UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

113 lines (112 loc) • 3.11 kB
(function() { try { var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}; e.SENTRY_RELEASE = { id: "3.47.0" }; var t = new e.Error().stack; t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "10662de0-8fd6-4e6b-97dc-3591eca2a871", e._sentryDebugIdIdentifier = "sentry-dbid-10662de0-8fd6-4e6b-97dc-3591eca2a871"); } catch {} })(); import { t as e } from "./is-webview-DA6FLdme.js"; import { $t as t, D as n, Qt as r, gt as i, vt as a, yt as o } from "./LayerStore-DCg-juRT.js"; //#region src/utils/scene-bounds.ts var s = "areamap"; function c(e) { var n; let c = e == null || (n = e.rootLayer) == null ? void 0 : n.children; if (!(c != null && c.length)) return null; let l = Infinity, u = Infinity, d = -Infinity, f = -Infinity, p = (e, t) => { !Number.isFinite(e) || !Number.isFinite(t) || (e < l && (l = e), t < u && (u = t), e > d && (d = e), t > f && (f = t)); }, m = (e) => { p(e.min.x, e.min.y), p(e.max.x, e.max.y); }, h = (e) => { if (i(e)) { e.children.forEach(h); return; } if (o(e)) { m(r(e.shape) ? e.shape : e.shape.bounds); return; } if (a(e)) { p(e.points.p0.x, e.points.p0.y), p(e.points.p1.x, e.points.p1.y); return; } m(e.bounds.bounds); }; for (let e of c) { let t = e.name; typeof t == "string" && t.toLowerCase() === s || h(e); } return l > d || u > f ? null : t.fromMinMax({ x: l, y: u }, { x: d, y: f }); } function l(e, t) { return !e || !t || t.area <= 0 || e.area / t.area > .1 ? .15 : .25; } function u(e, t) { return t ? e.expand({ x: e.size.width * t, y: e.size.height * t }) : e; } function d(e, t) { let n = c(e); return n ? u(n, l(n, t)) : null; } function f(e) { return e === "layer-viewbox" || e === "explicit-viewbox" || e === "scene-derived"; } function p(e) { if (e.layerViewbox) return { rect: e.layerViewbox, source: "layer-viewbox" }; if (e.explicitArea) return { rect: e.explicitArea, source: "explicit-viewbox" }; if (e.layerRectangle) return { rect: e.layerRectangle, source: "layer-rectangle" }; let t = d(e.sceneDef, e.svgArea); return t ? { rect: t, source: "scene-derived" } : { rect: e.svgArea, source: "svg-area" }; } //#endregion //#region src/utils/getContrastTextColor.ts var m = 150, h = "#1a1a1a", g = "#ffffff", _ = /^[0-9A-Fa-f]{6}$/, v = /^[0-9A-Fa-f]{3}$/; function y(e) { let t = e.replace("#", ""); return _.test(t) ? t : v.test(t) ? t[0] + t[0] + t[1] + t[1] + t[2] + t[2] : null; } function b(e) { let t = y(e); if (!t) return h; let n = parseInt(t.substring(0, 2), 16), r = parseInt(t.substring(2, 4), 16), i = parseInt(t.substring(4, 6), 16); return .299 * n + .587 * r + .114 * i > m ? h : g; } //#endregion //#region src/utils/is-phone.ts var x = (n || e) && Math.min(window.screen.width, window.screen.height) < 600; //#endregion //#region src/components/Map/scene.ts function S(e) { w = e; } function C() { return w; } var w; //#endregion export { u as a, p as c, b as i, S as n, f as o, x as r, l as s, C as t };