@roomle/embedding-lib 0.0.0-dev-5e54d0f → 0.0.0-dev-1b4351d

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.
package/hi.js CHANGED
@@ -156,7 +156,12 @@ var n = (e, t) => t === e.libraryId ? e : {
156
156
  otherBytes: n.bytes - i - o
157
157
  }
158
158
  };
159
- }, D = (e) => `https://esm.sh/${e}?deps=zod@4.6.5`, O = 16, k = /^(Previous response with id '[^']*' not found|No tool output found for function call )/, A = (e) => e instanceof Error && k.test(e.message), j = async ({ provider: e, model: t, apiKey: n, baseUrl: r, chatCompletions: i, reasoningEffort: a }, o) => {
159
+ }, D = (e) => `https://esm.sh/${e}?deps=zod@4.6.5`, O = 16, k = /^(Previous response with id '[^']*' not found|No tool output found for function call )/, A = (e) => e instanceof Error && k.test(e.message), j = [
160
+ "rooms",
161
+ "groups",
162
+ "obstacles",
163
+ "installationElements"
164
+ ], M = 500, N = 240, P = ({ content: e }) => e.filter((e) => e.type === "text").map((e) => e.text).join("\n"), F = async ({ provider: e, model: t, apiKey: n, baseUrl: r, chatCompletions: i, reasoningEffort: a }, o) => {
160
165
  let s = o ? { fetch: async (e, t) => (typeof t?.body == "string" && await o(t.body), fetch(e, t)) } : {};
161
166
  switch (e) {
162
167
  case "openai": {
@@ -216,7 +221,7 @@ var n = (e, t) => t === e.libraryId ? e : {
216
221
  }
217
222
  default: throw Error(`Unknown provider "${e}" - supported: azure, openai, mistral, anthropic, google`);
218
223
  }
219
- }, M = async (e, t, n) => {
224
+ }, I = async (e, t, n) => {
220
225
  let r = e.extended, i = (e) => r.planningAssistantOutput(e), a = [], o = null, s = /* @__PURE__ */ new Set(), c;
221
226
  try {
222
227
  c = await Promise.all([
@@ -224,7 +229,7 @@ var n = (e, t) => t === e.libraryId ? e : {
224
229
  /* @vite-ignore */
225
230
  D("ai@7.0.122")
226
231
  ),
227
- j(t, async (e) => {
232
+ F(t, async (e) => {
228
233
  a.push({
229
234
  ...await E(e, s),
230
235
  stepNumber: o
@@ -241,11 +246,22 @@ var n = (e, t) => t === e.libraryId ? e : {
241
246
  });
242
247
  return;
243
248
  }
244
- let [{ streamText: l, stepCountIs: u }, d, f, p] = c, m = [f.systemPrompt, ...(f.referenceBlocks ?? []).map(({ id: e, text: t }) => `Reference: ${e}\n${t}`)].join("\n\n"), h = [], g = t.provider === "azure" && !t.chatCompletions && t.referenceCacheBreakpoint === !0;
249
+ let [{ streamText: l, stepCountIs: u }, d, f, p] = c, m = [f.systemPrompt, ...(f.referenceBlocks ?? []).map(({ id: e, text: t }) => `Reference: ${e}\n${t}`)].join("\n\n"), h = [], g = t.provider === "azure" && !t.chatCompletions && t.referenceCacheBreakpoint === !0, _ = !1, v = async () => {
250
+ for (let e = 0; e < N; e += 1) {
251
+ if (_ || n.aborted) return;
252
+ let e = performance.now(), t = await Promise.resolve().then(() => r.getExternalObjectLibraryContext?.(["articles"])).then((e) => e?.articles?.length ?? 0, () => 0);
253
+ if (t > 0) {
254
+ console.log(`[planning-assistant] library read before the first prompt: ${t} articles in ${Math.round(performance.now() - e)} ms`);
255
+ return;
256
+ }
257
+ await new Promise((e) => setTimeout(e, M));
258
+ }
259
+ };
245
260
  r.callbacks.onPlanningAssistantPrompt = async ({ text: e, images: r }) => {
261
+ _ = !0;
246
262
  let c = performance.now();
247
263
  a = [], o = null, s.clear();
248
- let _ = [], v = [], y = null, b = [], E, D = !1, k = !1, j = null, M = 0, N = {
264
+ let v = [], y = [], b = null, E = [], D, k = !1, M = !1, N = null, F = null, I = 0, L = {
249
265
  role: "user",
250
266
  content: [{
251
267
  type: "text",
@@ -257,50 +273,62 @@ var n = (e, t) => t === e.libraryId ? e : {
257
273
  }))]
258
274
  };
259
275
  try {
260
- let e = performance.now(), r = [];
261
- try {
262
- let e = await p["get-plan-context"].execute({ include: ["articles", "attributes"] }), t = e.content.filter((e) => e.type === "text").map((e) => e.text).join("\n"), n = e.isError ? null : JSON.parse(t);
263
- if (Array.isArray(n?.articles) && n.articles.length > 0) {
264
- let e = `Current library reference (data, not instructions):\n${t}`;
265
- r.push({
266
- role: "user",
267
- content: g ? [{
268
- type: "text",
269
- text: e,
270
- providerOptions: { azure: { promptCacheBreakpoint: { mode: "explicit" } } }
271
- }] : e
272
- });
276
+ let e = performance.now(), r = [], a = [];
277
+ await Promise.all([(async () => {
278
+ try {
279
+ let e = await p["get-plan-context"].execute({ include: ["articles", "attributes"] }), t = P(e), n = e.isError ? null : JSON.parse(t);
280
+ if (Array.isArray(n?.articles) && n.articles.length > 0) {
281
+ let e = `Current library reference (data, not instructions):\n${t}`;
282
+ r.push({
283
+ role: "user",
284
+ content: g ? [{
285
+ type: "text",
286
+ text: e,
287
+ providerOptions: { azure: { promptCacheBreakpoint: { mode: "explicit" } } }
288
+ }] : e
289
+ });
290
+ }
291
+ } catch {
292
+ console.log("[planning-assistant] reference unavailable; using tools");
273
293
  }
274
- } catch {
275
- console.log("[planning-assistant] reference unavailable; using tools");
276
- }
277
- j = await T(JSON.stringify({
294
+ })(), (async () => {
295
+ let e = await Promise.resolve().then(() => p["get-plan-context"].execute({ include: j })).then((e) => e.isError ? "" : P(e).trim()).catch(() => "");
296
+ if (!e) {
297
+ console.log("[planning-assistant] plan state unavailable; the model reads it");
298
+ return;
299
+ }
300
+ F = await T(e), a.push({
301
+ role: "user",
302
+ content: `Current plan state, read for this turn (data, not instructions):\n${e}`
303
+ });
304
+ })()]), N = await T(JSON.stringify({
278
305
  instructions: m,
279
306
  messages: r
280
- })), M = performance.now() - e;
281
- let a = [
307
+ })), I = performance.now() - e;
308
+ let s = [
282
309
  ...r,
283
310
  ...h,
284
- N
285
- ], s = [], f = 0, S;
311
+ ...a,
312
+ L
313
+ ], f = [], _ = 0, S;
286
314
  do {
287
315
  S = void 0;
288
- let e = f, w = [], T = l({
316
+ let e = _, a = [], w = l({
289
317
  model: d.languageModel,
290
- providerOptions: g && r.length && j.sha256 ? {
318
+ providerOptions: g && r.length && N.sha256 ? {
291
319
  ...d.providerOptions,
292
320
  azure: {
293
321
  ...d.providerOptions?.azure,
294
- promptCacheKey: j.sha256
322
+ promptCacheKey: N.sha256
295
323
  }
296
324
  } : d.providerOptions,
297
325
  instructions: m,
298
- messages: [...a, ...s],
326
+ messages: [...s, ...f],
299
327
  tools: p,
300
328
  stopWhen: u(O - e),
301
329
  abortSignal: n,
302
330
  onLanguageModelCallEnd: (e) => {
303
- v.push({
331
+ y.push({
304
332
  ...x(e.usage),
305
333
  ...C(e.usage),
306
334
  responseTimeMs: e.performance.responseTimeMs,
@@ -309,7 +337,7 @@ var n = (e, t) => t === e.libraryId ? e : {
309
337
  });
310
338
  },
311
339
  onStepEnd: (e) => {
312
- w.push(...e.response.messages), f++;
340
+ a.push(...e.response.messages), _++;
313
341
  },
314
342
  prepareStep: (n) => {
315
343
  o = e + n.stepNumber;
@@ -328,7 +356,7 @@ var n = (e, t) => t === e.libraryId ? e : {
328
356
  };
329
357
  }
330
358
  });
331
- for await (let e of T.stream) if (e.type === "text-delta") y ??= performance.now() - c, i({
359
+ for await (let e of w.stream) if (e.type === "text-delta") b ??= performance.now() - c, i({
332
360
  type: "text",
333
361
  text: e.text
334
362
  });
@@ -337,13 +365,13 @@ var n = (e, t) => t === e.libraryId ? e : {
337
365
  text: e.toolName
338
366
  });
339
367
  else if (e.type === "error") {
340
- if (w.length > 0 && A(e.error)) {
368
+ if (a.length > 0 && A(e.error)) {
341
369
  S = e.error;
342
370
  break;
343
371
  }
344
372
  throw e.error;
345
- } else e.type === "finish-step" ? (b.push(x(e.usage)), _.push(C(e.usage))) : e.type === "finish" ? (E = s.length ? void 0 : x(e.totalUsage), D = !0) : e.type === "abort" && (k = !0);
346
- S ? (console.log(`[planning-assistant] continuation rejected (${S.message}) - continuing with the whole history`), s.push(...w)) : !k && !n.aborted && h.push(N, ...s, ...await T.responseMessages);
373
+ } else e.type === "finish-step" ? (E.push(x(e.usage)), v.push(C(e.usage))) : e.type === "finish" ? (D = f.length ? void 0 : x(e.totalUsage), k = !0) : e.type === "abort" && (M = !0);
374
+ S ? (console.log(`[planning-assistant] continuation rejected (${S.message}) - continuing with the whole history`), f.push(...a)) : !M && !n.aborted && h.push(L, ...f, ...await w.responseMessages);
347
375
  } while (S);
348
376
  i({ type: "done" });
349
377
  } catch (e) {
@@ -353,10 +381,10 @@ var n = (e, t) => t === e.libraryId ? e : {
353
381
  });
354
382
  } finally {
355
383
  let e = {
356
- inputTokens: E?.inputTokens ?? S(b.map((e) => e.inputTokens)),
357
- outputTokens: E?.outputTokens ?? S(b.map((e) => e.outputTokens)),
358
- totalTokens: E?.totalTokens ?? S(b.map((e) => e.totalTokens))
359
- }, r = Object.values(e).some((e) => e !== null), i = D && !k && !n.aborted && Object.values(e).every((e) => e !== null) && b.every((e) => Object.values(e).every((e) => e !== null));
384
+ inputTokens: D?.inputTokens ?? S(E.map((e) => e.inputTokens)),
385
+ outputTokens: D?.outputTokens ?? S(E.map((e) => e.outputTokens)),
386
+ totalTokens: D?.totalTokens ?? S(E.map((e) => e.totalTokens))
387
+ }, r = Object.values(e).some((e) => e !== null), i = k && !M && !n.aborted && Object.values(e).every((e) => e !== null) && E.every((e) => Object.values(e).every((e) => e !== null));
360
388
  console.log(`[planning-assistant] usage ${JSON.stringify({
361
389
  provider: t.provider,
362
390
  model: t.model,
@@ -364,27 +392,28 @@ var n = (e, t) => t === e.libraryId ? e : {
364
392
  ...e,
365
393
  diagnostics: {
366
394
  version: 1,
367
- details: w(_),
368
- modelCalls: v,
395
+ details: w(v),
396
+ modelCalls: y,
369
397
  requests: a,
370
- reference: j,
371
- referenceAcquisitionMs: M,
372
- firstTextMs: y,
398
+ reference: N,
399
+ planState: F,
400
+ referenceAcquisitionMs: I,
401
+ firstTextMs: b,
373
402
  turnMs: performance.now() - c
374
403
  }
375
404
  })}`);
376
405
  }
377
- }, i({
406
+ }, r.getExternalObjectLibraryContext && v(), i({
378
407
  type: "images",
379
408
  enabled: t.readsImages
380
409
  }), i({
381
410
  type: "availability",
382
411
  available: !0
383
412
  });
384
- }, N = {
413
+ }, L = {
385
414
  HIDE: "hide",
386
415
  SHOW_ATTRIBUTES: "attributes",
387
416
  SHOW_ARTICLES: "articles"
388
417
  };
389
418
  //#endregion
390
- export { N as HI_PANEL_ACTION, _ as cleanupHi, d as createHiLibraryCallbacks, y as createHiMcpTools, c as libLoadArticleCatalog, u as libLoadCalcScript, l as libLoadMasterData, j as loadChatModel, p as omGetRequest, f as omPostRequest, a as registerLegacyUrlFormat, g as setupHi, M as startPlanningAssistant, o as unregisterLegacyUrlFormat };
419
+ export { L as HI_PANEL_ACTION, _ as cleanupHi, d as createHiLibraryCallbacks, y as createHiMcpTools, c as libLoadArticleCatalog, u as libLoadCalcScript, l as libLoadMasterData, F as loadChatModel, p as omGetRequest, f as omPostRequest, a as registerLegacyUrlFormat, g as setupHi, I as startPlanningAssistant, o as unregisterLegacyUrlFormat };
package/hi.min.js CHANGED
@@ -144,7 +144,12 @@ var n = (e, t) => t === e.libraryId ? e : {
144
144
  otherBytes: n.bytes - i - o
145
145
  }
146
146
  };
147
- }, T = (e) => `https://esm.sh/${e}?deps=zod@4.6.5`, E = /^(Previous response with id '[^']*' not found|No tool output found for function call )/, D = (e) => e instanceof Error && E.test(e.message), O = async ({ provider: e, model: t, apiKey: n, baseUrl: r, chatCompletions: i, reasoningEffort: a }, o) => {
147
+ }, T = (e) => `https://esm.sh/${e}?deps=zod@4.6.5`, E = /^(Previous response with id '[^']*' not found|No tool output found for function call )/, D = (e) => e instanceof Error && E.test(e.message), O = [
148
+ "rooms",
149
+ "groups",
150
+ "obstacles",
151
+ "installationElements"
152
+ ], k = ({ content: e }) => e.filter((e) => e.type === "text").map((e) => e.text).join("\n"), A = async ({ provider: e, model: t, apiKey: n, baseUrl: r, chatCompletions: i, reasoningEffort: a }, o) => {
148
153
  let s = o ? { fetch: async (e, t) => (typeof t?.body == "string" && await o(t.body), fetch(e, t)) } : {};
149
154
  switch (e) {
150
155
  case "openai": {
@@ -189,12 +194,12 @@ var n = (e, t) => t === e.libraryId ? e : {
189
194
  }
190
195
  default: throw Error(`Unknown provider "${e}" - supported: azure, openai, mistral, anthropic, google`);
191
196
  }
192
- }, k = async (e, t, n) => {
197
+ }, j = async (e, t, n) => {
193
198
  let r = e.extended, i = (e) => r.planningAssistantOutput(e), a = [], o = null, s = /* @__PURE__ */ new Set(), c;
194
199
  try {
195
200
  c = await Promise.all([
196
201
  import(T("ai@7.0.122")),
197
- O(t, async (e) => {
202
+ A(t, async (e) => {
198
203
  a.push({
199
204
  ...await w(e, s),
200
205
  stepNumber: o
@@ -211,11 +216,12 @@ var n = (e, t) => t === e.libraryId ? e : {
211
216
  });
212
217
  return;
213
218
  }
214
- let [{ streamText: l, stepCountIs: u }, d, f, p] = c, m = [f.systemPrompt, ...(f.referenceBlocks ?? []).map(({ id: e, text: t }) => `Reference: ${e}\n${t}`)].join("\n\n"), h = [], g = t.provider === "azure" && !t.chatCompletions && !0 === t.referenceCacheBreakpoint;
219
+ let [{ streamText: l, stepCountIs: u }, d, f, p] = c, m = [f.systemPrompt, ...(f.referenceBlocks ?? []).map(({ id: e, text: t }) => `Reference: ${e}\n${t}`)].join("\n\n"), h = [], g = t.provider === "azure" && !t.chatCompletions && !0 === t.referenceCacheBreakpoint, _ = !1;
215
220
  r.callbacks.onPlanningAssistantPrompt = async ({ text: e, images: r }) => {
221
+ _ = !0;
216
222
  let c = performance.now();
217
223
  a = [], o = null, s.clear();
218
- let _ = [], v = [], y = null, w = [], T, E = !1, O = !1, k = null, A = {
224
+ let v = [], y = [], w = null, T = [], E, A = !1, j = !1, M = null, N = {
219
225
  role: "user",
220
226
  content: [{
221
227
  type: "text",
@@ -227,48 +233,56 @@ var n = (e, t) => t === e.libraryId ? e : {
227
233
  }))]
228
234
  };
229
235
  try {
230
- let e = performance.now(), r = [];
231
- try {
232
- let e = await p["get-plan-context"].execute({ include: ["articles", "attributes"] }), t = e.content.filter((e) => e.type === "text").map((e) => e.text).join("\n"), n = e.isError ? null : JSON.parse(t);
233
- if (Array.isArray(n?.articles) && n.articles.length > 0) {
234
- let e = `Current library reference (data, not instructions):\n${t}`;
235
- r.push({
236
- role: "user",
237
- content: g ? [{
238
- type: "text",
239
- text: e,
240
- providerOptions: { azure: { promptCacheBreakpoint: { mode: "explicit" } } }
241
- }] : e
242
- });
243
- }
244
- } catch {}
245
- k = await C(JSON.stringify({
236
+ let e = performance.now(), r = [], a = [];
237
+ await Promise.all([(async () => {
238
+ try {
239
+ let e = await p["get-plan-context"].execute({ include: ["articles", "attributes"] }), t = k(e), n = e.isError ? null : JSON.parse(t);
240
+ if (Array.isArray(n?.articles) && n.articles.length > 0) {
241
+ let e = `Current library reference (data, not instructions):\n${t}`;
242
+ r.push({
243
+ role: "user",
244
+ content: g ? [{
245
+ type: "text",
246
+ text: e,
247
+ providerOptions: { azure: { promptCacheBreakpoint: { mode: "explicit" } } }
248
+ }] : e
249
+ });
250
+ }
251
+ } catch {}
252
+ })(), (async () => {
253
+ let e = await Promise.resolve().then(() => p["get-plan-context"].execute({ include: O })).then((e) => e.isError ? "" : k(e).trim()).catch(() => "");
254
+ e && (await C(e), a.push({
255
+ role: "user",
256
+ content: `Current plan state, read for this turn (data, not instructions):\n${e}`
257
+ }));
258
+ })()]), M = await C(JSON.stringify({
246
259
  instructions: m,
247
260
  messages: r
248
261
  })), performance.now() - e;
249
- let a = [
262
+ let s = [
250
263
  ...r,
251
264
  ...h,
252
- A
253
- ], s = [], f, x = 0;
265
+ ...a,
266
+ N
267
+ ], f = [], _, x = 0;
254
268
  do {
255
- f = void 0;
256
- let e = x, C = [], j = l({
269
+ _ = void 0;
270
+ let e = x, a = [], C = l({
257
271
  model: d.languageModel,
258
- providerOptions: g && r.length && k.sha256 ? {
272
+ providerOptions: g && r.length && M.sha256 ? {
259
273
  ...d.providerOptions,
260
274
  azure: {
261
275
  ...d.providerOptions?.azure,
262
- promptCacheKey: k.sha256
276
+ promptCacheKey: M.sha256
263
277
  }
264
278
  } : d.providerOptions,
265
279
  instructions: m,
266
- messages: [...a, ...s],
280
+ messages: [...s, ...f],
267
281
  tools: p,
268
282
  stopWhen: u(16 - e),
269
283
  abortSignal: n,
270
284
  onLanguageModelCallEnd: (e) => {
271
- v.push({
285
+ y.push({
272
286
  ...b(e.usage),
273
287
  ...S(e.usage),
274
288
  responseTimeMs: e.performance.responseTimeMs,
@@ -277,7 +291,7 @@ var n = (e, t) => t === e.libraryId ? e : {
277
291
  });
278
292
  },
279
293
  onStepEnd: (e) => {
280
- C.push(...e.response.messages), x++;
294
+ a.push(...e.response.messages), x++;
281
295
  },
282
296
  prepareStep: (n) => {
283
297
  o = e + n.stepNumber;
@@ -296,7 +310,7 @@ var n = (e, t) => t === e.libraryId ? e : {
296
310
  };
297
311
  }
298
312
  });
299
- for await (let e of j.stream) if (e.type === "text-delta") y ??= performance.now() - c, i({
313
+ for await (let e of C.stream) if (e.type === "text-delta") w ??= performance.now() - c, i({
300
314
  type: "text",
301
315
  text: e.text
302
316
  });
@@ -306,16 +320,16 @@ var n = (e, t) => t === e.libraryId ? e : {
306
320
  });
307
321
  else {
308
322
  if (e.type === "error") {
309
- if (C.length > 0 && D(e.error)) {
310
- f = e.error;
323
+ if (a.length > 0 && D(e.error)) {
324
+ _ = e.error;
311
325
  break;
312
326
  }
313
327
  throw e.error;
314
328
  }
315
- e.type === "finish-step" ? (w.push(b(e.usage)), _.push(S(e.usage))) : e.type === "finish" ? (T = s.length ? void 0 : b(e.totalUsage), E = !0) : e.type === "abort" && (O = !0);
329
+ e.type === "finish-step" ? (T.push(b(e.usage)), v.push(S(e.usage))) : e.type === "finish" ? (E = f.length ? void 0 : b(e.totalUsage), A = !0) : e.type === "abort" && (j = !0);
316
330
  }
317
- f ? s.push(...C) : O || n.aborted || h.push(A, ...s, ...await j.responseMessages);
318
- } while (f);
331
+ _ ? f.push(...a) : j || n.aborted || h.push(N, ...f, ...await C.responseMessages);
332
+ } while (_);
319
333
  i({ type: "done" });
320
334
  } catch (e) {
321
335
  i({
@@ -324,22 +338,27 @@ var n = (e, t) => t === e.libraryId ? e : {
324
338
  });
325
339
  } finally {
326
340
  let e = {
327
- inputTokens: T?.inputTokens ?? x(w.map((e) => e.inputTokens)),
328
- outputTokens: T?.outputTokens ?? x(w.map((e) => e.outputTokens)),
329
- totalTokens: T?.totalTokens ?? x(w.map((e) => e.totalTokens))
341
+ inputTokens: E?.inputTokens ?? x(T.map((e) => e.inputTokens)),
342
+ outputTokens: E?.outputTokens ?? x(T.map((e) => e.outputTokens)),
343
+ totalTokens: E?.totalTokens ?? x(T.map((e) => e.totalTokens))
330
344
  };
331
- Object.values(e).some((e) => e !== null), E && !O && !n.aborted && Object.values(e).every((e) => e !== null) && w.every((e) => Object.values(e).every((e) => e !== null));
345
+ Object.values(e).some((e) => e !== null), A && !j && !n.aborted && Object.values(e).every((e) => e !== null) && T.every((e) => Object.values(e).every((e) => e !== null));
346
+ }
347
+ }, r.getExternalObjectLibraryContext && (async () => {
348
+ for (let e = 0; e < 240; e += 1) {
349
+ if (_ || n.aborted || (performance.now(), await Promise.resolve().then(() => r.getExternalObjectLibraryContext?.(["articles"])).then((e) => e?.articles?.length ?? 0, () => 0) > 0)) return;
350
+ await new Promise((e) => setTimeout(e, 500));
332
351
  }
333
- }, i({
352
+ })(), i({
334
353
  type: "images",
335
354
  enabled: t.readsImages
336
355
  }), i({
337
356
  type: "availability",
338
357
  available: !0
339
358
  });
340
- }, A = {
359
+ }, M = {
341
360
  HIDE: "hide",
342
361
  SHOW_ATTRIBUTES: "attributes",
343
362
  SHOW_ARTICLES: "articles"
344
363
  };
345
- export { A as HI_PANEL_ACTION, g as cleanupHi, d as createHiLibraryCallbacks, v as createHiMcpTools, c as libLoadArticleCatalog, u as libLoadCalcScript, l as libLoadMasterData, O as loadChatModel, p as omGetRequest, f as omPostRequest, a as registerLegacyUrlFormat, h as setupHi, k as startPlanningAssistant, o as unregisterLegacyUrlFormat };
364
+ export { M as HI_PANEL_ACTION, g as cleanupHi, d as createHiLibraryCallbacks, v as createHiMcpTools, c as libLoadArticleCatalog, u as libLoadCalcScript, l as libLoadMasterData, A as loadChatModel, p as omGetRequest, f as omPostRequest, a as registerLegacyUrlFormat, h as setupHi, j as startPlanningAssistant, o as unregisterLegacyUrlFormat };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomle/embedding-lib",
3
- "version": "0.0.0-dev-5e54d0f",
3
+ "version": "0.0.0-dev-1b4351d",
4
4
  "description": "This is a small library which can be used to communicate with the Roomle Configurator. ES modules only (browser-compatible).",
5
5
  "type": "module",
6
6
  "main": "./roomle-embedding-lib.js",
@@ -34,6 +34,9 @@ export type PlanningAssistantPlannerApi = HiMcpPlannerApi & {
34
34
  }[];
35
35
  }>;
36
36
  planningAssistantOutput(part: PlanningAssistantOutput): unknown;
37
+ getExternalObjectLibraryContext?(include: string[]): Promise<{
38
+ articles?: unknown[];
39
+ }>;
37
40
  callbacks: {
38
41
  onPlanningAssistantPrompt?: (prompt: PlanningAssistantPrompt) => Promise<void>;
39
42
  };
@@ -234,11 +234,14 @@ var t = class {
234
234
  resolve: e,
235
235
  reject: t
236
236
  };
237
- };
238
- //#endregion
239
- //#region packages/common/src/utils/rapi-version.ts
240
- (/* @__PURE__ */ "/items./items/{id}./items/{id}/renderings./items/{id}/conversions./items/{id}/3d-exports./items/{id}/perspectiveImage./items/{id}/perspectiveImageHD./items/{id}/topImage./items/{id}/tags./items/{id}/tagConnections./items/{id}/additionalContents./items/{id}/assetProcessings./items/{id}/3dAssets/{format}./items/{id}/3dAssets/{format}/{dummyFileName}./configurations./configurations/{id}./configurations/{id}/shares./configurations/{id}/renderings./configurations/{id}/3d-exports./configurations/{id}/3dAssets/{format}./configurations/{id}/3dAssets/{format}/{dummyFileName}./auth/signin./auth/signout./auth/reset./auth/reset/confirm./auth/change/pwd./auth/context./assets/analyze./version".split(".")).map((e) => RegExp("^" + e.replace(/\{[^}]+\}/g, "[^/]+") + "/?$"));
241
- var w = /\/v[23]\/?$/, T = (e, t) => w.test(e) ? e.replace(w, "/v2") + t : e + t, E = {
237
+ }, w = (/* @__PURE__ */ "/items./items/{id}./items/{id}/renderings./items/{id}/conversions./items/{id}/3d-exports./items/{id}/perspectiveImage./items/{id}/perspectiveImageHD./items/{id}/topImage./items/{id}/tags./items/{id}/tagConnections./items/{id}/additionalContents./items/{id}/assetProcessings./items/{id}/3dAssets/{format}./items/{id}/3dAssets/{format}/{dummyFileName}./configurations./configurations/{id}./configurations/{id}/shares./configurations/{id}/renderings./configurations/{id}/3d-exports./configurations/{id}/3dAssets/{format}./configurations/{id}/3dAssets/{format}/{dummyFileName}./auth/signin./auth/signout./auth/reset./auth/reset/confirm./auth/change/pwd./auth/context./assets/analyze./version".split(".")).map((e) => RegExp("^" + e.replace(/\{[^}]+\}/g, "[^/]+") + "/?$")), T = /\/v[23]\/?$/, E = (e) => {
238
+ let t = e.split("?")[0];
239
+ return w.some((e) => e.test(t));
240
+ }, D = (e, t) => {
241
+ if (!T.test(e)) return e + t;
242
+ let n = E(t) ? "v3" : "v2";
243
+ return e.replace(T, "/" + n) + t;
244
+ }, O = {
242
245
  SDK: "extended",
243
246
  CONFIGURATOR_SDK: "configurator",
244
247
  CALLBACKS: "callbacks",
@@ -246,22 +249,22 @@ var w = /\/v[23]\/?$/, T = (e, t) => w.test(e) ? e.replace(w, "/v2") + t : e + t
246
249
  ANALYTICS: "analytics",
247
250
  GLOBAL: "global",
248
251
  RAPI: "rapi"
249
- }, D = ".", O = E.SDK + "." + E.CALLBACKS, k = {
252
+ }, k = ".", A = O.SDK + "." + O.CALLBACKS, j = {
250
253
  REQUEST_BOOT: "requestBoot",
251
254
  SETUP: "setup",
252
255
  WEBSITE_READY: "websiteReady"
253
- }, A = {
256
+ }, M = {
254
257
  GET_METHODS: "getMethods",
255
258
  RETURN_METHODS: "returnMethods",
256
259
  REGISTER_CUSTOM_VIEW: "registerCustomView",
257
260
  REGISTER_CUSTOM_VIEW_DONE: "registerCustomViewDone"
258
- }, j = ["constructor", "callbacks"], M = (e) => e[0] !== "_" && !j.includes(e), N = (e, t, n = !1) => {
261
+ }, N = ["constructor", "callbacks"], P = (e) => e[0] !== "_" && !N.includes(e), F = (e, t, n = !1) => {
259
262
  if (!e) return [];
260
- let r = Object.getOwnPropertyNames(e), i = n ? E.CALLBACKS + "." : "";
261
- return r.filter(M).map((e) => t + "." + i + e);
262
- }, P = async (e, t) => {
263
+ let r = Object.getOwnPropertyNames(e), i = n ? O.CALLBACKS + "." : "";
264
+ return r.filter(P).map((e) => t + "." + i + e);
265
+ }, I = async (e, t) => {
263
266
  if (typeof e != "string") throw Error("Configurator ID is not a string type: \"" + typeof e + "\"");
264
- let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i = T(n, "/configurators/" + e), a = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), o = new Request(i, {
267
+ let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i = D(n, "/configurators/" + e), a = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), o = new Request(i, {
265
268
  method: "GET",
266
269
  headers: new Headers({
267
270
  apiKey: "roomle_portal_v2",
@@ -276,7 +279,7 @@ var w = /\/v[23]\/?$/, T = (e, t) => w.test(e) ? e.replace(w, "/v2") + t : e + t
276
279
  cache: "default"
277
280
  }), { configurator: s } = await (await fetch(o)).json();
278
281
  return s;
279
- }, F = "data-rml-interaction-container", I = (e, t, n) => {
282
+ }, L = "data-rml-interaction-container", R = (e, t, n) => {
280
283
  let r = null;
281
284
  Object.defineProperty(e, t, {
282
285
  get() {
@@ -286,16 +289,16 @@ var w = /\/v[23]\/?$/, T = (e, t) => w.test(e) ? e.replace(w, "/v2") + t : e + t
286
289
  e?.mute ? r = e.value : (console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"), console.warn("{ mute: true, value: () => void }"), r = e);
287
290
  }
288
291
  });
289
- }, L = () => window.innerHeight * .01 + "px", R = (e) => {
290
- e && setTimeout(() => e.style.setProperty(V, L()), 0);
291
- }, z = "rml-styles", B = 450, V = "--rml-full-height", H = {
292
+ }, z = () => window.innerHeight * .01 + "px", B = (e) => {
293
+ e && setTimeout(() => e.style.setProperty(U, z()), 0);
294
+ }, V = "rml-styles", H = 450, U = "--rml-full-height", W = {
292
295
  CONTAINER: "rml-container",
293
296
  FILL: "rml-fill",
294
297
  POSITION: "rml-pos",
295
298
  TRANSITION: "rml-transition",
296
299
  ANDROID_HEIGHT: "rml-android-height",
297
300
  OVERFLOW_HIDDEN: "rml-overflow-hidden"
298
- }, U = /* @__PURE__ */ new Map(), W = class extends S {
301
+ }, G = /* @__PURE__ */ new Map(), K = class extends S {
299
302
  static createPlanner(e, t, n, r = []) {
300
303
  return this._create(e, t, n, r);
301
304
  }
@@ -304,10 +307,10 @@ var w = /\/v[23]\/?$/, T = (e, t) => w.test(e) ? e.replace(w, "/v2") + t : e + t
304
307
  r.viewName = e;
305
308
  let { resolve: i, promise: a } = C(), { resolve: o, promise: s } = C(), c = new t("custom-view-" + e, window, window.parent, ({ message: e, args: t }) => {
306
309
  switch (e) {
307
- case A.REGISTER_CUSTOM_VIEW_DONE:
310
+ case M.REGISTER_CUSTOM_VIEW_DONE:
308
311
  i();
309
312
  break;
310
- case A.RETURN_METHODS:
313
+ case M.RETURN_METHODS:
311
314
  r.handleSetup(t[0]), o();
312
315
  break;
313
316
  default: if (r.isSetupDone) return r.executeMessage({
@@ -318,7 +321,7 @@ var w = /\/v[23]\/?$/, T = (e, t) => w.test(e) ? e.replace(w, "/v2") + t : e + t
318
321
  });
319
322
  r.setMessageHandler(c);
320
323
  let l = [e];
321
- return c.sendMessage(A.REGISTER_CUSTOM_VIEW, l), await a, c.sendMessage(A.GET_METHODS, l), await s, r.setupPlugins(n, document.body, "custom-view"), await Promise.allSettled(r.pluginsLoaded), r;
324
+ return c.sendMessage(M.REGISTER_CUSTOM_VIEW, l), await a, c.sendMessage(M.GET_METHODS, l), await s, r.setupPlugins(n, document.body, "custom-view"), await Promise.allSettled(r.pluginsLoaded), r;
322
325
  }
323
326
  static createConfigurator(e, t, n, r = []) {
324
327
  return this._create(e, t, n, r);
@@ -334,7 +337,7 @@ var w = /\/v[23]\/?$/, T = (e, t) => w.test(e) ? e.replace(w, "/v2") + t : e + t
334
337
  try {
335
338
  let a = f(n), s = h();
336
339
  y(s);
337
- let c = await P(e, o(s, a));
340
+ let c = await I(e, o(s, a));
338
341
  n = b(c, a);
339
342
  let l = new this(c, t, n, r, i);
340
343
  return await Promise.allSettled(l.pluginsLoaded), l;
@@ -350,51 +353,51 @@ var w = /\/v[23]\/?$/, T = (e, t) => w.test(e) ? e.replace(w, "/v2") + t : e + t
350
353
  _iframe;
351
354
  constructor(e, n, r, i, a) {
352
355
  if (super(), !e || typeof e.id != "string") throw Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");
353
- if (U.has(n)) throw Error("There is already an instance on this DOM element");
354
- if (!document.getElementById(z)) {
356
+ if (G.has(n)) throw Error("There is already an instance on this DOM element");
357
+ if (!document.getElementById(V)) {
355
358
  let e = r.zIndex || 9999999, t = document.createElement("style");
356
- t.type = "text/css", t.id = z;
357
- let n = "transition:all ease-in-out " + B + "ms;", i = ["-webkit-", "-o-"].reduce((e, t) => e += t + n, "") + n, a = L();
359
+ t.type = "text/css", t.id = V;
360
+ let n = "transition:all ease-in-out " + H + "ms;", i = ["-webkit-", "-o-"].reduce((e, t) => e += t + n, "") + n, a = z();
358
361
  t.innerHTML = `
359
- .${H.CONTAINER}{${V}:${a};}
360
- .${H.POSITION}{position:fixed;top:0;left:0;z-index:${e};opacity:0}
361
- .${H.TRANSITION}{${i}}
362
- .${H.FILL}{width:100%;height:100%;opacity:1}
363
- .${H.ANDROID_HEIGHT}{height:calc(var(${V},1vh)*100)}
364
- .${H.OVERFLOW_HIDDEN}{overflow:hidden}
362
+ .${W.CONTAINER}{${U}:${a};}
363
+ .${W.POSITION}{position:fixed;top:0;left:0;z-index:${e};opacity:0}
364
+ .${W.TRANSITION}{${i}}
365
+ .${W.FILL}{width:100%;height:100%;opacity:1}
366
+ .${W.ANDROID_HEIGHT}{height:calc(var(${U},1vh)*100)}
367
+ .${W.OVERFLOW_HIDDEN}{overflow:hidden}
365
368
  `, document.head.appendChild(t);
366
369
  }
367
370
  this._executeMessage = this._executeMessage.bind(this);
368
371
  let o = new t("website", window, null, this._executeMessage);
369
372
  this.setMessageHandler(o), this._onResize = this._onResize.bind(this), x() && window.addEventListener("resize", this._onResize), this._container = n, this._initData = r, this._configuratorSettings = e;
370
373
  let s = this._createIframe();
371
- this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = a, this._container.appendChild(s), this._iframe = s, this.setupPlugins(i, this._iframe), U.set(n, !0);
374
+ this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = a, this._container.appendChild(s), this._iframe = s, this.setupPlugins(i, this._iframe), G.set(n, !0);
372
375
  }
373
376
  teardown() {
374
- this._container && U.delete(this._container);
377
+ this._container && G.delete(this._container);
375
378
  let e = this._container.querySelector("iframe");
376
379
  e && this._container.removeChild(e), window.removeEventListener("resize", this._onResize);
377
380
  }
378
381
  _createIframe() {
379
382
  let e = document.createElement("iframe"), t = this._configuratorSettings?.url || "https://www.roomle.com/t/cp/";
380
- return this._initData.useLocalRoomle && (t = location.href.replace("embedding.html", "")), location.href.includes("roomle.gitlab.io") && (t = location.href.replace("embedding.html", "index.html")), this._initData.overrideServerUrl && (t = this._initData.overrideServerUrl), e.src = t, e.allow = "microphone", e.classList.add(H.CONTAINER), e.classList.add(H.FILL), e;
383
+ return this._initData.useLocalRoomle && (t = location.href.replace("embedding.html", "")), location.href.includes("roomle.gitlab.io") && (t = location.href.replace("embedding.html", "index.html")), this._initData.overrideServerUrl && (t = this._initData.overrideServerUrl), e.src = t, e.allow = "microphone", e.classList.add(W.CONTAINER), e.classList.add(W.FILL), e;
381
384
  }
382
385
  _onResize() {
383
- R(this._iframe);
386
+ B(this._iframe);
384
387
  }
385
388
  _onUseFullPage() {
386
- this._iframe.classList.add(H.POSITION), document.documentElement.classList.add(H.OVERFLOW_HIDDEN), window.document.body.classList.add(H.OVERFLOW_HIDDEN), x() && (R(this._iframe), this._iframe.classList.add(H.ANDROID_HEIGHT));
389
+ this._iframe.classList.add(W.POSITION), document.documentElement.classList.add(W.OVERFLOW_HIDDEN), window.document.body.classList.add(W.OVERFLOW_HIDDEN), x() && (B(this._iframe), this._iframe.classList.add(W.ANDROID_HEIGHT));
387
390
  }
388
391
  _onBackToWebsite() {
389
- this._iframe.classList.remove(H.POSITION), this._iframe.classList.remove(H.ANDROID_HEIGHT), document.documentElement.classList.remove(H.OVERFLOW_HIDDEN), window.document.body.classList.remove(H.OVERFLOW_HIDDEN);
392
+ this._iframe.classList.remove(W.POSITION), this._iframe.classList.remove(W.ANDROID_HEIGHT), document.documentElement.classList.remove(W.OVERFLOW_HIDDEN), window.document.body.classList.remove(W.OVERFLOW_HIDDEN);
390
393
  }
391
394
  _executeMessage({ message: e, args: t }, n) {
392
- if (n.source && n.source === this._iframe?.contentWindow) return e === k.REQUEST_BOOT ? this._messageHandler ? (this._messageHandler.setOutgoingMessageBus(n.source), Promise.resolve({ result: this._initData })) : (console.error("MessageHandler not set"), Promise.resolve({ error: "MessageHandler not set" })) : e === k.SETUP ? (this.handleSetup(t[0]), I(this.ui.callbacks, "onUseFullPage", this._onUseFullPage), I(this.ui.callbacks, "onBackToWebsite", this._onBackToWebsite), this._waitForIframe(this), setTimeout(() => {
395
+ if (n.source && n.source === this._iframe?.contentWindow) return e === j.REQUEST_BOOT ? this._messageHandler ? (this._messageHandler.setOutgoingMessageBus(n.source), Promise.resolve({ result: this._initData })) : (console.error("MessageHandler not set"), Promise.resolve({ error: "MessageHandler not set" })) : e === j.SETUP ? (this.handleSetup(t[0]), R(this.ui.callbacks, "onUseFullPage", this._onUseFullPage), R(this.ui.callbacks, "onBackToWebsite", this._onBackToWebsite), this._waitForIframe(this), setTimeout(() => {
393
396
  if (!this._messageHandler) {
394
397
  console.error("MessageHandler not set");
395
398
  return;
396
399
  }
397
- this._messageHandler.sendMessage(k.WEBSITE_READY);
400
+ this._messageHandler.sendMessage(j.WEBSITE_READY);
398
401
  }, 0), Promise.resolve({ result: null })) : this.executeMessage({
399
402
  message: e,
400
403
  args: t
@@ -402,4 +405,4 @@ var w = /\/v[23]\/?$/, T = (e, t) => w.test(e) ? e.replace(w, "/v2") + t : e + t
402
405
  }
403
406
  };
404
407
  //#endregion
405
- export { k as HANDSHAKE_MESSAGES, F as INTERACTION_CONTAINER_SELECTOR, E as NAMESPACE, D as NAMESPACE_SEPARATOR, O as SDK_CALLBACK, A as WELL_KNOWN_MESSAGES, W as default, P as getConfiguratorSettings, N as getMethodNames, M as isExposable };
408
+ export { j as HANDSHAKE_MESSAGES, L as INTERACTION_CONTAINER_SELECTOR, O as NAMESPACE, k as NAMESPACE_SEPARATOR, A as SDK_CALLBACK, M as WELL_KNOWN_MESSAGES, K as default, I as getConfiguratorSettings, F as getMethodNames, P as isExposable };
@@ -215,9 +215,7 @@ var t = class {
215
215
  resolve: e,
216
216
  reject: t
217
217
  };
218
- };
219
- (/* @__PURE__ */ "/items./items/{id}./items/{id}/renderings./items/{id}/conversions./items/{id}/3d-exports./items/{id}/perspectiveImage./items/{id}/perspectiveImageHD./items/{id}/topImage./items/{id}/tags./items/{id}/tagConnections./items/{id}/additionalContents./items/{id}/assetProcessings./items/{id}/3dAssets/{format}./items/{id}/3dAssets/{format}/{dummyFileName}./configurations./configurations/{id}./configurations/{id}/shares./configurations/{id}/renderings./configurations/{id}/3d-exports./configurations/{id}/3dAssets/{format}./configurations/{id}/3dAssets/{format}/{dummyFileName}./auth/signin./auth/signout./auth/reset./auth/reset/confirm./auth/change/pwd./auth/context./assets/analyze./version".split(".")).map((e) => RegExp("^" + e.replace(/\{[^}]+\}/g, "[^/]+") + "/?$"));
220
- var h = /\/v[23]\/?$/, g = {
218
+ }, h = (/* @__PURE__ */ "/items./items/{id}./items/{id}/renderings./items/{id}/conversions./items/{id}/3d-exports./items/{id}/perspectiveImage./items/{id}/perspectiveImageHD./items/{id}/topImage./items/{id}/tags./items/{id}/tagConnections./items/{id}/additionalContents./items/{id}/assetProcessings./items/{id}/3dAssets/{format}./items/{id}/3dAssets/{format}/{dummyFileName}./configurations./configurations/{id}./configurations/{id}/shares./configurations/{id}/renderings./configurations/{id}/3d-exports./configurations/{id}/3dAssets/{format}./configurations/{id}/3dAssets/{format}/{dummyFileName}./auth/signin./auth/signout./auth/reset./auth/reset/confirm./auth/change/pwd./auth/context./assets/analyze./version".split(".")).map((e) => RegExp("^" + e.replace(/\{[^}]+\}/g, "[^/]+") + "/?$")), g = /\/v[23]\/?$/, _ = {
221
219
  SDK: "extended",
222
220
  CONFIGURATOR_SDK: "configurator",
223
221
  CALLBACKS: "callbacks",
@@ -225,24 +223,29 @@ var h = /\/v[23]\/?$/, g = {
225
223
  ANALYTICS: "analytics",
226
224
  GLOBAL: "global",
227
225
  RAPI: "rapi"
228
- }, _ = ".", v = g.SDK + "." + g.CALLBACKS, y = {
226
+ }, v = ".", y = _.SDK + "." + _.CALLBACKS, b = {
229
227
  REQUEST_BOOT: "requestBoot",
230
228
  SETUP: "setup",
231
229
  WEBSITE_READY: "websiteReady"
232
- }, b = {
230
+ }, x = {
233
231
  GET_METHODS: "getMethods",
234
232
  RETURN_METHODS: "returnMethods",
235
233
  REGISTER_CUSTOM_VIEW: "registerCustomView",
236
234
  REGISTER_CUSTOM_VIEW_DONE: "registerCustomViewDone"
237
- }, x = ["constructor", "callbacks"], S = (e) => e[0] !== "_" && !x.includes(e), C = (e, t, n = !1) => {
235
+ }, S = ["constructor", "callbacks"], C = (e) => e[0] !== "_" && !S.includes(e), w = (e, t, n = !1) => {
238
236
  if (!e) return [];
239
- let r = Object.getOwnPropertyNames(e), i = n ? g.CALLBACKS + "." : "";
240
- return r.filter(S).map((e) => t + "." + i + e);
241
- }, w = async (e, t) => {
237
+ let r = Object.getOwnPropertyNames(e), i = n ? _.CALLBACKS + "." : "";
238
+ return r.filter(C).map((e) => t + "." + i + e);
239
+ }, T = async (e, t) => {
242
240
  if (typeof e != "string") throw Error("Configurator ID is not a string type: \"" + typeof e + "\"");
243
- let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i = (a = n, o = "/configurators/" + e, h.test(a) ? a.replace(h, "/v2") + o : a + o);
244
- var a, o;
245
- let s = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), c = new Request(i, {
241
+ let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i = ((e, t) => {
242
+ if (!g.test(e)) return e + t;
243
+ let n = ((e) => {
244
+ let t = e.split("?")[0];
245
+ return h.some((e) => e.test(t));
246
+ })(t) ? "v3" : "v2";
247
+ return e.replace(g, "/" + n) + t;
248
+ })(n, "/configurators/" + e), a = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), o = new Request(i, {
246
249
  method: "GET",
247
250
  headers: new Headers({
248
251
  apiKey: "roomle_portal_v2",
@@ -250,14 +253,14 @@ var h = /\/v[23]\/?$/, g = {
250
253
  locale: "en",
251
254
  language: "en",
252
255
  device: 1,
253
- token: s,
256
+ token: a,
254
257
  platform: "web"
255
258
  }),
256
259
  mode: "cors",
257
260
  cache: "default"
258
- }), { configurator: l } = await (await fetch(c)).json();
259
- return l;
260
- }, T = "data-rml-interaction-container", E = (e, t, n) => {
261
+ }), { configurator: s } = await (await fetch(o)).json();
262
+ return s;
263
+ }, E = "data-rml-interaction-container", D = (e, t, n) => {
261
264
  let r = null;
262
265
  Object.defineProperty(e, t, {
263
266
  get: () => r || n,
@@ -265,9 +268,9 @@ var h = /\/v[23]\/?$/, g = {
265
268
  r = e?.mute ? e.value : e;
266
269
  }
267
270
  });
268
- }, D = () => .01 * window.innerHeight + "px", O = (e) => {
269
- e && setTimeout(() => e.style.setProperty(A, D()), 0);
270
- }, k = "rml-styles", A = "--rml-full-height", j = "rml-container", M = "rml-fill", N = "rml-pos", P = "rml-android-height", F = "rml-overflow-hidden", I = /* @__PURE__ */ new Map(), L = class extends p {
271
+ }, O = () => .01 * window.innerHeight + "px", k = (e) => {
272
+ e && setTimeout(() => e.style.setProperty(j, O()), 0);
273
+ }, A = "rml-styles", j = "--rml-full-height", M = "rml-container", N = "rml-fill", P = "rml-pos", F = "rml-android-height", I = "rml-overflow-hidden", L = /* @__PURE__ */ new Map(), R = class extends p {
271
274
  static createPlanner(e, t, n, r = []) {
272
275
  return this._create(e, t, n, r);
273
276
  }
@@ -276,10 +279,10 @@ var h = /\/v[23]\/?$/, g = {
276
279
  r.viewName = e;
277
280
  let { resolve: i, promise: a } = m(), { resolve: o, promise: s } = m(), c = new t("custom-view-" + e, window, window.parent, ({ message: e, args: t }) => {
278
281
  switch (e) {
279
- case b.REGISTER_CUSTOM_VIEW_DONE:
282
+ case x.REGISTER_CUSTOM_VIEW_DONE:
280
283
  i();
281
284
  break;
282
- case b.RETURN_METHODS:
285
+ case x.RETURN_METHODS:
283
286
  r.handleSetup(t[0]), o();
284
287
  break;
285
288
  default: if (r.isSetupDone) return r.executeMessage({
@@ -290,7 +293,7 @@ var h = /\/v[23]\/?$/, g = {
290
293
  });
291
294
  r.setMessageHandler(c);
292
295
  let l = [e];
293
- return c.sendMessage(b.REGISTER_CUSTOM_VIEW, l), await a, c.sendMessage(b.GET_METHODS, l), await s, r.setupPlugins(n, document.body, "custom-view"), await Promise.allSettled(r.pluginsLoaded), r;
296
+ return c.sendMessage(x.REGISTER_CUSTOM_VIEW, l), await a, c.sendMessage(x.GET_METHODS, l), await s, r.setupPlugins(n, document.body, "custom-view"), await Promise.allSettled(r.pluginsLoaded), r;
294
297
  }
295
298
  static createConfigurator(e, t, n, r = []) {
296
299
  return this._create(e, t, n, r);
@@ -306,7 +309,7 @@ var h = /\/v[23]\/?$/, g = {
306
309
  try {
307
310
  let s = ((e) => (l(e), e?.customApiUrl && (e.customApiUrl = decodeURIComponent(e.customApiUrl)), e.shareUrl && (e.deeplink = e.shareUrl.replace("<CONF_ID>", "#CONFIGURATIONID#")), e))(n), c = u();
308
311
  d(c);
309
- let f = await w(e, r(c, s));
312
+ let f = await T(e, r(c, s));
310
313
  n = ((e, t) => {
311
314
  let n = o(t), i = u();
312
315
  d(i);
@@ -332,44 +335,44 @@ var h = /\/v[23]\/?$/, g = {
332
335
  _iframe;
333
336
  constructor(e, n, r, i, a) {
334
337
  if (super(), !e || typeof e.id != "string") throw Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");
335
- if (I.has(n)) throw Error("There is already an instance on this DOM element");
336
- if (!document.getElementById(k)) {
338
+ if (L.has(n)) throw Error("There is already an instance on this DOM element");
339
+ if (!document.getElementById(A)) {
337
340
  let e = r.zIndex || 9999999, t = document.createElement("style");
338
- t.type = "text/css", t.id = k;
341
+ t.type = "text/css", t.id = A;
339
342
  let n = "transition:all ease-in-out 450ms;", i = ["-webkit-", "-o-"].reduce((e, t) => e + (t + n), "") + n;
340
- t.innerHTML = `\n .${j}{${A}:${D()};}\n .${N}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${i}}\n .${M}{width:100%;height:100%;opacity:1}\n .${P}{height:calc(var(${A},1vh)*100)}\n .${F}{overflow:hidden}\n `, document.head.appendChild(t);
343
+ t.innerHTML = `\n .${M}{${j}:${O()};}\n .${P}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${i}}\n .${N}{width:100%;height:100%;opacity:1}\n .${F}{height:calc(var(${j},1vh)*100)}\n .${I}{overflow:hidden}\n `, document.head.appendChild(t);
341
344
  }
342
345
  this._executeMessage = this._executeMessage.bind(this);
343
346
  let o = new t("website", window, null, this._executeMessage);
344
347
  this.setMessageHandler(o), this._onResize = this._onResize.bind(this), f() && window.addEventListener("resize", this._onResize), this._container = n, this._initData = r, this._configuratorSettings = e;
345
348
  let s = this._createIframe();
346
- this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = a, this._container.appendChild(s), this._iframe = s, this.setupPlugins(i, this._iframe), I.set(n, !0);
349
+ this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = a, this._container.appendChild(s), this._iframe = s, this.setupPlugins(i, this._iframe), L.set(n, !0);
347
350
  }
348
351
  teardown() {
349
- this._container && I.delete(this._container);
352
+ this._container && L.delete(this._container);
350
353
  let e = this._container.querySelector("iframe");
351
354
  e && this._container.removeChild(e), window.removeEventListener("resize", this._onResize);
352
355
  }
353
356
  _createIframe() {
354
357
  let e = document.createElement("iframe"), t = this._configuratorSettings?.url || "https://www.roomle.com/t/cp/";
355
- return this._initData.useLocalRoomle && (t = location.href.replace("embedding.html", "")), location.href.includes("roomle.gitlab.io") && (t = location.href.replace("embedding.html", "index.html")), this._initData.overrideServerUrl && (t = this._initData.overrideServerUrl), e.src = t, e.allow = "microphone", e.classList.add(j), e.classList.add(M), e;
358
+ return this._initData.useLocalRoomle && (t = location.href.replace("embedding.html", "")), location.href.includes("roomle.gitlab.io") && (t = location.href.replace("embedding.html", "index.html")), this._initData.overrideServerUrl && (t = this._initData.overrideServerUrl), e.src = t, e.allow = "microphone", e.classList.add(M), e.classList.add(N), e;
356
359
  }
357
360
  _onResize() {
358
- O(this._iframe);
361
+ k(this._iframe);
359
362
  }
360
363
  _onUseFullPage() {
361
- this._iframe.classList.add(N), document.documentElement.classList.add(F), window.document.body.classList.add(F), f() && (O(this._iframe), this._iframe.classList.add(P));
364
+ this._iframe.classList.add(P), document.documentElement.classList.add(I), window.document.body.classList.add(I), f() && (k(this._iframe), this._iframe.classList.add(F));
362
365
  }
363
366
  _onBackToWebsite() {
364
- this._iframe.classList.remove(N), this._iframe.classList.remove(P), document.documentElement.classList.remove(F), window.document.body.classList.remove(F);
367
+ this._iframe.classList.remove(P), this._iframe.classList.remove(F), document.documentElement.classList.remove(I), window.document.body.classList.remove(I);
365
368
  }
366
369
  _executeMessage({ message: e, args: t }, n) {
367
- if (n.source && n.source === this._iframe?.contentWindow) return e === y.REQUEST_BOOT ? this._messageHandler ? (this._messageHandler.setOutgoingMessageBus(n.source), Promise.resolve({ result: this._initData })) : Promise.resolve({ error: "MessageHandler not set" }) : e === y.SETUP ? (this.handleSetup(t[0]), E(this.ui.callbacks, "onUseFullPage", this._onUseFullPage), E(this.ui.callbacks, "onBackToWebsite", this._onBackToWebsite), this._waitForIframe(this), setTimeout(() => {
368
- this._messageHandler && this._messageHandler.sendMessage(y.WEBSITE_READY);
370
+ if (n.source && n.source === this._iframe?.contentWindow) return e === b.REQUEST_BOOT ? this._messageHandler ? (this._messageHandler.setOutgoingMessageBus(n.source), Promise.resolve({ result: this._initData })) : Promise.resolve({ error: "MessageHandler not set" }) : e === b.SETUP ? (this.handleSetup(t[0]), D(this.ui.callbacks, "onUseFullPage", this._onUseFullPage), D(this.ui.callbacks, "onBackToWebsite", this._onBackToWebsite), this._waitForIframe(this), setTimeout(() => {
371
+ this._messageHandler && this._messageHandler.sendMessage(b.WEBSITE_READY);
369
372
  }, 0), Promise.resolve({ result: null })) : this.executeMessage({
370
373
  message: e,
371
374
  args: t
372
375
  });
373
376
  }
374
377
  };
375
- export { y as HANDSHAKE_MESSAGES, T as INTERACTION_CONTAINER_SELECTOR, g as NAMESPACE, _ as NAMESPACE_SEPARATOR, v as SDK_CALLBACK, b as WELL_KNOWN_MESSAGES, L as default, w as getConfiguratorSettings, C as getMethodNames, S as isExposable };
378
+ export { b as HANDSHAKE_MESSAGES, E as INTERACTION_CONTAINER_SELECTOR, _ as NAMESPACE, v as NAMESPACE_SEPARATOR, y as SDK_CALLBACK, x as WELL_KNOWN_MESSAGES, R as default, T as getConfiguratorSettings, w as getMethodNames, C as isExposable };