gaesup-world 1.0.14 → 1.0.16

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),E=require("./useSpawnFromBlueprint-aIQsqI3Q.cjs"),U=require("@react-three/drei"),W=require("@react-three/fiber"),z=require("@react-three/rapier"),H=require("three"),L=require("./gaesupStore-2zKBYTYo.cjs"),R=require("./index-DJRsuAc4.cjs"),V=require("./index-B9tuMXLQ.cjs");function Y(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const u in t)if(u!=="default"){const s=Object.getOwnPropertyDescriptor(t,u);Object.defineProperty(o,u,s.get?s:{enumerable:!0,get:()=>t[u]})}}return o.default=t,Object.freeze(o)}const X=Y(H),g=t=>t?.type==="character";function Z({blueprint:t}){const o=L.useGaesupStore(r=>r.setUrls),u=L.useGaesupStore(r=>r.setCameraOption),s=L.useGaesupStore(r=>r.setMode),_=L.useGaesupStore(r=>r.mode),[l,h]=d.useState(20),c=g(t)?t.controls?.clickToMove??!0:!1,v=g(t)?t.controls?.enableKeyboard??!0:!1,A=g(t)?t.controls?.enableMouse??!0:!1;R.useKeyboard(v,v),d.useEffect(()=>{s({type:"character",control:g(t)&&t.camera?.mode||"thirdPerson"});const r=g(t)?t.camera||{}:{};u({xDistance:r.distance?.x||l,yDistance:r.distance?.y||l*.5,zDistance:r.distance?.z||l,offset:new X.Vector3(0,0,0),enableCollision:r.enableCollision??!1,smoothing:r.smoothing||{position:.25,rotation:.3,fov:.2},fov:r.fov||50,zoom:1,enableZoom:r.enableZoom??!0,zoomSpeed:r.zoomSpeed||.001,minZoom:r.minZoom||.5,maxZoom:r.maxZoom||3,enableFocus:!1,maxDistance:50,distance:10,bounds:{minY:2,maxY:50}})},[s,u,l,t]),d.useEffect(()=>{if(g(t)){if(t.visuals?.model)o({characterUrl:t.visuals.model});else if(t.visuals?.parts&&t.visuals.parts.length>0){const r=t.visuals.parts.find(b=>b.type==="body");r&&o({characterUrl:r.url})}}},[t,o]),d.useEffect(()=>{const r=b=>{if(g(t)&&t.camera?.enableZoom===!1)return;b.preventDefault();const N=b.deltaY*.01;h(P=>Math.max(10,Math.min(40,P+N)))};return window.addEventListener("wheel",r,{passive:!1}),()=>window.removeEventListener("wheel",r)},[t]);const C=()=>!g(t)||!t.visuals?.parts?[]:t.visuals.parts.filter(r=>r.type!=="body").map(r=>r.color?{url:r.url,color:r.color}:{url:r.url});return e.jsxs("div",{className:"blueprint-preview",children:[e.jsxs(W.Canvas,{shadows:!0,camera:{position:[0,10,20],fov:50},style:{width:"100%",height:"100%"},children:[e.jsx(V.Camera,{}),e.jsx(U.Environment,{preset:"sunset"}),e.jsx("ambientLight",{intensity:.5}),e.jsx("directionalLight",{castShadow:!0,position:[20,30,10],intensity:.5,"shadow-mapSize":[1024,1024],"shadow-camera-near":1,"shadow-camera-far":120,"shadow-camera-top":90,"shadow-camera-right":90,"shadow-camera-bottom":-90,"shadow-camera-left":-90}),e.jsxs(z.Physics,{debug:!1,gravity:[0,-9.81,0],children:[t&&_?.type==="character"&&e.jsx(R.ControllerWrapper,{controllerOptions:{lerp:{cameraTurn:.1,cameraPosition:.08}},rigidBodyProps:{lockRotations:!0},parts:C(),position:[0,1,0],rotation:z.euler({x:0,y:Math.PI,z:0})},`preview-${t.id}`),c&&e.jsxs(e.Fragment,{children:[e.jsx(R.Clicker,{}),e.jsx(R.GroundClicker,{})]}),e.jsx(z.RigidBody,{type:"fixed",children:e.jsxs("mesh",{receiveShadow:!0,position:[0,-.5,0],children:[e.jsx("boxGeometry",{args:[100,1,100]}),e.jsx("meshStandardMaterial",{color:"#303030"})]})}),e.jsx(U.Grid,{renderOrder:-1,position:[0,.01,0],infiniteGrid:!0,cellSize:1,cellThickness:.5,cellColor:"#404040",sectionSize:5,sectionThickness:1,sectionColor:"#606060",fadeDistance:50,fadeStrength:1,followCamera:!1,userData:{intangible:!0}})]})]}),t&&e.jsxs("div",{className:"blueprint-preview__info",children:[e.jsx("h4",{className:"blueprint-preview__name",children:t.name}),e.jsx("p",{className:"blueprint-preview__type",children:t.type}),g(t)&&t.physics&&e.jsxs("div",{className:"blueprint-preview__stats",children:[e.jsxs("div",{children:["Move Speed: ",t.physics.moveSpeed]}),e.jsxs("div",{children:["Jump Force: ",t.physics.jumpForce]})]}),e.jsxs("div",{className:"blueprint-preview__controls",children:[e.jsxs("div",{children:["Camera: ",g(t)?t.camera?.mode||"thirdPerson":"N/A"]}),e.jsxs("div",{children:["Keyboard: ",v?"Enabled":"Disabled"]}),e.jsxs("div",{children:["Mouse: ",A?"Enabled":"Disabled"]}),e.jsxs("div",{children:["Click to Move: ",c?"Enabled":"Disabled"]})]})]})]})}const ee=t=>{switch(t.type){case"animation-sequence":return"animation";case"behavior-tree":return"behavior";default:return t.type}},K=t=>({id:t.id,name:t.name,type:ee(t),version:t.version,tags:t.tags||[],description:t.description??"",lastModified:new Date().toISOString().split("T")[0]??""}),G=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),te=(t,o,u)=>{if(o.length===0)return!1;let s=t;for(let l=0;l<o.length-1;l++){const h=o[l];if(!h)return!1;if(Array.isArray(s)){const c=Number(h);if(!Number.isInteger(c)||c<0||c>=s.length)return!1;s=s[c];continue}if(!G(s))return!1;s=s[h]}const _=o[o.length-1];if(!_)return!1;if(Array.isArray(s)){const l=Number(_);return!Number.isInteger(l)||l<0||l>=s.length?!1:(s[l]=u,!0)}return G(s)?(s[_]=u,!0):!1},se=[{id:"characters",name:"Characters",type:"character",count:0},{id:"vehicles",name:"Vehicles",type:"vehicle",count:0},{id:"airplanes",name:"Airplanes",type:"airplane",count:0},{id:"animations",name:"Animations",type:"animation",count:0},{id:"behaviors",name:"Behaviors",type:"behavior",count:0},{id:"items",name:"Items",type:"item",count:0}],re=({onClose:t})=>{const[o,u]=d.useState("character"),[s,_]=d.useState(null),[l,h]=d.useState(""),[c,v]=d.useState(null),[A,C]=d.useState(!0),{spawnAtCursor:r,isSpawning:b}=E.useSpawnFromBlueprint(),N=d.useMemo(()=>E.blueprintRegistry.getAll().map(K),[]),P=d.useMemo(()=>{const i={character:0,vehicle:0,airplane:0,animation:0,behavior:0,item:0};return N.forEach(a=>{a.type in i&&i[a.type]++}),se.map(a=>({...a,count:i[a.type]})).filter(a=>a.count>0)},[N]),w=d.useMemo(()=>N.filter(i=>{const a=i.type===o,m=l===""||i.name.toLowerCase().includes(l.toLowerCase())||i.tags.some(x=>x.toLowerCase().includes(l.toLowerCase()));return a&&m}),[o,l,N]),M=d.useCallback((i,a)=>{v(m=>{if(!m)return null;const x=JSON.parse(JSON.stringify(m));return te(x,i,a)?x:m})},[]),S=d.useCallback(i=>{if(_(i),i){const a=E.blueprintRegistry.get(i);a&&v(JSON.parse(JSON.stringify(a)))}else v(null)},[]);d.useEffect(()=>{const i=w.some(a=>a.id===s);w[0]?.id&&w.length>0&&!i?S(w[0].id):w.length===0&&S(null)},[w,s,S]);const I=async()=>{if(!s)return;await r(s)&&t()},D=(i,a,m)=>Array.isArray(a)?e.jsxs("div",{className:"blueprint-editor__inspector-group",children:[e.jsx("div",{className:"blueprint-editor__inspector-title",children:i}),e.jsx("div",{className:"blueprint-editor__inspector-list",children:a.length===0?"비어 있음":`${a.length}개 항목`})]},m.join(".")):G(a)?e.jsxs("div",{className:"blueprint-editor__inspector-group",children:[e.jsx("div",{className:"blueprint-editor__inspector-title",children:i}),Object.entries(a).map(([x,T])=>D(x,T,[...m,x]))]},m.join(".")):typeof a=="boolean"?e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("button",{className:`blueprint-editor__toggle ${a?"blueprint-editor__toggle--on":""}`,onClick:()=>M(m,!a),children:a?"ON":"OFF"})]},m.join(".")):typeof a=="number"?e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("input",{type:"number",value:a,onChange:x=>M(m,Number(x.target.value)),className:"blueprint-editor__inspector-input"})]},m.join(".")):e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("input",{type:"text",value:typeof a=="string"?a:"",onChange:x=>M(m,x.target.value),className:"blueprint-editor__inspector-input"})]},m.join("."));return e.jsxs("div",{className:"blueprint-editor",children:[e.jsxs("div",{className:"blueprint-editor__sidebar",children:[e.jsx("div",{className:"blueprint-editor__search",children:e.jsx("input",{type:"text",placeholder:"Search blueprints...",value:l,onChange:i=>h(i.target.value),className:"blueprint-editor__search-input"})}),e.jsx("div",{className:"blueprint-editor__categories",children:P.map(i=>e.jsxs("button",{onClick:()=>u(i.type),className:`blueprint-editor__category ${o===i.type?"active":""}`,children:[e.jsx("span",{className:"blueprint-editor__category-name",children:i.name}),e.jsx("span",{className:"blueprint-editor__category-count",children:i.count})]},i.id))}),e.jsx("div",{className:"blueprint-editor__list",children:w.map(i=>e.jsxs("div",{onClick:()=>S(i.id),className:`blueprint-editor__item ${s===i.id?"active":""}`,children:[e.jsx("div",{className:"blueprint-editor__item-name",children:i.name}),e.jsx("div",{className:"blueprint-editor__item-tags",children:i.tags.map(a=>e.jsx("span",{className:"blueprint-editor__tag",children:a},a))})]},i.id))}),e.jsx("div",{className:"blueprint-editor__actions",children:e.jsx("button",{onClick:I,disabled:!s||b,className:"blueprint-editor__spawn-button",children:b?"Spawning...":"Spawn Entity"})})]}),e.jsxs("div",{className:"blueprint-editor__main",children:[e.jsxs("div",{className:"blueprint-editor__preview-section",children:[e.jsxs("div",{className:"blueprint-editor__preview-header",children:[e.jsx("h3",{className:"blueprint-editor__preview-title",children:"Preview"}),e.jsx("button",{onClick:()=>C(!A),className:"blueprint-editor__preview-toggle",children:A?"Hide":"Show"})]}),A&&e.jsx("div",{className:"blueprint-editor__preview-container",children:e.jsx(Z,{blueprint:c},c?c.id:"no-blueprint")})]}),e.jsxs("div",{className:"blueprint-editor__inspector-section",children:[e.jsx("div",{className:"blueprint-editor__preview-header",children:e.jsx("h3",{className:"blueprint-editor__preview-title",children:"Inspector"})}),e.jsx("div",{className:"blueprint-editor__inspector",children:c?Object.entries(c).map(([i,a])=>D(i,a,[i])):e.jsx("div",{className:"blueprint-editor__empty",children:"블루프린트를 선택하세요."})})]})]})]})},F=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),ie=(t,o,u)=>{if(o.length===0)return!1;let s=t;for(let l=0;l<o.length-1;l++){const h=o[l];if(!h)return!1;if(Array.isArray(s)){const c=Number(h);if(!Number.isInteger(c)||c<0||c>=s.length)return!1;s=s[c];continue}if(!F(s))return!1;s=s[h]}const _=o[o.length-1];if(!_)return!1;if(Array.isArray(s)){const l=Number(_);return!Number.isInteger(l)||l<0||l>=s.length?!1:(s[l]=u,!0)}return F(s)?(s[_]=u,!0):!1},ne=[{id:"characters",name:"Characters",type:"character",count:0},{id:"vehicles",name:"Vehicles",type:"vehicle",count:0},{id:"airplanes",name:"Airplanes",type:"airplane",count:0},{id:"animations",name:"Animations",type:"animation",count:0},{id:"behaviors",name:"Behaviors",type:"behavior",count:0},{id:"items",name:"Items",type:"item",count:0}],ae=({className:t="",style:o,children:u})=>{const[s,_]=d.useState("character"),[l,h]=d.useState(null),[c,v]=d.useState(""),[A,C]=d.useState(!1),[r,b]=d.useState(null),[N,P]=d.useState(!1),{spawnAtCursor:w,isSpawning:M}=E.useSpawnFromBlueprint(),S=d.useMemo(()=>E.blueprintRegistry.getAll().map(K),[]),I=d.useMemo(()=>{const n={character:0,vehicle:0,airplane:0,animation:0,behavior:0,item:0};return S.forEach(p=>{p.type in n&&n[p.type]++}),ne.map(p=>({...p,count:n[p.type]}))},[S]),D=d.useMemo(()=>S.filter(n=>{const p=n.type===s,j=c===""||n.name.toLowerCase().includes(c.toLowerCase())||n.tags.some(f=>f.toLowerCase().includes(c.toLowerCase()));return p&&j}),[s,c,S]),i=n=>{h(n);const p=E.blueprintRegistry.get(n);p&&b(JSON.parse(JSON.stringify(p)))},a=()=>{C(!0)},m=()=>{r&&(E.blueprintRegistry.register(r),C(!1),P(!1),i(r.id))},x=()=>{if(C(!1),l){const n=E.blueprintRegistry.get(l);n&&b(JSON.parse(JSON.stringify(n)))}},T=()=>{let n;const p={id:`custom_${s}_${Date.now()}`,name:`New ${s.charAt(0).toUpperCase()+s.slice(1)}`,version:"1.0.0",tags:["custom"],description:"Custom blueprint"};switch(s){case"vehicle":n={...p,type:"vehicle",physics:{mass:1e3,maxSpeed:30,acceleration:10,braking:15,turning:2},seats:[{position:[0,1,0],isDriver:!0}],animations:{idle:""}};break;case"airplane":n={...p,type:"airplane",physics:{mass:2e3,maxSpeed:100,acceleration:20,turning:1,lift:50,drag:10},seats:[{position:[0,1,2],isDriver:!0}],animations:{idle:""}};break;default:n={...p,type:"character",physics:{mass:70,height:1.8,radius:.3,jumpForce:300,moveSpeed:5,runSpeed:10,airControl:.2},animations:{idle:"",walk:"",run:"",jump:{start:"",loop:"",land:""}},stats:{health:100,stamina:50,strength:10,defense:10,speed:10}}}b(n),h(n.id),P(!0),C(!0)},q=(n,p)=>{if(!r)return;const j=JSON.parse(JSON.stringify(r));ie(j,n,p)&&b(j)},J=(n,p=[])=>{const j=[];return Object.entries(n).forEach(([f,y])=>{const k=[...p,f],O=k.join(".");f==="id"||f==="type"?j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:"text",value:y,disabled:!0,className:"property-editor__input property-editor__input--disabled"})]},O)):F(y)?j.push(e.jsxs("div",{className:"property-editor__group",children:[e.jsxs("div",{className:"property-editor__group-title editor-text",children:[f.charAt(0).toUpperCase()+f.slice(1),":"]}),e.jsx("div",{className:"property-editor__group-content",children:J(y,k)})]},O)):Array.isArray(y)?y.length>0&&y.every(F)?j.push(e.jsxs("div",{className:"property-editor__group",children:[e.jsxs("div",{className:"property-editor__group-title editor-text",children:[f.charAt(0).toUpperCase()+f.slice(1),":"]}),e.jsx("div",{className:"property-editor__group-content",children:y.map((B,$)=>e.jsxs("div",{className:"property-editor__array-item",children:[e.jsxs("div",{className:"property-editor__array-item-title editor-text-small",children:["Item ",$+1]}),J(B,[...k,$.toString()])]},`${O}.${$}`))})]},O)):j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:"text",value:y.join(", "),onChange:B=>q(k,B.target.value.split(",").map($=>$.trim())),className:"property-editor__input"})]},O)):typeof y=="boolean"?j.push(e.jsx("div",{className:"property-editor__field",children:e.jsxs("label",{className:"property-editor__checkbox-label editor-text-small",children:[e.jsx("input",{type:"checkbox",checked:y,onChange:B=>q(k,B.target.checked),className:"property-editor__checkbox"}),f]})},O)):j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:typeof y=="number"?"number":"text",value:y,onChange:B=>q(k,typeof y=="number"?Number(B.target.value):B.target.value),className:"property-editor__input"})]},O))}),j},Q=async()=>{!l||await w(l)};return e.jsxs("div",{className:`blueprint-panel ${t}`,style:o,children:[e.jsx("h3",{className:"editor-title",children:"Blueprint Library"}),e.jsx("div",{className:"blueprint-panel__toolbar",children:e.jsxs("div",{className:"blueprint-panel__search-container",children:[e.jsx("input",{type:"text",placeholder:"Search blueprints...",value:c,onChange:n=>v(n.target.value),className:"blueprint-panel__search-input"}),e.jsx("button",{onClick:T,className:"blueprint-panel__button blueprint-panel__button--primary",children:"+ New Blueprint"})]})}),e.jsx("div",{className:"blueprint-panel__categories",children:I.map(n=>e.jsxs("button",{onClick:()=>_(n.type),className:`blueprint-panel__category-button ${s===n.type?"blueprint-panel__category-button--active":""}`,children:[e.jsx("span",{children:n.name}),e.jsxs("span",{children:["(",n.count,")"]})]},n.id))}),A?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"blueprint-panel__property-editor-container editor-scrollbar",children:r&&e.jsxs("div",{children:[e.jsx("h4",{className:"blueprint-panel__property-editor-title editor-text",children:N?"Create New Blueprint":`Edit: ${r.name}`}),J(r)]})}),e.jsx("div",{className:"blueprint-panel__footer",children:e.jsxs("div",{className:"blueprint-panel__footer-buttons",children:[e.jsx("button",{onClick:m,className:"blueprint-panel__button blueprint-panel__button--primary",children:N?"Create":"Save"}),e.jsx("button",{onClick:x,className:"blueprint-panel__button blueprint-panel__button--danger",children:"Cancel"})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"blueprint-panel__list editor-scrollbar",children:D.length===0?e.jsx("div",{className:"blueprint-panel__empty-message editor-text-small",children:"No blueprints found"}):D.map(n=>e.jsx("div",{onClick:()=>i(n.id),className:`blueprint-panel__list-item ${l===n.id?"blueprint-panel__list-item--selected":""}`,children:e.jsxs("div",{className:"list-item__content",children:[e.jsxs("div",{className:"list-item__text-content",children:[e.jsx("div",{className:"list-item__name editor-text",children:n.name}),e.jsx("div",{className:"list-item__description editor-text-small",children:n.description}),e.jsx("div",{className:"list-item__tags",children:n.tags.map(p=>e.jsx("span",{className:"list-item__tag editor-text-small",children:p},p))})]}),e.jsxs("div",{className:"list-item__meta editor-text-small",children:[e.jsxs("div",{children:["v",n.version]}),e.jsx("div",{children:n.lastModified})]})]})},n.id))}),l&&e.jsx("div",{className:"blueprint-panel__footer",children:e.jsxs("div",{className:"blueprint-panel__footer-buttons",children:[e.jsx("button",{onClick:a,className:"blueprint-panel__button blueprint-panel__button--secondary",children:"Edit Blueprint"}),e.jsx("button",{onClick:Q,disabled:M,className:"blueprint-panel__button blueprint-panel__button--primary",children:M?"Spawning...":"Spawn Entity"})]})})]}),u]})};exports.BlueprintEditor=re;exports.BlueprintPanel=ae;exports.BlueprintPreview=Z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),E=require("./useSpawnFromBlueprint-aIQsqI3Q.cjs"),U=require("@react-three/drei"),W=require("@react-three/fiber"),z=require("@react-three/rapier"),H=require("three"),L=require("./gaesupStore-2zKBYTYo.cjs"),R=require("./index-vksPEPuX.cjs"),V=require("./index-B0ymJw1j.cjs");function Y(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const u in t)if(u!=="default"){const s=Object.getOwnPropertyDescriptor(t,u);Object.defineProperty(o,u,s.get?s:{enumerable:!0,get:()=>t[u]})}}return o.default=t,Object.freeze(o)}const X=Y(H),g=t=>t?.type==="character";function Z({blueprint:t}){const o=L.useGaesupStore(r=>r.setUrls),u=L.useGaesupStore(r=>r.setCameraOption),s=L.useGaesupStore(r=>r.setMode),_=L.useGaesupStore(r=>r.mode),[l,h]=d.useState(20),c=g(t)?t.controls?.clickToMove??!0:!1,v=g(t)?t.controls?.enableKeyboard??!0:!1,A=g(t)?t.controls?.enableMouse??!0:!1;R.useKeyboard(v,v),d.useEffect(()=>{s({type:"character",control:g(t)&&t.camera?.mode||"thirdPerson"});const r=g(t)?t.camera||{}:{};u({xDistance:r.distance?.x||l,yDistance:r.distance?.y||l*.5,zDistance:r.distance?.z||l,offset:new X.Vector3(0,0,0),enableCollision:r.enableCollision??!1,smoothing:r.smoothing||{position:.25,rotation:.3,fov:.2},fov:r.fov||50,zoom:1,enableZoom:r.enableZoom??!0,zoomSpeed:r.zoomSpeed||.001,minZoom:r.minZoom||.5,maxZoom:r.maxZoom||3,enableFocus:!1,maxDistance:50,distance:10,bounds:{minY:2,maxY:50}})},[s,u,l,t]),d.useEffect(()=>{if(g(t)){if(t.visuals?.model)o({characterUrl:t.visuals.model});else if(t.visuals?.parts&&t.visuals.parts.length>0){const r=t.visuals.parts.find(b=>b.type==="body");r&&o({characterUrl:r.url})}}},[t,o]),d.useEffect(()=>{const r=b=>{if(g(t)&&t.camera?.enableZoom===!1)return;b.preventDefault();const N=b.deltaY*.01;h(P=>Math.max(10,Math.min(40,P+N)))};return window.addEventListener("wheel",r,{passive:!1}),()=>window.removeEventListener("wheel",r)},[t]);const C=()=>!g(t)||!t.visuals?.parts?[]:t.visuals.parts.filter(r=>r.type!=="body").map(r=>r.color?{url:r.url,color:r.color}:{url:r.url});return e.jsxs("div",{className:"blueprint-preview",children:[e.jsxs(W.Canvas,{shadows:!0,camera:{position:[0,10,20],fov:50},style:{width:"100%",height:"100%"},children:[e.jsx(V.Camera,{}),e.jsx(U.Environment,{preset:"sunset"}),e.jsx("ambientLight",{intensity:.5}),e.jsx("directionalLight",{castShadow:!0,position:[20,30,10],intensity:.5,"shadow-mapSize":[1024,1024],"shadow-camera-near":1,"shadow-camera-far":120,"shadow-camera-top":90,"shadow-camera-right":90,"shadow-camera-bottom":-90,"shadow-camera-left":-90}),e.jsxs(z.Physics,{debug:!1,gravity:[0,-9.81,0],children:[t&&_?.type==="character"&&e.jsx(R.ControllerWrapper,{controllerOptions:{lerp:{cameraTurn:.1,cameraPosition:.08}},rigidBodyProps:{lockRotations:!0},parts:C(),position:[0,1,0],rotation:z.euler({x:0,y:Math.PI,z:0})},`preview-${t.id}`),c&&e.jsxs(e.Fragment,{children:[e.jsx(R.Clicker,{}),e.jsx(R.GroundClicker,{})]}),e.jsx(z.RigidBody,{type:"fixed",children:e.jsxs("mesh",{receiveShadow:!0,position:[0,-.5,0],children:[e.jsx("boxGeometry",{args:[100,1,100]}),e.jsx("meshStandardMaterial",{color:"#303030"})]})}),e.jsx(U.Grid,{renderOrder:-1,position:[0,.01,0],infiniteGrid:!0,cellSize:1,cellThickness:.5,cellColor:"#404040",sectionSize:5,sectionThickness:1,sectionColor:"#606060",fadeDistance:50,fadeStrength:1,followCamera:!1,userData:{intangible:!0}})]})]}),t&&e.jsxs("div",{className:"blueprint-preview__info",children:[e.jsx("h4",{className:"blueprint-preview__name",children:t.name}),e.jsx("p",{className:"blueprint-preview__type",children:t.type}),g(t)&&t.physics&&e.jsxs("div",{className:"blueprint-preview__stats",children:[e.jsxs("div",{children:["Move Speed: ",t.physics.moveSpeed]}),e.jsxs("div",{children:["Jump Force: ",t.physics.jumpForce]})]}),e.jsxs("div",{className:"blueprint-preview__controls",children:[e.jsxs("div",{children:["Camera: ",g(t)?t.camera?.mode||"thirdPerson":"N/A"]}),e.jsxs("div",{children:["Keyboard: ",v?"Enabled":"Disabled"]}),e.jsxs("div",{children:["Mouse: ",A?"Enabled":"Disabled"]}),e.jsxs("div",{children:["Click to Move: ",c?"Enabled":"Disabled"]})]})]})]})}const ee=t=>{switch(t.type){case"animation-sequence":return"animation";case"behavior-tree":return"behavior";default:return t.type}},K=t=>({id:t.id,name:t.name,type:ee(t),version:t.version,tags:t.tags||[],description:t.description??"",lastModified:new Date().toISOString().split("T")[0]??""}),G=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),te=(t,o,u)=>{if(o.length===0)return!1;let s=t;for(let l=0;l<o.length-1;l++){const h=o[l];if(!h)return!1;if(Array.isArray(s)){const c=Number(h);if(!Number.isInteger(c)||c<0||c>=s.length)return!1;s=s[c];continue}if(!G(s))return!1;s=s[h]}const _=o[o.length-1];if(!_)return!1;if(Array.isArray(s)){const l=Number(_);return!Number.isInteger(l)||l<0||l>=s.length?!1:(s[l]=u,!0)}return G(s)?(s[_]=u,!0):!1},se=[{id:"characters",name:"Characters",type:"character",count:0},{id:"vehicles",name:"Vehicles",type:"vehicle",count:0},{id:"airplanes",name:"Airplanes",type:"airplane",count:0},{id:"animations",name:"Animations",type:"animation",count:0},{id:"behaviors",name:"Behaviors",type:"behavior",count:0},{id:"items",name:"Items",type:"item",count:0}],re=({onClose:t})=>{const[o,u]=d.useState("character"),[s,_]=d.useState(null),[l,h]=d.useState(""),[c,v]=d.useState(null),[A,C]=d.useState(!0),{spawnAtCursor:r,isSpawning:b}=E.useSpawnFromBlueprint(),N=d.useMemo(()=>E.blueprintRegistry.getAll().map(K),[]),P=d.useMemo(()=>{const i={character:0,vehicle:0,airplane:0,animation:0,behavior:0,item:0};return N.forEach(a=>{a.type in i&&i[a.type]++}),se.map(a=>({...a,count:i[a.type]})).filter(a=>a.count>0)},[N]),w=d.useMemo(()=>N.filter(i=>{const a=i.type===o,m=l===""||i.name.toLowerCase().includes(l.toLowerCase())||i.tags.some(x=>x.toLowerCase().includes(l.toLowerCase()));return a&&m}),[o,l,N]),M=d.useCallback((i,a)=>{v(m=>{if(!m)return null;const x=JSON.parse(JSON.stringify(m));return te(x,i,a)?x:m})},[]),S=d.useCallback(i=>{if(_(i),i){const a=E.blueprintRegistry.get(i);a&&v(JSON.parse(JSON.stringify(a)))}else v(null)},[]);d.useEffect(()=>{const i=w.some(a=>a.id===s);w[0]?.id&&w.length>0&&!i?S(w[0].id):w.length===0&&S(null)},[w,s,S]);const I=async()=>{if(!s)return;await r(s)&&t()},D=(i,a,m)=>Array.isArray(a)?e.jsxs("div",{className:"blueprint-editor__inspector-group",children:[e.jsx("div",{className:"blueprint-editor__inspector-title",children:i}),e.jsx("div",{className:"blueprint-editor__inspector-list",children:a.length===0?"비어 있음":`${a.length}개 항목`})]},m.join(".")):G(a)?e.jsxs("div",{className:"blueprint-editor__inspector-group",children:[e.jsx("div",{className:"blueprint-editor__inspector-title",children:i}),Object.entries(a).map(([x,T])=>D(x,T,[...m,x]))]},m.join(".")):typeof a=="boolean"?e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("button",{className:`blueprint-editor__toggle ${a?"blueprint-editor__toggle--on":""}`,onClick:()=>M(m,!a),children:a?"ON":"OFF"})]},m.join(".")):typeof a=="number"?e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("input",{type:"number",value:a,onChange:x=>M(m,Number(x.target.value)),className:"blueprint-editor__inspector-input"})]},m.join(".")):e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("input",{type:"text",value:typeof a=="string"?a:"",onChange:x=>M(m,x.target.value),className:"blueprint-editor__inspector-input"})]},m.join("."));return e.jsxs("div",{className:"blueprint-editor",children:[e.jsxs("div",{className:"blueprint-editor__sidebar",children:[e.jsx("div",{className:"blueprint-editor__search",children:e.jsx("input",{type:"text",placeholder:"Search blueprints...",value:l,onChange:i=>h(i.target.value),className:"blueprint-editor__search-input"})}),e.jsx("div",{className:"blueprint-editor__categories",children:P.map(i=>e.jsxs("button",{onClick:()=>u(i.type),className:`blueprint-editor__category ${o===i.type?"active":""}`,children:[e.jsx("span",{className:"blueprint-editor__category-name",children:i.name}),e.jsx("span",{className:"blueprint-editor__category-count",children:i.count})]},i.id))}),e.jsx("div",{className:"blueprint-editor__list",children:w.map(i=>e.jsxs("div",{onClick:()=>S(i.id),className:`blueprint-editor__item ${s===i.id?"active":""}`,children:[e.jsx("div",{className:"blueprint-editor__item-name",children:i.name}),e.jsx("div",{className:"blueprint-editor__item-tags",children:i.tags.map(a=>e.jsx("span",{className:"blueprint-editor__tag",children:a},a))})]},i.id))}),e.jsx("div",{className:"blueprint-editor__actions",children:e.jsx("button",{onClick:I,disabled:!s||b,className:"blueprint-editor__spawn-button",children:b?"Spawning...":"Spawn Entity"})})]}),e.jsxs("div",{className:"blueprint-editor__main",children:[e.jsxs("div",{className:"blueprint-editor__preview-section",children:[e.jsxs("div",{className:"blueprint-editor__preview-header",children:[e.jsx("h3",{className:"blueprint-editor__preview-title",children:"Preview"}),e.jsx("button",{onClick:()=>C(!A),className:"blueprint-editor__preview-toggle",children:A?"Hide":"Show"})]}),A&&e.jsx("div",{className:"blueprint-editor__preview-container",children:e.jsx(Z,{blueprint:c},c?c.id:"no-blueprint")})]}),e.jsxs("div",{className:"blueprint-editor__inspector-section",children:[e.jsx("div",{className:"blueprint-editor__preview-header",children:e.jsx("h3",{className:"blueprint-editor__preview-title",children:"Inspector"})}),e.jsx("div",{className:"blueprint-editor__inspector",children:c?Object.entries(c).map(([i,a])=>D(i,a,[i])):e.jsx("div",{className:"blueprint-editor__empty",children:"블루프린트를 선택하세요."})})]})]})]})},F=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),ie=(t,o,u)=>{if(o.length===0)return!1;let s=t;for(let l=0;l<o.length-1;l++){const h=o[l];if(!h)return!1;if(Array.isArray(s)){const c=Number(h);if(!Number.isInteger(c)||c<0||c>=s.length)return!1;s=s[c];continue}if(!F(s))return!1;s=s[h]}const _=o[o.length-1];if(!_)return!1;if(Array.isArray(s)){const l=Number(_);return!Number.isInteger(l)||l<0||l>=s.length?!1:(s[l]=u,!0)}return F(s)?(s[_]=u,!0):!1},ne=[{id:"characters",name:"Characters",type:"character",count:0},{id:"vehicles",name:"Vehicles",type:"vehicle",count:0},{id:"airplanes",name:"Airplanes",type:"airplane",count:0},{id:"animations",name:"Animations",type:"animation",count:0},{id:"behaviors",name:"Behaviors",type:"behavior",count:0},{id:"items",name:"Items",type:"item",count:0}],ae=({className:t="",style:o,children:u})=>{const[s,_]=d.useState("character"),[l,h]=d.useState(null),[c,v]=d.useState(""),[A,C]=d.useState(!1),[r,b]=d.useState(null),[N,P]=d.useState(!1),{spawnAtCursor:w,isSpawning:M}=E.useSpawnFromBlueprint(),S=d.useMemo(()=>E.blueprintRegistry.getAll().map(K),[]),I=d.useMemo(()=>{const n={character:0,vehicle:0,airplane:0,animation:0,behavior:0,item:0};return S.forEach(p=>{p.type in n&&n[p.type]++}),ne.map(p=>({...p,count:n[p.type]}))},[S]),D=d.useMemo(()=>S.filter(n=>{const p=n.type===s,j=c===""||n.name.toLowerCase().includes(c.toLowerCase())||n.tags.some(f=>f.toLowerCase().includes(c.toLowerCase()));return p&&j}),[s,c,S]),i=n=>{h(n);const p=E.blueprintRegistry.get(n);p&&b(JSON.parse(JSON.stringify(p)))},a=()=>{C(!0)},m=()=>{r&&(E.blueprintRegistry.register(r),C(!1),P(!1),i(r.id))},x=()=>{if(C(!1),l){const n=E.blueprintRegistry.get(l);n&&b(JSON.parse(JSON.stringify(n)))}},T=()=>{let n;const p={id:`custom_${s}_${Date.now()}`,name:`New ${s.charAt(0).toUpperCase()+s.slice(1)}`,version:"1.0.0",tags:["custom"],description:"Custom blueprint"};switch(s){case"vehicle":n={...p,type:"vehicle",physics:{mass:1e3,maxSpeed:30,acceleration:10,braking:15,turning:2},seats:[{position:[0,1,0],isDriver:!0}],animations:{idle:""}};break;case"airplane":n={...p,type:"airplane",physics:{mass:2e3,maxSpeed:100,acceleration:20,turning:1,lift:50,drag:10},seats:[{position:[0,1,2],isDriver:!0}],animations:{idle:""}};break;default:n={...p,type:"character",physics:{mass:70,height:1.8,radius:.3,jumpForce:300,moveSpeed:5,runSpeed:10,airControl:.2},animations:{idle:"",walk:"",run:"",jump:{start:"",loop:"",land:""}},stats:{health:100,stamina:50,strength:10,defense:10,speed:10}}}b(n),h(n.id),P(!0),C(!0)},q=(n,p)=>{if(!r)return;const j=JSON.parse(JSON.stringify(r));ie(j,n,p)&&b(j)},J=(n,p=[])=>{const j=[];return Object.entries(n).forEach(([f,y])=>{const k=[...p,f],O=k.join(".");f==="id"||f==="type"?j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:"text",value:y,disabled:!0,className:"property-editor__input property-editor__input--disabled"})]},O)):F(y)?j.push(e.jsxs("div",{className:"property-editor__group",children:[e.jsxs("div",{className:"property-editor__group-title editor-text",children:[f.charAt(0).toUpperCase()+f.slice(1),":"]}),e.jsx("div",{className:"property-editor__group-content",children:J(y,k)})]},O)):Array.isArray(y)?y.length>0&&y.every(F)?j.push(e.jsxs("div",{className:"property-editor__group",children:[e.jsxs("div",{className:"property-editor__group-title editor-text",children:[f.charAt(0).toUpperCase()+f.slice(1),":"]}),e.jsx("div",{className:"property-editor__group-content",children:y.map((B,$)=>e.jsxs("div",{className:"property-editor__array-item",children:[e.jsxs("div",{className:"property-editor__array-item-title editor-text-small",children:["Item ",$+1]}),J(B,[...k,$.toString()])]},`${O}.${$}`))})]},O)):j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:"text",value:y.join(", "),onChange:B=>q(k,B.target.value.split(",").map($=>$.trim())),className:"property-editor__input"})]},O)):typeof y=="boolean"?j.push(e.jsx("div",{className:"property-editor__field",children:e.jsxs("label",{className:"property-editor__checkbox-label editor-text-small",children:[e.jsx("input",{type:"checkbox",checked:y,onChange:B=>q(k,B.target.checked),className:"property-editor__checkbox"}),f]})},O)):j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:typeof y=="number"?"number":"text",value:y,onChange:B=>q(k,typeof y=="number"?Number(B.target.value):B.target.value),className:"property-editor__input"})]},O))}),j},Q=async()=>{!l||await w(l)};return e.jsxs("div",{className:`blueprint-panel ${t}`,style:o,children:[e.jsx("h3",{className:"editor-title",children:"Blueprint Library"}),e.jsx("div",{className:"blueprint-panel__toolbar",children:e.jsxs("div",{className:"blueprint-panel__search-container",children:[e.jsx("input",{type:"text",placeholder:"Search blueprints...",value:c,onChange:n=>v(n.target.value),className:"blueprint-panel__search-input"}),e.jsx("button",{onClick:T,className:"blueprint-panel__button blueprint-panel__button--primary",children:"+ New Blueprint"})]})}),e.jsx("div",{className:"blueprint-panel__categories",children:I.map(n=>e.jsxs("button",{onClick:()=>_(n.type),className:`blueprint-panel__category-button ${s===n.type?"blueprint-panel__category-button--active":""}`,children:[e.jsx("span",{children:n.name}),e.jsxs("span",{children:["(",n.count,")"]})]},n.id))}),A?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"blueprint-panel__property-editor-container editor-scrollbar",children:r&&e.jsxs("div",{children:[e.jsx("h4",{className:"blueprint-panel__property-editor-title editor-text",children:N?"Create New Blueprint":`Edit: ${r.name}`}),J(r)]})}),e.jsx("div",{className:"blueprint-panel__footer",children:e.jsxs("div",{className:"blueprint-panel__footer-buttons",children:[e.jsx("button",{onClick:m,className:"blueprint-panel__button blueprint-panel__button--primary",children:N?"Create":"Save"}),e.jsx("button",{onClick:x,className:"blueprint-panel__button blueprint-panel__button--danger",children:"Cancel"})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"blueprint-panel__list editor-scrollbar",children:D.length===0?e.jsx("div",{className:"blueprint-panel__empty-message editor-text-small",children:"No blueprints found"}):D.map(n=>e.jsx("div",{onClick:()=>i(n.id),className:`blueprint-panel__list-item ${l===n.id?"blueprint-panel__list-item--selected":""}`,children:e.jsxs("div",{className:"list-item__content",children:[e.jsxs("div",{className:"list-item__text-content",children:[e.jsx("div",{className:"list-item__name editor-text",children:n.name}),e.jsx("div",{className:"list-item__description editor-text-small",children:n.description}),e.jsx("div",{className:"list-item__tags",children:n.tags.map(p=>e.jsx("span",{className:"list-item__tag editor-text-small",children:p},p))})]}),e.jsxs("div",{className:"list-item__meta editor-text-small",children:[e.jsxs("div",{children:["v",n.version]}),e.jsx("div",{children:n.lastModified})]})]})},n.id))}),l&&e.jsx("div",{className:"blueprint-panel__footer",children:e.jsxs("div",{className:"blueprint-panel__footer-buttons",children:[e.jsx("button",{onClick:a,className:"blueprint-panel__button blueprint-panel__button--secondary",children:"Edit Blueprint"}),e.jsx("button",{onClick:Q,disabled:M,className:"blueprint-panel__button blueprint-panel__button--primary",children:M?"Spawning...":"Spawn Entity"})]})})]}),u]})};exports.BlueprintEditor=re;exports.BlueprintPanel=ae;exports.BlueprintPreview=Z;
@@ -6,8 +6,8 @@ import { Canvas as X } from "@react-three/fiber";
6
6
  import { Physics as ee, euler as te, RigidBody as ie } from "@react-three/rapier";
7
7
  import * as re from "three";
8
8
  import { u as J } from "./gaesupStore-DTu0tYBp.js";
9
- import { u as ne, C as ae, a as se, G as oe } from "./index-DU-r7CPy.js";
10
- import { C as le } from "./index-DnZ3X7L7.js";
9
+ import { u as ne, C as ae, a as se, G as oe } from "./index-D-y80TPB.js";
10
+ import { C as le } from "./index-CsKqKct1.js";
11
11
  const w = (t) => t?.type === "character";
12
12
  function ce({ blueprint: t }) {
13
13
  const d = J((n) => n.setUrls), b = J((n) => n.setCameraOption), r = J((n) => n.setMode), h = J((n) => n.mode), [l, u] = g(20), c = w(t) ? t.controls?.clickToMove ?? !0 : !1, C = w(t) ? t.controls?.enableKeyboard ?? !0 : !1, O = w(t) ? t.controls?.enableMouse ?? !0 : !1;
package/dist/editor.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("reflect-metadata");const e=require("./plugin-i8psdB12.cjs"),T=require("react"),S=require("@react-three/fiber"),I=require("three"),r=require("./index-HerLcjbR.cjs"),l=require("./gaesupStore-2zKBYTYo.cjs"),E=require("./loader-D7cEHkCq.cjs");function g(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(i,n,o.get?o:{enumerable:!0,get:()=>t[n]})}}return i.default=t,Object.freeze(i)}const _=g(I);var B=Object.defineProperty,D=Object.getOwnPropertyDescriptor,u=(t,i,n,o)=>{for(var d=D(i,n),s=t.length-1,c;s>=0;s--)(c=t[s])&&(d=c(i,n,d)||d);return d&&B(i,n,d),d};class a{static convertLegacyPosition(i){return{x:i[0],y:i[1],z:i[2]}}static convertLegacyRotation(i){return{x:i[0],y:i[1],z:i[2]}}static convertToLegacyPosition(i){return[i.x,i.y,i.z]}static convertToLegacyRotation(i){return[i.x,i.y,i.z]}static convertLegacyWall(i){return{id:i.id||`wall-${Date.now()}`,position:this.convertLegacyPosition(i.position),rotation:this.convertLegacyRotation(i.rotation),wallGroupId:i.wall_parent_id||"default",width:4,height:4,depth:.5}}static convertLegacyTile(i){return{id:i.id||`tile-${Date.now()}`,position:this.convertLegacyPosition(i.position),tileGroupId:i.tile_parent_id||"default",size:4}}static convertLegacyMesh(i){const n={id:i.id||`mesh-${Date.now()}`,color:i.color||"#ffffff",material:i.material==="GLASS"?"GLASS":"STANDARD",roughness:i.roughness||.5,metalness:i.metalness||0,opacity:i.opacity||1,transparent:i.transparent||!1};return i.map_texture_url&&(n.mapTextureUrl=i.map_texture_url),i.normal_texture_url&&(n.normalTextureUrl=i.normal_texture_url),n}}u([l.HandleError(),l.Profile()],a,"convertLegacyPosition");u([l.HandleError(),l.Profile()],a,"convertLegacyRotation");u([l.HandleError()],a,"convertToLegacyPosition");u([l.HandleError()],a,"convertToLegacyRotation");u([l.HandleError(),l.Profile()],a,"convertLegacyWall");u([l.HandleError(),l.Profile()],a,"convertLegacyTile");u([l.HandleError(),l.Profile()],a,"convertLegacyMesh");function L(){const t=T.useMemo(()=>({frustum:new _.Frustum,matrix:new _.Matrix4,camPos:new _.Vector3}),[]);return S.useFrame((i,n)=>{const o=i.camera;e.getGrassManager().size()!==0&&(t.matrix.multiplyMatrices(o.projectionMatrix,o.matrixWorldInverse),t.frustum.setFromProjectionMatrix(t.matrix),t.camPos.copy(o.position),e.getGrassManager().tick({elapsedTime:i.clock.elapsedTime,delta:n,cameraPosition:t.camPos,frustum:t.frustum}))}),null}exports.AnimationPanel=e.AnimationPanel;exports.Billboard=e.index;exports.BlockSystem=e.BlockSystem;exports.BuildingController=e.BuildingController;exports.BuildingGpuCullingDriver=e.BuildingGpuCullingDriver;exports.BuildingGpuMirrorDriver=e.BuildingGpuMirrorDriver;exports.BuildingGpuUploadDriver=e.BuildingGpuUploadDriver;exports.BuildingIndirectArgsUploadDriver=e.BuildingIndirectArgsUploadDriver;exports.BuildingIndirectDrawDriver=e.BuildingIndirectDrawDriver;exports.BuildingNavigationObstacleDriver=e.BuildingNavigationObstacleDriver;exports.BuildingPanel=e.BuildingPanel;exports.BuildingRenderStateDriver=e.BuildingRenderStateDriver;exports.BuildingSystem=e.BuildingSystem;exports.BuildingUI=e.BuildingUI;exports.BuildingVisibilityDriver=e.BuildingVisibilityDriver;exports.CameraPanel=e.CameraPanel;exports.DEFAULT_BUILDING_GRID_EXTENSION_ID=e.DEFAULT_BUILDING_GRID_EXTENSION_ID;exports.DEFAULT_BUILDING_OBJECT_CATALOG=e.DEFAULT_BUILDING_OBJECT_CATALOG;exports.DEFAULT_BUILDING_PLACEMENT_EXTENSION_ID=e.DEFAULT_BUILDING_PLACEMENT_EXTENSION_ID;exports.DEFAULT_BUILDING_SAVE_EXTENSION_ID=e.DEFAULT_BUILDING_SAVE_EXTENSION_ID;exports.DEFAULT_BUILDING_STORE_SERVICE_ID=e.DEFAULT_BUILDING_STORE_SERVICE_ID;exports.DRAW_CLUSTER_BILLBOARD=e.DRAW_CLUSTER_BILLBOARD;exports.DRAW_CLUSTER_BLOCK=e.DRAW_CLUSTER_BLOCK;exports.DRAW_CLUSTER_COUNT=e.DRAW_CLUSTER_COUNT;exports.DRAW_CLUSTER_DESCRIPTORS=e.DRAW_CLUSTER_DESCRIPTORS;exports.DRAW_CLUSTER_FIRE=e.DRAW_CLUSTER_FIRE;exports.DRAW_CLUSTER_FLAG=e.DRAW_CLUSTER_FLAG;exports.DRAW_CLUSTER_GRASS=e.DRAW_CLUSTER_GRASS;exports.DRAW_CLUSTER_MODEL=e.DRAW_CLUSTER_MODEL;exports.DRAW_CLUSTER_SAKURA=e.DRAW_CLUSTER_SAKURA;exports.DRAW_CLUSTER_SAND=e.DRAW_CLUSTER_SAND;exports.DRAW_CLUSTER_SNOWFIELD=e.DRAW_CLUSTER_SNOWFIELD;exports.DRAW_CLUSTER_TILE=e.DRAW_CLUSTER_TILE;exports.DRAW_CLUSTER_WALL=e.DRAW_CLUSTER_WALL;exports.DRAW_CLUSTER_WATER=e.DRAW_CLUSTER_WATER;exports.EDITOR_PANEL_COMPONENT_KIND=e.EDITOR_PANEL_COMPONENT_KIND;exports.Editor=e.Editor;exports.EditorLayout=e.EditorLayout;exports.Fire=e.index$1;exports.GPU_META_STRIDE=e.GPU_META_STRIDE;exports.GPU_SPATIAL_STRIDE=e.GPU_SPATIAL_STRIDE;exports.GameplayEventPanel=e.GameplayEventPanel;exports.Grass=e.Grass;exports.GridHelper=e.GridHelper;exports.INDIRECT_DRAW_STRIDE=e.INDIRECT_DRAW_STRIDE;exports.MotionPanel=e.MotionPanel;exports.PerformancePanel=e.PerformancePanel;exports.ResizablePanel=e.ResizablePanel;exports.Sakura=e.Sakura;exports.SakuraBatch=e.SakuraBatch;exports.Sand=e.Sand;exports.SandBatch=e.SandBatch;exports.Snow=e.Snow;exports.Snowfield=e.Snowfield;exports.SnowfieldBatch=e.SnowfieldBatch;exports.StudioPanel=e.StudioPanel;exports.TileSystem=e.TileSystem;exports.VehiclePanel=e.VehiclePanel;exports.WallSystem=e.WallSystem;exports.Water=e.Ocean;exports.applyBuildingNavigationObstacles=e.applyBuildingNavigationObstacles;exports.buildBuildingGpuMirror=e.buildBuildingGpuMirror;exports.buildBuildingIndirectDrawMirror=e.buildBuildingIndirectDrawMirror;exports.buildingPlugin=e.buildingPlugin;exports.createBuildingGpuUploadPlan=e.createBuildingGpuUploadPlan;exports.createBuildingIndirectDrawUploadPlan=e.createBuildingIndirectDrawUploadPlan;exports.createBuildingPlugin=e.createBuildingPlugin;exports.createBuildingScopeId=e.createBuildingScopeId;exports.createCustomMeshId=e.createCustomMeshId;exports.createEditorCommandStack=e.createEditorCommandStack;exports.createEditorShell=e.createEditorShell;exports.createEditorSlice=e.createEditorSlice;exports.createEmptyBuildingGpuUploadResources=e.createEmptyBuildingGpuUploadResources;exports.createEmptyBuildingIndirectDrawMirror=e.createEmptyBuildingIndirectDrawMirror;exports.createEmptyGpuMirror=e.createEmptyGpuMirror;exports.createTerrainBlockMaterial=e.createTerrainBlockMaterial;exports.destroyBuildingGpuUploadResources=e.destroyBuildingGpuUploadResources;exports.editorSlice=e.editorSlice;exports.findTerrainBlockMaterial=e.findTerrainBlockMaterial;exports.getDefaultBuildingObject=e.getDefaultBuildingObject;exports.getDrawClusterForSnapshotEntry=e.getDrawClusterForSnapshotEntry;exports.getGrassManager=e.getGrassManager;exports.getIndirectInstanceCount=e.getIndirectInstanceCount;exports.getWallMaterialKey=e.getWallMaterialKey;exports.getWebGPUDeviceFromRenderer=e.getWebGPUDeviceFromRenderer;exports.isEditorPanelComponentExtension=e.isEditorPanelComponentExtension;exports.parseBuildingGpuVisibilityFlags=e.parseBuildingGpuVisibilityFlags;exports.resolveEditorPanelComponentExtensions=e.resolveEditorPanelComponentExtensions;exports.syncBuildingGpuBuffers=e.syncBuildingGpuBuffers;exports.syncBuildingIndirectArgsBuffer=e.syncBuildingIndirectArgsBuffer;exports.useBuildingEditor=e.useBuildingEditor;exports.useBuildingGpuCullingStore=e.useBuildingGpuCullingStore;exports.useBuildingRenderStateStore=e.useBuildingRenderStateStore;exports.useBuildingVisibilityStore=e.useBuildingVisibilityStore;exports.useEditor=e.useEditor;exports.useEditorStore=e.useEditorStore;exports.BUILDING_BASIC_OBJECT_OPTIONS=r.BUILDING_BASIC_OBJECT_OPTIONS;exports.BUILDING_FLAG_STYLE_OPTIONS=r.BUILDING_FLAG_STYLE_OPTIONS;exports.BUILDING_PLACED_OBJECT_OPTIONS=r.BUILDING_PLACED_OBJECT_OPTIONS;exports.BUILDING_TILE_OBJECT_OPTIONS=r.BUILDING_TILE_OBJECT_OPTIONS;exports.BUILDING_TILE_PRESETS=r.BUILDING_TILE_PRESETS;exports.BUILDING_TILE_SHAPE_OPTIONS=r.BUILDING_TILE_SHAPE_OPTIONS;exports.BUILDING_TREE_COLOR_PRESETS=r.BUILDING_TREE_COLOR_PRESETS;exports.BUILDING_TREE_OPTIONS=r.BUILDING_TREE_OPTIONS;exports.BUILDING_WALL_KIND_OPTIONS=r.BUILDING_WALL_KIND_OPTIONS;exports.BUILDING_WALL_PRESETS=r.BUILDING_WALL_PRESETS;exports.BUILDING_WEATHER_EFFECT_OPTIONS=r.BUILDING_WEATHER_EFFECT_OPTIONS;exports.FLAG_STYLE_META=r.FLAG_STYLE_META;exports.blockToPlacementEntry=r.blockToPlacementEntry;exports.buildingCellToWorld=r.buildingCellToWorld;exports.buildingGridAdapter=r.buildingGridAdapter;exports.buildingGroupsToPlacementEntries=r.buildingGroupsToPlacementEntries;exports.buildingPlacementAdapter=r.buildingPlacementAdapter;exports.cellToTilePosition=r.cellToTilePosition;exports.createBlockFootprint=r.createBlockFootprint;exports.createBuildingPlacementEngine=r.createBuildingPlacementEngine;exports.createTileFootprint=r.createTileFootprint;exports.edgeKey=r.edgeKey;exports.edgeSideToWallRotation=r.edgeSideToWallRotation;exports.edgeToWallTransform=r.edgeToWallTransform;exports.getTileSupportHeight=r.getTileSupportHeight;exports.hasTileCollision=r.hasTileCollision;exports.hasWallCollision=r.hasWallCollision;exports.indexAabb=r.indexAabb;exports.normalizeQuarterTurnRotation=r.normalizeQuarterTurnRotation;exports.pair=r.pair;exports.queryAabbIds=r.queryAabbIds;exports.snapBuildingPosition=r.snapBuildingPosition;exports.tileFootprintKeys=r.tileFootprintKeys;exports.tileGroupToPlacementEntries=r.tileGroupToPlacementEntries;exports.tileHalfSize=r.tileHalfSize;exports.tileOverlaps=r.tileOverlaps;exports.tilePositionToCell=r.tilePositionToCell;exports.tileToPlacementEntry=r.tileToPlacementEntry;exports.unindexId=r.unindexId;exports.useBuildingStore=r.useBuildingStore;exports.wallGroupToPlacementEntries=r.wallGroupToPlacementEntries;exports.wallToPlacementEntry=r.wallToPlacementEntry;exports.wallTransformToEdge=r.wallTransformToEdge;exports.worldToBuildingCell=r.worldToBuildingCell;exports.zigZag=r.zigZag;exports.CONTENT_SCHEMA_VERSION=E.CONTENT_SCHEMA_VERSION;exports.HttpContentBundleSource=E.HttpContentBundleSource;exports.createContentBundleFromSaveSystem=E.createContentBundleFromSaveSystem;exports.loadContentBundleFromManifest=E.loadContentBundleFromManifest;exports.validateContentBundle=E.validateContentBundle;exports.validateContentBundleManifest=E.validateContentBundleManifest;exports.BuildingBridge=a;exports.GrassDriver=L;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("reflect-metadata");const e=require("./plugin-Dd_BwYh3.cjs"),T=require("react"),S=require("@react-three/fiber"),I=require("three"),r=require("./index-KD0DiwVP.cjs"),l=require("./gaesupStore-2zKBYTYo.cjs"),E=require("./loader-D7cEHkCq.cjs");function g(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(i,n,o.get?o:{enumerable:!0,get:()=>t[n]})}}return i.default=t,Object.freeze(i)}const _=g(I);var B=Object.defineProperty,D=Object.getOwnPropertyDescriptor,u=(t,i,n,o)=>{for(var d=D(i,n),s=t.length-1,c;s>=0;s--)(c=t[s])&&(d=c(i,n,d)||d);return d&&B(i,n,d),d};class a{static convertLegacyPosition(i){return{x:i[0],y:i[1],z:i[2]}}static convertLegacyRotation(i){return{x:i[0],y:i[1],z:i[2]}}static convertToLegacyPosition(i){return[i.x,i.y,i.z]}static convertToLegacyRotation(i){return[i.x,i.y,i.z]}static convertLegacyWall(i){return{id:i.id||`wall-${Date.now()}`,position:this.convertLegacyPosition(i.position),rotation:this.convertLegacyRotation(i.rotation),wallGroupId:i.wall_parent_id||"default",width:4,height:4,depth:.5}}static convertLegacyTile(i){return{id:i.id||`tile-${Date.now()}`,position:this.convertLegacyPosition(i.position),tileGroupId:i.tile_parent_id||"default",size:4}}static convertLegacyMesh(i){const n={id:i.id||`mesh-${Date.now()}`,color:i.color||"#ffffff",material:i.material==="GLASS"?"GLASS":"STANDARD",roughness:i.roughness||.5,metalness:i.metalness||0,opacity:i.opacity||1,transparent:i.transparent||!1};return i.map_texture_url&&(n.mapTextureUrl=i.map_texture_url),i.normal_texture_url&&(n.normalTextureUrl=i.normal_texture_url),n}}u([l.HandleError(),l.Profile()],a,"convertLegacyPosition");u([l.HandleError(),l.Profile()],a,"convertLegacyRotation");u([l.HandleError()],a,"convertToLegacyPosition");u([l.HandleError()],a,"convertToLegacyRotation");u([l.HandleError(),l.Profile()],a,"convertLegacyWall");u([l.HandleError(),l.Profile()],a,"convertLegacyTile");u([l.HandleError(),l.Profile()],a,"convertLegacyMesh");function L(){const t=T.useMemo(()=>({frustum:new _.Frustum,matrix:new _.Matrix4,camPos:new _.Vector3}),[]);return S.useFrame((i,n)=>{const o=i.camera;e.getGrassManager().size()!==0&&(t.matrix.multiplyMatrices(o.projectionMatrix,o.matrixWorldInverse),t.frustum.setFromProjectionMatrix(t.matrix),t.camPos.copy(o.position),e.getGrassManager().tick({elapsedTime:i.clock.elapsedTime,delta:n,cameraPosition:t.camPos,frustum:t.frustum}))}),null}exports.AnimationPanel=e.AnimationPanel;exports.Billboard=e.index;exports.BlockSystem=e.BlockSystem;exports.BuildingController=e.BuildingController;exports.BuildingGpuCullingDriver=e.BuildingGpuCullingDriver;exports.BuildingGpuMirrorDriver=e.BuildingGpuMirrorDriver;exports.BuildingGpuUploadDriver=e.BuildingGpuUploadDriver;exports.BuildingIndirectArgsUploadDriver=e.BuildingIndirectArgsUploadDriver;exports.BuildingIndirectDrawDriver=e.BuildingIndirectDrawDriver;exports.BuildingNavigationObstacleDriver=e.BuildingNavigationObstacleDriver;exports.BuildingPanel=e.BuildingPanel;exports.BuildingRenderStateDriver=e.BuildingRenderStateDriver;exports.BuildingSystem=e.BuildingSystem;exports.BuildingUI=e.BuildingUI;exports.BuildingVisibilityDriver=e.BuildingVisibilityDriver;exports.CameraPanel=e.CameraPanel;exports.DEFAULT_BUILDING_GRID_EXTENSION_ID=e.DEFAULT_BUILDING_GRID_EXTENSION_ID;exports.DEFAULT_BUILDING_OBJECT_CATALOG=e.DEFAULT_BUILDING_OBJECT_CATALOG;exports.DEFAULT_BUILDING_PLACEMENT_EXTENSION_ID=e.DEFAULT_BUILDING_PLACEMENT_EXTENSION_ID;exports.DEFAULT_BUILDING_SAVE_EXTENSION_ID=e.DEFAULT_BUILDING_SAVE_EXTENSION_ID;exports.DEFAULT_BUILDING_STORE_SERVICE_ID=e.DEFAULT_BUILDING_STORE_SERVICE_ID;exports.DRAW_CLUSTER_BILLBOARD=e.DRAW_CLUSTER_BILLBOARD;exports.DRAW_CLUSTER_BLOCK=e.DRAW_CLUSTER_BLOCK;exports.DRAW_CLUSTER_COUNT=e.DRAW_CLUSTER_COUNT;exports.DRAW_CLUSTER_DESCRIPTORS=e.DRAW_CLUSTER_DESCRIPTORS;exports.DRAW_CLUSTER_FIRE=e.DRAW_CLUSTER_FIRE;exports.DRAW_CLUSTER_FLAG=e.DRAW_CLUSTER_FLAG;exports.DRAW_CLUSTER_GRASS=e.DRAW_CLUSTER_GRASS;exports.DRAW_CLUSTER_MODEL=e.DRAW_CLUSTER_MODEL;exports.DRAW_CLUSTER_SAKURA=e.DRAW_CLUSTER_SAKURA;exports.DRAW_CLUSTER_SAND=e.DRAW_CLUSTER_SAND;exports.DRAW_CLUSTER_SNOWFIELD=e.DRAW_CLUSTER_SNOWFIELD;exports.DRAW_CLUSTER_TILE=e.DRAW_CLUSTER_TILE;exports.DRAW_CLUSTER_WALL=e.DRAW_CLUSTER_WALL;exports.DRAW_CLUSTER_WATER=e.DRAW_CLUSTER_WATER;exports.EDITOR_PANEL_COMPONENT_KIND=e.EDITOR_PANEL_COMPONENT_KIND;exports.Editor=e.Editor;exports.EditorLayout=e.EditorLayout;exports.Fire=e.index$1;exports.GPU_META_STRIDE=e.GPU_META_STRIDE;exports.GPU_SPATIAL_STRIDE=e.GPU_SPATIAL_STRIDE;exports.GameplayEventPanel=e.GameplayEventPanel;exports.Grass=e.Grass;exports.GridHelper=e.GridHelper;exports.INDIRECT_DRAW_STRIDE=e.INDIRECT_DRAW_STRIDE;exports.MotionPanel=e.MotionPanel;exports.PerformancePanel=e.PerformancePanel;exports.ResizablePanel=e.ResizablePanel;exports.Sakura=e.Sakura;exports.SakuraBatch=e.SakuraBatch;exports.Sand=e.Sand;exports.SandBatch=e.SandBatch;exports.Snow=e.Snow;exports.Snowfield=e.Snowfield;exports.SnowfieldBatch=e.SnowfieldBatch;exports.StudioPanel=e.StudioPanel;exports.TileSystem=e.TileSystem;exports.VehiclePanel=e.VehiclePanel;exports.WallSystem=e.WallSystem;exports.Water=e.Ocean;exports.applyBuildingNavigationObstacles=e.applyBuildingNavigationObstacles;exports.buildBuildingGpuMirror=e.buildBuildingGpuMirror;exports.buildBuildingIndirectDrawMirror=e.buildBuildingIndirectDrawMirror;exports.buildingPlugin=e.buildingPlugin;exports.createBuildingGpuUploadPlan=e.createBuildingGpuUploadPlan;exports.createBuildingIndirectDrawUploadPlan=e.createBuildingIndirectDrawUploadPlan;exports.createBuildingPlugin=e.createBuildingPlugin;exports.createBuildingScopeId=e.createBuildingScopeId;exports.createCustomMeshId=e.createCustomMeshId;exports.createEditorCommandStack=e.createEditorCommandStack;exports.createEditorShell=e.createEditorShell;exports.createEditorSlice=e.createEditorSlice;exports.createEmptyBuildingGpuUploadResources=e.createEmptyBuildingGpuUploadResources;exports.createEmptyBuildingIndirectDrawMirror=e.createEmptyBuildingIndirectDrawMirror;exports.createEmptyGpuMirror=e.createEmptyGpuMirror;exports.createTerrainBlockMaterial=e.createTerrainBlockMaterial;exports.destroyBuildingGpuUploadResources=e.destroyBuildingGpuUploadResources;exports.editorSlice=e.editorSlice;exports.findTerrainBlockMaterial=e.findTerrainBlockMaterial;exports.getDefaultBuildingObject=e.getDefaultBuildingObject;exports.getDrawClusterForSnapshotEntry=e.getDrawClusterForSnapshotEntry;exports.getGrassManager=e.getGrassManager;exports.getIndirectInstanceCount=e.getIndirectInstanceCount;exports.getWallMaterialKey=e.getWallMaterialKey;exports.getWebGPUDeviceFromRenderer=e.getWebGPUDeviceFromRenderer;exports.isEditorPanelComponentExtension=e.isEditorPanelComponentExtension;exports.parseBuildingGpuVisibilityFlags=e.parseBuildingGpuVisibilityFlags;exports.resolveEditorPanelComponentExtensions=e.resolveEditorPanelComponentExtensions;exports.syncBuildingGpuBuffers=e.syncBuildingGpuBuffers;exports.syncBuildingIndirectArgsBuffer=e.syncBuildingIndirectArgsBuffer;exports.useBuildingEditor=e.useBuildingEditor;exports.useBuildingGpuCullingStore=e.useBuildingGpuCullingStore;exports.useBuildingRenderStateStore=e.useBuildingRenderStateStore;exports.useBuildingVisibilityStore=e.useBuildingVisibilityStore;exports.useEditor=e.useEditor;exports.useEditorStore=e.useEditorStore;exports.BUILDING_BASIC_OBJECT_OPTIONS=r.BUILDING_BASIC_OBJECT_OPTIONS;exports.BUILDING_FLAG_STYLE_OPTIONS=r.BUILDING_FLAG_STYLE_OPTIONS;exports.BUILDING_PLACED_OBJECT_OPTIONS=r.BUILDING_PLACED_OBJECT_OPTIONS;exports.BUILDING_TILE_OBJECT_OPTIONS=r.BUILDING_TILE_OBJECT_OPTIONS;exports.BUILDING_TILE_PRESETS=r.BUILDING_TILE_PRESETS;exports.BUILDING_TILE_SHAPE_OPTIONS=r.BUILDING_TILE_SHAPE_OPTIONS;exports.BUILDING_TREE_COLOR_PRESETS=r.BUILDING_TREE_COLOR_PRESETS;exports.BUILDING_TREE_OPTIONS=r.BUILDING_TREE_OPTIONS;exports.BUILDING_WALL_KIND_OPTIONS=r.BUILDING_WALL_KIND_OPTIONS;exports.BUILDING_WALL_PRESETS=r.BUILDING_WALL_PRESETS;exports.BUILDING_WEATHER_EFFECT_OPTIONS=r.BUILDING_WEATHER_EFFECT_OPTIONS;exports.FLAG_STYLE_META=r.FLAG_STYLE_META;exports.blockToPlacementEntry=r.blockToPlacementEntry;exports.buildingCellToWorld=r.buildingCellToWorld;exports.buildingGridAdapter=r.buildingGridAdapter;exports.buildingGroupsToPlacementEntries=r.buildingGroupsToPlacementEntries;exports.buildingPlacementAdapter=r.buildingPlacementAdapter;exports.cellToTilePosition=r.cellToTilePosition;exports.createBlockFootprint=r.createBlockFootprint;exports.createBuildingPlacementEngine=r.createBuildingPlacementEngine;exports.createTileFootprint=r.createTileFootprint;exports.edgeKey=r.edgeKey;exports.edgeSideToWallRotation=r.edgeSideToWallRotation;exports.edgeToWallTransform=r.edgeToWallTransform;exports.getTileSupportHeight=r.getTileSupportHeight;exports.hasTileCollision=r.hasTileCollision;exports.hasWallCollision=r.hasWallCollision;exports.indexAabb=r.indexAabb;exports.normalizeQuarterTurnRotation=r.normalizeQuarterTurnRotation;exports.pair=r.pair;exports.queryAabbIds=r.queryAabbIds;exports.snapBuildingPosition=r.snapBuildingPosition;exports.tileFootprintKeys=r.tileFootprintKeys;exports.tileGroupToPlacementEntries=r.tileGroupToPlacementEntries;exports.tileHalfSize=r.tileHalfSize;exports.tileOverlaps=r.tileOverlaps;exports.tilePositionToCell=r.tilePositionToCell;exports.tileToPlacementEntry=r.tileToPlacementEntry;exports.unindexId=r.unindexId;exports.useBuildingStore=r.useBuildingStore;exports.wallGroupToPlacementEntries=r.wallGroupToPlacementEntries;exports.wallToPlacementEntry=r.wallToPlacementEntry;exports.wallTransformToEdge=r.wallTransformToEdge;exports.worldToBuildingCell=r.worldToBuildingCell;exports.zigZag=r.zigZag;exports.CONTENT_SCHEMA_VERSION=E.CONTENT_SCHEMA_VERSION;exports.HttpContentBundleSource=E.HttpContentBundleSource;exports.createContentBundleFromSaveSystem=E.createContentBundleFromSaveSystem;exports.loadContentBundleFromManifest=E.loadContentBundleFromManifest;exports.validateContentBundle=E.validateContentBundle;exports.validateContentBundleManifest=E.validateContentBundleManifest;exports.BuildingBridge=a;exports.GrassDriver=L;
package/dist/editor.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import "reflect-metadata";
2
- import { g as _ } from "./plugin-DCJd5Ocw.js";
3
- import { A, s as C, y as G, w as U, F as f, z as N, D as O, I as v, H as y, K as W, B as x, x as w, v as F, U as b, J as h, C as M, _ as z, X as H, $ as k, a0 as K, a1 as V, ac as j, ad as J, ae as q, a8 as X, af as $, ag as Q, ah as Y, ai as Z, aj as aa, ak as ea, al as ia, am as ta, an as ra, ao as sa, E as na, a as oa, b as la, t as ua, aq as da, ap as ca, G as _a, q as Ea, N as Ta, a6 as Sa, M as Ia, P as La, R as ma, j as Da, k as pa, l as Ba, m as ga, p as Ra, n as Pa, o as Aa, S as Ca, T as Ga, V as Ua, W as fa, O as Na, a4 as Oa, as as va, aa as ya, a3 as Wa, at as xa, ab as wa, a2 as Fa, Z as ba, Q as ha, c as Ma, d as za, h as Ha, ax as ka, a9 as Ka, ar as Va, aD as ja, az as Ja, e as qa, aE as Xa, Y as $a, au as Qa, a7 as Ya, L as Za, ay as ae, i as ee, av as ie, r as te, aA as re, aB as se, aF as ne, aw as oe, a5 as le, aC as ue, u as de, f as ce } from "./plugin-DCJd5Ocw.js";
2
+ import { g as _ } from "./plugin-Bt4zuKQx.js";
3
+ import { A, s as C, y as G, w as U, F as f, z as N, D as O, I as v, H as y, K as W, B as x, x as w, v as F, U as b, J as h, C as M, _ as z, X as H, $ as k, a0 as K, a1 as V, ac as j, ad as J, ae as q, a8 as X, af as $, ag as Q, ah as Y, ai as Z, aj as aa, ak as ea, al as ia, am as ta, an as ra, ao as sa, E as na, a as oa, b as la, t as ua, aq as da, ap as ca, G as _a, q as Ea, N as Ta, a6 as Sa, M as Ia, P as La, R as ma, j as Da, k as pa, l as Ba, m as ga, p as Ra, n as Pa, o as Aa, S as Ca, T as Ga, V as Ua, W as fa, O as Na, a4 as Oa, as as va, aa as ya, a3 as Wa, at as xa, ab as wa, a2 as Fa, Z as ba, Q as ha, c as Ma, d as za, h as Ha, ax as ka, a9 as Ka, ar as Va, aD as ja, az as Ja, e as qa, aE as Xa, Y as $a, au as Qa, a7 as Ya, L as Za, ay as ae, i as ee, av as ie, r as te, aA as re, aB as se, aF as ne, aw as oe, a5 as le, aC as ue, u as de, f as ce } from "./plugin-Bt4zuKQx.js";
4
4
  import { useMemo as E } from "react";
5
5
  import { useFrame as T } from "@react-three/fiber";
6
6
  import * as d from "three";
7
- import { Q as Ee, S as Te, R as Se, O as Ie, L as Le, P as me, N as De, M as pe, I as Be, K as ge, H as Re, J as Pe, a as Ae, b as Ce, e as Ge, d as Ue, f as fe, n as Ne, o as Oe, c as ve, r as ye, g as We, h as xe, i as we, j as Fe, k as be, l as he, m as Me, F as ze, p as He, q as ke, s as Ke, u as Ve, t as je, v as Je, w as qe, x as Xe, y as $e, z as Qe, G as Ye, A as Ze, B as ai, C as ei, D as ii, E as ti } from "./index-DKEZe9SJ.js";
7
+ import { Q as Ee, S as Te, R as Se, O as Ie, L as Le, P as me, N as De, M as pe, I as Be, K as ge, H as Re, J as Pe, a as Ae, b as Ce, e as Ge, d as Ue, f as fe, n as Ne, o as Oe, c as ve, r as ye, g as We, h as xe, i as we, j as Fe, k as be, l as he, m as Me, F as ze, p as He, q as ke, s as Ke, u as Ve, t as je, v as Je, w as qe, x as Xe, y as $e, z as Qe, G as Ye, A as Ze, B as ai, C as ei, D as ii, E as ti } from "./index-BcoQ669j.js";
8
8
  import { H as t, P as o } from "./gaesupStore-DTu0tYBp.js";
9
9
  import { C as si, H as ni, c as oi, l as li, v as ui, a as di } from "./loader-C3ZwumCe.js";
10
10
  var S = Object.defineProperty, I = Object.getOwnPropertyDescriptor, r = (e, a, i, l) => {
@@ -0,0 +1 @@
1
+ "use strict";const u=require("react"),j=require("@react-three/fiber"),rt=require("three"),q=require("./index-KD0DiwVP.cjs"),C=require("./gaesupStore-2zKBYTYo.cjs");require("reflect-metadata");const at=require("mitt");function ct(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const a=ct(rt);var lt=Object.defineProperty,ut=Object.getOwnPropertyDescriptor,H=(o,e,t,i)=>{for(var n=ut(e,t),r=o.length-1,c;r>=0;r--)(c=o[r])&&(n=c(e,t,n)||n);return n&&lt(e,t,n),n};function _(o){return{...o,distance:{...o.distance},smoothing:{...o.smoothing},...o.focusTarget?{focusTarget:{...o.focusTarget}}:{},...o.offset?{offset:{...o.offset}}:{},...o.lookAt?{lookAt:{...o.lookAt}}:{}}}class I{emitter;config;metrics={frameCount:0,totalFrameTime:0,lastUpdateTime:0};constructor(e){this.emitter=at(),this.config=_(e)}updateConfig(e){const t={...this.config};this.config=_({...this.config,...e}),Object.keys(e).forEach(i=>{this.emitter.emit("configChange",{key:i,value:e[i]})}),t.mode!==this.config.mode&&this.emitter.emit("modeChange",{from:t.mode,to:this.config.mode})}getConfig(){return _(this.config)}getState(){return{config:this.getConfig(),metrics:this.getMetrics()}}getMetrics(){return{frameCount:this.metrics.frameCount,averageFrameTime:this.metrics.frameCount>0?this.metrics.totalFrameTime/this.metrics.frameCount:0,lastUpdateTime:this.metrics.lastUpdateTime}}trackFrameMetrics(e){this.metrics.frameCount++,this.metrics.totalFrameTime+=e,this.metrics.lastUpdateTime=Date.now()}emitError(e,t){this.emitter.emit("error",{message:e,details:t})}destroy(){this.emitter.all.clear()}}H([C.HandleError()],I.prototype,"updateConfig");H([C.Profile()],I.prototype,"trackFrameMetrics");H([C.HandleError()],I.prototype,"destroy");const D=new a.Vector3,B=new a.Vector3,ft=new a.Quaternion,mt=new a.Matrix4,G=new a.Quaternion,R=new a.Vector3,A=new a.Raycaster,U=[],K=new a.Vector3,$=new a.Vector3,dt=new a.Vector3,ht=new a.Euler,gt=new a.Vector3,pt=new a.Vector3;new a.Vector3;let Z=[],J=null,W=-1;function tt(o){const e=[];return o.traverse(t=>{t instanceof a.Mesh&&!t.userData.intangible&&t.geometry?.boundingSphere&&e.push(t)}),e}function yt(o){const e=o._frameId;return e===void 0?tt(o):(o===J&&e-W<60||(J=o,W=e,Z=tt(o)),Z)}function vt(o,e){if(!e||e.length===0)return!1;let t=o;for(;t;){for(let i=0,n=e.length;i<n;i++)if(t===e[i])return!0;t=t.parent}return!1}const v={tempVectors:{temp1:new a.Vector3,temp2:new a.Vector3,temp3:new a.Vector3},clampValue:(o,e,t)=>Math.max(e,Math.min(t,o)),smoothingToSpeed:(o,e=C.CAMERA_CONSTANTS.FRAME_RATE_LERP_SPEED)=>{if(o===void 0||!Number.isFinite(o))return e;if(o<=0)return 0;if(o>=1)return o;const t=v.clampValue(o,.001,.999);return-Math.log(1-t)*60},frameRateIndependentLerpVector3:(o,e,t,i)=>{const n=1-Math.exp(-t*i);o.lerp(e,n)},smoothLookAt:(o,e,t,i)=>{const n=ft.setFromRotationMatrix(mt.lookAt(o.position,e,o.up)).normalize();G.copy(o.quaternion).normalize(),G.dot(n)<0&&(n.x*=-1,n.y*=-1,n.z*=-1,n.w*=-1);const r=1-Math.exp(-t*i);o.quaternion.slerp(n,r).normalize()},preventCameraJitter:(o,e,t,i,n,r=i*.8)=>{v.frameRateIndependentLerpVector3(o.position,e,i,n),v.smoothLookAt(o,t,r,n)},improvedCollisionCheck:(o,e,t,i=.5,n)=>{R.subVectors(e,o);const r=R.length();if(r<=0)return{safe:!0,position:e,obstacles:[]};R.multiplyScalar(1/r),A.set(o,R),A.near=0,A.far=r;const c=[],l=yt(t);for(let d=0,S=l.length;d<S;d++){const w=l[d];if(!w||vt(w,n))continue;U.length=0,A.intersectObject(w,!1,U);const g=U[0];g&&c.push({object:w,distance:g.distance,point:g.point})}if(c.length===0)return{safe:!0,position:e,obstacles:[]};const m=c.reduce((d,S)=>S.distance<d.distance?S:d);return K.copy(o).addScaledVector(R,Math.max(0,m.distance-i)),$.copy(K),{safe:!1,position:$,obstacles:c}},distanceSquared:(o,e)=>D.subVectors(o,e).lengthSq(),safeNormalize:o=>{const e=o.length();return e>0?o.divideScalar(e):o.set(0,0,0)},smoothDamp:(o,e,t,i,n,r)=>{const c=2/i,l=c*n,m=1/(1+l+.48*l*l+.235*l*l*l);D.subVectors(o,e);const d=r?r*i:1/0;D.clampLength(0,d),B.copy(t).addScaledVector(D,c).multiplyScalar(n),t.copy(t).sub(B).multiplyScalar(m),o.copy(e).add(D.add(B).multiplyScalar(m))},calculateBounds:(o,e,t)=>{if(!t)return o;const i=t.minX!==void 0?Math.max(t.minX,o.x):o.x,n=t.minY!==void 0?Math.max(t.minY,o.y):o.y,r=t.minZ!==void 0?Math.max(t.minZ,o.z):o.z,c=t.maxX!==void 0?Math.min(t.maxX,i):i,l=t.maxY!==void 0?Math.min(t.maxY,n):n,m=t.maxZ!==void 0?Math.min(t.maxZ,r):r;return D.set(c,l,m)},fastAtan2:(o,e)=>e===0?o>0?Math.PI/2:o<0?-Math.PI/2:0:e>0?Math.atan(o/e):Math.atan(o/e)+(o>=0?Math.PI:-Math.PI),updateFOV:(o,e,t,i)=>{if(!t||t<=0){if(Math.abs(e-o.fov)<1e-4)return;o.fov=e,o.updateProjectionMatrix();return}const n=i===void 0?t:1-Math.exp(-v.smoothingToSpeed(t)*i),r=n>=1?e:a.MathUtils.lerp(o.fov,e,n);Math.abs(r-o.fov)<1e-4||(o.fov=r,o.updateProjectionMatrix())},clampPosition:(o,e)=>(e&&(o.y=v.clampValue(o.y,e.minY||-1/0,e.maxY||1/0)),o),isPositionEqual:(o,e,t=.001)=>Math.abs(o.x-e.x)<t&&Math.abs(o.y-e.y)<t&&Math.abs(o.z-e.z)<t,pool:{vectors:[],getVector3:()=>v.pool.vectors.pop()||new a.Vector3,releaseVector3:o=>{o.set(0,0,0),v.pool.vectors.push(o)}},calculateSafeDistance:(o,e,t,i)=>{const n=o.distanceTo(e);return a.MathUtils.clamp(n,t,i)},isPositionValid:(o,e)=>e?o.y>=(e.minY??-1/0)&&o.y<=(e.maxY??1/0):!0},y={getPosition:o=>o?.position?o.position:dt.set(0,0,0),getEuler:o=>o?.euler?o.euler:ht.set(0,0,0),getVelocity:o=>o?.velocity?o.velocity:gt.set(0,0,0),calculateCameraOffset:(o,e,t)=>{const{xDistance:i=15,yDistance:n=8,zDistance:r=15,euler:c,mode:l="thirdPerson"}=e,m=t??pt;switch(l){case"chase":if(c){const d=1/Math.SQRT2;return m.set(-i*Math.sin(c.y)*d,n*d,-r*Math.cos(c.y)*d)}return m.set(-i,n,-r);case"thirdPerson":default:return m.set(-i,n,-r)}},getCameraTarget:(o,e)=>{const t=y.getPosition(o);return e.target||t}};var wt=Object.defineProperty,Ct=Object.getOwnPropertyDescriptor,it=(o,e,t,i)=>{for(var n=Ct(e,t),r=o.length-1,c;r>=0;r--)(c=o[r])&&(n=c(e,t,n)||n);return n&&wt(e,t,n),n};class P{focusTarget=new a.Vector3;focusDirection=new a.Vector3;focusBasePosition=new a.Vector3;focusTargetPosition=new a.Vector3;orbitRight=new a.Vector3;orbitYawQuaternion=new a.Quaternion;orbitPitchQuaternion=new a.Quaternion;xAxis=new a.Vector3(1,0,0);yAxis=new a.Vector3(0,1,0);applyDefaults(e){const t=this.defaultConfig,i=e.config;if(t.enableCollision!==void 0&&i.enableCollision===void 0&&(i.enableCollision=t.enableCollision),t.distance){const n=i.distance;n?(n.x===void 0&&t.distance.x!==void 0&&(n.x=t.distance.x),n.y===void 0&&t.distance.y!==void 0&&(n.y=t.distance.y),n.z===void 0&&t.distance.z!==void 0&&(n.z=t.distance.z)):i.distance={...t.distance}}if(t.smoothing){const n=i.smoothing;n?(n.position===void 0&&t.smoothing.position!==void 0&&(n.position=t.smoothing.position),n.rotation===void 0&&t.smoothing.rotation!==void 0&&(n.rotation=t.smoothing.rotation),n.fov===void 0&&t.smoothing.fov!==void 0&&(n.fov=t.smoothing.fov)):i.smoothing={...t.smoothing}}}calculateLookAt(e,t){return y.getPosition(e.activeState)}applyOrbitOffset(e,t){const i=t.config.orbitYaw??0,n=t.config.orbitPitch??0;return i===0&&n===0||(i!==0&&(this.orbitYawQuaternion.setFromAxisAngle(this.yAxis,i),e.applyQuaternion(this.orbitYawQuaternion)),n!==0&&(this.orbitRight.crossVectors(e,this.yAxis),this.orbitRight.lengthSq()<=1e-6?this.orbitRight.copy(this.xAxis):this.orbitRight.normalize(),this.orbitPitchQuaternion.setFromAxisAngle(this.orbitRight,n),e.applyQuaternion(this.orbitPitchQuaternion))),e}update(e,t){const{camera:i,deltaTime:n,activeState:r}=e;if(!r)return;this.applyDefaults(t);const c=t.config;let l,m;if(c.focus&&c.focusTarget){const g=this.focusTarget;g.set(c.focusTarget.x,c.focusTarget.y,c.focusTarget.z),m=g;const z=c.focusDistance||10,E=this.focusBasePosition.copy(this.calculateTargetPosition(e,t)),p=this.focusDirection;p.copy(E).sub(g),p.lengthSq()===0&&p.copy(i.position).sub(g),p.lengthSq()===0&&p.set(1,1,1),p.normalize(),l=this.focusTargetPosition.copy(g).addScaledVector(p,z)}else l=this.calculateTargetPosition(e,t),m=this.calculateLookAt(e,t);c.enableCollision&&(l=v.improvedCollisionCheck(m,l,e.scene,c.collisionMargin??.5,e.excludeObjects).position);const d=c.focusLerpSpeed||10,S=c.focus?d:v.smoothingToSpeed(c.smoothing?.position),w=c.focus?d*.8:v.smoothingToSpeed(c.smoothing?.rotation,S*.8);v.preventCameraJitter(i,l,m,S,n,w),t.config.fov&&i instanceof a.PerspectiveCamera&&v.updateFOV(i,t.config.fov,t.config.smoothing?.fov,n)}}it([C.Profile()],P.prototype,"calculateLookAt");it([C.HandleError(),C.Profile()],P.prototype,"update");class xt extends P{name="thirdPerson";target=new a.Vector3;offset=new a.Vector3;defaultConfig={distance:{x:15,y:8,z:15},smoothing:{position:.1,rotation:.1,fov:.1},enableCollision:!0};calculateTargetPosition(e,t){const i=y.getPosition(e.activeState),n=t.config.zoom||1;return y.calculateCameraOffset(i,{xDistance:t.config.distance.x*n,yDistance:t.config.distance.y*n,zDistance:t.config.distance.z*n,mode:"thirdPerson"},this.offset),this.applyOrbitOffset(this.offset,t),this.target.copy(i).add(this.offset)}}class bt extends P{name="firstPerson";target=new a.Vector3;lookAt=new a.Vector3;lookDirection=new a.Vector3;eyePosition=new a.Vector3;defaultConfig={distance:{x:0,y:2,z:.45},smoothing:{position:.2,rotation:.15,fov:.1},enableCollision:!1};calculateTargetPosition(e,t){const i=y.getPosition(e.activeState),n=y.getEuler(e.activeState),r=t.config.distance.y||this.defaultConfig.distance?.y||2,c=t.config.distance.z||this.defaultConfig.distance?.z||.45,l=this.lookDirection.set(0,0,-1);return n&&l.applyEuler(n),this.target.set(i.x,i.y+r,i.z).addScaledVector(l,c)}calculateLookAt(e,t){const i=this.eyePosition.copy(this.calculateTargetPosition(e,t)),n=y.getEuler(e.activeState),r=this.lookDirection.set(0,0,-1);return n&&r.applyEuler(n),this.lookAt.copy(i).add(r)}}class St extends P{name="chase";target=new a.Vector3;offset=new a.Vector3;defaultConfig={distance:{x:10,y:5,z:10},smoothing:{position:.15,rotation:.1,fov:.1},enableCollision:!0};calculateTargetPosition(e,t){const i=y.getPosition(e.activeState),n=y.getEuler(e.activeState),r=t.config.zoom||-1;return y.calculateCameraOffset(i,{xDistance:t.config.distance.x*r,yDistance:t.config.distance.y*r,zDistance:t.config.distance.z*r,euler:n,mode:"chase"},this.offset),this.applyOrbitOffset(this.offset,t),this.target.copy(i).add(this.offset)}}class Pt extends P{name="topDown";target=new a.Vector3;offset=new a.Vector3;yawQuaternion=new a.Quaternion;pitchQuaternion=new a.Quaternion;topDownXAxis=new a.Vector3(1,0,0);topDownYAxis=new a.Vector3(0,1,0);defaultConfig={distance:{x:0,y:20,z:0},smoothing:{position:.1,rotation:.1,fov:.1},enableCollision:!1};calculateTargetPosition(e,t){const i=y.getPosition(e.activeState),n=t.config.zoom||1,r=this.offset.set(0,t.config.distance.y*n,0),c=t.config.orbitPitch??0,l=t.config.orbitYaw??0;return c!==0&&(this.pitchQuaternion.setFromAxisAngle(this.topDownXAxis,c),r.applyQuaternion(this.pitchQuaternion)),l!==0&&(this.yawQuaternion.setFromAxisAngle(this.topDownYAxis,l),r.applyQuaternion(this.yawQuaternion)),this.target.copy(i).add(r)}}class Mt extends P{name="isometric";target=new a.Vector3;defaultConfig={distance:{x:15,y:15,z:15},smoothing:{position:.1,rotation:.1,fov:.1},enableCollision:!1};calculateTargetPosition(e,t){const i=y.getPosition(e.activeState),n=Math.PI/4,r=Math.sqrt(t.config.distance.x**2+t.config.distance.z**2);return this.target.set(i.x+Math.cos(n)*r,i.y+t.config.distance.y,i.z+Math.sin(n)*r)}}class Et extends P{name="sideScroll";target=new a.Vector3;defaultConfig={distance:{x:0,y:5,z:18},smoothing:{position:.08,rotation:.1,fov:.1},enableCollision:!1};calculateTargetPosition(e,t){const i=y.getPosition(e.activeState);return this.target.set(i.x+t.config.distance.x,i.y+t.config.distance.y,i.z+t.config.distance.z)}}class zt extends P{name="fixed";defaultPosition=new a.Vector3(0,10,10);defaultLookAt=new a.Vector3(0,0,0);defaultConfig={distance:{x:0,y:0,z:0},smoothing:{position:0,rotation:0,fov:0},enableCollision:!1};calculateTargetPosition(e,t){return t.config.fixedPosition||this.defaultPosition}calculateLookAt(e,t){return t.config.fixedLookAt||this.defaultLookAt}}var Tt=Object.getOwnPropertyDescriptor,Dt=(o,e,t,i)=>{for(var n=i>1?void 0:i?Tt(e,t):e,r=o.length-1,c;r>=0;r--)(c=o[r])&&(n=c(n)||n);return n};exports.CameraSystem=class extends I{controllers=new Map;state;cameraStates=new Map;currentCameraStateName="default";cameraTransitions=[];constructor(e){super(e),this.state=this.createInitialState(e),this.registerControllers(),this.initializeCameraStates()}createInitialState(e){return{config:_(e),lastUpdate:Date.now()}}initializeCameraStates(){const e={name:"default",type:"thirdPerson",position:new a.Vector3(0,5,10),rotation:new a.Euler(0,0,0),fov:75,config:{distance:{x:15,y:8,z:15},height:5,followSpeed:.1,rotationSpeed:.1},priority:0,tags:[]};this.cameraStates.set("default",e)}registerController(e){this.controllers.set(e.name,e)}updateConfig(e){super.updateConfig(e),this.state.config=this.getConfig()}update(e){this.trackFrameMetrics(e)}calculate(e){try{const t=this.controllers.get(this.state.config.mode);if(!t)return;this.state.activeController=t,t.update(e,this.state)}catch(t){this.emitError("Camera calculation failed",t instanceof Error?t.message:void 0)}}getCameraState(e){return this.cameraStates.get(e)}getCurrentCameraState(){return this.cameraStates.get(this.currentCameraStateName)}addCameraState(e,t){this.cameraStates.set(e,t)}setCameraTransitions(e){this.cameraTransitions=e,this.cameraTransitions.length}switchCameraState(e){if(this.cameraStates.has(e)){this.currentCameraStateName=e;const t=this.cameraStates.get(e),i={mode:t.type,fov:t.fov};t.config.distance&&(i.distance=t.config.distance),this.updateConfig(i)}}registerControllers(){this.registerController(new xt),this.registerController(new bt),this.registerController(new St),this.registerController(new Pt),this.registerController(new Mt),this.registerController(new Et),this.registerController(new zt)}};exports.CameraSystem=Dt([C.ManageRuntime({autoStart:!1})],exports.CameraSystem);function Rt(o,e,t){const i=u.useRef(null);i.current||(i.current=new o(e));const n=i.current;j.useFrame((m,d)=>{n?.update(d)}),u.useEffect(()=>{},[t,n]),u.useEffect(()=>()=>{n?.destroy()},[n]);const r=u.useCallback(m=>{n?.updateConfig(m)},[n]),c=u.useCallback(()=>n?.getState(),[n]),l=u.useCallback(()=>n?.getMetrics(),[n]);return{system:n,updateConfig:r,getState:c,getMetrics:l}}const et=.0015,ot=10,nt=1e-4,Vt=-.65,Ot=.85,N=o=>{if(!(o instanceof HTMLElement))return!1;const e=o.tagName.toLowerCase();return e==="input"||e==="textarea"||e==="select"||o.isContentEditable};function kt(){const{gl:o}=j.useThree(),{activeState:e}=q.useStateSystem(),t=C.useGaesupStore(s=>s.cameraOption),i=C.useGaesupStore(s=>s.setCameraOption),n=C.useGaesupStore(s=>s.mode),r=q.useBuildingStore(s=>s.isInEditMode()),c=q.useInputBackend(),l=u.useRef(t);u.useEffect(()=>{l.current=t},[t]);const m=u.useRef(n);u.useEffect(()=>{m.current=n},[n]);const d=u.useRef(r);u.useEffect(()=>{d.current=r},[r]);const S=u.useRef([]),w=u.useRef(null),g=u.useRef(new Set),z=u.useRef(!1),E=u.useRef(0),p=u.useRef(0),X=u.useRef(0),Y=u.useRef(0),st=u.useMemo(()=>({mode:n?.control||"thirdPerson",distance:{x:t?.xDistance??0,y:t?.yDistance??0,z:t?.zDistance??0},smoothing:{position:t?.smoothing?.position??.1,rotation:t?.smoothing?.rotation??.1,fov:t?.smoothing?.fov??.1},fov:t?.fov??75,zoom:t?.zoom??1,enableCollision:t?.enableCollision??!0,...t?.collisionMargin!==void 0?{collisionMargin:t.collisionMargin}:{},orbitYaw:E.current,orbitPitch:p.current,...t?.maxDistance!==void 0?{maxDistance:t.maxDistance}:{},...t?.offset?{offset:{x:t.offset.x,y:t.offset.y,z:t.offset.z}}:{},...t?.target?{lookAt:{x:t.target.x,y:t.target.y,z:t.target.z}}:{}}),[]),{system:Q,updateConfig:V}=Rt(exports.CameraSystem,st),O=u.useCallback(()=>{const s=l.current,h=m.current;V({mode:h?.control||"thirdPerson",distance:{x:s?.xDistance??0,y:s?.yDistance??0,z:s?.zDistance??0},smoothing:{position:s?.smoothing?.position??.1,rotation:s?.smoothing?.rotation??.1,fov:s?.smoothing?.fov??.1},fov:s?.fov??75,zoom:s?.zoom??1,enableCollision:s?.enableCollision??!0,...s?.collisionMargin!==void 0?{collisionMargin:s.collisionMargin}:{},orbitYaw:E.current,orbitPitch:p.current,...s?.maxDistance!==void 0?{maxDistance:s.maxDistance}:{},...s?.offset?{offset:{x:s.offset.x,y:s.offset.y,z:s.offset.z}}:{},...s?.target?{lookAt:{x:s.target.x,y:s.target.y,z:s.target.z}}:{},...s?.focus!==void 0?{focus:s.focus}:{},...s?.focusTarget?{focusTarget:{x:s.focusTarget.x,y:s.focusTarget.y,z:s.focusTarget.z}}:{focusTarget:void 0},...s?.focusDistance!==void 0?{focusDistance:s.focusDistance}:{},...s?.focusLerpSpeed!==void 0?{focusLerpSpeed:s.focusLerpSpeed}:{}})},[V]),F=u.useCallback(s=>{const h=l.current;if(!h?.enableZoom)return;s.preventDefault();const x=h.zoomSpeed||.001,M=h.minZoom||.45,b=h.maxZoom||2.4,k=h.zoom||1,T=s.deltaY*x,L=Math.min(Math.max(k+T,M),b);i({zoom:L})},[i]);return u.useEffect(()=>{const s=o.domElement;if(t?.enableZoom)return s.addEventListener("wheel",F,{passive:!1}),()=>{s.removeEventListener("wheel",F)}},[o,F,t?.enableZoom]),u.useEffect(()=>{const s=o.domElement,h=f=>{N(f.target)||(f.code==="ControlLeft"||f.code==="ControlRight")&&g.current.add(f.code)},x=f=>{f.code!=="ControlLeft"&&f.code!=="ControlRight"||g.current.delete(f.code)},M=f=>{!d.current||N(f.target)||f.button!==1&&f.button!==2||(f.preventDefault(),z.current=!0)},b=f=>{f.button!==1&&f.button!==2||(z.current=!1)},k=f=>{!(g.current.size>0||z.current)||N(f.target)||f.movementX===0&&f.movementY===0||(X.current-=f.movementX*et,Y.current=a.MathUtils.clamp(Y.current+f.movementY*et,Vt,Ot))},T=()=>{g.current.clear(),z.current=!1},L=f=>{d.current&&f.preventDefault()};return window.addEventListener("keydown",h),window.addEventListener("keyup",x),window.addEventListener("mousemove",k),window.addEventListener("mouseup",b),window.addEventListener("blur",T),document.addEventListener("visibilitychange",T),s.addEventListener("mousedown",M),s.addEventListener("contextmenu",L),()=>{window.removeEventListener("keydown",h),window.removeEventListener("keyup",x),window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",b),window.removeEventListener("blur",T),document.removeEventListener("visibilitychange",T),s.removeEventListener("mousedown",M),s.removeEventListener("contextmenu",L)}},[o,V]),u.useEffect(()=>{const s=h=>{const x=l.current;h.key==="Escape"&&x?.focus&&i({focus:!1})};if(t?.enableFocus&&!r)return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s)}},[t?.enableFocus,r,i]),u.useLayoutEffect(()=>{c.updateMouse({isLookAround:!1}),O()},[c,O]),u.useLayoutEffect(()=>{O()},[t,n,O]),j.useFrame((s,h)=>{if(!Q)return;const x=a.MathUtils.damp(E.current,X.current,ot,h),M=a.MathUtils.damp(p.current,Y.current,ot,h);if((Math.abs(x-E.current)>nt||Math.abs(M-p.current)>nt)&&(E.current=x,p.current=M,V({orbitYaw:x,orbitPitch:M})),!w.current)w.current={camera:s.camera,scene:s.scene,deltaTime:h,activeState:e,clock:s.clock,excludeObjects:S.current};else{const b=w.current;b.camera=s.camera,b.scene=s.scene,b.deltaTime=h,b.activeState=e,b.clock=s.clock}Q.calculate(w.current)}),{system:Q}}function Lt(){return kt(),null}function At(){const o=u.useRef(null),e=u.useRef(null),t=u.useRef(null),i=u.useRef(null);return{outerGroupRef:o,innerGroupRef:e,rigidBodyRef:t,colliderRef:i}}exports.Camera=Lt;exports.useGenericRefs=At;
@@ -2489,10 +2489,10 @@ const Br = pt(
2489
2489
  (t, n) => {
2490
2490
  const e = T(null);
2491
2491
  Xt(n, () => e.current);
2492
- const { size: r } = Pr({ url: t.url || "" }), o = t.url?.trim() ? t.url : Fr, { scene: i, animations: s } = Pe(o), { actions: a, ref: c } = en(s), l = T(void 0), {
2493
- handleIntersectionEnter: h,
2494
- handleIntersectionExit: u,
2495
- handleCollisionEnter: d
2492
+ const { size: r } = Pr({ url: t.url || "" }), o = t.url?.trim() ? t.url : Fr, { scene: i, animations: s } = Pe(o), a = L(() => bt.clone(i), [i]), c = T(null), { actions: l } = en(s, a), h = T(void 0), {
2493
+ handleIntersectionEnter: u,
2494
+ handleIntersectionExit: d,
2495
+ handleCollisionEnter: f
2496
2496
  } = Rr({
2497
2497
  rigidBodyRef: e,
2498
2498
  ...t.name ? { id: t.name } : {},
@@ -2504,19 +2504,19 @@ const Br = pt(
2504
2504
  ...t.onFrame ? { onFrame: t.onFrame } : {},
2505
2505
  ...t.onAnimate ? { onAnimate: t.onAnimate } : {},
2506
2506
  ...t.onDestroy || t.onDestory ? { onDestroy: t.onDestroy ?? t.onDestory } : {},
2507
- actions: a,
2507
+ actions: l,
2508
2508
  isActive: t.isActive,
2509
2509
  ...t.outerGroupRef ? { outerGroupRef: t.outerGroupRef } : {},
2510
2510
  ...t.innerGroupRef ? { innerGroupRef: t.innerGroupRef } : {},
2511
2511
  ...t.colliderRef ? { colliderRef: t.colliderRef } : {},
2512
2512
  ...t.groundRay ? { groundRay: t.groundRay } : {},
2513
2513
  ...t.colliderSize ? { colliderSize: t.colliderSize } : {}
2514
- }), f = L(() => bt.clone(i), [i]), g = L(() => {
2514
+ }), g = L(() => {
2515
2515
  let b = null;
2516
- return f.traverse((y) => {
2516
+ return a.traverse((y) => {
2517
2517
  y instanceof w.SkinnedMesh && (b = y.skeleton);
2518
2518
  }), b;
2519
- }, [f]), p = L(() => !t.parts || t.parts.length === 0 ? null : t.parts.map(({ url: b, color: y }, I) => b ? /* @__PURE__ */ Qt(
2519
+ }, [a]), p = L(() => !t.parts || t.parts.length === 0 ? null : t.parts.map(({ url: b, color: y }, I) => b ? /* @__PURE__ */ Qt(
2520
2520
  zr,
2521
2521
  {
2522
2522
  url: b,
@@ -2527,7 +2527,7 @@ const Br = pt(
2527
2527
  key: `${t.componentType}-${b}-${y || "default"}-${I}`,
2528
2528
  ...g ? { skeleton: g } : {}
2529
2529
  }
2530
- ) : null).filter(Boolean), [t.parts, t.componentType, t.currentAnimation, g]), { nodes: m } = yt(f), S = Object.values(m).find((b) => b.type === "Object3D"), v = t.rotation instanceof w.Euler ? t.rotation.y : 0, z = t.outerGroupRef ? { ref: t.outerGroupRef } : {}, D = t.innerGroupRef ? { ref: t.innerGroupRef } : {}, A = t.isActive ? { canSleep: !1, ccd: !0 } : { canSleep: !0, ccd: !1 }, K = L(() => {
2530
+ ) : null).filter(Boolean), [t.parts, t.componentType, t.currentAnimation, g]), { nodes: m } = yt(a), S = Object.values(m).find((b) => b.type === "Object3D"), v = t.rotation instanceof w.Euler ? t.rotation.y : 0, z = t.outerGroupRef ? { ref: t.outerGroupRef } : {}, D = t.innerGroupRef ? { ref: t.innerGroupRef } : {}, A = t.isActive ? { canSleep: !1, ccd: !0 } : { canSleep: !0, ccd: !1 }, K = L(() => {
2531
2531
  if (t.colliderSize) {
2532
2532
  const x = Math.max(0.05, t.colliderSize.radius), M = Math.max(0.05, t.colliderSize.height * 0.5 - x);
2533
2533
  return {
@@ -2545,11 +2545,11 @@ const Br = pt(
2545
2545
  }, [t.colliderSize, t.componentType, r.x, r.y, r.z]);
2546
2546
  return W(() => {
2547
2547
  if (!t.currentAnimation) return;
2548
- const b = Lr(a, t.currentAnimation);
2549
- if (!b || l.current === b) return;
2550
- const y = l.current ? a[l.current] : void 0, I = a[b];
2551
- y?.fadeOut(0.2), I?.reset().fadeIn(0.2).play(), l.current = b;
2552
- }, [a, t.currentAnimation]), /* @__PURE__ */ j("group", { ...z, userData: { intangible: !0 }, children: /* @__PURE__ */ _e(
2548
+ const b = Lr(l, t.currentAnimation);
2549
+ if (!b || h.current === b) return;
2550
+ const y = h.current ? l[h.current] : void 0, I = l[b];
2551
+ y?.fadeOut(0.2), I?.reset().fadeIn(0.2).play(), h.current = b;
2552
+ }, [l, t.currentAnimation]), /* @__PURE__ */ j("group", { ...z, userData: { intangible: !0 }, children: /* @__PURE__ */ _e(
2553
2553
  nn,
2554
2554
  {
2555
2555
  ...A,
@@ -2561,9 +2561,9 @@ const Br = pt(
2561
2561
  userData: t.userData,
2562
2562
  type: t.rigidbodyType || (t.isActive ? "dynamic" : "fixed"),
2563
2563
  ...t.sensor !== void 0 ? { sensor: t.sensor } : {},
2564
- onIntersectionEnter: h,
2565
- onIntersectionExit: u,
2566
- onCollisionEnter: d,
2564
+ onIntersectionEnter: u,
2565
+ onIntersectionExit: d,
2566
+ onCollisionEnter: f,
2567
2567
  ...t.rigidBodyProps,
2568
2568
  children: [
2569
2569
  !t.isNotColliding && /* @__PURE__ */ j(
@@ -2580,7 +2580,7 @@ const Br = pt(
2580
2580
  animationRef: c,
2581
2581
  nodes: m,
2582
2582
  ...D,
2583
- ...s.length > 0 ? { animatedObject: f } : {},
2583
+ ...s.length > 0 ? { animatedObject: a } : {},
2584
2584
  isActive: t.isActive,
2585
2585
  componentType: t.componentType,
2586
2586
  ...S ? { objectNode: S } : {},
@@ -1 +1 @@
1
- "use strict";const s=require("react/jsx-runtime"),l=require("react"),d=require("@react-three/fiber"),c=require("./gaesupStore-2zKBYTYo.cjs"),v=require("./index-HerLcjbR.cjs"),h=require("./index-B9tuMXLQ.cjs");function x(){const r=d.useThree(n=>n.gl),t=c.useGaesupStore(n=>n.setPerformance),o=l.useRef(0);return d.useFrame(()=>{if(o.current++,o.current<30)return;o.current=0;const n=r.info,a="programs"in n?n.programs:void 0;t({render:{calls:n.render.calls,triangles:n.render.triangles,points:n.render.points,lines:n.render.lines},engine:{geometries:n.memory.geometries,textures:n.memory.textures,programs:Array.isArray(a)?a.length:0}})}),null}function g({children:r,showGrid:t,showAxes:o}){return s.jsxs("group",{name:"gaesup-world",children:[t&&s.jsx("gridHelper",{args:[100,100,"#888888","#444444"]}),o&&s.jsx("axesHelper",{args:[10]}),r]})}function f(r){const t=c.useGaesupStore(e=>e.setMode),o=c.useGaesupStore(e=>e.setUrls),n=c.useGaesupStore(e=>e.setCameraOption),a=l.useMemo(()=>{if(!r.urls)return null;const e={};return r.urls.characterUrl!==void 0&&(e.characterUrl=r.urls.characterUrl),r.urls.vehicleUrl!==void 0&&(e.vehicleUrl=r.urls.vehicleUrl),r.urls.airplaneUrl!==void 0&&(e.airplaneUrl=r.urls.airplaneUrl),e.characterUrl===void 0&&r.urls.character!==void 0&&(e.characterUrl=r.urls.character),e.vehicleUrl===void 0&&r.urls.vehicle!==void 0&&(e.vehicleUrl=r.urls.vehicle),e.airplaneUrl===void 0&&r.urls.airplane!==void 0&&(e.airplaneUrl=r.urls.airplane),Object.keys(e).length>0?e:null},[r.urls]);l.useEffect(()=>{a&&o(a)},[a,o]);const u=l.useMemo(()=>{const e=r.cameraOption;if(!e)return null;const m=e.distance??15,i={};return e.xDistance!==void 0?i.xDistance=e.xDistance:e.type==="topDown"?i.xDistance=0:e.type!=="firstPerson"&&(i.xDistance=m),e.yDistance!==void 0?i.yDistance=e.yDistance:i.yDistance=e.height??(e.type==="topDown"?m:8),e.zDistance!==void 0?i.zDistance=e.zDistance:e.type==="topDown"?i.zDistance=0:e.type!=="firstPerson"&&(i.zDistance=m),e.fov!==void 0&&(i.fov=e.fov),e.zoom!==void 0&&(i.zoom=e.zoom),e.enableZoom!==void 0&&(i.enableZoom=e.enableZoom),e.minZoom!==void 0&&(i.minZoom=e.minZoom),e.maxZoom!==void 0&&(i.maxZoom=e.maxZoom),e.zoomSpeed!==void 0&&(i.zoomSpeed=e.zoomSpeed),e.enableCollision!==void 0&&(i.enableCollision=e.enableCollision),e.smoothness!==void 0&&(i.smoothing={position:e.smoothness,rotation:e.smoothness,fov:e.smoothness}),i},[r.cameraOption]);return l.useLayoutEffect(()=>{r.mode&&t(r.mode),r.cameraOption&&t({control:r.cameraOption.type}),u&&n(u)},[u,r.cameraOption,r.mode,n,t]),r.runtime?s.jsx(v.GaesupRuntimeProvider,{runtime:r.runtime,revision:r.runtimeRevision??0,children:r.children}):r.children}const U=f;function D({children:r,showGrid:t,showAxes:o}){return s.jsxs(l.Suspense,{fallback:null,children:[s.jsx(h.Camera,{}),s.jsx(x,{}),s.jsx(g,{showGrid:t??!1,showAxes:o??!1,children:r})]})}exports.GaesupWorldContent=D;exports.WorldConfigProvider=f;exports.WorldContainer=U;
1
+ "use strict";const s=require("react/jsx-runtime"),l=require("react"),d=require("@react-three/fiber"),c=require("./gaesupStore-2zKBYTYo.cjs"),v=require("./index-KD0DiwVP.cjs"),h=require("./index-B0ymJw1j.cjs");function x(){const r=d.useThree(n=>n.gl),t=c.useGaesupStore(n=>n.setPerformance),o=l.useRef(0);return d.useFrame(()=>{if(o.current++,o.current<30)return;o.current=0;const n=r.info,a="programs"in n?n.programs:void 0;t({render:{calls:n.render.calls,triangles:n.render.triangles,points:n.render.points,lines:n.render.lines},engine:{geometries:n.memory.geometries,textures:n.memory.textures,programs:Array.isArray(a)?a.length:0}})}),null}function g({children:r,showGrid:t,showAxes:o}){return s.jsxs("group",{name:"gaesup-world",children:[t&&s.jsx("gridHelper",{args:[100,100,"#888888","#444444"]}),o&&s.jsx("axesHelper",{args:[10]}),r]})}function f(r){const t=c.useGaesupStore(e=>e.setMode),o=c.useGaesupStore(e=>e.setUrls),n=c.useGaesupStore(e=>e.setCameraOption),a=l.useMemo(()=>{if(!r.urls)return null;const e={};return r.urls.characterUrl!==void 0&&(e.characterUrl=r.urls.characterUrl),r.urls.vehicleUrl!==void 0&&(e.vehicleUrl=r.urls.vehicleUrl),r.urls.airplaneUrl!==void 0&&(e.airplaneUrl=r.urls.airplaneUrl),e.characterUrl===void 0&&r.urls.character!==void 0&&(e.characterUrl=r.urls.character),e.vehicleUrl===void 0&&r.urls.vehicle!==void 0&&(e.vehicleUrl=r.urls.vehicle),e.airplaneUrl===void 0&&r.urls.airplane!==void 0&&(e.airplaneUrl=r.urls.airplane),Object.keys(e).length>0?e:null},[r.urls]);l.useEffect(()=>{a&&o(a)},[a,o]);const u=l.useMemo(()=>{const e=r.cameraOption;if(!e)return null;const m=e.distance??15,i={};return e.xDistance!==void 0?i.xDistance=e.xDistance:e.type==="topDown"?i.xDistance=0:e.type!=="firstPerson"&&(i.xDistance=m),e.yDistance!==void 0?i.yDistance=e.yDistance:i.yDistance=e.height??(e.type==="topDown"?m:8),e.zDistance!==void 0?i.zDistance=e.zDistance:e.type==="topDown"?i.zDistance=0:e.type!=="firstPerson"&&(i.zDistance=m),e.fov!==void 0&&(i.fov=e.fov),e.zoom!==void 0&&(i.zoom=e.zoom),e.enableZoom!==void 0&&(i.enableZoom=e.enableZoom),e.minZoom!==void 0&&(i.minZoom=e.minZoom),e.maxZoom!==void 0&&(i.maxZoom=e.maxZoom),e.zoomSpeed!==void 0&&(i.zoomSpeed=e.zoomSpeed),e.enableCollision!==void 0&&(i.enableCollision=e.enableCollision),e.smoothness!==void 0&&(i.smoothing={position:e.smoothness,rotation:e.smoothness,fov:e.smoothness}),i},[r.cameraOption]);return l.useLayoutEffect(()=>{r.mode&&t(r.mode),r.cameraOption&&t({control:r.cameraOption.type}),u&&n(u)},[u,r.cameraOption,r.mode,n,t]),r.runtime?s.jsx(v.GaesupRuntimeProvider,{runtime:r.runtime,revision:r.runtimeRevision??0,children:r.children}):r.children}const U=f;function D({children:r,showGrid:t,showAxes:o}){return s.jsxs(l.Suspense,{fallback:null,children:[s.jsx(h.Camera,{}),s.jsx(x,{}),s.jsx(g,{showGrid:t??!1,showAxes:o??!1,children:r})]})}exports.GaesupWorldContent=D;exports.WorldConfigProvider=f;exports.WorldContainer=U;
@@ -1,8 +1,9 @@
1
1
  import { useRef as h, useEffect as b, useCallback as A, useMemo as ut, useLayoutEffect as J } from "react";
2
2
  import { useFrame as ct, useThree as mt } from "@react-three/fiber";
3
3
  import * as a from "three";
4
- import { V as dt, G as ht, W as gt } from "./index-DKEZe9SJ.js";
4
+ import { V as dt, G as ht, W as gt } from "./index-BcoQ669j.js";
5
5
  import { H, P as G, C as pt, M as vt, u as U } from "./gaesupStore-DTu0tYBp.js";
6
+ import "reflect-metadata";
6
7
  import yt from "mitt";
7
8
  var wt = Object.defineProperty, Ct = Object.getOwnPropertyDescriptor, K = (e, o, t, i) => {
8
9
  for (var n = Ct(o, t), r = e.length - 1, c; r >= 0; r--)
@@ -687,10 +688,10 @@ function Zt() {
687
688
  system: F
688
689
  };
689
690
  }
690
- function Kt() {
691
+ function $t() {
691
692
  return Zt(), null;
692
693
  }
693
- function $t() {
694
+ function Jt() {
694
695
  const e = h(null), o = h(null), t = h(null), i = h(null);
695
696
  return {
696
697
  outerGroupRef: e,
@@ -700,7 +701,7 @@ function $t() {
700
701
  };
701
702
  }
702
703
  export {
703
- Kt as C,
704
+ $t as C,
704
705
  j as a,
705
- $t as u
706
+ Jt as u
706
707
  };
@@ -0,0 +1 @@
1
+ "use strict";const S=require("react/jsx-runtime"),b=require("react"),O=require("three"),I=require("./index-KD0DiwVP.cjs");require("reflect-metadata");const C=require("./gaesupStore-2zKBYTYo.cjs");function z(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const v=z(O),_="gaesup-save",j=1,M="slots";function L(){return new Promise((n,e)=>{if(typeof indexedDB>"u"){e(new Error("IndexedDB unavailable"));return}const t=indexedDB.open(_,j);t.onupgradeneeded=()=>{const r=t.result;r.objectStoreNames.contains(M)||r.createObjectStore(M)},t.onsuccess=()=>n(t.result),t.onerror=()=>e(t.error)})}function w(n,e){return L().then(t=>new Promise((r,a)=>{const o=t.transaction(M,n).objectStore(M),c=e(o);if(c instanceof Promise){c.then(r,a);return}c.onsuccess=()=>r(c.result),c.onerror=()=>a(c.error)}))}class R{async read(e){try{return await w("readonly",r=>r.get(e))??null}catch{return null}}async write(e,t){await w("readwrite",r=>r.put(t,e))}async list(){try{return(await w("readonly",t=>t.getAllKeys())).map(String)}catch{return[]}}async remove(e){try{await w("readwrite",t=>t.delete(e))}catch{}}}const y="gaesup:save:";function k(n,e){try{return n()}catch{return e}}class T{async read(e){return typeof localStorage>"u"?null:k(()=>{const t=localStorage.getItem(y+e);return t?JSON.parse(t):null},null)}async write(e,t){typeof localStorage>"u"||k(()=>localStorage.setItem(y+e,JSON.stringify(t)),void 0)}async list(){return typeof localStorage>"u"?[]:k(()=>{const e=[];for(let t=0;t<localStorage.length;t++){const r=localStorage.key(t);r&&r.startsWith(y)&&e.push(r.slice(y.length))}return e},[])}async remove(e){typeof localStorage>"u"||k(()=>localStorage.removeItem(y+e),void 0)}}class B{adapter;bindings=new Map;currentVersion;migrations;defaultSlot;diagnosticListeners=new Set;constructor(e){this.adapter=e.adapter,this.currentVersion=e.currentVersion??1,this.migrations=e.migrations??{},this.defaultSlot=e.defaultSlot??"main",e.onDiagnostic&&this.diagnosticListeners.add(e.onDiagnostic)}register(e){if(this.bindings.has(e.key))throw new E(e.key);const t={key:e.key,serialize:()=>e.serialize(),hydrate:r=>e.hydrate(r)};return this.bindings.set(e.key,t),()=>{this.bindings.get(e.key)===t&&this.bindings.delete(e.key)}}has(e){return this.bindings.has(e)}subscribeDiagnostics(e){return this.diagnosticListeners.add(e),()=>{this.diagnosticListeners.delete(e)}}getBindings(){return this.bindings.values()}createBlob(e=this.defaultSlot){const t={};for(const[r,a]of this.bindings)try{t[r]=a.serialize()}catch(i){t[r]=null,this.reportDiagnostic({phase:"serialize",key:r,slot:e,error:i})}return{version:this.currentVersion,savedAt:Date.now(),domains:t}}hydrateBlob(e,t=this.defaultSlot){let r=e;for(;r.version<this.currentVersion;){const a=this.migrations[r.version];if(!a)break;r=a(r)}for(const[a,i]of this.bindings)try{i.hydrate(r.domains?.[a])}catch(o){this.reportDiagnostic({phase:"hydrate",key:a,slot:t,error:o})}return!0}async save(e=this.defaultSlot){const t=this.createBlob(e);await this.adapter.write(e,t)}async load(e=this.defaultSlot){const t=await this.adapter.read(e);return t?this.hydrateBlob(t,e):!1}async list(){return this.adapter.list()}async remove(e=this.defaultSlot){return this.adapter.remove(e)}reportDiagnostic(e){for(const t of this.diagnosticListeners)t(e)}}class E extends Error{constructor(e){super(`Save domain "${e}" is already registered.`),this.name="DuplicateSaveDomainBindingError"}}let D=null;function A(){const n=typeof indexedDB<"u"?new R:new T;return new B({adapter:n,defaultSlot:"main",currentVersion:1})}function V(){return D||(D=A()),D}var W=Object.defineProperty,N=Object.getOwnPropertyDescriptor,q=(n,e,t)=>e in n?W(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,X=(n,e,t,r)=>{for(var a=r>1?void 0:r?N(e,t):e,i=n.length-1,o;i>=0;i--)(o=n[i])&&(a=o(a)||a);return a},F=(n,e,t)=>q(n,e+"",t);exports.MinimapSystem=class extends C.AbstractSystem{listeners;constructor(){const e={markers:new Map,canvas:null,ctx:null,isDirty:!0,lastPosition:null,lastRotation:null,gradientCache:{background:null,avatar:null},lastUpdate:Date.now()},t={markerCount:0,renderTime:0,frameTime:0};super(e,t),this.listeners=new Set}static getInstance(){return(!exports.MinimapSystem.instance||exports.MinimapSystem.instance.isDisposed)&&(exports.MinimapSystem.instance=new exports.MinimapSystem),exports.MinimapSystem.instance}addMarker(e,t,r,a,i){const o={id:e,type:t,text:r,center:a,size:i};this.state.markers.set(e,o),this.updateMetrics(0),this.notifyListeners()}removeMarker(e){this.state.markers.delete(e),this.updateMetrics(0),this.notifyListeners()}updateMarker(e,t){const r=this.state.markers.get(e);r&&(this.state.markers.set(e,{...r,...t}),this.updateMetrics(0),this.notifyListeners())}getMarkers(){return new Map(this.state.markers)}getMarker(e){return this.state.markers.get(e)}clear(){this.state.markers.clear(),this.updateMetrics(0),this.notifyListeners()}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(){const e=this.getMarkers();this.listeners.forEach(t=>t(e))}setCanvas(e){this.state.canvas=e,this.state.ctx=e?e.getContext("2d"):null,this.state.isDirty=!0,this.state.gradientCache={background:null,avatar:null}}checkForUpdates(e,t,r=.1,a=.01){const i=this.state.lastPosition,o=this.state.lastRotation;if(!i||o===null){this.state.isDirty=!0,this.state.lastPosition={x:e.x,z:e.z},this.state.lastRotation=t;return}const c=Math.abs(e.x-i.x)>r||Math.abs(e.z-i.z)>r,l=Math.abs(t-o)>a;(c||l)&&(this.state.isDirty=!0,this.state.lastPosition={x:e.x,z:e.z},this.state.lastRotation=t)}render(e){if(!this.state.canvas||!this.state.ctx||!this.state.isDirty)return;const t=performance.now(),{size:r,scale:a,position:i,rotation:o,blockRotate:c,tileGroups:l,sceneObjects:h}=e,s=this.state.ctx;if(s.clearRect(0,0,r,r),s.save(),s.beginPath(),s.arc(r/2,r/2,r/2,0,Math.PI*2),s.clip(),!this.state.gradientCache.background){const d=s.createRadialGradient(r/2,r/2,0,r/2,r/2,r/2);d.addColorStop(0,"rgba(20, 30, 40, 0.9)"),d.addColorStop(1,"rgba(10, 20, 30, 0.95)"),this.state.gradientCache.background=d}s.fillStyle=this.state.gradientCache.background,s.fillRect(0,0,r,r);const u=o*180/Math.PI;s.translate(r/2,r/2),s.rotate(-u*Math.PI/180),s.translate(-r/2,-r/2),s.save(),s.strokeStyle="rgba(255, 255, 255, 0.1)",s.lineWidth=1;for(let d=0;d<r;d+=20)s.beginPath(),s.moveTo(d,0),s.lineTo(d,r),s.moveTo(0,d),s.lineTo(r,d),s.stroke();s.restore(),this.renderCompass(s,r,u),l&&l.size>0&&this.renderTiles(s,r,a,i,l),h&&h.size>0&&this.renderSceneObjects(s,r,a,i,h),this.renderMarkers(s,r,a,i,u,c),this.renderAvatar(s,r),s.restore(),this.state.isDirty=!1,this.metrics.renderTime=performance.now()-t}renderCompass(e,t,r){e.save(),e.fillStyle="white",e.font="bold 16px sans-serif",e.shadowColor="rgba(0, 0, 0, 0.8)",e.shadowBlur=3,[{text:"N",x:t/2,y:25,color:"#ff6b6b"},{text:"S",x:t/2,y:t-25,color:"#4ecdc4"},{text:"E",x:t-25,y:t/2,color:"#45b7d1"},{text:"W",x:25,y:t/2,color:"#f9ca24"}].forEach(({text:i,x:o,y:c,color:l})=>{e.save(),e.fillStyle=l,e.translate(o,c),e.rotate(r*Math.PI/180),e.textAlign="center",e.textBaseline="middle",e.fillText(i,0,0),e.restore()}),e.restore()}renderTiles(e,t,r,a,i){Array.from(i.values()).forEach(c=>{c&&c.tiles&&Array.isArray(c.tiles)&&c.tiles.forEach(l=>{if(!l||!l.position)return;const h=(l.position.x-a.x)*r,s=(l.position.z-a.z)*r,u=(l.size||1)*4*r;e.save();const d=t/2-h-u/2,f=t/2-s-u/2;l.objectType==="water"?e.fillStyle="rgba(0, 150, 255, 0.6)":l.objectType==="grass"?e.fillStyle="rgba(50, 200, 50, 0.4)":l.objectType==="sand"?e.fillStyle="rgba(210, 180, 120, 0.45)":l.objectType==="snowfield"?e.fillStyle="rgba(225, 240, 255, 0.5)":e.fillStyle="rgba(150, 150, 150, 0.3)",e.fillRect(d,f,u,u),e.strokeStyle="rgba(255, 255, 255, 0.2)",e.lineWidth=.5,e.strokeRect(d,f,u,u),e.restore()})})}renderSceneObjects(e,t,r,a,i){i.forEach(o=>{if(!o?.position||!o?.size)return;const c=(o.position.x-a.x)*r,l=(o.position.z-a.z)*r,h=o.size.x*r,s=o.size.z*r;e.save();const u=t/2-c-h/2,d=t/2-l-s/2;e.fillStyle="rgba(100, 150, 200, 0.4)",e.fillRect(u,d,h,s),e.strokeStyle="rgba(255, 255, 255, 0.4)",e.lineWidth=1,e.strokeRect(u,d,h,s),e.restore()})}renderMarkers(e,t,r,a,i,o){this.state.markers.size!==0&&this.state.markers.forEach(c=>{if(!c?.center||!c?.size)return;const{center:l,size:h,text:s}=c,u=(l.x-a.x)*r,d=(l.z-a.z)*r;e.save();const f=h.x*r,g=h.z*r,m=t/2-u-f/2,p=t/2-d-g/2;e.shadowColor="rgba(0, 0, 0, 0.6)",e.shadowBlur=4,e.shadowOffsetX=2,e.shadowOffsetY=2,e.fillStyle="rgba(0,0,0,0.3)",e.fillRect(m,p,f,g),e.shadowColor="transparent",e.strokeStyle="rgba(255, 255, 255, 0.3)",e.lineWidth=1,e.strokeRect(m,p,f,g),s&&(e.save(),e.fillStyle="white",e.font="bold 12px sans-serif",e.shadowColor="rgba(0, 0, 0, 0.8)",e.shadowBlur=2,e.translate(m+f/2,p+g/2),o||e.rotate(-i*Math.PI/180),e.textAlign="center",e.textBaseline="middle",e.fillText(s,0,0),e.restore()),e.restore()})}renderAvatar(e,t){if(e.save(),!this.state.gradientCache.avatar){const r=e.createRadialGradient(t/2,t/2,0,t/2,t/2,12);r.addColorStop(0,"#01fff7"),r.addColorStop(.7,"#01fff7"),r.addColorStop(1,"transparent"),this.state.gradientCache.avatar=r}e.fillStyle=this.state.gradientCache.avatar,e.beginPath(),e.arc(t/2,t/2,12,0,Math.PI*2),e.fill(),e.fillStyle="#01fff7",e.shadowColor="0 0 10px rgba(1,255,247,0.7)",e.shadowBlur=8,e.beginPath(),e.arc(t/2,t/2,6,0,Math.PI*2),e.fill(),e.shadowColor="transparent",e.strokeStyle="rgba(255, 255, 255, 0.8)",e.lineWidth=2,e.beginPath(),e.moveTo(t/2,t/2),e.lineTo(t/2,t/2-12),e.stroke(),e.restore()}performUpdate(e){}createUpdateArgs(e){return e}updateMetrics(e){this.metrics.markerCount=this.state.markers.size,this.metrics.frameTime=e}onDispose(){this.clear(),this.listeners.clear(),this.state.canvas=null,this.state.ctx=null,exports.MinimapSystem.instance=null}};F(exports.MinimapSystem,"instance",null);exports.MinimapSystem=X([C.RegisterSystem("minimap"),C.ManageRuntime({autoStart:!1})],exports.MinimapSystem);function U({type:n="normal",text:e,position:t,children:r,interactive:a=!0,showMinimap:i=!0}){const o=b.useRef(null),c=I.useClicker(),l=b.useMemo(()=>`world-prop-${Date.now()}-${Math.random()}`,[]),h=b.useRef({center:new v.Vector3,size:new v.Vector3,positionAdd:new v.Vector3});return b.useEffect(()=>{if(!i||!o.current)return;const s=exports.MinimapSystem.getInstance(),d=setTimeout(()=>{const f=o.current;if(!f)return;const g=new v.Box3;if(g.setFromObject(f),!g.isEmpty()){const{center:m,size:p,positionAdd:P}=h.current;g.getCenter(m),g.getSize(p),t&&(P.set(t[0],t[1],t[2]),m.add(P)),s.addMarker(l,n,e||"",m.clone(),p.clone())}},100);return()=>{clearTimeout(d),s.removeMarker(l)}},[t,n,e,i,l]),S.jsxs("group",{ref:o,...t?{position:t}:{},onClick:s=>{a&&(s.stopPropagation(),c.onClick(s))},children:[r,e&&S.jsx("group",{position:[0,2,0],children:S.jsx("sprite",{scale:[2,.5,1],children:S.jsx("spriteMaterial",{color:"#ffffff",transparent:!0,opacity:.8})})})]})}exports.DuplicateSaveDomainBindingError=E;exports.IndexedDBAdapter=R;exports.LocalStorageAdapter=T;exports.SaveSystem=B;exports.WorldProps=U;exports.createDefaultSaveSystem=A;exports.getSaveSystem=V;
@@ -2,11 +2,11 @@ import { jsx as h, jsxs as E, Fragment as K } from "react/jsx-runtime";
2
2
  import { useRef as P, useState as C, useEffect as G, useMemo as x, useCallback as B, memo as U } from "react";
3
3
  import * as S from "three";
4
4
  import { Line as L } from "@react-three/drei";
5
- import { V as T, G as z, W as N, X as F, Y as I, Z as V, U as q, _ as W } from "./index-DKEZe9SJ.js";
5
+ import { V as T, G as z, W as N, X as F, Y as I, Z as V, U as q, _ as W } from "./index-BcoQ669j.js";
6
6
  import { useFrame as Z } from "@react-three/fiber";
7
7
  import { B as j, u as k } from "./gaesupStore-DTu0tYBp.js";
8
8
  import { vec3 as Y } from "@react-three/rapier";
9
- import { u as _ } from "./index-DnZ3X7L7.js";
9
+ import { u as _ } from "./index-CsKqKct1.js";
10
10
  const H = () => ({
11
11
  position: new S.Vector3(0, 0, 0),
12
12
  velocity: new S.Vector3(0, 0, 0),
@@ -30,14 +30,14 @@ function X(e = {}) {
30
30
  y.current = void 0, v.current = j.getOrCreate("motion");
31
31
  const u = v.current;
32
32
  if (!u) return;
33
- const n = u.subscribe((o, t) => {
33
+ const n = u.subscribe((i, t) => {
34
34
  const a = s(u);
35
35
  if (!a || t !== a) return;
36
36
  const c = performance.now();
37
37
  if (w.current = c, d > 0 && c - r.current < d) return;
38
38
  r.current = c;
39
- const i = l.current;
40
- i.position.copy(o.position), i.velocity.copy(o.velocity), i.rotation.copy(o.rotation), i.isMoving = o.isMoving, i.isGrounded = o.isGrounded, i.speed = o.speed, i.height = 2, g((b) => b + 1);
39
+ const o = l.current;
40
+ o.position.copy(i.position), o.velocity.copy(i.velocity), o.rotation.copy(i.rotation), o.isMoving = i.isMoving, o.isGrounded = i.isGrounded, o.speed = i.speed, o.height = 2, g((b) => b + 1);
41
41
  });
42
42
  return () => {
43
43
  n();
@@ -45,16 +45,16 @@ function X(e = {}) {
45
45
  }, [f, d]), Z(() => {
46
46
  const u = performance.now();
47
47
  if (d > 0 && u - r.current < d) return;
48
- const n = l.current, o = v.current, t = (a) => {
49
- const c = m.current, i = a.x - c.x, b = a.y - c.y, M = a.z - c.z;
50
- return i * i + b * b + M * M > 1e-6 ? (c.x = a.x, c.y = a.y, c.z = a.z, !0) : !1;
48
+ const n = l.current, i = v.current, t = (a) => {
49
+ const c = m.current, o = a.x - c.x, b = a.y - c.y, M = a.z - c.z;
50
+ return o * o + b * b + M * M > 1e-6 ? (c.x = a.x, c.y = a.y, c.z = a.z, !0) : !1;
51
51
  };
52
- if (o) {
53
- const a = s(o);
52
+ if (i) {
53
+ const a = s(i);
54
54
  if (!(u - w.current < 16) && a) {
55
- const i = o.snapshot(a);
56
- if (i) {
57
- n.position.copy(i.position), n.velocity.copy(i.velocity), n.rotation.copy(i.rotation), n.isMoving = i.isMoving, n.isGrounded = i.isGrounded, n.speed = i.speed, n.height = 2, r.current = u, t(n.position) && g((b) => b + 1);
55
+ const o = i.snapshot(a);
56
+ if (o) {
57
+ n.position.copy(o.position), n.velocity.copy(o.velocity), n.rotation.copy(o.rotation), n.isMoving = o.isMoving, n.isGrounded = o.isGrounded, n.speed = o.speed, n.height = 2, r.current = u, t(n.position) && g((b) => b + 1);
58
58
  return;
59
59
  }
60
60
  }
@@ -110,11 +110,11 @@ const $ = {
110
110
  a && t.preventDefault(), p();
111
111
  return;
112
112
  }
113
- const i = y.current.has(t.code);
114
- a && !i ? (y.current.add(t.code), t.code === "Space" && t.preventDefault(), d && l && (c === "forward" || c === "backward" || c === "leftward" || c === "rightward") && (g(), m.updateMouse({ isActive: !1, shouldRun: !1 })), m.updateKeyboard({ [c]: !0 })) : !a && i && (y.current.delete(t.code), m.updateKeyboard({ [c]: !1 }));
115
- }, u = (t) => s(t, !0), n = (t) => s(t, !1), o = () => document.hidden && p();
116
- return window.addEventListener("keydown", u), window.addEventListener("keyup", n), document.addEventListener("visibilitychange", o), () => {
117
- window.removeEventListener("keydown", u), window.removeEventListener("keyup", n), document.removeEventListener("visibilitychange", o);
113
+ const o = y.current.has(t.code);
114
+ a && !o ? (y.current.add(t.code), t.code === "Space" && t.preventDefault(), d && l && (c === "forward" || c === "backward" || c === "leftward" || c === "rightward") && (g(), m.updateMouse({ isActive: !1, shouldRun: !1 })), m.updateKeyboard({ [c]: !0 })) : !a && o && (y.current.delete(t.code), m.updateKeyboard({ [c]: !1 }));
115
+ }, u = (t) => s(t, !0), n = (t) => s(t, !1), i = () => document.hidden && p();
116
+ return window.addEventListener("keydown", u), window.addEventListener("keyup", n), document.addEventListener("visibilitychange", i), () => {
117
+ window.removeEventListener("keydown", u), window.removeEventListener("keyup", n), document.removeEventListener("visibilitychange", i);
118
118
  };
119
119
  }, [
120
120
  v,
@@ -174,19 +174,19 @@ function Q() {
174
174
  G(() => V(() => {
175
175
  g([...I()]);
176
176
  }), []);
177
- const r = f?.target || new S.Vector3(), w = f?.isActive || !1, m = e?.queue || { actions: [], currentIndex: 0 }, y = m.actions || [], v = m.currentIndex || 0, p = d.distanceTo(r) < 1, s = w && !p, u = y.map((t) => t.type === "move" && t.target ? new S.Vector3(t.target.x, t.target.y, t.target.z) : null).filter((t) => t !== null), n = l.length > 0 ? l : [r], o = s ? [d, ...n, ...u] : u.length > 0 ? [d, ...u] : [];
177
+ const r = f?.target || new S.Vector3(), w = f?.isActive || !1, m = e?.queue || { actions: [], currentIndex: 0 }, y = m.actions || [], v = m.currentIndex || 0, p = d.distanceTo(r) < 1, s = w && !p, u = y.map((t) => t.type === "move" && t.target ? new S.Vector3(t.target.x, t.target.y, t.target.z) : null).filter((t) => t !== null), n = l.length > 0 ? l : [r], i = s ? [d, ...n, ...u] : u.length > 0 ? [d, ...u] : [];
178
178
  return /* @__PURE__ */ E("group", { children: [
179
179
  s && /* @__PURE__ */ h("group", { position: r, children: /* @__PURE__ */ h(O, {}) }),
180
- o.length > 1 && /* @__PURE__ */ h(
180
+ i.length > 1 && /* @__PURE__ */ h(
181
181
  D,
182
182
  {
183
- points: o,
183
+ points: i,
184
184
  color: v >= 0 ? "#00ff88" : "#ffaa00"
185
185
  }
186
186
  ),
187
187
  y.map((t, a) => {
188
188
  if (t.type === "move" && t.target) {
189
- const c = a === v, i = a < v;
189
+ const c = a === v, o = a < v;
190
190
  return /* @__PURE__ */ h(
191
191
  "group",
192
192
  {
@@ -196,9 +196,9 @@ function Q() {
196
196
  /* @__PURE__ */ h(
197
197
  "meshStandardMaterial",
198
198
  {
199
- color: i ? "#888" : c ? "#ff4444" : "#ffaa00",
199
+ color: o ? "#888" : c ? "#ff4444" : "#ffaa00",
200
200
  transparent: !0,
201
- opacity: i ? 0.3 : 0.8
201
+ opacity: o ? 0.3 : 0.8
202
202
  }
203
203
  )
204
204
  ] })
@@ -236,19 +236,19 @@ function ee({ clickerOptions: e }) {
236
236
  );
237
237
  }
238
238
  function te({ props: e, children: d }) {
239
- const f = k((o) => o.mode), { gameStates: l } = T(), g = k((o) => o.rideable), r = k((o) => o.urls), w = z((o) => o.isInEditMode()), m = _();
239
+ const f = k((i) => i.mode), { gameStates: l } = T(), g = k((i) => i.rideable), r = k((i) => i.urls), w = z((i) => i.isInEditMode()), m = _();
240
240
  if (J(), w || !f || !l || !g || !r || f.type === "character" && !r.characterUrl || f.type === "vehicle" && !r.vehicleUrl || f.type === "airplane" && !r.airplaneUrl) return null;
241
241
  const { canRide: y, isRiding: v, currentRideable: R } = l, p = R?.id, s = x(
242
242
  () => (p ? g[p]?.offset : void 0) ?? Y(),
243
243
  [p, g]
244
244
  ), n = (() => {
245
- const o = e.rigidBodyRef ?? m.rigidBodyRef, t = e.outerGroupRef ?? m.outerGroupRef, a = e.innerGroupRef ?? m.innerGroupRef, c = e.colliderRef ?? m.colliderRef, i = {
245
+ const i = e.rigidBodyRef ?? m.rigidBodyRef, t = e.outerGroupRef ?? m.outerGroupRef, a = e.innerGroupRef ?? m.innerGroupRef, c = e.colliderRef ?? m.colliderRef, o = {
246
246
  isActive: !0,
247
247
  componentType: f.type,
248
248
  enableRiding: y,
249
249
  isRiderOn: v,
250
250
  offset: s,
251
- ref: o,
251
+ ref: i,
252
252
  outerGroupRef: t,
253
253
  innerGroupRef: a,
254
254
  colliderRef: c,
@@ -272,25 +272,25 @@ function te({ props: e, children: d }) {
272
272
  switch (f.type) {
273
273
  case "character":
274
274
  return {
275
- ...i,
275
+ ...o,
276
276
  url: r.characterUrl || ""
277
277
  };
278
278
  case "vehicle":
279
279
  return {
280
- ...i,
280
+ ...o,
281
281
  ...M,
282
282
  url: r.vehicleUrl || "",
283
283
  wheelUrl: r.wheelUrl
284
284
  };
285
285
  case "airplane":
286
286
  return {
287
- ...i,
287
+ ...o,
288
288
  ...M,
289
289
  url: r.airplaneUrl || ""
290
290
  };
291
291
  default:
292
292
  return {
293
- ...i,
293
+ ...o,
294
294
  url: r.characterUrl || ""
295
295
  };
296
296
  }
@@ -302,13 +302,13 @@ function ue(e) {
302
302
  ...l ?? {},
303
303
  ...l?.agentRadius === void 0 && g.colliderSize?.radius !== void 0 ? { agentRadius: g.colliderSize.radius } : {}
304
304
  };
305
- return /* @__PURE__ */ h(te, { props: g, children: /* @__PURE__ */ E(K, { children: [
305
+ return /* @__PURE__ */ E(K, { children: [
306
+ /* @__PURE__ */ h(te, { props: g, children: f }),
306
307
  d && /* @__PURE__ */ E(K, { children: [
307
308
  /* @__PURE__ */ h(ee, { clickerOptions: r }),
308
309
  /* @__PURE__ */ h(Q, {})
309
- ] }),
310
- f
311
- ] }) });
310
+ ] })
311
+ ] });
312
312
  }
313
313
  export {
314
314
  ue as C,