"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("three"),r=require("react");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var o=n(e),i=u(r);const c=i.forwardRef((function({children:e,object:r,disable:n,disableX:u,disableY:c,disableZ:a,left:l,right:s,top:f,bottom:d,front:p,back:b,onCentered:m,precise:g=!0,cacheKey:h=0,...x},y){const j=i.useRef(null),O=i.useRef(null),v=i.useRef(null),[w]=i.useState((()=>new t.Box3)),[S]=i.useState((()=>new t.Vector3)),[z]=i.useState((()=>new t.Sphere));return i.useLayoutEffect((()=>{O.current.matrixWorld.identity(),w.setFromObject(null!=r?r:v.current,g);const e=w.max.x-w.min.x,t=w.max.y-w.min.y,o=w.max.z-w.min.z;w.getCenter(S),w.getBoundingSphere(z);const i=f?t/2:d?-t/2:0,h=l?-e/2:s?e/2:0,x=p?o/2:b?-o/2:0;O.current.position.set(n||u?0:-S.x+h,n||c?0:-S.y+i,n||a?0:-S.z+x),null==m||m({parent:j.current.parent,container:j.current,width:e,height:t,depth:o,boundingBox:w,boundingSphere:z,center:S,verticalAlignment:i,horizontalAlignment:h,depthAlignment:x})}),[h,m,f,l,p,n,u,c,a,r,g,s,d,b,w,S,z]),i.useImperativeHandle(y,(()=>j.current),[]),i.createElement("group",o.default({ref:j},x),i.createElement("group",{ref:O},i.createElement("group",{ref:v},e)))}));exports.Center=c;
