"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react/jsx-runtime"),n=require("react"),j=require("d3");function g(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(t,e,o.get?o:{enumerable:!0,get:()=>r[e]})}}return t.default=r,Object.freeze(t)}const p=g(j);class m extends n.Component{constructor(t){super(t),this.state={},this.divRef=n.createRef(),this.createProjection=this.createProjection.bind(this)}createProjection(){const{editing:t,height:e,width:o,scale:i=200,center:s=[0,0],projectionName:a}=this.props,c=p[a]().fitSize([o,e]).scale(i).center(s).translate([o/2,e/2]);return{path:p.geoPath().projection(c),projection:c}}componentDidMount(){const{svg:t}=this.props,{path:e,projection:o}=this.createProjection();this.setState({path:e,projection:o})}componentDidUpdate(t,e,o){if(t.height!==this.props.height||t.width!==this.props.width||t.projectionName!==this.props.projectionName){const{path:i,projection:s}=this.createProjection();this.setState({path:i,projection:s})}}render(){const{editing:t,backgroundColor:e,height:o,width:i,scale:s=190,center:a=[0,0],initialPosition:c,settings:h}=this.props,d=n.Children.toArray(this.props.children);return u.jsx("div",{className:"projected",width:i,height:o,style:{margin:"auto",backgroundColor:e,height:`${o}px`,width:`${i}px`},children:n.Children.map(d,l=>n.cloneElement(l,{...this.state,initialPosition:c,editing:t,height:o,width:i,settings:h,projection:this.state.projection}))})}}exports.default=m;
