human2ai 0.1.7 → 0.1.8
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/README.en.md +1 -1
- package/README.md +1 -1
- package/dist/cli/main.js +74 -3
- package/dist/cli/main.js.map +1 -1
- package/dist/database/draft-version-errors.d.ts +6 -0
- package/dist/database/draft-version-errors.js +11 -0
- package/dist/database/draft-version-errors.js.map +1 -1
- package/dist/database/draft-version-store.js +17 -2
- package/dist/database/draft-version-store.js.map +1 -1
- package/dist/database/image-asset-repository.d.ts +5 -0
- package/dist/database/image-asset-repository.js +22 -4
- package/dist/database/image-asset-repository.js.map +1 -1
- package/dist/database/migrate.js +2 -0
- package/dist/database/migrate.js.map +1 -1
- package/dist/database/project-session-repository.d.ts +12 -1
- package/dist/database/project-session-repository.js +48 -11
- package/dist/database/project-session-repository.js.map +1 -1
- package/dist/database/session-preview-validation.js +37 -4
- package/dist/database/session-preview-validation.js.map +1 -1
- package/dist/database/session-storage-repository.d.ts +35 -0
- package/dist/database/session-storage-repository.js +281 -0
- package/dist/database/session-storage-repository.js.map +1 -0
- package/dist/database/ui-sketch-png-split-repository.d.ts +13 -0
- package/dist/database/ui-sketch-png-split-repository.js +123 -0
- package/dist/database/ui-sketch-png-split-repository.js.map +1 -0
- package/dist/database/workspace-settings-repository.d.ts +10 -0
- package/dist/database/workspace-settings-repository.js +30 -0
- package/dist/database/workspace-settings-repository.js.map +1 -0
- package/dist/domain/session/canvas-edit-history.d.ts +2 -0
- package/dist/domain/session/canvas-edit-history.js +4 -0
- package/dist/domain/session/canvas-edit-history.js.map +1 -1
- package/dist/domain/session/capabilities.js +14 -0
- package/dist/domain/session/capabilities.js.map +1 -1
- package/dist/domain/session/storage.d.ts +22 -0
- package/dist/domain/session/storage.js +10 -0
- package/dist/domain/session/storage.js.map +1 -0
- package/dist/domain/session/types.d.ts +4 -0
- package/dist/domain/ui-sketch/draft.js +22 -0
- package/dist/domain/ui-sketch/draft.js.map +1 -1
- package/dist/domain/ui-sketch/png-canvas.d.ts +25 -0
- package/dist/domain/ui-sketch/png-canvas.js +78 -0
- package/dist/domain/ui-sketch/png-canvas.js.map +1 -0
- package/dist/domain/ui-sketch/png-split-regions.d.ts +7 -0
- package/dist/domain/ui-sketch/png-split-regions.js +40 -0
- package/dist/domain/ui-sketch/png-split-regions.js.map +1 -0
- package/dist/domain/ui-sketch/png-split.d.ts +49 -0
- package/dist/domain/ui-sketch/png-split.js +39 -0
- package/dist/domain/ui-sketch/png-split.js.map +1 -0
- package/dist/domain/ui-sketch/transparent-png.d.ts +50 -0
- package/dist/domain/ui-sketch/transparent-png.js +178 -0
- package/dist/domain/ui-sketch/transparent-png.js.map +1 -0
- package/dist/domain/ui-sketch/types.d.ts +2 -0
- package/dist/server/app.d.ts +7 -1
- package/dist/server/app.js +21 -0
- package/dist/server/app.js.map +1 -1
- package/dist/server/routes/draft-version-routes.js +12 -3
- package/dist/server/routes/draft-version-routes.js.map +1 -1
- package/dist/server/routes/project-sessions.js +14 -0
- package/dist/server/routes/project-sessions.js.map +1 -1
- package/dist/server/routes/storage-protection.d.ts +3 -0
- package/dist/server/routes/storage-protection.js +29 -0
- package/dist/server/routes/storage-protection.js.map +1 -0
- package/dist/server/routes/ui-sketch-png-splits.d.ts +4 -0
- package/dist/server/routes/ui-sketch-png-splits.js +42 -0
- package/dist/server/routes/ui-sketch-png-splits.js.map +1 -0
- package/dist/server/routes/workspace-settings.d.ts +3 -0
- package/dist/server/routes/workspace-settings.js +25 -0
- package/dist/server/routes/workspace-settings.js.map +1 -0
- package/dist/server/runtime.js +8 -1
- package/dist/server/runtime.js.map +1 -1
- package/dist/server/session-preview-service.js +7 -4
- package/dist/server/session-preview-service.js.map +1 -1
- package/dist/server/storage-maintenance-service.d.ts +6 -0
- package/dist/server/storage-maintenance-service.js +65 -0
- package/dist/server/storage-maintenance-service.js.map +1 -0
- package/locales/en/common.json +64 -2
- package/migrations/0012_ui_sketch_png_splits.sql +6 -0
- package/migrations/0013_storage_retention.sql +43 -0
- package/migrations/0014_workspace_settings_and_trash.sql +11 -0
- package/package.json +1 -1
- package/schemas/ui-sketch-draft.schema.json +173 -0
- package/skills/human2ai/SKILL.md +8 -2
- package/skills/human2ai/references/ui-extraction-prompt.txt +41 -0
- package/skills/human2ai/references/ui-extraction.md +38 -0
- package/skills/human2ai/references/ui-layout.md +22 -0
- package/web/out/404/index.html +1 -1
- package/web/out/404.html +1 -1
- package/web/out/__next.__PAGE__.txt +7 -7
- package/web/out/__next._full.txt +7 -7
- package/web/out/__next._tree.txt +3 -3
- package/web/out/_next/static/chunks/327-3dba8bbcb4bcb1fc.js +1 -0
- package/web/out/_next/static/chunks/868-6a413fc8c52cf6df.js +1 -0
- package/web/out/_next/static/chunks/{60-f12915d6c3a2c6a3.js → 989-6d7aa6a22a75f7de.js} +24 -24
- package/web/out/_next/static/chunks/app/_not-found/{page-508d7dc25aaa3aa9.js → page-fddf8e0980e10cc5.js} +1 -1
- package/web/out/_next/static/chunks/app/composition/page-f810843a0f114d13.js +1 -0
- package/web/out/_next/static/chunks/app/layout-9c5f0b5667b84400.js +1 -0
- package/web/out/_next/static/chunks/app/{page-96f541a0e6fa160b.js → page-29cacabbd1c90b6f.js} +1 -1
- package/web/out/_next/static/chunks/app/spatial/page-014875456f84d8fa.js +1 -0
- package/web/out/_next/static/chunks/app/styles/{page-4f0f5e04e35adaa3.js → page-1077a7decb9be158.js} +1 -1
- package/web/out/_next/static/chunks/app/ui-sketch/page-ea382541f80cad0d.js +1 -0
- package/web/out/_next/static/chunks/{main-app-3e9223f29047fc41.js → main-app-9985b291e50ea69b.js} +1 -1
- package/web/out/_next/static/chunks/next/dist/client/components/builtin/global-error-1193cefa6c9c6179.js +1 -0
- package/web/out/_next/static/chunks/{webpack-9a8652ec72df780b.js → webpack-cfe3662bbaa8d6ce.js} +1 -1
- package/web/out/_next/static/css/15abfc5e59099f48.css +1 -0
- package/web/out/_next/static/css/57ecc433cb654a57.css +1 -0
- package/web/out/_next/static/css/7a62016f8918890b.css +5 -0
- package/web/out/_not-found/__next._full.txt +6 -6
- package/web/out/_not-found/__next._not-found.__PAGE__.txt +6 -6
- package/web/out/_not-found/__next._tree.txt +3 -3
- package/web/out/_not-found/index.html +1 -1
- package/web/out/_not-found/index.txt +6 -6
- package/web/out/composition/__next._full.txt +7 -7
- package/web/out/composition/__next._tree.txt +3 -3
- package/web/out/composition/__next.composition.__PAGE__.txt +7 -7
- package/web/out/composition/index.html +1 -1
- package/web/out/composition/index.txt +7 -7
- package/web/out/index.html +1 -1
- package/web/out/index.txt +7 -7
- package/web/out/spatial/__next._full.txt +7 -7
- package/web/out/spatial/__next._tree.txt +3 -3
- package/web/out/spatial/__next.spatial.__PAGE__.txt +7 -7
- package/web/out/spatial/index.html +1 -1
- package/web/out/spatial/index.txt +7 -7
- package/web/out/styles/__next._full.txt +7 -7
- package/web/out/styles/__next._tree.txt +3 -3
- package/web/out/styles/__next.styles.__PAGE__.txt +7 -7
- package/web/out/styles/index.html +1 -1
- package/web/out/styles/index.txt +7 -7
- package/web/out/ui-sketch/__next._full.txt +8 -8
- package/web/out/ui-sketch/__next._tree.txt +4 -4
- package/web/out/ui-sketch/__next.ui-sketch.__PAGE__.txt +8 -8
- package/web/out/ui-sketch/index.html +1 -1
- package/web/out/ui-sketch/index.txt +8 -8
- package/web/out/_next/static/chunks/348-845058912fd7c5e5.js +0 -1
- package/web/out/_next/static/chunks/app/composition/page-30c8fcabe591ab65.js +0 -1
- package/web/out/_next/static/chunks/app/layout-68da0027d158df26.js +0 -1
- package/web/out/_next/static/chunks/app/spatial/page-ac4e6cda25dea88f.js +0 -1
- package/web/out/_next/static/chunks/app/ui-sketch/page-08ddf9773e8f15ed.js +0 -1
- package/web/out/_next/static/chunks/next/dist/client/components/builtin/global-error-2d183cd08094b261.js +0 -1
- package/web/out/_next/static/css/0777c3d5c25abf92.css +0 -1
- package/web/out/_next/static/css/3d47424e508934f6.css +0 -5
- package/web/out/_next/static/css/5d259915312c51c1.css +0 -1
- /package/web/out/_next/static/{MsEzgYkCNtygwkUNRRXe7 → SiEWNIZfGL4sShRQt9h5W}/_buildManifest.js +0 -0
- /package/web/out/_next/static/{MsEzgYkCNtygwkUNRRXe7 → SiEWNIZfGL4sShRQt9h5W}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[868],{755:(e,t,i)=>{"use strict";i.d(t,{EY:()=>s,QO:()=>o,sM:()=>d});var n=i(1579),a=i(44791),r=i(69388);function o(e,t){let i=Math.min(1,.5*t.width/e.width,.5*t.height/e.height);return{width:e.width*i,height:e.height*i}}function s(e,t,i,n,s){let{width:l,height:d}=s??o(t,e.frame);return{...e,images:[...e.images,{...(0,a.D)(),id:i,x:(n?.x??e.frame.x+e.frame.width/2)-l/2,y:(n?.y??e.frame.y+e.frame.height/2)-d/2,width:l,height:d,visible:!0,weight:"auto",crop:null,assetId:t.assetId,previewReference:t.reference}],layerOrder:[...(0,r.G)(e),i]}}function l(e){return JSON.stringify({...e,images:e.images.map(e=>{if(!e.previewReference)return e;let{renderedRevision:t,...i}=e.previewReference;return{...e,assetId:null,previewReference:i}})})}function d(e,t,i){if(l(t)!==l(i))return null;let a=new Map(t.images.map(e=>[e.id,e])),r=new Map(i.images.map(e=>[e.id,e])),o=!1,s=e.images.map(e=>{let t=a.get(e.id),i=r.get(e.id);return e.previewReference&&t?.previewReference&&i?.previewReference&&(0,n.R)(e.previewReference)===(0,n.R)(i.previewReference)&&e.assetId===t.assetId&&(e.assetId!==i.assetId||e.previewReference.renderedRevision!==i.previewReference.renderedRevision)?(o=!0,{...e,assetId:i.assetId,previewReference:i.previewReference}):e});return o?{...e,images:s}:e}},1579:(e,t,i)=>{"use strict";function n(e){return JSON.stringify([e.sessionId,e.sessionType,"spatial"===e.sessionType?e.cameraId:e.stateId])}i.d(t,{R:()=>n})},1713:()=>{},1820:()=>{},2684:(e,t,i)=>{"use strict";i.d(t,{B:()=>o,P:()=>s});var n=i(73365),a=i(1521);let r=(0,a.createContext)(null);function o({attributes:e,children:t}){let i=(0,a.useContext)(r);return(0,n.jsx)(r.Provider,{value:i??e,children:t})}function s(e){return(0,a.useContext)(r)??e}},3500:(e,t,i)=>{"use strict";i.d(t,{B:()=>s,Bi:()=>m,GN:()=>h,Y8:()=>c,cq:()=>a,i:()=>d,sw:()=>o,tW:()=>r,tw:()=>u});var n=i(88912);let a=Object.freeze({width:1200,height:800}),r=n.rr;function o(e=r){return l({...n.rr,...e})}function s(e){var t;let i,n,r,o,s;return{...e,bounds:(t=e,i=.84*a.width,n=.84*a.height,r=Math.min(i/t.width,n/t.height),o=t.width*r,s=t.height*r,{x:(a.width-o)/2/a.width,y:(a.height-s)/2/a.height,width:o/a.width,height:s/a.height})}}function l(e){return{width:e.width,height:e.height,bounds:{x:e.x/a.width,y:e.y/a.height,width:e.width/a.width,height:e.height/a.height}}}function d(e){return{x:e.bounds.x*a.width,y:e.bounds.y*a.height,width:e.bounds.width*a.width,height:e.bounds.height*a.height}}function c(e){let t=180*Math.atan2(e.height,e.width)/Math.PI;return[...Array.from({length:8},(e,t)=>45*t),t,180-t,180+t,360-t].sort((e,t)=>e-t).filter((e,t,i)=>0===t||Math.abs(e-i[t-1])>1e-8)}function u(e,t){return{x:t.bounds.x+e.x*t.bounds.width,y:t.bounds.y+e.y*t.bounds.height}}function m(e,t){return{x:(e.x-t.bounds.x)/t.bounds.width,y:(e.y-t.bounds.y)/t.bounds.height}}function h(e,t){return l(t)}},4549:()=>{},6059:()=>{},12190:()=>{},12399:(e,t,i)=>{"use strict";i.d(t,{Oe:()=>y,Pw:()=>p,b5:()=>c,bl:()=>u,i1:()=>d,j4:()=>m,ms:()=>f,p:()=>g,pT:()=>h,uO:()=>function e(t,i,a,o=!0){let s=structuredClone(t),l=s.joints.find(e=>e.id===i);if(!l)throw Error("SPATIAL_INVALID: unknown joint");let u=s.bones.find(e=>e.endJointId===i),h=!!(u&&(0,r.dS)(u.modelPart)),y=Object.fromEntries(s.joints.map(e=>{let t=s.bones.find(t=>t.endJointId===e.id);return[e.id,{offset:g(s,e),basis:t?(0,r.IA)(s,t):new n.PTz}]})),x=f(t);if(a.position&&l.lockPosition||a.rotation&&u&&(u.lockRotation||m(u)))return{character:t,constrained:!0};let b=[...t.joints.filter(e=>e.lockPosition).map(e=>({id:e.id,weight:100,position:x[e.id].position})),...t.bones.filter(e=>e.lockRotation).map(e=>({id:e.endJointId,weight:100,rotation:x[e.endJointId].rotation}))],v={id:i,weight:1,...a.position?{position:d(a.position)}:{},...a.rotation?{rotation:c(a.rotation)}:{}};if(v.rotation&&u){let e=p(s,u,(l.parentId?x[l.parentId].rotation:c(t.rotation)).clone().invert().multiply(v.rotation));if(e.every((e,t)=>e>=u.limits.min[t]&&e<=u.limits.max[t])){u.rotation=e;let n=f(s,y);if(b.every(e=>(!e.position||1e-5>e.position.distanceTo(n[e.id].position))&&(!e.rotation||1e-5>e.rotation.angleTo(n[e.id].rotation))))return{character:s,constrained:!1};u.rotation=[...t.bones.find(e=>e.endJointId===i).rotation]}}let w=new Set,j=i;for(;j&&(w.add(j),!(j=s.joints.find(e=>e.id===j).parentId)||!(s.joints.filter(e=>e.parentId===j).length>1)););let k=new Set([i]);for(let e of k)for(let t of s.joints.filter(t=>t.parentId===e))k.add(t.id);let S=[];for(let e of s.bones)if(!(e.lockRotation||m(e))&&(v.rotation?k.has(e.endJointId):!o||w.has(e.endJointId)))for(let t of[0,1,2])e.limits.max[t]-e.limits.min[t]<1e-4||S.push({get:()=>e.rotation[t],set:i=>{e.rotation[t]=Math.max(e.limits.min[t],Math.min(e.limits.max[t],i))},step:.05});if(!l.parentId)for(let e of[0,1,2])S.push({get:()=>s.position[e],set:t=>{s.position[e]=t},step:.001});let I=e=>{let t=new Set(s.bones.filter(e=>e.lockRotation&&!m(e)).map(e=>e.id)),i=e=>{let n=s.bones.find(t=>t.id===e),a=s.bones.find(e=>e.endJointId===n.startJointId);a&&t.has(a.id)&&i(a.id);let r=f(s,y)[n.startJointId].rotation;n.rotation=p(s,n,r.clone().invert().multiply(x[n.endJointId].rotation)).map((e,t)=>Math.max(n.limits.min[t],Math.min(n.limits.max[t],e))),t.delete(e)};for(let e of t)i(e);let n=f(s,y),a=[];for(let t of e)if(t.position&&a.push(...t.position.clone().sub(n[t.id].position).multiplyScalar(t.weight).toArray()),t.rotation){let e=t.rotation.clone().multiply(n[t.id].rotation.clone().invert()).normalize(),i=e.w<0?-1:1;a.push(2*e.x*i*t.weight,2*e.y*i*t.weight,2*e.z*i*t.weight)}return a},C=e=>e.reduce((e,t)=>e+t*t,0),P=(e,t)=>{for(let i=0;i<t;i++){let t=I(e),i=C(t);if(i<1e-12)break;let n=S.map(e=>e.get()),a=S.map((i,a)=>{i.set(n[a]+i.step);let r=i.get()-n[a];1e-10>Math.abs(r)&&(i.set(n[a]-i.step),r=i.get()-n[a]);let o=I(e);return i.set(n[a]),o.map((e,i)=>0===r?0:(t[i]-e)/r)}),r=function(e,t){let i=e.map((e,i)=>[...e,t[i]]),n=i.length;for(let e=0;e<n;e++){let t=e;for(let a=e+1;a<n;a++)Math.abs(i[a][e])>Math.abs(i[t][e])&&(t=a);[i[t],i[e]]=[i[e],i[t]];let a=i[e][e];if(!(1e-14>Math.abs(a))){for(let t=e;t<=n;t++)i[e][t]/=a;for(let t=0;t<n;t++){if(t===e)continue;let a=i[t][e];for(let r=e;r<=n;r++)i[t][r]-=a*i[e][r]}}}return i.map(e=>e[n])}(t.map((e,i)=>t.map((e,t)=>a.reduce((e,n)=>e+n[i]*n[t],0)+(i===t?h?1e-7*(s.height/1.8)**2:1e-5:0))),t),o=a.map(e=>e.reduce((e,t,i)=>e+t*r[i],0)),l=!1;for(let t of[1,.5,.2,.05])if(S.forEach((e,i)=>e.set(n[i]+Math.max(-15,Math.min(15,o[i]))*t)),C(I(e))<i-1e-14){l=!0;break}if(!l){S.forEach((e,t)=>e.set(n[t]));break}}};P([...b,v],65),b.length&&P(b,25),I(b);let L=f(s,y);if(!b.every(e=>(!e.position||1e-5>e.position.distanceTo(L[e.id].position))&&(!e.rotation||1e-5>e.rotation.angleTo(L[e.id].rotation))))return o&&!h?e(t,i,a,!1):{character:t,constrained:!0};let A=!!v.position&&v.position.distanceTo(L[i].position)>(h?5e-4*s.height:.005)||!!v.rotation&&v.rotation.angleTo(L[i].rotation)>.005;if(A&&o&&!h){let n=e(t,i,a,!1),r=e=>{let t=f(e)[i];return(v.position?.distanceTo(t.position)??0)+(v.rotation?.angleTo(t.rotation)??0)};if(r(n.character)<r(s))return n}return{character:s,constrained:A}}});var n=i(84910),a=i(54996),r=i(29169),o=i(2872),s=i(79283);let l=Math.PI/180,d=e=>new n.Pq0(...e),c=e=>new n.PTz().setFromEuler(new n.O9p(...e.map(e=>e*l),"XYZ")),u=e=>{let t=new n.O9p().setFromQuaternion(e,"XYZ");return[t.x/l,t.y/l,t.z/l]},m=e=>/^(left|right)-(shoulder|hip)$/.test(e.modelPart);function h(e,t,i=t.rotation){let n=(0,r.IA)(e,t);return n.clone().multiply(c(i)).multiply(n.invert())}function p(e,t,i){let n=(0,r.IA)(e,t);return u(n.clone().invert().multiply(i).multiply(n))}function g(e,t){let i=d(t.offset),n=e.bones.find(e=>e.endJointId===t.id)?.modelPart;if(n&&(0,r.dS)(n)){let i=e.bones.find(e=>e.endJointId===t.id),n=(0,r.oT)(e,i);if(n)return(0,r.xT)(e,t,n)}let l=(0,a.G_)(e.headRatio);if(n&&(["spine","chest","neck"].includes(n)||/-(shoulder|hip)$/.test(n))){let t=6*(0,a.UB)(l,n)*e.headRatio/(7*(e.headRatio-1));i.x*=t;let r=6*l.torsoDepth*e.headRatio/(7*(e.headRatio-1));i.z*=1+(r-1)*(1-l.softness)}let c=e.neckLength??1;if("neck"===n&&i.multiplyScalar(l.neck*c),"spine"===n||"chest"===n){let t=e.joints.find(e=>"neck"===e.id);t&&(i.y+=t.offset[1]*(1-l.neck)/2,i.z+=t.offset[2]*(1-l.neck)*l.torsoDepth*6*e.headRatio/(7*(e.headRatio-1))/2*(1-l.softness))}n&&/-(elbow|wrist)$/.test(n)&&i.multiplyScalar(l.armLength),n?.endsWith("-hand")&&i.multiplyScalar(l.handLength*(e.palmSize??1));let u=(0,a.kF)(e.footSize);if(n?.endsWith("-ankle")&&1!==u){let n=e.bones.find(e=>e.startJointId===t.id&&e.modelPart.endsWith("-foot"));if(n){let t="female"===e.bodyType?s:o,a=t.parts.find(e=>e.id===n.modelPart),r=d(e.joints.find(e=>e.id===n.endJointId).offset).length()/d(a.end).sub(d(a.start)).length();i.y+=(a.start[1]-t.bottom)*r*(u-1)}}return n?.endsWith("-foot")&&(i.x*=e.footSize??1,i.y*=u,i.z*=l.footLength*(e.footSize??1)),i}function f(e,t){let i=Object.create(null),a=new Map(e.joints.map(e=>[e.id,e])),r=new Map(e.bones.map(e=>[e.endJointId,e])),o=new Set,s=l=>{if(i[l])return i[l];if(o.has(l))throw Error("SPATIAL_INVALID: cyclic skeleton");o.add(l);let u=a.get(l);if(!u)throw Error("SPATIAL_INVALID: missing parent joint");let m=u.parentId?s(u.parentId):{position:d(e.position),rotation:c(e.rotation)},p=r.get(l),f=t?.[l].basis,y=p?f?f.clone().multiply(c(p.rotation)).multiply(f.clone().invert()):h(e,p):new n.PTz,x=m.rotation.clone().multiply(y).normalize(),b=(t?.[l].offset.clone()??g(e,u)).applyQuaternion(x).add(m.position);return o.delete(l),i[l]={position:b,rotation:x}};return e.joints.forEach(e=>s(e.id)),i}function y(e){let t=f(e);return Object.fromEntries(e.bones.map(e=>[e.id,{position:t[e.startJointId].position.clone(),rotation:t[e.endJointId].rotation.clone()}]))}},12853:()=>{},14956:(e,t,i)=>{"use strict";i.d(t,{u:()=>a});var n=i(22146);function a(e,t){let i=Math.min(3,t.length),a=Math.ceil(t.length/i);return{columns:i,rows:a,width:i*e+(i-1)*n.eJ,height:a*(e+n.Sn)+(a-1)*n.eJ,tiles:t.map((t,a)=>({face:t,left:a%i*(e+n.eJ),top:Math.floor(a/i)*(e+n.Sn+n.eJ)}))}}},15682:()=>{},16803:()=>{},16842:(e,t,i)=>{"use strict";i.d(t,{C0:()=>a,aT:()=>n,jK:()=>r});let n=3650,a={imageRetentionDays:1,historyRetentionDays:7,trashRetentionDays:7};function r(e){let t=e.images;return[...new Set(t?.flatMap(e=>e.assetId?[e.assetId]:[])??[])]}},17053:()=>{},17346:()=>{},19204:(e,t,i)=>{"use strict";function n(e){let t=JSON.stringify(function e(t){return Array.isArray(t)?t.map(e):t&&"object"==typeof t?Object.fromEntries(Object.entries(t).filter(([,e])=>void 0!==e).sort(([e],[t])=>e<t?-1:+(e>t)).map(([t,i])=>[t,e(i)])):t}(e));if(void 0===t)throw Error("Cannot fingerprint an undefined document.");return t}function a(e){let t=0x811c9dc5;for(let i=0;i<e.length;i+=1)t^=e.charCodeAt(i),t=Math.imul(t,0x1000193);return`draft-${(t>>>0).toString(16).padStart(8,"0")}`}i.d(t,{U:()=>a,d:()=>n})},19767:(e,t,i)=>{"use strict";i.d(t,{$n:()=>s,Ab:()=>o,Dj:()=>l,MR:()=>c,PK:()=>p,QR:()=>r,Sq:()=>h,Wu:()=>d,xz:()=>u,zS:()=>m});var n=i(3500);let a={square:1,landscape:1.6,portrait:.625};function r(e,t){let i=t.width*t.height,n=e.area*i;if("circle"===e.primitive)return"free"===e.aspect&&e.width&&e.height?{type:"ellipse",cx:e.x*t.width,cy:e.y*t.height,radiusX:e.width*t.width/2,radiusY:e.height*t.height/2}:{type:"circle",cx:e.x*t.width,cy:e.y*t.height,radius:Math.sqrt(n/Math.PI)};let r={x:e.x*t.width,y:e.y*t.height};if("quadrilateral"===e.primitive){let i="free"===e.aspect?void 0:a[e.aspect],o="free"===e.aspect?e.width*t.width:Math.sqrt(n*i),s="free"===e.aspect?e.height*t.height:n/o;return{type:"polygon",points:(e.corners?e.corners.map(e=>({x:r.x+(e.x-.5)*o,y:r.y+(e.y-.5)*s})):[{x:r.x-o/2,y:r.y-s/2},{x:r.x+o/2,y:r.y-s/2},{x:r.x+o/2,y:r.y+s/2},{x:r.x-o/2,y:r.y+s/2}]).map(t=>g(t,r,e.rotation??0)),center:r,width:o,height:s}}let o="free"===e.aspect&&e.width&&e.height,s=o?e.width*t.width:Math.sqrt(4*n/Math.sqrt(3)),l=o?e.height*t.height:Math.sqrt(3)/2*s;return{type:"polygon",points:[{x:r.x,y:r.y-2*l/3},{x:r.x-s/2,y:r.y+l/3},{x:r.x+s/2,y:r.y+l/3}].map(t=>g(t,r,e.rotation??0)),center:r,side:s,height:l}}function o(e){return Math.abs(e.reduce((t,i,n)=>{let a=e[(n+1)%e.length];return t+i.x*a.y-a.x*i.y},0))/2}function s(e){return 4===e.length&&e.every((t,i)=>{let n=e[(i+1)%4],a=e[(i+2)%4];return(n.x-t.x)*(a.y-n.y)-(n.y-t.y)*(a.x-n.x)>1e-8})}function l(e,t){let i=r({...e,x:0,y:0,rotation:0},t);if("polygon"!==i.type)return[];let n={x:e.x*t.width,y:e.y*t.height};return[-.18,0,.18].map(t=>{let a=t*i.height,r=i.points.flatMap((e,t)=>{let n=i.points[(t+1)%i.points.length];return a<Math.min(e.y,n.y)||a>=Math.max(e.y,n.y)?[]:[e.x+(n.x-e.x)*(a-e.y)/(n.y-e.y)]}),o=Math.min(...r),s=Math.max(...r);return[.14,.86].map(t=>g({x:n.x+o+(s-o)*t,y:n.y+a},n,e.rotation??0))})}function d(e,t){let i={x:e.x*t.width,y:e.y*t.height},n=1.1*Math.hypot(t.width,t.height);return{type:"line",center:i,start:f(i,e.rotation+180,n),end:f(i,e.rotation,n)}}function c(e){var t;let i,a;return i=Math.min(...(t=[(0,n.i)(e.frame),...e.areas.map(e=>{let t;return{x:(t=h(r(e,n.cq))).minimumX,y:t.minimumY,width:t.maximumX-t.minimumX,height:t.maximumY-t.minimumY}}),...e.images.map(u),...e.focusPoints.map(e=>({x:e.x*n.cq.width-20,y:e.y*n.cq.height-20,width:40,height:40})),...e.directionLine?[{x:e.directionLine.x*n.cq.width,y:e.directionLine.y*n.cq.height,width:0,height:0}]:[]]).map(e=>e.x)),{x:i,y:a=Math.min(...t.map(e=>e.y)),width:Math.max(...t.map(e=>e.x+e.width))-i,height:Math.max(...t.map(e=>e.y+e.height))-a}}function u(e){let t={x:e.x*n.cq.width,y:e.y*n.cq.height},i=e.width*n.cq.width/2,a=e.height*n.cq.height/2,r=[{x:t.x-i,y:t.y-a},{x:t.x+i,y:t.y-a},{x:t.x+i,y:t.y+a},{x:t.x-i,y:t.y+a}].map(i=>g(i,t,e.rotation)),o=Math.min(...r.map(e=>e.x)),s=Math.max(...r.map(e=>e.x)),l=Math.min(...r.map(e=>e.y));return{x:o,y:l,width:s-o,height:Math.max(...r.map(e=>e.y))-l}}function m(e){let t=e.areas.map(e=>r(e,n.cq)),i=(0,n.i)(e.frame),a=t.map(()=>0),o=0,s=0,l=0;for(let e=0;e<120;e+=1)for(let n=0;n<180;n+=1){let r={x:i.x+(n+.5)/180*i.width,y:i.y+(e+.5)/120*i.height},d=!1;t.forEach((e,t)=>{(function(e,t){if("circle"===e.type)return Math.hypot(t.x-e.cx,t.y-e.cy)<=e.radius;if("ellipse"===e.type){let i=(t.x-e.cx)/e.radiusX,n=(t.y-e.cy)/e.radiusY;return i*i+n*n<=1}let i=!1;for(let n=0,a=e.points.length-1;n<e.points.length;a=n++){let r=e.points[n],o=e.points[a];r.y>t.y!=o.y>t.y&&t.x<(o.x-r.x)*(t.y-r.y)/(o.y-r.y)+r.x&&(i=!i)}return i})(e,r)&&(a[t]+=1,d=!0)}),d&&(o+=1,s+=(n+.5)/180,l+=(e+.5)/120)}let d=i.width*i.height,c=n.cq.width*n.cq.height,u=e.areas.reduce((e,t)=>e+t.area*c/d,0),m=a.map(e=>e/21600),h=m.reduce((e,t)=>e+t,0),p=o/21600;return{theoreticalArea:u,visibleAreaShares:m,occupiedArea:p,negativeSpace:1-p,clippedArea:Math.max(0,u-h),overlapArea:Math.max(0,h-p),visualCenter:o?{x:s/o,y:l/o}:{x:.5,y:.5}}}function h(e){return"circle"===e.type?{minimumX:e.cx-e.radius,maximumX:e.cx+e.radius,minimumY:e.cy-e.radius,maximumY:e.cy+e.radius}:"ellipse"===e.type?{minimumX:e.cx-e.radiusX,maximumX:e.cx+e.radiusX,minimumY:e.cy-e.radiusY,maximumY:e.cy+e.radiusY}:{minimumX:Math.min(...e.points.map(e=>e.x)),maximumX:Math.max(...e.points.map(e=>e.x)),minimumY:Math.min(...e.points.map(e=>e.y)),maximumY:Math.max(...e.points.map(e=>e.y))}}function p(e,t,i=1.6,n="quadrilateral"){let a=e*t.width*t.height,r="circle"===n?Math.PI/4:"triangle"===n?.5:1,o=Math.sqrt(a*i/r);return{width:o/t.width,height:a/r/o/t.height}}function g(e,t,i){let n=i*Math.PI/180,a=Math.cos(n),r=Math.sin(n),o=e.x-t.x,s=e.y-t.y;return{x:t.x+o*a-s*r,y:t.y+o*r+s*a}}function f(e,t,i){let n=t*Math.PI/180;return{x:e.x+Math.cos(n)*i,y:e.y+Math.sin(n)*i}}},20701:()=>{},21071:(e,t,i)=>{"use strict";i.d(t,{aY:()=>u.aY,s4:()=>k,em:()=>c.em,EG:()=>d.EG,mw:()=>c.mw,_1:()=>S,VO:()=>w,bl:()=>l.bl,bK:()=>M,Pw:()=>l.Pw,Oe:()=>l.Oe,D5:()=>f,oH:()=>I,zP:()=>g,wY:()=>C,IA:()=>d.IA,oq:()=>d.oq,dS:()=>d.dS,ov:()=>y,Au:()=>d.Au,j4:()=>l.j4,ms:()=>l.ms,oT:()=>d.oT,b5:()=>l.b5,wU:()=>A,cj:()=>L,i1:()=>l.i1});var n=i(27062),a=i(2872),r=i(79283);let o=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://yisi.local/schemas/spatial-draft.schema.json","type":"object","additionalProperties":false,"required":["version","kind","characters","objects","cameras"],"properties":{"version":{"const":2},"kind":{"const":"spatial-draft"},"lightingEnabled":{"type":"boolean"},"characters":{"type":"array","maxItems":24,"items":{"type":"object","additionalProperties":false,"required":["id","name","kind","position","rotation","height","headRatio","color","joints","bones","appearance"],"properties":{"id":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string","minLength":1,"maxLength":200},"kind":{"enum":["humanoid","custom"]},"position":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"rotation":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"height":{"type":"number","minimum":0.2,"maximum":20},"headRatio":{"type":"number","minimum":2,"maximum":12},"thumbLimitsVersion":{"const":2},"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"joints":{"type":"array","minItems":1,"maxItems":200,"items":{"type":"object","additionalProperties":false,"required":["id","name","parentId","offset","lockPosition","radius","terminal"],"properties":{"id":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string","minLength":1,"maxLength":200},"parentId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"offset":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"lockPosition":{"type":"boolean"},"radius":{"type":"number","exclusiveMinimum":0,"maximum":10},"terminal":{"type":"boolean"}}}},"bones":{"type":"array","maxItems":199,"items":{"type":"object","additionalProperties":false,"required":["id","name","startJointId","endJointId","rotation","restRotation","limits","lockRotation","modelPart"],"properties":{"id":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string","minLength":1,"maxLength":200},"startJointId":{"type":"string","minLength":1,"maxLength":100},"endJointId":{"type":"string","minLength":1,"maxLength":100},"rotation":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"restRotation":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"limits":{"type":"object","additionalProperties":false,"required":["min","max"],"properties":{"min":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"max":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}}}},"lockRotation":{"type":"boolean"},"modelPart":{"type":"string","minLength":1,"maxLength":100}}}},"appearance":{"enum":["quaternius","geometric"]},"torsoRatio":{"type":"number","minimum":0.3,"maximum":0.7},"bodyType":{"enum":["male","female"]},"neckLength":{"type":"number","minimum":0.6,"maximum":1.4},"palmSize":{"type":"number","minimum":0.7,"maximum":1.3},"fingerLength":{"type":"number","minimum":0.6,"maximum":1.4},"footSize":{"type":"number","minimum":0.7,"maximum":1.4},"note":{"type":"string"}}}},"objects":{"type":"array","maxItems":100,"items":{"type":"object","additionalProperties":false,"required":["id","name","kind","position","rotation","size","color"],"properties":{"id":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string","minLength":1,"maxLength":200},"kind":{"enum":["box","sphere","plane"]},"position":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"rotation":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"size":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"note":{"type":"string"}}}},"cameras":{"type":"array","minItems":1,"maxItems":24,"items":{"type":"object","additionalProperties":false,"required":["id","name","position","target","projection","fov","span","width","height","background"],"properties":{"id":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string","minLength":1,"maxLength":200},"position":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"target":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"projection":{"enum":["perspective","orthographic"]},"fov":{"type":"number","minimum":10,"maximum":120},"span":{"type":"number","minimum":0.1,"maximum":1000},"width":{"type":"integer","minimum":128,"maximum":2048},"height":{"type":"integer","minimum":128,"maximum":2048},"background":{"anyOf":[{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},{"type":"null"}]},"note":{"type":"string"}}}},"cameraBoxes":{"type":"array","maxItems":24,"items":{"type":"object","additionalProperties":false,"required":["id","name","position","rotation","size","resolution"],"properties":{"id":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string","minLength":1,"maxLength":200},"position":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"rotation":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"size":{"type":"number","minimum":0.05,"maximum":1000},"resolution":{"type":"integer","minimum":128,"maximum":1024},"note":{"type":"string"}}}}}}');var s=i(19204),l=i(12399),d=i(29169),c=i(22146),u=i(54996),m=i(84910),h=i(28179),p=i(14956);function g(e,t){return{id:e,name:t,position:[0,.9,0],rotation:[0,0,0],size:2.4,resolution:512}}function f(e,t){if("string"==typeof t&&"sheet"!==t)return{width:e.resolution,height:e.resolution};let{width:i,height:n}=(0,p.u)(e.resolution,"string"==typeof t?c.em:t);return{width:i,height:n}}function y(e,t,i){let n=(0,h.bh)(t),a=new m.NRn,r=(0,l.b5)(e.rotation).invert(),o=new m.Pq0;try{n.traverse(e=>{if(!(e instanceof m.eaF))return;let t=String(e.userData.modelPart??"");if("hands"===i&&!t.endsWith("-hand")&&!(0,d.dS)(t))return;let n=e.geometry.getAttribute("position");for(let t=0;t<n.count;t++)a.expandByPoint(o.fromBufferAttribute(n,t).applyMatrix4(e.matrixWorld).applyQuaternion(r))})}finally{(0,h.en)(n)}if(a.isEmpty())return e;let s=a.getSize(new m.Pq0);return{...e,position:a.getCenter(new m.Pq0).applyQuaternion((0,l.b5)(e.rotation)).toArray(),size:Math.max(.05,1.15*Math.max(s.x,s.y,s.z))}}let x=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://yisi.local/schemas/spatial-operations.schema.json","type":"array","maxItems":100,"items":{"oneOf":[{"type":"object","additionalProperties":false,"required":["type","enabled"],"properties":{"type":{"const":"set-lighting"},"enabled":{"type":"boolean"}}},{"type":"object","additionalProperties":false,"required":["type","id","name"],"properties":{"type":{"const":"add-character"},"id":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string","minLength":1,"maxLength":200},"height":{"type":"number","minimum":0.2,"maximum":20},"headRatio":{"type":"number","minimum":2,"maximum":12},"torsoRatio":{"type":"number","minimum":0.3,"maximum":0.7},"bodyType":{"enum":["male","female"]},"neckLength":{"type":"number","minimum":0.6,"maximum":1.4},"palmSize":{"type":"number","minimum":0.7,"maximum":1.3},"fingerLength":{"type":"number","minimum":0.6,"maximum":1.4},"footSize":{"type":"number","minimum":0.7,"maximum":1.4},"appearance":{"enum":["quaternius","geometric"]}}},{"type":"object","additionalProperties":false,"required":["type","character"],"properties":{"type":{"const":"put-character"},"character":{"type":"object","additionalProperties":false,"required":["id","name","kind","position","rotation","height","headRatio","color","joints","bones","appearance"],"properties":{"id":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string","minLength":1,"maxLength":200},"kind":{"enum":["humanoid","custom"]},"position":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"rotation":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"height":{"type":"number","minimum":0.2,"maximum":20},"headRatio":{"type":"number","minimum":2,"maximum":12},"thumbLimitsVersion":{"const":2},"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"joints":{"type":"array","minItems":1,"maxItems":200,"items":{"type":"object","additionalProperties":false,"required":["id","name","parentId","offset","lockPosition","radius","terminal"],"properties":{"id":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string","minLength":1,"maxLength":200},"parentId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"offset":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"lockPosition":{"type":"boolean"},"radius":{"type":"number","exclusiveMinimum":0,"maximum":10},"terminal":{"type":"boolean"}}}},"bones":{"type":"array","maxItems":199,"items":{"type":"object","additionalProperties":false,"required":["id","name","startJointId","endJointId","rotation","restRotation","limits","lockRotation","modelPart"],"properties":{"id":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string","minLength":1,"maxLength":200},"startJointId":{"type":"string","minLength":1,"maxLength":100},"endJointId":{"type":"string","minLength":1,"maxLength":100},"rotation":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"restRotation":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"limits":{"type":"object","additionalProperties":false,"required":["min","max"],"properties":{"min":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"max":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}}}},"lockRotation":{"type":"boolean"},"modelPart":{"type":"string","minLength":1,"maxLength":100}}}},"appearance":{"enum":["quaternius","geometric"]},"torsoRatio":{"type":"number","minimum":0.3,"maximum":0.7},"bodyType":{"enum":["male","female"]},"neckLength":{"type":"number","minimum":0.6,"maximum":1.4},"palmSize":{"type":"number","minimum":0.7,"maximum":1.3},"fingerLength":{"type":"number","minimum":0.6,"maximum":1.4},"footSize":{"type":"number","minimum":0.7,"maximum":1.4},"note":{"type":"string"}}}}},{"type":"object","additionalProperties":false,"required":["type","characterId","sourceJointId","parentId","idPrefix","offset"],"properties":{"type":{"const":"add-limb"},"characterId":{"type":"string","minLength":1,"maxLength":100},"sourceJointId":{"type":"string","minLength":1,"maxLength":100},"parentId":{"type":"string","minLength":1,"maxLength":100},"idPrefix":{"type":"string","minLength":1,"maxLength":100},"offset":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}}}},{"type":"object","additionalProperties":false,"required":["type","characterId","height","headRatio"],"properties":{"type":{"const":"set-proportions"},"characterId":{"type":"string","minLength":1,"maxLength":100},"height":{"type":"number","minimum":0.2,"maximum":20},"headRatio":{"type":"number","minimum":2,"maximum":12},"torsoRatio":{"type":"number","minimum":0.3,"maximum":0.7},"bodyType":{"enum":["male","female"]},"neckLength":{"type":"number","minimum":0.6,"maximum":1.4},"palmSize":{"type":"number","minimum":0.7,"maximum":1.3},"fingerLength":{"type":"number","minimum":0.6,"maximum":1.4},"footSize":{"type":"number","minimum":0.7,"maximum":1.4}}},{"type":"object","additionalProperties":false,"required":["type","characterId","jointId","position"],"properties":{"type":{"const":"move-joint"},"characterId":{"type":"string","minLength":1,"maxLength":100},"jointId":{"type":"string","minLength":1,"maxLength":100},"position":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}}}},{"type":"object","additionalProperties":false,"required":["type","characterId","jointId","position"],"properties":{"type":{"const":"lock-joint"},"characterId":{"type":"string","minLength":1,"maxLength":100},"jointId":{"type":"string","minLength":1,"maxLength":100},"position":{"type":"boolean"}}},{"type":"object","additionalProperties":false,"required":["type","object"],"properties":{"type":{"const":"put-object"},"object":{"type":"object","additionalProperties":false,"required":["id","name","kind","position","rotation","size","color"],"properties":{"id":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string","minLength":1,"maxLength":200},"kind":{"enum":["box","sphere","plane"]},"position":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"rotation":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"size":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"note":{"type":"string"}}}}},{"type":"object","additionalProperties":false,"required":["type","camera"],"properties":{"type":{"const":"put-camera"},"camera":{"type":"object","additionalProperties":false,"required":["id","name","position","target","projection","fov","span","width","height","background"],"properties":{"id":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string","minLength":1,"maxLength":200},"position":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"target":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"projection":{"enum":["perspective","orthographic"]},"fov":{"type":"number","minimum":10,"maximum":120},"span":{"type":"number","minimum":0.1,"maximum":1000},"width":{"type":"integer","minimum":128,"maximum":2048},"height":{"type":"integer","minimum":128,"maximum":2048},"background":{"anyOf":[{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},{"type":"null"}]},"note":{"type":"string"}}}}},{"type":"object","additionalProperties":false,"required":["type","id"],"properties":{"type":{"const":"remove"},"id":{"type":"string","minLength":1,"maxLength":100}}},{"type":"object","additionalProperties":false,"required":["type","characterId","boneId","rotation"],"properties":{"type":{"const":"rotate-bone"},"characterId":{"type":"string","minLength":1,"maxLength":100},"boneId":{"type":"string","minLength":1,"maxLength":100},"rotation":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}}}},{"type":"object","additionalProperties":false,"required":["type","characterId","boneId","rotation"],"properties":{"type":{"const":"lock-bone"},"characterId":{"type":"string","minLength":1,"maxLength":100},"boneId":{"type":"string","minLength":1,"maxLength":100},"rotation":{"type":"boolean"}}},{"type":"object","additionalProperties":false,"required":["type","characterId","boneId","limits"],"properties":{"type":{"const":"set-bone-limits"},"characterId":{"type":"string","minLength":1,"maxLength":100},"boneId":{"type":"string","minLength":1,"maxLength":100},"limits":{"type":"object","additionalProperties":false,"required":["min","max"],"properties":{"min":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"max":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}}}}}},{"type":"object","additionalProperties":false,"required":["type","characterId"],"properties":{"type":{"const":"reset-pose"},"characterId":{"type":"string","minLength":1,"maxLength":100}}},{"type":"object","additionalProperties":false,"required":["type","characterId","handBoneId"],"properties":{"type":{"const":"pose-hand"},"characterId":{"type":"string","minLength":1,"maxLength":100},"handBoneId":{"type":"string","minLength":1,"maxLength":100},"curl":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"thumb":{"type":"number","minimum":0,"maximum":1},"index":{"type":"number","minimum":0,"maximum":1},"middle":{"type":"number","minimum":0,"maximum":1},"ring":{"type":"number","minimum":0,"maximum":1},"little":{"type":"number","minimum":0,"maximum":1}}},"spread":{"type":"number","minimum":0,"maximum":1},"thumbOpposition":{"type":"number","minimum":0,"maximum":1}},"anyOf":[{"required":["curl"]},{"required":["spread"]},{"required":["thumbOpposition"]}]},{"type":"object","additionalProperties":false,"required":["type","characterId","handBoneId"],"properties":{"type":{"const":"reset-hand"},"characterId":{"type":"string","minLength":1,"maxLength":100},"handBoneId":{"type":"string","minLength":1,"maxLength":100}}},{"type":"object","additionalProperties":false,"required":["type","box"],"properties":{"type":{"const":"put-camera-box"},"box":{"type":"object","additionalProperties":false,"required":["id","name","position","rotation","size","resolution"],"properties":{"id":{"type":"string","minLength":1,"maxLength":100},"name":{"type":"string","minLength":1,"maxLength":200},"position":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"rotation":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"number","minimum":-10000,"maximum":10000}},"size":{"type":"number","minimum":0.05,"maximum":1000},"resolution":{"type":"integer","minimum":128,"maximum":1024},"note":{"type":"string"}}}}},{"type":"object","additionalProperties":false,"required":["type","id","region"],"properties":{"type":{"const":"fit-camera-box"},"id":{"type":"string","minLength":1,"maxLength":100},"region":{"enum":["scene","hands"]}}}]}}'),b=new n.Ajv2020({allErrors:!0}).compile(x),v=new n.Ajv2020({allErrors:!0}).compile(o),w={min:.3,max:.7},j=e=>1-(e.parts[0].start[1]-e.bottom)/(e.parts.find(e=>"head"===e.id).start[1]-e.bottom),k=j(a);class S extends Error{constructor(...e){super(...e),this.code="SPATIAL_CONSTRAINT"}}function I(e="camera-1",t="Camera 1"){return{id:e,name:t,position:[3,2.2,5],target:[0,.9,0],projection:"perspective",fov:40,span:3.2,width:1200,height:900,background:null}}function C(){return{version:2,kind:"spatial-draft",lightingEnabled:!1,characters:[],objects:[],cameras:[I()]}}function P(e,t,i=1.8,n=7,o=k,s="male",c={}){let m="female"===s?r:a,h=j(m),p=i-i/n,g=[{id:"pelvis",name:"pelvis",parentId:null,offset:[0,0,0],radius:.027*i,lockPosition:!1,terminal:!1}],f=[],y=(e,t,n,a,r,o=!1)=>{g.push({id:e,name:e,parentId:t,offset:n,radius:.025*i,lockPosition:!1,terminal:o}),f.push({id:e,name:e,startJointId:t,endJointId:e,rotation:[0,0,0],restRotation:[0,0,0],limits:{min:a,max:r},lockRotation:!1,modelPart:e})};for(let[e,t]of(y("spine","pelvis",[0,.16*p,0],[-35,-35,-30],[45,35,30]),y("chest","spine",[0,.17*p,0],[-25,-40,-25],[25,40,25]),y("neck","chest",[0,.15*p,0],[-35,-45,-30],[35,45,30]),y("head","neck",[0,i/n,0],[-30,-45,-20],[30,45,20],!0),[["left",1],["right",-1]]))y(`${e}-shoulder`,"chest",[t*p*.14,0,0],[0,0,0],[0,0,0]),y(`${e}-elbow`,`${e}-shoulder`,[t*p*.07,-(.2*p),0],[-160,-90,-100],[160,90,100]),y(`${e}-wrist`,`${e}-elbow`,[t*p*.03,-(.2*p),0],[-150,-10,-10],[0,10,10]),y(`${e}-hand`,`${e}-wrist`,[t*p*.02,-(.09*p),0],[-70,-80,-30],[70,80,30]),y(`${e}-hip`,"pelvis",[t*p*.085,0,0],[0,0,0],[0,0,0]),y(`${e}-knee`,`${e}-hip`,[0,-(.25*p),0],[-120,-45,-45],[40,45,45]),y(`${e}-ankle`,`${e}-knee`,[0,-(.25*p),0],[0,-10,-10],[150,10,10]),y(`${e}-foot`,`${e}-ankle`,[0,-(.02*p),.09*p],[-35,-25,-20],[45,25,20],!0);let x=p/(m.parts.find(e=>"head"===e.id).start[1]-m.bottom);for(let e of g.filter(e=>e.parentId)){let t=m.parts.find(t=>t.id===e.id);if(e.offset=t.end.map((e,i)=>(e-t.start[i])*x),"head"===e.id&&(e.offset=[0,i/n,0]),/-(elbow|wrist|hand)$/.test(e.id)){let t=e.id.startsWith("left")?1:-1;e.offset=[t*(0,l.i1)(e.offset).length()*.342,-(.9397*(0,l.i1)(e.offset).length()),0]}}let b=(0,l.i1)(g.find(e=>"left-knee"===e.id).offset).add((0,l.i1)(g.find(e=>"left-ankle"===e.id).offset)),v=1+-(p*(h-o)/b.y),w=1+p*(o-h)/(g.find(e=>"spine"===e.id).offset[1]+g.find(e=>"chest"===e.id).offset[1]),S=(0,l.i1)([0,(m.parts[0].start[1]-m.bottom)*x,0]).addScaledVector(b,1-v);for(let e of g){let t=["spine","chest"].includes(e.id)?w:/-(knee|ankle)$/.test(e.id)?v:1;e.offset=e.offset.map(e=>e*t)}let I={id:e,name:t,kind:"humanoid",position:S.toArray(),rotation:[0,0,0],height:i,headRatio:n,torsoRatio:o,bodyType:s,thumbLimitsVersion:2,color:"#b2a090",joints:g,bones:f,appearance:c.appearance??"quaternius"};for(let e of Object.keys(u.aY))void 0!==c[e]&&(I[e]=c[e]);for(let e of[...f].filter(e=>e.modelPart.endsWith("-hand")))g.find(t=>t.id===e.endJointId).radius=.01*i,(0,d.jp)(I,e);return I}function L(e){if(!v(e))throw Error(`SPATIAL_INVALID: ${v.errors?.map(e=>`${e.instancePath} ${e.message}`).join("; ")}`);let t=structuredClone(e),i=[...t.characters,...t.objects,...t.cameras,...t.cameraBoxes??[]].map(e=>e.id);if(new Set(i).size!==i.length)throw Error("SPATIAL_INVALID: duplicate object id");for(let e of t.characters){if((0,d.Rq)(e),(0,d.cy)(e),new Set(e.joints.map(e=>e.id)).size!==e.joints.length||1!==e.joints.filter(e=>null===e.parentId).length)throw Error("SPATIAL_INVALID: skeleton must have unique joints and one root");let t=e.joints.filter(e=>e.parentId);if(e.bones.length!==t.length||new Set(e.bones.map(e=>e.id)).size!==e.bones.length||new Set(e.bones.map(e=>e.endJointId)).size!==t.length)throw Error("SPATIAL_INVALID: each non-root joint requires one unique incoming bone");for(let t of e.bones){let i=e.joints.find(e=>e.id===t.endJointId);if(!i||!i.parentId||i.parentId!==t.startJointId)throw Error("SPATIAL_INVALID: bone endpoints differ from joint hierarchy");for(let e of[0,1,2])if(t.limits.min[e]>t.limits.max[e]||[t.rotation[e],t.restRotation[e]].some(i=>i<t.limits.min[e]-1e-7||i>t.limits.max[e]+1e-7))throw new S(`Bone angle outside limits: ${t.id}`)}let i=(0,l.ms)(e);for(let t of e.joints){if(t.parentId&&1e-4>(0,l.i1)(t.offset).length())throw Error("SPATIAL_INVALID: zero bone length");if(!i[t.id].position.toArray().every(Number.isFinite))throw Error("SPATIAL_INVALID: non-finite transform")}if("humanoid"===e.kind){let t=P(e.id,e.name,e.height,e.headRatio,e.torsoRatio,e.bodyType);if(e.joints.length!==t.joints.length)throw Error("SPATIAL_INVALID: humanoid structure changed without custom morphology");for(let i of t.bones){let t=e.bones.find(e=>e.id===i.id);if(!t||t.endJointId!==i.endJointId||t.modelPart!==i.modelPart||(0,s.d)(t.restRotation)!==(0,s.d)(i.restRotation))throw Error("SPATIAL_INVALID: modified standard bone anatomy")}for(let i of t.joints){let t=e.joints.find(e=>e.id===i.id);if(!t||t.parentId!==i.parentId||t.offset.some((e,t)=>Math.abs(e-i.offset[t])>1e-10))throw Error("SPATIAL_INVALID: modified standard humanoid anatomy")}}}for(let e of t.objects)if(e.size.some(e=>e<=0))throw Error("SPATIAL_INVALID: positive object dimensions required");for(let e of t.cameras)if(.01>(0,l.i1)(e.position).distanceTo((0,l.i1)(e.target)))throw Error("SPATIAL_INVALID: camera target equals position");return t}function A(e){return(0,s.U)((0,s.d)(L(e)))}function M(e,t){if(!b(t))throw Error("SPATIAL_INVALID: invalid operations");let i=L(e),n=!1;if(!Array.isArray(t)||t.length>100)throw Error("SPATIAL_INVALID: operations must be a bounded array");for(let e of t){let t=structuredClone(i),a="characterId"in e?i.characters.find(t=>t.id===e.characterId):void 0;if("characterId"in e&&!a)throw Error("SPATIAL_INVALID: unknown character");switch(e.type){case"set-lighting":i.lightingEnabled=e.enabled;break;case"add-character":i.characters.push(P(e.id,e.name,e.height,e.headRatio,e.torsoRatio,e.bodyType,e));break;case"put-character":{let t=i.characters.findIndex(t=>t.id===e.character.id);t<0?i.characters.push(structuredClone(e.character)):i.characters[t]=structuredClone(e.character);break}case"add-limb":{if(!a.joints.some(t=>t.id===e.parentId))throw Error("SPATIAL_INVALID: unknown limb attachment");let t=a.joints.find(t=>t.id===e.sourceJointId);if(!t||!t.parentId)throw Error("SPATIAL_INVALID: source limb must have an upstream joint");let i=[t];for(let e=0;e<i.length;e++)i.push(...a.joints.filter(t=>t.parentId===i[e].id));a.kind="custom";let n=new Set(i.map(e=>e.id)),r=a.bones.filter(e=>n.has(e.endJointId));a.joints.push(...i.map((t,i)=>({...structuredClone(t),id:`${e.idPrefix}-${t.id}`,name:`${e.idPrefix} ${t.name}`,parentId:0===i?e.parentId:`${e.idPrefix}-${t.parentId}`,offset:0===i?e.offset:[...t.offset],lockPosition:!1}))),a.bones.push(...r.map(i=>({...structuredClone(i),id:`${e.idPrefix}-${i.id}`,name:`${e.idPrefix} ${i.name}`,startJointId:i.endJointId===t.id?e.parentId:`${e.idPrefix}-${i.startJointId}`,endJointId:`${e.idPrefix}-${i.endJointId}`,lockRotation:!1})));break}case"set-proportions":{let t=e.torsoRatio??a.torsoRatio??k,i=e.bodyType??a.bodyType??"male",n=P(a.id,a.name,a.height,a.headRatio,a.torsoRatio,a.bodyType),r=P(a.id,a.name,e.height,e.headRatio,t,i);if("humanoid"===a.kind)a.joints=r.joints.map(e=>({...a.joints.find(t=>t.id===e.id),offset:e.offset,radius:e.radius}));else for(let t of a.joints){let i=a.bones.find(e=>e.endJointId===t.id)?.modelPart,o=n.joints.find(e=>e.id===i),s=r.joints.find(e=>e.id===i),d=o?.parentId&&s?(0,l.i1)(s.offset).length()/(0,l.i1)(o.offset).length():e.height/a.height;t.offset=t.offset.map(e=>e*d),t.radius*=e.height/a.height}for(let o of(a.position=(0,l.i1)(a.position).add((0,l.i1)(r.position).sub((0,l.i1)(n.position)).applyQuaternion((0,l.b5)(a.rotation))).toArray(),a.height=e.height,a.headRatio=e.headRatio,a.torsoRatio=t,a.bodyType=i,Object.keys(u.aY)))void 0!==e[o]&&(a[o]=e[o]);break}case"lock-joint":{let t=a.joints.find(t=>t.id===e.jointId);if(!t)throw Error("SPATIAL_INVALID: unknown joint");void 0!==e.position&&(t.lockPosition=e.position);break}case"reset-pose":a.joints.forEach(e=>{e.lockPosition=!1}),a.bones.forEach(e=>{e.rotation=[...e.restRotation],e.lockRotation=!1});break;case"pose-hand":case"reset-hand":{let t=a.bones.find(t=>t.id===e.handBoneId&&t.modelPart.endsWith("-hand"));if(!t)throw Error("SPATIAL_INVALID: unknown hand");let i=(0,d.Au)(a,t);if("reset-hand"===e.type)a.joints.filter(e=>i.has(e.id)).forEach(e=>{e.lockPosition=!1}),a.bones.filter(e=>i.has(e.endJointId)).forEach(e=>{e.rotation=[...e.restRotation],e.lockRotation=!1});else for(let r of d.EG){if(e.curl?.[r]===void 0&&(void 0===e.spread||"thumb"===r)&&(void 0===e.thumbOpposition||"thumb"!==r))continue;let o=a.bones.filter(e=>i.has(e.endJointId)&&(0,d.dS)(e.modelPart)?.finger===r);if(4!==o.length)throw Error("SPATIAL_INVALID: incomplete finger");for(let i of o){let a=(0,d.dS)(i.modelPart).segment;if(!a)continue;let o=[...i.rotation],s=e.curl?.[r],l=t.modelPart.startsWith("left")?1:-1;void 0!==s&&("thumb"===r&&3===a?(o[0]=0,o[2]=-l*s*(0,d.oq)(r)[a-1]):o[0]=s*(0,d.oq)(r)[a-1]),1===a&&void 0!==e.spread&&"thumb"!==r&&(o[2]=e.spread*d.zK[r]*l),1===a&&void 0!==e.thumbOpposition&&"thumb"===r&&(o[1]=60*e.thumbOpposition*l,o[2]=-30*e.thumbOpposition*l);let c=o.map((e,t)=>Math.max(i.limits.min[t],Math.min(i.limits.max[t],e)));n||=c.some((e,t)=>e!==o[t]),i.rotation=c}}break}case"lock-bone":case"set-bone-limits":{let t=a.bones.find(t=>t.id===e.boneId);if(!t)throw Error("SPATIAL_INVALID: unknown bone");"lock-bone"===e.type?t.lockRotation=e.rotation:t.limits=structuredClone(e.limits);break}case"move-joint":case"rotate-bone":{let t="rotate-bone"===e.type?a.bones.find(t=>t.id===e.boneId):void 0;if("rotate-bone"===e.type&&!t)throw Error("SPATIAL_INVALID: unknown bone");if(t&&(0,l.j4)(t)&&"rotate-bone"===e.type){n||=e.rotation.some((e,i)=>e!==t.rotation[i]);break}let r="rotate-bone"===e.type?e.rotation.map((e,i)=>Math.max(t.limits.min[i],Math.min(t.limits.max[i],e))):void 0;r&&"rotate-bone"===e.type&&(n||=r.some((t,i)=>t!==e.rotation[i]));let o=t?(0,l.ms)(a):void 0,s="move-joint"===e.type?{position:e.position}:{rotation:(0,l.bl)(o[t.startJointId].rotation.clone().multiply((0,l.pT)(a,t,r)))},d=(0,l.uO)(a,"move-joint"===e.type?e.jointId:t.endJointId,s);if(i.characters[i.characters.indexOf(a)]=d.character,n||=d.constrained,t&&r){let e=d.character.bones.find(e=>e.id===t.id);n||=(0,l.b5)(e.rotation).angleTo((0,l.b5)(r))>.005}break}case"put-object":{let t=i.objects.findIndex(t=>t.id===e.object.id);t<0?i.objects.push(structuredClone(e.object)):i.objects[t]=structuredClone(e.object);break}case"put-camera":{let t=i.cameras.findIndex(t=>t.id===e.camera.id);t<0?i.cameras.push(structuredClone(e.camera)):i.cameras[t]=structuredClone(e.camera);break}case"put-camera-box":{let t=i.cameraBoxes??=[],n=t.findIndex(t=>t.id===e.box.id);n<0?t.push(structuredClone(e.box)):t[n]=structuredClone(e.box);break}case"fit-camera-box":{let t=i.cameraBoxes?.findIndex(t=>t.id===e.id)??-1;if(t<0)throw Error("SPATIAL_INVALID: camera box not found");i.cameraBoxes[t]=y(i.cameraBoxes[t],i,e.region);break}case"remove":i.characters=i.characters.filter(t=>t.id!==e.id),i.objects=i.objects.filter(t=>t.id!==e.id),i.cameras=i.cameras.filter(t=>t.id!==e.id),i.cameraBoxes&&(i.cameraBoxes=i.cameraBoxes.filter(t=>t.id!==e.id));break;default:throw Error("SPATIAL_INVALID: unknown operation")}!function(e,t,i={}){for(let n of e.characters){let e=t.characters.find(e=>e.id===n.id);if(!e)continue;let a=(0,l.ms)(n),r=(0,l.ms)(e);for(let t of n.joints){let i=e.joints.find(e=>e.id===t.id);if(i&&t.lockPosition&&i.lockPosition&&a[t.id].position.distanceTo(r[t.id].position)>1e-5)throw new S(`Fixed world position changed: ${t.id}`)}for(let t of n.bones){let o=e.bones.find(e=>e.id===t.id);if(o&&(0,l.j4)(t)){let e=i.resetPoseCharacterId===n.id&&(0,s.d)(o.rotation)===(0,s.d)(t.restRotation);if(o.modelPart!==t.modelPart||(0,s.d)(o.restRotation)!==(0,s.d)(t.restRotation)||!e&&(0,s.d)(o.rotation)!==(0,s.d)(t.rotation))throw new S(`Rigid connector rotation changed: ${t.id}`);if((0,s.d)(o.limits)!==(0,s.d)(t.limits))throw new S(`Rigid connector angle bounds changed: ${t.id}`)}if(o&&!i.allowLimitChanges&&(0,s.d)(o.limits)!==(0,s.d)(t.limits))throw new S(`Use set-bone-limits to change angle bounds: ${t.id}`);if(t.lockRotation&&o?.lockRotation&&a[t.endJointId].rotation.angleTo(r[o.endJointId].rotation)>1e-5)throw new S(`Fixed world rotation changed: ${t.id}`)}}}(t,i=L(i),{allowLimitChanges:"set-bone-limits"===e.type,resetPoseCharacterId:"reset-pose"===e.type?e.characterId:void 0})}return{draft:i,constrained:n}}},21449:()=>{},21755:(e,t,i)=>{"use strict";i.d(t,{_:()=>a});var n=i(1521);function a(e){return function(t){let[i,a]=(0,n.useOptimistic)(t.value);return(0,n.createElement)(e,{...t,value:i,onChange:e=>{let i=e.target.value;(0,n.startTransition)(()=>{a(i),t.onChange?.(e)})}})}}},22146:(e,t,i)=>{"use strict";i.d(t,{Sn:()=>a,eJ:()=>r,em:()=>n,mw:()=>o});let n=["front","back","left","right","top","bottom"],a=28,r=12,o=["color","structure","depth","skeleton"]},22392:()=>{},23347:(e,t,i)=>{"use strict";i.d(t,{NT:()=>r,SZ:()=>l,sZ:()=>s});var n=i(84910),a=i(12399);let r=e=>new n.kn4().compose((0,a.i1)(e.position),(0,a.b5)(e.rotation),new n.Pq0(1,1,1)),o=e=>e instanceof n.eaF||e instanceof n.DXC;function s(e,t){let i=[],n=[];return e.traverse(e=>i.push(e)),t.traverse(e=>n.push(e)),!(i.length!==n.length||i.some((e,t)=>{let i=n[t];return e.type!==i.type||JSON.stringify(e.userData)!==JSON.stringify(i.userData)||!!o(e)&&!!o(i)&&(e.geometry.getAttribute("position").count!==i.geometry.getAttribute("position").count||e.geometry.index?.count!==i.geometry.index?.count||Object.entries(i.geometry.attributes).some(([t,i])=>e.geometry.getAttribute(t)?.array.length!==i.array.length))}))&&(i.forEach((e,t)=>{let i=n[t];if(e.position.copy(i.position),e.quaternion.copy(i.quaternion),e.scale.copy(i.scale),e.matrixAutoUpdate=i.matrixAutoUpdate,e.matrix.copy(i.matrix),o(e)&&o(i)){for(let[t,n]of Object.entries(i.geometry.attributes)){let i=e.geometry.getAttribute(t);i.array.set(n.array),i.needsUpdate=!0}e.geometry.index&&i.geometry.index&&(e.geometry.index.array.set(i.geometry.index.array),e.geometry.index.needsUpdate=!0),e.geometry.boundingBox=null,e.geometry.boundingSphere=null,Array.isArray(e.material)||Array.isArray(i.material)||e.material.copy(i.material)}}),!0)}function l(e,t){e.traverse(e=>{e instanceof n.eaF&&e.material instanceof n.G_z&&t.set(e,e.material.color.clone())})}},27812:(e,t,i)=>{"use strict";i.d(t,{Se:()=>l,cq:()=>n,cw:()=>s,h_:()=>a});let n="[data-yisiui-asset][data-yisiui-name][data-yisiui-category]",a="[aria-modal='true'], [data-yisiui-inspection-layer='blocking']",r=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,o=/^[A-Z][A-Za-z0-9]+$/;function s(e){let[t,i,...n]=e.split("/");return 0===n.length&&!!t&&!!i&&r.test(t)&&r.test(i)}function l(e){if(!r.test(e.namespace))throw Error(`Invalid YisiUI asset namespace: ${e.namespace}`);if(!r.test(e.id))throw Error(`Invalid YisiUI asset id: ${e.id}`);if(!o.test(e.name))throw Error(`Invalid YisiUI asset name: ${e.name}`);if(!e.category.trim())throw Error("YisiUI asset category must not be empty");return{"data-yisiui-asset":`${e.namespace}/${e.id}`,"data-yisiui-name":e.name,"data-yisiui-category":e.category,"data-yisiui-origin":e.origin,"data-yisiui-status":e.status}}},28179:(e,t,i)=>{"use strict";i.d(t,{Ls:()=>s,bh:()=>l,en:()=>u,yz:()=>d});var n=i(84910),a=i(96826),r=i(12399),o=i(29169);function s(e){let t=e.width/e.height,i="orthographic"===e.projection?new n.qUd(-e.span*t/2,e.span*t/2,e.span/2,-e.span/2,.01,3e4):new n.ubm(e.fov,t,.01,3e4);return i.position.copy((0,r.i1)(e.position)),i.lookAt((0,r.i1)(e.target)),i.updateMatrixWorld(),i}function l(e,t={}){let i=new n.YJl,o=(e,t,a,r,o,s=new n.Pq0(1,1,1))=>{let l=new n.eaF(e,new n.G_z({color:new n.Q1f(t),side:n.$EB}));return l.position.copy(a),l.quaternion.copy(r),l.scale.copy(s),l.userData=o,i.add(l),l};for(let n of e.characters)i.add((0,a.d)(n,t)),t.showRig&&"geometric"!==n.appearance&&d(i,n);for(let t of e.objects){let e=(0,r.i1)(t.size),i="sphere"===t.kind?new n.Gu$(.5,16,12):new n.iNn(1,1,1);"plane"===t.kind&&(e.y=.015),o(i,t.color,(0,r.i1)(t.position),(0,r.b5)(t.rotation),{objectId:t.id},e)}return i.updateMatrixWorld(!0),i}function d(e,t,i=!1){let a=function(e){let t=(0,r.ms)(e),i=[];for(let a of e.joints.filter(t=>!t.terminal||!!(0,o.dS)(e.bones.find(e=>e.endJointId===t.id)?.modelPart??"")))i.push({data:{characterId:e.id,rig:"joint",jointId:a.id},position:t[a.id].position,rotation:t[a.id].rotation,scale:new n.Pq0().setScalar(a.radius)});for(let a of e.bones){let r=(0,o.dS)(a.modelPart);if(r?.segment===0)continue;let s=t[a.startJointId].position,l=t[a.endJointId].position,d=l.clone().sub(s),c=d.length(),u=e.height*(r?.0018:.009);i.push({data:{characterId:e.id,rig:"bone",boneId:a.id},position:s.clone().add(l).multiplyScalar(.5),rotation:new n.PTz().setFromUnitVectors(new n.Pq0(0,1,0),d.normalize()),scale:new n.Pq0(u,c,u)})}return i}(t);if(i){let i=new n.kn4;for(let r of["joint","bone"]){let o=a.filter(e=>e.data.rig===r),s=e.children.find(e=>e instanceof n.ZLX&&e.userData.characterId===t.id&&e.userData.rig===r);s&&s.count!==o.length&&(e.remove(s),u(new n.YJl().add(s)),s=void 0),s||((s=new n.ZLX(c(r),new n.G_z({side:n.$EB,depthTest:!1}),o.length)).renderOrder=2,e.add(s)),s.userData={characterId:t.id,rig:r,instances:o.map(e=>e.data)};let l=new n.Q1f("joint"===r?"#e6a65c":"#728aa1");o.forEach((e,t)=>{s.setMatrixAt(t,i.compose(e.position,e.rotation,e.scale)),s.setColorAt(t,l)}),s.instanceMatrix.needsUpdate=!0,s.instanceColor&&(s.instanceColor.needsUpdate=!0),s.computeBoundingSphere()}return}let s=new Map(e.children.filter(e=>e.userData.rig&&e.userData.characterId===t.id).map(e=>[`${e.userData.rig}/${e.userData.jointId??e.userData.boneId}`,e])),l=(i,a)=>{let r=`${i}/${a}`,o=s.get(r);return s.delete(r),o||((o=new n.eaF(c(i),new n.G_z({side:n.$EB,depthTest:!1}))).userData={characterId:t.id,rig:i,["joint"===i?"jointId":"boneId"]:a},o.renderOrder=2,e.add(o)),o.material.color.set("joint"===i?"#e6a65c":"#728aa1"),o};for(let e of a){let t=l(e.data.rig,e.data.jointId??e.data.boneId);t.position.copy(e.position),t.quaternion.copy(e.rotation),t.scale.copy(e.scale)}for(let t of s.values())e.remove(t),t.geometry.dispose(),t.material.dispose()}let c=e=>"joint"===e?new n.Gu$(1,12,8):new n.Ho_(1,1,1,10);function u(e){e.traverse(e=>{if(e instanceof n.eaF||e instanceof n.DXC)for(let t of(e instanceof n.ZLX&&e.dispose(),e.geometry.dispose(),Array.isArray(e.material)?e.material:[e.material]))t.dispose()})}},29169:(e,t,i)=>{"use strict";i.d(t,{Au:()=>x,EG:()=>s,IA:()=>f,Jf:()=>p,PA:()=>g,Rq:()=>v,Yu:()=>c,cy:()=>m,dS:()=>l,jp:()=>b,oT:()=>h,oq:()=>w,t6:()=>d,xT:()=>y,zK:()=>j});var n=i(84910),a=i(2872),r=i(79283),o=i(54996);let s=["thumb","index","middle","ring","little"];function l(e){let t=/^(left|right)-(thumb|index|middle|ring|little)-([0-3])$/.exec(e);return t?{side:t[1],finger:t[2],segment:Number(t[3])}:null}let d=e=>e.endsWith("-hand")||!!l(e),c=e=>"female"===e.bodyType?r:a;function u(e,t){return 2===t?{min:[0,0,-45],max:[110,0,45]}:{min:[0,0,"left"===e?-90:0],max:[0,0,90*("left"!==e)]}}function m(e){if(2!==e.thumbLimitsVersion){for(let t of e.bones){let e=l(t.modelPart);if(e?.finger!=="thumb"||e.segment<2)continue;let i=[2===e.segment?110:90,0,0];t.limits.min.every(e=>0===e)&&t.limits.max.every((e,t)=>e===i[t])&&([t.rotation,t.restRotation].some(e=>e.some((e,t)=>e<0||e>i[t]))||(t.limits=u(e.side,e.segment),3===e.segment&&(t.limits.max[0]=Math.max(t.rotation[0],t.restRotation[0]))))}e.thumbLimitsVersion=2}}function h(e,t){let i=t;for(;i;){if(i.modelPart.endsWith("-hand"))return i;i=e.bones.find(e=>e.endJointId===i.startJointId)}}function p(e,t,i=!0){let a=c(e),r=a.parts.find(e=>e.id===t.modelPart),s=new n.Pq0(...r.end).sub(new n.Pq0(...r.start)),l=new n.Pq0(...e.joints.find(e=>e.id===t.endJointId).offset),d=l.length()/s.length(),u=(0,o.G_)(e.headRatio),m=i?e.palmSize??1:1,h=i?e.height/a.height*u.hand*m:d,g=new n.Pq0(0,1,0);return new n.kn4().compose(new n.Pq0,new n.PTz().setFromUnitVectors(g,l.normalize()),new n.Pq0(h,d*(i?u.handLength:1)*m,h)).multiply(new n.kn4().makeRotationFromQuaternion(new n.PTz().setFromUnitVectors(g,s.normalize()).invert()))}function g(e,t,i){let a=p(e,t);if(l(i)?.segment===0||(e.fingerLength??1)===(e.palmSize??1))return a;let r=c(e).parts.find(e=>e.id===i),o=new n.Pq0(...r.end).sub(new n.Pq0(...r.start)).normalize(),s=new n.kn4().makeRotationFromQuaternion(new n.PTz().setFromUnitVectors(new n.Pq0(0,1,0),o));return a.multiply(s).multiply(new n.kn4().makeScale(1,(e.fingerLength??1)/(e.palmSize??1),1)).multiply(s.clone().invert())}function f(e,t){let i=l(t.modelPart),a=i&&h(e,t);if(!i||!a||0===i.segment)return new n.PTz;let r=c(e).parts.find(e=>e.id===t.modelPart),o=new n.Pq0(...r.end).sub(new n.Pq0(...r.start)).normalize(),s=o.clone().cross(new n.Pq0(0,-1,0)).normalize(),d=s.clone().cross(o).normalize(),u=p(e,a,!1);return new n.PTz().setFromRotationMatrix(new n.kn4().makeBasis(s.transformDirection(u),o.transformDirection(u),d.transformDirection(u)))}function y(e,t,i){let a=e.bones.find(e=>e.endJointId===t.id).modelPart,r=g(e,i,a).multiply(p(e,i,!1).invert());return new n.Pq0(...t.offset).applyMatrix4(r)}function x(e,t){let i=new Set([t.endJointId]);for(let t of i)for(let n of e.joints.filter(e=>e.parentId===t))i.add(n.id);return i}function b(e,t){let i=c(e),a=p(e,t,!1),r=t.id.endsWith(t.modelPart)?t.id.slice(0,-t.modelPart.length):`${t.id}-`,o=t.modelPart.startsWith("left")?"left":"right";for(let l of s)for(let s=0;s<4;s++){let d=`${o}-${l}-${s}`,c=`${r}${d}`,m=i.parts.find(e=>e.id===d),h=s?`${r}${o}-${l}-${s-1}`:t.endJointId,p=new n.Pq0(...m.end).sub(new n.Pq0(...m.start)).applyMatrix4(a).toArray(),g=0===s?[0,0,0]:1===s?[-10,"thumb"===l?-70:0,"thumb"===l?-35:-20]:[0,0,0],f=0===s?[0,0,0]:1===s?[95,70*("thumb"===l),"thumb"===l?35:20]:[2===s?110:90,0,0];e.joints.push({id:c,name:c,parentId:h,offset:p,radius:.004*e.height,terminal:3===s,lockPosition:!1});let y="thumb"===l&&s>=2?u(o,s):{min:g,max:f};e.bones.push({id:c,name:c,startJointId:h,endJointId:c,rotation:[0,0,0],restRotation:[0,0,0],limits:y,lockRotation:!1,modelPart:d})}}function v(e){for(let t of e.bones.filter(e=>"left-hand"===e.modelPart||"right-hand"===e.modelPart)){let i=e.joints.find(e=>e.id===t.endJointId);if(!i?.terminal||e.joints.some(e=>e.parentId===i.id))continue;i.offset=i.offset.map(e=>.35*e),i.terminal=!1,i.radius=.01*e.height;let n=i.lockPosition;if(i.lockPosition=!1,b(e,t),n){let i=e.bones.find(i=>i.modelPart===t.modelPart.replace("hand","middle-3")&&x(e,t).has(i.endJointId));e.joints.find(e=>e.id===i.endJointId).lockPosition=!0}}}let w=e=>"thumb"===e?[35,50,55]:[70,95,65],j={thumb:0,index:16,middle:4,ring:-7,little:-18}},29415:(e,t,i)=>{"use strict";i.d(t,{J:()=>c});var n=i(73365),a=i(35659),r=i(1521);i(22392),i(17053);var o=i(2684),s=i(46811),l=i(99791);function d(e){return String(l.L[e])}Object.keys(l.L).filter(e=>e.startsWith("color."));let c=(0,r.forwardRef)(function({children:e,icon:t,mode:i="without-icon",backgroundColor:l,textColor:c,iconLabel:u,style:m,"aria-label":h,...p},g){let f=(0,r.useRef)(null);(0,r.useImperativeHandle)(g,()=>f.current);let y=(0,r.useRef)(null),x=e??u??h,b=null!=x&&""!==x&&"boolean"!=typeof x,v="hover-text"===i&&null!=t&&!1!==t&&b,w="icon-only"===i||"hover-text"===i&&!b;(0,r.useLayoutEffect)(()=>{if(!v)return;let e=f.current,t=y.current;if(!e||!t)return;let i=()=>{let i=getComputedStyle(e),n=e=>Number.parseFloat(e)||0,a=e.offsetHeight;if(!a)return;let r=n(i.paddingLeft)+n(i.paddingRight),o=n(i.borderLeftWidth)+n(i.borderRightWidth),s=Math.max(a,Math.ceil(t.scrollWidth+r+o));for(let[t,i]of[["collapsed",a],["expanded",s]]){let n=`--yisiui-basic-button-${t}-width`,a=`${i}px`;e.style.getPropertyValue(n)!==a&&e.style.setProperty(n,a)}};i();let n="u"<typeof ResizeObserver?void 0:new ResizeObserver(i);return n?.observe(e),n?.observe(t),window.addEventListener("resize",i),document.fonts?.addEventListener("loadingdone",i),()=>{n?.disconnect(),window.removeEventListener("resize",i),document.fonts?.removeEventListener("loadingdone",i),e.style.removeProperty("--yisiui-basic-button-collapsed-width"),e.style.removeProperty("--yisiui-basic-button-expanded-width")}},[v,x,p.size,p.shape,p.className,m]);let j=(0,o.P)((0,s.S)("basic-button","BasicButton","component")),k={..."none"===l?{backgroundColor:"transparent",border:"none",boxShadow:"none"}:l?{backgroundColor:d(l),borderColor:d(l)}:{},...c&&"none"!==c?{color:d(c)}:{}},S="hover-text"===i?u??h??("string"==typeof x||"number"==typeof x?String(x):void 0):"icon-only"===i?u??h:h;return(0,n.jsx)(a.Ay,{...p,...j,ref:f,"aria-label":S,classNames:v?e=>{let t="function"==typeof p.classNames?p.classNames(e):p.classNames;return{...t,root:[t?.root,"yisi-basic-button-hover-text",e.props.disabled&&"yisi-basic-button-hover-disabled",e.props.loading&&"yisi-basic-button-hover-loading",e.props.block&&"yisi-basic-button-hover-block"].filter(Boolean).join(" "),icon:[t?.icon,"yisi-basic-button-hover-icon"].filter(Boolean).join(" ")}}:p.classNames,autoInsertSpace:!v&&p.autoInsertSpace,icon:"without-icon"===i?void 0:v?(0,n.jsx)("span",{"aria-hidden":"true",children:t}):t,style:{...k,...m},children:v?(0,n.jsx)("span",{ref:y,className:"yisi-basic-button-hover-label",children:x}):w?void 0:"hover-text"===i?x:e})})},33949:(e,t,i)=>{"use strict";function n(e,t,i){if(!e.some(e=>e.id===t))throw Error(`Unknown canvas state: ${t}.`);let n=i.trim();if(!n||n.length>100)throw Error("Canvas state name must contain 1 to 100 characters.");return e.map(e=>e.id===t?{...e,name:n}:e)}function a(e,t){let i=new Map(e.map(e=>[e.id,e]));if(t.length!==e.length||new Set(t).size!==e.length||t.some(e=>!i.has(e)))throw Error("Canvas state order must contain each state exactly once.");return t.map(e=>i.get(e))}function r(e,t){if(!e.some(e=>e.id===t))throw Error(`Unknown canvas state: ${t}.`);if(1===e.length)throw Error("A canvas must retain at least one state.");return e.filter(e=>e.id!==t)}i.d(t,{UR:()=>n,aD:()=>r,kq:()=>a})},34345:(e,t,i)=>{"use strict";i.d(t,{q:()=>r,u:()=>a});var n=i(76109);function a(e){return(0,n.EN)([...e.images,...e.areas,...e.directionLine?[e.directionLine]:[],...e.focusPoints].map(e=>e.id),e.layerOrder)}function r(e,t,i){let r=a(e),o=(0,n.qP)(r,t,i);return o===r?e:{...e,layerOrder:[...o]}}},34944:(e,t,i)=>{"use strict";i.d(t,{Xn:()=>w,xB:()=>k,JZ:()=>I,eq:()=>v,hN:()=>j,s6:()=>C,mq:()=>x,MY:()=>S,Pe:()=>L,vm:()=>M,Wn:()=>A,km:()=>ee,CP:()=>P,Ai:()=>D,oF:()=>N,CV:()=>T,co:()=>U,IU:()=>R,z_:()=>$,rz:()=>F,hG:()=>E,QQ:()=>q,ET:()=>O,ai:()=>z,QY:()=>B,s:()=>_,M6:()=>b,VC:()=>H,yg:()=>G});var n=i(34345),a=i(59793),r=i(27062);let o=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://yisi.local/schemas/composition-draft.schema.json","title":"User Composition Draft","type":"object","additionalProperties":false,"required":["version","kind","processingSemantic","frame","overallNote","focusPoints","areas","images"],"allOf":[{"if":{"required":["states"]},"then":{"required":["activeStateId"]}},{"if":{"required":["activeStateId"]},"then":{"required":["states"]}}],"properties":{"plans":{"type":"array","items":{"$ref":"#/$defs/compositionPlan"}},"activeStateId":{"type":"string","minLength":1},"states":{"type":"array","minItems":1,"items":{"$ref":"#/$defs/state"}},"layerOrder":{"type":"array","uniqueItems":true,"items":{"type":"string","minLength":1}},"version":{"const":1},"kind":{"const":"composition-draft"},"processingSemantic":{"enum":[null,"scene-composition","editorial-layout"]},"previewMode":{"enum":["precise","soft"]},"frame":{"type":"object","additionalProperties":false,"required":["width","height"],"properties":{"width":{"type":"number","exclusiveMinimum":0},"height":{"type":"number","exclusiveMinimum":0},"bounds":{"type":"object","additionalProperties":false,"required":["x","y","width","height"],"properties":{"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number","exclusiveMinimum":0},"height":{"type":"number","exclusiveMinimum":0}}}}},"overallNote":{"type":"string"},"focusPoints":{"type":"array","maxItems":3,"items":{"$ref":"#/$defs/point"}},"directionLine":{"oneOf":[{"type":"null"},{"type":"object","additionalProperties":false,"required":["id","x","y","rotation","note","annotation","semanticType","shotScale"],"properties":{"id":{"const":"direction-1"},"x":{"type":"number"},"y":{"type":"number"},"rotation":{"type":"number"},"visible":{"type":"boolean"},"origin":{"enum":["user","agent","import"]},"note":{"type":"string"},"annotation":{"type":"string"},"semanticType":{"type":"string"},"shotScale":{"enum":["auto","foreground","midground","background"]}}}]},"areas":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","primitive","x","y","area","aspect","visualWeight","note","annotation","semanticType","shotScale"],"properties":{"id":{"type":"string","pattern":"^area-[0-9]+$"},"primitive":{"enum":["circle","triangle","quadrilateral"]},"x":{"type":"number"},"y":{"type":"number"},"area":{"type":"number","exclusiveMinimum":0},"aspect":{"enum":["square","free","landscape","portrait"]},"visualWeight":{"enum":["auto","high","medium","low","decorative"]},"displayText":{"type":"string"},"corners":{"$ref":"#/$defs/textCorners"},"isLightSource":{"type":"boolean"},"rotation":{"type":"number"},"width":{"type":"number","exclusiveMinimum":0},"height":{"type":"number","exclusiveMinimum":0},"visible":{"type":"boolean"},"origin":{"enum":["user","agent","import"]},"note":{"type":"string"},"annotation":{"type":"string"},"semanticType":{"type":"string"},"shotScale":{"enum":["auto","foreground","midground","background"]}},"allOf":[{"if":{"properties":{"aspect":{"const":"free"}}},"then":{"required":["width","height"]}},{"if":{"properties":{"semanticType":{"const":"text-region"}},"required":["semanticType"]},"then":{"required":["displayText"],"properties":{"isLightSource":{"const":false}}},"else":{"not":{"anyOf":[{"required":["displayText"]},{"required":["corners"]}]}}},{"if":{"required":["corners"]},"then":{"properties":{"primitive":{"const":"quadrilateral"},"aspect":{"const":"free"}}}}]}},"images":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","x","y","width","height","rotation","visualWeight","assetId","crop","note","annotation","semanticType","shotScale"],"properties":{"id":{"type":"string","pattern":"^image-[0-9]+$"},"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number","exclusiveMinimum":0},"height":{"type":"number","exclusiveMinimum":0},"rotation":{"type":"number"},"visualWeight":{"enum":["auto","high","medium","low","decorative"]},"cameraReference":{"type":"object","additionalProperties":false,"required":["sessionId","cameraId","renderedRevision"],"properties":{"sessionId":{"type":"string","minLength":1},"cameraId":{"type":"string","minLength":1},"renderedRevision":{"type":"integer","minimum":0}}},"assetId":{"type":["string","null"],"minLength":1},"crop":{"oneOf":[{"type":"null"},{"$ref":"#/$defs/imageCrop"}]},"visible":{"type":"boolean"},"origin":{"enum":["user","agent","import"]},"note":{"type":"string"},"annotation":{"type":"string"},"semanticType":{"type":"string"},"shotScale":{"enum":["auto","foreground","midground","background"]}}}}},"$defs":{"compositionPlan":{"type":"object","additionalProperties":false,"required":["id","visible","type"],"properties":{"id":{"type":"string","pattern":"^plan-[a-zA-Z0-9-]+$"},"visible":{"type":"boolean"},"axes":{"enum":["both","horizontal","vertical"]},"x":{"type":"number"},"y":{"type":"number"},"rotation":{"type":"number"},"scale":{"type":"number","exclusiveMinimum":0},"mirrored":{"type":"boolean"},"type":{"enum":["thirds","golden-section","symmetry","golden-spiral","triangle","radial"]},"width":{"type":"number","exclusiveMinimum":0},"height":{"type":"number","exclusiveMinimum":0},"rayCount":{"type":"integer","minimum":2,"maximum":36},"spread":{"type":"number","minimum":1,"maximum":360},"mode":{"enum":["uniform","free"]},"angles":{"type":"array","minItems":2,"maxItems":36,"items":{"type":"number"}}},"oneOf":[{"type":"object","properties":{"type":{"enum":["thirds","golden-section"]}},"required":["axes"],"not":{"anyOf":[{"required":["x"]},{"required":["y"]},{"required":["rotation"]},{"required":["scale"]},{"required":["mirrored"]},{"required":["width"]},{"required":["height"]},{"required":["rayCount"]},{"required":["spread"]},{"required":["mode"]},{"required":["angles"]}]}},{"type":"object","properties":{"type":{"enum":["symmetry"]}},"required":["x","y","rotation"],"not":{"anyOf":[{"required":["axes"]},{"required":["scale"]},{"required":["mirrored"]},{"required":["width"]},{"required":["height"]},{"required":["rayCount"]},{"required":["spread"]},{"required":["mode"]},{"required":["angles"]}]}},{"type":"object","properties":{"type":{"enum":["golden-spiral"]}},"required":["x","y","rotation","scale","mirrored"],"not":{"anyOf":[{"required":["axes"]},{"required":["width"]},{"required":["height"]},{"required":["rayCount"]},{"required":["spread"]},{"required":["mode"]},{"required":["angles"]}]}},{"type":"object","properties":{"type":{"enum":["triangle"]}},"required":["x","y","rotation","width","height"],"not":{"anyOf":[{"required":["axes"]},{"required":["scale"]},{"required":["mirrored"]},{"required":["rayCount"]},{"required":["spread"]},{"required":["mode"]},{"required":["angles"]}]}},{"type":"object","properties":{"type":{"enum":["radial"]},"mode":{"enum":["uniform"]}},"required":["x","y","rotation","rayCount","spread"],"not":{"anyOf":[{"required":["axes"]},{"required":["scale"]},{"required":["mirrored"]},{"required":["width"]},{"required":["height"]},{"required":["angles"]}]}},{"type":"object","properties":{"type":{"enum":["radial"]},"mode":{"enum":["free"]}},"required":["x","y","mode","angles"],"not":{"anyOf":[{"required":["axes"]},{"required":["rotation"]},{"required":["scale"]},{"required":["mirrored"]},{"required":["width"]},{"required":["height"]},{"required":["rayCount"]},{"required":["spread"]}]}}]},"state":{"type":"object","additionalProperties":false,"required":["id","number","layout"],"properties":{"id":{"type":"string","minLength":1,"maxLength":100},"number":{"type":"integer","minimum":1},"name":{"type":"string","minLength":1,"maxLength":100},"layout":{"type":"object","additionalProperties":false,"required":["frame","layerOrder","focusPoints","directionLine","areas","images"],"properties":{"plans":{"type":"array","items":{"$ref":"#/$defs/compositionPlan"}},"frame":{"allOf":[{"$ref":"#/properties/frame"},{"type":"object","required":["bounds"]}]},"layerOrder":{"$ref":"#/properties/layerOrder"},"focusPoints":{"type":"array","maxItems":3,"items":{"$ref":"#/$defs/layoutPoint"}},"directionLine":{"oneOf":[{"type":"null"},{"$ref":"#/$defs/layoutDirection"}]},"areas":{"type":"array","items":{"$ref":"#/$defs/layoutArea"}},"images":{"type":"array","items":{"$ref":"#/$defs/layoutImage"}}}}}},"layoutPoint":{"type":"object","additionalProperties":false,"required":["id","x","y"],"properties":{"visible":{"type":"boolean"},"id":{"type":"string","pattern":"^focus-[0-9]+$"},"x":{"type":"number"},"y":{"type":"number"}}},"layoutDirection":{"type":"object","additionalProperties":false,"required":["id","x","y","rotation"],"properties":{"visible":{"type":"boolean"},"id":{"const":"direction-1"},"x":{"type":"number"},"y":{"type":"number"},"rotation":{"type":"number"}}},"textCorners":{"type":"array","minItems":4,"maxItems":4,"items":{"type":"object","additionalProperties":false,"required":["x","y"],"properties":{"x":{"type":"number","minimum":0,"maximum":1},"y":{"type":"number","minimum":0,"maximum":1}}}},"layoutArea":{"type":"object","additionalProperties":false,"required":["id","x","y","area","aspect"],"properties":{"visible":{"type":"boolean"},"id":{"type":"string","pattern":"^area-[0-9]+$"},"x":{"type":"number"},"y":{"type":"number"},"area":{"type":"number","exclusiveMinimum":0},"corners":{"$ref":"#/$defs/textCorners"},"aspect":{"enum":["square","free","landscape","portrait"]},"rotation":{"type":"number"},"width":{"type":"number","exclusiveMinimum":0},"height":{"type":"number","exclusiveMinimum":0}},"allOf":[{"if":{"properties":{"aspect":{"const":"free"}}},"then":{"required":["width","height"]}}]},"layoutImage":{"type":"object","additionalProperties":false,"required":["id","x","y","width","height","rotation"],"properties":{"visible":{"type":"boolean"},"id":{"type":"string","pattern":"^image-[0-9]+$"},"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number","exclusiveMinimum":0},"height":{"type":"number","exclusiveMinimum":0},"rotation":{"type":"number"}}},"imageCrop":{"type":"object","additionalProperties":false,"required":["x","y","width","height"],"properties":{"x":{"type":"number","minimum":0,"maximum":1},"y":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","exclusiveMinimum":0,"maximum":1},"height":{"type":"number","exclusiveMinimum":0,"maximum":1}}},"point":{"type":"object","additionalProperties":false,"required":["id","x","y","note","annotation","semanticType","shotScale"],"properties":{"id":{"type":"string","pattern":"^focus-[0-9]+$"},"x":{"type":"number"},"y":{"type":"number"},"visible":{"type":"boolean"},"origin":{"enum":["user","agent","import"]},"note":{"type":"string"},"annotation":{"type":"string"},"semanticType":{"type":"string"},"shotScale":{"enum":["auto","foreground","midground","background"]}}}}}');var s=i(44791),l=i(19767),d=i(3500);let c=["circle","triangle","quadrilateral"],u=["square","free","landscape","portrait"],m="text-region",h=["scene-composition","editorial-layout"],p=["auto","high","medium","low","decorative"],g=new r.Ajv2020({allErrors:!0}),f=g.compile(o),y=g.compile(o.properties.frame);function x(e=d.tW){return b({version:1,kind:"composition-draft",processingSemantic:"scene-composition",previewMode:"soft",frame:(0,d.sw)(e),overallNote:"",focusPoints:[],directionLine:null,areas:[],images:[],plans:[{id:"plan-1",type:"thirds",axes:"both",visible:!0}]})}function b(e){let t,i,r,o=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return e;let t="focusPoints"in e&&Array.isArray(e.focusPoints)?e.focusPoints.map(J):void 0,i="areas"in e&&Array.isArray(e.areas)?e.areas.map(V):void 0,n="images"in e&&Array.isArray(e.images)?e.images.map(Y):[],a="directionLine"in e?null===e.directionLine?null:J(e.directionLine):void 0;return{...e,...!("processingSemantic"in e)?{processingSemantic:null}:{},...!("overallNote"in e)?{overallNote:""}:{},...t?{focusPoints:t}:{},...i?{areas:i}:{},images:n,...void 0!==a?{directionLine:a}:{}}}(function e(t){if(!t||"object"!=typeof t||Array.isArray(t))return t;let i=t.frame,n=Array.isArray(t.plans)?t.plans.map(e=>{if(!e||"object"!=typeof e||Array.isArray(e))return e;let{enabled:t,note:n,...a}=e;if("radial"===a.type&&void 0===a.mode)return{...a,mode:"uniform"};if(a?.type!=="triangle"||!Array.isArray(a.points)||3!==a.points.length||!a.points.every(e=>e&&Number.isFinite(e.x)&&Number.isFinite(e.y))||!i||!Number.isFinite(i.width)||!Number.isFinite(i.height)||i.width<=0||i.height<=0)return a;let[r,o,s]=a.points.map(e=>({x:e.x*i.width,y:e.y*i.height})),l=s.x-o.x,d=s.y-o.y,c=Math.hypot(l,d);if(0===c)return a;let u={x:(o.x+s.x)/2,y:(o.y+s.y)/2},m=(-((u.x-r.x)*d)+(u.y-r.y)*l)/c;if(0===m)return a;let{points:h,...p}=a;return{...p,x:(u.x+d/c*m/2)/i.width,y:(u.y-l/c*m/2)/i.height,rotation:180*Math.atan2(d,l)/Math.PI+180*(m<0),width:c/i.width,height:Math.abs(m)/i.height}}):void 0,a=Array.isArray(t.states)?t.states.map(t=>t&&"object"==typeof t?{...t,layout:e(t.layout)}:t):void 0;return{...t,...n?{plans:n}:{},...a?{states:a}:{}}}(e));if(!f(o))throw Error(ei(f.errors));var s,c=o.frame;if(!c||"object"!=typeof c||Array.isArray(c))throw Error("draft.frame must be an object.");let u=Object.keys(c).filter(e=>"width"!==e&&"height"!==e&&"bounds"!==e);if(u.length>0)throw Error(`draft.frame contains unknown fields: ${u.join(", ")}.`);if(!y(c))throw Error(ei(y.errors));let m=c.width/c.height;void 0!==c.bounds&&function(e,t){if(!e||"object"!=typeof e||Array.isArray(e))throw Error("draft.frame.bounds must be an object.");let i=Object.keys(e).filter(e=>!["x","y","width","height"].includes(e));if(i.length>0)throw Error(`draft.frame.bounds contains unknown fields: ${i.join(", ")}.`);for(let t of["x","y","width","height"])if(!Number.isFinite(e[t]))throw Error(`draft.frame.bounds.${t} must be a finite number.`);let n=e.width,a=e.height;if(n<=0||a<=0)throw Error("draft.frame.bounds width and height must be positive.");if(Math.abs(n*d.cq.width/(a*d.cq.height)-t)>.002)throw Error("draft.frame.bounds must match the frame aspect ratio.")}(c.bounds,m);let h=!o.frame.bounds,p=structuredClone(o);if(p.frame=h?(0,d.B)(o.frame):structuredClone(o.frame),h&&(i=(t=(s=p).frame.bounds).width*t.height,r=e=>{e.x=t.x+e.x*t.width,e.y=t.y+e.y*t.height},s.focusPoints.forEach(r),s.directionLine&&r(s.directionLine),s.areas.forEach(e=>{r(e),e.area*=i,void 0!==e.width&&(e.width*=t.width),void 0!==e.height&&(e.height*=t.height)}),s.images.forEach(e=>{r(e),e.width*=t.width,e.height*=t.height})),p.plans&&new Set(p.plans.map(e=>e.id)).size!==p.plans.length)throw Error("Composition planning ids must be unique within a state.");p.plans&&(p.plans=p.plans.map(e=>{let t={id:e.id,visible:e.visible};if("triangle"===e.type)return{...t,type:e.type,x:e.x,y:e.y,rotation:et(e.rotation),width:e.width,height:e.height};if("radial"===e.type)return"free"===e.mode?{...t,type:e.type,x:e.x,y:e.y,mode:e.mode,angles:e.angles.map(et)}:{...t,type:e.type,x:e.x,y:e.y,mode:e.mode,rotation:et(e.rotation),rayCount:e.rayCount,spread:e.spread};if("symmetry"===e.type)return{...t,type:e.type,x:.5,y:.5,rotation:ee(e.rotation,p.frame)};if("golden-spiral"===e.type){let i={x:e.x,y:e.y,rotation:et(e.rotation)};return{...t,type:e.type,...i,scale:e.scale,mirrored:e.mirrored}}return{...t,type:e.type,axes:e.axes}}));let g=new Set;for(let e of[...p.focusPoints,...p.directionLine?[p.directionLine]:[],...p.areas,...p.images]){if(g.has(e.id))throw Error(`Duplicate draft item id: ${e.id}.`);g.add(e.id)}return p.directionLine=p.directionLine?{...p.directionLine,rotation:et(p.directionLine.rotation)}:null,p.areas.forEach(e=>{if(e.corners){if(!(0,l.$n)(e.corners))throw Error("Text region corners must form a convex quadrilateral.");let t=e.corners.map(e=>e.x),i=e.corners.map(e=>e.y);if(Math.min(...t)>1e-8||Math.min(...i)>1e-8||Math.max(...t)<1-1e-8||Math.max(...i)<1-1e-8)throw Error("Text region corners must span their normalized bounding box.");e.area=e.width*e.height*(0,l.Ab)(e.corners)}"circle"===e.primitive&&"free"!==e.aspect&&(e.rotation=0),"quadrilateral"===e.primitive&&("landscape"===e.aspect||"portrait"===e.aspect)&&(Object.assign(e,(0,l.PK)(e.area,d.cq,"landscape"===e.aspect?1.6:.625,e.primitive)),e.aspect="free")}),p.layerOrder&&(p.layerOrder=(0,n.u)(p)),p.images.forEach(e=>{e.rotation=et(e.rotation),e.crop&&Z(e.crop)}),(0,a.Ib)(p)}function v(e,t){let i=b(e);if(i.focusPoints.length>=3)throw Error("A draft may contain at most 3 focus points.");let n={id:Q("focus",[...i.focusPoints,...i.areas]),x:t.x,y:t.y,...W()};return i.focusPoints.push(n),{draft:i,id:n.id}}function w(e,t){let i=b(e);if(!c.includes(t.primitive))throw Error(`Unsupported primitive: ${t.primitive}.`);let n=Number(t.area)>0?Number(t.area):.08,a=t.aspect&&u.includes(t.aspect)?t.aspect:"square",r={id:Q("area",[...i.focusPoints,...i.areas]),primitive:t.primitive,x:Number.isFinite(t.x)?t.x:.5,y:Number.isFinite(t.y)?t.y:.5,area:n,aspect:a,visualWeight:"auto",rotation:"circle"===t.primitive?0:et(Number(t.rotation)||0),...W()};return"free"===a&&Object.assign(r,(0,l.PK)(n,d.cq,1.6,t.primitive)),i.areas.push(r),{draft:i,id:r.id}}function j(e,t={}){let i=w(e,{...t,primitive:"quadrilateral",aspect:"free"});return{draft:z(_(i.draft,i.id,{semanticType:m}),i.id,{displayText:""}),id:i.id}}function k(e,t={}){let i=b(e),n={id:Q("image",[...i.focusPoints,...i.areas,...i.images]),x:Number.isFinite(t.x)?t.x:i.frame.bounds.x+i.frame.bounds.width/2,y:Number.isFinite(t.y)?t.y:i.frame.bounds.y+i.frame.bounds.height/2,width:Number.isFinite(t.width)&&t.width>0?t.width:320/d.cq.width,height:Number.isFinite(t.height)&&t.height>0?t.height:180/d.cq.height,rotation:et(Number(t.rotation)||0),visualWeight:"auto",assetId:null,crop:null,...W()};return i.images.push(n),{draft:i,id:n.id}}function S(e){return e.semanticType===m}function I(e){let t=b(e);if(t.directionLine)throw Error("A draft may contain at most one direction line.");return t.directionLine={id:"direction-1",x:.5,y:.5,rotation:0,...W()},{draft:t,id:t.directionLine.id}}function C(e,t){let i=b(e);return[...new Set(t)].flatMap(e=>{let t=i.focusPoints.find(t=>t.id===e);if(t)return[{kind:"focus",item:structuredClone(t)}];let n=i.areas.find(t=>t.id===e);if(n)return[{kind:"area",item:structuredClone(n)}];let a=i.images.find(t=>t.id===e);return a?[{kind:"image",item:structuredClone(a)}]:i.directionLine?.id===e?[{kind:"direction",item:structuredClone(i.directionLine)}]:[]})}function P(e,t,i){let n=b(e),a=[];for(let e of t){if("focus"===e.kind){if(n.focusPoints.length>=3)continue;let t={...structuredClone(e.item),id:Q("focus",[...n.focusPoints,...n.areas]),x:e.item.x+i.x,y:e.item.y+i.y};n.focusPoints.push(t),a.push(t.id);continue}if("area"===e.kind){let t={...structuredClone(e.item),id:Q("area",[...n.focusPoints,...n.areas]),x:e.item.x+i.x,y:e.item.y+i.y};n.areas.push(t),a.push(t.id);continue}if("image"===e.kind){let t={...structuredClone(e.item),id:Q("image",[...n.focusPoints,...n.areas,...n.images]),x:e.item.x+i.x,y:e.item.y+i.y};n.images.push(t),a.push(t.id);continue}n.directionLine||(n.directionLine={...structuredClone(e.item),id:"direction-1",x:e.item.x+i.x,y:e.item.y+i.y},a.push(n.directionLine.id))}return{draft:b(n),ids:a}}function L(e,t,i){let n=b(e),a=n.focusPoints.find(e=>e.id===t);if(a)return a.x=i.x,a.y=i.y,n;if(n.directionLine?.id===t)return n.directionLine.x=i.x,n.directionLine.y=i.y,n;let r=n.areas.find(e=>e.id===t)??n.images.find(e=>e.id===t);if(!r)throw Error(`Unknown draft item: ${t}.`);return r.x=i.x,r.y=i.y,n}function A(e,t,i,n){let a=b(e),r=K(a,t),o=M(r,i,n);return o===r?e:(a.areas[a.areas.indexOf(r)]=o,a)}function M(e,t,i){if(!S(e)||!Number.isInteger(t)||t<0||t>3||!Number.isFinite(i.x)||!Number.isFinite(i.y))return e;let n=(0,l.QR)({...e,x:0,y:0,rotation:0},d.cq);if("polygon"!==n.type)return e;let a=(e.rotation??0)*Math.PI/180,r=(i.x-e.x)*d.cq.width,o=(i.y-e.y)*d.cq.height;n.points[t]={x:r*Math.cos(a)+o*Math.sin(a),y:-r*Math.sin(a)+o*Math.cos(a)};let s=n.points.map(e=>e.x),c=n.points.map(e=>e.y),u=Math.min(...s),m=Math.min(...c),h=Math.max(...s)-u,p=Math.max(...c)-m;if(h<8||p<8)return e;let g=n.points.map(e=>({x:(e.x-u)/h,y:(e.y-m)/p}));if(!(0,l.$n)(g))return e;let f=u+h/2,y=m+p/2;return{...e,x:e.x+(f*Math.cos(a)-y*Math.sin(a))/d.cq.width,y:e.y+(f*Math.sin(a)+y*Math.cos(a))/d.cq.height,width:h/d.cq.width,height:p/d.cq.height,aspect:"free",corners:g,area:h/d.cq.width*(p/d.cq.height)*(0,l.Ab)(g)}}function N(e,t,i){let n=b(e),a=K(n,t);if(!Number.isFinite(i)||i<=0)return n;if("free"===a.aspect){let e=Math.sqrt(i/(a.corners?a.area:a.width*a.height));a.width*=e,a.height*=e}return a.area=i,n}function R(e,t,i,n){let a=b(e),r=a.areas.find(e=>e.id===t);if(!r)throw Error(`Unknown free area: ${t}.`);if(!Number.isFinite(i)||!Number.isFinite(n)||i<=0||n<=0)return a;r.width=i,r.height=n,r.aspect="free";let o=r.corners?(0,l.Ab)(r.corners):"circle"===r.primitive?Math.PI/4:"triangle"===r.primitive?.5:1;return r.area=i*n*o,a}function $(e,t,i){let n=b(e),a=K(n,t);return"circle"===a.primitive&&"free"!==a.aspect||(a.rotation=et(i)),n}function T(e,t,i,n){let a=b(e),r=X(a,t);return!Number.isFinite(i)||!Number.isFinite(n)||i<=0||n<=0||(r.width=i,r.height=n),a}function F(e,t,i){let n=b(e);return X(n,t).rotation=et(i),n}function E(e,t,i){let n=b(e);if(n.directionLine?.id!==t)throw Error(`Unknown draft direction line: ${t}.`);return n.directionLine.rotation=et(i),n}function D(e,t){let i=b(e);return i.focusPoints=i.focusPoints.filter(e=>e.id!==t),i.areas=i.areas.filter(e=>e.id!==t),i.images=i.images.filter(e=>e.id!==t),i.directionLine?.id===t&&(i.directionLine=null),i.layerOrder&&(i.layerOrder=(0,n.u)(i)),i}function _(e,t,i){let n=b(e),a=n.focusPoints.find(e=>e.id===t)??n.areas.find(e=>e.id===t)??n.images.find(e=>e.id===t)??(n.directionLine?.id===t?n.directionLine:null);if(!a)throw Error(`Unknown draft item: ${t}.`);return Object.assign(a,i),n}function z(e,t,i){let n=b(e),a=K(n,t);if(void 0!==i.visualWeight&&!p.includes(i.visualWeight))throw Error(`Unsupported visual weight: ${i.visualWeight}.`);if(void 0!==i.displayText&&!S(a))throw Error(`Display text is only supported by text regions: ${t}.`);return void 0!==i.visualWeight&&(a.visualWeight=i.visualWeight),void 0!==i.displayText&&(a.displayText=i.displayText),void 0!==i.isLightSource&&(a.isLightSource=i.isLightSource),b(n)}function B(e,t,i){let n=b(e),a=X(n,t);if(void 0!==i.visualWeight&&!p.includes(i.visualWeight))throw Error(`Unsupported visual weight: ${i.visualWeight}.`);if(void 0!==i.assetId&&null!==i.assetId&&!i.assetId.trim())throw Error("Image asset id cannot be empty.");return i.crop&&Z(i.crop),Object.assign(a,i),n}function q(e,t){return(e.previewMode??"precise")===t?e:{...e,previewMode:t}}function O(e,t){let i=b(e);if(!h.includes(t))throw Error(`Unsupported processing semantic: ${t}.`);return i.processingSemantic=t,i}function U(e,t){let i=b(e);return i.frame=(0,d.GN)(i.frame,t),i}function H(e){return(0,l.zS)(G(b(e)))}function G(e){let{states:t,activeStateId:i,...n}=e;return{...n,focusPoints:n.focusPoints.filter(e=>!1!==e.visible),directionLine:n.directionLine?.visible===!1?null:n.directionLine,areas:n.areas.filter(e=>!1!==e.visible),images:n.images.filter(e=>!1!==e.visible)}}function W(){return{...(0,s.D)(),shotScale:"auto"}}function J(e){let t=(0,s.I)(e);return!t||"object"!=typeof t||Array.isArray(t)?t:{shotScale:"auto",...t}}function V(e){let t=J(e);if(!t||"object"!=typeof t||Array.isArray(t))return t;let i={visualWeight:"auto",...t};return i.semanticType!==m||"displayText"in i?i:{...i,displayText:""}}function Y(e){let t=J(e);return!t||"object"!=typeof t||Array.isArray(t)?t:{visualWeight:"auto",assetId:null,crop:null,...t}}function K(e,t){let i=e.areas.find(e=>e.id===t);if(!i)throw Error(`Unknown draft area: ${t}.`);return i}function X(e,t){let i=e.images.find(e=>e.id===t);if(!i)throw Error(`Unknown draft image: ${t}.`);return i}function Q(e,t){let i=new Set(t.map(e=>e.id)),n=1;for(;i.has(`${e}-${n}`);)n+=1;return`${e}-${n}`}function Z(e){if(e.x+e.width>1+1e-9||e.y+e.height>1+1e-9)throw Error("Image crop must stay inside the source image.")}function ee(e,t){let i=et(e),n=e=>Math.abs((e-i+540)%360-180);return(0,d.Y8)(t).reduce((e,t)=>n(t)<n(e)?t:e)}function et(e){return(e%360+360)%360}function ei(e){return(e??[]).map(e=>"additionalProperties"===e.keyword?`${e.instancePath||"draft"} contains unknown field: ${String(e.params.additionalProperty)}`:`${e.instancePath||"draft"} ${e.message??"is invalid"}`).join("; ")}},37551:()=>{},37588:()=>{},38438:()=>{},38954:(e,t,i)=>{"use strict";function n(e,t){let i=new Set(t);for(let t of e.groups)t.itemIds.some(e=>i.has(e))&&t.itemIds.forEach(e=>i.add(e));return[...i]}function a(e,t,i){let a=n(e,t),o=new Set([...e.rectangles,...e.texts,...e.images].map(e=>e.id));if(a.length<2||a.some(e=>!o.has(e)))throw Error("A UI sketch group requires at least two existing items.");if(!i||o.has(i)||e.groups.some(e=>e.id===i))throw Error(`Duplicate or empty UI sketch group id: ${i}.`);return{...e,groups:[...r(e,a).groups,{id:i,itemIds:a}]}}function r(e,t){let i=new Set(t);return{...e,groups:e.groups.filter(e=>!e.itemIds.some(e=>i.has(e)))}}function o(e,t){let i=new Set(t);return e.map(e=>({...e,itemIds:e.itemIds.filter(e=>i.has(e))})).filter(e=>e.itemIds.length>=2)}i.d(t,{Im:()=>o,J$:()=>n,OT:()=>a,pu:()=>r})},42621:(e,t,i)=>{"use strict";i.d(t,{N:()=>r});var n=i(19204);let a=new WeakMap;function r(e){let{name:t,note:i,...r}=e,o=JSON.stringify(r),s=a.get(e);if(s?.raw===o)return s.key;let l=(0,n.d)(r);return a.set(e,{raw:o,key:l}),l}},42666:()=>{},44791:(e,t,i)=>{"use strict";function n(){return{origin:"user",note:"",annotation:"",semanticType:""}}function a(e){return!e||"object"!=typeof e||Array.isArray(e)?e:{...n(),...e}}i.d(t,{D:()=>n,I:()=>a})},46811:(e,t,i)=>{"use strict";i.d(t,{S:()=>r});var n=i(27812);let a={"basic-button":"button","action-button":"button","composite-button":"button","confirm-action":"button","number-badge":"number","animated-number":"number","border-scan":"motion","text-shine":"motion","tab-switch":"switching","expanding-switch":"switching","underline-tab-switch":"switching","dot-scrollbar":"scrolling","status-card":"card","image-title-card":"card","decorative-title":"typography","animated-icon":"icon","status-badge":"status","status-light":"status","loading-state":"status","aspect-ratio-selector":"module","model-selector":"module","cascade-selector":"module","adaptive-accordion":"module","resizable-collapse-group":"module","asset-skeleton-tree":"module","message-composer":"module","text-mark-editor":"module","side-action-panel":"module","section-navigation-panel":"module","app-shell-frame":"layout"};function r(e,t,i){return(0,n.Se)({namespace:"yisiui",id:e,name:t,category:a[e],origin:"shared",status:"experimental"})}},48308:()=>{},48511:e=>{"use strict";e.exports=JSON.parse('{"canvasLayers":{"bringToFront":"置于顶层","bringForward":"上移一层","sendBackward":"下移一层","sendToBack":"置于底层"},"app":{"title":"以形塑形","repositoryLink":"{{productName}} 的 GitHub 地址"},"integrations":{"workbuddy":{"name":"Agent自动画布","description":"Agent 可自行操作的画图、画 UI 界面神器,支持自主创建、编辑构图、UI 界面和 3D 空间,导出预览,并与您在同一画布上协作。","examples":{"composition":"把这张参考图的构图画到画布上,让我继续编辑。","uiSketch":"读取这个 UI 草图,按我的备注调整布局并导出预览。","spatial":"创建一个 3D 空间,摆好人物姿势并导出相机画面。"}}},"home":{"description":"用构图、UI 草图和 3D 空间表达想法,与 AI 一起完善设计。","createComposition":"创建构图","createUiSketch":"创建UI界面","createSpatial":"创建3D空间","skillInstallation":{"title":"安装skill","agentTab":"Agent","cliTab":"CLI","agentPrompt":"请把 Human2AI Skill 安装到当前项目:运行 npx skills add yisi-ai/human2ai --skill human2ai,选择项目级安装和你对应的 Agent 类型。完成后确认 Skill 已可被发现,并告知安装路径。","copy":"复制内容","copying":"正在复制内容","copyFailed":"复制失败,请手动选择并复制。"}},"navigation":{"composition":"构图"},"shell":{"sidebar":"Human2AI 应用侧栏","navigation":"Human2AI 应用导航","collapseSidebar":"收起应用侧栏","expandSidebar":"展开应用侧栏","resizeSidebar":"调整应用侧栏宽度","rightPanel":"操作面板","collapseRightPanel":"收起操作面板","expandRightPanel":"展开操作面板","resizeRightPanel":"调整操作面板宽度"},"language":{"selectorLabel":"界面语言"},"styleLibrary":{"title":"风格库","newStyle":"新建风格","editStyle":"编辑风格","name":"名称","namePlaceholder":"输入风格名称","category":{"label":"分类","all":"全部类型","visual":"画面","ui":"UI","spatial":"3D"},"creator":{"label":"创建方","all":"全部创建方","user":"User","agent":"Agent"},"references":{"heading":"参考","empty":"无参考图","add":"添加参考图","remove":"删除参考图","pasteHint":"在此粘贴图片,或选择本地图片。","fileTypes":"参考图支持 PNG、JPEG、WebP,最大 10 MB。"},"description":{"heading":"设计规范","placeholder":"说明布局、比例、视觉层级和装饰等设计规则","spatialPlaceholder":"说明形体、比例、材质、配色、光照和镜头等建模规则"},"searchPlaceholder":"搜索风格","deleteTitle":"确认删除这个风格?","deleteDescription":"该风格及其全部参考图和模型将被永久删除。","empty":"还没有风格","noMatches":"没有匹配的风格","loading":"正在加载风格","loadFailed":"风格加载失败","save":"保存","imageInvalid":"请选择不超过 10 MB 的有效 PNG、JPEG 或 WebP 图片。","openStyle":"打开“{{name}}”","closePreview":"关闭风格预览","promptSummary":{"label":"风格短句","placeholder":"用一句话概括最鲜明的视觉特征"},"model":{"label":"模型示例","loading":"正在加载模型","failed":"模型无法预览","reset":"重置模型视角","controls":"拖动旋转,滚轮缩放;聚焦后用方向键旋转,+ / − 缩放,Home 重置。"}},"notes":{"global":{"label":"全局备注","promptHeading":"整体要求:"},"element":{"label":"备注","prompt":"- 备注:{{note}}","nodePlaceholder":"说明这个节点表达什么","nodeHelp":"填写该节点的要求,会加入提示词。","regionPlaceholder":"这个区域表达什么布局内容","textPlaceholder":"这段文字表达什么"}},"sessionDetails":{"title":"基本信息","created":"创建时间","updated":"修改时间","nodes":"节点数","agent":"Agent","copyId":"复制ID","copyCommand":"复制命令","copying":"复制中","copyFailed":"复制失败","emptyValue":"—","agentCommand":"请使用以下 CLI 命令连接当前会话:\\n\\n{{command}}\\n\\n连接完成后,请停止并等待下一步命令。"},"workspaceSidebar":{"containsCurrentSession":"包含当前会话","functionArea":"功能区","projectArea":"项目","newComposition":"新建构图","newCompositionInProject":"在“{{project}}”中新建构图","newUiSketch":"新建 UI 界面","newUiSketchInProject":"在“{{project}}”中新建 UI 界面","newProject":"新建项目","projectNamePlaceholder":"输入项目名称","unassigned":"无项目","imageCompositionSession":"构图会话","uiLayoutSession":"UI 界面会话","sessionActions":"会话操作","projectActions":"项目操作","confirmRename":"确认","moveSessionTitle":"移动会话","selectProject":"选择项目","moveUnavailable":"没有可移动的项目","projectNameConflict":"项目名称不能重复","renameProjectTitle":"重命名项目","deleteProjectTitle":"删除项目","deleteProjectDescription":"删除后无法恢复。","deleteProjectDisabled":"项目包含子项,无法删除","renameSessionTitle":"重命名会话","renameSessionPlaceholder":"输入会话名称","deleteSessionTitle":"删除会话","deleteSessionDescription":"会话将移入回收站,可在保留期限内恢复。","loading":"正在加载项目","loadFailed":"项目列表加载失败","newSessionGroup":"新建分组","sessionGroupName":"分组名称","sessionGroupActions":"分组操作","renameSessionGroup":"重命名分组","deleteSessionGroup":"删除分组","deleteSessionGroupDescription":"分组内的会话将回到项目下,不会被删除。","sessionGroupNameConflict":"该项目中已存在同名分组","groupSession":"移入分组","ungroupedSessions":"未分组","newCompositionInGroup":"在“{{group}}”分组中新建构图","newUiSketchInGroup":"在“{{group}}”分组中新建 UI 界面"},"actions":{"start":"开始","delete":"删除","cancel":"取消","keep":"保留","deleteNode":"删除节点","deleteRegion":"删除区域","deleteText":"删除文字","create":"创建","rename":"重命名","move":"移动","retry":"重试"},"canvas":{"imageNode":{"label":"图片","add":"添加图片","promptHeading":"图片节点:"},"imageEditor":{"content":"图片内容","sourceDimensions":"{{width}} \xd7 {{height}} px","sourceFileSize":"{{size}} {{unit}}","upload":"上传图片","replace":"替换图片","uploading":"正在上传","uploadFailed":"图片上传失败,请重试。","fileTypes":"支持 PNG、JPEG、WebP、SVG,最大 10 MB。","svgSource":"SVG 源码","svgPaste":"粘贴 SVG","svgApply":"使用 SVG","svgSaveFailed":"SVG 保存失败,请检查代码后重试。","svgCopy":"复制源码","svgCopying":"正在复制源码","svgCopyFailed":"源码复制失败","sourceLoading":"正在读取图片内容","sourceLoadFailed":"图片内容读取失败,请重试。","download":"下载图片","downloading":"正在下载","downloadFailed":"图片下载失败,请重试。"},"imageCrop":{"title":"裁剪图片","loadFailed":"无法加载图片,请重新上传。"},"tools":{"label":"操作工具"},"viewport":{"help":"画布操作说明","instructions":"选择节点工具后,单击放置;形状和图片可拖动确定尺寸,动线可拖动确定方向;Esc 取消。滚轮缩放;按住右键,或空格键加左键拖动画布。"},"node":{"nodeDescription":"节点说明","nodeDescriptionHelp":"解释节点在画面中的作用,agent可读写。","originUser":"user","originAgent":"agent","originImport":"import"},"display":{"showHiddenNodes":"显示隐藏","onionSkin":"洋葱皮"},"nodeVisibility":{"visibility":"显示状态","visible":"显示","hidden":"隐藏"}},"canvasNodeEditor":{"title":"编辑节点信息","shapeKind":"形状","pointKind":"点"},"composition":{"session":{"new":"新构图会话","untitled":"未命名构图","loading":"正在加载构图","revisionConflict":"草图已由其他操作更新到版本 {{revision}}。请重新打开该会话后再修改。","typeMismatch":"该会话不是构图会话,无法在构图编辑器中打开。"},"views":{"draft":"构图","refined":"精修","reference":"预览","switch":"构图视图","draftCanvas":"用户构图草图","refinedCanvas":"Agent 精修后的构图","referenceCanvas":"用于生图的结构参考"},"workflow":{"agentDecision":"Agent 判断","appliedMethods":"执行方法","protectionAudit":"变化记录","maximumFocusShift":"最大焦点位移","maximumAreaShift":"最大区域位移","maximumRotationShift":"最大旋转变化"},"workspace":"画布工作区","clearCanvas":"清空画布","clearCanvasConfirmTitle":"确认清空画布?","clearCanvasConfirmDescription":"全部构图内容和设置将恢复为默认值。","collapseTools":"收起操作工具","expandTools":"展开操作工具","globalNote":{"title":"对整个画面的要求","placeholder":"例如:突出左侧主体,右侧保留呼吸感","ariaLabel":"构图草图的全局备注"},"flow":{"label":"动势线","controlPoint":"动势线操作点 {{number}}","promptHeading":"动势:","promptReference":"- 动势经过整体画面距左 {{x}}%、距上 {{y}}% 的位置,角度约 {{rotation}}\xb0"},"elementCapacity":{"compact":"{{current}}/{{limit}}","ariaLabel":"{{label}},已放置 {{current}}/{{limit}}"},"toolNames":{"focus":"焦点","circle":"圆形","triangle":"三角形","quadrilateral":"矩形","textRegion":"文字区域"},"canvasZoom":"当前缩放","zoomOut":"缩小画布","zoomIn":"放大画布","fitAll":"适应全部","frameRatio":"画框比例","frameLabel":"画框","frameReset":"重置画框","frameAction":"移动或缩放画框","aspectRatioTitle":"比例","lockFrame":"锁定画框","unlockFrame":"解锁画框","areaOverview":"面积概览","occupied":"画面占用","negativeSpace":"负空间","currentSelection":"当前选择","none":"无","prompt":{"title":"请根据以下信息设计画面;如附有参考图,请将其作为整体布局参考。","outputRatio":"输出比例:{{ratio}}","regionSemanticsGuidance":"- 每个区域只是视觉影响范围,不是成品对象的固定外形;除非备注明确要求,不要复刻完整边界、轮廓或封闭色块。","displayTextGuidance":"- 每个文字区域都必须呈现可见文字。已填写的“显示文字”必须原样出现;留空只表示文字内容由模型创作,不表示可以省略文字。文字可依照景别和画面关系变形或被部分遮挡。","layoutHeading":"整体布局要求:","coordinateOrigin":"- 以下位置均相对于整体画面表示,左上角为 0%, 0%。","referenceValues":"- 以下位置、占比和角度用于说明主要内容之间的视觉关系。","flexibleImplementation":"- 保留主要内容的相对方位、面积级差、视觉重量、前后关系和视觉动线;可按真实内容重构、拆分、融合、重叠或延伸至画面之外。","referenceImageGuidance":"- 上传的参考图只表达内容的大致占位、重心和视觉分布,是空间提示而非线稿;不要把其中的完整边界、标记或线条画进成品。","metricsHeading":"整体画面关系:","occupied":"- 主要内容约占整体画面的 {{value}}%","negativeSpace":"- 负空间约 {{value}}%","focusHeading":"视觉焦点:","focusNumber":"焦点#{{index}}","areaHeading":"主要内容分布:","areaNumber":"内容区域#{{index}}","imageNumber":"图片#{{index}}","textRegionNumber":"文字区域#{{index}}","generatedDisplayText":"- 文字内容:由模型创作,但本区域不能留空或改成普通图像内容","referencePosition":"- 参考位置:距左 {{x}}%,距上 {{y}}%","referenceArea":"- 可见内容约占整体画面的 {{area}}%","referenceRotation":"- 视觉分布倾向约 {{rotation}}\xb0","referenceClipping":"- 内容延伸至画面之外:{{sides}}","sideSeparator":"、","top":"上侧","right":"右侧","bottom":"下侧","left":"左侧","lightSourceNumber":"光源 {{index}}","lightSourceGuidance":"- 光源标记与普通形状一样,是大致的视觉意图和空间关系描述。淡黄色仅用于识别,不限定色温。光源与受光区域并不相同,结合场景理解照明来源及其作用:矩形表达带状或延展光照,圆形表达局部光照。保留大致照明方位、延展趋势及对主体和空间的作用即可,宽窄、长短、弯曲、连续性、边缘和强弱可随场景自由变化。用户指令和节点备注优先,未指定时由 Agent 决定;不要从参考图自行推导固定宽度、等宽直线、完整贯穿、中强对比或缩略图醒目等额外要求。逐个理解多个光源,成片效果允许拆分、叠加和融合。生成后按整体照明是否大致呼应构图判断,不逐边、逐段或按宽度比对;只有用户明确要求时才收紧对应限制,也不要完全忽略已画出的照明意图。","lightBandGuidance":"光带意图:大致保留这里的带状或延展光照及其空间作用,表现可因场景变窄、变宽、弯曲、断续或融合;不要求一条完整、笔直、等宽或醒目的亮条。宽度、长度、边缘和强弱优先遵循用户指令及本节点备注,未指定时由 Agent 自由安排,整体大致呼应即可。","planningGuidance":"以下构图规划表达布局意图,结合整体要求与备注使用;辅助线、轴线、螺旋和三角轮廓本身不应画进成品。位置相对于画面左上角,角度从向右的水平方向顺时针计量。","planningGrid":"- {{type}}:{{axes}}分割线。","planningSymmetry":"- 对称构图:对称轴经过画面中心({{x}}%,{{y}}%),方向 {{rotation}}\xb0。","planningSpiral":"- 黄金螺旋:收束位置({{x}}%,{{y}}%),外端方向 {{rotation}}\xb0,外半径为画面短边的 {{scale}}%,{{winding}}。","planningClockwise":"向外顺时针展开","planningCounterclockwise":"向外逆时针展开","planningTriangle":"- 三角构图:等腰三角形,顶点为 {{points}}。","planningRadial":"- 放射构图:汇聚点({{x}}%,{{y}}%),{{rayCount}} 条等角间隔射线,从 {{rotation}}\xb0 起顺时针展开 {{spread}}\xb0。","planningRadialFree":"- 自由放射构图:汇聚点({{x}}%,{{y}}%),{{rayCount}} 条射线,各自方向为 {{angles}}(从向右的水平方向顺时针计量)。"},"depth":{"label":"景别","auto":"自动","foreground":"前景","midground":"中景","background":"背景","prompt":"- 景别:{{shotScale}}"},"mode":{"label":"构图模式","placeholder":"请选择","scene":"场景构图","editorial":"版式编排","prompt":"构图模式:{{semantic}}","unselected":"未选择","unselectedGuidance":"- 尚未选择构图模式;请先确认使用场景构图还是版式编排。","sceneGuidance":"- 按场景构图处理全部区域;文字区域可以作为画面元素参与透视、变形和前后遮挡。","editorialGuidance":"- 按静态平面版式编排处理全部区域,统筹视觉层级、对齐、间距、留白、阅读空间和焦点关系;区域不是 UI 组件或固定色块。"},"refinement":{"objective":"精修目标","observations":"判断依据","uncertainties":"待确认事项","preserve":"保留关系","tradeoffs":"取舍","relations":"关系验证","retained":"保留原构图","target":"目标值","before":"原图测量","after":"精修测量","error":"达成偏差","unmeasurable":"不适用","framePlacement":"分割线定位","sizeRatio":"尺寸比例","mirrorSymmetry":"轴对称","focusFlow":"焦点引导","focusAnchor":"焦点定位","axisRelation":"轴线关系","rotationAlignment":"方向对齐","blockAlignment":"区域对齐","spacingRhythm":"等距排列"},"lightSource":{"toggle":"作为光源"},"textRegion":{"cornerLabel":"文字轮廓角点 {{index}}","cornerHelp":"选中文字区域后,按住 Ctrl 拖动角点调整轮廓;聚焦角点后可用方向键微调。"},"planning":{"title":"构图规划","add":"添加规划","empty":"暂无构图规划","types":{"thirds":"三分构图","golden-section":"黄金分割","symmetry":"对称构图","golden-spiral":"黄金螺旋","triangle":"三角构图","radial":"放射构图"},"visible":"显示规划","axes":"分割方向","both":"横纵","horizontal":"水平","vertical":"垂直","x":"横向位置(%)","y":"纵向位置(%)","rotation":"旋转角度(\xb0)","scale":"螺旋尺寸(%)","mirrored":"镜像螺旋","handle":"规划控制点 {{index}}","help":"Shift 点击多选规划,拖动已选辅助线一起移动;三分、黄金分割和对称构图保持固定。三分和黄金分割仅可在侧栏选择。方向键可微调,Delete 可删除。","width":"底边宽度(%)","height":"三角高度(%)","triangleHelp":"拖动顶点调整朝向和高度;拖动底角调整底边与高度,两侧始终对称。","symmetryHelp":"中心固定;拖动另一圆点吸附到原有八个方向或画框四角方向。四角方向随画框比例变化,正方形时合并重复点。方向键可逐档切换。","spiralHelp":"点击中心圆点切换顺/逆时针;拖动中心移动螺旋,拖动外端圆点调整角度和大小。","spiralDirection":"切换螺旋方向(顺时针/逆时针)","rayCount":"射线数量","spread":"展开角度(\xb0)","radialHelp":"均匀模式设置起始方向和展开角度;自由模式拖动每条射线的圆点分别调整方向,中心圆点移动汇聚点。切到自由保留方向,切回均匀按当前数量整圈均布。","lock":"锁定构图规划","unlock":"解锁构图规划","showAll":"显示构图线","hideAll":"隐藏构图线","radialMode":"放射模式","radialUniform":"均匀","radialFree":"自由","rayHandle":"射线 {{index}} 方向"},"previewMode":{"label":"预览模式","precise":"精准","soft":"模糊","prompt":"预览模式:{{mode}}","preciseGuidance":"- 精准预览:请让生成图尽量贴近画布设想,保留各区域的基本形态、位置、比例、旋转、层级、间距、留白和裁切关系。结合备注将图形表达为具体内容,不随意重构、拆分或合并已安排的形态。以预览图逐项对照这些关系;焦点、动势线等辅助标记不作为最终画面内容。用户指令和节点备注优先。","preciseLightGuidance":"- 精准光照:尽量保留画布中光源的位置、形态、延展范围及相对比例,并据此安排对主体和空间的照明。淡黄色仅用于识别光源,不限定色温;不要把光源标记描边画进成图。用户指令和节点备注优先。"}},"uiSketch":{"title":"UI 界面","canvas":"UI 界面画布","globalNote":{"title":"对整个界面的要求","placeholder":"例如:整体保持安静,突出当前任务和主要操作","ariaLabel":"UI 界面的全局备注"},"canvasLabels":{"canvasViewport":"UI 界面无限画布","scene":"UI 界面场景","region":"区域","addRegion":"添加区域","text":"文字","addText":"添加文字","newText":"文字","resetFrame":"重置范围","rangeTitle":"范围","lockFrame":"锁定范围","unlockFrame":"解锁范围","clearCanvas":"清空画布","clearCanvasConfirmTitle":"确认清空画布?","clearCanvasConfirmDescription":"将移除全部区域、文字和图片。","fitFrame":"适应界面范围","sideActions":"UI 界面操作","collapseSideActions":"收起 UI 界面操作","expandSideActions":"展开 UI 界面操作","frameAction":"移动或调整界面范围","frameRange":"界面范围","missingRegionNote":"未填写备注","editRegionNote":"编辑区域信息","editText":"编辑文字","emptyText":"---文字未输入---","fontSize":"字号","decreaseFontSize":"减小字号","increaseFontSize":"增大字号","selectedItemsPrefix":"已选择 ","selectedItemsSuffix":" 个元素","noSelection":"未选择元素","groupItems":"建组","ungroupItems":"解组"},"prompt":{"staticTitle":"请根据以下信息设计并实现界面。","motionTitle":"请根据以下信息设计并实现界面及状态过渡。","canvasSize":"画布建议尺寸:{{width}} \xd7 {{height}}px","layoutHeading":"布局说明:","canvasOrigin":"- 画布左上角为坐标原点。","referenceValues":"- 以下坐标、尺寸和字号均为参考值,用于帮助理解元素的大致方位、层级关系和变化趋势。","perceptibleElementGuidance":"- 草图只表达用户可见、可读、可识别或可交互的关键元素及其空间关系。矩形表示可感知的内容范围或视觉表面,不是组件树节点;不要把纯布局 wrapper、Stack、Grid 或无独立视觉意义的父级矩形实现为容器。","flexibleImplementation":"- 不要求使用固定定位或逐像素复现。请结合真实内容、组件约束和响应式布局,将数值调整得更合理、美观。","motionStateGuidance":"- 状态按标签顺序依次过渡;每组过渡的前一个状态描述基准画面,后一个状态只列出变化的属性,未列出的属性保持不变。","elementsHeading":"界面元素:","imageNumber":"图片#{{index}}","regionNumber":"区域#{{index}}","textNumber":"文字#{{index}}","referencePosition":"参考位置:x={{x}}px,y={{y}}px","referenceSize":"参考尺寸:宽={{width}}px,高={{height}}px","referenceFontSize":"参考字号:{{fontSize}}px","startState":"- 状态 1:","endState":"- 状态 2:","changeVisible":"改为显示","changeHidden":"改为隐藏","motionClosing":"请根据各元素的状态变化设计自然的布局过渡。参考坐标用于表达相对方位和移动趋势,不应直接实现为僵硬的固定位置。","stateHeading":"- {{name}}:"},"views":{"start":"状态 1","end":"状态 2","switch":"界面状态","enableMotion":"添加状态"},"session":{"new":"新 UI 界面会话","untitled":"未命名 UI 界面","loading":"正在加载 UI 界面","revisionConflict":"UI 界面已由其他操作更新到版本 {{revision}}。请重新打开该会话后再修改。","typeMismatch":"该会话不是 UI 界面会话,无法在 UI 界面编辑器中打开。","serviceOutdated":"当前 Human2AI 服务尚不支持 UI 界面。请重新启动开发服务,然后重试。"},"motion":{"copyPrompt":"动效"},"states":{"defaultName":"状态 {{number}}","name":"状态名称","actions":"{{name}}的状态操作","new":"新建状态","delete":"删除状态","deleteTitle":"确认删除状态“{{name}}”?","notFound":"找不到界面状态:{{state}}。"},"preview":{"outputFormatError":"UI 预览输出文件必须使用 .png 或 .svg 扩展名。"},"pngSplit":{"action":"拆分 PNG","alphaThreshold":"透明度阈值","minSize":"最小尺寸","gap":"间距","failed":"拆分失败,请重试。","invalid":"请选择包含透明区域且非空的静态 PNG 图片。","complete":"已拆分 {{count}} 张图片,过滤 {{discarded}} 个碎片。","alreadySplit":"所选图片已拆分。","retrySave":"重试保存","settings":"拆分 PNG 设置","applySettings":"拆分","running":"正在拆分 PNG…","preview":"拆分范围预览","previewing":"正在计算拆分范围…","previewFailed":"无法预览拆分范围,请重试。","previewSummary":"将生成 {{count}} 张图片,过滤 {{discarded}} 个碎片。","zoomIn":"放大预览","zoomOut":"缩小预览","help":"预览操作说明","interactionHelp":"滚轮缩放;按住右键,或空格键加左键平移。选择自由锚点后依次点击,至少三个不共线的点可点击起点或按 Enter 闭合;Esc 取消绘制。闭合区域只能选中删除,不能修改;每个区域保留为一张图片,重叠像素归先创建的区域。","freeAnchors":"自由锚点","manualRegion":"手动区域 {{index}}","closeRegion":"闭合区域"}},"clipboard":{"group":"复制","copyPrompt":"复制提示词","copied":"复制成功","promptFailed":"复制提示词失败。","promptUnsupported":"当前浏览器不支持复制提示词。","copyPreview":"复制预览图","previewImage":"预览图","previewFailed":"复制预览图失败。","previewDownloaded":"浏览器不支持复制图片,预览图已下载","promptPreview":"提示词预览","promptPreviewLoading":"正在加载提示词","promptPreviewFailed":"无法预览提示词"},"visualWeight":{"auto":"自动","high":"高","medium":"中","low":"低","decorative":"装饰","label":"视觉权重","prompt":"- 视觉权重:{{weight}}"},"dimensions":{"frameSize":"范围","width":"宽","height":"高"},"textContent":{"label":"显示文字","prompt":"- 显示文字:{{text}}","compositionPlaceholder":"填写指定文字;留空由模型生成文字内容","uiSketchPlaceholder":"输入文字"},"errors":{"historyExpired":"这段历史已过期,请重新载入当前画布。","serviceSync":"无法同步 Human2AI 服务:{{message}}","operationFailed":"操作失败,请重试。"},"confirmations":{"deleteNode":"确认删除这个节点?","deleteRegion":"确认删除这个区域?","deleteText":"确认删除这段文字?"},"sessionStyle":{"label":"会话风格","choose":"选择风格","dialogTitle":"为当前会话选择风格","unbind":"解除风格绑定","select":"使用此风格","pending":"尚未按当前风格加工","conflict":"会话或风格已更新,请重新读取后再试。","prompt":"风格:{{summary}}"},"spatial":{"title":"3D 空间","spaceTab":"空间","workspaceViews":"切换空间视图","cameraPreviewPending":"保存后显示预览","newSpace":"新建 3D 空间","newInProject":"在“{{project}}”中新建 3D 空间","untitled":"未命名 3D 空间","objects":"空间对象","cameras":"摄像机","addCharacter":"人物","character":"人物","addCamera":"摄像机","camera":"摄像机 {{number}}","box":"方块","sphere":"球体","plane":"平面","position":"空间位置","rotation":"空间旋转","lockPosition":"固定位置","lockRotation":"固定旋转","proportions":"头身比例","height":"人物身高","name":"对象名称","size":"物体尺寸","color":"显示颜色","joints":"关节","editView":"编辑视角","cameraView":"镜头预览","useView":"采用当前视角","projection":"投影方式","perspective":"透视投影","orthographic":"正交投影","fov":"视野角度","span":"取景高度","target":"观察目标","outputWidth":"输出宽度","outputHeight":"输出高度","transparent":"透明背景","reference":"3D 镜头","addReference":"添加 3D 镜头","selectSpace":"选择 3D 空间","selectCamera":"选择摄像机","openSource":"编辑源空间","snapshot":"另存为图片节点","sourceMissing":"源空间或摄像机已不存在","constrained":"已到达约束范围","invalid":"空间数据或关节约束无效","loadFailed":"无法读取 3D 空间","saveFailed":"未能保存,请重试","conflict":"空间已有更新,请重新载入后继续","duplicate":"复制空间对象","deleteConfirm":"删除这个空间对象?","empty":"空间内还没有对象","noSpaces":"还没有可引用的 3D 空间","viewport":"3D 编辑区域","webglFailed":"无法启动 3D 视图","translate":"移动关节或对象","rotate":"旋转骨段或对象","jointName":"关节 {{name}}","x":"X 轴","y":"Y 轴","z":"Z 轴","jointPelvis":"骨盆","jointSpine":"腰部关节","jointChest":"胸部","jointNeck":"颈部","jointHead":"头部","jointLeftShoulder":"左肩","jointLeftElbow":"左肘","jointLeftHand":"左掌心","jointLeftHip":"左髋","jointLeftKnee":"左膝","jointLeftFoot":"左脚","jointRightShoulder":"右肩","jointRightElbow":"右肘","jointRightHand":"右掌心","jointRightHip":"右髋","jointRightKnee":"右膝","jointRightFoot":"右脚","infoToolsTab":"信息与工具","panelViews":"切换空间面板","parameters":"参数","translateMode":"移动","rotateMode":"旋转","bones":"骨段","localRotation":"局部旋转","angleMinimum":"角度下限","angleMaximum":"角度上限","resetPose":"复原姿势","resetPoseHint":"恢复默认姿势并解除此人物的固定,可撤销。","showRig":"显示关节与骨段","showCameras":"显示摄像机","lightingEffects":"光照效果","jointLeftWrist":"左腕","jointLeftAnkle":"左踝","boneLeftShoulder":"左锁骨","boneLeftElbow":"左上臂","boneLeftWrist":"左前臂","boneLeftHand":"左手掌","boneLeftHip":"左髋骨","boneLeftKnee":"左大腿","boneLeftAnkle":"左小腿","boneLeftFoot":"左脚","jointRightWrist":"右腕","jointRightAnkle":"右踝","boneRightShoulder":"右锁骨","boneRightElbow":"右上臂","boneRightWrist":"右前臂","boneRightHand":"右手掌","boneRightHip":"右髋骨","boneRightKnee":"右大腿","boneRightAnkle":"右小腿","boneRightFoot":"右脚","boneSpine":"腰部","boneChest":"胸部骨段","boneNeck":"颈部骨段","boneHead":"头部","selectObjectForParameters":"选择对象以查看参数","bodyLegRatio":"躯干/腿部比例","torso":"躯干","legs":"腿部","bodyLegRatioHint":"按默认姿势计算,不含头部。向右拖动会缩短腿部,躯干与腿部各保留 30%–70%。","resetBodyLegRatio":"恢复默认比例","proportionsLocked":"固定关节阻止了比例调整,请先解除相关位置固定。","bodyType":"人物外形","bodyMale":"男性","bodyFemale":"女性","handLeft":"左手","handRight":"右手","fingerThumb":"拇指","fingerIndex":"食指","fingerMiddle":"中指","fingerRing":"无名指","fingerLittle":"小指","fingerRoot":"{{finger}}指根关节","fingerMiddleJoint":"{{finger}}中间关节","fingerDistalJoint":"{{finger}}末节关节","fingerTip":"{{finger}}指尖","fingerProximalBone":"{{finger}}近节骨段","fingerMiddleBone":"{{finger}}中节骨段","fingerDistalBone":"{{finger}}末节骨段","thumbMetacarpal":"拇指掌骨段","thumbProximal":"拇指近节骨段","fingerCurl":"{{finger}}弯曲","fingerSpread":"手指张开","thumbOpposition":"拇指内收","resetHand":"复原手部","resetHandHint":"恢复手掌和手指的默认姿势并解除其固定,保留手腕位置与手臂姿势,可撤销。","neckLength":"脖子长度","palmSize":"手掌大小","fingerLength":"手指长度","footSize":"脚部大小","bodyShapeHint":"100% 为当前头身比例的默认形态。手脚左右同步;手掌大小也影响手指粗细,手指长度单独调节。","referencePass":"参考图类型","referenceColor":"普通图","referenceStructure":"结构线","referenceDepth":"深度图","downloadReference":"下载 PNG","referenceLoadFailed":"参考图加载失败","cameraBox":"摄像机观察盒","cameraBoxTab":"观察盒","cameraBoxFrontToggle":"前","cameraBoxBackToggle":"后","cameraBoxLeftToggle":"左","cameraBoxRightToggle":"右","cameraBoxTopToggle":"顶","cameraBoxBottomToggle":"底","copyObservationImage":"复制观察图","downloadObservationImage":"下载观察图","observationCopyFailed":"复制观察图失败,请重试或下载图片。","observationDownloadFailed":"下载观察图失败,请重试。","noCameraBoxes":"暂无观察盒","noObservationDirections":"请选择至少一个观察方向","addCameraBox":"观察盒","cameraBoxSize":"边长(米)","cameraBoxResolution":"单图分辨率","cameraBoxView":"观察方向","cameraBoxSheet":"六方位合图","cameraBoxFront":"正面(+Z)","cameraBoxBack":"背面(−Z)","cameraBoxLeft":"左面(−X)","cameraBoxRight":"右面(+X)","cameraBoxTop":"顶面(+Y)","cameraBoxBottom":"底面(−Y)","fitCameraBoxScene":"框住全空间对象","fitCameraBoxHands":"框住全部手部","cameraBoxHint":"六面向内正交取景,只显示盒内内容。方向随观察盒旋转,合图用于辅助理解姿势;构图仍参考主镜头。","cameraBoxTargetError":"请选择普通摄像机或观察盒其中之一。","cameraBoxViewTargetError":"观察方向参数只能用于观察盒。","cameraBoxViewError":"观察方向须为 sheet、front、back、left、right、top 或 bottom。","cameraBoxViewsError":"请从 front、back、left、right、top、bottom 中选择 1–6 个不重复的方向,并用逗号分隔。","cameraBoxViewConflict":"--view 和 --views 只能使用其中一个。","cameraBoxGenerationGuidance":"主镜头决定最终构图。观察盒合图展示同一空间同一时刻,方向标签是观察盒的局部坐标,不是身体左右标记。仅用辅助图理解遮挡、手指归属和大致弯曲意图。最终画面不出现合图排版、重复人物、方向文字或关节/身体分块线;允许自然地修正姿势和手指接触,不必逐像素复原。","referenceSkeleton":"骨架投影","renderPassError":"--pass 必须为 {{passes}} 之一。","appearance":"模型样式","appearanceQuaternius":"人体模型","appearanceGeometric":"几何人偶","editObject":"编辑物件","newInGroup":"在“{{group}}”分组中新建 3D 空间"},"canvasHistory":{"undo":"撤销","redo":"重做","label":"编辑历史"},"canvasStates":{"switch":"布局状态"},"sessionPreview":{"label":"会话预览","add":"添加会话预览","session":"来源会话","output":"状态或摄像机","projectRequired":"请先将当前会话移入项目。","empty":"没有可引用的会话预览","unavailable":"来源已不可用,保留最后一次预览。","failed":"无法读取会话预览","openSource":"打开来源会话","group":"分组","search":"搜索分组、会话或状态","clearSearch":"清空搜索","chooseParent":"请先选择上一级","noChildren":"没有可选的下级内容","loading":"正在加载预览来源","descendantMatches":"下级有 {{count}} 项匹配","searchResults":"匹配 {{count}} 项"},"units":{"pixels":"px"},"settings":{"title":"设置","navigationLabel":"设置分区","close":"关闭设置","autoRelease":"自动释放","imageDays":"未使用图片","imageHint":"正在使用的图片不会释放。","historyDays":"画布历史版本","historyHint":"保留最新版和正在使用的撤销记录;普通历史版本最多保留 100 个。","trash":"回收站","trashDays":"自动删除时间","trashHint":"删除的会话及其内容保留到期后自动永久删除。","resetDefaults":"恢复默认值","restoreSession":"恢复会话","emptyTrash":"回收站为空","deletedAt":"删除时间","loading":"正在加载设置","invalidDays":"请输入 1–3650 之间的整数天数。","conflict":"设置已被更新,请重试以保存当前修改。","daysUnit_one":"天","daysUnit_other":"天","deleteNow":"立刻删除","deleteNowConfirm":"确认立刻删除“{{title}}”?","clearTrash":"清空回收站","clearTrashConfirm":"确认清空回收站?","permanentDeleteHint":"删除后,会话及其内容无法恢复。"}}')},49404:()=>{},49512:()=>{},49927:()=>{},50052:(e,t,i)=>{"use strict";i.d(t,{I:()=>u,u:()=>h});var n=i(73365),a=i(35659),r=i(50152),o=i(24539),s=i(1521);i(22392),i(94560);var l=i(46811),d=i(99791);let c=(0,s.createContext)(!1);function u({collapsed:e,children:t}){return(0,n.jsx)(c.Provider,{value:e,children:t})}function m(e){return String(d.L[e])}function h({label:e,icon:t,description:i,actions:d=[],onClick:u,textColor:p="color.text.primary",collapsed:g,collapsedLabel:f,"aria-current":y,"aria-label":x,title:b,disabled:v=!1,loading:w=!1,className:j}){let k=(0,s.useContext)(c),S=g??k,I=f??x??("string"==typeof e?e:b),C="none"===p?void 0:m(p),P=m("color.text.secondary");if(S&&!I)throw Error("CompositeButton collapsed state requires a plain-text label or collapsedLabel");let L=(0,n.jsx)(a.Ay,{className:"yisi-composite-button-main",size:"small",type:"text",icon:t,"aria-current":y,"aria-label":S?I:x,title:S?void 0:b,disabled:v,loading:w,onClick:u,style:C?{color:C}:void 0,children:S?null:(0,n.jsx)(r.A.Text,{className:"yisi-composite-button-label",style:{color:"inherit"},children:e})});return(0,n.jsxs)("div",{...(0,l.S)("composite-button","CompositeButton","component"),className:["yisi-composite-button",S?"yisi-composite-button--collapsed":null,!S&&d.length?"yisi-composite-button--has-actions":null,j].filter(Boolean).join(" "),"data-collapsed":S?"true":"false",children:[S?(0,n.jsx)(o.A,{title:I,placement:"right",children:L}):L,!S&&i?(0,n.jsx)(r.A.Text,{className:"yisi-composite-button-description",type:"secondary",style:{color:"var(--yisiui-color-text-muted)"},children:i}):null,!S&&d.length?(0,n.jsx)("div",{className:"yisi-composite-button-actions",role:"group","aria-label":"行操作",children:d.map(e=>(0,n.jsx)(a.Ay,{className:"yisi-composite-button-action",size:"small",type:"text",icon:e.icon,"aria-label":e.label,title:e.label,disabled:v||e.disabled,loading:e.loading,onClick:e.onClick,style:{color:P}},e.key))}):null]})}},52048:()=>{},52551:()=>{},52944:()=>{},53439:()=>{},54996:(e,t,i)=>{"use strict";i.d(t,{G_:()=>o,UB:()=>s,aY:()=>l,kF:()=>a,r8:()=>r});let n=[{heads:2,softness:1,torso:1.02,torsoDepth:1.5,headDepth:.9,shoulder:.94,hip:1,arm:1.02,forearm:1.08,thigh:1,calf:1.12,hand:1.35,foot:1.5,armLength:.84,handLength:1.2,footLength:1.75,neck:.42},{heads:3,softness:.82,torso:.94,torsoDepth:1.24,headDepth:.94,shoulder:.87,hip:.88,arm:.94,forearm:.96,thigh:.94,calf:1,hand:1.18,foot:1.26,armLength:.92,handLength:1.12,footLength:1.45,neck:.55},{heads:4,softness:.5,torso:.84,torsoDepth:1,headDepth:.94,shoulder:.84,hip:.84,arm:.75,forearm:.78,thigh:.84,calf:.8,hand:.88,foot:.94,armLength:.98,handLength:1.04,footLength:1.08,neck:.72},{heads:7,softness:0,torso:1,torsoDepth:1,headDepth:1,shoulder:1,hip:1,arm:1,forearm:1,thigh:1,calf:1,hand:1,foot:1,armLength:1,handLength:1,footLength:1,neck:1}],a=(e=1)=>1+(e-1)*.5;function r(e){let t=n.findIndex(t=>t.heads>=e);if(0===t)return[0,0,0];if(-1===t)return[3,3,0];let i=(e-n[t-1].heads)/(n[t].heads-n[t-1].heads);return[t-1,t,i*i*(3-2*i)]}function o(e){if(e>7){let t={...n[3]},i=Math.sqrt(7/e);for(let e of["torso","torsoDepth","shoulder","hip","arm","forearm","thigh","calf","hand","foot"])t[e]=i;return t}let[t,i,a]=r(e),o=n[t],s=n[i];return Object.fromEntries(Object.keys(o).map(e=>[e,o[e]+(s[e]-o[e])*a]))}function s(e,t){return t.endsWith("-shoulder")?e.shoulder:t.endsWith("-hip")?e.hip:t.endsWith("-elbow")?e.arm:t.endsWith("-wrist")?e.forearm:t.endsWith("-hand")?e.hand:t.endsWith("-knee")?e.thigh:t.endsWith("-ankle")?e.calf:t.endsWith("-foot")?e.foot:e.torso}let l={neckLength:{min:.6,max:1.4},palmSize:{min:.7,max:1.3},fingerLength:{min:.6,max:1.4},footSize:{min:.7,max:1.4}}},55894:()=>{},55972:(e,t,i)=>{"use strict";i.d(t,{AD:()=>n,F$:()=>o,_w:()=>a,sN:()=>r});let n=64,a=256;function r(e){return!!Array.isArray(e)&&!(e.length<3)&&!(e.length>a)&&!!e.every(e=>Array.isArray(e)&&2===e.length&&e.every(e=>"number"==typeof e&&Number.isFinite(e)&&1e6>=Math.abs(e)))&&Math.abs(e.reduce((t,[i,n],a)=>{let r=e[(a+1)%e.length];return t+i*r[1]-n*r[0]},0))>1e-8}function o(e){if(!Array.isArray(e)||e.length>n||!e.every(r))throw Error("Invalid PNG split regions.")}},58206:()=>{},59793:(e,t,i)=>{"use strict";i.d(t,{Ib:()=>c,KZ:()=>u,PX:()=>g,fQ:()=>d,uK:()=>h,wG:()=>m,yU:()=>p});var n=i(33949),a=i(34944),r=i(34345);function o(e){return{...e.plans?{plans:structuredClone(e.plans)}:{},frame:{width:e.frame.width,height:e.frame.height,bounds:{x:e.frame.bounds.x,y:e.frame.bounds.y,width:e.frame.bounds.width,height:e.frame.bounds.height}},layerOrder:(0,r.u)(e),focusPoints:e.focusPoints.map(({id:e,x:t,y:i,visible:n})=>({id:e,x:t,y:i,...void 0===n?{}:{visible:n}})),directionLine:e.directionLine?(({id:e,x:t,y:i,rotation:n,visible:a})=>({id:e,x:t,y:i,rotation:n,...void 0===a?{}:{visible:a}}))(e.directionLine):null,areas:e.areas.map(({id:e,x:t,y:i,area:n,aspect:a,rotation:r,width:o,height:s,corners:l,visible:d})=>({id:e,x:t,y:i,area:n,aspect:a,rotation:r,width:o,height:s,...void 0===d?{}:{visible:d},...l?{corners:structuredClone(l)}:{}})),images:e.images.map(({id:e,x:t,y:i,width:n,height:a,rotation:r,visible:o})=>({id:e,x:t,y:i,width:n,height:a,rotation:r,...void 0===o?{}:{visible:o}}))}}function s(e,t){if(!t)return{...e};let{visible:i,...n}=e;return{...n,...t}}function l(e,t){let{plans:i,...n}=e,a=new Map(t.focusPoints.map(e=>[e.id,e])),r=new Map(t.areas.map(e=>[e.id,e])),o=new Map(t.images.map(e=>[e.id,e]));return{...n,...t.plans?{plans:structuredClone(t.plans)}:{},frame:structuredClone(t.frame),layerOrder:[...t.layerOrder],focusPoints:e.focusPoints.map(e=>s(e,a.get(e.id))),directionLine:e.directionLine?s(e.directionLine,t.directionLine??void 0):null,areas:e.areas.map(e=>{let t=r.get(e.id);if(!t)return{...e};let{x:i,y:n,area:a,aspect:o,rotation:s,width:l,height:d,corners:c,visible:u,...m}=e;return{...m,...t}}),images:e.images.map(e=>s(e,o.get(e.id)))}}function d(e){return e.states??[{id:"state-1",number:1,layout:o(e)}]}function c(e){if(!e.states)return e;let{states:t,activeStateId:i,...n}=e;if(!t.some(e=>e.id===i))throw Error("Unknown active composition state.");if(new Set(t.map(({id:e})=>e)).size!==t.length||new Set(t.map(({number:e})=>e)).size!==t.length)throw Error("Composition state ids and numbers must be unique.");return e.states=t.map(e=>{if(void 0!==e.name&&!e.name.trim())throw Error("Composition state name must not be blank.");for(let t of[e.layout.focusPoints,e.layout.areas,e.layout.images])if(new Set(t.map(({id:e})=>e)).size!==t.length)throw Error("Duplicate composition state node id.");let t=(0,a.M6)(l(n,e.layout));return{...e,...void 0!==e.name?{name:e.name.trim()}:{},layout:o(e.id===i?n:t)}}),e}function u(e,t){let i=(0,a.M6)(e),n=d(i),r=n.find(e=>e.id===t);if(!r)throw Error(`Unknown composition state: ${t}.`);return(i.activeStateId??"state-1")===t?i:(0,a.M6)({...l(i,r.layout),states:n,activeStateId:t})}function m(e,t,i){let n=(0,a.M6)(e),r=[...d(n)],o=r.findIndex(e=>e.id===t);if(o<0||r.some(e=>e.id===i))throw Error("Invalid composition state source or new id.");let s={id:i,number:Math.max(...r.map(e=>e.number))+1,layout:structuredClone(r[o].layout)};return r.splice(o+1,0,s),(0,a.M6)({...l(n,s.layout),states:r,activeStateId:i})}function h(e,t,i){let r=(0,a.M6)(e);return{...r,activeStateId:r.activeStateId??"state-1",states:(0,n.UR)(d(r),t,i)}}function p(e,t){let i=(0,a.M6)(e);return{...i,activeStateId:i.activeStateId??"state-1",states:(0,n.kq)(d(i),t)}}function g(e,t){let i=(0,a.M6)(e),r=(0,n.aD)(d(i),t),o=d(i).findIndex(e=>e.id===t);return{...i.activeStateId===t?u(i,r[Math.max(0,o-1)].id):i,states:r}}},60458:(e,t,i)=>{"use strict";function n(){return ee("/api/v1/settings",{},globalThis.fetch)}function a(e,t){return ee("/api/v1/settings",{method:"PUT",body:JSON.stringify({...e,expectedRevision:t})},globalThis.fetch)}async function r(){return(await ee("/api/v1/trash/sessions",{},globalThis.fetch)).sessions}function o(e,t){return ee(`/api/v1/trash/sessions/${encodeURIComponent(e)}/restore`,{method:"POST",body:JSON.stringify({expectedRevision:t})},globalThis.fetch)}async function s(e,t){await et(`/api/v1/trash/sessions/${encodeURIComponent(e)}`,{method:"DELETE",body:JSON.stringify({expectedRevision:t})},globalThis.fetch)}async function l(){await et("/api/v1/trash/sessions",{method:"DELETE"},globalThis.fetch)}function d(e,t,i,n){return ee(`/api/v1/sessions/${encodeURIComponent(e)}/ui-sketch/png-splits/preview`,{method:"POST",body:JSON.stringify({sources:t,options:i}),signal:n},globalThis.fetch)}function c(e,t,i){return ee(`/api/v1/sessions/${encodeURIComponent(e)}/ui-sketch/png-splits`,{method:"POST",body:JSON.stringify({sources:t,options:i})},globalThis.fetch)}async function u(e){return(await ee(`/api/v1/sessions/${encodeURIComponent(e)}/preview-sources`,{},globalThis.fetch)).sources}function m(e,t){return ee(`/api/v1/sessions/${encodeURIComponent(e)}/previews`,{method:"POST",body:JSON.stringify(t)},globalThis.fetch)}function h(e,t){return`/api/v1/sessions/${encodeURIComponent(e)}/preview?${new URLSearchParams(t)}`}async function p(e,t=0){return(await ee(`/api/v1/sessions/${encodeURIComponent(e)}/ui-sketch/drafts/latest?knownRevision=${t}`,{},globalThis.fetch)).draftVersion}i.d(t,{$M:()=>S,DZ:()=>en,FX:()=>V,Fu:()=>O,Fw:()=>c,GQ:()=>f,GW:()=>M,Ht:()=>k,IE:()=>d,J_:()=>el,Jx:()=>R,ME:()=>U,MT:()=>K,MZ:()=>Y,Nr:()=>T,Pf:()=>D,Qk:()=>h,T8:()=>B,VQ:()=>J,X0:()=>N,XO:()=>y,YM:()=>z,a0:()=>a,a6:()=>b,aU:()=>E,al:()=>x,cZ:()=>s,dH:()=>W,gA:()=>P,g_:()=>F,gd:()=>l,gh:()=>r,gk:()=>ed,hF:()=>C,hU:()=>G,he:()=>H,jx:()=>v,mJ:()=>m,n8:()=>ea,nn:()=>$,oB:()=>L,pu:()=>p,qz:()=>ec,rO:()=>eo,t4:()=>u,tG:()=>n,ue:()=>w,ul:()=>es,us:()=>q,vh:()=>I,wP:()=>j,x:()=>_,xd:()=>o,xx:()=>A,zV:()=>er});let g=new Map;function f(e,t){let i=g.get(e);if(!i){let t=new Set,n=new EventSource(`/api/v1/sessions/${encodeURIComponent(e)}/preview-events`);n.onmessage=()=>t.forEach(e=>e()),i={events:n,listeners:t},g.set(e,i)}let n=i;return n.listeners.add(t),()=>{n.listeners.delete(t),n.listeners.size||(n.events.close(),g.delete(e))}}async function y(e=globalThis.fetch){return(await ee("/api/v1/session-groups",{},e)).groups}function x(e,t,i=globalThis.fetch){return ee(`/api/v1/projects/${encodeURIComponent(e)}/groups`,{method:"POST",body:JSON.stringify({name:t})},i)}function b(e,t,i,n=globalThis.fetch){return ee(`/api/v1/session-groups/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify({name:t,expectedRevision:i})},n)}async function v(e,t,i=globalThis.fetch){await et(`/api/v1/session-groups/${encodeURIComponent(e)}`,{method:"DELETE",body:JSON.stringify({expectedRevision:t})},i)}async function w(e,t,i,n=globalThis.fetch){await et(`/api/v1/projects/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/group`,{method:"PUT",body:JSON.stringify({groupId:i})},n)}class j extends Error{constructor(e,t,i,n={}){super(t),this.code=e,this.status=i,this.details=n,this.name="Human2AiApiError"}}function k(e,t=globalThis.fetch){return ee(`/api/v1/sessions/${encodeURIComponent(e)}`,{},t)}function S(e,t=null,i=globalThis.fetch,n){return ee("/api/v1/sessions",{method:"POST",body:JSON.stringify({sessionType:"image-composition",title:e,...t?{projectId:t}:{},...n?{groupId:n}:{}})},i)}function I(e,t=null,i=globalThis.fetch,n){return ee("/api/v1/sessions",{method:"POST",body:JSON.stringify({sessionType:"ui-layout",title:e,...t?{projectId:t}:{},...n?{groupId:n}:{}})},i)}async function C(e=globalThis.fetch){return(await ee("/api/v1/projects",{},e)).projects}function P(e,t=globalThis.fetch){return ee("/api/v1/projects",{method:"POST",body:JSON.stringify({name:e})},t)}function L(e,t,i,n=globalThis.fetch){return ee(`/api/v1/projects/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify({name:t,expectedRevision:i})},n)}async function A(e,t,i=globalThis.fetch){await et(`/api/v1/projects/${encodeURIComponent(e)}`,{method:"DELETE",body:JSON.stringify({expectedRevision:t})},i)}async function M(e=globalThis.fetch){return(await ee("/api/v1/sessions",{},e)).sessions}async function N(e=globalThis.fetch){return(await ee("/api/v1/styles",{},e)).styles}function R(e,t=globalThis.fetch){return ee("/api/v1/styles",{method:"POST",body:JSON.stringify(e)},t)}function $(e,t,i=globalThis.fetch){return ee(`/api/v1/styles/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)},i)}async function T(e,t,i=globalThis.fetch){await et(`/api/v1/styles/${encodeURIComponent(e)}`,{method:"DELETE",body:JSON.stringify({expectedRevision:t})},i)}function F(e,t,i,n=globalThis.fetch){return ee(`/api/v1/styles/${encodeURIComponent(e)}/references?filename=${encodeURIComponent(t.name)}&expectedRevision=${i}`,{method:"POST",headers:{"content-type":t.type||"application/octet-stream"},body:t},n)}function E(e,t,i,n=globalThis.fetch){return ee(`/api/v1/styles/${encodeURIComponent(e)}/references/${encodeURIComponent(t)}`,{method:"DELETE",body:JSON.stringify({expectedRevision:i})},n)}function D(e,t){let i=`/api/v1/styles/${encodeURIComponent(e)}/references/${encodeURIComponent(t)}/content`;return void 0===globalThis.location?i:new URL(i,globalThis.location.origin).toString()}function _(e,t){return`/api/v1/styles/${encodeURIComponent(e)}/models/${encodeURIComponent(t)}/content`}function z(e,t=globalThis.fetch){return ee(`/api/v1/sessions/${encodeURIComponent(e)}/style`,{},t)}function B(e,t,i,n=globalThis.fetch){return ee(`/api/v1/sessions/${encodeURIComponent(e)}/style`,{method:"PATCH",body:JSON.stringify({styleId:t,expectedRevision:i})},n)}function q(e,t,i,n=globalThis.fetch){return ee(`/api/v1/sessions/${encodeURIComponent(e)}/project`,{method:"PATCH",body:JSON.stringify({projectId:t,expectedRevision:i})},n)}function O(e,t,i,n=globalThis.fetch){return ee(`/api/v1/sessions/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify({title:t,expectedRevision:i})},n)}async function U(e,t,i=globalThis.fetch){await et(`/api/v1/sessions/${encodeURIComponent(e)}`,{method:"DELETE",body:JSON.stringify({expectedRevision:t})},i)}async function H(e,t=globalThis.fetch){return X(e,"composition",t)}function G(e,t,i,n=globalThis.fetch){return Q(e,"composition",t,i,n)}async function W(e,t=globalThis.fetch){return X(e,"ui-sketch",t)}function J(e,t,i,n=globalThis.fetch){return Q(e,"ui-sketch",t,i,n)}function V(e,t,i=globalThis.fetch){return ee(`/api/v1/sessions/${encodeURIComponent(e)}/assets?filename=${encodeURIComponent(t.name)}`,{method:"POST",headers:{"content-type":t.type||"application/octet-stream"},body:t},i)}function Y(e,t){let i=`/api/v1/sessions/${encodeURIComponent(e)}/assets/${encodeURIComponent(t)}/content`;return void 0===globalThis.location?i:new URL(i,globalThis.location.origin).toString()}async function K(e,t=globalThis.fetch){let i=await t(e);if(!i.ok)throw Error(`Image content request failed: ${i.status}`);let n=i.headers.get("content-type")?.split(";")[0].trim()??"",a={"image/png":"png","image/jpeg":"jpg","image/webp":"webp","image/svg+xml":"svg"}[n];if(!a)throw Error(`Unsupported image content type: ${n}`);return new File([await i.blob()],`image.${a}`,{type:n})}async function X(e,t,i){return(await ee(Z(e,t),{},i)).draftVersions}function Q(e,t,i,n,a){return ee(Z(e,t),{method:"POST",body:JSON.stringify({expectedLatestRevision:i,draft:n})},a)}function Z(e,t){return`/api/v1/sessions/${encodeURIComponent(e)}/${t}/drafts`}async function ee(e,t,i){let n=await et(e,t,i);return await ei(n)}async function et(e,t,i){let n=await i(e,{...t,cache:"no-store",headers:void 0===t.body?t.headers:t.headers??{"content-type":"application/json"}});if(!n.ok){var a;let e=await ei(n),t=(a=e)&&"object"==typeof a&&!Array.isArray(a)?e:{};throw new j("string"==typeof t.code?t.code:`HTTP_${n.status}`,"string"==typeof t.message?t.message:`Human2AI request failed with HTTP ${n.status}`,n.status,Object.fromEntries(Object.entries(t).filter(([e])=>"code"!==e&&"message"!==e)))}return n}async function ei(e){try{return await e.json()}catch{throw new j("INVALID_SERVICE_RESPONSE",`Human2AI returned invalid JSON with HTTP ${e.status}`,e.status)}}function en(e,t=null,i=globalThis.fetch,n){return ee("/api/v1/sessions",{method:"POST",body:JSON.stringify({sessionType:"spatial",title:e,projectId:t,...n?{groupId:n}:{}})},i)}function ea(e,t=globalThis.fetch){return X(e,"spatial",t)}async function er(e,t=0,i=globalThis.fetch){return(await ee(`/api/v1/sessions/${encodeURIComponent(e)}/spatial/drafts/latest?knownRevision=${t}`,{},i)).draftVersion}function eo(e,t,i,n=globalThis.fetch){return Q(e,"spatial",t,i,n)}function es(e,t,i,n=globalThis.fetch){return ee(`/api/v1/sessions/${encodeURIComponent(e)}/spatial/drafts/restore`,{method:"POST",body:JSON.stringify({expectedLatestRevision:t,targetRevision:i})},n)}function el(e,t,i,n="color"){let a=new URLSearchParams;return a.set("renderer","8"),i&&a.set("revision",String(i)),"color"!==n&&a.set("pass",n),`/api/v1/sessions/${encodeURIComponent(e)}/spatial/cameras/${encodeURIComponent(t)}.png${a.size?`?${a}`:""}`}function ed(e,t,i,n="sheet",a="color"){let r=new URLSearchParams({renderer:"4",revision:String(i),view:n,pass:a});return`/api/v1/sessions/${encodeURIComponent(e)}/spatial/camera-boxes/${encodeURIComponent(t)}.png?${r}`}function ec(e,t,i,n=globalThis.fetch){return ee(`/api/v1/sessions/${encodeURIComponent(e)}/spatial/operations`,{method:"POST",body:JSON.stringify({expectedLatestRevision:t,operations:i})},n)}},60868:(e,t,i)=>{"use strict";i.d(t,{o:()=>R,Human2AiShellLayout:()=>$});var n=i(73365),a=i(17357),r=i(67925),o=i(71788),s=i(29717),l=i(99568),d=i.n(l),c=i(1521),u=i(98196),m=i(8020),h=i(91093);let p={sidebarWidth:280,rightPanelWidth:300};function g(e){try{let t=Number(window.localStorage.getItem(`human2ai.appShell.${e}`));if(Number.isFinite(t)&&t>0)return t}catch{}return p[e]}function f(e,t){try{window.localStorage.setItem(`human2ai.appShell.${e}`,String(t))}catch{}}let y=e=>f("sidebarWidth",e),x=e=>f("rightPanelWidth",e),b="human2ai.workspaceSidebar.collapsedKeys";var v=i(65140),w=i(29415),j=i(35692),k=i(3742);let S={token:{colorPrimary:"#16A34A",colorPrimaryHover:"#22C55E",colorPrimaryActive:"#15803D",colorPrimaryBg:"#F0FDF4",colorPrimaryBgHover:"#DCFCE7",colorPrimaryBorder:"#15803D",colorPrimaryBorderHover:"#15803D",colorPrimaryText:"#15803D",colorPrimaryTextHover:"#15803D",colorPrimaryTextActive:"#15803D",colorLink:"#15803D",colorLinkHover:"#15803D",colorLinkActive:"#15803D",linkDecoration:"underline",linkHoverDecoration:"underline",linkFocusDecoration:"underline",colorTextBase:"#1F292B",colorText:"#1F292B",colorTextSecondary:"#48595C",colorTextTertiary:"#586B6F",colorTextQuaternary:"#7C918B",colorTextPlaceholder:"#586B6F",colorTextDisabled:"#7C918B",colorTextLightSolid:"#FFFFFF",colorBorder:"#7C918B",colorBorderSecondary:"#E2E9E7",colorBorderDisabled:"#E2E9E7",colorBgLayout:"#F3F6F5",colorBgContainer:"#FFFFFF",colorBgElevated:"#FFFFFF",colorBgContainerDisabled:"#F3F6F5",colorFillAlter:"#F8FAF9",colorBgTextHover:"#F8FAF9",colorBgTextActive:"#DCFCE7",controlItemBgHover:"#F8FAF9",controlItemBgActive:"#F0FDF4",controlItemBgActiveHover:"#DCFCE7",controlOutline:"#15803D",opacityLoading:1,colorInfo:"#48595C",colorInfoBg:"#F3F6F5",colorInfoText:"#48595C",colorError:"#CF1322",colorErrorBg:"#FFF1F0",colorWarning:"#AD4E00",colorWarningBg:"#FFF7E6",colorSuccess:"#237804",colorSuccessBg:"#F6FFED",borderRadius:8,borderRadiusSM:6,controlHeight:36,fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif",fontSize:14},components:{Button:{borderRadius:8,controlHeight:36,defaultBorderColor:"#C9D4D1",defaultHoverColor:"#15803D",defaultActiveColor:"#15803D",defaultHoverBorderColor:"#15803D",defaultActiveBorderColor:"#15803D",dangerColor:"#FFFFFF"},Card:{borderRadiusLG:8,colorBorderSecondary:"#C9D4D1"},Input:{borderRadius:8,controlHeight:36,activeBorderColor:"#15803D",hoverBorderColor:"#15803D",activeShadow:"0 0 0 2px #DCFCE7"},Select:{borderRadius:8,controlHeight:36,activeBorderColor:"#15803D",hoverBorderColor:"#15803D",activeOutlineColor:"#15803D"},Checkbox:{colorWhite:"#FFFFFF"},Radio:{colorWhite:"#FFFFFF"}}};var I=i(16842),C=i(60458);class P{constructor(e){this.current=e,this.pending={},this.saving=null}change(e,t){this.pending[e]=t}flush(){return this.save(!1)}retry(){return this.save(!0)}save(e){return this.saving||(this.saving=(async()=>{for(e&&(this.current=await (0,C.tG)());Object.keys(this.pending).length;){for(let e of Object.keys(this.pending))this.pending[e]===this.current[e]&&delete this.pending[e];if(!Object.keys(this.pending).length)break;let e={...this.pending},{revision:t,...i}=this.current;for(let n of(this.current=await (0,C.a0)({...i,...e},t),Object.keys(e)))this.pending[n]===e[n]&&delete this.pending[n]}})().finally(()=>{this.saving=null})),this.saving}}function L({onRestored:e}){let{t}=(0,m.Bd)(),[i,a]=(0,c.useState)(!1),[r,o]=(0,c.useState)(!1);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(w.J,{mode:"icon-only",backgroundColor:"none",icon:(0,n.jsx)(v.A,{}),iconLabel:t("settings.title"),title:t("settings.title"),onClick:()=>{o(!0),a(!0)}}),r?(0,n.jsx)(A,{open:i,afterClose:()=>o(!1),onClose:()=>a(!1),onRestored:e}):null]})}function A({open:e,afterClose:t,onClose:i,onRestored:a}){let{t:r,i18n:s}=(0,m.Bd)(),[l,d]=(0,c.useState)(null),[u,h]=(0,c.useState)({imageRetentionDays:"",historyRetentionDays:"",trashRetentionDays:""}),[p,g]=(0,c.useState)([]),[f,y]=(0,c.useState)(!0),[x,b]=(0,c.useState)(null),[v,w]=(0,c.useState)(null),[L,M]=(0,c.useState)(0),[N,R]=(0,c.useState)(!1),$=(0,c.useRef)(null),T=(0,c.useRef)(null),F=()=>{T.current&&clearTimeout(T.current),T.current=null};(0,c.useEffect)(()=>{let e=!1;return y(!0),b(null),Promise.all([(0,C.tG)(),(0,C.gh)()]).then(([t,i])=>{!e&&(d(t),h({imageRetentionDays:String(t.imageRetentionDays),historyRetentionDays:String(t.historyRetentionDays),trashRetentionDays:String(t.trashRetentionDays)}),g(i),$.current=new P(t))}).catch(()=>{e||b("errors.operationFailed")}).finally(()=>{e||y(!1)}),()=>{e=!0}},[L]),(0,c.useEffect)(()=>()=>{F(),$.current?.flush().catch(()=>{})},[]);let E=async(e=!1,t=!1)=>{let i=$.current;if(!i)return!0;F(),w(t?"reset":"save"),b(null),R(!1);try{return await (e?i.retry():i.flush()),!0}catch(e){return b(e instanceof C.wP&&"REVISION_CONFLICT"===e.code?"settings.conflict":"errors.operationFailed"),R(!0),!1}finally{w(null)}},D=async()=>{await E()&&i()},_=async e=>{let t=p.find(t=>t.id===e);if(t&&!v&&await E()){w(e),b(null);try{await (0,C.xd)(e,t.revision),g(t=>t.filter(t=>t.id!==e)),a()}catch{b("errors.operationFailed")}finally{w(null)}}},z=async e=>{let t=e?p.find(t=>t.id===e):void 0;if(!v&&(!e||t)&&await E()){w(e?`delete:${e}`:"clear-trash"),b(null);try{t?await (0,C.cZ)(t.id,t.revision):await (0,C.gd)(),g(t=>e?t.filter(t=>t.id!==e):[])}catch{b("errors.operationFailed")}finally{w(null)}}},B=Object.fromEntries(["title","navigationLabel","close","autoRelease","trash","imageDays","imageHint","historyDays","historyHint","trashDays","trashHint","resetDefaults","restoreSession","deleteNow","clearTrash","clearTrashConfirm","permanentDeleteHint","emptyTrash","deletedAt","loading"].map(e=>[e,r(`settings.${e}`)]));B.retry=r("actions.retry"),B.cancel=r("actions.cancel"),B.deleteNowConfirm=e=>r("settings.deleteNowConfirm",{title:e}),B.daysUnit=e=>r("settings.daysUnit",{count:Number(e)});let q=!!l&&Object.values(u).some(e=>!Number.isInteger(Number(e))||1>Number(e)||Number(e)>I.aT);return(0,n.jsx)(j.Ay,{theme:S,children:(0,n.jsx)(k.A,{open:e,afterClose:t,centered:!0,width:880,footer:null,closable:!1,title:B.title,onCancel:()=>{D()},styles:{header:{display:"none"},body:{padding:0}},children:(0,n.jsx)(o.ry,{labels:B,values:u,sessions:p.map(e=>({...e,deletedAt:new Date(e.deletedAt).toLocaleString(s.resolvedLanguage)})),loading:f,error:x?r(x):q?r("settings.invalidDays"):null,unavailable:!l,busy:v,retryAvailable:N,onChange:(e,t)=>{h(i=>({...i,[e]:t}));let i=Number(t);!Number.isInteger(i)||i<1||i>I.aT||($.current?.change(e,i),F(),T.current=setTimeout(()=>{T.current=null,E()},350))},onReset:()=>{h(e=>({...e,imageRetentionDays:String(I.C0.imageRetentionDays),historyRetentionDays:String(I.C0.historyRetentionDays)})),$.current?.change("imageRetentionDays",I.C0.imageRetentionDays),$.current?.change("historyRetentionDays",I.C0.historyRetentionDays),E(!1,!0)},onRestore:e=>{_(e)},onDelete:z,onClearTrash:()=>z(),onRetry:()=>{l?E(!0):M(e=>e+1)},onClose:()=>{D()}})})})}let M=(0,c.createContext)(null),N=[{value:"zh-CN",label:"中文"},{value:"en",label:"EN"}];function R({title:e,headerExtra:t,rightPanel:i,children:a,rightPanelOpen:r,onRightPanelOpenChange:o,className:s,currentSessionId:l=null,onCurrentSessionRename:d}){let m=(0,c.useContext)(M),h=(0,c.useRef)({}).current,p=!!e,g=null!=t&&!1!==t,f=null!=i,y=m.setPage;return(0,c.useLayoutEffect)(()=>{y({owner:h,hasTitle:p,hasHeaderExtra:g,hasRightPanel:f,currentSessionId:l,onCurrentSessionRename:d,rightPanelOpen:r,onRightPanelOpenChange:o,className:s})},[y,h,p,g,f,l,d,r,o,s]),(0,c.useLayoutEffect)(()=>()=>{y(e=>e?.owner===h?null:e)},[y,h]),(0,n.jsxs)(n.Fragment,{children:[m.title&&(0,u.createPortal)(e,m.title),m.header&&(0,u.createPortal)(t,m.header),m.panel&&(0,u.createPortal)(i,m.panel),a]})}function $({children:e}){let{t}=(0,m.Bd)(),i=function(){let[e,t]=(0,c.useState)(p);return(0,c.useLayoutEffect)(()=>{let e={sidebarWidth:g("sidebarWidth"),rightPanelWidth:g("rightPanelWidth")};t(t=>t.sidebarWidth===e.sidebarWidth&&t.rightPanelWidth===e.rightPanelWidth?t:e)},[]),{...e,onSidebarWidthChange:y,onRightPanelWidthChange:x}}(),[s,l]=(0,c.useState)(null),[u,h]=(0,c.useState)(null),[f,b]=(0,c.useState)(null),[v,w]=(0,c.useState)(null),j=(0,c.useMemo)(()=>({title:u,header:f,panel:v,setPage:l}),[u,f,v]),k=s?.currentSessionId;return(0,n.jsx)(M.Provider,{value:j,children:(0,n.jsx)(o.X3,{...i,className:s?.className,title:s?.hasTitle?(0,n.jsx)("span",{ref:h}):null,headerExtra:s?.hasHeaderExtra?(0,n.jsx)("div",{ref:b,style:{display:"contents"}}):void 0,rightPanel:s?.hasRightPanel?(0,n.jsx)("div",{ref:w,style:{display:"contents"}}):void 0,rightPanelOpen:s?.rightPanelOpen,onRightPanelOpenChange:s?.onRightPanelOpenChange,titleExtra:k?(0,n.jsx)(r.r,{size:"small",label:t("sessionDetails.copyId"),pendingLabel:t("sessionDetails.copying"),successLabel:t("clipboard.copied"),errorLabel:t("sessionDetails.copyFailed"),idleIcon:(0,n.jsx)(a.A,{"aria-hidden":"true"}),onAction:()=>navigator.clipboard.writeText(k)},k):void 0,brand:(0,n.jsxs)(d(),{href:"/",className:"human2ai-app-shell__brand",children:[(0,n.jsx)("img",{className:"human2ai-app-shell__brand-icon",src:"/brand/h2a.svg",alt:"",width:24,height:24}),t("app.title")]}),labels:{productName:t("app.title"),sidebar:t("shell.sidebar"),navigation:t("shell.navigation"),collapseSidebar:t("shell.collapseSidebar"),expandSidebar:t("shell.expandSidebar"),resizeSidebar:t("shell.resizeSidebar"),rightPanel:t("shell.rightPanel"),collapseRightPanel:t("shell.collapseRightPanel"),expandRightPanel:t("shell.expandRightPanel"),resizeRightPanel:t("shell.resizeRightPanel")},sidebar:(0,n.jsx)(T,{currentSessionId:k,onCurrentSessionRename:s?.onCurrentSessionRename}),children:e})})}let T=(0,c.memo)(function({currentSessionId:e,onCurrentSessionRename:t}){let i=(0,s.useRouter)(),{i18n:a,t:r}=(0,m.Bd)(),[l,d]=(0,c.useState)([]),[u,p]=(0,c.useState)([]),[g,f]=(0,c.useState)([]),[y,x]=(0,c.useState)(!0),[v,w]=(0,c.useState)(null),[j,k]=(0,c.useState)(0),S=u.some(e=>null===e.projectId),I=function(e){let[t,i]=(0,c.useState)(null);return(0,c.useLayoutEffect)(()=>{let e=[];try{let t=JSON.parse(window.localStorage.getItem(b)??"[]");Array.isArray(t)&&t.every(e=>"string"==typeof e)&&(e=t)}catch{}i(e)},[]),(0,c.useEffect)(()=>{if(null!==t)try{window.localStorage.setItem(b,JSON.stringify(t))}catch{}},[t]),{expandedKeys:(0,c.useMemo)(()=>null===t?null:e.filter(e=>!t.includes(e)),[e,t]),onExpandedKeysChange:(0,c.useCallback)(t=>{i(i=>{if(null===i)return i;let n=e.filter(e=>!i.includes(e)),a="function"==typeof t?t(n):t,r=e.filter(e=>!a.includes(e));return i.length===r.length&&i.every((e,t)=>e===r[t])?i:r})},[e])}}((0,c.useMemo)(()=>[...l.map(e=>`project:${e.id}`),...g.map(e=>`group:${e.id}`),...S?["project:unassigned"]:[]],[l,g,S]));(0,c.useEffect)(()=>{let e=!1;return x(!0),w(null),Promise.all([(0,C.hF)(),(0,C.GW)(),(0,C.XO)()]).then(([t,i,n])=>{e||(d(t),p(i),f(n))}).catch(()=>{e||w(r("workspaceSidebar.loadFailed"))}).finally(()=>{e||x(!1)}),()=>{e=!0}},[j,r]),(0,c.useEffect)(()=>{if(y||!e||u.some(t=>t.id===e))return;let t=!1;return(0,C.Ht)(e).then(e=>{t||p(t=>t.some(t=>t.id===e.id)?t:[e,...t])}).catch(()=>{}),()=>{t=!0}},[e,y,u]);let P=(0,c.useCallback)((e,t)=>{t&&f(i=>i.map(i=>i.id===t?{...i,sessionIds:[...i.sessionIds,e.id]}:i)),p(t=>[e,...t])},[]),A=(0,c.useRef)(u);(0,c.useLayoutEffect)(()=>{A.current=u},[u]);let M=(0,c.useRef)({currentSessionId:e,onCurrentSessionRename:t});(0,c.useLayoutEffect)(()=>{M.current={currentSessionId:e,onCurrentSessionRename:t}},[e,t]);let R=(0,c.useCallback)(async(e,t)=>{let i=A.current.find(t=>t.id===e);if(!i?.projectId)throw Error("SESSION_NOT_FOUND");await (0,C.ue)(i.projectId,e,t),f(i=>i.map(i=>i.id===t?{...i,sessionIds:[...i.sessionIds.filter(t=>t!==e),e]}:i.sessionIds.includes(e)?{...i,sessionIds:i.sessionIds.filter(t=>t!==e)}:i))},[]),$=(0,c.useMemo)(()=>({onCreateComposition:async(e,t)=>{let n=await (0,C.$M)(r("composition.session.untitled"),e??null,void 0,t);P(n,t),i.push(`/composition?session=${encodeURIComponent(n.id)}`)},onCreateSpatial:async(e,t)=>{let n=await (0,C.DZ)(r("spatial.untitled"),e??null,void 0,t);P(n,t),i.push(`/spatial?session=${encodeURIComponent(n.id)}`)},onCreateUiSketch:async(e,t)=>{let n=await (0,C.vh)(r("uiSketch.session.untitled"),e??null,void 0,t);P(n,t),i.push(`/ui-sketch?session=${encodeURIComponent(n.id)}`)}}),[i,r,P]),T=(0,c.useMemo)(()=>({functionArea:r("workspaceSidebar.functionArea"),projectArea:r("workspaceSidebar.projectArea"),newComposition:r("workspaceSidebar.newComposition"),newCompositionInProject:e=>r("workspaceSidebar.newCompositionInProject",{project:e}),newCompositionInGroup:e=>r("workspaceSidebar.newCompositionInGroup",{group:e}),newSpatial:r("spatial.newSpace"),newSpatialInProject:e=>r("spatial.newInProject",{project:e}),newSpatialInGroup:e=>r("spatial.newInGroup",{group:e}),spatialSession:r("spatial.title"),newUiSketch:r("workspaceSidebar.newUiSketch"),newUiSketchInProject:e=>r("workspaceSidebar.newUiSketchInProject",{project:e}),newUiSketchInGroup:e=>r("workspaceSidebar.newUiSketchInGroup",{group:e}),newProject:r("workspaceSidebar.newProject"),styleLibrary:r("styleLibrary.title"),projectNamePlaceholder:r("workspaceSidebar.projectNamePlaceholder"),createProject:r("actions.create"),unassigned:r("workspaceSidebar.unassigned"),containsCurrentSession:r("workspaceSidebar.containsCurrentSession"),imageCompositionSession:r("workspaceSidebar.imageCompositionSession"),uiLayoutSession:r("workspaceSidebar.uiLayoutSession"),sessionActions:r("workspaceSidebar.sessionActions"),projectActions:r("workspaceSidebar.projectActions"),newSessionGroup:r("workspaceSidebar.newSessionGroup"),sessionGroupName:r("workspaceSidebar.sessionGroupName"),sessionGroupActions:r("workspaceSidebar.sessionGroupActions"),renameSessionGroup:r("workspaceSidebar.renameSessionGroup"),deleteSessionGroup:r("workspaceSidebar.deleteSessionGroup"),deleteSessionGroupDescription:r("workspaceSidebar.deleteSessionGroupDescription"),sessionGroupNameConflict:r("workspaceSidebar.sessionGroupNameConflict"),groupSession:r("workspaceSidebar.groupSession"),ungroupedSessions:r("workspaceSidebar.ungroupedSessions"),rename:r("actions.rename"),confirmRename:r("workspaceSidebar.confirmRename"),move:r("actions.move"),moveSessionTitle:r("workspaceSidebar.moveSessionTitle"),selectProject:r("workspaceSidebar.selectProject"),moveUnavailable:r("workspaceSidebar.moveUnavailable"),delete:r("actions.delete"),projectNameConflict:r("workspaceSidebar.projectNameConflict"),renameProjectTitle:r("workspaceSidebar.renameProjectTitle"),deleteProjectTitle:r("workspaceSidebar.deleteProjectTitle"),deleteProjectDescription:r("workspaceSidebar.deleteProjectDescription"),deleteProjectDisabled:r("workspaceSidebar.deleteProjectDisabled"),renameSessionTitle:r("workspaceSidebar.renameSessionTitle"),renameSessionPlaceholder:r("workspaceSidebar.renameSessionPlaceholder"),deleteSessionTitle:r("workspaceSidebar.deleteSessionTitle"),deleteSessionDescription:r("workspaceSidebar.deleteSessionDescription"),cancel:r("actions.cancel"),loading:r("workspaceSidebar.loading"),loadFailed:r("workspaceSidebar.loadFailed"),retry:r("actions.retry"),actionFailed:r("errors.operationFailed")}),[r]);return(0,n.jsx)(o.te,{projects:l,sessions:u,groups:g,currentSessionId:e,...I,loading:y,errorMessage:v,footerExtra:(0,n.jsx)(L,{onRestored:()=>k(e=>e+1)}),repositoryLink:{href:"https://github.com/yisi-ai/human2ai",label:r("app.repositoryLink",{productName:r("app.title")})},languageSelector:{"aria-label":r("language.selectorLabel"),onChange:e=>{(0,h.EM)(e)&&a.changeLanguage(e)},options:N,placement:"top",value:(0,h.wl)(a.resolvedLanguage)},labels:T,...$,onCreateProject:async e=>{let t=await (0,C.gA)(e);d(e=>[t,...e])},onOpenStyleLibrary:()=>i.push("/styles"),onCreateGroup:async(e,t)=>{let i=await (0,C.al)(e,t);f(e=>[...e,i])},onRenameGroup:async(e,t)=>{let i=g.find(t=>t.id===e);if(!i)throw Error("SESSION_GROUP_NOT_FOUND");let n=await (0,C.a6)(e,t,i.revision);f(t=>t.map(t=>t.id===e?n:t))},onDeleteGroup:async e=>{let t=g.find(t=>t.id===e);if(!t)throw Error("SESSION_GROUP_NOT_FOUND");await (0,C.jx)(e,t.revision),f(t=>t.filter(t=>t.id!==e))},onGroupSession:R,onRenameProject:async(e,t)=>{let i=l.find(t=>t.id===e);if(!i)throw Error("PROJECT_NOT_FOUND");let n=await (0,C.oB)(e,t,i.revision);d(t=>t.map(t=>t.id===e?n:t))},onDeleteProject:async e=>{let t=l.find(t=>t.id===e);if(!t)throw Error("PROJECT_NOT_FOUND");await (0,C.xx)(e,t.revision),d(t=>t.filter(t=>t.id!==e)),f(t=>t.filter(t=>t.projectId!==e))},onOpenSession:e=>{let t=u.find(t=>t.id===e);if(!t)return;let n="spatial"===t.sessionType?"/spatial":"ui-layout"===t.sessionType?"/ui-sketch":"/composition";i.push(`${n}?session=${encodeURIComponent(e)}`)},onRenameSession:async(e,t)=>{let i=u.find(t=>t.id===e);if(!i)throw Error("SESSION_NOT_FOUND");let n=await (0,C.Fu)(e,t,i.revision);p(t=>t.map(t=>t.id===e?n:t));let a=M.current;a.currentSessionId===e&&a.onCurrentSessionRename?.(n.title)},onMoveSession:async(e,t)=>{let i=u.find(t=>t.id===e);if(!i)throw Error("SESSION_NOT_FOUND");let n=await (0,C.us)(e,t,i.revision);f(t=>t.map(t=>t.sessionIds.includes(e)?{...t,sessionIds:t.sessionIds.filter(t=>t!==e)}:t)),p(t=>t.map(t=>t.id===e?n:t))},onDeleteSession:async e=>{let t=u.find(t=>t.id===e);if(!t)throw Error("SESSION_NOT_FOUND");await (0,C.ME)(e,t.revision),f(t=>t.map(t=>t.sessionIds.includes(e)?{...t,sessionIds:t.sessionIds.filter(t=>t!==e)}:t)),p(t=>t.filter(t=>t.id!==e)),M.current.currentSessionId===e&&i.push("/")},onRetry:()=>k(e=>e+1)})})},61176:()=>{},63159:()=>{},63294:()=>{},67282:(e,t,i)=>{"use strict";i.d(t,{x:()=>s});var n=i(73365),a=i(76191),r=i(35659);i(22392),i(12853);var o=i(46811);function s({title:e,description:t,children:i,onConfirm:l,confirmLabel:d="确认",cancelLabel:c="取消",scopeLabel:u,danger:m=!0,...h}){return(0,n.jsx)(a.A,{title:e,description:u||t?(0,n.jsxs)("div",{className:"yisi-confirm-action-description",children:[u?(0,n.jsx)("strong",{children:u}):null,t?(0,n.jsx)("span",{children:t}):null]}):void 0,okText:d,cancelText:c,okButtonProps:{danger:m},onConfirm:l,children:(0,n.jsx)(r.Ay,{...h,...(0,o.S)("confirm-action","ConfirmAction","action-pattern"),danger:m,children:i})})}},67925:(e,t,i)=>{"use strict";i.d(t,{r:()=>u});var n=i(73365),a=i(48187),r=i(67872),o=i(1521),s=i(29415),l=i(2684),d=i(46811);function c(e,t){return(0,n.jsx)("span",{className:e,children:t})}function u({label:e,pendingLabel:t,successLabel:i,errorLabel:m,onAction:h,idleIcon:p,successIcon:g=(0,n.jsx)(a.A,{}),errorIcon:f=(0,n.jsx)(r.A,{}),feedbackDurationMs:y=1600,motion:x="auto",onStatusChange:b,onActionError:v,className:w,disabled:j,...k}){let[S,I]=(0,o.useState)("idle"),C=(0,o.useRef)(!0),P=(0,o.useRef)(!1),L=(0,o.useRef)(null);function A(e){C.current&&(I(e),b?.(e))}function M(){C.current&&null!==y&&(L.current=window.setTimeout(()=>{L.current=null,A("idle")},Math.max(0,y)))}async function N(){if(!P.current){P.current=!0,null!==L.current&&(window.clearTimeout(L.current),L.current=null),A("pending");try{if(await h(),!C.current)return;A("success"),M()}catch(e){if(!C.current)return;A("error"),v?.(e),M()}finally{P.current=!1}}}(0,o.useEffect)(()=>(C.current=!0,()=>{C.current=!1,null!==L.current&&window.clearTimeout(L.current)}),[]);let R="pending"===S?t:"success"===S?i:"error"===S?m:e,$="success"===S?c("yisi-action-button-feedback-icon",g):"error"===S?c("yisi-action-button-feedback-icon",f):p,T="pending"===S;return(0,n.jsx)(l.B,{attributes:(0,d.S)("action-button","ActionButton"),children:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s.J,{...k,"aria-label":k["aria-label"]??R,"aria-busy":T||void 0,className:["yisi-action-button",`yisi-action-button-motion-${x}`,w].filter(Boolean).join(" "),"data-action-status":S,disabled:j||T,icon:$,loading:T,mode:"with-icon",onClick:()=>void N(),children:(0,n.jsx)("span",{"data-yisiui-slot":"label",children:R})}),(0,n.jsx)("span",{"aria-atomic":"true","aria-live":"polite",className:"yisi-action-button-announcement",role:"status",children:"idle"===S?"":R})]})})}i(21449)},68071:()=>{},68118:()=>{},68743:()=>{},69388:(e,t,i)=>{"use strict";i.d(t,{G:()=>r,o:()=>o});var n=i(76109),a=i(38954);function r(e){return(0,n.EN)([...e.images,...e.rectangles,...e.texts].map(e=>e.id),e.layerOrder)}function o(e,t,i){let o=r(e),s=(0,n.qP)(o,(0,a.J$)(e,t),i);return s===o?e:{...e,layerOrder:[...s]}}},69854:()=>{},71180:()=>{},71788:(e,t,i)=>{"use strict";i.d(t,{jZ:()=>eJ,$o:()=>ek,Sm:()=>ao,zr:()=>tm,Cf:()=>td,TQ:()=>n8,x8:()=>i7,yP:()=>tJ,X3:()=>nh,ry:()=>i1,te:()=>nK,l7:()=>ez,ds:()=>io,J3:()=>n5,Zz:()=>ra,WL:()=>ag,Hx:()=>aX,cF:()=>ah,Ol:()=>tW,NX:()=>iN,SM:()=>af,FU:()=>th,LE:()=>tY,Nc:()=>tg,vB:()=>tG,MH:()=>tX,kC:()=>tU,Y$:()=>tH,wN:()=>tO});var n=i(73365),a=i(1521);function r(e,t){let i=(0,a.useRef)(new Map),n=new Map(i.current);return(0,a.useLayoutEffect)(()=>{let t=new Set(e);for(let e of n.keys())t.has(e)||n.delete(e);i.current=n}),(e,i,a,r)=>{var o;let s=[...t,i,...a],l=n.get(e);if(l&&(o=l.dependencies,o.length===s.length&&o.every((e,t)=>Object.is(e,s[t]))))return l.element;let d=r();return n.set(e,{dependencies:s,element:d}),d}}function o(e){let t=(0,a.useRef)(e);(0,a.useLayoutEffect)(()=>{t.current=e});let i=(0,a.useRef)(null);return i.current||(i.current=Object.fromEntries(Object.keys(e).map(e=>[e,(...i)=>t.current[e](...i)]))),i.current}function s(e,t){return t.every(t=>{let i=0;for(let n=0;n<e.length;n+=1){let a=e[n],r=e[(n+1)%e.length],o=(r.x-a.x)*(t.y-a.y)-(r.y-a.y)*(t.x-a.x);if(!(1e-7>=Math.abs(o))){if(i&&Math.sign(o)!==i)return!1;i=Math.sign(o)}}return!0})}function l(){let e=new Map;return t=>{let i=new Map(t.map(e=>[e.id,e])),n=new Set;for(let[t,n]of e){let a=i.get(t);if(!(a&&n.tone===a.tone&&n.geometry.length===a.geometry.length&&n.geometry.every((e,t)=>Object.is(e,a.geometry[t])))){for(let i of n.borders.keys())e.get(i)?.borders.delete(t);e.delete(t)}}for(let i of t){if(e.has(i.id))continue;let t=i.outline();e.set(i.id,{...i,points:t,borders:new Map,bounds:{left:Math.min(...t.map(e=>e.x)),right:Math.max(...t.map(e=>e.x)),top:Math.min(...t.map(e=>e.y)),bottom:Math.max(...t.map(e=>e.y))}}),n.add(i.id)}for(let t of n){let i=e.get(t);for(let t of e.values()){if(i.id===t.id||i.tone!==t.tone||n.has(t.id)&&t.id<i.id||i.bounds.right<=t.bounds.left||t.bounds.right<=i.bounds.left||i.bounds.bottom<=t.bounds.top||t.bounds.bottom<=i.bounds.top||!function(e,t){for(let i of[e,t])for(let n=0;n<i.length;n+=1){let a=i[n],r=i[(n+1)%i.length],o=r.y-a.y,s=a.x-r.x,l=e=>{let t=e.map(e=>e.x*o+e.y*s);return[Math.min(...t),Math.max(...t)]},[d,c]=l(e),[u,m]=l(t);if(Math.min(c,m)-Math.max(d,u)<=1e-7)return!1}return!0}(i.points,t.points))continue;let e=s(i.points,t.points),a=s(t.points,i.points);i.borders.set(t.id,!e||a),t.borders.set(i.id,!a||e)}}return new Set([...e.values()].filter(e=>[...e.borders.values()].some(Boolean)).map(({id:e})=>e))}}var d=i(19767),c=i(3500);function u(e){let t=0;for(let i=0;i<e.length;i+=1)t=Math.imul(t,31)+e.charCodeAt(i)>>>0;return t%6}function m(e){return[e.x,e.y,e.primitive,e.area,e.aspect,e.width,e.height,e.rotation,...e.corners?.flatMap(({x:e,y:t})=>[e,t])??[]]}function h(e){return{id:e.id,tone:u(e.id),geometry:m(e),outline:()=>{let t=(0,d.QR)(e,c.cq);if("polygon"===t.type)return t.points;let i="circle"===t.type?t.radius:t.radiusX,n="circle"===t.type?t.radius:t.radiusY,a=(e.rotation??0)*Math.PI/180;return Array.from({length:128},(e,r)=>{let o=2*r*Math.PI/128,s=i*Math.cos(o),l=n*Math.sin(o);return{x:t.cx+s*Math.cos(a)-l*Math.sin(a),y:t.cy+s*Math.sin(a)+l*Math.cos(a)}})}}}var p=i(21755),g=i(39093),f=i(44291),y=i(44040),x=i(81271),b=i(13360),v=i(3742),w=i(35659);i(22392),i(16803);var j=i(46811),k=i(67282);let S=Object.freeze({minRows:3,maxRows:6}),I=(0,a.forwardRef)(function(e,t){let{autoSize:i,rows:a,className:r,...o}=e;return(0,n.jsx)(b.A.TextArea,{...o,ref:t,className:["yisi-text-mark-editor-textarea",r].filter(Boolean).join(" "),autoSize:S,"data-yisiui-auto-size":"content","data-yisiui-min-rows":"3","data-yisiui-max-rows":"6"})});function C({label:e,controlId:t,htmlFor:i,hint:r,children:o}){let s=(0,a.useId)(),l=t??i??o.props.id??s,d=r?`${l}-hint`:void 0,c=[o.props["aria-describedby"],d].filter(Boolean).join(" ")||void 0,u=(0,a.cloneElement)(o,{id:l,"aria-describedby":c});return(0,n.jsxs)("div",{className:"yisi-text-mark-editor-field",children:[(0,n.jsxs)("div",{className:"yisi-text-mark-editor-field-heading",children:[(0,n.jsx)("label",{className:"yisi-text-mark-editor-field-label",htmlFor:l,children:e}),r?(0,n.jsx)("span",{id:d,className:"yisi-text-mark-editor-field-hint",children:r}):null]}),u]})}function P({open:e,title:t,selectedText:i,selectedTextLabel:r,children:o,onCancel:s,onSave:l,saveLabel:d,cancelLabel:c,saveLoading:u=!1,saveDisabled:m=!1,deleteAction:h,error:p}){let g=(0,a.useId)();return(0,n.jsx)(v.A,{open:e,title:t,width:520,destroyOnHidden:!0,footer:null,closable:!u,keyboard:!u,mask:{closable:!u},focusable:{focusTriggerAfterClose:!0},rootClassName:"yisi-text-mark-editor-modal",onCancel:s,children:(0,n.jsxs)("div",{...(0,j.S)("text-mark-editor","TextMarkEditor"),className:"yisi-text-mark-editor","data-has-delete":h?"true":"false","aria-busy":u||void 0,children:[(0,n.jsxs)("section",{className:"yisi-text-mark-editor-context","aria-labelledby":g,children:[(0,n.jsx)("span",{id:g,className:"yisi-text-mark-editor-context-label",children:r}),(0,n.jsx)("blockquote",{className:"yisi-text-mark-editor-quote",children:i})]}),(0,n.jsx)("div",{className:"yisi-text-mark-editor-fields",children:o}),p?(0,n.jsx)("div",{className:"yisi-text-mark-editor-error",role:"alert",children:p}):null,(0,n.jsxs)("div",{className:"yisi-text-mark-editor-actions",children:[h?(0,n.jsx)(k.x,{className:"yisi-text-mark-editor-delete-action",type:"text",size:"small",icon:(0,n.jsx)(x.A,{"aria-hidden":"true"}),title:h.confirmTitle,description:h.confirmDescription,scopeLabel:h.scopeLabel,confirmLabel:h.confirmLabel??h.label,cancelLabel:h.confirmCancelLabel,disabled:u,onConfirm:h.onConfirm,children:h.label}):null,(0,n.jsx)(w.Ay,{disabled:u,onClick:s,children:c}),(0,n.jsx)(w.Ay,{type:"primary",loading:u,disabled:m,onClick:()=>void l(),children:d})]})]})})}let L={bringToFront:"置于顶层",bringForward:"上移一层",sendBackward:"下移一层",sendToBack:"置于底层"};function A(){let[e,t]=(0,a.useState)(!1),[i,n]=(0,a.useState)({x:0,y:0}),r=(0,a.useRef)(null),o=(0,a.useRef)(null),s=(0,a.useCallback)(()=>t(!1),[]),l=(0,a.useCallback)(()=>{t(!1),r.current?.focus()},[]);return(0,a.useEffect)(()=>{if(!e)return;let t=e=>{e.target instanceof Node&&o.current?.contains(e.target)||l()};return window.addEventListener("pointerdown",t,!0),()=>window.removeEventListener("pointerdown",t,!0)},[e,l]),{contextMenuOpen:e,contextMenuPoint:i,contextMenuPopupRef:o,openContextMenuAt:(e,i)=>{r.current=i,n({x:e.clientX,y:e.clientY}),t(!0)},closeContextMenu:l,dismissContextMenu:s}}var M=i(76109),N=i(34345),R=i(78269),$=i(27812),T=i(88912);let F=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"];function E(e,t){return Number.isFinite(e)?Math.max(e,t):1}function D(e,t,i,n){return{x:e,y:t,width:Math.max(0,i-e),height:Math.max(0,n-t)}}var _=i(24539),z=i(98196);function B({children:e,title:t}){let i=(0,a.useId)(),r=(0,a.useRef)(null),o=(0,a.useRef)(null),s=(0,a.useRef)(null),[l,d]=(0,a.useState)(null);function c(e,t){s.current={x:Math.max(8,Math.min(window.innerWidth-8,e)),y:Math.max(8,Math.min(window.innerHeight-8,t))},null===o.current&&(o.current=requestAnimationFrame(()=>{o.current=null;let e=s.current;d(t=>t?.x===e?.x&&t?.y===e?.y?t:e)}))}function u(){null!==o.current&&cancelAnimationFrame(o.current),o.current=null,s.current=null,d(null)}return(0,a.useEffect)(()=>()=>{null!==o.current&&cancelAnimationFrame(o.current)},[]),(0,a.useLayoutEffect)(()=>{l&&r.current?.forceAlign()},[l]),(0,n.jsxs)(n.Fragment,{children:[(0,a.cloneElement)(e,{"aria-describedby":[e.props["aria-describedby"],l?i:void 0].filter(Boolean).join(" ")||void 0,onMouseEnter(t){e.props.onMouseEnter?.(t),t.buttons||c(t.clientX+12,t.clientY+12)},onMouseMove(t){e.props.onMouseMove?.(t),t.buttons?u():c(t.clientX+12,t.clientY+12)},onMouseLeave(t){e.props.onMouseLeave?.(t),u()},onFocus(t){e.props.onFocus?.(t);let i=t.currentTarget.getBoundingClientRect(),n=t.currentTarget.closest(".human2ai-infinite-canvas-viewport")?.getBoundingClientRect(),a=Math.max(0,n?.left??0,i.left),r=Math.max(0,n?.top??0,i.top);c((a+Math.min(window.innerWidth,n?.right??window.innerWidth,i.right))/2,(r+Math.min(window.innerHeight,n?.bottom??window.innerHeight,i.bottom))/2)},onBlur(t){e.props.onBlur?.(t),u()},onPointerDown(t){e.props.onPointerDown?.(t),u()},onKeyDown(t){e.props.onKeyDown?.(t),"Escape"===t.key&&u()}}),l?(0,z.createPortal)((0,n.jsx)(_.A,{ref:r,id:i,title:t,open:!0,trigger:[],arrow:!1,placement:"bottomLeft",align:{offset:[0,0],overflow:{adjustX:!0,adjustY:!0,shiftX:!0,shiftY:!0}},styles:{root:{position:"fixed",pointerEvents:"none",maxWidth:"min(250px, calc(100vw - 16px))"},container:{maxHeight:"calc(100vh - 16px)",overflow:"hidden"}},children:(0,n.jsx)("span",{"aria-hidden":"true",style:{position:"fixed",left:l.x,top:l.y,width:1,height:1,pointerEvents:"none"}})}),document.body):null]})}function q({id:e,label:t,children:i,x:r=0,y:o=0,rotation:s=0,selected:l=!1,controlsHost:d,locked:c=!1,bounds:u,resizeMode:m="free",resizeCenter:h,minimumWidth:p=8,minimumHeight:g=8,screenScale:f=1,resizeHitSize:y=24,resizeHandles:x=F,showRotationHandle:b=!0,rotationHandleOffset:v=32,nudgeStep:w=1,largeNudgeStep:j=10,tooltip:k,onSelect:S,onNudge:I,onResize:C,onResizeEnd:P,onRotate:L,onDoubleClick:A,onDelete:M,onKeyDown:N,className:R,...T}){var _;let J=(0,a.useRef)(null),V=(0,a.useRef)(null),Y=!c&&!!(S||I||C||L||A||M||N),K=["human2ai-canvas-node",R].filter(Boolean).join(" "),X=l&&!c&&!!(u&&C),Q=l&&!c&&b&&!!(u&&L),Z=f>0&&Number.isFinite(f)?f:1,ee=v/Z;function et(t){let i=J.current;if(!i||i.pointerId!==t.pointerId||!C)return;t.preventDefault(),t.stopPropagation();let n=U(t,i.inverseMatrix),a="free"!==m||t.shiftKey,r=function({bounds:e,handle:t,pointer:i,center:n={x:e.x+e.width/2,y:e.y+e.height/2},fromCenter:a=!1,proportional:r=!1,minimumWidth:o=1,minimumHeight:s=1}){let l=t.endsWith("left"),d=t.endsWith("right"),c=t.startsWith("top"),u=t.startsWith("bottom"),m=l||d,h=c||u,p=e.x+e.width,g=e.y+e.height,f=o/e.width,y=s/e.height,x=1,b=1;if(m)if(a){let t=l?e.x:p;x=E((i.x-n.x)/(t-n.x),f)}else x=E((l?p-i.x:i.x-e.x)/e.width,f);if(h)if(a){let t=c?e.y:g;b=E((i.y-n.y)/(t-n.y),y)}else b=E((c?g-i.y:i.y-e.y)/e.height,y);if(r){let e=function({scaleX:e,scaleY:t,movesHorizontally:i,movesVertically:n,minimumScale:a}){return i?n?Math.max(Math.abs(e-1)>=Math.abs(t-1)?e:t,a):Math.max(e,a):Math.max(t,a)}({scaleX:x,scaleY:b,movesHorizontally:m,movesVertically:h,minimumScale:Math.max(f,y)});x=e,b=e}let v=e.width*x,w=e.height*b;return{bounds:{x:a?n.x+(e.x-n.x)*x:l?p-v:d?e.x:e.x+(e.width-v)/2,y:a?n.y+(e.y-n.y)*b:c?g-w:u?e.y:e.y+(e.height-w)/2,width:v,height:w},scaleX:x,scaleY:b}}({bounds:i.sourceBounds,handle:i.handle,pointer:n,center:h,fromCenter:t.altKey,proportional:a,minimumWidth:p,minimumHeight:g});C({id:e,handle:i.handle,bounds:r.bounds,sourceBounds:i.sourceBounds,sourcePosition:i.sourcePosition,sourceRotation:i.sourceRotation,scaleX:r.scaleX,scaleY:r.scaleY,fromCenter:t.altKey,proportional:a})}function ei(e){J.current?.pointerId===e.pointerId&&(P&&"pointerup"===e.type&&et(e),J.current=null,P?.(),G(e.currentTarget,e.pointerId))}function en(e){V.current?.pointerId===e.pointerId&&(V.current=null,G(e.currentTarget,e.pointerId))}let ea=(0,n.jsxs)(n.Fragment,{children:[u?(0,n.jsx)("rect",{className:"human2ai-canvas-node__outline",x:u.x,y:u.y,width:u.width,height:u.height,"aria-hidden":"true"}):null,X&&u?(0,n.jsx)("g",{className:"human2ai-canvas-node__resize-controls","aria-hidden":"true",children:(_=x,[...O,...F.filter(e=>!O.includes(e))].filter(e=>_.includes(e))).map(t=>{let i=function({bounds:e,handle:t,hitSize:i,screenScale:n=1}){let a=Math.max(0,i)/(n>0&&Number.isFinite(n)?n:1)/2,r=Math.min(a,e.width/3),o=Math.min(a,e.height/3),s=e.x-a,l=e.x+r,d=e.x+e.width-r,c=e.x+e.width+a,u=e.y-a,m=e.y+o,h=e.y+e.height-o,p=e.y+e.height+a;return"top"===t?D(l,u,d,m):"right"===t?D(d,m,c,h):"bottom"===t?D(l,h,d,p):"left"===t?D(s,m,l,h):"top-left"===t?D(s,u,l,m):"top-right"===t?D(d,u,c,m):"bottom-right"===t?D(d,h,c,p):D(s,h,l,p)}({bounds:u,handle:t,hitSize:y,screenScale:Z});return(0,n.jsx)("rect",{className:"human2ai-canvas-node__resize-hit","data-node-id":e,"data-resize-handle":t,x:i.x,y:i.y,width:i.width,height:i.height,onPointerDown:i=>(function(t,i){if(!u||!C)return;let n=t.currentTarget.closest("[data-canvas-node]")??t.currentTarget.ownerSVGElement?.querySelector(`[data-canvas-node="${CSS.escape(e)}"]`),a=n?.getScreenCTM();a&&(t.preventDefault(),t.stopPropagation(),n?.focus(),J.current={pointerId:t.pointerId,handle:i,sourceBounds:{...u},sourcePosition:{x:r,y:o},sourceRotation:s,inverseMatrix:a.inverse()},H(t.currentTarget,t.pointerId))})(i,t),onPointerMove:et,onPointerUp:ei,onPointerCancel:ei,onLostPointerCapture:()=>{J.current&&(J.current=null,P?.())}},t)})}):null,Q&&u?(0,n.jsxs)("g",{className:"human2ai-canvas-node__rotation-control","aria-hidden":"true",children:[(0,n.jsx)("line",{className:"human2ai-canvas-node__rotation-stem",x1:u.x+u.width/2,y1:u.y,x2:u.x+u.width/2,y2:u.y-ee}),(0,n.jsx)("circle",{className:"human2ai-canvas-node__rotation-handle",cx:u.x+u.width/2,cy:u.y-ee,r:7/Z}),(0,n.jsx)("circle",{className:"human2ai-canvas-node__rotation-hit","data-node-id":e,"data-rotation-handle":"true",cx:u.x+u.width/2,cy:u.y-ee,r:12/Z,onPointerDown:function(t){if(!L)return;let i=t.currentTarget.closest("[data-canvas-node]")??t.currentTarget.ownerSVGElement?.querySelector(`[data-canvas-node="${CSS.escape(e)}"]`),n=i?.parentElement,a=n?.getScreenCTM();if(!a)return;let l=a.inverse(),d=U(t,l);t.preventDefault(),t.stopPropagation(),i?.focus(),V.current={pointerId:t.pointerId,sourceRotation:s,startAngle:Math.atan2(d.y-o,d.x-r),inverseParentMatrix:l},H(t.currentTarget,t.pointerId)},onPointerMove:function(t){let i=V.current;if(!i||i.pointerId!==t.pointerId||!L)return;t.preventDefault(),t.stopPropagation();let n=U(t,i.inverseParentMatrix),a=(Math.atan2(n.y-o,n.x-r)-i.startAngle)*180/Math.PI;L({id:e,rotation:i.sourceRotation+a,sourceRotation:i.sourceRotation})},onPointerUp:en,onPointerCancel:en,onLostPointerCapture:()=>{V.current=null}})]}):null]}),er=(0,n.jsxs)("g",{...T,...(0,$.Se)({namespace:"human2ai",id:"canvas-node",name:"CanvasNode",category:"module",origin:"project",status:"candidate"}),className:K,"data-canvas-node":e,"data-node-x":r,"data-node-y":o,"data-node-rotation":s,"data-selected":l?"true":"false","data-locked":c?"true":"false","data-resize-mode":C?m:void 0,"data-resizable":C?"true":"false","data-rotatable":L&&b?"true":"false","data-deletable":!c&&M?"true":"false","data-has-operation-outline":u?"true":"false",transform:`translate(${r} ${o}) rotate(${s})`,role:Y?"button":T.role,"aria-label":Y?t:T["aria-label"],"aria-pressed":Y?l:void 0,"aria-disabled":c||void 0,"aria-keyshortcuts":!c&&M?"Delete Backspace":T["aria-keyshortcuts"],tabIndex:Y?T.tabIndex??0:T.tabIndex,onClick:Y?function(t){t.stopPropagation(),W(t.currentTarget),S?.(e,t)}:void 0,onDoubleClick:Y&&A?function(t){t.stopPropagation(),A?.(e,t)}:void 0,onKeyDown:Y?function(t){if(("Delete"===t.key||"Backspace"===t.key)&&l&&M){t.preventDefault(),t.stopPropagation(),M(e,t);return}if("Enter"===t.key||" "===t.key){if(!S)return;t.preventDefault(),S(e,t);return}let i=t.shiftKey?j:w,n={ArrowLeft:{x:-i,y:0},ArrowRight:{x:i,y:0},ArrowUp:{x:0,y:-i},ArrowDown:{x:0,y:i}}[t.key];n&&I?(t.preventDefault(),S?.(e,t),I(n)):N?.(t)}:void 0,onPointerDown:Y?function(e){W(e.currentTarget),T.onPointerDown?.(e)}:T.onPointerDown,children:[i,d&&l?(0,z.createPortal)((0,n.jsx)("g",{className:K,"data-selected":"true","data-canvas-controls":e,transform:`translate(${r} ${o}) rotate(${s})`,children:ea}),d):ea]}),eo=k?[[k.labels.nodeDescription,k.annotation],[k.labels.displayText,k.displayText],[k.labels.note,k.note]].filter(([,e])=>e?.trim()):[];return eo.length>0?(0,n.jsx)(B,{title:(0,n.jsx)("dl",{className:"human2ai-canvas-node__tooltip",children:eo.map(([e,t])=>(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:e}),(0,n.jsx)("dd",{children:t})]},e))}),children:er}):er}i(4549);let O=["top","right","bottom","left"];function U(e,t){let i=new DOMPoint(e.clientX,e.clientY).matrixTransform(t);return{x:i.x,y:i.y}}function H(e,t){try{e.setPointerCapture(t)}catch{}}function G(e,t){e.hasPointerCapture(t)&&e.releasePointerCapture(t)}function W(e){e.focus(),requestAnimationFrame(()=>{e.isConnected&&e.focus()})}let J=(0,a.memo)(function(e){let{type:t,innerStroke:i,className:a,fill:r,stroke:o,strokeWidth:s,opacity:l,style:d,"aria-label":c}=e,u=["human2ai-canvas-shape",a].filter(Boolean).join(" "),m={...(0,$.Se)({namespace:"human2ai",id:"canvas-shape",name:"CanvasShape",category:"module",origin:"project",status:"candidate"}),className:u,fill:r,stroke:o,strokeWidth:s,opacity:l,style:d,role:c?"img":void 0,"aria-label":c,"aria-hidden":!c||void 0,"data-shape-type":t,"data-inner-stroke":i||void 0};if("circle"===t)return"size"in e&&void 0!==e.size?(0,n.jsx)("circle",{...m,cx:0,cy:0,r:e.size/2}):(0,n.jsx)("ellipse",{...m,cx:0,cy:0,rx:e.width/2,ry:e.height/2});if("rectangle"===t)return(0,n.jsx)("rect",{...m,x:-e.width/2,y:-e.height/2,width:e.width,height:e.height});let h=`0,${-2*e.height/3} ${-e.width/2},${e.height/3} ${e.width/2},${e.height/3}`;return(0,n.jsx)("polygon",{...m,points:h})});function V({id:e,label:t,bounds:i,caption:r,name:o,interactionResetKey:s,onBoundsChange:l,selected:d=!1,locked:c=!1,onMove:u,onSelect:m,className:h,...p}){let g=(0,a.useRef)(null),f=(0,a.useRef)(!1),y=(0,a.useRef)(null),x=(0,a.useRef)(null),b=(0,a.useRef)(l);function v(){null!==x.current&&cancelAnimationFrame(x.current),x.current=null;let e=y.current;y.current=null,e&&b.current?.(e)}function w(e){y.current=e,null===x.current&&(x.current=requestAnimationFrame(v))}(0,a.useLayoutEffect)(()=>{b.current=l}),(0,a.useLayoutEffect)(()=>()=>{null!==x.current&&cancelAnimationFrame(x.current),x.current=null,y.current=null,g.current=null},[s,c]);let j=["human2ai-canvas-frame__node",h].filter(Boolean).join(" "),k={x:-i.width/2,y:-i.height/2,width:i.width,height:i.height};function S(t){let i=g.current;if(!i||i.pointerId!==t.pointerId||!u&&!l||(t.preventDefault(),t.stopPropagation(),!i.moved&&3>Math.hypot(t.clientX-i.startClient.x,t.clientY-i.startClient.y)))return;i.moved=!0;let n=Y(t,i.inverseMatrix),a={x:n.x-i.start.x,y:n.y-i.start.y},r={...i.sourceBounds,x:Math.round(i.sourceBounds.x+a.x),y:Math.round(i.sourceBounds.y+a.y)};l?w(r):u?.({id:e,sourceBounds:i.sourceBounds,bounds:{...i.sourceBounds,x:i.sourceBounds.x+a.x,y:i.sourceBounds.y+a.y},delta:a})}function I(e){var t,i;let n=g.current;n?.pointerId===e.pointerId&&(l&&"pointerup"===e.type&&S(e),v(),f.current=n.moved,g.current=null,t=e.currentTarget,i=e.pointerId,t.hasPointerCapture(i)&&t.releasePointerCapture(i),window.setTimeout(()=>{f.current=!1},0))}return(0,n.jsxs)("g",{...(0,$.Se)({namespace:"human2ai",id:"canvas-frame",name:"CanvasFrame",category:"module",origin:"project",status:"candidate"}),className:"human2ai-canvas-frame","data-canvas-frame":e,children:[(0,a.createElement)(q,{...p,key:`${s??""}:${c}`,id:e,label:t,x:i.x+i.width/2,y:i.y+i.height/2,bounds:k,selected:d,locked:c,onSelect:m,resizeHandles:F,showRotationHandle:!1,...l?{resizeMode:"free",resizeCenter:{x:0,y:0},resizeHitSize:32,minimumWidth:T.Qq,minimumHeight:T.Qq,onResize:function(e){w((0,T.w4)({x:e.sourcePosition.x+e.bounds.x,y:e.sourcePosition.y+e.bounds.y,width:e.bounds.width,height:e.bounds.height}))},onResizeEnd:v}:{},className:j,children:[(0,n.jsx)(J,{type:"rectangle",width:i.width,height:i.height,className:"human2ai-canvas-frame__border"},"border"),(0,n.jsx)("rect",{className:"human2ai-canvas-frame__hit",x:k.x,y:k.y,width:k.width,height:k.height,"data-canvas-frame-hit":"true","data-frame-edge-mode":d?"resize":"move","data-frame-movable":!d&&!c&&(u||l)?"true":"false","aria-hidden":"true",onClick:function(e){f.current&&(f.current=!1,e.preventDefault(),e.stopPropagation())},onPointerDown:function(e){if(d||c||!u&&!l||0!==e.button)return;f.current=!1;let t=e.currentTarget.closest("[data-canvas-frame]"),n=t?.querySelector("[data-canvas-node]"),a=t?.parentElement,r=a?.getScreenCTM();if(!r)return;let o=r.inverse();e.preventDefault(),e.stopPropagation(),n?.focus(),g.current={pointerId:e.pointerId,sourceBounds:{...i},start:Y(e,o),startClient:{x:e.clientX,y:e.clientY},inverseMatrix:o,moved:!1},function(e,t){try{e.setPointerCapture(t)}catch{}}(e.currentTarget,e.pointerId)},onPointerMove:S,onPointerUp:I,onPointerCancel:I,onLostPointerCapture:()=>{let e=g.current;e&&(f.current=e.moved,g.current=null,v(),window.setTimeout(()=>{f.current=!1},0))}},"hit-area")]}),o||r?(0,n.jsx)("g",{className:"human2ai-canvas-frame__caption",transform:`translate(${i.x} ${i.y-12})`,"aria-hidden":"true",children:(0,n.jsx)("text",{children:o?`${o} \xb7 ${Math.round(i.width)} \xd7 ${Math.round(i.height)}`:r})}):null]})}function Y(e,t){let i=new DOMPoint(e.clientX,e.clientY).matrixTransform(t);return{x:i.x,y:i.y}}function K({src:e,retainPreviousSource:t=!1,alt:i,width:r,height:o,fit:s="contain",crop:l=null,status:d="ready",loadingLabel:c="图片加载中",errorLabel:u="图片加载失败",emptyLabel:m="图片",opacity:h,className:p,onLoad:g,onError:f}){let[y,x]=(0,a.useState)(e);(0,a.useEffect)(()=>{if(!t||!e)return;let i=!1,n=new Image;return n.src=e,n.decode().then(()=>{i||x(e)}).catch(()=>void 0),()=>{i=!0}},[e,t]);let b=t?y??e:e,v=`human2ai-canvas-image-${(0,a.useId)().replaceAll(":","")}`,w=["human2ai-canvas-image",p].filter(Boolean).join(" "),j=-r/2,k=-o/2,S="fill"===s?"none":`xMidYMid ${"cover"===s?"slice":"meet"}`;return(0,n.jsxs)("g",{...(0,$.Se)({namespace:"human2ai",id:"canvas-image",name:"CanvasImage",category:"module",origin:"project",status:"candidate"}),className:w,"data-image-fit":s,"data-image-status":d,role:"img","aria-label":i,opacity:h,children:[(0,n.jsx)("rect",{className:"human2ai-canvas-image__boundary",x:j,y:k,width:r,height:o,"aria-hidden":"true"}),"ready"===d&&e?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("defs",{children:(0,n.jsx)("clipPath",{id:v,children:(0,n.jsx)("rect",{x:j,y:k,width:r,height:o})})}),(0,n.jsx)("image",{className:"human2ai-canvas-image__content",href:b,x:l?j-l.x/l.width*r:j,y:l?k-l.y/l.height*o:k,width:l?r/l.width:r,height:l?o/l.height:o,preserveAspectRatio:l?"none":S,clipPath:`url(#${v})`,onLoad:g,onError:f,"aria-hidden":"true"})]}):(0,n.jsx)("text",{className:"human2ai-canvas-image__status",x:0,y:0,textAnchor:"middle",dominantBaseline:"middle","aria-hidden":"true",children:"loading"===d?c:"error"===d?u:m})]})}function X(e,t,i,n=[],a){let r=crypto.randomUUID(),o=Object.fromEntries(n.flatMap(e=>{let t=e.assetId&&a?.(e.assetId);return t?[[e.assetId,t]]:[]}));return e.setData(t,JSON.stringify({version:1,token:r,items:i,sources:o})),r}function Q(e,t,i){try{let n=JSON.parse(e.getData(t));if(n?.version!==1||"string"!=typeof n.token||!n.token||!n.sources||"object"!=typeof n.sources||Array.isArray(n.sources)||Object.values(n.sources).some(e=>"string"!=typeof e))return null;let a=i(n.items);return null===a?null:{token:n.token,items:a,sources:n.sources}}catch{return null}}async function Z(e,t,i){for(let n of new Set(e.flatMap(e=>e.assetId?[e.assetId]:[]))){if(!i.isCurrent())return!1;let a=t[n];if(a&&a===i.resolveSource?.(n))continue;if(!a||!i.read||!i.upload)throw Error("Image transfer is unavailable");let r=new URL(a,i.origin);if(r.origin!==i.origin||!/^\/api\/v1\/sessions\/[^/]+\/assets\/[^/]+\/content$/.test(r.pathname))throw Error("Unsupported clipboard image source");let o=await i.read(r.href);if(!i.isCurrent())return!1;let s=await i.upload(o);if(!i.isCurrent())return!1;for(let t of e)t.assetId===n&&(t.assetId=s)}return i.isCurrent()}var ee=i(67677);function et(e){for(let t of Array.from(e.items)){if("file"!==t.kind||!t.type.startsWith("image/"))continue;let e=t.getAsFile();if(e)return e}return Array.from(e.files).find(e=>e.type.startsWith("image/"))??null}async function ei(e){let t=URL.createObjectURL(e);try{var i,n;let e,a=new Image;return a.src=t,await a.decode(),i=a.naturalWidth,n=a.naturalHeight,e=Math.min(1,320/Math.max(i,n)),{width:i*e,height:n*e}}finally{URL.revokeObjectURL(t)}}function en(e){let[t,i]=ee.Ay.useMessage(),n=(0,a.useRef)(null),r=(0,a.useRef)(e),o=(0,a.useRef)(!1),s=(0,a.useRef)(0);function l(i){if(o.current)return;o.current=!0;let n=s.current,a=()=>s.current===n&&!r.current.disabled;t.loading({key:"canvas-image-paste",content:e.labels.uploading,duration:0}),(async()=>{try{let e=await i(a);a()&&e?.()}catch{s.current===n&&t.error(r.current.labels.uploadFailed)}finally{s.current===n&&(o.current=!1,t.destroy("canvas-image-paste"))}})()}return(0,a.useLayoutEffect)(()=>{r.current=e}),(0,a.useLayoutEffect)(()=>(o.current=!1,()=>{s.current+=1,t.destroy()}),[t,e.resetKey]),(0,a.useLayoutEffect)(()=>{let t=n.current;if(!t)return;let i=t.ownerDocument;function a(n){if(n.defaultPrevented||e.disabled)return;let a=n.target===i.body?i.activeElement:n.target;if(a instanceof Node&&t.contains(a))if("copy"===n.type)e.onCopy?.(n);else{let{x:i,y:a,width:o,height:s}=t.viewBox.baseVal;!function(t,i){if(t.defaultPrevented||e.disabled||!e.onUpload||!t.clipboardData)return!1;let n=t.target;if(n instanceof Element&&n.closest('input, textarea, [contenteditable="true"]'))return!1;let a=et(t.clipboardData);if(!a)return!1;t.preventDefault(),t.stopPropagation();let o=e.onUpload;return l(async e=>{let t=await ei(a);if(!e())return;let n=await o(a);return()=>r.current.onImageReady({assetId:n,...i,...t})}),!0}(n,{x:i+o/2,y:a+s/2})&&e.onPasteFallback?.(n)}}return i.addEventListener("copy",a),i.addEventListener("paste",a),()=>{i.removeEventListener("copy",a),i.removeEventListener("paste",a)}}),{sceneRef:n,feedback:i,pasteNodes:function(t,i,n){if(o.current)return;if(0===[...new Set(t.flatMap(e=>e.assetId?[e.assetId]:[]))].filter(t=>!i[t]||i[t]!==e.resolveImageSource?.(t)).length)return void n();let{onReadImageFile:a,onUpload:r,resolveImageSource:s}=e;l(async e=>{if(await Z(t,i,{origin:location.origin,read:a,upload:r,resolveSource:s,isCurrent:e}))return n})}}}var ea=i(21184),er=i(65193),eo=i(76793),es=i(17357),el=i(67925),ed=i(29415);async function ec(e){let t=window;if(t.showSaveFilePicker){let i;try{i=await t.showSaveFilePicker({suggestedName:e.name,types:[{accept:{[e.type]:[e.name.slice(e.name.lastIndexOf("."))]}}]})}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;throw e}let n=await i.createWritable();try{await n.write(e),await n.close()}catch(e){throw await n.abort().catch(()=>void 0),e}return}let i=URL.createObjectURL(e),n=document.createElement("a");n.href=i,n.download=e.name,document.body.append(n);try{n.click()}finally{n.remove(),window.setTimeout(()=>URL.revokeObjectURL(i),6e4)}}function eu({src:e,crop:t,aspectRatio:i,labels:r,disabled:o=!1,sourceLocked:s=!1,renderLayout:l,onUpload:d,onReadFile:c,onCropChange:u}){var m;let h=(0,a.useRef)(null),p=(0,a.useRef)(!1),g=(0,a.useRef)(!1),f=(0,a.useId)(),y=(0,a.useRef)(null),x=(0,a.useRef)(null),b=(0,a.useRef)(null),v=(0,a.useRef)(null),[w,j]=(0,a.useState)(e),k=s?w:e,[S,I]=(0,a.useState)(!1),[C,P]=(0,a.useState)(!1),[L,A]=(0,a.useState)(null),[M,N]=(0,a.useState)(!1),[R,T]=(0,a.useState)(null),[F,E]=(0,a.useState)(null),[D,_]=(0,a.useState)(null),[z,B]=(0,a.useState)(!1),[q,O]=(0,a.useState)(null),[U,H]=(0,a.useState)(!1),[G,W]=(0,a.useState)(!1),[J,V]=(0,a.useState)(0),[Y,K]=(0,a.useState)(!1),[X,Q]=(0,a.useState)(""),Z=`${f}-source`;async function ee(e){if(o||s||p.current)return!1;p.current=!0,I(!0),P(!1);try{return await d(e),!0}catch{return P(!0),!1}finally{p.current=!1,I(!1),y.current&&(y.current.value="")}}async function ei(){if(e&&D?.src===e&&!p.current&&!g.current){g.current=!0,B(!0),O(null);try{await ec(D.file)}catch{O(e)}finally{g.current=!1,B(!1)}}}function en(e){b.current=e,T(e)}function ef(e,t,i,n=b.current){if(!o&&n&&L){v.current={mode:t,pointerId:e.pointerId,startClientX:e.clientX,startClientY:e.clientY,startCrop:n,handle:i},e.currentTarget.closest("[data-crop-selection]")?.focus({preventScroll:!0});try{e.currentTarget.setPointerCapture?.(e.pointerId)}catch{}e.preventDefault(),e.stopPropagation()}}function ey(t){let i=v.current;if(!i||i.pointerId!==t.pointerId)return;v.current=null;let n=b.current;n&&L&&u(n,ep(n,L)),s&&j(e)}(0,a.useLayoutEffect)(()=>{s&&!v.current&&j(e)},[s,e]),(0,a.useLayoutEffect)(()=>{K(!1)},[e]),(0,a.useEffect)(()=>{let t=!1;return E(null),_(null),O(null),W(!1),H(!!(e&&c)),e&&c&&c(e).then(async i=>{let n="image/svg+xml"===i.type?await i.text():null;t||(_({src:e,file:i}),E(n))}).catch(()=>{t||W(!0)}).finally(()=>{t||H(!1)}),()=>{t=!0}},[c,J,e]),(0,a.useLayoutEffect)(()=>{A(null),N(!1),T(null),b.current=null,v.current=null},[k]),(0,a.useEffect)(()=>{var e,n,a;let r;if(!k||!L)return;let o=t?{...t}:{...a=(e=L,n=i,(r=e.width/e.height)>n?{x:0,y:0,width:n/r,height:1}:{x:0,y:0,width:1,height:r/n}),x:(1-a.width)/2,y:(1-a.height)/2};b.current=o,T(o)},[i,t,L,k]),(0,a.useEffect)(()=>{let e=h.current;if(!e)return;let t=e.closest('[role="dialog"]')??e,i=e.ownerDocument;function n(e){if(e.defaultPrevented||!e.clipboardData||o||s)return;let n=e.target===i.body?i.activeElement:e.target;if(!(n instanceof Node)||!t.contains(n))return;let a=et(e.clipboardData);a&&(e.preventDefault(),e.stopPropagation(),ee(a))}return i.addEventListener("paste",n),()=>i.removeEventListener("paste",n)});let ex=L&&L.width<L.height?`min(100%, ${Math.round(360*L.width/L.height)}px)`:"100%",eb=e&&D?.src===e?D.file.size:null,ev=null!==eb&&eb>=1e6?"MB":null!==eb&&eb>=1e3?"KB":"B",ew="MB"===ev?1e6:"KB"===ev?1e3:1,ej=[e&&L?r.sourceDimensions(L.width,L.height):null,null!==eb?r.sourceFileSize(Number((eb/ew).toFixed(1)),ev):null].filter(Boolean).join(" \xb7 "),ek=(0,n.jsx)("div",{className:"human2ai-canvas-image-editor-fields__preview-shell",children:e?M?(0,n.jsx)("div",{className:"human2ai-canvas-image-editor-fields__preview-status",role:"alert",children:r.cropLoadFailed}):(0,n.jsxs)("div",{ref:x,className:"human2ai-canvas-image-editor-fields__preview",style:{aspectRatio:L?`${L.width} / ${L.height}`:void 0,visibility:L?"visible":"hidden",width:ex},onPointerDown:function(e){let t=x.current?.getBoundingClientRect(),i=b.current;if(o||!t||!i)return;let n=eg((e.clientX-t.left)/t.width-i.width/2,0,1-i.width),a=eg((e.clientY-t.top)/t.height-i.height/2,0,1-i.height),r={...i,x:n,y:a};en(r),ef(e,"move",void 0,r)},onPointerMove:function(e){var t,i,n;let a,r,o,s,l,d,c,u,m,h,p=v.current,g=x.current?.getBoundingClientRect();if(!p||p.pointerId!==e.pointerId||!g)return;let f=(e.clientX-p.startClientX)/g.width,y=(e.clientY-p.startClientY)/g.height;en("move"===p.mode?eh(p.startCrop,f,y):(t=p,i=f,n=y,a=t.startCrop,o=(r=t.handle??"south-east").endsWith("east"),s=r.startsWith("south"),l=o?a.x:a.x+a.width,d=s?a.y:a.y+a.height,c=o?1-l:l,u=s?1-d:d,m=eg(a.width+(o?i:-i),Math.min(.05,c),c),h=eg(a.height+(s?n:-n),Math.min(.05,u),u),{x:o?l:l-m,y:s?d:d-h,width:m,height:h}))},onPointerUp:ey,onPointerCancel:ey,children:[(0,n.jsx)("img",{src:k,alt:"",draggable:!1,onLoad:e=>{let t=e.currentTarget;A({width:t.naturalWidth,height:t.naturalHeight}),N(!1)},onError:()=>{A(null),N(!0)}}),R?(0,n.jsx)("div",{className:"human2ai-canvas-image-editor-fields__crop-selection",style:(m=R,{left:`${100*m.x}%`,top:`${100*m.y}%`,width:`${100*m.width}%`,height:`${100*m.height}%`}),role:"group","aria-label":r.cropTitle,"aria-keyshortcuts":"ArrowLeft ArrowRight ArrowUp ArrowDown",tabIndex:o?-1:0,"data-crop-selection":!0,onPointerDown:e=>ef(e,"move"),onKeyDown:function(e){var t;let i=b.current;if(o||!i||"ArrowLeft"!==(t=e.key)&&"ArrowRight"!==t&&"ArrowUp"!==t&&"ArrowDown"!==t)return;e.preventDefault();let n=e.shiftKey?.05:.01,a=eh(i,"ArrowLeft"===e.key?-n:"ArrowRight"===e.key?n:0,"ArrowUp"===e.key?-n:"ArrowDown"===e.key?n:0);en(a),L&&u(a,ep(a,L))},children:em.map(e=>(0,n.jsx)("span",{className:"human2ai-canvas-image-editor-fields__crop-handle","data-crop-handle":e,"aria-hidden":"true",onPointerDown:t=>ef(t,"resize",e)},e))}):null]}):(0,n.jsx)("div",{className:"human2ai-canvas-image-editor-fields__preview-status","aria-label":r.content,children:(0,n.jsx)(ea.A,{"aria-hidden":"true"})})}),eS=(0,n.jsxs)("section",{ref:h,...(0,$.Se)({namespace:"human2ai",id:"canvas-image-editor-fields",name:"CanvasImageEditorFields",category:"module",origin:"project",status:"candidate"}),className:"human2ai-canvas-image-editor-fields","aria-labelledby":f,children:[(0,n.jsxs)("div",{className:"human2ai-canvas-image-editor-fields__heading",children:[(0,n.jsx)("span",{id:f,className:"yisi-text-mark-editor-field-label",children:r.content}),ej&&(0,n.jsx)("span",{className:"human2ai-canvas-image-editor-fields__metadata",children:ej})]}),(0,n.jsxs)("div",{className:"human2ai-canvas-image-editor-fields__actions",children:[!s&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("input",{ref:y,className:"human2ai-canvas-image-editor-fields__input",type:"file",accept:"image/png,image/jpeg,image/webp,image/svg+xml,.svg",disabled:o||S,onChange:e=>{let t=e.target.files?.[0];t&&ee(t)}}),(0,n.jsx)(ed.J,{mode:"with-icon",icon:(0,n.jsx)(ea.A,{}),loading:S,disabled:o||S,onClick:()=>y.current?.click(),children:S?r.uploading:e?r.replace:r.upload})]}),e&&c&&(0,n.jsx)(ed.J,{mode:"with-icon",icon:(0,n.jsx)(er.A,{"aria-hidden":"true"}),loading:z,disabled:S||z||D?.src!==e,onClick:()=>{ei()},children:z?r.downloading:r.download}),!s&&(0,n.jsx)(ed.J,{mode:"with-icon",icon:(0,n.jsx)(eo.A,{"aria-hidden":"true"}),disabled:o||S,"aria-expanded":Y,"aria-controls":Z,onClick:()=>{Q(""),K(!0),P(!1)},children:r.svgPaste}),null!==F&&(0,n.jsx)(el.r,{label:r.svgCopy,pendingLabel:r.svgCopying,successLabel:r.svgCopied,errorLabel:r.svgCopyFailed,idleIcon:(0,n.jsx)(es.A,{"aria-hidden":"true"}),disabled:S,onAction:()=>navigator.clipboard.writeText(F)},e)]}),!s&&(0,n.jsx)("span",{className:"human2ai-canvas-image-editor-fields__hint",role:C?"alert":void 0,children:C?Y?r.svgSaveFailed:r.uploadFailed:r.fileTypes}),U&&(0,n.jsx)("span",{role:"status",children:r.sourceLoading}),q===e&&(0,n.jsx)("span",{role:"alert",children:r.downloadFailed}),G&&(0,n.jsxs)("div",{role:"alert",children:[r.sourceLoadFailed,(0,n.jsx)(ed.J,{onClick:()=>V(e=>e+1),children:r.retry})]}),Y&&(0,n.jsxs)("div",{id:Z,className:"human2ai-canvas-image-editor-fields__source",children:[(0,n.jsx)("label",{htmlFor:`${Z}-input`,children:r.svgSource}),(0,n.jsx)("textarea",{id:`${Z}-input`,className:"yisi-text-mark-editor-textarea","aria-label":r.svgSource,value:X,onChange:e=>Q(e.target.value),disabled:o||s||S,rows:10,spellCheck:!1,autoFocus:!0}),(0,n.jsxs)("div",{className:"human2ai-canvas-image-editor-fields__actions",children:[(0,n.jsx)(ed.J,{loading:S,disabled:o||s||S||!X.trim(),onClick:async()=>{await ee(new File([X],"image.svg",{type:"image/svg+xml"}))&&K(!1)},children:r.svgApply}),(0,n.jsx)(ed.J,{disabled:S,onClick:()=>{K(!1),P(!1)},children:r.cancel})]})]}),!l&&ek]});return l?l(eS,ek):eS}i(1713);let em=["north-west","north-east","south-east","south-west"];function eh(e,t,i){return{...e,x:eg(e.x+t,0,1-e.width),y:eg(e.y+i,0,1-e.height)}}function ep(e,t){return e.width*t.width/(e.height*t.height)}function eg(e,t,i){return Math.min(i,Math.max(t,e))}function ef(e){let{type:t,className:i,stroke:r,strokeWidth:o,dashArray:s,opacity:l,hitWidth:d,"aria-label":c}=e,u=`human2ai-canvas-line-arrow-${(0,a.useId)().replaceAll(":","")}`,m=["human2ai-canvas-line",i].filter(Boolean).join(" "),h="infinite"===t?function(e,t,i){let n=t*Math.PI/180,a={x:Math.cos(n),y:Math.sin(n)},r=i.x,o=i.x+i.width,s=i.y,l=i.y+i.height,d=[];function c(t){let i={x:e.x+a.x*t,y:e.y+a.y*t,distance:t};i.x<r-1e-6||i.x>o+1e-6||i.y<s-1e-6||i.y>l+1e-6||d.some(e=>1e-6>Math.hypot(e.x-i.x,e.y-i.y))||d.push(i)}return(Math.abs(a.x)>1e-6&&(c((r-e.x)/a.x),c((o-e.x)/a.x)),Math.abs(a.y)>1e-6&&(c((s-e.y)/a.y),c((l-e.y)/a.y)),d.length<2)?null:(d.sort((e,t)=>e.distance-t.distance),{start:d[0],end:d[d.length-1]})}(e.anchor,e.angle,e.bounds):{start:e.start,end:e.end};return(0,n.jsxs)("g",{...(0,$.Se)({namespace:"human2ai",id:"canvas-line",name:"CanvasLine",category:"module",origin:"project",status:"candidate"}),className:m,"data-line-type":t,role:c?"img":void 0,"aria-label":c,"aria-hidden":!c||void 0,opacity:l,children:["directed"===t?(0,n.jsx)("defs",{children:(0,n.jsx)("marker",{id:u,viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"4",markerHeight:"4",orient:"auto-start-reverse",markerUnits:"strokeWidth",children:(0,n.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"context-stroke"})})}):null,h?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("line",{className:"human2ai-canvas-line__hit",x1:h.start.x,y1:h.start.y,x2:h.end.x,y2:h.end.y,strokeWidth:d}),(0,n.jsx)("line",{className:"human2ai-canvas-line__visible",x1:h.start.x,y1:h.start.y,x2:h.end.x,y2:h.end.y,stroke:r,strokeWidth:o,strokeDasharray:s,markerEnd:"directed"===t?`url(#${u})`:void 0})]}):null]})}function ey({radius:e=6,className:t,fill:i,stroke:a,strokeWidth:r,opacity:o,"aria-label":s}){let l=["human2ai-canvas-point",t].filter(Boolean).join(" ");return(0,n.jsx)("circle",{...(0,$.Se)({namespace:"human2ai",id:"canvas-point",name:"CanvasPoint",category:"module",origin:"project",status:"candidate"}),className:l,cx:0,cy:0,r:e,fill:i,stroke:a,strokeWidth:r,opacity:o,role:s?"img":void 0,"aria-label":s,"aria-hidden":!s||void 0})}function ex({tool:e,viewportBounds:t,onPlace:i,onCancel:r}){let o=(0,a.useRef)(null),s=(0,a.useRef)(null),l=(0,a.useRef)(null),d=(0,a.useRef)(null),c=(0,a.useRef)(null),u=(0,a.useRef)({onPlace:i,onCancel:r});function m(){null!==d.current&&cancelAnimationFrame(d.current),d.current=null,c.current=null,o.current?.removeAttribute("d")}function h(){l.current=null,m(),u.current.onCancel()}function p(t){var i,n,a;let r;s.current={clientX:t.clientX,clientY:t.clientY};let d=o.current.ownerSVGElement,c=d.createSVGPoint();c.x=t.clientX,c.y=t.clientY;let u=c.matrixTransform(d.getScreenCTM().inverse()),m=l.current,h=!!(m&&Math.hypot(t.clientX-m.client.x,t.clientY-m.client.y)>=3);return i=e,n=m?.start??u,a=u,r=h&&!i.clickOnly&&"point"!==i.shape,{start:{x:n.x,y:n.y},end:r?{x:a.x,y:a.y}:{x:n.x+i.width,y:n.y},dragged:r,bounds:{x:r?Math.min(n.x,a.x):n.x,y:r?Math.min(n.y,a.y):n.y,width:r?Math.max(8,Math.abs(a.x-n.x)):i.width,height:r?Math.max(8,Math.abs(a.y-n.y)):i.height}}}function g(t){c.current=t,null===d.current&&(d.current=requestAnimationFrame(()=>{d.current=null;let t=c.current;t&&o.current?.setAttribute("d",function(e,t){let{x:i,y:n,width:a,height:r}=t.bounds;return"point"===e.shape?`M ${i-8} ${n} H ${i+8} M ${i} ${n-8} V ${n+8}`:"line"===e.shape?`M ${t.start.x} ${t.start.y} L ${t.end.x} ${t.end.y}`:"ellipse"===e.shape?`M ${i} ${n+r/2} a ${a/2} ${r/2} 0 1 0 ${a} 0 a ${a/2} ${r/2} 0 1 0 ${-a} 0`:"triangle"===e.shape?`M ${i+a/2} ${n} L ${i+a} ${n+r} H ${i} Z`:`M ${i} ${n} h ${a} v ${r} h ${-a} Z`}(e,t))}))}return u.current={onPlace:i,onCancel:r},(0,a.useLayoutEffect)(()=>{function e(e){"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),h())}return o.current?.ownerSVGElement?.focus({preventScroll:!0}),window.addEventListener("keydown",e,!0),window.addEventListener("blur",h),()=>{window.removeEventListener("keydown",e,!0),window.removeEventListener("blur",h),l.current=null,m()}},[]),(0,a.useLayoutEffect)(()=>{s.current&&c.current&&g(p(s.current))},[t.x,t.y,t.width,t.height]),(0,n.jsxs)("g",{...(0,$.Se)({namespace:"human2ai",id:"canvas-placement",name:"CanvasPlacement",category:"module",origin:"project",status:"candidate"}),className:"human2ai-canvas-placement","data-canvas-placement":!0,onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),onPointerDown:e=>{if(0!==e.button||l.current)return;e.preventDefault(),e.stopPropagation();let t=p(e);l.current={pointerId:e.pointerId,start:t.start,client:{x:e.clientX,y:e.clientY}},e.currentTarget.setPointerCapture(e.pointerId),g(t)},onPointerMove:e=>{e.stopPropagation(),l.current&&l.current.pointerId!==e.pointerId||(0===e.buttons||l.current)&&g(p(e))},onPointerLeave:()=>{l.current||m()},onPointerUp:e=>{if(l.current?.pointerId!==e.pointerId)return;e.preventDefault(),e.stopPropagation();let t=p(e);l.current=null,m(),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),u.current.onPlace(t)},onPointerCancel:e=>{e.stopPropagation(),l.current?.pointerId===e.pointerId&&h()},onLostPointerCapture:e=>{e.stopPropagation(),l.current?.pointerId===e.pointerId&&h()},children:[(0,n.jsx)("rect",{...t,fill:"transparent",pointerEvents:"all"}),(0,n.jsx)("path",{ref:o,className:"human2ai-canvas-placement__preview","aria-hidden":"true"})]})}function eb({bounds:e,children:t,className:i,role:a="group",...r}){let o=["human2ai-canvas-scene",i].filter(Boolean).join(" ");return(0,n.jsx)("svg",{...r,...(0,$.Se)({namespace:"human2ai",id:"canvas-scene",name:"CanvasScene",category:"module",origin:"project",status:"candidate"}),className:o,viewBox:`${e.x} ${e.y} ${e.width} ${e.height}`,role:a,children:t})}i(53439);var ev=i(16269),ew=i(60773),ej=i(48511);function ek({value:e,onChange:t,hasMultipleStates:i,hasPreviousState:a,disabled:r=!1,labels:o=ej.canvas.display}){return(0,n.jsx)("div",{...(0,$.Se)({namespace:"human2ai",id:"canvas-display-controls",name:"CanvasDisplayControls",category:"module",origin:"project",status:"candidate"}),className:"human2ai-canvas-display-controls",children:[{key:"showHiddenNodes",icon:(0,n.jsx)(ev.A,{"aria-hidden":"true"}),enabled:e.showHiddenNodes,disabled:r},{key:"onionSkin",icon:(0,n.jsx)(ew.A,{"aria-hidden":"true"}),enabled:e.onionSkin&&a,disabled:r||!a}].filter(e=>"onionSkin"!==e.key||i).map(i=>(0,n.jsx)(ed.J,{mode:"with-icon",size:"small",icon:i.icon,"aria-label":o[i.key],title:o[i.key],"aria-pressed":i.enabled,disabled:i.disabled,backgroundColor:i.enabled?"color.action.primaryActive":"none",textColor:i.enabled?"color.text.onPrimary":"color.text.secondary",onClick:()=>t({...e,[i.key]:!e[i.key]}),children:o[i.key]},i.key))})}function eS({stateId:e,children:t}){return(0,n.jsx)("g",{className:"human2ai-canvas-onion-skin","data-canvas-onion-skin":e,"aria-hidden":"true",children:t})}i(63294);var eI=i(50018);i(61176);let eC=(0,p._)(I),eP={title:"编辑节点",note:"备注",noteHelp:ej.notes.element.nodeHelp,notePlaceholder:"说明这个节点表达什么",shotScale:"景别",shotScaleAuto:"自动",shotScaleForeground:"前景",shotScaleMidground:"中景",shotScaleBackground:"背景",deleteNode:"删除节点",confirmDeleteNode:"确认删除这个节点?",cancelDelete:"保留",shapeKind:"形状",pointKind:"点",lineKind:"线",textKind:"文字",imageKind:"图像",nodeDescription:"节点说明",nodeDescriptionHelp:ej.canvas.node.nodeDescriptionHelp,originUser:"user",originAgent:"agent",originImport:"import"};function eL({nodeKind:e,metadata:t,onMetadataChange:i,onRequestClose:a,onDelete:r,labels:o,titleExtra:s,leadingFields:l,propertyFields:d,trailingFields:c,autoFocusField:u="note",disabled:m=!1,className:h,style:p,"aria-label":g}){var f,x;let b={...eP,...o},v=(f=e,x=b,"shape"===f?x.shapeKind:"point"===f?x.pointKind:"line"===f?x.lineKind:"text"===f?x.textKind:x.imageKind),w=[{value:"auto",label:b.shotScaleAuto},{value:"foreground",label:b.shotScaleForeground},{value:"midground",label:b.shotScaleMidground},{value:"background",label:b.shotScaleBackground}];return(0,n.jsx)(P,{open:!0,title:(0,n.jsxs)("div",{className:"human2ai-canvas-node-editor__title",children:[(0,n.jsxs)("span",{className:"human2ai-canvas-node-editor__heading",children:[(0,n.jsx)("span",{className:"human2ai-canvas-node-editor__origin",children:"agent"===t.origin?b.originAgent:"import"===t.origin?b.originImport:b.originUser}),(0,n.jsx)("span",{children:`${b.title} \xb7 ${v}`})]}),s]}),selectedText:v,selectedTextLabel:b.title,saveLabel:"",cancelLabel:"",onCancel:a,onSave:()=>void 0,deleteAction:r&&!m?{label:b.deleteNode,confirmTitle:b.confirmDeleteNode,confirmCancelLabel:b.cancelDelete,onConfirm:r}:void 0,children:(0,n.jsxs)("div",{...(0,$.Se)({namespace:"human2ai",id:"canvas-node-editor",name:"Human2AiCanvasNodeEditor",category:"module",origin:"project",status:"candidate"}),className:["human2ai-canvas-node-editor",h].filter(Boolean).join(" "),style:p,"aria-label":g,"aria-disabled":m||void 0,"data-human2ai-auto-save-node-editor":!0,"data-node-kind":e,"data-empty":t.note||"auto"!==t.shotScale?"false":"true",children:[(0,n.jsxs)("div",{className:"human2ai-canvas-node-editor__primary-fields",children:["user"!==t.origin&&t.annotation.trim()?(0,n.jsx)(C,{label:b.nodeDescription,hint:(0,n.jsx)(_.A,{title:b.nodeDescriptionHelp,trigger:["hover","focus"],children:(0,n.jsx)(ed.J,{className:"human2ai-canvas-node-editor__field-help",mode:"icon-only",size:"small",type:"text",backgroundColor:"none",icon:(0,n.jsx)(eI.A,{"aria-hidden":"true"}),iconLabel:b.nodeDescriptionHelp})}),children:(0,n.jsx)("p",{className:"human2ai-canvas-node-editor__description",children:t.annotation})}):null,l,(0,n.jsx)(C,{label:b.note,hint:(0,n.jsx)(_.A,{title:b.noteHelp,trigger:["hover","focus"],children:(0,n.jsx)(ed.J,{className:"human2ai-canvas-node-editor__field-help",mode:"icon-only",size:"small",type:"text",backgroundColor:"none",icon:(0,n.jsx)(eI.A,{"aria-hidden":"true"}),iconLabel:b.noteHelp})}),children:(0,n.jsx)(eC,{name:"nodeNote",autoFocus:"note"===u,value:t.note,placeholder:b.notePlaceholder,"aria-label":b.note,disabled:m,onChange:e=>i({note:e.target.value})})}),(0,n.jsxs)("div",{className:"human2ai-canvas-node-editor__properties",children:[(0,n.jsx)(C,{label:b.shotScale,children:(0,n.jsx)(y.A,{className:"human2ai-canvas-node-editor__property-select human2ai-canvas-node-editor__shot-scale-select",value:t.shotScale,options:w,"aria-label":b.shotScale,disabled:m,onChange:e=>i({shotScale:e})})}),d]})]}),c?(0,n.jsx)("aside",{className:"human2ai-canvas-node-editor__side-fields",children:c}):null]})})}var eA=i(66234),eM=i(84092),eN=i(19330),eR=i(94423),e$=i(96313);i(88307);var eT=i(50052);function eF({tools:e,children:t,collapsed:i,defaultCollapsed:r=!1,onCollapsedChange:o,collapseLabel:s="收起侧边面板",expandLabel:l="展开侧边面板",width:d=220,"aria-label":c="侧边操作面板",className:u,style:m}){let h=(0,a.useId)(),[p,g]=(0,a.useState)(r),f=void 0!==i,y=i??p,x=y?l:s;return(0,n.jsxs)("aside",{...(0,j.S)("side-action-panel","SideActionPanel","panel-pattern"),className:["yisi-side-action-panel",y?"yisi-side-action-panel--collapsed":null,u].filter(Boolean).join(" "),"data-collapsed":y?"true":"false","aria-label":c,style:{...m,width:y?48:d},children:[(0,n.jsxs)("div",{className:"yisi-side-action-panel-header",children:[e?(0,n.jsx)("div",{className:"yisi-side-action-panel-tools",role:"group","aria-label":"面板工具",children:e}):null,(0,n.jsx)(w.Ay,{className:"yisi-side-action-panel-toggle",type:"text",icon:y?(0,n.jsx)(eR.A,{}):(0,n.jsx)(e$.A,{}),"aria-label":x,title:x,"aria-expanded":!y,"aria-controls":h,onClick:function(){let e=!y;f||g(e),o?.(e)}})]}),(0,n.jsx)(eT.I,{collapsed:y,children:(0,n.jsx)("div",{id:h,className:"yisi-side-action-panel-actions",children:t})})]})}i(49404);let eE={width:1,height:1},eD={x:0,y:0},e_={zoomOut:"缩小画布",zoomIn:"放大画布",currentZoom:"当前缩放",fitAll:"适应全部",help:"画布操作说明",interactionHelp:"滚轮缩放;按住右键拖动画布;按住空格键并使用左键拖动画布。",sideActions:"画布操作",collapseSideActions:"收起画布操作",expandSideActions:"展开画布操作"};function ez({children:e,onContextMenuRequest:t,cameraCenter:i,defaultCameraCenter:r=eD,zoom:o,defaultZoom:s=1,minimumZoom:l=.25,maximumZoom:d=4,fitRequest:c,contentBounds:u,backgroundPattern:m="dots",showViewportControls:h=!0,sideActions:p,sideActionPlacement:g="right",sideActionPanelWidth:f,sideActionPanelDefaultCollapsed:y=!1,labels:x,onCameraCenterChange:b,onZoomChange:v,className:w,style:j,"aria-label":k="无限画布"}){let S=(0,a.useRef)(null),I=`human2ai-infinite-canvas-${(0,a.useId)().replaceAll(":","")}`,[C,P]=(0,a.useState)(eE),[L,A]=(0,a.useState)(r),[M,N]=(0,a.useState)(s),[R,T]=(0,a.useState)(!1),[F,E]=(0,a.useState)(!1),D=(0,a.useRef)(!1),z=(0,a.useRef)(!1),B=(0,a.useRef)(null),q=(0,a.useRef)(!1),O=(0,a.useRef)(null),U=(0,a.useRef)(0),H=(0,a.useRef)(null),G={...e_,...x},W=Math.min(l,d),J=Math.max(l,d),V=i??L,Y=eq(o??M,W,J),K={width:C.width/Y,height:C.height/Y},X={x:V.x-K.width/2,y:V.y-K.height/2,width:K.width,height:K.height},Q=["human2ai-infinite-canvas-viewport",R?"human2ai-infinite-canvas-viewport--pan-ready":null,F?"human2ai-infinite-canvas-viewport--panning":null,w].filter(Boolean).join(" "),Z=er({x:0,y:0});function ee(e){void 0===i&&A(e),b?.(e)}function et(){cancelAnimationFrame(U.current),U.current=0;let e=H.current;H.current=null,e&&(ee(e.center),e.zoom!==Y&&en(e.zoom))}function ei(e,t=Y){H.current={center:e,zoom:t},U.current||(U.current=requestAnimationFrame(et))}function en(e){let t=eq(e,W,J);void 0===o&&N(t),v?.(t)}function ea(e,t=48){cancelAnimationFrame(U.current),U.current=0,H.current=null;let i=Math.max(0,t),n=Math.max(1,C.width-2*i),a=Math.max(1,C.height-2*i),r=eq(Math.min(n/Math.max(1,e.width),a/Math.max(1,e.height)),W,J);ee({x:e.x+e.width/2,y:e.y+e.height/2}),en(r)}function er(e){return{x:(e.x-X.x)*Y,y:(e.y-X.y)*Y}}function eo(e){let i=B.current;i&&i.pointerId===e.pointerId&&(et(),B.current=null,E(!1),e.preventDefault(),e.stopPropagation(),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),"pointerup"===e.type&&i.rightButton&&!i.moved&&t?.({clientX:e.clientX,clientY:e.clientY,target:i.contextTarget}),window.setTimeout(()=>{q.current=!1},0))}return(0,a.useEffect)(()=>{let e=S.current;if(!e)return;let t=()=>{let t=Math.max(1,e.clientWidth),i=Math.max(1,e.clientHeight);P(e=>e.width===t&&e.height===i?e:{width:t,height:i})};if(t(),"u"<typeof ResizeObserver)return;let i=new ResizeObserver(t);return i.observe(e),()=>i.disconnect()},[]),(0,a.useEffect)(()=>{let e=S.current;if(!e)return;let t=t=>{t.preventDefault();let i=H.current?.zoom??Y,n=H.current?.center??V,a=eq(i*Math.exp(-(.0015*t.deltaY)),W,J);if(a===i)return;let r=e.getBoundingClientRect(),o={x:t.clientX-r.left,y:t.clientY-r.top},s={x:n.x+(o.x-r.width/2)/i,y:n.y+(o.y-r.height/2)/i};ei({x:s.x+(r.width/2-o.x)/a,y:s.y+(r.height/2-o.y)/a},a)};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)}),(0,a.useEffect)(()=>()=>{cancelAnimationFrame(U.current)},[]),(0,a.useEffect)(()=>{!c||O.current===c.id||C.width<=1||C.height<=1||(O.current=c.id,ea(c.bounds,c.padding))},[c,J,W,C.height,C.width]),(0,a.useEffect)(()=>{let e=e=>{var t;"Space"!==e.code||!D.current||(t=e.target)instanceof HTMLElement&&(t.matches("input, textarea, select, button, a[href]")||t.isContentEditable)||(e.preventDefault(),z.current=!0,T(!0))},t=()=>{z.current=!1,T(!1)},i=e=>{"Space"===e.code&&t()};return window.addEventListener("keydown",e),window.addEventListener("keyup",i),window.addEventListener("blur",t),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",i),window.removeEventListener("blur",t)}},[]),(0,n.jsxs)("div",{ref:S,...(0,$.Se)({namespace:"human2ai",id:"infinite-canvas-viewport",name:"InfiniteCanvasViewport",category:"module",origin:"project",status:"candidate"}),className:Q,style:j,role:"region","aria-label":k,"data-camera-center-x":V.x,"data-camera-center-y":V.y,"data-camera-zoom":Y,"data-background-pattern":m,onPointerEnter:()=>{D.current=!0},onPointerLeave:()=>{D.current=!1},onPointerDownCapture:function(e){var t;if((t=e.target)instanceof Element&&t.closest("[data-infinite-canvas-ui]")||!(2===e.button||0===e.button&&z.current))return;let i=H.current;et(),B.current={pointerId:e.pointerId,sourceCameraCenter:i?.center??V,startClient:{x:e.clientX,y:e.clientY},contextTarget:e.target,rightButton:2===e.button,moved:!1},q.current=!0,E(!0),e.preventDefault(),e.stopPropagation();try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}},onPointerMoveCapture:function(e){let i=B.current;!i||i.pointerId!==e.pointerId||(Math.hypot(e.clientX-i.startClient.x,e.clientY-i.startClient.y)>3&&(i.moved=!0),e.preventDefault(),e.stopPropagation(),q.current=!0,t&&i.rightButton&&!i.moved||ei({x:i.sourceCameraCenter.x-(e.clientX-i.startClient.x)/Y,y:i.sourceCameraCenter.y-(e.clientY-i.startClient.y)/Y}))},onPointerUpCapture:eo,onPointerCancelCapture:eo,onLostPointerCapture:()=>{B.current=null,E(!1)},onClickCapture:e=>{q.current&&(e.preventDefault(),e.stopPropagation(),q.current=!1)},onContextMenu:e=>e.preventDefault(),children:[(0,n.jsx)(eB,{pattern:m,patternId:I,screenOrigin:Z,zoom:Y}),(0,n.jsx)("div",{className:"human2ai-infinite-canvas-viewport__world-content",children:e({cameraCenter:V,zoom:Y,viewportSize:C,viewportBounds:X,screenToWorld:function(e){return{x:X.x+e.x/Y,y:X.y+e.y/Y}},worldToScreen:er})}),p?(0,n.jsx)("div",{className:`human2ai-infinite-canvas-viewport__side-actions human2ai-infinite-canvas-viewport__side-actions--${g}`,"data-infinite-canvas-ui":"true","data-side-action-placement":g,children:(0,n.jsx)(eF,{width:f,defaultCollapsed:y,"aria-label":G.sideActions,collapseLabel:G.collapseSideActions,expandLabel:G.expandSideActions,children:p})}):null,h?(0,n.jsxs)("div",{className:"human2ai-infinite-canvas-viewport__controls","data-infinite-canvas-ui":"true",role:"group","aria-label":G.currentZoom,children:[(0,n.jsx)(ed.J,{mode:"icon-only",size:"small",backgroundColor:"none",icon:(0,n.jsx)(eA.A,{"aria-hidden":"true"}),iconLabel:G.zoomOut,title:G.zoomOut,disabled:Y<=W,onClick:()=>en(Y/1.2)}),(0,n.jsxs)("output",{className:"human2ai-infinite-canvas-viewport__zoom","aria-label":`${G.currentZoom} ${Math.round(100*Y)}%`,"aria-live":"polite",children:[Math.round(100*Y),"%"]}),(0,n.jsx)(ed.J,{mode:"icon-only",size:"small",backgroundColor:"none",icon:(0,n.jsx)(eM.A,{"aria-hidden":"true"}),iconLabel:G.zoomIn,title:G.zoomIn,disabled:Y>=J,onClick:()=>en(1.2*Y)}),(0,n.jsx)(ed.J,{mode:"icon-only",size:"small",backgroundColor:"none",icon:(0,n.jsx)(eN.A,{"aria-hidden":"true"}),iconLabel:G.fitAll,title:G.fitAll,disabled:!u,onClick:()=>{u&&ea(u)}}),(0,n.jsx)(_.A,{title:G.interactionHelp,placement:"topRight",children:(0,n.jsx)(ed.J,{mode:"icon-only",size:"small",backgroundColor:"none",icon:(0,n.jsx)(eI.A,{"aria-hidden":"true"}),iconLabel:G.help})})]}):null]})}function eB({pattern:e,patternId:t,screenOrigin:i,zoom:a}){if("none"===e)return null;let r=32*a,o="dots"===e,s=o?i.x-r/2:i.x,l=o?i.y-r/2:i.y;return(0,n.jsxs)("svg",{className:"human2ai-infinite-canvas-viewport__background","data-canvas-background":e,"aria-hidden":"true",children:[(0,n.jsx)("defs",{children:(0,n.jsx)("pattern",{id:t,x:s,y:l,width:r,height:r,patternUnits:"userSpaceOnUse",children:o?(0,n.jsx)("circle",{className:"human2ai-infinite-canvas-viewport__background-dot",cx:r/2,cy:r/2,r:"1.5"}):(0,n.jsx)("path",{className:"human2ai-infinite-canvas-viewport__background-line",d:`M 0 0 H ${r} M 0 0 V ${r}`,strokeDasharray:"dashed-grid"===e?"4 4":void 0})})}),(0,n.jsx)("rect",{width:"100%",height:"100%",fill:`url(#${t})`})]})}function eq(e,t,i){return Math.min(i,Math.max(t,e))}function eO({draft:e,selectedIds:t=[],onSelect:i,locked:r=!1,onDraftChange:o,screenScale:s,labels:l}){let d=(0,a.useId)(),c=(0,R.i)(e.frame),u=(0,a.useRef)(null),m=(0,a.useRef)(null),h=!!(i&&o&&!r),p=e=>{let t=e.currentTarget.ownerSVGElement.getScreenCTM(),i=new DOMPoint(e.clientX,e.clientY).matrixTransform(t.inverse());return{x:i.x,y:i.y}};function g(t,i,n){return(0,R.gH)(t,e.frame,i,n)}function f(e,n){let a=n?t.includes(e)?t.filter(t=>t!==e):[...t,e]:t.includes(e)?[...t]:[e];return i?.(a),a}function y(e,t){if("click"===t.type&&m.current===e){m.current=null;return}"key"in t&&"Enter"!==t.key&&" "!==t.key||f(e,t.shiftKey||t.ctrlKey||t.metaKey)}function x(n){o?.((0,R.q3)(e,n)),i?.(t.filter(e=>e!==n))}function b(t,i,n){if(!h||0!==t.button)return;t.preventDefault(),t.stopPropagation(),t.currentTarget.focus(),m.current=i.id;let a=void 0===n?f(i.id,t.shiftKey||t.ctrlKey||t.metaKey):[i.id];a.includes(i.id)&&(1!==a.length||"symmetry"!==i.type||1===n)&&(u.current={pointerId:t.pointerId,plan:i,draft:e,ids:a,start:p(t),handle:n,moved:!1},t.currentTarget.setPointerCapture(t.pointerId))}function v(e){let t=u.current;h&&t&&t.pointerId===e.pointerId&&(u.current=null,e.stopPropagation(),"pointerup"!==e.type||t.moved||0!==t.handle||"golden-spiral"!==t.plan.type||o?.((0,R.sJ)(t.draft,{...t.plan,mirrored:!t.plan.mirrored})),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))}let w={onPointerMove:function(e){let t=u.current;if(!h||!t||t.pointerId!==e.pointerId)return;e.preventDefault(),e.stopPropagation();let i=p(e),n={x:i.x-t.start.x,y:i.y-t.start.y};!t.moved&&"golden-spiral"===t.plan.type&&0===t.handle&&Math.hypot(n.x,n.y)*s<4||(t.moved=!0,o?.(void 0===t.handle?(0,R.u7)(t.draft,t.ids,n):(0,R.sJ)(t.draft,g(t.plan,n,t.handle))))},onPointerUp:v,onPointerCancel:v,onLostPointerCapture:()=>{u.current=null}};return(0,n.jsxs)("g",{className:"human2ai-composition-plans",children:[(0,n.jsx)("defs",{children:(0,n.jsx)("clipPath",{id:d,children:(0,n.jsx)("rect",{x:c.x,y:c.y,width:c.width,height:c.height})})}),(e.plans??[]).filter(e=>e.visible).map(i=>{let{paths:a,handles:c,snapPoints:u}=(0,R.SZ)(i,e.frame),m=!r&&t.includes(i.id),p=h&&"thirds"!==i.type&&"golden-section"!==i.type;return(0,n.jsxs)("g",{children:[(0,n.jsx)(q,{id:i.id,label:l.types[i.type],selected:m,locked:!p,className:"human2ai-composition-plan","data-composition-plan":i.id,"data-plan-type":i.type,onSelect:p?y:void 0,onNudge:p?n=>o?.((0,R.u7)(e,m?t:[i.id],n)):void 0,onDelete:p?()=>x(i.id):void 0,onPointerDown:p?e=>b(e,i):void 0,...w,children:(0,n.jsx)("g",{clipPath:`url(#${d})`,children:a.map((e,t)=>(0,n.jsxs)("g",{children:[(0,n.jsx)("polyline",{className:"human2ai-composition-plan__line",points:e.map(e=>`${e.x},${e.y}`).join(" ")}),p?(0,n.jsx)("polyline",{className:"human2ai-composition-plan__hit",points:e.map(e=>`${e.x},${e.y}`).join(" ")}):null]},t))})}),m&&1===t.length&&p&&u?(0,n.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:u.map((e,t)=>(0,n.jsx)("circle",{className:"human2ai-composition-plan__snap",cx:e.x,cy:e.y,r:3/s},t))}):null,m&&1===t.length&&p?c.map((t,a)=>"symmetry"===i.type&&0===a?(0,n.jsx)("circle",{className:"human2ai-composition-plan__fixed",cx:t.x,cy:t.y,r:5/s,"aria-hidden":"true",pointerEvents:"none"},a):(0,n.jsxs)("g",{"data-plan-handle":a,transform:`translate(${t.x} ${t.y})`,tabIndex:0,role:"button","data-plan-action":"golden-spiral"===i.type&&0===a?"toggle-winding":void 0,"aria-label":"golden-spiral"===i.type&&0===a?l.spiralDirection:"radial"===i.type&&"free"===i.mode&&a>0?l.rayHandle.replace("{{index}}",String(a)):l.handle.replace("{{index}}",String(a+1)),"aria-pressed":"golden-spiral"===i.type&&0===a?i.mirrored:void 0,onPointerDown:e=>b(e,i,a),...w,onClick:e=>{e.stopPropagation(),e.currentTarget.focus()},onKeyDown:t=>{if("golden-spiral"===i.type&&0===a&&("Enter"===t.key||" "===t.key)){t.preventDefault(),t.stopPropagation(),t.repeat||o?.((0,R.sJ)(e,{...i,mirrored:!i.mirrored}));return}if("Delete"===t.key||"Backspace"===t.key){t.preventDefault(),t.stopPropagation(),x(i.id);return}let n=t.shiftKey?10:1,r={ArrowLeft:{x:-n,y:0},ArrowRight:{x:n,y:0},ArrowUp:{x:0,y:-n},ArrowDown:{x:0,y:n}};if(!r[t.key])return;t.preventDefault(),t.stopPropagation();let s=g(i,r[t.key],a);if("symmetry"===i.type){let n=(0,R.Y8)(e.frame),a=n.findIndex(e=>1e-8>Math.abs(e-i.rotation)),r="ArrowRight"===t.key||"ArrowDown"===t.key?1:-1;s={...i,rotation:n[(a+r+n.length)%n.length]}}o?.((0,R.sJ)(e,s))},children:["golden-spiral"===i.type&&0===a?(0,n.jsx)("title",{children:l.spiralDirection}):null,(0,n.jsx)("circle",{className:"human2ai-composition-plan__handle",r:5/s}),(0,n.jsx)("circle",{className:"human2ai-composition-plan__handle-hit",r:12/s})]},a)):null]},i.id)})]})}i(98852),i(98151);let eU=(0,p._)(I),eH={circle:"圆形",triangle:"三角形",quadrilateral:"矩形"},eG={cornerLabel:"文字轮廓角点 {{index}}",lightSource:"作为光源",displayText:"显示文字",displayTextPlaceholder:"填写要显示的文字;留空由生图模型决定",visualWeight:"视觉权重",weightAuto:"自动",weightHigh:"高",weightMedium:"中",weightLow:"低",weightDecorative:"装饰"},eW={content:"图片内容",sourceDimensions:(e,t)=>`${e} \xd7 ${t} px`,sourceFileSize:(e,t)=>`${e} ${t}`,upload:"上传图片",download:"下载图片",downloading:"正在下载",downloadFailed:"图片下载失败,请重试。",replace:"替换图片",uploading:"正在上传",uploadFailed:"上传失败,请重试",fileTypes:"支持 PNG、JPEG、WebP、SVG,最大 10 MB",cropTitle:"裁剪图片",cropLoadFailed:"图片加载失败",svgSource:"SVG 源码",svgPaste:"粘贴 SVG",svgApply:"使用 SVG",svgSaveFailed:"SVG 保存失败,请检查代码后重试。",svgCopy:"复制源码",svgCopying:"正在复制源码",svgCopyFailed:"源码复制失败",sourceLoading:"正在读取图片内容",sourceLoadFailed:"图片内容读取失败,请重试。",svgCopied:"已复制",cancel:"取消",retry:"重试"},eJ="composition-frame";function eV({selectedPlanIds:e,planningLocked:t=!1,onPlanSelectionChange:i,planningLabels:s=ej.composition.planning,interactionResetKey:d,draft:c,appearance:p="editor",showPlanning:x=!0,showHiddenNodes:b=!1,onionSkin:v=!1,visibilityLabels:w=ej.canvas.nodeVisibility,frameLocked:j=!1,frameLabels:k={name:ej.composition.frameLabel,action:ej.composition.frameAction},zoom:S,viewportAction:I,backgroundPattern:P,showViewportControls:T,sideActions:F,sideActionPlacement:E,sideActionPanelWidth:D,sideActionPanelDefaultCollapsed:_,viewportLabels:z,layerLabels:B,nodeEditorLabels:O,directionControlLabels:U=["动势线操作点 1","动势线操作点 2"],areaEditorLabels:H,imageEditorLabels:G,resolveImageSource:W,renderCameraReference:Y,onImageUpload:Z,onReadImageFile:ee,selectedIds:et=[],onDraftChange:ei,placementTool:ea=null,onPlacementToolChange:er,onSelectionChange:eo,onItemDoubleClick:es,onZoomChange:el,className:ed,style:ec,"aria-label":em="构图画布"}){let eh=["human2ai-composition-canvas",`human2ai-composition-canvas--${p}`,j?"human2ai-composition-canvas--frame-locked":null,ed].filter(Boolean).join(" "),ep=ei?e=>{tT.current.draft=e,ei(e)}:void 0,eg=(0,a.useRef)(null),ef=(0,a.useMemo)(()=>b&&"reference"!==p?c:(0,R.yg)(c),[p,c,b]),ev=(0,a.useMemo)(()=>{let e=(0,R.fQ)(c);return e[e.findIndex(t=>t.id===(c.activeStateId??e[0].id))-1]?.id},[c]),ew=(0,a.useMemo)(()=>v&&ev?(0,R.iY)((0,R.KZ)(c,ev),W).join(""):null,[c,v,ev,W]),{contextMenuOpen:ek,contextMenuPoint:eI,contextMenuPopupRef:eC,openContextMenuAt:eP,closeContextMenu:eA,dismissContextMenu:eM}=A(),eN={...L,...B},[eR,e$]=(0,a.useState)(null),eT=(0,a.useRef)(null),eF=(0,a.useRef)(null),eE=(0,a.useRef)(null),eD=(0,a.useRef)(!1),e_=(0,a.useRef)(!1),eB=(0,a.useRef)(null),eq=(0,a.useRef)(tQ);(0,a.useLayoutEffect)(()=>{eq.current=tQ});let tn=(0,a.useRef)(""),tr=(0,a.useRef)(0),[to,ts]=(0,a.useState)(!1),[tl,td]=(0,a.useState)(!1),[tc,tu]=(0,a.useState)(!1),[tm,th]=(0,a.useState)(160),[tp,tg]=(0,a.useState)(null),[tf,ty]=(0,a.useState)(null),tx=(0,R.i)(c.frame),tb="reference"===p?{...ec,"--human2ai-composition-reference-aspect":tx.width/tx.height}:ec,tv=(0,R.MR)(ef),tw="reference"!==p&&!!ep&&!j,tj="reference"!==p&&et.includes(eJ),tk="reference"===p||tj?[]:[...new Set(et)].filter(e=>!!e9(ef,e)),tS=new Set(tk),tI=tk.length>1?function(e,t){let i=t.map(t=>e8(e,t)).filter(e=>!!e);if(0===i.length)return null;let n=Math.min(...i.map(e=>e.x)),a=Math.min(...i.map(e=>e.y));return{x:n,y:a,width:Math.max(1,Math.max(...i.map(e=>e.x+e.width))-n),height:Math.max(1,Math.max(...i.map(e=>e.y+e.height))-a)}}(c,tk):null,tC=tk.some(e=>c.images.some(t=>t.id===e)),tP=I?{id:I.id,bounds:"fit-frame"===I.type?tx:tv,padding:48}:void 0,tL=tf?e9(ef,tf.id):null;(0,a.useLayoutEffect)(()=>{tf&&!tL&&ty(null),tj||tk.length===et.length||eo?.(tk)},[tL,tf,tj,et,tk,eo]);let tA=tf?c.areas.find(({id:e})=>e===tf.id)??null:null,tM=tf?c.images.find(({id:e})=>e===tf.id)??null:null,tN={...eG,...H},tR=(0,a.useId)().replace(/:/g,""),t$={...eW,...G},tT=(0,a.useRef)({draft:c,onDraftChange:ep,interactionResetKey:d});(0,a.useLayoutEffect)(()=>{tT.current={draft:c,onDraftChange:ep,interactionResetKey:d}},[c,ei,d]),(0,a.useLayoutEffect)(()=>()=>{null!==eF.current&&cancelAnimationFrame(eF.current),eF.current=null,eE.current=null,eT.current?.type==="move-text-corner"&&(eT.current=null)},[d,c.activeStateId]);let tF=en({disabled:"reference"===p||!ep||!!tf,resetKey:`${d}:${c.activeStateId}`,labels:t$,onUpload:Z,onReadImageFile:ee,resolveImageSource:W,onCopy:function(e){if(0===tk.length||!e.clipboardData)return;let t=(0,R.s6)(c,tk);0!==t.length&&(tn.current=X(e.clipboardData,"application/x-human2ai-composition",t,t.flatMap(e=>"image"===e.kind?[e.item]:[]),W),tr.current=0,e.preventDefault(),e.stopPropagation())},onPasteFallback:function(e){if(e.defaultPrevented||!ep||!e.clipboardData)return;let t=Q(e.clipboardData,"application/x-human2ai-composition",R.mU);t&&(e.preventDefault(),e.stopPropagation(),tF.pasteNodes(t.items.flatMap(e=>"image"===e.kind?[e.item]:[]),t.sources,()=>eq.current(t)))},onImageReady:({assetId:e,x:t,y:i,width:n,height:a})=>{let r=(0,R.xB)(c,{x:t/R.cq.width,y:i/R.cq.height,width:n/R.cq.width,height:a/R.cq.height});ep?.((0,R.QY)(r.draft,r.id,{assetId:e})),eo?.([r.id]),er?.(null)}}),tE=[{value:"auto",label:tN.weightAuto},{value:"high",label:tN.weightHigh},{value:"medium",label:tN.weightMedium},{value:"low",label:tN.weightLow},{value:"decorative",label:tN.weightDecorative}],tD="reference"!==p&&!!ep&&("focus"!==ea||c.focusPoints.length<3)&&("direction"!==ea||!c.directionLine);function t_(e,t=""){return{annotation:e.annotation,displayText:t,note:e.note,labels:{nodeDescription:O?.nodeDescription??"节点说明",displayText:tN.displayText,note:O?.note??"备注"}}}function tz(e){let t;if(!ea||!ep||!tD)return;let{bounds:i,start:n,end:a,dragged:r}=e,o={x:(i.x+i.width/2)/R.cq.width,y:(i.y+i.height*("triangle"===ea?2/3:.5))/R.cq.height};"focus"===ea?t=(0,R.eq)(c,{x:n.x/R.cq.width,y:n.y/R.cq.height}):"direction"===ea?(t=(0,R.JZ)(c),th(r?Math.hypot(a.x-n.x,a.y-n.y):160),t.draft=(0,R.hG)((0,R.Pe)(t.draft,t.id,r?o:{x:n.x/R.cq.width,y:n.y/R.cq.height}),t.id,180*Math.atan2(a.y-n.y,a.x-n.x)/Math.PI)):"image"===ea?t=(0,R.xB)(c,{...o,width:i.width/R.cq.width,height:i.height/R.cq.height}):(t="text"===ea?(0,R.hN)(c,o):(0,R.Xn)(c,{...o,primitive:ea,aspect:"quadrilateral"===ea?"free":"square"}),r&&(t.draft=(0,R.IU)(t.draft,t.id,i.width/R.cq.width,i.height/R.cq.height))),ep(t.draft),eo?.([t.id]),er?.(null),eD.current=!0,window.setTimeout(()=>{eD.current=!1},0)}function tB(e){if(!ep||!e9(tT.current.draft,e))return;let t=tk.length>1&&tS.has(e)?tk:[e];ep(e3(tT.current.draft,t)),eo?.([]),tf&&t.includes(tf.id)&&tq()}function tq(){ty(null)}function tO(e){if(!(e.target instanceof Element)||(eD.current=!1,e_.current=!1,0!==e.button))return;let t=tt(e,e.currentTarget),i=e.target.closest("[data-handle]");if(i){if(!ep)return;let n=i.dataset.itemId,a=i.dataset.handle;if(!n||!a)return;let r=c.directionLine?.id===n?c.directionLine:null;if("move-text-corner"===a&&e.ctrlKey){let r=c.areas.find(e=>e.id===n);if(!r||!(0,R.MY)(r))return;let o=(0,R.QR)(r,R.cq),s=Number(i.dataset.cornerIndex);if("polygon"!==o.type||!o.points[s])return;eT.current={type:a,pointerId:e.pointerId,sourceArea:r,id:n,cornerIndex:s,start:t,startClient:{x:e.clientX,y:e.clientY},movingPoint:o.points[s],moved:!1},i.focus()}else{if(!r||"move-direction-point"!==a)return;let n=Number(i.dataset.pointIndex),o=e0(r,tm);eT.current={type:a,pointerId:e.pointerId,sourceDraft:c,pointIndex:n,fixedPoint:o[1-n],movingPoint:o[n],start:t},i.focus()}}else{let i=e.target.closest("[data-composition-item]"),n=i?.dataset.compositionItem,a=n?e9(c,n):null;if(n&&a){if(!ep)return;let i=tS.has(n)?tk:[n];eT.current={type:"move-items",pointerId:e.pointerId,ids:i,sourceDraft:c,start:t,startClient:{x:e.clientX,y:e.clientY},moved:!1}}else{if(!eo)return;eT.current={type:"marquee",pointerId:e.pointerId,sourceSelectedIds:tk,start:t,startClient:{x:e.clientX,y:e.clientY},moved:!1,additive:e.shiftKey}}}let n=eT.current;n&&("move-direction-point"===n.type||"move-text-corner"===n.type)&&(eD.current=!0,e.preventDefault(),ti(e.currentTarget,e.pointerId))}function tU(e){let t=eT.current;if(!t||t.pointerId!==e.pointerId)return;let i=tt(e,e.currentTarget);if("move-items"===t.type){if(!t.moved&&3>Math.hypot(e.clientX-t.startClient.x,e.clientY-t.startClient.y)||(t.moved||(t.moved=!0,ts(!0),ti(e.currentTarget,e.pointerId)),eD.current=!0,e_.current=!0,e.preventDefault(),!ep))return;ep(e2(t.sourceDraft,t.ids,{x:(i.x-t.start.x)/R.cq.width,y:(i.y-t.start.y)/R.cq.height}));return}if("marquee"===t.type){if(!t.moved&&3>Math.hypot(e.clientX-t.startClient.x,e.clientY-t.startClient.y))return;t.moved||(t.moved=!0,ti(e.currentTarget,e.pointerId)),e.preventDefault(),eD.current=!0,tg(e5(t.start,i));return}if(e.preventDefault(),eD.current=!0,ep){if("move-text-corner"===t.type){if(!t.moved&&3>Math.hypot(e.clientX-t.startClient.x,e.clientY-t.startClient.y))return;t.moved=!0;let n={x:(t.movingPoint.x+i.x-t.start.x)/R.cq.width,y:(t.movingPoint.y+i.y-t.start.y)/R.cq.height};(0,R.vm)(t.sourceArea,t.cornerIndex,n)!==t.sourceArea&&(eE.current={interaction:t,point:n},null===eF.current&&(eF.current=requestAnimationFrame(tH)));return}tG(t.sourceDraft,t.pointIndex,{x:t.movingPoint.x+i.x-t.start.x,y:t.movingPoint.y+i.y-t.start.y},t.fixedPoint)}}function tH(){null!==eF.current&&cancelAnimationFrame(eF.current),eF.current=null;let e=eE.current;if(eE.current=null,!e||e.interaction!==eT.current)return;let{draft:t,onDraftChange:i}=tT.current;if(!i||!t.areas.some(t=>t.id===e.interaction.id))return;let n=(0,R.Wn)(t,e.interaction.id,e.interaction.cornerIndex,e.point);n!==t&&i(n)}function tG(e,t,i,n){let a=e.directionLine;if(!a||!ep)return;let[r,o]=0===t?[i,n]:[n,i],s=o.x-r.x,l=o.y-r.y,d=Math.hypot(s,l);th(d),ep((0,R.hG)((0,R.Pe)(e,a.id,{x:(r.x+o.x)/2/R.cq.width,y:(r.y+o.y)/2/R.cq.height}),a.id,d<.001?a.rotation:180*Math.atan2(l,s)/Math.PI))}function tW(e,t){if(!c.directionLine)return;let i=e0(c.directionLine,tm);tG(c,e,{x:i[e].x+t.x,y:i[e].y+t.y},i[1-e])}function tJ(e){let t=eT.current;if(t&&t.pointerId===e.pointerId){if("move-text-corner"===t.type&&(tU(e),tH()),"marquee"===t.type){let i=t.moved?function(e,t){var i,n;let a,r,o,s;if(t.width<2&&t.height<2)return[];let l=e.areas.filter(e=>e6(e4(e),t)).map(e=>e.id),d=e.images.filter(e=>e6(e7(e),t)).map(e=>e.id),c=e.focusPoints.filter(i=>{let n=e8(e,i.id);return!!n&&e6(n,t)}).map(e=>e.id);return[...d,...l,...e.directionLine&&(i=e.directionLine,n=t,a=te(i),o={x:-Math.sin(r=i.rotation*Math.PI/180),y:Math.cos(r)},0>=Math.min(...s=[{x:n.x,y:n.y},{x:n.x+n.width,y:n.y},{x:n.x,y:n.y+n.height},{x:n.x+n.width,y:n.y+n.height}].map(e=>(e.x-a.x)*o.x+(e.y-a.y)*o.y))&&Math.max(...s)>=0)?[e.directionLine.id]:[],...c]}(ef,e5(t.start,tt(e,e.currentTarget))):[];eo?.(0===i.length?[]:t.additive?e1(t.sourceSelectedIds,i):i),tg(null)}eT.current=null,ts(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),window.setTimeout(()=>{eD.current=!1,e_.current=!1},0)}}function tV(e){eT.current?.pointerId===e.pointerId&&(tH(),eT.current=null,ts(!1),tg(null),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))}function tY(e){var t,i,n,a,r,o,s,l;if(!ep||tk.length<2)return;let d={x:e.sourcePosition.x+e.sourceBounds.x,y:e.sourcePosition.y+e.sourceBounds.y,width:e.sourceBounds.width,height:e.sourceBounds.height},u=JSON.stringify([tk,(t=d).x,t.y,t.width,t.height]);eB.current?.signature!==u&&(eB.current={signature:u,draft:c,ids:[...tk],bounds:d});let m=eB.current,h={x:e.sourcePosition.x+e.bounds.x,y:e.sourcePosition.y+e.bounds.y,width:e.bounds.width,height:e.bounds.height};ep((i=m.draft,n=m.ids,a=m.bounds,r=h,o=e.scaleX,s=e.scaleY,l=e.proportional,n.reduce((e,t)=>{let n=e9(i,t);if(!n)return e;let d=te(n),c={x:r.x+(d.x-a.x)*o,y:r.y+(d.y-a.y)*s},u=(0,R.Pe)(e,t,{x:c.x/R.cq.width,y:c.y/R.cq.height}),m=i.areas.find(e=>e.id===t);if(m){let e=(0,R.QR)(m,R.cq),i=eX(m,e);u=l?(0,R.oF)(u,t,m.area*o*s):(0,R.IU)(u,t,i.width*o/R.cq.width,i.height*s/R.cq.height)}let h=i.images.find(e=>e.id===t);h&&(u=(0,R.CV)(u,t,h.width*o,h.height*s));let p=i.directionLine?.id===t?i.directionLine:null;if(p&&o!==s){let e=p.rotation*Math.PI/180;u=(0,R.hG)(u,t,180*Math.atan2(Math.sin(e)*s,Math.cos(e)*o)/Math.PI)}return u},i)))}function tK(e){if("reference"===p||!(e.target instanceof Element))return;let t=e.target.closest("[data-composition-item]"),i=t?.dataset.compositionItem;i&&!tS.has(i)?eo?.([i]):e.target.closest("[data-canvas-frame]")&&eo?.([eJ]),eP(e,t??eg.current?.querySelector("[data-composition-scene]")??null)}function tX(e){if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault(),e.stopPropagation();let t=e.target instanceof Element?e.target:e.currentTarget,i=t.getBoundingClientRect();tK({clientX:i.x+i.width/2,clientY:i.y+i.height/2,target:t});return}}function tQ(e){if(!ep)return;let t=(e.token===tn.current?tr.current:0)+1,i=(0,R.CP)(tT.current.draft,e.items,{x:24*t/R.cq.width,y:24*t/R.cq.height});0!==i.ids.length&&(tn.current=e.token,tr.current=t,tq(),ep(i.draft),eo?.(i.ids))}(0,a.useLayoutEffect)(()=>{void 0!==d&&(eT.current=null,ts(!1),eB.current=null,tg(null),ty(null),tu(!1),eM())},[d]),(0,a.useLayoutEffect)(()=>{let e=e=>td(e.ctrlKey),t=()=>{tH(),td(!1),tu(!1),eT.current?.type==="move-text-corner"&&(eT.current=null)};return window.addEventListener("keydown",e),window.addEventListener("keyup",e),window.addEventListener("blur",t),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",e),window.removeEventListener("blur",t)}},[]),(0,a.useLayoutEffect)(()=>{ea&&tq(),ea&&!tD&&er?.(null)},[ea,tD]);let tZ=(0,a.useRef)(l()).current(c.areas.filter(e=>!1!==e.visible&&!e.isLightSource&&!(0,R.MY)(e)).map(h)),t0=o({selectItem:function(e,t){if(e_.current){e_.current=!1;return}eo?.(t.shiftKey?e1(tk,[e]):[e])},nudgeItem:function(e,t){if(!ep)return;let i=tk.length>1&&tS.has(e)?tk:[e];ep(e2(tT.current.draft,i,t))},resizeAreaNode:function(e,t){var i,n;if(!ep)return;let a=tT.current.draft.areas.find(t=>t.id===e);if(!a)return;let r=ta((i=a,n=t.bounds,"triangle"===i.primitive?{x:n.x+n.width/2,y:n.y+2*n.height/3}:{x:n.x+n.width/2,y:n.y+n.height/2}),t.sourceRotation),o=(0,R.IU)(tT.current.draft,e,t.bounds.width/R.cq.width,t.bounds.height/R.cq.height);ep((0,R.Pe)(o,e,{x:(t.sourcePosition.x+r.x)/R.cq.width,y:(t.sourcePosition.y+r.y)/R.cq.height}))},resizeImageNode:function(e,t){if(!ep||!tT.current.draft.images.some(t=>t.id===e))return;let i=ta({x:t.bounds.x+t.bounds.width/2,y:t.bounds.y+t.bounds.height/2},t.sourceRotation),n=(0,R.CV)(tT.current.draft,e,t.bounds.width/R.cq.width,t.bounds.height/R.cq.height);ep((0,R.Pe)(n,e,{x:(t.sourcePosition.x+i.x)/R.cq.width,y:(t.sourcePosition.y+i.y)/R.cq.height}))},openItemEditor:function(e,t){ty({id:e,kind:t}),eo?.([e]),es?.(e)},deleteItem:tB,rotateArea:(e,t)=>ep?.((0,R.z_)(tT.current.draft,e,t)),rotateImage:(e,t)=>ep?.((0,R.rz)(tT.current.draft,e,t)),selectFrame:()=>eo?.([eJ]),updateCompositionFrame:function(e){ep?.((0,R.co)(tT.current.draft,e))}}),t1=r([eJ,...c.images.map(({id:e})=>e),...c.areas.map(({id:e})=>e),...c.focusPoints.map(({id:e})=>e),...c.directionLine?[c.directionLine.id]:[]],[p,"reference"===p?c.previewMode:void 0,!!ep,!!es,eR,!!c.layerOrder,O?.imageKind,O?.textKind,O?.lineKind,O?.nodeDescription,O?.note,tN.displayText]),t2=e=>[e.x,e.y,e.note,e.annotation,e.visible,tS.has(e.id),!!(tI&&tS.has(e.id))];function t3(a){let r=a?.viewportBounds??tx,o="reference"===p?tx:r,l=a?.zoom??1,h=tI?{x:tI.x+tI.width/2,y:tI.y+tI.height/2}:null;return(0,n.jsxs)(eb,{ref:tF.sceneRef,"data-composition-scene":!0,bounds:o,className:"human2ai-composition-canvas__svg","data-camera-center-x":a?.cameraCenter.x,"data-camera-center-y":a?.cameraCenter.y,"data-camera-zoom":a?.zoom,"data-frame-crop":"reference"===p?"true":void 0,"data-frame-locked":j?"true":void 0,"data-canvas-dragging":to?"node":void 0,role:"group","aria-label":em,"aria-keyshortcuts":"reference"!==p?"Control+C Meta+C Control+V Meta+V":void 0,tabIndex:"reference"!==p?-1:void 0,onKeyDown:"reference"!==p?tX:void 0,onPointerDownCapture:"reference"!==p?e=>e.currentTarget.focus():void 0,onClickCapture:e=>{eD.current&&(e.stopPropagation(),eD.current=!1)},onClick:"reference"!==p&&eo?e=>{if(eD.current){eD.current=!1;return}e.target instanceof Element&&(e.target.closest("[data-composition-item]")||e.target.closest("[data-handle]")||e.target.closest("[data-resize-handle]")||e.target.closest("[data-rotation-handle]"))||(eo([]),i?.([]),tq())}:void 0,onPointerDown:"reference"!==p?tO:void 0,onPointerMove:"reference"!==p?tU:void 0,onPointerUp:"reference"!==p?tJ:void 0,onPointerCancel:"reference"!==p?tV:void 0,onLostPointerCapture:"reference"!==p?()=>{eT.current=null,ts(!1),tg(null)}:void 0,children:[(0,n.jsx)("rect",{className:"human2ai-composition-canvas__surface",x:"reference"===p?tx.x:r.x,y:"reference"===p?tx.y:r.y,width:"reference"===p?tx.width:r.width,height:"reference"===p?tx.height:r.height}),"reference"!==p?t1(eJ,l,[tx.x,tx.y,tx.width,tx.height,tj,tw,k.name,k.action,d,c.activeStateId],()=>(0,n.jsx)(V,{controlsHost:c.layerOrder?eR:void 0,id:eJ,label:k.action,name:k.name,interactionResetKey:`${c.activeStateId??""}:${d??""}`,bounds:tx,selected:tj,locked:!tw,onBoundsChange:tw?t0.updateCompositionFrame:void 0,screenScale:l,onSelect:tw?t0.selectFrame:void 0,className:"human2ai-composition-canvas__frame"})):null,"reference"!==p&&null!==ew&&ev?(0,n.jsx)(eS,{stateId:ev,children:(0,n.jsx)("g",{dangerouslySetInnerHTML:{__html:ew}})}):null,(0,M.jQ)([...c.images.map(e=>{if(!1===e.visible&&(!b||"reference"===p))return null;let t=e.width*R.cq.width,i=e.height*R.cq.height,a=e.assetId?W?.(e.assetId):void 0,r=O?.imageKind??"图片";return t1(e.id,tS.has(e.id)?l:1,[...t2(e),e.rotation,t,i,a,e.crop?.x,e.crop?.y,e.crop?.width,e.crop?.height],()=>(0,n.jsx)(q,{controlsHost:c.layerOrder?eR:void 0,id:e.id,label:`${r} ${e.id}`,tooltip:t_(e),x:e.x*R.cq.width,y:e.y*R.cq.height,rotation:e.rotation,selected:tS.has(e.id),bounds:"reference"===p||tI&&tS.has(e.id)?void 0:eY(t,i),resizeMode:"proportional",resizeCenter:{x:0,y:0},screenScale:l,onSelect:"reference"!==p?t0.selectItem:void 0,onNudge:"reference"!==p&&ep?t=>t0.nudgeItem(e.id,t):void 0,onResize:"reference"!==p&&ep&&!(tI&&tS.has(e.id))?t=>t0.resizeImageNode(e.id,t):void 0,onRotate:"reference"!==p&&ep&&!(tI&&tS.has(e.id))?t=>t0.rotateImage(e.id,t.rotation):void 0,onDoubleClick:"reference"!==p&&(ep||es)?()=>t0.openItemEditor(e.id,"image"):void 0,onDelete:"reference"!==p&&ep?()=>t0.deleteItem(e.id):void 0,nudgeStep:.01,largeNudgeStep:.05,className:"human2ai-composition-canvas__item human2ai-composition-canvas__image","data-composition-item":e.id,"data-composition-kind":"image","data-composition-visible":!1!==e.visible,children:(0,n.jsx)(K,{src:a,alt:e.note||r,width:t,height:i,fit:"cover",crop:e.crop,status:a?"ready":"empty",emptyLabel:r})},e.id))}),...c.areas.map(e=>!1!==e.visible||b&&"reference"!==p?t1(e.id,tS.has(e.id)?l:1,[...t2(e),...m(e),e.semanticType,e.displayText,e.isLightSource,tZ.has(e.id)],()=>{let t=(0,R.QR)(e,R.cq),i=(0,R.MY)(e),a=!!e.displayText?.trim()&&("reference"!==p||"soft"!==c.previewMode),r="circle"===t.type||"ellipse"===t.type?{x:t.cx,y:t.cy}:t.center,o=eX(e,t),s=e.corners?(0,R.QR)({...e,x:0,y:0,rotation:0},R.cq):null,d=i?O?.textKind??"文字区域":eH[e.primitive];return(0,n.jsx)(q,{controlsHost:c.layerOrder?eR:void 0,id:e.id,label:`选择${d} ${e.id}`,tooltip:t_(e,i?e.displayText:void 0),x:r.x,y:r.y,rotation:e.rotation??0,selected:tS.has(e.id),bounds:"reference"===p||tI&&tS.has(e.id)?void 0:o,resizeCenter:{x:0,y:0},screenScale:l,onSelect:"reference"!==p?t0.selectItem:void 0,onNudge:"reference"!==p&&ep?t=>t0.nudgeItem(e.id,t):void 0,onResize:"reference"!==p&&ep&&!(tI&&tS.has(e.id))?t=>t0.resizeAreaNode(e.id,t):void 0,onRotate:"reference"!==p&&ep&&!(tI&&tS.has(e.id))&&("circle"!==e.primitive||"free"===e.aspect)?t=>t0.rotateArea(e.id,t.rotation):void 0,onDoubleClick:"reference"!==p&&(ep||es)?()=>t0.openItemEditor(e.id,i?"text":"shape"):void 0,onDelete:"reference"!==p&&ep?()=>t0.deleteItem(e.id):void 0,nudgeStep:.01,largeNudgeStep:.05,className:["human2ai-composition-canvas__item","human2ai-composition-canvas__area",`human2ai-composition-canvas__area--tone-${u(e.id)}`,i?"human2ai-composition-canvas__area--text-region":null].filter(Boolean).join(" "),"data-composition-item":e.id,"data-composition-kind":i?"text-region":"area","data-composition-visible":!1!==e.visible,children:e.isLightSource?(0,n.jsx)("g",{dangerouslySetInnerHTML:{__html:(0,R.gf)({...e,x:0,y:0,rotation:0},`${tR}-light-${e.id}`,p)}}):"reference"!==p||"soft"!==c.previewMode||i?"circle"===t.type?(0,n.jsx)(J,{type:"circle",size:2*t.radius,className:"human2ai-composition-canvas__shape",innerStroke:"reference"!==p&&tZ.has(e.id)}):"ellipse"===t.type?(0,n.jsx)(J,{type:"circle",width:2*t.radiusX,height:2*t.radiusY,className:"human2ai-composition-canvas__shape",innerStroke:"reference"!==p&&tZ.has(e.id)}):i?(0,n.jsxs)(n.Fragment,{children:["reference"===p&&a?null:s?.type==="polygon"?(0,n.jsx)("polygon",{className:"human2ai-composition-canvas__shape",points:s.points.map(e=>`${e.x},${e.y}`).join(" "),"data-text-outline":!0}):(0,n.jsx)(J,{type:"rectangle",width:t.width??0,height:t.height,className:"human2ai-composition-canvas__shape"}),a?(0,n.jsx)("g",{pointerEvents:"none",dangerouslySetInnerHTML:{__html:(0,R.OS)({...e,x:0,y:0,rotation:0},`${tR}-text-${e.id}`)}}):s?(0,n.jsx)("g",{className:"human2ai-composition-canvas__text-region-marks","aria-hidden":"true",children:(0,R.Dj)({...e,x:0,y:0,rotation:0},R.cq).map(([e,t],i)=>(0,n.jsx)("line",{x1:e.x,y1:e.y,x2:t.x,y2:t.y},i))}):(0,n.jsx)(eK,{width:t.width??0,height:t.height})]}):(0,n.jsx)(J,{type:"triangle"===e.primitive?"triangle":"rectangle",width:"triangle"===e.primitive?t.side??0:t.width??0,height:t.height,className:"human2ai-composition-canvas__shape",innerStroke:"reference"!==p&&tZ.has(e.id)}):(0,n.jsx)("g",{dangerouslySetInnerHTML:{__html:(0,R.Kj)({...e,x:0,y:0,rotation:0},`${tR}-soft-${e.id}`)}})},e.id)}):null),...c.directionLine&&ef.directionLine?[t1(c.directionLine.id,1,[...t2(c.directionLine),c.directionLine.rotation,o.x,o.y,o.width,o.height],()=>(0,n.jsx)(eQ,{draft:c,label:O?.lineKind??"动势线",selected:tS.has(c.directionLine.id),onSelect:"reference"!==p?t0.selectItem:void 0,onNudge:"reference"!==p&&ep?t0.nudgeItem:void 0,onDoubleClick:"reference"!==p&&(ep||es)?e=>t0.openItemEditor(e,"line"):void 0,onDelete:"reference"!==p&&ep?t0.deleteItem:void 0,bounds:o,tooltip:t_(c.directionLine)},c.directionLine.id))]:[],...c.focusPoints.map(e=>{if(!1===e.visible&&(!b||"reference"===p))return null;let t=e.x*R.cq.width,i=e.y*R.cq.height,a=.018*Math.min(R.cq.width,R.cq.height);return t1(e.id,tS.has(e.id)?l:1,t2(e),()=>(0,n.jsxs)(q,{controlsHost:c.layerOrder?eR:void 0,id:e.id,label:`选择焦点 ${e.id}`,tooltip:t_(e),x:t,y:i,selected:tS.has(e.id),onSelect:"reference"!==p?t0.selectItem:void 0,onNudge:"reference"!==p&&ep?t=>t0.nudgeItem(e.id,t):void 0,onDoubleClick:"reference"!==p&&(ep||es)?()=>t0.openItemEditor(e.id,"point"):void 0,onDelete:"reference"!==p&&ep?()=>t0.deleteItem(e.id):void 0,nudgeStep:.01,largeNudgeStep:.05,className:"human2ai-composition-canvas__item human2ai-composition-canvas__focus","data-composition-item":e.id,"data-composition-visible":!1!==e.visible,children:[(0,n.jsx)("circle",{className:"human2ai-composition-canvas__focus-ring",cx:0,cy:0,r:a}),(0,n.jsx)("line",{x1:-(1.5*a),y1:0,x2:1.5*a,y2:0}),(0,n.jsx)("line",{x1:0,y1:-(1.5*a),x2:0,y2:1.5*a}),(0,n.jsx)(ey,{className:"human2ai-composition-canvas__focus-dot",radius:4})]},e.id))})].filter(e=>null!==e),c.layerOrder,e=>String(e.key)),"reference"!==p&&ep&&1===tk.length&&c.directionLine?.id===tk[0]?(0,n.jsx)(eZ,{directionLine:c.directionLine,distance:tm,screenScale:l,labels:U,onNudge:tW}):null,"reference"!==p&&x?(0,n.jsx)(eO,{draft:c,selectedIds:e,locked:t,onSelect:i,onDraftChange:ea?void 0:ep,screenScale:l,labels:s},`${c.activeStateId??"default"}:${d??0}:${t}`):null,"reference"!==p&&tI&&h&&ep?(0,n.jsx)(q,{controlsHost:c.layerOrder?eR:void 0,id:"composition-multi-selection",label:`缩放 ${tk.length} 个所选元素`,x:h.x,y:h.y,selected:!0,bounds:eY(tI.width,tI.height),resizeMode:tC?"proportional":"free",resizeCenter:{x:0,y:0},screenScale:l,minimumWidth:16,minimumHeight:16,showRotationHandle:!1,tabIndex:-1,nudgeStep:.01,largeNudgeStep:.05,onNudge:e=>{ep(e2(c,tk,e))},onResize:tY,onDelete:()=>{ep(e3(c,tk)),eo?.([])},className:"human2ai-composition-canvas__multi-selection",children:(0,n.jsx)("rect",{className:"human2ai-composition-canvas__multi-selection-surface",x:-tI.width/2,y:-tI.height/2,width:tI.width,height:tI.height,"aria-hidden":"true"})}):null,tp?(0,n.jsx)("rect",{className:"human2ai-composition-canvas__marquee",x:tp.x,y:tp.y,width:tp.width,height:tp.height,"aria-hidden":"true"}):null,"reference"===p?(0,n.jsx)("rect",{"data-composition-reference-frame":"true",x:tx.x,y:tx.y,width:tx.width,height:tx.height,fill:"none",stroke:"var(--yisiui-color-border-interactive)",strokeWidth:4,vectorEffect:"non-scaling-stroke",pointerEvents:"none","aria-hidden":"true"}):null,c.layerOrder&&"reference"!==p?(0,n.jsx)("rect",{"data-canvas-layer-frame":!0,className:"human2ai-canvas-shape human2ai-canvas-frame__border",x:tx.x,y:tx.y,width:tx.width,height:tx.height,"aria-hidden":"true"}):null,(0,n.jsx)("g",{ref:e$,"data-canvas-controls-layer":!0}),"reference"!==p&&ep&&1===tk.length&&(tl||tc)?c.areas.filter(e=>e.id===tk[0]&&(0,R.MY)(e)).map(e=>{let t=(0,R.QR)(e,R.cq);return"polygon"!==t.type?null:(0,n.jsx)("g",{className:"human2ai-composition-canvas__handles",onFocus:()=>tu(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||tu(!1)},children:t.points.map((t,i)=>(0,n.jsxs)("g",{"data-item-id":e.id,"data-handle":"move-text-corner","data-corner-index":i,className:"human2ai-composition-canvas__text-corner",transform:`translate(${t.x} ${t.y})`,role:"button",tabIndex:0,"aria-label":tN.cornerLabel.replace("{{index}}",String(i+1)),"aria-keyshortcuts":"ArrowLeft ArrowRight ArrowUp ArrowDown",onContextMenu:e=>{e.preventDefault(),e.stopPropagation()},onKeyDown:n=>{let a=(n.shiftKey?10:1)/l,r={ArrowLeft:{x:-a,y:0},ArrowRight:{x:a,y:0},ArrowUp:{x:0,y:-a},ArrowDown:{x:0,y:a}}[n.key];r&&(n.preventDefault(),n.stopPropagation(),ep((0,R.Wn)(c,e.id,i,{x:(t.x+r.x)/R.cq.width,y:(t.y+r.y)/R.cq.height})))},children:[(0,n.jsx)("circle",{className:"human2ai-composition-canvas__transform-handle",r:7/l}),(0,n.jsx)("circle",{className:"human2ai-composition-canvas__transform-hit",r:12/l})]},i))},e.id)}):null,ea&&tD?(0,n.jsx)(ex,{tool:function(e){if("focus"===e)return{shape:"point",width:16,height:16,clickOnly:!0};if("direction"===e)return{shape:"line",width:160,height:8};if("image"===e)return{shape:"rectangle",width:320,height:180};let t=("text"===e?(0,R.hN)((0,R.mq)()):(0,R.Xn)((0,R.mq)(),{primitive:e,aspect:"quadrilateral"===e?"free":"square"})).draft.areas[0],i=eX(t,(0,R.QR)(t,R.cq));return{shape:"circle"===e?"ellipse":"triangle"===e?"triangle":"rectangle",width:i.width,height:i.height}}(ea),viewportBounds:o,onPlace:tz,onCancel:()=>er?.(null)},ea):null]})}return(0,n.jsxs)("div",{...(0,$.Se)({namespace:"human2ai",id:"composition-canvas",name:"CompositionCanvas",category:"module",origin:"project",status:"candidate"}),ref:eg,className:eh,style:tb,children:["reference"!==p?(0,n.jsx)(g.A,{trigger:[],autoFocus:!0,open:ek,popupRender:e=>(0,n.jsx)("div",{ref:eC,children:e}),onOpenChange:e=>{e||eA()},menu:{items:M.JX.map(e=>({key:e,label:eN[e],disabled:!ep||(0,N.q)(c,tk,e)===c})),onClick:({key:e})=>{let t=M.JX.find(t=>t===e);t&&ep&&ep((0,N.q)(c,tk,t)),eA()}},children:(0,n.jsx)("span",{"aria-hidden":"true",style:{position:"fixed",left:eI.x,top:eI.y,width:1,height:1,pointerEvents:"none"}})}):null,"reference"===p?t3():(0,n.jsx)(ez,{onContextMenuRequest:tK,onCameraCenterChange:eM,className:"human2ai-composition-canvas__viewport",defaultCameraCenter:{x:R.cq.width/2,y:R.cq.height/2},zoom:S,minimumZoom:.25,maximumZoom:4,fitRequest:tP,contentBounds:tv,backgroundPattern:P,showViewportControls:T,sideActions:F,sideActionPlacement:E,sideActionPanelWidth:D,sideActionPanelDefaultCollapsed:_,labels:z,onZoomChange:e=>{eM(),el?.(e)},"aria-label":`${em}视口`,children:t3}),tF.feedback,"reference"!==p&&tf&&tL?(0,n.jsx)(eL,{nodeKind:tf.kind,metadata:tL,labels:O,disabled:!ep,titleExtra:(0,n.jsx)(f.A,{checked:!1!==tL.visible,checkedChildren:w.visible,unCheckedChildren:w.hidden,"aria-label":w.visibility,disabled:!ep,onChange:e=>ep?.((0,R.s)(tT.current.draft,tL.id,{visible:e}))}),leadingFields:tA&&(0,R.MY)(tA)?(0,n.jsx)(C,{label:tN.displayText,children:(0,n.jsx)(eU,{name:"displayText",autoFocus:!0,value:tA.displayText??"",placeholder:tN.displayTextPlaceholder,"aria-label":tN.displayText,disabled:!ep,onChange:e=>{ep&&ep((0,R.ai)(tT.current.draft,tA.id,{displayText:e.target.value}))}})}):void 0,propertyFields:tA||tM?(0,n.jsxs)(n.Fragment,{children:[tA&&!(0,R.MY)(tA)?(0,n.jsx)(C,{label:tN.lightSource,children:(0,n.jsx)(f.A,{checked:tA.isLightSource??!1,"aria-label":tN.lightSource,disabled:!ep,onChange:e=>{ep?.((0,R.ai)(tT.current.draft,tA.id,{isLightSource:e}))}})}):null,(0,n.jsx)(C,{label:tN.visualWeight,children:(0,n.jsx)(y.A,{className:"human2ai-canvas-node-editor__property-select",value:(tA??tM)?.visualWeight,options:tE,"aria-label":tN.visualWeight,disabled:!ep,onChange:e=>{ep&&ep(tA?(0,R.ai)(tT.current.draft,tA.id,{visualWeight:e}):(0,R.QY)(tT.current.draft,tM.id,{visualWeight:e}))}})})]}):null,trailingFields:tM?.cameraReference&&Y?Y(tM):tM?(0,n.jsx)(eu,{src:tM.assetId?W?.(tM.assetId):void 0,crop:tM.crop,aspectRatio:tM.width*R.cq.width/(tM.height*R.cq.height),labels:t$,onReadFile:ee,disabled:!ep||!Z,onUpload:async e=>{if(!ep||!Z)return;let t=await Z(e),i=tT.current;i.interactionResetKey===d&&i.draft.images.some(({id:e})=>e===tM.id)&&i.onDraftChange?.((0,R.QY)(i.draft,tM.id,{assetId:t,crop:null}))},onCropChange:(e,t)=>{if(!ep)return;let i=(0,R.QY)(tT.current.draft,tM.id,{crop:e});ep((0,R.CV)(i,tM.id,tM.width,tM.width*R.cq.width/(t*R.cq.height)))}},tM.id):void 0,autoFocusField:tA&&(0,R.MY)(tA)?"none":"note",onMetadataChange:e=>{ep&&ep((0,R.s)(tT.current.draft,tf.id,e))},onRequestClose:tq,onDelete:()=>tB(tf.id)}):null]})}function eY(e,t){return{x:-e/2,y:-t/2,width:e,height:t}}function eK({width:e,height:t}){let i=-(.32*e),a=[-(.18*t),0,.18*t];return(0,n.jsx)("g",{className:"human2ai-composition-canvas__text-region-marks","aria-hidden":"true",children:[.64*e,.5*e,.58*e].map((e,t)=>(0,n.jsx)("line",{x1:i,x2:i+e,y1:a[t],y2:a[t]},a[t]))})}function eX(e,t){if("circle"===t.type)return eY(2*t.radius,2*t.radius);if("ellipse"===t.type)return eY(2*t.radiusX,2*t.radiusY);let i="triangle"===e.primitive?t.side??0:t.width??0;return"triangle"===e.primitive?{x:-i/2,y:-2*t.height/3,width:i,height:t.height}:eY(i,t.height)}function eQ({draft:e,label:t,selected:i,onSelect:a,onNudge:r,onDoubleClick:o,onDelete:s,bounds:l,tooltip:d}){let c=e.directionLine;if(!c)return null;let u=te(c);return(0,n.jsx)(q,{id:c.id,label:`${t} ${c.id}`,tooltip:d,selected:i,onSelect:a,onNudge:r?e=>r(c.id,e):void 0,onDoubleClick:o,onDelete:s?()=>s(c.id):void 0,nudgeStep:.01,largeNudgeStep:.05,className:"human2ai-composition-canvas__item human2ai-composition-canvas__direction","data-composition-item":c.id,"data-composition-visible":!1!==c.visible,children:(0,n.jsx)(ef,{type:"infinite",anchor:u,angle:c.rotation,bounds:l,dashArray:"10 8"})})}function eZ({directionLine:e,distance:t,screenScale:i,labels:a,onNudge:r}){let o=i>0&&Number.isFinite(i)?i:1,s=7/o,l=12/o;return(0,n.jsx)("g",{className:"human2ai-composition-canvas__handles",children:e0(e,t).map((t,i)=>(0,n.jsxs)("g",{className:"human2ai-composition-canvas__direction-control","data-item-id":e.id,"data-handle":"move-direction-point","data-point-index":i,transform:`translate(${t.x} ${t.y})`,role:"button",tabIndex:0,"aria-label":a[i],"aria-keyshortcuts":"ArrowLeft ArrowRight ArrowUp ArrowDown",onKeyDown:e=>{let t=(e.shiftKey?10:1)/o,n={ArrowLeft:{x:-t,y:0},ArrowRight:{x:t,y:0},ArrowUp:{x:0,y:-t},ArrowDown:{x:0,y:t}};n[e.key]&&(e.preventDefault(),e.stopPropagation(),r(i,n[e.key]))},children:[(0,n.jsx)("circle",{className:"human2ai-composition-canvas__transform-handle",r:s}),(0,n.jsx)("circle",{className:"human2ai-composition-canvas__transform-hit",r:l})]},i))})}function e0(e,t){let i=te(e);return[tn(i,e.rotation,-t/2),tn(i,e.rotation,t/2)]}function e1(e,t){let i=new Set(t);return[...e.filter(e=>!i.has(e)),...t.filter(t=>!e.includes(t))]}function e2(e,t,i){return t.reduce((t,n)=>{let a=e9(e,n);return a?(0,R.Pe)(t,n,{x:a.x+i.x,y:a.y+i.y}):t},e)}function e3(e,t){return t.reduce((e,t)=>e9(e,t)?(0,R.Ai)(e,t):e,e)}function e5(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),width:Math.abs(t.x-e.x),height:Math.abs(t.y-e.y)}}function e8(e,t){let i=e.areas.find(e=>e.id===t);if(i)return e4(i);let n=e.images.find(e=>e.id===t);if(n)return e7(n);let a=e.focusPoints.find(e=>e.id===t);if(a){let e=te(a);return{x:e.x-20,y:e.y-20,width:40,height:40}}if(e.directionLine?.id===t){let t=te(e.directionLine);return{x:t.x-12,y:t.y-12,width:24,height:24}}return null}function e4(e){let t=(0,R.QR)(e,R.cq);if("circle"===t.type)return{x:t.cx-t.radius,y:t.cy-t.radius,width:2*t.radius,height:2*t.radius};if("ellipse"===t.type)return{x:t.cx-t.radiusX,y:t.cy-t.radiusY,width:2*t.radiusX,height:2*t.radiusY};let i=Math.min(...t.points.map(e=>e.x)),n=Math.min(...t.points.map(e=>e.y));return{x:i,y:n,width:Math.max(...t.points.map(e=>e.x))-i,height:Math.max(...t.points.map(e=>e.y))-n}}function e6(e,t){return!(e.x+e.width<t.x||t.x+t.width<e.x||e.y+e.height<t.y||t.y+t.height<e.y)}function e9(e,t){return e.areas.find(e=>e.id===t)??e.images.find(e=>e.id===t)??e.focusPoints.find(e=>e.id===t)??(e.directionLine?.id===t?e.directionLine:null)}function e7(e){let t=e.width*R.cq.width,i=e.height*R.cq.height,n=e.rotation*Math.PI/180,a=Math.abs(t*Math.cos(n))+Math.abs(i*Math.sin(n)),r=Math.abs(t*Math.sin(n))+Math.abs(i*Math.cos(n)),o=te(e);return{x:o.x-a/2,y:o.y-r/2,width:a,height:r}}function te(e){return{x:e.x*R.cq.width,y:e.y*R.cq.height}}function tt(e,t){let i=t.createSVGPoint();i.x=e.clientX,i.y=e.clientY;let n=t.getScreenCTM();if(!n)return{x:0,y:0};let a=i.matrixTransform(n.inverse());return{x:a.x,y:a.y}}function ti(e,t){try{e.setPointerCapture(t)}catch{}}function tn(e,t,i){let n=t*Math.PI/180;return{x:e.x+Math.cos(n)*i,y:e.y+Math.sin(n)*i}}function ta(e,t){let i=t*Math.PI/180,n=Math.cos(i),a=Math.sin(i);return{x:e.x*n-e.y*a,y:e.x*a+e.y*n}}var tr=i(63835),to=i(51055),ts=i(23139),tl=i(48776);function td({draft:e,selectedIds:t,onSelect:i,locked:a=!1,onLockedChange:r,showPlanning:o=!0,onShowPlanningChange:s,onDraftChange:l,labels:d,deleteLabel:c,disabled:u=!1}){let m=e.plans??[],h=u||a,p=1===t.length?m.find(e=>e.id===t[0]):void 0,b=p?.type==="symmetry"?d.symmetryHelp:p?.type==="golden-spiral"?d.spiralHelp:p?.type==="radial"?d.radialHelp:d.help,v=t=>{h||l((0,R.sJ)(e,t))},w=(e,t,i,a,r,o)=>(0,n.jsxs)("label",{className:"human2ai-composition-planning__field",children:[(0,n.jsx)("span",{children:e}),(0,n.jsx)(tl.A,{"aria-label":e,value:Math.round(100*t)/100,min:a,max:r,precision:o,step:1,controls:!1,disabled:h,onChange:e=>{null!==e&&Number.isFinite(e)&&(void 0===a||e>=a)&&(void 0===r||e<=r)&&(0!==o||Number.isInteger(e))&&i(e)}})]});return(0,n.jsxs)("section",{...(0,$.Se)({namespace:"human2ai",id:"composition-planning-panel",name:"CompositionPlanningPanel",category:"module",origin:"project",status:"candidate"}),className:"human2ai-composition-planning","aria-label":d.title,children:[(0,n.jsxs)("div",{className:"human2ai-composition-planning__heading",children:[(0,n.jsx)("h2",{children:d.title}),(0,n.jsx)(_.A,{title:b,children:(0,n.jsx)(ed.J,{mode:"icon-only",size:"small",icon:(0,n.jsx)(eI.A,{}),iconLabel:b})}),(0,n.jsx)(g.A,{trigger:["click"],disabled:h,menu:{items:R.Hm.map(e=>({key:e,label:d.types[e]})),onClick:({key:t})=>{if(h)return;let n=(0,R.vF)(e,t);l(n.draft),i([n.id])}},children:(0,n.jsx)(ed.J,{mode:"icon-only",size:"small",icon:(0,n.jsx)(eM.A,{}),iconLabel:d.add,disabled:h})}),(0,n.jsx)(_.A,{title:o?d.hideAll:d.showAll,children:(0,n.jsx)(ed.J,{mode:"icon-only",size:"small",icon:o?(0,n.jsx)(ev.A,{}):(0,n.jsx)(tr.A,{}),iconLabel:o?d.hideAll:d.showAll,"aria-pressed":o,disabled:u||!s,onClick:()=>s?.(!o)})}),(0,n.jsx)(_.A,{title:a?d.unlock:d.lock,children:(0,n.jsx)(ed.J,{mode:"icon-only",size:"small",icon:a?(0,n.jsx)(to.A,{}):(0,n.jsx)(ts.A,{}),iconLabel:a?d.unlock:d.lock,"aria-pressed":a,disabled:u||!r,onClick:()=>r?.(!a)})})]}),0===m.length?(0,n.jsx)("p",{className:"human2ai-composition-planning__empty",children:d.empty}):(0,n.jsx)("div",{className:"human2ai-composition-planning__list",children:m.map((a,r)=>(0,n.jsxs)("div",{className:"human2ai-composition-planning__row","data-plan-row":a.id,children:[(0,n.jsxs)(ed.J,{type:"text",size:"small","aria-pressed":t.includes(a.id),disabled:h,className:"human2ai-composition-planning__select",onClick:e=>i(e.shiftKey||e.ctrlKey||e.metaKey?t.includes(a.id)?t.filter(e=>e!==a.id):[...t,a.id]:[a.id]),children:[d.types[a.type]," ",r+1]}),(0,n.jsx)(_.A,{title:d.visible,children:(0,n.jsx)(f.A,{size:"small",checked:a.visible,"aria-label":d.visible,disabled:h,onChange:e=>v({...a,visible:e})})}),(0,n.jsx)(ed.J,{mode:"icon-only",size:"small",type:"text",icon:(0,n.jsx)(x.A,{}),iconLabel:c,disabled:h,onClick:()=>{h||(l((0,R.q3)(e,a.id)),i(t.filter(e=>e!==a.id)))}})]},a.id))}),p?(0,n.jsxs)("div",{className:"human2ai-composition-planning__properties","data-plan-properties":p.id,children:["thirds"===p.type||"golden-section"===p.type?(0,n.jsxs)("label",{className:"human2ai-composition-planning__field",children:[(0,n.jsx)("span",{children:d.axes}),(0,n.jsx)(y.A,{"aria-label":d.axes,value:p.axes,disabled:h,options:["both","horizontal","vertical"].map(e=>({value:e,label:d[e]})),onChange:e=>v({...p,axes:e})})]}):null,"radial"===p.type?(0,n.jsxs)("label",{className:"human2ai-composition-planning__field",children:[(0,n.jsx)("span",{children:d.radialMode}),(0,n.jsx)(y.A,{"aria-label":d.radialMode,value:p.mode,disabled:h,options:[{value:"uniform",label:d.radialUniform},{value:"free",label:d.radialFree}],onChange:e=>v((0,R.n_)(p,e))})]}):null,"golden-spiral"===p.type||"triangle"===p.type||"radial"===p.type?(0,n.jsxs)("div",{className:"human2ai-composition-planning__coordinates",children:[w(d.x,100*p.x,e=>v({...p,x:e/100})),w(d.y,100*p.y,e=>v({...p,y:e/100})),"radial"!==p.type||"uniform"===p.mode?w(d.rotation,p.rotation,e=>v({...p,rotation:e})):null,"golden-spiral"===p.type?w(d.scale,100*p.scale,e=>v({...p,scale:e/100}),1):null,"triangle"===p.type?(0,n.jsxs)(n.Fragment,{children:[w(d.width,100*p.width,e=>v({...p,width:e/100}),1),w(d.height,100*p.height,e=>v({...p,height:e/100}),1)]}):null,"radial"===p.type?(0,n.jsxs)(n.Fragment,{children:[w(d.rayCount,"free"===p.mode?p.angles.length:p.rayCount,e=>v((0,R.ht)(p,e)),2,36,0),"uniform"===p.mode?w(d.spread,p.spread,e=>v({...p,spread:e}),1,360):null]}):null]}):null,"golden-spiral"===p.type?(0,n.jsxs)("label",{className:"human2ai-composition-planning__toggle",children:[(0,n.jsx)("span",{children:d.mirrored}),(0,n.jsx)(f.A,{size:"small","aria-label":d.mirrored,checked:p.mirrored,disabled:h,onChange:e=>v({...p,mirrored:e})})]}):null,"triangle"===p.type?(0,n.jsx)("p",{className:"human2ai-composition-planning__help",children:d.triangleHelp}):null]}):null]})}var tc=i(43390),tu=i(74604);function tm({canUndo:e,canRedo:t,undo:i,redo:r,labels:o}){let[s,l]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{l(/Mac/.test(navigator.platform))},[]),(0,n.jsxs)("div",{...(0,$.Se)({namespace:"human2ai",id:"canvas-history-controls",name:"CanvasHistoryControls",category:"module",origin:"project",status:"candidate"}),className:"human2ai-canvas-history-controls",role:"group","aria-label":o.label,children:[(0,n.jsx)(ed.J,{mode:"icon-only",size:"small",icon:(0,n.jsx)(tc.A,{"aria-hidden":"true"}),iconLabel:o.undo,title:`${o.undo} (${s?"⌘Z":"Ctrl+Z"})`,"aria-keyshortcuts":"Control+z Meta+z",disabled:!e,onClick:i}),(0,n.jsx)(ed.J,{mode:"icon-only",size:"small",icon:(0,n.jsx)(tu.A,{"aria-hidden":"true"}),iconLabel:o.redo,title:`${o.redo} (${s?"⌘⇧Z":"Ctrl+Shift+Z"})`,"aria-keyshortcuts":"Control+Shift+z Meta+Shift+z Control+y",disabled:!t,onClick:r})]})}function th(e,t,i){let n=(0,R.M6)(e),a=(0,R.bc)(n),r="soft"===n.previewMode,o=n.plans??[],s=o.flatMap(e=>{let i;if("thirds"===e.type||"golden-section"===e.type)i=t("planningGrid",{type:t("thirds"===e.type?"planningThirds":"planningGoldenSection"),axes:t("both"===e.axes?"planningBoth":"horizontal"===e.axes?"planningHorizontal":"planningVertical")});else if("triangle"===e.type){let a=(0,R.i)(n.frame);i=t("planningTriangle",{points:(0,R.SZ)(e,n.frame).handles.map(e=>`(${tx((e.x-a.x)/a.width)}%, ${tx((e.y-a.y)/a.height)}%)`).join("; ")})}else if("radial"===e.type)i="free"===e.mode?t("planningRadialFree",{x:tx(e.x),y:tx(e.y),rayCount:e.angles.length,angles:e.angles.map(e=>`${Math.round(10*e)/10}\xb0`).join(", ")}):t("planningRadial",{x:tx(e.x),y:tx(e.y),rotation:Math.round(10*e.rotation)/10,rayCount:e.rayCount,spread:Math.round(10*e.spread)/10});else{if("symmetry"!==e.type&&"golden-spiral"!==e.type)return[];i=t("symmetry"===e.type?"planningSymmetry":"planningSpiral",{x:tx(e.x),y:tx(e.y),rotation:Math.round(10*e.rotation)/10,..."golden-spiral"===e.type?{scale:tx(e.scale),winding:t(e.mirrored?"planningCounterclockwise":"planningClockwise")}:{}})}return[i]}),l=a.areas.some(e=>"text-region"===e.semanticType),d=function(e,t){let i=Math.abs(e),n=Math.abs(t);for(;0!==n;)[i,n]=[n,i%n];return i||1}(n.frame.width,n.frame.height),c=a.focusPoints.map((e,i)=>[t("focusNumber",{index:i+1}),...ty(e,t),t("referencePosition",{x:tx(e.x),y:tx(e.y)})]),u=a.areas.map((e,i)=>[t(e.isLightSource?"lightSourceNumber":"text-region"===e.semanticType?"textRegionNumber":"areaNumber",{index:i+1}),...ty(e,t),...r&&e.isLightSource&&"quadrilateral"===e.primitive?[t("lightBandGuidance")]:[],...e.displayText?.trim()?[t("displayText",{text:e.displayText.trim()})]:"text-region"===e.semanticType?[t("generatedDisplayText")]:[],..."auto"===e.visualWeight?[]:[t("visualWeight",{weight:t(tp(e.visualWeight))})],t("referencePosition",{x:tx(e.center.x),y:tx(e.center.y)}),...e.isLightSource?[]:[t("referenceArea",{area:tx(e.visibleAreaShare)})],...!e.isLightSource&&Math.abs(e.rotation)>1e-6?[t("referenceRotation",{rotation:Math.round(e.rotation)})]:[],...!e.isLightSource&&e.clippedSides.length?[t("referenceClipping",{sides:e.clippedSides.map(e=>t(e)).join(t("sideSeparator"))})]:[]]),m=a.images.map((e,i)=>[t("imageNumber",{index:i+1}),...ty(e,t),..."auto"===e.visualWeight?[]:[t("visualWeight",{weight:t(tp(e.visualWeight))})],t("referencePosition",{x:tx(e.center.x),y:tx(e.center.y)}),t("referenceArea",{area:tx(e.areaShare)}),...Math.abs(e.rotation)>1e-6?[t("referenceRotation",{rotation:Math.round(e.rotation)})]:[],...e.clippedSides.length?[t("referenceClipping",{sides:e.clippedSides.map(e=>t(e)).join(t("sideSeparator"))})]:[]]),h=a.directionLine?[t("flowHeading"),...ty(a.directionLine,t),t("flowReference",{x:tx(a.directionLine.x),y:tx(a.directionLine.y),rotation:Math.round(a.directionLine.rotation)})]:[];return[t("title"),"",t("outputRatio",{ratio:`${n.frame.width/d}:${n.frame.height/d}`}),t("processingSemantic",{semantic:t("editorial-layout"===n.processingSemantic?"editorialLayout":"scene-composition"===n.processingSemantic?"sceneComposition":"unselected")}),"",t("previewMode",{mode:t(r?"softPreview":"precisePreview")}),t("layoutHeading"),t("editorial-layout"===n.processingSemantic?"editorialGuidance":"scene-composition"===n.processingSemantic?"sceneGuidance":"unselectedGuidance"),t(r?"regionSemanticsGuidance":"precisePreviewGuidance"),...a.areas.some(e=>e.isLightSource)?[t(r?"lightSourceGuidance":"preciseLightGuidance")]:[],...l?[t("displayTextGuidance")]:[],t("coordinateOrigin"),t("referenceValues"),...r?[t("flexibleImplementation"),t("referenceImageGuidance")]:[],...a.overallNote.trim()?["",t("globalNoteHeading"),a.overallNote.trim()]:[],...i?.trim()?["",i.trim()]:[],...o.length?["",t("planningHeading"),t("planningGuidance"),...s]:[],...a.areas.length?["",t("metricsHeading"),t("occupied",{value:tx(a.metrics.occupiedArea)}),t("negativeSpace",{value:tx(a.metrics.negativeSpace)})]:[],...c.length?["",t("focusHeading")]:[],...c.flatMap(e=>["",...e]),...u.length?["",t("areaHeading")]:[],...u.flatMap(e=>["",...e]),...m.length?["",t("imageHeading")]:[],...m.flatMap(e=>["",...e]),...h.length?["",...h]:[]].join("\n").trimEnd()}function tp(e){return"high"===e?"weightHigh":"medium"===e?"weightMedium":"low"===e?"weightLow":"weightDecorative"}async function tg(e,t){var i;let n,a,r=await tf(e,t);return navigator.clipboard?.write&&"u">typeof ClipboardItem?(await navigator.clipboard.write([new ClipboardItem({"image/png":r})]),"copied"):(i=r,n=URL.createObjectURL(i),(a=document.createElement("a")).href=n,a.download="composition-sketch.png",a.click(),URL.revokeObjectURL(n),"downloaded")}async function tf(e,t){var i,n,a,r;let o=(0,R.M6)(e),s=new Blob([(i=o,n=t,(0,R.qU)(i,n))],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(s);try{let e=await (a=l,new Promise((e,t)=>{let i=new Image;i.onload=()=>e(i),i.onerror=()=>t(Error("The browser could not render the composition sketch.")),i.src=a})),t=document.createElement("canvas");t.width=o.frame.width,t.height=o.frame.height;let i=t.getContext("2d");if(!i)throw Error("The browser could not create the composition canvas.");return i.drawImage(e,0,0,t.width,t.height),await (r=t,new Promise((e,t)=>{r.toBlob(i=>{i?e(i):t(Error("The browser could not generate the composition PNG."))},"image/png")}))}finally{URL.revokeObjectURL(l)}}function ty(e,t){return[...e.note.trim()?[t("note",{note:e.note.trim()})]:[],..."auto"===e.shotScale?[]:[t("shotScale",{shotScale:t(e.shotScale)})]]}function tx(e){return Math.round(100*e)}function tb(e,t){if(!e)throw Error(t)}i(1820);var tv=i(38954),tw=i(69388),tj=i(8647),tk=i(59030),tS=i(11902),tI=i(83499),tC=i(49762),tP=i(755);let tL=["#B9CA8B","#E4B653","#87C3CC","#DC938B","#B79BC8","#C9825D"],tA="#1F292B";function tM(e,t=0){return e*(1+1.4*t)}function tN(e){return e.filter(e=>e.visible).map(e=>({id:e.id,tone:u(e.id),geometry:[e.x,e.y,e.width,e.height],outline:()=>{var t,i,n,a;return t=e.x,i=e.y,[{x:t,y:i},{x:t+(n=e.width),y:i},{x:t+n,y:i+(a=e.height)},{x:t,y:i+a}]}}))}let tR="application/x-human2ai-workspace-session",t$=null,tT=null;function tF(e,t){t$=e,tT?.remove(),tT=null,e&&t&&((tT=document.createElement("canvas")).width=tT.height=1,tT.setAttribute("aria-hidden","true"),tT.style.cssText="position:fixed;left:0;top:0;pointer-events:none",document.body.appendChild(tT),t.setDragImage(tT,0,0))}var tE=i(92060),tD=i(55972),t_=i(27062);let tz=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://yisi.local/schemas/ui-sketch-draft.schema.json","title":"UI Sketch Draft","type":"object","additionalProperties":false,"required":["version","kind","frame","overallNote","rectangles","texts","images","groups","stages"],"properties":{"pngSplits":{"type":"array","items":{"$ref":"#/$defs/pngSplit"}},"layerOrder":{"type":"array","uniqueItems":true,"items":{"type":"string","minLength":1}},"version":{"const":1},"kind":{"const":"ui-layout-draft"},"frame":{"$ref":"#/$defs/bounds"},"overallNote":{"type":"string"},"stateTabs":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"required":["id","number"],"properties":{"id":{"type":"string","minLength":1},"number":{"type":"integer","minimum":1},"name":{"type":"string","minLength":1,"maxLength":100,"pattern":"\\\\S"}}}},"groups":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","itemIds"],"properties":{"id":{"type":"string","minLength":1},"itemIds":{"type":"array","minItems":2,"uniqueItems":true,"items":{"type":"string","minLength":1}}}}},"rectangles":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","x","y","width","height","note","annotation","semanticType","origin","visible","weight"],"properties":{"id":{"type":"string","minLength":1},"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number","exclusiveMinimum":0},"height":{"type":"number","exclusiveMinimum":0},"note":{"type":"string"},"annotation":{"type":"string"},"semanticType":{"type":"string"},"origin":{"enum":["user","agent","import"]},"visible":{"type":"boolean"},"weight":{"enum":["auto","high","medium","low","decorative"]}}}},"texts":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","x","y","text","fontSize","note","annotation","semanticType","origin","visible","weight"],"properties":{"id":{"type":"string","minLength":1},"x":{"type":"number"},"y":{"type":"number"},"text":{"type":"string"},"fontSize":{"type":"number","exclusiveMinimum":0},"note":{"type":"string"},"annotation":{"type":"string"},"semanticType":{"type":"string"},"origin":{"enum":["user","agent","import"]},"visible":{"type":"boolean"},"weight":{"enum":["auto","high","medium","low","decorative"]}}}},"images":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","x","y","width","height","assetId","crop","note","annotation","semanticType","origin","visible","weight"],"properties":{"id":{"type":"string","minLength":1},"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number","exclusiveMinimum":0},"height":{"type":"number","exclusiveMinimum":0},"previewReference":{"oneOf":[{"type":"object","additionalProperties":false,"required":["sessionId","sessionType","cameraId","renderedRevision"],"properties":{"sessionId":{"type":"string","minLength":1},"sessionType":{"const":"spatial"},"cameraId":{"type":"string","minLength":1},"renderedRevision":{"type":"integer","minimum":1}}},{"type":"object","additionalProperties":false,"required":["sessionId","sessionType","stateId","renderedRevision"],"properties":{"sessionId":{"type":"string","minLength":1},"sessionType":{"const":"ui-layout"},"stateId":{"type":"string","minLength":1},"renderedRevision":{"type":"integer","minimum":1}}},{"type":"object","additionalProperties":false,"required":["sessionId","sessionType","stateId","renderedRevision"],"properties":{"sessionId":{"type":"string","minLength":1},"sessionType":{"const":"image-composition"},"stateId":{"type":"string","minLength":1},"renderedRevision":{"type":"integer","minimum":1}}}]},"assetId":{"type":["string","null"],"minLength":1},"crop":{"oneOf":[{"type":"null"},{"$ref":"#/$defs/imageCrop"}]},"note":{"type":"string"},"annotation":{"type":"string"},"semanticType":{"type":"string"},"origin":{"enum":["user","agent","import"]},"visible":{"type":"boolean"},"weight":{"enum":["auto","high","medium","low","decorative"]}}}},"stages":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","rectangles","texts","images"],"properties":{"id":{"type":"string","minLength":1,"not":{"const":"start"}},"rectangles":{"type":"array","items":{"$ref":"#/$defs/stageRectangle"}},"texts":{"type":"array","items":{"$ref":"#/$defs/stageText"}},"images":{"type":"array","items":{"$ref":"#/$defs/stageRectangle"}}}}}},"$defs":{"pngSplit":{"type":"object","additionalProperties":false,"required":["id","algorithm","packingAlgorithm","options","sources","pieces","groupId"],"properties":{"id":{"type":"string","minLength":1},"algorithm":{"enum":["alpha-threshold-soft-edges-8-connected-v2","alpha-threshold-manual-regions-v3"]},"packingAlgorithm":{"const":"native-size-skyline-v1"},"options":{"type":"object","additionalProperties":false,"required":["alphaThreshold","minSize","gap"],"properties":{"alphaThreshold":{"type":"integer","minimum":0,"maximum":254},"minSize":{"type":"integer","minimum":0,"maximum":9007199254740991},"gap":{"type":"number","minimum":0}}},"sources":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"required":["nodeId","assetId","sha256","width","height","discarded"],"properties":{"nodeId":{"type":"string","minLength":1},"assetId":{"type":"string","minLength":1},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"width":{"type":"integer","minimum":1},"height":{"type":"integer","minimum":1},"discarded":{"type":"integer","minimum":0},"regions":{"type":"array","maxItems":64,"items":{"type":"array","minItems":3,"maxItems":256,"items":{"type":"array","minItems":2,"maxItems":2,"items":{"type":"number","minimum":-1000000,"maximum":1000000}}}}}}},"pieces":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["nodeId","assetId","sourceNodeId","sourceRect","sha256","width","height"],"properties":{"nodeId":{"type":"string","minLength":1},"assetId":{"type":"string","minLength":1},"sourceNodeId":{"type":"string","minLength":1},"sourceRect":{"type":"array","items":{"type":"integer","minimum":0},"minItems":4,"maxItems":4},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"width":{"type":"integer","minimum":1},"height":{"type":"integer","minimum":1}}}},"groupId":{"type":["string","null"],"minLength":1}}},"imageCrop":{"type":"object","additionalProperties":false,"required":["x","y","width","height"],"properties":{"x":{"type":"number","minimum":0,"maximum":1},"y":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","exclusiveMinimum":0,"maximum":1},"height":{"type":"number","exclusiveMinimum":0,"maximum":1}}},"bounds":{"type":"object","additionalProperties":false,"required":["x","y","width","height"],"properties":{"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number","exclusiveMinimum":0},"height":{"type":"number","exclusiveMinimum":0}}},"stageRectangle":{"type":"object","additionalProperties":false,"required":["id","x","y","width","height","visible"],"properties":{"id":{"type":"string","minLength":1},"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number","exclusiveMinimum":0},"height":{"type":"number","exclusiveMinimum":0},"visible":{"type":"boolean"}}},"stageText":{"type":"object","additionalProperties":false,"required":["id","x","y","fontSize","visible"],"properties":{"id":{"type":"string","minLength":1},"x":{"type":"number"},"y":{"type":"number"},"fontSize":{"type":"number","exclusiveMinimum":0},"visible":{"type":"boolean"}}}}}');var tB=i(44791),tq=i(33949);function tO(e){return e.stateTabs?.map(e=>({...e}))??["start",...e.stages.map(e=>e.id)].map((e,t)=>({id:e,number:t+1}))}function tU(e,t,i){return{...e,stateTabs:(0,tq.UR)(tO(e),t,i)}}function tH(e,t){return{...e,stateTabs:(0,tq.kq)(tO(e),t)}}function tG(e,t){return{...e,stateTabs:(0,tq.aD)(tO(e),t),stages:e.stages.filter(e=>e.id!==t)}}let tW="start",tJ={version:1,kind:"ui-layout-draft",frame:{...T.rr},overallNote:"",rectangles:[],texts:[],images:[],groups:[],stages:[]},tV=new t_.Ajv2020({allErrors:!0}).compile(tz);function tY(e){return{...e,...e.pngSplits?{pngSplits:structuredClone(e.pngSplits)}:{},...e.layerOrder?{layerOrder:[...e.layerOrder]}:{},frame:{...e.frame},...e.stateTabs?{stateTabs:tO(e)}:{},groups:e.groups.map(e=>({...e,itemIds:[...e.itemIds]})),rectangles:e.rectangles.map(e=>({...e})),texts:e.texts.map(e=>({...e})),images:e.images.map(e=>({...e,crop:e.crop?{...e.crop}:null})),stages:e.stages.map(e=>({...e,rectangles:e.rectangles.map(e=>({...e})),texts:e.texts.map(e=>({...e})),images:e.images.map(e=>({...e}))}))}}function tK(e,t){let i=tY(e);if(t===tW)return i;let n=tZ(i,t);if("end"===t&&!n)return i;if(!n)throw Error(`Unknown UI sketch stage id: ${t}.`);let a=new Map(n.rectangles.map(e=>[e.id,e])),r=new Map(n.texts.map(e=>[e.id,e])),o=new Map(n.images.map(e=>[e.id,e]));return{...i,rectangles:i.rectangles.map(e=>({...e,...a.get(e.id)})),texts:i.texts.map(e=>({...e,...r.get(e.id)})),images:i.images.map(e=>({...e,...o.get(e.id)}))}}function tX(e,t,i){if(i===tW||e.stages.some(e=>e.id===i))throw Error(`Duplicate UI sketch stage id: ${i}.`);let n=tO(e);if(!n.some(e=>e.id===t))throw Error(`Unknown UI sketch stage id: ${t}.`);let a=tK(e,t),r={id:i,rectangles:a.rectangles.map(t3),texts:a.texts.map(t5),images:a.images.map(t8)},o=t===tW?0:e.stages.findIndex(e=>e.id===t)+1;if(0===o&&t!==tW)throw Error(`Unknown UI sketch stage id: ${t}.`);let s=e.stages.map(t4);return s.splice(o,0,r),n.splice(n.findIndex(e=>e.id===t)+1,0,{id:i,number:Math.max(...n.map(e=>e.number))+1}),{...tY(e),stages:s,stateTabs:n}}function tQ(e,t,i){let n=t===tW?null:tZ(e,t);if(t!==tW&&"end"!==t&&!n)throw Error(`Unknown UI sketch stage id: ${t}.`);let a=n?.id??t,r=new Map(e.rectangles.map(e=>[e.id,e])),o=new Map(e.texts.map(e=>[e.id,e])),s=new Map(e.images.map(e=>[e.id,e])),l=new Map(i.rectangles.map(e=>[e.id,e])),d=new Map(i.texts.map(e=>[e.id,e])),c=new Map(i.images.map(e=>[e.id,e])),u=i.rectangles.map(e=>{let i=r.get(e.id);return i&&t!==tW?{...i,note:e.note,annotation:e.annotation,semanticType:e.semanticType,weight:e.weight}:{...e}}),m=i.texts.map(e=>{let i=o.get(e.id);return i&&t!==tW?{...i,text:e.text,note:e.note,annotation:e.annotation,semanticType:e.semanticType,weight:e.weight}:{...e}}),h=i.images.map(e=>{let i=s.get(e.id);return i&&t!==tW?{...i,assetId:e.assetId,...e.previewReference?{previewReference:{...e.previewReference}}:{previewReference:void 0},crop:e.crop?{...e.crop}:null,note:e.note,annotation:e.annotation,semanticType:e.semanticType,weight:e.weight}:{...e}}),p=e.stages.map(e=>({...e,rectangles:u.map(t=>e.id===a?t3(l.get(t.id)??t):{...e.rectangles.find(e=>e.id===t.id)??t3(l.get(t.id)??t)}),texts:m.map(t=>e.id===a?t5(d.get(t.id)??t):{...e.texts.find(e=>e.id===t.id)??t5(d.get(t.id)??t)}),images:h.map(t=>e.id===a?t8(c.get(t.id)??t):{...e.images.find(e=>e.id===t.id)??t8(c.get(t.id)??t)})}));return"end"!==t||n||p.push({id:"end",rectangles:u.map(e=>t3(l.get(e.id)??e)),texts:m.map(e=>t5(d.get(e.id)??e)),images:h.map(e=>t8(c.get(e.id)??e))}),{...e,...i.layerOrder?{layerOrder:(0,tw.G)(i)}:{},frame:{...i.frame},overallNote:i.overallNote,groups:i.groups.map(e=>({...e,itemIds:[...e.itemIds]})),rectangles:u,texts:m,images:h,stages:p,...e.stateTabs&&"end"===t&&!n?{stateTabs:[...tO(e),{id:"end",number:Math.max(...tO(e).map(e=>e.number))+1}]}:{}}}function tZ(e,t){return e.stages.find(e=>e.id===t)??("end"===t?e.stages[0]:void 0)}function t0(e){let t=(0,tB.I)(e);return!t||"object"!=typeof t||Array.isArray(t)?t:{...t,...!("weight"in t)?{weight:"auto"}:{},...!("visible"in t)?{visible:!0}:{}}}function t1(e){return e&&"object"==typeof e?{...e,..."rectangles"in e&&Array.isArray(e.rectangles)?{rectangles:e.rectangles.map(t2)}:{},..."texts"in e&&Array.isArray(e.texts)?{texts:e.texts.map(t2)}:{},..."images"in e&&Array.isArray(e.images)?{images:e.images.map(t2)}:{images:[]}}:e}function t2(e){return!e||"object"!=typeof e||"visible"in e?e:{...e,visible:!0}}function t3(e){let{id:t,x:i,y:n,width:a,height:r,visible:o}=e;return{id:t,x:i,y:n,width:a,height:r,visible:o}}function t5(e){let{id:t,x:i,y:n,fontSize:a,visible:r}=e;return{id:t,x:i,y:n,fontSize:a,visible:r}}function t8(e){let{id:t,x:i,y:n,width:a,height:r,visible:o}=e;return{id:t,x:i,y:n,width:a,height:r,visible:o}}function t4(e){return{...e,rectangles:e.rectangles.map(e=>({...e})),texts:e.texts.map(e=>({...e})),images:e.images.map(e=>({...e}))}}function t6(e){if(e.x+e.width>1+1e-9||e.y+e.height>1+1e-9)throw Error("Image crop must stay inside the source image.")}function t9(e,t){return e.length===t.size&&new Set(e).size===e.length&&e.every(e=>t.has(e))}function t7(e){let t=e.text.split("\n"),i=Math.max(1,...t.map(e=>[...e].length));return{x:e.x,y:e.y,width:Math.max(e.fontSize,i*e.fontSize*.62),height:Math.max(e.fontSize,t.length*e.fontSize*1.4)}}let ie=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","additionalProperties":false,"required":["sourceFingerprint","alignments"],"properties":{"sourceFingerprint":{"type":"string","minLength":1},"alignments":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["stageId","axis","edge","anchorId","itemIds"],"properties":{"stageId":{"type":"string","minLength":1},"axis":{"enum":["x","y"]},"edge":{"enum":["start","center","end"]},"anchorId":{"type":"string","minLength":1},"itemIds":{"type":"array","minItems":1,"uniqueItems":true,"items":{"type":"string","minLength":1}}}}}}}');function it(e){if(!e||"object"!=typeof e||!["rectangles","texts","images","groups","layerOrder"].every(t=>Array.isArray(e[t])))return null;try{let t=function(e){let t=function(e){if(!e||"object"!=typeof e)return e;let t="rectangles"in e&&Array.isArray(e.rectangles)?e.rectangles:null,i="texts"in e&&Array.isArray(e.texts)?e.texts:null,n="images"in e&&Array.isArray(e.images)?e.images:[],a="stages"in e&&Array.isArray(e.stages)?e.stages:[];return{...e,...!("groups"in e)?{groups:[]}:{},...t?{rectangles:t.map(e=>t0(e))}:{},...i?{texts:i.map(e=>t0(e))}:{},images:n.map(e=>{var t;let i;return t=e,!(i=t0(t))||"object"!=typeof i||Array.isArray(i)?i:{assetId:null,crop:null,...i}}),stages:a.map(t1)}}(e);if(!tV(t))throw Error((tV.errors??[]).map(e=>"additionalProperties"===e.keyword?`${e.instancePath||"draft"} contains unknown field: ${String(e.params.additionalProperty)}`:`${e.instancePath||"draft"} ${e.message??"is invalid"}`).join("; "));let i=tY(t),n=new Set;for(let e of[...i.rectangles,...i.texts,...i.images]){if(n.has(e.id))throw Error(`Duplicate UI sketch item id: ${e.id}.`);n.add(e.id)}i.layerOrder&&(i.layerOrder=(0,tw.G)(i)),i.images.forEach(e=>{e.crop&&t6(e.crop)});let a=new Set;for(let e of i.pngSplits??[]){let t=new Map(e.sources.map(e=>[e.nodeId,e]));for(let t of e.sources)(0,tD.F$)(t.regions??[]);if(a.has(e.id)||t.size!==e.sources.length)throw Error("Duplicate PNG split identity.");a.add(e.id);let i=new Set;for(let n of e.pieces){let e=t.get(n.sourceNodeId),[a,r,o,s]=n.sourceRect;if(!e||i.has(n.nodeId)||o!==n.width||s!==n.height||a+o>e.width||r+s>e.height)throw Error("Invalid PNG split source rectangle.");i.add(n.nodeId)}if(e.pieces.length>=2!=!!e.groupId)throw Error("Invalid PNG split group identity.")}let r=new Set,o=new Set;for(let e of i.groups){if(o.has(e.id)||n.has(e.id))throw Error(`Duplicate UI sketch group id: ${e.id}.`);for(let t of(o.add(e.id),e.itemIds)){if(!n.has(t))throw Error(`Unknown UI sketch group member: ${t}.`);if(r.has(t))throw Error(`UI sketch item belongs to multiple groups: ${t}.`);r.add(t)}}let s=new Set;for(let e of i.stages){if(e.id===tW||s.has(e.id))throw Error(`Duplicate UI sketch stage id: ${e.id}.`);s.add(e.id),function(e,t,i,n){let a=e.rectangles.map(e=>e.id),r=e.texts.map(e=>e.id),o=e.images.map(e=>e.id);if(!t9(a,t)||!t9(r,i)||!t9(o,n))throw Error(`UI sketch stage ${e.id} must contain each draft item exactly once.`)}(e,new Set(i.rectangles.map(e=>e.id)),new Set(i.texts.map(e=>e.id)),new Set(i.images.map(e=>e.id)))}if(i.stateTabs){let e=new Set(i.stateTabs.map(e=>e.id));if(e.size!==i.stateTabs.length||[...e].some(e=>e!==tW&&!s.has(e))||[...s].some(t=>!e.has(t)))throw Error("UI sketch state tabs must reference every snapshot exactly once.")}return i}({...tY(tJ),rectangles:e.rectangles,texts:e.texts,images:e.images,groups:e.groups,layerOrder:e.layerOrder}),i=ii(t,[...t.rectangles,...t.texts,...t.images].map(e=>e.id));return i.layerOrder.length?i:null}catch{return null}}function ii(e,t){let i=new Set((0,tv.J$)(e,t));return structuredClone({rectangles:e.rectangles.filter(e=>i.has(e.id)),texts:e.texts.filter(e=>i.has(e.id)),images:e.images.filter(e=>i.has(e.id)),groups:e.groups.filter(e=>e.itemIds.every(e=>i.has(e))),layerOrder:(0,tw.G)(e).filter(e=>i.has(e))})}new t_.Ajv2020({allErrors:!0}).compile(ie);var ia=i(95948);function ir({readPrompt:e,label:t,loadingLabel:i,errorLabel:r}){let[o,s]=(0,a.useState)();return(0,a.useEffect)(()=>{let t=!1;return Promise.resolve().then(e).then(i=>{t||s({reader:e,text:i})},()=>{t||s({reader:e,failed:!0})}),()=>{t=!0}},[e]),(0,n.jsx)("div",{className:"human2ai-prompt-preview-hover__content",role:"region","aria-label":t,tabIndex:0,children:o?.reader!==e?(0,n.jsx)(ia.G,{label:i,rows:4,compact:!0}):o.failed?(0,n.jsx)("p",{role:"alert",children:r}):(0,n.jsx)("pre",{children:o.text})})}function io(e){return(0,n.jsx)(tC.A,{placement:"top",trigger:["hover","focus"],destroyOnHidden:!0,getPopupContainer:e=>e.ownerDocument.body,styles:{root:{position:"fixed"}},title:e.label,open:!e.disabled&&void 0,content:()=>(0,n.jsx)(ir,{...e}),children:(0,n.jsx)("span",{className:"human2ai-prompt-preview-hover",...(0,$.Se)({namespace:"human2ai",id:"prompt-preview-hover",name:"PromptPreviewHover",category:"module",origin:"project",status:"candidate"}),children:e.children})})}function is({renderSvg:e,label:t}){let i=(0,a.useId)().replace(/:/g,""),r=(0,a.useMemo)(()=>({__html:e().replace(/\bid="([^"]+)"/g,`id="${i}-$1"`).replace(/\bhref="#([^"]+)"/g,`href="#${i}-$1"`).replace(/url\(#([^)]+)\)/g,`url(#${i}-$1)`)}),[e,i]);return(0,n.jsx)("div",{className:"human2ai-canvas-preview-hover__image",role:"img","aria-label":t,dangerouslySetInnerHTML:r})}function il(e){return(0,n.jsx)(tC.A,{placement:"left",trigger:["hover","focus"],destroyOnHidden:!0,open:!e.disabled&&void 0,content:()=>(0,n.jsx)(is,{...e}),children:(0,n.jsx)("span",{className:"human2ai-canvas-preview-hover",...(0,$.Se)({namespace:"human2ai",id:"canvas-preview-hover",name:"CanvasPreviewHover",category:"module",origin:"project",status:"candidate"}),children:e.children})})}function id({text:e,fontSize:t,lineHeight:i=1.4,baseline:r,fontFamily:o,fontWeight:s,fill:l,opacity:d,textAnchor:c="start",className:u,style:m,onBoundsChange:h,"aria-label":p=e}){let g=(0,a.useRef)(null),f=(0,a.useRef)(h),y=(0,a.useRef)(null);f.current=h;let x=["human2ai-canvas-text",u].filter(Boolean).join(" "),b=e.split("\n"),v=!!h;return(0,a.useLayoutEffect)(()=>{if(!v)return;let e=g.current;if(!e)return;let t=!0;function i(){var i,n;if(!t)return;let a=e.getBBox(),r={x:a.x,y:a.y,width:a.width,height:a.height};i=y.current,n=r,i&&.01>Math.abs(i.x-n.x)&&.01>Math.abs(i.y-n.y)&&.01>Math.abs(i.width-n.width)&&.01>Math.abs(i.height-n.height)||(y.current=r,f.current?.(r))}return i(),document.fonts?.addEventListener("loadingdone",i),document.fonts?.ready.then(i),()=>{t=!1,document.fonts?.removeEventListener("loadingdone",i)}},[u,r,o,t,s,i,v,m,e,c]),(0,n.jsx)("text",{ref:g,...(0,$.Se)({namespace:"human2ai",id:"canvas-text",name:"CanvasText",category:"module",origin:"project",status:"candidate"}),className:x,"data-line-count":b.length,x:0,y:r??0,fontSize:t,fontFamily:o,fontWeight:s,fill:l,opacity:d,textAnchor:c,dominantBaseline:void 0===r?"text-before-edge":"alphabetic",xmlSpace:"preserve",style:m,role:"img","aria-label":p,children:b.map((e,a)=>(0,n.jsx)("tspan",{x:0,y:void 0===r?void 0:r+a*t*i,dy:void 0===r?0===a?0:`${i}em`:void 0,children:e||"\xa0"},a))})}function ic(e,t){let i=Math.max(1,Math.round(e.frame.width)),n=Math.max(1,Math.round(e.frame.height)),a=l()(tN(e.rectangles)),r=e.rectangles.filter(e=>e.visible).map(t=>{let i,n,r=t.x-e.frame.x,o=t.y-e.frame.y,s=`x="${iu(r)}" y="${iu(o)}" width="${iu(t.width)}" height="${iu(t.height)}"`,l=`<rect ${s} fill="${tL[u(t.id)]}" fill-opacity="0.82"/>`;if(!a.has(t.id))return{id:t.id,svg:l};let d=`ui-rectangle-${t.id.replace(/[^a-zA-Z0-9_-]/g,"-")}`;return{id:t.id,svg:`${l}<defs><clipPath id="${d}"><rect ${s}/></clipPath></defs><rect ${s} fill="none" stroke="${i=tL[u(t.id)],n=[1,3,5].map(e=>Math.round(.25*parseInt(i.slice(e,e+2),16)+.75*parseInt(tA.slice(e,e+2),16))),`rgb(${n.join(",")})`}" stroke-width="6" clip-path="url(#${d})"/>`}}),o=e.images.filter(e=>e.visible).map(i=>{let n=i.x-e.frame.x,a=i.y-e.frame.y,r=i.assetId?t?.(i.assetId):void 0;if(!r)return{id:i.id,svg:`<rect data-element-kind="image" x="${iu(n)}" y="${iu(a)}" width="${iu(i.width)}" height="${iu(i.height)}" fill="#F8FAF9" stroke="#ADBDB8" stroke-width="2"/>`};let o=i.crop,s=o?n-o.x/o.width*i.width:n,l=o?a-o.y/o.height*i.height:a,d=o?i.width/o.width:i.width,c=o?i.height/o.height:i.height,u=`ui-image-${i.id.replace(/[^a-zA-Z0-9_-]/g,"-")}`,m=`x="${iu(n)}" y="${iu(a)}" width="${iu(i.width)}" height="${iu(i.height)}"`;return{id:i.id,svg:`<g data-element-kind="image"><rect ${m} fill="none" stroke="#ADBDB8" stroke-width="2"/><defs><clipPath id="${u}"><rect ${m}/></clipPath></defs><image href="${im(r)}" x="${iu(s)}" y="${iu(l)}" width="${iu(d)}" height="${iu(c)}" preserveAspectRatio="${o?"none":"xMidYMid slice"}" clip-path="url(#${u})"/></g>`}}),s=e.texts.filter(e=>e.visible).map(t=>{var i,n,a,r;let o;return{id:t.id,svg:(i=t.text,n=t.x-e.frame.x,a=t.y-e.frame.y,r=t.fontSize,o=i.split("\n").map((e,t)=>`<tspan x="0" y="${iu(tM(r,t))}">${im(e||"\xa0")}</tspan>`),`<g transform="translate(${iu(n)} ${iu(a)})"><text x="0" y="${iu(tM(r))}" font-size="${iu(r)}" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve" style="white-space:pre">${o.join("")}</text></g>`)}});return[`<svg xmlns="http://www.w3.org/2000/svg" width="${i}" height="${n}" viewBox="0 0 ${i} ${n}" overflow="hidden">`,`<defs><clipPath id="ui-preview-frame" clipPathUnits="userSpaceOnUse"><rect width="${i}" height="${n}"/></clipPath></defs>`,'<rect width="100%" height="100%" fill="#ffffff"/>',`<g clip-path="url(#ui-preview-frame)" font-family="-apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif" font-weight="400" fill="${tA}">`,...(0,M.jQ)([...o,...r,...s],e.layerOrder,e=>e.id).map(e=>e.svg),"</g>","</svg>"].join("")}function iu(e){return String(Math.round(100*e)/100)}function im(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function ih(e,t,i,n=t7){let a=[...e.images.flatMap((i,a)=>{var r,o,s,l;let d,c;return ip(e,i,n)?[(r=e,o=i,s=a,l=t,d=ib(r,o),c=o.note.trim(),[l("imageNumber",{index:s+1}),...c?[l("note",{note:c})]:[],l("visualWeight",{weight:iw(o.weight,l)}),`- ${l("referencePosition",d)}`,`- ${l("referenceSize",d)}`])]:[]}),...e.rectangles.flatMap((i,a)=>{var r,o,s,l;let d,c;return ip(e,i,n)?[(r=e,o=i,s=a,l=t,d=ib(r,o),c=o.note.trim(),[l("regionNumber",{index:s+1}),...c?[l("note",{note:c})]:[],l("visualWeight",{weight:iw(o.weight,l)}),`- ${l("referencePosition",d)}`,`- ${l("referenceSize",d)}`])]:[]}),...e.texts.flatMap((i,a)=>{var r,o,s,l;let d,c;return ip(e,i,n)?[(r=e,o=i,s=a,l=t,d=iv(r,o),c=o.note.trim(),[l("textNumber",{index:s+1}),l("displayText",{text:JSON.stringify(o.text)}),...c?[l("note",{note:c})]:[],l("visualWeight",{weight:iw(o.weight,l)}),`- ${l("referencePosition",d)}`,`- ${l("referenceFontSize",{fontSize:Math.max(1,Math.round(o.fontSize))})}`])]:[]})];return[t("staticTitle"),"",t("canvasSize",{width:Math.round(e.frame.width),height:Math.round(e.frame.height)}),"",...ig(!1,t),...iy(e.overallNote,t),...i?.trim()?["",i.trim()]:[],...a.length?["",t("elementsHeading")]:[],...a.flatMap(e=>["",...e])].join("\n").trimEnd()}function ip(e,t,i){if(!t.visible)return!1;let n="text"in t?i(t):t,a=e.frame;return n.x<a.x+a.width&&n.x+n.width>a.x&&n.y<a.y+a.height&&n.y+n.height>a.y}function ig(e,t){return[t("layoutHeading"),t("canvasOrigin"),t("referenceValues"),t("perceptibleElementGuidance"),t("flexibleImplementation"),...e?[t("motionStateGuidance")]:[]]}function iy(e,t){let i=e.trim();return i?["",t("globalNoteHeading"),i]:[]}function ix(e,t,i,n,a){return[...i!==n?[a(n?"changeVisible":"changeHidden")]:[],...e.x!==t.x||e.y!==t.y?[a("referencePosition",t)]:[],...e.width!==t.width||e.height!==t.height?[a("referenceSize",t)]:[]]}function ib(e,t){return{x:Math.round(t.x-e.frame.x),y:Math.round(t.y-e.frame.y),width:Math.max(1,Math.round(t.width)),height:Math.max(1,Math.round(t.height))}}function iv(e,t){let i=t7(t);return{x:Math.round(t.x-e.frame.x),y:Math.round(t.y-e.frame.y),width:Math.max(1,Math.round(i.width)),height:Math.max(1,Math.round(i.height))}}function iw(e,t){return({auto:t("weightAuto"),high:t("weightHigh"),medium:t("weightMedium"),low:t("weightLow"),decorative:t("weightDecorative")})[e]}async function ij(e,t){var i;let n,a,r=await ik(e,t);return navigator.clipboard?.write&&"u">typeof ClipboardItem?(await navigator.clipboard.write([new ClipboardItem({"image/png":r})]),"copied"):(i=r,n=URL.createObjectURL(i),(a=document.createElement("a")).href=n,a.download="ui-sketch.png",a.click(),URL.revokeObjectURL(n),"downloaded")}async function ik(e,t){let i=new Map;await Promise.all([...new Set(e.images.flatMap(e=>e.visible&&e.assetId?[e.assetId]:[]))].map(async e=>{let n=t?.(e);if(!n)return;if(n.startsWith("data:"))return void i.set(e,n);let a=await fetch(n);if(!a.ok)throw a;let r=await a.blob(),o=await new Promise((e,t)=>{let i=new FileReader;i.onload=()=>e(i.result),i.onerror=()=>t(i.error),i.readAsDataURL(r)});i.set(e,o)})),await document.fonts.ready;let n=new Blob([ic(e,e=>i.get(e))],{type:"image/svg+xml;charset=utf-8"}),a=URL.createObjectURL(n);try{var r,o;let t=await (r=a,new Promise((e,t)=>{let i=new Image;i.onload=()=>e(i),i.onerror=()=>t(Error("浏览器未能渲染 UI 界面。")),i.src=r})),i=document.createElement("canvas");i.width=Math.max(1,Math.round(e.frame.width)),i.height=Math.max(1,Math.round(e.frame.height));let n=i.getContext("2d");if(!n)throw Error("浏览器未能创建草图画布。");return n.drawImage(t,0,0,i.width,i.height),await (o=i,new Promise((e,t)=>{o.toBlob(i=>{i?e(i):t(Error("浏览器未能生成 UI 界面预览图。"))},"image/png")}))}finally{URL.revokeObjectURL(a)}}i(69854),i(49512),i(37588);let iS="frame:ui",iI="application/x-human2ai-ui-sketch",iC={rectangle:{shape:"rectangle",width:280,height:108},image:{shape:"rectangle",width:320,height:180},text:{shape:"rectangle",width:84,height:20,clickOnly:!0}},iP={...L,canvas:"UI 界面画布",canvasViewport:"UI 界面无限画布",scene:"UI 界面场景",region:"区域",addRegion:"添加区域",text:"文字",addText:"添加文字",image:"图片",addImage:"添加图片",newText:"文字",overallNote:"全局备注",clearCanvas:"清空画布",clearCanvasConfirmTitle:"确认清空画布?",clearCanvasConfirmDescription:"将移除全部区域、文字和图片。",clearCanvasCancel:"取消",groupItems:"建组",ungroupItems:"解组",deleteSelection:ej.actions.delete,copyGroup:"复制",copyPrompt:"复制提示词",promptPreview:ej.clipboard.promptPreview,promptPreviewLoading:ej.clipboard.promptPreviewLoading,promptPreviewFailed:ej.clipboard.promptPreviewFailed,copySketch:"复制预览图",previewImage:ej.clipboard.previewImage,copyAllStages:"动效",overallNoteTitle:"对整个界面的要求",overallNotePlaceholder:"例如:整体保持安静,突出当前任务和主要操作",overallNoteAriaLabel:"UI 界面的全局备注",fitFrame:"适应界面范围",interactionHelp:"选择节点工具后,单击放置;形状和图片可拖动确定尺寸;Esc 取消。滚轮缩放;按住右键,或空格键加左键拖动画布。",sideActions:"UI 界面操作",collapseSideActions:"收起 UI 界面操作",expandSideActions:"展开 UI 界面操作",frameAction:"移动或调整界面范围",frameRange:"界面范围",missingRegionNote:"未填写备注",editRegionNote:"编辑区域信息",editText:"编辑文字",nodeDescription:"节点说明",nodeDescriptionHelp:ej.canvas.node.nodeDescriptionHelp,originUser:"user",originAgent:"agent",originImport:"import",note:"备注",noteHelp:ej.notes.element.nodeHelp,textContent:"显示文字",regionPlaceholder:"这个区域表达什么布局内容",textPlaceholder:"输入文字",textNotePlaceholder:"这段文字表达什么",imageNotePlaceholder:"说明这个图片节点表达什么",shapeKind:"形状",emptyText:"---文字未输入---",visualWeight:"视觉权重",visibility:"显示状态",visible:"显示",hidden:"隐藏",weightAuto:"自动",weightHigh:"高",weightMedium:"中",weightLow:"低",weightDecorative:"装饰",fontSize:"字号",decreaseFontSize:"减小字号",increaseFontSize:"增大字号",cancel:"取消",deleteRegion:"删除区域",deleteText:"删除文字",deleteNode:"删除节点",confirmDeleteRegion:"确认删除这个区域?",confirmDeleteText:"确认删除这段文字?",confirmDeleteNode:"确认删除这个节点?",cancelDelete:"保留",promptUnsupported:"当前浏览器不支持复制提示词。",promptCopied:"复制成功",promptCopyFailed:"复制提示词失败。",sketchCopied:"复制成功",sketchDownloaded:"浏览器不支持复制图片,预览图已下载",sketchCopyFailed:"复制预览图失败。",selectedItemsPrefix:"已选择 ",selectedItemsSuffix:" 个元素",noSelection:"未选择元素"},iL=(0,p._)(b.A),iA=(0,p._)(b.A.TextArea),iM=(0,p._)(I);function iN({renderPngSplitDialog:e,pngSplitLabels:t,sessionPreviewLabel:i,sessionPreviewFailedLabel:s=ej.sessionPreview.failed,onSessionPreviewDrop:d,loadSessionPreviewDragImage:c,renderSessionPreviewTool:m,renderSessionPreviewEditor:h,interactionResetKey:p,draft:b,activeStageId:v=tW,onDraftChange:w,writePrompt:j,writeSketch:S,translatePrompt:I,resolveStylePrompt:L,toolHost:N=null,clearActionHost:R=null,showHiddenNodes:T=!1,onionSkin:F=!1,showCanvasTools:E=!0,canvasSideActionPanelDefaultCollapsed:D=!1,interfaceFrameLocked:B=!1,labels:O,imageEditorLabels:U,resolveImageSource:H,onImageUpload:G,onReadImageFile:W,className:Y,style:Z,"aria-label":ee}){var et,ei,ea,er,eo;let el={...iP,...O},ec={content:"图片内容",sourceDimensions:(e,t)=>`${e} \xd7 ${t} px`,sourceFileSize:(e,t)=>`${e} ${t}`,upload:"上传图片",download:"下载图片",downloading:"正在下载",downloadFailed:"图片下载失败,请重试。",replace:"替换图片",uploading:"正在上传",uploadFailed:"上传失败,请重试",fileTypes:"支持 PNG、JPEG、WebP、SVG,最大 10 MB",cropTitle:"裁剪图片",cropLoadFailed:"图片加载失败",svgSource:"SVG 源码",svgPaste:"粘贴 SVG",svgApply:"使用 SVG",svgSaveFailed:"SVG 保存失败,请检查代码后重试。",svgCopy:"复制源码",svgCopying:"正在复制源码",svgCopyFailed:"源码复制失败",sourceLoading:"正在读取图片内容",sourceLoadFailed:"图片内容读取失败,请重试。",svgCopied:"已复制",cancel:"取消",retry:"重试",...U},em=(0,a.useId)(),eh=(0,a.useMemo)(()=>tK(b,v),[v,b]),ep=(0,a.useCallback)(()=>ic(eh,H),[eh,H]),eg=(0,a.useRef)(b);(0,a.useLayoutEffect)(()=>{eg.current=b},[b]);let ef=(0,a.useRef)(0),ey=(0,a.useRef)(tq);(0,a.useLayoutEffect)(()=>{ey.current=tq}),(0,a.useLayoutEffect)(()=>()=>{ef.current++},[v,p,d]);let[ev,ew]=(0,a.useState)(null),[ek,eC]=(0,a.useState)([]),[eP,eL]=(0,a.useState)(null),[eN,eR]=(0,a.useState)({alphaThreshold:8,minSize:16,gap:12});(0,a.useLayoutEffect)(()=>{eL(null),eH(e=>e?.type==="info"?null:e)},[v,p,e]);let[e$,eF]=(0,a.useState)(null),[eE,eD]=(0,a.useState)(null),[e_,eB]=(0,a.useState)(!1),[eq,eO]=(0,a.useState)(null),[eU,eH]=(0,a.useState)(null),[eG,eW]=(0,a.useState)(!1),[eJ,eV]=(0,a.useState)(!1),[eY,eK]=(0,a.useState)(null),{contextMenuOpen:eX,contextMenuPoint:eQ,contextMenuPopupRef:eZ,openContextMenuAt:e0,closeContextMenu:e1,dismissContextMenu:e2}=A(),[e3,e5]=(0,a.useState)({}),[e8,e4]=(0,a.useState)(null),e6=(0,a.useRef)(null),e9=(0,a.useRef)(null),e7=(0,a.useRef)(null),te=(0,a.useRef)(!1),tt=(0,a.useRef)(!1),ti=(0,a.useRef)(tX);(0,a.useLayoutEffect)(()=>{ti.current=tX});let tn=(0,a.useRef)(""),ta=(0,a.useRef)(0),tr=tO(b),to=tr[tr.findIndex(e=>e.id===v)-1]?.id,ts=(0,a.useMemo)(()=>F&&to?tK(b,to):null,[b,F,to]),tl=(0,a.useMemo)(()=>T?eh:{...eh,rectangles:eh.rectangles.filter(e=>e.visible),texts:eh.texts.filter(e=>e.visible),images:eh.images.filter(e=>e.visible)},[T,eh]),td=tr.length>1,tc=[{value:"auto",label:el.weightAuto},{value:"high",label:el.weightHigh},{value:"medium",label:el.weightMedium},{value:"low",label:el.weightLow},{value:"decorative",label:el.weightDecorative}],tu=ek.filter(iF),tm=new Set(tu),th=tu.filter(e=>i_(tl,e)),tp=th.length>1?(et=tl,ei=th,ea=e3,iU(ei.map(e=>iz(et,e,ea)).filter(e=>!!e))):null,tg=e$?i_(eh,e$):null,tf=(0,a.useRef)({updateImage:t2,interactionResetKey:p});(0,a.useLayoutEffect)(()=>{tf.current={updateImage:t2,interactionResetKey:p}});let ty=en({disabled:!w||!!e$||e_||!!eP,resetKey:`${p}:${v}`,labels:ec,onUpload:G,onReadImageFile:W,resolveImageSource:H,onImageReady:({assetId:e,x:t,y:i,width:n,height:a})=>{tG({x:t-n/2,y:i-a/2,width:n,height:a},e),ew(null)},onCopy:function(e){if(!e.clipboardData||0===tu.length)return;let t=ii(eh,tL);0!==t.layerOrder.length&&(tn.current=X(e.clipboardData,iI,t,t.images,H),ta.current=0,e.preventDefault(),e.stopPropagation())},onPasteFallback:function(e){if(e.defaultPrevented||!w||!e.clipboardData)return;let t=Q(e.clipboardData,iI,it);t&&(e.preventDefault(),e.stopPropagation(),ty.pasteNodes(t.items.images,t.sources,()=>ti.current(t)))}}),tx=function(e,t,i,r){let o=(0,a.useRef)(null),s=(0,a.useRef)(null),l=(0,a.useRef)(null),d=(0,a.useRef)(null),c=(0,a.useRef)(null),u=(0,a.useRef)(r);function m(){null!==c.current&&cancelAnimationFrame(c.current),c.current=null,d.current?.request.abort(),d.current?.image&&(d.current.image.onload=null,d.current.image.onerror=null,d.current.image.src=""),o.current?.setAttribute("visibility","hidden"),s.current?.setAttribute("visibility","hidden"),l.current?.setAttribute("visibility","hidden"),l.current?.removeAttribute("href"),d.current?.objectUrl&&URL.revokeObjectURL(d.current.objectUrl),d.current=null}function h(){null===c.current&&(c.current=requestAnimationFrame(()=>{c.current=null;let e=d.current,t=o.current,i=t?.ownerSVGElement,n=i?.getScreenCTM();if(!e||!t||!i||!n)return;let a=i.createSVGPoint();a.x=e.clientX,a.y=e.clientY;let r=a.matrixTransform(n.inverse()),m=Math.hypot(n.a,n.b),h=Math.hypot(n.c,n.d),p=(0,tP.QO)(e,u.current),{width:g,height:f}=p;e.src&&!e.failed&&(e.displayedSize=p),t.setAttribute("transform",`translate(${r.x} ${r.y})`),t.setAttribute("visibility",e.failed||e.src?"visible":"hidden"),s.current?.setAttribute("visibility",e.failed?"visible":"hidden"),s.current?.setAttribute("transform",`scale(${1/m} ${1/h})`),l.current?.setAttribute("visibility",!e.failed&&e.src?"visible":"hidden"),l.current?.setAttribute("x",String(-g/2)),l.current?.setAttribute("y",String(-f/2)),l.current?.setAttribute("width",String(g)),l.current?.setAttribute("height",String(f)),e.src&&l.current?.getAttribute("href")!==e.src&&l.current?.setAttribute("href",e.src)}))}function p(e){return i&&!(d.current?.sessionId===e&&d.current.failed)}return(0,a.useLayoutEffect)(()=>{u.current=r,d.current&&h()},[r.width,r.height]),(0,a.useLayoutEffect)(()=>{let e=e=>{"Escape"===e.key&&m()};return window.addEventListener("dragend",m,!0),window.addEventListener("drop",m),window.addEventListener("blur",m),window.addEventListener("keydown",e),()=>{m(),window.removeEventListener("dragend",m,!0),window.removeEventListener("drop",m),window.removeEventListener("blur",m),window.removeEventListener("keydown",e)}},[e,t,i]),{show:function(t){let n=t.dataTransfer.getData(tR)||t$;if(!n)return!1;if(d.current?.sessionId!==n){m();let a={sessionId:n,clientX:t.clientX,clientY:t.clientY,width:1,height:1,failed:!i,request:new AbortController};d.current=a,i&&e&&e(n).then(async e=>{if(d.current!==a)return;let t=await fetch(e,{signal:a.request.signal});if(!t.ok)throw Error("Preview image unavailable");let i=await t.blob();if(d.current!==a)return;let n=URL.createObjectURL(i);a.objectUrl=n;let r=new Image;a.image=r,r.onload=()=>{d.current===a&&(a.width=r.naturalWidth,a.height=r.naturalHeight,a.src=n,h())},r.onerror=()=>{a.failed=!0,d.current===a&&h()},r.src=n}).catch(()=>{a.failed=!0,d.current===a&&h()})}return d.current.clientX=t.clientX,d.current.clientY=t.clientY,h(),p(n)},clear:m,canDrop:p,getSize:function(e){let t=d.current;return t?.sessionId!==e||t.failed?void 0:t.displayedSize},preview:(0,n.jsxs)("g",{ref:o,visibility:"hidden",pointerEvents:"none","aria-hidden":"true","data-session-preview-drag":!0,children:[(0,n.jsx)("image",{ref:l,opacity:.5,visibility:"hidden",preserveAspectRatio:"xMidYMid meet"}),(0,n.jsx)("g",{ref:s,visibility:"hidden","data-session-preview-drag-error":!0,children:(0,n.jsx)("foreignObject",{x:-12,y:-12,width:24,height:24,children:(0,n.jsx)(tE.A,{style:{display:"block",fontSize:24,color:"var(--yisiui-color-feedback-error)"}})})})]})}}(w&&d?c:void 0,`${p}:${v}`,!!(w&&d),eh.frame),tL=tu.map(iE),tA=eh.groups.filter(e=>e.itemIds.some(e=>tL.includes(e))),tT=!!w&&1===tL.length&&0===tA.length&&eh.images.some(e=>e.id===tL[0]&&e.assetId&&!e.previewReference),tF=1===tA.length&&tL.every(e=>tA[0].itemIds.includes(e)),tD=tL.length>=2&&!eh.groups.some(e=>e.itemIds.length===tL.length&&e.itemIds.every(e=>tL.includes(e)));function t_(e){if(!w)return;let t=eg.current,i=t===b?eh:tK(t,v);tz(tQ(t,v,"function"==typeof e?e(i):e))}function tz(e){w&&(eg.current=e,w(e))}function tB(e){t3(),eB(!1),ew(t=>t===e?null:e)}function tq(e,t,i){let n=i$("image");t_(a=>(0,tP.EY)(a,e,n,t,i)),eC([iT("image",n)])}async function tU(e,t,i){if(!d)return;let n=ef.current,a={width:eh.frame.width,height:eh.frame.height};ew(null);try{let r=await d(e);if(ef.current===n){let e=(0,tP.QO)(i??r,a);ey.current(r,t,e)}}catch{ef.current===n&&eH({type:"error",message:s})}}function tH({bounds:e}){var t,i;"rectangle"===ev&&(t=e,t_(e=>{let i={id:i$("rectangle"),x:Math.round(t.x),y:Math.round(t.y),width:Math.round(t.width),height:Math.round(t.height),note:"",annotation:"",semanticType:"",origin:"user",visible:!0,weight:"auto"};return eC([iT("rectangle",i.id)]),{...e,rectangles:[...e.rectangles,i]}})),"image"===ev&&tG(e),"text"===ev&&(i=e,t_(e=>{let t={id:i$("text"),x:Math.round(i.x),y:Math.round(i.y),text:el.newText,fontSize:14,note:"",annotation:"",semanticType:"",origin:"user",visible:!0,weight:"auto"};return eC([iT("text",t.id)]),eF(iT("text",t.id)),eD({kind:"text",item:t}),{...e,texts:[...e.texts,t]}})),ew(null),te.current=!0,window.setTimeout(()=>{te.current=!1},0)}function tG(e,t=null){t_(i=>{let n={id:i$("image"),x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height),note:"",annotation:"",semanticType:"",origin:"user",visible:!0,weight:"auto",assetId:t,crop:null};return eC([iT("image",n.id)]),{...i,images:[...i.images,n]}})}function tJ(e){return{annotation:e.annotation,displayText:"text"in e?e.text:void 0,note:e.note,labels:{nodeDescription:el.nodeDescription,displayText:el.textContent,note:el.note}}}function tV(e){if(!(e.target instanceof Element))return;let t=e.target.closest("[data-ui-sketch-item]"),i=t?.dataset.uiSketchItem;i&&iF(i)&&!tm.has(i)?eC(iD(eh,[i])):e.target.closest("[data-canvas-frame]")&&eC([iS]),e0(e,t??e9.current?.querySelector("[data-ui-sketch-scene]")??null)}function tX(e){if(!w)return;let t=(e.token===tn.current?ta.current:0)+1,i=function(e,t,i,n=tW){if(0===t.layerOrder.length)return{draft:e,ids:[]};let a=tK(e,n),r=new Set([...a.rectangles,...a.texts,...a.images,...a.groups,...t.rectangles,...t.texts,...t.images,...t.groups].map(e=>e.id)),o=new Map;function s(e){let t=1;for(;r.has(`${e}-${t}`);)t+=1;let i=`${e}-${t}`;return r.add(i),i}function l(e,t){return e.map(e=>{let n=s(t);return o.set(e.id,n),{...structuredClone(e),id:n,origin:"user",x:e.x+i.x,y:e.y+i.y}})}a.rectangles.push(...l(t.rectangles,"rectangle")),a.texts.push(...l(t.texts,"text")),a.images.push(...l(t.images,"image")),a.groups.push(...t.groups.map(e=>({id:s("group"),itemIds:e.itemIds.map(e=>o.get(e))})));let d=t.layerOrder.map(e=>o.get(e));return a.layerOrder=[...(0,tw.G)(e),...d],{draft:tQ(e,n,a),ids:d}}(eg.current,e.items,{x:24*t,y:24*t},v);if(0===i.ids.length)return;tn.current=e.token,ta.current=t,t3(),ew(null),tz(i.draft);let n=new Set(i.ids);eC([...i.draft.rectangles.filter(e=>n.has(e.id)).map(e=>iT("rectangle",e.id)),...i.draft.texts.filter(e=>n.has(e.id)).map(e=>iT("text",e.id)),...i.draft.images.filter(e=>n.has(e.id)).map(e=>iT("image",e.id))])}function tZ(e){w&&0!==e.length&&(t_(t=>{var i,n;let a,r;return i=t,a=new Set(n=e),r=new Set(n.map(iE)),{...i,groups:(0,tv.Im)(i.groups,[...i.rectangles,...i.texts,...i.images].filter(e=>!r.has(e.id)).map(e=>e.id)),rectangles:i.rectangles.filter(e=>!a.has(iT("rectangle",e.id))),images:i.images.filter(e=>!a.has(iT("image",e.id))),texts:i.texts.filter(e=>!a.has(iT("text",e.id)))}}),eC([]),eF(null),eD(null))}(0,a.useEffect)(()=>{if(!eU)return;let e=window.setTimeout(()=>eH(null),2e3);return()=>window.clearTimeout(e)},[eU]),(0,a.useEffect)(()=>{td||eK(null)},[td]),(0,a.useLayoutEffect)(()=>{if(void 0===p)return;let e=e6.current;e?.type==="move-items"&&iH(e),e6.current=null,eC([]),eF(null),eD(null),ew(null),eB(!1),eO(null),e2()},[p]),(0,a.useLayoutEffect)(()=>{ew(null),e2()},[v,T]),(0,a.useLayoutEffect)(()=>{eC(e=>{let t=e.filter(iF).filter(e=>i_(tl,e)),i=[...e.filter(e=>e===iS),...iD(eh,t)];return e.length===i.length&&e.every((e,t)=>e===i[t])?e:i}),e$&&!i_(tl,e$)&&(eF(null),eD(null))},[tl,eh,e$]),(0,a.useLayoutEffect)(()=>()=>{let e=e6.current;e?.type==="move-items"&&(iH(e),e6.current=null)},[v,T]);function t0(e,t){t_(i=>({...i,rectangles:i.rectangles.map(i=>i.id===e?{...i,...t}:i)}))}function t1(e,t){t_(i=>({...i,texts:i.texts.map(i=>i.id===e?{...i,...t}:i)}))}function t2(e,t){t_(i=>({...i,images:i.images.map(i=>i.id===e?{...i,...t}:i)}))}function t3(){eF(null),eD(null)}function t5(e){eE&&(eD(t=>t?("rectangle"===t.kind||t.kind,{...t,item:{...t.item,...e}}):null),"rectangle"===eE.kind?t0(eE.item.id,e):"text"===eE.kind?t1(eE.item.id,e):t2(eE.item.id,e))}function t8(e){eE?.kind==="text"&&(eD(t=>t?.kind==="text"?{...t,item:{...t.item,...e}}:t),t1(eE.item.id,e))}function t4(e){if(!(e.target instanceof Element)||0!==e.button||e.target.closest("[data-resize-handle]")||e.target.closest("[data-canvas-frame]"))return;te.current=!1,tt.current=!1;let t=iJ(e,e.currentTarget),i=e.target.closest("[data-ui-sketch-item]"),n=i?.dataset.uiSketchItem;if(n&&iF(n)&&i_(eh,n)){if(!w)return;let i=tm.has(n)?tu:iD(eh,[n]),a=new Set(i.map(iE)),r=new Set(eh.groups.filter(e=>e.itemIds.every(e=>a.has(e))).map(e=>e.id));e6.current={type:"move-items",pointerId:e.pointerId,keys:i,scene:e.currentTarget,previewElements:Array.from(e.currentTarget.querySelectorAll("[data-ui-sketch-preview], [data-ui-sketch-multi-selection], [data-ui-sketch-group-outline]")).filter(e=>i.includes(e.dataset.uiSketchPreview)||i.length>1&&e.hasAttribute("data-ui-sketch-multi-selection")||r.has(e.dataset.uiSketchGroupOutline??"")),delta:{x:0,y:0},animationFrame:null,start:t,startClient:{x:e.clientX,y:e.clientY},moved:!1}}else e6.current={type:"marquee",pointerId:e.pointerId,start:t,startClient:{x:e.clientX,y:e.clientY},moved:!1,sourceSelectedKeys:tu,additive:e.shiftKey},t3()}function t9(e){let t=e6.current;if(!t||t.pointerId!==e.pointerId)return;let i=iJ(e,e.currentTarget);if("marquee"===t.type){if(!t.moved&&3>Math.hypot(e.clientX-t.startClient.x,e.clientY-t.startClient.y))return;t.moved||(t.moved=!0,iV(e.currentTarget,e.pointerId)),e.preventDefault(),te.current=!0,eO(iW(t.start,i));return}!t.moved&&3>Math.hypot(e.clientX-t.startClient.x,e.clientY-t.startClient.y)||(t.moved||(t.moved=!0,e.currentTarget.setAttribute("data-canvas-dragging","node"),iV(e.currentTarget,e.pointerId)),e.preventDefault(),te.current=!0,tt.current=!0,t.delta={x:Math.round(i.x-t.start.x),y:Math.round(i.y-t.start.y)},null===t.animationFrame&&(t.animationFrame=requestAnimationFrame(()=>{t.animationFrame=null;let e=`translate(${t.delta.x} ${t.delta.y})`;t.previewElements.forEach(t=>t.setAttribute("transform",e))})))}function ie(e){let t=e6.current;if(t&&t.pointerId===e.pointerId){if("marquee"===t.type){var i,n,a;let r=t.moved?iD(eh,(i=tl,n=iW(t.start,iJ(e,e.currentTarget)),a=e3,[...i.images.map(e=>iT("image",e.id)),...i.rectangles.map(e=>iT("rectangle",e.id)),...i.texts.map(e=>iT("text",e.id))].filter(e=>{var t,r;let o=iz(i,e,a);return!!o&&(t=o,r=n,t.x<=r.x+r.width&&t.x+t.width>=r.x&&t.y<=r.y+r.height&&t.y+t.height>=r.y)}))):[];eC(0===r.length?[]:t.additive?iY(t.sourceSelectedKeys,r):r),eO(null)}else if(iH(t),t.moved){let i=iJ(e,e.currentTarget),n={x:Math.round(i.x-t.start.x),y:Math.round(i.y-t.start.y)};(0!==n.x||0!==n.y)&&t_(e=>iG(e,t.keys,n))}e6.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),window.setTimeout(()=>{te.current=!1,tt.current=!1},0)}}function ia(e){let t=e6.current;t&&t.pointerId===e.pointerId&&("move-items"===t.type&&iH(t),e6.current=null,eO(null),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))}async function ir(e){if(j)await j(e);else{if(!navigator.clipboard?.writeText)throw Error(el.promptUnsupported);await navigator.clipboard.writeText(e)}eH({type:"success",message:el.promptCopied})}async function is(e){let t=tK(b,e);eH("downloaded"===(S?await S(tY(t)):await ij(t,H))?{type:"warning",message:el.sketchDownloaded}:{type:"success",message:el.sketchCopied})}async function iu(e){let t=await L?.(),i=e=>iB(e,e3);return"all"===e?function(e,t,i,n=t7){let a=tO(e);return 1===a.length?ih(tK(e,a[0].id),t,i,n):a.slice(1).map((r,o)=>{var s,l,d,c,u,m;let h,p,g,f,y,x,b=a[o];return s=e,l=b.id,d=r.id,c=(e,i)=>{let n;return"startState"===e||"endState"===e?t("stateHeading",{name:(n="startState"===e?b:r).name??t("stateName",{number:n.number})}):t(e,i)},u=i,m=n,h=tK(s,l),g=new Map((p=tK(s,d)).rectangles.map(e=>[e.id,e])),f=new Map(p.texts.map(e=>[e.id,e])),y=new Map(p.images.map(e=>[e.id,e])),x=[...h.images.flatMap((e,t)=>{var i,n,a,r,o,s;let l,d,u,g,f=y.get(e.id);return f&&(ip(h,e,m)||ip(p,f,m))?[(i=h,n=p,a=e,r=f,o=t,s=c,l=ib(i,a),d=ib(n,r),u=a.note.trim(),g=ix(l,d,a.visible,r.visible,s),[s("imageNumber",{index:o+1}),...u?[s("note",{note:u})]:[],s("visualWeight",{weight:iw(a.weight,s)}),s("startState"),` - ${s(a.visible?"visible":"hidden")}`,` - ${s("referencePosition",l)}`,` - ${s("referenceSize",l)}`,...g.length?[s("endState"),...g.map(e=>` - ${e}`)]:[]])]:[]}),...h.rectangles.flatMap((e,t)=>{var i,n,a,r,o,s;let l,d,u,f,y=g.get(e.id);return y&&(ip(h,e,m)||ip(p,y,m))?[(i=h,n=p,a=e,r=y,o=t,s=c,l=ib(i,a),d=ib(n,r),u=a.note.trim(),f=ix(l,d,a.visible,r.visible,s),[s("regionNumber",{index:o+1}),...u?[s("note",{note:u})]:[],s("visualWeight",{weight:iw(a.weight,s)}),s("startState"),` - ${s(a.visible?"visible":"hidden")}`,` - ${s("referencePosition",l)}`,` - ${s("referenceSize",l)}`,...f.length?[s("endState"),...f.map(e=>` - ${e}`)]:[]])]:[]}),...h.texts.flatMap((e,t)=>{var i,n,a,r,o,s,l,d,u,g,y;let x,b,v,w,j=f.get(e.id);return j&&(ip(h,e,m)||ip(p,j,m))?[(i=h,n=p,a=e,r=j,o=t,s=c,x=iv(i,a),b=iv(n,r),v=a.note.trim(),w=(l=x,d=b,u=a,g=r,y=s,[...u.visible!==g.visible?[y(g.visible?"changeVisible":"changeHidden")]:[],...l.x!==d.x||l.y!==d.y?[y("referencePosition",d)]:[],...Math.round(u.fontSize)!==Math.round(g.fontSize)?[y("referenceFontSize",{fontSize:Math.max(1,Math.round(g.fontSize))})]:[]]),[s("textNumber",{index:o+1}),s("displayText",{text:JSON.stringify(a.text)}),...v?[s("note",{note:v})]:[],s("visualWeight",{weight:iw(a.weight,s)}),s("startState"),` - ${s(a.visible?"visible":"hidden")}`,` - ${s("referencePosition",x)}`,` - ${s("referenceFontSize",{fontSize:Math.max(1,Math.round(a.fontSize))})}`,...w.length?[s("endState"),...w.map(e=>` - ${e}`)]:[]])]:[]})],[c("motionTitle"),"",c("canvasSize",{width:Math.round(s.frame.width),height:Math.round(s.frame.height)}),"",...ig(x.length>0,c),...iy(s.overallNote,c),...u?.trim()?["",u.trim()]:[],...x.length?["",c("elementsHeading")]:[],...x.flatMap(e=>["",...e]),...x.length?["",c("motionClosing")]:[]].join("\n").trimEnd()}).join("\n\n")}(b,I,t,i):ih(tK(b,e),I,t,i)}async function im(e){eW(!0);try{await ir(await iu(e))}catch(e){eH({type:"error",message:e instanceof Error?e.message:el.promptCopyFailed})}finally{eW(!1)}}async function ik(e){eV(!0);try{await is(e)}catch(e){eH({type:"error",message:e instanceof Error?e.message:el.sketchCopyFailed})}finally{eV(!1)}}let iK=(0,a.useRef)(l()),iX=(0,a.useRef)(l()),iQ=iK.current(tN(eh.rectangles)),iZ=iX.current(tN(ts?.rectangles??[])),i0=o({selectItem:function(e,t){if(tt.current){tt.current=!1;return}eC(t.shiftKey?iY(tu,iD(eh,[e])):iD(eh,[e]))},nudgeItem:function(e,t){let i=tu.length>1&&tm.has(e)?tu:iD(eh,[e]);t_(e=>iG(e,i,t))},resizeImage:function(e,t){t2(e,{x:t.sourcePosition.x+t.bounds.x,y:t.sourcePosition.y+t.bounds.y,width:Math.max(8,t.bounds.width),height:Math.max(8,t.bounds.height)})},resizeRectangle:function(e,t){t0(e,{x:Math.round(t.sourcePosition.x+t.bounds.x),y:Math.round(t.sourcePosition.y+t.bounds.y),width:Math.max(8,Math.round(t.bounds.width)),height:Math.max(8,Math.round(t.bounds.height))})},openEditor:function(e){let t=i_(eh,e);t&&(eF(e),"rectangle"===t.kind?eD({kind:"rectangle",item:{...t.item}}):"text"===t.kind?eD({kind:"text",item:{...t.item}}):eD({kind:"image",item:{...t.item,crop:t.item.crop?{...t.item.crop}:null}}))},deleteItem:function(e){tZ(tu.length>1&&tm.has(e)?tu:iD(eh,[e]))},resizeText:(e,t)=>{let i,n,a=eh.texts.find(t=>t.id===e);a&&(i=function(e,t,i){let{sourceBounds:n,sourcePosition:a}=i;return[e,t,a.x,a.y,n.x,n.y,n.width,n.height].join(":")}(e,a.text,t),e7.current?.signature!==i&&(e7.current={signature:i,fontSize:a.fontSize}),n=t.bounds.width/Math.max(1,t.sourceBounds.width),t1(e,{x:Math.round(t.sourcePosition.x+t.bounds.x),y:Math.round(t.sourcePosition.y+t.bounds.y),fontSize:Math.max(8,Math.round(e7.current.fontSize*n))}))},selectFrame:()=>{eC([iS]),t3()},updateFrame:function(e){t_(t=>({...t,frame:e}))}}),i1=r([iS,...eh.images.map(({id:e})=>iT("image",e)),...eh.rectangles.map(({id:e})=>iT("rectangle",e)),...eh.texts.map(({id:e})=>iT("text",e))],[e8,!!eh.layerOrder,el.image,el.region,el.missingRegionNote,el.text,el.emptyText,el.nodeDescription,el.textContent,el.note,i]),i2=(e,t)=>[e.x,e.y,e.note,e.annotation,e.visible,tm.has(t),!!(tp&&tm.has(t))],i3=(0,n.jsxs)("label",{className:"human2ai-ui-sketch-canvas__overall-editor",children:[(0,n.jsx)("span",{children:el.overallNoteTitle}),(0,n.jsx)(iA,{name:"overallNote",autoFocus:!0,autoSize:{minRows:4,maxRows:8},value:eh.overallNote,placeholder:el.overallNotePlaceholder,"aria-label":el.overallNoteAriaLabel,onChange:e=>t_(t=>({...t,overallNote:e.target.value}))})]}),i5=tr.map(e=>({key:e.id,label:e.name??I("stateName",{number:e.number})})),i8=(0,n.jsxs)("div",{className:"human2ai-ui-sketch-canvas__tool-groups",role:"group","aria-label":el.sideActions,"data-ui-sketch-tool-groups":!0,children:[(0,n.jsxs)("div",{className:"human2ai-ui-sketch-canvas__tool-group","data-ui-sketch-tool-group":"elements",children:[(0,n.jsx)(eT.u,{icon:(0,n.jsx)(tj.A,{"aria-hidden":"true"}),label:el.region,collapsedLabel:el.addRegion,"aria-current":"rectangle"===ev||void 0,textColor:"rectangle"===ev?"color.action.primary":"color.text.primary",disabled:!w,onClick:()=>tB("rectangle")}),(0,n.jsx)(eT.u,{icon:(0,n.jsx)(tk.A,{"aria-hidden":"true"}),label:el.text,collapsedLabel:el.addText,"aria-current":"text"===ev||void 0,textColor:"text"===ev?"color.action.primary":"color.text.primary",disabled:!w,onClick:()=>tB("text")}),(0,n.jsx)(eT.u,{icon:(0,n.jsx)(tS.A,{"aria-hidden":"true"}),label:el.image,collapsedLabel:el.addImage,"aria-current":"image"===ev||void 0,textColor:"image"===ev?"color.action.primary":"color.text.primary",disabled:!w,onClick:()=>tB("image")}),(0,n.jsx)(a.Fragment,{children:m?.(tq)},`session-preview:${v}:${p}`)]}),(0,n.jsx)("div",{className:"human2ai-ui-sketch-canvas__tool-group","data-ui-sketch-tool-group":"overall-note",children:(0,n.jsx)(tC.A,{content:i3,trigger:"click",placement:"leftTop",open:e_,onOpenChange:eB,children:(0,n.jsx)("span",{className:"human2ai-ui-sketch-canvas__side-action",children:(0,n.jsx)(eT.u,{icon:(0,n.jsx)(tI.A,{"aria-hidden":"true"}),label:el.overallNote})})})}),(0,n.jsxs)("div",{className:"human2ai-ui-sketch-canvas__tool-group","data-ui-sketch-tool-group":"copy",children:[(0,n.jsx)("span",{className:"human2ai-ui-sketch-canvas__tool-group-title",children:el.copyGroup}),(0,n.jsx)(io,{readPrompt:()=>iu(v),label:el.promptPreview,loadingLabel:el.promptPreviewLoading,errorLabel:el.promptPreviewFailed,disabled:eG||"prompt"===eY,children:td?(0,n.jsx)(g.A,{trigger:["click"],open:"prompt"===eY,destroyOnHidden:!0,onOpenChange:e=>eK(t=>e?"prompt":"prompt"===t?null:t),menu:{items:[...i5.map(e=>({...e,label:(0,n.jsx)(io,{readPrompt:()=>iu(e.key),label:el.promptPreview,loadingLabel:el.promptPreviewLoading,errorLabel:el.promptPreviewFailed,children:(0,n.jsx)("span",{children:e.label})})})),{type:"divider"},{key:"all",label:(0,n.jsx)(io,{readPrompt:()=>iu("all"),label:el.promptPreview,loadingLabel:el.promptPreviewLoading,errorLabel:el.promptPreviewFailed,children:(0,n.jsx)("span",{children:el.copyAllStages})})}],onClick:({key:e})=>{eK(null),im(e)}},children:(0,n.jsx)("span",{className:"human2ai-ui-sketch-canvas__side-action",children:(0,n.jsx)(eT.u,{icon:(0,n.jsx)(es.A,{"aria-hidden":"true"}),label:el.copyPrompt,loading:eG})})}):(0,n.jsx)("span",{className:"human2ai-ui-sketch-canvas__side-action",children:(0,n.jsx)(eT.u,{icon:(0,n.jsx)(es.A,{"aria-hidden":"true"}),label:el.copyPrompt,loading:eG,onClick:()=>void im(tr[0].id)})})}),(0,n.jsx)(il,{renderSvg:ep,label:el.previewImage,disabled:eJ||"sketch"===eY,children:td?(0,n.jsx)(g.A,{trigger:["click"],open:"sketch"===eY,destroyOnHidden:!0,onOpenChange:e=>eK(t=>e?"sketch":"sketch"===t?null:t),menu:{items:i5,onClick:({key:e})=>{eK(null),ik(e)}},children:(0,n.jsx)("span",{className:"human2ai-ui-sketch-canvas__side-action",children:(0,n.jsx)(eT.u,{icon:(0,n.jsx)(tS.A,{"aria-hidden":"true"}),label:el.copySketch,loading:eJ})})}):(0,n.jsx)("span",{className:"human2ai-ui-sketch-canvas__side-action",children:(0,n.jsx)(eT.u,{icon:(0,n.jsx)(tS.A,{"aria-hidden":"true"}),label:el.copySketch,loading:eJ,onClick:()=>void ik(tr[0].id)})})})]})]}),i4=eE?(0,n.jsxs)("div",{className:"human2ai-canvas-node-editor__title",children:[(0,n.jsxs)("span",{className:"human2ai-canvas-node-editor__heading",children:[(0,n.jsx)("span",{className:"human2ai-canvas-node-editor__origin","data-ui-sketch-origin":eE.item.origin,children:(er=eE.item.origin,eo=el,"agent"===er?eo.originAgent:"import"===er?eo.originImport:eo.originUser)}),(0,n.jsx)("span",{children:"rectangle"===eE.kind?el.editRegionNote:"text"===eE.kind?el.editText:eE.item.previewReference?i??el.image:el.image})]}),(0,n.jsx)(f.A,{checked:eE.item.visible,checkedChildren:el.visible,unCheckedChildren:el.hidden,"aria-label":el.visibility,onChange:e=>t5({visible:e})})]}):null,i6=eE?(0,n.jsxs)("div",{className:"human2ai-ui-sketch-canvas__editor-primary-fields",children:[eE.item.annotation.trim()?(0,n.jsx)(C,{label:el.nodeDescription,hint:(0,n.jsx)(_.A,{title:el.nodeDescriptionHelp,trigger:["hover","focus"],children:(0,n.jsx)(ed.J,{className:"human2ai-canvas-node-editor__field-help",mode:"icon-only",size:"small",type:"text",backgroundColor:"none",icon:(0,n.jsx)(eI.A,{"aria-hidden":"true"}),iconLabel:el.nodeDescriptionHelp})}),children:(0,n.jsx)("p",{className:"human2ai-ui-sketch-canvas__node-description","data-ui-sketch-node-description":!0,children:eE.item.annotation})}):null,"text"===eE.kind?(0,n.jsx)(C,{label:el.textContent,children:(0,n.jsx)(iL,{autoFocus:!0,name:"textContent",value:eE.item.text,placeholder:el.textPlaceholder,"aria-label":el.textContent,onChange:e=>t8({text:e.target.value})})}):null,(0,n.jsx)(C,{label:el.note,hint:(0,n.jsx)(_.A,{title:el.noteHelp,trigger:["hover","focus"],children:(0,n.jsx)(ed.J,{className:"human2ai-canvas-node-editor__field-help",mode:"icon-only",size:"small",type:"text",backgroundColor:"none",icon:(0,n.jsx)(eI.A,{"aria-hidden":"true"}),iconLabel:el.noteHelp})}),children:(0,n.jsx)(iM,{autoFocus:"text"!==eE.kind,name:"nodeNote",value:eE.item.note,placeholder:"rectangle"===eE.kind?el.regionPlaceholder:"text"===eE.kind?el.textNotePlaceholder:el.imageNotePlaceholder,"aria-label":el.note,onChange:e=>t5({note:e.target.value})})}),(0,n.jsxs)("div",{className:"human2ai-ui-sketch-canvas__editor-properties",children:[(0,n.jsx)(C,{label:el.visualWeight,children:(0,n.jsx)(y.A,{className:"human2ai-ui-sketch-canvas__visual-weight-select",value:eE.item.weight,options:tc,"aria-label":el.visualWeight,onChange:e=>t5({weight:e})})}),"text"===eE.kind?(0,n.jsxs)("div",{className:"human2ai-ui-sketch-canvas__editor-field",children:[(0,n.jsx)("span",{id:em,className:"human2ai-ui-sketch-canvas__editor-field-label",children:el.fontSize}),(0,n.jsxs)("div",{className:"human2ai-ui-sketch-canvas__font-size-control",role:"group","aria-labelledby":em,children:[(0,n.jsx)(ed.J,{mode:"icon-only",size:"small",icon:(0,n.jsx)(eA.A,{"aria-hidden":"true"}),iconLabel:el.decreaseFontSize,disabled:eE.item.fontSize<=8,onClick:()=>t8({fontSize:Math.max(8,Math.round(eE.item.fontSize)-1)})}),(0,n.jsxs)("output",{"aria-live":"polite",children:[Math.round(eE.item.fontSize),"px"]}),(0,n.jsx)(ed.J,{mode:"icon-only",size:"small",icon:(0,n.jsx)(eM.A,{"aria-hidden":"true"}),iconLabel:el.increaseFontSize,onClick:()=>t8({fontSize:Math.round(eE.item.fontSize)+1})})]})]}):null]})]}):null,i9=eE?.kind==="image"&&tg?.kind==="image"?(0,n.jsx)(eu,{src:"image"===tg.kind&&tg.item.assetId?H?.(tg.item.assetId):void 0,crop:eE.item.crop,aspectRatio:eE.item.width/eE.item.height,labels:ec,onReadFile:eE.item.previewReference?void 0:W,disabled:!w||!G,sourceLocked:!!eE.item.previewReference,renderLayout:tg.item.previewReference&&h?(e,t)=>h({image:tg.item,title:i4,actions:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{hidden:!0,"data-ui-sketch-mark-editor":!0,"data-human2ai-auto-save-node-editor":!0}),i6]}),deleteAction:(0,n.jsx)(k.x,{type:"text",size:"small",icon:(0,n.jsx)(x.A,{"aria-hidden":"true"}),title:el.confirmDeleteNode,confirmLabel:el.deleteNode,cancelLabel:el.cancelDelete,onConfirm:()=>tZ([`image:${tg.item.id}`]),children:el.deleteNode}),preview:t,onCancel:t3,onReplace:e=>{let t=tf.current;t.interactionResetKey===p&&(t.updateImage(tg.item.id,{assetId:e.assetId,previewReference:e.reference}),eD(t=>t?.kind==="image"&&t.item.id===tg.item.id?{...t,item:{...t.item,assetId:e.assetId,previewReference:e.reference}}:t))},onSnapshot:()=>{let e=i$("image");t_(t=>{let i=t.images.find(e=>e.id===tg.item.id);if(!i)return t;let{previewReference:n,...a}=i;return{...t,images:[...t.images,{...a,id:e,x:i.x+24,y:i.y+24}],layerOrder:[...(0,tw.G)(t),e]}})}}):void 0,onUpload:async e=>{if(!G)return;let t=await G(e),i=tf.current;i.interactionResetKey===p&&(eD(e=>e?.kind==="image"&&e.item.id===eE.item.id?{...e,item:{...e.item,assetId:t,crop:null}}:e),i.updateImage(eE.item.id,{assetId:t,crop:null}))},onCropChange:(e,t)=>{eD(i=>i?.kind==="image"?{...i,item:{...i.item,crop:e,y:i.item.y+(i.item.height-i.item.width/t)/2,height:i.item.width/t}}:i),tz(function(e,t,i,n){if(!Number.isFinite(n)||n<=0)throw Error("Image aspect ratio must be greater than zero.");i&&t6(i);let a=tY(e),r=a.images.find(e=>e.id===t);if(!r)throw Error(`Unknown UI sketch image: ${t}.`);r.crop=i?{...i}:null;let o=r.width/n;return r.y+=(r.height-o)/2,r.height=o,a.stages.forEach(e=>{let i=e.images.find(e=>e.id===t);if(!i)return;let a=i.width/n;i.y+=(i.height-a)/2,i.height=a}),a}(eg.current,eE.item.id,e,t))}},eE.item.previewReference?`${v}:${p}:${eE.item.id}`:eE.item.id):null,i7=["human2ai-ui-sketch-canvas",Y].filter(Boolean).join(" ");return(0,n.jsxs)("main",{...(0,$.Se)({namespace:"human2ai",id:"ui-sketch-canvas",name:"UiSketchCanvas",category:"module",origin:"project",status:"candidate"}),className:i7,style:Z,"data-ui-sketch-canvas":!0,"aria-label":ee??el.canvas,children:[ty.feedback,eU?(0,n.jsx)("div",{className:`human2ai-ui-sketch-canvas__notice human2ai-ui-sketch-canvas__notice--${eU.type}`,role:"status",children:eU.message}):null,(0,n.jsxs)("div",{ref:e9,className:"human2ai-ui-sketch-canvas__workspace",children:[(0,n.jsx)(g.A,{trigger:[],autoFocus:!0,open:eX,popupRender:e=>(0,n.jsx)("div",{ref:eZ,children:e}),onOpenChange:e=>{e||e1()},menu:{items:[...M.JX.map(e=>({key:e,label:el[e],disabled:!w||(0,tw.o)(eh,tL,e)===eh})),{type:"divider"},...e&&t?[{key:"split-png",label:(0,n.jsx)("span",{"data-png-split-action":!0,children:t.action}),disabled:!!eP||!tT},{type:"divider"}]:[],{key:"group",label:el.groupItems,disabled:!w||!tD},{key:"ungroup",label:el.ungroupItems,disabled:!w||0===tA.length},{type:"divider"},{key:"delete",label:el.deleteSelection,danger:!0,disabled:!w||0===tu.length}],onClick:({key:e})=>{let t=M.JX.find(t=>t===e);t?t_(e=>(0,tw.o)(e,tL,t)):"group"===e&&tD?t_(e=>(0,tv.OT)(e,tL,i$("group"))):"ungroup"===e&&tA.length>0?t_(e=>(0,tv.pu)(e,tL)):"delete"===e?tZ(iD(eh,tu)):"split-png"===e&&tT&&!eP&&eL({images:eh.images.filter(e=>e.id===tL[0]),mode:"settings"}),e1()}},children:(0,n.jsx)("span",{"aria-hidden":"true",style:{position:"fixed",left:eQ.x,top:eQ.y,width:1,height:1,pointerEvents:"none"}})}),eP&&e?.({...eP,options:eN,onSplit:e=>{eR(e),eL(e=>e?{...e,mode:"split"}:null),eH({type:"info",message:t.running})},onCancel:()=>eL(null),onError:(e,t)=>{eH({type:"error",message:e}),eL(e=>t&&e?{...e,mode:"settings"}:null)},onApply:e=>{var i;let n=eg.current;if(e.sources.some(e=>!n.images.some(t=>t.id===e.nodeId&&t.assetId===e.assetId)))throw Error("PNG source changed during splitting.");let a=e9.current?.querySelector("[data-ui-sketch-scene]"),r=a?.createSVGPoint(),o=a?.getScreenCTM(),s=(tb((i=eh.frame)&&[i.x,i.y,i.width,i.height].every(Number.isFinite),"Missing interface frame"),{x:i.x+i.width+24,y:i.y});if(r&&o){let e=e9.current.getBoundingClientRect();r.x=e.left+e.width/2,r.y=e.top+e.height/2;let t=r.matrixTransform(o.inverse());s={x:Math.round(t.x),y:Math.round(t.y)}}let l=function(e,t,i){let n=t.sources.filter(i=>{var n;return n=t.options,!e.pngSplits?.some(e=>e.options.alphaThreshold===n.alphaThreshold&&e.options.minSize===n.minSize&&e.sources.some(e=>e.nodeId===i.nodeId&&e.assetId===i.assetId&&JSON.stringify(e.regions??[])===JSON.stringify(i.regions??[])))});if(!n.length)return e;let a=new Set(n.map(e=>e.nodeId)),r=t.pieces.filter(e=>a.has(e.sourceNodeId)),o=new Set([...e.rectangles,...e.texts,...e.images,...e.groups].map(e=>e.id)),s=function(e,t,i,n=12){let a;if(tb(Number.isFinite(t)&&Number.isFinite(i),"Start coordinates must be finite numbers"),tb(Number.isFinite(n)&&n>=0,"Invalid image gap"),!e.length)return{geometry:[],bounds:{x:t,y:i,width:0,height:0},gap:n};let r=e.map((e,t)=>(tb(Number.isFinite(e.width)&&e.width>0&&Number.isFinite(e.height)&&e.height>0,"Invalid piece dimensions"),{index:t,width:e.width,height:e.height})).sort((e,t)=>Math.max(t.width,t.height)-Math.max(e.width,e.height)||t.width*t.height-e.width*e.height||e.index-t.index),o=r.reduce((e,t)=>e+(t.width+n)*(t.height+n),0),s=Math.max(...r.map(e=>e.width+n));for(let e of[...new Set([.8,1,1.2,1.5].map(e=>Math.max(s,Math.ceil(Math.sqrt(o)*e))))]){let t=function(e,t,i){let n=[{x:0,y:0,width:t}],a=[];for(let r of e){let e,o=r.width+i,s=r.height+i;for(let i=0;i<n.length;i++){let a=n[i].x;if(a+o>t)continue;let r=o,l=0;for(let e=i;r>0&&e<n.length;e++)l=Math.max(l,n[e].y),r-=n[e].width;!(r>0)&&(!e||l+s<e.top||l+s===e.top&&a<e.x)&&(e={index:i,x:a,y:l,top:l+s})}tb(e,"PNG rectangle cannot fit the packing width"),n.splice(e.index,0,{x:e.x,y:e.top,width:o});for(let t=e.index+1;t<n.length;t++){let i=e.x+o-n[t].x;if(i<=0)break;if(i<n[t].width){n[t].x+=i,n[t].width-=i;break}n.splice(t--,1)}for(let e=1;e<n.length;e++)n[e-1].y===n[e].y&&(n[e-1].width+=n[e].width,n.splice(e--,1));a[r.index]={x:e.x,y:e.y,width:r.width,height:r.height}}let r={width:Math.max(...a.map(e=>e.x+e.width)),height:Math.max(...a.map(e=>e.y+e.height))};return{positions:a,bounds:r}}(r,e,n),{width:i,height:o}=t.bounds,s=i*o+.25*(i-o)**2;(!a||s<a.score)&&(a={...t,score:s})}return tb(a,"Missing PNG packing"),{geometry:a.positions.map(e=>({...e,x:t+e.x,y:i+e.y})),bounds:{x:t,y:i,...a.bounds},gap:n}}(r,i.x,i.y,t.options.gap),l=r.map((e,t)=>{if(!e.assetId||o.has(e.nodeId))throw Error("Invalid PNG slice asset or node identity.");return o.add(e.nodeId),{id:e.nodeId,assetId:e.assetId,...s.geometry[t],crop:null,note:"",annotation:"",semanticType:"",origin:"import",visible:!0,weight:"auto"}}),d=l.length>=2?t.groupId:null;if(l.length>=2&&!d)throw Error("Missing PNG slice group identity.");let c={...e,images:[...e.images,...l],layerOrder:[...(0,tw.G)(e),...l.map(e=>e.id)],stages:e.stages.map(e=>({...e,images:[...e.images,...l.map(({id:e,x:t,y:i,width:n,height:a,visible:r})=>({id:e,x:t,y:i,width:n,height:a,visible:r}))]})),pngSplits:[...e.pngSplits??[],{...t,sources:n,pieces:r,groupId:d}]};return d?(0,tv.OT)(c,l.map(e=>e.id),d):c}(n,e,s);if(l!==n){tz(l);let i=l.images.filter(e=>!n.images.some(t=>t.id===e.id));eC(i.map(e=>iT("image",e.id))),eH({type:"success",message:t.complete(i.length,e.sources.reduce((e,t)=>e+t.discarded,0))})}else eH({type:"success",message:t.alreadySplit});eL(null)}}),(0,n.jsx)(ez,{onContextMenuRequest:tV,onCameraCenterChange:()=>e2(),onZoomChange:()=>e2(),defaultCameraCenter:{x:eh.frame.x+eh.frame.width/2,y:eh.frame.y+eh.frame.height/2},contentBounds:eh.frame,backgroundPattern:"dots",sideActionPanelWidth:180,sideActionPanelDefaultCollapsed:D,sideActions:E?i8:void 0,"aria-label":el.canvasViewport,labels:{fitAll:el.fitFrame,interactionHelp:el.interactionHelp,sideActions:el.sideActions,collapseSideActions:el.collapseSideActions,expandSideActions:el.expandSideActions},children:e=>(0,n.jsxs)(eb,{ref:ty.sceneRef,bounds:e.viewportBounds,className:"human2ai-ui-sketch-canvas__scene","aria-label":el.scene,"aria-keyshortcuts":w?"Control+C Meta+C Control+V Meta+V Delete Backspace":void 0,"data-ui-sketch-scene":!0,onDragOver:e=>{e.dataTransfer.types.includes(tR)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=tx.show(e)?"copy":"none")},onDragLeave:e=>{let t=e.relatedTarget instanceof Node?e.relatedTarget:document.elementFromPoint(e.clientX,e.clientY);t&&e.currentTarget.contains(t)||tx.clear()},onDrop:e=>{let t=e.dataTransfer.getData(tR);if(!t)return;e.preventDefault(),e.stopPropagation();let i=tx.canDrop(t),n=tx.getSize(t);if(tx.clear(),!i||!w||!d)return;let a=e.currentTarget,r=a.getScreenCTM();if(!r)return;let o=a.createSVGPoint();o.x=e.clientX,o.y=e.clientY;let s=o.matrixTransform(r.inverse());tU(t,{x:s.x,y:s.y},n)},tabIndex:-1,onPointerDownCapture:e=>e.currentTarget.focus(),onKeyDown:e=>{if(("Delete"===e.key||"Backspace"===e.key)&&w&&tu.length>0&&!e.nativeEvent.isComposing&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&!(e.target instanceof Element&&e.target.closest('input, textarea, [contenteditable="true"], [role="textbox"]'))){e.preventDefault(),e.stopPropagation(),tZ(iD(eh,tu));return}("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key)&&(e.preventDefault(),tV({target:e.target,clientX:e.target.getBoundingClientRect().x,clientY:e.target.getBoundingClientRect().y})),"Escape"===e.key&&e1()},onClickCapture:e=>{te.current&&(e.stopPropagation(),te.current=!1)},onClick:e=>{if(te.current){te.current=!1;return}e.target instanceof Element&&(e.target.closest("[data-ui-sketch-item]")||e.target.closest("[data-canvas-frame]")||e.target.closest("[data-resize-handle]"))||(eC([]),t3())},onPointerDown:t4,onPointerMove:t9,onPointerUp:ie,onPointerCancel:ia,onLostPointerCapture:ia,children:[(0,n.jsx)("rect",{className:"human2ai-ui-sketch-canvas__world-surface",x:e.viewportBounds.x,y:e.viewportBounds.y,width:e.viewportBounds.width,height:e.viewportBounds.height,"aria-hidden":"true"}),i1(iS,e.zoom,[eh.frame.x,eh.frame.y,eh.frame.width,eh.frame.height,ek.includes(iS),B,el.frameAction,el.frameRange,v,p],()=>(0,n.jsx)(V,{controlsHost:eh.layerOrder?e8:void 0,id:"ui-frame",label:el.frameAction,name:el.frameRange,interactionResetKey:`${v}:${p??""}`,bounds:eh.frame,selected:ek.includes(iS),screenScale:e.zoom,locked:B,onSelect:i0.selectFrame,onBoundsChange:i0.updateFrame,className:"human2ai-ui-sketch-canvas__frame"})),ts?(0,n.jsx)(eS,{stateId:to,children:(0,M.jQ)([...ts.images.filter(e=>e.visible).map(e=>{let t=iq(e),i=e.assetId?H?.(e.assetId):void 0;return(0,n.jsx)("g",{transform:`translate(${t.x} ${t.y})`,children:(0,n.jsx)(K,{src:i,alt:e.note||el.image,width:e.width,height:e.height,fit:"cover",crop:e.crop,status:i?"ready":"empty",emptyLabel:el.image})},e.id)}),...ts.rectangles.map(e=>{if(!e.visible)return null;let t=iq(e);return(0,n.jsx)("g",{transform:`translate(${t.x} ${t.y})`,className:`human2ai-ui-sketch-canvas__rectangle--tone-${u(e.id)}`,children:(0,n.jsx)(J,{type:"rectangle",width:e.width,height:e.height,className:"human2ai-ui-sketch-canvas__rectangle-surface",innerStroke:iZ.has(e.id)})},e.id)}),...ts.texts.filter(e=>e.visible).map(e=>(0,n.jsx)("g",{transform:`translate(${e.x} ${e.y})`,children:(0,n.jsx)(id,{text:e.text||el.emptyText,fontSize:e.fontSize,baseline:tM(e.fontSize),lineHeight:1.4,className:["human2ai-ui-sketch-canvas__text-content",0===e.text.length?"human2ai-ui-sketch-canvas__text-content--empty":null].filter(Boolean).join(" ")})},e.id))].filter(e=>null!==e),ts.layerOrder,e=>String(e.key))}):null,(0,M.jQ)([...eh.images.map(t=>{if(!T&&!t.visible)return null;let a=iT("image",t.id),r=tm.has(a),o=iq(t),s=t.assetId?H?.(t.assetId):void 0,l=t.previewReference?i??el.image:el.image;return i1(a,r?e.zoom:1,[...i2(t,a),t.width,t.height,s,l,!!t.previewReference,t.crop?.x,t.crop?.y,t.crop?.width,t.crop?.height],()=>(0,n.jsx)("g",{"data-ui-sketch-preview":a,children:(0,n.jsx)(q,{controlsHost:eh.layerOrder?e8:void 0,id:t.id,label:`${l}:${t.note.trim()||l}`,tooltip:tJ(t),x:o.x,y:o.y,selected:r,bounds:tp&&r?void 0:iO(t.width,t.height),resizeMode:"proportional",resizeCenter:{x:0,y:0},screenScale:e.zoom,minimumWidth:8,minimumHeight:8,showRotationHandle:!1,onSelect:(e,t)=>i0.selectItem(a,t),onNudge:e=>i0.nudgeItem(a,e),onResize:e=>i0.resizeImage(t.id,e),onDoubleClick:()=>i0.openEditor(a),onDelete:()=>i0.deleteItem(a),className:"human2ai-ui-sketch-canvas__item human2ai-ui-sketch-canvas__image","data-ui-sketch-item":a,"data-ui-sketch-kind":"image","data-ui-sketch-visible":t.visible,children:(0,n.jsx)(K,{retainPreviousSource:!!t.previewReference,src:s,alt:t.note||el.image,width:t.width,height:t.height,fit:"cover",crop:t.crop,status:s?"ready":"empty",emptyLabel:el.image})})},t.id))}),...eh.rectangles.map(t=>{if(!T&&!t.visible)return null;let i=iT("rectangle",t.id),a=tm.has(i),r=iq(t);return i1(i,a?e.zoom:1,[...i2(t,i),t.width,t.height,iQ.has(t.id)],()=>(0,n.jsx)("g",{"data-ui-sketch-preview":i,children:(0,n.jsx)(q,{controlsHost:eh.layerOrder?e8:void 0,id:t.id,label:`${el.region}:${t.note.trim()||el.missingRegionNote}`,tooltip:tJ(t),x:r.x,y:r.y,selected:a,bounds:tp&&a?void 0:iO(t.width,t.height),resizeMode:"free",resizeCenter:{x:0,y:0},screenScale:e.zoom,minimumWidth:8,minimumHeight:8,showRotationHandle:!1,onSelect:(e,t)=>i0.selectItem(i,t),onNudge:e=>i0.nudgeItem(i,e),onResize:e=>i0.resizeRectangle(t.id,e),onDoubleClick:()=>i0.openEditor(i),onDelete:()=>i0.deleteItem(i),className:`human2ai-ui-sketch-canvas__item human2ai-ui-sketch-canvas__rectangle human2ai-ui-sketch-canvas__rectangle--tone-${u(t.id)}`,"data-ui-sketch-item":i,"data-ui-sketch-kind":"rectangle","data-ui-sketch-visible":t.visible,children:(0,n.jsx)(J,{type:"rectangle",width:t.width,height:t.height,className:"human2ai-ui-sketch-canvas__rectangle-surface",innerStroke:iQ.has(t.id)})})},t.id))}),...eh.texts.map(t=>{if(!T&&!t.visible)return null;let i=iT("text",t.id),a=tm.has(i),r=iB(t,e3),o=iq(r),s=0===t.text.length,l=s?el.emptyText:t.text;return i1(i,a?e.zoom:1,[...i2(t,i),t.text,t.fontSize,r.width,r.height],()=>(0,n.jsx)("g",{"data-ui-sketch-preview":i,children:(0,n.jsx)(q,{controlsHost:eh.layerOrder?e8:void 0,id:t.id,label:`${el.text}:${l}`,tooltip:tJ(t),x:o.x,y:o.y,selected:a,bounds:tp&&a?void 0:iO(r.width,r.height),resizeMode:"font-size",resizeCenter:{x:0,y:0},screenScale:e.zoom,minimumWidth:8,minimumHeight:8,showRotationHandle:!1,onSelect:(e,t)=>i0.selectItem(i,t),onNudge:e=>i0.nudgeItem(i,e),onResize:e=>i0.resizeText(t.id,e),onDoubleClick:()=>i0.openEditor(i),onDelete:()=>i0.deleteItem(i),className:"human2ai-ui-sketch-canvas__item human2ai-ui-sketch-canvas__text","data-ui-sketch-item":i,"data-ui-sketch-kind":"text","data-ui-sketch-visible":t.visible,children:(0,n.jsx)("g",{transform:`translate(${-r.width/2} ${-r.height/2})`,children:(0,n.jsx)(id,{text:l,fontSize:t.fontSize,baseline:tM(t.fontSize),lineHeight:1.4,onBoundsChange:e=>{e5(i=>{let n=i[t.id];return n&&n.text===t.text&&n.fontSize===t.fontSize&&.01>Math.abs(n.width-e.width)&&.01>Math.abs(n.height-e.height)?i:{...i,[t.id]:{text:t.text,fontSize:t.fontSize,width:e.width,height:e.height}}})},className:["human2ai-ui-sketch-canvas__text-content",s?"human2ai-ui-sketch-canvas__text-content--empty":null].filter(Boolean).join(" ")})})})},t.id))})].filter(e=>null!==e),eh.layerOrder,e=>String(e.key)),tx.preview,(0,n.jsx)(iR,{state:tl,selectedKeys:tu,textMeasurements:e3,zoom:e.zoom},`${p}:${v}`),tp&&!tF?(0,n.jsx)("rect",{className:"human2ai-ui-sketch-canvas__multi-selection",x:tp.x,y:tp.y,width:tp.width,height:tp.height,"aria-hidden":"true","data-ui-sketch-multi-selection":!0}):null,eq?(0,n.jsx)("rect",{className:"human2ai-ui-sketch-canvas__marquee",x:eq.x,y:eq.y,width:eq.width,height:eq.height,"aria-hidden":"true","data-ui-sketch-marquee":!0}):null,eh.layerOrder?(0,n.jsx)("rect",{"data-canvas-layer-frame":!0,className:"human2ai-canvas-shape human2ai-canvas-frame__border",x:eh.frame.x,y:eh.frame.y,width:eh.frame.width,height:eh.frame.height,"aria-hidden":"true"}):null,(0,n.jsx)("g",{ref:e4,"data-canvas-controls-layer":!0}),ev&&w?(0,n.jsx)(ex,{tool:iC[ev],viewportBounds:e.viewportBounds,onPlace:tH,onCancel:()=>ew(null)},`${v}:${ev}`):null]})}),e$&&tg&&eE?"image"===tg.kind&&tg.item.previewReference&&h?i9:(0,n.jsxs)(P,{open:!0,title:i4,selectedText:"rectangle"===tg.kind?tg.item.note.trim()||el.missingRegionNote:"text"===tg.kind?tg.item.text||el.emptyText:tg.item.note.trim()||el.image,selectedTextLabel:"rectangle"===tg.kind?el.region:"text"===tg.kind?el.text:el.image,saveLabel:"",cancelLabel:el.cancel,onCancel:t3,onSave:()=>void 0,deleteAction:{label:"rectangle"===eE.kind?el.deleteRegion:"text"===eE.kind?el.deleteText:el.deleteNode,confirmTitle:"rectangle"===eE.kind?el.confirmDeleteRegion:"text"===eE.kind?el.confirmDeleteText:el.confirmDeleteNode,confirmCancelLabel:el.cancelDelete,onConfirm:()=>tZ([e$])},children:[(0,n.jsx)("span",{hidden:!0,"data-ui-sketch-mark-editor":!0,"data-human2ai-auto-save-node-editor":!0}),(0,n.jsxs)("div",{className:["human2ai-ui-sketch-canvas__editor-layout","image"===eE.kind?"human2ai-ui-sketch-canvas__editor-layout--image":null].filter(Boolean).join(" "),"data-human2ai-image-editor-layout":"image"===eE.kind?"true":void 0,children:[i6,"image"===eE.kind?(0,n.jsx)("aside",{className:"human2ai-ui-sketch-canvas__editor-side-fields",children:i9}):null]})]}):null]}),(0,n.jsx)("span",{className:"human2ai-ui-sketch-canvas__selection-status","aria-live":"polite",children:tu.length?`${el.selectedItemsPrefix}${tu.length}${el.selectedItemsSuffix}`:el.noSelection}),R?(0,z.createPortal)((0,n.jsx)(_.A,{title:el.clearCanvas,children:(0,n.jsx)("span",{children:(0,n.jsx)(k.x,{type:"text",size:"small",icon:(0,n.jsx)(x.A,{"aria-hidden":"true"}),"aria-label":el.clearCanvas,title:el.clearCanvasConfirmTitle,description:el.clearCanvasConfirmDescription,confirmLabel:el.clearCanvas,cancelLabel:el.clearCanvasCancel,onConfirm:function(){ew(null),t_(e=>({...e,rectangles:[],texts:[],images:[],groups:[]})),eC([]),eF(null),eD(null),e5({})},"data-ui-sketch-clear-canvas-action":!0,children:null})})}),R):null,N?(0,z.createPortal)((0,n.jsx)("div",{className:"human2ai-ui-sketch-canvas__external-tools","data-ui-sketch-external-tools":!0,children:i8}),N):null]})}function iR({state:e,selectedKeys:t,textMeasurements:i,zoom:r}){let o=(0,a.useRef)(null),s=(0,a.useRef)(null),[l,d]=(0,a.useState)(null),c=(0,a.useMemo)(()=>new Map(e.groups.map(e=>[e.id,e])),[e.groups]),u=(0,a.useMemo)(()=>new Map(e.groups.flatMap(e=>e.itemIds.map(t=>[t,e]))),[e.groups]),m=(0,a.useMemo)(()=>new Map([...e.rectangles.map(e=>[e.id,e]),...e.images.map(e=>[e.id,e]),...e.texts.map(e=>[e.id,iB(e,i)])]),[e.rectangles,e.images,e.texts,i]);(0,a.useLayoutEffect)(()=>{let e=o.current?.ownerSVGElement;if(!e)return;let t=t=>{let i=t instanceof Element&&e.contains(t)?t.closest("[data-ui-sketch-item]")?.dataset.uiSketchItem:void 0;s.current=i&&iF(i)?iE(i):null,d(u.get(s.current??"")?.id??null)},i=i=>{e.hasPointerCapture(i.pointerId)||t(i.target)},n=i=>{e.hasPointerCapture(i.pointerId)||t(i.relatedTarget)},a=()=>t(null);return d(u.get(s.current??"")?.id??null),e.addEventListener("pointerover",i),e.addEventListener("pointerout",n),e.addEventListener("pointerleave",a),()=>{e.removeEventListener("pointerover",i),e.removeEventListener("pointerout",n),e.removeEventListener("pointerleave",a)}},[u]);let h=new Set(t.map(e=>u.get(iE(e)))),p=l?c.get(l):void 0;p&&h.add(p);let g=6/r;return(0,n.jsx)("g",{ref:o,"aria-hidden":"true",children:Array.from(h).map(e=>{if(!e)return null;let t=iU(e.itemIds.map(e=>m.get(e)).filter(e=>!!e));return t?(0,n.jsx)("rect",{className:"human2ai-ui-sketch-canvas__group-outline","data-ui-sketch-group-outline":e.id,x:t.x-g,y:t.y-g,width:t.width+2*g,height:t.height+2*g},e.id):null})})}function i$(e){return"u">typeof crypto&&"randomUUID"in crypto?`${e}-${crypto.randomUUID()}`:`${e}-${Date.now()}-${Math.random().toString(36).slice(2)}`}function iT(e,t){return`${e}:${t}`}function iF(e){return e.startsWith("rectangle:")||e.startsWith("text:")||e.startsWith("image:")}function iE(e){return e.slice(e.indexOf(":")+1)}function iD(e,t){let i=new Set((0,tv.J$)(e,t.map(iE)));return[...e.rectangles.filter(e=>i.has(e.id)).map(e=>iT("rectangle",e.id)),...e.texts.filter(e=>i.has(e.id)).map(e=>iT("text",e.id)),...e.images.filter(e=>i.has(e.id)).map(e=>iT("image",e.id))]}function i_(e,t){let i=iE(t);if(t.startsWith("rectangle:")){let t=e.rectangles.find(e=>e.id===i);return t?{kind:"rectangle",item:t}:null}if(t.startsWith("image:")){let t=e.images.find(e=>e.id===i);return t?{kind:"image",item:t}:null}let n=e.texts.find(e=>e.id===i);return n?{kind:"text",item:n}:null}function iz(e,t,i){let n=i_(e,t);return n?"rectangle"===n.kind||"image"===n.kind?n.item:iB(n.item,i):null}function iB(e,t){let i=t7(e),n=t[e.id];return n&&n.text===e.text&&n.fontSize===e.fontSize?{...i,width:n.width,height:n.height}:i}function iq(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function iO(e,t){return{x:-e/2,y:-t/2,width:e,height:t}}function iU(e){if(!e.length)return null;let t=Math.min(...e.map(e=>e.x)),i=Math.min(...e.map(e=>e.y));return{x:t,y:i,width:Math.max(...e.map(e=>e.x+e.width))-t,height:Math.max(...e.map(e=>e.y+e.height))-i}}function iH(e){null!==e.animationFrame&&cancelAnimationFrame(e.animationFrame),e.previewElements.forEach(e=>e.removeAttribute("transform")),e.scene.removeAttribute("data-canvas-dragging")}function iG(e,t,i){if(!t.length)return e;let n={x:Math.round(i.x),y:Math.round(i.y)},a=new Set(t);return{...e,rectangles:e.rectangles.map(e=>a.has(iT("rectangle",e.id))?{...e,x:e.x+n.x,y:e.y+n.y}:e),images:e.images.map(e=>a.has(iT("image",e.id))?{...e,x:e.x+n.x,y:e.y+n.y}:e),texts:e.texts.map(e=>a.has(iT("text",e.id))?{...e,x:e.x+n.x,y:e.y+n.y}:e)}}function iW(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),width:Math.abs(t.x-e.x),height:Math.abs(t.y-e.y)}}function iJ(e,t){let i=t.getBoundingClientRect(),n=t.viewBox.baseVal;return{x:n.x+(e.clientX-i.left)/Math.max(1,i.width)*n.width,y:n.y+(e.clientY-i.top)/Math.max(1,i.height)*n.height}}function iV(e,t){try{e.setPointerCapture(t)}catch{}}function iY(e,t){let i=new Set(e);return t.forEach(e=>{i.has(e)?i.delete(e):i.add(e)}),[...i]}var iK=i(48624),iX=i(10749),iQ=i(92334);function iZ({title:e,items:t,activeKey:i,onActiveKeyChange:r,content:o,onClose:s,navigationLabel:l="分区导航",contentLabel:d,closeLabel:c="关闭面板","aria-label":u,className:m,style:h}){let p=new Set;for(let e of t){if(p.has(e.key))throw Error(`SectionNavigationPanel 菜单项 key 必须唯一:${e.key}`);p.add(e.key)}let g=(0,a.useId)(),f=t.find(e=>e.key===i),y=d??f?.label??"内容区";return(0,n.jsxs)("section",{...(0,j.S)("section-navigation-panel","SectionNavigationPanel","navigation-pattern"),className:["yisi-section-navigation-panel",m].filter(Boolean).join(" "),style:h,"aria-label":u,"aria-labelledby":u?void 0:g,"data-active-key":i??void 0,"data-empty":0===t.length?"true":"false",children:[(0,n.jsxs)("header",{className:"yisi-section-navigation-panel-header",children:[(0,n.jsx)("div",{id:g,className:"yisi-section-navigation-panel-title",title:"string"==typeof e?e:void 0,children:e}),(0,n.jsx)(w.Ay,{className:"yisi-section-navigation-panel-close",type:"text",icon:(0,n.jsx)(iQ.A,{}),"aria-label":c,title:c,onClick:s})]}),(0,n.jsxs)("div",{className:"yisi-section-navigation-panel-body",children:[(0,n.jsx)("nav",{className:"yisi-section-navigation-panel-navigation","aria-label":l,children:(0,n.jsx)("div",{className:"yisi-section-navigation-panel-list",role:"list",children:t.map(e=>{let t=e.key===i;return(0,n.jsx)("div",{className:"yisi-section-navigation-panel-list-item",role:"listitem","data-section-key":e.key,children:(0,n.jsx)(eT.u,{className:["yisi-section-navigation-panel-item",t?"yisi-section-navigation-panel-item--active":null].filter(Boolean).join(" "),icon:(0,n.jsx)("span",{className:"yisi-section-navigation-panel-item-icon","aria-hidden":"true",children:e.icon}),label:e.label,title:e.label,textColor:e.disabled?"color.text.disabled":t?"color.action.link":"color.text.primary","aria-current":t?"true":void 0,disabled:e.disabled,onClick:()=>{e.disabled||e.key===i||r(e.key,e)}})},e.key)})})}),(0,n.jsx)("div",{className:"yisi-section-navigation-panel-content",role:"region","aria-label":y,"data-section-key":i??void 0,children:o})]})]})}i(49927);var i0=i(16842);function i1({labels:e,values:t,sessions:i,loading:r,error:o,unavailable:s,retryAvailable:l,busy:d,initialSection:c="autoRelease",onChange:u,onReset:m,onRestore:h,onDelete:p,onClearTrash:g,onRetry:f,onClose:y}){let[v,w]=(0,a.useState)(c),j=(0,a.useId)(),S=(i,a,r)=>(0,n.jsxs)("div",{className:"human2ai-settings__field",children:[(0,n.jsxs)("div",{className:"human2ai-settings__label",children:[(0,n.jsx)("label",{htmlFor:`${j}-${i}`,children:a}),(0,n.jsx)(_.A,{title:r,children:(0,n.jsx)(iK.A,{tabIndex:0,"aria-label":r})})]}),(0,n.jsxs)("div",{className:"human2ai-settings__value",children:[(0,n.jsx)(b.A,{id:`${j}-${i}`,type:"number",min:1,max:i0.aT,step:1,inputMode:"numeric","aria-describedby":`${j}-${i}-unit`,value:t[i],disabled:!!d&&"save"!==d,onChange:e=>u(i,e.target.value)}),(0,n.jsx)("span",{id:`${j}-${i}-unit`,children:e.daysUnit(t[i])})]})]});return(0,n.jsx)("section",{className:"human2ai-settings",...(0,$.Se)({namespace:"human2ai",id:"settings-panel",name:"Human2AiSettingsPanel",category:"module",origin:"project",status:"candidate"}),children:(0,n.jsx)(iZ,{title:e.title,closeLabel:e.close,navigationLabel:e.navigationLabel,activeKey:v,onClose:y,items:[{key:"autoRelease",label:e.autoRelease,icon:(0,n.jsx)(iX.A,{"aria-hidden":"true"})},{key:"trash",label:e.trash,icon:(0,n.jsx)(x.A,{"aria-hidden":"true"})}],onActiveKeyChange:e=>w(e),content:(0,n.jsxs)("div",{className:`human2ai-settings__content${"trash"===v?" human2ai-settings__content--trash":""}`,children:[o?(0,n.jsxs)("div",{role:"alert",className:"human2ai-settings__error",children:[o,l?(0,n.jsx)(ed.J,{disabled:!!d,onClick:f,children:e.retry}):null]}):null,r?(0,n.jsx)(ia.G,{label:e.loading,rows:3}):s?(0,n.jsx)(ed.J,{onClick:f,children:e.retry}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{children:["autoRelease"===v?(0,n.jsxs)(n.Fragment,{children:[S("imageRetentionDays",e.imageDays,e.imageHint),S("historyRetentionDays",e.historyDays,e.historyHint)]}):S("trashRetentionDays",e.trashDays,e.trashHint),"autoRelease"===v?(0,n.jsx)("div",{className:"human2ai-settings__actions",children:(0,n.jsx)(ed.J,{loading:"reset"===d,disabled:!!d&&"save"!==d,onClick:m,children:e.resetDefaults})}):null]}),"trash"===v?(0,n.jsxs)("div",{className:"human2ai-settings__trash",children:[(0,n.jsx)("div",{className:"human2ai-settings__actions",children:(0,n.jsx)(k.x,{title:e.clearTrashConfirm,description:e.permanentDeleteHint,confirmLabel:e.clearTrash,cancelLabel:e.cancel,loading:"clear-trash"===d,disabled:!!d||!i.length,onConfirm:g,children:e.clearTrash})}),(0,n.jsx)("div",{className:"human2ai-settings__trash-list",children:i.length?i.map(t=>(0,n.jsxs)("div",{className:"human2ai-settings__session",children:[(0,n.jsxs)("div",{className:"human2ai-settings__session-info",children:[(0,n.jsx)("div",{className:"human2ai-settings__session-title",title:t.title,children:t.title}),(0,n.jsxs)("div",{className:"human2ai-settings__timestamp",children:[e.deletedAt," \xb7 ",t.deletedAt]})]}),(0,n.jsx)(ed.J,{size:"small",color:"primary",variant:"solid",loading:d===t.id,disabled:!!d,onClick:()=>h(t.id),children:e.restoreSession}),(0,n.jsx)(k.x,{size:"small",title:e.deleteNowConfirm(t.title),description:e.permanentDeleteHint,confirmLabel:e.deleteNow,cancelLabel:e.cancel,loading:d===`delete:${t.id}`,disabled:!!d,onConfirm:()=>p(t.id),children:e.deleteNow})]},t.id)):(0,n.jsx)("div",{className:"human2ai-settings__empty",children:e.emptyTrash})})]}):null]})]})})})}i(68118);var i2=i(510),i3=i(18100),i5=i(81428);function i8(e="black"){return"white"===e?"var(--yisiui-color-text-inverse)":"var(--yisiui-color-text-primary)"}function i4({menu:e,tabKey:t,menuLabel:i,rightSlot:r,nodeRef:o,children:s,...l}){let[d,c]=(0,a.useState)(!1),[u,m]=(0,a.useState)(!1),h=(0,a.useRef)(null),p=(0,a.useRef)(null),f=(0,a.useRef)(!1),y=(0,a.useRef)(null),x=!!e?.items.length,b=e?.trigger==="hover",v=JSON.stringify(e?.items.map(({key:e,disabled:t})=>[e,!!t]));function w(){let e=b&&!u?p.current?.querySelector("input:not(:disabled)")??h.current:h.current;e?.focus()}function j(){c(!1),w()}function k(){m(!0),c(!0)}(0,a.useLayoutEffect)(()=>{y.current&&!e?.items.some(e=>e.key===y.current&&!e.disabled)&&(w(),y.current=null),x||c(!1)},[v]),(0,a.useLayoutEffect)(()=>{c(!1)},[b]);let S={placement:"bottomRight",autoAdjustOverflow:!0,autoFocus:u,popupRender:e=>(0,n.jsx)("div",{onKeyDownCapture:e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),f.current=!0,j())},children:e}),menu:{items:e?.items.map(e=>({...e,onFocus:()=>{y.current=e.key}})),onClick:({key:i,domEvent:n})=>{n.stopPropagation();let a=e?.items.find(e=>e.key===i);a&&!a.disabled&&(f.current=!0,j(),e?.onAction(i,t))}}};return(0,n.jsx)(g.A,{...S,trigger:b&&x?["hover"]:[],open:b&&x&&d,mouseEnterDelay:.15,mouseLeaveDelay:.15,onOpenChange:e=>{e&&(f.current||p.current?.closest(".yisi-tab-switch")?.hasAttribute("data-drag-state"))||(m(!1),c(e))},children:(0,n.jsxs)("div",{...l,ref:e=>{p.current=e,o(e)},"data-menu-trigger":b?"hover":"button",onMouseEnter:e=>{f.current=e.buttons>0},onPointerDownCapture:e=>{e.target.closest(".yisi-tab-switch-label")&&(f.current=!0,c(!1))},children:[s,null!=r||x?(0,n.jsxs)("div",{className:"yisi-tab-switch-right-slot","data-yisiui-slot":"rightSlot",children:[r,x?(0,n.jsx)("div",{className:"yisi-tab-switch-menu","data-mode":b?"hover":"button","data-open":d||void 0,children:(0,n.jsx)(g.A,{...S,trigger:b?[]:["click"],open:!b&&d,onOpenChange:e=>{m(!0),c(e),e||(y.current=null)},children:(0,n.jsx)(ed.J,{ref:h,className:"yisi-tab-switch-menu-trigger",mode:"icon-only",icon:(0,n.jsx)(i2.A,{}),iconLabel:e?.ariaLabel??`${i}的更多操作`,type:"text",size:"small","aria-haspopup":"menu","aria-expanded":d,onClick:b?k:void 0,onKeyDown:e=>{"ArrowDown"===e.key&&(e.preventDefault(),k()),"Escape"===e.key&&(f.current=!0,j())}})})}):null]}):null]})})}function i6({items:e,"aria-label":t,compact:i=!1,trailingAction:r,reorderable:o=!1,onReorder:s,scrollArrows:l,dragAnnouncements:d,tabBackground:c,selectedBackground:u,selectedTextColor:m,unselectedTextColor:h,value:p,defaultValue:g,onChange:f,className:y,style:x}){let b,v,w,k,S=(0,a.useRef)(!1);var I,C,P,L=S.current?void 0:g;if(e.length<1)throw Error("TabSwitch 至少需要一个子项。");let A=new Set;for(let t of e){if(A.has(t.key))throw Error(`TabSwitch 子项 key 必须唯一:${t.key}`);if(A.add(t.key),t.menu&&new Set(t.menu.items.map(e=>e.key)).size!==t.menu.items.length)throw Error(`TabSwitch 菜单项 key 必须唯一:${t.key}`);if(("icon-text"===t.mode||"icon-only"===t.mode)&&null==t.icon)throw Error(`TabSwitch 子项「${t.label}」使用 Icon 模式时必须提供 icon。`)}if(void 0!==p&&!A.has(p))throw Error(`TabSwitch value 不存在于 items:${p}`);if(void 0!==L&&!A.has(L))throw Error(`TabSwitch defaultValue 不存在于 items:${L}`);(0,a.useLayoutEffect)(()=>{S.current=!0},[]);let M=(0,a.useMemo)(()=>new Map(e.map(e=>[e.key,e])),[e]),N=e[0].key,[R,$]=(0,a.useState)(g??N),T=function(e,t,i,n){let r=(0,a.useRef)(null),o=(0,a.useRef)(null),s=(0,a.useRef)(new Map),l=(0,a.useRef)(null),d=(0,a.useRef)(void 0),c=(0,a.useRef)(void 0),u=(0,a.useRef)(!1),m=(0,a.useRef)({items:e,onReorder:i,announcements:n}),h=(0,a.useRef)(()=>{});(0,a.useLayoutEffect)(()=>{m.current={items:e,onReorder:i,announcements:n},l.current?.active&&f(l.current.inside)});let p=JSON.stringify(e.map(({key:e,label:t,disabled:i,mode:n,ariaLabel:a,menu:r})=>[e,t,!!i,n,a,r?.trigger,r?.items.map(({key:e,label:t,disabled:i,danger:n})=>[e,t,!!i,!!n])]));function g(){clearTimeout(d.current),void 0!==c.current&&window.cancelAnimationFrame(c.current),c.current=void 0;let e=l.current;for(let t of(l.current=null,h.current(),e?.target.hasPointerCapture?.(e.pointerId)&&e.target.releasePointerCapture(e.pointerId),s.current.values()))t.style.removeProperty("transform"),delete t.dataset.dragged;if(r.current){delete r.current.dataset.dragState;let e=r.current.querySelector("[data-drag-feedback]");e&&(e.textContent="")}}function f(e){let t=r.current?.querySelector("[data-drag-feedback]"),i=m.current.announcements[e?"inside":"outside"];t&&t.textContent!==i&&(t.textContent=i)}function y(e=!1){let t=l.current,i=r.current,n=o.current;if(!t?.active||!i||!n)return;let a=i.getBoundingClientRect();t.inside=t.x>=a.left&&t.x<=a.right&&t.y>=a.top&&t.y<=a.bottom;let s=t.inside?"dragging":"cancel";i.dataset.dragState!==s&&(i.dataset.dragState=s,f(t.inside));let d=!1;if(t.inside&&e&&n.scrollWidth>n.clientWidth){let e=Math.min(32,a.width/4),i=t.x<a.left+e?-8:8*(t.x>a.right-e);if(i){let e=n.scrollLeft;n.scrollLeft+=i,d=n.scrollLeft!==e}}let c=n.scrollLeft-t.scrollLeft,u=t.positions.find(({key:e})=>e===t.key),m=t.positions.filter(({key:e})=>e!==t.key),h=t.x-t.grabX+u.width/2+c,p=m.filter(({left:e,width:i})=>t.rtl?h<e+i/2:h>e+i/2).length,g=m.slice();g.splice(p,0,u),t.preview=(t.inside?g:t.positions).map(({key:e})=>e);let b=Math.min(...t.positions.map(({left:e})=>e)),v=Math.max(...t.positions.map(({left:e,width:t})=>e+t)),w=t.rtl?v:b;for(let e of t.preview){let i=t.positions.find(t=>t.key===e),n=t.rtl?w-i.width:w;w+=(t.rtl?-1:1)*i.width;let a=Math.max(b,Math.min(v-i.width,t.x-t.grabX+c)),r=t.inside?e===t.key?a-i.left:n-i.left:0,o=t.inside&&e===t.key?t.y-t.startY:0,s=`translate3d(${Math.round(1e3*r)/1e3}px, ${Math.round(1e3*o)/1e3}px, 0px)`;i.node.style.transform!==s&&(i.node.style.transform=s)}d&&x()}function x(){void 0===c.current&&(c.current=window.requestAnimationFrame(()=>{c.current=void 0,y(!0)}))}return(0,a.useLayoutEffect)(()=>{g()},[p,t]),(0,a.useLayoutEffect)(()=>()=>g(),[]),{rootRef:r,viewportRef:o,nodes:s,onPointerDown:function(i,n){let a;if(!t||0!==i.button||!1===i.isPrimary||l.current||e.length<2)return;let c=r.current,p=o.current;if(!c||!p)return;let f=i.currentTarget,b={pointerId:i.pointerId,key:n,x:i.clientX,y:i.clientY,startX:i.clientX,startY:i.clientY,active:!1,inside:!0,positions:[],preview:[],scrollLeft:p.scrollLeft,grabX:0,rtl:"rtl"===getComputedStyle(c).direction,target:f};l.current=b;let v=e=>{if(e.pointerId===b.pointerId){if(b.x=e.clientX,b.y=e.clientY,!b.active){Math.hypot(b.x-b.startX,b.y-b.startY)>6&&g();return}e.preventDefault(),x()}},w=e=>{if(e.pointerId!==b.pointerId)return;b.x=e.clientX,b.y=e.clientY,b.active&&y();let t=b.active&&b.inside?b.preview:null,i=t&&t.some((e,t)=>e!==m.current.items[t]?.key);g(),i&&m.current.onReorder?.(t)},j=e=>{e.pointerId===b.pointerId&&g()},k=()=>g(),S=e=>{"Escape"===e.key?(e.preventDefault(),g()):b.active&&e.preventDefault()},I=e=>{b.active&&e.preventDefault()};window.addEventListener("touchmove",I,{passive:!1}),window.addEventListener("pointermove",v,{passive:!1}),window.addEventListener("pointerup",w),window.addEventListener("pointercancel",j),window.addEventListener("blur",k),window.addEventListener("resize",k),window.addEventListener("keydown",S,!0),f.addEventListener("lostpointercapture",k),h.current=()=>{a?.disconnect(),window.removeEventListener("touchmove",I),window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",j),window.removeEventListener("blur",k),window.removeEventListener("resize",k),window.removeEventListener("keydown",S,!0),f.removeEventListener("lostpointercapture",k)},d.current=setTimeout(()=>{if(l.current!==b)return;b.positions=m.current.items.flatMap(({key:e})=>{let t=s.current.get(e);if(!t)return[];let i=t.getBoundingClientRect();return[{key:e,node:t,left:i.left,width:i.width}]});let e=b.positions.find(e=>e.key===n);if(!e||!e.width)return void g();let t=c.getBoundingClientRect();"u">typeof ResizeObserver&&((a=new ResizeObserver(()=>{let e=c.getBoundingClientRect();(Math.abs(e.width-t.width)>.5||Math.abs(e.height-t.height)>.5||b.positions.some(({node:e,width:t})=>Math.abs(e.getBoundingClientRect().width-t)>.5))&&g()})).observe(c),b.positions.forEach(({node:e})=>a.observe(e))),b.active=!0,b.scrollLeft=p.scrollLeft,b.grabX=b.startX-e.left,u.current=!0,e.node.dataset.dragged="true";try{f.setPointerCapture?.(b.pointerId)}catch{}y()},350)},suppressClick:u,resetClickSuppression:()=>{l.current?.active||(u.current=!1)}}}(e,o,s,{inside:d?.inside??"松手确认排序",outside:d?.outside??"移出范围,松手取消排序"}),F=function(e,t){let i=(0,a.useRef)(null),[n,r]=(0,a.useState)({overflow:!1,left:!1,right:!1,rtl:!1}),o=(0,a.useRef)(void 0),s=(0,a.useRef)(void 0),l=(0,a.useRef)(null),d=(0,a.useRef)(null),c=(0,a.useRef)(!1),u=(0,a.useRef)(void 0);function m(){let e=t.current;if(!e)return{min:0,max:0};let i=Math.max(0,e.scrollWidth-e.clientWidth);return"rtl"===getComputedStyle(e).direction?{min:-i,max:0}:{min:0,max:i}}function h(){let n=e.current,a=t.current,o=i.current;if(!n||!a||!o)return;let s=getComputedStyle(n),l=Math.max(0,n.clientWidth-(parseFloat(s.paddingLeft)||0)-(parseFloat(s.paddingRight)||0)),d=o.clientWidth>l+1,{min:c,max:u}=m(),h={overflow:d,left:d&&a.scrollLeft>c+1,right:d&&a.scrollLeft<u-1,rtl:"rtl"===getComputedStyle(a).direction};r(e=>e.overflow===h.overflow&&e.left===h.left&&e.right===h.right&&e.rtl===h.rtl?e:h),!d&&(f(),document.activeElement instanceof HTMLElement&&document.activeElement.matches(".yisi-tab-switch-scroll-arrow")&&n.contains(document.activeElement)&&(n.querySelector("input:checked:not(:disabled)")??n.querySelector("input:not(:disabled), .yisi-tab-switch-trailing-action button:not(:disabled)"))?.focus({preventScroll:!0}))}function p(e){let i=t.current;if(!i)return!1;let{min:n,max:a}=m(),r=i.scrollLeft;return i.scrollLeft=Math.max(n,Math.min(a,r+e)),h(),Math.abs(i.scrollLeft-r)>.01}function g(){void 0!==o.current&&window.cancelAnimationFrame(o.current),o.current=void 0,u.current=void 0}function f(){g(),clearTimeout(s.current),l.current=null,d.current&&(c.current=!0),d.current=null}function y(){if(void 0!==o.current)return;let t=i=>{o.current=void 0;let n=d.current?d.current.held?d.current.direction:null:l.current;if(null===n||e.current?.dataset.dragState)return void g();let a=Math.min(32,void 0===u.current?16:i-u.current);u.current=i,p(n*a*(d.current?.32:.18))?o.current=window.requestAnimationFrame(t):g()};o.current=window.requestAnimationFrame(t)}return(0,a.useLayoutEffect)(()=>{h();let n=e.current,a=t.current,r=i.current,o="u"<typeof ResizeObserver?void 0:new ResizeObserver(h);n&&o?.observe(n),a&&o?.observe(a),r&&o?.observe(r);let u=e=>{d.current?.id===e.pointerId&&(c.current=d.current.held,d.current=null,clearTimeout(s.current),g(),null!==l.current&&y())},m=()=>f(),p=e=>{"Escape"===e.key&&f()},x=()=>{document.hidden&&f()};return a?.addEventListener("scroll",h,{passive:!0}),window.addEventListener("resize",h),window.addEventListener("pointerup",u),window.addEventListener("pointercancel",m),window.addEventListener("blur",m),window.addEventListener("keydown",p),document.addEventListener("visibilitychange",x),()=>{f(),o?.disconnect(),a?.removeEventListener("scroll",h),window.removeEventListener("resize",h),window.removeEventListener("pointerup",u),window.removeEventListener("pointercancel",m),window.removeEventListener("blur",m),window.removeEventListener("keydown",p),document.removeEventListener("visibilitychange",x)}},[]),(0,a.useLayoutEffect)(()=>{h()}),{trackRef:i,edges:n,buttonProps:function(e){return{disabled:e<0?!n.left:!n.right,onPointerEnter:t=>{"touch"===t.pointerType||t.buttons>0||(l.current=e,y())},onPointerLeave:f,onPointerDown:t=>{0===t.button&&!1!==t.isPrimary&&(g(),clearTimeout(s.current),c.current=!1,d.current={id:t.pointerId,direction:e,held:!1},s.current=setTimeout(()=>{d.current&&(d.current.held=!0,y())},350))},onContextMenu:e=>e.preventDefault(),onClick:()=>{if(c.current){c.current=!1;return}p(e*Math.max(96,(t.current?.clientWidth??0)*.8))},onKeyDown:()=>{c.current=!1}}}}}(T.rootRef,T.viewportRef),E=(0,a.useId)(),D=(0,a.useRef)([]),_=(0,a.useRef)(null),z=p??(M.has(R)?R:N),B=(I=T.rootRef,C=F.trackRef,P=T.nodes,b=(0,a.useRef)(null),v=(0,a.useRef)(null),w=(0,a.useRef)(z),k=(0,a.useRef)(null),(0,a.useLayoutEffect)(()=>{let e,t=new Set,i=()=>{let e=I.current,t=b.current,i=P.current.get(w.current);if(!e||!t)return;if(!i||!i.offsetWidth||!i.offsetHeight){delete e.dataset.indicatorReady,v.current=null;return}let n={key:w.current,x:i.offsetLeft,y:i.offsetTop,width:i.offsetWidth,height:i.offsetHeight},a=v.current;a&&Object.keys(n).every(e=>n[e]===a[e])||(a&&a.key!==n.key&&!e.hasAttribute("data-drag-state")?t.dataset.animate="true":delete t.dataset.animate,t.style.transform=`translate3d(${n.x}px, ${n.y}px, 0px)`,t.style.width=`${n.width}px`,t.style.height=`${n.height}px`,e.dataset.indicatorReady="true",v.current=n)},n=()=>{void 0===e&&(e=window.requestAnimationFrame(()=>{e=void 0,i()}))},a="u"<typeof ResizeObserver?void 0:new ResizeObserver(n),r=C.current;return r&&a?.observe(r),k.current=()=>{let e=new Set(P.current.values());for(let i of t)e.has(i)||(a?.unobserve(i),t.delete(i));for(let i of e)t.has(i)||(a?.observe(i),t.add(i));i()},window.addEventListener("resize",n),()=>{a?.disconnect(),window.removeEventListener("resize",n),void 0!==e&&window.cancelAnimationFrame(e),k.current=null,v.current=null,I.current&&delete I.current.dataset.indicatorReady}},[I,C,P]),(0,a.useLayoutEffect)(()=>{w.current=z,k.current?.()}),b),q=M.get(z)?.disabled?e.find(e=>!e.disabled)?.key:z;function O(e){let t=M.get(e);t&&!t.disabled&&e!==z&&(void 0===p&&$(e),f?.(e,t))}return(0,a.useLayoutEffect)(()=>{let t=_.current;!t||(!M.has(t.key)||!t.node.isConnected||t.node instanceof HTMLInputElement&&t.node.disabled)&&(document.activeElement===document.body||document.activeElement===t.node)&&D.current[e.findIndex(e=>e.key===q)]?.focus()}),(0,n.jsxs)("div",{...(0,j.S)("tab-switch","TabSwitch","component"),ref:T.rootRef,"data-reorderable":o||void 0,"data-scroll-direction":F.edges.rtl?"rtl":"ltr",onPointerDownCapture:T.resetClickSuppression,onKeyDownCapture:e=>{e.defaultPrevented||"Escape"===e.key||T.resetClickSuppression()},onClickCapture:e=>{T.suppressClick.current&&(e.preventDefault(),e.stopPropagation())},className:["yisi-tab-switch",i?"yisi-tab-switch-compact":null,y].filter(Boolean).join(" "),"data-density":i?"compact":"default",style:{...x,"--yisiui-tab-switch-background":c??"var(--yisiui-color-surface-page)","--yisiui-tab-switch-selected-background":u??"var(--yisiui-color-action-primary)","--yisiui-tab-switch-selected-text-color":i8(m??(u?"black":"white")),...h?{"--yisiui-tab-switch-unselected-text-color":i8(h)}:{}},"aria-label":t,role:"radiogroup","aria-orientation":"horizontal",children:[F.edges.overflow?(0,n.jsx)(ed.J,{...F.buttonProps(-1),className:"yisi-tab-switch-scroll-arrow yisi-tab-switch-scroll-left",type:"text",size:"small",mode:"icon-only",icon:l?.left?.icon??(0,n.jsx)(i3.A,{}),iconLabel:l?.left?.label??"向左滚动标签"}):null,(0,n.jsx)("div",{ref:T.viewportRef,className:"yisi-tab-switch-viewport",children:(0,n.jsxs)("div",{ref:F.trackRef,className:"yisi-tab-switch-track",children:[(0,n.jsx)("div",{className:"yisi-tab-switch-selection-layer","aria-hidden":"true",children:(0,n.jsx)("div",{ref:B,className:"yisi-tab-switch-selection"})}),e.map((t,i)=>{let a;return(0,n.jsx)(i4,{menu:t.menu,tabKey:t.key,menuLabel:t.ariaLabel??t.label,rightSlot:t.rightSlot,nodeRef:e=>{e?T.nodes.current.set(t.key,e):T.nodes.current.delete(t.key)},"data-tab-key":t.key,onFocusCapture:e=>{_.current={key:t.key,node:e.target}},className:["yisi-tab-switch-item",t.key===z?"yisi-tab-switch-active-item":null,t.disabled?"yisi-tab-switch-disabled-item":null].filter(Boolean).join(" "),children:(0,n.jsxs)("label",{className:"yisi-tab-switch-label",onPointerDown:t.disabled?void 0:e=>T.onPointerDown(e,t.key),onContextMenu:e=>{o&&e.preventDefault()},title:"icon-only"===t.mode?t.ariaLabel??t.label:void 0,children:[(0,n.jsx)("input",{ref:e=>{D.current[i]=e},className:"yisi-tab-switch-input",type:"radio",name:E,value:t.key,checked:t.key===z,disabled:t.disabled,"aria-label":t.ariaLabel,tabIndex:t.disabled||t.key!==q?-1:0,onChange:()=>O(t.key),onKeyDown:t=>(function(t,i){let n;if(t.defaultPrevented)return;let a=e.flatMap((e,t)=>e.disabled?[]:[t]),r=a.indexOf(i),o=a.length-1,s="rtl"===getComputedStyle(t.currentTarget).direction;switch(t.key){case"ArrowRight":case"ArrowLeft":n=(r+("ArrowRight"===t.key!==s?1:o))%a.length;break;case"ArrowDown":n=(r+1)%a.length;break;case"ArrowUp":n=(r+o)%a.length;break;case"Home":n=0;break;case"End":n=o;break;default:return}t.preventDefault();let l=a[n];void 0!==l&&(O(e[l].key),D.current[l]?.focus())})(t,i)}),(a=t.mode??"icon-text",(0,n.jsxs)("span",{className:"yisi-tab-switch-content",children:["text-only"!==a?(0,n.jsx)("span",{className:"yisi-tab-switch-icon","aria-hidden":"true",children:t.icon}):null,"icon-only"===a?(0,n.jsx)("span",{className:"yisi-tab-switch-visually-hidden",children:t.ariaLabel??t.label}):(0,n.jsx)("span",{className:"yisi-tab-switch-text",children:t.label})]}))]})},t.key)}),r?(0,n.jsx)("div",{className:"yisi-tab-switch-trailing-action","data-yisiui-slot":"trailingAction",children:(0,n.jsx)(ed.J,{type:"text",size:i?"small":"middle",mode:r.icon?"with-icon":"without-icon",icon:r.icon,disabled:r.disabled,onClick:r.onClick,children:r.label})}):null]})}),F.edges.overflow?(0,n.jsx)(ed.J,{...F.buttonProps(1),className:"yisi-tab-switch-scroll-arrow yisi-tab-switch-scroll-right",type:"text",size:"small",mode:"icon-only",icon:l?.right?.icon??(0,n.jsx)(i5.A,{}),iconLabel:l?.right?.label??"向右滚动标签"}):null,(0,n.jsx)("span",{className:"yisi-tab-switch-visually-hidden","data-drag-feedback":!0,role:"status","aria-live":"polite"})]})}i(48308),i(71180);let i9={draftView:"构图",refinedView:"精修",referenceView:"预览",viewSwitch:"构图视图",draftCanvas:"用户构图草图",refinedCanvas:"Agent 精修后的构图",referenceCanvas:"用于生图的结构参考",agentDecision:"Agent 判断",appliedMethods:"执行方法",protectionAudit:"变化记录",maximumFocusShift:"最大焦点位移",maximumAreaShift:"最大形状位移",maximumRotationShift:"最大旋转变化",objective:"精修目标",observations:"判断依据",uncertainties:"待确认事项",preserve:"保留关系",tradeoffs:"取舍",relations:"关系验证",retained:"保留原构图",target:"目标值",before:"原图测量",after:"精修测量",error:"达成偏差",unmeasurable:"不适用",framePlacement:"分割线定位",sizeRatio:"尺寸比例",mirrorSymmetry:"轴对称",focusFlow:"焦点引导",focusAnchor:"焦点定位",axisRelation:"轴线关系",rotationAlignment:"方向对齐",blockAlignment:"区域对齐",spacingRhythm:"等距排列"};function i7(e){return"children"in e?(0,n.jsx)(ne,{...e}):(0,n.jsx)(nt,{...e})}function ne({stateControls:e,children:t,className:i,style:a,workflowStatus:r,activeView:o,"data-active-stage":s}){return(0,n.jsxs)("section",{...(0,$.Se)({namespace:"human2ai",id:"composition-workflow-view",name:"CompositionWorkflowView",category:"module",origin:"project",status:"candidate"}),className:["human2ai-composition-workflow",i].filter(Boolean).join(" "),style:a,"data-workflow-status":r,"data-active-view":o,"data-active-stage":s,children:[(0,n.jsx)("div",{className:"human2ai-composition-workflow__toolbar",children:e}),(0,n.jsx)("div",{className:"human2ai-composition-workflow__stage",children:t})]})}function nt({stateControls:e,interactionResetKey:t,selectedPlanIds:i,planningLocked:a=!1,onPlanSelectionChange:r,planningLabels:o,showHiddenNodes:s,onionSkin:l,visibilityLabels:d,draft:c,status:u,refinement:m=null,activeView:h,onViewChange:p,selectedIds:g=[],onDraftChange:f,placementTool:y,onPlacementToolChange:x,onSelectionChange:b,onItemDoubleClick:v,showPlanning:w=!0,frameLocked:j=!1,frameLabels:k,canvasZoom:S,canvasViewportAction:I,onCanvasZoomChange:C,canvasBackgroundPattern:P,showCanvasViewportControls:L,canvasSideActions:A,canvasSideActionPlacement:M,canvasSideActionPanelWidth:N,canvasSideActionPanelDefaultCollapsed:$,canvasViewportLabels:T,canvasLayerLabels:F,nodeEditorLabels:E,directionControlLabels:D,areaEditorLabels:_,imageEditorLabels:z,resolveImageSource:B,renderCameraReference:q,onImageUpload:O,onReadImageFile:U,labels:H,className:G,style:W}){let J={...i9,...H},V=m?.audit.passed===!0&&m.plan.sourceFingerprint===m.sourceFingerprint&&m.sourceFingerprint===(0,R.Oq)(c),Y="ready"!==u||V?u:"stale",K="ready"===Y&&V,X="refined"!==h||K?h:"draft",Q=K&&m?m.refinedDraft:c,Z=[{key:"draft",label:J.draftView,mode:"text-only"},{key:"refined",label:J.refinedView,mode:"text-only",disabled:!K},{key:"reference",label:J.referenceView,mode:"text-only"}];return(0,n.jsxs)(ne,{className:G,style:W,workflowStatus:Y,activeView:X,stateControls:e??(0,n.jsx)(i6,{items:Z,value:X,"aria-label":J.viewSwitch,onChange:e=>p(e)}),children:["draft"===X?(0,n.jsx)(eV,{interactionResetKey:t,selectedPlanIds:i,planningLocked:a,onPlanSelectionChange:r,planningLabels:o,draft:c,showPlanning:w,showHiddenNodes:s,onionSkin:l,visibilityLabels:d,frameLocked:j,frameLabels:k,zoom:S,viewportAction:I,backgroundPattern:P,showViewportControls:L,sideActions:A,sideActionPlacement:M,sideActionPanelWidth:N,sideActionPanelDefaultCollapsed:$,viewportLabels:T,layerLabels:F,nodeEditorLabels:E,directionControlLabels:D,areaEditorLabels:_,imageEditorLabels:z,renderCameraReference:q,resolveImageSource:B,onImageUpload:O,onReadImageFile:U,selectedIds:g,onDraftChange:f,placementTool:y,onPlacementToolChange:x,onSelectionChange:b,onItemDoubleClick:v,onZoomChange:C,"aria-label":J.draftCanvas},c.activeStateId):null,"refined"===X&&m?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eV,{draft:m.refinedDraft,frameLabels:k,showPlanning:w,zoom:S,viewportAction:I,backgroundPattern:P,showViewportControls:L,viewportLabels:T,layerLabels:F,nodeEditorLabels:E,resolveImageSource:B,onZoomChange:C,"aria-label":J.refinedCanvas}),(0,n.jsx)(ni,{refinement:m,labels:J})]}):null,"reference"===X?(0,n.jsx)(eV,{draft:Q,appearance:"reference",layerLabels:F,nodeEditorLabels:E,resolveImageSource:B,"aria-label":J.referenceCanvas}):null]})}function ni({refinement:e,labels:t}){let i=e.audit.changes;if(2===e.plan.version){let i=e.plan,a={"focus-anchor":t.focusAnchor,"axis-relation":t.axisRelation,"rotation-alignment":t.rotationAlignment,"block-alignment":t.blockAlignment,"spacing-rhythm":t.spacingRhythm,"frame-placement":t.framePlacement,"size-ratio":t.sizeRatio,"mirror-symmetry":t.mirrorSymmetry,"focus-flow":t.focusFlow},r=[[t.observations,i.assessment.observations],[t.uncertainties,i.assessment.uncertainties],[t.preserve,i.preserve],[t.tradeoffs,i.tradeoffs]];return(0,n.jsxs)("div",{className:"human2ai-composition-workflow__summary human2ai-composition-workflow__summary--directed",children:[(0,n.jsxs)("section",{children:[(0,n.jsx)("h3",{children:t.objective}),(0,n.jsx)("p",{children:i.objective}),(0,n.jsx)("p",{children:i.assessment.intent}),(0,n.jsx)("p",{children:i.rationale}),"retain"===i.decision?(0,n.jsx)("strong",{children:t.retained}):null,r.filter(([,e])=>e.length).map(([e,t])=>(0,n.jsxs)("div",{className:"human2ai-composition-workflow__explanation",children:[(0,n.jsx)("h3",{children:e}),(0,n.jsx)("ul",{children:t.map((e,t)=>(0,n.jsx)("li",{children:e},t))})]},e))]}),i.operations.length>0?(0,n.jsxs)("section",{children:[(0,n.jsx)("h3",{children:t.relations}),(0,n.jsx)("ol",{className:"human2ai-composition-workflow__relations",children:i.operations.map((i,r)=>{let o=e.audit.relations?.find(e=>e.operationIndex===r);return(0,n.jsxs)("li",{"data-relation-passed":o?.passed,children:[(0,n.jsx)("strong",{children:a[i.method]}),(0,n.jsx)("p",{children:i.reason}),(0,n.jsx)("p",{children:i.expectedEffect}),o?(0,n.jsx)("dl",{children:[[t.target,o.target],[t.before,o.before],[t.after,o.after],[t.error,o.error]].map(([e,i])=>(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:e}),(0,n.jsx)("dd",{children:function(e,t,i){if(null===e)return i;if("frame-fraction"===t)return`${Number((100*e).toFixed(3))}%`;let n=Number(e.toFixed(4)).toString();return"degrees"===t?`${n}\xb0`:"pixels"===t?`${n} px`:n}(i,o.unit,t.unmeasurable)})]},String(e)))}):null]},r)})})]}):null]})}return(0,n.jsxs)("div",{className:"human2ai-composition-workflow__summary",children:[(0,n.jsxs)("section",{children:[(0,n.jsx)("h3",{children:t.agentDecision}),(0,n.jsx)("p",{children:e.plan.rationale})]}),(0,n.jsxs)("section",{children:[(0,n.jsx)("h3",{children:t.appliedMethods}),(0,n.jsx)("ul",{children:e.appliedOperations.map((e,t)=>(0,n.jsx)("li",{children:(0,n.jsx)("code",{children:`${e.method}@${e.methodVersion}`})},`${e.method}-${t}`))})]}),(0,n.jsxs)("section",{children:[(0,n.jsx)("h3",{children:t.protectionAudit}),(0,n.jsxs)("dl",{children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:t.maximumFocusShift}),(0,n.jsx)("dd",{children:nn(i.maximumFocusShift)})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:t.maximumAreaShift}),(0,n.jsx)("dd",{children:nn(i.maximumAreaShift)})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:t.maximumRotationShift}),(0,n.jsxs)("dd",{children:[i.maximumRotationShift.toFixed(1),"\xb0"]})]})]})]})]})}function nn(e){return`${(100*e).toFixed(1)}%`}var na=i(81309);i(42666);let nr=["--yisiui-app-shell-sidebar-resized-width","--yisiui-app-shell-right-panel-resized-width"],no=(e,t)=>Number.isFinite(e)?Math.max(0,e):t,ns=(e,t,i)=>Math.min(i,Math.max(t,e));var nl=i(92449);let nd={sidebar:"Application sidebar",navigation:"Application navigation",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",rightPanel:"Right panel",collapseRightPanel:"Collapse right panel",expandRightPanel:"Expand right panel",resizeSidebar:"Resize sidebar",resizeRightPanel:"Resize right panel"};function nc(e){return"number"==typeof e?`${e}px`:e}function nu({sidebar:e,sidebarTitle:t,sidebarNavigation:i,title:r,headerExtra:o,backAction:s,sidebarCollapsedActions:l,rightPanel:d,children:c,collapsible:u=!0,sidebarOpen:m,defaultSidebarOpen:h=!0,onSidebarOpenChange:p,sidebarWidth:g="var(--yisiui-surface-desktop-web-sidebar-width)",sidebarResizable:f=!0,sidebarMinWidth:y=180,sidebarMaxWidth:x=480,onSidebarWidthChange:b,rightPanelCollapsible:v=!0,rightPanelOpen:k,defaultRightPanelOpen:S=!0,onRightPanelOpenChange:I,rightPanelWidth:C="var(--yisiui-surface-desktop-web-sidebar-width)",rightPanelResizable:P=!0,rightPanelMinWidth:L=240,rightPanelMaxWidth:A=560,onRightPanelWidthChange:M,contentMinWidth:N=320,labels:R,className:$,style:T}){let F=(0,a.useId)(),E=(0,a.useId)(),D=(0,a.useRef)(null),_=(0,a.useRef)(null),[z,B]=(0,a.useState)(h),[q,O]=(0,a.useState)(S),U=void 0!==m,H=void 0!==k,G=null!=d,W=null!=o&&!1!==o,J=!u||(m??z),V=G&&(!v||(k??q)),Y={...nd,...R},K=function(e){let t=(0,a.useRef)(null),i=(0,a.useRef)(null),n=(0,a.useRef)(null),r=(0,a.useRef)(null),o=(0,a.useRef)(null),s=(0,a.useRef)([void 0,void 0]),l=(0,a.useRef)([e.sidebarWidth,e.rightPanelWidth]),d=(0,a.useRef)(e);(0,a.useLayoutEffect)(()=>{d.current=e});let{sidebarWidth:c,sidebarResizable:u,sidebarMinWidth:m,sidebarMaxWidth:h,rightPanelWidth:p,rightPanelResizable:g,rightPanelMinWidth:f,rightPanelMaxWidth:y,contentMinWidth:x,isSidebarVisible:b,isRightPanelVisible:v}=e;return(0,a.useLayoutEffect)(()=>{let e=t.current,a=e.ownerDocument,w=a.defaultView,j=[i.current,n.current],k=[r.current,o.current],S=[b,v],I=[u,g],C=[c,p],P=[no(m,180),no(f,240)],L=[Math.max(P[0],no(h,480)),Math.max(P[1],no(y,560))],A=no(x,320),M=[0,0],N=0,R=null;for(let t of(e.style.setProperty("--yisiui-app-shell-content-min-width",`${A}px`),[0,1]))C[t]!==l.current[t]&&(s.current[t]=void 0),l.current[t]=C[t];function $(e){return Math.max(P[e],Math.min(L[e],N-A-M[1-e]))}function T(){for(let t of[0,1]){S[t]&&I[t]?e.style.setProperty(nr[t],`${M[t]}px`):e.style.removeProperty(nr[t]);let i=k[t];i&&(i.setAttribute("aria-valuemin",String(Math.round(P[t]))),i.setAttribute("aria-valuemax",String(Math.round($(t)))),i.setAttribute("aria-valuenow",String(Math.round(M[t]))),i.setAttribute("aria-valuetext",`${Math.round(M[t])}px`),i.setAttribute("aria-disabled",String($(t)<=P[t])))}}function F(){for(let t of[0,1])e.style.removeProperty(nr[t]);N=e.clientWidth;let t=w.getComputedStyle(e);if((N-=(parseFloat(t.paddingLeft)||0)+(parseFloat(t.paddingRight)||0))<=0)return;let i=(M=j.map((t,i)=>{if(!S[i]||!t)return 0;let n=t.getBoundingClientRect().width/(e.getBoundingClientRect().width/e.offsetWidth||1);return I[i]?ns(s.current[i]??n,P[i],L[i]):n})).map((e,t)=>S[t]&&I[t]?e-P[t]:0),n=i[0]+i[1],a=Math.min(n,Math.max(0,M[0]+M[1]+A-N));n>0&&(M=M.map((e,t)=>e-a*i[t]/n)),T()}function E(e){let t=0===e?d.current.onSidebarWidthChange:d.current.onRightPanelWidthChange;t?.(M[e])}function D(t){let i=R;i&&(R=null,i.shield.remove(),e.removeAttribute("data-resizing"),i.handle.removeAttribute("data-active"),i.handle.hasPointerCapture?.(i.pointerId)&&i.handle.releasePointerCapture(i.pointerId),t?M[i.side]!==i.startWidth&&E(i.side):(s.current[i.side]=i.previous,F()))}function _(e){let t=R;if(!t||e.pointerId!==t.pointerId)return;e.preventDefault();let i=0===t.side?1:-1,n=ns(t.startWidth+i*(e.clientX-t.startX)/t.scale,P[t.side],$(t.side));n!==M[t.side]&&(s.current[t.side]=n,M[t.side]=n,T())}let z=[];for(let t of[0,1]){let i=k[t];if(!i)continue;let n=n=>{if(R||0!==n.button||!n.isPrimary||$(t)<=P[t])return;n.preventDefault(),a.activeElement===i&&i.blur(),i.setPointerCapture(n.pointerId);let r=a.createElement("div");r.className="yisi-app-shell-resize-shield",r.setAttribute("aria-hidden","true"),a.body.append(r),R={side:t,pointerId:n.pointerId,handle:i,startX:n.clientX,startWidth:M[t],previous:s.current[t],scale:e.getBoundingClientRect().width/e.offsetWidth||1,shield:r},e.setAttribute("data-resizing",0===t?"sidebar":"right-panel"),i.setAttribute("data-active","true")},r=e=>{if(R)return;let i=(e.shiftKey?32:8)*(0===t?1:-1),n="ArrowLeft"===e.key?M[t]-i:"ArrowRight"===e.key?M[t]+i:"Home"===e.key?P[t]:"End"===e.key?$(t):null;if(null===n)return;e.preventDefault(),e.stopPropagation();let a=ns(n,P[t],$(t));a!==M[t]&&(s.current[t]=a,M[t]=a,T(),E(t))},o=e=>{R?.pointerId===e.pointerId&&D(!1)};i.addEventListener("pointerdown",n),i.addEventListener("keydown",r),i.addEventListener("lostpointercapture",o),z.push(()=>{i.removeEventListener("pointerdown",n),i.removeEventListener("keydown",r),i.removeEventListener("lostpointercapture",o)})}let B=e=>{R?.pointerId===e.pointerId&&(_(e),D(!0))},q=e=>{R?.pointerId===e.pointerId&&D(!1)},O=()=>D(!1),U=e=>{R&&"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),O())},H=()=>{O(),F()};a.addEventListener("pointermove",_,{passive:!1}),a.addEventListener("pointerup",B),a.addEventListener("pointercancel",q),a.addEventListener("keydown",U),w.addEventListener("blur",O),w.addEventListener("resize",H),F();let G=e.clientWidth,W="u"<typeof ResizeObserver?null:new ResizeObserver(()=>{e.clientWidth!==G&&(G=e.clientWidth,H())});return W?.observe(e),()=>{O(),W?.disconnect(),z.forEach(e=>e()),a.removeEventListener("pointermove",_),a.removeEventListener("pointerup",B),a.removeEventListener("pointercancel",q),a.removeEventListener("keydown",U),w.removeEventListener("blur",O),w.removeEventListener("resize",H)}},[c,u,m,h,p,g,f,y,x,b,v]),{rootRef:t,sidebarRef:i,rightPanelRef:n,sidebarHandleRef:r,rightPanelHandleRef:o}}({sidebarWidth:g,sidebarResizable:f,sidebarMinWidth:y,sidebarMaxWidth:x,onSidebarWidthChange:b,rightPanelWidth:C,rightPanelResizable:P,rightPanelMinWidth:L,rightPanelMaxWidth:A,onRightPanelWidthChange:M,contentMinWidth:N,isSidebarVisible:J,isRightPanelVisible:V}),X={"--yisi-app-shell-sidebar-width":nc(g),"--yisi-app-shell-right-panel-width":nc(C),...T};function Q(e){U||B(e),p?.(e)}return(0,n.jsxs)("div",{ref:K.rootRef,...(0,j.S)("app-shell-frame","AppShellFrame","layout"),className:["yisi-app-shell-frame",!J?"yisi-app-shell-frame--sidebar-hidden":null,!V?"yisi-app-shell-frame--right-panel-hidden":null,$].filter(Boolean).join(" "),"data-sidebar-state":J?"open":"closed","data-right-panel-state":G?V?"open":"closed":"absent",style:X,children:[(0,n.jsx)("aside",{ref:K.sidebarRef,id:F,className:"yisi-app-shell-sidebar","aria-label":Y.sidebar,"aria-hidden":!J,children:(0,n.jsxs)("div",{className:"yisi-app-shell-sidebar-content",children:[(0,n.jsxs)("div",{className:"yisi-app-shell-sidebar-top",children:[(0,n.jsxs)("div",{className:"yisi-app-shell-sidebar-heading",children:[t?(0,n.jsx)("div",{className:"yisi-app-shell-sidebar-title",children:t}):(0,n.jsx)("span",{"aria-hidden":"true"}),u&&J?(0,n.jsx)(w.Ay,{className:"yisi-app-shell-sidebar-toggle",type:"text",icon:(0,n.jsx)(nl.D,{ref:D,name:"sidebar-left",size:20}),"aria-label":Y.collapseSidebar,title:Y.collapseSidebar,"aria-expanded":"true","aria-controls":F,onPointerEnter:()=>D.current?.play(),onFocus:()=>D.current?.play(),onClick:()=>Q(!1)}):null]}),i?(0,n.jsx)("nav",{className:"yisi-app-shell-sidebar-navigation","aria-label":Y.navigation,children:i}):null]}),(0,n.jsx)("div",{className:"yisi-app-shell-sidebar-slot",children:e})]})}),J&&f&&(0,n.jsx)("div",{ref:K.sidebarHandleRef,className:"yisi-app-shell-resize-handle yisi-app-shell-resize-handle--sidebar",role:"separator","aria-orientation":"vertical","aria-label":Y.resizeSidebar,"aria-controls":F,tabIndex:0}),(0,n.jsxs)("div",{className:"yisi-app-shell-content",children:[(0,n.jsxs)("header",{className:"yisi-app-shell-content-header",children:[(0,n.jsxs)("div",{className:"yisi-app-shell-content-leading",children:[u&&!J?(0,n.jsx)(w.Ay,{className:"yisi-app-shell-content-toggle",type:"text",icon:(0,n.jsx)(nl.D,{ref:D,name:"sidebar-left",size:20}),"aria-label":Y.expandSidebar,title:Y.expandSidebar,"aria-expanded":"false","aria-controls":F,onPointerEnter:()=>D.current?.play(),onFocus:()=>D.current?.play(),onClick:()=>Q(!0)}):null,u&&!J&&l?(0,n.jsx)("div",{className:"yisi-app-shell-sidebar-collapsed-actions",children:l}):null,s?(0,n.jsx)(w.Ay,{className:"yisi-app-shell-content-back",type:"text",icon:s.icon??(0,n.jsx)(na.A,{}),"aria-label":s.label,title:s.label,onClick:s.onClick}):null]}),r?(0,n.jsx)("div",{className:"yisi-app-shell-content-title",title:"string"==typeof r?r:void 0,children:r}):null,W||G&&v?(0,n.jsxs)("div",{className:"yisi-app-shell-content-trailing",children:[W?(0,n.jsx)("div",{className:"yisi-app-shell-header-extra","data-yisiui-slot":"header-extra",children:o}):null,G&&v?(0,n.jsx)(w.Ay,{className:"yisi-app-shell-right-panel-toggle",type:"text",icon:(0,n.jsx)(nl.D,{ref:_,name:"sidebar-right",size:20}),"aria-label":V?Y.collapseRightPanel:Y.expandRightPanel,title:V?Y.collapseRightPanel:Y.expandRightPanel,"aria-expanded":V,"aria-controls":E,onPointerEnter:()=>_.current?.play(),onFocus:()=>_.current?.play(),onClick:()=>{var e;return e=!V,void(!H&&O(e),I?.(e))}}):null]}):null]}),(0,n.jsx)("div",{className:"yisi-app-shell-content-body",children:c})]}),V&&P&&(0,n.jsx)("div",{ref:K.rightPanelHandleRef,className:"yisi-app-shell-resize-handle yisi-app-shell-resize-handle--right-panel",role:"separator","aria-orientation":"vertical","aria-label":Y.resizeRightPanel,"aria-controls":E,tabIndex:0}),G?(0,n.jsx)("aside",{ref:K.rightPanelRef,id:E,className:"yisi-app-shell-right-panel","aria-label":Y.rightPanel,"aria-hidden":!V,children:d}):null]})}i(15682);let nm={productName:"human2ai",sidebar:"Human2AI 应用侧栏",navigation:"Human2AI 应用导航",collapseSidebar:"收起应用侧栏",expandSidebar:"展开应用侧栏",resizeSidebar:"调整应用侧栏宽度",rightPanel:"页面属性",collapseRightPanel:"收起页面属性",expandRightPanel:"展开页面属性",resizeRightPanel:"调整操作面板宽度"};function nh({title:e,titleExtra:t,headerExtra:i,brand:a,children:r,sidebar:o,rightPanel:s,rightPanelOpen:l,onRightPanelOpenChange:d,sidebarWidth:c=280,rightPanelWidth:u=300,onSidebarWidthChange:m,onRightPanelWidthChange:h,labels:p,className:g}){let f={...nm,...p};return(0,n.jsx)("div",{...(0,$.Se)({namespace:"human2ai",id:"app-shell",name:"Human2AiAppShell",category:"layout",origin:"project",status:"candidate"}),className:["human2ai-app-shell",g].filter(Boolean).join(" "),children:(0,n.jsx)(nu,{sidebar:o,sidebarTitle:a??f.productName,title:e?(0,n.jsxs)("div",{className:"human2ai-app-shell__page-heading",children:[(0,n.jsx)("h1",{className:"human2ai-app-shell__page-title",children:e}),t?(0,n.jsx)("div",{className:"human2ai-app-shell__title-extra",children:t}):null]}):void 0,headerExtra:i,rightPanel:s,rightPanelOpen:l,onRightPanelOpenChange:d,sidebarWidth:c,rightPanelWidth:u,onSidebarWidthChange:m,onRightPanelWidthChange:h,sidebarResizable:!0,rightPanelResizable:!0,labels:f,children:r})})}var np=i(82930),ng=i(6915),nf=i(14766),ny=i(21494),nx=i(81793),nb=i(11075),nv=i(62067),nw=i(48389),nj=i(50152),nk=i(31630),nS=i(88398),nI=i(24909),nC=i(67872),nP=i(40684),nL=i(41103);i(52048),i(68071),i(12190);let nA={default:{},info:{color:"blue",icon:(0,n.jsx)(iK.A,{})},success:{color:"green",icon:(0,n.jsx)(nS.A,{})},warning:{color:"orange",icon:(0,n.jsx)(nI.A,{})},danger:{color:"red",icon:(0,n.jsx)(nC.A,{})},processing:{color:"processing",icon:(0,n.jsx)(nP.A,{})}};function nM({label:e,tone:t="default",icon:i,mode:a="icon-text",tooltip:r}){let o=nA[t],s=i??o.icon,l=(0,n.jsx)(nL.A,{...(0,j.S)("status-badge","StatusBadge","component"),className:`yisi-status-badge yisi-status-badge-${a}`,color:o.color,icon:"text-only"===a?void 0:s,"aria-label":"icon-only"===a&&"string"==typeof e?e:void 0,children:"icon-only"===a?(0,n.jsx)("span",{className:"yisi-status-badge-visually-hidden",children:e}):e});return(0,n.jsx)(_.A,{title:void 0===r?e:r,children:l})}function nN(e){let t=window.matchMedia("(prefers-reduced-motion: reduce)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function nR(e,t,i=!1){return[...new Set([...Object.keys(e),...Object.keys(t)])].every(n=>!!i&&("order"===n||"parentKey"===n)||("status"===n?e.status?.label===t.status?.label&&e.status?.tone===t.status?.tone&&e.status?.icon===t.status?.icon:"extraClassNames"===n?e[n]?.join(" ")===t[n]?.join(" "):Object.is(e[n],t[n])))}function n$(e){let t=new Map;for(let i of e){let e=t.get(i.parentKey)??[];e.push(i),t.set(i.parentKey,e)}for(let e of t.values())e.sort((e,t)=>e.order-t.order||e.title.localeCompare(t.title)||e.key.localeCompare(t.key));return t}function nT(e,t,i){let n=new Map(e.map(e=>[e.node.key,e])),a=new Map;for(let e of t){let t=n.get(e.key),r=t&&nR(t.node,e)?t.node:e,o=i?t&&"exit"!==t.phase?t.node.title!==r.title&&"enter"!==t.phase?"rename":t.phase:"enter":"idle",s=t?t.phase!==o||t.node.title!==r.title?t.revision+1:t.revision:0;a.set(r.key,t&&t.node===r&&t.phase===o?t:{node:r,phase:o,revision:s})}let r=new Map([...n$(t)].map(([e,t])=>[e,t.map(e=>a.get(e.key))]));if(i)for(let t=e.length-1;t>=0;t--){let i=e[t];if(a.has(i.node.key))continue;let n="exit"===i.phase?i:{...i,phase:"exit",revision:i.revision+1},o=r.get(i.node.parentKey)??[],s=e.slice(t+1).find(e=>e.node.parentKey===i.node.parentKey&&o.some(t=>t.node.key===e.node.key)),l=s?o.findIndex(e=>e.node.key===s.node.key):o.length;o.splice(l,0,n),r.set(i.node.parentKey,o)}let o=[],s=new Set;return!function e(t){for(let i of r.get(t)??[])s.has(i.node.key)||(s.add(i.node.key),o.push(i),e(i.node.key))}(null),o}i(63159);let{Text:nF}=nj.A,nE=new Intl.Segmenter(void 0,{granularity:"grapheme"});function nD(e){return Array.from(nE.segment(e),e=>e.segment)}let n_=(0,a.memo)(function({text:e,fullText:t,phase:i,revision:r}){let[o,s]=(0,a.useState)(e);return(0,a.useLayoutEffect)(()=>{let t;if("enter"!==i&&"rename"!==i)return void s(e);let n=nD(e);if(s(""),!n.length)return;let a=0,r=Math.min(32,480/n.length);return t=setTimeout(function e(){a++,s(n.slice(0,a).join("")),a<n.length&&(t=setTimeout(e,r))},180*("enter"===i)+r),()=>clearTimeout(t)},[e,i,r]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"yisi-asset-skeleton-tree-state-announcement",children:t}),(0,n.jsx)("span",{"aria-hidden":"true",className:"yisi-asset-skeleton-tree-visible-title",children:o||"\xa0"})]})});function nz(e){return e.isLeaf?null:(0,n.jsx)(nw.A,{className:"yisi-asset-skeleton-tree-switcher",rotate:90*!!e.expanded})}function nB({dropPosition:e,dropLevelOffset:t,indent:i}){var a;return 0===e?null:(a={...-1===e?{top:0}:{bottom:0},left:-t*i,right:0},(0,n.jsxs)("span",{"aria-hidden":"true",className:"yisi-asset-skeleton-tree-drop-indicator",style:a,children:[(0,n.jsx)("span",{className:"yisi-asset-skeleton-tree-drop-indicator-dot"}),(0,n.jsx)("span",{className:"yisi-asset-skeleton-tree-drop-indicator-line"})]}))}let nq=(0,a.memo)(function({node:e,phase:t,revision:i,mode:r,maxTitleLength:o,isCurrent:s,shouldShowLock:l,shouldShowStatus:d}){var c;let u,m=(0,a.useRef)(null);(0,a.useLayoutEffect)(()=>{let e=m.current?.closest(".ant-tree-treenode");if(!e||("exit"===t&&e.contains(document.activeElement)&&e.closest(".ant-tree")?.querySelector('[role="tree"]')?.focus({preventScroll:!0}),e.inert="exit"===t,"enter"!==t&&"exit"!==t||!e.animate))return;let i=e.getBoundingClientRect().height,n=getComputedStyle(e),a={height:`${i}px`,minHeight:"0px",overflow:"hidden",marginTop:n.marginTop,marginBottom:n.marginBottom},r={height:"0px",minHeight:"0px",overflow:"hidden",marginTop:"0px",marginBottom:"0px",opacity:0},o="enter"===t?[r,{...a,opacity:0,offset:.75},{...a,opacity:1}]:[{...a,opacity:1},{...a,opacity:0,offset:.4},r],s=e.animate(o,{duration:"enter"===t?240:300,easing:"ease-in-out",fill:"both"});return()=>{s.cancel(),e.inert=!1}},[t]);let h="edit"===r,p=(c=e.title,(u=nD(c.trim())).length<=o?c:`${u.slice(0,Math.max(1,o-1)).join("")}…`),g=!!(e.trailing||s||d&&e.status);return(0,n.jsxs)("div",{ref:m,className:["yisi-asset-skeleton-tree-node",`yisi-asset-skeleton-tree-node-${r}`,`yisi-asset-skeleton-tree-node-${e.nodeKind}`,e.isDeleted?"yisi-asset-skeleton-tree-node-deleted":""].filter(Boolean).join(" "),title:e.title,children:[e.isChanged?(0,n.jsx)("span",{className:"yisi-asset-skeleton-tree-state-announcement",children:"已变动"}):null,h&&e.isDeleted?(0,n.jsx)(nM,{label:"[del]",tone:"danger",mode:"text-only"}):h&&e.isNew?(0,n.jsx)(nM,{label:"[new]",tone:"success",mode:"text-only"}):null,l&&e.locked?(0,n.jsx)(nM,{label:"锁定",tone:"warning",mode:"text-only",tooltip:e.lockedReason||"已锁定"}):null,(0,n.jsx)("div",{className:"yisi-asset-skeleton-tree-copy",children:(0,n.jsx)(nF,{strong:"container"===e.nodeKind,ellipsis:!0,title:e.title,className:"yisi-asset-skeleton-tree-title",children:(0,n.jsx)(n_,{text:p,fullText:e.title,phase:t,revision:i})})}),"container"===e.nodeKind&&e.description?(0,n.jsx)(nF,{ellipsis:!0,title:e.description,className:"yisi-asset-skeleton-tree-description",children:e.description}):null,g?(0,n.jsxs)("span",{className:"yisi-asset-skeleton-tree-trailing-area",children:[e.trailing?(0,n.jsx)("span",{className:"yisi-asset-skeleton-tree-trailing",children:e.trailing}):null,s?(0,n.jsx)(nM,{label:"当前",tone:"success",mode:"text-only"}):null,d&&e.status?(0,n.jsx)(nM,{label:e.status.label,tone:e.status.tone,icon:e.status.icon,mode:e.status.icon?"icon-only":"text-only"}):null]}):null]})},(e,t)=>nR(e.node,t.node,!0)&&e.phase===t.phase&&e.revision===t.revision&&e.mode===t.mode&&e.maxTitleLength===t.maxTitleLength&&e.isCurrent===t.isCurrent&&e.shouldShowLock===t.shouldShowLock&&e.shouldShowStatus===t.shouldShowStatus);function nO({nodes:e,animateChanges:t=!0,mode:i,className:r,currentKey:o=null,maxTitleLength:s=24,showCurrent:l,showContentOrder:d=!0,showLock:c,showStatus:u,canDragNode:m,switcherIcon:h,allowDrop:p,dropIndicatorRender:g,onDragStart:f,onDragEnd:y,onDragLeave:x,onDragOver:b,onDrop:v,...w}){let k=(0,a.useRef)(null),S=(0,a.useSyncExternalStore)(nN,()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches,()=>!0),I=function(e,t){let[i,n]=(0,a.useState)(()=>({nodes:e,animate:t,entries:nT([],e,!1)})),r=(0,a.useRef)(new Map),o=i.entries;return(i.nodes!==e||i.animate!==t)&&(o=nT(i.entries,e,t),n({nodes:e,animate:t,entries:o})),(0,a.useEffect)(()=>{let e=new Map(o.filter(e=>"idle"!==e.phase).map(e=>[e.node.key,e]));for(let[t,i]of r.current)e.get(t)?.revision!==i.revision&&(clearTimeout(i.timer),r.current.delete(t));for(let[t,i]of e){if(r.current.has(t))continue;let e=setTimeout(()=>{r.current.delete(t),n(e=>({...e,entries:e.entries.flatMap(e=>e.node.key!==t||e.revision!==i.revision?[e]:"exit"===e.phase?[]:[{...e,phase:"idle"}])}))},"exit"===i.phase?300:480+180*("enter"===i.phase));r.current.set(t,{revision:i.revision,timer:e})}},[o]),(0,a.useEffect)(()=>()=>{for(let e of r.current.values())clearTimeout(e.timer);r.current.clear()},[]),o}(e,t&&!S),[C,P]=(0,a.useState)(null),L=(0,a.useRef)(1),[A,M]=(0,a.useState)(null),N=(0,a.useRef)(null),R=(0,a.useRef)(null),$=l??"view"===i,T=c??"edit"===i,F=u??"view"===i,E=(0,a.useMemo)(()=>{let t,i,n;return t=n$(e),i=new Map,n=1,!function e(a){for(let r of t.get(a)??[])"content"!==r.nodeKind||r.isDeleted||(i.set(r.key,String(n).padStart(2,"0")),n+=1),e(r.key)}(null),i},[e]),D=(0,a.useMemo)(()=>new Map(e.map(e=>[e.key,e])),[e]),_="edit"===i?t=>(function(e,{dragNode:t,dropNode:i,dropPosition:n}){let a=new Map(e.map(e=>[e.key,e])),r=a.get(String(t.key)),o=a.get(String(i.key)),s=r?.nodeKind==="content"&&o?.nodeKind==="content"&&o.locked&&1===n;if(!r||!o||r.key===o.key||r.disabled||r.locked||r.isDeleted||o.disabled||o.isDeleted||o.locked&&!s)return!1;let l=o.parentKey;for(;null!==l;){if(l===r.key)return!1;l=a.get(l)?.parentKey??null}return"content"===r.nodeKind?"container"===o.nodeKind?0===n:"content"===o.nodeKind&&0!==n:"container"===o.nodeKind&&(0===n||r.parentKey===o.parentKey)})(e,t)&&(p?.(t)??!0):p;(0,a.useEffect)(()=>()=>{null!==N.current&&window.clearTimeout(N.current),null!==R.current&&window.clearTimeout(R.current)},[]);let z=(0,a.useMemo)(()=>{let e=new Map;for(let t of I){let i=e.get(t.node.parentKey)??[];i.push(t),e.set(t.node.parentKey,i)}return function t(a){return(e.get(a)??[]).map(({node:e,phase:a,revision:r})=>{let l=t(e.key),c="exit"===a;return{key:e.key,title:(0,n.jsx)(nq,{node:e,phase:a,revision:r,mode:i,maxTitleLength:s,isCurrent:$&&o===e.key,shouldShowLock:T,shouldShowStatus:F}),switcherIcon:function(e){if(!d||"content"!==e.nodeKind)return;let t=E.get(e.key);return(0,n.jsx)("span",{className:["yisi-asset-skeleton-tree-content-order",t?"":"yisi-asset-skeleton-tree-content-order-empty"].filter(Boolean).join(" "),"aria-hidden":!t||void 0,children:t?(0,n.jsx)(nM,{label:t,tone:e.contentOrderTone??"default",mode:"text-only",tooltip:`内容顺序 ${t}`}):null})}(e),disabled:!!(e.disabled||c),...c?{selectable:!1,checkable:!1,"aria-hidden":!0}:{},"data-yisi-tree-key":e.key,"data-yisi-tree-phase":a,className:[["yisi-asset-skeleton-tree-item",`yisi-asset-skeleton-tree-item-${e.nodeKind}`,e.locked?"yisi-asset-skeleton-tree-item-locked":"",e.isChanged?"yisi-asset-skeleton-tree-item-changed":"",e.isDeleted?"yisi-asset-skeleton-tree-item-deleted":"",e.isNew?"yisi-asset-skeleton-tree-item-new":"",...e.extraClassNames??[]].filter(Boolean).join(" "),e.key===o?"yisi-asset-skeleton-tree-item-current":"",e.key===A?"yisi-asset-skeleton-tree-item-moved":""].filter(Boolean).join(" "),isLeaf:0===l.length,children:l.length?l:void 0}})}(null)},[I,i,s,$,o,T,F,d,E,A]),B=void 0!==w.activeKey?w.activeKey:C,q=null!=B&&D.has(String(B))?B:null;return(0,n.jsx)("div",{ref:k,onKeyDownCapture:e=>{L.current="ArrowUp"===e.key||"End"===e.key?-1:1},...(0,j.S)("asset-skeleton-tree","AssetSkeletonTree","tree-pattern"),className:["yisi-asset-skeleton-tree",`yisi-asset-skeleton-tree-${i}`,d?"yisi-asset-skeleton-tree-content-order-layout":"",r].filter(Boolean).join(" "),"data-mode":i,onScroll:function(){k.current?.classList.add("yisi-asset-skeleton-tree-scrolling"),null!==N.current&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>{k.current?.classList.remove("yisi-asset-skeleton-tree-scrolling"),N.current=null},700)},children:(0,n.jsx)(nk.A,{blockNode:!0,...w,className:"yisi-asset-skeleton-tree-control",allowDrop:_,draggable:"edit"===i&&{icon:!1,nodeDraggable:e=>{let t=D.get(String(e.key));return!!(t&&!t.locked&&!t.disabled&&!t.isDeleted&&(m?.(t)??!0))}},dropIndicatorRender:g??nB,expandAction:w.expandAction??"click",onDragStart:"edit"===i?function(e){f?.(e)}:f,onDragEnd:"edit"===i?function(e){y?.(e)}:y,onDragLeave:"edit"===i?function(e){x?.(e)}:x,onDragOver:"edit"===i?function(e){b?.(e)}:b,onDrop:"edit"===i?function(e){M(String(e.dragNode.key)),null!==R.current&&window.clearTimeout(R.current),R.current=window.setTimeout(()=>{M(null),R.current=null},720),v?.(e)}:v,switcherIcon:h??nz,activeKey:q,onActiveChange:function(e){let t=e;if(null!=e&&!D.has(String(e))){let i=[...k.current?.querySelectorAll("[data-yisi-tree-key]")??[]],n=i.findIndex(t=>t.dataset.yisiTreeKey===String(e));t=null;for(let e=1;e<=i.length;e++){let a=i[(n+e*L.current+i.length)%i.length]?.dataset.yisiTreeKey;if(a&&D.has(a)){t=a;break}}}P(t),w.onActiveChange?.(t)},treeData:z})})}var nU=i(37132);i(17346);let nH={bottomLeft:{points:["tl","bl"],offset:[0,-1],overflow:{adjustX:0,adjustY:1},htmlRegion:"scroll"},topLeft:{points:["bl","tl"],offset:[0,1],overflow:{adjustX:0,adjustY:1},htmlRegion:"scroll"}};function nG({value:e,options:t,onChange:i,"aria-label":r,placeholder:o,placement:s="bottom",disabled:l=!1,className:d,style:c}){let[u,m]=(0,a.useState)(!1),h=(0,a.useRef)(null),p=0===t.length,g=l||p;function f(){null!==h.current&&(window.clearTimeout(h.current),h.current=null)}function x(){f(),h.current=window.setTimeout(()=>{h.current=null,m(!1)},120)}function b(){f(),g||m(!0)}return(0,a.useEffect)(()=>{g&&m(!1)},[g]),(0,a.useEffect)(()=>()=>{null!==h.current&&window.clearTimeout(h.current)},[]),(0,n.jsx)("div",{...(0,$.Se)({namespace:"human2ai",id:"compact-dropdown-select",name:"CompactDropdownSelect",category:"switching",origin:"project",status:"candidate"}),className:["human2ai-compact-dropdown-select",d].filter(Boolean).join(" "),"data-open":u?"true":"false","data-placement":s,"data-empty":p?"true":"false",onMouseEnter:b,onMouseLeave:x,style:c,children:(0,n.jsx)(y.A,{"aria-label":r,className:"human2ai-compact-dropdown-select__control",classNames:{content:"human2ai-compact-dropdown-select__value",suffix:"human2ai-compact-dropdown-select__suffix",popup:{root:"human2ai-compact-dropdown-select__popup",list:"human2ai-compact-dropdown-select__list",listItem:"human2ai-compact-dropdown-select__option"}},builtinPlacements:nH,disabled:g,listHeight:240,onChange:function(e){m(!1),i(e)},onOpenChange:function(e){f(),m(!g&&e)},open:u,options:t.map(e=>({...e})),placement:"top"===s?"topLeft":"bottomLeft",placeholder:o,popupMatchSelectWidth:!0,popupRender:e=>(0,n.jsx)("div",{className:"human2ai-compact-dropdown-select__popup-content",onMouseEnter:b,onMouseLeave:x,children:e}),showSearch:!1,suffixIcon:(0,n.jsx)(nU.A,{className:"human2ai-compact-dropdown-select__arrow","aria-hidden":"true"}),value:e,virtual:!1})})}i(80118);let nW=[],nJ={functionArea:"功能区",projectArea:"项目",newComposition:"新建构图",newCompositionInProject:e=>`在“${e}”中新建构图`,newCompositionInGroup:e=>ej.workspaceSidebar.newCompositionInGroup.replace("{{group}}",e),newSpatial:"新建 3D 空间",newSpatialInProject:e=>`在“${e}”中新建 3D 空间`,newSpatialInGroup:e=>ej.spatial.newInGroup.replace("{{group}}",e),spatialSession:"3D 空间",newUiSketch:"新建 UI 界面",newUiSketchInProject:e=>`在“${e}”中新建 UI 界面`,newUiSketchInGroup:e=>ej.workspaceSidebar.newUiSketchInGroup.replace("{{group}}",e),newProject:"新建项目",styleLibrary:"风格库",projectNamePlaceholder:"输入项目名称",createProject:"创建",unassigned:"无项目",containsCurrentSession:ej.workspaceSidebar.containsCurrentSession,imageCompositionSession:"构图会话",uiLayoutSession:"UI 界面会话",sessionActions:"会话操作",projectActions:"项目操作",newSessionGroup:ej.workspaceSidebar.newSessionGroup,sessionGroupName:ej.workspaceSidebar.sessionGroupName,sessionGroupActions:ej.workspaceSidebar.sessionGroupActions,renameSessionGroup:ej.workspaceSidebar.renameSessionGroup,deleteSessionGroup:ej.workspaceSidebar.deleteSessionGroup,deleteSessionGroupDescription:ej.workspaceSidebar.deleteSessionGroupDescription,sessionGroupNameConflict:ej.workspaceSidebar.sessionGroupNameConflict,groupSession:ej.workspaceSidebar.groupSession,ungroupedSessions:ej.workspaceSidebar.ungroupedSessions,rename:"重命名",confirmRename:"确认",move:"移动",moveSessionTitle:"移动会话",selectProject:"选择项目",moveUnavailable:"没有可移动的项目",delete:"删除",projectNameConflict:"项目名称不能重复",renameProjectTitle:"重命名项目",deleteProjectTitle:"删除项目",deleteProjectDescription:"删除后无法恢复。",deleteProjectDisabled:"项目包含子项,无法删除",renameSessionTitle:"重命名会话",renameSessionPlaceholder:"输入会话名称",deleteSessionTitle:"删除会话",deleteSessionDescription:"会话将移入回收站,可在保留期限内恢复。",cancel:"取消",loading:"正在加载项目",loadFailed:"项目列表加载失败",retry:"重试",actionFailed:"操作失败,请重试。"},nV=(0,a.createContext)({action:null,projectId:null,groupId:null});function nY({render:e}){return e((0,a.useContext)(nV))}function nK({projects:e,sessions:t,groups:i=nW,onCreateGroup:r,onRenameGroup:o,onDeleteGroup:s,onGroupSession:l,currentSessionId:d=null,expandedKeys:c,onExpandedKeysChange:u,loading:m=!1,errorMessage:h,labels:p,languageSelector:f,repositoryLink:y,footerExtra:x,onCreateComposition:j,onCreateUiSketch:k,onCreateSpatial:S,onCreateProject:I,onOpenStyleLibrary:C,onRenameProject:P,onDeleteProject:L,onOpenSession:A,onRenameSession:M,onMoveSession:N,onDeleteSession:R,onRetry:T}){let F=(0,a.useMemo)(()=>({...nJ,...p}),[p]),E=(0,a.useRef)(null),[D,z]=(0,a.useState)(!1),[B,q]=(0,a.useState)(""),[O,U]=(0,a.useState)(null),[H,G]=(0,a.useState)(null),[W,J]=(0,a.useState)([]),V=c??W,Y=u??J,[K,X]=(0,a.useState)(null),Q=(0,a.useRef)(new Set),Z=(0,a.useRef)(null),ee=(0,a.useRef)({id:null,done:!1}),[et,ei]=(0,a.useState)(null),[en,ea]=(0,a.useState)(""),[er,eo]=(0,a.useState)(null),[es,el]=(0,a.useState)(null),[ec,eu]=(0,a.useState)(""),[em,eh]=(0,a.useState)(null),[ep,eg]=(0,a.useState)(""),[ef,ey]=(0,a.useState)(null),[ex,eb]=(0,a.useState)(null),[ev,ew]=(0,a.useState)(null),[ej,ek]=(0,a.useState)(""),eS=(0,a.useRef)(null),eI=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>tF(null),[]);let eC=(0,a.useRef)(null),[eP,eL]=(0,a.useState)(null),eA=(0,a.useMemo)(()=>new Set(i.filter(e=>e.projectId===ev?.projectId&&e.id!==ev?.groupId).map(e=>e.name)),[i,ev]).has(ej.trim()),eM=n0(e,B),eN=n0(e,en,et?.id),eR=t.some(e=>null===e.projectId);(0,a.useEffect)(()=>{if(void 0!==c)return;let t=[...e.map(e=>nX(e.id)),...i.map(e=>nQ(e.id)),...eR?["project:unassigned"]:[]],n=t.filter(e=>!Q.current.has(e));Q.current=new Set(t),0!==n.length&&Y(e=>[...new Set([...e,...n])])},[eR,e,i,c,Y]);let e$=(0,a.useCallback)(async(e,t,i)=>{if(l&&!i&&e.projectId&&(!t||t.projectId===e.projectId)){U("group-session"),eb(null);try{await l(e.id,t?.id??null),Y(i=>[...new Set([...i,nX(e.projectId),...t?[nQ(t.id)]:[]])])}catch{eb(F.actionFailed)}finally{U(null)}}},[l,F.actionFailed,Y]),eF=(0,a.useMemo)(()=>({action:O,projectId:H,groupId:K}),[O,H,K]),eE=(0,a.useRef)(new Map),eD=!!r,e_=!!o,ez=!!s,eB=!!l,eq=(0,a.useMemo)(()=>{let a,d,c=new Map;function u(e,t,i){let a=eE.current.get(e),r=a&&a.dependencies.length===t.length&&t.every((e,t)=>Object.is(e,a.dependencies[t]))?a:{dependencies:t,element:(0,n.jsx)(nY,{render:i})};return c.set(e,r),r.element}let m=[F,j,k,S],h=t=>u(nZ(t.id),[t,F,e.every(e=>e.id===t.projectId),eB,e$,...i.filter(e=>e.projectId===t.projectId).flatMap(e=>[e.id,e.name,e.sessionIds.includes(t.id)])],a=>{var r;let o,s,d;return r=t,o=a.action,s=e.every(e=>e.id===r.projectId),d=[{key:"rename",label:F.rename},...l&&r.projectId?[{key:"group",label:F.groupSession,disabled:!!o,children:[{key:"ungroup",label:F.ungroupedSessions,disabled:!i.some(e=>e.sessionIds.includes(r.id))},...i.filter(e=>e.projectId===r.projectId).map(e=>({key:nQ(e.id),label:e.name,disabled:e.sessionIds.includes(r.id)}))]}]:[],{key:"move",label:F.move,disabled:s,title:s?F.moveUnavailable:void 0},{key:"delete",label:F.delete,danger:!0}],(0,n.jsx)(g.A,{trigger:["click"],menu:{items:d,onClick:({key:e,domEvent:t})=>{t.stopPropagation(),eb(null),"ungroup"===e||e.startsWith("group:")?e$(r,"ungroup"===e?null:i.find(t=>nQ(t.id)===e)??null,!!o):"rename"===e?(el(r),eu(r.title)):"move"!==e||s?"delete"===e&&ey(r):(eh(r),eg(""))}},children:(0,n.jsx)(w.Ay,{className:"human2ai-workspace-sidebar__node-menu",type:"text",size:"small",icon:(0,n.jsx)(i2.A,{}),"aria-label":`${r.title}:${F.sessionActions}`,title:F.sessionActions,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})})}),p=new Map(e.map(e=>[nX(e.id),e])),f=new Map(t.map(e=>[nZ(e.id),e])),y=new Map(i.map(e=>[nQ(e.id),e])),x=new Map(i.flatMap(e=>e.sessionIds.map(t=>[t,e])));return{nodes:(a=e.flatMap((e,a)=>[{key:nX(e.id),parentKey:null,order:a,nodeKind:"container",title:e.name,trailing:u(nX(e.id),[e,...m,eD,t.some(t=>t.projectId===e.id)],i=>{var a,o,s;let l,d,c;return a=e,o=i,(0,n.jsxs)("span",{className:"human2ai-workspace-sidebar__project-actions",children:[eW(a.id,a.name,void 0,o),(s=a,l=o.action,d=t.some(e=>e.projectId===s.id),c=[...r?[{key:"create-group",label:F.newSessionGroup,disabled:!!l}]:[],{key:"rename",label:F.rename},{key:"delete",label:F.delete,danger:!0,disabled:d,title:d?F.deleteProjectDisabled:void 0}],(0,n.jsx)(g.A,{trigger:["click"],menu:{items:c,onClick:({key:e,domEvent:t})=>{t.stopPropagation(),eb(null),"create-group"===e?(ew({projectId:s.id}),ek("")):"rename"===e?(ei(s),ea(s.name)):"delete"!==e||d||eo(s)}},children:(0,n.jsx)(w.Ay,{className:"human2ai-workspace-sidebar__node-menu",type:"text",size:"small",icon:(0,n.jsx)(i2.A,{}),"aria-label":`${s.name}:${F.projectActions}`,title:F.projectActions,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}))]})})},...i.filter(t=>t.projectId===e.id).map((t,i)=>({key:nQ(t.id),parentKey:nX(e.id),order:i,nodeKind:"container",title:t.name,trailing:u(nQ(t.id),[t,...m,e_,ez],e=>{var i,a,r;let l;return i=t,a=e,(0,n.jsxs)("span",{className:"human2ai-workspace-sidebar__project-actions",children:[eW(i.projectId,i.name,i.id,a),(r=i,l=a.action,(0,n.jsx)(g.A,{trigger:["click"],menu:{items:[{key:"rename",label:F.rename,disabled:!o||!!l},{key:"delete",label:F.delete,danger:!0,disabled:!s||!!l}],onClick:({key:e,domEvent:t})=>{t.stopPropagation(),eb(null),"rename"===e?(ew({projectId:r.projectId,groupId:r.id}),ek(r.name)):"delete"===e&&eL(r)}},children:(0,n.jsx)(w.Ay,{className:"human2ai-workspace-sidebar__node-menu",type:"text",size:"small",icon:(0,n.jsx)(i2.A,{}),"aria-label":`${r.name}:${F.sessionGroupActions}`,title:F.sessionGroupActions,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}))]})}),extraClassNames:["human2ai-workspace-sidebar__group"]})),...t.filter(t=>t.projectId===e.id).map((t,n)=>({key:nZ(t.id),parentKey:x.get(t.id)?.projectId===e.id?nQ(x.get(t.id).id):nX(e.id),order:i.length+n,nodeKind:"content",title:t.title,trailing:h(t)}))]),0===(d=t.filter(e=>null===e.projectId).map((e,t)=>({key:nZ(e.id),parentKey:"project:unassigned",order:t,nodeKind:"content",title:e.title,trailing:h(e)}))).length?a:[...a,{key:"project:unassigned",parentKey:null,order:e.length,nodeKind:"container",title:F.unassigned},...d]),projectsByKey:p,sessionsByKey:f,groupsByKey:y,groupBySession:x,actions:c}},[e,t,i,F,j,k,S,eD,e_,ez,eB,e$]);(0,a.useLayoutEffect)(()=>{eE.current=eq.actions},[eq]);let eO=d?eq.sessionsByKey.get(nZ(d)):void 0,eU=eO?eq.groupBySession.get(eO.id):void 0,eH=(eO?[eO.projectId?nX(eO.projectId):"project:unassigned",...eU&&eU.projectId===eO.projectId?[nQ(eU.id)]:[]]:[]).find(e=>!V.includes(e))??null;(0,a.useEffect)(()=>{let e;if(ee.current.id!==d&&(ee.current={id:d,done:!1}),!d||m||h||null===c||ee.current.done||!eq.sessionsByKey.get(nZ(d)))return;let t=eH??nZ(d),i=()=>{let n=Z.current?.querySelector(".yisi-asset-skeleton-tree");if(!n)return;if(n.querySelector(".ant-tree-treenode-motion")){e=requestAnimationFrame(i);return}let a=n.querySelector(`[data-session-tree-key="${CSS.escape(t)}"]`)?.closest(".ant-tree-treenode");if(!a)return;let r=n.getBoundingClientRect(),o=a.getBoundingClientRect(),s=r.top+n.clientTop,l=o.top-(s+n.clientHeight/4);l&&(n.scrollTop+=l),ee.current.done=!0};return e=requestAnimationFrame(i),()=>cancelAnimationFrame(e)},[d,m,h,eq,V,c,eH]);let eG=(0,a.useMemo)(()=>{let{nodes:e,projectsByKey:t,sessionsByKey:i,groupsByKey:a,groupBySession:r}=eq;return(0,n.jsx)(nO,{nodes:e,mode:"view",titleRender:e=>{let o=String(e.key),s=i.get(o),l=a.get(o),d=t.get(o),c=l?.projectId??d?.id,u=()=>{let e=eI.current?i.get(nZ(eI.current)):void 0;return!!(eB&&!O&&e?.projectId&&e.projectId===c&&(r.get(e.id)?.id??null)!==(l?.id??null))};return(0,n.jsxs)("div",{className:"human2ai-workspace-sidebar__tree-node","data-session-tree-key":o,"aria-label":s?.title??l?.name??d?.name??F.unassigned,draggable:!!(s?.projectId&&!O),onDragStart:e=>{!s?.projectId||e.target.closest("button")?e.preventDefault():(eI.current=s.id,tF(s.id,e.dataTransfer),e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setData(tR,s.id),e.dataTransfer.setData("text/plain",s.title),e.stopPropagation())},onDragOver:e=>{u()&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move",eC.current!==e.currentTarget&&eJ(),eC.current=e.currentTarget,e.currentTarget.dataset.dropTarget="true")},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||eJ()},onDrop:e=>{if(!u()||!eI.current)return;e.preventDefault(),e.stopPropagation();let t=eI.current;eI.current=null,eJ();let n=i.get(nZ(t));n&&e$(n,l??null,!!O)},onDragEnd:()=>{eI.current=null,tF(null),eJ()},children:[(0,n.jsx)("span",{className:"human2ai-workspace-sidebar__tree-node-label",children:"function"==typeof e.title?e.title(e):e.title}),o===eH?(0,n.jsx)("span",{className:"human2ai-workspace-sidebar__current-dot",role:"img","aria-label":F.containsCurrentSession}):null]})},defaultExpandAll:!0,defaultExpandParent:!1,autoExpandParent:!1,showContentOrder:!1,showCurrent:!1,showIcon:!0,showStatus:!1,expandedKeys:V,onExpand:e=>Y(e.map(String)),icon:({eventKey:e})=>{var t,r;let o,s,l=i.get(String(e));return l?(t=l.sessionType,r=F,o="image-composition"===t,s="spatial"===t?r.spatialSession:o?r.imageCompositionSession:r.uiLayoutSession,(0,n.jsx)("span",{className:"human2ai-workspace-sidebar__session-type-icon","data-session-type":t,role:"img","aria-label":s,title:s,children:"spatial"===t?(0,n.jsx)(nf.A,{"aria-hidden":"true"}):o?(0,n.jsx)(tS.A,{"aria-hidden":"true"}):(0,n.jsx)(ng.A,{"aria-hidden":"true"})})):a.has(String(e))?(0,n.jsx)(np.A,{"aria-hidden":"true"}):null},currentKey:d?nZ(d):null,selectedKeys:d?[nZ(d)]:[],onSelect:e=>{let t=String(e[0]??"");t.startsWith("session:")&&A(t.slice(8))}})},[eq,F,O,A,eB,e$,d,V,eH,Y]);function eW(e,t,i,a){let{action:r,projectId:o,groupId:s}=a,l=i?F.newCompositionInGroup(t):F.newCompositionInProject(t),d=i?F.newUiSketchInGroup(t):F.newUiSketchInProject(t),c=i?F.newSpatialInGroup(t):F.newSpatialInProject(t),u=o===e&&s===(i??null);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_.A,{title:l,children:(0,n.jsx)(w.Ay,{className:"human2ai-workspace-sidebar__node-action",type:"text",size:"small",icon:(0,n.jsx)(tS.A,{"aria-hidden":"true"}),"aria-label":l,loading:"composition"===r&&u,disabled:!!(r&&("composition"!==r||!u)),onClick:t=>{t.stopPropagation(),eK(e,i)},onPointerDown:e=>e.stopPropagation()})}),(0,n.jsx)(_.A,{title:d,children:(0,n.jsx)(w.Ay,{className:"human2ai-workspace-sidebar__node-action",type:"text",size:"small",icon:(0,n.jsx)(ng.A,{"aria-hidden":"true"}),"aria-label":d,loading:"ui-sketch"===r&&u,disabled:!!(r&&("ui-sketch"!==r||!u)),onClick:t=>{t.stopPropagation(),eX(e,i)},onPointerDown:e=>e.stopPropagation()})}),S&&(0,n.jsx)(_.A,{title:c,children:(0,n.jsx)(w.Ay,{className:"human2ai-workspace-sidebar__node-action",type:"text",size:"small",icon:(0,n.jsx)(nf.A,{}),"aria-label":c,loading:"spatial"===r&&u,disabled:!!(r&&("spatial"!==r||!u)),onClick:t=>{t.stopPropagation(),eQ(e,i)},onPointerDown:e=>e.stopPropagation()})})]})}function eJ(){eC.current&&delete eC.current.dataset.dropTarget,eC.current=null}async function eV(){if(ev&&ej.trim()&&!eA&&!O){U("save-group"),eb(null);try{ev.groupId?await o?.(ev.groupId,ej.trim()):await r?.(ev.projectId,ej.trim()),e0(ev.projectId),ew(null)}catch(e){eb(e&&"object"==typeof e&&"code"in e&&"SESSION_GROUP_NAME_CONFLICT"===e.code?F.sessionGroupNameConflict:F.actionFailed)}finally{U(null)}}}async function eY(){if(eP&&s&&!O){U("delete-group"),eb(null);try{await s(eP.id),e0(eP.projectId),eL(null)}catch{eb(F.actionFailed)}finally{U(null)}}}async function eK(e,t){e0(e,t),U("composition"),G(e??null),X(t??null),eb(null);try{await j(e,t)}catch{eb(F.actionFailed)}finally{U(null),G(null),X(null)}}async function eX(e,t){e0(e,t),U("ui-sketch"),G(e??null),X(t??null),eb(null);try{await k(e,t)}catch{eb(F.actionFailed)}finally{U(null),G(null),X(null)}}async function eQ(e,t){e0(e,t),U("spatial"),G(e??null),X(t??null),eb(null);try{await S?.(e,t)}catch{eb(F.actionFailed)}finally{U(null),G(null),X(null)}}async function eZ(){let e=B.trim();if(e&&!eM&&!O){U("create-project"),eb(null);try{await I(e),z(!1),q("")}catch(e){eb(n1(e,F))}finally{U(null)}}}function e0(e,t){let i=[e?nX(e):"project:unassigned",...t?[nQ(t)]:[]];Y(e=>{let t=i.filter(t=>!e.includes(t));return t.length?[...e,...t]:e})}async function e1(){let e=en.trim();if(et&&e&&!eN&&!O){U("rename-project"),eb(null);try{await P(et.id,e),ei(null)}catch(e){eb(n1(e,F))}finally{U(null)}}}async function e2(){if(er&&!O){U("delete-project"),eb(null);try{await L(er.id),eo(null)}catch(e){eb(n1(e,F))}finally{U(null)}}}async function e3(){let e=ec.trim();if(es&&e&&!O){U("rename-session"),eb(null);try{await M(es.id,e),el(null)}catch{eb(F.actionFailed)}finally{U(null)}}}async function e5(){if(em&&ep&&!O){U("move-session"),eb(null);try{await N(em.id,ep),eh(null),eg("")}catch{eb(F.actionFailed)}finally{U(null)}}}async function e8(){if(ef&&!O){U("delete-session"),eb(null);try{await R(ef.id),ey(null)}catch{eb(F.actionFailed)}finally{U(null)}}}return(0,n.jsxs)("div",{...(0,$.Se)({namespace:"human2ai",id:"workspace-sidebar",name:"Human2AiWorkspaceSidebar",category:"module",origin:"project",status:"candidate"}),className:"human2ai-workspace-sidebar",ref:Z,children:[(0,n.jsxs)("section",{className:"human2ai-workspace-sidebar__actions","aria-labelledby":"human2ai-sidebar-actions-title","aria-busy":m,children:[(0,n.jsx)("h2",{id:"human2ai-sidebar-actions-title",children:F.functionArea}),m?(0,n.jsx)(ia.G,{className:"human2ai-workspace-sidebar__actions-loading",label:F.loading,rows:S?4:3,compact:!0}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eT.u,{icon:(0,n.jsx)(tS.A,{"aria-hidden":"true"}),label:F.newComposition,collapsedLabel:F.newComposition,loading:"composition"===O&&null===H,disabled:!!(O&&("composition"!==O||null!==H)),onClick:()=>void eK()}),(0,n.jsx)(eT.u,{icon:(0,n.jsx)(ng.A,{"aria-hidden":"true"}),label:F.newUiSketch,collapsedLabel:F.newUiSketch,loading:"ui-sketch"===O&&null===H,disabled:!!(O&&("ui-sketch"!==O||null!==H)),onClick:()=>void eX()}),S&&(0,n.jsx)(eT.u,{icon:(0,n.jsx)(nf.A,{"aria-hidden":"true"}),label:F.newSpatial,collapsedLabel:F.newSpatial,loading:"spatial"===O&&null===H,disabled:!!(O&&"spatial"!==O),onClick:()=>void eQ()}),(0,n.jsx)(eT.u,{icon:(0,n.jsx)(ny.A,{"aria-hidden":"true"}),label:F.newProject,collapsedLabel:F.newProject,disabled:!!O,onClick:function(){eb(null),z(!0)}}),(0,n.jsx)(eT.u,{icon:(0,n.jsx)(nx.A,{"aria-hidden":"true"}),label:F.styleLibrary,collapsedLabel:F.styleLibrary,onClick:C})]}),!ex||ev||eP||D||et||er||es||em||ef?null:(0,n.jsx)("p",{className:"human2ai-workspace-sidebar__error",role:"alert",children:ex})]}),(0,n.jsxs)("section",{className:"human2ai-workspace-sidebar__projects","aria-labelledby":"human2ai-sidebar-projects-title","aria-busy":m,children:[(0,n.jsx)("h2",{id:"human2ai-sidebar-projects-title",children:F.projectArea}),m?(0,n.jsx)(ia.G,{className:"human2ai-workspace-sidebar__loading",label:F.loading,compact:!0}):h?(0,n.jsxs)("div",{className:"human2ai-workspace-sidebar__state",role:"alert",children:[(0,n.jsx)("span",{children:F.loadFailed}),T?(0,n.jsx)(w.Ay,{type:"text",size:"small",icon:(0,n.jsx)(nb.A,{}),onClick:T,children:F.retry}):null]}):(0,n.jsx)(nV.Provider,{value:eF,children:eG})]}),f||y||x?(0,n.jsxs)("div",{className:"human2ai-workspace-sidebar__language-selector",children:[x,y?(0,n.jsx)(ed.J,{className:"human2ai-workspace-sidebar__repository-link",mode:"icon-only",icon:(0,n.jsx)(nv.A,{"aria-hidden":"true"}),iconLabel:y.label,title:y.label,href:y.href,target:"_blank",rel:"noopener noreferrer",backgroundColor:"none"}):null,f?(0,n.jsx)(nG,{...f}):null]}):null,(0,n.jsxs)(v.A,{open:!!ev,title:ev?.groupId?F.renameSessionGroup:F.newSessionGroup,okText:ev?.groupId?F.confirmRename:F.createProject,cancelText:F.cancel,confirmLoading:"save-group"===O,okButtonProps:{disabled:!ej.trim()||eA},afterOpenChange:e=>{e&&eS.current?.focus()},onOk:()=>void eV(),onCancel:()=>{O||(ew(null),eb(null))},children:[(0,n.jsx)(b.A,{ref:eS,value:ej,maxLength:200,disabled:!!O,placeholder:F.sessionGroupName,"aria-label":F.sessionGroupName,status:eA?"error":void 0,"aria-invalid":eA,"aria-describedby":eA||ex?"human2ai-group-name-error":void 0,onChange:e=>{ek(e.target.value),eb(null)},onPressEnter:()=>void eV()}),eA||ex?(0,n.jsx)("p",{id:"human2ai-group-name-error",className:"human2ai-workspace-sidebar__error",role:"alert",children:eA?F.sessionGroupNameConflict:ex}):null]}),(0,n.jsxs)(v.A,{open:!!eP,title:F.deleteSessionGroup,okText:F.delete,cancelText:F.cancel,okButtonProps:{danger:!0},confirmLoading:"delete-group"===O,onOk:()=>void eY(),onCancel:()=>{O||(eL(null),eb(null))},children:[(0,n.jsx)("p",{children:eP?.name}),(0,n.jsx)("p",{children:F.deleteSessionGroupDescription}),ex?(0,n.jsx)("p",{className:"human2ai-workspace-sidebar__error",role:"alert",children:ex}):null]}),(0,n.jsxs)(v.A,{open:D,title:F.newProject,okText:F.createProject,footer:(e,{OkBtn:t})=>(0,n.jsx)(t,{}),confirmLoading:"create-project"===O,okButtonProps:{disabled:!B.trim()||eM},afterOpenChange:e=>{e&&E.current?.focus()},onOk:()=>void eZ(),onCancel:function(){"create-project"!==O&&(z(!1),q(""),eb(null))},children:[(0,n.jsx)(b.A,{ref:E,id:"human2ai-project-name",name:"projectName",value:B,maxLength:200,disabled:"create-project"===O,status:eM?"error":void 0,placeholder:F.projectNamePlaceholder,"aria-label":F.projectNamePlaceholder,"aria-invalid":eM,"aria-describedby":eM||ex?"human2ai-project-name-error":void 0,onChange:e=>{q(e.target.value),eb(null)},onPressEnter:()=>void eZ()}),eM||ex?(0,n.jsx)("p",{id:"human2ai-project-name-error",className:"human2ai-workspace-sidebar__error",role:"alert",children:eM?F.projectNameConflict:ex}):null]}),(0,n.jsxs)(v.A,{open:!!et,title:F.renameProjectTitle,okText:F.confirmRename,footer:(e,{OkBtn:t})=>(0,n.jsx)(t,{}),confirmLoading:"rename-project"===O,okButtonProps:{disabled:!en.trim()||eN},onOk:()=>void e1(),onCancel:()=>{"rename-project"!==O&&ei(null)},children:[(0,n.jsx)(b.A,{autoFocus:!0,id:"human2ai-project-rename",name:"projectName",value:en,maxLength:200,disabled:"rename-project"===O,status:eN?"error":void 0,placeholder:F.projectNamePlaceholder,"aria-label":F.projectNamePlaceholder,"aria-invalid":eN,"aria-describedby":eN||ex?"human2ai-project-rename-error":void 0,onChange:e=>{ea(e.target.value),eb(null)},onPressEnter:()=>void e1()}),eN||ex?(0,n.jsx)("p",{id:"human2ai-project-rename-error",className:"human2ai-workspace-sidebar__error",role:"alert",children:eN?F.projectNameConflict:ex}):null]}),(0,n.jsxs)(v.A,{open:!!er,title:F.deleteProjectTitle,okText:F.delete,cancelText:F.cancel,confirmLoading:"delete-project"===O,okButtonProps:{danger:!0},onOk:()=>void e2(),onCancel:()=>{"delete-project"!==O&&eo(null)},children:[(0,n.jsx)("p",{children:er?.name}),(0,n.jsx)("p",{children:F.deleteProjectDescription}),ex?(0,n.jsx)("p",{className:"human2ai-workspace-sidebar__error",role:"alert",children:ex}):null]}),(0,n.jsxs)(v.A,{open:!!es,title:F.renameSessionTitle,okText:F.confirmRename,footer:(e,{OkBtn:t})=>(0,n.jsx)(t,{}),confirmLoading:"rename-session"===O,okButtonProps:{disabled:!ec.trim()},onOk:()=>void e3(),onCancel:()=>{"rename-session"!==O&&el(null)},children:[(0,n.jsx)(b.A,{autoFocus:!0,id:"human2ai-session-title",name:"sessionTitle",value:ec,maxLength:200,placeholder:F.renameSessionPlaceholder,"aria-label":F.renameSessionPlaceholder,onChange:e=>eu(e.target.value),onPressEnter:()=>void e3()}),ex?(0,n.jsx)("p",{className:"human2ai-workspace-sidebar__error",role:"alert",children:ex}):null]}),(0,n.jsxs)(v.A,{open:!!em,title:F.moveSessionTitle,okText:F.move,footer:(e,{OkBtn:t})=>(0,n.jsx)(t,{}),confirmLoading:"move-session"===O,okButtonProps:{disabled:!ep},onOk:()=>void e5(),onCancel:()=>{"move-session"!==O&&(eh(null),eg(""))},children:[(0,n.jsx)("p",{children:em?.title}),(0,n.jsx)(nG,{value:ep,options:[{value:"",label:F.selectProject,disabled:!0},...e.filter(e=>e.id!==em?.projectId).map(e=>({value:e.id,label:e.name}))],onChange:eg,"aria-label":F.selectProject,disabled:"move-session"===O}),ex?(0,n.jsx)("p",{className:"human2ai-workspace-sidebar__error",role:"alert",children:ex}):null]}),(0,n.jsxs)(v.A,{open:!!ef,title:F.deleteSessionTitle,okText:F.delete,cancelText:F.cancel,confirmLoading:"delete-session"===O,okButtonProps:{danger:!0},onOk:()=>void e8(),onCancel:()=>{"delete-session"!==O&&ey(null)},children:[(0,n.jsx)("p",{children:ef?.title}),(0,n.jsx)("p",{children:F.deleteSessionDescription}),ex?(0,n.jsx)("p",{className:"human2ai-workspace-sidebar__error",role:"alert",children:ex}):null]})]})}function nX(e){return`project:${e}`}function nQ(e){return`group:${e}`}function nZ(e){return`session:${e}`}function n0(e,t,i){let n=t.trim();return!!n&&e.some(e=>e.id!==i&&e.name.trim()===n)}function n1(e,t){if(e&&"object"==typeof e&&"code"in e){if("PROJECT_NAME_CONFLICT"===e.code)return t.projectNameConflict;if("PROJECT_NOT_EMPTY"===e.code)return t.deleteProjectDisabled}return t.actionFailed}async function n2(e){if(!navigator.clipboard?.writeText)throw Error("Clipboard API unavailable.");await navigator.clipboard.writeText(e)}function n3(e,t,i){if(!e)return i;let n=new Date(e);return Number.isNaN(n.getTime())?i:new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"short"}).format(n)}function n5({primaryItem:e,secondaryItem:t,createdAt:i,updatedAt:r,nodeCount:o,agentCommand:s,locale:l,labels:d,writeText:c=n2,className:u,style:m}){let h=(0,a.useId)(),[p,g]=(0,a.useState)(null);return(0,n.jsxs)("section",{...(0,$.Se)({namespace:"human2ai",id:"session-details",name:"SessionDetails",category:"module",origin:"project",status:"candidate"}),"aria-labelledby":h,className:["human2ai-session-details",u].filter(Boolean).join(" "),style:m,children:[(0,n.jsx)("h2",{id:h,children:d.title}),(0,n.jsxs)("dl",{className:"human2ai-session-details__list",children:[e?(0,n.jsxs)("div",{className:"human2ai-session-details__row",children:[(0,n.jsx)("dt",{children:e.label}),(0,n.jsx)("dd",{children:e.value})]}):null,t?(0,n.jsxs)("div",{className:"human2ai-session-details__row",children:[(0,n.jsx)("dt",{children:t.label}),(0,n.jsx)("dd",{children:t.value})]}):null,(0,n.jsxs)("div",{className:"human2ai-session-details__row",children:[(0,n.jsx)("dt",{children:d.created}),(0,n.jsx)("dd",{children:i?(0,n.jsx)("time",{dateTime:i,children:n3(i,l,d.emptyValue)}):d.emptyValue})]}),(0,n.jsxs)("div",{className:"human2ai-session-details__row",children:[(0,n.jsx)("dt",{children:d.updated}),(0,n.jsx)("dd",{children:r?(0,n.jsx)("time",{dateTime:r,children:n3(r,l,d.emptyValue)}):d.emptyValue})]}),(0,n.jsxs)("div",{className:"human2ai-session-details__row",children:[(0,n.jsx)("dt",{children:d.nodes}),(0,n.jsx)("dd",{className:"human2ai-session-details__value",children:o})]}),(0,n.jsxs)("div",{className:"human2ai-session-details__row human2ai-session-details__row--agent",children:[(0,n.jsx)("dt",{children:d.agent}),(0,n.jsx)("dd",{children:(0,n.jsx)(el.r,{className:"human2ai-session-details__action-button",size:"small",label:d.copyCommand,pendingLabel:d.copying,successLabel:d.copied,errorLabel:d.copyFailed,disabled:!s,idleIcon:(0,n.jsx)(es.A,{}),onAction:async()=>{let e="function"==typeof s?await s():s;if(!e?.trim())throw Error("Agent command is empty.");await c(e)},onStatusChange:e=>{"success"===e&&g(null)},onActionError:()=>g(d.copyFailed)})})]})]}),p?(0,n.jsx)("p",{className:"human2ai-session-details__error",role:"alert",children:p}):null]})}function n8({draft:e,resolveImageSource:t,label:i,disabled:r,children:o}){let s=(0,a.useCallback)(()=>(0,R.qU)(e,t),[e,t]);return(0,n.jsx)("span",{className:"human2ai-composition-preview-hover",...(0,$.Se)({namespace:"human2ai",id:"composition-preview-hover",name:"CompositionPreviewHover",category:"module",origin:"project",status:"candidate"}),children:(0,n.jsx)(il,{renderSvg:s,label:i,disabled:r,children:o})})}i(89448),i(55894);let n4=[{key:"16:9",label:"16:9",width:16,height:9},{key:"9:16",label:"9:16",width:9,height:16},{key:"4:3",label:"4:3",width:4,height:3},{key:"3:4",label:"3:4",width:3,height:4},{key:"3:2",label:"3:2",width:3,height:2},{key:"1:1",label:"1:1",width:1,height:1},{key:"2:3",label:"2:3",width:2,height:3}],n6=["left-top","right-top","left-middle","right-middle","left-bottom","center-bottom","right-bottom"];function n9(e,t){if(void 0!==e&&(!Number.isFinite(e.width)||e.width<=0||!Number.isFinite(e.height)||e.height<=0))throw Error(`AspectRatioSelector ${t} 的宽高必须是正数。`)}function n7(e,t,i){for(let n=1;n<=e.length;n+=1){let a=(t+n*i+e.length)%e.length;if(!e[a].disabled)return a}return t}function ae(e){return{width:e.width,height:e.height}}function at(e,t){let i=e.width*t.height,n=t.width*e.height,a=1e-9*Math.max(1,Math.abs(i),Math.abs(n));return Math.abs(i-n)<=a}function ai(e,t){return e.find(e=>at(e,t))}function an(e){return String(e)}function aa(e){let t=Number(e);return""!==e.trim()&&Number.isFinite(t)&&t>0?t:null}function ar({options:e=n4,value:t,defaultValue:i,onChange:r,ratio:o,defaultRatio:s,onRatioChange:l,title:d="比例",widthLabel:c="w",heightLabel:u="h","aria-label":m="比例选择",disabled:h=!1,className:p,style:g}){let f;if(0===e.length||e.length>n6.length)throw Error("AspectRatioSelector 需要 1 至 7 个比例选项。");let y=new Set;for(let t of e){if(y.has(t.key))throw Error(`AspectRatioSelector 选项 key 必须唯一:${t.key}`);if(!Number.isFinite(t.width)||t.width<=0||!Number.isFinite(t.height)||t.height<=0)throw Error(`AspectRatioSelector 比例必须是正数:${t.key}`);y.add(t.key)}if(void 0!==t&&!y.has(t))throw Error(`AspectRatioSelector value 不存在于 options:${t}`);if(void 0!==i&&!y.has(i))throw Error(`AspectRatioSelector defaultValue 不存在于 options:${i}`);n9(o,"ratio"),n9(s,"defaultRatio");let x=e.find(e=>!e.disabled)?.key??e[0].key,b=new Map(e.map(e=>[e.key,e])),v=b.get(i??x)??e[0],w=s??ae(v),[k,S]=(0,a.useState)(w),[I,C]=(0,a.useState)(()=>void 0!==s?ai(e,s)?.key??null:v.key),P=void 0===t?void 0:b.get(t),L=o??(P?ae(P):k),A=b.get(t??I??""),M=A&&at(A,L)?A:ai(e,L),N=M?.key??null,[R,$]=(0,a.useState)(()=>an(L.width)),[T,F]=(0,a.useState)(()=>an(L.height)),E=(0,a.useId)(),D=(0,a.useRef)([]);function _(e){if(h||e.disabled)return;let i=ae(e);void 0===o&&void 0===t&&(S(i),C(e.key),$(an(i.width)),F(an(i.height))),r?.(e.key,e),l?.(i,e)}function z(i,n){var a;let r,s=n.currentTarget.value,d="width"===i?s:R,c="height"===i?s:T;"width"===i?$(s):F(s);let u=aa(d),m=aa(c);null!==u&&null!==m&&(r=ai(e,a={width:u,height:m}),void 0===o&&void 0===t&&(S(a),C(r?.key??null)),l?.(a,r))}function B(e,i){(null===aa(i.currentTarget.value)||void 0!==o||void 0!==t)&&("width"===e?$(an(L.width)):F(an(L.height)))}return(0,a.useEffect)(()=>{(void 0!==o||void 0!==t)&&($(an(L.width)),F(an(L.height)))},[L.height,L.width,o,t]),(0,n.jsxs)("div",{...(0,j.S)("aspect-ratio-selector","AspectRatioSelector","selection-pattern"),className:["yisi-aspect-ratio-selector",p].filter(Boolean).join(" "),style:g,"aria-disabled":h,children:[(0,n.jsxs)("div",{className:"yisi-aspect-ratio-selector-header",children:[(0,n.jsx)("span",{className:"yisi-aspect-ratio-selector-title",title:d,children:d}),(0,n.jsxs)("div",{className:"yisi-aspect-ratio-selector-inputs",children:[(0,n.jsxs)("label",{className:"yisi-aspect-ratio-selector-input-label",children:[(0,n.jsx)("span",{children:c}),(0,n.jsx)("input",{id:`${E}-width`,className:"yisi-aspect-ratio-selector-input",type:"number",min:"0",step:"any",inputMode:"decimal",autoComplete:"off","aria-label":c,"aria-invalid":null===aa(R),disabled:h,value:R,onChange:e=>z("width",e),onBlur:e=>B("width",e)})]}),(0,n.jsx)("span",{className:"yisi-aspect-ratio-selector-multiply","aria-hidden":"true",children:"\xd7"}),(0,n.jsxs)("label",{className:"yisi-aspect-ratio-selector-input-label",children:[(0,n.jsx)("span",{children:u}),(0,n.jsx)("input",{id:`${E}-height`,className:"yisi-aspect-ratio-selector-input",type:"number",min:"0",step:"any",inputMode:"decimal",autoComplete:"off","aria-label":u,"aria-invalid":null===aa(T),disabled:h,value:T,onChange:e=>z("height",e),onBlur:e=>B("height",e)})]})]})]}),(0,n.jsxs)("div",{className:"yisi-aspect-ratio-selector-options",role:"radiogroup","aria-label":m,"aria-disabled":h,children:[(0,n.jsxs)("div",{className:"yisi-aspect-ratio-selector-preview-area","aria-live":"polite","aria-atomic":"true",children:[(0,n.jsxs)("span",{className:"yisi-aspect-ratio-selector-current",children:[d,": ",an(L.width)," \xd7 ",an(L.height)]}),(0,n.jsx)("span",{className:"yisi-aspect-ratio-selector-preview",style:(f=Math.min(62/L.width,60/L.height),{"--yisiui-aspect-ratio-preview-width":`${Math.max(12,L.width*f)}px`,"--yisiui-aspect-ratio-preview-height":`${Math.max(12,L.height*f)}px`}),"data-ratio":N??`${L.width}:${L.height}`,"data-ratio-value":`${L.width}:${L.height}`,"aria-hidden":"true"})]}),e.map((t,i)=>{let a=t.key===N,r=M?.disabled??!1,o=(null===N||r)&&t.key===x;return(0,n.jsx)("button",{ref:e=>{D.current[i]=e},className:"yisi-aspect-ratio-selector-option",type:"button",role:"radio","aria-checked":a,"aria-label":t.ariaLabel,title:t.label,"data-ratio-key":t.key,"data-position":n6[i],disabled:h||t.disabled,tabIndex:a||o?0:-1,onClick:()=>_(t),onKeyDown:t=>{let n;return n=null,void("ArrowRight"===t.key||"ArrowDown"===t.key?n=n7(e,i,1):"ArrowLeft"===t.key||"ArrowUp"===t.key?n=n7(e,i,-1):"Home"===t.key?n=e.findIndex(e=>!e.disabled):"End"===t.key&&(n=function(e){for(let t=e.length-1;t>=0;t-=1)if(!e[t].disabled)return t;return -1}(e)),null!==n&&!(n<0)&&n!==i&&(t.preventDefault(),_(e[n]),D.current[n]?.focus()))},children:(0,n.jsx)("span",{children:t.label})},t.key)})]})]})}function ao({frame:e,name:t,locked:i,disabled:r,onChange:o,onLockedChange:s,labels:l}){let d=(0,a.useRef)(!1),[,c]=(0,a.useReducer)(e=>e+1,0),u=t=>{t!==e&&o(t)},m=e=>{if(!(e instanceof HTMLInputElement)||"number"!==e.type)return null;let t=e.getAttribute("aria-label");return t===l.width?"width":t===l.height?"height":null},h=(t,i)=>{u((0,T.mv)(e,{...e,[t]:Math.max(T.Qq,Math.round(i))})),c()};return(0,n.jsxs)("section",{...(0,$.Se)({namespace:"human2ai",id:"canvas-frame-controls",name:"CanvasFrameControls",category:"module",origin:"project",status:"candidate"}),children:[(0,n.jsxs)("div",{className:"human2ai-canvas-frame-controls__heading",children:[(0,n.jsx)("h2",{children:t}),(0,n.jsxs)("div",{className:"human2ai-canvas-frame-controls__actions",children:[(0,n.jsx)(ed.J,{mode:"icon-only",size:"small",icon:(0,n.jsx)(nb.A,{}),iconLabel:l.reset,title:l.reset,backgroundColor:"none",textColor:"color.text.secondary",disabled:r||i,onClick:()=>o({...T.rr})}),(0,n.jsx)(ed.J,{mode:"icon-only",size:"small",icon:i?(0,n.jsx)(to.A,{}):(0,n.jsx)(ts.A,{}),iconLabel:i?l.unlock:l.lock,title:i?l.unlock:l.lock,"aria-pressed":i,backgroundColor:i?"color.action.primaryActive":"none",textColor:i?"color.text.onPrimary":"color.text.secondary",disabled:r,onClick:()=>s(!i)})]})]}),(0,n.jsx)("div",{className:"human2ai-canvas-frame-controls__size",onKeyDownCapture:t=>{let i=m(t.target);if(!i||t.ctrlKey||t.metaKey||t.altKey||([".",",","e","E","+","-"].includes(t.key)&&t.preventDefault(),"ArrowUp"!==t.key&&"ArrowDown"!==t.key))return;t.preventDefault();let n=t.target,a=Number.isFinite(n.valueAsNumber)?n.valueAsNumber:e[i];h(i,Math.round(a)+("ArrowUp"===t.key?1:-1))},onPasteCapture:e=>{let t=m(e.target);if(!t)return;let i=e.clipboardData.getData("text/plain").trim(),n=Number(i);!i||!Number.isFinite(n)||/^\d+$/.test(i)||(e.preventDefault(),h(t,n))},children:(0,n.jsx)(ar,{ratio:{width:Math.max(1,Math.round(e.width)),height:Math.max(1,Math.round(e.height))},disabled:r||i,onChange:(t,i)=>{d.current=!0,u((0,T.Ge)(e,i))},onRatioChange:t=>{if(d.current){d.current=!1;return}u((0,T.mv)(e,t)),Number.isInteger(t.width)&&Number.isInteger(t.height)||c()},title:l.size,widthLabel:l.width,heightLabel:l.height,"aria-label":t})})]})}i(52551);var as=i(46759),al=i(61598),ad=i(11288);function ac({images:e,title:t,aspectRatio:i="3 / 2",className:r,...o}){let s=a.Children.toArray(e);return(0,n.jsxs)("figure",{...o,...(0,j.S)("image-title-card","ImageTitleCard","card"),className:["yisi-image-title-card",r].filter(Boolean).join(" "),children:[(0,n.jsx)("div",{className:"yisi-image-title-card-media","data-empty":0===s.length?"true":void 0,"data-image-count":s.length,"data-yisiui-slot":"images",style:{aspectRatio:i},children:s.map((e,t)=>{var i;let a,r,o;return(0,n.jsx)("div",{className:"yisi-image-title-card-image",style:(a=(i=s.length)<=1?0:t/(i-1)*2-1,r=Math.min(7,3+i),o=Math.min(12,5+1.5*i),{"--yisiui-image-title-card-offset":`${a*o}%`,"--yisiui-image-title-card-rotation":`${a*r}deg`,"--yisiui-image-title-card-lift":`${5*Math.abs(a)}px`,zIndex:t+1}),children:e},t)})}),(0,n.jsx)("figcaption",{className:"yisi-image-title-card-title","data-yisiui-slot":"title",children:t})]})}i(37551),i(58206);let au=(0,a.lazy)(()=>Promise.all([i.e(977),i.e(218),i.e(484)]).then(i.bind(i,88484))),am=new Set(["image/png","image/jpeg","image/webp"]);function ah({styles:e,labels:t,loading:i=!1,errorMessage:r,imageUrl:o,modelUrl:s,onCreate:l,onUpdate:d,onDelete:c,onRetry:u,initialCategory:m,selection:h}){var p,g,f,y;let[w,j]=(0,a.useState)(m??"all"),[S,I]=(0,a.useState)("all"),[C,P]=(0,a.useState)(""),[L,A]=(0,a.useState)(null),[M,N]=(0,a.useState)("model"),[R,T]=(0,a.useState)(null),[F,E]=(0,a.useState)(null),[D,_]=(0,a.useState)(""),[z,B]=(0,a.useState)("visual"),[q,O]=(0,a.useState)(""),[U,H]=(0,a.useState)(""),[G,W]=(0,a.useState)([]),[J,V]=(0,a.useState)([]),[Y,K]=(0,a.useState)(!1),[X,Q]=(0,a.useState)(!1),[Z,ee]=(0,a.useState)(null),et=(0,a.useRef)(null),ei=(0,a.useRef)([]),en=e.find(e=>e.id===L)??null,ea=F&&"new"!==F?e.find(e=>e.id===F)??null:null,er=ea?.referenceImages.filter(e=>!J.includes(e.id))??[],eo=en?.referenceImages.find(e=>e.id===R)??en?.referenceImages[0]??null,es=(0,a.useMemo)(()=>{let t=C.trim().toLocaleLowerCase();return e.filter(e=>("all"===w||e.category===w)&&("all"===S||e.creatorType===S)&&(!t||e.name.toLocaleLowerCase().includes(t)||e.description.toLocaleLowerCase().includes(t)))},[w,S,C,e]);function el(){Y||(ec(),E(null),V([]),ee(null))}function ec(){W(e=>{for(let t of e)URL.revokeObjectURL(t.previewUrl);return[]})}function eu(e){let i=e.filter(e=>am.has(e.type)&&e.size>0&&e.size<=0xa00000);i.length!==e.length&&ee(t.imageInvalid),0!==i.length&&W(e=>[...e,...i.map(e=>({file:e,previewUrl:URL.createObjectURL(e)}))])}async function em(){let e=D.trim(),i=q.trim();if(!e||!i||!U.trim()||Y||(ea?!d:!l))return;K(!0),ee(null);let n={name:e,category:z,description:i,promptSummary:U.trim(),newReferenceImages:G.map(({file:e})=>e),removedReferenceImageIds:J};try{let e=ea?await d(ea,n):await l(n);ec(),E(null),V([]),A(e.id),T(e.referenceImages[0]?.id??null)}catch{ee(t.operationFailed)}finally{K(!1)}}async function eh(){if(en&&!X&&c){Q(!0),ee(null);try{await c(en),A(null),T(null)}catch{ee(t.operationFailed)}finally{Q(!1)}}}return(0,a.useEffect)(()=>{ei.current=G},[G]),(0,a.useEffect)(()=>()=>{for(let e of ei.current)URL.revokeObjectURL(e.previewUrl)},[]),(0,a.useEffect)(()=>{L&&!en&&A(null)},[en,L]),(0,n.jsxs)("section",{...(0,$.Se)({namespace:"human2ai",id:"style-library-view",name:"StyleLibraryView",category:"page",origin:"project",status:"candidate"}),className:"human2ai-style-library","data-loading":i||void 0,children:[(0,n.jsxs)("header",{className:"human2ai-style-library__toolbar",children:[(0,n.jsx)(b.A,{className:"human2ai-style-library__search",allowClear:!0,prefix:(0,n.jsx)(as.A,{"aria-hidden":"true"}),value:C,placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder,onChange:e=>P(e.target.value)}),(0,n.jsx)(i6,{"aria-label":t.category,value:w,items:[{key:"all",label:t.allCategories,mode:"text-only"},{key:"visual",label:t.visualCategory,mode:"text-only"},{key:"ui",label:t.uiCategory,mode:"text-only"},{key:"spatial",label:t.spatialCategory,mode:"text-only"}],onChange:e=>j(e)}),(0,n.jsx)(i6,{"aria-label":t.creator,value:S,items:[{key:"all",label:t.allCreators,mode:"text-only"},{key:"user",label:t.userCreator,mode:"text-only"},{key:"agent",label:t.agentCreator,mode:"text-only"}],onChange:e=>I(e)}),l?(0,n.jsx)(ed.J,{type:"primary",mode:"with-icon",icon:(0,n.jsx)(eM.A,{"aria-hidden":"true"}),backgroundColor:"color.action.primaryActive",textColor:"color.text.onPrimary",onClick:function(){ec(),E("new"),_(""),B("visual"),O(""),H(""),V([]),ee(null)},children:t.newStyle}):null]}),i?(0,n.jsx)(ia.G,{label:t.loading}):r?(0,n.jsxs)("div",{className:"human2ai-style-library__page-state",role:"alert",children:[(0,n.jsx)("span",{children:t.loadFailed}),u?(0,n.jsx)(ed.J,{type:"text",mode:"with-icon",icon:(0,n.jsx)(nb.A,{"aria-hidden":"true"}),onClick:u,children:t.retry}):null]}):0===es.length?(0,n.jsx)("div",{className:"human2ai-style-library__page-state",children:0===e.length?t.empty:t.noMatches}):(0,n.jsx)("div",{className:"human2ai-style-library__grid",children:es.map(e=>{let i=e.referenceImages[0];return(0,n.jsxs)("div",{className:"human2ai-style-library__card",children:[(0,n.jsx)(ac,{images:e.referenceImages.length?e.referenceImages.slice(0,3).map(t=>(0,n.jsx)("img",{src:o(e.id,t.id),alt:""},t.id)):e.previewModel?[(0,n.jsxs)("div",{className:"human2ai-style-library__model-cover",children:[(0,n.jsx)(al.A,{"aria-hidden":"true"}),(0,n.jsx)("span",{children:t.model.label})]},"model")]:[],title:e.name}),(0,n.jsx)("button",{className:"human2ai-style-library__card-trigger",type:"button","aria-label":t.openStyle(e.name),onClick:()=>{N("model"),A(e.id),T(i?.id??null),ee(null)}})]},e.id)})}),(0,n.jsxs)(v.A,{open:!!en,centered:!0,width:1120,title:en?(0,n.jsxs)("div",{className:"human2ai-style-library__preview-heading",children:[(0,n.jsx)("span",{className:"human2ai-style-library__preview-title",children:en.name}),(0,n.jsxs)("span",{className:"human2ai-style-library__badges",children:[(0,n.jsx)("span",{children:(p=en.category,({visual:(g=t).visualCategory,ui:g.uiCategory,spatial:g.spatialCategory})[p])}),(0,n.jsx)("span",{children:(f=en.creatorType,y=t,"user"===f?y.userCreator:y.agentCreator)})]})]}):null,closeIcon:(0,n.jsx)(iQ.A,{"aria-label":t.closePreview}),footer:en?(0,n.jsxs)("div",{className:"human2ai-style-library__preview-actions",children:[c?(0,n.jsx)(k.x,{type:"text",icon:(0,n.jsx)(x.A,{"aria-hidden":"true"}),title:t.deleteTitle,description:t.deleteDescription,scopeLabel:en.name,confirmLabel:t.delete,cancelLabel:t.cancel,loading:X,onConfirm:eh,children:t.delete}):null,d?(0,n.jsx)(ed.J,{type:"primary",mode:"with-icon",icon:(0,n.jsx)(ad.A,{"aria-hidden":"true"}),backgroundColor:"color.action.primaryActive",textColor:"color.text.onPrimary",onClick:()=>{ec(),E(en.id),_(en.name),B(en.category),O(en.description),H(en.promptSummary),V([]),ee(null)},children:t.editStyle}):null,h?(0,n.jsx)(ed.J,{className:"human2ai-style-library__select-action",type:"primary",loading:Y,backgroundColor:"color.action.primaryActive",textColor:"color.text.onPrimary",onClick:async()=>{if(!Y){K(!0),ee(null);try{await h.onSelect(en),A(null)}catch{ee(t.operationFailed)}finally{K(!1)}}},children:h.label}):null]}):null,onCancel:()=>{X||Y||(A(null),T(null),ee(null))},children:[en?(0,n.jsxs)("div",{className:"human2ai-style-library__preview",children:[(0,n.jsxs)("section",{"aria-labelledby":"style-preview-references",children:[en.previewModel&&s?(0,n.jsx)("div",{className:"human2ai-style-library__reference-switch",id:"style-preview-references",children:(0,n.jsx)(i6,{"aria-label":t.references,value:M,items:[{key:"model",label:t.model.label,mode:"text-only"},{key:"image",label:t.references,mode:"text-only"}],onChange:e=>N(e)})}):(0,n.jsx)("h2",{id:"style-preview-references",children:t.references}),en.previewModel&&s&&"model"===M?(0,n.jsx)(a.Suspense,{fallback:(0,n.jsx)("div",{role:"status",children:t.model.loading}),children:(0,n.jsx)(au,{url:s(en.id,en.previewModel.id),labels:t.model},en.previewModel.id)}):eo?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"human2ai-style-library__active-reference",children:(0,n.jsx)("img",{src:o(en.id,eo.id),alt:en.name})}),en.referenceImages.length>1?(0,n.jsx)("div",{className:"human2ai-style-library__thumbnails",children:en.referenceImages.map((e,i)=>(0,n.jsx)("button",{type:"button","aria-label":`${t.references} ${i+1}`,"aria-pressed":e.id===eo.id,onClick:()=>T(e.id),children:(0,n.jsx)("img",{src:o(en.id,e.id),alt:""})},e.id))}):null]}):(0,n.jsx)("div",{className:"human2ai-style-library__no-reference",children:t.noReferences})]}),(0,n.jsxs)("section",{className:"human2ai-style-library__specification","aria-labelledby":"style-preview-description",tabIndex:0,children:[(0,n.jsx)("h2",{id:"style-preview-description",children:t.description}),(0,n.jsx)("p",{className:"human2ai-style-library__description",children:en.description}),(0,n.jsx)("h2",{children:t.promptSummary}),(0,n.jsx)("p",{className:"human2ai-style-library__description",children:en.promptSummary})]})]}):null,Z&&en?(0,n.jsx)("p",{className:"human2ai-style-library__error",role:"alert",children:Z}):null]}),(0,n.jsx)(v.A,{open:null!==F,title:ea?t.editStyle:t.newStyle,footer:null,onCancel:el,children:(0,n.jsxs)("div",{className:"human2ai-style-library__editor",onPaste:function(e){let t=Array.from(e.clipboardData.files).filter(e=>e.type.startsWith("image/"));0!==t.length&&(e.preventDefault(),eu(t))},children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("span",{children:t.name}),(0,n.jsx)(b.A,{autoFocus:!0,value:D,maxLength:200,placeholder:t.namePlaceholder,onChange:e=>_(e.target.value)})]}),(0,n.jsxs)("div",{className:"human2ai-style-library__field",children:[(0,n.jsx)("span",{children:t.category}),(0,n.jsx)(i6,{"aria-label":t.category,value:z,items:[{key:"visual",label:t.visualCategory,mode:"text-only"},{key:"ui",label:t.uiCategory,mode:"text-only"},{key:"spatial",label:t.spatialCategory,mode:"text-only"}],onChange:e=>B(e)})]}),(0,n.jsxs)("label",{children:[(0,n.jsx)("span",{children:t.description}),(0,n.jsx)(b.A.TextArea,{value:q,maxLength:2e4,autoSize:{minRows:6,maxRows:14},placeholder:"spatial"===z?t.spatialDescriptionPlaceholder:t.descriptionPlaceholder,onChange:e=>O(e.target.value)})]}),(0,n.jsxs)("div",{className:"human2ai-style-library__field",children:[(0,n.jsx)("span",{children:t.references}),(0,n.jsxs)("div",{className:"human2ai-style-library__editor-references",children:[er.map(e=>(0,n.jsx)(ap,{reference:e,previewUrl:o(e.styleId,e.id),removeLabel:t.removeReference,onRemove:()=>V(t=>[...t,e.id])},e.id)),G.map(e=>(0,n.jsx)(ap,{previewUrl:e.previewUrl,removeLabel:t.removeReference,onRemove:()=>{URL.revokeObjectURL(e.previewUrl),W(t=>t.filter(t=>t!==e))}},e.previewUrl)),(0,n.jsxs)("button",{className:"human2ai-style-library__add-reference",type:"button",onClick:()=>et.current?.click(),children:[(0,n.jsx)(eM.A,{"aria-hidden":"true"}),(0,n.jsx)("span",{children:t.addReferences})]})]}),(0,n.jsx)("input",{ref:et,className:"human2ai-style-library__file-input",type:"file",accept:"image/png,image/jpeg,image/webp",multiple:!0,onChange:function(e){eu(Array.from(e.target.files??[])),e.target.value=""}}),(0,n.jsxs)("span",{className:"human2ai-style-library__image-hint",children:[t.pasteHint," ",t.fileTypes]})]}),(0,n.jsxs)("label",{children:[(0,n.jsx)("span",{children:t.promptSummary}),(0,n.jsx)(b.A.TextArea,{value:U,maxLength:240,autoSize:{minRows:2,maxRows:3},placeholder:t.promptSummaryPlaceholder,onChange:e=>H(e.target.value)})]}),Z?(0,n.jsx)("p",{className:"human2ai-style-library__error",role:"alert",children:Z}):null,(0,n.jsxs)("div",{className:"human2ai-style-library__editor-actions",children:[(0,n.jsx)(ed.J,{disabled:Y,onClick:el,children:t.cancel}),(0,n.jsx)(ed.J,{type:"primary",loading:Y,disabled:!D.trim()||!q.trim()||!U.trim(),backgroundColor:"color.action.primaryActive",textColor:"color.text.onPrimary",onClick:()=>void em(),children:t.save})]})]})})]})}function ap({reference:e,previewUrl:t,removeLabel:i,onRemove:a}){return(0,n.jsxs)("div",{className:"human2ai-style-library__editor-reference",children:[(0,n.jsx)("img",{src:t,alt:""}),(0,n.jsx)("button",{type:"button","aria-label":i,onClick:a,children:(0,n.jsx)(iQ.A,{"aria-hidden":"true"})}),e?(0,n.jsx)("span",{children:e.position+1}):null]})}function ag({styles:e,currentStyle:t,category:i,labels:r,libraryLabels:o,imageUrl:s,modelUrl:l,onBind:d,onRetry:c,loading:u=!1,saving:m=!1,disabled:h=!1,error:p,pending:g=!1}){let[f,y]=(0,a.useState)(!1),x=(0,a.useId)();return(0,n.jsxs)("section",{...(0,$.Se)({namespace:"human2ai",id:"session-style-picker",name:"SessionStylePicker",category:"module",origin:"project",status:"candidate"}),className:"human2ai-session-style-picker","aria-labelledby":x,children:[(0,n.jsx)("h2",{id:x,children:r.title}),(0,n.jsxs)("div",{className:"human2ai-session-style-picker__controls",children:[(0,n.jsx)(ed.J,{className:"human2ai-session-style-picker__choose",mode:"with-icon",icon:(0,n.jsx)(nU.A,{"aria-hidden":"true"}),disabled:h||m,loading:m,onClick:()=>y(!0),children:t?.name??r.choose}),t?(0,n.jsx)(_.A,{title:r.unbind,children:(0,n.jsx)(ed.J,{type:"text",mode:"icon-only",icon:(0,n.jsx)(iQ.A,{"aria-hidden":"true"}),"aria-label":r.unbind,disabled:h||m||u,onClick:()=>void d(null).catch(()=>void 0)})}):null]}),t&&g?(0,n.jsx)("p",{className:"human2ai-session-style-picker__status",role:"status",children:r.pending}):null,p?(0,n.jsx)("p",{className:"human2ai-session-style-picker__error",role:"alert",children:p}):null,(0,n.jsx)(v.A,{open:f,title:r.dialogTitle,closable:{"aria-label":o.closePreview,disabled:m},closeIcon:(0,n.jsx)(iQ.A,{"aria-hidden":"true"}),width:1e3,footer:null,onCancel:()=>{m||y(!1)},destroyOnHidden:!0,children:(0,n.jsx)(ah,{styles:e,labels:o,loading:u,errorMessage:p,imageUrl:s,modelUrl:l,initialCategory:i,onRetry:c,selection:{label:r.select,onSelect:async e=>{await d(e.id),y(!1)}}})})]})}function af({items:e,value:t,labels:i,onChange:r,onCreate:o,onRename:s,onDelete:l,onReorder:d}){let[c,u]=(0,a.useState)(null),[m,h]=(0,a.useState)(""),p=(0,a.useRef)(null),g=(0,a.useRef)(null),f=e.find(e=>e.id===c?.id);function y(e,t=!1){requestAnimationFrame(()=>{let i=[...p.current?.querySelectorAll('input[type="radio"]')??[]].find(t=>t.value===e),n=t?i?.closest("[data-tab-key]")?.querySelector('button[aria-haspopup="menu"]'):i;n?.focus()})}return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{...(0,$.Se)({namespace:"human2ai",id:"ui-sketch-state-tabs",name:"UiSketchStateTabs",category:"module",origin:"project",status:"candidate"}),ref:p,className:"human2ai-state-tabs",children:(0,n.jsx)(i6,{"aria-label":i.switch,compact:!0,items:e.map(t=>({key:t.id,label:t.label,mode:"text-only",menu:{trigger:"hover",ariaLabel:i.actions(t.label),items:[{key:"new",label:i.new},{key:"rename",label:i.rename},{key:"delete",label:i.delete,danger:!0,disabled:1===e.length}],onAction:(e,i)=>{"new"===e?o(i):("rename"===e||"delete"===e)&&(g.current=i,h(t.label),u({id:i,kind:e}))}}})),value:t,onChange:r,trailingAction:1===e.length?{label:i.add,icon:(0,n.jsx)(eM.A,{"aria-hidden":"true"}),onClick:()=>o(t)}:void 0,reorderable:!0,onReorder:d})}),(0,n.jsx)(v.A,{open:!!f,title:c?.kind==="rename"?i.rename:i.deleteTitle(f?.label??""),closable:!1,okText:c?.kind==="rename"?i.rename:i.delete,cancelText:i.cancel,okButtonProps:{danger:c?.kind==="delete",disabled:c?.kind==="rename"?!m.trim():e.length<2},onCancel:()=>u(null),afterClose:()=>{let i=g.current;i&&e.some(e=>e.id===i)?y(i,!0):y(t)},onOk:()=>{if(f&&c){if("rename"===c.kind){if(!m.trim())return;s(c.id,m.trim())}else e.length>1&&l(c.id);u(null)}},destroyOnHidden:!0,afterOpenChange:e=>{e&&c?.kind==="rename"&&document.querySelector(".human2ai-state-tabs__name")?.select()},children:c?.kind==="rename"?(0,n.jsx)(b.A,{className:"human2ai-state-tabs__name","aria-label":i.name,value:m,maxLength:100,onChange:e=>h(e.target.value),onPressEnter:()=>{f&&m.trim()&&(s(f.id,m.trim()),u(null))}}):null})]})}i(68743),i(73251);var ay=i(99441),ax=i(33960),ab=i(53239),av=i(25865),aw=i(28462),aj=i(28110),ak=i(83424),aS=i(93319),aI=i(40129),aC=i(18522),aP=i(55408),aL=i(21071),aA=i(95813),aM=i(84910),aN=i(76770),aR=i(15362);function a$(e){let t=(0,aL.cj)(e);return e=>{let i="characterId"in e?e.characterId:"put-character"===e.type?e.character.id:void 0,n="put-object"===e.type?e.object.id:void 0,a="put-camera-box"===e.type?e.box.id:void 0,r=t.characters.find(e=>e.id===i),o=t.objects.find(e=>e.id===n),s=t.cameraBoxes?.find(e=>e.id===a);if(!r&&!o&&!s)return(0,aL.bK)(t,[e]);let l=(0,aL.bK)({...t,characters:r?[r]:[],objects:o?[o]:[],cameraBoxes:s?[s]:[]},[e]);return{constrained:l.constrained,draft:{...t,characters:r?t.characters.map(e=>e.id===i?l.draft.characters[0]:e):t.characters,objects:o?t.objects.map(e=>e.id===n?l.draft.objects[0]:e):t.objects,...t.cameraBoxes?{cameraBoxes:s?t.cameraBoxes.map(e=>e.id===a?l.draft.cameraBoxes[0]:e):t.cameraBoxes}:{}}}}}var aT=i(28179);let aF={ambient:.3,key:.85,direction:[-.65,.6,1.3],shadowSize:2048,shadowRadius:2,shadowStrength:.65},aE=e=>{let t=[];return e.traverse(e=>{e instanceof aM.eaF&&!e.userData.rig&&t.push(e)}),t};function aD(e,t,i){let n=aE(e),a=[],r=(e,t)=>{e.geometry.getAttribute("color")?.array!==t&&e.geometry.setAttribute("color",new aM.THS(t,3));let i=e.material;i.vertexColors=!0,i.shadowSide=aM.$EB,e.castShadow=!0,e.receiveShadow=!0};if(i)return n.forEach((e,t)=>r(e,i[t])),i;for(let e of n){let t=e.geometry.getAttribute("position"),i=e.geometry.index;for(let n=0;n<(i?.count??t.count);n+=3){let[r,o,s]=[0,1,2].map(a=>new aM.Pq0().fromBufferAttribute(t,i?i.getX(n+a):n+a).applyMatrix4(e.matrixWorld));a.push({a:r,b:o,c:s,bounds:new aM.NRn().setFromPoints([r,o,s]),center:r.clone().add(o).add(s).multiplyScalar(1/3)})}}if(!a.length)return[];let o=[],s=function e(t){let i=new aM.NRn;for(let e of t)i.union(e.bounds);if(t.length<=12)return{bounds:i,triangles:t};let n=i.getSize(new aM.Pq0),a=n.x>n.y&&n.x>n.z?"x":n.y>n.z?"y":"z";t.sort((e,t)=>e.center[a]-t.center[a]);let r=Math.floor(t.length/2);return{bounds:i,left:e(t.slice(0,r)),right:e(t.slice(r))}}(a),l=new aM.RlV,d=new aM.Pq0,c=(e,t)=>!(e.bounds.distanceToPoint(l.origin)>t)&&!!l.intersectsBox(e.bounds)&&(e.triangles?e.triangles.some(e=>null!==l.intersectTriangle(e.a,e.b,e.c,!1,d)&&d.distanceToSquared(l.origin)<t*t):c(e.left,t)||c(e.right,t)),u=new aM.Pq0,m=new aM.Pq0,h=new aM.Pq0,p=new aM.Pq0,g=Array.from({length:8},(e,t)=>{let i=Math.sqrt(1-(t+.5)/8),n=Math.sqrt(1-i*i),a=2.399963229728653*t;return[n*Math.cos(a),n*Math.sin(a),i]});for(let e of n){let i=e.geometry.getAttribute("position"),n=e.geometry.getAttribute("normal"),a=new aM.dwI().getNormalMatrix(e.matrixWorld),d=t.characters.find(t=>t.id===e.userData.characterId),f=(d?.height??Math.max(...t.objects.find(t=>t.id===e.userData.objectId)?.size??[1]))*.025,y=new Float32Array(3*i.count);for(let t=0;t<i.count;t++){u.fromBufferAttribute(i,t).applyMatrix4(e.matrixWorld),m.fromBufferAttribute(n,t).applyNormalMatrix(a),h.set(.9>Math.abs(m.y)?0:1,+(.9>Math.abs(m.y)),0).cross(m).normalize(),p.crossVectors(m,h),l.origin.copy(u).addScaledVector(m,.025*f);let r=0;for(let[e,t,i]of g)l.direction.copy(m).multiplyScalar(i).addScaledVector(h,e).addScaledVector(p,t),c(s,f)&&r++;y.fill(1-.5*r/g.length,3*t,3*t+3)}r(e,y),o.push(y)}return o}var a_=i(42621),az=i(23347),aB=i(96826);class aq{constructor(e={}){this.options=e,this.scene=new aM.YJl,this.entries=new Map,this.baseColors=new WeakMap,this.shading=!1,this.disposed=!1}update(e,t={}){let i=new Map,n=!1;for(let a of[...e.characters,...e.objects]){let r=JSON.stringify([(0,a_.N)(a),!!t.showRig]),o=this.entries.get(a.id);if(o?.key!==r){let i=JSON.stringify([(0,a_.N)({...a,position:[0,0,0],rotation:[0,0,0]}),!!t.showRig]);if(o?.shapeKey===i)o.group.matrixAutoUpdate=!1,o.group.matrix.copy((0,az.NT)(a).multiply(o.origin)),o.group.matrixWorldNeedsUpdate=!0,o.key=r;else{let n="bones"in a?{...e,characters:[a],objects:[]}:{...e,characters:[],objects:[a]},s=o?.group.children.filter(e=>e.userData.rig)??[];s.length&&o.group.remove(...s);let l=o?.group.children[0];if(o&&"bones"in a&&l instanceof aM.YJl&&(0,aB.m)(l,a))o.group.matrixAutoUpdate=!0,o.group.matrix.identity(),o={key:r,shapeKey:i,group:o.group,origin:(0,az.NT)(a).invert()};else{let e=(0,aT.bh)(n);o&&(0,az.sZ)(o.group,e)?((0,aT.en)(e),o={key:r,shapeKey:i,group:o.group,origin:(0,az.NT)(a).invert()}):(o&&(this.scene.remove(o.group),(0,aT.en)(o.group)),o={key:r,shapeKey:i,group:e,origin:(0,az.NT)(a).invert()})}"bones"in a&&t.showRig&&"geometric"!==a.appearance?(s.length&&o.group.add(...s),(0,aT.yz)(o.group,a,!0)):s.length&&(0,aT.en)(new aM.YJl().add(...s)),(0,az.SZ)(o.group,this.baseColors)}n=!0}i.set(a.id,o)}for(let[e,t]of this.entries)i.has(e)||(this.scene.remove(t.group),(0,aT.en)(t.group),n=!0);let a=[...i.values()].map(e=>e.group);a.some((e,t)=>this.scene.children[t]!==e)&&(this.scene.clear(),this.scene.add(...a),n=!0),this.entries=i,n&&this.scene.updateMatrixWorld(!0);let r=JSON.stringify([...i.values()].map(e=>e.key)),o=aE(this.scene),s=o.map(e=>JSON.stringify([e.userData,e.geometry.getAttribute("position").count])).join("/"),l=!this.colors||s!==this.shadedTopology||r!==this.shadedKey;return this.desired=!t.dragging&&l?{draft:e,key:r,topology:s}:void 0,this.options.shade?(this.colors&&s===this.shadedTopology||(this.colors=o.map(e=>new Float32Array(3*e.geometry.getAttribute("position").count).fill(1)),this.shadedTopology=s,this.shadedKey=void 0),n&&aD(this.scene,e,this.colors),this.scheduleShading()):this.colors&&s===this.shadedTopology&&(t.dragging||!l)?n&&aD(this.scene,e,this.colors):(this.colors=aD(this.scene,e),this.shadedKey=r,this.shadedTopology=s),n}scheduleShading(){if(this.shading||!this.desired||this.disposed)return;let e=this.desired;this.shading=!0,this.options.shade(e.draft).then(t=>{this.disposed||this.desired?.key!==e.key||this.desired.topology!==e.topology||(this.colors=aD(this.scene,e.draft,t),this.shadedKey=e.key,this.shadedTopology=e.topology,this.desired=void 0,this.options.onShaded?.())}).catch(()=>{this.desired?.key===e.key&&(this.desired=void 0)}).finally(()=>{this.shading=!1,this.scheduleShading()})}dispose(){this.disposed=!0,this.desired=void 0,(0,aT.en)(this.scene),this.scene.clear(),this.entries.clear(),this.colors=void 0,this.shadedKey=void 0,this.shadedTopology=void 0}}function aO(e){let t=(0,a.useRef)(null),r=(0,a.useRef)(e);r.current=e;let o=(0,a.useRef)(null),[s,l]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e,n,a,s,d,c,u,m,h=t.current;try{e=new aA.JeP({antialias:!0,alpha:!0})}catch{l(!0);return}e.setPixelRatio(Math.min(window.devicePixelRatio,2)),e.shadowMap.enabled=!0,e.shadowMap.type=aM.QP0,e.shadowMap.autoUpdate=!1,h.appendChild(e.domElement);let p=new aM.Z58,g=new aM.ubm(45,1,.01,3e4);g.position.set(3,2.2,5);let f=new aN.N(g,e.domElement);f.target.set(0,.9,0),f.update();let y=new aM.fTw(20,40,"#a4aeb8","#e0e4e8"),x=new aM.$p8(0xffffff);p.add(y,x);let b=new aM.ZyN(0xffffff);p.add(b,b.target);let v=new aM.B69;p.add(v);let w=new aR.ZU(g,e.domElement);w.setSpace("world"),w.setSize(.75),p.add(w.getHelper());let j=new aq({shade:e=>new Promise((t,r)=>{n??=new Worker(i.tu(new URL(i.p+i.u(101),i.b))),a=r,n.onmessage=e=>{a=void 0,t(e.data.colors)},n.onerror=e=>{n?.terminate(),n=void 0,a=void 0,r(e)},n.postMessage(e)}),onShaded:()=>{e.shadowMap.needsUpdate=!0,R()}}),k=j.scene;p.add(k);let S=new aM.YJl;p.add(S);let I=new aM.YJl;p.add(I);let C=new aM.IzY(1);C.visible=!1,p.add(C);let P=!1,L=null,A=null,M=0,N=0,R=()=>{N||(N=requestAnimationFrame(()=>{N=0,e.render(p,g)}))},$=t=>{let i=P||r.current.interacting,n=JSON.stringify([t.characters.map(a_.N),t.objects.map(a_.N),r.current.showRig,!!i]),a=c!==n;c=n;let o=a&&j.update(t,{showRig:r.current.showRig,dragging:i}),l=!!t.lightingEnabled!==s;s=!!t.lightingEnabled;let m=t.lightingEnabled?aF:{...aF,ambient:1,key:0,shadowStrength:0};x.intensity=m.ambient*Math.PI,b.intensity=m.key*Math.PI,e.shadowMap.enabled=!!m.shadowStrength,(o||l)&&(e.shadowMap.enabled&&function(e,t){let i=new aM.NRn;for(let e of aE(t))i.union(new aM.NRn().setFromObject(e));let n=i.isEmpty()?new aM.Pq0:i.getCenter(new aM.Pq0),a=Math.max(.1,i.getSize(new aM.Pq0).length());e.position.copy(n).addScaledVector(new aM.Pq0(...aF.direction).normalize(),a),e.target.position.copy(n),e.target.updateMatrixWorld(),e.updateMatrixWorld();let r=e.shadow.camera;r.position.copy(e.position),r.lookAt(n),r.updateMatrixWorld();let o=i.isEmpty()?new aM.NRn(new aM.Pq0(-.5,-.5,-.5),new aM.Pq0(.5,.5,.5)):i.clone().applyMatrix4(r.matrixWorldInverse),s=.02*a;r.left=o.min.x-s,r.right=o.max.x+s,r.bottom=o.min.y-s,r.top=o.max.y+s,r.near=Math.max(.001,-o.max.z-s),r.far=Math.max(r.near+.1,-o.min.z+s),r.updateProjectionMatrix();let l=Math.max(r.right-r.left,r.top-r.bottom)/aF.shadowSize;e.castShadow=!0,e.shadow.mapSize.setScalar(aF.shadowSize),e.shadow.radius=aF.shadowRadius,e.shadow.intensity=aF.shadowStrength,e.shadow.normalBias=2*l,e.shadow.bias=-(2*l)/(r.far-r.near),e.shadow.needsUpdate=!0}(b,k),e.shadowMap.needsUpdate=!0);let p=r.current.selection,g=getComputedStyle(h).getPropertyValue("--yisiui-color-action-primary").trim()||"#467bd3",f=JSON.stringify([t.cameras.map(({name:e,note:t,...i})=>i),t.cameraBoxes?.map(({name:e,note:t,...i})=>i),r.current.showCameras]),y=d!==f;if(y){for(let e of(d=f,(0,aT.en)(I),I.clear(),!1===r.current.showCameras?[]:t.cameras)){let t=p&&"cameraId"in p&&p.cameraId===e.id,i=(0,aT.Ls)(e);i.far=Math.max(2*i.near,i.position.distanceTo((0,aL.i1)(e.target))),i.updateProjectionMatrix();let n=new aM.WTh(i),a=n.material;a.vertexColors=!1,a.color.set(t?g:"#9cbbd3"),a.transparent=!0,a.opacity=t?.95:.45,a.depthTest=!1,n.renderOrder=1,n.userData.cameraId=e.id,I.add(n)}for(let e of((0,aT.en)(S),S.clear(),t.cameraBoxes??[])){let t=p&&"cameraBoxId"in p&&p.cameraBoxId===e.id,i=new aM.iNn(e.size,e.size,e.size),n=new aM.DXC(new aM.TDQ(i),new aM.mrM({color:t?"#467bd3":"#9cbbd3",transparent:!0,opacity:t?.95:.45,depthTest:!1}));i.dispose(),n.position.copy((0,aL.i1)(e.position)),n.quaternion.copy((0,aL.b5)(e.rotation)),n.userData.cameraBoxId=e.id,n.renderOrder=1,S.add(n)}}let v=JSON.stringify([p,g]),w=u!==v;if(u=v,y||w){for(let e of I.children){let t=p&&"cameraId"in p&&p.cameraId===e.userData.cameraId,i=e.material;i.color.set(t?g:"#9cbbd3"),i.opacity=t?.95:.45}for(let e of S.children){let t=p&&"cameraBoxId"in p&&p.cameraBoxId===e.userData.cameraBoxId,i=e.material;i.color.set(t?g:"#9cbbd3"),i.opacity=t?.95:.45}let e=p&&"cameraBoxId"in p?t.cameraBoxes?.find(e=>e.id===p.cameraBoxId):void 0;C.visible=!!e,e&&(C.position.copy((0,aL.i1)(e.position)),C.quaternion.copy((0,aL.b5)(e.rotation)),C.scale.setScalar(.25*e.size))}let L=p&&"characterId"in p&&p.handBoneId?t.characters.find(e=>e.id===p.characterId):void 0,A=L?.bones.find(e=>e.id===(p&&"characterId"in p?p.handBoneId:void 0)),M=L&&A?(0,aL.Au)(L,A):void 0,N=e=>p&&("characterId"in p?e.characterId===p.characterId&&(M?M.has(e.jointId)||e.jointId===A.startJointId||M.has(L.bones.find(t=>t.id===e.boneId)?.endJointId??""):p.jointId?e.jointId===p.jointId:!p.boneId||e.boneId===p.boneId):"objectId"in p&&e.objectId===p.objectId);(o||w)&&k.traverse(e=>{if(!(e instanceof aM.eaF)||!(e.material instanceof aM.G_z))return;if(e instanceof aM.ZLX&&e.userData.rig){let t=new aM.Q1f,i="joint"===e.userData.rig?"#e6a65c":"#728aa1";e.userData.instances.forEach((n,a)=>e.setColorAt(a,t.set(N(n)?g:i))),e.instanceColor&&(e.instanceColor.needsUpdate=!0);return}let i=j.baseColors.get(e);if(i&&e.material.color.copy(i),!p)return;let n=e.userData;N(n)&&((0,aL.dS)(n.modelPart??"")&&t.characters.find(e=>e.id===n.characterId)?.appearance==="geometric"?e.material.color.lerp(new aM.Q1f("#ffffff"),.3):e.material.color.set(g))}),(o||l||y||w)&&R()},T=()=>{if(P)return;let{draft:e,selection:t,mode:i,disabled:n}=r.current,a=JSON.stringify([c,d,t,i,n]);if(m===a)return;m=a;let o=t&&"characterId"in t?t.jointId?"translate":t.boneId||t.handBoneId?"rotate":i:i;if(w.setMode(o),w.setSpace(t&&"characterId"in t&&(t.boneId||t.handBoneId)?"local":"world"),w.detach(),n||!t||"cameraId"in t)return void R();if("characterId"in t){let i=e.characters.find(e=>e.id===t.characterId);if(!i)return;let n=i.joints.find(e=>e.id===t.jointId),a=i.bones.find(e=>e.id===(t.boneId??t.handBoneId));if(a){let e=(0,aL.Oe)(i)[a.id];if(v.position.copy(e.position),v.quaternion.copy(e.rotation).multiply((0,aL.IA)(i,a)),a.lockRotation||(0,aL.j4)(a))return void R()}else if(n){let e=(0,aL.ms)(i)[n.id];if(v.position.copy(e.position),v.quaternion.copy(e.rotation),n.lockPosition)return void R()}else v.position.copy((0,aL.i1)(i.position)),v.quaternion.copy((0,aL.b5)(i.rotation))}else{let i="cameraBoxId"in t?e.cameraBoxes?.find(e=>e.id===t.cameraBoxId):e.objects.find(e=>e.id===t.objectId);if(!i)return;v.position.copy((0,aL.i1)(i.position)),v.quaternion.copy((0,aL.b5)(i.rotation))}w.attach(v),R()},F=()=>{let{selection:e}=r.current,t=L??r.current.draft;if(!e||"cameraId"in e)return null;let i=v.position.toArray(),n=(0,aL.bl)(v.quaternion);if("characterId"in e){if(e.jointId)return{type:"move-joint",characterId:e.characterId,jointId:e.jointId,position:i};let a=t.characters.find(t=>t.id===e.characterId),r=a?.bones.find(t=>t.id===(e.boneId??e.handBoneId));if(a&&r){let e=(0,aL.ms)(a)[r.startJointId].rotation,t=v.quaternion.clone().multiply((0,aL.IA)(a,r).invert());return{type:"rotate-bone",characterId:a.id,boneId:r.id,rotation:(0,aL.Pw)(a,r,e.clone().invert().multiply(t))}}return a?{type:"put-character",character:{...a,position:i,rotation:n}}:null}if("cameraBoxId"in e){let a=t.cameraBoxes?.find(t=>t.id===e.cameraBoxId);return a?{type:"put-camera-box",box:{...a,position:i,rotation:n}}:null}let a=t.objects.find(t=>t.id===e.objectId);return a?{type:"put-object",object:{...a,position:i,rotation:n}}:null};w.addEventListener("mouseDown",()=>{P=!0,A=a$(L=r.current.draft),f.enabled=!1}),w.addEventListener("objectChange",()=>{P&&!M&&(M=requestAnimationFrame(()=>{M=0;let e=F();if(e&&L&&A)try{$(A(e).draft)}catch{$(L)}}))}),w.addEventListener("mouseUp",()=>{if(!P)return;let e=F();P=!1,f.enabled=!0,M&&(cancelAnimationFrame(M),M=0),e&&r.current.onOperation(e),L=null,A=null,$(r.current.draft),T()}),w.addEventListener("change",R);let E=()=>{P&&w.reset(),P=!1,L=null,A=null,f.enabled=!0,M&&(cancelAnimationFrame(M),M=0),$(r.current.draft),T()};e.domElement.addEventListener("pointercancel",E);let D=()=>{R(),r.current.onViewChange?.({position:g.position.toArray(),target:f.target.toArray()})};f.addEventListener("change",D);let _=null,z=!1,B=-1/0,q=null,O=(t,i=!1)=>{let n=e.domElement.getBoundingClientRect(),a=new aM.tBo;a.setFromCamera(new aM.I9Y((t.clientX-n.left)/n.width*2-1,-(t.clientY-n.top)/n.height*2+1),g),a.near=g.near,a.params.Line.threshold=.015;let r=k?a.intersectObjects(k.children,!0):[],o=i?r[0]:r.find(e=>"joint"===e.object.userData.rig)??r.find(e=>e.object.userData.rig)??r[0],s=a.intersectObjects([...S.children,...i?I.children:[]]).find(e=>{if(e.object.userData.cameraBoxId)return!0;if(!e.object.userData.cameraId||o)return!1;let i=e.point.clone().project(g);return i.z>=-1&&i.z<=1&&6>=Math.hypot(n.left+(i.x+1)*n.width/2-t.clientX,n.top+(1-i.y)*n.height/2-t.clientY)});if(s&&(!o||s.distance<o.distance)){let e=s.object.userData;return e.cameraId?{cameraId:e.cameraId}:{cameraBoxId:e.cameraBoxId}}if(o){let e=o.object instanceof aM.ZLX&&void 0!==o.instanceId?o.object.userData.instances[o.instanceId]:o.object.userData;return e.characterId?i?{characterId:e.characterId}:{characterId:e.characterId,jointId:e.jointId,boneId:e.boneId}:e.objectId?{objectId:e.objectId}:null}return null};e.domElement.addEventListener("pointerdown",e=>{h.focus(),_=[e.clientX,e.clientY],z=!1,0===e.button&&(!q||e.timeStamp-q.time>500||Math.hypot(e.clientX-q.x,e.clientY-q.y)>4)&&(q={selection:O(e,!0),x:e.clientX,y:e.clientY,time:e.timeStamp})}),e.domElement.addEventListener("pointermove",e=>{e.buttons&&_&&Math.hypot(e.clientX-_[0],e.clientY-_[1])>4&&(z=!0,B=performance.now(),q=null)}),e.domElement.addEventListener("pointerup",e=>{if(!_||z||0!==e.button||P||w.axis||r.current.disabled||Math.hypot(e.clientX-_[0],e.clientY-_[1])>4)return;let t=O(e);t&&r.current.onSelect(t)}),e.domElement.addEventListener("dblclick",e=>{if(0!==e.button||P||z||performance.now()-B<500||r.current.disabled)return;let t=q&&e.timeStamp-q.time<=500?q.selection:O(e,!0);q=null,t&&(e.preventDefault(),r.current.onEdit?.(t,{x:e.clientX,y:e.clientY}))});let U=new ResizeObserver(()=>{let{width:t,height:i}=h.getBoundingClientRect();t&&i&&(e.setSize(t,i),g.aspect=t/i,g.updateProjectionMatrix(),R())});return U.observe(h),o.current={rebuild:$,select:T,cancel:E},$(r.current.draft),T(),D(),()=>{for(let e of(o.current=null,M&&cancelAnimationFrame(M),N&&cancelAnimationFrame(N),U.disconnect(),f.dispose(),w.dispose(),y.geometry.dispose(),Array.isArray(y.material)?y.material:[y.material]))e.dispose();j.dispose(),n?.terminate(),a?.(new DOMException("","AbortError")),(0,aT.en)(I),(0,aT.en)(S),C.dispose(),b.dispose(),e.dispose(),e.forceContextLoss(),e.domElement.remove()}},[]),(0,a.useEffect)(()=>{o.current?.rebuild(e.draft),o.current?.select()},[e.draft,e.selection,e.mode,e.disabled,e.showRig,e.showCameras,e.interacting]),(0,a.useEffect)(()=>{void 0!==e.interactionResetKey&&o.current?.cancel()},[e.interactionResetKey]),(0,n.jsx)("div",{...(0,$.Se)({namespace:"human2ai",id:"spatial-viewport",name:"SpatialViewport",category:"canvas",origin:"project",status:"candidate"}),ref:t,className:"spatial-viewport",tabIndex:0,role:"region","aria-label":e.label,onKeyDown:t=>{if("Enter"===t.key&&e.selection&&!e.disabled){t.preventDefault();let i=t.currentTarget.getBoundingClientRect();e.onEdit?.(e.selection,{x:i.left+i.width/2,y:i.top+i.height/2});return}if("Escape"===t.key){o.current?.cancel(),e.onSelect(null);return}let i={ArrowLeft:[0,-1],ArrowRight:[0,1],ArrowDown:[1,-1],ArrowUp:[1,1],PageDown:[2,-1],PageUp:[2,1]}[t.key],n=e.selection;if(!i||e.disabled||!n||!("characterId"in n))return;let a=e.draft.characters.find(e=>e.id===n.characterId);if(a){if(n.jointId){t.preventDefault();let r=(0,aL.ms)(a)[n.jointId].position.toArray(),o=(0,aL.dS)(a.bones.find(e=>e.endJointId===n.jointId)?.modelPart??"");r[i[0]]+=i[1]*(t.shiftKey?5:1)*(o?.002*a.height:.02),e.onOperation({type:"move-joint",characterId:a.id,jointId:n.jointId,position:r})}else if(n.boneId||n.handBoneId){t.preventDefault();let r=a.bones.find(e=>e.id===(n.boneId??n.handBoneId));if(r.lockRotation||(0,aL.j4)(r))return;let o=[...r.rotation];o[i[0]]+=i[1]*(t.shiftKey?10:2),e.onOperation({type:"rotate-bone",characterId:a.id,boneId:r.id,rotation:o})}}},children:s&&(0,n.jsx)("div",{className:"spatial-viewport__error",role:"alert",children:e.errorLabel})})}var aU=i(22146),aH=i(14956);async function aG(e,t){let i=await Promise.all(e.map(e=>new Promise((t,i)=>{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>t(n),n.onerror=()=>i(Error("observation-image-load-failed")),n.src=e.source}))),{width:n,height:a,tiles:r}=(0,aH.u)(t,e.map(e=>e.face)),o=document.createElement("canvas");o.width=n,o.height=a;let s=o.getContext("2d");if(!s)throw Error("observation-image-canvas-unavailable");return s.font="14px sans-serif",s.textAlign="center",s.textBaseline="middle",i.forEach((i,n)=>{let{left:a,top:o}=r[n];s.fillStyle="#f1f3f5",s.fillRect(a,o,t,aU.Sn),s.fillStyle="#374151",s.fillText(e[n].label,a+t/2,o+aU.Sn/2,t-8),s.drawImage(i,a,o+aU.Sn,t,t)}),new Promise((e,t)=>{o.toBlob(i=>i?e(i):t(Error("observation-image-export-failed")),"image/png")})}let aW=[{face:"back",points:"42,8 73,24 73,60 42,44",rear:!0},{face:"left",points:"11,26 42,8 42,44 11,62",rear:!0},{face:"bottom",points:"11,62 42,44 73,60 42,78",rear:!0},{face:"top",points:"42,8 73,24 42,42 11,26"},{face:"front",points:"11,26 42,42 42,78 11,62"},{face:"right",points:"42,42 73,24 73,60 42,78"}],aJ=[["front","back"],["left","right"],["top","bottom"]];function aV({active:e,boxes:t,selectedBoxId:i,onSelectBox:r,pass:o,onPassChange:s,source:l,labels:d,copiedLabel:c,retryLabel:u,disabled:m}){let[h,p]=(0,a.useState)(aU.em),[g,f]=(0,a.useState)(0),[x,b]=(0,a.useState)(null),[v,w]=(0,a.useState)(null),[j,k]=(0,a.useState)(null),S=t.find(e=>e.id===i)??t[0],I=(e,t=!1)=>d[`cameraBox${e[0].toUpperCase()}${e.slice(1)}${t?"Toggle":""}`],C="color"===o?d.referenceColor:"structure"===o?d.referenceStructure:"depth"===o?d.referenceDepth:d.referenceSkeleton,P=e&&S?h.map(e=>({face:e,source:l?.(S.id,e,o),label:I(e)})):[],L=P.length&&P.every(e=>e.source)?JSON.stringify({boxId:S.id,pass:o,resolution:S.resolution,views:P,attempt:g}):null,A=x?.key===L&&"blob"in x?x:null,M=x?.key===L&&"error"in x,N=j?.key===L?j:null;(0,a.useEffect)(()=>{let e;if(b(null),!L)return;let t=!1,i=JSON.parse(L);return aG(i.views,i.resolution).then(i=>{t||(e=URL.createObjectURL(i),b({key:L,blob:i,url:e}))}).catch(()=>{t||b({key:L,error:!0})}),()=>{t=!0,e&&URL.revokeObjectURL(e)}},[L]);let R=async e=>{if(A&&S&&!m&&!v){w(e),k(null);try{if("copy"===e){if(!navigator.clipboard?.write||"u"<typeof ClipboardItem)throw Error("image-clipboard-unavailable");await navigator.clipboard.write([new ClipboardItem({"image/png":A.blob})]),k({key:A.key,message:c,error:!1})}else await ec(new File([A.blob],`${S.id}-${o}-${h.join("-")}.png`,{type:"image/png"}))}catch{k({key:A.key,message:"copy"===e?d.observationCopyFailed:d.observationDownloadFailed,error:!0})}finally{w(null)}}};return e?(0,n.jsxs)("section",{className:"spatial-observation","aria-label":d.cameraBoxTab,children:[(0,n.jsxs)("div",{className:"spatial-observation-toolbar",children:[(0,n.jsx)(y.A,{className:"spatial-observation-select","aria-label":d.cameraBoxTab,placeholder:d.cameraBoxTab,value:S?.id,disabled:m||!S,options:t.map(e=>({value:e.id,label:e.name})),onChange:r}),(0,n.jsx)(i6,{"aria-label":d.referencePass,value:o,onChange:e=>s(e),items:[{key:"color",label:d.referenceColor,mode:"text-only",disabled:m||!S},{key:"structure",label:d.referenceStructure,mode:"text-only",disabled:m||!S},{key:"depth",label:d.referenceDepth,mode:"text-only",disabled:m||!S},{key:"skeleton",label:d.referenceSkeleton,mode:"text-only",disabled:m||!S}]}),(0,n.jsxs)("div",{className:"spatial-observation-directions",role:"group","aria-label":d.cameraBoxView,children:[(0,n.jsx)("svg",{className:"spatial-observation-cube",viewBox:"0 0 84 86","aria-hidden":"true",children:aW.map(({face:e,points:t,rear:i})=>(0,n.jsx)("polygon",{points:t,"data-face":e,"data-enabled":!!(S&&h.includes(e)),"data-rear":i||void 0},e))}),(0,n.jsx)("div",{className:"spatial-observation-face-buttons",children:aJ.flatMap((e,t)=>e.map((e,i)=>{let a=!!(S&&h.includes(e));return(0,n.jsx)(ed.J,{className:"spatial-observation-face-button",size:"small",style:{gridRow:i+1,gridColumn:`${2*t+i+1} / span 2`},"aria-label":I(e),"aria-pressed":a,disabled:m||!S,backgroundColor:a?"color.action.primary":"color.surface.soft",textColor:a?"color.text.inverse":"color.text.secondary",onClick:()=>p(t=>aU.em.filter(i=>i===e?!t.includes(e):t.includes(i))),children:I(e,!0)},e)}))})]})]}),(0,n.jsx)("div",{className:"spatial-observation-preview","aria-busy":!!(L&&!A&&!M),children:S?h.length?L?M?(0,n.jsx)(aP.A,{type:"error",message:d.referenceLoadFailed,action:(0,n.jsx)(ed.J,{size:"small",disabled:m,onClick:()=>f(e=>e+1),children:u})}):A?(0,n.jsx)("img",{src:A.url,alt:`${S.name} \xb7 ${C} \xb7 ${P.map(e=>e.label).join(" / ")}`}):(0,n.jsx)(ia.G,{label:C,variant:"image"}):(0,n.jsx)("p",{className:"spatial-camera-pending",children:d.cameraPreviewPending}):(0,n.jsx)("p",{className:"spatial-camera-pending",children:d.noObservationDirections}):(0,n.jsx)("p",{className:"spatial-camera-pending",children:d.noCameraBoxes})}),N&&(N.error?(0,n.jsx)(aP.A,{type:"error",message:N.message}):(0,n.jsx)("p",{className:"spatial-observation-status",role:"status",children:N.message})),(0,n.jsxs)("div",{className:"spatial-observation-actions",children:[(0,n.jsx)(ed.J,{mode:"with-icon",icon:(0,n.jsx)(es.A,{"aria-hidden":"true"}),loading:"copy"===v,disabled:m||!A||!!v,onClick:()=>void R("copy"),children:d.copyObservationImage}),(0,n.jsx)(ed.J,{mode:"with-icon",icon:(0,n.jsx)(er.A,{"aria-hidden":"true"}),loading:"download"===v,disabled:m||!A||!!v,onClick:()=>void R("download"),children:d.downloadObservationImage})]})]}):null}i(78226);let aY=[{kind:"box",Icon:ay.A},{kind:"sphere",Icon:ax.A},{kind:"plane",Icon:tj.A}];function aK({value:e,onChange:t,...i}){let n=(0,a.useRef)(e),r=(0,a.useRef)(!1),o=(0,a.useRef)(!1),s=(0,a.useRef)(!1),[l,d]=(0,a.useState)(0);return(0,a.useLayoutEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]),(0,a.useLayoutEffect)(()=>{n.current=e,r.current=!1,o.current=!1},[e,i.disabled,l]),(0,a.createElement)(tl.A,{...i,key:`${e}/${!!i.disabled}/${l}`,defaultValue:e,onChange:e=>{n.current=e,r.current=!0},onPressEnter:e=>{e.nativeEvent.isComposing||e.target.blur()},onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),o.current=!0,e.currentTarget.blur())},onBlur:()=>{queueMicrotask(()=>{if(!s.current)return;let a=n.current;!o.current&&!i.disabled&&r.current&&null!==a&&Number.isFinite(a)&&a!==e&&t(a),r.current=!1,d(e=>e+1)})}})}function aX({draft:e,onOperation:t,showRig:i,onShowRigChange:r,showCameras:o,onShowCamerasChange:s,labels:l=ej.spatial,noteLabel:d=ej.notes.element.label,copiedLabel:c=ej.clipboard.copied,loading:u,disabled:m,error:h,onRetry:p,historyControls:g,interactionResetKey:f,initialCameraId:w,cameraSource:j,cameraBoxSource:S,details:P,panelHost:L,toolsLabel:A=ej.canvas.tools.label,onRequestProperties:M,actions:N=ej.actions}){let R,T,F,[E,D]=(0,a.useState)(w?{cameraId:w}:null),[B,q]=(0,a.useState)(w?"parameters":"info"),[O,U]=(0,a.useState)("space"),[H,G]=(0,a.useState)([]),[W,J]=(0,a.useState)(!0),[V,Y]=(0,a.useState)(!0),K=i??W,X=o??V,[Q,Z]=(0,a.useState)(null),[ee,et]=(0,a.useState)(null),[ei,en]=(0,a.useState)(null),[ea,er]=(0,a.useState)(null),[eo,el]=(0,a.useState)(null),ec=(0,a.useRef)(0),eu=()=>{cancelAnimationFrame(ec.current),ec.current=0,el(null)},em=(0,a.useRef)(null);(0,a.useLayoutEffect)(()=>(et(null),eu(),()=>{cancelAnimationFrame(ec.current),ec.current=0}),[e,E,B,m,u,O,f]);let eh=(t,i)=>ee?.source===e&&ee.key===t?ee.value:i,ep=(e,t,i)=>{et(null),e!==t&&i(e)},eg=t=>(em.current?.source!==e&&(em.current={source:e,apply:a$(e)}),em.current.apply(t)),[ef,ey]=(0,a.useState)("translate"),[ex,eb]=(0,a.useState)(w??e.cameras[0].id),[ev,ew]=(0,a.useState)("sheet"),[ek,eS]=(0,a.useState)(),[eI,eC]=(0,a.useState)("color"),eP=(0,a.useRef)({position:[3,2.2,5],target:[0,.9,0]}),eL=E&&"characterId"in E?e.characters.find(e=>e.id===E.characterId):void 0,eA=eL&&E&&"characterId"in E?eL.joints.find(e=>e.id===E.jointId):void 0,eM=eL&&E&&"characterId"in E?eL.bones.find(e=>e.id===E.boneId):void 0,eN=eL&&E&&"characterId"in E?eL.bones.find(e=>e.id===E.handBoneId):void 0,eR=eo?.source!==e||eo.characterId!==eL?.id||eo.handBoneId!==eN?.id||m||u||"parameters"!==B||"space"!==O?null:eo,e$=eA??eM??eN,eF=E&&"objectId"in E?e.objects.find(e=>e.id===E.objectId):void 0,eE=e.cameras.find(e=>e.id===(E&&"cameraId"in E?E.cameraId:ex))??e.cameras[0],eD=E&&"cameraId"in E?eE:void 0,e_=E&&"cameraBoxId"in E?e.cameraBoxes?.find(e=>e.id===E.cameraBoxId):void 0,ez=e_?S?.(e_.id,ev,eI):j?.(eE.id,eI),eB=e=>l[`cameraBox${e[0].toUpperCase()}${e.slice(1)}`],eq=eL??eF??eD??e_,eO=Q&&[...e.characters,...e.objects,...e.cameras,...e.cameraBoxes??[]].find(e=>e.id===Q.id),eU=eL&&eA?(0,aL.ms)(eL)[eA.id]:void 0,eH=Number(((eL?.torsoRatio??aL.s4)*100).toFixed(1)),eG=eh("torsoRatio",eH),eW=e=>`${l.torso} ${Number(e.toFixed(1))}%, ${l.legs} ${Number((100-e).toFixed(1))}%`,eJ=e=>l[`finger${e[0].toUpperCase()}${e.slice(1)}`],eV=(e,t=!1)=>{let i=(0,aL.dS)(e);if(!i)return;let n=t?["","fingerProximalBone","fingerMiddleBone","fingerDistalBone"][i.segment]:["fingerRoot","fingerMiddleJoint","fingerDistalJoint","fingerTip"][i.segment];return t&&"thumb"===i.finger&&i.segment<3?1===i.segment?l.thumbMetacarpal:l.thumbProximal:l[n]?.replace("{{finger}}",eJ(i.finger))},eY=(e,t,i=e)=>eV(i)??(t===e?l["joint"+e.split("-").map(e=>e[0].toUpperCase()+e.slice(1)).join("")]??t:t),eK=(e,t,i)=>eV(i,!0)??(t===e?l["bone"+i.split("-").map(e=>e[0].toUpperCase()+e.slice(1)).join("")]??t:t),eX=e=>`${e.id===e.modelPart?"":e.id.slice(0,-e.modelPart.length).replace(/-$/,"")+" "}${e.modelPart.startsWith("left")?l.handLeft:l.handRight}`,eQ=e=>`${e}-${globalThis.crypto.randomUUID()}`;(0,a.useLayoutEffect)(()=>{void 0!==f&&(E&&(!eq||"cameraId"in E&&!e.cameras.some(e=>e.id===E.cameraId)||"characterId"in E&&(E.jointId&&!eA||E.boneId&&!eM||E.handBoneId&&!eN))&&D(null),et(null),en(null),er(null),Z(null))},[f]);let eZ=e=>{m||t(e)},e0=(t,i=!1)=>{if(!eL||!eN||m||u)return;let n={...t,type:"pose-hand",characterId:eL.id,handBoneId:eN.id};cancelAnimationFrame(ec.current),ec.current=0;let a=()=>{ec.current=0;try{let t=eg(n);er(t.constrained?l.constrained:null),el(i?{source:e,draft:t.draft,characterId:eL.id,handBoneId:eN.id}:null),i||eZ(n)}catch{el(null),er(l.constrained)}};i?ec.current=requestAnimationFrame(a):a()},e1=e=>{if(!eL||m||u)return;let t={type:"set-proportions",characterId:eL.id,height:eL.height,headRatio:eL.headRatio,torsoRatio:eL.torsoRatio??aL.s4,...e};try{eg(t),en(null),eZ(t)}catch(e){en(e instanceof aL._1?l.proportionsLocked:l.constrained)}},e2=e=>{eL?eZ({type:"put-character",character:{...eL,...e}}):eF?eZ({type:"put-object",object:{...eF,...e}}):eD?eZ({type:"put-camera",camera:{...eD,...e}}):e_&&eZ({type:"put-camera-box",box:{...e_,...e}})},e3=(e,t,i,a=!1,r=.05)=>(0,n.jsxs)("div",{className:"spatial-field",children:[(0,n.jsx)("span",{children:e}),(0,n.jsx)("div",{className:"spatial-vector",children:t.map((o,s)=>(0,n.jsx)(aK,{"aria-label":`${e} ${[l.x,l.y,l.z][s]}`,value:Number(o.toFixed(3)),step:r,controls:!1,disabled:m||a,onChange:e=>{if(null!==e){let n=[...t];n[s]=e,i(n)}}},s))})]}),e5=e=>e?"characterId"in e?JSON.stringify(["character",e.characterId,e.jointId??null,e.boneId??null,e.handBoneId??null]):"objectId"in e?JSON.stringify(["object",e.objectId]):"cameraBoxId"in e?JSON.stringify(["camera-box",e.cameraBoxId]):JSON.stringify(["camera",e.cameraId]):void 0,{nodes:e8,selections:e4}=(0,a.useMemo)(()=>{let t=[],i=new Map,a=e=>e?.trim()?(0,n.jsx)(_.A,{title:(0,n.jsx)("span",{className:"spatial-note-tooltip",children:e}),children:(0,n.jsx)(iK.A,{tabIndex:0,"aria-label":d})}):void 0,r=(e,n,a,r,o)=>{let s=e5(e);i.set(s,e),t.push({key:s,title:n,parentKey:a,order:r,nodeKind:e&&"characterId"in e&&!e.jointId&&!e.boneId?"container":"content",trailing:o})};return e.characters.forEach((e,t)=>{let i=e5({characterId:e.id});r({characterId:e.id},e.name,null,t,a(e.note));let o=e.bones.filter(e=>e.modelPart.endsWith("-hand")),s=new Map;o.forEach(t=>{let n={characterId:e.id,handBoneId:t.id},a=e5(n);for(let o of(r(n,eX(t),i,3*e.joints.findIndex(e=>e.id===t.endJointId)),(0,aL.Au)(e,t)))s.set(o,a);s.set(t.startJointId,a)}),e.joints.forEach((t,a)=>{let o=e.bones.find(e=>e.endJointId===t.id),d=o&&(0,aL.dS)(o.modelPart);(!t.terminal||d)&&r({characterId:e.id,jointId:t.id},eY(t.id,t.name,o?.modelPart),s.get(t.id)??i,3*a+1,t.lockPosition&&(0,n.jsx)(_.A,{title:l.lockPosition,children:(0,n.jsx)(to.A,{"aria-label":l.lockPosition})})),o&&d?.segment!==0&&r({characterId:e.id,boneId:o.id},eK(o.id,o.name,o.modelPart),o.modelPart.endsWith("-wrist")?i:s.get(t.id)??i,3*a+2*!d,o.lockRotation&&(0,n.jsx)(_.A,{title:l.lockRotation,children:(0,n.jsx)(tu.A,{"aria-label":l.lockRotation})}))})}),e.objects.forEach((t,i)=>r({objectId:t.id},t.name,null,e.characters.length+i,a(t.note))),e.cameras.forEach((t,i)=>r({cameraId:t.id},t.name,null,e.characters.length+e.objects.length+i,a(t.note))),e.cameraBoxes?.forEach((t,i)=>r({cameraBoxId:t.id},t.name,null,e.characters.length+e.objects.length+e.cameras.length+i,a(t.note))),{nodes:t,selections:i}},[e,l,d]),e6=(t,i=!0)=>{if(Z(null),et(null),en(null),er(null),D(t),t&&(i&&q("parameters"),M?.(),"cameraId"in t&&eb(t.cameraId),"cameraBoxId"in t&&eS(t.cameraBoxId),"characterId"in t)){t.jointId&&ey("translate"),(t.boneId||t.handBoneId)&&ey("rotate");let i=e5({characterId:t.characterId}),n=e.characters.find(e=>e.id===t.characterId),a=n?.bones.find(e=>e.id===t.boneId||e.endJointId===t.jointId),r=n&&a?(0,aL.oT)(n,a)??n.bones.find(e=>e.modelPart.endsWith("-hand")&&e.startJointId===t.jointId):void 0,o=r?e5({characterId:t.characterId,handBoneId:r.id}):void 0;G(e=>[...new Set([...e,i,...o?[o]:[]])])}},e9=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_.A,{title:l.translate,children:(0,n.jsx)(ed.J,{mode:"with-icon","aria-label":l.translate,"aria-pressed":"translate"===ef,icon:(0,n.jsx)(ab.A,{"aria-hidden":"true"}),disabled:m||u||!!(eM||eN),onClick:()=>ey("translate"),children:l.translateMode})}),(0,n.jsx)(_.A,{title:l.rotate,children:(0,n.jsx)(ed.J,{mode:"with-icon","aria-label":l.rotate,"aria-pressed":"rotate"===ef,icon:(0,n.jsx)(tu.A,{"aria-hidden":"true"}),disabled:m||u||!!eA,onClick:()=>ey("rotate"),children:l.rotateMode})})]}),e7=(0,n.jsxs)("div",{className:"spatial-panel","data-canvas-editor":!0,children:[(0,n.jsx)(i6,{className:"spatial-panel-tabs","aria-label":l.panelViews,value:B,onChange:e=>{q(e),et(null)},items:[{key:"info",label:l.infoToolsTab,mode:"text-only"},{key:"objects",label:l.objects,mode:"text-only"},{key:"parameters",label:l.parameters,mode:"text-only"}]}),(0,n.jsx)("div",{className:"spatial-panel-body",children:"info"===B?(0,n.jsxs)(n.Fragment,{children:[P,(0,n.jsxs)("section",{className:"spatial-tools","aria-label":A,children:[(0,n.jsx)("h2",{children:A}),(0,n.jsxs)("div",{className:"spatial-add-actions",children:[(0,n.jsx)(eT.u,{icon:(0,n.jsx)(av.A,{"aria-hidden":"true"}),label:l.addCharacter,disabled:m||u,onClick:()=>{let e=eQ("character");eZ({type:"add-character",id:e,name:l.character}),e6({characterId:e})}}),(0,n.jsx)(eT.u,{icon:(0,n.jsx)(aw.A,{"aria-hidden":"true"}),label:l.addCamera,disabled:m||u,onClick:()=>{let t=eQ("camera");eZ({type:"put-camera",camera:(0,aL.oH)(t,l.camera.replace("{{number}}",String(e.cameras.length+1)))}),e6({cameraId:t})}})]}),(0,n.jsx)(eT.u,{icon:(0,n.jsx)(al.A,{"aria-hidden":"true"}),label:l.addCameraBox,disabled:m||u,onClick:()=>{let t=eQ("camera-box");eZ({type:"put-camera-box",box:(0,aL.ov)((0,aL.zP)(t,l.cameraBox),e,"scene")}),e6({cameraBoxId:t}),ew("sheet")}}),(0,n.jsx)("div",{className:"spatial-add-actions",children:aY.map(({kind:e,Icon:t})=>(0,n.jsx)(eT.u,{icon:(0,n.jsx)(t,{"aria-hidden":"true"}),label:l[e],disabled:m||u,onClick:()=>{let t=eQ(e);eZ({type:"put-object",object:{id:t,name:l[e],kind:e,position:[0,.3,0],rotation:[0,0,0],size:"plane"===e?[2,1,2]:[.6,.6,.6],color:"#b6a58c"}}),e6({objectId:t})}},e))}),(0,n.jsx)(aI.A,{checked:e.lightingEnabled??!1,disabled:m||u,onChange:e=>eZ({type:"set-lighting",enabled:e.target.checked}),children:l.lightingEffects}),(0,n.jsx)(aI.A,{checked:X,onChange:e=>(s??Y)(e.target.checked),children:l.showCameras}),(0,n.jsx)(aI.A,{checked:K,onChange:e=>(r??J)(e.target.checked),children:l.showRig}),K&&(0,n.jsxs)("div",{className:"spatial-rig-legend",children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("i",{className:"spatial-joint-dot"}),l.joints]}),(0,n.jsxs)("span",{children:[(0,n.jsx)("i",{className:"spatial-bone-dot"}),l.bones]})]})]})]}):"objects"===B?(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("section",{className:"spatial-objects","aria-label":l.objects,children:[(0,n.jsx)("h2",{children:l.objects}),u?(0,n.jsx)(ia.G,{label:l.title,rows:4}):(0,n.jsx)(nO,{className:"spatial-object-tree","aria-label":l.objects,nodes:e8,mode:"view",showCurrent:!1,showContentOrder:!1,showStatus:!1,showLock:!1,showIcon:!0,expandAction:!1,expandedKeys:H,onExpand:e=>G(e),selectedKeys:E?[e5(E)]:[],onSelect:e=>e6(e4.get(String(e[0]))??null,!1),icon:({eventKey:e})=>{let t=e4.get(String(e));return t&&"cameraId"in t?(0,n.jsx)(aw.A,{"aria-hidden":"true"}):t&&"cameraBoxId"in t?(0,n.jsx)(al.A,{"aria-hidden":"true"}):t&&"objectId"in t?(0,n.jsx)(tj.A,{"aria-hidden":"true"}):t&&"characterId"in t&&t.jointId?(0,n.jsx)(aj.A,{className:"spatial-joint-icon","aria-hidden":"true"}):t&&"characterId"in t&&t.boneId?(0,n.jsx)(ak.A,{className:"spatial-bone-icon","aria-hidden":"true"}):(0,n.jsx)(av.A,{"aria-hidden":"true"})}})]})}):(0,n.jsxs)(n.Fragment,{children:[!eq&&(0,n.jsx)("p",{className:"spatial-parameters-empty",children:l.selectObjectForParameters}),eq&&(0,n.jsxs)("section",{className:"spatial-parameters","aria-label":l.parameters,children:[(0,n.jsx)("h2",{children:l.parameters}),!eD&&!e$&&(0,n.jsx)("div",{className:"spatial-tool-modes",children:e9}),(0,n.jsxs)("label",{className:"spatial-field",children:[(0,n.jsx)("span",{children:eA?l.joints:eM?l.bones:l.name}),(0,n.jsx)(b.A,{"aria-label":l.name,defaultValue:eA?eY(eA.id,eA.name,eL?.bones.find(e=>e.endJointId===eA.id)?.modelPart):eM?eK(eM.id,eM.name,eM.modelPart):eN?eX(eN):eq.name,disabled:m||!!e$,onBlur:e=>{e.target.value.trim()&&e.target.value!==eq.name&&e2({name:e.target.value.trim()})}},`${eq.id}/${e$?.id??""}/${eq.name}`)]}),!e$&&(0,n.jsx)(C,{label:d,children:(0,n.jsx)(I,{"aria-label":d,value:eq.note??"",disabled:m,onChange:e=>e2({note:e.target.value})})}),eU&&eA&&eL?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"spatial-locks",children:(0,n.jsx)(aI.A,{checked:eA.lockPosition,disabled:m,onChange:e=>eZ({type:"lock-joint",characterId:eL.id,jointId:eA.id,position:e.target.checked}),children:l.lockPosition})}),e3(l.position,eU.position.toArray(),e=>eZ({type:"move-joint",characterId:eL.id,jointId:eA.id,position:e}),eA.lockPosition,(0,aL.dS)(eL.bones.find(e=>e.endJointId===eA.id)?.modelPart??"")?.005:.05)]}):(eM||eN)&&eL?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"spatial-locks",children:(0,n.jsx)(aI.A,{checked:(eM??eN).lockRotation,disabled:m,onChange:e=>eZ({type:"lock-bone",characterId:eL.id,boneId:(eM??eN).id,rotation:e.target.checked}),children:l.lockRotation})}),e3(l.localRotation,(eM??eN).rotation,e=>eZ({type:"rotate-bone",characterId:eL.id,boneId:(eM??eN).id,rotation:e}),(eM??eN).lockRotation||(0,aL.j4)(eM??eN),5),eM&&e3(l.angleMinimum,eM.limits.min,e=>eZ({type:"set-bone-limits",characterId:eL.id,boneId:eM.id,limits:{...eM.limits,min:e}}),(0,aL.j4)(eM),5),eM&&e3(l.angleMaximum,eM.limits.max,e=>eZ({type:"set-bone-limits",characterId:eL.id,boneId:eM.id,limits:{...eM.limits,max:e}}),(0,aL.j4)(eM),5)]}):(0,n.jsxs)(n.Fragment,{children:[e3(l.position,eq.position,e=>e2({position:e})),eD?e3(l.target,eD.target,e=>e2({target:e})):e3(l.rotation,(eL??eF??e_).rotation,e=>e2({rotation:e}),!1,5)]}),eL&&eN&&(R=(0,aL.Au)(eL,eN),T=e=>eL.bones.find(t=>R.has(t.endJointId)&&(0,aL.dS)(t.modelPart)?.finger===e&&(0,aL.dS)(t.modelPart)?.segment===1),F=(t,i,a)=>(0,n.jsxs)("div",{className:"spatial-hand-control",children:[(0,n.jsx)("span",{children:t}),(0,n.jsx)(aC.A,{min:0,max:100,step:2,value:eh(t,Math.round(Math.max(0,Math.min(100,i)))),disabled:m||u,ariaLabelForHandle:t,tooltip:{formatter:e=>`${e}%`},onChange:i=>{et({source:e,key:t,value:i}),e0(a(i/100),!0)},onChangeComplete:e=>{eu(),ep(e,Math.round(Math.max(0,Math.min(100,i))),e=>e0(a(e/100)))},onBlur:()=>{et(null),eu()}})]},t),(0,n.jsxs)("div",{className:"spatial-hand-controls",children:[(0,n.jsx)(_.A,{title:l.resetHandHint,children:(0,n.jsx)(ed.J,{mode:"with-icon",icon:(0,n.jsx)(tc.A,{"aria-hidden":"true"}),disabled:m||u,onClick:()=>{et(null),eu(),er(null),eZ({type:"reset-hand",characterId:eL.id,handBoneId:eN.id})},children:l.resetHand})}),aL.EG.filter(e=>T(e)).map(e=>F(l.fingerCurl.replace("{{finger}}",eJ(e)),T(e).rotation[0]/(0,aL.oq)(e)[0]*100,t=>({curl:{[e]:t}}))),T("little")&&F(l.fingerSpread,T("little").rotation[2]/(eN.modelPart.startsWith("left")?-18:18)*100,e=>({spread:e})),T("thumb")&&F(l.thumbOpposition,T("thumb").rotation[1]/(eN.modelPart.startsWith("left")?60:-60)*100,e=>({thumbOpposition:e})),ea&&(0,n.jsx)("span",{className:"spatial-proportion-error",role:"alert",children:ea})]})),eL&&!e$&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_.A,{title:l.resetPoseHint,children:(0,n.jsx)(ed.J,{mode:"with-icon",icon:(0,n.jsx)(tc.A,{"aria-hidden":"true"}),disabled:m,onClick:()=>{en(null),et(null),eZ({type:"reset-pose",characterId:eL.id})},children:l.resetPose})}),(0,n.jsxs)("label",{className:"spatial-field",children:[(0,n.jsx)("span",{children:l.appearance}),(0,n.jsx)(y.A,{"aria-label":l.appearance,value:eL.appearance,disabled:m||u,options:[{value:"quaternius",label:l.appearanceQuaternius},{value:"geometric",label:l.appearanceGeometric}],onChange:e=>e2({appearance:e})})]}),(0,n.jsxs)("label",{className:"spatial-field",children:[(0,n.jsx)("span",{children:l.bodyType}),(0,n.jsx)(y.A,{"aria-label":l.bodyType,value:eL.bodyType??"male",disabled:m||u,options:[{value:"male",label:l.bodyMale},{value:"female",label:l.bodyFemale}],onChange:e=>e1({bodyType:e})})]}),(0,n.jsxs)("div",{className:"spatial-dimensions",children:[(0,n.jsxs)("label",{className:"spatial-field",children:[(0,n.jsx)("span",{children:l.proportions}),(0,n.jsx)(aK,{controls:!1,"aria-label":l.proportions,min:2,max:12,step:.5,precision:1,value:eL.headRatio,disabled:m,onChange:e=>null!==e&&e1({headRatio:e})})]}),(0,n.jsxs)("label",{className:"spatial-field",children:[(0,n.jsx)("span",{children:l.height}),(0,n.jsx)(aK,{controls:!1,"aria-label":l.height,min:.2,max:20,step:.1,value:eL.height,disabled:m,onChange:e=>null!==e&&e1({height:e})})]})]}),(0,n.jsxs)("div",{className:"spatial-body-ratio",children:[(0,n.jsxs)("div",{className:"spatial-ratio-heading",children:[(0,n.jsxs)("span",{children:[l.bodyLegRatio," ",(0,n.jsx)(_.A,{title:l.bodyLegRatioHint,children:(0,n.jsx)(iK.A,{tabIndex:0,"aria-label":l.bodyLegRatioHint})})]}),(0,n.jsx)(_.A,{title:l.resetBodyLegRatio,children:(0,n.jsx)(ed.J,{size:"small",mode:"icon-only",icon:(0,n.jsx)(tc.A,{"aria-hidden":"true"}),"aria-label":l.resetBodyLegRatio,disabled:m||u,onClick:()=>e1({torsoRatio:aL.s4})})})]}),(0,n.jsxs)("div",{className:"spatial-ratio-values",children:[(0,n.jsxs)("span",{children:[l.torso," ",eG,"%"]}),(0,n.jsxs)("span",{children:[l.legs," ",Number((100-eG).toFixed(1)),"%"]})]}),(0,n.jsx)("div",{className:"spatial-ratio-track",style:{background:`linear-gradient(to right, var(--yisiui-color-action-primary) ${eG}%, var(--yisiui-color-border-default) ${eG}%)`},children:(0,n.jsx)(aC.A,{className:"spatial-ratio-slider",min:100*aL.VO.min,max:100*aL.VO.max,step:2,value:eG,disabled:m||u,marks:eG%2?{[eG]:eG}:void 0,styles:{root:{left:`${100*aL.VO.min}%`,right:`${(1-aL.VO.max)*100}%`},rail:{background:"transparent"},track:{background:"transparent"}},ariaLabelForHandle:l.bodyLegRatio,ariaValueTextFormatterForHandle:eW,tooltip:{formatter:e=>eW(e??eG)},onChange:t=>et({source:e,key:"torsoRatio",value:t}),onChangeComplete:e=>ep(e,eH,e=>e1({torsoRatio:e/100})),onBlur:()=>et(null)})})]}),Object.keys(aL.aY).map(t=>{let i=aL.aY[t],a=Number(((eL[t]??1)*100).toFixed(1)),r=eh(t,a);return(0,n.jsxs)("div",{className:"spatial-shape-control",children:[(0,n.jsxs)("span",{children:[l[t],"neckLength"===t&&(0,n.jsxs)(n.Fragment,{children:[" ",(0,n.jsx)(_.A,{title:l.bodyShapeHint,children:(0,n.jsx)(iK.A,{tabIndex:0,"aria-label":l.bodyShapeHint})})]})]}),(0,n.jsx)(aC.A,{min:100*i.min,max:100*i.max,step:2,value:r,disabled:m||u,marks:r%2?{[r]:""}:void 0,ariaLabelForHandle:l[t],ariaValueTextFormatterForHandle:e=>`${e}%`,tooltip:{formatter:e=>`${e}%`},onChange:i=>et({source:e,key:t,value:i}),onChangeComplete:e=>ep(e,a,e=>e1({[t]:e/100})),onBlur:()=>et(null)}),(0,n.jsx)(aK,{"aria-label":l[t],controls:!1,min:100*i.min,max:100*i.max,step:2,value:r,disabled:m||u,formatter:e=>`${e}%`,parser:e=>Number(e?.replace("%","")),onChange:e=>null!==e&&e1({[t]:e/100})})]},t)}),ei&&(0,n.jsx)("span",{className:"spatial-proportion-error",role:"alert",children:ei})]}),eF&&e3(l.size,eF.size,e=>e2({size:e})),(eL||eF)&&!e$&&(0,n.jsxs)("label",{className:"spatial-field",children:[(0,n.jsx)("span",{children:l.color}),(0,n.jsx)("input",{type:"color","aria-label":l.color,disabled:m,value:(eL??eF).color,onChange:e=>e2({color:e.target.value})})]}),e_&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"spatial-tool-modes",children:[(0,n.jsx)(_.A,{title:l.cameraBoxHint,children:(0,n.jsx)(iK.A,{tabIndex:0,"aria-label":l.cameraBoxHint})}),(0,n.jsx)(ed.J,{size:"small",disabled:m||u||!e.characters.length&&!e.objects.length,onClick:()=>eZ({type:"fit-camera-box",id:e_.id,region:"scene"}),children:l.fitCameraBoxScene}),(0,n.jsx)(ed.J,{size:"small",disabled:m||u||!e.characters.length,onClick:()=>eZ({type:"fit-camera-box",id:e_.id,region:"hands"}),children:l.fitCameraBoxHands})]}),(0,n.jsxs)("label",{className:"spatial-field",children:[(0,n.jsx)("span",{children:l.cameraBoxSize}),(0,n.jsx)(aK,{controls:!1,"aria-label":l.cameraBoxSize,value:Number(e_.size.toFixed(3)),min:.05,max:1e3,step:.05,disabled:m,onChange:e=>null!==e&&e2({size:e})})]}),(0,n.jsxs)("label",{className:"spatial-field",children:[(0,n.jsx)("span",{children:l.cameraBoxResolution}),(0,n.jsx)(y.A,{"aria-label":l.cameraBoxResolution,value:e_.resolution,disabled:m,options:[...new Set([128,256,512,1024,e_.resolution])].sort((e,t)=>e-t).map(e=>({value:e,label:`${e} \xd7 ${e}`})),onChange:e=>e2({resolution:e})})]})]}),eD&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ed.J,{size:"small",disabled:m,onClick:()=>e2(eP.current),children:l.useView}),(0,n.jsxs)("label",{className:"spatial-field",children:[(0,n.jsx)("span",{children:l.projection}),(0,n.jsx)(y.A,{"aria-label":l.projection,value:eD.projection,disabled:m,options:[{value:"perspective",label:l.perspective},{value:"orthographic",label:l.orthographic}],onChange:e=>e2({projection:e})})]}),(0,n.jsxs)("label",{className:"spatial-field",children:[(0,n.jsx)("span",{children:"perspective"===eD.projection?l.fov:l.span}),(0,n.jsx)(aK,{controls:!1,"aria-label":"perspective"===eD.projection?l.fov:l.span,value:"perspective"===eD.projection?eD.fov:eD.span,min:"perspective"===eD.projection?10:.1,max:"perspective"===eD.projection?120:1e3,disabled:m,onChange:e=>null!==e&&e2("perspective"===eD.projection?{fov:e}:{span:e})})]}),(0,n.jsx)("div",{className:"spatial-output-size",children:["width","height"].map(e=>(0,n.jsxs)("label",{className:"spatial-field",children:[(0,n.jsx)("span",{children:"width"===e?l.outputWidth:l.outputHeight}),(0,n.jsx)(aK,{controls:!1,"aria-label":"width"===e?l.outputWidth:l.outputHeight,min:128,max:2048,step:16,precision:0,disabled:m,value:eD[e],onChange:t=>null!==t&&e2({[e]:t})})]},e))}),(0,n.jsx)(aI.A,{checked:null===eD.background,disabled:m,onChange:e=>e2({background:e.target.checked?null:"#ffffff"}),children:l.transparent})]}),!e$&&(0,n.jsxs)("div",{className:"spatial-object-actions",children:[(0,n.jsx)(ed.J,{mode:"with-icon",size:"small",icon:(0,n.jsx)(es.A,{"aria-hidden":"true"}),disabled:m,onClick:()=>{let e=eQ("copy");eL?eZ({type:"put-character",character:{...structuredClone(eL),id:e,position:[eL.position[0]+.8,eL.position[1],eL.position[2]]}}):eF?eZ({type:"put-object",object:{...structuredClone(eF),id:e,position:[eF.position[0]+.8,eF.position[1],eF.position[2]]}}):eD?eZ({type:"put-camera",camera:{...structuredClone(eD),id:e}}):e_&&eZ({type:"put-camera-box",box:{...structuredClone(e_),id:e}})},children:l.duplicate}),(0,n.jsx)(k.x,{"aria-label":N.delete,size:"small",icon:(0,n.jsx)(x.A,{}),disabled:m||!!(eD&&1===e.cameras.length),confirmLabel:N.delete,cancelLabel:N.cancel,title:l.deleteConfirm,onConfirm:()=>{eZ({type:"remove",id:eq.id}),D(null)},children:null})]})]},`${e5(E)}/${f??0}/${!!u}`),(0,n.jsxs)("section",{className:"spatial-preview","aria-label":l.cameraView,children:[(0,n.jsx)("h2",{children:e_?l.cameraBoxSheet:l.cameraView}),e_?(0,n.jsx)(y.A,{"aria-label":l.cameraBoxView,value:ev,options:["sheet",...aL.em].map(e=>({value:e,label:eB(e)})),onChange:ew}):(0,n.jsx)(y.A,{"aria-label":l.selectCamera,value:eE.id,options:e.cameras.map(e=>({value:e.id,label:e.name})),onChange:e=>{eb(e),eD&&e6({cameraId:e})}}),(0,n.jsx)(aQ,{value:eI,onChange:eC,labels:l,disabled:m||u}),ez&&(0,n.jsx)(a0,{source:ez,camera:e_?{id:`${e_.id}-${ev}`,name:`${e_.name} \xb7 ${eB(ev)}`,...(0,aL.D5)(e_,ev)}:eE,pass:eI,labels:l,retryLabel:N.retry,disabled:m},ez)]})]})})]});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("section",{...(0,$.Se)({namespace:"human2ai",id:"spatial-workspace-view",name:"SpatialWorkspaceView",category:"composition",origin:"project",status:"candidate"}),className:"spatial-workspace","data-canvas-editor":!0,"aria-label":l.title,children:(0,n.jsx)(i7,{className:"spatial-workflow","data-active-stage":O,stateControls:(0,n.jsxs)("div",{className:"spatial-workspace-controls",children:[h&&(0,n.jsx)("span",{className:"spatial-workspace-error",role:"alert","aria-label":h,children:(0,n.jsx)(_.A,{title:p?`${h} \xb7 ${N.retry}`:h,trigger:["hover","focus"],children:(0,n.jsx)(ed.J,{mode:"icon-only",size:"small",textColor:"color.status.danger",backgroundColor:"none","aria-label":p?`${h} \xb7 ${N.retry}`:h,icon:(0,n.jsx)(aS.A,{"aria-hidden":"true"}),onClick:p})})}),(0,n.jsx)(i6,{className:"spatial-workspace-tabs","aria-label":l.workspaceViews,value:O,onChange:U,items:[{key:"space",label:l.spaceTab,mode:"text-only"},{key:"cameras",label:l.cameras,mode:"text-only"},{key:"cameraBoxes",label:l.cameraBoxTab,mode:"text-only"}]})]}),children:(0,n.jsx)("div",{className:"spatial-center",children:u?(0,n.jsx)(ia.G,{label:l.title,variant:"image"}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"spatial-space",hidden:"space"!==O,children:[g,(0,n.jsx)(aO,{interactionResetKey:f,interacting:!!eR,showRig:K,showCameras:X,draft:eR?.draft??e,selection:E,mode:ef,onSelect:e6,onEdit:(t,i)=>{if(m||u)return;let n="characterId"in t?{characterId:t.characterId}:t,a="characterId"in n?n.characterId:"objectId"in n?n.objectId:"cameraId"in n?n.cameraId:n.cameraBoxId,r=[...e.characters,...e.objects,...e.cameras,...e.cameraBoxes??[]].find(e=>e.id===a);r&&(e6(n),Z({id:a,name:r.name,...i}))},onOperation:eZ,onViewChange:e=>{eP.current=e},label:l.viewport,errorLabel:l.webglFailed,disabled:m})]}),"cameras"===O&&(0,n.jsx)("section",{className:"spatial-camera-gallery","aria-label":l.cameras,children:e.cameras.map(e=>(0,n.jsx)(aZ,{camera:e,selected:eD?.id===e.id,source:j,labels:l,retryLabel:N.retry,disabled:m,onSelect:()=>e6({cameraId:e.id})},e.id))}),(0,n.jsx)(aV,{active:"cameraBoxes"===O,boxes:e.cameraBoxes??[],selectedBoxId:ek,onSelectBox:e=>e6({cameraBoxId:e}),pass:eI,onPassChange:eC,source:S,labels:l,copiedLabel:c,retryLabel:N.retry,disabled:m})]})})})}),L&&(0,z.createPortal)(e7,L),Q&&eO&&(0,n.jsx)(v.A,{open:!0,title:l.editObject,footer:null,width:360,rootClassName:"spatial-object-editor-modal",destroyOnHidden:!0,mask:{closable:!0},closable:{"aria-label":N.cancel},onCancel:()=>Z(null),style:{position:"absolute",margin:0,left:`min(${Math.max(16,Q.x+12)}px, calc(100vw - 376px))`,top:`min(${Math.max(16,Q.y+12)}px, calc(100vh - 360px))`},children:(0,n.jsxs)("div",{className:"spatial-object-editor-fields","data-spatial-object-editor":eO.id,"data-human2ai-auto-save-node-editor":!0,children:[(0,n.jsx)(C,{label:l.name,children:(0,n.jsx)(b.A,{"aria-label":l.name,value:Q.name,maxLength:200,disabled:m,onChange:e=>{let t=e.target.value;Z({...Q,name:t}),t.trim()&&t.trim()!==eO.name&&e2({name:t.trim()})},onBlur:()=>Z(e=>e?{...e,name:eO.name}:null)})}),(0,n.jsx)(C,{label:d,children:(0,n.jsx)(I,{autoFocus:!0,"aria-label":d,value:eO.note??"",disabled:m,onChange:e=>e2({note:e.target.value})})})]})})]})}function aQ({value:e,onChange:t,labels:i,disabled:a}){return(0,n.jsx)(i6,{className:"spatial-reference-tabs",compact:!0,"aria-label":i.referencePass,value:e,onChange:e=>t(e),items:[{key:"color",label:i.referenceColor,mode:"text-only",disabled:a},{key:"structure",label:i.referenceStructure,mode:"text-only",disabled:a},{key:"depth",label:i.referenceDepth,mode:"text-only",disabled:a},{key:"skeleton",label:i.referenceSkeleton,mode:"text-only",disabled:a}]})}function aZ({camera:e,selected:t,source:i,labels:r,retryLabel:o,disabled:s,onSelect:l}){let[d,c]=(0,a.useState)("color"),[u,m]=(0,a.useState)(),h=i?.(e.id,d),p=!!(h&&u===h&&!s);return(0,n.jsxs)("figure",{className:"spatial-camera-card","data-camera-id":e.id,"data-selected":t,children:[(0,n.jsx)(ed.J,{className:"spatial-camera-select",backgroundColor:"none","aria-label":`${e.name} \xb7 ${r.parameters}`,"aria-pressed":t,onClick:l}),(0,n.jsx)("div",{className:"spatial-camera-image",children:h?(0,n.jsx)(a0,{source:h,camera:e,pass:d,labels:r,retryLabel:o,disabled:s,gallery:!0,onReady:m},`${d}:${h}`):(0,n.jsx)("p",{className:"spatial-camera-pending",children:r.cameraPreviewPending})}),(0,n.jsxs)("figcaption",{children:[(0,n.jsxs)("div",{className:"spatial-camera-caption-content",children:[(0,n.jsx)("span",{className:"spatial-camera-name",children:e.name}),(0,n.jsx)("div",{className:"spatial-camera-pass-controls",children:(0,n.jsx)(aQ,{value:d,onChange:e=>{m(void 0),c(e)},labels:r,disabled:s})})]}),(0,n.jsx)(ed.J,{className:"spatial-camera-download",mode:"icon-only",size:"small",icon:(0,n.jsx)(er.A,{"aria-hidden":"true"}),iconLabel:r.downloadReference,title:r.downloadReference,disabled:!p,href:p?h:void 0,download:`${e.id}-${d}.png`})]})]})}function a0({source:e,camera:t,pass:i,labels:r,retryLabel:o,disabled:s,gallery:l,onReady:d}){let[c,u]=(0,a.useState)("loading"),[m,h]=(0,a.useState)(0);(0,a.useLayoutEffect)(()=>{d?.(void 0)},[e,d]);let p="color"===i?r.referenceColor:"structure"===i?r.referenceStructure:"depth"===i?r.referenceDepth:r.referenceSkeleton;return(0,n.jsxs)(n.Fragment,{children:["error"===c&&(0,n.jsx)(aP.A,{type:"error",message:r.referenceLoadFailed,action:(0,n.jsx)(ed.J,{size:"small",disabled:s,onClick:()=>{u("loading"),h(e=>e+1)},children:o})}),(0,n.jsxs)("div",{className:"spatial-reference-image",style:{display:"error"===c?"none":void 0,aspectRatio:`${t.width} / ${t.height}`,maxWidth:l?void 0:230*t.width/t.height},children:["loading"===c&&(0,n.jsx)(ia.G,{label:p,variant:"image",compact:!0}),(0,n.jsx)("img",{src:e,loading:l?"lazy":"eager",alt:`${t.name} \xb7 ${p}`,width:t.width,height:t.height,onLoad:()=>{u("ready"),d?.(e)},onError:()=>{u("error"),d?.(void 0)},style:{visibility:"loading"===c?"hidden":void 0}},m)]}),!l&&(0,n.jsx)(ed.J,{mode:"with-icon",size:"small",icon:(0,n.jsx)(er.A,{"aria-hidden":"true"}),disabled:s||"ready"!==c,href:s||"ready"!==c?void 0:e,download:`${t.id}-${i}.png`,children:r.downloadReference})]})}var a1=i(11581);function a2({value:e,size:t=32,className:i,style:a,...r}){let o=Number.isFinite(e)?Math.min(99,Math.max(1,Math.trunc(e))):1,s=`${Number.isFinite(t)?Math.max(1,t):32}px`;return(0,n.jsx)("span",{...r,...(0,j.S)("number-badge","NumberBadge","component"),className:["yisi-number-badge",i].filter(Boolean).join(" "),style:{...a,width:s,height:s,minWidth:s,minHeight:s,maxWidth:s,maxHeight:s},children:(0,n.jsx)("span",{className:"yisi-number-badge-value",children:o})})}i(6059);let a3=[],a5={items:a3,parent:null,waiting:!0},a8={ranges:[],descendants:0};class a4{constructor(e){this.listeners=new Set,this.selected=[],this.columns=[],this.focus=new Map,this.firstEnabled=[],this.matches=new Map,this.query="",this.count=0,this.subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}),this.getColumn=e=>this.columns[e]??a5,this.getQuery=()=>this.query,this.getMatchCount=()=>this.count,this.getMatch=e=>this.matches.get(e)??a8,this.isDisabled=e=>!!(this.config.disabled||this.config.columns[e]?.loading||this.config.columns[e]?.error!=null),this.getRow=(e,t)=>{let i=this.isDisabled(e)||!!t.disabled,n=this.focus.get(e)??this.selected[e]??this.firstEnabled[e];return Number(this.selected[e]===t)|Number(!i&&n===t)<<1|Number(i)<<2},this.setFocus=(e,t)=>{this.focus.get(e)===t||this.isDisabled(e)||t.disabled||(this.focus.set(e,t),this.emit())},this.select=(e,t)=>{if(this.isDisabled(e)||t.disabled||!this.columns[e]?.items.includes(t)||this.selected[e]===t)return;let i=[...this.path.slice(0,e),t.key],n=[...this.selected.slice(0,e),t];void 0===this.config.value&&(this.path=i,this.rebuildColumns(),this.emit()),this.config.onChange?.(i,n)},this.setQuery=e=>{this.query!==e&&(this.query=e,this.matchQuery(),this.emit())},this.config=e,this.validate(e),this.path=e.value??e.defaultValue??[],this.rebuildColumns()}emit(){this.listeners.forEach(e=>e())}configure(e){let t,i=this.config,n=e.options!==i.options||e.columns.length!==i.columns.length;n&&this.validate(e),this.config=e;let a=e.value??this.path;(n||(t=this.path,!(a.length===t.length&&a.every((e,i)=>e===t[i]))))&&(this.path=a,this.rebuildColumns()),n&&this.matchQuery(),this.emit()}rebuildColumns(){let e=[],t=[],i=this.config.options,n=null;for(let a=0;a<this.config.columns.length;a++){let r=a>0&&null===n,o=this.columns[a];e.push(o?.items===i&&o.parent===n&&o.waiting===r?o:{items:i,parent:n,waiting:r}),(o?.items!==i||o?.parent!==n)&&this.focus.delete(a);let s=i.find(e=>e.key===this.path[a]&&!e.disabled);s&&t.length===a&&t.push(s),n=s??null,i=s?.children??a3}this.firstEnabled=e.map(e=>e.items.find(e=>!e.disabled)),this.columns=e,this.selected=t,this.path=t.map(e=>e.key)}matchQuery(){let e=this.query.trim(),t=this.matches;if(this.matches=new Map,this.count=0,!e)return;let i=RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"giu"),n=e=>{let a=0;for(let r of e){let e=[...r.label.matchAll(i)].map(e=>[e.index,e.index+e[0].length]),o=n(r.children??a3),s=t.get(r)??a8,l=s.descendants===o&&s.ranges.length===e.length&&s.ranges.every((t,i)=>t[0]===e[i][0]&&t[1]===e[i][1]);(e.length||o)&&this.matches.set(r,l?s:{ranges:e,descendants:o}),a+=Number(e.length>0)+o}return a};this.count=n(this.config.options)}validate(e){if(e.columns.length<2)throw Error("CascadeSelector 至少需要两栏");let t=new Set,i=(n,a)=>{if(n.length&&a>=e.columns.length)throw Error("CascadeSelector columns 必须覆盖所有数据层级");let r=new Set;for(let e of n){if(!e.key||r.has(e.key))throw Error("CascadeSelector 同级选项 key 必须非空且唯一");if(!e.label.trim())throw Error("CascadeSelector 选项 label 必须非空");if(t.has(e))throw Error("CascadeSelector options 不得包含循环引用");r.add(e.key),t.add(e),i(e.children??a3,a+1),t.delete(e)}};i(e.options,0)}}i(38438);let a6={level:e=>`第 ${e} 级选项`,search:"搜索所有层级",searchPlaceholder:"搜索所有层级的选项",clearSearch:"清空搜索",chooseParent:"请先选择上一级",empty:"暂无选项",noChildren:"该选项没有下级",loading:"正在加载选项",descendantMatches:e=>`下级有 ${e} 项匹配`,searchResults:e=>e?`匹配 ${e} 项`:"未找到匹配项"};function a9(e){(0,a.useEffect)(()=>{let t,i=e.current;if(!i)return;let n=()=>{i.dataset.scrolling="true",clearTimeout(t),t=setTimeout(()=>{delete i.dataset.scrolling},600)};return i.addEventListener("scroll",n,{passive:!0}),()=>{i.removeEventListener("scroll",n),clearTimeout(t),delete i.dataset.scrolling}},[e])}let a7=(0,a.memo)(function({store:e,labels:t,disabled:i}){let r=(0,a.useId)(),o=(0,a.useSyncExternalStore)(e.subscribe,e.getQuery,e.getQuery),s=(0,a.useSyncExternalStore)(e.subscribe,e.getMatchCount,e.getMatchCount),[l,d]=(0,a.useState)(o),c=(0,a.useRef)(!1),u=(0,a.useRef)(null);return(0,n.jsxs)("div",{className:"yisi-cascade-selector-search",children:[(0,n.jsx)("label",{htmlFor:r,className:"yisi-cascade-selector-sr",children:t.search}),(0,n.jsxs)("div",{className:"yisi-cascade-selector-search-control",children:[(0,n.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[(0,n.jsx)("circle",{cx:"8.5",cy:"8.5",r:"5.5"}),(0,n.jsx)("path",{d:"m13 13 4 4"})]}),(0,n.jsx)("input",{ref:u,id:r,type:"search",value:l,disabled:i,placeholder:t.searchPlaceholder,onCompositionStart:()=>{c.current=!0},onCompositionEnd:t=>{c.current=!1,e.setQuery(t.currentTarget.value)},onChange:t=>{d(t.target.value),c.current||e.setQuery(t.target.value)}}),l&&(0,n.jsx)("button",{type:"button",disabled:i,"aria-label":t.clearSearch,onClick:()=>{d(""),e.setQuery(""),u.current?.focus()},children:"\xd7"})]}),(0,n.jsx)("span",{className:"yisi-cascade-selector-search-status",role:"status",children:o.trim()?t.searchResults(s):""})]})}),re=(0,a.memo)(function({store:e,labels:t,level:i,item:r,renderOption:o}){let s=(0,a.useSyncExternalStore)(e.subscribe,()=>e.getRow(i,r),()=>e.getRow(i,r)),l=(0,a.useSyncExternalStore)(e.subscribe,()=>e.getMatch(r),()=>e.getMatch(r)),d=(0,a.useId)(),c=[],u=0;for(let[e,t]of l.ranges)c.push(r.label.slice(u,e),(0,n.jsx)("mark",{children:r.label.slice(e,t)},e)),u=t;c.push(r.label.slice(u));let m=(0,n.jsx)("span",{className:"yisi-cascade-selector-option-label",children:c});return(0,n.jsxs)("button",{type:"button",role:"radio","aria-label":r.label,"aria-checked":!!(1&s),"aria-describedby":l.descendants?d:void 0,disabled:!!(4&s),tabIndex:2&s?0:-1,className:"yisi-cascade-selector-option","data-option-key":r.key,"data-match":l.ranges.length>0||void 0,onFocus:()=>e.setFocus(i,r),onClick:()=>e.select(i,r),children:[(0,n.jsxs)("span",{className:"yisi-cascade-selector-option-main",children:[null!=r.icon&&(0,n.jsx)("span",{className:"yisi-cascade-selector-icon","aria-hidden":"true",children:r.icon}),o?o(r,m):m,l.descendants>0?(0,n.jsxs)("span",{className:"yisi-cascade-selector-match-badge","aria-hidden":"true",title:t.descendantMatches(l.descendants),children:[(0,n.jsx)(a2,{value:l.descendants,size:20,style:{fontSize:"var(--yisiui-font-size-xs)",background:"var(--yisiui-color-selection-text)",color:"var(--yisiui-color-text-on-primary)"}}),l.descendants>99&&(0,n.jsx)("span",{className:"yisi-cascade-selector-match-overflow",children:"+"})]}):!!r.children?.length&&(0,n.jsx)("span",{"aria-hidden":"true",className:"yisi-cascade-selector-chevron",children:"›"})]}),l.descendants>0&&(0,n.jsx)("span",{id:d,className:"yisi-cascade-selector-sr yisi-cascade-selector-match-hint",children:t.descendantMatches(l.descendants)})]})}),rt=(0,a.memo)(function({store:e,labels:t,level:i,column:r,disabled:o,renderOption:s}){let l=(0,a.useSyncExternalStore)(e.subscribe,()=>e.getColumn(i),()=>e.getColumn(i)),d=(0,a.useRef)(null);a9(d);let c=(0,a.useRef)(l),u=(0,a.useRef)(!1),m=o||r.loading||null!=r.error;(0,a.useLayoutEffect)(()=>{if(c.current!==l){if(d.current&&(d.current.scrollTop=0),u.current&&document.activeElement===document.body){let e=d.current?.querySelector('[role="radio"][tabindex="0"]')??d.current;e?.focus({preventScroll:!0})}c.current=l}},[l]);let h=null;return r.loading?h=t.loading:null!=r.error?h=r.error:l.items.length||(h=l.waiting?t.chooseParent:l.parent?t.noChildren:t.empty),(0,n.jsx)("div",{className:"yisi-cascade-selector-column","data-level":i,children:(0,n.jsx)("div",{ref:d,role:"radiogroup","aria-label":r["aria-label"]||t.level(i+1),"aria-orientation":"vertical","aria-disabled":m||void 0,"aria-busy":r.loading||void 0,className:"yisi-cascade-selector-list",tabIndex:null!=h||m||l.items.every(e=>e.disabled)?0:-1,onKeyDown:function(e){let t,i=e.target;if("radio"!==i.getAttribute("role"))return;let n=[...e.currentTarget.querySelectorAll('[role="radio"]:not(:disabled)')],a=n.indexOf(i);switch(e.key){case"ArrowDown":t=n[(a+1)%n.length];break;case"ArrowUp":t=n[(a-1+n.length)%n.length];break;case"Home":t=n[0];break;case"End":t=n[n.length-1];break;case"ArrowLeft":case"ArrowRight":{let i="rtl"===getComputedStyle(e.currentTarget).direction,n="ArrowRight"===e.key!==i?e.currentTarget.parentElement?.nextElementSibling:e.currentTarget.parentElement?.previousElementSibling;t=n?.querySelector('[role="radio"][tabindex="0"]:not(:disabled)')??void 0,e.preventDefault(),t?.focus(),t?.scrollIntoView({block:"nearest",inline:"nearest"});return}default:return}e.preventDefault(),t?.focus(),t?.click(),t?.scrollIntoView({block:"nearest",inline:"nearest"})},onFocusCapture:()=>{u.current=!0},onBlurCapture:e=>{e.relatedTarget&&!e.currentTarget.contains(e.relatedTarget)&&(u.current=!1)},children:null!=h?(0,n.jsx)("div",{className:"yisi-cascade-selector-message",role:null==r.error||r.loading?"status":"alert",children:h}):l.items.map(a=>(0,n.jsx)(re,{store:e,labels:t,level:i,item:a,renderOption:s},a.key))})})}),ri=(0,a.memo)(function({store:e,labels:t,columns:i,disabled:r,renderOption:o,width:s="100%",height:l=360,...d}){let c=(0,a.useRef)(null);a9(c);let u=i.map(e=>`minmax(${e.minWidth??144}px, ${e.width??1}fr)`).join(" ");return(0,n.jsxs)("div",{...(0,j.S)("cascade-selector","CascadeSelector"),role:"group","aria-label":d["aria-label"],className:["yisi-cascade-selector",d.className].filter(Boolean).join(" "),style:{width:s,height:l,...d.style},children:[(0,n.jsxs)("div",{className:"yisi-cascade-selector-header",children:[null!=d.title&&(0,n.jsx)("div",{className:"yisi-cascade-selector-title",children:d.title}),(0,n.jsx)(a7,{store:e,labels:t,disabled:r})]}),(0,n.jsx)("div",{ref:c,className:"yisi-cascade-selector-columns",style:{gridTemplateColumns:u},children:i.map((i,a)=>(0,n.jsx)(rt,{store:e,labels:t,column:i,level:a,disabled:r,renderOption:o},a))})]})}),rn=(0,a.memo)(function(e){for(let t of e.columns)if(void 0!==t.width&&(!Number.isFinite(t.width)||t.width<=0)||void 0!==t.minWidth&&(!Number.isFinite(t.minWidth)||t.minWidth<=0))throw Error("CascadeSelector 每栏的 width/minWidth 必须为正数");let[t]=(0,a.useState)(()=>new a4(e)),i=(0,a.useMemo)(()=>({...a6,...e.labels}),[e.labels]);return(0,a.useLayoutEffect)(()=>{t.configure(e)},[t,e]),(0,n.jsx)(ri,{store:t,labels:i,columns:e.columns,title:e.title,"aria-label":e["aria-label"],disabled:!!e.disabled,renderOption:e.renderOption,width:e.width,height:e.height,className:e.className,style:e.style})});function ra(e){let{labels:t,loading:i,saving:r}=e,o=(0,a.useMemo)(()=>[{"aria-label":t.group,width:1,loading:i},{"aria-label":t.session,width:1.5,loading:i},{"aria-label":t.output,width:1,loading:i}],[t.group,t.session,t.output,i]);return(0,n.jsx)(v.A,{open:e.open,title:e.title??t.label,width:920,onCancel:()=>{r||e.onCancel()},closable:{"aria-label":t.cancel,disabled:r},keyboard:!r,mask:{closable:!r},destroyOnHidden:!0,footer:"create"===e.mode?(0,n.jsx)(ed.J,{type:"primary",loading:r,disabled:i||r||!e.previewUrl||!!e.error,onClick:e.onInsert,children:t.create}):e.deleteAction?(0,n.jsx)("div",{className:"human2ai-session-preview-picker__delete-action",children:e.deleteAction}):null,children:(0,n.jsxs)("div",{...(0,$.Se)({namespace:"human2ai",id:"session-preview-picker",name:"SessionPreviewPicker",category:"module",origin:"project",status:"candidate"}),className:"human2ai-session-preview-picker","aria-busy":r||i||void 0,children:[e.projectRequired?(0,n.jsx)(aP.A,{type:"info",title:t.projectRequired}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(rn,{"aria-label":t.label,options:e.options,columns:o,value:e.value,onChange:e.onChange,disabled:i,height:250,width:"100%",labels:e.selectorLabels}),e.error&&(0,n.jsx)(aP.A,{type:"error",title:e.error,action:(0,n.jsx)(ed.J,{onClick:e.onRetry,children:t.retry})}),e.warning&&(0,n.jsx)(aP.A,{type:"warning",title:e.warning})]}),(0,n.jsxs)("div",{className:"human2ai-session-preview-picker__content",children:[(0,n.jsx)("div",{className:"human2ai-session-preview-picker__actions",children:e.actions}),(0,n.jsxs)("div",{className:"human2ai-session-preview-picker__preview-column",children:[(0,n.jsx)(a1.A,{spinning:!!r,children:(0,n.jsx)("div",{className:"human2ai-session-preview-picker__preview",children:e.preview??(e.previewUrl&&(0,n.jsx)("img",{src:e.previewUrl,alt:t.label,onError:e.onPreviewError,draggable:!1},e.previewUrl))})}),e.previewActions&&(0,n.jsx)("div",{className:"human2ai-session-preview-picker__preview-actions",children:e.previewActions})]})]})]})})}i(52944)},73251:()=>{},76109:(e,t,i)=>{"use strict";i.d(t,{EN:()=>a,JX:()=>n,jQ:()=>o,qP:()=>r});let n=["bringToFront","bringForward","sendBackward","sendToBack"];function a(e,t){let i=new Set(e),n=[];for(let e of t??[])i.delete(e)&&n.push(e);return[...n,...i]}function r(e,t,i){let n=new Set(t),a=[...e];if("bringToFront"===i||"sendToBack"===i){let t=e.filter(e=>n.has(e)),r=e.filter(e=>!n.has(e));a="bringToFront"===i?[...r,...t]:[...t,...r]}else if("bringForward"===i)for(let e=a.length-2;e>=0;e-=1)n.has(a[e])&&!n.has(a[e+1])&&([a[e],a[e+1]]=[a[e+1],a[e]]);else for(let e=1;e<a.length;e+=1)n.has(a[e])&&!n.has(a[e-1])&&([a[e],a[e-1]]=[a[e-1],a[e]]);return a.every((t,i)=>t===e[i])?e:a}function o(e,t,i){let n=new Map(e.map(e=>[i(e),e]));return a([...n.keys()],t).map(e=>n.get(e))}},78226:()=>{},78269:(e,t,i)=>{"use strict";i.d(t,{cq:()=>a.cq,Hm:()=>o,Xn:()=>n.Xn,xB:()=>n.xB,vF:()=>s,JZ:()=>n.JZ,eq:()=>n.eq,hN:()=>n.hN,QR:()=>r.QR,MR:()=>r.MR,SZ:()=>p,fQ:()=>H.fQ,Y8:()=>a.Y8,s6:()=>n.s6,wG:()=>H.wG,mq:()=>n.mq,PX:()=>H.PX,Oq:()=>v,i:()=>a.i,bc:()=>w,MY:()=>n.MY,u7:()=>c,Pe:()=>n.Pe,vm:()=>n.vm,Wn:()=>n.Wn,mU:()=>G,CP:()=>n.CP,q3:()=>d,Ai:()=>n.Ai,uK:()=>H.uK,OS:()=>F,gf:()=>D,iY:()=>R,qU:()=>$,Kj:()=>E,yU:()=>H.yU,sJ:()=>l,oF:()=>n.oF,CV:()=>n.CV,co:()=>n.co,IU:()=>n.IU,z_:()=>n.z_,rz:()=>n.rz,hG:()=>n.hG,KZ:()=>H.KZ,QQ:()=>n.QQ,n_:()=>m,ht:()=>h,ET:()=>n.ET,Dj:()=>r.Dj,gH:()=>g,ai:()=>n.ai,QY:()=>n.QY,s:()=>n.s,M6:()=>n.M6,VC:()=>n.VC,yg:()=>n.yg});var n=i(34944),a=i(3500),r=i(19767);let o=["thirds","golden-section","symmetry","golden-spiral","triangle","radial"];function s(e,t){let i=(0,n.M6)(e),a=i.plans??[],r=1;for(;a.some(e=>e.id===`plan-${r}`);)r+=1;let o={id:`plan-${r}`,visible:!0},s="triangle"===t?{...o,type:t,x:.5,y:.5,rotation:0,width:.6,height:.6}:"symmetry"===t?{...o,type:t,x:.5,y:.5,rotation:90}:"golden-spiral"===t?{...o,type:t,x:.618,y:.382,rotation:135,scale:.65,mirrored:!1}:"radial"===t?{...o,type:t,mode:"uniform",x:.5,y:.5,rotation:0,rayCount:8,spread:360}:{...o,type:t,axes:"both"};return{draft:(0,n.M6)({...i,plans:[...a,s]}),id:s.id}}function l(e,t){return(0,n.M6)({...e,plans:(e.plans??[]).map(e=>e.id===t.id?t:e)})}function d(e,t){return(0,n.M6)({...e,plans:(e.plans??[]).filter(e=>e.id!==t)})}function c(e,t,i){return(0,n.M6)({...e,plans:(e.plans??[]).map(n=>t.includes(n.id)?g(n,e.frame,i):n)})}function u(e){if("free"===e.mode)return[...e.angles];let t=e.spread/(360===e.spread?e.rayCount:e.rayCount-1);return Array.from({length:e.rayCount},(i,n)=>(e.rotation+n*t)%360)}function m(e,t){if(e.mode===t)return e;let i={id:e.id,type:e.type,visible:e.visible,x:e.x,y:e.y},n=u(e);return"free"===t?{...i,mode:t,angles:n}:{...i,mode:t,rotation:n[0],rayCount:n.length,spread:360}}function h(e,t){if("uniform"===e.mode)return{...e,rayCount:t};let i=e.angles.slice(0,t);for(;i.length<t;){let e=[...i].sort((e,t)=>e-t),t=e.map((t,i)=>(e[i+1]??e[0]+360)-t),n=t.indexOf(Math.max(...t));i.push((e[n]+t[n]/2)%360)}return{...e,angles:i}}function p(e,t){let i=(0,a.i)(t),r=e=>({x:i.x+e.x*i.width,y:i.y+e.y*i.height});if("thirds"===e.type||"golden-section"===e.type){let t="thirds"===e.type?1/3:(3-Math.sqrt(5))/2,i=[];for(let n of[t,1-t])"horizontal"!==e.axes&&i.push([r({x:n,y:0}),r({x:n,y:1})]),"vertical"!==e.axes&&i.push([r({x:0,y:n}),r({x:1,y:n})]);return{paths:i,handles:[]}}if("triangle"===e.type){let t=r(e),n=e.rotation*Math.PI/180,a=e.width*i.width,o=e.height*i.height,s=[{x:0,y:-o/2},{x:-a/2,y:o/2},{x:a/2,y:o/2}].map(({x:e,y:i})=>({x:t.x+e*Math.cos(n)-i*Math.sin(n),y:t.y+e*Math.sin(n)+i*Math.cos(n)}));return{paths:[[...s,s[0]]],handles:s}}let o=r("symmetry"===e.type?{x:.5,y:.5}:e),s=("symmetry"===e.type?(0,n.km)(e.rotation,t):"radial"===e.type?0:e.rotation)*Math.PI/180,l=(e,t=0)=>({x:o.x+e*Math.cos(s+t),y:o.y+e*Math.sin(s+t)}),d=Math.min(i.width,i.height);if("symmetry"===e.type){let e=Math.hypot(i.width,i.height)+Math.hypot(o.x-i.x,o.y-i.y),n=(0,a.Y8)(t).map(e=>l(.3*d,e*Math.PI/180-s));return{paths:[[l(-e),l(e)]],handles:[o,l(.3*d)],snapPoints:n}}if("radial"===e.type){let t=Math.hypot(i.width,i.height)+Math.hypot(o.x-i.x,o.y-i.y),n=u(e).map(e=>e*Math.PI/180);return{paths:n.map(e=>[o,l(t,e)]),handles:[o,...("free"===e.mode?n:n.slice(0,1)).map(e=>l(.3*d,e))]}}let c=d*e.scale,m=(1+Math.sqrt(5))/2,h=6*Math.PI,p=Array.from({length:241},(t,i)=>{let n=(i/240-1)*h;return l(c*m**(n/(Math.PI/2)),e.mirrored?-n:n)}),g=c*(1+(Math.log(m)/(Math.PI/2))**2)*(h/240)**2/8;return{paths:[p],handles:[o,l(c)],maxCurveDeviation:g}}function g(e,t,i,r){if("thirds"===e.type||"golden-section"===e.type)return e;let o=(0,a.i)(t);if("symmetry"===e.type){let a={...e,x:.5,y:.5,rotation:(0,n.km)(e.rotation,t)};if(1!==r)return a;let{handles:[o,s]}=p(a,t),l=s.x+i.x-o.x,d=s.y+i.y-o.y;return 1>Math.hypot(l,d)?a:{...a,rotation:(0,n.km)(180*Math.atan2(d,l)/Math.PI,t)}}if(void 0===r||"triangle"!==e.type&&0===r)return{...e,x:e.x+i.x/o.width,y:e.y+i.y/o.height};let{handles:s}=p(e,t),l={x:o.x+e.x*o.width,y:o.y+e.y*o.height},d=s[r].x+i.x-l.x,c=s[r].y+i.y-l.y;if("triangle"===e.type){if(0===r)return 1>Math.hypot(d,c)?e:{...e,rotation:180*Math.atan2(c,d)/Math.PI+90,height:2*Math.hypot(d,c)/o.height};let t=e.rotation*Math.PI/180;return{...e,width:Math.max(.01,2*Math.abs(d*Math.cos(t)+c*Math.sin(t))/o.width),height:Math.max(.01,2*(-d*Math.sin(t)+c*Math.cos(t))/o.height)}}if(1>Math.hypot(d,c))return e;let u=180*Math.atan2(c,d)/Math.PI;return"radial"===e.type?"free"===e.mode?{...e,angles:e.angles.map((e,t)=>t===r-1?u:e)}:{...e,rotation:u}:{...e,rotation:u,scale:Math.max(.01,Math.hypot(d,c)/Math.min(o.width,o.height))}}function f(e,t){return{x:e.x-t.x,y:e.y-t.y}}function y(e,t){return e.x*t.y-e.y*t.x}function x(e,t){return{x:e.start.x+(e.end.x-e.start.x)*t,y:e.start.y+(e.end.y-e.start.y)*t}}var b=i(19204);function v(e){var t;let i=(0,n.M6)(e);return(0,b.U)(JSON.stringify({...(t=i).plans?{plans:t.plans}:{},...t.states?{activeStateId:t.activeStateId,states:t.states.map(({id:e,number:t,name:i,layout:n})=>({id:e,number:t,name:i,layout:n}))}:{},...t.layerOrder?{layerOrder:t.layerOrder}:{},version:t.version,kind:t.kind,processingSemantic:t.processingSemantic,..."soft"===t.previewMode?{previewMode:t.previewMode}:{},frame:{width:t.frame.width,height:t.frame.height,bounds:{x:t.frame.bounds.x,y:t.frame.bounds.y,width:t.frame.bounds.width,height:t.frame.bounds.height}},...""===t.overallNote?{}:{overallNote:t.overallNote},focusPoints:t.focusPoints.map(({id:e,x:t,y:i,...n})=>({id:e,x:t,y:i,...L(n)})),...t.directionLine?{directionLine:{id:t.directionLine.id,x:t.directionLine.x,y:t.directionLine.y,rotation:t.directionLine.rotation,...L(t.directionLine)}}:{},areas:t.areas.map(e=>({id:e.id,primitive:e.primitive,x:e.x,y:e.y,area:e.area,aspect:e.aspect,...L(e),..."auto"===e.visualWeight?{}:{visualWeight:e.visualWeight},...e.displayText?{displayText:e.displayText}:{},...e.isLightSource?{isLightSource:!0}:{},...void 0===e.rotation?{}:{rotation:e.rotation},...void 0===e.width?{}:{width:e.width},...void 0===e.height?{}:{height:e.height},...void 0===e.corners?{}:{corners:e.corners}})),images:t.images.map(e=>({id:e.id,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,assetId:e.assetId,...e.cameraReference?{cameraReference:e.cameraReference}:{},crop:e.crop,...L(e),..."auto"===e.visualWeight?{}:{visualWeight:e.visualWeight}}))}))}function w(e){var t,i,o;let s,l,d,c=(0,n.yg)((0,n.M6)(e)),u=(0,n.VC)(c),m=c.areas.map((e,t)=>{let i=(0,r.Sq)((0,r.QR)(e,a.cq)),n=(0,a.i)(c.frame),o=(0,a.Bi)(e,c.frame),s=n.width*n.height;return{id:e.id,primitive:e.primitive,note:e.note,annotation:e.annotation,semanticType:e.semanticType,shotScale:e.shotScale,visualWeight:e.visualWeight,isLightSource:e.isLightSource??!1,...void 0===e.displayText?{}:{displayText:e.displayText},center:{x:P(o.x),y:P(o.y)},areaShare:P(e.area*a.cq.width*a.cq.height/s),visibleAreaShare:P(u.visibleAreaShares[t]),rotation:P(e.rotation??0),clippedSides:S(i,c.frame),bounds:{minimumX:P((i.minimumX-n.x)/n.width),maximumX:P((i.maximumX-n.x)/n.width),minimumY:P((i.minimumY-n.y)/n.height),maximumY:P((i.maximumY-n.y)/n.height)}}}),h=c.images.map(e=>{let t=(0,r.xz)(e),i=(0,a.i)(c.frame),n=(0,a.Bi)(e,c.frame);return{id:e.id,note:e.note,annotation:e.annotation,semanticType:e.semanticType,shotScale:e.shotScale,visualWeight:e.visualWeight,center:{x:P(n.x),y:P(n.y)},widthShare:P(t.width/i.width),heightShare:P(t.height/i.height),areaShare:P(t.width*t.height/(i.width*i.height)),rotation:P(e.rotation),clippedSides:S({minimumX:t.x,maximumX:t.x+t.width,minimumY:t.y,maximumY:t.y+t.height},c.frame)}});return{version:1,kind:"composition-inspection",...c.plans?{plans:structuredClone(c.plans)}:{},planningIntersections:function(e){let t=(0,a.i)(e.frame),i=(e.plans??[]).flatMap(i=>{let n=p(i,e.frame);return("triangle"===i.type?n.paths[0].slice(0,-1).map((e,t)=>[e,n.paths[0][t+1]]):n.paths).map((a,r)=>({source:{planId:i.id,type:i.type,lineId:function(e,t){if("thirds"===e.type||"golden-section"===e.type){let i="both"===e.axes?t%2==0?"vertical":"horizontal":e.axes;return`${i}-${"both"===e.axes?Math.floor(t/2)+1:t+1}`}return"triangle"===e.type?`edge-${t+1}`:"radial"===e.type?`ray-${t+1}`:"symmetry"===e.type?"axis":"spiral"}(i,r),visible:i.visible},segments:a.slice(0,-1).map((e,t)=>({start:e,end:a[t+1]})),maxCurveDeviationPx:(n.maxCurveDeviation??0)*e.frame.width/t.width}))}),n=[];for(let e=0;e<i.length;e+=1)for(let a=e+1;a<i.length;a+=1){let r=i[e],o=i[a],s=[],l=[];for(let e of r.segments)for(let t of o.segments){let i=function(e,t){if(Math.max(e.start.x,e.end.x)+1e-7<Math.min(t.start.x,t.end.x)||Math.max(t.start.x,t.end.x)+1e-7<Math.min(e.start.x,e.end.x)||Math.max(e.start.y,e.end.y)+1e-7<Math.min(t.start.y,t.end.y)||Math.max(t.start.y,t.end.y)+1e-7<Math.min(e.start.y,e.end.y))return null;let i=f(e.end,e.start),n=f(t.end,t.start),a=f(t.start,e.start),r=Math.hypot(i.x,i.y),o=Math.hypot(n.x,n.y);if(r<=1e-7||o<=1e-7)return null;let s=y(i,n);if(Math.abs(s)<=1e-12*r*o){if(Math.abs(y(a,i))>1e-7*r)return null;let t=(a.x*i.x+a.y*i.y)/r**2,o=t+(n.x*i.x+n.y*i.y)/r**2,s=Math.max(0,Math.min(t,o)),l=Math.min(1,Math.max(t,o));return l<s-1e-7/r?null:l-s<=1e-7/r?{point:x(e,Math.max(0,Math.min(1,(s+l)/2)))}:{overlap:{start:x(e,s),end:x(e,l)}}}let l=y(a,n)/s,d=y(a,i)/s;return l<-1e-7/r||l>1+1e-7/r||d<-1e-7/o||d>1+1e-7/o?null:{point:x(e,Math.max(0,Math.min(1,l)))}}(e,t);i&&"point"in i?s.push(i.point):i&&l.push(i.overlap)}for(let e of s){if(e.x<t.x-1e-7||e.x>t.x+t.width+1e-7||e.y<t.y-1e-7||e.y>t.y+t.height+1e-7||l.some(t=>(function(e,t){let i=f(t.end,t.start),n=f(e,t.start),a=x(t,Math.max(0,Math.min(1,(n.x*i.x+n.y*i.y)/(i.x**2+i.y**2))));return 1e-7>=Math.hypot(e.x-a.x,e.y-a.y)})(e,t)))continue;let i=n.find(t=>1e-7>=Math.hypot(t.point.x-e.x,t.point.y-e.y));for(let t of(i||(i={point:e,sources:[],maxCurveDeviationPx:0},n.push(i)),[r.source,o.source]))i.sources.some(e=>e.planId===t.planId&&e.lineId===t.lineId)||i.sources.push(t);i.maxCurveDeviationPx=Math.max(i.maxCurveDeviationPx,r.maxCurveDeviationPx,o.maxCurveDeviationPx)}}return n.sort((e,t)=>e.point.y-t.point.y||e.point.x-t.point.x).map((i,n)=>{let r={x:Math.max(0,Math.min(1,(i.point.x-t.x)/t.width)),y:Math.max(0,Math.min(1,(i.point.y-t.y)/t.height))};return{id:`intersection-${n+1}`,framePoint:r,canvasPoint:(0,a.tw)(r,e.frame),sources:i.sources,precision:{kind:i.sources.some(e=>"golden-spiral"===e.type)?"approximate":"exact",maxCurveDeviationPx:i.maxCurveDeviationPx}}})}(c),sourceFingerprint:v(e),processingSemantic:c.processingSemantic,previewMode:c.previewMode??"precise",frame:structuredClone(c.frame),overallNote:c.overallNote,focusPoints:c.focusPoints.map(e=>({...e,...C(e,c.frame)})),directionLine:c.directionLine?{...c.directionLine,...C(c.directionLine,c.frame)}:null,areas:m,images:h,axes:{focus:k(c.focusPoints,c),area:k(c.areas,c)},metrics:u,guidance:(s=[...(t=c).directionLine?[{...t.directionLine,localAxis:"x"}]:[],...t.areas.filter(e=>"circle"!==e.primitive||"free"===e.aspect&&Math.abs(e.width*a.cq.width-e.height*a.cq.height)>1e-9).flatMap(e=>["x","y"].map(t=>({...e,localAxis:t})))],l=t.frame.width/(t.frame.bounds.width*a.cq.width),s.flatMap(e=>t.focusPoints.map(t=>{let i=(e.rotation??0)+90*("y"===e.localAxis),n=i*Math.PI/180,r=(t.x-e.x)*a.cq.width,o=(t.y-e.y)*a.cq.height,s=180*Math.atan2(o,r)/Math.PI-i;return{sourceId:e.id,focusId:t.id,localAxis:e.localAxis,angleError:1e-9>Math.hypot(r,o)?null:P(Math.abs((s%360+540)%360-180)),perpendicularDistance:P(Math.abs(r*Math.sin(n)-o*Math.cos(n))*l),forwardDistance:P((r*Math.cos(n)+o*Math.sin(n))*l)}}))),layout:"editorial-layout"===c.processingSemantic?(i=c,d={auto:[],high:[],medium:[],low:[],decorative:[]},(o=m).forEach(e=>d[e.visualWeight].push(e.id)),{alignmentTolerance:.02,textRegionIds:o.filter(({semanticType:e})=>"text-region"===e).map(({id:e})=>e),weightGroups:d,areas:o.map(e=>({id:e.id,widthShare:P(e.bounds.maximumX-e.bounds.minimumX),heightShare:P(e.bounds.maximumY-e.bounds.minimumY),margins:{top:e.bounds.minimumY,right:P(1-e.bounds.maximumX),bottom:P(1-e.bounds.maximumY),left:e.bounds.minimumX}})),pairs:function(e){let t=[];for(let i=0;i<e.length;i+=1)for(let n=i+1;n<e.length;n+=1){let a=e[i],r=e[n],o=a.bounds.maximumX-a.bounds.minimumX,s=r.bounds.maximumX-r.bounds.minimumX,l=a.bounds.maximumY-a.bounds.minimumY,d=r.bounds.maximumY-r.bounds.minimumY,c=[];for(let[e,t,i]of[["left",a.bounds.minimumX,r.bounds.minimumX],["center-x",a.center.x,r.center.x],["right",a.bounds.maximumX,r.bounds.maximumX],["top",a.bounds.minimumY,r.bounds.minimumY],["center-y",a.center.y,r.center.y],["bottom",a.bounds.maximumY,r.bounds.maximumY]]).02>=Math.abs(t-i)&&c.push(e);t.push({ids:[a.id,r.id],widthRatio:P(j(o,s)),heightRatio:P(j(l,d)),areaRatio:P(j(a.areaShare,r.areaShare)),horizontalGap:P(function(e,t,i,n){return t<i?i-t:n<e?e-n:0}(a.bounds.minimumX,a.bounds.maximumX,r.bounds.minimumX,r.bounds.maximumX)),verticalGap:P(function(e,t,i,n){return t<i?i-t:n<e?e-n:0}(a.bounds.minimumY,a.bounds.maximumY,r.bounds.minimumY,r.bounds.maximumY)),centerDistance:P(Math.hypot(a.center.x-r.center.x,a.center.y-r.center.y)),alignments:c})}return t}(o),focusRelations:i.focusPoints.map(e=>{let t=C(e,i.frame),n=o.map(e=>{var i,n;return{id:e.id,distance:(i=t,Math.hypot(Math.max((n=e.bounds).minimumX-i.x,0,i.x-n.maximumX),Math.max(n.minimumY-i.y,0,i.y-n.maximumY)))}}),a=n.filter(({distance:e})=>e<=1e-9).map(({id:e})=>e),r=n.sort((e,t)=>e.distance-t.distance)[0];return{focusId:e.id,containingAreaIds:a,nearestAreaId:r?.id??null,distance:r?P(r.distance):null}})}):null}}function j(e,t){return Math.max(e,t)/Math.min(e,t)}function k(e,t){let i=[],n=(0,a.i)(t.frame),r=Math.hypot(n.width,n.height);for(let t=0;t<e.length;t+=1)for(let n=t+1;n<e.length;n+=1){let a=I(e[t]),o=I(e[n]);i.push({ids:[e[t].id,e[n].id],angle:P(180*Math.atan2(o.y-a.y,o.x-a.x)/Math.PI),distance:P(Math.hypot(o.x-a.x,o.y-a.y)/r)})}return i}function S(e,t){let i=[],n=(0,a.i)(t),r=1e-9*Math.max(n.width,n.height);return e.minimumY<n.y-r&&i.push("top"),e.maximumX>n.x+n.width+r&&i.push("right"),e.maximumY>n.y+n.height+r&&i.push("bottom"),e.minimumX<n.x-r&&i.push("left"),i}function I(e){return{x:e.x*a.cq.width,y:e.y*a.cq.height}}function C(e,t){let i=(0,a.Bi)(e,t);return{x:P(i.x),y:P(i.y)}}function P(e){return Math.round(1e6*e)/1e6}function L(e){return{...!1===e.visible?{visible:!1}:{},...""===e.note?{}:{note:e.note},...""===e.annotation?{}:{annotation:e.annotation},...""===e.semanticType?{}:{semanticType:e.semanticType},..."auto"===e.shotScale?{}:{shotScale:e.shotScale}}}var A=i(34345);function M(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function N(e,t){let i=e[1].x-e[0].x,n=e[1].y-e[0].y,a=e[2].x-e[0].x,r=e[2].y-e[0].y,o=t[1].x-t[0].x,s=t[1].y-t[0].y,l=t[2].x-t[0].x,d=t[2].y-t[0].y,c=i*r-a*n,u=(o*r-l*n)/c,m=(s*r-d*n)/c,h=(i*l-a*o)/c,p=(i*d-a*s)/c;return[u,m,h,p,t[0].x-u*e[0].x-h*e[0].y,t[0].y-m*e[0].x-p*e[0].y]}function R(e,t){let i=(0,n.yg)(e),o=[];for(let e of i.images)o.push(_(e,t));for(let e of i.areas){if(e.isLightSource){o.push(D(e));continue}let t=(0,r.QR)(e,a.cq);"circle"===t.type?o.push(`<circle cx="${B(t.cx)}" cy="${B(t.cy)}" r="${B(t.radius)}" fill="#c8c8c8" stroke="#000000" stroke-width="4"/>`):"ellipse"===t.type?o.push(`<ellipse cx="${B(t.cx)}" cy="${B(t.cy)}" rx="${B(t.radiusX)}" ry="${B(t.radiusY)}" fill="#c8c8c8" stroke="#000000" stroke-width="4"/>`):o.push(`<polygon points="${t.points.map(e=>`${B(e.x)},${B(e.y)}`).join(" ")}" fill="#c8c8c8" stroke="#000000" stroke-width="4"/>`),(0,n.MY)(e)&&e.displayText?.trim()&&(o[o.length-1]+=F(e))}if(i.directionLine){let e=(0,r.Wu)(i.directionLine,a.cq);o.push(`<line x1="${B(e.start.x)}" y1="${B(e.start.y)}" x2="${B(e.end.x)}" y2="${B(e.end.y)}" stroke="#000000" stroke-width="3"/>`)}for(let e of i.focusPoints){let t=e.x*a.cq.width,i=e.y*a.cq.height;o.push(`<line x1="${B(t-14)}" y1="${B(i)}" x2="${B(t+14)}" y2="${B(i)}" stroke="#000000" stroke-width="3"/><line x1="${B(t)}" y1="${B(i-14)}" x2="${B(t)}" y2="${B(i+14)}" stroke="#000000" stroke-width="3"/><circle cx="${B(t)}" cy="${B(i)}" r="9" fill="#ffffff" stroke="#000000" stroke-width="3"/>`)}return T(i,o)}function $(e,t){let i=(0,n.yg)((0,n.M6)(e)),o=(0,a.i)(i.frame),s=Math.min(o.width,o.height),l=.004*s,d=.018*s,c=[...i.images.map(e=>_(e,t)),...i.areas.map(e=>{if(e.isLightSource)return D(e,void 0,"reference");if("soft"===i.previewMode&&"text-region"!==e.semanticType&&!e.corners)return E(e);if("soft"!==i.previewMode&&(0,n.MY)(e)&&e.displayText?.trim())return F(e);let t=(0,r.QR)(e,a.cq);if(e.corners&&"polygon"===t.type){let i=t.points.map(e=>`${B(e.x)},${B(e.y)}`).join(" "),n=(0,r.Dj)(e,a.cq).map(([e,t])=>`<line x1="${B(e.x)}" y1="${B(e.y)}" x2="${B(t.x)}" y2="${B(t.y)}" stroke="#555555" stroke-width="${B(2*l)}" stroke-linecap="round"/>`);return`<g data-region-kind="text-region"><polygon data-reference-role="text-outline" points="${i}" fill="#e3e3e3"/><g data-reference-role="typography">${n.join("")}</g></g>`}let o=z(t,`data-reference-role="influence-zone" fill="#1F292B" fill-opacity="0.12" stroke="#1F292B" stroke-width="2" vector-effect="non-scaling-stroke"${"ellipse"===t.type?` transform="rotate(${B(e.rotation??0)} ${B(t.cx)} ${B(t.cy)})"`:""}`);if("text-region"!==e.semanticType)return`<g data-region-kind="content-region">${o}</g>`;let d=(0,r.Sq)(t),c=d.maximumX-d.minimumX,u=Math.min(.08*(d.maximumY-d.minimumY),.012*s),m=1.1*u,h=(d.minimumY+d.maximumY)/2,p=[.72,.48,.62].map((e,t)=>`<rect x="${B(d.minimumX+.14*c)}" y="${B(h+(t-1)*(u+m)-u/2)}" width="${B(c*e)}" height="${B(u)}" rx="${B(u/2)}" fill="#555555" fill-opacity="0.58"/>`);return`<g data-region-kind="text-region">${o}<g data-reference-role="typography">${p.join("")}</g></g>`})];if(i.directionLine){let e=(0,r.Wu)(i.directionLine,a.cq);c.push(`<line x1="${B(e.start.x)}" y1="${B(e.start.y)}" x2="${B(e.end.x)}" y2="${B(e.end.y)}" stroke="#1f1f1f" stroke-width="${B(l)}" stroke-dasharray="${B(.018*s)} ${B(.012*s)}"/>`)}for(let e of i.focusPoints){let t=e.x*a.cq.width,i=e.y*a.cq.height;c.push(`<line x1="${B(t-1.8*d)}" y1="${B(i)}" x2="${B(t+1.8*d)}" y2="${B(i)}" stroke="#1f1f1f" stroke-width="${B(l)}"/><line x1="${B(t)}" y1="${B(i-1.8*d)}" x2="${B(t)}" y2="${B(i+1.8*d)}" stroke="#1f1f1f" stroke-width="${B(l)}"/><circle cx="${B(t)}" cy="${B(i)}" r="${B(d)}" fill="#ffffff" stroke="#1f1f1f" stroke-width="${B(l)}"/>`)}return[`<svg xmlns="http://www.w3.org/2000/svg" width="${i.frame.width}" height="${i.frame.height}" viewBox="${B(o.x)} ${B(o.y)} ${B(o.width)} ${B(o.height)}">`,`<rect x="${B(o.x)}" y="${B(o.y)}" width="${B(o.width)}" height="${B(o.height)}" fill="#ffffff"/>`,...T(i,c),"</svg>"].join("")}function T(e,t){let i=new Map([...e.images,...e.areas,...e.directionLine?[e.directionLine]:[],...e.focusPoints].map((e,i)=>[e.id,t[i]]));return(0,A.u)(e).map(e=>i.get(e))}function F(e,t=`composition-text-${e.id}`){if(!e.displayText?.trim())return"";let i=(0,r.QR)({...e,rotation:0},a.cq);if("polygon"!==i.type||void 0===i.width)return"";let{width:n,height:o,center:s}=i,l=e.displayText.replace(/\r\n?/g,"\n").split("\n"),d=q(t),c=l.map((e,t)=>e.trim()?`<text x="0" y="${1200*t+950}" textLength="1000" lengthAdjust="spacingAndGlyphs">${q(e)}</text>`:"").join(""),u=i.points.map(e=>`${B(e.x)},${B(e.y)}`).join(" "),m=`<svg x="${e.corners?0:B(s.x-n/2)}" y="${e.corners?0:B(s.y-o/2)}" width="${B(n)}" height="${B(o)}" viewBox="0 0 1000 ${1200*l.length}" preserveAspectRatio="none" overflow="hidden" fill="#1F292B" stroke="none" font-family="Arial, 'Noto Sans CJK SC', 'Microsoft YaHei', sans-serif" font-size="1000" font-weight="400" dominant-baseline="alphabetic" text-anchor="start" style="white-space:pre" xml:space="preserve">${c}</svg>`,h=m;return e.corners&&(h=`<defs><g id="${d}-content">${m}</g></defs>`+(function(e,t,i){let[n,a,r,o]=e,s=a.x-r.x,l=o.x-r.x,d=a.y-r.y,c=o.y-r.y,u=n.x-a.x+r.x-o.x,m=n.y-a.y+r.y-o.y,h=s*c-l*d,p=(u*c-l*m)/h,g=(s*m-u*d)/h,f=({x:e,y:r})=>{let s=e/t,l=r/i,d=p*s+g*l+1;return{x:((a.x-n.x+p*a.x)*s+(o.x-n.x+g*o.x)*l+n.x)/d,y:((a.y-n.y+p*a.y)*s+(o.y-n.y+g*o.y)*l+n.y)/d}},y=[{x:0,y:0},{x:t,y:0},{x:t,y:i},{x:0,y:i}];if(Math.abs(p)+Math.abs(g)<1e-10)return[{source:y,target:[...e],matrix:N(y,e)}];let x=[],b=(e,t)=>{let i=e.map(f),n=e.map((t,i)=>M(t,e[(i+1)%3]));Math.max(...n.map((e,t)=>{let n=f(e),a=M(i[t],i[(t+1)%3]);return Math.hypot(n.x-a.x,n.y-a.y)}))>.3&&t<5?(b([e[0],n[0],n[2]],t+1),b([n[0],e[1],n[1]],t+1),b([n[2],n[1],e[2]],t+1),b([n[0],n[1],n[2]],t+1)):x.push({source:e,target:i,matrix:N(e,i)})};return b([y[0],y[1],y[2]],0),b([y[0],y[2],y[3]],0),x})(i.points,n,o).map((e,t)=>{let i=e.target.map((e,t,i)=>{let n=i[(t+i.length-1)%i.length],a=i[(t+1)%i.length],r=Math.hypot(e.x-n.x,e.y-n.y),o=Math.hypot(a.x-e.x,a.y-e.y),s=(e.y-n.y)/r,l=(n.x-e.x)/r,d=(a.y-e.y)/o,c=(e.x-a.x)/o,u=.5/(1+s*d+l*c);return`${B(e.x+(s+d)*u)},${B(e.y+(l+c)*u)}`}).join(" ");return`<clipPath id="${d}-${t}"><polygon points="${i}"/></clipPath><g clip-path="url(#${d}-${t})"><use data-text-warp-patch="${t}" href="#${d}-content" transform="matrix(${e.matrix.map(e=>Number(e.toFixed(9))).join(" ")})"/></g>`}).join("")),`<g data-region-kind="text-region" data-reference-role="display-text" transform="rotate(${B(e.rotation??0)} ${B(s.x)} ${B(s.y)})"><defs><clipPath id="${d}"><polygon points="${u}"/></clipPath></defs><g clip-path="url(#${d})">${h}</g></g>`}function E(e,t=`composition-soft-${e.id}`){let i=q(t),n=(0,r.QR)({...e,rotation:0},a.cq),o=(0,r.Sq)(n),s=.09*Math.min(o.maximumX-o.minimumX,o.maximumY-o.minimumY),l=z(n,`data-reference-role="influence-zone" fill="url(#${i})" stroke="none" filter="url(#${i}-blur)"`);return`<g data-region-kind="content-region" data-preview-mode="soft" transform="rotate(${B(e.rotation??0)} ${B(e.x*a.cq.width)} ${B(e.y*a.cq.height)})"><defs><radialGradient id="${i}" r="70%"><stop offset="0" stop-color="#1F292B" stop-opacity="0.28"/><stop offset="0.55" stop-color="#1F292B" stop-opacity="0.16"/><stop offset="1" stop-color="#1F292B" stop-opacity="0.03"/></radialGradient><filter id="${i}-blur" x="-40%" y="-40%" width="180%" height="180%" color-interpolation-filters="sRGB"><feGaussianBlur stdDeviation="${B(s)}"/></filter></defs>${l}</g>`}function D(e,t=`composition-light-${e.id}`,i="editor"){let n=q(t),o=(0,r.QR)({...e,rotation:0},a.cq),s="reference"===i,l=(0,r.Sq)(o),d=l.maximumX-l.minimumX,c=l.maximumY-l.minimumY,u=s?`fill="url(#${n})" stroke="none" filter="url(#${n}-soften)"`:`fill="url(#${n})" stroke="#d6b95c" stroke-opacity="0.55" stroke-width="1.5"`,m="circle"===o.type?`<circle cx="${B(o.cx)}" cy="${B(o.cy)}" r="${B(o.radius)}" ${u}/>`:"ellipse"===o.type?`<ellipse cx="${B(o.cx)}" cy="${B(o.cy)}" rx="${B(o.radiusX)}" ry="${B(o.radiusY)}" ${u}/>`:`<polygon points="${o.points.map(e=>`${B(e.x)},${B(e.y)}`).join(" ")}" ${u}/>`,h="quadrilateral"===e.primitive?`<linearGradient id="${n}" x1="0" y1="0" x2="${d>=c?"0":"1"}" y2="${d>=c?"1":"0"}"><stop offset="0" stop-color="#ffe58a" stop-opacity="0"/><stop offset="0.3" stop-color="#ffe58a" stop-opacity="0.5"/><stop offset="0.5" stop-color="#fff8c4" stop-opacity="0.9"/><stop offset="0.7" stop-color="#ffe58a" stop-opacity="0.5"/><stop offset="1" stop-color="#ffe58a" stop-opacity="0"/></linearGradient>`:`<radialGradient id="${n}"><stop offset="0" stop-color="#fff8c4" stop-opacity="0.95"/><stop offset="0.55" stop-color="#ffe58a" stop-opacity="${s?"0.4":"0.65"}"/><stop offset="1" stop-color="#ffe58a" stop-opacity="${s?"0":"0.12"}"/></radialGradient>`,p=s?`<filter id="${n}-soften" x="-25%" y="-25%" width="150%" height="150%"><feGaussianBlur stdDeviation="${B(.06*Math.min(d,c))}"/></filter>`:"";return`<g data-region-kind="light-source" data-light-source-id="${q(e.id)}" transform="rotate(${B(e.rotation??0)} ${B(e.x*a.cq.width)} ${B(e.y*a.cq.height)})"><defs>${h}${p}</defs>${m}</g>`}function _(e,t){let i=e.width*a.cq.width,n=e.height*a.cq.height,r=e.x*a.cq.width,o=e.y*a.cq.height,s=r-i/2,l=o-n/2,d=e.assetId?t?.(e.assetId):void 0,c=e.rotation?` transform="rotate(${B(e.rotation)} ${B(r)} ${B(o)})"`:"";if(!d)return`<rect data-region-kind="image" x="${B(s)}" y="${B(l)}" width="${B(i)}" height="${B(n)}" fill="#eeeeee" stroke="#8f8f8f" stroke-width="2"${c}/>`;let u=e.crop,m=u?s-u.x/u.width*i:s,h=u?l-u.y/u.height*n:l,p=u?i/u.width:i,g=u?n/u.height:n,f=`composition-image-${e.id.replace(/[^a-zA-Z0-9_-]/g,"-")}`;return`<g data-region-kind="image"${c}><defs><clipPath id="${f}"><rect x="${B(s)}" y="${B(l)}" width="${B(i)}" height="${B(n)}"/></clipPath></defs><image href="${q(d)}" x="${B(m)}" y="${B(h)}" width="${B(p)}" height="${B(g)}" preserveAspectRatio="${u?"none":"xMidYMid slice"}" clip-path="url(#${f})"/></g>`}function z(e,t){return"circle"===e.type?`<circle cx="${B(e.cx)}" cy="${B(e.cy)}" r="${B(e.radius)}" ${t}/>`:"ellipse"===e.type?`<ellipse cx="${B(e.cx)}" cy="${B(e.cy)}" rx="${B(e.radiusX)}" ry="${B(e.radiusY)}" ${t}/>`:`<polygon points="${e.points.map(e=>`${B(e.x)},${B(e.y)}`).join(" ")}" ${t}/>`}function B(e){return String(Math.round(1e3*e)/1e3)}function q(e){return e.replaceAll("&","&").replaceAll('"',""").replaceAll("<","<").replaceAll(">",">")}var O=i(27062);let U=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://yisi.local/schemas/composition-refinement-plan.schema.json","title":"Agent-authored Composition Refinement Plan","oneOf":[{"$ref":"#/$defs/legacyPlan"},{"$ref":"#/$defs/directedPlan"}],"$defs":{"focusAnchor":{"type":"object","additionalProperties":false,"required":["method","methodVersion","targetFocusId","anchor"],"properties":{"method":{"const":"focus-anchor"},"methodVersion":{"const":1},"targetFocusId":{"type":"string","pattern":"^focus-[0-9]+$"},"anchor":{"enum":["optical-center","geometric-center","golden-right-upper","golden-left-upper","golden-right-lower","golden-left-lower","third-right-upper","third-left-upper","third-right-lower","third-left-lower"]},"strength":{"const":"subtle","description":"Legacy compatibility field; does not restrict adjustment magnitude."},"reason":{"type":"string","minLength":1,"maxLength":2000},"expectedEffect":{"type":"string","minLength":1,"maxLength":2000}}},"axisRelation":{"type":"object","additionalProperties":false,"required":["method","methodVersion","focusIds","areaIds","relation"],"properties":{"method":{"const":"axis-relation"},"methodVersion":{"const":1},"focusIds":{"type":"array","minItems":2,"maxItems":2,"uniqueItems":true,"items":{"type":"string","pattern":"^focus-[0-9]+$"}},"areaIds":{"type":"array","minItems":2,"maxItems":2,"uniqueItems":true,"items":{"type":"string","pattern":"^area-[0-9]+$"}},"relation":{"enum":["parallel","perpendicular","mirrored-cross"]},"strength":{"const":"subtle","description":"Legacy compatibility field; does not restrict adjustment magnitude."},"reason":{"type":"string","minLength":1,"maxLength":2000},"expectedEffect":{"type":"string","minLength":1,"maxLength":2000}}},"rotationAlignment":{"type":"object","additionalProperties":false,"required":["method","methodVersion","targetAreaIds","axis"],"properties":{"method":{"const":"rotation-alignment"},"methodVersion":{"const":1},"targetAreaIds":{"type":"array","minItems":1,"uniqueItems":true,"items":{"type":"string","pattern":"^area-[0-9]+$"}},"axis":{"enum":["horizontal","vertical","rising-diagonal","falling-diagonal"]},"strength":{"const":"subtle","description":"Legacy compatibility field; does not restrict adjustment magnitude."},"reason":{"type":"string","minLength":1,"maxLength":2000},"expectedEffect":{"type":"string","minLength":1,"maxLength":2000}}},"blockAlignment":{"type":"object","additionalProperties":false,"required":["method","methodVersion","targetAreaIds","anchorAreaId","alignment"],"properties":{"method":{"const":"block-alignment"},"methodVersion":{"const":1},"targetAreaIds":{"type":"array","minItems":2,"uniqueItems":true,"items":{"type":"string","pattern":"^area-[0-9]+$"}},"anchorAreaId":{"type":"string","pattern":"^area-[0-9]+$"},"alignment":{"enum":["left","horizontal-center","right","top","vertical-center","bottom"]},"strength":{"const":"subtle","description":"Legacy compatibility field; does not restrict adjustment magnitude."},"reason":{"type":"string","minLength":1,"maxLength":2000},"expectedEffect":{"type":"string","minLength":1,"maxLength":2000}}},"spacingRhythm":{"type":"object","additionalProperties":false,"required":["method","methodVersion","targetAreaIds","axis","distribution"],"properties":{"method":{"const":"spacing-rhythm"},"methodVersion":{"const":1},"targetAreaIds":{"type":"array","minItems":3,"uniqueItems":true,"items":{"type":"string","pattern":"^area-[0-9]+$"}},"axis":{"enum":["horizontal","vertical"]},"distribution":{"const":"equal"},"strength":{"const":"subtle","description":"Legacy compatibility field; does not restrict adjustment magnitude."},"reason":{"type":"string","minLength":1,"maxLength":2000},"expectedEffect":{"type":"string","minLength":1,"maxLength":2000}}},"framePlacement":{"type":"object","additionalProperties":false,"required":["method","methodVersion","targetId","axis","alignment","division"],"properties":{"method":{"const":"frame-placement"},"methodVersion":{"const":1},"targetId":{"type":"string","pattern":"^(area|focus)-[0-9]+$"},"axis":{"enum":["x","y"]},"alignment":{"enum":["start","center","end"]},"division":{"enum":["center","golden-start","golden-end","third-start","third-end"]},"reason":{"type":"string","minLength":1,"maxLength":2000},"expectedEffect":{"type":"string","minLength":1,"maxLength":2000}}},"sizeRatio":{"type":"object","additionalProperties":false,"required":["method","methodVersion","targetAreaId","dimension","referenceId","referenceDimension","ratio"],"properties":{"method":{"const":"size-ratio"},"methodVersion":{"const":1},"targetAreaId":{"type":"string","pattern":"^area-[0-9]+$"},"dimension":{"enum":["width","height","area"]},"referenceId":{"type":"string","pattern":"^(frame|area-[0-9]+)$"},"referenceDimension":{"enum":["width","height","area"]},"ratio":{"type":"number","exclusiveMinimum":0},"reason":{"type":"string","minLength":1,"maxLength":2000},"expectedEffect":{"type":"string","minLength":1,"maxLength":2000}}},"mirrorSymmetry":{"type":"object","additionalProperties":false,"required":["method","methodVersion","anchorAreaId","targetAreaId","axis","division","match"],"properties":{"method":{"const":"mirror-symmetry"},"methodVersion":{"const":1},"anchorAreaId":{"type":"string","pattern":"^area-[0-9]+$"},"targetAreaId":{"type":"string","pattern":"^area-[0-9]+$"},"axis":{"enum":["vertical","horizontal"]},"division":{"enum":["center","golden-start","golden-end","third-start","third-end"]},"match":{"enum":["position","geometry"]},"reason":{"type":"string","minLength":1,"maxLength":2000},"expectedEffect":{"type":"string","minLength":1,"maxLength":2000}}},"focusFlow":{"type":"object","additionalProperties":false,"required":["method","methodVersion","sourceId","targetFocusId","localAxis"],"properties":{"method":{"const":"focus-flow"},"methodVersion":{"const":1},"sourceId":{"type":"string","pattern":"^(direction-1|area-[0-9]+)$"},"targetFocusId":{"type":"string","pattern":"^focus-[0-9]+$"},"localAxis":{"enum":["x","y"]},"reason":{"type":"string","minLength":1,"maxLength":2000},"expectedEffect":{"type":"string","minLength":1,"maxLength":2000}}},"legacyPlan":{"type":"object","additionalProperties":false,"required":["version","kind","sourceFingerprint","rationale","operations"],"properties":{"version":{"const":1},"kind":{"const":"composition-refinement-plan"},"sourceFingerprint":{"type":"string","pattern":"^draft-[0-9a-f]{8}$"},"rationale":{"type":"string","minLength":1,"maxLength":2000},"operations":{"type":"array","minItems":1,"maxItems":16,"items":{"oneOf":[{"$ref":"#/$defs/focusAnchor"},{"$ref":"#/$defs/axisRelation"},{"$ref":"#/$defs/rotationAlignment"},{"$ref":"#/$defs/blockAlignment"},{"$ref":"#/$defs/spacingRhythm"}]}}}},"directedPlan":{"type":"object","additionalProperties":false,"required":["version","kind","sourceFingerprint","rationale","operations","decision","objective","assessment","preserve","tradeoffs","fixedIds","focusLinks"],"properties":{"version":{"const":2},"kind":{"const":"composition-refinement-plan"},"sourceFingerprint":{"type":"string","pattern":"^draft-[0-9a-f]{8}$"},"rationale":{"type":"string","minLength":1,"maxLength":2000},"operations":{"type":"array","minItems":0,"maxItems":16,"items":{"allOf":[{"oneOf":[{"$ref":"#/$defs/focusAnchor"},{"$ref":"#/$defs/axisRelation"},{"$ref":"#/$defs/rotationAlignment"},{"$ref":"#/$defs/blockAlignment"},{"$ref":"#/$defs/spacingRhythm"},{"$ref":"#/$defs/framePlacement"},{"$ref":"#/$defs/sizeRatio"},{"$ref":"#/$defs/mirrorSymmetry"},{"$ref":"#/$defs/focusFlow"}]},{"type":"object","required":["reason","expectedEffect"]}]}},"decision":{"enum":["refine","retain"]},"objective":{"type":"string","minLength":1,"maxLength":2000},"assessment":{"type":"object","additionalProperties":false,"required":["intent","observations","uncertainties"],"properties":{"intent":{"type":"string","minLength":1,"maxLength":2000},"observations":{"type":"array","minItems":0,"maxItems":32,"items":{"type":"string","minLength":1,"maxLength":2000}},"uncertainties":{"type":"array","minItems":0,"maxItems":32,"items":{"type":"string","minLength":1,"maxLength":2000}}}},"preserve":{"type":"array","minItems":0,"maxItems":32,"items":{"type":"string","minLength":1,"maxLength":2000}},"tradeoffs":{"type":"array","minItems":0,"maxItems":32,"items":{"type":"string","minLength":1,"maxLength":2000}},"fixedIds":{"type":"array","minItems":0,"maxItems":32,"items":{"type":"string","pattern":"^(direction-1|(area|focus)-[0-9]+)$"},"uniqueItems":true},"focusLinks":{"type":"array","minItems":0,"maxItems":32,"items":{"type":"object","additionalProperties":false,"required":["focusId","areaId"],"properties":{"focusId":{"type":"string","pattern":"^focus-[0-9]+$"},"areaId":{"type":"string","pattern":"^area-[0-9]+$"}}}}},"allOf":[{"if":{"properties":{"decision":{"const":"retain"}}},"then":{"properties":{"operations":{"maxItems":0,"type":"array"}}},"else":{"properties":{"operations":{"minItems":1,"type":"array"}}}}]}}}');Object.freeze({"optical-center":{x:.5,y:.55},"geometric-center":{x:.5,y:.5},"golden-right-upper":{x:.61803398875,y:.38196601125},"golden-left-upper":{x:.38196601125,y:.38196601125},"golden-right-lower":{x:.61803398875,y:.61803398875},"golden-left-lower":{x:.38196601125,y:.61803398875},"third-right-upper":{x:2/3,y:1/3},"third-left-upper":{x:1/3,y:1/3},"third-right-lower":{x:2/3,y:2/3},"third-left-lower":{x:1/3,y:2/3}}),[...[{id:"frame-placement",description:"Place a subject center, edge, or focus on an Agent-selected frame division."},{id:"size-ratio",description:"Set an explicit physical length or area ratio between selected measurements."},{id:"mirror-symmetry",description:"Mirror a target area across a named frame axis, matching position or geometry."},{id:"focus-flow",description:"Aim an existing direction line or a subject's local axis at a selected focus."}].map(e=>({...e,id:e.id,version:1,decisionOwner:"agent",processingSemantics:["scene-composition","editorial-layout"]}))],new O.Ajv2020({allErrors:!0}).compile(U);var H=i(59793);function G(e){if(!Array.isArray(e)||0===e.length)return null;try{let t=(0,n.mq)(),i=[];for(let n of e){if(!n?.item||"string"!=typeof n.item.id)return null;if("focus"===n.kind)t.focusPoints.push(n.item);else if("area"===n.kind)t.areas.push(n.item);else if("image"===n.kind)t.images.push(n.item);else{if("direction"!==n.kind||t.directionLine)return null;t.directionLine=n.item}i.push(n.item.id)}return(0,n.s6)((0,n.M6)(t),i)}catch{return null}}},80118:()=>{},88307:()=>{},88912:(e,t,i)=>{"use strict";i.d(t,{Ge:()=>s,Qq:()=>n,mv:()=>o,rr:()=>a,w4:()=>r});let n=10,a=Object.freeze({x:0,y:0,width:960,height:560});function r(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.max(n,Math.round(e.width)),height:Math.max(n,Math.round(e.height))}}function o(e,t){let i=Math.round(t.width),a=Math.round(t.height);return!Number.isFinite(i)||!Number.isFinite(a)||i<n||a<n||i===e.width&&a===e.height?e:{x:e.x+(e.width-i)/2,y:e.y+(e.height-a)/2,width:i,height:a}}function s(e,t){return o(e,{width:e.width,height:e.width*t.height/t.width})}},89448:()=>{},91093:(e,t,i)=>{"use strict";i.d(t,{Gi:()=>d,EM:()=>c,wl:()=>u,Ao:()=>m});var n=i(80119);let a=JSON.parse('{"canvasLayers":{"bringToFront":"Bring to front","bringForward":"Bring forward","sendBackward":"Send backward","sendToBack":"Send to back"},"app":{"title":"human2ai","repositoryLink":"{{productName}}\'s GitHub URL"},"integrations":{"workbuddy":{"name":"human2ai","description":"An agent-operated tool for drawing and UI design. Let your agent create and edit compositions, interfaces and 3D spaces, export previews, and collaborate with you on one canvas.","examples":{"composition":"Recreate this reference image\'s composition on a canvas I can keep editing.","uiSketch":"Read this UI sketch, adjust the layout using my notes, and export a preview.","spatial":"Create a 3D space, pose a character, and export the camera view."}}},"home":{"description":"Explore ideas through compositions, UI sketches and 3D spaces, and refine your designs with AI.","createComposition":"Create composition","createUiSketch":"Create interface","createSpatial":"Create 3D space","skillInstallation":{"title":"Install skill","agentTab":"Agent","cliTab":"CLI","agentPrompt":"Install the Human2AI skill in this project: run npx skills add yisi-ai/human2ai --skill human2ai, select project scope and your agent type, then confirm the skill is discoverable and report its installation path.","copy":"Copy content","copying":"Copying content","copyFailed":"Copy failed. Select and copy the text manually."}},"navigation":{"composition":"Composition"},"shell":{"sidebar":"Human2AI application sidebar","navigation":"Human2AI application navigation","collapseSidebar":"Collapse application sidebar","expandSidebar":"Expand application sidebar","resizeSidebar":"Resize application sidebar","rightPanel":"Action panel","collapseRightPanel":"Collapse action panel","expandRightPanel":"Expand action panel","resizeRightPanel":"Resize action panel"},"language":{"selectorLabel":"Interface language"},"styleLibrary":{"title":"Style library","newStyle":"New style","editStyle":"Edit style","name":"Name","namePlaceholder":"Enter a style name","category":{"label":"Category","all":"All types","visual":"Visual","ui":"UI","spatial":"3D"},"creator":{"label":"Creator","all":"All creators","user":"User","agent":"Agent"},"references":{"heading":"Reference","empty":"No reference images","add":"Add references","remove":"Remove reference image","pasteHint":"Paste images here or choose local files.","fileTypes":"Reference images can be PNG, JPEG, or WebP up to 10 MB."},"description":{"heading":"Design specification","placeholder":"Describe the layout, proportions, visual hierarchy, and decorative treatment.","spatialPlaceholder":"Describe forms, proportions, materials, palette, lighting, and camera treatment."},"searchPlaceholder":"Search styles","deleteTitle":"Delete this style?","deleteDescription":"The style and all of its reference images and models will be permanently deleted.","empty":"No styles yet","noMatches":"No matching styles","loading":"Loading styles","loadFailed":"Could not load styles","save":"Save","imageInvalid":"Choose valid PNG, JPEG, or WebP images up to 10 MB.","openStyle":"Open {{name}}","closePreview":"Close style preview","promptSummary":{"label":"Style summary","placeholder":"Summarize the defining visual traits in one sentence."},"model":{"label":"Model example","loading":"Loading model","failed":"Could not preview the model","reset":"Reset model view","controls":"Drag to rotate, scroll to zoom. When focused, use arrow keys to rotate, + / − to zoom, and Home to reset."}},"notes":{"global":{"label":"Global note","promptHeading":"Overall direction:"},"element":{"label":"Note","prompt":"- Note: {{note}}","nodePlaceholder":"Describe what this node represents","nodeHelp":"Add requirements for this node to include in the prompt.","regionPlaceholder":"Describe the layout content represented by this region","textPlaceholder":"Describe what this text communicates"}},"sessionDetails":{"title":"Session details","created":"Created","updated":"Last updated","nodes":"Nodes","agent":"Agent","copyId":"Copy ID","copyCommand":"Copy command","copying":"Copying","copyFailed":"Copy failed","emptyValue":"—","agentCommand":"Use the following CLI command to connect to the current session:\\n\\n{{command}}\\n\\nOnce connected, stop and wait for the next instruction."},"workspaceSidebar":{"containsCurrentSession":"Contains current session","functionArea":"Actions","projectArea":"Projects","newComposition":"New composition","newCompositionInProject":"New composition in “{{project}}”","newUiSketch":"New interface","newUiSketchInProject":"New interface in “{{project}}”","newProject":"New project","projectNamePlaceholder":"Enter project name","unassigned":"No project","imageCompositionSession":"Composition session","uiLayoutSession":"Interface session","sessionActions":"Session actions","projectActions":"Project actions","confirmRename":"Confirm","moveSessionTitle":"Move session","selectProject":"Select project","moveUnavailable":"No other project available","projectNameConflict":"Project names must be unique","renameProjectTitle":"Rename project","deleteProjectTitle":"Delete project","deleteProjectDescription":"This action cannot be undone.","deleteProjectDisabled":"Projects with child items cannot be deleted","renameSessionTitle":"Rename session","renameSessionPlaceholder":"Enter session name","deleteSessionTitle":"Delete session","deleteSessionDescription":"This session will move to Trash and can be restored before its retention period ends.","loading":"Loading projects","loadFailed":"Could not load projects","newSessionGroup":"New group","sessionGroupName":"Group name","sessionGroupActions":"Group actions","renameSessionGroup":"Rename group","deleteSessionGroup":"Delete group","deleteSessionGroupDescription":"Sessions in this group will appear directly under the project. They will not be deleted.","sessionGroupNameConflict":"A group with this name already exists in this project.","groupSession":"Move to group","ungroupedSessions":"Ungrouped","newCompositionInGroup":"New composition in group “{{group}}”","newUiSketchInGroup":"New interface in group “{{group}}”"},"actions":{"start":"Start","delete":"Delete","cancel":"Cancel","keep":"Keep","deleteNode":"Delete node","deleteRegion":"Delete region","deleteText":"Delete text","create":"Create","rename":"Rename","move":"Move","retry":"Retry"},"canvas":{"imageNode":{"label":"Image","add":"Add image","promptHeading":"Image nodes:"},"imageEditor":{"content":"Image content","sourceDimensions":"{{width}} \xd7 {{height}} px","sourceFileSize":"{{size}} {{unit}}","upload":"Upload image","replace":"Replace image","uploading":"Uploading","uploadFailed":"Could not upload the image. Try again.","fileTypes":"PNG, JPEG, WebP, or SVG, up to 10 MB.","svgSource":"SVG source","svgPaste":"Paste SVG","svgApply":"Use SVG","svgSaveFailed":"Could not save SVG. Check the code and try again.","svgCopy":"Copy source","svgCopying":"Copying source","svgCopyFailed":"Could not copy source","sourceLoading":"Loading image content","sourceLoadFailed":"Could not load image content. Try again.","download":"Download image","downloading":"Downloading","downloadFailed":"Could not download the image. Try again."},"imageCrop":{"title":"Crop image","loadFailed":"Could not load the image. Upload it again."},"tools":{"label":"Tools"},"viewport":{"help":"Canvas controls","instructions":"Select a node tool, then click to place. Drag to size shapes and images or set a flow direction; Esc cancels. Use the wheel to zoom; drag with the secondary button, or hold Space and drag with the primary button."},"node":{"nodeDescription":"Node description","nodeDescriptionHelp":"Explains this node\'s role; agents can read and edit it.","originUser":"user","originAgent":"agent","originImport":"import"},"display":{"showHiddenNodes":"Show hidden","onionSkin":"Onion skin"},"nodeVisibility":{"visibility":"Visibility","visible":"Visible","hidden":"Hidden"}},"canvasNodeEditor":{"title":"Edit node details","shapeKind":"Shape","pointKind":"Point"},"composition":{"session":{"new":"New composition session","untitled":"Untitled composition","loading":"Loading composition","revisionConflict":"Another operation updated this draft to revision {{revision}}. Reopen the session before editing it again.","typeMismatch":"This is not a composition session and cannot be opened in the composition editor."},"views":{"draft":"Composition","refined":"Refined","reference":"Preview","switch":"Composition view","draftCanvas":"User composition draft","refinedCanvas":"Agent-refined composition","referenceCanvas":"Composition structure for image generation"},"workflow":{"agentDecision":"Agent decision","appliedMethods":"Applied methods","protectionAudit":"Changes","maximumFocusShift":"Maximum focus shift","maximumAreaShift":"Maximum region shift","maximumRotationShift":"Maximum rotation change"},"workspace":"Canvas workspace","clearCanvas":"Clear canvas","clearCanvasConfirmTitle":"Clear the canvas?","clearCanvasConfirmDescription":"All composition content and settings will return to their defaults.","collapseTools":"Collapse tools","expandTools":"Expand tools","globalNote":{"title":"Direction for the entire image","placeholder":"For example: emphasize the subject on the left and keep breathing room on the right","ariaLabel":"Global note for the composition draft"},"flow":{"label":"Flow","controlPoint":"Flow control point {{number}}","promptHeading":"Flow:","promptReference":"- The flow passes through a position {{x}}% from the left and {{y}}% from the top of the overall image, at an angle of approximately {{rotation}}\xb0"},"elementCapacity":{"compact":"{{current}}/{{limit}}","ariaLabel":"{{label}}, {{current}} of {{limit}} placed"},"toolNames":{"focus":"Focus","circle":"Circle","triangle":"Triangle","quadrilateral":"Rectangle","textRegion":"Text region"},"canvasZoom":"Current zoom","zoomOut":"Zoom out","zoomIn":"Zoom in","fitAll":"Fit all","frameRatio":"Frame ratio","frameLabel":"Frame","frameReset":"Reset frame","frameAction":"Move or resize frame","aspectRatioTitle":"Ratio","lockFrame":"Lock frame","unlockFrame":"Unlock frame","areaOverview":"Area overview","occupied":"Occupied","negativeSpace":"Negative space","currentSelection":"Current selection","none":"None","prompt":{"title":"Design an image from the following information. If a reference image is attached, use it as an overall layout reference.","outputRatio":"Output ratio: {{ratio}}","regionSemanticsGuidance":"- Every region is a zone of visual influence, not a fixed final silhouette. Unless a note explicitly requires it, do not reproduce complete boundaries, outlines, or closed panels.","displayTextGuidance":"- Every text region must contain visible typography. Provided display text must appear exactly; a blank field means the model creates the copy, not that typography may be omitted. Text may be distorted or partially occluded according to its depth and image relationships.","layoutHeading":"Overall layout requirements:","coordinateOrigin":"- Positions are percentages relative to the overall image, with 0%, 0% at the top left.","referenceValues":"- Positions, proportions, and angles describe the visual relationships among the main content.","flexibleImplementation":"- Preserve relative placement, scale hierarchy, visual weight, depth, and visual flow. Reconstruct, split, merge, overlap, or bleed regions as the real content requires.","referenceImageGuidance":"- The uploaded reference image expresses only approximate placement, visual weight, and distribution. It is a spatial cue, not line art; do not reproduce complete boundaries, markers, or lines in the final image.","metricsHeading":"Overall image relationships:","occupied":"- Main content occupies about {{value}}% of the overall image","negativeSpace":"- Negative space is about {{value}}%","focusHeading":"Visual focal points:","focusNumber":"Focus #{{index}}","areaHeading":"Main content distribution:","areaNumber":"Content region #{{index}}","imageNumber":"Image #{{index}}","textRegionNumber":"Text region #{{index}}","generatedDisplayText":"- Copy: Create suitable text, but do not leave this region blank or replace it with ordinary image content","referencePosition":"- Reference position: {{x}}% from the left, {{y}}% from the top","referenceArea":"- Visible content occupies about {{area}}% of the overall image","referenceRotation":"- Visual distribution trends at approximately {{rotation}}\xb0","referenceClipping":"- Content extends beyond the image on the {{sides}}","sideSeparator":", ","top":"top","right":"right","bottom":"bottom","left":"left","lightSourceNumber":"Light source {{index}}","lightSourceGuidance":"- Like ordinary shape regions, light markers describe approximate visual intent and spatial relationships. Pale yellow identifies lighting, not color temperature. A source is distinct from the area it illuminates: interpret its origin and contribution in the scene. Rectangles suggest band-shaped or extended illumination; circles suggest localized illumination. Retain the broad lighting placement, extension trend and contribution to subject and space, while freely adapting width, length, curvature, continuity, edges and strength to the scene. User instructions and node notes take precedence; otherwise the Agent chooses. Do not infer fixed width, straight constant-width strips, full-frame coverage, medium-strong contrast or thumbnail prominence from the reference. Consider sources individually while allowing their visible effects to split, overlap or blend. Review whether the overall lighting broadly echoes the composition rather than comparing edges, segments or widths; tighten a constraint only when the user explicitly requests it, and do not ignore the authored lighting intent entirely.","lightBandGuidance":"Light-band intent: broadly retain the extended or band-like illumination and its spatial role here. Its realization may narrow, widen, curve, break up or blend with the scene; a complete, straight, constant-width or conspicuous stripe is not required. User instructions and this node’s notes take precedence for width, length, edges and strength; otherwise the Agent interprets them freely. An approximate overall correspondence is sufficient.","planningGuidance":"Use the following plans as composition intent alongside the overall requirements and notes. Do not draw the guide lines, axes, spiral or triangle outline in the artwork. Positions are relative to the top-left of the image; angles run clockwise from the rightward horizontal.","planningGrid":"- {{type}}: {{axes}} divisions.","planningSymmetry":"- Symmetrical composition: axis through the image center ({{x}}%, {{y}}%), direction {{rotation}}\xb0.","planningSpiral":"- Golden spiral: pole at ({{x}}%, {{y}}%), outer radius directed at {{rotation}}\xb0, radius {{scale}}% of the shorter image side, {{winding}}.","planningClockwise":"expanding clockwise","planningCounterclockwise":"expanding counterclockwise","planningTriangle":"- Triangular composition: isosceles triangle with vertices at {{points}}.","planningRadial":"- Radial composition: convergence point ({{x}}%, {{y}}%), {{rayCount}} evenly spaced rays starting at {{rotation}}\xb0 and spanning {{spread}}\xb0 clockwise.","planningRadialFree":"- Free radial composition: convergence point ({{x}}%, {{y}}%), {{rayCount}} rays with independent directions: {{angles}} (clockwise from the rightward horizontal)."},"depth":{"label":"Depth","auto":"Auto","foreground":"Foreground","midground":"Midground","background":"Background","prompt":"- Depth: {{shotScale}}"},"mode":{"label":"Mode","placeholder":"Select","scene":"Scene","editorial":"Editorial","prompt":"Mode: {{semantic}}","unselected":"Not selected","unselectedGuidance":"- Choose Scene or Editorial before continuing.","sceneGuidance":"- Compose every region as part of one scene. Text may follow perspective, distortion, layering, and partial occlusion.","editorialGuidance":"- Arrange every region as an editorial layout, balancing hierarchy, alignment, spacing, negative space, reading flow, and focal relationships. Regions are not UI components or fixed panels."},"refinement":{"objective":"Refinement objective","observations":"Observations","uncertainties":"Uncertainties","preserve":"Preserved intent","tradeoffs":"Tradeoffs","relations":"Relation checks","retained":"Composition retained","target":"Target","before":"Before","after":"After","error":"Deviation","unmeasurable":"Not applicable","framePlacement":"Frame division","sizeRatio":"Size ratio","mirrorSymmetry":"Mirror symmetry","focusFlow":"Focal guidance","focusAnchor":"Focus placement","axisRelation":"Axis relationship","rotationAlignment":"Orientation alignment","blockAlignment":"Area alignment","spacingRhythm":"Equal spacing"},"lightSource":{"toggle":"Use as light source"},"textRegion":{"cornerLabel":"Text outline corner {{index}}","cornerHelp":"Select a text region and hold Ctrl to drag its corners. Focus a corner and use the arrow keys for fine adjustments."},"planning":{"title":"Composition planning","add":"Add plan","empty":"No composition plans","types":{"thirds":"Rule of thirds","golden-section":"Golden section","symmetry":"Symmetrical composition","golden-spiral":"Golden spiral","triangle":"Triangular composition","radial":"Radial composition"},"visible":"Show plan","axes":"Grid directions","both":"Horizontal and vertical","horizontal":"Horizontal","vertical":"Vertical","x":"Horizontal (%)","y":"Vertical (%)","rotation":"Rotation (\xb0)","scale":"Spiral size (%)","mirrored":"Mirror spiral","handle":"Plan control {{index}}","help":"Shift-click to select multiple plans and drag a selected guide to move them together. Thirds, golden-section and symmetry guides stay fixed. Select thirds and golden-section plans in the sidebar. Arrow keys nudge; Delete removes a plan.","width":"Base width (%)","height":"Triangle height (%)","triangleHelp":"Drag the apex to rotate and adjust height. Drag a base corner to resize; both sides stay symmetric.","symmetryHelp":"The center stays fixed. Drag the other dot to one of eight regular directions or four frame-corner directions. Corner directions follow the frame ratio; duplicate positions merge for a square. Arrow keys step between positions.","spiralHelp":"Click the center dot to switch clockwise/counterclockwise. Drag it to move the spiral; drag the outer dot to rotate and resize.","spiralDirection":"Switch spiral direction (clockwise/counterclockwise)","rayCount":"Ray count","spread":"Spread (\xb0)","radialHelp":"Uniform mode uses a starting direction and spread. In Free mode, drag each ray’s dot to adjust its direction; drag the center to move the convergence point. Switching to Free preserves directions; switching back to Uniform redistributes the current rays around a full circle.","lock":"Lock composition planning","unlock":"Unlock composition planning","showAll":"Show composition guides","hideAll":"Hide composition guides","radialMode":"Radial mode","radialUniform":"Uniform","radialFree":"Free","rayHandle":"Ray {{index}} direction"},"previewMode":{"label":"Preview mode","precise":"Precise","soft":"Soft","prompt":"Preview mode: {{mode}}","preciseGuidance":"- Precise reference: make the generated image closely follow the canvas intent. Preserve basic shapes, placement, proportions, rotation, layering, spacing, negative space and cropping. Interpret shapes as concrete content using the notes without freely restructuring, splitting or merging their arrangement. Compare these relationships with the reference; focal and flow markers are guides, not final artwork. User instructions and node notes take precedence.","preciseLightGuidance":"- Precise lighting: closely preserve the authored light placement, shape, extent and relative proportions when lighting the subject and space. Pale yellow identifies light sources without specifying color temperature; do not reproduce diagnostic outlines in the final image. User instructions and node notes take precedence."}},"uiSketch":{"title":"Interface","canvas":"Interface canvas","globalNote":{"title":"Direction for the entire interface","placeholder":"For example: keep it quiet and emphasize the current task and primary action","ariaLabel":"Global note for the interface"},"canvasLabels":{"canvasViewport":"Interface infinite canvas","scene":"Interface scene","region":"Region","addRegion":"Add region","text":"Text","addText":"Add text","newText":"Text","resetFrame":"Reset frame","rangeTitle":"Size","lockFrame":"Lock frame","unlockFrame":"Unlock frame","clearCanvas":"Clear canvas","clearCanvasConfirmTitle":"Clear the canvas?","clearCanvasConfirmDescription":"All regions, text, and images will be removed.","fitFrame":"Fit interface frame","sideActions":"Interface actions","collapseSideActions":"Collapse interface actions","expandSideActions":"Expand interface actions","frameAction":"Move or resize interface frame","frameRange":"Interface frame","missingRegionNote":"No note","editRegionNote":"Edit region details","editText":"Edit text","emptyText":"---No text entered---","fontSize":"Font size","decreaseFontSize":"Decrease font size","increaseFontSize":"Increase font size","selectedItemsPrefix":"Selected ","selectedItemsSuffix":" items","noSelection":"No items selected","groupItems":"Group","ungroupItems":"Ungroup"},"prompt":{"staticTitle":"Design and implement an interface using the following information.","motionTitle":"Design and implement the interface and its state transitions using the following information.","canvasSize":"Suggested canvas size: {{width}} \xd7 {{height}}px","layoutHeading":"Layout guidance:","canvasOrigin":"- Use the top-left corner of the canvas as the coordinate origin.","referenceValues":"- The coordinates, dimensions, and font sizes below are reference values that communicate approximate placement, hierarchy, and transition direction.","perceptibleElementGuidance":"- The sketch contains only key elements that users can see, read, recognize, or interact with and their spatial relationships. A rectangle represents a perceptible content footprint or visual surface, not a component-tree node; do not implement layout-only wrappers, stacks, grids, or parent rectangles with no independent visual meaning as containers.","flexibleImplementation":"- Do not reproduce them with rigid fixed positioning or pixel-perfect placement. Adjust them to suit the actual content, component constraints, responsive layout, and visual quality.","motionStateGuidance":"- States transition in tab order. In each transition, the first state describes the baseline appearance; the next state lists only changed properties. Properties not listed remain unchanged.","elementsHeading":"Interface elements:","imageNumber":"Image #{{index}}","regionNumber":"Region #{{index}}","textNumber":"Text #{{index}}","referencePosition":"Reference position: x={{x}}px, y={{y}}px","referenceSize":"Reference size: width={{width}}px, height={{height}}px","referenceFontSize":"Reference font size: {{fontSize}}px","startState":"- State 1:","endState":"- State 2:","changeVisible":"Change to visible","changeHidden":"Change to hidden","motionClosing":"Design a natural layout transition from each element\'s state changes. Treat the reference coordinates as guidance for relative placement and movement, not as rigid fixed positions.","stateHeading":"- {{name}}:"},"views":{"start":"State 1","end":"State 2","switch":"Interface states","enableMotion":"Add state"},"session":{"new":"New interface session","untitled":"Untitled interface","loading":"Loading interface","revisionConflict":"Another operation updated this interface to revision {{revision}}. Reopen the session before editing it again.","typeMismatch":"This is not an interface session and cannot be opened in the interface editor.","serviceOutdated":"The current Human2AI service does not support interfaces. Restart the development service, then try again."},"motion":{"copyPrompt":"Motion"},"states":{"defaultName":"State {{number}}","name":"State name","actions":"Actions for {{name}}","new":"New state","delete":"Delete state","deleteTitle":"Delete state “{{name}}”?","notFound":"Unknown UI state: {{state}}."},"preview":{"outputFormatError":"UI preview output must use a .png or .svg filename."},"pngSplit":{"action":"Split PNG","alphaThreshold":"Alpha threshold","minSize":"Minimum size","gap":"Gap","failed":"Splitting failed. Please retry.","invalid":"Select nonempty static PNG images with transparent areas.","complete":"Created {{count}} images; filtered {{discarded}} fragments.","alreadySplit":"Selected images have already been split.","retrySave":"Retry save","settings":"PNG split settings","applySettings":"Split","running":"Splitting PNG…","preview":"Split bounds preview","previewing":"Calculating split bounds…","previewFailed":"Could not preview split bounds. Please retry.","previewSummary":"Will create {{count}} images and filter {{discarded}} fragments.","zoomIn":"Zoom in","zoomOut":"Zoom out","help":"Preview controls","interactionHelp":"Scroll to zoom. Right-drag or Space-drag to pan. Choose Free anchors and click to add points. With at least three non-collinear points, click the first point or press Enter to close; Esc cancels drawing. Closed regions can be selected and deleted, but not reshaped. Each region becomes one image; earlier regions own overlapping pixels.","freeAnchors":"Free anchors","manualRegion":"Manual region {{index}}","closeRegion":"Close region"}},"clipboard":{"group":"Copy","copyPrompt":"Copy prompt","copied":"Copied","promptFailed":"Could not copy the prompt.","promptUnsupported":"This browser cannot copy the prompt.","copyPreview":"Copy preview","previewImage":"Preview image","previewFailed":"Could not copy the preview.","previewDownloaded":"This browser cannot copy images, so the preview was downloaded","promptPreview":"Prompt preview","promptPreviewLoading":"Loading prompt","promptPreviewFailed":"Could not preview prompt"},"visualWeight":{"auto":"Auto","high":"High","medium":"Medium","low":"Low","decorative":"Decorative","label":"Visual weight","prompt":"- Visual weight: {{weight}}"},"dimensions":{"frameSize":"Size","width":"Width","height":"Height"},"textContent":{"label":"Display text","prompt":"- Display text: {{text}}","compositionPlaceholder":"Enter exact text, or leave blank for generated copy","uiSketchPlaceholder":"Enter text"},"errors":{"historyExpired":"This history has expired. Reload the current canvas.","serviceSync":"Could not synchronize with Human2AI: {{message}}","operationFailed":"The action failed. Try again."},"confirmations":{"deleteNode":"Delete this node?","deleteRegion":"Delete this region?","deleteText":"Delete this text?"},"sessionStyle":{"label":"Session style","choose":"Choose style","dialogTitle":"Choose a style for this session","unbind":"Remove style","select":"Use this style","pending":"Not yet processed with this style","conflict":"The session or style has changed. Reload before trying again.","prompt":"Style: {{summary}}"},"spatial":{"title":"3D space","spaceTab":"Space","workspaceViews":"3D workspace view","cameraPreviewPending":"Preview available after saving","newSpace":"New 3D space","newInProject":"New 3D space in {{project}}","untitled":"Untitled 3D space","objects":"Scene objects","cameras":"Cameras","addCharacter":"Character","character":"Character","addCamera":"Camera","camera":"Camera {{number}}","box":"Box","sphere":"Sphere","plane":"Plane","position":"World position","rotation":"World rotation","lockPosition":"Lock position","lockRotation":"Lock rotation","proportions":"Head-to-body ratio","height":"Character height","name":"Object name","size":"Object size","color":"Display color","joints":"Joints","editView":"Editing view","cameraView":"Camera preview","useView":"Use current view","projection":"Projection","perspective":"Perspective","orthographic":"Orthographic","fov":"Field of view","span":"View height","target":"Look-at target","outputWidth":"Output width","outputHeight":"Output height","transparent":"Transparent background","reference":"3D camera view","addReference":"Add 3D camera view","selectSpace":"Select 3D space","selectCamera":"Select camera","openSource":"Edit source space","snapshot":"Save as image node","sourceMissing":"Source space or camera is unavailable","constrained":"Constraint reached","invalid":"Invalid scene or joint constraints","loadFailed":"Could not load the 3D space","saveFailed":"Could not save. Try again.","conflict":"The space has changed. Reload to continue.","duplicate":"Duplicate scene object","deleteConfirm":"Delete this scene object?","empty":"No objects in this space","noSpaces":"No 3D spaces available","viewport":"3D editing viewport","webglFailed":"Could not start the 3D view","translate":"Move joint or object","rotate":"Rotate bone or object","jointName":"Joint {{name}}","x":"X axis","y":"Y axis","z":"Z axis","jointPelvis":"Pelvis","jointSpine":"Waist joint","jointChest":"Chest","jointNeck":"Neck","jointHead":"Head","jointLeftShoulder":"Left shoulder","jointLeftElbow":"Left elbow","jointLeftHand":"Left palm center","jointLeftHip":"Left hip","jointLeftKnee":"Left knee","jointLeftFoot":"Left foot","jointRightShoulder":"Right shoulder","jointRightElbow":"Right elbow","jointRightHand":"Right palm center","jointRightHip":"Right hip","jointRightKnee":"Right knee","jointRightFoot":"Right foot","infoToolsTab":"Info & tools","panelViews":"3D panel view","parameters":"Properties","translateMode":"Move","rotateMode":"Rotate","bones":"Bone segment","localRotation":"Local rotation","angleMinimum":"Minimum angles","angleMaximum":"Maximum angles","resetPose":"Reset pose","resetPoseHint":"Restore the default pose and clear this character’s locks. Can be undone.","showRig":"Show joints and bones","showCameras":"Show cameras","lightingEffects":"Lighting effects","jointLeftWrist":"Left wrist","jointLeftAnkle":"Left ankle","boneLeftShoulder":"Left clavicle","boneLeftElbow":"Left upper arm","boneLeftWrist":"Left forearm","boneLeftHand":"Left palm","boneLeftHip":"Left hip connector","boneLeftKnee":"Left thigh","boneLeftAnkle":"Left lower leg","boneLeftFoot":"Left foot","jointRightWrist":"Right wrist","jointRightAnkle":"Right ankle","boneRightShoulder":"Right clavicle","boneRightElbow":"Right upper arm","boneRightWrist":"Right forearm","boneRightHand":"Right palm","boneRightHip":"Right hip connector","boneRightKnee":"Right thigh","boneRightAnkle":"Right lower leg","boneRightFoot":"Right foot","boneSpine":"Waist","boneChest":"Chest segment","boneNeck":"Neck segment","boneHead":"Head","selectObjectForParameters":"Select an object to view its properties","bodyLegRatio":"Torso / legs","torso":"Torso","legs":"Legs","bodyLegRatioHint":"Shares use rest height without the head. Move right for shorter legs. Each portion stays between 30% and 70%.","resetBodyLegRatio":"Reset proportions","proportionsLocked":"A fixed joint prevents this change. Unlock its position first.","bodyType":"Body model","bodyMale":"Male","bodyFemale":"Female","handLeft":"Left hand","handRight":"Right hand","fingerThumb":"Thumb","fingerIndex":"Index finger","fingerMiddle":"Middle finger","fingerRing":"Ring finger","fingerLittle":"Little finger","fingerRoot":"{{finger}} base joint","fingerMiddleJoint":"{{finger}} middle joint","fingerDistalJoint":"{{finger}} distal joint","fingerTip":"{{finger}} tip","fingerProximalBone":"{{finger}} proximal bone","fingerMiddleBone":"{{finger}} middle bone","fingerDistalBone":"{{finger}} distal bone","thumbMetacarpal":"Thumb metacarpal","thumbProximal":"Thumb proximal bone","fingerCurl":"{{finger}} curl","fingerSpread":"Finger spread","thumbOpposition":"Thumb opposition","resetHand":"Reset hand","resetHandHint":"Restore the palm and fingers and clear their locks, preserving the wrist and arm pose. Can be undone.","neckLength":"Neck length","palmSize":"Palm size","fingerLength":"Finger length","footSize":"Foot size","bodyShapeHint":"100% is the default for the current head proportions. Hands and feet stay symmetric. Palm size also changes finger thickness; finger length is separate.","referencePass":"Reference type","referenceColor":"Color","referenceStructure":"Structure lines","referenceDepth":"Scene depth","downloadReference":"Download PNG","referenceLoadFailed":"Could not load reference","cameraBox":"Camera box","cameraBoxTab":"Camera box","cameraBoxFrontToggle":"Front","cameraBoxBackToggle":"Back","cameraBoxLeftToggle":"Left","cameraBoxRightToggle":"Right","cameraBoxTopToggle":"Top","cameraBoxBottomToggle":"Bottom","copyObservationImage":"Copy observation image","downloadObservationImage":"Download observation image","observationCopyFailed":"Could not copy the observation image. Try again or download it.","observationDownloadFailed":"Could not download the observation image. Try again.","noCameraBoxes":"No camera boxes","noObservationDirections":"Select at least one direction","addCameraBox":"Camera box","cameraBoxSize":"Edge length (m)","cameraBoxResolution":"Tile resolution","cameraBoxView":"Observation view","cameraBoxSheet":"Six-view sheet","cameraBoxFront":"Front (+Z)","cameraBoxBack":"Back (−Z)","cameraBoxLeft":"Left (−X)","cameraBoxRight":"Right (+X)","cameraBoxTop":"Top (+Y)","cameraBoxBottom":"Bottom (−Y)","fitCameraBoxScene":"Fit scene objects","fitCameraBoxHands":"Fit all hands","cameraBoxHint":"Six inward orthographic views show only the box interior. Directions rotate with the box. Use the sheet to understand the pose and the main camera for composition.","cameraBoxTargetError":"Specify exactly one of --camera or --box.","cameraBoxViewTargetError":"Observation-view options require --box.","cameraBoxViewError":"--view must be sheet, front, back, left, right, top, or bottom.","cameraBoxViewsError":"Choose 1–6 distinct directions from front, back, left, right, top, bottom, separated by commas.","cameraBoxViewConflict":"Use either --view or --views, not both.","cameraBoxGenerationGuidance":"The main camera sets the final composition. The observation sheet shows the same scene at one moment; labels identify box-local directions, not anatomical left and right. Use auxiliary views to understand occlusion, digit ownership, and approximate bending intent. Produce a single image without a contact-sheet layout, duplicated subjects, direction labels, or joint/body guide lines. Correct anatomy and finger contact naturally instead of reproducing the references pixel for pixel.","referenceSkeleton":"Skeleton","renderPassError":"--pass must be one of {{passes}}.","appearance":"Model style","appearanceQuaternius":"Human model","appearanceGeometric":"Geometric mannequin","editObject":"Edit object","newInGroup":"New 3D space in group “{{group}}”"},"canvasHistory":{"undo":"Undo","redo":"Redo","label":"Edit history"},"canvasStates":{"switch":"Layout states"},"sessionPreview":{"label":"Session preview","add":"Add session preview","session":"Source session","output":"State or camera","projectRequired":"Move this session into a project first.","empty":"No session previews available","unavailable":"Source unavailable. The last preview is retained.","failed":"Unable to load session preview","openSource":"Open source session","group":"Group","search":"Search groups, sessions or states","clearSearch":"Clear search","chooseParent":"Select an item in the previous column","noChildren":"No options in this branch","loading":"Loading preview sources","descendantMatches":"{{count}} matching descendants","searchResults":"{{count}} matches"},"units":{"pixels":"px"},"settings":{"title":"Settings","navigationLabel":"Settings sections","close":"Close settings","autoRelease":"Automatic cleanup","imageDays":"Unused images","imageHint":"Images in use are kept.","historyDays":"Canvas history","historyHint":"The latest version and active undo history are kept. Ordinary history is limited to 100 versions.","trash":"Trash","trashDays":"Auto-delete after","trashHint":"Deleted sessions and their content are permanently removed when this period ends.","resetDefaults":"Reset to defaults","restoreSession":"Restore session","emptyTrash":"Trash is empty","deletedAt":"Deleted at","loading":"Loading settings","invalidDays":"Enter a whole number of days from 1 to 3650.","conflict":"Settings have changed. Retry to save your changes.","daysUnit_one":"day","daysUnit_other":"days","deleteNow":"Delete now","deleteNowConfirm":"Permanently delete “{{title}}”?","clearTrash":"Empty trash","clearTrashConfirm":"Empty the trash?","permanentDeleteHint":"Deleted sessions and their content cannot be restored."}}');var r=i(48511);let o=["zh-CN","en"],s="zh-CN",l={en:{translation:a},"zh-CN":{translation:r}};function d(e=s){let t=(0,n.Q_)();return t.init({fallbackLng:"en",initAsync:!1,interpolation:{escapeValue:!1},lng:e,resources:l}),t}function c(e){return o.some(t=>t===e)}function u(e){return e?.toLowerCase().startsWith("en")?"en":s}function m(e,t){if(c(e))return e;for(let e of t){let t=e.toLowerCase(),i=o.find(e=>e.toLowerCase()===t)??o.find(e=>e.toLowerCase().split("-")[0]===t.split("-")[0]);if(i)return i}return s}},92449:(e,t,i)=>{"use strict";i.d(t,{D:()=>k});var n=i(73365),a=i(1521);i(20701);var r=i(46811);let o=(e,t,i)=>[e[0]+t[0]*i,e[1]+t[1]*i],s=(e,t)=>Math.hypot(t[0]-e[0],t[1]-e[1]),l=e=>e.map(e=>Number(e.toFixed(6))).join(" ");function d(e,t,i=!0,n=.72){let a=e.map((a,r)=>{let l=i||0!==r&&r!==e.length-1?"number"==typeof t?t:t[r]??0:0;return function(e,t,i,n,a=.72){let r=s(e,t),l=s(t,i),d=Math.max(0,Math.min(n,.49*r,.49*l));if(0===r||0===l||0===d)return{start:t,end:t,middle:t,curves:[]};let c=[(t[0]-e[0])/r,(t[1]-e[1])/r],u=[(i[0]-t[0])/l,(i[1]-t[1])/l],m=a*d,h=2*m-d,p=o(t,c,-d),g=o(t,u,d),f=o(p,c,m),y=o(g,u,-m),x=[(f[0]+y[0])/2,(f[1]+y[1])/2];return{start:p,end:g,middle:x,curves:[[p,o(p,c,h),f,x],[x,y,o(g,u,-h),g]]}}(e[(r+e.length-1)%e.length],a,e[(r+1)%e.length],l,n)});return{d:a.map((e,t)=>`${0===t?"M":"L"}${l(e.start)}${e.curves.map(e=>`C${e.slice(1).map(l).join(" ")}`).join("")}`).join("")+(i?"Z":""),corners:a}}let c=d([[3.4,10.3],[20.4,3.6],[13.7,20.6],[10.7,13.3]],[3.1,3.8,3.1,1.7],!0,.56),u=d(function(e=9.5,t=4.8){return Array.from({length:10},(i,n)=>{let a=-Math.PI/2+n*Math.PI/5,r=n%2==0?e:t;return[12+r*Math.cos(a),12.3+r*Math.sin(a)]})}(9.8,5.2),[2.9,1.65,2.9,1.65,2.9,1.65,2.9,1.65,2.9,1.65],!0,.56),m=d([[4,14],[4,20],[20,20],[20,14]],3.8,!1,.56),h=d([[12,3.4],[17.7,9.7],[6.3,9.7]],[2.1,1.8,1.8],!0,.56),p=d([[8,7],[16,7],[20,11],[20,21],[8,21]],[4.5,1.2,1.2,4.5,4.5],!0,.56),g=22/3*Math.tan(Math.PI/8),f=`M6.5 10C6.5 ${10-g} ${12-g} 4.5 12 4.5C${12+g} 4.5 17.5 ${10-g} 17.5 10C17.5 13 17.9 14.6 18.6 15.8Q19.3 17 17.9 17H6.1Q4.7 17 5.4 15.8C6.1 14.6 6.5 13 6.5 10Z`,y=d([[19.2,3.5],[20,9.7],[13.8,7.6]],1.8,!0,.56),x=d([[3,4.5],[21,4.5],[21,19.5],[3,19.5]],4.5,!0,.56),b=d([[3.8,3.8],[3.8,9.2],[9.2,9.2]],1.6,!0,.56),v=d([[12,4.5],[18,11],[6,11]],[2.1,2.3,2.3],!0,.56),w={"arrow-up":0,"arrow-down":180,"arrow-left":-90,"arrow-right":90};function j({name:e}){let t={className:"yisi-animated-icon-motion","data-animated-icon-part":"motion"};switch(e){case"arrow-up":case"arrow-down":case"arrow-left":case"arrow-right":return(0,n.jsxs)("g",{transform:`rotate(${w[e]} 12 12)`,children:[(0,n.jsxs)("g",{...t,children:[(0,n.jsx)("path",{d:"M12 10v9",strokeWidth:"2.2"}),(0,n.jsx)("path",{d:v.d,fill:"currentColor",stroke:"none"})]}),(0,n.jsx)("g",{className:"yisi-animated-icon-layer yisi-icon-arrow-air",opacity:"0",strokeWidth:"1.3",children:(0,n.jsx)("path",{d:"M12 20.8v1.5M9.8 20.2l-.9 1.1M14.2 20.2l.9 1.1"})})]});case"reset":return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("g",{className:"yisi-animated-icon-layer yisi-icon-feedback yisi-icon-reset-ring",opacity:"0",strokeWidth:"1.2",children:(0,n.jsx)("circle",{cx:"12",cy:"12",r:"4.2"})}),(0,n.jsx)("circle",{cx:"12",cy:"12",r:"1.25",fill:"currentColor",stroke:"none"}),(0,n.jsxs)("g",{...t,children:[(0,n.jsx)("path",{d:"M5.5 7.35A8 8 0 1 1 4 12"}),(0,n.jsx)("path",{d:b.d,fill:"currentColor",stroke:"none"})]})]});case"sidebar-left":case"sidebar-right":return(0,n.jsxs)("g",{transform:"sidebar-right"===e?"translate(24 0) scale(-1 1)":void 0,children:[(0,n.jsx)("path",{d:x.d}),(0,n.jsx)("g",{...t,children:(0,n.jsx)("rect",{x:"5.5",y:"7",width:"4",height:"10",rx:"1.6",fill:"currentColor",stroke:"none"})}),(0,n.jsx)("g",{className:"yisi-animated-icon-layer yisi-icon-feedback yisi-icon-sidebar-wake",opacity:"0",strokeWidth:"1.2",children:(0,n.jsx)("path",{d:"M11 9h3M11 12h5M11 15h3"})})]});case"loading":return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"8",opacity:"0.16"}),(0,n.jsxs)("g",{...t,children:[(0,n.jsx)("path",{d:"M12 4a8 8 0 1 1-8 8"}),(0,n.jsx)("g",{className:"yisi-animated-icon-layer yisi-icon-feedback yisi-icon-loading-trail",opacity:"0",strokeWidth:"1.2",children:(0,n.jsx)("path",{d:"M6.2 12a5.8 5.8 0 0 0 5.8 5.8"})})]})]});case"plus":return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("g",{...t,fill:"currentColor",stroke:"none",children:[(0,n.jsx)("rect",{x:"4.5",y:"10.8",width:"15",height:"2.4",rx:"1.2"}),(0,n.jsx)("rect",{x:"10.8",y:"4.5",width:"2.4",height:"15",rx:"1.2"})]}),(0,n.jsx)("g",{className:"yisi-animated-icon-layer yisi-icon-feedback yisi-icon-plus-spark",opacity:"0",strokeWidth:"1.3",children:(0,n.jsx)("path",{d:"M5.5 5.5l-1-1M18.5 5.5l1-1M5.5 18.5l-1 1M18.5 18.5l1 1"})})]});case"upload":return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("path",{d:m.d}),(0,n.jsx)("rect",{x:"5.5",y:"18.4",width:"13",height:"2.5",rx:"1.25",fill:"currentColor",stroke:"none"}),(0,n.jsxs)("g",{...t,children:[(0,n.jsx)("path",{d:"M12 8.7v6.8"}),(0,n.jsx)("path",{fill:"currentColor",stroke:"none",d:h.d})]}),(0,n.jsx)("g",{className:"yisi-animated-icon-layer yisi-icon-feedback yisi-icon-upload-ripple",opacity:"0",strokeWidth:"1.1",children:(0,n.jsx)("ellipse",{cx:"12",cy:"17.4",rx:"4.2",ry:"0.9"})})]});case"send":return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("g",{...t,children:(0,n.jsx)("path",{d:`${c.d}M${l(c.corners[3].middle)}L${l(c.corners[1].middle)}`})}),(0,n.jsx)("g",{className:"yisi-animated-icon-layer yisi-icon-feedback yisi-icon-send-wake",opacity:"0",strokeWidth:"1.3",children:(0,n.jsx)("path",{d:"M4 16l3-3M4.5 20l4-4M8.5 21l2.5-2.5"})})]});case"refresh":return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("g",{className:"yisi-animated-icon-layer yisi-icon-feedback yisi-icon-refresh-trail",opacity:"0",strokeWidth:"1.2",children:(0,n.jsx)("path",{d:"M8 8a5.65 5.65 0 0 1 6-1.3M16 16a5.65 5.65 0 0 1-6 1.3"})}),(0,n.jsxs)("g",{...t,children:[(0,n.jsx)("path",{d:"M4.5 9a8 8 0 0 1 13.7-2.7M19.5 15a8 8 0 0 1-13.7 2.7"}),(0,n.jsxs)("g",{fill:"currentColor",stroke:"none",children:[(0,n.jsx)("path",{d:y.d}),(0,n.jsx)("path",{d:y.d,transform:"rotate(180 12 12)"})]})]})]});case"copy":return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("path",{d:"M6 16h-.5A2.5 2.5 0 0 1 3 13.5v-8A2.5 2.5 0 0 1 5.5 3h7A2.5 2.5 0 0 1 15 5.5"}),(0,n.jsx)("g",{className:"yisi-animated-icon-layer yisi-icon-feedback yisi-icon-copy-echo",opacity:"0",strokeWidth:"1.1",children:(0,n.jsx)("path",{d:p.d})}),(0,n.jsxs)("g",{...t,children:[(0,n.jsx)("path",{d:p.d}),(0,n.jsx)("path",{d:"M16 7v2a2 2 0 0 0 2 2h2Z",fill:"currentColor",stroke:"none"}),(0,n.jsx)("path",{d:"M11.5 15.5h5"})]})]});case"star":return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("g",{...t,children:(0,n.jsx)("path",{d:u.d})}),(0,n.jsx)("g",{className:"yisi-animated-icon-layer yisi-icon-feedback yisi-icon-star-spark",opacity:"0",strokeWidth:"1.2",children:(0,n.jsx)("path",{d:"M19.5 2.5v3M18 4h3M3.5 6v2M2.5 7h2M20 17.5V20M18.75 18.75h2.5"})})]});case"bell":return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("circle",{cx:"12",cy:"3.2",r:"1.4",fill:"currentColor",stroke:"none"}),(0,n.jsx)("g",{...t,children:(0,n.jsx)("path",{d:f})}),(0,n.jsxs)("g",{className:"yisi-animated-icon-layer yisi-icon-bell-clapper",children:[(0,n.jsx)("path",{d:"M12 17v1.5"}),(0,n.jsx)("rect",{x:"10.4",y:"18",width:"3.2",height:"3.6",rx:"1.6",fill:"currentColor",stroke:"none"})]}),(0,n.jsx)("g",{className:"yisi-animated-icon-layer yisi-icon-feedback yisi-icon-bell-waves",opacity:"0",strokeWidth:"1.2",children:(0,n.jsx)("path",{d:"M3.8 7Q1.5 10 3.8 13M20.2 7Q22.5 10 20.2 13"})})]});case"close":return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("g",{...t,children:(0,n.jsxs)("g",{transform:"rotate(45 12 12)",fill:"currentColor",stroke:"none",children:[(0,n.jsx)("rect",{x:"4.5",y:"10.8",width:"15",height:"2.4",rx:"1.2"}),(0,n.jsx)("rect",{x:"10.8",y:"4.5",width:"2.4",height:"15",rx:"1.2"})]})}),(0,n.jsx)("g",{className:"yisi-animated-icon-layer yisi-icon-feedback yisi-icon-close-ring",opacity:"0",strokeWidth:"1.2",children:(0,n.jsx)("circle",{cx:"12",cy:"12",r:"8"})})]})}}let k=(0,a.forwardRef)(function({name:e,size:t="1em",label:i,loop:o=!1,playKey:s,duration:l=720,motion:d="auto",onAnimationComplete:c,className:u,style:m,...h},p){let[g,f]=(0,a.useState)(!1),[y,x]=(0,a.useState)({id:0,playing:!1}),b=(0,a.useRef)(null),v=(0,a.useRef)(s),w="none"!==d&&!g,k=Number.isFinite(l)&&l>0?l:720;(0,a.useEffect)(()=>{let e=window.matchMedia("(prefers-reduced-motion: reduce)"),t=()=>f(e.matches);return t(),e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]);let S=(0,a.useCallback)(()=>{w&&x(e=>({id:e.id+1,playing:!0}))},[w]),I=(0,a.useCallback)(()=>x(e=>({...e,playing:!1})),[]);return(0,a.useImperativeHandle)(p,()=>({play:S,stop:I}),[S,I]),(0,a.useEffect)(()=>{x(e=>({id:e.id+1,playing:o&&w}))},[e,o,w]),(0,a.useEffect)(()=>{s!==v.current&&void 0!==s&&S(),v.current=s},[s,S]),(0,a.useEffect)(()=>{let e=b.current,t=e=>{!o&&y.playing&&w&&e.target instanceof SVGElement&&"motion"===e.target.getAttribute("data-animated-icon-part")&&(I(),c?.())};return e?.addEventListener("animationend",t),()=>e?.removeEventListener("animationend",t)},[o,w,y.playing,c,I]),(0,n.jsx)("svg",{...h,ref:b,...(0,r.S)("animated-icon","AnimatedIcon"),className:["yisi-animated-icon",u].filter(Boolean).join(" "),"data-icon":e,"data-playing":y.playing&&w?"true":"false","data-loop":o?"true":"false",viewBox:"0 0 24 24",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:h.strokeWidth??1.8,strokeLinecap:"round",strokeLinejoin:"round",role:i?"img":void 0,"aria-label":i,"aria-hidden":!i||void 0,focusable:"false",style:{"--yisiui-animated-icon-duration":`${k}ms`,...m},children:(0,n.jsx)(j,{name:e},`${e}:${y.id}`)})});k.displayName="AnimatedIcon"},93878:()=>{},94560:()=>{},95948:(e,t,i)=>{"use strict";i.d(t,{G:()=>s});var n=i(73365),a=i(87340),r=i(1521);i(22392),i(93878);var o=i(46811);function s({label:e,variant:t="text",rows:i,compact:l=!1,motion:d="auto",className:c,style:u}){let m=(0,r.useRef)(null),[h,p]=(0,r.useState)(4),g=void 0===i,f=g?h:Number.isFinite(i)?Math.min(12,Math.max(1,Math.trunc(i))):4;return(0,r.useLayoutEffect)(()=>{let e,i=m.current;if(!i||!g||"text"!==t)return;let n=()=>{let e=i.querySelector(".ant-skeleton-title");if(!e)return;let t=getComputedStyle(e),n=getComputedStyle(i),a=parseFloat(n.getPropertyValue("--yisiui-loading-state-line-height"))||16,r=parseFloat(n.getPropertyValue("--yisiui-loading-state-line-gap"))||16,o=e.getBoundingClientRect().height+(parseFloat(t.marginBottom)||0),s=i.getBoundingClientRect().height;if(s<=0)return;let l=Math.max(0,Math.floor((s-o+r)/(a+r)));p(e=>e===l?e:l)},a=()=>{void 0===e&&(e=requestAnimationFrame(()=>{e=void 0,n()}))};n();let r="u"<typeof ResizeObserver?void 0:new ResizeObserver(a);return r?.observe(i),window.addEventListener("resize",a),()=>{r?.disconnect(),window.removeEventListener("resize",a),void 0!==e&&cancelAnimationFrame(e)}},[g,l,t]),(0,n.jsxs)("section",{...(0,o.S)("loading-state","LoadingState"),className:["yisi-loading-state",l?"yisi-loading-state-compact":null,c].filter(Boolean).join(" "),"data-density":l?"compact":"default","data-motion":d,"data-variant":t,"data-rows":g?"auto":"fixed","aria-busy":"true","aria-label":e,style:u,children:[(0,n.jsx)("span",{className:"yisi-loading-state-announcement",role:"status","aria-live":"polite",children:e}),(0,n.jsx)("div",{ref:m,className:"yisi-loading-state-skeleton","aria-hidden":"true",children:"image"===t?(0,n.jsx)(a.A.Image,{active:"auto"===d}):(0,n.jsx)(a.A,{active:"auto"===d,paragraph:{rows:f},title:{width:"42%"}})})]})}},96826:(e,t,i)=>{"use strict";i.d(t,{d:()=>y,m:()=>f});var n=i(84910),a=i(5105),r=i(52798),o=i(12399),s=i(54996),l=i(18989),d=i(29169),c=i(17340),u=i(77902);let m=new n.Pq0(0,1,0),h=Object.fromEntries(Object.entries({male:a,female:r}).map(([e,t])=>{let i=t.parts.map(e=>{let t=new n.Pq0(...e.start),i=new n.Pq0(...e.end).sub(t);return{length:i.length(),inverse:new n.kn4().compose(t,new n.PTz().setFromUnitVectors(m,i.normalize()),new n.Pq0(1,1,1)).invert()}}),a=t.modules.map(e=>{let i=[...new Set(e.indices)],n=new Map(i.map((e,t)=>[e,t]));return{...e,vertices:i,indices:e.indices.map(e=>n.get(e)),normalKeys:i.map(e=>t.positions.slice(3*e,3*e+3).join(","))}});return[e,{asset:t,modules:a,targets:(0,l.F)(t),sourceFrames:i,sourceBodyHeight:t.height-i[t.parts.findIndex(e=>"head"===e.id)].length}]})),p=new WeakMap,g=e=>JSON.stringify([e.id,e.appearance,e.bodyType??"male",e.bones.map(e=>[e.id,e.modelPart])]);function f(e,t){let i=p.get(e);return!!i&&"geometric"!==t.appearance&&i.key===g(t)&&(x(t,e,i),!0)}function y(e,t={}){if("geometric"===e.appearance)return(0,u.s)(e);let i=new n.YJl,a={key:g(e),handCreases:t.handCreases??!0,parts:[]};return p.set(i,a),x(e,i,a),i}function x(e,t,i){let a,r=i.handCreases,l=i.headRatio!==e.headRatio,{asset:u,modules:p,targets:g,sourceFrames:f,sourceBodyHeight:y}=h[e.bodyType??"male"],x=(0,o.ms)(e),b=e.height/u.height,v=(0,s.G_)(e.headRatio),[w,j,k]=(0,s.r8)(e.headRatio),S=new Map,I=[],C=(t,i)=>{let a,r=`${t?.id??"root"}/${i}`;if(S.has(r))return S.get(r);let l=f[i],c=u.parts[i],h=b*(0,s.UB)(v,c.id)*(c.id.endsWith("-hand")?e.palmSize??1:1),p=t?x[t.startJointId].position:(0,o.i1)(e.position),g=e.joints.find(e=>e.id===(t?.endJointId??"spine")),w=g?(0,o.p)(e,g):new n.Pq0(0,l.length*b,0),j=c.id.endsWith("-foot")?e.footSize??1:1,k=(0,s.kF)(j);w.x/=j,w.y/=k,w.z/=j;let I=w.length()/l.length,C="head"===c.id?I:h,P=t?x[t.endJointId].rotation.clone():(0,o.b5)(e.rotation),L=t&&(0,d.dS)(c.id)?(0,d.oT)(e,t):void 0;if(L)a=new n.kn4().compose(p,P,new n.Pq0(1,1,1)).multiply((0,d.PA)(e,L,c.id)).multiply(new n.kn4().makeTranslation(-c.start[0],-c.start[1],-c.start[2]));else if(["pelvis","spine","chest","neck"].includes(c.id)||/-(shoulder|hip)$/.test(c.id)){let t=(0,o.i1)(c.end).sub((0,o.i1)(c.start)),i=Math.abs(t.y)>1e-4?w.y/t.y:(e.height-e.height/e.headRatio)/y,r=new n.Pq0(h,i,b*v.torsoDepth),s=P.clone().multiply(new n.PTz().setFromUnitVectors(t.clone().multiply(r).normalize(),w.clone().normalize())),l=new n.kn4().makeTranslation(-c.start[0],-c.start[1],-c.start[2]);a=new n.kn4().compose(p,s,r).multiply(l);let d=g&&(0,o.i1)(g.offset).normalize().dot(t.clone().normalize())>1-1e-6;if(v.softness>0&&d&&["pelvis","spine","chest","neck"].includes(c.id)){let e=new n.kn4().set(r.x,(w.x-t.x*r.x)/t.y,0,0,0,r.y,0,0,0,(w.z-t.z*r.z)/t.y,r.z,0,0,0,0,1),i=new n.kn4().compose(p,P,new n.Pq0(1,1,1)).multiply(e).multiply(l);a.elements.forEach((e,t)=>{a.elements[t]=e+(i.elements[t]-e)*v.softness})}}else{let e=P.clone().multiply(new n.PTz().setFromUnitVectors(m,w.clone().normalize()));if(a=new n.kn4().compose(p,e,new n.Pq0(C,I,"head"===c.id?C*v.headDepth:C)).multiply(l.inverse),c.id.endsWith("-foot")&&v.softness>0){let e=(0,o.i1)(c.end).sub((0,o.i1)(c.start)),t=new n.Pq0(h,w.y/e.y,w.z/e.z);P.multiply(new n.PTz().setFromUnitVectors(e.multiply(t).normalize(),w.clone().normalize()));let i=new n.kn4().compose(p,P,t).multiply(new n.kn4().makeTranslation(-c.start[0],-c.start[1],-c.start[2]));a.elements.forEach((e,t)=>{a.elements[t]=e+(i.elements[t]-e)*v.softness})}}if(1!==j){let i=new n.kn4().compose(p,t?x[t.endJointId].rotation:(0,o.b5)(e.rotation),new n.Pq0(1,1,1));a.premultiply(i.clone().multiply(new n.kn4().makeScale(j,k,j)).multiply(i.invert()))}return S.set(r,a),a},P=new Map(e.bones.filter(e=>e.id===e.modelPart).map(e=>[e.modelPart,e])),L=0,A=[],M=(t,o)=>{let s=o&&o.id.endsWith(o.modelPart)?o.id.slice(0,-o.modelPart.length):"",d=!!(o&&o.id!==o.modelPart),m=!d&&a?a:u.parts.map((i,n)=>{let a=d?e.bones.find(e=>e.id===`${s}${i.id}`):P.get(i.id);return a?C(a,n):d&&o?C(o,t.part):C(void 0,n)});d||(a=m);let{vertices:h}=t,p=i.parts[L++];if(!p){let a=new n.LoY().setAttribute("position",new n.qtW(3*h.length,3));a.setIndex(t.indices);let r=new n.eaF(a,new n.G_z({side:n.$EB}));r.userData={characterId:e.id,...o?{boneId:o.id}:{},modelPart:u.parts[t.part].id},p={mesh:r,rest:new Float64Array(3*h.length),posed:new Float64Array(3*h.length),segments:[]},i.parts.push(p)}let{mesh:f,rest:y,posed:x}=p,b=f.geometry,S=new n.Pq0,M=new n.Pq0,N=new n.Pq0;for(let e=0;e<h.length;e++){let t=h[e],i=3*t,n=g[w],a=g[j];l&&(y[3*e]=n[i]+(a[i]-n[i])*k,y[3*e+1]=n[i+1]+(a[i+1]-n[i+1])*k,y[3*e+2]=n[i+2]+(a[i+2]-n[i+2])*k),N.fromArray(y,3*e),S.set(0,0,0);let r=0;for(let e=0;e<4;e++){let i=u.weights[4*t+e];i&&(M.copy(N).applyMatrix4(m[u.influences[4*t+e]]),S.addScaledVector(M,i),r+=i)}S.divideScalar(r),x[3*e]=S.x,x[3*e+1]=S.y,x[3*e+2]=S.z}let R=b.getAttribute("position");R.array.set(x),R.needsUpdate=!0,b.boundingBox=null,b.boundingSphere=null,b.computeVertexNormals(),"body"===t.material&&v.softness>0&&I.push({geometry:b,keys:t.normalKeys.map(e=>`${s}/${e}`)});let $=new n.Q1f("brows"===t.material?"#514235":"eyes"===t.material?"#e7ded1":e.color),T=(w<2?1-k:0)+(j<2?k:0);if("brows"===t.material&&$.lerp(new n.Q1f(e.color),.9*T),"eyes"===t.material&&$.lerp(new n.Q1f("#514235"),T),f.material.color.copy($),A.push(f),r){l&&(p.segments=(0,c.xQ)(e,u.parts[t.part].id,y,t.indices));let i=(0,c.HK)(e,p.segments,x,p.creases);!i&&p.creases&&(p.creases.geometry.dispose(),p.creases.material.dispose(),p.creases=void 0,f.material.polygonOffset=!1),i&&(f.material.polygonOffset=!0,f.material.polygonOffsetFactor=1,f.material.polygonOffsetUnits=1,i.userData={...f.userData,reference:"finger-crease"},A.push(i),p.creases=i)}};for(let t of p){let i=u.parts[t.part].id;if("pelvis"===i)M(t);else for(let n of e.bones.filter(e=>e.modelPart===i))M(t,n)}let N=new Map,R=new n.Pq0,$=new n.Pq0,T=new n.Pq0;for(let{geometry:e,keys:t}of I){let i=e.getAttribute("position"),a=e.index;for(let e=0;e<a.count;e+=3){let r=[a.getX(e),a.getX(e+1),a.getX(e+2)];R.fromBufferAttribute(i,r[0]),$.fromBufferAttribute(i,r[1]),T.fromBufferAttribute(i,r[2]);let o=$.sub(R).cross(T.sub(R));for(let e of r){let i=t[e];N.has(i)||N.set(i,new n.Pq0),N.get(i).add(o)}}}for(let e of N.values())e.normalize();for(let{geometry:e,keys:t}of I){let i=e.getAttribute("normal");t.forEach((e,t)=>{R.fromBufferAttribute(i,t).lerp(N.get(e),v.softness).normalize(),i.setXYZ(t,R.x,R.y,R.z)})}(t.children.length!==A.length||A.some((e,i)=>t.children[i]!==e))&&(t.clear(),A.length&&t.add(...A)),i.headRatio=e.headRatio}},98151:()=>{},98852:()=>{},99791:(e,t,i)=>{"use strict";i.d(t,{L:()=>n});let n={"color.brand.primary":"#16A34A","color.brand.primaryHover":"#22C55E","color.brand.primaryActive":"#15803D","color.brand.primaryBg":"#F0FDF4","color.brand.primaryBgHover":"#DCFCE7","color.brand.primaryText":"#15803D","color.brand.onPrimary":"#FFFFFF","color.neutral.0":"#FFFFFF","color.neutral.25":"#FCFDFD","color.neutral.50":"#F8FAF9","color.neutral.100":"#F3F6F5","color.neutral.200":"#E2E9E7","color.neutral.300":"#C9D4D1","color.neutral.400":"#ADBDB8","color.neutral.500":"#7C918B","color.neutral.600":"#586B6F","color.neutral.700":"#48595C","color.neutral.800":"#334448","color.neutral.900":"#1F292B","color.paper.natural":"#F2E3C4","color.paper.sage":"#B9CA8B","color.paper.amber":"#E4B653","color.paper.rose":"#DC938B","color.paper.slate":"#98A9B0","color.paper.sky":"#87C3CC","color.paper.lavender":"#B79BC8","color.paper.clay":"#C9825D","color.status.success":"#237804","color.status.successBg":"#F6FFED","color.status.warning":"#AD4E00","color.status.warningBg":"#FFF7E6","color.status.danger":"#CF1322","color.status.dangerBg":"#FFF1F0","color.status.info":"#48595C","color.status.infoBg":"#F3F6F5","color.status.processing":"#15803D","color.status.processingBg":"#F0FDF4","font.family.sans":"-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif","font.family.mono":"SFMono-Regular, ui-monospace, Menlo, Monaco, Consolas, Liberation Mono, monospace","font.size.2xs":"11px","font.size.xs":"12px","font.size.sm":"13px","font.size.md":"14px","font.size.lg":"16px","font.size.xl":"20px","font.size.2xl":"24px","font.size.reading":"15px","font.size.display":"28px","font.weight.regular":400,"font.weight.medium":500,"font.weight.semibold":600,"font.weight.bold":700,"font.lineHeight.tight":1.2,"font.lineHeight.compact":1.35,"font.lineHeight.normal":1.6,"font.lineHeight.reading":1.9,"font.letterSpacing.normal":"0em","font.letterSpacing.label":"0.04em","font.variantNumeric.tabular":"tabular-nums","space.0":"0px","space.1":"4px","space.2":"8px","space.3":"12px","space.4":"16px","space.5":"20px","space.6":"24px","space.8":"32px","space.10":"40px","radius.sm":"6px","radius.md":"8px","radius.lg":"10px","radius.full":"9999px","shadow.panel":"0 16px 48px rgba(31, 41, 43, 0.06)","shadow.card":"0 4px 12px rgba(31, 41, 43, 0.04)","shadow.raised":"0 12px 30px rgba(31, 41, 43, 0.12)","motion.fast":"120ms","motion.normal":"180ms","motion.slow":"240ms","color.text.primary":"#1F292B","color.text.secondary":"#48595C","color.text.muted":"#586B6F","color.text.hint":"#586B6F","color.text.placeholder":"#586B6F","color.text.disabled":"#7C918B","color.text.inverse":"#FFFFFF","color.text.onPrimary":"#FFFFFF","color.border.default":"#C9D4D1","color.border.subtle":"#E2E9E7","color.border.control":"#7C918B","color.border.interactive":"#15803D","color.border.hover":"#ADBDB8","color.border.focus":"#15803D","color.border.disabled":"#E2E9E7","color.border.error":"#CF1322","color.border.warning":"#AD4E00","color.border.success":"#237804","color.surface.page":"#F3F6F5","color.surface.panel":"#FFFFFF","color.surface.soft":"#F8FAF9","color.surface.code":"#F8FAF9","color.surface.hover":"#F8FAF9","color.surface.selected":"#F0FDF4","color.surface.active":"#DCFCE7","color.surface.disabled":"#F3F6F5","color.surface.overlay":"rgba(31,41,43,0.45)","color.action.primary":"#16A34A","color.action.primaryHover":"#22C55E","color.action.primaryActive":"#15803D","color.action.secondaryHover":"#F8FAF9","color.action.secondaryActive":"#F0FDF4","color.action.link":"#15803D","color.action.linkHover":"#15803D","color.action.linkActive":"#15803D","color.feedback.success":"#237804","color.feedback.successBg":"#F6FFED","color.feedback.warning":"#AD4E00","color.feedback.warningBg":"#FFF7E6","color.feedback.danger":"#CF1322","color.feedback.dangerBg":"#FFF1F0","color.feedback.error":"#CF1322","color.feedback.errorBg":"#FFF1F0","color.feedback.info":"#48595C","color.feedback.infoBg":"#F3F6F5","color.feedback.processing":"#15803D","color.feedback.processingBg":"#F0FDF4","color.selection.background":"#F0FDF4","color.selection.text":"#15803D","typography.pageTitle.fontFamily":"-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif","typography.pageTitle.fontSize":"28px","typography.pageTitle.fontWeight":700,"typography.pageTitle.lineHeight":1.2,"typography.pageTitle.letterSpacing":"0em","typography.sectionTitle.fontFamily":"-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif","typography.sectionTitle.fontSize":"20px","typography.sectionTitle.fontWeight":600,"typography.sectionTitle.lineHeight":1.2,"typography.sectionTitle.letterSpacing":"0em","typography.cardTitle.fontFamily":"-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif","typography.cardTitle.fontSize":"16px","typography.cardTitle.fontWeight":600,"typography.cardTitle.lineHeight":1.2,"typography.cardTitle.letterSpacing":"0em","typography.body.fontFamily":"-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif","typography.body.fontSize":"14px","typography.body.fontWeight":400,"typography.body.lineHeight":1.6,"typography.body.letterSpacing":"0em","typography.bodyStrong.fontFamily":"-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif","typography.bodyStrong.fontSize":"14px","typography.bodyStrong.fontWeight":600,"typography.bodyStrong.lineHeight":1.6,"typography.bodyStrong.letterSpacing":"0em","typography.bodySmall.fontFamily":"-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif","typography.bodySmall.fontSize":"13px","typography.bodySmall.fontWeight":400,"typography.bodySmall.lineHeight":1.35,"typography.bodySmall.letterSpacing":"0em","typography.label.fontFamily":"-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif","typography.label.fontSize":"12px","typography.label.fontWeight":600,"typography.label.lineHeight":1.35,"typography.label.letterSpacing":"0em","typography.kicker.fontFamily":"-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif","typography.kicker.fontSize":"11px","typography.kicker.fontWeight":600,"typography.kicker.lineHeight":1.35,"typography.kicker.letterSpacing":"0.04em","typography.status.fontFamily":"-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif","typography.status.fontSize":"11px","typography.status.lineHeight":1.35,"typography.status.letterSpacing":"0em","typography.button.fontFamily":"-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif","typography.button.fontSize":"14px","typography.button.fontWeight":500,"typography.button.lineHeight":1.35,"typography.button.letterSpacing":"0em","typography.meta.fontFamily":"-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif","typography.meta.fontSize":"12px","typography.meta.fontWeight":400,"typography.meta.lineHeight":1.35,"typography.meta.letterSpacing":"0em","typography.reading.fontFamily":"-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif","typography.reading.fontSize":"15px","typography.reading.fontWeight":400,"typography.reading.lineHeight":1.9,"typography.reading.letterSpacing":"0em","typography.code.fontFamily":"SFMono-Regular, ui-monospace, Menlo, Monaco, Consolas, Liberation Mono, monospace","typography.code.fontSize":"12px","typography.code.fontWeight":400,"typography.code.lineHeight":1.6,"typography.code.letterSpacing":"0em","typography.numeric.fontFamily":"-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif","typography.numeric.fontSize":"24px","typography.numeric.fontWeight":700,"typography.numeric.lineHeight":1.2,"typography.numeric.letterSpacing":"0em","typography.numeric.fontVariantNumeric":"tabular-nums","theme.light.page":"#F3F6F5","theme.light.panel":"#FFFFFF","theme.light.text":"#1F292B","theme.dark.page":"#141414","theme.dark.panel":"#1F1F1F","theme.dark.text":"#F5F5F5","theme.dark.interactive":"#22C55E","motion.textSpeed.slow":.6,"motion.textSpeed.medium":1,"motion.textSpeed.fast":1.6,"surface.desktopWeb.pageBackground":"#F3F6F5","surface.desktopWeb.contentBackground":"#FFFFFF","surface.desktopWeb.sidebarWidth":"280px","surface.desktopWeb.contentMaxWidth":"1400px","surface.desktopWeb.pagePadding":"24px","surface.desktopWeb.sectionGap":"20px","surface.desktopWeb.panelPadding":"24px","component.button.height":"36px","component.button.radius":"8px","component.button.horizontalPadding":"14px","component.input.height":"36px","component.input.radius":"8px","component.card.radius":"8px","component.card.padding":"20px","component.card.shadow":"0 4px 12px rgba(31, 41, 43, 0.04)","component.statusLight.background":"#303030","component.statusLight.green":"#52C41A","component.statusLight.yellow":"#FADB14","component.statusLight.yellowOnLight":"#D0A003","component.statusLight.red":"#FF4D4F","component.borderScan.color":"#22C55E","component.borderScan.duration":"3200ms","component.borderScan.lineWidth":"3px","component.textShine.color":"#FFFFFF","component.textShine.beamWidth":"216px","component.textShine.beamAngle":"105deg","component.textShine.baseVelocity":96,"component.writingAgent.main":"#16A34A","component.writingAgent.logic":"#722ED1","component.writingAgent.draft":"#08979C","component.writingAgent.annotation":"#C41D7F","component.writingAgent.support":"#586B6F","component.contentGraph.node.actorFill":"#F0FDF4","component.contentGraph.node.actorStroke":"#15803D","component.contentGraph.node.actorText":"#15803D","component.contentGraph.node.eventFill":"#F6FFED","component.contentGraph.node.eventStroke":"#389E0D","component.contentGraph.node.eventText":"#135200","component.contentGraph.node.conflictFill":"#FFF7E6","component.contentGraph.node.conflictStroke":"#D46B08","component.contentGraph.node.conflictText":"#873800","component.contentGraph.node.knowledgeFill":"#E6FFFB","component.contentGraph.node.knowledgeStroke":"#08979C","component.contentGraph.node.knowledgeText":"#006D75","component.contentGraph.node.ruleFill":"#F9F0FF","component.contentGraph.node.ruleStroke":"#722ED1","component.contentGraph.node.ruleText":"#391085","component.contentGraph.node.skeletonFill":"#F5F5F5","component.contentGraph.node.skeletonStroke":"#8C8C8C","component.contentGraph.node.skeletonText":"#434343","component.contentGraph.node.defaultFill":"#F8FAF9","component.contentGraph.node.defaultStroke":"#8B9BAE","component.contentGraph.node.defaultText":"#1F292B","component.contentGraph.edge.causal":"#D46B08","component.contentGraph.edge.conflict":"#CF1322","component.contentGraph.edge.state":"#13A8A8","component.contentGraph.edge.evidence":"#389E0D","component.contentGraph.edge.reader":"#722ED1","component.contentGraph.edge.timeline":"#8C8C8C","component.contentGraph.edge.default":"#7A8CA3","component.contentGraph.label.text":"#48595C","component.contentGraph.label.background":"rgba(255,255,255,0.92)","component.contentGraph.label.border":"rgba(122,140,163,0.32)","component.contentGraph.selection":"#16A34A","component.focus.outline":"#15803D","component.focus.outlineWidth":"2px"}}}]);
|