@vincentt-xr/sdk 2.0.0-alpha.10 → 2.0.0-alpha.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/GROUNDING.md +95 -8
  2. package/dist/{CanonicalHeadFrame-D_0OzdB9.cjs → CanonicalHeadFrame-CZFvPzN_.cjs} +1 -1
  3. package/dist/{CanonicalHeadFrame-DdUqF6Fv.js → CanonicalHeadFrame-vn-jM9fG.js} +3 -3
  4. package/dist/{DebuggerUI-D-rcPa54.js → DebuggerUI-DDpU-nBF.js} +1 -1
  5. package/dist/{DebuggerUI-CVuV-VJ5.cjs → DebuggerUI-Db-1VtQJ.cjs} +1 -1
  6. package/dist/{FaceRetouch-C1AxBNex.js → FaceRetouch-D2xH5OpW.js} +4 -4
  7. package/dist/{FaceRetouch-D7kryDE6.cjs → FaceRetouch-DHhn1nSV.cjs} +1 -1
  8. package/dist/{TextLabel-c9BCucOI.js → TextLabel-C6F5xoaz.js} +182 -180
  9. package/dist/TextLabel-ChZCoB3P.cjs +2 -0
  10. package/dist/{bodyMaskMaterial-Cs2awskk.js → bodyMaskMaterial-C3aXItLo.js} +1 -1
  11. package/dist/{bodyMaskMaterial-CBWub5t_.cjs → bodyMaskMaterial-Q6rYywwW.cjs} +1 -1
  12. package/dist/{cache-2x3CUJuY.js → cache-C85JjyZA.js} +2 -2
  13. package/dist/{cache-DL1Dbz6k.cjs → cache-DFqZYsHC.cjs} +1 -1
  14. package/dist/components/ScreenImage/ScreenImage.d.ts +4 -1
  15. package/dist/components/ScreenShape/index.d.ts +4 -1
  16. package/dist/components/ScreenText/index.d.ts +4 -1
  17. package/dist/components/SegmentationOverlay/settings.d.ts +2 -2
  18. package/dist/components/TextLabel/TextLabel.d.ts +1 -1
  19. package/dist/{contexts-Y_FhdnIv.js → contexts-B5GODwuV.js} +2 -2
  20. package/dist/{contexts-DQc7zyqT.cjs → contexts-CSz9stBV.cjs} +1 -1
  21. package/dist/coordinates/index.d.ts +1 -1
  22. package/dist/coordinates/viewport.d.ts +10 -0
  23. package/dist/debug-ui/media-source.cjs +1 -1
  24. package/dist/debug-ui/media-source.js +1 -1
  25. package/dist/debug-ui.cjs +1 -1
  26. package/dist/debug-ui.js +11 -11
  27. package/dist/{drawNormalizedCrop-DG3gtJxf.js → drawNormalizedCrop-BLfB484W.js} +5 -5
  28. package/dist/{drawNormalizedCrop-C4KFaRne.cjs → drawNormalizedCrop-DaGT5mZ5.cjs} +1 -1
  29. package/dist/entries/core.d.ts +1 -1
  30. package/dist/face-effects.cjs +1 -1
  31. package/dist/face-effects.js +17 -17
  32. package/dist/footage-input/index.d.ts +46 -0
  33. package/dist/{getFaceInfo-BzlwHMjX.cjs → getFaceInfo-BbcKq8PJ.cjs} +1 -1
  34. package/dist/{getFaceInfo-BafgGT27.js → getFaceInfo-D_tCSQC7.js} +1 -1
  35. package/dist/{index-DiIoHK_4.js → index-B9DdHE4u.js} +1 -1
  36. package/dist/{index-Cyk_VIZE.js → index-BaNlidsb.js} +279 -273
  37. package/dist/index-BzGLgXJm.cjs +46 -0
  38. package/dist/{index-iIQ9jBDb.js → index-CNt8esFO.js} +1 -1
  39. package/dist/{index-CKRN-xJp.js → index-CTqQJj5p.js} +1249 -1175
  40. package/dist/{index-ItufYyHH.cjs → index-CelqbDSR.cjs} +1 -1
  41. package/dist/index-Cm3v6Dlg.cjs +21 -0
  42. package/dist/{index-vr2ichWQ.js → index-D10O6vqR.js} +2 -2
  43. package/dist/{index-S3gqudT6.cjs → index-DIYaENN3.cjs} +1 -1
  44. package/dist/{index-CUldCMRl.js → index-DlP4xxaT.js} +1 -1
  45. package/dist/{index-D-4w34GO.cjs → index-DzdKBXGE.cjs} +1 -1
  46. package/dist/index-J3Qy6hi3.cjs +1 -0
  47. package/dist/{index-By_LCo2V.cjs → index-LC2Xs08E.cjs} +1 -1
  48. package/dist/{index-BZoBxyLn.js → index-bL819L-K.js} +387 -375
  49. package/dist/instructions.cjs +1 -1
  50. package/dist/instructions.js +8 -8
  51. package/dist/{internal-Bb9ZXbpr.cjs → internal-DS8Pdlsm.cjs} +1 -1
  52. package/dist/{internal-Gt1wn6Z3.js → internal-TD4QhIry.js} +3 -3
  53. package/dist/internal.cjs +1 -1
  54. package/dist/internal.js +2 -2
  55. package/dist/{landmarks-BEjJXcnE.cjs → landmarks-BP6RbRHN.cjs} +1 -1
  56. package/dist/{landmarks-DtCAFV_m.js → landmarks-vLy5QKt6.js} +1 -1
  57. package/dist/low-level.cjs +1 -1
  58. package/dist/low-level.js +40 -40
  59. package/dist/main.cjs +1 -1
  60. package/dist/main.js +234 -230
  61. package/dist/particles.cjs +1 -1
  62. package/dist/particles.js +5 -5
  63. package/dist/product.cjs +1 -1
  64. package/dist/product.js +2 -2
  65. package/dist/{providers-CEZQgz2s.cjs → providers-BRSbw214.cjs} +1 -1
  66. package/dist/{providers-CRuaD8bi.js → providers-DmJlgrDD.js} +3 -3
  67. package/dist/{renderGroups-BADrepA1.cjs → renderGroups-B0N58SIA.cjs} +1 -1
  68. package/dist/{renderGroups-CNB99dZ2.js → renderGroups-BcQYy_J2.js} +1 -1
  69. package/dist/{renderPasses-DgxUKn9b.cjs → renderPasses-Bt8k0dkm.cjs} +1 -1
  70. package/dist/{renderPasses-DuapJA6V.js → renderPasses-DIPTIU_x.js} +4 -4
  71. package/dist/scene-object.cjs +1 -1
  72. package/dist/scene-object.js +2 -2
  73. package/dist/screen2d/coordinates.d.ts +37 -0
  74. package/dist/{segmentation-BOZJdWFC.js → segmentation-CZs5aVvY.js} +1 -1
  75. package/dist/{segmentation-J8GoNBvP.cjs → segmentation-Cz7oeNcS.cjs} +1 -1
  76. package/dist/{selectors-QB2qsaxy.cjs → selectors-Bq6tSgOY.cjs} +1 -1
  77. package/dist/{selectors-BvJepq6H.js → selectors-K5JKCWxw.js} +1 -1
  78. package/dist/{session-BVX859as.cjs → session-3aCMNb8W.cjs} +1 -1
  79. package/dist/{session-Cz8aie4K.js → session-DHBNTyJJ.js} +1 -1
  80. package/dist/tracking.cjs +1 -1
  81. package/dist/tracking.js +75 -75
  82. package/dist/{trigger-D9L4GPmQ.js → trigger-BwZ81ENx.js} +7 -7
  83. package/dist/{trigger-DZ9vU7jo.cjs → trigger-UjeJY5uh.cjs} +1 -1
  84. package/dist/{useBodies-BYzJpQ4L.js → useBodies-BMKHXAOL.js} +2 -2
  85. package/dist/{useBodies-Cxpmx6Bb.cjs → useBodies-CXomEo0i.cjs} +1 -1
  86. package/dist/useEditOverrides-BTkPGVjN.js +38 -0
  87. package/dist/useEditOverrides-C3ZVXuIH.cjs +1 -0
  88. package/dist/{useFaceInfo-DlLRAVNw.cjs → useFaceInfo-BEMMiZxw.cjs} +1 -1
  89. package/dist/{useFaceInfo-BzEUj2OI.js → useFaceInfo-BNVdnprN.js} +4 -4
  90. package/dist/{useFaceResultReader-Cc4Qrutf.js → useFaceResultReader-B15wn6RB.js} +1 -1
  91. package/dist/{useFaceResultReader-D3jOQNKz.cjs → useFaceResultReader-D9qibKmm.cjs} +1 -1
  92. package/dist/{useIrisTracking-Bz4uLDa7.js → useIrisTracking-CYm-KDIZ.js} +10 -10
  93. package/dist/{useIrisTracking-DRGWgoNy.cjs → useIrisTracking-DExhnhlt.cjs} +1 -1
  94. package/dist/{useXRCapabilities-B1KLckqw.js → useXRCapabilities-ClWlG5_Y.js} +1 -1
  95. package/dist/{useXRCapabilities-CZlPUBjF.cjs → useXRCapabilities-D-EhcDzM.cjs} +1 -1
  96. package/dist/utils/useEditOverrides.d.ts +33 -0
  97. package/docs/api/face-info.mdx +1 -1
  98. package/docs/api/screen-space-coordinates.mdx +17 -9
  99. package/docs/api/session-lifecycle.mdx +29 -0
  100. package/package.json +1 -1
  101. package/settings.json +64 -13
  102. package/dist/TextLabel-XE0rQSDn.cjs +0 -2
  103. package/dist/index-C-Mryx_u.cjs +0 -21
  104. package/dist/index-Dv3WnY9n.cjs +0 -46
  105. package/dist/index-Sho4F4it.cjs +0 -1
package/dist/debug-ui.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Oe=require("./session-BVX859as.cjs"),Hs=require("./debug-ui/default-setting.cjs"),e=require("react/jsx-runtime"),y=require("react"),Le=require("./renderGroups-BADrepA1.cjs"),K=require("./index-C-Mryx_u.cjs"),Ae=require("react-dom"),$e=require("./index-Sho4F4it.cjs"),Gs=require("three"),J=require("./renderPasses-DgxUKn9b.cjs"),Ne=require("./settings-C63FMBlF.cjs"),N=require("./FaceRetouch-D7kryDE6.cjs"),It=require("./landmarkMask-CvN-L5NT.cjs"),_s=require("./index-D-4w34GO.cjs"),Us=require("./index-By_LCo2V.cjs"),Zt=require("@react-three/drei"),Xs=require("@react-three/fiber"),Yt=require("./index-Dv3WnY9n.cjs"),Zs=require("./contexts-DQc7zyqT.cjs"),Ys=require("./selectors-QB2qsaxy.cjs"),qs={position:"fixed",zIndex:2e4,pointerEvents:"none"},kt={width:"100%",maxHeight:"none",border:"none",borderRadius:0,background:"transparent",boxShadow:"none",backdropFilter:"none",WebkitBackdropFilter:"none",overflow:"visible"},js=({docked:t=!1,initialPosition:s,position:l,onPositionChange:n})=>{const[a,d]=y.useState(s),r=l??a,o=y.useRef(null),h=y.useRef(n);return h.current=n,y.useEffect(()=>{if(t)return;const p=g=>{var j;const i=o.current;if(!i)return;const u={x:Math.max(8,g.clientX-i.x),y:Math.max(8,g.clientY-i.y)};d(u),(j=h.current)==null||j.call(h,u)},f=()=>{const g=o.current;g&&(o.current=null,g.selectNone&&document.body.classList.remove("select-none"))};return window.addEventListener("pointermove",p),window.addEventListener("pointerup",f),()=>{window.removeEventListener("pointermove",p),window.removeEventListener("pointerup",f)}},[t]),{docked:t,position:r,startDrag:(p,{capture:f=!0,selectNone:g=!0}={})=>{if(t)return;const i=p.currentTarget.getBoundingClientRect();o.current={x:p.clientX-i.left,y:p.clientY-i.top,selectNone:g},g&&document.body.classList.add("select-none"),f&&p.currentTarget.setPointerCapture(p.pointerId)},place:p=>t?p:typeof document>"u"?null:Ae.createPortal(e.jsx("div",{style:{...qs,left:r.x,top:r.y},children:p}),document.body)}},qt={pointerEvents:"auto",width:306,maxHeight:"calc(100vh - 124px)",borderRadius:16,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(8, 15, 28, 0.58)",boxShadow:"0 16px 36px rgba(0,0,0,0.28)",backdropFilter:"blur(20px) saturate(1.1)",WebkitBackdropFilter:"blur(20px) saturate(1.1)",color:"#f8fafc",overflow:"hidden"},Js=306,Qs=()=>({x:typeof window>"u"?14:window.innerWidth-(Js+20),y:30}),en={display:"grid",gap:7,padding:"7px 8px 8px",borderBottom:"1px solid rgba(255,255,255,0.08)",background:"rgba(8, 15, 28, 0.88)"},ms={display:"grid",gridTemplateColumns:"16px 22px minmax(0, 1fr) 28px",alignItems:"center",gap:7},tn={...ms,gridTemplateColumns:"22px minmax(0, 1fr) 28px"},sn={display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:11,fontWeight:700},nn={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(125,211,252,0.46)",background:"rgba(15,23,42,0.82)",color:"#f8fafc",fontSize:11,fontWeight:700,outline:"none",padding:"0 7px",boxSizing:"border-box"},ln={display:"flex",width:20,height:20,alignItems:"center",justifyContent:"center",borderRadius:7,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.08)",color:"#e2e8f0"},on={width:16,height:18,display:"flex",alignItems:"center",justifyContent:"center",cursor:"grab",color:"rgba(148,163,184,0.82)"},Jt={display:"grid",gap:8,padding:8,overflowY:"auto",maxHeight:"calc(100vh - 215px)"},rn={display:"grid",gridTemplateColumns:"minmax(0, 1fr) 30px",gap:6},an={width:"100%",height:26,borderRadius:8,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(56,189,248,0.16)",color:"#e0f2fe",fontSize:10.5,fontWeight:700,cursor:"pointer"},dn=t=>({display:"inline-flex",alignItems:"center",justifyContent:"center",width:30,height:26,borderRadius:8,border:"1px solid rgba(255,255,255,0.10)",color:t?"#e0f2fe":"rgba(148,163,184,0.72)",background:t?"rgba(56,189,248,0.16)":"rgba(255,255,255,0.04)",cursor:"pointer",padding:0}),cn={display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:24,borderRadius:8,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.05)",color:"#e2e8f0",cursor:"pointer",padding:0},pn={width:"fit-content",maxWidth:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.07)",color:"#e2e8f0",fontSize:10,padding:"0 8px"},hn=()=>e.jsx("svg",{width:"11",height:"15",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M8 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 18a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 18a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})}),xn=()=>e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"m12 2 8 4.6v10.8L12 22l-8-4.6V6.6L12 2zm0 2.3L6.3 7.6 12 10.9l5.7-3.3L12 4.3zM6 9.3v6.9l5 2.9v-6.9L6 9.3zm12 0-5 2.9v6.9l5-2.9V9.3z"})}),un=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 5c5 0 8.7 4.2 10 7-1.3 2.8-5 7-10 7s-8.7-4.2-10-7c1.3-2.8 5-7 10-7zm0 2c-3.6 0-6.4 2.7-7.7 5 1.3 2.3 4.1 5 7.7 5s6.4-2.7 7.7-5C18.4 9.7 15.6 7 12 7zm0 2.5a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5z"})}),gn=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M3.3 2 22 20.7 20.7 22l-3.1-3.1A10.5 10.5 0 0 1 12 20c-5 0-8.7-4.2-10-7a16.4 16.4 0 0 1 4-4.9L2 3.3 3.3 2zm4.1 7.5A14.4 14.4 0 0 0 4.3 13c1.3 2.3 4.1 5 7.7 5 1.5 0 2.8-.5 4-1.2l-2.1-2.1A2.5 2.5 0 0 1 9.3 10L7.4 9.5zM12 4c5 0 8.7 4.2 10 7a15 15 0 0 1-3.2 4.2l-1.4-1.4A13 13 0 0 0 19.7 11C18.4 8.7 15.6 6 12 6c-.9 0-1.8.2-2.6.5L7.8 4.9C9.1 4.3 10.5 4 12 4z"})}),yn=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M7 10h10v2H7v-2zm0 4h10v2H7v-2z"})}),bn=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M11 5h2v6h6v2h-6v6h-2v-6H5v-2h6V5z"})}),fn=async t=>{var l;if((l=navigator.clipboard)!=null&&l.writeText){await navigator.clipboard.writeText(t);return}const s=document.createElement("textarea");s.value=t,s.setAttribute("readonly",""),s.style.position="fixed",s.style.left="-9999px",document.body.appendChild(s),s.select(),document.execCommand("copy"),document.body.removeChild(s)},Ct=({children:t,copyConfig:s,docked:l=!1,initialPosition:n,layer:a="Default Layer",objectId:d,objectName:r,onObjectNameChange:o,onPositionChange:h,onVisibleChange:x,position:c,title:p,visible:f})=>{const{startDrag:g,place:i}=js({docked:l,initialPosition:n??Qs,position:c,onPositionChange:h}),[u,j]=y.useState(!1),[w,v]=y.useState(!0),M=r??p??d??"Scene Object",[U,b]=y.useState(!1),[F,E]=y.useState(M);y.useEffect(()=>{U||E(M)},[M,U]);const P=async()=>{try{await fn(JSON.stringify(s,null,2)),j(!0),window.setTimeout(()=>j(!1),1200)}catch{j(!1)}},le=()=>{const L=F.trim();if(b(!1),!o||!L||L===M){E(M);return}o(L)},ae=()=>{E(M),b(!1)};return i(e.jsxs("div",{style:l?{...qt,...kt}:qt,children:[e.jsxs("div",{style:en,children:[e.jsxs("div",{style:l?tn:ms,children:[!l&&e.jsx("div",{onPointerDown:g,style:on,children:e.jsx(hn,{})}),e.jsx("span",{style:ln,children:e.jsx(xn,{})}),U?e.jsx("input",{autoFocus:!0,"aria-label":"Object Name",style:nn,value:F,onBlur:le,onChange:L=>E(L.currentTarget.value),onKeyDown:L=>{L.key==="Enter"&&le(),L.key==="Escape"&&ae()}}):e.jsx("button",{type:"button",style:{...sn,padding:0,border:0,background:"transparent",color:"inherit",cursor:o?"text":"default",textAlign:"left"},onDoubleClick:()=>{o&&b(!0)},children:M}),e.jsx("button",{type:"button","aria-label":w?"Fold Inspector":"Expand Inspector",title:w?"Fold Inspector":"Expand Inspector",style:cn,onClick:()=>v(L=>!L),children:w?e.jsx(yn,{}):e.jsx(bn,{})})]}),w?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",style:pn,children:a}),e.jsxs("div",{style:rn,children:[e.jsx("button",{type:"button",style:an,onClick:P,children:u?"Copied Config":"Copy Config"}),e.jsx("button",{type:"button",style:dn(f),onClick:()=>x(!f),children:f?e.jsx(un,{}):e.jsx(gn,{})})]})]}):null]}),w?e.jsx("div",{style:l?{...Jt,maxHeight:"none"}:Jt,children:t}):null]}))},jn={clean:{fontWeight:400,strokeLayers:[],shadowLayers:[]},sticker:{color:"#101828",fontWeight:800,strokeLayers:[{color:"#ffffff",width:26,opacity:1},{color:"#101828",width:10,opacity:1}],shadowLayers:[]},"shadow-pop":{color:"#fff8df",fontWeight:800,strokeLayers:[{color:"#101828",width:12,opacity:1}],shadowLayers:[{color:"#0f172a",blur:0,offsetX:18,offsetY:18,opacity:.9},{color:"#0f172a",blur:10,offsetX:10,offsetY:10,opacity:.35}]},neon:{color:"#ffffff",fontWeight:700,strokeLayers:[{color:"#9be7ff",width:8,opacity:.9}],shadowLayers:[{color:"#38bdf8",blur:18,opacity:.8},{color:"#0ea5e9",blur:40,opacity:.7},{color:"#7c3aed",blur:70,opacity:.5}]},editorial:{color:"#f8fafc",fontWeight:500,strokeLayers:[{color:"#0f172a",width:4,opacity:.5}],shadowLayers:[]},"comic-burst":{color:"#fff06a",fontWeight:900,strokeLayers:[{color:"#ef4444",width:28,opacity:1},{color:"#111827",width:12,opacity:1}],shadowLayers:[{color:"#111827",blur:0,offsetX:12,offsetY:12,opacity:.65}]},"ice-outline":{color:"#eff8ff",fontWeight:800,strokeLayers:[{color:"#dbeafe",width:16,opacity:1},{color:"#1d4ed8",width:6,opacity:.95}],shadowLayers:[{color:"#38bdf8",blur:24,opacity:.32}]},"sunset-glow":{color:"#fff7ed",fontWeight:800,strokeLayers:[{color:"#fb7185",width:8,opacity:.95}],shadowLayers:[{color:"#fb7185",blur:18,opacity:.7},{color:"#f97316",blur:42,opacity:.55},{color:"#facc15",blur:70,opacity:.28}]},cutout:{color:"#fffaf0",fontWeight:800,strokeLayers:[{color:"#0f172a",width:6,opacity:.9}],shadowLayers:[{color:"#0f172a",blur:0,offsetX:8,offsetY:8,opacity:.95},{color:"#0f172a",blur:0,offsetX:16,offsetY:16,opacity:.4}]},"badge-arc":{color:"#ffffff",fontWeight:900,outlineEnabled:!0,shadowEnabled:!0,glowEnabled:!1,innerShadowEnabled:!1,bendEnabled:!0,bend:{preset:"arc",strength:100},strokeLayers:[{color:"#0b1020",width:24,opacity:1},{color:"#ffffff",width:8,opacity:1}],shadowLayers:[{color:"#020617",blur:8,offset:10,angle:-45,feather:.2,opacity:.65}]},"chrome-bulge":{color:"#f8fafc",fontWeight:900,outlineEnabled:!0,shadowEnabled:!1,glowEnabled:!0,innerShadowEnabled:!0,bendEnabled:!0,bend:{preset:"bulge",strength:100},glow:{color:"#dbeafe",style:"contoured",intensity:.55,range:.35,horizontalAngle:0,verticalAngle:0},innerShadow:{color:"#64748b",opacity:.9,offset:16,angle:-45,feather:.25},strokeLayers:[{color:"#0f172a",width:5,opacity:.9}],shadowLayers:[]},"retro-wave":{color:"#fffbeb",fontWeight:900,outlineEnabled:!0,shadowEnabled:!0,glowEnabled:!0,innerShadowEnabled:!1,bendEnabled:!0,bend:{preset:"wave",strength:100},glow:{color:"#fb7185",style:"outward",intensity:.65,range:.55,horizontalAngle:0,verticalAngle:0},strokeLayers:[{color:"#fb7185",width:12,opacity:1},{color:"#7c2d12",width:5,opacity:.9}],shadowLayers:[{color:"#7c2d12",blur:4,offset:14,angle:45,feather:.1,opacity:.75}]},"flag-pop":{color:"#ffffff",fontWeight:900,outlineEnabled:!0,shadowEnabled:!0,glowEnabled:!0,innerShadowEnabled:!1,bendEnabled:!0,bend:{preset:"flag",strength:100},glow:{color:"#38bdf8",style:"outward",intensity:.5,range:.45,horizontalAngle:.15,verticalAngle:-.1},strokeLayers:[{color:"#fde047",width:18,opacity:1},{color:"#111827",width:7,opacity:1}],shadowLayers:[{color:"#111827",blur:0,offset:14,angle:35,feather:0,opacity:.75}]},"fisheye-poster":{color:"#fff7ed",fontWeight:900,outlineEnabled:!0,shadowEnabled:!0,glowEnabled:!1,innerShadowEnabled:!0,bendEnabled:!0,bend:{preset:"fisheye",strength:100},innerShadow:{color:"#92400e",opacity:.55,offset:10,angle:-45,feather:.15},strokeLayers:[{color:"#020617",width:24,opacity:1},{color:"#f97316",width:8,opacity:.9}],shadowLayers:[{color:"#020617",blur:0,offset:12,angle:40,feather:0,opacity:.8}]}},mn=[{label:"Space Grotesk",value:'"Space Grotesk", sans-serif'},{label:"Bebas Neue",value:'"Bebas Neue", sans-serif'},{label:"DM Serif Display",value:'"DM Serif Display", serif'},{label:"Caveat",value:'"Caveat", cursive'}],Sn=["clean","sticker","shadow-pop","neon","editorial","comic-burst","ice-outline","sunset-glow","cutout","badge-arc","chrome-bulge","retro-wave","flag-pop","fisheye-poster"],vn={clean:"NONE",sticker:"sticker","shadow-pop":"shadow-pop",neon:"neon",editorial:"editorial","comic-burst":"comic-burst","ice-outline":"ice-outline","sunset-glow":"sunset-glow",cutout:"cutout","badge-arc":"badge-arc","chrome-bulge":"chrome-bulge","retro-wave":"retro-wave","flag-pop":"flag-pop","fisheye-poster":"fisheye-poster"},wn=()=>({color:"#000000",opacity:1,width:30}),Bt=()=>({color:"#000000",opacity:1,offset:10,angle:-45,feather:0,blur:0,offsetX:7.071,offsetY:-7.071}),Ss=()=>({color:"#ffffff",style:"outward",intensity:.5,range:.5,horizontalAngle:0,verticalAngle:0}),vs=()=>({preset:"arc",strength:100}),kn=[{label:"Arc",value:"arc"},{label:"Arc Lower",value:"arc-lower"},{label:"Arc Upper",value:"arc-upper"},{label:"Arch",value:"arch"},{label:"Bulge",value:"bulge"},{label:"Shell Lower",value:"shell-lower"},{label:"Shell Upper",value:"shell-upper"},{label:"Flag",value:"flag"},{label:"Wave",value:"wave"},{label:"Fish",value:"fish"},{label:"Rise",value:"rise"},{label:"Fisheye",value:"fisheye"},{label:"Inflate",value:"inflate"},{label:"Squeeze",value:"squeeze"},{label:"Twist",value:"twist"}],Cn=(t,s)=>{const l=jn[s],n=l.strokeLayers??t.style.strokeLayers,a=l.shadowLayers??t.style.shadowLayers;return{...t,textArtPreset:s,style:{...t.style,...l,fontWeight:t.style.bold?"bold":l.fontWeight??t.style.fontWeight,background:{...t.style.background,...l.background},outlineEnabled:l.strokeLayers?l.strokeLayers.length>0:t.style.outlineEnabled,shadowEnabled:l.shadowLayers?l.shadowLayers.length>0:t.style.shadowEnabled,strokeLayers:n,shadowLayers:a}}},ws=(t,s)=>({enabled:(s==null?void 0:s.enabled)??t.enabled,showGuides:(s==null?void 0:s.showTransformGuides)??t.showTransformGuides,coordinateSpace:t.coordinateSpace,canvasSize:t.canvasSize,position:(s==null?void 0:s.position)??t.position,size:(s==null?void 0:s.size)??t.size,rotation:(s==null?void 0:s.rotation)??t.rotation,scale2D:s==null?void 0:s.scale2D,referencePixelsPerUnit:s==null?void 0:s.referencePixelsPerUnit,pivot:(s==null?void 0:s.pivot)??t.pivot,renderOrder:(s==null?void 0:s.renderOrder)??t.renderOrder,overlay:(s==null?void 0:s.overlay)??t.overlay,visible:(s==null?void 0:s.visible)??t.visible}),Rn=(t,s)=>({...s,enabled:t.enabled,showTransformGuides:t.showGuides,coordinateSpace:t.coordinateSpace,canvasSize:t.canvasSize,position:t.position,size:t.size,rotation:t.rotation,pivot:t.pivot,renderOrder:t.renderOrder,overlay:t.overlay,visible:t.visible}),ks=(t,s)=>({...$e.DEFAULT_SCREEN_TRANSFORM_2D,...s,enabled:t.enabled,showTransformGuides:t.showGuides,position:t.position,size:t.size,rotation:t.rotation,scale2D:t.scale2D??(s==null?void 0:s.scale2D)??$e.DEFAULT_SCREEN_TRANSFORM_2D.scale2D,referencePixelsPerUnit:t.referencePixelsPerUnit??(s==null?void 0:s.referencePixelsPerUnit)??$e.DEFAULT_SCREEN_TRANSFORM_2D.referencePixelsPerUnit,pivot:t.pivot,renderOrder:t.renderOrder,overlay:t.overlay,visible:t.visible}),In={display:"flex",width:18,height:18,alignItems:"center",justifyContent:"center",borderRadius:6,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.08)",color:"#e2e8f0",flex:"0 0 auto"},En={borderRadius:12,border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.03)",overflow:"hidden"},Tn={display:"flex",alignItems:"center",gap:7,padding:"6px 7px"},zn={display:"flex",alignItems:"center",gap:6,fontSize:11,fontWeight:500,flex:"1 1 auto",minWidth:0},Mn={width:28,height:16,borderRadius:999,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.08)",padding:2,display:"flex",alignItems:"center",cursor:"pointer",flex:"0 0 auto"},Fn=t=>({width:10,height:10,borderRadius:999,background:t?"#f8fafc":"rgba(148,163,184,0.7)",transform:t?"translateX(12px)":"translateX(0)",transition:"transform 140ms ease, background 140ms ease"}),Wn={display:"grid",gap:7,padding:"0 7px 7px"},me={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},k={display:"flex",flexDirection:"column",gap:4},ee={...k,gridColumn:"1 / -1"},Ln={gridColumn:"1 / -1",display:"grid",gap:6,padding:"8px 8px 2px 12px",marginTop:-2,borderLeft:"1px solid rgba(255,255,255,0.10)"},$n={display:"flex",alignItems:"center",justifyContent:"space-between",gap:6,width:"100%",padding:0,border:0,background:"transparent",fontSize:9,color:"rgba(226,232,240,0.64)",textTransform:"uppercase",cursor:"pointer"},Nn={display:"flex",alignItems:"center",gap:6,minWidth:0},On={width:16,height:16,borderRadius:999,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"rgba(255,255,255,0.06)",color:"rgba(226,232,240,0.72)",flex:"0 0 auto"},S={fontSize:9,color:"rgba(226,232,240,0.72)"},Kt={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},An={...Kt,height:72,padding:"7px",resize:"vertical",lineHeight:1.35,fontFamily:"inherit"},je={...Kt,padding:2,cursor:"pointer"},xe={...Kt,appearance:"none"},Pn={opacity:.45,cursor:"not-allowed"},ue={display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:24},gt={width:16,height:16},Dn={display:"grid",gridTemplateColumns:"1.25fr repeat(4, 1fr)",gap:4,width:"100%"},Je=t=>({height:26,borderRadius:8,border:t?"1px solid rgba(125,211,252,0.72)":"1px solid rgba(255,255,255,0.10)",background:t?"rgba(56,189,248,0.20)":"rgba(255,255,255,0.05)",color:t?"#f0f9ff":"#e2e8f0",fontSize:10.5,fontWeight:700,cursor:"pointer",padding:"0 6px"}),wt={display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:8,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.05)",color:"#e2e8f0",cursor:"pointer",padding:0,flex:"0 0 auto"};function Bn({label:t,icon:s,open:l,onToggle:n,children:a}){return e.jsxs("div",{style:En,children:[e.jsxs("div",{style:Tn,children:[e.jsx("button",{type:"button",onClick:n,style:Mn,children:e.jsx("div",{style:Fn(l)})}),e.jsxs("div",{style:zn,children:[e.jsx("span",{style:In,children:s}),e.jsx("span",{children:t})]})]}),l?e.jsx("div",{style:Wn,children:a}):null]})}const Qt=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M4 6V4h16v2h-7v14h-2V6H4z"})}),es=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 3a9 9 0 1 0 0 18h1.2a2.8 2.8 0 0 0 0-5.6h-.4a1.8 1.8 0 0 1 0-3.6H16a5 5 0 0 0 0-10h-4zm-4 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm1 5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm6-7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z"})}),Vn=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M4 4h6v2H7.4l3.3 3.3-1.4 1.4L6 7.4V10H4V4zm10 0h6v6h-2V7.4l-3.3 3.3-1.4-1.4L16.6 6H14V4zM9.3 13.3l1.4 1.4L7.4 18H10v2H4v-6h2v2.6l3.3-3.3zm5.4 0 3.3 3.3V14h2v6h-6v-2h2.6l-3.3-3.3 1.4-1.4z"})}),Kn=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M7 5h10v2H9v6h8v2H7V5zm4 8h6v6h-6v-2h4v-2h-4v-2z"})});function Hn({value:t,onChange:s}){return e.jsxs("div",{style:me,children:[e.jsxs("label",{style:ee,children:[e.jsx("span",{style:S,children:"Text"}),e.jsx("textarea",{style:An,value:t.content.text,onChange:l=>s(n=>({...n,content:{...n.content,text:l.target.value}}))})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Text Art"}),e.jsx("select",{style:xe,value:t.textArtPreset,onChange:l=>s(n=>Cn(n,l.target.value)),children:Sn.map(l=>e.jsx("option",{value:l,children:vn[l]},l))})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Font"}),e.jsx("select",{style:xe,value:t.style.fontFamily,onChange:l=>s(n=>({...n,style:{...n.style,fontFamily:l.target.value}})),children:mn.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))})]})]})}const Gn={width:"100%",boxSizing:"border-box",border:"1px solid rgba(148,163,184,0.22)",borderRadius:8,background:"rgba(15,23,42,0.8)",color:"#e2e8f0",padding:"7px 9px"},_n=t=>/^-?\d*(\.\d*)?$/.test(t),z=({value:t,onChange:s,step:l=1,min:n,max:a,disabled:d=!1})=>{const[r,o]=y.useState(String(t));y.useEffect(()=>o(String(t)),[t]);const h=x=>Math.min(typeof a=="number"?a:1/0,Math.max(typeof n=="number"?n:-1/0,x));return e.jsx("input",{type:"text",inputMode:"decimal",pattern:"-?[0-9]*[.,]?[0-9]*",style:{...Gn,...d?{cursor:"not-allowed",opacity:.45}:{}},value:r,disabled:d,onChange:x=>{if(d)return;const c=x.target.value;if(!_n(c)||(o(c),["","-",".","-."].includes(c)))return;const p=Number(c);Number.isNaN(p)||s(h(p))},onBlur:()=>{if(d)return;const x=Number(r);if(Number.isNaN(x))return o(String(t));const c=h(x);o(String(c)),s(c)},onKeyDown:x=>{if(d||x.key!=="ArrowUp"&&x.key!=="ArrowDown")return;x.preventDefault();const c=x.shiftKey?l*10:x.altKey?l/10:l,p=x.key==="ArrowUp"?t+c:t-c;s(h(Number.isInteger(p)?p:Number(p.toFixed(6))))}})};function Un({background:t,onChange:s}){return e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Fill Mode"}),e.jsxs("select",{style:xe,value:t.fillMode,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,fillMode:l.target.value}}})),children:[e.jsx("option",{value:"solid",children:"solid"}),e.jsx("option",{value:"gradient",children:"gradient"})]})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Fill Area"}),e.jsxs("select",{style:xe,value:t.fit,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,fit:l.target.value}}})),children:[e.jsx("option",{value:"text",children:"text"}),e.jsx("option",{value:"full",children:"full"})]})]}),t.fillMode==="solid"?e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Background Color"}),e.jsx("input",{style:je,type:"color",value:t.color,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,color:l.target.value}}}))})]}):e.jsx("div",{style:{gridColumn:"1 / -1",display:"grid",gap:6},children:t.gradientStops.slice(0,3).map((l,n)=>e.jsxs("label",{style:k,children:[e.jsxs("span",{style:S,children:["Gradient ",n+1]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 60px",gap:4},children:[e.jsx("input",{style:je,type:"color",value:l.color,onChange:a=>s(d=>{const r=[...d.style.background.gradientStops];return r[n]={...r[n],color:a.target.value},{...d,style:{...d.style,background:{...d.style.background,gradientStops:r}}}})}),e.jsx(z,{value:l.position,min:0,max:1,step:.05,onChange:a=>s(d=>{const r=[...d.style.background.gradientStops];return r[n]={...r[n],position:a},{...d,style:{...d.style,background:{...d.style.background,gradientStops:r}}}})})]})]},n))}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Background Opacity"}),e.jsx(z,{value:t.opacity,min:0,max:1,step:.05,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,opacity:l}}}))})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Corner Radius"}),e.jsx(z,{value:t.borderRadius,min:0,max:200,step:2,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,borderRadius:l}}}))})]})]})}function Xn({background:t,onChange:s}){return e.jsxs(e.Fragment,{children:[e.jsx("label",{style:ee,children:e.jsxs("div",{style:ue,children:[e.jsx("span",{style:S,children:"Auto Width / Height"}),e.jsx("input",{type:"checkbox",style:gt,checked:t.autoSize,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,autoSize:l.target.checked}}}))})]})}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Width"}),e.jsx(z,{value:t.width,min:32,max:1024,step:8,disabled:t.autoSize,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,width:l}}}))})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Height"}),e.jsx(z,{value:t.height,min:32,max:1024,step:8,disabled:t.autoSize,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,height:l}}}))})]})]})}function Zn({background:t,onChange:s}){return e.jsxs(e.Fragment,{children:[e.jsx("label",{style:ee,children:e.jsxs("div",{style:ue,children:[e.jsx("span",{style:S,children:"Background Stroke"}),e.jsx("input",{type:"checkbox",style:gt,checked:t.borderEnabled,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,borderEnabled:l.target.checked,borderColor:l.target.checked&&n.style.background.borderColor==="transparent"?"#ffffff":n.style.background.borderColor,borderWidth:l.target.checked?Math.max(n.style.background.borderWidth,2):n.style.background.borderWidth}}}))})]})}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Stroke Color"}),e.jsx("input",{style:{...je,...t.borderEnabled?{}:Pn},type:"color",value:t.borderColor,disabled:!t.borderEnabled,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,borderColor:l.target.value}}}))})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Stroke Width"}),e.jsx(z,{value:t.borderWidth,min:0,max:64,step:1,disabled:!t.borderEnabled,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,borderWidth:l}}}))})]})]})}const Cs={gridColumn:"1 / -1",display:"grid",gap:6,padding:"8px",borderRadius:10,border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.03)"};function yt({checked:t,label:s,onChange:l}){return e.jsx("label",{style:ee,children:e.jsxs("div",{style:ue,children:[e.jsx("span",{style:S,children:s}),e.jsx("input",{type:"checkbox",style:gt,checked:t,onChange:n=>l(n.target.checked)})]})})}function Xe({children:t,label:s,open:l,setOpen:n}){return e.jsxs("div",{style:Ln,children:[e.jsxs("button",{type:"button",style:$n,onClick:()=>n(a=>!a),children:[e.jsxs("span",{style:Nn,children:[e.jsx(Kn,{}),e.jsx("span",{children:s})]}),e.jsx("span",{style:On,children:l?"−":"+"})]}),l?t:null]})}function Yn({value:t,onChange:s,open:l,setOpen:n}){const a=t.style.background;return e.jsxs(e.Fragment,{children:[e.jsx("label",{style:ee,children:e.jsxs("div",{style:ue,children:[e.jsx("span",{style:S,children:"Background Enabled"}),e.jsx("input",{type:"checkbox",style:gt,checked:a.enabled,onChange:d=>s(r=>({...r,style:{...r.style,background:{...r.style.background,enabled:d.target.checked}}}))})]})}),a.enabled?e.jsx(Xe,{label:"Background Settings",open:l,setOpen:n,children:e.jsxs(e.Fragment,{children:[e.jsx(Un,{background:a,onChange:s}),e.jsx(Zn,{background:a,onChange:s}),e.jsx(Xn,{background:a,onChange:s})]})}):null]})}function qn({bend:t,open:s,onChange:l,setOpen:n,value:a}){const d=r=>l(o=>({...o,style:{...o.style,bend:{...o.style.bend??t,...r}}}));return e.jsxs(e.Fragment,{children:[e.jsx(yt,{label:"Bend",checked:a.style.bendEnabled===!0,onChange:r=>l(o=>({...o,style:{...o.style,bendEnabled:r,bend:o.style.bend??vs()}}))}),a.style.bendEnabled===!0?e.jsx(Xe,{label:"Bend",open:s,setOpen:n,children:e.jsxs("div",{style:me,children:[e.jsxs("label",{style:ee,children:[e.jsx("span",{style:S,children:"Bend Preset"}),e.jsx("select",{style:xe,value:t.preset,onChange:r=>d({preset:r.target.value}),children:kn.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))})]}),e.jsxs("label",{style:ee,children:[e.jsx("span",{style:S,children:"Bend Strength"}),e.jsx(z,{value:t.strength,min:-100,max:100,step:1,onChange:r=>d({strength:r})})]})]})}):null]})}function Jn({glow:t,open:s,onChange:l,setOpen:n,value:a}){const d=r=>l(o=>({...o,style:{...o.style,glow:{...o.style.glow??t,...r}}}));return e.jsxs(e.Fragment,{children:[e.jsx(yt,{label:"Glow",checked:a.style.glowEnabled===!0,onChange:r=>l(o=>({...o,style:{...o.style,glowEnabled:r,glow:o.style.glow??Ss()}}))}),a.style.glowEnabled===!0?e.jsx(Xe,{label:"Glow",open:s,setOpen:n,children:e.jsxs("div",{style:me,children:[e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Color"}),e.jsx("input",{style:je,type:"color",value:t.color,onChange:r=>d({color:r.target.value})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Style"}),e.jsxs("select",{style:xe,value:t.style,onChange:r=>d({style:r.target.value}),children:[e.jsx("option",{value:"outward",children:"Outward"}),e.jsx("option",{value:"contoured",children:"Contoured"})]})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Intensity"}),e.jsx(z,{value:t.intensity??.5,min:0,max:1,step:.05,onChange:r=>d({intensity:r})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Range"}),e.jsx(z,{value:t.range??.5,min:0,max:1,step:.05,onChange:r=>d({range:r})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Horizontal Angle"}),e.jsx(z,{value:t.horizontalAngle??0,min:-.5,max:.5,step:.05,onChange:r=>d({horizontalAngle:r})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Vertical Angle"}),e.jsx(z,{value:t.verticalAngle??0,min:-.5,max:.5,step:.05,onChange:r=>d({verticalAngle:r})})]})]})}):null]})}const Qn={color:"#000000",opacity:1,offset:10,angle:-45,feather:0};function el({innerShadow:t,open:s,onChange:l,setOpen:n,value:a}){const d=r=>l(o=>({...o,style:{...o.style,innerShadow:{...o.style.innerShadow??t,...r}}}));return e.jsxs(e.Fragment,{children:[e.jsx(yt,{label:"Inner Shadow",checked:a.style.innerShadowEnabled===!0,onChange:r=>l(o=>({...o,style:{...o.style,innerShadowEnabled:r,innerShadow:o.style.innerShadow??Qn}}))}),a.style.innerShadowEnabled===!0?e.jsx(Xe,{label:"Inner Shadow",open:s,setOpen:n,children:e.jsxs("div",{style:me,children:[e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Shadow Color"}),e.jsx("input",{style:je,type:"color",value:t.color,onChange:r=>d({color:r.target.value})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Shadow Opacity"}),e.jsx(z,{value:t.opacity??1,min:0,max:1,step:.05,onChange:r=>d({opacity:r})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Shadow Offset"}),e.jsx(z,{value:t.offset??10,min:0,max:100,step:1,onChange:r=>d({offset:r})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Shadow Angle"}),e.jsx(z,{value:t.angle??-45,min:-180,max:180,step:1,onChange:r=>d({angle:r})})]}),e.jsxs("label",{style:ee,children:[e.jsx("span",{style:S,children:"Shadow Feather"}),e.jsx(z,{value:t.feather??0,min:0,max:1,step:.05,onChange:r=>d({feather:r})})]})]})}):null]})}function tl({layers:t,open:s,onChange:l,setOpen:n,value:a}){const d=(r,o)=>l(h=>{const x=[...h.style.strokeLayers??[]];return x[r]={...x[r],...o},{...h,style:{...h.style,strokeLayers:x}}});return e.jsxs(e.Fragment,{children:[e.jsx(yt,{label:"Outline",checked:a.style.outlineEnabled!==!1,onChange:r=>l(o=>({...o,style:{...o.style,outlineEnabled:r}}))}),a.style.outlineEnabled!==!1?e.jsx(Xe,{label:"Outline Editor",open:s,setOpen:n,children:e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{...ue,gridColumn:"1 / -1"},children:[e.jsxs("span",{style:S,children:["Layers: ",t.length]}),e.jsx("button",{type:"button",style:wt,onClick:()=>l(r=>({...r,style:{...r.style,strokeLayers:[...r.style.strokeLayers??[],wn()]}})),children:"+"})]}),t.length>0?t.map((r,o)=>e.jsxs("div",{style:Cs,children:[e.jsxs("div",{style:ue,children:[e.jsxs("span",{style:S,children:["Outline ",o+1]}),e.jsx("button",{type:"button",style:wt,onClick:()=>l(h=>({...h,style:{...h.style,strokeLayers:(h.style.strokeLayers??[]).filter((x,c)=>c!==o)}})),children:"×"})]}),e.jsxs("div",{style:me,children:[e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Outline Color"}),e.jsx("input",{style:je,type:"color",value:r.color,onChange:h=>d(o,{color:h.target.value})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Outline Opacity"}),e.jsx(z,{value:r.opacity??1,min:0,max:1,step:.05,onChange:h=>d(o,{opacity:h})})]}),e.jsxs("label",{style:ee,children:[e.jsx("span",{style:S,children:"Outline Size"}),e.jsx(z,{value:r.width,min:0,max:100,step:1,onChange:h=>d(o,{width:h})})]})]})]},o)):e.jsx("div",{style:{...S,gridColumn:"1 / -1"},children:"No outlines. Use `+` to add one."})]})}):null]})}function sl({layers:t,open:s,onChange:l,setOpen:n,value:a}){const d=(r,o)=>l(h=>{const x=[...h.style.shadowLayers??[]];return x[r]={...x[r],...o},{...h,style:{...h.style,shadowLayers:x}}});return e.jsxs(e.Fragment,{children:[e.jsx(yt,{label:"Outer Shadow",checked:a.style.shadowEnabled!==!1,onChange:r=>l(o=>{var h;return{...o,style:{...o.style,shadowEnabled:r,shadowLayers:r&&(((h=o.style.shadowLayers)==null?void 0:h.length)??0)===0?[Bt()]:o.style.shadowLayers}}})}),a.style.shadowEnabled!==!1?e.jsx(Xe,{label:"Shadow Editor",open:s,setOpen:n,children:e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{...ue,gridColumn:"1 / -1"},children:[e.jsxs("span",{style:S,children:["Layers: ",t.length]}),e.jsx("button",{type:"button",style:wt,onClick:()=>l(r=>({...r,style:{...r.style,shadowLayers:[...r.style.shadowLayers??[],Bt()]}})),children:"+"})]}),t.length>0?t.map((r,o)=>e.jsxs("div",{style:Cs,children:[e.jsxs("div",{style:ue,children:[e.jsxs("span",{style:S,children:["Shadow ",o+1]}),e.jsx("button",{type:"button",style:wt,onClick:()=>l(h=>({...h,style:{...h.style,shadowLayers:(h.style.shadowLayers??[]).filter((x,c)=>c!==o)}})),children:"×"})]}),e.jsxs("div",{style:me,children:[e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Shadow Color"}),e.jsx("input",{style:je,type:"color",value:r.color,onChange:h=>d(o,{color:h.target.value})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Shadow Opacity"}),e.jsx(z,{value:r.opacity??1,min:0,max:1,step:.05,onChange:h=>d(o,{opacity:h})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Shadow Offset"}),e.jsx(z,{value:r.offset??10,min:0,max:100,step:1,onChange:h=>d(o,{offset:h})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Shadow Angle"}),e.jsx(z,{value:r.angle??-45,min:-180,max:180,step:1,onChange:h=>d(o,{angle:h})})]}),e.jsxs("label",{style:ee,children:[e.jsx("span",{style:S,children:"Shadow Feather"}),e.jsx(z,{value:r.feather??0,min:0,max:1,step:.05,onChange:h=>d(o,{feather:h})})]})]})]},o)):e.jsx("div",{style:{...S,gridColumn:"1 / -1"},children:"No outer shadows. Use `+` to add one."})]})}):null]})}function nl({backgroundSettingsOpen:t,bend:s,bendSettingsOpen:l,glow:n,glowSettingsOpen:a,innerShadow:d,innerShadowSettingsOpen:r,onChange:o,outlineLayers:h,outlineSettingsOpen:x,setBackgroundSettingsOpen:c,setBendSettingsOpen:p,setGlowSettingsOpen:f,setInnerShadowSettingsOpen:g,setOutlineSettingsOpen:i,setShadowSettingsOpen:u,shadowLayers:j,shadowSettingsOpen:w,value:v}){return e.jsxs("div",{style:me,children:[e.jsx(tl,{value:v,onChange:o,layers:h,open:x,setOpen:i}),e.jsx(sl,{value:v,onChange:o,layers:j,open:w,setOpen:u}),e.jsx(el,{value:v,onChange:o,innerShadow:d,open:a,setOpen:f}),e.jsx(Jn,{value:v,onChange:o,glow:n,open:r,setOpen:g}),e.jsx(qn,{value:v,onChange:o,bend:s,open:l,setOpen:p}),e.jsx(Yn,{value:v,onChange:o,open:t,setOpen:c})]})}function ll({value:t,onChange:s}){const l=t.style.bold===!0||t.style.fontStyle==="italic"||t.style.underline===!0||t.style.strikethrough===!0;return e.jsxs("div",{style:me,children:[e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Text Color"}),e.jsx("input",{style:je,type:"color",value:t.style.color,onChange:n=>s(a=>({...a,style:{...a.style,color:n.target.value}}))})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Font Size"}),e.jsx(z,{value:t.style.fontSize,min:16,max:180,step:4,onChange:n=>s(a=>({...a,layout:{...a.layout,minFontSize:Math.min(a.layout.minFontSize??n,n)},style:{...a.style,fontSize:n}}))})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Letter Spacing"}),e.jsx(z,{value:t.style.letterSpacing,min:0,max:1,step:.05,onChange:n=>s(a=>({...a,style:{...a.style,letterSpacing:n}}))})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Line Spacing"}),e.jsx(z,{value:t.style.lineSpacing,min:0,max:1,step:.05,onChange:n=>s(a=>({...a,style:{...a.style,lineSpacing:n}}))})]}),e.jsxs("div",{style:ee,children:[e.jsx("span",{style:S,children:"Text Style"}),e.jsxs("div",{style:Dn,children:[e.jsx("button",{type:"button",style:Je(!l),onClick:()=>s(n=>({...n,style:{...n.style,bold:!1,fontWeight:n.style.fontWeight==="bold"?"normal":n.style.fontWeight,fontStyle:"normal",underline:!1,strikethrough:!1}})),children:"None"}),e.jsx("button",{type:"button",style:Je(t.style.bold===!0),onClick:()=>s(n=>({...n,style:{...n.style,bold:n.style.bold!==!0,fontWeight:n.style.bold!==!0?"bold":400}})),children:"B"}),e.jsx("button",{type:"button",style:Je(t.style.fontStyle==="italic"),onClick:()=>s(n=>({...n,style:{...n.style,fontStyle:n.style.fontStyle==="italic"?"normal":"italic"}})),children:"I"}),e.jsx("button",{type:"button",style:Je(t.style.underline===!0),onClick:()=>s(n=>({...n,style:{...n.style,underline:n.style.underline!==!0}})),children:"U"}),e.jsx("button",{type:"button",style:Je(t.style.strikethrough===!0),onClick:()=>s(n=>({...n,style:{...n.style,strikethrough:n.style.strikethrough!==!0}})),children:"S"})]})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Horizontal Alignment"}),e.jsxs("select",{style:xe,value:t.layout.textAlign??"center",onChange:n=>s(a=>({...a,layout:{...a.layout,textAlign:n.target.value}})),children:[e.jsx("option",{value:"left",children:"left"}),e.jsx("option",{value:"center",children:"center"}),e.jsx("option",{value:"right",children:"right"})]})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Vertical Alignment"}),e.jsxs("select",{style:xe,value:t.layout.verticalAlign??"center",onChange:n=>s(a=>({...a,layout:{...a.layout,verticalAlign:n.target.value}})),children:[e.jsx("option",{value:"top",children:"top"}),e.jsx("option",{value:"center",children:"center"}),e.jsx("option",{value:"bottom",children:"bottom"})]})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Overflow"}),e.jsxs("select",{style:xe,value:t.layout.overflow,onChange:n=>s(a=>({...a,layout:{...a.layout,overflow:n.target.value}})),children:[e.jsx("option",{value:"clip",children:"Clip text"}),e.jsx("option",{value:"ellipsis",children:"Show ellipsis"}),e.jsx("option",{value:"clamp",children:"Clamp"}),e.jsx("option",{value:"shrink",children:"Shrink"})]})]}),e.jsx("label",{style:ee,children:e.jsxs("div",{style:ue,children:[e.jsx("span",{style:S,children:"Resize To Fit"}),e.jsx("input",{type:"checkbox",style:gt,checked:t.layout.resizeToFit===!0,onChange:n=>s(a=>({...a,layout:{...a.layout,resizeToFit:n.target.checked}}))})]})})]})}const il={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},re={display:"flex",flexDirection:"column",gap:4},Et={...re,gridColumn:"1 / -1"},Y={fontSize:9,color:"rgba(226,232,240,0.72)"},ol={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},rl={...ol,fontVariantNumeric:"tabular-nums"},al={display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:24},dl={width:16,height:16},cl=t=>/^-?\d*(\.\d*)?$/.test(t),se=({value:t,onChange:s,step:l=1,min:n,max:a,disabled:d=!1})=>{const[r,o]=y.useState(String(t));y.useEffect(()=>o(String(t)),[t]);const h=x=>{let c=x;return typeof n=="number"&&(c=Math.max(n,c)),typeof a=="number"&&(c=Math.min(a,c)),c};return e.jsx("input",{type:"text",inputMode:"decimal",pattern:"-?[0-9]*[.,]?[0-9]*",style:rl,value:r,disabled:d,onChange:x=>{const c=x.target.value;if(!cl(c)||(o(c),c===""||c==="-"||c==="."||c==="-."))return;const p=Number(c);Number.isNaN(p)||s(h(p))},onBlur:()=>{const x=Number(r);if(Number.isNaN(x)){o(String(t));return}const c=h(x);o(String(c)),s(c)},onKeyDown:x=>{if(x.key!=="ArrowUp"&&x.key!=="ArrowDown")return;x.preventDefault();const c=x.shiftKey?l*10:x.altKey?l/10:l,p=x.key==="ArrowUp"?t+c:t-c;s(h(Number.isInteger(p)?p:Number(p.toFixed(6))))}})},Ht=({value:t,onChange:s,guideLabel:l,showRenderOrder:n=!0})=>{var a,d;return e.jsxs("div",{style:il,children:[e.jsxs("label",{style:re,children:[e.jsx("span",{style:Y,children:"Position X"}),e.jsx(se,{value:t.position.x,min:-4096,max:4096,step:1,onChange:r=>s({...t,position:{...t.position,x:r}})})]}),e.jsxs("label",{style:re,children:[e.jsx("span",{style:Y,children:"Position Y"}),e.jsx(se,{value:t.position.y,min:-4096,max:4096,step:1,onChange:r=>s({...t,position:{...t.position,y:r}})})]}),e.jsxs("label",{style:re,children:[e.jsx("span",{style:Y,children:"Size X"}),e.jsx(se,{value:t.size.width,min:0,max:8192,step:1,onChange:r=>s({...t,size:{...t.size,width:r}})})]}),e.jsxs("label",{style:re,children:[e.jsx("span",{style:Y,children:"Size Y"}),e.jsx(se,{value:t.size.height,min:0,max:8192,step:1,onChange:r=>s({...t,size:{...t.size,height:r}})})]}),e.jsxs("label",{style:Et,children:[e.jsx("span",{style:Y,children:"Rotation"}),e.jsx(se,{value:t.rotation,min:-360,max:360,step:1,onChange:r=>s({...t,rotation:r})})]}),e.jsxs("label",{style:re,children:[e.jsx("span",{style:Y,children:"Scale 2D X"}),e.jsx(se,{value:((a=t.scale2D)==null?void 0:a.x)??1,min:-10,max:10,step:.01,onChange:r=>{var o;return s({...t,scale2D:{x:r,y:((o=t.scale2D)==null?void 0:o.y)??1}})}})]}),e.jsxs("label",{style:re,children:[e.jsx("span",{style:Y,children:"Scale 2D Y"}),e.jsx(se,{value:((d=t.scale2D)==null?void 0:d.y)??1,min:-10,max:10,step:.01,onChange:r=>{var o;return s({...t,scale2D:{x:((o=t.scale2D)==null?void 0:o.x)??1,y:r}})}})]}),e.jsxs("label",{style:Et,children:[e.jsx("span",{style:Y,children:"Reference Pixels Per Unit"}),e.jsx(se,{value:t.referencePixelsPerUnit??32,min:1,max:512,step:1,onChange:r=>s({...t,referencePixelsPerUnit:r})})]}),n?e.jsxs("label",{style:re,children:[e.jsx("span",{style:Y,children:"Render Order"}),e.jsx(se,{value:t.renderOrder,min:-9999,max:9999,step:1,onChange:r=>s({...t,renderOrder:r})})]}):null,e.jsxs("label",{style:re,children:[e.jsx("span",{style:Y,children:"Pivot X"}),e.jsx(se,{value:t.pivot[0],min:0,max:1,step:.01,onChange:r=>s({...t,pivot:[r,t.pivot[1]]})})]}),e.jsxs("label",{style:re,children:[e.jsx("span",{style:Y,children:"Pivot Y"}),e.jsx(se,{value:t.pivot[1],min:0,max:1,step:.01,onChange:r=>s({...t,pivot:[t.pivot[0],r]})})]}),e.jsx("label",{style:Et,children:e.jsxs("div",{style:al,children:[e.jsx("span",{style:Y,children:l}),e.jsx("input",{type:"checkbox",style:dl,checked:t.showGuides,onChange:r=>s({...t,showGuides:r.target.checked})})]})})]})};function pl({value:t,onChange:s}){return e.jsx(Ht,{value:ws(t.transformation,t.screenTransform),guideLabel:"Transform Control On",showRenderOrder:!1,onChange:l=>s(n=>({...n,transformation:Rn(l,n.transformation),screenTransform:ks(l,n.screenTransform)}))})}const hl=({value:t,onChange:s,copyLabel:l,inspector:n,docked:a})=>{var Ze;const[d,r]=y.useState(()=>K.createSceneObject({name:l??"Screen Text",renderGroupId:Le.DEFAULT_RENDER_GROUP_IDS.screen2d})),[o]=y.useState(()=>{const $=d.id,Z=K.createDefaultComponent("ScreenTransform",$),m=K.createDefaultComponent("ScreenText",$),R=K.createDefaultComponent("Material",$),D=K.createDefaultComponent("Texture",$);return{screenTransform:Z,screenText:m,material:R,texture:D}}),[h,x]=y.useState(!0),[c,p]=y.useState(!0),[f,g]=y.useState(!0),[i,u]=y.useState(!0),[j,w]=y.useState(!0),[v,M]=y.useState(!0),[U,b]=y.useState({text2d:!0,content:!0,transformation:!0,style:!0,textEffect:!0}),F=ws(t.screenText.transformation,t.screenText.screenTransform),E={object:{...d,componentIds:[o.screenTransform.id,o.screenText.id,o.material.id,o.texture.id]},kind:"screenText",components:[{...o.screenTransform,settings:t.screenText.screenTransform??ks(F)},{...o.screenText,settings:t.screenText},{...o.material,settings:{...o.material.settings,color:t.screenText.style.color,opacity:t.screenText.style.opacity}},{...o.texture,settings:{...o.texture.settings,url:t.screenText.style.background.textureUrl,flipX:t.screenText.style.background.textureFlipX,flipY:t.screenText.style.background.textureFlipY}}],scene:{screenSpaceUI:t.screenSpaceUI}},P=$=>{s({...t,screenText:$(t.screenText)})},le=t.screenText.style.strokeLayers??[],ae=t.screenText.style.shadowEnabled!==!1&&(((Ze=t.screenText.style.shadowLayers)==null?void 0:Ze.length)??0)===0?[Bt()]:t.screenText.style.shadowLayers??[],L=t.screenText.style.innerShadow??{color:"#000000",opacity:1,offset:10,angle:-45,feather:0},Pe=t.screenText.style.glow??Ss(),De=t.screenText.style.bend??vs(),W=$=>b(Z=>({...Z,[$]:!Z[$]})),ve=($,Z,m,R)=>e.jsx(Bn,{label:Z,icon:m,open:U[$],onToggle:()=>W($),children:R},$);return e.jsxs(Ct,{objectId:(n==null?void 0:n.objectId)??d.id,objectName:(n==null?void 0:n.objectName)??d.name,onObjectNameChange:(n==null?void 0:n.onObjectNameChange)??($=>r(Z=>({...Z,name:$}))),layer:(n==null?void 0:n.layer)??"Default Layer",visible:(n==null?void 0:n.visible)??t.screenText.enabled,onVisibleChange:(n==null?void 0:n.onVisibleChange)??($=>P(Z=>({...Z,enabled:$}))),copyConfig:(n==null?void 0:n.copyConfig)??E,docked:a??(n==null?void 0:n.docked),initialPosition:n==null?void 0:n.initialPosition,position:n==null?void 0:n.position,onPositionChange:n==null?void 0:n.onPositionChange,title:n==null?void 0:n.title,children:[ve("transformation","Transformation",e.jsx(Vn,{}),e.jsx(pl,{value:t.screenText,onChange:P})),ve("text2d","2D Text",e.jsx(Qt,{}),e.jsxs(e.Fragment,{children:[ve("content","Content",e.jsx(Qt,{}),e.jsx(Hn,{value:t.screenText,onChange:P})),ve("style","Style",e.jsx(es,{}),e.jsx(ll,{value:t.screenText,onChange:P})),ve("textEffect","Text Effect",e.jsx(es,{}),e.jsx(nl,{value:t.screenText,onChange:P,outlineLayers:le,shadowLayers:ae,innerShadow:L,glow:Pe,bend:De,outlineSettingsOpen:h,setOutlineSettingsOpen:x,shadowSettingsOpen:c,setShadowSettingsOpen:p,innerShadowSettingsOpen:f,setInnerShadowSettingsOpen:g,glowSettingsOpen:i,setGlowSettingsOpen:u,bendSettingsOpen:j,setBendSettingsOpen:w,backgroundSettingsOpen:v,setBackgroundSettingsOpen:M}))]}))]})},xl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtAAAAUAAgMAAAAToI2uAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAlQTFRFqampbGxsAAAA/lGquwAAAAN0Uk5T//8A18oNQQAABPRJREFUeJztzssNQWEYQEG3CP1oQqJGsdCfBFs7j8X8+eRMBbPtBtpWB35RWimtlFZKK6WV0kppZWj6uLrwrceltFFaKa2UVkorpZXSSmlldPp2XT350P5Q2iitlFZKK6WV0kpppbRSWimtlFZKK3+RPq8OvXM/lTZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK3+THqG0UloprZRWSiulldJKaaW0UloprZRWSiuv6VFKK6WV0kpppbRSWimtlFbGpgcqrZRWSiulldJKaaW0MjL9BFWtRqVFuJpUAAAAAElFTkSuQmCC",ul={placeholder:"Placeholder","hero-image":"Hero Image","photo-frame":"Default Frame"},gl=Object.entries(ul).map(([t,s])=>({value:t,label:s})),yl={placeholder:{transformation:{showFitGuides:!1},image:{sourceKind:"default",stretchMode:"fit",materialType:"unlit",blendMode:"normal",opacity:1,color:"#ffffff",flipX:!1,flipY:!1,transparent:!0,alphaTest:0}},"hero-image":{transformation:{position:{x:0,y:.08},size:{width:.96,height:.62},rotation:0,pivot:[.5,.5],overlay:!0,visible:!0},image:{sourceKind:"image",stretchMode:"fillAndCut",materialType:"unlit",blendMode:"normal",opacity:1,color:"#ffffff",flipX:!1,flipY:!1,transparent:!0,alphaTest:0}},"photo-frame":{transformation:{position:{x:0,y:.01},size:{width:2,height:2},rotation:0,pivot:[.5,.5],overlay:!0,visible:!0},image:{sourceKind:"image",src:xl,stretchMode:"fill",materialType:"unlit",blendMode:"normal",opacity:1,color:"#ffffff",flipX:!1,flipY:!1,transparent:!0,alphaTest:0}}},bl=(t,s)=>{const l=yl[s];return{...t,preset:s,...l.enabled!==void 0?{enabled:l.enabled}:{},transformation:{...t.transformation,...l.transformation??{}},image:{...t.image,...l.image??{}}}},fl={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},ct={display:"flex",flexDirection:"column",gap:4},jl={...ct,gridColumn:"1 / -1"},Qe={fontSize:9,color:"rgba(226,232,240,0.72)"},Gt={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},ts={...Gt,appearance:"none"},ml={...Gt,fontVariantNumeric:"tabular-nums"},Sl={...Gt,padding:2,cursor:"pointer"},vl=t=>/^-?\d*(\.\d*)?$/.test(t),ss=({value:t,onChange:s,step:l=1,min:n,max:a})=>{const[d,r]=y.useState(String(t));y.useEffect(()=>r(String(t)),[t]);const o=h=>{let x=h;return typeof n=="number"&&(x=Math.max(n,x)),typeof a=="number"&&(x=Math.min(a,x)),x};return e.jsx("input",{type:"text",inputMode:"decimal",pattern:"-?[0-9]*[.,]?[0-9]*",style:ml,value:d,onChange:h=>{const x=h.target.value;if(!vl(x)||(r(x),x===""||x==="-"||x==="."||x==="-."))return;const c=Number(x);Number.isNaN(c)||s(o(c))},onBlur:()=>{const h=Number(d);if(Number.isNaN(h)){r(String(t));return}const x=o(h);r(String(x)),s(x)},onKeyDown:h=>{if(h.key!=="ArrowUp"&&h.key!=="ArrowDown")return;h.preventDefault();const x=h.shiftKey?l*10:h.altKey?l/10:l,c=h.key==="ArrowUp"?t+x:t-x;s(o(Number.isInteger(c)?c:Number(c.toFixed(6))))}})},wl=({value:t,onChange:s})=>e.jsxs("div",{style:fl,children:[e.jsxs("label",{style:ct,children:[e.jsx("span",{style:Qe,children:"Material Type"}),e.jsxs("select",{style:ts,value:t.materialType,onChange:l=>s({...t,materialType:l.target.value}),children:[e.jsx("option",{value:"unlit",children:"Unlit"}),e.jsx("option",{value:"standardPBR",children:"Standard PBR"}),e.jsx("option",{value:"matcap",children:"Matcap"})]})]}),e.jsxs("label",{style:ct,children:[e.jsx("span",{style:Qe,children:"Blend Mode"}),e.jsxs("select",{style:ts,value:t.blendMode,onChange:l=>s({...t,blendMode:l.target.value}),children:[e.jsx("option",{value:"normal",children:"Normal"}),e.jsx("option",{value:"add",children:"Add"}),e.jsx("option",{value:"subtract",children:"Subtract"}),e.jsx("option",{value:"multiply",children:"Multiply"}),e.jsx("option",{value:"screen",children:"Screen"}),e.jsx("option",{value:"lighten",children:"Lighten"}),e.jsx("option",{value:"darken",children:"Darken"}),e.jsx("option",{value:"overlay",children:"Overlay"}),e.jsx("option",{value:"softLight",children:"Soft Light"}),e.jsx("option",{value:"hardLight",children:"Hard Light"}),e.jsx("option",{value:"difference",children:"Difference"}),e.jsx("option",{value:"exclusion",children:"Exclusion"})]})]}),e.jsxs("label",{style:ct,children:[e.jsx("span",{style:Qe,children:"Opacity"}),e.jsx(ss,{value:t.opacity,min:0,max:1,step:.01,onChange:l=>s({...t,opacity:l})})]}),e.jsxs("label",{style:ct,children:[e.jsx("span",{style:Qe,children:"Tint"}),e.jsx("input",{type:"color",style:Sl,value:t.color,onChange:l=>s({...t,color:l.target.value})})]}),e.jsxs("label",{style:jl,children:[e.jsx("span",{style:Qe,children:"Alpha Test"}),e.jsx(ss,{value:t.alphaTest,min:0,max:1,step:.01,onChange:l=>s({...t,alphaTest:l})})]})]}),kl={display:"flex",width:18,height:18,alignItems:"center",justifyContent:"center",borderRadius:6,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.08)",color:"#e2e8f0",flex:"0 0 auto"},Cl={borderRadius:12,border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.03)",overflow:"hidden"},Rl={display:"flex",alignItems:"center",gap:7,padding:"6px 7px"},Il={display:"flex",alignItems:"center",gap:6,fontSize:11,fontWeight:500,flex:"1 1 auto",minWidth:0},El={width:28,height:16,borderRadius:999,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.08)",padding:2,display:"flex",alignItems:"center",cursor:"pointer",flex:"0 0 auto"},Tl=t=>({width:10,height:10,borderRadius:999,background:t?"#f8fafc":"rgba(148,163,184,0.7)",transform:t?"translateX(12px)":"translateX(0)",transition:"transform 140ms ease, background 140ms ease"}),zl={display:"grid",gap:7,padding:"0 7px 7px"},Ml={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},pt={display:"flex",flexDirection:"column",gap:4},Tt={...pt,gridColumn:"1 / -1"},we={fontSize:9,color:"rgba(226,232,240,0.72)"},Rs={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},zt={...Rs,appearance:"none"},Mt={display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:24},Ft={width:16,height:16},Fl=[{value:"default",label:"Default"},{value:"image",label:"Image"},{value:"gif",label:"GIF"}],Wl=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zm0 2v8.76l4.5-4.5 3.2 3.2 2.8-2.8L19 14.16V6H5zm12 3a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})}),Ll=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M11 2h2v4h3l-4 4-4-4h3V2zm0 20v-4H8l4-4 4 4h-3v4h-2zM2 11h4V8l4 4-4 4v-3H2v-2zm20 0v2h-4v3l-4-4 4-4v3h4z"})}),$l=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 2 3 7v10l9 5 9-5V7l-9-5zm0 2.3L17.9 7 12 9.7 6.1 7 12 4.3zM5 8.5l6 2.7v7.9l-6-3.3V8.5zm8 10.6v-7.9l6-2.7v7.3l-6 3.3z"})}),ns=(t,s)=>({enabled:(s==null?void 0:s.enabled)??t.enabled,showGuides:(s==null?void 0:s.showTransformGuides)??t.showFitGuides,coordinateSpace:t.coordinateSpace,canvasSize:t.canvasSize,position:(s==null?void 0:s.position)??t.position,size:(s==null?void 0:s.size)??t.size,rotation:(s==null?void 0:s.rotation)??t.rotation,scale2D:s==null?void 0:s.scale2D,referencePixelsPerUnit:s==null?void 0:s.referencePixelsPerUnit,pivot:(s==null?void 0:s.pivot)??t.pivot,renderOrder:(s==null?void 0:s.renderOrder)??t.renderOrder,overlay:(s==null?void 0:s.overlay)??t.overlay,visible:(s==null?void 0:s.visible)??t.visible}),Nl=(t,s)=>({...s,enabled:t.enabled,showFitGuides:t.showGuides,coordinateSpace:t.coordinateSpace,canvasSize:t.canvasSize,position:t.position,size:t.size,rotation:t.rotation,pivot:t.pivot,renderOrder:t.renderOrder,overlay:t.overlay,visible:t.visible}),ls=(t,s)=>({...$e.DEFAULT_SCREEN_TRANSFORM_2D,...s,enabled:t.enabled,showTransformGuides:t.showGuides,position:t.position,size:t.size,rotation:t.rotation,scale2D:t.scale2D??(s==null?void 0:s.scale2D)??$e.DEFAULT_SCREEN_TRANSFORM_2D.scale2D,referencePixelsPerUnit:t.referencePixelsPerUnit??(s==null?void 0:s.referencePixelsPerUnit)??$e.DEFAULT_SCREEN_TRANSFORM_2D.referencePixelsPerUnit,pivot:t.pivot,renderOrder:t.renderOrder,overlay:t.overlay,visible:t.visible}),Ol=({value:t,onChange:s,copyLabel:l,inspector:n,docked:a})=>{const[d,r]=y.useState(()=>K.createSceneObject({name:l??"Screen Image",renderGroupId:Le.DEFAULT_RENDER_GROUP_IDS.screen2d})),[o]=y.useState(()=>{const i=d.id,u=K.createDefaultComponent("ScreenTransform",i),j=K.createDefaultComponent("ScreenImage",i),w=K.createDefaultComponent("Material",i),v=K.createDefaultComponent("Texture",i);return{screenTransform:u,screenImage:j,material:w,texture:v}}),[h,x]=y.useState({transformation:!0,image:!0,material:!0}),c=ns(t.screenImage.transformation,t.screenImage.screenTransform),p={object:{...d,componentIds:[o.screenTransform.id,o.screenImage.id,o.material.id,o.texture.id]},kind:"screenImage",components:[{...o.screenTransform,settings:t.screenImage.screenTransform??ls(c)},{...o.screenImage,settings:t.screenImage},{...o.material,settings:{...o.material.settings,color:t.screenImage.image.color,opacity:t.screenImage.image.opacity}},{...o.texture,settings:{...o.texture.settings,url:t.screenImage.image.src||void 0,flipX:t.screenImage.image.flipX,flipY:t.screenImage.image.flipY}}],scene:{screenSpaceUI:t.screenSpaceUI}},f=i=>{s({...t,screenImage:i(t.screenImage)})},g=(i,u,j,w)=>e.jsxs("div",{style:Cl,children:[e.jsxs("div",{style:Rl,children:[e.jsx("button",{type:"button",onClick:()=>x(v=>({...v,[i]:!v[i]})),style:El,children:e.jsx("div",{style:Tl(h[i])})}),e.jsxs("div",{style:Il,children:[e.jsx("span",{style:kl,children:j}),e.jsx("span",{children:u})]})]}),h[i]?e.jsx("div",{style:zl,children:w}):null]},i);return e.jsxs(Ct,{objectId:(n==null?void 0:n.objectId)??d.id,objectName:(n==null?void 0:n.objectName)??d.name,onObjectNameChange:(n==null?void 0:n.onObjectNameChange)??(i=>r(u=>({...u,name:i}))),layer:(n==null?void 0:n.layer)??"Default Layer",visible:(n==null?void 0:n.visible)??t.screenImage.enabled,onVisibleChange:(n==null?void 0:n.onVisibleChange)??(i=>f(u=>({...u,enabled:i}))),copyConfig:(n==null?void 0:n.copyConfig)??p,docked:a??(n==null?void 0:n.docked),initialPosition:n==null?void 0:n.initialPosition,position:n==null?void 0:n.position,onPositionChange:n==null?void 0:n.onPositionChange,title:n==null?void 0:n.title,children:[g("transformation","Transformation",e.jsx(Ll,{}),e.jsx(Ht,{value:ns(t.screenImage.transformation,t.screenImage.screenTransform),guideLabel:"Transform Control On",showRenderOrder:!1,onChange:i=>f(u=>({...u,transformation:Nl(i,u.transformation),screenTransform:ls(i,u.screenTransform)}))})),g("image","Image",e.jsx(Wl,{}),e.jsxs("div",{style:{display:"grid",gap:6},children:[e.jsxs("label",{style:pt,children:[e.jsx("span",{style:we,children:"Preset"}),e.jsx("select",{style:zt,value:t.screenImage.preset,onChange:i=>f(u=>bl(u,i.target.value)),children:gl.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))})]}),e.jsxs("label",{style:pt,children:[e.jsx("span",{style:we,children:"Source Kind"}),e.jsx("select",{style:zt,value:t.screenImage.image.sourceKind,onChange:i=>f(u=>({...u,image:{...u.image,sourceKind:i.target.value}})),children:Fl.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))})]}),t.screenImage.image.sourceKind==="image"||t.screenImage.image.sourceKind==="gif"?e.jsxs("label",{style:pt,children:[e.jsx("span",{style:we,children:"Source URL"}),e.jsx("input",{style:Rs,value:t.screenImage.image.src,onChange:i=>f(u=>({...u,image:{...u.image,src:i.target.value}}))})]}):null,e.jsxs("label",{style:pt,children:[e.jsx("span",{style:we,children:"Stretch Mode"}),e.jsxs("select",{style:zt,value:t.screenImage.image.stretchMode,onChange:i=>f(u=>({...u,image:{...u.image,stretchMode:i.target.value}})),children:[e.jsx("option",{value:"fit",children:"Fit"}),e.jsx("option",{value:"fitWidth",children:"Fit Width"}),e.jsx("option",{value:"fitHeight",children:"Fit Height"}),e.jsx("option",{value:"center",children:"Center"}),e.jsx("option",{value:"stretch",children:"Stretch"}),e.jsx("option",{value:"fill",children:"Fill"}),e.jsx("option",{value:"fillAndCut",children:"Fill and Cut"})]})]}),e.jsx("label",{style:Tt,children:e.jsxs("div",{style:Mt,children:[e.jsx("span",{style:we,children:"Flip X"}),e.jsx("input",{type:"checkbox",style:Ft,checked:t.screenImage.image.flipX,onChange:i=>f(u=>({...u,image:{...u.image,flipX:i.target.checked}}))})]})}),e.jsx("label",{style:Tt,children:e.jsxs("div",{style:Mt,children:[e.jsx("span",{style:we,children:"Flip Y"}),e.jsx("input",{type:"checkbox",style:Ft,checked:t.screenImage.image.flipY,onChange:i=>f(u=>({...u,image:{...u.image,flipY:i.target.checked}}))})]})})]})),g("material","Material",e.jsx($l,{}),e.jsxs("div",{style:Ml,children:[e.jsx(wl,{value:t.screenImage.image,onChange:i=>f(u=>({...u,image:{...u.image,materialType:i.materialType,blendMode:i.blendMode,opacity:i.opacity,color:i.color,alphaTest:i.alphaTest}}))}),e.jsx("label",{style:Tt,children:e.jsxs("div",{style:Mt,children:[e.jsx("span",{style:we,children:"Transparent"}),e.jsx("input",{type:"checkbox",style:Ft,checked:t.screenImage.image.transparent,onChange:i=>f(u=>({...u,image:{...u.image,transparent:i.target.checked}}))})]})})]}))]})},_e={display:"grid",gridTemplateColumns:"92px minmax(0,1fr)",alignItems:"center",gap:10,margin:"8px 0",color:"#cbd5e1",fontSize:12},We={width:"100%",boxSizing:"border-box",padding:"8px 9px",border:"1px solid rgba(148,163,184,.16)",borderRadius:6,background:"rgba(15,23,42,.72)",color:"#e2e8f0"},Al=({onChange:t,value:s})=>e.jsxs("fieldset",{style:{border:0,padding:0,margin:0},children:[s.map((l,n)=>e.jsxs("div",{style:_e,children:[e.jsx("input",{"aria-label":`Gradient stop ${n+1} color`,type:"color",style:{...We,padding:2},value:l.color,onChange:a=>t(s.map((d,r)=>r===n?{...d,color:a.currentTarget.value}:d))}),e.jsxs("span",{style:{display:"grid",gridTemplateColumns:"1fr auto",gap:4},children:[e.jsx("input",{"aria-label":`Gradient stop ${n+1} position`,type:"number",min:0,max:1,step:.05,style:We,value:l.offset,onChange:a=>t(s.map((d,r)=>r===n?{...d,offset:Number(a.currentTarget.value)}:d))}),s.length>2?e.jsx("button",{type:"button",onClick:()=>t(s.filter((a,d)=>d!==n)),children:"−"}):null]})]},`${n}-${l.color}`)),s.length<J.MAX_SCREEN_GRADIENT_STOPS?e.jsx("button",{type:"button",onClick:()=>{var l;return t([...s,{offset:.5,color:((l=s[s.length-1])==null?void 0:l.color)??"#ffffff"}])},children:"Add stop"}):null]}),Is=({onChange:t,value:s})=>e.jsxs("fieldset",{style:{border:0,padding:0,margin:0},children:[e.jsxs("label",{style:_e,children:[e.jsx("span",{children:"Gradient"}),e.jsxs("select",{style:We,value:s.type,onChange:l=>t({...s,type:l.currentTarget.value}),children:[e.jsx("option",{value:"linear",children:"Linear"}),e.jsx("option",{value:"radial",children:"Radial"}),e.jsx("option",{value:"angular",children:"Conic / Angular"})]})]}),e.jsx(Al,{value:s.stops,onChange:l=>t({...s,stops:l})}),s.type!=="radial"?e.jsxs("label",{style:_e,children:[e.jsx("span",{children:"Angle"}),e.jsx("input",{type:"number",style:We,step:5,value:s.angle,onChange:l=>t({...s,angle:Number(l.currentTarget.value)})})]}):null,s.type!=="linear"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:_e,children:[e.jsx("span",{children:"Center X"}),e.jsx("input",{type:"number",style:We,min:0,max:1,step:.05,value:s.center.x,onChange:l=>t({...s,center:{...s.center,x:Number(l.currentTarget.value)}})})]}),e.jsxs("label",{style:_e,children:[e.jsx("span",{children:"Center Y"}),e.jsx("input",{type:"number",style:We,min:0,max:1,step:.05,value:s.center.y,onChange:l=>t({...s,center:{...s.center,y:Number(l.currentTarget.value)}})})]})]}):null,s.type==="radial"?e.jsxs("label",{style:_e,children:[e.jsx("span",{children:"Radius"}),e.jsx("input",{type:"number",style:We,min:.01,step:.05,value:s.radius,onChange:l=>t({...s,radius:Number(l.currentTarget.value)})})]}):null]}),is={display:"grid",gridTemplateColumns:"92px minmax(0,1fr)",alignItems:"center",gap:10,margin:"8px 0",color:"#cbd5e1",fontSize:12},os={width:"100%",boxSizing:"border-box",padding:"8px 9px",border:"1px solid rgba(148,163,184,.16)",borderRadius:6,background:"rgba(15,23,42,.72)",color:"#e2e8f0"},Es=({value:t,onChange:s})=>e.jsxs("fieldset",{style:{border:0,padding:0,margin:0},children:[e.jsxs("label",{style:is,children:[e.jsx("span",{children:"Tint"}),e.jsx("input",{type:"color",style:{...os,padding:2},value:t.tint,onChange:l=>s({...t,tint:l.currentTarget.value})})]}),["opacity","frost","highlight"].map(l=>e.jsxs("label",{style:is,children:[e.jsx("span",{children:l[0].toUpperCase()+l.slice(1)}),e.jsx("input",{type:"number",style:os,min:0,max:1,step:.05,value:t[l],onChange:n=>s({...t,[l]:Number(n.currentTarget.value)})})]},l))]}),Pl={borderRadius:12,border:"1px solid rgba(255,255,255,.08)",background:"rgba(255,255,255,.03)",padding:8},Ue={display:"grid",gridTemplateColumns:"92px minmax(0,1fr)",alignItems:"center",gap:10,margin:"8px 0",color:"#cbd5e1",fontSize:12},ht={width:"100%",boxSizing:"border-box",padding:"8px 9px",border:"1px solid rgba(148,163,184,.16)",borderRadius:6,background:"rgba(15,23,42,.72)",color:"#e2e8f0"},ie=({label:t,onValue:s,...l})=>e.jsxs("label",{style:Ue,children:[e.jsx("span",{children:t}),e.jsx("input",{...l,type:"number",style:ht,onChange:n=>s(Number(n.currentTarget.value))})]}),Ts=({value:t,onChange:s})=>e.jsxs("section",{style:Pl,children:[e.jsx("div",{style:{fontSize:11,fontWeight:700,marginBottom:7},children:"Screen Shape"}),e.jsxs("label",{style:Ue,children:[e.jsx("span",{children:"Shape"}),e.jsxs("select",{style:ht,value:t.kind,onChange:l=>s({...t,kind:l.currentTarget.value}),children:[e.jsx("option",{value:"circle",children:"Circle"}),e.jsx("option",{value:"ellipse",children:"Ellipse"}),e.jsx("option",{value:"rectangle",children:"Rectangle"}),e.jsx("option",{value:"roundedRectangle",children:"Rounded Rectangle"}),e.jsx("option",{value:"polygon",children:"Polygon"}),e.jsx("option",{value:"star",children:"Star"}),e.jsx("option",{value:"line",children:"Line"})]})]}),t.kind!=="line"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:Ue,children:[e.jsx("span",{children:"Fill"}),e.jsxs("select",{style:ht,value:t.fillMode,onChange:l=>s({...t,fillMode:l.currentTarget.value}),children:[e.jsx("option",{value:"solid",children:"Solid"}),e.jsx("option",{value:"gradient",children:"Gradient"}),e.jsx("option",{value:"glass",children:"Glass"})]})]}),t.fillMode==="gradient"?e.jsx(Is,{value:t.gradient,onChange:l=>s({...t,gradient:l})}):t.fillMode==="glass"?e.jsx(Es,{value:t.glass,onChange:l=>s({...t,glass:l})}):e.jsxs("label",{style:Ue,children:[e.jsx("span",{children:"Color"}),e.jsx("input",{type:"color",style:{...ht,padding:2},value:t.fillColor,onChange:l=>s({...t,fillColor:l.currentTarget.value})})]}),e.jsx(ie,{label:"Fill Opacity",min:0,max:1,step:.05,value:t.fillOpacity,onValue:l=>s({...t,fillOpacity:l})})]}):null,e.jsxs("label",{style:Ue,children:[e.jsx("span",{children:"Stroke"}),e.jsx("input",{type:"color",style:{...ht,padding:2},value:t.strokeColor,onChange:l=>s({...t,strokeColor:l.currentTarget.value})})]}),e.jsx(ie,{label:"Stroke Width",min:0,step:1,value:t.strokeWidth,onValue:l=>s({...t,strokeWidth:l})}),e.jsx(ie,{label:"Stroke Opacity",min:0,max:1,step:.05,value:t.strokeOpacity,onValue:l=>s({...t,strokeOpacity:l})}),e.jsxs("label",{style:Ue,children:[e.jsx("span",{children:"Dashed"}),e.jsx("input",{type:"checkbox",checked:t.dashed,onChange:l=>s({...t,dashed:l.currentTarget.checked})})]}),t.kind==="roundedRectangle"?e.jsx(ie,{label:"Corner Radius",min:0,max:.5,step:.01,value:t.cornerRadius,onValue:l=>s({...t,cornerRadius:l})}):null,t.kind==="polygon"||t.kind==="star"?e.jsx(ie,{label:t.kind==="star"?"Points":"Sides",min:3,max:12,step:1,value:t.sides,onValue:l=>s({...t,sides:l})}):null,t.kind==="star"?e.jsx(ie,{label:"Inner Radius",min:.05,max:.95,step:.05,value:t.innerRadiusRatio,onValue:l=>s({...t,innerRadiusRatio:l})}):null,t.kind==="line"?e.jsxs(e.Fragment,{children:[e.jsx(ie,{label:"Start X",min:0,max:1,step:.05,value:t.lineStart.x,onValue:l=>s({...t,lineStart:{...t.lineStart,x:l}})}),e.jsx(ie,{label:"Start Y",min:0,max:1,step:.05,value:t.lineStart.y,onValue:l=>s({...t,lineStart:{...t.lineStart,y:l}})}),e.jsx(ie,{label:"End X",min:0,max:1,step:.05,value:t.lineEnd.x,onValue:l=>s({...t,lineEnd:{...t.lineEnd,x:l}})}),e.jsx(ie,{label:"End Y",min:0,max:1,step:.05,value:t.lineEnd.y,onValue:l=>s({...t,lineEnd:{...t.lineEnd,y:l}})})]}):null]}),Dl={enabled:!0,bothHands:!0,visualScale:1,opacity:.92,pointRadius:3,lineWidth:3,labelScale:1.2,smoothing:.35,color:"#22d3ee",showBoundingBox:!0,showLabels:!1,logToConsole:!1},Bl={position:"fixed",left:14,top:104,zIndex:2e4,pointerEvents:"none"},zs={pointerEvents:"auto",width:286,borderRadius:16,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(8, 15, 28, 0.58)",boxShadow:"0 16px 36px rgba(0,0,0,0.28)",backdropFilter:"blur(20px) saturate(1.1)",WebkitBackdropFilter:"blur(20px) saturate(1.1)",color:"#f8fafc",overflowX:"hidden",overflowY:"auto",scrollbarWidth:"thin",scrollbarColor:"rgba(148,163,184,0.55) rgba(255,255,255,0.06)",overscrollBehavior:"contain"},Vl={...zs,width:32,height:32,borderRadius:16,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},Kl={position:"sticky",top:0,zIndex:1,display:"flex",alignItems:"center",gap:7,padding:"7px 8px",borderBottom:"1px solid rgba(255,255,255,0.08)",background:"rgba(8, 15, 28, 0.88)",backdropFilter:"blur(20px) saturate(1.1)",WebkitBackdropFilter:"blur(20px) saturate(1.1)"},Hl={width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",cursor:"grab",color:"rgba(148,163,184,0.82)",flex:"0 0 auto"},Gl={display:"flex",alignItems:"center",gap:6,fontSize:11,fontWeight:600,minWidth:0},rs={display:"flex",width:18,height:18,alignItems:"center",justifyContent:"center",borderRadius:6,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.08)",color:"#e2e8f0",flex:"0 0 auto"},_l={display:"grid",gap:6,padding:7},Ul={borderRadius:12,border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.03)",overflow:"hidden"},Xl={display:"flex",alignItems:"center",gap:7,padding:"6px 7px"},Zl={display:"flex",alignItems:"center",gap:6,fontSize:11,fontWeight:500,flex:"1 1 auto",minWidth:0},Yl={width:28,height:16,borderRadius:999,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.08)",padding:2,display:"flex",alignItems:"center",cursor:"pointer",flex:"0 0 auto"},ql=t=>({width:10,height:10,borderRadius:999,background:t?"#f8fafc":"rgba(148,163,184,0.7)",transform:t?"translateX(12px)":"translateX(0)",transition:"transform 140ms ease, background 140ms ease"}),Jl={display:"grid",gap:7,padding:"0 7px 7px"},Ql={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},Fe={display:"flex",flexDirection:"column",gap:4},et={...Fe,gridColumn:"1 / -1"},ne={fontSize:9,color:"rgba(226,232,240,0.72)"},Ve={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},tt={display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:24},st={width:16,height:16},as={display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:8,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.05)",color:"#e2e8f0",cursor:"pointer",padding:0,flex:"0 0 auto"},ei=()=>e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M7 10h10v2H7v-2zm0 4h10v2H7v-2zm0-8h10v2H7V6z"})}),ti=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M18.3 5.71 12 12l6.3 6.29-1.41 1.41L10.59 13.41 4.29 19.7 2.88 18.29 9.17 12 2.88 5.71 4.29 4.3l6.3 6.29 6.29-6.3z"})}),si=()=>e.jsx("svg",{width:"11",height:"15",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M8 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 18a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 18a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})}),Wt=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M11 2a1 1 0 0 1 1 1v6h1V3a1 1 0 1 1 2 0v6h1V4a1 1 0 1 1 2 0v7.3l1.6 2.4a5 5 0 0 1 .8 2.7V18a4 4 0 0 1-4 4H9a6 6 0 0 1-6-6v-3.5a2.5 2.5 0 0 1 5 0V15h1V3a1 1 0 0 1 1-1z"})}),ni=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 5V2L7 7l5 5V9a4 4 0 1 1-4 4H6a6 6 0 1 0 6-8z"})}),li=({value:t,onChange:s})=>{const[l,n]=y.useState(!0),[a,d]=y.useState({x:14,y:104}),[r,o]=y.useState(typeof window>"u"?0:window.innerHeight),[h,x]=y.useState({overlay:!0,visibility:!1}),c=y.useRef(null),p=Math.max(240,r-a.y-16);y.useEffect(()=>{const i=j=>{c.current&&d({x:Math.max(8,j.clientX-c.current.x),y:Math.max(8,j.clientY-c.current.y)})},u=()=>{c.current=null,document.body.classList.remove("select-none")};return window.addEventListener("pointermove",i),window.addEventListener("pointerup",u),()=>{window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",u)}},[]),y.useEffect(()=>{const i=()=>o(window.innerHeight);return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]);const f=i=>{const u=i.currentTarget.getBoundingClientRect();c.current={x:i.clientX-u.left,y:i.clientY-u.top},document.body.classList.add("select-none"),i.currentTarget.setPointerCapture(i.pointerId)},g=(i,u,j,w)=>e.jsxs("div",{style:Ul,children:[e.jsxs("div",{style:Xl,children:[e.jsx("button",{type:"button",onClick:()=>x(v=>({...v,[i]:!v[i]})),style:Yl,children:e.jsx("div",{style:ql(h[i])})}),e.jsxs("div",{style:Zl,children:[e.jsx("span",{style:rs,children:j}),e.jsx("span",{children:u})]})]}),h[i]?e.jsx("div",{style:Jl,children:w}):null]},i);return typeof document>"u"?null:Ae.createPortal(e.jsxs("div",{style:{...Bl,left:a.x,top:a.y},children:[e.jsx("style",{children:`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Oe=require("./session-3aCMNb8W.cjs"),Hs=require("./debug-ui/default-setting.cjs"),e=require("react/jsx-runtime"),y=require("react"),Le=require("./renderGroups-B0N58SIA.cjs"),K=require("./index-Cm3v6Dlg.cjs"),Ae=require("react-dom"),$e=require("./index-J3Qy6hi3.cjs"),Gs=require("three"),J=require("./renderPasses-Bt8k0dkm.cjs"),Ne=require("./settings-C63FMBlF.cjs"),N=require("./FaceRetouch-DHhn1nSV.cjs"),It=require("./landmarkMask-CvN-L5NT.cjs"),_s=require("./index-DzdKBXGE.cjs"),Us=require("./index-LC2Xs08E.cjs"),Zt=require("@react-three/drei"),Xs=require("@react-three/fiber"),Yt=require("./index-BzGLgXJm.cjs"),Zs=require("./contexts-CSz9stBV.cjs"),Ys=require("./selectors-Bq6tSgOY.cjs"),qs={position:"fixed",zIndex:2e4,pointerEvents:"none"},kt={width:"100%",maxHeight:"none",border:"none",borderRadius:0,background:"transparent",boxShadow:"none",backdropFilter:"none",WebkitBackdropFilter:"none",overflow:"visible"},js=({docked:t=!1,initialPosition:s,position:l,onPositionChange:n})=>{const[a,d]=y.useState(s),r=l??a,o=y.useRef(null),h=y.useRef(n);return h.current=n,y.useEffect(()=>{if(t)return;const p=g=>{var j;const i=o.current;if(!i)return;const u={x:Math.max(8,g.clientX-i.x),y:Math.max(8,g.clientY-i.y)};d(u),(j=h.current)==null||j.call(h,u)},f=()=>{const g=o.current;g&&(o.current=null,g.selectNone&&document.body.classList.remove("select-none"))};return window.addEventListener("pointermove",p),window.addEventListener("pointerup",f),()=>{window.removeEventListener("pointermove",p),window.removeEventListener("pointerup",f)}},[t]),{docked:t,position:r,startDrag:(p,{capture:f=!0,selectNone:g=!0}={})=>{if(t)return;const i=p.currentTarget.getBoundingClientRect();o.current={x:p.clientX-i.left,y:p.clientY-i.top,selectNone:g},g&&document.body.classList.add("select-none"),f&&p.currentTarget.setPointerCapture(p.pointerId)},place:p=>t?p:typeof document>"u"?null:Ae.createPortal(e.jsx("div",{style:{...qs,left:r.x,top:r.y},children:p}),document.body)}},qt={pointerEvents:"auto",width:306,maxHeight:"calc(100vh - 124px)",borderRadius:16,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(8, 15, 28, 0.58)",boxShadow:"0 16px 36px rgba(0,0,0,0.28)",backdropFilter:"blur(20px) saturate(1.1)",WebkitBackdropFilter:"blur(20px) saturate(1.1)",color:"#f8fafc",overflow:"hidden"},Js=306,Qs=()=>({x:typeof window>"u"?14:window.innerWidth-(Js+20),y:30}),en={display:"grid",gap:7,padding:"7px 8px 8px",borderBottom:"1px solid rgba(255,255,255,0.08)",background:"rgba(8, 15, 28, 0.88)"},ms={display:"grid",gridTemplateColumns:"16px 22px minmax(0, 1fr) 28px",alignItems:"center",gap:7},tn={...ms,gridTemplateColumns:"22px minmax(0, 1fr) 28px"},sn={display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:11,fontWeight:700},nn={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(125,211,252,0.46)",background:"rgba(15,23,42,0.82)",color:"#f8fafc",fontSize:11,fontWeight:700,outline:"none",padding:"0 7px",boxSizing:"border-box"},ln={display:"flex",width:20,height:20,alignItems:"center",justifyContent:"center",borderRadius:7,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.08)",color:"#e2e8f0"},on={width:16,height:18,display:"flex",alignItems:"center",justifyContent:"center",cursor:"grab",color:"rgba(148,163,184,0.82)"},Jt={display:"grid",gap:8,padding:8,overflowY:"auto",maxHeight:"calc(100vh - 215px)"},rn={display:"grid",gridTemplateColumns:"minmax(0, 1fr) 30px",gap:6},an={width:"100%",height:26,borderRadius:8,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(56,189,248,0.16)",color:"#e0f2fe",fontSize:10.5,fontWeight:700,cursor:"pointer"},dn=t=>({display:"inline-flex",alignItems:"center",justifyContent:"center",width:30,height:26,borderRadius:8,border:"1px solid rgba(255,255,255,0.10)",color:t?"#e0f2fe":"rgba(148,163,184,0.72)",background:t?"rgba(56,189,248,0.16)":"rgba(255,255,255,0.04)",cursor:"pointer",padding:0}),cn={display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:24,borderRadius:8,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.05)",color:"#e2e8f0",cursor:"pointer",padding:0},pn={width:"fit-content",maxWidth:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.07)",color:"#e2e8f0",fontSize:10,padding:"0 8px"},hn=()=>e.jsx("svg",{width:"11",height:"15",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M8 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 18a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 18a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})}),xn=()=>e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"m12 2 8 4.6v10.8L12 22l-8-4.6V6.6L12 2zm0 2.3L6.3 7.6 12 10.9l5.7-3.3L12 4.3zM6 9.3v6.9l5 2.9v-6.9L6 9.3zm12 0-5 2.9v6.9l5-2.9V9.3z"})}),un=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 5c5 0 8.7 4.2 10 7-1.3 2.8-5 7-10 7s-8.7-4.2-10-7c1.3-2.8 5-7 10-7zm0 2c-3.6 0-6.4 2.7-7.7 5 1.3 2.3 4.1 5 7.7 5s6.4-2.7 7.7-5C18.4 9.7 15.6 7 12 7zm0 2.5a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5z"})}),gn=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M3.3 2 22 20.7 20.7 22l-3.1-3.1A10.5 10.5 0 0 1 12 20c-5 0-8.7-4.2-10-7a16.4 16.4 0 0 1 4-4.9L2 3.3 3.3 2zm4.1 7.5A14.4 14.4 0 0 0 4.3 13c1.3 2.3 4.1 5 7.7 5 1.5 0 2.8-.5 4-1.2l-2.1-2.1A2.5 2.5 0 0 1 9.3 10L7.4 9.5zM12 4c5 0 8.7 4.2 10 7a15 15 0 0 1-3.2 4.2l-1.4-1.4A13 13 0 0 0 19.7 11C18.4 8.7 15.6 6 12 6c-.9 0-1.8.2-2.6.5L7.8 4.9C9.1 4.3 10.5 4 12 4z"})}),yn=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M7 10h10v2H7v-2zm0 4h10v2H7v-2z"})}),bn=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M11 5h2v6h6v2h-6v6h-2v-6H5v-2h6V5z"})}),fn=async t=>{var l;if((l=navigator.clipboard)!=null&&l.writeText){await navigator.clipboard.writeText(t);return}const s=document.createElement("textarea");s.value=t,s.setAttribute("readonly",""),s.style.position="fixed",s.style.left="-9999px",document.body.appendChild(s),s.select(),document.execCommand("copy"),document.body.removeChild(s)},Ct=({children:t,copyConfig:s,docked:l=!1,initialPosition:n,layer:a="Default Layer",objectId:d,objectName:r,onObjectNameChange:o,onPositionChange:h,onVisibleChange:x,position:c,title:p,visible:f})=>{const{startDrag:g,place:i}=js({docked:l,initialPosition:n??Qs,position:c,onPositionChange:h}),[u,j]=y.useState(!1),[w,v]=y.useState(!0),M=r??p??d??"Scene Object",[U,b]=y.useState(!1),[F,E]=y.useState(M);y.useEffect(()=>{U||E(M)},[M,U]);const P=async()=>{try{await fn(JSON.stringify(s,null,2)),j(!0),window.setTimeout(()=>j(!1),1200)}catch{j(!1)}},le=()=>{const L=F.trim();if(b(!1),!o||!L||L===M){E(M);return}o(L)},ae=()=>{E(M),b(!1)};return i(e.jsxs("div",{style:l?{...qt,...kt}:qt,children:[e.jsxs("div",{style:en,children:[e.jsxs("div",{style:l?tn:ms,children:[!l&&e.jsx("div",{onPointerDown:g,style:on,children:e.jsx(hn,{})}),e.jsx("span",{style:ln,children:e.jsx(xn,{})}),U?e.jsx("input",{autoFocus:!0,"aria-label":"Object Name",style:nn,value:F,onBlur:le,onChange:L=>E(L.currentTarget.value),onKeyDown:L=>{L.key==="Enter"&&le(),L.key==="Escape"&&ae()}}):e.jsx("button",{type:"button",style:{...sn,padding:0,border:0,background:"transparent",color:"inherit",cursor:o?"text":"default",textAlign:"left"},onDoubleClick:()=>{o&&b(!0)},children:M}),e.jsx("button",{type:"button","aria-label":w?"Fold Inspector":"Expand Inspector",title:w?"Fold Inspector":"Expand Inspector",style:cn,onClick:()=>v(L=>!L),children:w?e.jsx(yn,{}):e.jsx(bn,{})})]}),w?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",style:pn,children:a}),e.jsxs("div",{style:rn,children:[e.jsx("button",{type:"button",style:an,onClick:P,children:u?"Copied Config":"Copy Config"}),e.jsx("button",{type:"button",style:dn(f),onClick:()=>x(!f),children:f?e.jsx(un,{}):e.jsx(gn,{})})]})]}):null]}),w?e.jsx("div",{style:l?{...Jt,maxHeight:"none"}:Jt,children:t}):null]}))},jn={clean:{fontWeight:400,strokeLayers:[],shadowLayers:[]},sticker:{color:"#101828",fontWeight:800,strokeLayers:[{color:"#ffffff",width:26,opacity:1},{color:"#101828",width:10,opacity:1}],shadowLayers:[]},"shadow-pop":{color:"#fff8df",fontWeight:800,strokeLayers:[{color:"#101828",width:12,opacity:1}],shadowLayers:[{color:"#0f172a",blur:0,offsetX:18,offsetY:18,opacity:.9},{color:"#0f172a",blur:10,offsetX:10,offsetY:10,opacity:.35}]},neon:{color:"#ffffff",fontWeight:700,strokeLayers:[{color:"#9be7ff",width:8,opacity:.9}],shadowLayers:[{color:"#38bdf8",blur:18,opacity:.8},{color:"#0ea5e9",blur:40,opacity:.7},{color:"#7c3aed",blur:70,opacity:.5}]},editorial:{color:"#f8fafc",fontWeight:500,strokeLayers:[{color:"#0f172a",width:4,opacity:.5}],shadowLayers:[]},"comic-burst":{color:"#fff06a",fontWeight:900,strokeLayers:[{color:"#ef4444",width:28,opacity:1},{color:"#111827",width:12,opacity:1}],shadowLayers:[{color:"#111827",blur:0,offsetX:12,offsetY:12,opacity:.65}]},"ice-outline":{color:"#eff8ff",fontWeight:800,strokeLayers:[{color:"#dbeafe",width:16,opacity:1},{color:"#1d4ed8",width:6,opacity:.95}],shadowLayers:[{color:"#38bdf8",blur:24,opacity:.32}]},"sunset-glow":{color:"#fff7ed",fontWeight:800,strokeLayers:[{color:"#fb7185",width:8,opacity:.95}],shadowLayers:[{color:"#fb7185",blur:18,opacity:.7},{color:"#f97316",blur:42,opacity:.55},{color:"#facc15",blur:70,opacity:.28}]},cutout:{color:"#fffaf0",fontWeight:800,strokeLayers:[{color:"#0f172a",width:6,opacity:.9}],shadowLayers:[{color:"#0f172a",blur:0,offsetX:8,offsetY:8,opacity:.95},{color:"#0f172a",blur:0,offsetX:16,offsetY:16,opacity:.4}]},"badge-arc":{color:"#ffffff",fontWeight:900,outlineEnabled:!0,shadowEnabled:!0,glowEnabled:!1,innerShadowEnabled:!1,bendEnabled:!0,bend:{preset:"arc",strength:100},strokeLayers:[{color:"#0b1020",width:24,opacity:1},{color:"#ffffff",width:8,opacity:1}],shadowLayers:[{color:"#020617",blur:8,offset:10,angle:-45,feather:.2,opacity:.65}]},"chrome-bulge":{color:"#f8fafc",fontWeight:900,outlineEnabled:!0,shadowEnabled:!1,glowEnabled:!0,innerShadowEnabled:!0,bendEnabled:!0,bend:{preset:"bulge",strength:100},glow:{color:"#dbeafe",style:"contoured",intensity:.55,range:.35,horizontalAngle:0,verticalAngle:0},innerShadow:{color:"#64748b",opacity:.9,offset:16,angle:-45,feather:.25},strokeLayers:[{color:"#0f172a",width:5,opacity:.9}],shadowLayers:[]},"retro-wave":{color:"#fffbeb",fontWeight:900,outlineEnabled:!0,shadowEnabled:!0,glowEnabled:!0,innerShadowEnabled:!1,bendEnabled:!0,bend:{preset:"wave",strength:100},glow:{color:"#fb7185",style:"outward",intensity:.65,range:.55,horizontalAngle:0,verticalAngle:0},strokeLayers:[{color:"#fb7185",width:12,opacity:1},{color:"#7c2d12",width:5,opacity:.9}],shadowLayers:[{color:"#7c2d12",blur:4,offset:14,angle:45,feather:.1,opacity:.75}]},"flag-pop":{color:"#ffffff",fontWeight:900,outlineEnabled:!0,shadowEnabled:!0,glowEnabled:!0,innerShadowEnabled:!1,bendEnabled:!0,bend:{preset:"flag",strength:100},glow:{color:"#38bdf8",style:"outward",intensity:.5,range:.45,horizontalAngle:.15,verticalAngle:-.1},strokeLayers:[{color:"#fde047",width:18,opacity:1},{color:"#111827",width:7,opacity:1}],shadowLayers:[{color:"#111827",blur:0,offset:14,angle:35,feather:0,opacity:.75}]},"fisheye-poster":{color:"#fff7ed",fontWeight:900,outlineEnabled:!0,shadowEnabled:!0,glowEnabled:!1,innerShadowEnabled:!0,bendEnabled:!0,bend:{preset:"fisheye",strength:100},innerShadow:{color:"#92400e",opacity:.55,offset:10,angle:-45,feather:.15},strokeLayers:[{color:"#020617",width:24,opacity:1},{color:"#f97316",width:8,opacity:.9}],shadowLayers:[{color:"#020617",blur:0,offset:12,angle:40,feather:0,opacity:.8}]}},mn=[{label:"Space Grotesk",value:'"Space Grotesk", sans-serif'},{label:"Bebas Neue",value:'"Bebas Neue", sans-serif'},{label:"DM Serif Display",value:'"DM Serif Display", serif'},{label:"Caveat",value:'"Caveat", cursive'}],Sn=["clean","sticker","shadow-pop","neon","editorial","comic-burst","ice-outline","sunset-glow","cutout","badge-arc","chrome-bulge","retro-wave","flag-pop","fisheye-poster"],vn={clean:"NONE",sticker:"sticker","shadow-pop":"shadow-pop",neon:"neon",editorial:"editorial","comic-burst":"comic-burst","ice-outline":"ice-outline","sunset-glow":"sunset-glow",cutout:"cutout","badge-arc":"badge-arc","chrome-bulge":"chrome-bulge","retro-wave":"retro-wave","flag-pop":"flag-pop","fisheye-poster":"fisheye-poster"},wn=()=>({color:"#000000",opacity:1,width:30}),Bt=()=>({color:"#000000",opacity:1,offset:10,angle:-45,feather:0,blur:0,offsetX:7.071,offsetY:-7.071}),Ss=()=>({color:"#ffffff",style:"outward",intensity:.5,range:.5,horizontalAngle:0,verticalAngle:0}),vs=()=>({preset:"arc",strength:100}),kn=[{label:"Arc",value:"arc"},{label:"Arc Lower",value:"arc-lower"},{label:"Arc Upper",value:"arc-upper"},{label:"Arch",value:"arch"},{label:"Bulge",value:"bulge"},{label:"Shell Lower",value:"shell-lower"},{label:"Shell Upper",value:"shell-upper"},{label:"Flag",value:"flag"},{label:"Wave",value:"wave"},{label:"Fish",value:"fish"},{label:"Rise",value:"rise"},{label:"Fisheye",value:"fisheye"},{label:"Inflate",value:"inflate"},{label:"Squeeze",value:"squeeze"},{label:"Twist",value:"twist"}],Cn=(t,s)=>{const l=jn[s],n=l.strokeLayers??t.style.strokeLayers,a=l.shadowLayers??t.style.shadowLayers;return{...t,textArtPreset:s,style:{...t.style,...l,fontWeight:t.style.bold?"bold":l.fontWeight??t.style.fontWeight,background:{...t.style.background,...l.background},outlineEnabled:l.strokeLayers?l.strokeLayers.length>0:t.style.outlineEnabled,shadowEnabled:l.shadowLayers?l.shadowLayers.length>0:t.style.shadowEnabled,strokeLayers:n,shadowLayers:a}}},ws=(t,s)=>({enabled:(s==null?void 0:s.enabled)??t.enabled,showGuides:(s==null?void 0:s.showTransformGuides)??t.showTransformGuides,coordinateSpace:t.coordinateSpace,canvasSize:t.canvasSize,position:(s==null?void 0:s.position)??t.position,size:(s==null?void 0:s.size)??t.size,rotation:(s==null?void 0:s.rotation)??t.rotation,scale2D:s==null?void 0:s.scale2D,referencePixelsPerUnit:s==null?void 0:s.referencePixelsPerUnit,pivot:(s==null?void 0:s.pivot)??t.pivot,renderOrder:(s==null?void 0:s.renderOrder)??t.renderOrder,overlay:(s==null?void 0:s.overlay)??t.overlay,visible:(s==null?void 0:s.visible)??t.visible}),Rn=(t,s)=>({...s,enabled:t.enabled,showTransformGuides:t.showGuides,coordinateSpace:t.coordinateSpace,canvasSize:t.canvasSize,position:t.position,size:t.size,rotation:t.rotation,pivot:t.pivot,renderOrder:t.renderOrder,overlay:t.overlay,visible:t.visible}),ks=(t,s)=>({...$e.DEFAULT_SCREEN_TRANSFORM_2D,...s,enabled:t.enabled,showTransformGuides:t.showGuides,position:t.position,size:t.size,rotation:t.rotation,scale2D:t.scale2D??(s==null?void 0:s.scale2D)??$e.DEFAULT_SCREEN_TRANSFORM_2D.scale2D,referencePixelsPerUnit:t.referencePixelsPerUnit??(s==null?void 0:s.referencePixelsPerUnit)??$e.DEFAULT_SCREEN_TRANSFORM_2D.referencePixelsPerUnit,pivot:t.pivot,renderOrder:t.renderOrder,overlay:t.overlay,visible:t.visible}),In={display:"flex",width:18,height:18,alignItems:"center",justifyContent:"center",borderRadius:6,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.08)",color:"#e2e8f0",flex:"0 0 auto"},En={borderRadius:12,border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.03)",overflow:"hidden"},Tn={display:"flex",alignItems:"center",gap:7,padding:"6px 7px"},zn={display:"flex",alignItems:"center",gap:6,fontSize:11,fontWeight:500,flex:"1 1 auto",minWidth:0},Mn={width:28,height:16,borderRadius:999,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.08)",padding:2,display:"flex",alignItems:"center",cursor:"pointer",flex:"0 0 auto"},Fn=t=>({width:10,height:10,borderRadius:999,background:t?"#f8fafc":"rgba(148,163,184,0.7)",transform:t?"translateX(12px)":"translateX(0)",transition:"transform 140ms ease, background 140ms ease"}),Wn={display:"grid",gap:7,padding:"0 7px 7px"},me={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},k={display:"flex",flexDirection:"column",gap:4},ee={...k,gridColumn:"1 / -1"},Ln={gridColumn:"1 / -1",display:"grid",gap:6,padding:"8px 8px 2px 12px",marginTop:-2,borderLeft:"1px solid rgba(255,255,255,0.10)"},$n={display:"flex",alignItems:"center",justifyContent:"space-between",gap:6,width:"100%",padding:0,border:0,background:"transparent",fontSize:9,color:"rgba(226,232,240,0.64)",textTransform:"uppercase",cursor:"pointer"},Nn={display:"flex",alignItems:"center",gap:6,minWidth:0},On={width:16,height:16,borderRadius:999,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"rgba(255,255,255,0.06)",color:"rgba(226,232,240,0.72)",flex:"0 0 auto"},S={fontSize:9,color:"rgba(226,232,240,0.72)"},Kt={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},An={...Kt,height:72,padding:"7px",resize:"vertical",lineHeight:1.35,fontFamily:"inherit"},je={...Kt,padding:2,cursor:"pointer"},xe={...Kt,appearance:"none"},Pn={opacity:.45,cursor:"not-allowed"},ue={display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:24},gt={width:16,height:16},Dn={display:"grid",gridTemplateColumns:"1.25fr repeat(4, 1fr)",gap:4,width:"100%"},Je=t=>({height:26,borderRadius:8,border:t?"1px solid rgba(125,211,252,0.72)":"1px solid rgba(255,255,255,0.10)",background:t?"rgba(56,189,248,0.20)":"rgba(255,255,255,0.05)",color:t?"#f0f9ff":"#e2e8f0",fontSize:10.5,fontWeight:700,cursor:"pointer",padding:"0 6px"}),wt={display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:8,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.05)",color:"#e2e8f0",cursor:"pointer",padding:0,flex:"0 0 auto"};function Bn({label:t,icon:s,open:l,onToggle:n,children:a}){return e.jsxs("div",{style:En,children:[e.jsxs("div",{style:Tn,children:[e.jsx("button",{type:"button",onClick:n,style:Mn,children:e.jsx("div",{style:Fn(l)})}),e.jsxs("div",{style:zn,children:[e.jsx("span",{style:In,children:s}),e.jsx("span",{children:t})]})]}),l?e.jsx("div",{style:Wn,children:a}):null]})}const Qt=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M4 6V4h16v2h-7v14h-2V6H4z"})}),es=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 3a9 9 0 1 0 0 18h1.2a2.8 2.8 0 0 0 0-5.6h-.4a1.8 1.8 0 0 1 0-3.6H16a5 5 0 0 0 0-10h-4zm-4 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm1 5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm6-7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z"})}),Vn=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M4 4h6v2H7.4l3.3 3.3-1.4 1.4L6 7.4V10H4V4zm10 0h6v6h-2V7.4l-3.3 3.3-1.4-1.4L16.6 6H14V4zM9.3 13.3l1.4 1.4L7.4 18H10v2H4v-6h2v2.6l3.3-3.3zm5.4 0 3.3 3.3V14h2v6h-6v-2h2.6l-3.3-3.3 1.4-1.4z"})}),Kn=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M7 5h10v2H9v6h8v2H7V5zm4 8h6v6h-6v-2h4v-2h-4v-2z"})});function Hn({value:t,onChange:s}){return e.jsxs("div",{style:me,children:[e.jsxs("label",{style:ee,children:[e.jsx("span",{style:S,children:"Text"}),e.jsx("textarea",{style:An,value:t.content.text,onChange:l=>s(n=>({...n,content:{...n.content,text:l.target.value}}))})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Text Art"}),e.jsx("select",{style:xe,value:t.textArtPreset,onChange:l=>s(n=>Cn(n,l.target.value)),children:Sn.map(l=>e.jsx("option",{value:l,children:vn[l]},l))})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Font"}),e.jsx("select",{style:xe,value:t.style.fontFamily,onChange:l=>s(n=>({...n,style:{...n.style,fontFamily:l.target.value}})),children:mn.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))})]})]})}const Gn={width:"100%",boxSizing:"border-box",border:"1px solid rgba(148,163,184,0.22)",borderRadius:8,background:"rgba(15,23,42,0.8)",color:"#e2e8f0",padding:"7px 9px"},_n=t=>/^-?\d*(\.\d*)?$/.test(t),z=({value:t,onChange:s,step:l=1,min:n,max:a,disabled:d=!1})=>{const[r,o]=y.useState(String(t));y.useEffect(()=>o(String(t)),[t]);const h=x=>Math.min(typeof a=="number"?a:1/0,Math.max(typeof n=="number"?n:-1/0,x));return e.jsx("input",{type:"text",inputMode:"decimal",pattern:"-?[0-9]*[.,]?[0-9]*",style:{...Gn,...d?{cursor:"not-allowed",opacity:.45}:{}},value:r,disabled:d,onChange:x=>{if(d)return;const c=x.target.value;if(!_n(c)||(o(c),["","-",".","-."].includes(c)))return;const p=Number(c);Number.isNaN(p)||s(h(p))},onBlur:()=>{if(d)return;const x=Number(r);if(Number.isNaN(x))return o(String(t));const c=h(x);o(String(c)),s(c)},onKeyDown:x=>{if(d||x.key!=="ArrowUp"&&x.key!=="ArrowDown")return;x.preventDefault();const c=x.shiftKey?l*10:x.altKey?l/10:l,p=x.key==="ArrowUp"?t+c:t-c;s(h(Number.isInteger(p)?p:Number(p.toFixed(6))))}})};function Un({background:t,onChange:s}){return e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Fill Mode"}),e.jsxs("select",{style:xe,value:t.fillMode,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,fillMode:l.target.value}}})),children:[e.jsx("option",{value:"solid",children:"solid"}),e.jsx("option",{value:"gradient",children:"gradient"})]})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Fill Area"}),e.jsxs("select",{style:xe,value:t.fit,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,fit:l.target.value}}})),children:[e.jsx("option",{value:"text",children:"text"}),e.jsx("option",{value:"full",children:"full"})]})]}),t.fillMode==="solid"?e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Background Color"}),e.jsx("input",{style:je,type:"color",value:t.color,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,color:l.target.value}}}))})]}):e.jsx("div",{style:{gridColumn:"1 / -1",display:"grid",gap:6},children:t.gradientStops.slice(0,3).map((l,n)=>e.jsxs("label",{style:k,children:[e.jsxs("span",{style:S,children:["Gradient ",n+1]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 60px",gap:4},children:[e.jsx("input",{style:je,type:"color",value:l.color,onChange:a=>s(d=>{const r=[...d.style.background.gradientStops];return r[n]={...r[n],color:a.target.value},{...d,style:{...d.style,background:{...d.style.background,gradientStops:r}}}})}),e.jsx(z,{value:l.position,min:0,max:1,step:.05,onChange:a=>s(d=>{const r=[...d.style.background.gradientStops];return r[n]={...r[n],position:a},{...d,style:{...d.style,background:{...d.style.background,gradientStops:r}}}})})]})]},n))}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Background Opacity"}),e.jsx(z,{value:t.opacity,min:0,max:1,step:.05,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,opacity:l}}}))})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Corner Radius"}),e.jsx(z,{value:t.borderRadius,min:0,max:200,step:2,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,borderRadius:l}}}))})]})]})}function Xn({background:t,onChange:s}){return e.jsxs(e.Fragment,{children:[e.jsx("label",{style:ee,children:e.jsxs("div",{style:ue,children:[e.jsx("span",{style:S,children:"Auto Width / Height"}),e.jsx("input",{type:"checkbox",style:gt,checked:t.autoSize,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,autoSize:l.target.checked}}}))})]})}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Width"}),e.jsx(z,{value:t.width,min:32,max:1024,step:8,disabled:t.autoSize,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,width:l}}}))})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Height"}),e.jsx(z,{value:t.height,min:32,max:1024,step:8,disabled:t.autoSize,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,height:l}}}))})]})]})}function Zn({background:t,onChange:s}){return e.jsxs(e.Fragment,{children:[e.jsx("label",{style:ee,children:e.jsxs("div",{style:ue,children:[e.jsx("span",{style:S,children:"Background Stroke"}),e.jsx("input",{type:"checkbox",style:gt,checked:t.borderEnabled,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,borderEnabled:l.target.checked,borderColor:l.target.checked&&n.style.background.borderColor==="transparent"?"#ffffff":n.style.background.borderColor,borderWidth:l.target.checked?Math.max(n.style.background.borderWidth,2):n.style.background.borderWidth}}}))})]})}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Stroke Color"}),e.jsx("input",{style:{...je,...t.borderEnabled?{}:Pn},type:"color",value:t.borderColor,disabled:!t.borderEnabled,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,borderColor:l.target.value}}}))})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Stroke Width"}),e.jsx(z,{value:t.borderWidth,min:0,max:64,step:1,disabled:!t.borderEnabled,onChange:l=>s(n=>({...n,style:{...n.style,background:{...n.style.background,borderWidth:l}}}))})]})]})}const Cs={gridColumn:"1 / -1",display:"grid",gap:6,padding:"8px",borderRadius:10,border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.03)"};function yt({checked:t,label:s,onChange:l}){return e.jsx("label",{style:ee,children:e.jsxs("div",{style:ue,children:[e.jsx("span",{style:S,children:s}),e.jsx("input",{type:"checkbox",style:gt,checked:t,onChange:n=>l(n.target.checked)})]})})}function Xe({children:t,label:s,open:l,setOpen:n}){return e.jsxs("div",{style:Ln,children:[e.jsxs("button",{type:"button",style:$n,onClick:()=>n(a=>!a),children:[e.jsxs("span",{style:Nn,children:[e.jsx(Kn,{}),e.jsx("span",{children:s})]}),e.jsx("span",{style:On,children:l?"−":"+"})]}),l?t:null]})}function Yn({value:t,onChange:s,open:l,setOpen:n}){const a=t.style.background;return e.jsxs(e.Fragment,{children:[e.jsx("label",{style:ee,children:e.jsxs("div",{style:ue,children:[e.jsx("span",{style:S,children:"Background Enabled"}),e.jsx("input",{type:"checkbox",style:gt,checked:a.enabled,onChange:d=>s(r=>({...r,style:{...r.style,background:{...r.style.background,enabled:d.target.checked}}}))})]})}),a.enabled?e.jsx(Xe,{label:"Background Settings",open:l,setOpen:n,children:e.jsxs(e.Fragment,{children:[e.jsx(Un,{background:a,onChange:s}),e.jsx(Zn,{background:a,onChange:s}),e.jsx(Xn,{background:a,onChange:s})]})}):null]})}function qn({bend:t,open:s,onChange:l,setOpen:n,value:a}){const d=r=>l(o=>({...o,style:{...o.style,bend:{...o.style.bend??t,...r}}}));return e.jsxs(e.Fragment,{children:[e.jsx(yt,{label:"Bend",checked:a.style.bendEnabled===!0,onChange:r=>l(o=>({...o,style:{...o.style,bendEnabled:r,bend:o.style.bend??vs()}}))}),a.style.bendEnabled===!0?e.jsx(Xe,{label:"Bend",open:s,setOpen:n,children:e.jsxs("div",{style:me,children:[e.jsxs("label",{style:ee,children:[e.jsx("span",{style:S,children:"Bend Preset"}),e.jsx("select",{style:xe,value:t.preset,onChange:r=>d({preset:r.target.value}),children:kn.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))})]}),e.jsxs("label",{style:ee,children:[e.jsx("span",{style:S,children:"Bend Strength"}),e.jsx(z,{value:t.strength,min:-100,max:100,step:1,onChange:r=>d({strength:r})})]})]})}):null]})}function Jn({glow:t,open:s,onChange:l,setOpen:n,value:a}){const d=r=>l(o=>({...o,style:{...o.style,glow:{...o.style.glow??t,...r}}}));return e.jsxs(e.Fragment,{children:[e.jsx(yt,{label:"Glow",checked:a.style.glowEnabled===!0,onChange:r=>l(o=>({...o,style:{...o.style,glowEnabled:r,glow:o.style.glow??Ss()}}))}),a.style.glowEnabled===!0?e.jsx(Xe,{label:"Glow",open:s,setOpen:n,children:e.jsxs("div",{style:me,children:[e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Color"}),e.jsx("input",{style:je,type:"color",value:t.color,onChange:r=>d({color:r.target.value})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Style"}),e.jsxs("select",{style:xe,value:t.style,onChange:r=>d({style:r.target.value}),children:[e.jsx("option",{value:"outward",children:"Outward"}),e.jsx("option",{value:"contoured",children:"Contoured"})]})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Intensity"}),e.jsx(z,{value:t.intensity??.5,min:0,max:1,step:.05,onChange:r=>d({intensity:r})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Range"}),e.jsx(z,{value:t.range??.5,min:0,max:1,step:.05,onChange:r=>d({range:r})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Horizontal Angle"}),e.jsx(z,{value:t.horizontalAngle??0,min:-.5,max:.5,step:.05,onChange:r=>d({horizontalAngle:r})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Vertical Angle"}),e.jsx(z,{value:t.verticalAngle??0,min:-.5,max:.5,step:.05,onChange:r=>d({verticalAngle:r})})]})]})}):null]})}const Qn={color:"#000000",opacity:1,offset:10,angle:-45,feather:0};function el({innerShadow:t,open:s,onChange:l,setOpen:n,value:a}){const d=r=>l(o=>({...o,style:{...o.style,innerShadow:{...o.style.innerShadow??t,...r}}}));return e.jsxs(e.Fragment,{children:[e.jsx(yt,{label:"Inner Shadow",checked:a.style.innerShadowEnabled===!0,onChange:r=>l(o=>({...o,style:{...o.style,innerShadowEnabled:r,innerShadow:o.style.innerShadow??Qn}}))}),a.style.innerShadowEnabled===!0?e.jsx(Xe,{label:"Inner Shadow",open:s,setOpen:n,children:e.jsxs("div",{style:me,children:[e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Shadow Color"}),e.jsx("input",{style:je,type:"color",value:t.color,onChange:r=>d({color:r.target.value})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Shadow Opacity"}),e.jsx(z,{value:t.opacity??1,min:0,max:1,step:.05,onChange:r=>d({opacity:r})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Shadow Offset"}),e.jsx(z,{value:t.offset??10,min:0,max:100,step:1,onChange:r=>d({offset:r})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Shadow Angle"}),e.jsx(z,{value:t.angle??-45,min:-180,max:180,step:1,onChange:r=>d({angle:r})})]}),e.jsxs("label",{style:ee,children:[e.jsx("span",{style:S,children:"Shadow Feather"}),e.jsx(z,{value:t.feather??0,min:0,max:1,step:.05,onChange:r=>d({feather:r})})]})]})}):null]})}function tl({layers:t,open:s,onChange:l,setOpen:n,value:a}){const d=(r,o)=>l(h=>{const x=[...h.style.strokeLayers??[]];return x[r]={...x[r],...o},{...h,style:{...h.style,strokeLayers:x}}});return e.jsxs(e.Fragment,{children:[e.jsx(yt,{label:"Outline",checked:a.style.outlineEnabled!==!1,onChange:r=>l(o=>({...o,style:{...o.style,outlineEnabled:r}}))}),a.style.outlineEnabled!==!1?e.jsx(Xe,{label:"Outline Editor",open:s,setOpen:n,children:e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{...ue,gridColumn:"1 / -1"},children:[e.jsxs("span",{style:S,children:["Layers: ",t.length]}),e.jsx("button",{type:"button",style:wt,onClick:()=>l(r=>({...r,style:{...r.style,strokeLayers:[...r.style.strokeLayers??[],wn()]}})),children:"+"})]}),t.length>0?t.map((r,o)=>e.jsxs("div",{style:Cs,children:[e.jsxs("div",{style:ue,children:[e.jsxs("span",{style:S,children:["Outline ",o+1]}),e.jsx("button",{type:"button",style:wt,onClick:()=>l(h=>({...h,style:{...h.style,strokeLayers:(h.style.strokeLayers??[]).filter((x,c)=>c!==o)}})),children:"×"})]}),e.jsxs("div",{style:me,children:[e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Outline Color"}),e.jsx("input",{style:je,type:"color",value:r.color,onChange:h=>d(o,{color:h.target.value})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Outline Opacity"}),e.jsx(z,{value:r.opacity??1,min:0,max:1,step:.05,onChange:h=>d(o,{opacity:h})})]}),e.jsxs("label",{style:ee,children:[e.jsx("span",{style:S,children:"Outline Size"}),e.jsx(z,{value:r.width,min:0,max:100,step:1,onChange:h=>d(o,{width:h})})]})]})]},o)):e.jsx("div",{style:{...S,gridColumn:"1 / -1"},children:"No outlines. Use `+` to add one."})]})}):null]})}function sl({layers:t,open:s,onChange:l,setOpen:n,value:a}){const d=(r,o)=>l(h=>{const x=[...h.style.shadowLayers??[]];return x[r]={...x[r],...o},{...h,style:{...h.style,shadowLayers:x}}});return e.jsxs(e.Fragment,{children:[e.jsx(yt,{label:"Outer Shadow",checked:a.style.shadowEnabled!==!1,onChange:r=>l(o=>{var h;return{...o,style:{...o.style,shadowEnabled:r,shadowLayers:r&&(((h=o.style.shadowLayers)==null?void 0:h.length)??0)===0?[Bt()]:o.style.shadowLayers}}})}),a.style.shadowEnabled!==!1?e.jsx(Xe,{label:"Shadow Editor",open:s,setOpen:n,children:e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{...ue,gridColumn:"1 / -1"},children:[e.jsxs("span",{style:S,children:["Layers: ",t.length]}),e.jsx("button",{type:"button",style:wt,onClick:()=>l(r=>({...r,style:{...r.style,shadowLayers:[...r.style.shadowLayers??[],Bt()]}})),children:"+"})]}),t.length>0?t.map((r,o)=>e.jsxs("div",{style:Cs,children:[e.jsxs("div",{style:ue,children:[e.jsxs("span",{style:S,children:["Shadow ",o+1]}),e.jsx("button",{type:"button",style:wt,onClick:()=>l(h=>({...h,style:{...h.style,shadowLayers:(h.style.shadowLayers??[]).filter((x,c)=>c!==o)}})),children:"×"})]}),e.jsxs("div",{style:me,children:[e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Shadow Color"}),e.jsx("input",{style:je,type:"color",value:r.color,onChange:h=>d(o,{color:h.target.value})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Shadow Opacity"}),e.jsx(z,{value:r.opacity??1,min:0,max:1,step:.05,onChange:h=>d(o,{opacity:h})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Shadow Offset"}),e.jsx(z,{value:r.offset??10,min:0,max:100,step:1,onChange:h=>d(o,{offset:h})})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Shadow Angle"}),e.jsx(z,{value:r.angle??-45,min:-180,max:180,step:1,onChange:h=>d(o,{angle:h})})]}),e.jsxs("label",{style:ee,children:[e.jsx("span",{style:S,children:"Shadow Feather"}),e.jsx(z,{value:r.feather??0,min:0,max:1,step:.05,onChange:h=>d(o,{feather:h})})]})]})]},o)):e.jsx("div",{style:{...S,gridColumn:"1 / -1"},children:"No outer shadows. Use `+` to add one."})]})}):null]})}function nl({backgroundSettingsOpen:t,bend:s,bendSettingsOpen:l,glow:n,glowSettingsOpen:a,innerShadow:d,innerShadowSettingsOpen:r,onChange:o,outlineLayers:h,outlineSettingsOpen:x,setBackgroundSettingsOpen:c,setBendSettingsOpen:p,setGlowSettingsOpen:f,setInnerShadowSettingsOpen:g,setOutlineSettingsOpen:i,setShadowSettingsOpen:u,shadowLayers:j,shadowSettingsOpen:w,value:v}){return e.jsxs("div",{style:me,children:[e.jsx(tl,{value:v,onChange:o,layers:h,open:x,setOpen:i}),e.jsx(sl,{value:v,onChange:o,layers:j,open:w,setOpen:u}),e.jsx(el,{value:v,onChange:o,innerShadow:d,open:a,setOpen:f}),e.jsx(Jn,{value:v,onChange:o,glow:n,open:r,setOpen:g}),e.jsx(qn,{value:v,onChange:o,bend:s,open:l,setOpen:p}),e.jsx(Yn,{value:v,onChange:o,open:t,setOpen:c})]})}function ll({value:t,onChange:s}){const l=t.style.bold===!0||t.style.fontStyle==="italic"||t.style.underline===!0||t.style.strikethrough===!0;return e.jsxs("div",{style:me,children:[e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Text Color"}),e.jsx("input",{style:je,type:"color",value:t.style.color,onChange:n=>s(a=>({...a,style:{...a.style,color:n.target.value}}))})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Font Size"}),e.jsx(z,{value:t.style.fontSize,min:16,max:180,step:4,onChange:n=>s(a=>({...a,layout:{...a.layout,minFontSize:Math.min(a.layout.minFontSize??n,n)},style:{...a.style,fontSize:n}}))})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Letter Spacing"}),e.jsx(z,{value:t.style.letterSpacing,min:0,max:1,step:.05,onChange:n=>s(a=>({...a,style:{...a.style,letterSpacing:n}}))})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Line Spacing"}),e.jsx(z,{value:t.style.lineSpacing,min:0,max:1,step:.05,onChange:n=>s(a=>({...a,style:{...a.style,lineSpacing:n}}))})]}),e.jsxs("div",{style:ee,children:[e.jsx("span",{style:S,children:"Text Style"}),e.jsxs("div",{style:Dn,children:[e.jsx("button",{type:"button",style:Je(!l),onClick:()=>s(n=>({...n,style:{...n.style,bold:!1,fontWeight:n.style.fontWeight==="bold"?"normal":n.style.fontWeight,fontStyle:"normal",underline:!1,strikethrough:!1}})),children:"None"}),e.jsx("button",{type:"button",style:Je(t.style.bold===!0),onClick:()=>s(n=>({...n,style:{...n.style,bold:n.style.bold!==!0,fontWeight:n.style.bold!==!0?"bold":400}})),children:"B"}),e.jsx("button",{type:"button",style:Je(t.style.fontStyle==="italic"),onClick:()=>s(n=>({...n,style:{...n.style,fontStyle:n.style.fontStyle==="italic"?"normal":"italic"}})),children:"I"}),e.jsx("button",{type:"button",style:Je(t.style.underline===!0),onClick:()=>s(n=>({...n,style:{...n.style,underline:n.style.underline!==!0}})),children:"U"}),e.jsx("button",{type:"button",style:Je(t.style.strikethrough===!0),onClick:()=>s(n=>({...n,style:{...n.style,strikethrough:n.style.strikethrough!==!0}})),children:"S"})]})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Horizontal Alignment"}),e.jsxs("select",{style:xe,value:t.layout.textAlign??"center",onChange:n=>s(a=>({...a,layout:{...a.layout,textAlign:n.target.value}})),children:[e.jsx("option",{value:"left",children:"left"}),e.jsx("option",{value:"center",children:"center"}),e.jsx("option",{value:"right",children:"right"})]})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Vertical Alignment"}),e.jsxs("select",{style:xe,value:t.layout.verticalAlign??"center",onChange:n=>s(a=>({...a,layout:{...a.layout,verticalAlign:n.target.value}})),children:[e.jsx("option",{value:"top",children:"top"}),e.jsx("option",{value:"center",children:"center"}),e.jsx("option",{value:"bottom",children:"bottom"})]})]}),e.jsxs("label",{style:k,children:[e.jsx("span",{style:S,children:"Overflow"}),e.jsxs("select",{style:xe,value:t.layout.overflow,onChange:n=>s(a=>({...a,layout:{...a.layout,overflow:n.target.value}})),children:[e.jsx("option",{value:"clip",children:"Clip text"}),e.jsx("option",{value:"ellipsis",children:"Show ellipsis"}),e.jsx("option",{value:"clamp",children:"Clamp"}),e.jsx("option",{value:"shrink",children:"Shrink"})]})]}),e.jsx("label",{style:ee,children:e.jsxs("div",{style:ue,children:[e.jsx("span",{style:S,children:"Resize To Fit"}),e.jsx("input",{type:"checkbox",style:gt,checked:t.layout.resizeToFit===!0,onChange:n=>s(a=>({...a,layout:{...a.layout,resizeToFit:n.target.checked}}))})]})})]})}const il={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},re={display:"flex",flexDirection:"column",gap:4},Et={...re,gridColumn:"1 / -1"},Y={fontSize:9,color:"rgba(226,232,240,0.72)"},ol={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},rl={...ol,fontVariantNumeric:"tabular-nums"},al={display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:24},dl={width:16,height:16},cl=t=>/^-?\d*(\.\d*)?$/.test(t),se=({value:t,onChange:s,step:l=1,min:n,max:a,disabled:d=!1})=>{const[r,o]=y.useState(String(t));y.useEffect(()=>o(String(t)),[t]);const h=x=>{let c=x;return typeof n=="number"&&(c=Math.max(n,c)),typeof a=="number"&&(c=Math.min(a,c)),c};return e.jsx("input",{type:"text",inputMode:"decimal",pattern:"-?[0-9]*[.,]?[0-9]*",style:rl,value:r,disabled:d,onChange:x=>{const c=x.target.value;if(!cl(c)||(o(c),c===""||c==="-"||c==="."||c==="-."))return;const p=Number(c);Number.isNaN(p)||s(h(p))},onBlur:()=>{const x=Number(r);if(Number.isNaN(x)){o(String(t));return}const c=h(x);o(String(c)),s(c)},onKeyDown:x=>{if(x.key!=="ArrowUp"&&x.key!=="ArrowDown")return;x.preventDefault();const c=x.shiftKey?l*10:x.altKey?l/10:l,p=x.key==="ArrowUp"?t+c:t-c;s(h(Number.isInteger(p)?p:Number(p.toFixed(6))))}})},Ht=({value:t,onChange:s,guideLabel:l,showRenderOrder:n=!0})=>{var a,d;return e.jsxs("div",{style:il,children:[e.jsxs("label",{style:re,children:[e.jsx("span",{style:Y,children:"Position X"}),e.jsx(se,{value:t.position.x,min:-4096,max:4096,step:1,onChange:r=>s({...t,position:{...t.position,x:r}})})]}),e.jsxs("label",{style:re,children:[e.jsx("span",{style:Y,children:"Position Y"}),e.jsx(se,{value:t.position.y,min:-4096,max:4096,step:1,onChange:r=>s({...t,position:{...t.position,y:r}})})]}),e.jsxs("label",{style:re,children:[e.jsx("span",{style:Y,children:"Size X"}),e.jsx(se,{value:t.size.width,min:0,max:8192,step:1,onChange:r=>s({...t,size:{...t.size,width:r}})})]}),e.jsxs("label",{style:re,children:[e.jsx("span",{style:Y,children:"Size Y"}),e.jsx(se,{value:t.size.height,min:0,max:8192,step:1,onChange:r=>s({...t,size:{...t.size,height:r}})})]}),e.jsxs("label",{style:Et,children:[e.jsx("span",{style:Y,children:"Rotation"}),e.jsx(se,{value:t.rotation,min:-360,max:360,step:1,onChange:r=>s({...t,rotation:r})})]}),e.jsxs("label",{style:re,children:[e.jsx("span",{style:Y,children:"Scale 2D X"}),e.jsx(se,{value:((a=t.scale2D)==null?void 0:a.x)??1,min:-10,max:10,step:.01,onChange:r=>{var o;return s({...t,scale2D:{x:r,y:((o=t.scale2D)==null?void 0:o.y)??1}})}})]}),e.jsxs("label",{style:re,children:[e.jsx("span",{style:Y,children:"Scale 2D Y"}),e.jsx(se,{value:((d=t.scale2D)==null?void 0:d.y)??1,min:-10,max:10,step:.01,onChange:r=>{var o;return s({...t,scale2D:{x:((o=t.scale2D)==null?void 0:o.x)??1,y:r}})}})]}),e.jsxs("label",{style:Et,children:[e.jsx("span",{style:Y,children:"Reference Pixels Per Unit"}),e.jsx(se,{value:t.referencePixelsPerUnit??32,min:1,max:512,step:1,onChange:r=>s({...t,referencePixelsPerUnit:r})})]}),n?e.jsxs("label",{style:re,children:[e.jsx("span",{style:Y,children:"Render Order"}),e.jsx(se,{value:t.renderOrder,min:-9999,max:9999,step:1,onChange:r=>s({...t,renderOrder:r})})]}):null,e.jsxs("label",{style:re,children:[e.jsx("span",{style:Y,children:"Pivot X"}),e.jsx(se,{value:t.pivot[0],min:0,max:1,step:.01,onChange:r=>s({...t,pivot:[r,t.pivot[1]]})})]}),e.jsxs("label",{style:re,children:[e.jsx("span",{style:Y,children:"Pivot Y"}),e.jsx(se,{value:t.pivot[1],min:0,max:1,step:.01,onChange:r=>s({...t,pivot:[t.pivot[0],r]})})]}),e.jsx("label",{style:Et,children:e.jsxs("div",{style:al,children:[e.jsx("span",{style:Y,children:l}),e.jsx("input",{type:"checkbox",style:dl,checked:t.showGuides,onChange:r=>s({...t,showGuides:r.target.checked})})]})})]})};function pl({value:t,onChange:s}){return e.jsx(Ht,{value:ws(t.transformation,t.screenTransform),guideLabel:"Transform Control On",showRenderOrder:!1,onChange:l=>s(n=>({...n,transformation:Rn(l,n.transformation),screenTransform:ks(l,n.screenTransform)}))})}const hl=({value:t,onChange:s,copyLabel:l,inspector:n,docked:a})=>{var Ze;const[d,r]=y.useState(()=>K.createSceneObject({name:l??"Screen Text",renderGroupId:Le.DEFAULT_RENDER_GROUP_IDS.screen2d})),[o]=y.useState(()=>{const $=d.id,Z=K.createDefaultComponent("ScreenTransform",$),m=K.createDefaultComponent("ScreenText",$),R=K.createDefaultComponent("Material",$),D=K.createDefaultComponent("Texture",$);return{screenTransform:Z,screenText:m,material:R,texture:D}}),[h,x]=y.useState(!0),[c,p]=y.useState(!0),[f,g]=y.useState(!0),[i,u]=y.useState(!0),[j,w]=y.useState(!0),[v,M]=y.useState(!0),[U,b]=y.useState({text2d:!0,content:!0,transformation:!0,style:!0,textEffect:!0}),F=ws(t.screenText.transformation,t.screenText.screenTransform),E={object:{...d,componentIds:[o.screenTransform.id,o.screenText.id,o.material.id,o.texture.id]},kind:"screenText",components:[{...o.screenTransform,settings:t.screenText.screenTransform??ks(F)},{...o.screenText,settings:t.screenText},{...o.material,settings:{...o.material.settings,color:t.screenText.style.color,opacity:t.screenText.style.opacity}},{...o.texture,settings:{...o.texture.settings,url:t.screenText.style.background.textureUrl,flipX:t.screenText.style.background.textureFlipX,flipY:t.screenText.style.background.textureFlipY}}],scene:{screenSpaceUI:t.screenSpaceUI}},P=$=>{s({...t,screenText:$(t.screenText)})},le=t.screenText.style.strokeLayers??[],ae=t.screenText.style.shadowEnabled!==!1&&(((Ze=t.screenText.style.shadowLayers)==null?void 0:Ze.length)??0)===0?[Bt()]:t.screenText.style.shadowLayers??[],L=t.screenText.style.innerShadow??{color:"#000000",opacity:1,offset:10,angle:-45,feather:0},Pe=t.screenText.style.glow??Ss(),De=t.screenText.style.bend??vs(),W=$=>b(Z=>({...Z,[$]:!Z[$]})),ve=($,Z,m,R)=>e.jsx(Bn,{label:Z,icon:m,open:U[$],onToggle:()=>W($),children:R},$);return e.jsxs(Ct,{objectId:(n==null?void 0:n.objectId)??d.id,objectName:(n==null?void 0:n.objectName)??d.name,onObjectNameChange:(n==null?void 0:n.onObjectNameChange)??($=>r(Z=>({...Z,name:$}))),layer:(n==null?void 0:n.layer)??"Default Layer",visible:(n==null?void 0:n.visible)??t.screenText.enabled,onVisibleChange:(n==null?void 0:n.onVisibleChange)??($=>P(Z=>({...Z,enabled:$}))),copyConfig:(n==null?void 0:n.copyConfig)??E,docked:a??(n==null?void 0:n.docked),initialPosition:n==null?void 0:n.initialPosition,position:n==null?void 0:n.position,onPositionChange:n==null?void 0:n.onPositionChange,title:n==null?void 0:n.title,children:[ve("transformation","Transformation",e.jsx(Vn,{}),e.jsx(pl,{value:t.screenText,onChange:P})),ve("text2d","2D Text",e.jsx(Qt,{}),e.jsxs(e.Fragment,{children:[ve("content","Content",e.jsx(Qt,{}),e.jsx(Hn,{value:t.screenText,onChange:P})),ve("style","Style",e.jsx(es,{}),e.jsx(ll,{value:t.screenText,onChange:P})),ve("textEffect","Text Effect",e.jsx(es,{}),e.jsx(nl,{value:t.screenText,onChange:P,outlineLayers:le,shadowLayers:ae,innerShadow:L,glow:Pe,bend:De,outlineSettingsOpen:h,setOutlineSettingsOpen:x,shadowSettingsOpen:c,setShadowSettingsOpen:p,innerShadowSettingsOpen:f,setInnerShadowSettingsOpen:g,glowSettingsOpen:i,setGlowSettingsOpen:u,bendSettingsOpen:j,setBendSettingsOpen:w,backgroundSettingsOpen:v,setBackgroundSettingsOpen:M}))]}))]})},xl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtAAAAUAAgMAAAAToI2uAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAlQTFRFqampbGxsAAAA/lGquwAAAAN0Uk5T//8A18oNQQAABPRJREFUeJztzssNQWEYQEG3CP1oQqJGsdCfBFs7j8X8+eRMBbPtBtpWB35RWimtlFZKK6WV0kppZWj6uLrwrceltFFaKa2UVkorpZXSSmlldPp2XT350P5Q2iitlFZKK6WV0kpppbRSWimtlFZKK3+RPq8OvXM/lTZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK6WV0kpppbRSWimtlFZKK3+THqG0UloprZRWSiulldJKaaW0UloprZRWSiuv6VFKK6WV0kpppbRSWimtlFbGpgcqrZRWSiulldJKaaW0MjL9BFWtRqVFuJpUAAAAAElFTkSuQmCC",ul={placeholder:"Placeholder","hero-image":"Hero Image","photo-frame":"Default Frame"},gl=Object.entries(ul).map(([t,s])=>({value:t,label:s})),yl={placeholder:{transformation:{showFitGuides:!1},image:{sourceKind:"default",stretchMode:"fit",materialType:"unlit",blendMode:"normal",opacity:1,color:"#ffffff",flipX:!1,flipY:!1,transparent:!0,alphaTest:0}},"hero-image":{transformation:{position:{x:0,y:.08},size:{width:.96,height:.62},rotation:0,pivot:[.5,.5],overlay:!0,visible:!0},image:{sourceKind:"image",stretchMode:"fillAndCut",materialType:"unlit",blendMode:"normal",opacity:1,color:"#ffffff",flipX:!1,flipY:!1,transparent:!0,alphaTest:0}},"photo-frame":{transformation:{position:{x:0,y:.01},size:{width:2,height:2},rotation:0,pivot:[.5,.5],overlay:!0,visible:!0},image:{sourceKind:"image",src:xl,stretchMode:"fill",materialType:"unlit",blendMode:"normal",opacity:1,color:"#ffffff",flipX:!1,flipY:!1,transparent:!0,alphaTest:0}}},bl=(t,s)=>{const l=yl[s];return{...t,preset:s,...l.enabled!==void 0?{enabled:l.enabled}:{},transformation:{...t.transformation,...l.transformation??{}},image:{...t.image,...l.image??{}}}},fl={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},ct={display:"flex",flexDirection:"column",gap:4},jl={...ct,gridColumn:"1 / -1"},Qe={fontSize:9,color:"rgba(226,232,240,0.72)"},Gt={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},ts={...Gt,appearance:"none"},ml={...Gt,fontVariantNumeric:"tabular-nums"},Sl={...Gt,padding:2,cursor:"pointer"},vl=t=>/^-?\d*(\.\d*)?$/.test(t),ss=({value:t,onChange:s,step:l=1,min:n,max:a})=>{const[d,r]=y.useState(String(t));y.useEffect(()=>r(String(t)),[t]);const o=h=>{let x=h;return typeof n=="number"&&(x=Math.max(n,x)),typeof a=="number"&&(x=Math.min(a,x)),x};return e.jsx("input",{type:"text",inputMode:"decimal",pattern:"-?[0-9]*[.,]?[0-9]*",style:ml,value:d,onChange:h=>{const x=h.target.value;if(!vl(x)||(r(x),x===""||x==="-"||x==="."||x==="-."))return;const c=Number(x);Number.isNaN(c)||s(o(c))},onBlur:()=>{const h=Number(d);if(Number.isNaN(h)){r(String(t));return}const x=o(h);r(String(x)),s(x)},onKeyDown:h=>{if(h.key!=="ArrowUp"&&h.key!=="ArrowDown")return;h.preventDefault();const x=h.shiftKey?l*10:h.altKey?l/10:l,c=h.key==="ArrowUp"?t+x:t-x;s(o(Number.isInteger(c)?c:Number(c.toFixed(6))))}})},wl=({value:t,onChange:s})=>e.jsxs("div",{style:fl,children:[e.jsxs("label",{style:ct,children:[e.jsx("span",{style:Qe,children:"Material Type"}),e.jsxs("select",{style:ts,value:t.materialType,onChange:l=>s({...t,materialType:l.target.value}),children:[e.jsx("option",{value:"unlit",children:"Unlit"}),e.jsx("option",{value:"standardPBR",children:"Standard PBR"}),e.jsx("option",{value:"matcap",children:"Matcap"})]})]}),e.jsxs("label",{style:ct,children:[e.jsx("span",{style:Qe,children:"Blend Mode"}),e.jsxs("select",{style:ts,value:t.blendMode,onChange:l=>s({...t,blendMode:l.target.value}),children:[e.jsx("option",{value:"normal",children:"Normal"}),e.jsx("option",{value:"add",children:"Add"}),e.jsx("option",{value:"subtract",children:"Subtract"}),e.jsx("option",{value:"multiply",children:"Multiply"}),e.jsx("option",{value:"screen",children:"Screen"}),e.jsx("option",{value:"lighten",children:"Lighten"}),e.jsx("option",{value:"darken",children:"Darken"}),e.jsx("option",{value:"overlay",children:"Overlay"}),e.jsx("option",{value:"softLight",children:"Soft Light"}),e.jsx("option",{value:"hardLight",children:"Hard Light"}),e.jsx("option",{value:"difference",children:"Difference"}),e.jsx("option",{value:"exclusion",children:"Exclusion"})]})]}),e.jsxs("label",{style:ct,children:[e.jsx("span",{style:Qe,children:"Opacity"}),e.jsx(ss,{value:t.opacity,min:0,max:1,step:.01,onChange:l=>s({...t,opacity:l})})]}),e.jsxs("label",{style:ct,children:[e.jsx("span",{style:Qe,children:"Tint"}),e.jsx("input",{type:"color",style:Sl,value:t.color,onChange:l=>s({...t,color:l.target.value})})]}),e.jsxs("label",{style:jl,children:[e.jsx("span",{style:Qe,children:"Alpha Test"}),e.jsx(ss,{value:t.alphaTest,min:0,max:1,step:.01,onChange:l=>s({...t,alphaTest:l})})]})]}),kl={display:"flex",width:18,height:18,alignItems:"center",justifyContent:"center",borderRadius:6,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.08)",color:"#e2e8f0",flex:"0 0 auto"},Cl={borderRadius:12,border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.03)",overflow:"hidden"},Rl={display:"flex",alignItems:"center",gap:7,padding:"6px 7px"},Il={display:"flex",alignItems:"center",gap:6,fontSize:11,fontWeight:500,flex:"1 1 auto",minWidth:0},El={width:28,height:16,borderRadius:999,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.08)",padding:2,display:"flex",alignItems:"center",cursor:"pointer",flex:"0 0 auto"},Tl=t=>({width:10,height:10,borderRadius:999,background:t?"#f8fafc":"rgba(148,163,184,0.7)",transform:t?"translateX(12px)":"translateX(0)",transition:"transform 140ms ease, background 140ms ease"}),zl={display:"grid",gap:7,padding:"0 7px 7px"},Ml={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},pt={display:"flex",flexDirection:"column",gap:4},Tt={...pt,gridColumn:"1 / -1"},we={fontSize:9,color:"rgba(226,232,240,0.72)"},Rs={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},zt={...Rs,appearance:"none"},Mt={display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:24},Ft={width:16,height:16},Fl=[{value:"default",label:"Default"},{value:"image",label:"Image"},{value:"gif",label:"GIF"}],Wl=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zm0 2v8.76l4.5-4.5 3.2 3.2 2.8-2.8L19 14.16V6H5zm12 3a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})}),Ll=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M11 2h2v4h3l-4 4-4-4h3V2zm0 20v-4H8l4-4 4 4h-3v4h-2zM2 11h4V8l4 4-4 4v-3H2v-2zm20 0v2h-4v3l-4-4 4-4v3h4z"})}),$l=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 2 3 7v10l9 5 9-5V7l-9-5zm0 2.3L17.9 7 12 9.7 6.1 7 12 4.3zM5 8.5l6 2.7v7.9l-6-3.3V8.5zm8 10.6v-7.9l6-2.7v7.3l-6 3.3z"})}),ns=(t,s)=>({enabled:(s==null?void 0:s.enabled)??t.enabled,showGuides:(s==null?void 0:s.showTransformGuides)??t.showFitGuides,coordinateSpace:t.coordinateSpace,canvasSize:t.canvasSize,position:(s==null?void 0:s.position)??t.position,size:(s==null?void 0:s.size)??t.size,rotation:(s==null?void 0:s.rotation)??t.rotation,scale2D:s==null?void 0:s.scale2D,referencePixelsPerUnit:s==null?void 0:s.referencePixelsPerUnit,pivot:(s==null?void 0:s.pivot)??t.pivot,renderOrder:(s==null?void 0:s.renderOrder)??t.renderOrder,overlay:(s==null?void 0:s.overlay)??t.overlay,visible:(s==null?void 0:s.visible)??t.visible}),Nl=(t,s)=>({...s,enabled:t.enabled,showFitGuides:t.showGuides,coordinateSpace:t.coordinateSpace,canvasSize:t.canvasSize,position:t.position,size:t.size,rotation:t.rotation,pivot:t.pivot,renderOrder:t.renderOrder,overlay:t.overlay,visible:t.visible}),ls=(t,s)=>({...$e.DEFAULT_SCREEN_TRANSFORM_2D,...s,enabled:t.enabled,showTransformGuides:t.showGuides,position:t.position,size:t.size,rotation:t.rotation,scale2D:t.scale2D??(s==null?void 0:s.scale2D)??$e.DEFAULT_SCREEN_TRANSFORM_2D.scale2D,referencePixelsPerUnit:t.referencePixelsPerUnit??(s==null?void 0:s.referencePixelsPerUnit)??$e.DEFAULT_SCREEN_TRANSFORM_2D.referencePixelsPerUnit,pivot:t.pivot,renderOrder:t.renderOrder,overlay:t.overlay,visible:t.visible}),Ol=({value:t,onChange:s,copyLabel:l,inspector:n,docked:a})=>{const[d,r]=y.useState(()=>K.createSceneObject({name:l??"Screen Image",renderGroupId:Le.DEFAULT_RENDER_GROUP_IDS.screen2d})),[o]=y.useState(()=>{const i=d.id,u=K.createDefaultComponent("ScreenTransform",i),j=K.createDefaultComponent("ScreenImage",i),w=K.createDefaultComponent("Material",i),v=K.createDefaultComponent("Texture",i);return{screenTransform:u,screenImage:j,material:w,texture:v}}),[h,x]=y.useState({transformation:!0,image:!0,material:!0}),c=ns(t.screenImage.transformation,t.screenImage.screenTransform),p={object:{...d,componentIds:[o.screenTransform.id,o.screenImage.id,o.material.id,o.texture.id]},kind:"screenImage",components:[{...o.screenTransform,settings:t.screenImage.screenTransform??ls(c)},{...o.screenImage,settings:t.screenImage},{...o.material,settings:{...o.material.settings,color:t.screenImage.image.color,opacity:t.screenImage.image.opacity}},{...o.texture,settings:{...o.texture.settings,url:t.screenImage.image.src||void 0,flipX:t.screenImage.image.flipX,flipY:t.screenImage.image.flipY}}],scene:{screenSpaceUI:t.screenSpaceUI}},f=i=>{s({...t,screenImage:i(t.screenImage)})},g=(i,u,j,w)=>e.jsxs("div",{style:Cl,children:[e.jsxs("div",{style:Rl,children:[e.jsx("button",{type:"button",onClick:()=>x(v=>({...v,[i]:!v[i]})),style:El,children:e.jsx("div",{style:Tl(h[i])})}),e.jsxs("div",{style:Il,children:[e.jsx("span",{style:kl,children:j}),e.jsx("span",{children:u})]})]}),h[i]?e.jsx("div",{style:zl,children:w}):null]},i);return e.jsxs(Ct,{objectId:(n==null?void 0:n.objectId)??d.id,objectName:(n==null?void 0:n.objectName)??d.name,onObjectNameChange:(n==null?void 0:n.onObjectNameChange)??(i=>r(u=>({...u,name:i}))),layer:(n==null?void 0:n.layer)??"Default Layer",visible:(n==null?void 0:n.visible)??t.screenImage.enabled,onVisibleChange:(n==null?void 0:n.onVisibleChange)??(i=>f(u=>({...u,enabled:i}))),copyConfig:(n==null?void 0:n.copyConfig)??p,docked:a??(n==null?void 0:n.docked),initialPosition:n==null?void 0:n.initialPosition,position:n==null?void 0:n.position,onPositionChange:n==null?void 0:n.onPositionChange,title:n==null?void 0:n.title,children:[g("transformation","Transformation",e.jsx(Ll,{}),e.jsx(Ht,{value:ns(t.screenImage.transformation,t.screenImage.screenTransform),guideLabel:"Transform Control On",showRenderOrder:!1,onChange:i=>f(u=>({...u,transformation:Nl(i,u.transformation),screenTransform:ls(i,u.screenTransform)}))})),g("image","Image",e.jsx(Wl,{}),e.jsxs("div",{style:{display:"grid",gap:6},children:[e.jsxs("label",{style:pt,children:[e.jsx("span",{style:we,children:"Preset"}),e.jsx("select",{style:zt,value:t.screenImage.preset,onChange:i=>f(u=>bl(u,i.target.value)),children:gl.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))})]}),e.jsxs("label",{style:pt,children:[e.jsx("span",{style:we,children:"Source Kind"}),e.jsx("select",{style:zt,value:t.screenImage.image.sourceKind,onChange:i=>f(u=>({...u,image:{...u.image,sourceKind:i.target.value}})),children:Fl.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))})]}),t.screenImage.image.sourceKind==="image"||t.screenImage.image.sourceKind==="gif"?e.jsxs("label",{style:pt,children:[e.jsx("span",{style:we,children:"Source URL"}),e.jsx("input",{style:Rs,value:t.screenImage.image.src,onChange:i=>f(u=>({...u,image:{...u.image,src:i.target.value}}))})]}):null,e.jsxs("label",{style:pt,children:[e.jsx("span",{style:we,children:"Stretch Mode"}),e.jsxs("select",{style:zt,value:t.screenImage.image.stretchMode,onChange:i=>f(u=>({...u,image:{...u.image,stretchMode:i.target.value}})),children:[e.jsx("option",{value:"fit",children:"Fit"}),e.jsx("option",{value:"fitWidth",children:"Fit Width"}),e.jsx("option",{value:"fitHeight",children:"Fit Height"}),e.jsx("option",{value:"center",children:"Center"}),e.jsx("option",{value:"stretch",children:"Stretch"}),e.jsx("option",{value:"fill",children:"Fill"}),e.jsx("option",{value:"fillAndCut",children:"Fill and Cut"})]})]}),e.jsx("label",{style:Tt,children:e.jsxs("div",{style:Mt,children:[e.jsx("span",{style:we,children:"Flip X"}),e.jsx("input",{type:"checkbox",style:Ft,checked:t.screenImage.image.flipX,onChange:i=>f(u=>({...u,image:{...u.image,flipX:i.target.checked}}))})]})}),e.jsx("label",{style:Tt,children:e.jsxs("div",{style:Mt,children:[e.jsx("span",{style:we,children:"Flip Y"}),e.jsx("input",{type:"checkbox",style:Ft,checked:t.screenImage.image.flipY,onChange:i=>f(u=>({...u,image:{...u.image,flipY:i.target.checked}}))})]})})]})),g("material","Material",e.jsx($l,{}),e.jsxs("div",{style:Ml,children:[e.jsx(wl,{value:t.screenImage.image,onChange:i=>f(u=>({...u,image:{...u.image,materialType:i.materialType,blendMode:i.blendMode,opacity:i.opacity,color:i.color,alphaTest:i.alphaTest}}))}),e.jsx("label",{style:Tt,children:e.jsxs("div",{style:Mt,children:[e.jsx("span",{style:we,children:"Transparent"}),e.jsx("input",{type:"checkbox",style:Ft,checked:t.screenImage.image.transparent,onChange:i=>f(u=>({...u,image:{...u.image,transparent:i.target.checked}}))})]})})]}))]})},_e={display:"grid",gridTemplateColumns:"92px minmax(0,1fr)",alignItems:"center",gap:10,margin:"8px 0",color:"#cbd5e1",fontSize:12},We={width:"100%",boxSizing:"border-box",padding:"8px 9px",border:"1px solid rgba(148,163,184,.16)",borderRadius:6,background:"rgba(15,23,42,.72)",color:"#e2e8f0"},Al=({onChange:t,value:s})=>e.jsxs("fieldset",{style:{border:0,padding:0,margin:0},children:[s.map((l,n)=>e.jsxs("div",{style:_e,children:[e.jsx("input",{"aria-label":`Gradient stop ${n+1} color`,type:"color",style:{...We,padding:2},value:l.color,onChange:a=>t(s.map((d,r)=>r===n?{...d,color:a.currentTarget.value}:d))}),e.jsxs("span",{style:{display:"grid",gridTemplateColumns:"1fr auto",gap:4},children:[e.jsx("input",{"aria-label":`Gradient stop ${n+1} position`,type:"number",min:0,max:1,step:.05,style:We,value:l.offset,onChange:a=>t(s.map((d,r)=>r===n?{...d,offset:Number(a.currentTarget.value)}:d))}),s.length>2?e.jsx("button",{type:"button",onClick:()=>t(s.filter((a,d)=>d!==n)),children:"−"}):null]})]},`${n}-${l.color}`)),s.length<J.MAX_SCREEN_GRADIENT_STOPS?e.jsx("button",{type:"button",onClick:()=>{var l;return t([...s,{offset:.5,color:((l=s[s.length-1])==null?void 0:l.color)??"#ffffff"}])},children:"Add stop"}):null]}),Is=({onChange:t,value:s})=>e.jsxs("fieldset",{style:{border:0,padding:0,margin:0},children:[e.jsxs("label",{style:_e,children:[e.jsx("span",{children:"Gradient"}),e.jsxs("select",{style:We,value:s.type,onChange:l=>t({...s,type:l.currentTarget.value}),children:[e.jsx("option",{value:"linear",children:"Linear"}),e.jsx("option",{value:"radial",children:"Radial"}),e.jsx("option",{value:"angular",children:"Conic / Angular"})]})]}),e.jsx(Al,{value:s.stops,onChange:l=>t({...s,stops:l})}),s.type!=="radial"?e.jsxs("label",{style:_e,children:[e.jsx("span",{children:"Angle"}),e.jsx("input",{type:"number",style:We,step:5,value:s.angle,onChange:l=>t({...s,angle:Number(l.currentTarget.value)})})]}):null,s.type!=="linear"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:_e,children:[e.jsx("span",{children:"Center X"}),e.jsx("input",{type:"number",style:We,min:0,max:1,step:.05,value:s.center.x,onChange:l=>t({...s,center:{...s.center,x:Number(l.currentTarget.value)}})})]}),e.jsxs("label",{style:_e,children:[e.jsx("span",{children:"Center Y"}),e.jsx("input",{type:"number",style:We,min:0,max:1,step:.05,value:s.center.y,onChange:l=>t({...s,center:{...s.center,y:Number(l.currentTarget.value)}})})]})]}):null,s.type==="radial"?e.jsxs("label",{style:_e,children:[e.jsx("span",{children:"Radius"}),e.jsx("input",{type:"number",style:We,min:.01,step:.05,value:s.radius,onChange:l=>t({...s,radius:Number(l.currentTarget.value)})})]}):null]}),is={display:"grid",gridTemplateColumns:"92px minmax(0,1fr)",alignItems:"center",gap:10,margin:"8px 0",color:"#cbd5e1",fontSize:12},os={width:"100%",boxSizing:"border-box",padding:"8px 9px",border:"1px solid rgba(148,163,184,.16)",borderRadius:6,background:"rgba(15,23,42,.72)",color:"#e2e8f0"},Es=({value:t,onChange:s})=>e.jsxs("fieldset",{style:{border:0,padding:0,margin:0},children:[e.jsxs("label",{style:is,children:[e.jsx("span",{children:"Tint"}),e.jsx("input",{type:"color",style:{...os,padding:2},value:t.tint,onChange:l=>s({...t,tint:l.currentTarget.value})})]}),["opacity","frost","highlight"].map(l=>e.jsxs("label",{style:is,children:[e.jsx("span",{children:l[0].toUpperCase()+l.slice(1)}),e.jsx("input",{type:"number",style:os,min:0,max:1,step:.05,value:t[l],onChange:n=>s({...t,[l]:Number(n.currentTarget.value)})})]},l))]}),Pl={borderRadius:12,border:"1px solid rgba(255,255,255,.08)",background:"rgba(255,255,255,.03)",padding:8},Ue={display:"grid",gridTemplateColumns:"92px minmax(0,1fr)",alignItems:"center",gap:10,margin:"8px 0",color:"#cbd5e1",fontSize:12},ht={width:"100%",boxSizing:"border-box",padding:"8px 9px",border:"1px solid rgba(148,163,184,.16)",borderRadius:6,background:"rgba(15,23,42,.72)",color:"#e2e8f0"},ie=({label:t,onValue:s,...l})=>e.jsxs("label",{style:Ue,children:[e.jsx("span",{children:t}),e.jsx("input",{...l,type:"number",style:ht,onChange:n=>s(Number(n.currentTarget.value))})]}),Ts=({value:t,onChange:s})=>e.jsxs("section",{style:Pl,children:[e.jsx("div",{style:{fontSize:11,fontWeight:700,marginBottom:7},children:"Screen Shape"}),e.jsxs("label",{style:Ue,children:[e.jsx("span",{children:"Shape"}),e.jsxs("select",{style:ht,value:t.kind,onChange:l=>s({...t,kind:l.currentTarget.value}),children:[e.jsx("option",{value:"circle",children:"Circle"}),e.jsx("option",{value:"ellipse",children:"Ellipse"}),e.jsx("option",{value:"rectangle",children:"Rectangle"}),e.jsx("option",{value:"roundedRectangle",children:"Rounded Rectangle"}),e.jsx("option",{value:"polygon",children:"Polygon"}),e.jsx("option",{value:"star",children:"Star"}),e.jsx("option",{value:"line",children:"Line"})]})]}),t.kind!=="line"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:Ue,children:[e.jsx("span",{children:"Fill"}),e.jsxs("select",{style:ht,value:t.fillMode,onChange:l=>s({...t,fillMode:l.currentTarget.value}),children:[e.jsx("option",{value:"solid",children:"Solid"}),e.jsx("option",{value:"gradient",children:"Gradient"}),e.jsx("option",{value:"glass",children:"Glass"})]})]}),t.fillMode==="gradient"?e.jsx(Is,{value:t.gradient,onChange:l=>s({...t,gradient:l})}):t.fillMode==="glass"?e.jsx(Es,{value:t.glass,onChange:l=>s({...t,glass:l})}):e.jsxs("label",{style:Ue,children:[e.jsx("span",{children:"Color"}),e.jsx("input",{type:"color",style:{...ht,padding:2},value:t.fillColor,onChange:l=>s({...t,fillColor:l.currentTarget.value})})]}),e.jsx(ie,{label:"Fill Opacity",min:0,max:1,step:.05,value:t.fillOpacity,onValue:l=>s({...t,fillOpacity:l})})]}):null,e.jsxs("label",{style:Ue,children:[e.jsx("span",{children:"Stroke"}),e.jsx("input",{type:"color",style:{...ht,padding:2},value:t.strokeColor,onChange:l=>s({...t,strokeColor:l.currentTarget.value})})]}),e.jsx(ie,{label:"Stroke Width",min:0,step:1,value:t.strokeWidth,onValue:l=>s({...t,strokeWidth:l})}),e.jsx(ie,{label:"Stroke Opacity",min:0,max:1,step:.05,value:t.strokeOpacity,onValue:l=>s({...t,strokeOpacity:l})}),e.jsxs("label",{style:Ue,children:[e.jsx("span",{children:"Dashed"}),e.jsx("input",{type:"checkbox",checked:t.dashed,onChange:l=>s({...t,dashed:l.currentTarget.checked})})]}),t.kind==="roundedRectangle"?e.jsx(ie,{label:"Corner Radius",min:0,max:.5,step:.01,value:t.cornerRadius,onValue:l=>s({...t,cornerRadius:l})}):null,t.kind==="polygon"||t.kind==="star"?e.jsx(ie,{label:t.kind==="star"?"Points":"Sides",min:3,max:12,step:1,value:t.sides,onValue:l=>s({...t,sides:l})}):null,t.kind==="star"?e.jsx(ie,{label:"Inner Radius",min:.05,max:.95,step:.05,value:t.innerRadiusRatio,onValue:l=>s({...t,innerRadiusRatio:l})}):null,t.kind==="line"?e.jsxs(e.Fragment,{children:[e.jsx(ie,{label:"Start X",min:0,max:1,step:.05,value:t.lineStart.x,onValue:l=>s({...t,lineStart:{...t.lineStart,x:l}})}),e.jsx(ie,{label:"Start Y",min:0,max:1,step:.05,value:t.lineStart.y,onValue:l=>s({...t,lineStart:{...t.lineStart,y:l}})}),e.jsx(ie,{label:"End X",min:0,max:1,step:.05,value:t.lineEnd.x,onValue:l=>s({...t,lineEnd:{...t.lineEnd,x:l}})}),e.jsx(ie,{label:"End Y",min:0,max:1,step:.05,value:t.lineEnd.y,onValue:l=>s({...t,lineEnd:{...t.lineEnd,y:l}})})]}):null]}),Dl={enabled:!0,bothHands:!0,visualScale:1,opacity:.92,pointRadius:3,lineWidth:3,labelScale:1.2,smoothing:.35,color:"#22d3ee",showBoundingBox:!0,showLabels:!1,logToConsole:!1},Bl={position:"fixed",left:14,top:104,zIndex:2e4,pointerEvents:"none"},zs={pointerEvents:"auto",width:286,borderRadius:16,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(8, 15, 28, 0.58)",boxShadow:"0 16px 36px rgba(0,0,0,0.28)",backdropFilter:"blur(20px) saturate(1.1)",WebkitBackdropFilter:"blur(20px) saturate(1.1)",color:"#f8fafc",overflowX:"hidden",overflowY:"auto",scrollbarWidth:"thin",scrollbarColor:"rgba(148,163,184,0.55) rgba(255,255,255,0.06)",overscrollBehavior:"contain"},Vl={...zs,width:32,height:32,borderRadius:16,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},Kl={position:"sticky",top:0,zIndex:1,display:"flex",alignItems:"center",gap:7,padding:"7px 8px",borderBottom:"1px solid rgba(255,255,255,0.08)",background:"rgba(8, 15, 28, 0.88)",backdropFilter:"blur(20px) saturate(1.1)",WebkitBackdropFilter:"blur(20px) saturate(1.1)"},Hl={width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",cursor:"grab",color:"rgba(148,163,184,0.82)",flex:"0 0 auto"},Gl={display:"flex",alignItems:"center",gap:6,fontSize:11,fontWeight:600,minWidth:0},rs={display:"flex",width:18,height:18,alignItems:"center",justifyContent:"center",borderRadius:6,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.08)",color:"#e2e8f0",flex:"0 0 auto"},_l={display:"grid",gap:6,padding:7},Ul={borderRadius:12,border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.03)",overflow:"hidden"},Xl={display:"flex",alignItems:"center",gap:7,padding:"6px 7px"},Zl={display:"flex",alignItems:"center",gap:6,fontSize:11,fontWeight:500,flex:"1 1 auto",minWidth:0},Yl={width:28,height:16,borderRadius:999,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.08)",padding:2,display:"flex",alignItems:"center",cursor:"pointer",flex:"0 0 auto"},ql=t=>({width:10,height:10,borderRadius:999,background:t?"#f8fafc":"rgba(148,163,184,0.7)",transform:t?"translateX(12px)":"translateX(0)",transition:"transform 140ms ease, background 140ms ease"}),Jl={display:"grid",gap:7,padding:"0 7px 7px"},Ql={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:6},Fe={display:"flex",flexDirection:"column",gap:4},et={...Fe,gridColumn:"1 / -1"},ne={fontSize:9,color:"rgba(226,232,240,0.72)"},Ve={width:"100%",height:24,borderRadius:7,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(15,23,42,0.68)",color:"#f8fafc",fontSize:10.5,outline:"none",padding:"0 7px",boxSizing:"border-box"},tt={display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:24},st={width:16,height:16},as={display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:8,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.05)",color:"#e2e8f0",cursor:"pointer",padding:0,flex:"0 0 auto"},ei=()=>e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M7 10h10v2H7v-2zm0 4h10v2H7v-2zm0-8h10v2H7V6z"})}),ti=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M18.3 5.71 12 12l6.3 6.29-1.41 1.41L10.59 13.41 4.29 19.7 2.88 18.29 9.17 12 2.88 5.71 4.29 4.3l6.3 6.29 6.29-6.3z"})}),si=()=>e.jsx("svg",{width:"11",height:"15",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M8 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 18a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM16 18a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})}),Wt=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M11 2a1 1 0 0 1 1 1v6h1V3a1 1 0 1 1 2 0v6h1V4a1 1 0 1 1 2 0v7.3l1.6 2.4a5 5 0 0 1 .8 2.7V18a4 4 0 0 1-4 4H9a6 6 0 0 1-6-6v-3.5a2.5 2.5 0 0 1 5 0V15h1V3a1 1 0 0 1 1-1z"})}),ni=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 5V2L7 7l5 5V9a4 4 0 1 1-4 4H6a6 6 0 1 0 6-8z"})}),li=({value:t,onChange:s})=>{const[l,n]=y.useState(!0),[a,d]=y.useState({x:14,y:104}),[r,o]=y.useState(typeof window>"u"?0:window.innerHeight),[h,x]=y.useState({overlay:!0,visibility:!1}),c=y.useRef(null),p=Math.max(240,r-a.y-16);y.useEffect(()=>{const i=j=>{c.current&&d({x:Math.max(8,j.clientX-c.current.x),y:Math.max(8,j.clientY-c.current.y)})},u=()=>{c.current=null,document.body.classList.remove("select-none")};return window.addEventListener("pointermove",i),window.addEventListener("pointerup",u),()=>{window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",u)}},[]),y.useEffect(()=>{const i=()=>o(window.innerHeight);return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]);const f=i=>{const u=i.currentTarget.getBoundingClientRect();c.current={x:i.clientX-u.left,y:i.clientY-u.top},document.body.classList.add("select-none"),i.currentTarget.setPointerCapture(i.pointerId)},g=(i,u,j,w)=>e.jsxs("div",{style:Ul,children:[e.jsxs("div",{style:Xl,children:[e.jsx("button",{type:"button",onClick:()=>x(v=>({...v,[i]:!v[i]})),style:Yl,children:e.jsx("div",{style:ql(h[i])})}),e.jsxs("div",{style:Zl,children:[e.jsx("span",{style:rs,children:j}),e.jsx("span",{children:u})]})]}),h[i]?e.jsx("div",{style:Jl,children:w}):null]},i);return typeof document>"u"?null:Ae.createPortal(e.jsxs("div",{style:{...Bl,left:a.x,top:a.y},children:[e.jsx("style",{children:`
2
2
  .xr-hand-tracking-2d-scroll::-webkit-scrollbar { width: 10px; }
3
3
  .xr-hand-tracking-2d-scroll::-webkit-scrollbar-track { background: rgba(255,255,255,0.06); border-radius: 999px; }
4
4
  .xr-hand-tracking-2d-scroll::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.55); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
package/dist/debug-ui.js CHANGED
@@ -1,23 +1,23 @@
1
- import { M as rd, d as ad, s as sd, a as dd, b as cd, u as pd, c as hd } from "./session-Cz8aie4K.js";
1
+ import { M as rd, d as ad, s as sd, a as dd, b as cd, u as pd, c as hd } from "./session-DHBNTyJJ.js";
2
2
  import { DefaultSettingPanel as gd } from "./debug-ui/default-setting.js";
3
3
  import { jsx as e, jsxs as l, Fragment as N } from "react/jsx-runtime";
4
4
  import { useState as S, useRef as ge, useEffect as V, useContext as Hn, createContext as Pn, useMemo as xn } from "react";
5
- import { D as Sn, a as _t, r as Gn, b as jn, c as _n } from "./renderGroups-CNB99dZ2.js";
6
- import { o as vn, b as xe, A as Xn, z as wn, s as Xt } from "./index-Cyk_VIZE.js";
5
+ import { D as Sn, a as _t, r as Gn, b as jn, c as _n } from "./renderGroups-BcQYy_J2.js";
6
+ import { o as vn, b as xe, A as Xn, z as wn, s as Xt } from "./index-BaNlidsb.js";
7
7
  import { createPortal as Ne } from "react-dom";
8
- import { P as _e, aN as Un } from "./index-CKRN-xJp.js";
8
+ import { P as _e, aR as Un } from "./index-CTqQJj5p.js";
9
9
  import { DoubleSide as Zn } from "three";
10
- import { o as Yn, s as Jn, p as qn, F as Ut, a as Qn, c as Rt, q as el, t as tl, v as nl } from "./renderPasses-DuapJA6V.js";
10
+ import { o as Yn, s as Jn, p as qn, F as Ut, a as Qn, c as Rt, q as el, t as tl, v as nl } from "./renderPasses-DIPTIU_x.js";
11
11
  import { f as ll, e as il, G as ol, d as rl, r as al, b as sl, p as dl } from "./settings-BJ7FMBsO.js";
12
- import { r as cl, F as pl, p as hl, a as yl, b as gl, c as bl, d as ul, I as fl, e as ml, f as xl, L as Sl, g as vl, t as Zt, m as wl, h as kl, s as Cl, i as Rl, j as Il, k as zl } from "./FaceRetouch-C1AxBNex.js";
12
+ import { r as cl, F as pl, p as hl, a as yl, b as gl, c as bl, d as ul, I as fl, e as ml, f as xl, L as Sl, g as vl, t as Zt, m as wl, h as kl, s as Cl, i as Rl, j as Il, k as zl } from "./FaceRetouch-D2xH5OpW.js";
13
13
  import { r as Tl, f as El, e as Wl } from "./landmarkMask-DHivVjJm.js";
14
- import { n as Ml } from "./index-CUldCMRl.js";
15
- import { F as Ll } from "./index-iIQ9jBDb.js";
14
+ import { n as Ml } from "./index-DlP4xxaT.js";
15
+ import { F as Ll } from "./index-CNt8esFO.js";
16
16
  import { PerspectiveCamera as Fl, OrbitControls as $l } from "@react-three/drei";
17
17
  import { useThree as Nl } from "@react-three/fiber";
18
- import { e as Ol, f as Al } from "./index-BZoBxyLn.js";
19
- import { X as Bl } from "./contexts-Y_FhdnIv.js";
20
- import { c as Vl } from "./selectors-BvJepq6H.js";
18
+ import { e as Ol, f as Al } from "./index-bL819L-K.js";
19
+ import { X as Bl } from "./contexts-B5GODwuV.js";
20
+ import { c as Vl } from "./selectors-K5JKCWxw.js";
21
21
  const Kl = {
22
22
  position: "fixed",
23
23
  zIndex: 2e4,
@@ -1,11 +1,11 @@
1
1
  import { useFrame as V } from "@react-three/fiber";
2
2
  import { useState as b, useMemo as Z, useEffect as $, useRef as k } from "react";
3
3
  import * as x from "three";
4
- import { c as v, p as W, a as tt, b as et, s as rt } from "./bodyMaskMaterial-Cs2awskk.js";
5
- import { j as C, X as st } from "./index-CKRN-xJp.js";
6
- import { b as j } from "./selectors-BvJepq6H.js";
7
- import { u as it } from "./useBodies-BYzJpQ4L.js";
8
- import { u as nt } from "./landmarks-DtCAFV_m.js";
4
+ import { c as v, p as W, a as tt, b as et, s as rt } from "./bodyMaskMaterial-C3aXItLo.js";
5
+ import { j as C, X as st } from "./index-CTqQJj5p.js";
6
+ import { b as j } from "./selectors-K5JKCWxw.js";
7
+ import { u as it } from "./useBodies-BMKHXAOL.js";
8
+ import { u as nt } from "./landmarks-vLy5QKt6.js";
9
9
  const wt = { left: -1, right: 1, top: 1, bottom: -1 }, at = ({
10
10
  ready: t,
11
11
  error: e,
@@ -1 +1 @@
1
- "use strict";const j=require("@react-three/fiber"),g=require("react"),$=require("three"),y=require("./bodyMaskMaterial-CBWub5t_.cjs"),b=require("./index-Sho4F4it.cjs"),W=require("./selectors-QB2qsaxy.cjs"),ee=require("./useBodies-Cxpmx6Bb.cjs"),te=require("./landmarks-BEjJXcnE.cjs");function re(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const R=re($),se={left:-1,right:1,top:1,bottom:-1},z=({ready:e,error:t,hasMask:r})=>t?"error":e&&r?"ready":"loading",ne=(e,t)=>e==="ready"||t==="camera",K=(e=!0)=>{const{ready:t,error:r}=te.useXRModel(b.XRModel.BACKGROUND_SEGMENTATION,{type:"portrait"},e),o=W.useXRModelNode(b.XRModel.BACKGROUND_SEGMENTATION),[u,c]=g.useState(null);return j.useFrame(()=>{const n=(o==null?void 0:o.backgroundSegmentationMask)??null;n!==u&&c(n)}),{texture:u,status:z({ready:t,error:r,hasMask:!!u}),error:r}},ie=16,oe=({active:e=!0,resolution:t=.5,nobody:r,feather:o,numBodies:u=b.XR_MAX_SUBJECTS.body.max,...c}={})=>{const{texture:n,status:l,error:m}=K(e),s=W.useXRModelNode(b.XRModel.BACKGROUND_SEGMENTATION),{node:i,read:f}=ee.useBodySubject({...c,numBodies:u,active:e}),a=g.useMemo(()=>{const w=y.createBodyMaskSplitMaterial(),M=new R.Mesh(new R.PlaneGeometry(2,2),w);M.frustumCulled=!1;const d=new R.Scene;d.add(M);const x=new R.WebGLRenderTarget(1,1,{minFilter:R.LinearFilter,magFilter:R.LinearFilter,depthBuffer:!1,generateMipmaps:!1});return{material:w,quad:M,scene:d,camera:new R.Camera,target:x}},[]);g.useEffect(()=>()=>{a.target.dispose(),a.material.dispose(),a.quad.geometry.dispose()},[a]);const p=g.useRef([]),F=g.useRef(null),O=g.useRef(y.packBodyMaskUniforms([])),v=g.useRef({maskVersion:-1,bodies:null,target:-2}),[Y,J]=g.useState(null),[_,Q]=g.useState(!1);return j.useFrame(({gl:w})=>{var H,D,I;if(!e||!n)return;const M=((H=i==null?void 0:i.getBodies)==null?void 0:H.call(i))??[];if(M!==F.current){F.current=M;const T=((D=M.find(S=>!S.held))==null?void 0:D.pose.timestampMs)??performance.now();p.current.push({ms:T,bodies:M}),p.current.length>ie&&p.current.shift()}const d=f(),x=y.closestBodies(p.current,((I=s==null?void 0:s.getMaskTimestampMs)==null?void 0:I.call(s))??0),C=[];let X=-1;const N=n.image,B=(N==null?void 0:N.width)??0,E=(N==null?void 0:N.height)??0;if(!B||!E)return;const q=B/E;for(const T of(x==null?void 0:x.bodies)??[]){const S=y.bodyMaskPerson(T.pose,q);S&&(d&&(d.id===null?T.pose===d.pose:T.id===d.id)&&(X=C.length),C.push(S))}const A=(d==null?void 0:d.id)??null;A!==Y&&J(A);const P=Math.max(1,Math.round(B*t)),U=Math.max(1,Math.round(E*t)),G=a.target.width!==P||a.target.height!==U;G&&a.target.setSize(P,U);const k=v.current;if(!G&&k.maskVersion===n.version&&k.bodies===x&&k.target===X)return;k.maskVersion=n.version,k.bodies=x,k.target=X,y.packBodyMaskUniforms(C,O.current),y.setBodyMaskSplitUniforms(a.material,n,q,O.current,X,{nobody:r,feather:o});const Z=w.getRenderTarget();w.setRenderTarget(a.target),w.render(a.scene,a.camera),w.setRenderTarget(Z),_||Q(!0)}),{texture:_?a.target.texture:null,id:Y,status:l,error:m}},h=e=>typeof e=="number"&&Number.isFinite(e)&&e>0?e:0,ae=e=>{const t=e;return{width:h(t.videoWidth)||h(t.naturalWidth)||h(t.width),height:h(t.videoHeight)||h(t.naturalHeight)||h(t.height)}},L=(e,t)=>Math.min(1-t,Math.max(0,e)),V=(e,t,r,o=0)=>{if(!Number.isFinite(e.minX)||!Number.isFinite(e.minY)||!Number.isFinite(e.maxX)||!Number.isFinite(e.maxY)||!h(t.width)||!h(t.height)||!h(r.width)||!h(r.height))return null;const u=e.maxX-e.minX,c=e.maxY-e.minY;if(u<=0||c<=0)return null;const n=Number.isFinite(o)?Math.max(0,o):0,l=(e.minX+e.maxX)/2,m=(e.minY+e.maxY)/2;let s=Math.min(1,u*(1+n*2)),i=Math.min(1,c*(1+n*2));const f=r.width/r.height/(t.width/t.height);s/i<f?s=Math.min(1,i*f):i=Math.min(1,s/f),s/i<f?i=s/f:s/i>f&&(s=i*f);const a=L(l-s/2,s),p=L(m-i/2,i);return{minX:a,minY:p,maxX:a+s,maxY:p+i}},ce=({source:e,bounds:t,canvas:r,outputSize:o,padding:u})=>{const c=ae(e),n=V(t,c,o,u),l=Math.round(o.width),m=Math.round(o.height);if(!n||!c.width||!c.height||l<=0||m<=0)return!1;r.width!==l&&(r.width=l),r.height!==m&&(r.height=m);const s=r.getContext("2d");return s?(s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,l,m),s.drawImage(e,n.minX*c.width,n.minY*c.height,(n.maxX-n.minX)*c.width,(n.maxY-n.minY)*c.height,0,0,l,m),!0):!1};exports.FULL_SCREEN_ANCHORS=se;exports.drawNormalizedCrop=ce;exports.resolveNormalizedCrop=V;exports.resolvePersonCutoutStatus=z;exports.shouldDrawFallback=ne;exports.useBodyMaskTexture=oe;exports.usePersonMaskTexture=K;
1
+ "use strict";const j=require("@react-three/fiber"),g=require("react"),$=require("three"),y=require("./bodyMaskMaterial-Q6rYywwW.cjs"),b=require("./index-J3Qy6hi3.cjs"),W=require("./selectors-Bq6tSgOY.cjs"),ee=require("./useBodies-CXomEo0i.cjs"),te=require("./landmarks-BP6RbRHN.cjs");function re(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const R=re($),se={left:-1,right:1,top:1,bottom:-1},z=({ready:e,error:t,hasMask:r})=>t?"error":e&&r?"ready":"loading",ne=(e,t)=>e==="ready"||t==="camera",K=(e=!0)=>{const{ready:t,error:r}=te.useXRModel(b.XRModel.BACKGROUND_SEGMENTATION,{type:"portrait"},e),o=W.useXRModelNode(b.XRModel.BACKGROUND_SEGMENTATION),[u,c]=g.useState(null);return j.useFrame(()=>{const n=(o==null?void 0:o.backgroundSegmentationMask)??null;n!==u&&c(n)}),{texture:u,status:z({ready:t,error:r,hasMask:!!u}),error:r}},ie=16,oe=({active:e=!0,resolution:t=.5,nobody:r,feather:o,numBodies:u=b.XR_MAX_SUBJECTS.body.max,...c}={})=>{const{texture:n,status:l,error:m}=K(e),s=W.useXRModelNode(b.XRModel.BACKGROUND_SEGMENTATION),{node:i,read:f}=ee.useBodySubject({...c,numBodies:u,active:e}),a=g.useMemo(()=>{const w=y.createBodyMaskSplitMaterial(),M=new R.Mesh(new R.PlaneGeometry(2,2),w);M.frustumCulled=!1;const d=new R.Scene;d.add(M);const x=new R.WebGLRenderTarget(1,1,{minFilter:R.LinearFilter,magFilter:R.LinearFilter,depthBuffer:!1,generateMipmaps:!1});return{material:w,quad:M,scene:d,camera:new R.Camera,target:x}},[]);g.useEffect(()=>()=>{a.target.dispose(),a.material.dispose(),a.quad.geometry.dispose()},[a]);const p=g.useRef([]),F=g.useRef(null),O=g.useRef(y.packBodyMaskUniforms([])),v=g.useRef({maskVersion:-1,bodies:null,target:-2}),[Y,J]=g.useState(null),[_,Q]=g.useState(!1);return j.useFrame(({gl:w})=>{var H,D,I;if(!e||!n)return;const M=((H=i==null?void 0:i.getBodies)==null?void 0:H.call(i))??[];if(M!==F.current){F.current=M;const T=((D=M.find(S=>!S.held))==null?void 0:D.pose.timestampMs)??performance.now();p.current.push({ms:T,bodies:M}),p.current.length>ie&&p.current.shift()}const d=f(),x=y.closestBodies(p.current,((I=s==null?void 0:s.getMaskTimestampMs)==null?void 0:I.call(s))??0),C=[];let X=-1;const N=n.image,B=(N==null?void 0:N.width)??0,E=(N==null?void 0:N.height)??0;if(!B||!E)return;const q=B/E;for(const T of(x==null?void 0:x.bodies)??[]){const S=y.bodyMaskPerson(T.pose,q);S&&(d&&(d.id===null?T.pose===d.pose:T.id===d.id)&&(X=C.length),C.push(S))}const A=(d==null?void 0:d.id)??null;A!==Y&&J(A);const P=Math.max(1,Math.round(B*t)),U=Math.max(1,Math.round(E*t)),G=a.target.width!==P||a.target.height!==U;G&&a.target.setSize(P,U);const k=v.current;if(!G&&k.maskVersion===n.version&&k.bodies===x&&k.target===X)return;k.maskVersion=n.version,k.bodies=x,k.target=X,y.packBodyMaskUniforms(C,O.current),y.setBodyMaskSplitUniforms(a.material,n,q,O.current,X,{nobody:r,feather:o});const Z=w.getRenderTarget();w.setRenderTarget(a.target),w.render(a.scene,a.camera),w.setRenderTarget(Z),_||Q(!0)}),{texture:_?a.target.texture:null,id:Y,status:l,error:m}},h=e=>typeof e=="number"&&Number.isFinite(e)&&e>0?e:0,ae=e=>{const t=e;return{width:h(t.videoWidth)||h(t.naturalWidth)||h(t.width),height:h(t.videoHeight)||h(t.naturalHeight)||h(t.height)}},L=(e,t)=>Math.min(1-t,Math.max(0,e)),V=(e,t,r,o=0)=>{if(!Number.isFinite(e.minX)||!Number.isFinite(e.minY)||!Number.isFinite(e.maxX)||!Number.isFinite(e.maxY)||!h(t.width)||!h(t.height)||!h(r.width)||!h(r.height))return null;const u=e.maxX-e.minX,c=e.maxY-e.minY;if(u<=0||c<=0)return null;const n=Number.isFinite(o)?Math.max(0,o):0,l=(e.minX+e.maxX)/2,m=(e.minY+e.maxY)/2;let s=Math.min(1,u*(1+n*2)),i=Math.min(1,c*(1+n*2));const f=r.width/r.height/(t.width/t.height);s/i<f?s=Math.min(1,i*f):i=Math.min(1,s/f),s/i<f?i=s/f:s/i>f&&(s=i*f);const a=L(l-s/2,s),p=L(m-i/2,i);return{minX:a,minY:p,maxX:a+s,maxY:p+i}},ce=({source:e,bounds:t,canvas:r,outputSize:o,padding:u})=>{const c=ae(e),n=V(t,c,o,u),l=Math.round(o.width),m=Math.round(o.height);if(!n||!c.width||!c.height||l<=0||m<=0)return!1;r.width!==l&&(r.width=l),r.height!==m&&(r.height=m);const s=r.getContext("2d");return s?(s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,l,m),s.drawImage(e,n.minX*c.width,n.minY*c.height,(n.maxX-n.minX)*c.width,(n.maxY-n.minY)*c.height,0,0,l,m),!0):!1};exports.FULL_SCREEN_ANCHORS=se;exports.drawNormalizedCrop=ce;exports.resolveNormalizedCrop=V;exports.resolvePersonCutoutStatus=z;exports.shouldDrawFallback=ne;exports.useBodyMaskTexture=oe;exports.usePersonMaskTexture=K;
@@ -56,7 +56,7 @@ export { DEFAULT_SCREEN_IMAGE_SETTINGS, DEFAULT_SCREEN_IMAGE_SCENE_SETTINGS, map
56
56
  export type { ScreenImageSettings, ScreenImageSceneSettings, ScreenImageRenderMapping, } from '../screen-image/screenImageSettings';
57
57
  export { DEFAULT_SCREEN_TEXT_SCENE_SETTINGS, DEFAULT_SCREEN_TEXT_SHADOW_LAYER, mapScreenTextInnerShadowToProps, mapScreenTextSettingsToProps, } from '../screen-text/screenTextSettings';
58
58
  export type { ScreenTextRenderMapping, ScreenTextArtPreset, ScreenTextSettings, ScreenTextSceneSettings, ScreenTextStyle, } from '../screen-text/screenTextSettings';
59
- export { DEFAULT_PIXEL_SNAP_INCREMENT, DEFAULT_REFERENCE_PIXELS_PER_UNIT, DEFAULT_SCREEN_TRANSFORM_2D, DEFAULT_SCREEN_TRANSFORM_ROOT, mergeScreenTransform2D, clientToScreenPixels, mediaToScreenPixels, normalizedToScreenPixels, resolveScreenTransform2D, screenPixelsToUnits, screenPixelsToClient, screenPixelsToMedia, screenPixelsToNormalized, screenPixelsToScreenSpace, screenPointToRay, screenSpaceToScreenPixels, screenUnitsToPixels, smoothNumber, smoothVector2, smoothVector3, trackerPointToScreenPixels, worldToScreenPixels, } from '../screen2d';
59
+ export { DEFAULT_PIXEL_SNAP_INCREMENT, DEFAULT_REFERENCE_PIXELS_PER_UNIT, DEFAULT_SCREEN_TRANSFORM_2D, DEFAULT_SCREEN_TRANSFORM_ROOT, mergeScreenTransform2D, clientToScreenPixels, mediaToScreenPixels, normalizedToScreenPixels, normalizedToTransform2DPixels, resolveScreenTransform2D, screenTransform2DScale, transform2DPixelsToNormalized, viewportSizeToTransform2DPixels, screenPixelsToUnits, screenPixelsToClient, screenPixelsToMedia, screenPixelsToNormalized, screenPixelsToScreenSpace, screenPointToRay, screenSpaceToScreenPixels, screenUnitsToPixels, smoothNumber, smoothVector2, smoothVector3, trackerPointToScreenPixels, worldToScreenPixels, } from '../screen2d';
60
60
  export type { ProjectedScreenPixelPoint, ResolvedScreenTransform2D, ScreenClientRect, ScreenPixelPoint, ScreenPointUnitConversionOptions, ScreenTransform2DSettings, ScreenTransformRoot, ScreenUnitConversionOptions, ScreenViewportSize, } from '../screen2d';
61
61
  export type { NormalizedTrackerPoint, TrackerPoint } from '../types/common';
62
62
  export { computeContainScale } from '../texture/computeContainScale';
@@ -1,4 +1,4 @@
1
- "use strict";var ld=Object.defineProperty;var ud=(e,t,n)=>t in e?ld(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var C=(e,t,n)=>ud(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("react/jsx-runtime"),J=require("@react-three/fiber"),_=require("react"),Ae=require("three"),ou=require("./uv-BMFt19bg.cjs"),T=require("./useIrisTracking-DRGWgoNy.cjs"),Z=require("./index-Sho4F4it.cjs"),O=require("./FaceRetouch-D7kryDE6.cjs"),V=require("./CanonicalHeadFrame-D_0OzdB9.cjs"),iu=require("./similarityFit-BFqHND2e.cjs"),ae=require("./selectors-QB2qsaxy.cjs"),Te=require("./index-S3gqudT6.cjs"),K=require("./canonicalFace-C83I225R.cjs"),ls=require("@react-three/drei"),eo=require("./landmarks-BEjJXcnE.cjs"),le=require("./FaceSurface-CHAMEeG1.cjs"),to=require("./cache-DL1Dbz6k.cjs"),Mr=require("./segmentation-J8GoNBvP.cjs"),di=require("@mediapipe/tasks-vision"),Gt=require("./useLandmarkPoseFit-Bg-h9BPb.cjs"),oe=require("./renderPasses-DgxUKn9b.cjs"),de=require("./renderState-apSfg4eR.cjs"),mi=require("./textures-DAfc61zz.cjs"),tt=require("./landmarkMask-CvN-L5NT.cjs"),cu=require("./SkeletonUtils-CddIup1F.cjs"),$t=require("./providers-CEZQgz2s.cjs");function hd(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const d=hd(Ae),no={headCenter:[0,2.7,-2.2],crown:[0,13.26,-3.76],forehead:[0,6.545,5.027],noseBridge:[0,2.473,5.789],noseTip:[0,-1.127,7.476],chin:[0,-9.403,4.264],leftEar:[8.84,1.37,-3.26],rightEar:[-8.84,1.37,-3.26],leftEarLobe:[9.34,-.73,-3],rightEarLobe:[-9.34,-.73,-3]},fd=Object.keys(no),pd=new Set(["leftEar","rightEar","leftEarLobe","rightEarLobe"]),Wn=(e,t=!1)=>{const n=no[Z.feedSidedName(e,t)];return{position:n,mirror:pd.has(e)&&n[0]<0}},dd=(e,t=new d.Vector3,n=!1)=>t.fromArray(Wn(e,n).position),lu=(e,t,n=!1)=>{const{position:a,mirror:s}=Wn(e,n),[r,o,i]=a,[c,u,l]=(t==null?void 0:t.position)??[0,0,0],h=t==null?void 0:t.rotation;return{position:[r+(s?-c:c),o+u,i+l],rotation:h&&s?[h[0],-h[1],-h[2]]:h}},md=({point:e,offset:t,mirrored:n,children:a,...s})=>{const r=_.useContext(V.CanonicalHeadFrameContext),o=ae.useXRMirrored(),i=(t==null?void 0:t.scale)??1,c={point:e,offset:t,scale:i,mirrored:n??o};return r?L.jsx(gd,{...c,children:a}):L.jsx(Sd,{...c,fitOptions:s,children:a})},uu=(e,t,n)=>[Wn(e,t).mirror?-n:n,n,n],gd=({point:e,offset:t,scale:n,mirrored:a,children:s})=>{const r=lu(e,t,a);return L.jsx("group",{position:r.position,rotation:r.rotation??[0,0,0],children:L.jsx("group",{scale:uu(e,a,n),children:s})})},Sd=({point:e,offset:t,scale:n,mirrored:a,fitOptions:s,children:r})=>{const o=_.useRef(null),i=_.useMemo(()=>lu(e,t,a),[e,a,...(t==null?void 0:t.position)??[],...(t==null?void 0:t.rotation)??[]]);return V.useCanonicalHeadFit(o,{...s,offset:i}),L.jsx("group",{ref:o,children:L.jsx("group",{scale:uu(e,a,n),children:r})})},ao=Object.freeze({frequency:1.8,damping:.25,maxAngle:50}),yr={frequency:[.2,10],damping:[0,1],maxAngle:[1,175]},so=(e={})=>{const t={...ao};return Object.keys(yr).forEach(n=>{const a=e[n],[s,r]=yr[n];typeof a=="number"&&Number.isFinite(a)&&(t[n]=Math.min(r,Math.max(s,a)))}),t},hu=1/120,fu=.25,pu=20,Ed=Math.PI/180,ta=new d.Vector3,us=new d.Vector3,gi=new d.Vector3,na=new d.Vector3,We=new d.Vector3,Si=new d.Vector3,qe=new d.Vector3,_t=new d.Vector3,Ei=new d.Vector3,En=new d.Vector3;class ro{constructor(){C(this,"position",new d.Vector3);C(this,"velocity",new d.Vector3);C(this,"ready",!1);C(this,"lastPivot",new d.Vector3);C(this,"lastRest",new d.Vector3(0,-1,0));C(this,"lastLength",0);C(this,"lastTarget",new d.Vector3)}reset(t,n,a){this.position.copy(n).multiplyScalar(a).add(t),this.velocity.set(0,0,0),this.lastPivot.copy(t),this.lastRest.copy(n),this.lastLength=a,this.lastTarget.copy(this.position),this.ready=!0}step(t,n,a,s,r,o=new d.Vector3){ta.copy(n).multiplyScalar(a).add(t);const i=ta.distanceTo(this.lastTarget)>pu*Math.max(a,1e-6);if(!this.ready||!(s>0)||s>fu||i||!(a>0))return this.reset(t,n,a),o.copy(n);const c=2*Math.PI*r.frequency,u=c*c,l=2*r.damping*c,h=r.maxAngle*Ed;us.copy(t).sub(this.lastPivot).divideScalar(s),gi.copy(ta).sub(this.lastTarget).divideScalar(s);const f=Math.max(1,Math.ceil(s/hu)),p=s/f;for(let m=1;m<=f;m+=1){const E=m/f;na.lerpVectors(this.lastPivot,t,E),We.lerpVectors(this.lastRest,n,E),We.lengthSq()<1e-12&&We.copy(n),We.normalize();const S=this.lastLength+(a-this.lastLength)*E;Si.copy(We).multiplyScalar(S).add(na),Ei.copy(Si).sub(this.position).multiplyScalar(u).addScaledVector(En.copy(gi).sub(this.velocity),l),this.velocity.addScaledVector(Ei,p),this.position.addScaledVector(this.velocity,p),qe.copy(this.position).sub(na),qe.lengthSq()<1e-12&&qe.copy(We),qe.normalize();const g=d.MathUtils.clamp(qe.dot(We),-1,1);if(Math.acos(g)>h){_t.copy(qe).addScaledVector(We,-g),_t.lengthSq()<1e-12&&_t.set(1,0,0).cross(We),_t.normalize(),qe.copy(We).multiplyScalar(Math.cos(h)).addScaledVector(_t,Math.sin(h)),En.copy(this.velocity).sub(us);const A=En.dot(_t);A>0&&this.velocity.addScaledVector(_t,-A)}this.position.copy(qe).multiplyScalar(S).add(na),En.copy(this.velocity).sub(us),this.velocity.addScaledVector(qe,-En.dot(qe))}return this.lastPivot.copy(t),this.lastRest.copy(n),this.lastLength=a,this.lastTarget.copy(ta),o.copy(this.position).sub(t).normalize()}}class du{constructor(t){C(this,"joints");C(this,"pivot",new d.Vector3);this.joints=Array.from({length:Math.max(1,Math.floor(t))},()=>new ro)}step(t,n,a,s,r,o){return this.pivot.copy(t),this.joints.forEach((i,c)=>{o[c]??(o[c]=new d.Vector3),i.step(this.pivot,n[c]??n[n.length-1],a[c]??0,s,r,o[c]),this.pivot.copy(i.position)}),o}reset(t,n,a){this.pivot.copy(t),this.joints.forEach((s,r)=>{s.reset(this.pivot,n[r]??n[n.length-1],a[r]??0),this.pivot.copy(s.position)})}}const wr=1.5,Ai=new d.Vector3(0,-1,0),Ad=e=>{for(let t=e;t;t=t.parent)if(!t.visible)return!1;return!0};class oo{constructor(t,n,a={}){C(this,"settings",ao);C(this,"length",wr);C(this,"joint",new ro);C(this,"lastTime",null);C(this,"pivot",new d.Vector3);C(this,"rest",new d.Vector3);C(this,"direction",new d.Vector3);C(this,"linear",new d.Matrix3);this.outer=t,this.inner=n,this.setOptions(a)}setOptions({length:t,...n}){this.settings=so(n),this.length=typeof t=="number"&&Number.isFinite(t)&&t>0?t:wr}update(t){const{outer:n,inner:a}=this;if(!Ad(n)){this.lastTime=null,this.toRest();return}const s=this.lastTime;if(s!==null&&!(t>s))return;this.lastTime=t;const r=n.matrixWorld.elements;this.pivot.set(r[12],r[13],r[14]),this.rest.copy(Ai).transformDirection(n.matrixWorld);const o=(Math.hypot(r[0],r[1],r[2])+Math.hypot(r[4],r[5],r[6])+Math.hypot(r[8],r[9],r[10]))/3,i=this.length*o;if(s===null){this.joint.reset(this.pivot,this.rest,i),this.toRest();return}this.joint.step(this.pivot,this.rest,i,t-s,this.settings,this.direction),this.linear.setFromMatrix4(n.matrixWorld).invert(),this.direction.applyMatrix3(this.linear).normalize(),a.quaternion.setFromUnitVectors(Ai,this.direction),a.updateMatrixWorld(!0)}reset(){this.lastTime=null,this.toRest()}toRest(){this.inner.quaternion.w!==1&&(this.inner.quaternion.identity(),this.inner.updateMatrixWorld(!0))}}const mu=(e,t)=>{const n=t.map(r=>r.toLowerCase()).filter(Boolean),a=[],s=r=>{if(r!==e&&n.some(o=>r.name.toLowerCase().includes(o))){a.push(r);return}r.children.forEach(s)};return s(e),a.map(r=>{const o=r.parent,i=new d.Group;i.name=`${r.name} swing`,i.position.copy(r.position);const c=new d.Group,u=o.children.indexOf(r);return o.remove(r),r.position.set(0,0,0),c.add(r),i.add(c),i.parent=o,o.children.splice(u,0,i),{node:r,outer:i,inner:c}})},gu=({enabled:e=!0,position:t,rotation:n,children:a,...s})=>{const r=J.useThree(f=>f.scene),o=J.useThree(f=>f.get),i=_.useRef(null),c=_.useRef(null),u=_.useRef(null),l=_.useRef({enabled:e});l.current.enabled=e;const h=JSON.stringify(s);return _.useEffect(()=>{if(!i.current||!c.current)return;const f=new oo(i.current,c.current);u.current=f;const p=Gt.addSceneBeforeRender(r,()=>{l.current.enabled?f.update(o().clock.elapsedTime):f.reset()});return()=>{p(),f.reset(),u.current===f&&(u.current=null)}},[r,o]),_.useEffect(()=>{var f;(f=u.current)==null||f.setOptions(JSON.parse(h))},[h]),L.jsx("group",{ref:i,position:t,rotation:n,children:L.jsx("group",{ref:c,children:a})})},vd=5,Md=6,yd=(e,t,n=!1)=>{const a=Wn(e==="left"?"leftEarLobe":"rightEarLobe",n),[s,r,o]=a.position,[i,c,u]=(t==null?void 0:t.position)??[0,0,0],[l,h,f]=(t==null?void 0:t.rotation)??[0,0,0],p=(t==null?void 0:t.scale)??1;return a.mirror?{position:[s-i,r+c,o+u],rotation:[l,-h,-f],scale:[-p,p,p]}:{position:[s+i,r+c,o+u],rotation:[l,h,f],scale:[p,p,p]}},Su=e=>{const t=e.clone(!0);return t.traverse(n=>{if(n.frustumCulled=!1,!(n instanceof d.Mesh)||n.renderOrder!==0)return;const a=Array.isArray(n.material)?n.material:[n.material];n.renderOrder=a.some(s=>s.transparent)?Md:vd}),t},wd=({model:e,children:t,left:n=!0,right:a=!0,offset:s,mirrored:r,swing:o=!1,...i})=>{const c=_.useContext(V.CanonicalHeadFrameContext),u=ae.useXRMirrored();if(!n&&!a)return null;const l=r??u,h=L.jsxs(L.Fragment,{children:[a&&L.jsx(vi,{side:"right",model:e,offset:s,mirrored:l,swing:o,children:t}),n&&L.jsx(vi,{side:"left",model:e,offset:s,mirrored:l,swing:o,children:t})]});return c?h:L.jsx(V.CanonicalHeadFrame,{...i,children:h})},vi=({side:e,model:t,offset:n,mirrored:a,swing:s,children:r})=>{const o=_.useMemo(()=>yd(e,n,a),[e,a,...(n==null?void 0:n.position)??[],...(n==null?void 0:n.rotation)??[],n==null?void 0:n.scale]),i=_.useMemo(()=>t?Su(t):null,[t]);return L.jsx("group",{position:o.position,rotation:o.rotation,scale:o.scale,children:L.jsxs(gu,{enabled:s!==!1,...typeof s=="object"?s:{},children:[i&&L.jsx("primitive",{object:i}),typeof r=="function"?r(e):r]})})},Eu=()=>({irisCenter:{value:new d.Vector2},irisRadius:{value:0},irisOffset:{value:new d.Vector2},irisConfidence:{value:0},irisOpenness:{value:0},time:{value:0},color:{value:new d.Color("#4fa3ff")},opacity:{value:1},mirror:{value:0},tintImage:{value:0},map:{value:null}}),Au=(e,t,n)=>(e.irisCenter.value.set(t.center.x,t.center.y),e.irisRadius.value=t.radius,e.irisOffset.value.set(t.offset.x,t.offset.y),e.irisConfidence.value=t.confidence,e.irisOpenness.value=t.openness,e.time.value=n.time,n.color!==void 0&&e.color.value.set(n.color),n.opacity!==void 0&&(e.opacity.value=n.opacity),e.mirror.value=n.mirrored?1:0,n.tintImage!==void 0&&(e.tintImage.value=n.tintImage?1:0),n.map!==void 0&&(e.map.value=n.map),e),io=`
1
+ "use strict";var ld=Object.defineProperty;var ud=(e,t,n)=>t in e?ld(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var C=(e,t,n)=>ud(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("react/jsx-runtime"),J=require("@react-three/fiber"),_=require("react"),Ae=require("three"),ou=require("./uv-BMFt19bg.cjs"),T=require("./useIrisTracking-DExhnhlt.cjs"),Z=require("./index-J3Qy6hi3.cjs"),O=require("./FaceRetouch-DHhn1nSV.cjs"),V=require("./CanonicalHeadFrame-CZFvPzN_.cjs"),iu=require("./similarityFit-BFqHND2e.cjs"),ae=require("./selectors-Bq6tSgOY.cjs"),Te=require("./index-DIYaENN3.cjs"),K=require("./canonicalFace-C83I225R.cjs"),ls=require("@react-three/drei"),eo=require("./landmarks-BP6RbRHN.cjs"),le=require("./FaceSurface-CHAMEeG1.cjs"),to=require("./cache-DFqZYsHC.cjs"),Mr=require("./segmentation-Cz7oeNcS.cjs"),di=require("@mediapipe/tasks-vision"),Gt=require("./useLandmarkPoseFit-Bg-h9BPb.cjs"),oe=require("./renderPasses-Bt8k0dkm.cjs"),de=require("./renderState-apSfg4eR.cjs"),mi=require("./textures-DAfc61zz.cjs"),tt=require("./landmarkMask-CvN-L5NT.cjs"),cu=require("./SkeletonUtils-CddIup1F.cjs"),$t=require("./providers-BRSbw214.cjs");function hd(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const d=hd(Ae),no={headCenter:[0,2.7,-2.2],crown:[0,13.26,-3.76],forehead:[0,6.545,5.027],noseBridge:[0,2.473,5.789],noseTip:[0,-1.127,7.476],chin:[0,-9.403,4.264],leftEar:[8.84,1.37,-3.26],rightEar:[-8.84,1.37,-3.26],leftEarLobe:[9.34,-.73,-3],rightEarLobe:[-9.34,-.73,-3]},fd=Object.keys(no),pd=new Set(["leftEar","rightEar","leftEarLobe","rightEarLobe"]),Wn=(e,t=!1)=>{const n=no[Z.feedSidedName(e,t)];return{position:n,mirror:pd.has(e)&&n[0]<0}},dd=(e,t=new d.Vector3,n=!1)=>t.fromArray(Wn(e,n).position),lu=(e,t,n=!1)=>{const{position:a,mirror:s}=Wn(e,n),[r,o,i]=a,[c,u,l]=(t==null?void 0:t.position)??[0,0,0],h=t==null?void 0:t.rotation;return{position:[r+(s?-c:c),o+u,i+l],rotation:h&&s?[h[0],-h[1],-h[2]]:h}},md=({point:e,offset:t,mirrored:n,children:a,...s})=>{const r=_.useContext(V.CanonicalHeadFrameContext),o=ae.useXRMirrored(),i=(t==null?void 0:t.scale)??1,c={point:e,offset:t,scale:i,mirrored:n??o};return r?L.jsx(gd,{...c,children:a}):L.jsx(Sd,{...c,fitOptions:s,children:a})},uu=(e,t,n)=>[Wn(e,t).mirror?-n:n,n,n],gd=({point:e,offset:t,scale:n,mirrored:a,children:s})=>{const r=lu(e,t,a);return L.jsx("group",{position:r.position,rotation:r.rotation??[0,0,0],children:L.jsx("group",{scale:uu(e,a,n),children:s})})},Sd=({point:e,offset:t,scale:n,mirrored:a,fitOptions:s,children:r})=>{const o=_.useRef(null),i=_.useMemo(()=>lu(e,t,a),[e,a,...(t==null?void 0:t.position)??[],...(t==null?void 0:t.rotation)??[]]);return V.useCanonicalHeadFit(o,{...s,offset:i}),L.jsx("group",{ref:o,children:L.jsx("group",{scale:uu(e,a,n),children:r})})},ao=Object.freeze({frequency:1.8,damping:.25,maxAngle:50}),yr={frequency:[.2,10],damping:[0,1],maxAngle:[1,175]},so=(e={})=>{const t={...ao};return Object.keys(yr).forEach(n=>{const a=e[n],[s,r]=yr[n];typeof a=="number"&&Number.isFinite(a)&&(t[n]=Math.min(r,Math.max(s,a)))}),t},hu=1/120,fu=.25,pu=20,Ed=Math.PI/180,ta=new d.Vector3,us=new d.Vector3,gi=new d.Vector3,na=new d.Vector3,We=new d.Vector3,Si=new d.Vector3,qe=new d.Vector3,_t=new d.Vector3,Ei=new d.Vector3,En=new d.Vector3;class ro{constructor(){C(this,"position",new d.Vector3);C(this,"velocity",new d.Vector3);C(this,"ready",!1);C(this,"lastPivot",new d.Vector3);C(this,"lastRest",new d.Vector3(0,-1,0));C(this,"lastLength",0);C(this,"lastTarget",new d.Vector3)}reset(t,n,a){this.position.copy(n).multiplyScalar(a).add(t),this.velocity.set(0,0,0),this.lastPivot.copy(t),this.lastRest.copy(n),this.lastLength=a,this.lastTarget.copy(this.position),this.ready=!0}step(t,n,a,s,r,o=new d.Vector3){ta.copy(n).multiplyScalar(a).add(t);const i=ta.distanceTo(this.lastTarget)>pu*Math.max(a,1e-6);if(!this.ready||!(s>0)||s>fu||i||!(a>0))return this.reset(t,n,a),o.copy(n);const c=2*Math.PI*r.frequency,u=c*c,l=2*r.damping*c,h=r.maxAngle*Ed;us.copy(t).sub(this.lastPivot).divideScalar(s),gi.copy(ta).sub(this.lastTarget).divideScalar(s);const f=Math.max(1,Math.ceil(s/hu)),p=s/f;for(let m=1;m<=f;m+=1){const E=m/f;na.lerpVectors(this.lastPivot,t,E),We.lerpVectors(this.lastRest,n,E),We.lengthSq()<1e-12&&We.copy(n),We.normalize();const S=this.lastLength+(a-this.lastLength)*E;Si.copy(We).multiplyScalar(S).add(na),Ei.copy(Si).sub(this.position).multiplyScalar(u).addScaledVector(En.copy(gi).sub(this.velocity),l),this.velocity.addScaledVector(Ei,p),this.position.addScaledVector(this.velocity,p),qe.copy(this.position).sub(na),qe.lengthSq()<1e-12&&qe.copy(We),qe.normalize();const g=d.MathUtils.clamp(qe.dot(We),-1,1);if(Math.acos(g)>h){_t.copy(qe).addScaledVector(We,-g),_t.lengthSq()<1e-12&&_t.set(1,0,0).cross(We),_t.normalize(),qe.copy(We).multiplyScalar(Math.cos(h)).addScaledVector(_t,Math.sin(h)),En.copy(this.velocity).sub(us);const A=En.dot(_t);A>0&&this.velocity.addScaledVector(_t,-A)}this.position.copy(qe).multiplyScalar(S).add(na),En.copy(this.velocity).sub(us),this.velocity.addScaledVector(qe,-En.dot(qe))}return this.lastPivot.copy(t),this.lastRest.copy(n),this.lastLength=a,this.lastTarget.copy(ta),o.copy(this.position).sub(t).normalize()}}class du{constructor(t){C(this,"joints");C(this,"pivot",new d.Vector3);this.joints=Array.from({length:Math.max(1,Math.floor(t))},()=>new ro)}step(t,n,a,s,r,o){return this.pivot.copy(t),this.joints.forEach((i,c)=>{o[c]??(o[c]=new d.Vector3),i.step(this.pivot,n[c]??n[n.length-1],a[c]??0,s,r,o[c]),this.pivot.copy(i.position)}),o}reset(t,n,a){this.pivot.copy(t),this.joints.forEach((s,r)=>{s.reset(this.pivot,n[r]??n[n.length-1],a[r]??0),this.pivot.copy(s.position)})}}const wr=1.5,Ai=new d.Vector3(0,-1,0),Ad=e=>{for(let t=e;t;t=t.parent)if(!t.visible)return!1;return!0};class oo{constructor(t,n,a={}){C(this,"settings",ao);C(this,"length",wr);C(this,"joint",new ro);C(this,"lastTime",null);C(this,"pivot",new d.Vector3);C(this,"rest",new d.Vector3);C(this,"direction",new d.Vector3);C(this,"linear",new d.Matrix3);this.outer=t,this.inner=n,this.setOptions(a)}setOptions({length:t,...n}){this.settings=so(n),this.length=typeof t=="number"&&Number.isFinite(t)&&t>0?t:wr}update(t){const{outer:n,inner:a}=this;if(!Ad(n)){this.lastTime=null,this.toRest();return}const s=this.lastTime;if(s!==null&&!(t>s))return;this.lastTime=t;const r=n.matrixWorld.elements;this.pivot.set(r[12],r[13],r[14]),this.rest.copy(Ai).transformDirection(n.matrixWorld);const o=(Math.hypot(r[0],r[1],r[2])+Math.hypot(r[4],r[5],r[6])+Math.hypot(r[8],r[9],r[10]))/3,i=this.length*o;if(s===null){this.joint.reset(this.pivot,this.rest,i),this.toRest();return}this.joint.step(this.pivot,this.rest,i,t-s,this.settings,this.direction),this.linear.setFromMatrix4(n.matrixWorld).invert(),this.direction.applyMatrix3(this.linear).normalize(),a.quaternion.setFromUnitVectors(Ai,this.direction),a.updateMatrixWorld(!0)}reset(){this.lastTime=null,this.toRest()}toRest(){this.inner.quaternion.w!==1&&(this.inner.quaternion.identity(),this.inner.updateMatrixWorld(!0))}}const mu=(e,t)=>{const n=t.map(r=>r.toLowerCase()).filter(Boolean),a=[],s=r=>{if(r!==e&&n.some(o=>r.name.toLowerCase().includes(o))){a.push(r);return}r.children.forEach(s)};return s(e),a.map(r=>{const o=r.parent,i=new d.Group;i.name=`${r.name} swing`,i.position.copy(r.position);const c=new d.Group,u=o.children.indexOf(r);return o.remove(r),r.position.set(0,0,0),c.add(r),i.add(c),i.parent=o,o.children.splice(u,0,i),{node:r,outer:i,inner:c}})},gu=({enabled:e=!0,position:t,rotation:n,children:a,...s})=>{const r=J.useThree(f=>f.scene),o=J.useThree(f=>f.get),i=_.useRef(null),c=_.useRef(null),u=_.useRef(null),l=_.useRef({enabled:e});l.current.enabled=e;const h=JSON.stringify(s);return _.useEffect(()=>{if(!i.current||!c.current)return;const f=new oo(i.current,c.current);u.current=f;const p=Gt.addSceneBeforeRender(r,()=>{l.current.enabled?f.update(o().clock.elapsedTime):f.reset()});return()=>{p(),f.reset(),u.current===f&&(u.current=null)}},[r,o]),_.useEffect(()=>{var f;(f=u.current)==null||f.setOptions(JSON.parse(h))},[h]),L.jsx("group",{ref:i,position:t,rotation:n,children:L.jsx("group",{ref:c,children:a})})},vd=5,Md=6,yd=(e,t,n=!1)=>{const a=Wn(e==="left"?"leftEarLobe":"rightEarLobe",n),[s,r,o]=a.position,[i,c,u]=(t==null?void 0:t.position)??[0,0,0],[l,h,f]=(t==null?void 0:t.rotation)??[0,0,0],p=(t==null?void 0:t.scale)??1;return a.mirror?{position:[s-i,r+c,o+u],rotation:[l,-h,-f],scale:[-p,p,p]}:{position:[s+i,r+c,o+u],rotation:[l,h,f],scale:[p,p,p]}},Su=e=>{const t=e.clone(!0);return t.traverse(n=>{if(n.frustumCulled=!1,!(n instanceof d.Mesh)||n.renderOrder!==0)return;const a=Array.isArray(n.material)?n.material:[n.material];n.renderOrder=a.some(s=>s.transparent)?Md:vd}),t},wd=({model:e,children:t,left:n=!0,right:a=!0,offset:s,mirrored:r,swing:o=!1,...i})=>{const c=_.useContext(V.CanonicalHeadFrameContext),u=ae.useXRMirrored();if(!n&&!a)return null;const l=r??u,h=L.jsxs(L.Fragment,{children:[a&&L.jsx(vi,{side:"right",model:e,offset:s,mirrored:l,swing:o,children:t}),n&&L.jsx(vi,{side:"left",model:e,offset:s,mirrored:l,swing:o,children:t})]});return c?h:L.jsx(V.CanonicalHeadFrame,{...i,children:h})},vi=({side:e,model:t,offset:n,mirrored:a,swing:s,children:r})=>{const o=_.useMemo(()=>yd(e,n,a),[e,a,...(n==null?void 0:n.position)??[],...(n==null?void 0:n.rotation)??[],n==null?void 0:n.scale]),i=_.useMemo(()=>t?Su(t):null,[t]);return L.jsx("group",{position:o.position,rotation:o.rotation,scale:o.scale,children:L.jsxs(gu,{enabled:s!==!1,...typeof s=="object"?s:{},children:[i&&L.jsx("primitive",{object:i}),typeof r=="function"?r(e):r]})})},Eu=()=>({irisCenter:{value:new d.Vector2},irisRadius:{value:0},irisOffset:{value:new d.Vector2},irisConfidence:{value:0},irisOpenness:{value:0},time:{value:0},color:{value:new d.Color("#4fa3ff")},opacity:{value:1},mirror:{value:0},tintImage:{value:0},map:{value:null}}),Au=(e,t,n)=>(e.irisCenter.value.set(t.center.x,t.center.y),e.irisRadius.value=t.radius,e.irisOffset.value.set(t.offset.x,t.offset.y),e.irisConfidence.value=t.confidence,e.irisOpenness.value=t.openness,e.time.value=n.time,n.color!==void 0&&e.color.value.set(n.color),n.opacity!==void 0&&(e.opacity.value=n.opacity),e.mirror.value=n.mirrored?1:0,n.tintImage!==void 0&&(e.tintImage.value=n.tintImage?1:0),n.map!==void 0&&(e.map.value=n.map),e),io=`
2
2
  varying vec2 vUv;
3
3
  void main() {
4
4
  vUv = uv;