1import{c as m}from"./chunk-ATLPHYUF.js";(function r(a,h,e){function t(i,u){if(!h[i]){if(!a[i]){var n=typeof m=="function"&&m;if(!u&&n)return n(i,!0);if(o)return o(i,!0);var s=new Error("Cannot find module '"+i+"'");throw s.code="MODULE_NOT_FOUND",s}var f=h[i]={exports:{}};a[i][0].call(f.exports,function(d){var p=a[i][1][d];return t(p||d)},f,f.exports,r,a,h,e)}return h[i].exports}for(var o=typeof m=="function"&&m,l=0;l<e.length;l++)t(e[l]);return t})({1:[function(r,a,h){"use strict";if(typeof AFRAME>"u")throw new Error("Component attempted to register before AFRAME was available.");r("./src/physics-collider.js"),r("./src/physics-collision-filter.js"),r("./src/physics-sleepy.js"),r("./src/body-merger.js")},{"./src/body-merger.js":2,"./src/physics-collider.js":3,"./src/physics-collision-filter.js":4,"./src/physics-sleepy.js":5}],2:[function(r,a,h){"use strict";AFRAME.registerComponent("body-merger",{schema:{default:"static-body"},init:function(){let e=t=>{t.target===this.el&&(this.el.removeEventListener("body-loaded",e),this.merge
1())};this.el.body?this.merge():this.el.addEventListener("body-loaded",e)},merge:function(){let e=this.el.body,t=new THREE.Matrix4,o=new THREE.Quaternion,l=new THREE.Vector3,i=new THREE.Vector3(1,1,1),u=new CANNON.Vec3,n=new CANNON.Quaternion;for(let s of this.el.childNodes)if(!(!s.body||!s.getAttribute(this.data))){for(s.object3D.updateMatrix();s.body.shapes.length;)l.copy(s.body.shapeOffsets.pop()),o.copy(s.body.shapeOrientations.pop()),t.compose(l,o,i),t.multiply(s.object3D.matrix),t.decompose(l,o,i),u.copy(l),n.copy(o),e.addShape(s.body.shapes.pop(),u,n);s.removeAttribute(this.data)}}})},{}],3:[function(r,a,h){"use strict";AFRAME.registerComponent("physics-collider",{schema:{ignoreSleep:{default:!0}},init:function(){this.collisions=new Set,this.currentCollisions=new Set,this.newCollisions=[],this.clearedCollisions=[],this.collisionEventDetails={els:this.newCollisions,clearedEls:this.clearedCollisions}},update:function(){this.el.body?this.updateBody():this.el.addEventListener("body-loaded",this.updateBody.bind(this),{once:!0})},tick:(function(){return function(){if(!this.el.body)return;let o=this.currentCollisions,l=this.el.body.id,i=this.el.body.world.bodyOverlapKeeper.current,u=this.el.body.world.idToBodyMap,n=this.collisions,s=this.newCollisions,f=this.clearedCollisions,d=0,p=(i[d]&4294901760)>>16,c;for(s.length=f.length=0,o.clear();d<i.length&&p<l;)u[p]&&(c=u[p].el,(i[d]&65535)===l&&(o.add(c),n.has(c)||s.push(c))),p=(i[++d]&4294901760)>>16;for(;d<i.length&&p===l;)u[i[d]&65535]&&(c=u[i[d]&65535].el,o.add(c),n.has(c)||s.push(c)),p=(i[++d]&4294901760)>>16;for(let y of n)o.has(y)||(f.push(y),n.delete(y));for(let y of s)n.add(y);(s.length||f.length)&&this.el.emit("collisions",this.collisionEventDetails)}})(),remove:function(){this.originalSleepConfig&&AFRAME.utils.extend(this.el.body,this.originalSleepConfig)},updateBody:function(e){e!==void 0&&e.target!==this.el||(this.data.ignoreSleep?(this.el.body.allowSleep=!1,this.el.body.type=window.CANNON.Body.KINEMATIC,this.el.body.sleepSpeedLimit=0):this.originalSleepConfig===void 0?this.originalSleepConfig={allowSleep:this.el.body.allowSleep,sleepSpeedLimit:this.el.body.sleepSpeedLimit,type:this.el.body.type}:AFRAME.utils.extend(this.el.body,this.originalSleepConfig))}})},{}],4:[function(r,a,h){"use strict";AFRAME.registerComponent("collision-filter",{schema:{group:{default:"default"},collidesWith:{default:["default"]},collisionForces:{default:!0}},init:function(){this.updateBodyBound=this.updateBody.bind(this),this.system.registerMe(this),this.el.addEventListener("body-loaded",this.updateBodyBound)},update:function(){this.system.registerMe(this),this.el.body&&this.updateBody()},remove:function(){this.el.removeEventListener("body-loaded",this.updateBodyBound)},updateBody:function(e){e!==void 0&&e.target!==this.el||(this.el.body.collisionFilterMask=this.system.getFilterCode(this.data.collidesWith),this.el.body.collisionFilterGroup=this.system.getFilterCode(this.data.group),this.el.body.collisionResponse=this.data.collisionForces)}}),AFRAME.registerSystem("collision-filter",{schema:{collisionGroups:{default:["default"]}},dependencies:["physics"],init:function(){this.maxGroups=Math.log2(Number.MAX_SAFE_INTEGER)},registerMe:function(e){let t=[e.data.group,...e.data.collidesWith].filter(o=>this.data.collisionGroups.indexOf(o)===-1);if(this.data.collisionGroups.push(...t),this.data.collisionGroups.length>this.maxGroups)throw new Error("Too many collision groups")},getFilterCode:function(e){let t=0;return Array.isArray(e)||(e=[e]),e.forEach(o=>{t+=Math.floor(Math.pow(2,this.data.collisionGroups.indexOf(o)))}),t}})},{}],5:[function(r,a,h){"use strict";AFRAME.registerComponent("sleepy",{schema:{allowSleep:{default:!0},speedLimit:{default:.25,type:"number"},delay:{default:.25,type:"number"},linearDamping:{default:.99,type:"number"},angularDamping:{default:.99,type:"number"},holdState:{default:"grabbed"}},init:function(){this.updateBodyBound=this.updateBody.bind(this),this.holdStateBound=this.holdState.bind(this),this.resumeStateBound=this.resumeState.bind(this),this.el.addEventListener("body-loaded",this.updateBodyBound)},update:function(){this.el.body&&this.updateBody()},remove:function(){this.el.removeEventListener("body-loaded",this.updateBodyBound),this.el.removeEventListener("stateadded",this.holdStateBound),this.el.removeEventListener("stateremoved",this.resumeStateBound)},updateBody:function(e){if(!(e!==void 0&&e.target!==this.el)){if(this.data.allowSleep)try{this.el.body.world.allowSleep=!0}catch(t){console.error('Unable to activate sleep in physics.`sleepy` requires "local" physics driver')}this.el.body.allowSleep=this.data.allowSleep,this.el.body.sleepSpeedLimit=this.data.speedLimit,this.el.body.sleepTimeLimit=this.data.delay,this.el.body.linearDamping=this.data.linearDamping,this.el.body.angularDamping=this.data.angularDamping,this.data.allowSleep?(this.el.addEventListener("stateadded",this.holdStateBound),this.el.addEventListener("stateremoved",this.resumeStateBound)):(this.el.removeEventListener("stateadded",this.holdStateBound),this.el.removeEventListener("stateremoved",this.resumeStateBound))}},holdState:function(e){let t=this.data.holdState;(e.detail===t||e.detail.state===t)&&(this.el.body.allowSleep=!1)},resumeState:function(e){let t=this.data.holdState;(e.detail===t||e.detail.state===t)&&(this.el.body.allowSleep=this.data.allowSleep)}})},{}]},{},[1]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.