import { F as FlowGraphBlock } from './KHR_interactivity-BGk_Crki.esm.js';
import { R as RichTypeAny, d as RichTypeNumber, f as RichTypeVector3 } from './declarationMapper-CyxdrUFP.esm.js';
import { R as RegisterClass } from './index-BvJBnIUK.esm.js';
import './objectModelMapping-BtiDAwYm.esm.js';

/** This file must only contain pure code and pure imports */
/**
 * @experimental
 * A data block that reads the mass properties of a physics body.
 * Outputs the mass, center of mass (local space), and principal inertia.
 */
class FlowGraphGetPhysicsMassPropertiesBlock extends FlowGraphBlock {
    /**
     * Constructs a new FlowGraphGetPhysicsMassPropertiesBlock.
     * @param config - optional configuration for the block
     */
    constructor(config) {
        super(config);
        this.body = this.registerDataInput("body", RichTypeAny);
        this.mass = this.registerDataOutput("mass", RichTypeNumber);
        this.centerOfMass = this.registerDataOutput("centerOfMass", RichTypeVector3);
        this.inertia = this.registerDataOutput("inertia", RichTypeVector3);
    }
    /**
     * @internal
     */
    _updateOutputs(context) {
        const physicsBody = this.body.getValue(context);
        if (!physicsBody) {
            return;
        }
        const props = physicsBody.getMassProperties();
        if (props.mass !== undefined) {
            this.mass.setValue(props.mass, context);
        }
        if (props.centerOfMass) {
            this.centerOfMass.setValue(props.centerOfMass, context);
        }
        if (props.inertia) {
            this.inertia.setValue(props.inertia, context);
        }
    }
    /**
     * @returns class name of the block.
     */
    getClassName() {
        return "FlowGraphGetPhysicsMassPropertiesBlock" /* FlowGraphBlockNames.PhysicsGetMassProperties */;
    }
}
let _Registered = false;
/**
 * Register side effects for flowGraphGetPhysicsMassPropertiesBlock.
 * Safe to call multiple times; only the first call has an effect.
 */
function RegisterFlowGraphGetPhysicsMassPropertiesBlock() {
    if (_Registered) {
        return;
    }
    _Registered = true;
    RegisterClass("FlowGraphGetPhysicsMassPropertiesBlock" /* FlowGraphBlockNames.PhysicsGetMassProperties */, FlowGraphGetPhysicsMassPropertiesBlock);
}

/**
 * Re-exports pure implementation and applies runtime side effects.
 * Import flowGraphGetPhysicsMassPropertiesBlock.pure for tree-shakeable, side-effect-free usage.
 */
RegisterFlowGraphGetPhysicsMassPropertiesBlock();

export { FlowGraphGetPhysicsMassPropertiesBlock, RegisterFlowGraphGetPhysicsMassPropertiesBlock };
//# sourceMappingURL=flowGraphGetPhysicsMassPropertiesBlock-C3VzIbpb.esm.js.map
