PageSourceSearch

https://cdn.v1v2.io/_next/static/chunks/6129-1867338ff92ca825.js

js v1v2.io collected 2026-09-25 21:07:29 UTC 11,623 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6129],{86129:(e,t,s)=>{s.d(t,{k:()=>C});var o=s(96540),i=s(39437),n=s(92267),a=s(17335),r=s(32334),l=s(99842);let d={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function h(e){let t=await fetch(e);if(t.ok)return t.json();throw Error(t.statusText)}async function c(e){if(!e)throw Error("No basePath supplied");return await h(`${e}/profilesList.json`)}async function u(e,t,s=null,o=!0){let i,n;if(!e)throw Error("No xrInputSource supplied");if(!t)throw Error("No basePath supplied");let a=await c(t);if(e.profiles.some(e=>{let s=a[e];return s&&(i={profileId:e,profilePath:`${t}/${s.path}`,deprecated:!!s.deprecated}),!!i}),!i){if(!s)throw Error("No matching profile name found");let e=a[s];if(!e)throw Error(`No matching profile name found and default profile "${s}" missing.`);i={profileId:s,profilePath:`${t}/${e.path}`,deprecated:!!e.deprecated}}let r=await h(i.profilePath);if(o){let t;if(!(t="any"===e.handedness?r.layouts[Object.keys(r.layouts)[0]]:r.layouts[e.handedness]))throw Error(`No matching handedness, ${e.handedness}, in profile ${i.profileId}`);t.assetPath&&(n=i.profilePath.replace("profile.json",t.assetPath))}return{profile:r,assetPath:n}}let p={xAxis:0,yAxis:0,button:0,state:d.ComponentState.DEFAULT};class m{constructor(e){(0,l.A)(this,"value",void 0),(0,l.A)(this,"componentProperty",void 0),(0,l.A)(this,"states",void 0),(0,l.A)(this,"valueNodeName",void 0),(0,l.A)(this,"valueNodeProperty",void 0),(0,l.A)(this,"minNodeName",void 0),(0,l.A)(this,"maxNodeName",void 0),(0,l.A)(this,"valueNode",void 0),(0,l.A)(this,"minNode",void 0),(0,l.A)(this,"maxNode",void 0),this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===d.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(p)}updateFromComponent({xAxis:e,yAxis:t,button:s,state:o}){let{normalizedXAxis:i,normalizedYAxis:n}=function(e=0,t=0){let s=e,o=t;if(Math.sqrt(e*e+t*t)>1){let i=Math.atan2(t,e);s=Math.cos(i),o=Math.sin(i)}return{normalizedXAxis:.5*s+.5,normalizedYAxis:.5*o+.5}}(e,t);switch(this.componentProperty){case d.ComponentProperty.X_AXIS:this.value=this.states.includes(o)?i:.5;break;case d.ComponentProperty.Y_AXIS:this.value=this.states.includes(o)?n:.5;break;case d.ComponentProperty.BUTTON:this.value=this.states.includes(o)&&s?s:0;break;case d.ComponentProperty.STATE:this.valueNodeProperty===d.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(o):this.value=this.states.includes(o)?1:0;break;default:throw Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class v{constructor(e,t){if((0,l.A)(this,"id",void 0),(0,l.A)(this,"values",void 0),(0,l.A)(this,"type",void 0),(0,l.A)(this,"gamepadIndices",void 0),(0,l.A)(this,"rootNodeName",void 0),(0,l.A)(this,"visualResponses",void 0),(0,l.A)(this,"touchPointNodeName",void 0),(0,l.A)(this,"touchPointNode",void 0),!e||!t||!t.visualResponses||!t.gamepadIndices||0===Object.keys(t.gamepadIndices).length)throw Error("Invalid arguments supplied");this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(e=>{let s=new m(t.visualResponses[e]);this.visualResponses[e]=s}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:d.ComponentState.DEFAULT,button:void 0!==this.gamepadIndices.button?0:void 0,xAxis:void 0!==this.gamepadIndices.xAxis?0:void 0,yAxis:void 0!==this.gamepadIndices.yAxis?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(e){if(this.values.state=d.ComponentState.DEFAULT,void 0!==this.gamepadIndices.button&&e.buttons.length>this.gamepadIndices.button){let t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||1===this.values.button?this.values.state=d.ComponentState.PRESSED:(t.touched||this.values.button>d.ButtonTouchThreshold)&&(this.values.state=d.ComponentState.TOUCHED)}void 0!==this.gamepadIndices.xAxis&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===d.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>d.AxisTouchThreshold&&(this.values.state=d.ComponentState.TOUCHED)),void 0!==this.gamepadIndices.yAxis&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===d.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>d.AxisTouchThreshold&&(this.values.state=d.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEac
1h(e=>{e.updateFromComponent(this.values)})}}class f{constructor(e,t,s){if((0,l.A)(this,"xrInputSource",void 0),(0,l.A)(this,"assetUrl",void 0),(0,l.A)(this,"layoutDescription",void 0),(0,l.A)(this,"id",void 0),(0,l.A)(this,"components",void 0),!e)throw Error("No xrInputSource supplied");if(!t)throw Error("No profile supplied");if(!t.layouts[e.handedness])throw Error("No layout for "+e.handedness+" handedness");this.xrInputSource=e,this.assetUrl=s,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(e=>{let t=this.layoutDescription.components[e];this.components[e]=new v(e,t)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){let e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}}var y=s(91019);let x=(e,t)=>{t.traverse(t=>{t instanceof i.Mesh&&"envMap"in t.material&&(t.material.envMap=e,t.material.needsUpdate=!0)})};class A extends i.Object3D{constructor(){super(),this.motionController=null,this.envMap=null,this.scene=null}setEnvironmentMap(e){return this.envMap==e||(this.envMap=e,x(this.envMap,this)),this}connectModel(e){if(!this.motionController){console.warn("scene tried to add, but no motion controller");return}this.scene=e,function(e,t){Object.values(e.components).forEach(e=>{let{type:s,touchPointNodeName:o,visualResponses:n}=e;if(s===d.ComponentType.TOUCHPAD&&o){if(e.touchPointNode=t.getObjectByName(o),e.touchPointNode){let t=new i.SphereGeometry(.001),s=new i.MeshBasicMaterial({color:255}),o=new i.Mesh(t,s);e.touchPointNode.add(o)}else console.warn(`Could not find touch dot, ${e.touchPointNodeName}, in touchpad component ${e.id}`)}Object.values(n).forEach(e=>{let{valueNodeName:s,minNodeName:o,maxNodeName:i,valueNodeProperty:n}=e;if(n===d.VisualResponseProperty.TRANSFORM&&o&&i){if(e.minNode=t.getObjectByName(o),e.maxNode=t.getObjectByName(i),!e.minNode){console.warn(`Could not find ${o} in the model`);return}if(!e.maxNode){console.warn(`Could not find ${i} in the model`);return}}e.valueNode=t.getObjectByName(s),e.valueNode||console.warn(`Could not find ${s} in the model`)})})}(this.motionController,e),this.envMap&&x(this.envMap,e),this.add(e),this.dispatchEvent({type:"modelconnected",data:e})}connectMotionController(e){this.motionController=e,this.dispatchEvent({type:"motionconnected",data:e})}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(e=>{Object.values(e.visualResponses).forEach(e=>{let{valueNode:t,minNode:s,maxNode:o,value:i,valueNodeProperty:n}=e;t&&(n===d.VisualResponseProperty.VISIBILITY&&"boolean"==typeof i?t.visible=i:n===d.VisualResponseProperty.TRANSFORM&&s&&o&&"number"==typeof i&&(t.quaternion.slerpQuaternions(s.quaternion,o.quaternion,i),t.position.lerpVectors(s.position,o.position,i)))})}))}disconnect(){this.dispatchEvent({type:"motiondisconnected",data:this.motionController}),this.dispatchEvent({type:"modeldisconnected",data:this.scene}),this.motionController=null,this.scene&&this.remove(this.scene),this.scene=null}dispose(){this.disconnect()}}class N{constructor(e=null,t="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/[email protected]/dist/profiles"){this.gltfLoader=null!=e?e:new y.B,this.path=t,this._assetCache={}}initializeControllerModel(e,t){let s=t.data;"tracked-pointer"===s.targetRayMode&&s.gamepad&&u(s,this.path,"generic-trigger").then(({profile:t,assetPath:o})=>{if(!o)throw Error("no asset path");let i=new f(s,t,o);e.connectMotionController(i);let n=i.assetUrl,a=this._assetCache[n];if(a){let t=a.scene.clone();e.connectModel(t)}else{if(!this.gltfLoader)throw Error("GLTFLoader not set.");this.gltfLoader.setPath(""),this.gltfLoader.load(n,t=>{if(!e.motionController){console.warn("motionController gone while gltf load, bailing...");return}this._assetCache[n]=t;let s=t.scene.clone();e.connectModel(s)},void 0,()=>{throw Error(`Asset ${n} missing or malformed.`)})}}).catch(e=>{console.warn(e)})}}let g=o.forwardRef(function({target:e,hideOnBlur:t=!1,...s},r){let l=(0,a.ks)(e=>e.hoverState),d=o.useRef(null),h=o.useMemo(()=>new i.BufferGeometry().setFromPoints([new i.Vector3(0,0,0),new i.Vector3(0,0,-1)]),[]);return o.useImperativeHandle(r,()=>d.current),(0,n.A)(()=>{let s=1,o=l[e.inputSource.handedness].values().next().value;o&&"none"!==e.inputSource.handedness?(s=o.distance,t&&(d.current.visible=!1)):t&&(d.current.visible=!0),d.current.scale.z
1=s+-.01}),o.createElement("line",{ref:d,geometry:h,"material-opacity":.8,"material-transparent":!0,...s})}),b=new N;class E extends i.Group{constructor(e){super(),this.xrControllerModel=new A,this.target=e,this.add(this.xrControllerModel),this._onConnected=this._onConnected.bind(this),this._onDisconnected=this._onDisconnected.bind(this),this.target.controller.addEventListener("connected",this._onConnected),this.target.controller.addEventListener("disconnected",this._onDisconnected)}_onConnected(e){b.initializeControllerModel(this.xrControllerModel,e)}_onDisconnected(e){this.xrControllerModel.disconnect()}dispose(){this.target.controller.removeEventListener("connected",this._onConnected),this.target.controller.removeEventListener("disconnected",this._onDisconnected)}}function C({rayMaterial:e={},hideRaysOnBlur:t=!1}){let s=(0,a.ks)(e=>e.controllers),i=(0,a.ks)(e=>e.isHandTracking),l=o.useMemo(()=>Object.entries(e).reduce((e,[t,s])=>({...e,[`material-${t}`]:s}),{}),[JSON.stringify(e)]);return o.useMemo(()=>(0,n.e)({ControllerModel:E}),[]),(0,r.Es)(()=>{for(let e of s)e.controller.dispatchEvent({type:"connected",data:e.inputSource,fake:!0})},[s]),o.createElement(o.Fragment,null,s.map((e,s)=>o.createElement(o.Fragment,{key:s},(0,n.g)(o.createElement("controllerModel",{args:[e]}),e.grip),(0,n.g)(o.createElement(g,{visible:!i,hideOnBlur:t,target:e,...l}),e.controller))))}}}]);

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.