@volter/editor 0.5.57

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 (141) hide show
  1. package/BUNDLED_NOTICES +6196 -0
  2. package/LICENSE +686 -0
  3. package/LICENSE-BLENDER +1409 -0
  4. package/LICENSE-MCP +21 -0
  5. package/NOTICE +20 -0
  6. package/dist/.vite/manifest.json +1744 -0
  7. package/dist/assets/AudioViewer-DILwc7Pt.js +1 -0
  8. package/dist/assets/BVHLoader--2mLoe3e.js +1 -0
  9. package/dist/assets/BufferGeometryUtils-oP8-Ve4I.js +1 -0
  10. package/dist/assets/ColladaLoader-CyOCKXko.js +3 -0
  11. package/dist/assets/EntityModelDocument-DVlDQ_IJ.js +1 -0
  12. package/dist/assets/EnvironmentAssetDocument-BVGDJjW4.js +5 -0
  13. package/dist/assets/FBXLoader-DzWtiWYm.js +1 -0
  14. package/dist/assets/GameplaySessionTimeline-X_nMT8Sa.js +142 -0
  15. package/dist/assets/ImageViewer-D-aZoyr1.js +1 -0
  16. package/dist/assets/InspectorCanvasPreview-CLDhscy0.js +1 -0
  17. package/dist/assets/InspectorObjectPreview-CpHEw6QH.js +1 -0
  18. package/dist/assets/JsonAssetDocument-CLVN1V9Z.js +3 -0
  19. package/dist/assets/LineSegments2-vfeDUBfs.js +370 -0
  20. package/dist/assets/MTLLoader-D8SKGOsv.js +2 -0
  21. package/dist/assets/ModelAssetDocument-C60lQ11c.js +1 -0
  22. package/dist/assets/NonThreeAuthoringBootstrap-D8oHDftw.js +2 -0
  23. package/dist/assets/OBJLoader-8SrBLZ7J.js +5 -0
  24. package/dist/assets/Object3DPreview-CSmLPKkk.js +2 -0
  25. package/dist/assets/OnlineAssetDetail-D8wVVoay.js +2 -0
  26. package/dist/assets/OrbitControls-BHxt84w6.js +1 -0
  27. package/dist/assets/PLYLoader-BXUWXVtV.js +2 -0
  28. package/dist/assets/RectAreaLightUniformsLib-BGT7Bu4n.js +1 -0
  29. package/dist/assets/STLLoader-U-3fQm8v.js +1 -0
  30. package/dist/assets/SourceAssetViewer-BcOCJ2ye.js +13 -0
  31. package/dist/assets/StageHost-B_YrFNiC.js +1126 -0
  32. package/dist/assets/TDSLoader-BtiaQ4S3.js +1 -0
  33. package/dist/assets/ToolObject3DPreview-Crowr7IN.js +1 -0
  34. package/dist/assets/TransientHint-GNwuzA4c.js +1 -0
  35. package/dist/assets/VideoViewer-CjQ4P9AJ.js +1 -0
  36. package/dist/assets/_commonjsHelpers-D6-XlEtG.js +1 -0
  37. package/dist/assets/agx-base-srgb-BjWZJgrZ.lut +0 -0
  38. package/dist/assets/agx-look-medium-high-contrast-D5F_ob1L.lut +0 -0
  39. package/dist/assets/agx-look-punchy-dxsnycNs.lut +0 -0
  40. package/dist/assets/asset-editor-persistence-D3Yy77wZ.js +1 -0
  41. package/dist/assets/blender-emscripten-engine-C_uFxIuO.js +2 -0
  42. package/dist/assets/blender-node-editor.document-BfvoBocD.js +1 -0
  43. package/dist/assets/blender-outliner-model-B8b00oxr.js +1 -0
  44. package/dist/assets/blender-properties-tab-0M780SHF.js +3 -0
  45. package/dist/assets/blender-runtime-host-D8NHsAfD.js +4 -0
  46. package/dist/assets/blender-runtime-skin-DcwXD-m8.js +61 -0
  47. package/dist/assets/blender-runtime.document-BixTvrw8.js +7 -0
  48. package/dist/assets/blender-timeline.document-RtHIpbT1.js +1 -0
  49. package/dist/assets/blender-uv-editor.document-ChwaS3BG.js +1 -0
  50. package/dist/assets/blender-version.status-Bnhf8h1I.js +1 -0
  51. package/dist/assets/blender-wali-engine-C7bet0ss.js +2 -0
  52. package/dist/assets/blender.command-BCCEp0kb.js +1 -0
  53. package/dist/assets/blender.keymap-GAQgeklK.js +1 -0
  54. package/dist/assets/blender.status-ujwGU6dU.js +1 -0
  55. package/dist/assets/blender.style-Dcem5f_T.js +1 -0
  56. package/dist/assets/browserAll-Do0ehj3Q.js +14 -0
  57. package/dist/assets/client-DNXj_opT.js +25 -0
  58. package/dist/assets/clip-planes-CnAI6DZn.js +1 -0
  59. package/dist/assets/edit-mode-authoring-BX4IRQq9.js +1 -0
  60. package/dist/assets/editor-presentation-activity-C7SNSmTd.js +1 -0
  61. package/dist/assets/events-156d8d12.esm-Dy_KXdhT.js +36 -0
  62. package/dist/assets/fflate.module-DPuTF8aG.js +6 -0
  63. package/dist/assets/filmic-srgb-Ct35FIH6.lut +0 -0
  64. package/dist/assets/hosted-asset-materialization-BK7DHisS.js +2 -0
  65. package/dist/assets/index-5av5LJja.js +1691 -0
  66. package/dist/assets/index-BP6wv2A0.js +5 -0
  67. package/dist/assets/index-Bge9JUr6.js +1 -0
  68. package/dist/assets/index-BncK9THk.js +1 -0
  69. package/dist/assets/index-C5UECeSr.js +952 -0
  70. package/dist/assets/index-CJbYy-CF.js +3 -0
  71. package/dist/assets/index-CanA16PU.js +2 -0
  72. package/dist/assets/index-CinJrH5C.js +9 -0
  73. package/dist/assets/index-Cl83EGRl.js +2 -0
  74. package/dist/assets/index-CtzuWnCS.js +1 -0
  75. package/dist/assets/index-D2LwEE0L.js +562 -0
  76. package/dist/assets/index-D2fNXpHa.css +1 -0
  77. package/dist/assets/index-DUqP1RMl.js +1 -0
  78. package/dist/assets/index-D_NuPfjr.js +9 -0
  79. package/dist/assets/index-DaQZGF7d.js +1 -0
  80. package/dist/assets/index-DgapqSPi.js +7 -0
  81. package/dist/assets/index-IEjydI9d.js +1 -0
  82. package/dist/assets/index-gHZae-lw.js +13 -0
  83. package/dist/assets/jsx-runtime-DPjLkJKQ.js +9 -0
  84. package/dist/assets/model.layout-BJUEQYUI.js +1 -0
  85. package/dist/assets/models.finder-Bm1YfG95.js +1 -0
  86. package/dist/assets/product-Ywxte8eQ.js +1 -0
  87. package/dist/assets/properties-bone-constraints.inspector-Ck0Hzlvr.js +1 -0
  88. package/dist/assets/properties-bone.inspector-B8M42o0V.js +1 -0
  89. package/dist/assets/properties-collection.inspector-D-RSO5zy.js +1 -0
  90. package/dist/assets/properties-constraints.inspector-DbJa57oa.js +1 -0
  91. package/dist/assets/properties-data.inspector-DLgjbRW6.js +1 -0
  92. package/dist/assets/properties-material.inspector-B11LZYDW.js +1 -0
  93. package/dist/assets/properties-modifiers.inspector-BCWwuA26.js +1 -0
  94. package/dist/assets/properties-object.inspector-UZVJG49S.js +1 -0
  95. package/dist/assets/properties-output.inspector-XOwcBits.js +1 -0
  96. package/dist/assets/properties-particles.inspector-By04vT7R.js +1 -0
  97. package/dist/assets/properties-physics.inspector-D3T7FLdg.js +1 -0
  98. package/dist/assets/properties-render.inspector-Y0Rjr9gZ.js +1 -0
  99. package/dist/assets/properties-scene.inspector-CfyDWB4W.js +1 -0
  100. package/dist/assets/properties-texture.inspector-AFRsJx6-.js +1 -0
  101. package/dist/assets/properties-view-layer.inspector-Co07LAmQ.js +1 -0
  102. package/dist/assets/properties-world.inspector-C7T4JocI.js +1 -0
  103. package/dist/assets/react-18-DyywM-Z2.js +1 -0
  104. package/dist/assets/react-story-board-vrmj74Ng.js +1 -0
  105. package/dist/assets/react-three-rapier.esm-D874pLFD.js +1 -0
  106. package/dist/assets/sculpt.layout-zJF55yCR.js +1 -0
  107. package/dist/assets/session-1bPxsLdy.js +4167 -0
  108. package/dist/assets/shading.layout-DULYZV6M.js +1 -0
  109. package/dist/assets/sky-precompute-worker-ChN7J87v.js +1 -0
  110. package/dist/assets/spark.module-D1CUMLYS.js +12120 -0
  111. package/dist/assets/stage-keyboard-Cx90EYIT.js +1 -0
  112. package/dist/assets/stage-overlay-set-duu3P0mZ.js +1 -0
  113. package/dist/assets/stage-presence-markers-DKH3p_ao.js +1 -0
  114. package/dist/assets/story-capture-Dqurwlhr.js +1 -0
  115. package/dist/assets/story-mount-turn-2IYGgHob.js +1 -0
  116. package/dist/assets/story-pixi-preview-c78Aygdi.js +1 -0
  117. package/dist/assets/story-three-preview-CbZo5B3D.js +2 -0
  118. package/dist/assets/texture.layout-DASpHVht.js +1 -0
  119. package/dist/assets/three.module-BynznMJN.js +3840 -0
  120. package/dist/assets/uv-editing.layout-BEKHxmHw.js +1 -0
  121. package/dist/assets/vgai-shared-fontawesome-CFSkqz69.js +1 -0
  122. package/dist/assets/vgai-shared-jsx-dev-runtime-VfxIYu0y.js +9 -0
  123. package/dist/assets/vgai-shared-jsx-runtime-DIqBpTut.js +1 -0
  124. package/dist/assets/vgai-shared-react-DL5U9FnC.js +1 -0
  125. package/dist/assets/vgai-shared-react-dom-DFajMqMT.js +1 -0
  126. package/dist/assets/vgai-shared-react-dom-client-S0ozfl6_.js +1 -0
  127. package/dist/assets/vgai-shared-three-BWkbSQ3V.js +1 -0
  128. package/dist/assets/viewport-pick-context-DkawXbEi.js +1 -0
  129. package/dist/assets/webworkerAll-iMzrvNir.js +101 -0
  130. package/dist/assets/worker-DTgfRRas.js +1 -0
  131. package/dist/assets/world-documents-CGbrcsYk.js +3 -0
  132. package/dist/vgai-shared-react.json +10 -0
  133. package/dist/vgai-shared-three.json +3 -0
  134. package/dist-node/cli.js +17823 -0
  135. package/dist-node/create.js +14084 -0
  136. package/package.json +56 -0
  137. package/presets.mjs +2 -0
  138. package/src/contributions.d.ts +4 -0
  139. package/src/index.ts +9 -0
  140. package/starter/cube.blend +0 -0
  141. package/starter/cube.py +81 -0
@@ -0,0 +1 @@
1
+ import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{r as o}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{k as B,m as H,p as W,n as M,T as v,B as P,q as h,v as F}from"./index-5av5LJja.js";import"./index-D2LwEE0L.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";function Q({assetPath:n,displayName:l}){const{sheetPath:i,frameName:t}=B(n),s=`/${i}`,[r,a]=o.useState(null),[x,p]=o.useState(t),[m,u]=o.useState("fit"),[j,I]=o.useState(null),w=o.useRef(null),[y,N]=o.useState({w:320,h:240}),f=x??t,g=f?r?.frames.find(c=>c.name===f)??null:null;o.useEffect(()=>{p(t),u("fit")},[t]),o.useEffect(()=>{if(!t){a(null);return}let c=!1;return fetch(`/${H(i)}`).then(d=>d.ok?d.text():null).then(d=>{c||!d||a(W(d))}).catch(()=>{c||a(null)}),()=>{c=!0}},[t,i]),o.useEffect(()=>{const c=w.current;if(!c)return;const d=new ResizeObserver(R=>{const S=R[0]?.contentRect;S&&N({w:Math.max(1,S.width-24),h:Math.max(1,S.height-24)})});return d.observe(c),()=>d.disconnect()},[]);const b=g?.sourceWidth??j?.w??0,$=g?.sourceHeight??j?.h??0,k=M(m,b,$,y.w,y.h),E=l??f??i.split("/").pop()??n;return e.jsxs("div",{"data-testid":"image-asset-document",style:{height:"100%",minHeight:240,display:"flex",flexDirection:"column",minWidth:0},children:[e.jsx(T,{title:E,srcWidth:b,srcHeight:$,scaleMode:m,scale:k,onScaleMode:u}),e.jsx(z,{stageRef:w,frameName:t,frame:g,sheet:r,sheetUrl:s,title:E,scale:k,onNatural:I}),r&&r.frames.length>1?e.jsx(C,{sheetUrl:s,frames:r.frames,activeName:f,onPick:p}):null]})}function T({title:n,srcWidth:l,srcHeight:i,scaleMode:t,scale:s,onScaleMode:r}){return e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:6,padding:"6px 8px"},children:[e.jsx(v,{tone:"dim",variant:"label",children:n}),l>0&&e.jsxs(v,{tone:"muted",variant:"code",children:[l," × ",i,t==="fit"?` · ${O(s)}`:""]}),e.jsx("span",{style:{flex:1}}),[1,4,8,"fit"].map(a=>e.jsx(P,{type:"button",size:"compact",shape:"segment","aria-pressed":t===a,variant:t===a?"primary":"secondary",onClick:()=>r(a),children:a==="fit"?"Fit":`${a}×`},String(a)))]})}function z({stageRef:n,frameName:l,frame:i,sheet:t,sheetUrl:s,title:r,scale:a,onNatural:x}){let p;return l&&!i?p=e.jsx(v,{tone:"muted",variant:"body",children:t?`No sprite named ${l}`:"Loading sprite…"}):i?p=e.jsx(F,{sheetUrl:s,frame:i,scale:a}):p=e.jsx("img",{src:s,alt:r,style:{imageRendering:"pixelated",display:"block",transform:`scale(${a})`,transformOrigin:"center center"},onLoad:m=>{const u=m.currentTarget;x({w:u.naturalWidth,h:u.naturalHeight})}}),e.jsx("div",{ref:n,className:"vgai-asset-transparency-well","data-testid":"sprite-stage",style:{flex:1,minHeight:0,display:"flex",alignItems:"center",justifyContent:"center",overflow:"auto"},children:p})}function C({sheetUrl:n,frames:l,activeName:i,onPick:t}){return e.jsx("div",{"data-testid":"sprite-filmstrip",style:{display:"flex",gap:6,overflowX:"auto",padding:"8px 8px 10px",borderTop:`1px solid ${h[3]}`},children:l.map(s=>{const r=s.name===i;return e.jsxs("button",{type:"button",title:s.name,"aria-pressed":r,onClick:()=>t(s.name),style:{border:r?`1px solid ${h[1]}`:"1px solid transparent",background:"transparent",padding:2,cursor:"pointer",flex:"0 0 auto"},children:[e.jsx(F,{sheetUrl:n,frame:s,maxEdge:40}),e.jsx("div",{style:{fontSize:9,color:r?h[1]:h[3],maxWidth:56,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.name})]},s.name)})})}function O(n){return n>=1?`${n}×`:`1/${Math.round(1/n)}×`}export{Q as ImageViewer};
@@ -0,0 +1 @@
1
+ import{a as i}from"./jsx-runtime-DPjLkJKQ.js";import{r as o}from"./index-DaQZGF7d.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";function f({capture:r,previewKey:s,size:l}){const[n,e]=o.useState(null);return o.useEffect(()=>{let t=!1;return e(null),r(l).then(a=>{t||e(a)},()=>{t||e(null)}),()=>{t=!0}},[r,s,l]),n?i.jsx("img",{src:n,alt:"Selected object preview",className:"vgai-component-thumbnail"}):null}export{f as InspectorCanvasPreview};
@@ -0,0 +1 @@
1
+ import{a as t}from"./jsx-runtime-DPjLkJKQ.js";import{Object3DSnapshotDocument as p}from"./EntityModelDocument-DVlDQ_IJ.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-DaQZGF7d.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-5av5LJja.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";import"./StageHost-B_YrFNiC.js";import"./clip-planes-CnAI6DZn.js";import"./OrbitControls-BHxt84w6.js";import"./LineSegments2-vfeDUBfs.js";import"./viewport-pick-context-DkawXbEi.js";import"./editor-presentation-activity-C7SNSmTd.js";function I({previewKey:i,object:o,displayName:r,fill:e=!1}){return t.jsx("div",{"data-testid":"inspector-object-preview",style:e?{position:"absolute",inset:0,overflow:"hidden"}:{width:"100%",height:220,minHeight:220,borderBottom:"1px solid var(--vgai-structural-divider)",overflow:"hidden",position:"relative"},children:t.jsx(p,{documentId:`inspector-preview:${i}`,source:o,displayName:r,active:!0,chromeless:!0})})}export{I as InspectorObjectPreview};
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DgapqSPi.js","assets/index-BP6wv2A0.js","assets/index-CJbYy-CF.js","assets/index-CanA16PU.js","assets/index-Bge9JUr6.js","assets/index-gHZae-lw.js","assets/index-BncK9THk.js","assets/index-IEjydI9d.js","assets/index-DUqP1RMl.js"])))=>i.map(i=>d[i]);
2
+ import{a as m}from"./jsx-runtime-DPjLkJKQ.js";import{r as d}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{t as i,_ as b,b4 as W,S as X,aH as Y}from"./index-5av5LJja.js";import"./index-D2LwEE0L.js";import{O as Z,Q as ee,V as _,C as te,G as F}from"./StageHost-B_YrFNiC.js";const re={ts:"typescript",tsx:"typescript",mts:"typescript",cts:"typescript",js:"typescript",jsx:"typescript",mjs:"typescript",cjs:"typescript",json:"json",jsonc:"json",json5:"json"};function Je(e){const r=e.split("/").pop()??e,t=r.lastIndexOf(".");return t<0?"text":re[r.slice(t+1).toLowerCase()]??"text"}let I=null;function ne(){return I??=Promise.all([b(()=>import("./index-BP6wv2A0.js"),[]),b(()=>import("./index-DgapqSPi.js").then(e=>e.i),__vite__mapDeps([0,1])),b(()=>import("./index-CJbYy-CF.js").then(e=>e.w),__vite__mapDeps([2,1,0])),b(()=>import("./index-CanA16PU.js"),__vite__mapDeps([3,0,1])),b(()=>import("./index-Bge9JUr6.js"),__vite__mapDeps([4,1,0,2])),b(()=>import("./index-gHZae-lw.js"),__vite__mapDeps([5,6,2,1,0])),b(()=>import("./index-IEjydI9d.js"),__vite__mapDeps([7,6,2,1,0])),b(()=>import("./index-DUqP1RMl.js"),__vite__mapDeps([8,0,1,2]))]).then(([e,r,t,n,o,a,l,c])=>({state:e,view:r,language:t,search:n,commands:o,javascript:a,json:l,oneDark:c})),I}function C(e){return typeof e=="number"?`${e}px`:e}function L(e){return typeof e=="string"&&e.trim().endsWith("%")}function oe(e,r){let t=0;for(;t<e.length&&t<r.length&&e[t]===r[t];)t++;let n=e.length,o=r.length;for(;n>t&&o>t&&e[n-1]===r[o-1];)n--,o--;return{from:t,oldEnd:n,newEnd:o}}const q=1800,J=`color-mix(in srgb, ${i.semantic.warning} 42%, transparent)`,V=`color-mix(in srgb, ${i.semantic.warning} 18%, transparent)`;function se(e){class r extends e.view.WidgetType{constructor(a){super(),this.revision=a}eq(a){return this.revision===a.revision}toDOM(){const a=document.createElement("span");return a.className=`cm-source-deletion cm-source-change cm-source-change-${this.revision%2}`,a.setAttribute("aria-hidden","true"),a}}const t=e.state.StateEffect.define(),n=e.state.StateField.define({create:()=>e.view.Decoration.none,update(o,a){let l=o.map(a.changes);for(const c of a.effects){if(!c.is(t))continue;if(!c.value){l=e.view.Decoration.none;continue}const{from:u,to:s,revision:p}=c.value,h=u===s?e.view.Decoration.widget({widget:new r(p),side:-1}).range(u):e.view.Decoration.mark({class:`cm-source-change cm-source-change-${p%2}`}).range(u,s);l=e.view.Decoration.set([h])}return l},provide:o=>e.view.EditorView.decorations.from(o)});return{mark:t,field:n}}function ie(e,r,t){return e.view.EditorView.theme({"&":{color:i.content.primary,backgroundColor:"transparent",fontSize:`${r}px`,...L(t)?{height:C(t)}:{}},"&.cm-focused":{outline:"none"},".cm-content":{fontFamily:i.typography.mono,padding:"2px 0",caretColor:"transparent"},".cm-scroller":{fontFamily:i.typography.mono,lineHeight:"1.5",overflow:"auto",...t===void 0?{}:{maxHeight:C(t)}},".cm-gutters":{backgroundColor:"transparent",color:i.content.dim,border:"none",userSelect:"none"},".cm-lineNumbers .cm-gutterElement":{padding:"0 8px 0 4px",minWidth:"2ch"},".cm-content ::selection":{backgroundColor:i.selection.background},".cm-panels":{backgroundColor:i.surface.raised,color:i.content.primary,border:"none",fontFamily:i.typography.sans},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${i.boundary.default}`},".cm-textfield":{backgroundColor:i.surface.inset,color:i.content.primary,border:`1px solid ${i.boundary.default}`,borderRadius:i.shape.small},".cm-button":{backgroundColor:i.surface.raised,backgroundImage:"none",color:i.content.primary,border:`1px solid ${i.boundary.default}`,borderRadius:i.shape.small},".cm-searchMatch":{backgroundColor:i.accent.muted},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:i.accent.default,color:i.content.onAccent},".cm-source-change":{backgroundColor:J,borderRadius:"2px"},".cm-line:has(.cm-source-change)":{backgroundColor:V},".cm-source-change, .cm-line:has(.cm-source-change)":{animationDuration:`${q}ms`,animationTimingFunction:"ease-out",animationFillMode:"forwards"},".cm-source-deletion":{display:"inline-block",width:"0",position:"relative"},".cm-source-deletion::after":{content:'""',position:"absolute",left:"-2px",bottom:"0",width:"4px",height:"1em",backgroundColor:"inherit",borderRadius:"2px"},".cm-source-change-0":{animationName:"vgai-source-change-even"},".cm-source-change-1":{animationName:"vgai-source-change-odd"},".cm-line:has(.cm-source-change-0)":{animationName:"vgai-source-line-even"},".cm-line:has(.cm-source-change-1)":{animationName:"vgai-source-line-odd"},"@keyframes vgai-source-line-even":{"0%, 40%":{backgroundColor:V},"100%":{backgroundColor:"transparent"}},"@keyframes vgai-source-line-odd":{"0%, 40%":{backgroundColor:V},"100%":{backgroundColor:"transparent"}},"@keyframes vgai-source-change-even":{"0%, 40%":{backgroundColor:J},"100%":{backgroundColor:"transparent"}},"@keyframes vgai-source-change-odd":{"0%, 40%":{backgroundColor:J},"100%":{backgroundColor:"transparent"}},"@media (prefers-reduced-motion: reduce)":{".cm-source-change, .cm-line:has(.cm-source-change)":{animation:"none"}},".cm-matchingBracket, &.cm-focused .cm-matchingBracket":{backgroundColor:i.neutralOverlay.active,outline:`1px solid ${i.boundary.strong}`}},{dark:!0})}function ae(e,r,t,n){const o=r==="typescript"?[e.javascript.javascript({typescript:!0,jsx:!0})]:r==="json"?[e.json.json()]:[];return[e.view.lineNumbers(),e.view.highlightSpecialChars(),e.language.bracketMatching(),e.language.syntaxHighlighting(e.oneDark.oneDarkHighlightStyle),e.search.search({top:!0}),e.view.keymap.of([...e.commands.standardKeymap,...e.search.searchKeymap]),e.view.EditorView.lineWrapping,e.state.EditorState.readOnly.of(!0),e.view.EditorView.editable.of(!1),e.view.EditorView.contentAttributes.of({tabindex:"0"}),...o,ie(e,t,n)]}function ce({value:e,language:r,fontSize:t=11,maxHeight:n,ariaLabel:o,followChanges:a=!1}){const l=d.useRef(null),c=d.useRef(null),u=d.useRef(null),s=d.useRef(null),p=d.useRef(0),h=d.useRef(e);h.current=e;const[f,N]=d.useState(null),[D,T]=d.useState(!1);d.useEffect(()=>{let g=!1;return ne().then(y=>{g||N(y)},()=>{g||T(!0)}),()=>{g=!0}},[]),d.useEffect(()=>{const g=l.current;if(!g||!f)return;const y=se(f),v=new f.view.EditorView({parent:g,state:f.state.EditorState.create({doc:h.current,extensions:[ae(f,r,t,n),y.field]})});return c.current=v,u.current=y,()=>{s.current!==null&&clearTimeout(s.current),s.current=null,u.current=null,c.current=null,v.destroy()}},[f,r,t,n]),d.useEffect(()=>{const g=c.current;if(!g)return;const y=g.state.toText(e).toString(),v=g.state.doc.toString();if(v===y)return;const{from:j,oldEnd:K,newEnd:B}=oe(v,y),M=g.state.changes({from:j,to:K,insert:y.slice(j,B)}),S=u.current,x=[];if(a&&f&&S){const E=g.coordsAtPos(j),O=g.scrollDOM.getBoundingClientRect(),z=E&&E.top>=O.top&&E.bottom<=O.bottom&&E.left>=O.left&&E.right<=O.right?g.scrollSnapshot().map(M):f.view.EditorView.scrollIntoView(j,{y:"nearest",x:"nearest"});z&&x.push(z),x.push(S.mark.of({from:j,to:B,revision:++p.current}))}else S&&x.push(S.mark.of(null));g.dispatch({changes:M,effects:x}),s.current!==null&&clearTimeout(s.current),s.current=null,a&&S&&(s.current=setTimeout(()=>{c.current===g&&g.dispatch({effects:S.mark.of(null)}),s.current=null},q))},[e,a,f]);const k=L(n)?{height:"100%",minHeight:0}:{};return f?m.jsx("div",{ref:l,role:"group","aria-label":o,style:{minWidth:0,...k}}):m.jsxs("div",{role:"group","aria-label":o,style:{minWidth:0,...k},children:[D&&m.jsx("div",{style:{color:i.semantic.warning,fontSize:10,marginBottom:4},children:"Syntax highlighting failed to load — showing plain text."}),m.jsx("pre",{style:{margin:0,fontFamily:i.typography.mono,fontSize:t,lineHeight:1.5,color:i.content.primary,whiteSpace:"pre-wrap",wordBreak:"break-word",overflow:"auto",...n===void 0?{}:{maxHeight:C(n)},...L(n)?{height:C(n)}:{}},children:e})]})}const le={fontSize:11,color:i.content.muted,marginBottom:2};function ue({assetPath:e}){const[r,t]=d.useState(null),[n,o]=d.useState("json"),[a,l]=d.useState(!1),c=e.split("/").pop()??e;return d.useEffect(()=>{let u=!1;return t(null),l(!1),fetch(W(e)).then(s=>s.text()).then(s=>{try{const p=JSON.parse(s);u||(o("json"),t(JSON.stringify(p,null,2)))}catch{u||(o("text"),t(s))}}).catch(()=>{u||l(!0)}),()=>{u=!0}},[e]),m.jsxs("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:8},children:[m.jsx("div",{style:{fontWeight:600,fontSize:12,color:i.content.primary,wordBreak:"break-all"},children:c}),m.jsx("div",{className:"vgai-content-frost",style:{border:`1px solid ${i.boundary.default}`,borderRadius:i.shape.small,padding:8,overflow:"hidden",maxHeight:500},children:a?m.jsx("span",{style:{color:i.semantic.danger,fontSize:11},children:"Failed to load file"}):r===null?m.jsx("span",{style:{color:i.content.muted,fontSize:11},children:"Loading..."}):m.jsx(ce,{value:r,language:n,fontSize:10,maxHeight:484,ariaLabel:`Contents of ${c}`})}),m.jsx(X,{label:"Info",defaultOpen:!1,children:m.jsxs("div",{children:[m.jsx("div",{style:le,children:"Path"}),m.jsx("div",{style:{fontSize:11,color:i.content.primary,wordBreak:"break-all"},children:e})]})})]})}function pe(e){const r=[],t=new Set;return e.traverse(n=>{if(n.type!=="ParticleEmitter")return;const o=n.system;!o||typeof o.getRendererSettings!="function"||t.has(o)||(t.add(o),r.push(o))}),r}function de(e){const r=e.split(/[?#]/,1)[0].replace(/^\/+/,"");return r.startsWith("public/")?r:`public/${r}`}const $=new WeakMap;function R(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function G(e){return R(e)?e:null}function P(e,r){r(e);for(const t of e.children??[])P(t,r)}function me(e){if(!R(e))return!1;const r=G(e.object);if(!r)return!1;let t=!1;return P(r,n=>{n.type==="ParticleEmitter"&&R(n.ps)&&n.ps.version!==void 0&&(t=!0)}),t}function fe(e){const r=new Map,t=G(e.object);return t&&P(t,n=>{typeof n.uuid=="string"&&r.set(n.uuid,n)}),r}function ge(e){const r=new ee().parse(e.json),t=fe(e.json),n=pe(r),o=new Map(n.map(c=>[c.emitter,c])),a=new Map;if(r.traverse(c=>{const u=o.get(c);if(!u)return;const s=t.get(c.uuid);if(!s?.ps)throw new Error(`Native Quarks emitter ${c.name||c.uuid} has no matching JSON node.`);a.set(c,{system:u,json:s})}),a.size===0)throw new Error("The Quarks document contains no loadable emitter.");const l={root:r,originalText:e.text,json:e.json,emitters:a,dirty:!1};return $.set(r,l),l}function U(e){const r=$.get(e);if(!r)throw new Error("Object3D is not a native three.quarks JSON document.");return r}function he(e){for(const r of e.emitters.values())r.system.dispose();$.delete(e.root)}function ye(e){const r=U(e);return r.dirty?`${JSON.stringify(r.json,null,2)}
3
+ `:r.originalText}const be=new Set(["particles.duration","particles.looping","particles.prewarm","particles.worldSpace","particles.startLife","particles.startSpeed","particles.startRotation","particles.startSize","particles.startColor","particles.emissionOverTime","particles.emissionOverDistance"]);function we(){return[{path:"particles.duration",label:"Duration",type:"number",group:"Emission"},{path:"particles.looping",label:"Looping",type:"boolean",group:"Emission"},{path:"particles.prewarm",label:"Prewarm",type:"boolean",group:"Emission"},{path:"particles.emissionOverTime",label:"Rate over time",type:"json",group:"Emission"},{path:"particles.emissionOverDistance",label:"Rate over distance",type:"json",group:"Emission"},{path:"particles.startLife",label:"Lifetime",type:"json",group:"Start"},{path:"particles.startSpeed",label:"Speed",type:"json",group:"Start"},{path:"particles.startRotation",label:"Rotation",type:"json",group:"Start"},{path:"particles.startSize",label:"Size",type:"json",group:"Start"},{path:"particles.startColor",label:"Color",type:"json",group:"Start"},{path:"particles.worldSpace",label:"World space",type:"boolean",group:"Simulation"},{path:"particles.shape",label:"Shape",type:"string",readonly:!0,group:"Shape"},{path:"particles.behaviors",label:"Modules",type:"json",readonly:!0,group:"Behavior"},{path:"particles.renderMode",label:"Native render mode",type:"number",readonly:!0,group:"Renderer"}]}function w(e,r){if(!R(e)||typeof e.type!="string")throw new Error(`${r} must be a native quarks function JSON object with a type.`);return e}function Q(e,r){const{system:t}=e;switch(r){case"particles.duration":return t.duration;case"particles.looping":return t.looping;case"particles.prewarm":return t.prewarm;case"particles.worldSpace":return t.worldSpace;case"particles.startLife":return t.startLife.toJSON();case"particles.startSpeed":return t.startSpeed.toJSON();case"particles.startRotation":return t.startRotation.toJSON();case"particles.startSize":return t.startSize.toJSON();case"particles.startColor":return t.startColor.toJSON();case"particles.emissionOverTime":return t.emissionOverTime.toJSON();case"particles.emissionOverDistance":return t.emissionOverDistance.toJSON();case"particles.shape":return t.emitterShape.type;case"particles.behaviors":return t.behaviors.map(n=>n.type);case"particles.renderMode":return t.renderMode;default:return}}function A(e){return e.slice(10)}function H(e,r,t){const{system:n}=e;switch(r){case"particles.duration":{const o=Number(t);if(!Number.isFinite(o)||o<=0)throw new Error("Particle duration must be a positive finite number.");n.duration=o;break}case"particles.looping":n.looping=!!t;break;case"particles.prewarm":n.prewarm=!!t;break;case"particles.worldSpace":n.worldSpace=!!t;break;case"particles.startLife":n.startLife=_(w(t,"Lifetime"));break;case"particles.startSpeed":n.startSpeed=_(w(t,"Speed"));break;case"particles.startRotation":n.startRotation=F(w(t,"Rotation"));break;case"particles.startSize":n.startSize=F(w(t,"Size"));break;case"particles.startColor":n.startColor=te(w(t,"Color"));break;case"particles.emissionOverTime":n.emissionOverTime=_(w(t,"Rate over time"));break;case"particles.emissionOverDistance":n.emissionOverDistance=_(w(t,"Rate over distance"));break;default:throw new Error(`Particle field ${r} is read-only.`)}e.json.ps[A(r)]=t,n.restart()}function Se(e,r,t,n){H(e,r,t),e.json.ps[A(r)]=n}function ve(e){return e===void 0?void 0:JSON.parse(JSON.stringify(e))}const je=({root:e,defaultAdapter:r,commit:t})=>{const n=U(e),o=new Set,a=()=>{for(const s of o)s()},l=s=>{const p=r.hierarchy.object3D?.(s);return p?n.emitters.get(p)??null:null},c={properties:s=>[...r.inspector?.properties(s)??[],...l(s)?we():[]],get:(s,p)=>{const h=l(s);return h&&p.startsWith("particles.")?Q(h,p):r.inspector?.get(s,p)},set:async(s,p,h)=>{const f=l(s);if(!f||!be.has(p)){await r.inspector?.set(s,p,h);return}const N=Q(f,p),D=A(p),T=ve(f.json.ps?.[D]),k=n.dirty;try{H(f,p,h),n.dirty=!0,a(),await t(`Edit ${f.system.emitter.name||"Particle Emitter"}`)}catch(g){throw Se(f,p,N,T),n.dirty=k,a(),g}}};return{adapter:{capabilities:{...r.capabilities,inspectorFields:!0,persist:!0},provenance:{source:"document",label:"three.quarks JSON",detail:"The hierarchy and emitter fields are the native three.quarks Object3D JSON document."},hierarchy:r.hierarchy,...r.selection?{selection:r.selection}:{},...r.transforms?{transforms:r.transforms}:{},inspector:c,subscribe:s=>{o.add(s);const p=r.subscribe?.(s)??(()=>{});return()=>{o.delete(s),p()}}},dispose:()=>o.clear()}};async function Ee(e,r){const t=await fetch(W(e),{cache:"no-store",...r?{signal:r}:{}});if(!t.ok)throw new Error(`Could not load ${e}: HTTP ${t.status}.`);const n=await t.text();let o;try{o=JSON.parse(n)}catch{return null}return me(o)?{text:n,json:o,projectPath:de(e)}:null}function ke({documentId:e,assetPath:r,displayName:t,active:n,source:o}){const[a,l]=d.useState(null),[c,u]=d.useState(null);d.useEffect(()=>{if(!n){l(null);return}let h=null;try{h=ge(o),l(h),u(null)}catch(f){u(f instanceof Error?f.message:String(f))}return()=>{h&&he(h)}},[n,o]);const s=d.useCallback(()=>{if(!a)throw new Error(`Particle asset ${r} is not loaded.`);return{root:a.root,dispose(){}}},[a,r]),p=d.useMemo(()=>({label:`Edit ${t}`,resources:[{path:o.projectPath,contentType:"application/json",serialize:({root:h})=>ye(h)}]}),[t,o.projectPath]);return c?m.jsx("div",{role:"alert",style:{padding:20,color:i.semantic.danger},children:c}):a?m.jsx(Z,{documentId:e,sourcePath:r,displayName:t,build:s,active:n,assetType:"particles",persistence:p,authoring:je,dressing:{grid:!0}}):m.jsxs("div",{style:{padding:20,color:i.content.muted},children:["Loading ",t,"…"]})}function xe({documentId:e,assetPath:r,displayName:t,active:n,sections:o,status:a}){const[l,c]=d.useState({kind:"loading"});return d.useEffect(()=>{if(!n){c({kind:"loading"});return}const u=new AbortController;return c({kind:"loading"}),Ee(r,u.signal).then(s=>{u.signal.aborted||c(s?{kind:"quarks",source:s}:{kind:"generic"})},s=>{u.signal.aborted||c({kind:"error",message:s instanceof Error?s.message:String(s)})}),()=>u.abort()},[n,r]),l.kind==="quarks"?m.jsx(ke,{documentId:e,assetPath:r,displayName:t,active:n,source:l.source}):m.jsx(Y,{documentId:e,active:n,type:"json",title:t,sections:o,status:a,children:l.kind==="loading"?m.jsxs("div",{style:{padding:20,color:i.content.muted},children:["Inspecting ",t,"…"]}):l.kind==="error"?m.jsx("div",{role:"alert",style:{padding:20,color:i.semantic.danger},children:l.message}):m.jsx(ue,{assetPath:r})})}const Ve=Object.freeze(Object.defineProperty({__proto__:null,JsonAssetDocument:xe},Symbol.toStringTag,{value:"Module"}));export{ce as C,xe as J,Ve as a,Je as c};
@@ -0,0 +1,370 @@
1
+ import{g as X,bg as B,bh as G,a as $,ba as M,an as K,aC as I,bi as O,bj as _,bk as Q,ap as C,bl as V,V as y,a0 as Y,c as E,bm as Z,x as ee,b as te}from"./three.module-BynznMJN.js";M.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new $(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};B.line={uniforms:G.merge([M.common,M.fog,M.line]),vertexShader:`
2
+ #include <common>
3
+ #include <color_pars_vertex>
4
+ #include <fog_pars_vertex>
5
+ #include <logdepthbuf_pars_vertex>
6
+ #include <clipping_planes_pars_vertex>
7
+
8
+ uniform float linewidth;
9
+ uniform vec2 resolution;
10
+
11
+ attribute vec3 instanceStart;
12
+ attribute vec3 instanceEnd;
13
+
14
+ attribute vec3 instanceColorStart;
15
+ attribute vec3 instanceColorEnd;
16
+
17
+ #ifdef WORLD_UNITS
18
+
19
+ varying vec4 worldPos;
20
+ varying vec3 worldStart;
21
+ varying vec3 worldEnd;
22
+
23
+ #ifdef USE_DASH
24
+
25
+ varying vec2 vUv;
26
+
27
+ #endif
28
+
29
+ #else
30
+
31
+ varying vec2 vUv;
32
+
33
+ #endif
34
+
35
+ #ifdef USE_DASH
36
+
37
+ uniform float dashScale;
38
+ attribute float instanceDistanceStart;
39
+ attribute float instanceDistanceEnd;
40
+ varying float vLineDistance;
41
+
42
+ #endif
43
+
44
+ void trimSegment( const in vec4 start, inout vec4 end ) {
45
+
46
+ // trim end segment so it terminates between the camera plane and the near plane
47
+
48
+ // conservative estimate of the near plane
49
+ float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
50
+ float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
51
+ float nearEstimate = - 0.5 * b / a;
52
+
53
+ float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
54
+
55
+ end.xyz = mix( start.xyz, end.xyz, alpha );
56
+
57
+ }
58
+
59
+ void main() {
60
+
61
+ #ifdef USE_COLOR
62
+
63
+ vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
64
+
65
+ #endif
66
+
67
+ #ifdef USE_DASH
68
+
69
+ vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
70
+ vUv = uv;
71
+
72
+ #endif
73
+
74
+ float aspect = resolution.x / resolution.y;
75
+
76
+ // camera space
77
+ vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
78
+ vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
79
+
80
+ #ifdef WORLD_UNITS
81
+
82
+ worldStart = start.xyz;
83
+ worldEnd = end.xyz;
84
+
85
+ #else
86
+
87
+ vUv = uv;
88
+
89
+ #endif
90
+
91
+ // special case for perspective projection, and segments that terminate either in, or behind, the camera plane
92
+ // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
93
+ // but we need to perform ndc-space calculations in the shader, so we must address this issue directly
94
+ // perhaps there is a more elegant solution -- WestLangley
95
+
96
+ bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
97
+
98
+ if ( perspective ) {
99
+
100
+ if ( start.z < 0.0 && end.z >= 0.0 ) {
101
+
102
+ trimSegment( start, end );
103
+
104
+ } else if ( end.z < 0.0 && start.z >= 0.0 ) {
105
+
106
+ trimSegment( end, start );
107
+
108
+ }
109
+
110
+ }
111
+
112
+ // clip space
113
+ vec4 clipStart = projectionMatrix * start;
114
+ vec4 clipEnd = projectionMatrix * end;
115
+
116
+ // ndc space
117
+ vec3 ndcStart = clipStart.xyz / clipStart.w;
118
+ vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
119
+
120
+ // direction
121
+ vec2 dir = ndcEnd.xy - ndcStart.xy;
122
+
123
+ // account for clip-space aspect ratio
124
+ dir.x *= aspect;
125
+ dir = normalize( dir );
126
+
127
+ #ifdef WORLD_UNITS
128
+
129
+ vec3 worldDir = normalize( end.xyz - start.xyz );
130
+ vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );
131
+ vec3 worldUp = normalize( cross( worldDir, tmpFwd ) );
132
+ vec3 worldFwd = cross( worldDir, worldUp );
133
+ worldPos = position.y < 0.5 ? start: end;
134
+
135
+ // height offset
136
+ float hw = linewidth * 0.5;
137
+ worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;
138
+
139
+ // don't extend the line if we're rendering dashes because we
140
+ // won't be rendering the endcaps
141
+ #ifndef USE_DASH
142
+
143
+ // cap extension
144
+ worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;
145
+
146
+ // add width to the box
147
+ worldPos.xyz += worldFwd * hw;
148
+
149
+ // endcaps
150
+ if ( position.y > 1.0 || position.y < 0.0 ) {
151
+
152
+ worldPos.xyz -= worldFwd * 2.0 * hw;
153
+
154
+ }
155
+
156
+ #endif
157
+
158
+ // project the worldpos
159
+ vec4 clip = projectionMatrix * worldPos;
160
+
161
+ // shift the depth of the projected points so the line
162
+ // segments overlap neatly
163
+ vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
164
+ clip.z = clipPose.z * clip.w;
165
+
166
+ #else
167
+
168
+ vec2 offset = vec2( dir.y, - dir.x );
169
+ // undo aspect ratio adjustment
170
+ dir.x /= aspect;
171
+ offset.x /= aspect;
172
+
173
+ // sign flip
174
+ if ( position.x < 0.0 ) offset *= - 1.0;
175
+
176
+ // endcaps
177
+ if ( position.y < 0.0 ) {
178
+
179
+ offset += - dir;
180
+
181
+ } else if ( position.y > 1.0 ) {
182
+
183
+ offset += dir;
184
+
185
+ }
186
+
187
+ // adjust for linewidth
188
+ offset *= linewidth;
189
+
190
+ // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
191
+ offset /= resolution.y;
192
+
193
+ // select end
194
+ vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
195
+
196
+ // back to clip space
197
+ offset *= clip.w;
198
+
199
+ clip.xy += offset;
200
+
201
+ #endif
202
+
203
+ gl_Position = clip;
204
+
205
+ vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
206
+
207
+ #include <logdepthbuf_vertex>
208
+ #include <clipping_planes_vertex>
209
+ #include <fog_vertex>
210
+
211
+ }
212
+ `,fragmentShader:`
213
+ uniform vec3 diffuse;
214
+ uniform float opacity;
215
+ uniform float linewidth;
216
+
217
+ #ifdef USE_DASH
218
+
219
+ uniform float dashOffset;
220
+ uniform float dashSize;
221
+ uniform float gapSize;
222
+
223
+ #endif
224
+
225
+ varying float vLineDistance;
226
+
227
+ #ifdef WORLD_UNITS
228
+
229
+ varying vec4 worldPos;
230
+ varying vec3 worldStart;
231
+ varying vec3 worldEnd;
232
+
233
+ #ifdef USE_DASH
234
+
235
+ varying vec2 vUv;
236
+
237
+ #endif
238
+
239
+ #else
240
+
241
+ varying vec2 vUv;
242
+
243
+ #endif
244
+
245
+ #include <common>
246
+ #include <color_pars_fragment>
247
+ #include <fog_pars_fragment>
248
+ #include <logdepthbuf_pars_fragment>
249
+ #include <clipping_planes_pars_fragment>
250
+
251
+ vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
252
+
253
+ float mua;
254
+ float mub;
255
+
256
+ vec3 p13 = p1 - p3;
257
+ vec3 p43 = p4 - p3;
258
+
259
+ vec3 p21 = p2 - p1;
260
+
261
+ float d1343 = dot( p13, p43 );
262
+ float d4321 = dot( p43, p21 );
263
+ float d1321 = dot( p13, p21 );
264
+ float d4343 = dot( p43, p43 );
265
+ float d2121 = dot( p21, p21 );
266
+
267
+ float denom = d2121 * d4343 - d4321 * d4321;
268
+
269
+ float numer = d1343 * d4321 - d1321 * d4343;
270
+
271
+ mua = numer / denom;
272
+ mua = clamp( mua, 0.0, 1.0 );
273
+ mub = ( d1343 + d4321 * ( mua ) ) / d4343;
274
+ mub = clamp( mub, 0.0, 1.0 );
275
+
276
+ return vec2( mua, mub );
277
+
278
+ }
279
+
280
+ void main() {
281
+
282
+ float alpha = opacity;
283
+ vec4 diffuseColor = vec4( diffuse, alpha );
284
+
285
+ #include <clipping_planes_fragment>
286
+
287
+ #ifdef USE_DASH
288
+
289
+ if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
290
+
291
+ if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
292
+
293
+ #endif
294
+
295
+ #ifdef WORLD_UNITS
296
+
297
+ // Find the closest points on the view ray and the line segment
298
+ vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
299
+ vec3 lineDir = worldEnd - worldStart;
300
+ vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
301
+
302
+ vec3 p1 = worldStart + lineDir * params.x;
303
+ vec3 p2 = rayEnd * params.y;
304
+ vec3 delta = p1 - p2;
305
+ float len = length( delta );
306
+ float norm = len / linewidth;
307
+
308
+ #ifndef USE_DASH
309
+
310
+ #ifdef USE_ALPHA_TO_COVERAGE
311
+
312
+ float dnorm = fwidth( norm );
313
+ alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
314
+
315
+ #else
316
+
317
+ if ( norm > 0.5 ) {
318
+
319
+ discard;
320
+
321
+ }
322
+
323
+ #endif
324
+
325
+ #endif
326
+
327
+ #else
328
+
329
+ #ifdef USE_ALPHA_TO_COVERAGE
330
+
331
+ // artifacts appear on some hardware if a derivative is taken within a conditional
332
+ float a = vUv.x;
333
+ float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
334
+ float len2 = a * a + b * b;
335
+ float dlen = fwidth( len2 );
336
+
337
+ if ( abs( vUv.y ) > 1.0 ) {
338
+
339
+ alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
340
+
341
+ }
342
+
343
+ #else
344
+
345
+ if ( abs( vUv.y ) > 1.0 ) {
346
+
347
+ float a = vUv.x;
348
+ float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
349
+ float len2 = a * a + b * b;
350
+
351
+ if ( len2 > 1.0 ) discard;
352
+
353
+ }
354
+
355
+ #endif
356
+
357
+ #endif
358
+
359
+ #include <logdepthbuf_fragment>
360
+ #include <color_fragment>
361
+
362
+ gl_FragColor = vec4( diffuseColor.rgb, alpha );
363
+
364
+ #include <tonemapping_fragment>
365
+ #include <colorspace_fragment>
366
+ #include <fog_fragment>
367
+ #include <premultiplied_alpha_fragment>
368
+
369
+ }
370
+ `};class ie extends X{constructor(e){super({type:"LineMaterial",uniforms:G.clone(B.line.uniforms),vertexShader:B.line.vertexShader,fragmentShader:B.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const j=new C,z=new y;class ne extends K{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new I(e,3)),this.setAttribute("uv",new I(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new O(t,6,1);return this.setAttribute("instanceStart",new _(i,3,0)),this.setAttribute("instanceEnd",new _(i,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new O(t,6,1);return this.setAttribute("instanceColorStart",new _(i,3,0)),this.setAttribute("instanceColorEnd",new _(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Q(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new C);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),j.setFromBufferAttribute(t),this.boundingBox.union(j))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new V),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let s=0;for(let r=0,l=e.count;r<l;r++)z.fromBufferAttribute(e,r),s=Math.max(s,i.distanceToSquared(z)),z.fromBufferAttribute(t,r),s=Math.max(s,i.distanceToSquared(z));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}const L=new E,H=new y,R=new y,a=new E,o=new E,m=new E,D=new y,T=new ee,d=new Z,N=new y,U=new C,A=new V,v=new E;let g,x;function F(c,e,t){return v.set(0,0,-e,1).applyMatrix4(c.projectionMatrix),v.multiplyScalar(1/v.w),v.x=x/t.width,v.y=x/t.height,v.applyMatrix4(c.projectionMatrixInverse),v.multiplyScalar(1/v.w),Math.abs(Math.max(v.x,v.y))}function se(c,e){const t=c.matrixWorld,i=c.geometry,s=i.attributes.instanceStart,r=i.attributes.instanceEnd,l=Math.min(i.instanceCount,s.count);for(let n=0,f=l;n<f;n++){d.start.fromBufferAttribute(s,n),d.end.fromBufferAttribute(r,n),d.applyMatrix4(t);const p=new y,h=new y;g.distanceSqToSegment(d.start,d.end,h,p),h.distanceTo(p)<x*.5&&e.push({point:h,pointOnLine:p,distance:g.origin.distanceTo(h),object:c,face:null,faceIndex:n,uv:null,uv1:null})}}function re(c,e,t){const i=e.projectionMatrix,r=c.material.resolution,l=c.matrixWorld,n=c.geometry,f=n.attributes.instanceStart,p=n.attributes.instanceEnd,h=Math.min(n.instanceCount,f.count),u=-e.near;g.at(1,m),m.w=1,m.applyMatrix4(e.matrixWorldInverse),m.applyMatrix4(i),m.multiplyScalar(1/m.w),m.x*=r.x/2,m.y*=r.y/2,m.z=0,D.copy(m),T.multiplyMatrices(e.matrixWorldInverse,l);for(let S=0,q=h;S<q;S++){if(a.fromBufferAttribute(f,S),o.fromBufferAttribute(p,S),a.w=1,o.w=1,a.applyMatrix4(T),o.applyMatrix4(T),a.z>u&&o.z>u)continue;if(a.z>u){const b=a.z-o.z,w=(a.z-u)/b;a.lerp(o,w)}else if(o.z>u){const b=o.z-a.z,w=(o.z-u)/b;o.lerp(a,w)}a.applyMatrix4(i),o.applyMatrix4(i),a.multiplyScalar(1/a.w),o.multiplyScalar(1/o.w),a.x*=r.x/2,a.y*=r.y/2,o.x*=r.x/2,o.y*=r.y/2,d.start.copy(a),d.start.z=0,d.end.copy(o),d.end.z=0;const P=d.closestPointToPointParameter(D,!0);d.at(P,N);const W=te.lerp(a.z,o.z,P),k=W>=-1&&W<=1,J=D.distanceTo(N)<x*.5;if(k&&J){d.start.fromBufferAttribute(f,S),d.end.fromBufferAttribute(p,S),d.start.applyMatrix4(l),d.end.applyMatrix4(l);const b=new y,w=new y;g.distanceSqToSegment(d.start,d.end,w,b),t.push({point:w,pointOnLine:b,distance:g.origin.distanceTo(w),object:c,face:null,faceIndex:S,uv:null,uv1:null})}}}class de extends Y{constructor(e=new ne,t=new ie({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,s=new Float32Array(2*t.count);for(let l=0,n=0,f=t.count;l<f;l++,n+=2)H.fromBufferAttribute(t,l),R.fromBufferAttribute(i,l),s[n]=n===0?0:s[n-1],s[n+1]=s[n]+H.distanceTo(R);const r=new O(s,2,1);return e.setAttribute("instanceDistanceStart",new _(r,1,0)),e.setAttribute("instanceDistanceEnd",new _(r,1,1)),this}raycast(e,t){const i=this.material.worldUnits,s=e.camera;s===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const r=e.params.Line2!==void 0&&e.params.Line2.threshold||0;g=e.ray;const l=this.matrixWorld,n=this.geometry,f=this.material;x=f.linewidth+r,n.boundingSphere===null&&n.computeBoundingSphere(),A.copy(n.boundingSphere).applyMatrix4(l);let p;if(i)p=x*.5;else{const u=Math.max(s.near,A.distanceToPoint(g.origin));p=F(s,u,f.resolution)}if(A.radius+=p,g.intersectsSphere(A)===!1)return;n.boundingBox===null&&n.computeBoundingBox(),U.copy(n.boundingBox).applyMatrix4(l);let h;if(i)h=x*.5;else{const u=Math.max(s.near,U.distanceToPoint(g.origin));h=F(s,u,f.resolution)}U.expandByScalar(h),g.intersectsBox(U)!==!1&&(i?se(this,t):re(this,s,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(L),this.material.uniforms.resolution.value.set(L.z,L.w))}}export{ne as L,ie as a,de as b};
@@ -0,0 +1,2 @@
1
+ import{z as b,aI as w,I as M,_ as x,f as F,aJ as d,d as u,i as f,aF as L,a as g,aK as O,aL as y}from"./three.module-BynznMJN.js";class A extends b{constructor(s){super(s)}load(s,o,p,e){const a=this,n=this.path===""?w.extractUrlBase(s):this.path,r=new M(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(s,function(t){try{o(a.parse(t,n))}catch(i){e?e(i):console.error(i),a.manager.itemError(s)}},p,e)}setMaterialOptions(s){return this.materialOptions=s,this}parse(s,o){const p=s.split(`
2
+ `);let e={};const a=/\s+/,n={};for(let t=0;t<p.length;t++){let i=p[t];if(i=i.trim(),i.length===0||i.charAt(0)==="#")continue;const c=i.indexOf(" ");let l=c>=0?i.substring(0,c):i;l=l.toLowerCase();let h=c>=0?i.substring(c+1):"";if(h=h.trim(),l==="newmtl")e={name:h},n[h]=e;else if(l==="ka"||l==="kd"||l==="ks"||l==="ke"){const m=h.split(a,3);e[l]=[parseFloat(m[0]),parseFloat(m[1]),parseFloat(m[2])]}else e[l]=h}const r=new C(this.resourcePath||o,this.materialOptions);return r.setCrossOrigin(this.crossOrigin),r.setManager(this.manager),r.setMaterials(n),r}}class C{constructor(s="",o={}){this.baseUrl=s,this.options=o,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=this.options.side!==void 0?this.options.side:x,this.wrap=this.options.wrap!==void 0?this.options.wrap:F}setCrossOrigin(s){return this.crossOrigin=s,this}setManager(s){this.manager=s}setMaterials(s){this.materialsInfo=this.convert(s),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(s){if(!this.options)return s;const o={};for(const p in s){const e=s[p],a={};o[p]=a;for(const n in e){let r=!0,t=e[n];const i=n.toLowerCase();switch(i){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(t=[t[0]/255,t[1]/255,t[2]/255]),this.options&&this.options.ignoreZeroRGBs&&t[0]===0&&t[1]===0&&t[2]===0&&(r=!1);break}r&&(a[i]=t)}}return o}preload(){for(const s in this.materialsInfo)this.create(s)}getIndex(s){return this.nameLookup[s]}getAsArray(){let s=0;for(const o in this.materialsInfo)this.materialsArray[s]=this.create(o),this.nameLookup[o]=s,s++;return this.materialsArray}create(s){return this.materials[s]===void 0&&this.createMaterial_(s),this.materials[s]}createMaterial_(s){const o=this,p=this.materialsInfo[s],e={name:s,side:this.side};function a(r,t){return typeof t!="string"||t===""?"":/^https?:\/\//i.test(t)?t:r+t}function n(r,t){if(e[r])return;const i=o.getTextureParams(t,e),c=o.loadTexture(a(o.baseUrl,i.url));c.repeat.copy(i.scale),c.offset.copy(i.offset),c.wrapS=o.wrap,c.wrapT=o.wrap,(r==="map"||r==="emissiveMap")&&(c.colorSpace=f),e[r]=c}for(const r in p){const t=p[r];let i;if(t!=="")switch(r.toLowerCase()){case"kd":e.color=d.colorSpaceToWorking(new u().fromArray(t),f);break;case"ks":e.specular=d.colorSpaceToWorking(new u().fromArray(t),f);break;case"ke":e.emissive=d.colorSpaceToWorking(new u().fromArray(t),f);break;case"map_kd":n("map",t);break;case"map_ks":n("specularMap",t);break;case"map_ke":n("emissiveMap",t);break;case"norm":n("normalMap",t);break;case"map_bump":case"bump":n("bumpMap",t);break;case"disp":n("displacementMap",t);break;case"map_d":n("alphaMap",t),e.transparent=!0;break;case"ns":e.shininess=parseFloat(t);break;case"d":i=parseFloat(t),i<1&&(e.opacity=i,e.transparent=!0);break;case"tr":i=parseFloat(t),this.options&&this.options.invertTrProperty&&(i=1-i),i>0&&(e.opacity=1-i,e.transparent=!0);break}}return this.materials[s]=new L(e),this.materials[s]}getTextureParams(s,o){const p={scale:new g(1,1),offset:new g(0,0)},e=s.split(/\s+/);let a;return a=e.indexOf("-bm"),a>=0&&(o.bumpScale=parseFloat(e[a+1]),e.splice(a,2)),a=e.indexOf("-mm"),a>=0&&(o.displacementBias=parseFloat(e[a+1]),o.displacementScale=parseFloat(e[a+2]),e.splice(a,3)),a=e.indexOf("-s"),a>=0&&(p.scale.set(parseFloat(e[a+1]),parseFloat(e[a+2])),e.splice(a,4)),a=e.indexOf("-o"),a>=0&&(p.offset.set(parseFloat(e[a+1]),parseFloat(e[a+2])),e.splice(a,4)),p.url=e.join(" ").trim(),p}loadTexture(s,o,p,e,a){const n=this.manager!==void 0?this.manager:O;let r=n.getHandler(s);r===null&&(r=new y(n)),r.setCrossOrigin&&r.setCrossOrigin(this.crossOrigin);const t=r.load(s,p,e,a);return o!==void 0&&(t.mapping=o),t}}export{A as MTLLoader};
@@ -0,0 +1 @@
1
+ import{a as u}from"./jsx-runtime-DPjLkJKQ.js";import{r as l}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{x,y as w,z as E,A as S,D as a,t as f}from"./index-5av5LJja.js";import"./index-D2LwEE0L.js";import{O as M}from"./StageHost-B_YrFNiC.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";import"./clip-planes-CnAI6DZn.js";import"./OrbitControls-BHxt84w6.js";import"./LineSegments2-vfeDUBfs.js";import"./viewport-pick-context-DkawXbEi.js";import"./editor-presentation-activity-C7SNSmTd.js";function G({documentId:g,assetPath:o,displayName:d,active:i}){const[b,s]=l.useState(null),[c,p]=l.useState(null);l.useEffect(()=>{if(!i){s(null);return}const n=new AbortController;let m=null;s(null),p(null);const t=x(o);return(t==="glb"||t==="gltf"||t==="spz"?w(o,n.signal):t?E({url:o,format:t}).then(S).then(r=>({root:r,sourceBytes:null})):Promise.reject(new Error(`No native Three.js model loader supports ${o}.`))).then(r=>{if(n.signal.aborted){a(r.root);return}m=r.root,s(r)},r=>{n.signal.aborted||p(r instanceof Error?r.message:String(r))}),()=>{n.abort(),m&&a(m)}},[i,o]);const e=b?.root??null,j=l.useCallback(()=>{if(!e)throw new Error(`Model asset ${o} is not loaded.`);return{root:e,animations:e.animations,dispose(){}}},[o,e]);return c?u.jsx("div",{role:"alert",style:{padding:20,color:f.semantic.danger},children:c}):e?u.jsx(M,{documentId:g,sourcePath:o,displayName:d,build:j,active:i,assetType:"model",modelSource:{kind:"project-file",path:o}}):u.jsxs("div",{style:{padding:20,color:f.content.muted},children:["Loading ",d,"…"]})}export{G as ModelAssetDocument};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/world-documents-CGbrcsYk.js","assets/jsx-runtime-DPjLkJKQ.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-5av5LJja.js","assets/index-DaQZGF7d.js","assets/index-D_NuPfjr.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-D2LwEE0L.js","assets/client-DNXj_opT.js","assets/three.module-BynznMJN.js","assets/index-D2fNXpHa.css","assets/edit-mode-authoring-BX4IRQq9.js","assets/TransientHint-GNwuzA4c.js","assets/react-story-board-vrmj74Ng.js","assets/viewport-pick-context-DkawXbEi.js"])))=>i.map(i=>d[i]);
2
+ import{r as p}from"./index-DaQZGF7d.js";import{U as u,V as h,W as m,_ as l,X as f,Y as b,Z as g}from"./index-5av5LJja.js";import{b as v,e as r,i as D}from"./edit-mode-authoring-BX4IRQq9.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";class y{constructor(s){this.store=s,this.unbind=v(()=>this.rebuild()),this.ready=this.rebuild()}references=0;disposed=!1;composite;disposeDocuments;stages=new Set;tail=Promise.resolve();unbind;ready;retain(){return this.references++,()=>{--this.references>0||(this.disposed=!0,this.unbind(),this.disposeDocuments?.(),r(this.composite),n.delete(this.store))}}attach(s){const i=this.retain();return this.stages.add(s),{ready:this.composite?s(this.composite):this.tail,dispose:()=>{this.stages.delete(s),i()}}}rebuild(){const s=this.tail.then(async()=>{if(this.disposed)return;const i=b(),a=new Set(h().map(t=>t.descriptor.id)),c=this.composite?m().map(t=>t.descriptor.id).filter(t=>a.has(t)):[];this.disposeDocuments?.(),this.disposeDocuments=void 0,r(this.composite),this.composite=void 0;const o=await D(this.store);if(this.disposed){r(o);return}const{installRootDocuments:d}=await l(async()=>{const{installRootDocuments:t}=await import("./world-documents-CGbrcsYk.js");return{installRootDocuments:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]));if(this.disposed){r(o);return}this.composite=o,this.disposeDocuments=d(this.store,o);for(const t of c)f(t,t===i);await Promise.all([...this.stages].map(t=>t(o)))});return this.tail=s.catch(()=>{}),s}}const n=new Map;function w(e){let s=n.get(e);return s||(s=new y(e),n.set(e,s)),s}function P(e){const s=w(e);return{ready:s.ready.then(()=>u()),dispose:s.retain()}}function I({store:e}){return p.useEffect(()=>{const s=P(e);return s.ready.catch(i=>{g.error(`Authoring session failed: ${i instanceof Error?i.message:String(i)}`,"authoring")}),s.dispose},[e]),null}export{I as ProjectAuthoringBootstrap};
@@ -0,0 +1,5 @@
1
+ import{z as N,I as H,d as R,i as T,aB as k,aa as P,aC as w,aD as C,a9 as U,aE as L,aF as J,aG as D,aH as z,a0 as B,V}from"./three.module-BynznMJN.js";const q=/^[og]\s*(.+)?/,W=/^mtllib /,K=/^usemtl /,Q=/^usemap /,E=/\s+/,G=new V,F=new V,S=new V,O=new V,j=new V,_=new R;function X(){const I={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(s,e){if(this.object&&this.object.fromDeclaration===!1){this.object.name=s,this.object.fromDeclaration=e!==!1;return}const n=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:s||"",fromDeclaration:e!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(t,i){const a=this._finalize(!1);a&&(a.inherited||a.groupCount<=0)&&this.materials.splice(a.index,1);const d={index:this.materials.length,name:t||"",mtllib:Array.isArray(i)&&i.length>0?i[i.length-1]:"",smooth:a!==void 0?a.smooth:this.smooth,groupStart:a!==void 0?a.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(g){const r={index:typeof g=="number"?g:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return r.clone=this.clone.bind(r),r}};return this.materials.push(d),d},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(t){const i=this.currentMaterial();if(i&&i.groupEnd===-1&&(i.groupEnd=this.geometry.vertices.length/3,i.groupCount=i.groupEnd-i.groupStart,i.inherited=!1),t&&this.materials.length>1)for(let a=this.materials.length-1;a>=0;a--)this.materials[a].groupCount<=0&&this.materials.splice(a,1);return t&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),i}},n&&n.name&&typeof n.clone=="function"){const t=n.clone(0);t.inherited=!0,this.object.materials.push(t)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(s,e){const n=parseInt(s,10);return(n>=0?n-1:n+e/3)*3},parseNormalIndex:function(s,e){const n=parseInt(s,10);return(n>=0?n-1:n+e/3)*3},parseUVIndex:function(s,e){const n=parseInt(s,10);return(n>=0?n-1:n+e/2)*2},addVertex:function(s,e,n){const t=this.vertices,i=this.object.geometry.vertices;i.push(t[s+0],t[s+1],t[s+2]),i.push(t[e+0],t[e+1],t[e+2]),i.push(t[n+0],t[n+1],t[n+2])},addVertexPoint:function(s){const e=this.vertices;this.object.geometry.vertices.push(e[s+0],e[s+1],e[s+2])},addVertexLine:function(s){const e=this.vertices;this.object.geometry.vertices.push(e[s+0],e[s+1],e[s+2])},addNormal:function(s,e,n){const t=this.normals,i=this.object.geometry.normals;i.push(t[s+0],t[s+1],t[s+2]),i.push(t[e+0],t[e+1],t[e+2]),i.push(t[n+0],t[n+1],t[n+2])},addFaceNormal:function(s,e,n){const t=this.vertices,i=this.object.geometry.normals;G.fromArray(t,s),F.fromArray(t,e),S.fromArray(t,n),j.subVectors(S,F),O.subVectors(G,F),j.cross(O),j.normalize(),i.push(j.x,j.y,j.z),i.push(j.x,j.y,j.z),i.push(j.x,j.y,j.z)},addColor:function(s,e,n){const t=this.colors,i=this.object.geometry.colors;t[s]!==void 0&&i.push(t[s+0],t[s+1],t[s+2]),t[e]!==void 0&&i.push(t[e+0],t[e+1],t[e+2]),t[n]!==void 0&&i.push(t[n+0],t[n+1],t[n+2])},addUV:function(s,e,n){const t=this.uvs,i=this.object.geometry.uvs;i.push(t[s+0],t[s+1]),i.push(t[e+0],t[e+1]),i.push(t[n+0],t[n+1])},addDefaultUV:function(){const s=this.object.geometry.uvs;s.push(0,0),s.push(0,0),s.push(0,0)},addUVLine:function(s){const e=this.uvs;this.object.geometry.uvs.push(e[s+0],e[s+1])},addFace:function(s,e,n,t,i,a,d,g,r){const h=this.vertices.length;let o=this.parseVertexIndex(s,h),l=this.parseVertexIndex(e,h),u=this.parseVertexIndex(n,h);if(this.addVertex(o,l,u),this.addColor(o,l,u),d!==void 0&&d!==""){const m=this.normals.length;o=this.parseNormalIndex(d,m),l=this.parseNormalIndex(g,m),u=this.parseNormalIndex(r,m),this.addNormal(o,l,u)}else this.addFaceNormal(o,l,u);if(t!==void 0&&t!==""){const m=this.uvs.length;o=this.parseUVIndex(t,m),l=this.parseUVIndex(i,m),u=this.parseUVIndex(a,m),this.addUV(o,l,u),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(s){this.object.geometry.type="Points";const e=this.vertices.length;for(let n=0,t=s.length;n<t;n++){const i=this.parseVertexIndex(s[n],e);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(s,e){this.object.geometry.type="Line";const n=this.vertices.length,t=this.uvs.length;for(let i=0,a=s.length;i<a;i++)this.addVertexLine(this.parseVertexIndex(s[i],n));for(let i=0,a=e.length;i<a;i++)this.addUVLine(this.parseUVIndex(e[i],t))}};return I.startObject("",!1),I}class Z extends N{constructor(s){super(s),this.materials=null}load(s,e,n,t){const i=this,a=new H(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(s,function(d){try{e(i.parse(d))}catch(g){t?t(g):console.error(g),i.manager.itemError(s)}},n,t)}setMaterials(s){return this.materials=s,this}parse(s){const e=new X;s.indexOf(`\r
2
+ `)!==-1&&(s=s.replace(/\r\n/g,`
3
+ `)),s.indexOf(`\\
4
+ `)!==-1&&(s=s.replace(/\\\n/g,""));const n=s.split(`
5
+ `);let t=[];for(let d=0,g=n.length;d<g;d++){const r=n[d].trimStart();if(r.length===0)continue;const h=r.charAt(0);if(h!=="#")if(h==="v"){const o=r.split(E);switch(o[0]){case"v":e.vertices.push(parseFloat(o[1]),parseFloat(o[2]),parseFloat(o[3])),o.length>=7?(_.setRGB(parseFloat(o[4]),parseFloat(o[5]),parseFloat(o[6]),T),e.colors.push(_.r,_.g,_.b)):e.colors.push(void 0,void 0,void 0);break;case"vn":e.normals.push(parseFloat(o[1]),parseFloat(o[2]),parseFloat(o[3]));break;case"vt":e.uvs.push(parseFloat(o[1]),parseFloat(o[2]));break}}else if(h==="f"){const l=r.slice(1).trim().split(E),u=[];for(let c=0,p=l.length;c<p;c++){const b=l[c];if(b.length>0){const v=b.split("/");u.push(v)}}const m=u[0];for(let c=1,p=u.length-1;c<p;c++){const b=u[c],v=u[c+1];e.addFace(m[0],b[0],v[0],m[1],b[1],v[1],m[2],b[2],v[2])}}else if(h==="l"){const o=r.substring(1).trim().split(" ");let l=[];const u=[];if(r.indexOf("/")===-1)l=o;else for(let m=0,c=o.length;m<c;m++){const p=o[m].split("/");p[0]!==""&&l.push(p[0]),p[1]!==""&&u.push(p[1])}e.addLineGeometry(l,u)}else if(h==="p"){const l=r.slice(1).trim().split(" ");e.addPointGeometry(l)}else if((t=q.exec(r))!==null){const o=(" "+t[0].slice(1).trim()).slice(1);e.startObject(o)}else if(K.test(r))e.object.startMaterial(r.substring(7).trim(),e.materialLibraries);else if(W.test(r))e.materialLibraries.push(r.substring(7).trim());else if(Q.test(r))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(h==="s"){if(t=r.split(" "),t.length>1){const l=t[1].trim().toLowerCase();e.object.smooth=l!=="0"&&l!=="off"}else e.object.smooth=!0;const o=e.object.currentMaterial();o&&(o.smooth=e.object.smooth)}else{if(r==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+r+'"')}}e.finalize();const i=new k;if(i.materialLibraries=[].concat(e.materialLibraries),!(e.objects.length===1&&e.objects[0].geometry.vertices.length===0)===!0)for(let d=0,g=e.objects.length;d<g;d++){const r=e.objects[d],h=r.geometry,o=r.materials,l=h.type==="Line",u=h.type==="Points";let m=!1;if(h.vertices.length===0)continue;const c=new P;c.setAttribute("position",new w(h.vertices,3)),h.normals.length>0&&c.setAttribute("normal",new w(h.normals,3)),h.colors.length>0&&(m=!0,c.setAttribute("color",new w(h.colors,3))),h.hasUVIndices===!0&&c.setAttribute("uv",new w(h.uvs,2));const p=[];for(let v=0,M=o.length;v<M;v++){const y=o[v],A=y.name+"_"+y.smooth+"_"+m;let f=e.materials[A];if(this.materials!==null){if(f=this.materials.create(y.name),l&&f&&!(f instanceof C)){const x=new C;U.prototype.copy.call(x,f),x.color.copy(f.color),f=x}else if(u&&f&&!(f instanceof L)){const x=new L({size:10,sizeAttenuation:!1});U.prototype.copy.call(x,f),x.color.copy(f.color),x.map=f.map,f=x}}f===void 0&&(l?f=new C:u?f=new L({size:1,sizeAttenuation:!1}):f=new J,f.name=y.name,f.flatShading=!y.smooth,f.vertexColors=m,e.materials[A]=f),p.push(f)}let b;if(p.length>1){for(let v=0,M=o.length;v<M;v++){const y=o[v];c.addGroup(y.groupStart,y.groupCount,v)}l?b=new D(c,p):u?b=new z(c,p):b=new B(c,p)}else l?b=new D(c,p[0]):u?b=new z(c,p[0]):b=new B(c,p[0]);b.name=r.name,i.add(b)}else if(e.vertices.length>0){const d=new L({size:1,sizeAttenuation:!1}),g=new P;g.setAttribute("position",new w(e.vertices,3)),e.colors.length>0&&e.colors[0]!==void 0&&(g.setAttribute("color",new w(e.colors,3)),d.vertexColors=!0);const r=new z(g,d);i.add(r)}return i}}export{Z as OBJLoader};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/spark.module-D1CUMLYS.js","assets/three.module-BynznMJN.js","assets/index-5av5LJja.js","assets/index-DaQZGF7d.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-D2LwEE0L.js","assets/client-DNXj_opT.js","assets/index-D2fNXpHa.css"])))=>i.map(i=>d[i]);
2
+ import{K as te,t as A,L as re,x as ne,M as ie,z as oe,A as ae,D as N,N as se,_ as le,O as ce,P as de,Q as pe}from"./index-5av5LJja.js";import{a as M}from"./jsx-runtime-DPjLkJKQ.js";import{r as C}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import"./index-D2LwEE0L.js";import{aV as me,w as ue,k as fe,i as we,aW as he,aX as ge,aY as ve,aZ as be,ae as xe,a_ as ye,V as Ae,a$ as Me}from"./three.module-BynznMJN.js";import{O as Ce}from"./OrbitControls-BHxt84w6.js";import{s as Ee,i as F}from"./editor-presentation-activity-C7SNSmTd.js";import"./client-DNXj_opT.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";const b={webglContext:0,animationFrame:0,resizeObserver:0,objectUrl:0},Q={...b};function _(r){b[r]++,Q[r]=Math.max(Q[r],b[r]);let a=!1;return()=>{a||(a=!0,b[r]=Math.max(0,b[r]-1))}}function Se(r){const a=r.animations[0];if(!a)return null;const m=new Me(r),h=m.clipAction(a).play();return h.paused=!0,m.update(0),m}let je=0;function $e({assetPath:r,materialPath:a,displayName:m="Object3D preview",active:h=!0,sourceFactory:E,showSkeleton:D=!1,background:z,cameraDirection:S,showGrid:H=!0,useDefaultLighting:L=!0,exposure:k=1,setupPreview:T}){const W=C.useRef(null),[j,V]=C.useState(null),[$,R]=C.useState(!0);return C.useEffect(()=>{if(!h)return;const o=W.current;if(!o)return;const x=new AbortController,X=te({id:`preview-card:${++je}`,label:`${m} (preview card)`,contentClock:()=>0}),t=new me({antialias:!0,alpha:!0}),Y=_("webglContext"),Z=_("animationFrame"),J=_("resizeObserver"),s=new ue,u=new fe(35,1,.01,1e3),f=new Ce(u,t.domElement),q=new xe;let I=null,w=null,y=null,c,l=null,g=null;const O=[];let d=0,p=!1;if(V(null),R(!0),t.outputColorSpace=we,t.toneMapping=he,t.toneMappingExposure=k,t.shadowMap.enabled=!0,t.setClearColor(z??2106410,1),t.setPixelRatio(Math.min(window.devicePixelRatio,2)),t.domElement.style.width="100%",t.domElement.style.height="100%",t.domElement.style.display="block",o.appendChild(t.domElement),f.enableDamping=!0,f.dampingFactor=.1,L){s.add(new ge(16777215,3489874,1.8));const e=new ve(16777215,2.2);e.position.set(3,5,4),s.add(e)}if(H){const e=new be(10,20,5333103,3423044);s.add(e),O.push(e)}const U=(e,n)=>{if(!g)return;const i=S?new Ae(...S):void 0,v=de(g,Math.max(e,1)/Math.max(n,1),i);u.copy(v,!1),f.target.copy(g.center),f.update()},G=async e=>{if(p)return;s.add(e);let n=!1;if(e.traverse(i=>{se(i,"gaussianSplat")&&(n=!0)}),n){const{SparkRenderer:i}=await le(async()=>{const{SparkRenderer:v}=await import("./spark.module-D1CUMLYS.js");return{SparkRenderer:v}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]));if(p)return;l=new i({renderer:t,enableLod:!1})}if(g=ce(e,"perspective"),U(o.clientWidth,o.clientHeight),I=Se(e),D){const i=new ye(e);i.name="__compact_preview_skeleton",s.add(i),O.push(i)}c=T?.({scene:s,camera:u,renderer:t,model:e}),c?.resize?.(Math.max(o.clientWidth,1),Math.max(o.clientHeight,1),t.getPixelRatio()),R(!1)};(async()=>{try{if(E){y=re(E),await G(y.root);return}if(!r)throw new Error("Compact Object3D preview has no source.");const e=ne(r);if(!e)throw new Error(`No native Three.js loader supports ${r}.`);const n=e==="glb"||e==="gltf"||e==="spz"?await ie(r,x.signal):await oe({url:r,format:e,...a?{materialUrl:a}:{}});if(w=ae(n),x.signal.aborted||p){N(w),w=null;return}await G(w)}catch(e){!x.signal.aborted&&!p&&(V(e instanceof Error?e.message:String(e)),R(!1))}})();const B=()=>{const e=Math.max(o.clientWidth,1),n=Math.max(o.clientHeight,1);t.setSize(e,n,!1),g&&!c?U(e,n):(u.aspect=e/n,u.updateProjectionMatrix()),c?.resize?.(e,n,t.getPixelRatio())},K=new ResizeObserver(B);K.observe(o),B();const P=()=>{if(d=0,p||!F())return;const e=Math.min(q.getDelta(),.1);f.update(),l&&s.add(l);try{c?.render?c.render(e):t.render(s,u)}finally{l?.removeFromParent()}d=requestAnimationFrame(P)},ee=Ee(()=>{F()?!p&&d===0&&(q.getDelta(),P()):(cancelAnimationFrame(d),d=0)});return F()&&(d=requestAnimationFrame(P)),()=>{p=!0,ee(),X(),x.abort(new Error("Compact Object3D preview closed.")),cancelAnimationFrame(d),K.disconnect(),I?.stopAllAction(),c?.dispose(),f.dispose(),l&&(l.removeFromParent(),pe(l),l=null),t.dispose(),t.forceContextLoss();for(const e of O){const n=e;n.geometry?.dispose();const i=n.material;if(Array.isArray(i))for(const v of i)v.dispose();else i?.dispose()}y&&y.dispose(),w&&N(w),o.contains(t.domElement)&&o.removeChild(t.domElement),J(),Z(),Y()}},[h,r,z,S,k,a,T,H,D,E,L]),M.jsxs("div",{ref:W,"data-testid":"object3d-compact-preview",role:"region","aria-label":`Interactive 3D preview: ${m}`,"aria-busy":$,style:{width:"100%",height:"100%",minHeight:220,overflow:"hidden",position:"relative",background:A.surface.inset},children:[$&&!j?M.jsx("span",{style:{position:"absolute",padding:10,color:A.content.muted},children:"Loading…"}):null,h?null:M.jsx("span",{style:{position:"absolute",padding:10,color:A.content.muted},children:"Preview suspended while inactive."}),j?M.jsx("div",{role:"alert",style:{position:"absolute",padding:10,color:A.semantic.danger},children:j}):null]})}export{$e as Object3DPreview};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Object3DPreview-CSmLPKkk.js","assets/index-5av5LJja.js","assets/index-DaQZGF7d.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-D2LwEE0L.js","assets/client-DNXj_opT.js","assets/three.module-BynznMJN.js","assets/index-D2fNXpHa.css","assets/OrbitControls-BHxt84w6.js","assets/editor-presentation-activity-C7SNSmTd.js"])))=>i.map(i=>d[i]);
2
+ import{$ as T,a0 as L,a1 as H,a2 as R,a3 as U,t as a,a4 as b,a5 as w,S as k,a6 as W,B as M,a7 as N,a8 as J,_ as V}from"./index-5av5LJja.js";import{a as t}from"./jsx-runtime-DPjLkJKQ.js";import{r}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{d as G}from"./asset-editor-persistence-D3Yy77wZ.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./three.module-BynznMJN.js";const S=new Map,K=new Set;function C(){for(const e of K)e()}function q(e,o){const n=S.get(e);if(n?.status==="running")return n;const f={id:e,label:o,stage:"fetch",loaded:0,total:0,status:"running",controller:new AbortController};return S.set(e,f),C(),f}function g(e,o){const n=S.get(e);n&&(Object.assign(n,o),C())}const Q=r.lazy(()=>V(()=>import("./Object3DPreview-CSmLPKkk.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(e=>({default:e.Object3DPreview}))),X={width:"100%"};function Y(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function de({online:e,mode:o="full",showPreview:n=!1,onResolved:f}){const[h,z]=r.useState([]),[l,D]=r.useState(null),[O,y]=r.useState(!0),[B,A]=r.useState(null),[v,E]=r.useState(null),[I,m]=r.useState(!1),[_,x]=r.useState(!1),[j,P]=r.useState(!1),[c,p]=r.useState("idle");r.useEffect(()=>{if(o==="preview"){y(!1);return}let s=!1;return y(!0),A(null),T(e.source,e.id).then(i=>{s||(z(i),i.length>0&&D(i[0]))}).catch(i=>{s||(z([]),A(i instanceof L?H(i.code):i instanceof Error?i.message:"Asset delivery metadata is unavailable while offline."))}).finally(()=>{s||y(!1)}),()=>{s=!0}},[o,e.source,e.id]);const F=e.source==="local"&&(e.type==="model"||e.type==="animation"||e.type==="source");r.useEffect(()=>{if(o==="inspector"&&!n){m(!1);return}let s=!1;if(E(null),x(!1),P(!1),!F){m(!1);return}return m(!0),R(e.source,e.id).then(i=>{s||(E(i),x(!i))}).catch(()=>{s||x(!0)}).finally(()=>{s||m(!1)}),()=>{s=!0}},[o,e.id,e.source,n,F]);const $=r.useCallback(async()=>{if(!l)return;const s=`single:${e.source}:${e.id}`,i=q(s,e.name);g(s,{stage:"fetch",loaded:0,total:l.sizeBytes??0,status:"running"}),p("downloading");try{const d={source:e.source,id:e.id,name:e.name,url:l.url,format:l.format,jobId:s,signal:i.controller.signal};l.includes&&(d.includes=l.includes);const u=await G(d);u.ok&&u.path?(g(s,{stage:"commit",loaded:l.sizeBytes??1,total:l.sizeBytes??1,status:u.alreadyExists?"skipped":"imported",message:u.path}),p("done"),U(`${e.name} added to Content — drag it from there into the viewport to place it.`),f?.(`/${u.path}`)):(g(s,{status:"failed",message:u.error??"The import was rejected."}),p("error"))}catch(d){g(s,{status:i.controller.signal.aborted?"cancelled":"failed",message:d instanceof Error?d.message:String(d)}),p("error")}},[e,l,f]);return t.jsxs("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:8},children:[o!=="preview"&&t.jsx("div",{style:{fontWeight:600,fontSize:12,color:a.content.primary,wordBreak:"break-all"},children:e.name}),(o!=="inspector"||n)&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{width:"100%",height:"100%",minHeight:o==="inspector"?160:240,background:a.surface.shell,borderRadius:a.shape.small,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},children:I?t.jsxs("div",{style:{color:a.content.muted,fontSize:11},children:[t.jsx(b,{icon:w,spin:!0,style:{marginRight:5}}),"Loading Asset Editor preview…"]}):v?t.jsx(r.Suspense,{fallback:t.jsx("span",{style:{color:a.content.muted},children:"Loading preview…"}),children:t.jsx(Q,{assetPath:v.path,materialPath:v.materialPath,displayName:e.name})}):t.jsx("img",{src:j?"/__editor/asset-library/local-placeholder.svg":e.thumbnailUrl,alt:j?`${e.name} preview unavailable`:e.name,onError:()=>P(!0),style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}})}),j&&t.jsx("div",{role:"status",style:{color:a.content.dim,fontSize:10},children:"The catalog preview could not be loaded; showing the typed fallback."}),_&&t.jsx("div",{style:{color:a.content.dim,fontSize:10},children:"Interactive preview is unavailable for this variant; showing its catalog thumbnail."})]}),o!=="preview"&&t.jsxs(t.Fragment,{children:[t.jsx(k,{label:"Info",children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,color:a.content.dim,marginBottom:2},children:"Source"}),t.jsx("div",{style:{fontSize:11,color:a.content.primary},children:e.source==="polyhaven"?"Poly Haven":e.source==="ambientcg"?"ambientCG":"Full Catalog"})]}),t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,color:a.content.dim,marginBottom:2},children:"Type"}),t.jsx("div",{style:{fontSize:11,color:a.content.primary},children:e.type})]}),e.tags.length>0&&t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,color:a.content.dim,marginBottom:2},children:"Tags"}),t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:3},children:e.tags.slice(0,12).map(s=>t.jsx("span",{style:{fontSize:10,padding:"1px 5px",background:a.surface.raised,borderRadius:a.shape.small,color:a.content.muted},children:s},s))})]}),e.author&&t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,color:a.content.dim,marginBottom:2},children:"Author"}),t.jsx("div",{style:{fontSize:11,color:a.content.primary},children:e.author})]})]})}),t.jsx(k,{label:"Add to Project",children:t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:O?t.jsxs("div",{style:{fontSize:11,color:a.content.dim},children:[t.jsx(b,{icon:w,spin:!0,style:{marginRight:4}}),"Loading options..."]}):B?t.jsxs("div",{role:"alert",style:{fontSize:11,color:a.content.muted},children:["Delivery unavailable: ",B]}):h.length>0?t.jsxs(t.Fragment,{children:[t.jsx(W,{"aria-label":"Asset delivery",value:l?h.indexOf(l):0,onChange:s=>D(h[Number(s.target.value)]??null),style:X,children:h.map((s,i)=>t.jsxs("option",{value:i,children:[s.label,s.sizeBytes?` (${Y(s.sizeBytes)})`:""]},i))}),t.jsxs(M,{type:"button",variant:c==="done"?"success":"primary",size:"comfortable",onClick:$,disabled:c==="downloading",style:{width:"100%"},children:[t.jsx(b,{icon:c==="done"?N:c==="downloading"?w:J,spin:c==="downloading",style:{fontSize:10}}),c==="done"?"Downloaded":c==="downloading"?"Downloading...":c==="error"?"Retry":"Add to Project"]})]}):t.jsx("div",{role:"status",style:{fontSize:11,color:a.content.dim},children:e.source==="local"?"No healthy SSD or cloud delivery is available for this asset.":"This provider has no compatible remote delivery for the selected asset."})})}),t.jsxs("div",{style:{fontSize:10,color:a.content.dim,padding:"4px 0"},children:["License: ",e.license??"CC0 (Public Domain)"]})]})]})}export{de as OnlineAssetDetail};
@@ -0,0 +1 @@
1
+ import{C as S,V as p,M as u,T as _,Q as E,S as P,a as c,R as w,P as O,b as R}from"./three.module-BynznMJN.js";const D={type:"change"},b={type:"start"},M={type:"end"},f=new w,T=new O,j=Math.cos(70*R.DEG2RAD),n=new p,r=2*Math.PI,o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},y=1e-6;class X extends S{constructor(t,e=null){super(t,e),this.state=o.NONE,this.target=new p,this.cursor=new p,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:u.ROTATE,MIDDLE:u.DOLLY,RIGHT:u.PAN},this.touches={ONE:_.ROTATE,TWO:_.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new p,this._lastQuaternion=new E,this._lastTargetPosition=new p,this._quat=new E().setFromUnitVectors(t.up,new p(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new P,this._sphericalDelta=new P,this._scale=1,this._panOffset=new p,this._rotateStart=new c,this._rotateEnd=new c,this._rotateDelta=new c,this._panStart=new c,this._panEnd=new c,this._panDelta=new c,this._dollyStart=new c,this._dollyEnd=new c,this._dollyDelta=new c,this._dollyDirection=new p,this._mouse=new c,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=L.bind(this),this._onPointerDown=A.bind(this),this._onPointerUp=k.bind(this),this._onContextMenu=Z.bind(this),this._onMouseWheel=N.bind(this),this._onKeyDown=Y.bind(this),this._onTouchStart=I.bind(this),this._onTouchMove=U.bind(this),this._onMouseDown=x.bind(this),this._onMouseMove=C.bind(this),this._interceptControlDown=z.bind(this),this._interceptControlUp=K.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(t){super.connect(t),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(t){t.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=t}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(D),this.update(),this.state=o.NONE}update(t=null){const e=this.object.position;n.copy(e).sub(this.target),n.applyQuaternion(this._quat),this._spherical.setFromVector3(n),this.autoRotate&&this.state===o.NONE&&this._rotateLeft(this._getAutoRotationAngle(t)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let s=this.minAzimuthAngle,a=this.maxAzimuthAngle;isFinite(s)&&isFinite(a)&&(s<-Math.PI?s+=r:s>Math.PI&&(s-=r),a<-Math.PI?a+=r:a>Math.PI&&(a-=r),s<=a?this._spherical.theta=Math.max(s,Math.min(a,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(s+a)/2?Math.max(s,this._spherical.theta):Math.min(a,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let h=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const l=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),h=l!=this._spherical.radius}if(n.setFromSpherical(this._spherical),n.applyQuaternion(this._quatInverse),e.copy(this.target).add(n),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let l=null;if(this.object.isPerspectiveCamera){const d=n.length();l=this._clampDistance(d*this._scale);const m=d-l;this.object.position.addScaledVector(this._dollyDirection,m),this.object.updateMatrixWorld(),h=!!m}else if(this.object.isOrthographicCamera){const d=new p(this._mouse.x,this._mouse.y,0);d.unproject(this.object);const m=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),h=m!==this.object.zoom;const g=new p(this._mouse.x,this._mouse.y,0);g.unproject(this.object),this.object.position.sub(g).add(d),this.object.updateMatrixWorld(),l=n.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;l!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(l).add(this.object.position):(f.origin.copy(this.object.position),f.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(f.direction))<j?this.object.lookAt(this.target):(T.setFromNormalAndCoplanarPoint(this.object.up,this.target),f.intersectPlane(T,this.target))))}else if(this.object.isOrthographicCamera){const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),l!==this.object.zoom&&(this.object.updateProjectionMatrix(),h=!0)}return this._scale=1,this._performCursorZoom=!1,h||this._lastPosition.distanceToSquared(this.object.position)>y||8*(1-this._lastQuaternion.dot(this.object.quaternion))>y||this._lastTargetPosition.distanceToSquared(this.target)>y?(this.dispatchEvent(D),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(t){return t!==null?r/60*this.autoRotateSpeed*t:r/60/60*this.autoRotateSpeed}_getZoomScale(t){const e=Math.abs(t*.01);return Math.pow(.95,this.zoomSpeed*e)}_rotateLeft(t){this._sphericalDelta.theta-=t}_rotateUp(t){this._sphericalDelta.phi-=t}_panLeft(t,e){n.setFromMatrixColumn(e,0),n.multiplyScalar(-t),this._panOffset.add(n)}_panUp(t,e){this.screenSpacePanning===!0?n.setFromMatrixColumn(e,1):(n.setFromMatrixColumn(e,0),n.crossVectors(this.object.up,n)),n.multiplyScalar(t),this._panOffset.add(n)}_pan(t,e){const s=this.domElement;if(this.object.isPerspectiveCamera){const a=this.object.position;n.copy(a).sub(this.target);let h=n.length();h*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*h/s.clientHeight,this.object.matrix),this._panUp(2*e*h/s.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(t*(this.object.right-this.object.left)/this.object.zoom/s.clientWidth,this.object.matrix),this._panUp(e*(this.object.top-this.object.bottom)/this.object.zoom/s.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(t,e){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const s=this.domElement.getBoundingClientRect(),a=t-s.left,h=e-s.top,l=s.width,d=s.height;this._mouse.x=a/l*2-1,this._mouse.y=-(h/d)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(t){return Math.max(this.minDistance,Math.min(this.maxDistance,t))}_handleMouseDownRotate(t){this._rotateStart.set(t.clientX,t.clientY)}_handleMouseDownDolly(t){this._updateZoomParameters(t.clientX,t.clientX),this._dollyStart.set(t.clientX,t.clientY)}_handleMouseDownPan(t){this._panStart.set(t.clientX,t.clientY)}_handleMouseMoveRotate(t){this._rotateEnd.set(t.clientX,t.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(r*this._rotateDelta.x/e.clientHeight),this._rotateUp(r*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(t){this._dollyEnd.set(t.clientX,t.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(t){this._panEnd.set(t.clientX,t.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(t){this._updateZoomParameters(t.clientX,t.clientY),t.deltaY<0?this._dollyIn(this._getZoomScale(t.deltaY)):t.deltaY>0&&this._dollyOut(this._getZoomScale(t.deltaY)),this.update()}_handleKeyDown(t){let e=!1;switch(t.code){case this.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(r*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),e=!0;break;case this.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(-r*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),e=!0;break;case this.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(r*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),e=!0;break;case this.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(-r*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),e=!0;break}e&&(t.preventDefault(),this.update())}_handleTouchStartRotate(t){if(this._pointers.length===1)this._rotateStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),s=.5*(t.pageX+e.x),a=.5*(t.pageY+e.y);this._rotateStart.set(s,a)}}_handleTouchStartPan(t){if(this._pointers.length===1)this._panStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),s=.5*(t.pageX+e.x),a=.5*(t.pageY+e.y);this._panStart.set(s,a)}}_handleTouchStartDolly(t){const e=this._getSecondPointerPosition(t),s=t.pageX-e.x,a=t.pageY-e.y,h=Math.sqrt(s*s+a*a);this._dollyStart.set(0,h)}_handleTouchStartDollyPan(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enablePan&&this._handleTouchStartPan(t)}_handleTouchStartDollyRotate(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enableRotate&&this._handleTouchStartRotate(t)}_handleTouchMoveRotate(t){if(this._pointers.length==1)this._rotateEnd.set(t.pageX,t.pageY);else{const s=this._getSecondPointerPosition(t),a=.5*(t.pageX+s.x),h=.5*(t.pageY+s.y);this._rotateEnd.set(a,h)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(r*this._rotateDelta.x/e.clientHeight),this._rotateUp(r*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(t){if(this._pointers.length===1)this._panEnd.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),s=.5*(t.pageX+e.x),a=.5*(t.pageY+e.y);this._panEnd.set(s,a)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(t){const e=this._getSecondPointerPosition(t),s=t.pageX-e.x,a=t.pageY-e.y,h=Math.sqrt(s*s+a*a);this._dollyEnd.set(0,h),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const l=(t.pageX+e.x)*.5,d=(t.pageY+e.y)*.5;this._updateZoomParameters(l,d)}_handleTouchMoveDollyPan(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enablePan&&this._handleTouchMovePan(t)}_handleTouchMoveDollyRotate(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enableRotate&&this._handleTouchMoveRotate(t)}_addPointer(t){this._pointers.push(t.pointerId)}_removePointer(t){delete this._pointerPositions[t.pointerId];for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId){this._pointers.splice(e,1);return}}_isTrackingPointer(t){for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId)return!0;return!1}_trackPointer(t){let e=this._pointerPositions[t.pointerId];e===void 0&&(e=new c,this._pointerPositions[t.pointerId]=e),e.set(t.pageX,t.pageY)}_getSecondPointerPosition(t){const e=t.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[e]}_customWheelEvent(t){const e=t.deltaMode,s={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(e){case 1:s.deltaY*=16;break;case 2:s.deltaY*=100;break}return t.ctrlKey&&!this._controlActive&&(s.deltaY*=10),s}}function A(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i)))}function L(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function k(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(M),this.state=o.NONE;break;case 1:const t=this._pointers[0],e=this._pointerPositions[t];this._onTouchStart({pointerId:t,pageX:e.x,pageY:e.y});break}}function x(i){let t;switch(i.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case u.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=o.DOLLY;break;case u.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=o.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=o.ROTATE}break;case u.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=o.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=o.PAN}break;default:this.state=o.NONE}this.state!==o.NONE&&this.dispatchEvent(b)}function C(i){switch(this.state){case o.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case o.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case o.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function N(i){this.enabled===!1||this.enableZoom===!1||this.state!==o.NONE||(i.preventDefault(),this.dispatchEvent(b),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(M))}function Y(i){this.enabled!==!1&&this._handleKeyDown(i)}function I(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case _.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=o.TOUCH_ROTATE;break;case _.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=o.TOUCH_PAN;break;default:this.state=o.NONE}break;case 2:switch(this.touches.TWO){case _.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=o.TOUCH_DOLLY_PAN;break;case _.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=o.TOUCH_DOLLY_ROTATE;break;default:this.state=o.NONE}break;default:this.state=o.NONE}this.state!==o.NONE&&this.dispatchEvent(b)}function U(i){switch(this._trackPointer(i),this.state){case o.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case o.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case o.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case o.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=o.NONE}}function Z(i){this.enabled!==!1&&i.preventDefault()}function z(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function K(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}export{X as O};
@@ -0,0 +1,2 @@
1
+ import{z as M,I as V,aa as b,aC as h,d as j,i as T}from"./three.module-BynznMJN.js";const f=new j;class G extends M{constructor(u){super(u),this.propertyNameMapping={},this.customPropertyMapping={}}load(u,C,x,y){const R=this,m=new V(this.manager);m.setPath(this.path),m.setResponseType("arraybuffer"),m.setRequestHeader(this.requestHeader),m.setWithCredentials(this.withCredentials),m.load(u,function(z){try{C(R.parse(z))}catch(v){y?y(v):console.error(v),R.manager.itemError(u)}},x,y)}setPropertyNameMapping(u){this.propertyNameMapping=u}setCustomPropertyNameMapping(u){this.customPropertyMapping=u}parse(u){function C(e,n=0){const r=/^ply([\s\S]*)end_header(\r\n|\r|\n)/;let t="";const s=r.exec(e);s!==null&&(t=s[1]);const o={comments:[],elements:[],headerLength:n,objInfo:""},i=t.split(/\r\n|\r|\n/);let a;function d(c,p){const l={type:c[0]};return l.type==="list"?(l.name=c[3],l.countType=c[1],l.itemType=c[2]):l.name=c[1],l.name in p&&(l.name=p[l.name]),l}for(let c=0;c<i.length;c++){let p=i[c];if(p=p.trim(),p==="")continue;const l=p.split(/\s+/),N=l.shift();switch(p=l.join(" "),N){case"format":o.format=l[0],o.version=l[1];break;case"comment":o.comments.push(p);break;case"element":a!==void 0&&o.elements.push(a),a={},a.name=l[0],a.count=parseInt(l[1]),a.properties=[];break;case"property":a.properties.push(d(l,g.propertyNameMapping));break;case"obj_info":o.objInfo=p;break;default:console.log("unhandled",N,l)}}return a!==void 0&&o.elements.push(a),o}function x(e,n){switch(n){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(e);case"float":case"double":case"float32":case"float64":return parseFloat(e)}}function y(e,n){const r={};for(let t=0;t<e.length;t++){if(n.empty())return null;if(e[t].type==="list"){const s=[],o=x(n.next(),e[t].countType);for(let i=0;i<o;i++){if(n.empty())return null;s.push(x(n.next(),e[t].itemType))}r[e[t].name]=s}else r[e[t].name]=x(n.next(),e[t].type)}return r}function R(){const e={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[],faceVertexColors:[]};for(const n of Object.keys(g.customPropertyMapping))e[n]=[];return e}function m(e){const n=e.map(t=>t.name);function r(t){for(let s=0,o=t.length;s<o;s++){const i=t[s];if(n.includes(i))return i}return null}return{attrX:r(["x","px","posx"])||"x",attrY:r(["y","py","posy"])||"y",attrZ:r(["z","pz","posz"])||"z",attrNX:r(["nx","normalx"]),attrNY:r(["ny","normaly"]),attrNZ:r(["nz","normalz"]),attrS:r(["s","u","texture_u","tx"]),attrT:r(["t","v","texture_v","ty"]),attrR:r(["red","diffuse_red","r","diffuse_r"]),attrG:r(["green","diffuse_green","g","diffuse_g"]),attrB:r(["blue","diffuse_blue","b","diffuse_b"])}}function z(e,n){const r=R(),t=/end_header\s+(\S[\s\S]*\S|\S)\s*$/;let s,o;(o=t.exec(e))!==null?s=o[1].split(/\s+/):s=[];const i=new U(s);e:for(let a=0;a<n.elements.length;a++){const d=n.elements[a],c=m(d.properties);for(let p=0;p<d.count;p++){const l=y(d.properties,i);if(!l)break e;P(r,d.name,l,c)}}return v(r)}function v(e){let n=new b;e.indices.length>0&&n.setIndex(e.indices),n.setAttribute("position",new h(e.vertices,3)),e.normals.length>0&&n.setAttribute("normal",new h(e.normals,3)),e.uvs.length>0&&n.setAttribute("uv",new h(e.uvs,2)),e.colors.length>0&&n.setAttribute("color",new h(e.colors,3)),(e.faceVertexUvs.length>0||e.faceVertexColors.length>0)&&(n=n.toNonIndexed(),e.faceVertexUvs.length>0&&n.setAttribute("uv",new h(e.faceVertexUvs,2)),e.faceVertexColors.length>0&&n.setAttribute("color",new h(e.faceVertexColors,3)));for(const r of Object.keys(g.customPropertyMapping))e[r].length>0&&n.setAttribute(r,new h(e[r],g.customPropertyMapping[r].length));return n.computeBoundingSphere(),n}function P(e,n,r,t){if(n==="vertex"){e.vertices.push(r[t.attrX],r[t.attrY],r[t.attrZ]),t.attrNX!==null&&t.attrNY!==null&&t.attrNZ!==null&&e.normals.push(r[t.attrNX],r[t.attrNY],r[t.attrNZ]),t.attrS!==null&&t.attrT!==null&&e.uvs.push(r[t.attrS],r[t.attrT]),t.attrR!==null&&t.attrG!==null&&t.attrB!==null&&(f.setRGB(r[t.attrR]/255,r[t.attrG]/255,r[t.attrB]/255,T),e.colors.push(f.r,f.g,f.b));for(const s of Object.keys(g.customPropertyMapping))for(const o of g.customPropertyMapping[s])e[s].push(r[o])}else if(n==="face"){const s=r.vertex_indices||r.vertex_index,o=r.texcoord;s.length===3?(e.indices.push(s[0],s[1],s[2]),o&&o.length===6&&(e.faceVertexUvs.push(o[0],o[1]),e.faceVertexUvs.push(o[2],o[3]),e.faceVertexUvs.push(o[4],o[5]))):s.length===4&&(e.indices.push(s[0],s[1],s[3]),e.indices.push(s[1],s[2],s[3])),t.attrR!==null&&t.attrG!==null&&t.attrB!==null&&(f.setRGB(r[t.attrR]/255,r[t.attrG]/255,r[t.attrB]/255,T),e.faceVertexColors.push(f.r,f.g,f.b),e.faceVertexColors.push(f.r,f.g,f.b),e.faceVertexColors.push(f.r,f.g,f.b))}}function I(e,n){const r={};let t=0;for(let s=0;s<n.length;s++){const o=n[s],i=o.valueReader;if(o.type==="list"){const a=[],d=o.countReader.read(e+t);t+=o.countReader.size;for(let c=0;c<d;c++)a.push(i.read(e+t)),t+=i.size;r[o.name]=a}else r[o.name]=i.read(e+t),t+=i.size}return[r,t]}function S(e,n,r){function t(s,o,i){switch(o){case"int8":case"char":return{read:a=>s.getInt8(a),size:1};case"uint8":case"uchar":return{read:a=>s.getUint8(a),size:1};case"int16":case"short":return{read:a=>s.getInt16(a,i),size:2};case"uint16":case"ushort":return{read:a=>s.getUint16(a,i),size:2};case"int32":case"int":return{read:a=>s.getInt32(a,i),size:4};case"uint32":case"uint":return{read:a=>s.getUint32(a,i),size:4};case"float32":case"float":return{read:a=>s.getFloat32(a,i),size:4};case"float64":case"double":return{read:a=>s.getFloat64(a,i),size:8}}}for(let s=0,o=e.length;s<o;s++){const i=e[s];i.type==="list"?(i.countReader=t(n,i.countType,r),i.valueReader=t(n,i.itemType,r)):i.valueReader=t(n,i.type,r)}}function _(e,n){const r=R(),t=n.format==="binary_little_endian",s=new DataView(e,n.headerLength);let o,i=0;for(let a=0;a<n.elements.length;a++){const d=n.elements[a],c=d.properties,p=m(c);S(c,s,t);for(let l=0;l<d.count;l++){o=I(i,c),i+=o[1];const N=o[0];P(r,d.name,N,p)}}return v(r)}function w(e){let n=0,r=!0,t="";const s=[],o=new TextDecoder().decode(e.subarray(0,5)),i=/^ply\r\n/.test(o);do{const a=String.fromCharCode(e[n++]);a!==`
2
+ `&&a!=="\r"?t+=a:(t==="end_header"&&(r=!1),t!==""&&(s.push(t),t=""))}while(r&&n<e.length);return i===!0&&n++,{headerText:s.join("\r")+"\r",headerLength:n}}let B;const g=this;if(u instanceof ArrayBuffer){const e=new Uint8Array(u),{headerText:n,headerLength:r}=w(e),t=C(n,r);if(t.format==="ascii"){const s=new TextDecoder().decode(e);B=z(s,t)}else B=_(u,t)}else B=z(u,C(u));return B}}class U{constructor(u){this.arr=u,this.i=0}empty(){return this.i>=this.arr.length}next(){return this.arr[this.i++]}}export{G as PLYLoader};