import { SkeletonModifier } from './skeleton_modifier.js';

/**
 * Skeleton modifier for IK solvers.
 *
 * Integrates IK solving into the skeleton post-processing pipeline.
 * The IK solver is executed each frame and results are blended with the base animation.
 *
 * @public
 */ class IKModifier extends SkeletonModifier {
    _solver;
    _target;
    _weight;
    /**
   * Create an IK post-processor.
   *
   * @param solver - The IK solver to integrate
   * @param target - Target position for the end effector
   * @param weight - Blend weight [0-1] (default: 1.0)
   */ constructor(solver, target, weight = 1.0){
        super();
        this._weight = weight;
        this._solver = solver;
        this._target = target.clone();
    }
    /**
   * Get the IK solver.
   */ get solver() {
        return this._solver;
    }
    /**
   * Get the current target position.
   */ get target() {
        return this._target.clone();
    }
    /**
   * Set the target position for the end effector.
   *
   * @param target - New target position (will be cloned)
   */ setTarget(target) {
        this._target.set(target);
    }
    /**
   * Apply IK solving to skeleton joints.
   */ apply(_skeleton, _deltaTime) {
        if (!this._enabled || this._weight <= 0) {
            return;
        }
        // Solve IK
        this._solver.solve(this._target);
        // Apply to nodes with blending
        this._solver.applyToNodes(this._weight);
    }
    /**
   * Reset the IK solver to initial state.
   */ reset() {
    // IK solvers typically don't need explicit reset
    // as they solve based on current joint positions
    }
    _getWeight() {
        return this._weight;
    }
    _setWeight(value) {
        this._weight = Math.max(0, Math.min(1, value));
    }
}

export { IKModifier };
//# sourceMappingURL=ik_modifier.js.map
