gaesup-world 1.0.22 → 1.0.23

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-Cpso39Zs.cjs"),V=require("./index-D1hpjfAw.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-Ctehfr0N.cjs"),V=require("./index-TNaPJQpb.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,7 +6,7 @@ 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-DXZjZF_s.js";
9
+ import { u as ne, C as ae, a as se, G as oe } from "./index-B3DY2LIR.js";
10
10
  import { C as le } from "./index-DRLvJF_k.js";
11
11
  const w = (t) => t?.type === "character";
12
12
  function ce({ blueprint: t }) {
package/dist/editor.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("reflect-metadata");const e=require("./plugin-CS2nMv9n.cjs"),T=require("react"),S=require("@react-three/fiber"),I=require("three"),r=require("./index-CJj-Z7Jr.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-B4lSjyeZ.cjs"),T=require("react"),S=require("@react-three/fiber"),I=require("three"),r=require("./index-CJj-Z7Jr.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;
@@ -303,13 +303,13 @@ function de(e) {
303
303
  ...u ?? {},
304
304
  ...u?.agentRadius === void 0 && f.colliderSize?.radius !== void 0 ? { agentRadius: f.colliderSize.radius } : {}
305
305
  };
306
- return /* @__PURE__ */ v(re, { props: f, children: /* @__PURE__ */ P(A, { children: [
306
+ return /* @__PURE__ */ P(A, { children: [
307
+ /* @__PURE__ */ v(re, { props: f, children: d }),
307
308
  g && /* @__PURE__ */ P(A, { children: [
308
309
  /* @__PURE__ */ v(te, { clickerOptions: r }),
309
310
  /* @__PURE__ */ v(ee, {})
310
- ] }),
311
- d
312
- ] }) });
311
+ ] })
312
+ ] });
313
313
  }
314
314
  export {
315
315
  de as C,
@@ -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-CJj-Z7Jr.cjs"),h=require("./index-D1hpjfAw.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-CJj-Z7Jr.cjs"),h=require("./index-TNaPJQpb.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 +1 @@
1
- "use strict";const i=require("react/jsx-runtime"),p=require("react"),O=require("three"),T=require("@react-three/drei"),w=require("./index-CJj-Z7Jr.cjs"),D=require("@react-three/fiber"),k=require("./gaesupStore-2zKBYTYo.cjs"),z=require("@react-three/rapier"),U=require("./index-D1hpjfAw.cjs");function q(e){const d=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const c=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(d,a,c.get?c:{enumerable:!0,get:()=>e[a]})}}return d.default=e,Object.freeze(d)}const j=q(O),N=()=>({position:new j.Vector3(0,0,0),velocity:new j.Vector3(0,0,0),rotation:new j.Euler(0,0,0),isMoving:!1,isGrounded:!1,speed:0,height:2});function M(e={}){const{updateInterval:d=0,entityId:a}=e,c=p.useRef(null);c.current||(c.current=N());const[,g]=p.useState(0),r=p.useRef(0),S=p.useRef(0),m=p.useRef({x:0,y:0,z:0}),v=p.useRef(void 0),x=p.useRef(null),{activeState:b,gameStates:R}=w.useStateSystem(),f=h=>{if(a)return a;if(v.current)return v.current;const t=h.getActiveEntities();return v.current=t[0],v.current};return p.useEffect(()=>{v.current=void 0,x.current=k.BridgeFactory.getOrCreate("motion");const h=x.current;if(!h)return;const t=h.subscribe((o,y)=>{const u=f(h);if(!u||y!==u)return;const l=performance.now();if(S.current=l,d>0&&l-r.current<d)return;r.current=l;const n=c.current;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,g(s=>s+1)});return()=>{t()}},[a,d]),D.useFrame(()=>{const h=performance.now();if(d>0&&h-r.current<d)return;const t=c.current,o=x.current,y=u=>{const l=m.current,n=u.x-l.x,s=u.y-l.y,E=u.z-l.z;return n*n+s*s+E*E>1e-6?(l.x=u.x,l.y=u.y,l.z=u.z,!0):!1};if(o){const u=f(o);if(!(h-S.current<16)&&u){const n=o.snapshot(u);if(n){t.position.copy(n.position),t.velocity.copy(n.velocity),t.rotation.copy(n.rotation),t.isMoving=n.isMoving,t.isGrounded=n.isGrounded,t.speed=n.speed,t.height=2,r.current=h,y(t.position)&&g(s=>s+1);return}}}b?.position&&(t.position.copy(b.position),b.velocity?t.velocity.copy(b.velocity):t.velocity.set(0,0,0),b.euler?t.rotation.copy(b.euler):t.rotation.set(0,0,0),t.isMoving=R?.isMoving||!1,t.isGrounded=R?.isOnTheGround||!1,t.speed=b.velocity?b.velocity.length():0,t.height=2,r.current=h,y(t.position)&&g(u=>u+1))}),c.current}const F={KeyW:"forward",KeyA:"leftward",KeyS:"backward",KeyD:"rightward",ShiftLeft:"shift",Space:"space",KeyZ:"keyZ",KeyR:"keyR",KeyF:"keyF",KeyE:"keyE",Escape:"escape"},C=(e=!0,d=!0,a)=>{const c=k.useGaesupStore(f=>f.automation?.queue.isRunning),g=k.useGaesupStore(f=>f.stopAutomation),r=k.useGaesupStore(f=>f.interaction?.isActive??!0),S=w.useBuildingStore(f=>f.isInEditMode()),m=w.useInputBackend(),v=p.useRef(new Set),x=p.useMemo(()=>({...F}),[]),b=p.useCallback((f,h)=>{if(!r)return!1;try{return m.updateKeyboard({[f]:h}),h?v.current.add(f):v.current.delete(f),!0}catch(t){return console.error("Error updating keyboard state:",t),!1}},[m,r]),R=p.useCallback(()=>{v.current.clear(),m.updateKeyboard({forward:!1,backward:!1,leftward:!1,rightward:!1,shift:!1,space:!1,keyZ:!1,keyR:!1,keyF:!1,keyE:!1,escape:!1})},[m]);return p.useEffect(()=>{(!r||S)&&R()},[R,r,S]),p.useEffect(()=>{const f=(y,u)=>{const l=x[y.code];if(!l)return;if(!r||S){u&&y.preventDefault(),R();return}const n=v.current.has(y.code);u&&!n?(v.current.add(y.code),y.code==="Space"&&y.preventDefault(),d&&c&&(l==="forward"||l==="backward"||l==="leftward"||l==="rightward")&&(g(),m.updateMouse({isActive:!1,shouldRun:!1})),m.updateKeyboard({[l]:!0})):!u&&n&&(v.current.delete(y.code),m.updateKeyboard({[l]:!1}))},h=y=>f(y,!0),t=y=>f(y,!1),o=()=>document.hidden&&R();return window.addEventListener("keydown",h),window.addEventListener("keyup",t),document.addEventListener("visibilitychange",o),()=>{window.removeEventListener("keydown",h),window.removeEventListener("keyup",t),document.removeEventListener("visibilitychange",o)}},[x,d,g,c,R,r,S,m]),{pressedKeys:Array.from(v.current),pushKey:b,isKeyPressed:f=>v.current.has(f),clearAllKeys:R}},K=p.memo(({points:e,color:d})=>e.length<2?null:i.jsx(T.Line,{points:e,color:d,lineWidth:2,dashed:!1}));K.displayName="PathLine";const B=p.memo(()=>i.jsxs("group",{children:[i.jsxs("mesh",{children:[i.jsx("sphereGeometry",{args:[.2,16,16]}),i.jsx("meshStandardMaterial",{color:"#00ff88",emissive:"#00ff88",emissiveIntensity:.5,transparent:!0,opacity:.9})]}),i.jsxs("mesh",{rotation:[Math.PI/2,0,0],children:[i.jsx("ringGeometry",{args:[.3,.5,8]}),i.jsx("meshStandardMaterial",{color:"#00ff88",transparent:!0,opacity:.6,side:j.DoubleSide})]})]}));B.displayName="TargetMarker";function I(){const e=k.useGaesupStore(s=>s.automation),{position:d}=M(),{activeState:a}=w.useStateSystem(),{mouse:c}=w.useInteractionSystem(),[g,r]=p.useState(()=>[...w.getClickNavigationRoute()]);p.useEffect(()=>w.subscribeClickNavigationRoute(()=>{r([...w.getClickNavigationRoute()])}),[]);const S=c?.target||new j.Vector3,m=a?.position??d,v=c?.isActive||!1,x=e?.queue||{actions:[],currentIndex:0},b=x.actions||[],R=x.currentIndex||0,h=m.distanceTo(S)<1,t=v&&!h,o=b.map(s=>s.type==="move"&&s.target?new j.Vector3(s.target.x,s.target.y,s.target.z):null).filter(s=>s!==null),y=m.clone(),u=g.length>0?g:[S],l=u[0]??o[0]??S;y.y=l.y;const n=t?[y,...u,...o]:o.length>0?[y,...o]:[];return i.jsxs("group",{children:[t&&i.jsx("group",{position:S,children:i.jsx(B,{})}),n.length>1&&i.jsx(K,{points:n,color:R>=0?"#00ff88":"#ffaa00"}),b.map((s,E)=>{if(s.type==="move"&&s.target){const P=E===R,G=E<R;return i.jsx("group",{position:[s.target.x,s.target.y,s.target.z],children:i.jsxs("mesh",{children:[i.jsx("sphereGeometry",{args:[.1,8,8]}),i.jsx("meshStandardMaterial",{color:G?"#888":P?"#ff4444":"#ffaa00",transparent:!0,opacity:G?.3:.8})]})},`action-${E}`)}return null})]})}function A({clickerOptions:e}){const{onClick:d}=w.useClicker(e),a=c=>{c.stopPropagation();const{cameraOption:g,setCameraOption:r}=k.useGaesupStore.getState();if(g?.focus){r({focus:!1});return}d(c)};return i.jsxs("mesh",{position:[0,0,0],rotation:[-Math.PI/2,0,0],onPointerDown:a,visible:!0,userData:{intangible:!0},children:[i.jsx("planeGeometry",{args:[1e3,1e3]}),i.jsx("meshBasicMaterial",{transparent:!0,opacity:0})]})}function L({props:e,children:d}){const a=k.useGaesupStore(o=>o.mode),{gameStates:c}=w.useStateSystem(),g=k.useGaesupStore(o=>o.rideable),r=k.useGaesupStore(o=>o.urls),S=w.useBuildingStore(o=>o.isInEditMode()),m=U.useGenericRefs();if(C(),S||!a||!c||!g||!r||a.type==="character"&&!r.characterUrl||a.type==="vehicle"&&!r.vehicleUrl||a.type==="airplane"&&!r.airplaneUrl)return null;const{canRide:v,isRiding:x,currentRideable:b}=c,R=b?.id,f=p.useMemo(()=>(R?g[R]?.offset:void 0)??z.vec3(),[R,g]),t=(()=>{const o=e.rigidBodyRef??m.rigidBodyRef,y=e.outerGroupRef??m.outerGroupRef,u=e.innerGroupRef??m.innerGroupRef,l=e.colliderRef??m.colliderRef,n={isActive:!0,componentType:a.type,enableRiding:v,isRiderOn:x,offset:f,ref:o,outerGroupRef:y,innerGroupRef:u,colliderRef:l,parts:(e.parts||[]).filter(P=>!!P.url).map(P=>({...P,url:P.url})),...e.onAnimate?{onAnimate:e.onAnimate}:{},...e.onFrame?{onFrame:e.onFrame}:{},...e.onReady?{onReady:e.onReady}:{},...e.onDestroy?{onDestroy:e.onDestroy}:{},...e.onDestory?{onDestory:e.onDestory}:{},...typeof e.baseColor=="string"&&e.baseColor.trim().length>0?{baseColor:e.baseColor}:{},...Array.isArray(e.excludeBaseNodes)&&e.excludeBaseNodes.length>0?{excludeBaseNodes:e.excludeBaseNodes}:{},...e.rigidBodyProps?{rigidBodyProps:e.rigidBodyProps}:{},...e.controllerOptions?{controllerOptions:e.controllerOptions}:{},...e.groundRay?{groundRay:e.groundRay}:{},...e.colliderSize?{colliderSize:e.colliderSize}:{},...e.position?{position:e.position}:{},...e.rotation?{rotation:e.rotation}:{},...e.scale?{scale:e.scale}:{}},s=x&&a.type!=="character"?r.ridingUrl:void 0,E=typeof s=="string"&&s.length>0?{ridingUrl:s}:{};switch(a.type){case"character":return{...n,url:r.characterUrl||""};case"vehicle":return{...n,...E,url:r.vehicleUrl||"",wheelUrl:r.wheelUrl};case"airplane":return{...n,...E,url:r.airplaneUrl||""};default:return{...n,url:r.characterUrl||""}}})();return a.type==="character"&&c.isRiding?null:i.jsx(w.PhysicsEntity,{...t,children:d})}function V(e){const{clickToMove:d,children:a,clickerOptions:c,...g}=e,r={...c??{},...c?.agentRadius===void 0&&g.colliderSize?.radius!==void 0?{agentRadius:g.colliderSize.radius}:{}};return i.jsx(L,{props:g,children:i.jsxs(i.Fragment,{children:[d&&i.jsxs(i.Fragment,{children:[i.jsx(A,{clickerOptions:r}),i.jsx(I,{})]}),a]})})}exports.Clicker=I;exports.ControllerWrapper=V;exports.GroundClicker=A;exports.useKeyboard=C;exports.usePlayerPosition=M;
1
+ "use strict";const i=require("react/jsx-runtime"),p=require("react"),O=require("three"),T=require("@react-three/drei"),w=require("./index-CJj-Z7Jr.cjs"),D=require("@react-three/fiber"),k=require("./gaesupStore-2zKBYTYo.cjs"),z=require("@react-three/rapier"),U=require("./index-TNaPJQpb.cjs");function q(e){const d=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const c=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(d,a,c.get?c:{enumerable:!0,get:()=>e[a]})}}return d.default=e,Object.freeze(d)}const j=q(O),N=()=>({position:new j.Vector3(0,0,0),velocity:new j.Vector3(0,0,0),rotation:new j.Euler(0,0,0),isMoving:!1,isGrounded:!1,speed:0,height:2});function M(e={}){const{updateInterval:d=0,entityId:a}=e,c=p.useRef(null);c.current||(c.current=N());const[,g]=p.useState(0),r=p.useRef(0),S=p.useRef(0),m=p.useRef({x:0,y:0,z:0}),v=p.useRef(void 0),x=p.useRef(null),{activeState:b,gameStates:R}=w.useStateSystem(),f=h=>{if(a)return a;if(v.current)return v.current;const t=h.getActiveEntities();return v.current=t[0],v.current};return p.useEffect(()=>{v.current=void 0,x.current=k.BridgeFactory.getOrCreate("motion");const h=x.current;if(!h)return;const t=h.subscribe((o,y)=>{const u=f(h);if(!u||y!==u)return;const l=performance.now();if(S.current=l,d>0&&l-r.current<d)return;r.current=l;const n=c.current;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,g(s=>s+1)});return()=>{t()}},[a,d]),D.useFrame(()=>{const h=performance.now();if(d>0&&h-r.current<d)return;const t=c.current,o=x.current,y=u=>{const l=m.current,n=u.x-l.x,s=u.y-l.y,E=u.z-l.z;return n*n+s*s+E*E>1e-6?(l.x=u.x,l.y=u.y,l.z=u.z,!0):!1};if(o){const u=f(o);if(!(h-S.current<16)&&u){const n=o.snapshot(u);if(n){t.position.copy(n.position),t.velocity.copy(n.velocity),t.rotation.copy(n.rotation),t.isMoving=n.isMoving,t.isGrounded=n.isGrounded,t.speed=n.speed,t.height=2,r.current=h,y(t.position)&&g(s=>s+1);return}}}b?.position&&(t.position.copy(b.position),b.velocity?t.velocity.copy(b.velocity):t.velocity.set(0,0,0),b.euler?t.rotation.copy(b.euler):t.rotation.set(0,0,0),t.isMoving=R?.isMoving||!1,t.isGrounded=R?.isOnTheGround||!1,t.speed=b.velocity?b.velocity.length():0,t.height=2,r.current=h,y(t.position)&&g(u=>u+1))}),c.current}const F={KeyW:"forward",KeyA:"leftward",KeyS:"backward",KeyD:"rightward",ShiftLeft:"shift",Space:"space",KeyZ:"keyZ",KeyR:"keyR",KeyF:"keyF",KeyE:"keyE",Escape:"escape"},C=(e=!0,d=!0,a)=>{const c=k.useGaesupStore(f=>f.automation?.queue.isRunning),g=k.useGaesupStore(f=>f.stopAutomation),r=k.useGaesupStore(f=>f.interaction?.isActive??!0),S=w.useBuildingStore(f=>f.isInEditMode()),m=w.useInputBackend(),v=p.useRef(new Set),x=p.useMemo(()=>({...F}),[]),b=p.useCallback((f,h)=>{if(!r)return!1;try{return m.updateKeyboard({[f]:h}),h?v.current.add(f):v.current.delete(f),!0}catch(t){return console.error("Error updating keyboard state:",t),!1}},[m,r]),R=p.useCallback(()=>{v.current.clear(),m.updateKeyboard({forward:!1,backward:!1,leftward:!1,rightward:!1,shift:!1,space:!1,keyZ:!1,keyR:!1,keyF:!1,keyE:!1,escape:!1})},[m]);return p.useEffect(()=>{(!r||S)&&R()},[R,r,S]),p.useEffect(()=>{const f=(y,u)=>{const l=x[y.code];if(!l)return;if(!r||S){u&&y.preventDefault(),R();return}const n=v.current.has(y.code);u&&!n?(v.current.add(y.code),y.code==="Space"&&y.preventDefault(),d&&c&&(l==="forward"||l==="backward"||l==="leftward"||l==="rightward")&&(g(),m.updateMouse({isActive:!1,shouldRun:!1})),m.updateKeyboard({[l]:!0})):!u&&n&&(v.current.delete(y.code),m.updateKeyboard({[l]:!1}))},h=y=>f(y,!0),t=y=>f(y,!1),o=()=>document.hidden&&R();return window.addEventListener("keydown",h),window.addEventListener("keyup",t),document.addEventListener("visibilitychange",o),()=>{window.removeEventListener("keydown",h),window.removeEventListener("keyup",t),document.removeEventListener("visibilitychange",o)}},[x,d,g,c,R,r,S,m]),{pressedKeys:Array.from(v.current),pushKey:b,isKeyPressed:f=>v.current.has(f),clearAllKeys:R}},K=p.memo(({points:e,color:d})=>e.length<2?null:i.jsx(T.Line,{points:e,color:d,lineWidth:2,dashed:!1}));K.displayName="PathLine";const B=p.memo(()=>i.jsxs("group",{children:[i.jsxs("mesh",{children:[i.jsx("sphereGeometry",{args:[.2,16,16]}),i.jsx("meshStandardMaterial",{color:"#00ff88",emissive:"#00ff88",emissiveIntensity:.5,transparent:!0,opacity:.9})]}),i.jsxs("mesh",{rotation:[Math.PI/2,0,0],children:[i.jsx("ringGeometry",{args:[.3,.5,8]}),i.jsx("meshStandardMaterial",{color:"#00ff88",transparent:!0,opacity:.6,side:j.DoubleSide})]})]}));B.displayName="TargetMarker";function I(){const e=k.useGaesupStore(s=>s.automation),{position:d}=M(),{activeState:a}=w.useStateSystem(),{mouse:c}=w.useInteractionSystem(),[g,r]=p.useState(()=>[...w.getClickNavigationRoute()]);p.useEffect(()=>w.subscribeClickNavigationRoute(()=>{r([...w.getClickNavigationRoute()])}),[]);const S=c?.target||new j.Vector3,m=a?.position??d,v=c?.isActive||!1,x=e?.queue||{actions:[],currentIndex:0},b=x.actions||[],R=x.currentIndex||0,h=m.distanceTo(S)<1,t=v&&!h,o=b.map(s=>s.type==="move"&&s.target?new j.Vector3(s.target.x,s.target.y,s.target.z):null).filter(s=>s!==null),y=m.clone(),u=g.length>0?g:[S],l=u[0]??o[0]??S;y.y=l.y;const n=t?[y,...u,...o]:o.length>0?[y,...o]:[];return i.jsxs("group",{children:[t&&i.jsx("group",{position:S,children:i.jsx(B,{})}),n.length>1&&i.jsx(K,{points:n,color:R>=0?"#00ff88":"#ffaa00"}),b.map((s,E)=>{if(s.type==="move"&&s.target){const P=E===R,G=E<R;return i.jsx("group",{position:[s.target.x,s.target.y,s.target.z],children:i.jsxs("mesh",{children:[i.jsx("sphereGeometry",{args:[.1,8,8]}),i.jsx("meshStandardMaterial",{color:G?"#888":P?"#ff4444":"#ffaa00",transparent:!0,opacity:G?.3:.8})]})},`action-${E}`)}return null})]})}function A({clickerOptions:e}){const{onClick:d}=w.useClicker(e),a=c=>{c.stopPropagation();const{cameraOption:g,setCameraOption:r}=k.useGaesupStore.getState();if(g?.focus){r({focus:!1});return}d(c)};return i.jsxs("mesh",{position:[0,0,0],rotation:[-Math.PI/2,0,0],onPointerDown:a,visible:!0,userData:{intangible:!0},children:[i.jsx("planeGeometry",{args:[1e3,1e3]}),i.jsx("meshBasicMaterial",{transparent:!0,opacity:0})]})}function L({props:e,children:d}){const a=k.useGaesupStore(o=>o.mode),{gameStates:c}=w.useStateSystem(),g=k.useGaesupStore(o=>o.rideable),r=k.useGaesupStore(o=>o.urls),S=w.useBuildingStore(o=>o.isInEditMode()),m=U.useGenericRefs();if(C(),S||!a||!c||!g||!r||a.type==="character"&&!r.characterUrl||a.type==="vehicle"&&!r.vehicleUrl||a.type==="airplane"&&!r.airplaneUrl)return null;const{canRide:v,isRiding:x,currentRideable:b}=c,R=b?.id,f=p.useMemo(()=>(R?g[R]?.offset:void 0)??z.vec3(),[R,g]),t=(()=>{const o=e.rigidBodyRef??m.rigidBodyRef,y=e.outerGroupRef??m.outerGroupRef,u=e.innerGroupRef??m.innerGroupRef,l=e.colliderRef??m.colliderRef,n={isActive:!0,componentType:a.type,enableRiding:v,isRiderOn:x,offset:f,ref:o,outerGroupRef:y,innerGroupRef:u,colliderRef:l,parts:(e.parts||[]).filter(P=>!!P.url).map(P=>({...P,url:P.url})),...e.onAnimate?{onAnimate:e.onAnimate}:{},...e.onFrame?{onFrame:e.onFrame}:{},...e.onReady?{onReady:e.onReady}:{},...e.onDestroy?{onDestroy:e.onDestroy}:{},...e.onDestory?{onDestory:e.onDestory}:{},...typeof e.baseColor=="string"&&e.baseColor.trim().length>0?{baseColor:e.baseColor}:{},...Array.isArray(e.excludeBaseNodes)&&e.excludeBaseNodes.length>0?{excludeBaseNodes:e.excludeBaseNodes}:{},...e.rigidBodyProps?{rigidBodyProps:e.rigidBodyProps}:{},...e.controllerOptions?{controllerOptions:e.controllerOptions}:{},...e.groundRay?{groundRay:e.groundRay}:{},...e.colliderSize?{colliderSize:e.colliderSize}:{},...e.position?{position:e.position}:{},...e.rotation?{rotation:e.rotation}:{},...e.scale?{scale:e.scale}:{}},s=x&&a.type!=="character"?r.ridingUrl:void 0,E=typeof s=="string"&&s.length>0?{ridingUrl:s}:{};switch(a.type){case"character":return{...n,url:r.characterUrl||""};case"vehicle":return{...n,...E,url:r.vehicleUrl||"",wheelUrl:r.wheelUrl};case"airplane":return{...n,...E,url:r.airplaneUrl||""};default:return{...n,url:r.characterUrl||""}}})();return a.type==="character"&&c.isRiding?null:i.jsx(w.PhysicsEntity,{...t,children:d})}function V(e){const{clickToMove:d,children:a,clickerOptions:c,...g}=e,r={...c??{},...c?.agentRadius===void 0&&g.colliderSize?.radius!==void 0?{agentRadius:g.colliderSize.radius}:{}};return i.jsxs(i.Fragment,{children:[i.jsx(L,{props:g,children:a}),d&&i.jsxs(i.Fragment,{children:[i.jsx(A,{clickerOptions:r}),i.jsx(I,{})]})]})}exports.Clicker=I;exports.ControllerWrapper=V;exports.GroundClicker=A;exports.useKeyboard=C;exports.usePlayerPosition=M;
@@ -0,0 +1 @@
1
+ "use strict";const S=require("react/jsx-runtime"),b=require("react"),O=require("three"),I=require("./index-CJj-Z7Jr.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;
@@ -1 +1 @@
1
- "use strict";const f=require("react"),j=require("./index-co-QAQz9.cjs"),U=require("./runtimeFilter-W6iMw1pL.cjs"),re=require("./assetStore-DVPge_2j.cjs"),se=require("./snapshot-DRqZrbCu.cjs"),c=require("react/jsx-runtime"),W=require("@react-three/fiber"),oe=require("three"),m=require("./eventsStore-Cipkf938.cjs"),V=require("./timeStore-CDN035t4.cjs"),C=require("./weatherStore-1unmwIen.cjs");function ie(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const P=ie(oe);function ae({intervalMs:e=5*60*1e3,slot:t,saveOnUnload:n=!0,saveOnVisibilityChange:r=!0}={}){f.useEffect(()=>{const s=j.getSaveSystem();let o=!1;const a=()=>{o||s.save(t)},u=window.setInterval(a,Math.max(1e3,e)),l=()=>{s.save(t)},g=()=>{document.visibilityState==="hidden"&&s.save(t)};return n&&window.addEventListener("beforeunload",l),r&&document.addEventListener("visibilitychange",g),()=>{o=!0,window.clearInterval(u),n&&window.removeEventListener("beforeunload",l),r&&document.removeEventListener("visibilitychange",g)}},[e,t,n,r])}function ce(e,t){f.useEffect(()=>{const n=j.getSaveSystem();let r=!1;return n.load(e).then(s=>{!r&&t&&t(s)}),()=>{r=!0}},[e,t])}const L="runtime.saveDiagnostics",$="runtime:saveDiagnostic";function K(e={}){const t=Math.max(1,e.maxEntries??50),n=[],r=new Set;let s=1;return{report(o){const a=J(o.error),u={...o,id:s,reportedAt:Date.now(),errorMessage:a,message:H(o,a)};s+=1,n.push(u),n.length>t&&n.splice(0,n.length-t);for(const l of r)l(u);return u},getDiagnostics(){return n.map(o=>({...o}))},getLatest(){const o=n[n.length-1];return o?{...o}:void 0},clear(){n.length=0},subscribe(o){return r.add(o),()=>{r.delete(o)}}}}function H(e,t=J(e.error)){return`Save domain "${e.key}" failed during ${e.phase} for slot "${e.slot}": ${t}`}function J(e){return e instanceof Error?e.message:typeof e=="string"?e:"Unknown save error"}function ue(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.key=="string"&&typeof t.serialize=="function"&&typeof t.hydrate=="function"}function fe(e={}){const t=U.createPluginLogger(e.logger),n=U.createPluginRegistry(e.logger?{logger:e.logger}:{}),r=e.pluginRuntime??"client",s=e.saveSystem??(e.saveOptions?new j.SaveSystem(le(e.saveOptions)):j.getSaveSystem()),o=K(e.saveDiagnostics),a=s.subscribeDiagnostics(i=>{const d=o.report(i);t.warn(d.message,d),n.context.events.emit($,d)}),u=new Map;n.context.services.register(L,o,"gaesup.runtime");for(const i of U.filterPluginsForRuntime(e.plugins??[],r))n.register(i);const l=i=>{if(u.has(i.key))return;const d=s.register({key:i.key,serialize:()=>i.serialize()??null,hydrate:i.hydrate});u.set(i.key,d)};for(const i of e.saveBindings??[])l(i);const g=()=>{for(const i of n.context.save.list())ue(i.value)&&l(i.value)},w=async()=>{const i=e.assets?.source;i&&await re.useAssetStore.getState().loadAssets(i)};return{pluginRuntime:r,plugins:n,save:s,saveDiagnostics:o,loadAssets:w,getService:i=>n.context.services.get(i),requireService:i=>n.context.services.require(i),setup:async()=>{e.assets?.loadOnCreate&&await w(),await n.setupAll(),g()},dispose:async()=>{await n.disposeAll(),a();for(const i of u.values())i();u.clear(),n.context.services.remove(L)}}}function le(e){return{...e}}const Q={lighting:{ambientIntensity:1,directionalIntensity:1,directionalPosition:{x:0,y:10,z:0}}};function I(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function O(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function _(e){return Array.isArray(e)?e.map(t=>O(t)):[]}function k(e,t){const n=e[t];return I(n)?n:void 0}function F(e){if(Array.isArray(e)&&e.length>=3){const[t,n,r]=e;if(typeof t=="number"&&typeof n=="number"&&typeof r=="number")return{x:t,y:n,z:r}}if(I(e)&&typeof e.x=="number"&&typeof e.y=="number"&&typeof e.z=="number")return{x:e.x,y:e.y,z:e.z}}function de(e){if(!I(e)||typeof e.id!="string")return null;const t=F(e.position)??{x:0,y:0,z:0},n=F(e.rotation)??{x:0,y:0,z:0},r=I(e.metadata)?O(e.metadata):void 0,s=I(e.behavior)?e.behavior:void 0,o=s&&typeof s.mode=="string"?s.mode:void 0;return{id:e.id,name:typeof e.name=="string"?e.name:e.id,position:t,rotation:n,...typeof e.modelUrl=="string"?{modelUrl:e.modelUrl}:{},...o?{behavior:o}:{},...r?{metadata:r}:{}}}function me(e){const t=e?.instances;return Array.isArray(t)?t.map(de).filter(n=>n!==null):[]}function X(e){if(!e)return;const t=I(e.cameraOption)?e.cameraOption:e,n=F(t.position);if(!n)return;const r=F(t.rotation)??{x:0,y:0,z:0},s=I(e.mode)?e.mode:void 0,o=typeof e.mode=="string"?e.mode:s&&typeof s.control=="string"?s.control:"default",a=I(e.settings)?O(e.settings):I(e.cameraOption)?O(e.cameraOption):void 0;return{position:n,rotation:r,mode:o,...a?{settings:a}:{}}}function Z(e,t,n){const r=k(e,"building"),s=X(k(e,"camera"));return{id:t,name:n,buildings:{wallGroups:_(r?.wallGroups),tileGroups:_(r?.tileGroups),blocks:_(r?.blocks),meshes:_(r?.meshes)},npcs:me(k(e,"npc")),environment:Q,...s?{camera:s}:{}}}function Y(e){const t=e.slice(e.lastIndexOf("_")+1),n=Number(t);return Number.isFinite(n)?n:Date.now()}function ee(e){const t=e.lastIndexOf("_");return t>0?e.slice(0,t):e}function te(e,t){if(e)return{...e,createdAt:e.createdAt??t,updatedAt:e.updatedAt??t}}function ge(e,t,n,r){const s=Y(t),o=ee(t),a={version:"1.0.0",timestamp:s,world:Z(se.collectSaveDomains(e),o,n??o)},u=te(r,s);return u?{...a,metadata:u}:a}class he{byKind=new Map;global=new Set;on(t,n){let r=this.byKind.get(t);return r||(r=new Set,this.byKind.set(t,r)),r.add(n),()=>{r.delete(n)}}onAny(t){return this.global.add(t),()=>{this.global.delete(t)}}emit(t){const n=this.byKind.get(t.kind);if(n){for(const r of n)if(r(t)===!0)return}for(const r of this.global)r(t)}clear(){this.byKind.clear(),this.global.clear()}}let G=null;function ne(){return G||(G=new he),G}function N(e,t,n=!0){f.useEffect(()=>n?ne().on(e,t):void 0,[e,t,n])}function Se(){const e=m.useInventoryStore(n=>n.getEquipped());return e?m.getItemRegistry().get(e.itemId)?.toolKind??null:null}function ye({position:e,rotationY:t=0,hp:n=3,woodDrop:r=2,regrowMinutes:s=1440,hitRange:o=1.6,trunkColor:a="#6b4a2a",foliageColor:u="#3f8a3a",scale:l=1}){const g=f.useRef(null),[w,i]=f.useState(n),[d,h]=f.useState(!1),S=f.useRef(0),y=f.useRef(-1/0),p=f.useCallback(D=>{if(d)return;const M=D.origin[0]-e[0],x=D.origin[2]-e[2],A=M*M+x*x,T=o+D.range*.5;if(!(A>T*T))return y.current=performance.now(),i(q=>{const B=q-1;return B<=0?(m.useInventoryStore.getState().add("wood",r)>0?m.notify("warn","인벤토리가 가득 찼습니다"):m.notify("reward",`목재 +${r}`),h(!0),S.current=V.useTimeStore.getState().totalMinutes+s,n):B}),!0},[d,e,o,r,s,n]);N("axe",p),f.useEffect(()=>d?V.useTimeStore.subscribe((M,x)=>{M.totalMinutes!==x.totalMinutes&&M.totalMinutes>=S.current&&(h(!1),i(n))}):void 0,[d,n]),W.useFrame((D,M)=>{const x=g.current;if(!x)return;const A=(performance.now()-y.current)/1e3;if(A<.4){const T=A/.4,q=Math.sin(T*Math.PI*6)*(1-T)*.18;x.rotation.z=q}else Math.abs(x.rotation.z)>1e-4&&(x.rotation.z*=Math.max(0,1-M*12))});const b=w<n,R=1.6*l,v=.18*l,E=.95*l,z=f.useMemo(()=>{const D=new P.Color(u);return b&&D.lerp(new P.Color("#a55"),.06*(n-w)),D},[u,b,n,w]);return d?c.jsx("group",{position:e,rotation:[0,t,0],children:c.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,.18*l,0],children:[c.jsx("cylinderGeometry",{args:[v,v*1.15,.36*l,12]}),c.jsx("meshToonMaterial",{color:a})]})}):c.jsxs("group",{ref:g,position:e,rotation:[0,t,0],children:[c.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,R*.5,0],children:[c.jsx("cylinderGeometry",{args:[v*.85,v,R,12]}),c.jsx("meshToonMaterial",{color:a})]}),c.jsxs("mesh",{castShadow:!0,position:[0,R+E*.6,0],children:[c.jsx("coneGeometry",{args:[E,E*1.6,14]}),c.jsx("meshToonMaterial",{color:z})]}),c.jsxs("mesh",{castShadow:!0,position:[0,R+E*1.5,0],children:[c.jsx("coneGeometry",{args:[E*.75,E*1.2,14]}),c.jsx("meshToonMaterial",{color:z})]})]})}const pe=[{itemId:"fish-bass",weight:60},{itemId:"fish-tuna",weight:25},{itemId:"fish-koi",weight:10}];function we(e,t,n){const r=[];for(const a of n)a.startsWith(t)&&r.push(a.slice(t.length));if(r.length===0)return e;const s=new Set(r),o=e.filter(a=>s.has(a.itemId));return o.length>0?o:e}function ve(e){if(e.length===0)return null;const t=e.reduce((r,s)=>r+Math.max(0,s.weight),0);if(t<=0)return null;let n=Math.random()*t;for(const r of e)if(n-=Math.max(0,r.weight),n<=0)return r.itemId;return e[e.length-1].itemId}function be({position:e,radius:t=3,pool:n=pe,cooldownMs:r=600,successChance:s=.6,showRipple:o=!0,rippleColor:a="#9ad9ff"}){const u=f.useRef(-1/0),l=f.useRef(null),g=f.useRef(-1/0),w=f.useCallback(i=>{const d=i.origin[0]-e[0],h=i.origin[2]-e[2];if(d*d+h*h>t*t)return;const S=performance.now();if(S-u.current<r)return!0;u.current=S,g.current=S;const y=C.useWeatherStore.getState().fishingBonus();if(Math.random()>Math.min(.95,s+y))return m.notify("warn","놓쳤다…"),!0;const p=we(n,"fish:",m.useEventsStore.getState().tags),b=ve(p);if(!b)return!0;const R=m.getItemRegistry().get(b);return m.useInventoryStore.getState().add(b,1)>0?m.notify("warn","인벤토리가 가득 찼습니다"):m.notify("reward",`${R?.name??b} 낚음!`),!0},[e,t,r,n,s]);return N("rod",w),W.useFrame(()=>{const i=l.current;if(!i)return;const d=(performance.now()-g.current)/1e3;if(d<.6){const h=d/.6;i.scale.setScalar(.4+h*1.4);const S=i.material;S.opacity=.55*(1-h)}else i.scale.setScalar(0)}),c.jsx("group",{position:e,children:o&&c.jsxs("mesh",{ref:l,rotation:[-Math.PI/2,0,0],position:[0,.04,0],children:[c.jsx("ringGeometry",{args:[.4,.6,32]}),c.jsx("meshBasicMaterial",{color:a,transparent:!0,opacity:0,depthWrite:!1})]})})}const xe=[{itemId:"bug-butterfly",weight:70},{itemId:"bug-beetle",weight:22},{itemId:"bug-stag",weight:8}];function Ie(e,t,n){const r=[];for(const a of n)a.startsWith(t)&&r.push(a.slice(t.length));if(r.length===0)return e;const s=new Set(r),o=e.filter(a=>s.has(a.itemId));return o.length>0?o:e}function Re(e){if(e.length===0)return null;const t=e.reduce((r,s)=>r+Math.max(0,s.weight),0);if(t<=0)return null;let n=Math.random()*t;for(const r of e)if(n-=Math.max(0,r.weight),n<=0)return r.itemId;return e[e.length-1].itemId}function Ee({position:e,radius:t=2.4,pool:n=xe,cooldownMs:r=600,successChance:s=.7,bugColor:o="#ffd0e0",hoverHeight:a=1.2}){const u=f.useRef(-1/0),l=f.useRef(null),[g,w]=f.useState(!0),i=f.useRef(-1/0),d=f.useCallback(h=>{if(!g)return;const S=h.origin[0]-e[0],y=h.origin[2]-e[2];if(S*S+y*y>t*t)return;const p=performance.now();if(p-u.current<r)return!0;u.current=p;const b=C.useWeatherStore.getState().bugBonus();if(Math.random()>Math.min(.95,Math.max(.05,s+b)))return m.notify("warn","날아갔다…"),w(!1),i.current=p+8e3,!0;const R=Ie(n,"bug:",m.useEventsStore.getState().tags),v=Re(R);if(!v)return!0;const E=m.getItemRegistry().get(v);return m.useInventoryStore.getState().add(v,1)>0?m.notify("warn","인벤토리가 가득 찼습니다"):m.notify("reward",`${E?.name??v} 잡았다!`),w(!1),i.current=p+12e3,!0},[e,t,r,n,s,g]);return N("net",d),W.useFrame(({clock:h})=>{const S=performance.now();!g&&S>=i.current&&w(!0);const y=l.current;if(!y||!g)return;const p=h.elapsedTime;y.position.x=Math.sin(p*1.2)*.6,y.position.z=Math.cos(p*.9)*.6,y.position.y=a+Math.sin(p*2.6)*.15,y.rotation.y=p*1.4}),g?c.jsx("group",{position:e,children:c.jsxs("mesh",{ref:l,children:[c.jsx("sphereGeometry",{args:[.12,10,10]}),c.jsx("meshToonMaterial",{color:o})]})}):c.jsx("group",{position:e})}exports.BugSpot=Ee;exports.DEFAULT_RUNTIME_SAVE_DIAGNOSTICS_SERVICE_ID=L;exports.DEFAULT_WORLD_SAVE_ENVIRONMENT=Q;exports.FishSpot=be;exports.RUNTIME_SAVE_DIAGNOSTIC_EVENT=$;exports.TreeObject=ye;exports.createCameraSaveDataFromDomain=X;exports.createGaesupRuntime=fe;exports.createRuntimeSaveDiagnostics=K;exports.createSaveDataFromSaveSystem=ge;exports.createWorldDataFromSaveDomains=Z;exports.formatRuntimeSaveDiagnostic=H;exports.getToolEvents=ne;exports.normalizeSaveMetadata=te;exports.parseWorldSaveId=ee;exports.parseWorldSaveTimestamp=Y;exports.useAutoSave=ae;exports.useEquippedToolKind=Se;exports.useLoadOnMount=ce;exports.useToolUse=N;
1
+ "use strict";const f=require("react"),j=require("./index-De3ev_jU.cjs"),U=require("./runtimeFilter-W6iMw1pL.cjs"),re=require("./assetStore-DVPge_2j.cjs"),se=require("./snapshot-DRqZrbCu.cjs"),c=require("react/jsx-runtime"),W=require("@react-three/fiber"),oe=require("three"),m=require("./eventsStore-Cipkf938.cjs"),V=require("./timeStore-CDN035t4.cjs"),C=require("./weatherStore-1unmwIen.cjs");function ie(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const P=ie(oe);function ae({intervalMs:e=5*60*1e3,slot:t,saveOnUnload:n=!0,saveOnVisibilityChange:r=!0}={}){f.useEffect(()=>{const s=j.getSaveSystem();let o=!1;const a=()=>{o||s.save(t)},u=window.setInterval(a,Math.max(1e3,e)),l=()=>{s.save(t)},g=()=>{document.visibilityState==="hidden"&&s.save(t)};return n&&window.addEventListener("beforeunload",l),r&&document.addEventListener("visibilitychange",g),()=>{o=!0,window.clearInterval(u),n&&window.removeEventListener("beforeunload",l),r&&document.removeEventListener("visibilitychange",g)}},[e,t,n,r])}function ce(e,t){f.useEffect(()=>{const n=j.getSaveSystem();let r=!1;return n.load(e).then(s=>{!r&&t&&t(s)}),()=>{r=!0}},[e,t])}const L="runtime.saveDiagnostics",$="runtime:saveDiagnostic";function K(e={}){const t=Math.max(1,e.maxEntries??50),n=[],r=new Set;let s=1;return{report(o){const a=J(o.error),u={...o,id:s,reportedAt:Date.now(),errorMessage:a,message:H(o,a)};s+=1,n.push(u),n.length>t&&n.splice(0,n.length-t);for(const l of r)l(u);return u},getDiagnostics(){return n.map(o=>({...o}))},getLatest(){const o=n[n.length-1];return o?{...o}:void 0},clear(){n.length=0},subscribe(o){return r.add(o),()=>{r.delete(o)}}}}function H(e,t=J(e.error)){return`Save domain "${e.key}" failed during ${e.phase} for slot "${e.slot}": ${t}`}function J(e){return e instanceof Error?e.message:typeof e=="string"?e:"Unknown save error"}function ue(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.key=="string"&&typeof t.serialize=="function"&&typeof t.hydrate=="function"}function fe(e={}){const t=U.createPluginLogger(e.logger),n=U.createPluginRegistry(e.logger?{logger:e.logger}:{}),r=e.pluginRuntime??"client",s=e.saveSystem??(e.saveOptions?new j.SaveSystem(le(e.saveOptions)):j.getSaveSystem()),o=K(e.saveDiagnostics),a=s.subscribeDiagnostics(i=>{const d=o.report(i);t.warn(d.message,d),n.context.events.emit($,d)}),u=new Map;n.context.services.register(L,o,"gaesup.runtime");for(const i of U.filterPluginsForRuntime(e.plugins??[],r))n.register(i);const l=i=>{if(u.has(i.key))return;const d=s.register({key:i.key,serialize:()=>i.serialize()??null,hydrate:i.hydrate});u.set(i.key,d)};for(const i of e.saveBindings??[])l(i);const g=()=>{for(const i of n.context.save.list())ue(i.value)&&l(i.value)},w=async()=>{const i=e.assets?.source;i&&await re.useAssetStore.getState().loadAssets(i)};return{pluginRuntime:r,plugins:n,save:s,saveDiagnostics:o,loadAssets:w,getService:i=>n.context.services.get(i),requireService:i=>n.context.services.require(i),setup:async()=>{e.assets?.loadOnCreate&&await w(),await n.setupAll(),g()},dispose:async()=>{await n.disposeAll(),a();for(const i of u.values())i();u.clear(),n.context.services.remove(L)}}}function le(e){return{...e}}const Q={lighting:{ambientIntensity:1,directionalIntensity:1,directionalPosition:{x:0,y:10,z:0}}};function I(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function O(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function _(e){return Array.isArray(e)?e.map(t=>O(t)):[]}function k(e,t){const n=e[t];return I(n)?n:void 0}function F(e){if(Array.isArray(e)&&e.length>=3){const[t,n,r]=e;if(typeof t=="number"&&typeof n=="number"&&typeof r=="number")return{x:t,y:n,z:r}}if(I(e)&&typeof e.x=="number"&&typeof e.y=="number"&&typeof e.z=="number")return{x:e.x,y:e.y,z:e.z}}function de(e){if(!I(e)||typeof e.id!="string")return null;const t=F(e.position)??{x:0,y:0,z:0},n=F(e.rotation)??{x:0,y:0,z:0},r=I(e.metadata)?O(e.metadata):void 0,s=I(e.behavior)?e.behavior:void 0,o=s&&typeof s.mode=="string"?s.mode:void 0;return{id:e.id,name:typeof e.name=="string"?e.name:e.id,position:t,rotation:n,...typeof e.modelUrl=="string"?{modelUrl:e.modelUrl}:{},...o?{behavior:o}:{},...r?{metadata:r}:{}}}function me(e){const t=e?.instances;return Array.isArray(t)?t.map(de).filter(n=>n!==null):[]}function X(e){if(!e)return;const t=I(e.cameraOption)?e.cameraOption:e,n=F(t.position);if(!n)return;const r=F(t.rotation)??{x:0,y:0,z:0},s=I(e.mode)?e.mode:void 0,o=typeof e.mode=="string"?e.mode:s&&typeof s.control=="string"?s.control:"default",a=I(e.settings)?O(e.settings):I(e.cameraOption)?O(e.cameraOption):void 0;return{position:n,rotation:r,mode:o,...a?{settings:a}:{}}}function Z(e,t,n){const r=k(e,"building"),s=X(k(e,"camera"));return{id:t,name:n,buildings:{wallGroups:_(r?.wallGroups),tileGroups:_(r?.tileGroups),blocks:_(r?.blocks),meshes:_(r?.meshes)},npcs:me(k(e,"npc")),environment:Q,...s?{camera:s}:{}}}function Y(e){const t=e.slice(e.lastIndexOf("_")+1),n=Number(t);return Number.isFinite(n)?n:Date.now()}function ee(e){const t=e.lastIndexOf("_");return t>0?e.slice(0,t):e}function te(e,t){if(e)return{...e,createdAt:e.createdAt??t,updatedAt:e.updatedAt??t}}function ge(e,t,n,r){const s=Y(t),o=ee(t),a={version:"1.0.0",timestamp:s,world:Z(se.collectSaveDomains(e),o,n??o)},u=te(r,s);return u?{...a,metadata:u}:a}class he{byKind=new Map;global=new Set;on(t,n){let r=this.byKind.get(t);return r||(r=new Set,this.byKind.set(t,r)),r.add(n),()=>{r.delete(n)}}onAny(t){return this.global.add(t),()=>{this.global.delete(t)}}emit(t){const n=this.byKind.get(t.kind);if(n){for(const r of n)if(r(t)===!0)return}for(const r of this.global)r(t)}clear(){this.byKind.clear(),this.global.clear()}}let G=null;function ne(){return G||(G=new he),G}function N(e,t,n=!0){f.useEffect(()=>n?ne().on(e,t):void 0,[e,t,n])}function Se(){const e=m.useInventoryStore(n=>n.getEquipped());return e?m.getItemRegistry().get(e.itemId)?.toolKind??null:null}function ye({position:e,rotationY:t=0,hp:n=3,woodDrop:r=2,regrowMinutes:s=1440,hitRange:o=1.6,trunkColor:a="#6b4a2a",foliageColor:u="#3f8a3a",scale:l=1}){const g=f.useRef(null),[w,i]=f.useState(n),[d,h]=f.useState(!1),S=f.useRef(0),y=f.useRef(-1/0),p=f.useCallback(D=>{if(d)return;const M=D.origin[0]-e[0],x=D.origin[2]-e[2],A=M*M+x*x,T=o+D.range*.5;if(!(A>T*T))return y.current=performance.now(),i(q=>{const B=q-1;return B<=0?(m.useInventoryStore.getState().add("wood",r)>0?m.notify("warn","인벤토리가 가득 찼습니다"):m.notify("reward",`목재 +${r}`),h(!0),S.current=V.useTimeStore.getState().totalMinutes+s,n):B}),!0},[d,e,o,r,s,n]);N("axe",p),f.useEffect(()=>d?V.useTimeStore.subscribe((M,x)=>{M.totalMinutes!==x.totalMinutes&&M.totalMinutes>=S.current&&(h(!1),i(n))}):void 0,[d,n]),W.useFrame((D,M)=>{const x=g.current;if(!x)return;const A=(performance.now()-y.current)/1e3;if(A<.4){const T=A/.4,q=Math.sin(T*Math.PI*6)*(1-T)*.18;x.rotation.z=q}else Math.abs(x.rotation.z)>1e-4&&(x.rotation.z*=Math.max(0,1-M*12))});const b=w<n,R=1.6*l,v=.18*l,E=.95*l,z=f.useMemo(()=>{const D=new P.Color(u);return b&&D.lerp(new P.Color("#a55"),.06*(n-w)),D},[u,b,n,w]);return d?c.jsx("group",{position:e,rotation:[0,t,0],children:c.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,.18*l,0],children:[c.jsx("cylinderGeometry",{args:[v,v*1.15,.36*l,12]}),c.jsx("meshToonMaterial",{color:a})]})}):c.jsxs("group",{ref:g,position:e,rotation:[0,t,0],children:[c.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,R*.5,0],children:[c.jsx("cylinderGeometry",{args:[v*.85,v,R,12]}),c.jsx("meshToonMaterial",{color:a})]}),c.jsxs("mesh",{castShadow:!0,position:[0,R+E*.6,0],children:[c.jsx("coneGeometry",{args:[E,E*1.6,14]}),c.jsx("meshToonMaterial",{color:z})]}),c.jsxs("mesh",{castShadow:!0,position:[0,R+E*1.5,0],children:[c.jsx("coneGeometry",{args:[E*.75,E*1.2,14]}),c.jsx("meshToonMaterial",{color:z})]})]})}const pe=[{itemId:"fish-bass",weight:60},{itemId:"fish-tuna",weight:25},{itemId:"fish-koi",weight:10}];function we(e,t,n){const r=[];for(const a of n)a.startsWith(t)&&r.push(a.slice(t.length));if(r.length===0)return e;const s=new Set(r),o=e.filter(a=>s.has(a.itemId));return o.length>0?o:e}function ve(e){if(e.length===0)return null;const t=e.reduce((r,s)=>r+Math.max(0,s.weight),0);if(t<=0)return null;let n=Math.random()*t;for(const r of e)if(n-=Math.max(0,r.weight),n<=0)return r.itemId;return e[e.length-1].itemId}function be({position:e,radius:t=3,pool:n=pe,cooldownMs:r=600,successChance:s=.6,showRipple:o=!0,rippleColor:a="#9ad9ff"}){const u=f.useRef(-1/0),l=f.useRef(null),g=f.useRef(-1/0),w=f.useCallback(i=>{const d=i.origin[0]-e[0],h=i.origin[2]-e[2];if(d*d+h*h>t*t)return;const S=performance.now();if(S-u.current<r)return!0;u.current=S,g.current=S;const y=C.useWeatherStore.getState().fishingBonus();if(Math.random()>Math.min(.95,s+y))return m.notify("warn","놓쳤다…"),!0;const p=we(n,"fish:",m.useEventsStore.getState().tags),b=ve(p);if(!b)return!0;const R=m.getItemRegistry().get(b);return m.useInventoryStore.getState().add(b,1)>0?m.notify("warn","인벤토리가 가득 찼습니다"):m.notify("reward",`${R?.name??b} 낚음!`),!0},[e,t,r,n,s]);return N("rod",w),W.useFrame(()=>{const i=l.current;if(!i)return;const d=(performance.now()-g.current)/1e3;if(d<.6){const h=d/.6;i.scale.setScalar(.4+h*1.4);const S=i.material;S.opacity=.55*(1-h)}else i.scale.setScalar(0)}),c.jsx("group",{position:e,children:o&&c.jsxs("mesh",{ref:l,rotation:[-Math.PI/2,0,0],position:[0,.04,0],children:[c.jsx("ringGeometry",{args:[.4,.6,32]}),c.jsx("meshBasicMaterial",{color:a,transparent:!0,opacity:0,depthWrite:!1})]})})}const xe=[{itemId:"bug-butterfly",weight:70},{itemId:"bug-beetle",weight:22},{itemId:"bug-stag",weight:8}];function Ie(e,t,n){const r=[];for(const a of n)a.startsWith(t)&&r.push(a.slice(t.length));if(r.length===0)return e;const s=new Set(r),o=e.filter(a=>s.has(a.itemId));return o.length>0?o:e}function Re(e){if(e.length===0)return null;const t=e.reduce((r,s)=>r+Math.max(0,s.weight),0);if(t<=0)return null;let n=Math.random()*t;for(const r of e)if(n-=Math.max(0,r.weight),n<=0)return r.itemId;return e[e.length-1].itemId}function Ee({position:e,radius:t=2.4,pool:n=xe,cooldownMs:r=600,successChance:s=.7,bugColor:o="#ffd0e0",hoverHeight:a=1.2}){const u=f.useRef(-1/0),l=f.useRef(null),[g,w]=f.useState(!0),i=f.useRef(-1/0),d=f.useCallback(h=>{if(!g)return;const S=h.origin[0]-e[0],y=h.origin[2]-e[2];if(S*S+y*y>t*t)return;const p=performance.now();if(p-u.current<r)return!0;u.current=p;const b=C.useWeatherStore.getState().bugBonus();if(Math.random()>Math.min(.95,Math.max(.05,s+b)))return m.notify("warn","날아갔다…"),w(!1),i.current=p+8e3,!0;const R=Ie(n,"bug:",m.useEventsStore.getState().tags),v=Re(R);if(!v)return!0;const E=m.getItemRegistry().get(v);return m.useInventoryStore.getState().add(v,1)>0?m.notify("warn","인벤토리가 가득 찼습니다"):m.notify("reward",`${E?.name??v} 잡았다!`),w(!1),i.current=p+12e3,!0},[e,t,r,n,s,g]);return N("net",d),W.useFrame(({clock:h})=>{const S=performance.now();!g&&S>=i.current&&w(!0);const y=l.current;if(!y||!g)return;const p=h.elapsedTime;y.position.x=Math.sin(p*1.2)*.6,y.position.z=Math.cos(p*.9)*.6,y.position.y=a+Math.sin(p*2.6)*.15,y.rotation.y=p*1.4}),g?c.jsx("group",{position:e,children:c.jsxs("mesh",{ref:l,children:[c.jsx("sphereGeometry",{args:[.12,10,10]}),c.jsx("meshToonMaterial",{color:o})]})}):c.jsx("group",{position:e})}exports.BugSpot=Ee;exports.DEFAULT_RUNTIME_SAVE_DIAGNOSTICS_SERVICE_ID=L;exports.DEFAULT_WORLD_SAVE_ENVIRONMENT=Q;exports.FishSpot=be;exports.RUNTIME_SAVE_DIAGNOSTIC_EVENT=$;exports.TreeObject=ye;exports.createCameraSaveDataFromDomain=X;exports.createGaesupRuntime=fe;exports.createRuntimeSaveDiagnostics=K;exports.createSaveDataFromSaveSystem=ge;exports.createWorldDataFromSaveDomains=Z;exports.formatRuntimeSaveDiagnostic=H;exports.getToolEvents=ne;exports.normalizeSaveMetadata=te;exports.parseWorldSaveId=ee;exports.parseWorldSaveTimestamp=Y;exports.useAutoSave=ae;exports.useEquippedToolKind=Se;exports.useLoadOnMount=ce;exports.useToolUse=N;
@@ -0,0 +1 @@
1
+ "use strict";const u=require("react"),j=require("@react-three/fiber"),rt=require("three"),q=require("./index-CJj-Z7Jr.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;