dingcard-mcp 0.59.0 → 0.60.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.
- package/dist/app/assets/{MarkdownEditor-DDmv6m-x.js → MarkdownEditor-D1UaIr2y.js} +1 -1
- package/dist/app/assets/{jszip.min-Bke3tEl4.js → jszip.min-Dh_Y8aD6.js} +1 -1
- package/dist/app/assets/{main-9ISg6ah0.js → main-BDVCVLc1.js} +92 -86
- package/dist/app/assets/{paginate-CrvyT_J7.js → paginate-CywTJr2d.js} +1 -1
- package/dist/app/assets/{render-BCI8TA6e.js → render-CCSRSldx.js} +1 -1
- package/dist/app/index.html +2 -2
- package/dist/app/render.html +2 -2
- package/dist/index.mjs +186 -10
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jszip.min-
|
|
2
|
-
var C1=Object.defineProperty;var E1=(e,n,r)=>n in e?C1(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var ga=(e,n,r)=>E1(e,typeof n!="symbol"?n+"":n,r);import{r as p,j as t,t as i,s as Et,a as di,p as z1,D as Kn,n as R1,c as zr,d as Zh,F as Xh,e as qh,f as Qh,g as I1,h as Jh,P as mr,i as bl,k as Ls,C as yl,m as cd,u as na,L as fc,l as em,o as jl,q as Bs,A as tm,v as ka,w as L1,x as wl,y as dd,z as kl,B as Pc,E as nm,G as rm,H as am,I as Ks,J as xt,K as Tc,M as $1,N as si,O as im,Q as ll,R as D1,S as Wc,T as Hc,U as A1,V as Qu,W as Ju,X as hc,Y as oi,Z as _r,_ as rr,$ as ef,a0 as tf,a1 as P1,a2 as Oc,a3 as T1,a4 as nf,a5 as W1,a6 as H1,a7 as O1,a8 as _1,a9 as B1,aa as K1,ab as V1,ac as cl,ad as G1,ae as ye,af as Sl,ag as _c,ah as Bc,ai as U1,aj as Qt,ak as Vs,al as Bi,am as sm,an as Lr,ao as As,ap as ui,aq as Kc,ar as Y1,as as nr,at as hr,au as Ki,av as Ps,aw as Ur,ax as Tn,ay as jt,az as Gr,aA as ud,aB as om,aC as Z1,aD as X1,aE as q1,aF as lm,aG as cm,aH as Wn,aI as Q1,aJ as ni,aK as J1,aL as dm,aM as dl,aN as ul,aO as Gn,aP as ri,aQ as Ao,aR as eg,aS as mc,aT as tg,aU as ng,aV as ks,aW as Es,aX as pc,aY as rg,aZ as ag,a_ as ig,a$ as rf,b0 as af,b1 as sg,b2 as og,b3 as sf,b4 as gc,b5 as Fr,b6 as lg,b7 as cg,b8 as xc,b9 as xa,ba as dg,bb as of,bc as ug,bd as fg,be as lf,bf as cf,bg as hg,bh as mg,bi as pg,bj as gg,bk as xg,bl as bg,bm as yg,bn as jg,bo as wg,bp as kg,bq as Sg,br as vg,bs as Ng,bt as Mg,bu as Fg,bv as df,bw as uf,bx as Cg,by as Eg,bz as zg,bA as Rg,bB as Ig,bC as Lg,bD as $g,bE as Dg,bF as Ag,bG as Pg,bH as ff,bI as Tg,bJ as Wg,bK as Po,bL as Hg,bM as Og,bN as _g,bO as Bg,bP as Kg,bQ as Vg,bR as Gg,bS as hn,bT as Ug,bU as Yg,bV as Zg,bW as Xg,bX as qg,bY as hf,bZ as mf,b_ as Qg,b$ as Jg,c0 as e2,c1 as t2,c2 as n2,c3 as r2,c4 as a2,c5 as i2,c6 as s2,c7 as o2,c8 as um,c9 as fm,ca as l2,cb as c2,cc as pf,cd as d2,ce as u2,cf as f2,cg as h2,ch as m2,ci as p2,cj as gf,ck as g2,cl as x2,cm as b2,cn as y2,co as j2,cp as w2}from"./paginate-CrvyT_J7.js";const vl="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%20role='img'%20aria-label='叮卡'%3e%3ctitle%3e叮卡%3c/title%3e%3cdefs%3e%3clinearGradient%20id='dc-base'%20x1='0'%20y1='0'%20x2='64'%20y2='64'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0%25'%20stop-color='%231c1917'/%3e%3cstop%20offset='100%25'%20stop-color='%2309090b'/%3e%3c/linearGradient%3e%3clinearGradient%20id='dc-amber'%20x1='20'%20y1='12'%20x2='48'%20y2='40'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0%25'%20stop-color='%23fb923c'/%3e%3cstop%20offset='100%25'%20stop-color='%23ea580c'/%3e%3c/linearGradient%3e%3clinearGradient%20id='dc-rim'%20x1='0'%20y1='0'%20x2='0'%20y2='64'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0%25'%20stop-color='%23ffffff'%20stop-opacity='0.18'/%3e%3cstop%20offset='100%25'%20stop-color='%23ffffff'%20stop-opacity='0.04'/%3e%3c/linearGradient%3e%3cfilter%20id='dc-glow'%20x='-20%25'%20y='-20%25'%20width='140%25'%20height='140%25'%3e%3cfeGaussianBlur%20stdDeviation='2'%20result='blur'/%3e%3cfeComposite%20in='SourceGraphic'%20in2='blur'%20operator='over'/%3e%3c/filter%3e%3c/defs%3e%3c!--%20曜石质感圆角底板%20--%3e%3crect%20width='64'%20height='64'%20rx='16'%20fill='url(%23dc-base)'/%3e%3crect%20width='64'%20height='64'%20rx='16'%20fill='none'%20stroke='url(%23dc-rim)'%20stroke-width='1.5'/%3e%3c!--%20负空间几何切片字标%20'D'%20--%3e%3cg%20transform='translate(2,%200)'%3e%3c!--%20左侧卡片主轴%20(Spine)%20--%3e%3crect%20x='15'%20y='14'%20width='7'%20height='36'%20rx='3.5'%20fill='%23f4f4f5'/%3e%3c!--%20右侧上半切片%20(Amber%20Slice)%20--%3e%3cpath%20d='M26%2014H35C42.732%2014%2049%2020.268%2049%2028C49%2029.5%2048.7%2030.9%2048.1%2032.2L36.5%2020.6C35.7%2019.8%2034.6%2019.3%2033.4%2019.3H26V14Z'%20fill='url(%23dc-amber)'/%3e%3c!--%20右侧下半切片%20(Light%20Slice)%20--%3e%3cpath%20d='M26%2026.5L43.5%2044H35C30.0294%2044%2026%2039.9706%2026%2035V26.5Z'%20fill='%23f4f4f5'%20fill-opacity='0.92'/%3e%3c!--%20裁切缝微光核心%20(Spark)%20--%3e%3ccircle%20cx='37'%20cy='27'%20r='2.5'%20fill='%23ffffff'%20filter='url(%23dc-glow)'/%3e%3ccircle%20cx='37'%20cy='27'%20r='1.5'%20fill='%23ffffff'/%3e%3c/g%3e%3c/svg%3e",k2=["button","input","textarea","select",'[tabindex]:not([tabindex="-1"])'].join(",");function bc(e){return Array.from(e.querySelectorAll(k2)).filter(n=>n.tabIndex>=0&&!n.matches(":disabled")&&!n.closest("[inert]")&&n.getClientRects().length>0&&window.getComputedStyle(n).visibility!=="hidden")}function S2({onAuthed:e,onClose:n}){const r=p.useId(),s=p.useRef(null),l=p.useRef(null),o=p.useRef(null),c=p.useRef(null),[f,h]=p.useState("login"),[g,x]=p.useState(""),[m,j]=p.useState(""),[k,v]=p.useState(null),[w,N]=p.useState(!1);async function M(F){var z;F.preventDefault(),v(null),document.activeElement===o.current&&((z=l.current)==null||z.focus()),N(!0);try{const A=f==="login"?await Et.auth.login(g,m):await Et.auth.register(g,m);e(A)}catch(A){v(A instanceof Error?i(A.message):i("出错了,请重试"))}finally{N(!1)}}p.useEffect(()=>{const F=s.current;if(!F)return;const z=document.activeElement;z instanceof HTMLElement&&F.contains(z)&&(c.current=z);const A=T=>{var K;const L=T.target;if(L instanceof HTMLElement&&F.contains(L)){bc(F).includes(L)&&(c.current=L);return}const H=bc(F),P=c.current,U=P&&H.includes(P)?P:H[0];U==null||U.focus(),F.contains(document.activeElement)||(K=H[0])==null||K.focus(),F.contains(document.activeElement)||F.focus()};return document.addEventListener("focusin",A),()=>document.removeEventListener("focusin",A)},[]);function I(F){var H;if(F.key==="Escape"){F.preventDefault(),F.stopPropagation(),n();return}if(F.key!=="Tab")return;const z=s.current;if(!z)return;const A=bc(z);if(A.length===0){F.preventDefault();return}const T=A.indexOf(document.activeElement),L=F.shiftKey?T<=0?A.length-1:T-1:T<0||T===A.length-1?0:T+1;F.preventDefault(),(H=A[L])==null||H.focus()}return t.jsx("div",{className:"sheet-backdrop",onClick:n,children:t.jsxs("div",{ref:s,className:"sheet",role:"dialog",tabIndex:-1,"aria-modal":"true","aria-labelledby":r,onClick:F=>F.stopPropagation(),onKeyDown:I,children:[t.jsx("h2",{id:r,className:"sr-only",children:i("账户登录与注册")}),t.jsxs("div",{className:"sheet-tabs",children:[t.jsx("button",{className:f==="login"?"sheet-tab on":"sheet-tab",onClick:()=>{h("login"),v(null)},children:i("登录")}),t.jsx("button",{className:f==="register"?"sheet-tab on":"sheet-tab",onClick:()=>{h("register"),v(null)},children:i("注册")})]}),t.jsxs("form",{className:"sheet-body",onSubmit:M,children:[t.jsxs("label",{className:"field",children:[t.jsx("span",{className:"field-label",children:i("用户名")}),t.jsx("input",{className:"text-input",value:g,autoFocus:!0,onChange:F=>x(F.target.value),placeholder:i("至少 2 个字符")})]}),t.jsxs("label",{className:"field",children:[t.jsx("span",{className:"field-label",children:i("密码")}),t.jsx("input",{className:"text-input",type:"password",value:m,onChange:F=>j(F.target.value),placeholder:i("至少 4 个字符")})]}),k&&t.jsx("div",{className:"form-error",role:"alert","aria-live":"polite",children:k}),t.jsx("p",{className:"form-note",children:Et.remote?i("账号会安全保存到你的服务器,可在登录后跨设备同步草稿。"):i("账号仅保存在此浏览器本地,不会上传,也不能跨设备同步。")}),t.jsxs("div",{className:"sheet-foot",children:[t.jsx("button",{ref:l,type:"button",className:"ghost",onClick:n,children:i("取消")}),t.jsx("button",{ref:o,type:"submit",className:"accent",disabled:w,children:w?i("请稍候…"):f==="login"?i("登录"):i("创建账号")})]})]})]})})}const $s="dingcard.guest.v1",hm="dingcard.guest-move-declined.v1";function v2(){try{if(localStorage.getItem($s)==="1")return!0}catch{}try{return sessionStorage.getItem($s)==="1"}catch{return!1}}function N2(e){try{e?localStorage.setItem($s,"1"):localStorage.removeItem($s)}catch{}try{sessionStorage.removeItem($s)}catch{}}function mm(){try{const e=JSON.parse(localStorage.getItem(hm)??"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function M2(e){const n=mm()[e];return typeof n=="number"&&Number.isFinite(n)?n:0}function F2(e,n){try{localStorage.setItem(hm,JSON.stringify({...mm(),[e]:n}))}catch{}}const C2={md:"markdown-card",canvas:"freeform-slide"};function Fi(e){return e==="markdown-card"?"md":"canvas"}function yc(e){return e?C2[e]??null:null}function xf(e){if(!e)return null;const n=Number.parseInt(e,10);return Number.isFinite(n)&&n>0?n:null}function E2(e){const n=e.replace(/^#/,""),[r,s=""]=n.split("?"),l=r.split("/").filter(Boolean),o=new URLSearchParams(s);switch(l[0]){case void 0:return{name:"home"};case"login":return{name:"login"};case"projects":return{name:"projects",system:yc(o.get("system"))};case"templates":return{name:"templates",system:yc(o.get("system"))};case"assets":return{name:"assets"};case"edit":{const c=yc(l[1]??null),f=l[2];let h=null;return c&&f==="new"?h={kind:"new",platformId:o.get("platform"),width:xf(o.get("w")),height:xf(o.get("h"))}:c&&f==="template"&&l[3]?h={kind:"template",templateId:decodeURIComponent(l[3])}:c==="freeform-slide"&&f==="import"&&o.get("url")?h={kind:"import",url:o.get("url"),title:o.get("title")}:c&&f&&(h={kind:"open",draftId:decodeURIComponent(f)}),{name:"edit",system:c,intent:h}}default:return{name:"home"}}}function Rt(e,n={}){const r=e.startsWith("#")?e:`#${e}`;if(n.replace){history.replaceState(history.state,"",r),window.dispatchEvent(new HashChangeEvent("hashchange"));return}location.hash!==r&&(location.hash=r)}function z2(e){return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)}function bf(){return location.hash}function R2(){const e=p.useSyncExternalStore(z2,bf,bf);return p.useMemo(()=>E2(e),[e])}const ft={home:"/",login:"/login",projects:e=>e?`/projects?system=${Fi(e)}`:"/projects",templates:e=>e?`/templates?system=${Fi(e)}`:"/templates",assets:"/assets",editor:e=>e?`/edit/${Fi(e)}`:"/edit",openProject:(e,n)=>`/edit/${Fi(e)}/${encodeURIComponent(n)}`,newProject:(e,n={})=>{const r=new URLSearchParams;n.platformId&&r.set("platform",n.platformId),n.width&&r.set("w",String(n.width)),n.height&&r.set("h",String(n.height));const s=r.toString();return`/edit/${Fi(e)}/new${s?`?${s}`:""}`},fromTemplate:(e,n)=>`/edit/${Fi(e)}/template/${encodeURIComponent(n)}`};class rl extends p.Component{constructor(){super(...arguments);ga(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r instanceof Error?r:new Error(String(r))}}componentDidUpdate(r){this.state.error&&!Object.is(r.resetKey,this.props.resetKey)&&this.setState({error:null})}render(){const{error:r}=this.state;return r?t.jsx(I2,{error:r,scope:this.props.scope,fullPage:this.props.fullPage}):this.props.children}}function I2({error:e,scope:n,fullPage:r=!1}){return t.jsxs("div",{className:r?"crash-fallback is-full-page":"crash-fallback",role:"alert","data-testid":"crash-fallback",children:[t.jsx("b",{children:n==="editor"?i("编辑器出错了"):i("页面出错了")}),t.jsx("code",{className:"crash-fallback-error",children:e.message||e.name}),t.jsxs("div",{className:"crash-fallback-actions",children:[t.jsx("button",{className:"primary",type:"button",onClick:()=>window.location.reload(),children:i("重新加载")}),t.jsx("button",{className:"ghost",type:"button",onClick:()=>{Rt(ft.home),window.location.reload()},children:i("回到首页")})]})]})}function Oe({children:e,...n}){return t.jsx("svg",{viewBox:"0 0 16 16",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",...n,children:e})}function pm(e){return t.jsxs(Oe,{...e,children:[t.jsx("circle",{cx:"8",cy:"8",r:"2.75"}),t.jsx("path",{d:"M8 1.75v1.5M8 12.75v1.5M1.75 8h1.5M12.75 8h1.5M3.58 3.58l1.06 1.06M11.36 11.36l1.06 1.06M3.58 12.42l1.06-1.06M11.36 4.64l1.06-1.06"})]})}function fd(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M13.25 9.9A5.5 5.5 0 1 1 6.1 2.75a4.4 4.4 0 0 0 7.15 7.15Z"})})}function Qi(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M9.75 3.75 5.5 8l4.25 4.25"})})}function gm(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M6.25 3.75 10.5 8l-4.25 4.25"})})}function li(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M8 2.5v7.75M4.75 7 8 10.25 11.25 7M3 13.25h10"})})}function xm(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M8 10.75V2.5M4.75 5.75 8 2.5l3.25 3.25M3.5 10.5v2a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1v-2"})})}function bm(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M3.75 8h8.5"})})}function fl(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M8 3.75v8.5M3.75 8h8.5"})})}function Pn(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"m4.25 4.25 7.5 7.5m0-7.5-7.5 7.5"})})}function L2(e){return t.jsx(Oe,{strokeWidth:"1.75",...e,children:t.jsx("path",{d:"M4.75 3h3.9a2.4 2.4 0 0 1 0 4.8h-3.9zM4.75 7.8h4.6a2.6 2.6 0 0 1 0 5.2h-4.6z"})})}function $2(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M10.75 3H6.75M9.25 13h-4M9.1 3 6.9 13"})})}function D2(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M3.25 3.5v9M6.5 5h6.25M6.5 8h6.25M6.5 11h4"})})}function A2(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M6.5 4.5h6.25M6.5 8h6.25M6.5 11.5h6.25"}),t.jsx("circle",{cx:"3.5",cy:"4.5",r:"0.5",fill:"currentColor"}),t.jsx("circle",{cx:"3.5",cy:"8",r:"0.5",fill:"currentColor"}),t.jsx("circle",{cx:"3.5",cy:"11.5",r:"0.5",fill:"currentColor"})]})}function P2(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M4 2.25v2.5a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-2.5M4 13.75v-2.5a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2.5M2 8h1.5M6.25 8h3.5M12.5 8H14"})})}function T2(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M2.75 7 8 2.75 13.25 7v6.25a.75.75 0 0 1-.75.75H10V9.75H6V14H3.5a.75.75 0 0 1-.75-.75z"})})}function ym(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"2.25",y:"2.25",width:"4.75",height:"4.75",rx:"1"}),t.jsx("rect",{x:"9",y:"2.25",width:"4.75",height:"4.75",rx:"1"}),t.jsx("rect",{x:"2.25",y:"9",width:"4.75",height:"4.75",rx:"1"}),t.jsx("rect",{x:"9",y:"9",width:"4.75",height:"4.75",rx:"1"})]})}function Vi(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"2.25",y:"2.25",width:"11.5",height:"11.5",rx:"1.75"}),t.jsx("path",{d:"M2.25 6.25h11.5M6.25 6.25v7.5"})]})}function W2(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M8 2.25a5.75 5.75 0 0 0 0 11.5c.83 0 1.35-.55 1.35-1.22 0-.33-.13-.6-.33-.86-.2-.25-.33-.53-.33-.86 0-.67.55-1.2 1.22-1.2h1.38a2.46 2.46 0 0 0 2.46-2.46C13.75 4.4 11.18 2.25 8 2.25Z"}),t.jsx("circle",{cx:"5.1",cy:"7.4",r:".55"}),t.jsx("circle",{cx:"6.6",cy:"5",r:".55"}),t.jsx("circle",{cx:"9.5",cy:"4.9",r:".55"})]})}function Gs(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"2.25",y:"2.25",width:"11.5",height:"11.5",rx:"1.75"}),t.jsx("circle",{cx:"6",cy:"6",r:"1.1"}),t.jsx("path",{d:"m13.75 10.25-3.25-3.25-7.75 6.75"})]})}function Ma(e){return t.jsxs(Oe,{...e,children:[t.jsx("circle",{cx:"7.25",cy:"7.25",r:"4.5"}),t.jsx("path",{d:"m13.5 13.5-2.9-2.9"})]})}function Us(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"1.5",y:"3.5",width:"13",height:"9",rx:"1.75"}),t.jsx("path",{d:"M4 10V6l1.75 2L7.5 6v4M11 6v3.75M9.6 8.6 11 10l1.4-1.4"})]})}function Gi(e){return t.jsxs(Oe,{...e,children:[t.jsx("circle",{cx:"5.75",cy:"5.75",r:"3.25"}),t.jsx("rect",{x:"8.25",y:"8.25",width:"5.5",height:"5.5",rx:"1"})]})}function Nl(e){return t.jsxs(Oe,{...e,children:[t.jsx("circle",{cx:"3.75",cy:"8",r:".75",fill:"currentColor"}),t.jsx("circle",{cx:"8",cy:"8",r:".75",fill:"currentColor"}),t.jsx("circle",{cx:"12.25",cy:"8",r:".75",fill:"currentColor"})]})}function jm(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"5.25",y:"5.25",width:"8.5",height:"8.5",rx:"1.5"}),t.jsx("path",{d:"M10.75 5.25V3.75a1.5 1.5 0 0 0-1.5-1.5h-5.5a1.5 1.5 0 0 0-1.5 1.5v5.5a1.5 1.5 0 0 0 1.5 1.5h1.5"})]})}function Ji(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M2.75 4.5h10.5M6.5 7.25v4M9.5 7.25v4M3.75 4.5l.6 8.4a1 1 0 0 0 1 .85h5.3a1 1 0 0 0 1-.85l.6-8.4M6 4.5V2.75h4V4.5"})})}function Vc(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M6.25 13.75H3.5a1 1 0 0 1-1-1v-9.5a1 1 0 0 1 1-1h2.75M10.5 11l3-3-3-3M13.5 8H6.25"})})}function pr(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M8 13.25V5.5M4.75 8.5 8 5.25l3.25 3.25M3 2.75h10"})})}function hl(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"3.25",y:"7",width:"9.5",height:"6.75",rx:"1.5"}),t.jsx("path",{d:"M5.5 7V5.25a2.5 2.5 0 0 1 5 0V7"})]})}function hd(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"m4.25 6.25 3.75 3.75 3.75-3.75"})})}function md(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"m10.25 2.75 3 3-7.5 7.5-3.5.5.5-3.5z"}),t.jsx("path",{d:"m8.75 4.25 3 3"})]})}function H2(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"m3.25 8.25 3 3 6.5-6.5"})})}function yf(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"2.25",y:"2.75",width:"11.5",height:"10.5",rx:"2"}),t.jsx("path",{d:"M6.25 2.75v10.5"})]})}function O2(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"2.25",y:"2.75",width:"11.5",height:"10.5",rx:"2"}),t.jsx("path",{d:"M9.75 2.75v10.5"})]})}function _2(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"4.25",y:"1.75",width:"7.5",height:"5",rx:"1.25"}),t.jsx("rect",{x:"4.25",y:"9.25",width:"7.5",height:"5",rx:"1.25"})]})}function wm(e){return t.jsxs(Oe,{...e,children:[t.jsx("circle",{cx:"8",cy:"8",r:"5.75"}),t.jsx("path",{d:"M2.25 8h11.5M8 2.25c1.6 1.7 2.4 3.6 2.4 5.75S9.6 12.05 8 13.75C6.4 12.05 5.6 10.15 5.6 8S6.4 3.95 8 2.25Z"})]})}function B2(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M5.5 4.25 2.75 7l2.75 2.75"}),t.jsx("path",{d:"M2.75 7h6.5a4 4 0 0 1 0 8h-2"})]})}function K2(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M10.5 4.25 13.25 7l-2.75 2.75"}),t.jsx("path",{d:"M13.25 7h-6.5a4 4 0 0 0 0 8h2"})]})}function km(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M3 4.25V3h10v1.25M8 3v10M6 13h4"})})}function Sm(e){return t.jsxs(Oe,{...e,children:[t.jsx("circle",{cx:"5.5",cy:"5.5",r:"3"}),t.jsx("path",{d:"M8.75 8.75h4.5v4.5h-4.5z"}),t.jsx("path",{d:"m10.75 2.25 2.5 4.25h-5z"})]})}function V2(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M3 13 13 3"}),t.jsx("path",{d:"M9 3h4v4"})]})}function G2(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M2.75 12.75c1.75-7.5 4.5-9 6-5.25s3.75 2.75 4.5-4.75"})})}function vm(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"2.25",y:"3",width:"11.5",height:"10",rx:"1.75"}),t.jsx("circle",{cx:"5.75",cy:"6.5",r:"1.1"}),t.jsx("path",{d:"m13.75 10.5-3.25-3-7.5 5.25"})]})}function _i({shape:e,...n}){const r={rect:t.jsx("rect",{x:"4",y:"6",width:"24",height:"20",rx:"3"}),ellipse:t.jsx("circle",{cx:"16",cy:"16",r:"11"}),triangle:t.jsx("path",{d:"M16 5 28 26H4z"}),star:t.jsx("path",{d:"m16 4 3.6 7.6 8.4 1-6.2 5.8 1.6 8.3L16 22.6l-7.4 4.1 1.6-8.3L4 12.6l8.4-1z"}),hexagon:t.jsx("path",{d:"M10 5h12l6 11-6 11H10L4 16z"}),diamond:t.jsx("path",{d:"M16 4 28 16 16 28 4 16z"}),pentagon:t.jsx("path",{d:"M16 4 28 13.4 23.3 27H8.7L4 13.4z"}),heart:t.jsx("path",{d:"M16 27 6.6 17.6C3.1 14.1 3.1 8.7 6.6 6c3-2.4 7-1.6 9.4 1.4C18.4 4.4 22.4 3.6 25.4 6c3.5 2.7 3.5 8.1 0 11.6z"}),bubble:t.jsx("path",{d:"M6 6h20a4 4 0 0 1 4 4v9a4 4 0 0 1-4 4H15l-6 6v-6H6a4 4 0 0 1-4-4v-9a4 4 0 0 1 4-4z"}),qrcode:t.jsx("path",{d:"M5 5h8v8H5zM19 5h8v8h-8zM5 19h8v8H5zM18 18h3v3h-3zM23 18h4v4h-4zM18 23h3v4h-3zM23 24h4v4h-4z"}),chart:t.jsx("g",{fill:"none",stroke:"currentColor",strokeWidth:"2.6",strokeLinecap:"round",children:t.jsx("path",{d:"M7 27V17M16 27V5M25 27v-8"})}),table:t.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinejoin:"round",children:[t.jsx("rect",{x:"4",y:"6",width:"24",height:"20",rx:"2"}),t.jsx("path",{d:"M4 12.7h24M4 19.3h24M12 6v20M20 6v20"})]}),timeline:t.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",children:[t.jsx("path",{d:"M8 5v22"}),t.jsx("path",{d:"M8 8.5h14M8 16h10M8 23.5h13"})]}),progress:t.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",children:[t.jsx("circle",{cx:"16",cy:"16",r:"10",opacity:"0.3"}),t.jsx("path",{d:"M6 16a10 10 0 0 1 16-8"})]}),line:t.jsx("path",{d:"M5 27 27 5",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),arrow:t.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M5 27 26 6"}),t.jsx("path",{d:"M15 6h11v11"})]}),arrowBoth:t.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M6 26 26 6"}),t.jsx("path",{d:"M15 6h11v11"}),t.jsx("path",{d:"M17 26H6V15"})]})};return t.jsx("svg",{viewBox:"0 0 32 32",width:"32",height:"32",fill:"currentColor","aria-hidden":"true",focusable:"false",...n,children:r[e]??r.rect})}function U2(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"4.25",y:"1.75",width:"7.5",height:"12.5",rx:"1.5"}),t.jsx("path",{d:"M4.25 6h7.5M4.25 10h7.5"})]})}function Y2(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"2.25",y:"2.25",width:"11.5",height:"11.5",rx:"1.5"}),t.jsx("path",{d:"M6.08 2.25v11.5M9.92 2.25v11.5M2.25 6.08h11.5M2.25 9.92h11.5"})]})}function Z2(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"m8 2.5 5.5 2.75L8 8 2.5 5.25z"}),t.jsx("path",{d:"m2.5 8 5.5 2.75L13.5 8M2.5 10.75 8 13.5l5.5-2.75"})]})}function X2(e){return t.jsxs(Oe,{...e,children:[t.jsx("circle",{cx:"8",cy:"6",r:"2.75"}),t.jsx("path",{d:"M3 13.5c.7-2.3 2.7-3.75 5-3.75s4.3 1.45 5 3.75"})]})}function q2(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M4.5 12.25a3 3 0 0 1-.4-5.97 4 4 0 0 1 7.72-.9 3.2 3.2 0 0 1 .43 6.87z"}),t.jsx("path",{d:"m6.25 9 1.25 1.25L9.75 8"})]})}function Q2(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M6 12.25H4.5a3 3 0 0 1-.4-5.97 4 4 0 0 1 .8-1.73M7.1 3.1a4 4 0 0 1 4.72 2.28 3.2 3.2 0 0 1 1.83 5.6"}),t.jsx("path",{d:"m2.5 2.5 11 11"})]})}function J2(e){return t.jsxs(Oe,{...e,children:[t.jsx("circle",{cx:"8",cy:"8",r:"5.75"}),t.jsx("path",{d:"M8 5v3.5M8 10.9v.1"})]})}function jf(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M9.25 2.25H4.75a1 1 0 0 0-1 1v9.5a1 1 0 0 0 1 1h6.5a1 1 0 0 0 1-1V5.25z"}),t.jsx("path",{d:"M9.25 2.25v3h3M8 7v4.25M6.25 9.5 8 11.25 9.75 9.5"})]})}function ex(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"m8 2.5 5.5 2.75L8 8 2.5 5.25z"}),t.jsx("path",{d:"m2.5 8 5.5 2.75L13.5 8"})]})}function Nm(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M2.75 8a5.25 5.25 0 1 0 1.54-3.71"}),t.jsx("path",{d:"M2.75 2.75v2.5h2.5M8 5.25V8l1.75 1.25"})]})}function pd(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M3 10.75V4.5a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v6.25M1.75 12.5h12.5"}),t.jsx("path",{d:"m6.4 7.1 1.1 1.1 2.1-2.1"})]})}function tx(e,n){return e>0&&n>0?i("你没登录时做了 {projects} 个项目、存了 {assets} 张素材,都保存在这台设备上。",{projects:e,assets:n}):e>0?i("你没登录时做了 {n} 个项目,都保存在这台设备上。",{n:e}):i("你没登录时存了 {n} 张素材,都保存在这台设备上。",{n})}function nx({username:e,projects:n,assets:r,phase:s,onMove:l,onKeep:o}){const c=p.useId(),f=p.useId(),h=p.useRef(null),g=s.kind==="moving",x=p.useRef(g);x.current=g;const m=p.useRef(o);return m.current=o,p.useEffect(()=>{var v;const j=document.activeElement instanceof HTMLElement?document.activeElement:null;(v=h.current)==null||v.focus();const k=w=>{w.key!=="Escape"||x.current||(w.preventDefault(),m.current())};return window.addEventListener("keydown",k),()=>{window.removeEventListener("keydown",k),j!=null&&j.isConnected&&j.focus()}},[]),t.jsx("div",{className:"modal-backdrop",children:t.jsxs("div",{className:"modal confirm-modal guest-move-modal",role:"dialog","aria-modal":"true","aria-labelledby":c,"aria-describedby":f,"data-testid":"guest-move-dialog",children:[t.jsx("span",{className:"guest-move-icon","aria-hidden":"true",children:t.jsx(pd,{})}),t.jsx("h3",{id:c,className:"confirm-title",children:n>0?i("把这台设备上的项目放进账号?"):i("把这台设备上的素材放进账号?")}),t.jsxs("p",{id:f,className:"confirm-body",children:[tx(n,r),Et.remote?i("放进「{name}」后,换一台设备登录也能继续编辑。",{name:e}):i("放进「{name}」后,它们会出现在这个账号的「我的项目」里。",{name:e})]}),s.kind==="failed"&&t.jsx("p",{className:"form-error",role:"alert",children:i("还有 {n} 项没能放进账号:{error}",{n:s.failed,error:s.message})}),t.jsxs("div",{className:"modal-foot",children:[t.jsx("button",{className:"ghost",type:"button",onClick:o,disabled:g,"data-testid":"guest-move-keep",children:i("先留在本机")}),t.jsx("button",{ref:h,className:"accent",type:"button",onClick:l,disabled:g,"data-testid":"guest-move-confirm",children:g?i("正在放进账号… {done}/{total}",{done:s.done,total:s.total}):s.kind==="failed"?i("重试"):i("放进账号")})]})]})})}function Sa(e){const n=Math.round(e*10)/10;return Object.is(n,-0)?0:n}const nt=([e,n])=>`${Sa(e)} ${Sa(n)}`,ti=nt;function al(e,n){const r=Math.sin(e*12.9898+n*78.233)*43758.5453;return(r-Math.floor(r))*2-1}function Mm(e,n){const r=e.length,s=o=>n?e[(o+r)%r]:e[Math.max(0,Math.min(r-1,o))],l=n?r:r-1;return Array.from({length:l},(o,c)=>{const[f,h,g,x]=[s(c-1),s(c),s(c+1),s(c+2)],m=[h[0]+(g[0]-f[0])/6,h[1]+(g[1]-f[1])/6],j=[g[0]-(x[0]-h[0])/6,g[1]-(x[1]-h[1])/6];return{from:h,c1:m,c2:j,to:g}})}function Rr(e,n=!1){if(e.length<2)return"";const r=Mm(e,n);return`M${nt(e[0])}${r.map(({c1:s,c2:l,to:o})=>`C${nt(s)} ${nt(l)} ${nt(o)}`).join("")}${n?"Z":""}`}function cn(e,n=!1){return`M${e.map(nt).join("L")}${n?"Z":""}`}function Fm(e,n=10,r=!1){const s=[e[0]];for(const{from:l,c1:o,c2:c,to:f}of Mm(e,r))for(let h=1;h<=n;h+=1){const g=h/n,x=1-g;s.push([x*x*x*l[0]+3*x*x*g*o[0]+3*x*g*g*c[0]+g*g*g*f[0],x*x*x*l[1]+3*x*x*g*o[1]+3*x*g*g*c[1]+g*g*g*f[1]])}return s}function Ci(e,n,r={}){const{tip:s=.18,taper:l=.32,peak:o=.45}=r,c=Fm(e,8),f=[0];for(let m=1;m<c.length;m+=1)f.push(f[m-1]+Math.hypot(c[m][0]-c[m-1][0],c[m][1]-c[m-1][1]));const h=f[f.length-1]||1,g=[],x=[];return c.forEach((m,j)=>{const k=c[Math.max(0,j-1)],v=c[Math.min(c.length-1,j+1)],w=v[0]-k[0],N=v[1]-k[1],M=Math.hypot(w,N)||1,I=f[j]/h,F=Math.min(1,I/Math.max(.01,l*(o/.5))),z=Math.min(1,(1-I)/Math.max(.01,l*((1-o)/.5))),A=Math.sin(Math.min(F,z)*Math.PI/2),T=n/2*(s+(1-s)*A);g.push([m[0]-N/M*T,m[1]+w/M*T]),x.push([m[0]+N/M*T,m[1]-w/M*T])}),Rr([...g,...x.reverse()],!0)}function rx(e,n,r,s=28,l=0){const o=Math.atan2(e[1]-n[1],e[0]-n[0]),c=f=>{const h=o+Math.PI+f*((s+f*l)*Math.PI)/180;return[e[0]+Math.cos(h)*r,e[1]+Math.sin(h)*r]};return`M${nt(c(1))}L${nt(e)}L${nt(c(-1))}`}function Xa(e,n,r,s,l,o=0){return Array.from({length:l*2},(c,f)=>{const h=f%2===0?r:s,g=-Math.PI/2+f*Math.PI/l+o*Math.PI/180;return[e+Math.cos(g)*h,n+Math.sin(g)*h]})}function Ei(e,n){const r=e.length,s=e.map((l,o)=>{const c=e[(o-1+r)%r],f=e[(o+1)%r],h=g=>{const x=g[0]-l[0],m=g[1]-l[1],j=Math.hypot(x,m)||1,k=Math.min(n,j/2);return[l[0]+x/j*k,l[1]+m/j*k]};return{corner:l,enter:h(c),leave:h(f)}});return`M${nt(s[0].leave)}${s.slice(1).concat(s[0]).map(({corner:l,enter:o,leave:c})=>`L${nt(o)}Q${nt(l)} ${nt(c)}`).join("")}Z`}function To(e,n,r,s=.16){const l=r*s;return`M${nt([e,n-r])}Q${nt([e+l,n-l])} ${nt([e+r,n])}Q${nt([e+l,n+l])} ${nt([e,n+r])}Q${nt([e-l,n+l])} ${nt([e-r,n])}Q${nt([e-l,n-l])} ${nt([e,n-r])}Z`}function ax(e,n,r,s){const l=(o,c)=>[e+o*r,n+c*s];return`M${nt(l(.5,.26))}C${nt(l(.42,.06))} ${nt(l(.06,.02))} ${nt(l(.02,.33))}C${nt(l(-.02,.62))} ${nt(l(.3,.8))} ${nt(l(.5,.98))}C${nt(l(.7,.8))} ${nt(l(1.02,.62))} ${nt(l(.98,.33))}C${nt(l(.94,.02))} ${nt(l(.58,.06))} ${nt(l(.5,.26))}Z`}function Dn(e,n,r){return`M${nt([e-r,n])}A${Sa(r)} ${Sa(r)} 0 1 0 ${nt([e+r,n])}A${Sa(r)} ${Sa(r)} 0 1 0 ${nt([e-r,n])}Z`}function ix(e,n,r,s,l=.08){const o=r*(1-l),c=Array.from({length:s},(h,g)=>{const x=-Math.PI/2+g*2*Math.PI/s;return[e+Math.cos(x)*o,n+Math.sin(x)*o]}),f=2*Math.PI*o/s/2;return`M${nt(c[0])}${c.slice(1).concat([c[0]]).map(h=>`A${Sa(f)} ${Sa(f)} 0 0 1 ${nt(h)}`).join("")}Z`}function sx(e,n,r,s,l={}){const{turns:o=1.14,start:c=200,tilt:f=-4,spread:h=.07,seed:g=1,steps:x=22}=l,m=f*Math.PI/180;return Array.from({length:x+1},(j,k)=>{const v=k/x,w=(c+360*o*v)*Math.PI/180,N=1+h*(v-.5)+.015*al(g,k),M=Math.cos(w)*r*N,I=Math.sin(w)*s*N;return[e+M*Math.cos(m)-I*Math.sin(m),n+M*Math.sin(m)+I*Math.cos(m)]})}function ox(e,n,r,s,l){const o=l*4;return Array.from({length:o+1},(c,f)=>{const h=f*Math.PI/2;return[e+r*f/o,n-Math.sin(h)*s]})}function lx(e,n,r,s,l=40){return Array.from({length:l+1},(o,c)=>{const f=c/l,h=f*s*2*Math.PI,g=r*(.08+.92*f);return[e+Math.cos(h)*g,n+Math.sin(h)*g]})}const cx=[{id:"hand-drawn",zh:"手绘线条",en:"Hand-drawn"},{id:"sticker",zh:"贴纸",en:"Stickers"},{id:"label",zh:"标签",en:"Labels"}],qt="#1c1917",zi="#e8453c",Br="#ffd23f",wf="#ffc53d",dx="#1f9d63",ux="#ff7a9c",Cm="PingFang SC, Microsoft YaHei, system-ui, sans-serif",fx="'LXGW WenKai TC', cursive";function Gc(e){const n=Number.parseInt(e.slice(1),16);return[n>>16&255,n>>8&255,n&255]}function Ri(e,n,r){const s=Gc(e),l=Gc(n);return`#${s.map((o,c)=>Math.round(o+(l[c]-o)*r).toString(16).padStart(2,"0")).join("")}`}function er(e){const[n,r,s]=Gc(e).map(o=>{const c=o/255;return c<=.03928?c/12.92:((c+.055)/1.055)**2.4});return 1.05/(.2126*n+.7152*r+.0722*s+.05)>=3?"#ffffff":qt}const mn=(e,n,r)=>({kind:"path",d:e,stroke:n,strokeWidth:r}),Je=(e,n,r)=>({kind:"path",d:e,fill:n,...r?{stroke:r.color,strokeWidth:r.width}:{}}),fn={color:qt,width:4};function kf(e,n,r=30){const s=Fm(e,12),l=s[s.length-1],o=s[s.length-4];return Rr(e)+rx(l,o,n,r)}function hx(e,n,r,s,l){return r.map((o,c)=>{const f=o*Math.PI/180,h=typeof l=="number"?l:l[c],g=[e+Math.cos(f)*s,n+Math.sin(f)*s],x=[e+Math.cos(f)*h,n+Math.sin(f)*h];return cn([g,x])}).join("")}function mx(e,n,r,s,l,o){const c=r*Math.PI/180,[f,h]=[Math.cos(c),Math.sin(c)],[g,x]=[-h*(o/2),f*(o/2)],m=(k,v)=>[e+f*k+g*v,n+h*k+x*v],j=o/2;return`M${ti(m(s,1))}L${ti(m(l,1))}A${j} ${j} 0 0 0 ${ti(m(l,-1))}L${ti(m(s,-1))}A${j} ${j} 0 0 0 ${ti(m(s,1))}Z`}function Sf(e,n,r,s,l){const o=Math.PI/r,c=s*Math.cos(o),f=Math.sqrt(Math.max(0,l*l-(s*Math.sin(o))**2)),h=Array.from({length:r},(x,m)=>{const j=-Math.PI/2+(2*m+1)*o;return[e+Math.cos(j)*(c+f),n+Math.sin(j)*(c+f)]}),g=h[r-1];return`M${ti(g)}${h.map(x=>`A${l} ${l} 0 1 1 ${ti(x)}`).join("")}Z`}function tr(e,n,r,s,l={}){return{kind:"text",...n,text:e.text,fontSize:r,color:s,fontFamily:Cm,fontWeight:"bold",...l}}const Ui=[{id:"circle-scribble",zh:"手绘圈",en:"Scribble circle",category:"hand-drawn",keywords:"圈 圈出 圆圈 重点 强调 circle ring highlight",width:240,height:140,color:zi,share:.4,parts:({color:e})=>[Je(Ci(sx(120,70,104,54,{turns:1.1,start:196,tilt:-5,spread:.08,seed:3}),8,{tip:.3,taper:.12,peak:.25}),e)]},{id:"underline-brush",zh:"手绘下划线",en:"Brush underline",category:"hand-drawn",keywords:"下划线 划线 强调 underline swoosh",width:320,height:44,color:zi,share:.42,parts:({color:e})=>[Je(Ci([[10,34],[70,25],[160,19],[250,17],[310,21]],16,{tip:.12,taper:.45,peak:.3}),e)]},{id:"underline-wave",zh:"波浪线",en:"Wavy line",category:"hand-drawn",keywords:"波浪 下划线 曲线 wave squiggle underline",width:300,height:40,color:zi,share:.4,parts:({color:e})=>[mn(Rr(ox(8,20,284,9,4).map(([n,r],s)=>[n,r+al(7,s)*1.5])),e,5)]},{id:"underline-double",zh:"双下划线",en:"Double underline",category:"hand-drawn",keywords:"下划线 双线 强调 double underline",width:300,height:40,color:qt,share:.4,parts:({color:e})=>[mn(Rr([[8,14],[110,10],[210,12],[292,9]])+Rr([[36,31],[140,27],[262,30]]),e,4.5)]},{id:"arrow-curved",zh:"弧形箭头",en:"Curved arrow",category:"hand-drawn",keywords:"箭头 指向 弯 arrow curve point",width:200,height:150,color:qt,share:.26,parts:({color:e})=>[mn(kf([[16,132],[44,84],[104,46],[182,34]],28),e,5)]},{id:"arrow-loop",zh:"绕圈箭头",en:"Loop arrow",category:"hand-drawn",keywords:"箭头 绕圈 指向 arrow loop curl",width:280,height:150,color:qt,share:.32,parts:({color:e})=>[mn(kf([[12,120],[70,112],[128,86],[150,50],[128,22],[102,40],[112,84],[164,112],[222,106],[266,74]],28),e,5)]},{id:"emphasis-marks",zh:"强调线",en:"Emphasis marks",category:"hand-drawn",keywords:"强调 惊叹 亮点 闪 emphasis accent shine",width:100,height:100,color:qt,share:.12,parts:({color:e})=>[Je([-104,-62,-20].map((n,r)=>{const s=n*Math.PI/180,l=[70,76,68][r];return Ci([[14+Math.cos(s)*26,86+Math.sin(s)*26],[14+Math.cos(s)*l,86+Math.sin(s)*l]],9,{tip:.35,taper:.5})}).join(""),e)]},{id:"radiate",zh:"放射线",en:"Burst lines",category:"hand-drawn",keywords:"放射 发光 亮点 爆炸 burst rays shine",width:120,height:120,color:qt,share:.16,parts:({color:e})=>[mn(hx(60,60,[-90,-45,0,45,90,135,180,225],30,[54,46,54,46,54,46,54,46]),e,5)]},{id:"check-hand",zh:"手绘对勾",en:"Hand-drawn check",category:"hand-drawn",keywords:"对勾 勾 正确 完成 check tick yes",width:130,height:110,color:dx,share:.16,parts:({color:e})=>[Je(Ci([[12,56],[32,76],[50,96],[80,58],[122,12]],15,{tip:.3,taper:.3,peak:.3}),e)]},{id:"cross-hand",zh:"手绘叉",en:"Hand-drawn cross",category:"hand-drawn",keywords:"叉 错误 不要 避雷 cross wrong no",width:110,height:110,color:zi,share:.14,parts:({color:e})=>[Je(Ci([[18,16],[56,54],[94,96]],14,{tip:.3,taper:.3})+Ci([[92,18],[56,56],[16,94]],14,{tip:.3,taper:.3}),e)]},{id:"star-hand",zh:"手绘星星",en:"Hand-drawn star",category:"hand-drawn",keywords:"星星 星 收藏 star doodle",width:140,height:136,color:qt,share:.16,parts:({color:e})=>{const n=Xa(70,74,62,27,5).map(([r,s],l)=>[r+al(5,l)*2,s+al(9,l)*2]);return[mn(cn([...n,n[0],[n[0][0]+(n[1][0]-n[0][0])*.25,n[0][1]+(n[1][1]-n[0][1])*.25]]),e,5)]}},{id:"heart-hand",zh:"手绘爱心",en:"Hand-drawn heart",category:"hand-drawn",keywords:"爱心 心 喜欢 heart love doodle",width:140,height:128,color:zi,share:.16,parts:({color:e})=>[mn(Rr([[70,38],[56,16],[30,10],[12,28],[10,52],[26,78],[50,100],[70,120],[91,99],[115,77],[131,51],[128,27],[110,10],[84,15],[72,34],[66,48]]),e,5.5)]},{id:"spiral",zh:"螺旋",en:"Spiral",category:"hand-drawn",keywords:"螺旋 旋转 晕 spiral swirl",width:120,height:120,color:qt,share:.14,parts:({color:e})=>[mn(Rr(lx(60,60,52,2.6,36)),e,5)]},{id:"corner-frame",zh:"取景框",en:"Corner frame",category:"hand-drawn",keywords:"框 边框 角 取景 frame corners brackets",width:260,height:180,color:qt,share:.44,parts:({color:e})=>[mn("M8 52V8H52M208 8H252V52M252 128V172H208M52 172H8V128",e,6)]},{id:"zigzag",zh:"锯齿线",en:"Zigzag",category:"hand-drawn",keywords:"锯齿 折线 下划线 zigzag underline",width:280,height:36,color:qt,share:.38,parts:({color:e})=>[mn(cn(Array.from({length:11},(n,r)=>[8+r*26.4,r%2===0?27:9])),e,5)]},{id:"marker-band",zh:"荧光笔",en:"Highlighter",category:"hand-drawn",keywords:"荧光笔 高亮 涂抹 马克笔 highlighter marker",width:320,height:64,color:"#ffe14d",share:.42,parts:({color:e})=>[{kind:"path",d:Rr([[16,14],[110,11],[210,12],[304,9],[312,20],[306,30],[313,41],[302,54],[200,52],[100,55],[18,53],[9,43],[15,33],[8,23]],!0),fill:e,blendMode:"multiply"}]},{id:"sparkle",zh:"闪光",en:"Sparkle",category:"sticker",keywords:"闪光 星光 亮 闪 sparkle shine twinkle",width:100,height:100,color:wf,share:.1,parts:({color:e})=>[Je(To(50,50,48,.14),e)]},{id:"sparkles",zh:"闪闪",en:"Sparkles",category:"sticker",keywords:"闪光 星光 亮晶晶 闪 sparkles shine twinkle",width:150,height:150,color:wf,share:.14,parts:({color:e})=>[Je(To(62,84,56,.14)+To(122,32,24,.16)+To(126,122,14,.18),e)]},{id:"star",zh:"星星",en:"Star",category:"sticker",keywords:"星星 星 五角星 收藏 star",width:130,height:126,color:Br,share:.13,parts:({color:e})=>[Je(Ei(Xa(65,69,58,25,5),7),e,fn)]},{id:"heart",zh:"爱心",en:"Heart",category:"sticker",keywords:"爱心 心 喜欢 点赞 heart love like",width:130,height:118,color:"#ff5c7a",share:.13,parts:({color:e})=>[Je(ax(8,8,114,104),e,fn)]},{id:"flower",zh:"小花",en:"Flower",category:"sticker",keywords:"花 小花 花朵 春天 flower blossom",width:130,height:130,color:ux,share:.13,parts:({color:e})=>[Je(Sf(65,65,5,33,27),e,fn),Je(Dn(65,65,15),Br,fn)]},{id:"sun",zh:"太阳",en:"Sun",category:"sticker",keywords:"太阳 晴天 阳光 夏天 sun sunny",width:150,height:150,color:"#ffb627",share:.15,parts:({color:e})=>[Je(Dn(75,75,33)+[0,45,90,135,180,225,270,315].map(n=>mx(75,75,n,45,66,11)).join(""),e,fn)]},{id:"cloud",zh:"云朵",en:"Cloud",category:"sticker",keywords:"云 云朵 天气 cloud",width:190,height:120,color:"#ffffff",share:.18,parts:({color:e})=>[Je("M38 104H154A27 27 0 0 0 162 51A37 37 0 0 0 96 32A31 31 0 0 0 46 56A25 25 0 0 0 38 104Z",e,fn)]},{id:"speech-bubble",zh:"对话气泡",en:"Speech bubble",category:"sticker",keywords:"对话 气泡 说话 聊天 speech bubble chat",width:190,height:150,color:"#ffffff",share:.2,parts:({color:e})=>[Je("M50 10H140A40 40 0 0 1 180 50V70A40 40 0 0 1 140 110H86L40 140L54 110H50A40 40 0 0 1 10 70V50A40 40 0 0 1 50 10Z",e,fn)]},{id:"crown",zh:"皇冠",en:"Crown",category:"sticker",keywords:"皇冠 王冠 第一 冠军 crown king winner",width:150,height:112,color:Br,share:.15,parts:({color:e})=>[Je(Ei([[24,100],[14,36],[48,62],[75,26],[102,62],[136,36],[126,100]],5)+Dn(14,30,8)+Dn(75,18,8)+Dn(136,30,8),e,fn)]},{id:"medal",zh:"奖章",en:"Medal",category:"sticker",keywords:"奖章 勋章 荣誉 冠军 第一 medal award badge winner",width:150,height:190,color:"#f5b301",share:.15,parts:({color:e})=>[Je(cn([[46,112],[74,126],[60,184],[47,168],[30,178]],!0)+cn([[104,112],[76,126],[90,184],[103,168],[120,178]],!0),zi,fn),Je(ix(75,75,66,18,.07),e,fn),Je(Dn(75,75,45),Ri(e,"#ffffff",.4),{color:qt,width:3}),Je(Ei(Xa(75,78,27,11.5,5),3),Ri(e,"#000000",.12))]},{id:"flame",zh:"火苗",en:"Flame",category:"sticker",keywords:"火 火苗 火热 爆款 热门 fire flame hot",width:110,height:150,color:"#ff5a36",share:.12,parts:({color:e})=>[Je("M55 8C70 38 98 56 98 94C98 124 78 142 55 142C32 142 12 124 12 96C12 72 26 60 34 42C38 58 44 64 50 66C47 44 50 26 55 8Z",e,fn),Je("M56 72C66 88 76 98 76 113C76 127 67 135 55 135C43 135 34 127 34 114C34 102 41 94 45 86C48 94 52 98 56 98C54 89 54 80 56 72Z",Br)]},{id:"lightning",zh:"闪电",en:"Lightning",category:"sticker",keywords:"闪电 电 快 能量 lightning bolt flash",width:100,height:150,color:Br,share:.11,parts:({color:e})=>[Je(Ei([[64,8],[18,84],[48,84],[34,142],[84,60],[54,60],[74,8]],4),e,fn)]},{id:"smile",zh:"笑脸",en:"Smiley",category:"sticker",keywords:"笑脸 开心 微笑 表情 smile happy face",width:130,height:130,color:Br,share:.13,parts:({color:e})=>[Je(Dn(65,65,57),e,fn),Je(`${Dn(46,52,7)}${Dn(84,52,7)}M36 74Q65 112 94 74Q65 96 36 74Z`,qt)]},{id:"rainbow",zh:"彩虹",en:"Rainbow",category:"sticker",keywords:"彩虹 雨后 希望 rainbow",width:210,height:120,color:"#ff6b6b",share:.22,parts:({color:e})=>[94,78,62,46].map((n,r)=>mn(`M${105-n} 112A${n} ${n} 0 0 1 ${105+n} 112`,[e,"#ffb23f","#ffe066","#4cc38a"][r],15))},{id:"balloon",zh:"气球",en:"Balloon",category:"sticker",keywords:"气球 生日 派对 庆祝 balloon party birthday",width:110,height:196,color:"#ff6b6b",share:.12,parts:({color:e})=>[mn(Rr([[55,136],[48,152],[60,168],[50,182],[56,192]]),qt,3),Je("M55 8C84 8 102 34 102 64C102 98 78 124 55 124C32 124 8 98 8 64C8 34 26 8 55 8ZM55 124L47 138H63Z",e,fn),mn("M28 56C30 40 40 28 54 24","#ffffff",6)]},{id:"gift",zh:"礼物",en:"Gift",category:"sticker",keywords:"礼物 礼盒 生日 节日 福利 gift present",width:140,height:140,color:"#ff7a9c",share:.13,parts:({color:e})=>[Je(`${cn([[18,64],[122,64],[122,132],[18,132]],!0)}${cn([[10,42],[130,42],[130,66],[10,66]],!0)}`,e,fn),Je(`${cn([[60,42],[80,42],[80,132],[60,132]],!0)}`,Br,fn),Je("M70 42C58 18 30 14 30 30C30 42 50 44 70 42ZM70 42C82 18 110 14 110 30C110 42 90 44 70 42Z",Br,fn)]},{id:"clover",zh:"四叶草",en:"Clover",category:"sticker",keywords:"四叶草 幸运 好运 草 clover lucky",width:130,height:150,color:"#4cc38a",share:.13,parts:({color:e})=>[mn(Rr([[65,66],[68,104],[80,128],[96,142]]),qt,5),Je(Sf(65,62,4,27,25),e,fn)]},{id:"tape",zh:"胶带",en:"Tape",category:"sticker",keywords:"胶带 和纸胶带 贴 照片 tape washi",width:220,height:64,color:"#f4b6b0",rotation:-6,share:.24,parts:({color:e})=>[{kind:"path",d:cn([[14,10],[206,10],[212,18],[206,26],[212,34],[206,42],[212,50],[206,56],[14,56],[8,48],[14,40],[8,32],[14,24],[8,16]],!0),fill:e,opacity:.85}]},{id:"paperclip",zh:"回形针",en:"Paper clip",category:"sticker",keywords:"回形针 别针 夹子 笔记 paperclip clip",width:70,height:170,color:"#8b939e",share:.1,parts:({color:e})=>[mn("M40 60V118A12 12 0 0 1 16 118V30A20 20 0 0 1 56 30V136A26 26 0 0 1 4 136V44",e,6)]},{id:"dots",zh:"点阵",en:"Dot grid",category:"sticker",keywords:"点阵 波点 圆点 网点 dots grid pattern",width:150,height:150,color:"#ff8a3d",share:.16,parts:({color:e})=>[Je(Array.from({length:25},(n,r)=>Dn(11+r%5*32,11+Math.floor(r/5)*32,6)).join(""),e)]},{id:"pill",zh:"胶囊标签",en:"Pill label",category:"label",keywords:"标签 胶囊 新 角标 pill tag badge new",width:200,height:56,color:"#ff4d4f",text:{zh:"NEW",en:"NEW"},share:.2,parts:e=>[tr(e,{x:0,y:0,width:200,height:56},38,er(e.color),{letterSpacing:2,effect:{type:"background",color:e.color,amount:60,radius:100}})]},{id:"outline-pill",zh:"描边标签",en:"Outline label",category:"label",keywords:"标签 描边 分类 话题 outline tag",width:240,height:76,color:qt,text:{zh:"干货分享",en:"Must read"},share:.24,parts:e=>[{kind:"shape",shape:"rect",x:2,y:2,width:236,height:72,stroke:e.color,strokeWidth:3,cornerRadius:36},tr(e,{x:0,y:14,width:240,height:48},32,e.color,{letterSpacing:4})]},{id:"burst-badge",zh:"爆炸贴",en:"Burst badge",category:"label",keywords:"爆炸 促销 限时 特价 角标 burst sale badge",width:180,height:180,color:"#ff4d4f",text:{zh:"限时",en:"SALE"},share:.18,parts:e=>[Je(Ei(Xa(90,90,86,68,16),3),e.color),tr(e,{x:22,y:63,width:136,height:54},42,er(e.color),{rotation:-10})]},{id:"price-tag",zh:"价签",en:"Price sticker",category:"label",keywords:"价格 价签 优惠 到手价 price tag",width:170,height:170,color:"#ff4d4f",text:{zh:"¥99",en:"$99"},share:.17,parts:e=>[{kind:"shape",shape:"ellipse",x:4,y:4,width:162,height:162,fill:e.color},{kind:"path",d:Dn(85,85,68),stroke:er(e.color),strokeWidth:2.5,dash:7},tr(e,{x:10,y:52,width:150,height:66},56,er(e.color),{letterSpacing:-1})]},{id:"ribbon",zh:"飘带",en:"Ribbon banner",category:"label",keywords:"飘带 横幅 丝带 推荐 标题 ribbon banner",width:340,height:110,color:"#d9382f",text:{zh:"年度推荐",en:"TOP PICK"},share:.36,parts:e=>[Je(cn([[8,36],[66,36],[66,98],[8,98],[28,67]],!0)+cn([[332,36],[274,36],[274,98],[332,98],[312,67]],!0),Ri(e.color,"#000000",.2)),Je(cn([[44,82],[66,82],[66,98]],!0)+cn([[296,82],[274,82],[274,98]],!0),Ri(e.color,"#000000",.45)),Je(cn([[44,16],[296,16],[296,82],[44,82]],!0),e.color),tr(e,{x:44,y:24,width:252,height:50},38,er(e.color),{letterSpacing:4})]},{id:"section-tag",zh:"分节标题",en:"Section tag",category:"label",keywords:"分节 小标题 章节 第一部分 section part chapter",width:240,height:76,color:qt,text:{zh:"PART 01",en:"PART 01"},share:.24,parts:e=>[Je(cn([[22,6],[234,6],[218,70],[6,70]],!0),e.color),tr(e,{x:20,y:16,width:200,height:44},34,er(e.color),{letterSpacing:3,fontFamily:"system-ui, sans-serif"})]},{id:"stamp",zh:"印章",en:"Stamp",category:"label",keywords:"印章 盖章 推荐 认证 stamp seal approved",width:160,height:160,color:"#d6332a",text:{zh:"推荐",en:"BEST"},rotation:-12,share:.16,parts:e=>[mn(Dn(80,80,73),e.color,6),mn(Dn(80,80,62),e.color,2),Je(cn(Xa(80,36,9,4,5),!0),e.color),Je(cn(Xa(80,124,9,4,5),!0),e.color),tr(e,{x:16,y:54,width:128,height:52},44,e.color,{letterSpacing:2})]},{id:"number",zh:"序号",en:"Number badge",category:"label",keywords:"序号 编号 数字 步骤 number step badge",width:100,height:100,color:qt,text:{zh:"01",en:"01"},share:.1,parts:e=>[{kind:"shape",shape:"ellipse",x:2,y:2,width:96,height:96,fill:e.color},tr(e,{x:0,y:24,width:100,height:52},44,er(e.color))]},{id:"speech-label",zh:"对话框",en:"Speech label",category:"label",keywords:"对话框 气泡 划重点 提示 speech callout",width:230,height:130,color:qt,text:{zh:"划重点",en:"Key point"},share:.24,parts:e=>[Je("M34 6H196A28 28 0 0 1 224 34V68A28 28 0 0 1 196 96H78L34 124L46 96H34A28 28 0 0 1 6 68V34A28 28 0 0 1 34 6Z",e.color),tr(e,{x:6,y:26,width:218,height:50},36,er(e.color),{letterSpacing:2})]},{id:"sticky-note",zh:"便利贴",en:"Sticky note",category:"label",keywords:"便利贴 便签 笔记 待办 sticky note memo",width:220,height:220,color:"#ffe066",text:{zh:"今日待办",en:"To do"},share:.26,parts:e=>[{kind:"path",d:cn([[14,14],[206,14],[206,168],[168,206],[14,206]],!0),fill:e.color,shadow:{color:"#b9ae8c",blur:14,offsetX:0,offsetY:6}},Je(cn([[206,168],[168,206],[174,174]],!0),Ri(e.color,"#000000",.16)),tr(e,{x:34,y:38,width:152,height:48},32,Ri(e.color,qt,.85),{fontFamily:fx,fontWeight:"normal"})]},{id:"hang-tag",zh:"吊牌",en:"Hang tag",category:"label",keywords:"吊牌 标签 价格 促销 tag sale",width:240,height:110,color:Br,text:{zh:"SALE",en:"SALE"},share:.24,parts:e=>[{kind:"path",d:`M62 10H224A12 12 0 0 1 236 22V88A12 12 0 0 1 224 100H62L14 55Z${Dn(46,55,9)}`,fill:e.color,stroke:qt,strokeWidth:3,fillRule:"evenodd"},tr(e,{x:66,y:29,width:160,height:52},40,er(e.color),{letterSpacing:4})]},{id:"coupon",zh:"票券",en:"Coupon",category:"label",keywords:"票券 优惠券 券 满减 折扣 coupon ticket voucher",width:340,height:130,color:"#f25a2c",text:{zh:"满100减20",en:"20% OFF"},share:.34,parts:e=>[Je("M20 10H244A12 12 0 0 0 268 10H320A14 14 0 0 1 334 24V106A14 14 0 0 1 320 120H268A12 12 0 0 0 244 120H20A14 14 0 0 1 6 106V24A14 14 0 0 1 20 10Z",e.color),{kind:"path",d:"M256 32V98",stroke:er(e.color),strokeWidth:3,dash:6},Je(Ei(Xa(301,65,17,7.5,5),2),er(e.color)),tr(e,{x:14,y:42,width:232,height:46},36,er(e.color))]}],px=new Map(Ui.map(e=>[e.id,e])),gx=new Map(Ui.map(e=>[e.zh,e]));function Em(e){return px.get(e)}function xx(e){return gx.get(e)}function bx(e){const n=e.trim().toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?[...Ui]:Ui.filter(r=>{const s=`${r.id} ${r.zh} ${r.en} ${r.keywords}`.toLowerCase();return n.every(l=>s.includes(l))})}const Wo=8;function zm(e){if(e.kind==="path"){const n=z1(e.d)??{x:0,y:0,width:1,height:1},r=e.stroke?(e.strokeWidth??4)/2:0;return{x:n.x-r,y:n.y-r,width:Math.max(1,n.width+r*2),height:Math.max(1,n.height+r*2)}}if(e.kind==="shape"&&e.stroke){const n=(e.strokeWidth??2)/2;return{x:e.x-n,y:e.y-n,width:e.width+n*2,height:e.height+n*2}}return{x:e.x,y:e.y,width:e.width,height:e.height}}const vf=new Map;function gd(e){var c;const n=vf.get(e.id);if(n)return n;const r=e.parts({color:e.color,text:((c=e.text)==null?void 0:c.zh)??""}).map(zm),s=Math.min(...r.map(f=>f.x)),l=Math.min(...r.map(f=>f.y)),o={x:s,y:l,width:Math.max(...r.map(f=>f.x+f.width))-s,height:Math.max(...r.map(f=>f.y+f.height))-l};return vf.set(e.id,o),o}function yx(e){const n=e.parts({color:e.color,text:""});return n.length===1&&n[0].kind==="path"}const jx={path:"图形",shape:"形状",text:"文本"},Pt=e=>Math.round(e*100)/100;function Nf(e,n,r,s,l){const o={id:l,name:s,locked:!1,hidden:!1},c=zm(e),f=n(c),h={x:Pt(f.x),y:Pt(f.y),width:Math.max(1,Pt(f.width)),height:Math.max(1,Pt(f.height)),rotation:0,scale:1};if(e.kind==="path")return{...o,type:"path",...h,d:e.d,viewBox:{x:Pt(c.x),y:Pt(c.y),width:Pt(c.width),height:Pt(c.height)},fill:e.fill?{type:"solid",color:e.fill}:{type:"transparent"},stroke:e.stroke??qt,strokeWidth:e.stroke?e.strokeWidth??4:0,...e.opacity!==void 0?{opacity:e.opacity}:{},...e.blendMode?{blendMode:e.blendMode}:{},...e.fillRule?{fillRule:e.fillRule}:{},...e.dash!==void 0?{dash:e.dash}:{},...e.shadow?{shadow:{color:e.shadow.color,blur:Pt(e.shadow.blur*r),offsetX:Pt(e.shadow.offsetX*r),offsetY:Pt(e.shadow.offsetY*r)}}:{}};if(e.kind==="shape"){const m=n({x:e.x,y:e.y,width:e.width,height:e.height});return{...o,type:"shape",...h,x:Pt(m.x),y:Pt(m.y),width:Math.max(1,Pt(m.width)),height:Math.max(1,Pt(m.height)),shape:e.shape,fill:e.fill?{type:"solid",color:e.fill}:{type:"transparent"},stroke:e.stroke??"transparent",strokeWidth:e.stroke?Pt((e.strokeWidth??2)*r):0,...e.cornerRadius!==void 0?{cornerRadius:Pt(e.cornerRadius*r)}:{}}}const g=Math.max(1,Math.round(e.fontSize*r*10)/10);return{...o,type:"text",x:Pt(f.x-Wo),y:Pt(f.y-Wo),width:Pt(f.width+Wo*2),height:Pt(f.height+Wo*2),rotation:e.rotation??0,scale:1,text:e.text,fontSize:g,fontFamily:e.fontFamily??Cm,textFill:{type:"solid",color:e.color},align:"center",fontWeight:e.fontWeight??"bold",lineHeight:Pt(f.height/g),...e.letterSpacing!==void 0?{letterSpacing:Pt(e.letterSpacing*r)}:{},...e.effect?{effect:{...e.effect}}:{}}}function xd(e,n,r=()=>di()){var N;const s=n.color??e.color,l=n.text??((N=e.text)==null?void 0:N[n.language??"zh"])??"",o=e.parts({color:s,text:l}),c=gd(e),f=n.width/c.width,h=yx(e)&&n.height!==void 0?n.height:c.height*f,g=h/c.height,x=Math.sqrt(f*g),m=e.rotation??0,j=M=>({x:n.x+(M.x-c.x)*f,y:n.y+(M.y-c.y)*g,width:M.width*f,height:M.height*g});if(o.length===1){const M=Nf(o[0],j,x,e.zh,r());return M.type==="group"?M:{...M,rotation:M.rotation+m}}const k={x:n.x+n.width/2,y:n.y+h/2},v=o.map(M=>{const I=Nf(M,j,x,jx[M.kind],r());return I.type==="group"?I:{...I,x:Pt(I.x-k.x),y:Pt(I.y-k.y)}});return{id:r(),name:e.zh,locked:!1,hidden:!1,type:"group",x:Pt(k.x),y:Pt(k.y),rotation:m,scale:1,children:v}}function wx(e,n){const r=gd(e),s=Math.max(24,Math.round(Math.min(n.width,n.height)*e.share));return{width:s,height:Math.max(1,Math.round(s*r.height/r.width))}}const kx=(e,n,r)=>`${e.name}字 ${n+1}-${r+1}`,Sx=(e,n,r)=>`${e.name}格 ${n+1}-${r+1}`;function vx(e,n){return{rows:Math.max(1,Math.min(e.maxRows,n.length)),columns:Math.max(1,Math.min(e.maxColumns,Math.max(0,...n.map(r=>r.length))))}}function Nx(e,n,r=()=>di()){var k;const{rows:s,columns:l}=vx(e,n),o=l>1?e.width*e.labelShare:e.width,c=l>1?(e.width-o-e.gap*(l-1))/(l-1):0,f=s>1?e.height*e.headerShare:e.height,h=s>1?(e.height-f-e.gap*(s-1))/(s-1):0,g=new Map,x=v=>v?(g.has(v)||g.set(v,e.body.palette[g.size%e.body.palette.length]),g.get(v)):e.body.empty,m=v=>Math.round(v*10)/10,j=[];for(let v=0;v<s;v+=1)for(let w=0;w<l;w+=1){const N=(((k=n[v])==null?void 0:k[w])??"").trim(),M=e.x+(w===0?0:o+e.gap+(w-1)*(c+e.gap)),I=e.y+(v===0?0:f+e.gap+(v-1)*(h+e.gap)),F=w===0?o:c,z=v===0?f:h,A=v===0?e.header:w===0?e.labels:{fill:x(N),...e.body};if(j.push({id:r(),name:Sx(e,v,w),locked:!1,hidden:!1,type:"shape",x:m(M),y:m(I),width:m(F),height:m(z),rotation:0,scale:1,shape:"rect",fill:{type:"solid",color:A.fill},stroke:"transparent",strokeWidth:0,cornerRadius:e.radius}),!N)continue;const T=N.split(`
|
|
3
|
-
`).length,L=1.3,H=Math.min(z,A.fontSize*L*T+16);j.push({id:r(),name:kx(e,v,w),locked:!1,hidden:!1,type:"text",x:m(
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jszip.min-Dh_Y8aD6.js","assets/paginate-CywTJr2d.js","assets/paginate-CnQX0qlX.css","assets/MarkdownEditor-D1UaIr2y.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var C1=Object.defineProperty;var E1=(e,n,r)=>n in e?C1(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var ga=(e,n,r)=>E1(e,typeof n!="symbol"?n+"":n,r);import{r as p,j as t,t as i,s as zt,a as fi,p as z1,D as Kn,n as R1,c as zr,d as Zh,F as Xh,e as qh,f as Qh,g as I1,h as Jh,P as pr,i as bl,k as Ls,C as yl,m as cd,u as ra,L as fc,l as e0,o as jl,q as Bs,A as t0,v as ka,w as L1,x as wl,y as dd,z as kl,B as Pc,E as n0,G as r0,H as a0,I as Ks,J as xt,K as Tc,M as $1,N as li,O as i0,Q as ll,R as D1,S as Wc,T as Hc,U as A1,V as Qu,W as Ju,X as hc,Y as ci,Z as Br,_ as ar,$ as ef,a0 as tf,a1 as P1,a2 as Oc,a3 as T1,a4 as nf,a5 as W1,a6 as H1,a7 as O1,a8 as _1,a9 as B1,aa as K1,ab as V1,ac as cl,ad as G1,ae as ye,af as Sl,ag as _c,ah as Bc,ai as U1,aj as Qt,ak as Vs,al as Ki,am as s0,an as Lr,ao as As,ap as hi,aq as Kc,ar as Y1,as as rr,at as mr,au as Vi,av as Ps,aw as Yr,ax as Tn,ay as jt,az as Ur,aA as ud,aB as o0,aC as Z1,aD as X1,aE as q1,aF as l0,aG as c0,aH as Wn,aI as Q1,aJ as ai,aK as J1,aL as d0,aM as dl,aN as ul,aO as Gn,aP as ii,aQ as Ao,aR as eg,aS as mc,aT as tg,aU as ng,aV as ks,aW as Es,aX as pc,aY as rg,aZ as ag,a_ as ig,a$ as rf,b0 as af,b1 as sg,b2 as og,b3 as sf,b4 as gc,b5 as Mr,b6 as lg,b7 as cg,b8 as xc,b9 as xa,ba as dg,bb as of,bc as ug,bd as fg,be as lf,bf as cf,bg as hg,bh as mg,bi as pg,bj as gg,bk as xg,bl as bg,bm as yg,bn as jg,bo as wg,bp as kg,bq as Sg,br as vg,bs as Ng,bt as Fg,bu as Mg,bv as df,bw as uf,bx as Cg,by as Eg,bz as zg,bA as Rg,bB as Ig,bC as Lg,bD as $g,bE as Dg,bF as Ag,bG as Pg,bH as ff,bI as Tg,bJ as Wg,bK as Po,bL as Hg,bM as Og,bN as _g,bO as Bg,bP as Kg,bQ as Vg,bR as Gg,bS as hn,bT as Ug,bU as Yg,bV as Zg,bW as Xg,bX as qg,bY as hf,bZ as mf,b_ as Qg,b$ as Jg,c0 as e2,c1 as t2,c2 as n2,c3 as r2,c4 as a2,c5 as i2,c6 as s2,c7 as o2,c8 as u0,c9 as f0,ca as l2,cb as c2,cc as pf,cd as d2,ce as u2,cf as f2,cg as h2,ch as m2,ci as p2,cj as gf,ck as g2,cl as x2,cm as b2,cn as y2,co as j2,cp as w2}from"./paginate-CywTJr2d.js";const vl="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%20role='img'%20aria-label='叮卡'%3e%3ctitle%3e叮卡%3c/title%3e%3cdefs%3e%3clinearGradient%20id='dc-base'%20x1='0'%20y1='0'%20x2='64'%20y2='64'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0%25'%20stop-color='%231c1917'/%3e%3cstop%20offset='100%25'%20stop-color='%2309090b'/%3e%3c/linearGradient%3e%3clinearGradient%20id='dc-amber'%20x1='20'%20y1='12'%20x2='48'%20y2='40'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0%25'%20stop-color='%23fb923c'/%3e%3cstop%20offset='100%25'%20stop-color='%23ea580c'/%3e%3c/linearGradient%3e%3clinearGradient%20id='dc-rim'%20x1='0'%20y1='0'%20x2='0'%20y2='64'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0%25'%20stop-color='%23ffffff'%20stop-opacity='0.18'/%3e%3cstop%20offset='100%25'%20stop-color='%23ffffff'%20stop-opacity='0.04'/%3e%3c/linearGradient%3e%3cfilter%20id='dc-glow'%20x='-20%25'%20y='-20%25'%20width='140%25'%20height='140%25'%3e%3cfeGaussianBlur%20stdDeviation='2'%20result='blur'/%3e%3cfeComposite%20in='SourceGraphic'%20in2='blur'%20operator='over'/%3e%3c/filter%3e%3c/defs%3e%3c!--%20曜石质感圆角底板%20--%3e%3crect%20width='64'%20height='64'%20rx='16'%20fill='url(%23dc-base)'/%3e%3crect%20width='64'%20height='64'%20rx='16'%20fill='none'%20stroke='url(%23dc-rim)'%20stroke-width='1.5'/%3e%3c!--%20负空间几何切片字标%20'D'%20--%3e%3cg%20transform='translate(2,%200)'%3e%3c!--%20左侧卡片主轴%20(Spine)%20--%3e%3crect%20x='15'%20y='14'%20width='7'%20height='36'%20rx='3.5'%20fill='%23f4f4f5'/%3e%3c!--%20右侧上半切片%20(Amber%20Slice)%20--%3e%3cpath%20d='M26%2014H35C42.732%2014%2049%2020.268%2049%2028C49%2029.5%2048.7%2030.9%2048.1%2032.2L36.5%2020.6C35.7%2019.8%2034.6%2019.3%2033.4%2019.3H26V14Z'%20fill='url(%23dc-amber)'/%3e%3c!--%20右侧下半切片%20(Light%20Slice)%20--%3e%3cpath%20d='M26%2026.5L43.5%2044H35C30.0294%2044%2026%2039.9706%2026%2035V26.5Z'%20fill='%23f4f4f5'%20fill-opacity='0.92'/%3e%3c!--%20裁切缝微光核心%20(Spark)%20--%3e%3ccircle%20cx='37'%20cy='27'%20r='2.5'%20fill='%23ffffff'%20filter='url(%23dc-glow)'/%3e%3ccircle%20cx='37'%20cy='27'%20r='1.5'%20fill='%23ffffff'/%3e%3c/g%3e%3c/svg%3e",k2=["button","input","textarea","select",'[tabindex]:not([tabindex="-1"])'].join(",");function bc(e){return Array.from(e.querySelectorAll(k2)).filter(n=>n.tabIndex>=0&&!n.matches(":disabled")&&!n.closest("[inert]")&&n.getClientRects().length>0&&window.getComputedStyle(n).visibility!=="hidden")}function S2({onAuthed:e,onClose:n}){const r=p.useId(),s=p.useRef(null),l=p.useRef(null),o=p.useRef(null),c=p.useRef(null),[f,h]=p.useState("login"),[g,x]=p.useState(""),[m,j]=p.useState(""),[k,v]=p.useState(null),[w,N]=p.useState(!1);async function F(M){var z;M.preventDefault(),v(null),document.activeElement===o.current&&((z=l.current)==null||z.focus()),N(!0);try{const A=f==="login"?await zt.auth.login(g,m):await zt.auth.register(g,m);e(A)}catch(A){v(A instanceof Error?i(A.message):i("出错了,请重试"))}finally{N(!1)}}p.useEffect(()=>{const M=s.current;if(!M)return;const z=document.activeElement;z instanceof HTMLElement&&M.contains(z)&&(c.current=z);const A=T=>{var K;const L=T.target;if(L instanceof HTMLElement&&M.contains(L)){bc(M).includes(L)&&(c.current=L);return}const H=bc(M),P=c.current,U=P&&H.includes(P)?P:H[0];U==null||U.focus(),M.contains(document.activeElement)||(K=H[0])==null||K.focus(),M.contains(document.activeElement)||M.focus()};return document.addEventListener("focusin",A),()=>document.removeEventListener("focusin",A)},[]);function I(M){var H;if(M.key==="Escape"){M.preventDefault(),M.stopPropagation(),n();return}if(M.key!=="Tab")return;const z=s.current;if(!z)return;const A=bc(z);if(A.length===0){M.preventDefault();return}const T=A.indexOf(document.activeElement),L=M.shiftKey?T<=0?A.length-1:T-1:T<0||T===A.length-1?0:T+1;M.preventDefault(),(H=A[L])==null||H.focus()}return t.jsx("div",{className:"sheet-backdrop",onClick:n,children:t.jsxs("div",{ref:s,className:"sheet",role:"dialog",tabIndex:-1,"aria-modal":"true","aria-labelledby":r,onClick:M=>M.stopPropagation(),onKeyDown:I,children:[t.jsx("h2",{id:r,className:"sr-only",children:i("账户登录与注册")}),t.jsxs("div",{className:"sheet-tabs",children:[t.jsx("button",{className:f==="login"?"sheet-tab on":"sheet-tab",onClick:()=>{h("login"),v(null)},children:i("登录")}),t.jsx("button",{className:f==="register"?"sheet-tab on":"sheet-tab",onClick:()=>{h("register"),v(null)},children:i("注册")})]}),t.jsxs("form",{className:"sheet-body",onSubmit:F,children:[t.jsxs("label",{className:"field",children:[t.jsx("span",{className:"field-label",children:i("用户名")}),t.jsx("input",{className:"text-input",value:g,autoFocus:!0,onChange:M=>x(M.target.value),placeholder:i("至少 2 个字符")})]}),t.jsxs("label",{className:"field",children:[t.jsx("span",{className:"field-label",children:i("密码")}),t.jsx("input",{className:"text-input",type:"password",value:m,onChange:M=>j(M.target.value),placeholder:i("至少 4 个字符")})]}),k&&t.jsx("div",{className:"form-error",role:"alert","aria-live":"polite",children:k}),t.jsx("p",{className:"form-note",children:zt.remote?i("账号会安全保存到你的服务器,可在登录后跨设备同步草稿。"):i("账号仅保存在此浏览器本地,不会上传,也不能跨设备同步。")}),t.jsxs("div",{className:"sheet-foot",children:[t.jsx("button",{ref:l,type:"button",className:"ghost",onClick:n,children:i("取消")}),t.jsx("button",{ref:o,type:"submit",className:"accent",disabled:w,children:w?i("请稍候…"):f==="login"?i("登录"):i("创建账号")})]})]})]})})}const $s="dingcard.guest.v1",h0="dingcard.guest-move-declined.v1";function v2(){try{if(localStorage.getItem($s)==="1")return!0}catch{}try{return sessionStorage.getItem($s)==="1"}catch{return!1}}function N2(e){try{e?localStorage.setItem($s,"1"):localStorage.removeItem($s)}catch{}try{sessionStorage.removeItem($s)}catch{}}function m0(){try{const e=JSON.parse(localStorage.getItem(h0)??"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function F2(e){const n=m0()[e];return typeof n=="number"&&Number.isFinite(n)?n:0}function M2(e,n){try{localStorage.setItem(h0,JSON.stringify({...m0(),[e]:n}))}catch{}}const C2={md:"markdown-card",canvas:"freeform-slide"};function Ei(e){return e==="markdown-card"?"md":"canvas"}function yc(e){return e?C2[e]??null:null}function xf(e){if(!e)return null;const n=Number.parseInt(e,10);return Number.isFinite(n)&&n>0?n:null}function E2(e){const n=e.replace(/^#/,""),[r,s=""]=n.split("?"),l=r.split("/").filter(Boolean),o=new URLSearchParams(s);switch(l[0]){case void 0:return{name:"home"};case"login":return{name:"login"};case"projects":return{name:"projects",system:yc(o.get("system"))};case"templates":return{name:"templates",system:yc(o.get("system"))};case"assets":return{name:"assets"};case"edit":{const c=yc(l[1]??null),f=l[2];let h=null;return c&&f==="new"?h={kind:"new",platformId:o.get("platform"),width:xf(o.get("w")),height:xf(o.get("h"))}:c&&f==="template"&&l[3]?h={kind:"template",templateId:decodeURIComponent(l[3])}:c==="freeform-slide"&&f==="import"&&o.get("url")?h={kind:"import",url:o.get("url"),title:o.get("title")}:c&&f&&(h={kind:"open",draftId:decodeURIComponent(f)}),{name:"edit",system:c,intent:h}}default:return{name:"home"}}}function It(e,n={}){const r=e.startsWith("#")?e:`#${e}`;if(n.replace){history.replaceState(history.state,"",r),window.dispatchEvent(new HashChangeEvent("hashchange"));return}location.hash!==r&&(location.hash=r)}function z2(e){return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)}function bf(){return location.hash}function R2(){const e=p.useSyncExternalStore(z2,bf,bf);return p.useMemo(()=>E2(e),[e])}const ht={home:"/",login:"/login",projects:e=>e?`/projects?system=${Ei(e)}`:"/projects",templates:e=>e?`/templates?system=${Ei(e)}`:"/templates",assets:"/assets",editor:e=>e?`/edit/${Ei(e)}`:"/edit",openProject:(e,n)=>`/edit/${Ei(e)}/${encodeURIComponent(n)}`,newProject:(e,n={})=>{const r=new URLSearchParams;n.platformId&&r.set("platform",n.platformId),n.width&&r.set("w",String(n.width)),n.height&&r.set("h",String(n.height));const s=r.toString();return`/edit/${Ei(e)}/new${s?`?${s}`:""}`},fromTemplate:(e,n)=>`/edit/${Ei(e)}/template/${encodeURIComponent(n)}`};class rl extends p.Component{constructor(){super(...arguments);ga(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r instanceof Error?r:new Error(String(r))}}componentDidUpdate(r){this.state.error&&!Object.is(r.resetKey,this.props.resetKey)&&this.setState({error:null})}render(){const{error:r}=this.state;return r?t.jsx(I2,{error:r,scope:this.props.scope,fullPage:this.props.fullPage}):this.props.children}}function I2({error:e,scope:n,fullPage:r=!1}){return t.jsxs("div",{className:r?"crash-fallback is-full-page":"crash-fallback",role:"alert","data-testid":"crash-fallback",children:[t.jsx("b",{children:n==="editor"?i("编辑器出错了"):i("页面出错了")}),t.jsx("code",{className:"crash-fallback-error",children:e.message||e.name}),t.jsxs("div",{className:"crash-fallback-actions",children:[t.jsx("button",{className:"primary",type:"button",onClick:()=>window.location.reload(),children:i("重新加载")}),t.jsx("button",{className:"ghost",type:"button",onClick:()=>{It(ht.home),window.location.reload()},children:i("回到首页")})]})]})}function Oe({children:e,...n}){return t.jsx("svg",{viewBox:"0 0 16 16",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",...n,children:e})}function p0(e){return t.jsxs(Oe,{...e,children:[t.jsx("circle",{cx:"8",cy:"8",r:"2.75"}),t.jsx("path",{d:"M8 1.75v1.5M8 12.75v1.5M1.75 8h1.5M12.75 8h1.5M3.58 3.58l1.06 1.06M11.36 11.36l1.06 1.06M3.58 12.42l1.06-1.06M11.36 4.64l1.06-1.06"})]})}function fd(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M13.25 9.9A5.5 5.5 0 1 1 6.1 2.75a4.4 4.4 0 0 0 7.15 7.15Z"})})}function Qi(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M9.75 3.75 5.5 8l4.25 4.25"})})}function g0(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M6.25 3.75 10.5 8l-4.25 4.25"})})}function di(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M8 2.5v7.75M4.75 7 8 10.25 11.25 7M3 13.25h10"})})}function x0(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M8 10.75V2.5M4.75 5.75 8 2.5l3.25 3.25M3.5 10.5v2a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1v-2"})})}function b0(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M3.75 8h8.5"})})}function fl(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M8 3.75v8.5M3.75 8h8.5"})})}function Pn(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"m4.25 4.25 7.5 7.5m0-7.5-7.5 7.5"})})}function L2(e){return t.jsx(Oe,{strokeWidth:"1.75",...e,children:t.jsx("path",{d:"M4.75 3h3.9a2.4 2.4 0 0 1 0 4.8h-3.9zM4.75 7.8h4.6a2.6 2.6 0 0 1 0 5.2h-4.6z"})})}function $2(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M10.75 3H6.75M9.25 13h-4M9.1 3 6.9 13"})})}function D2(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M3.25 3.5v9M6.5 5h6.25M6.5 8h6.25M6.5 11h4"})})}function A2(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M6.5 4.5h6.25M6.5 8h6.25M6.5 11.5h6.25"}),t.jsx("circle",{cx:"3.5",cy:"4.5",r:"0.5",fill:"currentColor"}),t.jsx("circle",{cx:"3.5",cy:"8",r:"0.5",fill:"currentColor"}),t.jsx("circle",{cx:"3.5",cy:"11.5",r:"0.5",fill:"currentColor"})]})}function P2(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M4 2.25v2.5a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-2.5M4 13.75v-2.5a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2.5M2 8h1.5M6.25 8h3.5M12.5 8H14"})})}function T2(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M2.75 7 8 2.75 13.25 7v6.25a.75.75 0 0 1-.75.75H10V9.75H6V14H3.5a.75.75 0 0 1-.75-.75z"})})}function y0(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"2.25",y:"2.25",width:"4.75",height:"4.75",rx:"1"}),t.jsx("rect",{x:"9",y:"2.25",width:"4.75",height:"4.75",rx:"1"}),t.jsx("rect",{x:"2.25",y:"9",width:"4.75",height:"4.75",rx:"1"}),t.jsx("rect",{x:"9",y:"9",width:"4.75",height:"4.75",rx:"1"})]})}function Gi(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"2.25",y:"2.25",width:"11.5",height:"11.5",rx:"1.75"}),t.jsx("path",{d:"M2.25 6.25h11.5M6.25 6.25v7.5"})]})}function W2(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M8 2.25a5.75 5.75 0 0 0 0 11.5c.83 0 1.35-.55 1.35-1.22 0-.33-.13-.6-.33-.86-.2-.25-.33-.53-.33-.86 0-.67.55-1.2 1.22-1.2h1.38a2.46 2.46 0 0 0 2.46-2.46C13.75 4.4 11.18 2.25 8 2.25Z"}),t.jsx("circle",{cx:"5.1",cy:"7.4",r:".55"}),t.jsx("circle",{cx:"6.6",cy:"5",r:".55"}),t.jsx("circle",{cx:"9.5",cy:"4.9",r:".55"})]})}function Gs(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"2.25",y:"2.25",width:"11.5",height:"11.5",rx:"1.75"}),t.jsx("circle",{cx:"6",cy:"6",r:"1.1"}),t.jsx("path",{d:"m13.75 10.25-3.25-3.25-7.75 6.75"})]})}function Ma(e){return t.jsxs(Oe,{...e,children:[t.jsx("circle",{cx:"7.25",cy:"7.25",r:"4.5"}),t.jsx("path",{d:"m13.5 13.5-2.9-2.9"})]})}function Us(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"1.5",y:"3.5",width:"13",height:"9",rx:"1.75"}),t.jsx("path",{d:"M4 10V6l1.75 2L7.5 6v4M11 6v3.75M9.6 8.6 11 10l1.4-1.4"})]})}function Ui(e){return t.jsxs(Oe,{...e,children:[t.jsx("circle",{cx:"5.75",cy:"5.75",r:"3.25"}),t.jsx("rect",{x:"8.25",y:"8.25",width:"5.5",height:"5.5",rx:"1"})]})}function Nl(e){return t.jsxs(Oe,{...e,children:[t.jsx("circle",{cx:"3.75",cy:"8",r:".75",fill:"currentColor"}),t.jsx("circle",{cx:"8",cy:"8",r:".75",fill:"currentColor"}),t.jsx("circle",{cx:"12.25",cy:"8",r:".75",fill:"currentColor"})]})}function j0(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"5.25",y:"5.25",width:"8.5",height:"8.5",rx:"1.5"}),t.jsx("path",{d:"M10.75 5.25V3.75a1.5 1.5 0 0 0-1.5-1.5h-5.5a1.5 1.5 0 0 0-1.5 1.5v5.5a1.5 1.5 0 0 0 1.5 1.5h1.5"})]})}function Ji(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M2.75 4.5h10.5M6.5 7.25v4M9.5 7.25v4M3.75 4.5l.6 8.4a1 1 0 0 0 1 .85h5.3a1 1 0 0 0 1-.85l.6-8.4M6 4.5V2.75h4V4.5"})})}function Vc(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M6.25 13.75H3.5a1 1 0 0 1-1-1v-9.5a1 1 0 0 1 1-1h2.75M10.5 11l3-3-3-3M13.5 8H6.25"})})}function gr(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M8 13.25V5.5M4.75 8.5 8 5.25l3.25 3.25M3 2.75h10"})})}function hl(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"3.25",y:"7",width:"9.5",height:"6.75",rx:"1.5"}),t.jsx("path",{d:"M5.5 7V5.25a2.5 2.5 0 0 1 5 0V7"})]})}function hd(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"m4.25 6.25 3.75 3.75 3.75-3.75"})})}function md(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"m10.25 2.75 3 3-7.5 7.5-3.5.5.5-3.5z"}),t.jsx("path",{d:"m8.75 4.25 3 3"})]})}function H2(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"m3.25 8.25 3 3 6.5-6.5"})})}function yf(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"2.25",y:"2.75",width:"11.5",height:"10.5",rx:"2"}),t.jsx("path",{d:"M6.25 2.75v10.5"})]})}function O2(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"2.25",y:"2.75",width:"11.5",height:"10.5",rx:"2"}),t.jsx("path",{d:"M9.75 2.75v10.5"})]})}function _2(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"4.25",y:"1.75",width:"7.5",height:"5",rx:"1.25"}),t.jsx("rect",{x:"4.25",y:"9.25",width:"7.5",height:"5",rx:"1.25"})]})}function w0(e){return t.jsxs(Oe,{...e,children:[t.jsx("circle",{cx:"8",cy:"8",r:"5.75"}),t.jsx("path",{d:"M2.25 8h11.5M8 2.25c1.6 1.7 2.4 3.6 2.4 5.75S9.6 12.05 8 13.75C6.4 12.05 5.6 10.15 5.6 8S6.4 3.95 8 2.25Z"})]})}function B2(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M5.5 4.25 2.75 7l2.75 2.75"}),t.jsx("path",{d:"M2.75 7h6.5a4 4 0 0 1 0 8h-2"})]})}function K2(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M10.5 4.25 13.25 7l-2.75 2.75"}),t.jsx("path",{d:"M13.25 7h-6.5a4 4 0 0 0 0 8h2"})]})}function k0(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M3 4.25V3h10v1.25M8 3v10M6 13h4"})})}function S0(e){return t.jsxs(Oe,{...e,children:[t.jsx("circle",{cx:"5.5",cy:"5.5",r:"3"}),t.jsx("path",{d:"M8.75 8.75h4.5v4.5h-4.5z"}),t.jsx("path",{d:"m10.75 2.25 2.5 4.25h-5z"})]})}function V2(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M3 13 13 3"}),t.jsx("path",{d:"M9 3h4v4"})]})}function G2(e){return t.jsx(Oe,{...e,children:t.jsx("path",{d:"M2.75 12.75c1.75-7.5 4.5-9 6-5.25s3.75 2.75 4.5-4.75"})})}function v0(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"2.25",y:"3",width:"11.5",height:"10",rx:"1.75"}),t.jsx("circle",{cx:"5.75",cy:"6.5",r:"1.1"}),t.jsx("path",{d:"m13.75 10.5-3.25-3-7.5 5.25"})]})}function Bi({shape:e,...n}){const r={rect:t.jsx("rect",{x:"4",y:"6",width:"24",height:"20",rx:"3"}),ellipse:t.jsx("circle",{cx:"16",cy:"16",r:"11"}),triangle:t.jsx("path",{d:"M16 5 28 26H4z"}),star:t.jsx("path",{d:"m16 4 3.6 7.6 8.4 1-6.2 5.8 1.6 8.3L16 22.6l-7.4 4.1 1.6-8.3L4 12.6l8.4-1z"}),hexagon:t.jsx("path",{d:"M10 5h12l6 11-6 11H10L4 16z"}),diamond:t.jsx("path",{d:"M16 4 28 16 16 28 4 16z"}),pentagon:t.jsx("path",{d:"M16 4 28 13.4 23.3 27H8.7L4 13.4z"}),heart:t.jsx("path",{d:"M16 27 6.6 17.6C3.1 14.1 3.1 8.7 6.6 6c3-2.4 7-1.6 9.4 1.4C18.4 4.4 22.4 3.6 25.4 6c3.5 2.7 3.5 8.1 0 11.6z"}),bubble:t.jsx("path",{d:"M6 6h20a4 4 0 0 1 4 4v9a4 4 0 0 1-4 4H15l-6 6v-6H6a4 4 0 0 1-4-4v-9a4 4 0 0 1 4-4z"}),qrcode:t.jsx("path",{d:"M5 5h8v8H5zM19 5h8v8h-8zM5 19h8v8H5zM18 18h3v3h-3zM23 18h4v4h-4zM18 23h3v4h-3zM23 24h4v4h-4z"}),chart:t.jsx("g",{fill:"none",stroke:"currentColor",strokeWidth:"2.6",strokeLinecap:"round",children:t.jsx("path",{d:"M7 27V17M16 27V5M25 27v-8"})}),table:t.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinejoin:"round",children:[t.jsx("rect",{x:"4",y:"6",width:"24",height:"20",rx:"2"}),t.jsx("path",{d:"M4 12.7h24M4 19.3h24M12 6v20M20 6v20"})]}),timeline:t.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",children:[t.jsx("path",{d:"M8 5v22"}),t.jsx("path",{d:"M8 8.5h14M8 16h10M8 23.5h13"})]}),progress:t.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",children:[t.jsx("circle",{cx:"16",cy:"16",r:"10",opacity:"0.3"}),t.jsx("path",{d:"M6 16a10 10 0 0 1 16-8"})]}),line:t.jsx("path",{d:"M5 27 27 5",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),arrow:t.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M5 27 26 6"}),t.jsx("path",{d:"M15 6h11v11"})]}),arrowBoth:t.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M6 26 26 6"}),t.jsx("path",{d:"M15 6h11v11"}),t.jsx("path",{d:"M17 26H6V15"})]})};return t.jsx("svg",{viewBox:"0 0 32 32",width:"32",height:"32",fill:"currentColor","aria-hidden":"true",focusable:"false",...n,children:r[e]??r.rect})}function U2(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"4.25",y:"1.75",width:"7.5",height:"12.5",rx:"1.5"}),t.jsx("path",{d:"M4.25 6h7.5M4.25 10h7.5"})]})}function Y2(e){return t.jsxs(Oe,{...e,children:[t.jsx("rect",{x:"2.25",y:"2.25",width:"11.5",height:"11.5",rx:"1.5"}),t.jsx("path",{d:"M6.08 2.25v11.5M9.92 2.25v11.5M2.25 6.08h11.5M2.25 9.92h11.5"})]})}function Z2(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"m8 2.5 5.5 2.75L8 8 2.5 5.25z"}),t.jsx("path",{d:"m2.5 8 5.5 2.75L13.5 8M2.5 10.75 8 13.5l5.5-2.75"})]})}function X2(e){return t.jsxs(Oe,{...e,children:[t.jsx("circle",{cx:"8",cy:"6",r:"2.75"}),t.jsx("path",{d:"M3 13.5c.7-2.3 2.7-3.75 5-3.75s4.3 1.45 5 3.75"})]})}function q2(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M4.5 12.25a3 3 0 0 1-.4-5.97 4 4 0 0 1 7.72-.9 3.2 3.2 0 0 1 .43 6.87z"}),t.jsx("path",{d:"m6.25 9 1.25 1.25L9.75 8"})]})}function Q2(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M6 12.25H4.5a3 3 0 0 1-.4-5.97 4 4 0 0 1 .8-1.73M7.1 3.1a4 4 0 0 1 4.72 2.28 3.2 3.2 0 0 1 1.83 5.6"}),t.jsx("path",{d:"m2.5 2.5 11 11"})]})}function J2(e){return t.jsxs(Oe,{...e,children:[t.jsx("circle",{cx:"8",cy:"8",r:"5.75"}),t.jsx("path",{d:"M8 5v3.5M8 10.9v.1"})]})}function jf(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M9.25 2.25H4.75a1 1 0 0 0-1 1v9.5a1 1 0 0 0 1 1h6.5a1 1 0 0 0 1-1V5.25z"}),t.jsx("path",{d:"M9.25 2.25v3h3M8 7v4.25M6.25 9.5 8 11.25 9.75 9.5"})]})}function ex(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"m8 2.5 5.5 2.75L8 8 2.5 5.25z"}),t.jsx("path",{d:"m2.5 8 5.5 2.75L13.5 8"})]})}function N0(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M2.75 8a5.25 5.25 0 1 0 1.54-3.71"}),t.jsx("path",{d:"M2.75 2.75v2.5h2.5M8 5.25V8l1.75 1.25"})]})}function pd(e){return t.jsxs(Oe,{...e,children:[t.jsx("path",{d:"M3 10.75V4.5a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v6.25M1.75 12.5h12.5"}),t.jsx("path",{d:"m6.4 7.1 1.1 1.1 2.1-2.1"})]})}function tx(e,n){return e>0&&n>0?i("你没登录时做了 {projects} 个项目、存了 {assets} 张素材,都保存在这台设备上。",{projects:e,assets:n}):e>0?i("你没登录时做了 {n} 个项目,都保存在这台设备上。",{n:e}):i("你没登录时存了 {n} 张素材,都保存在这台设备上。",{n})}function nx({username:e,projects:n,assets:r,phase:s,onMove:l,onKeep:o}){const c=p.useId(),f=p.useId(),h=p.useRef(null),g=s.kind==="moving",x=p.useRef(g);x.current=g;const m=p.useRef(o);return m.current=o,p.useEffect(()=>{var v;const j=document.activeElement instanceof HTMLElement?document.activeElement:null;(v=h.current)==null||v.focus();const k=w=>{w.key!=="Escape"||x.current||(w.preventDefault(),m.current())};return window.addEventListener("keydown",k),()=>{window.removeEventListener("keydown",k),j!=null&&j.isConnected&&j.focus()}},[]),t.jsx("div",{className:"modal-backdrop",children:t.jsxs("div",{className:"modal confirm-modal guest-move-modal",role:"dialog","aria-modal":"true","aria-labelledby":c,"aria-describedby":f,"data-testid":"guest-move-dialog",children:[t.jsx("span",{className:"guest-move-icon","aria-hidden":"true",children:t.jsx(pd,{})}),t.jsx("h3",{id:c,className:"confirm-title",children:n>0?i("把这台设备上的项目放进账号?"):i("把这台设备上的素材放进账号?")}),t.jsxs("p",{id:f,className:"confirm-body",children:[tx(n,r),zt.remote?i("放进「{name}」后,换一台设备登录也能继续编辑。",{name:e}):i("放进「{name}」后,它们会出现在这个账号的「我的项目」里。",{name:e})]}),s.kind==="failed"&&t.jsx("p",{className:"form-error",role:"alert",children:i("还有 {n} 项没能放进账号:{error}",{n:s.failed,error:s.message})}),t.jsxs("div",{className:"modal-foot",children:[t.jsx("button",{className:"ghost",type:"button",onClick:o,disabled:g,"data-testid":"guest-move-keep",children:i("先留在本机")}),t.jsx("button",{ref:h,className:"accent",type:"button",onClick:l,disabled:g,"data-testid":"guest-move-confirm",children:g?i("正在放进账号… {done}/{total}",{done:s.done,total:s.total}):s.kind==="failed"?i("重试"):i("放进账号")})]})]})})}function Sa(e){const n=Math.round(e*10)/10;return Object.is(n,-0)?0:n}const rt=([e,n])=>`${Sa(e)} ${Sa(n)}`,ni=rt;function al(e,n){const r=Math.sin(e*12.9898+n*78.233)*43758.5453;return(r-Math.floor(r))*2-1}function F0(e,n){const r=e.length,s=o=>n?e[(o+r)%r]:e[Math.max(0,Math.min(r-1,o))],l=n?r:r-1;return Array.from({length:l},(o,c)=>{const[f,h,g,x]=[s(c-1),s(c),s(c+1),s(c+2)],m=[h[0]+(g[0]-f[0])/6,h[1]+(g[1]-f[1])/6],j=[g[0]-(x[0]-h[0])/6,g[1]-(x[1]-h[1])/6];return{from:h,c1:m,c2:j,to:g}})}function Rr(e,n=!1){if(e.length<2)return"";const r=F0(e,n);return`M${rt(e[0])}${r.map(({c1:s,c2:l,to:o})=>`C${rt(s)} ${rt(l)} ${rt(o)}`).join("")}${n?"Z":""}`}function cn(e,n=!1){return`M${e.map(rt).join("L")}${n?"Z":""}`}function M0(e,n=10,r=!1){const s=[e[0]];for(const{from:l,c1:o,c2:c,to:f}of F0(e,r))for(let h=1;h<=n;h+=1){const g=h/n,x=1-g;s.push([x*x*x*l[0]+3*x*x*g*o[0]+3*x*g*g*c[0]+g*g*g*f[0],x*x*x*l[1]+3*x*x*g*o[1]+3*x*g*g*c[1]+g*g*g*f[1]])}return s}function zi(e,n,r={}){const{tip:s=.18,taper:l=.32,peak:o=.45}=r,c=M0(e,8),f=[0];for(let m=1;m<c.length;m+=1)f.push(f[m-1]+Math.hypot(c[m][0]-c[m-1][0],c[m][1]-c[m-1][1]));const h=f[f.length-1]||1,g=[],x=[];return c.forEach((m,j)=>{const k=c[Math.max(0,j-1)],v=c[Math.min(c.length-1,j+1)],w=v[0]-k[0],N=v[1]-k[1],F=Math.hypot(w,N)||1,I=f[j]/h,M=Math.min(1,I/Math.max(.01,l*(o/.5))),z=Math.min(1,(1-I)/Math.max(.01,l*((1-o)/.5))),A=Math.sin(Math.min(M,z)*Math.PI/2),T=n/2*(s+(1-s)*A);g.push([m[0]-N/F*T,m[1]+w/F*T]),x.push([m[0]+N/F*T,m[1]-w/F*T])}),Rr([...g,...x.reverse()],!0)}function rx(e,n,r,s=28,l=0){const o=Math.atan2(e[1]-n[1],e[0]-n[0]),c=f=>{const h=o+Math.PI+f*((s+f*l)*Math.PI)/180;return[e[0]+Math.cos(h)*r,e[1]+Math.sin(h)*r]};return`M${rt(c(1))}L${rt(e)}L${rt(c(-1))}`}function qa(e,n,r,s,l,o=0){return Array.from({length:l*2},(c,f)=>{const h=f%2===0?r:s,g=-Math.PI/2+f*Math.PI/l+o*Math.PI/180;return[e+Math.cos(g)*h,n+Math.sin(g)*h]})}function Ri(e,n){const r=e.length,s=e.map((l,o)=>{const c=e[(o-1+r)%r],f=e[(o+1)%r],h=g=>{const x=g[0]-l[0],m=g[1]-l[1],j=Math.hypot(x,m)||1,k=Math.min(n,j/2);return[l[0]+x/j*k,l[1]+m/j*k]};return{corner:l,enter:h(c),leave:h(f)}});return`M${rt(s[0].leave)}${s.slice(1).concat(s[0]).map(({corner:l,enter:o,leave:c})=>`L${rt(o)}Q${rt(l)} ${rt(c)}`).join("")}Z`}function To(e,n,r,s=.16){const l=r*s;return`M${rt([e,n-r])}Q${rt([e+l,n-l])} ${rt([e+r,n])}Q${rt([e+l,n+l])} ${rt([e,n+r])}Q${rt([e-l,n+l])} ${rt([e-r,n])}Q${rt([e-l,n-l])} ${rt([e,n-r])}Z`}function ax(e,n,r,s){const l=(o,c)=>[e+o*r,n+c*s];return`M${rt(l(.5,.26))}C${rt(l(.42,.06))} ${rt(l(.06,.02))} ${rt(l(.02,.33))}C${rt(l(-.02,.62))} ${rt(l(.3,.8))} ${rt(l(.5,.98))}C${rt(l(.7,.8))} ${rt(l(1.02,.62))} ${rt(l(.98,.33))}C${rt(l(.94,.02))} ${rt(l(.58,.06))} ${rt(l(.5,.26))}Z`}function Dn(e,n,r){return`M${rt([e-r,n])}A${Sa(r)} ${Sa(r)} 0 1 0 ${rt([e+r,n])}A${Sa(r)} ${Sa(r)} 0 1 0 ${rt([e-r,n])}Z`}function ix(e,n,r,s,l=.08){const o=r*(1-l),c=Array.from({length:s},(h,g)=>{const x=-Math.PI/2+g*2*Math.PI/s;return[e+Math.cos(x)*o,n+Math.sin(x)*o]}),f=2*Math.PI*o/s/2;return`M${rt(c[0])}${c.slice(1).concat([c[0]]).map(h=>`A${Sa(f)} ${Sa(f)} 0 0 1 ${rt(h)}`).join("")}Z`}function sx(e,n,r,s,l={}){const{turns:o=1.14,start:c=200,tilt:f=-4,spread:h=.07,seed:g=1,steps:x=22}=l,m=f*Math.PI/180;return Array.from({length:x+1},(j,k)=>{const v=k/x,w=(c+360*o*v)*Math.PI/180,N=1+h*(v-.5)+.015*al(g,k),F=Math.cos(w)*r*N,I=Math.sin(w)*s*N;return[e+F*Math.cos(m)-I*Math.sin(m),n+F*Math.sin(m)+I*Math.cos(m)]})}function ox(e,n,r,s,l){const o=l*4;return Array.from({length:o+1},(c,f)=>{const h=f*Math.PI/2;return[e+r*f/o,n-Math.sin(h)*s]})}function lx(e,n,r,s,l=40){return Array.from({length:l+1},(o,c)=>{const f=c/l,h=f*s*2*Math.PI,g=r*(.08+.92*f);return[e+Math.cos(h)*g,n+Math.sin(h)*g]})}const cx=[{id:"hand-drawn",zh:"手绘线条",en:"Hand-drawn"},{id:"sticker",zh:"贴纸",en:"Stickers"},{id:"label",zh:"标签",en:"Labels"}],qt="#1c1917",Ii="#e8453c",Kr="#ffd23f",wf="#ffc53d",dx="#1f9d63",ux="#ff7a9c",C0="PingFang SC, Microsoft YaHei, system-ui, sans-serif",fx="'LXGW WenKai TC', cursive";function Gc(e){const n=Number.parseInt(e.slice(1),16);return[n>>16&255,n>>8&255,n&255]}function Li(e,n,r){const s=Gc(e),l=Gc(n);return`#${s.map((o,c)=>Math.round(o+(l[c]-o)*r).toString(16).padStart(2,"0")).join("")}`}function tr(e){const[n,r,s]=Gc(e).map(o=>{const c=o/255;return c<=.03928?c/12.92:((c+.055)/1.055)**2.4});return 1.05/(.2126*n+.7152*r+.0722*s+.05)>=3?"#ffffff":qt}const mn=(e,n,r)=>({kind:"path",d:e,stroke:n,strokeWidth:r}),et=(e,n,r)=>({kind:"path",d:e,fill:n,...r?{stroke:r.color,strokeWidth:r.width}:{}}),fn={color:qt,width:4};function kf(e,n,r=30){const s=M0(e,12),l=s[s.length-1],o=s[s.length-4];return Rr(e)+rx(l,o,n,r)}function hx(e,n,r,s,l){return r.map((o,c)=>{const f=o*Math.PI/180,h=typeof l=="number"?l:l[c],g=[e+Math.cos(f)*s,n+Math.sin(f)*s],x=[e+Math.cos(f)*h,n+Math.sin(f)*h];return cn([g,x])}).join("")}function mx(e,n,r,s,l,o){const c=r*Math.PI/180,[f,h]=[Math.cos(c),Math.sin(c)],[g,x]=[-h*(o/2),f*(o/2)],m=(k,v)=>[e+f*k+g*v,n+h*k+x*v],j=o/2;return`M${ni(m(s,1))}L${ni(m(l,1))}A${j} ${j} 0 0 0 ${ni(m(l,-1))}L${ni(m(s,-1))}A${j} ${j} 0 0 0 ${ni(m(s,1))}Z`}function Sf(e,n,r,s,l){const o=Math.PI/r,c=s*Math.cos(o),f=Math.sqrt(Math.max(0,l*l-(s*Math.sin(o))**2)),h=Array.from({length:r},(x,m)=>{const j=-Math.PI/2+(2*m+1)*o;return[e+Math.cos(j)*(c+f),n+Math.sin(j)*(c+f)]}),g=h[r-1];return`M${ni(g)}${h.map(x=>`A${l} ${l} 0 1 1 ${ni(x)}`).join("")}Z`}function nr(e,n,r,s,l={}){return{kind:"text",...n,text:e.text,fontSize:r,color:s,fontFamily:C0,fontWeight:"bold",...l}}const Yi=[{id:"circle-scribble",zh:"手绘圈",en:"Scribble circle",category:"hand-drawn",keywords:"圈 圈出 圆圈 重点 强调 circle ring highlight",width:240,height:140,color:Ii,share:.4,parts:({color:e})=>[et(zi(sx(120,70,104,54,{turns:1.1,start:196,tilt:-5,spread:.08,seed:3}),8,{tip:.3,taper:.12,peak:.25}),e)]},{id:"underline-brush",zh:"手绘下划线",en:"Brush underline",category:"hand-drawn",keywords:"下划线 划线 强调 underline swoosh",width:320,height:44,color:Ii,share:.42,parts:({color:e})=>[et(zi([[10,34],[70,25],[160,19],[250,17],[310,21]],16,{tip:.12,taper:.45,peak:.3}),e)]},{id:"underline-wave",zh:"波浪线",en:"Wavy line",category:"hand-drawn",keywords:"波浪 下划线 曲线 wave squiggle underline",width:300,height:40,color:Ii,share:.4,parts:({color:e})=>[mn(Rr(ox(8,20,284,9,4).map(([n,r],s)=>[n,r+al(7,s)*1.5])),e,5)]},{id:"underline-double",zh:"双下划线",en:"Double underline",category:"hand-drawn",keywords:"下划线 双线 强调 double underline",width:300,height:40,color:qt,share:.4,parts:({color:e})=>[mn(Rr([[8,14],[110,10],[210,12],[292,9]])+Rr([[36,31],[140,27],[262,30]]),e,4.5)]},{id:"arrow-curved",zh:"弧形箭头",en:"Curved arrow",category:"hand-drawn",keywords:"箭头 指向 弯 arrow curve point",width:200,height:150,color:qt,share:.26,parts:({color:e})=>[mn(kf([[16,132],[44,84],[104,46],[182,34]],28),e,5)]},{id:"arrow-loop",zh:"绕圈箭头",en:"Loop arrow",category:"hand-drawn",keywords:"箭头 绕圈 指向 arrow loop curl",width:280,height:150,color:qt,share:.32,parts:({color:e})=>[mn(kf([[12,120],[70,112],[128,86],[150,50],[128,22],[102,40],[112,84],[164,112],[222,106],[266,74]],28),e,5)]},{id:"emphasis-marks",zh:"强调线",en:"Emphasis marks",category:"hand-drawn",keywords:"强调 惊叹 亮点 闪 emphasis accent shine",width:100,height:100,color:qt,share:.12,parts:({color:e})=>[et([-104,-62,-20].map((n,r)=>{const s=n*Math.PI/180,l=[70,76,68][r];return zi([[14+Math.cos(s)*26,86+Math.sin(s)*26],[14+Math.cos(s)*l,86+Math.sin(s)*l]],9,{tip:.35,taper:.5})}).join(""),e)]},{id:"radiate",zh:"放射线",en:"Burst lines",category:"hand-drawn",keywords:"放射 发光 亮点 爆炸 burst rays shine",width:120,height:120,color:qt,share:.16,parts:({color:e})=>[mn(hx(60,60,[-90,-45,0,45,90,135,180,225],30,[54,46,54,46,54,46,54,46]),e,5)]},{id:"check-hand",zh:"手绘对勾",en:"Hand-drawn check",category:"hand-drawn",keywords:"对勾 勾 正确 完成 check tick yes",width:130,height:110,color:dx,share:.16,parts:({color:e})=>[et(zi([[12,56],[32,76],[50,96],[80,58],[122,12]],15,{tip:.3,taper:.3,peak:.3}),e)]},{id:"cross-hand",zh:"手绘叉",en:"Hand-drawn cross",category:"hand-drawn",keywords:"叉 错误 不要 避雷 cross wrong no",width:110,height:110,color:Ii,share:.14,parts:({color:e})=>[et(zi([[18,16],[56,54],[94,96]],14,{tip:.3,taper:.3})+zi([[92,18],[56,56],[16,94]],14,{tip:.3,taper:.3}),e)]},{id:"star-hand",zh:"手绘星星",en:"Hand-drawn star",category:"hand-drawn",keywords:"星星 星 收藏 star doodle",width:140,height:136,color:qt,share:.16,parts:({color:e})=>{const n=qa(70,74,62,27,5).map(([r,s],l)=>[r+al(5,l)*2,s+al(9,l)*2]);return[mn(cn([...n,n[0],[n[0][0]+(n[1][0]-n[0][0])*.25,n[0][1]+(n[1][1]-n[0][1])*.25]]),e,5)]}},{id:"heart-hand",zh:"手绘爱心",en:"Hand-drawn heart",category:"hand-drawn",keywords:"爱心 心 喜欢 heart love doodle",width:140,height:128,color:Ii,share:.16,parts:({color:e})=>[mn(Rr([[70,38],[56,16],[30,10],[12,28],[10,52],[26,78],[50,100],[70,120],[91,99],[115,77],[131,51],[128,27],[110,10],[84,15],[72,34],[66,48]]),e,5.5)]},{id:"spiral",zh:"螺旋",en:"Spiral",category:"hand-drawn",keywords:"螺旋 旋转 晕 spiral swirl",width:120,height:120,color:qt,share:.14,parts:({color:e})=>[mn(Rr(lx(60,60,52,2.6,36)),e,5)]},{id:"corner-frame",zh:"取景框",en:"Corner frame",category:"hand-drawn",keywords:"框 边框 角 取景 frame corners brackets",width:260,height:180,color:qt,share:.44,parts:({color:e})=>[mn("M8 52V8H52M208 8H252V52M252 128V172H208M52 172H8V128",e,6)]},{id:"zigzag",zh:"锯齿线",en:"Zigzag",category:"hand-drawn",keywords:"锯齿 折线 下划线 zigzag underline",width:280,height:36,color:qt,share:.38,parts:({color:e})=>[mn(cn(Array.from({length:11},(n,r)=>[8+r*26.4,r%2===0?27:9])),e,5)]},{id:"marker-band",zh:"荧光笔",en:"Highlighter",category:"hand-drawn",keywords:"荧光笔 高亮 涂抹 马克笔 highlighter marker",width:320,height:64,color:"#ffe14d",share:.42,parts:({color:e})=>[{kind:"path",d:Rr([[16,14],[110,11],[210,12],[304,9],[312,20],[306,30],[313,41],[302,54],[200,52],[100,55],[18,53],[9,43],[15,33],[8,23]],!0),fill:e,blendMode:"multiply"}]},{id:"sparkle",zh:"闪光",en:"Sparkle",category:"sticker",keywords:"闪光 星光 亮 闪 sparkle shine twinkle",width:100,height:100,color:wf,share:.1,parts:({color:e})=>[et(To(50,50,48,.14),e)]},{id:"sparkles",zh:"闪闪",en:"Sparkles",category:"sticker",keywords:"闪光 星光 亮晶晶 闪 sparkles shine twinkle",width:150,height:150,color:wf,share:.14,parts:({color:e})=>[et(To(62,84,56,.14)+To(122,32,24,.16)+To(126,122,14,.18),e)]},{id:"star",zh:"星星",en:"Star",category:"sticker",keywords:"星星 星 五角星 收藏 star",width:130,height:126,color:Kr,share:.13,parts:({color:e})=>[et(Ri(qa(65,69,58,25,5),7),e,fn)]},{id:"heart",zh:"爱心",en:"Heart",category:"sticker",keywords:"爱心 心 喜欢 点赞 heart love like",width:130,height:118,color:"#ff5c7a",share:.13,parts:({color:e})=>[et(ax(8,8,114,104),e,fn)]},{id:"flower",zh:"小花",en:"Flower",category:"sticker",keywords:"花 小花 花朵 春天 flower blossom",width:130,height:130,color:ux,share:.13,parts:({color:e})=>[et(Sf(65,65,5,33,27),e,fn),et(Dn(65,65,15),Kr,fn)]},{id:"sun",zh:"太阳",en:"Sun",category:"sticker",keywords:"太阳 晴天 阳光 夏天 sun sunny",width:150,height:150,color:"#ffb627",share:.15,parts:({color:e})=>[et(Dn(75,75,33)+[0,45,90,135,180,225,270,315].map(n=>mx(75,75,n,45,66,11)).join(""),e,fn)]},{id:"cloud",zh:"云朵",en:"Cloud",category:"sticker",keywords:"云 云朵 天气 cloud",width:190,height:120,color:"#ffffff",share:.18,parts:({color:e})=>[et("M38 104H154A27 27 0 0 0 162 51A37 37 0 0 0 96 32A31 31 0 0 0 46 56A25 25 0 0 0 38 104Z",e,fn)]},{id:"speech-bubble",zh:"对话气泡",en:"Speech bubble",category:"sticker",keywords:"对话 气泡 说话 聊天 speech bubble chat",width:190,height:150,color:"#ffffff",share:.2,parts:({color:e})=>[et("M50 10H140A40 40 0 0 1 180 50V70A40 40 0 0 1 140 110H86L40 140L54 110H50A40 40 0 0 1 10 70V50A40 40 0 0 1 50 10Z",e,fn)]},{id:"crown",zh:"皇冠",en:"Crown",category:"sticker",keywords:"皇冠 王冠 第一 冠军 crown king winner",width:150,height:112,color:Kr,share:.15,parts:({color:e})=>[et(Ri([[24,100],[14,36],[48,62],[75,26],[102,62],[136,36],[126,100]],5)+Dn(14,30,8)+Dn(75,18,8)+Dn(136,30,8),e,fn)]},{id:"medal",zh:"奖章",en:"Medal",category:"sticker",keywords:"奖章 勋章 荣誉 冠军 第一 medal award badge winner",width:150,height:190,color:"#f5b301",share:.15,parts:({color:e})=>[et(cn([[46,112],[74,126],[60,184],[47,168],[30,178]],!0)+cn([[104,112],[76,126],[90,184],[103,168],[120,178]],!0),Ii,fn),et(ix(75,75,66,18,.07),e,fn),et(Dn(75,75,45),Li(e,"#ffffff",.4),{color:qt,width:3}),et(Ri(qa(75,78,27,11.5,5),3),Li(e,"#000000",.12))]},{id:"flame",zh:"火苗",en:"Flame",category:"sticker",keywords:"火 火苗 火热 爆款 热门 fire flame hot",width:110,height:150,color:"#ff5a36",share:.12,parts:({color:e})=>[et("M55 8C70 38 98 56 98 94C98 124 78 142 55 142C32 142 12 124 12 96C12 72 26 60 34 42C38 58 44 64 50 66C47 44 50 26 55 8Z",e,fn),et("M56 72C66 88 76 98 76 113C76 127 67 135 55 135C43 135 34 127 34 114C34 102 41 94 45 86C48 94 52 98 56 98C54 89 54 80 56 72Z",Kr)]},{id:"lightning",zh:"闪电",en:"Lightning",category:"sticker",keywords:"闪电 电 快 能量 lightning bolt flash",width:100,height:150,color:Kr,share:.11,parts:({color:e})=>[et(Ri([[64,8],[18,84],[48,84],[34,142],[84,60],[54,60],[74,8]],4),e,fn)]},{id:"smile",zh:"笑脸",en:"Smiley",category:"sticker",keywords:"笑脸 开心 微笑 表情 smile happy face",width:130,height:130,color:Kr,share:.13,parts:({color:e})=>[et(Dn(65,65,57),e,fn),et(`${Dn(46,52,7)}${Dn(84,52,7)}M36 74Q65 112 94 74Q65 96 36 74Z`,qt)]},{id:"rainbow",zh:"彩虹",en:"Rainbow",category:"sticker",keywords:"彩虹 雨后 希望 rainbow",width:210,height:120,color:"#ff6b6b",share:.22,parts:({color:e})=>[94,78,62,46].map((n,r)=>mn(`M${105-n} 112A${n} ${n} 0 0 1 ${105+n} 112`,[e,"#ffb23f","#ffe066","#4cc38a"][r],15))},{id:"balloon",zh:"气球",en:"Balloon",category:"sticker",keywords:"气球 生日 派对 庆祝 balloon party birthday",width:110,height:196,color:"#ff6b6b",share:.12,parts:({color:e})=>[mn(Rr([[55,136],[48,152],[60,168],[50,182],[56,192]]),qt,3),et("M55 8C84 8 102 34 102 64C102 98 78 124 55 124C32 124 8 98 8 64C8 34 26 8 55 8ZM55 124L47 138H63Z",e,fn),mn("M28 56C30 40 40 28 54 24","#ffffff",6)]},{id:"gift",zh:"礼物",en:"Gift",category:"sticker",keywords:"礼物 礼盒 生日 节日 福利 gift present",width:140,height:140,color:"#ff7a9c",share:.13,parts:({color:e})=>[et(`${cn([[18,64],[122,64],[122,132],[18,132]],!0)}${cn([[10,42],[130,42],[130,66],[10,66]],!0)}`,e,fn),et(`${cn([[60,42],[80,42],[80,132],[60,132]],!0)}`,Kr,fn),et("M70 42C58 18 30 14 30 30C30 42 50 44 70 42ZM70 42C82 18 110 14 110 30C110 42 90 44 70 42Z",Kr,fn)]},{id:"clover",zh:"四叶草",en:"Clover",category:"sticker",keywords:"四叶草 幸运 好运 草 clover lucky",width:130,height:150,color:"#4cc38a",share:.13,parts:({color:e})=>[mn(Rr([[65,66],[68,104],[80,128],[96,142]]),qt,5),et(Sf(65,62,4,27,25),e,fn)]},{id:"tape",zh:"胶带",en:"Tape",category:"sticker",keywords:"胶带 和纸胶带 贴 照片 tape washi",width:220,height:64,color:"#f4b6b0",rotation:-6,share:.24,parts:({color:e})=>[{kind:"path",d:cn([[14,10],[206,10],[212,18],[206,26],[212,34],[206,42],[212,50],[206,56],[14,56],[8,48],[14,40],[8,32],[14,24],[8,16]],!0),fill:e,opacity:.85}]},{id:"paperclip",zh:"回形针",en:"Paper clip",category:"sticker",keywords:"回形针 别针 夹子 笔记 paperclip clip",width:70,height:170,color:"#8b939e",share:.1,parts:({color:e})=>[mn("M40 60V118A12 12 0 0 1 16 118V30A20 20 0 0 1 56 30V136A26 26 0 0 1 4 136V44",e,6)]},{id:"dots",zh:"点阵",en:"Dot grid",category:"sticker",keywords:"点阵 波点 圆点 网点 dots grid pattern",width:150,height:150,color:"#ff8a3d",share:.16,parts:({color:e})=>[et(Array.from({length:25},(n,r)=>Dn(11+r%5*32,11+Math.floor(r/5)*32,6)).join(""),e)]},{id:"pill",zh:"胶囊标签",en:"Pill label",category:"label",keywords:"标签 胶囊 新 角标 pill tag badge new",width:200,height:56,color:"#ff4d4f",text:{zh:"NEW",en:"NEW"},share:.2,parts:e=>[nr(e,{x:0,y:0,width:200,height:56},38,tr(e.color),{letterSpacing:2,effect:{type:"background",color:e.color,amount:60,radius:100}})]},{id:"outline-pill",zh:"描边标签",en:"Outline label",category:"label",keywords:"标签 描边 分类 话题 outline tag",width:240,height:76,color:qt,text:{zh:"干货分享",en:"Must read"},share:.24,parts:e=>[{kind:"shape",shape:"rect",x:2,y:2,width:236,height:72,stroke:e.color,strokeWidth:3,cornerRadius:36},nr(e,{x:0,y:14,width:240,height:48},32,e.color,{letterSpacing:4})]},{id:"burst-badge",zh:"爆炸贴",en:"Burst badge",category:"label",keywords:"爆炸 促销 限时 特价 角标 burst sale badge",width:180,height:180,color:"#ff4d4f",text:{zh:"限时",en:"SALE"},share:.18,parts:e=>[et(Ri(qa(90,90,86,68,16),3),e.color),nr(e,{x:22,y:63,width:136,height:54},42,tr(e.color),{rotation:-10})]},{id:"price-tag",zh:"价签",en:"Price sticker",category:"label",keywords:"价格 价签 优惠 到手价 price tag",width:170,height:170,color:"#ff4d4f",text:{zh:"¥99",en:"$99"},share:.17,parts:e=>[{kind:"shape",shape:"ellipse",x:4,y:4,width:162,height:162,fill:e.color},{kind:"path",d:Dn(85,85,68),stroke:tr(e.color),strokeWidth:2.5,dash:7},nr(e,{x:10,y:52,width:150,height:66},56,tr(e.color),{letterSpacing:-1})]},{id:"ribbon",zh:"飘带",en:"Ribbon banner",category:"label",keywords:"飘带 横幅 丝带 推荐 标题 ribbon banner",width:340,height:110,color:"#d9382f",text:{zh:"年度推荐",en:"TOP PICK"},share:.36,parts:e=>[et(cn([[8,36],[66,36],[66,98],[8,98],[28,67]],!0)+cn([[332,36],[274,36],[274,98],[332,98],[312,67]],!0),Li(e.color,"#000000",.2)),et(cn([[44,82],[66,82],[66,98]],!0)+cn([[296,82],[274,82],[274,98]],!0),Li(e.color,"#000000",.45)),et(cn([[44,16],[296,16],[296,82],[44,82]],!0),e.color),nr(e,{x:44,y:24,width:252,height:50},38,tr(e.color),{letterSpacing:4})]},{id:"section-tag",zh:"分节标题",en:"Section tag",category:"label",keywords:"分节 小标题 章节 第一部分 section part chapter",width:240,height:76,color:qt,text:{zh:"PART 01",en:"PART 01"},share:.24,parts:e=>[et(cn([[22,6],[234,6],[218,70],[6,70]],!0),e.color),nr(e,{x:20,y:16,width:200,height:44},34,tr(e.color),{letterSpacing:3,fontFamily:"system-ui, sans-serif"})]},{id:"stamp",zh:"印章",en:"Stamp",category:"label",keywords:"印章 盖章 推荐 认证 stamp seal approved",width:160,height:160,color:"#d6332a",text:{zh:"推荐",en:"BEST"},rotation:-12,share:.16,parts:e=>[mn(Dn(80,80,73),e.color,6),mn(Dn(80,80,62),e.color,2),et(cn(qa(80,36,9,4,5),!0),e.color),et(cn(qa(80,124,9,4,5),!0),e.color),nr(e,{x:16,y:54,width:128,height:52},44,e.color,{letterSpacing:2})]},{id:"number",zh:"序号",en:"Number badge",category:"label",keywords:"序号 编号 数字 步骤 number step badge",width:100,height:100,color:qt,text:{zh:"01",en:"01"},share:.1,parts:e=>[{kind:"shape",shape:"ellipse",x:2,y:2,width:96,height:96,fill:e.color},nr(e,{x:0,y:24,width:100,height:52},44,tr(e.color))]},{id:"speech-label",zh:"对话框",en:"Speech label",category:"label",keywords:"对话框 气泡 划重点 提示 speech callout",width:230,height:130,color:qt,text:{zh:"划重点",en:"Key point"},share:.24,parts:e=>[et("M34 6H196A28 28 0 0 1 224 34V68A28 28 0 0 1 196 96H78L34 124L46 96H34A28 28 0 0 1 6 68V34A28 28 0 0 1 34 6Z",e.color),nr(e,{x:6,y:26,width:218,height:50},36,tr(e.color),{letterSpacing:2})]},{id:"sticky-note",zh:"便利贴",en:"Sticky note",category:"label",keywords:"便利贴 便签 笔记 待办 sticky note memo",width:220,height:220,color:"#ffe066",text:{zh:"今日待办",en:"To do"},share:.26,parts:e=>[{kind:"path",d:cn([[14,14],[206,14],[206,168],[168,206],[14,206]],!0),fill:e.color,shadow:{color:"#b9ae8c",blur:14,offsetX:0,offsetY:6}},et(cn([[206,168],[168,206],[174,174]],!0),Li(e.color,"#000000",.16)),nr(e,{x:34,y:38,width:152,height:48},32,Li(e.color,qt,.85),{fontFamily:fx,fontWeight:"normal"})]},{id:"hang-tag",zh:"吊牌",en:"Hang tag",category:"label",keywords:"吊牌 标签 价格 促销 tag sale",width:240,height:110,color:Kr,text:{zh:"SALE",en:"SALE"},share:.24,parts:e=>[{kind:"path",d:`M62 10H224A12 12 0 0 1 236 22V88A12 12 0 0 1 224 100H62L14 55Z${Dn(46,55,9)}`,fill:e.color,stroke:qt,strokeWidth:3,fillRule:"evenodd"},nr(e,{x:66,y:29,width:160,height:52},40,tr(e.color),{letterSpacing:4})]},{id:"coupon",zh:"票券",en:"Coupon",category:"label",keywords:"票券 优惠券 券 满减 折扣 coupon ticket voucher",width:340,height:130,color:"#f25a2c",text:{zh:"满100减20",en:"20% OFF"},share:.34,parts:e=>[et("M20 10H244A12 12 0 0 0 268 10H320A14 14 0 0 1 334 24V106A14 14 0 0 1 320 120H268A12 12 0 0 0 244 120H20A14 14 0 0 1 6 106V24A14 14 0 0 1 20 10Z",e.color),{kind:"path",d:"M256 32V98",stroke:tr(e.color),strokeWidth:3,dash:6},et(Ri(qa(301,65,17,7.5,5),2),tr(e.color)),nr(e,{x:14,y:42,width:232,height:46},36,tr(e.color))]}],px=new Map(Yi.map(e=>[e.id,e])),gx=new Map(Yi.map(e=>[e.zh,e]));function E0(e){return px.get(e)}function xx(e){return gx.get(e)}function bx(e){const n=e.trim().toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?[...Yi]:Yi.filter(r=>{const s=`${r.id} ${r.zh} ${r.en} ${r.keywords}`.toLowerCase();return n.every(l=>s.includes(l))})}const Wo=8;function z0(e){if(e.kind==="path"){const n=z1(e.d)??{x:0,y:0,width:1,height:1},r=e.stroke?(e.strokeWidth??4)/2:0;return{x:n.x-r,y:n.y-r,width:Math.max(1,n.width+r*2),height:Math.max(1,n.height+r*2)}}if(e.kind==="shape"&&e.stroke){const n=(e.strokeWidth??2)/2;return{x:e.x-n,y:e.y-n,width:e.width+n*2,height:e.height+n*2}}return{x:e.x,y:e.y,width:e.width,height:e.height}}const vf=new Map;function gd(e){var c;const n=vf.get(e.id);if(n)return n;const r=e.parts({color:e.color,text:((c=e.text)==null?void 0:c.zh)??""}).map(z0),s=Math.min(...r.map(f=>f.x)),l=Math.min(...r.map(f=>f.y)),o={x:s,y:l,width:Math.max(...r.map(f=>f.x+f.width))-s,height:Math.max(...r.map(f=>f.y+f.height))-l};return vf.set(e.id,o),o}function yx(e){const n=e.parts({color:e.color,text:""});return n.length===1&&n[0].kind==="path"}const jx={path:"图形",shape:"形状",text:"文本"},Tt=e=>Math.round(e*100)/100;function Nf(e,n,r,s,l){const o={id:l,name:s,locked:!1,hidden:!1},c=z0(e),f=n(c),h={x:Tt(f.x),y:Tt(f.y),width:Math.max(1,Tt(f.width)),height:Math.max(1,Tt(f.height)),rotation:0,scale:1};if(e.kind==="path")return{...o,type:"path",...h,d:e.d,viewBox:{x:Tt(c.x),y:Tt(c.y),width:Tt(c.width),height:Tt(c.height)},fill:e.fill?{type:"solid",color:e.fill}:{type:"transparent"},stroke:e.stroke??qt,strokeWidth:e.stroke?e.strokeWidth??4:0,...e.opacity!==void 0?{opacity:e.opacity}:{},...e.blendMode?{blendMode:e.blendMode}:{},...e.fillRule?{fillRule:e.fillRule}:{},...e.dash!==void 0?{dash:e.dash}:{},...e.shadow?{shadow:{color:e.shadow.color,blur:Tt(e.shadow.blur*r),offsetX:Tt(e.shadow.offsetX*r),offsetY:Tt(e.shadow.offsetY*r)}}:{}};if(e.kind==="shape"){const m=n({x:e.x,y:e.y,width:e.width,height:e.height});return{...o,type:"shape",...h,x:Tt(m.x),y:Tt(m.y),width:Math.max(1,Tt(m.width)),height:Math.max(1,Tt(m.height)),shape:e.shape,fill:e.fill?{type:"solid",color:e.fill}:{type:"transparent"},stroke:e.stroke??"transparent",strokeWidth:e.stroke?Tt((e.strokeWidth??2)*r):0,...e.cornerRadius!==void 0?{cornerRadius:Tt(e.cornerRadius*r)}:{}}}const g=Math.max(1,Math.round(e.fontSize*r*10)/10);return{...o,type:"text",x:Tt(f.x-Wo),y:Tt(f.y-Wo),width:Tt(f.width+Wo*2),height:Tt(f.height+Wo*2),rotation:e.rotation??0,scale:1,text:e.text,fontSize:g,fontFamily:e.fontFamily??C0,textFill:{type:"solid",color:e.color},align:"center",fontWeight:e.fontWeight??"bold",lineHeight:Tt(f.height/g),...e.letterSpacing!==void 0?{letterSpacing:Tt(e.letterSpacing*r)}:{},...e.effect?{effect:{...e.effect}}:{}}}function xd(e,n,r=()=>fi()){var N;const s=n.color??e.color,l=n.text??((N=e.text)==null?void 0:N[n.language??"zh"])??"",o=e.parts({color:s,text:l}),c=gd(e),f=n.width/c.width,h=yx(e)&&n.height!==void 0?n.height:c.height*f,g=h/c.height,x=Math.sqrt(f*g),m=e.rotation??0,j=F=>({x:n.x+(F.x-c.x)*f,y:n.y+(F.y-c.y)*g,width:F.width*f,height:F.height*g});if(o.length===1){const F=Nf(o[0],j,x,e.zh,r());return F.type==="group"?F:{...F,rotation:F.rotation+m}}const k={x:n.x+n.width/2,y:n.y+h/2},v=o.map(F=>{const I=Nf(F,j,x,jx[F.kind],r());return I.type==="group"?I:{...I,x:Tt(I.x-k.x),y:Tt(I.y-k.y)}});return{id:r(),name:e.zh,locked:!1,hidden:!1,type:"group",x:Tt(k.x),y:Tt(k.y),rotation:m,scale:1,children:v}}function wx(e,n){const r=gd(e),s=Math.max(24,Math.round(Math.min(n.width,n.height)*e.share));return{width:s,height:Math.max(1,Math.round(s*r.height/r.width))}}const kx=(e,n,r)=>`${e.name}字 ${n+1}-${r+1}`,Sx=(e,n,r)=>`${e.name}格 ${n+1}-${r+1}`;function vx(e,n){return{rows:Math.max(1,Math.min(e.maxRows,n.length)),columns:Math.max(1,Math.min(e.maxColumns,Math.max(0,...n.map(r=>r.length))))}}function Nx(e,n,r=()=>fi()){var k;const{rows:s,columns:l}=vx(e,n),o=l>1?e.width*e.labelShare:e.width,c=l>1?(e.width-o-e.gap*(l-1))/(l-1):0,f=s>1?e.height*e.headerShare:e.height,h=s>1?(e.height-f-e.gap*(s-1))/(s-1):0,g=new Map,x=v=>v?(g.has(v)||g.set(v,e.body.palette[g.size%e.body.palette.length]),g.get(v)):e.body.empty,m=v=>Math.round(v*10)/10,j=[];for(let v=0;v<s;v+=1)for(let w=0;w<l;w+=1){const N=(((k=n[v])==null?void 0:k[w])??"").trim(),F=e.x+(w===0?0:o+e.gap+(w-1)*(c+e.gap)),I=e.y+(v===0?0:f+e.gap+(v-1)*(h+e.gap)),M=w===0?o:c,z=v===0?f:h,A=v===0?e.header:w===0?e.labels:{fill:x(N),...e.body};if(j.push({id:r(),name:Sx(e,v,w),locked:!1,hidden:!1,type:"shape",x:m(F),y:m(I),width:m(M),height:m(z),rotation:0,scale:1,shape:"rect",fill:{type:"solid",color:A.fill},stroke:"transparent",strokeWidth:0,cornerRadius:e.radius}),!N)continue;const T=N.split(`
|
|
3
|
+
`).length,L=1.3,H=Math.min(z,A.fontSize*L*T+16);j.push({id:r(),name:kx(e,v,w),locked:!1,hidden:!1,type:"text",x:m(F),y:m(I+(z-H)/2),width:m(M),height:m(H),rotation:0,scale:1,text:N,fontSize:A.fontSize,fontFamily:e.font,textFill:{type:"solid",color:A.color},align:"center",fontWeight:v===0||w>0?"bold":"normal",lineHeight:L})}return j}const Fx={name:"课表",x:90,y:300,width:1574,height:850,gap:12,labelShare:.13,headerShare:.1,radius:18,font:"PingFang SC, Microsoft YaHei, system-ui, sans-serif",header:{fill:"#2f2a24",color:"#ffffff",fontSize:34},labels:{fill:"#efe6d6",color:"#5a4f43",fontSize:26},body:{color:"#2f2a24",fontSize:38,empty:"#f6f1e8",palette:["#ffd9d2","#d4e6ff","#fff0bf","#d4f2e1","#e7dcff","#ffe0ee","#ffe4c8","#d6f0f2","#ecf3c6","#f0ddd0","#dce3f7","#f7d9f2"]},maxRows:12,maxColumns:8},Mx=[["节次","周一","周二","周三","周四","周五"],[`第 1 节
|
|
4
4
|
8:00`,"语文","数学","英语","语文","数学"],[`第 2 节
|
|
5
5
|
8:55`,"数学","语文","数学","英语","语文"],[`第 3 节
|
|
6
6
|
10:00`,"英语","科学","语文","数学","美术"],[`第 4 节
|
|
7
7
|
10:55`,"体育","音乐","体育","科学","英语"],[`第 5 节
|
|
8
8
|
14:00`,"美术","数学","道法","体育","班会"],[`第 6 节
|
|
9
9
|
14:55`,"科学","体育","音乐","书法","阅读"],[`第 7 节
|
|
10
|
-
15:50`,"阅读","英语","社团","阅读","社团"]],d=e=>({type:"solid",color:e}),
|
|
10
|
+
15:50`,"阅读","英语","社团","阅读","社团"]],d=e=>({type:"solid",color:e}),ir=(e,n)=>({type:"linear-gradient",stops:e.map(([r,s])=>({offset:r,color:s})),angle:n}),de=16;function Cx(e){return{...e}}function xr(){return fi()}function b(e,n,r,s,l,o={}){return{id:xr(),name:o.name??"文字",locked:!1,hidden:!1,type:"text",x:n,y:r,width:s,height:l,rotation:o.rotation??0,scale:1,text:e,fontSize:o.fontSize??42,fontFamily:o.fontFamily??"PingFang SC",textFill:o.textFill??d("#18181b"),align:o.align??"left",fontWeight:o.fontWeight??"normal",...o.lineHeight!==void 0?{lineHeight:o.lineHeight}:{},...o.letterSpacing!==void 0?{letterSpacing:o.letterSpacing}:{},...o.italic?{italic:!0}:{},...o.vertical?{vertical:!0}:{},...o.opacity!==void 0?{opacity:o.opacity}:{},...o.shadow?{shadow:{...o.shadow}}:{},...o.filter?{filter:{...o.filter}}:{},...o.blendMode?{blendMode:o.blendMode}:{},...o.stroke!==void 0?{stroke:o.stroke}:{},...o.strokeWidth!==void 0?{strokeWidth:o.strokeWidth}:{},...o.effect?{effect:{...o.effect}}:{},...o.verticalAlign?{verticalAlign:o.verticalAlign}:{}}}function V(e,n,r,s,l,o,c={}){return{id:xr(),name:c.name??"色块",locked:!1,hidden:!1,type:"shape",x:n,y:r,width:s,height:l,rotation:c.rotation??0,scale:1,shape:e,fill:o,stroke:c.stroke??"transparent",strokeWidth:c.strokeWidth??0,...c.cornerRadius!==void 0?{cornerRadius:c.cornerRadius}:{},...c.opacity!==void 0?{opacity:c.opacity}:{},...c.shadow?{shadow:{...c.shadow}}:{},...c.filter?{filter:{...c.filter}}:{},...c.blendMode?{blendMode:c.blendMode}:{}}}function Z(e,n,r,s,l=6,o={}){return{id:xr(),name:o.name??"分隔线",locked:!1,hidden:!1,type:"line",lineKind:o.lineKind??"line",x:e,y:n,width:r,height:12,rotation:o.rotation??0,scale:1,stroke:s,strokeWidth:l,...o.opacity!==void 0?{opacity:o.opacity}:{},...o.shadow?{shadow:{...o.shadow}}:{},...o.filter?{filter:{...o.filter}}:{},...o.blendMode?{blendMode:o.blendMode}:{},...o.dash!==void 0?{dash:o.dash}:{},...o.cap?{cap:o.cap}:{},...o.startCap?{startCap:o.startCap}:{},...o.endCap?{endCap:o.endCap}:{}}}function va(e,n,r,s,l,o={}){const c=r-n;return Z(e-c/2,(n+r)/2-6,c,s,l,{...o,rotation:90})}function Y(e,n,r,s,l,o={}){return{id:xr(),name:o.name??"路径",locked:!1,hidden:!1,type:"path",x:n,y:r,width:s,height:l,rotation:0,scale:1,d:e,viewBox:{x:0,y:0,width:s,height:l},fill:o.fill??{type:"transparent"},stroke:o.stroke??"#000000",strokeWidth:o.strokeWidth??4,...o.dash!==void 0?{dash:o.dash}:{},...o.cap?{cap:o.cap}:{},...o.join?{join:o.join}:{},...o.opacity!==void 0?{opacity:o.opacity}:{},...o.shadow?{shadow:{...o.shadow}}:{},...o.blendMode?{blendMode:o.blendMode}:{}}}function fe(e,n,r,s={width:1080,height:1440}){return{id:xr(),name:e,width:s.width,height:s.height,background:n,nodes:r}}function we(e){const n={documentVersion:44,activeSlideId:e[0].id,slides:e},r=R1(n);if(!r)throw new Error("内置模板生成了无效的自由画布文档");return r}const Ex={column:{source:`# 在城市里慢慢走
|
|
11
11
|
|
|
12
12
|
这半年,我把周末的打车换成了走路。本来只想省点钱,没想到,走路让我重新认识了住了五年的城市。
|
|
13
13
|
|
|
@@ -385,98 +385,104 @@ var C1=Object.defineProperty;var E1=(e,n,r)=>n in e?C1(e,n,{enumerable:!0,config
|
|
|
385
385
|
|
|
386
386
|
**本周花销:** 市集 86 元,咖啡豆 58 元,旧书 5 元。
|
|
387
387
|
|
|
388
|
-
下周也要记得,给自己留一个慢慢过的周末。`,platformId:"rednote",themeId:"template-journal",fontFamily:"'LXGW WenKai TC', cursive",radius:0,profile:{...Kn,nickname:"叮卡",handle:"dingcard"}}};function zx(e){const n=Ex[e];return{...n,profile:Cx(n.profile)}}const X="'Noto Serif SC', serif",
|
|
388
|
+
下周也要记得,给自己留一个慢慢过的周末。`,platformId:"rednote",themeId:"template-journal",fontFamily:"'LXGW WenKai TC', cursive",radius:0,profile:{...Kn,nickname:"叮卡",handle:"dingcard"}}};function zx(e){const n=Ex[e];return{...n,profile:Cx(n.profile)}}const X="'Noto Serif SC', serif",ri="'LXGW WenKai TC', cursive",ie="system-ui, sans-serif",_="'Noto Sans SC', sans-serif",Ft="'Playfair Display', serif",Xe="'Archivo Black', sans-serif",Ys="'Great Vibes', cursive",na="'Ma Shan Zheng', cursive",Rx="'ZCOOL QingKe HuangYou', sans-serif",Ix={paper:"#f6f3ea",ink:"#1b1a18",red:"#c23a26",redOnInk:"#e5503a",muted:"#5f584e",band:"#e7dfcf"},Lx=(e,n)=>b(e,88,72,640,48,{name:"刊头",fontSize:24,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:6});function $x(){const{paper:e,ink:n,red:r,redOnInk:s,muted:l,band:o}=Ix,c=Lx;return we([fe("封面",d(e),[Z(88,130,904,n,3,{name:"刊头线"}),V("rect",88,712,132,12,d(r),{name:"标题线",cornerRadius:0}),Z(88,1294,904,n,2,{name:"页脚线"}),c("THE DINGCARD REVIEW",n),b("2026 · AUTUMN",692,72,300,48,{name:"期号",fontSize:24,fontFamily:ie,textFill:d(l),align:"right",letterSpacing:3}),b("FIELD NOTES",88,194,420,60,{name:"栏目",fontSize:28,fontFamily:ie,textFill:d("#ffffff"),fontWeight:"bold",letterSpacing:5,effect:{type:"background",color:r,amount:45,radius:8}}),b(`开头先把
|
|
389
389
|
判断写清楚`,80,290,920,390,{name:"主标题",fontSize:150,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.18,letterSpacing:-2}),b(`第一屏负责给出判断,
|
|
390
|
-
后面的页面再交代过程。`,88,756,800,140,{name:"导语",fontSize:40,fontFamily:X,textFill:d(l),lineHeight:1.6}),b("01",520,904,480,370,{name:"大期号",fontSize:340,fontFamily:X,textFill:d(r),fontWeight:"bold",align:"right",lineHeight:1,effect:{type:"hollow",amount:30}}),b("叮卡编辑部",88,1318,400,44,{name:"署名",fontSize:24,fontFamily:ie,textFill:d(n),letterSpacing:2}),b("先判断,再展开",592,1318,400,44,{name:"页脚主题",fontSize:24,fontFamily:ie,textFill:d(l),align:"right",letterSpacing:2})]),
|
|
390
|
+
后面的页面再交代过程。`,88,756,800,140,{name:"导语",fontSize:40,fontFamily:X,textFill:d(l),lineHeight:1.6}),b("01",520,904,480,370,{name:"大期号",fontSize:340,fontFamily:X,textFill:d(r),fontWeight:"bold",align:"right",lineHeight:1,effect:{type:"hollow",amount:30}}),b("叮卡编辑部",88,1318,400,44,{name:"署名",fontSize:24,fontFamily:ie,textFill:d(n),letterSpacing:2}),b("先判断,再展开",592,1318,400,44,{name:"页脚主题",fontSize:24,fontFamily:ie,textFill:d(l),align:"right",letterSpacing:2})]),fe("内页",d(e),[Z(88,130,904,n,3,{name:"刊头线"}),Z(88,724,904,n,3,{name:"正文分隔线"}),V("rect",-de,1004,1080+de*2,250,d(o),{name:"引文底板",cornerRadius:0}),V("rect",88,1052,10,154,d(r),{name:"引文竖线",cornerRadius:0}),Z(88,1294,904,n,2,{name:"页脚线"}),c("THE DINGCARD REVIEW",n),b("02",792,72,200,48,{name:"页码",fontSize:28,fontFamily:ie,textFill:d(r),fontWeight:"bold",align:"right",letterSpacing:2}),b(`每一页
|
|
391
391
|
都要往前走`,80,192,920,300,{name:"标题",fontSize:112,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.2,letterSpacing:-1}),b("分页不是把一段话切开,而是安排读者先看到什么、接着理解什么。",88,518,880,170,{name:"导语",fontSize:38,fontFamily:X,textFill:d(l),lineHeight:1.6}),b(`01
|
|
392
392
|
提出问题`,88,762,280,190,{name:"步骤一",fontSize:44,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.4}),b(`02
|
|
393
393
|
解释原因`,400,762,280,190,{name:"步骤二",fontSize:44,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.4}),b(`03
|
|
394
394
|
给出下一步`,712,762,280,190,{name:"步骤三",fontSize:44,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.4}),b(`“抽掉这一页,
|
|
395
|
-
文章有没有少一个关键动作?”`,136,1046,856,130,{name:"引文",fontSize:42,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.45}),b("用这个问题检查跨页节奏",136,1180,856,48,{name:"引文注释",fontSize:28,fontFamily:ie,textFill:d(l),letterSpacing:1}),b("阅读顺序 / 02",88,1318,400,44,{name:"页脚",fontSize:24,fontFamily:ie,textFill:d(n),letterSpacing:2})]),
|
|
395
|
+
文章有没有少一个关键动作?”`,136,1046,856,130,{name:"引文",fontSize:42,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.45}),b("用这个问题检查跨页节奏",136,1180,856,48,{name:"引文注释",fontSize:28,fontFamily:ie,textFill:d(l),letterSpacing:1}),b("阅读顺序 / 02",88,1318,400,44,{name:"页脚",fontSize:24,fontFamily:ie,textFill:d(n),letterSpacing:2})]),fe("结尾",d(n),[Z(88,130,904,e,3,{name:"刊头线"}),V("rect",88,772,132,10,d(s),{name:"正文线",cornerRadius:0}),V("rect",806,1080,176,176,d(r),{name:"印章",cornerRadius:20,rotation:-8}),Z(88,1294,904,"#3b3732",2,{name:"页脚线"}),c("THE DINGCARD REVIEW · 03",e),b("03",792,72,200,48,{name:"页码",fontSize:28,fontFamily:ie,textFill:d(s),fontWeight:"bold",align:"right",letterSpacing:2}),b(`结尾要让文章
|
|
396
396
|
真正落地`,80,192,920,300,{name:"标题",fontSize:112,fontFamily:X,textFill:d(e),fontWeight:"bold",lineHeight:1.2,letterSpacing:-1}),b("给出下一步,或者留下一句值得记住的话。不要把开头再说一遍。",88,530,860,190,{name:"正文",fontSize:38,fontFamily:X,textFill:d("#c2baad"),lineHeight:1.6}),b(`一句结论
|
|
397
397
|
一个动作
|
|
398
|
-
到此结束`,88,818,680,300,{name:"结尾清单",fontSize:50,fontFamily:ie,textFill:d(e),fontWeight:"bold",lineHeight:1.6}),b("完",806,1088,176,160,{name:"印章文字",fontSize:104,fontFamily:X,textFill:d(e),fontWeight:"bold",align:"center",lineHeight:1,rotation:-8}),b("THE DINGCARD REVIEW",88,1318,600,44,{name:"页脚",fontSize:24,fontFamily:ie,textFill:d("#948b7e"),letterSpacing:6})])])}const Dx={paper:"#f3f5ec",green:"#1f4d3a",deep:"#14261d",mint:"#dfe9dc",yellow:"#f2c94c",muted:"#5c6f64",rule:"#dce3d6",frame:"#cfd8cb",ruleOnGreen:"#3c6a56",mutedOnGreen:"#a8c3b5"},Ax=e=>b("DINGCARD WORKBOOK",88,1318,600,44,{name:"页脚",fontSize:24,fontFamily:ie,textFill:d(e),fontWeight:"bold",letterSpacing:4});function Px(){const{paper:e,green:n,deep:r,mint:s,yellow:l,muted:o,rule:c,frame:f,ruleOnGreen:h,mutedOnGreen:g}=Dx,x="#ffffff",m=Ax,j=(v,w,N,
|
|
398
|
+
到此结束`,88,818,680,300,{name:"结尾清单",fontSize:50,fontFamily:ie,textFill:d(e),fontWeight:"bold",lineHeight:1.6}),b("完",806,1088,176,160,{name:"印章文字",fontSize:104,fontFamily:X,textFill:d(e),fontWeight:"bold",align:"center",lineHeight:1,rotation:-8}),b("THE DINGCARD REVIEW",88,1318,600,44,{name:"页脚",fontSize:24,fontFamily:ie,textFill:d("#948b7e"),letterSpacing:6})])])}const Dx={paper:"#f3f5ec",green:"#1f4d3a",deep:"#14261d",mint:"#dfe9dc",yellow:"#f2c94c",muted:"#5c6f64",rule:"#dce3d6",frame:"#cfd8cb",ruleOnGreen:"#3c6a56",mutedOnGreen:"#a8c3b5"},Ax=e=>b("DINGCARD WORKBOOK",88,1318,600,44,{name:"页脚",fontSize:24,fontFamily:ie,textFill:d(e),fontWeight:"bold",letterSpacing:4});function Px(){const{paper:e,green:n,deep:r,mint:s,yellow:l,muted:o,rule:c,frame:f,ruleOnGreen:h,mutedOnGreen:g}=Dx,x="#ffffff",m=Ax,j=(v,w,N,F,I,M)=>{const z=396+v*230,A=["一","二","三"][v];return[V("rect",88,z+4,116,116,d(I),{name:`编号底板${A}`,cornerRadius:30}),Z(240,z+186,752,c,2,{name:`步骤线${A}`}),b(w,88,z+26,116,72,{name:`编号${A}`,fontSize:54,fontFamily:ie,textFill:d(M),fontWeight:"bold",align:"center"}),b(N,240,z,752,76,{name:`步骤${A}`,fontSize:50,textFill:d(r),fontWeight:"bold"}),b(F,240,z+82,752,60,{name:`说明${A}`,fontSize:34,textFill:d(o)})]},k=(v,w)=>{const N=504+v*150,F=["一","二","三"][v];return[V("ellipse",88,N,76,76,d(l),{name:`完成点${F}`}),Z(196,N+110,796,h,2,{name:`验收线${F}`}),b("✓",88,N+8,76,60,{name:`勾${F}`,fontSize:40,fontFamily:ie,textFill:d(n),fontWeight:"bold",align:"center"}),b(w,196,N+2,796,72,{name:`验收项${F}`,fontSize:46,textFill:d(e),fontWeight:"bold"})]};return we([fe("封面",d(e),[Y("M 24 112 L 96 184 L 236 24",760,70,260,210,{name:"勾形",stroke:l,strokeWidth:40,cap:"round",join:"round"}),Z(88,806,904,f,2,{name:"清单线一"}),V("rect",88,846,60,60,d(n),{name:"复选框一",cornerRadius:16}),V("rect",88,976,60,60,d(e),{name:"复选框二",cornerRadius:16,stroke:n,strokeWidth:5}),V("rect",88,1106,60,60,d(e),{name:"复选框三",cornerRadius:16,stroke:n,strokeWidth:5}),Z(88,934,904,c,2,{name:"清单线二"}),Z(88,1064,904,c,2,{name:"清单线三"}),Z(88,1294,904,f,2,{name:"页脚线"}),b("CHECKLIST",88,110,360,60,{name:"标签文字",fontSize:30,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:5,effect:{type:"background",color:l,amount:55,radius:100}}),b(`把计划写到
|
|
399
399
|
能立刻开工`,80,300,920,330,{name:"主标题",fontSize:128,textFill:d(r),fontWeight:"bold",lineHeight:1.18,letterSpacing:-2}),b(`先确定今天交付什么,
|
|
400
|
-
再把它拆成看得见的动作。`,88,640,840,130,{name:"导语",fontSize:38,textFill:d(o),lineHeight:1.55}),b("✓",88,852,60,48,{name:"勾一",fontSize:34,fontFamily:ie,textFill:d(x),fontWeight:"bold",align:"center"}),b("目标已经写清楚",180,840,812,72,{name:"检查项一",fontSize:44,textFill:d(r),fontWeight:"bold"}),b("完成标准可以验证",180,970,812,72,{name:"检查项二",fontSize:44,textFill:d(r),fontWeight:"bold"}),b("素材集中在一个地方",180,1100,812,72,{name:"检查项三",fontSize:44,textFill:d(r),fontWeight:"bold"}),m(n),b("01 / 03",692,1318,300,44,{name:"边栏页码",fontSize:26,fontFamily:ie,textFill:d(n),fontWeight:"bold",align:"right",letterSpacing:2})]),
|
|
401
|
-
逐项打勾`,80,196,920,290,{name:"标题",fontSize:112,textFill:d(e),fontWeight:"bold",lineHeight:1.18,letterSpacing:-1}),...k(0,"第一页能看懂主题"),...k(1,"中间没有突然拥挤"),...k(2,"最后一页给出下一步"),b("03 / 03",80,960,920,230,{name:"完成进度",fontSize:200,fontFamily:ie,textFill:d(l),fontWeight:"bold",letterSpacing:-6,lineHeight:1}),b("全部完成,可以导出。",88,1196,904,72,{name:"结论",fontSize:40,textFill:d(e),fontWeight:"bold"}),m(g)])])}const Tx={paper:"#f1efe9",black:"#111111",red:"#d63b24",blue:"#2550d9",yellow:"#f4c542"};function Wx(){const{paper:e,black:n,red:r,blue:s,yellow:l}=Tx,o=(c,f,h,g)=>{const x=214+c*200,m=["一","二","三"][c];return[Z(512,x+170,504,"#cfcbc2",2,{name:`证据线${m}`}),b(f,512,x,96,110,{name:`证据编号${m}`,fontSize:96,fontFamily:ie,textFill:d(h),fontWeight:"bold",lineHeight:1}),b(g,624,x+10,392,130,{name:`证据${m}`,fontSize:40,textFill:d(n),fontWeight:"bold",lineHeight:1.35})]};return
|
|
402
|
-
才发现你真正想说什么。`,64,944,952,180,{name:"主张",fontSize:56,textFill:d(n),fontWeight:"bold",lineHeight:1.35}),b("判断站在第一屏,证据跟在后面。",64,1146,952,60,{name:"说明",fontSize:34,textFill:d("#55524c")}),b("DINGCARD SIGNAL",64,1318,600,44,{name:"页脚",fontSize:24,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:4}),b("2026",816,1318,200,44,{name:"页脚编号",fontSize:24,fontFamily:ie,textFill:d(n),align:"right",letterSpacing:4})]),
|
|
403
|
-
判断后面`,56,330,370,240,{name:"主标题",fontSize:88,textFill:d("#ffffff"),fontWeight:"bold",lineHeight:1.2}),b("先说结论,不会削弱论证。它只是让读者知道,接下来的材料在回答什么。",60,640,360,360,{name:"左栏正文",fontSize:34,textFill:d("#d7e0ff"),lineHeight:1.65}),b("02",816,88,200,60,{name:"页码",fontSize:40,fontFamily:ie,textFill:d(n),fontWeight:"bold",align:"right"}),...o(0,"A",r,"先给一个清楚的判断"),...o(1,"B",s,"再摆最有力的事实"),...o(2,"C",n,"删掉不能支撑判断的材料"),b("顺序清楚,论证才有方向。",512,950,504,200,{name:"结论",fontSize:50,textFill:d("#ffffff"),fontWeight:"bold",lineHeight:1.35}),b("SIGNAL / 02",512,1318,400,44,{name:"页脚",fontSize:24,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:4})]),
|
|
404
|
-
给一个动作。`,64,280,740,320,{name:"主标题",fontSize:116,textFill:d(e),fontWeight:"bold",lineHeight:1.18}),b("→",820,368,196,140,{name:"箭头文字",fontSize:120,fontFamily:ie,textFill:d(n),fontWeight:"bold",align:"center",lineHeight:1}),b("今天试一次",120,776,840,110,{name:"行动标题",fontSize:80,textFill:d("#ffffff"),fontWeight:"bold"}),b("明天回来,看结果。",120,904,840,70,{name:"行动说明",fontSize:40,textFill:d("#ffffff")}),b("能被执行的观点,才会真正留下来。",64,1104,952,110,{name:"收束句",fontSize:40,textFill:d("#bdbab3"),lineHeight:1.45}),b("DINGCARD SIGNAL",64,1318,600,44,{name:"页脚",fontSize:24,fontFamily:ie,textFill:d(e),fontWeight:"bold",letterSpacing:4})])])}const Hx={night:"#0e1824",cream:"#f4eee2",amber:"#f2b84b",teal:"#6fb7c8",coral:"#e8664a",muted:"#a6b3bf",rule:"#26374a",axis:"#3d5570"};function Ox(){const{night:e,cream:n,amber:r,teal:s,coral:l,muted:o,rule:c,axis:f}=Hx,h=(g,x,m,j)=>{const k=470+g*220,v=["一","二","三"][g];return[
|
|
400
|
+
再把它拆成看得见的动作。`,88,640,840,130,{name:"导语",fontSize:38,textFill:d(o),lineHeight:1.55}),b("✓",88,852,60,48,{name:"勾一",fontSize:34,fontFamily:ie,textFill:d(x),fontWeight:"bold",align:"center"}),b("目标已经写清楚",180,840,812,72,{name:"检查项一",fontSize:44,textFill:d(r),fontWeight:"bold"}),b("完成标准可以验证",180,970,812,72,{name:"检查项二",fontSize:44,textFill:d(r),fontWeight:"bold"}),b("素材集中在一个地方",180,1100,812,72,{name:"检查项三",fontSize:44,textFill:d(r),fontWeight:"bold"}),m(n),b("01 / 03",692,1318,300,44,{name:"边栏页码",fontSize:26,fontFamily:ie,textFill:d(n),fontWeight:"bold",align:"right",letterSpacing:2})]),fe("步骤",d(e),[Z(88,164,904,f,2,{name:"刊头线"}),V("rect",88,1094,904,176,d(s),{name:"批注底板",cornerRadius:32}),Z(88,1294,904,f,2,{name:"页脚线"}),b("CHECKLIST / 02",88,100,600,44,{name:"刊头",fontSize:26,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:4}),b("开工前确认",80,200,920,150,{name:"页标题",fontSize:104,textFill:d(r),fontWeight:"bold",letterSpacing:-1}),...j(0,"01","这次只解决一个问题","范围越清楚,开始越容易。",n,x),...j(1,"02","一句话写出完成标准","最后要交付什么,必须能被检查。",l,n),...j(2,"03","把素材收进同一处","减少寻找和切换,给执行留出连续时间。",n,x),b("不满足的项目先补齐,不急着进入制作。",136,1134,808,96,{name:"批注",fontSize:36,textFill:d(n),fontWeight:"bold",lineHeight:1.45}),m(n)]),fe("验收",d(n),[Z(88,164,904,h,2,{name:"刊头线"}),Z(88,1294,904,h,2,{name:"页脚线"}),b("FINAL CHECK / 03",88,100,600,44,{name:"刊头",fontSize:26,fontFamily:ie,textFill:d(l),fontWeight:"bold",letterSpacing:4}),b(`发布前,
|
|
401
|
+
逐项打勾`,80,196,920,290,{name:"标题",fontSize:112,textFill:d(e),fontWeight:"bold",lineHeight:1.18,letterSpacing:-1}),...k(0,"第一页能看懂主题"),...k(1,"中间没有突然拥挤"),...k(2,"最后一页给出下一步"),b("03 / 03",80,960,920,230,{name:"完成进度",fontSize:200,fontFamily:ie,textFill:d(l),fontWeight:"bold",letterSpacing:-6,lineHeight:1}),b("全部完成,可以导出。",88,1196,904,72,{name:"结论",fontSize:40,textFill:d(e),fontWeight:"bold"}),m(g)])])}const Tx={paper:"#f1efe9",black:"#111111",red:"#d63b24",blue:"#2550d9",yellow:"#f4c542"};function Wx(){const{paper:e,black:n,red:r,blue:s,yellow:l}=Tx,o=(c,f,h,g)=>{const x=214+c*200,m=["一","二","三"][c];return[Z(512,x+170,504,"#cfcbc2",2,{name:`证据线${m}`}),b(f,512,x,96,110,{name:`证据编号${m}`,fontSize:96,fontFamily:ie,textFill:d(h),fontWeight:"bold",lineHeight:1}),b(g,624,x+10,392,130,{name:`证据${m}`,fontSize:40,textFill:d(n),fontWeight:"bold",lineHeight:1.35})]};return we([fe("封面",d(e),[V("rect",-de,-de,436+de,376+de,d(r),{name:"红色象限",cornerRadius:0}),V("rect",470,330,220,20,d(s),{name:"蓝色坐标轴",cornerRadius:0}),Z(64,902,952,n,10,{name:"中部网格线",cap:"butt"}),Z(64,1294,952,n,3,{name:"页脚线",cap:"butt"}),b("01",40,96,360,240,{name:"圆点编号",fontSize:230,fontFamily:ie,textFill:d(e),fontWeight:"bold",letterSpacing:-10,lineHeight:1}),b("SIGNAL / POSTER 01",470,72,546,44,{name:"刊头",fontSize:24,fontFamily:ie,textFill:d(n),fontWeight:"bold",align:"right",letterSpacing:4}),b("CLAIM FIRST →",470,252,546,64,{name:"英文主张",fontSize:40,fontFamily:ie,textFill:d(s),fontWeight:"bold",letterSpacing:4}),b("观点",64,400,952,240,{name:"标题上",fontSize:175,textFill:d(n),fontWeight:"bold",letterSpacing:-6,lineHeight:1.1}),b("先行",64,640,952,240,{name:"标题下",fontSize:175,textFill:d(n),fontWeight:"bold",letterSpacing:-6,lineHeight:1.1}),b(`别让读者读完三段,
|
|
402
|
+
才发现你真正想说什么。`,64,944,952,180,{name:"主张",fontSize:56,textFill:d(n),fontWeight:"bold",lineHeight:1.35}),b("判断站在第一屏,证据跟在后面。",64,1146,952,60,{name:"说明",fontSize:34,textFill:d("#55524c")}),b("DINGCARD SIGNAL",64,1318,600,44,{name:"页脚",fontSize:24,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:4}),b("2026",816,1318,200,44,{name:"页脚编号",fontSize:24,fontFamily:ie,textFill:d(n),align:"right",letterSpacing:4})]),fe("论证",d(e),[V("rect",-de,-de,456+de,1440+de*2,d(s),{name:"蓝色分区",cornerRadius:0}),Z(512,164,504,n,4,{name:"右栏顶线",cap:"butt"}),V("rect",456,900,624+de,300,d(r),{name:"红色结论栏",cornerRadius:0}),Z(512,1294,504,n,3,{name:"页脚线",cap:"butt"}),b("WHY",52,88,390,170,{name:"英文标题",fontSize:150,fontFamily:ie,textFill:d(e),fontWeight:"bold",letterSpacing:2,lineHeight:1}),b(`证据跟在
|
|
403
|
+
判断后面`,56,330,370,240,{name:"主标题",fontSize:88,textFill:d("#ffffff"),fontWeight:"bold",lineHeight:1.2}),b("先说结论,不会削弱论证。它只是让读者知道,接下来的材料在回答什么。",60,640,360,360,{name:"左栏正文",fontSize:34,textFill:d("#d7e0ff"),lineHeight:1.65}),b("02",816,88,200,60,{name:"页码",fontSize:40,fontFamily:ie,textFill:d(n),fontWeight:"bold",align:"right"}),...o(0,"A",r,"先给一个清楚的判断"),...o(1,"B",s,"再摆最有力的事实"),...o(2,"C",n,"删掉不能支撑判断的材料"),b("顺序清楚,论证才有方向。",512,950,504,200,{name:"结论",fontSize:50,textFill:d("#ffffff"),fontWeight:"bold",lineHeight:1.35}),b("SIGNAL / 02",512,1318,400,44,{name:"页脚",fontSize:24,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:4})]),fe("行动",d(n),[V("rect",-de,-de,1080+de*2,196+de,d(l),{name:"黄色刊头",cornerRadius:0}),V("ellipse",820,342,196,196,d(l),{name:"方向符号"}),Z(64,646,952,"#33312d",3,{name:"标题线",cap:"butt"}),V("rect",64,716,952,330,d(r),{name:"行动底板",cornerRadius:32}),Z(64,1294,952,l,3,{name:"页脚线",cap:"butt"}),b("SIGNAL / 03 / ACTION",64,76,700,50,{name:"刊头",fontSize:30,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:4}),b("03",816,76,200,50,{name:"页码",fontSize:30,fontFamily:ie,textFill:d(n),fontWeight:"bold",align:"right"}),b(`最后,
|
|
404
|
+
给一个动作。`,64,280,740,320,{name:"主标题",fontSize:116,textFill:d(e),fontWeight:"bold",lineHeight:1.18}),b("→",820,368,196,140,{name:"箭头文字",fontSize:120,fontFamily:ie,textFill:d(n),fontWeight:"bold",align:"center",lineHeight:1}),b("今天试一次",120,776,840,110,{name:"行动标题",fontSize:80,textFill:d("#ffffff"),fontWeight:"bold"}),b("明天回来,看结果。",120,904,840,70,{name:"行动说明",fontSize:40,textFill:d("#ffffff")}),b("能被执行的观点,才会真正留下来。",64,1104,952,110,{name:"收束句",fontSize:40,textFill:d("#bdbab3"),lineHeight:1.45}),b("DINGCARD SIGNAL",64,1318,600,44,{name:"页脚",fontSize:24,fontFamily:ie,textFill:d(e),fontWeight:"bold",letterSpacing:4})])])}const Hx={night:"#0e1824",cream:"#f4eee2",amber:"#f2b84b",teal:"#6fb7c8",coral:"#e8664a",muted:"#a6b3bf",rule:"#26374a",axis:"#3d5570"};function Ox(){const{night:e,cream:n,amber:r,teal:s,coral:l,muted:o,rule:c,axis:f}=Hx,h=(g,x,m,j)=>{const k=470+g*220,v=["一","二","三"][g];return[V("ellipse",100,k+16,28,28,d(m),{name:`时间点${v}`,...g===2?{shadow:{color:m,blur:18,offsetX:0,offsetY:0}}:{}}),...g<2?[va(114,k+56,k+224,f,4,{name:`时间轴${v}`}),Z(168,k+168,824,c,2,{name:`记录线${v}`})]:[],b(x,168,k,300,56,{name:`时间${v}`,fontSize:36,fontFamily:ie,textFill:d(m),fontWeight:"bold",letterSpacing:2}),b(j,168,k+64,824,76,{name:`记录${v}`,fontSize:50,fontFamily:X,textFill:d(n),fontWeight:"bold"})]};return we([fe("出发",ir([[0,"#0a121d"],[1,"#18293d"]],180),[V("ellipse",770,120,210,210,d("#f3e8d0"),{name:"月亮",shadow:{color:"#f3e8d0",blur:80,offsetX:0,offsetY:0}}),V("ellipse",640,300,8,8,d(n),{name:"星一",opacity:.7}),V("ellipse",980,420,6,6,d(n),{name:"星二",opacity:.5}),V("ellipse",560,150,6,6,d(n),{name:"星三",opacity:.6}),Y("M 14 186 Q 452 -46 890 116",88,1010,904,210,{name:"航线",stroke:s,strokeWidth:4,dash:14,cap:"round",opacity:.85}),V("ellipse",90,1184,24,24,d(r),{name:"起点"}),V("ellipse",962,1110,32,32,d(l),{name:"终点",shadow:{color:l,blur:24,offsetX:0,offsetY:0}}),Z(88,1294,904,c,2,{name:"页脚线"}),b("NF 2340",88,92,400,56,{name:"航班号",fontSize:36,fontFamily:ie,textFill:d(r),fontWeight:"bold",letterSpacing:6}),b("FRI · 23:40",88,152,400,44,{name:"出发时间",fontSize:28,fontFamily:ie,textFill:d(o),letterSpacing:3}),b(`夜里先记下,
|
|
405
405
|
天亮再判断`,80,420,920,380,{name:"主标题",fontSize:136,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.25}),b(`灵感通常不完整。
|
|
406
|
-
保留原句,先别急着把它修成成品。`,88,820,840,140,{name:"导语",fontSize:40,textFill:d(o),lineHeight:1.55}),b("23:40",88,1222,200,48,{name:"起点时间",fontSize:30,fontFamily:ie,textFill:d(r),fontWeight:"bold",letterSpacing:2}),b("08:30",792,1150,200,48,{name:"抵达时间",fontSize:30,fontFamily:ie,textFill:d(l),fontWeight:"bold",align:"right",letterSpacing:2}),b("NIGHT FLIGHT / ROUTE 01",88,1318,600,44,{name:"页脚",fontSize:24,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:3}),b("31.23°N 121.47°E",642,1318,350,44,{name:"坐标",fontSize:24,fontFamily:ie,textFill:d(s),align:"right",letterSpacing:2})]),
|
|
406
|
+
保留原句,先别急着把它修成成品。`,88,820,840,140,{name:"导语",fontSize:40,textFill:d(o),lineHeight:1.55}),b("23:40",88,1222,200,48,{name:"起点时间",fontSize:30,fontFamily:ie,textFill:d(r),fontWeight:"bold",letterSpacing:2}),b("08:30",792,1150,200,48,{name:"抵达时间",fontSize:30,fontFamily:ie,textFill:d(l),fontWeight:"bold",align:"right",letterSpacing:2}),b("NIGHT FLIGHT / ROUTE 01",88,1318,600,44,{name:"页脚",fontSize:24,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:3}),b("31.23°N 121.47°E",642,1318,350,44,{name:"坐标",fontSize:24,fontFamily:ie,textFill:d(s),align:"right",letterSpacing:2})]),fe("中途",d(e),[Z(88,156,904,c,2,{name:"刊头线"}),Z(88,1294,904,c,2,{name:"页脚线"}),b("NIGHT FLIGHT / LOG 02",88,92,600,44,{name:"刊头",fontSize:26,fontFamily:ie,textFill:d(o),fontWeight:"bold",letterSpacing:3}),b("航行记录",80,196,920,150,{name:"页标题",fontSize:112,fontFamily:X,textFill:d(n),fontWeight:"bold"}),b("00:15 · MIDWAY",88,362,600,50,{name:"当前时间",fontSize:30,fontFamily:ie,textFill:d(r),fontWeight:"bold",letterSpacing:3}),...h(0,"23:40",r,"留下最初那句话"),...h(1,"00:15",s,"补上来源和去向"),...h(2,"08:30",l,"醒来后重新判断"),b("先保存线索,不在夜里替明天做完所有决定。",88,1150,904,110,{name:"注释",fontSize:36,textFill:d(o),lineHeight:1.55}),b("31.23°N · ROUTE ACTIVE",88,1318,600,44,{name:"页脚",fontSize:24,fontFamily:ie,textFill:d(s),fontWeight:"bold",letterSpacing:3})]),fe("抵达",ir([[0,"#f7f1e6"],[1,"#f3dcbd"]],180),[V("ellipse",600,1050,600,600,{type:"radial-gradient",stops:[{offset:0,color:"#f6b04d"},{offset:1,color:"#ef7a52"}]},{name:"朝阳",opacity:.9}),V("rect",-de,-de,1080+de*2,172+de,d(e),{name:"抵达信息栏",cornerRadius:0}),V("ellipse",88,736,40,40,d(r),{name:"起点"}),V("ellipse",520,736,40,40,d(s),{name:"中点"}),V("ellipse",948,732,48,48,d(l),{name:"终点"}),Z(136,750,376,e,3,{name:"抵达线一"}),Z(568,750,372,e,3,{name:"抵达线二"}),V("rect",88,896,904,300,d(e),{name:"结论底板",cornerRadius:32}),Z(88,1294,904,e,2,{name:"页脚线"}),b("ARRIVAL · 08:30",88,64,600,56,{name:"抵达时间",fontSize:32,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:4}),b("ROUTE 03",692,66,300,52,{name:"路线编号",fontSize:28,fontFamily:ie,textFill:d(r),fontWeight:"bold",align:"right",letterSpacing:3}),b(`天亮以后,
|
|
407
407
|
只判断一件事`,80,236,920,330,{name:"主标题",fontSize:120,fontFamily:X,textFill:d(e),fontWeight:"bold",lineHeight:1.22}),b("它还让你想继续写吗?",88,600,904,70,{name:"提问",fontSize:46,textFill:d("#5b4a3a"),fontWeight:"bold"}),b("保留原句",88,800,300,50,{name:"节点一",fontSize:32,textFill:d(e),fontWeight:"bold"}),b("补充线索",390,800,300,50,{name:"节点二",fontSize:32,textFill:d(e),fontWeight:"bold",align:"center"}),b("重新判断",692,800,300,50,{name:"节点三",fontSize:32,textFill:d(e),fontWeight:"bold",align:"right"}),b(`答案是肯定的,
|
|
408
|
-
就排进今天。`,136,944,808,160,{name:"结论",fontSize:56,textFill:d(n),fontWeight:"bold",lineHeight:1.3}),b("否则留在草稿里,也没关系。",136,1114,808,50,{name:"补充结论",fontSize:32,textFill:d(o)}),b("DINGCARD / NIGHT FLIGHT",88,1318,600,44,{name:"页脚",fontSize:24,fontFamily:ie,textFill:d(e),fontWeight:"bold",letterSpacing:3})])])}const _x={concrete:"#ecebe6",black:"#0d0d0d",yellow:"#f5e900",grey:"#3a3a36"};function Bx(){const{concrete:e,black:n,yellow:r,grey:s}=_x,l={color:n,blur:0,offsetX:24,offsetY:24},o=(c,f,h,g)=>{const x=420+c*240,m=["一","二","三"][c];return[
|
|
408
|
+
就排进今天。`,136,944,808,160,{name:"结论",fontSize:56,textFill:d(n),fontWeight:"bold",lineHeight:1.3}),b("否则留在草稿里,也没关系。",136,1114,808,50,{name:"补充结论",fontSize:32,textFill:d(o)}),b("DINGCARD / NIGHT FLIGHT",88,1318,600,44,{name:"页脚",fontSize:24,fontFamily:ie,textFill:d(e),fontWeight:"bold",letterSpacing:3})])])}const _x={concrete:"#ecebe6",black:"#0d0d0d",yellow:"#f5e900",grey:"#3a3a36"};function Bx(){const{concrete:e,black:n,yellow:r,grey:s}=_x,l={color:n,blur:0,offsetX:24,offsetY:24},o=(c,f,h,g)=>{const x=420+c*240,m=["一","二","三"][c];return[V("rect",88,x,120,120,d(n),{name:`编号块${m}`,cornerRadius:0}),Z(88,x+184,904,n,6,{name:`规则线${m}`,cap:"butt"}),b(f,88,x+18,120,84,{name:`编号${m}`,fontSize:72,fontFamily:ie,textFill:d(r),fontWeight:"bold",align:"center",lineHeight:1}),b(h,244,x-2,748,80,{name:`规则${m}`,fontSize:52,textFill:d(n),fontWeight:"bold",effect:{type:"marker",color:r,amount:45}}),b(g,244,x+86,748,56,{name:`注释${m}`,fontSize:32,textFill:d(s)})]};return we([fe("宣言",d(e),[Z(88,144,904,n,8,{name:"刊头线",cap:"butt"}),V("rect",88,220,880,420,d(r),{name:"标题底块",cornerRadius:0,stroke:n,strokeWidth:8,shadow:l}),V("ellipse",740,860,240,240,d(n),{name:"印章"}),Z(88,1288,904,n,6,{name:"页脚线",cap:"butt"}),b("BRUTAL PAGE",88,84,520,48,{name:"刊头",fontSize:26,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:8}),b("NO.01 / 2026",692,84,300,48,{name:"期号",fontSize:26,fontFamily:ie,textFill:d(n),fontWeight:"bold",align:"right",letterSpacing:3}),b(`排版没有
|
|
409
409
|
温柔可言`,136,262,800,340,{name:"主标题",fontSize:140,textFill:d(n),fontWeight:"bold",lineHeight:1.15,letterSpacing:-4}),b("信息要么站出来,要么让开。",88,724,904,80,{name:"导语",fontSize:50,textFill:d(n),fontWeight:"bold"}),b(`黑、黄、粗线、硬阴影。
|
|
410
410
|
每一笔都摆在明面上。`,88,820,620,130,{name:"说明",fontSize:36,textFill:d(s),lineHeight:1.5}),b(`宣言
|
|
411
|
-
01`,740,905,240,150,{name:"印章文字",fontSize:52,textFill:d(r),fontWeight:"bold",align:"center",lineHeight:1.15,rotation:-12}),b("→",72,1010,420,240,{name:"箭头",fontSize:230,fontFamily:ie,textFill:d(n),fontWeight:"bold",lineHeight:1}),b("BRUTAL PAGE PRESS",88,1312,600,44,{name:"刊尾",fontSize:24,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:6}),b("大声说",692,1312,300,44,{name:"页脚词",fontSize:26,textFill:d(n),fontWeight:"bold",align:"right"})]),
|
|
412
|
-
就停`,236,250,790,520,{name:"结尾大字",fontSize:220,textFill:d(n),fontWeight:"bold",lineHeight:1.1,letterSpacing:-8}),b("最后一句不用装饰,站直就行。",240,874,752,150,{name:"正文一",fontSize:48,textFill:d(n),fontWeight:"bold",lineHeight:1.4}),b("多一个感叹号都是心虚。",240,1076,752,80,{name:"正文二",fontSize:40,textFill:d(r),fontWeight:"bold",effect:{type:"background",color:n,amount:40,radius:0}}),b("BRUTAL PAGE PRESS",240,1312,600,44,{name:"刊尾",fontSize:24,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:6})])])}const
|
|
413
|
-
画成蓝图`,80,296,920,330,{name:"主标题",fontSize:128,textFill:d(n),fontWeight:"bold",lineHeight:1.2}),b("计划不用漂亮,先要画得清楚。",88,670,600,130,{name:"导语",fontSize:40,textFill:d(r),lineHeight:1.55}),b("Ø 240",700,1046,240,40,{name:"图形标注",fontSize:22,fontFamily:ie,textFill:d(r),align:"center",letterSpacing:3}),f("SHEET",116,1126,"编号标签"),b("BP-01",116,1180,260,70,{name:"图纸编号",fontSize:44,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:2}),f("SCALE",418,1126,"比例标签"),b("1 : 1",418,1180,260,70,{name:"比例",fontSize:44,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:2}),f("DATE",718,1126,"日期标签"),b("2026.10",718,1180,260,70,{name:"日期",fontSize:44,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:2})]),
|
|
414
|
-
按图验收`,80,236,920,310,{name:"主标题",fontSize:120,textFill:d(n),fontWeight:"bold",lineHeight:1.2}),b("对不上图的地方,先改图,再改计划。",88,590,860,130,{name:"导语",fontSize:40,textFill:d(r),lineHeight:1.55}),b("全部核对通过",123,870,560,100,{name:"签收标题",fontSize:64,textFill:d(s),fontWeight:"bold",align:"center",rotation:-6}),b("APPROVED · 可交付",133,1e3,560,50,{name:"签收状态",fontSize:30,fontFamily:ie,textFill:d(s),fontWeight:"bold",align:"center",letterSpacing:4,rotation:-6}),b("签名 / DATE",760,1112,232,40,{name:"签名标注",fontSize:22,fontFamily:ie,textFill:d(r),align:"right",letterSpacing:3}),b("BLUEPRINT / FINAL",88,1318,600,44,{name:"页脚",fontSize:22,fontFamily:ie,textFill:d(r),letterSpacing:6}),b("PLAN A APPROVED",592,1318,400,44,{name:"比例",fontSize:22,fontFamily:ie,textFill:d(r),align:"right",letterSpacing:6})])])}const Gt={width:1080,height:1920},
|
|
415
|
-
讲简单`,110,290,1180,360,{name:"主标题",fontSize:150,fontFamily:
|
|
416
|
-
再讲为什么`,112,290,800,230,{name:"标题",fontSize:84,fontFamily:
|
|
417
|
-
大家`,110,220,820,420,{name:"主标题",fontSize:170,fontFamily:
|
|
411
|
+
01`,740,905,240,150,{name:"印章文字",fontSize:52,textFill:d(r),fontWeight:"bold",align:"center",lineHeight:1.15,rotation:-12}),b("→",72,1010,420,240,{name:"箭头",fontSize:230,fontFamily:ie,textFill:d(n),fontWeight:"bold",lineHeight:1}),b("BRUTAL PAGE PRESS",88,1312,600,44,{name:"刊尾",fontSize:24,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:6}),b("大声说",692,1312,300,44,{name:"页脚词",fontSize:26,textFill:d(n),fontWeight:"bold",align:"right"})]),fe("规则",d(e),[Z(88,144,904,n,8,{name:"刊头线",cap:"butt"}),Z(88,1288,904,n,6,{name:"页脚线",cap:"butt"}),b("RULES / 02",88,84,520,48,{name:"刊头",fontSize:26,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:8}),b("三条硬规则",80,190,920,160,{name:"页标题",fontSize:120,textFill:d(n),fontWeight:"bold",letterSpacing:-4}),...o(0,"1","标题字重拉满","字号不够,就加字重;字重到头,再谈颜色。"),...o(1,"2","阴影不许虚","要投影就投硬影,偏移看得见。"),...o(2,"3","留白也是表态","没内容的地方,就让它空着。"),b("BRUTAL PAGE / RULES",88,1312,600,44,{name:"刊尾",fontSize:24,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:6})]),fe("结束",d(r),[V("rect",-de,-de,196+de,1440+de*2,d(n),{name:"边栏",cornerRadius:0}),Z(240,818,752,n,12,{name:"结尾线",cap:"butt"}),Z(240,1288,752,n,6,{name:"页脚线",cap:"butt"}),b("END / 03",62,88,60,420,{name:"边栏刊头",fontSize:34,fontFamily:ie,textFill:d(r),fontWeight:"bold",letterSpacing:8,vertical:!0}),b("LOUD / 03",62,960,60,400,{name:"边栏页脚",fontSize:34,fontFamily:ie,textFill:d(r),fontWeight:"bold",letterSpacing:8,vertical:!0}),b(`说完了
|
|
412
|
+
就停`,236,250,790,520,{name:"结尾大字",fontSize:220,textFill:d(n),fontWeight:"bold",lineHeight:1.1,letterSpacing:-8}),b("最后一句不用装饰,站直就行。",240,874,752,150,{name:"正文一",fontSize:48,textFill:d(n),fontWeight:"bold",lineHeight:1.4}),b("多一个感叹号都是心虚。",240,1076,752,80,{name:"正文二",fontSize:40,textFill:d(r),fontWeight:"bold",effect:{type:"background",color:n,amount:40,radius:0}}),b("BRUTAL PAGE PRESS",240,1312,600,44,{name:"刊尾",fontSize:24,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:6})])])}const Fl={paper:"#174478",chalk:"#f2f6fc",line:"#b9cde6",yellow:"#ffd166"};function Kx(e,n,r){const s=Array.from({length:Math.floor(1080/n)},(o,c)=>`M ${(c+1)*n} 0 V 1440`),l=Array.from({length:Math.floor(1440/n)},(o,c)=>`M 0 ${(c+1)*n} H 1080`);return Y([...s,...l].join(" "),0,0,1080,1440,{name:e,stroke:"#ffffff",strokeWidth:1.5,opacity:r,cap:"butt"})}const Vx=(e,n,r,s,l)=>Y(`M 2 2 H ${s-2} V ${l-2} H 2 Z`,n,r,s,l,{name:e,stroke:Fl.chalk,strokeWidth:3,dash:12,cap:"butt",join:"miter"}),Gx=e=>b(e,692,86,300,44,{name:"图纸编号",fontSize:26,fontFamily:ie,textFill:d(Fl.chalk),fontWeight:"bold",align:"right",letterSpacing:4}),Ux=(e,n,r,s)=>b(e,n,r,280,36,{name:s,fontSize:22,fontFamily:ie,textFill:d(Fl.line),letterSpacing:4});function Yx(){const{paper:e,chalk:n,line:r,yellow:s}=Fl,l=Kx,o=Vx,c=Gx,f=Ux;return we([fe("图纸",d(e),[l("细网格",60,.09),l("粗网格",240,.16),Z(88,194,904,n,2,{name:"尺寸标注",startCap:"arrow",endCap:"arrow"}),V("ellipse",700,800,240,240,{type:"transparent"},{name:"图形圆",stroke:n,strokeWidth:3}),Z(670,914,300,r,2,{name:"中心线横",dash:10}),va(820,770,1070,r,2,{name:"中心线竖",dash:10}),Y("M 2 2 H 902 V 168 H 2 Z M 302 2 V 168 M 602 2 V 168",88,1110,904,170,{name:"图签框",stroke:n,strokeWidth:3,cap:"butt",join:"miter"}),b("BLUEPRINT · PLAN A",88,86,600,44,{name:"刊头",fontSize:24,fontFamily:ie,textFill:d(r),letterSpacing:6}),b("1080",480,182,120,36,{name:"尺寸数字",fontSize:22,fontFamily:ie,textFill:d(n),align:"center",letterSpacing:2,effect:{type:"background",color:e,amount:30,radius:0}}),b(`先把想法
|
|
413
|
+
画成蓝图`,80,296,920,330,{name:"主标题",fontSize:128,textFill:d(n),fontWeight:"bold",lineHeight:1.2}),b("计划不用漂亮,先要画得清楚。",88,670,600,130,{name:"导语",fontSize:40,textFill:d(r),lineHeight:1.55}),b("Ø 240",700,1046,240,40,{name:"图形标注",fontSize:22,fontFamily:ie,textFill:d(r),align:"center",letterSpacing:3}),f("SHEET",116,1126,"编号标签"),b("BP-01",116,1180,260,70,{name:"图纸编号",fontSize:44,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:2}),f("SCALE",418,1126,"比例标签"),b("1 : 1",418,1180,260,70,{name:"比例",fontSize:44,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:2}),f("DATE",718,1126,"日期标签"),b("2026.10",718,1180,260,70,{name:"日期",fontSize:44,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:2})]),fe("结构",d(e),[l("细网格",60,.09),l("粗网格",240,.16),o("模块底板一",88,196,904,370),o("模块底板二",88,616,440,330),o("装配底板",552,616,440,330),Z(88,1004,904,s,3,{name:"装配虚线",dash:14,endCap:"arrow"}),b("STRUCTURE",88,86,600,44,{name:"刊头",fontSize:24,fontFamily:ie,textFill:d(r),letterSpacing:6}),c("BP-02"),b("先装骨架",136,236,808,200,{name:"模块标题一",fontSize:88,textFill:d(n),fontWeight:"bold",lineHeight:1.2}),b("列出必须成立的三件事。",136,450,808,90,{name:"模块说明一",fontSize:34,textFill:d(r),lineHeight:1.5}),b("再填血肉",128,656,360,130,{name:"模块标题二",fontSize:52,textFill:d(n),fontWeight:"bold",lineHeight:1.25}),b("每一块都有明确的负责人和时间。",128,800,360,120,{name:"模块说明二",fontSize:30,textFill:d(r),lineHeight:1.5}),b("装配顺序",592,656,360,130,{name:"装配标题",fontSize:52,textFill:d(n),fontWeight:"bold",lineHeight:1.25}),b("素材 → 结构 → 校对 → 验收",592,800,360,120,{name:"装配步骤",fontSize:30,textFill:d(r),lineHeight:1.5}),b("顺序写清楚,比写得漂亮重要。",88,1050,904,110,{name:"注释",fontSize:36,textFill:d(s),lineHeight:1.5}),b("BLUEPRINT / ASSEMBLY",88,1318,600,44,{name:"页脚",fontSize:22,fontFamily:ie,textFill:d(r),letterSpacing:6})]),fe("验收",d(e),[l("细网格",60,.09),l("粗网格",240,.16),V("rect",88,820,640,300,{type:"transparent"},{name:"签收底板",cornerRadius:20,stroke:s,strokeWidth:6,rotation:-6}),Z(760,1094,232,n,2,{name:"签名线"}),b("CHECK",88,86,600,44,{name:"刊头",fontSize:24,fontFamily:ie,textFill:d(r),letterSpacing:6}),c("BP-03"),b(`按图施工,
|
|
414
|
+
按图验收`,80,236,920,310,{name:"主标题",fontSize:120,textFill:d(n),fontWeight:"bold",lineHeight:1.2}),b("对不上图的地方,先改图,再改计划。",88,590,860,130,{name:"导语",fontSize:40,textFill:d(r),lineHeight:1.55}),b("全部核对通过",123,870,560,100,{name:"签收标题",fontSize:64,textFill:d(s),fontWeight:"bold",align:"center",rotation:-6}),b("APPROVED · 可交付",133,1e3,560,50,{name:"签收状态",fontSize:30,fontFamily:ie,textFill:d(s),fontWeight:"bold",align:"center",letterSpacing:4,rotation:-6}),b("签名 / DATE",760,1112,232,40,{name:"签名标注",fontSize:22,fontFamily:ie,textFill:d(r),align:"right",letterSpacing:3}),b("BLUEPRINT / FINAL",88,1318,600,44,{name:"页脚",fontSize:22,fontFamily:ie,textFill:d(r),letterSpacing:6}),b("PLAN A APPROVED",592,1318,400,44,{name:"比例",fontSize:22,fontFamily:ie,textFill:d(r),align:"right",letterSpacing:6})])])}const Gt={width:1080,height:1920},Dr={width:1080,height:1080},Yn={width:1920,height:1080},Zs={width:1800,height:766},es={width:1240,height:1754},Zx={width:3240,height:3240},bd={width:1754,height:1240},Xx={paper:"#f5f3ee",ink:"#151515",orange:"#ff5a1f",muted:"#5b5852",rule:"#d9d5cc",dim:"#c9c5bd",night:"#2a2a28"};function Ff(e,n,r="02 / 06"){return[Z(120,984,1680,n,2,{name:"页脚线",cap:"butt"}),b("DINGCARD KEYNOTE",120,1010,600,40,{name:"页脚",fontSize:22,fontFamily:_,textFill:d(e),fontWeight:"bold",letterSpacing:6}),b(r,1500,1006,300,44,{name:"页码",fontSize:26,fontFamily:Xe,textFill:d(e),align:"right",letterSpacing:2})]}function qx(){const{paper:e,ink:n,orange:r,muted:s,rule:l,dim:o,night:c}=Xx,f=(g,x,m)=>{const j=236+g*230,k=ft[g];return[V("rect",1040,j+14,22,22,d(r),{name:`标记${k}`,cornerRadius:0}),b(x,1086,j,714,64,{name:`要点${k}`,fontSize:46,fontFamily:_,textFill:d(n),fontWeight:"bold",lineHeight:1.25}),b(m,1086,j+72,714,92,{name:`说明${k}`,fontSize:30,fontFamily:_,textFill:d(s),lineHeight:1.5}),Z(1040,j+186,760,l,2,{name:`要点线${k}`,cap:"butt"})]},h=(g,x)=>{const m=260+g*150,j=ft[g];return[Y(ot(30,30,30),1060,m+4,60,60,{name:`编号底${j}`,fill:d(r),strokeWidth:0}),b(String(g+1),1060,m+10,60,48,{name:`编号${j}`,fontSize:30,fontFamily:Xe,textFill:d(n),align:"center"}),b(x,1150,m+2,650,64,{name:`行动${j}`,fontSize:44,fontFamily:_,textFill:d(e),fontWeight:"bold",lineHeight:1.25})]};return we([fe("封面",d(e),[Y(ot(480,480,480),1040,70,960,960,{name:"橙色大圆",fill:d(r),strokeWidth:0}),Y(ot(520,520,520),1e3,30,1040,1040,{name:"光晕",stroke:n,strokeWidth:1.5}),b("DINGCARD KEYNOTE",120,92,700,40,{name:"刊头",fontSize:24,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:6}),b(`把复杂的事
|
|
415
|
+
讲简单`,110,290,1180,360,{name:"主标题",fontSize:150,fontFamily:_,textFill:d(n),fontWeight:"bold",lineHeight:1.12,letterSpacing:-4}),b("一套为汇报、路演和课程准备的演示模板",120,694,900,60,{name:"导语",fontSize:40,fontFamily:_,textFill:d(s),letterSpacing:1}),Z(120,930,880,n,2,{name:"封面线",cap:"butt"}),b("主讲人 林一",120,956,400,44,{name:"署名",fontSize:28,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:2}),b("2026 年 11 月",560,956,440,44,{name:"日期",fontSize:28,fontFamily:_,textFill:d(s),align:"right",letterSpacing:2})],Yn),fe("内页",d(e),[Y(ot(170,170,170),-70,-70,340,340,{name:"角圆",fill:d(r),strokeWidth:0}),b("02",56,64,160,80,{name:"大页码",fontSize:64,fontFamily:Xe,textFill:d(n),letterSpacing:-2}),b(`先讲结论,
|
|
416
|
+
再讲为什么`,112,290,800,230,{name:"标题",fontSize:84,fontFamily:_,textFill:d(n),fontWeight:"bold",lineHeight:1.22,letterSpacing:-2}),b("听众在前三十秒决定要不要继续听。把最重要的判断放在第一页,其余的页面都在回答它。",120,546,760,200,{name:"导语",fontSize:36,fontFamily:_,textFill:d(s),lineHeight:1.65}),V("rect",120,800,8,110,d(r),{name:"引文竖线",cornerRadius:0}),b("“一页只讲一件事。”",154,806,760,100,{name:"引文",fontSize:42,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.4}),...f(0,"结论放在第一页","一句话说清你希望听众记住什么"),...f(1,"每页只回答一个问题","标题就是这一页的答案"),...f(2,"数据跟在判断后面","先说意味着什么,再给数字"),...Ff(n,n,"02 / 03")],Yn),fe("结尾",d(n),[Y("M 0 300 A 300 300 0 0 1 600 300 Z",1240,690,600,300,{name:"落日",fill:d(r),strokeWidth:0}),b(`谢谢
|
|
417
|
+
大家`,110,220,820,420,{name:"主标题",fontSize:170,fontFamily:_,textFill:d(e),fontWeight:"bold",lineHeight:1.12,letterSpacing:-4}),b("有问题,会后随时找我聊。",120,690,820,120,{name:"收束句",fontSize:40,fontFamily:_,textFill:d(o),lineHeight:1.6}),...h(0,"本周确认方案"),...h(1,"下周给出排期"),...h(2,"月底上线第一版"),...Ff(e,c,"03 / 03")],Yn)])}const Qx={navy:"#14213d",paper:"#f8f6f1",gold:"#c9a55a",goldInk:"#86621a",muted:"#5e6574",rule:"#d8d3c7",pale:"#c3cad8",deep:"#2a3858"};function Mf(e,n,r="02 / 12"){return[Z(120,984,1680,n,2,{name:"页脚线",cap:"butt"}),b("ACADEMIC REPORT",120,1006,600,40,{name:"页脚",fontSize:22,fontFamily:Ft,textFill:d(e),letterSpacing:8}),b(r,1500,1002,300,44,{name:"页码",fontSize:28,fontFamily:Ft,textFill:d(e),align:"right",italic:!0,letterSpacing:2})]}function Cf(e,n,r,s){const l=r,o=r/300,c=(v,w)=>[l+v*Math.cos(w),l+v*Math.sin(w)],f=([v,w])=>`${Fe(v)} ${Fe(w)}`,h=196*o,g=[],x=[];for(const v of[1,-1]){const w=Math.PI/2+v*.36,N=Math.PI/2+v*2.5;x.push(`M ${f(c(h,w))} A ${Fe(h)} ${Fe(h)} 0 0 ${v>0?1:0} ${f(c(h,N))}`);for(let F=0;F<6;F+=1){const I=w+v*(.22+F*.36),M=[-Math.sin(I)*v,Math.cos(I)*v],z=[Math.cos(I),Math.sin(I)];for(const A of[1,-1]){const T=Math.hypot(M[0]+A*.7*z[0],M[1]+A*.7*z[1]),L=[(M[0]+A*.7*z[0])/T,(M[1]+A*.7*z[1])/T],H=[-L[1],L[0]],[P,U]=c(h+A*14*o,I),[K,D]=[26*o,9*o];g.push(`M ${f([P-L[0]*K,U-L[1]*K])} Q ${f([P+H[0]*D,U+H[1]*D])} ${f([P+L[0]*K,U+L[1]*K])} Q ${f([P-H[0]*D,U-H[1]*D])} ${f([P-L[0]*K,U-L[1]*K])} Z`)}}}const m=v=>{const w=l+v*112*o;return`M ${f([l,l-46*o])} Q ${f([l+v*56*o,l-78*o])} ${f([w,l-58*o])} L ${f([w,l+62*o])} Q ${f([l+v*56*o,l+42*o])} ${f([l,l+72*o])} Z`},j=[0,1,2].flatMap(v=>[1,-1].map(w=>{const N=v*30*o;return`M ${f([l+w*22*o,l-18*o+N])} Q ${f([l+w*56*o,l-40*o+N])} ${f([l+w*92*o,l-28*o+N])}`})).join(" "),k=(v,w,N)=>Y(w,e,n,r*2,r*2,{name:v,...N});return[k("校徽环",`${ot(l,l,r-3*o)} ${ot(l,l,r-34*o)}`,{stroke:s,strokeWidth:Fe(2.5*o)}),k("校徽刻度",Uc(l,l,r-12*o,12*o,72,()=>!0),{stroke:s,strokeWidth:Fe(2*o)}),k("桂枝",x.join(" "),{stroke:s,strokeWidth:Fe(2.5*o),cap:"round"}),k("桂叶",g.join(" "),{fill:d(s),strokeWidth:0}),k("书",`${m(-1)} ${m(1)}`,{stroke:s,strokeWidth:Fe(3*o),join:"round"}),k("书页",j,{stroke:s,strokeWidth:Fe(2*o),cap:"round"}),k("星",ml(l,l-128*o,16*o,6.5*o),{fill:d(s),strokeWidth:0})]}function Jx(){const{navy:e,paper:n,gold:r,goldInk:s,muted:l,rule:o,pale:c,deep:f}=Qx,h=(x,m,j)=>{const k=220+x*230,v=ft[x];return[b(["I","II","III"][x],970,k-6,90,64,{name:`序号${v}`,fontSize:46,fontFamily:Ft,textFill:d(s),italic:!0,lineHeight:1.2}),b(m,1070,k,730,64,{name:`要点${v}`,fontSize:42,fontFamily:_,textFill:d(e),fontWeight:"bold",lineHeight:1.25}),b(j,1070,k+72,730,92,{name:`说明${v}`,fontSize:28,fontFamily:_,textFill:d(l),lineHeight:1.5}),Z(970,k+186,830,o,2,{name:`要点线${v}`,cap:"butt"})]},g=(x,m)=>{const j=660+x*92,k=ft[x];return[b(["I","II","III"][x],120,j-4,80,60,{name:`序号${k}`,fontSize:40,fontFamily:Ft,textFill:d(r),italic:!0,lineHeight:1.2}),b(m,210,j,900,56,{name:`展望${k}`,fontSize:34,fontFamily:_,textFill:d(n),fontWeight:"bold",lineHeight:1.3})]};return we([fe("封面",d(e),[Y(ot(370,370,370),1110,170,740,740,{name:"校徽底",fill:d("#1a2a4b"),strokeWidth:0}),...Cf(1150,210,330,r),b("本科毕业论文答辩",120,150,800,40,{name:"刊头",fontSize:26,fontFamily:_,textFill:d(r),fontWeight:"bold",letterSpacing:12}),Z(120,214,80,r,3,{name:"刊头线",cap:"butt"}),b(`城市街道绿化对
|
|
418
418
|
居民步行意愿的影响研究`,110,270,1010,360,{name:"主标题",fontSize:80,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.3}),b(`答辩人 林澄 指导教师 王明 教授
|
|
419
|
-
城市规划学院 · 2026 年 6 月`,120,680,1e3,110,{name:"导语",fontSize:30,fontFamily:
|
|
420
|
-
问卷与街景分析`,112,290,760,200,{name:"标题",fontSize:64,fontFamily:X,textFill:d(e),fontWeight:"bold",lineHeight:1.3}),b("在三个片区发放问卷 1,200 份,回收有效问卷 986 份;同时用街景图片计算每条街道的绿视率。",120,510,720,210,{name:"导语",fontSize:30,fontFamily:
|
|
421
|
-
批评指正`,110,190,1100,330,{name:"主标题",fontSize:110,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.25}),b("谢谢!后续研究会从这三件事做起:",120,560,1e3,60,{name:"收束句",fontSize:36,fontFamily:
|
|
422
|
-
第二条路`,64,1012,952,370,{name:"标题",fontSize:152,textFill:d(n),fontWeight:"bold",lineHeight:1.15,letterSpacing:-4}),b("关于步行、街道和公共空间的一次分享",72,1394,936,64,{name:"副标题",fontSize:40,textFill:d(l)}),...o(0,"时间","10 月 18 日 周六 14:00"),...o(1,"地点","城市规划展览馆 3 层报告厅"),...o(2,"嘉宾","林一 · 建筑师"),b("扫码报名 →",72,1784,420,56,{name:"按钮文字",fontSize:36,textFill:d("#ffffff"),fontWeight:"bold",align:"center"}),b("城市漫游计划",592,1788,416,48,{name:"主办",fontSize:28,textFill:d(l),align:"right",letterSpacing:2})],Gt)])}function ab(){const e="#fff3e3",n="#ff6a2b",r="#3b1f14",s="#7a4a2c";return
|
|
423
|
-
7 天`,770,350,230,132,{name:"角标",fontSize:46,textFill:d(r),fontWeight:"bold",align:"center",lineHeight:1.15,rotation:12}),b("第二杯半价",40,1214,1e3,236,{name:"标题",fontSize:180,textFill:d(r),fontWeight:"bold",align:"center",letterSpacing:-4,effect:{type:"offset",color:n,amount:40,angle:45}}),b("拿铁、美式、季节限定,任选两杯",72,1468,936,64,{name:"正文",fontSize:40,textFill:d(r),align:"center"}),b("活动时间 10.1 – 10.31",72,1560,936,52,{name:"信息一",fontSize:34,textFill:d(s),align:"center"}),b("全国直营门店可用",72,1616,936,52,{name:"信息二",fontSize:34,textFill:d(s),align:"center"}),b("立即领券",290,1724,500,64,{name:"按钮文字",fontSize:44,textFill:d(e),fontWeight:"bold",align:"center",letterSpacing:4}),b("DINGCARD COFFEE",72,1846,936,40,{name:"品牌",fontSize:24,fontFamily:ie,textFill:d(r),fontWeight:"bold",align:"center",letterSpacing:8})],Gt)])}function ib(e,n,r,s,l){const o=s/2,c=s*.17,f=s*.6,h=`M ${s*.2} ${s} C ${s*.2} ${f+s*.04} ${s*.33} ${f-s*.04} ${o} ${f-s*.04} C ${s*.67} ${f-s*.04} ${s*.8} ${f+s*.04} ${s*.8} ${s} Z`,g=`M ${o-c} ${s*.36} A ${c} ${c} 0 1 0 ${o+c} ${s*.36} A ${c} ${c} 0 1 0 ${o-c} ${s*.36} Z`;return Y(`${g} ${h}`,n,r,s,s,{name:e,fill:d(l),stroke:l,strokeWidth:0})}function sb(){const e="#f3efe6",n="#16181d",r="#5b5f6a",s="#2448d8",l="#f0643a",o="#d84c22",c="#d9d3c6",f=[["#2448d8","#4a6ae6"],["#f0643a","#f58a68"],["#f2b632","#f6c95f"],["#2f8f6a","#4fa985"],["#e3dccd","#cfc6b3"],["#16181d","#3a3e48"],["#f2b632","#f6c95f"],["#2448d8","#4a6ae6"],null,["#f0643a","#f58a68"]],h=168,g=k=>({x:72+k%5*(h+24),y:120+Math.floor(k/5)*(h+24)}),x=f.flatMap((k,v)=>{if(!k)return[];const{x:w,y:N}=g(v),
|
|
424
|
-
留给你`,64,610,952,300,{name:"标题",fontSize:124,textFill:d(n),fontWeight:"bold",lineHeight:1.16,letterSpacing:-2}),b("做一款给 AI 用的设计编辑器,现在就差一个你。",72,930,936,60,{name:"副标题",fontSize:38,textFill:d(r)}),...j(0,"全职 · 上海","产品设计师"),...j(1,"全职 · 可远程","前端工程师"),...j(2,"每周 4 天 · 3 个月起","设计实习生"),b("弹性工作 · 不打卡 · 每年一次团队旅行",72,1500,936,60,{name:"正文",fontSize:36,textFill:d(s),fontWeight:"bold"}),b("简历发到 hr@dingcard.app",72,1632,936,60,{name:"按钮文字",fontSize:40,textFill:d("#ffffff"),fontWeight:"bold",align:"center"}),b("DINGCARD 叮卡",72,1806,936,44,{name:"品牌",fontSize:26,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:6})],Gt)])}function ob(){const e="#f3d58a",n="#d9c9a0",r="M 20 140 C 20 100 60 80 100 92 C 110 52 170 40 200 72 C 230 30 300 30 320 80 C 350 60 410 70 420 110 C 460 104 500 120 500 140 Z";return
|
|
425
|
-
年度设计之夜`,96,520,888,300,{name:"标题",fontSize:108,fontFamily:X,textFill:d(r),fontWeight:"bold",align:"center",lineHeight:1.3}),...l(0,"时间","2026 年 12 月 20 日 19:00"),...l(1,"地点","外滩源壹号 · 宴会厅"),...l(2,"着装","深色正装"),b("敬请回复",340,1522,400,56,{name:"按钮文字",fontSize:36,fontFamily:X,textFill:d(n),align:"center",letterSpacing:6}),b("叮卡团队 敬邀",140,1680,800,52,{name:"品牌",fontSize:32,fontFamily:X,textFill:d(s),align:"center",letterSpacing:4})],Gt)])}function cb(){const e="#f5f1ea",n="#1d1b18",r="#c23a26",s="#6f675d";return
|
|
426
|
-
是一种能力。`,96,300,888,380,{name:"标题",fontSize:80,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.4}),b("—— 林一《写给自己的设计笔记》",96,760,888,56,{name:"副标题",fontSize:34,textFill:d(s)}),b("每日一句 · 第 120 天",96,916,600,50,{name:"信息一",fontSize:28,fontFamily:ie,textFill:d(s),letterSpacing:2}),b("DINGCARD",684,916,300,50,{name:"品牌",fontSize:28,fontFamily:ie,textFill:d(n),fontWeight:"bold",align:"right",letterSpacing:6})],
|
|
427
|
-
看懂复利`,132,346,1220,440,{name:"标题",fontSize:180,textFill:d(n),fontWeight:"bold",lineHeight:1.1,letterSpacing:-6}),b("为什么越早开始越好",140,806,1200,84,{name:"副标题",fontSize:52,textFill:d(e),fontWeight:"bold",effect:{type:"background",color:r,amount:30,radius:0}}),b("叮卡财经",140,934,700,52,{name:"品牌",fontSize:34,textFill:d(n),fontWeight:"bold",letterSpacing:2}),b("4K · 60FPS",1376,848,392,36,{name:"规格",fontSize:22,fontFamily:ie,textFill:d(l),fontWeight:"bold",letterSpacing:4}),...["-2","0","+2"].map((c,f)=>b(c,1340+f*192,942,80,36,{name:`曝光值${f+1}`,fontSize:22,fontFamily:ie,textFill:d(l),align:"center"}))],
|
|
428
|
-
步行友好度`,88,196,920,320,{name:"标题",fontSize:120,textFill:d(n),fontWeight:"bold",lineHeight:1.18,letterSpacing:-2}),b("我们走了 30 条街,记下这些细节",96,536,920,64,{name:"副标题",fontSize:40,textFill:d(s)}),b("叮卡周刊",96,670,600,48,{name:"品牌",fontSize:28,fontFamily:ie,textFill:d(s),fontWeight:"bold",letterSpacing:4})],Zs)])}function hb(){const e="#f3e9dc",n="#c8553d",r="#a8432c",s="#2b2118",l="#6e5f52",o=(c,f,h)=>{const g=940+c*130,x=["一","二","三"][c];return[b(f,96,g,480,44,{name:`标签${x}`,fontSize:28,textFill:d(r),fontWeight:"bold",letterSpacing:4}),b(h,96,g+46,500,60,{name:`信息${x}`,fontSize:34,textFill:d(s),fontWeight:"bold"})]};return
|
|
419
|
+
城市规划学院 · 2026 年 6 月`,120,680,1e3,110,{name:"导语",fontSize:30,fontFamily:_,textFill:d(c),lineHeight:1.7}),b("ACADEMIC REPORT",120,980,800,40,{name:"英文刊头",fontSize:24,fontFamily:Ft,textFill:d(r),italic:!0,letterSpacing:6})],Yn),fe("内页",d(n),[V("rect",-de,-de,28+de,1080+de*2,d(e),{name:"书脊",cornerRadius:0}),b("CHAPTER",120,74,300,32,{name:"章节",fontSize:22,fontFamily:Ft,textFill:d(s),letterSpacing:10}),b("02",110,108,400,150,{name:"章节号",fontSize:120,fontFamily:Ft,textFill:d(s),italic:!0,lineHeight:1.05}),b(`研究方法:
|
|
420
|
+
问卷与街景分析`,112,290,760,200,{name:"标题",fontSize:64,fontFamily:X,textFill:d(e),fontWeight:"bold",lineHeight:1.3}),b("在三个片区发放问卷 1,200 份,回收有效问卷 986 份;同时用街景图片计算每条街道的绿视率。",120,510,720,210,{name:"导语",fontSize:30,fontFamily:_,textFill:d(l),lineHeight:1.7}),V("rect",120,780,6,110,d(s),{name:"引文竖线",cornerRadius:0}),b("“街道是城市里最大的公共空间。”",150,786,700,100,{name:"引文",fontSize:34,fontFamily:X,textFill:d(e),fontWeight:"bold",lineHeight:1.45}),...h(0,"问卷调查","步行频率、目的和对街道的感受"),...h(1,"街景分析","从街景图片里算出每条街的绿视率"),...h(2,"回归模型","控制年龄、收入和距离后看绿化的影响"),...Mf(e,o,"02 / 03")],Yn),fe("结尾",d(e),[...Cf(1260,280,300,f),b(`恳请各位老师
|
|
421
|
+
批评指正`,110,190,1100,330,{name:"主标题",fontSize:110,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.25}),b("谢谢!后续研究会从这三件事做起:",120,560,1e3,60,{name:"收束句",fontSize:36,fontFamily:_,textFill:d(c),lineHeight:1.5}),...g(0,"把样本扩大到五个城市"),...g(1,"加入夜间步行的数据"),...g(2,"和街道改造项目一起做跟踪"),...Mf(c,f,"03 / 03")],Yn)])}function Ca(e,n,r,s,l,o,c={}){return V(c.shape??"rect",r,s,l,o,{type:"image",src:n,fit:"cover",framing:zr()},{name:e,cornerRadius:c.cornerRadius??0,rotation:c.rotation,filter:c.filter})}function qr(e,n,r,s,l={}){const o=E0(e);if(!o)throw new Error(`no decoration ${e}`);return{...xd(o,{x:n,y:r,width:s,height:l.height,color:l.color,text:l.text},xr),...l.name?{name:l.name}:{},...l.rotation!==void 0?{rotation:l.rotation}:{}}}function eb(e,n,r,s,l,o={}){const c=qr(e,n,r,s,{color:o.color});if(c.type!=="group"||c.rotation!==0)throw new Error(`decoration ${e} has no parts to lay out`);return c.children.flatMap((f,h)=>{const g=l[h];return!g||f.type==="group"?[]:[{...f,name:g,x:c.x+f.x,y:c.y+f.y}]})}function R0(e,n,r){const s=r*Math.PI/180,l=n.x+n.width/2,o=n.y+n.height/2,c=e.x+e.width/2-l,f=e.y+e.height/2-o;return{x:Math.round((l+c*Math.cos(s)-f*Math.sin(s)-e.width/2)*10)/10,y:Math.round((o+c*Math.sin(s)+f*Math.cos(s)-e.height/2)*10)/10}}function $r(e,n,r,s,l,o,c,f={}){return{id:xr(),name:e,locked:!1,hidden:!1,type:"image",x:s,y:l,width:o,height:c,rotation:f.rotation??0,scale:1,src:n,alt:r,fit:"contain",framing:zr()}}function tb(e,n,r,s,l,o,c,f={}){return{id:xr(),name:f.name??"图表",locked:!1,hidden:!1,type:"chart",x:s,y:l,width:o,height:c,rotation:f.rotation??0,scale:1,chartKind:e,labels:[...n],series:r.map(h=>({values:[...h.values],color:h.color,...h.name!==void 0?{name:h.name}:{}})),...f.showValues?{showValues:!0}:{},...f.barMode?{barMode:f.barMode}:{},...f.showTicks===!1?{showTicks:!1}:{},...f.showLegend!==void 0?{showLegend:f.showLegend}:{},...f.ink!==void 0?{ink:f.ink}:{},...f.opacity!==void 0?{opacity:f.opacity}:{}}}function nb(e,n,r,s,l,o={}){const c=e.length,f=Math.max(...e.map(g=>g.length)),h=[];for(const g of e)for(let x=0;x<f;x+=1)h.push(g[x]??"");return{id:xr(),name:o.name??"表格",locked:!1,hidden:!1,type:"table",x:n,y:r,width:s,height:l,rotation:o.rotation??0,scale:1,rows:c,cols:f,cells:h,...o.headerRow===!1?{headerRow:!1}:{},...o.striped?{striped:!0}:{},...o.ink!==void 0?{ink:o.ink}:{},...o.headerFill!==void 0?{headerFill:o.headerFill}:{},...o.stripeFill!==void 0?{stripeFill:o.stripeFill}:{},...o.colWidths!==void 0?{colWidths:[...o.colWidths]}:{},...o.grid!==void 0?{grid:o.grid}:{},...o.lineColor!==void 0?{lineColor:o.lineColor}:{},...o.lineWidth!==void 0?{lineWidth:o.lineWidth}:{},...o.fontSize!==void 0?{fontSize:o.fontSize}:{},...o.opacity!==void 0?{opacity:o.opacity}:{}}}function rb(){const e="#f2efe8",n="#141414",r="#c7400e",s="#b93a0c",l="#5c5852",o=(c,f,h)=>{const g=1528+c*70,x=["一","二","三"][c];return[b(f,72,g,140,56,{name:`标签${x}`,fontSize:30,fontFamily:ie,textFill:d(s),fontWeight:"bold",letterSpacing:2}),b(h,212,g,796,56,{name:`信息${x}`,fontSize:34,textFill:d(n),fontWeight:"bold"})]};return we([fe("海报",d(e),[Ca("主图","/templates/editorial-building.webp",-de,-de,1080+de*2,980+de),Z(72,1488,936,n,3,{name:"分隔线",cap:"butt"}),V("rect",72,1764,420,96,d(n),{name:"按钮底板",cornerRadius:48}),b("公开讲座",72,880,600,64,{name:"角标",fontSize:32,textFill:d("#ffffff"),fontWeight:"bold",letterSpacing:4,effect:{type:"background",color:r,amount:45,radius:6}}),b(`城市里的
|
|
422
|
+
第二条路`,64,1012,952,370,{name:"标题",fontSize:152,textFill:d(n),fontWeight:"bold",lineHeight:1.15,letterSpacing:-4}),b("关于步行、街道和公共空间的一次分享",72,1394,936,64,{name:"副标题",fontSize:40,textFill:d(l)}),...o(0,"时间","10 月 18 日 周六 14:00"),...o(1,"地点","城市规划展览馆 3 层报告厅"),...o(2,"嘉宾","林一 · 建筑师"),b("扫码报名 →",72,1784,420,56,{name:"按钮文字",fontSize:36,textFill:d("#ffffff"),fontWeight:"bold",align:"center"}),b("城市漫游计划",592,1788,416,48,{name:"主办",fontSize:28,textFill:d(l),align:"right",letterSpacing:2})],Gt)])}function ab(){const e="#fff3e3",n="#ff6a2b",r="#3b1f14",s="#7a4a2c";return we([fe("海报",d(e),[V("ellipse",90,330,900,900,d(n),{name:"大圆"}),$r("主图","/templates/poster-coffee.svg","一杯放在碟子上的拿铁",170,390,740,740),V("ellipse",770,300,230,230,d("#ffd23f"),{name:"角标底"}),Z(440,240,200,r,4,{name:"副标题线",cap:"round"}),V("rect",290,1700,500,112,d(r),{name:"按钮底板",cornerRadius:56}),b("秋日咖啡季",64,120,952,100,{name:"副标题",fontSize:64,textFill:d(r),fontWeight:"bold",align:"center",letterSpacing:8}),b(`限时
|
|
423
|
+
7 天`,770,350,230,132,{name:"角标",fontSize:46,textFill:d(r),fontWeight:"bold",align:"center",lineHeight:1.15,rotation:12}),b("第二杯半价",40,1214,1e3,236,{name:"标题",fontSize:180,textFill:d(r),fontWeight:"bold",align:"center",letterSpacing:-4,effect:{type:"offset",color:n,amount:40,angle:45}}),b("拿铁、美式、季节限定,任选两杯",72,1468,936,64,{name:"正文",fontSize:40,textFill:d(r),align:"center"}),b("活动时间 10.1 – 10.31",72,1560,936,52,{name:"信息一",fontSize:34,textFill:d(s),align:"center"}),b("全国直营门店可用",72,1616,936,52,{name:"信息二",fontSize:34,textFill:d(s),align:"center"}),b("立即领券",290,1724,500,64,{name:"按钮文字",fontSize:44,textFill:d(e),fontWeight:"bold",align:"center",letterSpacing:4}),b("DINGCARD COFFEE",72,1846,936,40,{name:"品牌",fontSize:24,fontFamily:ie,textFill:d(r),fontWeight:"bold",align:"center",letterSpacing:8})],Gt)])}function ib(e,n,r,s,l){const o=s/2,c=s*.17,f=s*.6,h=`M ${s*.2} ${s} C ${s*.2} ${f+s*.04} ${s*.33} ${f-s*.04} ${o} ${f-s*.04} C ${s*.67} ${f-s*.04} ${s*.8} ${f+s*.04} ${s*.8} ${s} Z`,g=`M ${o-c} ${s*.36} A ${c} ${c} 0 1 0 ${o+c} ${s*.36} A ${c} ${c} 0 1 0 ${o-c} ${s*.36} Z`;return Y(`${g} ${h}`,n,r,s,s,{name:e,fill:d(l),stroke:l,strokeWidth:0})}function sb(){const e="#f3efe6",n="#16181d",r="#5b5f6a",s="#2448d8",l="#f0643a",o="#d84c22",c="#d9d3c6",f=[["#2448d8","#4a6ae6"],["#f0643a","#f58a68"],["#f2b632","#f6c95f"],["#2f8f6a","#4fa985"],["#e3dccd","#cfc6b3"],["#16181d","#3a3e48"],["#f2b632","#f6c95f"],["#2448d8","#4a6ae6"],null,["#f0643a","#f58a68"]],h=168,g=k=>({x:72+k%5*(h+24),y:120+Math.floor(k/5)*(h+24)}),x=f.flatMap((k,v)=>{if(!k)return[];const{x:w,y:N}=g(v),F=v+1;return[V("rect",w,N,h,h,d(k[0]),{name:`成员${F}`,cornerRadius:28}),ib(`头像${F}`,w,N,h,k[1])]}),m=g(8),j=(k,v,w)=>{const N=1040+k*150,F=["一","二","三"][k];return[Z(72,N+132,936,c,2,{name:`职位线${F}`,cap:"butt"}),b(String(k+1).padStart(2,"0"),72,N+50,90,64,{name:`编号${F}`,fontSize:44,fontFamily:ie,textFill:d(o),fontWeight:"bold"}),b(v,176,N,832,44,{name:`条件${F}`,fontSize:28,fontFamily:ie,textFill:d(s),fontWeight:"bold",letterSpacing:2}),b(w,176,N+44,832,76,{name:`职位${F}`,fontSize:52,textFill:d(n),fontWeight:"bold"})]};return we([fe("海报",d(e),[...x,Y(`M 3 3 H ${h-3} V ${h-3} H 3 Z`,m.x,m.y,h,h,{name:"空位",stroke:n,strokeWidth:5,dash:14,cap:"butt",join:"miter"}),Y("M 84 44 V 124 M 44 84 H 124",m.x,m.y,h,h,{name:"加号",stroke:n,strokeWidth:10,cap:"round"}),Z(72,1774,936,n,3,{name:"页脚线",cap:"butt"}),V("rect",72,1600,936,124,d(n),{name:"按钮底板",cornerRadius:62}),b("WE ARE HIRING",72,538,700,44,{name:"英文标语",fontSize:28,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:8}),b("急招",852,524,156,72,{name:"角标",fontSize:34,textFill:d(n),fontWeight:"bold",align:"center",letterSpacing:6,effect:{type:"background",color:l,amount:40,radius:100}}),b(`这个位置
|
|
424
|
+
留给你`,64,610,952,300,{name:"标题",fontSize:124,textFill:d(n),fontWeight:"bold",lineHeight:1.16,letterSpacing:-2}),b("做一款给 AI 用的设计编辑器,现在就差一个你。",72,930,936,60,{name:"副标题",fontSize:38,textFill:d(r)}),...j(0,"全职 · 上海","产品设计师"),...j(1,"全职 · 可远程","前端工程师"),...j(2,"每周 4 天 · 3 个月起","设计实习生"),b("弹性工作 · 不打卡 · 每年一次团队旅行",72,1500,936,60,{name:"正文",fontSize:36,textFill:d(s),fontWeight:"bold"}),b("简历发到 hr@dingcard.app",72,1632,936,60,{name:"按钮文字",fontSize:40,textFill:d("#ffffff"),fontWeight:"bold",align:"center"}),b("DINGCARD 叮卡",72,1806,936,44,{name:"品牌",fontSize:26,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:6})],Gt)])}function ob(){const e="#f3d58a",n="#d9c9a0",r="M 20 140 C 20 100 60 80 100 92 C 110 52 170 40 200 72 C 230 30 300 30 320 80 C 350 60 410 70 420 110 C 460 104 500 120 500 140 Z";return we([fe("海报",ir([[0,"#0c1a2e"],[1,"#20365e"]],180),[V("ellipse",230,250,620,620,{type:"radial-gradient",stops:[{offset:0,color:"#fff8e1"},{offset:1,color:"#f2cf86"}]},{name:"月亮",shadow:{color:"#f6dfa0",blur:90,offsetX:0,offsetY:0}}),Y(r,120,720,520,160,{name:"祥云一",fill:d("#ffffff"),strokeWidth:0,opacity:.16}),Y(r,520,790,520,160,{name:"祥云二",fill:d("#ffffff"),strokeWidth:0,opacity:.1}),V("ellipse",160,200,8,8,d("#ffffff"),{name:"星一",opacity:.7}),V("ellipse",900,160,6,6,d("#ffffff"),{name:"星二",opacity:.6}),V("ellipse",960,520,6,6,d("#ffffff"),{name:"星三",opacity:.5}),V("rect",96,1480,120,120,d("#c8382e"),{name:"印章",cornerRadius:10,rotation:-4}),Z(96,1716,300,e,2,{name:"落款线"}),b("月满中秋",770,980,210,720,{name:"标题",fontSize:150,fontFamily:X,textFill:d(e),fontWeight:"bold",letterSpacing:20,vertical:!0}),b("但愿人长久 千里共婵娟",660,1e3,90,640,{name:"副标题",fontSize:40,fontFamily:X,textFill:d(n),letterSpacing:8,vertical:!0}),b("中秋",96,1498,120,84,{name:"印章文字",fontSize:44,fontFamily:X,textFill:d("#ffffff"),fontWeight:"bold",align:"center",rotation:-4,lineHeight:1.4}),b("丙午年 八月十五",96,1636,500,52,{name:"信息一",fontSize:34,fontFamily:X,textFill:d(n),letterSpacing:4}),b("2026.09.25",96,1742,500,44,{name:"信息二",fontSize:28,fontFamily:ie,textFill:d(n),letterSpacing:4}),b("叮卡 敬贺",96,1800,500,52,{name:"品牌",fontSize:32,fontFamily:X,textFill:d(e),letterSpacing:6})],Gt)])}function lb(){const e="#12352b",n="#c9a45c",r="#f4ecdc",s="#cbbf9f",l=(o,c,f)=>{const h=960+o*170,g=["一","二","三"][o];return[b(c,140,h,800,44,{name:`标签${g}`,fontSize:28,fontFamily:ie,textFill:d(n),align:"center",letterSpacing:8}),b(f,140,h+50,800,70,{name:`信息${g}`,fontSize:46,fontFamily:X,textFill:d(r),align:"center"})]};return we([fe("邀请函",d(e),[V("rect",48,48,984,1824,{type:"transparent"},{name:"外框",cornerRadius:0,stroke:n,strokeWidth:3}),V("rect",70,70,940,1780,{type:"transparent"},{name:"内框",cornerRadius:0,stroke:n,strokeWidth:1}),Z(330,278,170,n,2,{name:"饰线左"}),Z(580,278,170,n,2,{name:"饰线右"}),V("rect",525,269,30,30,d(n),{name:"菱形",cornerRadius:0,rotation:45}),Z(440,868,200,n,2,{name:"标题线"}),V("rect",340,1500,400,100,{type:"transparent"},{name:"按钮底板",cornerRadius:50,stroke:n,strokeWidth:2}),b("INVITATION",140,180,800,50,{name:"英文标语",fontSize:28,fontFamily:ie,textFill:d(n),align:"center",letterSpacing:14}),b("诚邀您参加",140,420,800,70,{name:"副标题",fontSize:48,fontFamily:X,textFill:d(r),align:"center",letterSpacing:8}),b(`叮卡五周年
|
|
425
|
+
年度设计之夜`,96,520,888,300,{name:"标题",fontSize:108,fontFamily:X,textFill:d(r),fontWeight:"bold",align:"center",lineHeight:1.3}),...l(0,"时间","2026 年 12 月 20 日 19:00"),...l(1,"地点","外滩源壹号 · 宴会厅"),...l(2,"着装","深色正装"),b("敬请回复",340,1522,400,56,{name:"按钮文字",fontSize:36,fontFamily:X,textFill:d(n),align:"center",letterSpacing:6}),b("叮卡团队 敬邀",140,1680,800,52,{name:"品牌",fontSize:32,fontFamily:X,textFill:d(s),align:"center",letterSpacing:4})],Gt)])}function cb(){const e="#f5f1ea",n="#1d1b18",r="#c23a26",s="#6f675d";return we([fe("金句",d(e),[Y("M 0 56 C 0 22 18 0 52 0 L 52 22 C 34 22 26 32 26 46 L 52 46 L 52 100 L 0 100 Z M 70 56 C 70 22 88 0 122 0 L 122 22 C 104 22 96 32 96 46 L 122 46 L 122 100 L 70 100 Z",96,140,122,100,{name:"引号",fill:d(r),strokeWidth:0}),Z(96,874,888,"#d8d0c4",2,{name:"分隔线",cap:"butt"}),b(`把复杂的事说简单,
|
|
426
|
+
是一种能力。`,96,300,888,380,{name:"标题",fontSize:80,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.4}),b("—— 林一《写给自己的设计笔记》",96,760,888,56,{name:"副标题",fontSize:34,textFill:d(s)}),b("每日一句 · 第 120 天",96,916,600,50,{name:"信息一",fontSize:28,fontFamily:ie,textFill:d(s),letterSpacing:2}),b("DINGCARD",684,916,300,50,{name:"品牌",fontSize:28,fontFamily:ie,textFill:d(n),fontWeight:"bold",align:"right",letterSpacing:6})],Dr)])}function db(){const e="#0f5132",n="#3f7a60",r="#d63d22",s="#ffffff",l=(o,c)=>{const f=366+o*74,h=["一","二","三"][o];return[V("ellipse",72,f+6,44,44,d(e),{name:`勾底${h}`}),b("✓",72,f+8,44,40,{name:`勾${h}`,fontSize:26,fontFamily:ie,textFill:d(s),fontWeight:"bold",align:"center"}),b(c,132,f,440,56,{name:`信息${h}`,fontSize:34,textFill:d(e),fontWeight:"bold"})]};return we([fe("主图",ir([[0,"#eef8f3"],[1,"#d7efe4"]],160),[V("ellipse",470,110,580,580,d(s),{name:"背景圆",opacity:.75}),$r("主图","/templates/poster-bottle.svg","一瓶植物精华水和两片叶子",520,110,480,600),Z(72,620,420,"#bfe0d1",2,{name:"分隔线",cap:"butt"}),V("ellipse",64,690,300,300,d(r),{name:"价格底"}),b("植物精华水",64,110,560,130,{name:"标题",fontSize:96,textFill:d(e),fontWeight:"bold",letterSpacing:-2}),b("补水 · 舒缓 · 不黏腻",72,250,500,56,{name:"副标题",fontSize:36,textFill:d(n)}),...l(0,"72 小时持续补水"),...l(1,"无酒精 · 无香精"),...l(2,"敏感肌也能用"),b("到手价",64,746,300,56,{name:"价格标签",fontSize:40,textFill:d(s),fontWeight:"bold",align:"center",letterSpacing:4}),b("¥59",64,802,300,130,{name:"角标",fontSize:110,fontFamily:ie,textFill:d(s),fontWeight:"bold",align:"center",letterSpacing:-2}),b("DINGCARD 植物所",560,980,456,44,{name:"品牌",fontSize:26,fontFamily:ie,textFill:d(e),fontWeight:"bold",align:"right",letterSpacing:4})],Dr)])}function Ef(e,n,r,s){const[l,o,c,f]=[s,s,e-s,n-s];return[`M ${l} ${o+r} V ${o} H ${l+r}`,`M ${c-r} ${o} H ${c} V ${o+r}`,`M ${c} ${f-r} V ${f} H ${c-r}`,`M ${l+r} ${f} H ${l} V ${f-r}`].join(" ")}function ub(){const e="#111315",n="#ffffff",r="#ffd84d",s="#ff3b30",l="#8d939b",o=Array.from({length:13},(c,f)=>{const h=4+f*32,g=f%6===0;return`M ${h} ${g?2:14} V 34`}).join(" ");return we([fe("封面",d(e),[Y(Ef(1792,952,104,4),64,64,1792,952,{name:"取景框",stroke:n,strokeWidth:8,cap:"square",join:"miter"}),Y(Ef(300,300,48,3),1420,330,300,300,{name:"对焦框",stroke:r,strokeWidth:6,cap:"square",join:"miter"}),Y("M 150 132 V 168 M 132 150 H 168",1420,330,300,300,{name:"对焦点",stroke:r,strokeWidth:4,cap:"butt"}),Y(o,1376,900,392,36,{name:"曝光刻度",stroke:n,strokeWidth:3,cap:"butt"}),V("ellipse",1567,878,14,14,d(r),{name:"曝光指针"}),V("ellipse",140,136,30,30,d(s),{name:"录制点",shadow:{color:s,blur:16,offsetX:0,offsetY:0}}),b("REC",186,126,200,50,{name:"录制",fontSize:34,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:6}),b("00:08:24",1480,126,300,50,{name:"时间码",fontSize:34,fontFamily:ie,textFill:d(n),fontWeight:"bold",align:"right",letterSpacing:4}),b("EP.12",140,246,320,80,{name:"角标",fontSize:44,fontFamily:ie,textFill:d(e),fontWeight:"bold",letterSpacing:2,effect:{type:"background",color:r,amount:40,radius:10}}),b(`3 分钟
|
|
427
|
+
看懂复利`,132,346,1220,440,{name:"标题",fontSize:180,textFill:d(n),fontWeight:"bold",lineHeight:1.1,letterSpacing:-6}),b("为什么越早开始越好",140,806,1200,84,{name:"副标题",fontSize:52,textFill:d(e),fontWeight:"bold",effect:{type:"background",color:r,amount:30,radius:0}}),b("叮卡财经",140,934,700,52,{name:"品牌",fontSize:34,textFill:d(n),fontWeight:"bold",letterSpacing:2}),b("4K · 60FPS",1376,848,392,36,{name:"规格",fontSize:22,fontFamily:ie,textFill:d(l),fontWeight:"bold",letterSpacing:4}),...["-2","0","+2"].map((c,f)=>b(c,1340+f*192,942,80,36,{name:`曝光值${f+1}`,fontSize:22,fontFamily:ie,textFill:d(l),align:"center"}))],Yn)])}function fb(){const e="#13213c",n="#f6f1e7",r="#f28b30",s="#aab6cc";return we([fe("首图",d(e),[Ca("主图","/templates/editorial-building.webp",1060,-de,740+de,766+de*2),V("rect",1040,-de,20,766+de*2,d(r),{name:"色条",cornerRadius:0}),Z(96,636,120,r,6,{name:"标题线",cap:"butt"}),b("深度 · 城市",96,112,500,60,{name:"角标",fontSize:30,textFill:d(e),fontWeight:"bold",letterSpacing:4,effect:{type:"background",color:r,amount:45,radius:6}}),b(`一座城市的
|
|
428
|
+
步行友好度`,88,196,920,320,{name:"标题",fontSize:120,textFill:d(n),fontWeight:"bold",lineHeight:1.18,letterSpacing:-2}),b("我们走了 30 条街,记下这些细节",96,536,920,64,{name:"副标题",fontSize:40,textFill:d(s)}),b("叮卡周刊",96,670,600,48,{name:"品牌",fontSize:28,fontFamily:ie,textFill:d(s),fontWeight:"bold",letterSpacing:4})],Zs)])}function hb(){const e="#f3e9dc",n="#c8553d",r="#a8432c",s="#2b2118",l="#6e5f52",o=(c,f,h)=>{const g=940+c*130,x=["一","二","三"][c];return[b(f,96,g,480,44,{name:`标签${x}`,fontSize:28,textFill:d(r),fontWeight:"bold",letterSpacing:4}),b(h,96,g+46,500,60,{name:`信息${x}`,fontSize:34,textFill:d(s),fontWeight:"bold"})]};return we([fe("宣传单",d(e),[Z(96,146,1048,s,2,{name:"刊头线",cap:"butt"}),Y("M 0 620 V 250 A 250 250 0 0 1 500 250 V 620 Z",650,700,500,620,{name:"拱门",fill:d("#e9c3ae"),strokeWidth:0}),$r("主图","/templates/poster-pottery.svg","三件手作陶器:插着枝叶的高瓶、条纹罐和小杯",610,840,580,490),V("rect",96,1400,480,110,d(n),{name:"按钮底板",cornerRadius:55}),Z(96,1616,1048,s,1.5,{name:"页脚线",cap:"butt"}),b("泥土与火 CLAY STUDIO",96,76,800,48,{name:"品牌",fontSize:28,fontFamily:ie,textFill:d(s),fontWeight:"bold",letterSpacing:6}),b("周末限定",96,196,400,60,{name:"角标",fontSize:30,textFill:d("#ffffff"),fontWeight:"bold",letterSpacing:4,effect:{type:"background",color:"#b84a32",amount:45,radius:8}}),b(`周末
|
|
429
429
|
陶艺工作坊`,88,276,1060,400,{name:"标题",fontSize:170,textFill:d(s),fontWeight:"bold",lineHeight:1.12,letterSpacing:-6}),b(`从揉泥到上釉,
|
|
430
|
-
两天做出自己的第一只杯子`,96,716,520,170,{name:"副标题",fontSize:40,textFill:d(l),lineHeight:1.5}),...o(0,"时间","每周六、日 10:00–16:00"),...o(1,"地点","城南创意园 B 座 2 层"),...o(2,"费用","680 元 / 人,含材料与烧制"),b("扫码预约",96,1426,480,60,{name:"按钮文字",fontSize:42,textFill:d("#ffffff"),fontWeight:"bold",align:"center",letterSpacing:6}),b("预约电话 021-6000 0000 · 城南创意园 B 座",96,1646,1048,44,{name:"页脚",fontSize:26,textFill:d(l),letterSpacing:1})],es)])}const
|
|
430
|
+
两天做出自己的第一只杯子`,96,716,520,170,{name:"副标题",fontSize:40,textFill:d(l),lineHeight:1.5}),...o(0,"时间","每周六、日 10:00–16:00"),...o(1,"地点","城南创意园 B 座 2 层"),...o(2,"费用","680 元 / 人,含材料与烧制"),b("扫码预约",96,1426,480,60,{name:"按钮文字",fontSize:42,textFill:d("#ffffff"),fontWeight:"bold",align:"center",letterSpacing:6}),b("预约电话 021-6000 0000 · 城南创意园 B 座",96,1646,1048,44,{name:"页脚",fontSize:26,textFill:d(l),letterSpacing:1})],es)])}const ft=["一","二","三","四","五","六","七","八","九","十"];function mb(){const e="#fbf7ef",n="#1d1b16",r="#6b645a",s=[...Array.from({length:17},(o,c)=>`M${(c+1)*60} 0V1440`),...Array.from({length:23},(o,c)=>`M0 ${(c+1)*60}H1080`)].join(""),l=(o,c)=>{const f=948+o*108,h=ft[o];return[V("ellipse",132,f+8,56,56,d(n),{name:`编号底${h}`}),b(String(o+1),124,f+4,72,64,{name:`编号${h}`,fontSize:30,fontFamily:ie,textFill:d("#ffffff"),fontWeight:"bold",align:"center",lineHeight:1.6}),b(c,212,f,760,72,{name:`要点${h}`,fontSize:42,textFill:d(n),fontWeight:"bold"})]};return we([fe("封面",d(e),[Y(s,0,0,1080,1440,{name:"格线",stroke:"#ece4d4",strokeWidth:2,cap:"butt"}),V("rect",88,912,904,360,d("#ffffff"),{name:"清单卡",cornerRadius:32,stroke:n,strokeWidth:4,shadow:{color:n,blur:0,offsetX:10,offsetY:10}}),qr("sparkles",858,96,132,{color:"#ffb000"}),b("干货分享",88,120,400,64,{name:"角标",fontSize:34,textFill:d("#ffffff"),fontWeight:"bold",letterSpacing:4,effect:{type:"background",color:n,amount:50,radius:100}}),b(`新手做图
|
|
431
431
|
最该先学的
|
|
432
|
-
5 个排版习惯`,80,224,920,540,{name:"标题",fontSize:132,textFill:d(n),fontWeight:"bold",lineHeight:1.3,letterSpacing:-2,effect:{type:"marker",color:"#ffd84d",amount:55}}),b("收藏起来,做图前对照一遍",88,790,904,70,{name:"副标题",fontSize:44,textFill:d(r)}),...l(0,"留白比你想的更重要"),...l(1,"一页只说一件事"),...l(2,"字号至少拉开两档"),
|
|
433
|
-
城市漫步路线`,80,920,920,300,{name:"标题",fontSize:112,textFill:d(n),fontWeight:"bold",lineHeight:1.24,letterSpacing:-2}),b("6 个小众打卡点,附路线图",88,1236,904,64,{name:"副标题",fontSize:42,textFill:d(r)}),
|
|
434
|
-
特发此证,以资鼓励。`,227,652,1300,170,{name:"正文",fontSize:40,fontFamily:X,textFill:d(l),align:"center",lineHeight:1.75}),b("叮卡设计委员会",220,996,600,60,{name:"颁发单位",fontSize:36,fontFamily:X,textFill:d(s),fontWeight:"bold",align:"center",letterSpacing:4}),b("二〇二六年十月",220,1060,600,52,{name:"信息一",fontSize:30,fontFamily:X,textFill:d(l),align:"center",letterSpacing:4}),b("No. 2026-018",1300,100,360,40,{name:"信息二",fontSize:22,fontFamily:ie,textFill:d(r),align:"right",letterSpacing:2})],bd)])}function wb(){const e="#fff4e3",n={color:"#3b2342",blur:40,offsetX:0,offsetY:12},r=
|
|
435
|
-
看这张表`,64,168,952,290,{name:"标题",fontSize:120,fontFamily:
|
|
436
|
-
自动同步省心`,108,1482,908,140,{name:"结论",fontSize:46,fontFamily:
|
|
437
|
-
看城市里的光,怎样落在每个人身上。`,64,1462,952,110,{name:"正文",fontSize:32,fontFamily:
|
|
438
|
-
SOON`,52,300,976,420,{name:"英文标语",fontSize:200,fontFamily:
|
|
439
|
-
首发当天前 100 名享 8 折。`,112,1398,856,120,{name:"正文",fontSize:34,fontFamily:
|
|
440
|
-
秋天就到这里了。`,96,452,500,120,{name:"信息二",fontSize:32,fontFamily:X,textFill:d(s),lineHeight:1.75}),b("叮卡 · 节气日历",96,1800,600,48,{name:"品牌",fontSize:28,fontFamily:X,textFill:d(n),letterSpacing:6})],Gt)])}function
|
|
441
|
-
做了多少事`,64,500,952,260,{name:"标题",fontSize:104,fontFamily:
|
|
442
|
-
把日子过成自己喜欢的样子。`,110,702,860,130,{name:"正文",fontSize:34,fontFamily:X,textFill:d(s),align:"center",lineHeight:1.75}),b("— 爱你的阿林",90,860,900,52,{name:"署名",fontSize:32,fontFamily:X,textFill:d(n),align:"center",letterSpacing:4})],
|
|
443
|
-
改十遍`,56,48,640,216,{name:"标题",fontSize:96,fontFamily:Rx,textFill:d(l),lineHeight:1.12}),Z(60,266,96,l,6,{name:"标题线",cap:"butt"}),b("和林一聊聊设计里的耐心",60,286,640,48,{name:"副标题",fontSize:30,fontFamily:
|
|
444
|
-
Pitch Deck 2027`,1440,560,400,140,{name:"副标题",fontSize:40,fontFamily:
|
|
445
|
-
所有甜品都可以做小份。`,120,1452,640,110,{name:"正文",fontSize:30,fontFamily:X,textFill:d(r),lineHeight:1.7}),b("叮卡甜品店 · 每日 10:00 – 20:00",120,1620,680,48,{name:"品牌",fontSize:30,fontFamily:X,textFill:d(n),fontWeight:"bold",letterSpacing:2})],es)])}function $b(){const e="#f6f2ea",n="#55715e",r="#2f3a33",s="#5f6b63";return
|
|
446
|
-
不急,不慌,一步一步,把日子过稳。`,88,1410,904,150,{name:"正文",fontSize:40,fontFamily:X,textFill:d(n),align:"center",lineHeight:1.75}),Z(500,1610,80,r,3,{name:"短线",cap:"butt"}),b("你的年度汉字是哪一个?",88,1648,904,56,{name:"信息一",fontSize:34,fontFamily:X,textFill:d(s),align:"center",letterSpacing:4}),b("叮卡 · 年终特辑",88,1796,904,48,{name:"品牌",fontSize:28,fontFamily:X,textFill:d(n),align:"center",letterSpacing:8})],Gt)])}function Hb(){const e="#190a34",n="#ffffff",r="#ffd54a",s="#ff6fa8",l=[[380,10],[440,14],[492,18],[540,22],[586,26],[632,30]],o=(f,h,g)=>{const x=1508+f*64,m=
|
|
447
|
-
2026.10.13`,616,300,196,96,{name:"邮戳文字",fontSize:26,fontFamily:
|
|
432
|
+
5 个排版习惯`,80,224,920,540,{name:"标题",fontSize:132,textFill:d(n),fontWeight:"bold",lineHeight:1.3,letterSpacing:-2,effect:{type:"marker",color:"#ffd84d",amount:55}}),b("收藏起来,做图前对照一遍",88,790,904,70,{name:"副标题",fontSize:44,textFill:d(r)}),...l(0,"留白比你想的更重要"),...l(1,"一页只说一件事"),...l(2,"字号至少拉开两档"),qr("star",912,1218,112,{name:"星星",rotation:14}),b("@叮卡设计笔记",88,1334,700,56,{name:"品牌",fontSize:32,textFill:d(r),fontWeight:"bold"})])])}function pb(){const e="#efe6da",n="#2a211b",r="#6f6156",l={x:112,y:100,width:856,height:740},o={x:140,y:128,width:800,height:612},c=R0(o,l,-2);return we([fe("封面",d(e),[V("rect",l.x,l.y,l.width,l.height,d("#ffffff"),{name:"相框",cornerRadius:6,rotation:-2,shadow:{color:"#cbbca8",blur:36,offsetX:0,offsetY:14}}),Ca("主图","/templates/editorial-building.webp",c.x,c.y,o.width,o.height,{rotation:-2}),qr("tape",54,74,240,{rotation:-34}),qr("tape",784,74,240,{rotation:34,color:"#b9d3ea"}),...eb("burst-badge",806,676,200,["角标底",null]),b("必去",806,738,200,76,{name:"角标",fontSize:50,textFill:d("#ffffff"),fontWeight:"bold",align:"center",rotation:-10,lineHeight:1.2}),b(`周末去哪儿
|
|
433
|
+
城市漫步路线`,80,920,920,300,{name:"标题",fontSize:112,textFill:d(n),fontWeight:"bold",lineHeight:1.24,letterSpacing:-2}),b("6 个小众打卡点,附路线图",88,1236,904,64,{name:"副标题",fontSize:42,textFill:d(r)}),qr("underline-wave",88,1316,240,{name:"波浪线",color:"#d9503f"}),b("@叮卡周末",88,1352,600,52,{name:"品牌",fontSize:30,textFill:d(r),fontWeight:"bold"})])])}function gb(){const e="#f4ede1",n="#2b1d14",r="#a8462c",s="#76665a",l=(o,c,f)=>{const h=520+o*112,g=ft[o];return[Z(110,h+78,1020,"#cdbda6",2,{name:`虚线${g}`,dash:3,cap:"round"}),b(c,110,h,800,72,{name:`菜品${g}`,fontSize:44,fontFamily:X,textFill:d(n),fontWeight:"bold"}),b(f,900,h,230,72,{name:`价格${g}`,fontSize:44,fontFamily:X,textFill:d(r),fontWeight:"bold",align:"right"})]};return we([fe("菜单",d(e),[V("rect",56,56,1128,1642,{type:"transparent"},{name:"边框",cornerRadius:0,stroke:"#d8c9b2",strokeWidth:2}),$r("主图","/templates/poster-coffee.svg","一杯放在碟子上的拿铁",838,80,320,320),b("COFFEE & TEA",110,110,640,44,{name:"刊头",fontSize:26,fontFamily:ie,textFill:d(r),fontWeight:"bold",letterSpacing:8}),b("今日菜单",100,170,760,180,{name:"标题",fontSize:140,fontFamily:X,textFill:d(n),fontWeight:"bold",letterSpacing:4}),b("秋冬限定 · 每日 8:00–20:00",110,360,800,56,{name:"副标题",fontSize:34,textFill:d(s),letterSpacing:2,lineHeight:1.4}),Z(110,452,1020,n,3,{name:"分隔线",cap:"butt"}),...l(0,"美式咖啡","22"),...l(1,"拿铁","28"),...l(2,"燕麦拿铁","30"),...l(3,"澳白","30"),...l(4,"卡布奇诺","28"),...l(5,"桂花拿铁","32"),...l(6,"手冲 · 埃塞俄比亚","38"),...l(7,"柚子美式","30"),Z(110,1440,1020,n,3,{name:"底线",cap:"butt"}),b("所有咖啡可换燕麦奶 +3 元,可做冰、可少糖",110,1476,1020,56,{name:"正文",fontSize:30,textFill:d(s)}),b("DINGCARD COFFEE · 城南创意园 B 座 1 层",110,1630,1020,50,{name:"品牌",fontSize:28,fontFamily:ie,textFill:d(n),fontWeight:"bold",letterSpacing:2})],es)])}function xb(e,n,r){const s=r*.7,l=Math.round(e/r),o=e/l,c=Array.from({length:l},(h,g)=>`L ${((g+.5)*o).toFixed(1)} 0 L ${((g+1)*o).toFixed(1)} ${s.toFixed(1)}`).join(" "),f=Array.from({length:l},(h,g)=>`L ${(e-(g+.5)*o).toFixed(1)} ${n} L ${(e-(g+1)*o).toFixed(1)} ${(n-s).toFixed(1)}`).join(" ");return`M 0 ${s.toFixed(1)} ${c} L ${e} ${(n-s).toFixed(1)} ${f} Z`}function bb(e,n,r){let s=0;const l=[];return e.forEach((o,c)=>{c%2===0&&l.push(`M ${s} 0 H ${s+o*n} V ${r} H ${s} Z`),s+=o*n}),{d:l.join(" "),width:s}}function yb(){const e="#5a1f2b",n="#fbf8f2",r="#2a2225",s="#7a6a6c",l="#ddd3cc",o={x:130,y:110,width:820,height:1720},c=bb([3,1,1,2,2,1,1,3,1,1,4,2,1,1,2,3,1,2,1,1,3,1,2,2,1,3,1,1,2,1,1,4,1,2,3,1,1,2,2,1,1,3,1,1,2,2,3,1,1],5,80),f=(h,g,x)=>{const m=676+h*96,j=ft[h];return[...h>0?[Z(196,m-22,688,l,2,{name:`隔线${j}`,dash:6,cap:"butt"})]:[],b(g,196,m,488,64,{name:`项目${j}`,fontSize:38,textFill:d(r),fontWeight:"bold"}),b(x,684,m,200,64,{name:`价格${j}`,fontSize:38,fontFamily:ie,textFill:d(e),fontWeight:"bold",align:"right"})]};return we([fe("价目表",d(e),[Y(xb(o.width,o.height,28),o.x,o.y,o.width,o.height,{name:"小票",fill:d(n),stroke:n,strokeWidth:0,shadow:{color:"#2e0d15",blur:48,offsetX:0,offsetY:20}}),Z(196,560,688,r,3,{name:"票头线",dash:12,cap:"butt"}),Z(196,1460,688,r,3,{name:"票尾线",dash:12,cap:"butt"}),V("rect",290,1552,500,104,{type:"transparent"},{name:"按钮底板",cornerRadius:16,stroke:e,strokeWidth:4}),Y(c.d,Math.round(540-c.width/2),1686,c.width,80,{name:"条码",fill:d(r),stroke:r,strokeWidth:0}),b("美甲 · 美睫",290,186,500,64,{name:"角标",fontSize:30,textFill:d("#ffffff"),fontWeight:"bold",align:"center",letterSpacing:4,effect:{type:"background",color:e,amount:50,radius:100}}),b("价目表",160,286,760,180,{name:"标题",fontSize:140,fontFamily:X,textFill:d(r),fontWeight:"bold",align:"center",letterSpacing:16}),b("PRICE LIST · 2026",160,478,760,44,{name:"副标题",fontSize:26,fontFamily:ie,textFill:d(s),align:"center",letterSpacing:10}),b("ITEM",196,596,300,36,{name:"项目栏",fontSize:22,fontFamily:ie,textFill:d(s),fontWeight:"bold",letterSpacing:6}),b("PRICE",584,596,300,36,{name:"价格栏",fontSize:22,fontFamily:ie,textFill:d(s),fontWeight:"bold",align:"right",letterSpacing:6}),...f(0,"纯色美甲","¥98"),...f(1,"猫眼美甲","¥158"),...f(2,"法式美甲","¥138"),...f(3,"手绘款(单指)","¥30"),...f(4,"延长甲","¥188"),...f(5,"自然款美睫","¥168"),...f(6,"卸甲护理","¥38"),...f(7,"手部护理","¥88"),b("以上价格含基础修型 · 节假日正常营业",160,1486,760,48,{name:"正文",fontSize:28,textFill:d(s),align:"center"}),b("私信预约",290,1574,500,60,{name:"按钮文字",fontSize:38,textFill:d(e),fontWeight:"bold",align:"center",letterSpacing:8}),b("0 2026 1013 0001 8",290,1770,500,34,{name:"条码数字",fontSize:22,fontFamily:ie,textFill:d(r),align:"center",letterSpacing:8}),b("@叮卡美甲工作室",80,1858,920,44,{name:"品牌",fontSize:28,textFill:d("#ead9d4"),align:"center",letterSpacing:2})],Gt)])}function jb(){const e="#fbf8f1",n="#b8955a",r="#8a6a35",s="#2b2118",l="#5d5146",o=(c,f)=>V("rect",c-11,f-11,22,22,d(n),{name:"角饰",cornerRadius:0,rotation:45});return we([fe("证书",d(e),[V("rect",44,44,1666,1152,{type:"transparent"},{name:"外框",cornerRadius:0,stroke:n,strokeWidth:6}),V("rect",68,68,1618,1104,{type:"transparent"},{name:"内框",cornerRadius:0,stroke:n,strokeWidth:2}),o(68,68),o(1686,68),o(68,1172),o(1686,1172),qr("medal",1360,808,210,{color:"#d9a62e"}),Z(577,610,600,n,2,{name:"姓名线",cap:"butt"}),Z(300,980,440,s,1.5,{name:"签名线",cap:"butt"}),b("CERTIFICATE OF HONOR",0,150,1754,50,{name:"英文标题",fontSize:28,fontFamily:ie,textFill:d(r),fontWeight:"bold",align:"center",letterSpacing:14}),b("荣誉证书",0,208,1754,176,{name:"标题",fontSize:128,fontFamily:X,textFill:d(s),fontWeight:"bold",align:"center",letterSpacing:36}),b("林一",427,452,900,150,{name:"获得者",fontSize:104,fontFamily:ri,textFill:d(s),align:"center",letterSpacing:12}),b(`在 2026 年度「叮卡设计挑战赛」中表现突出,荣获一等奖。
|
|
434
|
+
特发此证,以资鼓励。`,227,652,1300,170,{name:"正文",fontSize:40,fontFamily:X,textFill:d(l),align:"center",lineHeight:1.75}),b("叮卡设计委员会",220,996,600,60,{name:"颁发单位",fontSize:36,fontFamily:X,textFill:d(s),fontWeight:"bold",align:"center",letterSpacing:4}),b("二〇二六年十月",220,1060,600,52,{name:"信息一",fontSize:30,fontFamily:X,textFill:d(l),align:"center",letterSpacing:4}),b("No. 2026-018",1300,100,360,40,{name:"信息二",fontSize:22,fontFamily:ie,textFill:d(r),align:"right",letterSpacing:2})],bd)])}function wb(){const e="#fff4e3",n={color:"#3b2342",blur:40,offsetX:0,offsetY:12},r=fe("九宫格",d("#3d2b52"),[Ca("主图","/templates/grid-sunset.svg",-de,-de,3240+de*2,3240+de*2),Z(1440,2468,360,e,6,{name:"短线",cap:"round",opacity:.8}),b("2026 · 10",150,170,900,140,{name:"角标",fontSize:96,fontFamily:ie,textFill:d("#5b2a4e"),fontWeight:"bold",letterSpacing:8}),b("你好,十月",0,1290,3240,660,{name:"标题",fontSize:500,fontFamily:X,textFill:d(e),fontWeight:"bold",align:"center",letterSpacing:24,lineHeight:1.2,shadow:n}),b("愿你被温柔以待",1080,2520,1080,150,{name:"副标题",fontSize:92,fontFamily:X,textFill:d(e),align:"center",letterSpacing:8,shadow:n}),b("@叮卡",2280,3010,810,100,{name:"品牌",fontSize:64,fontFamily:ie,textFill:d(e),fontWeight:"bold",align:"right",letterSpacing:4,shadow:n})],Zx);return r.guides=[1080,2160].flatMap(s=>["x","y"].map(l=>({id:xr(),axis:l,position:s}))),we([r])}function kb(){const e="#fdf8ee",n="#2f2a24",r="#7a6e60";return we([fe("课程表",d(e),[qr("rainbow",1450,56,214),qr("sparkle",1394,64,44,{color:"#ffc53d"}),b("课程表",86,66,900,140,{name:"标题",fontSize:100,textFill:d(n),fontWeight:"bold",letterSpacing:6}),b("三年级二班 · 2026 秋季学期",92,206,1e3,60,{name:"副标题",fontSize:36,textFill:d(r)}),b("叮卡实验小学",1100,208,564,56,{name:"品牌",fontSize:32,textFill:d(r),fontWeight:"bold",align:"right",letterSpacing:2}),...Nx(Fx,Mx,xr)],bd)])}function Sb(){const e="#f2f0ea",n="#171717",r="#2448c8",s="#dbe2fb";return we([fe("对比表",d(e),[V("rect",-de,-de,1080+de*2,620+de,d(r),{name:"刊头色块",cornerRadius:0}),b("VS",476,190,540,330,{name:"对比字",fontSize:300,fontFamily:Xe,textFill:d("#4065e0"),align:"right",lineHeight:1,letterSpacing:-10}),V("rect",64,1488,12,128,d(r),{name:"结论竖线",cornerRadius:0}),Z(64,1800,952,n,2,{name:"页脚线",cap:"butt"}),b("REVIEW",64,72,500,48,{name:"角标",fontSize:28,fontFamily:_,textFill:d("#ffffff"),fontWeight:"bold",letterSpacing:12}),b(`怎么选,
|
|
435
|
+
看这张表`,64,168,952,290,{name:"标题",fontSize:120,fontFamily:_,textFill:d("#ffffff"),fontWeight:"bold",lineHeight:1.15}),b("两款笔记 App 的功能对比",64,480,952,56,{name:"副标题",fontSize:38,fontFamily:_,textFill:d(s)}),nb([["对比项","甲 App","乙 App"],["价格","免费","12 元/月"],["离线","支持","不支持"],["导出","Markdown","PDF"],["同步","手动","自动"]],64,700,952,680,{name:"对比表",ink:n,headerFill:s,grid:"rows",lineColor:"#c9c4b8",lineWidth:2,fontSize:38,colWidths:[1.3,1,1]}),b(`最后选了乙 App:
|
|
436
|
+
自动同步省心`,108,1482,908,140,{name:"结论",fontSize:46,fontFamily:_,textFill:d(n),fontWeight:"bold",lineHeight:1.4}),b("@叮卡工作室",64,1826,640,48,{name:"品牌",fontSize:28,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:2})],Gt)])}function vb(){const e="#ecebe6",n="#111111",r="#55534d",s=(l,o,c)=>{const f=1618+l*58,h=ft[l];return[b(o,64,f+6,120,40,{name:`标签${h}`,fontSize:24,fontFamily:_,textFill:d(r),fontWeight:"bold",letterSpacing:6}),b(c,184,f,832,50,{name:`信息${h}`,fontSize:32,fontFamily:_,textFill:d(n)})]};return we([fe("海报",d(e),[Ca("主图","/templates/art-ink-stripes.svg",-de,-de,1080+de*2,1196+de),Z(64,1800,952,n,3,{name:"页脚线",cap:"butt"}),b("exhibition.",54,1124,980,210,{name:"英文标语",fontSize:170,fontFamily:Xe,textFill:d(n),letterSpacing:-5,lineHeight:1.1}),b("光与影的漫游",64,1352,952,100,{name:"标题",fontSize:72,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:6}),b(`四十位摄影师、一百二十幅作品,
|
|
437
|
+
看城市里的光,怎样落在每个人身上。`,64,1462,952,110,{name:"正文",fontSize:32,fontFamily:_,textFill:d(r),lineHeight:1.6}),...s(0,"展期","2026.11.01 — 2027.01.15"),...s(1,"地点","城市美术馆 · 二号展厅"),...s(2,"票价","80 元 · 学生半价"),b("城市美术馆",64,1826,640,48,{name:"主办",fontSize:28,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:4}),b("No.12",716,1826,300,48,{name:"角标",fontSize:30,fontFamily:Xe,textFill:d(n),align:"right",letterSpacing:1})],Gt)])}function Nb(){const e="#0b0d17",n="#ffffff",r="#d9dbec",s=(l,o,c,f,h,g,x)=>V("ellipse",c,f,h,g,d(o),{name:l,filter:{blur:100},opacity:x});return we([fe("海报",d(e),[s("光斑一","#3a52f0",-280,60,1e3,1e3,.65),s("光斑二","#9455f5",440,-240,900,860,.65),s("光斑三","#ff6a3d",320,800,960,820,.65),s("光斑四","#ffbe4d",-220,1260,720,640,.6),V("rect",64,1128,952,604,d(e),{name:"玻璃板",cornerRadius:40,opacity:.38}),V("rect",64,1128,952,604,{type:"transparent"},{name:"玻璃边",cornerRadius:40,stroke:n,strokeWidth:2,opacity:.4}),V("rect",112,1572,336,100,d(n),{name:"按钮底板",cornerRadius:50}),Y("M 12 12 L 128 128 M 128 40 L 128 128 L 40 128",760,540,140,140,{name:"箭头",stroke:n,strokeWidth:16,cap:"square",join:"miter"}),b("STUDIO DING",64,72,560,48,{name:"品牌",fontSize:28,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:6}),b("09.20",716,66,300,56,{name:"角标",fontSize:40,fontFamily:Xe,textFill:d(n),align:"right"}),b(`COMING
|
|
438
|
+
SOON`,52,300,976,420,{name:"英文标语",fontSize:200,fontFamily:Xe,textFill:d(n),lineHeight:1,letterSpacing:-6}),b("秋冬系列 · 第 4 季",112,1180,856,48,{name:"副标题",fontSize:32,fontFamily:_,textFill:d(r),letterSpacing:6}),b("新品即将上线",112,1246,856,136,{name:"标题",fontSize:108,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:2}),b(`预约即送限定礼盒,
|
|
439
|
+
首发当天前 100 名享 8 折。`,112,1398,856,120,{name:"正文",fontSize:34,fontFamily:_,textFill:d(n),lineHeight:1.6}),b("立即预约",112,1594,336,56,{name:"按钮文字",fontSize:36,fontFamily:_,textFill:d(e),fontWeight:"bold",align:"center",letterSpacing:6}),b("11 月 11 日 20:00 · 官网与门店同步首发",64,1800,952,48,{name:"信息一",fontSize:30,fontFamily:_,textFill:d(n),letterSpacing:2})],Gt)])}function Fb(){const e="#f1ede4",n="#2b2926",r="#b8322a",s="#6a655d";return we([fe("海报",d(e),[V("ellipse",652,984,210,210,d("#c4473a"),{name:"落日"}),$r("主图","/templates/art-ink-mountains.svg","雾里层层叠叠的远山",0,960,1080,960),V("rect",96,150,100,100,d(r),{name:"印章",cornerRadius:6,rotation:-3}),b("霜降",730,120,330,720,{name:"标题",fontSize:280,fontFamily:na,textFill:d(n),vertical:!0,lineHeight:1.1}),b("霜降水返壑 风落木归山",636,172,72,660,{name:"副标题",fontSize:36,fontFamily:X,textFill:d(n),vertical:!0,letterSpacing:10,lineHeight:1.2}),b("节气",92,166,108,68,{name:"印章文字",fontSize:40,fontFamily:na,textFill:d("#ffffff"),align:"center",rotation:-3,lineHeight:1.2}),Z(96,278,56,n,2,{name:"短线",cap:"butt"}),b("FROST'S DESCENT",96,300,480,40,{name:"英文",fontSize:24,fontFamily:X,textFill:d(s),letterSpacing:8}),b("10 月 23 日",96,352,500,84,{name:"信息一",fontSize:64,fontFamily:X,textFill:d(n),fontWeight:"bold"}),b(`二十四节气的第十八个,
|
|
440
|
+
秋天就到这里了。`,96,452,500,120,{name:"信息二",fontSize:32,fontFamily:X,textFill:d(s),lineHeight:1.75}),b("叮卡 · 节气日历",96,1800,600,48,{name:"品牌",fontSize:28,fontFamily:X,textFill:d(n),letterSpacing:6})],Gt)])}function Mb(){const e="#f3efe6",n="#151515",r="#5f594f",s="#d9442a",l=(o,c,f)=>{const h=64+o*328,g=ft[o];return[V("rect",h,1004,48,8,d(s),{name:`数字标记${g}`,cornerRadius:0}),b(f,h,1018,300,116,{name:`信息${g}`,fontSize:96,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:-2}),b(c,h,1136,300,44,{name:`标签${g}`,fontSize:28,fontFamily:_,textFill:d(r),letterSpacing:2})]};return we([fe("海报",d(e),[Z(64,136,952,n,3,{name:"刊头线",cap:"butt"}),Z(64,980,952,n,2,{name:"数字顶线",cap:"butt"}),Z(64,1220,952,n,2,{name:"数字底线",cap:"butt"}),Z(64,1800,952,n,3,{name:"页脚线",cap:"butt"}),b("ANNUAL REVIEW",64,72,560,48,{name:"刊头",fontSize:26,fontFamily:_,textFill:d("#ffffff"),fontWeight:"bold",letterSpacing:8,effect:{type:"background",color:n,amount:40,radius:0}}),b("2026",44,150,992,330,{name:"角标",fontSize:330,fontFamily:Xe,textFill:d(s),letterSpacing:-14,lineHeight:1}),b(`这一年,
|
|
441
|
+
做了多少事`,64,500,952,260,{name:"标题",fontSize:104,fontFamily:_,textFill:d(n),fontWeight:"bold",lineHeight:1.18}),b("一份写给自己的年度盘点",64,800,952,56,{name:"副标题",fontSize:36,fontFamily:_,textFill:d(r)}),...l(0,"发布作品","128"),...l(1,"累计读者","5.2万"),...l(2,"去过的城市","12"),tb("bar",["一月","二月","三月","四月","五月","六月"],[{name:"作品",values:[8,12,15,24,20,28],color:s}],64,1270,952,480,{name:"图表",showValues:!0,ink:n}),b("@叮卡工作室",64,1826,640,48,{name:"品牌",fontSize:28,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:2})],Gt)])}function Cb(){const e="#173a30",n="#f3ead8",r="#e7b649",s="#b9c6b6",l=(o,c,f)=>{const h=716+o*186,g=ft[o];return[V("ellipse",88,h+14,26,26,d(r),{name:`节点${g}`}),b(c,152,h,864,54,{name:`标签${g}`,fontSize:38,fontFamily:X,textFill:d(r),fontWeight:"bold",letterSpacing:2}),b(f,152,h+60,864,64,{name:`信息${g}`,fontSize:44,fontFamily:X,textFill:d(n)})]};return we([fe("海报",d(e),[Z(64,640,952,r,2,{name:"标题线",cap:"butt"}),va(101,740,1484,s,2,{name:"时间轴",cap:"butt",opacity:.5}),Z(64,1800,952,s,1.5,{name:"页脚线",cap:"butt",opacity:.6}),b("2026",52,96,976,270,{name:"角标",fontSize:260,fontFamily:Ft,textFill:d(r),lineHeight:1,letterSpacing:-6}),b("这一年,慢慢长大",64,390,952,130,{name:"标题",fontSize:96,fontFamily:X,textFill:d(n),fontWeight:"bold",letterSpacing:2}),b("五个节点,把一年的变化串起来",64,540,952,56,{name:"副标题",fontSize:36,fontFamily:X,textFill:d(s)}),...l(0,"1 月","立了个 flag:每周写一篇笔记"),...l(1,"3 月","第一篇破千赞,涨了 500 粉"),...l(2,"6 月","接到第一单商单合作"),...l(3,"9 月","粉丝破万,开始做系列内容"),...l(4,"12 月","工作室成立,全职做内容"),b("明年,把画画捡回来",64,1680,952,70,{name:"结论",fontSize:46,fontFamily:X,textFill:d(r),fontWeight:"bold"}),b("@叮卡成长记录",64,1826,640,48,{name:"品牌",fontSize:28,fontFamily:X,textFill:d(s),letterSpacing:2})],Gt)])}function Eb(){const e="#f6e4de",n="#b2394c",r="#3b2226",s="#73555a",l="#d4a243",o="#3f8f8a",c="#2c3a66",f="#e98a9a",h=[["rect",70,46,22,58,l,28],["ellipse",168,120,26,26,n,0],["rect",250,40,18,50,o,-24],["star",86,188,30,30,l,8],["rect",330,128,16,40,f,52],["ellipse",40,310,22,22,l,0],["rect",740,44,20,54,c,34],["ellipse",836,120,18,18,l,0],["rect",930,52,22,58,n,-30],["star",994,186,36,36,o,-10],["rect",990,300,16,44,l,18],["ellipse",690,150,14,14,f,0],["rect",80,940,20,54,o,-32],["star",190,992,34,34,l,14],["rect",40,820,16,40,n,40],["rect",880,960,22,56,l,24],["ellipse",990,880,26,26,n,0],["ellipse",780,1010,16,16,c,0]];return we([fe("贺卡",d(e),[...h.map(([g,x,m,j,k,v,w],N)=>V(g,x,m,j,k,d(v),{name:`彩纸${N+1}`,cornerRadius:g==="rect"?4:void 0,rotation:w})),b("Happy Birthday",40,160,1e3,220,{name:"英文标语",fontSize:156,fontFamily:Ys,textFill:d(n),align:"center",lineHeight:1.3}),b("生日快乐",90,412,900,130,{name:"标题",fontSize:92,fontFamily:X,textFill:d(r),fontWeight:"bold",align:"center",letterSpacing:28}),Z(476,578,128,l,3,{name:"分隔线",cap:"butt"}),b("亲爱的小满:",90,622,900,60,{name:"名字",fontSize:40,fontFamily:X,textFill:d(r),align:"center"}),b(`愿你一直保有好奇心,吃得好、睡得香,
|
|
442
|
+
把日子过成自己喜欢的样子。`,110,702,860,130,{name:"正文",fontSize:34,fontFamily:X,textFill:d(s),align:"center",lineHeight:1.75}),b("— 爱你的阿林",90,860,900,52,{name:"署名",fontSize:32,fontFamily:X,textFill:d(n),align:"center",letterSpacing:4})],Dr)])}function zb(){const e="#efe7d8",n="#d6432f",r="#2350a8",s="#f2b22e",l="#161616",o=(c,f,h,g)=>{const x=f===0?-de:0,m=h===0?-de:0,j=f===2?de:0,k=h===2?de:0;return V("rect",f*360+x,h*360+m,360-x+j,360-m+k,d(g),{name:c,cornerRadius:0})};return we([fe("封面",d(e),[o("黄块",2,0,s),Y("M 0 0 A 360 360 0 0 1 360 360 L 0 360 Z",720,0,360,360,{name:"四分之一圆",fill:d(l),strokeWidth:0}),o("蓝块",0,1,r),Y("M 0 360 A 180 180 0 0 1 360 360 Z",0,360,360,360,{name:"半圆",fill:d(e),strokeWidth:0}),Y("M 0 150 A 150 150 0 1 1 300 150 A 150 150 0 1 1 0 150 Z",390,390,300,300,{name:"红圆",fill:d(n),strokeWidth:0}),o("黑块",2,1,l),Y("M 360 0 A 360 360 0 0 0 0 360 L 360 360 Z",720,360,360,360,{name:"黄四分圆",fill:d(s),strokeWidth:0}),o("红块",0,2,n),Y("M 0 0 A 180 180 0 0 0 360 0 Z",0,720,360,360,{name:"黑半圆",fill:d(l),strokeWidth:0}),o("蓝底",2,2,r),V("ellipse",800,800,200,200,d(e),{name:"小圆"}),b(`一张图
|
|
443
|
+
改十遍`,56,48,640,216,{name:"标题",fontSize:96,fontFamily:Rx,textFill:d(l),lineHeight:1.12}),Z(60,266,96,l,6,{name:"标题线",cap:"butt"}),b("和林一聊聊设计里的耐心",60,286,640,48,{name:"副标题",fontSize:30,fontFamily:_,textFill:d(l),letterSpacing:2}),b("EP.12",384,742,320,110,{name:"角标",fontSize:92,fontFamily:Xe,textFill:d(l),letterSpacing:-2}),b("叮卡电台",388,960,300,52,{name:"品牌",fontSize:34,fontFamily:_,textFill:d(l),fontWeight:"bold",letterSpacing:6})],Dr)])}function Rb(){const e="#dfe3e8",n="#2b2e34",r="#4c515b",s=(l,o,c,f,h,g,x)=>V("ellipse",c,f,h,g,d(o),{name:l,filter:{blur:100},opacity:x});return we([fe("封面",d(e),[s("光斑一","#f8f9fb",-240,-320,1300,1e3),s("光斑二","#a9c4e8",960,240,1200,1e3),s("光斑三","#cec7ee",1220,-380,900,800,.9),s("光斑四","#ecdacd",80,640,1e3,760,.8),Z(96,136,1728,n,2,{name:"刊头线",cap:"butt"}),b("DINGCARD",96,70,700,48,{name:"品牌",fontSize:30,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:8}),b("汇报人 林一",1224,72,600,48,{name:"信息一",fontSize:30,fontFamily:_,textFill:d(r),align:"right",letterSpacing:2}),b("增长计划",76,330,1360,420,{name:"标题",fontSize:320,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:-12,lineHeight:1.2}),b(`商业计划书
|
|
444
|
+
Pitch Deck 2027`,1440,560,400,140,{name:"副标题",fontSize:40,fontFamily:_,textFill:d(r),lineHeight:1.4}),b("2027 年第一季度 · 内部分享",96,950,1e3,48,{name:"信息二",fontSize:30,fontFamily:_,textFill:d(r),letterSpacing:2})],Yn)])}function Ib(){const e="#efece6",n="#141414";return we([fe("封面",d(e),[Ca("主图","/templates/editorial-building.webp",-de,360,1080+de*2,1080+de,{filter:{grayscale:1,contrast:1.08}}),V("rect",866,-de,150,290+de,d("#b3191f"),{name:"红签",cornerRadius:0}),b("林一 LIN YI",64,72,700,48,{name:"品牌",fontSize:26,fontFamily:X,textFill:d(n),fontWeight:"bold",letterSpacing:6}),b("2026",866,64,150,56,{name:"角标",fontSize:38,fontFamily:Ft,textFill:d("#ffffff"),align:"center"}),b("PORTFOLIO",36,156,1010,230,{name:"英文标语",fontSize:172,fontFamily:Ft,textFill:d(n),letterSpacing:-2,lineHeight:1.2}),Z(64,1150,120,"#ffffff",4,{name:"标题线",cap:"butt"}),b("城市与光",64,1166,640,120,{name:"标题",fontSize:92,fontFamily:X,textFill:d("#ffffff"),fontWeight:"bold",letterSpacing:8}),b("建筑摄影 · 精选作品 36 幅",64,1294,640,48,{name:"副标题",fontSize:30,fontFamily:X,textFill:d("#ffffff"),letterSpacing:4})])])}function Lb(){const e="#fbf4e8",n="#3a2a1f",r="#6f4a30",s="#c4521a",l="#e6d6bd",o=(c,f,h)=>{const g=676+c*92,x=ft[c];return[Z(120,g+70,700,l,1.5,{name:`隔线${x}`,cap:"butt"}),b(f,120,g,520,60,{name:`菜品${x}`,fontSize:42,fontFamily:X,textFill:d(n),fontWeight:"bold",letterSpacing:2}),b(h,640,g,180,60,{name:`价格${x}`,fontSize:42,fontFamily:X,textFill:d(s),fontWeight:"bold",align:"right"})]};return we([fe("菜单",d(e),[$r("主图","/templates/art-flowers.svg","橙黄蓝三色的花和叶子",-48,-48,660,660),$r("花束","/templates/art-flowers.svg","橙黄蓝三色的花和叶子",820,1334,460,460,{rotation:180}),b("五月甜品",990,140,190,760,{name:"标题",fontSize:160,fontFamily:X,textFill:d(n),fontWeight:"bold",vertical:!0,letterSpacing:16,lineHeight:1.1}),b("Dessert Menu",680,420,520,100,{name:"英文标语",fontSize:76,fontFamily:Ys,textFill:d(s),rotation:90,align:"center"}),b("每日现烤 · 当季水果",120,600,700,48,{name:"副标题",fontSize:32,fontFamily:X,textFill:d(r),letterSpacing:6}),...o(0,"栗子蛋糕","38"),...o(1,"凤梨酥挞","32"),...o(2,"黑森林蛋糕","42"),...o(3,"草莓奶酪","36"),...o(4,"意式提拉米苏","40"),...o(5,"红莓松糕","28"),...o(6,"巧克力榛子","38"),...o(7,"焦糖布丁","26"),Y("M 0 10 Q 15 0 30 10 T 60 10 T 90 10 T 120 10 T 150 10",120,1410,150,20,{name:"波浪线",stroke:s,strokeWidth:3,cap:"round"}),b(`整只蛋糕请提前一天预订,
|
|
445
|
+
所有甜品都可以做小份。`,120,1452,640,110,{name:"正文",fontSize:30,fontFamily:X,textFill:d(r),lineHeight:1.7}),b("叮卡甜品店 · 每日 10:00 – 20:00",120,1620,680,48,{name:"品牌",fontSize:30,fontFamily:X,textFill:d(n),fontWeight:"bold",letterSpacing:2})],es)])}function $b(){const e="#f6f2ea",n="#55715e",r="#2f3a33",s="#5f6b63";return we([fe("请柬",d(e),[$r("主图","/templates/art-eucalyptus.svg","一圈尤加利叶环",30,110,1020,1020),Z(470,1476,140,"#b49a6c",2,{name:"分隔线",cap:"butt"}),V("rect",320,1620,440,104,{type:"transparent"},{name:"按钮底板",cornerRadius:52,stroke:n,strokeWidth:2}),b("Save the Date",140,440,800,170,{name:"英文标语",fontSize:118,fontFamily:Ys,textFill:d(n),align:"center",lineHeight:1.3}),b("林一 & 陈默",140,636,800,120,{name:"标题",fontSize:84,fontFamily:X,textFill:d(r),fontWeight:"bold",align:"center",letterSpacing:4}),b("我们结婚啦",140,780,800,64,{name:"副标题",fontSize:40,fontFamily:X,textFill:d(s),align:"center",letterSpacing:18}),b("2026.12.20",90,1160,900,120,{name:"信息一",fontSize:96,fontFamily:X,textFill:d(r),align:"center",letterSpacing:6}),b("星期日 · 下午五点二十分",90,1292,900,60,{name:"信息二",fontSize:40,fontFamily:X,textFill:d(s),align:"center",letterSpacing:4}),b("外滩源壹号 · 草坪",90,1366,900,64,{name:"信息三",fontSize:44,fontFamily:X,textFill:d(r),align:"center",letterSpacing:4}),b("期待与您一同见证这一天",90,1516,900,60,{name:"正文",fontSize:36,fontFamily:X,textFill:d(s),align:"center",letterSpacing:4}),b("敬请回复",320,1644,440,56,{name:"按钮文字",fontSize:34,fontFamily:X,textFill:d(n),align:"center",letterSpacing:12}),b("林家 · 陈家 敬邀",90,1800,900,52,{name:"品牌",fontSize:30,fontFamily:X,textFill:d(s),align:"center",letterSpacing:6})],Gt)])}function Db(){const e="#fbf1e2",n="#a83e26",r="#6f4127",s="#c45f23";return we([fe("海报",ir([[0,e],[1,"#f6e4cc"]],180),[$r("主图","/templates/art-autumn-leaves.svg","枫叶、银杏叶和落叶",0,-36,1080,440),$r("落叶","/templates/art-autumn-leaves.svg","枫叶、银杏叶和落叶",120,1132,840,342,{rotation:180}),Z(150,868,110,s,2,{name:"饰线左",cap:"butt"}),Z(820,868,110,s,2,{name:"饰线右",cap:"butt"}),V("diamond",250,862,14,14,d(s),{name:"菱形左"}),V("diamond",816,862,14,14,d(s),{name:"菱形右"}),b("Autumn Market",90,396,900,104,{name:"英文标语",fontSize:72,fontFamily:Ys,textFill:d(s),align:"center",lineHeight:1.3}),b("秋日市集",60,512,960,224,{name:"标题",fontSize:172,fontFamily:X,textFill:d(n),fontWeight:"bold",align:"center",letterSpacing:16}),b("带上朋友,来过一个慢慢的周末",90,742,900,56,{name:"副标题",fontSize:36,fontFamily:X,textFill:d(r),align:"center",letterSpacing:2}),b("手作 · 咖啡 · 旧书 · 音乐",260,838,560,64,{name:"正文",fontSize:40,fontFamily:X,textFill:d(s),fontWeight:"bold",align:"center",letterSpacing:2}),b("10 月 24 – 25 日 10:00 起",90,938,900,70,{name:"信息一",fontSize:50,fontFamily:X,textFill:d(r),fontWeight:"bold",align:"center"}),b("城南创意园 · 中央草坪",90,1020,900,56,{name:"信息二",fontSize:36,fontFamily:X,textFill:d("#85654f"),align:"center",letterSpacing:4}),b("叮卡生活节",90,1088,900,44,{name:"品牌",fontSize:26,fontFamily:X,textFill:d(r),fontWeight:"bold",align:"center",letterSpacing:10})])])}function Ab(e,n){const r=c=>Math.sqrt(Math.max(0,e*e-(c-e)**2)),s=(c,f)=>`${Math.round(c*10)/10} ${Math.round(f*10)/10}`,[l]=n,o=[`M ${s(e-r(l[0]),l[0])} A ${e} ${e} 0 1 1 ${s(e+r(l[0]),l[0])} Z`];return n.forEach(([c,f],h)=>{const g=c+f,x=h+1<n.length?n[h+1][0]:2*e;o.push(`M ${s(e-r(g),g)} A ${e} ${e} 0 0 0 ${s(e-r(x),x)} L ${s(e+r(x),x)} A ${e} ${e} 0 0 0 ${s(e+r(g),g)} Z`)}),o.join(" ")}function ot(e,n,r){return`M ${e-r} ${n} A ${r} ${r} 0 1 0 ${e+r} ${n} A ${r} ${r} 0 1 0 ${e-r} ${n} Z`}function Pb(){const e="#eeeae2",n="#171513";return we([fe("封面",d(e),[b("DING",40,36,1e3,320,{name:"刊名",fontSize:290,fontFamily:Ft,textFill:d(n),align:"center",letterSpacing:40,lineHeight:1.1}),Z(88,362,904,n,2,{name:"刊头线",cap:"butt"}),b("VOL.12",88,382,260,40,{name:"角标",fontSize:26,fontFamily:Ft,textFill:d(n),letterSpacing:4}),b("2026 秋季号 · 城市与生活",360,382,632,40,{name:"副标题",fontSize:26,fontFamily:_,textFill:d(n),align:"right",letterSpacing:4}),Ca("主图","/templates/editorial-building.webp",88,450,904,690),b("城市里的慢生活",88,1168,904,112,{name:"标题",fontSize:88,fontFamily:X,textFill:d(n),fontWeight:"bold",letterSpacing:6}),b("从一条街开始,重新认识你住了五年的地方",88,1290,904,48,{name:"正文",fontSize:32,fontFamily:X,textFill:d("#655f56"),letterSpacing:1}),Z(88,1352,904,n,1.5,{name:"页脚线",cap:"butt"}),b("建筑 · 旅行 · 生活方式",88,1366,600,40,{name:"品牌",fontSize:24,fontFamily:_,textFill:d(n),letterSpacing:6}),b("¥ 48",692,1366,300,40,{name:"信息一",fontSize:26,fontFamily:Ft,textFill:d(n),align:"right",fontWeight:"bold"})])])}function Tb(){const e="#f3eee4",n="#26221d",r="#6f675c",l={x:809,y:374,width:112,height:520},o=[{x:112,width:118,height:560,color:"#2f4b3d",text:"#f3ecdf",title:"慢慢来",note:"林夕 · 写给总在赶路的人"},{x:244,width:96,height:486,color:"#c4583a",text:"#fbf3e8",title:"去看海",note:"陈默 · 一个人的旅行散文"},{x:354,width:138,height:600,color:"#e7c46a",text:"#2a2620",title:"一个人的厨房",note:"苏禾 · 三十道一人食"},{x:506,width:104,height:470,color:"#3d5c8c",text:"#f3f0ea",title:"城市漫步",note:"周遥 · 走路看城市"},{x:624,width:124,height:540,color:"#2a2622",text:"#efe6d6",title:"夜晚的书",note:"许眠 · 失眠时读的短篇"}];return we([fe("书单",d(e),[V("rect",72,900,936,18,d("#8a6a4f"),{name:"书架",cornerRadius:2}),Z(72,932,936,"#d9cdb8",2,{name:"分隔线",cap:"butt"}),...o.flatMap((c,f)=>{const h=ft[f],g=900-c.height,x=(m,j)=>V("rect",c.x,m,c.width,8,d(c.text),{name:`书标${h}${j}`,opacity:.55});return[V("rect",c.x,g,c.width,c.height,d(c.color),{name:`书脊${h}`,cornerRadius:6}),x(g+40,""),x(844,"下"),b(c.title,c.x+(c.width-64)/2,g+76,64,c.height-160,{name:`书名${h}`,fontSize:40,fontFamily:X,textFill:d(c.text),fontWeight:"bold",vertical:!0,letterSpacing:8,lineHeight:1.1})]}),V("rect",l.x,l.y,l.width,l.height,d("#b49a74"),{name:"斜书",cornerRadius:6,rotation:-14}),...[l.y+40,l.y+l.height-56].map((c,f)=>{const h=R0({x:l.x,y:c,width:l.width,height:8},l,-14);return V("rect",h.x,h.y,l.width,8,d("#f3ecdf"),{name:f===0?"斜书标":"斜书标下",opacity:.55,rotation:-14})}),b("十月书单",64,72,952,150,{name:"标题",fontSize:120,fontFamily:X,textFill:d(n),fontWeight:"bold",letterSpacing:10}),b("这个月读完的五本书,每一本都想推荐给你",64,232,952,48,{name:"副标题",fontSize:32,fontFamily:_,textFill:d(r),letterSpacing:2}),...o.flatMap((c,f)=>{const h=ft[f],g=968+f*60;return[b(String(f+1).padStart(2,"0"),72,g,72,44,{name:`序号${h}`,fontSize:30,fontFamily:Ft,textFill:d(c.color==="#e7c46a"?"#a2781a":c.color),fontWeight:"bold"}),b(c.note,156,g,860,44,{name:`推荐${h}`,fontSize:30,fontFamily:_,textFill:d(n)})]}),b("@林一的书房",64,1328,952,44,{name:"品牌",fontSize:26,fontFamily:_,textFill:d(r),letterSpacing:4})])])}function Wb(){const e="#f4f1ea",n="#1b1917",r="#b8322a",s="#6a645b";return we([fe("海报",d(e),[b("2026 年度汉字",88,120,620,52,{name:"副标题",fontSize:34,fontFamily:X,textFill:d(n),fontWeight:"bold",letterSpacing:12}),b("Word of the Year",600,124,392,48,{name:"英文",fontSize:30,fontFamily:Ft,textFill:d(s),italic:!0,align:"right"}),Z(88,190,904,n,2,{name:"刊头线",cap:"butt"}),b("wěn",140,286,800,120,{name:"拼音",fontSize:92,fontFamily:Ft,textFill:d(s),italic:!0,align:"center"}),b("稳",90,400,900,840,{name:"标题",fontSize:800,fontFamily:na,textFill:d(n),align:"center",lineHeight:1.05}),V("rect",786,1250,120,120,d(r),{name:"印章",cornerRadius:8,rotation:-4}),b("年度",786,1270,120,80,{name:"印章文字",fontSize:50,fontFamily:na,textFill:d("#ffffff"),align:"center",rotation:-4,lineHeight:1.2}),b(`稳,是这一年最想对自己说的话。
|
|
446
|
+
不急,不慌,一步一步,把日子过稳。`,88,1410,904,150,{name:"正文",fontSize:40,fontFamily:X,textFill:d(n),align:"center",lineHeight:1.75}),Z(500,1610,80,r,3,{name:"短线",cap:"butt"}),b("你的年度汉字是哪一个?",88,1648,904,56,{name:"信息一",fontSize:34,fontFamily:X,textFill:d(s),align:"center",letterSpacing:4}),b("叮卡 · 年终特辑",88,1796,904,48,{name:"品牌",fontSize:28,fontFamily:X,textFill:d(n),align:"center",letterSpacing:8})],Gt)])}function Hb(){const e="#190a34",n="#ffffff",r="#ffd54a",s="#ff6fa8",l=[[380,10],[440,14],[492,18],[540,22],[586,26],[632,30]],o=(f,h,g)=>{const x=1508+f*64,m=ft[f];return[b(h,96,x+4,110,44,{name:`标签${m}`,fontSize:28,fontFamily:_,textFill:d(r),fontWeight:"bold",letterSpacing:4}),b(g,210,x,806,50,{name:`信息${m}`,fontSize:32,fontFamily:_,textFill:d(n)})]},c=[...[0,180,360,540,720,900,1080].map(f=>`M 540 0 L ${f} 220`),...[36,84,146,220].map(f=>`M 0 ${f} L 1080 ${f}`)].join(" ");return we([fe("海报",ir([[0,e],[1,"#2c0b4f"]],180),[Y(Ab(350,l),190,260,700,700,{name:"太阳",fill:ir([[0,"#ffe066"],[.55,"#ff8a5b"],[1,"#ff3d81"]],180),strokeWidth:0}),Z(48,954,984,s,4,{name:"地平线",cap:"butt"}),Y(c,0,960,1080,220,{name:"网格",stroke:s,strokeWidth:2,opacity:.55}),b("SOUND WAVE FESTIVAL",64,84,640,44,{name:"品牌",fontSize:26,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:6}),b("VOL.03",716,80,300,48,{name:"角标",fontSize:32,fontFamily:Xe,textFill:d(n),align:"right"}),b("LIVE MUSIC",40,1196,1e3,170,{name:"英文标语",fontSize:132,fontFamily:Xe,textFill:d(n),align:"center",letterSpacing:-2,lineHeight:1.15}),b("声浪音乐节",64,1366,952,112,{name:"标题",fontSize:84,fontFamily:_,textFill:d(n),fontWeight:"bold",align:"center",letterSpacing:14}),...o(0,"周六","落日飞行 · 海边的风 · 白日梦乐队"),...o(1,"周日","晚安星球 · 野草莓 · 城市漫游者"),...o(2,"地点","滨江公园大草坪 · 11 月 21 — 22 日"),V("rect",340,1724,400,96,d(n),{name:"按钮底板",cornerRadius:48}),b("立即购票",340,1746,400,52,{name:"按钮文字",fontSize:36,fontFamily:_,textFill:d(e),fontWeight:"bold",align:"center",letterSpacing:8})],Gt)])}function zf(e,n,r,s,l){const f=[];for(let h=r+l;h<e-r;h+=120)for(const g of[r,n-r-s])f.push(`M ${h} ${g} L ${h+30} ${g} L ${h+30-s} ${g+s} L ${h-s} ${g+s} Z`);for(let h=r+s+l;h<n-r-s;h+=120)for(const g of[r,e-r-s])f.push(`M ${g} ${h} L ${g+s} ${h-s} L ${g+s} ${h-s+30} L ${g} ${h+30} Z`);return f.join(" ")}function Ob(e,n,r,s,l,o){const c=(h,g)=>`M ${h-l} ${g} A ${l} ${l} 0 1 0 ${h+l} ${g} A ${l} ${l} 0 1 0 ${h-l} ${g} Z`,f=[];for(let h=e+o/2;h<e+r;h+=o)f.push(c(h,n),c(h,n+s));for(let h=n+o/2;h<n+s;h+=o)f.push(c(e,h),c(e+r,h));return f.join(" ")}function _b(){const e="#f7f1e4",n="#cf3b2e",r="#2a4f9e",s="#2b2724",l="#655d52",o="#d9cdb8",c={x:790,y:96,width:200,height:244};return we([fe("明信片",d(e),[Y(zf(1080,1440,22,22,0),0,0,1080,1440,{name:"航空边红",fill:d(n),strokeWidth:0}),Y(zf(1080,1440,22,22,60),0,0,1080,1440,{name:"航空边蓝",fill:d(r),strokeWidth:0}),...Array.from({length:6},(f,h)=>V("rect",88+h*54,98,44,44,{type:"transparent"},{name:`邮编框${ft[h]}`,stroke:n,strokeWidth:2.5,cornerRadius:2})),V("rect",c.x,c.y,c.width,c.height,d("#ffffff"),{name:"邮票",shadow:{color:"#d8ccb6",blur:12,offsetX:0,offsetY:4}}),Y(Ob(8,8,c.width,c.height,7,20),c.x-8,c.y-8,c.width+16,c.height+16,{name:"齿孔",fill:d(e),strokeWidth:0}),Ca("主图","/templates/grid-sunset.svg",c.x+16,c.y+16,c.width-32,c.height-72),b("80 分",c.x+16,c.y+c.height-50,c.width-32,36,{name:"面值",fontSize:24,fontFamily:_,textFill:d(s),fontWeight:"bold",align:"right"}),V("ellipse",616,248,196,196,{type:"transparent"},{name:"邮戳",stroke:s,strokeWidth:3,opacity:.6}),b(`厦门
|
|
447
|
+
2026.10.13`,616,300,196,96,{name:"邮戳文字",fontSize:26,fontFamily:_,textFill:d(s),fontWeight:"bold",align:"center",rotation:-10,opacity:.7,lineHeight:1.5}),Y("M 0 20 Q 30 0 60 20 T 120 20 T 180 20 M 0 50 Q 30 30 60 50 T 120 50 T 180 50 M 0 80 Q 30 60 60 80 T 120 80 T 180 80",430,300,180,100,{name:"邮戳波纹",stroke:s,strokeWidth:3,opacity:.45,cap:"round"}),b("POST CARD",88,172,640,84,{name:"英文标语",fontSize:64,fontFamily:Ft,textFill:d(s),letterSpacing:12,lineHeight:1.2}),b("Greetings from the sea",88,258,520,40,{name:"英文",fontSize:28,fontFamily:Ft,textFill:d(l),italic:!0}),b("来自海边的问候",88,400,904,92,{name:"标题",fontSize:68,fontFamily:ri,textFill:d(s),fontWeight:"bold",letterSpacing:6}),...Array.from({length:6},(f,h)=>Z(88,576+h*72-6,904,o,2,{name:`横线${ft[h]}`,cap:"butt"})),b(`这里的风是咸的,傍晚的海是粉色的。
|
|
448
448
|
住在看得见灯塔的小旅馆,每天早上被海鸥叫醒。
|
|
449
|
-
等你有空,我们一起来。`,88,516,904,430,{name:"正文",fontSize:40,fontFamily:
|
|
450
|
-
看设计怎样改变一座城市。`,64,1206,880,130,{name:"正文",fontSize:38,fontFamily:
|
|
449
|
+
等你有空,我们一起来。`,88,516,904,430,{name:"正文",fontSize:40,fontFamily:ri,textFill:d(s),lineHeight:1.8}),b("—— 林一,于厦门",492,960,500,56,{name:"署名",fontSize:36,fontFamily:ri,textFill:d(s),align:"right"}),Z(88,1060,904,o,2,{name:"分隔线",cap:"butt",dash:10}),b("TO",88,1100,120,64,{name:"收件",fontSize:48,fontFamily:Ft,textFill:d(n),italic:!0}),b("远方的你",210,1104,600,60,{name:"收件人",fontSize:44,fontFamily:ri,textFill:d(s),letterSpacing:4}),Z(210,1172,782,o,2,{name:"地址线一",cap:"butt"}),b("北京市东城区 · 胡同里的那扇红门",210,1196,782,52,{name:"信息一",fontSize:34,fontFamily:ri,textFill:d(l)}),Z(210,1258,782,o,2,{name:"地址线二",cap:"butt"})])])}function Bb(){const e="#f1f0eb",n="#111111",r="#e3352b",s="#55544f",l=(o,c,f)=>{const h=64+o*320,g=ft[o];return[Z(h,1474,292,n,3,{name:`栏线${g}`,cap:"butt"}),b(c,h,1494,292,40,{name:`标签${g}`,fontSize:26,fontFamily:_,textFill:d(r),fontWeight:"bold",letterSpacing:4}),b(f,h,1546,292,110,{name:`信息${g}`,fontSize:32,fontFamily:_,textFill:d(n),fontWeight:"bold",lineHeight:1.5})]};return we([fe("海报",d(e),[Y(ot(260,260,260),520,210,520,520,{name:"红圆",fill:d(r),strokeWidth:0}),b("26",30,120,1020,800,{name:"角标",fontSize:760,fontFamily:Xe,textFill:d(n),letterSpacing:-40,lineHeight:1.05}),b("DESIGN WEEK 2026",966,984,74,470,{name:"副标题",fontSize:38,fontFamily:_,textFill:d(n),fontWeight:"bold",vertical:!0,letterSpacing:4,lineHeight:1.2}),Z(64,944,952,n,6,{name:"刊头线",cap:"butt"}),b("城市设计周",64,984,880,150,{name:"标题",fontSize:124,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:6}),Z(64,1160,96,r,8,{name:"标题线",cap:"butt"}),b(`三十场展览、四十场讲座,
|
|
450
|
+
看设计怎样改变一座城市。`,64,1206,880,130,{name:"正文",fontSize:38,fontFamily:_,textFill:d(s),lineHeight:1.6}),...l(0,"时间",`11.18 — 11.24
|
|
451
451
|
10:00 — 20:00`),...l(1,"地点",`西岸艺术中心
|
|
452
452
|
徐汇区龙腾大道`),...l(2,"票价",`免费预约
|
|
453
|
-
现场 50 元`),Z(64,1786,952,n,2,{name:"页脚线",cap:"butt"}),b("主办:城市设计研究所",64,1808,700,48,{name:"品牌",fontSize:28,fontFamily:
|
|
454
|
-
CHRISTMAS`,88,516,904,258,{name:"英文标语",fontSize:112,fontFamily:
|
|
455
|
-
也有想见的人。`,88,992,904,120,{name:"正文",fontSize:34,fontFamily:
|
|
456
|
-
心里有光,身边有人。`,88,1290,904,144,{name:"正文",fontSize:38,fontFamily:X,textFill:d(s),align:"center",lineHeight:1.8}),...o(0,"除夕","2 月 5 日 · 周五"),...o(1,"春节","2 月 6 日 · 周六"),b("叮卡 敬贺",88,1744,904,52,{name:"品牌",fontSize:34,fontFamily:X,textFill:d(s),align:"center",letterSpacing:10})],Gt)])}const
|
|
457
|
-
排版习惯`,796,214,908,270,{name:"标题",fontSize:96,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.3,letterSpacing:2,verticalAlign:"middle"}),Z(800,512,88,n,6,{name:"标题线",cap:"butt"}),b("从字号、行距到留白,一次讲清",800,548,904,56,{name:"副标题",fontSize:36,fontFamily:
|
|
458
|
-
住三天`,90,150,900,260,{name:"标题",fontSize:100,fontFamily:X,textFill:d(e),fontWeight:"bold",lineHeight:1.25,letterSpacing:4,verticalAlign:"middle"}),b("一个人的徒步与慢生活",96,426,800,52,{name:"副标题",fontSize:34,fontFamily:
|
|
459
|
-
设计工具`,110,386,1100,360,{name:"标题",fontSize:150,fontFamily:
|
|
460
|
-
智能峰会`,88,352,480,304,{name:"标题",fontSize:104,fontFamily:
|
|
461
|
-
上海西岸艺术中心 B 馆`,96,684,460,110,{name:"正文",fontSize:32,fontFamily:
|
|
462
|
-
超过 4 小时`,88,694,904,170,{name:"标题",fontSize:60,fontFamily:
|
|
463
|
-
适合刚开始喝咖啡`,88,712,330,120,{name:"信息一",fontSize:34,fontFamily:
|
|
464
|
-
热量几乎为零`,576,1132,416,118,{name:"信息二",fontSize:34,fontFamily:
|
|
465
|
-
早起计划`,84,150,912,300,{name:"标题",fontSize:120,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.2,letterSpacing:2}),b("每天 6:30 起床,做一件喜欢的事",88,462,904,52,{name:"副标题",fontSize:36,fontFamily:
|
|
466
|
-
喜欢钻纸箱?`,84,880,912,260,{name:"标题",fontSize:100,fontFamily:
|
|
467
|
-
四日慢游`,84,84,760,336,{name:"标题",fontSize:120,fontFamily:X,textFill:d(r),fontWeight:"bold",lineHeight:1.2,letterSpacing:4,verticalAlign:"bottom"}),b("跟着这条线走,景点不绕路",88,432,904,52,{name:"副标题",fontSize:34,fontFamily:
|
|
468
|
-
TOP 5`,84,150,912,320,{name:"标题",fontSize:130,fontFamily:
|
|
469
|
-
城西万象城一层 108 号`,88,1372,904,120,{name:"正文",fontSize:34,fontFamily:
|
|
470
|
-
直播专场`,88,590,904,370,{name:"标题",fontSize:140,fontFamily:
|
|
471
|
-
歌单`,132,268,472,340,{name:"标题",fontSize:120,fontFamily:X,textFill:d(s),fontWeight:"bold",lineHeight:1.15}),Z(136,630,64,l,4,{name:"封套线",cap:"butt"}),b("十二首适合一个人听的歌",136,650,464,40,{name:"副标题",fontSize:28,fontFamily:
|
|
472
|
-
从一碗面开始`,80,296,1100,220,{name:"标题",fontSize:80,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.25}),b("我们在凌晨的街头,吃遍了还亮着灯的面馆",80,532,1100,50,{name:"副标题",fontSize:32,fontFamily:
|
|
473
|
-
有个地方坐一会儿。`,680,210,1040,210,{name:"标题",fontSize:64,fontFamily:X,textFill:d(s),fontWeight:"bold",lineHeight:1.4}),Z(680,452,72,n,4,{name:"短线",cap:"butt"}),b("对话 阿澄 · 独立书店「慢读」店主",680,484,1040,50,{name:"副标题",fontSize:34,fontFamily:
|
|
453
|
+
现场 50 元`),Z(64,1786,952,n,2,{name:"页脚线",cap:"butt"}),b("主办:城市设计研究所",64,1808,700,48,{name:"品牌",fontSize:28,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:2}),b("No.07",716,1808,300,48,{name:"编号",fontSize:30,fontFamily:Xe,textFill:d(n),align:"right"})],Gt)])}function Kb(e,n,r,s,l){return[`M ${l} 0 L ${e-l} 0 Q ${e} 0 ${e} ${l}`,`L ${e} ${r-s} A ${s} ${s} 0 0 0 ${e} ${r+s}`,`L ${e} ${n-l} Q ${e} ${n} ${e-l} ${n}`,`L ${l} ${n} Q 0 ${n} 0 ${n-l}`,`L 0 ${r+s} A ${s} ${s} 0 0 0 0 ${r-s}`,`L 0 ${l} Q 0 0 ${l} 0 Z`].join(" ")}function Vb(){const e="#c8102e",n="#8f0a20",r="#fff4e1",s="#ffe27a",l={x:88,y:196,width:904,height:720,tear:520},o=(c,f,h)=>{const g=1334+c*136,x=ft[c];return[b(f,88,g,904,44,{name:`标签${x}`,fontSize:30,fontFamily:_,textFill:d(s),fontWeight:"bold",align:"center",letterSpacing:8}),b(h,88,g+50,904,60,{name:`信息${x}`,fontSize:42,fontFamily:_,textFill:d(r),align:"center"})]};return we([fe("海报",ir([[0,"#d81b33"],[1,"#a50c25"]],180),[Y(Kb(l.width,l.height,l.tear,40,28),l.x,l.y,l.width,l.height,{name:"优惠券",fill:d(r),strokeWidth:0,shadow:{color:"#6e0716",blur:40,offsetX:0,offsetY:16}}),Z(l.x+64,l.y+l.tear-6,l.width-128,e,4,{name:"撕线",dash:14,cap:"butt",opacity:.6}),b("DOUBLE ELEVEN",l.x,l.y+64,l.width,48,{name:"英文标语",fontSize:32,fontFamily:Xe,textFill:d(e),align:"center",letterSpacing:14}),b("11.11",l.x+14,l.y+166,l.width-48,290,{name:"大字",fontSize:256,fontFamily:Xe,textFill:d(e),align:"center",letterSpacing:-4,lineHeight:1.05,effect:{type:"extrude",color:n,amount:60,angle:45}}),b("COUPON",l.x+72,l.y+l.tear+64,400,72,{name:"券名",fontSize:52,fontFamily:Xe,textFill:d(e),letterSpacing:6}),b("¥50",l.x+452,l.y+l.tear+40,380,120,{name:"券额",fontSize:96,fontFamily:_,textFill:d(e),fontWeight:"bold",align:"right"}),b("叮卡生活馆 · 官方旗舰店",88,96,904,48,{name:"品牌",fontSize:30,fontFamily:_,textFill:d(r),fontWeight:"bold",align:"center",letterSpacing:6}),b("年终好价节",88,868,904,320,{name:"标题",fontSize:132,fontFamily:_,textFill:d(r),fontWeight:"bold",align:"center",letterSpacing:12,lineHeight:1.15,verticalAlign:"bottom"}),b("跨店每满 300 减 50 · 全场包邮",88,1208,904,64,{name:"副标题",fontSize:44,fontFamily:_,textFill:d(s),fontWeight:"bold",align:"center",letterSpacing:2}),...o(0,"活动时间","11 月 1 日 — 11 月 11 日"),...o(1,"参与方式","线上旗舰店 · 全国门店同享"),V("rect",320,1658,440,104,d(s),{name:"按钮底板",cornerRadius:52}),b("立即抢购",320,1682,440,56,{name:"按钮文字",fontSize:40,fontFamily:_,textFill:d(e),fontWeight:"bold",align:"center",letterSpacing:10})],Gt)])}function Gb(e,n){const r=n/2,s=Math.round(n*.28),l=Math.round(n*.72),o=[];return e.forEach((c,f)=>{for(let h=0;h<c.length;h+=1){if(c[h]!=="#")continue;const g=h*n,x=f*n;o.push(`M ${g} ${x} L ${g+r} ${x+s} L ${g+n} ${x} L ${g+n} ${x+l} L ${g+r} ${x+n} L ${g} ${x+l} Z`)}}),o.join(" ")}function Ub(e,n,r){return Array.from({length:n},(s,l)=>Array.from({length:e},(o,c)=>r(c,l)?"#":".").join(""))}const Yb=["....#....",".#..#..#.","..#.#.#..","...###...","#########","...###...","..#.#.#..",".#..#..#.","....#...."],Zb=["....#....","...###...","..#####..","...###...","..#####..",".#######.","#########","....#....","....#...."];function Xb(){const e="#b3202a",n="#1f5a3d",r="#164530",s="#f7efe2",c=(j,k)=>{const v=[6,18,30,42,54].find(N=>Math.abs(j-N)<=4);return v===void 0?!1:(v===18||v===42?Zb:Yb)[k][j-v+4]==="#"},f=(j,k)=>k===1?j%2===1:j%4===(k===0?0:2),h=Ub(61,21,(j,k)=>k===1?j%4===2:k>=3&&k<=5?f(j,k-3):k>=7&&k<=15?c(j,k-7):k>=17&&k<=19?f(j,19-k):!1),g=21*18,x=1308,m=Array.from({length:61},(j,k)=>`M ${k*18+5} 0 L ${k*18+13} 0 L ${k*18+13} ${1440+de-x} L ${k*18+5} ${1440+de-x} Z`).join(" ");return we([fe("贺卡",d(e),[V("rect",-de,-de,1080+de*2,g+de,d(n),{name:"领口"}),Y(Gb(h,18),-18/2,0,61*18,g,{name:"领口花样",fill:d(s),strokeWidth:0}),V("rect",-de,x,1080+de*2,1440+de-x,d(n),{name:"下摆"}),Y(m,-18/2,x,61*18,1440+de-x,{name:"罗纹",fill:d(r),strokeWidth:0}),b("致 亲爱的你",88,444,904,48,{name:"名字",fontSize:34,fontFamily:_,textFill:d(s),align:"center",letterSpacing:6}),b(`MERRY
|
|
454
|
+
CHRISTMAS`,88,516,904,258,{name:"英文标语",fontSize:112,fontFamily:Xe,textFill:d(s),align:"center",letterSpacing:6,lineHeight:1.1}),b("圣诞快乐",88,788,904,160,{name:"标题",fontSize:84,fontFamily:_,textFill:d(s),fontWeight:"bold",align:"center",letterSpacing:20,lineHeight:1.2,verticalAlign:"middle"}),Z(500,962,80,s,3,{name:"分隔线",cap:"butt"}),b(`愿你今晚有热可可、有礼物,
|
|
455
|
+
也有想见的人。`,88,992,904,120,{name:"正文",fontSize:34,fontFamily:_,textFill:d(s),align:"center",lineHeight:1.7}),b("12 月 24 日 · 平安夜",88,1136,904,44,{name:"信息一",fontSize:30,fontFamily:_,textFill:d(s),align:"center",letterSpacing:4}),b("—— 叮卡 敬上",88,1196,904,48,{name:"署名",fontSize:32,fontFamily:_,textFill:d(s),fontWeight:"bold",align:"center",letterSpacing:4})])])}function qb(e,n,r){const s=[.4,.9,.2,.7,.5,1,.3,.8,.1,.6,.9,.4,.7,.2,1,.5,.8,.3,.6,.9,.2,.7,.4,1,.6,.3,.8,.5],l=e/(s.length-1),o=s.map((c,f)=>`L ${Math.round(f*l)} ${Math.round(n-r+c*r)}`).reverse();return`M 0 0 L ${e} 0 ${o.join(" ")} Z`}function Qb(){const e="#1d2a47",n="#fbf6ea",r="#c93a2e",s="#2a2622",l="#6e665b",o={x:160,y:172,width:760,height:1080},c={x:216,width:648},f=(h,g,x,m)=>{const j=1066+h*66,k=ft[h];return[V("rect",c.x,j,48,48,d(m),{name:`标签底${k}`,cornerRadius:6}),b(g,c.x,j+2,48,44,{name:`标签${k}`,fontSize:30,fontFamily:X,textFill:d(n),fontWeight:"bold",align:"center"}),b(x,c.x+72,j-2,c.width-72,52,{name:`信息${k}`,fontSize:36,fontFamily:X,textFill:d(s),letterSpacing:4})]};return we([fe("日历",d(e),[V("rect",o.x+12,o.y+o.height-10,o.width-24,28,d("#d6ccb6"),{name:"页厚二",cornerRadius:4}),V("rect",o.x+6,o.y+o.height-10,o.width-12,20,d("#e9e1cf"),{name:"页厚一",cornerRadius:4}),V("rect",o.x,o.y,o.width,o.height,d(n),{name:"日历页",cornerRadius:6,shadow:{color:"#0b1222",blur:36,offsetX:0,offsetY:18}}),Y(qb(o.width,64,22),o.x,192,o.width,64,{name:"撕痕",fill:d("#eee5d2"),strokeWidth:0,shadow:{color:"#d3c8b1",blur:3,offsetX:0,offsetY:2}}),V("rect",o.x,96,o.width,96,d(r),{name:"日历头",cornerRadius:16}),V("ellipse",300,133,22,22,d(e),{name:"挂孔一"}),V("ellipse",758,133,22,22,d(e),{name:"挂孔二"}),b("2027",o.x,116,o.width,56,{name:"年份",fontSize:40,fontFamily:Ft,textFill:d(n),fontWeight:"bold",align:"center",letterSpacing:10}),b("JANUARY",c.x,280,360,48,{name:"月份",fontSize:34,fontFamily:Ft,textFill:d(r),letterSpacing:8}),b("一月",c.x+c.width-200,280,200,48,{name:"月份中文",fontSize:34,fontFamily:X,textFill:d(r),fontWeight:"bold",align:"right",letterSpacing:6}),Z(c.x,338,c.width,s,2,{name:"刊头线",cap:"butt"}),b("1",c.x,336,c.width,470,{name:"日期",fontSize:510,fontFamily:X,textFill:d(r),fontWeight:"bold",align:"center",lineHeight:.9}),b("元旦 · 星期五",c.x,818,c.width,56,{name:"副标题",fontSize:40,fontFamily:X,textFill:d(l),align:"center",letterSpacing:8}),b("你好,2027",c.x,888,c.width,160,{name:"标题",fontSize:80,fontFamily:X,textFill:d(s),fontWeight:"bold",align:"center",letterSpacing:4,lineHeight:1.2,verticalAlign:"middle"}),...f(0,"宜","重新开始 早睡早起",r),...f(1,"忌","回头看 熬夜",s),b("叮卡 · 新年快乐",88,1318,904,48,{name:"品牌",fontSize:30,fontFamily:X,textFill:d(n),align:"center",letterSpacing:8})])])}function Jb(){const e="#b90f27",n="#a00b22",r="#efc66b",s="#f8e5b5",l="#e6b85a",o=(g,x,m)=>{const j=1468+g*122,k=ft[g];return[b(x,140,j,800,44,{name:`标签${k}`,fontSize:30,fontFamily:X,textFill:d(s),align:"center",letterSpacing:10}),b(m,140,j+46,800,64,{name:`信息${k}`,fontSize:44,fontFamily:X,textFill:d(s),fontWeight:"bold",align:"center"})]},c={x:-de,y:-de,width:1080+de*2,height:680},f=436,h=`M 0 0 L ${c.width} 0 L ${c.width} ${f} Q ${c.width/2} 916 0 ${f} Z`;return we([fe("红包",d(e),[V("rect",56,56,968,1808,{type:"transparent"},{name:"金框",stroke:r,strokeWidth:2,cornerRadius:0}),Y(h,c.x,c.y,c.width,c.height,{name:"封口",fill:d(n),stroke:r,strokeWidth:4,shadow:{color:"#6b0715",blur:30,offsetX:0,offsetY:10}}),Y(ot(118,118,118),422,542,236,236,{name:"圆章",fill:d(l),strokeWidth:0,shadow:{color:"#6b0715",blur:16,offsetX:0,offsetY:6}}),Y(ot(100,100,100),440,560,200,200,{name:"圆章内圈",stroke:"#b3862f",strokeWidth:3}),b("福",422,566,236,188,{name:"福字",fontSize:150,fontFamily:na,textFill:d(n),align:"center",lineHeight:1.2}),b("新春快乐",88,806,904,336,{name:"标题",fontSize:200,fontFamily:na,textFill:d(r),align:"center",letterSpacing:16,lineHeight:1.1,verticalAlign:"middle"}),b("丁未羊年 · 万事顺意",88,1150,904,70,{name:"副标题",fontSize:48,fontFamily:X,textFill:d(r),align:"center",letterSpacing:10}),Z(392,1246,120,r,2,{name:"饰线左",cap:"butt"}),Z(568,1246,120,r,2,{name:"饰线右",cap:"butt"}),V("rect",530,1242,20,20,d(r),{name:"菱形",cornerRadius:0,rotation:45}),b(`愿新的一年,日子有盼头,
|
|
456
|
+
心里有光,身边有人。`,88,1290,904,144,{name:"正文",fontSize:38,fontFamily:X,textFill:d(s),align:"center",lineHeight:1.8}),...o(0,"除夕","2 月 5 日 · 周五"),...o(1,"春节","2 月 6 日 · 周六"),b("叮卡 敬贺",88,1744,904,52,{name:"品牌",fontSize:34,fontFamily:X,textFill:d(s),align:"center",letterSpacing:10})],Gt)])}const Fe=e=>Math.round(e*10)/10;function yd(e,n){const r=o=>n?e[(o+e.length)%e.length]:e[Math.min(e.length-1,Math.max(0,o))],s=[`M ${Fe(e[0][0])} ${Fe(e[0][1])}`],l=n?e.length:e.length-1;for(let o=0;o<l;o+=1){const[c,f,h,g]=[r(o-1),r(o),r(o+1),r(o+2)];s.push(`C ${Fe(f[0]+(h[0]-c[0])/6)} ${Fe(f[1]+(h[1]-c[1])/6)} ${Fe(h[0]-(g[0]-f[0])/6)} ${Fe(h[1]-(g[1]-f[1])/6)} ${Fe(h[0])} ${Fe(h[1])}`)}return s.join(" ")+(n?" Z":"")}function I0(e,n){const r=e[0],s=e[e.length-1];return`${yd(e,!1)} L ${s[0]} ${n} L ${r[0]} ${n} Z`}function ey(e,n,r,s,l,o,c,f){const h=Array.from({length:s},(F,I)=>Array.from({length:28},(M,z)=>{const A=z/28*Math.PI*2,T=(I+1)*l,L=1+.09*Math.sin(A*3+(I+1)*.42)+.05*Math.sin(A*5-(I+1)*.7)+.03*Math.sin(A*2+I+1);return[n+Math.cos(A)*T*L*o,r+Math.sin(A)*T*L]})),g=l,x=h.flat().map(([F])=>F),m=h.flat().map(([,F])=>F),j=Math.floor(Math.min(...x)-g),k=Math.floor(Math.min(...m)-g),v=Math.ceil(Math.max(...x)+g)-j,w=Math.ceil(Math.max(...m)+g)-k,N=h.map(F=>yd(F.map(([I,M])=>[I-j,M-k]),!0)).join(" ");return Y(N,j,k,v,w,{name:e,stroke:c,strokeWidth:2,opacity:f})}function Uc(e,n,r,s,l,o){const c=[];for(let f=0;f<l;f+=1){if(!o(f))continue;const h=f/l*Math.PI*2-Math.PI/2,[g,x]=[Math.cos(h),Math.sin(h)];c.push(`M ${Fe(e+g*r)} ${Fe(n+x*r)} L ${Fe(e+g*(r-s))} ${Fe(n+x*(r-s))}`)}return c.join(" ")}function Rf(e,n,r,s,l,o,c,f=1/0,h=1/0){return Array.from({length:c},(g,x)=>{const m=(l+(o-l)*x/(c-1))*Math.PI/180,[j,k]=[Math.cos(m),Math.sin(m)],v=[j>0?(f-e)/j:j<0?-e/j:1/0,k>0?(h-n)/k:k<0?-n/k:1/0],w=Math.min(s,...v);return`M ${Fe(e+j*r)} ${Fe(n+k*r)} L ${Fe(e+j*w)} ${Fe(n+k*w)}`}).join(" ")}function ty(){const e="#f3efe7",n="#1b1a18",r="#c0341d";return we([fe("首图",d(e),[V("rect",-de,-de,720+de,766+de*2,d(r),{name:"色块",cornerRadius:0}),Y(ot(300,300,300),60,83,600,600,{name:"圆环",stroke:e,strokeWidth:3,opacity:.45}),b("Nº",72,40,200,76,{name:"编号",fontSize:64,fontFamily:Ft,textFill:d(e),italic:!0}),b("07",24,120,672,560,{name:"角标",fontSize:460,fontFamily:Xe,textFill:d(e),align:"center",letterSpacing:-12,lineHeight:1.1}),b("叮卡排版课 · 第 38 期",800,150,904,40,{name:"品牌",fontSize:26,fontFamily:_,textFill:d(r),fontWeight:"bold",letterSpacing:4}),b(`让文章更好读的
|
|
457
|
+
排版习惯`,796,214,908,270,{name:"标题",fontSize:96,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.3,letterSpacing:2,verticalAlign:"middle"}),Z(800,512,88,n,6,{name:"标题线",cap:"butt"}),b("从字号、行距到留白,一次讲清",800,548,904,56,{name:"副标题",fontSize:36,fontFamily:_,textFill:d("#635e56"),letterSpacing:1})],Zs)])}function ny(){const e="#1d3640",n="#355d6b",r=766+de,s=(o,c,f)=>Y(I0(f.map(([h,g])=>[h+de,g]),r),-de,0,1800+de*2,r,{name:o,fill:d(c),strokeWidth:0}),l=(o,c,f,h)=>Y(`M 2 ${Fe(h*.42)} Q ${Fe(h*.26)} 2 ${Fe(h*.5)} ${Fe(h*.42)} Q ${Fe(h*.74)} 2 ${h-2} ${Fe(h*.42)}`,c,f,h,Math.round(h*.5),{name:o,stroke:e,strokeWidth:2.5,cap:"round",join:"round",opacity:.7});return we([fe("首图",ir([[0,"#dbe5e8"],[.6,"#f0e3d6"],[1,"#f5d9c3"]],180),[V("ellipse",1060,110,540,440,d("#f9d3b2"),{name:"霞光",filter:{blur:80},opacity:.65}),Y(ot(64,64,64),1256,266,128,128,{name:"太阳",fill:d("#efa678"),strokeWidth:0}),l("飞鸟一",1096,214,44),l("飞鸟二",1156,246,30),s("远山一","#c4d2d6",[[-16,520],[180,506],[380,520],[560,492],[760,470],[940,430],[1100,380],[1230,332],[1330,302],[1430,322],[1540,292],[1660,318],[1816,340]]),s("远山二","#9fb7bf",[[-16,574],[220,560],[460,574],[700,548],[900,520],[1080,470],[1220,440],[1360,452],[1500,410],[1650,432],[1816,418]]),V("rect",-de,540,1800+de*2,64,d("#eef1f0"),{name:"山雾",filter:{blur:30},opacity:.45,cornerRadius:0}),s("远山三","#73949f",[[-16,624],[300,610],[580,630],[860,596],[1120,566],[1340,544],[1560,560],[1816,536]]),s("远山四","#46697a",[[-16,674],[340,656],[700,680],[1040,652],[1340,628],[1600,650],[1816,624]]),s("远山五","#20404d",[[-16,716],[420,700],[860,722],[1260,700],[1560,714],[1816,690]]),b("旅行笔记",96,96,400,40,{name:"角标",fontSize:26,fontFamily:_,textFill:d(e),fontWeight:"bold",letterSpacing:6}),b("叮卡周刊",1404,96,300,40,{name:"品牌",fontSize:26,fontFamily:_,textFill:d(e),fontWeight:"bold",align:"right",letterSpacing:6}),b(`去山里
|
|
458
|
+
住三天`,90,150,900,260,{name:"标题",fontSize:100,fontFamily:X,textFill:d(e),fontWeight:"bold",lineHeight:1.25,letterSpacing:4,verticalAlign:"middle"}),b("一个人的徒步与慢生活",96,426,800,52,{name:"副标题",fontSize:34,fontFamily:_,textFill:d(n),letterSpacing:2})],Zs)])}function ry(){const e="#0a0e1c",n="#f4f6ff",r="#9aa3c2",s="#d4ff3a",l="#33416e",[o,c]=[1440,540],f=(x,m,j,k,v,w,N)=>V("ellipse",o-m,c-j,m*2,j*2,{type:"transparent"},{name:x,stroke:v,strokeWidth:w,rotation:k,opacity:N}),h=(x,m,j,k,v,w,N)=>{const[F,I]=[v*Math.PI/180,k*Math.PI/180],M=o+m*Math.cos(F)*Math.cos(I)-j*Math.sin(F)*Math.sin(I),z=c+m*Math.cos(F)*Math.sin(I)+j*Math.sin(F)*Math.cos(I);return Y(ot(w/2,w/2,w/2),Fe(M-w/2),Fe(z-w/2),w,w,{name:x,fill:d(N),strokeWidth:0})},g=(x,m,j)=>{const k=120+x*420,v=ft[x];return[b(m,k,852,380,40,{name:`标签${v}`,fontSize:26,fontFamily:_,textFill:d(r),letterSpacing:6}),b(j,k,896,400,56,{name:`信息${v}`,fontSize:38,fontFamily:_,textFill:d(n),fontWeight:"bold"})]};return we([fe("主视觉",d(e),[V("ellipse",900,0,1100,1080,d("#2c4bff"),{name:"光晕",filter:{blur:100},opacity:.4}),f("轨道一",560,560,0,l,2),f("轨道二",420,420,0,l,2),f("轨道三",300,300,0,l,1.5),f("轨道四",620,210,-18,s,2.5,.85),f("轨道五",520,160,28,"#7f8fd6",2,.7),Y(ot(150,150,150),o-150,c-150,300,300,{name:"核心",fill:{type:"radial-gradient",stops:[{offset:0,color:"#f4ffc2"},{offset:.55,color:"#cdf53e"},{offset:1,color:"#2fbfa4"}]},strokeWidth:0,shadow:{color:"#b8f03a",blur:90,offsetX:0,offsetY:0}}),h("卫星一",620,210,-18,110,22,s),h("卫星二",520,160,28,24,16,n),h("卫星三",420,420,0,300,12,"#7f8fd6"),b("DINGCARD SUMMIT",120,96,800,44,{name:"品牌",fontSize:28,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:8}),b("2026",1500,92,300,52,{name:"角标",fontSize:40,fontFamily:Xe,textFill:d(s),align:"right"}),b("第五届 · 设计与智能大会",120,318,1e3,56,{name:"副标题",fontSize:38,fontFamily:_,textFill:d(s),letterSpacing:4}),b(`未来的
|
|
459
|
+
设计工具`,110,386,1100,360,{name:"标题",fontSize:150,fontFamily:_,textFill:d(n),fontWeight:"bold",lineHeight:1.15,letterSpacing:2,verticalAlign:"middle"}),Z(120,790,96,s,6,{name:"标题线",cap:"butt"}),...g(0,"时间","11 月 18 — 19 日"),...g(1,"地点","上海西岸艺术中心")],Yn)])}function ay(){const e="#0d0b08",n="#d4b06a",r="#f2e4c2",s=ir([[0,"#b8924f"],[.5,"#f6dfa4"],[1,"#b8924f"]],90),l=(c,f,h,g,x)=>{const m=k=>g?64-k:k,j=k=>x?64-k:k;return Y(`M ${m(0)} ${j(64)} L ${m(0)} ${j(0)} L ${m(64)} ${j(0)} M ${m(16)} ${j(64)} L ${m(16)} ${j(16)} L ${m(64)} ${j(16)}`,f,h,64,64,{name:c,stroke:n,strokeWidth:3,cap:"butt",join:"miter"})},o=(c,f,h)=>{const g=400+c*640,x=ft[c];return[b(f,g,808,480,40,{name:`标签${x}`,fontSize:26,fontFamily:X,textFill:d(n),align:"center",letterSpacing:10}),b(h,g,852,480,56,{name:`信息${x}`,fontSize:38,fontFamily:X,textFill:d(r),fontWeight:"bold",align:"center",letterSpacing:2})]};return we([fe("主视觉",d(e),[Y(Rf(960,1140,380,1600,-170,-10,41,1920,1080),0,0,1920,1080,{name:"光芒",stroke:n,strokeWidth:2,opacity:.13}),V("rect",56,56,1808,968,{type:"transparent"},{name:"外框",stroke:n,strokeWidth:3,cornerRadius:0}),V("rect",76,76,1768,928,{type:"transparent"},{name:"内框",stroke:n,strokeWidth:1.5,cornerRadius:0,opacity:.7}),l("角饰一",92,92,!1,!1),l("角饰二",1764,92,!0,!1),l("角饰三",92,924,!1,!0),l("角饰四",1764,924,!0,!0),Y(`M 4 104 A 96 96 0 0 1 196 104 ${Rf(100,104,30,84,-180,0,13)}`,860,112,200,108,{name:"扇饰",stroke:n,strokeWidth:2.5,cap:"butt"}),b("2027",560,228,800,110,{name:"角标",fontSize:88,fontFamily:Ft,textFill:d(n),align:"center",letterSpacing:30}),b("年会盛典",160,348,1600,320,{name:"标题",fontSize:180,fontFamily:X,textFill:s,fontWeight:"bold",align:"center",letterSpacing:40,lineHeight:1.15,verticalAlign:"middle"}),b("同心致远 · 感谢每一位同行者",160,676,1600,64,{name:"副标题",fontSize:42,fontFamily:X,textFill:d(r),align:"center",letterSpacing:10}),Z(660,772,260,n,2,{name:"饰线左",cap:"butt"}),V("rect",950,768,20,20,d(n),{name:"菱形",cornerRadius:0,rotation:45}),Z(1e3,772,260,n,2,{name:"饰线右",cap:"butt"}),...o(0,"时间","2027.01.16 18:30"),...o(1,"地点","外滩华尔道夫酒店"),b("叮卡科技 · 全体同仁",160,950,1600,44,{name:"品牌",fontSize:28,fontFamily:X,textFill:d(n),align:"center",letterSpacing:12})],Yn)])}function iy(){const e="#f7f6f2",n="#151618",r="#2747d6",s="#d3dbff",l="#646873",o="#d7d6cf",c=(h,g,x)=>{const m=214+h*150,j=ft[h];return[b(g,720,m+48,170,52,{name:`标签${j}`,fontSize:36,fontFamily:Xe,textFill:d(r)}),b(x,900,m+46,760,56,{name:`信息${j}`,fontSize:38,fontFamily:_,textFill:d(n),fontWeight:"bold"}),Z(720,m+140,940,o,2,{name:`行线${j}`,cap:"butt"})]},f=[160,240,320].map(h=>`M 0 ${320-h} A ${h} ${h} 0 0 1 ${h} 320`).join(" ");return we([fe("议程",d(e),[V("rect",-de,-de,636,1240+de*2,d(r),{name:"色块",cornerRadius:0}),Y(f,0,920,320,320,{name:"弧线",stroke:"#6f88ff",strokeWidth:2,opacity:.55}),b("DINGCARD FORUM",96,96,460,40,{name:"品牌",fontSize:26,fontFamily:_,textFill:d("#ffffff"),fontWeight:"bold",letterSpacing:8}),b("第五届年度大会",96,296,460,48,{name:"副标题",fontSize:32,fontFamily:_,textFill:d(s),letterSpacing:4}),b(`设计与
|
|
460
|
+
智能峰会`,88,352,480,304,{name:"标题",fontSize:104,fontFamily:_,textFill:d("#ffffff"),fontWeight:"bold",lineHeight:1.15,letterSpacing:2,verticalAlign:"middle"}),b(`11 月 18 日 · 星期三
|
|
461
|
+
上海西岸艺术中心 B 馆`,96,684,460,110,{name:"正文",fontSize:32,fontFamily:_,textFill:d("#ffffff"),lineHeight:1.65}),b("TIME",720,136,170,36,{name:"表头一",fontSize:22,fontFamily:_,textFill:d(l),fontWeight:"bold",letterSpacing:6}),b("SESSION",900,136,400,36,{name:"表头二",fontSize:22,fontFamily:_,textFill:d(l),fontWeight:"bold",letterSpacing:6}),Z(720,190,940,n,3,{name:"表头线",cap:"butt"}),...c(0,"09:30","开幕致辞 · 林一"),...c(1,"10:00","主题演讲:设计工具的下一个十年"),...c(2,"11:30","圆桌:AI 会取代设计师吗"),...c(3,"14:00","工作坊:用模板做一套海报"),...c(4,"16:00","案例分享:从品牌到落地"),...c(5,"17:30","闭幕与合影")],bd)])}function sy(){const e="#f5f3ee",n="#132548",r="#b3925a",s="#586174";return we([fe("封面",d(e),[ey("等高线",930,940,8,50,1.25,r,.8),b("叮卡科技有限公司",100,100,640,44,{name:"品牌",fontSize:28,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:4}),b("ANNUAL REPORT",640,104,500,40,{name:"英文",fontSize:24,fontFamily:_,textFill:d(n),fontWeight:"bold",align:"right",letterSpacing:8}),Z(100,166,1040,n,2,{name:"刊头线",cap:"butt"}),b("2026",84,210,1080,400,{name:"角标",fontSize:360,fontFamily:Xe,textFill:d(n),letterSpacing:-10,lineHeight:1.05}),b("年度报告",100,1196,1040,324,{name:"标题",fontSize:128,fontFamily:X,textFill:d(n),fontWeight:"bold",letterSpacing:16,lineHeight:1.25,verticalAlign:"bottom"}),b("稳健增长 · 长期主义",104,1530,1e3,60,{name:"副标题",fontSize:40,fontFamily:_,textFill:d(s),letterSpacing:6}),Z(100,1640,1040,n,2,{name:"页脚线",cap:"butt"}),b("2027 年 3 月发布",100,1662,700,44,{name:"信息一",fontSize:28,fontFamily:_,textFill:d(s),letterSpacing:2})],es)])}function oy(){const e="#1f3fd0",n="#c3ceff";return we([fe("数据卡",d(e),[b("年轻人的屏幕时间",88,88,904,48,{name:"副标题",fontSize:34,fontFamily:_,textFill:d("#ffffff"),fontWeight:"bold",letterSpacing:4}),Z(88,160,904,n,2,{name:"刊头线",cap:"butt",opacity:.7}),b("87%",56,190,980,460,{name:"角标",fontSize:400,fontFamily:Xe,textFill:d("#ffffff"),letterSpacing:-12,lineHeight:1.1}),V("rect",92,650,140,14,d("#ffd447"),{name:"色条",cornerRadius:0}),b(`的年轻人每天刷手机
|
|
462
|
+
超过 4 小时`,88,694,904,170,{name:"标题",fontSize:60,fontFamily:_,textFill:d("#ffffff"),fontWeight:"bold",lineHeight:1.35,verticalAlign:"middle"}),b("数据来源:2026 数字生活调查",88,952,904,44,{name:"品牌",fontSize:26,fontFamily:_,textFill:d(n),letterSpacing:1})],Dr)])}function ly(){const e="#f1ebe0",n="#1c1a17",r="#d23c22",s="#625c56",[l,o,c]=[540,452,322],f=c+34,h={x:l-f,y:o-f,size:f*2};return we([fe("倒计时",d(e),[Y(ot(f,f,f),h.x,h.y,h.size,h.size,{name:"外圈",stroke:n,strokeWidth:2}),Y(Uc(f,f,c,16,60,g=>g%5!==0),h.x,h.y,h.size,h.size,{name:"刻度",stroke:n,strokeWidth:3,cap:"butt"}),Y(Uc(f,f,c,36,60,g=>g%5===0),h.x,h.y,h.size,h.size,{name:"大刻度",stroke:n,strokeWidth:6,cap:"butt"}),Y("M 0 0 L 28 0 L 14 24 Z",l-14,h.y-30,28,24,{name:"指针",fill:d(r),strokeWidth:0}),b("叮卡",88,64,400,44,{name:"品牌",fontSize:28,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:6}),b("COUNTDOWN",592,68,400,40,{name:"英文",fontSize:22,fontFamily:_,textFill:d(s),fontWeight:"bold",align:"right",letterSpacing:8}),b("距离新品发布还有",290,268,500,48,{name:"副标题",fontSize:34,fontFamily:_,textFill:d(n),align:"center",letterSpacing:2}),b("3",290,338,500,296,{name:"角标",fontSize:280,fontFamily:Xe,textFill:d(n),align:"center",lineHeight:1.05}),b("DAYS",290,644,500,52,{name:"单位",fontSize:40,fontFamily:_,textFill:d(r),fontWeight:"bold",align:"center",letterSpacing:16}),b("叮卡 App 3.0 发布会",88,838,904,80,{name:"标题",fontSize:60,fontFamily:_,textFill:d(n),fontWeight:"bold",align:"center"}),b("11 月 18 日 20:00 · 线上直播",88,934,904,48,{name:"信息一",fontSize:32,fontFamily:_,textFill:d(s),align:"center"})],Dr)])}function cy(){const e="#f3efe6",n="#161616",r="#ffcf33",s="#5d5850",[l,o,c,f]=[480,1250,600,480];return we([fe("封面",d(e),[Y(`M 0 0 L ${c+de} 0 L ${f+de} ${o-l} L 0 ${o-l} Z`,-de,l,c+de,o-l,{name:"左栏",fill:d(r),strokeWidth:0}),Y(`M ${c-f} 0 L ${1080+de-f} 0 L ${1080+de-f} ${o-l} L 0 ${o-l} Z`,f,l,1080+de-f,o-l,{name:"右栏",fill:d(n),strokeWidth:0}),Y(ot(112,112,112),428,753,224,224,{name:"VS底",fill:d("#ffffff"),stroke:n,strokeWidth:6}),b("VS",428,803,224,124,{name:"VS",fontSize:100,fontFamily:Xe,textFill:d(n),align:"center",lineHeight:1.1}),b("测评 · 第 21 期",88,88,600,44,{name:"角标",fontSize:28,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:4}),b("拿铁还是美式?",84,140,912,240,{name:"标题",fontSize:104,fontFamily:_,textFill:d(n),fontWeight:"bold",lineHeight:1.18,letterSpacing:-2,verticalAlign:"middle"}),b("喝了 30 杯之后,我的结论",88,392,904,52,{name:"副标题",fontSize:36,fontFamily:_,textFill:d(s),letterSpacing:1}),b("拿铁",88,556,432,140,{name:"标签一",fontSize:104,fontFamily:_,textFill:d(n),fontWeight:"bold",lineHeight:1.15}),b(`奶香柔和,
|
|
463
|
+
适合刚开始喝咖啡`,88,712,330,120,{name:"信息一",fontSize:34,fontFamily:_,textFill:d(n),lineHeight:1.5}),b("美式",576,990,416,140,{name:"标签二",fontSize:104,fontFamily:_,textFill:d("#ffffff"),fontWeight:"bold",lineHeight:1.15}),b(`清爽提神,
|
|
464
|
+
热量几乎为零`,576,1132,416,118,{name:"信息二",fontSize:34,fontFamily:_,textFill:d("#ffffff"),lineHeight:1.5}),Z(88,1300,904,n,2,{name:"页脚线",cap:"butt"}),b("咖啡研究所",88,1326,600,44,{name:"品牌",fontSize:28,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:4})])])}function If(e,n,r,s,l=e*n){const o=r/2;return Array.from({length:Math.min(l,e*n)},(c,f)=>{const h=f%e*(r+s)+o,g=Math.floor(f/e)*(r+s)+o;return`M ${h-o} ${g} A ${o} ${o} 0 1 0 ${h+o} ${g} A ${o} ${o} 0 1 0 ${h-o} ${g} Z`}).join(" ")}function dy(){const e="#eef1ea",n="#1e2a22",r="#3c8a5d",s="#2e6e49",l="#c4cfc0",o="#566159",[c,f,h,g,x]=[6,5,112,36,12],m={x:114,y:548,width:c*h+(c-1)*g,height:f*h+(f-1)*g},j=Array.from({length:x},(k,v)=>{const w=v%c*(h+g),N=Math.floor(v/c)*(h+g);return`M ${w+32} ${N+58} L ${w+50} ${N+76} L ${w+82} ${N+40}`}).join(" ");return we([fe("封面",d(e),[Y(If(c,f,h,g),m.x,m.y,m.width,m.height,{name:"打卡格",stroke:l,strokeWidth:3}),Y(If(c,f,h,g,x),m.x,m.y,m.width,m.height,{name:"已打卡",fill:d(r),strokeWidth:0}),Y(j,m.x,m.y,m.width,m.height,{name:"对勾",stroke:"#ffffff",strokeWidth:7,cap:"round",join:"round"}),b("第 12 天",88,96,400,48,{name:"角标",fontSize:32,fontFamily:_,textFill:d(s),fontWeight:"bold",letterSpacing:4}),b(`30 天
|
|
465
|
+
早起计划`,84,150,912,300,{name:"标题",fontSize:120,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.2,letterSpacing:2}),b("每天 6:30 起床,做一件喜欢的事",88,462,904,52,{name:"副标题",fontSize:36,fontFamily:_,textFill:d(o),letterSpacing:1}),b("坚持到第 30 天,奖励自己一次短途旅行。",88,1300,904,52,{name:"正文",fontSize:32,fontFamily:_,textFill:d(n),letterSpacing:1}),Z(88,1366,64,s,4,{name:"短线",cap:"butt"}),b("叮卡打卡本",168,1356,600,40,{name:"品牌",fontSize:26,fontFamily:_,textFill:d(o),fontWeight:"bold",letterSpacing:4})])])}function uy(){const e="#ffcd38",n="#1a1a1a";return we([fe("封面",d(e),[Y("M 70 210 C 70 70, 390 40, 390 225 C 390 335, 230 365, 230 480 L 230 548",560,120,460,600,{name:"问号",stroke:"#ffffff",strokeWidth:92,cap:"round",join:"round"}),Y(ot(56,56,56),734,744,112,112,{name:"问号点",fill:d("#ffffff"),strokeWidth:0}),b("冷知识 No.36",88,96,500,44,{name:"角标",fontSize:28,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:4}),Z(88,156,72,n,6,{name:"短线",cap:"butt"}),b(`为什么猫咪
|
|
466
|
+
喜欢钻纸箱?`,84,880,912,260,{name:"标题",fontSize:100,fontFamily:_,textFill:d(n),fontWeight:"bold",lineHeight:1.2,letterSpacing:-2}),b("纸箱又窄又暗,猫咪钻进去会觉得安全;纸板还能保温,冬天尤其舒服。",88,1156,904,120,{name:"正文",fontSize:34,fontFamily:_,textFill:d("#3b372f"),lineHeight:1.6}),b("叮卡百科",88,1356,600,44,{name:"品牌",fontSize:28,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:4})])])}function fy(){const e="#f5efe3",n="#bfdde3",r="#1d2b36",s="#e2553a",l="#56626b",o=[[230,650],[540,770],[300,970],[590,1140]],c=(g,x,m)=>{const[j,k]=o[g],v=ft[g];return[Y(ot(30,30,30),j-30,k-30,60,60,{name:`标记${v}`,fill:d(s),strokeWidth:0}),b(String(g+1),j-30,k-22,60,44,{name:`编号${v}`,fontSize:30,fontFamily:Xe,textFill:d("#ffffff"),align:"center"}),b(x,j+50,k-46,320,40,{name:`标签${v}`,fontSize:26,fontFamily:_,textFill:d(r),fontWeight:"bold",letterSpacing:3}),b(m,j+50,k-4,992-(j+50),48,{name:`信息${v}`,fontSize:34,fontFamily:_,textFill:d(r),fontWeight:"bold"})]},f=g=>{const[[x,m],[j,k]]=[o[g-1],o[g]],v=Math.min(x,j)-60,w=Math.min(m,k),N=Math.abs(j-x)+120,F=Math.abs(k-m),[I,M,z,A]=[x-v,m-w,j-v,k-w],T=g%2?60:-60;return Y(`M ${I} ${M} C ${I+T} ${M+F*.45}, ${z-T} ${A-F*.45}, ${z} ${A}`,v,w,N,F,{name:`路线${ft[g]}`,stroke:s,strokeWidth:5,dash:14,cap:"round"})},h=I0([[1096,560],[930,590],[850,720],[900,860],[790,1e3],[850,1150],[760,1262]].map(([g,x])=>[g,x-520]),760);return we([fe("封面",d(e),[Y(`${h}`,0,520,1096,760,{name:"海",fill:d(n),strokeWidth:0}),Y("M 0 70 C 120 40 240 110 380 80 M 0 150 C 140 120 260 190 420 160",60,1150,440,220,{name:"等高线",stroke:"#d9cfbd",strokeWidth:3,cap:"round"}),f(1),f(2),f(3),...c(0,"DAY 1","西湖 · 断桥"),...c(1,"DAY 2","灵隐寺 · 飞来峰"),...c(2,"DAY 3","龙井村 · 九溪"),...c(3,"DAY 4","河坊街 · 南宋御街"),Y("M 30 0 L 44 46 L 30 38 L 16 46 Z",920,1270,60,60,{name:"指北针",fill:d(r),strokeWidth:0}),b("N",920,1322,60,36,{name:"北",fontSize:24,fontFamily:Xe,textFill:d(r),align:"center"}),b(`杭州
|
|
467
|
+
四日慢游`,84,84,760,336,{name:"标题",fontSize:120,fontFamily:X,textFill:d(r),fontWeight:"bold",lineHeight:1.2,letterSpacing:4,verticalAlign:"bottom"}),b("跟着这条线走,景点不绕路",88,432,904,52,{name:"副标题",fontSize:34,fontFamily:_,textFill:d(l),letterSpacing:1}),b("叮卡旅行",88,1356,600,44,{name:"品牌",fontSize:28,fontFamily:_,textFill:d(r),fontWeight:"bold",letterSpacing:4})])])}function hy(){const e="#111111",n="#a9a9a9",r="#ff5a36",s=["#ff5a36","#ff7d5e","#ffa086","#ffc3b1","#ffe2d8"],l=[800,710,630,560,500],o=(c,f)=>{const h=600+c*140,g=ft[c];return[V("rect",192,h,l[c],104,d(s[c]),{name:`条${g}`,cornerRadius:0}),b(String(c+1),80,h+2,100,104,{name:`名次${g}`,fontSize:88,fontFamily:Xe,textFill:d("#ffffff"),align:"center",lineHeight:1.15}),b(f,224,h+24,l[c]-56,56,{name:`信息${g}`,fontSize:40,fontFamily:_,textFill:d("#141414"),fontWeight:"bold"})]};return we([fe("封面",d(e),[b("2026",88,92,300,52,{name:"角标",fontSize:40,fontFamily:Xe,textFill:d(r)}),b(`年度好物
|
|
468
|
+
TOP 5`,84,150,912,320,{name:"标题",fontSize:130,fontFamily:_,textFill:d("#ffffff"),fontWeight:"bold",lineHeight:1.18,letterSpacing:-2}),b("用了一整年,真心推荐这五样",88,492,904,52,{name:"副标题",fontSize:34,fontFamily:_,textFill:d(n),letterSpacing:1}),...o(0,"降噪耳机"),...o(1,"电动牙刷"),...o(2,"手冲咖啡壶"),...o(3,"护眼台灯"),...o(4,"折叠收纳箱"),Z(88,1320,904,"#333333",2,{name:"页脚线",cap:"butt"}),b("叮卡好物志",88,1344,600,44,{name:"品牌",fontSize:28,fontFamily:_,textFill:d("#ffffff"),fontWeight:"bold",letterSpacing:4})])])}function jd(e){let n=e>>>0;return()=>(n=Math.imul(n,1664525)+1013904223>>>0,n/4294967296)}function my(){const e="#fbf4e4",n="#c9382a",r="#2a1d17",s="#6b5a4f",l="#c59a3e",f=m=>m.map(j=>{const k=j*135;return`M ${k} 0 L ${k+135} 0 L ${k+135} 250 A ${67.5} ${67.5} 0 0 1 ${k} 250 Z`}).join(" "),h=Array.from({length:8},(m,j)=>{const k=j*135;return`M ${k} 2 A ${67.5} ${67.5} 0 0 0 ${k+135} 2`}).join(" "),g=(m,j)=>{const k=1046+m*92,v=ft[m];return[V("rect",532,k+22,16,16,d(l),{name:`菱形${v}`,cornerRadius:0,rotation:45}),b(j,88,k+44,904,48,{name:`信息${v}`,fontSize:36,fontFamily:_,textFill:d(r),align:"center",letterSpacing:1})]},x={color:"#8a2a1e",blur:18,offsetX:0,offsetY:10};return we([fe("海报",d(e),[Y(f([1,3,5,7]),0,0,1080,250+135/2,{name:"篷底",fill:d("#f6e9cf"),strokeWidth:0,shadow:{...x,color:"#c9b48c"}}),Y(f([0,2,4,6]),0,0,1080,250+135/2,{name:"遮阳篷",fill:d(n),strokeWidth:0,shadow:x}),Y(h,0,248,1080,135/2+4,{name:"篷边",stroke:n,strokeWidth:3}),va(430,300,380,r,3,{name:"挂绳左"}),va(650,300,380,r,3,{name:"挂绳右"}),V("rect",360,380,360,140,d(r),{name:"招牌",cornerRadius:18}),b("OPEN",360,398,360,104,{name:"招牌字",fontSize:84,fontFamily:Xe,textFill:d(e),align:"center",letterSpacing:8,lineHeight:1.15}),V("rect",64,580,952,1150,{type:"transparent"},{name:"外框",stroke:n,strokeWidth:3,cornerRadius:28}),V("rect",78,594,924,1122,{type:"transparent"},{name:"内框",stroke:n,strokeWidth:1.5,cornerRadius:20}),b("开业大吉",88,606,904,290,{name:"标题",fontSize:160,fontFamily:X,textFill:d(n),fontWeight:"bold",align:"center",letterSpacing:12,lineHeight:1.15,verticalAlign:"middle"}),b("山野咖啡 · 城西新店",88,906,904,60,{name:"副标题",fontSize:42,fontFamily:X,textFill:d(r),align:"center",letterSpacing:8}),Z(392,1e3,296,l,2,{name:"饰线",cap:"butt"}),...g(0,"开业三天,全场饮品 8 折"),...g(1,"前 100 位到店,送限定杯套"),...g(2,"充值 200 元,再送 50 元"),b(`10 月 30 日 正式营业
|
|
469
|
+
城西万象城一层 108 号`,88,1372,904,120,{name:"正文",fontSize:34,fontFamily:_,textFill:d(s),align:"center",lineHeight:1.7}),V("rect",320,1556,440,108,d(n),{name:"按钮底板",cornerRadius:54}),b("到店领券",320,1582,440,56,{name:"按钮文字",fontSize:40,fontFamily:_,textFill:d("#ffffff"),fontWeight:"bold",align:"center",letterSpacing:10}),b("SHANYE COFFEE",88,1792,904,44,{name:"品牌",fontSize:28,fontFamily:_,textFill:d(r),fontWeight:"bold",align:"center",letterSpacing:10})],Gt)])}function py(){const e="#ff5b2e",n="#ff7c55",r="#141414",s={x:120,y:330,width:840,height:760,band:150},l=-.4,o=1080+de*2,c=[[420,540],[880,1060],[1500,1600]].map(([g,x])=>`M 0 ${g} L ${o} ${Fe(g+l*o)} L ${o} ${Fe(x+l*o)} L 0 ${x} Z`).join(" "),f=(g,x,m)=>Y(ot(14,14,14),x-14,m-14,28,28,{name:g,fill:d(e),strokeWidth:0}),h=(g,x,m)=>{const j=1190+g*110,k=ft[g];return[b(x,120,j+6,160,48,{name:`标签${k}`,fontSize:32,fontFamily:_,textFill:d(r),fontWeight:"bold",letterSpacing:6}),b(m,290,j,670,60,{name:`信息${k}`,fontSize:40,fontFamily:_,textFill:d(r),fontWeight:"bold"}),Z(120,j+84,840,r,2,{name:`行线${k}`,cap:"butt",opacity:.35})]};return we([fe("海报",d(e),[Y(c,-de,0,1080+de*2,1920,{name:"速度线",fill:d(n),strokeWidth:0}),b("城市半程马拉松",88,66,904,216,{name:"标题",fontSize:104,fontFamily:_,textFill:d(r),fontWeight:"bold",letterSpacing:-2,lineHeight:1.18,verticalAlign:"bottom"}),V("rect",s.x,s.y,s.width,s.height,d("#ffffff"),{name:"号码布",cornerRadius:24,shadow:{color:"#b33a17",blur:30,offsetX:0,offsetY:14}}),Y(`M 0 24 A 24 24 0 0 1 24 0 L ${s.width-24} 0 A 24 24 0 0 1 ${s.width} 24 L ${s.width} ${s.band} L 0 ${s.band} Z`,s.x,s.y,s.width,s.band,{name:"号码布顶",fill:d(r),strokeWidth:0}),f("孔一",s.x+40,s.y+40),f("孔二",s.x+s.width-40,s.y+40),f("孔三",s.x+40,s.y+s.height-40),f("孔四",s.x+s.width-40,s.y+s.height-40),b("21.0975 KM · 秋季站",s.x,s.y+44,s.width,64,{name:"副标题",fontSize:42,fontFamily:_,textFill:d("#ffffff"),fontWeight:"bold",align:"center",letterSpacing:4}),b("2026",s.x,s.y+230,s.width,360,{name:"角标",fontSize:320,fontFamily:Xe,textFill:d(r),align:"center",letterSpacing:-8,lineHeight:1.1}),b("RUNNER No.",s.x,s.y+620,s.width,44,{name:"号码说明",fontSize:28,fontFamily:_,textFill:d(r),fontWeight:"bold",align:"center",letterSpacing:10}),...h(0,"时间","11 月 16 日 7:30 鸣枪"),...h(1,"起点","滨江公园南门"),...h(2,"报名","即日起至 10 月 31 日"),b("城市体育局 · 叮卡跑团",88,1800,904,48,{name:"品牌",fontSize:30,fontFamily:_,textFill:d(r),fontWeight:"bold",align:"center",letterSpacing:6})],Gt)])}function gy(){const e="#0f0f12",n="#ff3b3b",r="#a1a1aa",s=Array.from({length:33},(o,c)=>{const f=30+Math.round(110*Math.abs(Math.sin(c*.9))*Math.exp(-((c-16)**2)/120)),h=c*28+4;return`M ${h} ${150-f} L ${h} 150`}).join(" "),l=(o,c,f)=>{const h=1150+o*100,g=ft[o];return[b(c,88,h,904,40,{name:`标签${g}`,fontSize:28,fontFamily:_,textFill:d(r),align:"center",letterSpacing:8}),b(f,88,h+42,904,52,{name:`信息${g}`,fontSize:38,fontFamily:_,textFill:d("#ffffff"),fontWeight:"bold",align:"center"})]};return we([fe("海报",d(e),[V("ellipse",140,160,800,420,d(n),{name:"红光",filter:{blur:100},opacity:.35}),V("rect",240,270,600,200,{type:"transparent"},{name:"灯牌",stroke:n,strokeWidth:8,cornerRadius:36,shadow:{color:n,blur:40,offsetX:0,offsetY:0}}),Y(ot(18,18,18),292,352,36,36,{name:"红点",fill:d(n),strokeWidth:0,shadow:{color:n,blur:20,offsetX:0,offsetY:0}}),b("ON AIR",340,300,480,140,{name:"灯牌字",fontSize:104,fontFamily:Xe,textFill:d(n),align:"center",lineHeight:1.2,effect:{type:"neon",color:"#ff3b3b",amount:30}}),b("LIVE STUDIO",88,96,904,44,{name:"品牌",fontSize:28,fontFamily:_,textFill:d("#ffffff"),fontWeight:"bold",align:"center",letterSpacing:10}),b(`双十一
|
|
470
|
+
直播专场`,88,590,904,370,{name:"标题",fontSize:140,fontFamily:_,textFill:d("#ffffff"),fontWeight:"bold",align:"center",lineHeight:1.15,letterSpacing:4,verticalAlign:"middle"}),b("主播小满带你逛 · 全场直降",88,972,904,60,{name:"副标题",fontSize:40,fontFamily:_,textFill:d(r),align:"center",letterSpacing:4}),...l(0,"开播时间","11 月 10 日 20:00"),...l(1,"直播平台","视频号 · 小红书 同步"),V("rect",320,1420,440,108,d(n),{name:"按钮底板",cornerRadius:54}),b("预约直播",320,1446,440,56,{name:"按钮文字",fontSize:40,fontFamily:_,textFill:d("#ffffff"),fontWeight:"bold",align:"center",letterSpacing:10}),Y(s,72,1640,936,150,{name:"声波",stroke:n,strokeWidth:8,cap:"round",opacity:.85})],Gt)])}function xy(){const e="#f3e3b5",n="#c9c3f0",r=jd(77),s=(F,I,M)=>`M ${Fe(F-M)} ${Fe(I)} a ${M} ${M} 0 1 0 ${Fe(M*2)} 0 a ${M} ${M} 0 1 0 ${Fe(-M*2)} 0 Z`,l=(F,I,M)=>Array.from({length:F},()=>{const z=r(),A=(r()+r()+r()-1.5)*I,T=-60+z*1200+A*.5,L=1500-z*1180+A,H=Fe(M[0]+r()*(M[1]-M[0]));return T-H<0||T+H>1080||L-H<0||L+H>1600?"":s(T,L,H)}).filter(Boolean).join(" "),o=l(260,90,[1,2.6]),c=l(90,60,[2,4]),f=Array.from({length:150},()=>s(20+r()*1040,30+r()*1160,Fe(.8+r()*1.6))).join(" "),h=(F,I,M,z)=>Y(`M ${z} 0 Q ${z*1.12} ${z*.88} ${z*2} ${z} Q ${z*1.12} ${z*1.12} ${z} ${z*2} Q ${z*.88} ${z*1.12} 0 ${z} Q ${z*.88} ${z*.88} ${z} 0 Z`,I-z,M-z,z*2,z*2,{name:F,fill:d(e),strokeWidth:0,shadow:{color:"#fff3c4",blur:30,offsetX:0,offsetY:0}}),[g,x]=[[250,560],[820,930]],m={x:860,y:230,r:56},j=[[296,598],[332,610],[318,668],[282,656]],k=[[774,888],[866,972]],v=`M ${g[0]} ${g[1]} L ${j.map(([F,I])=>`${F} ${I}`).join(" L ")} Z M ${k[0][0]} ${k[0][1]} L ${x[0]} ${x[1]} L ${k[1][0]} ${k[1][1]}`,w=[...j,...k].map(([F,I])=>`M ${F-4} ${I} a 4 4 0 1 0 8 0 a 4 4 0 1 0 -8 0 Z`).join(" "),N=Array.from({length:15},(F,I)=>{const M=(I+1)/16;return s(g[0]+(x[0]-g[0])*M,g[1]+(x[1]-g[1])*M-Math.sin(M*Math.PI)*170,5)}).join(" ");return we([fe("海报",ir([[0,"#0b0e2e"],[.6,"#17124a"],[1,"#26155a"]],180),[V("ellipse",-310,760,1700,300,d("#8f86d8"),{name:"银河光",rotation:-44.5,filter:{blur:100},opacity:.28}),Y(f,0,0,1080,1200,{name:"星空",fill:d("#ffffff"),strokeWidth:0,opacity:.55}),Y(o,0,0,1080,1600,{name:"银河远",fill:d(n),strokeWidth:0,opacity:.5}),Y(c,0,0,1080,1600,{name:"银河近",fill:d("#ffffff"),strokeWidth:0,opacity:.75}),V("ellipse",g[0]-120,g[1]-120,240,240,d("#f7e3a1"),{name:"星光一",filter:{blur:60},opacity:.45}),V("ellipse",x[0]-120,x[1]-120,240,240,d("#f7e3a1"),{name:"星光二",filter:{blur:60},opacity:.45}),Y(N,0,0,1080,1100,{name:"鹊桥",fill:d(e),strokeWidth:0,opacity:.85}),Y(v,0,0,1080,1100,{name:"星座线",stroke:e,strokeWidth:1.5,opacity:.55,join:"round"}),Y(w,0,0,1080,1100,{name:"小星",fill:d(e),strokeWidth:0,opacity:.9}),Y(`M ${m.r} 0 A ${m.r} ${m.r} 0 0 1 ${m.r} ${m.r*2} A ${Fe(m.r*.35)} ${m.r} 0 0 0 ${m.r} 0 Z`,m.x-m.r,m.y-m.r,m.r*2,m.r*2,{name:"月",fill:d(e),strokeWidth:0,shadow:{color:"#fff3c4",blur:24,offsetX:0,offsetY:0}}),h("织女星",g[0],g[1],34),h("牛郎星",x[0],x[1],30),b("VEGA",g[0]-230,g[1]-18,180,36,{name:"星名一",fontSize:22,fontFamily:Ft,textFill:d(e),align:"right",letterSpacing:8,italic:!0}),b("ALTAIR",x[0]+48,x[1]-52,180,36,{name:"星名二",fontSize:22,fontFamily:Ft,textFill:d(e),letterSpacing:8,italic:!0}),b("七夕",88,1110,904,440,{name:"标题",fontSize:230,fontFamily:X,textFill:d(e),fontWeight:"bold",align:"center",letterSpacing:30,lineHeight:1.15,verticalAlign:"bottom"}),b("一年一会,鹊桥相见",88,1570,904,64,{name:"副标题",fontSize:44,fontFamily:X,textFill:d(e),align:"center",letterSpacing:14}),b("农历七月初七 · 8 月 19 日",88,1660,904,48,{name:"信息一",fontSize:30,fontFamily:_,textFill:d(n),align:"center",letterSpacing:6}),b("叮卡 敬贺",88,1800,904,44,{name:"品牌",fontSize:28,fontFamily:X,textFill:d(e),align:"center",letterSpacing:12})],Gt)])}function by(){const e="#f3efe2",n="#1f2a24",r="#b8322a",s="#3f7f86",l="#55625a",o="#c59a3e",f=Array.from({length:8},(k,v)=>Array.from({length:10},(w,N)=>{const F=N*120+(v%2?60:0)+56,I=v*70+70;return[56,40,24].map(M=>`M ${F-M} ${I} A ${M} ${M} 0 0 1 ${F+M} ${I}`).join(" ")}).join(" ")).join(" "),h=Array.from({length:13},(k,v)=>190+v*46),g=h.map(k=>`M ${k-7} 90 a 7 7 0 1 0 14 0 a 7 7 0 1 0 -14 0 Z`).join(" "),x=h.map(k=>`M ${k-1} 101 L ${k-12} 128`).join(" "),m=h.map(k=>`M ${k+18} 92 L ${k-28} 182`).join(" "),j=h.map(k=>`M ${k-25} 176 L ${k-31} 188`).join(" ");return we([fe("海报",d(e),[Y(ot(250,250,250),100,770,500,500,{name:"红日",fill:d("#d9583b"),strokeWidth:0,opacity:.92}),Y(f,-110,1380,1300,560,{name:"海水纹",stroke:s,strokeWidth:3,opacity:.75}),Y(m,70,1210,940,200,{name:"船桨",stroke:n,strokeWidth:4,cap:"round"}),Y(j,70,1210,940,200,{name:"桨叶",stroke:n,strokeWidth:9,cap:"round"}),Y("M 60 120 Q 460 160 860 112 L 846 140 Q 460 196 84 150 Z",70,1210,940,200,{name:"龙舟",fill:d(n),strokeWidth:0}),Y("M 92 134 Q 460 172 838 124",70,1210,940,200,{name:"船线",stroke:o,strokeWidth:4,cap:"round"}),Y("M 842 120 C 872 104 882 78 872 56",70,1210,940,200,{name:"龙颈",stroke:n,strokeWidth:18,cap:"round"}),Y("M 874 34 C 864 18 852 10 836 8 M 884 31 C 880 16 872 8 860 2 M 866 68 C 852 76 840 78 828 76 M 870 82 C 858 92 846 96 834 96",70,1210,940,200,{name:"龙角",stroke:n,strokeWidth:5,cap:"round"}),Y("M 858 62 C 856 44 870 30 890 30 L 926 32 C 934 33 938 38 934 42 L 906 46 L 930 54 C 934 56 932 62 926 62 L 892 64 C 878 66 864 68 858 62 Z",70,1210,940,200,{name:"龙头",fill:d(n),strokeWidth:0}),Y("M 892.5 40 a 3.5 3.5 0 1 0 7 0 a 3.5 3.5 0 1 0 -7 0 Z",70,1210,940,200,{name:"龙眼",fill:d(e),strokeWidth:0}),Y("M 72 126 C 40 118 26 94 36 72 C 44 56 64 58 66 72 C 68 82 58 86 52 80",70,1210,940,200,{name:"龙尾",stroke:n,strokeWidth:10,cap:"round"}),Y("M 130 124 L 130 30 M 130 32 L 176 46 L 130 60 Z",70,1210,940,200,{name:"旗",fill:d(r),stroke:n,strokeWidth:4,join:"round"}),Y(x,70,1210,940,200,{name:"划手",stroke:n,strokeWidth:11,cap:"round"}),Y(g,70,1210,940,200,{name:"划手头",fill:d(n),strokeWidth:0}),b("端午安康",668,130,322,860,{name:"标题",fontSize:190,fontFamily:na,textFill:d(n),vertical:!0,lineHeight:1.1}),b("粽叶飘香 龙舟竞渡",600,180,80,640,{name:"副标题",fontSize:40,fontFamily:X,textFill:d(n),vertical:!0,letterSpacing:10,lineHeight:1.2}),b("叮卡 敬贺",604,860,72,340,{name:"品牌",fontSize:30,fontFamily:X,textFill:d(l),vertical:!0,letterSpacing:8,lineHeight:1.2}),V("rect",96,150,110,110,d(r),{name:"印章",cornerRadius:8,rotation:-4}),b("端午",96,166,110,78,{name:"印章文字",fontSize:44,fontFamily:na,textFill:d("#ffffff"),align:"center",rotation:-4,lineHeight:1.2}),b("五月初五",96,320,420,72,{name:"信息一",fontSize:54,fontFamily:X,textFill:d(n),fontWeight:"bold",letterSpacing:6}),b("6 月 19 日 · 星期五",96,404,460,48,{name:"信息二",fontSize:32,fontFamily:_,textFill:d(l),letterSpacing:2}),b("放假三天:6 月 19 日 — 21 日",96,462,460,48,{name:"信息三",fontSize:30,fontFamily:_,textFill:d(l)})],Gt)])}function yy(){const e="#ebe5da",n="#151515",r="#1f3550",s="#f3ead8",l="#e8603c",o="#5f5a52",f={x:470,y:170},h=Array.from({length:13},(j,k)=>ot(280,280,124+k*12)).join(" "),g=(j,k)=>{const[v,w]=[j,k].map(F=>F*Math.PI/180),N=268;return`M 280 280 L ${Fe(280+N*Math.cos(v))} ${Fe(280+N*Math.sin(v))} A ${N} ${N} 0 0 1 ${Fe(280+N*Math.cos(w))} ${Fe(280+N*Math.sin(w))} Z`},x=(j,k)=>{const v=796+j*62,w=ft[j];return[b(String(j+1).padStart(2,"0"),88,v+4,64,40,{name:`编号${w}`,fontSize:26,fontFamily:Xe,textFill:d(l)}),b(k,160,v,832,48,{name:`信息${w}`,fontSize:32,fontFamily:_,textFill:d(n),fontWeight:"bold"})]},m={color:"#9c9282",blur:26,offsetX:0,offsetY:12};return we([fe("封面",d(e),[b("阿澄的深夜电台",88,88,600,44,{name:"品牌",fontSize:28,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:4}),b("STEREO · 33 RPM",692,94,300,36,{name:"转速",fontSize:20,fontFamily:Xe,textFill:d(o),align:"right",letterSpacing:4}),Y(ot(280,280,280),f.x,f.y,280*2,280*2,{name:"唱片",fill:d(n),strokeWidth:0,shadow:m}),Y(h,f.x,f.y,280*2,280*2,{name:"纹路",stroke:"#2e2e2e",strokeWidth:2}),Y(`${g(-70,-38)} ${g(110,142)}`,f.x,f.y,280*2,280*2,{name:"反光",fill:d("#ffffff"),strokeWidth:0,opacity:.08}),Y(ot(96,96,96),f.x+280-96,f.y+280-96,192,192,{name:"唱片标",fill:d(l),strokeWidth:0}),b("SIDE A",f.x+280-96,f.y+280-64,192,30,{name:"唱片标字",fontSize:18,fontFamily:Xe,textFill:d(s),align:"center",letterSpacing:4}),Y(ot(9,9,9),f.x+280-9,f.y+280-9,18,18,{name:"中孔",fill:d(e),strokeWidth:0}),V("rect",88,170,560,560,d(r),{name:"封套",cornerRadius:6,shadow:m}),b("VOL.07",136,214,300,40,{name:"角标",fontSize:26,fontFamily:Xe,textFill:d(l),letterSpacing:4}),b(`深夜
|
|
471
|
+
歌单`,132,268,472,340,{name:"标题",fontSize:120,fontFamily:X,textFill:d(s),fontWeight:"bold",lineHeight:1.15}),Z(136,630,64,l,4,{name:"封套线",cap:"butt"}),b("十二首适合一个人听的歌",136,650,464,40,{name:"副标题",fontSize:28,fontFamily:_,textFill:d("#b9c5d6"),letterSpacing:2}),Z(88,764,904,n,2,{name:"分隔线",cap:"butt"}),...x(0,"凌晨三点的便利店"),...x(1,"海边的末班车"),...x(2,"月亮不睡我不睡")],Dr)])}function jy(){const e="#f6efe4",n="#e5352b",r="#1c1a17",s="#6a6259",l=(o,c,f)=>{const h=88+o*312,g=ft[o];return[b(c,h,786,280,36,{name:`标签${g}`,fontSize:24,fontFamily:_,textFill:d(s),letterSpacing:4}),b(f,h,824,280,96,{name:`信息${g}`,fontSize:34,fontFamily:_,textFill:d(r),fontWeight:"bold",lineHeight:1.35})]};return we([fe("封面",d(e),[V("rect",100,96,880,640,d(n),{name:"贴纸",cornerRadius:40,shadow:{color:"#cdbca8",blur:30,offsetX:0,offsetY:14}}),Y("M 5 30 L 8 6 M 20 38 L 40 20 M 24 54 L 48 50",980,46,60,60,{name:"强调线",stroke:r,strokeWidth:5,cap:"round"}),b("HELLO",100,106,880,150,{name:"贴纸字",fontSize:130,fontFamily:Xe,textFill:d("#ffffff"),align:"center",letterSpacing:6,lineHeight:1.1}),b("my name is",100,262,880,76,{name:"贴纸小字",fontSize:56,fontFamily:Ys,textFill:d("#ffffff"),align:"center",lineHeight:1.2}),V("rect",130,346,820,340,d("#ffffff"),{name:"名字底",cornerRadius:20}),b("小满",130,354,820,324,{name:"标题",fontSize:176,fontFamily:na,textFill:d(r),align:"center",lineHeight:1.15,verticalAlign:"middle"}),...l(0,"坐标","杭州"),...l(1,"职业","插画师"),...l(2,"爱好","爬山和猫"),b("初次见面",88,972,500,40,{name:"角标",fontSize:26,fontFamily:_,textFill:d(r),fontWeight:"bold",letterSpacing:6}),b("@阿澄的日常",592,972,400,40,{name:"品牌",fontSize:26,fontFamily:_,textFill:d(s),align:"right",letterSpacing:2})],Dr)])}function wy(e,n,r,s,l){const o=Fe(r*Math.abs(s)),c=l?1:0,f=s<0===l?0:1;return`M ${e} ${n-r} A ${r} ${r} 0 0 ${c} ${e} ${n+r} A ${o} ${r} 0 0 ${f} ${e} ${n-r} Z`}function ky(){const e="#f3e6b4",n="#9aa3c4",r=jd(1024),s={x:86,y:136,width:908,height:148},l=30,o=[[64,-.6,!0],[184,-.04,!0],[304,.55,!0],[604,.55,!1],[724,-.04,!1],[844,-.6,!1]],c=o.map(([x])=>ot(x,74,l)).join(" "),f=o.map(([x,m,j])=>wy(x,74,l,m,j)).join(" "),h=[[430,50,12],[478,92,16],[452,114,8],[496,50,7]].map(([x,m,j])=>ot(x,m,j)).join(" "),g=Array.from({length:80},()=>{const x=20+r()*1040,m=20+r()*1040,j=Fe(.8+r()*1.4);return`M ${Fe(x-j)} ${Fe(m)} a ${j} ${j} 0 1 0 ${Fe(j*2)} 0 a ${j} ${j} 0 1 0 ${Fe(-j*2)} 0 Z`}).join(" ");return we([fe("日签",ir([[0,"#0c1430"],[1,"#1d2a5c"]],180),[Y(g,0,0,1080,1080,{name:"星",fill:d("#ffffff"),strokeWidth:0,opacity:.5}),V("ellipse",400,90,280,240,d(e),{name:"月光",filter:{blur:60},opacity:.3}),Y(c,s.x,s.y,s.width,s.height,{name:"月相暗面",fill:d(e),strokeWidth:0,opacity:.16}),Y(f,s.x,s.y,s.width,s.height,{name:"月相",fill:d(e),strokeWidth:0}),Y(ot(454,74,74),s.x,s.y,s.width,s.height,{name:"满月",fill:d(e),strokeWidth:0,shadow:{color:"#fff3c4",blur:30,offsetX:0,offsetY:0}}),Y(h,s.x,s.y,s.width,s.height,{name:"环形山",fill:d("#e2d29b"),strokeWidth:0}),b("10.24",88,330,904,230,{name:"角标",fontSize:200,fontFamily:Ft,textFill:d("#ffffff"),align:"center",lineHeight:1.1}),b("星期六 · 农历九月十五",88,566,904,44,{name:"副标题",fontSize:28,fontFamily:_,textFill:d(n),align:"center",letterSpacing:6}),Z(500,648,80,e,2,{name:"短线",cap:"butt"}),b("慢慢来,比较快。",120,690,840,200,{name:"标题",fontSize:60,fontFamily:X,textFill:d("#ffffff"),align:"center",lineHeight:1.5,verticalAlign:"middle"}),b("叮卡日签",88,968,904,40,{name:"品牌",fontSize:24,fontFamily:_,textFill:d(n),align:"center",letterSpacing:10})],Dr)])}function Sy(){const e="#f1ede3",n="#1a1a1a",r="#57524a",s={x:1236,y:312,width:468,height:364,step:26},l=236,o=[];for(let c=s.step/2;c<s.height;c+=s.step)for(let f=s.step/2;f<s.width;f+=s.step){const h=Math.hypot(f-170,c-150),g=Math.abs(f-170)<64*(1-(c-l)/200)&&Math.floor((c-l)/s.step)%2===0,x=c<l?h<70?0:.06+.42*Math.min(1,(h-70)/420):g?.3:.85,m=Fe(s.step/2*Math.sqrt(x));m>=.8&&o.push(`M ${Fe(f-m)} ${c} a ${m} ${m} 0 1 0 ${Fe(m*2)} 0 a ${m} ${m} 0 1 0 ${Fe(-m*2)} 0 Z`)}return we([fe("首图",d(e),[b("叮卡周报",80,36,1640,150,{name:"品牌",fontSize:112,fontFamily:X,textFill:d(n),fontWeight:"bold",align:"center",letterSpacing:30,lineHeight:1.2}),Z(80,194,1640,n,4,{name:"报头线",cap:"butt"}),Z(80,202,1640,n,1.5,{name:"报头细线",cap:"butt"}),b("第 128 期 · 2026 年 10 月 24 日 · 星期六",80,220,1100,36,{name:"角标",fontSize:24,fontFamily:_,textFill:d(r),letterSpacing:2}),b("WEEKEND EDITION",1220,218,500,36,{name:"版别",fontSize:24,fontFamily:Ft,textFill:d(r),align:"right",italic:!0,letterSpacing:2}),Z(80,264,1640,n,1.5,{name:"日期线",cap:"butt"}),b(`一座城市的夜晚,
|
|
472
|
+
从一碗面开始`,80,296,1100,220,{name:"标题",fontSize:80,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.25}),b("我们在凌晨的街头,吃遍了还亮着灯的面馆",80,532,1100,50,{name:"副标题",fontSize:32,fontFamily:_,textFill:d(n),letterSpacing:1}),b("十二家面馆,从晚上十点开到早上六点。来吃面的有出租车司机、夜班护士和刚下班的厨师,他们是这座城市夜里最熟悉的面孔。",80,600,1100,100,{name:"正文",fontSize:24,fontFamily:_,textFill:d(r),lineHeight:1.6}),va(1206,300,700,n,1.5,{name:"栏线"}),Y(o.join(" "),s.x,s.y,s.width,s.height,{name:"网点图",fill:d(n),strokeWidth:0}),V("rect",s.x,s.y,s.width,s.height,{type:"transparent"},{name:"图框",stroke:n,strokeWidth:1.5,cornerRadius:0}),Z(80,726,1640,n,3,{name:"底线",cap:"butt"})],Zs)])}function vy(){const e="#f4efe6",n="#c8573a",r="#f6e7d8",s="#1d1a17",l="#6a625a",c=(f,h,g)=>[Y(`M ${15.600000000000001} ${166.4} C 13 91 ${67.60000000000001} ${23.400000000000002} ${166.4} 0 L ${176.8} ${28.6} C ${114.4} 52 ${85.8} ${93.60000000000001} ${93.60000000000001} ${111.8} Z`,h,g,182,169,{name:`引号尾${f}`,fill:d(r),strokeWidth:0}),Y(ot(85.8,85.8,85.8),h+11.700000000000001,g+96.2,171.6,171.6,{name:`引号球${f}`,fill:d(r),strokeWidth:0})];return we([fe("首图",d(e),[V("rect",-de,-de,600+de,766+de*2,d(n),{name:"色块",cornerRadius:0}),...c("一",99,249),...c("二",318,249),b("人物访谈 · 第 12 期",680,150,640,40,{name:"角标",fontSize:26,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:6}),b("叮卡人物",1320,150,400,40,{name:"品牌",fontSize:24,fontFamily:_,textFill:d(l),fontWeight:"bold",align:"right",letterSpacing:6}),b(`开一家书店,是为了让陌生人
|
|
473
|
+
有个地方坐一会儿。`,680,210,1040,210,{name:"标题",fontSize:64,fontFamily:X,textFill:d(s),fontWeight:"bold",lineHeight:1.4}),Z(680,452,72,n,4,{name:"短线",cap:"butt"}),b("对话 阿澄 · 独立书店「慢读」店主",680,484,1040,50,{name:"副标题",fontSize:34,fontFamily:_,textFill:d(s),fontWeight:"bold"}),b("书店开到第七年,我们聊了熬过的冬天,和那些一坐就是一下午的老读者。",680,546,1040,80,{name:"正文",fontSize:26,fontFamily:_,textFill:d(l),lineHeight:1.5})],Zs)])}function Ny(){const e="#16181d",n="#2f5bea",r="#646a75",s="#dfe2e8",l=(c,f,h)=>[V("rect",96,h+15,14,14,d(n),{name:`${c}标记`,cornerRadius:0}),b(f,126,h,400,44,{name:c,fontSize:30,fontFamily:_,textFill:d(e),fontWeight:"bold",letterSpacing:4})],o=(c,f,h)=>{const g=744+c*136,x=ft[c];return[b(f,96,g+4,260,40,{name:`标签${x}`,fontSize:26,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:1}),b(h,380,g,764,100,{name:`信息${x}`,fontSize:28,fontFamily:_,textFill:d(e),lineHeight:1.65})]};return we([fe("简历",d("#ffffff"),[b("林澄",96,112,640,140,{name:"标题",fontSize:110,fontFamily:_,textFill:d(e),fontWeight:"bold",letterSpacing:10,lineHeight:1.15}),b("产品设计师 · 七年经验",96,264,640,52,{name:"副标题",fontSize:36,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:2}),b(`138 0000 0000
|
|
474
474
|
lin.cheng@example.com
|
|
475
|
-
浙江 · 杭州`,744,130,400,160,{name:"角标",fontSize:26,fontFamily:
|
|
476
|
-
2026 年 9 月 21 日`,640,1430,480,130,{name:"落款",fontSize:32,fontFamily:X,textFill:d(n),align:"right",lineHeight:1.75}),Y(`${ot(100,100,96)} ${ot(100,100,84)}`,830,1396,200,200,{name:"印章环",stroke:e,strokeWidth:5,opacity:.85,blendMode:"multiply"}),Y(ml(100,100,38,15),830,1396,200,200,{name:"印章星",fill:d(e),strokeWidth:0,opacity:.85,blendMode:"multiply"})],es)])}function
|
|
477
|
-
一碗牛肉面`,84,112,680,264,{name:"标题",fontSize:100,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.22}),b("藏在老小区里,开了二十年",88,388,680,50,{name:"副标题",fontSize:34,fontFamily:
|
|
478
|
-
画一张数据图`,112,250,980,300,{name:"标题",fontSize:112,fontFamily:B,textFill:d(n),fontWeight:"bold",lineHeight:1.15,letterSpacing:-2}),b("从读表格到出图,四十分钟学会",120,590,900,56,{name:"副标题",fontSize:38,fontFamily:B,textFill:d(l),letterSpacing:1}),...c(0,"讲师","阿澄 · 数据分析师"),...c(1,"时长","40 分钟"),...c(2,"难度","入门,不需要编程基础")],gr)])}const Ey={column:{title:"专栏",description:"宋体正文配一点朱红,标题、导语、图注和引文都按杂志的版式排,适合随笔、观察和长文。",pageCount:5,tags:["随笔","长文"],format:"xhs"},memo:{title:"备忘录",description:"像手机里的一页备忘录:顶栏、日期、能勾选的待办和荧光笔重点,适合清单、攻略和生活记录。",pageCount:3,tags:["清单","生活"],format:"xhs"},letter:{title:"信笺",description:"霞鹜文楷写在红格信纸上,段落首行缩进,适合书信、日记和写给自己的话。",pageCount:3,tags:["书信","日记"],format:"xhs"},night:{title:"夜读",description:"深色底、暖灰色宋体和一弯金色月亮,适合读书笔记、夜晚随笔和情绪文字。",pageCount:4,tags:["读书","随笔"],format:"xhs"},aurora:{title:"极光",description:"柔和的彩色光晕上铺一张磨砂卡片,适合生活方式、习惯清单和成长分享。",pageCount:4,tags:["生活","成长"],format:"xhs"},doc:{title:"文档",description:"知识库式的页面:顶部路径、提示框、代码块和表格,适合教程、速查表和干货整理。",pageCount:4,tags:["教程","干货"],format:"xhs"},xuan:{title:"宣纸",description:"宣纸底色、宋体首行缩进,页码刻成一方朱红印章,适合节气、诗词和传统文化。",pageCount:4,tags:["国风","节气"],format:"xhs"},swiss:{title:"瑞士",description:"黑色粗线、一抹红和大号页码,像一页国际主义版式,适合设计、方法和观点。",pageCount:4,tags:["观点","方法"],format:"xhs"},journal:{title:"手账",description:"点阵纸上的霞鹜文楷,配荧光笔标题、胶带和便利贴,适合周末记录、vlog 和手账。",pageCount:4,tags:["手账","生活"],format:"xhs"}},Ii=(e,n,r)=>({title:e,description:n,pageCount:3,tags:r,format:"xhs"}),Re=(e,n,r,s)=>({title:e,description:n,pageCount:1,tags:r,format:s}),zy={editorial:Ii("编辑部","用刊头和正文网格组织长文,适合观点与方法文章。",["观点","方法"]),checklist:Ii("清单","把步骤排成可以逐项勾选的工作页,适合教程和计划。",["教程","清单"]),signal:Ii("信号","用海报式大标题亮出判断,适合短观点。",["观点","短文"]),"night-flight":Ii("夜航","沿时间和路线展开一段记录,适合随笔与灵感。",["随笔","灵感"]),brutalist:Ii("粗野","黄黑撞色、硬阴影和粗线,适合宣言与规则清单。",["宣言","海报"]),blueprint:Ii("蓝图","工程网格、尺寸标注和图签,适合计划与结构拆解。",["计划","结构"]),thesis:{title:"答辩",description:"16:9 答辩套图:深蓝封面上一枚金色细线校徽,桂枝围着一本打开的书,配衬线大标题;内页米白底,左边一道深蓝书脊,章节号和罗马数字编号用金色斜体,结尾页写着「恳请各位老师批评指正」,适合毕业答辩、开题报告和学术汇报。",pageCount:3,tags:["答辩","学术"],format:"landscape"},spotlight:{title:"聚光",description:"16:9 演示套图:暖白底上一轮橙色大圆,黑色粗体大标题、细线和大页码,观点页整页铺橙色,适合汇报、路演、课程和分享。",pageCount:3,tags:["演示","汇报"],format:"landscape"},"talk-poster":Re("讲座","大图配大标题,时间、地点、嘉宾一目了然,适合讲座、分享会和活动报名。",["活动","讲座"],"story"),"sale-poster":Re("促销","大字优惠配产品插画,适合新品、折扣和门店活动。",["促销","门店"],"story"),"hiring-poster":Re("招聘","团队头像排成一格,空着的那格留给新人,下面列职位和投递方式,适合招聘和团队介绍。",["招聘","团队"],"story"),"festival-poster":Re("节日","月亮、祥云和竖排标题,适合中秋等节日问候。",["节日","问候"],"story"),invitation:Re("邀请函","金色边框、居中排版,适合晚宴、发布会和典礼邀请。",["邀请","活动"],"story"),"quote-card":Re("金句","一句话配出处,适合金句、日签和读书摘抄。",["金句","日签"],"square"),"product-card":Re("商品主图","产品图配卖点和价格角标,适合电商主图和新品介绍。",["电商","产品"],"square"),"video-cover":Re("视频封面","相机取景框里的超大标题,带录制、时间码和对焦框,适合视频和直播封面。",["封面","视频","vlog"],"landscape"),"article-cover":Re("公众号首图","标题在左、图片在右,适合公众号文章首图。",["封面","公众号"],"wechat-cover"),flyer:Re("宣传单","A4 单页:大标题、插画、时间地点和预约按钮,适合课程和活动传单。",["印刷","课程"],"a4"),"note-cover":Re("干货笔记","格子纸、荧光笔大标题和三条要点,适合小红书知识类笔记封面。",["小红书","封面"],"xhs"),"photo-cover":Re("图片拼贴","照片配胶带和角标贴纸,下面是大标题,适合小红书探店、旅行和生活封面。",["小红书","封面"],"xhs"),menu:Re("菜单","A4 单页:店名大标题、八道菜品和价格,适合咖啡店、餐厅和饮品菜单。",["菜单","餐饮"],"a4"),"price-list":Re("价目表","撕下来的小票:虚线隔开的项目和价格、预约框和条码,适合美甲、美发、咖啡和工作室。",["价目表","门店","小票"],"story"),certificate:Re("证书","金色双框、居中大字和奖章,适合荣誉证书、获奖证书和结业证书。",["证书","印刷"],"a4-landscape"),"moments-grid":Re("朋友圈九宫格","一整张插画配横跨中间一排的大标题,导出时切成九张,发朋友圈拼成一张大图。",["朋友圈","节日"],"moments-grid"),timetable:Re("课程表","表格按科目自动配色,适合学校课程表、培训排课和每周计划。",["课程表","学校"],"a4-landscape"),"data-roundup":Re("数据盘点","朱红大年份配三个大数字和一张柱状图,像杂志的数据页,适合年度盘点、月度总结和数据海报。",["盘点","数据"],"story"),"birthday-card":Re("生日贺卡","花体 Happy Birthday 配宋体祝福和几片彩纸,适合生日祝福、纪念日和好友卡片。",["生日","祝福"],"square"),"compare-table":Re("对比表","蓝色刊头配一张大字号的对比表格和一句结论,适合产品对比、方案选择和清单式总结。",["对比","清单"],"story"),"growth-timeline":Re("成长记录","墨绿底上金色大年份和一条时间线,一个节点一件事,适合年度总结、成长复盘和里程碑打卡。",["成长","复盘"],"story"),"exhibition-poster":Re("展览海报","黑白水墨条纹配超大 exhibition. 字标,适合展览、发布会和艺术活动。",["展览","活动"],"story"),"launch-poster":Re("新品预告","深色底上的彩色光斑、毛玻璃信息板和 COMING SOON 大字,适合新品预告、发布倒计时和预约。",["新品","预告"],"story"),"solar-term":Re("节气","水墨远山、落日和竖排毛笔大字,配一方红印,适合节气、节日和传统文化日签。",["节气","国风"],"story"),"podcast-cover":Re("播客封面","包豪斯色块和几何圆,配期数大字,适合播客、电台和系列节目封面。",["播客","封面"],"square"),"pitch-cover":Re("演示封面","雾面渐变底上一行巨大的标题,适合商业计划书、汇报和演讲的首页。",["演示","汇报"],"landscape"),"portfolio-cover":Re("作品集封面","Playfair 大字 PORTFOLIO 压在黑白照片上,配一枚红签,适合作品集、摄影集和个人主页封面。",["作品集","封面"],"xhs"),"dessert-menu":Re("甜品菜单","A4 单页:竖排大标题、八道甜品和价格,两角配橙黄蓝的花,适合甜品店、面包店和下午茶菜单。",["菜单","餐饮"],"a4"),"wedding-invitation":Re("婚礼请柬","尤加利叶环里写着花体 Save the Date 和两个人的名字,适合婚礼、订婚和纪念日邀请。",["婚礼","邀请"],"story"),"autumn-market":Re("秋日市集","枫叶和银杏叶上下围着宋体大标题,适合市集、秋季活动和周末聚会。",["市集","活动"],"xhs"),"magazine-cover":Re("杂志封面","Playfair 大字刊名、细线刊头和一张大图,像一本独立杂志的封面,适合小红书封面、专题和期刊。",["杂志","封面"],"xhs"),"book-list":Re("书单","一排彩色书脊立在书架上,书名竖排在书脊里,下面一本一句推荐,适合书单、好物清单和年度推荐。",["书单","读书"],"xhs"),"word-of-year":Re("年度汉字","一个毛笔大字配拼音和一方朱红印章,适合年度汉字、年终总结和新年愿望。",["年终","国风"],"story"),"music-festival":Re("音乐节","夜空里一轮被地平线切开的渐变太阳和霓虹网格,配大字标题和演出阵容,适合音乐节、演出和派对。",["音乐","活动"],"story"),"travel-postcard":Re("旅行明信片","红蓝航空信封边、带齿孔的邮票和邮戳,霞鹜文楷写在横线上,适合旅行分享、问候和祝福。",["旅行","问候"],"xhs"),"design-week":Re("设计周","黑字大号数字压在一个红圆上,下面三栏信息,国际主义版式,适合设计周、展会和论坛。",["展会","设计"],"story"),"double-eleven":Re("双十一","一张大优惠券上印着立体的 11.11,下面是活动名、满减、时间和抢购按钮,适合双十一、年货节和店铺大促。",["双十一","促销"],"story"),"christmas-card":Re("圣诞","毛衣花样织在领口:雪花、圣诞树和锯齿纹,下摆是罗纹,中间写 MERRY CHRISTMAS 和祝福,适合圣诞贺卡、平安夜问候和圣诞活动。",["圣诞","节日"],"xhs"),"new-year-calendar":Re("元旦","一本手撕日历:去年最后一页刚撕掉,新的一页印着大大的 1、今天的标题和宜忌,适合元旦、跨年和新年计划。",["元旦","新年"],"xhs"),"spring-festival":Re("春节","整张是一个红包:封口压着金色的福字圆章,下面是毛笔大字、祝福和日期,适合春节拜年、新春祝福和放假通知。",["春节","国风"],"story"),"listicle-cover":Re("数字清单","公众号首图:左边一块朱红色压着一个巨大的编号,右边是宋体大标题,适合清单、干货和系列文章。",["公众号","清单"],"wechat-cover"),"ridge-cover":Re("远山","公众号首图:晨雾里五层山脊叠向远处,太阳半落在山后,宋体标题写在天上,适合旅行、随笔和生活方式。",["公众号","旅行"],"wechat-cover"),"summit-visual":Re("大会主视觉","横版主视觉:深夜蓝底上几圈轨道绕着一颗发光的球,左边是大标题、时间和地点,适合大会、峰会和发布会的背景板。",["大会","主视觉"],"landscape"),"gala-backdrop":Re("年会","横版主视觉:黑底金线的装饰艺术风,扇形光芒、双线框和渐变金色大字,适合年会、颁奖礼和晚宴。",["年会","主视觉"],"landscape"),"agenda-sheet":Re("会议议程","A4 横版:左边钴蓝色块写会议名、日期和地点,右边细线隔开的六行日程,适合会议、论坛和活动流程。",["议程","会议"],"a4-landscape"),"annual-report":Re("年度报告","A4 封面:超大的年份压在金色等高线上,下面是宋体标题,适合年度报告、企业画册和白皮书。",["报告","封面"],"a4"),"stat-card":Re("数据卡","方图:克莱因蓝底上一个巨大的数字,下面一句话说清它是什么,适合数据发布、调查结论和社交分享。",["数据","社交"],"square"),countdown:Re("倒计时","方图:六十格刻度的表盘中间一个大数字,下面写活动和时间,适合发布会、开售和考试倒计时。",["倒计时","活动"],"square"),"versus-cover":Re("对比测评","小红书封面:黄黑两栏斜着对开,中间一枚 VS 徽章,两边各写一个名字和一句结论,适合对比测评、二选一和选购攻略。",["小红书","测评"],"xhs"),"habit-tracker":Re("打卡计划","小红书封面:三十个圆圈排成打卡格,已完成的涂绿打勾,配宋体大标题,适合打卡挑战、学习计划和习惯养成。",["小红书","打卡"],"xhs"),"fun-fact":Re("冷知识","小红书封面:明黄底上一个巨大的白色问号,问题写成大标题,下面一段解答,适合冷知识、科普和问答。",["小红书","科普"],"xhs"),"trip-route":Re("旅行攻略","小红书封面:海岸线边的手绘地图,虚线路线串起四个编号地点,每站一行名字,适合旅行攻略、路线规划和城市漫游。",["小红书","旅行"],"xhs"),"ranking-cover":Re("年度排行","小红书封面:黑底上五条由长到短的橙色名次条,每条写一个名字,适合排行榜、年度推荐和好物清单。",["小红书","排行"],"xhs"),"grand-opening":Re("开业大吉","红白条纹的遮阳篷下挂着 OPEN 招牌,复古双线框里是宋体红字大标题、三行开业优惠、营业时间地址和领券按钮,适合开业、新店开张和周年庆。",["开业","门店"],"story"),"race-bib":Re("马拉松","橙色速度线上别着一张号码布:大号码、赛事名和公里数,下面三行时间、起点和报名,适合马拉松、夜跑和运动赛事。",["运动","赛事"],"story"),"live-show":Re("直播预告","黑底上亮着红色的 ON AIR 灯牌,大标题、开播时间和平台,底部一排声波,适合直播预告、带货专场和线上发布。",["直播","预告"],"story"),"qixi-stars":Re("七夕","靛紫夜空里一条银河,织女星和牛郎星隔河相望,鹊桥连起两颗星,金色宋体大字,适合七夕、情人节和纪念日。",["七夕","节日"],"story"),"dragon-boat":Re("端午","一条龙舟划过朱红的太阳,下面是海水纹,竖排毛笔大字配一方朱印,左边写日子和放假安排,适合端午问候、放假通知和门店活动。",["端午","国风"],"story"),"vinyl-cover":Re("黑胶歌单","方图:一张黑胶唱片从深蓝封套里滑出半张,封套上印着歌单名,下面三行曲目,适合歌单、播客和音乐推荐。",["歌单","音乐"],"square"),"intro-card":Re("自我介绍","方图:一张红色的 HELLO 姓名贴,白底上手写你的名字,下面三栏写坐标、职业和爱好,适合自我介绍、新人报到和社群破冰。",["自我介绍","社交"],"square"),"daily-quote":Re("日签","方图:深蓝夜空里一排月相,中间的满月是今晚,大号日期配一句话,适合日签、晚安和每日打卡。",["日签","晚安"],"square"),"masthead-cover":Re("报头首图","公众号首图:像一份报纸的头版,宋体报头、双线和日期栏,大标题旁边是一张网点印出来的海上日落,适合周刊、专栏和资讯。",["公众号","周刊"],"wechat-cover"),"interview-cover":Re("人物访谈","公众号首图:左边一块赤陶色上压着两个巨大的引号,右边是受访者的一句话、名字和身份,适合人物访谈、对话和用户故事。",["公众号","访谈"],"wechat-cover"),resume:Re("简历","A4:粗黑的名字和蓝色的职位,右上角是联系方式,一道粗线下面写关于我,再按时间排五行工作与教育,适合求职简历和个人履历。",["简历","求职"],"a4"),notice:Re("红头通知","A4:红色的单位名称和文号,红线中间一颗星,下面是通知标题、称呼、正文和五条事项,落款上盖着红章,适合放假通知、公司公告和社团通知。",["通知","公告"],"a4"),"food-review":Re("探店点评","小红书封面:俯视的一碗牛肉面,筷子架在碗边,右上角一枚红色评分章,下面三行人均、推荐和地址,适合探店、美食点评和餐厅推荐。",["小红书","探店"],"xhs"),"course-cover":Re("课程封面","16:9 横版封面:方格纸上一个明黄大圆写着课号,一支铅笔斜靠在圆边,左边是课程标题、一句介绍和讲师、时长、难度,适合网课封面、培训和分享会。",["课程","封面"],"landscape")},Ry={editorial:$x,checklist:Px,signal:Wx,"night-flight":Ox,brutalist:Bx,blueprint:Yx,spotlight:qx,thesis:Jx,"talk-poster":rb,"sale-poster":ab,"hiring-poster":sb,"festival-poster":ob,invitation:lb,"quote-card":cb,"product-card":db,"video-cover":ub,"article-cover":fb,flyer:hb,"note-cover":mb,"photo-cover":pb,menu:gb,"price-list":yb,certificate:jb,"moments-grid":wb,timetable:kb,"data-roundup":Fb,"birthday-card":Eb,"growth-timeline":Cb,"compare-table":Sb,"exhibition-poster":vb,"launch-poster":Nb,"solar-term":Mb,"podcast-cover":zb,"pitch-cover":Rb,"portfolio-cover":Ib,"dessert-menu":Lb,"wedding-invitation":$b,"autumn-market":Db,"magazine-cover":Pb,"book-list":Tb,"word-of-year":Wb,"music-festival":Hb,"travel-postcard":_b,"design-week":Bb,"double-eleven":Vb,"christmas-card":Xb,"new-year-calendar":Qb,"spring-festival":Jb,"listicle-cover":ty,"ridge-cover":ny,"summit-visual":ry,"gala-backdrop":ay,"agenda-sheet":iy,"annual-report":sy,"stat-card":oy,countdown:ly,"versus-cover":cy,"habit-tracker":dy,"fun-fact":uy,"trip-route":fy,"ranking-cover":hy,"grand-opening":my,"race-bib":py,"live-show":gy,"qixi-stars":xy,"dragon-boat":by,"vinyl-cover":yy,"intro-card":jy,"daily-quote":ky,"masthead-cover":Sy,"interview-cover":vy,resume:Ny,notice:My,"food-review":Fy,"course-cover":Cy},Iy=["column","memo","letter","night","aurora","doc","xuan","swiss","journal"],Ly=["editorial","checklist","signal","night-flight","brutalist","blueprint","spotlight","thesis","note-cover","photo-cover","magazine-cover","book-list","versus-cover","ranking-cover","fun-fact","trip-route","food-review","habit-tracker","portfolio-cover","menu","dessert-menu","price-list","certificate","moments-grid","timetable","agenda-sheet","resume","notice","exhibition-poster","design-week","music-festival","race-bib","talk-poster","launch-poster","countdown","grand-opening","sale-poster","double-eleven","live-show","hiring-poster","spring-festival","new-year-calendar","christmas-card","qixi-stars","dragon-boat","festival-poster","solar-term","word-of-year","invitation","wedding-invitation","birthday-card","travel-postcard","autumn-market","quote-card","daily-quote","intro-card","product-card","video-cover","pitch-cover","course-cover","summit-visual","gala-backdrop","annual-report","podcast-cover","vinyl-cover","article-cover","listicle-cover","ridge-cover","masthead-cover","interview-cover","flyer","data-roundup","stat-card","compare-table","growth-timeline"];function $y(e){return{...Ey[e],id:`${e}-markdown`,series:e,workspace:"markdown",kind:"deck",createMarkdown:()=>zx(e)}}function Dy(e){const n=zy[e];return{...n,id:`${e}-freeform`,series:e,workspace:"freeform",kind:n.pageCount===1?"poster":"deck",createFreeform:()=>Ry[e]()}}const ci=[...Iy.map($y),...Ly.map(Dy)];function wd(e){return ci.filter(n=>n.workspace===e)}const Ho=()=>{};function Oo(e){return Number.isFinite(e)&&e>0?e:1}function Lf(...e){return e.filter(Boolean).join(" ")}const Xs=p.memo(function({slide:n,frameWidth:r,frameHeight:s,className:l,artboardClassName:o,deferOffscreen:c=!1}){const f=p.useRef(null),[h,g]=p.useState(!c),x=Oo(r),m=Oo(s),j=Oo(n.width),k=Oo(n.height),v=Math.min(x/j,m/k),w=j*v,N=k*v,M={left:(x-w)/2,top:(m-N)/2,width:j,height:k,background:Zh(n.background),transform:`scale(${v})`};return p.useEffect(()=>{if(!c){g(!0);return}const I=f.current;if(!I||typeof IntersectionObserver>"u"){g(!0);return}const F=new IntersectionObserver(([z])=>{g(z.isIntersecting)},{root:I.closest(".freeform-slide-list"),rootMargin:"192px"});return F.observe(I),()=>F.disconnect()},[c]),t.jsx("div",{ref:f,className:Lf("freeform-slide-preview",l),style:{width:x,height:m},"aria-hidden":"true",children:t.jsxs("div",{className:Lf("freeform-slide-preview-artboard",o),style:M,children:[h&&t.jsx(Xh,{slide:n,presentationOnly:!0}),h&&t.jsx(qh,{nodes:n.nodes,slideId:n.id,presentationOnly:!0,activeParentPath:["__preview__"],selectedPaths:[],onNodePointerDown:Ho,onNodeDoubleClick:Ho,onTextChange:Ho,onTextFocus:Ho})]})})});function Ay(e){const{html:n,role:r}=Lm(e,0);return{html:n,role:r}}function Lm(e,n){const r=Qh(e.source),s=[[]];for(const h of r)h.isBreak?s.push([]):s[s.length-1].push(h);const l=s.filter(h=>h.length>0);l.length===0&&l.push([]);const o=Math.min(Math.max(n,0),l.length-1),c=l[o],f=[...r].reverse().find(h=>!h.isBreak);return{html:c.map(h=>h.html).join(""),pageCount:l.length,role:I1({themeId:e.themeId,blocks:c,pageIndex:o,includesLastContentBlock:f!==void 0&&c.includes(f)})}}function kd(e,n,r){return{...Jh(r,n),"--template-scale":String(e)}}function Yn({source:e,width:n,height:r,page:s=0,className:l,lazy:o=!1}){const c=r??Math.round(n*4/3);return e.kind==="markdown"?t.jsx(Py,{document:e.document,page:s,width:n,height:c,className:l}):t.jsx(Ty,{document:e.document,page:s,width:n,height:c,className:l,lazy:o})}function Py({document:e,page:n,width:r,height:s,className:l}){const o=p.useMemo(()=>{if(e.images)for(const[g,x]of Object.entries(e.images))Et.images.register(g,x);return Lm(e,n)},[e,n]),c=mr.find(g=>g.id===e.platformId)??mr[0],f=bl(c,Ls(e.themeId),e.fontFamily),h=Math.min(r/f.width,s/f.height);return t.jsx("div",{className:["doc-preview","doc-preview-md",l].filter(Boolean).join(" "),style:{width:r,height:s,...kd(h,e.radius,f)},"aria-hidden":"true",children:t.jsx(yl,{html:o.html,config:f,profile:e.profile??Kn,pageIndex:n,pageCount:Math.max(n+1,o.pageCount),pageRole:o.role,showHeader:n===0||!(e.profile??Kn).headerFirstPageOnly,title:cd(e.source)})})}function Ty({document:e,page:n,width:r,height:s,className:l,lazy:o}){const c=e.slides[Math.min(n,e.slides.length-1)],f=["doc-preview","doc-preview-ff",l].filter(Boolean).join(" ");return c?t.jsx("div",{className:f,style:{width:r,height:s},"aria-hidden":"true",children:t.jsx(Xs,{slide:c,frameWidth:r,frameHeight:s,deferOffscreen:o})}):t.jsx("div",{className:f,style:{width:r,height:s}})}function Zi({className:e,style:n,children:r}){const s=p.useRef(null),[l,o]=p.useState(0);return p.useEffect(()=>{const c=s.current;if(!c)return;const f=()=>o(Math.floor(c.getBoundingClientRect().width));f();const h=new ResizeObserver(f);return h.observe(c),()=>h.disconnect()},[]),t.jsx("div",{ref:s,className:e,style:n,children:l>0?r(l):null})}function qs(e,n,r){const s=p.useRef(r);s.current=r,p.useEffect(()=>{if(!n)return;const l=c=>{var f;(f=e.current)!=null&&f.contains(c.target)||s.current()},o=c=>{c.key==="Escape"&&s.current()};return document.addEventListener("pointerdown",l),document.addEventListener("keydown",o),()=>{document.removeEventListener("pointerdown",l),document.removeEventListener("keydown",o)}},[n,e])}function Sd({align:e="end",className:n}){const r=na(),[s,l]=p.useState(!1),o=p.useRef(null),c=p.useRef(null),f=p.useId(),h=fc.find(j=>j.id===r)??fc[0];qs(o,s,()=>l(!1)),p.useEffect(()=>{var j,k;s&&((k=(j=o.current)==null?void 0:j.querySelector('[role="menuitemradio"][aria-checked="true"]'))==null||k.focus())},[s]);function g(){var j;l(!1),(j=c.current)==null||j.focus()}function x(j){g(),em(j)}function m(j){var N;const k=Array.from(j.currentTarget.querySelectorAll('[role="menuitemradio"]')),v=k.findIndex(M=>M===document.activeElement);let w=-1;if(j.key==="ArrowDown")w=(v+1)%k.length;else if(j.key==="ArrowUp")w=(v-1+k.length)%k.length;else if(j.key==="Home")w=0;else if(j.key==="End")w=k.length-1;else if(j.key==="ArrowLeft"||j.key==="ArrowRight")w=v;else if(j.key==="Escape"){j.preventDefault(),j.stopPropagation(),g();return}else if(j.key==="Tab"){l(!1);return}else return;j.preventDefault(),j.stopPropagation(),(N=k[w])==null||N.focus()}return t.jsxs("div",{className:["lang-menu",n].filter(Boolean).join(" "),ref:o,children:[t.jsxs("button",{ref:c,className:"lang-trigger",type:"button","aria-haspopup":"menu","aria-expanded":s,"aria-controls":s?f:void 0,"aria-label":i("界面语言:{name}",{name:h.label}),title:i("界面语言"),"data-testid":"language-menu",onClick:()=>l(j=>!j),onKeyDown:j=>{j.key!=="ArrowDown"||s||(j.preventDefault(),j.stopPropagation(),l(!0))},children:[t.jsx(wm,{}),t.jsx("span",{className:"lang-current",children:h.label}),t.jsx(hd,{className:"lang-chevron"})]}),s&&t.jsx("div",{id:f,className:`menu lang-list is-${e}`,role:"menu","aria-label":i("界面语言"),onKeyDown:m,children:fc.map(j=>t.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":r===j.id,lang:j.id==="zh"?"zh-CN":"en",onClick:()=>x(j.id),children:[t.jsx("span",{className:"lang-name",children:j.label}),t.jsx(H2,{className:"lang-check"})]},j.id))})]})}const Wy=["xuan-markdown","portfolio-cover-freeform","column-markdown","night-flight-freeform","aurora-markdown"];function va(e){var r,s;if(e.workspace==="markdown"){const l=(r=e.createMarkdown)==null?void 0:r.call(e);return l?{kind:"markdown",document:l}:null}const n=(s=e.createFreeform)==null?void 0:s.call(e);return n?{kind:"freeform",document:n}:null}function Hy({onAuthed:e,onGuest:n}){const[r,s]=p.useState("login"),[l,o]=p.useState(""),[c,f]=p.useState(""),[h,g]=p.useState(null),[x,m]=p.useState(!1),j=p.useId(),k=p.useMemo(()=>Wy.map(N=>ci.find(M=>M.id===N)).filter(N=>!!N).map(N=>({id:N.id,source:va(N)})).filter(N=>N.source!==null),[]);async function v(N){N.preventDefault(),g(null),m(!0);try{const M=r==="login"?await Et.auth.login(l,c):await Et.auth.register(l,c);e(M)}catch(M){g(M instanceof Error&&M.message?i(M.message):i("出错了,请重试")),m(!1)}}const w=r==="register";return na(),t.jsxs("div",{className:"login","data-testid":"login-page",children:[t.jsxs("section",{className:"login-show","aria-label":i("叮卡能做什么"),children:[t.jsxs("div",{className:"login-brand",children:[t.jsx("img",{src:vl,alt:"",width:"28",height:"28"}),i("叮卡")]}),t.jsx("div",{className:"login-fan","aria-hidden":"true",children:k.map(N=>t.jsx("div",{className:"login-fan-card",children:t.jsx(Yn,{source:N.source,width:240})},N.id))}),t.jsxs("div",{className:"login-copy",children:[t.jsxs("h2",{children:[i("长文自动排成卡片,"),t.jsx("br",{}),i("海报随手自由排版")]}),t.jsx("p",{children:i("Markdown 卡片把一篇长文切成一组小红书、微博、推特卡片;自由编辑像做海报一样摆放文字、图片和形状。")}),t.jsxs("ul",{className:"login-facts",children:[t.jsxs("li",{children:[t.jsx("b",{children:"2"})," ",i("套编辑器,一个工作台")]}),t.jsxs("li",{children:[t.jsx("b",{children:ci.length})," ",i("套成品模板")]}),t.jsxs("li",{children:[t.jsx("b",{children:"MIT"})," ",i("开源,可自部署")]})]})]})]}),t.jsxs("section",{className:"login-panel",children:[t.jsx(Sd,{className:"login-lang"}),t.jsxs("form",{className:"login-form",onSubmit:v,"aria-labelledby":j,children:[t.jsxs("div",{children:[t.jsx("h1",{id:j,children:w?i("创建叮卡账号"):i("欢迎回来")}),t.jsx("p",{className:"login-sub",children:w?i("只需要用户名和密码。"):i("登录后继续编辑你的项目。")})]}),t.jsxs("div",{className:"login-seg",role:"group","aria-label":i("登录或注册"),children:[t.jsx("button",{type:"button","aria-pressed":!w,onClick:()=>{s("login"),g(null)},children:i("登录")}),t.jsx("button",{type:"button","aria-pressed":w,onClick:()=>{s("register"),g(null)},children:i("注册")})]}),t.jsxs("label",{className:"login-field",children:[t.jsx("span",{children:i("用户名")}),t.jsx("input",{className:"text-input",value:l,autoComplete:"username",autoFocus:!0,onChange:N=>o(N.target.value),placeholder:i("至少 2 个字符")})]}),t.jsxs("label",{className:"login-field",children:[t.jsx("span",{children:i("密码")}),t.jsx("input",{className:"text-input",type:"password",value:c,autoComplete:w?"new-password":"current-password",onChange:N=>f(N.target.value),placeholder:i("至少 4 个字符")})]}),h&&t.jsx("div",{className:"form-error",role:"alert",children:h}),t.jsx("button",{className:"accent login-submit",type:"submit",disabled:x,"data-testid":"login-submit",children:x?i("请稍候…"):w?i("创建账号并进入"):i("登录")}),t.jsx("div",{className:"login-or",children:i("或")}),t.jsx("button",{className:"ghost login-guest",type:"button",onClick:n,"data-testid":"login-guest",children:i("不注册,直接开始")}),t.jsxs("p",{className:"login-note",children:[t.jsx(hl,{}),t.jsx("span",{children:Et.remote?i("账号保存在你部署的服务器上,登录后可在多台设备间同步项目。不注册也能用,项目会自动保存在这台设备上。"):i("账号和项目只保存在这台设备的浏览器里,不会上传。不注册也会自动保存;部署服务端后可在多台设备间同步。")})]})]})]})]})}function Oy(e){return e==="markdown-card"?"markdown":"freeform"}function $m(e){return e.workspace==="markdown"?"markdown-card":"freeform-slide"}function Ts(e){return wd(Oy(e))}function _y(e,n){return Ts(e).find(r=>r.id===n)??null}const By="slicer.last-session.",_o={mode:"markdown-card",markdownDraftId:null,freeformDraftId:null};function Dm(e){return By+e}function Ky(e){return e==="markdown-card"||e==="freeform-slide"}function $f(e){return typeof e=="string"&&e.length>0}function Qs(e){if(!e)return{..._o};let n=null;try{const s=localStorage.getItem(Dm(e));n=s?JSON.parse(s):null}catch{return{..._o}}if(!n||typeof n!="object"||Array.isArray(n))return{..._o};const r=n;return{mode:Ky(r.mode)?r.mode:_o.mode,markdownDraftId:$f(r.markdownDraftId)?r.markdownDraftId:null,freeformDraftId:$f(r.freeformDraftId)?r.freeformDraftId:null}}function Na(e,n){if(!e)return;const r={...Qs(e),...n};try{localStorage.setItem(Dm(e),JSON.stringify(r))}catch{}}function Fl({title:e,detail:n,onDismiss:r,onRetry:s,retryLabel:l=i("重试"),tone:o="info",className:c=""}){return t.jsxs("div",{className:`operation-notice operation-notice--${o} ${c}`.trim(),role:"alert","aria-atomic":"true",children:[t.jsx("span",{className:"operation-notice-mark","aria-hidden":"true"}),t.jsxs("div",{className:"operation-notice-copy",children:[t.jsx("strong",{children:e}),n&&t.jsx("span",{children:n})]}),t.jsxs("div",{className:"operation-notice-actions",children:[s&&t.jsx("button",{type:"button",className:"operation-notice-retry",onClick:s,children:l}),t.jsx("button",{type:"button",className:"operation-notice-dismiss","aria-label":i("关闭提示"),title:i("关闭提示"),onClick:r,children:t.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:t.jsx("path",{d:"m4 4 8 8m0-8-8 8"})})})]})]})}const Vy=500;function Df(e,n){const r=Array.from(n,s=>s.codePointAt(0).toString(16)).join("-");return`${e}-option-${r||"empty"}`}function Gy(e){let n=e;for(;n;){if(n.hasAttribute("inert"))return!0;n=n.parentElement}return!1}function Uy(e){let n=e.parentElement;for(;n;){if(n.matches(":disabled")&&!(n instanceof HTMLFieldSetElement))return!0;n=n.parentElement}return!1}function Yy(e){return e.hasAttribute("tabindex")||e.isContentEditable?!0:e instanceof HTMLAnchorElement||e instanceof HTMLAreaElement?e.hasAttribute("href"):e instanceof HTMLInputElement?e.type!=="hidden":e instanceof HTMLButtonElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e.tagName==="SUMMARY"}function Zy(e){if(!(e instanceof Element)||Gy(e))return null;let n=e;for(;n;){if(n instanceof HTMLElement&&Yy(n))return n.matches(":disabled")||Uy(e)?null:n;n=n.parentElement}return null}function qr({value:e,options:n,onChange:r,title:s,testId:l,previewFonts:o}){const[c,f]=p.useState(!1),[h,g]=p.useState(null),x=p.useRef(null),m=p.useRef(null),j=p.useRef(""),k=p.useRef(null),v=p.useId(),w=n.length>0,N=c&&w,M=n.findIndex(D=>D.id===e),I=n[M]??n[0],F=n.findIndex(D=>D.id===h),z=w?F>=0?F:Math.max(0,M):-1,A=z>=0?n[z].id:null;function T(){j.current="",k.current!==null&&(globalThis.clearTimeout(k.current),k.current=null)}function L(){T(),f(!1)}function H(D){if(!w)return;const re=Math.min(n.length-1,Math.max(0,D??M));g(n[re].id),f(!0)}p.useEffect(()=>{if(!N)return;const D=re=>{var te;if(!x.current||x.current.contains(re.target))return;L(),Zy(re.target)||(re.preventDefault(),(te=m.current)==null||te.focus())};return document.addEventListener("pointerdown",D),()=>document.removeEventListener("pointerdown",D)},[N]),p.useEffect(()=>{w||(T(),g(null),f(!1))},[w]),p.useEffect(()=>{!N||F>=0||A===null||g(A)},[N,A,F]),p.useEffect(()=>()=>T(),[]);function P(D){const re=n[D];re&&(L(),r(re.id))}function U(D){const re=`${j.current}${D}`.toLocaleLowerCase();j.current=re,k.current!==null&&globalThis.clearTimeout(k.current),k.current=globalThis.setTimeout(()=>{j.current="",k.current=null},Vy);for(let q=1;q<=n.length;q+=1){const te=(z+q)%n.length,be=n[te].label.toLocaleLowerCase();if(be.startsWith(re)||be.split(/\s+/).some(Be=>Be.startsWith(re))){g(n[te].id);return}}}function K(D){var re;if(!N){(D.key==="Enter"||D.key===" "||D.key==="ArrowDown"||D.key==="ArrowUp")&&(D.preventDefault(),D.stopPropagation(),H(D.key==="ArrowUp"?n.length-1:void 0));return}if(D.key==="Tab"){L();return}if(D.key==="Escape")D.preventDefault(),D.stopPropagation(),L(),(re=m.current)==null||re.focus();else if(D.key==="ArrowDown"){D.preventDefault(),D.stopPropagation();const q=Math.min(n.length-1,z+1);g(n[q].id)}else if(D.key==="ArrowUp"){D.preventDefault(),D.stopPropagation();const q=Math.max(0,z-1);g(n[q].id)}else D.key==="Home"?(D.preventDefault(),D.stopPropagation(),g(n[0].id)):D.key==="End"?(D.preventDefault(),D.stopPropagation(),g(n[n.length-1].id)):D.key==="Enter"||D.key===" "?(D.preventDefault(),D.stopPropagation(),P(z)):D.key.length===1&&!D.altKey&&!D.ctrlKey&&!D.metaKey&&(D.preventDefault(),D.stopPropagation(),U(D.key))}return t.jsxs("div",{className:"sel",ref:x,title:s,children:[t.jsxs("button",{ref:m,type:"button",role:"combobox",className:N?"sel-trigger open":"sel-trigger",onClick:()=>N?L():H(),onKeyDown:K,"aria-label":s,"aria-haspopup":"listbox","aria-expanded":N,"aria-controls":N?v:void 0,"aria-activedescendant":N?Df(v,n[z].id):void 0,disabled:!w,"data-testid":l,children:[t.jsxs("span",{className:"sel-content",children:[(I==null?void 0:I.swatch)&&t.jsx("span",{className:"sel-swatch",style:{background:I.swatch.bg},"aria-hidden":"true",children:t.jsx("span",{className:"sel-swatch-dot",style:{background:I.swatch.accent}})}),t.jsx("span",{className:"sel-value",style:o&&I?{fontFamily:I.previewFont??I.id}:void 0,children:(I==null?void 0:I.label)??i("暂无选项")})]}),t.jsx("svg",{className:"sel-caret",viewBox:"0 0 10 6",width:"10",height:"6","aria-hidden":!0,children:t.jsx("path",{d:"M1 1l4 4 4-4",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),N&&t.jsx("ul",{className:"sel-panel",role:"listbox",id:v,children:n.map((D,re)=>t.jsxs("li",{id:Df(v,D.id),role:"option","aria-selected":D.id===e,className:"sel-option"+(D.id===e?" selected":"")+(re===z?" hover":""),style:o?{fontFamily:D.previewFont??D.id}:void 0,onMouseEnter:()=>g(D.id),onMouseDown:q=>q.preventDefault(),onClick:q=>{q.preventDefault(),q.stopPropagation(),P(re)},children:[t.jsxs("span",{className:"sel-option-content",children:[D.swatch&&t.jsx("span",{className:"sel-swatch",style:{background:D.swatch.bg},"aria-hidden":"true",children:t.jsx("span",{className:"sel-swatch-dot",style:{background:D.swatch.accent}})}),t.jsx("span",{className:"sel-option-label",children:D.label})]}),D.id===e&&t.jsx("svg",{className:"sel-check",viewBox:"0 0 14 14",width:"14",height:"14","aria-hidden":!0,children:t.jsx("path",{d:"M2.5 7.5l3 3 6-6.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})]},D.id))})]})}function Xy(e){const n=/^data:image\/(png|jpeg|webp)/i.exec(e.src)??/\.(png|jpe?g|webp)(?:[?#]|$)/i.exec(e.src),r=((n==null?void 0:n[1])??"png").toLowerCase();return`${e.name}.${r==="jpeg"?"jpg":r}`}function Am(e){const n=document.createElement("a");n.href=e.src,n.download=Xy(e),document.body.append(n),n.click(),n.remove()}function qy(e){return new Date(e).toLocaleDateString(Bs(),{year:"numeric",month:"long",day:"numeric"})}function Qy({asset:e,onPreview:n,onRename:r,onDelete:s}){const[l,o]=p.useState(!1),[c,f]=p.useState(!1),h=p.useRef(null),g=p.useRef(!1);qs(h,l,()=>o(!1));function x(m){if(f(!1),g.current)return;const j=m.trim();j&&j!==e.name&&r(e,j)}return t.jsxs("article",{className:"asset","data-testid":"asset-card",children:[t.jsx("button",{className:"asset-thumb",type:"button",onClick:()=>n(e),"aria-label":i("查看 {name}",{name:e.name}),children:t.jsx("img",{src:e.src,alt:"",loading:"lazy",decoding:"async",draggable:!1})}),t.jsxs("div",{className:"asset-info",children:[c?t.jsx("input",{className:"text-input asset-rename","aria-label":i("素材名称"),defaultValue:e.name,maxLength:60,autoFocus:!0,onFocus:m=>m.currentTarget.select(),onBlur:m=>x(m.currentTarget.value),onKeyDown:m=>{m.key==="Enter"?m.currentTarget.blur():m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),g.current=!0,m.currentTarget.blur())}}):t.jsx("span",{className:"asset-name",title:e.name,children:e.name}),t.jsxs("span",{className:"asset-meta tnum",children:[e.width," × ",e.height," · ",jl(e.bytes)]})]}),t.jsxs("div",{className:"asset-menu",ref:h,children:[t.jsx("button",{className:"icon-btn asset-more",type:"button","aria-label":i("{name} 的更多操作",{name:e.name}),"aria-haspopup":"menu","aria-expanded":l,onClick:()=>o(m=>!m),children:t.jsx(Nl,{})}),l&&t.jsxs("div",{className:"menu asset-menu-list",role:"menu",children:[t.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{o(!1),g.current=!1,f(!0)},children:[t.jsx(md,{}),i("重命名")]}),t.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{o(!1),Am(e)},children:[t.jsx(li,{}),i("下载")]}),t.jsxs("button",{role:"menuitem",type:"button",className:"danger",onClick:()=>{o(!1),s(e)},children:[t.jsx(Ji,{}),i("删除")]})]})]})]})}function Jy({asset:e,usedBy:n,onDelete:r,onClose:s}){const l=p.useId(),o=p.useRef(null),c=p.useRef(s);return c.current=s,p.useEffect(()=>{var g;const f=document.activeElement instanceof HTMLElement?document.activeElement:null;(g=o.current)==null||g.focus();const h=x=>{x.key==="Escape"&&(x.preventDefault(),c.current())};return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h),f==null||f.focus()}},[]),t.jsx("div",{className:"modal-backdrop",onMouseDown:f=>f.target===f.currentTarget&&s(),children:t.jsxs("div",{className:"modal asset-preview",role:"dialog","aria-modal":"true","aria-labelledby":l,children:[t.jsx("div",{className:"asset-preview-stage",children:t.jsx("img",{src:e.src,alt:e.name})}),t.jsxs("div",{className:"asset-preview-side",children:[t.jsxs("div",{className:"modal-head",children:[t.jsx("h3",{id:l,children:e.name}),t.jsx("button",{ref:o,className:"modal-x",type:"button",onClick:s,"aria-label":i("关闭"),children:t.jsx(Pn,{})})]}),t.jsxs("dl",{className:"asset-facts",children:[t.jsxs("div",{children:[t.jsx("dt",{children:i("尺寸")}),t.jsxs("dd",{className:"tnum",children:[e.width," × ",e.height," px"]})]}),t.jsxs("div",{children:[t.jsx("dt",{children:i("大小")}),t.jsx("dd",{className:"tnum",children:jl(e.bytes)})]}),t.jsxs("div",{children:[t.jsx("dt",{children:i("上传于")}),t.jsx("dd",{children:qy(e.createdAt)})]}),t.jsxs("div",{children:[t.jsx("dt",{children:i("用在")}),t.jsx("dd",{className:"tnum",children:n>0?i("{n} 个项目里",{n}):i("还没有项目用到")})]})]}),t.jsx("p",{className:"asset-preview-hint",children:i("在 Markdown 卡片工具栏的「素材库」或自由编辑插入栏的「图片」里,点一下就能放进项目。")}),t.jsxs("div",{className:"modal-foot",children:[t.jsxs("button",{className:"ghost confirm-danger-ghost",type:"button",onClick:()=>r(e),children:[t.jsx(Ji,{}),i("删除")]}),t.jsxs("button",{className:"accent",type:"button",onClick:()=>Am(e),children:[t.jsx(li,{}),i("下载")]})]})]})]})})}const vd=tm.join(","),e4=25*1024*1024,t4=1800;function n4(e){return new Promise((n,r)=>{const s=new FileReader;s.onload=()=>n(String(s.result??"")),s.onerror=()=>r(s.error??new Error("无法读取图片")),s.readAsDataURL(e)})}function r4(e){return new Promise((n,r)=>{const s=new Image;s.onload=()=>n({width:s.naturalWidth,height:s.naturalHeight}),s.onerror=()=>r(new Error("图片已损坏或无法解码")),s.src=e})}function Yc(e){return Array.from(e??[]).filter(n=>n.type.startsWith("image/"))}async function a4(e){if(!tm.includes(e.type))throw new Error("只支持 PNG、JPG、WebP 图片");if(e.size>e4)throw new Error("图片超过 25 MB");const n=await ka(await n4(e),t4),{width:r,height:s}=await r4(n);return{dataUrl:n,name:L1(e.name),width:r,height:s}}function fi({title:e,body:n,confirmLabel:r,cancelLabel:s=i("取消"),danger:l=!1,onConfirm:o,onCancel:c}){const f=p.useId(),h=p.useRef(null),g=p.useRef(c);return g.current=c,p.useEffect(()=>{var j;const x=document.activeElement instanceof HTMLElement?document.activeElement:null;(j=h.current)==null||j.focus();const m=k=>{k.key==="Escape"&&(k.preventDefault(),g.current())};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m),x==null||x.focus()}},[]),t.jsx("div",{className:"modal-backdrop",onMouseDown:x=>x.target===x.currentTarget&&c(),children:t.jsxs("div",{className:"modal confirm-modal",role:"alertdialog","aria-modal":"true","aria-labelledby":f,children:[t.jsx("h3",{id:f,className:"confirm-title",children:e}),t.jsx("p",{className:"confirm-body",children:n}),t.jsxs("div",{className:"modal-foot",children:[t.jsx("button",{ref:h,className:"ghost",type:"button",onClick:c,children:s}),t.jsx("button",{className:l?"accent confirm-danger":"accent",type:"button",onClick:o,children:r})]})]})})}const i4={truetype:"TTF",opentype:"OTF",woff:"WOFF",woff2:"WOFF2"};async function s4(e){for(const n of e)try{await kl.importFile(n)}catch(r){return r instanceof Error&&r.message?i(r.message):i("字体导入失败,请稍后重试")}return null}function o4({error:e,onPick:n}){const r=wl(),[s,l]=p.useState(null);return t.jsxs(t.Fragment,{children:[e&&t.jsx("div",{className:"font-library-error",role:"alert",children:e}),r.length>0?t.jsx("div",{className:"font-grid","data-testid":"font-grid",children:r.map(o=>t.jsxs("article",{className:"font-card","data-testid":"font-card",children:[t.jsxs("div",{className:"font-card-sample",style:{fontFamily:dd(o.family)},"aria-hidden":"true",children:[t.jsx("span",{className:"font-card-big",children:i("永 Aa")}),t.jsx("span",{className:"font-card-line",children:i("字体样张 123")})]}),t.jsxs("div",{className:"font-card-info",children:[t.jsx("span",{className:"font-card-name",title:o.family,children:o.family}),t.jsxs("span",{className:"font-card-meta tnum",children:[i4[o.format]," · ",jl(o.bytes)]})]}),t.jsx("button",{type:"button",className:"icon-btn font-card-remove","aria-label":i("删除字体 {font}",{font:o.family}),title:i("删除字体 {font}",{font:o.family}),onClick:()=>l(o),children:t.jsx(Ji,{})})]},o.id))}):t.jsxs("div",{className:"asset-drop",children:[t.jsx("span",{className:"asset-drop-icon",children:t.jsx(pr,{})}),t.jsx("b",{children:i("把字体文件拖到这里")}),t.jsx("span",{children:i("TTF、OTF、WOFF、WOFF2 都可以,最大 40 MB。")}),t.jsx("button",{className:"ghost",type:"button",onClick:n,children:i("选择字体")})]}),s&&t.jsx(fi,{title:i("删除字体「{title}」?",{title:s.family}),body:i("用了它的文字会换回默认字体。"),confirmLabel:i("删除"),danger:!0,onCancel:()=>l(null),onConfirm:()=>{const o=s;l(null),kl.remove(o.id).catch(()=>{})}})]})}function Bo(e){return Array.from(e.dataTransfer.types).includes("Files")}function l4(e){return e instanceof HTMLElement&&e.closest('input, textarea, [contenteditable="true"]')!==null}function c4({ownerId:e,assets:n,usage:r,onUpload:s,onRename:l,onDelete:o}){const[c,f]=p.useState(""),[h,g]=p.useState("recent"),[x,m]=p.useState(null),[j,k]=p.useState(null),[v,w]=p.useState(!1),[N,M]=p.useState("images"),[I,F]=p.useState(null),z=wl(),A=p.useRef(0),T=p.useRef(null),L=p.useRef(null),H=p.useRef(s);H.current=s;const P=p.useRef(N);P.current=N;const U=le=>{F(null),s4(le).then(F)},K=n.assets,D=K.reduce((le,De)=>le+De.bytes,0),re=c.trim().toLocaleLowerCase(),q=p.useMemo(()=>Pc(K.filter(le=>!re||le.name.toLocaleLowerCase().includes(re)),h),[K,re,h]),te=x?K.find(le=>le.id===x)??null:null;p.useEffect(()=>{if(!e)return;const le=De=>{var ae;if(l4(De.target)||P.current!=="images")return;const W=Yc((ae=De.clipboardData)==null?void 0:ae.files);W.length!==0&&(De.preventDefault(),H.current(W))};return window.addEventListener("paste",le),()=>window.removeEventListener("paste",le)},[e]);const be=e?{onDragEnter:le=>{Bo(le)&&(le.preventDefault(),A.current+=1,w(!0))},onDragOver:le=>{Bo(le)&&(le.preventDefault(),le.dataTransfer.dropEffect="copy")},onDragLeave:le=>{Bo(le)&&(A.current=Math.max(0,A.current-1),A.current===0&&w(!1))},onDrop:le=>{if(!Bo(le))return;le.preventDefault(),A.current=0,w(!1);const De=Array.from(le.dataTransfer.files);De.length!==0&&(N==="fonts"?U(De):s(De))}}:{},ne=()=>{var le;return(le=T.current)==null?void 0:le.click()},Be=()=>{var le;return(le=L.current)==null?void 0:le.click()};return t.jsxs("section",{className:"page page-assets","aria-label":i("素材库"),...be,children:[t.jsxs("div",{className:"page-head",children:[t.jsx("div",{children:t.jsx("h1",{children:i("素材库")})}),e&&t.jsxs("div",{className:"page-actions",children:[t.jsxs("div",{className:"tabs",role:"group","aria-label":i("素材类型"),children:[t.jsxs("button",{type:"button","aria-pressed":N==="images","data-testid":"asset-kind-images",onClick:()=>M("images"),children:[i("图片")," ",t.jsx("span",{className:"tnum",children:K.length})]}),t.jsxs("button",{type:"button","aria-pressed":N==="fonts","data-testid":"asset-kind-fonts",onClick:()=>M("fonts"),children:[i("字体")," ",t.jsx("span",{className:"tnum",children:z.length})]})]}),N==="images"?t.jsxs("button",{className:"accent",type:"button",onClick:ne,"data-testid":"asset-upload",children:[t.jsx(pr,{}),i("上传图片")]}):t.jsxs("button",{className:"accent",type:"button",onClick:Be,"data-testid":"font-import",children:[t.jsx(pr,{}),i("导入字体")]})]})]}),t.jsx("input",{ref:L,type:"file",accept:nm,multiple:!0,hidden:!0,"data-testid":"font-file-input",onChange:le=>{const De=Array.from(le.currentTarget.files??[]);le.currentTarget.value="",De.length>0&&U(De)}}),t.jsx("input",{ref:T,type:"file",accept:vd,multiple:!0,hidden:!0,"data-testid":"asset-file-input",onChange:le=>{const De=Array.from(le.currentTarget.files??[]);le.currentTarget.value="",De.length>0&&s(De)}}),e&&N==="fonts"&&t.jsx(o4,{error:I,onPick:Be}),!e||N!=="images"?null:t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"toolbar-row",children:[t.jsxs("label",{className:"search-field",children:[t.jsx(Ma,{}),t.jsx("input",{type:"search",value:c,placeholder:i("按名称搜索"),"aria-label":i("搜索素材"),onChange:le=>f(le.target.value)})]}),t.jsx("span",{className:"asset-summary tnum",children:i("{n} 张 · {size}",{n:K.length,size:jl(D)})}),t.jsx("span",{className:"grow"}),t.jsx(qr,{value:h,title:i("排序"),onChange:le=>g(le),options:[{id:"recent",label:i("最近上传")},{id:"name",label:i("按名称")}]})]}),n.status==="error"&&t.jsxs("div",{className:"empty",children:[t.jsx("b",{children:i("素材库读取失败")}),t.jsx("span",{children:n.error}),t.jsx("button",{className:"ghost",type:"button",onClick:n.reload,children:i("重试")})]}),q.length>0||n.uploads.length>0?t.jsxs("div",{className:"asset-grid",children:[n.uploads.map(le=>t.jsxs("div",{className:"asset is-pending",role:"status","aria-label":i("正在上传 {name}",{name:le.name}),children:[t.jsx("div",{className:"asset-thumb",children:t.jsx("span",{className:"asset-spinner"})}),t.jsxs("div",{className:"asset-info",children:[t.jsx("span",{className:"asset-name",children:le.name}),t.jsx("span",{className:"asset-meta",children:i("上传中…")})]})]},le.id)),q.map(le=>t.jsx(Qy,{asset:le,onPreview:De=>m(De.id),onRename:l,onDelete:k},le.id))]}):n.status==="ready"&&(re?t.jsxs("div",{className:"empty",children:[t.jsx("b",{children:i("没有名称包含「{query}」的素材",{query:c.trim()})}),t.jsx("span",{children:i("换个关键词试试。")})]}):t.jsxs("div",{className:"asset-drop",children:[t.jsx("span",{className:"asset-drop-icon",children:t.jsx(pr,{})}),t.jsx("b",{children:i("把图片拖到这里,或者直接粘贴截图")}),t.jsx("span",{children:i("PNG、JPG、WebP 都可以,长边超过 1800 px 会自动缩小。")}),t.jsx("button",{className:"ghost",type:"button",onClick:ne,children:i("选择图片")})]}))]}),v&&t.jsx("div",{className:"asset-drop-overlay","aria-hidden":"true",children:t.jsxs("div",{children:[t.jsx(pr,{}),t.jsx("b",{children:N==="fonts"?i("松开,导入字体"):i("松开,上传到素材库")})]})}),te&&t.jsx(Jy,{asset:te,usedBy:r.get(te.id)??0,onDelete:le=>{m(null),k(le)},onClose:()=>m(null)}),j&&t.jsx(fi,{title:i("删除「{title}」?",{title:j.name}),body:(r.get(j.id)??0)>0?i("有 {n} 个项目用到了这张图片,它们不受影响,只是以后不能再从素材库里选它。",{n:r.get(j.id)??0}):i("删除后不能再从素材库里选它。"),confirmLabel:i("删除"),danger:!0,onCancel:()=>k(null),onConfirm:()=>{const le=j;k(null),m(null),o(le)}})]})}function d4(e){return e.mode==="freeform-slide"?rm(e.document):[...am(e.document.source),...Object.values(e.document.images??{})]}function Af(e){if(e.startsWith("data:"))return e;try{return new URL(e,"http://local.invalid").pathname}catch{return e}}function u4(e,n){const r=new Map;if(e.length===0)return r;const s=new Map(e.map(l=>[Af(l.src),l.id]));for(const l of n){const o=new Set;for(const c of d4(l)){const f=s.get(Af(c));f&&o.add(f)}for(const c of o)r.set(c,(r.get(c)??0)+1)}return r}const Ws=[{id:"xhs",name:"小红书",ratio:"3:4",width:1080,height:1440},{id:"story",name:"竖版海报",ratio:"9:16",width:1080,height:1920},{id:"square",name:"方图",ratio:"1:1",width:1080,height:1080},{id:"landscape",name:"横版封面",ratio:"16:9",width:1920,height:1080},{id:"wechat-cover",name:"公众号首图",ratio:"2.35:1",width:1800,height:766},{id:"a4",name:"A4 印刷",ratio:"A4",width:1240,height:1754},{id:"a4-landscape",name:"A4 横版",ratio:"A4 横",width:1754,height:1240},{id:"moments-grid",name:"朋友圈九宫格",ratio:"3×3",width:3240,height:3240}];function Rn(e){return Ws.find(n=>n.id===e)??Ws[0]}const Pm=[{id:"article",name:"长文卡片"},{id:"carousel",name:"图文套图"},{id:"social",name:"社交配图"},{id:"event",name:"活动海报"},{id:"promo",name:"营销电商"},{id:"menu",name:"菜单价目"},{id:"festival",name:"节日节气"},{id:"invite",name:"邀请贺卡"},{id:"office",name:"办公学习"}],Tm=[{id:"minimal",name:"简约"},{id:"editorial",name:"杂志"},{id:"literary",name:"文艺"},{id:"chinese",name:"国风"},{id:"retro",name:"复古"},{id:"handdrawn",name:"手绘"},{id:"elegant",name:"优雅"},{id:"bold",name:"潮酷"},{id:"business",name:"商务"},{id:"fresh",name:"清新"}],Nd=[{id:"white",name:"白色",swatch:"#ffffff"},{id:"beige",name:"米色",swatch:"#efe4cf"},{id:"gray",name:"灰色",swatch:"#9b9b98"},{id:"black",name:"黑色",swatch:"#1d1d1f"},{id:"red",name:"红色",swatch:"#d33b2c"},{id:"orange",name:"橙色",swatch:"#ec8a3c"},{id:"yellow",name:"黄色",swatch:"#f2c84b"},{id:"green",name:"绿色",swatch:"#3c8c5b"},{id:"blue",name:"蓝色",swatch:"#3467d6"},{id:"purple",name:"紫色",swatch:"#8b62d9"},{id:"pink",name:"粉色",swatch:"#ef93b4"}],ge=(e,n,r)=>({uses:e,styles:n,colors:r}),f4={column:ge(["article"],["editorial","literary"],["beige","red"]),memo:ge(["article"],["minimal","fresh"],["white","yellow"]),letter:ge(["article"],["literary","retro"],["beige","red"]),night:ge(["article"],["literary"],["black"]),aurora:ge(["article"],["fresh"],["purple","pink","blue"]),doc:ge(["article"],["business","minimal"],["white","blue"]),xuan:ge(["article"],["chinese"],["beige","red"]),swiss:ge(["article"],["bold","minimal"],["white","red"]),journal:ge(["article"],["handdrawn","fresh"],["beige","orange"]),editorial:ge(["carousel"],["editorial"],["beige","red"]),checklist:ge(["carousel"],["minimal","fresh"],["green","white"]),signal:ge(["carousel"],["bold"],["beige","red"]),"night-flight":ge(["carousel"],["literary"],["black","blue"]),brutalist:ge(["carousel"],["bold"],["yellow","black"]),blueprint:ge(["carousel"],["business"],["blue"]),spotlight:ge(["carousel","office"],["minimal","business"],["orange","white"]),thesis:ge(["carousel","office"],["business","elegant"],["blue","white"]),"note-cover":ge(["social"],["fresh"],["beige","yellow"]),"photo-cover":ge(["social"],["retro"],["beige","black"]),"portfolio-cover":ge(["social"],["elegant","editorial"],["black","red"]),menu:ge(["menu"],["minimal","retro"],["beige","orange"]),"dessert-menu":ge(["menu"],["handdrawn"],["beige","orange","yellow"]),"price-list":ge(["menu","promo"],["retro"],["red","white"]),certificate:ge(["office"],["elegant"],["beige","yellow"]),"moments-grid":ge(["social","festival"],["handdrawn"],["purple","orange","pink"]),timetable:ge(["office"],["fresh"],["white","blue","yellow"]),"exhibition-poster":ge(["event"],["bold","minimal"],["white","black"]),"talk-poster":ge(["event"],["editorial"],["beige","black"]),"launch-poster":ge(["promo","event"],["bold"],["black","blue","purple"]),"sale-poster":ge(["promo"],["bold"],["orange"]),"hiring-poster":ge(["office","event"],["minimal","fresh"],["beige","blue","orange"]),"festival-poster":ge(["festival"],["chinese"],["blue","yellow"]),"solar-term":ge(["festival"],["chinese"],["beige","red"]),invitation:ge(["invite"],["elegant"],["green","yellow"]),"wedding-invitation":ge(["invite"],["elegant"],["white","green"]),"birthday-card":ge(["invite"],["fresh"],["pink","beige"]),"autumn-market":ge(["event"],["handdrawn"],["beige","orange"]),"quote-card":ge(["social"],["minimal","literary"],["beige","red"]),"product-card":ge(["promo"],["fresh"],["green"]),"video-cover":ge(["social"],["bold"],["black","yellow"]),"pitch-cover":ge(["office"],["business","minimal"],["blue","white"]),"podcast-cover":ge(["social"],["retro","bold"],["beige","red","blue"]),"article-cover":ge(["social"],["editorial"],["blue","black"]),flyer:ge(["event"],["fresh"],["beige","orange"]),"data-roundup":ge(["office"],["editorial","business"],["beige","red"]),"compare-table":ge(["office"],["business"],["blue","white"]),"growth-timeline":ge(["office"],["elegant"],["green","yellow"]),"magazine-cover":ge(["social"],["editorial","elegant"],["beige","black"]),"book-list":ge(["social"],["literary","fresh"],["beige","green","orange"]),"word-of-year":ge(["festival","social"],["chinese","minimal"],["white","red","black"]),"music-festival":ge(["event"],["bold","retro"],["purple","pink","yellow"]),"travel-postcard":ge(["invite","social"],["retro"],["beige","red","blue"]),"design-week":ge(["event"],["bold","minimal"],["white","red","black"]),"double-eleven":ge(["promo","festival"],["bold"],["red","yellow"]),"christmas-card":ge(["festival","invite"],["retro","handdrawn"],["red","green"]),"new-year-calendar":ge(["festival","social"],["retro","minimal"],["blue","red","beige"]),"spring-festival":ge(["festival","invite"],["chinese"],["red","yellow"]),"listicle-cover":ge(["social"],["editorial","minimal"],["red","beige"]),"ridge-cover":ge(["social"],["literary","fresh"],["blue","beige"]),"summit-visual":ge(["event"],["business","bold"],["black","blue","green"]),"gala-backdrop":ge(["event","festival"],["elegant","retro"],["black","yellow"]),"agenda-sheet":ge(["event","office"],["business","minimal"],["blue","white"]),"annual-report":ge(["office"],["business","elegant"],["white","blue"]),"stat-card":ge(["social","office"],["minimal","bold"],["blue"]),countdown:ge(["event","promo"],["minimal"],["beige","black"]),"versus-cover":ge(["social","promo"],["bold"],["yellow","black"]),"habit-tracker":ge(["social","office"],["fresh","minimal"],["green"]),"fun-fact":ge(["social"],["bold"],["yellow"]),"trip-route":ge(["social"],["handdrawn","fresh"],["blue","beige"]),"ranking-cover":ge(["social","promo"],["bold"],["black","orange"]),"grand-opening":ge(["promo","event"],["retro"],["red","beige"]),"race-bib":ge(["event"],["bold"],["orange","black"]),"live-show":ge(["promo","event"],["bold"],["black","red"]),"qixi-stars":ge(["festival","invite"],["elegant","chinese"],["purple","blue"]),"dragon-boat":ge(["festival"],["chinese"],["red","beige"]),"vinyl-cover":ge(["social"],["retro"],["blue","black"]),"intro-card":ge(["social"],["bold"],["red","beige"]),"daily-quote":ge(["social"],["elegant","literary"],["blue","yellow"]),"masthead-cover":ge(["social"],["editorial","retro"],["beige","black"]),"interview-cover":ge(["social"],["editorial","elegant"],["orange","beige"]),resume:ge(["office"],["minimal","business"],["white","blue"]),notice:ge(["office"],["business"],["red","white"]),"food-review":ge(["social"],["handdrawn","fresh"],["beige","orange"]),"course-cover":ge(["office"],["fresh","minimal"],["yellow","white"])};function Qr(e){return f4[e.series]}const h4={article:["长文","笔记","Markdown","文章","图文"],carousel:["套图","多页","图文","轮播"],social:["封面","配图","头图"],event:["活动","海报","宣传","报名"],promo:["促销","电商","打折","新品","优惠","海报"],menu:["菜单","价目","餐厅","饮品"],festival:["节日","节气","问候","祝福"],invite:["请柬","请帖","邀请","贺卡"],office:["办公","工作","汇报","PPT","学习","学校"]},Md=(e,n)=>{var r;return((r=e.find(s=>s.id===n))==null?void 0:r.name)??n};function Xi(e){return Md(Pm,e)}function Wm(e){return Md(Tm,e)}function Hm(e){return Md(Nd,e)}function m4(e){const{uses:n,styles:r,colors:s}=Qr(e),l=Rn(e.format);return[[e.title,8],...e.tags.map(c=>[c,4]),...n.map(c=>[Xi(c),4]),...n.flatMap(c=>h4[c].map(f=>[f,2])),...r.map(c=>[Wm(c),3]),...s.map(c=>[Hm(c),2]),[l.name,2],[l.ratio,2],[e.workspace==="markdown"?"Markdown 卡片":"自由编辑",1],[e.description,1]].flatMap(([c,f])=>{const h=i(c);return h===c?[[c.toLowerCase(),f]]:[[c.toLowerCase(),f],[h.toLowerCase(),f]]})}function p4(e,n){const r=n.trim().toLowerCase().split(/\s+/).filter(Boolean);if(r.length===0)return 1;const s=m4(e);let l=0;for(const o of r){const c=s.reduce((f,[h,g])=>h.includes(o)?Math.max(f,g):f,0);if(c===0)return 0;l+=c}return l}function g4(e,n){const{uses:r,styles:s,colors:l}=Qr(e);return!(n.use&&!r.includes(n.use)||n.format&&e.format!==n.format||n.style&&!s.includes(n.style)||n.color&&!l.includes(n.color)||n.only&&!n.only.has(e.id))}function ai(e,n){var l;const r=((l=n.text)==null?void 0:l.trim())??"",s=e.map((o,c)=>({template:o,index:c,score:g4(o,n)?p4(o,r):0})).filter(o=>o.score>0);return r&&s.sort((o,c)=>c.score-o.score||o.index-c.index),s.map(o=>o.template)}function x4(e,n,r=6){const s=Qr(e);return n.filter(l=>l.id!==e.id).map((l,o)=>{const c=Qr(l),f=c.uses.filter(x=>s.uses.includes(x)).length,h=c.styles.filter(x=>s.styles.includes(x)).length,g=f*4+h*2+(l.format===e.format?1:0)+c.colors.filter(x=>s.colors.includes(x)).length*.5;return{candidate:l,index:o,score:f+h>0?g:0}}).filter(l=>l.score>0).sort((l,o)=>o.score-l.score||l.index-o.index).slice(0,r).map(l=>l.candidate)}function Fd(e){return Pm.map(n=>n.id).filter(n=>e.some(r=>Qr(r).uses.includes(n)))}function Cd(e){return e.mode==="markdown-card"?{kind:"markdown",document:e.document}:{kind:"freeform",document:e.document}}function Om(e,n=Date.now()){const r=Math.round((n-e)/6e4);if(r<1)return i("刚刚");if(r<60)return i("{n} 分钟前",{n:r});const s=Math.round(r/60);if(s<24)return i("{n} 小时前",{n:s});const l=Math.round(s/24);return l<7?i("{n} 天前",{n:l}):new Date(e).toLocaleDateString(Bs(),{month:"short",day:"numeric"})}function b4(e){if(e.mode==="markdown-card"){const r=mr.find(s=>s.id===e.document.platformId);return r?i(r.label):"Markdown"}const n=e.document.slides[0];return n?`${n.width} × ${n.height}`:i("自由编辑")}function y4({system:e,className:n}){return e==="markdown-card"?t.jsx(Us,{className:["sys-mark","sys-md",n].filter(Boolean).join(" ")}):t.jsx(Gi,{className:["sys-mark","sys-ff",n].filter(Boolean).join(" ")})}function _m({draft:e,onOpen:n,onDuplicate:r,onRename:s,onDelete:l}){const[o,c]=p.useState(!1),[f,h]=p.useState(!1),g=p.useRef(null),x=p.useRef(!1),m=e.mode==="freeform-slide"?e.document.slides.length:null,j=e.mode==="markdown-card"?i("Markdown 卡片"):i("自由编辑");qs(g,o,()=>c(!1));function k(v){if(h(!1),x.current)return;const w=v.trim();w&&w!==e.title&&(s==null||s(e,w))}return t.jsxs("article",{className:"project","data-testid":"project-card","data-system":e.mode,children:[t.jsxs("button",{className:"project-open",type:"button",onClick:()=>n(e),"aria-label":i("打开 {title}",{title:e.title}),children:[t.jsx(Zi,{className:"project-thumb",children:v=>t.jsx(Yn,{source:Cd(e),width:v,lazy:!0})}),m!==null&&m>1&&t.jsx("span",{className:"project-pages tnum",children:i("{n} 页",{n:m})})]}),t.jsxs("div",{className:"project-info",children:[t.jsxs("div",{className:"project-title",children:[t.jsx(y4,{system:e.mode}),f?t.jsx("input",{className:"text-input project-rename","aria-label":i("项目名称"),defaultValue:e.title,maxLength:60,autoFocus:!0,onFocus:v=>v.currentTarget.select(),onBlur:v=>k(v.currentTarget.value),onKeyDown:v=>{if(v.key==="Enter"){if(v.nativeEvent.isComposing)return;v.currentTarget.blur()}else v.key==="Escape"&&(v.preventDefault(),v.stopPropagation(),x.current=!0,v.currentTarget.blur())}}):t.jsx("span",{title:e.title,children:e.title})]}),t.jsxs("div",{className:"project-meta",children:[t.jsx("span",{children:j}),t.jsx("span",{className:"dot-sep","aria-hidden":"true"}),t.jsx("span",{children:b4(e)}),t.jsx("span",{className:"dot-sep","aria-hidden":"true"}),t.jsx("span",{className:"tnum",children:Om(e.updatedAt)})]})]}),(r||s||l)&&t.jsxs("div",{className:"project-menu",ref:g,children:[t.jsx("button",{className:"icon-btn project-more",type:"button","aria-label":i("{name} 的更多操作",{name:e.title}),"aria-haspopup":"menu","aria-expanded":o,onClick:()=>c(v=>!v),children:t.jsx(Nl,{})}),o&&t.jsxs("div",{className:"menu project-menu-list",role:"menu",children:[s&&t.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{c(!1),x.current=!1,h(!0)},children:[t.jsx(md,{}),i("重命名")]}),r&&t.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{c(!1),r(e)},children:[t.jsx(jm,{}),i("复制一份")]}),l&&t.jsxs("button",{role:"menuitem",type:"button",className:"danger",onClick:()=>{c(!1),l(e)},children:[t.jsx(Ji,{}),i("删除")]})]})]})]})}const j4={markdown:t.jsx(Us,{className:"sys-md"}),freeform:t.jsx(Gi,{className:"sys-ff"}),projects:t.jsx(ym,{}),templates:t.jsx(Vi,{}),assets:t.jsx(Gs,{}),theme:t.jsx(fd,{}),language:t.jsx(wm,{})};function Pf(e,n){return!n||e.toLocaleLowerCase().includes(n.toLocaleLowerCase())}function w4({projects:e,templates:n,actions:r,onOpenProject:s,onUseTemplate:l,onClose:o}){const c=Ks(),[f,h]=p.useState(""),[g,x]=p.useState(0),m=p.useRef(null),j=p.useRef(null),k=f.trim(),v=p.useMemo(()=>{const F=e.filter(T=>Pf(T.title,k)).slice(0,5).map(T=>({type:"project",key:`p:${T.id}`,draft:T})),z=ai(n,{text:k}).slice(0,4).map(T=>({type:"template",key:`t:${T.id}`,template:T})),A=r.filter(T=>Pf(T.label,k)).map(T=>({type:"action",key:`a:${T.id}`,action:T}));return[{label:c("项目"),items:F},{label:c("模板"),items:z},{label:c("操作"),items:A}].filter(T=>T.items.length>0)},[r,e,k,c,n]),w=v.flatMap(F=>F.items);p.useEffect(()=>{var z;const F=document.activeElement instanceof HTMLElement?document.activeElement:null;return(z=m.current)==null||z.focus(),()=>F==null?void 0:F.focus()},[]),p.useEffect(()=>x(0),[k]),p.useEffect(()=>{var F,z;(z=(F=j.current)==null?void 0:F.querySelector('[data-active="true"]'))==null||z.scrollIntoView({block:"nearest"})},[g]);function N(F){o(),F.type==="project"?s(F.draft):F.type==="template"?l(F.template):F.action.run()}function M(F){F.key==="Escape"?(F.preventDefault(),o()):F.key==="ArrowDown"?(F.preventDefault(),x(z=>Math.min(w.length-1,z+1))):F.key==="ArrowUp"?(F.preventDefault(),x(z=>Math.max(0,z-1))):F.key==="Enter"&&w[g]&&(F.preventDefault(),N(w[g]))}let I=-1;return t.jsx("div",{className:"palette-back",onMouseDown:F=>F.target===F.currentTarget&&o(),children:t.jsxs("div",{className:"palette",role:"dialog","aria-modal":"true","aria-label":c("搜索与命令"),onKeyDown:M,children:[t.jsxs("div",{className:"palette-input",children:[t.jsx(Ma,{}),t.jsx("input",{ref:m,value:f,onChange:F=>h(F.target.value),placeholder:c("搜索项目、模板,或输入操作"),"aria-label":c("搜索项目、模板和操作"),role:"combobox","aria-expanded":"true","aria-controls":"palette-list"}),t.jsx("kbd",{children:"Esc"})]}),t.jsxs("div",{className:"palette-list",id:"palette-list",role:"listbox",ref:j,children:[v.length===0&&t.jsx("div",{className:"palette-empty",children:c("没有找到“{query}”",{query:k})}),v.map(F=>t.jsxs("div",{role:"group","aria-label":F.label,children:[t.jsx("div",{className:"palette-group",children:F.label}),F.items.map(z=>{I+=1;const A=I,T=A===g;return t.jsxs("button",{type:"button",role:"option","aria-selected":T,"data-active":T,className:"palette-item",onMouseEnter:()=>x(A),onClick:()=>N(z),children:[z.type==="project"&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"palette-thumb",children:t.jsx(Yn,{source:Cd(z.draft),width:24})}),t.jsx("span",{className:"palette-label",children:z.draft.title}),t.jsx("small",{className:"tnum",children:Om(z.draft.updatedAt)})]}),z.type==="template"&&(()=>{const L=va(z.template);return t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"palette-thumb",children:L&&t.jsx(Yn,{source:L,width:24})}),t.jsx("span",{className:"palette-label",children:c(z.template.title)}),t.jsx("small",{children:z.template.workspace==="markdown"?c("Markdown 卡片模板"):c("自由编辑模板")})]})})(),z.type==="action"&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"palette-icon",children:j4[z.action.icon]}),t.jsx("span",{className:"palette-label",children:z.action.label}),z.action.hint&&t.jsx("small",{children:z.action.hint})]})]},z.key)})]},F.label))]})]})})}function vn(e,n){return e instanceof Error&&e.message.trim()?i(e.message):n}const k4=24*60*60*1e3,S4=30;function v4({ownerId:e,onChanged:n,onClose:r}){const s=Ks(),l=p.useId(),[o,c]=p.useState(null),[f,h]=p.useState(null),[g,x]=p.useState(null),[m,j]=p.useState(null),[k,v]=p.useState(null),w=p.useCallback(()=>{let F=!1;return xt(e).drafts.listTrash(e).then(z=>{F||(c(z),h(null))},z=>{F||h(vn(z,s("暂时无法读取回收站,请稍后重试")))}),()=>{F=!0}},[e]);p.useEffect(w,[w]),p.useEffect(()=>{const F=z=>{z.key!=="Escape"||g||m||(z.preventDefault(),r())};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[r,g,m]);async function N(F){j(F.id),v(null);try{await xt(e).drafts.restore(e,F.id),c(z=>(z==null?void 0:z.filter(A=>A.id!==F.id))??z),n()}catch(z){v(vn(z,s("恢复失败,请稍后重试")))}finally{j(null)}}async function M(F){j(F.id),v(null);try{await xt(e).drafts.purge(e,F.id),x(null),c(z=>(z==null?void 0:z.filter(A=>A.id!==F.id))??z),n()}catch(z){v(vn(z,s("彻底删除失败,请稍后重试")))}finally{j(null)}}function I(F){return Math.max(1,S4-Math.floor((Date.now()-F.deletedAt)/k4))}return t.jsxs("div",{className:"modal-backdrop",children:[t.jsxs("div",{className:"modal token-dialog",role:"dialog","aria-modal":"true","aria-labelledby":l,"data-testid":"project-trash-dialog",children:[t.jsx("h3",{id:l,className:"confirm-title",children:s("回收站")}),t.jsx("p",{className:"confirm-body",children:s("删除的项目在这里保留 30 天:恢复就回到「我的项目」,内容和历史版本都在;到期没管的会被自动清除。")}),k&&t.jsx("p",{className:"share-error",role:"alert",children:k}),f?t.jsx("p",{className:"share-error",role:"alert",children:f}):o===null?t.jsx("p",{className:"confirm-body","data-testid":"project-trash-loading",children:s("读取中…")}):o.length===0?t.jsx("p",{className:"confirm-body","data-testid":"project-trash-empty",children:s("回收站是空的——删除的项目会在这里保留 30 天。")}):t.jsx("ul",{className:"token-list","data-testid":"project-trash-list",children:o.map(F=>t.jsxs("li",{className:"token-row",children:[t.jsxs("div",{className:"token-main",children:[t.jsx("span",{className:"token-name",children:F.title||s("未命名")}),t.jsxs("span",{className:"token-sub",children:[s("{n} 天后自动清除",{n:I(F)}),F.mode==="markdown-card"?` · ${s("Markdown")}`:""]})]}),t.jsx("button",{type:"button",className:"ghost","data-testid":"project-trash-restore",disabled:m!==null,onClick:()=>void N(F),children:s("恢复")}),t.jsx("button",{type:"button",className:"ghost danger-text","data-testid":"project-trash-purge",disabled:m!==null,onClick:()=>x(F),children:s("彻底删除")})]},F.id))}),t.jsx("div",{className:"modal-foot",children:t.jsx("button",{type:"button",className:"ghost",onClick:r,disabled:m!==null,children:s("关闭")})})]}),g&&t.jsx(fi,{title:s("彻底删除「{title}」?",{title:g.title}),body:s("彻底删除后无法恢复,它的内容和历史版本都会一起清掉。"),confirmLabel:s("彻底删除"),danger:!0,onConfirm:()=>void M(g),onCancel:()=>x(null)})]})}function N4({template:e,onUse:n}){const r=p.useMemo(()=>va(e),[e]),s=e.workspace==="markdown"?"md":"ff",l=Math.min(3,e.pageCount),o=l>1?[1,0,2].filter(c=>c<l):[0];return t.jsxs("article",{className:"tpl-card","data-testid":"template-card",children:[t.jsxs("button",{className:"tpl-stage",type:"button",onClick:()=>n(e),"aria-label":i("用「{title}」新建项目",{title:i(e.title)}),children:[r&&e.kind==="poster"&&t.jsx(Zi,{className:"tpl-fan",children:c=>{const f=Rn(e.format),h=Math.min(c*.84/f.width,c*.75*.78/f.height),g={width:Math.round(f.width*h),height:Math.round(f.height*h)};return t.jsx("div",{className:"tpl-page tpl-page-solo",style:{left:(c-g.width)/2,top:(c*.75-g.height)/2},children:t.jsx(Yn,{source:r,page:0,width:g.width,height:g.height,lazy:!0})})}}),r&&e.kind!=="poster"&&t.jsx(Zi,{className:"tpl-fan",children:c=>o.map(f=>t.jsx("div",{className:`tpl-page tpl-page-${f}`,children:t.jsx(Yn,{source:r,page:f,width:Math.round(c*.38),lazy:!0})},f))}),t.jsx("span",{className:"tpl-use",children:i("使用模板")})]}),t.jsxs("div",{className:"tpl-info",children:[t.jsxs("div",{className:"tpl-title-row",children:[t.jsx("h3",{children:i(e.title)}),t.jsx("span",{className:"chip tnum",children:e.kind==="poster"?i(Rn(e.format).ratio):i("{n} 页",{n:e.pageCount})})]}),t.jsxs("p",{children:[t.jsx("span",{className:`sys-dot ${s}`,"aria-hidden":"true"}),s==="md"?i("Markdown 卡片"):i("自由编辑"),e.tags.length>0&&` · ${e.tags.map(c=>i(c)).join(" · ")}`]})]})]})}const M4=Tc.filter(e=>["3:4","1:1","9:16","16:9"].includes(e.ratio));function Tf(e=new Date){const n=e.getHours();return n<6?i("夜深了"):n<12?i("早上好"):n<18?i("下午好"):i("晚上好")}function F4(e){return e.name||(e.type==="text"?i("文本"):e.type==="image"?i("图片"):i("形状"))}function C4({user:e,ownerId:n,projects:r,assets:s,onUploadAssets:l,templateCounts:o,onNewMarkdown:c,onNewFreeform:f,onOpenProject:h,onUseTemplate:g,onDuplicate:x,onRename:m,onDelete:j}){var T;const[k,v]=p.useState("all"),w=p.useRef(null),N=p.useMemo(()=>({"markdown-card":r.projects.filter(L=>L.mode==="markdown-card").length,"freeform-slide":r.projects.filter(L=>L.mode==="freeform-slide").length}),[r.projects]),M=r.projects.filter(L=>k==="all"||L.mode===k).slice(0,8),I=p.useMemo(()=>{const L=ci.find(H=>H.id==="column-markdown");return L?va(L):null},[]),F=p.useMemo(()=>{const L=ci.find(H=>H.id==="night-flight-freeform");return L?va(L):null},[]),z=(F==null?void 0:F.kind)==="freeform"?(((T=F.document.slides[0])==null?void 0:T.nodes)??[]).slice(-4).reverse().map(F4):[],A=p.useMemo(()=>["column-markdown","autumn-market-freeform","journal-markdown","signal-freeform"].map(L=>ci.find(H=>H.id===L)).filter(L=>!!L),[]);return t.jsxs("section",{className:"page page-home","aria-label":i("首页"),children:[t.jsx("h1",{className:"hello",children:e?i("{greeting},{name}",{greeting:Tf(),name:e.username}):Tf()}),t.jsx("p",{className:"hello-sub",children:i("今天想发点什么?写长文用 Markdown 卡片,自己排版用自由编辑。")}),t.jsxs("div",{className:"systems",children:[t.jsxs("article",{className:"system","data-testid":"system-markdown",children:[t.jsxs("div",{className:"system-top",children:[t.jsxs("span",{className:"sys-badge",children:[t.jsx(Us,{className:"sys-md"}),i("Markdown 卡片")]}),t.jsx("span",{className:"system-count tnum",children:i("{projects} 个项目 · {templates} 套模板",{projects:N["markdown-card"],templates:o["markdown-card"]})})]}),t.jsxs("div",{children:[t.jsx("h2",{className:"system-title",children:i("写一篇长文,自动排成一组卡片")}),t.jsx("p",{className:"system-desc",children:i("只管写字。标题、正文、金句按内容自动分页,整组图片一键导出。")})]}),t.jsxs("div",{className:"system-art system-art-md","aria-hidden":"true",children:[t.jsxs("div",{className:"md-doc",children:[t.jsx("b",{children:i("# 在城市里慢慢走")}),t.jsx("i",{}),t.jsx("i",{className:"short"}),t.jsx("span",{className:"md-break",children:"---"}),t.jsx("b",{children:i("## 地铁看不见的东西")}),t.jsx("i",{}),t.jsx("i",{}),t.jsx("i",{className:"short"}),t.jsx("span",{className:"md-break",children:"---"}),t.jsx("span",{children:i("> 你不需要去很远的地方")})]}),t.jsx("span",{className:"md-flow"}),t.jsx("div",{className:"md-fan",children:I&&[1,0,2].map(L=>t.jsx("div",{className:`md-fan-page md-fan-${L}`,children:t.jsx(Yn,{source:I,page:L,width:84})},L))})]}),t.jsxs("div",{className:"system-actions",children:[t.jsx("span",{className:"system-label",children:i("新建")}),mr.map(L=>t.jsx("button",{className:"pill",type:"button",onClick:()=>c(L.id),children:i(L.label)},L.id)),t.jsx("button",{className:"system-more",type:"button",onClick:()=>Rt(ft.templates("markdown-card")),children:i("从模板开始")})]})]}),t.jsxs("article",{className:"system","data-testid":"system-freeform",children:[t.jsxs("div",{className:"system-top",children:[t.jsxs("span",{className:"sys-badge",children:[t.jsx(Gi,{className:"sys-ff"}),i("自由编辑")]}),t.jsx("span",{className:"system-count tnum",children:i("{projects} 个项目 · {templates} 套模板",{projects:N["freeform-slide"],templates:o["freeform-slide"]})})]}),t.jsxs("div",{children:[t.jsx("h2",{className:"system-title",children:i("像做海报一样,自由摆放每个元素")}),t.jsx("p",{className:"system-desc",children:i("文字、图片、形状、图层和参考线都在手边,多页设计一次导出。")})]}),t.jsxs("div",{className:"system-art system-art-ff","aria-hidden":"true",children:[t.jsxs("div",{className:"ff-rail",children:[t.jsx("span",{children:t.jsx(Vi,{})}),t.jsx("span",{className:"on",children:t.jsx(Gs,{})}),t.jsx("span",{children:t.jsx(Gi,{})})]}),t.jsx("div",{className:"ff-canvas",children:F&&t.jsxs("div",{className:"ff-page",children:[t.jsx(Yn,{source:F,width:112}),t.jsx("i",{className:"ff-sel"})]})}),t.jsx("div",{className:"ff-layers",children:z.map((L,H)=>t.jsx("span",{className:H===1?"on":void 0,children:L},`${L}-${H}`))})]}),t.jsxs("div",{className:"system-actions",children:[t.jsx("span",{className:"system-label",children:i("新建")}),M4.map(L=>t.jsx("button",{className:"pill tnum",type:"button",onClick:()=>f(L.width,L.height),children:L.ratio},L.ratio)),t.jsx("button",{className:"system-more",type:"button",onClick:()=>Rt(ft.templates("freeform-slide")),children:i("从模板开始")})]})]})]}),t.jsxs("section",{className:"section","aria-labelledby":"home-recent",children:[t.jsxs("div",{className:"section-head",children:[t.jsx("h2",{id:"home-recent",children:i("最近编辑")}),t.jsxs("div",{className:"section-tools",children:[t.jsxs("div",{className:"tabs",role:"group","aria-label":i("按系统筛选"),children:[t.jsx("button",{type:"button","aria-pressed":k==="all",onClick:()=>v("all"),children:i("全部")}),t.jsx("button",{type:"button","aria-pressed":k==="markdown-card",onClick:()=>v("markdown-card"),children:i("Markdown 卡片")}),t.jsx("button",{type:"button","aria-pressed":k==="freeform-slide",onClick:()=>v("freeform-slide"),children:i("自由编辑")})]}),r.projects.length>0&&t.jsx("button",{className:"link-btn",type:"button",onClick:()=>Rt(ft.projects()),children:i("查看全部 {n} 个",{n:r.projects.length})})]})]}),M.length>0?t.jsx("div",{className:"project-grid",children:M.map(L=>t.jsx(_m,{draft:L,onOpen:h,onDuplicate:x,onRename:m,onDelete:j},L.id))}):t.jsxs("div",{className:"empty",children:[t.jsx("b",{children:i("还没有项目")}),t.jsx("span",{children:i("从上面选一种方式新建,开始编辑就会自动保存到这里。")})]})]}),n&&t.jsxs("section",{className:"section","aria-labelledby":"home-assets",children:[t.jsxs("div",{className:"section-head",children:[t.jsxs("div",{children:[t.jsx("h2",{id:"home-assets",children:i("素材库")}),t.jsx("p",{className:"section-hint",children:i("常用的照片、头像和 Logo 放在这里,两套系统都能直接取用。")})]}),t.jsx("button",{className:"link-btn",type:"button",onClick:()=>Rt(ft.assets),children:s.assets.length>0?i("管理全部 {n} 张",{n:s.assets.length}):i("打开素材库")})]}),t.jsxs("div",{className:"asset-strip",children:[s.assets.slice(0,7).map(L=>t.jsx("button",{className:"asset-strip-item",type:"button",title:L.name,"aria-label":i("在素材库中查看 {name}",{name:L.name}),onClick:()=>Rt(ft.assets),children:t.jsx("img",{src:L.src,alt:"",loading:"lazy",decoding:"async",draggable:!1})},L.id)),t.jsxs("button",{className:"asset-strip-add",type:"button",onClick:()=>{var L;return(L=w.current)==null?void 0:L.click()},children:[t.jsx(pr,{}),t.jsx("span",{children:i("上传图片")})]}),t.jsx("input",{ref:w,type:"file",accept:vd,multiple:!0,hidden:!0,onChange:L=>{const H=Array.from(L.currentTarget.files??[]);L.currentTarget.value="",H.length>0&&l(H)}})]})]}),t.jsxs("section",{className:"section","aria-labelledby":"home-templates",children:[t.jsxs("div",{className:"section-head",children:[t.jsx("h2",{id:"home-templates",children:i("模板推荐")}),t.jsx("button",{className:"link-btn",type:"button",onClick:()=>Rt(ft.templates()),children:i("去模板中心")})]}),t.jsx("div",{className:"tpl-grid",children:A.map(L=>t.jsx(N4,{template:L,onUse:g},L.id))})]})]})}function Wf(e){return Array.from(e.dataTransfer.types).includes("Files")}function E4({ownerId:e,guestLeft:n,onMoveGuestWork:r,system:s,projects:l,onNewMarkdown:o,onNewFreeform:c,onImport:f,onOpenTrash:h,onOpenProject:g,onDuplicate:x,onRename:m,onDelete:j}){const[k,v]=p.useState("updated"),[w,N]=p.useState(!1),M=p.useRef(null),I=l.projects,F={"markdown-card":I.filter(A=>A.mode==="markdown-card").length,"freeform-slide":I.filter(A=>A.mode==="freeform-slide").length},z=p.useMemo(()=>{const A=I.filter(T=>!s||T.mode===s);return k==="title"?[...A].sort((T,L)=>T.title.localeCompare(L.title,Bs())):A},[I,k,s]);return t.jsxs("section",{className:w?"page page-projects is-dropping":"page page-projects","aria-label":i("我的项目"),onDragOver:A=>{!e||!Wf(A)||(A.preventDefault(),A.dataTransfer.dropEffect="copy",N(!0))},onDragLeave:A=>{A.currentTarget.contains(A.relatedTarget)||N(!1)},onDrop:A=>{if(!e||!Wf(A))return;A.preventDefault(),N(!1);const T=A.dataTransfer.files[0];T&&f(T)},children:[t.jsxs("div",{className:"page-head",children:[t.jsx("div",{children:t.jsx("h1",{children:i("我的项目")})}),t.jsxs("div",{className:"page-actions",children:[h&&t.jsxs("button",{className:"ghost",type:"button","data-testid":"project-trash",title:i("删除的项目在这里保留 30 天,可以恢复或彻底删除"),onClick:h,children:[t.jsx(Ji,{}),i("回收站")]}),e&&t.jsxs("button",{className:"ghost",type:"button","data-testid":"project-import",title:i("导入 .json 文档,比如 MCP 工具生成的结果"),onClick:()=>{var A;return(A=M.current)==null?void 0:A.click()},children:[t.jsx(jf,{}),i("导入 JSON")]}),t.jsxs("button",{className:"ghost",type:"button",onClick:o,children:[t.jsx(Us,{className:"sys-md"}),i("新建 Markdown 卡片")]}),t.jsxs("button",{className:"ghost",type:"button",onClick:c,children:[t.jsx(Gi,{className:"sys-ff"}),i("新建自由编辑")]}),t.jsx("input",{ref:M,type:"file",accept:".json,application/json",hidden:!0,"aria-label":i("导入 JSON 文档"),"data-testid":"project-import-input",onChange:A=>{var L;const T=(L=A.currentTarget.files)==null?void 0:L[0];A.currentTarget.value="",T&&f(T)}})]})]}),n&&n.projects+n.assets>0&&t.jsxs("div",{className:"guest-left","data-testid":"guest-left",children:[t.jsx(pd,{}),t.jsx("span",{children:n.projects>0?i("这台设备上还有 {n} 个没登录时做的项目。",{n:n.projects}):i("这台设备上还有 {n} 张没登录时存的素材。",{n:n.assets})}),t.jsx("button",{className:"ghost",type:"button",onClick:r,"data-testid":"guest-left-move",children:i("放进账号")})]}),t.jsxs("div",{className:"toolbar-row",children:[t.jsxs("div",{className:"tabs",role:"group","aria-label":i("按系统筛选"),children:[t.jsxs("button",{type:"button","aria-pressed":!s,onClick:()=>Rt(ft.projects()),children:[i("全部")," ",t.jsx("span",{className:"tnum",children:I.length})]}),t.jsxs("button",{type:"button","aria-pressed":s==="markdown-card",onClick:()=>Rt(ft.projects("markdown-card")),children:[t.jsx("span",{className:"sys-dot md","aria-hidden":"true"}),i("Markdown 卡片")," ",t.jsx("span",{className:"tnum",children:F["markdown-card"]})]}),t.jsxs("button",{type:"button","aria-pressed":s==="freeform-slide",onClick:()=>Rt(ft.projects("freeform-slide")),children:[t.jsx("span",{className:"sys-dot ff","aria-hidden":"true"}),i("自由编辑")," ",t.jsx("span",{className:"tnum",children:F["freeform-slide"]})]})]}),t.jsx("span",{className:"grow"}),t.jsx(qr,{value:k,title:i("排序"),onChange:A=>v(A),options:[{id:"updated",label:i("最近编辑")},{id:"title",label:i("按名称")}]})]}),l.status==="error"&&t.jsxs("div",{className:"empty",children:[t.jsx("b",{children:i("项目读取失败")}),t.jsx("span",{children:l.error}),t.jsx("button",{className:"ghost",type:"button",onClick:l.reload,children:i("重试")})]}),w&&t.jsx("div",{className:"asset-drop-overlay","aria-hidden":"true",children:t.jsxs("div",{children:[t.jsx(jf,{}),t.jsx("b",{children:i("松开,导入为项目")})]})}),z.length>0?t.jsx("div",{className:"project-grid",children:z.map(A=>t.jsx(_m,{draft:A,onOpen:g,onDuplicate:x,onRename:m,onDelete:j},A.id))}):l.status!=="error"&&t.jsxs("div",{className:"empty",children:[t.jsx("b",{children:s?i("这一类还没有项目"):i("还没有保存的项目")}),t.jsx("span",{children:i("新建一个,开始编辑就会自动保存到这里;也可以把 .json 文档拖进来导入。")})]})]})}const Zc="slicer.template.favorites.v1";function Bm(e){if(!Array.isArray(e))return[];const n=new Set,r=[];for(const s of e)typeof s!="string"||s.length===0||n.has(s)||(n.add(s),r.push(s));return r}function Km(){try{const e=localStorage.getItem(Zc);return e?Bm(JSON.parse(e)):[]}catch{return[]}}function Vm(e){try{const n=Bm(e);n.length===0?localStorage.removeItem(Zc):localStorage.setItem(Zc,JSON.stringify(n))}catch{}}function Gm(e,n){return e.includes(n)?e.filter(r=>r!==n):[...e,n]}function z4(){const[e,n]=p.useState(()=>Km());return[p.useMemo(()=>new Set(e),[e]),l=>n(o=>{const c=Gm(o,l);return Vm(c),c})]}function Um({template:e,on:n,onToggle:r,className:s}){const l=i(e.title);return t.jsx("button",{className:n?`${s} on`:s,type:"button","aria-pressed":n,"aria-label":n?i("取消收藏{title}",{title:l}):i("收藏{title}",{title:l}),"data-testid":`template-favorite-${e.id}`,onClick:o=>{o.stopPropagation(),r()},children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M10 17s-6.3-3.9-8.2-7.2C.5 7.4 2 4 5.2 4c2 0 3.4 1.1 4.8 2.9C11.4 5.1 12.8 4 14.8 4 18 4 19.5 7.4 18.2 9.8 16.3 13.1 10 17 10 17Z"})})})}function R4(e){return e.kind==="poster"?i(Rn(e.format).ratio):i("{n} 页",{n:e.pageCount})}function I4({template:e,width:n,favorited:r,onToggleFavorite:s,onPreview:l,onUse:o}){const c=p.useMemo(()=>va(e),[e]),f=Rn(e.format),h={width:Math.round(n),height:Math.round(n*f.height/f.width)},g=i(e.title),x=e.workspace==="markdown"?"md":"ff";return t.jsxs("article",{className:e.pageCount>1?"tpl-tile is-pages":"tpl-tile","data-testid":"template-card","data-template-id":e.id,children:[t.jsxs("div",{className:"tpl-tile-media",style:{height:h.height},children:[t.jsx("button",{className:"tpl-tile-open",type:"button","aria-label":i("预览{title}",{title:g}),onClick:()=>l(e),children:c&&t.jsx(Yn,{source:c,width:h.width,height:h.height,lazy:!0})}),t.jsx("button",{className:"tpl-tile-use",type:"button","aria-label":i("用「{title}」新建项目",{title:g}),onClick:()=>o(e),children:i("使用")}),t.jsx(Um,{className:"tpl-tile-heart",template:e,on:r,onToggle:()=>s(e.id)})]}),t.jsxs("div",{className:"tpl-tile-info",children:[t.jsx("h3",{children:g}),t.jsxs("span",{className:"tpl-tile-meta tnum",children:[t.jsx("span",{className:`sys-dot ${x}`,"aria-hidden":"true"}),R4(e)]})]})]})}function Hf({templates:e,minColumn:n=188,gap:r=20,children:s}){return t.jsx(Zi,{className:"tpl-masonry",children:l=>{const o=Math.max(2,Math.floor((l+r)/(n+r))),c=(l-r*(o-1))/o,f=Array.from({length:o},()=>({height:0,items:[]}));for(const h of e){const g=Rn(h.format),x=f.reduce((m,j)=>j.height<m.height-.5?j:m,f[0]);x.items.push(h),x.height+=c*g.height/g.width+56+r}return t.jsx("div",{className:"tpl-masonry-columns",style:{gap:r,gridTemplateColumns:`repeat(${o}, minmax(0, 1fr))`},children:f.map((h,g)=>t.jsx("div",{className:"tpl-masonry-column",style:{gap:r},children:h.items.map(x=>s(x,c))},g))})}})}function L4(e){return Array.from(e.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), [tabindex]:not([tabindex="-1"])'))}function $4({template:e,list:n,pool:r,favorites:s,onToggleFavorite:l,onShow:o,onUse:c,onFilterUse:f,onFilterStyle:h,onClose:g}){const x=p.useRef(null),m=p.useRef(null),[j,k]=p.useState(0),v=p.useMemo(()=>va(e),[e]),w=Rn(e.format),N=Qr(e),M=p.useMemo(()=>x4(e,r,6),[e,r]),I=n.findIndex(U=>U.id===e.id),F=I>0?n[I-1]:null,z=I>=0&&I<n.length-1?n[I+1]:null,A=i(e.title),T=Math.min(520/w.width,520/w.height,(typeof window>"u"?900:window.innerHeight*.62)/w.height),L={width:Math.round(w.width*T),height:Math.round(w.height*T)},H={width:Math.round(64*w.width/Math.max(w.width,w.height)),height:Math.round(64*w.height/Math.max(w.width,w.height))},P=p.useRef({previous:F,next:z,onShow:o,onClose:g});return P.current={previous:F,next:z,onShow:o,onClose:g},p.useEffect(()=>k(0),[e]),p.useEffect(()=>{m.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const U=requestAnimationFrame(()=>{var D,re;return(re=(D=x.current)==null?void 0:D.querySelector(".tpl-preview-use"))==null?void 0:re.focus()}),K=D=>{const re=x.current;if(re){if(D.key==="Escape")D.preventDefault(),P.current.onClose();else if(D.key==="ArrowLeft"&&P.current.previous&&!(D.target instanceof HTMLInputElement))D.preventDefault(),P.current.onShow(P.current.previous);else if(D.key==="ArrowRight"&&P.current.next&&!(D.target instanceof HTMLInputElement))D.preventDefault(),P.current.onShow(P.current.next);else if(D.key==="Tab"){const q=L4(re);if(q.length===0)return;D.shiftKey&&document.activeElement===q[0]?(D.preventDefault(),q[q.length-1].focus()):!D.shiftKey&&document.activeElement===q[q.length-1]&&(D.preventDefault(),q[0].focus())}}};return window.addEventListener("keydown",K,!0),()=>{var D;cancelAnimationFrame(U),window.removeEventListener("keydown",K,!0),(D=m.current)==null||D.focus()}},[]),t.jsx("div",{className:"tpl-preview-backdrop",onMouseDown:U=>{U.target===U.currentTarget&&(U.preventDefault(),g())},children:t.jsxs("div",{ref:x,className:"tpl-preview",role:"dialog","aria-modal":"true","aria-labelledby":"tpl-preview-title","data-testid":"template-preview",children:[t.jsx("button",{className:"icon-btn tpl-preview-close",type:"button","aria-label":i("关闭"),onClick:g,children:t.jsx(Pn,{})}),t.jsxs("div",{className:"tpl-preview-main",children:[t.jsxs("div",{className:"tpl-preview-stage",children:[t.jsx("button",{className:"icon-btn tpl-preview-step",type:"button","aria-label":i("上一个模板"),disabled:!F,onClick:()=>F&&o(F),children:t.jsx(Qi,{})}),t.jsx("div",{className:"tpl-preview-page",style:{width:L.width,height:L.height},children:v&&t.jsx(Yn,{source:v,page:j,width:L.width,height:L.height})}),t.jsx("button",{className:"icon-btn tpl-preview-step",type:"button","aria-label":i("下一个模板"),disabled:!z,onClick:()=>z&&o(z),children:t.jsx(gm,{})})]}),e.pageCount>1&&v&&t.jsx("div",{className:"tpl-preview-pages",role:"group","aria-label":i("模板页面"),children:Array.from({length:e.pageCount},(U,K)=>t.jsx("button",{type:"button",className:"tpl-preview-thumb","aria-label":i("第 {n} 页",{n:K+1}),"aria-pressed":j===K,onClick:()=>k(K),children:t.jsx(Yn,{source:v,page:K,width:H.width,height:H.height})},K))})]}),t.jsxs("div",{className:"tpl-preview-side",children:[t.jsx("div",{className:"tpl-preview-uses",children:N.uses.map(U=>t.jsx("button",{type:"button",className:"tpl-preview-link",onClick:()=>f(U),children:i(Xi(U))},U))}),t.jsx("h2",{id:"tpl-preview-title",children:A}),t.jsx("p",{className:"tpl-preview-desc",children:i(e.description)}),t.jsxs("dl",{className:"tpl-preview-specs",children:[t.jsxs("div",{children:[t.jsx("dt",{children:i("尺寸")}),t.jsxs("dd",{className:"tnum",children:[i(w.name)," · ",w.width,"×",w.height]})]}),t.jsxs("div",{children:[t.jsx("dt",{children:i("页数")}),t.jsx("dd",{className:"tnum",children:i("{n} 页",{n:e.pageCount})})]}),t.jsxs("div",{children:[t.jsx("dt",{children:i("编辑方式")}),t.jsx("dd",{children:e.workspace==="markdown"?i("Markdown 卡片"):i("自由编辑")})]}),t.jsxs("div",{children:[t.jsx("dt",{children:i("风格")}),t.jsx("dd",{className:"tpl-preview-chips",children:N.styles.map(U=>t.jsx("button",{type:"button",className:"chip",onClick:()=>h(U),children:i(Wm(U))},U))})]}),t.jsxs("div",{children:[t.jsx("dt",{children:i("颜色")}),t.jsx("dd",{className:"tpl-preview-colors",children:N.colors.map(U=>{var K;return t.jsx("span",{className:"tpl-color-dot",title:i(Hm(U)),style:{background:(K=Nd.find(D=>D.id===U))==null?void 0:K.swatch}},U)})})]})]}),t.jsxs("div",{className:"tpl-preview-actions",children:[t.jsx("button",{className:"primary tpl-preview-use",type:"button",onClick:()=>c(e),children:i("使用这个模板")}),t.jsx(Um,{className:"ghost tpl-preview-heart",template:e,on:s.has(e.id),onToggle:()=>l(e.id)})]}),M.length>0&&t.jsxs("section",{className:"tpl-preview-similar","aria-labelledby":"tpl-preview-similar",children:[t.jsx("h3",{id:"tpl-preview-similar",children:i("相似模板")}),t.jsx("div",{className:"tpl-preview-similar-grid",children:M.map(U=>{const K=va(U),D=Rn(U.format),re=84,q=Math.min(re/D.width,re/D.height);return t.jsxs("button",{type:"button",className:"tpl-preview-similar-item","aria-label":i("预览{title}",{title:i(U.title)}),onClick:()=>o(U),children:[t.jsx("span",{className:"tpl-preview-similar-art",children:K&&t.jsx(Yn,{source:K,width:Math.round(D.width*q),height:Math.round(D.height*q),lazy:!0})}),t.jsx("span",{children:i(U.title)})]},U.id)})})]})]})]})})}const D4="https://github.com/lottshin/DingCard/blob/master/docs/templates.md",Kr="all";function A4({system:e,onUseTemplate:n}){na();const r=p.useMemo(()=>Ts("markdown-card"),[]),s=p.useMemo(()=>Ts("freeform-slide"),[]),l=p.useMemo(()=>[...r,...s],[r,s]),o=p.useMemo(()=>e?l.filter(W=>$m(W)===e):l,[l,e]),[c,f]=p.useState(""),[h,g]=p.useState(null),[x,m]=p.useState(null),[j,k]=p.useState(null),[v,w]=p.useState(null),[N,M]=p.useState(!1),[I,F]=z4(),[z,A]=p.useState(null),T=Fd(o),L=h&&T.includes(h)?h:null,H=x&&o.some(W=>W.format===x)?x:null,P=j&&o.some(W=>Qr(W).styles.includes(j))?j:null,U=v&&o.some(W=>Qr(W).colors.includes(v))?v:null,K={text:c,use:L,format:H,style:P,color:U,only:N?I:null},D=ai(o,K),re=Ws.filter(W=>W.id===H||ai(o,{...K,format:W.id}).length>0),q=Tm.filter(W=>W.id===P||ai(o,{...K,style:W.id}).length>0),te=Nd.filter(W=>W.id===U||ai(o,{...K,color:W.id}).length>0),be=!!(c.trim()||L||H||P||U||N),ne=be?[]:T.map(W=>({id:W,templates:D.filter(ae=>Qr(ae).uses[0]===W)})).filter(W=>W.templates.length>0),Be=z?l.find(W=>W.id===z)??null:null;function le(){f(""),g(null),m(null),k(null),w(null),M(!1)}const De=(W,ae)=>t.jsx(I4,{template:W,width:ae,favorited:I.has(W.id),onToggleFavorite:F,onPreview:ke=>A(ke.id),onUse:n},W.id);return t.jsxs("section",{className:"page tpl-center","aria-label":i("模板中心"),children:[t.jsxs("div",{className:"page-head",children:[t.jsx("div",{children:t.jsx("h1",{children:i("模板中心")})}),t.jsxs("div",{className:"tabs",role:"group","aria-label":i("按系统筛选"),children:[t.jsxs("button",{type:"button","aria-pressed":!e,onClick:()=>Rt(ft.templates()),children:[i("全部")," ",t.jsx("span",{className:"tnum",children:l.length})]}),t.jsxs("button",{type:"button","aria-pressed":e==="markdown-card",onClick:()=>Rt(ft.templates("markdown-card")),children:[t.jsx("span",{className:"sys-dot md","aria-hidden":"true"}),i("Markdown 卡片")," ",t.jsx("span",{className:"tnum",children:r.length})]}),t.jsxs("button",{type:"button","aria-pressed":e==="freeform-slide",onClick:()=>Rt(ft.templates("freeform-slide")),children:[t.jsx("span",{className:"sys-dot ff","aria-hidden":"true"}),i("自由编辑")," ",t.jsx("span",{className:"tnum",children:s.length})]})]})]}),t.jsxs("div",{className:"tpl-finder",children:[t.jsxs("label",{className:"search-field tpl-search",children:[t.jsx(Ma,{}),t.jsx("input",{type:"search","data-testid":"template-center-search","aria-label":i("搜索模板"),placeholder:i("搜索模板,比如:菜单、中秋、读书笔记"),value:c,onChange:W=>f(W.target.value),onKeyDown:W=>{W.key==="Escape"&&c&&(W.preventDefault(),f(""))}}),c&&t.jsx("button",{className:"tpl-search-clear",type:"button","aria-label":i("清空搜索"),onClick:()=>f(""),children:t.jsx(Pn,{})})]}),T.length>1&&t.jsxs("div",{className:"tpl-uses",role:"group","aria-label":i("按用途筛选"),children:[t.jsx("button",{type:"button","aria-pressed":L===null,onClick:()=>g(null),children:i("全部")}),T.map(W=>t.jsx("button",{type:"button","aria-pressed":L===W,"data-testid":`template-use-${W}`,onClick:()=>g(L===W?null:W),children:i(Xi(W))},W))]}),t.jsxs("div",{className:"tpl-filters",children:[t.jsx(qr,{value:H??Kr,title:i("尺寸"),testId:"template-filter-format",onChange:W=>m(W===Kr?null:W),options:[{id:Kr,label:i("全部尺寸")},...re.map(W=>({id:W.id,label:`${i(W.name)} · ${i(W.ratio)}`}))]}),t.jsx(qr,{value:P??Kr,title:i("风格"),testId:"template-filter-style",onChange:W=>k(W===Kr?null:W),options:[{id:Kr,label:i("全部风格")},...q.map(W=>({id:W.id,label:i(W.name)}))]}),t.jsx(qr,{value:U??Kr,title:i("颜色"),testId:"template-filter-color",onChange:W=>w(W===Kr?null:W),options:[{id:Kr,label:i("全部颜色")},...te.map(W=>({id:W.id,label:i(W.name),swatch:{bg:W.swatch,accent:W.swatch}}))]}),t.jsxs("button",{className:"tpl-filter-toggle",type:"button","aria-pressed":N,"data-testid":"template-center-favorites",onClick:()=>M(W=>!W),children:[t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M10 17s-6.3-3.9-8.2-7.2C.5 7.4 2 4 5.2 4c2 0 3.4 1.1 4.8 2.9C11.4 5.1 12.8 4 14.8 4 18 4 19.5 7.4 18.2 9.8 16.3 13.1 10 17 10 17Z"})}),i("收藏"),I.size>0&&t.jsx("span",{className:"tnum",children:I.size})]}),t.jsx("span",{className:"grow"}),t.jsx("span",{className:"tpl-count tnum","data-testid":"template-center-count",children:i("{n} 套模板",{n:D.length})}),be&&t.jsx("button",{className:"link-btn",type:"button",onClick:le,children:i("清除筛选")})]})]}),D.length===0&&t.jsxs("div",{className:"empty tpl-empty","data-testid":"template-center-empty",children:[t.jsx("b",{children:i("没有找到相关模板")}),t.jsx("button",{className:"ghost",type:"button",onClick:le,children:i("清除筛选")})]}),be&&D.length>0&&t.jsx(Hf,{templates:D,children:De}),!be&&ne.map(W=>t.jsxs("section",{className:"tpl-section","aria-labelledby":`tpl-use-${W.id}`,children:[t.jsxs("div",{className:"tpl-section-head",children:[t.jsx("h2",{id:`tpl-use-${W.id}`,children:i(Xi(W.id))}),t.jsx("span",{className:"tnum",children:W.templates.length}),t.jsx("span",{className:"grow"}),t.jsx("button",{className:"link-btn",type:"button",onClick:()=>g(W.id),children:i("只看这一类")})]}),t.jsx(Hf,{templates:W.templates,children:De})]},W.id)),t.jsxs("aside",{className:"tpl-contribute","aria-label":i("贡献模板"),children:[t.jsxs("div",{children:[t.jsx("b",{children:i("模板由社区共建")}),t.jsx("p",{children:i("每套模板都在仓库里维护。做了一套好看的版式?按贡献指南提交 Pull Request,合并后所有人都能用。想复用自己的作品,在「我的项目」里复制一份就行。")})]}),t.jsx("a",{className:"ghost tpl-contribute-link",href:D4,target:"_blank",rel:"noreferrer",children:i("查看贡献指南")})]}),Be&&t.jsx($4,{template:Be,list:D,pool:o,favorites:I,onToggleFavorite:F,onShow:W=>A(W.id),onUse:W=>{A(null),n(W)},onFilterUse:W=>{A(null),le(),g(W)},onFilterStyle:W=>{A(null),le(),k(W)},onClose:()=>A(null)})]})}const P4=["decks","shares","drafts","assets","images"];function T4(e,n){return n===null?e("还没用过"):new Date(n).toLocaleString()}function W4({ownerId:e,onClose:n}){const r=Ks(),l=na()==="zh"?"、":", ",o=p.useId(),c=p.useRef(null),[f,h]=p.useState(null),[g,x]=p.useState(null),[m,j]=p.useState(""),[k,v]=p.useState(["shares","images"]),[w,N]=p.useState(!1),[M,I]=p.useState(null),[F,z]=p.useState(null),[A,T]=p.useState(!1),[L,H]=p.useState(null),P=()=>{Et.tokens.list(e).then(q=>{h(q),x(null)},q=>{x(vn(q,r("暂时无法读取令牌,请稍后重试")))})};p.useEffect(()=>{var te;P(),(te=c.current)==null||te.focus();const q=be=>{be.key==="Escape"&&(be.preventDefault(),n())};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[]);const U=q=>{v(te=>te.includes(q)?te.filter(be=>be!==q):[...te,q])},K=async()=>{if(!w){N(!0),I(null);try{const q=await Et.tokens.create(e,m.trim(),k);z(q),T(!1),j(""),P()}catch(q){I(vn(q,r("暂时无法创建令牌,请稍后重试")))}finally{N(!1)}}},D=async()=>{if(F)try{await navigator.clipboard.writeText(F.token),T(!0)}catch{}},re=async()=>{if(!L)return;const q=L;H(null);try{await Et.tokens.revoke(e,q.id),P()}catch(te){x(vn(te,r("暂时无法撤销令牌,请稍后重试")))}};return t.jsxs("div",{className:"modal-backdrop",onMouseDown:q=>q.target===q.currentTarget&&n(),children:[t.jsxs("div",{className:"modal token-modal",role:"dialog","aria-modal":"true","aria-labelledby":o,children:[t.jsxs("div",{className:"modal-head",children:[t.jsx("h3",{id:o,children:r("API 令牌")}),t.jsx("p",{className:"token-intro",children:r("给程序用的钥匙:带上这个值的请求就代表你的账号,只能做勾选范围内的事。值只显示一次,随时可以撤销。")})]}),F&&t.jsxs("div",{className:"token-minted","data-testid":"token-minted",children:[t.jsx("div",{className:"token-minted-label",children:r("「{name}」的令牌值(只显示这一次)",{name:F.name})}),t.jsx("code",{className:"token-value",children:F.token}),t.jsxs("div",{className:"token-minted-actions",children:[t.jsx("button",{type:"button",className:"ghost",onClick:()=>void D(),children:r(A?"已复制":"复制")}),t.jsx("button",{type:"button",className:"ghost",onClick:()=>z(null),children:r("我存好了")})]})]}),t.jsxs("div",{className:"token-create",children:[t.jsx("label",{className:"field-label",htmlFor:"token-name",children:r("名称")}),t.jsx("input",{id:"token-name",ref:c,className:"token-name-input","data-testid":"token-name-input",value:m,onChange:q=>j(q.target.value),placeholder:r("比如:我的智能体")}),t.jsx("span",{className:"field-label",children:r("权限")}),t.jsx("div",{className:"token-scopes",role:"group","aria-label":r("权限"),children:P4.map(q=>t.jsxs("label",{className:"token-scope",children:[t.jsx("input",{type:"checkbox","data-testid":`token-scope-${q}`,checked:k.includes(q),onChange:()=>U(q)}),r(q)]},q))}),M&&t.jsx("p",{className:"token-error",role:"alert",children:M}),t.jsx("button",{type:"button",className:"accent token-create-btn","data-testid":"token-create-btn",disabled:w||m.trim()===""||k.length===0,onClick:()=>void K(),children:r(w?"创建中…":"创建令牌")})]}),t.jsxs("div",{className:"token-list","data-testid":"token-list",children:[g&&t.jsx("p",{className:"token-error",role:"alert",children:g}),f!==null&&f.length===0&&!g&&t.jsx("p",{className:"token-empty",children:r("还没有令牌。")}),f==null?void 0:f.map(q=>t.jsxs("div",{className:"token-row","data-testid":"token-row",children:[t.jsxs("div",{className:"token-row-main",children:[t.jsx("b",{children:q.name}),t.jsx("span",{className:"token-row-scopes",children:q.scopes.map(te=>r(te)).join(l)})]}),t.jsxs("div",{className:"token-row-meta",children:[t.jsx("span",{children:r("最近使用:{time}",{time:T4(r,q.lastUsedAt)})}),t.jsx("button",{type:"button",className:"ghost token-revoke",onClick:()=>H(q),children:r("撤销")})]})]},q.id))]}),t.jsx("div",{className:"modal-foot",children:t.jsx("button",{type:"button",className:"ghost",onClick:n,children:r("关闭")})})]}),L&&t.jsx(fi,{title:r("撤销「{name}」?",{name:L.name}),body:r("撤销后用这个令牌的程序立刻无法访问。"),confirmLabel:r("撤销"),danger:!0,onConfirm:()=>void re(),onCancel:()=>H(null)})]})}function Ym(e){const n=e,[r,s]=p.useState([]),[l,o]=p.useState(n?"loading":"idle"),[c,f]=p.useState(null),[h,g]=p.useState([]),x=p.useRef(0),m=p.useRef(n);m.current=n;const j=p.useCallback(()=>{const N=++x.current;if(!n){s([]),o("idle"),f(null);return}o(M=>M==="ready"?M:"loading"),xt(n).assets.list(n).then(M=>{N===x.current&&(s(Pc(M)),o("ready"),f(null))},M=>{N===x.current&&(o("error"),f(vn(M,i("暂时无法读取素材库,请稍后重试"))))})},[n]);p.useEffect(()=>(j(),g([]),()=>{x.current+=1}),[j]);const k=p.useCallback(async N=>{const M=m.current,I={added:[],failed:[]};if(!M||N.length===0)return I;const F=N.map(z=>({id:di(),name:z.name}));g(z=>[...F,...z]);for(const[z,A]of N.entries())try{const T=await xt(M).assets.add(M,await a4(A));if(m.current!==M)break;I.added.push(T),s(L=>Pc([T,...L])),o("ready")}catch(T){I.failed.push({name:A.name,error:vn(T,i("上传失败,请稍后重试"))})}finally{g(T=>T.filter(L=>L.id!==F[z].id))}return I},[]),v=p.useCallback(async(N,M)=>{const I=m.current;if(!I)return;const F=await xt(I).assets.rename(I,N.id,M);m.current===I&&s(z=>z.map(A=>A.id===F.id?F:A))},[]),w=p.useCallback(async N=>{const M=m.current;M&&(await xt(M).assets.remove(M,N.id),m.current===M&&s(I=>I.filter(F=>F.id!==N.id)))},[]);return{status:l,assets:r,error:c,uploads:h,reload:j,upload:k,rename:v,remove:w}}function Zm(e){const{added:n,failed:r}=e;if(r.length===0)return n.length>0?{title:i("已上传 {n} 张图片",{n:n.length}),tone:"info"}:null;const[s]=r,l=r.length>1?i(",另有 {n} 张也没上传",{n:r.length-1}):"";return{title:n.length>0?i("上传了 {added} 张,{failed} 张没有上传",{added:n.length,failed:r.length}):i("{n} 张图片没有上传",{n:r.length}),detail:i("「{name}」{error}",{name:s.name,error:s.error})+l,tone:"error"}}const H4="slicer.user-templates.";function Xc(e){return H4+e}function O4(e){return typeof e=="object"&&e!==null}function _4(e){try{const n=localStorage.getItem(Xc(e));if(n===null)return null;const r=JSON.parse(n);return Array.isArray(r)?r:[]}catch{return[]}}function Of(e,n){try{n.length===0?localStorage.removeItem(Xc(e)):localStorage.setItem(Xc(e),JSON.stringify(n))}catch{}}function B4(e){if(!O4(e))return null;const n=$1(e.draft);if(!n)return null;const r=typeof e.name=="string"&&e.name.trim()?e.name.trim():n.title;return n.mode==="freeform-slide"?{mode:"freeform-slide",title:r,document:n.document}:{mode:"markdown-card",title:r,document:n.document}}async function K4(e,n){const r=_4(e);if(r===null)return 0;let s=[...r],l=0;for(;s.length>0;){const[o,...c]=s,f=B4(o);f&&(await n(f),l+=1),s=c,Of(e,s)}return Of(e,[]),l}const V4=700,il=new Set,qc=new Set;function Ko(){return Promise.all([...il].map(e=>e.flush())).then(()=>{})}function G4(e){return qc.add(e),()=>{qc.delete(e)}}class U4{constructor(n,r,s,l=V4,o=null){ga(this,"draftId");ga(this,"queued",null);ga(this,"timer",null);ga(this,"chain",Promise.resolve());ga(this,"saving",0);ga(this,"listening",!0);this.save=n,this.listener=s,this.delay=l,this.ownerId=o,this.draftId=r}get id(){return this.draftId}get busy(){return this.queued!==null||this.saving>0}get pending(){return this.queued!==null}schedule(n,r){this.queued={content:n,tag:r},il.add(this),this.clearTimer(),this.timer=setTimeout(()=>{this.timer=null,this.flush()},this.delay)}flush(){return this.clearTimer(),this.chain=this.chain.then(()=>this.drain()),this.chain}detach(){return this.listening=!1,this.flush()}cancel(){this.listening=!1,this.clearTimer(),this.queued=null,this.saving===0&&il.delete(this)}clearTimer(){this.timer!==null&&(clearTimeout(this.timer),this.timer=null)}async drain(){const n=this.queued;if(n){this.queued=null,this.saving+=1;try{const r={...n.content,id:this.draftId??void 0},s=await this.save(r);this.draftId=s.id,this.listening&&this.listener.onSaved(s,n.content,n.tag);for(const l of[...qc])l(s,this.ownerId)}catch(r){!this.queued&&this.listening&&(this.queued=n),this.listening&&this.listener.onError(r)}finally{this.saving-=1,this.busy||il.delete(this)}}}}function Y4(e){return[...e].sort((n,r)=>r.updatedAt-n.updatedAt)}function _f(e,n){const r=new Map(e.map(s=>[s.id,s]));for(const s of n.values()){const l=r.get(s.id);(!l||l.updatedAt<s.updatedAt)&&r.set(s.id,s)}return Y4([...r.values()])}const jc=new Map,Qc=new Map;function Z4(e){if(si(e))return Promise.resolve();let n=jc.get(e);return n||(n=K4(e,r=>xt(e).drafts.save(e,r)).then(r=>{r>0&&Qc.set(e,r)},()=>{jc.delete(e)}),jc.set(e,n)),n}function X4(e){const[n,r]=p.useState([]),[s,l]=p.useState(e?"loading":"idle"),[o,c]=p.useState(null),[f,h]=p.useState(0),g=p.useRef(0),x=p.useRef(new Map),m=e;p.useEffect(()=>{if(x.current=new Map,!!m)return G4((v,w)=>{w===m&&(x.current.set(v.id,v),r(N=>_f(N,new Map([[v.id,v]]))))})},[m]);const j=p.useCallback(v=>{x.current.delete(v),r(w=>w.filter(N=>N.id!==v))},[]),k=p.useCallback(()=>{const v=++g.current;if(!m){r([]),l("idle"),c(null);return}l(w=>w==="ready"?w:"loading"),Z4(m).then(()=>{const w=Qc.get(m);return w&&v===g.current&&(Qc.delete(m),h(w)),xt(m).drafts.list(m)}).then(w=>{v===g.current&&(r(_f(w,x.current)),l("ready"),c(null))},w=>{v===g.current&&(l("error"),c(w instanceof Error&&w.message?i(w.message):i("暂时无法读取项目,请稍后重试")))})},[m]);return p.useEffect(()=>(k(),()=>{g.current+=1}),[k]),{status:s,projects:n,error:o,movedTemplates:f,reload:k,forget:j}}const q4={"markdown-card":"Markdown 卡片","freeform-slide":"自由编辑"},Jc="dingcard.sidebar-collapsed.v1";function Q4(){try{return localStorage.getItem(Jc)==="1"}catch{return!1}}function J4(e){try{e?localStorage.setItem(Jc,"1"):localStorage.removeItem(Jc)}catch{}}function e6({route:e,user:n,ownerId:r,guestLeft:s,dataVersion:l,onMoveGuestWork:o,theme:c,onToggleTheme:f,onLogout:h,editorMeta:g,onProjectRemoved:x,onProjectRenamed:m}){const j=Ks(),k=na(),v=X4(r),w=Ym(r),N=p.useMemo(()=>u4(w.assets,v.projects),[w.assets,v.projects]),[M,I]=p.useState(null),[F,z]=p.useState(null),[A,T]=p.useState(!1),[L,H]=p.useState(null),[P,U]=p.useState(!1),[K,D]=p.useState(!1),[re,q]=p.useState(!1),[te,be]=p.useState(!1),[ne,Be]=p.useState(!1),[le,De]=p.useState(Q4),W=p.useRef(null),ae=p.useRef(null),ke=p.useMemo(()=>[...Ts("markdown-card"),...Ts("freeform-slide")],[]),Ee={"markdown-card":ke.filter(ee=>ee.workspace==="markdown").length,"freeform-slide":ke.filter(ee=>ee.workspace==="freeform").length};p.useEffect(()=>{const ee=He=>{(He.metaKey||He.ctrlKey)&&He.key.toLowerCase()==="k"&&(He.preventDefault(),U(ct=>!ct))};return window.addEventListener("keydown",ee),()=>window.removeEventListener("keydown",ee)},[]),p.useEffect(()=>{if(!K&&!re)return;const ee=ct=>{var bt,gn;const Lt=ct.target;(bt=W.current)!=null&&bt.contains(Lt)||D(!1),(gn=ae.current)!=null&&gn.contains(Lt)||q(!1)},He=ct=>{ct.key==="Escape"&&(D(!1),q(!1))};return document.addEventListener("pointerdown",ee),document.addEventListener("keydown",He),()=>{document.removeEventListener("pointerdown",ee),document.removeEventListener("keydown",He)}},[K,re]),p.useEffect(()=>Be(!1),[e]);const{reload:ue}=v,{reload:Ye}=w;p.useEffect(()=>{l!==0&&(ue(),Ye())},[l,Ye,ue]),p.useEffect(()=>{v.movedTemplates!==0&&H({title:j("你存过的 {n} 个模板已经放进「我的项目」",{n:v.movedTemplates}),detail:j("模板改由社区共建;想复用自己的作品,在项目卡片上选「复制一份」。"),tone:"info"})},[v.movedTemplates,j]);function Ue(){De(ee=>(J4(!ee),!ee)),D(!1),q(!1)}function Ot(ee,He,ct){const Lt=g[ee];if(ct&&Lt.draftId===ct){Rt(ft.editor(ee));return}if(Lt.unsaved){I({system:ee,path:He});return}Rt(He)}const zt=(ee="rednote")=>Ot("markdown-card",ft.newProject("markdown-card",{platformId:ee})),oe=(ee=1080,He=1440)=>Ot("freeform-slide",ft.newProject("freeform-slide",{width:ee,height:He})),fe=ee=>Ot(ee.mode,ft.openProject(ee.mode,ee.id),ee.id),Ae=ee=>{const He=$m(ee);Ot(He,ft.fromTemplate(He,ee.id))};async function ze(ee){if(!r)return;const He=ee.mode==="markdown-card"?{mode:ee.mode,title:j("{title} 副本",{title:ee.title}),document:ee.document}:{mode:ee.mode,title:j("{title} 副本",{title:ee.title}),document:ee.document};try{await xt(r).drafts.save(r,He),v.reload(),H({title:j("已复制「{title}」",{title:ee.title}),tone:"info"})}catch(ct){H({title:j("复制失败"),detail:vn(ct,j("暂时无法复制,请稍后重试")),tone:"error"})}}async function Xe(ee,He){if(!r)return;const ct=ee.mode==="markdown-card"?{id:ee.id,mode:ee.mode,title:He,document:ee.document}:{id:ee.id,mode:ee.mode,title:He,document:ee.document};try{await xt(r).drafts.save(r,ct),m(ee.mode,ee.id,He),v.reload()}catch(Lt){H({title:j("重命名失败"),detail:vn(Lt,j("暂时无法重命名,请稍后重试")),tone:"error"})}}async function Fe(ee){if(!r)return;let He;try{He=await ee.text()}catch{H({title:j("导入失败"),detail:j("文件读取失败,请重试"),tone:"error"});return}const ct=im(He);if(!ct.ok){H({title:j("导入失败"),detail:j(ct.error),tone:"error"});return}try{const Lt=r;let bt=await xt(Lt).drafts.save(Lt,ct.data);r&&r!==Lt&&(bt=await xt(r).drafts.save(r,ct.data)),v.reload(),Ot(bt.mode,ft.openProject(bt.mode,bt.id),bt.id)}catch(Lt){H({title:j("导入失败"),detail:vn(Lt,j("暂时无法导入,请稍后重试")),tone:"error"})}}async function Mt(ee){if(z(null),!!r)try{await xt(r).drafts.remove(r,ee.id);const He=Qs(r);He.markdownDraftId===ee.id&&Na(r,{markdownDraftId:null}),He.freeformDraftId===ee.id&&Na(r,{freeformDraftId:null}),x(ee.mode,ee.id),v.forget(ee.id),v.reload(),H({title:Et.remote?j("已删除「{title}」,30 天内可在回收站恢复",{title:ee.title}):j("已删除「{title}」",{title:ee.title}),tone:"info"})}catch(He){H({title:j("删除失败"),detail:vn(He,j("暂时无法删除,请稍后重试")),tone:"error"})}}function Qe(ee){r&&w.upload(ee).then(He=>{const ct=Zm(He);ct&&H(ct)})}function mt(ee,He){w.rename(ee,He).catch(ct=>{H({title:j("重命名失败"),detail:vn(ct,j("暂时无法重命名,请稍后重试")),tone:"error"})})}function It(ee){w.remove(ee).then(()=>H({title:j("已删除「{title}」",{title:ee.name}),tone:"info"}),He=>H({title:j("删除失败"),detail:vn(He,j("暂时无法删除,请稍后重试")),tone:"error"}))}const _t=[{id:"new-md",label:j("新建 Markdown 卡片"),hint:j("小红书"),icon:"markdown",run:()=>zt()},{id:"new-ff",label:j("新建自由编辑"),hint:"3:4",icon:"freeform",run:()=>oe()},{id:"projects",label:j("打开我的项目"),icon:"projects",run:()=>Rt(ft.projects())},{id:"templates",label:j("打开模板中心"),icon:"templates",run:()=>Rt(ft.templates())},{id:"assets",label:j("打开素材库"),icon:"assets",run:()=>Rt(ft.assets)},{id:"theme",label:j(c==="dark"?"切换到浅色模式":"切换到深色模式"),icon:"theme",run:f},{id:"language",label:k==="zh"?"Switch to English":j("切换到中文"),icon:"language",run:()=>em(k==="zh"?"en":"zh")}],lt=ee=>e.name===ee?"page":void 0,pt=["wb",ne?"is-side-open":"",le?"is-collapsed":""].filter(Boolean).join(" ");return t.jsxs("div",{className:pt,"data-testid":"workbench",children:[t.jsxs("aside",{className:"wb-side","aria-label":j("主导航"),children:[t.jsxs("div",{className:"wb-brand",children:[t.jsx("img",{src:vl,alt:"",width:"28",height:"28"}),t.jsx("span",{className:"wb-brand-name",children:j("叮卡")}),t.jsx("button",{className:"icon-btn wb-collapse",type:"button",onClick:Ue,"aria-label":j(le?"展开侧栏":"收起侧栏"),title:j(le?"展开侧栏":"收起侧栏"),"data-testid":"sidebar-toggle",children:t.jsx(yf,{})})]}),t.jsxs("div",{className:"wb-new",ref:W,children:[t.jsxs("button",{className:"accent wb-new-btn",type:"button","aria-haspopup":"menu","aria-expanded":K,"aria-label":le?j("新建项目"):void 0,title:le?j("新建项目"):void 0,onClick:()=>D(ee=>!ee),"data-testid":"new-project",children:[t.jsxs("span",{children:[t.jsx(fl,{}),t.jsx("span",{className:"wb-text",children:j("新建项目")})]}),t.jsx(hd,{className:"wb-text"})]}),K&&t.jsxs("div",{className:"menu wb-new-menu",role:"menu",children:[t.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{D(!1),zt()},children:[t.jsx("span",{className:"sys-tile sys-tile-md",children:t.jsx(Us,{})}),t.jsxs("span",{children:[t.jsx("b",{children:j("Markdown 卡片")}),t.jsx("small",{children:j("写长文,自动分页成一组卡片")})]})]}),t.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{D(!1),oe()},children:[t.jsx("span",{className:"sys-tile sys-tile-ff",children:t.jsx(Gi,{})}),t.jsxs("span",{children:[t.jsx("b",{children:j("自由编辑")}),t.jsx("small",{children:j("像做海报一样自由排版")})]})]})]})]}),t.jsx("nav",{className:"wb-nav","aria-label":j("工作台导航"),children:[{name:"home",href:ft.home,icon:t.jsx(T2,{}),label:j("首页"),count:0},{name:"projects",href:ft.projects(),icon:t.jsx(ym,{}),label:j("我的项目"),count:v.projects.length},{name:"templates",href:ft.templates(),icon:t.jsx(Vi,{}),label:j("模板中心"),count:0},{name:"assets",href:ft.assets,icon:t.jsx(Gs,{}),label:j("素材库"),count:w.assets.length}].map(ee=>t.jsxs("a",{href:`#${ee.href}`,"aria-current":lt(ee.name),title:le?ee.label:void 0,children:[ee.icon,t.jsx("span",{className:"wb-text",children:ee.label}),ee.count>0&&t.jsx("span",{className:"count tnum",children:ee.count})]},ee.name))}),v.projects.length>0&&t.jsxs("div",{className:"wb-recent",children:[t.jsx("div",{className:"wb-label",children:j("最近打开")}),v.projects.slice(0,3).map(ee=>t.jsxs("button",{type:"button",className:"wb-recent-item",onClick:()=>fe(ee),children:[t.jsx("span",{className:"wb-recent-thumb",children:t.jsx(Yn,{source:Cd(ee),width:22})}),t.jsx("span",{className:"wb-recent-title",children:ee.title})]},ee.id))]}),t.jsx("div",{className:"wb-foot",children:n?t.jsxs("div",{className:"wb-me",ref:ae,children:[re&&t.jsxs("div",{className:"menu wb-me-menu",role:"menu",children:[t.jsxs("div",{className:"wb-me-head",children:[t.jsx("b",{children:n.username}),t.jsx("span",{children:Et.remote?j("服务器账号 · 多设备同步"):j("本地账号 · 数据只存在这台设备")})]}),t.jsx("div",{className:"menu-sep",role:"separator"}),Et.remote&&r&&t.jsxs("button",{role:"menuitem",type:"button","data-testid":"workbench-tokens",onClick:()=>{q(!1),be(!0)},children:[t.jsx(hl,{}),j("API 令牌")," "]}),t.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{q(!1),h()},"data-testid":"workbench-logout",children:[t.jsx(Vc,{}),j("退出登录")]})]}),t.jsxs("button",{className:"wb-me-btn",type:"button","aria-haspopup":"menu","aria-expanded":re,"aria-label":j("账号菜单({name})",{name:n.username}),onClick:()=>q(ee=>!ee),children:[t.jsx("span",{className:"wb-avatar","aria-hidden":"true",children:n.username.slice(0,1)}),t.jsxs("span",{className:"wb-who wb-text",children:[t.jsx("b",{children:n.username}),t.jsx("span",{children:Et.remote?j("服务器账号"):j("本地账号")})]}),t.jsx(Nl,{className:"wb-text"})]})]}):t.jsx("div",{className:"wb-guest",children:t.jsx("button",{className:"accent",type:"button",onClick:()=>Rt(ft.login),"data-testid":"workbench-login",title:le?j("登录或注册"):void 0,children:le?t.jsx(Vc,{}):j("登录或注册")})})})]}),ne&&t.jsx("div",{className:"wb-scrim",onClick:()=>Be(!1),"aria-hidden":"true"}),t.jsxs("div",{className:"wb-main",children:[t.jsxs("header",{className:"wb-top","data-testid":"workbench-topbar",children:[t.jsx("button",{className:"icon-btn wb-menu-btn",type:"button","aria-label":j("打开导航"),onClick:()=>Be(!0),children:t.jsx(yf,{})}),t.jsxs("button",{className:"wb-search",type:"button",onClick:()=>U(!0),"data-testid":"open-palette",children:[t.jsx(Ma,{}),t.jsx("span",{children:j("搜索项目、模板和操作")}),t.jsx("kbd",{children:"⌘K"})]}),t.jsx("span",{className:"grow"}),t.jsx(Sd,{}),t.jsx("button",{className:"icon-btn wb-theme",type:"button","aria-label":j("切换深浅色"),title:j(c==="dark"?"切换到浅色模式":"切换到深色模式"),onClick:f,children:c==="dark"?t.jsx(pm,{}):t.jsx(fd,{})})]}),L&&t.jsx(Fl,{className:"operation-notice--workbench",title:L.title,detail:L.detail,tone:L.tone,onDismiss:()=>H(null)}),t.jsxs("div",{className:"wb-scroll",children:[e.name==="home"&&t.jsx(C4,{user:n,ownerId:r,projects:v,assets:w,onUploadAssets:Qe,templateCounts:Ee,onNewMarkdown:zt,onNewFreeform:oe,onOpenProject:fe,onUseTemplate:Ae,onDuplicate:ze,onRename:(ee,He)=>void Xe(ee,He),onDelete:z}),e.name==="projects"&&t.jsx(E4,{ownerId:r,guestLeft:n?s:null,onMoveGuestWork:o,system:e.system,projects:v,onNewMarkdown:()=>zt(),onNewFreeform:()=>oe(),onImport:ee=>void Fe(ee),onOpenTrash:Et.remote&&r?()=>T(!0):void 0,onOpenProject:fe,onDuplicate:ze,onRename:(ee,He)=>void Xe(ee,He),onDelete:z}),e.name==="templates"&&t.jsx(A4,{system:e.system,onUseTemplate:Ae}),e.name==="assets"&&t.jsx(c4,{ownerId:r,assets:w,usage:N,onUpload:Qe,onRename:mt,onDelete:It})]})]}),P&&t.jsx(w4,{projects:v.projects,templates:ke,actions:_t,onOpenProject:fe,onUseTemplate:Ae,onClose:()=>U(!1)}),M&&t.jsx(fi,{title:j("{system}里还有没保存的修改",{system:j(q4[M.system])}),body:j("「{title}」最近的修改没能保存。继续的话,这些改动会被丢掉。",{title:g[M.system].title||j("未命名")}),confirmLabel:j("丢掉改动,继续"),cancelLabel:j("回去看看"),danger:!0,onCancel:()=>{const ee=M.system;I(null),Rt(ft.editor(ee))},onConfirm:()=>{const ee=M.path;I(null),Rt(ee)}}),F&&t.jsx(fi,{title:j("删除「{title}」?",{title:F.title}),body:Et.remote?j("删除后进入回收站:30 天内可以恢复,之后自动清除。"):j("删除后无法恢复。"),confirmLabel:j("删除"),danger:!0,onCancel:()=>z(null),onConfirm:()=>void Mt(F)}),A&&r&&Et.remote&&t.jsx(v4,{ownerId:r,onChanged:()=>v.reload(),onClose:()=>T(!1)}),te&&r&&t.jsx(W4,{ownerId:r,onClose:()=>be(!1)})]})}const Bf=/\((img:[a-z0-9]+)\)/gi;async function zs(e,n){const[r,s]=await Promise.all([e.drafts.list(n),e.assets.list(n).catch(()=>[])]);return{projects:r,assets:s}}function Kf(e){return e.projects.length+e.assets.length}function t6(e){return Math.max(0,...e.projects.map(n=>n.updatedAt),...e.assets.map(n=>n.createdAt))}async function n6(e,n,r){const{images:s={},...l}=e,o=new Set;for(const h of l.source.matchAll(Bf))o.add(h[1]);const c=new Map;for(const h of o){const g=s[h]??n.images.resolve(h);g&&g!==h&&c.set(h,await r.images.put(g))}const f=l.source.replace(Bf,(h,g)=>{const x=c.get(g);return x?`(${x})`:h});return{...l,source:f}}async function r6(e,n,r){if(e.mode==="freeform-slide")return{mode:"freeform-slide",title:e.title,document:e.document};const s=r.remote?await n6(e.document,n,r):e.document;return{mode:"markdown-card",title:e.title,document:s}}async function a6({from:e,fromId:n,to:r,toId:s,onProgress:l}){const o=await zs(e,n),c=[...o.projects].sort((j,k)=>j.updatedAt-k.updatedAt),f=[...o.assets].sort((j,k)=>j.createdAt-k.createdAt),h=c.length+f.length,g={moved:new Map,movedAssets:0,failed:0,error:null};let x=0;const m=j=>{g.failed+=1,g.error===null&&(g.error=j)};for(const j of c){try{const k=await r.drafts.save(s,await r6(j,e,r));g.moved.set(j.id,k),await e.drafts.remove(n,j.id)}catch(k){g.moved.has(j.id)||m(k)}l==null||l(++x,h)}for(const j of f){let k=!1;try{await r.assets.add(s,{dataUrl:j.src,name:j.name,width:j.width,height:j.height}),k=!0,g.movedAssets+=1,await e.assets.remove(n,j.id)}catch(v){k||m(v)}l==null||l(++x,h)}return g}function Xm({ownerId:e,onInsert:n,onManage:r}){const s=Ym(e),[l,o]=p.useState(""),[c,f]=p.useState(null),[h,g]=p.useState(!1),x=p.useRef(0),m=p.useRef(null),j=l.trim().toLocaleLowerCase(),k=p.useMemo(()=>s.assets.filter(N=>!j||N.name.toLocaleLowerCase().includes(j)),[s.assets,j]);function v(N){!e||N.length===0||(f(null),s.upload(N).then(M=>{const I=Zm(M);f(I?{text:I.detail?i("{title}:{detail}",{title:I.title,detail:I.detail}):I.title,tone:I.tone}:null)}))}const w=N=>!!e&&Array.from(N.dataTransfer.types).includes("Files");return e?t.jsxs("div",{className:h?"asset-panel is-dragging":"asset-panel",onDragEnter:N=>{w(N)&&(N.preventDefault(),x.current+=1,g(!0))},onDragOver:N=>{w(N)&&(N.preventDefault(),N.dataTransfer.dropEffect="copy")},onDragLeave:N=>{w(N)&&(x.current=Math.max(0,x.current-1),x.current===0&&g(!1))},onDrop:N=>{w(N)&&(N.preventDefault(),x.current=0,g(!1),v(Array.from(N.dataTransfer.files)))},children:[t.jsxs("div",{className:"asset-drawer-tools",children:[t.jsxs("label",{className:"search-field",children:[t.jsx(Ma,{}),t.jsx("input",{type:"search",value:l,placeholder:i("搜索素材"),"aria-label":i("搜索素材"),onChange:N=>o(N.target.value)})]}),t.jsxs("button",{className:"ghost",type:"button",onClick:()=>{var N;return(N=m.current)==null?void 0:N.click()},"data-testid":"asset-drawer-upload",title:i("上传到素材库"),children:[t.jsx(pr,{}),i("上传")]}),t.jsx("input",{ref:m,type:"file",accept:vd,multiple:!0,hidden:!0,"data-testid":"asset-drawer-file-input",onChange:N=>{const M=Array.from(N.currentTarget.files??[]);N.currentTarget.value="",v(M)}})]}),c&&t.jsx("p",{className:`asset-drawer-message is-${c.tone}`,role:c.tone==="error"?"alert":"status",children:c.text}),t.jsx("div",{className:"asset-drawer-body",children:s.status==="error"?t.jsxs("div",{className:"asset-drawer-empty",children:[t.jsx("b",{children:i("素材库读取失败")}),t.jsx("span",{children:s.error}),t.jsx("button",{className:"ghost",type:"button",onClick:s.reload,children:i("重试")})]}):k.length>0||s.uploads.length>0?t.jsxs("div",{className:"asset-drawer-grid",children:[s.uploads.map(N=>t.jsx("div",{className:"asset-pick is-pending",role:"status","aria-label":i("正在上传 {name}",{name:N.name}),children:t.jsx("span",{className:"asset-spinner"})},N.id)),k.map(N=>t.jsxs("button",{className:"asset-pick",type:"button",title:N.name,"aria-label":i("插入 {name}",{name:N.name}),"data-testid":"asset-pick",onClick:()=>n(N),children:[t.jsx("img",{src:N.src,alt:"",loading:"lazy",decoding:"async",draggable:!1}),t.jsx("span",{className:"asset-pick-name",children:N.name})]},N.id))]}):s.status==="ready"&&(j?t.jsx("p",{className:"asset-drawer-empty",children:i("没有名称包含「{query}」的素材",{query:l.trim()})}):t.jsxs("div",{className:"asset-drawer-empty",children:[t.jsx("span",{className:"asset-drop-icon",children:t.jsx(pr,{})}),t.jsx("b",{children:i("素材库还是空的")}),t.jsx("span",{children:i("把图片拖到这里,或者点「上传」。存进来的图片,所有项目都能用。")})]}))}),t.jsxs("div",{className:"asset-drawer-foot",children:[t.jsx("button",{className:"link-btn",type:"button",onClick:r,children:i("管理素材库")}),t.jsx("span",{className:"tnum",children:i("{n} 张",{n:s.assets.length})})]}),h&&t.jsxs("div",{className:"asset-drawer-drop","aria-hidden":"true",children:[t.jsx(pr,{}),i("松开,存进素材库")]})]}):t.jsx("div",{className:"asset-panel",children:t.jsxs("div",{className:"asset-drawer-empty",role:"status",children:[t.jsx("span",{className:"asset-drop-icon",children:t.jsx(Gs,{})}),t.jsx("span",{children:i("正在读取素材库…")})]})})}function i6({ownerId:e,system:n,onInsert:r,onManage:s,onClose:l}){return t.jsxs("aside",{className:"asset-drawer","aria-label":i("素材库"),"data-testid":"asset-drawer",onKeyDown:o=>{o.key!=="Escape"||o.defaultPrevented||o.target instanceof HTMLInputElement&&o.target.value||(o.preventDefault(),l())},children:[t.jsxs("div",{className:"asset-drawer-head",children:[t.jsxs("div",{children:[t.jsx("h2",{children:i("素材库")}),t.jsx("p",{children:n==="markdown-card"?i("点一下,插入到光标所在的位置"):i("点一下,放到当前页的中央")})]}),t.jsx("button",{className:"icon-btn",type:"button","aria-label":i("关闭素材库"),onClick:l,children:t.jsx(Pn,{})})]}),t.jsx(Xm,{ownerId:e,onInsert:r,onManage:s})]})}function Vf(e,n){return e instanceof Error&&e.message!==""?e.message:n}function s6({stock:e,onInsert:n}){var be;const[r,s]=p.useState(null),[l,o]=p.useState("loading"),[c,f]=p.useState(""),[h,g]=p.useState(""),[x,m]=p.useState(""),[j,k]=p.useState([]),[v,w]=p.useState(0),[N,M]=p.useState(1),[I,F]=p.useState(!1),[z,A]=p.useState(!1),[T,L]=p.useState(null),[H,P]=p.useState(null),U=p.useRef(0),K=p.useCallback(()=>{if(!e)return;o("loading");let ne=!1;return e.sources().then(Be=>{ne||(s(Be),f(le=>le!==""?le:Be.preferred),o("ready"))}).catch(()=>{ne||o("error")}),()=>{ne=!0}},[e]);p.useEffect(()=>K(),[K]);async function D(ne){if(!e||z)return;const Be=x.trim();if(Be==="")return;const le=++U.current;A(!0),P(null);try{const De=await e.search(Be,c,ne);if(le!==U.current)return;k(ne===1?De.results:[...j,...De.results]),g(De.source),w(De.total),M(De.page),F(!0)}catch(De){if(le!==U.current)return;P({text:Vf(De,i("图库搜索失败,请稍后重试")),tone:"error"})}finally{le===U.current&&A(!1)}}async function re(ne){if(!(!e||T!==null)){L(ne.id),P(null);try{const Be=await e.importImage(h,ne.id);n(Be.url,Be.alt,ne.width>0&&ne.height>0?{width:ne.width,height:ne.height}:void 0)}catch(Be){P({text:Vf(Be,i("图片导入失败,请稍后重试")),tone:"error"})}finally{L(null)}}}if(!e)return t.jsx("div",{className:"stock-panel","data-testid":"stock-panel",children:t.jsxs("div",{className:"stock-degraded",role:"status",children:[t.jsx("b",{children:i("在线图库需要服务端")}),t.jsx("span",{children:i("部署服务端并登录账户后,可以在这里搜索、插入可商用的在线图片;未配置密钥时自动使用 Openverse。")})]})});const q=(r==null?void 0:r.sources)??[],te=((be=q.find(ne=>ne.id===h))==null?void 0:be.label)??h;return t.jsxs("div",{className:"stock-panel","data-testid":"stock-panel",children:[t.jsxs("form",{className:"stock-search",onSubmit:ne=>{ne.preventDefault(),D(1)},children:[t.jsxs("label",{className:"search-field",children:[t.jsx(Ma,{}),t.jsx("input",{type:"search",value:x,placeholder:i("搜索在线图片"),"aria-label":i("搜索在线图片"),"data-testid":"stock-search-input",onChange:ne=>m(ne.target.value)})]}),t.jsx("button",{className:"accent",type:"submit",disabled:z||x.trim()==="","data-testid":"stock-search-submit",children:z?i("搜索中…"):i("搜索")})]}),q.length>1&&t.jsx("div",{className:"stock-sources",role:"group","aria-label":i("图库来源"),children:q.map(ne=>t.jsx("button",{type:"button",className:ne.id===c?"stock-source is-active":"stock-source","aria-pressed":ne.id===c,"data-testid":`stock-source-${ne.id}`,disabled:!ne.available,title:ne.available?ne.label:i("{label}:未配置密钥",{label:ne.label}),onClick:()=>f(ne.id),children:ne.label},ne.id))}),H&&t.jsx("p",{className:`asset-drawer-message is-${H.tone}`,role:H.tone==="error"?"alert":"status",children:H.text}),l==="error"?t.jsxs("div",{className:"stock-empty",children:[t.jsx("b",{children:i("图库暂不可用")}),t.jsx("button",{className:"ghost",type:"button",onClick:K,children:i("重试")})]}):j.length===0?I?t.jsx("p",{className:"stock-empty",children:i("没有找到「{query}」相关图片",{query:x.trim()})}):l==="loading"?t.jsx("p",{className:"stock-empty",role:"status",children:i("正在读取图库…")}):t.jsx("p",{className:"stock-empty",children:i("输入关键词,搜索可商用的在线图片。")}):t.jsx("div",{className:"stock-grid",children:j.map(ne=>t.jsxs("button",{className:"stock-hit",type:"button","data-testid":"stock-hit","aria-label":i("插入图库图片"),title:ne.author!==""?`${te} · ${ne.author}`:te,onClick:()=>void re(ne),children:[t.jsx("img",{src:ne.thumb,alt:"",loading:"lazy",decoding:"async",draggable:!1}),T===ne.id&&t.jsx("span",{className:"stock-hit-loading",role:"status","aria-label":i("正在导入"),children:t.jsx("span",{className:"asset-spinner"})})]},`${h}:${ne.id}`))}),j.length>0&&j.length<v&&t.jsx("button",{className:"ghost stock-more",type:"button",disabled:z,"data-testid":"stock-load-more",onClick:()=>void D(N+1),children:z?i("加载中…"):i("加载更多")})]})}const Gf=.75;function qm(e,n,r){return{jpeg:e,pixelWidth:r.width,pixelHeight:r.height,width:n.width*Gf,height:n.height*Gf}}function Vo(e){return String(Math.round(e*100)/100)}function Qm(e){if(e.length===0)throw new Error("PDF needs at least one page");const n=new TextEncoder,r=[],s=[];let l=0;const o=j=>{const k=typeof j=="string"?n.encode(j):j;r.push(k),l+=k.length},c=(j,k,v)=>{if(s[j]=l,o(`${j} 0 obj
|
|
479
|
-
|
|
475
|
+
浙江 · 杭州`,744,130,400,160,{name:"角标",fontSize:26,fontFamily:_,textFill:d(r),align:"right",lineHeight:1.7}),V("rect",96,352,1048,10,d(e),{name:"粗线",cornerRadius:0}),...l("关于我","关于我",414),b("做了七年产品设计,擅长把复杂的流程做简单。喜欢和工程师坐在一起,把想法尽快做成能用的东西。",96,476,1048,110,{name:"正文",fontSize:28,fontFamily:_,textFill:d(e),lineHeight:1.7}),...l("经历","工作与教育",634),Z(96,700,1048,s,2,{name:"经历线",cap:"butt"}),...o(0,"2022 — 至今","叮卡科技 · 资深产品设计师,负责编辑器和模板中心,带两名设计师"),...o(1,"2019 — 2022","山野咖啡 · 产品设计师,从零做了点单小程序,月活十二万"),...o(2,"2017 — 2019","城市报业 · 视觉设计师,做新闻专题和数据图表"),...o(3,"2013 — 2017","中国美术学院 · 视觉传达设计 本科"),...o(4,"技能","Figma、原型与动效、用户访谈、基础前端"),Z(96,1520,1048,s,2,{name:"页脚线",cap:"butt"}),b("作品集 lincheng.design",96,1546,700,40,{name:"品牌",fontSize:26,fontFamily:_,textFill:d(r),fontWeight:"bold",letterSpacing:2})],es)])}function ml(e,n,r,s){return`${Array.from({length:10},(l,o)=>{const c=-Math.PI/2+o*Math.PI/5,f=o%2?s:r;return`${o?"L":"M"} ${Fe(e+f*Math.cos(c))} ${Fe(n+f*Math.sin(c))}`}).join(" ")} Z`}function Fy(){const e="#c8161d",n="#1b1b1b",r=(s,l)=>b(l,120,872+s*104,1e3,96,{name:`信息${ft[s]}`,fontSize:32,fontFamily:X,textFill:d(n),lineHeight:1.75});return we([fe("通知",d("#fffdf8"),[b("叮卡科技有限公司",96,150,1048,140,{name:"品牌",fontSize:96,fontFamily:X,textFill:d(e),fontWeight:"bold",align:"center",letterSpacing:10,lineHeight:1.2}),b("叮卡〔2026〕18 号",96,318,1048,44,{name:"角标",fontSize:28,fontFamily:X,textFill:d(n),align:"center",letterSpacing:2}),Z(96,398,500,e,4,{name:"红线左",cap:"butt"}),Y(ml(22,22,22,9),598,382,44,44,{name:"红星",fill:d(e),strokeWidth:0}),Z(644,398,500,e,4,{name:"红线右",cap:"butt"}),b("关于国庆节放假安排的通知",120,456,1e3,160,{name:"标题",fontSize:52,fontFamily:X,textFill:d(n),fontWeight:"bold",align:"center",lineHeight:1.45,verticalAlign:"middle"}),b("各部门、全体员工:",120,660,1e3,50,{name:"称呼",fontSize:32,fontFamily:X,textFill:d(n)}),b("根据国家法定节假日安排,结合公司实际情况,现将 2026 年国庆节放假安排通知如下:",120,726,1e3,120,{name:"正文",fontSize:32,fontFamily:X,textFill:d(n),lineHeight:1.75}),r(0,"一、放假时间:10 月 1 日至 7 日,10 月 8 日(星期四)正常上班。"),r(1,"二、放假前请各部门做好安全检查,关闭门窗、电源和空调。"),r(2,"三、假期中如有急事,请联系行政部值班电话。"),r(3,"四、外出旅行请注意人身和财产安全。"),r(4,"五、请各部门于 9 月 28 日前把值班表报行政部。"),b(`叮卡科技有限公司
|
|
476
|
+
2026 年 9 月 21 日`,640,1430,480,130,{name:"落款",fontSize:32,fontFamily:X,textFill:d(n),align:"right",lineHeight:1.75}),Y(`${ot(100,100,96)} ${ot(100,100,84)}`,830,1396,200,200,{name:"印章环",stroke:e,strokeWidth:5,opacity:.85,blendMode:"multiply"}),Y(ml(100,100,38,15),830,1396,200,200,{name:"印章星",fill:d(e),strokeWidth:0,opacity:.85,blendMode:"multiply"})],es)])}function My(){const e="#f7efe3",n="#221a14",r="#d2462c",s="#6e6157",l="#2f5d8a",o=jd(38),c=260,f=198,h=Array.from({length:12},(F,I)=>{const M=-132+I*24,z=Math.sqrt(f*f-M*M)-26,A=Math.max(2,Math.round(z*2/44)),T=z*2/A;let L=`M ${Fe(c-z)} ${Fe(c+M)}`;for(let H=0;H<A;H+=1){const P=c-z+H*T;L+=` Q ${Fe(P+T/2)} ${Fe(c+M+((H+I)%2?9:-9))} ${Fe(P+T)} ${Fe(c+M)}`}return L}).join(" "),g=(F,I,M,z,A)=>{const T=A*Math.PI/180;return yd(Array.from({length:12},(L,H)=>{const P=H/12*Math.PI*2,U=1+(H%3===0?.06:-.03);return[Fe(F+U*(M*Math.cos(P)*Math.cos(T)-z*Math.sin(P)*Math.sin(T))),Fe(I+U*(M*Math.cos(P)*Math.sin(T)+z*Math.sin(P)*Math.cos(T)))]}),!0)},x=[g(338,196,74,42,-18),g(372,268,70,40,14),g(306,300,66,38,36)].join(" "),m="M 290 186 Q 336 176 384 194 M 330 262 Q 372 254 412 272 M 270 296 Q 306 290 340 312",j=F=>{for(;;){const[I,M]=[c+(o()*2-1)*F,c+(o()*2-1)*F];if(Math.hypot(I-c,M-c)<F)return[Fe(I),Fe(M)]}},k=Array.from({length:18},()=>{const[F,I]=j(170);return`M ${F-7} ${I} a 7 7 0 1 0 14 0 a 7 7 0 1 0 -14 0 Z`}).join(" "),v=Array.from({length:16},()=>{const[F,I]=j(180),M=Fe(3+o()*3);return`M ${Fe(F-M)} ${I} a ${M} ${M} 0 1 0 ${Fe(M*2)} 0 a ${M} ${M} 0 1 0 ${Fe(-M*2)} 0 Z`}).join(" "),w={x:280,y:470},N=(F,I,M)=>{const z=1046+F*76,A=ft[F];return[b(I,88,z,140,44,{name:`标签${A}`,fontSize:28,fontFamily:_,textFill:d(r),fontWeight:"bold",letterSpacing:4}),b(M,236,z-2,756,48,{name:`信息${A}`,fontSize:32,fontFamily:_,textFill:d(n)}),Z(88,z+60,904,"#e3d5c2",2,{name:`行线${A}`,cap:"butt"})]};return we([fe("封面",d(e),[b(`巷子里的
|
|
477
|
+
一碗牛肉面`,84,112,680,264,{name:"标题",fontSize:100,fontFamily:X,textFill:d(n),fontWeight:"bold",lineHeight:1.22}),b("藏在老小区里,开了二十年",88,388,680,50,{name:"副标题",fontSize:34,fontFamily:_,textFill:d(s),letterSpacing:1}),Y(`${ot(118,118,114)} ${ot(118,118,102)}`,754,132,236,236,{name:"评分章",stroke:r,strokeWidth:4}),b("评分",754,176,236,32,{name:"评分字",fontSize:22,fontFamily:_,textFill:d(r),fontWeight:"bold",align:"center",letterSpacing:8}),b("9.2",754,202,236,110,{name:"角标",fontSize:88,fontFamily:Xe,textFill:d(r),align:"center",lineHeight:1.15}),Y([0,1,2,3,4].map(F=>ml(12+F*30,12,12,5)).join(" "),799,316,146,24,{name:"星级",fill:d(r),strokeWidth:0}),Y(ot(c,c,250),w.x,w.y,520,520,{name:"碗",fill:d("#fbfaf6"),strokeWidth:0,shadow:{color:"#d8c6ae",blur:30,offsetX:0,offsetY:16}}),Y(`${ot(c,c,243)} ${ot(c,c,226)}`,w.x,w.y,520,520,{name:"碗边",stroke:l,strokeWidth:4}),Y(ot(c,c,f),w.x,w.y,520,520,{name:"汤",fill:d("#c8742f"),strokeWidth:0}),Y(h,w.x,w.y,520,520,{name:"面",stroke:"#f3d9a2",strokeWidth:8,cap:"round"}),Y(x,w.x,w.y,520,520,{name:"牛肉",fill:d("#7b3f2a"),strokeWidth:0}),Y(m,w.x,w.y,520,520,{name:"肉纹",stroke:"#a65d3f",strokeWidth:4,cap:"round"}),Y("M 128 196 a 54 46 0 1 0 108 0 a 54 46 0 1 0 -108 0 Z",w.x,w.y,520,520,{name:"蛋白",fill:d("#fffaf0"),strokeWidth:0}),Y(ot(186,198,25),w.x,w.y,520,520,{name:"蛋黄",fill:d("#f2b632"),strokeWidth:0}),Y(v,w.x,w.y,520,520,{name:"辣油",fill:d("#e0452b"),strokeWidth:0,opacity:.9}),Y(k,w.x,w.y,520,520,{name:"葱花",stroke:"#5f9e3c",strokeWidth:4}),Y("M 12 22 L 560 4 L 562 14 L 14 34 Z M 18 58 L 566 52 L 566 62 L 18 70 Z",470,600,580,80,{name:"筷子",fill:d("#6f4a2f"),strokeWidth:0}),...N(0,"人均","¥ 38"),...N(1,"推荐","招牌牛肉面、卤蛋、凉拌木耳"),...N(2,"地址","南门路 26 号,早上 6 点开门"),b("@阿澄吃什么",88,1344,600,44,{name:"品牌",fontSize:28,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:2})])])}function Cy(){const e="#f7f6f1",n="#16181d",r="#ffd23f",s="#3a6df0",l="#5d6370",o=[...Array.from({length:41},(h,g)=>`M ${g*48} 0 L ${g*48} 1080`),...Array.from({length:23},(h,g)=>`M 0 ${g*48} L 1920 ${g*48}`)].join(" "),c=(h,g,x)=>{const m=724+h*70,j=ft[h];return[V("rect",120,m+15,16,16,d(s),{name:`标记${j}`,cornerRadius:4}),b(g,156,m,140,46,{name:`标签${j}`,fontSize:30,fontFamily:_,textFill:d(s),fontWeight:"bold",letterSpacing:4}),b(x,300,m,760,46,{name:`信息${j}`,fontSize:30,fontFamily:_,textFill:d(n)})]},f=(h,g,x)=>({...Y(g,1e3,860,520,56,{name:h,...x}),rotation:-24});return we([fe("封面",d(e),[Y(o,0,0,1920,1080,{name:"方格",stroke:"#dde4ec",strokeWidth:1.5}),Y(ot(330,330,330),1130,200,660,660,{name:"黄圆",fill:d(r),strokeWidth:0}),b("LESSON",1130,300,660,70,{name:"课号",fontSize:52,fontFamily:Xe,textFill:d(n),align:"center",letterSpacing:12}),b("12",1130,396,660,330,{name:"角标",fontSize:300,fontFamily:Xe,textFill:d(n),align:"center",letterSpacing:-6,lineHeight:1.05}),f("笔尖木","M 0 28 L 64 0 L 64 56 Z",{fill:d("#ecd2a8"),strokeWidth:0}),f("笔芯","M 0 28 L 22 18.4 L 22 37.6 Z",{fill:d(n),strokeWidth:0}),f("笔杆","M 64 0 L 440 0 L 440 56 L 64 56 Z",{fill:d("#f4a52c"),strokeWidth:0}),f("笔棱","M 64 19 L 440 19 M 64 37 L 440 37",{stroke:"#d98a17",strokeWidth:2}),f("笔箍","M 440 0 L 478 0 L 478 56 L 440 56 Z",{fill:d("#c9ced6"),strokeWidth:0}),f("橡皮","M 478 0 L 504 0 Q 520 0 520 16 L 520 40 Q 520 56 504 56 L 478 56 Z",{fill:d("#ef8fa3"),strokeWidth:0}),b("叮卡学堂",120,100,600,44,{name:"品牌",fontSize:30,fontFamily:_,textFill:d(n),fontWeight:"bold",letterSpacing:6}),b(`用 Python
|
|
478
|
+
画一张数据图`,112,250,980,300,{name:"标题",fontSize:112,fontFamily:_,textFill:d(n),fontWeight:"bold",lineHeight:1.15,letterSpacing:-2}),b("从读表格到出图,四十分钟学会",120,590,900,56,{name:"副标题",fontSize:38,fontFamily:_,textFill:d(l),letterSpacing:1}),...c(0,"讲师","阿澄 · 数据分析师"),...c(1,"时长","40 分钟"),...c(2,"难度","入门,不需要编程基础")],Yn)])}function Ey(){const e="#e9dfcc",n="#fbf7ee",r="#c4473a",s="#2a2520",l="#7a6f62";return we([fe("笔记",d(e),[V("rect",96,320,888,840,d(n),{name:"书页",cornerRadius:10,shadow:{color:"#cdbfa6",blur:40,offsetX:0,offsetY:16}}),Y("M 0 0 L 64 0 L 64 240 L 32 212 L 0 240 Z",812,300,64,240,{name:"书签",fill:d(r),strokeWidth:0}),va(196,360,1120,"#e7b2aa",3,{name:"页边线",cap:"butt"}),Z(240,400,80,r,4,{name:"短线",cap:"butt"}),b("“",228,410,160,180,{name:"引号",fontSize:200,fontFamily:Ft,textFill:d(r),fontWeight:"bold",opacity:.85,lineHeight:1}),b(`真正重要的东西,
|
|
479
|
+
用眼睛是看不见的,
|
|
480
|
+
要用心去看。
|
|
481
|
+
—— 狐狸对小王子说`,240,600,680,420,{name:"正文",fontSize:50,fontFamily:X,textFill:d(s),lineHeight:1.8,verticalAlign:"middle"}),b("《小王子》读书笔记",96,96,888,120,{name:"标题",fontSize:84,fontFamily:X,textFill:d(s),fontWeight:"bold",effect:{type:"marker",color:"#f2c84b",amount:40}}),b("圣埃克苏佩里 · 第三次重读",96,228,888,50,{name:"副标题",fontSize:32,fontFamily:_,textFill:d(l),letterSpacing:2}),b("P.86",600,1060,320,44,{name:"角标",fontSize:28,fontFamily:_,textFill:d(l),align:"right",letterSpacing:4}),b("@阿澄的读书角",96,1290,560,44,{name:"品牌",fontSize:26,fontFamily:_,textFill:d(l),letterSpacing:4}),b("Reading notes",656,1286,328,48,{name:"英文",fontSize:30,fontFamily:Ft,textFill:d(r),italic:!0,align:"right"})])])}function zy(){const e="#1f2a44",n="#f5ecd9",r="#d0503a",s="#1d1f26",l="#6c6457",o=[3,1,2,1,3,2,1,1,3,1,2,2,1,3,1,2,1,1,3,2,1,2];let c=0;const f=o.map(g=>{const x=c;return c+=g*5+4,`M ${x} 0 L ${x+g*5} 0 L ${x+g*5} 110 L ${x} 110 Z`}).join(" ");c-=4;const h=(g,x,m)=>{const j=610+g*66,k=ft[g];return[b(x,240,j,120,46,{name:`标签${k}`,fontSize:30,fontFamily:_,textFill:d(r),fontWeight:"bold",letterSpacing:4}),b(m,380,j,880,46,{name:`信息${k}`,fontSize:30,fontFamily:_,textFill:d(s)})]};return we([fe("横幅",d(e),[V("ellipse",-300,500,900,900,d("#2a3858"),{name:"光圈",opacity:.8}),V("rect",160,200,1600,680,d(n),{name:"票面",cornerRadius:28,shadow:{color:"#0d1322",blur:60,offsetX:0,offsetY:24}}),V("rect",160,200,36,680,d(r),{name:"票边",cornerRadius:0}),V("ellipse",1300,160,80,80,d(e),{name:"缺口上"}),V("ellipse",1300,840,80,80,d(e),{name:"缺口下"}),va(1340,260,820,"#b8ab90",4,{name:"撕线",dash:14,cap:"butt"}),b("第 7 届 · 2026",240,262,900,44,{name:"角标",fontSize:30,fontFamily:_,textFill:d(r),fontWeight:"bold",letterSpacing:6}),b("城市读书节",240,320,1040,160,{name:"标题",fontSize:132,fontFamily:X,textFill:d(s),fontWeight:"bold",letterSpacing:8}),b("一整个周末,和三万本书待在一起",240,492,1040,56,{name:"副标题",fontSize:38,fontFamily:_,textFill:d(l),letterSpacing:2}),Z(240,572,1020,"#d9cdb4",2,{name:"分隔线",cap:"butt"}),...h(0,"时间","11 月 8 日 — 9 日 · 10:00 — 21:00"),...h(1,"地点","滨江美术馆 · 一号展厅"),...h(2,"门票","凭票入场,含一杯咖啡"),b("ADMIT ONE",1380,300,340,52,{name:"入场",fontSize:40,fontFamily:Ft,textFill:d(s),fontWeight:"bold",align:"center",letterSpacing:6}),b("No.",1380,386,340,40,{name:"票号前",fontSize:28,fontFamily:Ft,textFill:d(l),italic:!0,align:"center"}),b("0826",1380,424,340,130,{name:"票号",fontSize:112,fontFamily:Xe,textFill:d(r),align:"center",letterSpacing:2,lineHeight:1.1}),Y(f,1550-c/2,590,c,110,{name:"条码",fill:d(s),strokeWidth:0}),b("叮卡书店 主办",1380,744,340,44,{name:"品牌",fontSize:28,fontFamily:_,textFill:d(s),fontWeight:"bold",align:"center",letterSpacing:4})],Yn)])}function Ry(){const e="#f6efe3",n="#e5483a",r="#1f1d1b",s="#6f675d";return we([fe("方图",d(e),[b("LOW BATTERY",120,120,840,50,{name:"提示",fontSize:36,fontFamily:Xe,textFill:d(n),align:"center",letterSpacing:10}),Y("M 44 8 L 556 8 Q 592 8 592 44 L 592 236 Q 592 272 556 272 L 44 272 Q 8 272 8 236 L 8 44 Q 8 8 44 8 Z",220,250,600,280,{name:"电池",stroke:r,strokeWidth:16,join:"round"}),V("rect",836,340,40,100,d(r),{name:"正极",cornerRadius:10}),V("rect",252,282,120,216,d(n),{name:"电量",cornerRadius:16}),b("20%",400,312,400,150,{name:"角标",fontSize:130,fontFamily:Xe,textFill:d(r),align:"center",lineHeight:1.1}),b("今日电量不足",80,604,920,150,{name:"标题",fontSize:104,fontFamily:X,textFill:d(r),fontWeight:"bold",align:"center",letterSpacing:6,lineHeight:1.2}),b(`需要一杯热可可,
|
|
482
|
+
和一个不用回消息的晚上`,120,764,840,120,{name:"副标题",fontSize:36,fontFamily:_,textFill:d(s),align:"center",lineHeight:1.6}),b("@小鹿的日常",120,956,840,44,{name:"品牌",fontSize:26,fontFamily:_,textFill:d(s),align:"center",letterSpacing:4})],Dr)])}function Iy(){const e="#2f4a3f",n="#fbf8f0",r="#d98d7f",s="#26231f",l="#e6b54a",o="#ece6d6",c="#a9b8aa",m=Array.from({length:6},(j,k)=>{const v=192+k*120,w=`M 192 ${v} L ${192+96*11} ${v} L ${192+96*11} ${v+96} L 192 ${v+96} Z`,N=Array.from({length:10},(F,I)=>`M ${192+(I+1)*96} ${v} L ${192+(I+1)*96} ${v+96}`).join(" ");return`${w} ${N}`}).join(" ");return we([fe("封面",d(e),[V("rect",120,120,1200,840,d(n),{name:"稿纸",cornerRadius:6,shadow:{color:"#1b2c25",blur:48,offsetX:0,offsetY:20}}),Y(m,0,0,1920,1080,{name:"格子",stroke:r,strokeWidth:2}),b("11 × 6 = 66",192,906,600,32,{name:"页脚",fontSize:20,fontFamily:ie,textFill:d(r),letterSpacing:2}),b(`下班后的
|
|
483
|
+
第二种人生`,204,180,96*11+24,120*2,{name:"标题",fontSize:72,fontFamily:ri,textFill:d(s),letterSpacing:24,lineHeight:120/72}),b("周末专栏 · 第 12 期",1400,400,440,44,{name:"角标",fontSize:28,fontFamily:_,textFill:d(l),fontWeight:"bold",letterSpacing:4}),Z(1400,466,80,l,4,{name:"短线",cap:"butt"}),b(`白天写代码,晚上做陶艺,
|
|
484
|
+
一个程序员的两种手艺`,1400,506,440,140,{name:"副标题",fontSize:34,fontFamily:_,textFill:d(o),lineHeight:1.6}),b("文 / 林澄",1400,860,440,44,{name:"品牌",fontSize:28,fontFamily:_,textFill:d(c),letterSpacing:4})],Yn)])}const Ly={column:{title:"专栏",description:"宋体正文配一点朱红,标题、导语、图注和引文都按杂志的版式排,适合随笔、观察和长文。",pageCount:5,tags:["随笔","长文"],format:"xhs"},memo:{title:"备忘录",description:"像手机里的一页备忘录:顶栏、日期、能勾选的待办和荧光笔重点,适合清单、攻略和生活记录。",pageCount:3,tags:["清单","生活"],format:"xhs"},letter:{title:"信笺",description:"霞鹜文楷写在红格信纸上,段落首行缩进,适合书信、日记和写给自己的话。",pageCount:3,tags:["书信","日记"],format:"xhs"},night:{title:"夜读",description:"深色底、暖灰色宋体和一弯金色月亮,适合读书笔记、夜晚随笔和情绪文字。",pageCount:4,tags:["读书","随笔"],format:"xhs"},aurora:{title:"极光",description:"柔和的彩色光晕上铺一张磨砂卡片,适合生活方式、习惯清单和成长分享。",pageCount:4,tags:["生活","成长"],format:"xhs"},doc:{title:"文档",description:"知识库式的页面:顶部路径、提示框、代码块和表格,适合教程、速查表和干货整理。",pageCount:4,tags:["教程","干货"],format:"xhs"},xuan:{title:"宣纸",description:"宣纸底色、宋体首行缩进,页码刻成一方朱红印章,适合节气、诗词和传统文化。",pageCount:4,tags:["国风","节气"],format:"xhs"},swiss:{title:"瑞士",description:"黑色粗线、一抹红和大号页码,像一页国际主义版式,适合设计、方法和观点。",pageCount:4,tags:["观点","方法"],format:"xhs"},journal:{title:"手账",description:"点阵纸上的霞鹜文楷,配荧光笔标题、胶带和便利贴,适合周末记录、vlog 和手账。",pageCount:4,tags:["手账","生活"],format:"xhs"}},$i=(e,n,r)=>({title:e,description:n,pageCount:3,tags:r,format:"xhs"}),Ee=(e,n,r,s)=>({title:e,description:n,pageCount:1,tags:r,format:s}),$y={editorial:$i("编辑部","用刊头和正文网格组织长文,适合观点与方法文章。",["观点","方法"]),checklist:$i("清单","把步骤排成可以逐项勾选的工作页,适合教程和计划。",["教程","清单"]),signal:$i("信号","用海报式大标题亮出判断,适合短观点。",["观点","短文"]),"night-flight":$i("夜航","沿时间和路线展开一段记录,适合随笔与灵感。",["随笔","灵感"]),brutalist:$i("粗野","黄黑撞色、硬阴影和粗线,适合宣言与规则清单。",["宣言","海报"]),blueprint:$i("蓝图","工程网格、尺寸标注和图签,适合计划与结构拆解。",["计划","结构"]),thesis:{title:"答辩",description:"16:9 答辩套图:深蓝封面上一枚金色细线校徽,桂枝围着一本打开的书,配衬线大标题;内页米白底,左边一道深蓝书脊,章节号和罗马数字编号用金色斜体,结尾页写着「恳请各位老师批评指正」,适合毕业答辩、开题报告和学术汇报。",pageCount:3,tags:["答辩","学术"],format:"landscape"},spotlight:{title:"聚光",description:"16:9 演示套图:暖白底上一轮橙色大圆,黑色粗体大标题、细线和大页码,观点页整页铺橙色,适合汇报、路演、课程和分享。",pageCount:3,tags:["演示","汇报"],format:"landscape"},"talk-poster":Ee("讲座","大图配大标题,时间、地点、嘉宾一目了然,适合讲座、分享会和活动报名。",["活动","讲座"],"story"),"sale-poster":Ee("促销","大字优惠配产品插画,适合新品、折扣和门店活动。",["促销","门店"],"story"),"hiring-poster":Ee("招聘","团队头像排成一格,空着的那格留给新人,下面列职位和投递方式,适合招聘和团队介绍。",["招聘","团队"],"story"),"festival-poster":Ee("节日","月亮、祥云和竖排标题,适合中秋等节日问候。",["节日","问候"],"story"),invitation:Ee("邀请函","金色边框、居中排版,适合晚宴、发布会和典礼邀请。",["邀请","活动"],"story"),"quote-card":Ee("金句","一句话配出处,适合金句、日签和读书摘抄。",["金句","日签"],"square"),"product-card":Ee("商品主图","产品图配卖点和价格角标,适合电商主图和新品介绍。",["电商","产品"],"square"),"video-cover":Ee("视频封面","相机取景框里的超大标题,带录制、时间码和对焦框,适合视频和直播封面。",["封面","视频","vlog"],"landscape"),"article-cover":Ee("公众号首图","标题在左、图片在右,适合公众号文章首图。",["封面","公众号"],"wechat-cover"),flyer:Ee("宣传单","A4 单页:大标题、插画、时间地点和预约按钮,适合课程和活动传单。",["印刷","课程"],"a4"),"note-cover":Ee("干货笔记","格子纸、荧光笔大标题和三条要点,适合小红书知识类笔记封面。",["小红书","封面"],"xhs"),"photo-cover":Ee("图片拼贴","照片配胶带和角标贴纸,下面是大标题,适合小红书探店、旅行和生活封面。",["小红书","封面"],"xhs"),menu:Ee("菜单","A4 单页:店名大标题、八道菜品和价格,适合咖啡店、餐厅和饮品菜单。",["菜单","餐饮"],"a4"),"price-list":Ee("价目表","撕下来的小票:虚线隔开的项目和价格、预约框和条码,适合美甲、美发、咖啡和工作室。",["价目表","门店","小票"],"story"),certificate:Ee("证书","金色双框、居中大字和奖章,适合荣誉证书、获奖证书和结业证书。",["证书","印刷"],"a4-landscape"),"moments-grid":Ee("朋友圈九宫格","一整张插画配横跨中间一排的大标题,导出时切成九张,发朋友圈拼成一张大图。",["朋友圈","节日"],"moments-grid"),timetable:Ee("课程表","表格按科目自动配色,适合学校课程表、培训排课和每周计划。",["课程表","学校"],"a4-landscape"),"data-roundup":Ee("数据盘点","朱红大年份配三个大数字和一张柱状图,像杂志的数据页,适合年度盘点、月度总结和数据海报。",["盘点","数据"],"story"),"birthday-card":Ee("生日贺卡","花体 Happy Birthday 配宋体祝福和几片彩纸,适合生日祝福、纪念日和好友卡片。",["生日","祝福"],"square"),"compare-table":Ee("对比表","蓝色刊头配一张大字号的对比表格和一句结论,适合产品对比、方案选择和清单式总结。",["对比","清单"],"story"),"growth-timeline":Ee("成长记录","墨绿底上金色大年份和一条时间线,一个节点一件事,适合年度总结、成长复盘和里程碑打卡。",["成长","复盘"],"story"),"exhibition-poster":Ee("展览海报","黑白水墨条纹配超大 exhibition. 字标,适合展览、发布会和艺术活动。",["展览","活动"],"story"),"launch-poster":Ee("新品预告","深色底上的彩色光斑、毛玻璃信息板和 COMING SOON 大字,适合新品预告、发布倒计时和预约。",["新品","预告"],"story"),"solar-term":Ee("节气","水墨远山、落日和竖排毛笔大字,配一方红印,适合节气、节日和传统文化日签。",["节气","国风"],"story"),"podcast-cover":Ee("播客封面","包豪斯色块和几何圆,配期数大字,适合播客、电台和系列节目封面。",["播客","封面"],"square"),"pitch-cover":Ee("演示封面","雾面渐变底上一行巨大的标题,适合商业计划书、汇报和演讲的首页。",["演示","汇报"],"landscape"),"portfolio-cover":Ee("作品集封面","Playfair 大字 PORTFOLIO 压在黑白照片上,配一枚红签,适合作品集、摄影集和个人主页封面。",["作品集","封面"],"xhs"),"dessert-menu":Ee("甜品菜单","A4 单页:竖排大标题、八道甜品和价格,两角配橙黄蓝的花,适合甜品店、面包店和下午茶菜单。",["菜单","餐饮"],"a4"),"wedding-invitation":Ee("婚礼请柬","尤加利叶环里写着花体 Save the Date 和两个人的名字,适合婚礼、订婚和纪念日邀请。",["婚礼","邀请"],"story"),"autumn-market":Ee("秋日市集","枫叶和银杏叶上下围着宋体大标题,适合市集、秋季活动和周末聚会。",["市集","活动"],"xhs"),"magazine-cover":Ee("杂志封面","Playfair 大字刊名、细线刊头和一张大图,像一本独立杂志的封面,适合小红书封面、专题和期刊。",["杂志","封面"],"xhs"),"book-list":Ee("书单","一排彩色书脊立在书架上,书名竖排在书脊里,下面一本一句推荐,适合书单、好物清单和年度推荐。",["书单","读书"],"xhs"),"word-of-year":Ee("年度汉字","一个毛笔大字配拼音和一方朱红印章,适合年度汉字、年终总结和新年愿望。",["年终","国风"],"story"),"music-festival":Ee("音乐节","夜空里一轮被地平线切开的渐变太阳和霓虹网格,配大字标题和演出阵容,适合音乐节、演出和派对。",["音乐","活动"],"story"),"travel-postcard":Ee("旅行明信片","红蓝航空信封边、带齿孔的邮票和邮戳,霞鹜文楷写在横线上,适合旅行分享、问候和祝福。",["旅行","问候"],"xhs"),"design-week":Ee("设计周","黑字大号数字压在一个红圆上,下面三栏信息,国际主义版式,适合设计周、展会和论坛。",["展会","设计"],"story"),"double-eleven":Ee("双十一","一张大优惠券上印着立体的 11.11,下面是活动名、满减、时间和抢购按钮,适合双十一、年货节和店铺大促。",["双十一","促销"],"story"),"christmas-card":Ee("圣诞","毛衣花样织在领口:雪花、圣诞树和锯齿纹,下摆是罗纹,中间写 MERRY CHRISTMAS 和祝福,适合圣诞贺卡、平安夜问候和圣诞活动。",["圣诞","节日"],"xhs"),"new-year-calendar":Ee("元旦","一本手撕日历:去年最后一页刚撕掉,新的一页印着大大的 1、今天的标题和宜忌,适合元旦、跨年和新年计划。",["元旦","新年"],"xhs"),"spring-festival":Ee("春节","整张是一个红包:封口压着金色的福字圆章,下面是毛笔大字、祝福和日期,适合春节拜年、新春祝福和放假通知。",["春节","国风"],"story"),"listicle-cover":Ee("数字清单","公众号首图:左边一块朱红色压着一个巨大的编号,右边是宋体大标题,适合清单、干货和系列文章。",["公众号","清单"],"wechat-cover"),"ridge-cover":Ee("远山","公众号首图:晨雾里五层山脊叠向远处,太阳半落在山后,宋体标题写在天上,适合旅行、随笔和生活方式。",["公众号","旅行"],"wechat-cover"),"summit-visual":Ee("大会主视觉","横版主视觉:深夜蓝底上几圈轨道绕着一颗发光的球,左边是大标题、时间和地点,适合大会、峰会和发布会的背景板。",["大会","主视觉"],"landscape"),"gala-backdrop":Ee("年会","横版主视觉:黑底金线的装饰艺术风,扇形光芒、双线框和渐变金色大字,适合年会、颁奖礼和晚宴。",["年会","主视觉"],"landscape"),"agenda-sheet":Ee("会议议程","A4 横版:左边钴蓝色块写会议名、日期和地点,右边细线隔开的六行日程,适合会议、论坛和活动流程。",["议程","会议"],"a4-landscape"),"annual-report":Ee("年度报告","A4 封面:超大的年份压在金色等高线上,下面是宋体标题,适合年度报告、企业画册和白皮书。",["报告","封面"],"a4"),"stat-card":Ee("数据卡","方图:克莱因蓝底上一个巨大的数字,下面一句话说清它是什么,适合数据发布、调查结论和社交分享。",["数据","社交"],"square"),countdown:Ee("倒计时","方图:六十格刻度的表盘中间一个大数字,下面写活动和时间,适合发布会、开售和考试倒计时。",["倒计时","活动"],"square"),"versus-cover":Ee("对比测评","小红书封面:黄黑两栏斜着对开,中间一枚 VS 徽章,两边各写一个名字和一句结论,适合对比测评、二选一和选购攻略。",["小红书","测评"],"xhs"),"habit-tracker":Ee("打卡计划","小红书封面:三十个圆圈排成打卡格,已完成的涂绿打勾,配宋体大标题,适合打卡挑战、学习计划和习惯养成。",["小红书","打卡"],"xhs"),"fun-fact":Ee("冷知识","小红书封面:明黄底上一个巨大的白色问号,问题写成大标题,下面一段解答,适合冷知识、科普和问答。",["小红书","科普"],"xhs"),"trip-route":Ee("旅行攻略","小红书封面:海岸线边的手绘地图,虚线路线串起四个编号地点,每站一行名字,适合旅行攻略、路线规划和城市漫游。",["小红书","旅行"],"xhs"),"ranking-cover":Ee("年度排行","小红书封面:黑底上五条由长到短的橙色名次条,每条写一个名字,适合排行榜、年度推荐和好物清单。",["小红书","排行"],"xhs"),"grand-opening":Ee("开业大吉","红白条纹的遮阳篷下挂着 OPEN 招牌,复古双线框里是宋体红字大标题、三行开业优惠、营业时间地址和领券按钮,适合开业、新店开张和周年庆。",["开业","门店"],"story"),"race-bib":Ee("马拉松","橙色速度线上别着一张号码布:大号码、赛事名和公里数,下面三行时间、起点和报名,适合马拉松、夜跑和运动赛事。",["运动","赛事"],"story"),"live-show":Ee("直播预告","黑底上亮着红色的 ON AIR 灯牌,大标题、开播时间和平台,底部一排声波,适合直播预告、带货专场和线上发布。",["直播","预告"],"story"),"qixi-stars":Ee("七夕","靛紫夜空里一条银河,织女星和牛郎星隔河相望,鹊桥连起两颗星,金色宋体大字,适合七夕、情人节和纪念日。",["七夕","节日"],"story"),"dragon-boat":Ee("端午","一条龙舟划过朱红的太阳,下面是海水纹,竖排毛笔大字配一方朱印,左边写日子和放假安排,适合端午问候、放假通知和门店活动。",["端午","国风"],"story"),"vinyl-cover":Ee("黑胶歌单","方图:一张黑胶唱片从深蓝封套里滑出半张,封套上印着歌单名,下面三行曲目,适合歌单、播客和音乐推荐。",["歌单","音乐"],"square"),"intro-card":Ee("自我介绍","方图:一张红色的 HELLO 姓名贴,白底上手写你的名字,下面三栏写坐标、职业和爱好,适合自我介绍、新人报到和社群破冰。",["自我介绍","社交"],"square"),"daily-quote":Ee("日签","方图:深蓝夜空里一排月相,中间的满月是今晚,大号日期配一句话,适合日签、晚安和每日打卡。",["日签","晚安"],"square"),"masthead-cover":Ee("报头首图","公众号首图:像一份报纸的头版,宋体报头、双线和日期栏,大标题旁边是一张网点印出来的海上日落,适合周刊、专栏和资讯。",["公众号","周刊"],"wechat-cover"),"interview-cover":Ee("人物访谈","公众号首图:左边一块赤陶色上压着两个巨大的引号,右边是受访者的一句话、名字和身份,适合人物访谈、对话和用户故事。",["公众号","访谈"],"wechat-cover"),resume:Ee("简历","A4:粗黑的名字和蓝色的职位,右上角是联系方式,一道粗线下面写关于我,再按时间排五行工作与教育,适合求职简历和个人履历。",["简历","求职"],"a4"),notice:Ee("红头通知","A4:红色的单位名称和文号,红线中间一颗星,下面是通知标题、称呼、正文和五条事项,落款上盖着红章,适合放假通知、公司公告和社团通知。",["通知","公告"],"a4"),"food-review":Ee("探店点评","小红书封面:俯视的一碗牛肉面,筷子架在碗边,右上角一枚红色评分章,下面三行人均、推荐和地址,适合探店、美食点评和餐厅推荐。",["小红书","探店"],"xhs"),"course-cover":Ee("课程封面","16:9 横版封面:方格纸上一个明黄大圆写着课号,一支铅笔斜靠在圆边,左边是课程标题、一句介绍和讲师、时长、难度,适合网课封面、培训和分享会。",["课程","封面"],"landscape"),"book-note":Ee("读书笔记","小红书封面:一页摊开的书页上夹着红色丝带书签,荧光笔划过书名,宋体抄下一句书摘,适合读书笔记、书摘和读后感。",["小红书","读书"],"xhs"),"event-banner":Ee("活动门票","横版横幅:深蓝底上一张米色门票,左边是活动名、时间和地点,虚线撕口右边是票号和条码,适合读书节、展览、演出和市集。",["活动","门票"],"landscape"),"mood-square":Ee("情绪电量","方图:一节只剩一格红色电量的电池,配宋体大字的心情和一句话,适合心情分享、打工日常和朋友圈。",["朋友圈","心情"],"square"),"article-hero":Ee("专栏封面","横版封面:墨绿桌面上一张红格稿纸,标题一字一格写在格子里,右边是期数和导语,适合专栏、随笔和公众号长文的横版封面。",["专栏","随笔"],"landscape")},Dy={editorial:$x,checklist:Px,signal:Wx,"night-flight":Ox,brutalist:Bx,blueprint:Yx,spotlight:qx,thesis:Jx,"talk-poster":rb,"sale-poster":ab,"hiring-poster":sb,"festival-poster":ob,invitation:lb,"quote-card":cb,"product-card":db,"video-cover":ub,"article-cover":fb,flyer:hb,"note-cover":mb,"photo-cover":pb,menu:gb,"price-list":yb,certificate:jb,"moments-grid":wb,timetable:kb,"data-roundup":Mb,"birthday-card":Eb,"growth-timeline":Cb,"compare-table":Sb,"exhibition-poster":vb,"launch-poster":Nb,"solar-term":Fb,"podcast-cover":zb,"pitch-cover":Rb,"portfolio-cover":Ib,"dessert-menu":Lb,"wedding-invitation":$b,"autumn-market":Db,"magazine-cover":Pb,"book-list":Tb,"word-of-year":Wb,"music-festival":Hb,"travel-postcard":_b,"design-week":Bb,"double-eleven":Vb,"christmas-card":Xb,"new-year-calendar":Qb,"spring-festival":Jb,"listicle-cover":ty,"ridge-cover":ny,"summit-visual":ry,"gala-backdrop":ay,"agenda-sheet":iy,"annual-report":sy,"stat-card":oy,countdown:ly,"versus-cover":cy,"habit-tracker":dy,"fun-fact":uy,"trip-route":fy,"ranking-cover":hy,"grand-opening":my,"race-bib":py,"live-show":gy,"qixi-stars":xy,"dragon-boat":by,"vinyl-cover":yy,"intro-card":jy,"daily-quote":ky,"masthead-cover":Sy,"interview-cover":vy,resume:Ny,notice:Fy,"food-review":My,"course-cover":Cy,"book-note":Ey,"event-banner":zy,"mood-square":Ry,"article-hero":Iy},Ay=["column","memo","letter","night","aurora","doc","xuan","swiss","journal"],Py=["editorial","checklist","signal","night-flight","brutalist","blueprint","spotlight","thesis","note-cover","photo-cover","magazine-cover","book-list","book-note","versus-cover","ranking-cover","fun-fact","mood-square","trip-route","food-review","habit-tracker","portfolio-cover","menu","dessert-menu","price-list","certificate","moments-grid","timetable","agenda-sheet","resume","notice","exhibition-poster","design-week","music-festival","race-bib","event-banner","talk-poster","launch-poster","countdown","grand-opening","sale-poster","double-eleven","live-show","hiring-poster","spring-festival","new-year-calendar","christmas-card","qixi-stars","dragon-boat","festival-poster","solar-term","word-of-year","invitation","wedding-invitation","birthday-card","travel-postcard","autumn-market","quote-card","daily-quote","intro-card","product-card","video-cover","pitch-cover","course-cover","summit-visual","gala-backdrop","annual-report","podcast-cover","vinyl-cover","article-cover","listicle-cover","ridge-cover","article-hero","masthead-cover","interview-cover","flyer","data-roundup","stat-card","compare-table","growth-timeline"];function Ty(e){return{...Ly[e],id:`${e}-markdown`,series:e,workspace:"markdown",kind:"deck",createMarkdown:()=>zx(e)}}function Wy(e){const n=$y[e];return{...n,id:`${e}-freeform`,series:e,workspace:"freeform",kind:n.pageCount===1?"poster":"deck",createFreeform:()=>Dy[e]()}}const ui=[...Ay.map(Ty),...Py.map(Wy)];function wd(e){return ui.filter(n=>n.workspace===e)}const Ho=()=>{};function Oo(e){return Number.isFinite(e)&&e>0?e:1}function Lf(...e){return e.filter(Boolean).join(" ")}const Xs=p.memo(function({slide:n,frameWidth:r,frameHeight:s,className:l,artboardClassName:o,deferOffscreen:c=!1}){const f=p.useRef(null),[h,g]=p.useState(!c),x=Oo(r),m=Oo(s),j=Oo(n.width),k=Oo(n.height),v=Math.min(x/j,m/k),w=j*v,N=k*v,F={left:(x-w)/2,top:(m-N)/2,width:j,height:k,background:Zh(n.background),transform:`scale(${v})`};return p.useEffect(()=>{if(!c){g(!0);return}const I=f.current;if(!I||typeof IntersectionObserver>"u"){g(!0);return}const M=new IntersectionObserver(([z])=>{g(z.isIntersecting)},{root:I.closest(".freeform-slide-list"),rootMargin:"192px"});return M.observe(I),()=>M.disconnect()},[c]),t.jsx("div",{ref:f,className:Lf("freeform-slide-preview",l),style:{width:x,height:m},"aria-hidden":"true",children:t.jsxs("div",{className:Lf("freeform-slide-preview-artboard",o),style:F,children:[h&&t.jsx(Xh,{slide:n,presentationOnly:!0}),h&&t.jsx(qh,{nodes:n.nodes,slideId:n.id,presentationOnly:!0,activeParentPath:["__preview__"],selectedPaths:[],onNodePointerDown:Ho,onNodeDoubleClick:Ho,onTextChange:Ho,onTextFocus:Ho})]})})});function Hy(e){const{html:n,role:r}=L0(e,0);return{html:n,role:r}}function L0(e,n){const r=Qh(e.source),s=[[]];for(const h of r)h.isBreak?s.push([]):s[s.length-1].push(h);const l=s.filter(h=>h.length>0);l.length===0&&l.push([]);const o=Math.min(Math.max(n,0),l.length-1),c=l[o],f=[...r].reverse().find(h=>!h.isBreak);return{html:c.map(h=>h.html).join(""),pageCount:l.length,role:I1({themeId:e.themeId,blocks:c,pageIndex:o,includesLastContentBlock:f!==void 0&&c.includes(f)})}}function kd(e,n,r){return{...Jh(r,n),"--template-scale":String(e)}}function Zn({source:e,width:n,height:r,page:s=0,className:l,lazy:o=!1}){const c=r??Math.round(n*4/3);return e.kind==="markdown"?t.jsx(Oy,{document:e.document,page:s,width:n,height:c,className:l}):t.jsx(_y,{document:e.document,page:s,width:n,height:c,className:l,lazy:o})}function Oy({document:e,page:n,width:r,height:s,className:l}){const o=p.useMemo(()=>{if(e.images)for(const[g,x]of Object.entries(e.images))zt.images.register(g,x);return L0(e,n)},[e,n]),c=pr.find(g=>g.id===e.platformId)??pr[0],f=bl(c,Ls(e.themeId),e.fontFamily),h=Math.min(r/f.width,s/f.height);return t.jsx("div",{className:["doc-preview","doc-preview-md",l].filter(Boolean).join(" "),style:{width:r,height:s,...kd(h,e.radius,f)},"aria-hidden":"true",children:t.jsx(yl,{html:o.html,config:f,profile:e.profile??Kn,pageIndex:n,pageCount:Math.max(n+1,o.pageCount),pageRole:o.role,showHeader:n===0||!(e.profile??Kn).headerFirstPageOnly,title:cd(e.source)})})}function _y({document:e,page:n,width:r,height:s,className:l,lazy:o}){const c=e.slides[Math.min(n,e.slides.length-1)],f=["doc-preview","doc-preview-ff",l].filter(Boolean).join(" ");return c?t.jsx("div",{className:f,style:{width:r,height:s},"aria-hidden":"true",children:t.jsx(Xs,{slide:c,frameWidth:r,frameHeight:s,deferOffscreen:o})}):t.jsx("div",{className:f,style:{width:r,height:s}})}function Zi({className:e,style:n,children:r}){const s=p.useRef(null),[l,o]=p.useState(0);return p.useEffect(()=>{const c=s.current;if(!c)return;const f=()=>o(Math.floor(c.getBoundingClientRect().width));f();const h=new ResizeObserver(f);return h.observe(c),()=>h.disconnect()},[]),t.jsx("div",{ref:s,className:e,style:n,children:l>0?r(l):null})}function qs(e,n,r){const s=p.useRef(r);s.current=r,p.useEffect(()=>{if(!n)return;const l=c=>{var f;(f=e.current)!=null&&f.contains(c.target)||s.current()},o=c=>{c.key==="Escape"&&s.current()};return document.addEventListener("pointerdown",l),document.addEventListener("keydown",o),()=>{document.removeEventListener("pointerdown",l),document.removeEventListener("keydown",o)}},[n,e])}function Sd({align:e="end",className:n}){const r=ra(),[s,l]=p.useState(!1),o=p.useRef(null),c=p.useRef(null),f=p.useId(),h=fc.find(j=>j.id===r)??fc[0];qs(o,s,()=>l(!1)),p.useEffect(()=>{var j,k;s&&((k=(j=o.current)==null?void 0:j.querySelector('[role="menuitemradio"][aria-checked="true"]'))==null||k.focus())},[s]);function g(){var j;l(!1),(j=c.current)==null||j.focus()}function x(j){g(),e0(j)}function m(j){var N;const k=Array.from(j.currentTarget.querySelectorAll('[role="menuitemradio"]')),v=k.findIndex(F=>F===document.activeElement);let w=-1;if(j.key==="ArrowDown")w=(v+1)%k.length;else if(j.key==="ArrowUp")w=(v-1+k.length)%k.length;else if(j.key==="Home")w=0;else if(j.key==="End")w=k.length-1;else if(j.key==="ArrowLeft"||j.key==="ArrowRight")w=v;else if(j.key==="Escape"){j.preventDefault(),j.stopPropagation(),g();return}else if(j.key==="Tab"){l(!1);return}else return;j.preventDefault(),j.stopPropagation(),(N=k[w])==null||N.focus()}return t.jsxs("div",{className:["lang-menu",n].filter(Boolean).join(" "),ref:o,children:[t.jsxs("button",{ref:c,className:"lang-trigger",type:"button","aria-haspopup":"menu","aria-expanded":s,"aria-controls":s?f:void 0,"aria-label":i("界面语言:{name}",{name:h.label}),title:i("界面语言"),"data-testid":"language-menu",onClick:()=>l(j=>!j),onKeyDown:j=>{j.key!=="ArrowDown"||s||(j.preventDefault(),j.stopPropagation(),l(!0))},children:[t.jsx(w0,{}),t.jsx("span",{className:"lang-current",children:h.label}),t.jsx(hd,{className:"lang-chevron"})]}),s&&t.jsx("div",{id:f,className:`menu lang-list is-${e}`,role:"menu","aria-label":i("界面语言"),onKeyDown:m,children:fc.map(j=>t.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":r===j.id,lang:j.id==="zh"?"zh-CN":"en",onClick:()=>x(j.id),children:[t.jsx("span",{className:"lang-name",children:j.label}),t.jsx(H2,{className:"lang-check"})]},j.id))})]})}const By=["xuan-markdown","portfolio-cover-freeform","column-markdown","night-flight-freeform","aurora-markdown"];function Na(e){var r,s;if(e.workspace==="markdown"){const l=(r=e.createMarkdown)==null?void 0:r.call(e);return l?{kind:"markdown",document:l}:null}const n=(s=e.createFreeform)==null?void 0:s.call(e);return n?{kind:"freeform",document:n}:null}function Ky({onAuthed:e,onGuest:n}){const[r,s]=p.useState("login"),[l,o]=p.useState(""),[c,f]=p.useState(""),[h,g]=p.useState(null),[x,m]=p.useState(!1),j=p.useId(),k=p.useMemo(()=>By.map(N=>ui.find(F=>F.id===N)).filter(N=>!!N).map(N=>({id:N.id,source:Na(N)})).filter(N=>N.source!==null),[]);async function v(N){N.preventDefault(),g(null),m(!0);try{const F=r==="login"?await zt.auth.login(l,c):await zt.auth.register(l,c);e(F)}catch(F){g(F instanceof Error&&F.message?i(F.message):i("出错了,请重试")),m(!1)}}const w=r==="register";return ra(),t.jsxs("div",{className:"login","data-testid":"login-page",children:[t.jsxs("section",{className:"login-show","aria-label":i("叮卡能做什么"),children:[t.jsxs("div",{className:"login-brand",children:[t.jsx("img",{src:vl,alt:"",width:"28",height:"28"}),i("叮卡")]}),t.jsx("div",{className:"login-fan","aria-hidden":"true",children:k.map(N=>t.jsx("div",{className:"login-fan-card",children:t.jsx(Zn,{source:N.source,width:240})},N.id))}),t.jsxs("div",{className:"login-copy",children:[t.jsxs("h2",{children:[i("长文自动排成卡片,"),t.jsx("br",{}),i("海报随手自由排版")]}),t.jsx("p",{children:i("Markdown 卡片把一篇长文切成一组小红书、微博、推特卡片;自由编辑像做海报一样摆放文字、图片和形状。")}),t.jsxs("ul",{className:"login-facts",children:[t.jsxs("li",{children:[t.jsx("b",{children:"2"})," ",i("套编辑器,一个工作台")]}),t.jsxs("li",{children:[t.jsx("b",{children:ui.length})," ",i("套成品模板")]}),t.jsxs("li",{children:[t.jsx("b",{children:"MIT"})," ",i("开源,可自部署")]})]})]})]}),t.jsxs("section",{className:"login-panel",children:[t.jsx(Sd,{className:"login-lang"}),t.jsxs("form",{className:"login-form",onSubmit:v,"aria-labelledby":j,children:[t.jsxs("div",{children:[t.jsx("h1",{id:j,children:w?i("创建叮卡账号"):i("欢迎回来")}),t.jsx("p",{className:"login-sub",children:w?i("只需要用户名和密码。"):i("登录后继续编辑你的项目。")})]}),t.jsxs("div",{className:"login-seg",role:"group","aria-label":i("登录或注册"),children:[t.jsx("button",{type:"button","aria-pressed":!w,onClick:()=>{s("login"),g(null)},children:i("登录")}),t.jsx("button",{type:"button","aria-pressed":w,onClick:()=>{s("register"),g(null)},children:i("注册")})]}),t.jsxs("label",{className:"login-field",children:[t.jsx("span",{children:i("用户名")}),t.jsx("input",{className:"text-input",value:l,autoComplete:"username",autoFocus:!0,onChange:N=>o(N.target.value),placeholder:i("至少 2 个字符")})]}),t.jsxs("label",{className:"login-field",children:[t.jsx("span",{children:i("密码")}),t.jsx("input",{className:"text-input",type:"password",value:c,autoComplete:w?"new-password":"current-password",onChange:N=>f(N.target.value),placeholder:i("至少 4 个字符")})]}),h&&t.jsx("div",{className:"form-error",role:"alert",children:h}),t.jsx("button",{className:"accent login-submit",type:"submit",disabled:x,"data-testid":"login-submit",children:x?i("请稍候…"):w?i("创建账号并进入"):i("登录")}),t.jsx("div",{className:"login-or",children:i("或")}),t.jsx("button",{className:"ghost login-guest",type:"button",onClick:n,"data-testid":"login-guest",children:i("不注册,直接开始")}),t.jsxs("p",{className:"login-note",children:[t.jsx(hl,{}),t.jsx("span",{children:zt.remote?i("账号保存在你部署的服务器上,登录后可在多台设备间同步项目。不注册也能用,项目会自动保存在这台设备上。"):i("账号和项目只保存在这台设备的浏览器里,不会上传。不注册也会自动保存;部署服务端后可在多台设备间同步。")})]})]})]})]})}function Vy(e){return e==="markdown-card"?"markdown":"freeform"}function $0(e){return e.workspace==="markdown"?"markdown-card":"freeform-slide"}function Ts(e){return wd(Vy(e))}function Gy(e,n){return Ts(e).find(r=>r.id===n)??null}const Uy="slicer.last-session.",_o={mode:"markdown-card",markdownDraftId:null,freeformDraftId:null};function D0(e){return Uy+e}function Yy(e){return e==="markdown-card"||e==="freeform-slide"}function $f(e){return typeof e=="string"&&e.length>0}function Qs(e){if(!e)return{..._o};let n=null;try{const s=localStorage.getItem(D0(e));n=s?JSON.parse(s):null}catch{return{..._o}}if(!n||typeof n!="object"||Array.isArray(n))return{..._o};const r=n;return{mode:Yy(r.mode)?r.mode:_o.mode,markdownDraftId:$f(r.markdownDraftId)?r.markdownDraftId:null,freeformDraftId:$f(r.freeformDraftId)?r.freeformDraftId:null}}function Fa(e,n){if(!e)return;const r={...Qs(e),...n};try{localStorage.setItem(D0(e),JSON.stringify(r))}catch{}}function Ml({title:e,detail:n,onDismiss:r,onRetry:s,retryLabel:l=i("重试"),tone:o="info",className:c=""}){return t.jsxs("div",{className:`operation-notice operation-notice--${o} ${c}`.trim(),role:"alert","aria-atomic":"true",children:[t.jsx("span",{className:"operation-notice-mark","aria-hidden":"true"}),t.jsxs("div",{className:"operation-notice-copy",children:[t.jsx("strong",{children:e}),n&&t.jsx("span",{children:n})]}),t.jsxs("div",{className:"operation-notice-actions",children:[s&&t.jsx("button",{type:"button",className:"operation-notice-retry",onClick:s,children:l}),t.jsx("button",{type:"button",className:"operation-notice-dismiss","aria-label":i("关闭提示"),title:i("关闭提示"),onClick:r,children:t.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:t.jsx("path",{d:"m4 4 8 8m0-8-8 8"})})})]})]})}const Zy=500;function Df(e,n){const r=Array.from(n,s=>s.codePointAt(0).toString(16)).join("-");return`${e}-option-${r||"empty"}`}function Xy(e){let n=e;for(;n;){if(n.hasAttribute("inert"))return!0;n=n.parentElement}return!1}function qy(e){let n=e.parentElement;for(;n;){if(n.matches(":disabled")&&!(n instanceof HTMLFieldSetElement))return!0;n=n.parentElement}return!1}function Qy(e){return e.hasAttribute("tabindex")||e.isContentEditable?!0:e instanceof HTMLAnchorElement||e instanceof HTMLAreaElement?e.hasAttribute("href"):e instanceof HTMLInputElement?e.type!=="hidden":e instanceof HTMLButtonElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e.tagName==="SUMMARY"}function Jy(e){if(!(e instanceof Element)||Xy(e))return null;let n=e;for(;n;){if(n instanceof HTMLElement&&Qy(n))return n.matches(":disabled")||qy(e)?null:n;n=n.parentElement}return null}function Qr({value:e,options:n,onChange:r,title:s,testId:l,previewFonts:o}){const[c,f]=p.useState(!1),[h,g]=p.useState(null),x=p.useRef(null),m=p.useRef(null),j=p.useRef(""),k=p.useRef(null),v=p.useId(),w=n.length>0,N=c&&w,F=n.findIndex(D=>D.id===e),I=n[F]??n[0],M=n.findIndex(D=>D.id===h),z=w?M>=0?M:Math.max(0,F):-1,A=z>=0?n[z].id:null;function T(){j.current="",k.current!==null&&(globalThis.clearTimeout(k.current),k.current=null)}function L(){T(),f(!1)}function H(D){if(!w)return;const re=Math.min(n.length-1,Math.max(0,D??F));g(n[re].id),f(!0)}p.useEffect(()=>{if(!N)return;const D=re=>{var te;if(!x.current||x.current.contains(re.target))return;L(),Jy(re.target)||(re.preventDefault(),(te=m.current)==null||te.focus())};return document.addEventListener("pointerdown",D),()=>document.removeEventListener("pointerdown",D)},[N]),p.useEffect(()=>{w||(T(),g(null),f(!1))},[w]),p.useEffect(()=>{!N||M>=0||A===null||g(A)},[N,A,M]),p.useEffect(()=>()=>T(),[]);function P(D){const re=n[D];re&&(L(),r(re.id))}function U(D){const re=`${j.current}${D}`.toLocaleLowerCase();j.current=re,k.current!==null&&globalThis.clearTimeout(k.current),k.current=globalThis.setTimeout(()=>{j.current="",k.current=null},Zy);for(let q=1;q<=n.length;q+=1){const te=(z+q)%n.length,be=n[te].label.toLocaleLowerCase();if(be.startsWith(re)||be.split(/\s+/).some(Be=>Be.startsWith(re))){g(n[te].id);return}}}function K(D){var re;if(!N){(D.key==="Enter"||D.key===" "||D.key==="ArrowDown"||D.key==="ArrowUp")&&(D.preventDefault(),D.stopPropagation(),H(D.key==="ArrowUp"?n.length-1:void 0));return}if(D.key==="Tab"){L();return}if(D.key==="Escape")D.preventDefault(),D.stopPropagation(),L(),(re=m.current)==null||re.focus();else if(D.key==="ArrowDown"){D.preventDefault(),D.stopPropagation();const q=Math.min(n.length-1,z+1);g(n[q].id)}else if(D.key==="ArrowUp"){D.preventDefault(),D.stopPropagation();const q=Math.max(0,z-1);g(n[q].id)}else D.key==="Home"?(D.preventDefault(),D.stopPropagation(),g(n[0].id)):D.key==="End"?(D.preventDefault(),D.stopPropagation(),g(n[n.length-1].id)):D.key==="Enter"||D.key===" "?(D.preventDefault(),D.stopPropagation(),P(z)):D.key.length===1&&!D.altKey&&!D.ctrlKey&&!D.metaKey&&(D.preventDefault(),D.stopPropagation(),U(D.key))}return t.jsxs("div",{className:"sel",ref:x,title:s,children:[t.jsxs("button",{ref:m,type:"button",role:"combobox",className:N?"sel-trigger open":"sel-trigger",onClick:()=>N?L():H(),onKeyDown:K,"aria-label":s,"aria-haspopup":"listbox","aria-expanded":N,"aria-controls":N?v:void 0,"aria-activedescendant":N?Df(v,n[z].id):void 0,disabled:!w,"data-testid":l,children:[t.jsxs("span",{className:"sel-content",children:[(I==null?void 0:I.swatch)&&t.jsx("span",{className:"sel-swatch",style:{background:I.swatch.bg},"aria-hidden":"true",children:t.jsx("span",{className:"sel-swatch-dot",style:{background:I.swatch.accent}})}),t.jsx("span",{className:"sel-value",style:o&&I?{fontFamily:I.previewFont??I.id}:void 0,children:(I==null?void 0:I.label)??i("暂无选项")})]}),t.jsx("svg",{className:"sel-caret",viewBox:"0 0 10 6",width:"10",height:"6","aria-hidden":!0,children:t.jsx("path",{d:"M1 1l4 4 4-4",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),N&&t.jsx("ul",{className:"sel-panel",role:"listbox",id:v,children:n.map((D,re)=>t.jsxs("li",{id:Df(v,D.id),role:"option","aria-selected":D.id===e,className:"sel-option"+(D.id===e?" selected":"")+(re===z?" hover":""),style:o?{fontFamily:D.previewFont??D.id}:void 0,onMouseEnter:()=>g(D.id),onMouseDown:q=>q.preventDefault(),onClick:q=>{q.preventDefault(),q.stopPropagation(),P(re)},children:[t.jsxs("span",{className:"sel-option-content",children:[D.swatch&&t.jsx("span",{className:"sel-swatch",style:{background:D.swatch.bg},"aria-hidden":"true",children:t.jsx("span",{className:"sel-swatch-dot",style:{background:D.swatch.accent}})}),t.jsx("span",{className:"sel-option-label",children:D.label})]}),D.id===e&&t.jsx("svg",{className:"sel-check",viewBox:"0 0 14 14",width:"14",height:"14","aria-hidden":!0,children:t.jsx("path",{d:"M2.5 7.5l3 3 6-6.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})]},D.id))})]})}function e4(e){const n=/^data:image\/(png|jpeg|webp)/i.exec(e.src)??/\.(png|jpe?g|webp)(?:[?#]|$)/i.exec(e.src),r=((n==null?void 0:n[1])??"png").toLowerCase();return`${e.name}.${r==="jpeg"?"jpg":r}`}function A0(e){const n=document.createElement("a");n.href=e.src,n.download=e4(e),document.body.append(n),n.click(),n.remove()}function t4(e){return new Date(e).toLocaleDateString(Bs(),{year:"numeric",month:"long",day:"numeric"})}function n4({asset:e,onPreview:n,onRename:r,onDelete:s}){const[l,o]=p.useState(!1),[c,f]=p.useState(!1),h=p.useRef(null),g=p.useRef(!1);qs(h,l,()=>o(!1));function x(m){if(f(!1),g.current)return;const j=m.trim();j&&j!==e.name&&r(e,j)}return t.jsxs("article",{className:"asset","data-testid":"asset-card",children:[t.jsx("button",{className:"asset-thumb",type:"button",onClick:()=>n(e),"aria-label":i("查看 {name}",{name:e.name}),children:t.jsx("img",{src:e.src,alt:"",loading:"lazy",decoding:"async",draggable:!1})}),t.jsxs("div",{className:"asset-info",children:[c?t.jsx("input",{className:"text-input asset-rename","aria-label":i("素材名称"),defaultValue:e.name,maxLength:60,autoFocus:!0,onFocus:m=>m.currentTarget.select(),onBlur:m=>x(m.currentTarget.value),onKeyDown:m=>{m.key==="Enter"?m.currentTarget.blur():m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),g.current=!0,m.currentTarget.blur())}}):t.jsx("span",{className:"asset-name",title:e.name,children:e.name}),t.jsxs("span",{className:"asset-meta tnum",children:[e.width," × ",e.height," · ",jl(e.bytes)]})]}),t.jsxs("div",{className:"asset-menu",ref:h,children:[t.jsx("button",{className:"icon-btn asset-more",type:"button","aria-label":i("{name} 的更多操作",{name:e.name}),"aria-haspopup":"menu","aria-expanded":l,onClick:()=>o(m=>!m),children:t.jsx(Nl,{})}),l&&t.jsxs("div",{className:"menu asset-menu-list",role:"menu",children:[t.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{o(!1),g.current=!1,f(!0)},children:[t.jsx(md,{}),i("重命名")]}),t.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{o(!1),A0(e)},children:[t.jsx(di,{}),i("下载")]}),t.jsxs("button",{role:"menuitem",type:"button",className:"danger",onClick:()=>{o(!1),s(e)},children:[t.jsx(Ji,{}),i("删除")]})]})]})]})}function r4({asset:e,usedBy:n,onDelete:r,onClose:s}){const l=p.useId(),o=p.useRef(null),c=p.useRef(s);return c.current=s,p.useEffect(()=>{var g;const f=document.activeElement instanceof HTMLElement?document.activeElement:null;(g=o.current)==null||g.focus();const h=x=>{x.key==="Escape"&&(x.preventDefault(),c.current())};return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h),f==null||f.focus()}},[]),t.jsx("div",{className:"modal-backdrop",onMouseDown:f=>f.target===f.currentTarget&&s(),children:t.jsxs("div",{className:"modal asset-preview",role:"dialog","aria-modal":"true","aria-labelledby":l,children:[t.jsx("div",{className:"asset-preview-stage",children:t.jsx("img",{src:e.src,alt:e.name})}),t.jsxs("div",{className:"asset-preview-side",children:[t.jsxs("div",{className:"modal-head",children:[t.jsx("h3",{id:l,children:e.name}),t.jsx("button",{ref:o,className:"modal-x",type:"button",onClick:s,"aria-label":i("关闭"),children:t.jsx(Pn,{})})]}),t.jsxs("dl",{className:"asset-facts",children:[t.jsxs("div",{children:[t.jsx("dt",{children:i("尺寸")}),t.jsxs("dd",{className:"tnum",children:[e.width," × ",e.height," px"]})]}),t.jsxs("div",{children:[t.jsx("dt",{children:i("大小")}),t.jsx("dd",{className:"tnum",children:jl(e.bytes)})]}),t.jsxs("div",{children:[t.jsx("dt",{children:i("上传于")}),t.jsx("dd",{children:t4(e.createdAt)})]}),t.jsxs("div",{children:[t.jsx("dt",{children:i("用在")}),t.jsx("dd",{className:"tnum",children:n>0?i("{n} 个项目里",{n}):i("还没有项目用到")})]})]}),t.jsx("p",{className:"asset-preview-hint",children:i("在 Markdown 卡片工具栏的「素材库」或自由编辑插入栏的「图片」里,点一下就能放进项目。")}),t.jsxs("div",{className:"modal-foot",children:[t.jsxs("button",{className:"ghost confirm-danger-ghost",type:"button",onClick:()=>r(e),children:[t.jsx(Ji,{}),i("删除")]}),t.jsxs("button",{className:"accent",type:"button",onClick:()=>A0(e),children:[t.jsx(di,{}),i("下载")]})]})]})]})})}const vd=t0.join(","),a4=25*1024*1024,i4=1800;function s4(e){return new Promise((n,r)=>{const s=new FileReader;s.onload=()=>n(String(s.result??"")),s.onerror=()=>r(s.error??new Error("无法读取图片")),s.readAsDataURL(e)})}function o4(e){return new Promise((n,r)=>{const s=new Image;s.onload=()=>n({width:s.naturalWidth,height:s.naturalHeight}),s.onerror=()=>r(new Error("图片已损坏或无法解码")),s.src=e})}function Yc(e){return Array.from(e??[]).filter(n=>n.type.startsWith("image/"))}async function l4(e){if(!t0.includes(e.type))throw new Error("只支持 PNG、JPG、WebP 图片");if(e.size>a4)throw new Error("图片超过 25 MB");const n=await ka(await s4(e),i4),{width:r,height:s}=await o4(n);return{dataUrl:n,name:L1(e.name),width:r,height:s}}function mi({title:e,body:n,confirmLabel:r,cancelLabel:s=i("取消"),danger:l=!1,onConfirm:o,onCancel:c}){const f=p.useId(),h=p.useRef(null),g=p.useRef(c);return g.current=c,p.useEffect(()=>{var j;const x=document.activeElement instanceof HTMLElement?document.activeElement:null;(j=h.current)==null||j.focus();const m=k=>{k.key==="Escape"&&(k.preventDefault(),g.current())};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m),x==null||x.focus()}},[]),t.jsx("div",{className:"modal-backdrop",onMouseDown:x=>x.target===x.currentTarget&&c(),children:t.jsxs("div",{className:"modal confirm-modal",role:"alertdialog","aria-modal":"true","aria-labelledby":f,children:[t.jsx("h3",{id:f,className:"confirm-title",children:e}),t.jsx("p",{className:"confirm-body",children:n}),t.jsxs("div",{className:"modal-foot",children:[t.jsx("button",{ref:h,className:"ghost",type:"button",onClick:c,children:s}),t.jsx("button",{className:l?"accent confirm-danger":"accent",type:"button",onClick:o,children:r})]})]})})}const c4={truetype:"TTF",opentype:"OTF",woff:"WOFF",woff2:"WOFF2"};async function d4(e){for(const n of e)try{await kl.importFile(n)}catch(r){return r instanceof Error&&r.message?i(r.message):i("字体导入失败,请稍后重试")}return null}function u4({error:e,onPick:n}){const r=wl(),[s,l]=p.useState(null);return t.jsxs(t.Fragment,{children:[e&&t.jsx("div",{className:"font-library-error",role:"alert",children:e}),r.length>0?t.jsx("div",{className:"font-grid","data-testid":"font-grid",children:r.map(o=>t.jsxs("article",{className:"font-card","data-testid":"font-card",children:[t.jsxs("div",{className:"font-card-sample",style:{fontFamily:dd(o.family)},"aria-hidden":"true",children:[t.jsx("span",{className:"font-card-big",children:i("永 Aa")}),t.jsx("span",{className:"font-card-line",children:i("字体样张 123")})]}),t.jsxs("div",{className:"font-card-info",children:[t.jsx("span",{className:"font-card-name",title:o.family,children:o.family}),t.jsxs("span",{className:"font-card-meta tnum",children:[c4[o.format]," · ",jl(o.bytes)]})]}),t.jsx("button",{type:"button",className:"icon-btn font-card-remove","aria-label":i("删除字体 {font}",{font:o.family}),title:i("删除字体 {font}",{font:o.family}),onClick:()=>l(o),children:t.jsx(Ji,{})})]},o.id))}):t.jsxs("div",{className:"asset-drop",children:[t.jsx("span",{className:"asset-drop-icon",children:t.jsx(gr,{})}),t.jsx("b",{children:i("把字体文件拖到这里")}),t.jsx("span",{children:i("TTF、OTF、WOFF、WOFF2 都可以,最大 40 MB。")}),t.jsx("button",{className:"ghost",type:"button",onClick:n,children:i("选择字体")})]}),s&&t.jsx(mi,{title:i("删除字体「{title}」?",{title:s.family}),body:i("用了它的文字会换回默认字体。"),confirmLabel:i("删除"),danger:!0,onCancel:()=>l(null),onConfirm:()=>{const o=s;l(null),kl.remove(o.id).catch(()=>{})}})]})}function Bo(e){return Array.from(e.dataTransfer.types).includes("Files")}function f4(e){return e instanceof HTMLElement&&e.closest('input, textarea, [contenteditable="true"]')!==null}function h4({ownerId:e,assets:n,usage:r,onUpload:s,onRename:l,onDelete:o}){const[c,f]=p.useState(""),[h,g]=p.useState("recent"),[x,m]=p.useState(null),[j,k]=p.useState(null),[v,w]=p.useState(!1),[N,F]=p.useState("images"),[I,M]=p.useState(null),z=wl(),A=p.useRef(0),T=p.useRef(null),L=p.useRef(null),H=p.useRef(s);H.current=s;const P=p.useRef(N);P.current=N;const U=le=>{M(null),d4(le).then(M)},K=n.assets,D=K.reduce((le,De)=>le+De.bytes,0),re=c.trim().toLocaleLowerCase(),q=p.useMemo(()=>Pc(K.filter(le=>!re||le.name.toLocaleLowerCase().includes(re)),h),[K,re,h]),te=x?K.find(le=>le.id===x)??null:null;p.useEffect(()=>{if(!e)return;const le=De=>{var ae;if(f4(De.target)||P.current!=="images")return;const W=Yc((ae=De.clipboardData)==null?void 0:ae.files);W.length!==0&&(De.preventDefault(),H.current(W))};return window.addEventListener("paste",le),()=>window.removeEventListener("paste",le)},[e]);const be=e?{onDragEnter:le=>{Bo(le)&&(le.preventDefault(),A.current+=1,w(!0))},onDragOver:le=>{Bo(le)&&(le.preventDefault(),le.dataTransfer.dropEffect="copy")},onDragLeave:le=>{Bo(le)&&(A.current=Math.max(0,A.current-1),A.current===0&&w(!1))},onDrop:le=>{if(!Bo(le))return;le.preventDefault(),A.current=0,w(!1);const De=Array.from(le.dataTransfer.files);De.length!==0&&(N==="fonts"?U(De):s(De))}}:{},ne=()=>{var le;return(le=T.current)==null?void 0:le.click()},Be=()=>{var le;return(le=L.current)==null?void 0:le.click()};return t.jsxs("section",{className:"page page-assets","aria-label":i("素材库"),...be,children:[t.jsxs("div",{className:"page-head",children:[t.jsx("div",{children:t.jsx("h1",{children:i("素材库")})}),e&&t.jsxs("div",{className:"page-actions",children:[t.jsxs("div",{className:"tabs",role:"group","aria-label":i("素材类型"),children:[t.jsxs("button",{type:"button","aria-pressed":N==="images","data-testid":"asset-kind-images",onClick:()=>F("images"),children:[i("图片")," ",t.jsx("span",{className:"tnum",children:K.length})]}),t.jsxs("button",{type:"button","aria-pressed":N==="fonts","data-testid":"asset-kind-fonts",onClick:()=>F("fonts"),children:[i("字体")," ",t.jsx("span",{className:"tnum",children:z.length})]})]}),N==="images"?t.jsxs("button",{className:"accent",type:"button",onClick:ne,"data-testid":"asset-upload",children:[t.jsx(gr,{}),i("上传图片")]}):t.jsxs("button",{className:"accent",type:"button",onClick:Be,"data-testid":"font-import",children:[t.jsx(gr,{}),i("导入字体")]})]})]}),t.jsx("input",{ref:L,type:"file",accept:n0,multiple:!0,hidden:!0,"data-testid":"font-file-input",onChange:le=>{const De=Array.from(le.currentTarget.files??[]);le.currentTarget.value="",De.length>0&&U(De)}}),t.jsx("input",{ref:T,type:"file",accept:vd,multiple:!0,hidden:!0,"data-testid":"asset-file-input",onChange:le=>{const De=Array.from(le.currentTarget.files??[]);le.currentTarget.value="",De.length>0&&s(De)}}),e&&N==="fonts"&&t.jsx(u4,{error:I,onPick:Be}),!e||N!=="images"?null:t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"toolbar-row",children:[t.jsxs("label",{className:"search-field",children:[t.jsx(Ma,{}),t.jsx("input",{type:"search",value:c,placeholder:i("按名称搜索"),"aria-label":i("搜索素材"),onChange:le=>f(le.target.value)})]}),t.jsx("span",{className:"asset-summary tnum",children:i("{n} 张 · {size}",{n:K.length,size:jl(D)})}),t.jsx("span",{className:"grow"}),t.jsx(Qr,{value:h,title:i("排序"),onChange:le=>g(le),options:[{id:"recent",label:i("最近上传")},{id:"name",label:i("按名称")}]})]}),n.status==="error"&&t.jsxs("div",{className:"empty",children:[t.jsx("b",{children:i("素材库读取失败")}),t.jsx("span",{children:n.error}),t.jsx("button",{className:"ghost",type:"button",onClick:n.reload,children:i("重试")})]}),q.length>0||n.uploads.length>0?t.jsxs("div",{className:"asset-grid",children:[n.uploads.map(le=>t.jsxs("div",{className:"asset is-pending",role:"status","aria-label":i("正在上传 {name}",{name:le.name}),children:[t.jsx("div",{className:"asset-thumb",children:t.jsx("span",{className:"asset-spinner"})}),t.jsxs("div",{className:"asset-info",children:[t.jsx("span",{className:"asset-name",children:le.name}),t.jsx("span",{className:"asset-meta",children:i("上传中…")})]})]},le.id)),q.map(le=>t.jsx(n4,{asset:le,onPreview:De=>m(De.id),onRename:l,onDelete:k},le.id))]}):n.status==="ready"&&(re?t.jsxs("div",{className:"empty",children:[t.jsx("b",{children:i("没有名称包含「{query}」的素材",{query:c.trim()})}),t.jsx("span",{children:i("换个关键词试试。")})]}):t.jsxs("div",{className:"asset-drop",children:[t.jsx("span",{className:"asset-drop-icon",children:t.jsx(gr,{})}),t.jsx("b",{children:i("把图片拖到这里,或者直接粘贴截图")}),t.jsx("span",{children:i("PNG、JPG、WebP 都可以,长边超过 1800 px 会自动缩小。")}),t.jsx("button",{className:"ghost",type:"button",onClick:ne,children:i("选择图片")})]}))]}),v&&t.jsx("div",{className:"asset-drop-overlay","aria-hidden":"true",children:t.jsxs("div",{children:[t.jsx(gr,{}),t.jsx("b",{children:N==="fonts"?i("松开,导入字体"):i("松开,上传到素材库")})]})}),te&&t.jsx(r4,{asset:te,usedBy:r.get(te.id)??0,onDelete:le=>{m(null),k(le)},onClose:()=>m(null)}),j&&t.jsx(mi,{title:i("删除「{title}」?",{title:j.name}),body:(r.get(j.id)??0)>0?i("有 {n} 个项目用到了这张图片,它们不受影响,只是以后不能再从素材库里选它。",{n:r.get(j.id)??0}):i("删除后不能再从素材库里选它。"),confirmLabel:i("删除"),danger:!0,onCancel:()=>k(null),onConfirm:()=>{const le=j;k(null),m(null),o(le)}})]})}function m4(e){return e.mode==="freeform-slide"?r0(e.document):[...a0(e.document.source),...Object.values(e.document.images??{})]}function Af(e){if(e.startsWith("data:"))return e;try{return new URL(e,"http://local.invalid").pathname}catch{return e}}function p4(e,n){const r=new Map;if(e.length===0)return r;const s=new Map(e.map(l=>[Af(l.src),l.id]));for(const l of n){const o=new Set;for(const c of m4(l)){const f=s.get(Af(c));f&&o.add(f)}for(const c of o)r.set(c,(r.get(c)??0)+1)}return r}const Ws=[{id:"xhs",name:"小红书",ratio:"3:4",width:1080,height:1440},{id:"story",name:"竖版海报",ratio:"9:16",width:1080,height:1920},{id:"square",name:"方图",ratio:"1:1",width:1080,height:1080},{id:"landscape",name:"横版封面",ratio:"16:9",width:1920,height:1080},{id:"wechat-cover",name:"公众号首图",ratio:"2.35:1",width:1800,height:766},{id:"a4",name:"A4 印刷",ratio:"A4",width:1240,height:1754},{id:"a4-landscape",name:"A4 横版",ratio:"A4 横",width:1754,height:1240},{id:"moments-grid",name:"朋友圈九宫格",ratio:"3×3",width:3240,height:3240}];function Rn(e){return Ws.find(n=>n.id===e)??Ws[0]}const P0=[{id:"article",name:"长文卡片"},{id:"carousel",name:"图文套图"},{id:"social",name:"社交配图"},{id:"event",name:"活动海报"},{id:"promo",name:"营销电商"},{id:"menu",name:"菜单价目"},{id:"festival",name:"节日节气"},{id:"invite",name:"邀请贺卡"},{id:"office",name:"办公学习"}],T0=[{id:"minimal",name:"简约"},{id:"editorial",name:"杂志"},{id:"literary",name:"文艺"},{id:"chinese",name:"国风"},{id:"retro",name:"复古"},{id:"handdrawn",name:"手绘"},{id:"elegant",name:"优雅"},{id:"bold",name:"潮酷"},{id:"business",name:"商务"},{id:"fresh",name:"清新"}],Nd=[{id:"white",name:"白色",swatch:"#ffffff"},{id:"beige",name:"米色",swatch:"#efe4cf"},{id:"gray",name:"灰色",swatch:"#9b9b98"},{id:"black",name:"黑色",swatch:"#1d1d1f"},{id:"red",name:"红色",swatch:"#d33b2c"},{id:"orange",name:"橙色",swatch:"#ec8a3c"},{id:"yellow",name:"黄色",swatch:"#f2c84b"},{id:"green",name:"绿色",swatch:"#3c8c5b"},{id:"blue",name:"蓝色",swatch:"#3467d6"},{id:"purple",name:"紫色",swatch:"#8b62d9"},{id:"pink",name:"粉色",swatch:"#ef93b4"}],ge=(e,n,r)=>({uses:e,styles:n,colors:r}),g4={column:ge(["article"],["editorial","literary"],["beige","red"]),memo:ge(["article"],["minimal","fresh"],["white","yellow"]),letter:ge(["article"],["literary","retro"],["beige","red"]),night:ge(["article"],["literary"],["black"]),aurora:ge(["article"],["fresh"],["purple","pink","blue"]),doc:ge(["article"],["business","minimal"],["white","blue"]),xuan:ge(["article"],["chinese"],["beige","red"]),swiss:ge(["article"],["bold","minimal"],["white","red"]),journal:ge(["article"],["handdrawn","fresh"],["beige","orange"]),editorial:ge(["carousel"],["editorial"],["beige","red"]),checklist:ge(["carousel"],["minimal","fresh"],["green","white"]),signal:ge(["carousel"],["bold"],["beige","red"]),"night-flight":ge(["carousel"],["literary"],["black","blue"]),brutalist:ge(["carousel"],["bold"],["yellow","black"]),blueprint:ge(["carousel"],["business"],["blue"]),spotlight:ge(["carousel","office"],["minimal","business"],["orange","white"]),thesis:ge(["carousel","office"],["business","elegant"],["blue","white"]),"note-cover":ge(["social"],["fresh"],["beige","yellow"]),"photo-cover":ge(["social"],["retro"],["beige","black"]),"portfolio-cover":ge(["social"],["elegant","editorial"],["black","red"]),menu:ge(["menu"],["minimal","retro"],["beige","orange"]),"dessert-menu":ge(["menu"],["handdrawn"],["beige","orange","yellow"]),"price-list":ge(["menu","promo"],["retro"],["red","white"]),certificate:ge(["office"],["elegant"],["beige","yellow"]),"moments-grid":ge(["social","festival"],["handdrawn"],["purple","orange","pink"]),timetable:ge(["office"],["fresh"],["white","blue","yellow"]),"exhibition-poster":ge(["event"],["bold","minimal"],["white","black"]),"talk-poster":ge(["event"],["editorial"],["beige","black"]),"launch-poster":ge(["promo","event"],["bold"],["black","blue","purple"]),"sale-poster":ge(["promo"],["bold"],["orange"]),"hiring-poster":ge(["office","event"],["minimal","fresh"],["beige","blue","orange"]),"festival-poster":ge(["festival"],["chinese"],["blue","yellow"]),"solar-term":ge(["festival"],["chinese"],["beige","red"]),invitation:ge(["invite"],["elegant"],["green","yellow"]),"wedding-invitation":ge(["invite"],["elegant"],["white","green"]),"birthday-card":ge(["invite"],["fresh"],["pink","beige"]),"autumn-market":ge(["event"],["handdrawn"],["beige","orange"]),"quote-card":ge(["social"],["minimal","literary"],["beige","red"]),"product-card":ge(["promo"],["fresh"],["green"]),"video-cover":ge(["social"],["bold"],["black","yellow"]),"pitch-cover":ge(["office"],["business","minimal"],["blue","white"]),"podcast-cover":ge(["social"],["retro","bold"],["beige","red","blue"]),"article-cover":ge(["social"],["editorial"],["blue","black"]),flyer:ge(["event"],["fresh"],["beige","orange"]),"data-roundup":ge(["office"],["editorial","business"],["beige","red"]),"compare-table":ge(["office"],["business"],["blue","white"]),"growth-timeline":ge(["office"],["elegant"],["green","yellow"]),"magazine-cover":ge(["social"],["editorial","elegant"],["beige","black"]),"book-list":ge(["social"],["literary","fresh"],["beige","green","orange"]),"word-of-year":ge(["festival","social"],["chinese","minimal"],["white","red","black"]),"music-festival":ge(["event"],["bold","retro"],["purple","pink","yellow"]),"travel-postcard":ge(["invite","social"],["retro"],["beige","red","blue"]),"design-week":ge(["event"],["bold","minimal"],["white","red","black"]),"double-eleven":ge(["promo","festival"],["bold"],["red","yellow"]),"christmas-card":ge(["festival","invite"],["retro","handdrawn"],["red","green"]),"new-year-calendar":ge(["festival","social"],["retro","minimal"],["blue","red","beige"]),"spring-festival":ge(["festival","invite"],["chinese"],["red","yellow"]),"listicle-cover":ge(["social"],["editorial","minimal"],["red","beige"]),"ridge-cover":ge(["social"],["literary","fresh"],["blue","beige"]),"summit-visual":ge(["event"],["business","bold"],["black","blue","green"]),"gala-backdrop":ge(["event","festival"],["elegant","retro"],["black","yellow"]),"agenda-sheet":ge(["event","office"],["business","minimal"],["blue","white"]),"annual-report":ge(["office"],["business","elegant"],["white","blue"]),"stat-card":ge(["social","office"],["minimal","bold"],["blue"]),countdown:ge(["event","promo"],["minimal"],["beige","black"]),"versus-cover":ge(["social","promo"],["bold"],["yellow","black"]),"habit-tracker":ge(["social","office"],["fresh","minimal"],["green"]),"fun-fact":ge(["social"],["bold"],["yellow"]),"trip-route":ge(["social"],["handdrawn","fresh"],["blue","beige"]),"ranking-cover":ge(["social","promo"],["bold"],["black","orange"]),"grand-opening":ge(["promo","event"],["retro"],["red","beige"]),"race-bib":ge(["event"],["bold"],["orange","black"]),"live-show":ge(["promo","event"],["bold"],["black","red"]),"qixi-stars":ge(["festival","invite"],["elegant","chinese"],["purple","blue"]),"dragon-boat":ge(["festival"],["chinese"],["red","beige"]),"vinyl-cover":ge(["social"],["retro"],["blue","black"]),"intro-card":ge(["social"],["bold"],["red","beige"]),"daily-quote":ge(["social"],["elegant","literary"],["blue","yellow"]),"masthead-cover":ge(["social"],["editorial","retro"],["beige","black"]),"interview-cover":ge(["social"],["editorial","elegant"],["orange","beige"]),resume:ge(["office"],["minimal","business"],["white","blue"]),notice:ge(["office"],["business"],["red","white"]),"food-review":ge(["social"],["handdrawn","fresh"],["beige","orange"]),"course-cover":ge(["office"],["fresh","minimal"],["yellow","white"]),"book-note":ge(["social"],["literary","handdrawn"],["beige","red"]),"event-banner":ge(["event"],["retro"],["blue","beige"]),"mood-square":ge(["social"],["minimal","bold"],["beige","red"]),"article-hero":ge(["social"],["literary"],["green","white"])};function Jr(e){return g4[e.series]}const x4={article:["长文","笔记","Markdown","文章","图文"],carousel:["套图","多页","图文","轮播"],social:["封面","配图","头图"],event:["活动","海报","宣传","报名"],promo:["促销","电商","打折","新品","优惠","海报"],menu:["菜单","价目","餐厅","饮品"],festival:["节日","节气","问候","祝福"],invite:["请柬","请帖","邀请","贺卡"],office:["办公","工作","汇报","PPT","学习","学校"]},Fd=(e,n)=>{var r;return((r=e.find(s=>s.id===n))==null?void 0:r.name)??n};function Xi(e){return Fd(P0,e)}function W0(e){return Fd(T0,e)}function H0(e){return Fd(Nd,e)}function b4(e){const{uses:n,styles:r,colors:s}=Jr(e),l=Rn(e.format);return[[e.title,8],...e.tags.map(c=>[c,4]),...n.map(c=>[Xi(c),4]),...n.flatMap(c=>x4[c].map(f=>[f,2])),...r.map(c=>[W0(c),3]),...s.map(c=>[H0(c),2]),[l.name,2],[l.ratio,2],[e.workspace==="markdown"?"Markdown 卡片":"自由编辑",1],[e.description,1]].flatMap(([c,f])=>{const h=i(c);return h===c?[[c.toLowerCase(),f]]:[[c.toLowerCase(),f],[h.toLowerCase(),f]]})}function y4(e,n){const r=n.trim().toLowerCase().split(/\s+/).filter(Boolean);if(r.length===0)return 1;const s=b4(e);let l=0;for(const o of r){const c=s.reduce((f,[h,g])=>h.includes(o)?Math.max(f,g):f,0);if(c===0)return 0;l+=c}return l}function j4(e,n){const{uses:r,styles:s,colors:l}=Jr(e);return!(n.use&&!r.includes(n.use)||n.format&&e.format!==n.format||n.style&&!s.includes(n.style)||n.color&&!l.includes(n.color)||n.only&&!n.only.has(e.id))}function si(e,n){var l;const r=((l=n.text)==null?void 0:l.trim())??"",s=e.map((o,c)=>({template:o,index:c,score:j4(o,n)?y4(o,r):0})).filter(o=>o.score>0);return r&&s.sort((o,c)=>c.score-o.score||o.index-c.index),s.map(o=>o.template)}function w4(e,n,r=6){const s=Jr(e);return n.filter(l=>l.id!==e.id).map((l,o)=>{const c=Jr(l),f=c.uses.filter(x=>s.uses.includes(x)).length,h=c.styles.filter(x=>s.styles.includes(x)).length,g=f*4+h*2+(l.format===e.format?1:0)+c.colors.filter(x=>s.colors.includes(x)).length*.5;return{candidate:l,index:o,score:f+h>0?g:0}}).filter(l=>l.score>0).sort((l,o)=>o.score-l.score||l.index-o.index).slice(0,r).map(l=>l.candidate)}function Md(e){return P0.map(n=>n.id).filter(n=>e.some(r=>Jr(r).uses.includes(n)))}function Cd(e){return e.mode==="markdown-card"?{kind:"markdown",document:e.document}:{kind:"freeform",document:e.document}}function O0(e,n=Date.now()){const r=Math.round((n-e)/6e4);if(r<1)return i("刚刚");if(r<60)return i("{n} 分钟前",{n:r});const s=Math.round(r/60);if(s<24)return i("{n} 小时前",{n:s});const l=Math.round(s/24);return l<7?i("{n} 天前",{n:l}):new Date(e).toLocaleDateString(Bs(),{month:"short",day:"numeric"})}function k4(e){if(e.mode==="markdown-card"){const r=pr.find(s=>s.id===e.document.platformId);return r?i(r.label):"Markdown"}const n=e.document.slides[0];return n?`${n.width} × ${n.height}`:i("自由编辑")}function S4({system:e,className:n}){return e==="markdown-card"?t.jsx(Us,{className:["sys-mark","sys-md",n].filter(Boolean).join(" ")}):t.jsx(Ui,{className:["sys-mark","sys-ff",n].filter(Boolean).join(" ")})}function _0({draft:e,onOpen:n,onDuplicate:r,onRename:s,onDelete:l}){const[o,c]=p.useState(!1),[f,h]=p.useState(!1),g=p.useRef(null),x=p.useRef(!1),m=e.mode==="freeform-slide"?e.document.slides.length:null,j=e.mode==="markdown-card"?i("Markdown 卡片"):i("自由编辑");qs(g,o,()=>c(!1));function k(v){if(h(!1),x.current)return;const w=v.trim();w&&w!==e.title&&(s==null||s(e,w))}return t.jsxs("article",{className:"project","data-testid":"project-card","data-system":e.mode,children:[t.jsxs("button",{className:"project-open",type:"button",onClick:()=>n(e),"aria-label":i("打开 {title}",{title:e.title}),children:[t.jsx(Zi,{className:"project-thumb",children:v=>t.jsx(Zn,{source:Cd(e),width:v,lazy:!0})}),m!==null&&m>1&&t.jsx("span",{className:"project-pages tnum",children:i("{n} 页",{n:m})})]}),t.jsxs("div",{className:"project-info",children:[t.jsxs("div",{className:"project-title",children:[t.jsx(S4,{system:e.mode}),f?t.jsx("input",{className:"text-input project-rename","aria-label":i("项目名称"),defaultValue:e.title,maxLength:60,autoFocus:!0,onFocus:v=>v.currentTarget.select(),onBlur:v=>k(v.currentTarget.value),onKeyDown:v=>{if(v.key==="Enter"){if(v.nativeEvent.isComposing)return;v.currentTarget.blur()}else v.key==="Escape"&&(v.preventDefault(),v.stopPropagation(),x.current=!0,v.currentTarget.blur())}}):t.jsx("span",{title:e.title,children:e.title})]}),t.jsxs("div",{className:"project-meta",children:[t.jsx("span",{children:j}),t.jsx("span",{className:"dot-sep","aria-hidden":"true"}),t.jsx("span",{children:k4(e)}),t.jsx("span",{className:"dot-sep","aria-hidden":"true"}),t.jsx("span",{className:"tnum",children:O0(e.updatedAt)})]})]}),(r||s||l)&&t.jsxs("div",{className:"project-menu",ref:g,children:[t.jsx("button",{className:"icon-btn project-more",type:"button","aria-label":i("{name} 的更多操作",{name:e.title}),"aria-haspopup":"menu","aria-expanded":o,onClick:()=>c(v=>!v),children:t.jsx(Nl,{})}),o&&t.jsxs("div",{className:"menu project-menu-list",role:"menu",children:[s&&t.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{c(!1),x.current=!1,h(!0)},children:[t.jsx(md,{}),i("重命名")]}),r&&t.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{c(!1),r(e)},children:[t.jsx(j0,{}),i("复制一份")]}),l&&t.jsxs("button",{role:"menuitem",type:"button",className:"danger",onClick:()=>{c(!1),l(e)},children:[t.jsx(Ji,{}),i("删除")]})]})]})]})}const v4={markdown:t.jsx(Us,{className:"sys-md"}),freeform:t.jsx(Ui,{className:"sys-ff"}),projects:t.jsx(y0,{}),templates:t.jsx(Gi,{}),assets:t.jsx(Gs,{}),theme:t.jsx(fd,{}),language:t.jsx(w0,{})};function Pf(e,n){return!n||e.toLocaleLowerCase().includes(n.toLocaleLowerCase())}function N4({projects:e,templates:n,actions:r,onOpenProject:s,onUseTemplate:l,onClose:o}){const c=Ks(),[f,h]=p.useState(""),[g,x]=p.useState(0),m=p.useRef(null),j=p.useRef(null),k=f.trim(),v=p.useMemo(()=>{const M=e.filter(T=>Pf(T.title,k)).slice(0,5).map(T=>({type:"project",key:`p:${T.id}`,draft:T})),z=si(n,{text:k}).slice(0,4).map(T=>({type:"template",key:`t:${T.id}`,template:T})),A=r.filter(T=>Pf(T.label,k)).map(T=>({type:"action",key:`a:${T.id}`,action:T}));return[{label:c("项目"),items:M},{label:c("模板"),items:z},{label:c("操作"),items:A}].filter(T=>T.items.length>0)},[r,e,k,c,n]),w=v.flatMap(M=>M.items);p.useEffect(()=>{var z;const M=document.activeElement instanceof HTMLElement?document.activeElement:null;return(z=m.current)==null||z.focus(),()=>M==null?void 0:M.focus()},[]),p.useEffect(()=>x(0),[k]),p.useEffect(()=>{var M,z;(z=(M=j.current)==null?void 0:M.querySelector('[data-active="true"]'))==null||z.scrollIntoView({block:"nearest"})},[g]);function N(M){o(),M.type==="project"?s(M.draft):M.type==="template"?l(M.template):M.action.run()}function F(M){M.key==="Escape"?(M.preventDefault(),o()):M.key==="ArrowDown"?(M.preventDefault(),x(z=>Math.min(w.length-1,z+1))):M.key==="ArrowUp"?(M.preventDefault(),x(z=>Math.max(0,z-1))):M.key==="Enter"&&w[g]&&(M.preventDefault(),N(w[g]))}let I=-1;return t.jsx("div",{className:"palette-back",onMouseDown:M=>M.target===M.currentTarget&&o(),children:t.jsxs("div",{className:"palette",role:"dialog","aria-modal":"true","aria-label":c("搜索与命令"),onKeyDown:F,children:[t.jsxs("div",{className:"palette-input",children:[t.jsx(Ma,{}),t.jsx("input",{ref:m,value:f,onChange:M=>h(M.target.value),placeholder:c("搜索项目、模板,或输入操作"),"aria-label":c("搜索项目、模板和操作"),role:"combobox","aria-expanded":"true","aria-controls":"palette-list"}),t.jsx("kbd",{children:"Esc"})]}),t.jsxs("div",{className:"palette-list",id:"palette-list",role:"listbox",ref:j,children:[v.length===0&&t.jsx("div",{className:"palette-empty",children:c("没有找到“{query}”",{query:k})}),v.map(M=>t.jsxs("div",{role:"group","aria-label":M.label,children:[t.jsx("div",{className:"palette-group",children:M.label}),M.items.map(z=>{I+=1;const A=I,T=A===g;return t.jsxs("button",{type:"button",role:"option","aria-selected":T,"data-active":T,className:"palette-item",onMouseEnter:()=>x(A),onClick:()=>N(z),children:[z.type==="project"&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"palette-thumb",children:t.jsx(Zn,{source:Cd(z.draft),width:24})}),t.jsx("span",{className:"palette-label",children:z.draft.title}),t.jsx("small",{className:"tnum",children:O0(z.draft.updatedAt)})]}),z.type==="template"&&(()=>{const L=Na(z.template);return t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"palette-thumb",children:L&&t.jsx(Zn,{source:L,width:24})}),t.jsx("span",{className:"palette-label",children:c(z.template.title)}),t.jsx("small",{children:z.template.workspace==="markdown"?c("Markdown 卡片模板"):c("自由编辑模板")})]})})(),z.type==="action"&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"palette-icon",children:v4[z.action.icon]}),t.jsx("span",{className:"palette-label",children:z.action.label}),z.action.hint&&t.jsx("small",{children:z.action.hint})]})]},z.key)})]},M.label))]})]})})}function vn(e,n){return e instanceof Error&&e.message.trim()?i(e.message):n}const F4=24*60*60*1e3,M4=30;function C4({ownerId:e,onChanged:n,onClose:r}){const s=Ks(),l=p.useId(),[o,c]=p.useState(null),[f,h]=p.useState(null),[g,x]=p.useState(null),[m,j]=p.useState(null),[k,v]=p.useState(null),w=p.useCallback(()=>{let M=!1;return xt(e).drafts.listTrash(e).then(z=>{M||(c(z),h(null))},z=>{M||h(vn(z,s("暂时无法读取回收站,请稍后重试")))}),()=>{M=!0}},[e]);p.useEffect(w,[w]),p.useEffect(()=>{const M=z=>{z.key!=="Escape"||g||m||(z.preventDefault(),r())};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[r,g,m]);async function N(M){j(M.id),v(null);try{await xt(e).drafts.restore(e,M.id),c(z=>(z==null?void 0:z.filter(A=>A.id!==M.id))??z),n()}catch(z){v(vn(z,s("恢复失败,请稍后重试")))}finally{j(null)}}async function F(M){j(M.id),v(null);try{await xt(e).drafts.purge(e,M.id),x(null),c(z=>(z==null?void 0:z.filter(A=>A.id!==M.id))??z),n()}catch(z){v(vn(z,s("彻底删除失败,请稍后重试")))}finally{j(null)}}function I(M){return Math.max(1,M4-Math.floor((Date.now()-M.deletedAt)/F4))}return t.jsxs("div",{className:"modal-backdrop",children:[t.jsxs("div",{className:"modal token-dialog",role:"dialog","aria-modal":"true","aria-labelledby":l,"data-testid":"project-trash-dialog",children:[t.jsx("h3",{id:l,className:"confirm-title",children:s("回收站")}),t.jsx("p",{className:"confirm-body",children:s("删除的项目在这里保留 30 天:恢复就回到「我的项目」,内容和历史版本都在;到期没管的会被自动清除。")}),k&&t.jsx("p",{className:"share-error",role:"alert",children:k}),f?t.jsx("p",{className:"share-error",role:"alert",children:f}):o===null?t.jsx("p",{className:"confirm-body","data-testid":"project-trash-loading",children:s("读取中…")}):o.length===0?t.jsx("p",{className:"confirm-body","data-testid":"project-trash-empty",children:s("回收站是空的——删除的项目会在这里保留 30 天。")}):t.jsx("ul",{className:"token-list","data-testid":"project-trash-list",children:o.map(M=>t.jsxs("li",{className:"token-row",children:[t.jsxs("div",{className:"token-main",children:[t.jsx("span",{className:"token-name",children:M.title||s("未命名")}),t.jsxs("span",{className:"token-sub",children:[s("{n} 天后自动清除",{n:I(M)}),M.mode==="markdown-card"?` · ${s("Markdown")}`:""]})]}),t.jsx("button",{type:"button",className:"ghost","data-testid":"project-trash-restore",disabled:m!==null,onClick:()=>void N(M),children:s("恢复")}),t.jsx("button",{type:"button",className:"ghost danger-text","data-testid":"project-trash-purge",disabled:m!==null,onClick:()=>x(M),children:s("彻底删除")})]},M.id))}),t.jsx("div",{className:"modal-foot",children:t.jsx("button",{type:"button",className:"ghost",onClick:r,disabled:m!==null,children:s("关闭")})})]}),g&&t.jsx(mi,{title:s("彻底删除「{title}」?",{title:g.title}),body:s("彻底删除后无法恢复,它的内容和历史版本都会一起清掉。"),confirmLabel:s("彻底删除"),danger:!0,onConfirm:()=>void F(g),onCancel:()=>x(null)})]})}function E4({template:e,onUse:n}){const r=p.useMemo(()=>Na(e),[e]),s=e.workspace==="markdown"?"md":"ff",l=Math.min(3,e.pageCount),o=l>1?[1,0,2].filter(c=>c<l):[0];return t.jsxs("article",{className:"tpl-card","data-testid":"template-card",children:[t.jsxs("button",{className:"tpl-stage",type:"button",onClick:()=>n(e),"aria-label":i("用「{title}」新建项目",{title:i(e.title)}),children:[r&&e.kind==="poster"&&t.jsx(Zi,{className:"tpl-fan",children:c=>{const f=Rn(e.format),h=Math.min(c*.84/f.width,c*.75*.78/f.height),g={width:Math.round(f.width*h),height:Math.round(f.height*h)};return t.jsx("div",{className:"tpl-page tpl-page-solo",style:{left:(c-g.width)/2,top:(c*.75-g.height)/2},children:t.jsx(Zn,{source:r,page:0,width:g.width,height:g.height,lazy:!0})})}}),r&&e.kind!=="poster"&&t.jsx(Zi,{className:"tpl-fan",children:c=>o.map(f=>t.jsx("div",{className:`tpl-page tpl-page-${f}`,children:t.jsx(Zn,{source:r,page:f,width:Math.round(c*.38),lazy:!0})},f))}),t.jsx("span",{className:"tpl-use",children:i("使用模板")})]}),t.jsxs("div",{className:"tpl-info",children:[t.jsxs("div",{className:"tpl-title-row",children:[t.jsx("h3",{children:i(e.title)}),t.jsx("span",{className:"chip tnum",children:e.kind==="poster"?i(Rn(e.format).ratio):i("{n} 页",{n:e.pageCount})})]}),t.jsxs("p",{children:[t.jsx("span",{className:`sys-dot ${s}`,"aria-hidden":"true"}),s==="md"?i("Markdown 卡片"):i("自由编辑"),e.tags.length>0&&` · ${e.tags.map(c=>i(c)).join(" · ")}`]})]})]})}const z4=Tc.filter(e=>["3:4","1:1","9:16","16:9"].includes(e.ratio));function Tf(e=new Date){const n=e.getHours();return n<6?i("夜深了"):n<12?i("早上好"):n<18?i("下午好"):i("晚上好")}function R4(e){return e.name||(e.type==="text"?i("文本"):e.type==="image"?i("图片"):i("形状"))}function I4({user:e,ownerId:n,projects:r,assets:s,onUploadAssets:l,templateCounts:o,onNewMarkdown:c,onNewFreeform:f,onOpenProject:h,onUseTemplate:g,onDuplicate:x,onRename:m,onDelete:j}){var T;const[k,v]=p.useState("all"),w=p.useRef(null),N=p.useMemo(()=>({"markdown-card":r.projects.filter(L=>L.mode==="markdown-card").length,"freeform-slide":r.projects.filter(L=>L.mode==="freeform-slide").length}),[r.projects]),F=r.projects.filter(L=>k==="all"||L.mode===k).slice(0,8),I=p.useMemo(()=>{const L=ui.find(H=>H.id==="column-markdown");return L?Na(L):null},[]),M=p.useMemo(()=>{const L=ui.find(H=>H.id==="night-flight-freeform");return L?Na(L):null},[]),z=(M==null?void 0:M.kind)==="freeform"?(((T=M.document.slides[0])==null?void 0:T.nodes)??[]).slice(-4).reverse().map(R4):[],A=p.useMemo(()=>["column-markdown","autumn-market-freeform","journal-markdown","signal-freeform"].map(L=>ui.find(H=>H.id===L)).filter(L=>!!L),[]);return t.jsxs("section",{className:"page page-home","aria-label":i("首页"),children:[t.jsx("h1",{className:"hello",children:e?i("{greeting},{name}",{greeting:Tf(),name:e.username}):Tf()}),t.jsx("p",{className:"hello-sub",children:i("今天想发点什么?写长文用 Markdown 卡片,自己排版用自由编辑。")}),t.jsxs("div",{className:"systems",children:[t.jsxs("article",{className:"system","data-testid":"system-markdown",children:[t.jsxs("div",{className:"system-top",children:[t.jsxs("span",{className:"sys-badge",children:[t.jsx(Us,{className:"sys-md"}),i("Markdown 卡片")]}),t.jsx("span",{className:"system-count tnum",children:i("{projects} 个项目 · {templates} 套模板",{projects:N["markdown-card"],templates:o["markdown-card"]})})]}),t.jsxs("div",{children:[t.jsx("h2",{className:"system-title",children:i("写一篇长文,自动排成一组卡片")}),t.jsx("p",{className:"system-desc",children:i("只管写字。标题、正文、金句按内容自动分页,整组图片一键导出。")})]}),t.jsxs("div",{className:"system-art system-art-md","aria-hidden":"true",children:[t.jsxs("div",{className:"md-doc",children:[t.jsx("b",{children:i("# 在城市里慢慢走")}),t.jsx("i",{}),t.jsx("i",{className:"short"}),t.jsx("span",{className:"md-break",children:"---"}),t.jsx("b",{children:i("## 地铁看不见的东西")}),t.jsx("i",{}),t.jsx("i",{}),t.jsx("i",{className:"short"}),t.jsx("span",{className:"md-break",children:"---"}),t.jsx("span",{children:i("> 你不需要去很远的地方")})]}),t.jsx("span",{className:"md-flow"}),t.jsx("div",{className:"md-fan",children:I&&[1,0,2].map(L=>t.jsx("div",{className:`md-fan-page md-fan-${L}`,children:t.jsx(Zn,{source:I,page:L,width:84})},L))})]}),t.jsxs("div",{className:"system-actions",children:[t.jsx("span",{className:"system-label",children:i("新建")}),pr.map(L=>t.jsx("button",{className:"pill",type:"button",onClick:()=>c(L.id),children:i(L.label)},L.id)),t.jsx("button",{className:"system-more",type:"button",onClick:()=>It(ht.templates("markdown-card")),children:i("从模板开始")})]})]}),t.jsxs("article",{className:"system","data-testid":"system-freeform",children:[t.jsxs("div",{className:"system-top",children:[t.jsxs("span",{className:"sys-badge",children:[t.jsx(Ui,{className:"sys-ff"}),i("自由编辑")]}),t.jsx("span",{className:"system-count tnum",children:i("{projects} 个项目 · {templates} 套模板",{projects:N["freeform-slide"],templates:o["freeform-slide"]})})]}),t.jsxs("div",{children:[t.jsx("h2",{className:"system-title",children:i("像做海报一样,自由摆放每个元素")}),t.jsx("p",{className:"system-desc",children:i("文字、图片、形状、图层和参考线都在手边,多页设计一次导出。")})]}),t.jsxs("div",{className:"system-art system-art-ff","aria-hidden":"true",children:[t.jsxs("div",{className:"ff-rail",children:[t.jsx("span",{children:t.jsx(Gi,{})}),t.jsx("span",{className:"on",children:t.jsx(Gs,{})}),t.jsx("span",{children:t.jsx(Ui,{})})]}),t.jsx("div",{className:"ff-canvas",children:M&&t.jsxs("div",{className:"ff-page",children:[t.jsx(Zn,{source:M,width:112}),t.jsx("i",{className:"ff-sel"})]})}),t.jsx("div",{className:"ff-layers",children:z.map((L,H)=>t.jsx("span",{className:H===1?"on":void 0,children:L},`${L}-${H}`))})]}),t.jsxs("div",{className:"system-actions",children:[t.jsx("span",{className:"system-label",children:i("新建")}),z4.map(L=>t.jsx("button",{className:"pill tnum",type:"button",onClick:()=>f(L.width,L.height),children:L.ratio},L.ratio)),t.jsx("button",{className:"system-more",type:"button",onClick:()=>It(ht.templates("freeform-slide")),children:i("从模板开始")})]})]})]}),t.jsxs("section",{className:"section","aria-labelledby":"home-recent",children:[t.jsxs("div",{className:"section-head",children:[t.jsx("h2",{id:"home-recent",children:i("最近编辑")}),t.jsxs("div",{className:"section-tools",children:[t.jsxs("div",{className:"tabs",role:"group","aria-label":i("按系统筛选"),children:[t.jsx("button",{type:"button","aria-pressed":k==="all",onClick:()=>v("all"),children:i("全部")}),t.jsx("button",{type:"button","aria-pressed":k==="markdown-card",onClick:()=>v("markdown-card"),children:i("Markdown 卡片")}),t.jsx("button",{type:"button","aria-pressed":k==="freeform-slide",onClick:()=>v("freeform-slide"),children:i("自由编辑")})]}),r.projects.length>0&&t.jsx("button",{className:"link-btn",type:"button",onClick:()=>It(ht.projects()),children:i("查看全部 {n} 个",{n:r.projects.length})})]})]}),F.length>0?t.jsx("div",{className:"project-grid",children:F.map(L=>t.jsx(_0,{draft:L,onOpen:h,onDuplicate:x,onRename:m,onDelete:j},L.id))}):t.jsxs("div",{className:"empty",children:[t.jsx("b",{children:i("还没有项目")}),t.jsx("span",{children:i("从上面选一种方式新建,开始编辑就会自动保存到这里。")})]})]}),n&&t.jsxs("section",{className:"section","aria-labelledby":"home-assets",children:[t.jsxs("div",{className:"section-head",children:[t.jsxs("div",{children:[t.jsx("h2",{id:"home-assets",children:i("素材库")}),t.jsx("p",{className:"section-hint",children:i("常用的照片、头像和 Logo 放在这里,两套系统都能直接取用。")})]}),t.jsx("button",{className:"link-btn",type:"button",onClick:()=>It(ht.assets),children:s.assets.length>0?i("管理全部 {n} 张",{n:s.assets.length}):i("打开素材库")})]}),t.jsxs("div",{className:"asset-strip",children:[s.assets.slice(0,7).map(L=>t.jsx("button",{className:"asset-strip-item",type:"button",title:L.name,"aria-label":i("在素材库中查看 {name}",{name:L.name}),onClick:()=>It(ht.assets),children:t.jsx("img",{src:L.src,alt:"",loading:"lazy",decoding:"async",draggable:!1})},L.id)),t.jsxs("button",{className:"asset-strip-add",type:"button",onClick:()=>{var L;return(L=w.current)==null?void 0:L.click()},children:[t.jsx(gr,{}),t.jsx("span",{children:i("上传图片")})]}),t.jsx("input",{ref:w,type:"file",accept:vd,multiple:!0,hidden:!0,onChange:L=>{const H=Array.from(L.currentTarget.files??[]);L.currentTarget.value="",H.length>0&&l(H)}})]})]}),t.jsxs("section",{className:"section","aria-labelledby":"home-templates",children:[t.jsxs("div",{className:"section-head",children:[t.jsx("h2",{id:"home-templates",children:i("模板推荐")}),t.jsx("button",{className:"link-btn",type:"button",onClick:()=>It(ht.templates()),children:i("去模板中心")})]}),t.jsx("div",{className:"tpl-grid",children:A.map(L=>t.jsx(E4,{template:L,onUse:g},L.id))})]})]})}function Wf(e){return Array.from(e.dataTransfer.types).includes("Files")}function L4({ownerId:e,guestLeft:n,onMoveGuestWork:r,system:s,projects:l,onNewMarkdown:o,onNewFreeform:c,onImport:f,onOpenTrash:h,onOpenProject:g,onDuplicate:x,onRename:m,onDelete:j}){const[k,v]=p.useState("updated"),[w,N]=p.useState(!1),F=p.useRef(null),I=l.projects,M={"markdown-card":I.filter(A=>A.mode==="markdown-card").length,"freeform-slide":I.filter(A=>A.mode==="freeform-slide").length},z=p.useMemo(()=>{const A=I.filter(T=>!s||T.mode===s);return k==="title"?[...A].sort((T,L)=>T.title.localeCompare(L.title,Bs())):A},[I,k,s]);return t.jsxs("section",{className:w?"page page-projects is-dropping":"page page-projects","aria-label":i("我的项目"),onDragOver:A=>{!e||!Wf(A)||(A.preventDefault(),A.dataTransfer.dropEffect="copy",N(!0))},onDragLeave:A=>{A.currentTarget.contains(A.relatedTarget)||N(!1)},onDrop:A=>{if(!e||!Wf(A))return;A.preventDefault(),N(!1);const T=A.dataTransfer.files[0];T&&f(T)},children:[t.jsxs("div",{className:"page-head",children:[t.jsx("div",{children:t.jsx("h1",{children:i("我的项目")})}),t.jsxs("div",{className:"page-actions",children:[h&&t.jsxs("button",{className:"ghost",type:"button","data-testid":"project-trash",title:i("删除的项目在这里保留 30 天,可以恢复或彻底删除"),onClick:h,children:[t.jsx(Ji,{}),i("回收站")]}),e&&t.jsxs("button",{className:"ghost",type:"button","data-testid":"project-import",title:i("导入 .json 文档,比如 MCP 工具生成的结果"),onClick:()=>{var A;return(A=F.current)==null?void 0:A.click()},children:[t.jsx(jf,{}),i("导入 JSON")]}),t.jsxs("button",{className:"ghost",type:"button",onClick:o,children:[t.jsx(Us,{className:"sys-md"}),i("新建 Markdown 卡片")]}),t.jsxs("button",{className:"ghost",type:"button",onClick:c,children:[t.jsx(Ui,{className:"sys-ff"}),i("新建自由编辑")]}),t.jsx("input",{ref:F,type:"file",accept:".json,application/json",hidden:!0,"aria-label":i("导入 JSON 文档"),"data-testid":"project-import-input",onChange:A=>{var L;const T=(L=A.currentTarget.files)==null?void 0:L[0];A.currentTarget.value="",T&&f(T)}})]})]}),n&&n.projects+n.assets>0&&t.jsxs("div",{className:"guest-left","data-testid":"guest-left",children:[t.jsx(pd,{}),t.jsx("span",{children:n.projects>0?i("这台设备上还有 {n} 个没登录时做的项目。",{n:n.projects}):i("这台设备上还有 {n} 张没登录时存的素材。",{n:n.assets})}),t.jsx("button",{className:"ghost",type:"button",onClick:r,"data-testid":"guest-left-move",children:i("放进账号")})]}),t.jsxs("div",{className:"toolbar-row",children:[t.jsxs("div",{className:"tabs",role:"group","aria-label":i("按系统筛选"),children:[t.jsxs("button",{type:"button","aria-pressed":!s,onClick:()=>It(ht.projects()),children:[i("全部")," ",t.jsx("span",{className:"tnum",children:I.length})]}),t.jsxs("button",{type:"button","aria-pressed":s==="markdown-card",onClick:()=>It(ht.projects("markdown-card")),children:[t.jsx("span",{className:"sys-dot md","aria-hidden":"true"}),i("Markdown 卡片")," ",t.jsx("span",{className:"tnum",children:M["markdown-card"]})]}),t.jsxs("button",{type:"button","aria-pressed":s==="freeform-slide",onClick:()=>It(ht.projects("freeform-slide")),children:[t.jsx("span",{className:"sys-dot ff","aria-hidden":"true"}),i("自由编辑")," ",t.jsx("span",{className:"tnum",children:M["freeform-slide"]})]})]}),t.jsx("span",{className:"grow"}),t.jsx(Qr,{value:k,title:i("排序"),onChange:A=>v(A),options:[{id:"updated",label:i("最近编辑")},{id:"title",label:i("按名称")}]})]}),l.status==="error"&&t.jsxs("div",{className:"empty",children:[t.jsx("b",{children:i("项目读取失败")}),t.jsx("span",{children:l.error}),t.jsx("button",{className:"ghost",type:"button",onClick:l.reload,children:i("重试")})]}),w&&t.jsx("div",{className:"asset-drop-overlay","aria-hidden":"true",children:t.jsxs("div",{children:[t.jsx(jf,{}),t.jsx("b",{children:i("松开,导入为项目")})]})}),z.length>0?t.jsx("div",{className:"project-grid",children:z.map(A=>t.jsx(_0,{draft:A,onOpen:g,onDuplicate:x,onRename:m,onDelete:j},A.id))}):l.status!=="error"&&t.jsxs("div",{className:"empty",children:[t.jsx("b",{children:s?i("这一类还没有项目"):i("还没有保存的项目")}),t.jsx("span",{children:i("新建一个,开始编辑就会自动保存到这里;也可以把 .json 文档拖进来导入。")})]})]})}const Zc="slicer.template.favorites.v1";function B0(e){if(!Array.isArray(e))return[];const n=new Set,r=[];for(const s of e)typeof s!="string"||s.length===0||n.has(s)||(n.add(s),r.push(s));return r}function K0(){try{const e=localStorage.getItem(Zc);return e?B0(JSON.parse(e)):[]}catch{return[]}}function V0(e){try{const n=B0(e);n.length===0?localStorage.removeItem(Zc):localStorage.setItem(Zc,JSON.stringify(n))}catch{}}function G0(e,n){return e.includes(n)?e.filter(r=>r!==n):[...e,n]}function $4(){const[e,n]=p.useState(()=>K0());return[p.useMemo(()=>new Set(e),[e]),l=>n(o=>{const c=G0(o,l);return V0(c),c})]}function U0({template:e,on:n,onToggle:r,className:s}){const l=i(e.title);return t.jsx("button",{className:n?`${s} on`:s,type:"button","aria-pressed":n,"aria-label":n?i("取消收藏{title}",{title:l}):i("收藏{title}",{title:l}),"data-testid":`template-favorite-${e.id}`,onClick:o=>{o.stopPropagation(),r()},children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M10 17s-6.3-3.9-8.2-7.2C.5 7.4 2 4 5.2 4c2 0 3.4 1.1 4.8 2.9C11.4 5.1 12.8 4 14.8 4 18 4 19.5 7.4 18.2 9.8 16.3 13.1 10 17 10 17Z"})})})}function D4(e){return e.kind==="poster"?i(Rn(e.format).ratio):i("{n} 页",{n:e.pageCount})}function A4({template:e,width:n,favorited:r,onToggleFavorite:s,onPreview:l,onUse:o}){const c=p.useMemo(()=>Na(e),[e]),f=Rn(e.format),h={width:Math.round(n),height:Math.round(n*f.height/f.width)},g=i(e.title),x=e.workspace==="markdown"?"md":"ff";return t.jsxs("article",{className:e.pageCount>1?"tpl-tile is-pages":"tpl-tile","data-testid":"template-card","data-template-id":e.id,children:[t.jsxs("div",{className:"tpl-tile-media",style:{height:h.height},children:[t.jsx("button",{className:"tpl-tile-open",type:"button","aria-label":i("预览{title}",{title:g}),onClick:()=>l(e),children:c&&t.jsx(Zn,{source:c,width:h.width,height:h.height,lazy:!0})}),t.jsx("button",{className:"tpl-tile-use",type:"button","aria-label":i("用「{title}」新建项目",{title:g}),onClick:()=>o(e),children:i("使用")}),t.jsx(U0,{className:"tpl-tile-heart",template:e,on:r,onToggle:()=>s(e.id)})]}),t.jsxs("div",{className:"tpl-tile-info",children:[t.jsx("h3",{children:g}),t.jsxs("span",{className:"tpl-tile-meta tnum",children:[t.jsx("span",{className:`sys-dot ${x}`,"aria-hidden":"true"}),D4(e)]})]})]})}function Hf({templates:e,minColumn:n=188,gap:r=20,children:s}){return t.jsx(Zi,{className:"tpl-masonry",children:l=>{const o=Math.max(2,Math.floor((l+r)/(n+r))),c=(l-r*(o-1))/o,f=Array.from({length:o},()=>({height:0,items:[]}));for(const h of e){const g=Rn(h.format),x=f.reduce((m,j)=>j.height<m.height-.5?j:m,f[0]);x.items.push(h),x.height+=c*g.height/g.width+56+r}return t.jsx("div",{className:"tpl-masonry-columns",style:{gap:r,gridTemplateColumns:`repeat(${o}, minmax(0, 1fr))`},children:f.map((h,g)=>t.jsx("div",{className:"tpl-masonry-column",style:{gap:r},children:h.items.map(x=>s(x,c))},g))})}})}function P4(e){return Array.from(e.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), [tabindex]:not([tabindex="-1"])'))}function T4({template:e,list:n,pool:r,favorites:s,onToggleFavorite:l,onShow:o,onUse:c,onFilterUse:f,onFilterStyle:h,onClose:g}){const x=p.useRef(null),m=p.useRef(null),[j,k]=p.useState(0),v=p.useMemo(()=>Na(e),[e]),w=Rn(e.format),N=Jr(e),F=p.useMemo(()=>w4(e,r,6),[e,r]),I=n.findIndex(U=>U.id===e.id),M=I>0?n[I-1]:null,z=I>=0&&I<n.length-1?n[I+1]:null,A=i(e.title),T=Math.min(520/w.width,520/w.height,(typeof window>"u"?900:window.innerHeight*.62)/w.height),L={width:Math.round(w.width*T),height:Math.round(w.height*T)},H={width:Math.round(64*w.width/Math.max(w.width,w.height)),height:Math.round(64*w.height/Math.max(w.width,w.height))},P=p.useRef({previous:M,next:z,onShow:o,onClose:g});return P.current={previous:M,next:z,onShow:o,onClose:g},p.useEffect(()=>k(0),[e]),p.useEffect(()=>{m.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const U=requestAnimationFrame(()=>{var D,re;return(re=(D=x.current)==null?void 0:D.querySelector(".tpl-preview-use"))==null?void 0:re.focus()}),K=D=>{const re=x.current;if(re){if(D.key==="Escape")D.preventDefault(),P.current.onClose();else if(D.key==="ArrowLeft"&&P.current.previous&&!(D.target instanceof HTMLInputElement))D.preventDefault(),P.current.onShow(P.current.previous);else if(D.key==="ArrowRight"&&P.current.next&&!(D.target instanceof HTMLInputElement))D.preventDefault(),P.current.onShow(P.current.next);else if(D.key==="Tab"){const q=P4(re);if(q.length===0)return;D.shiftKey&&document.activeElement===q[0]?(D.preventDefault(),q[q.length-1].focus()):!D.shiftKey&&document.activeElement===q[q.length-1]&&(D.preventDefault(),q[0].focus())}}};return window.addEventListener("keydown",K,!0),()=>{var D;cancelAnimationFrame(U),window.removeEventListener("keydown",K,!0),(D=m.current)==null||D.focus()}},[]),t.jsx("div",{className:"tpl-preview-backdrop",onMouseDown:U=>{U.target===U.currentTarget&&(U.preventDefault(),g())},children:t.jsxs("div",{ref:x,className:"tpl-preview",role:"dialog","aria-modal":"true","aria-labelledby":"tpl-preview-title","data-testid":"template-preview",children:[t.jsx("button",{className:"icon-btn tpl-preview-close",type:"button","aria-label":i("关闭"),onClick:g,children:t.jsx(Pn,{})}),t.jsxs("div",{className:"tpl-preview-main",children:[t.jsxs("div",{className:"tpl-preview-stage",children:[t.jsx("button",{className:"icon-btn tpl-preview-step",type:"button","aria-label":i("上一个模板"),disabled:!M,onClick:()=>M&&o(M),children:t.jsx(Qi,{})}),t.jsx("div",{className:"tpl-preview-page",style:{width:L.width,height:L.height},children:v&&t.jsx(Zn,{source:v,page:j,width:L.width,height:L.height})}),t.jsx("button",{className:"icon-btn tpl-preview-step",type:"button","aria-label":i("下一个模板"),disabled:!z,onClick:()=>z&&o(z),children:t.jsx(g0,{})})]}),e.pageCount>1&&v&&t.jsx("div",{className:"tpl-preview-pages",role:"group","aria-label":i("模板页面"),children:Array.from({length:e.pageCount},(U,K)=>t.jsx("button",{type:"button",className:"tpl-preview-thumb","aria-label":i("第 {n} 页",{n:K+1}),"aria-pressed":j===K,onClick:()=>k(K),children:t.jsx(Zn,{source:v,page:K,width:H.width,height:H.height})},K))})]}),t.jsxs("div",{className:"tpl-preview-side",children:[t.jsx("div",{className:"tpl-preview-uses",children:N.uses.map(U=>t.jsx("button",{type:"button",className:"tpl-preview-link",onClick:()=>f(U),children:i(Xi(U))},U))}),t.jsx("h2",{id:"tpl-preview-title",children:A}),t.jsx("p",{className:"tpl-preview-desc",children:i(e.description)}),t.jsxs("dl",{className:"tpl-preview-specs",children:[t.jsxs("div",{children:[t.jsx("dt",{children:i("尺寸")}),t.jsxs("dd",{className:"tnum",children:[i(w.name)," · ",w.width,"×",w.height]})]}),t.jsxs("div",{children:[t.jsx("dt",{children:i("页数")}),t.jsx("dd",{className:"tnum",children:i("{n} 页",{n:e.pageCount})})]}),t.jsxs("div",{children:[t.jsx("dt",{children:i("编辑方式")}),t.jsx("dd",{children:e.workspace==="markdown"?i("Markdown 卡片"):i("自由编辑")})]}),t.jsxs("div",{children:[t.jsx("dt",{children:i("风格")}),t.jsx("dd",{className:"tpl-preview-chips",children:N.styles.map(U=>t.jsx("button",{type:"button",className:"chip",onClick:()=>h(U),children:i(W0(U))},U))})]}),t.jsxs("div",{children:[t.jsx("dt",{children:i("颜色")}),t.jsx("dd",{className:"tpl-preview-colors",children:N.colors.map(U=>{var K;return t.jsx("span",{className:"tpl-color-dot",title:i(H0(U)),style:{background:(K=Nd.find(D=>D.id===U))==null?void 0:K.swatch}},U)})})]})]}),t.jsxs("div",{className:"tpl-preview-actions",children:[t.jsx("button",{className:"primary tpl-preview-use",type:"button",onClick:()=>c(e),children:i("使用这个模板")}),t.jsx(U0,{className:"ghost tpl-preview-heart",template:e,on:s.has(e.id),onToggle:()=>l(e.id)})]}),F.length>0&&t.jsxs("section",{className:"tpl-preview-similar","aria-labelledby":"tpl-preview-similar",children:[t.jsx("h3",{id:"tpl-preview-similar",children:i("相似模板")}),t.jsx("div",{className:"tpl-preview-similar-grid",children:F.map(U=>{const K=Na(U),D=Rn(U.format),re=84,q=Math.min(re/D.width,re/D.height);return t.jsxs("button",{type:"button",className:"tpl-preview-similar-item","aria-label":i("预览{title}",{title:i(U.title)}),onClick:()=>o(U),children:[t.jsx("span",{className:"tpl-preview-similar-art",children:K&&t.jsx(Zn,{source:K,width:Math.round(D.width*q),height:Math.round(D.height*q),lazy:!0})}),t.jsx("span",{children:i(U.title)})]},U.id)})})]})]})]})})}const W4="https://github.com/lottshin/DingCard/blob/master/docs/templates.md",Vr="all";function H4({system:e,onUseTemplate:n}){ra();const r=p.useMemo(()=>Ts("markdown-card"),[]),s=p.useMemo(()=>Ts("freeform-slide"),[]),l=p.useMemo(()=>[...r,...s],[r,s]),o=p.useMemo(()=>e?l.filter(W=>$0(W)===e):l,[l,e]),[c,f]=p.useState(""),[h,g]=p.useState(null),[x,m]=p.useState(null),[j,k]=p.useState(null),[v,w]=p.useState(null),[N,F]=p.useState(!1),[I,M]=$4(),[z,A]=p.useState(null),T=Md(o),L=h&&T.includes(h)?h:null,H=x&&o.some(W=>W.format===x)?x:null,P=j&&o.some(W=>Jr(W).styles.includes(j))?j:null,U=v&&o.some(W=>Jr(W).colors.includes(v))?v:null,K={text:c,use:L,format:H,style:P,color:U,only:N?I:null},D=si(o,K),re=Ws.filter(W=>W.id===H||si(o,{...K,format:W.id}).length>0),q=T0.filter(W=>W.id===P||si(o,{...K,style:W.id}).length>0),te=Nd.filter(W=>W.id===U||si(o,{...K,color:W.id}).length>0),be=!!(c.trim()||L||H||P||U||N),ne=be?[]:T.map(W=>({id:W,templates:D.filter(ae=>Jr(ae).uses[0]===W)})).filter(W=>W.templates.length>0),Be=z?l.find(W=>W.id===z)??null:null;function le(){f(""),g(null),m(null),k(null),w(null),F(!1)}const De=(W,ae)=>t.jsx(A4,{template:W,width:ae,favorited:I.has(W.id),onToggleFavorite:M,onPreview:Se=>A(Se.id),onUse:n},W.id);return t.jsxs("section",{className:"page tpl-center","aria-label":i("模板中心"),children:[t.jsxs("div",{className:"page-head",children:[t.jsx("div",{children:t.jsx("h1",{children:i("模板中心")})}),t.jsxs("div",{className:"tabs",role:"group","aria-label":i("按系统筛选"),children:[t.jsxs("button",{type:"button","aria-pressed":!e,onClick:()=>It(ht.templates()),children:[i("全部")," ",t.jsx("span",{className:"tnum",children:l.length})]}),t.jsxs("button",{type:"button","aria-pressed":e==="markdown-card",onClick:()=>It(ht.templates("markdown-card")),children:[t.jsx("span",{className:"sys-dot md","aria-hidden":"true"}),i("Markdown 卡片")," ",t.jsx("span",{className:"tnum",children:r.length})]}),t.jsxs("button",{type:"button","aria-pressed":e==="freeform-slide",onClick:()=>It(ht.templates("freeform-slide")),children:[t.jsx("span",{className:"sys-dot ff","aria-hidden":"true"}),i("自由编辑")," ",t.jsx("span",{className:"tnum",children:s.length})]})]})]}),t.jsxs("div",{className:"tpl-finder",children:[t.jsxs("label",{className:"search-field tpl-search",children:[t.jsx(Ma,{}),t.jsx("input",{type:"search","data-testid":"template-center-search","aria-label":i("搜索模板"),placeholder:i("搜索模板,比如:菜单、中秋、读书笔记"),value:c,onChange:W=>f(W.target.value),onKeyDown:W=>{W.key==="Escape"&&c&&(W.preventDefault(),f(""))}}),c&&t.jsx("button",{className:"tpl-search-clear",type:"button","aria-label":i("清空搜索"),onClick:()=>f(""),children:t.jsx(Pn,{})})]}),T.length>1&&t.jsxs("div",{className:"tpl-uses",role:"group","aria-label":i("按用途筛选"),children:[t.jsx("button",{type:"button","aria-pressed":L===null,onClick:()=>g(null),children:i("全部")}),T.map(W=>t.jsx("button",{type:"button","aria-pressed":L===W,"data-testid":`template-use-${W}`,onClick:()=>g(L===W?null:W),children:i(Xi(W))},W))]}),t.jsxs("div",{className:"tpl-filters",children:[t.jsx(Qr,{value:H??Vr,title:i("尺寸"),testId:"template-filter-format",onChange:W=>m(W===Vr?null:W),options:[{id:Vr,label:i("全部尺寸")},...re.map(W=>({id:W.id,label:`${i(W.name)} · ${i(W.ratio)}`}))]}),t.jsx(Qr,{value:P??Vr,title:i("风格"),testId:"template-filter-style",onChange:W=>k(W===Vr?null:W),options:[{id:Vr,label:i("全部风格")},...q.map(W=>({id:W.id,label:i(W.name)}))]}),t.jsx(Qr,{value:U??Vr,title:i("颜色"),testId:"template-filter-color",onChange:W=>w(W===Vr?null:W),options:[{id:Vr,label:i("全部颜色")},...te.map(W=>({id:W.id,label:i(W.name),swatch:{bg:W.swatch,accent:W.swatch}}))]}),t.jsxs("button",{className:"tpl-filter-toggle",type:"button","aria-pressed":N,"data-testid":"template-center-favorites",onClick:()=>F(W=>!W),children:[t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M10 17s-6.3-3.9-8.2-7.2C.5 7.4 2 4 5.2 4c2 0 3.4 1.1 4.8 2.9C11.4 5.1 12.8 4 14.8 4 18 4 19.5 7.4 18.2 9.8 16.3 13.1 10 17 10 17Z"})}),i("收藏"),I.size>0&&t.jsx("span",{className:"tnum",children:I.size})]}),t.jsx("span",{className:"grow"}),t.jsx("span",{className:"tpl-count tnum","data-testid":"template-center-count",children:i("{n} 套模板",{n:D.length})}),be&&t.jsx("button",{className:"link-btn",type:"button",onClick:le,children:i("清除筛选")})]})]}),D.length===0&&t.jsxs("div",{className:"empty tpl-empty","data-testid":"template-center-empty",children:[t.jsx("b",{children:i("没有找到相关模板")}),t.jsx("button",{className:"ghost",type:"button",onClick:le,children:i("清除筛选")})]}),be&&D.length>0&&t.jsx(Hf,{templates:D,children:De}),!be&&ne.map(W=>t.jsxs("section",{className:"tpl-section","aria-labelledby":`tpl-use-${W.id}`,children:[t.jsxs("div",{className:"tpl-section-head",children:[t.jsx("h2",{id:`tpl-use-${W.id}`,children:i(Xi(W.id))}),t.jsx("span",{className:"tnum",children:W.templates.length}),t.jsx("span",{className:"grow"}),t.jsx("button",{className:"link-btn",type:"button",onClick:()=>g(W.id),children:i("只看这一类")})]}),t.jsx(Hf,{templates:W.templates,children:De})]},W.id)),t.jsxs("aside",{className:"tpl-contribute","aria-label":i("贡献模板"),children:[t.jsxs("div",{children:[t.jsx("b",{children:i("模板由社区共建")}),t.jsx("p",{children:i("每套模板都在仓库里维护。做了一套好看的版式?按贡献指南提交 Pull Request,合并后所有人都能用。想复用自己的作品,在「我的项目」里复制一份就行。")})]}),t.jsx("a",{className:"ghost tpl-contribute-link",href:W4,target:"_blank",rel:"noreferrer",children:i("查看贡献指南")})]}),Be&&t.jsx(T4,{template:Be,list:D,pool:o,favorites:I,onToggleFavorite:M,onShow:W=>A(W.id),onUse:W=>{A(null),n(W)},onFilterUse:W=>{A(null),le(),g(W)},onFilterStyle:W=>{A(null),le(),k(W)},onClose:()=>A(null)})]})}const O4=["decks","shares","drafts","assets","images"];function _4(e,n){return n===null?e("还没用过"):new Date(n).toLocaleString()}function B4({ownerId:e,onClose:n}){const r=Ks(),l=ra()==="zh"?"、":", ",o=p.useId(),c=p.useRef(null),[f,h]=p.useState(null),[g,x]=p.useState(null),[m,j]=p.useState(""),[k,v]=p.useState(["shares","images"]),[w,N]=p.useState(!1),[F,I]=p.useState(null),[M,z]=p.useState(null),[A,T]=p.useState(!1),[L,H]=p.useState(null),P=()=>{zt.tokens.list(e).then(q=>{h(q),x(null)},q=>{x(vn(q,r("暂时无法读取令牌,请稍后重试")))})};p.useEffect(()=>{var te;P(),(te=c.current)==null||te.focus();const q=be=>{be.key==="Escape"&&(be.preventDefault(),n())};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[]);const U=q=>{v(te=>te.includes(q)?te.filter(be=>be!==q):[...te,q])},K=async()=>{if(!w){N(!0),I(null);try{const q=await zt.tokens.create(e,m.trim(),k);z(q),T(!1),j(""),P()}catch(q){I(vn(q,r("暂时无法创建令牌,请稍后重试")))}finally{N(!1)}}},D=async()=>{if(M)try{await navigator.clipboard.writeText(M.token),T(!0)}catch{}},re=async()=>{if(!L)return;const q=L;H(null);try{await zt.tokens.revoke(e,q.id),P()}catch(te){x(vn(te,r("暂时无法撤销令牌,请稍后重试")))}};return t.jsxs("div",{className:"modal-backdrop",onMouseDown:q=>q.target===q.currentTarget&&n(),children:[t.jsxs("div",{className:"modal token-modal",role:"dialog","aria-modal":"true","aria-labelledby":o,children:[t.jsxs("div",{className:"modal-head",children:[t.jsx("h3",{id:o,children:r("API 令牌")}),t.jsx("p",{className:"token-intro",children:r("给程序用的钥匙:带上这个值的请求就代表你的账号,只能做勾选范围内的事。值只显示一次,随时可以撤销。")})]}),M&&t.jsxs("div",{className:"token-minted","data-testid":"token-minted",children:[t.jsx("div",{className:"token-minted-label",children:r("「{name}」的令牌值(只显示这一次)",{name:M.name})}),t.jsx("code",{className:"token-value",children:M.token}),t.jsxs("div",{className:"token-minted-actions",children:[t.jsx("button",{type:"button",className:"ghost",onClick:()=>void D(),children:r(A?"已复制":"复制")}),t.jsx("button",{type:"button",className:"ghost",onClick:()=>z(null),children:r("我存好了")})]})]}),t.jsxs("div",{className:"token-create",children:[t.jsx("label",{className:"field-label",htmlFor:"token-name",children:r("名称")}),t.jsx("input",{id:"token-name",ref:c,className:"token-name-input","data-testid":"token-name-input",value:m,onChange:q=>j(q.target.value),placeholder:r("比如:我的智能体")}),t.jsx("span",{className:"field-label",children:r("权限")}),t.jsx("div",{className:"token-scopes",role:"group","aria-label":r("权限"),children:O4.map(q=>t.jsxs("label",{className:"token-scope",children:[t.jsx("input",{type:"checkbox","data-testid":`token-scope-${q}`,checked:k.includes(q),onChange:()=>U(q)}),r(q)]},q))}),F&&t.jsx("p",{className:"token-error",role:"alert",children:F}),t.jsx("button",{type:"button",className:"accent token-create-btn","data-testid":"token-create-btn",disabled:w||m.trim()===""||k.length===0,onClick:()=>void K(),children:r(w?"创建中…":"创建令牌")})]}),t.jsxs("div",{className:"token-list","data-testid":"token-list",children:[g&&t.jsx("p",{className:"token-error",role:"alert",children:g}),f!==null&&f.length===0&&!g&&t.jsx("p",{className:"token-empty",children:r("还没有令牌。")}),f==null?void 0:f.map(q=>t.jsxs("div",{className:"token-row","data-testid":"token-row",children:[t.jsxs("div",{className:"token-row-main",children:[t.jsx("b",{children:q.name}),t.jsx("span",{className:"token-row-scopes",children:q.scopes.map(te=>r(te)).join(l)})]}),t.jsxs("div",{className:"token-row-meta",children:[t.jsx("span",{children:r("最近使用:{time}",{time:_4(r,q.lastUsedAt)})}),t.jsx("button",{type:"button",className:"ghost token-revoke",onClick:()=>H(q),children:r("撤销")})]})]},q.id))]}),t.jsx("div",{className:"modal-foot",children:t.jsx("button",{type:"button",className:"ghost",onClick:n,children:r("关闭")})})]}),L&&t.jsx(mi,{title:r("撤销「{name}」?",{name:L.name}),body:r("撤销后用这个令牌的程序立刻无法访问。"),confirmLabel:r("撤销"),danger:!0,onConfirm:()=>void re(),onCancel:()=>H(null)})]})}function Y0(e){const n=e,[r,s]=p.useState([]),[l,o]=p.useState(n?"loading":"idle"),[c,f]=p.useState(null),[h,g]=p.useState([]),x=p.useRef(0),m=p.useRef(n);m.current=n;const j=p.useCallback(()=>{const N=++x.current;if(!n){s([]),o("idle"),f(null);return}o(F=>F==="ready"?F:"loading"),xt(n).assets.list(n).then(F=>{N===x.current&&(s(Pc(F)),o("ready"),f(null))},F=>{N===x.current&&(o("error"),f(vn(F,i("暂时无法读取素材库,请稍后重试"))))})},[n]);p.useEffect(()=>(j(),g([]),()=>{x.current+=1}),[j]);const k=p.useCallback(async N=>{const F=m.current,I={added:[],failed:[]};if(!F||N.length===0)return I;const M=N.map(z=>({id:fi(),name:z.name}));g(z=>[...M,...z]);for(const[z,A]of N.entries())try{const T=await xt(F).assets.add(F,await l4(A));if(m.current!==F)break;I.added.push(T),s(L=>Pc([T,...L])),o("ready")}catch(T){I.failed.push({name:A.name,error:vn(T,i("上传失败,请稍后重试"))})}finally{g(T=>T.filter(L=>L.id!==M[z].id))}return I},[]),v=p.useCallback(async(N,F)=>{const I=m.current;if(!I)return;const M=await xt(I).assets.rename(I,N.id,F);m.current===I&&s(z=>z.map(A=>A.id===M.id?M:A))},[]),w=p.useCallback(async N=>{const F=m.current;F&&(await xt(F).assets.remove(F,N.id),m.current===F&&s(I=>I.filter(M=>M.id!==N.id)))},[]);return{status:l,assets:r,error:c,uploads:h,reload:j,upload:k,rename:v,remove:w}}function Z0(e){const{added:n,failed:r}=e;if(r.length===0)return n.length>0?{title:i("已上传 {n} 张图片",{n:n.length}),tone:"info"}:null;const[s]=r,l=r.length>1?i(",另有 {n} 张也没上传",{n:r.length-1}):"";return{title:n.length>0?i("上传了 {added} 张,{failed} 张没有上传",{added:n.length,failed:r.length}):i("{n} 张图片没有上传",{n:r.length}),detail:i("「{name}」{error}",{name:s.name,error:s.error})+l,tone:"error"}}const K4="slicer.user-templates.";function Xc(e){return K4+e}function V4(e){return typeof e=="object"&&e!==null}function G4(e){try{const n=localStorage.getItem(Xc(e));if(n===null)return null;const r=JSON.parse(n);return Array.isArray(r)?r:[]}catch{return[]}}function Of(e,n){try{n.length===0?localStorage.removeItem(Xc(e)):localStorage.setItem(Xc(e),JSON.stringify(n))}catch{}}function U4(e){if(!V4(e))return null;const n=$1(e.draft);if(!n)return null;const r=typeof e.name=="string"&&e.name.trim()?e.name.trim():n.title;return n.mode==="freeform-slide"?{mode:"freeform-slide",title:r,document:n.document}:{mode:"markdown-card",title:r,document:n.document}}async function Y4(e,n){const r=G4(e);if(r===null)return 0;let s=[...r],l=0;for(;s.length>0;){const[o,...c]=s,f=U4(o);f&&(await n(f),l+=1),s=c,Of(e,s)}return Of(e,[]),l}const Z4=700,il=new Set,qc=new Set;function Ko(){return Promise.all([...il].map(e=>e.flush())).then(()=>{})}function X4(e){return qc.add(e),()=>{qc.delete(e)}}class q4{constructor(n,r,s,l=Z4,o=null){ga(this,"draftId");ga(this,"queued",null);ga(this,"timer",null);ga(this,"chain",Promise.resolve());ga(this,"saving",0);ga(this,"listening",!0);this.save=n,this.listener=s,this.delay=l,this.ownerId=o,this.draftId=r}get id(){return this.draftId}get busy(){return this.queued!==null||this.saving>0}get pending(){return this.queued!==null}schedule(n,r){this.queued={content:n,tag:r},il.add(this),this.clearTimer(),this.timer=setTimeout(()=>{this.timer=null,this.flush()},this.delay)}flush(){return this.clearTimer(),this.chain=this.chain.then(()=>this.drain()),this.chain}detach(){return this.listening=!1,this.flush()}cancel(){this.listening=!1,this.clearTimer(),this.queued=null,this.saving===0&&il.delete(this)}clearTimer(){this.timer!==null&&(clearTimeout(this.timer),this.timer=null)}async drain(){const n=this.queued;if(n){this.queued=null,this.saving+=1;try{const r={...n.content,id:this.draftId??void 0},s=await this.save(r);this.draftId=s.id,this.listening&&this.listener.onSaved(s,n.content,n.tag);for(const l of[...qc])l(s,this.ownerId)}catch(r){!this.queued&&this.listening&&(this.queued=n),this.listening&&this.listener.onError(r)}finally{this.saving-=1,this.busy||il.delete(this)}}}}function Q4(e){return[...e].sort((n,r)=>r.updatedAt-n.updatedAt)}function _f(e,n){const r=new Map(e.map(s=>[s.id,s]));for(const s of n.values()){const l=r.get(s.id);(!l||l.updatedAt<s.updatedAt)&&r.set(s.id,s)}return Q4([...r.values()])}const jc=new Map,Qc=new Map;function J4(e){if(li(e))return Promise.resolve();let n=jc.get(e);return n||(n=Y4(e,r=>xt(e).drafts.save(e,r)).then(r=>{r>0&&Qc.set(e,r)},()=>{jc.delete(e)}),jc.set(e,n)),n}function e6(e){const[n,r]=p.useState([]),[s,l]=p.useState(e?"loading":"idle"),[o,c]=p.useState(null),[f,h]=p.useState(0),g=p.useRef(0),x=p.useRef(new Map),m=e;p.useEffect(()=>{if(x.current=new Map,!!m)return X4((v,w)=>{w===m&&(x.current.set(v.id,v),r(N=>_f(N,new Map([[v.id,v]]))))})},[m]);const j=p.useCallback(v=>{x.current.delete(v),r(w=>w.filter(N=>N.id!==v))},[]),k=p.useCallback(()=>{const v=++g.current;if(!m){r([]),l("idle"),c(null);return}l(w=>w==="ready"?w:"loading"),J4(m).then(()=>{const w=Qc.get(m);return w&&v===g.current&&(Qc.delete(m),h(w)),xt(m).drafts.list(m)}).then(w=>{v===g.current&&(r(_f(w,x.current)),l("ready"),c(null))},w=>{v===g.current&&(l("error"),c(w instanceof Error&&w.message?i(w.message):i("暂时无法读取项目,请稍后重试")))})},[m]);return p.useEffect(()=>(k(),()=>{g.current+=1}),[k]),{status:s,projects:n,error:o,movedTemplates:f,reload:k,forget:j}}const t6={"markdown-card":"Markdown 卡片","freeform-slide":"自由编辑"},Jc="dingcard.sidebar-collapsed.v1";function n6(){try{return localStorage.getItem(Jc)==="1"}catch{return!1}}function r6(e){try{e?localStorage.setItem(Jc,"1"):localStorage.removeItem(Jc)}catch{}}function a6({route:e,user:n,ownerId:r,guestLeft:s,dataVersion:l,onMoveGuestWork:o,theme:c,onToggleTheme:f,onLogout:h,editorMeta:g,onProjectRemoved:x,onProjectRenamed:m}){const j=Ks(),k=ra(),v=e6(r),w=Y0(r),N=p.useMemo(()=>p4(w.assets,v.projects),[w.assets,v.projects]),[F,I]=p.useState(null),[M,z]=p.useState(null),[A,T]=p.useState(!1),[L,H]=p.useState(null),[P,U]=p.useState(!1),[K,D]=p.useState(!1),[re,q]=p.useState(!1),[te,be]=p.useState(!1),[ne,Be]=p.useState(!1),[le,De]=p.useState(n6),W=p.useRef(null),ae=p.useRef(null),Se=p.useMemo(()=>[...Ts("markdown-card"),...Ts("freeform-slide")],[]),ze={"markdown-card":Se.filter(ee=>ee.workspace==="markdown").length,"freeform-slide":Se.filter(ee=>ee.workspace==="freeform").length};p.useEffect(()=>{const ee=He=>{(He.metaKey||He.ctrlKey)&&He.key.toLowerCase()==="k"&&(He.preventDefault(),U(ct=>!ct))};return window.addEventListener("keydown",ee),()=>window.removeEventListener("keydown",ee)},[]),p.useEffect(()=>{if(!K&&!re)return;const ee=ct=>{var bt,gn;const $t=ct.target;(bt=W.current)!=null&&bt.contains($t)||D(!1),(gn=ae.current)!=null&&gn.contains($t)||q(!1)},He=ct=>{ct.key==="Escape"&&(D(!1),q(!1))};return document.addEventListener("pointerdown",ee),document.addEventListener("keydown",He),()=>{document.removeEventListener("pointerdown",ee),document.removeEventListener("keydown",He)}},[K,re]),p.useEffect(()=>Be(!1),[e]);const{reload:ue}=v,{reload:Ye}=w;p.useEffect(()=>{l!==0&&(ue(),Ye())},[l,Ye,ue]),p.useEffect(()=>{v.movedTemplates!==0&&H({title:j("你存过的 {n} 个模板已经放进「我的项目」",{n:v.movedTemplates}),detail:j("模板改由社区共建;想复用自己的作品,在项目卡片上选「复制一份」。"),tone:"info"})},[v.movedTemplates,j]);function Ue(){De(ee=>(r6(!ee),!ee)),D(!1),q(!1)}function Ot(ee,He,ct){const $t=g[ee];if(ct&&$t.draftId===ct){It(ht.editor(ee));return}if($t.unsaved){I({system:ee,path:He});return}It(He)}const Rt=(ee="rednote")=>Ot("markdown-card",ht.newProject("markdown-card",{platformId:ee})),oe=(ee=1080,He=1440)=>Ot("freeform-slide",ht.newProject("freeform-slide",{width:ee,height:He})),he=ee=>Ot(ee.mode,ht.openProject(ee.mode,ee.id),ee.id),Ae=ee=>{const He=$0(ee);Ot(He,ht.fromTemplate(He,ee.id))};async function Re(ee){if(!r)return;const He=ee.mode==="markdown-card"?{mode:ee.mode,title:j("{title} 副本",{title:ee.title}),document:ee.document}:{mode:ee.mode,title:j("{title} 副本",{title:ee.title}),document:ee.document};try{await xt(r).drafts.save(r,He),v.reload(),H({title:j("已复制「{title}」",{title:ee.title}),tone:"info"})}catch(ct){H({title:j("复制失败"),detail:vn(ct,j("暂时无法复制,请稍后重试")),tone:"error"})}}async function qe(ee,He){if(!r)return;const ct=ee.mode==="markdown-card"?{id:ee.id,mode:ee.mode,title:He,document:ee.document}:{id:ee.id,mode:ee.mode,title:He,document:ee.document};try{await xt(r).drafts.save(r,ct),m(ee.mode,ee.id,He),v.reload()}catch($t){H({title:j("重命名失败"),detail:vn($t,j("暂时无法重命名,请稍后重试")),tone:"error"})}}async function Me(ee){if(!r)return;let He;try{He=await ee.text()}catch{H({title:j("导入失败"),detail:j("文件读取失败,请重试"),tone:"error"});return}const ct=i0(He);if(!ct.ok){H({title:j("导入失败"),detail:j(ct.error),tone:"error"});return}try{const $t=r;let bt=await xt($t).drafts.save($t,ct.data);r&&r!==$t&&(bt=await xt(r).drafts.save(r,ct.data)),v.reload(),Ot(bt.mode,ht.openProject(bt.mode,bt.id),bt.id)}catch($t){H({title:j("导入失败"),detail:vn($t,j("暂时无法导入,请稍后重试")),tone:"error"})}}async function Mt(ee){if(z(null),!!r)try{await xt(r).drafts.remove(r,ee.id);const He=Qs(r);He.markdownDraftId===ee.id&&Fa(r,{markdownDraftId:null}),He.freeformDraftId===ee.id&&Fa(r,{freeformDraftId:null}),x(ee.mode,ee.id),v.forget(ee.id),v.reload(),H({title:zt.remote?j("已删除「{title}」,30 天内可在回收站恢复",{title:ee.title}):j("已删除「{title}」",{title:ee.title}),tone:"info"})}catch(He){H({title:j("删除失败"),detail:vn(He,j("暂时无法删除,请稍后重试")),tone:"error"})}}function Je(ee){r&&w.upload(ee).then(He=>{const ct=Z0(He);ct&&H(ct)})}function mt(ee,He){w.rename(ee,He).catch(ct=>{H({title:j("重命名失败"),detail:vn(ct,j("暂时无法重命名,请稍后重试")),tone:"error"})})}function Lt(ee){w.remove(ee).then(()=>H({title:j("已删除「{title}」",{title:ee.name}),tone:"info"}),He=>H({title:j("删除失败"),detail:vn(He,j("暂时无法删除,请稍后重试")),tone:"error"}))}const _t=[{id:"new-md",label:j("新建 Markdown 卡片"),hint:j("小红书"),icon:"markdown",run:()=>Rt()},{id:"new-ff",label:j("新建自由编辑"),hint:"3:4",icon:"freeform",run:()=>oe()},{id:"projects",label:j("打开我的项目"),icon:"projects",run:()=>It(ht.projects())},{id:"templates",label:j("打开模板中心"),icon:"templates",run:()=>It(ht.templates())},{id:"assets",label:j("打开素材库"),icon:"assets",run:()=>It(ht.assets)},{id:"theme",label:j(c==="dark"?"切换到浅色模式":"切换到深色模式"),icon:"theme",run:f},{id:"language",label:k==="zh"?"Switch to English":j("切换到中文"),icon:"language",run:()=>e0(k==="zh"?"en":"zh")}],lt=ee=>e.name===ee?"page":void 0,pt=["wb",ne?"is-side-open":"",le?"is-collapsed":""].filter(Boolean).join(" ");return t.jsxs("div",{className:pt,"data-testid":"workbench",children:[t.jsxs("aside",{className:"wb-side","aria-label":j("主导航"),children:[t.jsxs("div",{className:"wb-brand",children:[t.jsx("img",{src:vl,alt:"",width:"28",height:"28"}),t.jsx("span",{className:"wb-brand-name",children:j("叮卡")}),t.jsx("button",{className:"icon-btn wb-collapse",type:"button",onClick:Ue,"aria-label":j(le?"展开侧栏":"收起侧栏"),title:j(le?"展开侧栏":"收起侧栏"),"data-testid":"sidebar-toggle",children:t.jsx(yf,{})})]}),t.jsxs("div",{className:"wb-new",ref:W,children:[t.jsxs("button",{className:"accent wb-new-btn",type:"button","aria-haspopup":"menu","aria-expanded":K,"aria-label":le?j("新建项目"):void 0,title:le?j("新建项目"):void 0,onClick:()=>D(ee=>!ee),"data-testid":"new-project",children:[t.jsxs("span",{children:[t.jsx(fl,{}),t.jsx("span",{className:"wb-text",children:j("新建项目")})]}),t.jsx(hd,{className:"wb-text"})]}),K&&t.jsxs("div",{className:"menu wb-new-menu",role:"menu",children:[t.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{D(!1),Rt()},children:[t.jsx("span",{className:"sys-tile sys-tile-md",children:t.jsx(Us,{})}),t.jsxs("span",{children:[t.jsx("b",{children:j("Markdown 卡片")}),t.jsx("small",{children:j("写长文,自动分页成一组卡片")})]})]}),t.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{D(!1),oe()},children:[t.jsx("span",{className:"sys-tile sys-tile-ff",children:t.jsx(Ui,{})}),t.jsxs("span",{children:[t.jsx("b",{children:j("自由编辑")}),t.jsx("small",{children:j("像做海报一样自由排版")})]})]})]})]}),t.jsx("nav",{className:"wb-nav","aria-label":j("工作台导航"),children:[{name:"home",href:ht.home,icon:t.jsx(T2,{}),label:j("首页"),count:0},{name:"projects",href:ht.projects(),icon:t.jsx(y0,{}),label:j("我的项目"),count:v.projects.length},{name:"templates",href:ht.templates(),icon:t.jsx(Gi,{}),label:j("模板中心"),count:0},{name:"assets",href:ht.assets,icon:t.jsx(Gs,{}),label:j("素材库"),count:w.assets.length}].map(ee=>t.jsxs("a",{href:`#${ee.href}`,"aria-current":lt(ee.name),title:le?ee.label:void 0,children:[ee.icon,t.jsx("span",{className:"wb-text",children:ee.label}),ee.count>0&&t.jsx("span",{className:"count tnum",children:ee.count})]},ee.name))}),v.projects.length>0&&t.jsxs("div",{className:"wb-recent",children:[t.jsx("div",{className:"wb-label",children:j("最近打开")}),v.projects.slice(0,3).map(ee=>t.jsxs("button",{type:"button",className:"wb-recent-item",onClick:()=>he(ee),children:[t.jsx("span",{className:"wb-recent-thumb",children:t.jsx(Zn,{source:Cd(ee),width:22})}),t.jsx("span",{className:"wb-recent-title",children:ee.title})]},ee.id))]}),t.jsx("div",{className:"wb-foot",children:n?t.jsxs("div",{className:"wb-me",ref:ae,children:[re&&t.jsxs("div",{className:"menu wb-me-menu",role:"menu",children:[t.jsxs("div",{className:"wb-me-head",children:[t.jsx("b",{children:n.username}),t.jsx("span",{children:zt.remote?j("服务器账号 · 多设备同步"):j("本地账号 · 数据只存在这台设备")})]}),t.jsx("div",{className:"menu-sep",role:"separator"}),zt.remote&&r&&t.jsxs("button",{role:"menuitem",type:"button","data-testid":"workbench-tokens",onClick:()=>{q(!1),be(!0)},children:[t.jsx(hl,{}),j("API 令牌")," "]}),t.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{q(!1),h()},"data-testid":"workbench-logout",children:[t.jsx(Vc,{}),j("退出登录")]})]}),t.jsxs("button",{className:"wb-me-btn",type:"button","aria-haspopup":"menu","aria-expanded":re,"aria-label":j("账号菜单({name})",{name:n.username}),onClick:()=>q(ee=>!ee),children:[t.jsx("span",{className:"wb-avatar","aria-hidden":"true",children:n.username.slice(0,1)}),t.jsxs("span",{className:"wb-who wb-text",children:[t.jsx("b",{children:n.username}),t.jsx("span",{children:zt.remote?j("服务器账号"):j("本地账号")})]}),t.jsx(Nl,{className:"wb-text"})]})]}):t.jsx("div",{className:"wb-guest",children:t.jsx("button",{className:"accent",type:"button",onClick:()=>It(ht.login),"data-testid":"workbench-login",title:le?j("登录或注册"):void 0,children:le?t.jsx(Vc,{}):j("登录或注册")})})})]}),ne&&t.jsx("div",{className:"wb-scrim",onClick:()=>Be(!1),"aria-hidden":"true"}),t.jsxs("div",{className:"wb-main",children:[t.jsxs("header",{className:"wb-top","data-testid":"workbench-topbar",children:[t.jsx("button",{className:"icon-btn wb-menu-btn",type:"button","aria-label":j("打开导航"),onClick:()=>Be(!0),children:t.jsx(yf,{})}),t.jsxs("button",{className:"wb-search",type:"button",onClick:()=>U(!0),"data-testid":"open-palette",children:[t.jsx(Ma,{}),t.jsx("span",{children:j("搜索项目、模板和操作")}),t.jsx("kbd",{children:"⌘K"})]}),t.jsx("span",{className:"grow"}),t.jsx(Sd,{}),t.jsx("button",{className:"icon-btn wb-theme",type:"button","aria-label":j("切换深浅色"),title:j(c==="dark"?"切换到浅色模式":"切换到深色模式"),onClick:f,children:c==="dark"?t.jsx(p0,{}):t.jsx(fd,{})})]}),L&&t.jsx(Ml,{className:"operation-notice--workbench",title:L.title,detail:L.detail,tone:L.tone,onDismiss:()=>H(null)}),t.jsxs("div",{className:"wb-scroll",children:[e.name==="home"&&t.jsx(I4,{user:n,ownerId:r,projects:v,assets:w,onUploadAssets:Je,templateCounts:ze,onNewMarkdown:Rt,onNewFreeform:oe,onOpenProject:he,onUseTemplate:Ae,onDuplicate:Re,onRename:(ee,He)=>void qe(ee,He),onDelete:z}),e.name==="projects"&&t.jsx(L4,{ownerId:r,guestLeft:n?s:null,onMoveGuestWork:o,system:e.system,projects:v,onNewMarkdown:()=>Rt(),onNewFreeform:()=>oe(),onImport:ee=>void Me(ee),onOpenTrash:zt.remote&&r?()=>T(!0):void 0,onOpenProject:he,onDuplicate:Re,onRename:(ee,He)=>void qe(ee,He),onDelete:z}),e.name==="templates"&&t.jsx(H4,{system:e.system,onUseTemplate:Ae}),e.name==="assets"&&t.jsx(h4,{ownerId:r,assets:w,usage:N,onUpload:Je,onRename:mt,onDelete:Lt})]})]}),P&&t.jsx(N4,{projects:v.projects,templates:Se,actions:_t,onOpenProject:he,onUseTemplate:Ae,onClose:()=>U(!1)}),F&&t.jsx(mi,{title:j("{system}里还有没保存的修改",{system:j(t6[F.system])}),body:j("「{title}」最近的修改没能保存。继续的话,这些改动会被丢掉。",{title:g[F.system].title||j("未命名")}),confirmLabel:j("丢掉改动,继续"),cancelLabel:j("回去看看"),danger:!0,onCancel:()=>{const ee=F.system;I(null),It(ht.editor(ee))},onConfirm:()=>{const ee=F.path;I(null),It(ee)}}),M&&t.jsx(mi,{title:j("删除「{title}」?",{title:M.title}),body:zt.remote?j("删除后进入回收站:30 天内可以恢复,之后自动清除。"):j("删除后无法恢复。"),confirmLabel:j("删除"),danger:!0,onCancel:()=>z(null),onConfirm:()=>void Mt(M)}),A&&r&&zt.remote&&t.jsx(C4,{ownerId:r,onChanged:()=>v.reload(),onClose:()=>T(!1)}),te&&r&&t.jsx(B4,{ownerId:r,onClose:()=>be(!1)})]})}const Bf=/\((img:[a-z0-9]+)\)/gi;async function zs(e,n){const[r,s]=await Promise.all([e.drafts.list(n),e.assets.list(n).catch(()=>[])]);return{projects:r,assets:s}}function Kf(e){return e.projects.length+e.assets.length}function i6(e){return Math.max(0,...e.projects.map(n=>n.updatedAt),...e.assets.map(n=>n.createdAt))}async function s6(e,n,r){const{images:s={},...l}=e,o=new Set;for(const h of l.source.matchAll(Bf))o.add(h[1]);const c=new Map;for(const h of o){const g=s[h]??n.images.resolve(h);g&&g!==h&&c.set(h,await r.images.put(g))}const f=l.source.replace(Bf,(h,g)=>{const x=c.get(g);return x?`(${x})`:h});return{...l,source:f}}async function o6(e,n,r){if(e.mode==="freeform-slide")return{mode:"freeform-slide",title:e.title,document:e.document};const s=r.remote?await s6(e.document,n,r):e.document;return{mode:"markdown-card",title:e.title,document:s}}async function l6({from:e,fromId:n,to:r,toId:s,onProgress:l}){const o=await zs(e,n),c=[...o.projects].sort((j,k)=>j.updatedAt-k.updatedAt),f=[...o.assets].sort((j,k)=>j.createdAt-k.createdAt),h=c.length+f.length,g={moved:new Map,movedAssets:0,failed:0,error:null};let x=0;const m=j=>{g.failed+=1,g.error===null&&(g.error=j)};for(const j of c){try{const k=await r.drafts.save(s,await o6(j,e,r));g.moved.set(j.id,k),await e.drafts.remove(n,j.id)}catch(k){g.moved.has(j.id)||m(k)}l==null||l(++x,h)}for(const j of f){let k=!1;try{await r.assets.add(s,{dataUrl:j.src,name:j.name,width:j.width,height:j.height}),k=!0,g.movedAssets+=1,await e.assets.remove(n,j.id)}catch(v){k||m(v)}l==null||l(++x,h)}return g}function X0({ownerId:e,onInsert:n,onManage:r}){const s=Y0(e),[l,o]=p.useState(""),[c,f]=p.useState(null),[h,g]=p.useState(!1),x=p.useRef(0),m=p.useRef(null),j=l.trim().toLocaleLowerCase(),k=p.useMemo(()=>s.assets.filter(N=>!j||N.name.toLocaleLowerCase().includes(j)),[s.assets,j]);function v(N){!e||N.length===0||(f(null),s.upload(N).then(F=>{const I=Z0(F);f(I?{text:I.detail?i("{title}:{detail}",{title:I.title,detail:I.detail}):I.title,tone:I.tone}:null)}))}const w=N=>!!e&&Array.from(N.dataTransfer.types).includes("Files");return e?t.jsxs("div",{className:h?"asset-panel is-dragging":"asset-panel",onDragEnter:N=>{w(N)&&(N.preventDefault(),x.current+=1,g(!0))},onDragOver:N=>{w(N)&&(N.preventDefault(),N.dataTransfer.dropEffect="copy")},onDragLeave:N=>{w(N)&&(x.current=Math.max(0,x.current-1),x.current===0&&g(!1))},onDrop:N=>{w(N)&&(N.preventDefault(),x.current=0,g(!1),v(Array.from(N.dataTransfer.files)))},children:[t.jsxs("div",{className:"asset-drawer-tools",children:[t.jsxs("label",{className:"search-field",children:[t.jsx(Ma,{}),t.jsx("input",{type:"search",value:l,placeholder:i("搜索素材"),"aria-label":i("搜索素材"),onChange:N=>o(N.target.value)})]}),t.jsxs("button",{className:"ghost",type:"button",onClick:()=>{var N;return(N=m.current)==null?void 0:N.click()},"data-testid":"asset-drawer-upload",title:i("上传到素材库"),children:[t.jsx(gr,{}),i("上传")]}),t.jsx("input",{ref:m,type:"file",accept:vd,multiple:!0,hidden:!0,"data-testid":"asset-drawer-file-input",onChange:N=>{const F=Array.from(N.currentTarget.files??[]);N.currentTarget.value="",v(F)}})]}),c&&t.jsx("p",{className:`asset-drawer-message is-${c.tone}`,role:c.tone==="error"?"alert":"status",children:c.text}),t.jsx("div",{className:"asset-drawer-body",children:s.status==="error"?t.jsxs("div",{className:"asset-drawer-empty",children:[t.jsx("b",{children:i("素材库读取失败")}),t.jsx("span",{children:s.error}),t.jsx("button",{className:"ghost",type:"button",onClick:s.reload,children:i("重试")})]}):k.length>0||s.uploads.length>0?t.jsxs("div",{className:"asset-drawer-grid",children:[s.uploads.map(N=>t.jsx("div",{className:"asset-pick is-pending",role:"status","aria-label":i("正在上传 {name}",{name:N.name}),children:t.jsx("span",{className:"asset-spinner"})},N.id)),k.map(N=>t.jsxs("button",{className:"asset-pick",type:"button",title:N.name,"aria-label":i("插入 {name}",{name:N.name}),"data-testid":"asset-pick",onClick:()=>n(N),children:[t.jsx("img",{src:N.src,alt:"",loading:"lazy",decoding:"async",draggable:!1}),t.jsx("span",{className:"asset-pick-name",children:N.name})]},N.id))]}):s.status==="ready"&&(j?t.jsx("p",{className:"asset-drawer-empty",children:i("没有名称包含「{query}」的素材",{query:l.trim()})}):t.jsxs("div",{className:"asset-drawer-empty",children:[t.jsx("span",{className:"asset-drop-icon",children:t.jsx(gr,{})}),t.jsx("b",{children:i("素材库还是空的")}),t.jsx("span",{children:i("把图片拖到这里,或者点「上传」。存进来的图片,所有项目都能用。")})]}))}),t.jsxs("div",{className:"asset-drawer-foot",children:[t.jsx("button",{className:"link-btn",type:"button",onClick:r,children:i("管理素材库")}),t.jsx("span",{className:"tnum",children:i("{n} 张",{n:s.assets.length})})]}),h&&t.jsxs("div",{className:"asset-drawer-drop","aria-hidden":"true",children:[t.jsx(gr,{}),i("松开,存进素材库")]})]}):t.jsx("div",{className:"asset-panel",children:t.jsxs("div",{className:"asset-drawer-empty",role:"status",children:[t.jsx("span",{className:"asset-drop-icon",children:t.jsx(Gs,{})}),t.jsx("span",{children:i("正在读取素材库…")})]})})}function c6({ownerId:e,system:n,onInsert:r,onManage:s,onClose:l}){return t.jsxs("aside",{className:"asset-drawer","aria-label":i("素材库"),"data-testid":"asset-drawer",onKeyDown:o=>{o.key!=="Escape"||o.defaultPrevented||o.target instanceof HTMLInputElement&&o.target.value||(o.preventDefault(),l())},children:[t.jsxs("div",{className:"asset-drawer-head",children:[t.jsxs("div",{children:[t.jsx("h2",{children:i("素材库")}),t.jsx("p",{children:n==="markdown-card"?i("点一下,插入到光标所在的位置"):i("点一下,放到当前页的中央")})]}),t.jsx("button",{className:"icon-btn",type:"button","aria-label":i("关闭素材库"),onClick:l,children:t.jsx(Pn,{})})]}),t.jsx(X0,{ownerId:e,onInsert:r,onManage:s})]})}function Vf(e,n){return e instanceof Error&&e.message!==""?e.message:n}function d6({stock:e,onInsert:n}){var be;const[r,s]=p.useState(null),[l,o]=p.useState("loading"),[c,f]=p.useState(""),[h,g]=p.useState(""),[x,m]=p.useState(""),[j,k]=p.useState([]),[v,w]=p.useState(0),[N,F]=p.useState(1),[I,M]=p.useState(!1),[z,A]=p.useState(!1),[T,L]=p.useState(null),[H,P]=p.useState(null),U=p.useRef(0),K=p.useCallback(()=>{if(!e)return;o("loading");let ne=!1;return e.sources().then(Be=>{ne||(s(Be),f(le=>le!==""?le:Be.preferred),o("ready"))}).catch(()=>{ne||o("error")}),()=>{ne=!0}},[e]);p.useEffect(()=>K(),[K]);async function D(ne){if(!e||z)return;const Be=x.trim();if(Be==="")return;const le=++U.current;A(!0),P(null);try{const De=await e.search(Be,c,ne);if(le!==U.current)return;k(ne===1?De.results:[...j,...De.results]),g(De.source),w(De.total),F(De.page),M(!0)}catch(De){if(le!==U.current)return;P({text:Vf(De,i("图库搜索失败,请稍后重试")),tone:"error"})}finally{le===U.current&&A(!1)}}async function re(ne){if(!(!e||T!==null)){L(ne.id),P(null);try{const Be=await e.importImage(h,ne.id);n(Be.url,Be.alt,ne.width>0&&ne.height>0?{width:ne.width,height:ne.height}:void 0)}catch(Be){P({text:Vf(Be,i("图片导入失败,请稍后重试")),tone:"error"})}finally{L(null)}}}if(!e)return t.jsx("div",{className:"stock-panel","data-testid":"stock-panel",children:t.jsxs("div",{className:"stock-degraded",role:"status",children:[t.jsx("b",{children:i("在线图库需要服务端")}),t.jsx("span",{children:i("部署服务端并登录账户后,可以在这里搜索、插入可商用的在线图片;未配置密钥时自动使用 Openverse。")})]})});const q=(r==null?void 0:r.sources)??[],te=((be=q.find(ne=>ne.id===h))==null?void 0:be.label)??h;return t.jsxs("div",{className:"stock-panel","data-testid":"stock-panel",children:[t.jsxs("form",{className:"stock-search",onSubmit:ne=>{ne.preventDefault(),D(1)},children:[t.jsxs("label",{className:"search-field",children:[t.jsx(Ma,{}),t.jsx("input",{type:"search",value:x,placeholder:i("搜索在线图片"),"aria-label":i("搜索在线图片"),"data-testid":"stock-search-input",onChange:ne=>m(ne.target.value)})]}),t.jsx("button",{className:"accent",type:"submit",disabled:z||x.trim()==="","data-testid":"stock-search-submit",children:z?i("搜索中…"):i("搜索")})]}),q.length>1&&t.jsx("div",{className:"stock-sources",role:"group","aria-label":i("图库来源"),children:q.map(ne=>t.jsx("button",{type:"button",className:ne.id===c?"stock-source is-active":"stock-source","aria-pressed":ne.id===c,"data-testid":`stock-source-${ne.id}`,disabled:!ne.available,title:ne.available?ne.label:i("{label}:未配置密钥",{label:ne.label}),onClick:()=>f(ne.id),children:ne.label},ne.id))}),H&&t.jsx("p",{className:`asset-drawer-message is-${H.tone}`,role:H.tone==="error"?"alert":"status",children:H.text}),l==="error"?t.jsxs("div",{className:"stock-empty",children:[t.jsx("b",{children:i("图库暂不可用")}),t.jsx("button",{className:"ghost",type:"button",onClick:K,children:i("重试")})]}):j.length===0?I?t.jsx("p",{className:"stock-empty",children:i("没有找到「{query}」相关图片",{query:x.trim()})}):l==="loading"?t.jsx("p",{className:"stock-empty",role:"status",children:i("正在读取图库…")}):t.jsx("p",{className:"stock-empty",children:i("输入关键词,搜索可商用的在线图片。")}):t.jsx("div",{className:"stock-grid",children:j.map(ne=>t.jsxs("button",{className:"stock-hit",type:"button","data-testid":"stock-hit","aria-label":i("插入图库图片"),title:ne.author!==""?`${te} · ${ne.author}`:te,onClick:()=>void re(ne),children:[t.jsx("img",{src:ne.thumb,alt:"",loading:"lazy",decoding:"async",draggable:!1}),T===ne.id&&t.jsx("span",{className:"stock-hit-loading",role:"status","aria-label":i("正在导入"),children:t.jsx("span",{className:"asset-spinner"})})]},`${h}:${ne.id}`))}),j.length>0&&j.length<v&&t.jsx("button",{className:"ghost stock-more",type:"button",disabled:z,"data-testid":"stock-load-more",onClick:()=>void D(N+1),children:z?i("加载中…"):i("加载更多")})]})}const Gf=.75;function q0(e,n,r){return{jpeg:e,pixelWidth:r.width,pixelHeight:r.height,width:n.width*Gf,height:n.height*Gf}}function Vo(e){return String(Math.round(e*100)/100)}function Q0(e){if(e.length===0)throw new Error("PDF needs at least one page");const n=new TextEncoder,r=[],s=[];let l=0;const o=j=>{const k=typeof j=="string"?n.encode(j):j;r.push(k),l+=k.length},c=(j,k,v)=>{if(s[j]=l,o(`${j} 0 obj
|
|
485
|
+
`),typeof k=="string")o(k);else{const w=k.reduce((N,F)=>N+F.length,0);o(`<< ${v??""} /Length ${w} >>
|
|
480
486
|
stream
|
|
481
487
|
`),k.forEach(o),o(`
|
|
482
488
|
endstream`)}o(`
|
|
@@ -494,9 +500,9 @@ Q`)])});const h=l,g=3+e.length*3;o(`xref
|
|
|
494
500
|
startxref
|
|
495
501
|
${h}
|
|
496
502
|
%%EOF
|
|
497
|
-
`);const x=new Uint8Array(l);let m=0;for(const j of r)x.set(j,m),m+=j.length;return x}const
|
|
498
|
-
${Et.remote?i("只保存在这台设备上。登录后可以放进账号,换一台设备也能继续编辑。"):i("保存在这台设备的浏览器里。")}`,children:[t.jsx(pd,{}),t.jsx("span",{children:i("已保存到本机")})]}):t.jsxs("span",{className:"save-chip is-saved","data-testid":"editor-save-state",role:"status",title:i("已自动保存 · {time}",{time:Yf(e.at)}),children:[t.jsx(q2,{}),t.jsx("span",{children:i("已保存")})]});case"error":return t.jsxs("span",{className:"save-chip is-error","data-testid":"editor-save-state",role:"alert",title:e.message,children:[t.jsx(J2,{}),t.jsx("span",{children:i("保存失败")}),t.jsx("button",{type:"button",className:"save-retry","data-testid":"editor-save-retry",onClick:r,children:i("重试")})]})}}function m6({chrome:e,user:n,requestAuth:r}){const[s,l]=p.useState(!1),o=p.useRef(null);return qs(o,s,()=>l(!1)),n?t.jsxs("div",{className:"editor-account",ref:o,children:[t.jsx("button",{className:"editor-avatar-btn",type:"button","data-testid":"account-menu","aria-haspopup":"menu","aria-expanded":s,"aria-label":i("账号菜单({name})",{name:n.username}),title:n.username,onClick:()=>l(c=>!c),children:t.jsx("span",{className:"editor-avatar","aria-hidden":"true",children:n.username.slice(0,1)})}),s&&t.jsxs("div",{className:"menu editor-account-menu",role:"menu",children:[t.jsxs("div",{className:"editor-account-head",children:[t.jsx("b",{children:n.username}),t.jsx("span",{children:Et.remote?i("服务器账号 · 多设备同步"):i("本地账号 · 数据只存在这台设备")})]}),t.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{l(!1),e.onHome()},children:[t.jsx(Qi,{}),i("返回工作台")]}),t.jsx("div",{className:"menu-sep",role:"separator"}),t.jsxs("button",{role:"menuitem",type:"button","data-testid":"account-logout",onClick:()=>{l(!1),e.onLogout()},children:[t.jsx(Vc,{}),i("退出登录")]})]})]}):e.authStatus==="checking"?t.jsx("span",{className:"editor-account-status","data-testid":"account-status","aria-label":i("正在检查登录状态"),children:i("检查中")}):e.authStatus==="error"?t.jsx("button",{className:"editor-account-status is-retry",type:"button","data-testid":"account-status-retry",title:i("重新检查登录状态"),onClick:e.onRetryAuth,children:i("待确认")}):t.jsx("button",{className:"editor-login",type:"button","data-testid":"account-login",title:i("登录账户"),onClick:r,children:i("登录")})}function e0({chrome:e,user:n,requestAuth:r,system:s,title:l,onRename:o,save:c,onRetrySave:f,center:h,actions:g,primary:x}){return t.jsxs("header",{className:"editor-bar","data-testid":"app-header","data-system":s,children:[t.jsxs("div",{className:"editor-bar-start",children:[t.jsxs("button",{className:"editor-home",type:"button","data-testid":"editor-home","aria-label":i("返回工作台"),title:i("返回工作台"),onClick:e.onHome,children:[t.jsx(Qi,{className:"editor-home-chevron"}),t.jsx("img",{src:vl,alt:"",width:"22",height:"22"})]}),t.jsxs("div",{className:"editor-doc",children:[t.jsx(f6,{title:l,onRename:o}),t.jsx(h6,{save:c,onRequestAuth:r,onRetry:f})]})]}),t.jsx("div",{className:"editor-bar-center",children:h}),t.jsxs("div",{className:"editor-bar-end",children:[g,t.jsx(Sd,{className:"editor-lang"}),t.jsx("button",{className:"editor-icon-btn",type:"button","data-testid":"theme-toggle","aria-label":i("切换深浅色"),title:e.theme==="dark"?i("切换到浅色模式"):i("切换到深色模式"),onClick:e.onToggleTheme,children:e.theme==="dark"?t.jsx(pm,{}):t.jsx(fd,{})}),t.jsx(m6,{chrome:e,user:n,requestAuth:r}),x]})]})}function t0({testId:e,label:n,className:r,disabled:s=!1,children:l}){const o=p.useRef(null),c=["workspace-toolbar",r,s?"is-disabled":""].filter(Boolean).join(" ");return p.useEffect(()=>{const f=o.current;f&&(s?f.setAttribute("inert",""):f.removeAttribute("inert"))},[s]),t.jsx("div",{ref:o,className:c,"data-testid":e,role:"toolbar","aria-label":n,"aria-disabled":s||void 0,children:l})}function td({side:e="left",children:n}){return t.jsx("div",{className:`toolbar-group toolbar-group-${e}`,children:n})}function pl(){return t.jsx("span",{className:"toolbar-divider","aria-hidden":"true"})}const p6=5*60*1e3,g6=30*1e3;function n0(e){return[...new Set(e.map(n=>n.trim()).filter(Boolean))].sort()}function x6(e){return JSON.stringify(n0(e))}function b6(e){let n=[],r="[]",s=!1,l=()=>{},o=null,c=null,f=!1,h=0,g=0;const x=()=>s&&n.length>0,m=()=>{o!==null&&(e.clearTimeout(o),o=null)},j=T=>{try{l(T)}catch{}},k=()=>{!x()||o!==null||(o=e.setTimeout(()=>{o=null,v(!1)},g6))},v=async T=>{if(!x())return;const L=++g,H=h,P=[...n];try{await e.retain(P),L===g&&H===h&&m()}catch(U){if(L===g&&H===h&&x()&&(j(U),k()),T)throw U}},w=()=>{x()&&(m(),v(!1))},N=()=>w(),M=()=>{e.visibilityState()==="visible"&&w()},I=()=>{f&&(e.windowTarget.removeEventListener("online",N),e.documentTarget.removeEventListener("visibilitychange",M),f=!1)},F=()=>{m(),c!==null&&(e.clearInterval(c),c=null),I()},z=()=>{x()&&(f||(e.windowTarget.addEventListener("online",N),e.documentTarget.addEventListener("visibilitychange",M),f=!0),c=e.setInterval(w,p6),w())};return{update(T,L,H){l=H;const P=n0(T),U=JSON.stringify(P);s===L&&r===U||(h+=1,g+=1,F(),n=P,r=U,s=L,z())},retainNow:async()=>{x()&&(m(),await v(!0))},dispose(){h+=1,g+=1,F(),n=[],r="[]",s=!1,l=()=>{}}}}function r0(e,n,r){const s=p.useRef(null);s.current||(s.current=b6({retain:c=>Et.images.retain(c),windowTarget:window,documentTarget:document,visibilityState:()=>document.visibilityState,setTimeout:(c,f)=>window.setTimeout(c,f),clearTimeout:c=>window.clearTimeout(c),setInterval:(c,f)=>window.setInterval(c,f),clearInterval:c=>window.clearInterval(c)}));const l=s.current,o=x6(e);return p.useEffect(()=>{l.update(e,n,r)},[n,o,r,l,e]),p.useEffect(()=>()=>l.dispose(),[l]),p.useCallback(()=>l.retainNow(),[l])}function y6(e){return e instanceof Error&&e.message.trim()?i(e.message):i("暂时无法保存,请稍后重试")}function a0(e){const n=p.useRef(null),r=p.useRef(e);r.current=e;const[s,l]=p.useState("idle"),[o,c]=p.useState(null),f=p.useRef("idle"),h=p.useCallback(k=>{f.current!==k&&(f.current=k,l(k))},[]),g=p.useCallback((k,v,w,N)=>{let M=n.current;if(!M||M.ownerId!==k){M==null||M.saver.detach();const I=new U4(F=>xt(k).drafts.save(k,F),v,{onSaved:(F,z,A)=>{var T;((T=n.current)==null?void 0:T.saver)===I&&(r.current(F,z,A),c(null),h(I.pending?"saving":"saved"))},onError:F=>{var z;((z=n.current)==null?void 0:z.saver)===I&&(c(y6(F)),h("error"))}},void 0,k);M={saver:I,ownerId:k},n.current=M}M.saver.schedule(w,N),h("saving")},[h]),x=p.useCallback(()=>{const k=n.current;return k!=null&&k.saver.busy?(h("saving"),k.saver.flush()):Promise.resolve()},[h]),m=p.useCallback(()=>{var k;(k=n.current)==null||k.saver.detach(),n.current=null,h("idle"),c(null)},[h]),j=p.useCallback(()=>{var k;(k=n.current)==null||k.saver.cancel(),n.current=null,h("idle"),c(null)},[h]);return p.useEffect(()=>()=>{var k;(k=n.current)==null||k.saver.detach(),n.current=null},[]),{status:s,error:o,schedule:g,flush:x,release:m,discard:j}}function j6({template:e,detail:n=!1}){var h;const r=(h=e.createMarkdown)==null?void 0:h.call(e);if(!r)return null;const s=mr.find(g=>g.id===r.platformId)??mr[0],l=Ls(r.themeId),o=ll.find(g=>g.id===r.fontFamily)??ll[0],c=bl(s,l,o.id),f=Ay(r);return t.jsx("div",{className:n?"template-markdown-preview detail":"template-markdown-preview",style:kd(n?.622:.45,r.radius,c),children:t.jsx(yl,{html:f.html,config:c,profile:r.profile??Kn,pageIndex:0,pageCount:e.pageCount,pageRole:f.role,showHeader:!1,title:cd(r.source)})})}function w6(e,n,r){const{width:s,height:l}=Rn(e.format),o=Math.min(n/s,r/l);return{width:Math.round(s*o),height:Math.round(l*o)}}function i0({template:e,detail:n=!1,frame:r}){const s=p.useMemo(()=>{var c;return(c=e.createFreeform)==null?void 0:c.call(e)},[e]),l=s==null?void 0:s.slides[0];if(!l)return null;const o=r??w6(e,300,n?420:216);return t.jsx(Xs,{slide:l,frameWidth:o.width,frameHeight:o.height,className:n?"template-freeform-preview detail":"template-freeform-preview",artboardClassName:"template-freeform-artboard"})}function Zf({template:e,detail:n=!1}){return e.workspace==="markdown"?t.jsx(j6,{template:e,detail:n}):t.jsx(i0,{template:e,detail:n})}function Xf(e){return Array.from(e.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'))}function s0({open:e,workspace:n,hasCurrentContent:r,currentIsSaved:s,onClose:l,onApply:o,onInsert:c,onApplyLook:f}){var Ee;const h=p.useRef(null),g=p.useRef(null),x=p.useRef(null),m=p.useRef(null),j=p.useRef(l),k=wd(n),v=Ws.filter(ue=>k.some(Ye=>Ye.format===ue.id)),w=Fd(k),[N,M]=p.useState(null),[I,F]=p.useState(null),[z,A]=p.useState(""),[T,L]=p.useState(!1),[H,P]=p.useState(()=>Km()),U=p.useRef(""),K=p.useMemo(()=>new Set(H),[H]),D=p.useMemo(()=>ai(k,{text:z,use:I,format:N,only:T?K:null}),[k,z,I,N,T,K]),[re,q]=p.useState(((Ee=D[0])==null?void 0:Ee.id)??""),[te,be]=p.useState(null),ne=D.find(ue=>ue.id===re)??D[0];U.current=z,m.current=te,j.current=l,p.useEffect(()=>{if(!e)return;g.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const ue=requestAnimationFrame(()=>{const Ue=h.current&&Xf(h.current)[0];Ue==null||Ue.focus()}),Ye=Ue=>{if(Ue.key==="Escape"){if(Ue.preventDefault(),U.current&&Ue.target instanceof HTMLElement&&Ue.target.closest(".template-search")){A("");return}m.current?De():j.current();return}if(Ue.key!=="Tab"||!h.current)return;const Ot=m.current?h.current.querySelector(".template-confirm")??h.current:h.current,zt=Xf(Ot);if(zt.length===0)return;const oe=zt[0],fe=zt[zt.length-1];Ue.shiftKey&&document.activeElement===oe?(Ue.preventDefault(),fe.focus()):!Ue.shiftKey&&document.activeElement===fe&&(Ue.preventDefault(),oe.focus())};return window.addEventListener("keydown",Ye,!0),()=>{var Ue;cancelAnimationFrame(ue),window.removeEventListener("keydown",Ye,!0),(Ue=g.current)==null||Ue.focus()}},[e]),p.useEffect(()=>{if(!e||!te)return;const ue=requestAnimationFrame(()=>{var Ye,Ue;(Ue=(Ye=h.current)==null?void 0:Ye.querySelector(".template-confirm-actions button"))==null||Ue.focus()});return()=>cancelAnimationFrame(ue)},[e,te]),p.useEffect(()=>{var ue;M(null),F(null),A(""),q(((ue=k[0])==null?void 0:ue.id)??""),x.current=null,be(null)},[n]),p.useEffect(()=>{var ue;D.some(Ye=>Ye.id===re)||q(((ue=D[0])==null?void 0:ue.id)??"")},[D,re]);function Be(ue){M(ue)}if(!e)return null;function le(ue){r?(x.current=document.activeElement instanceof HTMLElement?document.activeElement:null,be(ue)):o(ue)}function De(){const ue=x.current;x.current=null,be(null),requestAnimationFrame(()=>ue==null?void 0:ue.focus())}function W(ue){ue.key==="Enter"&&ue.target===ue.currentTarget&&le(ne)}function ae(ue){P(Ye=>{const Ue=Gm(Ye,ue);return Vm(Ue),Ue})}function ke(ue){const Ye=K.has(ue.id);return t.jsxs("article",{className:ue.id===(ne==null?void 0:ne.id)?"template-tile selected":"template-tile",children:[t.jsx("button",{className:Ye?"template-tile-favorite on":"template-tile-favorite",type:"button","aria-pressed":Ye,"aria-label":Ye?i("取消收藏{title}",{title:i(ue.title)}):i("收藏{title}",{title:i(ue.title)}),"data-testid":`template-favorite-${ue.id}`,onClick:Ue=>{Ue.stopPropagation(),ae(ue.id)},children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M10 17s-6.3-3.9-8.2-7.2C.5 7.4 2 4 5.2 4c2 0 3.4 1.1 4.8 2.9C11.4 5.1 12.8 4 14.8 4 18 4 19.5 7.4 18.2 9.8 16.3 13.1 10 17 10 17Z"})})}),t.jsx("button",{className:"template-tile-preview",type:"button","aria-label":i("预览{title}",{title:i(ue.title)}),"aria-pressed":ue.id===(ne==null?void 0:ne.id),onClick:()=>q(ue.id),children:t.jsx(Zf,{template:ue})}),t.jsxs("div",{className:"template-tile-copy",children:[t.jsxs("div",{children:[t.jsx("h3",{children:i(ue.title)}),t.jsx("p",{children:i(ue.description)})]}),t.jsx("span",{className:"template-page-count",children:ue.kind==="poster"?i(Rn(ue.format).ratio):i("{n} 页",{n:ue.pageCount})})]}),t.jsx("div",{className:"template-tags",children:ue.tags.map(Ue=>t.jsx("span",{children:i(Ue)},Ue))})]},ue.id)}return t.jsx("div",{className:"template-backdrop",onMouseDown:ue=>{ue.target===ue.currentTarget&&(ue.preventDefault(),m.current?De():l())},children:t.jsxs("div",{ref:h,className:"template-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"template-gallery-title",tabIndex:-1,onKeyDown:W,children:[t.jsxs("header",{className:"template-dialog-head",children:[t.jsxs("div",{children:[t.jsx("p",{className:"template-kicker",children:"DINGCARD / TEMPLATE LIBRARY"}),t.jsx("h2",{id:"template-gallery-title",children:i("从一套成品开始")}),t.jsx("p",{className:"template-dialog-subtitle",children:i("样式和内容都可以继续改,先选一套接近你想法的。")})]}),t.jsx("button",{className:"template-close",type:"button","aria-label":i("关闭模板中心"),title:i("关闭"),onClick:l,children:t.jsx(Pn,{})})]}),t.jsxs("div",{className:"template-dialog-body",children:[t.jsxs("section",{className:"template-list","aria-label":i("模板列表"),children:[t.jsx("input",{className:"template-search",type:"search","data-testid":"template-search","aria-label":i("搜索模板"),placeholder:i("搜索模板,比如:菜单、中秋、读书笔记"),value:z,onChange:ue=>A(ue.target.value)}),w.length>1&&t.jsxs("div",{className:"template-formats template-uses",role:"group","aria-label":i("按用途筛选"),children:[t.jsx("button",{type:"button","aria-pressed":I===null,onClick:()=>F(null),children:i("全部")}),w.map(ue=>t.jsx("button",{type:"button","aria-pressed":I===ue,"data-testid":`template-gallery-use-${ue}`,onClick:()=>F(I===ue?null:ue),children:i(Xi(ue))},ue))]}),v.length>1&&t.jsxs("div",{className:"template-formats",role:"group","aria-label":i("按尺寸筛选"),children:[t.jsx("button",{type:"button","aria-pressed":N===null,onClick:()=>Be(null),children:i("全部尺寸")}),v.map(ue=>t.jsx("button",{type:"button","aria-pressed":N===ue.id,"data-testid":`template-format-${ue.id}`,onClick:()=>Be(ue.id),children:i(ue.name)},ue.id)),t.jsx("button",{type:"button","aria-pressed":T,"data-testid":"template-filter-favorites",onClick:()=>L(ue=>!ue),children:i("收藏")})]}),D.map(ke),D.length===0&&t.jsx("p",{className:"template-search-empty","data-testid":"template-search-empty",children:i("没有找到相关模板,换个关键词或尺寸试试。")})]}),ne&&t.jsxs("aside",{className:"template-detail","aria-label":i("模板详情"),children:[t.jsx("div",{className:"template-detail-preview",children:t.jsx(Zf,{template:ne,detail:!0})}),t.jsxs("div",{className:"template-detail-copy",children:[t.jsx("span",{className:"template-detail-series",children:i(ne.title)}),t.jsx("h3",{children:ne.workspace==="markdown"?i("Markdown 长文排版"):ne.kind==="poster"?i("{name} · {width}×{height}",{name:i(Rn(ne.format).name),width:Rn(ne.format).width,height:Rn(ne.format).height}):i("自由画布轻设计")}),t.jsx("p",{children:i(ne.description)}),t.jsx("p",{className:"template-detail-note",children:ne.workspace==="markdown"?i("{n} 页示例已经排好,正文、主题和字体都可以改。",{n:ne.pageCount}):ne.kind==="poster"?i("文字、图片、颜色和图层都可以改。"):i("{n} 页作品已经排好,文字、颜色、尺寸和图层都可以改。",{n:ne.pageCount})}),t.jsx("button",{className:"template-use",type:"button",onClick:()=>le(ne),children:i("使用这套模板")}),f&&ne.workspace==="markdown"&&t.jsx("button",{className:"template-add",type:"button","data-testid":"template-apply-look",onClick:()=>f(ne),children:i("只换样式")}),c&&ne.workspace==="freeform"&&t.jsx("button",{className:"template-add",type:"button","data-testid":"template-add-to-work",onClick:()=>c(ne),children:i("加到当前作品")})]})]})]}),te&&t.jsx("div",{className:"template-confirm-backdrop",role:"presentation",onMouseDown:ue=>{ue.target===ue.currentTarget&&(ue.preventDefault(),De())},children:t.jsxs("div",{className:"template-confirm",role:"alertdialog","aria-modal":"true","aria-labelledby":"template-confirm-title",children:[t.jsx("p",{className:"template-kicker",children:s?i("当前项目已自动保存"):i("当前内容还没有保存")}),t.jsx("h3",{id:"template-confirm-title",children:i("用这套模板新建项目?")}),t.jsx("p",{children:s?i("模板会作为一个新项目打开,当前项目留在「我的项目」里。"):i("最近的修改还没保存,打开模板后就找不回来了。")}),t.jsxs("div",{className:"template-confirm-actions",children:[t.jsx("button",{className:"template-cancel",type:"button",onClick:De,children:i("继续编辑")}),t.jsx("button",{className:"template-use",type:"button",onClick:()=>{x.current=null,o(te),be(null)},children:i("用模板新建")})]})]})})]})})}function k6(e,n){const r=e.style.justifyContent;r&&(e.style.justifyContent="flex-start");const s=n?e.scrollWidth:e.scrollHeight;return r&&(e.style.justifyContent=r),s}function S6(e,n){const r=[];return D1(e,(s,l)=>{if(s.type!=="text")return;const o=s.vertical===!0,c=n(s.id,o);if(c===null||!Number.isFinite(c)||c<=0)return;const f=Math.ceil(c);o?f>s.width&&r.push({path:l,size:f,dimension:"width"}):f>s.height&&r.push({path:l,size:f,dimension:"height"})}),r}function qf(e,n){return n.height>0&&Math.abs(e.width/e.height-n.width/n.height)<.01}function v6({templates:e,pageSize:n,room:r,onInsert:s}){const l=p.useRef(null),[o,c]=p.useState(null),[f,h]=p.useState(null),[g,x]=p.useState(""),[m,j]=p.useState(null),k=e.find(F=>F.id===o),v=p.useMemo(()=>Fd(e),[e]),w=g.trim()!==""||m!==null,N=p.useMemo(()=>w?ai(e,{text:g,use:m}):[],[e,g,m,w]),[M]=p.useState(()=>[...Ws].sort((F,z)=>Number(qf(z,n))-Number(qf(F,n))));if(p.useEffect(()=>{var F,z;o||!f||((z=(F=l.current)==null?void 0:F.querySelector(`[data-testid="freeform-template-tile-${CSS.escape(f)}"]`))==null||z.focus(),h(null))},[o,f]),k)return t.jsx(N6,{template:k,room:r,onInsert:s,onBack:()=>{h(k.id),c(null)}});const I=F=>{const z=Rn(F.format),A=F.kind==="poster",T=z.width>z.height*1.2;return t.jsxs("button",{type:"button",className:`freeform-template-tile${T?" is-wide":""}`,"data-testid":`freeform-template-tile-${F.id}`,"aria-label":i(A?"加入{title}":"打开{title}",{title:i(F.title)}),disabled:A&&r<1,onClick:()=>A?s(F,[0]):c(F.id),children:[t.jsx(Zi,{className:"freeform-template-thumb",style:{aspectRatio:`${z.width} / ${z.height}`},children:L=>t.jsx(i0,{template:F,frame:{width:L,height:Math.round(L*z.height/z.width)}})}),t.jsx("span",{className:"freeform-template-tile-title",children:i(F.title)}),t.jsx("span",{className:"freeform-template-tile-meta",children:A?i(z.ratio):i("{n} 页",{n:F.pageCount})})]},F.id)};return t.jsxs("div",{className:"freeform-template-list",ref:l,children:[t.jsxs("label",{className:"search-field freeform-template-search",children:[t.jsx(Ma,{}),t.jsx("input",{type:"search","data-testid":"freeform-template-search","aria-label":i("搜索模板"),placeholder:i("搜索模板"),value:g,onChange:F=>x(F.target.value),onKeyDown:F=>{F.key!=="Escape"||!g||(F.preventDefault(),F.stopPropagation(),x(""))}}),g&&t.jsx("button",{className:"tpl-search-clear",type:"button","aria-label":i("清空搜索"),onClick:()=>x(""),children:t.jsx(Pn,{})})]}),v.length>1&&t.jsx("div",{className:"freeform-template-uses",role:"group","aria-label":i("按用途筛选"),children:v.map(F=>t.jsx("button",{type:"button","aria-pressed":m===F,"data-testid":`freeform-template-use-${F}`,onClick:()=>j(m===F?null:F),children:i(Xi(F))},F))}),w&&(N.length>0?t.jsx("div",{className:"freeform-template-tiles",children:N.map(I)}):t.jsx("p",{className:"freeform-template-empty","data-testid":"freeform-template-empty",children:i("没有找到相关模板")})),!w&&M.map(F=>{const z=e.filter(A=>A.format===F.id);return z.length===0?null:t.jsxs(p.Fragment,{children:[t.jsx("div",{className:"freeform-drawer-section",children:i(F.name)}),t.jsx("div",{className:"freeform-template-tiles",children:z.map(I)})]},F.id)})]})}function N6({template:e,room:n,onInsert:r,onBack:s}){const l=p.useRef(null),o=p.useMemo(()=>{var f;return((f=e.createFreeform)==null?void 0:f.call(e).slides)??[]},[e]),c=Rn(e.format);return p.useEffect(()=>{var f;(f=l.current)==null||f.focus()},[]),t.jsxs("div",{className:"freeform-template-pages","data-testid":"freeform-template-pages",onKeyDown:f=>{f.key!=="Escape"||f.defaultPrevented||(f.preventDefault(),s())},children:[t.jsxs("div",{className:"freeform-template-pages-head",children:[t.jsx("button",{ref:l,className:"icon-btn",type:"button","aria-label":i("返回模板列表"),"data-testid":"freeform-template-back",onClick:s,children:t.jsx(Qi,{})}),t.jsx("h3",{children:i(e.title)})]}),t.jsx("button",{className:"accent freeform-drawer-upload",type:"button","data-testid":"freeform-template-add-all",disabled:n<o.length,onClick:()=>r(e,o.map((f,h)=>h)),children:i("加入全部 {n} 页",{n:o.length})}),t.jsx("div",{className:"freeform-template-tiles",children:o.map((f,h)=>t.jsxs("button",{type:"button",className:"freeform-template-tile","data-testid":`freeform-template-page-${h+1}`,"aria-label":i("加入第 {n} 页",{n:h+1}),disabled:n<1,onClick:()=>r(e,[h]),children:[t.jsx(Zi,{className:"freeform-template-thumb",style:{aspectRatio:`${c.width} / ${c.height}`},children:g=>t.jsx(Xs,{slide:f,frameWidth:g,frameHeight:Math.round(g*c.height/c.width),className:"template-freeform-preview",artboardClassName:"template-freeform-artboard"})}),t.jsx("span",{className:"freeform-template-tile-title",children:f.name})]},f.id))})]})}const Qf=[12,14,16,18,20,24,28,32,36,40,48,56,64,72,80,96,112,128,144,160,200,240];function nd(e,n){return n>0?Qf.find(r=>r>e)??Math.round(e*1.25):[...Qf].reverse().find(r=>r<e)??Math.max(1,Math.round(e*.8))}const M6={x:0,y:0,width:24,height:24},F6=2,Hs=[{id:"check",zh:"对勾",en:"Check",keywords:"勾 正确 完成 done tick",d:"M20 6 9 17l-5-5"},{id:"x",zh:"叉",en:"Cross",keywords:"错误 关闭 close wrong",d:"M18 6 6 18M6 6l12 12"},{id:"plus",zh:"加号",en:"Plus",keywords:"添加 add",d:"M5 12h14M12 5v14"},{id:"minus",zh:"减号",en:"Minus",keywords:"remove",d:"M5 12h14"},{id:"circle-check",zh:"圆圈对勾",en:"Check circle",keywords:"完成 正确 success",d:"M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0ZM16 9l-5.5 5.5L8 12"},{id:"circle-x",zh:"圆圈叉",en:"Cross circle",keywords:"错误 失败 error",d:"M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0ZM15 9l-6 6M9 9l6 6"},{id:"circle-alert",zh:"提醒",en:"Alert",keywords:"注意 警告 感叹号 warning",d:"M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0ZM12 8L12 12M12 16L12.01 16"},{id:"triangle-alert",zh:"警告",en:"Warning",keywords:"注意 危险 caution",d:"M21.73 18l-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3M12 9v4M12 17h.01"},{id:"info",zh:"信息",en:"Info",keywords:"说明 提示",d:"M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0ZM12 16v-4M12 8h.01"},{id:"circle-question-mark",zh:"问号",en:"Question",keywords:"疑问 帮助 help",d:"M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0ZM9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3M12 17h.01"},{id:"arrow-right",zh:"右箭头",en:"Arrow right",keywords:"向右 下一步 next",d:"M5 12h14M12 5l7 7-7 7"},{id:"arrow-left",zh:"左箭头",en:"Arrow left",keywords:"向左 返回 back",d:"M12 19l-7-7 7-7M19 12H5"},{id:"arrow-up",zh:"上箭头",en:"Arrow up",keywords:"向上 增长",d:"M5 12l7-7 7 7M12 19V5"},{id:"arrow-down",zh:"下箭头",en:"Arrow down",keywords:"向下 下降",d:"M12 5v14M19 12l-7 7-7-7"},{id:"arrow-up-right",zh:"右上箭头",en:"Arrow up right",keywords:"外链 增长 trend",d:"M7 7h10v10M7 17 17 7"},{id:"chevron-right",zh:"右尖角",en:"Chevron right",keywords:"更多 next",d:"M9 18l6-6-6-6"},{id:"chevron-down",zh:"下尖角",en:"Chevron down",keywords:"展开 more",d:"M6 9l6 6 6-6"},{id:"refresh-cw",zh:"循环",en:"Refresh",keywords:"刷新 重复 loop",d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8M21 3v5h-5M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16M8 16H3v5"},{id:"star",zh:"星星",en:"Star",keywords:"收藏 评分 favorite",d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"},{id:"heart",zh:"爱心",en:"Heart",keywords:"喜欢 心 love like",d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"},{id:"thumbs-up",zh:"点赞",en:"Thumbs up",keywords:"赞 好评 like",d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88ZM7 10v12"},{id:"flame",zh:"火焰",en:"Flame",keywords:"热门 火 hot fire",d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4"},{id:"zap",zh:"闪电",en:"Lightning",keywords:"能量 快 flash",d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z"},{id:"lightbulb",zh:"灯泡",en:"Light bulb",keywords:"想法 灵感 idea tip",d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5M9 18h6M10 22h4"},{id:"sparkles",zh:"闪光",en:"Sparkles",keywords:"亮点 新 magic new",d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594zM20 2v4M22 4h-4M2 20a2 2 0 1 0 4 0a2 2 0 1 0 -4 0Z"},{id:"crown",zh:"皇冠",en:"Crown",keywords:"第一 会员 vip",d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294zM5 21h14"},{id:"trophy",zh:"奖杯",en:"Trophy",keywords:"冠军 获奖 win",d:"M10 14.66V17a1 1 0 0 1-1 1 2 2 0 0 0-2 2v2M14 14.66V17a1 1 0 0 0 1 1 2 2 0 0 1 2 2v2M17.916 10H19.5A2.5 2.5 0 0 0 22 7.5V5a1 1 0 0 0-1-1h-3M4 22h16M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1zM6.084 10H4.5A2.5 2.5 0 0 1 2 7.5V5a1 1 0 0 1 1-1h3"},{id:"award",zh:"奖章",en:"Award",keywords:"认证 荣誉 badge",d:"M15.477 12.89l1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526M6 8a6 6 0 1 0 12 0a6 6 0 1 0 -12 0Z"},{id:"target",zh:"目标",en:"Target",keywords:"靶心 定位 goal",d:"M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0ZM6 12a6 6 0 1 0 12 0a6 6 0 1 0 -12 0ZM10 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0Z"},{id:"rocket",zh:"火箭",en:"Rocket",keywords:"启动 增长 launch",d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2zM9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05"},{id:"gem",zh:"钻石",en:"Gem",keywords:"宝石 精选 premium",d:"M10.5 3 8 9l4 13 4-13-2.5-6M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3zM2 9h20"},{id:"sun",zh:"太阳",en:"Sun",keywords:"晴天 白天 day",d:"M8 12a4 4 0 1 0 8 0a4 4 0 1 0 -8 0ZM12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"},{id:"moon",zh:"月亮",en:"Moon",keywords:"夜晚 晚安 night",d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"},{id:"cloud",zh:"云",en:"Cloud",keywords:"天气 云端 weather",d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"},{id:"umbrella",zh:"雨伞",en:"Umbrella",keywords:"下雨 保护 rain",d:"M12 13v7a2 2 0 0 0 4 0M12 2v2M20.992 13a1 1 0 0 0 .97-1.274 10.284 10.284 0 0 0-19.923 0A1 1 0 0 0 3 13z"},{id:"leaf",zh:"叶子",en:"Leaf",keywords:"自然 环保 nature eco",d:"M11 20a10 10 0 0010-10 25.9 25.9 0 00-1.04-7.281 1 1 0 00-1.755-.325C15.833 5.5 13 5.5 9.8 6.1A7 7 0 0011 20M2 21a5 5 0 012.911-4.544C7.613 15.212 8.351 15.24 11 13"},{id:"flower-2",zh:"花",en:"Flower",keywords:"花朵 春天 spring",d:"M12 5a3 3 0 1 1 3 3m-3-3a3 3 0 1 0-3 3m3-3v1M9 8a3 3 0 1 0 3 3M9 8h1m5 0a3 3 0 1 1-3 3m3-3h-1m-2 3v-1M10 8a2 2 0 1 0 4 0a2 2 0 1 0 -4 0ZM12 10v12M12 22c4.2 0 7-1.667 7-5-4.2 0-7 1.667-7 5ZM12 22c-4.2 0-7-1.667-7-5 4.2 0 7 1.667 7 5Z"},{id:"tree-pine",zh:"树",en:"Tree",keywords:"松树 森林 forest",d:"M17 14l3 3.3a1 1 0 0 1-.7 1.7H4.7a1 1 0 0 1-.7-1.7L7 14h-.3a1 1 0 0 1-.7-1.7L9 9h-.2A1 1 0 0 1 8 7.3L12 3l4 4.3a1 1 0 0 1-.8 1.7H15l3 3.3a1 1 0 0 1-.7 1.7H17ZM12 22v-3"},{id:"snowflake",zh:"雪花",en:"Snowflake",keywords:"冬天 冷 winter",d:"M10 20l-1.25-2.5L6 18M10 4 8.75 6.5 6 6M14 20l1.25-2.5L18 18M14 4l1.25 2.5L18 6M17 21l-3-6h-4M17 3l-3 6 1.5 3M2 12h6.5L10 9M20 10l-1.5 2 1.5 2M22 12h-6.5L14 15M4 10l1.5 2L4 14M7 21l3-6-1.5-3M7 3l3 6h4"},{id:"droplet",zh:"水滴",en:"Drop",keywords:"水 液体 water",d:"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z"},{id:"coffee",zh:"咖啡",en:"Coffee",keywords:"饮品 休息 drink",d:"M10 2v2M14 2v2M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1M6 2v2"},{id:"utensils",zh:"餐具",en:"Utensils",keywords:"吃饭 美食 餐厅 food",d:"M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2M7 2v20M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7"},{id:"cake",zh:"蛋糕",en:"Cake",keywords:"生日 甜点 birthday",d:"M20 21v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8M4 16s.5-1 2-1 2.5 2 4 2 2.5-2 4-2 2.5 2 4 2 2-1 2-1M2 21h20M7 8v3M12 8v3M17 8v3M7 4h.01M12 4h.01M17 4h.01"},{id:"gift",zh:"礼物",en:"Gift",keywords:"礼品 福利 present",d:"M12 7v14M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5M4 7h16a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1Z"},{id:"shopping-bag",zh:"购物袋",en:"Shopping bag",keywords:"购物 买 shop",d:"M16 10a4 4 0 0 1-8 0M3.103 6.034h17.794M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z"},{id:"shopping-cart",zh:"购物车",en:"Cart",keywords:"购物 下单 shop",d:"M2.05 2.05l1.099-.028a1 1 0 0 1 1.008.815l2.69 14.347A1 1 0 0 0 7.83 18H18M4.563 5h16.435a1 1 0 0 1 .981 1.204l-1.026 6.226A2 2 0 0 1 18.962 14H6.25M16 20a2 2 0 1 0 4 0a2 2 0 1 0 -4 0ZM6 20a2 2 0 1 0 4 0a2 2 0 1 0 -4 0Z"},{id:"tag",zh:"标签",en:"Tag",keywords:"价格 分类 price label",d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42zM7 7.5a0.5 0.5 0 1 0 1 0a0.5 0.5 0 1 0 -1 0Z"},{id:"bookmark",zh:"书签",en:"Bookmark",keywords:"收藏 保存 save",d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z"},{id:"flag",zh:"旗帜",en:"Flag",keywords:"目标 里程碑 milestone",d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528"},{id:"map-pin",zh:"定位",en:"Location",keywords:"地点 地图 位置 place",d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0M9 10a3 3 0 1 0 6 0a3 3 0 1 0 -6 0Z"},{id:"globe",zh:"地球",en:"Globe",keywords:"世界 国际 网络 world web",d:"M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0ZM12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20M2 12h20"},{id:"house",zh:"房子",en:"Home",keywords:"家 首页 house",d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"},{id:"building",zh:"大楼",en:"Building",keywords:"公司 办公 office",d:"M12 10h.01M12 14h.01M12 6h.01M16 10h.01M16 14h.01M16 6h.01M8 10h.01M8 14h.01M8 6h.01M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3M6 2h12a2 2 0 0 1 2 2v16a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-16a2 2 0 0 1 2 -2Z"},{id:"calendar",zh:"日历",en:"Calendar",keywords:"日期 日程 date",d:"M8 2v3M16 2v3M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2ZM3 9h18"},{id:"clock",zh:"时钟",en:"Clock",keywords:"时间 time",d:"M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0ZM12 6v6l4 2"},{id:"timer",zh:"计时",en:"Timer",keywords:"倒计时 秒表 countdown",d:"M10 2L14 2M12 14L15 11M4 14a8 8 0 1 0 16 0a8 8 0 1 0 -16 0Z"},{id:"bell",zh:"铃铛",en:"Bell",keywords:"通知 提醒 notification",d:"M10.268 21a2 2 0 0 0 3.464 0M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"},{id:"mail",zh:"邮件",en:"Mail",keywords:"信封 email",d:"M22 7l-8.991 5.727a2 2 0 0 1-2.009 0L2 7M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-16a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2Z"},{id:"phone",zh:"电话",en:"Phone",keywords:"联系 call",d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"},{id:"message-circle",zh:"对话",en:"Chat",keywords:"消息 评论 聊天 comment",d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"},{id:"quote",zh:"引号",en:"Quote",keywords:"引用 名言",d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2zM5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"},{id:"camera",zh:"相机",en:"Camera",keywords:"拍照 摄影 photo",d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4zM9 13a3 3 0 1 0 6 0a3 3 0 1 0 -6 0Z"},{id:"image",zh:"图片",en:"Image",keywords:"照片 picture",d:"M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2ZM7 9a2 2 0 1 0 4 0a2 2 0 1 0 -4 0ZM21 15l-3.086-3.086a2 2 0 0 0-2.828 0L6 21"},{id:"music",zh:"音乐",en:"Music",keywords:"音符 歌 song",d:"M9 18V5l12-2v13M3 18a3 3 0 1 0 6 0a3 3 0 1 0 -6 0ZM15 16a3 3 0 1 0 6 0a3 3 0 1 0 -6 0Z"},{id:"video",zh:"视频",en:"Video",keywords:"录像 影片 film",d:"M16 13l5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5M4 6h10a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-8a2 2 0 0 1 2 -2Z"},{id:"play",zh:"播放",en:"Play",keywords:"开始 start",d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"},{id:"pause",zh:"暂停",en:"Pause",keywords:"停止",d:"M15 3h3a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-3a1 1 0 0 1 -1 -1v-16a1 1 0 0 1 1 -1ZM6 3h3a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-3a1 1 0 0 1 -1 -1v-16a1 1 0 0 1 1 -1Z"},{id:"headphones",zh:"耳机",en:"Headphones",keywords:"听 音频 audio",d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3"},{id:"user",zh:"人物",en:"User",keywords:"用户 个人 person",d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2M8 7a4 4 0 1 0 8 0a4 4 0 1 0 -8 0Z"},{id:"users",zh:"人群",en:"Users",keywords:"团队 用户 team people",d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M16 3.128a4 4 0 0 1 0 7.744M22 21v-2a4 4 0 0 0-3-3.87M5 7a4 4 0 1 0 8 0a4 4 0 1 0 -8 0Z"},{id:"face-slightly-smiling",zh:"笑脸",en:"Smile",keywords:"开心 微笑 happy",d:"M15 10V9M16.472 15a6 6 0 01-8.943 0M9 10V9M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0Z"},{id:"briefcase",zh:"公文包",en:"Briefcase",keywords:"工作 职场 work",d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16M4 6h16a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-16a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2Z"},{id:"graduation-cap",zh:"学士帽",en:"Graduation cap",keywords:"学习 教育 毕业 school",d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0zM22 10v6M6 12.5V16a6 3 0 0 0 12 0v-3.5"},{id:"book-open",zh:"书本",en:"Book",keywords:"阅读 学习 read",d:"M12 5v16M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z"},{id:"pencil",zh:"铅笔",en:"Pencil",keywords:"写 编辑 edit write",d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497zM15 5l4 4"},{id:"clipboard-list",zh:"清单",en:"Checklist",keywords:"列表 待办 todo list",d:"M9 2h6a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-6a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1ZM16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2M12 11h4M12 16h4M8 11h.01M8 16h.01"},{id:"list-checks",zh:"勾选列表",en:"Checked list",keywords:"待办 完成 todo",d:"M13 5h8M13 12h8M13 19h8M3 17l2 2 4-4M3 7l2 2 4-4"},{id:"trending-up",zh:"上升趋势",en:"Trending up",keywords:"增长 数据 growth",d:"M16 7h6v6M22 7l-8.5 8.5-5-5L2 17"},{id:"chart-column",zh:"柱状图",en:"Bar chart",keywords:"数据 统计 chart",d:"M3 3v16a2 2 0 0 0 2 2h16M18 17V9M13 17V5M8 17v-3"},{id:"chart-pie",zh:"饼图",en:"Pie chart",keywords:"数据 占比 chart",d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1zM21.21 15.89A10 10 0 1 1 8 2.83"},{id:"dollar-sign",zh:"美元",en:"Dollar",keywords:"钱 价格 money",d:"M12 2L12 22M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"},{id:"percent",zh:"百分号",en:"Percent",keywords:"折扣 比例 discount",d:"M19 5L5 19M4 6.5a2.5 2.5 0 1 0 5 0a2.5 2.5 0 1 0 -5 0ZM15 17.5a2.5 2.5 0 1 0 5 0a2.5 2.5 0 1 0 -5 0Z"},{id:"lock",zh:"锁",en:"Lock",keywords:"安全 隐私 secure",d:"M5 11h14a2 2 0 0 1 2 2v7a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-7a2 2 0 0 1 2 -2ZM7 11V7a5 5 0 0 1 10 0v4"},{id:"key-round",zh:"钥匙",en:"Key",keywords:"密码 关键 password",d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4zM16 7.5a0.5 0.5 0 1 0 1 0a0.5 0.5 0 1 0 -1 0Z"},{id:"shield-check",zh:"盾牌",en:"Shield",keywords:"安全 保障 protect",d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1zM9 12l2 2 4-4"},{id:"settings",zh:"设置",en:"Settings",keywords:"齿轮 配置 gear",d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915M9 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0Z"},{id:"search",zh:"搜索",en:"Search",keywords:"放大镜 查找 find",d:"M21 21l-4.34-4.34M3 11a8 8 0 1 0 16 0a8 8 0 1 0 -16 0Z"},{id:"link",zh:"链接",en:"Link",keywords:"网址 关联 url",d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"},{id:"download",zh:"下载",en:"Download",keywords:"保存 save",d:"M12 15V3M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5"},{id:"upload",zh:"上传",en:"Upload",keywords:"发布",d:"M12 3v12M17 8l-5-5-5 5M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"},{id:"share-2",zh:"分享",en:"Share",keywords:"转发",d:"M15 5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0ZM3 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0ZM15 19a3 3 0 1 0 6 0a3 3 0 1 0 -6 0ZM8.59 13.51L15.42 17.49M15.41 6.51L8.59 10.49"},{id:"send",zh:"发送",en:"Send",keywords:"纸飞机 投递",d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11zM21.854 2.147l-10.94 10.939"},{id:"wifi",zh:"无线网",en:"Wi-Fi",keywords:"网络 信号 wireless",d:"M12 20h.01M2 8.82a15 15 0 0 1 20 0M5 12.859a10 10 0 0 1 14 0M8.5 16.429a5 5 0 0 1 7 0"},{id:"car",zh:"汽车",en:"Car",keywords:"出行 开车 drive",d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2M5 17a2 2 0 1 0 4 0a2 2 0 1 0 -4 0ZM9 17h6M15 17a2 2 0 1 0 4 0a2 2 0 1 0 -4 0Z"},{id:"plane",zh:"飞机",en:"Plane",keywords:"旅行 出差 travel flight",d:"M17.8 19.2 16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z"},{id:"train-front",zh:"火车",en:"Train",keywords:"高铁 出行 rail",d:"M8 3.1V7a4 4 0 0 0 8 0V3.1M9 15l-1-1M15 15l1-1M9 19c-2.8 0-5-2.2-5-5v-4a8 8 0 0 1 16 0v4c0 2.8-2.2 5-5 5ZM8 19l-2 3M16 19l2 3"},{id:"bike",zh:"自行车",en:"Bike",keywords:"骑行 运动 cycle",d:"M15 17.5a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0ZM2 17.5a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0ZM14 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0ZM12 17.5V14l-3-3 4-3 2 3h2"}],C6=new Map(Hs.map(e=>[e.id,e])),E6=new Map(Hs.map(e=>[e.zh,e]));function z6(e){return C6.get(e)}function R6(e){return E6.get(e)}function I6(e){return`${e.id} ${e.zh} ${e.en} ${e.keywords}`.toLowerCase()}function L6(e){const n=e.trim().toLowerCase().split(/\s+/).filter(Boolean);if(n.length===0)return[...Hs];const r=n.join(" "),s=l=>{const o=[l.id,l.zh,l.en.toLowerCase()];return o.includes(r)?0:l.keywords.toLowerCase().split(" ").includes(r)?1:o.some(c=>c.startsWith(r))?2:3};return Hs.filter(l=>{const o=I6(l);return n.every(c=>o.includes(c))}).map((l,o)=>({icon:l,order:o,rank:s(l)})).sort((l,o)=>l.rank-o.rank||l.order-o.order).map(l=>l.icon)}const st=1/2,Fn=1/3,o0=[{id:"pair",label:"两张并排",aspect:1.6,cells:[{x:0,y:0,width:st,height:1},{x:st,y:0,width:st,height:1}]},{id:"top-feature",label:"一大两小",aspect:1.2,cells:[{x:0,y:0,width:1,height:st},{x:0,y:st,width:st,height:st},{x:st,y:st,width:st,height:st}]},{id:"bottom-feature",label:"两小一大",aspect:1.2,cells:[{x:0,y:0,width:st,height:st},{x:st,y:0,width:st,height:st},{x:0,y:st,width:1,height:st}]},{id:"triple",label:"三等分",aspect:1.5,cells:[{x:0,y:0,width:Fn,height:1},{x:Fn,y:0,width:Fn,height:1},{x:Fn*2,y:0,width:Fn,height:1}]},{id:"quad",label:"四宫格",aspect:1,cells:[{x:0,y:0,width:st,height:st},{x:st,y:0,width:st,height:st},{x:0,y:st,width:st,height:st},{x:st,y:st,width:st,height:st}]},{id:"six",label:"六宫格",aspect:.75,cells:[{x:0,y:0,width:st,height:Fn},{x:st,y:0,width:st,height:Fn},{x:0,y:Fn,width:st,height:Fn},{x:st,y:Fn,width:st,height:Fn},{x:0,y:Fn*2,width:st,height:Fn},{x:st,y:Fn*2,width:st,height:Fn}]}];function l0(e){return o0.find(n=>n.id===e)}const $6="#e4e4e7",D6="#d4d4d8";function A6(e,n){const r=Math.round(n.width*.8),s=Math.round(n.height*.8*e.aspect),l=Math.min(r,s),o=Math.round(l/e.aspect);return{x:Math.round((n.width-l)/2),y:Math.round((n.height-o)/2),width:l,height:o}}function P6(e,n={}){const r=n.gap??12,s=n.cornerRadius??12,l=n.createId??(()=>di()),o=n.box??{x:0,y:0,width:600,height:600/e.aspect},c=e.cells.map((f,h)=>({id:l(),name:`图片位 ${h+1}`,locked:!1,hidden:!1,type:"shape",x:Math.round(f.x*o.width+r/2),y:Math.round(f.y*o.height+r/2),width:Math.max(1,Math.round(f.width*o.width-r)),height:Math.max(1,Math.round(f.height*o.height-r)),rotation:0,scale:1,shape:"rect",fill:{type:"solid",color:$6},stroke:D6,strokeWidth:1,cornerRadius:s}));return{id:l(),name:"拼图",locked:!1,hidden:!1,type:"group",x:o.x,y:o.y,rotation:0,scale:1,children:c}}const zd="application/x-dingcard-element",Rd=[{id:"rect",label:"矩形"},{id:"ellipse",label:"圆形"},{id:"triangle",label:"三角形"},{id:"diamond",label:"菱形"},{id:"pentagon",label:"五边形"},{id:"hexagon",label:"六边形"},{id:"star",label:"五角星"},{id:"heart",label:"心形"},{id:"bubble",label:"对话气泡"}],c0=[{id:"line",label:"直线"},{id:"arrow",label:"箭头"},{id:"arrow",label:"双向箭头",bothEnds:!0}];function wc(e){return Array.from(e.types).includes(zd)}function T6(e){try{const n=JSON.parse(e.getData(zd));if(n.kind==="qrcode")return{kind:"qrcode"};if(n.kind==="chart")return{kind:"chart"};if(typeof n.id!="string")return null;const r=n.id;return n.kind==="shape"&&Rd.some(s=>s.id===r)?{kind:"shape",id:r}:n.kind==="line"&&c0.some(s=>s.id===r&&!!s.bothEnds==!!n.bothEnds)?{kind:"line",id:r,...n.bothEnds===!0?{bothEnds:!0}:{}}:n.kind==="collage"&&l0(r)?{kind:"collage",id:r}:n.kind==="decoration"&&Ui.some(s=>s.id===r)?{kind:"decoration",id:r}:n.kind==="icon"&&Hs.some(s=>s.id===r)?{kind:"icon",id:r}:null}catch{return null}}function Li(e){return{draggable:!0,onDragStart:n=>{n.dataTransfer.setData(zd,JSON.stringify(e)),n.dataTransfer.effectAllowed="copy"}}}function W6(e,n){const r=gd(e),s=240,l=r.height*s/r.width,o=18;let c=0;return{id:`decoration-preview-${e.id}`,name:e.zh,width:Math.round(s+o*2),height:Math.round(l+o*2),background:{type:"transparent"},nodes:[xd(e,{x:o,y:o,width:s,language:n},()=>`decoration-preview-${e.id}-${c++}`)]}}function Go(e,n){const r=n.trim().toLowerCase().split(/\s+/).filter(Boolean),s=`${e} ${i(e)}`.toLowerCase();return r.every(l=>s.includes(l))}const H6=p.memo(function({onPick:n}){const r=na(),s=r==="en"?"en":"zh",[l,o]=p.useState(""),c=l.trim().length>0,f=p.useMemo(()=>Rd.filter(w=>!c||Go(w.label,l)),[l,c,r]),h=p.useMemo(()=>c0.filter(w=>!c||Go(w.label,l)),[l,c,r]),g=p.useMemo(()=>o0.filter(w=>!c||Go(w.label,l)),[l,c,r]),x=p.useMemo(()=>bx(l),[l]),m=p.useMemo(()=>L6(l),[l]),j=p.useMemo(()=>[{id:"qrcode",label:"二维码"},{id:"chart",label:"图表"},{id:"table",label:"表格"},{id:"timeline",label:"时间线"},{id:"progress",label:"进度"}].filter(w=>!c||Go(w.label,l)),[l,c,r]),k=p.useMemo(()=>new Map(Ui.map(w=>[w.id,W6(w,s)])),[s]),v=f.length+h.length+g.length+x.length+m.length+j.length===0;return t.jsxs(t.Fragment,{children:[t.jsxs("label",{className:"search-field freeform-element-search",children:[t.jsx(Ma,{}),t.jsx("input",{type:"search",value:l,placeholder:i("搜索元素"),"aria-label":i("搜索元素"),"data-testid":"freeform-element-search",onChange:w=>o(w.currentTarget.value)})]}),f.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"freeform-drawer-section",children:i("形状")}),t.jsx("div",{className:"freeform-element-tiles",role:"group","aria-label":i("形状"),children:f.map(w=>t.jsxs("button",{type:"button",className:"freeform-element-tile","data-testid":`insert-shape-${w.id}`,...Li({kind:"shape",id:w.id}),onClick:()=>n({kind:"shape",id:w.id}),children:[t.jsx(_i,{shape:w.id}),t.jsx("span",{children:i(w.label)})]},w.id))})]}),h.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"freeform-drawer-section",children:i("线条")}),t.jsx("div",{className:"freeform-element-tiles",role:"group","aria-label":i("线条"),children:h.map(w=>t.jsxs("button",{type:"button",className:"freeform-element-tile","data-testid":`insert-line-${w.bothEnds?"arrow-both":w.id}`,...Li({kind:"line",id:w.id,bothEnds:w.bothEnds}),onClick:()=>n({kind:"line",id:w.id,bothEnds:w.bothEnds}),children:[t.jsx(_i,{shape:w.bothEnds?"arrowBoth":w.id}),t.jsx("span",{children:i(w.label)})]},w.bothEnds?"arrow-both":w.id))})]}),j.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"freeform-drawer-section",children:i("实用")}),t.jsx("div",{className:"freeform-element-tiles",role:"group","aria-label":i("实用"),children:j.map(w=>t.jsxs("button",{type:"button",className:"freeform-element-tile","data-testid":`insert-${w.id}`,...Li(w.id==="qrcode"||w.id==="chart"||w.id==="table"||w.id==="timeline"||w.id==="progress"?{kind:w.id}:{kind:"chart"}),onClick:()=>n(w.id==="qrcode"||w.id==="chart"||w.id==="table"||w.id==="timeline"||w.id==="progress"?{kind:w.id}:{kind:"chart"}),children:[t.jsx(_i,{shape:w.id}),t.jsx("span",{children:i(w.label)})]},w.id))})]}),g.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"freeform-drawer-section",children:i("拼图")}),t.jsx("div",{className:"freeform-element-tiles",role:"group","aria-label":i("拼图"),children:g.map(w=>t.jsxs("button",{type:"button",className:"freeform-element-tile","data-testid":`insert-collage-${w.id}`,...Li({kind:"collage",id:w.id}),onClick:()=>n({kind:"collage",id:w.id}),children:[t.jsx("span",{className:"collage-preview","aria-hidden":"true",style:{aspectRatio:`${w.aspect}`},children:w.cells.map((N,M)=>t.jsx("span",{style:{left:`${N.x*100}%`,top:`${N.y*100}%`,width:`${N.width*100}%`,height:`${N.height*100}%`}},M))}),t.jsx("span",{children:i(w.label)})]},w.id))})]}),cx.map(w=>{const N=x.filter(I=>I.category===w.id);if(N.length===0)return null;const M=s==="en"?w.en:w.zh;return t.jsxs("div",{className:"freeform-decoration-group",children:[t.jsx("div",{className:"freeform-drawer-section",children:M}),t.jsx("div",{className:`freeform-decoration-grid is-${w.id}`,role:"group","aria-label":M,children:N.map(I=>{const F=s==="en"?I.en:I.zh,z=w.id==="label";return t.jsx("button",{type:"button",className:"freeform-decoration-tile","data-testid":`insert-decoration-${I.id}`,"aria-label":F,title:F,...Li({kind:"decoration",id:I.id}),onClick:()=>n({kind:"decoration",id:I.id}),children:t.jsx(Xs,{slide:k.get(I.id),frameWidth:z?72:46,frameHeight:z?48:46,className:"freeform-decoration-preview"})},I.id)})})]},w.id)}),m.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"freeform-drawer-section",children:i("图标")}),t.jsx("div",{className:"freeform-icon-grid",role:"group","aria-label":i("图标"),children:m.map(w=>{const N=r==="en"?w.en:w.zh;return t.jsx("button",{type:"button",className:"freeform-icon-tile","data-testid":`insert-icon-${w.id}`,"aria-label":N,title:N,...Li({kind:"icon",id:w.id}),onClick:()=>n({kind:"icon",id:w.id}),children:t.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:t.jsx("path",{d:w.d})})},w.id)})})]}),v&&t.jsx("p",{className:"freeform-element-empty","data-testid":"freeform-element-empty",children:i("没有找到元素")})]})}),rd="__import-font__";function d0(e){const n=Hc.find(s=>s.id===e);if(n)return n;const r=Wc(e).toLowerCase();return Hc.find(s=>Wc(s.id).toLowerCase()===r)}function Os(e){const n=d0(e);return n?i(n.label):Wc(e)||e}function Id(e){var n;return((n=d0(e))==null?void 0:n.id)??e}function u0(e,{current:n,withImport:r=!1}={}){const s=[...Hc.map(l=>({id:l.id,label:i(l.label)})),...e.map(l=>({id:dd(l.family),label:l.family}))];if(n!==void 0){const l=Id(n);s.some(o=>o.id===l)||s.push({id:l,label:Os(l)})}return r&&s.push({id:rd,label:i("导入字体…"),previewFont:"inherit"}),s}const O6=p.memo(function({onRestyle:n}){return na(),t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"freeform-drawer-section",children:i("搭配")}),t.jsx("div",{className:"freeform-looks",children:A1.map(r=>{const s=Qu.find(o=>o.id===r.palette),l=Ju.find(o=>o.id===r.fontSet);return t.jsxs("button",{type:"button",className:"freeform-look","data-testid":`style-look-${r.id}`,onClick:()=>n({palette:r.palette,fontSet:r.fontSet}),children:[t.jsxs("span",{className:"freeform-look-page",style:{background:s.background,color:s.text},"aria-hidden":"true",children:[t.jsx("span",{className:"freeform-look-title",style:{fontFamily:l.heading},children:i("标题")}),t.jsx("i",{className:"freeform-look-accent",style:{background:s.accents[0]}}),t.jsx("span",{className:"freeform-look-body",style:{fontFamily:l.body},children:i("正文内容")})]}),t.jsx("span",{className:"freeform-palette-name",children:i(r.name)})]},r.id)})}),t.jsx("div",{className:"freeform-drawer-section",children:i("配色")}),t.jsx("div",{className:"freeform-palettes",children:Qu.map(r=>t.jsxs("button",{type:"button",className:"freeform-palette","data-testid":`style-palette-${r.id}`,onClick:()=>n({palette:r.id}),children:[t.jsxs("span",{className:"freeform-palette-chip",style:{background:r.background,color:r.text},"aria-hidden":"true",children:["Aa",t.jsx("span",{className:"freeform-palette-accents",children:r.accents.map(s=>t.jsx("i",{style:{background:s}},s))})]}),t.jsx("span",{className:"freeform-palette-name",children:i(r.name)})]},r.id))}),t.jsx("div",{className:"freeform-drawer-section",children:i("字体组合")}),t.jsx("div",{className:"freeform-font-sets",children:Ju.map(r=>t.jsxs("button",{type:"button",className:"freeform-font-set","data-testid":`style-font-set-${r.id}`,onClick:()=>n({fontSet:r.id}),children:[t.jsx("span",{className:"freeform-font-set-name",style:{fontFamily:r.heading},children:i(r.name)}),t.jsxs("span",{className:"freeform-font-set-body",children:[t.jsx("span",{style:{fontFamily:r.heading},children:Os(r.heading)}),r.body!==r.heading&&t.jsxs(t.Fragment,{children:[" + ",t.jsx("span",{style:{fontFamily:r.body},children:Os(r.body)})]})]})]},r.id))})]})}),_6=10,f0="slicer.recent-colors.v1";function h0(e){return typeof e=="string"&&/^#[0-9a-fA-F]{6}$/.test(e)}function Ld(e){if(!Array.isArray(e))return[];const n=new Set,r=[];for(const s of e){if(!h0(s))continue;const l=s.toLowerCase();if(!n.has(l)&&(n.add(l),r.push(l),r.length>=_6))break}return r}function kc(){try{const e=localStorage.getItem(f0);return e?Ld(JSON.parse(e)):[]}catch{return[]}}function B6(e){try{localStorage.setItem(f0,JSON.stringify(Ld(e)))}catch{}}function K6(e,n){if(!h0(n))return[...e];const r=n.toLowerCase();return Ld([r,...e])}const m0=p.createContext(null),V6=["#18181b","#52525b","#ffffff","#b34d4d","#fed7aa","#f97316","#ef4444","#eab308","#22c55e","#14b8a6","#3b82f6","#8b5cf6"];function sl(e){return e.type==="solid"||e.type==="linear-gradient"||e.type==="radial-gradient"}function G6(e,n){return sl(e)?e:n}function U6(e){return e.type==="pattern"?"solid":e.type}function p0(e){return Number.isFinite(e)?Math.max(0,Math.min(255,Math.round(e))):0}function ad(e){const n=rr(e)?e.slice(1):"000000";return{r:Number.parseInt(n.slice(0,2),16),g:Number.parseInt(n.slice(2,4),16),b:Number.parseInt(n.slice(4,6),16)}}function gl({r:e,g:n,b:r}){return`#${[e,n,r].map(s=>p0(s).toString(16).padStart(2,"0")).join("")}`}function Jf(e,n){const r=ad(e),s=ad(n);return gl({r:Math.round((r.r+s.r)/2),g:Math.round((r.g+s.g)/2),b:Math.round((r.b+s.b)/2)})}function Y6(e,n){const r={...n,[e]:0},s={...n,[e]:255};return`linear-gradient(90deg, ${gl(r)}, ${gl(s)})`}function eh(){const e=window.EyeDropper;return typeof e=="function"?e:null}function vt({label:e,color:n,onChange:r,testId:s="paint-color-button",variant:l="swatch"}){const o=p.useRef(null),c=p.useRef(null),[f,h]=p.useState(!1),[g,x]=p.useState(kc),[m,j]=p.useState(!1),k=p.useRef(null),v=p.useContext(m0),[w,N]=p.useState(null),M=ad(n),I=n==="transparent";function F(){x(kc()),k.current=null,N(rr(n)?n.toLowerCase():null),h(!0)}function z(){const K=k.current;if(K){const D=K6(kc(),K);B6(D),x(D)}k.current=null,h(!1)}function A(K){rr(K)&&(k.current=K),r(K)}async function T(){const K=eh();if(!(!K||m)){j(!0);try{const D=await new K().open();rr(D.sRGBHex)&&A(D.sRGBHex)}catch{}finally{j(!1)}}}p.useEffect(()=>{if(!f)return;function K(re){const q=o.current;q&&!q.contains(re.target)&&z()}function D(re){re.key==="Escape"&&(re.preventDefault(),re.stopPropagation(),z(),requestAnimationFrame(()=>{var q;return(q=c.current)==null?void 0:q.focus()}))}return window.addEventListener("pointerdown",K,!0),window.addEventListener("keydown",D,!0),()=>{window.removeEventListener("pointerdown",K,!0),window.removeEventListener("keydown",D,!0)}},[f]);function L(K,D){A(gl({...M,[K]:p0(Number(D))}))}const H=(v==null?void 0:v.colors.slice(0,12))??[],P=rr(n)?n.toLowerCase():null,U=!!(v&&w&&P&&P!==w&&v.colors.includes(w));return t.jsxs("div",{className:"paint-color",ref:o,children:[t.jsx("button",{ref:c,type:"button",className:`paint-color-button${I?" is-empty":""}${l==="text"?" is-text":""}`,"data-testid":s,"aria-label":e,"aria-haspopup":"dialog","aria-expanded":f,style:l==="text"?{"--paint-color":n}:I?void 0:{background:n},onClick:()=>f?z():F(),children:l==="text"&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"paint-color-letter","aria-hidden":"true",children:"A"}),t.jsx("span",{className:"paint-color-bar","aria-hidden":"true"})]})}),f&&t.jsxs("div",{className:"paint-popover","data-testid":"paint-popover",role:"dialog","aria-label":i("{label} 色板",{label:e}),children:[t.jsxs("div",{className:"paint-popover-head",children:[t.jsx("span",{className:"paint-popover-sample",style:{background:n}}),t.jsx("input",{className:"paint-popover-hex",value:n,"aria-label":i("{label} 自定义 HEX",{label:e}),onChange:K=>{const D=K.currentTarget.value;rr(D)&&A(D)}}),eh()&&t.jsx("button",{type:"button",className:"paint-eyedropper","data-testid":"paint-eyedropper","aria-label":i("{label} 屏幕取色",{label:e}),title:i("屏幕取色"),disabled:m,onClick:()=>{T()},children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M13.4 3.6a2.5 2.5 0 0 1 3.5 3.5l-1.5 1.4 1.1 1.1-1.4 1.4-1.1-1.1-6 6-3 0.7 0.7-3 6-6-1.1-1.1 1.4-1.4 1.1 1.1 1.4-1.5z"})})})]}),H.length>0&&t.jsx("div",{className:"paint-swatch-grid paint-deck-grid","aria-label":i("{label} 本设计用色",{label:e}),"data-testid":"paint-deck-grid",children:H.map(K=>t.jsx("button",{type:"button",className:"paint-swatch","aria-label":i("{label} 本设计 {color}",{label:e,color:K}),style:{background:K},onClick:()=>A(K)},K))}),t.jsx("div",{className:"paint-swatch-grid","aria-label":i("{label} 常用颜色",{label:e}),children:V6.map(K=>t.jsx("button",{type:"button",className:"paint-swatch","aria-label":`${e} ${K}`,style:{background:K},onClick:()=>A(K)},K))}),g.length>0&&t.jsx("div",{className:"paint-swatch-grid paint-recent-grid","aria-label":i("{label} 最近使用",{label:e}),"data-testid":"paint-recent-grid",children:g.map(K=>t.jsx("button",{type:"button",className:"paint-swatch","data-testid":"paint-recent-swatch","aria-label":i("{label} 最近 {color}",{label:e,color:K}),style:{background:K},onClick:()=>A(K)},K))}),t.jsx("div",{className:"paint-channel-list",children:["r","g","b"].map(K=>t.jsxs("label",{className:"paint-channel",children:[t.jsx("span",{children:K.toUpperCase()}),t.jsx("input",{className:"paint-channel-range",type:"range",min:"0",max:"255",value:M[K],style:{backgroundImage:Y6(K,M)},onChange:D=>L(K,D.currentTarget.value)}),t.jsx("input",{className:"paint-channel-number",type:"number",min:"0",max:"255",value:M[K],onChange:D=>L(K,D.currentTarget.value)})]},K))}),U&&v&&w&&P&&t.jsxs("button",{type:"button",className:"paint-replace-all","data-testid":"paint-replace-all",title:i("把整套里的 {from} 都换成 {to}",{from:w,to:P}),onClick:()=>{v.replace(w,P),N(P)},children:[t.jsx("span",{className:"paint-replace-chip",style:{background:w},"aria-hidden":"true"}),t.jsx("span",{className:"paint-replace-arrow","aria-hidden":"true",children:"→"}),t.jsx("span",{className:"paint-replace-chip",style:{background:P},"aria-hidden":"true"}),i("全部替换")]})]})]})}function Uo({label:e,value:n,modes:r,onChange:s,fallbackPaint:l=Oc,onChooseImage:o,onClearImage:c,onImageFitChange:f,onAdjustImageFraming:h,onResetImageFraming:g,imageFramingDisabled:x=!1,imageFramingDisabledReason:m,imageFramingResetDisabled:j=!0}){const k=U6(n),v=G6(n,l),w=hc(v);function N(P){if(P!==k){if(P==="solid")s(sl(n)?T1(n):l);else if(P==="linear-gradient")s(sl(n)?hc(n):hc(l));else if(P==="radial-gradient")s(sl(n)?nf(n):nf(l));else if(P==="transparent")s({type:"transparent"});else if(P==="image"){if(n.type==="image")return;o==null||o()}}}function M(P){rr(P)&&s({type:"solid",color:P})}function I(P){k==="radial-gradient"||_r(w)||s({...w,...P,type:"linear-gradient"})}function F(P){if(k==="radial-gradient"){s({type:"radial-gradient",stops:P});return}s({type:"linear-gradient",stops:P,angle:w.angle})}function z(P){k!=="radial-gradient"&&s(_r(w)?{type:"linear-gradient",stops:w.stops,angle:P}:{...w,angle:P,type:"linear-gradient"})}function A(){if(_r(w)){if(w.stops.length>=tf)return;const P=w.stops;let U=0,K=-1;for(let te=0;te<P.length-1;te+=1){const be=P[te+1].offset-P[te].offset;be>K&&(K=be,U=te)}const D=P[U],re=P[U+1],q=[...P];q.splice(U+1,0,{offset:(D.offset+re.offset)/2,color:Jf(D.color,re.color)}),F(q);return}s({type:"linear-gradient",angle:w.angle,stops:[{offset:0,color:w.from},{offset:.5,color:Jf(w.from,w.to)},{offset:1,color:w.to}]})}function T(P,U){_r(w)&&F(w.stops.map((K,D)=>D===P?{...K,color:U}:{...K}))}function L(P,U){if(!_r(w)||!Number.isFinite(U))return;const K=w.stops,D=P===0?0:Math.floor(K[P-1].offset*100)+1,re=P===K.length-1?100:Math.ceil(K[P+1].offset*100)-1,q=Math.max(D,Math.min(re,Math.round(U)));F(K.map((te,be)=>be===P?{...te,offset:q/100}:{...te}))}function H(P){!_r(w)||w.stops.length<=ef||F(w.stops.filter((U,K)=>K!==P))}return t.jsxs("div",{className:"paint-field","data-testid":"freeform-paint-field",children:[t.jsx("div",{className:"field-label",children:e}),t.jsx("div",{className:"seg stretch paint-mode","aria-label":i("{label} 类型",{label:e}),children:r.map(P=>t.jsx("button",{type:"button",className:k===P?"seg-btn on":"seg-btn","data-testid":`paint-mode-${P}`,"aria-label":P==="image"?i("插入图片填充"):void 0,onClick:()=>N(P),children:P==="solid"?i("纯色"):P==="linear-gradient"?i("渐变"):P==="radial-gradient"?i("径向"):P==="transparent"?i("透明"):i("图片")},P))}),k==="solid"&&t.jsxs("div",{className:"paint-row",children:[t.jsx(vt,{label:i("{label} 颜色",{label:e}),color:oi(v),onChange:M}),t.jsx("input",{className:"paint-hex",value:oi(v),onChange:P=>M(P.currentTarget.value),"aria-label":`${e} hex`})]}),(k==="linear-gradient"||k==="radial-gradient")&&t.jsxs("div",{className:"paint-gradient",children:[_r(w)?t.jsx("div",{className:"paint-stops","data-testid":"paint-stops-list",children:w.stops.map((P,U)=>t.jsxs("div",{className:"paint-row paint-stop-row",children:[t.jsx(vt,{label:i("{label} 色标 {n} 颜色",{label:e,n:U+1}),color:P.color,onChange:K=>T(U,K)}),t.jsx("input",{className:"paint-hex",value:P.color,onChange:K=>rr(K.currentTarget.value)&&T(U,K.currentTarget.value),"aria-label":i("{label} 色标 {n} hex",{label:e,n:U+1})}),t.jsx("input",{className:"paint-angle","data-testid":`paint-stop-${U}-offset`,type:"number",min:U===0?0:Math.floor(w.stops[U-1].offset*100)+1,max:U===w.stops.length-1?100:Math.ceil(w.stops[U+1].offset*100)-1,value:Math.round(P.offset*100),onChange:K=>L(U,Number(K.currentTarget.value)),"aria-label":i("{label} 色标 {n} 位置百分比",{label:e,n:U+1})}),t.jsx("button",{type:"button",className:"paint-stop-remove","data-testid":`paint-stop-${U}-remove`,disabled:w.stops.length<=ef,onClick:()=>H(U),"aria-label":i("{label} 删除色标 {n}",{label:e,n:U+1}),title:i("删除色标"),children:t.jsx(bm,{})})]},U))}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"paint-row",children:[t.jsx(vt,{label:i("{label} 渐变起始色",{label:e}),color:w.from,onChange:P=>I({from:P})}),t.jsx("input",{className:"paint-hex",value:w.from,onChange:P=>rr(P.currentTarget.value)&&I({from:P.currentTarget.value}),"aria-label":i("{label} 渐变起始 hex",{label:e})})]}),t.jsxs("div",{className:"paint-row",children:[t.jsx(vt,{label:i("{label} 渐变结束色",{label:e}),color:w.to,onChange:P=>I({to:P})}),t.jsx("input",{className:"paint-hex",value:w.to,onChange:P=>rr(P.currentTarget.value)&&I({to:P.currentTarget.value}),"aria-label":i("{label} 渐变结束 hex",{label:e})})]})]}),k==="linear-gradient"&&t.jsxs("div",{className:"paint-row",children:[t.jsx("input",{className:"paint-range","data-testid":"paint-gradient-angle",type:"range",min:"0",max:"359",value:w.angle,onChange:P=>z(Number(P.currentTarget.value)),"aria-label":i("{label} 渐变角度",{label:e})}),t.jsx("input",{className:"paint-angle",type:"number",min:"0",max:"359",value:w.angle,onChange:P=>z(Number(P.currentTarget.value)),"aria-label":i("{label} 渐变角度数值",{label:e})})]}),t.jsx("div",{className:"paint-row",children:t.jsx("button",{type:"button",className:"ghost","data-testid":"paint-stops-add",disabled:_r(w)&&w.stops.length>=tf,onClick:A,"aria-label":i("{label} 添加色标",{label:e}),children:i("添加色标")})}),t.jsx("div",{className:"paint-preview","aria-hidden":"true",style:{background:P1(k==="radial-gradient"&&_r(w)?{type:"radial-gradient",stops:w.stops}:w)}})]}),k==="image"&&n.type==="image"&&t.jsxs("div",{className:"paint-image",children:[t.jsx("div",{className:"seg stretch",children:["cover","contain"].map(P=>t.jsx("button",{type:"button",className:n.fit===P?"seg-btn on":"seg-btn","data-testid":`paint-image-fit-${P}`,onClick:()=>f==null?void 0:f(P),children:P==="cover"?i("填满"):i("适应")},P))}),t.jsxs("div",{className:"inspector-actions",children:[t.jsx("button",{className:"ghost",type:"button","data-testid":"freeform-adjust-framing","aria-label":i("调整图片取景"),title:x?m:i("调整图片取景"),disabled:x,onClick:h,children:i("调整取景")}),t.jsx("button",{className:"ghost",type:"button","data-testid":"freeform-reset-framing","aria-label":i("重置图片取景"),title:j?i("当前已经是默认取景"):i("重置图片取景"),disabled:j,onClick:g,children:i("重置取景")}),t.jsx("button",{className:"ghost",type:"button",onClick:o,children:i("替换图片")}),t.jsx("button",{className:"ghost",type:"button",onClick:c,children:i("清除图片")})]})]})]})}function Ss(e){if(!Number.isFinite(e))return"";const n=Number(e.toFixed(2));return n!==0||e===0?String(n):e.toExponential(2).replace("e+","e")}function Ct({ariaLabel:e,value:n,min:r,max:s,step:l="any",resetKey:o,onCommit:c}){const[f,h]=p.useState(()=>Ss(n)),g=p.useRef(f),[x,m]=p.useState(!1),j=p.useRef(n),k=p.useRef(o),v=p.useRef(!1),w=p.useRef(Ss(n)),N=p.useRef(!1);p.useLayoutEffect(()=>{const F=o!==k.current;if(!x||n!==j.current||F){const z=Ss(n);g.current=z,h(z),w.current=z,N.current=!1}j.current=n,k.current=o},[x,o,n]);function M(){const F=Ss(n);g.current=F,h(F),m(!1),v.current=!1,w.current=F,N.current=!1}function I(){if(v.current){v.current=!1;return}const F=g.current;if(!N.current||F===w.current){M();return}const z=Number(F);if(!(F.trim().length>0&&Number.isFinite(z)&&(r===void 0||z>=r)&&(s===void 0||z<=s))||z===n){M();return}c(z)===!1?M():m(!1)}return t.jsx("input",{type:"number","aria-label":e,value:f,min:r,max:s,step:l,onFocus:()=>{w.current=g.current,N.current=!1,m(!0)},onChange:F=>{const z=F.currentTarget.value;m(!0),N.current=z!==w.current,g.current=z,h(z)},onBlur:I,onKeyDown:F=>{if(F.key==="Enter")F.preventDefault(),F.currentTarget.blur();else if(F.key==="Escape"){F.preventDefault(),v.current=!0;const z=Ss(n);g.current=z,h(z),m(!1),N.current=!1,F.currentTarget.blur()}}})}function id({text:e,fontSize:n,textFill:r,effect:s}){const l=s?W1(s,n):null,o=r.type==="solid"?r.color:oi(r);return t.jsxs("span",{className:"text-effect-sample",style:{fontSize:n},"aria-hidden":"true",children:[l&&t.jsx("span",{className:"text-effect-sample-layer",style:l.style,children:l.band?t.jsx("span",{className:"freeform-text-effect-band",style:l.band,children:e}):e}),t.jsx("span",{className:"text-effect-sample-words",style:{...O1(r),...s?H1(s,n,o):{}},children:e})]})}const Z6={neon:"霓虹",outline:"描边",hollow:"镂空",splice:"错位",offset:"投影",echo:"回声",glitch:"故障",extrude:"立体",background:"底色",marker:"荧光笔"},Sc={neon:"强度",outline:"粗细",hollow:"粗细",splice:"偏移",offset:"偏移",echo:"偏移",glitch:"偏移",extrude:"厚度",background:"扩展",marker:"高度"},ur=e=>({type:"solid",color:e}),vc={neon:{page:"#0b1020",fill:ur("#e8fdff"),effect:{type:"neon",color:"#22d3ee",amount:55}},outline:{page:"#fbbf24",fill:ur("#1f2937"),effect:{type:"outline",color:"#ffffff",amount:60}},hollow:{page:"#f4f4f5",fill:ur("#18181b"),effect:{type:"hollow",amount:50}},splice:{page:"#fffbeb",fill:ur("#18181b"),effect:{type:"splice",color:"#f59e0b",amount:50,angle:45}},offset:{page:"#fef3c7",fill:ur("#ea580c"),effect:{type:"offset",color:"#1c1917",amount:45,angle:45}},echo:{page:"#f5f3ff",fill:ur("#6d28d9"),effect:{type:"echo",color:"#6d28d9",amount:45,angle:0}},glitch:{page:"#0a0a0a",fill:ur("#ffffff"),effect:{type:"glitch",color:"#00e5ff",color2:"#ff2bd6",amount:45}},extrude:{page:"#1e1b4b",fill:ur("#fde047"),effect:{type:"extrude",color:"#c2410c",amount:50,angle:45}},background:{page:"#f4f4f5",fill:ur("#ffffff"),effect:{type:"background",color:"#18181b",amount:40,radius:30}},marker:{page:"#ffffff",fill:ur("#18181b"),effect:{type:"marker",color:"#fde68a",amount:50}}};function X6({effect:e,textColor:n,resetKey:r,onChange:s}){na();const l=o=>{if(o===null){e&&s(null);return}(e==null?void 0:e.type)!==o&&s(K1(o,n))};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"text-effect-grid",role:"group","aria-label":i("效果"),children:[t.jsxs("button",{type:"button",className:"text-effect-choice","data-testid":"text-effect-none","aria-pressed":!e,onClick:()=>l(null),children:[t.jsx("span",{className:"text-effect-choice-sample",style:{background:"#f4f4f5"},children:t.jsx(id,{text:"Aa",fontSize:20,textFill:ur("#18181b"),effect:null})}),t.jsx("span",{className:"text-effect-choice-name",children:i("无")})]}),_1.map(o=>t.jsxs("button",{type:"button",className:"text-effect-choice","data-testid":`text-effect-${o}`,"aria-pressed":(e==null?void 0:e.type)===o,onClick:()=>l(o),children:[t.jsx("span",{className:"text-effect-choice-sample",style:{background:vc[o].page},children:t.jsx(id,{text:"Aa",fontSize:20,textFill:vc[o].fill,effect:vc[o].effect})}),t.jsx("span",{className:"text-effect-choice-name",children:i(Z6[o])})]},o))]}),e&&t.jsxs("div",{className:"text-effect-settings","data-testid":"text-effect-settings",children:["color"in e&&t.jsxs("div",{className:"field-grid with-gap",children:[t.jsxs("div",{className:"stroke-color-field","data-testid":"text-effect-color",children:[t.jsx("span",{className:"stroke-color-label",children:i("颜色")}),t.jsxs("div",{className:"color-field",children:[t.jsx("span",{className:"color-field-value",children:e.color.toUpperCase()}),t.jsx(vt,{label:i("效果颜色"),color:e.color,onChange:o=>s({...e,color:o})})]})]}),e.type==="glitch"&&t.jsxs("div",{className:"stroke-color-field","data-testid":"text-effect-color2",children:[t.jsx("span",{className:"stroke-color-label",children:i("颜色")}),t.jsxs("div",{className:"color-field",children:[t.jsx("span",{className:"color-field-value",children:e.color2.toUpperCase()}),t.jsx(vt,{label:i("效果第二种颜色"),color:e.color2,onChange:o=>s({...e,color2:o})})]})]})]}),t.jsxs("div",{className:"field-grid",children:[t.jsxs("label",{title:i(Sc[e.type]),children:[t.jsx("span",{className:"field-glyph is-word","aria-hidden":"true",children:i(Sc[e.type])}),t.jsx(Ct,{ariaLabel:i(Sc[e.type]),min:0,max:100,resetKey:r,value:e.amount,onCommit:o=>s({...e,amount:o})})]}),B1.has(e.type)&&"angle"in e&&t.jsxs("label",{title:i("方向"),children:[t.jsx("span",{className:"field-glyph is-word","aria-hidden":"true",children:i("方向")}),t.jsx(Ct,{ariaLabel:i("方向"),min:0,max:360,resetKey:r,value:e.angle,onCommit:o=>s({...e,angle:o===360?0:o})}),t.jsx("span",{className:"field-suffix","aria-hidden":"true",children:"°"})]}),e.type==="background"&&t.jsxs("label",{title:i("圆角"),children:[t.jsx("span",{className:"field-glyph is-word","aria-hidden":"true",children:i("圆角")}),t.jsx(Ct,{ariaLabel:i("圆角"),min:0,max:100,resetKey:r,value:e.radius,onCommit:o=>s({...e,radius:o})})]})]})]})]})}const Hn=e=>({type:"solid",color:e}),q6=[{id:"neon-cyan",name:"霓虹青",backdrop:"#0b1020",textFill:Hn("#e8fdff"),effect:{type:"neon",color:"#22d3ee",amount:55}},{id:"neon-pink",name:"霓虹粉",backdrop:"#120a1a",textFill:Hn("#fff0fa"),effect:{type:"neon",color:"#f472b6",amount:55}},{id:"sticker",name:"贴纸白边",backdrop:"#fbbf24",textFill:Hn("#1f2937"),effect:{type:"outline",color:"#ffffff",amount:60}},{id:"candy",name:"糖果描边",backdrop:"#fdf2f8",textFill:Hn("#ffffff"),effect:{type:"outline",color:"#f43f5e",amount:50}},{id:"hollow",name:"镂空",backdrop:"#f5f5f4",textFill:Hn("#18181b"),effect:{type:"hollow",amount:50}},{id:"splice",name:"错位",backdrop:"#fffbeb",textFill:Hn("#18181b"),effect:{type:"splice",color:"#f59e0b",amount:50,angle:45}},{id:"retro",name:"复古投影",backdrop:"#fef3c7",textFill:Hn("#ea580c"),effect:{type:"offset",color:"#1c1917",amount:45,angle:45}},{id:"echo",name:"回声",backdrop:"#f5f3ff",textFill:Hn("#6d28d9"),effect:{type:"echo",color:"#6d28d9",amount:45,angle:0}},{id:"glitch",name:"故障",backdrop:"#0a0a0a",textFill:Hn("#ffffff"),effect:{type:"glitch",color:"#00e5ff",color2:"#ff2bd6",amount:45}},{id:"extrude",name:"立体",backdrop:"#1e1b4b",textFill:Hn("#fde047"),effect:{type:"extrude",color:"#c2410c",amount:50,angle:45}},{id:"label",name:"黑底标签",backdrop:"#f5f5f4",textFill:Hn("#ffffff"),effect:{type:"background",color:"#18181b",amount:40,radius:30}},{id:"tag",name:"黄色底块",backdrop:"#ffffff",textFill:Hn("#1c1917"),effect:{type:"background",color:"#fde047",amount:35,radius:12}},{id:"marker",name:"荧光笔",backdrop:"#ffffff",textFill:Hn("#1c1917"),effect:{type:"marker",color:"#fde68a",amount:50}},{id:"sunset",name:"日落渐变",backdrop:"#fff7ed",textFill:{type:"linear-gradient",from:"#f97316",to:"#db2777",angle:90},effect:null},{id:"aurora",name:"极光渐变",backdrop:"#0b1020",textFill:{type:"linear-gradient",from:"#22d3ee",to:"#a78bfa",angle:90},effect:{type:"neon",color:"#818cf8",amount:30}},{id:"gold",name:"金色",backdrop:"#1c1917",textFill:{type:"linear-gradient",stops:[{offset:0,color:"#fef3c7"},{offset:.55,color:"#f59e0b"},{offset:1,color:"#b45309"}],angle:180},effect:{type:"offset",color:"#78350f",amount:20,angle:90}}];function Q6(e){const n=Number.parseInt(e.backdrop.slice(1),16);return .2126*(n>>16&255)+.7152*(n>>8&255)+.0722*(n&255)<128}function J6(e){return{textFill:structuredClone(e.textFill),effect:e.effect?{...e.effect}:null,fontWeight:"bold",stroke:null,strokeWidth:null,shadow:null}}const th="linear-gradient(135deg, #f43f5e 0%, #fbbf24 45%, #38bdf8 100%)",e5=[{id:"mono",name:"黑白",filter:{grayscale:1,contrast:1.1}},{id:"vintage",name:"复古",filter:{sepia:.45,contrast:1.05,brightness:1.05}},{id:"sunny",name:"暖阳",filter:{sepia:.25,saturation:1.2,brightness:1.05}},{id:"cool",name:"冷调",filter:{hue:345,saturation:1.05,brightness:1.02}},{id:"film",name:"胶片",filter:{sepia:.2,saturation:1.25,contrast:.95,brightness:1.05}},{id:"faded",name:"褪色",filter:{saturation:.6,contrast:.85,brightness:1.12}},{id:"punch",name:"高对比",filter:{contrast:1.4,saturation:1.2}},{id:"soft",name:"柔焦",filter:{blur:2,brightness:1.05}}];function t5(e){return V1(e.filter)}const n5={png:"PNG",jpeg:"JPG",pdf:"PDF"};function r5({disabled:e,exporting:n,progress:r,pageCount:s,prefs:l,onPrefsChange:o,onExportCurrent:c,onExportAll:f,onExportLong:h,onExportGrid:g,onShare:x}){const[m,j]=p.useState(!1),k=p.useRef(null);qs(k,m,()=>j(!1));const v=r?i("导出 {current}/{total}",r):n?i("导出中…"):i("导出");return t.jsxs("div",{className:"ff-export",ref:k,children:[t.jsxs("button",{className:"toolbar-primary editor-primary ff-export-trigger",type:"button","data-testid":"freeform-export","aria-haspopup":"dialog","aria-expanded":m,"aria-label":v,disabled:e,onClick:()=>j(w=>!w),children:[t.jsx(li,{}),t.jsx("span",{className:"editor-primary-label",children:v}),t.jsx(hd,{className:"ff-export-chevron"})]}),m&&t.jsxs("div",{className:"ff-export-panel",role:"dialog","aria-label":i("导出"),"data-testid":"freeform-export-options",onKeyDown:w=>{w.key==="Escape"&&(w.preventDefault(),w.stopPropagation(),j(!1))},children:[t.jsxs("div",{className:"ff-export-row",children:[t.jsx("span",{className:"field-label",children:i("格式")}),t.jsx("div",{className:"seg stretch",children:["png","jpeg","pdf"].map(w=>t.jsx("button",{type:"button",className:l.exportFormat===w?"seg-btn on":"seg-btn","aria-pressed":l.exportFormat===w,"data-testid":`export-format-${w}`,onClick:()=>o({exportFormat:w}),children:n5[w]},w))})]}),t.jsxs("div",{className:"ff-export-row",children:[t.jsx("span",{className:"field-label",children:i("倍率")}),t.jsx("div",{className:"seg stretch",children:[1,2].map(w=>t.jsxs("button",{type:"button",className:l.exportScale===w?"seg-btn on":"seg-btn","aria-pressed":l.exportScale===w,"data-testid":`export-scale-${w}x`,onClick:()=>o({exportScale:w}),children:[w,"x"]},w))})]}),l.exportFormat!=="png"&&t.jsxs("div",{className:"ff-export-row",children:[t.jsx("span",{className:"field-label",children:i("质量")}),t.jsxs("div",{className:"paint-row",children:[t.jsx("input",{className:"paint-range","data-testid":"export-quality-range",type:"range",min:50,max:100,value:Math.round(l.exportQuality*100),onChange:w=>o({exportQuality:Number(w.currentTarget.value)/100}),"aria-label":i("导出质量")}),t.jsxs("span",{className:"export-quality-value",children:[Math.round(l.exportQuality*100),"%"]})]})]}),t.jsxs("div",{className:"ff-export-actions",children:[t.jsxs("button",{className:"accent",type:"button","data-testid":"freeform-primary-export",disabled:e||n,onClick:c,children:[t.jsx(li,{}),i("下载当前页")]}),t.jsxs("button",{className:"ghost",type:"button","data-testid":"freeform-export-all",disabled:e||n,onClick:f,children:[t.jsx(Z2,{}),r?i("导出 {current}/{total}",r):l.exportFormat==="pdf"?i("下载全部 {n} 页",{n:s}):i("打包下载全部 {n} 页",{n:s})]}),l.exportFormat!=="pdf"&&t.jsxs("button",{className:"ghost",type:"button","data-testid":"freeform-export-long",disabled:e||n,onClick:h,children:[t.jsx(U2,{}),i("拼成一张长图")]}),l.exportFormat!=="pdf"&&g&&t.jsxs("button",{className:"ghost",type:"button","data-testid":"freeform-export-grid",disabled:e||n,onClick:g,children:[t.jsx(Y2,{}),i("切成九宫格")]}),x&&t.jsxs("button",{className:"ghost",type:"button","data-testid":"freeform-export-share",disabled:e||n,onClick:x,children:[t.jsx(xm,{}),i("分享链接")]})]})]})]})}function a5({slideCount:e,activeSlideName:n,countMatches:r,onApply:s,onClose:l}){const[o,c]=p.useState(""),[f,h]=p.useState(""),[g,x]=p.useState("deck"),[m,j]=p.useState(null),k=p.useRef(null),v=o===""?null:r(o,g);p.useEffect(()=>{var M;(M=k.current)==null||M.focus();const N=I=>{I.key==="Escape"&&(I.preventDefault(),l())};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[l]),p.useEffect(()=>{j(null)},[o,f,g]);const w=()=>{o===""||!v||j(s(o,f,g))};return t.jsx("div",{className:"modal-backdrop","data-testid":"find-replace-scrim",onClick:N=>{N.target===N.currentTarget&&l()},children:t.jsxs("div",{className:"modal find-replace-modal",role:"dialog","aria-modal":"true","aria-label":i("查找替换"),"data-testid":"find-replace-dialog",children:[t.jsx("div",{className:"modal-head",children:t.jsx("h3",{children:i("查找替换")})}),t.jsxs("label",{className:"field find-replace-field",children:[t.jsx("span",{className:"field-label",children:i("查找")}),t.jsx("input",{ref:k,"data-testid":"find-input",type:"text",value:o,onChange:N=>c(N.target.value),onKeyDown:N=>{N.key==="Enter"&&w()}})]}),t.jsxs("label",{className:"field",children:[t.jsx("span",{className:"field-label",children:i("替换为")}),t.jsx("input",{"data-testid":"replace-input",type:"text",value:f,onChange:N=>h(N.target.value),onKeyDown:N=>{N.key==="Enter"&&w()}})]}),t.jsxs("div",{className:"seg stretch",role:"group","aria-label":i("范围"),children:[t.jsx("button",{type:"button",className:g==="deck"?"seg-btn on":"seg-btn","aria-pressed":g==="deck","data-testid":"find-scope-deck",onClick:()=>x("deck"),children:i("整套作品")}),t.jsxs("button",{type:"button",className:g==="slide"?"seg-btn on":"seg-btn","aria-pressed":g==="slide","data-testid":"find-scope-slide",onClick:()=>x("slide"),children:[i("仅当前页"),e>1?`(${n})`:""]})]}),t.jsx("p",{className:"find-replace-result","data-testid":"find-replace-result","aria-live":"polite",children:m?[i("已替换 {n} 处",{n:m.replaced}),...m.skipped>0?[i("{n} 处换完超出字数上限,没有替换",{n:m.skipped})]:[]].join(" · "):v===null?"":v===0?i("没有找到要替换的文字"):i("找到 {n} 处",{n:v})}),t.jsxs("div",{className:"modal-actions",children:[t.jsx("button",{type:"button",className:"ghost",onClick:l,children:i("关闭")}),t.jsx("button",{type:"button",className:"primary","data-testid":"find-replace-apply",disabled:!v,onClick:w,children:i("全部替换")})]})]})})}const i5=[{hours:1,label:"1 小时"},{hours:6,label:"6 小时"},{hours:24,label:"1 天"},{hours:168,label:"7 天"},{hours:720,label:"30 天"}],Yo=24*30;function s5(e){const n=new Date(e),r=Number.isFinite(n.getTime())?n:null;return r?r.toLocaleDateString(Bs(),{year:"numeric",month:"long",day:"numeric"}):""}function g0({share:e,creating:n,progress:r,slideCount:s,revoking:l,error:o,onCreate:c,onRevoke:f,onClose:h}){const g=p.useId(),[x,m]=p.useState(24),[j,k]=p.useState("24"),[v,w]=p.useState(null),[N,M]=p.useState(!1),I=p.useRef(null),F=p.useRef(null);p.useEffect(()=>{if(!e)return;let H=!1;return Ed(()=>import("./paginate-CrvyT_J7.js").then(P=>P.b),__vite__mapDeps([1,2])).then(P=>P.toDataURL(e.url,{margin:1,width:256})).then(P=>{H||w(P)}).catch(()=>{}),()=>{H=!0}},[e]),p.useEffect(()=>{var U;const H=document.activeElement instanceof HTMLElement?document.activeElement:null;(U=e?I.current:F.current)==null||U.focus();const P=K=>{K.key!=="Escape"||l||n||(K.preventDefault(),h())};return window.addEventListener("keydown",P),()=>{window.removeEventListener("keydown",P),H!=null&&H.isConnected&&H.focus()}},[e,h,l,n]);async function z(){try{await navigator.clipboard.writeText(e.url),M(!0)}catch{M(!1)}}const A=x==="custom"?Number(j):x,T=Number.isInteger(A)&&A>=1&&A<=Yo,L=e?s5(e.expiresAt):"";return t.jsx("div",{className:"modal-backdrop",children:t.jsx("div",{className:"modal share-modal",role:"dialog","aria-modal":"true","aria-labelledby":g,"data-testid":"freeform-share-dialog",children:e?t.jsxs(t.Fragment,{children:[t.jsx("h3",{id:g,className:"confirm-title",children:i("分享链接已创建")}),t.jsxs("p",{className:"confirm-body",children:[i("手机扫码或在浏览器打开链接就能看这 {n} 张卡片,长按图片可以保存到相册。",{n:e.imageCount}),L?i("有效期到 {date}。",{date:L}):"",i("链接已被打开 {n} 次。",{n:e.views})]}),v?t.jsx("img",{className:"share-qr",src:v,alt:i("分享二维码"),"data-testid":"share-qr"}):t.jsx("div",{className:"share-qr share-qr-pending","aria-hidden":"true","data-testid":"share-qr-pending"}),t.jsxs("label",{className:"share-link-label",htmlFor:"share-link-input",children:[t.jsx("span",{className:"field-label",children:i("链接")}),t.jsx("input",{id:"share-link-input",className:"share-link-input",type:"text",readOnly:!0,value:e.url,onFocus:H=>H.currentTarget.select(),"data-testid":"share-link-input"})]}),t.jsxs("div",{className:"modal-foot",children:[t.jsx("button",{className:"ghost",type:"button",onClick:()=>void f(),disabled:l,"data-testid":"share-revoke",children:l?i("正在撤销…"):i("撤销分享")}),t.jsx("button",{ref:I,className:"accent",type:"button",onClick:()=>void z(),"data-testid":"share-copy",children:N?i("已复制"):i("复制链接")}),t.jsx("button",{className:"ghost",type:"button",onClick:h,disabled:l,children:i("完成")})]})]}):t.jsxs(t.Fragment,{children:[t.jsx("h3",{id:g,className:"confirm-title",children:i("分享链接")}),t.jsx("p",{className:"confirm-body",children:i("生成一个不用登录就能打开的链接,手机扫码或在浏览器点开,就能看这 {n} 张卡片。",{n:s})}),t.jsxs("div",{className:"share-expiry-row",children:[t.jsx("span",{className:"field-label",children:i("有效期")}),t.jsxs("div",{className:"seg stretch",children:[i5.map(({hours:H,label:P})=>t.jsx("button",{type:"button",className:x===H?"seg-btn on":"seg-btn","aria-pressed":x===H,"data-testid":`share-expiry-${H}h`,disabled:n,onClick:()=>m(H),children:i(P)},H)),t.jsx("button",{type:"button",className:x==="custom"?"seg-btn on":"seg-btn","aria-pressed":x==="custom","data-testid":"share-expiry-custom",disabled:n,onClick:()=>m("custom"),children:i("自定义")})]})]}),x==="custom"&&t.jsxs("div",{className:"share-days-row",children:[t.jsx("input",{className:"share-days-input","data-testid":"share-expiry-hours",type:"number",min:1,max:Yo,step:1,value:j,disabled:n,"aria-label":i("自定义小时数"),onChange:H=>k(H.currentTarget.value)}),t.jsx("span",{className:"share-days-suffix",children:i("小时")}),!T&&t.jsx("span",{className:"share-days-hint",children:i("最长 {h} 小时({d} 天)",{h:Yo,d:Yo/24})})]}),o&&t.jsx("p",{className:"share-error",role:"alert",children:o}),n&&r&&t.jsx("p",{className:"confirm-body",children:i("正在生成 {current}/{total} 页…",r)}),t.jsxs("div",{className:"modal-foot",children:[t.jsx("button",{className:"ghost",type:"button",onClick:h,disabled:n,children:i("取消")}),t.jsx("button",{ref:F,className:"accent",type:"button","data-testid":"share-create",disabled:n||s===0||!T,onClick:()=>c(A),children:n?i("正在生成…"):i("生成链接")})]})]})})})}function x0({ownerId:e,draftId:n,onRestored:r,onClose:s}){const l=Ks(),o=p.useId(),[c,f]=p.useState(null),[h,g]=p.useState(null),[x,m]=p.useState(null),[j,k]=p.useState(!1),[v,w]=p.useState(null);p.useEffect(()=>{let M=!1;return xt(e).drafts.listVersions(e,n).then(I=>{M||(f(I),g(null))},I=>{M||g(vn(I,l("暂时无法读取历史版本,请稍后重试")))}),()=>{M=!0}},[e,n]),p.useEffect(()=>{const M=I=>{I.key!=="Escape"||x||j||(I.preventDefault(),s())};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[s,x,j]);async function N(M){k(!0),w(null);try{const I=await xt(e).drafts.restoreVersion(e,n,M.id);m(null),r(I)}catch(I){w(vn(I,l("恢复失败,请稍后重试")))}finally{k(!1)}}return t.jsxs("div",{className:"modal-backdrop",children:[t.jsxs("div",{className:"modal token-dialog",role:"dialog","aria-modal":"true","aria-labelledby":o,"data-testid":"draft-history-dialog",children:[t.jsx("h3",{id:o,className:"confirm-title",children:l("历史版本")}),t.jsx("p",{className:"confirm-body",children:l("服务端每隔一段时间自动存一份旧内容(最多保留 30 个)。恢复哪个,哪个就成为当前内容;被替换的内容也会先存成一个版本。")}),v&&t.jsx("p",{className:"share-error",role:"alert",children:v}),h?t.jsx("p",{className:"share-error",role:"alert",children:h}):c===null?t.jsx("p",{className:"confirm-body","data-testid":"draft-history-loading",children:l("读取中…")}):c.length===0?t.jsx("p",{className:"confirm-body","data-testid":"draft-history-empty",children:l("还没有历史版本——编辑并保存一段时间后,这里会出现可以回去的版本。")}):t.jsx("ul",{className:"token-list","data-testid":"draft-history-list",children:c.map(M=>t.jsxs("li",{className:"token-row",children:[t.jsxs("div",{className:"token-main",children:[t.jsx("span",{className:"token-name",children:M.title||l("未命名")}),t.jsxs("span",{className:"token-sub",children:[new Date(M.createdAt).toLocaleString(),M.mode==="markdown-card"?` · ${l("Markdown")}`:""]})]}),t.jsx("button",{type:"button",className:"ghost","data-testid":"draft-history-restore",disabled:j,onClick:()=>m(M),children:l("恢复")})]},M.id))}),t.jsx("div",{className:"modal-foot",children:t.jsx("button",{type:"button",className:"ghost",onClick:s,disabled:j,children:l("关闭")})})]}),x&&t.jsx(fi,{title:l("恢复这个版本?"),body:l("当前内容会被替换(替换前也会存成一个版本,随时能再换回来)。"),confirmLabel:l(j?"正在恢复…":"恢复"),onConfirm:()=>void N(x),onCancel:()=>m(null)})]})}const o5=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]'].join(", ");function b0(e){if(!(e instanceof Element))return!1;if(e.closest(o5))return!0;const n=e.closest("label");return n instanceof HTMLLabelElement&&n.control!==null&&!n.control.matches(":disabled")}function ol({isActive:e,testId:n,label:r,options:s,onSelect:l,onEscape:o,icon:c}){const f=p.useRef(null),h=p.useRef(null),g=p.useRef([]),x=p.useRef(null),m=p.useRef(e),j=p.useRef(!1),[k,v]=p.useState(!1),w=`${n}-menu`;m.current=e;function N(){x.current!==null&&(window.cancelAnimationFrame(x.current),x.current=null)}function M(){m.current&&(N(),x.current=window.requestAnimationFrame(()=>{var T;x.current=null,m.current&&((T=h.current)==null||T.focus())}))}function I(T){v(!1),T&&M()}function F(){!e||s.length===0||(j.current=!1,v(!0))}function z(T){j.current||(j.current=!0,l(T),I(!0))}function A(T){var P;const L=s.length;if(L===0)return;const H=(T+L)%L;(P=g.current[H])==null||P.focus()}return p.useEffect(()=>{var T;!k||!e||(T=g.current[0])==null||T.focus()},[k,e]),p.useEffect(()=>{e||(N(),v(!1))},[e]),p.useEffect(()=>()=>{N()},[]),p.useEffect(()=>{if(!k||!e)return;function T(L){const H=f.current;!H||H.contains(L.target)||I(!b0(L.target))}return window.addEventListener("pointerdown",T,!0),()=>window.removeEventListener("pointerdown",T,!0)},[k,e]),t.jsxs("div",{className:"freeform-insert-menu-control",ref:f,children:[t.jsxs("button",{ref:h,className:"freeform-insert-trigger",type:"button","data-testid":n,"data-freeform-toolbar-flyout-trigger":"","aria-haspopup":"menu","aria-expanded":k,"aria-controls":w,onClick:()=>k?I(!1):F(),children:[c,t.jsx("span",{children:i(r)}),t.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",children:t.jsx("path",{d:"m3 4.5 3 3 3-3"})})]}),k&&t.jsx("div",{className:"freeform-insert-menu",id:w,role:"menu","aria-label":i(r),onKeyDown:T=>{const L=g.current.findIndex(H=>H===globalThis.document.activeElement);if(T.key==="Tab"){I(!1);return}if(T.key==="ArrowDown"){T.preventDefault(),T.stopPropagation(),A(L+1);return}if(T.key==="ArrowUp"){T.preventDefault(),T.stopPropagation(),A(L<0?s.length-1:L-1);return}T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),I(o===void 0),o==null||o())},children:s.map((T,L)=>t.jsxs("button",{ref:H=>{g.current[L]=H},className:"freeform-insert-menu-item",type:"button",role:"menuitem",tabIndex:-1,"data-testid":T.testId,onClick:()=>z(T.id),children:[T.icon,t.jsx("span",{children:i(T.label)})]},T.id))})]})}const l5={rotate:t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M13 8a5 5 0 1 1-1.46-3.54"}),t.jsx("path",{d:"M13 2.5v3h-3"})]}),radius:t.jsx("path",{d:"M3 13.5V8.5a5.5 5.5 0 0 1 5.5-5.5h5"}),opacity:t.jsxs(t.Fragment,{children:[t.jsx("circle",{cx:"8",cy:"8",r:"5.5"}),t.jsx("path",{d:"M8 2.5a5.5 5.5 0 0 1 0 11z",fill:"currentColor",stroke:"none"})]}),stroke:t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M2.5 3.75h11",strokeWidth:"1"}),t.jsx("path",{d:"M2.5 7.75h11",strokeWidth:"1.75"}),t.jsx("path",{d:"M2.5 12.25h11",strokeWidth:"2.5"})]}),"font-size":t.jsx("path",{d:"m1.75 13 3.5-9 3.5 9M3 10h4.5M10 13l2.25-5.5L14.5 13M10.75 11.25h3"}),"line-height":t.jsx("path",{d:"M2.5 2.75h11M2.5 13.25h11M8 5.25v5.5M6.25 7 8 5.25 9.75 7M6.25 9 8 10.75 9.75 9"}),"letter-spacing":t.jsx("path",{d:"M2 2.5v11M14 2.5v11M5.25 11.5 8 4.5l2.75 7M6.1 9.25h3.8"}),blur:t.jsx("path",{d:"M8 2.25c2.6 3.1 4 5.1 4 7.1a4 4 0 0 1-8 0c0-2 1.4-4 4-7.1z"}),dash:t.jsx("path",{d:"M1.75 8h2.5M6.75 8h2.5M11.75 8h2.5"}),"paragraph-spacing":t.jsx("path",{d:"M2.5 2.75h7M2.5 5h5M2.5 11h7M2.5 13.25h5M12.5 5.25v5.5M11 6.75l1.5-1.5 1.5 1.5M11 9.25l1.5 1.5 1.5-1.5"})};function zn({name:e}){return t.jsx("svg",{className:"field-glyph",viewBox:"0 0 16 16","aria-hidden":"true",children:l5[e]})}const $d=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform),y0=$d?"⌫":"Del";function Bn(e,n={}){return $d?`${n.alt?"⌥":""}${n.shift?"⇧":""}${n.mod?"⌘":""}${e}`:[n.mod&&"Ctrl",n.shift&&"Shift",n.alt&&"Alt",e].filter(Boolean).join("+")}function c5(e){return e.key.toLowerCase()!=="v"||e.altKey?!1:$d?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}const nh=[{id:"rect",label:"矩形"},{id:"ellipse",label:"圆形"},{id:"triangle",label:"三角形"},{id:"diamond",label:"菱形"},{id:"pentagon",label:"五边形"},{id:"hexagon",label:"六边形"},{id:"star",label:"五角星"},{id:"heart",label:"心形"},{id:"bubble",label:"对话气泡"}],d5=[{id:"left",label:"左对齐",icon:"M4 3v14M7 6.5h9M7 13.5h5.5"},{id:"h-center",label:"水平居中",icon:"M10 3v14M5 6.5h10M6.75 13.5h6.5"},{id:"right",label:"右对齐",icon:"M16 3v14M4 6.5h9M7.5 13.5H13"},{id:"top",label:"顶对齐",icon:"M3 4h14M6.5 7v9M13.5 7v5.5"},{id:"v-center",label:"垂直居中",icon:"M3 10h14M6.5 5v10M13.5 6.75v6.5"},{id:"bottom",label:"底对齐",icon:"M3 16h14M6.5 4v9M13.5 7.5V13"},{id:"distribute-h",label:"水平均分",icon:"M4 4v12M16 4v12M8.5 7h3v6h-3z"},{id:"distribute-v",label:"垂直均分",icon:"M4 4h12M4 16h12M7 8.5h6v3H7z"}],u5=[{id:"front",label:"置于顶层",icon:"M10 16V7M6.5 10.5 10 7l3.5 3.5M5 3.5h10"},{id:"forward",label:"上移一层",icon:"M10 15.5V5.5M6.5 9 10 5.5 13.5 9"},{id:"backward",label:"下移一层",icon:"M10 4.5v10M6.5 11 10 14.5l3.5-3.5"},{id:"back",label:"移到底层",icon:"M10 4v9M6.5 9.5 10 13l3.5-3.5M5 16.5h10"}],f5=[{id:"left",label:"文字左对齐",icon:"M2.5 4h11M2.5 8h7M2.5 12h9"},{id:"center",label:"文字居中",icon:"M2.5 4h11M4.5 8h7M3.5 12h9"},{id:"right",label:"文字右对齐",icon:"M2.5 4h11M6.5 8h7M4.5 12h9"},{id:"justify",label:"文字两端对齐",icon:"M2.5 4h11M2.5 8h11M2.5 12h7"}],h5={none:"bullet",bullet:"number",number:null},m5={bullet:"M6 4h7.5M6 8h7.5M6 12h7.5M2.75 4h.01M2.75 8h.01M2.75 12h.01",number:"M6 4h7.5M6 8h7.5M6 12h7.5M2.25 3l.9-.6v3.1M2 8.4c.25-.55 1.75-.6 1.75.3 0 .65-1.75 1.15-1.75 1.8h1.85"};function ln({d:e,viewBox:n="0 0 20 20"}){return t.jsx("svg",{className:"ctx-icon",viewBox:n,"aria-hidden":"true",children:t.jsx("path",{d:e})})}function Cn({className:e}){return t.jsx("span",{className:e?`ctx-divider ${e}`:"ctx-divider","aria-hidden":"true"})}const p5=6;function rh(e){const n=Number.parseFloat(getComputedStyle(e).minHeight)+1,r=[];for(e.removeAttribute("data-fold");e.offsetHeight>n&&r.length<p5;)r.push(String(r.length+1)),e.setAttribute("data-fold",r.join(" "))}function ba({label:e,glyph:n,value:r,min:s,max:l,unit:o,resetKey:c,className:f,onCommit:h}){return t.jsxs("label",{className:f?`ctx-number ${f}`:"ctx-number",title:e,children:[n.length<=2?t.jsx("span",{className:"field-glyph","aria-hidden":"true",children:n}):t.jsx(zn,{name:n}),t.jsx(Ct,{ariaLabel:e,value:r,min:s,max:l,resetKey:c,onCommit:h}),o&&t.jsx("span",{className:"ctx-unit","aria-hidden":"true",children:o})]})}function ya({label:e,pressed:n,disabled:r,title:s,testId:l,className:o,onClick:c,children:f}){return t.jsx("button",{type:"button",className:o?`ctx-btn ${o}`:"ctx-btn","aria-label":e,"aria-pressed":n,title:s??e,disabled:r,"data-testid":l,onClick:c,children:f})}function On({icon:e,label:n}){return t.jsxs("span",{className:"ctx-subject","data-testid":"freeform-context-subject",children:[e,t.jsx("span",{children:n})]})}function g5(e){var h,g;const{subject:n,resetKey:r,suspended:s=!1}=e,l=wl(),o=n.kind!=="page",c=p.useRef(null);p.useEffect(()=>{const x=c.current;x&&(s?x.setAttribute("inert",""):x.removeAttribute("inert"))},[s]);const f=[n.kind,"node"in n?n.node.id:"",n.kind==="shape"?`${n.node.shape} ${n.node.fill.type}`:"","name"in n?n.name:"","count"in n?n.count:"",e.canAlign,cl()].join("|");return p.useLayoutEffect(()=>{c.current&&rh(c.current)},[f]),p.useEffect(()=>{const x=c.current,m=x==null?void 0:x.parentElement;if(!x||!m)return;let j=-1;const k=new ResizeObserver(()=>{const v=m.getBoundingClientRect().width;v!==j&&(j=v,rh(x))});return k.observe(m),()=>k.disconnect()},[]),t.jsxs("div",{ref:c,className:`freeform-context-toolbar${s?" is-suspended":""}`,role:"toolbar","aria-label":i("对象工具条"),"data-testid":"freeform-context-toolbar","data-subject":n.kind,children:[t.jsxs("div",{className:"ctx-group",children:[n.kind==="text"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(km,{}),label:i("文本")}),t.jsx(Cn,{}),t.jsx("div",{className:"ctx-font",children:t.jsx(qr,{value:Id(n.node.fontFamily),onChange:e.onFontFamily,title:i("字体"),testId:"ctx-font-select",previewFonts:!0,options:u0(l,{current:n.node.fontFamily,withImport:!0})})}),t.jsxs("div",{className:"ctx-stepper",children:[t.jsx("button",{type:"button",className:"ctx-btn is-small ctx-fold-details","aria-label":i("缩小字号"),title:i("缩小字号"),onClick:()=>e.onProperty({property:"fontSize",value:nd(n.fontSize,-1)}),children:t.jsx(ln,{d:"M5 10h10"})}),t.jsx(ba,{label:i("文字大小"),glyph:"font-size",value:n.fontSize,min:Number.MIN_VALUE,max:Number.MAX_VALUE,resetKey:r,onCommit:x=>e.onProperty({property:"fontSize",value:x})}),t.jsx("button",{type:"button",className:"ctx-btn is-small ctx-fold-details","aria-label":i("放大字号"),title:i("放大字号"),onClick:()=>e.onProperty({property:"fontSize",value:nd(n.fontSize,1)}),children:t.jsx(ln,{d:"M10 5v10M5 10h10"})})]}),t.jsx(vt,{label:i("文字填充颜色"),testId:"ctx-text-color",variant:"text",color:oi(n.node.textFill),onChange:x=>e.onStyle({textFill:{type:"solid",color:x}})}),t.jsx(Cn,{}),t.jsx(ya,{label:i("加粗文字"),pressed:n.node.fontWeight==="bold",onClick:()=>e.onStyle({fontWeight:n.node.fontWeight==="bold"?"normal":"bold"}),children:t.jsx("b",{className:"ctx-glyph",children:"B"})}),t.jsx(ya,{label:i("倾斜文字"),pressed:n.node.italic===!0,onClick:()=>e.onStyle({italic:!n.node.italic}),children:t.jsx("i",{className:"ctx-glyph is-italic",children:"I"})}),f5.map(x=>t.jsx(ya,{label:i(x.label),className:"ctx-text-align",pressed:n.node.align===x.id,onClick:()=>e.onStyle({align:x.id}),children:t.jsx(ln,{viewBox:"0 0 16 16",d:x.icon})},x.id)),t.jsx(ya,{label:i(n.node.list==="number"?"编号列表":n.node.list==="bullet"?"项目符号列表":"列表"),className:"ctx-text-align",testId:"ctx-text-list",pressed:n.node.list!==void 0,onClick:()=>e.onStyle({list:h5[n.node.list??"none"]}),children:t.jsx(ln,{viewBox:"0 0 16 16",d:m5[n.node.list==="number"?"number":"bullet"]})})]}),n.kind==="shape"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(Sm,{}),label:i("形状")}),t.jsx(Cn,{}),t.jsx(ol,{isActive:e.isActive,testId:"ctx-shape-menu",label:i(((h=nh.find(x=>x.id===n.node.shape))==null?void 0:h.label)??"形状"),icon:t.jsx(_i,{shape:n.node.shape}),options:nh.map(x=>({id:x.id,label:x.label,icon:t.jsx(_i,{shape:x.id})})),onSelect:x=>e.onStyle({shape:x})}),n.node.fill.type==="image"?t.jsxs("button",{type:"button",className:"ctx-btn is-text","data-testid":"ctx-adjust-framing",disabled:!n.canFrame,title:n.canFrame?i("调整取景"):n.frameDisabledReason??void 0,onClick:e.onAdjustFraming,children:[t.jsx(ln,{d:"M6 2.5V14h11.5M2.5 6H14v11.5"}),t.jsx("span",{children:i("调整取景")})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"ctx-label",children:i("填充")}),t.jsx(vt,{label:i("形状填充颜色"),testId:"ctx-shape-fill",color:n.node.fill.type==="transparent"?"transparent":oi(n.node.fill),onChange:x=>e.onShapeFill({type:"solid",color:x})})]}),t.jsx("span",{className:"ctx-label",children:i("描边")}),t.jsx(vt,{label:i("形状轮廓颜色"),testId:"ctx-shape-stroke",color:n.node.stroke,onChange:x=>e.onStyle({stroke:x})}),t.jsx(ba,{label:i("轮廓粗细"),glyph:"stroke",value:n.strokeWidth,min:0,max:Number.MAX_VALUE,resetKey:r,className:"ctx-fold-details",onCommit:x=>e.onProperty({property:"strokeWidth",value:x})}),n.node.shape==="rect"&&t.jsx(ba,{label:i("转角弧度"),glyph:"radius",value:((g=n.node.cornerRadii)==null?void 0:g.topLeft)??n.node.cornerRadius??16,min:0,max:2e3,resetKey:r,className:"ctx-fold-details",onCommit:x=>e.onStyle({cornerRadius:x,cornerRadii:null})}),n.node.shape==="star"&&t.jsx(ba,{label:i("星角内径"),glyph:"radius",value:Math.round((n.node.starInnerRatio??.38)*100),min:15,max:85,unit:"%",resetKey:r,className:"ctx-fold-details",onCommit:x=>e.onStyle({starInnerRatio:x/100})}),n.node.shape==="bubble"&&t.jsx(ba,{label:i("尾巴位置"),glyph:"radius",value:Math.round((n.node.bubbleTailX??.5)*100),min:5,max:95,unit:"%",resetKey:r,className:"ctx-fold-details",onCommit:x=>e.onStyle({bubbleTailX:x/100})})]}),n.kind==="image"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(vm,{}),label:i("图片")}),t.jsx(Cn,{}),t.jsxs("button",{type:"button",className:"ctx-btn is-text","data-testid":"ctx-crop",disabled:!n.canCrop,title:n.canCrop?i("裁剪图片"):n.cropDisabledReason??void 0,onClick:e.onCrop,children:[t.jsx(ln,{d:"M6 2.5V14h11.5M2.5 6H14v11.5"}),t.jsx("span",{children:i("裁剪")})]}),t.jsx("div",{className:"ctx-seg",role:"group","aria-label":i("图片填充方式"),children:["cover","contain"].map(x=>t.jsx("button",{type:"button",className:n.node.fit===x?"ctx-seg-btn on":"ctx-seg-btn","aria-pressed":n.node.fit===x,onClick:()=>e.onStyle({fit:x}),children:x==="cover"?i("填满"):i("适应")},x))})]}),n.kind==="chart"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(ln,{d:"M4 16V9M10 16V4M16 16v-4"}),label:n.node.chartKind==="ring"?i("环形图"):n.node.chartKind==="line"?i("折线图"):i("柱状图")}),t.jsx(Cn,{})]}),n.kind==="table"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(ln,{d:"M3 4h18v16H3zM3 9.3h18M3 14.6h18M9 4v16M15 4v16"}),label:i("表格")}),t.jsx(Cn,{})]}),n.kind==="timeline"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(ln,{d:"M6 4v16M6 7h9M6 12h12M6 17h8"}),label:i("时间线")}),t.jsx(Cn,{})]}),n.kind==="progress"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(ln,{d:"M4 12a8 8 0 1 1 8 8"}),label:i("进度")}),t.jsx(Cn,{})]}),n.kind==="qrcode"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(ln,{d:"M3.5 3.5h4v4h-4zM12.5 3.5h4v4h-4zM3.5 12.5h4v4h-4zM11 11h2v2h-2zM14.5 14.5h2v2h-2zM11 14.5h2v2h-2zM14.5 11h2v2h-2z"}),label:i("二维码")}),t.jsx(Cn,{})]}),n.kind==="line"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(V2,{}),label:n.node.lineKind==="arrow"?i("箭头"):i("直线")}),t.jsx(Cn,{}),t.jsx("span",{className:"ctx-label",children:i("颜色")}),t.jsx(vt,{label:i("线条描边颜色"),testId:"ctx-line-stroke",color:n.node.stroke,onChange:x=>e.onStyle({stroke:x})}),t.jsx(ba,{label:i("线条粗细"),glyph:"stroke",value:n.strokeWidth,min:Number.MIN_VALUE,max:Number.MAX_VALUE,resetKey:r,className:"ctx-fold-details",onCommit:x=>e.onProperty({property:"strokeWidth",value:x})}),t.jsx(ya,{label:i("末端箭头"),pressed:n.node.lineKind==="arrow",onClick:()=>e.onStyle({lineKind:n.node.lineKind==="arrow"?"line":"arrow"}),children:t.jsx(ln,{d:"M3 10h13M12 6l4 4-4 4"})})]}),n.kind==="path"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(G2,{}),label:i("图形")}),t.jsx(Cn,{}),n.node.fill.type==="image"?t.jsxs("button",{type:"button",className:"ctx-btn is-text","data-testid":"ctx-adjust-framing",disabled:!n.canFrame,title:n.canFrame?i("调整取景"):n.frameDisabledReason??void 0,onClick:e.onAdjustFraming,children:[t.jsx(ln,{d:"M6 2.5V14h11.5M2.5 6H14v11.5"}),t.jsx("span",{children:i("调整取景")})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"ctx-label",children:i("填充")}),t.jsx(vt,{label:i("图形填充颜色"),testId:"ctx-path-fill",color:n.node.fill.type==="transparent"?"transparent":oi(n.node.fill),onChange:x=>e.onStyle({fill:{type:"solid",color:x}})})]}),t.jsx("span",{className:"ctx-label",children:i("描边")}),t.jsx(vt,{label:i("图形描边颜色"),testId:"ctx-path-stroke",color:n.node.stroke,onChange:x=>e.onStyle({stroke:x})}),t.jsx(ba,{label:i("描边粗细"),glyph:"stroke",value:n.strokeWidth,min:0,max:Number.MAX_VALUE,resetKey:r,className:"ctx-fold-details",onCommit:x=>e.onProperty({property:"strokeWidth",value:x})})]}),n.kind==="group"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(ln,{d:"M3.5 3.5h6v6h-6zM10.5 10.5h6v6h-6z"}),label:n.name}),t.jsx(Cn,{}),t.jsx("button",{type:"button",className:"ctx-btn is-text",onClick:e.onUngroup,children:t.jsx("span",{children:i("取消编组")})})]}),n.kind==="multi"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(ln,{d:"M3.5 3.5h6v6h-6zM10.5 10.5h6v6h-6z"}),label:i("{n} 个对象",{n:n.count})}),t.jsx(Cn,{}),t.jsx("button",{type:"button",className:"ctx-btn is-text",disabled:!e.canGroup,onClick:e.onGroup,children:t.jsx("span",{children:i("编成一组")})})]}),n.kind==="locked"&&t.jsx(t.Fragment,{children:t.jsx(On,{icon:t.jsx(hl,{}),label:n.name})})]}),t.jsxs("div",{className:"ctx-group is-end",children:[o&&t.jsxs(t.Fragment,{children:[n.kind!=="locked"&&n.kind!=="group"&&n.kind!=="multi"&&t.jsx(ba,{label:i("透明度"),glyph:"opacity",value:Math.round((n.node.opacity??1)*100),min:0,max:100,unit:"%",resetKey:r,className:"ctx-opacity",onCommit:x=>e.onStyle({opacity:Math.round(x)/100})}),n.kind!=="locked"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"ctx-fold-menus",children:[e.canAlign&&t.jsx(ol,{isActive:e.isActive,testId:"ctx-align-menu",label:i("位置"),icon:t.jsx(ln,{d:"M4 3v14M7 6.5h9M7 13.5h5.5"}),options:d5.filter(x=>e.canDistribute||!x.id.startsWith("distribute")).map(x=>({id:x.id,label:x.label,icon:t.jsx(ln,{d:x.icon})})),onSelect:x=>{x==="distribute-h"?e.onDistribute("horizontal"):x==="distribute-v"?e.onDistribute("vertical"):e.onAlign(x)}}),t.jsx(ol,{isActive:e.isActive,testId:"ctx-order-menu",label:i("层级"),icon:t.jsx(ln,{d:"m10 3.5 6.5 3.25L10 10 3.5 6.75zM3.5 10.25 10 13.5l6.5-3.25M3.5 13.75 10 17l6.5-3.25"}),options:u5.map(x=>({id:x.id,label:x.label,icon:t.jsx(ln,{d:x.icon})})),onSelect:e.onOrder}),t.jsx(Cn,{})]}),t.jsx(ya,{label:i("复制一份"),title:i("复制一份({keys})",{keys:Bn("D",{mod:!0})}),testId:"ctx-duplicate",className:"ctx-fold-actions",onClick:e.onDuplicate,children:t.jsx(jm,{})})]}),t.jsx(ya,{label:n.kind==="locked"?i("解锁对象"):i("锁定对象"),pressed:n.kind==="locked",testId:"ctx-lock",className:n.kind==="locked"?void 0:"ctx-fold-actions",onClick:e.onToggleLock,children:t.jsx(hl,{})}),n.kind!=="locked"&&t.jsx(ya,{label:i("删除对象"),title:i("删除对象({keys})",{keys:y0}),testId:"ctx-delete",className:"ctx-fold-delete",onClick:e.onDelete,children:t.jsx(Ji,{})}),t.jsx(Cn,{className:n.kind==="locked"?void 0:"ctx-fold-delete"})]}),t.jsxs("button",{type:"button",className:"ctx-btn is-text ctx-more","data-testid":"ctx-more","aria-pressed":e.panelOpen,title:e.panelOpen?i("收起面板"):i("更多设置"),onClick:e.onTogglePanel,children:[t.jsx(O2,{}),t.jsx("span",{children:i("更多")})]})]})]})}const x5=/^Page \d+$/,sd=/^(.*\S) copy$/;function j0(e){let n=e.trim();for(let r=sd.exec(n);r;r=sd.exec(n))n=r[1];return x5.test(n)}function Rs(e,n){const r=e.trim();if(!r||j0(r))return i("第 {n} 页",{n:n+1});const s=sd.exec(r);return s?i("{name} 副本",{name:Rs(s[1],n)}):r}const b5=.03,y5=16,j5=12;function w5(e,n,r){const s=Math.max(y5,Math.round(Math.min(r.width,r.height)*b5)),l=n.flatMap(f=>{const h=G1(f);return h?[{x:h.x+h.width/2,y:h.y+h.height/2}]:[]}),o=(f,h)=>{const g=f+e.width/2,x=h+e.height/2;return l.some(m=>Math.abs(m.x-g)<s/2&&Math.abs(m.y-x)<s/2)},c=(f,h)=>f>=0&&h>=0&&f+e.width<=r.width&&h+e.height<=r.height;if(!o(e.x,e.y))return e;for(const f of[1,-1])for(let h=1;h<=j5;h+=1){const g=e.x+f*h*s,x=e.y+f*h*s;if(!c(g,x))break;if(!o(g,x))return{...e,x:Math.round(g),y:Math.round(x)}}return e}const k5=new Set(["文本","图片","形状","直线","箭头","组","图形"]);function Ir(e){var n,r;return k5.has(e)?i(e):cl()!=="en"?e:((n=R6(e))==null?void 0:n.en)??((r=xx(e))==null?void 0:r.en)??e}const ah=4,S5=8,w0=4;function v5(e){return!Number.isInteger(e)||e<1?ah:ah+Math.min(e-1,w0)*S5}function N5(e){return!Number.isInteger(e)||e<=w0+1||e>Sl?null:String(e)}function M5(e){return e.type==="text"?i("文本"):e.type==="image"?i("图片"):e.type==="line"?e.lineKind==="arrow"?i("箭头"):i("直线"):e.type==="group"?i("组合"):e.type==="path"?i("图形"):e.type==="qrcode"?i("二维码"):e.type==="chart"?e.chartKind==="ring"?i("环形图"):e.chartKind==="line"?i("折线图"):i("柱状图"):i("形状")}function k0(e,n=1){return e.type!=="group"||n>Sl?!1:e.children.some(r=>r.locked||k0(r,n+1))}function S0(e,n,r=[],s=1){const l=[];for(const o of[...e].reverse()){const c=[...r,o.id];l.push({node:o,path:c,parentPath:[...r],level:s}),o.type==="group"&&n.has(ye(c))&&l.push(...S0(o.children,n,c,s+1))}return l}function od(e,n=[]){const r=[];for(const s of e){if(s.type!=="group")continue;const l=[...n,s.id];r.push(ye(l),...od(s.children,l))}return r}function F5(e){return e.type==="group"?t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:"freeform-layer-icon",children:[t.jsx("path",{d:"M3 6.5h5l1.5 2H17v7.5H3z"}),t.jsx("path",{d:"M3 6.5V4h5l1.5 2.5"})]}):e.type==="text"?t.jsx("span",{"aria-hidden":"true",className:"freeform-layer-type-mark",children:"T"}):e.type==="image"?t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:"freeform-layer-icon",children:[t.jsx("rect",{x:"3",y:"3",width:"14",height:"14",rx:"2"}),t.jsx("circle",{cx:"7",cy:"7",r:"1.2"}),t.jsx("path",{d:"m4.5 14 3.2-3.2 2.4 2.3 1.8-1.8 3.6 3.2"})]}):e.type==="line"?t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:"freeform-layer-icon",children:[t.jsx("path",{d:"m4 16 12-12"}),e.lineKind==="arrow"&&t.jsx("path",{d:"M11 4h5v5"})]}):e.type==="path"?t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:"freeform-layer-icon",children:[t.jsx("path",{d:"M3.5 15.5c2.5-9 6-11 8-6.5s4.5 3 5-5"}),t.jsx("circle",{cx:"3.5",cy:"15.5",r:"1.3"}),t.jsx("circle",{cx:"16.5",cy:"4",r:"1.3"})]}):e.type==="qrcode"?t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:"freeform-layer-icon",children:t.jsx("path",{d:"M3.5 3.5h5v5h-5zM11.5 3.5h5v5h-5zM3.5 11.5h5v5h-5zM11 11h2.4v2.4H11zM14.1 14.1h2.4v2.4h-2.4zM11 14.1h2.4v2.4H11zM14.1 11h2.4v2.4h-2.4z"})}):e.type==="chart"?t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:"freeform-layer-icon",children:t.jsx("path",{d:"M4 16V10M10 16V4M16 16V7",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round"})}):t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:"freeform-layer-icon",children:t.jsx("path",{d:"m10 2 7 4v8l-7 4-7-4V6z"})})}function C5(e){return t.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"freeform-layer-expand-icon",children:t.jsx("path",{d:e?"m4 6 4 4 4-4":"m6 4 4 4-4 4"})})}function E5(e){return t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:"freeform-layer-action-icon",children:[t.jsx("path",{d:"M2.5 10s2.8-5 7.5-5 7.5 5 7.5 5-2.8 5-7.5 5-7.5-5-7.5-5Z"}),t.jsx("circle",{cx:"10",cy:"10",r:"2.2"}),!e&&t.jsx("path",{d:"m3 3 14 14"})]})}function z5(e){return t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:"freeform-layer-action-icon",children:[t.jsx("rect",{x:"4",y:"8",width:"12",height:"9",rx:"2"}),t.jsx("path",{d:e?"M7 8V6a3 3 0 0 1 6 0v2":"M7 8V6a3 3 0 0 1 5.7-1.3"})]})}function R5(){return t.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"freeform-layer-inherited-icon",children:[t.jsx("path",{d:"M6.2 9.8 4.8 11.2a2.1 2.1 0 0 1-3-3l2.1-2.1a2.1 2.1 0 0 1 3 0"}),t.jsx("path",{d:"m9.8 6.2 1.4-1.4a2.1 2.1 0 0 1 3 3l-2.1 2.1a2.1 2.1 0 0 1-3 0"}),t.jsx("path",{d:"m5.6 10.4 4.8-4.8"})]})}function I5({nodes:e,selectedPaths:n,hasStructuralLockedSelection:r,onSelect:s,onRename:l,onReorder:o,onDropReorder:c,onSetLocked:f,onSetHidden:h,onGroup:g,onUngroup:x}){const[m,j]=p.useState(()=>new Set(od(e))),[k,v]=p.useState(null),[w,N]=p.useState(null),[M,I]=p.useState(""),[F,z]=p.useState(""),A=p.useRef(new Map),T=p.useRef(null),L=p.useRef(null),H=p.useRef(!1),P=p.useRef(new Set),U=p.useRef([]),K=p.useId().replace(/:/g,""),D=p.useMemo(()=>S0(e,m),[e,m]),re=p.useMemo(()=>new Map(D.map(oe=>[ye(oe.path),oe])),[D]),q=p.useMemo(()=>new Set(n.map(ye)),[n]);p.useEffect(()=>{const oe=new Set(od(e)),fe=P.current;P.current=oe;const Ae=ze=>{const Xe=new Set([...ze].filter(Fe=>oe.has(Fe)));return oe.forEach(Fe=>{fe.has(Fe)||Xe.add(Fe)}),Xe.size===ze.size&&[...Xe].every(Fe=>ze.has(Fe))?ze:Xe};Ae(m)!==m&&j(Ae)},[e]),p.useEffect(()=>{if(D.length===0){v(null),U.current=D;return}if(!k){v(ye(D[0].path)),U.current=D;return}if(!re.has(k)){const oe=U.current,fe=oe.findIndex(lt=>ye(lt.path)===k),Ae=oe[fe],ze=lt=>lt.map(pt=>oe[pt]).find(pt=>pt&&re.has(ye(pt.path))&&(!Ae||ye(pt.parentPath)===ye(Ae.parentPath))),Xe=ze(Array.from({length:Math.max(0,oe.length-fe-1)},(lt,pt)=>fe+pt+1)),Fe=ze(Array.from({length:Math.max(0,fe)},(lt,pt)=>fe-pt-1)),Mt=Ae!=null&&Ae.parentPath.length?re.get(ye(Ae.parentPath)):void 0,Qe=Xe??Fe??Mt??D[0],mt=ye(Qe.path),It=document.activeElement,_t=It===null||It===document.body;v(mt),_t&&requestAnimationFrame(()=>{var lt;(document.activeElement===null||document.activeElement===document.body)&&((lt=A.current.get(mt))==null||lt.focus())})}U.current=D},[k,re,D]),p.useEffect(()=>{var fe;if(!k)return;const oe=A.current.get(k);oe&&((fe=document.activeElement)==null?void 0:fe.getAttribute("role"))==="treeitem"&&oe.focus()},[k]);function te(oe){var fe;oe&&(v(oe),(fe=A.current.get(oe))==null||fe.focus(),requestAnimationFrame(()=>{var ze;const Ae=document.activeElement;(Ae===null||Ae===document.body)&&((ze=A.current.get(oe))==null||ze.focus())}))}function be(oe){z(""),requestAnimationFrame(()=>z(oe))}function ne(oe){const fe=oe==="group"?g():x();be(fe?oe==="group"?i("所选图层已组合"):i("所选组合已解组"):oe==="group"?i("无法组合所选图层"):i("无法解组所选图层"))}function Be(oe){const fe=ye(oe);j(Ae=>{const ze=new Set(Ae);return ze.has(fe)?ze.delete(fe):ze.add(fe),ze})}function le(oe){H.current=!1,N(ye(oe.path)),I(oe.node.name),requestAnimationFrame(()=>{var Ae;const fe=(Ae=A.current.get(ye(oe.path)))==null?void 0:Ae.querySelector("input");fe instanceof HTMLInputElement&&(fe.focus(),fe.select())})}function De(oe){H.current=!1;const fe=M.trim()||M5(oe.node),Ae=l(oe.path,fe);N(null),I(""),Ae!==!1&&be(i("{name} 已重命名",{name:fe}))}function W(oe,fe){s(oe.path,{toggle:fe})===!1&&be(i("只能同时选择同一组内的图层"))}function ae(oe){const fe=D.filter(Xe=>ye(Xe.parentPath)===ye(oe.parentPath)),Ae=fe.findIndex(Xe=>ye(Xe.path)===ye(oe.path)),ze=fe[Ae+1]??fe[Ae-1]??(oe.parentPath.length>0?re.get(ye(oe.parentPath)):void 0);ze&&te(ye(ze.path))}function ke(oe,fe,Ae){h(oe.path,fe)!==!1&&(be(Ae?i(fe?"{name} 已设为自身隐藏,仍受父级隐藏影响":"{name} 已取消自身隐藏,仍受父级隐藏影响",{name:oe.node.name}):i(fe?"{name} 已隐藏":"{name} 已显示",{name:oe.node.name})),fe&&!Ae&&ae(oe))}function Ee(oe,fe,Ae){f(oe.path,fe)!==!1&&(be(Ae?i(fe?"{name} 已设为自身锁定,仍受父级锁定影响":"{name} 已取消自身锁定,仍受父级锁定影响",{name:oe.node.name}):i(fe?"{name} 已锁定":"{name} 已解锁",{name:oe.node.name})),te(ye(oe.path)))}function ue(oe,fe,Ae){const ze=fe.key,Xe=ye(oe.path);if(w!==Xe){if(fe.altKey&&(ze==="ArrowUp"||ze==="ArrowDown")){fe.preventDefault(),fe.stopPropagation();const Fe=ze==="ArrowUp"?"forward":"backward";if(o(oe.parentPath,[oe.node.id],Fe)!==!1){const Qe=D.filter(_t=>ye(_t.parentPath)===ye(oe.parentPath)),mt=Qe.findIndex(_t=>ye(_t.path)===Xe),It=Math.max(0,Math.min(Qe.length-1,mt+(Fe==="forward"?-1:1)));be(i("{name} 已移至第 {n} 层",{name:oe.node.name,n:It+1})),te(Xe)}else Ae&&be(i("图层已锁定,无法调整层级"));return}if(ze==="ArrowDown"||ze==="ArrowUp"||ze==="Home"||ze==="End"){fe.preventDefault(),fe.stopPropagation();const Fe=D.findIndex(Qe=>ye(Qe.path)===Xe),Mt=ze==="Home"?0:ze==="End"?D.length-1:Math.max(0,Math.min(D.length-1,Fe+(ze==="ArrowDown"?1:-1)));te(ye(D[Mt].path));return}if(ze==="ArrowRight"){if(fe.preventDefault(),fe.stopPropagation(),oe.node.type!=="group")return;if(!m.has(Xe)){Be(oe.path);return}const Mt=D.find(Qe=>Qe.parentPath.length===oe.path.length&&Qe.parentPath.every((mt,It)=>mt===oe.path[It]));Mt&&te(ye(Mt.path));return}if(ze==="ArrowLeft"){if(fe.preventDefault(),fe.stopPropagation(),oe.node.type==="group"&&m.has(Xe)){Be(oe.path);return}oe.parentPath.length>0&&te(ye(oe.parentPath));return}if(ze==="Enter"){fe.preventDefault(),fe.stopPropagation(),W(oe,!1);return}if(ze===" "){fe.preventDefault(),fe.stopPropagation(),W(oe,!0);return}if(ze==="F2"){fe.preventDefault(),fe.stopPropagation(),le(oe);return}}}function Ye(oe,fe){fe.preventDefault();const Ae=L.current;if(L.current=null,!Ae)return;const ze=re.get(ye(Ae));if(!ze)return;if(!(ye(ze.parentPath)===ye(oe.parentPath))){be(i("图层只能在同一组内排序"));return}if(ze.node.id===oe.node.id)return;const Fe=q.has(ye(ze.path));if(Fe&&q.has(ye(oe.path)))return;const Mt=Fe?n.filter(lt=>ye(lt.slice(0,-1))===ye(oe.parentPath)).length:1,Qe=D.filter(lt=>ye(lt.parentPath)===ye(oe.parentPath)),mt=Qe.findIndex(lt=>ye(lt.path)===ye(Ae)),It=Qe.findIndex(lt=>ye(lt.path)===ye(oe.path));if(mt<0||It<0)return;c(oe.parentPath,[ze.node.id],oe.node.id)!==!1?be(Mt>1?i("已移动 {count} 个图层至 {name} 上方",{count:Mt,name:oe.node.name}):i("{name} 已移至第 {n} 层",{name:ze.node.name,n:It+1})):Fe&&r&&be(i("图层已锁定,无法调整层级"))}function Ue(oe){return`freeform-${K}-group-${encodeURIComponent(ye(oe))}`}function Ot(oe){return`freeform-${K}-status-${encodeURIComponent(ye(oe))}`}function zt(oe,fe,Ae,ze=!1,Xe=!1){return[...oe].reverse().map(Fe=>{const Mt=[...fe,Fe.id],Qe=ye(Mt),mt={node:Fe,path:Mt,parentPath:[...fe]},It=Fe.type==="group"&&m.has(Qe),_t=q.has(Qe),lt=w===Qe,pt=N5(Ae),ee=ze||Fe.locked,He=Xe||Fe.hidden,ct=k0(Fe),Lt=ee||ct||_t&&r,bt=["freeform-layer-row",_t?"is-selected":"",ee?"is-effectively-locked":"",Lt&&!ee?"is-structurally-locked":"",He?"is-effectively-hidden":""].filter(Boolean).join(" "),gn=Ot(Mt),xn=[Fe.hidden?i("自身隐藏"):i("自身可见"),Xe?i("受父级隐藏影响,当前隐藏"):Fe.hidden?i("当前隐藏"):i("当前可见"),Fe.locked?i("自身锁定"):i("自身未锁定"),ze?i("受父级锁定影响,当前锁定"):Fe.locked?i("当前锁定"):i("当前未锁定"),ct?i("包含锁定后代,结构只读"):_t&&r?i("当前选择包含锁定图层,结构只读"):""].join(i(";")),$t=i("隐藏图层 {name}",{name:Fe.name}),Zn=i(Fe.hidden?"显示 {name}":"隐藏 {name}",{name:Fe.name}),se=i("锁定图层 {name}",{name:Fe.name}),ve=i(Fe.locked?"解锁 {name}":"锁定 {name}",{name:Fe.name}),ce=[Xe?i("隐藏"):"",ze?i("锁定"):""].filter(Boolean).join(i("和"));return t.jsxs("div",{className:"freeform-layer-branch",children:[t.jsxs("div",{ref:me=>{me?A.current.set(Qe,me):A.current.delete(Qe)},className:bt,role:"treeitem","aria-label":Ir(Fe.name),"aria-level":Ae,"aria-selected":_t,"aria-expanded":Fe.type==="group"?It:void 0,"aria-owns":Fe.type==="group"&&It?Ue(Mt):void 0,"aria-describedby":gn,"data-effective-locked":ee?"true":"false","data-structural-locked":Lt?"true":"false","data-effective-hidden":He?"true":"false",tabIndex:k===Qe?0:-1,draggable:!lt&&!Lt,style:{paddingLeft:v5(Ae)},onFocus:()=>v(Qe),onClick:me=>{lt||W(mt,me.shiftKey||me.ctrlKey||me.metaKey)},onDoubleClick:me=>{me.preventDefault(),me.stopPropagation(),le(mt)},onKeyDown:me=>ue(mt,me,Lt),onDragStart:()=>{Lt||(L.current=mt.path)},onDragOver:me=>me.preventDefault(),onDrop:me=>Ye(mt,me),children:[pt&&t.jsx("span",{className:"freeform-layer-depth","aria-hidden":"true",title:i("第 {n} 层",{n:pt}),children:pt}),Fe.type==="group"?t.jsx("button",{className:"freeform-layer-expand",type:"button","aria-label":It?i("折叠图层组"):i("展开图层组"),tabIndex:-1,onClick:me=>{me.preventDefault(),me.stopPropagation(),Be(Mt),te(Qe)},children:C5(It)}):t.jsx("span",{className:"freeform-layer-expand-spacer","aria-hidden":"true"}),t.jsxs("span",{className:"freeform-layer-type","aria-hidden":"true",children:[F5(Fe),(Xe||ze)&&t.jsx("span",{className:"freeform-layer-inherited-state",title:i("受父级{state}影响",{state:ce}),children:R5()})]}),lt?t.jsx("input",{className:"freeform-layer-rename","aria-label":i("重命名图层"),value:M,onChange:me=>I(me.currentTarget.value),onBlur:()=>De(mt),onKeyDown:me=>{if(me.stopPropagation(),me.key==="Enter"){if(me.nativeEvent.isComposing||H.current)return;me.preventDefault(),De(mt)}else me.key==="Escape"&&(me.preventDefault(),H.current=!1,N(null),I(""))},onCompositionStart:()=>{H.current=!0},onCompositionEnd:()=>{H.current=!1}}):t.jsx("span",{className:"freeform-layer-name",title:Ir(Fe.name),onDoubleClick:me=>{me.preventDefault(),me.stopPropagation(),le(mt)},children:Ir(Fe.name)}),t.jsx("span",{id:gn,className:"sr-only",children:xn}),t.jsxs("span",{className:"freeform-layer-actions",children:[t.jsx("button",{className:"freeform-layer-action",type:"button","aria-label":$t,"aria-pressed":Fe.hidden,title:Zn,onPointerDown:me=>{me.preventDefault(),me.stopPropagation()},onKeyDown:me=>me.stopPropagation(),onDoubleClick:me=>{me.preventDefault(),me.stopPropagation()},onDragStart:me=>{me.preventDefault(),me.stopPropagation()},onClick:me=>{me.preventDefault(),me.stopPropagation(),!(me.detail>1)&&ke(mt,!Fe.hidden,Xe)},children:E5(!Fe.hidden)}),t.jsx("button",{className:"freeform-layer-action",type:"button","aria-label":se,"aria-pressed":Fe.locked,title:ve,onPointerDown:me=>{me.preventDefault(),me.stopPropagation()},onKeyDown:me=>me.stopPropagation(),onDoubleClick:me=>{me.preventDefault(),me.stopPropagation()},onDragStart:me=>{me.preventDefault(),me.stopPropagation()},onClick:me=>{me.preventDefault(),me.stopPropagation(),!(me.detail>1)&&Ee(mt,!Fe.locked,ze)},children:z5(Fe.locked)})]})]}),Fe.type==="group"&&It&&t.jsx("div",{id:Ue(Mt),className:"freeform-layer-children",role:"group",children:zt(Fe.children,Mt,Ae+1,ee,He)})]},Qe)})}return t.jsxs("div",{className:"freeform-layers-panel",children:[t.jsxs("div",{className:"freeform-layers-heading",children:[t.jsxs("span",{className:"freeform-layers-title",children:[i("图层"),t.jsx("span",{className:"freeform-layers-count",children:D.length})]}),t.jsxs("div",{className:"freeform-layers-commands",role:"group","aria-label":i("图层组合操作"),children:[t.jsx("button",{className:"freeform-layers-command",type:"button","data-testid":"freeform-group-selection",title:i("组合所选图层 (Ctrl+G)"),onClick:()=>ne("group"),children:i("组合")}),t.jsx("button",{className:"freeform-layers-command",type:"button","data-testid":"freeform-ungroup-selection",title:i("解组所选图层 (Ctrl+Shift+G)"),onClick:()=>ne("ungroup"),children:i("解组")})]})]}),t.jsx("div",{ref:T,className:"freeform-layer-tree",role:"tree","aria-label":i("图层树"),"aria-multiselectable":"true",onDragEnd:()=>{L.current=null},children:zt(e,[],1)}),t.jsx("div",{className:"freeform-layer-live","data-testid":"freeform-layer-live","aria-live":"polite","aria-atomic":"true",children:F})]})}const ih="freeform-page-size-popover",Nc="freeform-page-size-error";function sh(e){return e.trim()===""?Number.NaN:Number(e)}function L5({isActive:e,width:n,height:r,onApply:s}){const l=p.useRef(null),o=p.useRef(null),c=p.useRef(null),f=p.useRef(null),h=p.useRef(e),[g,x]=p.useState(!1),[m,j]=p.useState(String(n)),[k,v]=p.useState(String(r)),[w,N]=p.useState(null),M=Tc.find(L=>L.width===n&&L.height===r),I=M?`${i(M.ratio)} · ${n}×${r}px`:i("自定义 · {width}×{height}px",{width:n,height:r});h.current=e;function F(){h.current&&(f.current!==null&&window.cancelAnimationFrame(f.current),f.current=window.requestAnimationFrame(()=>{var L;f.current=null,h.current&&((L=o.current)==null||L.focus())}))}function z(L){x(!1),N(null),L&&F()}function A(){e&&(j(String(n)),v(String(r)),N(null),x(!0))}function T(L,H){const P=U1(L,H);if(!P.ok){N(P.message);return}s(L,H),z(!0)}return p.useEffect(()=>{e||(f.current!==null&&(window.cancelAnimationFrame(f.current),f.current=null),x(!1),N(null))},[e]),p.useEffect(()=>()=>{f.current!==null&&window.cancelAnimationFrame(f.current)},[]),p.useEffect(()=>{var U,K;if(!g||!e)return;const L=(U=c.current)==null?void 0:U.querySelector('.page-size-preset[aria-pressed="true"]'),H=(K=c.current)==null?void 0:K.querySelector(".page-size-field input"),P=L??H;P==null||P.focus()},[g,e]),p.useEffect(()=>{if(!g)return;function L(P){const U=l.current;!U||U.contains(P.target)||z(!b0(P.target))}function H(P){P.key==="Escape"&&(P.preventDefault(),P.stopPropagation(),P.stopImmediatePropagation(),z(!0))}return window.addEventListener("pointerdown",L,!0),window.addEventListener("keydown",H,!0),()=>{window.removeEventListener("pointerdown",L,!0),window.removeEventListener("keydown",H,!0)}},[g,e]),t.jsxs("div",{className:"page-size-control",ref:l,onBlur:L=>{const H=L.relatedTarget;!(H instanceof Node)||L.currentTarget.contains(H)||z(!1)},children:[t.jsxs("button",{ref:o,className:"page-size-trigger",type:"button","data-testid":"page-size-trigger","data-freeform-toolbar-flyout-trigger":"","aria-haspopup":"dialog","aria-expanded":g,"aria-controls":ih,onClick:()=>g?z(!1):A(),children:[t.jsx("span",{"data-testid":"freeform-slide-size",children:I}),t.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",children:t.jsx("path",{d:"m3 4.5 3 3 3-3"})})]}),g&&t.jsxs("div",{ref:c,className:"page-size-popover",id:ih,"data-testid":"page-size-popover",role:"dialog","aria-label":i("页面尺寸"),children:[t.jsxs("div",{className:"page-size-popover-heading",children:[t.jsx("strong",{children:i("页面尺寸")}),t.jsxs("span",{children:[n,"×",r,"px"]})]}),t.jsx("div",{className:"page-size-presets","aria-label":i("常用页面比例"),children:Tc.map(L=>{const H=L.width===n&&L.height===r;return t.jsxs("button",{type:"button",className:H?"page-size-preset on":"page-size-preset","aria-label":i(L.ratio),"aria-pressed":H,onClick:()=>T(L.width,L.height),children:[t.jsx("span",{children:i(L.ratio)}),t.jsxs("small",{children:[L.width,"×",L.height]})]},L.ratio)})}),t.jsxs("form",{className:"page-size-custom",noValidate:!0,onSubmit:L=>{L.preventDefault(),T(sh(m),sh(k))},children:[t.jsx("div",{className:"page-size-custom-heading",children:i("自定义尺寸")}),t.jsxs("div",{className:"page-size-fields",children:[t.jsxs("label",{className:"page-size-field",children:[t.jsxs("span",{children:[i("宽度")," ",t.jsx("small",{children:"px"})]}),t.jsx("input",{"aria-label":i("宽度 px"),"aria-describedby":w?Nc:void 0,type:"number",inputMode:"numeric",min:Bc,max:_c,step:"1",value:m,onChange:L=>{j(L.currentTarget.value),N(null)}})]}),t.jsx("span",{className:"page-size-times","aria-hidden":"true",children:"×"}),t.jsxs("label",{className:"page-size-field",children:[t.jsxs("span",{children:[i("高度")," ",t.jsx("small",{children:"px"})]}),t.jsx("input",{"aria-label":i("高度 px"),"aria-describedby":w?Nc:void 0,type:"number",inputMode:"numeric",min:Bc,max:_c,step:"1",value:k,onChange:L=>{v(L.currentTarget.value),N(null)}})]})]}),w&&t.jsx("div",{className:"page-size-error",id:Nc,role:"alert",children:w}),t.jsx("button",{className:"page-size-apply",type:"submit",children:i("应用尺寸")})]})]})]})}const qa=[{id:"properties",label:"属性"},{id:"layers",label:"图层"},{id:"history",label:"历史"}];function $5({children:e,layers:n,history:r,propertiesTabRef:s,disabled:l=!1,activeTab:o,onTabChange:c,onClose:f}){const h=p.useRef(null),[g,x]=p.useState(o),m=c;p.useEffect(()=>{x(o)},[o]);const j=p.useId().replace(/:/g,""),k=N=>`freeform-${j}-${N}-tab`,v=N=>`freeform-${j}-${N}-panel`;p.useEffect(()=>{const N=h.current;N&&(l?N.setAttribute("inert",""):N.removeAttribute("inert"))},[l]);function w(N,M){const I=qa.findIndex(A=>A.id===N);let F=I;if((M.key==="ArrowRight"||M.key==="ArrowDown")&&(F=(I+1)%qa.length),(M.key==="ArrowLeft"||M.key==="ArrowUp")&&(F=(I-1+qa.length)%qa.length),M.key==="Home"&&(F=0),M.key==="End"&&(F=qa.length-1),F===I)return;M.preventDefault(),M.stopPropagation();const z=qa[F].id;x(z),m(z),requestAnimationFrame(()=>{var A;return(A=document.getElementById(k(z)))==null?void 0:A.focus()})}return t.jsxs("aside",{ref:h,className:`freeform-inspector freeform-right-panel${l?" is-disabled":""}`,"aria-label":i("属性和图层面板"),"aria-disabled":l||void 0,children:[t.jsxs("div",{className:"freeform-right-head",children:[t.jsx("div",{className:"freeform-right-tabs",role:"tablist","aria-label":i("自由编辑面板"),children:qa.map(N=>t.jsx("button",{ref:N.id==="properties"?s:void 0,id:k(N.id),className:N.id===o?"freeform-right-tab is-active":"freeform-right-tab",type:"button",role:"tab","aria-selected":N.id===o,"aria-controls":v(N.id),tabIndex:N.id===g?0:-1,onClick:()=>{m(N.id),x(N.id)},onFocus:()=>x(N.id),onKeyDown:M=>w(N.id,M),children:i(N.label)},N.id))}),t.jsx("button",{type:"button",className:"icon-btn freeform-right-close","data-testid":"freeform-panel-close","aria-label":i("收起面板"),title:i("收起面板"),onClick:f,children:t.jsx(Pn,{})})]}),t.jsx("div",{id:v("properties"),className:"freeform-right-tabpanel freeform-properties-tabpanel",role:"tabpanel","aria-labelledby":k("properties"),hidden:o!=="properties",children:e}),t.jsx("div",{id:v("layers"),className:"freeform-right-tabpanel freeform-layers-tabpanel",role:"tabpanel","aria-labelledby":k("layers"),hidden:o!=="layers",children:n}),t.jsx("div",{id:v("history"),className:"freeform-right-tabpanel freeform-history-tabpanel",role:"tabpanel","aria-labelledby":k("history"),hidden:o!=="history",children:r})]})}const D5=[["n","裁剪上边"],["ne","裁剪右上角"],["e","裁剪右边"],["se","裁剪右下角"],["s","裁剪下边"],["sw","裁剪左下角"],["w","裁剪左边"],["nw","裁剪左上角"]];function oh(e){return Number.isFinite(e.left)&&Number.isFinite(e.top)&&Number.isFinite(e.right)&&Number.isFinite(e.bottom)&&e.right>e.left&&e.bottom>e.top}function A5(e){return!!e&&oh(e.frame)&&oh(e.image)&&e.image.left<=e.frame.left+Qt&&e.image.top<=e.frame.top+Qt&&e.image.right+Qt>=e.frame.right&&e.image.bottom+Qt>=e.frame.bottom&&Vs(e.framing)}function P5(e){return Array.isArray(e)&&e.length===6&&e.every(n=>Number.isFinite(n))}function lh(e){return{left:e.left,top:e.top,width:e.right-e.left,height:e.bottom-e.top}}function ch(e){return[e.frame.left,e.frame.top,e.frame.right,e.frame.bottom,e.image.left,e.image.top,e.image.right,e.image.bottom].join("|")}function dh(e,n,r){e.dataset[`crop${n[0].toUpperCase()}${n.slice(1)}Left`]=String(r.left),e.dataset[`crop${n[0].toUpperCase()}${n.slice(1)}Top`]=String(r.top),e.dataset[`crop${n[0].toUpperCase()}${n.slice(1)}Right`]=String(r.right),e.dataset[`crop${n[0].toUpperCase()}${n.slice(1)}Bottom`]=String(r.bottom)}function uh(e,n,r){if(!A5(e)||!P5(n)||!Number.isFinite(r)||r<=0)return null;const s=lh(e.frame),l=lh(e.image),o={left:e.image.left-e.frame.left,top:e.image.top-e.frame.top,width:e.image.right-e.image.left,height:e.image.bottom-e.image.top};return{overlayStyle:{transform:`matrix(${n.join(",")})`,width:Math.max(1,e.frame.right,e.image.right),height:Math.max(1,e.frame.bottom,e.image.bottom),"--crop-hit-size":`${24/r}px`,"--crop-handle-long":`${12/r}px`,"--crop-handle-thick":`${4/r}px`,"--crop-handle-corner":`${8/r}px`,"--crop-halo":`${1/r}px`,"--crop-frame-line":`${1/r}px`,"--crop-focus-line":`${2/r}px`},frameStyle:s,imageStyle:l,brightImageStyle:o,data:{frame:e.frame,image:e.image}}}function vs(e,n){Object.entries(n).forEach(([r,s])=>{s!==void 0&&(r.startsWith("--")?e.style.setProperty(r,String(s)):e.style.setProperty(r,typeof s=="number"?`${s}px`:String(s)))})}const v0=p.forwardRef(function({draft:n,worldMatrix:r,screenScale:s,resolvedSrc:l,alt:o,activeHandle:c=null,onHandlePointerDown:f,onHandleKeyDown:h,onImagePointerDown:g,onImageError:x,onKeyDown:m},j){const k=p.useRef(null),v=p.useRef(null),w=p.useRef(null),N=p.useRef(null),M=p.useRef(null),I=p.useRef(null),F=uh(n,r,s),z=A=>{const T=uh(A,r,s),L=k.current,H=v.current,P=w.current,U=N.current,K=M.current;if(!T||!L||!H||!P||!U||!K)return;vs(L,T.overlayStyle),vs(H,T.imageStyle),vs(P,T.frameStyle),vs(U,T.brightImageStyle),vs(K,T.frameStyle),dh(L,"frame",T.data.frame),dh(L,"image",T.data.image);const D=ch(A);D!==I.current&&(I.current=D,L.dataset.cropDraftKey=D)};return p.useImperativeHandle(j,()=>({renderDraft:z,focusHandle:A=>{var T,L;(L=(T=k.current)==null?void 0:T.querySelector(`[data-crop-handle="${A}"]`))==null||L.focus()}}),[r,s]),p.useLayoutEffect(()=>{z(n)}),p.useLayoutEffect(()=>{var A;(A=k.current)==null||A.focus()},[]),!F||typeof l!="string"||l.length===0?null:t.jsxs("div",{ref:k,className:"freeform-ui-only freeform-image-crop-overlay","data-testid":"freeform-image-crop-overlay","data-crop-draft-key":ch(n),role:"application","aria-label":i("图片裁剪"),tabIndex:-1,style:F.overlayStyle,onKeyDown:m,children:[t.jsx("img",{ref:v,className:"freeform-image-crop-dim",src:l,alt:o,draggable:!1,style:F.imageStyle,onPointerDown:A=>{var T;(T=k.current)==null||T.focus(),g==null||g(A)},onError:x}),t.jsx("div",{ref:w,className:"freeform-image-crop-window",style:F.frameStyle,"aria-hidden":"true",children:t.jsx("img",{ref:N,className:"freeform-image-crop-bright",src:l,alt:"",draggable:!1,style:F.brightImageStyle,onError:x})}),t.jsx("div",{ref:M,className:"freeform-image-crop-frame",style:F.frameStyle,children:D5.map(([A,T])=>t.jsx("button",{type:"button",tabIndex:0,"data-crop-handle":A,"data-active":c===A?"true":void 0,"aria-label":i(T),onPointerDown:L=>f==null?void 0:f(L,A),onKeyDown:L=>h==null?void 0:h(L,A),children:t.jsx("span",{"aria-hidden":"true"})},A))})]})});v0.displayName="ImageCropOverlay";const T5=new Set(["n","ne","e","se","s","sw","w","nw"]),fh=new Set(["id","name","locked","hidden","type","x","y","width","height","rotation","scale","src","alt","fit","framing"]);function pn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Nt(e){return typeof e=="number"&&Number.isFinite(e)}function hi(e){return pn(e)&&Nt(e.width)&&e.width>0&&Nt(e.height)&&e.height>0}function xl(e){return pn(e)&&Nt(e.x)&&Nt(e.y)}function qi(e){if(!pn(e)||!Nt(e.left)||!Nt(e.top)||!Nt(e.right)||!Nt(e.bottom))return!1;const n=e.right-e.left,r=e.bottom-e.top;return Nt(n)&&n>0&&Nt(r)&&r>0}function Jr(e){return e.right-e.left}function ea(e){return e.bottom-e.top}function hh(e,n,r){return Math.min(r,Math.max(n,e))}function Zr(e,n){const r=Math.max(1,Math.abs(e),Math.abs(n));return Math.abs(e-n)<=Qt*r*8}function Ds(e,n,r){if(!Nt(e))return null;const s=Qt*Math.max(1,Math.abs(e),Math.abs(n),Math.abs(r));return e<n-s||e>r+s?null:Math.min(r,Math.max(n,e))}function Cl(e){if(!pn(e))return!1;const n=Object.keys(e);return n.length===fh.size&&n.every(r=>fh.has(r))&&typeof e.id=="string"&&e.id.trim().length>0&&typeof e.name=="string"&&typeof e.locked=="boolean"&&typeof e.hidden=="boolean"&&e.type==="image"&&Nt(e.x)&&Nt(e.y)&&Nt(e.width)&&e.width>0&&Nt(e.height)&&e.height>0&&Nt(e.rotation)&&Nt(e.scale)&&e.scale>0&&typeof e.src=="string"&&typeof e.alt=="string"&&e.fit==="cover"&&Vs(e.framing)}function El(e){return pn(e)&&qi(e.frame)&&qi(e.image)&&Vs(e.framing)}function W5(e){return typeof e=="string"&&T5.has(e)}function H5(e){if(!pn(e))return null;const{startNode:n,naturalSize:r}=e;if(!Cl(n)||!hi(r))return null;const s=sm({naturalSize:r,frameSize:{width:n.width,height:n.height},fit:"cover",framing:n.framing});if(!s)return null;const l={left:0,top:0,right:n.width,bottom:n.height},o={left:s.left,top:s.top,right:s.left+s.width,bottom:s.top+s.height};return!qi(l)||!qi(o)?null:{frame:l,image:o,framing:Y1(n.framing)}}function N0(e){if(!pn(e))return null;const{startNode:n,naturalSize:r,draft:s}=e;if(!Cl(n)||!hi(r)||!El(s))return null;const l=Jr(s.frame),o=ea(s.frame),c=Jr(s.image),f=ea(s.image);if(s.frame.left<s.image.left-Qt||s.frame.top<s.image.top-Qt||s.frame.right>s.image.right+Qt||s.frame.bottom>s.image.bottom+Qt)return null;const h=c/r.width,g=f/r.height;if(!Nt(h)||h<=0||!Nt(g)||g<=0||!Zr(h,g))return null;const x=h+(g-h)/2,m=Math.max(l/r.width,o/r.height),j=Ds(x/m,Ps,Ki),k=Ds((l/2-(s.image.left-s.frame.left))/c,0,1),v=Ds((o/2-(s.image.top-s.frame.top))/f,0,1);if(j===null||k===null||v===null)return null;const w={focusX:k,focusY:v,zoom:j};if(!Vs(w))return null;const N=sm({naturalSize:r,frameSize:{width:l,height:o},fit:"cover",framing:w});if(!N||!Zr(N.left,s.image.left-s.frame.left)||!Zr(N.top,s.image.top-s.frame.top)||!Zr(N.width,c)||!Zr(N.height,f))return null;try{const M={...n,width:l,height:o},I=Lr(As(n),ui(s.frame.left,s.frame.top)),F=Kc(M,I,n.scale);return!F||F.type!=="image"?null:{x:F.x,y:F.y,width:l,height:o,framing:w}}catch{return null}}function M0(e,n){return Zr(e.left,n.left)&&Zr(e.top,n.top)&&Zr(e.right,n.right)&&Zr(e.bottom,n.bottom)}function F0(e,n,r,s,l){if(!hi(l)||!qi(s)||Jr(s)<l.width-Qt||ea(s)<l.height-Qt)return null;const o={frame:s,image:r.image,framing:r.framing},c=N0({startNode:e,naturalSize:n,draft:o});return c?{...o,framing:c.framing}:null}function O5(e,n,r,s){const l={...e};switch(n){case"n":l.top+=r.y,s&&(l.bottom-=r.y);break;case"ne":l.top+=r.y,l.right+=r.x;break;case"e":l.right+=r.x,s&&(l.left-=r.x);break;case"se":l.right+=r.x,l.bottom+=r.y;break;case"s":l.bottom+=r.y,s&&(l.top-=r.y);break;case"sw":l.bottom+=r.y,l.left+=r.x;break;case"w":l.left+=r.x,s&&(l.right-=r.x);break;case"nw":l.left+=r.x,l.top+=r.y;break;default:return null}return Object.values(l).every(Nt)?l:null}function _5(e,n,r){return{left:e.left+(n.left-e.left)*r,top:e.top+(n.top-e.top)*r,right:e.right+(n.right-e.right)*r,bottom:e.bottom+(n.bottom-e.bottom)*r}}function Vr(e,n,r,s){const l=r-n;if(!Nt(l)||Math.abs(l)<=Number.EPSILON)return;const o=(s-n)/l;Nt(o)&&o>0&&o<1&&e.push(o)}function B5(e,n,r,s,l){const o=[0,1];Vr(o,e.left,n.left,r.left),Vr(o,e.top,n.top,r.top),Vr(o,e.right,n.right,r.right),Vr(o,e.bottom,n.bottom,r.bottom);const c=Jr(e),f=Jr(n),h=ea(e),g=ea(n);Vr(o,c,f,l.width),Vr(o,h,g,l.height),Vr(o,c,f,Jr(r)/Ki),Vr(o,h,g,ea(r)/Ki);const x=c/s.width-h/s.height,m=f/s.width-g/s.height;return Vr(o,x,m,0),[...new Set(o)].sort((j,k)=>j-k)}function K5(e,n){const r=n(0);if(!r)return null;let s={progress:0,candidate:r};const l=(o,c)=>{let f=o,h=c,g=n(f)??s.candidate;for(let x=0;x<56;x+=1){const m=f+(h-f)/2,j=n(m);j?(f=m,g=j):h=m}return{progress:f,candidate:g}};for(let o=1;o<e.length;o+=1){const c=e[o-1],f=e[o];if(f<=s.progress)continue;const h=c+(f-c)/2;if(!n(h))return l(s.progress,h);const x=n(f);if(!x)return l(h,f);s={progress:f,candidate:x}}return s}function C0(e){const n=pn(e)?e.startDraft:null;if(!pn(e))return n;const{startNode:r,naturalSize:s,handle:l,localDelta:o,minimumFrameSize:c}=e,f=e.symmetric===void 0?!1:e.symmetric;if(!Cl(r)||!hi(s)||!El(n)||!W5(l)||!xl(o)||!hi(c)||typeof f!="boolean"||o.x===0&&o.y===0)return n;const h=O5(n.frame,l,o,f);if(!h)return n;const g=B5(n.frame,h,n.image,s,c),x=K5(g,m=>F0(r,s,n,_5(n.frame,h,m),c));return!x||M0(x.candidate.frame,n.frame)?n:x.candidate}function V5(e){if(!pn(e))return null;const n=e,{screenDelta:r,renderScale:s,startWorldMatrix:l}=n;if(!xl(r)||!Nt(s)||s<=0)return null;try{const o=nr(l);if(!o)return null;const c=hr(o,{x:r.x/s,y:r.y/s});return xl(c)?c:null}catch{return null}}function mh(e){if(!pn(e))return null;const{renderScale:n,startWorldMatrix:r}=e;if(!Nt(n)||n<=0)return null;try{const s=Bi(r);if(!s)return null;const l=s.scale*n;return Nt(l)&&l>0?l:null}catch{return null}}function E0(e){const n=pn(e)?e.draft:null;if(!pn(e))return n;const{localDelta:r}=e;if(!xl(r)||!El(n)||n.frame.left<n.image.left-Qt||n.frame.top<n.image.top-Qt||n.frame.right>n.image.right+Qt||n.frame.bottom>n.image.bottom+Qt)return n;const s=Jr(n.image),l=ea(n.image),o=hh(n.image.left+r.x,n.frame.right-s,n.frame.left),c=hh(n.image.top+r.y,n.frame.bottom-l,n.frame.top),f=Math.abs(o-n.image.left)>Qt,h=Math.abs(c-n.image.top)>Qt;if(!f&&!h)return n;const g={left:o,top:c,right:o+s,bottom:c+l};if(!qi(g))return n;const x=Jr(n.frame),m=ea(n.frame),j=f?Ds((x/2-(o-n.frame.left))/s,0,1):n.framing.focusX,k=h?Ds((m/2-(c-n.frame.top))/l,0,1):n.framing.focusY;if(j===null||k===null)return n;const v={focusX:j,focusY:k,zoom:n.framing.zoom};return Vs(v)?{frame:n.frame,image:g,framing:v}:n}function G5(e){const n=pn(e)?e.startDraft:null;if(!pn(e))return n;const r=V5({screenDelta:e.screenDelta,renderScale:e.renderScale,startWorldMatrix:e.startWorldMatrix});return r?e.kind==="pan"?E0({draft:n,localDelta:r}):e.kind!=="handle"?n:C0({startNode:e.startNode,naturalSize:e.naturalSize,startDraft:n,handle:e.handle,localDelta:r,minimumFrameSize:e.minimumFrameSize,symmetric:e.symmetric}):n}function U5(e){const n=pn(e)?e.draft:null;if(!pn(e))return n;const{startNode:r,naturalSize:s,ratio:l,minimumFrameSize:o}=e;if(!Cl(r)||!hi(s)||!El(n)||!hi(o)||l!=="original"&&(!Nt(l)||l<=0))return n;const c=l==="original"?s.width/s.height:l;if(!Nt(c)||c<=0)return n;const f=Jr(n.frame),h=ea(n.frame);if(!Nt(f)||f<=0||!Nt(h)||h<=0)return n;const g=n.frame.left+f/2,x=n.frame.top+h/2;let m=f,j=h;if(f/h>c?m=h*c:j=f/c,!Nt(m)||!Nt(j))return n;const k={left:g-m/2,top:x-j/2,right:g+m/2,bottom:x+j/2};return M0(k,n.frame)?n:F0(r,s,n,k,o)??n}const Zo=40;function Un(e){return typeof e=="number"&&Number.isFinite(e)}function ph(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&Un(e.width)&&e.width>0&&Un(e.height)&&e.height>0}function gh(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&Un(e.x)&&Un(e.y)}function Y5(e){return Array.isArray(e)&&e.length===6&&e.every(Un)}function $i(e){return{frame:{...e.frame},image:{...e.image},framing:{...e.framing}}}function Z5(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const n=e;return[n.frame,n.image].every(s=>s&&Un(s.left)&&Un(s.top)&&Un(s.right)&&Un(s.bottom)&&s.right>s.left&&s.bottom>s.top)?n.image.left<=n.frame.left&&n.image.top<=n.frame.top&&n.image.right>=n.frame.right&&n.image.bottom>=n.frame.bottom&&!!n.framing:!1}function X5(e){var r;if(!e||typeof e!="object"||Array.isArray(e))return!1;const n=e;return Un(n.scopeGeneration)&&typeof n.draftScopeKey=="string"&&typeof n.slideId=="string"&&Array.isArray(n.path)&&n.path.length>0&&n.path.every(s=>typeof s=="string"&&s.length>0)&&typeof n.logicalSrc=="string"&&typeof n.resolvedSrc=="string"&&ph(n.naturalSize)&&!!n.startDocument&&((r=n.startNode)==null?void 0:r.type)==="image"&&Y5(n.startWorldMatrix)&&Z5(n.draft)&&(n.minimumFrameSize===void 0||ph(n.minimumFrameSize))}function q5(e){if(e.minimumFrameSize)return{...e.minimumFrameSize};const n=e.startWorldMatrix[0],r=e.startWorldMatrix[1],s=Math.hypot(n,r);return!Un(s)||s<=0?{width:Zo,height:Zo}:{width:Zo/s,height:Zo/s}}function Q5(e){return{x:e.includes("e")?1:e.includes("w")?-1:0,y:e.includes("s")?1:e.includes("n")?-1:0}}function xh(e){return e==="n"||e==="e"||e==="s"||e==="w"}function J5(e,n){const r=n.shiftKey?10:1,s=Q5(e);return n.key==="ArrowLeft"&&s.x!==0?{x:-r,y:0}:n.key==="ArrowRight"&&s.x!==0?{x:r,y:0}:n.key==="ArrowUp"&&s.y!==0?{x:0,y:-r}:n.key==="ArrowDown"&&s.y!==0?{x:0,y:r}:null}function ej(e){const n=p.useRef(null),r=p.useRef(null),s=p.useRef(null),l=p.useRef(null),o=p.useRef(null),c=p.useRef(null),f=p.useRef(!0),h=p.useRef(()=>{}),g=p.useRef(()=>{}),x=p.useRef(()=>{}),m=p.useRef(()=>{}),j=p.useRef({move:W=>h.current(W),up:W=>g.current(W),cancel:W=>x.current(W),blur:()=>m.current()}),[k,v]=p.useState(null),w=Un(e)&&e>0?e:null,N=o.current,M=p.useCallback(W=>{var ae;!W||!f.current||(ae=n.current)==null||ae.renderDraft(W)},[]),I=p.useCallback(W=>{const ae=$i(W);l.current=ae,o.current=ae;const ke=s.current;if(ke){const Ee={...ke,draft:ae};s.current=Ee,v(Ee)}M(ae)},[M]),F=p.useCallback(W=>{var ae,ke;if(!(!(W!=null&&W.target)||typeof W.target.releasePointerCapture!="function"))try{(ke=(ae=W.target).hasPointerCapture)!=null&&ke.call(ae,W.pointerId)&&W.target.releasePointerCapture(W.pointerId)}catch{}},[]),z=p.useCallback(()=>{const W=c.current;(W==null?void 0:W.frameId)!==null&&(W==null?void 0:W.frameId)!==void 0&&(cancelAnimationFrame(W.frameId),W.frameId=null)},[]),A=p.useCallback(()=>{window.removeEventListener("pointermove",j.current.move),window.removeEventListener("pointerup",j.current.up),window.removeEventListener("pointercancel",j.current.cancel),window.removeEventListener("blur",j.current.blur)},[]),T=p.useCallback(()=>{const W=c.current;z(),A(),F(W),c.current=null},[z,F,A]),L=p.useCallback(W=>{const ae=s.current;return ae?G5({startNode:ae.startNode,naturalSize:ae.naturalSize,startDraft:W.startDraft,kind:W.kind,handle:W.handle,screenDelta:{x:W.latestClient.x-W.startClient.x,y:W.latestClient.y-W.startClient.y},renderScale:W.renderScale,startWorldMatrix:ae.startWorldMatrix,minimumFrameSize:ae.minimumFrameSize,symmetric:W.symmetric}):W.startDraft},[]),H=p.useCallback(()=>{const W=c.current;return W?(z(),L(W)):null},[L,z]),P=p.useCallback(()=>{const W=c.current;!W||W.frameId!==null||(W.frameId=requestAnimationFrame(()=>{const ae=c.current;if(!ae||ae!==W)return;ae.frameId=null;const ke=L(ae);o.current=ke,M(ke)}))},[L,M]),U=p.useCallback(W=>{const ae=c.current;if(ae){if(W){const ke=H()??ae.startDraft;I(ke)}else z(),I(ae.startDraft);T()}},[z,T,H,I]),K=p.useCallback((W,ae,ke)=>{var zt;const Ee=s.current,ue=r.current;if(!Ee||ue===null||c.current||!ke.isPrimary||ke.button!==0||!Un(ke.pointerId))return;ke.preventDefault(),ke.stopPropagation();const Ye=ke.currentTarget;try{(zt=Ye.setPointerCapture)==null||zt.call(Ye,ke.pointerId)}catch{}const Ue=$i(l.current??Ee.draft),Ot={pointerId:ke.pointerId,pointerType:ke.pointerType,kind:W,handle:ae,symmetric:!!(ke.ctrlKey||ke.metaKey)&&!!(ae&&xh(ae)),startClient:{x:ke.clientX,y:ke.clientY},latestClient:{x:ke.clientX,y:ke.clientY},startDraft:Ue,renderScale:ue,target:Ye,frameId:null};c.current=Ot,window.addEventListener("pointermove",j.current.move,{passive:!1}),window.addEventListener("pointerup",j.current.up),window.addEventListener("pointercancel",j.current.cancel),window.addEventListener("blur",j.current.blur)},[]),D=p.useCallback(W=>{K("pan",void 0,W)},[K]),re=p.useCallback((W,ae)=>{K("handle",W,ae)},[K]),q=p.useCallback(W=>{if(c.current)return;const ae=s.current;!ae||!gh(W)||I(E0({draft:l.current??ae.draft,localDelta:W}))},[I]),te=p.useCallback((W,ae,ke)=>{if(c.current)return;const Ee=s.current;!Ee||!gh(ae)||I(C0({startNode:Ee.startNode,naturalSize:Ee.naturalSize,startDraft:l.current??Ee.draft,handle:W,localDelta:ae,minimumFrameSize:Ee.minimumFrameSize,symmetric:ke}))},[I]),be=p.useCallback((W,ae)=>{const ke=J5(W,ae);ke&&(ae.preventDefault(),ae.stopPropagation(),te(W,ke,!!(ae.ctrlKey||ae.metaKey)&&xh(W)))},[te]),ne=p.useCallback(W=>{const ae=W.key==="ArrowLeft"?{x:-1,y:0}:W.key==="ArrowRight"?{x:1,y:0}:W.key==="ArrowUp"?{x:0,y:-1}:W.key==="ArrowDown"?{x:0,y:1}:null;ae&&(W.preventDefault(),W.stopPropagation(),q(W.shiftKey?{x:ae.x*10,y:ae.y*10}:ae))},[q]),Be=p.useCallback(W=>{if(!X5(W)||r.current===null||s.current)return!1;const ae=q5(W),ke=$i(W.draft),Ee={...W,path:[...W.path],naturalSize:{...W.naturalSize},startNode:{...W.startNode,framing:{...W.startNode.framing}},startWorldMatrix:[...W.startWorldMatrix],minimumFrameSize:ae,startDraft:ke,draft:ke};return s.current=Ee,l.current=ke,o.current=ke,v(Ee),M(ke),!0},[M]),le=p.useCallback(W=>{const ae=s.current;if(!ae)return null;const ke=c.current?H()??o.current??ae.draft:o.current??ae.draft;c.current&&(l.current=$i(ke),o.current=l.current,M(l.current)),T();const Ee={reason:W,session:{...ae,draft:$i(ke)},draft:$i(ke)};return s.current=null,l.current=null,o.current=null,v(null),Ee},[T,M,H]),De=p.useCallback(()=>{!s.current&&!c.current||(T(),s.current=null,l.current=null,o.current=null,v(null))},[T]);return h.current=W=>{const ae=c.current;!ae||W.pointerId!==ae.pointerId||(W.preventDefault(),ae.latestClient={x:W.clientX,y:W.clientY},P())},g.current=W=>{const ae=c.current;!ae||W.pointerId!==ae.pointerId||(W.preventDefault(),ae.latestClient={x:W.clientX,y:W.clientY},U(!0))},x.current=W=>{const ae=c.current;!ae||W.pointerId!==ae.pointerId||U(!1)},m.current=()=>{c.current&&U(!1)},p.useLayoutEffect(()=>{r.current=w},[w]),p.useLayoutEffect(()=>{const W=o.current;W!==N&&M(W)}),p.useEffect(()=>(f.current=!0,()=>{f.current=!1,T(),s.current=null,l.current=null,o.current=null}),[T]),{session:k,overlayRef:n,renderDraft:N,start:Be,finish:le,invalidate:De,panPointerDown:D,handlePointerDown:re,handleKeyDown:be,overlayKeyDown:ne,nudgePan:q,nudgeHandle:te,applyAspectRatio:W=>{if(c.current)return!1;const ae=s.current;if(!ae)return!1;const ke=U5({startNode:ae.startNode,naturalSize:ae.naturalSize,draft:l.current??ae.draft,ratio:W,minimumFrameSize:ae.minimumFrameSize}),Ee=ke!==(l.current??ae.draft);return Ee&&I(ke),Ee}}}function tj({zoomPercent:e,canZoomOut:n,canZoomIn:r,onZoomOut:s,onZoomIn:l,onFit:o}){return t.jsxs("div",{className:"freeform-zoom",role:"group","aria-label":i("预览缩放"),children:[t.jsx("button",{className:"zoom-btn",type:"button","aria-label":i("缩小画布"),title:i("缩小画布"),disabled:!n,onClick:s,children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M4 10h12"})})}),t.jsxs("button",{className:"zoom-value",type:"button","data-testid":"freeform-zoom-value",title:i("适应画布"),onClick:o,children:[e,"%"]}),t.jsx("button",{className:"zoom-btn",type:"button","aria-label":i("放大画布"),title:i("放大画布"),disabled:!r,onClick:l,children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M10 4v12M4 10h12"})})})]})}const nj={nw:{x:-1,y:-1},n:{x:0,y:-1},ne:{x:1,y:-1},e:{x:1,y:0},se:{x:1,y:1},s:{x:0,y:1},sw:{x:-1,y:1},w:{x:-1,y:0}},rj=["nw","ne","sw"],bh=["n","e","s","w"],yh=56,aj=36,ij=52,jh={cornerRadius:"调整圆角",starInnerRatio:"调整星角内径",bubbleTailX:"调整气泡尾巴"},sj="移动对象",oj="拖拽移动",lj="调整大小",cj="旋转对象";function wh(e,n,r){return{nw:Wn(e,{x:0,y:0}),ne:Wn(e,{x:n,y:0}),se:Wn(e,{x:n,y:r}),sw:Wn(e,{x:0,y:r})}}function dj(e){if(e.length===0)return null;const n=Math.min(...e.map(o=>o.x)),r=Math.min(...e.map(o=>o.y)),s=Math.max(...e.map(o=>o.x+o.width)),l=Math.max(...e.map(o=>o.y+o.height));return{x:n,y:r,width:s-n,height:l-r}}function uj(e,n,r){const s=n.filter(w=>{var N,M;return((N=Ur(e,w))==null?void 0:N.hidden)===!1&&((M=Ur(e,w))==null?void 0:M.locked)===!1});if(s.length===0)return[];if(s.length>1){const w=s.map(F=>[...F]),N=w.flatMap(F=>{const z=Tn(e,F);return z?[z]:[]});if(N.length!==w.length)return[];const M=dj(N);if(!M)return[];const I=ui(M.x,M.y);return[{target:{key:`multi:${w.map(ye).join("|")}`,kind:"multi",nodeIds:w.map(F=>F[F.length-1]),paths:w,worldBounds:M,resizePivot:{x:M.x,y:M.y},corners:wh(I,M.width,M.height),center:{x:M.x+M.width/2,y:M.y+M.height/2}},matrix:I,width:M.width,height:M.height}]}const l=[...s[0]],o=jt(e,l),c=Gr(e,l),f=Tn(e,l);if(!o||!c||!f)return[];const h=o.type==="group"?ud(o.children):{x:0,y:0,width:o.width,height:o.height};if(!h)return[];const g=Lr(c,ui(h.x,h.y)),x=o.type==="line"&&o.points?o.points.map(w=>({x:w.x+h.x,y:w.y+h.y})):void 0;let m=o.type==="shape"&&!o.locked?om(o.shape,h.width,h.height,o):null;m&&o.type==="shape"&&o.shape==="rect"&&(m=Z1(X1(h.width,h.height,o).topLeft,h.width,h.height,r)),m&&o.type==="shape"&&o.shape==="bubble"&&(m=q1(h.width,h.height,o.bubbleTailX??.5,r));const j=o.type==="shape"?lm(o.shape):null,k=m&&j?{param:j,x:m.x,y:m.y}:void 0,v=o.type==="table"&&!o.locked?cm(h.width,o.cols,o.colWidths).slice(1,-1).map((w,N)=>({index:N,x:w,y:h.height/2})):void 0;return[{target:{key:ye(l),kind:o.type==="group"?"group":"leaf",nodeIds:[o.id],paths:[l],worldBounds:f,resizePivot:Wn(g,{x:0,y:0}),corners:wh(g,h.width,h.height),center:Wn(g,{x:h.width/2,y:h.height/2})},matrix:g,width:h.width,height:h.height,vertices:x,...k?{shapeParamHandle:k}:{},...v?{tableColumnHandles:v}:{}}]}function fj(e){return`matrix(${e.join(",")})`}function hj({nodes:e,selectedPaths:n,renderScale:r,activeInteraction:s,interactive:l,badge:o,onMovePointerDown:c,onResizePointerDown:f,onRotatePointerDown:h,onVertexPointerDown:g,onVertexDoubleClick:x,onShapeParamPointerDown:m,onTableColumnPointerDown:j}){const k=uj(e,n,r),v=r>0?1/r:1;return t.jsx("div",{className:"freeform-ui-only freeform-selection-overlay","data-testid":"freeform-selection-overlay","data-live-interaction":s??void 0,role:"presentation",style:{"--freeform-inverse-scale":v},children:k.map(({target:w,matrix:N,width:M,height:I,vertices:F,shapeParamHandle:z,tableColumnHandles:A})=>{var q;const T=((q=Bi(N))==null?void 0:q.scale)??1,L={left:0,top:0,width:M,height:I,transform:fj(N),"--freeform-inverse-scale":T>0?v/T:v},H=M*T*r,P=I*T*r,U=w.worldBounds.y*r<ij,K=F!==void 0&&F.length>0,D=K||Math.min(H,P)<aj?[]:rj,re=w.kind==="leaf"&&!K?bh.filter(te=>te==="n"||te==="s"?H>=yh:P>=yh):[];return t.jsxs("div",{className:"freeform-selection-item","data-testid":"freeform-selection-box","data-element-id":w.nodeIds.length===1?w.nodeIds[0]:"multi","data-selection-kind":w.kind,style:L,children:[t.jsx("span",{className:"freeform-ui-only element-outline","aria-hidden":"true"}),l&&t.jsxs(t.Fragment,{children:[[...re,...D].map(te=>t.jsx("span",{className:`freeform-ui-only freeform-resize-handle is-${bh.includes(te)?"edge":"corner"}`,"data-handle":te,"data-testid":`freeform-selection-resize-${te}`,"aria-hidden":"true",onPointerDown:be=>f(be,w,te)},te)),t.jsx("button",{className:"freeform-ui-only element-resize freeform-selection-resize","data-testid":"freeform-selection-resize","data-handle":"se",type:"button","aria-label":i(lj),onPointerDown:te=>f(te,w,"se")}),t.jsxs("span",{className:"freeform-ui-only freeform-selection-tools","data-placement":U?"below":"above",children:[t.jsx("button",{className:"freeform-ui-only element-rotate freeform-selection-rotate","data-testid":"freeform-selection-rotate",type:"button","aria-label":i(cj),title:i("拖动旋转,按住 Shift 以 15° 为步长"),onPointerDown:te=>h(te,w),children:t.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[t.jsx("path",{d:"M13 8a5 5 0 1 1-1.46-3.54"}),t.jsx("path",{d:"M13 2.5v3h-3"})]})}),t.jsx("button",{className:"freeform-ui-only element-drag freeform-selection-move","data-testid":"freeform-selection-move",type:"button","aria-label":i(sj),title:i(oj),onPointerDown:te=>c(te,w),children:t.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[t.jsx("path",{d:"M8 1.75v12.5M1.75 8h12.5"}),t.jsx("path",{d:"M6.25 3.5 8 1.75 9.75 3.5M6.25 12.5 8 14.25l1.75-1.75M3.5 6.25 1.75 8l1.75 1.75M12.5 6.25 14.25 8l-1.75 1.75"})]})})]})]}),l&&K&&g&&t.jsx(t.Fragment,{children:F.map((te,be)=>t.jsx("button",{className:"freeform-ui-only freeform-vertex-handle","data-testid":`freeform-vertex-handle-${be}`,type:"button","aria-label":i("拖动顶点 {n}",{n:be+1}),style:{left:te.x,top:te.y},onPointerDown:ne=>g(ne,w,be),onDoubleClick:ne=>x==null?void 0:x(ne,w,be)},`vertex-${be}`))}),l&&z&&m&&t.jsx("button",{className:"freeform-ui-only freeform-vertex-handle freeform-param-handle","data-testid":`freeform-shape-param-${z.param}`,type:"button","aria-label":i(jh[z.param]),title:i(jh[z.param]),style:{left:z.x,top:z.y},onPointerDown:te=>m(te,w,z.param)}),l&&A&&A.length>0&&j&&t.jsx(t.Fragment,{children:A.map(te=>t.jsx("button",{className:"freeform-ui-only freeform-vertex-handle freeform-table-col-handle","data-testid":`freeform-table-col-handle-${te.index}`,type:"button","aria-label":i("调整第 {n} 列宽",{n:te.index+1}),title:i("拖动调整这一列和右边一列的宽度"),style:{left:te.x,top:te.y},onPointerDown:be=>j(be,w,te.index)},`table-col-${te.index}`))}),o&&t.jsx("span",{className:"freeform-ui-only freeform-selection-badge","data-testid":"freeform-selection-badge",children:o})]},w.key)})})}function kn({title:e,testId:n,tone:r="default",children:s}){return t.jsxs("section",{className:`inspector-section inspector-section-${r}`,"data-testid":n,children:[t.jsx("h2",{className:"inspector-section-title",children:e}),t.jsx("div",{className:"inspector-section-body",children:s})]})}function Mc(e){return{past:[],current:e,future:[]}}function Fc(e,n,r){return Object.is(e.current,n)?e:{past:[...e.past,{state:e.current,label:r}],current:n,future:[]}}function mj(e){const n=e.past[e.past.length-1];return n?{past:e.past.slice(0,-1),current:n.state,future:[{state:e.current,label:n.label},...e.future]}:e}function pj(e){const n=e.future[0];return n?{past:[...e.past,{state:e.current,label:n.label}],current:n.state,future:e.future.slice(1)}:e}function gj(e,n){if(!Number.isInteger(n.index)||n.index<0)return e;if(n.kind==="past"){const s=e.past[n.index];if(!s)return e;const l=e.past.slice(n.index+1);return{past:e.past.slice(0,n.index),current:s.state,future:[...l.map((o,c)=>({state:o.state,label:e.past[n.index+c].label})),{state:e.current,label:e.past[e.past.length-1].label},...e.future]}}const r=e.future[n.index];return r?{past:[...e.past,{state:e.current,label:e.future[0].label},...e.future.slice(0,n.index).map((s,l)=>({state:s.state,label:e.future[l+1].label}))],current:r.state,future:e.future.slice(n.index+1)}:e}function kh(e){var n,r,s,l;switch(e.type){case"slide/add-after-active":return"新增页面";case"slide/duplicate":return"复制页面";case"slide/insert":return e.replaceSlideId!==void 0?"替换页面":"插入页面";case"slide/delete":return"删除页面";case"slide/select":return"切换页面";case"slide/reorder":return"调整页面顺序";case"slide/update":return(n=e.patch)!=null&&n.background&&!((r=e.patch)!=null&&r.name)?"更改页面背景":(s=e.patch)!=null&&s.name&&!((l=e.patch)!=null&&l.background)?"重命名页面":"更新页面";case"slide/resize":return"调整页面尺寸";case"guides/set":return"调整参考线";case"document/restyle":return e.palette!==void 0?"更换配色":e.fontSet!==void 0?"更换字体组合":e.fonts!==void 0&&e.colors===void 0?"替换字体":"替换颜色";case"node/set-locked":return e.locked?"锁定对象":"解锁对象";case"node/set-hidden":return e.hidden?"隐藏对象":"显示对象";case"node/rename":return"重命名对象";case"node/update-content":return"编辑内容";case"node/update-style":return e.updates.length>0&&e.updates.every(o=>Object.keys(o.patch).length===1&&"points"in o.patch)?"调整顶点":"更改样式";case"node/update-geometry":return"移动对象";case"node/update-image-crop":return"调整裁切";case"node/delete":return"删除对象";case"node/reorder":return"调整层级";case"node/reorder-above":return"调整层级";case"node/clone":return"复制对象";case"node/insert-children":return"插入对象";case"group/create":return"编组";case"group/ungroup":return"解组";default:return"编辑"}}function ii(e){const n=(e%360+360)%360;return Object.is(n,-0)||n<=Qt||360-n<=Qt?0:n}function Di(e,n){return Math.abs(e-n)<=Qt}function Sh(e,n){const r=Math.abs(e-n)%360;return Math.min(r,360-r)<=Qt}function Vn(e){return Number.isFinite(e)&&e>0}function xj(e){return Number.isFinite(e)&&e>=0}function bj(e){const n=J1(e);return n?n==="invalid-transform"?"invalid-transform":"invalid-scene":null}function z0(e,n){for(const r of e){const s=[...n,r.id];if(r.locked)return{path:s,node:r};if(r.type==="group"){const l=z0(r.children,s);if(l)return l}}return null}function yj(e,n,r){for(let s=e.length-1;s>=0;s-=1){const l=e[s];if(l.locked)return{kind:"locked",sourcePath:n.slice(0,s+1),sourceName:l.name}}if(r.type==="group"){const s=z0(r.children,n);if(s)return{kind:"locked-descendant",sourcePath:s.path,sourceName:s.node.name}}return{kind:"editable"}}function R0(e,n){if(!Array.isArray(n)||n.length===0||!n.every(s=>typeof s=="string"))return{ok:!1,reason:"unknown-path"};const r=bj(e);if(r)return{ok:!1,reason:r};if(n.length>Sl)return{ok:!1,reason:"unknown-path"};try{let s=e,l=Q1(),o=1;const c=[],f=[{name:"页面",path:[]}];let h=null;for(let F=0;F<n.length;F+=1){const z=s.find(A=>A.id===n[F]);if(!z)return{ok:!1,reason:"unknown-path"};if(c.push(z),F===n.length-1){h=z;break}if(z.type!=="group")return{ok:!1,reason:"unknown-path"};l=Lr(l,As(z)),o*=z.scale,f.push({name:z.name,path:n.slice(0,F+1)}),s=z.children}if(!h)return{ok:!1,reason:"unknown-path"};const g=Bi(l),x=Lr(l,As(h)),m=Bi(x),j=o*h.scale;if(!g||!m||!Vn(j))return{ok:!1,reason:"invalid-transform"};const k={path:[...n],breadcrumbs:f,editability:yj(c,n,h),rotation:ii(m.rotation),worldScale:j};if(h.type!=="group"){const F=Wn(x,{x:h.width/2,y:h.height/2}),z=h.width*j,A=h.height*j,T=F.x-z/2,L=F.y-A/2;if(![T,L,z,A].every(Number.isFinite)||z<=0||A<=0)return{ok:!1,reason:"invalid-transform"};const H={...k,kind:"leaf",node:h,x:T,y:L,width:z,height:A,...h.type==="text"?{fontSize:h.fontSize*j}:{},...h.type==="shape"||h.type==="line"?{strokeWidth:h.strokeWidth*j}:{},...h.type==="path"?{strokeWidth:h.strokeWidth*ni(h.viewBox,h.width,h.height)*j}:{}};return H.fontSize!==void 0&&!Number.isFinite(H.fontSize)||H.strokeWidth!==void 0&&!Number.isFinite(H.strokeWidth)?{ok:!1,reason:"invalid-transform"}:{ok:!0,value:{properties:H,parentWorld:l,parentRotation:ii(g.rotation),parentScale:o,localGroupBounds:null}}}const v=ud(h.children);if(!v||v.width<=0||v.height<=0)return{ok:!1,reason:"invalid-transform"};const w=Wn(x,{x:v.x+v.width/2,y:v.y+v.height/2}),N=v.width*j,M=v.height*j,I=j*100;return![w.x,w.y,N,M,I].every(Number.isFinite)||N<=0||M<=0?{ok:!1,reason:"invalid-transform"}:{ok:!0,value:{properties:{...k,kind:"group",node:h,x:w.x,y:w.y,width:N,height:M,scalePercent:I},parentWorld:l,parentRotation:ii(g.rotation),parentScale:o,localGroupBounds:v}}}catch{return{ok:!1,reason:"invalid-transform"}}}function jj(e,n){const r=R0(e,n);return r.ok?{ok:!0,properties:r.value.properties}:r}function wj(e){return e.kind==="locked"?{ok:!1,reason:"locked"}:e.kind==="locked-descendant"?{ok:!1,reason:"locked-descendant"}:null}function Cr(e,n,r,s=!1){return{ok:!0,category:"geometry",update:n?{path:[...e],patch:n}:null,resolvedValue:r,clamped:s}}function Xo(e,n,r){return{ok:!0,category:"style",update:n?{path:[...e],patch:n}:null,resolvedValue:r,clamped:!1}}function kj(e,n){let r=dl/n,s=ul/n;const l=[];for(const o of e.children)l.push({node:o,effectiveScale:n*o.scale,depth:1});for(;l.length>0;){const o=l.pop();if(o.depth>Sl||!Vn(o.effectiveScale))return null;if(r=Math.max(r,dl/o.effectiveScale),s=Math.min(s,ul/o.effectiveScale),o.node.type==="group")for(const c of o.node.children)l.push({node:c,effectiveScale:o.effectiveScale*c.scale,depth:o.depth+1})}return Vn(r)&&Vn(s)&&r<=s?{min:r,max:s}:null}function vh(e,n,r,s){const l=hr(dm(0,0,r,s),n);return{x:e.x-l.x,y:e.y-l.y}}function Sj(e,n){return Wn(dm(e.x,e.y,e.rotation,e.scale),{x:n.x+n.width/2,y:n.y+n.height/2})}function vj(e,n,r){if(r===null||typeof r!="object"||typeof r.value!="number"||!Number.isFinite(r.value))return{ok:!1,reason:"invalid-value"};const s=R0(e,n);if(!s.ok)return s;const l=s.value,{properties:o}=l,c=wj(o.editability);if(c)return c;if(o.kind==="leaf"){const H=o.node;if(r.property==="scalePercent")return{ok:!1,reason:"unsupported-property"};if(r.property==="fontSize"){if(H.type!=="text")return{ok:!1,reason:"unsupported-property"};if(!Vn(r.value))return{ok:!1,reason:"invalid-value"};if(Di(o.fontSize??Number.NaN,r.value))return Xo(n,null,r.value);const De=r.value/o.worldScale;return Vn(De)?Xo(n,{fontSize:De},r.value):{ok:!1,reason:"invalid-transform"}}if(r.property==="strokeWidth"){if(H.type!=="shape"&&H.type!=="line"&&H.type!=="path")return{ok:!1,reason:"unsupported-property"};const De=H.type==="shape"||H.type==="path";if(!(De?xj(r.value):Vn(r.value)))return{ok:!1,reason:"invalid-value"};if(Di(o.strokeWidth??Number.NaN,r.value))return Xo(n,null,r.value);const ae=H.type==="path"?ni(H.viewBox,H.width,H.height):1,ke=r.value/(o.worldScale*ae);return!Number.isFinite(ke)||(De?ke<0:ke<=0)?{ok:!1,reason:"invalid-transform"}:Xo(n,{strokeWidth:ke},r.value)}if(r.property!=="x"&&r.property!=="y"&&r.property!=="width"&&r.property!=="height"&&r.property!=="rotation")return{ok:!1,reason:"unsupported-property"};if((r.property==="width"||r.property==="height")&&!Vn(r.value))return{ok:!1,reason:"invalid-value"};const P=r.property==="rotation"?ii(r.value):r.value;if(r.property==="rotation"?Sh(o.rotation,P):Di(o[r.property],P))return Cr(n,null,P);if(r.property==="rotation"){const De=ii(P-l.parentRotation);return Cr(n,{rotation:De},P)}const U=r.property==="width"?P:o.width,K=r.property==="height"?P:o.height,D=r.property==="x"?P:o.x,re=r.property==="y"?P:o.y,q=U/o.worldScale,te=K/o.worldScale,be=nr(l.parentWorld);if(!be||!Vn(q)||!Vn(te))return{ok:!1,reason:"invalid-transform"};const ne=Wn(be,{x:D+U/2,y:re+K/2}),Be=ne.x-q/2,le=ne.y-te/2;return[Be,le].every(Number.isFinite)?Cr(n,{x:Be,y:le,...r.property==="width"?{width:q}:{},...r.property==="height"?{height:te}:{}},P):{ok:!1,reason:"invalid-transform"}}if(r.property==="fontSize"||r.property==="strokeWidth")return{ok:!1,reason:"unsupported-property"};if(r.property!=="x"&&r.property!=="y"&&r.property!=="width"&&r.property!=="height"&&r.property!=="rotation"&&r.property!=="scalePercent")return{ok:!1,reason:"unsupported-property"};if((r.property==="width"||r.property==="height"||r.property==="scalePercent")&&!Vn(r.value))return{ok:!1,reason:"invalid-value"};const f=o.node,h=l.localGroupBounds;if(!h)return{ok:!1,reason:"invalid-transform"};const g=nr(l.parentWorld);if(!g)return{ok:!1,reason:"invalid-transform"};const x={x:h.x+h.width/2,y:h.y+h.height/2};if(r.property==="x"||r.property==="y"){if(Di(o[r.property],r.value))return Cr(n,null,r.value);const H=r.property==="x"?{x:r.value-o.x,y:0}:{x:0,y:r.value-o.y},P=hr(g,H),U=f.x+P.x,K=f.y+P.y;return[U,K].every(Number.isFinite)?Cr(n,{x:U,y:K},r.value):{ok:!1,reason:"invalid-transform"}}const m=Sj(f,h);if(r.property==="rotation"){const H=ii(r.value);if(Sh(o.rotation,H))return Cr(n,null,H);const P=ii(H-l.parentRotation),U=vh(m,x,P,f.scale);return[U.x,U.y].every(Number.isFinite)?Cr(n,{x:U.x,y:U.y,rotation:P},H):{ok:!1,reason:"invalid-transform"}}const k=(r.property==="scalePercent"?r.value/100:r.property==="width"?r.value/h.width:r.value/h.height)/l.parentScale;if(!Vn(k))return{ok:!1,reason:"invalid-transform"};const v=kj(f,o.worldScale);if(!v)return{ok:!1,reason:"invalid-transform"};const w=k/f.scale,N=w<v.min||w>v.max;let M=Math.min(Math.max(w,v.min),v.max);if(!N&&Di(r.value,o[r.property]))return Cr(n,null,r.value);const I=Number.EPSILON*32;let F=!1;v.max>v.min&&w>=v.max&&M===v.max?(M=Math.max(v.min,v.max*(1-I)),F=!0):v.max>v.min&&w<=v.min&&M===v.min&&(M=Math.min(v.max,v.min*(1+I)),F=!0);const z=f.scale*M;if(!Vn(z))return{ok:!1,reason:"invalid-transform"};const A=r.property==="scalePercent"?l.parentScale*z*100:r.property==="width"?h.width*l.parentScale*z:h.height*l.parentScale*z,T=N||F;if(Di(A,o[r.property]))return Cr(n,null,T?o[r.property]:A,T);const L=vh(m,x,f.rotation,z);return[L.x,L.y,A].every(Number.isFinite)?Cr(n,{x:L.x,y:L.y,scale:z},A,T):{ok:!1,reason:"invalid-transform"}}function Nj(e,n,r){try{return vj(e,n,r)}catch{return{ok:!1,reason:"invalid-transform"}}}function Mj(e,n,r){const s=new Set(r),l=Gn(e,n);if(!l)return null;const o=[];for(const x of l){if(!s.has(x.id)||x.hidden)continue;const m=Tn(e,[...n,x.id]);m&&o.push(m)}if(o.length===0)return null;const c=Math.min(...o.map(x=>x.x)),f=Math.min(...o.map(x=>x.y)),h=Math.max(...o.map(x=>x.x+x.width)),g=Math.max(...o.map(x=>x.y+x.height));return{x:c,y:f,width:h-c,height:g-f}}function Fj(e,n,r,s){const l=-n.x,o=e.width-(n.x+n.width),c=-n.y,f=e.height-(n.y+n.height);return{x:l>o?l:Math.min(Math.max(r,l),o),y:c>f?c:Math.min(Math.max(s,c),f)}}function Cj(e,n,r){const s=Gn(e,n);if(!s)return[];const l=Ej(r);return s.filter(o=>!o.hidden).filter(o=>{const c=Tn(e,[...n,o.id]);return c?zj({left:c.x,top:c.y,right:c.x+c.width,bottom:c.y+c.height},l):!1}).map(o=>o.id)}function ld(e,n,r,s,l,o){const c=Gn(n,r),f=ri(n,r),h=f?nr(f):null,g=Mj(n,r,s);if(!c||!f||!h||!g)return[];const x=Fj(e,g,l,o),m=hr(h,x),j=new Set(s);return c.filter(k=>j.has(k.id)&&!k.hidden).map(k=>({nodeId:k.id,patch:{x:k.x+m.x,y:k.y+m.y}}))}function Ej(e){const n=Math.min(e.x,e.x+e.width),r=Math.max(e.x,e.x+e.width),s=Math.min(e.y,e.y+e.height),l=Math.max(e.y,e.y+e.height);return{left:n,top:s,right:r,bottom:l}}function zj(e,n){return e.left<n.right&&e.right>n.left&&e.top<n.bottom&&e.bottom>n.top}const I0=4;function Nh(e,n,r,s=I0){const l=e==="x"?{start:"left",end:"right",crossStart:"top",crossEnd:"bottom"}:{start:"top",end:"bottom",crossStart:"left",crossEnd:"right"},o=n[l.start],c=n[l.end],f=n[l.crossStart],h=n[l.crossEnd],g=N=>{const M=h-f,I=N[l.crossEnd]-N[l.crossStart];return Math.min(h,N[l.crossEnd])-Math.max(f,N[l.crossStart])>=Math.min(M,I)/2};let x=null,m=null;for(const N of r)g(N)&&(N[l.end]<=o+s&&(!x||N[l.end]>x[l.end])&&(x=N),N[l.start]>=c-s&&(!m||N[l.start]<m[l.start])&&(m=N));if(!x||!m)return null;const j=o-x[l.end],k=m[l.start]-c,v=Math.abs(j-k);if(v>s||v===0)return null;const w=(j+k)/2;return e==="x"?{dx:w-j,dy:0,gaps:[{gap:w,axis:e,before:x.id,after:m.id}]}:{dx:0,dy:w-j,gaps:[{gap:w,axis:e,before:x.id,after:m.id}]}}function Rj(e,n,r=I0){const s=Nh("x",e,n,r),l=Nh("y",e,n,r),o=c=>c?Math.abs(c.dx)+Math.abs(c.dy):1/0;return o(s)<=o(l)?s:l}const Ij=6,Mh={center:0,start:1,end:2},Fh={page:0,guide:1,element:2};function Lj(e,n,r){const s=Gn(e,n);if(!s)return null;const l=s.filter(o=>r.has(o.id)&&!o.hidden).flatMap(o=>{const c=Tn(e,[...n,o.id]);return c?[{left:c.x,top:c.y,right:c.x+c.width,bottom:c.y+c.height}]:[]});return l.length===0?null:l.reduce((o,c)=>({left:Math.min(o.left,c.left),top:Math.min(o.top,c.top),right:Math.max(o.right,c.right),bottom:Math.max(o.bottom,c.bottom)}))}function Cc(e,n,r,s,l,o){const c=ld(e,n,r,s,l,o),f=Gn(n,r),h=ri(n,r),g=c[0],x=f==null?void 0:f.find(j=>j.id===(g==null?void 0:g.nodeId));if(!g||!x||!h)return{dx:l,dy:o};const m=hr(h,{x:g.patch.x-x.x,y:g.patch.y-x.y});return{dx:m.x,dy:m.y}}function Ch(e,n,r,s,l){const o=e==="x"?n.width:n.height,c=[0,o/2,o].map(x=>({position:x,source:"page"})),h=(Gn(r,s)??[]).filter(x=>!l.has(x.id)&&!x.hidden).flatMap(x=>{const m=Tn(r,[...s,x.id]);return m?L0({left:m.x,top:m.y,right:m.x+m.width,bottom:m.y+m.height},e).map(j=>({position:j.position,source:"element"})):[]}),g=(n.guides??[]).filter(x=>x.axis===e).map(x=>({position:x.position,source:"guide"}));return[...c,...g,...h]}function Eh(e,n,r,s,l){const o=L0(r,e).map(h=>({...h,position:h.position+s})),c=n.flatMap(h=>o.map(g=>({anchor:g,distance:Math.abs(h.position-g.position),reference:h,snappedDelta:s+h.position-g.position})).filter(g=>g.distance<=l));c.sort(Pj);const f=c[0];return f?{delta:f.snappedDelta,line:{axis:e,position:f.reference.position,source:f.reference.source}}:{delta:s}}function $j(e,n,r,s,l,o,c={}){const f=new Set(s),h=Lj(n,r,f);if(!h)return{dx:l,dy:o,lines:[]};const g=Math.max(0,c.threshold??Ij),x=Cc(e,n,r,s,l,o),m=Eh("x",Ch("x",e,n,r,f),h,x.dx,g),j=Eh("y",Ch("y",e,n,r,f),h,x.dy,g),k=Cc(e,n,r,s,m.delta,j.delta),v=[];m.line&&Math.abs(k.dx-m.delta)<=Number.EPSILON*64&&v.push(m.line),j.line&&Math.abs(k.dy-j.delta)<=Number.EPSILON*64&&v.push(j.line);let w=k.dx,N=k.dy,M;const I=g>0?Aj(n,r,f,Dj(h,x)):null;if(I&&(!m.line&&I.dx!==0&&(w=x.dx+I.dx),!j.line&&I.dy!==0&&(N=x.dy+I.dy),w!==k.dx||N!==k.dy)){const F=Cc(e,n,r,s,w,N);w=F.dx,N=F.dy,M=I.gap}return{dx:w,dy:N,lines:v,...M?{space:M}:{}}}function Dj(e,n){return{id:"__dragging__",left:e.left+n.dx,top:e.top+n.dy,right:e.right+n.dx,bottom:e.bottom+n.dy}}function Aj(e,n,r,s){const l=[];for(const f of Gn(e,n)??[]){if(f.hidden||r.has(f.id))continue;const h=Tn(e,[...n,f.id]);h&&l.push({id:f.name,left:h.x,top:h.y,right:h.x+h.width,bottom:h.y+h.height})}if(l.length<2)return null;const o=Rj(s,l);if(!o||o.dx===0&&o.dy===0)return null;const[c]=o.gaps;return c?{dx:o.dx,dy:o.dy,gap:c}:null}function Pj(e,n){const r=e.distance-n.distance;if(r!==0)return r;const s=Fh[e.reference.source]-Fh[n.reference.source];if(s!==0)return s;const l=Mh[e.anchor.name]-Mh[n.anchor.name];return l!==0?l:e.reference.position-n.reference.position}function L0(e,n){const r=n==="x"?e.left:e.top,s=n==="x"?e.right:e.bottom;return[{name:"start",position:r},{name:"center",position:(r+s)/2},{name:"end",position:s}]}const zh=15;function Tj(e){if(!Number.isFinite(e))return 0;const n=Math.round(e/zh)*zh;return n===0?0:n}function Wj(e,n,r,s,l){if(l<=0)return{position:s,target:null};const o=r==="x"?e.width:e.height,c=[{position:o/2,target:"page-center",priority:0},{position:0,target:"page-edge",priority:1},{position:o,target:"page-edge",priority:1}];for(const h of n){if(h.hidden)continue;const g=Tn(n,[h.id]);if(!g)continue;const x=r==="x"?g.x:g.y,m=r==="x"?g.width:g.height;for(const j of[x,x+m/2,x+m])c.push({position:j,target:"element",priority:2})}const f=c.map(h=>({...h,distance:Math.abs(h.position-s)})).filter(h=>h.distance<=l).sort((h,g)=>h.distance-g.distance||h.priority-g.priority)[0];return f?{position:f.position,target:f.target}:{position:s,target:null}}const Hj=500;function Oj(e,n,r,s){return e<s&&r<n}function _j(e,n,r,s){return(Math.max(e,r)+Math.min(n,s))/2}function Bj(e,n){return[{side:"left",axis:"x",draggedEdge:e.x,referenceEdge:r=>r.x+r.width,isOnSide:r=>r<=e.x,perpendicular:r=>[r.y,r.y+r.height],pageEdge:n?0:null},{side:"right",axis:"x",draggedEdge:e.x+e.width,referenceEdge:r=>r.x,isOnSide:r=>r>=e.x+e.width,perpendicular:r=>[r.y,r.y+r.height],pageEdge:n?n.width:null},{side:"top",axis:"y",draggedEdge:e.y,referenceEdge:r=>r.y+r.height,isOnSide:r=>r<=e.y,perpendicular:r=>[r.x,r.x+r.width],pageEdge:n?0:null},{side:"bottom",axis:"y",draggedEdge:e.y+e.height,referenceEdge:r=>r.y,isOnSide:r=>r>=e.y+e.height,perpendicular:r=>[r.x,r.x+r.width],pageEdge:n?n.height:null}]}function Kj(e,n,r,s=Hj){if(!Number.isFinite(s)||s<=0)return[];const l=[];for(const o of Bj(e,r)){const[c,f]=o.perpendicular(e);let h=null,g=!1;for(const x of n){if(x.source!=="element")continue;const[m,j]=o.perpendicular(x);if(!Oj(c,f,m,j))continue;const k=o.referenceEdge(x);if(!o.isOnSide(k))continue;g=!0;const v=Math.abs(o.draggedEdge-k);v<=0||v>s||h&&v>=h.distance||(h={axis:o.axis,side:o.side,from:o.draggedEdge,to:k,distance:Math.round(v),at:_j(c,f,m,j),source:"element"})}if(!h&&!g&&o.pageEdge!==null){const x=Math.abs(o.draggedEdge-o.pageEdge);x>0&&x<=s&&(h={axis:o.axis,side:o.side,from:o.draggedEdge,to:o.pageEdge,distance:Math.round(x),at:(c+f)/2,source:"page"})}h&&l.push(h)}return l}const Vj=48,Ns=[1,2,5,10,20,50,100,200,500,1e3,2e3],Gj=5;function Uj(e){if(!Number.isFinite(e)||e<=0)return Ns[Ns.length-1];for(const n of Ns)if(n*e>=Vj)return n;return Ns[Ns.length-1]}function Rh(e,n,r){if(!Number.isFinite(e)||!Number.isFinite(n)||n<=e)return[];if(!Number.isFinite(r)||r<=0)return[];const s=Math.ceil(e/r),l=Math.floor(n/r),o=[];for(let c=s;c<=l;c+=1){const f=c*r;o.push({position:f===0?0:f,label:c%Gj===0?String(f===0?0:f):null})}return o}const $0="slicer.freeform.prefs.v1",fr={rulersVisible:!1,guidesVisible:!0,snappingEnabled:!0,exportFormat:"png",exportQuality:.92,exportScale:1,panelOpen:!1,pagesVisible:!0};function Yj(e){return e==="png"||e==="jpeg"||e==="pdf"}function Zj(){try{const e=localStorage.getItem($0);if(!e)return{...fr};const n=JSON.parse(e);if(typeof n!="object"||n===null)return{...fr};const r=n;return{rulersVisible:typeof r.rulersVisible=="boolean"?r.rulersVisible:fr.rulersVisible,guidesVisible:typeof r.guidesVisible=="boolean"?r.guidesVisible:fr.guidesVisible,snappingEnabled:typeof r.snappingEnabled=="boolean"?r.snappingEnabled:fr.snappingEnabled,exportFormat:Yj(r.exportFormat)?r.exportFormat:fr.exportFormat,exportQuality:typeof r.exportQuality=="number"&&Number.isFinite(r.exportQuality)&&r.exportQuality>=.5&&r.exportQuality<=1?r.exportQuality:fr.exportQuality,exportScale:r.exportScale===2?2:1,panelOpen:typeof r.panelOpen=="boolean"?r.panelOpen:fr.panelOpen,pagesVisible:typeof r.pagesVisible=="boolean"?r.pagesVisible:fr.pagesVisible}}catch{return{...fr}}}function Xj(e){try{localStorage.setItem($0,JSON.stringify(e))}catch{}}const Oi=100,D0=10,A0=400,qo=10;function _s(e){return Number.isFinite(e)&&e>0}function qj(e,n,r,s){return[e,n,r,s].every(_s)?Math.min(e/r,n/s):null}function Qj(e,n){return e===null||!_s(e)||!_s(n)?null:e*(n/100)}function Yr(e){return Number.isFinite(e)?Math.min(A0,Math.max(D0,e)):Oi}const Jj=.8;function ew(e,n,r,s,l){if(e===null||!_s(e)||![n,r,s,l].every(_s))return null;const o=Math.min(n/s,r/l)*Jj;return Yr(Math.round(o/e*100))}function tw(e,n){if(!Number.isFinite(n)||n===0)return Yr(e);if(!Number.isFinite(e)||e<=0)return Oi;const r=Math.min(3e3,Math.max(-3e3,n)),s=Math.exp(-r*.0015);return Yr(Math.round(e*s))}const Qa=["opacity","shadow","filter","blendMode"],nw=["fontSize","fontFamily","textFill","align","fontWeight","verticalAlign","paragraphSpacing","list","lineHeight","letterSpacing","italic","vertical","stroke","strokeWidth","effect"],rw=["fill","stroke","strokeWidth","strokeDash","cornerRadius","cornerRadii","starInnerRatio","bubbleTailX"],aw=["stroke","strokeWidth","dash","cap"],iw=["fill","stroke","strokeWidth","dash","cap","join","fillRule"],sw=["dark","light","ecl","moduleStyle","quietZone"],ow=["accent","showValues","showLegend"],lw=["fit","cornerRadius","stroke","strokeWidth"];function P0(e){switch(e){case"text":return[...nw,...Qa];case"shape":return[...rw,...Qa];case"line":return[...aw,...Qa];case"path":return[...iw,...Qa];case"image":return[...lw,...Qa];case"qrcode":return[...sw,...Qa];case"chart":return[...ow,...Qa];default:return[]}}function cw(e){if(e.type==="group")return null;const n={};for(const r of P0(e.type)){const s=e[r];s!==void 0&&(n[r]=s)}if(e.type==="shape"&&e.shape==="rect"&&e.cornerRadii===void 0&&(n.cornerRadii=null),e.type==="path"){const r=ni(e.viewBox,e.width,e.height);n.strokeWidth=e.strokeWidth*r,e.dash!==void 0&&(n.dash=e.dash*r)}return Object.keys(n).length>0?n:null}function dw(e,n,r=1){if(n==="group")return{};const s=new Set(P0(n)),l={};for(const[o,c]of Object.entries(e))if(!(!s.has(o)||c===void 0)&&!(n==="path"&&o==="fill"&&c.type==="image")&&!(n==="path"&&o==="stroke"&&!rr(c))){if(n==="path"&&(o==="strokeWidth"||o==="dash")&&typeof c=="number"){l[o]=c/r;continue}l[o]=c}return l}function uw(e){const[n,r]=p.useState(()=>{var s;return typeof window<"u"&&((s=window.matchMedia)==null?void 0:s.call(window,e).matches)===!0});return p.useEffect(()=>{var o;const s=(o=window.matchMedia)==null?void 0:o.call(window,e);if(!s)return;const l=()=>r(s.matches);return l(),s.addEventListener("change",l),()=>s.removeEventListener("change",l)},[e]),n}const fw=1e-4,hw=3500,mw={cornerRadius:"调整圆角",starInnerRatio:"调整星角内径",bubbleTailX:"调整气泡尾巴"},pw=["#d92d20","#f97316","#f79009","#129211","#1570ef","#6941c6"],gw=["#fef08a","#fed7aa","#fbcfe8","#bbf7d0","#bfdbfe","#e9d5ff"],xw={color:"#101828",blur:24,offsetX:0,offsetY:8},bw={normal:"正常",multiply:"正片叠底",screen:"滤色",overlay:"叠加",darken:"变暗",lighten:"变亮","color-dodge":"颜色减淡","color-burn":"颜色加深","hard-light":"强光","soft-light":"柔光",difference:"差值",exclusion:"排除",hue:"色相",saturation:"饱和度",color:"颜色",luminosity:"明度"},yw=Jg.map(e=>({id:e,label:bw[e]??e})),Ih=[{id:"round",label:"圆头"},{id:"butt",label:"平头"},{id:"square",label:"方头"}],jw=[{id:"round",label:"圆滑"},{id:"miter",label:"尖角"},{id:"bevel",label:"斜切"}],ww=[{id:"none",label:"无"},{id:"arrow",label:"箭头"},{id:"dot",label:"圆点"}],kw=[{id:"start",label:"起点"},{id:"end",label:"终点"}],Sw=wd("freeform");function vw(e,n){const r=n?52:80,s=n?72:120,l=e.width>0&&e.height>0?e.width/e.height:1,o=Math.min(s,r/l);return{width:Math.round(Math.min(r,o*l)),height:Math.round(o)}}function Lh(e){const n=e.currentTarget.getBoundingClientRect(),r=e.currentTarget.closest(".freeform-slide-list");return r!==null&&getComputedStyle(r).flexDirection==="row"?e.clientX<n.left+n.width/2?"before":"after":e.clientY<n.top+n.height/2?"before":"after"}const Nw=[{id:"cover",label:"填满"},{id:"contain",label:"适应"}],Mw=[{id:"square",label:"直角",radius:0},{id:"small",label:"小圆",radius:12},{id:"large",label:"大圆",radius:28},{id:"capsule",label:"胶囊",radius:"capsule"}],Fw=[{id:"original",label:"原图"},{id:"1:1",label:"1:1"},{id:"4:3",label:"4:3"},{id:"3:4",label:"3:4"},{id:"16:9",label:"16:9"},{id:"9:16",label:"9:16"}],Cw={original:"original","1:1":1,"4:3":4/3,"3:4":3/4,"16:9":16/9,"9:16":9/16};function Ec(e){return{scopeGeneration:e.scopeGeneration,slideId:e.slideId,scenePathKey:ye(e.path),logicalSrc:e.logicalSrc,resolvedSrc:e.resolvedSrc}}function Hi(e){if((e==null?void 0:e.type)==="image")return{targetKind:"image",logicalSrc:e.src,resolvedSrc:Et.images.resolve(e.src),fit:e.fit,framing:e.framing,frameSize:{width:e.width,height:e.height},shape:null};if((e==null?void 0:e.type)==="shape"&&e.fill.type==="image")return{targetKind:"shape-fill",logicalSrc:e.fill.src,resolvedSrc:Et.images.resolve(e.fill.src),fit:e.fill.fit,framing:e.fill.framing,frameSize:{width:e.width,height:e.height},shape:e.shape};if((e==null?void 0:e.type)==="path"&&e.fill.type==="image"){const n=Hg(e.d,e.viewBox,e.width,e.height);return{targetKind:"shape-fill",logicalSrc:e.fill.src,resolvedSrc:Et.images.resolve(e.fill.src),fit:e.fill.fit,framing:e.fill.framing,frameSize:{width:e.width,height:e.height},shape:null,...n!==null?{clipPath:`path("${n}")`}:{}}}return null}function Qo(e,n){if(n.length>0)return Hi(jt(e.nodes,n));const r=e.background;return r.type!=="image"?null:{targetKind:"page-background",logicalSrc:r.src,resolvedSrc:Et.images.resolve(r.src),fit:r.fit,framing:r.framing,frameSize:{width:e.width,height:e.height},shape:null}}function Ai(e,n,r,s){return{scopeGeneration:e,slideId:n,scenePathKey:ye(r),logicalSrc:s.logicalSrc,resolvedSrc:s.resolvedSrc}}function Jo(e,n){return JSON.stringify([e,n])}function zc(e,n,r){return JSON.stringify([e,n,ye(r)])}function Ew(e){return{transform:`matrix(${e.join(",")})`}}function $h(e,n,r,s){return r.targetKind==="page-background"?{type:"slide/update",slideId:e,patch:{background:{type:"image",src:r.logicalSrc,fit:r.fit,framing:s}}}:{type:"node/update-style",slideId:e,updates:[{path:[...n],patch:r.targetKind==="image"?{framing:s}:{fill:{type:"image",src:r.logicalSrc,fit:r.fit,framing:s}}}]}}function zw(e){if(!Number.isFinite(e))return Ps;const n=Math.round(e*100);return Math.min(Ki,Math.max(Ps,n/100))}function Rw(e,n){return e.x!==n.x||e.y!==n.y||e.width!==n.width||e.height!==n.height||!Es(e.framing,n.framing)}function Iw(e){try{const n=JSON.parse(e);return Array.isArray(n)&&n.length>0&&n.every(r=>typeof r=="string")?n:null}catch{return null}}function Lw(e){const n=e.slides.find(r=>r.id===e.activeSlideId);if(!n)throw new Error("Freeform document has no valid active slide");return n}function $w(e,n,r){const s=Math.min(1,e.width/r.width,n.height*.7/r.height),l=Math.max(1,Math.round(r.width*s)),o=Math.max(1,Math.round(r.height*s));return{...e,x:Math.round((n.width-l)/2),y:Math.round((n.height-o)/2),width:l,height:o}}function el(e){return e.path.length===0?i(e.name):Ir(e.name)}function Ms(e){return new Promise((n,r)=>{const s=new FileReader;s.onload=()=>n(String(s.result??"")),s.onerror=()=>r(s.error),s.readAsDataURL(e)})}function Is(e){if(!(e instanceof HTMLElement))return!1;const n=e.tagName.toLowerCase();return n==="input"||n==="textarea"||n==="select"||e.isContentEditable}function Dw(e){var n;return e===((n=globalThis.document)==null?void 0:n.body)?!0:e instanceof HTMLElement&&!!e.closest('[data-testid="freeform-canvas"]')}function Aw(e){return e instanceof Element?!!e.closest('button, input, textarea, select, a[href], label, summary, [contenteditable="true"], [role="treeitem"], [role="option"], [role="menuitem"], [role="menu"]'):!1}function Dh(e){var r;if(!(e instanceof Element))return null;const n=[];for(let s=e.closest("[data-scene-node-id]");s;s=((r=s.parentElement)==null?void 0:r.closest("[data-scene-node-id]"))??null){const l=s.getAttribute("data-scene-node-id");if(!l)break;n.unshift(l)}return n.length>0?n:null}function Sn(){var n;const e=(n=globalThis.document)==null?void 0:n.activeElement;e instanceof HTMLElement&&Is(e)&&e.blur()}function Er(e,n,r){return Math.max(n,Math.min(r,e))}function An(e){const n=Number.parseFloat(e);return Number.isFinite(n)?n:0}function Rc(e,n){const r=URL.createObjectURL(e),s=globalThis.document.createElement("a");s.href=r,s.download=n,s.click(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}const Pw={png:"png",jpeg:"jpg",pdf:"pdf"};function Ic(e,n){return`slide-${String(e+1).padStart(2,"0")}.${Pw[n]}`}function ja(e,n,r){return new Promise(s=>e.toBlob(s,n,r))}function Tw(e){const n=e[0];return n?e.some(r=>r.width!==n.width||r.height!==n.height):!1}function Ah(e,n,r,s){return s.flatMap(l=>{const o=jt(e,[...r,l]),c=jt(n,[...r,l]);if(!o||!c||o.type!==c.type)return[];const f={x:c.x,y:c.y,rotation:c.rotation,scale:c.scale};return o.type!=="group"&&c.type!=="group"&&(f.width=c.width,f.height=c.height),[{path:[...r,l],patch:f}]})}function tl(e,n){const r=n.flatMap(f=>{const h=Tn(e,f);return h?[h]:[]});if(r.length===0)return null;const s=Math.min(...r.map(f=>f.x)),l=Math.min(...r.map(f=>f.y)),o=Math.max(...r.map(f=>f.x+f.width)),c=Math.max(...r.map(f=>f.y+f.height));return{x:s,y:l,width:o-s,height:c-l}}function Ww(e,n,r){var h;const s=ri(e,n),l=s?((h=Bi(s))==null?void 0:h.scale)??1:1,o=[],c=(g,x)=>{const m=x*g.scale;o.push(l*m),g.type==="group"&&g.children.forEach(j=>c(j,m))};return(Gn(e,n)??[]).filter(g=>r.includes(g.id)).forEach(g=>c(g,1)),o.length===0?{min:dl,max:ul}:{min:Math.max(...o.map(g=>dl/g)),max:Math.min(...o.map(g=>ul/g))}}function Ph(e,n){return Lr(ui(n.x,n.y),Lr(e,ui(-n.x,-n.y)))}function Th(e,n,r){const s=Hw(e,n.nodes,r);return r.length===0?w5(s,n.nodes,n):s}function Hw(e,n,r){if(r.length===0)return e;const s=jt(n,r),l=(s==null?void 0:s.type)==="group"?ud(s.children):null;if(!l)return{...e,x:-e.width/2,y:-e.height/2};const o=l.x+l.width/2,c=l.y+l.height/2;return{...e,x:o-e.width/2,y:c-e.height/2}}function Ow(e,n){return e instanceof Error&&e.message.trim()?i(e.message):n}const _w=4,Bw=6;function Wh(e,n,r){return{...e==="x"?{left:n,width:1/r}:{top:n,height:1/r},"--freeform-guide-dash":`${_w/r}px`}}const T0="图层已锁定,先解锁后再编辑",Kw="请先结束当前变换";function Pi(e,n){return n==="locked"||n==="locked-parent"?e==="group"?i("图层或父级已锁定,无法组合"):e==="ungroup"?i("图层或父级已锁定,无法解组"):i(T0):e==="group"?n==="requires-two"||n==="empty-selection"?i("至少选择两个同级图层后才能组合"):n==="invalid-selection"?i("只能组合同一组内的图层"):n==="hidden"?i("隐藏图层无法组合"):i("当前图层无法组合"):e==="ungroup"?n==="not-group"?i("请选择一个或多个组合后再解组"):i("当前图层无法解组"):i("无法在当前编辑范围内插入对象")}function Hh(e){return{x:e.startX,y:e.startY,width:e.currentX-e.startX,height:e.currentY-e.startY}}function wa(e){return(e==null?void 0:e.type)==="shape"}const Vw=["L","M","Q","H"],Gw=["square","rounded","dot"],Uw={square:"方块",rounded:"圆角",dot:"圆点"},Yw=[{value:0,label:"无"},{value:1,label:"窄"},{value:2,label:"标准"},{value:4,label:"宽"}],Zw=[{id:"classic",label:"经典",dark:"#18181b",light:"#ffffff",moduleStyle:"square"},{id:"dot",label:"圆点",dark:"#18181b",light:"#ffffff",moduleStyle:"dot"},{id:"blue",label:"商务蓝",dark:"#1d4ed8",light:"#eff6ff",moduleStyle:"rounded"},{id:"warm",label:"暖橙",dark:"#b45309",light:"#fef3c7",moduleStyle:"dot"},{id:"promo",label:"促销红",dark:"#dc2626",light:"#fff1f2",moduleStyle:"square"}];function Oh(e){return(e==null?void 0:e.type)==="qrcode"}function Lc(e){return(e==null?void 0:e.type)==="chart"}function Xw(e){return(e==null?void 0:e.type)==="table"}function qw(e){return(e==null?void 0:e.type)==="timeline"}function Qw(e){return(e==null?void 0:e.type)==="progress"}const Jw=["bar","ring","line","radar"],e8=["grouped","stacked","percent"],t8={grouped:"分组",stacked:"堆叠",percent:"百分比"},_h=["#1d4ed8","#e11d48","#f59e0b"],n8=e=>_h.find(n=>!e.includes(n))??_h[0],r8={bar:"柱状图",ring:"环形图",line:"折线图",radar:"雷达图"},a8=["auto","on","off"],i8={auto:"自动",on:"显示",off:"隐藏"},s8={all:"全框",rows:"横线","three-line":"三线表",none:"无"},o8=[{id:"business",label:"商务蓝",colors:["#1d4ed8","#0ea5e9","#94a3b8"]},{id:"sunset",label:"暖阳",colors:["#b45309","#dc2626","#f59e0b"]},{id:"grove",label:"森林",colors:["#15803d","#65a30d","#0f766e"]},{id:"candy",label:"糖果",colors:["#db2777","#7c3aed","#f59e0b"]}];function Ja(e){return(e==null?void 0:e.type)==="image"}function _n(e){return(e==null?void 0:e.type)==="text"}function Ti(e){return(e==null?void 0:e.type)==="line"}function ei(e){return(e==null?void 0:e.type)==="path"}function l8({filter:e,resetKey:n,onChange:r}){const s=[{key:"brightness",label:i("亮度"),min:0,max:3,fallback:1},{key:"contrast",label:i("对比度"),min:0,max:3,fallback:1},{key:"saturation",label:i("饱和度"),min:0,max:3,fallback:1},{key:"hue",label:i("色调"),min:0,max:360,fallback:0},{key:"grayscale",label:i("灰度"),min:0,max:1,fallback:0},{key:"sepia",label:i("复古黄"),min:0,max:1,fallback:0},{key:"blur",label:i("模糊"),min:0,max:100,fallback:0}];return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"filter-presets",role:"group","aria-label":i("滤镜预设"),"data-testid":"filter-presets",children:[t.jsxs("button",{className:e?"filter-preset-tile":"filter-preset-tile on",type:"button","data-testid":"filter-preset-none","aria-pressed":!e,onClick:()=>r(null),children:[t.jsx("span",{className:"filter-preset-swatch",style:{background:th}}),i("原图")]}),e5.map(l=>{const o=e!==void 0&&e2(e,l.filter);return t.jsxs("button",{className:o?"filter-preset-tile on":"filter-preset-tile",type:"button","data-testid":`filter-preset-${l.id}`,"aria-pressed":o,title:i("滤镜预设{name}",{name:i(l.name)}),onClick:()=>r({...l.filter}),children:[t.jsx("span",{className:"filter-preset-swatch",style:{background:th,filter:t5(l)}}),i(l.name)]},l.id)})]}),e?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"field-grid",children:s.map(({key:l,label:o,min:c,max:f,fallback:h})=>t.jsxs("label",{children:[o,t.jsx(Ct,{ariaLabel:i("滤镜{name}",{name:o}),min:c,max:f,resetKey:n,value:e[l]??h,onCommit:g=>r({...e,[l]:g})})]},l))}),t.jsx("div",{className:"inspector-actions",children:t.jsx("button",{className:"ghost",type:"button","data-testid":"filter-clear",onClick:()=>r(null),children:i("清除滤镜")})})]}):t.jsx("div",{className:"inspector-actions",children:t.jsx("button",{className:"ghost",type:"button","data-testid":"filter-add",onClick:()=>r({brightness:1.1,contrast:1.1}),children:i("添加滤镜")})})]})}function c8({shadow:e,resetKey:n,onChange:r}){return e?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"field-grid with-gap",children:[t.jsxs("div",{className:"stroke-color-field","data-testid":"shadow-color",children:[t.jsx("span",{className:"stroke-color-label",children:i("颜色")}),t.jsxs("div",{className:"color-field",children:[t.jsx("span",{className:"color-field-value",children:e.color==="transparent"?i("透明"):e.color.toUpperCase()}),t.jsx(vt,{label:i("阴影颜色"),color:e.color,onChange:s=>r({...e,color:s})})]})]}),t.jsxs("label",{title:i("阴影模糊"),children:[t.jsx(zn,{name:"blur"}),t.jsx(Ct,{ariaLabel:i("阴影模糊"),min:0,max:400,resetKey:n,value:e.blur,onCommit:s=>r({...e,blur:s})})]})]}),t.jsxs("div",{className:"field-grid",children:[t.jsxs("label",{title:i("阴影水平偏移"),children:[t.jsx("span",{className:"field-glyph","aria-hidden":"true",children:"X"}),t.jsx(Ct,{ariaLabel:i("阴影水平偏移"),min:-1e3,max:1e3,resetKey:n,value:e.offsetX,onCommit:s=>r({...e,offsetX:s})})]}),t.jsxs("label",{title:i("阴影垂直偏移"),children:[t.jsx("span",{className:"field-glyph","aria-hidden":"true",children:"Y"}),t.jsx(Ct,{ariaLabel:i("阴影垂直偏移"),min:-1e3,max:1e3,resetKey:n,value:e.offsetY,onCommit:s=>r({...e,offsetY:s})})]})]}),t.jsx("div",{className:"inspector-actions",children:t.jsx("button",{className:"ghost",type:"button","data-testid":"shadow-clear",onClick:()=>r(null),children:i("清除阴影")})})]}):t.jsx("div",{className:"inspector-actions",children:t.jsx("button",{className:"ghost",type:"button","data-testid":"shadow-add",onClick:()=>r({...xw}),children:i("添加阴影")})})}const d8=[{id:"left",testId:"left",label:"左对齐",icon:"M4 3v14M7 6.5h9M7 13.5h5.5"},{id:"h-center",testId:"hcenter",label:"水平居中",icon:"M10 3v14M5 6.5h10M6.75 13.5h6.5"},{id:"right",testId:"right",label:"右对齐",icon:"M16 3v14M4 6.5h9M7.5 13.5H13"},{id:"top",testId:"top",label:"顶对齐",icon:"M3 4h14M6.5 7v9M13.5 7v5.5"},{id:"v-center",testId:"vcenter",label:"垂直居中",icon:"M3 10h14M6.5 5v10M13.5 6.75v6.5"},{id:"bottom",testId:"bottom",label:"底对齐",icon:"M3 16h14M6.5 4v9M13.5 7.5V13"}],Bh=10,Kh=32;function En({keys:e}){return t.jsx("kbd",{className:"freeform-context-menu-shortcut","aria-hidden":"true",children:e})}const u8=[{id:"box",testId:"insert-text",label:"添加文本框"},{id:"heading",testId:"insert-text-heading",label:"添加标题"},{id:"subheading",testId:"insert-text-subheading",label:"添加副标题"},{id:"body",testId:"insert-text-body",label:"添加一段正文"}],f8={heading:{text:"添加标题",fontSize:88,fontWeight:"bold",lineHeight:1.15,height:110,maxWidth:860,widthRatio:.8},subheading:{text:"添加副标题",fontSize:52,fontWeight:"bold",lineHeight:1.2,height:70,maxWidth:720,widthRatio:.68},body:{text:"在这里写一段正文,说说你想分享的内容。",fontSize:30,fontWeight:"normal",lineHeight:1.55,height:104,maxWidth:640,widthRatio:.6}},h8=[{id:"left",label:"文字左对齐",icon:"M2.5 4h11M2.5 8h7M2.5 12h9"},{id:"center",label:"文字居中",icon:"M2.5 4h11M4.5 8h7M3.5 12h9"},{id:"right",label:"文字右对齐",icon:"M2.5 4h11M6.5 8h7M4.5 12h9"},{id:"justify",label:"文字两端对齐",icon:"M2.5 4h11M2.5 8h11M2.5 12h7"}],m8=[{id:"top",label:"文字靠上",icon:"M2.5 2.5h11M5 6h6M5 8.75h6"},{id:"middle",label:"文字垂直居中",icon:"M2.5 2.5h11M2.5 13.5h11M5 6.75h6M5 9.5h6"},{id:"bottom",label:"文字靠下",icon:"M2.5 13.5h11M5 7.25h6M5 10h6"}],p8=[{id:"none",label:"无列表",icon:"M2.5 4h11M2.5 8h11M2.5 12h11"},{id:"bullet",label:"项目符号列表",icon:"M6 4h7.5M6 8h7.5M6 12h7.5M2.75 4h.01M2.75 8h.01M2.75 12h.01"},{id:"number",label:"编号列表",icon:"M6 4h7.5M6 8h7.5M6 12h7.5M2.25 3l.9-.6v3.1M2 8.4c.25-.55 1.75-.6 1.75.3 0 .65-1.75 1.15-1.75 1.8h1.85"}],g8=[{id:"front",label:"置顶",icon:"M10 16V7M6.5 10.5 10 7l3.5 3.5M5 3.5h10"},{id:"forward",label:"前移",icon:"M10 15.5V5.5M6.5 9 10 5.5 13.5 9"},{id:"backward",label:"后移",icon:"M10 4.5v10M6.5 11 10 14.5l3.5-3.5"},{id:"back",label:"置底",icon:"M10 4v9M6.5 9.5 10 13l3.5-3.5M5 16.5h10"}];function x8({isActive:e,user:n,ownerId:r,transfer:s=null,requestAuth:l,chrome:o,request:c=null,onMetaChange:f}){var Ku,Vu,Gu;const[h,g]=p.useState(()=>Mc(Ao())),x=h.current,m=Lw(x),j=x.slides.indexOf(m),k=p.useRef([]),v={activeSlideId:m.id,draftId:null,userId:r},[w,N]=p.useState(()=>({activeGroupPath:[],selectionPaths:[],identity:v})),M=w.activeGroupPath,I=w.selectionPaths,F=p.useMemo(()=>Gn(m.nodes,M)??[],[M,m.nodes]),[z,A]=p.useState(null),[T,L]=p.useState(null),[H,P]=p.useState(Oi),[U,K]=p.useState(0),[D,re]=p.useState(null),[q,te]=p.useState(!1),[be,ne]=p.useState(!1),Be=p.useRef(!1),le=p.useRef(null),De=p.useRef(null),[W,ae]=p.useState(null),ke=p.useRef(null),[Ee,ue]=p.useState(null),Ye=p.useRef(null),Ue=p.useRef(null),Ot=p.useRef(null),zt=p.useRef(null),oe=uw("(max-width: 1100px)"),fe=p.useRef(null),[Ae,ze]=p.useState(null),[Xe,Fe]=p.useState(!1),[Mt,Qe]=p.useState(null),[mt,It]=p.useState(!1),[_t,lt]=p.useState(!1),[pt,ee]=p.useState(null),[He,ct]=p.useState(!1),[Lt,bt]=p.useState(null),gn=p.useRef(x),xn=mt&&pt?pt.id:null;p.useEffect(()=>{if(!xn||!r)return;let a=!1;const u=r;return xt(u).shares.list(u).then(y=>{if(a)return;const S=y.find(E=>E.id===xn);S&&ee(S)},()=>{}),()=>{a=!0}},[xn,r]);const[$t,Zn]=p.useState(!1),[se,ve]=p.useState(!1),[ce,me]=p.useState(null),Dt=p.useRef(()=>{}),ts=p.useCallback(a=>Dt.current(a),[]),[Xn,Js]=p.useState("properties"),[aa,mi]=p.useState(null),[In,ia]=p.useState(null),[pi,Jt]=p.useState(null),[ns,Ca]=p.useState(!1),[ir,Ea]=p.useState(()=>i("未命名设计")),[sa,oa]=p.useState(!1),za=p.useRef(!1),sr=p.useRef(0),eo=p.useRef(0),Ra=p.useRef(()=>{}),[rs,Ze]=p.useState(null),[to,gi]=p.useState(!1),Dr=p.useRef(0),[or,br]=p.useState(null),[zl,Ia]=p.useState([]),[as,la]=p.useState(null),[Rl,xi]=p.useState([]),[no,yr]=p.useState(null),[Ge,Il]=p.useState(Zj);function qn(a){Il(u=>{const y={...fr,...u,...a};return Xj(y),y})}function ro(a){if(Ge.panelOpen&&Xn===a){qn({panelOpen:!1});return}Js(a),Ge.panelOpen||qn({panelOpen:!0})}function La(a){me(u=>u===a?null:a)}const[bi,bn]=p.useState(null),en=p.useRef(null),[ca,is]=p.useState(eg),[ao,Ll]=p.useState(0),Qn=p.useRef(ca),Ut=p.useRef(null),[io,Ar]=p.useState(()=>new Set),[yn,so]=p.useState(null),gt=p.useRef(null),we=Qj(D,H),Nn=ej(we),_=Nn.session,Q=p.useRef(null),je=p.useRef(null),Ie=p.useRef(null),xe=p.useMemo(()=>mc(m.nodes,M,I),[M,m.nodes,I]),_e=p.useMemo(()=>xe.map(a=>a[a.length-1]),[xe]),rn=p.useMemo(()=>F.filter(a=>_e.includes(a.id)),[F,_e]),jn=rn.length>0&&rn.every(a=>a.locked),lr=rn.length>0&&rn.every(a=>a.hidden),yi=rn.some(a=>a.type==="group"),cr=rn.some(a=>a.type!=="group"),oo=rn.length===1&&rn[0].type==="image",jr=Ee?x.slides.findIndex(a=>a.id===Ee.slideId):-1,ss=p.useMemo(()=>{const a=[];for(let u=h.future.length-1;u>=0;u-=1)a.push({key:`future-${u}`,label:h.future[u].label,kind:"future",index:u});a.push({key:"current",label:h.past.length>0?h.past[h.past.length-1].label:"初始文档",kind:"current",index:-1});for(let u=h.past.length-1;u>=0;u-=1)a.push({key:`past-${u}`,label:u>0?h.past[u-1].label:"初始文档",kind:"past",index:u});return a},[h]),dt=p.useCallback(a=>{N(u=>{const y=mc(m.nodes,u.activeGroupPath,u.selectionPaths).map(E=>E[E.length-1]),S=typeof a=="function"?a(y):a;return{...u,selectionPaths:S.map(E=>[...u.activeGroupPath,E])}})},[m.nodes]),da=p.useRef(null),ua=p.useRef(null),lo=p.useRef(null),[Kt,Dd]=p.useState(null),[Vt,co]=p.useState(null),$l=p.useRef(null),$a=p.useRef(null),Ad=p.useRef(null),uo=p.useRef(null),fo=p.useRef(null),H0=wl(),ji=p.useRef(null),ho=p.useRef(null),mo=p.useRef(null),[Pd,Td]=p.useState(!1),Pr=p.useRef(new Map),Wd=p.useRef(null),wt=p.useRef(0),os=p.useRef(0),ls=p.useRef(h),at=p.useRef(x),wr=p.useRef(In),Yt=p.useRef(r),Hd=p.useRef(s),Da=p.useRef(null),cs=p.useRef(ir),Od=p.useRef(pi),fa=p.useRef(sa),ds=p.useRef(x),us=p.useRef(null),[Dl,_d]=p.useState(null),Al=p.useRef(null),Pl=p.useRef(null);cs.current=ir,Od.current=pi,fa.current=sa,k.current=_e,ls.current=h,at.current=x,wr.current=In,Yt.current=r,Hd.current=s;const Tr=xt(r??hn);Qn.current=ca,gt.current=yn,Q.current=_;const Aa=p.useCallback(a=>{wr.current=a,ia(a)},[]),wi=_e,C=p.useMemo(()=>{const a=xe[0]?jt(m.nodes,xe[0]):void 0;return(a==null?void 0:a.type)==="group"?void 0:a},[m.nodes,xe]),et=xe.length===1?xe[0]:null,Pa=Lc(C)?Math.min(U,C.series.length-1):0,ki=Lc(C)?C.series[Pa]:void 0,Bt=JSON.stringify([wt.current,os.current,m.id,et]),ut=p.useMemo(()=>{if(!et)return null;const a=jj(m.nodes,et);return a.ok?a.properties:null},[m.nodes,et]),Wt=p.useMemo(()=>{const a=tg(m.nodes,xe);if(!a)return null;const u=jt(m.nodes,a);return u?{unlockPath:a,unlockName:u.name}:null},[m.nodes,xe]),tn=p.useMemo(()=>{const a=ng(m.nodes,xe)??((ut==null?void 0:ut.editability.kind)==="locked-descendant"?ut.editability.sourcePath:null);if(!a)return null;const u=jt(m.nodes,a);return u?{sourcePath:a,sourceName:u.name}:null},[m.nodes,ut,xe]),Ta=!!(Wt||tn),Ft=p.useMemo(()=>Hi(C),[C]),Bd=p.useMemo(()=>et&&Ft?Ai(wt.current,m.id,et,Ft):null,[m.id,Ft,et]),O0=Bd?ks(ca,Bd):null,Kd=!!(et&&(Ft==null?void 0:Ft.targetKind)==="shape-fill"&&io.has(zc(wt.current,m.id,et))),Wa=Ta?i("请先解锁图片"):Kd?i("图片正在处理中"):(Ft==null?void 0:Ft.fit)==="contain"?Ft.targetKind==="image"?i("请先切换到填满模式后裁剪"):i("适应模式不支持调整取景"):O0?null:(Ft==null?void 0:Ft.targetKind)==="image"?i("图片加载完成后可裁剪"):i("图片加载完成后可调整取景"),fs=!!(Ft&&et&&Ft.fit==="cover"&&!Wa),Tl=!!(fs&&(Ft==null?void 0:Ft.targetKind)==="image"),hs=!!(Ft&&Ft.fit==="cover"&&!Kd&&!Ta&&!Es(Ft.framing,zr())),kr=p.useMemo(()=>Qo(m,[]),[m]),_0=kr?ks(ca,Ai(wt.current,m.id,[],kr)):null,Vd=Pd?i("图片正在处理中"):(kr==null?void 0:kr.fit)==="contain"?i("适应模式不支持调整取景"):_0?null:i("图片加载完成后可调整取景"),B0=!!(kr&&kr.fit==="cover"&&!Vd),Gd=!!(kr&&kr.fit==="cover"&&!Pd&&!Es(kr.framing,zr())),Ud=p.useMemo(()=>{const a=[{name:"页面",path:[]}];for(let u=1;u<=M.length;u+=1){const y=M.slice(0,u),S=jt(m.nodes,y);if((S==null?void 0:S.type)!=="group")break;a.push({name:S.name,path:y})}return a},[M,m.nodes]),Yd=p.useMemo(()=>xe.length>0&&!Wt&&!tn&&xe.every(a=>{var u;return ye(a.slice(0,-1))===ye(M)&&!((u=jt(m.nodes,a))!=null&&u.hidden)}),[M,m.nodes,Wt,tn,xe]),K0=h.past.length>0,V0=h.future.length>0,Wr=or?Hh(or):null,Wl=p.useMemo(()=>pc([m]),[m]),Hl=p.useMemo(()=>pc(x.slides),[x.slides]),G0=p.useMemo(()=>rm(x),[x]),wn=p.useCallback((a,u)=>{Ze(Ow(a,u))},[]),Zt=p.useCallback(a=>{const u=ls.current,y=typeof a=="function"?a(u):a;return ls.current=y,at.current=y.current,Object.is(y,u)||g(y),y},[]),sn=p.useCallback(()=>{Ze(i(T0))},[]),Te=p.useCallback(()=>!en.current&&$a.current===null&&!gt.current&&!Q.current?!1:(Ze(i(Kw)),!0),[]),U0=p.useCallback(a=>{wn(a,i("图片续租失败,请检查网络后重试"))},[wn]),ms=r0(G0,r!==null&&Tr.remote,U0),Ol=p.useCallback(()=>{is(a=>{const u=rg(a);return Qn.current=u,u}),Ll(a=>a+1)},[]),Y0=p.useCallback(a=>{const u=wt.current;is(y=>{const S=ag(y,u,a);return Qn.current=S,S})},[]),Zd=p.useCallback(a=>{if(a.identity.scopeGeneration!==wt.current)return;const u=a.identity.scenePathKey===ig?[]:Iw(a.identity.scenePathKey),y=Q.current;if(y){const J=Ec(y),Le=Vl(y),$e=rf({sessionIdentity:J,currentIdentity:(Le==null?void 0:Le.identity)??null,readiness:a});$e.invalidate&&($e.reason==="loading"?Ut.current={...a.identity}:$e.reason==="error"?(Ut.current=null,Ze(i("图片加载失败,请重试"))):Ut.current=null,wo())}const S=!!(Ut.current&&af(a.identity,Ut.current)),E=u?at.current.slides.find(J=>J.id===a.identity.slideId):void 0,R=E&&u?Qo(E,u):null,$=E&&u&&R?Ai(wt.current,E.id,u,R):null;if(!$)return;const O=Qn.current,V=sg(O,a,$);Object.is(V,O)||(Qn.current=V,is(V)),a.status==="error"&&S?(Ut.current=null,Ze(i("图片加载失败,请重试"))):a.status==="ready"&&S&&(Ut.current=null)},[M,ao]),_l=p.useCallback(()=>{const a=da.current;if(!a)return;const u=a.getBoundingClientRect(),y=getComputedStyle(a),S=u.width-An(y.borderLeftWidth)-An(y.borderRightWidth)-An(y.paddingLeft)-An(y.paddingRight),E=u.height-An(y.borderTopWidth)-An(y.borderBottomWidth)-An(y.paddingTop)-An(y.paddingBottom),R=qj(S,E,m.width,m.height);R!==null&&re($=>$!==null&&Math.abs($-R)<fw?$:R)},[m.height,m.width]);p.useLayoutEffect(()=>{if(!e)return;_l();const a=da.current;if(!a)return;const u=new ResizeObserver(()=>_l());return u.observe(a),()=>u.disconnect()},[e,_l]),p.useEffect(()=>{if(!e)return;const a=lo.current;if(!a)return;const u=y=>{if(!y.ctrlKey&&!y.metaKey)return;y.preventDefault();const S=tw(H,y.deltaY);if(S===H)return;const E=ua.current;if(!E||we===null||we<=0){le.current=null,P(S);return}const R=E.getBoundingClientRect();le.current={clientX:y.clientX,clientY:y.clientY,worldX:(y.clientX-R.left)/we,worldY:(y.clientY-R.top)/we},P(S)};return a.addEventListener("wheel",u,{passive:!1}),()=>a.removeEventListener("wheel",u)}),p.useLayoutEffect(()=>{const a=da.current,u=ua.current,y=De.current;if(y){De.current=null,le.current=null;const R=a?Fu():null;if(!a||!u||!R||we===null||we<=0)return;const $=u.getBoundingClientRect();a.scrollLeft+=$.left-(R.clientLeft+R.width/2-y.worldX*we),a.scrollTop+=$.top-(R.clientTop+R.height/2-y.worldY*we);return}const S=le.current;if(!S||(le.current=null,!a||!u||we===null||we<=0))return;const E=u.getBoundingClientRect();a.scrollLeft+=E.left-(S.clientX-S.worldX*we),a.scrollTop+=E.top-(S.clientY-S.worldY*we)});const ps=p.useCallback(()=>{const a=lo.current,u=ua.current;if(!a||!u||we===null||we<=0){Dd(null);return}const y=a.getBoundingClientRect(),S=u.getBoundingClientRect(),E={left:S.left-y.left,top:S.top-y.top,scale:we,width:a.clientWidth,height:a.clientHeight};Dd(R=>R&&R.width===E.width&&R.height===E.height&&Math.abs(R.left-E.left)<.01&&Math.abs(R.top-E.top)<.01&&Math.abs(R.scale-E.scale)<.01?R:E)},[we]);p.useEffect(()=>{ps()},[ps,we,m.width,m.height]),p.useEffect(()=>{if(!e)return;const a=lo.current;if(!a)return;const u=new ResizeObserver(()=>ps());return u.observe(a),()=>u.disconnect()},[e,ps]),p.useLayoutEffect(()=>{const a=Ee??W;if(!a)return;const u=Ee?Ye.current:ke.current;if(!u)return;const y=u.getBoundingClientRect(),S=8,E=Er(a.x,S,Math.max(S,window.innerWidth-y.width-S)),R=Er(a.y,S,Math.max(S,window.innerHeight-y.height-S));E===a.x&&R===a.y||(Ee?ue({...Ee,x:E,y:R}):ae({x:E,y:R}))},[W,Ee]),p.useLayoutEffect(()=>{const a=zt.current,u=a==null?void 0:a.querySelector(`.freeform-thumb[data-slide-id="${CSS.escape(m.id)}"]`);if(!a||!u)return;const y=a.getBoundingClientRect(),S=u.getBoundingClientRect(),E=8;S.top<y.top?a.scrollTop-=y.top-S.top+E:S.bottom>y.bottom&&(a.scrollTop+=S.bottom-y.bottom+E),S.left<y.left?a.scrollLeft-=y.left-S.left+E:S.right>y.right&&(a.scrollLeft+=S.right-y.right+E)},[m.id,x.slides.length,Ge.pagesVisible]),p.useEffect(()=>{var a,u;Ee!=null&&Ee.fromButton&&((u=(a=Ye.current)==null?void 0:a.querySelector('[role="menuitem"]:not(:disabled)'))==null||u.focus({preventScroll:!0}))},[Ee==null?void 0:Ee.slideId,Ee==null?void 0:Ee.fromButton]),p.useEffect(()=>{if(!e)return;const a=u=>{var E;const y=Ot.current;if(Ot.current=null,Is(u.target)||u.target instanceof Element&&u.target.closest('[aria-modal="true"]')||gt.current||Q.current)return;const S=Yc((E=u.clipboardData)==null?void 0:E.files).slice(0,Bh);if(u.preventDefault(),S.length>0){$p(S);return}bs((y==null?void 0:y.inPlace)??!1)};return window.addEventListener("paste",a),()=>window.removeEventListener("paste",a)}),p.useEffect(()=>{if(!W&&!Ee)return;const a=u=>{var S,E;const y=u.target;y instanceof Node&&((S=ke.current)!=null&&S.contains(y)||(E=Ye.current)!=null&&E.contains(y))||y instanceof Element&&y.closest(".freeform-thumb-menu")||(ae(null),ue(null))};return window.addEventListener("pointerdown",a,!0),()=>window.removeEventListener("pointerdown",a,!0)},[W,Ee]);const Ha=a0((a,u,y)=>{if(a.mode!=="freeform-slide"||u.mode!=="freeform-slide")return;const S=u.document;Aa(a.id);const E=Yt.current;E&&Na(E,{mode:"freeform-slide",freeformDraftId:a.id}),Da.current={source:S,document:a.document,updatedAt:a.updatedAt};const R=!!(en.current||$a.current!==null||gt.current||Q.current);xt(E??hn).remote&&!R&&Zt(O=>Object.is(O.current,S)?{...O,current:a.document}:O);const $=at.current;ds.current=Object.is($,a.document)?a.document:S,(Object.is($,S)||Object.is($,a.document))&&Jt(a.updatedAt),y.title===cs.current&&(fa.current=!1,oa(!1))}),{schedule:Bl,release:po,discard:Z0}=Ha,Xd=Ha.flush;p.useEffect(()=>{e||Xd()},[Xd,e]),p.useEffect(()=>{var $;const a=r,u=Wd.current;if(u===a)return;const y=fa.current||Od.current===null&&ls.current.past.length>0;xs(u),Wd.current=a;const S=us.current,E=u!==null&&!si(u)&&si(a)&&y;if(u!==null&&!E&&!S?Ro(u):po(),wt.current+=1,Pr.current.clear(),Ar(new Set),Ol(),Da.current=null,Jt(null),Ze(null),E){us.current={userId:u,draftId:wr.current},_d(u),Aa(null);return}if(us.current=null,_d(null),a===null)return;if(S){if(S.userId===a){Aa(S.draftId);return}Ro(hn)}const R=wr.current?($=Hd.current)==null?void 0:$.get(wr.current):void 0;if((R==null?void 0:R.mode)==="freeform-slide"){ds.current=at.current,fa.current=!1,Io(R);return}if(u===null&&!S){Aa(null),!y&&!za.current&&Du(a);return}za.current=!1,ws(Ao(),void 0,!1),Du(a)},[Ol,r,po,Aa]),p.useEffect(()=>{const a=Q.current;if(!a)return;const u=Ec(a),y=Vl(a),S=og(Qn.current,u),E=rf({sessionIdentity:u,currentIdentity:(y==null?void 0:y.identity)??null,readiness:S});E.invalidate&&(E.reason==="loading"?Ut.current={...u}:E.reason==="error"?(Ut.current=null,Ze(i("图片加载失败,请重试"))):Ut.current=null,wo())},[M,m.id,m.nodes,In,_,ca,r]),p.useEffect(()=>{const a={activeSlideId:m.id,draftId:In,userId:r};sf(m.nodes,w,a)!==w&&N(u=>sf(m.nodes,u,a))},[m.id,m.nodes,In,r]),p.useEffect(()=>{if(Wl.length===0)return;const a=window.setTimeout(()=>{gc(Wl).catch(()=>{})},250);return()=>window.clearTimeout(a)},[Wl]),p.useEffect(()=>{if(Hl.length===0)return;const a=window.setTimeout(()=>{gc(Hl).catch(()=>{})},1e3);return()=>window.clearTimeout(a)},[Hl]);const Ve=p.useCallback((a,u)=>{if(Te())return!1;const y=at.current,S=Fr(y,a);if(Object.is(S,y))return!1;const E=u??kh(a);return Zt(R=>{if(Object.is(R.current,y))return Fc(R,S,E);const $=Fr(R.current,a);return Object.is($,R.current)?R:Fc(R,$,E)}),Jt(null),!0},[Te,Zt]),go=p.useCallback(a=>{Ve({type:"document/restyle",...a})},[Ve]),X0=p.useMemo(()=>({colors:lg(x).map(a=>a.color),replace:(a,u)=>go({colors:{[a]:u}})}),[x,go]),[ha,xo]=p.useState(null),q0=p.useMemo(()=>new Set(cg(x).map(a=>a.fontFamily)),[x]),Q0=xe.map(a=>a.join("/")).join("|");p.useEffect(()=>{ha&&xo(null)},[Q0]);const J0=p.useCallback((a,u)=>{if(Te())return!1;const y=at.current;let S=y;for(const R of a){const $=Fr(S,R);if(Object.is($,S))return!1;S=$}let E=!1;return Zt(R=>Object.is(R.current,y)?(E=!0,Fc(R,S,u)):R),E&&Jt(null),E},[Te,Zt]);p.useLayoutEffect(()=>{if(!e)return;const a=()=>{if(en.current||$a.current!==null||gt.current||Q.current)return;const y=ua.current;if(!y)return;const S=(V,J)=>{const Le=y.querySelector(`[data-scene-node-id="${CSS.escape(V)}"]`),$e=Le==null?void 0:Le.querySelector(".freeform-textbox");return $e instanceof HTMLElement?k6($e,J):null},E=S6(m.nodes,S);if(E.length===0)return;const R={type:"node/update-geometry",slideId:m.id,updates:E.map(V=>({path:[...V.path],patch:V.dimension==="height"?{height:V.size}:{width:V.size}}))},$=at.current,O=Fr($,R);Object.is(O,$)||(Zt(V=>{const J=Fr(V.current,R);return Object.is(J,V.current)?V:{...V,current:J}}),Jt(null))};a();const u=()=>a();return document.fonts.addEventListener("loadingdone",u),()=>{document.fonts.removeEventListener("loadingdone",u)}},[e,m,Zt]);function ep(a,u,y){return Ve({type:"node/update-content",slideId:a,updates:[{path:[...u],patch:y}]})}function tp(a,u,y){return Ve({type:"node/update-style",slideId:a,updates:[{path:[...u],patch:y}]})}function Ht(a){return et?ep(m.id,et,a):!1}function he(a){return et?tp(m.id,et,a):!1}function qd(a){return et?Ve({type:"node/update-geometry",slideId:m.id,updates:[{path:[...et],patch:a}]}):!1}const Mn=p.useMemo(()=>{if(!aa||!_n(C)||aa.path[aa.path.length-1]!==C.id)return null;const a=Math.min(aa.end,C.text.length),u=Math.min(aa.start,a);return u<a?{start:u,end:a}:null},[aa,C]);function Oa(a){if(!et||!_n(C)||!Mn)return;const u=Qg(C.spans,Mn,a,C.text.length);u&&he({spans:u})}const Qd=!!(Mn&&_n(C)&&xc(C.spans,Mn,a=>a.bold===!0)),Jd=!!(Mn&&_n(C)&&xc(C.spans,Mn,a=>a.underline===!0)),eu=!!(Mn&&_n(C)&&xc(C.spans,Mn,a=>a.strike===!0)),Kl=Mn&&_n(C)?((Vu=(Ku=C.spans)==null?void 0:Ku.find(a=>a.start<=Mn.start&&a.end>Mn.start))==null?void 0:Vu.fontSize)??C.fontSize:null;function tu(a){if(!_n(C)||Kl===null)return;const u=nd(Kl,a),y=C.fontSize;Oa(({fontSize:S,...E})=>u===y?E:{...E,fontSize:u})}function np(a){!_n(C)||!C.spans||he({spans:C.spans.filter((u,y)=>y!==a)})}function bo(a,u){const y=zc(wt.current,a,u),S=Symbol(y);return Pr.current.set(y,S),Ar(E=>{const R=new Set(E);return R.add(y),R}),{key:y,token:S}}function yo(a){Pr.current.get(a.key)===a.token&&(Pr.current.delete(a.key),Ar(u=>{if(!u.has(a.key))return u;const y=new Set(u);return y.delete(a.key),y}))}function _a(a){if(!et)return!1;const u=bo(m.id,et),y=he({fill:a});return yo(u),y}function Hr(a){if(!et)return!1;const u=at.current.slides.find(S=>S.id===m.id);if(!u)return!1;const y=Nj(u.nodes,et,a);return y.ok?y.update?y.category==="geometry"?Ve({type:"node/update-geometry",slideId:m.id,updates:[y.update]}):Ve({type:"node/update-style",slideId:m.id,updates:[y.update]}):!1:((y.reason==="locked"||y.reason==="locked-descendant")&&sn(),!1)}const Ln=p.useCallback(a=>{Zt(u=>{const y=Fr(u.current,a);return Object.is(y,u.current)?u:{...u,current:y}})},[Zt]),Ba=p.useCallback((a,u=i("编辑"))=>{const y=Da.current,S=y&&(Object.is(y.source,a)||Object.is(y.document,a))?y.document:a;Zt(E=>Object.is(E.current,S)||Object.is(E.current,a)?E:{past:[...E.past,{state:S,label:u}],current:E.current,future:[]}),Jt(null)},[Zt]),dr=p.useCallback(a=>{const u=Da.current,y=u&&(Object.is(u.source,a)||Object.is(u.document,a))?u.document:a;Zt(S=>Object.is(S.current,y)?S:{...S,current:y}),u&&(Object.is(u.source,a)||Object.is(u.document,a))&&Jt(u.updatedAt)},[Zt]),rp=p.useCallback((a,u,y,S)=>{if(!y)return dr(a),"cancelled";const E=at.current,R=Fr(E,u);if(Object.is(R,E))return"rejected";const $=Da.current,O=$&&(Object.is($.source,a)||Object.is($.document,a))?$.document:a,V=S??kh(u),J={result:"rejected"};return Zt(Le=>{const $e=Fr(Le.current,u);return Object.is($e,Le.current)?Le:(J.result="committed",{past:[...Le.past,{state:O,label:V}],current:$e,future:[]})}),J.result==="committed"&&Jt(null),J.result},[dr,Zt]);function Ka(a,u=Yt.current){if(!ru(a,u))return null;const y=at.current.slides.find(E=>E.id===a.slideId);if(!y)return null;const S=Qo(y,a.path);return!S||S.targetKind!==a.targetKind||S.logicalSrc!==a.logicalSrc||S.resolvedSrc!==a.resolvedSrc?null:{slide:y,target:S}}function nu(a){return ru(a,Yt.current)}function ru(a,u){return a.scopeGeneration===wt.current&&a.draftScopeKey===Jo(wt.current,u)}function ap(a,u){return a.scopeGeneration===wt.current&&a.draftScopeKey===Jo(wt.current,u)}function Vl(a,u=Yt.current){if(!ap(a,u))return null;const y=at.current;if(y.activeSlideId!==a.slideId)return null;const S=y.slides.find(V=>V.id===a.slideId);if(!S)return null;const E=xa(S.nodes,M,a.path);if(!E||ye(E)!==ye(a.path))return null;const R=Ur(S.nodes,a.path),$=jt(S.nodes,a.path);if(!R||R.locked||R.hidden||($==null?void 0:$.type)!=="image"||$.fit!=="cover")return null;const O=Hi($);return!O||O.targetKind!=="image"?null:{slide:S,node:$,identity:Ai(a.scopeGeneration,S.id,a.path,O)}}function jo(a,u=Yt.current){const y=Vl(a,u);if(!y||!af(y.identity,Ec(a)))return null;const S=ks(Qn.current,y.identity);return!S||S.width!==a.naturalSize.width||S.height!==a.naturalSize.height?null:{slide:y.slide,node:y.node}}function wo(){Nn.invalidate(),Q.current=null}function ip(){const a=Q.current;if(!a)return;const u=jo(a);wo(),Ut.current=null,u&&Ze(i("图片加载失败,请重试"))}function Gl(a){if(Q.current||gt.current||Te())return!1;const u=at.current,y=u.slides.find(qe=>qe.id===u.activeSlideId);if(!y||y.id!==m.id||we===null)return!1;const S=xa(y.nodes,M,a);if(!S||ye(S)!==ye(a))return!1;const E=Ur(y.nodes,a),R=jt(y.nodes,a);if(!E||E.locked||E.hidden||(R==null?void 0:R.type)!=="image"||R.fit!=="cover")return!1;const $=Hi(R);if(!$||$.targetKind!=="image")return!1;const O=Ai(wt.current,y.id,a,$),V=ks(Qn.current,O),J=Gr(y.nodes,a);if(!V||!J)return!1;const Le=H5({startNode:R,naturalSize:V});return!Le||mh({renderScale:we,startWorldMatrix:J})===null||!Nn.start({scopeGeneration:wt.current,draftScopeKey:Jo(wt.current,Yt.current),slideId:y.id,path:[...a],logicalSrc:R.src,resolvedSrc:$.resolvedSrc,naturalSize:{...V},startDocument:u,startNode:{...R,framing:{...R.framing}},startWorldMatrix:[...J],draft:Le})?!1:(Ut.current=null,Sn(),dt([a[a.length-1]]),Ze(null),!0)}function sp(a){const u=Nn.applyAspectRatio(Cw[a]);Ze(u?null:i("当前裁剪范围无法应用该比例"))}function gs(a="done",u=Yt.current){const y=Nn.finish(a);if(!y)return Q.current=null,Ut.current=null,null;const{session:S,draft:E}=y;if(!jo(S,u))return Q.current=null,Ut.current=null,null;const $=N0({startNode:S.startNode,naturalSize:S.naturalSize,draft:E});if(!$)return Ze(i("图片裁剪未能应用,请重试")),Q.current=null,Ut.current=null,"rejected";const O=rp(S.startDocument,{type:"node/update-image-crop",slideId:S.slideId,path:[...S.path],patch:{...$,framing:{...$.framing}}},Rw(S.startNode,$),i("调整裁切"));return Ze(O==="rejected"?i("图片裁剪未能应用,请重试"):null),Q.current=null,Ut.current=null,O}function ko(a,u){if(gt.current!==a)return!1;const y=Ka(a);return!y||y.target.fit!=="cover"||Es(y.target.framing,u)?!1:(Ln($h(a.slideId,a.path,y.target,u)),!0)}function So(){gt.current=null,Ie.current=null,so(null)}function vo(a){if(gt.current||Te())return!1;const u=at.current,y=u.slides.find($=>$.id===u.activeSlideId);if(!y||y.id!==m.id)return!1;const S=xa(y.nodes,M,a);if(!S||ye(S)!==ye(a))return!1;const E=Ur(y.nodes,a);if(!E||E.locked||E.hidden)return!1;const R=Hi(jt(y.nodes,a));return!R||R.fit!=="cover"||R.targetKind==="shape-fill"&&Pr.current.has(zc(wt.current,y.id,a))?!1:au(u,y,a,R)}function op(){if(gt.current||Te())return!1;const a=at.current,u=a.slides.find(S=>S.id===a.activeSlideId);if(!u||u.id!==m.id)return!1;const y=Qo(u,[]);return!y||y.fit!=="cover"?!1:au(a,u,[],y)}function au(a,u,y,S){const E=Ai(wt.current,u.id,y,S),R=ks(Qn.current,E);if(!R)return!1;const $={scopeGeneration:wt.current,draftScopeKey:Jo(wt.current,Yt.current),slideId:u.id,path:[...y],targetKind:S.targetKind,logicalSrc:S.logicalSrc,resolvedSrc:S.resolvedSrc,naturalSize:{...R},startDocument:a,startFraming:{...S.framing}};return Sn(),dt(y.length>0?[y[y.length-1]]:[]),gt.current=$,so($),Ze(null),requestAnimationFrame(()=>{var O;return(O=je.current)==null?void 0:O.focus()}),!0}function iu(){const a=gt.current;if(!a)return;if(!nu(a)){So();return}const u=Ka(a);!u||Es(u.target.framing,a.startFraming)?dr(a.startDocument):Ba(a.startDocument,i("调整取景")),So()}function su(){const a=gt.current;a&&(nu(a)&&dr(a.startDocument),So())}function xs(a=Yt.current){const u=Q.current;u&&(jo(u,a)?gs("transition",a):wo());const y=gt.current;y&&(Ka(y,a)&&dr(y.startDocument),So()),Ut.current=null,Ol()}function Ul(){!et||!Ft||!hs||Ve($h(m.id,et,Ft,zr()))}function Yl(a){const u=gt.current;if(!u)return;const y=Ka(u);y&&ko(u,{...y.target.framing,zoom:zw(a)})}function lp(a){const u=gt.current;if(!u)return;const y=Ka(u);y&&ko(u,s2({naturalSize:u.naturalSize,frameSize:y.target.frameSize,framing:y.target.framing,localDelta:a}))}function cp(a){if(!a.isPrimary||a.button!==0||Ie.current!==null)return;const u=gt.current,y=u?Ka(u):null,S=u&&y?Gr(y.slide.nodes,u.path):null;if(!u||!y||!S||we===null)return;a.preventDefault(),a.stopPropagation(),a.currentTarget.focus();const E=a.pointerId;Ie.current=E;const R={x:a.clientX,y:a.clientY},$={...y.target.framing},O={...y.target.frameSize},V=we;let J=!1;const Le=()=>{window.removeEventListener("pointermove",$e),window.removeEventListener("pointerup",qe),window.removeEventListener("pointercancel",Ce),window.removeEventListener("blur",Ne),Ie.current===E&&(Ie.current=null)},$e=Ke=>{J||Ke.pointerId!==E||(Ke.preventDefault(),ko(u,l2({naturalSize:u.naturalSize,frameSize:O,framing:$,screenDelta:{x:Ke.clientX-R.x,y:Ke.clientY-R.y},renderScale:V,worldMatrix:S})))},qe=Ke=>{J||Ke.pointerId!==E||(J=!0,Le())},We=()=>{J||(J=!0,Le(),ko(u,$))},Ce=Ke=>{Ke.pointerId===E&&We()},Ne=()=>We();window.addEventListener("pointermove",$e,{passive:!1}),window.addEventListener("pointerup",qe),window.addEventListener("pointercancel",Ce),window.addEventListener("blur",Ne)}p.useEffect(()=>{if(!yn)return;const a=requestAnimationFrame(()=>{var u;return(u=je.current)==null?void 0:u.focus()});return()=>cancelAnimationFrame(a)},[yn]),p.useEffect(()=>{e||(gt.current||Q.current)&&xs()},[e]);function No(a){(gt.current||Q.current)&&xs(),!Te()&&a!==m.id&&(Y0(m.id),Ln({type:"slide/select",slideId:a}),dt([]))}function dp(){Te()||(Ve({type:"slide/add-after-active"}),dt([]))}function up(a=m.id){Te()||(Ve({type:"slide/duplicate",slideId:a}),dt([]))}const[ou,Zl]=p.useState(null),[lu,Mo]=p.useState(""),Si=p.useRef(!1),Xl=p.useRef(null);function cu(a){const u=x.slides.findIndex(y=>y.id===a);u<0||(Si.current=!1,Zl(a),Mo(Rs(x.slides[u].name,u)),requestAnimationFrame(()=>{var y,S;(y=Xl.current)==null||y.focus(),(S=Xl.current)==null||S.select()}))}function du(){Si.current=!1;const a=ou,u=x.slides.findIndex(S=>S.id===a),y=x.slides[u];if(a&&y){const S=lu.trim();S&&S!==y.name&&S!==Rs(y.name,u)&&Ve({type:"slide/update",slideId:a,patch:{name:S}})}Zl(null),Mo("")}function fp(){Si.current=!1,Zl(null),Mo("")}function hp(a=m.id){Te()||(Ve({type:"slide/delete",slideId:a}),dt([]))}function vi(a,u){Te()||(Ve({type:"slide/reorder",slideId:a,targetIndex:u}),dt([]))}function mp(a,u,y){const S=x.slides.findIndex($=>$.id===a),E=x.slides.findIndex($=>$.id===u);if(S<0||E<0)return null;const R=y?E+1:E;return R>S?R-1:R}function pp(a,u){if(gt.current||Q.current)return;if(a.stopPropagation(),(Ee==null?void 0:Ee.slideId)===u){ue(null);return}u!==m.id&&No(u);const y=a.currentTarget.getBoundingClientRect();Ue.current=a.currentTarget,ae(null),ue({slideId:u,x:y.left,y:y.bottom+4,fromButton:!0})}function Or(a){const u=Ee!=null&&Ee.fromButton?Ue.current:null;ue(null),a&&(u!=null&&u.isConnected)&&u.focus({preventScroll:!0})}function gp(a,u){gt.current||Q.current||(a.preventDefault(),a.stopPropagation(),u!==m.id&&No(u),ae(null),ue({slideId:u,x:a.clientX,y:a.clientY}))}function uu(a,u,y=!1){N(S=>y&&ye(S.activeGroupPath)!==ye(a)?S:{...S,activeGroupPath:[...a],selectionPaths:[[...a,u]]})}function ql(a,u,y){return u&&y.length===0?{...a,x:Math.round(Math.max(0,Math.min(u.x-a.width/2,m.width-a.width))),y:Math.round(Math.max(0,Math.min(u.y-a.height/2,m.height-a.height)))}:Th(a,m,y)}function Ql(a,u){var S;return Ve({type:"node/insert-children",slideId:m.id,parentPath:u,nodes:[a]})?(uu(u,a.id),!0):((S=Ur(m.nodes,u))!=null&&S.locked?sn():Ze(Pi("insert","invalid-selection")),!1)}function Sr(a,u){if(Te())return!1;const y=[...M];return Ql(ql(a,u,y),y)}function Jl(a,u){const y=Ug(m);if(a==="box"){Sr({...y,text:i(y.text)});return}const S=f8[a],E=Math.min(S.maxWidth,Math.round(m.width*S.widthRatio));Sr({...y,x:Math.round((m.width-E)/2),y:Math.round((m.height-S.height)/2),width:E,height:S.height,text:i(S.text),fontSize:S.fontSize,fontWeight:S.fontWeight,lineHeight:S.lineHeight,...u?{textFill:structuredClone(u.textFill),...u.effect?{effect:{...u.effect}}:{}}:{}})}function xp(a){if(Te())return;const u=J6(a),y=xe.flatMap(E=>{const R=jt(m.nodes,E);return(R==null?void 0:R.type)==="text"?[{path:[...E],patch:u}]:[]});if(y.length===0){Jl("heading",a);return}!Ve({type:"node/update-style",slideId:m.id,updates:y},i("套用花字"))&&(Wt||tn)&&sn()}function bp(a,u){Sr(t2(m,a),u)}function yp(a){Sr(r2(m),a)}function jp(a){Sr(a2(m),a)}function wp(a,u){const y=n2(m,a.id);a.bothEnds&&(y.name=i("双向箭头"),y.startCap="arrow"),Sr(y,u)}function kp(a,u){if(Te())return;const y=[...M],S=ql(A6(a,m),u,y);Ql(P6(a,{box:S}),y)}function Sp(a,u){Sr(i2(m,{name:a.zh,d:a.d,viewBox:M6,size:Math.max(48,Math.round(Math.min(m.width,m.height)*.15)),strokeWidth:F6}),u)}function vp(a,u){if(Te())return;const y=[...M],S=wx(a,m),E=ql({x:Math.round((m.width-S.width)/2),y:Math.round((m.height-S.height)/2),...S},u,y);Ql(xd(a,{...E,language:cl()==="en"?"en":"zh"}),y)}function fu(a,u){if(a.kind==="shape")bp(a.id,u);else if(a.kind==="line")wp(a,u);else if(a.kind==="qrcode")yp(u);else if(a.kind==="chart")jp(u);else if(a.kind==="table")Sr(Og(m),u);else if(a.kind==="timeline")Sr(_g(m),u);else if(a.kind==="progress")Sr(Bg(m),u);else if(a.kind==="collage"){const y=l0(a.id);y&&kp(y,u)}else if(a.kind==="icon"){const y=z6(a.id);y&&Sp(y,u)}else{const y=Em(a.id);y&&vp(y,u)}}Dt.current=fu;async function ec(a,u,y,S){var We;if(Te())return;const E=wt.current,R=Yt.current,$=m.id,O=[...M],V=await a();if(E!==wt.current||R!==Yt.current||Te())return;const J=at.current.slides.find(Ce=>Ce.id===$);if(!J)return;const Le=Yg(J,V,u),$e=y?$w(Le,J,y):Le,qe=S&&O.length===0?{...$e,x:Math.round(Math.max(0,Math.min(S.x-$e.width/2,J.width-$e.width))),y:Math.round(Math.max(0,Math.min(S.y-$e.height/2,J.height-$e.height)))}:Th($e,J,O);Ve({type:"node/insert-children",slideId:$,parentPath:O,nodes:[qe]})?at.current.activeSlideId===$&&uu(O,qe.id,!0):(We=Ur(J.nodes,O))!=null&&We.locked?sn():Ze(Pi("insert","invalid-selection"))}async function hu(a,u){const y=Tr;await ec(async()=>{y.remote&&await ms();const S=await Ms(a),E=await ka(S,1800);return y.images.put(E)},a.name,void 0,u)}function Fo(a){return Array.from(a.dataTransfer.types).includes("Files")}function Np(a){if(wc(a.dataTransfer)){a.preventDefault();return}Fo(a)&&(a.preventDefault(),Dr.current+=1,!gt.current&&!Q.current&&gi(!0))}function Mp(a){!wc(a.dataTransfer)&&!Fo(a)||(a.preventDefault(),a.dataTransfer.dropEffect=gt.current||Q.current?"none":"copy")}function Fp(a){Fo(a)&&(Dr.current=Math.max(0,Dr.current-1),Dr.current===0&&gi(!1))}function Cp(a){if(wc(a.dataTransfer)){if(a.preventDefault(),gt.current||Q.current)return;const E=T6(a.dataTransfer),R=Nr(a.clientX,a.clientY),$=R!==null&&R.x>=0&&R.y>=0&&R.x<=m.width&&R.y<=m.height;E&&fu(E,$?R:void 0);return}if(!Fo(a)||(a.preventDefault(),Dr.current=0,gi(!1),gt.current||Q.current))return;const u=Yc(a.dataTransfer.files).slice(0,Bh);if(u.length===0){Ze(i("这里只能放图片"));return}const y=Nr(a.clientX,a.clientY),S=y!==null&&y.x>=0&&y.y>=0&&y.x<=m.width&&y.y<=m.height;mu(u,S?y:null)}async function mu(a,u){for(const[y,S]of a.entries())try{await hu(S,u?{x:u.x+y*Kh,y:u.y+y*Kh}:void 0)}catch(E){wn(E,i("图片插入失败,请稍后重试"));return}}async function Ep(a){const u=r;if(u){sr.current+=1;try{await ec(()=>Jm(a,u),a.name,a)}catch(y){wn(y,i("图片插入失败,请稍后重试"))}}}function pu(){var a;(a=fo.current)==null||a.click()}async function zp(a){const u=a==null?void 0:a[0];if(u)try{const y=await kl.importFile(u);(C==null?void 0:C.type)==="text"&&he({fontFamily:dd(y.family)})}catch(y){wn(y,i("字体导入失败,请稍后重试"))}finally{fo.current&&(fo.current.value="")}}async function Rp(a){const u=a==null?void 0:a[0];if(u)try{await hu(u)}catch(y){wn(y,i("图片插入失败,请稍后重试"))}finally{uo.current&&(uo.current.value="")}}function tc(){const a=et?[...et]:null;if(!a)return null;const u=at.current.slides.find(R=>R.id===m.id),y=u?jt(u.nodes,a):void 0,S=wt.current,E=Yt.current;return(y==null?void 0:y.type)==="shape"||(y==null?void 0:y.type)==="path"?{kind:"frame",slideId:m.id,path:a,identityGeneration:S,userId:E}:(y==null?void 0:y.type)==="image"?{kind:"image",slideId:m.id,path:a,identityGeneration:S,userId:E}:null}async function Ip(a){const u=tc();if(!u||u.kind!=="frame")return;const y=bo(u.slideId,u.path);try{const S=await Ms(a);await gu(S,u,y)}finally{yo(y)}}async function gu(a,u,y,S){const E=Tr;E.remote&&await ms();const R=await ka(a,1800),$=await E.images.put(R);if(Pr.current.get(y.key)!==y.token||u.identityGeneration!==wt.current||u.userId!==Yt.current||Te())return!0;const O=at.current.slides.find(J=>J.id===u.slideId),V=O?jt(O.nodes,u.path):void 0;return(V==null?void 0:V.type)!=="shape"&&(V==null?void 0:V.type)!=="path"||Ve({type:"node/update-style",slideId:u.slideId,updates:[{path:u.path,patch:{fill:{type:"image",src:$,fit:"cover",framing:zr()}}}]},S),!0}async function Lp(a,u,y){const S=Tr;S.remote&&await ms();const E=await ka(a,1800),R=await S.images.put(E);if(Pr.current.get(y.key)!==y.token||u.identityGeneration!==wt.current||u.userId!==Yt.current||Te())return!0;const $=at.current.slides.find(V=>V.id===u.slideId),O=$?jt($.nodes,u.path):void 0;return(O==null?void 0:O.type)!=="image"||Ve({type:"node/update-content",slideId:u.slideId,updates:[{path:u.path,patch:{src:R}}]},i("粘贴替换图片")),!0}async function $p(a){const u=a[0];if(!u)return;const y=tc();if(y&&(Wt||tn)){sn();return}const S=y?bo(y.slideId,y.path):null;try{const E=await Ms(u);if(Te())return;if(y&&S){if(y.kind==="image"){if(await Lp(E,y,S))return}else if(await gu(E,y,S,i("粘贴填充图片")))return}await mu(a,null)}catch(E){wn(E,i("图片插入失败,请稍后重试"))}finally{S&&yo(S)}}async function xu(a){const u=a==null?void 0:a[0];if(u)try{await Ip(u)}catch(y){wn(y,i("图片填充失败,请稍后重试"))}finally{ji.current&&(ji.current.value="")}}async function Dp(a){if(!(!et||!Oh(C)))try{const u=Tr;u.remote&&await ms();const y=await Ms(a),S=await ka(y,600),E=await u.images.put(S);he({logoSrc:E})}catch(u){wn(u,i("logo 上传失败,请稍后重试"))}finally{mo.current&&(mo.current.value="")}}function vr(a,u){return Ve({type:"slide/update",slideId:a,patch:{background:u}})}async function Ap(a){const u=m.id,y=wt.current,S=Yt.current,E=Tr;Td(!0);try{E.remote&&await ms();const R=await Ms(a),$=await ka(R,2400),O=await E.images.put($);if(y!==wt.current||S!==Yt.current)return;vr(u,{type:"image",src:O,fit:"cover",framing:zr()})}finally{Td(!1)}}async function Pp(a){const u=a==null?void 0:a[0];if(u)try{await Ap(u)}catch(y){wn(y,i("背景图片设置失败,请稍后重试"))}finally{ho.current&&(ho.current.value="")}}function bu(){if(!et||!Ja(C)||Ta)return;J0([{type:"slide/update",slideId:m.id,patch:{background:{type:"image",src:C.src,fit:"cover",framing:zr()}}},{type:"node/delete",slideId:m.id,parentPath:et.slice(0,-1),nodeIds:[C.id]}],i("设为背景"))&&dt([])}function Co(){if(_e.length===0||Te())return;Ve({type:"node/delete",slideId:m.id,parentPath:M,nodeIds:_e})?dt([]):(Wt||tn)&&sn()}function nc(){var E;if(_e.length===0)return;const u=(Gn(m.nodes,M)??[]).filter(R=>_e.includes(R.id)),y=ri(m.nodes,M);if(!y||u.length===0)return;A({nodes:structuredClone(u),sourceParentWorld:[...y]});const S=u.flatMap(function R($){return $.type==="group"?$.children.flatMap(R):$.type==="text"?[$.text]:[]});(E=navigator.clipboard)==null||E.writeText(S.join(`
|
|
499
|
-
`)).catch(()=>{})}function rc(){if(_e.length===0)return;const a=at.current.slides.find(O=>O.id===m.id),u=a?Gn(a.nodes,M):void 0;if(!u)return;const y=new Set(u.map(O=>O.id));if(!Ve({type:"node/clone",slideId:m.id,parentPath:M,nodeIds:_e},i("原位复制"))){(Wt||tn)&&sn();return}const E=at.current.slides.find(O=>O.id===m.id),$=((E?Gn(E.nodes,M):void 0)??[]).filter(O=>!y.has(O.id));dt($.map(O=>O.id))}function Tp(){const a=(z==null?void 0:z.nodes.length)===1?z.nodes[0]:void 0;if((a==null?void 0:a.type)!=="image")return!1;const u=tc();if(!u)return!1;const y=at.current.slides.find(R=>R.id===u.slideId),S=y?jt(y.nodes,u.path):void 0;if(u.kind==="image"&&((S==null?void 0:S.type)!=="image"||S.src===a.src))return!1;if(Wt||tn)return sn(),!0;const E=bo(u.slideId,u.path);try{u.kind==="image"?Ve({type:"node/update-content",slideId:u.slideId,updates:[{path:u.path,patch:{src:a.src}}]},i("粘贴替换图片")):Ve({type:"node/update-style",slideId:u.slideId,updates:[{path:u.path,patch:{fill:{type:"image",src:a.src,fit:"cover",framing:zr()}}}]},i("粘贴填充图片"))}finally{yo(E)}return!0}function bs(a=!1){var $;if(!z||z.nodes.length===0||Te()||!a&&Tp())return;const u=ri(m.nodes,M),y=u?nr(u):null;if(!u||!y)return;const S=ui(a?0:16,a?0:16),E=mf(z.nodes).flatMap(O=>{const V=Lr(y,Lr(S,Lr(z.sourceParentWorld,As(O)))),J=Kc(O,V);return J?[J]:[]});if(E.length!==z.nodes.length){Ze(i("无法在当前编辑范围内粘贴对象"));return}Ve({type:"node/insert-children",slideId:m.id,parentPath:M,nodes:E},a?i("原位粘贴"):void 0)?dt(E.map(O=>O.id)):(Wt||($=Ur(m.nodes,M))!=null&&$.locked)&&sn()}function yu(){if(_e.length===0)return;nc(),Ve({type:"node/delete",slideId:m.id,parentPath:M,nodeIds:_e},i("剪切对象"))?dt([]):(Wt||tn)&&sn()}function Eo(){var V;if(Te())return!1;const a=[...M],u=xe.filter(J=>ye(J.slice(0,-1))===ye(a)).map(J=>J[J.length-1]),y=at.current.slides.find(J=>J.id===m.id);if(!y||u.length!==xe.length)return Ze(Pi("group","invalid-selection")),!1;const S=di(),E=Xg(y.nodes,a,u,{id:S,name:i("组")});if(!E.ok)return Ze(Pi("group",E.reason)),!1;const R=Ve({type:"group/create",slideId:y.id,parentPath:a,nodeIds:u,groupId:S,name:i("组")}),$=at.current.slides.find(J=>J.id===y.id),O=[...a,S];return!R||((V=jt(($==null?void 0:$.nodes)??[],O))==null?void 0:V.type)!=="group"?(Ze(i("组合未能应用到当前文档,请重试")),!1):(Ze(null),N(J=>({...J,activeGroupPath:a,selectionPaths:[O]})),!0)}function zo(){if(Te())return!1;const a=[...M],u=xe.filter(O=>ye(O.slice(0,-1))===ye(a)).map(O=>O[O.length-1]),y=at.current.slides.find(O=>O.id===m.id);if(!y||u.length!==xe.length||u.length===0)return Ze(Pi("ungroup","not-group")),!1;const S=Zg(y.nodes,a,u,"one-level");if(!S.ok)return Ze(Pi("ungroup",S.reason)),!1;const E=Ve({type:"group/ungroup",slideId:y.id,parentPath:a,groupIds:u,mode:"one-level"}),R=at.current.slides.find(O=>O.id===y.id),$=S.selectionIds.map(O=>[...a,O]).filter(O=>!!jt((R==null?void 0:R.nodes)??[],O));return!E||$.length!==S.selectionIds.length?(Ze(i("解组未能应用到当前文档,请重试")),!1):(Ze(null),N(O=>({...O,activeGroupPath:a,selectionPaths:$})),!0)}function Wp(){if(xe.length!==1)return!1;const a=xe[0],u=jt(m.nodes,a);return(u==null?void 0:u.type)!=="group"||ye(a.slice(0,-1))!==ye(M)?!1:(N(y=>({...y,activeGroupPath:[...a],selectionPaths:[]})),!0)}function Hp(){N(a=>a.activeGroupPath.length===0?{...a,selectionPaths:[]}:{...a,activeGroupPath:a.activeGroupPath.slice(0,-1),selectionPaths:[]})}function ma(a){if(_e.length===0)return;!Ve({type:"node/reorder",slideId:m.id,parentPath:M,nodeIds:_e,direction:a})&&(Wt||tn)&&sn()}function Op(a,u){if(a.length===0||!jt(m.nodes,a))return!1;const y=a.slice(0,-1);return u.toggle&&xe.length>0&&ye(M)!==ye(y)?!1:(N(S=>{if(!u.toggle)return{...S,activeGroupPath:[...y],selectionPaths:[[...a]]};const E=mc(m.nodes,y,S.selectionPaths),R=ye(a),$=E.some(O=>ye(O)===R);return{...S,activeGroupPath:[...y],selectionPaths:$?E.filter(O=>ye(O)!==R):[...E,[...a]]}}),!0)}function _p(a,u){return Te()?!1:Ve({type:"node/rename",slideId:m.id,path:a,name:u})}function Ni(a,u){return Te()?!1:Ve({type:"node/set-locked",slideId:m.id,path:a,locked:u})}function ju(a,u){return Te()?!1:Ve({type:"node/set-hidden",slideId:m.id,path:a,hidden:u})}function Bp(a,u,y){if(Te())return!1;const E=xe.filter($=>ye($.slice(0,-1))===ye(a)).map($=>$[$.length-1]),R=u.every($=>E.includes($));return Ve({type:"node/reorder",slideId:m.id,parentPath:a,nodeIds:R&&E.length>0?E:[...u],direction:y})}function Kp(a,u,y){if(Te())return!1;const E=xe.filter(O=>ye(O.slice(0,-1))===ye(a)).map(O=>O[O.length-1]),$=u.every(O=>E.includes(O))&&E.length>0?E:[...u];return $.includes(y)?!1:Ve({type:"node/reorder-above",slideId:m.id,parentPath:a,nodeIds:$,targetNodeId:y})}function wu(a){const u=F.filter(We=>_e.includes(We.id)&&!We.hidden);if(u.length<1||Te())return;const y=ri(m.nodes,M),S=y?nr(y):null;if(!S)return;const E=u.flatMap(We=>{const Ce=[...M,We.id],Ne=Tn(m.nodes,Ce);return Ne?[{node:We,path:Ce,bounds:Ne}]:[]});if(E.length!==u.length)return;const R=E.length===1,$=R&&M.length>0?Tn(m.nodes,M):null,O=R?($==null?void 0:$.x)??0:Math.min(...E.map(({bounds:We})=>We.x)),V=R?$?$.x+$.width:m.width:Math.max(...E.map(({bounds:We})=>We.x+We.width)),J=R?($==null?void 0:$.y)??0:Math.min(...E.map(({bounds:We})=>We.y)),Le=R?$?$.y+$.height:m.height:Math.max(...E.map(({bounds:We})=>We.y+We.height)),$e=(O+V)/2,qe=(J+Le)/2;Ve({type:"node/update-geometry",slideId:m.id,updates:E.map(({node:We,path:Ce,bounds:Ne})=>{const Ke=a==="left"?O-Ne.x:a==="h-center"?$e-(Ne.x+Ne.width/2):a==="right"?V-(Ne.x+Ne.width):0,it=a==="top"?J-Ne.y:a==="v-center"?qe-(Ne.y+Ne.height/2):a==="bottom"?Le-(Ne.y+Ne.height):0,Pe=hr(S,{x:Ke,y:it});return{path:Ce,patch:{x:We.x+Pe.x,y:We.y+Pe.y}}})},R?i("对齐到页面"):i("对齐"))}function ac(a){const u=F.filter(Ce=>_e.includes(Ce.id)&&!Ce.hidden);if(u.length<3||Te())return;const y=ri(m.nodes,M),S=y?nr(y):null;if(!S)return;const E=u.flatMap(Ce=>{const Ne=[...M,Ce.id],Ke=Tn(m.nodes,Ne);return Ke?[{node:Ce,path:Ne,bounds:Ke}]:[]});if(E.length!==u.length)return;const R=[...E].sort((Ce,Ne)=>a==="horizontal"?Ce.bounds.x-Ne.bounds.x:Ce.bounds.y-Ne.bounds.y),$=R[0],O=R[R.length-1],V=a==="horizontal"?$.bounds.x:$.bounds.y,J=a==="horizontal"?O.bounds.x+O.bounds.width:O.bounds.y+O.bounds.height,Le=R.reduce((Ce,Ne)=>Ce+(a==="horizontal"?Ne.bounds.width:Ne.bounds.height),0),$e=(J-V-Le)/(R.length-1);let qe=V;const We=R.map(({node:Ce,path:Ne,bounds:Ke})=>{const it=qe-(a==="horizontal"?Ke.x:Ke.y);qe+=(a==="horizontal"?Ke.width:Ke.height)+$e;const Pe=hr(S,a==="horizontal"?{x:it,y:0}:{x:0,y:it});return{path:Ne,patch:{x:Ce.x+Pe.x,y:Ce.y+Pe.y}}});Ve({type:"node/update-geometry",slideId:m.id,updates:We},i("分布"))}function Vp(a,u){if(Te())return;let y=!1;Zt(S=>{const E=gj(S,{kind:a,index:u});return y=E!==S,E}),y&&(os.current+=1,dt([]),Jt(null))}function Gp(a,u){m.width===a&&m.height===u||Te()||Ve({type:"slide/resize",slideId:m.id,width:a,height:u})}function ku(){Te()||(os.current+=1,Zt(a=>mj(a)),Jt(null))}function ic(){Te()||(os.current+=1,Zt(a=>pj(a)),Jt(null))}function Up(a,u){const y=k.current;if(y.length===0)return;const S=new Map(F.map($=>[$.id,$])),E=ld(m,m.nodes,M,y,a,u).filter(({nodeId:$,patch:O})=>{const V=S.get($);return V&&(V.x!==O.x||V.y!==O.y)});if(E.length===0){(Wt||tn)&&sn();return}!Ve({type:"node/update-geometry",slideId:m.id,updates:E.map(({nodeId:$,patch:O})=>({path:[...M,$],patch:O}))})&&(Wt||tn)&&sn()}p.useEffect(()=>{if(!e)return;const a=u=>{if(u.target instanceof Element&&u.target.closest('[aria-modal="true"]'))return;const y=u.key.toLowerCase();if(Q.current){if(u.key==="Escape"||u.key==="Enter"){u.preventDefault(),gs();return}(u.key.startsWith("Arrow")||u.ctrlKey||u.metaKey||["delete","backspace"].includes(y))&&u.preventDefault();return}if(gt.current){if(u.key==="Escape"){u.preventDefault(),su();return}if(u.key==="Enter"){u.preventDefault(),iu();return}const V=u.key==="ArrowLeft"?{x:-(u.shiftKey?10:1),y:0}:u.key==="ArrowRight"?{x:u.shiftKey?10:1,y:0}:u.key==="ArrowUp"?{x:0,y:-(u.shiftKey?10:1)}:u.key==="ArrowDown"?{x:0,y:u.shiftKey?10:1}:null,J=u.target instanceof HTMLInputElement&&u.target.dataset.testid==="freeform-framing-zoom";if(V&&!J){u.preventDefault(),lp(V);return}(u.ctrlKey||u.metaKey||["delete","backspace"].includes(y))&&u.preventDefault();return}if((W||Ee)&&u.key==="Escape"){u.preventDefault(),ae(null),ue(null);return}const R=(u.ctrlKey||u.metaKey)&&["z","y","c","x","v","g","d"].includes(y)||["arrowleft","arrowright","arrowup","arrowdown","delete","backspace","escape","enter","[","]"].includes(y);if((en.current||$a.current!==null)&&R){u.preventDefault();return}if((u.ctrlKey||u.metaKey)&&!u.altKey&&u.code==="KeyD"){u.preventDefault(),rc();return}if(Is(u.target))return;if((u.key==="PageUp"||u.key==="PageDown")&&!u.ctrlKey&&!u.metaKey&&!u.altKey){u.preventDefault();const V=x.slides[j+(u.key==="PageDown"?1:-1)];V&&No(V.id);return}if((u.ctrlKey||u.metaKey)&&u.altKey&&u.code==="KeyC"){u.preventDefault(),Eu();return}if((u.ctrlKey||u.metaKey)&&u.altKey&&u.code==="KeyV"){u.preventDefault(),zu();return}if((u.ctrlKey||u.metaKey)&&!u.altKey&&u.code==="KeyA"){u.preventDefault();const V=new Set(k.current);dt(F.map(J=>J.id).filter(J=>u.shiftKey?!V.has(J):!0));return}if(!u.altKey&&(u.code==="BracketRight"||u.code==="BracketLeft")){const V=u.code==="BracketRight";if(u.ctrlKey||u.metaKey){u.preventDefault(),ma(V?u.shiftKey?"front":"forward":u.shiftKey?"back":"backward");return}if(!u.shiftKey){u.preventDefault(),ma(V?"front":"back");return}}if((u.ctrlKey||u.metaKey)&&!u.altKey&&["=","+","-","_"].includes(u.key)){u.preventDefault(),qp(u.key==="-"||u.key==="_"?-qo:qo);return}if((u.ctrlKey||u.metaKey)&&!u.altKey&&u.key==="0"){u.preventDefault(),Mu(Oi);return}if(u.shiftKey&&!u.ctrlKey&&!u.metaKey&&!u.altKey&&(u.code==="Digit1"||u.code==="Digit2")){u.preventDefault(),u.code==="Digit1"?Mu(Oi):Cu();return}if(u.code==="Space"&&!u.ctrlKey&&!u.metaKey&&!u.altKey&&!u.shiftKey&&!Aw(u.target)){u.preventDefault(),Be.current||(Be.current=!0,te(!0));return}if((u.ctrlKey||u.metaKey)&&y==="z"){u.preventDefault(),u.shiftKey?ic():ku();return}if((u.ctrlKey||u.metaKey)&&y==="y"){u.preventDefault(),ic();return}if((u.ctrlKey||u.metaKey)&&y==="c"){u.preventDefault(),nc();return}if((u.ctrlKey||u.metaKey)&&y==="x"){u.preventDefault(),yu();return}if((u.ctrlKey||u.metaKey)&&y==="v"){const V=u.shiftKey;if(c5(u)){Ot.current={inPlace:V},window.setTimeout(()=>{Ot.current&&(Ot.current=null,bs(V))},0);return}u.preventDefault(),bs(V);return}if((u.ctrlKey||u.metaKey)&&y==="g"){u.preventDefault(),u.shiftKey?zo():Eo();return}if(u.key==="Enter"&&Dw(u.target)&&Wp()){u.preventDefault();return}const $=u.shiftKey?10:1,O=u.key==="ArrowLeft"?{dx:-$,dy:0}:u.key==="ArrowRight"?{dx:$,dy:0}:u.key==="ArrowUp"?{dx:0,dy:-$}:u.key==="ArrowDown"?{dx:0,dy:$}:null;if(O){k.current.length>0&&(u.preventDefault(),Up(O.dx,O.dy));return}(u.key==="Delete"||u.key==="Backspace")&&k.current.length>0&&(u.preventDefault(),Co()),u.key==="Escape"&&((M.length>0||k.current.length>0)&&u.preventDefault(),Hp())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)}),p.useEffect(()=>{if(!e)return;const a=()=>{Be.current=!1,te(!1),ne(!1)},u=y=>{y.code==="Space"&&a()};return window.addEventListener("keyup",u),window.addEventListener("blur",a),()=>{window.removeEventListener("keyup",u),window.removeEventListener("blur",a)}});function Yp(a,u,y,S){if(a.button!==0)return;if(gt.current||Q.current){a.preventDefault(),a.stopPropagation();return}const E=xa(m.nodes,M,y);if(!E)return;const R=jt(m.nodes,E);if(!R)return;const $=E[E.length-1];if(S.locked){a.preventDefault(),a.stopPropagation(),Sn(),sn();return}if(a.shiftKey){a.preventDefault(),a.stopPropagation(),Sn(),dt(O=>O.includes($)?O.filter(V=>V!==$):[...O,$]);return}if(R.type==="group"){a.preventDefault(),a.stopPropagation(),Sn(),dt([$]);return}Xp(a,u)}function Zp(a,u,y,S){if(gt.current||Q.current){a.preventDefault(),a.stopPropagation();return}const E=xa(m.nodes,M,y),R=E?jt(m.nodes,E):void 0;if(!(!E||!R)){if(R.type!=="group"&&ye(E)===ye(y)&&Hi(R)){if(a.preventDefault(),a.stopPropagation(),S.locked||S.hidden){sn();return}dt([R.id]),R.type==="image"?Gl(E):vo(E);return}if(R.type==="line"&&R.points&&we!==null){const $=Nr(a.clientX,a.clientY),O=Gr(m.nodes,E),V=O?nr(O):null;if(!$||!O||!V)return;if(a.preventDefault(),a.stopPropagation(),S.locked||S.hidden){sn();return}dt([R.id]);const J=8/we;let Le=-1,$e=J;if(R.points.forEach((Ne,Ke)=>{const it=Wn(O,Ne),Pe=Math.hypot(it.x-$.x,it.y-$.y);Pe<$e&&($e=Pe,Le=Ke)}),Le>=0){if(R.points.length<=hf)return;Ve({type:"node/update-style",slideId:m.id,updates:[{path:E,patch:{points:R.points.filter((Ne,Ke)=>Ke!==Le)}}]},i("删除顶点"));return}let qe=-1,We=null,Ce=J;for(let Ne=0;Ne<R.points.length-1;Ne+=1){const Ke=Wn(O,R.points[Ne]),it=Wn(O,R.points[Ne+1]),Pe={x:it.x-Ke.x,y:it.y-Ke.y},kt=Pe.x*Pe.x+Pe.y*Pe.y,At=kt>0?Er((($.x-Ke.x)*Pe.x+($.y-Ke.y)*Pe.y)/kt,0,1):0,St={x:Ke.x+Pe.x*At,y:Ke.y+Pe.y*At},yt=Math.hypot(St.x-$.x,St.y-$.y);if(yt<Ce){Ce=yt,qe=Ne+1;const tt=Wn(V,St);We={x:Er(tt.x,0,R.width),y:Er(tt.y,0,R.height)}}}if(qe>=0&&We){const Ne=[...R.points];Ne.splice(qe,0,We),Ve({type:"node/update-style",slideId:m.id,updates:[{path:E,patch:{points:Ne}}]},i("添加顶点"))}return}if(R.type==="group"){if(a.preventDefault(),a.stopPropagation(),S.locked||S.hidden){sn();return}N($=>({...$,activeGroupPath:[...E],selectionPaths:[]}))}}}function Su(a,u,y){const S=tl(a.nodes,y.map(E=>[...u,E]));return S?`${Math.round(S.width)}×${Math.round(S.height)}`:null}function vu(a,u,y){if(a.button!==0||we===null)return;if(Te()){a.preventDefault(),a.stopPropagation();return}a.preventDefault(),a.stopPropagation(),Sn();const S=at.current;let E=S.slides.find(tt=>tt.id===m.id),R=E?Gn(E.nodes,M):void 0;if(!E||!R)return;const $=k.current,O=y&&y.length>0?[...y]:$.includes(u)?$:[u],V=new Set(R.map(tt=>tt.id));if(O.some(tt=>!V.has(tt)))return;$.includes(u)||dt([u]);let J=O;if(a.altKey){const tt=R.filter(nn=>O.includes(nn.id));if(tt.length>0){const nn=mf(tt);let an=!1;Zt(on=>{const $n=Fr(on.current,{type:"node/insert-children",slideId:m.id,parentPath:M,nodes:nn});return $n===on.current?on:(an=!0,{...on,current:$n})}),an&&(E=at.current.slides.find(on=>on.id===m.id)??E,J=nn.map(on=>on.id),dt(J))}}const Le=we,$e=a.pointerId,qe=a.clientX,We=a.clientY;en.current="move",bn("move");const Ce=R.filter(tt=>!J.includes(tt.id)&&!tt.hidden).flatMap(tt=>{const nn=Tn(E.nodes,[...M,tt.id]);return nn?[{...nn,source:"element"}]:[]}),Ne=M.length===0?{width:E.width,height:E.height}:null,Ke=tt=>{if(tt.pointerId!==$e)return;const nn=(tt.clientX-qe)/Le,an=(tt.clientY-We)/Le,on=Ge.guidesVisible?E:{...E,guides:void 0},$n=$j(on,E.nodes,M,J,nn,an,Ge.snappingEnabled?{}:{threshold:0}),Va=ld(E,E.nodes,M,J,$n.dx,$n.dy);Ia($n.lines),la($n.space??null),Zt(Jn=>{const un=Fr(Jn.current,{type:"node/update-geometry",slideId:E.id,updates:Va.map(({nodeId:Ga,patch:$o})=>({path:[...M,Ga],patch:$o}))});return Object.is(un,Jn.current)?Jn:{...Jn,current:un}});const Mr=at.current.slides.find(Jn=>Jn.id===E.id);if(Mr){const Jn=tl(Mr.nodes,J.map(un=>[...M,un]));xi(Jn?Kj(Jn,Ce,Ne):[]),yr(Su(Mr,M,J))}},it=()=>{window.removeEventListener("pointermove",Ke),window.removeEventListener("pointerup",At),window.removeEventListener("pointercancel",St),window.removeEventListener("blur",yt),en.current=null,Ia([]),la(null),xi([]),yr(null),bn(null)},Pe=()=>{it(),Ba(S,a.altKey?i("拖拽复制"):i("移动对象"))},kt=()=>{it(),dr(S)},At=tt=>{tt.pointerId===$e&&Pe()},St=tt=>{tt.pointerId===$e&&kt()},yt=()=>kt();window.addEventListener("pointermove",Ke),window.addEventListener("pointerup",At),window.addEventListener("pointercancel",St),window.addEventListener("blur",yt)}function Xp(a,u){if(Te()){a.preventDefault(),a.stopPropagation();return}if(u.locked||u.hidden){a.preventDefault(),a.stopPropagation(),Sn(),u.locked&&sn();return}if(a.shiftKey){a.preventDefault(),a.stopPropagation(),Sn(),dt(y=>y.includes(u.id)?y.filter(S=>S!==u.id):[...y,u.id]);return}if(Is(a.target)){dt([u.id]);return}vu(a,u.id)}function Nr(a,u){const y=ua.current;if(!y||we===null)return null;const S=y.getBoundingClientRect();return{x:(a-S.left)/we,y:(u-S.top)/we}}function Nu(a,u,y){if(a===H)return;const S=Nr(u,y);le.current=S?{clientX:u,clientY:y,worldX:S.x,worldY:S.y}:null,P(Yr(a))}function qp(a){const u=da.current;if(!u){P(S=>Yr(S+a));return}const y=u.getBoundingClientRect();Nu(Yr(H+a),y.left+y.width/2,y.top+y.height/2)}function Mu(a){const u=da.current;if(!u){P(Yr(a));return}const y=u.getBoundingClientRect();Nu(a,y.left+y.width/2,y.top+y.height/2)}function Fu(){const a=da.current;if(!a)return null;const u=a.getBoundingClientRect(),y=getComputedStyle(a),S=An(y.borderLeftWidth),E=An(y.borderTopWidth),R=An(y.paddingLeft),$=An(y.paddingTop),O=a.clientWidth-R-An(y.paddingRight),V=a.clientHeight-$-An(y.paddingBottom);return{clientLeft:u.left+S+R,clientTop:u.top+E+$,width:O,height:V}}function Cu(){if(xe.length===0||D===null)return;const a=Fu();if(!a||a.width<=0||a.height<=0)return;const u=xe.flatMap(J=>{const Le=Tn(m.nodes,J);return Le?[Le]:[]});if(u.length!==xe.length||u.length===0)return;const y=Math.min(...u.map(J=>J.x)),S=Math.min(...u.map(J=>J.y)),E=Math.max(...u.map(J=>J.x+J.width)),R=Math.max(...u.map(J=>J.y+J.height)),$=E-y,O=R-S;if(!($>0)||!(O>0))return;const V=ew(D,a.width,a.height,$,O);V===null||V===H||(De.current={worldX:y+$/2,worldY:S+O/2},P(V))}function Eu(){const a=xe.map(u=>jt(m.nodes,u)).find(u=>u!==void 0&&u.type!=="group");a&&L(cw(a))}function zu(){if(!T||Te())return;const a=xe.flatMap(y=>{const S=jt(m.nodes,y);if(!S||S.type==="group")return[];const E=dw(T,S.type,S.type==="path"?ni(S.viewBox,S.width,S.height):1);return Object.keys(E).length===0?[]:[{path:[...y],patch:E}]});if(a.length===0)return;!Ve({type:"node/update-style",slideId:m.id,updates:a})&&(Wt||tn)&&sn()}function sc(a,u,y){var Ne,Ke;if(a.button!==0||we===null)return;a.preventDefault(),a.stopPropagation();const S=m;if(!y&&(((Ne=S.guides)==null?void 0:Ne.length)??0)>=qg)return;!y&&!Ge.guidesVisible&&qn({guidesVisible:!0});const E=Nr(a.clientX,a.clientY);if(!E)return;const R=a.pointerId,$=u==="x"?E.x:E.y,O=y?(Ke=S.guides)==null?void 0:Ke.find(it=>it.id===y):void 0;let V=(O==null?void 0:O.position)??$;const J=we,Le=it=>Wj(S,S.nodes,u,it,Ge.snappingEnabled?Bw/J:0);co({axis:u,guideId:y,position:V,target:O?Le(V).target:null});const $e=it=>{if(it.pointerId!==R)return;const Pe=Nr(it.clientX,it.clientY);if(!Pe)return;const kt=Le(u==="x"?Pe.x:Pe.y);V=kt.position,co({axis:u,guideId:y,position:V,target:kt.target})},qe=()=>{window.removeEventListener("pointermove",$e),window.removeEventListener("pointerup",We),window.removeEventListener("pointercancel",Ce)},We=()=>{qe(),co(null);const it=u==="x"?S.width:S.height,Pe=Math.round(V);if(y&&Math.abs(Pe-Math.round((O==null?void 0:O.position)??$))<=1){const kt=$l.current,At=performance.now();if(kt&&kt.guideId===y&&At-kt.time<500){$l.current=null,Ve({type:"guides/set",slideId:S.id,guides:(S.guides??[]).filter(St=>St.id!==y)},i("删除参考线"));return}$l.current={guideId:y,time:At}}if(Pe<0||Pe>it){y&&Ve({type:"guides/set",slideId:S.id,guides:(S.guides??[]).filter(kt=>kt.id!==y)},i("删除参考线"));return}if(y){if((S.guides??[]).some(At=>At.id===y&&At.position===Pe))return;Ve({type:"guides/set",slideId:S.id,guides:(S.guides??[]).map(At=>At.id===y?{...At,position:Pe}:At)},i("调整参考线"));return}Ve({type:"guides/set",slideId:S.id,guides:[...S.guides??[],{id:`guide-${di()}`,axis:u,position:Pe}]},i("新增参考线"))},Ce=()=>{qe(),co(null)};window.addEventListener("pointermove",$e),window.addEventListener("pointerup",We),window.addEventListener("pointercancel",Ce)}function Qp(a){if(Be.current){if(gt.current||Q.current||a.button!==0)return;a.preventDefault(),a.stopPropagation(),Sn(),ne(!0);const u=da.current;if(!u)return;const y=a.pointerId,S=a.clientX,E=a.clientY,R=u.scrollLeft,$=u.scrollTop,O=$e=>{$e.pointerId===y&&(u.scrollLeft=R-($e.clientX-S),u.scrollTop=$-($e.clientY-E))},V=()=>{window.removeEventListener("pointermove",O),window.removeEventListener("pointerup",J),window.removeEventListener("pointercancel",Le),window.removeEventListener("blur",V),ne(!1)},J=$e=>{$e.pointerId===y&&V()},Le=$e=>{$e.pointerId===y&&V()};window.addEventListener("pointermove",O),window.addEventListener("pointerup",J),window.addEventListener("pointercancel",Le),window.addEventListener("blur",V);return}W&&ae(null)}function Jp(a,u){const y=ua.current;if(!y)return null;const S=Array.from(y.querySelectorAll("[data-scene-node-id]"));for(let E=S.length-1;E>=0;E-=1){const R=S[E].getBoundingClientRect();if(a>R.left&&a<R.right&&u>R.top&&u<R.bottom){const $=Dh(S[E]);if($)return $}}return null}function e1(a){if(gt.current||Q.current||Is(a.target))return;a.preventDefault(),Sn();const u=Dh(a.target)??Jp(a.clientX,a.clientY);if(u){const y=xa(m.nodes,M,u);if(y){const S=y[y.length-1];_e.includes(S)||dt([S])}}else dt([]);ue(null),ae({x:a.clientX,y:a.clientY})}function dn(){ae(null)}function oc(a,u){const y=Nr(a,u);return y?{x:Er(y.x,0,m.width),y:Er(y.y,0,m.height)}:null}function t1(a){if(!Q.current)return;const u=a.target;u instanceof Element&&u.closest('[data-testid="freeform-image-crop-overlay"]')||gs("outside")}function n1(a){if(a.target!==a.currentTarget)return;if(Te()){a.preventDefault(),a.stopPropagation();return}const u=oc(a.clientX,a.clientY);if(!u)return;a.preventDefault(),Sn();const y=a.pointerId;$a.current=y,dt([]),br({startX:u.x,startY:u.y,currentX:u.x,currentY:u.y});const S=()=>{window.removeEventListener("pointermove",E),window.removeEventListener("pointerup",R),window.removeEventListener("pointercancel",$),window.removeEventListener("blur",O),$a.current===y&&($a.current=null)},E=V=>{if(V.pointerId!==y)return;const J=oc(V.clientX,V.clientY);J&&br(Le=>Le&&{...Le,currentX:J.x,currentY:J.y})},R=V=>{if(V.pointerId!==y)return;S();const J=oc(V.clientX,V.clientY)??u,Le={startX:u.x,startY:u.y,currentX:J.x,currentY:J.y},$e=Hh(Le);if(br(null),Math.hypot($e.width,$e.height)<4){dt([]);return}dt(Cj(m.nodes,M,$e).filter(qe=>{var We;return!((We=Ur(m.nodes,[...M,qe]))!=null&&We.locked)}))},$=V=>{V.pointerId===y&&(S(),br(null))},O=()=>{S(),br(null)};window.addEventListener("pointermove",E),window.addEventListener("pointerup",R),window.addEventListener("pointercancel",$),window.addEventListener("blur",O)}function r1(a,u,y){if(we===null)return;if(Te()){a.preventDefault(),a.stopPropagation();return}a.preventDefault(),a.stopPropagation(),Sn();const S=we,E=a.pointerId,R=at.current,$=R.slides.find(yt=>yt.id===m.id);if(!$)return;const O=[...M,u.nodeIds[0]],V=jt($.nodes,O);if(!V||V.type!=="line"||!V.points||V.points[y]===void 0)return;const J=Gr($.nodes,O),Le=J?nr(J):null;if(!J||!Le)return;const $e=V.points,qe=V.points[y],We=a.clientX,Ce=a.clientY;en.current="move",bn("move");const Ne=yt=>{if(yt.pointerId!==E)return;const tt={x:(yt.clientX-We)/S,y:(yt.clientY-Ce)/S},nn=hr(Le,tt),an={x:Er(qe.x+nn.x,0,V.width),y:Er(qe.y+nn.y,0,V.height)};Ln({type:"node/update-style",slideId:$.id,updates:[{path:O,patch:{points:$e.map((on,$n)=>$n===y?an:on)}}]})},Ke=()=>{window.removeEventListener("pointermove",Ne),window.removeEventListener("pointerup",kt),window.removeEventListener("pointercancel",At),window.removeEventListener("blur",St),en.current=null,bn(null)},it=()=>{Ke(),Ba(R,i("拖动顶点"))},Pe=()=>{Ke(),dr(R)},kt=yt=>{yt.pointerId===E&&it()},At=yt=>{yt.pointerId===E&&Pe()},St=()=>Pe();window.addEventListener("pointermove",Ne),window.addEventListener("pointerup",kt),window.addEventListener("pointercancel",At),window.addEventListener("blur",St)}function a1(a,u,y){if(we===null)return;if(Te()){a.preventDefault(),a.stopPropagation();return}a.preventDefault(),a.stopPropagation(),Sn();const S=we,E=a.pointerId,R=at.current,$=R.slides.find(St=>St.id===m.id);if(!$)return;const O=[...M,u.nodeIds[0]],V=jt($.nodes,O);if(!V||V.type!=="shape"||V.locked||lm(V.shape)!==y)return;const J=Gr($.nodes,O),Le=J?nr(J):null;if(!J||!Le)return;const $e=om(V.shape,V.width,V.height,V);if(!$e)return;const qe=a.clientX,We=a.clientY;en.current="move",bn("move");const Ce=St=>{if(St.pointerId!==E)return;const yt={x:(St.clientX-qe)/S,y:(St.clientY-We)/S},tt=hr(Le,yt),nn=c2(y,{x:$e.x+tt.x,y:$e.y+tt.y},V.width,V.height);Ln({type:"node/update-style",slideId:$.id,updates:[{path:O,patch:y==="cornerRadius"?{cornerRadius:nn,cornerRadii:null}:{[y]:nn}}]})},Ne=()=>{window.removeEventListener("pointermove",Ce),window.removeEventListener("pointerup",Pe),window.removeEventListener("pointercancel",kt),window.removeEventListener("blur",At),en.current=null,bn(null)},Ke=()=>{Ne(),Ba(R,i(mw[y]))},it=()=>{Ne(),dr(R)},Pe=St=>{St.pointerId===E&&Ke()},kt=St=>{St.pointerId===E&&it()},At=()=>it();window.addEventListener("pointermove",Ce),window.addEventListener("pointerup",Pe),window.addEventListener("pointercancel",kt),window.addEventListener("blur",At)}function i1(a,u,y){a.preventDefault(),a.stopPropagation();const S=at.current.slides.find($=>$.id===m.id);if(!S)return;const E=[...M,u.nodeIds[0]],R=jt(S.nodes,E);!R||R.type!=="line"||!R.points||R.points.length<=hf||Ve({type:"node/update-style",slideId:S.id,updates:[{path:E,patch:{points:R.points.filter(($,O)=>O!==y)}}]},i("删除顶点"))}function s1(a,u,y="se"){if(we===null)return;if(Te()){a.preventDefault(),a.stopPropagation();return}const S=we,E=a.pointerId,R=[...M];a.preventDefault(),a.stopPropagation(),Sn();const $=at.current,O=$.slides.find(un=>un.id===m.id);if(!O)return;const V=u.nodeIds.map(un=>[...R,un]);if(!tl(O.nodes,V))return;const Le=a.clientX,$e=a.clientY,qe=Nr(Le,$e);if(!qe)return;const We=u.kind==="leaf"&&u.nodeIds.length===1?jt(O.nodes,V[0]):null,Ce=(We==null?void 0:We.type)==="group"?null:We,Ne=nj[y],Ke=Ne.x!==0&&Ne.y!==0;if(!Ce&&!Ke)return;const it=Ce?Gr(O.nodes,V[0]):null,Pe=it?nr(it):null,kt=Ce?As(Ce):null,At=Ww(O.nodes,R,u.nodeIds),St=u.corners[Ne.x<0?Ne.y<0?"se":"ne":Ne.y<0?"sw":"nw"],yt={x:qe.x-St.x,y:qe.y-St.y},tt=yt.x**2+yt.y**2;en.current="resize",bn("resize");const nn=un=>{var Zu;if(un.pointerId!==E)return;const Ga={x:(un.clientX-Le)/S,y:(un.clientY-$e)/S},$o=()=>{const Ua=at.current.slides.find(Xu=>Xu.id===O.id);yr(Ua?Su(Ua,R,u.nodeIds):null)};if(Ce&&it&&Pe&&kt){const Ua=hr(Pe,Ga),pa=40/(((Zu=Bi(it))==null?void 0:Zu.scale)??1);let Ya=Ce.width,Za=Ce.height;if(Ke&&(un.shiftKey||Ce.type==="path")&&tt>Number.EPSILON){const qu=Math.hypot(yt.x+Ga.x,yt.y+Ga.y)/Math.sqrt(tt);Ya=Math.max(pa,Ce.width*qu),Za=Math.max(pa,Ce.height*qu)}else if(un.shiftKey&&!Ke){const uc=Ne.x!==0?Math.max(pa,Ce.width+Ne.x*Ua.x)/Ce.width:Math.max(pa,Ce.height+Ne.y*Ua.y)/Ce.height;Ya=Math.max(pa,Ce.width*uc),Za=Math.max(pa,Ce.height*uc)}else Ne.x!==0&&(Ya=Math.max(pa,Ce.width+Ne.x*Ua.x)),Ne.y!==0&&(Za=Math.max(pa,Ce.height+Ne.y*Ua.y));const F1=ui(Ne.x<0?Ce.width-Ya:Ne.x===0?(Ce.width-Ya)/2:0,Ne.y<0?Ce.height-Za:Ne.y===0?(Ce.height-Za)/2:0),Do=Kc({...Ce,width:Ya,height:Za},Lr(kt,F1));if(!Do||Do.type==="group")return;Ln({type:"node/update-geometry",slideId:O.id,updates:[{path:V[0],patch:{x:Do.x,y:Do.y,width:Ya,height:Za}}]}),$o();return}if(tt<=Number.EPSILON)return;const Uu={x:yt.x+Ga.x,y:yt.y+Ga.y},M1=(Uu.x*yt.x+Uu.y*yt.y)/tt,dc=Er(M1,At.min,At.max);if(!Number.isFinite(dc)||dc<=0)return;const Yu=pf(O.nodes,R,u.nodeIds,Ph(u2(dc),St));Yu.ok&&(Ln({type:"node/update-geometry",slideId:O.id,updates:Ah(O.nodes,Yu.nodes,R,u.nodeIds)}),$o())},an=()=>{window.removeEventListener("pointermove",nn),window.removeEventListener("pointerup",Va),window.removeEventListener("pointercancel",Mr),window.removeEventListener("blur",Jn),en.current=null,Ia([]),la(null),yr(null),bn(null)},on=()=>{an(),Ba($,i("调整大小"))},$n=()=>{an(),dr($)},Va=un=>{un.pointerId===E&&on()},Mr=un=>{un.pointerId===E&&$n()},Jn=()=>$n();window.addEventListener("pointermove",nn),window.addEventListener("pointerup",Va),window.addEventListener("pointercancel",Mr),window.addEventListener("blur",Jn)}function o1(a,u,y){if(we===null)return;if(Te()){a.preventDefault(),a.stopPropagation();return}const S=we,E=a.pointerId,R=[...M];a.preventDefault(),a.stopPropagation(),Sn();const $=at.current,O=$.slides.find(an=>an.id===m.id);if(!O)return;const V=[...R,u.nodeIds[0]],J=jt(O.nodes,V);if(!J||J.type!=="table"||y>=J.cols-1)return;const Le=cm(J.width,J.cols,J.colWidths),$e=Array.from({length:J.cols},(an,on)=>Le[on+1]-Le[on]),qe=Gr(O.nodes,V),We=qe?nr(qe):null;if(!We)return;const Ce=a.clientX,Ne=a.clientY,Ke=$e[y]+$e[y+1],it=Math.max(12,J.width/(J.cols*6));en.current="resize",bn("resize");const Pe=an=>{if(an.pointerId!==E)return;const on={x:(an.clientX-Ce)/S,y:(an.clientY-Ne)/S},$n=hr(We,on),Va=Math.min(Ke-it,Math.max(it,$e[y]+$n.x)),Mr=[...$e];Mr[y]=Va,Mr[y+1]=Ke-Va,Ln({type:"node/update-content",slideId:O.id,updates:[{path:V,patch:{colWidths:Mr}}]})},kt=()=>{window.removeEventListener("pointermove",Pe),window.removeEventListener("pointerup",yt),window.removeEventListener("pointercancel",tt),window.removeEventListener("blur",nn),en.current=null,bn(null)},At=()=>{kt(),Ba($,i("调整列宽"))},St=()=>{kt(),dr($)},yt=an=>{an.pointerId===E&&At()},tt=an=>{an.pointerId===E&&St()},nn=()=>St();window.addEventListener("pointermove",Pe),window.addEventListener("pointerup",yt),window.addEventListener("pointercancel",tt),window.addEventListener("blur",nn)}function l1(a,u){if(we===null)return;if(Te()){a.preventDefault(),a.stopPropagation();return}a.preventDefault(),a.stopPropagation(),Sn();const y=at.current,S=y.slides.find(Pe=>Pe.id===m.id);if(!S)return;const E=[...M],R=u.nodeIds.map(Pe=>[...E,Pe]),$=tl(S.nodes,R);if(!$)return;const O={x:$.x+$.width/2,y:$.y+$.height/2},V=a.pointerId,J=Nr(a.clientX,a.clientY);if(!J)return;const Le=Math.atan2(J.y-O.y,J.x-O.x);en.current="rotate",bn("rotate");const $e=Pe=>{if(Pe.pointerId!==V)return;const kt=Nr(Pe.clientX,Pe.clientY);if(!kt)return;const St=(Math.atan2(kt.y-O.y,kt.x-O.x)-Le)*180/Math.PI,yt=Pe.shiftKey?Tj(St):St,tt=pf(S.nodes,E,u.nodeIds,Ph(d2(yt),O));tt.ok&&(Ln({type:"node/update-geometry",slideId:S.id,updates:Ah(S.nodes,tt.nodes,E,u.nodeIds)}),yr(`${Math.round(yt)}°`))},qe=()=>{window.removeEventListener("pointermove",$e),window.removeEventListener("pointerup",Ne),window.removeEventListener("pointercancel",Ke),window.removeEventListener("blur",it),en.current=null,yr(null),bn(null)},We=()=>{qe(),Ba(y,i("旋转对象"))},Ce=()=>{qe(),dr(y)},Ne=Pe=>{Pe.pointerId===V&&We()},Ke=Pe=>{Pe.pointerId===V&&Ce()},it=()=>Ce();window.addEventListener("pointermove",$e),window.addEventListener("pointerup",Ne),window.addEventListener("pointercancel",Ke),window.addEventListener("blur",it)}async function ys(a,u,y,S){const E=ua.current;if(!E)return null;const R=await o2(E,{timeoutMs:hw});if(!R.ok)throw new Error(R.reason==="timeout"?i("图片加载超时,导出已取消"):i("图片加载失败,导出已取消"));await new Promise(O=>requestAnimationFrame(()=>requestAnimationFrame(O)));const $=await um(E,{pixelRatio:y,width:a.width,height:a.height,style:{transform:"none"},fontEmbedCSS:u,filter:O=>!(O instanceof HTMLElement&&O.classList.contains("freeform-ui-only"))});return S?fm($):$}async function Ru(a,u){const y=Ge.exportFormat==="jpeg",S=await ys(a,u,Ge.exportScale,y);return S?y?ja(S,"image/jpeg",Ge.exportQuality):ja(S,"image/png"):null}async function Iu(a,u){const y=await ys(a,u,Ge.exportScale,!0);if(!y)return null;const S=await ja(y,"image/jpeg",Ge.exportQuality);return S?qm(new Uint8Array(await S.arrayBuffer()),a,y):null}function Lu(a,u){Rc(new Blob([Qm(a)],{type:"application/pdf"}),u)}async function js(a){try{return await gc(pc(a))}catch{return""}}async function c1(){if(we!==null&&!Te()){Fe(!0);try{dt([]),await new Promise(y=>requestAnimationFrame(()=>requestAnimationFrame(y)));const a=await js([m]),u=Math.max(0,x.slides.findIndex(y=>y.id===m.id));if(Ge.exportFormat==="pdf"){const y=await Iu(m,a);y&&Lu([y],Ic(u,"pdf"))}else{const y=await Ru(m,a);y&&Rc(y,Ic(u,Ge.exportFormat))}}catch(a){wn(a,i("导出失败,请稍后重试"))}finally{Fe(!1)}}}async function $u(){if(x.slides.length===0||we===null||Te())return;Fe(!0),Qe(null);const a=m.id;try{dt([]);const u=await js(x.slides),y=Ge.exportFormat==="pdf",S=[],E=[];for(let $=0;$<x.slides.length;$++){const O=x.slides[$];if(Qe({current:$+1,total:x.slides.length}),Ln({type:"slide/select",slideId:O.id}),await new Promise(V=>requestAnimationFrame(()=>requestAnimationFrame(V))),y){const V=await Iu(O,u);V&&E.push(V)}else{const V=await Ru(O,u);V&&S.push({name:Ic($,Ge.exportFormat),blob:V})}}const R=new Date().toISOString().slice(0,10);E.length>0&&Lu(E,`freeform-slides-${R}.pdf`),S.length>0&&await ed(S,`freeform-slides-${R}.zip`)}catch(u){wn(u,Ge.exportFormat==="pdf"?i("导出失败,请稍后重试"):i("打包导出失败,请稍后重试"))}finally{Ln({type:"slide/select",slideId:a}),Qe(null),Fe(!1)}}async function d1(){if(x.slides.length===0||we===null||Te())return;const a=Vg(x.slides,Ge.exportScale);if(a===null){Ze(i("页面太多,拼不成一张长图,请改用打包下载"));return}Fe(!0),Qe(null);const u=m.id;try{dt([]);const y=await js(x.slides),S=Ge.exportFormat==="jpeg",E=Gg(x.slides,a,S?"#ffffff":void 0);for(let O=0;O<x.slides.length;O++){const V=x.slides[O];Qe({current:O+1,total:x.slides.length}),Ln({type:"slide/select",slideId:V.id}),await new Promise(Le=>requestAnimationFrame(()=>requestAnimationFrame(Le)));const J=await ys(V,y,a,S);J&&E.draw(O,J)}const R=S?await ja(E.canvas,"image/jpeg",Ge.exportQuality):await ja(E.canvas,"image/png");if(!R)throw new Error(i("长图导出失败,请稍后重试"));const $=new Date().toISOString().slice(0,10);Rc(R,`freeform-long-${$}.${S?"jpg":"png"}`),a<Ge.exportScale&&Ze(i("长图太长,已缩小到 {scale}x 导出",{scale:a}))}catch(y){wn(y,i("长图导出失败,请稍后重试"))}finally{Ln({type:"slide/select",slideId:u}),Qe(null),Fe(!1)}}async function u1(){if(!(we===null||!of(m))&&!Te()){Fe(!0);try{dt([]),await new Promise(E=>requestAnimationFrame(()=>requestAnimationFrame(E)));const a=await js([m]),u=Ge.exportFormat==="jpeg",y=await ys(m,a,Ge.exportScale,u);if(!y)return;const S=[];for(const[E,R]of Kg(y).entries()){const $=u?await ja(R,"image/jpeg",Ge.exportQuality):await ja(R,"image/png");if(!$)throw new Error(i("九宫格导出失败,请稍后重试"));S.push({name:`grid-${E+1}.${u?"jpg":"png"}`,blob:$})}await ed(S,`freeform-grid-${new Date().toISOString().slice(0,10)}.zip`)}catch(a){wn(a,i("九宫格导出失败,请稍后重试"))}finally{Fe(!1)}}}async function f1(a){if(x.slides.length===0||we===null||Te())return;const u=r??hn,y=xt(u);if(!y.remote)return;Fe(!0),Qe(null),bt(null);const S=m.id;try{dt([]);const E=await js(x.slides),R=[];for(let $=0;$<x.slides.length;$++){const O=x.slides[$];Qe({current:$+1,total:x.slides.length}),Ln({type:"slide/select",slideId:O.id}),await new Promise(qe=>requestAnimationFrame(()=>requestAnimationFrame(qe)));const V=await ys(O,E,Ge.exportScale,!1),J=V?await ja(V,"image/png"):null;if(!J)continue;const Le=await new Promise((qe,We)=>{const Ce=new FileReader;Ce.onload=()=>qe(String(Ce.result)),Ce.onerror=()=>We(Ce.error),Ce.readAsDataURL(J)}),$e=await ka(Le,2160);R.push(await y.images.put($e))}if(R.length===0)throw new Error(i("分享创建失败,请稍后重试"));ee(await y.shares.create(u,cs.current,R,a)),gn.current=x}catch{bt(i("分享创建失败,请稍后重试"))}finally{Ln({type:"slide/select",slideId:S}),Qe(null),Fe(!1)}}async function h1(a){const u=r??hn;ct(!0);try{await xt(u).shares.revoke(u,a.id),ee(null),gn.current=null,It(!1),Ze(i("分享已撤销,链接不再能打开"))}catch(y){wn(y,i("撤销分享失败,请稍后重试"))}finally{ct(!1)}}function m1(){if(we!==null&&!Te()){if(Ge.exportFormat!=="pdf"&&Tw(x.slides)){Zn(!0);return}$u()}}function p1(){we!==null&&(Te()||(Zn(!1),$u()))}function Ro(a=Yt.current){const u=at.current,y=wr.current!==null||ls.current.past.length>0,S=!Object.is(u,ds.current)||fa.current,E=Object.is(u,Al.current)&&Pl.current===cs.current;if(a&&!us.current&&y&&S&&!E){const R=cs.current;Bl(a,wr.current,{mode:"freeform-slide",title:R,document:u},{title:R})}Al.current=null,Pl.current=null,po()}function Io(a){if(a.mode!=="freeform-slide"||(xs(),Te()))return;Ro(),ds.current=a.document,wt.current+=1,Pr.current.clear(),Ar(new Set),Da.current={source:a.document,document:a.document,updatedAt:a.updatedAt},Zt(Mc(a.document)),dt([]),Aa(a.id),Jt(a.updatedAt),Ea(a.title),fa.current=!1,oa(!1);const u=Yt.current;u&&Na(u,{mode:"freeform-slide",freeformDraftId:a.id})}Ra.current=Io;function Du(a){const u=Qs(a).freeformDraftId;if(!u)return;const y=++sr.current;xt(a).drafts.list(a).then(S=>{if(Yt.current!==a||sr.current!==y)return;const E=S.find(R=>R.id===u&&R.mode==="freeform-slide");E&&Ra.current(E)},()=>{})}function g1(a){Ea(a),oa(!0)}async function x1(a,u){const y=sr.current;let S=null;try{S=new URL(a,window.location.href)}catch{S=null}const E=S!==null&&/^https?:$/.test(S.protocol)&&(S.origin===window.location.origin||["127.0.0.1","localhost","[::1]"].includes(S.hostname));if(!S||!E){Ze(i("只能导入本机上的文档"));return}let R;try{const O=await fetch(S.href,{cache:"no-store"});if(!O.ok)throw new Error(String(O.status));R=await O.text()}catch{Ze(i("读取导入的文档失败,请重试"));return}if(sr.current!==y)return;const $=im(R);if(!$.ok){Ze(i($.error));return}if($.data.mode!=="freeform-slide"){Ze(i("这里只能导入自由画布文档"));return}ws($.data.document,(u==null?void 0:u.trim())||i("导入的设计")),fa.current=!0,oa(!0)}function Au(a,u){var $;if(a.workspace!=="freeform")return;const y=($=a.createFreeform)==null?void 0:$.call(a);if(!y)return;const S=u?u.flatMap(O=>y.slides[O]??[]):y.slides;if(S.length===0)return;const E=m.nodes.length===0;Ve(E?{type:"slide/insert",slides:S,replaceSlideId:m.id}:{type:"slide/insert",slides:S,afterSlideId:m.id},E?"套用模板":"插入模板页")&&dt([])}function Pu(a){var y;if(a.workspace!=="freeform")return;const u=(y=a.createFreeform)==null?void 0:y.call(a);u&&ws(u,i(a.title))}function ws(a,u=i("未命名设计"),y=!0){xs(),!Te()&&(y?Ro():po(),ds.current=a,sr.current+=1,wt.current+=1,os.current+=1,Pr.current.clear(),Ar(new Set),Da.current=null,Zt(Mc(a)),N({activeGroupPath:[],selectionPaths:[],identity:{activeSlideId:a.activeSlideId,draftId:null,userId:Yt.current}}),A(null),br(null),Ia([]),la(null),Aa(null),Jt(null),Ea(u),fa.current=!1,oa(!1),ve(!1))}const Lo=pi===null&&h.past.length>0,Tu=!bi&&or===null&&!yn&&!_;p.useEffect(()=>{!r||us.current||!(Lo||sa)||!Tu||(Al.current=x,Pl.current=ir,Bl(r,wr.current,{mode:"freeform-slide",title:ir,document:x},{title:ir}))},[x,Lo,Tu,r,Dl,ir,Bl,sa]);const lc=(Lo||sa)&&(r===null||Dl!==null||Ha.status==="error");p.useEffect(()=>{f==null||f({title:ir,draftId:In,unsaved:lc})},[ir,In,lc,f]);const b1=Dl?{kind:"signed-out"}:r===null?{kind:"none"}:Ha.status==="error"?{kind:"error",message:Ha.error??""}:Lo||sa||Ha.status==="saving"?{kind:"saving"}:In?{kind:"saved",at:pi??Date.now(),onDevice:si(r)}:{kind:"none"};p.useEffect(()=>{if(!(!c||eo.current===c.nonce)&&!(c.kind==="open"&&!r)){if(eo.current=c.nonce,c.kind==="removed"||c.kind==="renamed"){if(wr.current!==c.draftId)return;if(c.kind==="renamed"){Ea(c.title);return}Z0(),ws(Ao(),void 0,!1);return}if(sr.current+=1,za.current=!0,c.kind==="new"){const a=y=>y===null?void 0:Math.min(_c,Math.max(Bc,y)),u=dg({width:a(c.width),height:a(c.height)});ws({...Ao(),activeSlideId:u.id,slides:[u]})}else if(c.kind==="template")Pu(c.template);else if(c.kind==="import")x1(c.url,c.title);else if(r&&wr.current!==c.draftId){const a=r,u=c.draftId,y=sr.current;xt(a).drafts.list(a).then(S=>{if(Yt.current!==a||sr.current!==y)return;const E=S.find(R=>R.id===u&&R.mode==="freeform-slide");E?Io(E):Ze(i("没有找到这个项目,它可能已经被删除了"))},S=>wn(S,i("暂时无法读取项目,请稍后重试")))}}},[c,r]);const y1=(()=>{if(wi.length===0)return{kind:"page"};if(Wt)return{kind:"locked",name:Ir(Wt.unlockName)};if(tn)return{kind:"locked",name:Ir(tn.sourceName)};if(wi.length>1)return{kind:"multi",count:wi.length};if(!C){const u=et?jt(m.nodes,et):void 0;return{kind:"group",name:Ir((u==null?void 0:u.name)??"组")}}const a=(ut==null?void 0:ut.kind)==="leaf"?ut:null;return C.type==="text"?{kind:"text",node:C,fontSize:(a==null?void 0:a.fontSize)??C.fontSize}:C.type==="shape"?{kind:"shape",node:C,strokeWidth:(a==null?void 0:a.strokeWidth)??C.strokeWidth,canFrame:fs&&(Ft==null?void 0:Ft.targetKind)==="shape-fill",frameDisabledReason:Wa}:C.type==="line"?{kind:"line",node:C,strokeWidth:(a==null?void 0:a.strokeWidth)??C.strokeWidth}:C.type==="path"?{kind:"path",node:C,strokeWidth:(a==null?void 0:a.strokeWidth)??C.strokeWidth*ni(C.viewBox,C.width,C.height),canFrame:fs&&(Ft==null?void 0:Ft.targetKind)==="shape-fill",frameDisabledReason:Wa}:C.type==="qrcode"?{kind:"qrcode",node:C}:C.type==="chart"?{kind:"chart",node:C}:C.type==="table"?{kind:"table",node:C}:C.type==="timeline"?{kind:"timeline",node:C}:C.type==="progress"?{kind:"progress",node:C}:{kind:"image",node:C,canCrop:Tl,cropDisabledReason:Wa}})();function j1(){if(Wt){Ni(Wt.unlockPath,!1);return}if(tn){Ni(tn.sourcePath,!1);return}for(const a of xe)Ni(a,!0)}const Xt=yn?Ka(yn):null,Wu=yn&&Xt?Gr(Xt.slide.nodes,yn.path):null,Hu=Wu&&Xt?{...Ew(Wu),width:Xt.target.frameSize.width,height:Xt.target.frameSize.height}:void 0,w1=Xt!=null&&Xt.target.shape?` shape-${Xt.target.shape}`:"",cc=_?jo(_):null,Ou=_&&cc&&we!==null?mh({renderScale:we,startWorldMatrix:_.startWorldMatrix}):null,k1=cc&&_?ye(_.path):void 0,Mi=!!(yn||_),_u=Kt?Uj(Kt.scale):1,S1=Kt?Rh(-Kt.left/Kt.scale,(Kt.width-Kt.left)/Kt.scale,_u):[],v1=Kt?Rh(-Kt.top/Kt.scale,(Kt.height-Kt.top)/Kt.scale,_u):[],N1=Vt?Vt.axis==="x"?m.width:m.height:0,Bu=Vt!==null&&Vt.position>=0&&Vt.position<=N1;return t.jsx(m0.Provider,{value:X0,children:t.jsxs("div",{className:["freeform-workspace",yn?"is-framing":"",_?"is-image-cropping":""].filter(Boolean).join(" "),"aria-label":i("自由编辑工作区"),"data-history-depth":h.past.length,children:[e&&t.jsx(e0,{chrome:o,user:n,requestAuth:l,system:"freeform-slide",title:ir,onRename:g1,save:b1,onRetrySave:()=>void Ha.flush(),actions:Tr.remote&&In?t.jsxs("button",{className:"bar-btn",type:"button","data-testid":"draft-history",disabled:Mi,onClick:()=>Ca(!0),children:[t.jsx(Nm,{}),i("历史版本")]}):void 0,center:t.jsx(t0,{testId:"freeform-toolbar",label:i("自由编辑工具栏"),className:"freeform-toolbar",disabled:Mi,children:t.jsxs(td,{children:[t.jsx("button",{className:"bar-btn bar-icon",type:"button",onClick:ku,disabled:!K0,"aria-label":i("撤销"),title:i("撤销(⌘Z)"),children:t.jsx(B2,{})}),t.jsx("button",{className:"bar-btn bar-icon",type:"button",onClick:ic,disabled:!V0,"aria-label":i("重做"),title:i("重做(⇧⌘Z)"),children:t.jsx(K2,{})}),t.jsx(pl,{}),t.jsx("div",{className:"freeform-page-context",children:t.jsx(L5,{isActive:e,width:m.width,height:m.height,onApply:Gp})}),t.jsx(pl,{}),t.jsxs("div",{className:"freeform-view-toggles",role:"group","aria-label":i("视图"),children:[t.jsx("button",{className:"bar-btn bar-icon",type:"button","data-testid":"freeform-rulers-toggle","aria-label":i("显示标尺"),title:i("显示标尺"),"aria-pressed":Ge.rulersVisible,onClick:()=>qn({rulersVisible:!Ge.rulersVisible}),children:t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[t.jsx("path",{d:"M3.5 7.5h13v5h-13z"}),t.jsx("path",{d:"M6.5 7.5v2M9.5 7.5v2.75M12.5 7.5v2M15.5 7.5v2.75"})]})}),t.jsx("button",{className:"bar-btn bar-icon",type:"button","data-testid":"freeform-guides-toggle","aria-label":i("显示参考线"),title:i("显示参考线"),"aria-pressed":Ge.guidesVisible,onClick:()=>qn({guidesVisible:!Ge.guidesVisible}),children:t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[t.jsx("path",{d:"M7 2.5v15M2.5 13h15",strokeDasharray:"2 2"}),t.jsx("rect",{x:"4.5",y:"4.5",width:"11",height:"11",rx:"1.5"})]})}),t.jsx("button",{className:"bar-btn bar-icon",type:"button","data-testid":"freeform-snap-toggle","aria-label":i("对象吸附"),title:i("对象吸附"),"aria-pressed":Ge.snappingEnabled,onClick:()=>qn({snappingEnabled:!Ge.snappingEnabled}),children:t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[t.jsx("path",{d:"M5.5 3.5v6.25a4.5 4.5 0 0 0 9 0V3.5"}),t.jsx("path",{d:"M5.5 6.75h3M11.5 6.75h3"})]})})]})]})}),primary:t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",className:"bar-btn","data-testid":"find-replace-trigger",onClick:()=>lt(!0),title:i("查找替换"),"aria-label":i("查找替换"),children:t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[t.jsx("circle",{cx:"9",cy:"9",r:"5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8"}),t.jsx("path",{d:"M13.2 13.2 17 17",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"}),t.jsx("path",{d:"M6.5 9h5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}),t.jsx(r5,{disabled:we===null||Mi,exporting:Xe,progress:Mt,pageCount:x.slides.length,prefs:Ge,onPrefsChange:qn,onExportCurrent:()=>void c1(),onExportAll:m1,onExportLong:()=>void d1(),onExportGrid:of(m)?()=>void u1():void 0,onShare:Tr.remote?()=>{bt(null),It(!0)}:void 0})]})}),rs&&t.jsx(Fl,{title:rs,onDismiss:()=>Ze(null)}),_t&&t.jsx(a5,{slideCount:x.slides.length,activeSlideName:m.name,countMatches:(a,u)=>fg(x,a,u==="slide"?m.id:null),onApply:(a,u,y)=>{const S=ug(x,a,u,y==="slide"?m.id:null);return S.replaced>0&&Ve({type:"document/find-replace",find:a,replace:u,...y==="slide"?{slideId:m.id}:{}}),{replaced:S.replaced,skipped:S.skipped}},onClose:()=>lt(!1)}),mt&&t.jsx(g0,{share:pt&&gn.current===at.current&&pt.expiresAt>Date.now()?pt:null,creating:Xe,progress:Mt,slideCount:x.slides.length,revoking:He,error:Lt,onCreate:a=>void f1(a),onRevoke:()=>pt&&void h1(pt),onClose:()=>{Xe||It(!1)}}),ns&&r&&In&&t.jsx(x0,{ownerId:r,draftId:In,onRestored:a=>{Ca(!1),Io(a)},onClose:()=>Ca(!1)}),t.jsxs("main",{className:`freeform-main${ce?" has-drawer":""}${Ge.panelOpen?" has-panel":""}`,children:[t.jsxs("nav",{className:"freeform-tools","aria-label":i("插入"),ref:a=>{a&&(Mi?a.setAttribute("inert",""):a.removeAttribute("inert"))},children:[t.jsxs("button",{className:"freeform-tool",type:"button","data-testid":"freeform-template-button","aria-expanded":ce==="templates","aria-controls":"freeform-templates-drawer",onClick:()=>La("templates"),children:[t.jsx(Vi,{}),t.jsx("span",{children:i("模板")})]}),t.jsxs("button",{className:"freeform-tool",type:"button","data-testid":"freeform-styles-tool","aria-expanded":ce==="styles","aria-controls":"freeform-styles-drawer",onClick:()=>La("styles"),children:[t.jsx(W2,{}),t.jsx("span",{children:i("风格")})]}),t.jsx("span",{className:"freeform-tools-sep","aria-hidden":"true"}),t.jsxs("button",{className:"freeform-tool",type:"button","data-testid":"freeform-text-tool","aria-expanded":ce==="text","aria-controls":"freeform-text-drawer",onClick:()=>La("text"),children:[t.jsx(km,{}),t.jsx("span",{children:i("文字")})]}),t.jsxs("button",{className:"freeform-tool",type:"button","data-testid":"freeform-images-tool","aria-expanded":ce==="images","aria-controls":"freeform-images-drawer",onClick:()=>La("images"),children:[t.jsx(vm,{}),t.jsx("span",{children:i("图片")})]}),t.jsxs("button",{className:"freeform-tool",type:"button","data-testid":"freeform-elements-tool","aria-expanded":ce==="elements","aria-controls":"freeform-elements-drawer",onClick:()=>La("elements"),children:[t.jsx(Sm,{}),t.jsx("span",{children:i("元素")})]}),t.jsxs("button",{className:"freeform-tool freeform-tool-end freeform-pages-tool",type:"button","data-testid":"freeform-pages-tool","aria-pressed":Ge.pagesVisible,"aria-controls":Ge.pagesVisible?"freeform-page-list":void 0,onClick:()=>qn({pagesVisible:!Ge.pagesVisible}),children:[t.jsx(_2,{}),t.jsx("span",{children:i("页面")})]}),t.jsxs("button",{className:"freeform-tool",type:"button","data-testid":"freeform-layers-tool","aria-pressed":Ge.panelOpen&&Xn==="layers",onClick:()=>ro("layers"),children:[t.jsx(ex,{}),t.jsx("span",{children:i("图层")})]}),t.jsx("input",{ref:uo,className:"freeform-file",type:"file",accept:"image/*",onChange:a=>Rp(a.currentTarget.files)}),t.jsx("input",{ref:fo,className:"freeform-font-file",type:"file",accept:nm,"data-testid":"freeform-font-input",onChange:a=>zp(a.currentTarget.files)})]}),ce==="templates"&&t.jsxs("aside",{className:"freeform-drawer is-scroll",id:"freeform-templates-drawer","aria-label":i("模板"),"data-testid":"freeform-templates-drawer",onKeyDown:a=>{a.key!=="Escape"||a.defaultPrevented||(a.preventDefault(),me(null),requestAnimationFrame(()=>{var u;return(u=document.querySelector('[data-testid="freeform-template-button"]'))==null?void 0:u.focus()}))},children:[t.jsxs("div",{className:"freeform-drawer-head",children:[t.jsx("h2",{children:i("模板")}),t.jsx("button",{className:"icon-btn",type:"button","aria-label":i("关闭面板"),onClick:()=>me(null),children:t.jsx(Pn,{})})]}),t.jsxs("button",{className:"accent freeform-drawer-upload",type:"button","data-testid":"freeform-templates-browse",onClick:()=>ve(!0),children:[t.jsx(Vi,{}),i("浏览全部模板")]}),t.jsx(v6,{templates:Sw,pageSize:m,room:lf-x.slides.length+(m.nodes.length===0?1:0),onInsert:Au})]}),ce==="styles"&&t.jsxs("aside",{className:"freeform-drawer is-scroll",id:"freeform-styles-drawer","aria-label":i("风格"),"data-testid":"freeform-styles-drawer",onKeyDown:a=>{a.key!=="Escape"||a.defaultPrevented||(a.preventDefault(),me(null),requestAnimationFrame(()=>{var u;return(u=document.querySelector('[data-testid="freeform-styles-tool"]'))==null?void 0:u.focus()}))},children:[t.jsxs("div",{className:"freeform-drawer-head",children:[t.jsx("h2",{children:i("风格")}),t.jsx("button",{className:"icon-btn",type:"button","aria-label":i("关闭面板"),onClick:()=>me(null),children:t.jsx(Pn,{})})]}),t.jsx(O6,{onRestyle:go})]}),ce==="text"&&t.jsxs("aside",{className:"freeform-drawer is-scroll",id:"freeform-text-drawer","aria-label":i("文字"),"data-testid":"freeform-text-drawer",onKeyDown:a=>{a.key!=="Escape"||a.defaultPrevented||(a.preventDefault(),me(null),requestAnimationFrame(()=>{var u;return(u=document.querySelector('[data-testid="freeform-text-tool"]'))==null?void 0:u.focus()}))},children:[t.jsxs("div",{className:"freeform-drawer-head",children:[t.jsx("h2",{children:i("文字")}),t.jsx("button",{className:"icon-btn",type:"button","aria-label":i("关闭面板"),onClick:()=>me(null),children:t.jsx(Pn,{})})]}),t.jsxs("button",{className:"accent freeform-drawer-upload",type:"button","data-testid":"insert-text",onClick:()=>Jl("box"),children:[t.jsx(fl,{}),i("添加文本框")]}),t.jsx("div",{className:"freeform-drawer-section",children:i("默认文字样式")}),t.jsx("div",{className:"freeform-text-presets",children:u8.filter(a=>a.id!=="box").map(a=>t.jsx("button",{type:"button",className:`freeform-text-preset is-${a.id}`,"data-testid":a.testId,onClick:()=>Jl(a.id),children:i(a.label)},a.id))}),t.jsx("div",{className:"freeform-drawer-section",children:i("花字")}),t.jsx("div",{className:"freeform-text-styles",children:q6.map(a=>t.jsxs("button",{type:"button",className:`freeform-text-style${Q6(a)?" is-dark":""}`,"data-testid":`text-style-${a.id}`,style:{background:a.backdrop},onClick:()=>xp(a),children:[t.jsx(id,{text:cl()==="en"?"Wow":"花字",fontSize:30,textFill:a.textFill,effect:a.effect}),t.jsx("span",{className:"freeform-text-style-name",children:i(a.name)})]},a.id))})]}),ce==="elements"&&t.jsxs("aside",{className:"freeform-drawer is-scroll",id:"freeform-elements-drawer","aria-label":i("元素"),"data-testid":"freeform-elements-drawer",onKeyDown:a=>{a.key!=="Escape"||a.defaultPrevented||a.target instanceof HTMLInputElement&&a.target.value||(a.preventDefault(),me(null),requestAnimationFrame(()=>{var u;return(u=document.querySelector('[data-testid="freeform-elements-tool"]'))==null?void 0:u.focus()}))},children:[t.jsxs("div",{className:"freeform-drawer-head",children:[t.jsx("h2",{children:i("元素")}),t.jsx("button",{className:"icon-btn",type:"button","aria-label":i("关闭面板"),onClick:()=>me(null),children:t.jsx(Pn,{})})]}),t.jsx(H6,{onPick:ts})]}),ce==="images"&&t.jsxs("aside",{className:"freeform-drawer",id:"freeform-images-drawer","aria-label":i("图片"),"data-testid":"freeform-images-drawer",onKeyDown:a=>{a.key!=="Escape"||a.defaultPrevented||a.target instanceof HTMLInputElement&&a.target.value||(a.preventDefault(),me(null))},children:[t.jsxs("div",{className:"freeform-drawer-head",children:[t.jsx("h2",{children:i("图片")}),t.jsx("button",{className:"icon-btn",type:"button","aria-label":i("关闭面板"),onClick:()=>me(null),children:t.jsx(Pn,{})})]}),t.jsxs("button",{className:"accent freeform-drawer-upload",type:"button","data-testid":"insert-image",onClick:()=>{var a;return(a=uo.current)==null?void 0:a.click()},children:[t.jsx(pr,{}),i("上传图片")]}),t.jsx("div",{className:"freeform-drawer-section",children:i("在线图库")}),t.jsx(s6,{stock:Tr.stock,onInsert:(a,u,y)=>{ec(async()=>a,u,y)}}),t.jsx("div",{className:"freeform-drawer-section",children:i("素材库")}),t.jsx(Xm,{ownerId:r,onInsert:a=>void Ep(a),onManage:()=>Rt(ft.assets)})]}),Ge.pagesVisible&&t.jsxs("aside",{className:"freeform-rail",id:"freeform-page-list","aria-label":i("页面列表"),"data-testid":"freeform-page-strip",children:[t.jsxs("div",{className:"freeform-rail-head",children:[t.jsx("h2",{children:i("{n} 页",{n:x.slides.length})}),t.jsx("button",{type:"button",className:"icon-btn","data-testid":"freeform-pages-collapse","aria-label":i("收起页面列表"),title:i("收起页面列表"),onClick:()=>qn({pagesVisible:!1}),children:t.jsx(Qi,{})})]}),t.jsx("div",{ref:zt,className:"freeform-slide-list",role:"list",onDragOver:a=>{fe.current&&(a.preventDefault(),a.dataTransfer.dropEffect="move")},onDrop:a=>{const u=fe.current;u&&(a.preventDefault(),fe.current=null,ze(null),vi(u,x.slides.length-1))},children:x.slides.map((a,u)=>{const y=vw(a,oe),S=Rs(a.name,u),E=(Ee==null?void 0:Ee.slideId)===a.id&&!!Ee.fromButton;return t.jsxs("div",{className:`freeform-thumb-wrap${a.id===m.id?" is-active":""}`,role:"listitem",children:[t.jsxs("button",{type:"button",draggable:!0,className:`freeform-thumb${a.id===m.id?" on":""}${(Ae==null?void 0:Ae.slideId)===a.id?Ae.position==="before"?" drop-before":" drop-after":""}`,"aria-current":a.id===m.id?"page":void 0,"data-testid":"freeform-thumb","data-slide-id":a.id,onClick:()=>No(a.id),onDragStart:R=>{fe.current=a.id,R.dataTransfer.effectAllowed="move",R.dataTransfer.setData("text/plain",a.id)},onDragEnd:()=>{fe.current=null,ze(null)},onDragOver:R=>{if(!fe.current||fe.current===a.id)return;R.preventDefault(),R.dataTransfer.dropEffect="move";const $=Lh(R);ze(O=>O&&O.slideId===a.id&&O.position===$?O:{slideId:a.id,position:$})},onDragLeave:()=>{ze(R=>(R==null?void 0:R.slideId)===a.id?null:R)},onDrop:R=>{const $=fe.current;if(!$||$===a.id)return;R.preventDefault(),R.stopPropagation(),fe.current=null,ze(null);const O=Lh(R)==="after",V=mp($,a.id,O);V!==null&&vi($,V)},onContextMenu:R=>gp(R,a.id),children:[t.jsx(Xs,{slide:a,frameWidth:y.width,frameHeight:y.height,className:"freeform-thumb-art",deferOffscreen:a.id!==m.id}),t.jsx("span",{className:"freeform-thumb-caption",children:t.jsx("span",{className:"freeform-thumb-title","data-testid":"freeform-thumb-title",title:S,onDoubleClick:R=>{R.stopPropagation(),R.preventDefault(),cu(a.id)},children:S})})]}),t.jsx("button",{type:"button",className:"freeform-thumb-menu","data-testid":"freeform-thumb-menu","aria-label":i("{name} 的页面操作",{name:S}),title:i("页面操作"),"aria-haspopup":"menu","aria-expanded":E,onClick:R=>pp(R,a.id),children:t.jsx(Nl,{})}),ou===a.id&&t.jsx("input",{ref:Xl,className:"freeform-thumb-rename","data-testid":"freeform-thumb-rename","aria-label":i("重命名页面"),value:lu,onChange:R=>Mo(R.currentTarget.value),onPointerDown:R=>R.stopPropagation(),onBlur:()=>du(),onKeyDown:R=>{if(R.stopPropagation(),R.key==="Enter"){if(R.nativeEvent.isComposing||Si.current)return;R.preventDefault(),du()}else R.key==="Escape"&&(R.preventDefault(),fp())},onCompositionStart:()=>{Si.current=!0},onCompositionEnd:()=>{Si.current=!1}})]},a.id)})}),t.jsxs("button",{className:"freeform-add-page",type:"button",onClick:dp,children:[t.jsx(fl,{}),t.jsx("span",{children:i("新增页面")})]})]}),t.jsxs("section",{className:"freeform-stage-pane","aria-label":i("自由画布"),children:[(_||yn)&&t.jsx("div",{className:"freeform-stage-head is-session",children:_?t.jsxs("div",{className:"freeform-framing-head freeform-crop-head",role:"toolbar","aria-label":i("图片裁剪"),children:[t.jsx("div",{className:"freeform-toolbar","data-image-crop-control":"",style:{position:"relative",zIndex:70},children:t.jsx(ol,{isActive:e,testId:"freeform-image-crop-aspect",label:i("比例"),options:Fw,onSelect:sp,onEscape:()=>{gs()}})}),t.jsx("strong",{children:i("裁剪")}),t.jsx("button",{className:"toolbar-primary",type:"button","data-testid":"freeform-image-crop-done",onClick:()=>{gs()},children:i("完成")})]}):t.jsxs("div",{className:"freeform-framing-head",role:"toolbar","aria-label":i("图片取景"),children:[t.jsx("button",{className:"ghost",type:"button","data-testid":"freeform-framing-cancel",onClick:su,children:i("取消")}),t.jsx("strong",{children:i("调整取景")}),t.jsx("button",{className:"toolbar-primary",type:"button","data-testid":"freeform-framing-done",onClick:iu,children:i("完成")})]})}),t.jsx(g5,{suspended:Mi,isActive:e,subject:y1,resetKey:Bt,canAlign:Yd,canDistribute:xe.length>=3,canGroup:xe.length>=2,onStyle:a=>{he(a)},onProperty:a=>{Hr(a)},onFontFamily:a=>{if(a===rd){pu();return}(C==null?void 0:C.type)==="text"&&cf(C.text,a,[C.fontWeight]).catch(()=>{});const u=(C==null?void 0:C.type)==="text"?C.fontFamily:null;he({fontFamily:a})&&u&&u!==a&&xo({from:u,to:a})},onShapeFill:a=>{_a(a)},onAlign:wu,onDistribute:ac,onOrder:ma,onGroup:()=>{Eo()},onUngroup:()=>{zo()},onCrop:()=>{et&&Gl(et)},onDuplicate:rc,onToggleLock:j1,onDelete:Co,onAdjustFraming:()=>{et&&vo(et)},panelOpen:Ge.panelOpen&&Xn==="properties",onTogglePanel:()=>ro("properties")}),t.jsxs("div",{ref:lo,className:`freeform-stage-viewport${Ge.rulersVisible?" has-rulers":""}${Vt?` guide-dragging-${Vt.axis}`:""}`,onDragEnter:Np,onDragOver:Mp,onDragLeave:Fp,onDrop:Cp,children:[Kt&&Ge.rulersVisible&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"freeform-ruler freeform-ruler-x","data-testid":"freeform-ruler-x",title:i("按住拖动可拉出竖向参考线"),onPointerDown:a=>sc(a,"x",null),children:S1.map(a=>t.jsxs(p.Fragment,{children:[t.jsx("div",{className:`freeform-ruler-tick${a.label!==null?" major":""}`,style:{left:Kt.left+a.position*Kt.scale}}),a.label!==null&&t.jsx("div",{className:"freeform-ruler-label",style:{left:Kt.left+a.position*Kt.scale},children:a.label})]},a.position))}),t.jsx("div",{className:"freeform-ruler freeform-ruler-y","data-testid":"freeform-ruler-y",title:i("按住拖动可拉出横向参考线"),onPointerDown:a=>sc(a,"y",null),children:v1.map(a=>t.jsxs(p.Fragment,{children:[t.jsx("div",{className:`freeform-ruler-tick${a.label!==null?" major":""}`,style:{top:Kt.top+a.position*Kt.scale}}),a.label!==null&&t.jsx("div",{className:"freeform-ruler-label",style:{top:Kt.top+a.position*Kt.scale},children:a.label})]},a.position))}),t.jsx("div",{className:"freeform-ruler-corner","aria-hidden":"true"})]}),t.jsx("div",{ref:da,className:`freeform-stage-scroll${be?" space-panning":q?" space-pan-ready":""}`,"aria-busy":we===null,onScroll:ps,onPointerDownCapture:Qp,onContextMenu:e1,children:we!==null&&t.jsx("div",{className:"freeform-stage-box",style:{width:m.width*we,height:m.height*we},children:t.jsxs("div",{ref:ua,className:"freeform-artboard","data-testid":"freeform-canvas","data-active-group-path":M.join("/"),onPointerDownCapture:t1,style:{width:m.width,height:m.height,transform:`scale(${we})`,background:Zh(m.background),"--freeform-artboard-inverse-scale":1/we},children:[t.jsxs("div",{className:"freeform-artwork-clip",onPointerDown:n1,children:[t.jsx(Xh,{slide:m,scopeGeneration:wt.current,onDecodeReport:Zd}),t.jsx(qh,{nodes:m.nodes,slideId:m.id,scopeGeneration:wt.current,onImageDecodeReport:Zd,hiddenImageContentPathKey:k1,activeParentPath:M,selectedPaths:xe,onNodePointerDown:Yp,onNodeDoubleClick:Zp,onTextChange:(a,u)=>{const y=xa(m.nodes,M,a);!y||ye(y)!==ye(a)||Ve({type:"node/update-content",slideId:m.id,updates:[{path:a,patch:{text:u}}]})},onTextFocus:a=>{const u=xa(m.nodes,M,a);u&&dt([u[u.length-1]])},onTextSelectionChange:(a,u)=>{mi(u?{path:a,start:u.start,end:u.end}:null)}}),Wr&&t.jsx("div",{className:"freeform-ui-only freeform-marquee",style:{left:Math.min(Wr.x,Wr.x+Wr.width),top:Math.min(Wr.y,Wr.y+Wr.height),width:Math.abs(Wr.width),height:Math.abs(Wr.height)}}),zl.map(a=>t.jsx("div",{className:`freeform-ui-only freeform-snap-line freeform-snap-line-${a.axis} freeform-snap-source-${a.source}`,"data-testid":"freeform-snap-line",style:a.axis==="x"?{left:a.position}:{top:a.position}},`${a.axis}-${a.position}-${a.source}`)),as&&t.jsx("div",{className:"freeform-ui-only freeform-space-badge","data-testid":"freeform-space-badge","data-space-axis":as.axis,style:{top:8/we,fontSize:12/we},children:i("间距 {n}",{n:Math.round(as.gap)})}),Rl.map((a,u)=>t.jsx("div",{className:"freeform-ui-only freeform-measurement","data-testid":"freeform-measurement","data-measurement-axis":a.axis,"data-measurement-side":a.side,"data-measurement-source":a.source,style:a.axis==="x"?{left:Math.min(a.from,a.to),top:a.at,width:Math.max(Math.abs(a.to-a.from),1/we),height:1/we}:{left:a.at,top:Math.min(a.from,a.to),width:1/we,height:Math.max(Math.abs(a.to-a.from),1/we)},children:t.jsx("span",{className:"freeform-ui-only freeform-measurement-label","data-testid":"freeform-measurement-label",style:{fontSize:11/we},children:a.distance})},`${a.axis}-${a.side}-${u}`)),(Ge.guidesVisible?m.guides??[]:[]).filter(a=>(Vt==null?void 0:Vt.guideId)!==a.id).map(a=>t.jsx("div",{className:`freeform-ui-only freeform-guide freeform-guide-${a.axis}`,"data-testid":"freeform-guide","data-guide-axis":a.axis,title:i("拖动参考线,拖出页面删除;双击移除"),onPointerDown:u=>sc(u,a.axis,a.id),style:Wh(a.axis,a.position,we),children:t.jsx("div",{className:"freeform-guide-hit",style:a.axis==="x"?{width:8/we}:{height:8/we}})},a.id)),Vt&&t.jsx("div",{className:`freeform-ui-only freeform-guide-ghost freeform-guide-${Vt.axis}${Bu?"":" freeform-guide-invalid"}${Vt.target?" is-snapped":""}`,"data-testid":"freeform-guide-dragging",style:Wh(Vt.axis,Vt.position,we)}),Vt&&Bu&&t.jsx("span",{className:`freeform-ui-only freeform-guide-readout${Vt.target?" is-snapped":""}`,"data-testid":"freeform-guide-readout",style:Vt.axis==="x"?{left:Vt.position+6/we,top:8/we,fontSize:11/we}:{left:8/we,top:Vt.position+6/we,fontSize:11/we},children:Vt.target==="page-center"?i("居中 · {position}",{position:Math.round(Vt.position)}):Math.round(Vt.position)})]}),_&&cc&&Ou&&Nn.renderDraft&&t.jsx(v0,{ref:Nn.overlayRef,draft:Nn.renderDraft,worldMatrix:_.startWorldMatrix,screenScale:Ou,resolvedSrc:_.resolvedSrc,alt:_.startNode.alt,onImagePointerDown:Nn.panPointerDown,onImageError:ip,onHandlePointerDown:(a,u)=>Nn.handlePointerDown(u,a),onHandleKeyDown:(a,u)=>Nn.handleKeyDown(u,a),onKeyDown:Nn.overlayKeyDown}),yn&&Xt&&Hu&&t.jsxs("div",{ref:je,className:`freeform-ui-only freeform-framing-surface${w1}`,"data-testid":"freeform-framing-surface","data-framing-focus-x":Xt.target.framing.focusX,"data-framing-focus-y":Xt.target.framing.focusY,"data-framing-zoom":Xt.target.framing.zoom,role:"application","aria-label":i("调整图片取景"),tabIndex:0,style:{...Hu,...Xt.target.clipPath?{clipPath:Xt.target.clipPath}:{}},onPointerDown:cp,children:[t.jsx("span",{className:"freeform-framing-third freeform-framing-third-v first","aria-hidden":"true"}),t.jsx("span",{className:"freeform-framing-third freeform-framing-third-v second","aria-hidden":"true"}),t.jsx("span",{className:"freeform-framing-third freeform-framing-third-h first","aria-hidden":"true"}),t.jsx("span",{className:"freeform-framing-third freeform-framing-third-h second","aria-hidden":"true"})]}),!yn&&!_&&t.jsx(hj,{nodes:m.nodes,selectedPaths:xe,renderScale:we,activeInteraction:bi,interactive:!Wt&&!tn,badge:no,onMovePointerDown:(a,u)=>vu(a,u.nodeIds[0],u.nodeIds),onResizePointerDown:s1,onRotatePointerDown:l1,onVertexPointerDown:r1,onVertexDoubleClick:i1,onShapeParamPointerDown:a1,onTableColumnPointerDown:o1})]})})}),to&&t.jsx("div",{className:"freeform-drop-overlay","data-testid":"freeform-drop-overlay","aria-hidden":"true",children:t.jsxs("div",{children:[t.jsx(pr,{}),t.jsx("b",{children:i("松开,把图片放进这一页")})]})})]}),Xt&&t.jsxs("div",{className:"freeform-framing-zoom",role:"group","aria-label":i("图片缩放"),children:[t.jsx("button",{type:"button","aria-label":i("缩小图片"),title:i("缩小图片"),"data-testid":"freeform-framing-zoom-out",disabled:Xt.target.framing.zoom<=Ps,onClick:()=>Yl(Xt.target.framing.zoom-.1),children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M4 10h12"})})}),t.jsx("input",{type:"range",min:Ps*100,max:Ki*100,step:"1",value:Math.round(Xt.target.framing.zoom*100),"data-testid":"freeform-framing-zoom","aria-label":i("图片缩放比例"),onChange:a=>Yl(Number(a.currentTarget.value)/100)}),t.jsxs("output",{children:[Math.round(Xt.target.framing.zoom*100),"%"]}),t.jsx("button",{type:"button","aria-label":i("放大图片"),title:i("放大图片"),"data-testid":"freeform-framing-zoom-in",disabled:Xt.target.framing.zoom>=Ki,onClick:()=>Yl(Xt.target.framing.zoom+.1),children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M10 4v12M4 10h12"})})})]}),!_&&!yn&&t.jsx(tj,{zoomPercent:H,canZoomOut:H>D0,canZoomIn:H<A0,onZoomOut:()=>P(a=>Yr(a-qo)),onZoomIn:()=>P(a=>Yr(a+qo)),onFit:()=>P(Oi)})]}),Ge.panelOpen&&t.jsxs($5,{propertiesTabRef:Ad,disabled:Mi,activeTab:Xn,onTabChange:Js,onClose:()=>qn({panelOpen:!1}),layers:t.jsx(I5,{nodes:m.nodes,selectedPaths:xe,hasStructuralLockedSelection:!!(Wt||tn),onSelect:Op,onRename:_p,onReorder:Bp,onDropReorder:Kp,onSetLocked:Ni,onSetHidden:ju,onGroup:Eo,onUngroup:zo}),history:t.jsx("div",{className:"freeform-history-panel","data-testid":"freeform-history-panel","data-history-count":ss.length,children:t.jsx("ol",{className:"freeform-history-list","aria-label":i("编辑历史"),children:ss.map(a=>{const{kind:u,index:y}=a;return u==="current"?t.jsx("li",{children:t.jsxs("div",{className:"freeform-history-item is-current","data-testid":"freeform-history-item","data-history-kind":"current",children:[t.jsx("span",{className:"freeform-history-label",children:i(a.label)}),t.jsx("span",{className:"freeform-history-state",children:i("当前")})]})},a.key):t.jsx("li",{children:t.jsxs("button",{type:"button",className:"freeform-history-item","data-testid":"freeform-history-item","data-history-kind":u,"data-history-index":y,title:u==="past"?i("撤销到这一步"):i("重做到这一步"),onClick:()=>Vp(u,y),children:[t.jsx("span",{className:"freeform-history-label",children:i(a.label)}),t.jsx("span",{className:"freeform-history-state",children:u==="past"?i("撤销"):i("重做")})]})},a.key)})})}),children:[t.jsxs("div",{className:"freeform-panel-head",children:[t.jsx("span",{children:i("属性")}),(ut||M.length>0)&&t.jsxs("nav",{className:"freeform-inspector-breadcrumb","aria-label":ut?i("对象路径"):i("编辑范围"),"data-testid":ut?void 0:"freeform-scope-breadcrumb",title:(ut?[...ut.breadcrumbs.map(el),Ir(ut.node.name)]:Ud.map(el)).join(" / "),children:[((ut==null?void 0:ut.breadcrumbs)??Ud).map((a,u)=>t.jsxs("span",{title:el(a),children:[u>0&&t.jsx("span",{className:"freeform-inspector-breadcrumb-separator","aria-hidden":"true",children:"/"}),el(a)]},ye(a.path))),ut&&t.jsxs("span",{className:"freeform-inspector-breadcrumb-current",title:Ir(ut.node.name),children:[t.jsx("span",{className:"freeform-inspector-breadcrumb-separator","aria-hidden":"true",children:"/"}),Ir(ut.node.name)]})]})]}),wi.length===0?t.jsx(t.Fragment,{children:t.jsxs(kn,{title:i("页面"),testId:"inspector-page",children:[t.jsxs("label",{className:"field",children:[t.jsx("span",{className:"field-label",children:i("页面名称")}),t.jsx("input",{className:"text-input",value:j0(m.name)?Rs(m.name,j):m.name,onChange:a=>Ve({type:"slide/update",slideId:m.id,patch:{name:a.currentTarget.value}})})]}),t.jsx("div",{"data-testid":"page-background-paint",children:t.jsx(Uo,{label:i("背景"),value:m.background.type==="pattern"?{type:"solid",color:m.background.color}:m.background,modes:["solid","linear-gradient","radial-gradient","transparent","image"],fallbackPaint:Oc,onChange:a=>vr(m.id,a),onChooseImage:()=>{var a;return(a=ho.current)==null?void 0:a.click()},onClearImage:()=>vr(m.id,{...Oc}),onImageFitChange:a=>{m.background.type==="image"&&vr(m.id,{...m.background,fit:a})},onAdjustImageFraming:()=>{op()},onResetImageFraming:()=>{m.background.type!=="image"||!Gd||vr(m.id,{...m.background,framing:zr()})},imageFramingDisabled:!B0,imageFramingDisabledReason:Vd??void 0,imageFramingResetDisabled:!Gd})}),t.jsx("div",{className:"field-label with-gap",children:i("背景图案")}),t.jsxs("div",{className:"seg stretch",role:"group","aria-label":i("背景图案"),children:[t.jsx("button",{type:"button",className:m.background.type!=="pattern"?"seg-btn on":"seg-btn","data-testid":"page-pattern-none",onClick:()=>{m.background.type==="pattern"&&vr(m.id,{type:"solid",color:m.background.color})},children:i("无")}),hg.map(a=>t.jsx("button",{type:"button",className:m.background.type==="pattern"&&m.background.pattern===a?"seg-btn on":"seg-btn","data-testid":`page-pattern-${a}`,onClick:()=>vr(m.id,pg(m.background,a)),children:i(mg[a])},a))]}),m.background.type==="pattern"&&(a=>t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"paint-row","data-testid":"page-pattern-colors",children:[t.jsx(vt,{label:i("底色"),color:a.color,onChange:u=>vr(m.id,{...a,color:u})}),t.jsx(vt,{label:i("图案色"),color:a.patternColor,onChange:u=>vr(m.id,{...a,patternColor:u})})]}),t.jsx("div",{className:"field-label with-gap",children:i("密度")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("密度"),children:gg.map(u=>t.jsx("button",{type:"button",className:a.size===u?"seg-btn on":"seg-btn","data-testid":`page-pattern-size-${u}`,onClick:()=>vr(m.id,{...a,size:u}),children:i(xg[u])},u))})]}))(m.background),t.jsx("input",{ref:ho,className:"freeform-file",type:"file",accept:"image/*","data-testid":"page-background-input",onChange:a=>{Pp(a.currentTarget.files)}})]})}):t.jsxs(t.Fragment,{children:[Wt&&t.jsxs("div",{className:"freeform-lock-banner","data-testid":"freeform-lock-banner",role:"note","aria-label":i("锁定状态"),children:[t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[t.jsx("rect",{x:"4",y:"8",width:"12",height:"9",rx:"2"}),t.jsx("path",{d:"M7 8V6a3 3 0 0 1 6 0v2"})]}),t.jsxs("div",{className:"freeform-lock-banner-copy",children:[t.jsx("strong",{children:i("已锁定")}),t.jsx("span",{children:i("锁定来源:{name}",{name:Wt.unlockName})})]}),t.jsxs("button",{className:"ghost freeform-lock-banner-action",type:"button","aria-label":i("解锁 {name}",{name:Wt.unlockName}),title:i("解锁 {name}",{name:Wt.unlockName}),onClick:()=>{Ni(Wt.unlockPath,!1)&&requestAnimationFrame(()=>{var a;return(a=Ad.current)==null?void 0:a.focus()})},children:[t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[t.jsx("rect",{x:"4",y:"8",width:"12",height:"9",rx:"2"}),t.jsx("path",{d:"M7 8V6a3 3 0 0 1 5.7-1.3"})]}),t.jsx("span",{children:i("解锁")})]})]}),!Wt&&tn&&t.jsxs("div",{className:"freeform-lock-descendant-banner","data-testid":"freeform-lock-descendant-banner",role:"note","aria-label":i("包含锁定图层"),children:[t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[t.jsx("rect",{x:"4",y:"8",width:"12",height:"9",rx:"2"}),t.jsx("path",{d:"M7 8V6a3 3 0 0 1 6 0v2"})]}),t.jsxs("div",{className:"freeform-lock-banner-copy",children:[t.jsx("strong",{children:i("包含锁定图层")}),t.jsx("span",{children:i("锁定来源:{name},请先在图层面板解锁",{name:tn.sourceName})})]})]}),!Ta&&Yd&&t.jsxs("div",{className:"freeform-align-bar","data-testid":"freeform-align-bar",role:"toolbar","aria-label":i("对齐与分布"),children:[d8.map(a=>t.jsx("button",{type:"button",className:"align-bar-btn","data-testid":`freeform-align-${a.testId}`,"aria-label":i(a.label),title:i(a.label),onClick:()=>wu(a.id),children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:a.icon})})},a.id)),t.jsx("span",{className:"align-bar-separator","aria-hidden":"true"}),t.jsx("button",{type:"button",className:"align-bar-btn","data-testid":"freeform-distribute-h","aria-label":i("水平均分"),title:i("水平均分"),disabled:xe.length<3,onClick:()=>ac("horizontal"),children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M4 4v12M16 4v12M8.5 7h3v6h-3z"})})}),t.jsx("button",{type:"button",className:"align-bar-btn","data-testid":"freeform-distribute-v","aria-label":i("垂直均分"),title:i("垂直均分"),disabled:xe.length<3,onClick:()=>ac("vertical"),children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M4 4h12M4 16h12M7 8.5h6v3H7z"})})})]}),!Ta&&wi.length===1&&ut&&t.jsxs(t.Fragment,{children:[t.jsxs(kn,{title:i("位置与尺寸"),testId:"inspector-geometry",children:[t.jsxs("div",{className:"field-grid",children:[t.jsxs("label",{children:[t.jsx("span",{className:"field-glyph","aria-hidden":"true",children:ut.kind==="group"?i("中心 X"):"X"}),t.jsx(Ct,{ariaLabel:ut.kind==="group"?i("中心 X"):"X",resetKey:Bt,value:ut.x,onCommit:a=>Hr({property:"x",value:a})})]}),t.jsxs("label",{children:[t.jsx("span",{className:"field-glyph","aria-hidden":"true",children:ut.kind==="group"?i("中心 Y"):"Y"}),t.jsx(Ct,{ariaLabel:ut.kind==="group"?i("中心 Y"):"Y",resetKey:Bt,value:ut.y,onCommit:a=>Hr({property:"y",value:a})})]}),t.jsxs("label",{title:i("宽"),children:[t.jsx("span",{className:"field-glyph","aria-hidden":"true",children:"W"}),t.jsx(Ct,{ariaLabel:i("宽"),min:Number.MIN_VALUE,resetKey:Bt,value:ut.width,onCommit:a=>Hr({property:"width",value:a})})]}),t.jsxs("label",{title:i("高"),children:[t.jsx("span",{className:"field-glyph","aria-hidden":"true",children:"H"}),t.jsx(Ct,{ariaLabel:i("高"),min:Number.MIN_VALUE,resetKey:Bt,value:ut.height,onCommit:a=>Hr({property:"height",value:a})})]}),t.jsxs("label",{title:i("旋转"),children:[t.jsx(zn,{name:"rotate"}),t.jsx(Ct,{ariaLabel:i("旋转"),resetKey:Bt,value:ut.rotation,onCommit:a=>Hr({property:"rotation",value:a})}),t.jsx("span",{className:"field-suffix","aria-hidden":"true",children:"°"})]}),ut.kind==="group"&&t.jsxs("label",{title:i("缩放 %"),children:[t.jsx("span",{className:"field-glyph","aria-hidden":"true",children:"%"}),t.jsx(Ct,{ariaLabel:i("缩放 %"),min:Number.MIN_VALUE,resetKey:Bt,value:ut.scalePercent,onCommit:a=>Hr({property:"scalePercent",value:a})})]})]}),(Ja(C)||wa(C)||ei(C))&&t.jsxs("div",{className:"flip-row with-gap","data-testid":"flip-row",children:[t.jsx("button",{type:"button",className:"ghost","data-testid":"flip-x","aria-pressed":C.flipX===!0,onClick:()=>qd({flipX:C.flipX!==!0}),children:i("水平翻转")}),t.jsx("button",{type:"button",className:"ghost","data-testid":"flip-y","aria-pressed":C.flipY===!0,onClick:()=>qd({flipY:C.flipY!==!0}),children:i("垂直翻转")})]}),wa(C)&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"field-label with-gap",children:i("形状")}),t.jsx("div",{className:"seg stretch",children:Rd.map(a=>t.jsxs("button",{type:"button",className:C.shape===a.id?"seg-btn on":"seg-btn",onClick:()=>he({shape:a.id}),title:i(a.label),children:[t.jsx(_i,{shape:a.id,className:"seg-shape-icon"}),t.jsx("span",{className:"sr-only",children:i(a.label)})]},a.id))}),t.jsxs("div",{className:"field-grid with-gap","data-testid":"shape-dash-field",children:[t.jsxs("label",{title:i("虚线"),children:[t.jsx(zn,{name:"dash"}),t.jsx(Ct,{ariaLabel:i("虚线"),min:0,max:500,resetKey:Bt,value:C.strokeDash??0,onCommit:a=>he({strokeDash:a>0?a:null})})]}),t.jsx("button",{className:"ghost",type:"button","data-testid":"shape-dash-clear",disabled:C.strokeDash===void 0,onClick:()=>he({strokeDash:null}),children:i("实线")})]})]})]}),_n(C)&&t.jsxs(kn,{title:i("文字"),testId:"inspector-typography",children:[t.jsxs("label",{className:"field",children:[t.jsx("span",{className:"field-label",children:i("文本")}),t.jsx("textarea",{className:"freeform-inspector-text",value:C.text,onChange:a=>Ht({text:a.currentTarget.value})})]}),t.jsxs("label",{className:"field",children:[t.jsx("span",{className:"field-label",children:i("字体")}),t.jsx(qr,{value:Id(C.fontFamily),onChange:a=>{if(a===rd){pu();return}cf(C.text,a,[C.fontWeight]).catch(()=>{});const u=C.fontFamily;he({fontFamily:a})&&u!==a&&xo({from:u,to:a})},title:i("字体"),testId:"freeform-font-select",previewFonts:!0,options:u0(H0,{current:C.fontFamily,withImport:!0})})]}),ha&&ha.to===C.fontFamily&&q0.has(ha.from)&&t.jsx("button",{type:"button",className:"freeform-font-swap","data-testid":"freeform-font-swap",title:i("把整套里用「{from}」的文字都换成「{to}」",{from:Os(ha.from),to:Os(ha.to)}),onClick:()=>{go({fonts:{[ha.from]:ha.to}}),xo(null)},children:i("全部替换")}),t.jsxs("div",{className:"field-grid three",children:[t.jsxs("label",{title:i("字号"),children:[t.jsx(zn,{name:"font-size"}),t.jsx(Ct,{ariaLabel:i("字号"),min:Number.MIN_VALUE,max:Number.MAX_VALUE,resetKey:Bt,value:ut.kind==="leaf"?ut.fontSize??C.fontSize:C.fontSize,onCommit:a=>Hr({property:"fontSize",value:a})})]}),t.jsxs("label",{title:i("行高"),children:[t.jsx(zn,{name:"line-height"}),t.jsx(Ct,{ariaLabel:i("行高"),min:.5,max:4,resetKey:Bt,value:C.lineHeight??1.18,onCommit:a=>he({lineHeight:a})})]}),t.jsxs("label",{title:i("字距"),children:[t.jsx(zn,{name:"letter-spacing"}),t.jsx(Ct,{ariaLabel:i("字距"),min:-50,max:200,resetKey:Bt,value:C.letterSpacing??0,onCommit:a=>he({letterSpacing:a})})]})]}),t.jsx("div",{className:"field-label with-gap",children:i("对齐与字型")}),t.jsxs("div",{className:"text-style-row",children:[t.jsx("div",{className:"seg stretch",children:h8.map(a=>t.jsx("button",{type:"button",className:C.align===a.id?"seg-btn on":"seg-btn","aria-label":i(a.label),title:i(a.label),"aria-pressed":C.align===a.id,onClick:()=>he({align:a.id}),children:t.jsx("svg",{className:"seg-icon",viewBox:"0 0 16 16","aria-hidden":"true",children:t.jsx("path",{d:a.icon})})},a.id))}),t.jsxs("div",{className:"seg stretch",children:[t.jsx("button",{type:"button",className:C.fontWeight==="bold"?"seg-btn on":"seg-btn","data-testid":"text-weight-toggle","aria-pressed":C.fontWeight==="bold"?"true":"false","aria-label":i("粗体"),title:i("粗体"),onClick:()=>he({fontWeight:C.fontWeight==="bold"?"normal":"bold"}),children:t.jsx("b",{className:"seg-glyph","aria-hidden":"true",children:"B"})}),t.jsx("button",{type:"button",className:C.italic?"seg-btn on":"seg-btn","data-testid":"text-italic-toggle","aria-pressed":C.italic?"true":"false","aria-label":i("斜体"),title:i("斜体"),onClick:()=>he({italic:!C.italic}),children:t.jsx("i",{className:"seg-glyph","aria-hidden":"true",children:"I"})}),t.jsx("button",{type:"button",className:C.vertical?"seg-btn on":"seg-btn","data-testid":"text-vertical-toggle","aria-pressed":C.vertical?"true":"false","aria-label":i("竖排"),title:i("竖排"),onClick:()=>he({vertical:!C.vertical}),children:t.jsx("svg",{className:"seg-icon",viewBox:"0 0 16 16","aria-hidden":"true",children:t.jsx("path",{d:"M10.5 2.5v11M8 11l2.5 2.5L13 11M3 3.5h4M5 3.5v6.5"})})})]})]}),t.jsx("div",{className:"field-label with-gap",children:i("段落")}),t.jsxs("div",{className:"text-style-row",children:[t.jsx("div",{className:"seg stretch","data-testid":"text-vertical-align",children:m8.map(a=>{const u=(C.verticalAlign??"top")===a.id;return t.jsx("button",{type:"button",className:u?"seg-btn on":"seg-btn","aria-label":i(a.label),title:i(a.label),"aria-pressed":u,onClick:()=>he({verticalAlign:a.id}),children:t.jsx("svg",{className:"seg-icon",viewBox:"0 0 16 16","aria-hidden":"true",children:t.jsx("path",{d:a.icon})})},a.id)})}),t.jsx("div",{className:"seg stretch","data-testid":"text-list",children:p8.map(a=>{const u=(C.list??"none")===a.id;return t.jsx("button",{type:"button",className:u?"seg-btn on":"seg-btn","aria-label":i(a.label),title:i(a.label),"aria-pressed":u,onClick:()=>he({list:a.id==="none"?null:a.id}),children:t.jsx("svg",{className:"seg-icon",viewBox:"0 0 16 16","aria-hidden":"true",children:t.jsx("path",{d:a.icon})})},a.id)})})]}),t.jsx("div",{className:"field-grid three with-gap",children:t.jsxs("label",{title:i("段间距"),children:[t.jsx(zn,{name:"paragraph-spacing"}),t.jsx(Ct,{ariaLabel:i("段间距"),min:0,max:1e3,resetKey:Bt,value:C.paragraphSpacing??0,onCommit:a=>he({paragraphSpacing:a})})]})}),t.jsx("div",{className:"field-label with-gap",children:i("描边")}),t.jsxs("div",{className:"paint-row","data-testid":"text-stroke-field",children:[t.jsx(vt,{label:i("描边颜色"),color:C.stroke??"#18181b",onChange:a=>he({stroke:a,strokeWidth:C.strokeWidth??2})}),t.jsx("input",{className:"paint-hex",value:C.stroke??"",placeholder:i("无"),onChange:a=>{rr(a.currentTarget.value)&&he({stroke:a.currentTarget.value,strokeWidth:C.strokeWidth??2})},"aria-label":i("描边 hex")}),t.jsx(Ct,{ariaLabel:i("描边宽度"),min:.5,max:100,resetKey:Bt,value:C.strokeWidth??2,onCommit:a=>he({strokeWidth:a,...C.stroke?{}:{stroke:"#18181b"}})}),t.jsx("button",{type:"button",className:"ghost inspector-icon-btn","data-testid":"text-stroke-clear","aria-label":i("清除描边"),title:i("清除描边"),onClick:()=>he({stroke:null,strokeWidth:null}),children:t.jsx(Pn,{})})]})]}),_n(C)&&t.jsx(kn,{title:i("效果"),testId:"inspector-text-effect",children:t.jsx(X6,{effect:C.effect,textColor:C.textFill.type==="solid"?C.textFill.color:oi(C.textFill),resetKey:Bt,onChange:a=>he({effect:a})})}),_n(C)&&(Mn||(((Gu=C.spans)==null?void 0:Gu.length)??0)>0)&&t.jsxs(kn,{title:i("文字片段"),testId:"inspector-rich-spans",children:[Mn&&t.jsxs("div",{className:"rich-span-apply","data-testid":"rich-span-apply",children:[t.jsx("span",{className:"rich-span-hint",children:i("已选 {n} 字",{n:Mn.end-Mn.start})}),t.jsx("button",{className:"ghost",type:"button","data-testid":"rich-span-bold","aria-pressed":Qd,onMouseDown:a=>a.preventDefault(),onClick:()=>Oa(({bold:a,...u})=>Qd?u:{...u,bold:!0}),children:i("加粗")}),t.jsx("button",{className:"ghost",type:"button","data-testid":"rich-span-underline","aria-pressed":Jd,onMouseDown:a=>a.preventDefault(),onClick:()=>Oa(({underline:a,...u})=>Jd?u:{...u,underline:!0}),children:i("下划线")}),t.jsx("button",{className:"ghost",type:"button","data-testid":"rich-span-strike","aria-pressed":eu,onMouseDown:a=>a.preventDefault(),onClick:()=>Oa(({strike:a,...u})=>eu?u:{...u,strike:!0}),children:i("删除线")}),t.jsxs("div",{className:"rich-span-size","data-testid":"rich-span-size",children:[t.jsx("button",{className:"ghost",type:"button","aria-label":i("缩小所选文字"),title:i("缩小所选文字"),"data-testid":"rich-span-size-down",onMouseDown:a=>a.preventDefault(),onClick:()=>tu(-1),children:"A−"}),t.jsx("span",{className:"rich-span-size-value","aria-label":i("所选文字字号"),children:Kl}),t.jsx("button",{className:"ghost",type:"button","aria-label":i("放大所选文字"),title:i("放大所选文字"),"data-testid":"rich-span-size-up",onMouseDown:a=>a.preventDefault(),onClick:()=>tu(1),children:"A+"})]}),t.jsx("button",{className:"ghost",type:"button","data-testid":"rich-span-clear",onMouseDown:a=>a.preventDefault(),onClick:()=>Oa(()=>({})),children:i("清除样式")}),t.jsxs("div",{className:"rich-span-swatches",children:[t.jsx("span",{className:"rich-span-label",children:i("标色")}),pw.map(a=>t.jsx("button",{className:"rich-span-swatch",type:"button","aria-label":i("标色 {color}",{color:a}),title:a,style:{background:a},onMouseDown:u=>u.preventDefault(),onClick:()=>Oa(u=>({...u,color:a}))},a))]}),t.jsxs("div",{className:"rich-span-swatches",children:[t.jsx("span",{className:"rich-span-label",children:i("高亮")}),gw.map(a=>t.jsx("button",{className:"rich-span-swatch is-highlight",type:"button","aria-label":i("高亮 {color}",{color:a}),title:a,style:{background:a},onMouseDown:u=>u.preventDefault(),onClick:()=>Oa(u=>({...u,highlight:a}))},a))]})]}),C.spans&&C.spans.length>0&&t.jsx("ul",{className:"rich-span-list","data-testid":"rich-span-list",children:C.spans.map((a,u)=>t.jsxs("li",{children:[t.jsx("span",{className:"rich-span-range",title:C.text.slice(a.start,a.end),children:C.text.slice(a.start,a.end)}),a.bold&&t.jsx("span",{className:"rich-span-chip",children:i("加粗")}),a.color&&t.jsx("span",{className:"rich-span-chip",style:{color:a.color},children:i("标色")}),a.highlight&&t.jsx("span",{className:"rich-span-chip is-highlight",style:{background:a.highlight},children:i("高亮")}),a.underline&&t.jsx("span",{className:"rich-span-chip is-underline",children:i("下划线")}),a.strike&&t.jsx("span",{className:"rich-span-chip is-strike",children:i("删除线")}),a.fontSize!==void 0&&t.jsx("span",{className:"rich-span-chip",children:i("字号 {n}",{n:a.fontSize})}),t.jsx("button",{className:"draft-del",type:"button","aria-label":i("删除文字片段"),onClick:()=>np(u),children:i("删除")})]},`${a.start}-${a.end}-${u}`))})]}),Lc(C)&&ki&&t.jsxs(kn,{title:i("图表"),testId:"inspector-chart",children:[t.jsx("div",{className:"field-label",children:i("类型")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("图表类型"),children:Jw.map(a=>t.jsx("button",{type:"button",className:C.chartKind===a?"seg-btn on":"seg-btn","data-testid":`chart-kind-${a}`,onClick:()=>he({chartKind:a}),children:i(r8[a])},a))}),C.chartKind==="bar"&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"field-label with-gap",children:i("堆叠方式")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("堆叠方式"),children:e8.map(a=>t.jsx("button",{type:"button",className:(C.barMode??"grouped")===a?"seg-btn on":"seg-btn","data-testid":`chart-bar-mode-${a}`,onClick:()=>he({barMode:a==="grouped"?null:a}),children:i(t8[a])},a))})]}),t.jsx("div",{className:"field-label with-gap",children:i("配色")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("配色"),children:o8.map(a=>t.jsx("button",{type:"button",className:"seg-btn","data-testid":`chart-palette-${a.id}`,title:i(a.label),onClick:()=>Ht({series:C.series.map((u,y)=>({...u,color:a.colors[y]??u.color}))}),children:i(a.label)},a.id))}),t.jsxs("div",{className:"paint-row with-gap","data-testid":"chart-ink-colors",children:[t.jsx(vt,{label:i("墨色"),color:C.ink??"#3f3f46",testId:"chart-ink-color",onChange:a=>he({ink:a})}),C.ink!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"chart-ink-reset",onClick:()=>he({ink:null}),children:i("恢复默认")})]}),t.jsx("div",{className:"field-label with-gap",children:i("系列")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("系列"),children:C.series.map((a,u)=>{var y;return t.jsx("button",{type:"button",className:u===Pa?"seg-btn on":"seg-btn","data-testid":`chart-series-${u}`,onClick:()=>K(u),children:((y=a.name)==null?void 0:y.trim())||i("第 {n} 系列",{n:u+1})},u)})}),t.jsxs("div",{className:"paint-row with-gap","data-testid":"chart-series-style",children:[t.jsx("input",{type:"text",className:"qr-payload-input",maxLength:12,value:ki.name??"",placeholder:i("第 {n} 系列",{n:Pa+1}),"aria-label":i("系列名称"),"data-testid":"chart-series-name",onChange:a=>{const u=a.currentTarget.value.trim(),y=C.series.map((S,E)=>E===Pa?{...S,...u?{name:a.currentTarget.value}:{}}:S);Ht({series:y})}}),t.jsx(vt,{label:i("系列颜色"),color:ki.color,onChange:a=>Ht({series:C.series.map((u,y)=>y===Pa?{...u,color:a}:u)})}),C.series.length>1&&t.jsx("button",{type:"button",className:"ghost","data-testid":"chart-series-remove",onClick:()=>{Ht({series:C.series.filter((a,u)=>u!==Pa)}),K(0)},children:i("删除系列")})]}),C.series.length<bg&&t.jsx("button",{type:"button",className:"ghost chart-series-add","data-testid":"chart-series-add",onClick:()=>{Ht({series:[...C.series,{values:C.labels.map(()=>0),color:n8(C.series.map(a=>a.color))}]}),K(C.series.length)},children:i("添加系列")}),t.jsx("div",{className:"field-label with-gap",children:i("数据")}),t.jsx("div",{className:"chart-data-rows","data-testid":"chart-data-rows",children:C.labels.map((a,u)=>t.jsxs("div",{className:"chart-data-row",children:[t.jsx("input",{type:"text",maxLength:24,value:a,"aria-label":i("第 {n} 项标签",{n:u+1}),onChange:y=>{const S=[...C.labels];S[u]=y.currentTarget.value,yg(S,ki.values)&&Ht({labels:S})}}),t.jsx("input",{type:"number",min:0,step:"any",value:String(ki.values[u]),"aria-label":i("第 {n} 项数值",{n:u+1}),onChange:y=>{const S=Number(y.currentTarget.value);if(!Number.isFinite(S)||S<0)return;const E=[...ki.values];E[u]=S,Ht({series:C.series.map((R,$)=>$===Pa?{...R,values:E}:R)})}}),C.labels.length>1&&t.jsx("button",{type:"button",className:"ghost chart-data-remove","aria-label":i("删除第 {n} 项",{n:u+1}),"data-testid":`chart-data-remove-${u}`,onClick:()=>Ht({labels:C.labels.filter((y,S)=>S!==u),series:C.series.map(y=>({...y,values:y.values.filter((S,E)=>E!==u)}))}),children:"×"})]},u))}),C.labels.length<jg&&t.jsx("button",{type:"button",className:"ghost chart-data-add","data-testid":"chart-data-add",onClick:()=>Ht({labels:[...C.labels,i("新增")],series:C.series.map(a=>({...a,values:[...a.values,0]}))}),children:i("添加一项")}),t.jsxs("div",{className:"chart-data-head",children:[t.jsx("span",{className:"field-label",children:i("粘贴数据")}),t.jsx("button",{type:"button",className:"ghost","data-testid":"chart-paste-data",title:i("每行「标签 数值…」,数值用空格、逗号或制表符分隔"),onClick:()=>{(async()=>{let a;try{a=await navigator.clipboard.readText()}catch{Ze(i("读取剪贴板失败,请重试"));return}const u=wg(a,C.series.length);if(!u){Ze(i("粘贴内容读不出数据:每行需要「标签 数值…」,数值为非负数字"));return}Ze(null),Ht({labels:u.labels,series:C.series.map((y,S)=>({...y,values:u.series[S]??y.values}))})})()},children:i("从剪贴板粘贴")})]}),t.jsx("div",{className:"field-label with-gap",children:i("数值标签")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("数值标签"),children:t.jsx("button",{type:"button",className:C.showValues===!0?"seg-btn on":"seg-btn","aria-pressed":C.showValues===!0,"data-testid":"chart-values-on",onClick:()=>he({showValues:C.showValues===!0?null:!0}),children:i("显示")})}),t.jsx("div",{className:"field-label with-gap",children:i("图例")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("图例"),children:a8.map(a=>t.jsx("button",{type:"button",className:(C.showLegend===void 0?"auto":C.showLegend?"on":"off")===a?"seg-btn on":"seg-btn","data-testid":`chart-legend-${a}`,onClick:()=>he({showLegend:a==="auto"?null:a==="on"}),children:i(i8[a])},a))}),(C.chartKind==="bar"||C.chartKind==="line")&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"field-label with-gap",children:i("轴刻度")}),t.jsxs("div",{className:"seg stretch",role:"group","aria-label":i("轴刻度"),children:[t.jsx("button",{type:"button",className:C.showTicks!==!1?"seg-btn on":"seg-btn","aria-pressed":C.showTicks!==!1,"data-testid":"chart-ticks-on",onClick:()=>he({showTicks:C.showTicks===!1?null:!1}),children:i("显示")}),t.jsx("button",{type:"button",className:C.showTicks===!1?"seg-btn on":"seg-btn","aria-pressed":C.showTicks===!1,"data-testid":"chart-ticks-off",onClick:()=>he({showTicks:!1}),children:i("隐藏")})]})]})]}),Xw(C)&&t.jsxs(kn,{title:i("表格"),testId:"inspector-table",children:[t.jsx("div",{className:"field-label",children:i("表头")}),t.jsxs("div",{className:"seg stretch",role:"group","aria-label":i("表头"),children:[t.jsx("button",{type:"button",className:C.headerRow!==!1?"seg-btn on":"seg-btn","aria-pressed":C.headerRow!==!1,"data-testid":"table-header-on",onClick:()=>he({headerRow:C.headerRow===!1?null:!1}),children:i("显示")}),t.jsx("button",{type:"button",className:C.headerRow===!1?"seg-btn on":"seg-btn","aria-pressed":C.headerRow===!1,"data-testid":"table-header-off",onClick:()=>he({headerRow:!1}),children:i("隐藏")})]}),t.jsx("div",{className:"field-label with-gap",children:i("斑马纹")}),t.jsxs("div",{className:"seg stretch",role:"group","aria-label":i("斑马纹"),children:[t.jsx("button",{type:"button",className:C.striped===!0?"seg-btn on":"seg-btn","aria-pressed":C.striped===!0,"data-testid":"table-striped-on",onClick:()=>he({striped:C.striped===!0?null:!0}),children:i("显示")}),t.jsx("button",{type:"button",className:C.striped!==!0?"seg-btn on":"seg-btn","aria-pressed":C.striped!==!0,"data-testid":"table-striped-off",onClick:()=>he({striped:null}),children:i("隐藏")})]}),t.jsx("div",{className:"field-label with-gap",children:i("格线")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("格线"),children:kg.map(a=>t.jsx("button",{type:"button",className:(C.grid??"all")===a?"seg-btn on":"seg-btn","aria-pressed":(C.grid??"all")===a,"data-testid":`table-grid-${a}`,onClick:()=>he({grid:a==="all"?null:a}),children:i(s8[a])},a))}),C.grid!=="none"&&t.jsxs("div",{className:"paint-row with-gap","data-testid":"table-lines",children:[t.jsx(vt,{label:i("格线颜色"),color:C.lineColor??C.ink??"#3f3f46",testId:"table-line-color",onChange:a=>he({lineColor:a})}),t.jsx(Ct,{ariaLabel:i("格线粗细"),min:vg,max:Sg,resetKey:Bt,value:C.lineWidth??1,onCommit:a=>he({lineWidth:a})}),(C.lineColor!==void 0||C.lineWidth!==void 0)&&t.jsx("button",{type:"button",className:"ghost","data-testid":"table-line-reset",onClick:()=>he({lineColor:null,lineWidth:null}),children:i("恢复默认")})]}),t.jsx("div",{className:"field-label with-gap",children:i("格子字号")}),t.jsxs("div",{className:"paint-row","data-testid":"table-font-size",children:[t.jsx(Ct,{ariaLabel:i("格子字号"),min:Mg,max:Ng,resetKey:Bt,value:C.fontSize??Fg(C.width,C.height,C.rows,C.cols,C.cells,C.colWidths),onCommit:a=>he({fontSize:a})}),C.fontSize!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"table-font-size-auto",onClick:()=>he({fontSize:null}),children:i("自动")})]}),t.jsx("div",{className:"field-label with-gap",children:i("颜色")}),t.jsxs("div",{className:"paint-row","data-testid":"table-colors",children:[t.jsx(vt,{label:i("墨色"),color:C.ink??"#3f3f46",testId:"table-ink-color",onChange:a=>he({ink:a})}),C.ink!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"table-ink-reset",onClick:()=>he({ink:null}),children:i("恢复默认")})]}),t.jsxs("div",{className:"paint-row with-gap","data-testid":"table-fills",children:[t.jsx(vt,{label:i("表头底色"),color:C.headerFill??"#3f3f46",testId:"table-header-color",onChange:a=>he({headerFill:a})}),C.headerFill!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"table-header-reset",onClick:()=>he({headerFill:null}),children:i("恢复默认")}),t.jsx(vt,{label:i("斑马纹底色"),color:C.stripeFill??"#3f3f46",testId:"table-stripe-color",onChange:a=>he({stripeFill:a})}),C.stripeFill!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"table-stripe-reset",onClick:()=>he({stripeFill:null}),children:i("恢复默认")})]}),t.jsx("div",{className:"field-label with-gap",children:i("行列")}),t.jsxs("div",{className:"table-size-row",role:"group","aria-label":i("行列"),children:[t.jsx("button",{type:"button",className:"ghost","data-testid":"table-row-add",disabled:C.rows>=df,onClick:()=>Ht({rows:C.rows+1}),children:i("加一行")}),t.jsx("button",{type:"button",className:"ghost","data-testid":"table-row-remove",disabled:C.rows<=2,onClick:()=>Ht({rows:C.rows-1}),children:i("减一行")}),t.jsx("button",{type:"button",className:"ghost","data-testid":"table-col-add",disabled:C.cols>=uf,onClick:()=>Ht({cols:C.cols+1}),children:i("加一列")}),t.jsx("button",{type:"button",className:"ghost","data-testid":"table-col-remove",disabled:C.cols<=1,onClick:()=>Ht({cols:C.cols-1}),children:i("减一列")})]}),t.jsx("div",{className:"field-label with-gap",children:i("单元格")}),t.jsx("div",{className:"table-cell-rows","data-testid":"table-cell-rows",children:Array.from({length:C.rows},(a,u)=>t.jsx("div",{className:"table-cell-row",children:Array.from({length:C.cols},(y,S)=>{const E=u*C.cols+S;return t.jsx("input",{type:"text",maxLength:Cg,"data-testid":`table-cell-${E}`,value:C.cells[E]??"","aria-label":i("第 {n} 行第 {m} 列",{n:u+1,m:S+1}),onChange:R=>{const $=R.currentTarget.value;if(!Eg($))return;const O=[...C.cells];O[E]=$,Ht({cells:O})}},E)})},u))}),t.jsx("button",{type:"button",className:"ghost table-paste","data-testid":"table-paste-data",onClick:()=>void(async()=>{let a;try{a=await navigator.clipboard.readText()}catch{Ze(i("读取剪贴板失败,请重试"));return}const u=zg(a);if(!u){Ze(i("粘贴内容读不出表格:每行需要用制表符、逗号或空格分隔的单元格"));return}const y=Math.min(uf,Math.max(...u.rows.map(R=>R.length))),S=u.rows.slice(0,df);for(;S.length<2;)S.push([]);const E=[];for(const R of S)for(let $=0;$<y;$+=1)E.push(R[$]??"");Ze(null),Ht({rows:S.length,cols:y,cells:E})})(),children:i("从剪贴板粘贴")})]}),qw(C)&&t.jsxs(kn,{title:i("时间线"),testId:"inspector-timeline",children:[t.jsx("div",{className:"field-label",children:i("方向")}),t.jsxs("div",{className:"seg stretch",role:"group","aria-label":i("方向"),children:[t.jsx("button",{type:"button",className:C.horizontal!==!0?"seg-btn on":"seg-btn","aria-pressed":C.horizontal!==!0,"data-testid":"timeline-direction-vertical",onClick:()=>he({horizontal:C.horizontal===!0?!1:null}),children:i("竖排")}),t.jsx("button",{type:"button",className:C.horizontal===!0?"seg-btn on":"seg-btn","aria-pressed":C.horizontal===!0,"data-testid":"timeline-direction-horizontal",onClick:()=>he({horizontal:!0}),children:i("横排")})]}),t.jsx("div",{className:"field-label with-gap",children:i("颜色")}),t.jsxs("div",{className:"paint-row","data-testid":"timeline-colors",children:[t.jsx(vt,{label:i("主线颜色"),color:C.accent??"#1d4ed8",testId:"timeline-accent-color",onChange:a=>he({accent:a})}),C.accent!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"timeline-accent-reset",onClick:()=>he({accent:null}),children:i("恢复默认")}),t.jsx(vt,{label:i("墨色"),color:C.ink??"#3f3f46",testId:"timeline-ink-color",onChange:a=>he({ink:a})}),C.ink!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"timeline-ink-reset",onClick:()=>he({ink:null}),children:i("恢复默认")})]}),t.jsx("div",{className:"field-label with-gap",children:i("条目")}),t.jsx("div",{className:"timeline-items","data-testid":"timeline-items",children:C.items.map((a,u)=>t.jsxs("div",{className:"timeline-item",children:[t.jsx("input",{type:"text",maxLength:Rg,value:a.label??"",placeholder:i("时间"),"aria-label":i("第 {n} 项时间",{n:u+1}),"data-testid":`timeline-item-label-${u}`,onChange:y=>{const S=y.currentTarget.value,E=C.items.map((R,$)=>$===u?{text:R.text,...S.trim()!==""?{label:S}:{}}:{text:R.text,..."label"in R?{label:R.label}:{}});Ht({items:E})}}),t.jsx("input",{type:"text",maxLength:Ig,value:a.text,"aria-label":i("第 {n} 项内容",{n:u+1}),"data-testid":`timeline-item-text-${u}`,onChange:y=>{const S=y.currentTarget.value;if(!Lg(S))return;const E=C.items.map((R,$)=>$===u?{...R,text:S}:R);Ht({items:E})}}),t.jsx("button",{type:"button",className:"ghost timeline-item-remove","aria-label":i("删除第 {n} 项",{n:u+1}),"data-testid":`timeline-item-remove-${u}`,disabled:C.items.length<=$g,onClick:()=>Ht({items:C.items.filter((y,S)=>S!==u)}),children:"×"})]},u))}),t.jsx("button",{type:"button",className:"ghost timeline-item-add","data-testid":"timeline-item-add",disabled:C.items.length>=Dg,onClick:()=>Ht({items:[...C.items,{label:i("今天"),text:i("新的一步")}]}),children:i("加一条")})]}),Qw(C)&&t.jsxs(kn,{title:i("进度"),testId:"inspector-progress",children:[t.jsx("div",{className:"field-label",children:i("数值")}),t.jsx("input",{className:"progress-value-input","data-testid":"progress-value-input",type:"number",min:0,max:100,step:.1,value:String(C.value),"aria-label":i("进度数值"),onChange:a=>{const u=Number(a.currentTarget.value);Ag(u)&&u!==C.value&&Ht({value:u})}}),t.jsx("div",{className:"field-label with-gap",children:i("标签")}),t.jsx("input",{className:"progress-label-input","data-testid":"progress-label-input",type:"text",defaultValue:C.label??"",maxLength:Pg,"aria-label":i("进度标签"),onKeyDown:a=>{if(a.key!=="Enter")return;a.preventDefault();const u=a.currentTarget.value.trim();if(u===(C.label??"")){a.currentTarget.blur();return}if(u!==""&&!ff(u)){a.currentTarget.blur();return}Ht({label:u}),a.currentTarget.blur()},onBlur:a=>{const u=a.currentTarget.value.trim();u!==(C.label??"")&&(u!==""&&!ff(u)||Ht({label:u}))}},`${C.id}:${C.label??""}`),t.jsx("div",{className:"field-label with-gap",children:i("样式")}),t.jsxs("div",{className:"seg stretch",role:"group","aria-label":i("进度样式"),children:[t.jsx("button",{type:"button",className:C.progressKind==="bar"?"seg-btn on":"seg-btn","aria-pressed":C.progressKind==="bar","data-testid":"progress-kind-bar",onClick:()=>he({progressKind:"bar"}),children:i("横条")}),t.jsx("button",{type:"button",className:C.progressKind==="ring"?"seg-btn on":"seg-btn","aria-pressed":C.progressKind==="ring","data-testid":"progress-kind-ring",onClick:()=>he({progressKind:"ring"}),children:i("圆环")})]}),t.jsx("div",{className:"field-label with-gap",children:i("进度颜色")}),t.jsxs("div",{className:"paint-row","data-testid":"progress-colors",children:[t.jsx(vt,{label:i("进度颜色"),color:C.accent??"#1d4ed8",testId:"progress-accent-color",onChange:a=>he({accent:a})}),C.accent!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"progress-accent-reset",onClick:()=>he({accent:null}),children:i("恢复默认")})]}),t.jsxs("div",{className:"paint-row with-gap","data-testid":"progress-track-colors",children:[t.jsx(vt,{label:i("轨道底色"),color:C.trackFill??"#e4e4e7",testId:"progress-track-color",onChange:a=>he({trackFill:a})}),C.trackFill!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"progress-track-reset",onClick:()=>he({trackFill:null}),children:i("恢复默认")})]}),t.jsxs("div",{className:"paint-row with-gap","data-testid":"progress-ink-colors",children:[t.jsx(vt,{label:i("墨色"),color:C.ink??"#3f3f46",testId:"progress-ink-color",onChange:a=>he({ink:a})}),C.ink!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"progress-ink-reset",onClick:()=>he({ink:null}),children:i("恢复默认")})]})]}),Oh(C)&&t.jsxs(kn,{title:i("二维码"),testId:"inspector-qrcode",children:[t.jsx("div",{className:"field-label",children:i("内容")}),t.jsx("input",{className:"qr-payload-input","data-testid":"qr-payload-input",type:"text",defaultValue:C.payload,maxLength:Tg,"aria-label":i("二维码内容"),onKeyDown:a=>{if(a.key!=="Enter")return;a.preventDefault();const u=a.currentTarget.value.trim();u&&u!==C.payload&&Ht({payload:u}),a.currentTarget.blur()},onBlur:a=>{const u=a.currentTarget.value.trim();u&&u!==C.payload&&Ht({payload:u})}},`${C.id}:${C.payload.length}`),t.jsx("div",{className:"field-label with-gap",children:i("纠错级别")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("纠错级别"),children:Vw.map(a=>t.jsx("button",{type:"button",className:(C.ecl??"M")===a?"seg-btn on":"seg-btn","data-testid":`qr-ecl-${a}`,onClick:()=>he({ecl:a==="M"?null:a}),children:a},a))}),t.jsx("div",{className:"field-label with-gap",children:i("模块样式")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("模块样式"),children:Gw.map(a=>t.jsx("button",{type:"button",className:(C.moduleStyle??"square")===a?"seg-btn on":"seg-btn","data-testid":`qr-module-${a}`,onClick:()=>he({moduleStyle:a==="square"?null:a}),children:i(Uw[a])},a))}),t.jsx("div",{className:"field-label with-gap",children:i("码边距")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("码边距"),children:Yw.map(a=>t.jsx("button",{type:"button",className:(C.quietZone??2)===a.value?"seg-btn on":"seg-btn","data-testid":`qr-quiet-${a.value}`,onClick:()=>he({quietZone:a.value===2?null:a.value}),children:i(a.label)},a.value))}),t.jsx("div",{className:"field-label with-gap",children:i("颜色")}),t.jsxs("div",{className:"paint-row","data-testid":"qr-colors",children:[t.jsx(vt,{label:i("码点颜色"),color:C.dark,onChange:a=>he({dark:a})}),t.jsx(vt,{label:i("背景颜色"),color:C.light,onChange:a=>he({light:a})})]}),t.jsx("div",{className:"field-label with-gap",children:i("品牌 logo")}),t.jsxs("div",{className:"paint-row","data-testid":"qr-logo-row",children:[t.jsx("button",{className:"ghost",type:"button","data-testid":"qr-logo-upload",onClick:()=>{var a;return(a=mo.current)==null?void 0:a.click()},children:C.logoSrc?i("更换 logo"):i("上传 logo")}),C.logoSrc&&t.jsx("button",{className:"ghost",type:"button","data-testid":"qr-logo-remove",onClick:()=>he({logoSrc:null}),children:i("移除 logo")})]}),t.jsx("p",{className:"qr-logo-hint","data-testid":"qr-logo-hint",children:i("logo 盖在码中央,会自动按最高纠错级别 H 生成,扫码不受影响")}),t.jsx("input",{ref:mo,className:"freeform-file",type:"file",accept:"image/*",onChange:a=>{var y;const u=(y=a.currentTarget.files)==null?void 0:y[0];u&&Dp(u)}}),t.jsx("div",{className:"field-label with-gap",children:i("预设")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("预设"),children:Zw.map(a=>t.jsx("button",{type:"button",className:"seg-btn","data-testid":`qr-preset-${a.id}`,title:i(a.label),onClick:()=>he({dark:a.dark,light:a.light,moduleStyle:a.moduleStyle==="square"?null:a.moduleStyle}),children:i(a.label)},a.id))})]}),(_n(C)||wa(C)||ei(C)||Ja(C))&&t.jsxs(kn,{title:i("填充"),testId:"inspector-fill",children:[_n(C)&&t.jsx("div",{"data-testid":"text-fill-paint",children:t.jsx(Uo,{label:i("文字颜色"),value:C.textFill,modes:["solid","linear-gradient","radial-gradient"],fallbackPaint:Wg,onChange:a=>he({textFill:a})})}),wa(C)&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"data-testid":"shape-fill-paint",children:t.jsx(Uo,{label:i("填充"),value:C.fill,modes:["solid","linear-gradient","radial-gradient","transparent","image"],fallbackPaint:Po,onChange:a=>_a(a),onChooseImage:()=>{var a;return(a=ji.current)==null?void 0:a.click()},onClearImage:()=>_a({...Po}),onImageFitChange:a=>{C.fill.type==="image"&&_a({...C.fill,fit:a})},onAdjustImageFraming:()=>{et&&vo(et)},onResetImageFraming:Ul,imageFramingDisabled:!fs,imageFramingDisabledReason:Wa??void 0,imageFramingResetDisabled:!hs})}),t.jsx("input",{ref:ji,className:"freeform-file",type:"file",accept:"image/*",onChange:a=>xu(a.currentTarget.files)})]}),ei(C)&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"data-testid":"path-fill-paint",children:t.jsx(Uo,{label:i("填充"),value:C.fill,modes:["solid","linear-gradient","radial-gradient","transparent","image"],fallbackPaint:Po,onChange:a=>_a(a),onChooseImage:()=>{var a;return(a=ji.current)==null?void 0:a.click()},onClearImage:()=>_a({...Po}),onImageFitChange:a=>{C.fill.type==="image"&&_a({...C.fill,fit:a})},onAdjustImageFraming:()=>{et&&vo(et)},onResetImageFraming:Ul,imageFramingDisabled:!fs,imageFramingDisabledReason:Wa??void 0,imageFramingResetDisabled:!hs})}),t.jsx("input",{ref:ji,className:"freeform-file",type:"file",accept:"image/*",onChange:a=>xu(a.currentTarget.files)})]}),Ja(C)&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"field-label",children:i("图片填充方式")}),t.jsx("div",{className:"seg stretch",children:Nw.map(a=>t.jsx("button",{type:"button",className:C.fit===a.id?"seg-btn on":"seg-btn","data-testid":`paint-image-fit-${a.id}`,onClick:()=>he({fit:a.id}),children:i(a.label)},a.id))}),t.jsxs("div",{className:"inspector-actions",children:[t.jsx("button",{className:"ghost",type:"button","data-testid":"freeform-crop-image","aria-label":i("裁剪图片"),title:Tl?i("裁剪图片"):Wa??void 0,disabled:!Tl,onClick:()=>{et&&Gl(et)},children:i("裁剪")}),t.jsx("button",{className:"ghost",type:"button","data-testid":"freeform-reset-framing","aria-label":i("重置图片取景"),title:hs?i("重置图片取景"):i("当前已经是默认取景"),disabled:!hs,onClick:Ul,children:i("重置取景")}),t.jsx("button",{className:"ghost",type:"button","data-testid":"freeform-image-as-background",onClick:bu,children:i("设为背景")})]})]})]}),Ja(C)&&t.jsx(kn,{title:i("相框"),testId:"inspector-image-frame",children:t.jsxs("div",{className:"field-grid with-gap",children:[t.jsxs("div",{className:"stroke-color-field","data-testid":"image-stroke-color",children:[t.jsx("span",{className:"stroke-color-label",children:i("颜色")}),t.jsxs("div",{className:"color-field",children:[t.jsx("span",{className:"color-field-value",children:C.stroke===void 0?i("无"):C.stroke.toUpperCase()}),t.jsx(vt,{label:i("图片描边颜色"),color:C.stroke??"#ffffff",onChange:a=>he(C.strokeWidth===void 0?{stroke:a,strokeWidth:12}:{stroke:a})})]})]}),t.jsxs("label",{title:i("描边宽"),children:[t.jsx(zn,{name:"stroke"}),t.jsx(Ct,{ariaLabel:i("描边宽"),min:0,max:100,resetKey:Bt,value:C.strokeWidth??0,onCommit:a=>he(a===0?{strokeWidth:null}:C.stroke===void 0?{stroke:"#ffffff",strokeWidth:a}:{strokeWidth:a})})]})]})}),(wa(C)||Ti(C)||ei(C))&&t.jsxs(kn,{title:i("描边"),testId:"inspector-stroke",children:[Ti(C)&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"field-label",children:i("线条")}),t.jsx("div",{className:"seg stretch","data-testid":"line-kind-seg",children:["line","arrow"].map(a=>t.jsx("button",{type:"button",className:C.lineKind===a?"seg-btn on":"seg-btn",onClick:()=>he({lineKind:a}),children:a==="line"?i("直线"):i("箭头")},a))})]}),t.jsxs("div",{className:"field-grid with-gap",children:[t.jsxs("div",{className:"stroke-color-field","data-testid":wa(C)?"shape-stroke-color":ei(C)?"path-stroke-color":"line-stroke-color",children:[t.jsx("span",{className:"stroke-color-label",children:i("颜色")}),t.jsxs("div",{className:"color-field",children:[t.jsx("span",{className:"color-field-value",children:C.stroke==="transparent"?i("透明"):C.stroke.toUpperCase()}),t.jsx(vt,{label:wa(C)?i("形状描边颜色"):ei(C)?i("图形描边颜色"):i("线条颜色"),color:C.stroke,onChange:a=>he({stroke:a})})]})]}),t.jsxs("label",{title:Ti(C)?i("粗细"):i("描边宽"),children:[t.jsx(zn,{name:"stroke"}),t.jsx(Ct,{ariaLabel:Ti(C)?i("粗细"):i("描边宽"),min:Ti(C)?Number.MIN_VALUE:0,max:Number.MAX_VALUE,resetKey:Bt,value:ut.kind==="leaf"?ut.strokeWidth??C.strokeWidth:C.strokeWidth,onCommit:a=>Hr({property:"strokeWidth",value:a})})]})]}),ei(C)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"field-grid with-gap",children:[t.jsxs("label",{title:i("虚线"),children:[t.jsx(zn,{name:"dash"}),t.jsx(Ct,{ariaLabel:i("虚线"),min:0,max:Number.MAX_VALUE,resetKey:Bt,value:C.dash===void 0?0:C.dash*ni(C.viewBox,C.width,C.height),onCommit:a=>he({dash:a>0?a/ni(C.viewBox,C.width,C.height):null})})]}),t.jsx("div",{className:"inspector-actions",children:t.jsx("button",{className:"ghost",type:"button","data-testid":"path-dash-clear",disabled:C.dash===void 0,onClick:()=>he({dash:null}),children:i("实线")})})]}),t.jsx("div",{className:"field-label with-gap",children:i("线帽")}),t.jsx("div",{className:"seg stretch",children:Ih.map(a=>t.jsx("button",{type:"button",className:(C.cap??"round")===a.id?"seg-btn on":"seg-btn","data-testid":`path-cap-${a.id}`,onClick:()=>he({cap:a.id}),children:i(a.label)},a.id))}),t.jsx("div",{className:"field-label with-gap",children:i("拐角")}),t.jsx("div",{className:"seg stretch",children:jw.map(a=>t.jsx("button",{type:"button",className:(C.join??"round")===a.id?"seg-btn on":"seg-btn","data-testid":`path-join-${a.id}`,onClick:()=>he({join:a.id}),children:i(a.label)},a.id))})]}),Ti(C)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"field-grid with-gap",children:[t.jsxs("label",{title:i("虚线"),children:[t.jsx(zn,{name:"dash"}),t.jsx(Ct,{ariaLabel:i("虚线"),min:1,max:500,resetKey:Bt,value:C.dash??0,onCommit:a=>he({dash:a})})]}),t.jsx("div",{className:"inspector-actions",children:t.jsx("button",{className:"ghost",type:"button","data-testid":"line-dash-clear",disabled:C.dash===void 0,onClick:()=>he({dash:null}),children:i("实线")})})]}),t.jsx("div",{className:"field-label with-gap",children:i("线帽")}),t.jsx("div",{className:"seg stretch",children:Ih.map(a=>t.jsx("button",{type:"button",className:(C.cap??"round")===a.id?"seg-btn on":"seg-btn","data-testid":`line-cap-${a.id}`,onClick:()=>he({cap:a.id}),children:i(a.label)},a.id))}),t.jsx("div",{className:"field-label with-gap",children:i("端点")}),t.jsx("div",{className:"field-grid with-gap",children:kw.map(a=>{const u=a.id==="start"?C.startCap??"none":C.endCap??(C.lineKind==="arrow"?"arrow":"none");return t.jsxs("div",{children:[t.jsx("div",{className:"field-label",children:i(a.label)}),t.jsx("div",{className:"seg stretch",children:ww.map(y=>{const S=a.id==="end"&&C.lineKind==="arrow"?"arrow":"none";return t.jsx("button",{type:"button",className:u===y.id?"seg-btn on":"seg-btn","data-testid":`line-endpoint-${a.id}-${y.id}`,onClick:()=>he(y.id===S?a.id==="start"?{startCap:null}:{endCap:null}:a.id==="start"?{startCap:y.id}:{endCap:y.id}),children:i(y.label)},y.id)})})]},a.id)})})]})]}),C&&t.jsxs(kn,{title:i("外观"),testId:"inspector-appearance",children:[Ja(C)&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"field-label",children:i("圆角")}),t.jsx("div",{className:"seg stretch","data-testid":"image-radius-presets",children:Mw.map(a=>{const u=a.radius==="capsule"?Math.min(2e3,Math.round(Math.min(C.width,C.height)/2)):a.radius,y=a.radius==="capsule"?(C.cornerRadius??0)>=u-.5:(C.cornerRadius??0)===u;return t.jsx("button",{type:"button",className:y?"seg-btn on":"seg-btn","data-testid":`image-radius-${a.id}`,"aria-pressed":y,onClick:()=>he({cornerRadius:u}),children:i(a.label)},a.id)})})]}),t.jsxs("div",{className:"field-grid with-gap",children:[t.jsxs("label",{title:i("不透明度 %"),children:[t.jsx(zn,{name:"opacity"}),t.jsx(Ct,{ariaLabel:i("不透明度 %"),min:0,max:100,resetKey:Bt,value:Math.round((C.opacity??1)*100),onCommit:a=>he({opacity:Math.round(a)/100})}),t.jsx("span",{className:"field-suffix","aria-hidden":"true",children:"%"})]}),wa(C)&&C.shape==="rect"&&t.jsxs("div",{className:"corner-radii-grid","data-testid":"corner-radii-grid",children:[[["topLeft","左上圆角"],["topRight","右上圆角"],["bottomRight","右下圆角"],["bottomLeft","左下圆角"]].map(([a,u])=>t.jsxs("label",{title:i(u),children:[t.jsx(zn,{name:"radius"}),t.jsx(Ct,{ariaLabel:i(u),min:0,max:2e3,resetKey:Bt,value:C.cornerRadii!==void 0?C.cornerRadii[a]:C.cornerRadius??16,onCommit:y=>{const S=C.cornerRadii!==void 0?{...C.cornerRadii}:{topLeft:C.cornerRadius??16,topRight:C.cornerRadius??16,bottomRight:C.cornerRadius??16,bottomLeft:C.cornerRadius??16};he({cornerRadii:{...S,[a]:y}})}})]},a)),t.jsx("button",{type:"button",className:"ghost","data-testid":"corner-radii-reset",disabled:C.cornerRadii===void 0,onClick:()=>he({cornerRadii:null}),children:i("统一圆角")})]}),Ja(C)&&t.jsxs("label",{title:i("圆角"),children:[t.jsx(zn,{name:"radius"}),t.jsx(Ct,{ariaLabel:i("圆角"),min:0,max:2e3,resetKey:Bt,value:C.cornerRadius??0,onCommit:a=>he({cornerRadius:a})})]})]}),t.jsx("div",{className:"field-label with-gap",children:i("阴影")}),t.jsx(c8,{shadow:C.shadow,resetKey:Bt,onChange:a=>he({shadow:a})}),t.jsx("div",{className:"field-label with-gap",children:i("混合模式")}),t.jsx(qr,{value:C.blendMode??"normal",onChange:a=>he({blendMode:a==="normal"?null:a}),title:i("混合模式"),testId:"freeform-blend-select",options:yw.map(a=>({...a,label:i(a.label)}))}),t.jsx("div",{className:"field-label with-gap",children:i("滤镜")}),t.jsx(l8,{filter:C.filter,resetKey:Bt,onChange:a=>he({filter:a})})]})]}),!Ta&&t.jsxs(kn,{title:i("排列"),testId:"inspector-arrange",children:[t.jsx("div",{className:"field-label",children:i("层级")}),t.jsx("div",{className:"inspector-icon-row",children:g8.map(a=>t.jsx("button",{className:"ghost inspector-icon-btn",type:"button","aria-label":i(a.label),title:i(a.label),onClick:()=>ma(a.id),children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:a.icon})})},a.id))})]}),!Ta&&wi.length===1&&t.jsx(kn,{title:i("删除"),testId:"inspector-danger",tone:"danger",children:t.jsx("button",{className:"ghost inspector-delete",type:"button",onClick:Co,children:i("删除")})})]})]})]}),t.jsx(s0,{open:se,workspace:"freeform",hasCurrentContent:In!==null||h.past.length>0||x.slides.length>1||x.slides.some(a=>a.nodes.length>0),currentIsSaved:r!==null&&!lc,onClose:()=>ve(!1),onApply:Pu,onInsert:a=>{Au(a),ve(!1)}}),$t&&t.jsx("div",{className:"sheet-backdrop",onClick:()=>Zn(!1),children:t.jsx("div",{className:"sheet freeform-warning-sheet",onClick:a=>a.stopPropagation(),children:t.jsxs("div",{className:"sheet-body",children:[t.jsx("h2",{children:i("包含不同尺寸页面")}),t.jsx("p",{className:"form-note",children:i("当前作品包含不同尺寸页面。ZIP 中的图片会保留各自页面尺寸,不会统一拉伸或裁剪。")}),t.jsxs("div",{className:"sheet-foot",children:[t.jsx("button",{type:"button",className:"ghost",onClick:()=>Zn(!1),children:i("取消")}),t.jsx("button",{type:"button",className:"accent",onClick:p1,disabled:we===null,children:i("继续导出")})]})]})})}),W&&t.jsxs("div",{ref:ke,className:"freeform-context-menu","data-testid":"freeform-context-menu",role:"menu","aria-label":i("画布操作"),style:{left:W.x,top:W.y},children:[t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-copy",disabled:_e.length===0,onClick:()=>{dn(),nc()},children:[i("复制"),t.jsx(En,{keys:Bn("C",{mod:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-duplicate",disabled:_e.length===0,onClick:()=>{dn(),rc()},children:[i("原位复制"),t.jsx(En,{keys:Bn("D",{mod:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-cut",disabled:_e.length===0,onClick:()=>{dn(),yu()},children:[i("剪切"),t.jsx(En,{keys:Bn("X",{mod:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-paste",disabled:!z||z.nodes.length===0,onClick:()=>{dn(),bs()},children:[i("粘贴"),t.jsx(En,{keys:Bn("V",{mod:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-paste-in-place",disabled:!z||z.nodes.length===0,onClick:()=>{dn(),bs(!0)},children:[i("原位粘贴"),t.jsx(En,{keys:Bn("V",{mod:!0,shift:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-delete",disabled:_e.length===0,onClick:()=>{dn(),Co()},children:[i("删除"),t.jsx(En,{keys:y0})]}),t.jsx("div",{className:"freeform-context-menu-separator",role:"separator"}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-forward",disabled:_e.length===0,onClick:()=>{dn(),ma("forward")},children:[i("上移一层"),t.jsx(En,{keys:Bn("]",{mod:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-backward",disabled:_e.length===0,onClick:()=>{dn(),ma("backward")},children:[i("下移一层"),t.jsx(En,{keys:Bn("[",{mod:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-front",disabled:_e.length===0,onClick:()=>{dn(),ma("front")},children:[i("置于顶层"),t.jsx(En,{keys:"]"})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-back",disabled:_e.length===0,onClick:()=>{dn(),ma("back")},children:[i("移到底层"),t.jsx(En,{keys:"["})]}),oo&&t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-as-background",disabled:jn,onClick:()=>{dn(),bu()},children:i("设为背景")}),t.jsx("div",{className:"freeform-context-menu-separator",role:"separator"}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-group",disabled:xe.length<2,onClick:()=>{dn(),Eo()},children:[i("编组"),t.jsx(En,{keys:Bn("G",{mod:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-ungroup",disabled:!yi,onClick:()=>{dn(),zo()},children:[i("解组"),t.jsx(En,{keys:Bn("G",{mod:!0,shift:!0})})]}),t.jsx("div",{className:"freeform-context-menu-separator",role:"separator"}),t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-lock",disabled:_e.length===0,onClick:()=>{dn(),xe.forEach(a=>{Ni(a,!jn)})},children:jn?i("解锁"):i("锁定")}),t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-visibility",disabled:_e.length===0,onClick:()=>{dn(),xe.forEach(a=>{ju(a,!lr)})},children:lr?i("取消隐藏"):i("隐藏")}),t.jsx("div",{className:"freeform-context-menu-separator",role:"separator"}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-copy-style",disabled:!cr,onClick:()=>{dn(),Eu()},children:[i("复制样式"),t.jsx(En,{keys:Bn("C",{mod:!0,alt:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-paste-style",disabled:!T||!cr,onClick:()=>{dn(),zu()},children:[i("粘贴样式"),t.jsx(En,{keys:Bn("V",{mod:!0,alt:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-zoom-selection",disabled:_e.length===0,onClick:()=>{dn(),Cu()},children:[i("缩放到选区"),t.jsx(En,{keys:Bn("2",{shift:!0})})]})]}),Ee&&jr>=0&&t.jsxs("div",{ref:Ye,className:"freeform-context-menu","data-testid":"freeform-slide-context-menu",role:"menu","aria-label":i("页面操作"),style:{left:Ee.x,top:Ee.y},onKeyDown:a=>{const u=Array.from(a.currentTarget.querySelectorAll('[role="menuitem"]:not(:disabled)')),y=u.findIndex(E=>E===document.activeElement);let S=null;a.key==="ArrowDown"?S=y+1:a.key==="ArrowUp"?S=y<0?u.length-1:y-1:a.key==="Home"?S=0:a.key==="End"&&(S=u.length-1),S!==null&&u.length>0?(a.preventDefault(),a.stopPropagation(),u[(S+u.length)%u.length].focus()):a.key==="Escape"?(a.preventDefault(),a.stopPropagation(),Or(!0)):a.key==="Tab"&&Or(!1)},children:[t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-slide-context-menu-rename",onClick:()=>{const a=Ee.slideId;Or(!1),cu(a)},children:i("重命名此页")}),t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-slide-context-menu-duplicate",disabled:x.slides.length>=lf,onClick:()=>{Or(!0),up(Ee.slideId)},children:i("复制此页")}),t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-slide-context-menu-delete",disabled:x.slides.length<=1,onClick:()=>{Or(!0),hp(Ee.slideId)},children:i("删除此页")}),t.jsx("div",{className:"freeform-context-menu-separator",role:"separator"}),t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-slide-context-menu-up",disabled:jr===0,onClick:()=>{Or(!0),vi(Ee.slideId,jr-1)},children:i("上移一位")}),t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-slide-context-menu-down",disabled:jr===x.slides.length-1,onClick:()=>{Or(!0),vi(Ee.slideId,jr+1)},children:i("下移一位")}),t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-slide-context-menu-front",disabled:jr===0,onClick:()=>{Or(!0),vi(Ee.slideId,0)},children:i("移到最前")}),t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-slide-context-menu-back",disabled:jr===x.slides.length-1,onClick:()=>{Or(!0),vi(Ee.slideId,x.slides.length-1)},children:i("移到最后")})]})]})})}const W0="slicer.mode.v1";let Vh=0;function b8(){var e;try{const n=localStorage.getItem(W0);return n==="light"||n==="dark"?n:(e=window.matchMedia)!=null&&e.call(window,"(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}function y8(){const[e,n]=p.useState(b8);return p.useEffect(()=>{const s=document.documentElement;s.setAttribute("data-theme",e),s.style.colorScheme=e;try{localStorage.setItem(W0,e)}catch{}},[e]),[e,()=>{const s=document.documentElement;s.classList.add("theme-anim"),window.clearTimeout(Vh),Vh=window.setTimeout(()=>s.classList.remove("theme-anim"),320),n(l=>l==="light"?"dark":"light")}]}function j8({profile:e,onSave:n,onClose:r}){const[s,l]=p.useState(e),o=p.useRef(null),c=(g,x)=>l(m=>({...m,[g]:x}));function f(g){var j;const x=(j=g.target.files)==null?void 0:j[0];if(!x)return;const m=new FileReader;m.onload=()=>c("avatarImage",m.result),m.readAsDataURL(x)}const h=s.avatarImage?{backgroundImage:`url(${s.avatarImage})`}:{background:s.avatarColor};return t.jsx("div",{className:"modal-backdrop",onClick:r,children:t.jsxs("div",{className:"modal",onClick:g=>g.stopPropagation(),children:[t.jsxs("div",{className:"modal-head",children:[t.jsx("h3",{children:i("个人资料")}),t.jsx("button",{className:"modal-x",onClick:r,"aria-label":i("关闭"),children:t.jsx(Pn,{})})]}),t.jsxs("div",{className:"modal-row",children:[t.jsx("div",{className:"avatar-preview",style:h}),t.jsxs("div",{className:"avatar-picker",children:[t.jsx("div",{className:"field-label",children:i("头像颜色(或上传图片)")}),t.jsxs("div",{className:"swatches",children:[f2.map(g=>t.jsx("button",{className:!s.avatarImage&&s.avatarColor===g?"swatch active":"swatch",style:{background:g},onClick:()=>{c("avatarColor",g),c("avatarImage",null)},"aria-label":i("颜色 {color}",{color:g})},g)),t.jsx("button",{className:"swatch swatch-upload",onClick:()=>{var g;return(g=o.current)==null?void 0:g.click()},"aria-label":i("上传图片"),children:"+"}),t.jsx("input",{ref:o,type:"file",accept:"image/*",hidden:!0,onChange:f})]})]})]}),t.jsxs("label",{className:"field",children:[t.jsx("span",{className:"field-label",children:i("昵称")}),t.jsx("input",{className:"text-input",value:s.nickname,onChange:g=>c("nickname",g.target.value)})]}),t.jsxs("label",{className:"field",children:[t.jsx("span",{className:"field-label",children:i("@ 用户名(推特)")}),t.jsx("input",{className:"text-input",value:s.handle,onChange:g=>c("handle",g.target.value)})]}),t.jsxs("label",{className:"field",children:[t.jsx("span",{className:"field-label",children:i("发布地点(微博/推特)")}),t.jsx("input",{className:"text-input",value:s.location,onChange:g=>c("location",g.target.value)})]}),t.jsxs("div",{className:"field-inline",children:[t.jsx("span",{className:"field-label",children:i("显示认证标志")}),t.jsx("button",{className:s.verified?"toggle on":"toggle",onClick:()=>c("verified",!s.verified),role:"switch","aria-checked":s.verified,children:t.jsx("span",{className:"toggle-knob"})})]}),t.jsxs("div",{className:"field-inline",children:[t.jsx("span",{className:"field-label",children:i("只在首页显示个人信息")}),t.jsx("button",{className:s.headerFirstPageOnly?"toggle on":"toggle",onClick:()=>c("headerFirstPageOnly",!s.headerFirstPageOnly),role:"switch","aria-checked":s.headerFirstPageOnly,children:t.jsx("span",{className:"toggle-knob"})})]}),t.jsxs("div",{className:"modal-foot",children:[t.jsx("button",{className:"ghost",onClick:r,children:i("取消")}),t.jsx("button",{className:"primary",onClick:()=>n(s),children:i("保存")})]})]})})}const w8=new Map(ci.flatMap(e=>{var r;const n=(r=e.createMarkdown)==null?void 0:r.call(e);return n?[[n.themeId,n.fontFamily]]:[]}));function $c(e,n){return e.look&&w8.get(e.id)||n}const Gh=92;function k8({theme:e,html:n,pageCount:r,title:s,fontFamily:l,radius:o,profile:c}){const f=bl(mr[0],e,l),h=Gh/f.width;return t.jsx("span",{className:"doc-preview doc-preview-md look-thumb",style:{width:Gh,height:Math.round(f.height*h),...kd(h,o,f)},"aria-hidden":"true",children:t.jsx(yl,{html:n,config:f,profile:c,pageIndex:0,pageCount:r,pageRole:e.look&&r>1?"cover":"article",showHeader:!1,title:s})})}function S8({themeId:e,fontFamily:n,radius:r,profile:s,firstPageHtml:l,pageCount:o,title:c,onPick:f}){const[h,g]=p.useState(!1),[x,m]=p.useState(0),j=p.useRef(null),k=p.useRef(null),v=p.useRef(null),w=p.useId(),N=h2(e),M=N.filter(D=>D.look),I=N.filter(D=>!D.look),F=[...M,...I],z=F.find(D=>D.id===e)??F[0],A=D=>`${w}-look-${D}`;function T(){m(Math.max(0,F.findIndex(D=>D.id===e))),g(!0)}function L(D){var re;g(!1),D&&((re=k.current)==null||re.focus())}function H(D){const re=F[D];re&&(L(!0),(re.id!==e||$c(re,n)!==n)&&f(re,$c(re,n)))}p.useLayoutEffect(()=>{var D;h&&((D=v.current)==null||D.focus())},[h]),p.useEffect(()=>{var D,re;h&&((re=(D=v.current)==null?void 0:D.querySelector(`[id="${CSS.escape(A(x))}"]`))==null||re.scrollIntoView({block:"nearest"}))},[h,x]),p.useEffect(()=>{if(!h)return;const D=re=>{var q;(q=j.current)!=null&&q.contains(re.target)||L(!1)};return document.addEventListener("pointerdown",D),()=>document.removeEventListener("pointerdown",D)},[h]);function P(){var te,be;const D=Array.from(((te=v.current)==null?void 0:te.querySelectorAll('[role="option"]'))??[]),re=(be=D[0])==null?void 0:be.offsetTop,q=D.filter(ne=>ne.offsetTop===re).length;return Math.max(1,q)}function U(D){const re=q=>{D.preventDefault(),D.stopPropagation(),m(te=>Math.min(F.length-1,Math.max(0,te+q)))};D.key==="ArrowRight"?re(1):D.key==="ArrowLeft"?re(-1):D.key==="ArrowDown"?re(P()):D.key==="ArrowUp"?re(-P()):D.key==="Home"?re(-F.length):D.key==="End"?re(F.length):D.key==="Enter"||D.key===" "?(D.preventDefault(),D.stopPropagation(),H(x)):D.key==="Escape"?(D.preventDefault(),D.stopPropagation(),L(!0)):D.key==="Tab"&&L(!1)}const K=(D,re,q)=>re.length>0&&t.jsxs("div",{className:"look-group",role:"group","aria-label":D,children:[t.jsx("div",{className:"look-group-head","aria-hidden":"true",children:D}),t.jsx("div",{className:"look-grid",children:re.map((te,be)=>{const ne=q+be;return t.jsxs("div",{id:A(ne),role:"option","aria-selected":te.id===e,className:`look-option${ne===x?" active":""}${te.id===e?" selected":""}`,"data-testid":`look-option-${te.id}`,onPointerEnter:()=>m(ne),onPointerDown:Be=>Be.preventDefault(),onClick:()=>H(ne),children:[t.jsx(k8,{theme:te,html:l,pageCount:o,title:c,fontFamily:$c(te,n),radius:r,profile:s}),t.jsx("span",{className:"look-option-label",children:i(te.label)})]},te.id)})})]});return t.jsxs("div",{className:"sel look-picker",ref:j,title:i("主题"),children:[t.jsxs("button",{ref:k,type:"button",role:"combobox",className:h?"sel-trigger open":"sel-trigger","aria-label":i("主题"),"aria-haspopup":"listbox","aria-expanded":h,"aria-controls":h?w:void 0,"data-testid":"markdown-look-picker",onClick:()=>h?L(!1):T(),onKeyDown:D=>{h||["Enter"," ","ArrowDown","ArrowUp"].includes(D.key)&&(D.preventDefault(),T())},children:[t.jsxs("span",{className:"sel-content",children:[t.jsx("span",{className:"sel-swatch",style:{background:z.background},"aria-hidden":"true",children:t.jsx("span",{className:"sel-swatch-dot",style:{background:z.accent}})}),t.jsx("span",{className:"sel-value",children:i(z.label)})]}),t.jsx("svg",{className:"sel-caret",viewBox:"0 0 10 6",width:"10",height:"6","aria-hidden":!0,children:t.jsx("path",{d:"M1 1l4 4 4-4",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),h&&t.jsxs("div",{ref:v,id:w,className:"look-panel",role:"listbox",tabIndex:0,"aria-label":i("主题"),"aria-activedescendant":A(x),onKeyDown:U,children:[K(i("长文版式"),M,0),K(i("基础主题"),I,M.length)]})]})}const v8=p.lazy(()=>Ed(()=>import("./MarkdownEditor-DDmv6m-x.js"),__vite__mapDeps([3,1,2])).then(e=>({default:e.MarkdownEditor}))),N8=`# 图文切片快速上手
|
|
503
|
+
`);const x=new Uint8Array(l);let m=0;for(const j of r)x.set(j,m),m+=j.length;return x}const u6="modulepreload",f6=function(e){return"/"+e},Uf={},Ed=function(n,r,s){let l=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),f=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));l=Promise.allSettled(r.map(h=>{if(h=f6(h),h in Uf)return;Uf[h]=!0;const g=h.endsWith(".css"),x=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${x}`))return;const m=document.createElement("link");if(m.rel=g?"stylesheet":u6,g||(m.as="script"),m.crossOrigin="",m.href=h,f&&m.setAttribute("nonce",f),document.head.appendChild(m),g)return new Promise((j,k)=>{m.addEventListener("load",j),m.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return l.then(c=>{for(const f of c||[])f.status==="rejected"&&o(f.reason);return n().catch(o)})};function h6(e){const n=e.indexOf(",");return n>=0?e.slice(n+1):e}async function ed(e,n="cards.zip",r={}){const{default:s}=await Ed(async()=>{const{default:h}=await import("./jszip.min-Dh_Y8aD6.js").then(g=>g.j);return{default:h}},__vite__mapDeps([0,1,2])),l=new s,o=String(e.length).length;await Promise.all(e.map(async(h,g)=>{var x;if(typeof h=="string"){const m=((x=r.fileNameForIndex)==null?void 0:x.call(r,g,e.length))??`card-${String(g+1).padStart(o,"0")}.png`;l.file(m,h6(h),{base64:!0});return}l.file(h.name,await h.blob.arrayBuffer())}));const c=await l.generateAsync({type:"blob"});(r.downloader??m6)(c,n)}function m6(e,n){const r=URL.createObjectURL(e),s=document.createElement("a");s.href=r,s.download=n,s.click(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}async function J0(e,n){const r=xt(n);return r.remote?e.src:r.images.put(e.src)}function p6(e){return e.replace(/[[\]"<>|\\]+/g," ").replace(/\s+/g," ").trim()}function Yf(e){return new Date(e).toLocaleTimeString(Bs(),{hour:"2-digit",minute:"2-digit"})}function g6({title:e,onRename:n}){const[r,s]=p.useState(!1),l=p.useRef(null),o=p.useRef(!1);p.useEffect(()=>{var f,h;r&&((f=l.current)==null||f.focus(),(h=l.current)==null||h.select())},[r]);function c(f){if(s(!1),o.current){o.current=!1;return}const h=f.trim();h&&h!==e&&n(h)}return r?t.jsx("input",{ref:l,className:"editor-title-input","data-testid":"editor-title-input","aria-label":i("项目名称"),defaultValue:e,maxLength:60,onBlur:f=>c(f.currentTarget.value),onKeyDown:f=>{if(f.key==="Enter"){if(f.nativeEvent.isComposing)return;f.preventDefault(),f.currentTarget.blur()}else f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),o.current=!0,f.currentTarget.blur())}}):t.jsxs("button",{className:"editor-title",type:"button","data-testid":"editor-title",title:i("重命名项目"),"aria-label":i("项目名称:{title},点击重命名",{title:e}),onClick:()=>s(!0),children:[t.jsx("span",{className:"editor-title-text",children:e}),t.jsx(md,{className:"editor-title-edit"})]})}function x6({save:e,onRequestAuth:n,onRetry:r}){switch(e.kind){case"none":return null;case"signed-out":return t.jsxs("button",{className:"save-chip is-signed-out",type:"button","data-testid":"editor-save-state",title:i("登录已过期。重新登录后,这些修改会存回原来的项目。"),onClick:n,children:[t.jsx(Q2,{}),t.jsx("span",{children:i("登录后继续保存")})]});case"saving":return t.jsxs("span",{className:"save-chip is-saving","data-testid":"editor-save-state",role:"status",children:[t.jsx("span",{className:"save-spinner","aria-hidden":"true"}),t.jsx("span",{children:i("保存中…")})]});case"saved":return e.onDevice?t.jsxs("span",{className:"save-chip is-saved is-on-device","data-testid":"editor-save-state",role:"status",title:`${i("已自动保存 · {time}",{time:Yf(e.at)})}
|
|
504
|
+
${zt.remote?i("只保存在这台设备上。登录后可以放进账号,换一台设备也能继续编辑。"):i("保存在这台设备的浏览器里。")}`,children:[t.jsx(pd,{}),t.jsx("span",{children:i("已保存到本机")})]}):t.jsxs("span",{className:"save-chip is-saved","data-testid":"editor-save-state",role:"status",title:i("已自动保存 · {time}",{time:Yf(e.at)}),children:[t.jsx(q2,{}),t.jsx("span",{children:i("已保存")})]});case"error":return t.jsxs("span",{className:"save-chip is-error","data-testid":"editor-save-state",role:"alert",title:e.message,children:[t.jsx(J2,{}),t.jsx("span",{children:i("保存失败")}),t.jsx("button",{type:"button",className:"save-retry","data-testid":"editor-save-retry",onClick:r,children:i("重试")})]})}}function b6({chrome:e,user:n,requestAuth:r}){const[s,l]=p.useState(!1),o=p.useRef(null);return qs(o,s,()=>l(!1)),n?t.jsxs("div",{className:"editor-account",ref:o,children:[t.jsx("button",{className:"editor-avatar-btn",type:"button","data-testid":"account-menu","aria-haspopup":"menu","aria-expanded":s,"aria-label":i("账号菜单({name})",{name:n.username}),title:n.username,onClick:()=>l(c=>!c),children:t.jsx("span",{className:"editor-avatar","aria-hidden":"true",children:n.username.slice(0,1)})}),s&&t.jsxs("div",{className:"menu editor-account-menu",role:"menu",children:[t.jsxs("div",{className:"editor-account-head",children:[t.jsx("b",{children:n.username}),t.jsx("span",{children:zt.remote?i("服务器账号 · 多设备同步"):i("本地账号 · 数据只存在这台设备")})]}),t.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{l(!1),e.onHome()},children:[t.jsx(Qi,{}),i("返回工作台")]}),t.jsx("div",{className:"menu-sep",role:"separator"}),t.jsxs("button",{role:"menuitem",type:"button","data-testid":"account-logout",onClick:()=>{l(!1),e.onLogout()},children:[t.jsx(Vc,{}),i("退出登录")]})]})]}):e.authStatus==="checking"?t.jsx("span",{className:"editor-account-status","data-testid":"account-status","aria-label":i("正在检查登录状态"),children:i("检查中")}):e.authStatus==="error"?t.jsx("button",{className:"editor-account-status is-retry",type:"button","data-testid":"account-status-retry",title:i("重新检查登录状态"),onClick:e.onRetryAuth,children:i("待确认")}):t.jsx("button",{className:"editor-login",type:"button","data-testid":"account-login",title:i("登录账户"),onClick:r,children:i("登录")})}function em({chrome:e,user:n,requestAuth:r,system:s,title:l,onRename:o,save:c,onRetrySave:f,center:h,actions:g,primary:x}){return t.jsxs("header",{className:"editor-bar","data-testid":"app-header","data-system":s,children:[t.jsxs("div",{className:"editor-bar-start",children:[t.jsxs("button",{className:"editor-home",type:"button","data-testid":"editor-home","aria-label":i("返回工作台"),title:i("返回工作台"),onClick:e.onHome,children:[t.jsx(Qi,{className:"editor-home-chevron"}),t.jsx("img",{src:vl,alt:"",width:"22",height:"22"})]}),t.jsxs("div",{className:"editor-doc",children:[t.jsx(g6,{title:l,onRename:o}),t.jsx(x6,{save:c,onRequestAuth:r,onRetry:f})]})]}),t.jsx("div",{className:"editor-bar-center",children:h}),t.jsxs("div",{className:"editor-bar-end",children:[g,t.jsx(Sd,{className:"editor-lang"}),t.jsx("button",{className:"editor-icon-btn",type:"button","data-testid":"theme-toggle","aria-label":i("切换深浅色"),title:e.theme==="dark"?i("切换到浅色模式"):i("切换到深色模式"),onClick:e.onToggleTheme,children:e.theme==="dark"?t.jsx(p0,{}):t.jsx(fd,{})}),t.jsx(b6,{chrome:e,user:n,requestAuth:r}),x]})]})}function tm({testId:e,label:n,className:r,disabled:s=!1,children:l}){const o=p.useRef(null),c=["workspace-toolbar",r,s?"is-disabled":""].filter(Boolean).join(" ");return p.useEffect(()=>{const f=o.current;f&&(s?f.setAttribute("inert",""):f.removeAttribute("inert"))},[s]),t.jsx("div",{ref:o,className:c,"data-testid":e,role:"toolbar","aria-label":n,"aria-disabled":s||void 0,children:l})}function td({side:e="left",children:n}){return t.jsx("div",{className:`toolbar-group toolbar-group-${e}`,children:n})}function pl(){return t.jsx("span",{className:"toolbar-divider","aria-hidden":"true"})}const y6=5*60*1e3,j6=30*1e3;function nm(e){return[...new Set(e.map(n=>n.trim()).filter(Boolean))].sort()}function w6(e){return JSON.stringify(nm(e))}function k6(e){let n=[],r="[]",s=!1,l=()=>{},o=null,c=null,f=!1,h=0,g=0;const x=()=>s&&n.length>0,m=()=>{o!==null&&(e.clearTimeout(o),o=null)},j=T=>{try{l(T)}catch{}},k=()=>{!x()||o!==null||(o=e.setTimeout(()=>{o=null,v(!1)},j6))},v=async T=>{if(!x())return;const L=++g,H=h,P=[...n];try{await e.retain(P),L===g&&H===h&&m()}catch(U){if(L===g&&H===h&&x()&&(j(U),k()),T)throw U}},w=()=>{x()&&(m(),v(!1))},N=()=>w(),F=()=>{e.visibilityState()==="visible"&&w()},I=()=>{f&&(e.windowTarget.removeEventListener("online",N),e.documentTarget.removeEventListener("visibilitychange",F),f=!1)},M=()=>{m(),c!==null&&(e.clearInterval(c),c=null),I()},z=()=>{x()&&(f||(e.windowTarget.addEventListener("online",N),e.documentTarget.addEventListener("visibilitychange",F),f=!0),c=e.setInterval(w,y6),w())};return{update(T,L,H){l=H;const P=nm(T),U=JSON.stringify(P);s===L&&r===U||(h+=1,g+=1,M(),n=P,r=U,s=L,z())},retainNow:async()=>{x()&&(m(),await v(!0))},dispose(){h+=1,g+=1,M(),n=[],r="[]",s=!1,l=()=>{}}}}function rm(e,n,r){const s=p.useRef(null);s.current||(s.current=k6({retain:c=>zt.images.retain(c),windowTarget:window,documentTarget:document,visibilityState:()=>document.visibilityState,setTimeout:(c,f)=>window.setTimeout(c,f),clearTimeout:c=>window.clearTimeout(c),setInterval:(c,f)=>window.setInterval(c,f),clearInterval:c=>window.clearInterval(c)}));const l=s.current,o=w6(e);return p.useEffect(()=>{l.update(e,n,r)},[n,o,r,l,e]),p.useEffect(()=>()=>l.dispose(),[l]),p.useCallback(()=>l.retainNow(),[l])}function S6(e){return e instanceof Error&&e.message.trim()?i(e.message):i("暂时无法保存,请稍后重试")}function am(e){const n=p.useRef(null),r=p.useRef(e);r.current=e;const[s,l]=p.useState("idle"),[o,c]=p.useState(null),f=p.useRef("idle"),h=p.useCallback(k=>{f.current!==k&&(f.current=k,l(k))},[]),g=p.useCallback((k,v,w,N)=>{let F=n.current;if(!F||F.ownerId!==k){F==null||F.saver.detach();const I=new q4(M=>xt(k).drafts.save(k,M),v,{onSaved:(M,z,A)=>{var T;((T=n.current)==null?void 0:T.saver)===I&&(r.current(M,z,A),c(null),h(I.pending?"saving":"saved"))},onError:M=>{var z;((z=n.current)==null?void 0:z.saver)===I&&(c(S6(M)),h("error"))}},void 0,k);F={saver:I,ownerId:k},n.current=F}F.saver.schedule(w,N),h("saving")},[h]),x=p.useCallback(()=>{const k=n.current;return k!=null&&k.saver.busy?(h("saving"),k.saver.flush()):Promise.resolve()},[h]),m=p.useCallback(()=>{var k;(k=n.current)==null||k.saver.detach(),n.current=null,h("idle"),c(null)},[h]),j=p.useCallback(()=>{var k;(k=n.current)==null||k.saver.cancel(),n.current=null,h("idle"),c(null)},[h]);return p.useEffect(()=>()=>{var k;(k=n.current)==null||k.saver.detach(),n.current=null},[]),{status:s,error:o,schedule:g,flush:x,release:m,discard:j}}function v6({template:e,detail:n=!1}){var h;const r=(h=e.createMarkdown)==null?void 0:h.call(e);if(!r)return null;const s=pr.find(g=>g.id===r.platformId)??pr[0],l=Ls(r.themeId),o=ll.find(g=>g.id===r.fontFamily)??ll[0],c=bl(s,l,o.id),f=Hy(r);return t.jsx("div",{className:n?"template-markdown-preview detail":"template-markdown-preview",style:kd(n?.622:.45,r.radius,c),children:t.jsx(yl,{html:f.html,config:c,profile:r.profile??Kn,pageIndex:0,pageCount:e.pageCount,pageRole:f.role,showHeader:!1,title:cd(r.source)})})}function N6(e,n,r){const{width:s,height:l}=Rn(e.format),o=Math.min(n/s,r/l);return{width:Math.round(s*o),height:Math.round(l*o)}}function im({template:e,detail:n=!1,frame:r}){const s=p.useMemo(()=>{var c;return(c=e.createFreeform)==null?void 0:c.call(e)},[e]),l=s==null?void 0:s.slides[0];if(!l)return null;const o=r??N6(e,300,n?420:216);return t.jsx(Xs,{slide:l,frameWidth:o.width,frameHeight:o.height,className:n?"template-freeform-preview detail":"template-freeform-preview",artboardClassName:"template-freeform-artboard"})}function Zf({template:e,detail:n=!1}){return e.workspace==="markdown"?t.jsx(v6,{template:e,detail:n}):t.jsx(im,{template:e,detail:n})}function Xf(e){return Array.from(e.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'))}function sm({open:e,workspace:n,hasCurrentContent:r,currentIsSaved:s,onClose:l,onApply:o,onInsert:c,onApplyLook:f}){var ze;const h=p.useRef(null),g=p.useRef(null),x=p.useRef(null),m=p.useRef(null),j=p.useRef(l),k=wd(n),v=Ws.filter(ue=>k.some(Ye=>Ye.format===ue.id)),w=Md(k),[N,F]=p.useState(null),[I,M]=p.useState(null),[z,A]=p.useState(""),[T,L]=p.useState(!1),[H,P]=p.useState(()=>K0()),U=p.useRef(""),K=p.useMemo(()=>new Set(H),[H]),D=p.useMemo(()=>si(k,{text:z,use:I,format:N,only:T?K:null}),[k,z,I,N,T,K]),[re,q]=p.useState(((ze=D[0])==null?void 0:ze.id)??""),[te,be]=p.useState(null),ne=D.find(ue=>ue.id===re)??D[0];U.current=z,m.current=te,j.current=l,p.useEffect(()=>{if(!e)return;g.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const ue=requestAnimationFrame(()=>{const Ue=h.current&&Xf(h.current)[0];Ue==null||Ue.focus()}),Ye=Ue=>{if(Ue.key==="Escape"){if(Ue.preventDefault(),U.current&&Ue.target instanceof HTMLElement&&Ue.target.closest(".template-search")){A("");return}m.current?De():j.current();return}if(Ue.key!=="Tab"||!h.current)return;const Ot=m.current?h.current.querySelector(".template-confirm")??h.current:h.current,Rt=Xf(Ot);if(Rt.length===0)return;const oe=Rt[0],he=Rt[Rt.length-1];Ue.shiftKey&&document.activeElement===oe?(Ue.preventDefault(),he.focus()):!Ue.shiftKey&&document.activeElement===he&&(Ue.preventDefault(),oe.focus())};return window.addEventListener("keydown",Ye,!0),()=>{var Ue;cancelAnimationFrame(ue),window.removeEventListener("keydown",Ye,!0),(Ue=g.current)==null||Ue.focus()}},[e]),p.useEffect(()=>{if(!e||!te)return;const ue=requestAnimationFrame(()=>{var Ye,Ue;(Ue=(Ye=h.current)==null?void 0:Ye.querySelector(".template-confirm-actions button"))==null||Ue.focus()});return()=>cancelAnimationFrame(ue)},[e,te]),p.useEffect(()=>{var ue;F(null),M(null),A(""),q(((ue=k[0])==null?void 0:ue.id)??""),x.current=null,be(null)},[n]),p.useEffect(()=>{var ue;D.some(Ye=>Ye.id===re)||q(((ue=D[0])==null?void 0:ue.id)??"")},[D,re]);function Be(ue){F(ue)}if(!e)return null;function le(ue){r?(x.current=document.activeElement instanceof HTMLElement?document.activeElement:null,be(ue)):o(ue)}function De(){const ue=x.current;x.current=null,be(null),requestAnimationFrame(()=>ue==null?void 0:ue.focus())}function W(ue){ue.key==="Enter"&&ue.target===ue.currentTarget&&le(ne)}function ae(ue){P(Ye=>{const Ue=G0(Ye,ue);return V0(Ue),Ue})}function Se(ue){const Ye=K.has(ue.id);return t.jsxs("article",{className:ue.id===(ne==null?void 0:ne.id)?"template-tile selected":"template-tile",children:[t.jsx("button",{className:Ye?"template-tile-favorite on":"template-tile-favorite",type:"button","aria-pressed":Ye,"aria-label":Ye?i("取消收藏{title}",{title:i(ue.title)}):i("收藏{title}",{title:i(ue.title)}),"data-testid":`template-favorite-${ue.id}`,onClick:Ue=>{Ue.stopPropagation(),ae(ue.id)},children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M10 17s-6.3-3.9-8.2-7.2C.5 7.4 2 4 5.2 4c2 0 3.4 1.1 4.8 2.9C11.4 5.1 12.8 4 14.8 4 18 4 19.5 7.4 18.2 9.8 16.3 13.1 10 17 10 17Z"})})}),t.jsx("button",{className:"template-tile-preview",type:"button","aria-label":i("预览{title}",{title:i(ue.title)}),"aria-pressed":ue.id===(ne==null?void 0:ne.id),onClick:()=>q(ue.id),children:t.jsx(Zf,{template:ue})}),t.jsxs("div",{className:"template-tile-copy",children:[t.jsxs("div",{children:[t.jsx("h3",{children:i(ue.title)}),t.jsx("p",{children:i(ue.description)})]}),t.jsx("span",{className:"template-page-count",children:ue.kind==="poster"?i(Rn(ue.format).ratio):i("{n} 页",{n:ue.pageCount})})]}),t.jsx("div",{className:"template-tags",children:ue.tags.map(Ue=>t.jsx("span",{children:i(Ue)},Ue))})]},ue.id)}return t.jsx("div",{className:"template-backdrop",onMouseDown:ue=>{ue.target===ue.currentTarget&&(ue.preventDefault(),m.current?De():l())},children:t.jsxs("div",{ref:h,className:"template-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"template-gallery-title",tabIndex:-1,onKeyDown:W,children:[t.jsxs("header",{className:"template-dialog-head",children:[t.jsxs("div",{children:[t.jsx("p",{className:"template-kicker",children:"DINGCARD / TEMPLATE LIBRARY"}),t.jsx("h2",{id:"template-gallery-title",children:i("从一套成品开始")}),t.jsx("p",{className:"template-dialog-subtitle",children:i("样式和内容都可以继续改,先选一套接近你想法的。")})]}),t.jsx("button",{className:"template-close",type:"button","aria-label":i("关闭模板中心"),title:i("关闭"),onClick:l,children:t.jsx(Pn,{})})]}),t.jsxs("div",{className:"template-dialog-body",children:[t.jsxs("section",{className:"template-list","aria-label":i("模板列表"),children:[t.jsx("input",{className:"template-search",type:"search","data-testid":"template-search","aria-label":i("搜索模板"),placeholder:i("搜索模板,比如:菜单、中秋、读书笔记"),value:z,onChange:ue=>A(ue.target.value)}),w.length>1&&t.jsxs("div",{className:"template-formats template-uses",role:"group","aria-label":i("按用途筛选"),children:[t.jsx("button",{type:"button","aria-pressed":I===null,onClick:()=>M(null),children:i("全部")}),w.map(ue=>t.jsx("button",{type:"button","aria-pressed":I===ue,"data-testid":`template-gallery-use-${ue}`,onClick:()=>M(I===ue?null:ue),children:i(Xi(ue))},ue))]}),v.length>1&&t.jsxs("div",{className:"template-formats",role:"group","aria-label":i("按尺寸筛选"),children:[t.jsx("button",{type:"button","aria-pressed":N===null,onClick:()=>Be(null),children:i("全部尺寸")}),v.map(ue=>t.jsx("button",{type:"button","aria-pressed":N===ue.id,"data-testid":`template-format-${ue.id}`,onClick:()=>Be(ue.id),children:i(ue.name)},ue.id)),t.jsx("button",{type:"button","aria-pressed":T,"data-testid":"template-filter-favorites",onClick:()=>L(ue=>!ue),children:i("收藏")})]}),D.map(Se),D.length===0&&t.jsx("p",{className:"template-search-empty","data-testid":"template-search-empty",children:i("没有找到相关模板,换个关键词或尺寸试试。")})]}),ne&&t.jsxs("aside",{className:"template-detail","aria-label":i("模板详情"),children:[t.jsx("div",{className:"template-detail-preview",children:t.jsx(Zf,{template:ne,detail:!0})}),t.jsxs("div",{className:"template-detail-copy",children:[t.jsx("span",{className:"template-detail-series",children:i(ne.title)}),t.jsx("h3",{children:ne.workspace==="markdown"?i("Markdown 长文排版"):ne.kind==="poster"?i("{name} · {width}×{height}",{name:i(Rn(ne.format).name),width:Rn(ne.format).width,height:Rn(ne.format).height}):i("自由画布轻设计")}),t.jsx("p",{children:i(ne.description)}),t.jsx("p",{className:"template-detail-note",children:ne.workspace==="markdown"?i("{n} 页示例已经排好,正文、主题和字体都可以改。",{n:ne.pageCount}):ne.kind==="poster"?i("文字、图片、颜色和图层都可以改。"):i("{n} 页作品已经排好,文字、颜色、尺寸和图层都可以改。",{n:ne.pageCount})}),t.jsx("button",{className:"template-use",type:"button",onClick:()=>le(ne),children:i("使用这套模板")}),f&&ne.workspace==="markdown"&&t.jsx("button",{className:"template-add",type:"button","data-testid":"template-apply-look",onClick:()=>f(ne),children:i("只换样式")}),c&&ne.workspace==="freeform"&&t.jsx("button",{className:"template-add",type:"button","data-testid":"template-add-to-work",onClick:()=>c(ne),children:i("加到当前作品")})]})]})]}),te&&t.jsx("div",{className:"template-confirm-backdrop",role:"presentation",onMouseDown:ue=>{ue.target===ue.currentTarget&&(ue.preventDefault(),De())},children:t.jsxs("div",{className:"template-confirm",role:"alertdialog","aria-modal":"true","aria-labelledby":"template-confirm-title",children:[t.jsx("p",{className:"template-kicker",children:s?i("当前项目已自动保存"):i("当前内容还没有保存")}),t.jsx("h3",{id:"template-confirm-title",children:i("用这套模板新建项目?")}),t.jsx("p",{children:s?i("模板会作为一个新项目打开,当前项目留在「我的项目」里。"):i("最近的修改还没保存,打开模板后就找不回来了。")}),t.jsxs("div",{className:"template-confirm-actions",children:[t.jsx("button",{className:"template-cancel",type:"button",onClick:De,children:i("继续编辑")}),t.jsx("button",{className:"template-use",type:"button",onClick:()=>{x.current=null,o(te),be(null)},children:i("用模板新建")})]})]})})]})})}function F6(e,n){const r=e.style.justifyContent;r&&(e.style.justifyContent="flex-start");const s=n?e.scrollWidth:e.scrollHeight;return r&&(e.style.justifyContent=r),s}function M6(e,n){const r=[];return D1(e,(s,l)=>{if(s.type!=="text")return;const o=s.vertical===!0,c=n(s.id,o);if(c===null||!Number.isFinite(c)||c<=0)return;const f=Math.ceil(c);o?f>s.width&&r.push({path:l,size:f,dimension:"width"}):f>s.height&&r.push({path:l,size:f,dimension:"height"})}),r}function qf(e,n){return n.height>0&&Math.abs(e.width/e.height-n.width/n.height)<.01}function C6({templates:e,pageSize:n,room:r,onInsert:s}){const l=p.useRef(null),[o,c]=p.useState(null),[f,h]=p.useState(null),[g,x]=p.useState(""),[m,j]=p.useState(null),k=e.find(M=>M.id===o),v=p.useMemo(()=>Md(e),[e]),w=g.trim()!==""||m!==null,N=p.useMemo(()=>w?si(e,{text:g,use:m}):[],[e,g,m,w]),[F]=p.useState(()=>[...Ws].sort((M,z)=>Number(qf(z,n))-Number(qf(M,n))));if(p.useEffect(()=>{var M,z;o||!f||((z=(M=l.current)==null?void 0:M.querySelector(`[data-testid="freeform-template-tile-${CSS.escape(f)}"]`))==null||z.focus(),h(null))},[o,f]),k)return t.jsx(E6,{template:k,room:r,onInsert:s,onBack:()=>{h(k.id),c(null)}});const I=M=>{const z=Rn(M.format),A=M.kind==="poster",T=z.width>z.height*1.2;return t.jsxs("button",{type:"button",className:`freeform-template-tile${T?" is-wide":""}`,"data-testid":`freeform-template-tile-${M.id}`,"aria-label":i(A?"加入{title}":"打开{title}",{title:i(M.title)}),disabled:A&&r<1,onClick:()=>A?s(M,[0]):c(M.id),children:[t.jsx(Zi,{className:"freeform-template-thumb",style:{aspectRatio:`${z.width} / ${z.height}`},children:L=>t.jsx(im,{template:M,frame:{width:L,height:Math.round(L*z.height/z.width)}})}),t.jsx("span",{className:"freeform-template-tile-title",children:i(M.title)}),t.jsx("span",{className:"freeform-template-tile-meta",children:A?i(z.ratio):i("{n} 页",{n:M.pageCount})})]},M.id)};return t.jsxs("div",{className:"freeform-template-list",ref:l,children:[t.jsxs("label",{className:"search-field freeform-template-search",children:[t.jsx(Ma,{}),t.jsx("input",{type:"search","data-testid":"freeform-template-search","aria-label":i("搜索模板"),placeholder:i("搜索模板"),value:g,onChange:M=>x(M.target.value),onKeyDown:M=>{M.key!=="Escape"||!g||(M.preventDefault(),M.stopPropagation(),x(""))}}),g&&t.jsx("button",{className:"tpl-search-clear",type:"button","aria-label":i("清空搜索"),onClick:()=>x(""),children:t.jsx(Pn,{})})]}),v.length>1&&t.jsx("div",{className:"freeform-template-uses",role:"group","aria-label":i("按用途筛选"),children:v.map(M=>t.jsx("button",{type:"button","aria-pressed":m===M,"data-testid":`freeform-template-use-${M}`,onClick:()=>j(m===M?null:M),children:i(Xi(M))},M))}),w&&(N.length>0?t.jsx("div",{className:"freeform-template-tiles",children:N.map(I)}):t.jsx("p",{className:"freeform-template-empty","data-testid":"freeform-template-empty",children:i("没有找到相关模板")})),!w&&F.map(M=>{const z=e.filter(A=>A.format===M.id);return z.length===0?null:t.jsxs(p.Fragment,{children:[t.jsx("div",{className:"freeform-drawer-section",children:i(M.name)}),t.jsx("div",{className:"freeform-template-tiles",children:z.map(I)})]},M.id)})]})}function E6({template:e,room:n,onInsert:r,onBack:s}){const l=p.useRef(null),o=p.useMemo(()=>{var f;return((f=e.createFreeform)==null?void 0:f.call(e).slides)??[]},[e]),c=Rn(e.format);return p.useEffect(()=>{var f;(f=l.current)==null||f.focus()},[]),t.jsxs("div",{className:"freeform-template-pages","data-testid":"freeform-template-pages",onKeyDown:f=>{f.key!=="Escape"||f.defaultPrevented||(f.preventDefault(),s())},children:[t.jsxs("div",{className:"freeform-template-pages-head",children:[t.jsx("button",{ref:l,className:"icon-btn",type:"button","aria-label":i("返回模板列表"),"data-testid":"freeform-template-back",onClick:s,children:t.jsx(Qi,{})}),t.jsx("h3",{children:i(e.title)})]}),t.jsx("button",{className:"accent freeform-drawer-upload",type:"button","data-testid":"freeform-template-add-all",disabled:n<o.length,onClick:()=>r(e,o.map((f,h)=>h)),children:i("加入全部 {n} 页",{n:o.length})}),t.jsx("div",{className:"freeform-template-tiles",children:o.map((f,h)=>t.jsxs("button",{type:"button",className:"freeform-template-tile","data-testid":`freeform-template-page-${h+1}`,"aria-label":i("加入第 {n} 页",{n:h+1}),disabled:n<1,onClick:()=>r(e,[h]),children:[t.jsx(Zi,{className:"freeform-template-thumb",style:{aspectRatio:`${c.width} / ${c.height}`},children:g=>t.jsx(Xs,{slide:f,frameWidth:g,frameHeight:Math.round(g*c.height/c.width),className:"template-freeform-preview",artboardClassName:"template-freeform-artboard"})}),t.jsx("span",{className:"freeform-template-tile-title",children:f.name})]},f.id))})]})}const Qf=[12,14,16,18,20,24,28,32,36,40,48,56,64,72,80,96,112,128,144,160,200,240];function nd(e,n){return n>0?Qf.find(r=>r>e)??Math.round(e*1.25):[...Qf].reverse().find(r=>r<e)??Math.max(1,Math.round(e*.8))}const z6={x:0,y:0,width:24,height:24},R6=2,Hs=[{id:"check",zh:"对勾",en:"Check",keywords:"勾 正确 完成 done tick",d:"M20 6 9 17l-5-5"},{id:"x",zh:"叉",en:"Cross",keywords:"错误 关闭 close wrong",d:"M18 6 6 18M6 6l12 12"},{id:"plus",zh:"加号",en:"Plus",keywords:"添加 add",d:"M5 12h14M12 5v14"},{id:"minus",zh:"减号",en:"Minus",keywords:"remove",d:"M5 12h14"},{id:"circle-check",zh:"圆圈对勾",en:"Check circle",keywords:"完成 正确 success",d:"M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0ZM16 9l-5.5 5.5L8 12"},{id:"circle-x",zh:"圆圈叉",en:"Cross circle",keywords:"错误 失败 error",d:"M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0ZM15 9l-6 6M9 9l6 6"},{id:"circle-alert",zh:"提醒",en:"Alert",keywords:"注意 警告 感叹号 warning",d:"M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0ZM12 8L12 12M12 16L12.01 16"},{id:"triangle-alert",zh:"警告",en:"Warning",keywords:"注意 危险 caution",d:"M21.73 18l-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3M12 9v4M12 17h.01"},{id:"info",zh:"信息",en:"Info",keywords:"说明 提示",d:"M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0ZM12 16v-4M12 8h.01"},{id:"circle-question-mark",zh:"问号",en:"Question",keywords:"疑问 帮助 help",d:"M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0ZM9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3M12 17h.01"},{id:"arrow-right",zh:"右箭头",en:"Arrow right",keywords:"向右 下一步 next",d:"M5 12h14M12 5l7 7-7 7"},{id:"arrow-left",zh:"左箭头",en:"Arrow left",keywords:"向左 返回 back",d:"M12 19l-7-7 7-7M19 12H5"},{id:"arrow-up",zh:"上箭头",en:"Arrow up",keywords:"向上 增长",d:"M5 12l7-7 7 7M12 19V5"},{id:"arrow-down",zh:"下箭头",en:"Arrow down",keywords:"向下 下降",d:"M12 5v14M19 12l-7 7-7-7"},{id:"arrow-up-right",zh:"右上箭头",en:"Arrow up right",keywords:"外链 增长 trend",d:"M7 7h10v10M7 17 17 7"},{id:"chevron-right",zh:"右尖角",en:"Chevron right",keywords:"更多 next",d:"M9 18l6-6-6-6"},{id:"chevron-down",zh:"下尖角",en:"Chevron down",keywords:"展开 more",d:"M6 9l6 6 6-6"},{id:"refresh-cw",zh:"循环",en:"Refresh",keywords:"刷新 重复 loop",d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8M21 3v5h-5M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16M8 16H3v5"},{id:"star",zh:"星星",en:"Star",keywords:"收藏 评分 favorite",d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"},{id:"heart",zh:"爱心",en:"Heart",keywords:"喜欢 心 love like",d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"},{id:"thumbs-up",zh:"点赞",en:"Thumbs up",keywords:"赞 好评 like",d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88ZM7 10v12"},{id:"flame",zh:"火焰",en:"Flame",keywords:"热门 火 hot fire",d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4"},{id:"zap",zh:"闪电",en:"Lightning",keywords:"能量 快 flash",d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z"},{id:"lightbulb",zh:"灯泡",en:"Light bulb",keywords:"想法 灵感 idea tip",d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5M9 18h6M10 22h4"},{id:"sparkles",zh:"闪光",en:"Sparkles",keywords:"亮点 新 magic new",d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594zM20 2v4M22 4h-4M2 20a2 2 0 1 0 4 0a2 2 0 1 0 -4 0Z"},{id:"crown",zh:"皇冠",en:"Crown",keywords:"第一 会员 vip",d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294zM5 21h14"},{id:"trophy",zh:"奖杯",en:"Trophy",keywords:"冠军 获奖 win",d:"M10 14.66V17a1 1 0 0 1-1 1 2 2 0 0 0-2 2v2M14 14.66V17a1 1 0 0 0 1 1 2 2 0 0 1 2 2v2M17.916 10H19.5A2.5 2.5 0 0 0 22 7.5V5a1 1 0 0 0-1-1h-3M4 22h16M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1zM6.084 10H4.5A2.5 2.5 0 0 1 2 7.5V5a1 1 0 0 1 1-1h3"},{id:"award",zh:"奖章",en:"Award",keywords:"认证 荣誉 badge",d:"M15.477 12.89l1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526M6 8a6 6 0 1 0 12 0a6 6 0 1 0 -12 0Z"},{id:"target",zh:"目标",en:"Target",keywords:"靶心 定位 goal",d:"M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0ZM6 12a6 6 0 1 0 12 0a6 6 0 1 0 -12 0ZM10 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0Z"},{id:"rocket",zh:"火箭",en:"Rocket",keywords:"启动 增长 launch",d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2zM9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05"},{id:"gem",zh:"钻石",en:"Gem",keywords:"宝石 精选 premium",d:"M10.5 3 8 9l4 13 4-13-2.5-6M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3zM2 9h20"},{id:"sun",zh:"太阳",en:"Sun",keywords:"晴天 白天 day",d:"M8 12a4 4 0 1 0 8 0a4 4 0 1 0 -8 0ZM12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"},{id:"moon",zh:"月亮",en:"Moon",keywords:"夜晚 晚安 night",d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"},{id:"cloud",zh:"云",en:"Cloud",keywords:"天气 云端 weather",d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"},{id:"umbrella",zh:"雨伞",en:"Umbrella",keywords:"下雨 保护 rain",d:"M12 13v7a2 2 0 0 0 4 0M12 2v2M20.992 13a1 1 0 0 0 .97-1.274 10.284 10.284 0 0 0-19.923 0A1 1 0 0 0 3 13z"},{id:"leaf",zh:"叶子",en:"Leaf",keywords:"自然 环保 nature eco",d:"M11 20a10 10 0 0010-10 25.9 25.9 0 00-1.04-7.281 1 1 0 00-1.755-.325C15.833 5.5 13 5.5 9.8 6.1A7 7 0 0011 20M2 21a5 5 0 012.911-4.544C7.613 15.212 8.351 15.24 11 13"},{id:"flower-2",zh:"花",en:"Flower",keywords:"花朵 春天 spring",d:"M12 5a3 3 0 1 1 3 3m-3-3a3 3 0 1 0-3 3m3-3v1M9 8a3 3 0 1 0 3 3M9 8h1m5 0a3 3 0 1 1-3 3m3-3h-1m-2 3v-1M10 8a2 2 0 1 0 4 0a2 2 0 1 0 -4 0ZM12 10v12M12 22c4.2 0 7-1.667 7-5-4.2 0-7 1.667-7 5ZM12 22c-4.2 0-7-1.667-7-5 4.2 0 7 1.667 7 5Z"},{id:"tree-pine",zh:"树",en:"Tree",keywords:"松树 森林 forest",d:"M17 14l3 3.3a1 1 0 0 1-.7 1.7H4.7a1 1 0 0 1-.7-1.7L7 14h-.3a1 1 0 0 1-.7-1.7L9 9h-.2A1 1 0 0 1 8 7.3L12 3l4 4.3a1 1 0 0 1-.8 1.7H15l3 3.3a1 1 0 0 1-.7 1.7H17ZM12 22v-3"},{id:"snowflake",zh:"雪花",en:"Snowflake",keywords:"冬天 冷 winter",d:"M10 20l-1.25-2.5L6 18M10 4 8.75 6.5 6 6M14 20l1.25-2.5L18 18M14 4l1.25 2.5L18 6M17 21l-3-6h-4M17 3l-3 6 1.5 3M2 12h6.5L10 9M20 10l-1.5 2 1.5 2M22 12h-6.5L14 15M4 10l1.5 2L4 14M7 21l3-6-1.5-3M7 3l3 6h4"},{id:"droplet",zh:"水滴",en:"Drop",keywords:"水 液体 water",d:"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z"},{id:"coffee",zh:"咖啡",en:"Coffee",keywords:"饮品 休息 drink",d:"M10 2v2M14 2v2M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1M6 2v2"},{id:"utensils",zh:"餐具",en:"Utensils",keywords:"吃饭 美食 餐厅 food",d:"M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2M7 2v20M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7"},{id:"cake",zh:"蛋糕",en:"Cake",keywords:"生日 甜点 birthday",d:"M20 21v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8M4 16s.5-1 2-1 2.5 2 4 2 2.5-2 4-2 2.5 2 4 2 2-1 2-1M2 21h20M7 8v3M12 8v3M17 8v3M7 4h.01M12 4h.01M17 4h.01"},{id:"gift",zh:"礼物",en:"Gift",keywords:"礼品 福利 present",d:"M12 7v14M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5M4 7h16a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1Z"},{id:"shopping-bag",zh:"购物袋",en:"Shopping bag",keywords:"购物 买 shop",d:"M16 10a4 4 0 0 1-8 0M3.103 6.034h17.794M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z"},{id:"shopping-cart",zh:"购物车",en:"Cart",keywords:"购物 下单 shop",d:"M2.05 2.05l1.099-.028a1 1 0 0 1 1.008.815l2.69 14.347A1 1 0 0 0 7.83 18H18M4.563 5h16.435a1 1 0 0 1 .981 1.204l-1.026 6.226A2 2 0 0 1 18.962 14H6.25M16 20a2 2 0 1 0 4 0a2 2 0 1 0 -4 0ZM6 20a2 2 0 1 0 4 0a2 2 0 1 0 -4 0Z"},{id:"tag",zh:"标签",en:"Tag",keywords:"价格 分类 price label",d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42zM7 7.5a0.5 0.5 0 1 0 1 0a0.5 0.5 0 1 0 -1 0Z"},{id:"bookmark",zh:"书签",en:"Bookmark",keywords:"收藏 保存 save",d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z"},{id:"flag",zh:"旗帜",en:"Flag",keywords:"目标 里程碑 milestone",d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528"},{id:"map-pin",zh:"定位",en:"Location",keywords:"地点 地图 位置 place",d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0M9 10a3 3 0 1 0 6 0a3 3 0 1 0 -6 0Z"},{id:"globe",zh:"地球",en:"Globe",keywords:"世界 国际 网络 world web",d:"M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0ZM12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20M2 12h20"},{id:"house",zh:"房子",en:"Home",keywords:"家 首页 house",d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"},{id:"building",zh:"大楼",en:"Building",keywords:"公司 办公 office",d:"M12 10h.01M12 14h.01M12 6h.01M16 10h.01M16 14h.01M16 6h.01M8 10h.01M8 14h.01M8 6h.01M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3M6 2h12a2 2 0 0 1 2 2v16a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-16a2 2 0 0 1 2 -2Z"},{id:"calendar",zh:"日历",en:"Calendar",keywords:"日期 日程 date",d:"M8 2v3M16 2v3M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2ZM3 9h18"},{id:"clock",zh:"时钟",en:"Clock",keywords:"时间 time",d:"M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0ZM12 6v6l4 2"},{id:"timer",zh:"计时",en:"Timer",keywords:"倒计时 秒表 countdown",d:"M10 2L14 2M12 14L15 11M4 14a8 8 0 1 0 16 0a8 8 0 1 0 -16 0Z"},{id:"bell",zh:"铃铛",en:"Bell",keywords:"通知 提醒 notification",d:"M10.268 21a2 2 0 0 0 3.464 0M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"},{id:"mail",zh:"邮件",en:"Mail",keywords:"信封 email",d:"M22 7l-8.991 5.727a2 2 0 0 1-2.009 0L2 7M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-16a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2Z"},{id:"phone",zh:"电话",en:"Phone",keywords:"联系 call",d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"},{id:"message-circle",zh:"对话",en:"Chat",keywords:"消息 评论 聊天 comment",d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"},{id:"quote",zh:"引号",en:"Quote",keywords:"引用 名言",d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2zM5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"},{id:"camera",zh:"相机",en:"Camera",keywords:"拍照 摄影 photo",d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4zM9 13a3 3 0 1 0 6 0a3 3 0 1 0 -6 0Z"},{id:"image",zh:"图片",en:"Image",keywords:"照片 picture",d:"M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2ZM7 9a2 2 0 1 0 4 0a2 2 0 1 0 -4 0ZM21 15l-3.086-3.086a2 2 0 0 0-2.828 0L6 21"},{id:"music",zh:"音乐",en:"Music",keywords:"音符 歌 song",d:"M9 18V5l12-2v13M3 18a3 3 0 1 0 6 0a3 3 0 1 0 -6 0ZM15 16a3 3 0 1 0 6 0a3 3 0 1 0 -6 0Z"},{id:"video",zh:"视频",en:"Video",keywords:"录像 影片 film",d:"M16 13l5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5M4 6h10a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-8a2 2 0 0 1 2 -2Z"},{id:"play",zh:"播放",en:"Play",keywords:"开始 start",d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"},{id:"pause",zh:"暂停",en:"Pause",keywords:"停止",d:"M15 3h3a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-3a1 1 0 0 1 -1 -1v-16a1 1 0 0 1 1 -1ZM6 3h3a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-3a1 1 0 0 1 -1 -1v-16a1 1 0 0 1 1 -1Z"},{id:"headphones",zh:"耳机",en:"Headphones",keywords:"听 音频 audio",d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3"},{id:"user",zh:"人物",en:"User",keywords:"用户 个人 person",d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2M8 7a4 4 0 1 0 8 0a4 4 0 1 0 -8 0Z"},{id:"users",zh:"人群",en:"Users",keywords:"团队 用户 team people",d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M16 3.128a4 4 0 0 1 0 7.744M22 21v-2a4 4 0 0 0-3-3.87M5 7a4 4 0 1 0 8 0a4 4 0 1 0 -8 0Z"},{id:"face-slightly-smiling",zh:"笑脸",en:"Smile",keywords:"开心 微笑 happy",d:"M15 10V9M16.472 15a6 6 0 01-8.943 0M9 10V9M2 12a10 10 0 1 0 20 0a10 10 0 1 0 -20 0Z"},{id:"briefcase",zh:"公文包",en:"Briefcase",keywords:"工作 职场 work",d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16M4 6h16a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-16a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2Z"},{id:"graduation-cap",zh:"学士帽",en:"Graduation cap",keywords:"学习 教育 毕业 school",d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0zM22 10v6M6 12.5V16a6 3 0 0 0 12 0v-3.5"},{id:"book-open",zh:"书本",en:"Book",keywords:"阅读 学习 read",d:"M12 5v16M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z"},{id:"pencil",zh:"铅笔",en:"Pencil",keywords:"写 编辑 edit write",d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497zM15 5l4 4"},{id:"clipboard-list",zh:"清单",en:"Checklist",keywords:"列表 待办 todo list",d:"M9 2h6a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-6a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1ZM16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2M12 11h4M12 16h4M8 11h.01M8 16h.01"},{id:"list-checks",zh:"勾选列表",en:"Checked list",keywords:"待办 完成 todo",d:"M13 5h8M13 12h8M13 19h8M3 17l2 2 4-4M3 7l2 2 4-4"},{id:"trending-up",zh:"上升趋势",en:"Trending up",keywords:"增长 数据 growth",d:"M16 7h6v6M22 7l-8.5 8.5-5-5L2 17"},{id:"chart-column",zh:"柱状图",en:"Bar chart",keywords:"数据 统计 chart",d:"M3 3v16a2 2 0 0 0 2 2h16M18 17V9M13 17V5M8 17v-3"},{id:"chart-pie",zh:"饼图",en:"Pie chart",keywords:"数据 占比 chart",d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1zM21.21 15.89A10 10 0 1 1 8 2.83"},{id:"dollar-sign",zh:"美元",en:"Dollar",keywords:"钱 价格 money",d:"M12 2L12 22M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"},{id:"percent",zh:"百分号",en:"Percent",keywords:"折扣 比例 discount",d:"M19 5L5 19M4 6.5a2.5 2.5 0 1 0 5 0a2.5 2.5 0 1 0 -5 0ZM15 17.5a2.5 2.5 0 1 0 5 0a2.5 2.5 0 1 0 -5 0Z"},{id:"lock",zh:"锁",en:"Lock",keywords:"安全 隐私 secure",d:"M5 11h14a2 2 0 0 1 2 2v7a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-7a2 2 0 0 1 2 -2ZM7 11V7a5 5 0 0 1 10 0v4"},{id:"key-round",zh:"钥匙",en:"Key",keywords:"密码 关键 password",d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4zM16 7.5a0.5 0.5 0 1 0 1 0a0.5 0.5 0 1 0 -1 0Z"},{id:"shield-check",zh:"盾牌",en:"Shield",keywords:"安全 保障 protect",d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1zM9 12l2 2 4-4"},{id:"settings",zh:"设置",en:"Settings",keywords:"齿轮 配置 gear",d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915M9 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0Z"},{id:"search",zh:"搜索",en:"Search",keywords:"放大镜 查找 find",d:"M21 21l-4.34-4.34M3 11a8 8 0 1 0 16 0a8 8 0 1 0 -16 0Z"},{id:"link",zh:"链接",en:"Link",keywords:"网址 关联 url",d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"},{id:"download",zh:"下载",en:"Download",keywords:"保存 save",d:"M12 15V3M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5"},{id:"upload",zh:"上传",en:"Upload",keywords:"发布",d:"M12 3v12M17 8l-5-5-5 5M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"},{id:"share-2",zh:"分享",en:"Share",keywords:"转发",d:"M15 5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0ZM3 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0ZM15 19a3 3 0 1 0 6 0a3 3 0 1 0 -6 0ZM8.59 13.51L15.42 17.49M15.41 6.51L8.59 10.49"},{id:"send",zh:"发送",en:"Send",keywords:"纸飞机 投递",d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11zM21.854 2.147l-10.94 10.939"},{id:"wifi",zh:"无线网",en:"Wi-Fi",keywords:"网络 信号 wireless",d:"M12 20h.01M2 8.82a15 15 0 0 1 20 0M5 12.859a10 10 0 0 1 14 0M8.5 16.429a5 5 0 0 1 7 0"},{id:"car",zh:"汽车",en:"Car",keywords:"出行 开车 drive",d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2M5 17a2 2 0 1 0 4 0a2 2 0 1 0 -4 0ZM9 17h6M15 17a2 2 0 1 0 4 0a2 2 0 1 0 -4 0Z"},{id:"plane",zh:"飞机",en:"Plane",keywords:"旅行 出差 travel flight",d:"M17.8 19.2 16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z"},{id:"train-front",zh:"火车",en:"Train",keywords:"高铁 出行 rail",d:"M8 3.1V7a4 4 0 0 0 8 0V3.1M9 15l-1-1M15 15l1-1M9 19c-2.8 0-5-2.2-5-5v-4a8 8 0 0 1 16 0v4c0 2.8-2.2 5-5 5ZM8 19l-2 3M16 19l2 3"},{id:"bike",zh:"自行车",en:"Bike",keywords:"骑行 运动 cycle",d:"M15 17.5a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0ZM2 17.5a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0ZM14 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0ZM12 17.5V14l-3-3 4-3 2 3h2"}],I6=new Map(Hs.map(e=>[e.id,e])),L6=new Map(Hs.map(e=>[e.zh,e]));function $6(e){return I6.get(e)}function D6(e){return L6.get(e)}function A6(e){return`${e.id} ${e.zh} ${e.en} ${e.keywords}`.toLowerCase()}function P6(e){const n=e.trim().toLowerCase().split(/\s+/).filter(Boolean);if(n.length===0)return[...Hs];const r=n.join(" "),s=l=>{const o=[l.id,l.zh,l.en.toLowerCase()];return o.includes(r)?0:l.keywords.toLowerCase().split(" ").includes(r)?1:o.some(c=>c.startsWith(r))?2:3};return Hs.filter(l=>{const o=A6(l);return n.every(c=>o.includes(c))}).map((l,o)=>({icon:l,order:o,rank:s(l)})).sort((l,o)=>l.rank-o.rank||l.order-o.order).map(l=>l.icon)}const st=1/2,Mn=1/3,om=[{id:"pair",label:"两张并排",aspect:1.6,cells:[{x:0,y:0,width:st,height:1},{x:st,y:0,width:st,height:1}]},{id:"top-feature",label:"一大两小",aspect:1.2,cells:[{x:0,y:0,width:1,height:st},{x:0,y:st,width:st,height:st},{x:st,y:st,width:st,height:st}]},{id:"bottom-feature",label:"两小一大",aspect:1.2,cells:[{x:0,y:0,width:st,height:st},{x:st,y:0,width:st,height:st},{x:0,y:st,width:1,height:st}]},{id:"triple",label:"三等分",aspect:1.5,cells:[{x:0,y:0,width:Mn,height:1},{x:Mn,y:0,width:Mn,height:1},{x:Mn*2,y:0,width:Mn,height:1}]},{id:"quad",label:"四宫格",aspect:1,cells:[{x:0,y:0,width:st,height:st},{x:st,y:0,width:st,height:st},{x:0,y:st,width:st,height:st},{x:st,y:st,width:st,height:st}]},{id:"six",label:"六宫格",aspect:.75,cells:[{x:0,y:0,width:st,height:Mn},{x:st,y:0,width:st,height:Mn},{x:0,y:Mn,width:st,height:Mn},{x:st,y:Mn,width:st,height:Mn},{x:0,y:Mn*2,width:st,height:Mn},{x:st,y:Mn*2,width:st,height:Mn}]}];function lm(e){return om.find(n=>n.id===e)}const T6="#e4e4e7",W6="#d4d4d8";function H6(e,n){const r=Math.round(n.width*.8),s=Math.round(n.height*.8*e.aspect),l=Math.min(r,s),o=Math.round(l/e.aspect);return{x:Math.round((n.width-l)/2),y:Math.round((n.height-o)/2),width:l,height:o}}function O6(e,n={}){const r=n.gap??12,s=n.cornerRadius??12,l=n.createId??(()=>fi()),o=n.box??{x:0,y:0,width:600,height:600/e.aspect},c=e.cells.map((f,h)=>({id:l(),name:`图片位 ${h+1}`,locked:!1,hidden:!1,type:"shape",x:Math.round(f.x*o.width+r/2),y:Math.round(f.y*o.height+r/2),width:Math.max(1,Math.round(f.width*o.width-r)),height:Math.max(1,Math.round(f.height*o.height-r)),rotation:0,scale:1,shape:"rect",fill:{type:"solid",color:T6},stroke:W6,strokeWidth:1,cornerRadius:s}));return{id:l(),name:"拼图",locked:!1,hidden:!1,type:"group",x:o.x,y:o.y,rotation:0,scale:1,children:c}}const zd="application/x-dingcard-element",Rd=[{id:"rect",label:"矩形"},{id:"ellipse",label:"圆形"},{id:"triangle",label:"三角形"},{id:"diamond",label:"菱形"},{id:"pentagon",label:"五边形"},{id:"hexagon",label:"六边形"},{id:"star",label:"五角星"},{id:"heart",label:"心形"},{id:"bubble",label:"对话气泡"}],cm=[{id:"line",label:"直线"},{id:"arrow",label:"箭头"},{id:"arrow",label:"双向箭头",bothEnds:!0}];function wc(e){return Array.from(e.types).includes(zd)}function _6(e){try{const n=JSON.parse(e.getData(zd));if(n.kind==="qrcode")return{kind:"qrcode"};if(n.kind==="chart")return{kind:"chart"};if(typeof n.id!="string")return null;const r=n.id;return n.kind==="shape"&&Rd.some(s=>s.id===r)?{kind:"shape",id:r}:n.kind==="line"&&cm.some(s=>s.id===r&&!!s.bothEnds==!!n.bothEnds)?{kind:"line",id:r,...n.bothEnds===!0?{bothEnds:!0}:{}}:n.kind==="collage"&&lm(r)?{kind:"collage",id:r}:n.kind==="decoration"&&Yi.some(s=>s.id===r)?{kind:"decoration",id:r}:n.kind==="icon"&&Hs.some(s=>s.id===r)?{kind:"icon",id:r}:null}catch{return null}}function Di(e){return{draggable:!0,onDragStart:n=>{n.dataTransfer.setData(zd,JSON.stringify(e)),n.dataTransfer.effectAllowed="copy"}}}function B6(e,n){const r=gd(e),s=240,l=r.height*s/r.width,o=18;let c=0;return{id:`decoration-preview-${e.id}`,name:e.zh,width:Math.round(s+o*2),height:Math.round(l+o*2),background:{type:"transparent"},nodes:[xd(e,{x:o,y:o,width:s,language:n},()=>`decoration-preview-${e.id}-${c++}`)]}}function Go(e,n){const r=n.trim().toLowerCase().split(/\s+/).filter(Boolean),s=`${e} ${i(e)}`.toLowerCase();return r.every(l=>s.includes(l))}const K6=p.memo(function({onPick:n}){const r=ra(),s=r==="en"?"en":"zh",[l,o]=p.useState(""),c=l.trim().length>0,f=p.useMemo(()=>Rd.filter(w=>!c||Go(w.label,l)),[l,c,r]),h=p.useMemo(()=>cm.filter(w=>!c||Go(w.label,l)),[l,c,r]),g=p.useMemo(()=>om.filter(w=>!c||Go(w.label,l)),[l,c,r]),x=p.useMemo(()=>bx(l),[l]),m=p.useMemo(()=>P6(l),[l]),j=p.useMemo(()=>[{id:"qrcode",label:"二维码"},{id:"chart",label:"图表"},{id:"table",label:"表格"},{id:"timeline",label:"时间线"},{id:"progress",label:"进度"}].filter(w=>!c||Go(w.label,l)),[l,c,r]),k=p.useMemo(()=>new Map(Yi.map(w=>[w.id,B6(w,s)])),[s]),v=f.length+h.length+g.length+x.length+m.length+j.length===0;return t.jsxs(t.Fragment,{children:[t.jsxs("label",{className:"search-field freeform-element-search",children:[t.jsx(Ma,{}),t.jsx("input",{type:"search",value:l,placeholder:i("搜索元素"),"aria-label":i("搜索元素"),"data-testid":"freeform-element-search",onChange:w=>o(w.currentTarget.value)})]}),f.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"freeform-drawer-section",children:i("形状")}),t.jsx("div",{className:"freeform-element-tiles",role:"group","aria-label":i("形状"),children:f.map(w=>t.jsxs("button",{type:"button",className:"freeform-element-tile","data-testid":`insert-shape-${w.id}`,...Di({kind:"shape",id:w.id}),onClick:()=>n({kind:"shape",id:w.id}),children:[t.jsx(Bi,{shape:w.id}),t.jsx("span",{children:i(w.label)})]},w.id))})]}),h.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"freeform-drawer-section",children:i("线条")}),t.jsx("div",{className:"freeform-element-tiles",role:"group","aria-label":i("线条"),children:h.map(w=>t.jsxs("button",{type:"button",className:"freeform-element-tile","data-testid":`insert-line-${w.bothEnds?"arrow-both":w.id}`,...Di({kind:"line",id:w.id,bothEnds:w.bothEnds}),onClick:()=>n({kind:"line",id:w.id,bothEnds:w.bothEnds}),children:[t.jsx(Bi,{shape:w.bothEnds?"arrowBoth":w.id}),t.jsx("span",{children:i(w.label)})]},w.bothEnds?"arrow-both":w.id))})]}),j.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"freeform-drawer-section",children:i("实用")}),t.jsx("div",{className:"freeform-element-tiles",role:"group","aria-label":i("实用"),children:j.map(w=>t.jsxs("button",{type:"button",className:"freeform-element-tile","data-testid":`insert-${w.id}`,...Di(w.id==="qrcode"||w.id==="chart"||w.id==="table"||w.id==="timeline"||w.id==="progress"?{kind:w.id}:{kind:"chart"}),onClick:()=>n(w.id==="qrcode"||w.id==="chart"||w.id==="table"||w.id==="timeline"||w.id==="progress"?{kind:w.id}:{kind:"chart"}),children:[t.jsx(Bi,{shape:w.id}),t.jsx("span",{children:i(w.label)})]},w.id))})]}),g.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"freeform-drawer-section",children:i("拼图")}),t.jsx("div",{className:"freeform-element-tiles",role:"group","aria-label":i("拼图"),children:g.map(w=>t.jsxs("button",{type:"button",className:"freeform-element-tile","data-testid":`insert-collage-${w.id}`,...Di({kind:"collage",id:w.id}),onClick:()=>n({kind:"collage",id:w.id}),children:[t.jsx("span",{className:"collage-preview","aria-hidden":"true",style:{aspectRatio:`${w.aspect}`},children:w.cells.map((N,F)=>t.jsx("span",{style:{left:`${N.x*100}%`,top:`${N.y*100}%`,width:`${N.width*100}%`,height:`${N.height*100}%`}},F))}),t.jsx("span",{children:i(w.label)})]},w.id))})]}),cx.map(w=>{const N=x.filter(I=>I.category===w.id);if(N.length===0)return null;const F=s==="en"?w.en:w.zh;return t.jsxs("div",{className:"freeform-decoration-group",children:[t.jsx("div",{className:"freeform-drawer-section",children:F}),t.jsx("div",{className:`freeform-decoration-grid is-${w.id}`,role:"group","aria-label":F,children:N.map(I=>{const M=s==="en"?I.en:I.zh,z=w.id==="label";return t.jsx("button",{type:"button",className:"freeform-decoration-tile","data-testid":`insert-decoration-${I.id}`,"aria-label":M,title:M,...Di({kind:"decoration",id:I.id}),onClick:()=>n({kind:"decoration",id:I.id}),children:t.jsx(Xs,{slide:k.get(I.id),frameWidth:z?72:46,frameHeight:z?48:46,className:"freeform-decoration-preview"})},I.id)})})]},w.id)}),m.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"freeform-drawer-section",children:i("图标")}),t.jsx("div",{className:"freeform-icon-grid",role:"group","aria-label":i("图标"),children:m.map(w=>{const N=r==="en"?w.en:w.zh;return t.jsx("button",{type:"button",className:"freeform-icon-tile","data-testid":`insert-icon-${w.id}`,"aria-label":N,title:N,...Di({kind:"icon",id:w.id}),onClick:()=>n({kind:"icon",id:w.id}),children:t.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:t.jsx("path",{d:w.d})})},w.id)})})]}),v&&t.jsx("p",{className:"freeform-element-empty","data-testid":"freeform-element-empty",children:i("没有找到元素")})]})}),rd="__import-font__";function dm(e){const n=Hc.find(s=>s.id===e);if(n)return n;const r=Wc(e).toLowerCase();return Hc.find(s=>Wc(s.id).toLowerCase()===r)}function Os(e){const n=dm(e);return n?i(n.label):Wc(e)||e}function Id(e){var n;return((n=dm(e))==null?void 0:n.id)??e}function um(e,{current:n,withImport:r=!1}={}){const s=[...Hc.map(l=>({id:l.id,label:i(l.label)})),...e.map(l=>({id:dd(l.family),label:l.family}))];if(n!==void 0){const l=Id(n);s.some(o=>o.id===l)||s.push({id:l,label:Os(l)})}return r&&s.push({id:rd,label:i("导入字体…"),previewFont:"inherit"}),s}const V6=p.memo(function({onRestyle:n}){return ra(),t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"freeform-drawer-section",children:i("搭配")}),t.jsx("div",{className:"freeform-looks",children:A1.map(r=>{const s=Qu.find(o=>o.id===r.palette),l=Ju.find(o=>o.id===r.fontSet);return t.jsxs("button",{type:"button",className:"freeform-look","data-testid":`style-look-${r.id}`,onClick:()=>n({palette:r.palette,fontSet:r.fontSet}),children:[t.jsxs("span",{className:"freeform-look-page",style:{background:s.background,color:s.text},"aria-hidden":"true",children:[t.jsx("span",{className:"freeform-look-title",style:{fontFamily:l.heading},children:i("标题")}),t.jsx("i",{className:"freeform-look-accent",style:{background:s.accents[0]}}),t.jsx("span",{className:"freeform-look-body",style:{fontFamily:l.body},children:i("正文内容")})]}),t.jsx("span",{className:"freeform-palette-name",children:i(r.name)})]},r.id)})}),t.jsx("div",{className:"freeform-drawer-section",children:i("配色")}),t.jsx("div",{className:"freeform-palettes",children:Qu.map(r=>t.jsxs("button",{type:"button",className:"freeform-palette","data-testid":`style-palette-${r.id}`,onClick:()=>n({palette:r.id}),children:[t.jsxs("span",{className:"freeform-palette-chip",style:{background:r.background,color:r.text},"aria-hidden":"true",children:["Aa",t.jsx("span",{className:"freeform-palette-accents",children:r.accents.map(s=>t.jsx("i",{style:{background:s}},s))})]}),t.jsx("span",{className:"freeform-palette-name",children:i(r.name)})]},r.id))}),t.jsx("div",{className:"freeform-drawer-section",children:i("字体组合")}),t.jsx("div",{className:"freeform-font-sets",children:Ju.map(r=>t.jsxs("button",{type:"button",className:"freeform-font-set","data-testid":`style-font-set-${r.id}`,onClick:()=>n({fontSet:r.id}),children:[t.jsx("span",{className:"freeform-font-set-name",style:{fontFamily:r.heading},children:i(r.name)}),t.jsxs("span",{className:"freeform-font-set-body",children:[t.jsx("span",{style:{fontFamily:r.heading},children:Os(r.heading)}),r.body!==r.heading&&t.jsxs(t.Fragment,{children:[" + ",t.jsx("span",{style:{fontFamily:r.body},children:Os(r.body)})]})]})]},r.id))})]})}),G6=10,fm="slicer.recent-colors.v1";function hm(e){return typeof e=="string"&&/^#[0-9a-fA-F]{6}$/.test(e)}function Ld(e){if(!Array.isArray(e))return[];const n=new Set,r=[];for(const s of e){if(!hm(s))continue;const l=s.toLowerCase();if(!n.has(l)&&(n.add(l),r.push(l),r.length>=G6))break}return r}function kc(){try{const e=localStorage.getItem(fm);return e?Ld(JSON.parse(e)):[]}catch{return[]}}function U6(e){try{localStorage.setItem(fm,JSON.stringify(Ld(e)))}catch{}}function Y6(e,n){if(!hm(n))return[...e];const r=n.toLowerCase();return Ld([r,...e])}const mm=p.createContext(null),Z6=["#18181b","#52525b","#ffffff","#b34d4d","#fed7aa","#f97316","#ef4444","#eab308","#22c55e","#14b8a6","#3b82f6","#8b5cf6"];function sl(e){return e.type==="solid"||e.type==="linear-gradient"||e.type==="radial-gradient"}function X6(e,n){return sl(e)?e:n}function q6(e){return e.type==="pattern"?"solid":e.type}function pm(e){return Number.isFinite(e)?Math.max(0,Math.min(255,Math.round(e))):0}function ad(e){const n=ar(e)?e.slice(1):"000000";return{r:Number.parseInt(n.slice(0,2),16),g:Number.parseInt(n.slice(2,4),16),b:Number.parseInt(n.slice(4,6),16)}}function gl({r:e,g:n,b:r}){return`#${[e,n,r].map(s=>pm(s).toString(16).padStart(2,"0")).join("")}`}function Jf(e,n){const r=ad(e),s=ad(n);return gl({r:Math.round((r.r+s.r)/2),g:Math.round((r.g+s.g)/2),b:Math.round((r.b+s.b)/2)})}function Q6(e,n){const r={...n,[e]:0},s={...n,[e]:255};return`linear-gradient(90deg, ${gl(r)}, ${gl(s)})`}function eh(){const e=window.EyeDropper;return typeof e=="function"?e:null}function vt({label:e,color:n,onChange:r,testId:s="paint-color-button",variant:l="swatch"}){const o=p.useRef(null),c=p.useRef(null),[f,h]=p.useState(!1),[g,x]=p.useState(kc),[m,j]=p.useState(!1),k=p.useRef(null),v=p.useContext(mm),[w,N]=p.useState(null),F=ad(n),I=n==="transparent";function M(){x(kc()),k.current=null,N(ar(n)?n.toLowerCase():null),h(!0)}function z(){const K=k.current;if(K){const D=Y6(kc(),K);U6(D),x(D)}k.current=null,h(!1)}function A(K){ar(K)&&(k.current=K),r(K)}async function T(){const K=eh();if(!(!K||m)){j(!0);try{const D=await new K().open();ar(D.sRGBHex)&&A(D.sRGBHex)}catch{}finally{j(!1)}}}p.useEffect(()=>{if(!f)return;function K(re){const q=o.current;q&&!q.contains(re.target)&&z()}function D(re){re.key==="Escape"&&(re.preventDefault(),re.stopPropagation(),z(),requestAnimationFrame(()=>{var q;return(q=c.current)==null?void 0:q.focus()}))}return window.addEventListener("pointerdown",K,!0),window.addEventListener("keydown",D,!0),()=>{window.removeEventListener("pointerdown",K,!0),window.removeEventListener("keydown",D,!0)}},[f]);function L(K,D){A(gl({...F,[K]:pm(Number(D))}))}const H=(v==null?void 0:v.colors.slice(0,12))??[],P=ar(n)?n.toLowerCase():null,U=!!(v&&w&&P&&P!==w&&v.colors.includes(w));return t.jsxs("div",{className:"paint-color",ref:o,children:[t.jsx("button",{ref:c,type:"button",className:`paint-color-button${I?" is-empty":""}${l==="text"?" is-text":""}`,"data-testid":s,"aria-label":e,"aria-haspopup":"dialog","aria-expanded":f,style:l==="text"?{"--paint-color":n}:I?void 0:{background:n},onClick:()=>f?z():M(),children:l==="text"&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"paint-color-letter","aria-hidden":"true",children:"A"}),t.jsx("span",{className:"paint-color-bar","aria-hidden":"true"})]})}),f&&t.jsxs("div",{className:"paint-popover","data-testid":"paint-popover",role:"dialog","aria-label":i("{label} 色板",{label:e}),children:[t.jsxs("div",{className:"paint-popover-head",children:[t.jsx("span",{className:"paint-popover-sample",style:{background:n}}),t.jsx("input",{className:"paint-popover-hex",value:n,"aria-label":i("{label} 自定义 HEX",{label:e}),onChange:K=>{const D=K.currentTarget.value;ar(D)&&A(D)}}),eh()&&t.jsx("button",{type:"button",className:"paint-eyedropper","data-testid":"paint-eyedropper","aria-label":i("{label} 屏幕取色",{label:e}),title:i("屏幕取色"),disabled:m,onClick:()=>{T()},children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M13.4 3.6a2.5 2.5 0 0 1 3.5 3.5l-1.5 1.4 1.1 1.1-1.4 1.4-1.1-1.1-6 6-3 0.7 0.7-3 6-6-1.1-1.1 1.4-1.4 1.1 1.1 1.4-1.5z"})})})]}),H.length>0&&t.jsx("div",{className:"paint-swatch-grid paint-deck-grid","aria-label":i("{label} 本设计用色",{label:e}),"data-testid":"paint-deck-grid",children:H.map(K=>t.jsx("button",{type:"button",className:"paint-swatch","aria-label":i("{label} 本设计 {color}",{label:e,color:K}),style:{background:K},onClick:()=>A(K)},K))}),t.jsx("div",{className:"paint-swatch-grid","aria-label":i("{label} 常用颜色",{label:e}),children:Z6.map(K=>t.jsx("button",{type:"button",className:"paint-swatch","aria-label":`${e} ${K}`,style:{background:K},onClick:()=>A(K)},K))}),g.length>0&&t.jsx("div",{className:"paint-swatch-grid paint-recent-grid","aria-label":i("{label} 最近使用",{label:e}),"data-testid":"paint-recent-grid",children:g.map(K=>t.jsx("button",{type:"button",className:"paint-swatch","data-testid":"paint-recent-swatch","aria-label":i("{label} 最近 {color}",{label:e,color:K}),style:{background:K},onClick:()=>A(K)},K))}),t.jsx("div",{className:"paint-channel-list",children:["r","g","b"].map(K=>t.jsxs("label",{className:"paint-channel",children:[t.jsx("span",{children:K.toUpperCase()}),t.jsx("input",{className:"paint-channel-range",type:"range",min:"0",max:"255",value:F[K],style:{backgroundImage:Q6(K,F)},onChange:D=>L(K,D.currentTarget.value)}),t.jsx("input",{className:"paint-channel-number",type:"number",min:"0",max:"255",value:F[K],onChange:D=>L(K,D.currentTarget.value)})]},K))}),U&&v&&w&&P&&t.jsxs("button",{type:"button",className:"paint-replace-all","data-testid":"paint-replace-all",title:i("把整套里的 {from} 都换成 {to}",{from:w,to:P}),onClick:()=>{v.replace(w,P),N(P)},children:[t.jsx("span",{className:"paint-replace-chip",style:{background:w},"aria-hidden":"true"}),t.jsx("span",{className:"paint-replace-arrow","aria-hidden":"true",children:"→"}),t.jsx("span",{className:"paint-replace-chip",style:{background:P},"aria-hidden":"true"}),i("全部替换")]})]})]})}function Uo({label:e,value:n,modes:r,onChange:s,fallbackPaint:l=Oc,onChooseImage:o,onClearImage:c,onImageFitChange:f,onAdjustImageFraming:h,onResetImageFraming:g,imageFramingDisabled:x=!1,imageFramingDisabledReason:m,imageFramingResetDisabled:j=!0}){const k=q6(n),v=X6(n,l),w=hc(v);function N(P){if(P!==k){if(P==="solid")s(sl(n)?T1(n):l);else if(P==="linear-gradient")s(sl(n)?hc(n):hc(l));else if(P==="radial-gradient")s(sl(n)?nf(n):nf(l));else if(P==="transparent")s({type:"transparent"});else if(P==="image"){if(n.type==="image")return;o==null||o()}}}function F(P){ar(P)&&s({type:"solid",color:P})}function I(P){k==="radial-gradient"||Br(w)||s({...w,...P,type:"linear-gradient"})}function M(P){if(k==="radial-gradient"){s({type:"radial-gradient",stops:P});return}s({type:"linear-gradient",stops:P,angle:w.angle})}function z(P){k!=="radial-gradient"&&s(Br(w)?{type:"linear-gradient",stops:w.stops,angle:P}:{...w,angle:P,type:"linear-gradient"})}function A(){if(Br(w)){if(w.stops.length>=tf)return;const P=w.stops;let U=0,K=-1;for(let te=0;te<P.length-1;te+=1){const be=P[te+1].offset-P[te].offset;be>K&&(K=be,U=te)}const D=P[U],re=P[U+1],q=[...P];q.splice(U+1,0,{offset:(D.offset+re.offset)/2,color:Jf(D.color,re.color)}),M(q);return}s({type:"linear-gradient",angle:w.angle,stops:[{offset:0,color:w.from},{offset:.5,color:Jf(w.from,w.to)},{offset:1,color:w.to}]})}function T(P,U){Br(w)&&M(w.stops.map((K,D)=>D===P?{...K,color:U}:{...K}))}function L(P,U){if(!Br(w)||!Number.isFinite(U))return;const K=w.stops,D=P===0?0:Math.floor(K[P-1].offset*100)+1,re=P===K.length-1?100:Math.ceil(K[P+1].offset*100)-1,q=Math.max(D,Math.min(re,Math.round(U)));M(K.map((te,be)=>be===P?{...te,offset:q/100}:{...te}))}function H(P){!Br(w)||w.stops.length<=ef||M(w.stops.filter((U,K)=>K!==P))}return t.jsxs("div",{className:"paint-field","data-testid":"freeform-paint-field",children:[t.jsx("div",{className:"field-label",children:e}),t.jsx("div",{className:"seg stretch paint-mode","aria-label":i("{label} 类型",{label:e}),children:r.map(P=>t.jsx("button",{type:"button",className:k===P?"seg-btn on":"seg-btn","data-testid":`paint-mode-${P}`,"aria-label":P==="image"?i("插入图片填充"):void 0,onClick:()=>N(P),children:P==="solid"?i("纯色"):P==="linear-gradient"?i("渐变"):P==="radial-gradient"?i("径向"):P==="transparent"?i("透明"):i("图片")},P))}),k==="solid"&&t.jsxs("div",{className:"paint-row",children:[t.jsx(vt,{label:i("{label} 颜色",{label:e}),color:ci(v),onChange:F}),t.jsx("input",{className:"paint-hex",value:ci(v),onChange:P=>F(P.currentTarget.value),"aria-label":`${e} hex`})]}),(k==="linear-gradient"||k==="radial-gradient")&&t.jsxs("div",{className:"paint-gradient",children:[Br(w)?t.jsx("div",{className:"paint-stops","data-testid":"paint-stops-list",children:w.stops.map((P,U)=>t.jsxs("div",{className:"paint-row paint-stop-row",children:[t.jsx(vt,{label:i("{label} 色标 {n} 颜色",{label:e,n:U+1}),color:P.color,onChange:K=>T(U,K)}),t.jsx("input",{className:"paint-hex",value:P.color,onChange:K=>ar(K.currentTarget.value)&&T(U,K.currentTarget.value),"aria-label":i("{label} 色标 {n} hex",{label:e,n:U+1})}),t.jsx("input",{className:"paint-angle","data-testid":`paint-stop-${U}-offset`,type:"number",min:U===0?0:Math.floor(w.stops[U-1].offset*100)+1,max:U===w.stops.length-1?100:Math.ceil(w.stops[U+1].offset*100)-1,value:Math.round(P.offset*100),onChange:K=>L(U,Number(K.currentTarget.value)),"aria-label":i("{label} 色标 {n} 位置百分比",{label:e,n:U+1})}),t.jsx("button",{type:"button",className:"paint-stop-remove","data-testid":`paint-stop-${U}-remove`,disabled:w.stops.length<=ef,onClick:()=>H(U),"aria-label":i("{label} 删除色标 {n}",{label:e,n:U+1}),title:i("删除色标"),children:t.jsx(b0,{})})]},U))}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"paint-row",children:[t.jsx(vt,{label:i("{label} 渐变起始色",{label:e}),color:w.from,onChange:P=>I({from:P})}),t.jsx("input",{className:"paint-hex",value:w.from,onChange:P=>ar(P.currentTarget.value)&&I({from:P.currentTarget.value}),"aria-label":i("{label} 渐变起始 hex",{label:e})})]}),t.jsxs("div",{className:"paint-row",children:[t.jsx(vt,{label:i("{label} 渐变结束色",{label:e}),color:w.to,onChange:P=>I({to:P})}),t.jsx("input",{className:"paint-hex",value:w.to,onChange:P=>ar(P.currentTarget.value)&&I({to:P.currentTarget.value}),"aria-label":i("{label} 渐变结束 hex",{label:e})})]})]}),k==="linear-gradient"&&t.jsxs("div",{className:"paint-row",children:[t.jsx("input",{className:"paint-range","data-testid":"paint-gradient-angle",type:"range",min:"0",max:"359",value:w.angle,onChange:P=>z(Number(P.currentTarget.value)),"aria-label":i("{label} 渐变角度",{label:e})}),t.jsx("input",{className:"paint-angle",type:"number",min:"0",max:"359",value:w.angle,onChange:P=>z(Number(P.currentTarget.value)),"aria-label":i("{label} 渐变角度数值",{label:e})})]}),t.jsx("div",{className:"paint-row",children:t.jsx("button",{type:"button",className:"ghost","data-testid":"paint-stops-add",disabled:Br(w)&&w.stops.length>=tf,onClick:A,"aria-label":i("{label} 添加色标",{label:e}),children:i("添加色标")})}),t.jsx("div",{className:"paint-preview","aria-hidden":"true",style:{background:P1(k==="radial-gradient"&&Br(w)?{type:"radial-gradient",stops:w.stops}:w)}})]}),k==="image"&&n.type==="image"&&t.jsxs("div",{className:"paint-image",children:[t.jsx("div",{className:"seg stretch",children:["cover","contain"].map(P=>t.jsx("button",{type:"button",className:n.fit===P?"seg-btn on":"seg-btn","data-testid":`paint-image-fit-${P}`,onClick:()=>f==null?void 0:f(P),children:P==="cover"?i("填满"):i("适应")},P))}),t.jsxs("div",{className:"inspector-actions",children:[t.jsx("button",{className:"ghost",type:"button","data-testid":"freeform-adjust-framing","aria-label":i("调整图片取景"),title:x?m:i("调整图片取景"),disabled:x,onClick:h,children:i("调整取景")}),t.jsx("button",{className:"ghost",type:"button","data-testid":"freeform-reset-framing","aria-label":i("重置图片取景"),title:j?i("当前已经是默认取景"):i("重置图片取景"),disabled:j,onClick:g,children:i("重置取景")}),t.jsx("button",{className:"ghost",type:"button",onClick:o,children:i("替换图片")}),t.jsx("button",{className:"ghost",type:"button",onClick:c,children:i("清除图片")})]})]})]})}function Ss(e){if(!Number.isFinite(e))return"";const n=Number(e.toFixed(2));return n!==0||e===0?String(n):e.toExponential(2).replace("e+","e")}function Et({ariaLabel:e,value:n,min:r,max:s,step:l="any",resetKey:o,onCommit:c}){const[f,h]=p.useState(()=>Ss(n)),g=p.useRef(f),[x,m]=p.useState(!1),j=p.useRef(n),k=p.useRef(o),v=p.useRef(!1),w=p.useRef(Ss(n)),N=p.useRef(!1);p.useLayoutEffect(()=>{const M=o!==k.current;if(!x||n!==j.current||M){const z=Ss(n);g.current=z,h(z),w.current=z,N.current=!1}j.current=n,k.current=o},[x,o,n]);function F(){const M=Ss(n);g.current=M,h(M),m(!1),v.current=!1,w.current=M,N.current=!1}function I(){if(v.current){v.current=!1;return}const M=g.current;if(!N.current||M===w.current){F();return}const z=Number(M);if(!(M.trim().length>0&&Number.isFinite(z)&&(r===void 0||z>=r)&&(s===void 0||z<=s))||z===n){F();return}c(z)===!1?F():m(!1)}return t.jsx("input",{type:"number","aria-label":e,value:f,min:r,max:s,step:l,onFocus:()=>{w.current=g.current,N.current=!1,m(!0)},onChange:M=>{const z=M.currentTarget.value;m(!0),N.current=z!==w.current,g.current=z,h(z)},onBlur:I,onKeyDown:M=>{if(M.key==="Enter")M.preventDefault(),M.currentTarget.blur();else if(M.key==="Escape"){M.preventDefault(),v.current=!0;const z=Ss(n);g.current=z,h(z),m(!1),N.current=!1,M.currentTarget.blur()}}})}function id({text:e,fontSize:n,textFill:r,effect:s}){const l=s?W1(s,n):null,o=r.type==="solid"?r.color:ci(r);return t.jsxs("span",{className:"text-effect-sample",style:{fontSize:n},"aria-hidden":"true",children:[l&&t.jsx("span",{className:"text-effect-sample-layer",style:l.style,children:l.band?t.jsx("span",{className:"freeform-text-effect-band",style:l.band,children:e}):e}),t.jsx("span",{className:"text-effect-sample-words",style:{...O1(r),...s?H1(s,n,o):{}},children:e})]})}const J6={neon:"霓虹",outline:"描边",hollow:"镂空",splice:"错位",offset:"投影",echo:"回声",glitch:"故障",extrude:"立体",background:"底色",marker:"荧光笔"},Sc={neon:"强度",outline:"粗细",hollow:"粗细",splice:"偏移",offset:"偏移",echo:"偏移",glitch:"偏移",extrude:"厚度",background:"扩展",marker:"高度"},fr=e=>({type:"solid",color:e}),vc={neon:{page:"#0b1020",fill:fr("#e8fdff"),effect:{type:"neon",color:"#22d3ee",amount:55}},outline:{page:"#fbbf24",fill:fr("#1f2937"),effect:{type:"outline",color:"#ffffff",amount:60}},hollow:{page:"#f4f4f5",fill:fr("#18181b"),effect:{type:"hollow",amount:50}},splice:{page:"#fffbeb",fill:fr("#18181b"),effect:{type:"splice",color:"#f59e0b",amount:50,angle:45}},offset:{page:"#fef3c7",fill:fr("#ea580c"),effect:{type:"offset",color:"#1c1917",amount:45,angle:45}},echo:{page:"#f5f3ff",fill:fr("#6d28d9"),effect:{type:"echo",color:"#6d28d9",amount:45,angle:0}},glitch:{page:"#0a0a0a",fill:fr("#ffffff"),effect:{type:"glitch",color:"#00e5ff",color2:"#ff2bd6",amount:45}},extrude:{page:"#1e1b4b",fill:fr("#fde047"),effect:{type:"extrude",color:"#c2410c",amount:50,angle:45}},background:{page:"#f4f4f5",fill:fr("#ffffff"),effect:{type:"background",color:"#18181b",amount:40,radius:30}},marker:{page:"#ffffff",fill:fr("#18181b"),effect:{type:"marker",color:"#fde68a",amount:50}}};function e5({effect:e,textColor:n,resetKey:r,onChange:s}){ra();const l=o=>{if(o===null){e&&s(null);return}(e==null?void 0:e.type)!==o&&s(K1(o,n))};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"text-effect-grid",role:"group","aria-label":i("效果"),children:[t.jsxs("button",{type:"button",className:"text-effect-choice","data-testid":"text-effect-none","aria-pressed":!e,onClick:()=>l(null),children:[t.jsx("span",{className:"text-effect-choice-sample",style:{background:"#f4f4f5"},children:t.jsx(id,{text:"Aa",fontSize:20,textFill:fr("#18181b"),effect:null})}),t.jsx("span",{className:"text-effect-choice-name",children:i("无")})]}),_1.map(o=>t.jsxs("button",{type:"button",className:"text-effect-choice","data-testid":`text-effect-${o}`,"aria-pressed":(e==null?void 0:e.type)===o,onClick:()=>l(o),children:[t.jsx("span",{className:"text-effect-choice-sample",style:{background:vc[o].page},children:t.jsx(id,{text:"Aa",fontSize:20,textFill:vc[o].fill,effect:vc[o].effect})}),t.jsx("span",{className:"text-effect-choice-name",children:i(J6[o])})]},o))]}),e&&t.jsxs("div",{className:"text-effect-settings","data-testid":"text-effect-settings",children:["color"in e&&t.jsxs("div",{className:"field-grid with-gap",children:[t.jsxs("div",{className:"stroke-color-field","data-testid":"text-effect-color",children:[t.jsx("span",{className:"stroke-color-label",children:i("颜色")}),t.jsxs("div",{className:"color-field",children:[t.jsx("span",{className:"color-field-value",children:e.color.toUpperCase()}),t.jsx(vt,{label:i("效果颜色"),color:e.color,onChange:o=>s({...e,color:o})})]})]}),e.type==="glitch"&&t.jsxs("div",{className:"stroke-color-field","data-testid":"text-effect-color2",children:[t.jsx("span",{className:"stroke-color-label",children:i("颜色")}),t.jsxs("div",{className:"color-field",children:[t.jsx("span",{className:"color-field-value",children:e.color2.toUpperCase()}),t.jsx(vt,{label:i("效果第二种颜色"),color:e.color2,onChange:o=>s({...e,color2:o})})]})]})]}),t.jsxs("div",{className:"field-grid",children:[t.jsxs("label",{title:i(Sc[e.type]),children:[t.jsx("span",{className:"field-glyph is-word","aria-hidden":"true",children:i(Sc[e.type])}),t.jsx(Et,{ariaLabel:i(Sc[e.type]),min:0,max:100,resetKey:r,value:e.amount,onCommit:o=>s({...e,amount:o})})]}),B1.has(e.type)&&"angle"in e&&t.jsxs("label",{title:i("方向"),children:[t.jsx("span",{className:"field-glyph is-word","aria-hidden":"true",children:i("方向")}),t.jsx(Et,{ariaLabel:i("方向"),min:0,max:360,resetKey:r,value:e.angle,onCommit:o=>s({...e,angle:o===360?0:o})}),t.jsx("span",{className:"field-suffix","aria-hidden":"true",children:"°"})]}),e.type==="background"&&t.jsxs("label",{title:i("圆角"),children:[t.jsx("span",{className:"field-glyph is-word","aria-hidden":"true",children:i("圆角")}),t.jsx(Et,{ariaLabel:i("圆角"),min:0,max:100,resetKey:r,value:e.radius,onCommit:o=>s({...e,radius:o})})]})]})]})]})}const Hn=e=>({type:"solid",color:e}),t5=[{id:"neon-cyan",name:"霓虹青",backdrop:"#0b1020",textFill:Hn("#e8fdff"),effect:{type:"neon",color:"#22d3ee",amount:55}},{id:"neon-pink",name:"霓虹粉",backdrop:"#120a1a",textFill:Hn("#fff0fa"),effect:{type:"neon",color:"#f472b6",amount:55}},{id:"sticker",name:"贴纸白边",backdrop:"#fbbf24",textFill:Hn("#1f2937"),effect:{type:"outline",color:"#ffffff",amount:60}},{id:"candy",name:"糖果描边",backdrop:"#fdf2f8",textFill:Hn("#ffffff"),effect:{type:"outline",color:"#f43f5e",amount:50}},{id:"hollow",name:"镂空",backdrop:"#f5f5f4",textFill:Hn("#18181b"),effect:{type:"hollow",amount:50}},{id:"splice",name:"错位",backdrop:"#fffbeb",textFill:Hn("#18181b"),effect:{type:"splice",color:"#f59e0b",amount:50,angle:45}},{id:"retro",name:"复古投影",backdrop:"#fef3c7",textFill:Hn("#ea580c"),effect:{type:"offset",color:"#1c1917",amount:45,angle:45}},{id:"echo",name:"回声",backdrop:"#f5f3ff",textFill:Hn("#6d28d9"),effect:{type:"echo",color:"#6d28d9",amount:45,angle:0}},{id:"glitch",name:"故障",backdrop:"#0a0a0a",textFill:Hn("#ffffff"),effect:{type:"glitch",color:"#00e5ff",color2:"#ff2bd6",amount:45}},{id:"extrude",name:"立体",backdrop:"#1e1b4b",textFill:Hn("#fde047"),effect:{type:"extrude",color:"#c2410c",amount:50,angle:45}},{id:"label",name:"黑底标签",backdrop:"#f5f5f4",textFill:Hn("#ffffff"),effect:{type:"background",color:"#18181b",amount:40,radius:30}},{id:"tag",name:"黄色底块",backdrop:"#ffffff",textFill:Hn("#1c1917"),effect:{type:"background",color:"#fde047",amount:35,radius:12}},{id:"marker",name:"荧光笔",backdrop:"#ffffff",textFill:Hn("#1c1917"),effect:{type:"marker",color:"#fde68a",amount:50}},{id:"sunset",name:"日落渐变",backdrop:"#fff7ed",textFill:{type:"linear-gradient",from:"#f97316",to:"#db2777",angle:90},effect:null},{id:"aurora",name:"极光渐变",backdrop:"#0b1020",textFill:{type:"linear-gradient",from:"#22d3ee",to:"#a78bfa",angle:90},effect:{type:"neon",color:"#818cf8",amount:30}},{id:"gold",name:"金色",backdrop:"#1c1917",textFill:{type:"linear-gradient",stops:[{offset:0,color:"#fef3c7"},{offset:.55,color:"#f59e0b"},{offset:1,color:"#b45309"}],angle:180},effect:{type:"offset",color:"#78350f",amount:20,angle:90}}];function n5(e){const n=Number.parseInt(e.backdrop.slice(1),16);return .2126*(n>>16&255)+.7152*(n>>8&255)+.0722*(n&255)<128}function r5(e){return{textFill:structuredClone(e.textFill),effect:e.effect?{...e.effect}:null,fontWeight:"bold",stroke:null,strokeWidth:null,shadow:null}}const th="linear-gradient(135deg, #f43f5e 0%, #fbbf24 45%, #38bdf8 100%)",a5=[{id:"mono",name:"黑白",filter:{grayscale:1,contrast:1.1}},{id:"vintage",name:"复古",filter:{sepia:.45,contrast:1.05,brightness:1.05}},{id:"sunny",name:"暖阳",filter:{sepia:.25,saturation:1.2,brightness:1.05}},{id:"cool",name:"冷调",filter:{hue:345,saturation:1.05,brightness:1.02}},{id:"film",name:"胶片",filter:{sepia:.2,saturation:1.25,contrast:.95,brightness:1.05}},{id:"faded",name:"褪色",filter:{saturation:.6,contrast:.85,brightness:1.12}},{id:"punch",name:"高对比",filter:{contrast:1.4,saturation:1.2}},{id:"soft",name:"柔焦",filter:{blur:2,brightness:1.05}}];function i5(e){return V1(e.filter)}const s5={png:"PNG",jpeg:"JPG",pdf:"PDF"};function o5({disabled:e,exporting:n,progress:r,pageCount:s,prefs:l,onPrefsChange:o,onExportCurrent:c,onExportAll:f,onExportLong:h,onExportGrid:g,onShare:x}){const[m,j]=p.useState(!1),k=p.useRef(null);qs(k,m,()=>j(!1));const v=r?i("导出 {current}/{total}",r):n?i("导出中…"):i("导出");return t.jsxs("div",{className:"ff-export",ref:k,children:[t.jsxs("button",{className:"toolbar-primary editor-primary ff-export-trigger",type:"button","data-testid":"freeform-export","aria-haspopup":"dialog","aria-expanded":m,"aria-label":v,disabled:e,onClick:()=>j(w=>!w),children:[t.jsx(di,{}),t.jsx("span",{className:"editor-primary-label",children:v}),t.jsx(hd,{className:"ff-export-chevron"})]}),m&&t.jsxs("div",{className:"ff-export-panel",role:"dialog","aria-label":i("导出"),"data-testid":"freeform-export-options",onKeyDown:w=>{w.key==="Escape"&&(w.preventDefault(),w.stopPropagation(),j(!1))},children:[t.jsxs("div",{className:"ff-export-row",children:[t.jsx("span",{className:"field-label",children:i("格式")}),t.jsx("div",{className:"seg stretch",children:["png","jpeg","pdf"].map(w=>t.jsx("button",{type:"button",className:l.exportFormat===w?"seg-btn on":"seg-btn","aria-pressed":l.exportFormat===w,"data-testid":`export-format-${w}`,onClick:()=>o({exportFormat:w}),children:s5[w]},w))})]}),t.jsxs("div",{className:"ff-export-row",children:[t.jsx("span",{className:"field-label",children:i("倍率")}),t.jsx("div",{className:"seg stretch",children:[1,2].map(w=>t.jsxs("button",{type:"button",className:l.exportScale===w?"seg-btn on":"seg-btn","aria-pressed":l.exportScale===w,"data-testid":`export-scale-${w}x`,onClick:()=>o({exportScale:w}),children:[w,"x"]},w))})]}),l.exportFormat!=="png"&&t.jsxs("div",{className:"ff-export-row",children:[t.jsx("span",{className:"field-label",children:i("质量")}),t.jsxs("div",{className:"paint-row",children:[t.jsx("input",{className:"paint-range","data-testid":"export-quality-range",type:"range",min:50,max:100,value:Math.round(l.exportQuality*100),onChange:w=>o({exportQuality:Number(w.currentTarget.value)/100}),"aria-label":i("导出质量")}),t.jsxs("span",{className:"export-quality-value",children:[Math.round(l.exportQuality*100),"%"]})]})]}),t.jsxs("div",{className:"ff-export-actions",children:[t.jsxs("button",{className:"accent",type:"button","data-testid":"freeform-primary-export",disabled:e||n,onClick:c,children:[t.jsx(di,{}),i("下载当前页")]}),t.jsxs("button",{className:"ghost",type:"button","data-testid":"freeform-export-all",disabled:e||n,onClick:f,children:[t.jsx(Z2,{}),r?i("导出 {current}/{total}",r):l.exportFormat==="pdf"?i("下载全部 {n} 页",{n:s}):i("打包下载全部 {n} 页",{n:s})]}),l.exportFormat!=="pdf"&&t.jsxs("button",{className:"ghost",type:"button","data-testid":"freeform-export-long",disabled:e||n,onClick:h,children:[t.jsx(U2,{}),i("拼成一张长图")]}),l.exportFormat!=="pdf"&&g&&t.jsxs("button",{className:"ghost",type:"button","data-testid":"freeform-export-grid",disabled:e||n,onClick:g,children:[t.jsx(Y2,{}),i("切成九宫格")]}),x&&t.jsxs("button",{className:"ghost",type:"button","data-testid":"freeform-export-share",disabled:e||n,onClick:x,children:[t.jsx(x0,{}),i("分享链接")]})]})]})]})}function l5({slideCount:e,activeSlideName:n,countMatches:r,onApply:s,onClose:l}){const[o,c]=p.useState(""),[f,h]=p.useState(""),[g,x]=p.useState("deck"),[m,j]=p.useState(null),k=p.useRef(null),v=o===""?null:r(o,g);p.useEffect(()=>{var F;(F=k.current)==null||F.focus();const N=I=>{I.key==="Escape"&&(I.preventDefault(),l())};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[l]),p.useEffect(()=>{j(null)},[o,f,g]);const w=()=>{o===""||!v||j(s(o,f,g))};return t.jsx("div",{className:"modal-backdrop","data-testid":"find-replace-scrim",onClick:N=>{N.target===N.currentTarget&&l()},children:t.jsxs("div",{className:"modal find-replace-modal",role:"dialog","aria-modal":"true","aria-label":i("查找替换"),"data-testid":"find-replace-dialog",children:[t.jsx("div",{className:"modal-head",children:t.jsx("h3",{children:i("查找替换")})}),t.jsxs("label",{className:"field find-replace-field",children:[t.jsx("span",{className:"field-label",children:i("查找")}),t.jsx("input",{ref:k,"data-testid":"find-input",type:"text",value:o,onChange:N=>c(N.target.value),onKeyDown:N=>{N.key==="Enter"&&w()}})]}),t.jsxs("label",{className:"field",children:[t.jsx("span",{className:"field-label",children:i("替换为")}),t.jsx("input",{"data-testid":"replace-input",type:"text",value:f,onChange:N=>h(N.target.value),onKeyDown:N=>{N.key==="Enter"&&w()}})]}),t.jsxs("div",{className:"seg stretch",role:"group","aria-label":i("范围"),children:[t.jsx("button",{type:"button",className:g==="deck"?"seg-btn on":"seg-btn","aria-pressed":g==="deck","data-testid":"find-scope-deck",onClick:()=>x("deck"),children:i("整套作品")}),t.jsxs("button",{type:"button",className:g==="slide"?"seg-btn on":"seg-btn","aria-pressed":g==="slide","data-testid":"find-scope-slide",onClick:()=>x("slide"),children:[i("仅当前页"),e>1?`(${n})`:""]})]}),t.jsx("p",{className:"find-replace-result","data-testid":"find-replace-result","aria-live":"polite",children:m?[i("已替换 {n} 处",{n:m.replaced}),...m.skipped>0?[i("{n} 处换完超出字数上限,没有替换",{n:m.skipped})]:[]].join(" · "):v===null?"":v===0?i("没有找到要替换的文字"):i("找到 {n} 处",{n:v})}),t.jsxs("div",{className:"modal-actions",children:[t.jsx("button",{type:"button",className:"ghost",onClick:l,children:i("关闭")}),t.jsx("button",{type:"button",className:"primary","data-testid":"find-replace-apply",disabled:!v,onClick:w,children:i("全部替换")})]})]})})}const c5=[{hours:1,label:"1 小时"},{hours:6,label:"6 小时"},{hours:24,label:"1 天"},{hours:168,label:"7 天"},{hours:720,label:"30 天"}],Yo=24*30;function d5(e){const n=new Date(e),r=Number.isFinite(n.getTime())?n:null;return r?r.toLocaleDateString(Bs(),{year:"numeric",month:"long",day:"numeric"}):""}function gm({share:e,creating:n,progress:r,slideCount:s,revoking:l,error:o,onCreate:c,onRevoke:f,onClose:h}){const g=p.useId(),[x,m]=p.useState(24),[j,k]=p.useState("24"),[v,w]=p.useState(null),[N,F]=p.useState(!1),I=p.useRef(null),M=p.useRef(null);p.useEffect(()=>{if(!e)return;let H=!1;return Ed(()=>import("./paginate-CywTJr2d.js").then(P=>P.b),__vite__mapDeps([1,2])).then(P=>P.toDataURL(e.url,{margin:1,width:256})).then(P=>{H||w(P)}).catch(()=>{}),()=>{H=!0}},[e]),p.useEffect(()=>{var U;const H=document.activeElement instanceof HTMLElement?document.activeElement:null;(U=e?I.current:M.current)==null||U.focus();const P=K=>{K.key!=="Escape"||l||n||(K.preventDefault(),h())};return window.addEventListener("keydown",P),()=>{window.removeEventListener("keydown",P),H!=null&&H.isConnected&&H.focus()}},[e,h,l,n]);async function z(){try{await navigator.clipboard.writeText(e.url),F(!0)}catch{F(!1)}}const A=x==="custom"?Number(j):x,T=Number.isInteger(A)&&A>=1&&A<=Yo,L=e?d5(e.expiresAt):"";return t.jsx("div",{className:"modal-backdrop",children:t.jsx("div",{className:"modal share-modal",role:"dialog","aria-modal":"true","aria-labelledby":g,"data-testid":"freeform-share-dialog",children:e?t.jsxs(t.Fragment,{children:[t.jsx("h3",{id:g,className:"confirm-title",children:i("分享链接已创建")}),t.jsxs("p",{className:"confirm-body",children:[i("手机扫码或在浏览器打开链接就能看这 {n} 张卡片,长按图片可以保存到相册。",{n:e.imageCount}),L?i("有效期到 {date}。",{date:L}):"",i("链接已被打开 {n} 次。",{n:e.views})]}),v?t.jsx("img",{className:"share-qr",src:v,alt:i("分享二维码"),"data-testid":"share-qr"}):t.jsx("div",{className:"share-qr share-qr-pending","aria-hidden":"true","data-testid":"share-qr-pending"}),t.jsxs("label",{className:"share-link-label",htmlFor:"share-link-input",children:[t.jsx("span",{className:"field-label",children:i("链接")}),t.jsx("input",{id:"share-link-input",className:"share-link-input",type:"text",readOnly:!0,value:e.url,onFocus:H=>H.currentTarget.select(),"data-testid":"share-link-input"})]}),t.jsxs("div",{className:"modal-foot",children:[t.jsx("button",{className:"ghost",type:"button",onClick:()=>void f(),disabled:l,"data-testid":"share-revoke",children:l?i("正在撤销…"):i("撤销分享")}),t.jsx("button",{ref:I,className:"accent",type:"button",onClick:()=>void z(),"data-testid":"share-copy",children:N?i("已复制"):i("复制链接")}),t.jsx("button",{className:"ghost",type:"button",onClick:h,disabled:l,children:i("完成")})]})]}):t.jsxs(t.Fragment,{children:[t.jsx("h3",{id:g,className:"confirm-title",children:i("分享链接")}),t.jsx("p",{className:"confirm-body",children:i("生成一个不用登录就能打开的链接,手机扫码或在浏览器点开,就能看这 {n} 张卡片。",{n:s})}),t.jsxs("div",{className:"share-expiry-row",children:[t.jsx("span",{className:"field-label",children:i("有效期")}),t.jsxs("div",{className:"seg stretch",children:[c5.map(({hours:H,label:P})=>t.jsx("button",{type:"button",className:x===H?"seg-btn on":"seg-btn","aria-pressed":x===H,"data-testid":`share-expiry-${H}h`,disabled:n,onClick:()=>m(H),children:i(P)},H)),t.jsx("button",{type:"button",className:x==="custom"?"seg-btn on":"seg-btn","aria-pressed":x==="custom","data-testid":"share-expiry-custom",disabled:n,onClick:()=>m("custom"),children:i("自定义")})]})]}),x==="custom"&&t.jsxs("div",{className:"share-days-row",children:[t.jsx("input",{className:"share-days-input","data-testid":"share-expiry-hours",type:"number",min:1,max:Yo,step:1,value:j,disabled:n,"aria-label":i("自定义小时数"),onChange:H=>k(H.currentTarget.value)}),t.jsx("span",{className:"share-days-suffix",children:i("小时")}),!T&&t.jsx("span",{className:"share-days-hint",children:i("最长 {h} 小时({d} 天)",{h:Yo,d:Yo/24})})]}),o&&t.jsx("p",{className:"share-error",role:"alert",children:o}),n&&r&&t.jsx("p",{className:"confirm-body",children:i("正在生成 {current}/{total} 页…",r)}),t.jsxs("div",{className:"modal-foot",children:[t.jsx("button",{className:"ghost",type:"button",onClick:h,disabled:n,children:i("取消")}),t.jsx("button",{ref:M,className:"accent",type:"button","data-testid":"share-create",disabled:n||s===0||!T,onClick:()=>c(A),children:n?i("正在生成…"):i("生成链接")})]})]})})})}function xm({ownerId:e,draftId:n,onRestored:r,onClose:s}){const l=Ks(),o=p.useId(),[c,f]=p.useState(null),[h,g]=p.useState(null),[x,m]=p.useState(null),[j,k]=p.useState(!1),[v,w]=p.useState(null);p.useEffect(()=>{let F=!1;return xt(e).drafts.listVersions(e,n).then(I=>{F||(f(I),g(null))},I=>{F||g(vn(I,l("暂时无法读取历史版本,请稍后重试")))}),()=>{F=!0}},[e,n]),p.useEffect(()=>{const F=I=>{I.key!=="Escape"||x||j||(I.preventDefault(),s())};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[s,x,j]);async function N(F){k(!0),w(null);try{const I=await xt(e).drafts.restoreVersion(e,n,F.id);m(null),r(I)}catch(I){w(vn(I,l("恢复失败,请稍后重试")))}finally{k(!1)}}return t.jsxs("div",{className:"modal-backdrop",children:[t.jsxs("div",{className:"modal token-dialog",role:"dialog","aria-modal":"true","aria-labelledby":o,"data-testid":"draft-history-dialog",children:[t.jsx("h3",{id:o,className:"confirm-title",children:l("历史版本")}),t.jsx("p",{className:"confirm-body",children:l("服务端每隔一段时间自动存一份旧内容(最多保留 30 个)。恢复哪个,哪个就成为当前内容;被替换的内容也会先存成一个版本。")}),v&&t.jsx("p",{className:"share-error",role:"alert",children:v}),h?t.jsx("p",{className:"share-error",role:"alert",children:h}):c===null?t.jsx("p",{className:"confirm-body","data-testid":"draft-history-loading",children:l("读取中…")}):c.length===0?t.jsx("p",{className:"confirm-body","data-testid":"draft-history-empty",children:l("还没有历史版本——编辑并保存一段时间后,这里会出现可以回去的版本。")}):t.jsx("ul",{className:"token-list","data-testid":"draft-history-list",children:c.map(F=>t.jsxs("li",{className:"token-row",children:[t.jsxs("div",{className:"token-main",children:[t.jsx("span",{className:"token-name",children:F.title||l("未命名")}),t.jsxs("span",{className:"token-sub",children:[new Date(F.createdAt).toLocaleString(),F.mode==="markdown-card"?` · ${l("Markdown")}`:""]})]}),t.jsx("button",{type:"button",className:"ghost","data-testid":"draft-history-restore",disabled:j,onClick:()=>m(F),children:l("恢复")})]},F.id))}),t.jsx("div",{className:"modal-foot",children:t.jsx("button",{type:"button",className:"ghost",onClick:s,disabled:j,children:l("关闭")})})]}),x&&t.jsx(mi,{title:l("恢复这个版本?"),body:l("当前内容会被替换(替换前也会存成一个版本,随时能再换回来)。"),confirmLabel:l(j?"正在恢复…":"恢复"),onConfirm:()=>void N(x),onCancel:()=>m(null)})]})}const u5=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]'].join(", ");function bm(e){if(!(e instanceof Element))return!1;if(e.closest(u5))return!0;const n=e.closest("label");return n instanceof HTMLLabelElement&&n.control!==null&&!n.control.matches(":disabled")}function ol({isActive:e,testId:n,label:r,options:s,onSelect:l,onEscape:o,icon:c}){const f=p.useRef(null),h=p.useRef(null),g=p.useRef([]),x=p.useRef(null),m=p.useRef(e),j=p.useRef(!1),[k,v]=p.useState(!1),w=`${n}-menu`;m.current=e;function N(){x.current!==null&&(window.cancelAnimationFrame(x.current),x.current=null)}function F(){m.current&&(N(),x.current=window.requestAnimationFrame(()=>{var T;x.current=null,m.current&&((T=h.current)==null||T.focus())}))}function I(T){v(!1),T&&F()}function M(){!e||s.length===0||(j.current=!1,v(!0))}function z(T){j.current||(j.current=!0,l(T),I(!0))}function A(T){var P;const L=s.length;if(L===0)return;const H=(T+L)%L;(P=g.current[H])==null||P.focus()}return p.useEffect(()=>{var T;!k||!e||(T=g.current[0])==null||T.focus()},[k,e]),p.useEffect(()=>{e||(N(),v(!1))},[e]),p.useEffect(()=>()=>{N()},[]),p.useEffect(()=>{if(!k||!e)return;function T(L){const H=f.current;!H||H.contains(L.target)||I(!bm(L.target))}return window.addEventListener("pointerdown",T,!0),()=>window.removeEventListener("pointerdown",T,!0)},[k,e]),t.jsxs("div",{className:"freeform-insert-menu-control",ref:f,children:[t.jsxs("button",{ref:h,className:"freeform-insert-trigger",type:"button","data-testid":n,"data-freeform-toolbar-flyout-trigger":"","aria-haspopup":"menu","aria-expanded":k,"aria-controls":w,onClick:()=>k?I(!1):M(),children:[c,t.jsx("span",{children:i(r)}),t.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",children:t.jsx("path",{d:"m3 4.5 3 3 3-3"})})]}),k&&t.jsx("div",{className:"freeform-insert-menu",id:w,role:"menu","aria-label":i(r),onKeyDown:T=>{const L=g.current.findIndex(H=>H===globalThis.document.activeElement);if(T.key==="Tab"){I(!1);return}if(T.key==="ArrowDown"){T.preventDefault(),T.stopPropagation(),A(L+1);return}if(T.key==="ArrowUp"){T.preventDefault(),T.stopPropagation(),A(L<0?s.length-1:L-1);return}T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),I(o===void 0),o==null||o())},children:s.map((T,L)=>t.jsxs("button",{ref:H=>{g.current[L]=H},className:"freeform-insert-menu-item",type:"button",role:"menuitem",tabIndex:-1,"data-testid":T.testId,onClick:()=>z(T.id),children:[T.icon,t.jsx("span",{children:i(T.label)})]},T.id))})]})}const f5={rotate:t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M13 8a5 5 0 1 1-1.46-3.54"}),t.jsx("path",{d:"M13 2.5v3h-3"})]}),radius:t.jsx("path",{d:"M3 13.5V8.5a5.5 5.5 0 0 1 5.5-5.5h5"}),opacity:t.jsxs(t.Fragment,{children:[t.jsx("circle",{cx:"8",cy:"8",r:"5.5"}),t.jsx("path",{d:"M8 2.5a5.5 5.5 0 0 1 0 11z",fill:"currentColor",stroke:"none"})]}),stroke:t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M2.5 3.75h11",strokeWidth:"1"}),t.jsx("path",{d:"M2.5 7.75h11",strokeWidth:"1.75"}),t.jsx("path",{d:"M2.5 12.25h11",strokeWidth:"2.5"})]}),"font-size":t.jsx("path",{d:"m1.75 13 3.5-9 3.5 9M3 10h4.5M10 13l2.25-5.5L14.5 13M10.75 11.25h3"}),"line-height":t.jsx("path",{d:"M2.5 2.75h11M2.5 13.25h11M8 5.25v5.5M6.25 7 8 5.25 9.75 7M6.25 9 8 10.75 9.75 9"}),"letter-spacing":t.jsx("path",{d:"M2 2.5v11M14 2.5v11M5.25 11.5 8 4.5l2.75 7M6.1 9.25h3.8"}),blur:t.jsx("path",{d:"M8 2.25c2.6 3.1 4 5.1 4 7.1a4 4 0 0 1-8 0c0-2 1.4-4 4-7.1z"}),dash:t.jsx("path",{d:"M1.75 8h2.5M6.75 8h2.5M11.75 8h2.5"}),"paragraph-spacing":t.jsx("path",{d:"M2.5 2.75h7M2.5 5h5M2.5 11h7M2.5 13.25h5M12.5 5.25v5.5M11 6.75l1.5-1.5 1.5 1.5M11 9.25l1.5 1.5 1.5-1.5"})};function zn({name:e}){return t.jsx("svg",{className:"field-glyph",viewBox:"0 0 16 16","aria-hidden":"true",children:f5[e]})}const $d=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform),ym=$d?"⌫":"Del";function Bn(e,n={}){return $d?`${n.alt?"⌥":""}${n.shift?"⇧":""}${n.mod?"⌘":""}${e}`:[n.mod&&"Ctrl",n.shift&&"Shift",n.alt&&"Alt",e].filter(Boolean).join("+")}function h5(e){return e.key.toLowerCase()!=="v"||e.altKey?!1:$d?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}const nh=[{id:"rect",label:"矩形"},{id:"ellipse",label:"圆形"},{id:"triangle",label:"三角形"},{id:"diamond",label:"菱形"},{id:"pentagon",label:"五边形"},{id:"hexagon",label:"六边形"},{id:"star",label:"五角星"},{id:"heart",label:"心形"},{id:"bubble",label:"对话气泡"}],m5=[{id:"left",label:"左对齐",icon:"M4 3v14M7 6.5h9M7 13.5h5.5"},{id:"h-center",label:"水平居中",icon:"M10 3v14M5 6.5h10M6.75 13.5h6.5"},{id:"right",label:"右对齐",icon:"M16 3v14M4 6.5h9M7.5 13.5H13"},{id:"top",label:"顶对齐",icon:"M3 4h14M6.5 7v9M13.5 7v5.5"},{id:"v-center",label:"垂直居中",icon:"M3 10h14M6.5 5v10M13.5 6.75v6.5"},{id:"bottom",label:"底对齐",icon:"M3 16h14M6.5 4v9M13.5 7.5V13"},{id:"distribute-h",label:"水平均分",icon:"M4 4v12M16 4v12M8.5 7h3v6h-3z"},{id:"distribute-v",label:"垂直均分",icon:"M4 4h12M4 16h12M7 8.5h6v3H7z"}],p5=[{id:"front",label:"置于顶层",icon:"M10 16V7M6.5 10.5 10 7l3.5 3.5M5 3.5h10"},{id:"forward",label:"上移一层",icon:"M10 15.5V5.5M6.5 9 10 5.5 13.5 9"},{id:"backward",label:"下移一层",icon:"M10 4.5v10M6.5 11 10 14.5l3.5-3.5"},{id:"back",label:"移到底层",icon:"M10 4v9M6.5 9.5 10 13l3.5-3.5M5 16.5h10"}],g5=[{id:"left",label:"文字左对齐",icon:"M2.5 4h11M2.5 8h7M2.5 12h9"},{id:"center",label:"文字居中",icon:"M2.5 4h11M4.5 8h7M3.5 12h9"},{id:"right",label:"文字右对齐",icon:"M2.5 4h11M6.5 8h7M4.5 12h9"},{id:"justify",label:"文字两端对齐",icon:"M2.5 4h11M2.5 8h11M2.5 12h7"}],x5={none:"bullet",bullet:"number",number:null},b5={bullet:"M6 4h7.5M6 8h7.5M6 12h7.5M2.75 4h.01M2.75 8h.01M2.75 12h.01",number:"M6 4h7.5M6 8h7.5M6 12h7.5M2.25 3l.9-.6v3.1M2 8.4c.25-.55 1.75-.6 1.75.3 0 .65-1.75 1.15-1.75 1.8h1.85"};function ln({d:e,viewBox:n="0 0 20 20"}){return t.jsx("svg",{className:"ctx-icon",viewBox:n,"aria-hidden":"true",children:t.jsx("path",{d:e})})}function Cn({className:e}){return t.jsx("span",{className:e?`ctx-divider ${e}`:"ctx-divider","aria-hidden":"true"})}const y5=6;function rh(e){const n=Number.parseFloat(getComputedStyle(e).minHeight)+1,r=[];for(e.removeAttribute("data-fold");e.offsetHeight>n&&r.length<y5;)r.push(String(r.length+1)),e.setAttribute("data-fold",r.join(" "))}function ba({label:e,glyph:n,value:r,min:s,max:l,unit:o,resetKey:c,className:f,onCommit:h}){return t.jsxs("label",{className:f?`ctx-number ${f}`:"ctx-number",title:e,children:[n.length<=2?t.jsx("span",{className:"field-glyph","aria-hidden":"true",children:n}):t.jsx(zn,{name:n}),t.jsx(Et,{ariaLabel:e,value:r,min:s,max:l,resetKey:c,onCommit:h}),o&&t.jsx("span",{className:"ctx-unit","aria-hidden":"true",children:o})]})}function ya({label:e,pressed:n,disabled:r,title:s,testId:l,className:o,onClick:c,children:f}){return t.jsx("button",{type:"button",className:o?`ctx-btn ${o}`:"ctx-btn","aria-label":e,"aria-pressed":n,title:s??e,disabled:r,"data-testid":l,onClick:c,children:f})}function On({icon:e,label:n}){return t.jsxs("span",{className:"ctx-subject","data-testid":"freeform-context-subject",children:[e,t.jsx("span",{children:n})]})}function j5(e){var h,g;const{subject:n,resetKey:r,suspended:s=!1}=e,l=wl(),o=n.kind!=="page",c=p.useRef(null);p.useEffect(()=>{const x=c.current;x&&(s?x.setAttribute("inert",""):x.removeAttribute("inert"))},[s]);const f=[n.kind,"node"in n?n.node.id:"",n.kind==="shape"?`${n.node.shape} ${n.node.fill.type}`:"","name"in n?n.name:"","count"in n?n.count:"",e.canAlign,cl()].join("|");return p.useLayoutEffect(()=>{c.current&&rh(c.current)},[f]),p.useEffect(()=>{const x=c.current,m=x==null?void 0:x.parentElement;if(!x||!m)return;let j=-1;const k=new ResizeObserver(()=>{const v=m.getBoundingClientRect().width;v!==j&&(j=v,rh(x))});return k.observe(m),()=>k.disconnect()},[]),t.jsxs("div",{ref:c,className:`freeform-context-toolbar${s?" is-suspended":""}`,role:"toolbar","aria-label":i("对象工具条"),"data-testid":"freeform-context-toolbar","data-subject":n.kind,children:[t.jsxs("div",{className:"ctx-group",children:[n.kind==="text"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(k0,{}),label:i("文本")}),t.jsx(Cn,{}),t.jsx("div",{className:"ctx-font",children:t.jsx(Qr,{value:Id(n.node.fontFamily),onChange:e.onFontFamily,title:i("字体"),testId:"ctx-font-select",previewFonts:!0,options:um(l,{current:n.node.fontFamily,withImport:!0})})}),t.jsxs("div",{className:"ctx-stepper",children:[t.jsx("button",{type:"button",className:"ctx-btn is-small ctx-fold-details","aria-label":i("缩小字号"),title:i("缩小字号"),onClick:()=>e.onProperty({property:"fontSize",value:nd(n.fontSize,-1)}),children:t.jsx(ln,{d:"M5 10h10"})}),t.jsx(ba,{label:i("文字大小"),glyph:"font-size",value:n.fontSize,min:Number.MIN_VALUE,max:Number.MAX_VALUE,resetKey:r,onCommit:x=>e.onProperty({property:"fontSize",value:x})}),t.jsx("button",{type:"button",className:"ctx-btn is-small ctx-fold-details","aria-label":i("放大字号"),title:i("放大字号"),onClick:()=>e.onProperty({property:"fontSize",value:nd(n.fontSize,1)}),children:t.jsx(ln,{d:"M10 5v10M5 10h10"})})]}),t.jsx(vt,{label:i("文字填充颜色"),testId:"ctx-text-color",variant:"text",color:ci(n.node.textFill),onChange:x=>e.onStyle({textFill:{type:"solid",color:x}})}),t.jsx(Cn,{}),t.jsx(ya,{label:i("加粗文字"),pressed:n.node.fontWeight==="bold",onClick:()=>e.onStyle({fontWeight:n.node.fontWeight==="bold"?"normal":"bold"}),children:t.jsx("b",{className:"ctx-glyph",children:"B"})}),t.jsx(ya,{label:i("倾斜文字"),pressed:n.node.italic===!0,onClick:()=>e.onStyle({italic:!n.node.italic}),children:t.jsx("i",{className:"ctx-glyph is-italic",children:"I"})}),g5.map(x=>t.jsx(ya,{label:i(x.label),className:"ctx-text-align",pressed:n.node.align===x.id,onClick:()=>e.onStyle({align:x.id}),children:t.jsx(ln,{viewBox:"0 0 16 16",d:x.icon})},x.id)),t.jsx(ya,{label:i(n.node.list==="number"?"编号列表":n.node.list==="bullet"?"项目符号列表":"列表"),className:"ctx-text-align",testId:"ctx-text-list",pressed:n.node.list!==void 0,onClick:()=>e.onStyle({list:x5[n.node.list??"none"]}),children:t.jsx(ln,{viewBox:"0 0 16 16",d:b5[n.node.list==="number"?"number":"bullet"]})})]}),n.kind==="shape"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(S0,{}),label:i("形状")}),t.jsx(Cn,{}),t.jsx(ol,{isActive:e.isActive,testId:"ctx-shape-menu",label:i(((h=nh.find(x=>x.id===n.node.shape))==null?void 0:h.label)??"形状"),icon:t.jsx(Bi,{shape:n.node.shape}),options:nh.map(x=>({id:x.id,label:x.label,icon:t.jsx(Bi,{shape:x.id})})),onSelect:x=>e.onStyle({shape:x})}),n.node.fill.type==="image"?t.jsxs("button",{type:"button",className:"ctx-btn is-text","data-testid":"ctx-adjust-framing",disabled:!n.canFrame,title:n.canFrame?i("调整取景"):n.frameDisabledReason??void 0,onClick:e.onAdjustFraming,children:[t.jsx(ln,{d:"M6 2.5V14h11.5M2.5 6H14v11.5"}),t.jsx("span",{children:i("调整取景")})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"ctx-label",children:i("填充")}),t.jsx(vt,{label:i("形状填充颜色"),testId:"ctx-shape-fill",color:n.node.fill.type==="transparent"?"transparent":ci(n.node.fill),onChange:x=>e.onShapeFill({type:"solid",color:x})})]}),t.jsx("span",{className:"ctx-label",children:i("描边")}),t.jsx(vt,{label:i("形状轮廓颜色"),testId:"ctx-shape-stroke",color:n.node.stroke,onChange:x=>e.onStyle({stroke:x})}),t.jsx(ba,{label:i("轮廓粗细"),glyph:"stroke",value:n.strokeWidth,min:0,max:Number.MAX_VALUE,resetKey:r,className:"ctx-fold-details",onCommit:x=>e.onProperty({property:"strokeWidth",value:x})}),n.node.shape==="rect"&&t.jsx(ba,{label:i("转角弧度"),glyph:"radius",value:((g=n.node.cornerRadii)==null?void 0:g.topLeft)??n.node.cornerRadius??16,min:0,max:2e3,resetKey:r,className:"ctx-fold-details",onCommit:x=>e.onStyle({cornerRadius:x,cornerRadii:null})}),n.node.shape==="star"&&t.jsx(ba,{label:i("星角内径"),glyph:"radius",value:Math.round((n.node.starInnerRatio??.38)*100),min:15,max:85,unit:"%",resetKey:r,className:"ctx-fold-details",onCommit:x=>e.onStyle({starInnerRatio:x/100})}),n.node.shape==="bubble"&&t.jsx(ba,{label:i("尾巴位置"),glyph:"radius",value:Math.round((n.node.bubbleTailX??.5)*100),min:5,max:95,unit:"%",resetKey:r,className:"ctx-fold-details",onCommit:x=>e.onStyle({bubbleTailX:x/100})})]}),n.kind==="image"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(v0,{}),label:i("图片")}),t.jsx(Cn,{}),t.jsxs("button",{type:"button",className:"ctx-btn is-text","data-testid":"ctx-crop",disabled:!n.canCrop,title:n.canCrop?i("裁剪图片"):n.cropDisabledReason??void 0,onClick:e.onCrop,children:[t.jsx(ln,{d:"M6 2.5V14h11.5M2.5 6H14v11.5"}),t.jsx("span",{children:i("裁剪")})]}),t.jsx("div",{className:"ctx-seg",role:"group","aria-label":i("图片填充方式"),children:["cover","contain"].map(x=>t.jsx("button",{type:"button",className:n.node.fit===x?"ctx-seg-btn on":"ctx-seg-btn","aria-pressed":n.node.fit===x,onClick:()=>e.onStyle({fit:x}),children:x==="cover"?i("填满"):i("适应")},x))})]}),n.kind==="chart"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(ln,{d:"M4 16V9M10 16V4M16 16v-4"}),label:n.node.chartKind==="ring"?i("环形图"):n.node.chartKind==="line"?i("折线图"):i("柱状图")}),t.jsx(Cn,{})]}),n.kind==="table"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(ln,{d:"M3 4h18v16H3zM3 9.3h18M3 14.6h18M9 4v16M15 4v16"}),label:i("表格")}),t.jsx(Cn,{})]}),n.kind==="timeline"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(ln,{d:"M6 4v16M6 7h9M6 12h12M6 17h8"}),label:i("时间线")}),t.jsx(Cn,{})]}),n.kind==="progress"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(ln,{d:"M4 12a8 8 0 1 1 8 8"}),label:i("进度")}),t.jsx(Cn,{})]}),n.kind==="qrcode"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(ln,{d:"M3.5 3.5h4v4h-4zM12.5 3.5h4v4h-4zM3.5 12.5h4v4h-4zM11 11h2v2h-2zM14.5 14.5h2v2h-2zM11 14.5h2v2h-2zM14.5 11h2v2h-2z"}),label:i("二维码")}),t.jsx(Cn,{})]}),n.kind==="line"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(V2,{}),label:n.node.lineKind==="arrow"?i("箭头"):i("直线")}),t.jsx(Cn,{}),t.jsx("span",{className:"ctx-label",children:i("颜色")}),t.jsx(vt,{label:i("线条描边颜色"),testId:"ctx-line-stroke",color:n.node.stroke,onChange:x=>e.onStyle({stroke:x})}),t.jsx(ba,{label:i("线条粗细"),glyph:"stroke",value:n.strokeWidth,min:Number.MIN_VALUE,max:Number.MAX_VALUE,resetKey:r,className:"ctx-fold-details",onCommit:x=>e.onProperty({property:"strokeWidth",value:x})}),t.jsx(ya,{label:i("末端箭头"),pressed:n.node.lineKind==="arrow",onClick:()=>e.onStyle({lineKind:n.node.lineKind==="arrow"?"line":"arrow"}),children:t.jsx(ln,{d:"M3 10h13M12 6l4 4-4 4"})})]}),n.kind==="path"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(G2,{}),label:i("图形")}),t.jsx(Cn,{}),n.node.fill.type==="image"?t.jsxs("button",{type:"button",className:"ctx-btn is-text","data-testid":"ctx-adjust-framing",disabled:!n.canFrame,title:n.canFrame?i("调整取景"):n.frameDisabledReason??void 0,onClick:e.onAdjustFraming,children:[t.jsx(ln,{d:"M6 2.5V14h11.5M2.5 6H14v11.5"}),t.jsx("span",{children:i("调整取景")})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"ctx-label",children:i("填充")}),t.jsx(vt,{label:i("图形填充颜色"),testId:"ctx-path-fill",color:n.node.fill.type==="transparent"?"transparent":ci(n.node.fill),onChange:x=>e.onStyle({fill:{type:"solid",color:x}})})]}),t.jsx("span",{className:"ctx-label",children:i("描边")}),t.jsx(vt,{label:i("图形描边颜色"),testId:"ctx-path-stroke",color:n.node.stroke,onChange:x=>e.onStyle({stroke:x})}),t.jsx(ba,{label:i("描边粗细"),glyph:"stroke",value:n.strokeWidth,min:0,max:Number.MAX_VALUE,resetKey:r,className:"ctx-fold-details",onCommit:x=>e.onProperty({property:"strokeWidth",value:x})})]}),n.kind==="group"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(ln,{d:"M3.5 3.5h6v6h-6zM10.5 10.5h6v6h-6z"}),label:n.name}),t.jsx(Cn,{}),t.jsx("button",{type:"button",className:"ctx-btn is-text",onClick:e.onUngroup,children:t.jsx("span",{children:i("取消编组")})})]}),n.kind==="multi"&&t.jsxs(t.Fragment,{children:[t.jsx(On,{icon:t.jsx(ln,{d:"M3.5 3.5h6v6h-6zM10.5 10.5h6v6h-6z"}),label:i("{n} 个对象",{n:n.count})}),t.jsx(Cn,{}),t.jsx("button",{type:"button",className:"ctx-btn is-text",disabled:!e.canGroup,onClick:e.onGroup,children:t.jsx("span",{children:i("编成一组")})})]}),n.kind==="locked"&&t.jsx(t.Fragment,{children:t.jsx(On,{icon:t.jsx(hl,{}),label:n.name})})]}),t.jsxs("div",{className:"ctx-group is-end",children:[o&&t.jsxs(t.Fragment,{children:[n.kind!=="locked"&&n.kind!=="group"&&n.kind!=="multi"&&t.jsx(ba,{label:i("透明度"),glyph:"opacity",value:Math.round((n.node.opacity??1)*100),min:0,max:100,unit:"%",resetKey:r,className:"ctx-opacity",onCommit:x=>e.onStyle({opacity:Math.round(x)/100})}),n.kind!=="locked"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"ctx-fold-menus",children:[e.canAlign&&t.jsx(ol,{isActive:e.isActive,testId:"ctx-align-menu",label:i("位置"),icon:t.jsx(ln,{d:"M4 3v14M7 6.5h9M7 13.5h5.5"}),options:m5.filter(x=>e.canDistribute||!x.id.startsWith("distribute")).map(x=>({id:x.id,label:x.label,icon:t.jsx(ln,{d:x.icon})})),onSelect:x=>{x==="distribute-h"?e.onDistribute("horizontal"):x==="distribute-v"?e.onDistribute("vertical"):e.onAlign(x)}}),t.jsx(ol,{isActive:e.isActive,testId:"ctx-order-menu",label:i("层级"),icon:t.jsx(ln,{d:"m10 3.5 6.5 3.25L10 10 3.5 6.75zM3.5 10.25 10 13.5l6.5-3.25M3.5 13.75 10 17l6.5-3.25"}),options:p5.map(x=>({id:x.id,label:x.label,icon:t.jsx(ln,{d:x.icon})})),onSelect:e.onOrder}),t.jsx(Cn,{})]}),t.jsx(ya,{label:i("复制一份"),title:i("复制一份({keys})",{keys:Bn("D",{mod:!0})}),testId:"ctx-duplicate",className:"ctx-fold-actions",onClick:e.onDuplicate,children:t.jsx(j0,{})})]}),t.jsx(ya,{label:n.kind==="locked"?i("解锁对象"):i("锁定对象"),pressed:n.kind==="locked",testId:"ctx-lock",className:n.kind==="locked"?void 0:"ctx-fold-actions",onClick:e.onToggleLock,children:t.jsx(hl,{})}),n.kind!=="locked"&&t.jsx(ya,{label:i("删除对象"),title:i("删除对象({keys})",{keys:ym}),testId:"ctx-delete",className:"ctx-fold-delete",onClick:e.onDelete,children:t.jsx(Ji,{})}),t.jsx(Cn,{className:n.kind==="locked"?void 0:"ctx-fold-delete"})]}),t.jsxs("button",{type:"button",className:"ctx-btn is-text ctx-more","data-testid":"ctx-more","aria-pressed":e.panelOpen,title:e.panelOpen?i("收起面板"):i("更多设置"),onClick:e.onTogglePanel,children:[t.jsx(O2,{}),t.jsx("span",{children:i("更多")})]})]})]})}const w5=/^Page \d+$/,sd=/^(.*\S) copy$/;function jm(e){let n=e.trim();for(let r=sd.exec(n);r;r=sd.exec(n))n=r[1];return w5.test(n)}function Rs(e,n){const r=e.trim();if(!r||jm(r))return i("第 {n} 页",{n:n+1});const s=sd.exec(r);return s?i("{name} 副本",{name:Rs(s[1],n)}):r}const k5=.03,S5=16,v5=12;function N5(e,n,r){const s=Math.max(S5,Math.round(Math.min(r.width,r.height)*k5)),l=n.flatMap(f=>{const h=G1(f);return h?[{x:h.x+h.width/2,y:h.y+h.height/2}]:[]}),o=(f,h)=>{const g=f+e.width/2,x=h+e.height/2;return l.some(m=>Math.abs(m.x-g)<s/2&&Math.abs(m.y-x)<s/2)},c=(f,h)=>f>=0&&h>=0&&f+e.width<=r.width&&h+e.height<=r.height;if(!o(e.x,e.y))return e;for(const f of[1,-1])for(let h=1;h<=v5;h+=1){const g=e.x+f*h*s,x=e.y+f*h*s;if(!c(g,x))break;if(!o(g,x))return{...e,x:Math.round(g),y:Math.round(x)}}return e}const F5=new Set(["文本","图片","形状","直线","箭头","组","图形"]);function Ir(e){var n,r;return F5.has(e)?i(e):cl()!=="en"?e:((n=D6(e))==null?void 0:n.en)??((r=xx(e))==null?void 0:r.en)??e}const ah=4,M5=8,wm=4;function C5(e){return!Number.isInteger(e)||e<1?ah:ah+Math.min(e-1,wm)*M5}function E5(e){return!Number.isInteger(e)||e<=wm+1||e>Sl?null:String(e)}function z5(e){return e.type==="text"?i("文本"):e.type==="image"?i("图片"):e.type==="line"?e.lineKind==="arrow"?i("箭头"):i("直线"):e.type==="group"?i("组合"):e.type==="path"?i("图形"):e.type==="qrcode"?i("二维码"):e.type==="chart"?e.chartKind==="ring"?i("环形图"):e.chartKind==="line"?i("折线图"):i("柱状图"):i("形状")}function km(e,n=1){return e.type!=="group"||n>Sl?!1:e.children.some(r=>r.locked||km(r,n+1))}function Sm(e,n,r=[],s=1){const l=[];for(const o of[...e].reverse()){const c=[...r,o.id];l.push({node:o,path:c,parentPath:[...r],level:s}),o.type==="group"&&n.has(ye(c))&&l.push(...Sm(o.children,n,c,s+1))}return l}function od(e,n=[]){const r=[];for(const s of e){if(s.type!=="group")continue;const l=[...n,s.id];r.push(ye(l),...od(s.children,l))}return r}function R5(e){return e.type==="group"?t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:"freeform-layer-icon",children:[t.jsx("path",{d:"M3 6.5h5l1.5 2H17v7.5H3z"}),t.jsx("path",{d:"M3 6.5V4h5l1.5 2.5"})]}):e.type==="text"?t.jsx("span",{"aria-hidden":"true",className:"freeform-layer-type-mark",children:"T"}):e.type==="image"?t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:"freeform-layer-icon",children:[t.jsx("rect",{x:"3",y:"3",width:"14",height:"14",rx:"2"}),t.jsx("circle",{cx:"7",cy:"7",r:"1.2"}),t.jsx("path",{d:"m4.5 14 3.2-3.2 2.4 2.3 1.8-1.8 3.6 3.2"})]}):e.type==="line"?t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:"freeform-layer-icon",children:[t.jsx("path",{d:"m4 16 12-12"}),e.lineKind==="arrow"&&t.jsx("path",{d:"M11 4h5v5"})]}):e.type==="path"?t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:"freeform-layer-icon",children:[t.jsx("path",{d:"M3.5 15.5c2.5-9 6-11 8-6.5s4.5 3 5-5"}),t.jsx("circle",{cx:"3.5",cy:"15.5",r:"1.3"}),t.jsx("circle",{cx:"16.5",cy:"4",r:"1.3"})]}):e.type==="qrcode"?t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:"freeform-layer-icon",children:t.jsx("path",{d:"M3.5 3.5h5v5h-5zM11.5 3.5h5v5h-5zM3.5 11.5h5v5h-5zM11 11h2.4v2.4H11zM14.1 14.1h2.4v2.4h-2.4zM11 14.1h2.4v2.4H11zM14.1 11h2.4v2.4h-2.4z"})}):e.type==="chart"?t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:"freeform-layer-icon",children:t.jsx("path",{d:"M4 16V10M10 16V4M16 16V7",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round"})}):t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:"freeform-layer-icon",children:t.jsx("path",{d:"m10 2 7 4v8l-7 4-7-4V6z"})})}function I5(e){return t.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"freeform-layer-expand-icon",children:t.jsx("path",{d:e?"m4 6 4 4 4-4":"m6 4 4 4-4 4"})})}function L5(e){return t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:"freeform-layer-action-icon",children:[t.jsx("path",{d:"M2.5 10s2.8-5 7.5-5 7.5 5 7.5 5-2.8 5-7.5 5-7.5-5-7.5-5Z"}),t.jsx("circle",{cx:"10",cy:"10",r:"2.2"}),!e&&t.jsx("path",{d:"m3 3 14 14"})]})}function $5(e){return t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:"freeform-layer-action-icon",children:[t.jsx("rect",{x:"4",y:"8",width:"12",height:"9",rx:"2"}),t.jsx("path",{d:e?"M7 8V6a3 3 0 0 1 6 0v2":"M7 8V6a3 3 0 0 1 5.7-1.3"})]})}function D5(){return t.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"freeform-layer-inherited-icon",children:[t.jsx("path",{d:"M6.2 9.8 4.8 11.2a2.1 2.1 0 0 1-3-3l2.1-2.1a2.1 2.1 0 0 1 3 0"}),t.jsx("path",{d:"m9.8 6.2 1.4-1.4a2.1 2.1 0 0 1 3 3l-2.1 2.1a2.1 2.1 0 0 1-3 0"}),t.jsx("path",{d:"m5.6 10.4 4.8-4.8"})]})}function A5({nodes:e,selectedPaths:n,hasStructuralLockedSelection:r,onSelect:s,onRename:l,onReorder:o,onDropReorder:c,onSetLocked:f,onSetHidden:h,onGroup:g,onUngroup:x}){const[m,j]=p.useState(()=>new Set(od(e))),[k,v]=p.useState(null),[w,N]=p.useState(null),[F,I]=p.useState(""),[M,z]=p.useState(""),A=p.useRef(new Map),T=p.useRef(null),L=p.useRef(null),H=p.useRef(!1),P=p.useRef(new Set),U=p.useRef([]),K=p.useId().replace(/:/g,""),D=p.useMemo(()=>Sm(e,m),[e,m]),re=p.useMemo(()=>new Map(D.map(oe=>[ye(oe.path),oe])),[D]),q=p.useMemo(()=>new Set(n.map(ye)),[n]);p.useEffect(()=>{const oe=new Set(od(e)),he=P.current;P.current=oe;const Ae=Re=>{const qe=new Set([...Re].filter(Me=>oe.has(Me)));return oe.forEach(Me=>{he.has(Me)||qe.add(Me)}),qe.size===Re.size&&[...qe].every(Me=>Re.has(Me))?Re:qe};Ae(m)!==m&&j(Ae)},[e]),p.useEffect(()=>{if(D.length===0){v(null),U.current=D;return}if(!k){v(ye(D[0].path)),U.current=D;return}if(!re.has(k)){const oe=U.current,he=oe.findIndex(lt=>ye(lt.path)===k),Ae=oe[he],Re=lt=>lt.map(pt=>oe[pt]).find(pt=>pt&&re.has(ye(pt.path))&&(!Ae||ye(pt.parentPath)===ye(Ae.parentPath))),qe=Re(Array.from({length:Math.max(0,oe.length-he-1)},(lt,pt)=>he+pt+1)),Me=Re(Array.from({length:Math.max(0,he)},(lt,pt)=>he-pt-1)),Mt=Ae!=null&&Ae.parentPath.length?re.get(ye(Ae.parentPath)):void 0,Je=qe??Me??Mt??D[0],mt=ye(Je.path),Lt=document.activeElement,_t=Lt===null||Lt===document.body;v(mt),_t&&requestAnimationFrame(()=>{var lt;(document.activeElement===null||document.activeElement===document.body)&&((lt=A.current.get(mt))==null||lt.focus())})}U.current=D},[k,re,D]),p.useEffect(()=>{var he;if(!k)return;const oe=A.current.get(k);oe&&((he=document.activeElement)==null?void 0:he.getAttribute("role"))==="treeitem"&&oe.focus()},[k]);function te(oe){var he;oe&&(v(oe),(he=A.current.get(oe))==null||he.focus(),requestAnimationFrame(()=>{var Re;const Ae=document.activeElement;(Ae===null||Ae===document.body)&&((Re=A.current.get(oe))==null||Re.focus())}))}function be(oe){z(""),requestAnimationFrame(()=>z(oe))}function ne(oe){const he=oe==="group"?g():x();be(he?oe==="group"?i("所选图层已组合"):i("所选组合已解组"):oe==="group"?i("无法组合所选图层"):i("无法解组所选图层"))}function Be(oe){const he=ye(oe);j(Ae=>{const Re=new Set(Ae);return Re.has(he)?Re.delete(he):Re.add(he),Re})}function le(oe){H.current=!1,N(ye(oe.path)),I(oe.node.name),requestAnimationFrame(()=>{var Ae;const he=(Ae=A.current.get(ye(oe.path)))==null?void 0:Ae.querySelector("input");he instanceof HTMLInputElement&&(he.focus(),he.select())})}function De(oe){H.current=!1;const he=F.trim()||z5(oe.node),Ae=l(oe.path,he);N(null),I(""),Ae!==!1&&be(i("{name} 已重命名",{name:he}))}function W(oe,he){s(oe.path,{toggle:he})===!1&&be(i("只能同时选择同一组内的图层"))}function ae(oe){const he=D.filter(qe=>ye(qe.parentPath)===ye(oe.parentPath)),Ae=he.findIndex(qe=>ye(qe.path)===ye(oe.path)),Re=he[Ae+1]??he[Ae-1]??(oe.parentPath.length>0?re.get(ye(oe.parentPath)):void 0);Re&&te(ye(Re.path))}function Se(oe,he,Ae){h(oe.path,he)!==!1&&(be(Ae?i(he?"{name} 已设为自身隐藏,仍受父级隐藏影响":"{name} 已取消自身隐藏,仍受父级隐藏影响",{name:oe.node.name}):i(he?"{name} 已隐藏":"{name} 已显示",{name:oe.node.name})),he&&!Ae&&ae(oe))}function ze(oe,he,Ae){f(oe.path,he)!==!1&&(be(Ae?i(he?"{name} 已设为自身锁定,仍受父级锁定影响":"{name} 已取消自身锁定,仍受父级锁定影响",{name:oe.node.name}):i(he?"{name} 已锁定":"{name} 已解锁",{name:oe.node.name})),te(ye(oe.path)))}function ue(oe,he,Ae){const Re=he.key,qe=ye(oe.path);if(w!==qe){if(he.altKey&&(Re==="ArrowUp"||Re==="ArrowDown")){he.preventDefault(),he.stopPropagation();const Me=Re==="ArrowUp"?"forward":"backward";if(o(oe.parentPath,[oe.node.id],Me)!==!1){const Je=D.filter(_t=>ye(_t.parentPath)===ye(oe.parentPath)),mt=Je.findIndex(_t=>ye(_t.path)===qe),Lt=Math.max(0,Math.min(Je.length-1,mt+(Me==="forward"?-1:1)));be(i("{name} 已移至第 {n} 层",{name:oe.node.name,n:Lt+1})),te(qe)}else Ae&&be(i("图层已锁定,无法调整层级"));return}if(Re==="ArrowDown"||Re==="ArrowUp"||Re==="Home"||Re==="End"){he.preventDefault(),he.stopPropagation();const Me=D.findIndex(Je=>ye(Je.path)===qe),Mt=Re==="Home"?0:Re==="End"?D.length-1:Math.max(0,Math.min(D.length-1,Me+(Re==="ArrowDown"?1:-1)));te(ye(D[Mt].path));return}if(Re==="ArrowRight"){if(he.preventDefault(),he.stopPropagation(),oe.node.type!=="group")return;if(!m.has(qe)){Be(oe.path);return}const Mt=D.find(Je=>Je.parentPath.length===oe.path.length&&Je.parentPath.every((mt,Lt)=>mt===oe.path[Lt]));Mt&&te(ye(Mt.path));return}if(Re==="ArrowLeft"){if(he.preventDefault(),he.stopPropagation(),oe.node.type==="group"&&m.has(qe)){Be(oe.path);return}oe.parentPath.length>0&&te(ye(oe.parentPath));return}if(Re==="Enter"){he.preventDefault(),he.stopPropagation(),W(oe,!1);return}if(Re===" "){he.preventDefault(),he.stopPropagation(),W(oe,!0);return}if(Re==="F2"){he.preventDefault(),he.stopPropagation(),le(oe);return}}}function Ye(oe,he){he.preventDefault();const Ae=L.current;if(L.current=null,!Ae)return;const Re=re.get(ye(Ae));if(!Re)return;if(!(ye(Re.parentPath)===ye(oe.parentPath))){be(i("图层只能在同一组内排序"));return}if(Re.node.id===oe.node.id)return;const Me=q.has(ye(Re.path));if(Me&&q.has(ye(oe.path)))return;const Mt=Me?n.filter(lt=>ye(lt.slice(0,-1))===ye(oe.parentPath)).length:1,Je=D.filter(lt=>ye(lt.parentPath)===ye(oe.parentPath)),mt=Je.findIndex(lt=>ye(lt.path)===ye(Ae)),Lt=Je.findIndex(lt=>ye(lt.path)===ye(oe.path));if(mt<0||Lt<0)return;c(oe.parentPath,[Re.node.id],oe.node.id)!==!1?be(Mt>1?i("已移动 {count} 个图层至 {name} 上方",{count:Mt,name:oe.node.name}):i("{name} 已移至第 {n} 层",{name:Re.node.name,n:Lt+1})):Me&&r&&be(i("图层已锁定,无法调整层级"))}function Ue(oe){return`freeform-${K}-group-${encodeURIComponent(ye(oe))}`}function Ot(oe){return`freeform-${K}-status-${encodeURIComponent(ye(oe))}`}function Rt(oe,he,Ae,Re=!1,qe=!1){return[...oe].reverse().map(Me=>{const Mt=[...he,Me.id],Je=ye(Mt),mt={node:Me,path:Mt,parentPath:[...he]},Lt=Me.type==="group"&&m.has(Je),_t=q.has(Je),lt=w===Je,pt=E5(Ae),ee=Re||Me.locked,He=qe||Me.hidden,ct=km(Me),$t=ee||ct||_t&&r,bt=["freeform-layer-row",_t?"is-selected":"",ee?"is-effectively-locked":"",$t&&!ee?"is-structurally-locked":"",He?"is-effectively-hidden":""].filter(Boolean).join(" "),gn=Ot(Mt),xn=[Me.hidden?i("自身隐藏"):i("自身可见"),qe?i("受父级隐藏影响,当前隐藏"):Me.hidden?i("当前隐藏"):i("当前可见"),Me.locked?i("自身锁定"):i("自身未锁定"),Re?i("受父级锁定影响,当前锁定"):Me.locked?i("当前锁定"):i("当前未锁定"),ct?i("包含锁定后代,结构只读"):_t&&r?i("当前选择包含锁定图层,结构只读"):""].join(i(";")),Dt=i("隐藏图层 {name}",{name:Me.name}),Xn=i(Me.hidden?"显示 {name}":"隐藏 {name}",{name:Me.name}),se=i("锁定图层 {name}",{name:Me.name}),ve=i(Me.locked?"解锁 {name}":"锁定 {name}",{name:Me.name}),ce=[qe?i("隐藏"):"",Re?i("锁定"):""].filter(Boolean).join(i("和"));return t.jsxs("div",{className:"freeform-layer-branch",children:[t.jsxs("div",{ref:pe=>{pe?A.current.set(Je,pe):A.current.delete(Je)},className:bt,role:"treeitem","aria-label":Ir(Me.name),"aria-level":Ae,"aria-selected":_t,"aria-expanded":Me.type==="group"?Lt:void 0,"aria-owns":Me.type==="group"&&Lt?Ue(Mt):void 0,"aria-describedby":gn,"data-effective-locked":ee?"true":"false","data-structural-locked":$t?"true":"false","data-effective-hidden":He?"true":"false",tabIndex:k===Je?0:-1,draggable:!lt&&!$t,style:{paddingLeft:C5(Ae)},onFocus:()=>v(Je),onClick:pe=>{lt||W(mt,pe.shiftKey||pe.ctrlKey||pe.metaKey)},onDoubleClick:pe=>{pe.preventDefault(),pe.stopPropagation(),le(mt)},onKeyDown:pe=>ue(mt,pe,$t),onDragStart:()=>{$t||(L.current=mt.path)},onDragOver:pe=>pe.preventDefault(),onDrop:pe=>Ye(mt,pe),children:[pt&&t.jsx("span",{className:"freeform-layer-depth","aria-hidden":"true",title:i("第 {n} 层",{n:pt}),children:pt}),Me.type==="group"?t.jsx("button",{className:"freeform-layer-expand",type:"button","aria-label":Lt?i("折叠图层组"):i("展开图层组"),tabIndex:-1,onClick:pe=>{pe.preventDefault(),pe.stopPropagation(),Be(Mt),te(Je)},children:I5(Lt)}):t.jsx("span",{className:"freeform-layer-expand-spacer","aria-hidden":"true"}),t.jsxs("span",{className:"freeform-layer-type","aria-hidden":"true",children:[R5(Me),(qe||Re)&&t.jsx("span",{className:"freeform-layer-inherited-state",title:i("受父级{state}影响",{state:ce}),children:D5()})]}),lt?t.jsx("input",{className:"freeform-layer-rename","aria-label":i("重命名图层"),value:F,onChange:pe=>I(pe.currentTarget.value),onBlur:()=>De(mt),onKeyDown:pe=>{if(pe.stopPropagation(),pe.key==="Enter"){if(pe.nativeEvent.isComposing||H.current)return;pe.preventDefault(),De(mt)}else pe.key==="Escape"&&(pe.preventDefault(),H.current=!1,N(null),I(""))},onCompositionStart:()=>{H.current=!0},onCompositionEnd:()=>{H.current=!1}}):t.jsx("span",{className:"freeform-layer-name",title:Ir(Me.name),onDoubleClick:pe=>{pe.preventDefault(),pe.stopPropagation(),le(mt)},children:Ir(Me.name)}),t.jsx("span",{id:gn,className:"sr-only",children:xn}),t.jsxs("span",{className:"freeform-layer-actions",children:[t.jsx("button",{className:"freeform-layer-action",type:"button","aria-label":Dt,"aria-pressed":Me.hidden,title:Xn,onPointerDown:pe=>{pe.preventDefault(),pe.stopPropagation()},onKeyDown:pe=>pe.stopPropagation(),onDoubleClick:pe=>{pe.preventDefault(),pe.stopPropagation()},onDragStart:pe=>{pe.preventDefault(),pe.stopPropagation()},onClick:pe=>{pe.preventDefault(),pe.stopPropagation(),!(pe.detail>1)&&Se(mt,!Me.hidden,qe)},children:L5(!Me.hidden)}),t.jsx("button",{className:"freeform-layer-action",type:"button","aria-label":se,"aria-pressed":Me.locked,title:ve,onPointerDown:pe=>{pe.preventDefault(),pe.stopPropagation()},onKeyDown:pe=>pe.stopPropagation(),onDoubleClick:pe=>{pe.preventDefault(),pe.stopPropagation()},onDragStart:pe=>{pe.preventDefault(),pe.stopPropagation()},onClick:pe=>{pe.preventDefault(),pe.stopPropagation(),!(pe.detail>1)&&ze(mt,!Me.locked,Re)},children:$5(Me.locked)})]})]}),Me.type==="group"&&Lt&&t.jsx("div",{id:Ue(Mt),className:"freeform-layer-children",role:"group",children:Rt(Me.children,Mt,Ae+1,ee,He)})]},Je)})}return t.jsxs("div",{className:"freeform-layers-panel",children:[t.jsxs("div",{className:"freeform-layers-heading",children:[t.jsxs("span",{className:"freeform-layers-title",children:[i("图层"),t.jsx("span",{className:"freeform-layers-count",children:D.length})]}),t.jsxs("div",{className:"freeform-layers-commands",role:"group","aria-label":i("图层组合操作"),children:[t.jsx("button",{className:"freeform-layers-command",type:"button","data-testid":"freeform-group-selection",title:i("组合所选图层 (Ctrl+G)"),onClick:()=>ne("group"),children:i("组合")}),t.jsx("button",{className:"freeform-layers-command",type:"button","data-testid":"freeform-ungroup-selection",title:i("解组所选图层 (Ctrl+Shift+G)"),onClick:()=>ne("ungroup"),children:i("解组")})]})]}),t.jsx("div",{ref:T,className:"freeform-layer-tree",role:"tree","aria-label":i("图层树"),"aria-multiselectable":"true",onDragEnd:()=>{L.current=null},children:Rt(e,[],1)}),t.jsx("div",{className:"freeform-layer-live","data-testid":"freeform-layer-live","aria-live":"polite","aria-atomic":"true",children:M})]})}const ih="freeform-page-size-popover",Nc="freeform-page-size-error";function sh(e){return e.trim()===""?Number.NaN:Number(e)}function P5({isActive:e,width:n,height:r,onApply:s}){const l=p.useRef(null),o=p.useRef(null),c=p.useRef(null),f=p.useRef(null),h=p.useRef(e),[g,x]=p.useState(!1),[m,j]=p.useState(String(n)),[k,v]=p.useState(String(r)),[w,N]=p.useState(null),F=Tc.find(L=>L.width===n&&L.height===r),I=F?`${i(F.ratio)} · ${n}×${r}px`:i("自定义 · {width}×{height}px",{width:n,height:r});h.current=e;function M(){h.current&&(f.current!==null&&window.cancelAnimationFrame(f.current),f.current=window.requestAnimationFrame(()=>{var L;f.current=null,h.current&&((L=o.current)==null||L.focus())}))}function z(L){x(!1),N(null),L&&M()}function A(){e&&(j(String(n)),v(String(r)),N(null),x(!0))}function T(L,H){const P=U1(L,H);if(!P.ok){N(P.message);return}s(L,H),z(!0)}return p.useEffect(()=>{e||(f.current!==null&&(window.cancelAnimationFrame(f.current),f.current=null),x(!1),N(null))},[e]),p.useEffect(()=>()=>{f.current!==null&&window.cancelAnimationFrame(f.current)},[]),p.useEffect(()=>{var U,K;if(!g||!e)return;const L=(U=c.current)==null?void 0:U.querySelector('.page-size-preset[aria-pressed="true"]'),H=(K=c.current)==null?void 0:K.querySelector(".page-size-field input"),P=L??H;P==null||P.focus()},[g,e]),p.useEffect(()=>{if(!g)return;function L(P){const U=l.current;!U||U.contains(P.target)||z(!bm(P.target))}function H(P){P.key==="Escape"&&(P.preventDefault(),P.stopPropagation(),P.stopImmediatePropagation(),z(!0))}return window.addEventListener("pointerdown",L,!0),window.addEventListener("keydown",H,!0),()=>{window.removeEventListener("pointerdown",L,!0),window.removeEventListener("keydown",H,!0)}},[g,e]),t.jsxs("div",{className:"page-size-control",ref:l,onBlur:L=>{const H=L.relatedTarget;!(H instanceof Node)||L.currentTarget.contains(H)||z(!1)},children:[t.jsxs("button",{ref:o,className:"page-size-trigger",type:"button","data-testid":"page-size-trigger","data-freeform-toolbar-flyout-trigger":"","aria-haspopup":"dialog","aria-expanded":g,"aria-controls":ih,onClick:()=>g?z(!1):A(),children:[t.jsx("span",{"data-testid":"freeform-slide-size",children:I}),t.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",children:t.jsx("path",{d:"m3 4.5 3 3 3-3"})})]}),g&&t.jsxs("div",{ref:c,className:"page-size-popover",id:ih,"data-testid":"page-size-popover",role:"dialog","aria-label":i("页面尺寸"),children:[t.jsxs("div",{className:"page-size-popover-heading",children:[t.jsx("strong",{children:i("页面尺寸")}),t.jsxs("span",{children:[n,"×",r,"px"]})]}),t.jsx("div",{className:"page-size-presets","aria-label":i("常用页面比例"),children:Tc.map(L=>{const H=L.width===n&&L.height===r;return t.jsxs("button",{type:"button",className:H?"page-size-preset on":"page-size-preset","aria-label":i(L.ratio),"aria-pressed":H,onClick:()=>T(L.width,L.height),children:[t.jsx("span",{children:i(L.ratio)}),t.jsxs("small",{children:[L.width,"×",L.height]})]},L.ratio)})}),t.jsxs("form",{className:"page-size-custom",noValidate:!0,onSubmit:L=>{L.preventDefault(),T(sh(m),sh(k))},children:[t.jsx("div",{className:"page-size-custom-heading",children:i("自定义尺寸")}),t.jsxs("div",{className:"page-size-fields",children:[t.jsxs("label",{className:"page-size-field",children:[t.jsxs("span",{children:[i("宽度")," ",t.jsx("small",{children:"px"})]}),t.jsx("input",{"aria-label":i("宽度 px"),"aria-describedby":w?Nc:void 0,type:"number",inputMode:"numeric",min:Bc,max:_c,step:"1",value:m,onChange:L=>{j(L.currentTarget.value),N(null)}})]}),t.jsx("span",{className:"page-size-times","aria-hidden":"true",children:"×"}),t.jsxs("label",{className:"page-size-field",children:[t.jsxs("span",{children:[i("高度")," ",t.jsx("small",{children:"px"})]}),t.jsx("input",{"aria-label":i("高度 px"),"aria-describedby":w?Nc:void 0,type:"number",inputMode:"numeric",min:Bc,max:_c,step:"1",value:k,onChange:L=>{v(L.currentTarget.value),N(null)}})]})]}),w&&t.jsx("div",{className:"page-size-error",id:Nc,role:"alert",children:w}),t.jsx("button",{className:"page-size-apply",type:"submit",children:i("应用尺寸")})]})]})]})}const Qa=[{id:"properties",label:"属性"},{id:"layers",label:"图层"},{id:"history",label:"历史"}];function T5({children:e,layers:n,history:r,propertiesTabRef:s,disabled:l=!1,activeTab:o,onTabChange:c,onClose:f}){const h=p.useRef(null),[g,x]=p.useState(o),m=c;p.useEffect(()=>{x(o)},[o]);const j=p.useId().replace(/:/g,""),k=N=>`freeform-${j}-${N}-tab`,v=N=>`freeform-${j}-${N}-panel`;p.useEffect(()=>{const N=h.current;N&&(l?N.setAttribute("inert",""):N.removeAttribute("inert"))},[l]);function w(N,F){const I=Qa.findIndex(A=>A.id===N);let M=I;if((F.key==="ArrowRight"||F.key==="ArrowDown")&&(M=(I+1)%Qa.length),(F.key==="ArrowLeft"||F.key==="ArrowUp")&&(M=(I-1+Qa.length)%Qa.length),F.key==="Home"&&(M=0),F.key==="End"&&(M=Qa.length-1),M===I)return;F.preventDefault(),F.stopPropagation();const z=Qa[M].id;x(z),m(z),requestAnimationFrame(()=>{var A;return(A=document.getElementById(k(z)))==null?void 0:A.focus()})}return t.jsxs("aside",{ref:h,className:`freeform-inspector freeform-right-panel${l?" is-disabled":""}`,"aria-label":i("属性和图层面板"),"aria-disabled":l||void 0,children:[t.jsxs("div",{className:"freeform-right-head",children:[t.jsx("div",{className:"freeform-right-tabs",role:"tablist","aria-label":i("自由编辑面板"),children:Qa.map(N=>t.jsx("button",{ref:N.id==="properties"?s:void 0,id:k(N.id),className:N.id===o?"freeform-right-tab is-active":"freeform-right-tab",type:"button",role:"tab","aria-selected":N.id===o,"aria-controls":v(N.id),tabIndex:N.id===g?0:-1,onClick:()=>{m(N.id),x(N.id)},onFocus:()=>x(N.id),onKeyDown:F=>w(N.id,F),children:i(N.label)},N.id))}),t.jsx("button",{type:"button",className:"icon-btn freeform-right-close","data-testid":"freeform-panel-close","aria-label":i("收起面板"),title:i("收起面板"),onClick:f,children:t.jsx(Pn,{})})]}),t.jsx("div",{id:v("properties"),className:"freeform-right-tabpanel freeform-properties-tabpanel",role:"tabpanel","aria-labelledby":k("properties"),hidden:o!=="properties",children:e}),t.jsx("div",{id:v("layers"),className:"freeform-right-tabpanel freeform-layers-tabpanel",role:"tabpanel","aria-labelledby":k("layers"),hidden:o!=="layers",children:n}),t.jsx("div",{id:v("history"),className:"freeform-right-tabpanel freeform-history-tabpanel",role:"tabpanel","aria-labelledby":k("history"),hidden:o!=="history",children:r})]})}const W5=[["n","裁剪上边"],["ne","裁剪右上角"],["e","裁剪右边"],["se","裁剪右下角"],["s","裁剪下边"],["sw","裁剪左下角"],["w","裁剪左边"],["nw","裁剪左上角"]];function oh(e){return Number.isFinite(e.left)&&Number.isFinite(e.top)&&Number.isFinite(e.right)&&Number.isFinite(e.bottom)&&e.right>e.left&&e.bottom>e.top}function H5(e){return!!e&&oh(e.frame)&&oh(e.image)&&e.image.left<=e.frame.left+Qt&&e.image.top<=e.frame.top+Qt&&e.image.right+Qt>=e.frame.right&&e.image.bottom+Qt>=e.frame.bottom&&Vs(e.framing)}function O5(e){return Array.isArray(e)&&e.length===6&&e.every(n=>Number.isFinite(n))}function lh(e){return{left:e.left,top:e.top,width:e.right-e.left,height:e.bottom-e.top}}function ch(e){return[e.frame.left,e.frame.top,e.frame.right,e.frame.bottom,e.image.left,e.image.top,e.image.right,e.image.bottom].join("|")}function dh(e,n,r){e.dataset[`crop${n[0].toUpperCase()}${n.slice(1)}Left`]=String(r.left),e.dataset[`crop${n[0].toUpperCase()}${n.slice(1)}Top`]=String(r.top),e.dataset[`crop${n[0].toUpperCase()}${n.slice(1)}Right`]=String(r.right),e.dataset[`crop${n[0].toUpperCase()}${n.slice(1)}Bottom`]=String(r.bottom)}function uh(e,n,r){if(!H5(e)||!O5(n)||!Number.isFinite(r)||r<=0)return null;const s=lh(e.frame),l=lh(e.image),o={left:e.image.left-e.frame.left,top:e.image.top-e.frame.top,width:e.image.right-e.image.left,height:e.image.bottom-e.image.top};return{overlayStyle:{transform:`matrix(${n.join(",")})`,width:Math.max(1,e.frame.right,e.image.right),height:Math.max(1,e.frame.bottom,e.image.bottom),"--crop-hit-size":`${24/r}px`,"--crop-handle-long":`${12/r}px`,"--crop-handle-thick":`${4/r}px`,"--crop-handle-corner":`${8/r}px`,"--crop-halo":`${1/r}px`,"--crop-frame-line":`${1/r}px`,"--crop-focus-line":`${2/r}px`},frameStyle:s,imageStyle:l,brightImageStyle:o,data:{frame:e.frame,image:e.image}}}function vs(e,n){Object.entries(n).forEach(([r,s])=>{s!==void 0&&(r.startsWith("--")?e.style.setProperty(r,String(s)):e.style.setProperty(r,typeof s=="number"?`${s}px`:String(s)))})}const vm=p.forwardRef(function({draft:n,worldMatrix:r,screenScale:s,resolvedSrc:l,alt:o,activeHandle:c=null,onHandlePointerDown:f,onHandleKeyDown:h,onImagePointerDown:g,onImageError:x,onKeyDown:m},j){const k=p.useRef(null),v=p.useRef(null),w=p.useRef(null),N=p.useRef(null),F=p.useRef(null),I=p.useRef(null),M=uh(n,r,s),z=A=>{const T=uh(A,r,s),L=k.current,H=v.current,P=w.current,U=N.current,K=F.current;if(!T||!L||!H||!P||!U||!K)return;vs(L,T.overlayStyle),vs(H,T.imageStyle),vs(P,T.frameStyle),vs(U,T.brightImageStyle),vs(K,T.frameStyle),dh(L,"frame",T.data.frame),dh(L,"image",T.data.image);const D=ch(A);D!==I.current&&(I.current=D,L.dataset.cropDraftKey=D)};return p.useImperativeHandle(j,()=>({renderDraft:z,focusHandle:A=>{var T,L;(L=(T=k.current)==null?void 0:T.querySelector(`[data-crop-handle="${A}"]`))==null||L.focus()}}),[r,s]),p.useLayoutEffect(()=>{z(n)}),p.useLayoutEffect(()=>{var A;(A=k.current)==null||A.focus()},[]),!M||typeof l!="string"||l.length===0?null:t.jsxs("div",{ref:k,className:"freeform-ui-only freeform-image-crop-overlay","data-testid":"freeform-image-crop-overlay","data-crop-draft-key":ch(n),role:"application","aria-label":i("图片裁剪"),tabIndex:-1,style:M.overlayStyle,onKeyDown:m,children:[t.jsx("img",{ref:v,className:"freeform-image-crop-dim",src:l,alt:o,draggable:!1,style:M.imageStyle,onPointerDown:A=>{var T;(T=k.current)==null||T.focus(),g==null||g(A)},onError:x}),t.jsx("div",{ref:w,className:"freeform-image-crop-window",style:M.frameStyle,"aria-hidden":"true",children:t.jsx("img",{ref:N,className:"freeform-image-crop-bright",src:l,alt:"",draggable:!1,style:M.brightImageStyle,onError:x})}),t.jsx("div",{ref:F,className:"freeform-image-crop-frame",style:M.frameStyle,children:W5.map(([A,T])=>t.jsx("button",{type:"button",tabIndex:0,"data-crop-handle":A,"data-active":c===A?"true":void 0,"aria-label":i(T),onPointerDown:L=>f==null?void 0:f(L,A),onKeyDown:L=>h==null?void 0:h(L,A),children:t.jsx("span",{"aria-hidden":"true"})},A))})]})});vm.displayName="ImageCropOverlay";const _5=new Set(["n","ne","e","se","s","sw","w","nw"]),fh=new Set(["id","name","locked","hidden","type","x","y","width","height","rotation","scale","src","alt","fit","framing"]);function pn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Nt(e){return typeof e=="number"&&Number.isFinite(e)}function pi(e){return pn(e)&&Nt(e.width)&&e.width>0&&Nt(e.height)&&e.height>0}function xl(e){return pn(e)&&Nt(e.x)&&Nt(e.y)}function qi(e){if(!pn(e)||!Nt(e.left)||!Nt(e.top)||!Nt(e.right)||!Nt(e.bottom))return!1;const n=e.right-e.left,r=e.bottom-e.top;return Nt(n)&&n>0&&Nt(r)&&r>0}function ea(e){return e.right-e.left}function ta(e){return e.bottom-e.top}function hh(e,n,r){return Math.min(r,Math.max(n,e))}function Xr(e,n){const r=Math.max(1,Math.abs(e),Math.abs(n));return Math.abs(e-n)<=Qt*r*8}function Ds(e,n,r){if(!Nt(e))return null;const s=Qt*Math.max(1,Math.abs(e),Math.abs(n),Math.abs(r));return e<n-s||e>r+s?null:Math.min(r,Math.max(n,e))}function Cl(e){if(!pn(e))return!1;const n=Object.keys(e);return n.length===fh.size&&n.every(r=>fh.has(r))&&typeof e.id=="string"&&e.id.trim().length>0&&typeof e.name=="string"&&typeof e.locked=="boolean"&&typeof e.hidden=="boolean"&&e.type==="image"&&Nt(e.x)&&Nt(e.y)&&Nt(e.width)&&e.width>0&&Nt(e.height)&&e.height>0&&Nt(e.rotation)&&Nt(e.scale)&&e.scale>0&&typeof e.src=="string"&&typeof e.alt=="string"&&e.fit==="cover"&&Vs(e.framing)}function El(e){return pn(e)&&qi(e.frame)&&qi(e.image)&&Vs(e.framing)}function B5(e){return typeof e=="string"&&_5.has(e)}function K5(e){if(!pn(e))return null;const{startNode:n,naturalSize:r}=e;if(!Cl(n)||!pi(r))return null;const s=s0({naturalSize:r,frameSize:{width:n.width,height:n.height},fit:"cover",framing:n.framing});if(!s)return null;const l={left:0,top:0,right:n.width,bottom:n.height},o={left:s.left,top:s.top,right:s.left+s.width,bottom:s.top+s.height};return!qi(l)||!qi(o)?null:{frame:l,image:o,framing:Y1(n.framing)}}function Nm(e){if(!pn(e))return null;const{startNode:n,naturalSize:r,draft:s}=e;if(!Cl(n)||!pi(r)||!El(s))return null;const l=ea(s.frame),o=ta(s.frame),c=ea(s.image),f=ta(s.image);if(s.frame.left<s.image.left-Qt||s.frame.top<s.image.top-Qt||s.frame.right>s.image.right+Qt||s.frame.bottom>s.image.bottom+Qt)return null;const h=c/r.width,g=f/r.height;if(!Nt(h)||h<=0||!Nt(g)||g<=0||!Xr(h,g))return null;const x=h+(g-h)/2,m=Math.max(l/r.width,o/r.height),j=Ds(x/m,Ps,Vi),k=Ds((l/2-(s.image.left-s.frame.left))/c,0,1),v=Ds((o/2-(s.image.top-s.frame.top))/f,0,1);if(j===null||k===null||v===null)return null;const w={focusX:k,focusY:v,zoom:j};if(!Vs(w))return null;const N=s0({naturalSize:r,frameSize:{width:l,height:o},fit:"cover",framing:w});if(!N||!Xr(N.left,s.image.left-s.frame.left)||!Xr(N.top,s.image.top-s.frame.top)||!Xr(N.width,c)||!Xr(N.height,f))return null;try{const F={...n,width:l,height:o},I=Lr(As(n),hi(s.frame.left,s.frame.top)),M=Kc(F,I,n.scale);return!M||M.type!=="image"?null:{x:M.x,y:M.y,width:l,height:o,framing:w}}catch{return null}}function Fm(e,n){return Xr(e.left,n.left)&&Xr(e.top,n.top)&&Xr(e.right,n.right)&&Xr(e.bottom,n.bottom)}function Mm(e,n,r,s,l){if(!pi(l)||!qi(s)||ea(s)<l.width-Qt||ta(s)<l.height-Qt)return null;const o={frame:s,image:r.image,framing:r.framing},c=Nm({startNode:e,naturalSize:n,draft:o});return c?{...o,framing:c.framing}:null}function V5(e,n,r,s){const l={...e};switch(n){case"n":l.top+=r.y,s&&(l.bottom-=r.y);break;case"ne":l.top+=r.y,l.right+=r.x;break;case"e":l.right+=r.x,s&&(l.left-=r.x);break;case"se":l.right+=r.x,l.bottom+=r.y;break;case"s":l.bottom+=r.y,s&&(l.top-=r.y);break;case"sw":l.bottom+=r.y,l.left+=r.x;break;case"w":l.left+=r.x,s&&(l.right-=r.x);break;case"nw":l.left+=r.x,l.top+=r.y;break;default:return null}return Object.values(l).every(Nt)?l:null}function G5(e,n,r){return{left:e.left+(n.left-e.left)*r,top:e.top+(n.top-e.top)*r,right:e.right+(n.right-e.right)*r,bottom:e.bottom+(n.bottom-e.bottom)*r}}function Gr(e,n,r,s){const l=r-n;if(!Nt(l)||Math.abs(l)<=Number.EPSILON)return;const o=(s-n)/l;Nt(o)&&o>0&&o<1&&e.push(o)}function U5(e,n,r,s,l){const o=[0,1];Gr(o,e.left,n.left,r.left),Gr(o,e.top,n.top,r.top),Gr(o,e.right,n.right,r.right),Gr(o,e.bottom,n.bottom,r.bottom);const c=ea(e),f=ea(n),h=ta(e),g=ta(n);Gr(o,c,f,l.width),Gr(o,h,g,l.height),Gr(o,c,f,ea(r)/Vi),Gr(o,h,g,ta(r)/Vi);const x=c/s.width-h/s.height,m=f/s.width-g/s.height;return Gr(o,x,m,0),[...new Set(o)].sort((j,k)=>j-k)}function Y5(e,n){const r=n(0);if(!r)return null;let s={progress:0,candidate:r};const l=(o,c)=>{let f=o,h=c,g=n(f)??s.candidate;for(let x=0;x<56;x+=1){const m=f+(h-f)/2,j=n(m);j?(f=m,g=j):h=m}return{progress:f,candidate:g}};for(let o=1;o<e.length;o+=1){const c=e[o-1],f=e[o];if(f<=s.progress)continue;const h=c+(f-c)/2;if(!n(h))return l(s.progress,h);const x=n(f);if(!x)return l(h,f);s={progress:f,candidate:x}}return s}function Cm(e){const n=pn(e)?e.startDraft:null;if(!pn(e))return n;const{startNode:r,naturalSize:s,handle:l,localDelta:o,minimumFrameSize:c}=e,f=e.symmetric===void 0?!1:e.symmetric;if(!Cl(r)||!pi(s)||!El(n)||!B5(l)||!xl(o)||!pi(c)||typeof f!="boolean"||o.x===0&&o.y===0)return n;const h=V5(n.frame,l,o,f);if(!h)return n;const g=U5(n.frame,h,n.image,s,c),x=Y5(g,m=>Mm(r,s,n,G5(n.frame,h,m),c));return!x||Fm(x.candidate.frame,n.frame)?n:x.candidate}function Z5(e){if(!pn(e))return null;const n=e,{screenDelta:r,renderScale:s,startWorldMatrix:l}=n;if(!xl(r)||!Nt(s)||s<=0)return null;try{const o=rr(l);if(!o)return null;const c=mr(o,{x:r.x/s,y:r.y/s});return xl(c)?c:null}catch{return null}}function mh(e){if(!pn(e))return null;const{renderScale:n,startWorldMatrix:r}=e;if(!Nt(n)||n<=0)return null;try{const s=Ki(r);if(!s)return null;const l=s.scale*n;return Nt(l)&&l>0?l:null}catch{return null}}function Em(e){const n=pn(e)?e.draft:null;if(!pn(e))return n;const{localDelta:r}=e;if(!xl(r)||!El(n)||n.frame.left<n.image.left-Qt||n.frame.top<n.image.top-Qt||n.frame.right>n.image.right+Qt||n.frame.bottom>n.image.bottom+Qt)return n;const s=ea(n.image),l=ta(n.image),o=hh(n.image.left+r.x,n.frame.right-s,n.frame.left),c=hh(n.image.top+r.y,n.frame.bottom-l,n.frame.top),f=Math.abs(o-n.image.left)>Qt,h=Math.abs(c-n.image.top)>Qt;if(!f&&!h)return n;const g={left:o,top:c,right:o+s,bottom:c+l};if(!qi(g))return n;const x=ea(n.frame),m=ta(n.frame),j=f?Ds((x/2-(o-n.frame.left))/s,0,1):n.framing.focusX,k=h?Ds((m/2-(c-n.frame.top))/l,0,1):n.framing.focusY;if(j===null||k===null)return n;const v={focusX:j,focusY:k,zoom:n.framing.zoom};return Vs(v)?{frame:n.frame,image:g,framing:v}:n}function X5(e){const n=pn(e)?e.startDraft:null;if(!pn(e))return n;const r=Z5({screenDelta:e.screenDelta,renderScale:e.renderScale,startWorldMatrix:e.startWorldMatrix});return r?e.kind==="pan"?Em({draft:n,localDelta:r}):e.kind!=="handle"?n:Cm({startNode:e.startNode,naturalSize:e.naturalSize,startDraft:n,handle:e.handle,localDelta:r,minimumFrameSize:e.minimumFrameSize,symmetric:e.symmetric}):n}function q5(e){const n=pn(e)?e.draft:null;if(!pn(e))return n;const{startNode:r,naturalSize:s,ratio:l,minimumFrameSize:o}=e;if(!Cl(r)||!pi(s)||!El(n)||!pi(o)||l!=="original"&&(!Nt(l)||l<=0))return n;const c=l==="original"?s.width/s.height:l;if(!Nt(c)||c<=0)return n;const f=ea(n.frame),h=ta(n.frame);if(!Nt(f)||f<=0||!Nt(h)||h<=0)return n;const g=n.frame.left+f/2,x=n.frame.top+h/2;let m=f,j=h;if(f/h>c?m=h*c:j=f/c,!Nt(m)||!Nt(j))return n;const k={left:g-m/2,top:x-j/2,right:g+m/2,bottom:x+j/2};return Fm(k,n.frame)?n:Mm(r,s,n,k,o)??n}const Zo=40;function Un(e){return typeof e=="number"&&Number.isFinite(e)}function ph(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&Un(e.width)&&e.width>0&&Un(e.height)&&e.height>0}function gh(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&Un(e.x)&&Un(e.y)}function Q5(e){return Array.isArray(e)&&e.length===6&&e.every(Un)}function Ai(e){return{frame:{...e.frame},image:{...e.image},framing:{...e.framing}}}function J5(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const n=e;return[n.frame,n.image].every(s=>s&&Un(s.left)&&Un(s.top)&&Un(s.right)&&Un(s.bottom)&&s.right>s.left&&s.bottom>s.top)?n.image.left<=n.frame.left&&n.image.top<=n.frame.top&&n.image.right>=n.frame.right&&n.image.bottom>=n.frame.bottom&&!!n.framing:!1}function ej(e){var r;if(!e||typeof e!="object"||Array.isArray(e))return!1;const n=e;return Un(n.scopeGeneration)&&typeof n.draftScopeKey=="string"&&typeof n.slideId=="string"&&Array.isArray(n.path)&&n.path.length>0&&n.path.every(s=>typeof s=="string"&&s.length>0)&&typeof n.logicalSrc=="string"&&typeof n.resolvedSrc=="string"&&ph(n.naturalSize)&&!!n.startDocument&&((r=n.startNode)==null?void 0:r.type)==="image"&&Q5(n.startWorldMatrix)&&J5(n.draft)&&(n.minimumFrameSize===void 0||ph(n.minimumFrameSize))}function tj(e){if(e.minimumFrameSize)return{...e.minimumFrameSize};const n=e.startWorldMatrix[0],r=e.startWorldMatrix[1],s=Math.hypot(n,r);return!Un(s)||s<=0?{width:Zo,height:Zo}:{width:Zo/s,height:Zo/s}}function nj(e){return{x:e.includes("e")?1:e.includes("w")?-1:0,y:e.includes("s")?1:e.includes("n")?-1:0}}function xh(e){return e==="n"||e==="e"||e==="s"||e==="w"}function rj(e,n){const r=n.shiftKey?10:1,s=nj(e);return n.key==="ArrowLeft"&&s.x!==0?{x:-r,y:0}:n.key==="ArrowRight"&&s.x!==0?{x:r,y:0}:n.key==="ArrowUp"&&s.y!==0?{x:0,y:-r}:n.key==="ArrowDown"&&s.y!==0?{x:0,y:r}:null}function aj(e){const n=p.useRef(null),r=p.useRef(null),s=p.useRef(null),l=p.useRef(null),o=p.useRef(null),c=p.useRef(null),f=p.useRef(!0),h=p.useRef(()=>{}),g=p.useRef(()=>{}),x=p.useRef(()=>{}),m=p.useRef(()=>{}),j=p.useRef({move:W=>h.current(W),up:W=>g.current(W),cancel:W=>x.current(W),blur:()=>m.current()}),[k,v]=p.useState(null),w=Un(e)&&e>0?e:null,N=o.current,F=p.useCallback(W=>{var ae;!W||!f.current||(ae=n.current)==null||ae.renderDraft(W)},[]),I=p.useCallback(W=>{const ae=Ai(W);l.current=ae,o.current=ae;const Se=s.current;if(Se){const ze={...Se,draft:ae};s.current=ze,v(ze)}F(ae)},[F]),M=p.useCallback(W=>{var ae,Se;if(!(!(W!=null&&W.target)||typeof W.target.releasePointerCapture!="function"))try{(Se=(ae=W.target).hasPointerCapture)!=null&&Se.call(ae,W.pointerId)&&W.target.releasePointerCapture(W.pointerId)}catch{}},[]),z=p.useCallback(()=>{const W=c.current;(W==null?void 0:W.frameId)!==null&&(W==null?void 0:W.frameId)!==void 0&&(cancelAnimationFrame(W.frameId),W.frameId=null)},[]),A=p.useCallback(()=>{window.removeEventListener("pointermove",j.current.move),window.removeEventListener("pointerup",j.current.up),window.removeEventListener("pointercancel",j.current.cancel),window.removeEventListener("blur",j.current.blur)},[]),T=p.useCallback(()=>{const W=c.current;z(),A(),M(W),c.current=null},[z,M,A]),L=p.useCallback(W=>{const ae=s.current;return ae?X5({startNode:ae.startNode,naturalSize:ae.naturalSize,startDraft:W.startDraft,kind:W.kind,handle:W.handle,screenDelta:{x:W.latestClient.x-W.startClient.x,y:W.latestClient.y-W.startClient.y},renderScale:W.renderScale,startWorldMatrix:ae.startWorldMatrix,minimumFrameSize:ae.minimumFrameSize,symmetric:W.symmetric}):W.startDraft},[]),H=p.useCallback(()=>{const W=c.current;return W?(z(),L(W)):null},[L,z]),P=p.useCallback(()=>{const W=c.current;!W||W.frameId!==null||(W.frameId=requestAnimationFrame(()=>{const ae=c.current;if(!ae||ae!==W)return;ae.frameId=null;const Se=L(ae);o.current=Se,F(Se)}))},[L,F]),U=p.useCallback(W=>{const ae=c.current;if(ae){if(W){const Se=H()??ae.startDraft;I(Se)}else z(),I(ae.startDraft);T()}},[z,T,H,I]),K=p.useCallback((W,ae,Se)=>{var Rt;const ze=s.current,ue=r.current;if(!ze||ue===null||c.current||!Se.isPrimary||Se.button!==0||!Un(Se.pointerId))return;Se.preventDefault(),Se.stopPropagation();const Ye=Se.currentTarget;try{(Rt=Ye.setPointerCapture)==null||Rt.call(Ye,Se.pointerId)}catch{}const Ue=Ai(l.current??ze.draft),Ot={pointerId:Se.pointerId,pointerType:Se.pointerType,kind:W,handle:ae,symmetric:!!(Se.ctrlKey||Se.metaKey)&&!!(ae&&xh(ae)),startClient:{x:Se.clientX,y:Se.clientY},latestClient:{x:Se.clientX,y:Se.clientY},startDraft:Ue,renderScale:ue,target:Ye,frameId:null};c.current=Ot,window.addEventListener("pointermove",j.current.move,{passive:!1}),window.addEventListener("pointerup",j.current.up),window.addEventListener("pointercancel",j.current.cancel),window.addEventListener("blur",j.current.blur)},[]),D=p.useCallback(W=>{K("pan",void 0,W)},[K]),re=p.useCallback((W,ae)=>{K("handle",W,ae)},[K]),q=p.useCallback(W=>{if(c.current)return;const ae=s.current;!ae||!gh(W)||I(Em({draft:l.current??ae.draft,localDelta:W}))},[I]),te=p.useCallback((W,ae,Se)=>{if(c.current)return;const ze=s.current;!ze||!gh(ae)||I(Cm({startNode:ze.startNode,naturalSize:ze.naturalSize,startDraft:l.current??ze.draft,handle:W,localDelta:ae,minimumFrameSize:ze.minimumFrameSize,symmetric:Se}))},[I]),be=p.useCallback((W,ae)=>{const Se=rj(W,ae);Se&&(ae.preventDefault(),ae.stopPropagation(),te(W,Se,!!(ae.ctrlKey||ae.metaKey)&&xh(W)))},[te]),ne=p.useCallback(W=>{const ae=W.key==="ArrowLeft"?{x:-1,y:0}:W.key==="ArrowRight"?{x:1,y:0}:W.key==="ArrowUp"?{x:0,y:-1}:W.key==="ArrowDown"?{x:0,y:1}:null;ae&&(W.preventDefault(),W.stopPropagation(),q(W.shiftKey?{x:ae.x*10,y:ae.y*10}:ae))},[q]),Be=p.useCallback(W=>{if(!ej(W)||r.current===null||s.current)return!1;const ae=tj(W),Se=Ai(W.draft),ze={...W,path:[...W.path],naturalSize:{...W.naturalSize},startNode:{...W.startNode,framing:{...W.startNode.framing}},startWorldMatrix:[...W.startWorldMatrix],minimumFrameSize:ae,startDraft:Se,draft:Se};return s.current=ze,l.current=Se,o.current=Se,v(ze),F(Se),!0},[F]),le=p.useCallback(W=>{const ae=s.current;if(!ae)return null;const Se=c.current?H()??o.current??ae.draft:o.current??ae.draft;c.current&&(l.current=Ai(Se),o.current=l.current,F(l.current)),T();const ze={reason:W,session:{...ae,draft:Ai(Se)},draft:Ai(Se)};return s.current=null,l.current=null,o.current=null,v(null),ze},[T,F,H]),De=p.useCallback(()=>{!s.current&&!c.current||(T(),s.current=null,l.current=null,o.current=null,v(null))},[T]);return h.current=W=>{const ae=c.current;!ae||W.pointerId!==ae.pointerId||(W.preventDefault(),ae.latestClient={x:W.clientX,y:W.clientY},P())},g.current=W=>{const ae=c.current;!ae||W.pointerId!==ae.pointerId||(W.preventDefault(),ae.latestClient={x:W.clientX,y:W.clientY},U(!0))},x.current=W=>{const ae=c.current;!ae||W.pointerId!==ae.pointerId||U(!1)},m.current=()=>{c.current&&U(!1)},p.useLayoutEffect(()=>{r.current=w},[w]),p.useLayoutEffect(()=>{const W=o.current;W!==N&&F(W)}),p.useEffect(()=>(f.current=!0,()=>{f.current=!1,T(),s.current=null,l.current=null,o.current=null}),[T]),{session:k,overlayRef:n,renderDraft:N,start:Be,finish:le,invalidate:De,panPointerDown:D,handlePointerDown:re,handleKeyDown:be,overlayKeyDown:ne,nudgePan:q,nudgeHandle:te,applyAspectRatio:W=>{if(c.current)return!1;const ae=s.current;if(!ae)return!1;const Se=q5({startNode:ae.startNode,naturalSize:ae.naturalSize,draft:l.current??ae.draft,ratio:W,minimumFrameSize:ae.minimumFrameSize}),ze=Se!==(l.current??ae.draft);return ze&&I(Se),ze}}}function ij({zoomPercent:e,canZoomOut:n,canZoomIn:r,onZoomOut:s,onZoomIn:l,onFit:o}){return t.jsxs("div",{className:"freeform-zoom",role:"group","aria-label":i("预览缩放"),children:[t.jsx("button",{className:"zoom-btn",type:"button","aria-label":i("缩小画布"),title:i("缩小画布"),disabled:!n,onClick:s,children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M4 10h12"})})}),t.jsxs("button",{className:"zoom-value",type:"button","data-testid":"freeform-zoom-value",title:i("适应画布"),onClick:o,children:[e,"%"]}),t.jsx("button",{className:"zoom-btn",type:"button","aria-label":i("放大画布"),title:i("放大画布"),disabled:!r,onClick:l,children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M10 4v12M4 10h12"})})})]})}const sj={nw:{x:-1,y:-1},n:{x:0,y:-1},ne:{x:1,y:-1},e:{x:1,y:0},se:{x:1,y:1},s:{x:0,y:1},sw:{x:-1,y:1},w:{x:-1,y:0}},oj=["nw","ne","sw"],bh=["n","e","s","w"],yh=56,lj=36,cj=52,jh={cornerRadius:"调整圆角",starInnerRatio:"调整星角内径",bubbleTailX:"调整气泡尾巴"},dj="移动对象",uj="拖拽移动",fj="调整大小",hj="旋转对象";function wh(e,n,r){return{nw:Wn(e,{x:0,y:0}),ne:Wn(e,{x:n,y:0}),se:Wn(e,{x:n,y:r}),sw:Wn(e,{x:0,y:r})}}function mj(e){if(e.length===0)return null;const n=Math.min(...e.map(o=>o.x)),r=Math.min(...e.map(o=>o.y)),s=Math.max(...e.map(o=>o.x+o.width)),l=Math.max(...e.map(o=>o.y+o.height));return{x:n,y:r,width:s-n,height:l-r}}function pj(e,n,r){const s=n.filter(w=>{var N,F;return((N=Yr(e,w))==null?void 0:N.hidden)===!1&&((F=Yr(e,w))==null?void 0:F.locked)===!1});if(s.length===0)return[];if(s.length>1){const w=s.map(M=>[...M]),N=w.flatMap(M=>{const z=Tn(e,M);return z?[z]:[]});if(N.length!==w.length)return[];const F=mj(N);if(!F)return[];const I=hi(F.x,F.y);return[{target:{key:`multi:${w.map(ye).join("|")}`,kind:"multi",nodeIds:w.map(M=>M[M.length-1]),paths:w,worldBounds:F,resizePivot:{x:F.x,y:F.y},corners:wh(I,F.width,F.height),center:{x:F.x+F.width/2,y:F.y+F.height/2}},matrix:I,width:F.width,height:F.height}]}const l=[...s[0]],o=jt(e,l),c=Ur(e,l),f=Tn(e,l);if(!o||!c||!f)return[];const h=o.type==="group"?ud(o.children):{x:0,y:0,width:o.width,height:o.height};if(!h)return[];const g=Lr(c,hi(h.x,h.y)),x=o.type==="line"&&o.points?o.points.map(w=>({x:w.x+h.x,y:w.y+h.y})):void 0;let m=o.type==="shape"&&!o.locked?o0(o.shape,h.width,h.height,o):null;m&&o.type==="shape"&&o.shape==="rect"&&(m=Z1(X1(h.width,h.height,o).topLeft,h.width,h.height,r)),m&&o.type==="shape"&&o.shape==="bubble"&&(m=q1(h.width,h.height,o.bubbleTailX??.5,r));const j=o.type==="shape"?l0(o.shape):null,k=m&&j?{param:j,x:m.x,y:m.y}:void 0,v=o.type==="table"&&!o.locked?c0(h.width,o.cols,o.colWidths).slice(1,-1).map((w,N)=>({index:N,x:w,y:h.height/2})):void 0;return[{target:{key:ye(l),kind:o.type==="group"?"group":"leaf",nodeIds:[o.id],paths:[l],worldBounds:f,resizePivot:Wn(g,{x:0,y:0}),corners:wh(g,h.width,h.height),center:Wn(g,{x:h.width/2,y:h.height/2})},matrix:g,width:h.width,height:h.height,vertices:x,...k?{shapeParamHandle:k}:{},...v?{tableColumnHandles:v}:{}}]}function gj(e){return`matrix(${e.join(",")})`}function xj({nodes:e,selectedPaths:n,renderScale:r,activeInteraction:s,interactive:l,badge:o,onMovePointerDown:c,onResizePointerDown:f,onRotatePointerDown:h,onVertexPointerDown:g,onVertexDoubleClick:x,onShapeParamPointerDown:m,onTableColumnPointerDown:j}){const k=pj(e,n,r),v=r>0?1/r:1;return t.jsx("div",{className:"freeform-ui-only freeform-selection-overlay","data-testid":"freeform-selection-overlay","data-live-interaction":s??void 0,role:"presentation",style:{"--freeform-inverse-scale":v},children:k.map(({target:w,matrix:N,width:F,height:I,vertices:M,shapeParamHandle:z,tableColumnHandles:A})=>{var q;const T=((q=Ki(N))==null?void 0:q.scale)??1,L={left:0,top:0,width:F,height:I,transform:gj(N),"--freeform-inverse-scale":T>0?v/T:v},H=F*T*r,P=I*T*r,U=w.worldBounds.y*r<cj,K=M!==void 0&&M.length>0,D=K||Math.min(H,P)<lj?[]:oj,re=w.kind==="leaf"&&!K?bh.filter(te=>te==="n"||te==="s"?H>=yh:P>=yh):[];return t.jsxs("div",{className:"freeform-selection-item","data-testid":"freeform-selection-box","data-element-id":w.nodeIds.length===1?w.nodeIds[0]:"multi","data-selection-kind":w.kind,style:L,children:[t.jsx("span",{className:"freeform-ui-only element-outline","aria-hidden":"true"}),l&&t.jsxs(t.Fragment,{children:[[...re,...D].map(te=>t.jsx("span",{className:`freeform-ui-only freeform-resize-handle is-${bh.includes(te)?"edge":"corner"}`,"data-handle":te,"data-testid":`freeform-selection-resize-${te}`,"aria-hidden":"true",onPointerDown:be=>f(be,w,te)},te)),t.jsx("button",{className:"freeform-ui-only element-resize freeform-selection-resize","data-testid":"freeform-selection-resize","data-handle":"se",type:"button","aria-label":i(fj),onPointerDown:te=>f(te,w,"se")}),t.jsxs("span",{className:"freeform-ui-only freeform-selection-tools","data-placement":U?"below":"above",children:[t.jsx("button",{className:"freeform-ui-only element-rotate freeform-selection-rotate","data-testid":"freeform-selection-rotate",type:"button","aria-label":i(hj),title:i("拖动旋转,按住 Shift 以 15° 为步长"),onPointerDown:te=>h(te,w),children:t.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[t.jsx("path",{d:"M13 8a5 5 0 1 1-1.46-3.54"}),t.jsx("path",{d:"M13 2.5v3h-3"})]})}),t.jsx("button",{className:"freeform-ui-only element-drag freeform-selection-move","data-testid":"freeform-selection-move",type:"button","aria-label":i(dj),title:i(uj),onPointerDown:te=>c(te,w),children:t.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[t.jsx("path",{d:"M8 1.75v12.5M1.75 8h12.5"}),t.jsx("path",{d:"M6.25 3.5 8 1.75 9.75 3.5M6.25 12.5 8 14.25l1.75-1.75M3.5 6.25 1.75 8l1.75 1.75M12.5 6.25 14.25 8l-1.75 1.75"})]})})]})]}),l&&K&&g&&t.jsx(t.Fragment,{children:M.map((te,be)=>t.jsx("button",{className:"freeform-ui-only freeform-vertex-handle","data-testid":`freeform-vertex-handle-${be}`,type:"button","aria-label":i("拖动顶点 {n}",{n:be+1}),style:{left:te.x,top:te.y},onPointerDown:ne=>g(ne,w,be),onDoubleClick:ne=>x==null?void 0:x(ne,w,be)},`vertex-${be}`))}),l&&z&&m&&t.jsx("button",{className:"freeform-ui-only freeform-vertex-handle freeform-param-handle","data-testid":`freeform-shape-param-${z.param}`,type:"button","aria-label":i(jh[z.param]),title:i(jh[z.param]),style:{left:z.x,top:z.y},onPointerDown:te=>m(te,w,z.param)}),l&&A&&A.length>0&&j&&t.jsx(t.Fragment,{children:A.map(te=>t.jsx("button",{className:"freeform-ui-only freeform-vertex-handle freeform-table-col-handle","data-testid":`freeform-table-col-handle-${te.index}`,type:"button","aria-label":i("调整第 {n} 列宽",{n:te.index+1}),title:i("拖动调整这一列和右边一列的宽度"),style:{left:te.x,top:te.y},onPointerDown:be=>j(be,w,te.index)},`table-col-${te.index}`))}),o&&t.jsx("span",{className:"freeform-ui-only freeform-selection-badge","data-testid":"freeform-selection-badge",children:o})]},w.key)})})}function kn({title:e,testId:n,tone:r="default",children:s}){return t.jsxs("section",{className:`inspector-section inspector-section-${r}`,"data-testid":n,children:[t.jsx("h2",{className:"inspector-section-title",children:e}),t.jsx("div",{className:"inspector-section-body",children:s})]})}function Fc(e){return{past:[],current:e,future:[]}}function Mc(e,n,r){return Object.is(e.current,n)?e:{past:[...e.past,{state:e.current,label:r}],current:n,future:[]}}function bj(e){const n=e.past[e.past.length-1];return n?{past:e.past.slice(0,-1),current:n.state,future:[{state:e.current,label:n.label},...e.future]}:e}function yj(e){const n=e.future[0];return n?{past:[...e.past,{state:e.current,label:n.label}],current:n.state,future:e.future.slice(1)}:e}function jj(e,n){if(!Number.isInteger(n.index)||n.index<0)return e;if(n.kind==="past"){const s=e.past[n.index];if(!s)return e;const l=e.past.slice(n.index+1);return{past:e.past.slice(0,n.index),current:s.state,future:[...l.map((o,c)=>({state:o.state,label:e.past[n.index+c].label})),{state:e.current,label:e.past[e.past.length-1].label},...e.future]}}const r=e.future[n.index];return r?{past:[...e.past,{state:e.current,label:e.future[0].label},...e.future.slice(0,n.index).map((s,l)=>({state:s.state,label:e.future[l+1].label}))],current:r.state,future:e.future.slice(n.index+1)}:e}function kh(e){var n,r,s,l;switch(e.type){case"slide/add-after-active":return"新增页面";case"slide/duplicate":return"复制页面";case"slide/insert":return e.replaceSlideId!==void 0?"替换页面":"插入页面";case"slide/delete":return"删除页面";case"slide/select":return"切换页面";case"slide/reorder":return"调整页面顺序";case"slide/update":return(n=e.patch)!=null&&n.background&&!((r=e.patch)!=null&&r.name)?"更改页面背景":(s=e.patch)!=null&&s.name&&!((l=e.patch)!=null&&l.background)?"重命名页面":"更新页面";case"slide/resize":return"调整页面尺寸";case"guides/set":return"调整参考线";case"document/restyle":return e.palette!==void 0?"更换配色":e.fontSet!==void 0?"更换字体组合":e.fonts!==void 0&&e.colors===void 0?"替换字体":"替换颜色";case"node/set-locked":return e.locked?"锁定对象":"解锁对象";case"node/set-hidden":return e.hidden?"隐藏对象":"显示对象";case"node/rename":return"重命名对象";case"node/update-content":return"编辑内容";case"node/update-style":return e.updates.length>0&&e.updates.every(o=>Object.keys(o.patch).length===1&&"points"in o.patch)?"调整顶点":"更改样式";case"node/update-geometry":return"移动对象";case"node/update-image-crop":return"调整裁切";case"node/delete":return"删除对象";case"node/reorder":return"调整层级";case"node/reorder-above":return"调整层级";case"node/clone":return"复制对象";case"node/insert-children":return"插入对象";case"group/create":return"编组";case"group/ungroup":return"解组";default:return"编辑"}}function oi(e){const n=(e%360+360)%360;return Object.is(n,-0)||n<=Qt||360-n<=Qt?0:n}function Pi(e,n){return Math.abs(e-n)<=Qt}function Sh(e,n){const r=Math.abs(e-n)%360;return Math.min(r,360-r)<=Qt}function Vn(e){return Number.isFinite(e)&&e>0}function wj(e){return Number.isFinite(e)&&e>=0}function kj(e){const n=J1(e);return n?n==="invalid-transform"?"invalid-transform":"invalid-scene":null}function zm(e,n){for(const r of e){const s=[...n,r.id];if(r.locked)return{path:s,node:r};if(r.type==="group"){const l=zm(r.children,s);if(l)return l}}return null}function Sj(e,n,r){for(let s=e.length-1;s>=0;s-=1){const l=e[s];if(l.locked)return{kind:"locked",sourcePath:n.slice(0,s+1),sourceName:l.name}}if(r.type==="group"){const s=zm(r.children,n);if(s)return{kind:"locked-descendant",sourcePath:s.path,sourceName:s.node.name}}return{kind:"editable"}}function Rm(e,n){if(!Array.isArray(n)||n.length===0||!n.every(s=>typeof s=="string"))return{ok:!1,reason:"unknown-path"};const r=kj(e);if(r)return{ok:!1,reason:r};if(n.length>Sl)return{ok:!1,reason:"unknown-path"};try{let s=e,l=Q1(),o=1;const c=[],f=[{name:"页面",path:[]}];let h=null;for(let M=0;M<n.length;M+=1){const z=s.find(A=>A.id===n[M]);if(!z)return{ok:!1,reason:"unknown-path"};if(c.push(z),M===n.length-1){h=z;break}if(z.type!=="group")return{ok:!1,reason:"unknown-path"};l=Lr(l,As(z)),o*=z.scale,f.push({name:z.name,path:n.slice(0,M+1)}),s=z.children}if(!h)return{ok:!1,reason:"unknown-path"};const g=Ki(l),x=Lr(l,As(h)),m=Ki(x),j=o*h.scale;if(!g||!m||!Vn(j))return{ok:!1,reason:"invalid-transform"};const k={path:[...n],breadcrumbs:f,editability:Sj(c,n,h),rotation:oi(m.rotation),worldScale:j};if(h.type!=="group"){const M=Wn(x,{x:h.width/2,y:h.height/2}),z=h.width*j,A=h.height*j,T=M.x-z/2,L=M.y-A/2;if(![T,L,z,A].every(Number.isFinite)||z<=0||A<=0)return{ok:!1,reason:"invalid-transform"};const H={...k,kind:"leaf",node:h,x:T,y:L,width:z,height:A,...h.type==="text"?{fontSize:h.fontSize*j}:{},...h.type==="shape"||h.type==="line"?{strokeWidth:h.strokeWidth*j}:{},...h.type==="path"?{strokeWidth:h.strokeWidth*ai(h.viewBox,h.width,h.height)*j}:{}};return H.fontSize!==void 0&&!Number.isFinite(H.fontSize)||H.strokeWidth!==void 0&&!Number.isFinite(H.strokeWidth)?{ok:!1,reason:"invalid-transform"}:{ok:!0,value:{properties:H,parentWorld:l,parentRotation:oi(g.rotation),parentScale:o,localGroupBounds:null}}}const v=ud(h.children);if(!v||v.width<=0||v.height<=0)return{ok:!1,reason:"invalid-transform"};const w=Wn(x,{x:v.x+v.width/2,y:v.y+v.height/2}),N=v.width*j,F=v.height*j,I=j*100;return![w.x,w.y,N,F,I].every(Number.isFinite)||N<=0||F<=0?{ok:!1,reason:"invalid-transform"}:{ok:!0,value:{properties:{...k,kind:"group",node:h,x:w.x,y:w.y,width:N,height:F,scalePercent:I},parentWorld:l,parentRotation:oi(g.rotation),parentScale:o,localGroupBounds:v}}}catch{return{ok:!1,reason:"invalid-transform"}}}function vj(e,n){const r=Rm(e,n);return r.ok?{ok:!0,properties:r.value.properties}:r}function Nj(e){return e.kind==="locked"?{ok:!1,reason:"locked"}:e.kind==="locked-descendant"?{ok:!1,reason:"locked-descendant"}:null}function Cr(e,n,r,s=!1){return{ok:!0,category:"geometry",update:n?{path:[...e],patch:n}:null,resolvedValue:r,clamped:s}}function Xo(e,n,r){return{ok:!0,category:"style",update:n?{path:[...e],patch:n}:null,resolvedValue:r,clamped:!1}}function Fj(e,n){let r=dl/n,s=ul/n;const l=[];for(const o of e.children)l.push({node:o,effectiveScale:n*o.scale,depth:1});for(;l.length>0;){const o=l.pop();if(o.depth>Sl||!Vn(o.effectiveScale))return null;if(r=Math.max(r,dl/o.effectiveScale),s=Math.min(s,ul/o.effectiveScale),o.node.type==="group")for(const c of o.node.children)l.push({node:c,effectiveScale:o.effectiveScale*c.scale,depth:o.depth+1})}return Vn(r)&&Vn(s)&&r<=s?{min:r,max:s}:null}function vh(e,n,r,s){const l=mr(d0(0,0,r,s),n);return{x:e.x-l.x,y:e.y-l.y}}function Mj(e,n){return Wn(d0(e.x,e.y,e.rotation,e.scale),{x:n.x+n.width/2,y:n.y+n.height/2})}function Cj(e,n,r){if(r===null||typeof r!="object"||typeof r.value!="number"||!Number.isFinite(r.value))return{ok:!1,reason:"invalid-value"};const s=Rm(e,n);if(!s.ok)return s;const l=s.value,{properties:o}=l,c=Nj(o.editability);if(c)return c;if(o.kind==="leaf"){const H=o.node;if(r.property==="scalePercent")return{ok:!1,reason:"unsupported-property"};if(r.property==="fontSize"){if(H.type!=="text")return{ok:!1,reason:"unsupported-property"};if(!Vn(r.value))return{ok:!1,reason:"invalid-value"};if(Pi(o.fontSize??Number.NaN,r.value))return Xo(n,null,r.value);const De=r.value/o.worldScale;return Vn(De)?Xo(n,{fontSize:De},r.value):{ok:!1,reason:"invalid-transform"}}if(r.property==="strokeWidth"){if(H.type!=="shape"&&H.type!=="line"&&H.type!=="path")return{ok:!1,reason:"unsupported-property"};const De=H.type==="shape"||H.type==="path";if(!(De?wj(r.value):Vn(r.value)))return{ok:!1,reason:"invalid-value"};if(Pi(o.strokeWidth??Number.NaN,r.value))return Xo(n,null,r.value);const ae=H.type==="path"?ai(H.viewBox,H.width,H.height):1,Se=r.value/(o.worldScale*ae);return!Number.isFinite(Se)||(De?Se<0:Se<=0)?{ok:!1,reason:"invalid-transform"}:Xo(n,{strokeWidth:Se},r.value)}if(r.property!=="x"&&r.property!=="y"&&r.property!=="width"&&r.property!=="height"&&r.property!=="rotation")return{ok:!1,reason:"unsupported-property"};if((r.property==="width"||r.property==="height")&&!Vn(r.value))return{ok:!1,reason:"invalid-value"};const P=r.property==="rotation"?oi(r.value):r.value;if(r.property==="rotation"?Sh(o.rotation,P):Pi(o[r.property],P))return Cr(n,null,P);if(r.property==="rotation"){const De=oi(P-l.parentRotation);return Cr(n,{rotation:De},P)}const U=r.property==="width"?P:o.width,K=r.property==="height"?P:o.height,D=r.property==="x"?P:o.x,re=r.property==="y"?P:o.y,q=U/o.worldScale,te=K/o.worldScale,be=rr(l.parentWorld);if(!be||!Vn(q)||!Vn(te))return{ok:!1,reason:"invalid-transform"};const ne=Wn(be,{x:D+U/2,y:re+K/2}),Be=ne.x-q/2,le=ne.y-te/2;return[Be,le].every(Number.isFinite)?Cr(n,{x:Be,y:le,...r.property==="width"?{width:q}:{},...r.property==="height"?{height:te}:{}},P):{ok:!1,reason:"invalid-transform"}}if(r.property==="fontSize"||r.property==="strokeWidth")return{ok:!1,reason:"unsupported-property"};if(r.property!=="x"&&r.property!=="y"&&r.property!=="width"&&r.property!=="height"&&r.property!=="rotation"&&r.property!=="scalePercent")return{ok:!1,reason:"unsupported-property"};if((r.property==="width"||r.property==="height"||r.property==="scalePercent")&&!Vn(r.value))return{ok:!1,reason:"invalid-value"};const f=o.node,h=l.localGroupBounds;if(!h)return{ok:!1,reason:"invalid-transform"};const g=rr(l.parentWorld);if(!g)return{ok:!1,reason:"invalid-transform"};const x={x:h.x+h.width/2,y:h.y+h.height/2};if(r.property==="x"||r.property==="y"){if(Pi(o[r.property],r.value))return Cr(n,null,r.value);const H=r.property==="x"?{x:r.value-o.x,y:0}:{x:0,y:r.value-o.y},P=mr(g,H),U=f.x+P.x,K=f.y+P.y;return[U,K].every(Number.isFinite)?Cr(n,{x:U,y:K},r.value):{ok:!1,reason:"invalid-transform"}}const m=Mj(f,h);if(r.property==="rotation"){const H=oi(r.value);if(Sh(o.rotation,H))return Cr(n,null,H);const P=oi(H-l.parentRotation),U=vh(m,x,P,f.scale);return[U.x,U.y].every(Number.isFinite)?Cr(n,{x:U.x,y:U.y,rotation:P},H):{ok:!1,reason:"invalid-transform"}}const k=(r.property==="scalePercent"?r.value/100:r.property==="width"?r.value/h.width:r.value/h.height)/l.parentScale;if(!Vn(k))return{ok:!1,reason:"invalid-transform"};const v=Fj(f,o.worldScale);if(!v)return{ok:!1,reason:"invalid-transform"};const w=k/f.scale,N=w<v.min||w>v.max;let F=Math.min(Math.max(w,v.min),v.max);if(!N&&Pi(r.value,o[r.property]))return Cr(n,null,r.value);const I=Number.EPSILON*32;let M=!1;v.max>v.min&&w>=v.max&&F===v.max?(F=Math.max(v.min,v.max*(1-I)),M=!0):v.max>v.min&&w<=v.min&&F===v.min&&(F=Math.min(v.max,v.min*(1+I)),M=!0);const z=f.scale*F;if(!Vn(z))return{ok:!1,reason:"invalid-transform"};const A=r.property==="scalePercent"?l.parentScale*z*100:r.property==="width"?h.width*l.parentScale*z:h.height*l.parentScale*z,T=N||M;if(Pi(A,o[r.property]))return Cr(n,null,T?o[r.property]:A,T);const L=vh(m,x,f.rotation,z);return[L.x,L.y,A].every(Number.isFinite)?Cr(n,{x:L.x,y:L.y,scale:z},A,T):{ok:!1,reason:"invalid-transform"}}function Ej(e,n,r){try{return Cj(e,n,r)}catch{return{ok:!1,reason:"invalid-transform"}}}function zj(e,n,r){const s=new Set(r),l=Gn(e,n);if(!l)return null;const o=[];for(const x of l){if(!s.has(x.id)||x.hidden)continue;const m=Tn(e,[...n,x.id]);m&&o.push(m)}if(o.length===0)return null;const c=Math.min(...o.map(x=>x.x)),f=Math.min(...o.map(x=>x.y)),h=Math.max(...o.map(x=>x.x+x.width)),g=Math.max(...o.map(x=>x.y+x.height));return{x:c,y:f,width:h-c,height:g-f}}function Rj(e,n,r,s){const l=-n.x,o=e.width-(n.x+n.width),c=-n.y,f=e.height-(n.y+n.height);return{x:l>o?l:Math.min(Math.max(r,l),o),y:c>f?c:Math.min(Math.max(s,c),f)}}function Ij(e,n,r){const s=Gn(e,n);if(!s)return[];const l=Lj(r);return s.filter(o=>!o.hidden).filter(o=>{const c=Tn(e,[...n,o.id]);return c?$j({left:c.x,top:c.y,right:c.x+c.width,bottom:c.y+c.height},l):!1}).map(o=>o.id)}function ld(e,n,r,s,l,o){const c=Gn(n,r),f=ii(n,r),h=f?rr(f):null,g=zj(n,r,s);if(!c||!f||!h||!g)return[];const x=Rj(e,g,l,o),m=mr(h,x),j=new Set(s);return c.filter(k=>j.has(k.id)&&!k.hidden).map(k=>({nodeId:k.id,patch:{x:k.x+m.x,y:k.y+m.y}}))}function Lj(e){const n=Math.min(e.x,e.x+e.width),r=Math.max(e.x,e.x+e.width),s=Math.min(e.y,e.y+e.height),l=Math.max(e.y,e.y+e.height);return{left:n,top:s,right:r,bottom:l}}function $j(e,n){return e.left<n.right&&e.right>n.left&&e.top<n.bottom&&e.bottom>n.top}const Im=4;function Nh(e,n,r,s=Im){const l=e==="x"?{start:"left",end:"right",crossStart:"top",crossEnd:"bottom"}:{start:"top",end:"bottom",crossStart:"left",crossEnd:"right"},o=n[l.start],c=n[l.end],f=n[l.crossStart],h=n[l.crossEnd],g=N=>{const F=h-f,I=N[l.crossEnd]-N[l.crossStart];return Math.min(h,N[l.crossEnd])-Math.max(f,N[l.crossStart])>=Math.min(F,I)/2};let x=null,m=null;for(const N of r)g(N)&&(N[l.end]<=o+s&&(!x||N[l.end]>x[l.end])&&(x=N),N[l.start]>=c-s&&(!m||N[l.start]<m[l.start])&&(m=N));if(!x||!m)return null;const j=o-x[l.end],k=m[l.start]-c,v=Math.abs(j-k);if(v>s||v===0)return null;const w=(j+k)/2;return e==="x"?{dx:w-j,dy:0,gaps:[{gap:w,axis:e,before:x.id,after:m.id}]}:{dx:0,dy:w-j,gaps:[{gap:w,axis:e,before:x.id,after:m.id}]}}function Dj(e,n,r=Im){const s=Nh("x",e,n,r),l=Nh("y",e,n,r),o=c=>c?Math.abs(c.dx)+Math.abs(c.dy):1/0;return o(s)<=o(l)?s:l}const Aj=6,Fh={center:0,start:1,end:2},Mh={page:0,guide:1,element:2};function Pj(e,n,r){const s=Gn(e,n);if(!s)return null;const l=s.filter(o=>r.has(o.id)&&!o.hidden).flatMap(o=>{const c=Tn(e,[...n,o.id]);return c?[{left:c.x,top:c.y,right:c.x+c.width,bottom:c.y+c.height}]:[]});return l.length===0?null:l.reduce((o,c)=>({left:Math.min(o.left,c.left),top:Math.min(o.top,c.top),right:Math.max(o.right,c.right),bottom:Math.max(o.bottom,c.bottom)}))}function Cc(e,n,r,s,l,o){const c=ld(e,n,r,s,l,o),f=Gn(n,r),h=ii(n,r),g=c[0],x=f==null?void 0:f.find(j=>j.id===(g==null?void 0:g.nodeId));if(!g||!x||!h)return{dx:l,dy:o};const m=mr(h,{x:g.patch.x-x.x,y:g.patch.y-x.y});return{dx:m.x,dy:m.y}}function Ch(e,n,r,s,l){const o=e==="x"?n.width:n.height,c=[0,o/2,o].map(x=>({position:x,source:"page"})),h=(Gn(r,s)??[]).filter(x=>!l.has(x.id)&&!x.hidden).flatMap(x=>{const m=Tn(r,[...s,x.id]);return m?Lm({left:m.x,top:m.y,right:m.x+m.width,bottom:m.y+m.height},e).map(j=>({position:j.position,source:"element"})):[]}),g=(n.guides??[]).filter(x=>x.axis===e).map(x=>({position:x.position,source:"guide"}));return[...c,...g,...h]}function Eh(e,n,r,s,l){const o=Lm(r,e).map(h=>({...h,position:h.position+s})),c=n.flatMap(h=>o.map(g=>({anchor:g,distance:Math.abs(h.position-g.position),reference:h,snappedDelta:s+h.position-g.position})).filter(g=>g.distance<=l));c.sort(Oj);const f=c[0];return f?{delta:f.snappedDelta,line:{axis:e,position:f.reference.position,source:f.reference.source}}:{delta:s}}function Tj(e,n,r,s,l,o,c={}){const f=new Set(s),h=Pj(n,r,f);if(!h)return{dx:l,dy:o,lines:[]};const g=Math.max(0,c.threshold??Aj),x=Cc(e,n,r,s,l,o),m=Eh("x",Ch("x",e,n,r,f),h,x.dx,g),j=Eh("y",Ch("y",e,n,r,f),h,x.dy,g),k=Cc(e,n,r,s,m.delta,j.delta),v=[];m.line&&Math.abs(k.dx-m.delta)<=Number.EPSILON*64&&v.push(m.line),j.line&&Math.abs(k.dy-j.delta)<=Number.EPSILON*64&&v.push(j.line);let w=k.dx,N=k.dy,F;const I=g>0?Hj(n,r,f,Wj(h,x)):null;if(I&&(!m.line&&I.dx!==0&&(w=x.dx+I.dx),!j.line&&I.dy!==0&&(N=x.dy+I.dy),w!==k.dx||N!==k.dy)){const M=Cc(e,n,r,s,w,N);w=M.dx,N=M.dy,F=I.gap}return{dx:w,dy:N,lines:v,...F?{space:F}:{}}}function Wj(e,n){return{id:"__dragging__",left:e.left+n.dx,top:e.top+n.dy,right:e.right+n.dx,bottom:e.bottom+n.dy}}function Hj(e,n,r,s){const l=[];for(const f of Gn(e,n)??[]){if(f.hidden||r.has(f.id))continue;const h=Tn(e,[...n,f.id]);h&&l.push({id:f.name,left:h.x,top:h.y,right:h.x+h.width,bottom:h.y+h.height})}if(l.length<2)return null;const o=Dj(s,l);if(!o||o.dx===0&&o.dy===0)return null;const[c]=o.gaps;return c?{dx:o.dx,dy:o.dy,gap:c}:null}function Oj(e,n){const r=e.distance-n.distance;if(r!==0)return r;const s=Mh[e.reference.source]-Mh[n.reference.source];if(s!==0)return s;const l=Fh[e.anchor.name]-Fh[n.anchor.name];return l!==0?l:e.reference.position-n.reference.position}function Lm(e,n){const r=n==="x"?e.left:e.top,s=n==="x"?e.right:e.bottom;return[{name:"start",position:r},{name:"center",position:(r+s)/2},{name:"end",position:s}]}const zh=15;function _j(e){if(!Number.isFinite(e))return 0;const n=Math.round(e/zh)*zh;return n===0?0:n}function Bj(e,n,r,s,l){if(l<=0)return{position:s,target:null};const o=r==="x"?e.width:e.height,c=[{position:o/2,target:"page-center",priority:0},{position:0,target:"page-edge",priority:1},{position:o,target:"page-edge",priority:1}];for(const h of n){if(h.hidden)continue;const g=Tn(n,[h.id]);if(!g)continue;const x=r==="x"?g.x:g.y,m=r==="x"?g.width:g.height;for(const j of[x,x+m/2,x+m])c.push({position:j,target:"element",priority:2})}const f=c.map(h=>({...h,distance:Math.abs(h.position-s)})).filter(h=>h.distance<=l).sort((h,g)=>h.distance-g.distance||h.priority-g.priority)[0];return f?{position:f.position,target:f.target}:{position:s,target:null}}const Kj=500;function Vj(e,n,r,s){return e<s&&r<n}function Gj(e,n,r,s){return(Math.max(e,r)+Math.min(n,s))/2}function Uj(e,n){return[{side:"left",axis:"x",draggedEdge:e.x,referenceEdge:r=>r.x+r.width,isOnSide:r=>r<=e.x,perpendicular:r=>[r.y,r.y+r.height],pageEdge:n?0:null},{side:"right",axis:"x",draggedEdge:e.x+e.width,referenceEdge:r=>r.x,isOnSide:r=>r>=e.x+e.width,perpendicular:r=>[r.y,r.y+r.height],pageEdge:n?n.width:null},{side:"top",axis:"y",draggedEdge:e.y,referenceEdge:r=>r.y+r.height,isOnSide:r=>r<=e.y,perpendicular:r=>[r.x,r.x+r.width],pageEdge:n?0:null},{side:"bottom",axis:"y",draggedEdge:e.y+e.height,referenceEdge:r=>r.y,isOnSide:r=>r>=e.y+e.height,perpendicular:r=>[r.x,r.x+r.width],pageEdge:n?n.height:null}]}function Yj(e,n,r,s=Kj){if(!Number.isFinite(s)||s<=0)return[];const l=[];for(const o of Uj(e,r)){const[c,f]=o.perpendicular(e);let h=null,g=!1;for(const x of n){if(x.source!=="element")continue;const[m,j]=o.perpendicular(x);if(!Vj(c,f,m,j))continue;const k=o.referenceEdge(x);if(!o.isOnSide(k))continue;g=!0;const v=Math.abs(o.draggedEdge-k);v<=0||v>s||h&&v>=h.distance||(h={axis:o.axis,side:o.side,from:o.draggedEdge,to:k,distance:Math.round(v),at:Gj(c,f,m,j),source:"element"})}if(!h&&!g&&o.pageEdge!==null){const x=Math.abs(o.draggedEdge-o.pageEdge);x>0&&x<=s&&(h={axis:o.axis,side:o.side,from:o.draggedEdge,to:o.pageEdge,distance:Math.round(x),at:(c+f)/2,source:"page"})}h&&l.push(h)}return l}const Zj=48,Ns=[1,2,5,10,20,50,100,200,500,1e3,2e3],Xj=5;function qj(e){if(!Number.isFinite(e)||e<=0)return Ns[Ns.length-1];for(const n of Ns)if(n*e>=Zj)return n;return Ns[Ns.length-1]}function Rh(e,n,r){if(!Number.isFinite(e)||!Number.isFinite(n)||n<=e)return[];if(!Number.isFinite(r)||r<=0)return[];const s=Math.ceil(e/r),l=Math.floor(n/r),o=[];for(let c=s;c<=l;c+=1){const f=c*r;o.push({position:f===0?0:f,label:c%Xj===0?String(f===0?0:f):null})}return o}const $m="slicer.freeform.prefs.v1",hr={rulersVisible:!1,guidesVisible:!0,snappingEnabled:!0,exportFormat:"png",exportQuality:.92,exportScale:1,panelOpen:!1,pagesVisible:!0};function Qj(e){return e==="png"||e==="jpeg"||e==="pdf"}function Jj(){try{const e=localStorage.getItem($m);if(!e)return{...hr};const n=JSON.parse(e);if(typeof n!="object"||n===null)return{...hr};const r=n;return{rulersVisible:typeof r.rulersVisible=="boolean"?r.rulersVisible:hr.rulersVisible,guidesVisible:typeof r.guidesVisible=="boolean"?r.guidesVisible:hr.guidesVisible,snappingEnabled:typeof r.snappingEnabled=="boolean"?r.snappingEnabled:hr.snappingEnabled,exportFormat:Qj(r.exportFormat)?r.exportFormat:hr.exportFormat,exportQuality:typeof r.exportQuality=="number"&&Number.isFinite(r.exportQuality)&&r.exportQuality>=.5&&r.exportQuality<=1?r.exportQuality:hr.exportQuality,exportScale:r.exportScale===2?2:1,panelOpen:typeof r.panelOpen=="boolean"?r.panelOpen:hr.panelOpen,pagesVisible:typeof r.pagesVisible=="boolean"?r.pagesVisible:hr.pagesVisible}}catch{return{...hr}}}function e8(e){try{localStorage.setItem($m,JSON.stringify(e))}catch{}}const _i=100,Dm=10,Am=400,qo=10;function _s(e){return Number.isFinite(e)&&e>0}function t8(e,n,r,s){return[e,n,r,s].every(_s)?Math.min(e/r,n/s):null}function n8(e,n){return e===null||!_s(e)||!_s(n)?null:e*(n/100)}function Zr(e){return Number.isFinite(e)?Math.min(Am,Math.max(Dm,e)):_i}const r8=.8;function a8(e,n,r,s,l){if(e===null||!_s(e)||![n,r,s,l].every(_s))return null;const o=Math.min(n/s,r/l)*r8;return Zr(Math.round(o/e*100))}function i8(e,n){if(!Number.isFinite(n)||n===0)return Zr(e);if(!Number.isFinite(e)||e<=0)return _i;const r=Math.min(3e3,Math.max(-3e3,n)),s=Math.exp(-r*.0015);return Zr(Math.round(e*s))}const Ja=["opacity","shadow","filter","blendMode"],s8=["fontSize","fontFamily","textFill","align","fontWeight","verticalAlign","paragraphSpacing","list","lineHeight","letterSpacing","italic","vertical","stroke","strokeWidth","effect"],o8=["fill","stroke","strokeWidth","strokeDash","cornerRadius","cornerRadii","starInnerRatio","bubbleTailX"],l8=["stroke","strokeWidth","dash","cap"],c8=["fill","stroke","strokeWidth","dash","cap","join","fillRule"],d8=["dark","light","ecl","moduleStyle","quietZone"],u8=["accent","showValues","showLegend"],f8=["fit","cornerRadius","stroke","strokeWidth"];function Pm(e){switch(e){case"text":return[...s8,...Ja];case"shape":return[...o8,...Ja];case"line":return[...l8,...Ja];case"path":return[...c8,...Ja];case"image":return[...f8,...Ja];case"qrcode":return[...d8,...Ja];case"chart":return[...u8,...Ja];default:return[]}}function h8(e){if(e.type==="group")return null;const n={};for(const r of Pm(e.type)){const s=e[r];s!==void 0&&(n[r]=s)}if(e.type==="shape"&&e.shape==="rect"&&e.cornerRadii===void 0&&(n.cornerRadii=null),e.type==="path"){const r=ai(e.viewBox,e.width,e.height);n.strokeWidth=e.strokeWidth*r,e.dash!==void 0&&(n.dash=e.dash*r)}return Object.keys(n).length>0?n:null}function m8(e,n,r=1){if(n==="group")return{};const s=new Set(Pm(n)),l={};for(const[o,c]of Object.entries(e))if(!(!s.has(o)||c===void 0)&&!(n==="path"&&o==="fill"&&c.type==="image")&&!(n==="path"&&o==="stroke"&&!ar(c))){if(n==="path"&&(o==="strokeWidth"||o==="dash")&&typeof c=="number"){l[o]=c/r;continue}l[o]=c}return l}function p8(e){const[n,r]=p.useState(()=>{var s;return typeof window<"u"&&((s=window.matchMedia)==null?void 0:s.call(window,e).matches)===!0});return p.useEffect(()=>{var o;const s=(o=window.matchMedia)==null?void 0:o.call(window,e);if(!s)return;const l=()=>r(s.matches);return l(),s.addEventListener("change",l),()=>s.removeEventListener("change",l)},[e]),n}const g8=1e-4,x8=3500,b8={cornerRadius:"调整圆角",starInnerRatio:"调整星角内径",bubbleTailX:"调整气泡尾巴"},y8=["#d92d20","#f97316","#f79009","#129211","#1570ef","#6941c6"],j8=["#fef08a","#fed7aa","#fbcfe8","#bbf7d0","#bfdbfe","#e9d5ff"],w8={color:"#101828",blur:24,offsetX:0,offsetY:8},k8={normal:"正常",multiply:"正片叠底",screen:"滤色",overlay:"叠加",darken:"变暗",lighten:"变亮","color-dodge":"颜色减淡","color-burn":"颜色加深","hard-light":"强光","soft-light":"柔光",difference:"差值",exclusion:"排除",hue:"色相",saturation:"饱和度",color:"颜色",luminosity:"明度"},S8=Jg.map(e=>({id:e,label:k8[e]??e})),Ih=[{id:"round",label:"圆头"},{id:"butt",label:"平头"},{id:"square",label:"方头"}],v8=[{id:"round",label:"圆滑"},{id:"miter",label:"尖角"},{id:"bevel",label:"斜切"}],N8=[{id:"none",label:"无"},{id:"arrow",label:"箭头"},{id:"dot",label:"圆点"}],F8=[{id:"start",label:"起点"},{id:"end",label:"终点"}],M8=wd("freeform");function C8(e,n){const r=n?52:80,s=n?72:120,l=e.width>0&&e.height>0?e.width/e.height:1,o=Math.min(s,r/l);return{width:Math.round(Math.min(r,o*l)),height:Math.round(o)}}function Lh(e){const n=e.currentTarget.getBoundingClientRect(),r=e.currentTarget.closest(".freeform-slide-list");return r!==null&&getComputedStyle(r).flexDirection==="row"?e.clientX<n.left+n.width/2?"before":"after":e.clientY<n.top+n.height/2?"before":"after"}const E8=[{id:"cover",label:"填满"},{id:"contain",label:"适应"}],z8=[{id:"square",label:"直角",radius:0},{id:"small",label:"小圆",radius:12},{id:"large",label:"大圆",radius:28},{id:"capsule",label:"胶囊",radius:"capsule"}],R8=[{id:"original",label:"原图"},{id:"1:1",label:"1:1"},{id:"4:3",label:"4:3"},{id:"3:4",label:"3:4"},{id:"16:9",label:"16:9"},{id:"9:16",label:"9:16"}],I8={original:"original","1:1":1,"4:3":4/3,"3:4":3/4,"16:9":16/9,"9:16":9/16};function Ec(e){return{scopeGeneration:e.scopeGeneration,slideId:e.slideId,scenePathKey:ye(e.path),logicalSrc:e.logicalSrc,resolvedSrc:e.resolvedSrc}}function Oi(e){if((e==null?void 0:e.type)==="image")return{targetKind:"image",logicalSrc:e.src,resolvedSrc:zt.images.resolve(e.src),fit:e.fit,framing:e.framing,frameSize:{width:e.width,height:e.height},shape:null};if((e==null?void 0:e.type)==="shape"&&e.fill.type==="image")return{targetKind:"shape-fill",logicalSrc:e.fill.src,resolvedSrc:zt.images.resolve(e.fill.src),fit:e.fill.fit,framing:e.fill.framing,frameSize:{width:e.width,height:e.height},shape:e.shape};if((e==null?void 0:e.type)==="path"&&e.fill.type==="image"){const n=Hg(e.d,e.viewBox,e.width,e.height);return{targetKind:"shape-fill",logicalSrc:e.fill.src,resolvedSrc:zt.images.resolve(e.fill.src),fit:e.fill.fit,framing:e.fill.framing,frameSize:{width:e.width,height:e.height},shape:null,...n!==null?{clipPath:`path("${n}")`}:{}}}return null}function Qo(e,n){if(n.length>0)return Oi(jt(e.nodes,n));const r=e.background;return r.type!=="image"?null:{targetKind:"page-background",logicalSrc:r.src,resolvedSrc:zt.images.resolve(r.src),fit:r.fit,framing:r.framing,frameSize:{width:e.width,height:e.height},shape:null}}function Ti(e,n,r,s){return{scopeGeneration:e,slideId:n,scenePathKey:ye(r),logicalSrc:s.logicalSrc,resolvedSrc:s.resolvedSrc}}function Jo(e,n){return JSON.stringify([e,n])}function zc(e,n,r){return JSON.stringify([e,n,ye(r)])}function L8(e){return{transform:`matrix(${e.join(",")})`}}function $h(e,n,r,s){return r.targetKind==="page-background"?{type:"slide/update",slideId:e,patch:{background:{type:"image",src:r.logicalSrc,fit:r.fit,framing:s}}}:{type:"node/update-style",slideId:e,updates:[{path:[...n],patch:r.targetKind==="image"?{framing:s}:{fill:{type:"image",src:r.logicalSrc,fit:r.fit,framing:s}}}]}}function $8(e){if(!Number.isFinite(e))return Ps;const n=Math.round(e*100);return Math.min(Vi,Math.max(Ps,n/100))}function D8(e,n){return e.x!==n.x||e.y!==n.y||e.width!==n.width||e.height!==n.height||!Es(e.framing,n.framing)}function A8(e){try{const n=JSON.parse(e);return Array.isArray(n)&&n.length>0&&n.every(r=>typeof r=="string")?n:null}catch{return null}}function P8(e){const n=e.slides.find(r=>r.id===e.activeSlideId);if(!n)throw new Error("Freeform document has no valid active slide");return n}function T8(e,n,r){const s=Math.min(1,e.width/r.width,n.height*.7/r.height),l=Math.max(1,Math.round(r.width*s)),o=Math.max(1,Math.round(r.height*s));return{...e,x:Math.round((n.width-l)/2),y:Math.round((n.height-o)/2),width:l,height:o}}function el(e){return e.path.length===0?i(e.name):Ir(e.name)}function Fs(e){return new Promise((n,r)=>{const s=new FileReader;s.onload=()=>n(String(s.result??"")),s.onerror=()=>r(s.error),s.readAsDataURL(e)})}function Is(e){if(!(e instanceof HTMLElement))return!1;const n=e.tagName.toLowerCase();return n==="input"||n==="textarea"||n==="select"||e.isContentEditable}function W8(e){var n;return e===((n=globalThis.document)==null?void 0:n.body)?!0:e instanceof HTMLElement&&!!e.closest('[data-testid="freeform-canvas"]')}function H8(e){return e instanceof Element?!!e.closest('button, input, textarea, select, a[href], label, summary, [contenteditable="true"], [role="treeitem"], [role="option"], [role="menuitem"], [role="menu"]'):!1}function Dh(e){var r;if(!(e instanceof Element))return null;const n=[];for(let s=e.closest("[data-scene-node-id]");s;s=((r=s.parentElement)==null?void 0:r.closest("[data-scene-node-id]"))??null){const l=s.getAttribute("data-scene-node-id");if(!l)break;n.unshift(l)}return n.length>0?n:null}function Sn(){var n;const e=(n=globalThis.document)==null?void 0:n.activeElement;e instanceof HTMLElement&&Is(e)&&e.blur()}function Er(e,n,r){return Math.max(n,Math.min(r,e))}function An(e){const n=Number.parseFloat(e);return Number.isFinite(n)?n:0}function Rc(e,n){const r=URL.createObjectURL(e),s=globalThis.document.createElement("a");s.href=r,s.download=n,s.click(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}const O8={png:"png",jpeg:"jpg",pdf:"pdf"};function Ic(e,n){return`slide-${String(e+1).padStart(2,"0")}.${O8[n]}`}function ja(e,n,r){return new Promise(s=>e.toBlob(s,n,r))}function _8(e){const n=e[0];return n?e.some(r=>r.width!==n.width||r.height!==n.height):!1}function Ah(e,n,r,s){return s.flatMap(l=>{const o=jt(e,[...r,l]),c=jt(n,[...r,l]);if(!o||!c||o.type!==c.type)return[];const f={x:c.x,y:c.y,rotation:c.rotation,scale:c.scale};return o.type!=="group"&&c.type!=="group"&&(f.width=c.width,f.height=c.height),[{path:[...r,l],patch:f}]})}function tl(e,n){const r=n.flatMap(f=>{const h=Tn(e,f);return h?[h]:[]});if(r.length===0)return null;const s=Math.min(...r.map(f=>f.x)),l=Math.min(...r.map(f=>f.y)),o=Math.max(...r.map(f=>f.x+f.width)),c=Math.max(...r.map(f=>f.y+f.height));return{x:s,y:l,width:o-s,height:c-l}}function B8(e,n,r){var h;const s=ii(e,n),l=s?((h=Ki(s))==null?void 0:h.scale)??1:1,o=[],c=(g,x)=>{const m=x*g.scale;o.push(l*m),g.type==="group"&&g.children.forEach(j=>c(j,m))};return(Gn(e,n)??[]).filter(g=>r.includes(g.id)).forEach(g=>c(g,1)),o.length===0?{min:dl,max:ul}:{min:Math.max(...o.map(g=>dl/g)),max:Math.min(...o.map(g=>ul/g))}}function Ph(e,n){return Lr(hi(n.x,n.y),Lr(e,hi(-n.x,-n.y)))}function Th(e,n,r){const s=K8(e,n.nodes,r);return r.length===0?N5(s,n.nodes,n):s}function K8(e,n,r){if(r.length===0)return e;const s=jt(n,r),l=(s==null?void 0:s.type)==="group"?ud(s.children):null;if(!l)return{...e,x:-e.width/2,y:-e.height/2};const o=l.x+l.width/2,c=l.y+l.height/2;return{...e,x:o-e.width/2,y:c-e.height/2}}function V8(e,n){return e instanceof Error&&e.message.trim()?i(e.message):n}const G8=4,U8=6;function Wh(e,n,r){return{...e==="x"?{left:n,width:1/r}:{top:n,height:1/r},"--freeform-guide-dash":`${G8/r}px`}}const Tm="图层已锁定,先解锁后再编辑",Y8="请先结束当前变换";function Wi(e,n){return n==="locked"||n==="locked-parent"?e==="group"?i("图层或父级已锁定,无法组合"):e==="ungroup"?i("图层或父级已锁定,无法解组"):i(Tm):e==="group"?n==="requires-two"||n==="empty-selection"?i("至少选择两个同级图层后才能组合"):n==="invalid-selection"?i("只能组合同一组内的图层"):n==="hidden"?i("隐藏图层无法组合"):i("当前图层无法组合"):e==="ungroup"?n==="not-group"?i("请选择一个或多个组合后再解组"):i("当前图层无法解组"):i("无法在当前编辑范围内插入对象")}function Hh(e){return{x:e.startX,y:e.startY,width:e.currentX-e.startX,height:e.currentY-e.startY}}function wa(e){return(e==null?void 0:e.type)==="shape"}const Z8=["L","M","Q","H"],X8=["square","rounded","dot"],q8={square:"方块",rounded:"圆角",dot:"圆点"},Q8=[{value:0,label:"无"},{value:1,label:"窄"},{value:2,label:"标准"},{value:4,label:"宽"}],J8=[{id:"classic",label:"经典",dark:"#18181b",light:"#ffffff",moduleStyle:"square"},{id:"dot",label:"圆点",dark:"#18181b",light:"#ffffff",moduleStyle:"dot"},{id:"blue",label:"商务蓝",dark:"#1d4ed8",light:"#eff6ff",moduleStyle:"rounded"},{id:"warm",label:"暖橙",dark:"#b45309",light:"#fef3c7",moduleStyle:"dot"},{id:"promo",label:"促销红",dark:"#dc2626",light:"#fff1f2",moduleStyle:"square"}];function Oh(e){return(e==null?void 0:e.type)==="qrcode"}function Lc(e){return(e==null?void 0:e.type)==="chart"}function ew(e){return(e==null?void 0:e.type)==="table"}function tw(e){return(e==null?void 0:e.type)==="timeline"}function nw(e){return(e==null?void 0:e.type)==="progress"}const rw=["bar","ring","line","radar"],aw=["grouped","stacked","percent"],iw={grouped:"分组",stacked:"堆叠",percent:"百分比"},_h=["#1d4ed8","#e11d48","#f59e0b"],sw=e=>_h.find(n=>!e.includes(n))??_h[0],ow={bar:"柱状图",ring:"环形图",line:"折线图",radar:"雷达图"},lw=["auto","on","off"],cw={auto:"自动",on:"显示",off:"隐藏"},dw={all:"全框",rows:"横线","three-line":"三线表",none:"无"},uw=[{id:"business",label:"商务蓝",colors:["#1d4ed8","#0ea5e9","#94a3b8"]},{id:"sunset",label:"暖阳",colors:["#b45309","#dc2626","#f59e0b"]},{id:"grove",label:"森林",colors:["#15803d","#65a30d","#0f766e"]},{id:"candy",label:"糖果",colors:["#db2777","#7c3aed","#f59e0b"]}];function ei(e){return(e==null?void 0:e.type)==="image"}function _n(e){return(e==null?void 0:e.type)==="text"}function Hi(e){return(e==null?void 0:e.type)==="line"}function ti(e){return(e==null?void 0:e.type)==="path"}function fw({filter:e,resetKey:n,onChange:r}){const s=[{key:"brightness",label:i("亮度"),min:0,max:3,fallback:1},{key:"contrast",label:i("对比度"),min:0,max:3,fallback:1},{key:"saturation",label:i("饱和度"),min:0,max:3,fallback:1},{key:"hue",label:i("色调"),min:0,max:360,fallback:0},{key:"grayscale",label:i("灰度"),min:0,max:1,fallback:0},{key:"sepia",label:i("复古黄"),min:0,max:1,fallback:0},{key:"blur",label:i("模糊"),min:0,max:100,fallback:0}];return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"filter-presets",role:"group","aria-label":i("滤镜预设"),"data-testid":"filter-presets",children:[t.jsxs("button",{className:e?"filter-preset-tile":"filter-preset-tile on",type:"button","data-testid":"filter-preset-none","aria-pressed":!e,onClick:()=>r(null),children:[t.jsx("span",{className:"filter-preset-swatch",style:{background:th}}),i("原图")]}),a5.map(l=>{const o=e!==void 0&&e2(e,l.filter);return t.jsxs("button",{className:o?"filter-preset-tile on":"filter-preset-tile",type:"button","data-testid":`filter-preset-${l.id}`,"aria-pressed":o,title:i("滤镜预设{name}",{name:i(l.name)}),onClick:()=>r({...l.filter}),children:[t.jsx("span",{className:"filter-preset-swatch",style:{background:th,filter:i5(l)}}),i(l.name)]},l.id)})]}),e?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"field-grid",children:s.map(({key:l,label:o,min:c,max:f,fallback:h})=>t.jsxs("label",{children:[o,t.jsx(Et,{ariaLabel:i("滤镜{name}",{name:o}),min:c,max:f,resetKey:n,value:e[l]??h,onCommit:g=>r({...e,[l]:g})})]},l))}),t.jsx("div",{className:"inspector-actions",children:t.jsx("button",{className:"ghost",type:"button","data-testid":"filter-clear",onClick:()=>r(null),children:i("清除滤镜")})})]}):t.jsx("div",{className:"inspector-actions",children:t.jsx("button",{className:"ghost",type:"button","data-testid":"filter-add",onClick:()=>r({brightness:1.1,contrast:1.1}),children:i("添加滤镜")})})]})}function hw({shadow:e,resetKey:n,onChange:r}){return e?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"field-grid with-gap",children:[t.jsxs("div",{className:"stroke-color-field","data-testid":"shadow-color",children:[t.jsx("span",{className:"stroke-color-label",children:i("颜色")}),t.jsxs("div",{className:"color-field",children:[t.jsx("span",{className:"color-field-value",children:e.color==="transparent"?i("透明"):e.color.toUpperCase()}),t.jsx(vt,{label:i("阴影颜色"),color:e.color,onChange:s=>r({...e,color:s})})]})]}),t.jsxs("label",{title:i("阴影模糊"),children:[t.jsx(zn,{name:"blur"}),t.jsx(Et,{ariaLabel:i("阴影模糊"),min:0,max:400,resetKey:n,value:e.blur,onCommit:s=>r({...e,blur:s})})]})]}),t.jsxs("div",{className:"field-grid",children:[t.jsxs("label",{title:i("阴影水平偏移"),children:[t.jsx("span",{className:"field-glyph","aria-hidden":"true",children:"X"}),t.jsx(Et,{ariaLabel:i("阴影水平偏移"),min:-1e3,max:1e3,resetKey:n,value:e.offsetX,onCommit:s=>r({...e,offsetX:s})})]}),t.jsxs("label",{title:i("阴影垂直偏移"),children:[t.jsx("span",{className:"field-glyph","aria-hidden":"true",children:"Y"}),t.jsx(Et,{ariaLabel:i("阴影垂直偏移"),min:-1e3,max:1e3,resetKey:n,value:e.offsetY,onCommit:s=>r({...e,offsetY:s})})]})]}),t.jsx("div",{className:"inspector-actions",children:t.jsx("button",{className:"ghost",type:"button","data-testid":"shadow-clear",onClick:()=>r(null),children:i("清除阴影")})})]}):t.jsx("div",{className:"inspector-actions",children:t.jsx("button",{className:"ghost",type:"button","data-testid":"shadow-add",onClick:()=>r({...w8}),children:i("添加阴影")})})}const mw=[{id:"left",testId:"left",label:"左对齐",icon:"M4 3v14M7 6.5h9M7 13.5h5.5"},{id:"h-center",testId:"hcenter",label:"水平居中",icon:"M10 3v14M5 6.5h10M6.75 13.5h6.5"},{id:"right",testId:"right",label:"右对齐",icon:"M16 3v14M4 6.5h9M7.5 13.5H13"},{id:"top",testId:"top",label:"顶对齐",icon:"M3 4h14M6.5 7v9M13.5 7v5.5"},{id:"v-center",testId:"vcenter",label:"垂直居中",icon:"M3 10h14M6.5 5v10M13.5 6.75v6.5"},{id:"bottom",testId:"bottom",label:"底对齐",icon:"M3 16h14M6.5 4v9M13.5 7.5V13"}],Bh=10,Kh=32;function En({keys:e}){return t.jsx("kbd",{className:"freeform-context-menu-shortcut","aria-hidden":"true",children:e})}const pw=[{id:"box",testId:"insert-text",label:"添加文本框"},{id:"heading",testId:"insert-text-heading",label:"添加标题"},{id:"subheading",testId:"insert-text-subheading",label:"添加副标题"},{id:"body",testId:"insert-text-body",label:"添加一段正文"}],gw={heading:{text:"添加标题",fontSize:88,fontWeight:"bold",lineHeight:1.15,height:110,maxWidth:860,widthRatio:.8},subheading:{text:"添加副标题",fontSize:52,fontWeight:"bold",lineHeight:1.2,height:70,maxWidth:720,widthRatio:.68},body:{text:"在这里写一段正文,说说你想分享的内容。",fontSize:30,fontWeight:"normal",lineHeight:1.55,height:104,maxWidth:640,widthRatio:.6}},xw=[{id:"left",label:"文字左对齐",icon:"M2.5 4h11M2.5 8h7M2.5 12h9"},{id:"center",label:"文字居中",icon:"M2.5 4h11M4.5 8h7M3.5 12h9"},{id:"right",label:"文字右对齐",icon:"M2.5 4h11M6.5 8h7M4.5 12h9"},{id:"justify",label:"文字两端对齐",icon:"M2.5 4h11M2.5 8h11M2.5 12h7"}],bw=[{id:"top",label:"文字靠上",icon:"M2.5 2.5h11M5 6h6M5 8.75h6"},{id:"middle",label:"文字垂直居中",icon:"M2.5 2.5h11M2.5 13.5h11M5 6.75h6M5 9.5h6"},{id:"bottom",label:"文字靠下",icon:"M2.5 13.5h11M5 7.25h6M5 10h6"}],yw=[{id:"none",label:"无列表",icon:"M2.5 4h11M2.5 8h11M2.5 12h11"},{id:"bullet",label:"项目符号列表",icon:"M6 4h7.5M6 8h7.5M6 12h7.5M2.75 4h.01M2.75 8h.01M2.75 12h.01"},{id:"number",label:"编号列表",icon:"M6 4h7.5M6 8h7.5M6 12h7.5M2.25 3l.9-.6v3.1M2 8.4c.25-.55 1.75-.6 1.75.3 0 .65-1.75 1.15-1.75 1.8h1.85"}],jw=[{id:"front",label:"置顶",icon:"M10 16V7M6.5 10.5 10 7l3.5 3.5M5 3.5h10"},{id:"forward",label:"前移",icon:"M10 15.5V5.5M6.5 9 10 5.5 13.5 9"},{id:"backward",label:"后移",icon:"M10 4.5v10M6.5 11 10 14.5l3.5-3.5"},{id:"back",label:"置底",icon:"M10 4v9M6.5 9.5 10 13l3.5-3.5M5 16.5h10"}];function ww({isActive:e,user:n,ownerId:r,transfer:s=null,requestAuth:l,chrome:o,request:c=null,onMetaChange:f}){var Ku,Vu,Gu;const[h,g]=p.useState(()=>Fc(Ao())),x=h.current,m=P8(x),j=x.slides.indexOf(m),k=p.useRef([]),v={activeSlideId:m.id,draftId:null,userId:r},[w,N]=p.useState(()=>({activeGroupPath:[],selectionPaths:[],identity:v})),F=w.activeGroupPath,I=w.selectionPaths,M=p.useMemo(()=>Gn(m.nodes,F)??[],[F,m.nodes]),[z,A]=p.useState(null),[T,L]=p.useState(null),[H,P]=p.useState(_i),[U,K]=p.useState(0),[D,re]=p.useState(null),[q,te]=p.useState(!1),[be,ne]=p.useState(!1),Be=p.useRef(!1),le=p.useRef(null),De=p.useRef(null),[W,ae]=p.useState(null),Se=p.useRef(null),[ze,ue]=p.useState(null),Ye=p.useRef(null),Ue=p.useRef(null),Ot=p.useRef(null),Rt=p.useRef(null),oe=p8("(max-width: 1100px)"),he=p.useRef(null),[Ae,Re]=p.useState(null),[qe,Me]=p.useState(!1),[Mt,Je]=p.useState(null),[mt,Lt]=p.useState(!1),[_t,lt]=p.useState(!1),[pt,ee]=p.useState(null),[He,ct]=p.useState(!1),[$t,bt]=p.useState(null),gn=p.useRef(x),xn=mt&&pt?pt.id:null;p.useEffect(()=>{if(!xn||!r)return;let a=!1;const u=r;return xt(u).shares.list(u).then(y=>{if(a)return;const S=y.find(E=>E.id===xn);S&&ee(S)},()=>{}),()=>{a=!0}},[xn,r]);const[Dt,Xn]=p.useState(!1),[se,ve]=p.useState(!1),[ce,pe]=p.useState(null),At=p.useRef(()=>{}),ts=p.useCallback(a=>At.current(a),[]),[qn,Js]=p.useState("properties"),[aa,gi]=p.useState(null),[In,ia]=p.useState(null),[xi,Jt]=p.useState(null),[ns,Ea]=p.useState(!1),[sr,za]=p.useState(()=>i("未命名设计")),[sa,oa]=p.useState(!1),Ra=p.useRef(!1),or=p.useRef(0),eo=p.useRef(0),Ia=p.useRef(()=>{}),[rs,Ze]=p.useState(null),[to,bi]=p.useState(!1),Ar=p.useRef(0),[lr,br]=p.useState(null),[zl,La]=p.useState([]),[as,la]=p.useState(null),[Rl,yi]=p.useState([]),[no,yr]=p.useState(null),[Ge,Il]=p.useState(Jj);function Qn(a){Il(u=>{const y={...hr,...u,...a};return e8(y),y})}function ro(a){if(Ge.panelOpen&&qn===a){Qn({panelOpen:!1});return}Js(a),Ge.panelOpen||Qn({panelOpen:!0})}function $a(a){pe(u=>u===a?null:a)}const[ji,bn]=p.useState(null),en=p.useRef(null),[ca,is]=p.useState(eg),[ao,Ll]=p.useState(0),Jn=p.useRef(ca),Ut=p.useRef(null),[io,Pr]=p.useState(()=>new Set),[yn,so]=p.useState(null),gt=p.useRef(null),ke=n8(D,H),Nn=aj(ke),B=Nn.session,Q=p.useRef(null),je=p.useRef(null),Ie=p.useRef(null),xe=p.useMemo(()=>mc(m.nodes,F,I),[F,m.nodes,I]),_e=p.useMemo(()=>xe.map(a=>a[a.length-1]),[xe]),rn=p.useMemo(()=>M.filter(a=>_e.includes(a.id)),[M,_e]),jn=rn.length>0&&rn.every(a=>a.locked),cr=rn.length>0&&rn.every(a=>a.hidden),wi=rn.some(a=>a.type==="group"),dr=rn.some(a=>a.type!=="group"),oo=rn.length===1&&rn[0].type==="image",jr=ze?x.slides.findIndex(a=>a.id===ze.slideId):-1,ss=p.useMemo(()=>{const a=[];for(let u=h.future.length-1;u>=0;u-=1)a.push({key:`future-${u}`,label:h.future[u].label,kind:"future",index:u});a.push({key:"current",label:h.past.length>0?h.past[h.past.length-1].label:"初始文档",kind:"current",index:-1});for(let u=h.past.length-1;u>=0;u-=1)a.push({key:`past-${u}`,label:u>0?h.past[u-1].label:"初始文档",kind:"past",index:u});return a},[h]),dt=p.useCallback(a=>{N(u=>{const y=mc(m.nodes,u.activeGroupPath,u.selectionPaths).map(E=>E[E.length-1]),S=typeof a=="function"?a(y):a;return{...u,selectionPaths:S.map(E=>[...u.activeGroupPath,E])}})},[m.nodes]),da=p.useRef(null),ua=p.useRef(null),lo=p.useRef(null),[Kt,Dd]=p.useState(null),[Vt,co]=p.useState(null),$l=p.useRef(null),Da=p.useRef(null),Ad=p.useRef(null),uo=p.useRef(null),fo=p.useRef(null),Hm=wl(),ki=p.useRef(null),ho=p.useRef(null),mo=p.useRef(null),[Pd,Td]=p.useState(!1),Tr=p.useRef(new Map),Wd=p.useRef(null),wt=p.useRef(0),os=p.useRef(0),ls=p.useRef(h),at=p.useRef(x),wr=p.useRef(In),Yt=p.useRef(r),Hd=p.useRef(s),Aa=p.useRef(null),cs=p.useRef(sr),Od=p.useRef(xi),fa=p.useRef(sa),ds=p.useRef(x),us=p.useRef(null),[Dl,_d]=p.useState(null),Al=p.useRef(null),Pl=p.useRef(null);cs.current=sr,Od.current=xi,fa.current=sa,k.current=_e,ls.current=h,at.current=x,wr.current=In,Yt.current=r,Hd.current=s;const Wr=xt(r??hn);Jn.current=ca,gt.current=yn,Q.current=B;const Pa=p.useCallback(a=>{wr.current=a,ia(a)},[]),Si=_e,C=p.useMemo(()=>{const a=xe[0]?jt(m.nodes,xe[0]):void 0;return(a==null?void 0:a.type)==="group"?void 0:a},[m.nodes,xe]),tt=xe.length===1?xe[0]:null,Ta=Lc(C)?Math.min(U,C.series.length-1):0,vi=Lc(C)?C.series[Ta]:void 0,Bt=JSON.stringify([wt.current,os.current,m.id,tt]),ut=p.useMemo(()=>{if(!tt)return null;const a=vj(m.nodes,tt);return a.ok?a.properties:null},[m.nodes,tt]),Wt=p.useMemo(()=>{const a=tg(m.nodes,xe);if(!a)return null;const u=jt(m.nodes,a);return u?{unlockPath:a,unlockName:u.name}:null},[m.nodes,xe]),tn=p.useMemo(()=>{const a=ng(m.nodes,xe)??((ut==null?void 0:ut.editability.kind)==="locked-descendant"?ut.editability.sourcePath:null);if(!a)return null;const u=jt(m.nodes,a);return u?{sourcePath:a,sourceName:u.name}:null},[m.nodes,ut,xe]),Wa=!!(Wt||tn),Ct=p.useMemo(()=>Oi(C),[C]),Bd=p.useMemo(()=>tt&&Ct?Ti(wt.current,m.id,tt,Ct):null,[m.id,Ct,tt]),Om=Bd?ks(ca,Bd):null,Kd=!!(tt&&(Ct==null?void 0:Ct.targetKind)==="shape-fill"&&io.has(zc(wt.current,m.id,tt))),Ha=Wa?i("请先解锁图片"):Kd?i("图片正在处理中"):(Ct==null?void 0:Ct.fit)==="contain"?Ct.targetKind==="image"?i("请先切换到填满模式后裁剪"):i("适应模式不支持调整取景"):Om?null:(Ct==null?void 0:Ct.targetKind)==="image"?i("图片加载完成后可裁剪"):i("图片加载完成后可调整取景"),fs=!!(Ct&&tt&&Ct.fit==="cover"&&!Ha),Tl=!!(fs&&(Ct==null?void 0:Ct.targetKind)==="image"),hs=!!(Ct&&Ct.fit==="cover"&&!Kd&&!Wa&&!Es(Ct.framing,zr())),kr=p.useMemo(()=>Qo(m,[]),[m]),_m=kr?ks(ca,Ti(wt.current,m.id,[],kr)):null,Vd=Pd?i("图片正在处理中"):(kr==null?void 0:kr.fit)==="contain"?i("适应模式不支持调整取景"):_m?null:i("图片加载完成后可调整取景"),Bm=!!(kr&&kr.fit==="cover"&&!Vd),Gd=!!(kr&&kr.fit==="cover"&&!Pd&&!Es(kr.framing,zr())),Ud=p.useMemo(()=>{const a=[{name:"页面",path:[]}];for(let u=1;u<=F.length;u+=1){const y=F.slice(0,u),S=jt(m.nodes,y);if((S==null?void 0:S.type)!=="group")break;a.push({name:S.name,path:y})}return a},[F,m.nodes]),Yd=p.useMemo(()=>xe.length>0&&!Wt&&!tn&&xe.every(a=>{var u;return ye(a.slice(0,-1))===ye(F)&&!((u=jt(m.nodes,a))!=null&&u.hidden)}),[F,m.nodes,Wt,tn,xe]),Km=h.past.length>0,Vm=h.future.length>0,Hr=lr?Hh(lr):null,Wl=p.useMemo(()=>pc([m]),[m]),Hl=p.useMemo(()=>pc(x.slides),[x.slides]),Gm=p.useMemo(()=>r0(x),[x]),wn=p.useCallback((a,u)=>{Ze(V8(a,u))},[]),Zt=p.useCallback(a=>{const u=ls.current,y=typeof a=="function"?a(u):a;return ls.current=y,at.current=y.current,Object.is(y,u)||g(y),y},[]),sn=p.useCallback(()=>{Ze(i(Tm))},[]),Te=p.useCallback(()=>!en.current&&Da.current===null&&!gt.current&&!Q.current?!1:(Ze(i(Y8)),!0),[]),Um=p.useCallback(a=>{wn(a,i("图片续租失败,请检查网络后重试"))},[wn]),ms=rm(Gm,r!==null&&Wr.remote,Um),Ol=p.useCallback(()=>{is(a=>{const u=rg(a);return Jn.current=u,u}),Ll(a=>a+1)},[]),Ym=p.useCallback(a=>{const u=wt.current;is(y=>{const S=ag(y,u,a);return Jn.current=S,S})},[]),Zd=p.useCallback(a=>{if(a.identity.scopeGeneration!==wt.current)return;const u=a.identity.scenePathKey===ig?[]:A8(a.identity.scenePathKey),y=Q.current;if(y){const J=Ec(y),Le=Vl(y),$e=rf({sessionIdentity:J,currentIdentity:(Le==null?void 0:Le.identity)??null,readiness:a});$e.invalidate&&($e.reason==="loading"?Ut.current={...a.identity}:$e.reason==="error"?(Ut.current=null,Ze(i("图片加载失败,请重试"))):Ut.current=null,wo())}const S=!!(Ut.current&&af(a.identity,Ut.current)),E=u?at.current.slides.find(J=>J.id===a.identity.slideId):void 0,R=E&&u?Qo(E,u):null,$=E&&u&&R?Ti(wt.current,E.id,u,R):null;if(!$)return;const O=Jn.current,G=sg(O,a,$);Object.is(G,O)||(Jn.current=G,is(G)),a.status==="error"&&S?(Ut.current=null,Ze(i("图片加载失败,请重试"))):a.status==="ready"&&S&&(Ut.current=null)},[F,ao]),_l=p.useCallback(()=>{const a=da.current;if(!a)return;const u=a.getBoundingClientRect(),y=getComputedStyle(a),S=u.width-An(y.borderLeftWidth)-An(y.borderRightWidth)-An(y.paddingLeft)-An(y.paddingRight),E=u.height-An(y.borderTopWidth)-An(y.borderBottomWidth)-An(y.paddingTop)-An(y.paddingBottom),R=t8(S,E,m.width,m.height);R!==null&&re($=>$!==null&&Math.abs($-R)<g8?$:R)},[m.height,m.width]);p.useLayoutEffect(()=>{if(!e)return;_l();const a=da.current;if(!a)return;const u=new ResizeObserver(()=>_l());return u.observe(a),()=>u.disconnect()},[e,_l]),p.useEffect(()=>{if(!e)return;const a=lo.current;if(!a)return;const u=y=>{if(!y.ctrlKey&&!y.metaKey)return;y.preventDefault();const S=i8(H,y.deltaY);if(S===H)return;const E=ua.current;if(!E||ke===null||ke<=0){le.current=null,P(S);return}const R=E.getBoundingClientRect();le.current={clientX:y.clientX,clientY:y.clientY,worldX:(y.clientX-R.left)/ke,worldY:(y.clientY-R.top)/ke},P(S)};return a.addEventListener("wheel",u,{passive:!1}),()=>a.removeEventListener("wheel",u)}),p.useLayoutEffect(()=>{const a=da.current,u=ua.current,y=De.current;if(y){De.current=null,le.current=null;const R=a?Mu():null;if(!a||!u||!R||ke===null||ke<=0)return;const $=u.getBoundingClientRect();a.scrollLeft+=$.left-(R.clientLeft+R.width/2-y.worldX*ke),a.scrollTop+=$.top-(R.clientTop+R.height/2-y.worldY*ke);return}const S=le.current;if(!S||(le.current=null,!a||!u||ke===null||ke<=0))return;const E=u.getBoundingClientRect();a.scrollLeft+=E.left-(S.clientX-S.worldX*ke),a.scrollTop+=E.top-(S.clientY-S.worldY*ke)});const ps=p.useCallback(()=>{const a=lo.current,u=ua.current;if(!a||!u||ke===null||ke<=0){Dd(null);return}const y=a.getBoundingClientRect(),S=u.getBoundingClientRect(),E={left:S.left-y.left,top:S.top-y.top,scale:ke,width:a.clientWidth,height:a.clientHeight};Dd(R=>R&&R.width===E.width&&R.height===E.height&&Math.abs(R.left-E.left)<.01&&Math.abs(R.top-E.top)<.01&&Math.abs(R.scale-E.scale)<.01?R:E)},[ke]);p.useEffect(()=>{ps()},[ps,ke,m.width,m.height]),p.useEffect(()=>{if(!e)return;const a=lo.current;if(!a)return;const u=new ResizeObserver(()=>ps());return u.observe(a),()=>u.disconnect()},[e,ps]),p.useLayoutEffect(()=>{const a=ze??W;if(!a)return;const u=ze?Ye.current:Se.current;if(!u)return;const y=u.getBoundingClientRect(),S=8,E=Er(a.x,S,Math.max(S,window.innerWidth-y.width-S)),R=Er(a.y,S,Math.max(S,window.innerHeight-y.height-S));E===a.x&&R===a.y||(ze?ue({...ze,x:E,y:R}):ae({x:E,y:R}))},[W,ze]),p.useLayoutEffect(()=>{const a=Rt.current,u=a==null?void 0:a.querySelector(`.freeform-thumb[data-slide-id="${CSS.escape(m.id)}"]`);if(!a||!u)return;const y=a.getBoundingClientRect(),S=u.getBoundingClientRect(),E=8;S.top<y.top?a.scrollTop-=y.top-S.top+E:S.bottom>y.bottom&&(a.scrollTop+=S.bottom-y.bottom+E),S.left<y.left?a.scrollLeft-=y.left-S.left+E:S.right>y.right&&(a.scrollLeft+=S.right-y.right+E)},[m.id,x.slides.length,Ge.pagesVisible]),p.useEffect(()=>{var a,u;ze!=null&&ze.fromButton&&((u=(a=Ye.current)==null?void 0:a.querySelector('[role="menuitem"]:not(:disabled)'))==null||u.focus({preventScroll:!0}))},[ze==null?void 0:ze.slideId,ze==null?void 0:ze.fromButton]),p.useEffect(()=>{if(!e)return;const a=u=>{var E;const y=Ot.current;if(Ot.current=null,Is(u.target)||u.target instanceof Element&&u.target.closest('[aria-modal="true"]')||gt.current||Q.current)return;const S=Yc((E=u.clipboardData)==null?void 0:E.files).slice(0,Bh);if(u.preventDefault(),S.length>0){$p(S);return}bs((y==null?void 0:y.inPlace)??!1)};return window.addEventListener("paste",a),()=>window.removeEventListener("paste",a)}),p.useEffect(()=>{if(!W&&!ze)return;const a=u=>{var S,E;const y=u.target;y instanceof Node&&((S=Se.current)!=null&&S.contains(y)||(E=Ye.current)!=null&&E.contains(y))||y instanceof Element&&y.closest(".freeform-thumb-menu")||(ae(null),ue(null))};return window.addEventListener("pointerdown",a,!0),()=>window.removeEventListener("pointerdown",a,!0)},[W,ze]);const Oa=am((a,u,y)=>{if(a.mode!=="freeform-slide"||u.mode!=="freeform-slide")return;const S=u.document;Pa(a.id);const E=Yt.current;E&&Fa(E,{mode:"freeform-slide",freeformDraftId:a.id}),Aa.current={source:S,document:a.document,updatedAt:a.updatedAt};const R=!!(en.current||Da.current!==null||gt.current||Q.current);xt(E??hn).remote&&!R&&Zt(O=>Object.is(O.current,S)?{...O,current:a.document}:O);const $=at.current;ds.current=Object.is($,a.document)?a.document:S,(Object.is($,S)||Object.is($,a.document))&&Jt(a.updatedAt),y.title===cs.current&&(fa.current=!1,oa(!1))}),{schedule:Bl,release:po,discard:Zm}=Oa,Xd=Oa.flush;p.useEffect(()=>{e||Xd()},[Xd,e]),p.useEffect(()=>{var $;const a=r,u=Wd.current;if(u===a)return;const y=fa.current||Od.current===null&&ls.current.past.length>0;xs(u),Wd.current=a;const S=us.current,E=u!==null&&!li(u)&&li(a)&&y;if(u!==null&&!E&&!S?Ro(u):po(),wt.current+=1,Tr.current.clear(),Pr(new Set),Ol(),Aa.current=null,Jt(null),Ze(null),E){us.current={userId:u,draftId:wr.current},_d(u),Pa(null);return}if(us.current=null,_d(null),a===null)return;if(S){if(S.userId===a){Pa(S.draftId);return}Ro(hn)}const R=wr.current?($=Hd.current)==null?void 0:$.get(wr.current):void 0;if((R==null?void 0:R.mode)==="freeform-slide"){ds.current=at.current,fa.current=!1,Io(R);return}if(u===null&&!S){Pa(null),!y&&!Ra.current&&Du(a);return}Ra.current=!1,ws(Ao(),void 0,!1),Du(a)},[Ol,r,po,Pa]),p.useEffect(()=>{const a=Q.current;if(!a)return;const u=Ec(a),y=Vl(a),S=og(Jn.current,u),E=rf({sessionIdentity:u,currentIdentity:(y==null?void 0:y.identity)??null,readiness:S});E.invalidate&&(E.reason==="loading"?Ut.current={...u}:E.reason==="error"?(Ut.current=null,Ze(i("图片加载失败,请重试"))):Ut.current=null,wo())},[F,m.id,m.nodes,In,B,ca,r]),p.useEffect(()=>{const a={activeSlideId:m.id,draftId:In,userId:r};sf(m.nodes,w,a)!==w&&N(u=>sf(m.nodes,u,a))},[m.id,m.nodes,In,r]),p.useEffect(()=>{if(Wl.length===0)return;const a=window.setTimeout(()=>{gc(Wl).catch(()=>{})},250);return()=>window.clearTimeout(a)},[Wl]),p.useEffect(()=>{if(Hl.length===0)return;const a=window.setTimeout(()=>{gc(Hl).catch(()=>{})},1e3);return()=>window.clearTimeout(a)},[Hl]);const Ve=p.useCallback((a,u)=>{if(Te())return!1;const y=at.current,S=Mr(y,a);if(Object.is(S,y))return!1;const E=u??kh(a);return Zt(R=>{if(Object.is(R.current,y))return Mc(R,S,E);const $=Mr(R.current,a);return Object.is($,R.current)?R:Mc(R,$,E)}),Jt(null),!0},[Te,Zt]),go=p.useCallback(a=>{Ve({type:"document/restyle",...a})},[Ve]),Xm=p.useMemo(()=>({colors:lg(x).map(a=>a.color),replace:(a,u)=>go({colors:{[a]:u}})}),[x,go]),[ha,xo]=p.useState(null),qm=p.useMemo(()=>new Set(cg(x).map(a=>a.fontFamily)),[x]),Qm=xe.map(a=>a.join("/")).join("|");p.useEffect(()=>{ha&&xo(null)},[Qm]);const Jm=p.useCallback((a,u)=>{if(Te())return!1;const y=at.current;let S=y;for(const R of a){const $=Mr(S,R);if(Object.is($,S))return!1;S=$}let E=!1;return Zt(R=>Object.is(R.current,y)?(E=!0,Mc(R,S,u)):R),E&&Jt(null),E},[Te,Zt]);p.useLayoutEffect(()=>{if(!e)return;const a=()=>{if(en.current||Da.current!==null||gt.current||Q.current)return;const y=ua.current;if(!y)return;const S=(G,J)=>{const Le=y.querySelector(`[data-scene-node-id="${CSS.escape(G)}"]`),$e=Le==null?void 0:Le.querySelector(".freeform-textbox");return $e instanceof HTMLElement?F6($e,J):null},E=M6(m.nodes,S);if(E.length===0)return;const R={type:"node/update-geometry",slideId:m.id,updates:E.map(G=>({path:[...G.path],patch:G.dimension==="height"?{height:G.size}:{width:G.size}}))},$=at.current,O=Mr($,R);Object.is(O,$)||(Zt(G=>{const J=Mr(G.current,R);return Object.is(J,G.current)?G:{...G,current:J}}),Jt(null))};a();const u=()=>a();return document.fonts.addEventListener("loadingdone",u),()=>{document.fonts.removeEventListener("loadingdone",u)}},[e,m,Zt]);function ep(a,u,y){return Ve({type:"node/update-content",slideId:a,updates:[{path:[...u],patch:y}]})}function tp(a,u,y){return Ve({type:"node/update-style",slideId:a,updates:[{path:[...u],patch:y}]})}function Ht(a){return tt?ep(m.id,tt,a):!1}function me(a){return tt?tp(m.id,tt,a):!1}function qd(a){return tt?Ve({type:"node/update-geometry",slideId:m.id,updates:[{path:[...tt],patch:a}]}):!1}const Fn=p.useMemo(()=>{if(!aa||!_n(C)||aa.path[aa.path.length-1]!==C.id)return null;const a=Math.min(aa.end,C.text.length),u=Math.min(aa.start,a);return u<a?{start:u,end:a}:null},[aa,C]);function _a(a){if(!tt||!_n(C)||!Fn)return;const u=Qg(C.spans,Fn,a,C.text.length);u&&me({spans:u})}const Qd=!!(Fn&&_n(C)&&xc(C.spans,Fn,a=>a.bold===!0)),Jd=!!(Fn&&_n(C)&&xc(C.spans,Fn,a=>a.underline===!0)),eu=!!(Fn&&_n(C)&&xc(C.spans,Fn,a=>a.strike===!0)),Kl=Fn&&_n(C)?((Vu=(Ku=C.spans)==null?void 0:Ku.find(a=>a.start<=Fn.start&&a.end>Fn.start))==null?void 0:Vu.fontSize)??C.fontSize:null;function tu(a){if(!_n(C)||Kl===null)return;const u=nd(Kl,a),y=C.fontSize;_a(({fontSize:S,...E})=>u===y?E:{...E,fontSize:u})}function np(a){!_n(C)||!C.spans||me({spans:C.spans.filter((u,y)=>y!==a)})}function bo(a,u){const y=zc(wt.current,a,u),S=Symbol(y);return Tr.current.set(y,S),Pr(E=>{const R=new Set(E);return R.add(y),R}),{key:y,token:S}}function yo(a){Tr.current.get(a.key)===a.token&&(Tr.current.delete(a.key),Pr(u=>{if(!u.has(a.key))return u;const y=new Set(u);return y.delete(a.key),y}))}function Ba(a){if(!tt)return!1;const u=bo(m.id,tt),y=me({fill:a});return yo(u),y}function Or(a){if(!tt)return!1;const u=at.current.slides.find(S=>S.id===m.id);if(!u)return!1;const y=Ej(u.nodes,tt,a);return y.ok?y.update?y.category==="geometry"?Ve({type:"node/update-geometry",slideId:m.id,updates:[y.update]}):Ve({type:"node/update-style",slideId:m.id,updates:[y.update]}):!1:((y.reason==="locked"||y.reason==="locked-descendant")&&sn(),!1)}const Ln=p.useCallback(a=>{Zt(u=>{const y=Mr(u.current,a);return Object.is(y,u.current)?u:{...u,current:y}})},[Zt]),Ka=p.useCallback((a,u=i("编辑"))=>{const y=Aa.current,S=y&&(Object.is(y.source,a)||Object.is(y.document,a))?y.document:a;Zt(E=>Object.is(E.current,S)||Object.is(E.current,a)?E:{past:[...E.past,{state:S,label:u}],current:E.current,future:[]}),Jt(null)},[Zt]),ur=p.useCallback(a=>{const u=Aa.current,y=u&&(Object.is(u.source,a)||Object.is(u.document,a))?u.document:a;Zt(S=>Object.is(S.current,y)?S:{...S,current:y}),u&&(Object.is(u.source,a)||Object.is(u.document,a))&&Jt(u.updatedAt)},[Zt]),rp=p.useCallback((a,u,y,S)=>{if(!y)return ur(a),"cancelled";const E=at.current,R=Mr(E,u);if(Object.is(R,E))return"rejected";const $=Aa.current,O=$&&(Object.is($.source,a)||Object.is($.document,a))?$.document:a,G=S??kh(u),J={result:"rejected"};return Zt(Le=>{const $e=Mr(Le.current,u);return Object.is($e,Le.current)?Le:(J.result="committed",{past:[...Le.past,{state:O,label:G}],current:$e,future:[]})}),J.result==="committed"&&Jt(null),J.result},[ur,Zt]);function Va(a,u=Yt.current){if(!ru(a,u))return null;const y=at.current.slides.find(E=>E.id===a.slideId);if(!y)return null;const S=Qo(y,a.path);return!S||S.targetKind!==a.targetKind||S.logicalSrc!==a.logicalSrc||S.resolvedSrc!==a.resolvedSrc?null:{slide:y,target:S}}function nu(a){return ru(a,Yt.current)}function ru(a,u){return a.scopeGeneration===wt.current&&a.draftScopeKey===Jo(wt.current,u)}function ap(a,u){return a.scopeGeneration===wt.current&&a.draftScopeKey===Jo(wt.current,u)}function Vl(a,u=Yt.current){if(!ap(a,u))return null;const y=at.current;if(y.activeSlideId!==a.slideId)return null;const S=y.slides.find(G=>G.id===a.slideId);if(!S)return null;const E=xa(S.nodes,F,a.path);if(!E||ye(E)!==ye(a.path))return null;const R=Yr(S.nodes,a.path),$=jt(S.nodes,a.path);if(!R||R.locked||R.hidden||($==null?void 0:$.type)!=="image"||$.fit!=="cover")return null;const O=Oi($);return!O||O.targetKind!=="image"?null:{slide:S,node:$,identity:Ti(a.scopeGeneration,S.id,a.path,O)}}function jo(a,u=Yt.current){const y=Vl(a,u);if(!y||!af(y.identity,Ec(a)))return null;const S=ks(Jn.current,y.identity);return!S||S.width!==a.naturalSize.width||S.height!==a.naturalSize.height?null:{slide:y.slide,node:y.node}}function wo(){Nn.invalidate(),Q.current=null}function ip(){const a=Q.current;if(!a)return;const u=jo(a);wo(),Ut.current=null,u&&Ze(i("图片加载失败,请重试"))}function Gl(a){if(Q.current||gt.current||Te())return!1;const u=at.current,y=u.slides.find(Qe=>Qe.id===u.activeSlideId);if(!y||y.id!==m.id||ke===null)return!1;const S=xa(y.nodes,F,a);if(!S||ye(S)!==ye(a))return!1;const E=Yr(y.nodes,a),R=jt(y.nodes,a);if(!E||E.locked||E.hidden||(R==null?void 0:R.type)!=="image"||R.fit!=="cover")return!1;const $=Oi(R);if(!$||$.targetKind!=="image")return!1;const O=Ti(wt.current,y.id,a,$),G=ks(Jn.current,O),J=Ur(y.nodes,a);if(!G||!J)return!1;const Le=K5({startNode:R,naturalSize:G});return!Le||mh({renderScale:ke,startWorldMatrix:J})===null||!Nn.start({scopeGeneration:wt.current,draftScopeKey:Jo(wt.current,Yt.current),slideId:y.id,path:[...a],logicalSrc:R.src,resolvedSrc:$.resolvedSrc,naturalSize:{...G},startDocument:u,startNode:{...R,framing:{...R.framing}},startWorldMatrix:[...J],draft:Le})?!1:(Ut.current=null,Sn(),dt([a[a.length-1]]),Ze(null),!0)}function sp(a){const u=Nn.applyAspectRatio(I8[a]);Ze(u?null:i("当前裁剪范围无法应用该比例"))}function gs(a="done",u=Yt.current){const y=Nn.finish(a);if(!y)return Q.current=null,Ut.current=null,null;const{session:S,draft:E}=y;if(!jo(S,u))return Q.current=null,Ut.current=null,null;const $=Nm({startNode:S.startNode,naturalSize:S.naturalSize,draft:E});if(!$)return Ze(i("图片裁剪未能应用,请重试")),Q.current=null,Ut.current=null,"rejected";const O=rp(S.startDocument,{type:"node/update-image-crop",slideId:S.slideId,path:[...S.path],patch:{...$,framing:{...$.framing}}},D8(S.startNode,$),i("调整裁切"));return Ze(O==="rejected"?i("图片裁剪未能应用,请重试"):null),Q.current=null,Ut.current=null,O}function ko(a,u){if(gt.current!==a)return!1;const y=Va(a);return!y||y.target.fit!=="cover"||Es(y.target.framing,u)?!1:(Ln($h(a.slideId,a.path,y.target,u)),!0)}function So(){gt.current=null,Ie.current=null,so(null)}function vo(a){if(gt.current||Te())return!1;const u=at.current,y=u.slides.find($=>$.id===u.activeSlideId);if(!y||y.id!==m.id)return!1;const S=xa(y.nodes,F,a);if(!S||ye(S)!==ye(a))return!1;const E=Yr(y.nodes,a);if(!E||E.locked||E.hidden)return!1;const R=Oi(jt(y.nodes,a));return!R||R.fit!=="cover"||R.targetKind==="shape-fill"&&Tr.current.has(zc(wt.current,y.id,a))?!1:au(u,y,a,R)}function op(){if(gt.current||Te())return!1;const a=at.current,u=a.slides.find(S=>S.id===a.activeSlideId);if(!u||u.id!==m.id)return!1;const y=Qo(u,[]);return!y||y.fit!=="cover"?!1:au(a,u,[],y)}function au(a,u,y,S){const E=Ti(wt.current,u.id,y,S),R=ks(Jn.current,E);if(!R)return!1;const $={scopeGeneration:wt.current,draftScopeKey:Jo(wt.current,Yt.current),slideId:u.id,path:[...y],targetKind:S.targetKind,logicalSrc:S.logicalSrc,resolvedSrc:S.resolvedSrc,naturalSize:{...R},startDocument:a,startFraming:{...S.framing}};return Sn(),dt(y.length>0?[y[y.length-1]]:[]),gt.current=$,so($),Ze(null),requestAnimationFrame(()=>{var O;return(O=je.current)==null?void 0:O.focus()}),!0}function iu(){const a=gt.current;if(!a)return;if(!nu(a)){So();return}const u=Va(a);!u||Es(u.target.framing,a.startFraming)?ur(a.startDocument):Ka(a.startDocument,i("调整取景")),So()}function su(){const a=gt.current;a&&(nu(a)&&ur(a.startDocument),So())}function xs(a=Yt.current){const u=Q.current;u&&(jo(u,a)?gs("transition",a):wo());const y=gt.current;y&&(Va(y,a)&&ur(y.startDocument),So()),Ut.current=null,Ol()}function Ul(){!tt||!Ct||!hs||Ve($h(m.id,tt,Ct,zr()))}function Yl(a){const u=gt.current;if(!u)return;const y=Va(u);y&&ko(u,{...y.target.framing,zoom:$8(a)})}function lp(a){const u=gt.current;if(!u)return;const y=Va(u);y&&ko(u,s2({naturalSize:u.naturalSize,frameSize:y.target.frameSize,framing:y.target.framing,localDelta:a}))}function cp(a){if(!a.isPrimary||a.button!==0||Ie.current!==null)return;const u=gt.current,y=u?Va(u):null,S=u&&y?Ur(y.slide.nodes,u.path):null;if(!u||!y||!S||ke===null)return;a.preventDefault(),a.stopPropagation(),a.currentTarget.focus();const E=a.pointerId;Ie.current=E;const R={x:a.clientX,y:a.clientY},$={...y.target.framing},O={...y.target.frameSize},G=ke;let J=!1;const Le=()=>{window.removeEventListener("pointermove",$e),window.removeEventListener("pointerup",Qe),window.removeEventListener("pointercancel",Ce),window.removeEventListener("blur",Ne),Ie.current===E&&(Ie.current=null)},$e=Ke=>{J||Ke.pointerId!==E||(Ke.preventDefault(),ko(u,l2({naturalSize:u.naturalSize,frameSize:O,framing:$,screenDelta:{x:Ke.clientX-R.x,y:Ke.clientY-R.y},renderScale:G,worldMatrix:S})))},Qe=Ke=>{J||Ke.pointerId!==E||(J=!0,Le())},We=()=>{J||(J=!0,Le(),ko(u,$))},Ce=Ke=>{Ke.pointerId===E&&We()},Ne=()=>We();window.addEventListener("pointermove",$e,{passive:!1}),window.addEventListener("pointerup",Qe),window.addEventListener("pointercancel",Ce),window.addEventListener("blur",Ne)}p.useEffect(()=>{if(!yn)return;const a=requestAnimationFrame(()=>{var u;return(u=je.current)==null?void 0:u.focus()});return()=>cancelAnimationFrame(a)},[yn]),p.useEffect(()=>{e||(gt.current||Q.current)&&xs()},[e]);function No(a){(gt.current||Q.current)&&xs(),!Te()&&a!==m.id&&(Ym(m.id),Ln({type:"slide/select",slideId:a}),dt([]))}function dp(){Te()||(Ve({type:"slide/add-after-active"}),dt([]))}function up(a=m.id){Te()||(Ve({type:"slide/duplicate",slideId:a}),dt([]))}const[ou,Zl]=p.useState(null),[lu,Fo]=p.useState(""),Ni=p.useRef(!1),Xl=p.useRef(null);function cu(a){const u=x.slides.findIndex(y=>y.id===a);u<0||(Ni.current=!1,Zl(a),Fo(Rs(x.slides[u].name,u)),requestAnimationFrame(()=>{var y,S;(y=Xl.current)==null||y.focus(),(S=Xl.current)==null||S.select()}))}function du(){Ni.current=!1;const a=ou,u=x.slides.findIndex(S=>S.id===a),y=x.slides[u];if(a&&y){const S=lu.trim();S&&S!==y.name&&S!==Rs(y.name,u)&&Ve({type:"slide/update",slideId:a,patch:{name:S}})}Zl(null),Fo("")}function fp(){Ni.current=!1,Zl(null),Fo("")}function hp(a=m.id){Te()||(Ve({type:"slide/delete",slideId:a}),dt([]))}function Fi(a,u){Te()||(Ve({type:"slide/reorder",slideId:a,targetIndex:u}),dt([]))}function mp(a,u,y){const S=x.slides.findIndex($=>$.id===a),E=x.slides.findIndex($=>$.id===u);if(S<0||E<0)return null;const R=y?E+1:E;return R>S?R-1:R}function pp(a,u){if(gt.current||Q.current)return;if(a.stopPropagation(),(ze==null?void 0:ze.slideId)===u){ue(null);return}u!==m.id&&No(u);const y=a.currentTarget.getBoundingClientRect();Ue.current=a.currentTarget,ae(null),ue({slideId:u,x:y.left,y:y.bottom+4,fromButton:!0})}function _r(a){const u=ze!=null&&ze.fromButton?Ue.current:null;ue(null),a&&(u!=null&&u.isConnected)&&u.focus({preventScroll:!0})}function gp(a,u){gt.current||Q.current||(a.preventDefault(),a.stopPropagation(),u!==m.id&&No(u),ae(null),ue({slideId:u,x:a.clientX,y:a.clientY}))}function uu(a,u,y=!1){N(S=>y&&ye(S.activeGroupPath)!==ye(a)?S:{...S,activeGroupPath:[...a],selectionPaths:[[...a,u]]})}function ql(a,u,y){return u&&y.length===0?{...a,x:Math.round(Math.max(0,Math.min(u.x-a.width/2,m.width-a.width))),y:Math.round(Math.max(0,Math.min(u.y-a.height/2,m.height-a.height)))}:Th(a,m,y)}function Ql(a,u){var S;return Ve({type:"node/insert-children",slideId:m.id,parentPath:u,nodes:[a]})?(uu(u,a.id),!0):((S=Yr(m.nodes,u))!=null&&S.locked?sn():Ze(Wi("insert","invalid-selection")),!1)}function Sr(a,u){if(Te())return!1;const y=[...F];return Ql(ql(a,u,y),y)}function Jl(a,u){const y=Ug(m);if(a==="box"){Sr({...y,text:i(y.text)});return}const S=gw[a],E=Math.min(S.maxWidth,Math.round(m.width*S.widthRatio));Sr({...y,x:Math.round((m.width-E)/2),y:Math.round((m.height-S.height)/2),width:E,height:S.height,text:i(S.text),fontSize:S.fontSize,fontWeight:S.fontWeight,lineHeight:S.lineHeight,...u?{textFill:structuredClone(u.textFill),...u.effect?{effect:{...u.effect}}:{}}:{}})}function xp(a){if(Te())return;const u=r5(a),y=xe.flatMap(E=>{const R=jt(m.nodes,E);return(R==null?void 0:R.type)==="text"?[{path:[...E],patch:u}]:[]});if(y.length===0){Jl("heading",a);return}!Ve({type:"node/update-style",slideId:m.id,updates:y},i("套用花字"))&&(Wt||tn)&&sn()}function bp(a,u){Sr(t2(m,a),u)}function yp(a){Sr(r2(m),a)}function jp(a){Sr(a2(m),a)}function wp(a,u){const y=n2(m,a.id);a.bothEnds&&(y.name=i("双向箭头"),y.startCap="arrow"),Sr(y,u)}function kp(a,u){if(Te())return;const y=[...F],S=ql(H6(a,m),u,y);Ql(O6(a,{box:S}),y)}function Sp(a,u){Sr(i2(m,{name:a.zh,d:a.d,viewBox:z6,size:Math.max(48,Math.round(Math.min(m.width,m.height)*.15)),strokeWidth:R6}),u)}function vp(a,u){if(Te())return;const y=[...F],S=wx(a,m),E=ql({x:Math.round((m.width-S.width)/2),y:Math.round((m.height-S.height)/2),...S},u,y);Ql(xd(a,{...E,language:cl()==="en"?"en":"zh"}),y)}function fu(a,u){if(a.kind==="shape")bp(a.id,u);else if(a.kind==="line")wp(a,u);else if(a.kind==="qrcode")yp(u);else if(a.kind==="chart")jp(u);else if(a.kind==="table")Sr(Og(m),u);else if(a.kind==="timeline")Sr(_g(m),u);else if(a.kind==="progress")Sr(Bg(m),u);else if(a.kind==="collage"){const y=lm(a.id);y&&kp(y,u)}else if(a.kind==="icon"){const y=$6(a.id);y&&Sp(y,u)}else{const y=E0(a.id);y&&vp(y,u)}}At.current=fu;async function ec(a,u,y,S){var We;if(Te())return;const E=wt.current,R=Yt.current,$=m.id,O=[...F],G=await a();if(E!==wt.current||R!==Yt.current||Te())return;const J=at.current.slides.find(Ce=>Ce.id===$);if(!J)return;const Le=Yg(J,G,u),$e=y?T8(Le,J,y):Le,Qe=S&&O.length===0?{...$e,x:Math.round(Math.max(0,Math.min(S.x-$e.width/2,J.width-$e.width))),y:Math.round(Math.max(0,Math.min(S.y-$e.height/2,J.height-$e.height)))}:Th($e,J,O);Ve({type:"node/insert-children",slideId:$,parentPath:O,nodes:[Qe]})?at.current.activeSlideId===$&&uu(O,Qe.id,!0):(We=Yr(J.nodes,O))!=null&&We.locked?sn():Ze(Wi("insert","invalid-selection"))}async function hu(a,u){const y=Wr;await ec(async()=>{y.remote&&await ms();const S=await Fs(a),E=await ka(S,1800);return y.images.put(E)},a.name,void 0,u)}function Mo(a){return Array.from(a.dataTransfer.types).includes("Files")}function Np(a){if(wc(a.dataTransfer)){a.preventDefault();return}Mo(a)&&(a.preventDefault(),Ar.current+=1,!gt.current&&!Q.current&&bi(!0))}function Fp(a){!wc(a.dataTransfer)&&!Mo(a)||(a.preventDefault(),a.dataTransfer.dropEffect=gt.current||Q.current?"none":"copy")}function Mp(a){Mo(a)&&(Ar.current=Math.max(0,Ar.current-1),Ar.current===0&&bi(!1))}function Cp(a){if(wc(a.dataTransfer)){if(a.preventDefault(),gt.current||Q.current)return;const E=_6(a.dataTransfer),R=Nr(a.clientX,a.clientY),$=R!==null&&R.x>=0&&R.y>=0&&R.x<=m.width&&R.y<=m.height;E&&fu(E,$?R:void 0);return}if(!Mo(a)||(a.preventDefault(),Ar.current=0,bi(!1),gt.current||Q.current))return;const u=Yc(a.dataTransfer.files).slice(0,Bh);if(u.length===0){Ze(i("这里只能放图片"));return}const y=Nr(a.clientX,a.clientY),S=y!==null&&y.x>=0&&y.y>=0&&y.x<=m.width&&y.y<=m.height;mu(u,S?y:null)}async function mu(a,u){for(const[y,S]of a.entries())try{await hu(S,u?{x:u.x+y*Kh,y:u.y+y*Kh}:void 0)}catch(E){wn(E,i("图片插入失败,请稍后重试"));return}}async function Ep(a){const u=r;if(u){or.current+=1;try{await ec(()=>J0(a,u),a.name,a)}catch(y){wn(y,i("图片插入失败,请稍后重试"))}}}function pu(){var a;(a=fo.current)==null||a.click()}async function zp(a){const u=a==null?void 0:a[0];if(u)try{const y=await kl.importFile(u);(C==null?void 0:C.type)==="text"&&me({fontFamily:dd(y.family)})}catch(y){wn(y,i("字体导入失败,请稍后重试"))}finally{fo.current&&(fo.current.value="")}}async function Rp(a){const u=a==null?void 0:a[0];if(u)try{await hu(u)}catch(y){wn(y,i("图片插入失败,请稍后重试"))}finally{uo.current&&(uo.current.value="")}}function tc(){const a=tt?[...tt]:null;if(!a)return null;const u=at.current.slides.find(R=>R.id===m.id),y=u?jt(u.nodes,a):void 0,S=wt.current,E=Yt.current;return(y==null?void 0:y.type)==="shape"||(y==null?void 0:y.type)==="path"?{kind:"frame",slideId:m.id,path:a,identityGeneration:S,userId:E}:(y==null?void 0:y.type)==="image"?{kind:"image",slideId:m.id,path:a,identityGeneration:S,userId:E}:null}async function Ip(a){const u=tc();if(!u||u.kind!=="frame")return;const y=bo(u.slideId,u.path);try{const S=await Fs(a);await gu(S,u,y)}finally{yo(y)}}async function gu(a,u,y,S){const E=Wr;E.remote&&await ms();const R=await ka(a,1800),$=await E.images.put(R);if(Tr.current.get(y.key)!==y.token||u.identityGeneration!==wt.current||u.userId!==Yt.current||Te())return!0;const O=at.current.slides.find(J=>J.id===u.slideId),G=O?jt(O.nodes,u.path):void 0;return(G==null?void 0:G.type)!=="shape"&&(G==null?void 0:G.type)!=="path"||Ve({type:"node/update-style",slideId:u.slideId,updates:[{path:u.path,patch:{fill:{type:"image",src:$,fit:"cover",framing:zr()}}}]},S),!0}async function Lp(a,u,y){const S=Wr;S.remote&&await ms();const E=await ka(a,1800),R=await S.images.put(E);if(Tr.current.get(y.key)!==y.token||u.identityGeneration!==wt.current||u.userId!==Yt.current||Te())return!0;const $=at.current.slides.find(G=>G.id===u.slideId),O=$?jt($.nodes,u.path):void 0;return(O==null?void 0:O.type)!=="image"||Ve({type:"node/update-content",slideId:u.slideId,updates:[{path:u.path,patch:{src:R}}]},i("粘贴替换图片")),!0}async function $p(a){const u=a[0];if(!u)return;const y=tc();if(y&&(Wt||tn)){sn();return}const S=y?bo(y.slideId,y.path):null;try{const E=await Fs(u);if(Te())return;if(y&&S){if(y.kind==="image"){if(await Lp(E,y,S))return}else if(await gu(E,y,S,i("粘贴填充图片")))return}await mu(a,null)}catch(E){wn(E,i("图片插入失败,请稍后重试"))}finally{S&&yo(S)}}async function xu(a){const u=a==null?void 0:a[0];if(u)try{await Ip(u)}catch(y){wn(y,i("图片填充失败,请稍后重试"))}finally{ki.current&&(ki.current.value="")}}async function Dp(a){if(!(!tt||!Oh(C)))try{const u=Wr;u.remote&&await ms();const y=await Fs(a),S=await ka(y,600),E=await u.images.put(S);me({logoSrc:E})}catch(u){wn(u,i("logo 上传失败,请稍后重试"))}finally{mo.current&&(mo.current.value="")}}function vr(a,u){return Ve({type:"slide/update",slideId:a,patch:{background:u}})}async function Ap(a){const u=m.id,y=wt.current,S=Yt.current,E=Wr;Td(!0);try{E.remote&&await ms();const R=await Fs(a),$=await ka(R,2400),O=await E.images.put($);if(y!==wt.current||S!==Yt.current)return;vr(u,{type:"image",src:O,fit:"cover",framing:zr()})}finally{Td(!1)}}async function Pp(a){const u=a==null?void 0:a[0];if(u)try{await Ap(u)}catch(y){wn(y,i("背景图片设置失败,请稍后重试"))}finally{ho.current&&(ho.current.value="")}}function bu(){if(!tt||!ei(C)||Wa)return;Jm([{type:"slide/update",slideId:m.id,patch:{background:{type:"image",src:C.src,fit:"cover",framing:zr()}}},{type:"node/delete",slideId:m.id,parentPath:tt.slice(0,-1),nodeIds:[C.id]}],i("设为背景"))&&dt([])}function Co(){if(_e.length===0||Te())return;Ve({type:"node/delete",slideId:m.id,parentPath:F,nodeIds:_e})?dt([]):(Wt||tn)&&sn()}function nc(){var E;if(_e.length===0)return;const u=(Gn(m.nodes,F)??[]).filter(R=>_e.includes(R.id)),y=ii(m.nodes,F);if(!y||u.length===0)return;A({nodes:structuredClone(u),sourceParentWorld:[...y]});const S=u.flatMap(function R($){return $.type==="group"?$.children.flatMap(R):$.type==="text"?[$.text]:[]});(E=navigator.clipboard)==null||E.writeText(S.join(`
|
|
505
|
+
`)).catch(()=>{})}function rc(){if(_e.length===0)return;const a=at.current.slides.find(O=>O.id===m.id),u=a?Gn(a.nodes,F):void 0;if(!u)return;const y=new Set(u.map(O=>O.id));if(!Ve({type:"node/clone",slideId:m.id,parentPath:F,nodeIds:_e},i("原位复制"))){(Wt||tn)&&sn();return}const E=at.current.slides.find(O=>O.id===m.id),$=((E?Gn(E.nodes,F):void 0)??[]).filter(O=>!y.has(O.id));dt($.map(O=>O.id))}function Tp(){const a=(z==null?void 0:z.nodes.length)===1?z.nodes[0]:void 0;if((a==null?void 0:a.type)!=="image")return!1;const u=tc();if(!u)return!1;const y=at.current.slides.find(R=>R.id===u.slideId),S=y?jt(y.nodes,u.path):void 0;if(u.kind==="image"&&((S==null?void 0:S.type)!=="image"||S.src===a.src))return!1;if(Wt||tn)return sn(),!0;const E=bo(u.slideId,u.path);try{u.kind==="image"?Ve({type:"node/update-content",slideId:u.slideId,updates:[{path:u.path,patch:{src:a.src}}]},i("粘贴替换图片")):Ve({type:"node/update-style",slideId:u.slideId,updates:[{path:u.path,patch:{fill:{type:"image",src:a.src,fit:"cover",framing:zr()}}}]},i("粘贴填充图片"))}finally{yo(E)}return!0}function bs(a=!1){var $;if(!z||z.nodes.length===0||Te()||!a&&Tp())return;const u=ii(m.nodes,F),y=u?rr(u):null;if(!u||!y)return;const S=hi(a?0:16,a?0:16),E=mf(z.nodes).flatMap(O=>{const G=Lr(y,Lr(S,Lr(z.sourceParentWorld,As(O)))),J=Kc(O,G);return J?[J]:[]});if(E.length!==z.nodes.length){Ze(i("无法在当前编辑范围内粘贴对象"));return}Ve({type:"node/insert-children",slideId:m.id,parentPath:F,nodes:E},a?i("原位粘贴"):void 0)?dt(E.map(O=>O.id)):(Wt||($=Yr(m.nodes,F))!=null&&$.locked)&&sn()}function yu(){if(_e.length===0)return;nc(),Ve({type:"node/delete",slideId:m.id,parentPath:F,nodeIds:_e},i("剪切对象"))?dt([]):(Wt||tn)&&sn()}function Eo(){var G;if(Te())return!1;const a=[...F],u=xe.filter(J=>ye(J.slice(0,-1))===ye(a)).map(J=>J[J.length-1]),y=at.current.slides.find(J=>J.id===m.id);if(!y||u.length!==xe.length)return Ze(Wi("group","invalid-selection")),!1;const S=fi(),E=Xg(y.nodes,a,u,{id:S,name:i("组")});if(!E.ok)return Ze(Wi("group",E.reason)),!1;const R=Ve({type:"group/create",slideId:y.id,parentPath:a,nodeIds:u,groupId:S,name:i("组")}),$=at.current.slides.find(J=>J.id===y.id),O=[...a,S];return!R||((G=jt(($==null?void 0:$.nodes)??[],O))==null?void 0:G.type)!=="group"?(Ze(i("组合未能应用到当前文档,请重试")),!1):(Ze(null),N(J=>({...J,activeGroupPath:a,selectionPaths:[O]})),!0)}function zo(){if(Te())return!1;const a=[...F],u=xe.filter(O=>ye(O.slice(0,-1))===ye(a)).map(O=>O[O.length-1]),y=at.current.slides.find(O=>O.id===m.id);if(!y||u.length!==xe.length||u.length===0)return Ze(Wi("ungroup","not-group")),!1;const S=Zg(y.nodes,a,u,"one-level");if(!S.ok)return Ze(Wi("ungroup",S.reason)),!1;const E=Ve({type:"group/ungroup",slideId:y.id,parentPath:a,groupIds:u,mode:"one-level"}),R=at.current.slides.find(O=>O.id===y.id),$=S.selectionIds.map(O=>[...a,O]).filter(O=>!!jt((R==null?void 0:R.nodes)??[],O));return!E||$.length!==S.selectionIds.length?(Ze(i("解组未能应用到当前文档,请重试")),!1):(Ze(null),N(O=>({...O,activeGroupPath:a,selectionPaths:$})),!0)}function Wp(){if(xe.length!==1)return!1;const a=xe[0],u=jt(m.nodes,a);return(u==null?void 0:u.type)!=="group"||ye(a.slice(0,-1))!==ye(F)?!1:(N(y=>({...y,activeGroupPath:[...a],selectionPaths:[]})),!0)}function Hp(){N(a=>a.activeGroupPath.length===0?{...a,selectionPaths:[]}:{...a,activeGroupPath:a.activeGroupPath.slice(0,-1),selectionPaths:[]})}function ma(a){if(_e.length===0)return;!Ve({type:"node/reorder",slideId:m.id,parentPath:F,nodeIds:_e,direction:a})&&(Wt||tn)&&sn()}function Op(a,u){if(a.length===0||!jt(m.nodes,a))return!1;const y=a.slice(0,-1);return u.toggle&&xe.length>0&&ye(F)!==ye(y)?!1:(N(S=>{if(!u.toggle)return{...S,activeGroupPath:[...y],selectionPaths:[[...a]]};const E=mc(m.nodes,y,S.selectionPaths),R=ye(a),$=E.some(O=>ye(O)===R);return{...S,activeGroupPath:[...y],selectionPaths:$?E.filter(O=>ye(O)!==R):[...E,[...a]]}}),!0)}function _p(a,u){return Te()?!1:Ve({type:"node/rename",slideId:m.id,path:a,name:u})}function Mi(a,u){return Te()?!1:Ve({type:"node/set-locked",slideId:m.id,path:a,locked:u})}function ju(a,u){return Te()?!1:Ve({type:"node/set-hidden",slideId:m.id,path:a,hidden:u})}function Bp(a,u,y){if(Te())return!1;const E=xe.filter($=>ye($.slice(0,-1))===ye(a)).map($=>$[$.length-1]),R=u.every($=>E.includes($));return Ve({type:"node/reorder",slideId:m.id,parentPath:a,nodeIds:R&&E.length>0?E:[...u],direction:y})}function Kp(a,u,y){if(Te())return!1;const E=xe.filter(O=>ye(O.slice(0,-1))===ye(a)).map(O=>O[O.length-1]),$=u.every(O=>E.includes(O))&&E.length>0?E:[...u];return $.includes(y)?!1:Ve({type:"node/reorder-above",slideId:m.id,parentPath:a,nodeIds:$,targetNodeId:y})}function wu(a){const u=M.filter(We=>_e.includes(We.id)&&!We.hidden);if(u.length<1||Te())return;const y=ii(m.nodes,F),S=y?rr(y):null;if(!S)return;const E=u.flatMap(We=>{const Ce=[...F,We.id],Ne=Tn(m.nodes,Ce);return Ne?[{node:We,path:Ce,bounds:Ne}]:[]});if(E.length!==u.length)return;const R=E.length===1,$=R&&F.length>0?Tn(m.nodes,F):null,O=R?($==null?void 0:$.x)??0:Math.min(...E.map(({bounds:We})=>We.x)),G=R?$?$.x+$.width:m.width:Math.max(...E.map(({bounds:We})=>We.x+We.width)),J=R?($==null?void 0:$.y)??0:Math.min(...E.map(({bounds:We})=>We.y)),Le=R?$?$.y+$.height:m.height:Math.max(...E.map(({bounds:We})=>We.y+We.height)),$e=(O+G)/2,Qe=(J+Le)/2;Ve({type:"node/update-geometry",slideId:m.id,updates:E.map(({node:We,path:Ce,bounds:Ne})=>{const Ke=a==="left"?O-Ne.x:a==="h-center"?$e-(Ne.x+Ne.width/2):a==="right"?G-(Ne.x+Ne.width):0,it=a==="top"?J-Ne.y:a==="v-center"?Qe-(Ne.y+Ne.height/2):a==="bottom"?Le-(Ne.y+Ne.height):0,Pe=mr(S,{x:Ke,y:it});return{path:Ce,patch:{x:We.x+Pe.x,y:We.y+Pe.y}}})},R?i("对齐到页面"):i("对齐"))}function ac(a){const u=M.filter(Ce=>_e.includes(Ce.id)&&!Ce.hidden);if(u.length<3||Te())return;const y=ii(m.nodes,F),S=y?rr(y):null;if(!S)return;const E=u.flatMap(Ce=>{const Ne=[...F,Ce.id],Ke=Tn(m.nodes,Ne);return Ke?[{node:Ce,path:Ne,bounds:Ke}]:[]});if(E.length!==u.length)return;const R=[...E].sort((Ce,Ne)=>a==="horizontal"?Ce.bounds.x-Ne.bounds.x:Ce.bounds.y-Ne.bounds.y),$=R[0],O=R[R.length-1],G=a==="horizontal"?$.bounds.x:$.bounds.y,J=a==="horizontal"?O.bounds.x+O.bounds.width:O.bounds.y+O.bounds.height,Le=R.reduce((Ce,Ne)=>Ce+(a==="horizontal"?Ne.bounds.width:Ne.bounds.height),0),$e=(J-G-Le)/(R.length-1);let Qe=G;const We=R.map(({node:Ce,path:Ne,bounds:Ke})=>{const it=Qe-(a==="horizontal"?Ke.x:Ke.y);Qe+=(a==="horizontal"?Ke.width:Ke.height)+$e;const Pe=mr(S,a==="horizontal"?{x:it,y:0}:{x:0,y:it});return{path:Ne,patch:{x:Ce.x+Pe.x,y:Ce.y+Pe.y}}});Ve({type:"node/update-geometry",slideId:m.id,updates:We},i("分布"))}function Vp(a,u){if(Te())return;let y=!1;Zt(S=>{const E=jj(S,{kind:a,index:u});return y=E!==S,E}),y&&(os.current+=1,dt([]),Jt(null))}function Gp(a,u){m.width===a&&m.height===u||Te()||Ve({type:"slide/resize",slideId:m.id,width:a,height:u})}function ku(){Te()||(os.current+=1,Zt(a=>bj(a)),Jt(null))}function ic(){Te()||(os.current+=1,Zt(a=>yj(a)),Jt(null))}function Up(a,u){const y=k.current;if(y.length===0)return;const S=new Map(M.map($=>[$.id,$])),E=ld(m,m.nodes,F,y,a,u).filter(({nodeId:$,patch:O})=>{const G=S.get($);return G&&(G.x!==O.x||G.y!==O.y)});if(E.length===0){(Wt||tn)&&sn();return}!Ve({type:"node/update-geometry",slideId:m.id,updates:E.map(({nodeId:$,patch:O})=>({path:[...F,$],patch:O}))})&&(Wt||tn)&&sn()}p.useEffect(()=>{if(!e)return;const a=u=>{if(u.target instanceof Element&&u.target.closest('[aria-modal="true"]'))return;const y=u.key.toLowerCase();if(Q.current){if(u.key==="Escape"||u.key==="Enter"){u.preventDefault(),gs();return}(u.key.startsWith("Arrow")||u.ctrlKey||u.metaKey||["delete","backspace"].includes(y))&&u.preventDefault();return}if(gt.current){if(u.key==="Escape"){u.preventDefault(),su();return}if(u.key==="Enter"){u.preventDefault(),iu();return}const G=u.key==="ArrowLeft"?{x:-(u.shiftKey?10:1),y:0}:u.key==="ArrowRight"?{x:u.shiftKey?10:1,y:0}:u.key==="ArrowUp"?{x:0,y:-(u.shiftKey?10:1)}:u.key==="ArrowDown"?{x:0,y:u.shiftKey?10:1}:null,J=u.target instanceof HTMLInputElement&&u.target.dataset.testid==="freeform-framing-zoom";if(G&&!J){u.preventDefault(),lp(G);return}(u.ctrlKey||u.metaKey||["delete","backspace"].includes(y))&&u.preventDefault();return}if((W||ze)&&u.key==="Escape"){u.preventDefault(),ae(null),ue(null);return}const R=(u.ctrlKey||u.metaKey)&&["z","y","c","x","v","g","d"].includes(y)||["arrowleft","arrowright","arrowup","arrowdown","delete","backspace","escape","enter","[","]"].includes(y);if((en.current||Da.current!==null)&&R){u.preventDefault();return}if((u.ctrlKey||u.metaKey)&&!u.altKey&&u.code==="KeyD"){u.preventDefault(),rc();return}if(Is(u.target))return;if((u.key==="PageUp"||u.key==="PageDown")&&!u.ctrlKey&&!u.metaKey&&!u.altKey){u.preventDefault();const G=x.slides[j+(u.key==="PageDown"?1:-1)];G&&No(G.id);return}if((u.ctrlKey||u.metaKey)&&u.altKey&&u.code==="KeyC"){u.preventDefault(),Eu();return}if((u.ctrlKey||u.metaKey)&&u.altKey&&u.code==="KeyV"){u.preventDefault(),zu();return}if((u.ctrlKey||u.metaKey)&&!u.altKey&&u.code==="KeyA"){u.preventDefault();const G=new Set(k.current);dt(M.map(J=>J.id).filter(J=>u.shiftKey?!G.has(J):!0));return}if(!u.altKey&&(u.code==="BracketRight"||u.code==="BracketLeft")){const G=u.code==="BracketRight";if(u.ctrlKey||u.metaKey){u.preventDefault(),ma(G?u.shiftKey?"front":"forward":u.shiftKey?"back":"backward");return}if(!u.shiftKey){u.preventDefault(),ma(G?"front":"back");return}}if((u.ctrlKey||u.metaKey)&&!u.altKey&&["=","+","-","_"].includes(u.key)){u.preventDefault(),qp(u.key==="-"||u.key==="_"?-qo:qo);return}if((u.ctrlKey||u.metaKey)&&!u.altKey&&u.key==="0"){u.preventDefault(),Fu(_i);return}if(u.shiftKey&&!u.ctrlKey&&!u.metaKey&&!u.altKey&&(u.code==="Digit1"||u.code==="Digit2")){u.preventDefault(),u.code==="Digit1"?Fu(_i):Cu();return}if(u.code==="Space"&&!u.ctrlKey&&!u.metaKey&&!u.altKey&&!u.shiftKey&&!H8(u.target)){u.preventDefault(),Be.current||(Be.current=!0,te(!0));return}if((u.ctrlKey||u.metaKey)&&y==="z"){u.preventDefault(),u.shiftKey?ic():ku();return}if((u.ctrlKey||u.metaKey)&&y==="y"){u.preventDefault(),ic();return}if((u.ctrlKey||u.metaKey)&&y==="c"){u.preventDefault(),nc();return}if((u.ctrlKey||u.metaKey)&&y==="x"){u.preventDefault(),yu();return}if((u.ctrlKey||u.metaKey)&&y==="v"){const G=u.shiftKey;if(h5(u)){Ot.current={inPlace:G},window.setTimeout(()=>{Ot.current&&(Ot.current=null,bs(G))},0);return}u.preventDefault(),bs(G);return}if((u.ctrlKey||u.metaKey)&&y==="g"){u.preventDefault(),u.shiftKey?zo():Eo();return}if(u.key==="Enter"&&W8(u.target)&&Wp()){u.preventDefault();return}const $=u.shiftKey?10:1,O=u.key==="ArrowLeft"?{dx:-$,dy:0}:u.key==="ArrowRight"?{dx:$,dy:0}:u.key==="ArrowUp"?{dx:0,dy:-$}:u.key==="ArrowDown"?{dx:0,dy:$}:null;if(O){k.current.length>0&&(u.preventDefault(),Up(O.dx,O.dy));return}(u.key==="Delete"||u.key==="Backspace")&&k.current.length>0&&(u.preventDefault(),Co()),u.key==="Escape"&&((F.length>0||k.current.length>0)&&u.preventDefault(),Hp())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)}),p.useEffect(()=>{if(!e)return;const a=()=>{Be.current=!1,te(!1),ne(!1)},u=y=>{y.code==="Space"&&a()};return window.addEventListener("keyup",u),window.addEventListener("blur",a),()=>{window.removeEventListener("keyup",u),window.removeEventListener("blur",a)}});function Yp(a,u,y,S){if(a.button!==0)return;if(gt.current||Q.current){a.preventDefault(),a.stopPropagation();return}const E=xa(m.nodes,F,y);if(!E)return;const R=jt(m.nodes,E);if(!R)return;const $=E[E.length-1];if(S.locked){a.preventDefault(),a.stopPropagation(),Sn(),sn();return}if(a.shiftKey){a.preventDefault(),a.stopPropagation(),Sn(),dt(O=>O.includes($)?O.filter(G=>G!==$):[...O,$]);return}if(R.type==="group"){a.preventDefault(),a.stopPropagation(),Sn(),dt([$]);return}Xp(a,u)}function Zp(a,u,y,S){if(gt.current||Q.current){a.preventDefault(),a.stopPropagation();return}const E=xa(m.nodes,F,y),R=E?jt(m.nodes,E):void 0;if(!(!E||!R)){if(R.type!=="group"&&ye(E)===ye(y)&&Oi(R)){if(a.preventDefault(),a.stopPropagation(),S.locked||S.hidden){sn();return}dt([R.id]),R.type==="image"?Gl(E):vo(E);return}if(R.type==="line"&&R.points&&ke!==null){const $=Nr(a.clientX,a.clientY),O=Ur(m.nodes,E),G=O?rr(O):null;if(!$||!O||!G)return;if(a.preventDefault(),a.stopPropagation(),S.locked||S.hidden){sn();return}dt([R.id]);const J=8/ke;let Le=-1,$e=J;if(R.points.forEach((Ne,Ke)=>{const it=Wn(O,Ne),Pe=Math.hypot(it.x-$.x,it.y-$.y);Pe<$e&&($e=Pe,Le=Ke)}),Le>=0){if(R.points.length<=hf)return;Ve({type:"node/update-style",slideId:m.id,updates:[{path:E,patch:{points:R.points.filter((Ne,Ke)=>Ke!==Le)}}]},i("删除顶点"));return}let Qe=-1,We=null,Ce=J;for(let Ne=0;Ne<R.points.length-1;Ne+=1){const Ke=Wn(O,R.points[Ne]),it=Wn(O,R.points[Ne+1]),Pe={x:it.x-Ke.x,y:it.y-Ke.y},kt=Pe.x*Pe.x+Pe.y*Pe.y,Pt=kt>0?Er((($.x-Ke.x)*Pe.x+($.y-Ke.y)*Pe.y)/kt,0,1):0,St={x:Ke.x+Pe.x*Pt,y:Ke.y+Pe.y*Pt},yt=Math.hypot(St.x-$.x,St.y-$.y);if(yt<Ce){Ce=yt,Qe=Ne+1;const nt=Wn(G,St);We={x:Er(nt.x,0,R.width),y:Er(nt.y,0,R.height)}}}if(Qe>=0&&We){const Ne=[...R.points];Ne.splice(Qe,0,We),Ve({type:"node/update-style",slideId:m.id,updates:[{path:E,patch:{points:Ne}}]},i("添加顶点"))}return}if(R.type==="group"){if(a.preventDefault(),a.stopPropagation(),S.locked||S.hidden){sn();return}N($=>({...$,activeGroupPath:[...E],selectionPaths:[]}))}}}function Su(a,u,y){const S=tl(a.nodes,y.map(E=>[...u,E]));return S?`${Math.round(S.width)}×${Math.round(S.height)}`:null}function vu(a,u,y){if(a.button!==0||ke===null)return;if(Te()){a.preventDefault(),a.stopPropagation();return}a.preventDefault(),a.stopPropagation(),Sn();const S=at.current;let E=S.slides.find(nt=>nt.id===m.id),R=E?Gn(E.nodes,F):void 0;if(!E||!R)return;const $=k.current,O=y&&y.length>0?[...y]:$.includes(u)?$:[u],G=new Set(R.map(nt=>nt.id));if(O.some(nt=>!G.has(nt)))return;$.includes(u)||dt([u]);let J=O;if(a.altKey){const nt=R.filter(nn=>O.includes(nn.id));if(nt.length>0){const nn=mf(nt);let an=!1;Zt(on=>{const $n=Mr(on.current,{type:"node/insert-children",slideId:m.id,parentPath:F,nodes:nn});return $n===on.current?on:(an=!0,{...on,current:$n})}),an&&(E=at.current.slides.find(on=>on.id===m.id)??E,J=nn.map(on=>on.id),dt(J))}}const Le=ke,$e=a.pointerId,Qe=a.clientX,We=a.clientY;en.current="move",bn("move");const Ce=R.filter(nt=>!J.includes(nt.id)&&!nt.hidden).flatMap(nt=>{const nn=Tn(E.nodes,[...F,nt.id]);return nn?[{...nn,source:"element"}]:[]}),Ne=F.length===0?{width:E.width,height:E.height}:null,Ke=nt=>{if(nt.pointerId!==$e)return;const nn=(nt.clientX-Qe)/Le,an=(nt.clientY-We)/Le,on=Ge.guidesVisible?E:{...E,guides:void 0},$n=Tj(on,E.nodes,F,J,nn,an,Ge.snappingEnabled?{}:{threshold:0}),Ga=ld(E,E.nodes,F,J,$n.dx,$n.dy);La($n.lines),la($n.space??null),Zt(er=>{const un=Mr(er.current,{type:"node/update-geometry",slideId:E.id,updates:Ga.map(({nodeId:Ua,patch:$o})=>({path:[...F,Ua],patch:$o}))});return Object.is(un,er.current)?er:{...er,current:un}});const Fr=at.current.slides.find(er=>er.id===E.id);if(Fr){const er=tl(Fr.nodes,J.map(un=>[...F,un]));yi(er?Yj(er,Ce,Ne):[]),yr(Su(Fr,F,J))}},it=()=>{window.removeEventListener("pointermove",Ke),window.removeEventListener("pointerup",Pt),window.removeEventListener("pointercancel",St),window.removeEventListener("blur",yt),en.current=null,La([]),la(null),yi([]),yr(null),bn(null)},Pe=()=>{it(),Ka(S,a.altKey?i("拖拽复制"):i("移动对象"))},kt=()=>{it(),ur(S)},Pt=nt=>{nt.pointerId===$e&&Pe()},St=nt=>{nt.pointerId===$e&&kt()},yt=()=>kt();window.addEventListener("pointermove",Ke),window.addEventListener("pointerup",Pt),window.addEventListener("pointercancel",St),window.addEventListener("blur",yt)}function Xp(a,u){if(Te()){a.preventDefault(),a.stopPropagation();return}if(u.locked||u.hidden){a.preventDefault(),a.stopPropagation(),Sn(),u.locked&&sn();return}if(a.shiftKey){a.preventDefault(),a.stopPropagation(),Sn(),dt(y=>y.includes(u.id)?y.filter(S=>S!==u.id):[...y,u.id]);return}if(Is(a.target)){dt([u.id]);return}vu(a,u.id)}function Nr(a,u){const y=ua.current;if(!y||ke===null)return null;const S=y.getBoundingClientRect();return{x:(a-S.left)/ke,y:(u-S.top)/ke}}function Nu(a,u,y){if(a===H)return;const S=Nr(u,y);le.current=S?{clientX:u,clientY:y,worldX:S.x,worldY:S.y}:null,P(Zr(a))}function qp(a){const u=da.current;if(!u){P(S=>Zr(S+a));return}const y=u.getBoundingClientRect();Nu(Zr(H+a),y.left+y.width/2,y.top+y.height/2)}function Fu(a){const u=da.current;if(!u){P(Zr(a));return}const y=u.getBoundingClientRect();Nu(a,y.left+y.width/2,y.top+y.height/2)}function Mu(){const a=da.current;if(!a)return null;const u=a.getBoundingClientRect(),y=getComputedStyle(a),S=An(y.borderLeftWidth),E=An(y.borderTopWidth),R=An(y.paddingLeft),$=An(y.paddingTop),O=a.clientWidth-R-An(y.paddingRight),G=a.clientHeight-$-An(y.paddingBottom);return{clientLeft:u.left+S+R,clientTop:u.top+E+$,width:O,height:G}}function Cu(){if(xe.length===0||D===null)return;const a=Mu();if(!a||a.width<=0||a.height<=0)return;const u=xe.flatMap(J=>{const Le=Tn(m.nodes,J);return Le?[Le]:[]});if(u.length!==xe.length||u.length===0)return;const y=Math.min(...u.map(J=>J.x)),S=Math.min(...u.map(J=>J.y)),E=Math.max(...u.map(J=>J.x+J.width)),R=Math.max(...u.map(J=>J.y+J.height)),$=E-y,O=R-S;if(!($>0)||!(O>0))return;const G=a8(D,a.width,a.height,$,O);G===null||G===H||(De.current={worldX:y+$/2,worldY:S+O/2},P(G))}function Eu(){const a=xe.map(u=>jt(m.nodes,u)).find(u=>u!==void 0&&u.type!=="group");a&&L(h8(a))}function zu(){if(!T||Te())return;const a=xe.flatMap(y=>{const S=jt(m.nodes,y);if(!S||S.type==="group")return[];const E=m8(T,S.type,S.type==="path"?ai(S.viewBox,S.width,S.height):1);return Object.keys(E).length===0?[]:[{path:[...y],patch:E}]});if(a.length===0)return;!Ve({type:"node/update-style",slideId:m.id,updates:a})&&(Wt||tn)&&sn()}function sc(a,u,y){var Ne,Ke;if(a.button!==0||ke===null)return;a.preventDefault(),a.stopPropagation();const S=m;if(!y&&(((Ne=S.guides)==null?void 0:Ne.length)??0)>=qg)return;!y&&!Ge.guidesVisible&&Qn({guidesVisible:!0});const E=Nr(a.clientX,a.clientY);if(!E)return;const R=a.pointerId,$=u==="x"?E.x:E.y,O=y?(Ke=S.guides)==null?void 0:Ke.find(it=>it.id===y):void 0;let G=(O==null?void 0:O.position)??$;const J=ke,Le=it=>Bj(S,S.nodes,u,it,Ge.snappingEnabled?U8/J:0);co({axis:u,guideId:y,position:G,target:O?Le(G).target:null});const $e=it=>{if(it.pointerId!==R)return;const Pe=Nr(it.clientX,it.clientY);if(!Pe)return;const kt=Le(u==="x"?Pe.x:Pe.y);G=kt.position,co({axis:u,guideId:y,position:G,target:kt.target})},Qe=()=>{window.removeEventListener("pointermove",$e),window.removeEventListener("pointerup",We),window.removeEventListener("pointercancel",Ce)},We=()=>{Qe(),co(null);const it=u==="x"?S.width:S.height,Pe=Math.round(G);if(y&&Math.abs(Pe-Math.round((O==null?void 0:O.position)??$))<=1){const kt=$l.current,Pt=performance.now();if(kt&&kt.guideId===y&&Pt-kt.time<500){$l.current=null,Ve({type:"guides/set",slideId:S.id,guides:(S.guides??[]).filter(St=>St.id!==y)},i("删除参考线"));return}$l.current={guideId:y,time:Pt}}if(Pe<0||Pe>it){y&&Ve({type:"guides/set",slideId:S.id,guides:(S.guides??[]).filter(kt=>kt.id!==y)},i("删除参考线"));return}if(y){if((S.guides??[]).some(Pt=>Pt.id===y&&Pt.position===Pe))return;Ve({type:"guides/set",slideId:S.id,guides:(S.guides??[]).map(Pt=>Pt.id===y?{...Pt,position:Pe}:Pt)},i("调整参考线"));return}Ve({type:"guides/set",slideId:S.id,guides:[...S.guides??[],{id:`guide-${fi()}`,axis:u,position:Pe}]},i("新增参考线"))},Ce=()=>{Qe(),co(null)};window.addEventListener("pointermove",$e),window.addEventListener("pointerup",We),window.addEventListener("pointercancel",Ce)}function Qp(a){if(Be.current){if(gt.current||Q.current||a.button!==0)return;a.preventDefault(),a.stopPropagation(),Sn(),ne(!0);const u=da.current;if(!u)return;const y=a.pointerId,S=a.clientX,E=a.clientY,R=u.scrollLeft,$=u.scrollTop,O=$e=>{$e.pointerId===y&&(u.scrollLeft=R-($e.clientX-S),u.scrollTop=$-($e.clientY-E))},G=()=>{window.removeEventListener("pointermove",O),window.removeEventListener("pointerup",J),window.removeEventListener("pointercancel",Le),window.removeEventListener("blur",G),ne(!1)},J=$e=>{$e.pointerId===y&&G()},Le=$e=>{$e.pointerId===y&&G()};window.addEventListener("pointermove",O),window.addEventListener("pointerup",J),window.addEventListener("pointercancel",Le),window.addEventListener("blur",G);return}W&&ae(null)}function Jp(a,u){const y=ua.current;if(!y)return null;const S=Array.from(y.querySelectorAll("[data-scene-node-id]"));for(let E=S.length-1;E>=0;E-=1){const R=S[E].getBoundingClientRect();if(a>R.left&&a<R.right&&u>R.top&&u<R.bottom){const $=Dh(S[E]);if($)return $}}return null}function e1(a){if(gt.current||Q.current||Is(a.target))return;a.preventDefault(),Sn();const u=Dh(a.target)??Jp(a.clientX,a.clientY);if(u){const y=xa(m.nodes,F,u);if(y){const S=y[y.length-1];_e.includes(S)||dt([S])}}else dt([]);ue(null),ae({x:a.clientX,y:a.clientY})}function dn(){ae(null)}function oc(a,u){const y=Nr(a,u);return y?{x:Er(y.x,0,m.width),y:Er(y.y,0,m.height)}:null}function t1(a){if(!Q.current)return;const u=a.target;u instanceof Element&&u.closest('[data-testid="freeform-image-crop-overlay"]')||gs("outside")}function n1(a){if(a.target!==a.currentTarget)return;if(Te()){a.preventDefault(),a.stopPropagation();return}const u=oc(a.clientX,a.clientY);if(!u)return;a.preventDefault(),Sn();const y=a.pointerId;Da.current=y,dt([]),br({startX:u.x,startY:u.y,currentX:u.x,currentY:u.y});const S=()=>{window.removeEventListener("pointermove",E),window.removeEventListener("pointerup",R),window.removeEventListener("pointercancel",$),window.removeEventListener("blur",O),Da.current===y&&(Da.current=null)},E=G=>{if(G.pointerId!==y)return;const J=oc(G.clientX,G.clientY);J&&br(Le=>Le&&{...Le,currentX:J.x,currentY:J.y})},R=G=>{if(G.pointerId!==y)return;S();const J=oc(G.clientX,G.clientY)??u,Le={startX:u.x,startY:u.y,currentX:J.x,currentY:J.y},$e=Hh(Le);if(br(null),Math.hypot($e.width,$e.height)<4){dt([]);return}dt(Ij(m.nodes,F,$e).filter(Qe=>{var We;return!((We=Yr(m.nodes,[...F,Qe]))!=null&&We.locked)}))},$=G=>{G.pointerId===y&&(S(),br(null))},O=()=>{S(),br(null)};window.addEventListener("pointermove",E),window.addEventListener("pointerup",R),window.addEventListener("pointercancel",$),window.addEventListener("blur",O)}function r1(a,u,y){if(ke===null)return;if(Te()){a.preventDefault(),a.stopPropagation();return}a.preventDefault(),a.stopPropagation(),Sn();const S=ke,E=a.pointerId,R=at.current,$=R.slides.find(yt=>yt.id===m.id);if(!$)return;const O=[...F,u.nodeIds[0]],G=jt($.nodes,O);if(!G||G.type!=="line"||!G.points||G.points[y]===void 0)return;const J=Ur($.nodes,O),Le=J?rr(J):null;if(!J||!Le)return;const $e=G.points,Qe=G.points[y],We=a.clientX,Ce=a.clientY;en.current="move",bn("move");const Ne=yt=>{if(yt.pointerId!==E)return;const nt={x:(yt.clientX-We)/S,y:(yt.clientY-Ce)/S},nn=mr(Le,nt),an={x:Er(Qe.x+nn.x,0,G.width),y:Er(Qe.y+nn.y,0,G.height)};Ln({type:"node/update-style",slideId:$.id,updates:[{path:O,patch:{points:$e.map((on,$n)=>$n===y?an:on)}}]})},Ke=()=>{window.removeEventListener("pointermove",Ne),window.removeEventListener("pointerup",kt),window.removeEventListener("pointercancel",Pt),window.removeEventListener("blur",St),en.current=null,bn(null)},it=()=>{Ke(),Ka(R,i("拖动顶点"))},Pe=()=>{Ke(),ur(R)},kt=yt=>{yt.pointerId===E&&it()},Pt=yt=>{yt.pointerId===E&&Pe()},St=()=>Pe();window.addEventListener("pointermove",Ne),window.addEventListener("pointerup",kt),window.addEventListener("pointercancel",Pt),window.addEventListener("blur",St)}function a1(a,u,y){if(ke===null)return;if(Te()){a.preventDefault(),a.stopPropagation();return}a.preventDefault(),a.stopPropagation(),Sn();const S=ke,E=a.pointerId,R=at.current,$=R.slides.find(St=>St.id===m.id);if(!$)return;const O=[...F,u.nodeIds[0]],G=jt($.nodes,O);if(!G||G.type!=="shape"||G.locked||l0(G.shape)!==y)return;const J=Ur($.nodes,O),Le=J?rr(J):null;if(!J||!Le)return;const $e=o0(G.shape,G.width,G.height,G);if(!$e)return;const Qe=a.clientX,We=a.clientY;en.current="move",bn("move");const Ce=St=>{if(St.pointerId!==E)return;const yt={x:(St.clientX-Qe)/S,y:(St.clientY-We)/S},nt=mr(Le,yt),nn=c2(y,{x:$e.x+nt.x,y:$e.y+nt.y},G.width,G.height);Ln({type:"node/update-style",slideId:$.id,updates:[{path:O,patch:y==="cornerRadius"?{cornerRadius:nn,cornerRadii:null}:{[y]:nn}}]})},Ne=()=>{window.removeEventListener("pointermove",Ce),window.removeEventListener("pointerup",Pe),window.removeEventListener("pointercancel",kt),window.removeEventListener("blur",Pt),en.current=null,bn(null)},Ke=()=>{Ne(),Ka(R,i(b8[y]))},it=()=>{Ne(),ur(R)},Pe=St=>{St.pointerId===E&&Ke()},kt=St=>{St.pointerId===E&&it()},Pt=()=>it();window.addEventListener("pointermove",Ce),window.addEventListener("pointerup",Pe),window.addEventListener("pointercancel",kt),window.addEventListener("blur",Pt)}function i1(a,u,y){a.preventDefault(),a.stopPropagation();const S=at.current.slides.find($=>$.id===m.id);if(!S)return;const E=[...F,u.nodeIds[0]],R=jt(S.nodes,E);!R||R.type!=="line"||!R.points||R.points.length<=hf||Ve({type:"node/update-style",slideId:S.id,updates:[{path:E,patch:{points:R.points.filter(($,O)=>O!==y)}}]},i("删除顶点"))}function s1(a,u,y="se"){if(ke===null)return;if(Te()){a.preventDefault(),a.stopPropagation();return}const S=ke,E=a.pointerId,R=[...F];a.preventDefault(),a.stopPropagation(),Sn();const $=at.current,O=$.slides.find(un=>un.id===m.id);if(!O)return;const G=u.nodeIds.map(un=>[...R,un]);if(!tl(O.nodes,G))return;const Le=a.clientX,$e=a.clientY,Qe=Nr(Le,$e);if(!Qe)return;const We=u.kind==="leaf"&&u.nodeIds.length===1?jt(O.nodes,G[0]):null,Ce=(We==null?void 0:We.type)==="group"?null:We,Ne=sj[y],Ke=Ne.x!==0&&Ne.y!==0;if(!Ce&&!Ke)return;const it=Ce?Ur(O.nodes,G[0]):null,Pe=it?rr(it):null,kt=Ce?As(Ce):null,Pt=B8(O.nodes,R,u.nodeIds),St=u.corners[Ne.x<0?Ne.y<0?"se":"ne":Ne.y<0?"sw":"nw"],yt={x:Qe.x-St.x,y:Qe.y-St.y},nt=yt.x**2+yt.y**2;en.current="resize",bn("resize");const nn=un=>{var Zu;if(un.pointerId!==E)return;const Ua={x:(un.clientX-Le)/S,y:(un.clientY-$e)/S},$o=()=>{const Ya=at.current.slides.find(Xu=>Xu.id===O.id);yr(Ya?Su(Ya,R,u.nodeIds):null)};if(Ce&&it&&Pe&&kt){const Ya=mr(Pe,Ua),pa=40/(((Zu=Ki(it))==null?void 0:Zu.scale)??1);let Za=Ce.width,Xa=Ce.height;if(Ke&&(un.shiftKey||Ce.type==="path")&&nt>Number.EPSILON){const qu=Math.hypot(yt.x+Ua.x,yt.y+Ua.y)/Math.sqrt(nt);Za=Math.max(pa,Ce.width*qu),Xa=Math.max(pa,Ce.height*qu)}else if(un.shiftKey&&!Ke){const uc=Ne.x!==0?Math.max(pa,Ce.width+Ne.x*Ya.x)/Ce.width:Math.max(pa,Ce.height+Ne.y*Ya.y)/Ce.height;Za=Math.max(pa,Ce.width*uc),Xa=Math.max(pa,Ce.height*uc)}else Ne.x!==0&&(Za=Math.max(pa,Ce.width+Ne.x*Ya.x)),Ne.y!==0&&(Xa=Math.max(pa,Ce.height+Ne.y*Ya.y));const M1=hi(Ne.x<0?Ce.width-Za:Ne.x===0?(Ce.width-Za)/2:0,Ne.y<0?Ce.height-Xa:Ne.y===0?(Ce.height-Xa)/2:0),Do=Kc({...Ce,width:Za,height:Xa},Lr(kt,M1));if(!Do||Do.type==="group")return;Ln({type:"node/update-geometry",slideId:O.id,updates:[{path:G[0],patch:{x:Do.x,y:Do.y,width:Za,height:Xa}}]}),$o();return}if(nt<=Number.EPSILON)return;const Uu={x:yt.x+Ua.x,y:yt.y+Ua.y},F1=(Uu.x*yt.x+Uu.y*yt.y)/nt,dc=Er(F1,Pt.min,Pt.max);if(!Number.isFinite(dc)||dc<=0)return;const Yu=pf(O.nodes,R,u.nodeIds,Ph(u2(dc),St));Yu.ok&&(Ln({type:"node/update-geometry",slideId:O.id,updates:Ah(O.nodes,Yu.nodes,R,u.nodeIds)}),$o())},an=()=>{window.removeEventListener("pointermove",nn),window.removeEventListener("pointerup",Ga),window.removeEventListener("pointercancel",Fr),window.removeEventListener("blur",er),en.current=null,La([]),la(null),yr(null),bn(null)},on=()=>{an(),Ka($,i("调整大小"))},$n=()=>{an(),ur($)},Ga=un=>{un.pointerId===E&&on()},Fr=un=>{un.pointerId===E&&$n()},er=()=>$n();window.addEventListener("pointermove",nn),window.addEventListener("pointerup",Ga),window.addEventListener("pointercancel",Fr),window.addEventListener("blur",er)}function o1(a,u,y){if(ke===null)return;if(Te()){a.preventDefault(),a.stopPropagation();return}const S=ke,E=a.pointerId,R=[...F];a.preventDefault(),a.stopPropagation(),Sn();const $=at.current,O=$.slides.find(an=>an.id===m.id);if(!O)return;const G=[...R,u.nodeIds[0]],J=jt(O.nodes,G);if(!J||J.type!=="table"||y>=J.cols-1)return;const Le=c0(J.width,J.cols,J.colWidths),$e=Array.from({length:J.cols},(an,on)=>Le[on+1]-Le[on]),Qe=Ur(O.nodes,G),We=Qe?rr(Qe):null;if(!We)return;const Ce=a.clientX,Ne=a.clientY,Ke=$e[y]+$e[y+1],it=Math.max(12,J.width/(J.cols*6));en.current="resize",bn("resize");const Pe=an=>{if(an.pointerId!==E)return;const on={x:(an.clientX-Ce)/S,y:(an.clientY-Ne)/S},$n=mr(We,on),Ga=Math.min(Ke-it,Math.max(it,$e[y]+$n.x)),Fr=[...$e];Fr[y]=Ga,Fr[y+1]=Ke-Ga,Ln({type:"node/update-content",slideId:O.id,updates:[{path:G,patch:{colWidths:Fr}}]})},kt=()=>{window.removeEventListener("pointermove",Pe),window.removeEventListener("pointerup",yt),window.removeEventListener("pointercancel",nt),window.removeEventListener("blur",nn),en.current=null,bn(null)},Pt=()=>{kt(),Ka($,i("调整列宽"))},St=()=>{kt(),ur($)},yt=an=>{an.pointerId===E&&Pt()},nt=an=>{an.pointerId===E&&St()},nn=()=>St();window.addEventListener("pointermove",Pe),window.addEventListener("pointerup",yt),window.addEventListener("pointercancel",nt),window.addEventListener("blur",nn)}function l1(a,u){if(ke===null)return;if(Te()){a.preventDefault(),a.stopPropagation();return}a.preventDefault(),a.stopPropagation(),Sn();const y=at.current,S=y.slides.find(Pe=>Pe.id===m.id);if(!S)return;const E=[...F],R=u.nodeIds.map(Pe=>[...E,Pe]),$=tl(S.nodes,R);if(!$)return;const O={x:$.x+$.width/2,y:$.y+$.height/2},G=a.pointerId,J=Nr(a.clientX,a.clientY);if(!J)return;const Le=Math.atan2(J.y-O.y,J.x-O.x);en.current="rotate",bn("rotate");const $e=Pe=>{if(Pe.pointerId!==G)return;const kt=Nr(Pe.clientX,Pe.clientY);if(!kt)return;const St=(Math.atan2(kt.y-O.y,kt.x-O.x)-Le)*180/Math.PI,yt=Pe.shiftKey?_j(St):St,nt=pf(S.nodes,E,u.nodeIds,Ph(d2(yt),O));nt.ok&&(Ln({type:"node/update-geometry",slideId:S.id,updates:Ah(S.nodes,nt.nodes,E,u.nodeIds)}),yr(`${Math.round(yt)}°`))},Qe=()=>{window.removeEventListener("pointermove",$e),window.removeEventListener("pointerup",Ne),window.removeEventListener("pointercancel",Ke),window.removeEventListener("blur",it),en.current=null,yr(null),bn(null)},We=()=>{Qe(),Ka(y,i("旋转对象"))},Ce=()=>{Qe(),ur(y)},Ne=Pe=>{Pe.pointerId===G&&We()},Ke=Pe=>{Pe.pointerId===G&&Ce()},it=()=>Ce();window.addEventListener("pointermove",$e),window.addEventListener("pointerup",Ne),window.addEventListener("pointercancel",Ke),window.addEventListener("blur",it)}async function ys(a,u,y,S){const E=ua.current;if(!E)return null;const R=await o2(E,{timeoutMs:x8});if(!R.ok)throw new Error(R.reason==="timeout"?i("图片加载超时,导出已取消"):i("图片加载失败,导出已取消"));await new Promise(O=>requestAnimationFrame(()=>requestAnimationFrame(O)));const $=await u0(E,{pixelRatio:y,width:a.width,height:a.height,style:{transform:"none"},fontEmbedCSS:u,filter:O=>!(O instanceof HTMLElement&&O.classList.contains("freeform-ui-only"))});return S?f0($):$}async function Ru(a,u){const y=Ge.exportFormat==="jpeg",S=await ys(a,u,Ge.exportScale,y);return S?y?ja(S,"image/jpeg",Ge.exportQuality):ja(S,"image/png"):null}async function Iu(a,u){const y=await ys(a,u,Ge.exportScale,!0);if(!y)return null;const S=await ja(y,"image/jpeg",Ge.exportQuality);return S?q0(new Uint8Array(await S.arrayBuffer()),a,y):null}function Lu(a,u){Rc(new Blob([Q0(a)],{type:"application/pdf"}),u)}async function js(a){try{return await gc(pc(a))}catch{return""}}async function c1(){if(ke!==null&&!Te()){Me(!0);try{dt([]),await new Promise(y=>requestAnimationFrame(()=>requestAnimationFrame(y)));const a=await js([m]),u=Math.max(0,x.slides.findIndex(y=>y.id===m.id));if(Ge.exportFormat==="pdf"){const y=await Iu(m,a);y&&Lu([y],Ic(u,"pdf"))}else{const y=await Ru(m,a);y&&Rc(y,Ic(u,Ge.exportFormat))}}catch(a){wn(a,i("导出失败,请稍后重试"))}finally{Me(!1)}}}async function $u(){if(x.slides.length===0||ke===null||Te())return;Me(!0),Je(null);const a=m.id;try{dt([]);const u=await js(x.slides),y=Ge.exportFormat==="pdf",S=[],E=[];for(let $=0;$<x.slides.length;$++){const O=x.slides[$];if(Je({current:$+1,total:x.slides.length}),Ln({type:"slide/select",slideId:O.id}),await new Promise(G=>requestAnimationFrame(()=>requestAnimationFrame(G))),y){const G=await Iu(O,u);G&&E.push(G)}else{const G=await Ru(O,u);G&&S.push({name:Ic($,Ge.exportFormat),blob:G})}}const R=new Date().toISOString().slice(0,10);E.length>0&&Lu(E,`freeform-slides-${R}.pdf`),S.length>0&&await ed(S,`freeform-slides-${R}.zip`)}catch(u){wn(u,Ge.exportFormat==="pdf"?i("导出失败,请稍后重试"):i("打包导出失败,请稍后重试"))}finally{Ln({type:"slide/select",slideId:a}),Je(null),Me(!1)}}async function d1(){if(x.slides.length===0||ke===null||Te())return;const a=Vg(x.slides,Ge.exportScale);if(a===null){Ze(i("页面太多,拼不成一张长图,请改用打包下载"));return}Me(!0),Je(null);const u=m.id;try{dt([]);const y=await js(x.slides),S=Ge.exportFormat==="jpeg",E=Gg(x.slides,a,S?"#ffffff":void 0);for(let O=0;O<x.slides.length;O++){const G=x.slides[O];Je({current:O+1,total:x.slides.length}),Ln({type:"slide/select",slideId:G.id}),await new Promise(Le=>requestAnimationFrame(()=>requestAnimationFrame(Le)));const J=await ys(G,y,a,S);J&&E.draw(O,J)}const R=S?await ja(E.canvas,"image/jpeg",Ge.exportQuality):await ja(E.canvas,"image/png");if(!R)throw new Error(i("长图导出失败,请稍后重试"));const $=new Date().toISOString().slice(0,10);Rc(R,`freeform-long-${$}.${S?"jpg":"png"}`),a<Ge.exportScale&&Ze(i("长图太长,已缩小到 {scale}x 导出",{scale:a}))}catch(y){wn(y,i("长图导出失败,请稍后重试"))}finally{Ln({type:"slide/select",slideId:u}),Je(null),Me(!1)}}async function u1(){if(!(ke===null||!of(m))&&!Te()){Me(!0);try{dt([]),await new Promise(E=>requestAnimationFrame(()=>requestAnimationFrame(E)));const a=await js([m]),u=Ge.exportFormat==="jpeg",y=await ys(m,a,Ge.exportScale,u);if(!y)return;const S=[];for(const[E,R]of Kg(y).entries()){const $=u?await ja(R,"image/jpeg",Ge.exportQuality):await ja(R,"image/png");if(!$)throw new Error(i("九宫格导出失败,请稍后重试"));S.push({name:`grid-${E+1}.${u?"jpg":"png"}`,blob:$})}await ed(S,`freeform-grid-${new Date().toISOString().slice(0,10)}.zip`)}catch(a){wn(a,i("九宫格导出失败,请稍后重试"))}finally{Me(!1)}}}async function f1(a){if(x.slides.length===0||ke===null||Te())return;const u=r??hn,y=xt(u);if(!y.remote)return;Me(!0),Je(null),bt(null);const S=m.id;try{dt([]);const E=await js(x.slides),R=[];for(let $=0;$<x.slides.length;$++){const O=x.slides[$];Je({current:$+1,total:x.slides.length}),Ln({type:"slide/select",slideId:O.id}),await new Promise(Qe=>requestAnimationFrame(()=>requestAnimationFrame(Qe)));const G=await ys(O,E,Ge.exportScale,!1),J=G?await ja(G,"image/png"):null;if(!J)continue;const Le=await new Promise((Qe,We)=>{const Ce=new FileReader;Ce.onload=()=>Qe(String(Ce.result)),Ce.onerror=()=>We(Ce.error),Ce.readAsDataURL(J)}),$e=await ka(Le,2160);R.push(await y.images.put($e))}if(R.length===0)throw new Error(i("分享创建失败,请稍后重试"));ee(await y.shares.create(u,cs.current,R,a)),gn.current=x}catch{bt(i("分享创建失败,请稍后重试"))}finally{Ln({type:"slide/select",slideId:S}),Je(null),Me(!1)}}async function h1(a){const u=r??hn;ct(!0);try{await xt(u).shares.revoke(u,a.id),ee(null),gn.current=null,Lt(!1),Ze(i("分享已撤销,链接不再能打开"))}catch(y){wn(y,i("撤销分享失败,请稍后重试"))}finally{ct(!1)}}function m1(){if(ke!==null&&!Te()){if(Ge.exportFormat!=="pdf"&&_8(x.slides)){Xn(!0);return}$u()}}function p1(){ke!==null&&(Te()||(Xn(!1),$u()))}function Ro(a=Yt.current){const u=at.current,y=wr.current!==null||ls.current.past.length>0,S=!Object.is(u,ds.current)||fa.current,E=Object.is(u,Al.current)&&Pl.current===cs.current;if(a&&!us.current&&y&&S&&!E){const R=cs.current;Bl(a,wr.current,{mode:"freeform-slide",title:R,document:u},{title:R})}Al.current=null,Pl.current=null,po()}function Io(a){if(a.mode!=="freeform-slide"||(xs(),Te()))return;Ro(),ds.current=a.document,wt.current+=1,Tr.current.clear(),Pr(new Set),Aa.current={source:a.document,document:a.document,updatedAt:a.updatedAt},Zt(Fc(a.document)),dt([]),Pa(a.id),Jt(a.updatedAt),za(a.title),fa.current=!1,oa(!1);const u=Yt.current;u&&Fa(u,{mode:"freeform-slide",freeformDraftId:a.id})}Ia.current=Io;function Du(a){const u=Qs(a).freeformDraftId;if(!u)return;const y=++or.current;xt(a).drafts.list(a).then(S=>{if(Yt.current!==a||or.current!==y)return;const E=S.find(R=>R.id===u&&R.mode==="freeform-slide");E&&Ia.current(E)},()=>{})}function g1(a){za(a),oa(!0)}async function x1(a,u){const y=or.current;let S=null;try{S=new URL(a,window.location.href)}catch{S=null}const E=S!==null&&/^https?:$/.test(S.protocol)&&(S.origin===window.location.origin||["127.0.0.1","localhost","[::1]"].includes(S.hostname));if(!S||!E){Ze(i("只能导入本机上的文档"));return}let R;try{const O=await fetch(S.href,{cache:"no-store"});if(!O.ok)throw new Error(String(O.status));R=await O.text()}catch{Ze(i("读取导入的文档失败,请重试"));return}if(or.current!==y)return;const $=i0(R);if(!$.ok){Ze(i($.error));return}if($.data.mode!=="freeform-slide"){Ze(i("这里只能导入自由画布文档"));return}ws($.data.document,(u==null?void 0:u.trim())||i("导入的设计")),fa.current=!0,oa(!0)}function Au(a,u){var $;if(a.workspace!=="freeform")return;const y=($=a.createFreeform)==null?void 0:$.call(a);if(!y)return;const S=u?u.flatMap(O=>y.slides[O]??[]):y.slides;if(S.length===0)return;const E=m.nodes.length===0;Ve(E?{type:"slide/insert",slides:S,replaceSlideId:m.id}:{type:"slide/insert",slides:S,afterSlideId:m.id},E?"套用模板":"插入模板页")&&dt([])}function Pu(a){var y;if(a.workspace!=="freeform")return;const u=(y=a.createFreeform)==null?void 0:y.call(a);u&&ws(u,i(a.title))}function ws(a,u=i("未命名设计"),y=!0){xs(),!Te()&&(y?Ro():po(),ds.current=a,or.current+=1,wt.current+=1,os.current+=1,Tr.current.clear(),Pr(new Set),Aa.current=null,Zt(Fc(a)),N({activeGroupPath:[],selectionPaths:[],identity:{activeSlideId:a.activeSlideId,draftId:null,userId:Yt.current}}),A(null),br(null),La([]),la(null),Pa(null),Jt(null),za(u),fa.current=!1,oa(!1),ve(!1))}const Lo=xi===null&&h.past.length>0,Tu=!ji&&lr===null&&!yn&&!B;p.useEffect(()=>{!r||us.current||!(Lo||sa)||!Tu||(Al.current=x,Pl.current=sr,Bl(r,wr.current,{mode:"freeform-slide",title:sr,document:x},{title:sr}))},[x,Lo,Tu,r,Dl,sr,Bl,sa]);const lc=(Lo||sa)&&(r===null||Dl!==null||Oa.status==="error");p.useEffect(()=>{f==null||f({title:sr,draftId:In,unsaved:lc})},[sr,In,lc,f]);const b1=Dl?{kind:"signed-out"}:r===null?{kind:"none"}:Oa.status==="error"?{kind:"error",message:Oa.error??""}:Lo||sa||Oa.status==="saving"?{kind:"saving"}:In?{kind:"saved",at:xi??Date.now(),onDevice:li(r)}:{kind:"none"};p.useEffect(()=>{if(!(!c||eo.current===c.nonce)&&!(c.kind==="open"&&!r)){if(eo.current=c.nonce,c.kind==="removed"||c.kind==="renamed"){if(wr.current!==c.draftId)return;if(c.kind==="renamed"){za(c.title);return}Zm(),ws(Ao(),void 0,!1);return}if(or.current+=1,Ra.current=!0,c.kind==="new"){const a=y=>y===null?void 0:Math.min(_c,Math.max(Bc,y)),u=dg({width:a(c.width),height:a(c.height)});ws({...Ao(),activeSlideId:u.id,slides:[u]})}else if(c.kind==="template")Pu(c.template);else if(c.kind==="import")x1(c.url,c.title);else if(r&&wr.current!==c.draftId){const a=r,u=c.draftId,y=or.current;xt(a).drafts.list(a).then(S=>{if(Yt.current!==a||or.current!==y)return;const E=S.find(R=>R.id===u&&R.mode==="freeform-slide");E?Io(E):Ze(i("没有找到这个项目,它可能已经被删除了"))},S=>wn(S,i("暂时无法读取项目,请稍后重试")))}}},[c,r]);const y1=(()=>{if(Si.length===0)return{kind:"page"};if(Wt)return{kind:"locked",name:Ir(Wt.unlockName)};if(tn)return{kind:"locked",name:Ir(tn.sourceName)};if(Si.length>1)return{kind:"multi",count:Si.length};if(!C){const u=tt?jt(m.nodes,tt):void 0;return{kind:"group",name:Ir((u==null?void 0:u.name)??"组")}}const a=(ut==null?void 0:ut.kind)==="leaf"?ut:null;return C.type==="text"?{kind:"text",node:C,fontSize:(a==null?void 0:a.fontSize)??C.fontSize}:C.type==="shape"?{kind:"shape",node:C,strokeWidth:(a==null?void 0:a.strokeWidth)??C.strokeWidth,canFrame:fs&&(Ct==null?void 0:Ct.targetKind)==="shape-fill",frameDisabledReason:Ha}:C.type==="line"?{kind:"line",node:C,strokeWidth:(a==null?void 0:a.strokeWidth)??C.strokeWidth}:C.type==="path"?{kind:"path",node:C,strokeWidth:(a==null?void 0:a.strokeWidth)??C.strokeWidth*ai(C.viewBox,C.width,C.height),canFrame:fs&&(Ct==null?void 0:Ct.targetKind)==="shape-fill",frameDisabledReason:Ha}:C.type==="qrcode"?{kind:"qrcode",node:C}:C.type==="chart"?{kind:"chart",node:C}:C.type==="table"?{kind:"table",node:C}:C.type==="timeline"?{kind:"timeline",node:C}:C.type==="progress"?{kind:"progress",node:C}:{kind:"image",node:C,canCrop:Tl,cropDisabledReason:Ha}})();function j1(){if(Wt){Mi(Wt.unlockPath,!1);return}if(tn){Mi(tn.sourcePath,!1);return}for(const a of xe)Mi(a,!0)}const Xt=yn?Va(yn):null,Wu=yn&&Xt?Ur(Xt.slide.nodes,yn.path):null,Hu=Wu&&Xt?{...L8(Wu),width:Xt.target.frameSize.width,height:Xt.target.frameSize.height}:void 0,w1=Xt!=null&&Xt.target.shape?` shape-${Xt.target.shape}`:"",cc=B?jo(B):null,Ou=B&&cc&&ke!==null?mh({renderScale:ke,startWorldMatrix:B.startWorldMatrix}):null,k1=cc&&B?ye(B.path):void 0,Ci=!!(yn||B),_u=Kt?qj(Kt.scale):1,S1=Kt?Rh(-Kt.left/Kt.scale,(Kt.width-Kt.left)/Kt.scale,_u):[],v1=Kt?Rh(-Kt.top/Kt.scale,(Kt.height-Kt.top)/Kt.scale,_u):[],N1=Vt?Vt.axis==="x"?m.width:m.height:0,Bu=Vt!==null&&Vt.position>=0&&Vt.position<=N1;return t.jsx(mm.Provider,{value:Xm,children:t.jsxs("div",{className:["freeform-workspace",yn?"is-framing":"",B?"is-image-cropping":""].filter(Boolean).join(" "),"aria-label":i("自由编辑工作区"),"data-history-depth":h.past.length,children:[e&&t.jsx(em,{chrome:o,user:n,requestAuth:l,system:"freeform-slide",title:sr,onRename:g1,save:b1,onRetrySave:()=>void Oa.flush(),actions:Wr.remote&&In?t.jsxs("button",{className:"bar-btn",type:"button","data-testid":"draft-history",disabled:Ci,onClick:()=>Ea(!0),children:[t.jsx(N0,{}),i("历史版本")]}):void 0,center:t.jsx(tm,{testId:"freeform-toolbar",label:i("自由编辑工具栏"),className:"freeform-toolbar",disabled:Ci,children:t.jsxs(td,{children:[t.jsx("button",{className:"bar-btn bar-icon",type:"button",onClick:ku,disabled:!Km,"aria-label":i("撤销"),title:i("撤销(⌘Z)"),children:t.jsx(B2,{})}),t.jsx("button",{className:"bar-btn bar-icon",type:"button",onClick:ic,disabled:!Vm,"aria-label":i("重做"),title:i("重做(⇧⌘Z)"),children:t.jsx(K2,{})}),t.jsx(pl,{}),t.jsx("div",{className:"freeform-page-context",children:t.jsx(P5,{isActive:e,width:m.width,height:m.height,onApply:Gp})}),t.jsx(pl,{}),t.jsxs("div",{className:"freeform-view-toggles",role:"group","aria-label":i("视图"),children:[t.jsx("button",{className:"bar-btn bar-icon",type:"button","data-testid":"freeform-rulers-toggle","aria-label":i("显示标尺"),title:i("显示标尺"),"aria-pressed":Ge.rulersVisible,onClick:()=>Qn({rulersVisible:!Ge.rulersVisible}),children:t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[t.jsx("path",{d:"M3.5 7.5h13v5h-13z"}),t.jsx("path",{d:"M6.5 7.5v2M9.5 7.5v2.75M12.5 7.5v2M15.5 7.5v2.75"})]})}),t.jsx("button",{className:"bar-btn bar-icon",type:"button","data-testid":"freeform-guides-toggle","aria-label":i("显示参考线"),title:i("显示参考线"),"aria-pressed":Ge.guidesVisible,onClick:()=>Qn({guidesVisible:!Ge.guidesVisible}),children:t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[t.jsx("path",{d:"M7 2.5v15M2.5 13h15",strokeDasharray:"2 2"}),t.jsx("rect",{x:"4.5",y:"4.5",width:"11",height:"11",rx:"1.5"})]})}),t.jsx("button",{className:"bar-btn bar-icon",type:"button","data-testid":"freeform-snap-toggle","aria-label":i("对象吸附"),title:i("对象吸附"),"aria-pressed":Ge.snappingEnabled,onClick:()=>Qn({snappingEnabled:!Ge.snappingEnabled}),children:t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[t.jsx("path",{d:"M5.5 3.5v6.25a4.5 4.5 0 0 0 9 0V3.5"}),t.jsx("path",{d:"M5.5 6.75h3M11.5 6.75h3"})]})})]})]})}),primary:t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",className:"bar-btn","data-testid":"find-replace-trigger",onClick:()=>lt(!0),title:i("查找替换"),"aria-label":i("查找替换"),children:t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[t.jsx("circle",{cx:"9",cy:"9",r:"5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8"}),t.jsx("path",{d:"M13.2 13.2 17 17",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"}),t.jsx("path",{d:"M6.5 9h5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}),t.jsx(o5,{disabled:ke===null||Ci,exporting:qe,progress:Mt,pageCount:x.slides.length,prefs:Ge,onPrefsChange:Qn,onExportCurrent:()=>void c1(),onExportAll:m1,onExportLong:()=>void d1(),onExportGrid:of(m)?()=>void u1():void 0,onShare:Wr.remote?()=>{bt(null),Lt(!0)}:void 0})]})}),rs&&t.jsx(Ml,{title:rs,onDismiss:()=>Ze(null)}),_t&&t.jsx(l5,{slideCount:x.slides.length,activeSlideName:m.name,countMatches:(a,u)=>fg(x,a,u==="slide"?m.id:null),onApply:(a,u,y)=>{const S=ug(x,a,u,y==="slide"?m.id:null);return S.replaced>0&&Ve({type:"document/find-replace",find:a,replace:u,...y==="slide"?{slideId:m.id}:{}}),{replaced:S.replaced,skipped:S.skipped}},onClose:()=>lt(!1)}),mt&&t.jsx(gm,{share:pt&&gn.current===at.current&&pt.expiresAt>Date.now()?pt:null,creating:qe,progress:Mt,slideCount:x.slides.length,revoking:He,error:$t,onCreate:a=>void f1(a),onRevoke:()=>pt&&void h1(pt),onClose:()=>{qe||Lt(!1)}}),ns&&r&&In&&t.jsx(xm,{ownerId:r,draftId:In,onRestored:a=>{Ea(!1),Io(a)},onClose:()=>Ea(!1)}),t.jsxs("main",{className:`freeform-main${ce?" has-drawer":""}${Ge.panelOpen?" has-panel":""}`,children:[t.jsxs("nav",{className:"freeform-tools","aria-label":i("插入"),ref:a=>{a&&(Ci?a.setAttribute("inert",""):a.removeAttribute("inert"))},children:[t.jsxs("button",{className:"freeform-tool",type:"button","data-testid":"freeform-template-button","aria-expanded":ce==="templates","aria-controls":"freeform-templates-drawer",onClick:()=>$a("templates"),children:[t.jsx(Gi,{}),t.jsx("span",{children:i("模板")})]}),t.jsxs("button",{className:"freeform-tool",type:"button","data-testid":"freeform-styles-tool","aria-expanded":ce==="styles","aria-controls":"freeform-styles-drawer",onClick:()=>$a("styles"),children:[t.jsx(W2,{}),t.jsx("span",{children:i("风格")})]}),t.jsx("span",{className:"freeform-tools-sep","aria-hidden":"true"}),t.jsxs("button",{className:"freeform-tool",type:"button","data-testid":"freeform-text-tool","aria-expanded":ce==="text","aria-controls":"freeform-text-drawer",onClick:()=>$a("text"),children:[t.jsx(k0,{}),t.jsx("span",{children:i("文字")})]}),t.jsxs("button",{className:"freeform-tool",type:"button","data-testid":"freeform-images-tool","aria-expanded":ce==="images","aria-controls":"freeform-images-drawer",onClick:()=>$a("images"),children:[t.jsx(v0,{}),t.jsx("span",{children:i("图片")})]}),t.jsxs("button",{className:"freeform-tool",type:"button","data-testid":"freeform-elements-tool","aria-expanded":ce==="elements","aria-controls":"freeform-elements-drawer",onClick:()=>$a("elements"),children:[t.jsx(S0,{}),t.jsx("span",{children:i("元素")})]}),t.jsxs("button",{className:"freeform-tool freeform-tool-end freeform-pages-tool",type:"button","data-testid":"freeform-pages-tool","aria-pressed":Ge.pagesVisible,"aria-controls":Ge.pagesVisible?"freeform-page-list":void 0,onClick:()=>Qn({pagesVisible:!Ge.pagesVisible}),children:[t.jsx(_2,{}),t.jsx("span",{children:i("页面")})]}),t.jsxs("button",{className:"freeform-tool",type:"button","data-testid":"freeform-layers-tool","aria-pressed":Ge.panelOpen&&qn==="layers",onClick:()=>ro("layers"),children:[t.jsx(ex,{}),t.jsx("span",{children:i("图层")})]}),t.jsx("input",{ref:uo,className:"freeform-file",type:"file",accept:"image/*",onChange:a=>Rp(a.currentTarget.files)}),t.jsx("input",{ref:fo,className:"freeform-font-file",type:"file",accept:n0,"data-testid":"freeform-font-input",onChange:a=>zp(a.currentTarget.files)})]}),ce==="templates"&&t.jsxs("aside",{className:"freeform-drawer is-scroll",id:"freeform-templates-drawer","aria-label":i("模板"),"data-testid":"freeform-templates-drawer",onKeyDown:a=>{a.key!=="Escape"||a.defaultPrevented||(a.preventDefault(),pe(null),requestAnimationFrame(()=>{var u;return(u=document.querySelector('[data-testid="freeform-template-button"]'))==null?void 0:u.focus()}))},children:[t.jsxs("div",{className:"freeform-drawer-head",children:[t.jsx("h2",{children:i("模板")}),t.jsx("button",{className:"icon-btn",type:"button","aria-label":i("关闭面板"),onClick:()=>pe(null),children:t.jsx(Pn,{})})]}),t.jsxs("button",{className:"accent freeform-drawer-upload",type:"button","data-testid":"freeform-templates-browse",onClick:()=>ve(!0),children:[t.jsx(Gi,{}),i("浏览全部模板")]}),t.jsx(C6,{templates:M8,pageSize:m,room:lf-x.slides.length+(m.nodes.length===0?1:0),onInsert:Au})]}),ce==="styles"&&t.jsxs("aside",{className:"freeform-drawer is-scroll",id:"freeform-styles-drawer","aria-label":i("风格"),"data-testid":"freeform-styles-drawer",onKeyDown:a=>{a.key!=="Escape"||a.defaultPrevented||(a.preventDefault(),pe(null),requestAnimationFrame(()=>{var u;return(u=document.querySelector('[data-testid="freeform-styles-tool"]'))==null?void 0:u.focus()}))},children:[t.jsxs("div",{className:"freeform-drawer-head",children:[t.jsx("h2",{children:i("风格")}),t.jsx("button",{className:"icon-btn",type:"button","aria-label":i("关闭面板"),onClick:()=>pe(null),children:t.jsx(Pn,{})})]}),t.jsx(V6,{onRestyle:go})]}),ce==="text"&&t.jsxs("aside",{className:"freeform-drawer is-scroll",id:"freeform-text-drawer","aria-label":i("文字"),"data-testid":"freeform-text-drawer",onKeyDown:a=>{a.key!=="Escape"||a.defaultPrevented||(a.preventDefault(),pe(null),requestAnimationFrame(()=>{var u;return(u=document.querySelector('[data-testid="freeform-text-tool"]'))==null?void 0:u.focus()}))},children:[t.jsxs("div",{className:"freeform-drawer-head",children:[t.jsx("h2",{children:i("文字")}),t.jsx("button",{className:"icon-btn",type:"button","aria-label":i("关闭面板"),onClick:()=>pe(null),children:t.jsx(Pn,{})})]}),t.jsxs("button",{className:"accent freeform-drawer-upload",type:"button","data-testid":"insert-text",onClick:()=>Jl("box"),children:[t.jsx(fl,{}),i("添加文本框")]}),t.jsx("div",{className:"freeform-drawer-section",children:i("默认文字样式")}),t.jsx("div",{className:"freeform-text-presets",children:pw.filter(a=>a.id!=="box").map(a=>t.jsx("button",{type:"button",className:`freeform-text-preset is-${a.id}`,"data-testid":a.testId,onClick:()=>Jl(a.id),children:i(a.label)},a.id))}),t.jsx("div",{className:"freeform-drawer-section",children:i("花字")}),t.jsx("div",{className:"freeform-text-styles",children:t5.map(a=>t.jsxs("button",{type:"button",className:`freeform-text-style${n5(a)?" is-dark":""}`,"data-testid":`text-style-${a.id}`,style:{background:a.backdrop},onClick:()=>xp(a),children:[t.jsx(id,{text:cl()==="en"?"Wow":"花字",fontSize:30,textFill:a.textFill,effect:a.effect}),t.jsx("span",{className:"freeform-text-style-name",children:i(a.name)})]},a.id))})]}),ce==="elements"&&t.jsxs("aside",{className:"freeform-drawer is-scroll",id:"freeform-elements-drawer","aria-label":i("元素"),"data-testid":"freeform-elements-drawer",onKeyDown:a=>{a.key!=="Escape"||a.defaultPrevented||a.target instanceof HTMLInputElement&&a.target.value||(a.preventDefault(),pe(null),requestAnimationFrame(()=>{var u;return(u=document.querySelector('[data-testid="freeform-elements-tool"]'))==null?void 0:u.focus()}))},children:[t.jsxs("div",{className:"freeform-drawer-head",children:[t.jsx("h2",{children:i("元素")}),t.jsx("button",{className:"icon-btn",type:"button","aria-label":i("关闭面板"),onClick:()=>pe(null),children:t.jsx(Pn,{})})]}),t.jsx(K6,{onPick:ts})]}),ce==="images"&&t.jsxs("aside",{className:"freeform-drawer",id:"freeform-images-drawer","aria-label":i("图片"),"data-testid":"freeform-images-drawer",onKeyDown:a=>{a.key!=="Escape"||a.defaultPrevented||a.target instanceof HTMLInputElement&&a.target.value||(a.preventDefault(),pe(null))},children:[t.jsxs("div",{className:"freeform-drawer-head",children:[t.jsx("h2",{children:i("图片")}),t.jsx("button",{className:"icon-btn",type:"button","aria-label":i("关闭面板"),onClick:()=>pe(null),children:t.jsx(Pn,{})})]}),t.jsxs("button",{className:"accent freeform-drawer-upload",type:"button","data-testid":"insert-image",onClick:()=>{var a;return(a=uo.current)==null?void 0:a.click()},children:[t.jsx(gr,{}),i("上传图片")]}),t.jsx("div",{className:"freeform-drawer-section",children:i("在线图库")}),t.jsx(d6,{stock:Wr.stock,onInsert:(a,u,y)=>{ec(async()=>a,u,y)}}),t.jsx("div",{className:"freeform-drawer-section",children:i("素材库")}),t.jsx(X0,{ownerId:r,onInsert:a=>void Ep(a),onManage:()=>It(ht.assets)})]}),Ge.pagesVisible&&t.jsxs("aside",{className:"freeform-rail",id:"freeform-page-list","aria-label":i("页面列表"),"data-testid":"freeform-page-strip",children:[t.jsxs("div",{className:"freeform-rail-head",children:[t.jsx("h2",{children:i("{n} 页",{n:x.slides.length})}),t.jsx("button",{type:"button",className:"icon-btn","data-testid":"freeform-pages-collapse","aria-label":i("收起页面列表"),title:i("收起页面列表"),onClick:()=>Qn({pagesVisible:!1}),children:t.jsx(Qi,{})})]}),t.jsx("div",{ref:Rt,className:"freeform-slide-list",role:"list",onDragOver:a=>{he.current&&(a.preventDefault(),a.dataTransfer.dropEffect="move")},onDrop:a=>{const u=he.current;u&&(a.preventDefault(),he.current=null,Re(null),Fi(u,x.slides.length-1))},children:x.slides.map((a,u)=>{const y=C8(a,oe),S=Rs(a.name,u),E=(ze==null?void 0:ze.slideId)===a.id&&!!ze.fromButton;return t.jsxs("div",{className:`freeform-thumb-wrap${a.id===m.id?" is-active":""}`,role:"listitem",children:[t.jsxs("button",{type:"button",draggable:!0,className:`freeform-thumb${a.id===m.id?" on":""}${(Ae==null?void 0:Ae.slideId)===a.id?Ae.position==="before"?" drop-before":" drop-after":""}`,"aria-current":a.id===m.id?"page":void 0,"data-testid":"freeform-thumb","data-slide-id":a.id,onClick:()=>No(a.id),onDragStart:R=>{he.current=a.id,R.dataTransfer.effectAllowed="move",R.dataTransfer.setData("text/plain",a.id)},onDragEnd:()=>{he.current=null,Re(null)},onDragOver:R=>{if(!he.current||he.current===a.id)return;R.preventDefault(),R.dataTransfer.dropEffect="move";const $=Lh(R);Re(O=>O&&O.slideId===a.id&&O.position===$?O:{slideId:a.id,position:$})},onDragLeave:()=>{Re(R=>(R==null?void 0:R.slideId)===a.id?null:R)},onDrop:R=>{const $=he.current;if(!$||$===a.id)return;R.preventDefault(),R.stopPropagation(),he.current=null,Re(null);const O=Lh(R)==="after",G=mp($,a.id,O);G!==null&&Fi($,G)},onContextMenu:R=>gp(R,a.id),children:[t.jsx(Xs,{slide:a,frameWidth:y.width,frameHeight:y.height,className:"freeform-thumb-art",deferOffscreen:a.id!==m.id}),t.jsx("span",{className:"freeform-thumb-caption",children:t.jsx("span",{className:"freeform-thumb-title","data-testid":"freeform-thumb-title",title:S,onDoubleClick:R=>{R.stopPropagation(),R.preventDefault(),cu(a.id)},children:S})})]}),t.jsx("button",{type:"button",className:"freeform-thumb-menu","data-testid":"freeform-thumb-menu","aria-label":i("{name} 的页面操作",{name:S}),title:i("页面操作"),"aria-haspopup":"menu","aria-expanded":E,onClick:R=>pp(R,a.id),children:t.jsx(Nl,{})}),ou===a.id&&t.jsx("input",{ref:Xl,className:"freeform-thumb-rename","data-testid":"freeform-thumb-rename","aria-label":i("重命名页面"),value:lu,onChange:R=>Fo(R.currentTarget.value),onPointerDown:R=>R.stopPropagation(),onBlur:()=>du(),onKeyDown:R=>{if(R.stopPropagation(),R.key==="Enter"){if(R.nativeEvent.isComposing||Ni.current)return;R.preventDefault(),du()}else R.key==="Escape"&&(R.preventDefault(),fp())},onCompositionStart:()=>{Ni.current=!0},onCompositionEnd:()=>{Ni.current=!1}})]},a.id)})}),t.jsxs("button",{className:"freeform-add-page",type:"button",onClick:dp,children:[t.jsx(fl,{}),t.jsx("span",{children:i("新增页面")})]})]}),t.jsxs("section",{className:"freeform-stage-pane","aria-label":i("自由画布"),children:[(B||yn)&&t.jsx("div",{className:"freeform-stage-head is-session",children:B?t.jsxs("div",{className:"freeform-framing-head freeform-crop-head",role:"toolbar","aria-label":i("图片裁剪"),children:[t.jsx("div",{className:"freeform-toolbar","data-image-crop-control":"",style:{position:"relative",zIndex:70},children:t.jsx(ol,{isActive:e,testId:"freeform-image-crop-aspect",label:i("比例"),options:R8,onSelect:sp,onEscape:()=>{gs()}})}),t.jsx("strong",{children:i("裁剪")}),t.jsx("button",{className:"toolbar-primary",type:"button","data-testid":"freeform-image-crop-done",onClick:()=>{gs()},children:i("完成")})]}):t.jsxs("div",{className:"freeform-framing-head",role:"toolbar","aria-label":i("图片取景"),children:[t.jsx("button",{className:"ghost",type:"button","data-testid":"freeform-framing-cancel",onClick:su,children:i("取消")}),t.jsx("strong",{children:i("调整取景")}),t.jsx("button",{className:"toolbar-primary",type:"button","data-testid":"freeform-framing-done",onClick:iu,children:i("完成")})]})}),t.jsx(j5,{suspended:Ci,isActive:e,subject:y1,resetKey:Bt,canAlign:Yd,canDistribute:xe.length>=3,canGroup:xe.length>=2,onStyle:a=>{me(a)},onProperty:a=>{Or(a)},onFontFamily:a=>{if(a===rd){pu();return}(C==null?void 0:C.type)==="text"&&cf(C.text,a,[C.fontWeight]).catch(()=>{});const u=(C==null?void 0:C.type)==="text"?C.fontFamily:null;me({fontFamily:a})&&u&&u!==a&&xo({from:u,to:a})},onShapeFill:a=>{Ba(a)},onAlign:wu,onDistribute:ac,onOrder:ma,onGroup:()=>{Eo()},onUngroup:()=>{zo()},onCrop:()=>{tt&&Gl(tt)},onDuplicate:rc,onToggleLock:j1,onDelete:Co,onAdjustFraming:()=>{tt&&vo(tt)},panelOpen:Ge.panelOpen&&qn==="properties",onTogglePanel:()=>ro("properties")}),t.jsxs("div",{ref:lo,className:`freeform-stage-viewport${Ge.rulersVisible?" has-rulers":""}${Vt?` guide-dragging-${Vt.axis}`:""}`,onDragEnter:Np,onDragOver:Fp,onDragLeave:Mp,onDrop:Cp,children:[Kt&&Ge.rulersVisible&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"freeform-ruler freeform-ruler-x","data-testid":"freeform-ruler-x",title:i("按住拖动可拉出竖向参考线"),onPointerDown:a=>sc(a,"x",null),children:S1.map(a=>t.jsxs(p.Fragment,{children:[t.jsx("div",{className:`freeform-ruler-tick${a.label!==null?" major":""}`,style:{left:Kt.left+a.position*Kt.scale}}),a.label!==null&&t.jsx("div",{className:"freeform-ruler-label",style:{left:Kt.left+a.position*Kt.scale},children:a.label})]},a.position))}),t.jsx("div",{className:"freeform-ruler freeform-ruler-y","data-testid":"freeform-ruler-y",title:i("按住拖动可拉出横向参考线"),onPointerDown:a=>sc(a,"y",null),children:v1.map(a=>t.jsxs(p.Fragment,{children:[t.jsx("div",{className:`freeform-ruler-tick${a.label!==null?" major":""}`,style:{top:Kt.top+a.position*Kt.scale}}),a.label!==null&&t.jsx("div",{className:"freeform-ruler-label",style:{top:Kt.top+a.position*Kt.scale},children:a.label})]},a.position))}),t.jsx("div",{className:"freeform-ruler-corner","aria-hidden":"true"})]}),t.jsx("div",{ref:da,className:`freeform-stage-scroll${be?" space-panning":q?" space-pan-ready":""}`,"aria-busy":ke===null,onScroll:ps,onPointerDownCapture:Qp,onContextMenu:e1,children:ke!==null&&t.jsx("div",{className:"freeform-stage-box",style:{width:m.width*ke,height:m.height*ke},children:t.jsxs("div",{ref:ua,className:"freeform-artboard","data-testid":"freeform-canvas","data-active-group-path":F.join("/"),onPointerDownCapture:t1,style:{width:m.width,height:m.height,transform:`scale(${ke})`,background:Zh(m.background),"--freeform-artboard-inverse-scale":1/ke},children:[t.jsxs("div",{className:"freeform-artwork-clip",onPointerDown:n1,children:[t.jsx(Xh,{slide:m,scopeGeneration:wt.current,onDecodeReport:Zd}),t.jsx(qh,{nodes:m.nodes,slideId:m.id,scopeGeneration:wt.current,onImageDecodeReport:Zd,hiddenImageContentPathKey:k1,activeParentPath:F,selectedPaths:xe,onNodePointerDown:Yp,onNodeDoubleClick:Zp,onTextChange:(a,u)=>{const y=xa(m.nodes,F,a);!y||ye(y)!==ye(a)||Ve({type:"node/update-content",slideId:m.id,updates:[{path:a,patch:{text:u}}]})},onTextFocus:a=>{const u=xa(m.nodes,F,a);u&&dt([u[u.length-1]])},onTextSelectionChange:(a,u)=>{gi(u?{path:a,start:u.start,end:u.end}:null)}}),Hr&&t.jsx("div",{className:"freeform-ui-only freeform-marquee",style:{left:Math.min(Hr.x,Hr.x+Hr.width),top:Math.min(Hr.y,Hr.y+Hr.height),width:Math.abs(Hr.width),height:Math.abs(Hr.height)}}),zl.map(a=>t.jsx("div",{className:`freeform-ui-only freeform-snap-line freeform-snap-line-${a.axis} freeform-snap-source-${a.source}`,"data-testid":"freeform-snap-line",style:a.axis==="x"?{left:a.position}:{top:a.position}},`${a.axis}-${a.position}-${a.source}`)),as&&t.jsx("div",{className:"freeform-ui-only freeform-space-badge","data-testid":"freeform-space-badge","data-space-axis":as.axis,style:{top:8/ke,fontSize:12/ke},children:i("间距 {n}",{n:Math.round(as.gap)})}),Rl.map((a,u)=>t.jsx("div",{className:"freeform-ui-only freeform-measurement","data-testid":"freeform-measurement","data-measurement-axis":a.axis,"data-measurement-side":a.side,"data-measurement-source":a.source,style:a.axis==="x"?{left:Math.min(a.from,a.to),top:a.at,width:Math.max(Math.abs(a.to-a.from),1/ke),height:1/ke}:{left:a.at,top:Math.min(a.from,a.to),width:1/ke,height:Math.max(Math.abs(a.to-a.from),1/ke)},children:t.jsx("span",{className:"freeform-ui-only freeform-measurement-label","data-testid":"freeform-measurement-label",style:{fontSize:11/ke},children:a.distance})},`${a.axis}-${a.side}-${u}`)),(Ge.guidesVisible?m.guides??[]:[]).filter(a=>(Vt==null?void 0:Vt.guideId)!==a.id).map(a=>t.jsx("div",{className:`freeform-ui-only freeform-guide freeform-guide-${a.axis}`,"data-testid":"freeform-guide","data-guide-axis":a.axis,title:i("拖动参考线,拖出页面删除;双击移除"),onPointerDown:u=>sc(u,a.axis,a.id),style:Wh(a.axis,a.position,ke),children:t.jsx("div",{className:"freeform-guide-hit",style:a.axis==="x"?{width:8/ke}:{height:8/ke}})},a.id)),Vt&&t.jsx("div",{className:`freeform-ui-only freeform-guide-ghost freeform-guide-${Vt.axis}${Bu?"":" freeform-guide-invalid"}${Vt.target?" is-snapped":""}`,"data-testid":"freeform-guide-dragging",style:Wh(Vt.axis,Vt.position,ke)}),Vt&&Bu&&t.jsx("span",{className:`freeform-ui-only freeform-guide-readout${Vt.target?" is-snapped":""}`,"data-testid":"freeform-guide-readout",style:Vt.axis==="x"?{left:Vt.position+6/ke,top:8/ke,fontSize:11/ke}:{left:8/ke,top:Vt.position+6/ke,fontSize:11/ke},children:Vt.target==="page-center"?i("居中 · {position}",{position:Math.round(Vt.position)}):Math.round(Vt.position)})]}),B&&cc&&Ou&&Nn.renderDraft&&t.jsx(vm,{ref:Nn.overlayRef,draft:Nn.renderDraft,worldMatrix:B.startWorldMatrix,screenScale:Ou,resolvedSrc:B.resolvedSrc,alt:B.startNode.alt,onImagePointerDown:Nn.panPointerDown,onImageError:ip,onHandlePointerDown:(a,u)=>Nn.handlePointerDown(u,a),onHandleKeyDown:(a,u)=>Nn.handleKeyDown(u,a),onKeyDown:Nn.overlayKeyDown}),yn&&Xt&&Hu&&t.jsxs("div",{ref:je,className:`freeform-ui-only freeform-framing-surface${w1}`,"data-testid":"freeform-framing-surface","data-framing-focus-x":Xt.target.framing.focusX,"data-framing-focus-y":Xt.target.framing.focusY,"data-framing-zoom":Xt.target.framing.zoom,role:"application","aria-label":i("调整图片取景"),tabIndex:0,style:{...Hu,...Xt.target.clipPath?{clipPath:Xt.target.clipPath}:{}},onPointerDown:cp,children:[t.jsx("span",{className:"freeform-framing-third freeform-framing-third-v first","aria-hidden":"true"}),t.jsx("span",{className:"freeform-framing-third freeform-framing-third-v second","aria-hidden":"true"}),t.jsx("span",{className:"freeform-framing-third freeform-framing-third-h first","aria-hidden":"true"}),t.jsx("span",{className:"freeform-framing-third freeform-framing-third-h second","aria-hidden":"true"})]}),!yn&&!B&&t.jsx(xj,{nodes:m.nodes,selectedPaths:xe,renderScale:ke,activeInteraction:ji,interactive:!Wt&&!tn,badge:no,onMovePointerDown:(a,u)=>vu(a,u.nodeIds[0],u.nodeIds),onResizePointerDown:s1,onRotatePointerDown:l1,onVertexPointerDown:r1,onVertexDoubleClick:i1,onShapeParamPointerDown:a1,onTableColumnPointerDown:o1})]})})}),to&&t.jsx("div",{className:"freeform-drop-overlay","data-testid":"freeform-drop-overlay","aria-hidden":"true",children:t.jsxs("div",{children:[t.jsx(gr,{}),t.jsx("b",{children:i("松开,把图片放进这一页")})]})})]}),Xt&&t.jsxs("div",{className:"freeform-framing-zoom",role:"group","aria-label":i("图片缩放"),children:[t.jsx("button",{type:"button","aria-label":i("缩小图片"),title:i("缩小图片"),"data-testid":"freeform-framing-zoom-out",disabled:Xt.target.framing.zoom<=Ps,onClick:()=>Yl(Xt.target.framing.zoom-.1),children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M4 10h12"})})}),t.jsx("input",{type:"range",min:Ps*100,max:Vi*100,step:"1",value:Math.round(Xt.target.framing.zoom*100),"data-testid":"freeform-framing-zoom","aria-label":i("图片缩放比例"),onChange:a=>Yl(Number(a.currentTarget.value)/100)}),t.jsxs("output",{children:[Math.round(Xt.target.framing.zoom*100),"%"]}),t.jsx("button",{type:"button","aria-label":i("放大图片"),title:i("放大图片"),"data-testid":"freeform-framing-zoom-in",disabled:Xt.target.framing.zoom>=Vi,onClick:()=>Yl(Xt.target.framing.zoom+.1),children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M10 4v12M4 10h12"})})})]}),!B&&!yn&&t.jsx(ij,{zoomPercent:H,canZoomOut:H>Dm,canZoomIn:H<Am,onZoomOut:()=>P(a=>Zr(a-qo)),onZoomIn:()=>P(a=>Zr(a+qo)),onFit:()=>P(_i)})]}),Ge.panelOpen&&t.jsxs(T5,{propertiesTabRef:Ad,disabled:Ci,activeTab:qn,onTabChange:Js,onClose:()=>Qn({panelOpen:!1}),layers:t.jsx(A5,{nodes:m.nodes,selectedPaths:xe,hasStructuralLockedSelection:!!(Wt||tn),onSelect:Op,onRename:_p,onReorder:Bp,onDropReorder:Kp,onSetLocked:Mi,onSetHidden:ju,onGroup:Eo,onUngroup:zo}),history:t.jsx("div",{className:"freeform-history-panel","data-testid":"freeform-history-panel","data-history-count":ss.length,children:t.jsx("ol",{className:"freeform-history-list","aria-label":i("编辑历史"),children:ss.map(a=>{const{kind:u,index:y}=a;return u==="current"?t.jsx("li",{children:t.jsxs("div",{className:"freeform-history-item is-current","data-testid":"freeform-history-item","data-history-kind":"current",children:[t.jsx("span",{className:"freeform-history-label",children:i(a.label)}),t.jsx("span",{className:"freeform-history-state",children:i("当前")})]})},a.key):t.jsx("li",{children:t.jsxs("button",{type:"button",className:"freeform-history-item","data-testid":"freeform-history-item","data-history-kind":u,"data-history-index":y,title:u==="past"?i("撤销到这一步"):i("重做到这一步"),onClick:()=>Vp(u,y),children:[t.jsx("span",{className:"freeform-history-label",children:i(a.label)}),t.jsx("span",{className:"freeform-history-state",children:u==="past"?i("撤销"):i("重做")})]})},a.key)})})}),children:[t.jsxs("div",{className:"freeform-panel-head",children:[t.jsx("span",{children:i("属性")}),(ut||F.length>0)&&t.jsxs("nav",{className:"freeform-inspector-breadcrumb","aria-label":ut?i("对象路径"):i("编辑范围"),"data-testid":ut?void 0:"freeform-scope-breadcrumb",title:(ut?[...ut.breadcrumbs.map(el),Ir(ut.node.name)]:Ud.map(el)).join(" / "),children:[((ut==null?void 0:ut.breadcrumbs)??Ud).map((a,u)=>t.jsxs("span",{title:el(a),children:[u>0&&t.jsx("span",{className:"freeform-inspector-breadcrumb-separator","aria-hidden":"true",children:"/"}),el(a)]},ye(a.path))),ut&&t.jsxs("span",{className:"freeform-inspector-breadcrumb-current",title:Ir(ut.node.name),children:[t.jsx("span",{className:"freeform-inspector-breadcrumb-separator","aria-hidden":"true",children:"/"}),Ir(ut.node.name)]})]})]}),Si.length===0?t.jsx(t.Fragment,{children:t.jsxs(kn,{title:i("页面"),testId:"inspector-page",children:[t.jsxs("label",{className:"field",children:[t.jsx("span",{className:"field-label",children:i("页面名称")}),t.jsx("input",{className:"text-input",value:jm(m.name)?Rs(m.name,j):m.name,onChange:a=>Ve({type:"slide/update",slideId:m.id,patch:{name:a.currentTarget.value}})})]}),t.jsx("div",{"data-testid":"page-background-paint",children:t.jsx(Uo,{label:i("背景"),value:m.background.type==="pattern"?{type:"solid",color:m.background.color}:m.background,modes:["solid","linear-gradient","radial-gradient","transparent","image"],fallbackPaint:Oc,onChange:a=>vr(m.id,a),onChooseImage:()=>{var a;return(a=ho.current)==null?void 0:a.click()},onClearImage:()=>vr(m.id,{...Oc}),onImageFitChange:a=>{m.background.type==="image"&&vr(m.id,{...m.background,fit:a})},onAdjustImageFraming:()=>{op()},onResetImageFraming:()=>{m.background.type!=="image"||!Gd||vr(m.id,{...m.background,framing:zr()})},imageFramingDisabled:!Bm,imageFramingDisabledReason:Vd??void 0,imageFramingResetDisabled:!Gd})}),t.jsx("div",{className:"field-label with-gap",children:i("背景图案")}),t.jsxs("div",{className:"seg stretch",role:"group","aria-label":i("背景图案"),children:[t.jsx("button",{type:"button",className:m.background.type!=="pattern"?"seg-btn on":"seg-btn","data-testid":"page-pattern-none",onClick:()=>{m.background.type==="pattern"&&vr(m.id,{type:"solid",color:m.background.color})},children:i("无")}),hg.map(a=>t.jsx("button",{type:"button",className:m.background.type==="pattern"&&m.background.pattern===a?"seg-btn on":"seg-btn","data-testid":`page-pattern-${a}`,onClick:()=>vr(m.id,pg(m.background,a)),children:i(mg[a])},a))]}),m.background.type==="pattern"&&(a=>t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"paint-row","data-testid":"page-pattern-colors",children:[t.jsx(vt,{label:i("底色"),color:a.color,onChange:u=>vr(m.id,{...a,color:u})}),t.jsx(vt,{label:i("图案色"),color:a.patternColor,onChange:u=>vr(m.id,{...a,patternColor:u})})]}),t.jsx("div",{className:"field-label with-gap",children:i("密度")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("密度"),children:gg.map(u=>t.jsx("button",{type:"button",className:a.size===u?"seg-btn on":"seg-btn","data-testid":`page-pattern-size-${u}`,onClick:()=>vr(m.id,{...a,size:u}),children:i(xg[u])},u))})]}))(m.background),t.jsx("input",{ref:ho,className:"freeform-file",type:"file",accept:"image/*","data-testid":"page-background-input",onChange:a=>{Pp(a.currentTarget.files)}})]})}):t.jsxs(t.Fragment,{children:[Wt&&t.jsxs("div",{className:"freeform-lock-banner","data-testid":"freeform-lock-banner",role:"note","aria-label":i("锁定状态"),children:[t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[t.jsx("rect",{x:"4",y:"8",width:"12",height:"9",rx:"2"}),t.jsx("path",{d:"M7 8V6a3 3 0 0 1 6 0v2"})]}),t.jsxs("div",{className:"freeform-lock-banner-copy",children:[t.jsx("strong",{children:i("已锁定")}),t.jsx("span",{children:i("锁定来源:{name}",{name:Wt.unlockName})})]}),t.jsxs("button",{className:"ghost freeform-lock-banner-action",type:"button","aria-label":i("解锁 {name}",{name:Wt.unlockName}),title:i("解锁 {name}",{name:Wt.unlockName}),onClick:()=>{Mi(Wt.unlockPath,!1)&&requestAnimationFrame(()=>{var a;return(a=Ad.current)==null?void 0:a.focus()})},children:[t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[t.jsx("rect",{x:"4",y:"8",width:"12",height:"9",rx:"2"}),t.jsx("path",{d:"M7 8V6a3 3 0 0 1 5.7-1.3"})]}),t.jsx("span",{children:i("解锁")})]})]}),!Wt&&tn&&t.jsxs("div",{className:"freeform-lock-descendant-banner","data-testid":"freeform-lock-descendant-banner",role:"note","aria-label":i("包含锁定图层"),children:[t.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[t.jsx("rect",{x:"4",y:"8",width:"12",height:"9",rx:"2"}),t.jsx("path",{d:"M7 8V6a3 3 0 0 1 6 0v2"})]}),t.jsxs("div",{className:"freeform-lock-banner-copy",children:[t.jsx("strong",{children:i("包含锁定图层")}),t.jsx("span",{children:i("锁定来源:{name},请先在图层面板解锁",{name:tn.sourceName})})]})]}),!Wa&&Yd&&t.jsxs("div",{className:"freeform-align-bar","data-testid":"freeform-align-bar",role:"toolbar","aria-label":i("对齐与分布"),children:[mw.map(a=>t.jsx("button",{type:"button",className:"align-bar-btn","data-testid":`freeform-align-${a.testId}`,"aria-label":i(a.label),title:i(a.label),onClick:()=>wu(a.id),children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:a.icon})})},a.id)),t.jsx("span",{className:"align-bar-separator","aria-hidden":"true"}),t.jsx("button",{type:"button",className:"align-bar-btn","data-testid":"freeform-distribute-h","aria-label":i("水平均分"),title:i("水平均分"),disabled:xe.length<3,onClick:()=>ac("horizontal"),children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M4 4v12M16 4v12M8.5 7h3v6h-3z"})})}),t.jsx("button",{type:"button",className:"align-bar-btn","data-testid":"freeform-distribute-v","aria-label":i("垂直均分"),title:i("垂直均分"),disabled:xe.length<3,onClick:()=>ac("vertical"),children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:"M4 4h12M4 16h12M7 8.5h6v3H7z"})})})]}),!Wa&&Si.length===1&&ut&&t.jsxs(t.Fragment,{children:[t.jsxs(kn,{title:i("位置与尺寸"),testId:"inspector-geometry",children:[t.jsxs("div",{className:"field-grid",children:[t.jsxs("label",{children:[t.jsx("span",{className:"field-glyph","aria-hidden":"true",children:ut.kind==="group"?i("中心 X"):"X"}),t.jsx(Et,{ariaLabel:ut.kind==="group"?i("中心 X"):"X",resetKey:Bt,value:ut.x,onCommit:a=>Or({property:"x",value:a})})]}),t.jsxs("label",{children:[t.jsx("span",{className:"field-glyph","aria-hidden":"true",children:ut.kind==="group"?i("中心 Y"):"Y"}),t.jsx(Et,{ariaLabel:ut.kind==="group"?i("中心 Y"):"Y",resetKey:Bt,value:ut.y,onCommit:a=>Or({property:"y",value:a})})]}),t.jsxs("label",{title:i("宽"),children:[t.jsx("span",{className:"field-glyph","aria-hidden":"true",children:"W"}),t.jsx(Et,{ariaLabel:i("宽"),min:Number.MIN_VALUE,resetKey:Bt,value:ut.width,onCommit:a=>Or({property:"width",value:a})})]}),t.jsxs("label",{title:i("高"),children:[t.jsx("span",{className:"field-glyph","aria-hidden":"true",children:"H"}),t.jsx(Et,{ariaLabel:i("高"),min:Number.MIN_VALUE,resetKey:Bt,value:ut.height,onCommit:a=>Or({property:"height",value:a})})]}),t.jsxs("label",{title:i("旋转"),children:[t.jsx(zn,{name:"rotate"}),t.jsx(Et,{ariaLabel:i("旋转"),resetKey:Bt,value:ut.rotation,onCommit:a=>Or({property:"rotation",value:a})}),t.jsx("span",{className:"field-suffix","aria-hidden":"true",children:"°"})]}),ut.kind==="group"&&t.jsxs("label",{title:i("缩放 %"),children:[t.jsx("span",{className:"field-glyph","aria-hidden":"true",children:"%"}),t.jsx(Et,{ariaLabel:i("缩放 %"),min:Number.MIN_VALUE,resetKey:Bt,value:ut.scalePercent,onCommit:a=>Or({property:"scalePercent",value:a})})]})]}),(ei(C)||wa(C)||ti(C))&&t.jsxs("div",{className:"flip-row with-gap","data-testid":"flip-row",children:[t.jsx("button",{type:"button",className:"ghost","data-testid":"flip-x","aria-pressed":C.flipX===!0,onClick:()=>qd({flipX:C.flipX!==!0}),children:i("水平翻转")}),t.jsx("button",{type:"button",className:"ghost","data-testid":"flip-y","aria-pressed":C.flipY===!0,onClick:()=>qd({flipY:C.flipY!==!0}),children:i("垂直翻转")})]}),wa(C)&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"field-label with-gap",children:i("形状")}),t.jsx("div",{className:"seg stretch",children:Rd.map(a=>t.jsxs("button",{type:"button",className:C.shape===a.id?"seg-btn on":"seg-btn",onClick:()=>me({shape:a.id}),title:i(a.label),children:[t.jsx(Bi,{shape:a.id,className:"seg-shape-icon"}),t.jsx("span",{className:"sr-only",children:i(a.label)})]},a.id))}),t.jsxs("div",{className:"field-grid with-gap","data-testid":"shape-dash-field",children:[t.jsxs("label",{title:i("虚线"),children:[t.jsx(zn,{name:"dash"}),t.jsx(Et,{ariaLabel:i("虚线"),min:0,max:500,resetKey:Bt,value:C.strokeDash??0,onCommit:a=>me({strokeDash:a>0?a:null})})]}),t.jsx("button",{className:"ghost",type:"button","data-testid":"shape-dash-clear",disabled:C.strokeDash===void 0,onClick:()=>me({strokeDash:null}),children:i("实线")})]})]})]}),_n(C)&&t.jsxs(kn,{title:i("文字"),testId:"inspector-typography",children:[t.jsxs("label",{className:"field",children:[t.jsx("span",{className:"field-label",children:i("文本")}),t.jsx("textarea",{className:"freeform-inspector-text",value:C.text,onChange:a=>Ht({text:a.currentTarget.value})})]}),t.jsxs("label",{className:"field",children:[t.jsx("span",{className:"field-label",children:i("字体")}),t.jsx(Qr,{value:Id(C.fontFamily),onChange:a=>{if(a===rd){pu();return}cf(C.text,a,[C.fontWeight]).catch(()=>{});const u=C.fontFamily;me({fontFamily:a})&&u!==a&&xo({from:u,to:a})},title:i("字体"),testId:"freeform-font-select",previewFonts:!0,options:um(Hm,{current:C.fontFamily,withImport:!0})})]}),ha&&ha.to===C.fontFamily&&qm.has(ha.from)&&t.jsx("button",{type:"button",className:"freeform-font-swap","data-testid":"freeform-font-swap",title:i("把整套里用「{from}」的文字都换成「{to}」",{from:Os(ha.from),to:Os(ha.to)}),onClick:()=>{go({fonts:{[ha.from]:ha.to}}),xo(null)},children:i("全部替换")}),t.jsxs("div",{className:"field-grid three",children:[t.jsxs("label",{title:i("字号"),children:[t.jsx(zn,{name:"font-size"}),t.jsx(Et,{ariaLabel:i("字号"),min:Number.MIN_VALUE,max:Number.MAX_VALUE,resetKey:Bt,value:ut.kind==="leaf"?ut.fontSize??C.fontSize:C.fontSize,onCommit:a=>Or({property:"fontSize",value:a})})]}),t.jsxs("label",{title:i("行高"),children:[t.jsx(zn,{name:"line-height"}),t.jsx(Et,{ariaLabel:i("行高"),min:.5,max:4,resetKey:Bt,value:C.lineHeight??1.18,onCommit:a=>me({lineHeight:a})})]}),t.jsxs("label",{title:i("字距"),children:[t.jsx(zn,{name:"letter-spacing"}),t.jsx(Et,{ariaLabel:i("字距"),min:-50,max:200,resetKey:Bt,value:C.letterSpacing??0,onCommit:a=>me({letterSpacing:a})})]})]}),t.jsx("div",{className:"field-label with-gap",children:i("对齐与字型")}),t.jsxs("div",{className:"text-style-row",children:[t.jsx("div",{className:"seg stretch",children:xw.map(a=>t.jsx("button",{type:"button",className:C.align===a.id?"seg-btn on":"seg-btn","aria-label":i(a.label),title:i(a.label),"aria-pressed":C.align===a.id,onClick:()=>me({align:a.id}),children:t.jsx("svg",{className:"seg-icon",viewBox:"0 0 16 16","aria-hidden":"true",children:t.jsx("path",{d:a.icon})})},a.id))}),t.jsxs("div",{className:"seg stretch",children:[t.jsx("button",{type:"button",className:C.fontWeight==="bold"?"seg-btn on":"seg-btn","data-testid":"text-weight-toggle","aria-pressed":C.fontWeight==="bold"?"true":"false","aria-label":i("粗体"),title:i("粗体"),onClick:()=>me({fontWeight:C.fontWeight==="bold"?"normal":"bold"}),children:t.jsx("b",{className:"seg-glyph","aria-hidden":"true",children:"B"})}),t.jsx("button",{type:"button",className:C.italic?"seg-btn on":"seg-btn","data-testid":"text-italic-toggle","aria-pressed":C.italic?"true":"false","aria-label":i("斜体"),title:i("斜体"),onClick:()=>me({italic:!C.italic}),children:t.jsx("i",{className:"seg-glyph","aria-hidden":"true",children:"I"})}),t.jsx("button",{type:"button",className:C.vertical?"seg-btn on":"seg-btn","data-testid":"text-vertical-toggle","aria-pressed":C.vertical?"true":"false","aria-label":i("竖排"),title:i("竖排"),onClick:()=>me({vertical:!C.vertical}),children:t.jsx("svg",{className:"seg-icon",viewBox:"0 0 16 16","aria-hidden":"true",children:t.jsx("path",{d:"M10.5 2.5v11M8 11l2.5 2.5L13 11M3 3.5h4M5 3.5v6.5"})})})]})]}),t.jsx("div",{className:"field-label with-gap",children:i("段落")}),t.jsxs("div",{className:"text-style-row",children:[t.jsx("div",{className:"seg stretch","data-testid":"text-vertical-align",children:bw.map(a=>{const u=(C.verticalAlign??"top")===a.id;return t.jsx("button",{type:"button",className:u?"seg-btn on":"seg-btn","aria-label":i(a.label),title:i(a.label),"aria-pressed":u,onClick:()=>me({verticalAlign:a.id}),children:t.jsx("svg",{className:"seg-icon",viewBox:"0 0 16 16","aria-hidden":"true",children:t.jsx("path",{d:a.icon})})},a.id)})}),t.jsx("div",{className:"seg stretch","data-testid":"text-list",children:yw.map(a=>{const u=(C.list??"none")===a.id;return t.jsx("button",{type:"button",className:u?"seg-btn on":"seg-btn","aria-label":i(a.label),title:i(a.label),"aria-pressed":u,onClick:()=>me({list:a.id==="none"?null:a.id}),children:t.jsx("svg",{className:"seg-icon",viewBox:"0 0 16 16","aria-hidden":"true",children:t.jsx("path",{d:a.icon})})},a.id)})})]}),t.jsx("div",{className:"field-grid three with-gap",children:t.jsxs("label",{title:i("段间距"),children:[t.jsx(zn,{name:"paragraph-spacing"}),t.jsx(Et,{ariaLabel:i("段间距"),min:0,max:1e3,resetKey:Bt,value:C.paragraphSpacing??0,onCommit:a=>me({paragraphSpacing:a})})]})}),t.jsx("div",{className:"field-label with-gap",children:i("描边")}),t.jsxs("div",{className:"paint-row","data-testid":"text-stroke-field",children:[t.jsx(vt,{label:i("描边颜色"),color:C.stroke??"#18181b",onChange:a=>me({stroke:a,strokeWidth:C.strokeWidth??2})}),t.jsx("input",{className:"paint-hex",value:C.stroke??"",placeholder:i("无"),onChange:a=>{ar(a.currentTarget.value)&&me({stroke:a.currentTarget.value,strokeWidth:C.strokeWidth??2})},"aria-label":i("描边 hex")}),t.jsx(Et,{ariaLabel:i("描边宽度"),min:.5,max:100,resetKey:Bt,value:C.strokeWidth??2,onCommit:a=>me({strokeWidth:a,...C.stroke?{}:{stroke:"#18181b"}})}),t.jsx("button",{type:"button",className:"ghost inspector-icon-btn","data-testid":"text-stroke-clear","aria-label":i("清除描边"),title:i("清除描边"),onClick:()=>me({stroke:null,strokeWidth:null}),children:t.jsx(Pn,{})})]})]}),_n(C)&&t.jsx(kn,{title:i("效果"),testId:"inspector-text-effect",children:t.jsx(e5,{effect:C.effect,textColor:C.textFill.type==="solid"?C.textFill.color:ci(C.textFill),resetKey:Bt,onChange:a=>me({effect:a})})}),_n(C)&&(Fn||(((Gu=C.spans)==null?void 0:Gu.length)??0)>0)&&t.jsxs(kn,{title:i("文字片段"),testId:"inspector-rich-spans",children:[Fn&&t.jsxs("div",{className:"rich-span-apply","data-testid":"rich-span-apply",children:[t.jsx("span",{className:"rich-span-hint",children:i("已选 {n} 字",{n:Fn.end-Fn.start})}),t.jsx("button",{className:"ghost",type:"button","data-testid":"rich-span-bold","aria-pressed":Qd,onMouseDown:a=>a.preventDefault(),onClick:()=>_a(({bold:a,...u})=>Qd?u:{...u,bold:!0}),children:i("加粗")}),t.jsx("button",{className:"ghost",type:"button","data-testid":"rich-span-underline","aria-pressed":Jd,onMouseDown:a=>a.preventDefault(),onClick:()=>_a(({underline:a,...u})=>Jd?u:{...u,underline:!0}),children:i("下划线")}),t.jsx("button",{className:"ghost",type:"button","data-testid":"rich-span-strike","aria-pressed":eu,onMouseDown:a=>a.preventDefault(),onClick:()=>_a(({strike:a,...u})=>eu?u:{...u,strike:!0}),children:i("删除线")}),t.jsxs("div",{className:"rich-span-size","data-testid":"rich-span-size",children:[t.jsx("button",{className:"ghost",type:"button","aria-label":i("缩小所选文字"),title:i("缩小所选文字"),"data-testid":"rich-span-size-down",onMouseDown:a=>a.preventDefault(),onClick:()=>tu(-1),children:"A−"}),t.jsx("span",{className:"rich-span-size-value","aria-label":i("所选文字字号"),children:Kl}),t.jsx("button",{className:"ghost",type:"button","aria-label":i("放大所选文字"),title:i("放大所选文字"),"data-testid":"rich-span-size-up",onMouseDown:a=>a.preventDefault(),onClick:()=>tu(1),children:"A+"})]}),t.jsx("button",{className:"ghost",type:"button","data-testid":"rich-span-clear",onMouseDown:a=>a.preventDefault(),onClick:()=>_a(()=>({})),children:i("清除样式")}),t.jsxs("div",{className:"rich-span-swatches",children:[t.jsx("span",{className:"rich-span-label",children:i("标色")}),y8.map(a=>t.jsx("button",{className:"rich-span-swatch",type:"button","aria-label":i("标色 {color}",{color:a}),title:a,style:{background:a},onMouseDown:u=>u.preventDefault(),onClick:()=>_a(u=>({...u,color:a}))},a))]}),t.jsxs("div",{className:"rich-span-swatches",children:[t.jsx("span",{className:"rich-span-label",children:i("高亮")}),j8.map(a=>t.jsx("button",{className:"rich-span-swatch is-highlight",type:"button","aria-label":i("高亮 {color}",{color:a}),title:a,style:{background:a},onMouseDown:u=>u.preventDefault(),onClick:()=>_a(u=>({...u,highlight:a}))},a))]})]}),C.spans&&C.spans.length>0&&t.jsx("ul",{className:"rich-span-list","data-testid":"rich-span-list",children:C.spans.map((a,u)=>t.jsxs("li",{children:[t.jsx("span",{className:"rich-span-range",title:C.text.slice(a.start,a.end),children:C.text.slice(a.start,a.end)}),a.bold&&t.jsx("span",{className:"rich-span-chip",children:i("加粗")}),a.color&&t.jsx("span",{className:"rich-span-chip",style:{color:a.color},children:i("标色")}),a.highlight&&t.jsx("span",{className:"rich-span-chip is-highlight",style:{background:a.highlight},children:i("高亮")}),a.underline&&t.jsx("span",{className:"rich-span-chip is-underline",children:i("下划线")}),a.strike&&t.jsx("span",{className:"rich-span-chip is-strike",children:i("删除线")}),a.fontSize!==void 0&&t.jsx("span",{className:"rich-span-chip",children:i("字号 {n}",{n:a.fontSize})}),t.jsx("button",{className:"draft-del",type:"button","aria-label":i("删除文字片段"),onClick:()=>np(u),children:i("删除")})]},`${a.start}-${a.end}-${u}`))})]}),Lc(C)&&vi&&t.jsxs(kn,{title:i("图表"),testId:"inspector-chart",children:[t.jsx("div",{className:"field-label",children:i("类型")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("图表类型"),children:rw.map(a=>t.jsx("button",{type:"button",className:C.chartKind===a?"seg-btn on":"seg-btn","data-testid":`chart-kind-${a}`,onClick:()=>me({chartKind:a}),children:i(ow[a])},a))}),C.chartKind==="bar"&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"field-label with-gap",children:i("堆叠方式")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("堆叠方式"),children:aw.map(a=>t.jsx("button",{type:"button",className:(C.barMode??"grouped")===a?"seg-btn on":"seg-btn","data-testid":`chart-bar-mode-${a}`,onClick:()=>me({barMode:a==="grouped"?null:a}),children:i(iw[a])},a))})]}),t.jsx("div",{className:"field-label with-gap",children:i("配色")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("配色"),children:uw.map(a=>t.jsx("button",{type:"button",className:"seg-btn","data-testid":`chart-palette-${a.id}`,title:i(a.label),onClick:()=>Ht({series:C.series.map((u,y)=>({...u,color:a.colors[y]??u.color}))}),children:i(a.label)},a.id))}),t.jsxs("div",{className:"paint-row with-gap","data-testid":"chart-ink-colors",children:[t.jsx(vt,{label:i("墨色"),color:C.ink??"#3f3f46",testId:"chart-ink-color",onChange:a=>me({ink:a})}),C.ink!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"chart-ink-reset",onClick:()=>me({ink:null}),children:i("恢复默认")})]}),t.jsx("div",{className:"field-label with-gap",children:i("系列")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("系列"),children:C.series.map((a,u)=>{var y;return t.jsx("button",{type:"button",className:u===Ta?"seg-btn on":"seg-btn","data-testid":`chart-series-${u}`,onClick:()=>K(u),children:((y=a.name)==null?void 0:y.trim())||i("第 {n} 系列",{n:u+1})},u)})}),t.jsxs("div",{className:"paint-row with-gap","data-testid":"chart-series-style",children:[t.jsx("input",{type:"text",className:"qr-payload-input",maxLength:12,value:vi.name??"",placeholder:i("第 {n} 系列",{n:Ta+1}),"aria-label":i("系列名称"),"data-testid":"chart-series-name",onChange:a=>{const u=a.currentTarget.value.trim(),y=C.series.map((S,E)=>E===Ta?{...S,...u?{name:a.currentTarget.value}:{}}:S);Ht({series:y})}}),t.jsx(vt,{label:i("系列颜色"),color:vi.color,onChange:a=>Ht({series:C.series.map((u,y)=>y===Ta?{...u,color:a}:u)})}),C.series.length>1&&t.jsx("button",{type:"button",className:"ghost","data-testid":"chart-series-remove",onClick:()=>{Ht({series:C.series.filter((a,u)=>u!==Ta)}),K(0)},children:i("删除系列")})]}),C.series.length<bg&&t.jsx("button",{type:"button",className:"ghost chart-series-add","data-testid":"chart-series-add",onClick:()=>{Ht({series:[...C.series,{values:C.labels.map(()=>0),color:sw(C.series.map(a=>a.color))}]}),K(C.series.length)},children:i("添加系列")}),t.jsx("div",{className:"field-label with-gap",children:i("数据")}),t.jsx("div",{className:"chart-data-rows","data-testid":"chart-data-rows",children:C.labels.map((a,u)=>t.jsxs("div",{className:"chart-data-row",children:[t.jsx("input",{type:"text",maxLength:24,value:a,"aria-label":i("第 {n} 项标签",{n:u+1}),onChange:y=>{const S=[...C.labels];S[u]=y.currentTarget.value,yg(S,vi.values)&&Ht({labels:S})}}),t.jsx("input",{type:"number",min:0,step:"any",value:String(vi.values[u]),"aria-label":i("第 {n} 项数值",{n:u+1}),onChange:y=>{const S=Number(y.currentTarget.value);if(!Number.isFinite(S)||S<0)return;const E=[...vi.values];E[u]=S,Ht({series:C.series.map((R,$)=>$===Ta?{...R,values:E}:R)})}}),C.labels.length>1&&t.jsx("button",{type:"button",className:"ghost chart-data-remove","aria-label":i("删除第 {n} 项",{n:u+1}),"data-testid":`chart-data-remove-${u}`,onClick:()=>Ht({labels:C.labels.filter((y,S)=>S!==u),series:C.series.map(y=>({...y,values:y.values.filter((S,E)=>E!==u)}))}),children:"×"})]},u))}),C.labels.length<jg&&t.jsx("button",{type:"button",className:"ghost chart-data-add","data-testid":"chart-data-add",onClick:()=>Ht({labels:[...C.labels,i("新增")],series:C.series.map(a=>({...a,values:[...a.values,0]}))}),children:i("添加一项")}),t.jsxs("div",{className:"chart-data-head",children:[t.jsx("span",{className:"field-label",children:i("粘贴数据")}),t.jsx("button",{type:"button",className:"ghost","data-testid":"chart-paste-data",title:i("每行「标签 数值…」,数值用空格、逗号或制表符分隔"),onClick:()=>{(async()=>{let a;try{a=await navigator.clipboard.readText()}catch{Ze(i("读取剪贴板失败,请重试"));return}const u=wg(a,C.series.length);if(!u){Ze(i("粘贴内容读不出数据:每行需要「标签 数值…」,数值为非负数字"));return}Ze(null),Ht({labels:u.labels,series:C.series.map((y,S)=>({...y,values:u.series[S]??y.values}))})})()},children:i("从剪贴板粘贴")})]}),t.jsx("div",{className:"field-label with-gap",children:i("数值标签")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("数值标签"),children:t.jsx("button",{type:"button",className:C.showValues===!0?"seg-btn on":"seg-btn","aria-pressed":C.showValues===!0,"data-testid":"chart-values-on",onClick:()=>me({showValues:C.showValues===!0?null:!0}),children:i("显示")})}),t.jsx("div",{className:"field-label with-gap",children:i("图例")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("图例"),children:lw.map(a=>t.jsx("button",{type:"button",className:(C.showLegend===void 0?"auto":C.showLegend?"on":"off")===a?"seg-btn on":"seg-btn","data-testid":`chart-legend-${a}`,onClick:()=>me({showLegend:a==="auto"?null:a==="on"}),children:i(cw[a])},a))}),(C.chartKind==="bar"||C.chartKind==="line")&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"field-label with-gap",children:i("轴刻度")}),t.jsxs("div",{className:"seg stretch",role:"group","aria-label":i("轴刻度"),children:[t.jsx("button",{type:"button",className:C.showTicks!==!1?"seg-btn on":"seg-btn","aria-pressed":C.showTicks!==!1,"data-testid":"chart-ticks-on",onClick:()=>me({showTicks:C.showTicks===!1?null:!1}),children:i("显示")}),t.jsx("button",{type:"button",className:C.showTicks===!1?"seg-btn on":"seg-btn","aria-pressed":C.showTicks===!1,"data-testid":"chart-ticks-off",onClick:()=>me({showTicks:!1}),children:i("隐藏")})]})]})]}),ew(C)&&t.jsxs(kn,{title:i("表格"),testId:"inspector-table",children:[t.jsx("div",{className:"field-label",children:i("表头")}),t.jsxs("div",{className:"seg stretch",role:"group","aria-label":i("表头"),children:[t.jsx("button",{type:"button",className:C.headerRow!==!1?"seg-btn on":"seg-btn","aria-pressed":C.headerRow!==!1,"data-testid":"table-header-on",onClick:()=>me({headerRow:C.headerRow===!1?null:!1}),children:i("显示")}),t.jsx("button",{type:"button",className:C.headerRow===!1?"seg-btn on":"seg-btn","aria-pressed":C.headerRow===!1,"data-testid":"table-header-off",onClick:()=>me({headerRow:!1}),children:i("隐藏")})]}),t.jsx("div",{className:"field-label with-gap",children:i("斑马纹")}),t.jsxs("div",{className:"seg stretch",role:"group","aria-label":i("斑马纹"),children:[t.jsx("button",{type:"button",className:C.striped===!0?"seg-btn on":"seg-btn","aria-pressed":C.striped===!0,"data-testid":"table-striped-on",onClick:()=>me({striped:C.striped===!0?null:!0}),children:i("显示")}),t.jsx("button",{type:"button",className:C.striped!==!0?"seg-btn on":"seg-btn","aria-pressed":C.striped!==!0,"data-testid":"table-striped-off",onClick:()=>me({striped:null}),children:i("隐藏")})]}),t.jsx("div",{className:"field-label with-gap",children:i("格线")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("格线"),children:kg.map(a=>t.jsx("button",{type:"button",className:(C.grid??"all")===a?"seg-btn on":"seg-btn","aria-pressed":(C.grid??"all")===a,"data-testid":`table-grid-${a}`,onClick:()=>me({grid:a==="all"?null:a}),children:i(dw[a])},a))}),C.grid!=="none"&&t.jsxs("div",{className:"paint-row with-gap","data-testid":"table-lines",children:[t.jsx(vt,{label:i("格线颜色"),color:C.lineColor??C.ink??"#3f3f46",testId:"table-line-color",onChange:a=>me({lineColor:a})}),t.jsx(Et,{ariaLabel:i("格线粗细"),min:vg,max:Sg,resetKey:Bt,value:C.lineWidth??1,onCommit:a=>me({lineWidth:a})}),(C.lineColor!==void 0||C.lineWidth!==void 0)&&t.jsx("button",{type:"button",className:"ghost","data-testid":"table-line-reset",onClick:()=>me({lineColor:null,lineWidth:null}),children:i("恢复默认")})]}),t.jsx("div",{className:"field-label with-gap",children:i("格子字号")}),t.jsxs("div",{className:"paint-row","data-testid":"table-font-size",children:[t.jsx(Et,{ariaLabel:i("格子字号"),min:Fg,max:Ng,resetKey:Bt,value:C.fontSize??Mg(C.width,C.height,C.rows,C.cols,C.cells,C.colWidths),onCommit:a=>me({fontSize:a})}),C.fontSize!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"table-font-size-auto",onClick:()=>me({fontSize:null}),children:i("自动")})]}),t.jsx("div",{className:"field-label with-gap",children:i("颜色")}),t.jsxs("div",{className:"paint-row","data-testid":"table-colors",children:[t.jsx(vt,{label:i("墨色"),color:C.ink??"#3f3f46",testId:"table-ink-color",onChange:a=>me({ink:a})}),C.ink!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"table-ink-reset",onClick:()=>me({ink:null}),children:i("恢复默认")})]}),t.jsxs("div",{className:"paint-row with-gap","data-testid":"table-fills",children:[t.jsx(vt,{label:i("表头底色"),color:C.headerFill??"#3f3f46",testId:"table-header-color",onChange:a=>me({headerFill:a})}),C.headerFill!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"table-header-reset",onClick:()=>me({headerFill:null}),children:i("恢复默认")}),t.jsx(vt,{label:i("斑马纹底色"),color:C.stripeFill??"#3f3f46",testId:"table-stripe-color",onChange:a=>me({stripeFill:a})}),C.stripeFill!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"table-stripe-reset",onClick:()=>me({stripeFill:null}),children:i("恢复默认")})]}),t.jsx("div",{className:"field-label with-gap",children:i("行列")}),t.jsxs("div",{className:"table-size-row",role:"group","aria-label":i("行列"),children:[t.jsx("button",{type:"button",className:"ghost","data-testid":"table-row-add",disabled:C.rows>=df,onClick:()=>Ht({rows:C.rows+1}),children:i("加一行")}),t.jsx("button",{type:"button",className:"ghost","data-testid":"table-row-remove",disabled:C.rows<=2,onClick:()=>Ht({rows:C.rows-1}),children:i("减一行")}),t.jsx("button",{type:"button",className:"ghost","data-testid":"table-col-add",disabled:C.cols>=uf,onClick:()=>Ht({cols:C.cols+1}),children:i("加一列")}),t.jsx("button",{type:"button",className:"ghost","data-testid":"table-col-remove",disabled:C.cols<=1,onClick:()=>Ht({cols:C.cols-1}),children:i("减一列")})]}),t.jsx("div",{className:"field-label with-gap",children:i("单元格")}),t.jsx("div",{className:"table-cell-rows","data-testid":"table-cell-rows",children:Array.from({length:C.rows},(a,u)=>t.jsx("div",{className:"table-cell-row",children:Array.from({length:C.cols},(y,S)=>{const E=u*C.cols+S;return t.jsx("input",{type:"text",maxLength:Cg,"data-testid":`table-cell-${E}`,value:C.cells[E]??"","aria-label":i("第 {n} 行第 {m} 列",{n:u+1,m:S+1}),onChange:R=>{const $=R.currentTarget.value;if(!Eg($))return;const O=[...C.cells];O[E]=$,Ht({cells:O})}},E)})},u))}),t.jsx("button",{type:"button",className:"ghost table-paste","data-testid":"table-paste-data",onClick:()=>void(async()=>{let a;try{a=await navigator.clipboard.readText()}catch{Ze(i("读取剪贴板失败,请重试"));return}const u=zg(a);if(!u){Ze(i("粘贴内容读不出表格:每行需要用制表符、逗号或空格分隔的单元格"));return}const y=Math.min(uf,Math.max(...u.rows.map(R=>R.length))),S=u.rows.slice(0,df);for(;S.length<2;)S.push([]);const E=[];for(const R of S)for(let $=0;$<y;$+=1)E.push(R[$]??"");Ze(null),Ht({rows:S.length,cols:y,cells:E})})(),children:i("从剪贴板粘贴")})]}),tw(C)&&t.jsxs(kn,{title:i("时间线"),testId:"inspector-timeline",children:[t.jsx("div",{className:"field-label",children:i("方向")}),t.jsxs("div",{className:"seg stretch",role:"group","aria-label":i("方向"),children:[t.jsx("button",{type:"button",className:C.horizontal!==!0?"seg-btn on":"seg-btn","aria-pressed":C.horizontal!==!0,"data-testid":"timeline-direction-vertical",onClick:()=>me({horizontal:C.horizontal===!0?!1:null}),children:i("竖排")}),t.jsx("button",{type:"button",className:C.horizontal===!0?"seg-btn on":"seg-btn","aria-pressed":C.horizontal===!0,"data-testid":"timeline-direction-horizontal",onClick:()=>me({horizontal:!0}),children:i("横排")})]}),t.jsx("div",{className:"field-label with-gap",children:i("颜色")}),t.jsxs("div",{className:"paint-row","data-testid":"timeline-colors",children:[t.jsx(vt,{label:i("主线颜色"),color:C.accent??"#1d4ed8",testId:"timeline-accent-color",onChange:a=>me({accent:a})}),C.accent!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"timeline-accent-reset",onClick:()=>me({accent:null}),children:i("恢复默认")}),t.jsx(vt,{label:i("墨色"),color:C.ink??"#3f3f46",testId:"timeline-ink-color",onChange:a=>me({ink:a})}),C.ink!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"timeline-ink-reset",onClick:()=>me({ink:null}),children:i("恢复默认")})]}),t.jsx("div",{className:"field-label with-gap",children:i("条目")}),t.jsx("div",{className:"timeline-items","data-testid":"timeline-items",children:C.items.map((a,u)=>t.jsxs("div",{className:"timeline-item",children:[t.jsx("input",{type:"text",maxLength:Rg,value:a.label??"",placeholder:i("时间"),"aria-label":i("第 {n} 项时间",{n:u+1}),"data-testid":`timeline-item-label-${u}`,onChange:y=>{const S=y.currentTarget.value,E=C.items.map((R,$)=>$===u?{text:R.text,...S.trim()!==""?{label:S}:{}}:{text:R.text,..."label"in R?{label:R.label}:{}});Ht({items:E})}}),t.jsx("input",{type:"text",maxLength:Ig,value:a.text,"aria-label":i("第 {n} 项内容",{n:u+1}),"data-testid":`timeline-item-text-${u}`,onChange:y=>{const S=y.currentTarget.value;if(!Lg(S))return;const E=C.items.map((R,$)=>$===u?{...R,text:S}:R);Ht({items:E})}}),t.jsx("button",{type:"button",className:"ghost timeline-item-remove","aria-label":i("删除第 {n} 项",{n:u+1}),"data-testid":`timeline-item-remove-${u}`,disabled:C.items.length<=$g,onClick:()=>Ht({items:C.items.filter((y,S)=>S!==u)}),children:"×"})]},u))}),t.jsx("button",{type:"button",className:"ghost timeline-item-add","data-testid":"timeline-item-add",disabled:C.items.length>=Dg,onClick:()=>Ht({items:[...C.items,{label:i("今天"),text:i("新的一步")}]}),children:i("加一条")})]}),nw(C)&&t.jsxs(kn,{title:i("进度"),testId:"inspector-progress",children:[t.jsx("div",{className:"field-label",children:i("数值")}),t.jsx("input",{className:"progress-value-input","data-testid":"progress-value-input",type:"number",min:0,max:100,step:.1,value:String(C.value),"aria-label":i("进度数值"),onChange:a=>{const u=Number(a.currentTarget.value);Ag(u)&&u!==C.value&&Ht({value:u})}}),t.jsx("div",{className:"field-label with-gap",children:i("标签")}),t.jsx("input",{className:"progress-label-input","data-testid":"progress-label-input",type:"text",defaultValue:C.label??"",maxLength:Pg,"aria-label":i("进度标签"),onKeyDown:a=>{if(a.key!=="Enter")return;a.preventDefault();const u=a.currentTarget.value.trim();if(u===(C.label??"")){a.currentTarget.blur();return}if(u!==""&&!ff(u)){a.currentTarget.blur();return}Ht({label:u}),a.currentTarget.blur()},onBlur:a=>{const u=a.currentTarget.value.trim();u!==(C.label??"")&&(u!==""&&!ff(u)||Ht({label:u}))}},`${C.id}:${C.label??""}`),t.jsx("div",{className:"field-label with-gap",children:i("样式")}),t.jsxs("div",{className:"seg stretch",role:"group","aria-label":i("进度样式"),children:[t.jsx("button",{type:"button",className:C.progressKind==="bar"?"seg-btn on":"seg-btn","aria-pressed":C.progressKind==="bar","data-testid":"progress-kind-bar",onClick:()=>me({progressKind:"bar"}),children:i("横条")}),t.jsx("button",{type:"button",className:C.progressKind==="ring"?"seg-btn on":"seg-btn","aria-pressed":C.progressKind==="ring","data-testid":"progress-kind-ring",onClick:()=>me({progressKind:"ring"}),children:i("圆环")})]}),t.jsx("div",{className:"field-label with-gap",children:i("进度颜色")}),t.jsxs("div",{className:"paint-row","data-testid":"progress-colors",children:[t.jsx(vt,{label:i("进度颜色"),color:C.accent??"#1d4ed8",testId:"progress-accent-color",onChange:a=>me({accent:a})}),C.accent!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"progress-accent-reset",onClick:()=>me({accent:null}),children:i("恢复默认")})]}),t.jsxs("div",{className:"paint-row with-gap","data-testid":"progress-track-colors",children:[t.jsx(vt,{label:i("轨道底色"),color:C.trackFill??"#e4e4e7",testId:"progress-track-color",onChange:a=>me({trackFill:a})}),C.trackFill!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"progress-track-reset",onClick:()=>me({trackFill:null}),children:i("恢复默认")})]}),t.jsxs("div",{className:"paint-row with-gap","data-testid":"progress-ink-colors",children:[t.jsx(vt,{label:i("墨色"),color:C.ink??"#3f3f46",testId:"progress-ink-color",onChange:a=>me({ink:a})}),C.ink!==void 0&&t.jsx("button",{type:"button",className:"ghost","data-testid":"progress-ink-reset",onClick:()=>me({ink:null}),children:i("恢复默认")})]})]}),Oh(C)&&t.jsxs(kn,{title:i("二维码"),testId:"inspector-qrcode",children:[t.jsx("div",{className:"field-label",children:i("内容")}),t.jsx("input",{className:"qr-payload-input","data-testid":"qr-payload-input",type:"text",defaultValue:C.payload,maxLength:Tg,"aria-label":i("二维码内容"),onKeyDown:a=>{if(a.key!=="Enter")return;a.preventDefault();const u=a.currentTarget.value.trim();u&&u!==C.payload&&Ht({payload:u}),a.currentTarget.blur()},onBlur:a=>{const u=a.currentTarget.value.trim();u&&u!==C.payload&&Ht({payload:u})}},`${C.id}:${C.payload.length}`),t.jsx("div",{className:"field-label with-gap",children:i("纠错级别")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("纠错级别"),children:Z8.map(a=>t.jsx("button",{type:"button",className:(C.ecl??"M")===a?"seg-btn on":"seg-btn","data-testid":`qr-ecl-${a}`,onClick:()=>me({ecl:a==="M"?null:a}),children:a},a))}),t.jsx("div",{className:"field-label with-gap",children:i("模块样式")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("模块样式"),children:X8.map(a=>t.jsx("button",{type:"button",className:(C.moduleStyle??"square")===a?"seg-btn on":"seg-btn","data-testid":`qr-module-${a}`,onClick:()=>me({moduleStyle:a==="square"?null:a}),children:i(q8[a])},a))}),t.jsx("div",{className:"field-label with-gap",children:i("码边距")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("码边距"),children:Q8.map(a=>t.jsx("button",{type:"button",className:(C.quietZone??2)===a.value?"seg-btn on":"seg-btn","data-testid":`qr-quiet-${a.value}`,onClick:()=>me({quietZone:a.value===2?null:a.value}),children:i(a.label)},a.value))}),t.jsx("div",{className:"field-label with-gap",children:i("颜色")}),t.jsxs("div",{className:"paint-row","data-testid":"qr-colors",children:[t.jsx(vt,{label:i("码点颜色"),color:C.dark,onChange:a=>me({dark:a})}),t.jsx(vt,{label:i("背景颜色"),color:C.light,onChange:a=>me({light:a})})]}),t.jsx("div",{className:"field-label with-gap",children:i("品牌 logo")}),t.jsxs("div",{className:"paint-row","data-testid":"qr-logo-row",children:[t.jsx("button",{className:"ghost",type:"button","data-testid":"qr-logo-upload",onClick:()=>{var a;return(a=mo.current)==null?void 0:a.click()},children:C.logoSrc?i("更换 logo"):i("上传 logo")}),C.logoSrc&&t.jsx("button",{className:"ghost",type:"button","data-testid":"qr-logo-remove",onClick:()=>me({logoSrc:null}),children:i("移除 logo")})]}),t.jsx("p",{className:"qr-logo-hint","data-testid":"qr-logo-hint",children:i("logo 盖在码中央,会自动按最高纠错级别 H 生成,扫码不受影响")}),t.jsx("input",{ref:mo,className:"freeform-file",type:"file",accept:"image/*",onChange:a=>{var y;const u=(y=a.currentTarget.files)==null?void 0:y[0];u&&Dp(u)}}),t.jsx("div",{className:"field-label with-gap",children:i("预设")}),t.jsx("div",{className:"seg stretch",role:"group","aria-label":i("预设"),children:J8.map(a=>t.jsx("button",{type:"button",className:"seg-btn","data-testid":`qr-preset-${a.id}`,title:i(a.label),onClick:()=>me({dark:a.dark,light:a.light,moduleStyle:a.moduleStyle==="square"?null:a.moduleStyle}),children:i(a.label)},a.id))})]}),(_n(C)||wa(C)||ti(C)||ei(C))&&t.jsxs(kn,{title:i("填充"),testId:"inspector-fill",children:[_n(C)&&t.jsx("div",{"data-testid":"text-fill-paint",children:t.jsx(Uo,{label:i("文字颜色"),value:C.textFill,modes:["solid","linear-gradient","radial-gradient"],fallbackPaint:Wg,onChange:a=>me({textFill:a})})}),wa(C)&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"data-testid":"shape-fill-paint",children:t.jsx(Uo,{label:i("填充"),value:C.fill,modes:["solid","linear-gradient","radial-gradient","transparent","image"],fallbackPaint:Po,onChange:a=>Ba(a),onChooseImage:()=>{var a;return(a=ki.current)==null?void 0:a.click()},onClearImage:()=>Ba({...Po}),onImageFitChange:a=>{C.fill.type==="image"&&Ba({...C.fill,fit:a})},onAdjustImageFraming:()=>{tt&&vo(tt)},onResetImageFraming:Ul,imageFramingDisabled:!fs,imageFramingDisabledReason:Ha??void 0,imageFramingResetDisabled:!hs})}),t.jsx("input",{ref:ki,className:"freeform-file",type:"file",accept:"image/*",onChange:a=>xu(a.currentTarget.files)})]}),ti(C)&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"data-testid":"path-fill-paint",children:t.jsx(Uo,{label:i("填充"),value:C.fill,modes:["solid","linear-gradient","radial-gradient","transparent","image"],fallbackPaint:Po,onChange:a=>Ba(a),onChooseImage:()=>{var a;return(a=ki.current)==null?void 0:a.click()},onClearImage:()=>Ba({...Po}),onImageFitChange:a=>{C.fill.type==="image"&&Ba({...C.fill,fit:a})},onAdjustImageFraming:()=>{tt&&vo(tt)},onResetImageFraming:Ul,imageFramingDisabled:!fs,imageFramingDisabledReason:Ha??void 0,imageFramingResetDisabled:!hs})}),t.jsx("input",{ref:ki,className:"freeform-file",type:"file",accept:"image/*",onChange:a=>xu(a.currentTarget.files)})]}),ei(C)&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"field-label",children:i("图片填充方式")}),t.jsx("div",{className:"seg stretch",children:E8.map(a=>t.jsx("button",{type:"button",className:C.fit===a.id?"seg-btn on":"seg-btn","data-testid":`paint-image-fit-${a.id}`,onClick:()=>me({fit:a.id}),children:i(a.label)},a.id))}),t.jsxs("div",{className:"inspector-actions",children:[t.jsx("button",{className:"ghost",type:"button","data-testid":"freeform-crop-image","aria-label":i("裁剪图片"),title:Tl?i("裁剪图片"):Ha??void 0,disabled:!Tl,onClick:()=>{tt&&Gl(tt)},children:i("裁剪")}),t.jsx("button",{className:"ghost",type:"button","data-testid":"freeform-reset-framing","aria-label":i("重置图片取景"),title:hs?i("重置图片取景"):i("当前已经是默认取景"),disabled:!hs,onClick:Ul,children:i("重置取景")}),t.jsx("button",{className:"ghost",type:"button","data-testid":"freeform-image-as-background",onClick:bu,children:i("设为背景")})]})]})]}),ei(C)&&t.jsx(kn,{title:i("相框"),testId:"inspector-image-frame",children:t.jsxs("div",{className:"field-grid with-gap",children:[t.jsxs("div",{className:"stroke-color-field","data-testid":"image-stroke-color",children:[t.jsx("span",{className:"stroke-color-label",children:i("颜色")}),t.jsxs("div",{className:"color-field",children:[t.jsx("span",{className:"color-field-value",children:C.stroke===void 0?i("无"):C.stroke.toUpperCase()}),t.jsx(vt,{label:i("图片描边颜色"),color:C.stroke??"#ffffff",onChange:a=>me(C.strokeWidth===void 0?{stroke:a,strokeWidth:12}:{stroke:a})})]})]}),t.jsxs("label",{title:i("描边宽"),children:[t.jsx(zn,{name:"stroke"}),t.jsx(Et,{ariaLabel:i("描边宽"),min:0,max:100,resetKey:Bt,value:C.strokeWidth??0,onCommit:a=>me(a===0?{strokeWidth:null}:C.stroke===void 0?{stroke:"#ffffff",strokeWidth:a}:{strokeWidth:a})})]})]})}),(wa(C)||Hi(C)||ti(C))&&t.jsxs(kn,{title:i("描边"),testId:"inspector-stroke",children:[Hi(C)&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"field-label",children:i("线条")}),t.jsx("div",{className:"seg stretch","data-testid":"line-kind-seg",children:["line","arrow"].map(a=>t.jsx("button",{type:"button",className:C.lineKind===a?"seg-btn on":"seg-btn",onClick:()=>me({lineKind:a}),children:a==="line"?i("直线"):i("箭头")},a))})]}),t.jsxs("div",{className:"field-grid with-gap",children:[t.jsxs("div",{className:"stroke-color-field","data-testid":wa(C)?"shape-stroke-color":ti(C)?"path-stroke-color":"line-stroke-color",children:[t.jsx("span",{className:"stroke-color-label",children:i("颜色")}),t.jsxs("div",{className:"color-field",children:[t.jsx("span",{className:"color-field-value",children:C.stroke==="transparent"?i("透明"):C.stroke.toUpperCase()}),t.jsx(vt,{label:wa(C)?i("形状描边颜色"):ti(C)?i("图形描边颜色"):i("线条颜色"),color:C.stroke,onChange:a=>me({stroke:a})})]})]}),t.jsxs("label",{title:Hi(C)?i("粗细"):i("描边宽"),children:[t.jsx(zn,{name:"stroke"}),t.jsx(Et,{ariaLabel:Hi(C)?i("粗细"):i("描边宽"),min:Hi(C)?Number.MIN_VALUE:0,max:Number.MAX_VALUE,resetKey:Bt,value:ut.kind==="leaf"?ut.strokeWidth??C.strokeWidth:C.strokeWidth,onCommit:a=>Or({property:"strokeWidth",value:a})})]})]}),ti(C)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"field-grid with-gap",children:[t.jsxs("label",{title:i("虚线"),children:[t.jsx(zn,{name:"dash"}),t.jsx(Et,{ariaLabel:i("虚线"),min:0,max:Number.MAX_VALUE,resetKey:Bt,value:C.dash===void 0?0:C.dash*ai(C.viewBox,C.width,C.height),onCommit:a=>me({dash:a>0?a/ai(C.viewBox,C.width,C.height):null})})]}),t.jsx("div",{className:"inspector-actions",children:t.jsx("button",{className:"ghost",type:"button","data-testid":"path-dash-clear",disabled:C.dash===void 0,onClick:()=>me({dash:null}),children:i("实线")})})]}),t.jsx("div",{className:"field-label with-gap",children:i("线帽")}),t.jsx("div",{className:"seg stretch",children:Ih.map(a=>t.jsx("button",{type:"button",className:(C.cap??"round")===a.id?"seg-btn on":"seg-btn","data-testid":`path-cap-${a.id}`,onClick:()=>me({cap:a.id}),children:i(a.label)},a.id))}),t.jsx("div",{className:"field-label with-gap",children:i("拐角")}),t.jsx("div",{className:"seg stretch",children:v8.map(a=>t.jsx("button",{type:"button",className:(C.join??"round")===a.id?"seg-btn on":"seg-btn","data-testid":`path-join-${a.id}`,onClick:()=>me({join:a.id}),children:i(a.label)},a.id))})]}),Hi(C)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"field-grid with-gap",children:[t.jsxs("label",{title:i("虚线"),children:[t.jsx(zn,{name:"dash"}),t.jsx(Et,{ariaLabel:i("虚线"),min:1,max:500,resetKey:Bt,value:C.dash??0,onCommit:a=>me({dash:a})})]}),t.jsx("div",{className:"inspector-actions",children:t.jsx("button",{className:"ghost",type:"button","data-testid":"line-dash-clear",disabled:C.dash===void 0,onClick:()=>me({dash:null}),children:i("实线")})})]}),t.jsx("div",{className:"field-label with-gap",children:i("线帽")}),t.jsx("div",{className:"seg stretch",children:Ih.map(a=>t.jsx("button",{type:"button",className:(C.cap??"round")===a.id?"seg-btn on":"seg-btn","data-testid":`line-cap-${a.id}`,onClick:()=>me({cap:a.id}),children:i(a.label)},a.id))}),t.jsx("div",{className:"field-label with-gap",children:i("端点")}),t.jsx("div",{className:"field-grid with-gap",children:F8.map(a=>{const u=a.id==="start"?C.startCap??"none":C.endCap??(C.lineKind==="arrow"?"arrow":"none");return t.jsxs("div",{children:[t.jsx("div",{className:"field-label",children:i(a.label)}),t.jsx("div",{className:"seg stretch",children:N8.map(y=>{const S=a.id==="end"&&C.lineKind==="arrow"?"arrow":"none";return t.jsx("button",{type:"button",className:u===y.id?"seg-btn on":"seg-btn","data-testid":`line-endpoint-${a.id}-${y.id}`,onClick:()=>me(y.id===S?a.id==="start"?{startCap:null}:{endCap:null}:a.id==="start"?{startCap:y.id}:{endCap:y.id}),children:i(y.label)},y.id)})})]},a.id)})})]})]}),C&&t.jsxs(kn,{title:i("外观"),testId:"inspector-appearance",children:[ei(C)&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"field-label",children:i("圆角")}),t.jsx("div",{className:"seg stretch","data-testid":"image-radius-presets",children:z8.map(a=>{const u=a.radius==="capsule"?Math.min(2e3,Math.round(Math.min(C.width,C.height)/2)):a.radius,y=a.radius==="capsule"?(C.cornerRadius??0)>=u-.5:(C.cornerRadius??0)===u;return t.jsx("button",{type:"button",className:y?"seg-btn on":"seg-btn","data-testid":`image-radius-${a.id}`,"aria-pressed":y,onClick:()=>me({cornerRadius:u}),children:i(a.label)},a.id)})})]}),t.jsxs("div",{className:"field-grid with-gap",children:[t.jsxs("label",{title:i("不透明度 %"),children:[t.jsx(zn,{name:"opacity"}),t.jsx(Et,{ariaLabel:i("不透明度 %"),min:0,max:100,resetKey:Bt,value:Math.round((C.opacity??1)*100),onCommit:a=>me({opacity:Math.round(a)/100})}),t.jsx("span",{className:"field-suffix","aria-hidden":"true",children:"%"})]}),wa(C)&&C.shape==="rect"&&t.jsxs("div",{className:"corner-radii-grid","data-testid":"corner-radii-grid",children:[[["topLeft","左上圆角"],["topRight","右上圆角"],["bottomRight","右下圆角"],["bottomLeft","左下圆角"]].map(([a,u])=>t.jsxs("label",{title:i(u),children:[t.jsx(zn,{name:"radius"}),t.jsx(Et,{ariaLabel:i(u),min:0,max:2e3,resetKey:Bt,value:C.cornerRadii!==void 0?C.cornerRadii[a]:C.cornerRadius??16,onCommit:y=>{const S=C.cornerRadii!==void 0?{...C.cornerRadii}:{topLeft:C.cornerRadius??16,topRight:C.cornerRadius??16,bottomRight:C.cornerRadius??16,bottomLeft:C.cornerRadius??16};me({cornerRadii:{...S,[a]:y}})}})]},a)),t.jsx("button",{type:"button",className:"ghost","data-testid":"corner-radii-reset",disabled:C.cornerRadii===void 0,onClick:()=>me({cornerRadii:null}),children:i("统一圆角")})]}),ei(C)&&t.jsxs("label",{title:i("圆角"),children:[t.jsx(zn,{name:"radius"}),t.jsx(Et,{ariaLabel:i("圆角"),min:0,max:2e3,resetKey:Bt,value:C.cornerRadius??0,onCommit:a=>me({cornerRadius:a})})]})]}),t.jsx("div",{className:"field-label with-gap",children:i("阴影")}),t.jsx(hw,{shadow:C.shadow,resetKey:Bt,onChange:a=>me({shadow:a})}),t.jsx("div",{className:"field-label with-gap",children:i("混合模式")}),t.jsx(Qr,{value:C.blendMode??"normal",onChange:a=>me({blendMode:a==="normal"?null:a}),title:i("混合模式"),testId:"freeform-blend-select",options:S8.map(a=>({...a,label:i(a.label)}))}),t.jsx("div",{className:"field-label with-gap",children:i("滤镜")}),t.jsx(fw,{filter:C.filter,resetKey:Bt,onChange:a=>me({filter:a})})]})]}),!Wa&&t.jsxs(kn,{title:i("排列"),testId:"inspector-arrange",children:[t.jsx("div",{className:"field-label",children:i("层级")}),t.jsx("div",{className:"inspector-icon-row",children:jw.map(a=>t.jsx("button",{className:"ghost inspector-icon-btn",type:"button","aria-label":i(a.label),title:i(a.label),onClick:()=>ma(a.id),children:t.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:t.jsx("path",{d:a.icon})})},a.id))})]}),!Wa&&Si.length===1&&t.jsx(kn,{title:i("删除"),testId:"inspector-danger",tone:"danger",children:t.jsx("button",{className:"ghost inspector-delete",type:"button",onClick:Co,children:i("删除")})})]})]})]}),t.jsx(sm,{open:se,workspace:"freeform",hasCurrentContent:In!==null||h.past.length>0||x.slides.length>1||x.slides.some(a=>a.nodes.length>0),currentIsSaved:r!==null&&!lc,onClose:()=>ve(!1),onApply:Pu,onInsert:a=>{Au(a),ve(!1)}}),Dt&&t.jsx("div",{className:"sheet-backdrop",onClick:()=>Xn(!1),children:t.jsx("div",{className:"sheet freeform-warning-sheet",onClick:a=>a.stopPropagation(),children:t.jsxs("div",{className:"sheet-body",children:[t.jsx("h2",{children:i("包含不同尺寸页面")}),t.jsx("p",{className:"form-note",children:i("当前作品包含不同尺寸页面。ZIP 中的图片会保留各自页面尺寸,不会统一拉伸或裁剪。")}),t.jsxs("div",{className:"sheet-foot",children:[t.jsx("button",{type:"button",className:"ghost",onClick:()=>Xn(!1),children:i("取消")}),t.jsx("button",{type:"button",className:"accent",onClick:p1,disabled:ke===null,children:i("继续导出")})]})]})})}),W&&t.jsxs("div",{ref:Se,className:"freeform-context-menu","data-testid":"freeform-context-menu",role:"menu","aria-label":i("画布操作"),style:{left:W.x,top:W.y},children:[t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-copy",disabled:_e.length===0,onClick:()=>{dn(),nc()},children:[i("复制"),t.jsx(En,{keys:Bn("C",{mod:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-duplicate",disabled:_e.length===0,onClick:()=>{dn(),rc()},children:[i("原位复制"),t.jsx(En,{keys:Bn("D",{mod:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-cut",disabled:_e.length===0,onClick:()=>{dn(),yu()},children:[i("剪切"),t.jsx(En,{keys:Bn("X",{mod:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-paste",disabled:!z||z.nodes.length===0,onClick:()=>{dn(),bs()},children:[i("粘贴"),t.jsx(En,{keys:Bn("V",{mod:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-paste-in-place",disabled:!z||z.nodes.length===0,onClick:()=>{dn(),bs(!0)},children:[i("原位粘贴"),t.jsx(En,{keys:Bn("V",{mod:!0,shift:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-delete",disabled:_e.length===0,onClick:()=>{dn(),Co()},children:[i("删除"),t.jsx(En,{keys:ym})]}),t.jsx("div",{className:"freeform-context-menu-separator",role:"separator"}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-forward",disabled:_e.length===0,onClick:()=>{dn(),ma("forward")},children:[i("上移一层"),t.jsx(En,{keys:Bn("]",{mod:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-backward",disabled:_e.length===0,onClick:()=>{dn(),ma("backward")},children:[i("下移一层"),t.jsx(En,{keys:Bn("[",{mod:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-front",disabled:_e.length===0,onClick:()=>{dn(),ma("front")},children:[i("置于顶层"),t.jsx(En,{keys:"]"})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-back",disabled:_e.length===0,onClick:()=>{dn(),ma("back")},children:[i("移到底层"),t.jsx(En,{keys:"["})]}),oo&&t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-as-background",disabled:jn,onClick:()=>{dn(),bu()},children:i("设为背景")}),t.jsx("div",{className:"freeform-context-menu-separator",role:"separator"}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-group",disabled:xe.length<2,onClick:()=>{dn(),Eo()},children:[i("编组"),t.jsx(En,{keys:Bn("G",{mod:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-ungroup",disabled:!wi,onClick:()=>{dn(),zo()},children:[i("解组"),t.jsx(En,{keys:Bn("G",{mod:!0,shift:!0})})]}),t.jsx("div",{className:"freeform-context-menu-separator",role:"separator"}),t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-lock",disabled:_e.length===0,onClick:()=>{dn(),xe.forEach(a=>{Mi(a,!jn)})},children:jn?i("解锁"):i("锁定")}),t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-visibility",disabled:_e.length===0,onClick:()=>{dn(),xe.forEach(a=>{ju(a,!cr)})},children:cr?i("取消隐藏"):i("隐藏")}),t.jsx("div",{className:"freeform-context-menu-separator",role:"separator"}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-copy-style",disabled:!dr,onClick:()=>{dn(),Eu()},children:[i("复制样式"),t.jsx(En,{keys:Bn("C",{mod:!0,alt:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-paste-style",disabled:!T||!dr,onClick:()=>{dn(),zu()},children:[i("粘贴样式"),t.jsx(En,{keys:Bn("V",{mod:!0,alt:!0})})]}),t.jsxs("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-context-menu-zoom-selection",disabled:_e.length===0,onClick:()=>{dn(),Cu()},children:[i("缩放到选区"),t.jsx(En,{keys:Bn("2",{shift:!0})})]})]}),ze&&jr>=0&&t.jsxs("div",{ref:Ye,className:"freeform-context-menu","data-testid":"freeform-slide-context-menu",role:"menu","aria-label":i("页面操作"),style:{left:ze.x,top:ze.y},onKeyDown:a=>{const u=Array.from(a.currentTarget.querySelectorAll('[role="menuitem"]:not(:disabled)')),y=u.findIndex(E=>E===document.activeElement);let S=null;a.key==="ArrowDown"?S=y+1:a.key==="ArrowUp"?S=y<0?u.length-1:y-1:a.key==="Home"?S=0:a.key==="End"&&(S=u.length-1),S!==null&&u.length>0?(a.preventDefault(),a.stopPropagation(),u[(S+u.length)%u.length].focus()):a.key==="Escape"?(a.preventDefault(),a.stopPropagation(),_r(!0)):a.key==="Tab"&&_r(!1)},children:[t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-slide-context-menu-rename",onClick:()=>{const a=ze.slideId;_r(!1),cu(a)},children:i("重命名此页")}),t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-slide-context-menu-duplicate",disabled:x.slides.length>=lf,onClick:()=>{_r(!0),up(ze.slideId)},children:i("复制此页")}),t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-slide-context-menu-delete",disabled:x.slides.length<=1,onClick:()=>{_r(!0),hp(ze.slideId)},children:i("删除此页")}),t.jsx("div",{className:"freeform-context-menu-separator",role:"separator"}),t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-slide-context-menu-up",disabled:jr===0,onClick:()=>{_r(!0),Fi(ze.slideId,jr-1)},children:i("上移一位")}),t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-slide-context-menu-down",disabled:jr===x.slides.length-1,onClick:()=>{_r(!0),Fi(ze.slideId,jr+1)},children:i("下移一位")}),t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-slide-context-menu-front",disabled:jr===0,onClick:()=>{_r(!0),Fi(ze.slideId,0)},children:i("移到最前")}),t.jsx("button",{type:"button",role:"menuitem",className:"freeform-context-menu-item","data-testid":"freeform-slide-context-menu-back",disabled:jr===x.slides.length-1,onClick:()=>{_r(!0),Fi(ze.slideId,x.slides.length-1)},children:i("移到最后")})]})]})})}const Wm="slicer.mode.v1";let Vh=0;function kw(){var e;try{const n=localStorage.getItem(Wm);return n==="light"||n==="dark"?n:(e=window.matchMedia)!=null&&e.call(window,"(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}function Sw(){const[e,n]=p.useState(kw);return p.useEffect(()=>{const s=document.documentElement;s.setAttribute("data-theme",e),s.style.colorScheme=e;try{localStorage.setItem(Wm,e)}catch{}},[e]),[e,()=>{const s=document.documentElement;s.classList.add("theme-anim"),window.clearTimeout(Vh),Vh=window.setTimeout(()=>s.classList.remove("theme-anim"),320),n(l=>l==="light"?"dark":"light")}]}function vw({profile:e,onSave:n,onClose:r}){const[s,l]=p.useState(e),o=p.useRef(null),c=(g,x)=>l(m=>({...m,[g]:x}));function f(g){var j;const x=(j=g.target.files)==null?void 0:j[0];if(!x)return;const m=new FileReader;m.onload=()=>c("avatarImage",m.result),m.readAsDataURL(x)}const h=s.avatarImage?{backgroundImage:`url(${s.avatarImage})`}:{background:s.avatarColor};return t.jsx("div",{className:"modal-backdrop",onClick:r,children:t.jsxs("div",{className:"modal",onClick:g=>g.stopPropagation(),children:[t.jsxs("div",{className:"modal-head",children:[t.jsx("h3",{children:i("个人资料")}),t.jsx("button",{className:"modal-x",onClick:r,"aria-label":i("关闭"),children:t.jsx(Pn,{})})]}),t.jsxs("div",{className:"modal-row",children:[t.jsx("div",{className:"avatar-preview",style:h}),t.jsxs("div",{className:"avatar-picker",children:[t.jsx("div",{className:"field-label",children:i("头像颜色(或上传图片)")}),t.jsxs("div",{className:"swatches",children:[f2.map(g=>t.jsx("button",{className:!s.avatarImage&&s.avatarColor===g?"swatch active":"swatch",style:{background:g},onClick:()=>{c("avatarColor",g),c("avatarImage",null)},"aria-label":i("颜色 {color}",{color:g})},g)),t.jsx("button",{className:"swatch swatch-upload",onClick:()=>{var g;return(g=o.current)==null?void 0:g.click()},"aria-label":i("上传图片"),children:"+"}),t.jsx("input",{ref:o,type:"file",accept:"image/*",hidden:!0,onChange:f})]})]})]}),t.jsxs("label",{className:"field",children:[t.jsx("span",{className:"field-label",children:i("昵称")}),t.jsx("input",{className:"text-input",value:s.nickname,onChange:g=>c("nickname",g.target.value)})]}),t.jsxs("label",{className:"field",children:[t.jsx("span",{className:"field-label",children:i("@ 用户名(推特)")}),t.jsx("input",{className:"text-input",value:s.handle,onChange:g=>c("handle",g.target.value)})]}),t.jsxs("label",{className:"field",children:[t.jsx("span",{className:"field-label",children:i("发布地点(微博/推特)")}),t.jsx("input",{className:"text-input",value:s.location,onChange:g=>c("location",g.target.value)})]}),t.jsxs("div",{className:"field-inline",children:[t.jsx("span",{className:"field-label",children:i("显示认证标志")}),t.jsx("button",{className:s.verified?"toggle on":"toggle",onClick:()=>c("verified",!s.verified),role:"switch","aria-checked":s.verified,children:t.jsx("span",{className:"toggle-knob"})})]}),t.jsxs("div",{className:"field-inline",children:[t.jsx("span",{className:"field-label",children:i("只在首页显示个人信息")}),t.jsx("button",{className:s.headerFirstPageOnly?"toggle on":"toggle",onClick:()=>c("headerFirstPageOnly",!s.headerFirstPageOnly),role:"switch","aria-checked":s.headerFirstPageOnly,children:t.jsx("span",{className:"toggle-knob"})})]}),t.jsxs("div",{className:"modal-foot",children:[t.jsx("button",{className:"ghost",onClick:r,children:i("取消")}),t.jsx("button",{className:"primary",onClick:()=>n(s),children:i("保存")})]})]})})}const Nw=new Map(ui.flatMap(e=>{var r;const n=(r=e.createMarkdown)==null?void 0:r.call(e);return n?[[n.themeId,n.fontFamily]]:[]}));function $c(e,n){return e.look&&Nw.get(e.id)||n}const Gh=92;function Fw({theme:e,html:n,pageCount:r,title:s,fontFamily:l,radius:o,profile:c}){const f=bl(pr[0],e,l),h=Gh/f.width;return t.jsx("span",{className:"doc-preview doc-preview-md look-thumb",style:{width:Gh,height:Math.round(f.height*h),...kd(h,o,f)},"aria-hidden":"true",children:t.jsx(yl,{html:n,config:f,profile:c,pageIndex:0,pageCount:r,pageRole:e.look&&r>1?"cover":"article",showHeader:!1,title:s})})}function Mw({themeId:e,fontFamily:n,radius:r,profile:s,firstPageHtml:l,pageCount:o,title:c,onPick:f}){const[h,g]=p.useState(!1),[x,m]=p.useState(0),j=p.useRef(null),k=p.useRef(null),v=p.useRef(null),w=p.useId(),N=h2(e),F=N.filter(D=>D.look),I=N.filter(D=>!D.look),M=[...F,...I],z=M.find(D=>D.id===e)??M[0],A=D=>`${w}-look-${D}`;function T(){m(Math.max(0,M.findIndex(D=>D.id===e))),g(!0)}function L(D){var re;g(!1),D&&((re=k.current)==null||re.focus())}function H(D){const re=M[D];re&&(L(!0),(re.id!==e||$c(re,n)!==n)&&f(re,$c(re,n)))}p.useLayoutEffect(()=>{var D;h&&((D=v.current)==null||D.focus())},[h]),p.useEffect(()=>{var D,re;h&&((re=(D=v.current)==null?void 0:D.querySelector(`[id="${CSS.escape(A(x))}"]`))==null||re.scrollIntoView({block:"nearest"}))},[h,x]),p.useEffect(()=>{if(!h)return;const D=re=>{var q;(q=j.current)!=null&&q.contains(re.target)||L(!1)};return document.addEventListener("pointerdown",D),()=>document.removeEventListener("pointerdown",D)},[h]);function P(){var te,be;const D=Array.from(((te=v.current)==null?void 0:te.querySelectorAll('[role="option"]'))??[]),re=(be=D[0])==null?void 0:be.offsetTop,q=D.filter(ne=>ne.offsetTop===re).length;return Math.max(1,q)}function U(D){const re=q=>{D.preventDefault(),D.stopPropagation(),m(te=>Math.min(M.length-1,Math.max(0,te+q)))};D.key==="ArrowRight"?re(1):D.key==="ArrowLeft"?re(-1):D.key==="ArrowDown"?re(P()):D.key==="ArrowUp"?re(-P()):D.key==="Home"?re(-M.length):D.key==="End"?re(M.length):D.key==="Enter"||D.key===" "?(D.preventDefault(),D.stopPropagation(),H(x)):D.key==="Escape"?(D.preventDefault(),D.stopPropagation(),L(!0)):D.key==="Tab"&&L(!1)}const K=(D,re,q)=>re.length>0&&t.jsxs("div",{className:"look-group",role:"group","aria-label":D,children:[t.jsx("div",{className:"look-group-head","aria-hidden":"true",children:D}),t.jsx("div",{className:"look-grid",children:re.map((te,be)=>{const ne=q+be;return t.jsxs("div",{id:A(ne),role:"option","aria-selected":te.id===e,className:`look-option${ne===x?" active":""}${te.id===e?" selected":""}`,"data-testid":`look-option-${te.id}`,onPointerEnter:()=>m(ne),onPointerDown:Be=>Be.preventDefault(),onClick:()=>H(ne),children:[t.jsx(Fw,{theme:te,html:l,pageCount:o,title:c,fontFamily:$c(te,n),radius:r,profile:s}),t.jsx("span",{className:"look-option-label",children:i(te.label)})]},te.id)})})]});return t.jsxs("div",{className:"sel look-picker",ref:j,title:i("主题"),children:[t.jsxs("button",{ref:k,type:"button",role:"combobox",className:h?"sel-trigger open":"sel-trigger","aria-label":i("主题"),"aria-haspopup":"listbox","aria-expanded":h,"aria-controls":h?w:void 0,"data-testid":"markdown-look-picker",onClick:()=>h?L(!1):T(),onKeyDown:D=>{h||["Enter"," ","ArrowDown","ArrowUp"].includes(D.key)&&(D.preventDefault(),T())},children:[t.jsxs("span",{className:"sel-content",children:[t.jsx("span",{className:"sel-swatch",style:{background:z.background},"aria-hidden":"true",children:t.jsx("span",{className:"sel-swatch-dot",style:{background:z.accent}})}),t.jsx("span",{className:"sel-value",children:i(z.label)})]}),t.jsx("svg",{className:"sel-caret",viewBox:"0 0 10 6",width:"10",height:"6","aria-hidden":!0,children:t.jsx("path",{d:"M1 1l4 4 4-4",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),h&&t.jsxs("div",{ref:v,id:w,className:"look-panel",role:"listbox",tabIndex:0,"aria-label":i("主题"),"aria-activedescendant":A(x),onKeyDown:U,children:[K(i("长文版式"),F,0),K(i("基础主题"),I,F.length)]})]})}const Cw=p.lazy(()=>Ed(()=>import("./MarkdownEditor-D1UaIr2y.js"),__vite__mapDeps([3,1,2])).then(e=>({default:e.MarkdownEditor}))),Ew=`# 图文切片快速上手
|
|
500
506
|
|
|
501
507
|
把长文粘贴到左侧编辑器,系统会自动切成适合社交媒体阅读的多张卡片。
|
|
502
508
|
|
|
@@ -523,24 +529,24 @@ ${Et.remote?i("只保存在这台设备上。登录后可以放进账号,换
|
|
|
523
529
|
|
|
524
530
|
完成后,点击右上角“打包下载”,即可导出所有卡片。`,Dc=`# 标题
|
|
525
531
|
|
|
526
|
-
写下第一段。内容超出一张卡片会自动分页,也可以单独一行输入 --- 手动分页。`,nl=3;function
|
|
532
|
+
写下第一段。内容超出一张卡片会自动分页,也可以单独一行输入 --- 手动分页。`,nl=3;function zw(e,n){return e instanceof Error&&e.message.trim()?i(e.message):n}function Rw({isActive:e,user:n,ownerId:r,transfer:s=null,requestAuth:l,chrome:o,request:c=null,onMetaChange:f}){var gt,ke,Nn;const[h,g]=p.useState(Ew),[x,m]=p.useState(pr[0].id),[j,k]=p.useState(m2[0].id),[v,w]=p.useState(ll[0].id),[N,F]=p.useState(18),[I,M]=p.useState(1),[z,A]=p.useState(Kn),[T,L]=p.useState(e),[H,P]=p.useState(!1),[U,K]=p.useState(!1),[D,re]=p.useState(!1),[q,te]=p.useState(!1),[be,ne]=p.useState(0),[Be,le]=p.useState(null),De=p.useRef(0),W=p.useRef(0),ae=p.useRef(()=>{}),[Se,ze]=p.useState(null),[ue,Ye]=p.useState(!1),[Ue,Ot]=p.useState(null),[Rt,oe]=p.useState(null),[he,Ae]=p.useState(null),Re=p.useRef(null),qe=p.useRef(null),Me=p.useRef(null),[Mt,Je]=p.useState(null),mt=p.useRef(r),Lt=p.useRef(s),_t=p.useRef(!1),lt=p.useRef(Se),pt=p.useRef(0);mt.current=r,Lt.current=s,lt.current=Se;const ee=xt(r??hn),He=p.useCallback(B=>{lt.current=B,ze(B)},[]),[ct,$t]=p.useState(!1),bt=p.useCallback(()=>{pt.current+=1,Ot(null),$t(!0)},[]),gn=pr.find(B=>B.id===x),xn=Ls(j),Dt=p.useMemo(()=>bl(gn,xn,v),[gn,xn,v]),Xn=p.useMemo(()=>cd(h),[h]),se=p.useMemo(()=>Qh(h),[h]),ve=p.useMemo(()=>a0(h),[h]),[ce,pe]=p.useState([{blocks:[],role:"article"}]),At=p.useCallback((B,Q,je)=>{Ae({title:B,detail:zw(Q,je),tone:"error"})},[]),ts=p.useCallback(B=>{At(i("图片资源续租失败"),B,i("暂时无法保护已上传图片,请稍后重试"))},[At]),qn=p.useCallback(B=>{At(i("Markdown 图片上传失败"),B,i("图片处理失败,请稍后重试"))},[At]),Js=rm(ve,r!==null&&ee.remote,ts),aa=p.useCallback(B=>xt(mt.current??hn).images.put(B),[]);p.useEffect(()=>{const B=requestAnimationFrame(()=>{pe(p2(se,Dt,z.headerFirstPageOnly))});return()=>cancelAnimationFrame(B)},[se,Dt,z.headerFirstPageOnly]);const gi=p.useRef(null),In=p.useCallback(B=>{g(B),bt()},[bt]),ia=p.useCallback((B,Q="",je="")=>{const Ie=gi.current;if(Ie){const xe=Ie.state.selection.main,rn=Ie.state.sliceDoc(xe.from,xe.to)||je,jn=B+rn+Q;Ie.dispatch({changes:{from:xe.from,to:xe.to,insert:jn},selection:{anchor:xe.from+B.length,head:xe.from+B.length+rn.length}}),Ie.focus()}else g(xe=>xe+`
|
|
527
533
|
|
|
528
|
-
`+
|
|
534
|
+
`+B+je+Q),bt()},[bt]),xi=p.useCallback(()=>{const B=gi.current;if(B){const Q=B.state.selection.main,je=`
|
|
529
535
|
|
|
530
536
|
---
|
|
531
537
|
|
|
532
|
-
`;
|
|
538
|
+
`;B.dispatch({changes:{from:Q.to,insert:je},selection:{anchor:Q.to+je.length}}),B.focus()}else g(Q=>Q+`
|
|
533
539
|
|
|
534
540
|
---
|
|
535
541
|
|
|
536
|
-
`),bt()},[bt]),Jt=
|
|
542
|
+
`),bt()},[bt]),Jt=am((B,Q,je)=>{He(B.id);const Ie=mt.current;Ie&&Fa(Ie,{mode:"markdown-card",markdownDraftId:B.id}),pt.current===je&&($t(!1),Ot(B.updatedAt))}),{schedule:ns,release:Ea,discard:sr}=Jt,za=Jt.flush;p.useEffect(()=>{e||za()},[za,e]),p.useEffect(()=>{var xe;const B=r,Q=qe.current;if(Q===B)return;qe.current=B,Ea(),Ot(null);const je=Me.current;if(Q!==null&&!li(Q)&&li(B)&&ct){Me.current={userId:Q,draftId:lt.current},Je(Q),He(null);return}if(Me.current=null,Je(null),B===null)return;if(je){if(je.userId===B){He(je.draftId);return}ns(hn,null,{mode:"markdown-card",...Rt?{title:Rt}:{},document:{source:h,platformId:x,themeId:j,fontFamily:v,profile:z,radius:N}},pt.current),Ea()}const Ie=lt.current?(xe=Lt.current)==null?void 0:xe.get(lt.current):void 0;if((Ie==null?void 0:Ie.mode)==="markdown-card"){en(Ie);return}if(Q===null&&!je){!ct&&!_t.current&&ca(B);return}_t.current=!1,bn(Dc,null),ca(B)},[r]),p.useEffect(()=>{!r||!ct||Me.current||ns(r,lt.current,{mode:"markdown-card",...Rt?{title:Rt}:{},document:{source:h,platformId:x,themeId:j,fontFamily:v,profile:z,radius:N}},pt.current)},[Rt,ct,v,r,Mt,x,z,N,ns,h,j]),p.useEffect(()=>{be>ce.length-1&&ne(Math.max(0,ce.length-1))},[ce.length,be]),p.useEffect(()=>{e||le(null)},[e]),p.useEffect(()=>{e&&L(!0)},[e]),p.useEffect(()=>{if(!Be)return;const B=()=>le(null);window.addEventListener("click",B),window.addEventListener("scroll",B,!0),window.addEventListener("resize",B);const Q=je=>je.key==="Escape"&&B();return window.addEventListener("keydown",Q),()=>{window.removeEventListener("click",B),window.removeEventListener("scroll",B,!0),window.removeEventListener("resize",B),window.removeEventListener("keydown",Q)}},[Be]);const sa={...Jh(Dt,N),"--preview-scale":String(I),"--preview-w":`${Dt.width*I}px`,"--preview-h":`${Dt.height*I}px`,"--preview-half-w":`${Dt.width*I/2}px`};async function oa(B){return ne(B),await new Promise(Q=>requestAnimationFrame(()=>requestAnimationFrame(Q))),Re.current}async function Ra(B,Q){const je=await oa(B);return je?b2(je,{pixelRatio:nl,width:Dt.width,height:Dt.height,fontEmbedCSS:Q,filter:Ie=>!(Ie instanceof HTMLElement&&Ie.classList.contains("img-handle"))}):null}async function or(B,Q){const je=await oa(B);if(!je)return null;const Ie=f0(await u0(je,{pixelRatio:nl,width:Dt.width,height:Dt.height,fontEmbedCSS:Q,filter:_e=>!(_e instanceof HTMLElement&&_e.classList.contains("img-handle"))})),xe=await new Promise(_e=>Ie.toBlob(_e,"image/jpeg",.92));return xe?q0(new Uint8Array(await xe.arrayBuffer()),Dt,Ie):null}function eo(B,Q){const je=document.createElement("a");je.href=B,je.download=`card-${Q+1}.png`,je.click()}async function Ia(){try{return await g2(x2(Dt.look,h,v))}catch{return}}async function rs(B){te(!0);const Q=be;try{const je=await Ia(),Ie=await Ra(B,je);Ie&&eo(Ie,B)}finally{ne(Q),te(!1)}}async function Ze(){if(ce.length===0)return;te(!0);const B=be;try{const Q=await Ia(),je=[];for(let Ie=0;Ie<ce.length;Ie++){const xe=await Ra(Ie,Q);xe&&je.push(xe)}if(je.length){const Ie=new Date().toISOString().slice(0,10);await ed(je,`cards-${Ie}.zip`)}}finally{ne(B),te(!1)}}async function to(){if(ce.length===0)return;te(!0);const B=be;try{const Q=await Ia(),je=[];for(let Ie=0;Ie<ce.length;Ie++){const xe=await or(Ie,Q);xe&&je.push(xe)}if(je.length>0){const Ie=new Date().toISOString().slice(0,10),xe=URL.createObjectURL(new Blob([Q0(je)],{type:"application/pdf"})),_e=document.createElement("a");_e.href=xe,_e.download=`cards-${Ie}.pdf`,_e.click(),setTimeout(()=>URL.revokeObjectURL(xe),1e3)}}catch(Q){At(i("导出 PDF 失败"),Q,i("导出失败,请稍后重试"))}finally{ne(B),te(!1)}}const[bi,Ar]=p.useState(!1),[lr,br]=p.useState(null),[zl,La]=p.useState(!1),[as,la]=p.useState(null),[Rl,yi]=p.useState(null),no=p.useRef(null),yr=bi&&lr?lr.id:null;p.useEffect(()=>{if(!yr||!r)return;let B=!1;const Q=r;return xt(Q).shares.list(Q).then(je=>{if(B)return;const Ie=je.find(xe=>xe.id===yr);Ie&&br(Ie)},()=>{}),()=>{B=!0}},[yr,r]);async function Ge(B){const Q=xt(r??hn);if(!Q.remote)return;te(!0),yi(null),la(null);const je=be;try{const Ie=await Ia(),xe=[];for(let jn=0;jn<ce.length;jn++){yi({current:jn+1,total:ce.length});const cr=await Ra(jn,Ie);cr&&xe.push(await Q.images.put(await ka(cr,2160)))}if(xe.length===0)throw new Error("no pages rendered");const _e=r??hn,rn=await Q.shares.create(_e,Ut,xe,B);no.current=io,br(rn)}catch{la(i("分享创建失败,请稍后重试"))}finally{ne(je),yi(null),te(!1)}}async function Il(B){const Q=r??hn;La(!0);try{await xt(Q).shares.revoke(Q,B.id),br(null),Ar(!1),Ae({title:i("分享已撤销,链接不再能打开"),detail:""})}catch(je){At(i("撤销分享失败,请稍后重试"),je,i("撤销分享失败,请稍后重试"))}finally{La(!1)}}function Qn(B){B.preventDefault(),le({x:B.clientX,y:B.clientY,index:be})}function ro(B){const Q=B.target;if(!Q.classList.contains("img-handle"))return;const je=Q.closest(".img-wrap");if(!je)return;B.preventDefault();const Ie=decodeURIComponent(je.dataset.href??""),xe=B.clientX,_e=je.getBoundingClientRect().width/I,rn=Dt.width-Dt.padding*2;je.classList.add("resizing");let jn=_e;const cr=dr=>{jn=Math.max(60,Math.min(rn,_e+(dr.clientX-xe)/I)),je.style.width=`${Math.round(jn)}px`},wi=()=>{window.removeEventListener("pointermove",cr),window.removeEventListener("pointerup",wi),je.classList.remove("resizing"),Ie&&(g(dr=>y2(dr,Ie,Math.round(jn))),bt())};window.addEventListener("pointermove",cr),window.addEventListener("pointerup",wi)}function $a(B){B.preventDefault(),B.stopPropagation();const Q=B.currentTarget.dataset.corner??"br",je=B.currentTarget.closest(".card-frame");if(!je)return;const Ie={tl:[1,1],tr:[-1,1],bl:[1,-1],br:[-1,-1]},[xe,_e]=Ie[Q],rn=B.clientX,jn=B.clientY,cr=N,wi=Math.round(Math.min(Dt.width,Dt.height)/2);je.classList.add("rounding");let dr=cr;const oo=ss=>{const dt=((ss.clientX-rn)*xe+(ss.clientY-jn)*_e)/I;dr=Math.max(0,Math.min(wi,Math.round(cr+dt))),je.style.setProperty("--card-radius",`${dr}px`)},jr=()=>{window.removeEventListener("pointermove",oo),window.removeEventListener("pointerup",jr),je.classList.remove("rounding"),je.style.removeProperty("--card-radius"),dr!==N&&(F(dr),bt())};window.addEventListener("pointermove",oo),window.addEventListener("pointerup",jr)}function ji(B,Q){if(Ea(),pt.current+=1,De.current+=1,Me.current=null,Je(null),B){if(B.images)for(const[je,Ie]of Object.entries(B.images))ee.images.register(je,Ie);g(B.source),m(B.platformId),k(Ls(B.themeId).id),w(B.fontFamily),A(B.profile),F(B.radius)}He((Q==null?void 0:Q.id)??null),Ot((Q==null?void 0:Q.updatedAt)??null),oe(Q&&B&&Q.title!==gf(B.source)?Q.title:null),$t(!1),ne(0),K(!1)}function bn(B,Q){ji(null,null),g(B),Q&&pr.some(je=>je.id===Q)&&m(Q)}function en(B){if(B.mode!=="markdown-card")return;ji(B.document,B);const Q=mt.current;Q&&Fa(Q,{mode:"markdown-card",markdownDraftId:B.id})}ae.current=en;function ca(B){const Q=Qs(B).markdownDraftId;if(!Q)return;const je=++De.current;xt(B).drafts.list(B).then(Ie=>{if(mt.current!==B||De.current!==je)return;const xe=Ie.find(_e=>_e.id===Q&&_e.mode==="markdown-card");xe&&ae.current(xe)},()=>{})}function is(B){oe(B),bt()}function ao(B){var je;if(B.workspace!=="markdown")return;const Q=(je=B.createMarkdown)==null?void 0:je.call(B);Q&&ji(Q,null)}function Ll(B){var je;const Q=B.workspace==="markdown"?(je=B.createMarkdown)==null?void 0:je.call(B):null;Q&&(k(Ls(Q.themeId).id),w(Q.fontFamily),F(Q.radius),bt(),K(!1))}const Jn=gf(h),Ut=Rt??(Jn==="未命名草稿"?i("未命名"):Jn),io=JSON.stringify({source:h,platformId:x,themeId:j,fontFamily:v,radius:N,profile:z}),Pr=ct&&(r===null||Mt!==null||Jt.status==="error");p.useEffect(()=>{f==null||f({title:Ut,draftId:Se,unsaved:Pr})},[Ut,Se,Pr,f]);const yn=Mt?{kind:"signed-out"}:r===null?{kind:"none"}:Jt.status==="error"?{kind:"error",message:Jt.error??""}:ct||Jt.status==="saving"?{kind:"saving"}:Se?{kind:"saved",at:Ue??Date.now(),onDevice:li(r)}:{kind:"none"};async function so(B){if(r){De.current+=1;try{const Q=`})`,je=gi.current;if(je){const{from:Ie,to:xe}=je.state.selection.main,rn=`${Ie>0&&je.state.doc.sliceString(Ie-1,Ie)!==`
|
|
537
543
|
`?`
|
|
538
544
|
`:""}${Q}
|
|
539
545
|
`;je.dispatch({changes:{from:Ie,to:xe,insert:rn},selection:{anchor:Ie+rn.length},scrollIntoView:!0}),je.focus()}else g(Ie=>`${Ie}
|
|
540
546
|
|
|
541
547
|
${Q}
|
|
542
|
-
`),bt()}catch(Q){
|
|
548
|
+
`),bt()}catch(Q){At(i("图片插入失败"),Q,i("暂时无法插入这张图片,请稍后重试"))}}}return p.useEffect(()=>{if(!(!c||W.current===c.nonce)&&!(c.kind==="open"&&!r)){if(W.current=c.nonce,c.kind==="removed"||c.kind==="renamed"){if(lt.current!==c.draftId)return;if(c.kind==="renamed"){oe(c.title);return}sr(),bn(Dc,null);return}if(c.kind!=="import"){if(De.current+=1,_t.current=!0,c.kind==="new")bn(Dc,c.platformId);else if(c.kind==="template")ao(c.template);else if(r&<.current!==c.draftId){const B=r,Q=c.draftId,je=De.current;xt(B).drafts.list(B).then(Ie=>{if(mt.current!==B||De.current!==je)return;const xe=Ie.find(_e=>_e.id===Q&&_e.mode==="markdown-card");xe?en(xe):Ae({title:i("没有找到这个项目"),detail:i("它可能已经被删除了"),tone:"error"})},Ie=>At(i("项目打开失败"),Ie,i("暂时无法读取项目,请稍后重试")))}}}},[c,r]),t.jsxs("div",{className:"app",children:[e&&t.jsx(em,{chrome:o,user:n,requestAuth:l,system:"markdown-card",title:Ut,onRename:is,save:yn,onRetrySave:()=>void Jt.flush(),actions:ee.remote&&Se?t.jsxs("button",{className:"bar-btn",type:"button","data-testid":"draft-history",onClick:()=>Ye(!0),children:[t.jsx(N0,{}),i("历史版本")]}):void 0,primary:t.jsxs(t.Fragment,{children:[ee.remote&&t.jsxs("button",{className:"bar-btn",type:"button","data-testid":"markdown-share",onClick:()=>{la(null),Ar(!0)},disabled:q,children:[t.jsx(x0,{}),i("分享链接")]}),t.jsxs("button",{className:"bar-btn",type:"button","data-testid":"markdown-export-pdf","aria-label":i("导出 PDF"),onClick:to,disabled:q,children:[t.jsx(di,{}),i("导出 PDF")]}),t.jsxs("button",{className:"toolbar-primary editor-primary",type:"button","aria-label":q?i("导出中…"):i("打包下载 {n} 页",{n:ce.length}),onClick:Ze,disabled:q,children:[t.jsx(di,{}),t.jsx("span",{className:"editor-primary-label",children:q?i("导出中…"):i("打包下载 {n} 页",{n:ce.length})})]})]})}),t.jsxs(tm,{testId:"markdown-toolbar",label:i("Markdown 卡片工具栏"),className:"markdown-toolbar",children:[t.jsxs(td,{children:[t.jsxs("button",{className:"bar-btn","data-testid":"markdown-template-button",onClick:()=>K(!0),children:[t.jsx(Gi,{}),i("模板")]}),t.jsx(pl,{}),t.jsx("div",{className:"seg",role:"tablist","aria-label":i("平台"),children:pr.map(B=>t.jsx("button",{className:B.id===x?"seg-btn on":"seg-btn",onClick:()=>{B.id!==x&&(m(B.id),bt())},children:i(B.label)},B.id))}),t.jsx(Mw,{themeId:j,fontFamily:v,radius:N,profile:z,firstPageHtml:(((gt=ce[0])==null?void 0:gt.blocks)??[]).map(B=>B.html).join(""),pageCount:ce.length,title:Xn,onPick:(B,Q)=>{k(B.id),w(Q),bt()}}),t.jsx(Qr,{value:v,onChange:B=>{B!==v&&(w(B),bt())},title:i("字体"),previewFonts:!0,options:ll.map(B=>({id:B.id,label:i(B.label)}))}),t.jsx(pl,{}),t.jsxs("button",{className:"bar-btn",onClick:()=>P(!0),title:i("卡片署名:头像、昵称、账号"),children:[t.jsx(X2,{}),i("个人资料")]})]}),t.jsx(td,{side:"right",children:t.jsxs("button",{className:"bar-btn",type:"button","data-testid":"editor-assets","aria-pressed":D,title:i("素材库:插入常用图片"),onClick:()=>re(B=>!B),children:[t.jsx(Gs,{}),i("素材库")]})})]}),he&&t.jsx(Ml,{title:he.title,detail:he.detail,tone:he.tone,onDismiss:()=>Ae(null)}),t.jsxs("div",{className:"body",children:[t.jsxs("section",{className:"pane pane-editor",children:[t.jsxs("div",{className:"pane-head",children:[t.jsxs("div",{className:"md-format",role:"toolbar","aria-label":i("Markdown 格式"),children:[t.jsx("button",{type:"button",className:"md-format-btn","aria-label":i("一级标题"),title:i("一级标题"),onClick:()=>ia("# ",`
|
|
543
549
|
`,i("大标题")),children:"H1"}),t.jsx("button",{type:"button",className:"md-format-btn","aria-label":i("二级标题"),title:i("二级标题"),onClick:()=>ia("## ",`
|
|
544
550
|
`,i("小标题")),children:"H2"}),t.jsx("span",{className:"md-format-sep","aria-hidden":"true"}),t.jsx("button",{type:"button",className:"md-format-btn","aria-label":i("加粗"),title:i("加粗"),onClick:()=>ia("**","**",i("重点文字")),children:t.jsx(L2,{})}),t.jsx("button",{type:"button",className:"md-format-btn","aria-label":i("斜体"),title:i("斜体"),onClick:()=>ia("*","*",i("斜体文字")),children:t.jsx($2,{})}),t.jsx("span",{className:"md-format-sep","aria-hidden":"true"}),t.jsx("button",{type:"button",className:"md-format-btn","aria-label":i("引用"),title:i("引用"),onClick:()=>ia("> ",`
|
|
545
551
|
`,i("引用金句或核心观点")),children:t.jsx(D2,{})}),t.jsx("button",{type:"button",className:"md-format-btn","aria-label":i("列表"),title:i("列表"),onClick:()=>ia("- ",`
|
|
546
|
-
`,i("列表要点")),children:t.jsx(A2,{})}),t.jsx("span",{className:"md-format-sep","aria-hidden":"true"}),t.jsxs("button",{type:"button",className:"md-format-btn md-format-btn--label",title:i("插入分页(---)"),onClick:pi,children:[t.jsx(P2,{}),i("分页")]})]}),t.jsx("span",{className:"pane-sub",children:i("{chars} 字 · {pages} 页",{chars:h.length,pages:ce.length})})]}),T?t.jsx(p.Suspense,{fallback:t.jsx("div",{className:"cm-host","aria-hidden":"true"}),children:t.jsx(v8,{value:h,onChange:In,fontFamily:$t.fontFamily,putImage:aa,beforeImageUpload:ee.remote?Js:void 0,onImageError:Xn,onViewReady:_=>{mi.current=_}})}):t.jsx("div",{className:"cm-host","aria-hidden":"true"})]}),t.jsxs("section",{className:"pane pane-preview",style:sa,children:[t.jsxs("div",{className:"pane-head",children:[t.jsxs("div",{className:"md-preview-meta",children:[t.jsx("span",{className:"md-preview-title",children:i("预览")}),t.jsxs("span",{className:"md-preview-spec",children:[i(gn.label)," · ",$t.width*nl," × ",$t.height*nl]})]}),t.jsxs("div",{className:"zoom-controls","aria-label":i("预览缩放"),children:[t.jsx("button",{type:"button",className:"zoom-btn","aria-label":i("缩小预览"),title:i("缩小预览"),onClick:()=>F(_=>Math.max(.75,Number((_-.1).toFixed(2)))),disabled:I<=.75,children:t.jsx(bm,{})}),t.jsxs("button",{type:"button",className:"zoom-value",title:i("恢复 100%"),onClick:()=>F(1),children:[Math.round(I*100),"%"]}),t.jsx("button",{type:"button",className:"zoom-btn","aria-label":i("放大预览"),title:i("放大预览"),onClick:()=>F(_=>Math.min(1.75,Number((_+.1).toFixed(2)))),disabled:I>=1.75,children:t.jsx(fl,{})})]})]}),t.jsx("div",{className:"stage-wrap",children:t.jsx("div",{className:"stage",children:t.jsx("div",{className:"card-zoom-box",children:t.jsxs("div",{className:"card-frame",onContextMenu:qn,onPointerDown:ro,children:[t.jsx(yl,{ref:ze,config:$t,profile:z,pageIndex:be,pageCount:ce.length,pageRole:((we=ce[be])==null?void 0:we.role)??"article",showHeader:!z.headerFirstPageOnly||be===0,html:(((Nn=ce[be])==null?void 0:Nn.blocks)??[]).map(_=>_.html).join(""),title:Zn}),["tl","tr","bl","br"].map(_=>t.jsx("span",{className:`corner-handle corner-${_}`,"data-corner":_,onPointerDown:La},_))]})})})}),t.jsxs("div",{className:"md-dock-row",children:[t.jsxs("div",{className:"md-dock",children:[t.jsx("button",{type:"button",className:"md-dock-btn","aria-label":i("上一页"),title:i("上一页"),onClick:()=>ne(_=>Math.max(0,_-1)),disabled:be===0,children:t.jsx(Qi,{})}),t.jsx("div",{className:"pager",role:"group","aria-label":i("页码"),children:ce.map((_,Q)=>t.jsx("button",{type:"button",className:Q===be?"page-dot active":"page-dot","aria-current":Q===be?"page":void 0,title:i("第 {n} 页",{n:Q+1}),onClick:()=>ne(Q),children:Q+1},Q))}),t.jsx("button",{type:"button",className:"md-dock-btn","aria-label":i("下一页"),title:i("下一页"),onClick:()=>ne(_=>Math.min(ce.length-1,_+1)),disabled:be>=ce.length-1,children:t.jsx(gm,{})}),t.jsx("span",{className:"md-dock-sep","aria-hidden":"true"}),t.jsxs("button",{type:"button",className:"md-dock-action",title:i("导出当前页为 PNG"),onClick:()=>rs(be),disabled:q,children:[t.jsx(li,{}),i("导出本页")]})]}),t.jsx("div",{className:"pager-hint",children:i("右键卡片导出单页 · 拖动卡片四角调整圆角 · 拖动图片右下角调整宽度")})]})]})]}),Be&&t.jsxs("div",{className:"ctx-menu",style:{left:Be.x,top:Be.y},onClick:_=>_.stopPropagation(),children:[t.jsx("button",{className:"ctx-item",onClick:()=>{const _=Be.index;le(null),rs(_)},children:i("导出第 {n} 页 PNG",{n:Be.index+1})}),t.jsx("button",{className:"ctx-item",onClick:()=>{le(null),Ze()},children:i("打包下载全部 {n} 页",{n:ce.length})}),t.jsx("button",{className:"ctx-item",onClick:()=>{le(null),to()},children:i("导出全部 {n} 页 PDF",{n:ce.length})})]}),ue&&r&&ke&&t.jsx(x0,{ownerId:r,draftId:ke,onRestored:_=>{Ye(!1),en(_)},onClose:()=>Ye(!1)}),gi&&t.jsx(g0,{share:or&&no.current===io&&or.expiresAt>Date.now()?or:null,creating:q,progress:Rl,slideCount:ce.length,revoking:zl,error:as,onCreate:_=>void Ge(_),onRevoke:()=>or&&void Il(or),onClose:()=>{q||Dr(!1)}}),H&&t.jsx(j8,{profile:z,onClose:()=>P(!1),onSave:_=>{A(_),bt(),P(!1)}}),D&&e&&t.jsx(i6,{ownerId:r,system:"markdown-card",onInsert:_=>void so(_),onManage:()=>Rt(ft.assets),onClose:()=>re(!1)}),t.jsx(s0,{open:U,workspace:"markdown",hasCurrentContent:ke!==null||pt.current>0,currentIsSaved:r!==null&&!Ar,onClose:()=>K(!1),onApply:ao,onApplyLook:Ll})]})}const Fs=xt(hn),C8="button,a,input,select,textarea,[tabindex]";function E8(e){if(!(e!=null&&e.isConnected)||e.tabIndex<0||e.matches(':disabled, [aria-disabled="true"]')||e.closest('[inert], [hidden], [aria-hidden="true"]'))return!1;const n=window.getComputedStyle(e);return e.getClientRects().length>0&&n.display!=="none"&&n.visibility==="visible"}function Cs(e){return E8(e)?(e.focus(),document.activeElement===e):!1}const Uh={title:"",draftId:null,unsaved:!1};function Yh(e,n){return e.title===n.title&&e.draftId===n.draftId&&e.unsaved===n.unsaved}function Ac(e,n){return e instanceof Error&&e.message.trim()?i(e.message):n}function z8(){var $t,Zn;na();const e=R2(),[n,r]=p.useState(()=>e.name==="edit"&&e.system||"markdown-card"),[s,l]=y8(),[o,c]=p.useState(null),[f,h]=p.useState(!1),[g,x]=p.useState(!1),[m,j]=p.useState("checking"),[k,v]=p.useState(null),[w,N]=p.useState(null),M=p.useRef(w);M.current=w;const[I,F]=p.useState({projects:0,assets:0}),[z,A]=p.useState(0),[T,L]=p.useState(null),H=p.useRef(0),P=p.useRef(null),U=p.useRef(null),K=p.useRef(!1),D=p.useRef(!1),re=p.useRef(null),q=p.useRef(0),[te,be]=p.useState(v2),[ne,Be]=p.useState({"markdown-card":null,"freeform-slide":null}),le=p.useRef(0),[De,W]=p.useState({"markdown-card":Uh,"freeform-slide":Uh}),ae=e.name==="edit"&&e.system!==null,[ke,Ee]=p.useState(()=>({"markdown-card":e.name==="edit"&&e.system==="markdown-card","freeform-slide":e.name==="edit"&&e.system==="freeform-slide"})),ue=p.useRef(o);ue.current=o;const Ye=o?o.id:f?hn:null,Ue=p.useRef(Ye);Ue.current=Ye;const Ot=p.useRef(e);Ot.current=e;const zt=p.useRef(n);zt.current=n;const oe=e.name==="edit"?e.system:null,fe=oe??n,Ae=se=>ke[se]||oe===se,ze=p.useCallback(se=>{N2(se),be(se)},[]),Xe=p.useCallback((se,ve)=>{const ce=++le.current;Be(me=>({...me,[se]:{...ve,nonce:ce}}))},[]),Fe=p.useCallback(se=>{W(ve=>Yh(ve["markdown-card"],se)?ve:{...ve,"markdown-card":se})},[]),Mt=p.useCallback(se=>{W(ve=>Yh(ve["freeform-slide"],se)?ve:{...ve,"freeform-slide":se})},[]);p.useEffect(()=>{if(e.name==="login"&&ue.current){Rt(ft.home,{replace:!0});return}if(e.name!=="edit")return;const se=e.system;if(!se){const ce=Ue.current?Qs(Ue.current).mode:zt.current;Rt(ft.editor(ce),{replace:!0});return}r(se),Ee(ce=>ce[se]?ce:{...ce,[se]:!0}),Ue.current&&Na(Ue.current,{mode:se});const ve=e.intent;if(ve){if(ve.kind==="open")Xe(se,{kind:"open",draftId:ve.draftId});else if(ve.kind==="new")Xe(se,{kind:"new",platformId:ve.platformId,width:ve.width,height:ve.height});else if(ve.kind==="import")Xe(se,{kind:"import",url:ve.url,title:ve.title});else{const ce=_y(se,ve.templateId);ce&&Xe(se,{kind:"template",template:ce})}Rt(ft.editor(se),{replace:!0})}},[e,Xe]),p.useEffect(()=>{f&&!o&&e.name==="edit"&&!te&&ze(!0)},[te,e.name,f,ze,o]),p.useEffect(()=>{o&&ze(!1)},[ze,o]),p.useEffect(()=>{const se=()=>void Ko();return window.addEventListener("pagehide",se),()=>window.removeEventListener("pagehide",se)},[]);const Qe=p.useCallback(se=>{const ve=se.target,ce=ve instanceof Element?ve.closest(C8):null;if(!ce||!se.currentTarget.contains(ce))return;const me=++q.current;re.current=ce,window.setTimeout(()=>{q.current===me&&(re.current=null)},0)},[]),mt=p.useCallback(()=>{const se=re.current;if(re.current=null,D.current)return;D.current=!0;const ve=document.activeElement;U.current=se!=null&&se.isConnected?se:ve instanceof HTMLElement&&ve.isConnected?ve:null,x(!0)},[]);p.useLayoutEffect(()=>{if(!g)return;const se=P.current;if(!se)return;const ve=Array.from(se.children).filter(ce=>ce instanceof HTMLElement&&!ce.classList.contains("sheet-backdrop")).map(ce=>({element:ce,inert:ce.getAttribute("inert"),ariaHidden:ce.getAttribute("aria-hidden")}));for(const{element:ce}of ve)ce.setAttribute("inert",""),ce.setAttribute("aria-hidden","true");return()=>{for(const{element:ce,inert:me,ariaHidden:Dt}of ve)me===null?ce.removeAttribute("inert"):ce.setAttribute("inert",me),Dt===null?ce.removeAttribute("aria-hidden"):ce.setAttribute("aria-hidden",Dt)}},[g,T]),p.useLayoutEffect(()=>{const se=K.current;if(K.current=g,!se||g)return;D.current=!1;const ve=U.current;if(U.current=null,Cs(ve))return;const ce=P.current,me=(ce==null?void 0:ce.querySelector('[data-testid="account-login"], [data-testid="account-menu"], [data-testid="account-status-retry"]'))??null;Cs(me)||Cs((ce==null?void 0:ce.querySelector('[data-testid="editor-home"], [data-testid="open-palette"]'))??null)},[g]);const It=p.useRef(!1);p.useLayoutEffect(()=>{const se=It.current;if(It.current=w!==null,!se||w)return;const ve=document.activeElement;if(ve instanceof HTMLElement&&ve!==document.body&&ve.isConnected)return;const ce=P.current;Cs((ce==null?void 0:ce.querySelector('[data-testid="account-menu"]'))??null)||Cs((ce==null?void 0:ce.querySelector('[data-testid="editor-home"], [data-testid="open-palette"]'))??null)},[w]);const _t=p.useCallback(async()=>{const se=++H.current;j("checking");try{const ve=await Et.auth.current();if(se!==H.current)return;c(ve),h(!0),j("ready"),L(null)}catch(ve){if(se!==H.current)return;h(!0),j("error"),L({title:i("登录状态尚未确认"),detail:Ac(ve,i("暂时无法连接服务器,请稍后重试")),retry:!0})}},[]);p.useEffect(()=>{const se=Et.auth.onInvalidated(()=>{H.current+=1,c(null),h(!0),v(null),j("ready"),x(!1),L({title:i("登录已过期,请重新登录"),retry:!1})});return _t(),()=>{H.current+=1,se()}},[_t]),p.useEffect(()=>{Ye&&ae&&Na(Ye,{mode:fe})},[fe,ae,Ye]),p.useEffect(()=>{if(!o){F({projects:0,assets:0});return}let se=!1;return zs(Fs,hn).then(ve=>{se||F({projects:ve.projects.length,assets:ve.assets.length})},()=>{}),()=>{se=!0}},[o,z]);async function lt(){const se=++H.current;try{return await Ko(),await Et.auth.logout(),se!==H.current?!1:(c(null),v(null),j("ready"),L(null),!0)}catch(ve){return se!==H.current||L({title:i("退出登录失败"),detail:Ac(ve,i("请稍后重试")),retry:!1}),!1}}const pt=p.useRef(lt);pt.current=lt;function ee(se,ve){H.current+=1,v(ve&&ve.size>0?ve:null),c(se),h(!0),j("ready"),L(null),ze(!1),Ot.current.name==="login"&&Rt(ft.home,{replace:!0})}async function He(se){const ve=++H.current;let ce=null;try{await Ko();const me=await zs(Fs,hn);Kf(me)>0&&t6(me)>M2(se.id)&&(ce={user:se,projects:me.projects.length,assets:me.assets.length,signingIn:!0,phase:{kind:"ask"},moved:new Map})}catch{}ve===H.current&&(x(!1),ce?N(ce):ee(se,null))}async function ct(){const se=M.current;if(!se||se.phase.kind==="moving")return;const ve=se.user.id;N({...se,phase:{kind:"moving",done:0,total:se.projects+se.assets}});let ce;try{await Ko(),ce=await a6({from:Fs,fromId:hn,to:Et,toId:ve,onProgress:(Dt,ts)=>N(Xn=>(Xn==null?void 0:Xn.user.id)===ve?{...Xn,phase:{kind:"moving",done:Dt,total:ts}}:Xn)})}catch(Dt){ce={moved:new Map,movedAssets:0,failed:se.projects+se.assets,error:Dt}}const me=new Map([...se.moved,...ce.moved]);if(A(Dt=>Dt+1),ce.failed>0){const Dt=await zs(Fs,hn).catch(()=>null);N({...se,moved:me,projects:(Dt==null?void 0:Dt.projects.length)??se.projects,assets:(Dt==null?void 0:Dt.assets.length)??se.assets,phase:{kind:"failed",failed:ce.failed,message:Ac(ce.error,i("请稍后重试"))}});return}N(null),se.signingIn&&ee(se.user,me)}function Lt(){const se=M.current;!se||se.phase.kind==="moving"||(F2(se.user.id,Date.now()),N(null),se.signingIn&&ee(se.user,se.moved))}function bt(){const se=ue.current;!se||M.current||zs(Fs,hn).then(ve=>{var ce;Kf(ve)===0||((ce=ue.current)==null?void 0:ce.id)!==se.id||N({user:se,projects:ve.projects.length,assets:ve.assets.length,signingIn:!1,phase:{kind:"ask"},moved:new Map})},()=>{})}const gn=p.useMemo(()=>({theme:s,authStatus:m,onHome:()=>Rt(ft.home),onToggleTheme:l,onRetryAuth:()=>void _t(),onLogout:()=>void pt.current()}),[s,m,_t,l]),xn=ae?"editor":e.name==="login"?o?"workbench":"login":o||te?"workbench":m==="checking"?"splash":"login";return t.jsxs("div",{ref:P,className:"app-shell","data-workspace":fe,"data-view":xn,onClickCapture:Qe,children:[xn==="splash"&&t.jsx("div",{className:"app-splash","aria-label":i("正在加载"),children:t.jsx("img",{src:vl,alt:"",width:"40",height:"40"})}),xn==="login"&&t.jsx(Hy,{onAuthed:se=>void He(se),onGuest:()=>ze(!0)}),xn==="workbench"&&e.name!=="edit"&&e.name!=="login"&&t.jsx(rl,{scope:"page",resetKey:e,children:t.jsx(e6,{route:e,user:o,ownerId:Ye,guestLeft:I,dataVersion:z,onMoveGuestWork:bt,theme:s,onToggleTheme:l,onLogout:()=>{lt().then(se=>{se&&ze(!1)})},editorMeta:De,onProjectRemoved:(se,ve)=>Xe(se,{kind:"removed",draftId:ve}),onProjectRenamed:(se,ve,ce)=>Xe(se,{kind:"renamed",draftId:ve,title:ce})})}),(Ae("markdown-card")||Ae("freeform-slide"))&&t.jsxs("div",{className:"editor-frame",hidden:xn!=="editor",children:[Ae("markdown-card")&&t.jsx("div",{id:"workspace-panel-markdown",className:"workspace-panel","data-testid":"workspace-markdown",hidden:fe!=="markdown-card",children:t.jsx(rl,{scope:"editor",resetKey:($t=ne["markdown-card"])==null?void 0:$t.nonce,children:t.jsx(F8,{isActive:xn==="editor"&&fe==="markdown-card",user:o,ownerId:Ye,transfer:k,requestAuth:mt,chrome:gn,request:ne["markdown-card"],onMetaChange:Fe})})}),Ae("freeform-slide")&&t.jsx("div",{id:"workspace-panel-freeform",className:"workspace-panel","data-testid":"workspace-freeform",hidden:fe!=="freeform-slide",children:t.jsx(rl,{scope:"editor",resetKey:(Zn=ne["freeform-slide"])==null?void 0:Zn.nonce,children:t.jsx(x8,{isActive:xn==="editor"&&fe==="freeform-slide",user:o,ownerId:Ye,transfer:k,requestAuth:mt,chrome:gn,request:ne["freeform-slide"],onMetaChange:Mt})})})]}),T&&t.jsx(Fl,{className:"operation-notice--global",tone:"error",title:T.title,detail:T.detail,onDismiss:()=>L(null),onRetry:T.retry?()=>void _t():void 0}),g&&t.jsx(S2,{onClose:()=>x(!1),onAuthed:se=>void He(se)}),w&&t.jsx(nx,{username:w.user.username,projects:w.projects,assets:w.assets,phase:w.phase,onMove:()=>void ct(),onKeep:Lt})]})}function R8(){return t.jsx(z8,{})}kl.load();j2.createRoot(document.getElementById("root")).render(t.jsx(w2.StrictMode,{children:t.jsx(rl,{scope:"page",fullPage:!0,children:t.jsx(R8,{})})}));
|
|
552
|
+
`,i("列表要点")),children:t.jsx(A2,{})}),t.jsx("span",{className:"md-format-sep","aria-hidden":"true"}),t.jsxs("button",{type:"button",className:"md-format-btn md-format-btn--label",title:i("插入分页(---)"),onClick:xi,children:[t.jsx(P2,{}),i("分页")]})]}),t.jsx("span",{className:"pane-sub",children:i("{chars} 字 · {pages} 页",{chars:h.length,pages:ce.length})})]}),T?t.jsx(p.Suspense,{fallback:t.jsx("div",{className:"cm-host","aria-hidden":"true"}),children:t.jsx(Cw,{value:h,onChange:In,fontFamily:Dt.fontFamily,putImage:aa,beforeImageUpload:ee.remote?Js:void 0,onImageError:qn,onViewReady:B=>{gi.current=B}})}):t.jsx("div",{className:"cm-host","aria-hidden":"true"})]}),t.jsxs("section",{className:"pane pane-preview",style:sa,children:[t.jsxs("div",{className:"pane-head",children:[t.jsxs("div",{className:"md-preview-meta",children:[t.jsx("span",{className:"md-preview-title",children:i("预览")}),t.jsxs("span",{className:"md-preview-spec",children:[i(gn.label)," · ",Dt.width*nl," × ",Dt.height*nl]})]}),t.jsxs("div",{className:"zoom-controls","aria-label":i("预览缩放"),children:[t.jsx("button",{type:"button",className:"zoom-btn","aria-label":i("缩小预览"),title:i("缩小预览"),onClick:()=>M(B=>Math.max(.75,Number((B-.1).toFixed(2)))),disabled:I<=.75,children:t.jsx(b0,{})}),t.jsxs("button",{type:"button",className:"zoom-value",title:i("恢复 100%"),onClick:()=>M(1),children:[Math.round(I*100),"%"]}),t.jsx("button",{type:"button",className:"zoom-btn","aria-label":i("放大预览"),title:i("放大预览"),onClick:()=>M(B=>Math.min(1.75,Number((B+.1).toFixed(2)))),disabled:I>=1.75,children:t.jsx(fl,{})})]})]}),t.jsx("div",{className:"stage-wrap",children:t.jsx("div",{className:"stage",children:t.jsx("div",{className:"card-zoom-box",children:t.jsxs("div",{className:"card-frame",onContextMenu:Qn,onPointerDown:ro,children:[t.jsx(yl,{ref:Re,config:Dt,profile:z,pageIndex:be,pageCount:ce.length,pageRole:((ke=ce[be])==null?void 0:ke.role)??"article",showHeader:!z.headerFirstPageOnly||be===0,html:(((Nn=ce[be])==null?void 0:Nn.blocks)??[]).map(B=>B.html).join(""),title:Xn}),["tl","tr","bl","br"].map(B=>t.jsx("span",{className:`corner-handle corner-${B}`,"data-corner":B,onPointerDown:$a},B))]})})})}),t.jsxs("div",{className:"md-dock-row",children:[t.jsxs("div",{className:"md-dock",children:[t.jsx("button",{type:"button",className:"md-dock-btn","aria-label":i("上一页"),title:i("上一页"),onClick:()=>ne(B=>Math.max(0,B-1)),disabled:be===0,children:t.jsx(Qi,{})}),t.jsx("div",{className:"pager",role:"group","aria-label":i("页码"),children:ce.map((B,Q)=>t.jsx("button",{type:"button",className:Q===be?"page-dot active":"page-dot","aria-current":Q===be?"page":void 0,title:i("第 {n} 页",{n:Q+1}),onClick:()=>ne(Q),children:Q+1},Q))}),t.jsx("button",{type:"button",className:"md-dock-btn","aria-label":i("下一页"),title:i("下一页"),onClick:()=>ne(B=>Math.min(ce.length-1,B+1)),disabled:be>=ce.length-1,children:t.jsx(g0,{})}),t.jsx("span",{className:"md-dock-sep","aria-hidden":"true"}),t.jsxs("button",{type:"button",className:"md-dock-action",title:i("导出当前页为 PNG"),onClick:()=>rs(be),disabled:q,children:[t.jsx(di,{}),i("导出本页")]})]}),t.jsx("div",{className:"pager-hint",children:i("右键卡片导出单页 · 拖动卡片四角调整圆角 · 拖动图片右下角调整宽度")})]})]})]}),Be&&t.jsxs("div",{className:"ctx-menu",style:{left:Be.x,top:Be.y},onClick:B=>B.stopPropagation(),children:[t.jsx("button",{className:"ctx-item",onClick:()=>{const B=Be.index;le(null),rs(B)},children:i("导出第 {n} 页 PNG",{n:Be.index+1})}),t.jsx("button",{className:"ctx-item",onClick:()=>{le(null),Ze()},children:i("打包下载全部 {n} 页",{n:ce.length})}),t.jsx("button",{className:"ctx-item",onClick:()=>{le(null),to()},children:i("导出全部 {n} 页 PDF",{n:ce.length})})]}),ue&&r&&Se&&t.jsx(xm,{ownerId:r,draftId:Se,onRestored:B=>{Ye(!1),en(B)},onClose:()=>Ye(!1)}),bi&&t.jsx(gm,{share:lr&&no.current===io&&lr.expiresAt>Date.now()?lr:null,creating:q,progress:Rl,slideCount:ce.length,revoking:zl,error:as,onCreate:B=>void Ge(B),onRevoke:()=>lr&&void Il(lr),onClose:()=>{q||Ar(!1)}}),H&&t.jsx(vw,{profile:z,onClose:()=>P(!1),onSave:B=>{A(B),bt(),P(!1)}}),D&&e&&t.jsx(c6,{ownerId:r,system:"markdown-card",onInsert:B=>void so(B),onManage:()=>It(ht.assets),onClose:()=>re(!1)}),t.jsx(sm,{open:U,workspace:"markdown",hasCurrentContent:Se!==null||pt.current>0,currentIsSaved:r!==null&&!Pr,onClose:()=>K(!1),onApply:ao,onApplyLook:Ll})]})}const Ms=xt(hn),Iw="button,a,input,select,textarea,[tabindex]";function Lw(e){if(!(e!=null&&e.isConnected)||e.tabIndex<0||e.matches(':disabled, [aria-disabled="true"]')||e.closest('[inert], [hidden], [aria-hidden="true"]'))return!1;const n=window.getComputedStyle(e);return e.getClientRects().length>0&&n.display!=="none"&&n.visibility==="visible"}function Cs(e){return Lw(e)?(e.focus(),document.activeElement===e):!1}const Uh={title:"",draftId:null,unsaved:!1};function Yh(e,n){return e.title===n.title&&e.draftId===n.draftId&&e.unsaved===n.unsaved}function Ac(e,n){return e instanceof Error&&e.message.trim()?i(e.message):n}function $w(){var Dt,Xn;ra();const e=R2(),[n,r]=p.useState(()=>e.name==="edit"&&e.system||"markdown-card"),[s,l]=Sw(),[o,c]=p.useState(null),[f,h]=p.useState(!1),[g,x]=p.useState(!1),[m,j]=p.useState("checking"),[k,v]=p.useState(null),[w,N]=p.useState(null),F=p.useRef(w);F.current=w;const[I,M]=p.useState({projects:0,assets:0}),[z,A]=p.useState(0),[T,L]=p.useState(null),H=p.useRef(0),P=p.useRef(null),U=p.useRef(null),K=p.useRef(!1),D=p.useRef(!1),re=p.useRef(null),q=p.useRef(0),[te,be]=p.useState(v2),[ne,Be]=p.useState({"markdown-card":null,"freeform-slide":null}),le=p.useRef(0),[De,W]=p.useState({"markdown-card":Uh,"freeform-slide":Uh}),ae=e.name==="edit"&&e.system!==null,[Se,ze]=p.useState(()=>({"markdown-card":e.name==="edit"&&e.system==="markdown-card","freeform-slide":e.name==="edit"&&e.system==="freeform-slide"})),ue=p.useRef(o);ue.current=o;const Ye=o?o.id:f?hn:null,Ue=p.useRef(Ye);Ue.current=Ye;const Ot=p.useRef(e);Ot.current=e;const Rt=p.useRef(n);Rt.current=n;const oe=e.name==="edit"?e.system:null,he=oe??n,Ae=se=>Se[se]||oe===se,Re=p.useCallback(se=>{N2(se),be(se)},[]),qe=p.useCallback((se,ve)=>{const ce=++le.current;Be(pe=>({...pe,[se]:{...ve,nonce:ce}}))},[]),Me=p.useCallback(se=>{W(ve=>Yh(ve["markdown-card"],se)?ve:{...ve,"markdown-card":se})},[]),Mt=p.useCallback(se=>{W(ve=>Yh(ve["freeform-slide"],se)?ve:{...ve,"freeform-slide":se})},[]);p.useEffect(()=>{if(e.name==="login"&&ue.current){It(ht.home,{replace:!0});return}if(e.name!=="edit")return;const se=e.system;if(!se){const ce=Ue.current?Qs(Ue.current).mode:Rt.current;It(ht.editor(ce),{replace:!0});return}r(se),ze(ce=>ce[se]?ce:{...ce,[se]:!0}),Ue.current&&Fa(Ue.current,{mode:se});const ve=e.intent;if(ve){if(ve.kind==="open")qe(se,{kind:"open",draftId:ve.draftId});else if(ve.kind==="new")qe(se,{kind:"new",platformId:ve.platformId,width:ve.width,height:ve.height});else if(ve.kind==="import")qe(se,{kind:"import",url:ve.url,title:ve.title});else{const ce=Gy(se,ve.templateId);ce&&qe(se,{kind:"template",template:ce})}It(ht.editor(se),{replace:!0})}},[e,qe]),p.useEffect(()=>{f&&!o&&e.name==="edit"&&!te&&Re(!0)},[te,e.name,f,Re,o]),p.useEffect(()=>{o&&Re(!1)},[Re,o]),p.useEffect(()=>{const se=()=>void Ko();return window.addEventListener("pagehide",se),()=>window.removeEventListener("pagehide",se)},[]);const Je=p.useCallback(se=>{const ve=se.target,ce=ve instanceof Element?ve.closest(Iw):null;if(!ce||!se.currentTarget.contains(ce))return;const pe=++q.current;re.current=ce,window.setTimeout(()=>{q.current===pe&&(re.current=null)},0)},[]),mt=p.useCallback(()=>{const se=re.current;if(re.current=null,D.current)return;D.current=!0;const ve=document.activeElement;U.current=se!=null&&se.isConnected?se:ve instanceof HTMLElement&&ve.isConnected?ve:null,x(!0)},[]);p.useLayoutEffect(()=>{if(!g)return;const se=P.current;if(!se)return;const ve=Array.from(se.children).filter(ce=>ce instanceof HTMLElement&&!ce.classList.contains("sheet-backdrop")).map(ce=>({element:ce,inert:ce.getAttribute("inert"),ariaHidden:ce.getAttribute("aria-hidden")}));for(const{element:ce}of ve)ce.setAttribute("inert",""),ce.setAttribute("aria-hidden","true");return()=>{for(const{element:ce,inert:pe,ariaHidden:At}of ve)pe===null?ce.removeAttribute("inert"):ce.setAttribute("inert",pe),At===null?ce.removeAttribute("aria-hidden"):ce.setAttribute("aria-hidden",At)}},[g,T]),p.useLayoutEffect(()=>{const se=K.current;if(K.current=g,!se||g)return;D.current=!1;const ve=U.current;if(U.current=null,Cs(ve))return;const ce=P.current,pe=(ce==null?void 0:ce.querySelector('[data-testid="account-login"], [data-testid="account-menu"], [data-testid="account-status-retry"]'))??null;Cs(pe)||Cs((ce==null?void 0:ce.querySelector('[data-testid="editor-home"], [data-testid="open-palette"]'))??null)},[g]);const Lt=p.useRef(!1);p.useLayoutEffect(()=>{const se=Lt.current;if(Lt.current=w!==null,!se||w)return;const ve=document.activeElement;if(ve instanceof HTMLElement&&ve!==document.body&&ve.isConnected)return;const ce=P.current;Cs((ce==null?void 0:ce.querySelector('[data-testid="account-menu"]'))??null)||Cs((ce==null?void 0:ce.querySelector('[data-testid="editor-home"], [data-testid="open-palette"]'))??null)},[w]);const _t=p.useCallback(async()=>{const se=++H.current;j("checking");try{const ve=await zt.auth.current();if(se!==H.current)return;c(ve),h(!0),j("ready"),L(null)}catch(ve){if(se!==H.current)return;h(!0),j("error"),L({title:i("登录状态尚未确认"),detail:Ac(ve,i("暂时无法连接服务器,请稍后重试")),retry:!0})}},[]);p.useEffect(()=>{const se=zt.auth.onInvalidated(()=>{H.current+=1,c(null),h(!0),v(null),j("ready"),x(!1),L({title:i("登录已过期,请重新登录"),retry:!1})});return _t(),()=>{H.current+=1,se()}},[_t]),p.useEffect(()=>{Ye&&ae&&Fa(Ye,{mode:he})},[he,ae,Ye]),p.useEffect(()=>{if(!o){M({projects:0,assets:0});return}let se=!1;return zs(Ms,hn).then(ve=>{se||M({projects:ve.projects.length,assets:ve.assets.length})},()=>{}),()=>{se=!0}},[o,z]);async function lt(){const se=++H.current;try{return await Ko(),await zt.auth.logout(),se!==H.current?!1:(c(null),v(null),j("ready"),L(null),!0)}catch(ve){return se!==H.current||L({title:i("退出登录失败"),detail:Ac(ve,i("请稍后重试")),retry:!1}),!1}}const pt=p.useRef(lt);pt.current=lt;function ee(se,ve){H.current+=1,v(ve&&ve.size>0?ve:null),c(se),h(!0),j("ready"),L(null),Re(!1),Ot.current.name==="login"&&It(ht.home,{replace:!0})}async function He(se){const ve=++H.current;let ce=null;try{await Ko();const pe=await zs(Ms,hn);Kf(pe)>0&&i6(pe)>F2(se.id)&&(ce={user:se,projects:pe.projects.length,assets:pe.assets.length,signingIn:!0,phase:{kind:"ask"},moved:new Map})}catch{}ve===H.current&&(x(!1),ce?N(ce):ee(se,null))}async function ct(){const se=F.current;if(!se||se.phase.kind==="moving")return;const ve=se.user.id;N({...se,phase:{kind:"moving",done:0,total:se.projects+se.assets}});let ce;try{await Ko(),ce=await l6({from:Ms,fromId:hn,to:zt,toId:ve,onProgress:(At,ts)=>N(qn=>(qn==null?void 0:qn.user.id)===ve?{...qn,phase:{kind:"moving",done:At,total:ts}}:qn)})}catch(At){ce={moved:new Map,movedAssets:0,failed:se.projects+se.assets,error:At}}const pe=new Map([...se.moved,...ce.moved]);if(A(At=>At+1),ce.failed>0){const At=await zs(Ms,hn).catch(()=>null);N({...se,moved:pe,projects:(At==null?void 0:At.projects.length)??se.projects,assets:(At==null?void 0:At.assets.length)??se.assets,phase:{kind:"failed",failed:ce.failed,message:Ac(ce.error,i("请稍后重试"))}});return}N(null),se.signingIn&&ee(se.user,pe)}function $t(){const se=F.current;!se||se.phase.kind==="moving"||(M2(se.user.id,Date.now()),N(null),se.signingIn&&ee(se.user,se.moved))}function bt(){const se=ue.current;!se||F.current||zs(Ms,hn).then(ve=>{var ce;Kf(ve)===0||((ce=ue.current)==null?void 0:ce.id)!==se.id||N({user:se,projects:ve.projects.length,assets:ve.assets.length,signingIn:!1,phase:{kind:"ask"},moved:new Map})},()=>{})}const gn=p.useMemo(()=>({theme:s,authStatus:m,onHome:()=>It(ht.home),onToggleTheme:l,onRetryAuth:()=>void _t(),onLogout:()=>void pt.current()}),[s,m,_t,l]),xn=ae?"editor":e.name==="login"?o?"workbench":"login":o||te?"workbench":m==="checking"?"splash":"login";return t.jsxs("div",{ref:P,className:"app-shell","data-workspace":he,"data-view":xn,onClickCapture:Je,children:[xn==="splash"&&t.jsx("div",{className:"app-splash","aria-label":i("正在加载"),children:t.jsx("img",{src:vl,alt:"",width:"40",height:"40"})}),xn==="login"&&t.jsx(Ky,{onAuthed:se=>void He(se),onGuest:()=>Re(!0)}),xn==="workbench"&&e.name!=="edit"&&e.name!=="login"&&t.jsx(rl,{scope:"page",resetKey:e,children:t.jsx(a6,{route:e,user:o,ownerId:Ye,guestLeft:I,dataVersion:z,onMoveGuestWork:bt,theme:s,onToggleTheme:l,onLogout:()=>{lt().then(se=>{se&&Re(!1)})},editorMeta:De,onProjectRemoved:(se,ve)=>qe(se,{kind:"removed",draftId:ve}),onProjectRenamed:(se,ve,ce)=>qe(se,{kind:"renamed",draftId:ve,title:ce})})}),(Ae("markdown-card")||Ae("freeform-slide"))&&t.jsxs("div",{className:"editor-frame",hidden:xn!=="editor",children:[Ae("markdown-card")&&t.jsx("div",{id:"workspace-panel-markdown",className:"workspace-panel","data-testid":"workspace-markdown",hidden:he!=="markdown-card",children:t.jsx(rl,{scope:"editor",resetKey:(Dt=ne["markdown-card"])==null?void 0:Dt.nonce,children:t.jsx(Rw,{isActive:xn==="editor"&&he==="markdown-card",user:o,ownerId:Ye,transfer:k,requestAuth:mt,chrome:gn,request:ne["markdown-card"],onMetaChange:Me})})}),Ae("freeform-slide")&&t.jsx("div",{id:"workspace-panel-freeform",className:"workspace-panel","data-testid":"workspace-freeform",hidden:he!=="freeform-slide",children:t.jsx(rl,{scope:"editor",resetKey:(Xn=ne["freeform-slide"])==null?void 0:Xn.nonce,children:t.jsx(ww,{isActive:xn==="editor"&&he==="freeform-slide",user:o,ownerId:Ye,transfer:k,requestAuth:mt,chrome:gn,request:ne["freeform-slide"],onMetaChange:Mt})})})]}),T&&t.jsx(Ml,{className:"operation-notice--global",tone:"error",title:T.title,detail:T.detail,onDismiss:()=>L(null),onRetry:T.retry?()=>void _t():void 0}),g&&t.jsx(S2,{onClose:()=>x(!1),onAuthed:se=>void He(se)}),w&&t.jsx(nx,{username:w.user.username,projects:w.projects,assets:w.assets,phase:w.phase,onMove:()=>void ct(),onKeep:$t})]})}function Dw(){return t.jsx($w,{})}kl.load();j2.createRoot(document.getElementById("root")).render(t.jsx(w2.StrictMode,{children:t.jsx(rl,{scope:"page",fullPage:!0,children:t.jsx(Dw,{})})}));
|