iflow-engine-base 3.10.8 → 3.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,211 @@
1
+ import { b8 as w } from "./three-vendor-fDCVai2b.js";
2
+ const S = "__BIM_ENGINE_SDK_ASSET_BASE__", b = "__BIM_ENGINE_SDK_ASSET_FILE_MAP__", g = "__BIM_ENGINE_SDK_ASSET_FILE_URLS__", A = "__BIM_ENGINE_SDK_ASSET_FILE_SESSION__", j = "https://unpkg.com/iflow-engine-base@3.9.20/dist/", L = "https://__bim_engine_sdk_asset__/", M = ["assets/", "fonts/", "draco/", "basis/", "texture/", "prompt/"];
3
+ let _ = null;
4
+ async function R() {
5
+ return _ || (_ = import("./sdk-vendor-VNZqYnFS.js").then((t) => t.j).then((t) => t.default ?? t)), _;
6
+ }
7
+ function a() {
8
+ return typeof globalThis < "u" ? globalThis : null;
9
+ }
10
+ function u(t) {
11
+ return t.endsWith("/") ? t : `${t}/`;
12
+ }
13
+ function l(t) {
14
+ return String(t).replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+/g, "/");
15
+ }
16
+ function m(t) {
17
+ return /^(?:[a-z][a-z\d+\-.]*:)?\/\//i.test(t) || /^(?:data|blob):/i.test(t);
18
+ }
19
+ function y(t) {
20
+ return t.startsWith("./") || t.startsWith("../");
21
+ }
22
+ function f(t, e) {
23
+ try {
24
+ return e ? new URL(t, e).toString() : new URL(t).toString();
25
+ } catch {
26
+ return null;
27
+ }
28
+ }
29
+ function F(t) {
30
+ return /\.zip$/i.test(t.name);
31
+ }
32
+ function T() {
33
+ return `${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
34
+ }
35
+ function v(t) {
36
+ return t.startsWith(L);
37
+ }
38
+ function p() {
39
+ const e = a()?.[A];
40
+ return typeof e == "string" && e ? `${L}${e}/` : null;
41
+ }
42
+ function z(t) {
43
+ return `${p() ?? L}${l(t)}`;
44
+ }
45
+ function U() {
46
+ const e = a()?.[b];
47
+ return e instanceof Map ? e : null;
48
+ }
49
+ function K() {
50
+ const e = a()?.[g];
51
+ return Array.isArray(e) ? e : [];
52
+ }
53
+ function O() {
54
+ const t = a();
55
+ t && (K().forEach((e) => URL.revokeObjectURL(e)), delete t[b], delete t[g], delete t[A]);
56
+ }
57
+ function D(t, e) {
58
+ const n = a();
59
+ n && (O(), n[b] = t, n[g] = e, n[A] = T());
60
+ }
61
+ function N(t, e, n) {
62
+ const s = l(e), r = /* @__PURE__ */ new Set([s]), o = s.indexOf("dist/");
63
+ o >= 0 && r.add(s.slice(o + 5));
64
+ const c = s.indexOf("public/");
65
+ c >= 0 && r.add(s.slice(c + 7));
66
+ for (const i of M) {
67
+ const E = s.indexOf(i);
68
+ E >= 0 && r.add(s.slice(E));
69
+ }
70
+ r.forEach((i) => {
71
+ i && (t.set(i, n), t.set(i.toLowerCase(), n));
72
+ });
73
+ }
74
+ function B(t) {
75
+ const e = U();
76
+ if (!e)
77
+ return null;
78
+ const n = l(t);
79
+ return e.get(n) ?? e.get(n.toLowerCase()) ?? null;
80
+ }
81
+ function h(t) {
82
+ const e = U();
83
+ if (!e)
84
+ return !1;
85
+ const n = l(t).replace(/\/?$/, "/").toLowerCase();
86
+ for (const s of e.keys())
87
+ if (s.toLowerCase().startsWith(n))
88
+ return !0;
89
+ return !1;
90
+ }
91
+ function k(t) {
92
+ if (!v(t))
93
+ return null;
94
+ const e = p();
95
+ if (!e || !t.startsWith(e))
96
+ return null;
97
+ const n = t.slice(e.length);
98
+ return B(n);
99
+ }
100
+ w.setURLModifier((t) => k(t) ?? t);
101
+ async function P(t) {
102
+ const e = [];
103
+ for (const n of t) {
104
+ const s = l(n.webkitRelativePath || n.name);
105
+ if (F(n)) {
106
+ const o = await (await R()).loadAsync(n), c = Object.values(o.files);
107
+ for (const i of c)
108
+ i.dir || e.push({
109
+ path: l(i.name),
110
+ blob: await i.async("blob")
111
+ });
112
+ continue;
113
+ }
114
+ e.push({
115
+ path: s,
116
+ blob: n
117
+ });
118
+ }
119
+ return e;
120
+ }
121
+ function I() {
122
+ return typeof document < "u" && document.baseURI ? document.baseURI : typeof location < "u" && location.href ? location.href : null;
123
+ }
124
+ function W(t, e) {
125
+ const n = u(t);
126
+ if (m(n))
127
+ return n;
128
+ const s = d(e) || x() || I();
129
+ return f(n, s || void 0) || n;
130
+ }
131
+ function d(t) {
132
+ if (!t)
133
+ return null;
134
+ try {
135
+ const e = I(), n = f(t, e || void 0) || t, s = new URL(".", n), r = s.pathname.replace(/\\/g, "/");
136
+ return r.endsWith("/chunks/") ? new URL("../", s).toString() : e && /\/src\//.test(r) ? u(e) : s.toString();
137
+ } catch {
138
+ return null;
139
+ }
140
+ }
141
+ function x() {
142
+ if (typeof document > "u")
143
+ return null;
144
+ const t = document.currentScript;
145
+ if (t?.src)
146
+ return d(t.src);
147
+ const e = document.getElementsByTagName("script");
148
+ for (let n = e.length - 1; n >= 0; n -= 1) {
149
+ const s = e[n]?.src;
150
+ if (s && /(?:bim-engine-sdk|iflow-engine-base|dwg-preview|gaussian)\.(?:es|umd)\.js(?:[?#].*)?$/.test(s))
151
+ return d(s);
152
+ }
153
+ return null;
154
+ }
155
+ function Z(t) {
156
+ const e = a();
157
+ if (e) {
158
+ if (!t) {
159
+ delete e[S];
160
+ return;
161
+ }
162
+ e[S] = u(t);
163
+ }
164
+ }
165
+ async function $(t) {
166
+ if (!t || t.length === 0) {
167
+ O();
168
+ return;
169
+ }
170
+ const e = Array.from(t), n = await P(e), s = /* @__PURE__ */ new Map(), r = [];
171
+ n.forEach((o) => {
172
+ const c = URL.createObjectURL(o.blob);
173
+ r.push(c), N(s, o.path, c);
174
+ }), D(s, r);
175
+ }
176
+ async function V(t) {
177
+ await $(t ? [t] : null);
178
+ }
179
+ function G(t) {
180
+ const e = p();
181
+ if (e)
182
+ return e;
183
+ const s = a()?.[S];
184
+ return typeof s == "string" && s.length > 0 ? W(s, t) : u(j);
185
+ }
186
+ function Y(t, e) {
187
+ if (m(t))
188
+ return t;
189
+ const n = l(t), s = B(n);
190
+ if (s && !t.endsWith("/"))
191
+ return s;
192
+ if (t.endsWith("/") || h(n)) {
193
+ const o = z(n);
194
+ if (h(n))
195
+ return t.endsWith("/") ? u(o) : o;
196
+ }
197
+ if (y(t)) {
198
+ const o = f(t, d(e) || void 0);
199
+ if (o)
200
+ return o;
201
+ }
202
+ const r = G(e);
203
+ return f(n, r) || n;
204
+ }
205
+ export {
206
+ V as a,
207
+ Z as b,
208
+ G as g,
209
+ Y as r,
210
+ $ as s
211
+ };