/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{copy as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{applyToViewMatrix as r}from"./localOriginHelper.js";class e{constructor(i){this._factory=i,this._originData=new Map}acquire(i){return this.register(this._factory.getOrigin(i))}register(i){const t=this._originData.get(i.id)||new o(i);return t.refCount++,this._originData.has(t.origin.id)||this._originData.set(t.origin.id,t),t}release(i){i&&(i.refCount--,0===i.refCount&&this._originData.delete(i.origin.id))}updateViewMatrices(t){this._originData.forEach(e=>{i(e.viewMatrix,t),r(e.origin.vec3,e.viewMatrix)})}}class o{constructor(i){this.origin=i,this.refCount=0,this.viewMatrix=t()}}export{e as LocalOriginManager,o as OriginData};
