import { d as e } from "./globals-XgQKmpSH.js";
import { C as t, T as n, a as r, n as i, r as a, t as o, w as s } from "./proj-BsI0VXog.js";
//#region ../../node_modules/ol/proj/proj4.js
var c = /* @__PURE__ */ e({
	fromProjectionCode: () => m,
	getEPSGLookup: () => g,
	getProjectionCodeLookup: () => p,
	isRegistered: () => u,
	register: () => d
}), l = null;
function u() {
	return !!l;
}
function d(e) {
	l = e;
	let c = Object.keys(e.defs), u = c.length, d, f;
	for (d = 0; d < u; ++d) {
		let t = c[d];
		if (!s(t)) {
			let r = e.defs(t), i = r.units;
			!i && r.projName === "longlat" && (i = "degrees"), a(new n({
				code: t,
				axisOrientation: r.axis,
				metersPerUnit: r.to_meter,
				units: i
			}));
		}
	}
	for (d = 0; d < u; ++d) {
		let n = c[d], a = s(n);
		for (f = 0; f < u; ++f) {
			let l = c[f], u = s(l);
			if (!t(n, l)) if (e.defs[n] === e.defs[l]) i([a, u]);
			else {
				let t = e(n, l);
				o(a, u, r(a, u, t.forward), r(u, a, t.inverse));
			}
		}
	}
}
var f = async function(e) {
	if (typeof e != "string" || !e.includes(":")) throw Error("Invalid code");
	let [t, n] = e.toLowerCase().split(":", 2), r = await fetch(`https://spatialreference.org/ref/${t}/${n}/ogcwkt/`);
	if (!r.ok) throw Error(`Unexpected response from spatialreference.org: ${r.status}`);
	return r.text();
};
function p() {
	return f;
}
async function m(e) {
	let t = l;
	if (!t) throw Error("Proj4 must be registered first with register(proj4)");
	return t.defs(e) ? s(e) : (t.defs(e, await f(e)), d(t), s(e));
}
var h = async function(e) {
	return await f("EPSG:" + e);
};
function g() {
	return h;
}
//#endregion
export { d as i, u as n, c as r, m as t };
