@vertexvis/doc-viewer 0.24.5-canary.8

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.
Files changed (73) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/doc-viewer.cjs.js +27 -0
  3. package/dist/cjs/index-DY-_Uhw6.js +1914 -0
  4. package/dist/cjs/index.cjs.js +5 -0
  5. package/dist/cjs/loader.cjs.js +15 -0
  6. package/dist/cjs/vertex-document-viewer.cjs.entry.js +34272 -0
  7. package/dist/collection/__mocks__/pdfjs-mock.js +33 -0
  8. package/dist/collection/__setup__/polyfills.js +28 -0
  9. package/dist/collection/__setup__/resize-observer.js +13 -0
  10. package/dist/collection/collection-manifest.json +14 -0
  11. package/dist/collection/components/document-viewer/document-viewer.css +26 -0
  12. package/dist/collection/components/document-viewer/document-viewer.js +556 -0
  13. package/dist/collection/index.js +5 -0
  14. package/dist/collection/lib/config.js +1 -0
  15. package/dist/collection/lib/document/api.js +97 -0
  16. package/dist/collection/lib/document/layers/controller.js +41 -0
  17. package/dist/collection/lib/document/layers/index.js +5 -0
  18. package/dist/collection/lib/document/layers/types.js +9 -0
  19. package/dist/collection/lib/document/provider.js +1 -0
  20. package/dist/collection/lib/document/renderer.js +22 -0
  21. package/dist/collection/lib/dom.js +6 -0
  22. package/dist/collection/lib/index.js +4 -0
  23. package/dist/collection/lib/interactions/pan-interaction-handler.js +67 -0
  24. package/dist/collection/lib/pdf/pdfjs-api.js +67 -0
  25. package/dist/collection/lib/pdf/pdfjs-provider.js +12 -0
  26. package/dist/collection/lib/pdf/pdfjs-renderer.js +77 -0
  27. package/dist/collection/lib/types/loadableResource.js +18 -0
  28. package/dist/collection/polyfill/index.js +7 -0
  29. package/dist/collection/polyfill/resize-observer.js +9 -0
  30. package/dist/collection/testing/mock-document-api.js +19 -0
  31. package/dist/components/index.d.ts +35 -0
  32. package/dist/components/index.js +4 -0
  33. package/dist/components/p-DRNDkVQa.js +4 -0
  34. package/dist/components/vertex-document-viewer.d.ts +11 -0
  35. package/dist/components/vertex-document-viewer.js +39 -0
  36. package/dist/doc-viewer/doc-viewer.css +1 -0
  37. package/dist/doc-viewer/doc-viewer.esm.js +4 -0
  38. package/dist/doc-viewer/index.esm.js +3 -0
  39. package/dist/doc-viewer/p-Ct6uMP9a.js +5 -0
  40. package/dist/doc-viewer/p-b8e2846a.entry.js +39 -0
  41. package/dist/esm/doc-viewer.js +23 -0
  42. package/dist/esm/index-Ct6uMP9a.js +1886 -0
  43. package/dist/esm/index.js +3 -0
  44. package/dist/esm/loader.js +13 -0
  45. package/dist/esm/vertex-document-viewer.entry.js +34251 -0
  46. package/dist/index.cjs.js +1 -0
  47. package/dist/index.js +1 -0
  48. package/dist/types/__mocks__/pdfjs-mock.d.ts +30 -0
  49. package/dist/types/__setup__/polyfills.d.ts +1 -0
  50. package/dist/types/__setup__/resize-observer.d.ts +1 -0
  51. package/dist/types/components/document-viewer/document-viewer.d.ts +132 -0
  52. package/dist/types/components.d.ts +176 -0
  53. package/dist/types/index.d.ts +2 -0
  54. package/dist/types/lib/config.d.ts +8 -0
  55. package/dist/types/lib/document/api.d.ts +51 -0
  56. package/dist/types/lib/document/layers/controller.d.ts +24 -0
  57. package/dist/types/lib/document/layers/index.d.ts +2 -0
  58. package/dist/types/lib/document/layers/types.d.ts +15 -0
  59. package/dist/types/lib/document/provider.d.ts +16 -0
  60. package/dist/types/lib/document/renderer.d.ts +16 -0
  61. package/dist/types/lib/dom.d.ts +1 -0
  62. package/dist/types/lib/index.d.ts +1 -0
  63. package/dist/types/lib/interactions/pan-interaction-handler.d.ts +16 -0
  64. package/dist/types/lib/pdf/pdfjs-api.d.ts +19 -0
  65. package/dist/types/lib/pdf/pdfjs-provider.d.ts +10 -0
  66. package/dist/types/lib/pdf/pdfjs-renderer.d.ts +11 -0
  67. package/dist/types/lib/types/loadableResource.d.ts +11 -0
  68. package/dist/types/polyfill/index.d.ts +1 -0
  69. package/dist/types/polyfill/resize-observer.d.ts +1 -0
  70. package/dist/types/stencil-public-runtime.d.ts +1860 -0
  71. package/dist/types/testing/mock-document-api.d.ts +14 -0
  72. package/package.json +96 -0
  73. package/readme.md +17 -0
@@ -0,0 +1,1886 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ const NAMESPACE = 'doc-viewer';
5
+ const BUILD = /* doc-viewer */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, prop: true, propChangeCallback: true, updatable: true};
6
+
7
+ var ResizeObserver$1 = {};
8
+
9
+ var ResizeObservation = {};
10
+
11
+ var ContentRect = {};
12
+
13
+ var hasRequiredContentRect;
14
+
15
+ function requireContentRect () {
16
+ if (hasRequiredContentRect) return ContentRect;
17
+ hasRequiredContentRect = 1;
18
+ Object.defineProperty(ContentRect, "__esModule", { value: true });
19
+ var ContentRect$1 = function (target) {
20
+ if ('getBBox' in target) {
21
+ var box = target.getBBox();
22
+ return Object.freeze({
23
+ height: box.height,
24
+ left: 0,
25
+ top: 0,
26
+ width: box.width,
27
+ });
28
+ }
29
+ else { // if (target instanceof HTMLElement) { // also includes all other non-SVGGraphicsElements
30
+ var styles = window.getComputedStyle(target);
31
+ return Object.freeze({
32
+ height: parseFloat(styles.height || '0'),
33
+ left: parseFloat(styles.paddingLeft || '0'),
34
+ top: parseFloat(styles.paddingTop || '0'),
35
+ width: parseFloat(styles.width || '0'),
36
+ });
37
+ }
38
+ };
39
+ ContentRect.ContentRect = ContentRect$1;
40
+
41
+ return ContentRect;
42
+ }
43
+
44
+ var hasRequiredResizeObservation;
45
+
46
+ function requireResizeObservation () {
47
+ if (hasRequiredResizeObservation) return ResizeObservation;
48
+ hasRequiredResizeObservation = 1;
49
+ Object.defineProperty(ResizeObservation, "__esModule", { value: true });
50
+ var ContentRect_1 = requireContentRect();
51
+ var ResizeObservation$1 = /** @class */ (function () {
52
+ function ResizeObservation(target) {
53
+ this.target = target;
54
+ this.$$broadcastWidth = this.$$broadcastHeight = 0;
55
+ }
56
+ Object.defineProperty(ResizeObservation.prototype, "broadcastWidth", {
57
+ get: function () {
58
+ return this.$$broadcastWidth;
59
+ },
60
+ enumerable: true,
61
+ configurable: true
62
+ });
63
+ Object.defineProperty(ResizeObservation.prototype, "broadcastHeight", {
64
+ get: function () {
65
+ return this.$$broadcastHeight;
66
+ },
67
+ enumerable: true,
68
+ configurable: true
69
+ });
70
+ ResizeObservation.prototype.isActive = function () {
71
+ var cr = ContentRect_1.ContentRect(this.target);
72
+ return !!cr
73
+ && (cr.width !== this.broadcastWidth
74
+ || cr.height !== this.broadcastHeight);
75
+ };
76
+ return ResizeObservation;
77
+ }());
78
+ ResizeObservation.ResizeObservation = ResizeObservation$1;
79
+
80
+ return ResizeObservation;
81
+ }
82
+
83
+ var ResizeObserverEntry = {};
84
+
85
+ var hasRequiredResizeObserverEntry;
86
+
87
+ function requireResizeObserverEntry () {
88
+ if (hasRequiredResizeObserverEntry) return ResizeObserverEntry;
89
+ hasRequiredResizeObserverEntry = 1;
90
+ Object.defineProperty(ResizeObserverEntry, "__esModule", { value: true });
91
+ var ContentRect_1 = requireContentRect();
92
+ var ResizeObserverEntry$1 = /** @class */ (function () {
93
+ function ResizeObserverEntry(target) {
94
+ this.target = target;
95
+ this.contentRect = ContentRect_1.ContentRect(target);
96
+ }
97
+ return ResizeObserverEntry;
98
+ }());
99
+ ResizeObserverEntry.ResizeObserverEntry = ResizeObserverEntry$1;
100
+
101
+ return ResizeObserverEntry;
102
+ }
103
+
104
+ var hasRequiredResizeObserver;
105
+
106
+ function requireResizeObserver () {
107
+ if (hasRequiredResizeObserver) return ResizeObserver$1;
108
+ hasRequiredResizeObserver = 1;
109
+ Object.defineProperty(ResizeObserver$1, "__esModule", { value: true });
110
+ var ResizeObservation_1 = requireResizeObservation();
111
+ var ResizeObserverEntry_1 = requireResizeObserverEntry();
112
+ var resizeObservers = [];
113
+ var ResizeObserver = /** @class */ (function () {
114
+ function ResizeObserver(callback) {
115
+ /** @internal */
116
+ this.$$observationTargets = [];
117
+ /** @internal */
118
+ this.$$activeTargets = [];
119
+ /** @internal */
120
+ this.$$skippedTargets = [];
121
+ var message = callbackGuard(callback);
122
+ if (message) {
123
+ throw TypeError(message);
124
+ }
125
+ this.$$callback = callback;
126
+ }
127
+ ResizeObserver.prototype.observe = function (target) {
128
+ var message = targetGuard('observe', target);
129
+ if (message) {
130
+ throw TypeError(message);
131
+ }
132
+ var index = findTargetIndex(this.$$observationTargets, target);
133
+ if (index >= 0) {
134
+ return;
135
+ }
136
+ this.$$observationTargets.push(new ResizeObservation_1.ResizeObservation(target));
137
+ registerResizeObserver(this);
138
+ };
139
+ ResizeObserver.prototype.unobserve = function (target) {
140
+ var message = targetGuard('unobserve', target);
141
+ if (message) {
142
+ throw TypeError(message);
143
+ }
144
+ var index = findTargetIndex(this.$$observationTargets, target);
145
+ if (index < 0) {
146
+ return;
147
+ }
148
+ this.$$observationTargets.splice(index, 1);
149
+ if (this.$$observationTargets.length === 0) {
150
+ deregisterResizeObserver(this);
151
+ }
152
+ };
153
+ ResizeObserver.prototype.disconnect = function () {
154
+ this.$$observationTargets = [];
155
+ this.$$activeTargets = [];
156
+ deregisterResizeObserver(this);
157
+ };
158
+ return ResizeObserver;
159
+ }());
160
+ ResizeObserver$1.ResizeObserver = ResizeObserver;
161
+ function registerResizeObserver(resizeObserver) {
162
+ var index = resizeObservers.indexOf(resizeObserver);
163
+ if (index < 0) {
164
+ resizeObservers.push(resizeObserver);
165
+ startLoop();
166
+ }
167
+ }
168
+ function deregisterResizeObserver(resizeObserver) {
169
+ var index = resizeObservers.indexOf(resizeObserver);
170
+ if (index >= 0) {
171
+ resizeObservers.splice(index, 1);
172
+ checkStopLoop();
173
+ }
174
+ }
175
+ function callbackGuard(callback) {
176
+ if (typeof (callback) === 'undefined') {
177
+ return "Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.";
178
+ }
179
+ if (typeof (callback) !== 'function') {
180
+ return "Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.";
181
+ }
182
+ }
183
+ function targetGuard(functionName, target) {
184
+ if (typeof (target) === 'undefined') {
185
+ return "Failed to execute '" + functionName + "' on 'ResizeObserver': 1 argument required, but only 0 present.";
186
+ }
187
+ if (!(target && target.nodeType === window.Node.ELEMENT_NODE)) {
188
+ return "Failed to execute '" + functionName + "' on 'ResizeObserver': parameter 1 is not of type 'Element'.";
189
+ }
190
+ }
191
+ function findTargetIndex(collection, target) {
192
+ for (var index = 0; index < collection.length; index += 1) {
193
+ if (collection[index].target === target) {
194
+ return index;
195
+ }
196
+ }
197
+ return -1;
198
+ }
199
+ var gatherActiveObservationsAtDepth = function (depth) {
200
+ resizeObservers.forEach(function (ro) {
201
+ ro.$$activeTargets = [];
202
+ ro.$$skippedTargets = [];
203
+ ro.$$observationTargets.forEach(function (ot) {
204
+ if (ot.isActive()) {
205
+ var targetDepth = calculateDepthForNode(ot.target);
206
+ if (targetDepth > depth) {
207
+ ro.$$activeTargets.push(ot);
208
+ }
209
+ else {
210
+ ro.$$skippedTargets.push(ot);
211
+ }
212
+ }
213
+ });
214
+ });
215
+ };
216
+ var hasActiveObservations = function () {
217
+ return resizeObservers.some(function (ro) { return !!ro.$$activeTargets.length; });
218
+ };
219
+ var hasSkippedObservations = function () {
220
+ return resizeObservers.some(function (ro) { return !!ro.$$skippedTargets.length; });
221
+ };
222
+ var broadcastActiveObservations = function () {
223
+ var shallowestTargetDepth = Infinity;
224
+ resizeObservers.forEach(function (ro) {
225
+ if (!ro.$$activeTargets.length) {
226
+ return;
227
+ }
228
+ var entries = [];
229
+ ro.$$activeTargets.forEach(function (obs) {
230
+ var entry = new ResizeObserverEntry_1.ResizeObserverEntry(obs.target);
231
+ entries.push(entry);
232
+ obs.$$broadcastWidth = entry.contentRect.width;
233
+ obs.$$broadcastHeight = entry.contentRect.height;
234
+ var targetDepth = calculateDepthForNode(obs.target);
235
+ if (targetDepth < shallowestTargetDepth) {
236
+ shallowestTargetDepth = targetDepth;
237
+ }
238
+ });
239
+ ro.$$callback(entries, ro);
240
+ ro.$$activeTargets = [];
241
+ });
242
+ return shallowestTargetDepth;
243
+ };
244
+ var deliverResizeLoopErrorNotification = function () {
245
+ var errorEvent = new window.ErrorEvent('ResizeLoopError', {
246
+ message: 'ResizeObserver loop completed with undelivered notifications.',
247
+ });
248
+ window.dispatchEvent(errorEvent);
249
+ };
250
+ var calculateDepthForNode = function (target) {
251
+ var depth = 0;
252
+ while (target.parentNode) {
253
+ target = target.parentNode;
254
+ depth += 1;
255
+ }
256
+ return depth;
257
+ };
258
+ var notificationIteration = function () {
259
+ var depth = 0;
260
+ gatherActiveObservationsAtDepth(depth);
261
+ while (hasActiveObservations()) {
262
+ depth = broadcastActiveObservations();
263
+ gatherActiveObservationsAtDepth(depth);
264
+ }
265
+ if (hasSkippedObservations()) {
266
+ deliverResizeLoopErrorNotification();
267
+ }
268
+ };
269
+ var animationFrameCancelToken;
270
+ var startLoop = function () {
271
+ if (animationFrameCancelToken)
272
+ return;
273
+ runLoop();
274
+ };
275
+ var runLoop = function () {
276
+ animationFrameCancelToken = window.requestAnimationFrame(function () {
277
+ notificationIteration();
278
+ runLoop();
279
+ });
280
+ };
281
+ var checkStopLoop = function () {
282
+ if (animationFrameCancelToken && !resizeObservers.some(function (ro) { return !!ro.$$observationTargets.length; })) {
283
+ window.cancelAnimationFrame(animationFrameCancelToken);
284
+ animationFrameCancelToken = undefined;
285
+ }
286
+ };
287
+ var install = function () {
288
+ return window.ResizeObserver = ResizeObserver;
289
+ };
290
+ ResizeObserver$1.install = install;
291
+
292
+ return ResizeObserver$1;
293
+ }
294
+
295
+ var ResizeObserverExports = requireResizeObserver();
296
+
297
+ function resizeObserver () {
298
+ if (typeof ResizeObserver === 'undefined') {
299
+ ResizeObserverExports.install();
300
+ }
301
+ }
302
+
303
+ function index () {
304
+ resizeObserver();
305
+ }
306
+
307
+ const appGlobalScript = index || (() => {});
308
+ const globalScripts = appGlobalScript;
309
+ const globalStyles = ":root{--white:#ffffff;--black:#000000}:root{--neutral-050:#fafafa;--neutral-100:#f5f5f5;--neutral-200:#eeeeee;--neutral-300:#e0e0e0;--neutral-400:#bdbdbd;--neutral-500:#9e9e9e;--neutral-600:#757575;--neutral-700:#616161;--neutral-800:#444444;--neutral-900:#212121}:root{--red-050:#fff7f7;--red-100:#ffefef;--red-200:#ffe0e0;--red-300:#ffb3b3;--red-400:#ff4d4d;--red-500:#ff0000;--red-600:#eb0000;--red-700:#d90000;--red-800:#c40000;--red-900:#990000}:root{--orange-050:#fffcf7;--orange-100:#fff9ef;--orange-200:#fff3e0;--orange-300:#ffe0b3;--orange-400:#ffb84d;--orange-500:#ff9900;--orange-600:#ff8400;--orange-700:#ff7300;--orange-800:#e05d00;--orange-900:#993b00}:root{--yellow-050:#fffef7;--yellow-100:#fffdef;--yellow-200:#fffbe0;--yellow-300:#fff5b3;--yellow-400:#ffee6e;--yellow-500:#ffe600;--yellow-600:#ffd300;--yellow-700:#ffc500;--yellow-800:#cc8f00;--yellow-900:#995c00}:root{--green-050:#f7fdf7;--green-100:#effcef;--green-200:#e0f9e0;--green-300:#b3f0b3;--green-400:#4ddb4d;--green-500:#00cc00;--green-600:#00c000;--green-700:#00ad00;--green-800:#008000;--green-900:#004d00}:root{--teal-050:#f8fdfc;--teal-100:#f1fbfa;--teal-200:#e4f7f5;--teal-300:#bcece7;--teal-400:#62d2c7;--teal-500:#1fbeaf;--teal-600:#17af9f;--teal-700:#0a9986;--teal-800:#07705f;--teal-900:#054d43}:root{--blue-050:#f7fcfd;--blue-100:#eff9fc;--blue-200:#e0f3f9;--blue-300:#b3e0f0;--blue-400:#4db8db;--blue-500:#0099cc;--blue-600:#0086c0;--blue-700:#006bad;--blue-800:#004f80;--blue-900:#002f4d}:root{--purple-050:#fdf9fc;--purple-100:#faf2f8;--purple-200:#f6e6f2;--purple-300:#e9c2e0;--purple-400:#cb70b6;--purple-500:#b43296;--purple-600:#a42683;--purple-700:#8c1368;--purple-800:#66124b;--purple-900:#4d0b39}:root{--x-axis-color:#ea3324;--y-axis-color:#4faf32;--z-axis-color:#0000ff;--two-axes-color:#e0e0e0}:root{--padding-1:0.25em;--padding-2:0.5em;--padding-3:0.75em;--padding-4:1em;--padding-5:1.25em;--padding-6:1.5em;--padding-7:1.75em;--padding-8:2em;--abs-padding-1:0.25rem;--abs-padding-2:0.5rem;--abs-padding-3:0.75rem;--abs-padding-4:1rem;--abs-padding-5:1.25rem;--abs-padding-6:1.5rem;--abs-padding-7:1.75rem;--abs-padding-8:2rem}";
310
+
311
+ /*
312
+ Stencil Client Platform v4.43.3 | MIT Licensed | https://stenciljs.com
313
+ */
314
+
315
+
316
+ // src/utils/get-prop-descriptor.ts
317
+ function getPropertyDescriptor(obj, memberName, getOnly) {
318
+ const stopAt = typeof HTMLElement !== "undefined" ? HTMLElement.prototype : null;
319
+ while (obj && obj !== stopAt) {
320
+ const desc = Object.getOwnPropertyDescriptor(obj, memberName);
321
+ if (desc && (!getOnly || desc.get)) return desc;
322
+ obj = Object.getPrototypeOf(obj);
323
+ }
324
+ return void 0;
325
+ }
326
+
327
+ // src/utils/es2022-rewire-class-members.ts
328
+ var reWireGetterSetter = (instance, hostRef) => {
329
+ var _a;
330
+ const cmpMeta = hostRef.$cmpMeta$;
331
+ const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
332
+ members.map(([memberName, [memberFlags]]) => {
333
+ if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
334
+ const ogValue = instance[memberName];
335
+ const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName, true) || Object.getOwnPropertyDescriptor(instance, memberName);
336
+ if (ogDescriptor) {
337
+ Object.defineProperty(instance, memberName, {
338
+ get() {
339
+ return ogDescriptor.get.call(this);
340
+ },
341
+ set(newValue) {
342
+ ogDescriptor.set.call(this, newValue);
343
+ },
344
+ configurable: true,
345
+ enumerable: true
346
+ });
347
+ }
348
+ if (hostRef.$instanceValues$.has(memberName)) {
349
+ instance[memberName] = hostRef.$instanceValues$.get(memberName);
350
+ } else if (ogValue !== void 0) {
351
+ instance[memberName] = ogValue;
352
+ }
353
+ }
354
+ });
355
+ };
356
+
357
+ // src/client/client-host-ref.ts
358
+ var getHostRef = (ref) => {
359
+ if (ref.__stencil__getHostRef) {
360
+ return ref.__stencil__getHostRef();
361
+ }
362
+ return void 0;
363
+ };
364
+ var registerInstance = (lazyInstance, hostRef) => {
365
+ if (!hostRef) return;
366
+ lazyInstance.__stencil__getHostRef = () => hostRef;
367
+ hostRef.$lazyInstance$ = lazyInstance;
368
+ if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.prop)) {
369
+ reWireGetterSetter(lazyInstance, hostRef);
370
+ }
371
+ };
372
+ var registerHost = (hostElement, cmpMeta) => {
373
+ const hostRef = {
374
+ $flags$: 0,
375
+ $hostElement$: hostElement,
376
+ $cmpMeta$: cmpMeta,
377
+ $instanceValues$: /* @__PURE__ */ new Map(),
378
+ $serializerValues$: /* @__PURE__ */ new Map()
379
+ };
380
+ {
381
+ hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
382
+ }
383
+ {
384
+ hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
385
+ hostElement["s-p"] = [];
386
+ hostElement["s-rc"] = [];
387
+ }
388
+ {
389
+ hostRef.$fetchedCbList$ = [];
390
+ }
391
+ const ref = hostRef;
392
+ hostElement.__stencil__getHostRef = () => ref;
393
+ return ref;
394
+ };
395
+ var isMemberInElement = (elm, memberName) => memberName in elm;
396
+ var consoleError = (e, el) => (0, console.error)(e, el);
397
+
398
+ // src/client/client-load-module.ts
399
+ var cmpModules = /* @__PURE__ */ new Map();
400
+ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
401
+ const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
402
+ const bundleId = cmpMeta.$lazyBundleId$;
403
+ if (!bundleId) {
404
+ return void 0;
405
+ }
406
+ const module = cmpModules.get(bundleId) ;
407
+ if (module) {
408
+ return module[exportName];
409
+ }
410
+
411
+ if (!hmrVersionId || !BUILD.hotModuleReplacement) {
412
+ const processMod = importedModule => {
413
+ cmpModules.set(bundleId, importedModule);
414
+ return importedModule[exportName];
415
+ }
416
+ switch(bundleId) {
417
+
418
+ case 'vertex-document-viewer':
419
+ return import(
420
+ /* webpackMode: "lazy" */
421
+ './vertex-document-viewer.entry.js').then(processMod, consoleError);
422
+ }
423
+ }
424
+ return import(
425
+ /* @vite-ignore */
426
+ /* webpackInclude: /\.entry\.js$/ */
427
+ /* webpackExclude: /\.system\.entry\.js$/ */
428
+ /* webpackMode: "lazy" */
429
+ `./${bundleId}.entry.js${""}`
430
+ ).then(
431
+ (importedModule) => {
432
+ {
433
+ cmpModules.set(bundleId, importedModule);
434
+ }
435
+ return importedModule[exportName];
436
+ },
437
+ (e) => {
438
+ consoleError(e, hostRef.$hostElement$);
439
+ }
440
+ );
441
+ };
442
+
443
+ // src/client/client-style.ts
444
+ var styles = /* @__PURE__ */ new Map();
445
+ var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
446
+ var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
447
+ var win = typeof window !== "undefined" ? window : {};
448
+ var plt = {
449
+ $flags$: 0,
450
+ $resourcesUrl$: "",
451
+ jmp: (h2) => h2(),
452
+ raf: (h2) => requestAnimationFrame(h2),
453
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
454
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
455
+ ce: (eventName, opts) => new CustomEvent(eventName, opts)
456
+ };
457
+ var promiseResolve = (v) => Promise.resolve(v);
458
+ var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
459
+ try {
460
+ if (!win.document.adoptedStyleSheets) {
461
+ return false;
462
+ }
463
+ new CSSStyleSheet();
464
+ return typeof new CSSStyleSheet().replaceSync === "function";
465
+ } catch (e) {
466
+ }
467
+ return false;
468
+ })() ;
469
+ var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @__PURE__ */ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;
470
+ var queuePending = false;
471
+ var queueDomReads = [];
472
+ var queueDomWrites = [];
473
+ var queueTask = (queue, write) => (cb) => {
474
+ queue.push(cb);
475
+ if (!queuePending) {
476
+ queuePending = true;
477
+ if (write && plt.$flags$ & 4 /* queueSync */) {
478
+ nextTick(flush);
479
+ } else {
480
+ plt.raf(flush);
481
+ }
482
+ }
483
+ };
484
+ var consume = (queue) => {
485
+ for (let i2 = 0; i2 < queue.length; i2++) {
486
+ try {
487
+ queue[i2](performance.now());
488
+ } catch (e) {
489
+ consoleError(e);
490
+ }
491
+ }
492
+ queue.length = 0;
493
+ };
494
+ var flush = () => {
495
+ consume(queueDomReads);
496
+ {
497
+ consume(queueDomWrites);
498
+ if (queuePending = queueDomReads.length > 0) {
499
+ plt.raf(flush);
500
+ }
501
+ }
502
+ };
503
+ var nextTick = (cb) => promiseResolve().then(cb);
504
+ var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
505
+
506
+ // src/utils/style.ts
507
+ function createStyleSheetIfNeededAndSupported(styles2) {
508
+ if (!supportsConstructableStylesheets) return void 0;
509
+ const sheet = new CSSStyleSheet();
510
+ sheet.replaceSync(styles2);
511
+ return sheet;
512
+ }
513
+
514
+ // src/utils/shadow-root.ts
515
+ var globalStyleSheet;
516
+ function createShadowRoot(cmpMeta) {
517
+ var _a;
518
+ const opts = { mode: "open" };
519
+ const shadowRoot = this.attachShadow(opts);
520
+ if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported(globalStyles)) != null ? _a : null;
521
+ if (globalStyleSheet) {
522
+ if (supportsMutableAdoptedStyleSheets) {
523
+ shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
524
+ } else {
525
+ shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
526
+ }
527
+ } else if (!supportsConstructableStylesheets) {
528
+ const styleElm = document.createElement("style");
529
+ styleElm.innerHTML = globalStyles;
530
+ shadowRoot.prepend(styleElm);
531
+ }
532
+ }
533
+ var createTime = (fnName, tagName = "") => {
534
+ {
535
+ return () => {
536
+ return;
537
+ };
538
+ }
539
+ };
540
+ var uniqueTime = (key, measureText) => {
541
+ {
542
+ return () => {
543
+ return;
544
+ };
545
+ }
546
+ };
547
+
548
+ // src/utils/query-nonce-meta-tag-content.ts
549
+ function queryNonceMetaTagContent(doc) {
550
+ var _a, _b, _c;
551
+ return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
552
+ }
553
+
554
+ // src/runtime/styles.ts
555
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
556
+ var registerStyle = (scopeId2, cssText, allowCS) => {
557
+ let style = styles.get(scopeId2);
558
+ if (supportsConstructableStylesheets && allowCS) {
559
+ style = style || new CSSStyleSheet();
560
+ if (typeof style === "string") {
561
+ style = cssText;
562
+ } else {
563
+ style.replaceSync(cssText);
564
+ }
565
+ } else {
566
+ style = cssText;
567
+ }
568
+ styles.set(scopeId2, style);
569
+ };
570
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
571
+ var _a, _b, _c;
572
+ const scopeId2 = getScopeId(cmpMeta);
573
+ const style = styles.get(scopeId2);
574
+ if (!win.document) {
575
+ return scopeId2;
576
+ }
577
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
578
+ if (style) {
579
+ if (typeof style === "string") {
580
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
581
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
582
+ let styleElm;
583
+ if (!appliedStyles) {
584
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
585
+ }
586
+ if (!appliedStyles.has(scopeId2)) {
587
+ styleElm = win.document.createElement("style");
588
+ styleElm.textContent = style;
589
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
590
+ if (nonce != null) {
591
+ styleElm.setAttribute("nonce", nonce);
592
+ }
593
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
594
+ if (styleContainerNode.nodeName === "HEAD") {
595
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
596
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
597
+ styleContainerNode.insertBefore(
598
+ styleElm,
599
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
600
+ );
601
+ } else if ("host" in styleContainerNode) {
602
+ if (supportsConstructableStylesheets) {
603
+ const currentWindow = (_b = styleContainerNode.defaultView) != null ? _b : styleContainerNode.ownerDocument.defaultView;
604
+ const stylesheet = new currentWindow.CSSStyleSheet();
605
+ stylesheet.replaceSync(style);
606
+ if (supportsMutableAdoptedStyleSheets) {
607
+ styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
608
+ } else {
609
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
610
+ }
611
+ } else {
612
+ const existingStyleContainer = styleContainerNode.querySelector("style");
613
+ if (existingStyleContainer && true) {
614
+ existingStyleContainer.textContent = style + existingStyleContainer.textContent;
615
+ } else {
616
+ styleContainerNode.prepend(styleElm);
617
+ }
618
+ }
619
+ } else {
620
+ styleContainerNode.append(styleElm);
621
+ }
622
+ }
623
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
624
+ styleContainerNode.insertBefore(styleElm, null);
625
+ }
626
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
627
+ styleElm.textContent += SLOT_FB_CSS;
628
+ }
629
+ if (appliedStyles) {
630
+ appliedStyles.add(scopeId2);
631
+ }
632
+ }
633
+ } else {
634
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
635
+ if (!appliedStyles) {
636
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
637
+ }
638
+ if (!appliedStyles.has(scopeId2)) {
639
+ const currentWindow = (_c = styleContainerNode.defaultView) != null ? _c : styleContainerNode.ownerDocument.defaultView;
640
+ let stylesheet;
641
+ if (style.constructor === currentWindow.CSSStyleSheet) {
642
+ stylesheet = style;
643
+ } else {
644
+ stylesheet = new currentWindow.CSSStyleSheet();
645
+ for (let i2 = 0; i2 < style.cssRules.length; i2++) {
646
+ stylesheet.insertRule(style.cssRules[i2].cssText, i2);
647
+ }
648
+ }
649
+ if (supportsMutableAdoptedStyleSheets) {
650
+ styleContainerNode.adoptedStyleSheets.push(stylesheet);
651
+ } else {
652
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, stylesheet];
653
+ }
654
+ appliedStyles.add(scopeId2);
655
+ }
656
+ }
657
+ }
658
+ return scopeId2;
659
+ };
660
+ var attachStyles = (hostRef) => {
661
+ const cmpMeta = hostRef.$cmpMeta$;
662
+ const elm = hostRef.$hostElement$;
663
+ const flags = cmpMeta.$flags$;
664
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
665
+ const scopeId2 = addStyle(
666
+ elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
667
+ cmpMeta);
668
+ if (flags & 10 /* needsScopedEncapsulation */) {
669
+ elm["s-sc"] = scopeId2;
670
+ elm.classList.add(scopeId2 + "-h");
671
+ }
672
+ endAttachStyles();
673
+ };
674
+ var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
675
+ var isComplexType = (o) => {
676
+ o = typeof o;
677
+ return o === "object" || o === "function";
678
+ };
679
+
680
+ // src/runtime/vdom/h.ts
681
+ var h = (nodeName, vnodeData, ...children) => {
682
+ if (typeof nodeName === "string") {
683
+ nodeName = transformTag(nodeName);
684
+ }
685
+ let child = null;
686
+ let key = null;
687
+ let simple = false;
688
+ let lastSimple = false;
689
+ const vNodeChildren = [];
690
+ const walk = (c) => {
691
+ for (let i2 = 0; i2 < c.length; i2++) {
692
+ child = c[i2];
693
+ if (Array.isArray(child)) {
694
+ walk(child);
695
+ } else if (child != null && typeof child !== "boolean") {
696
+ if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
697
+ child = String(child);
698
+ }
699
+ if (simple && lastSimple) {
700
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
701
+ } else {
702
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
703
+ }
704
+ lastSimple = simple;
705
+ }
706
+ }
707
+ };
708
+ walk(children);
709
+ if (vnodeData) {
710
+ if (vnodeData.key) {
711
+ key = vnodeData.key;
712
+ }
713
+ {
714
+ const classData = vnodeData.className || vnodeData.class;
715
+ if (classData) {
716
+ vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
717
+ }
718
+ }
719
+ }
720
+ const vnode = newVNode(nodeName, null);
721
+ vnode.$attrs$ = vnodeData;
722
+ if (vNodeChildren.length > 0) {
723
+ vnode.$children$ = vNodeChildren;
724
+ }
725
+ {
726
+ vnode.$key$ = key;
727
+ }
728
+ return vnode;
729
+ };
730
+ var newVNode = (tag, text) => {
731
+ const vnode = {
732
+ $flags$: 0,
733
+ $tag$: tag,
734
+ // Normalize undefined to null to prevent rendering "undefined" as text
735
+ $text$: text != null ? text : null,
736
+ $elm$: null,
737
+ $children$: null
738
+ };
739
+ {
740
+ vnode.$attrs$ = null;
741
+ }
742
+ {
743
+ vnode.$key$ = null;
744
+ }
745
+ return vnode;
746
+ };
747
+ var Host = {};
748
+ var isHost = (node) => node && node.$tag$ === Host;
749
+
750
+ // src/runtime/parse-property-value.ts
751
+ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
752
+ if (propValue != null && !isComplexType(propValue)) {
753
+ if (propType & 2 /* Number */) {
754
+ return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
755
+ }
756
+ if (propType & 1 /* String */) {
757
+ return String(propValue);
758
+ }
759
+ return propValue;
760
+ }
761
+ return propValue;
762
+ };
763
+ var getElement = (ref) => {
764
+ var _a;
765
+ return (_a = getHostRef(ref)) == null ? void 0 : _a.$hostElement$ ;
766
+ };
767
+
768
+ // src/runtime/event-emitter.ts
769
+ var createEvent = (ref, name, flags) => {
770
+ const elm = getElement(ref);
771
+ return {
772
+ emit: (detail) => {
773
+ return emitEvent(elm, name, {
774
+ bubbles: true,
775
+ composed: true,
776
+ cancelable: true,
777
+ detail
778
+ });
779
+ }
780
+ };
781
+ };
782
+ var emitEvent = (elm, name, opts) => {
783
+ const ev = plt.ce(name, opts);
784
+ elm.dispatchEvent(ev);
785
+ return ev;
786
+ };
787
+ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
788
+ if (oldValue === newValue) {
789
+ return;
790
+ }
791
+ let isProp = isMemberInElement(elm, memberName);
792
+ let ln = memberName.toLowerCase();
793
+ if (memberName === "class") {
794
+ const classList = elm.classList;
795
+ const oldClasses = parseClassList(oldValue);
796
+ let newClasses = parseClassList(newValue);
797
+ {
798
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
799
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
800
+ }
801
+ } else if (memberName === "key") ; else if (memberName === "ref") {
802
+ if (newValue) {
803
+ queueRefAttachment(newValue, elm);
804
+ }
805
+ } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
806
+ if (memberName[2] === "-") {
807
+ memberName = memberName.slice(3);
808
+ } else if (isMemberInElement(win, ln)) {
809
+ memberName = ln.slice(2);
810
+ } else {
811
+ memberName = ln[2] + memberName.slice(3);
812
+ }
813
+ if (oldValue || newValue) {
814
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
815
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
816
+ if (oldValue) {
817
+ plt.rel(elm, memberName, oldValue, capture);
818
+ }
819
+ if (newValue) {
820
+ plt.ael(elm, memberName, newValue, capture);
821
+ }
822
+ }
823
+ } else if (memberName[0] === "a" && memberName.startsWith("attr:")) {
824
+ const propName = memberName.slice(5);
825
+ let attrName;
826
+ {
827
+ const hostRef = getHostRef(elm);
828
+ if (hostRef && hostRef.$cmpMeta$ && hostRef.$cmpMeta$.$members$) {
829
+ const memberMeta = hostRef.$cmpMeta$.$members$[propName];
830
+ if (memberMeta && memberMeta[1]) {
831
+ attrName = memberMeta[1];
832
+ }
833
+ }
834
+ }
835
+ if (!attrName) {
836
+ attrName = propName.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
837
+ }
838
+ if (newValue == null || newValue === false) {
839
+ if (newValue !== false || elm.getAttribute(attrName) === "") {
840
+ elm.removeAttribute(attrName);
841
+ }
842
+ } else {
843
+ elm.setAttribute(attrName, newValue === true ? "" : newValue);
844
+ }
845
+ return;
846
+ } else if (memberName[0] === "p" && memberName.startsWith("prop:")) {
847
+ const propName = memberName.slice(5);
848
+ try {
849
+ elm[propName] = newValue;
850
+ } catch (e) {
851
+ }
852
+ return;
853
+ } else {
854
+ const isComplex = isComplexType(newValue);
855
+ if ((isProp || isComplex && newValue !== null) && !isSvg) {
856
+ try {
857
+ if (!elm.tagName.includes("-")) {
858
+ const n = newValue == null ? "" : newValue;
859
+ if (memberName === "list") {
860
+ isProp = false;
861
+ } else if (oldValue == null || elm[memberName] !== n) {
862
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
863
+ elm[memberName] = n;
864
+ } else {
865
+ elm.setAttribute(memberName, n);
866
+ }
867
+ }
868
+ } else if (elm[memberName] !== newValue) {
869
+ elm[memberName] = newValue;
870
+ }
871
+ } catch (e) {
872
+ }
873
+ }
874
+ if (newValue == null || newValue === false) {
875
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
876
+ {
877
+ elm.removeAttribute(memberName);
878
+ }
879
+ }
880
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
881
+ newValue = newValue === true ? "" : newValue;
882
+ {
883
+ elm.setAttribute(memberName, newValue);
884
+ }
885
+ }
886
+ }
887
+ };
888
+ var parseClassListRegex = /\s/;
889
+ var parseClassList = (value) => {
890
+ if (typeof value === "object" && value && "baseVal" in value) {
891
+ value = value.baseVal;
892
+ }
893
+ if (!value || typeof value !== "string") {
894
+ return [];
895
+ }
896
+ return value.split(parseClassListRegex);
897
+ };
898
+ var CAPTURE_EVENT_SUFFIX = "Capture";
899
+ var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
900
+
901
+ // src/runtime/vdom/update-element.ts
902
+ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
903
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
904
+ const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
905
+ const newVnodeAttrs = newVnode.$attrs$ || {};
906
+ {
907
+ for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
908
+ if (!(memberName in newVnodeAttrs)) {
909
+ setAccessor(
910
+ elm,
911
+ memberName,
912
+ oldVnodeAttrs[memberName],
913
+ void 0,
914
+ isSvgMode2,
915
+ newVnode.$flags$);
916
+ }
917
+ }
918
+ }
919
+ for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
920
+ setAccessor(
921
+ elm,
922
+ memberName,
923
+ oldVnodeAttrs[memberName],
924
+ newVnodeAttrs[memberName],
925
+ isSvgMode2,
926
+ newVnode.$flags$);
927
+ }
928
+ };
929
+ function sortedAttrNames(attrNames) {
930
+ return attrNames.includes("ref") ? (
931
+ // we need to sort these to ensure that `'ref'` is the last attr
932
+ [...attrNames.filter((attr) => attr !== "ref"), "ref"]
933
+ ) : (
934
+ // no need to sort, return the original array
935
+ attrNames
936
+ );
937
+ }
938
+ var hostTagName;
939
+ var useNativeShadowDom = false;
940
+ var isSvgMode = false;
941
+ var refCallbacksToRemove = [];
942
+ var refCallbacksToAttach = [];
943
+ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
944
+ const newVNode2 = newParentVNode.$children$[childIndex];
945
+ let i2 = 0;
946
+ let elm;
947
+ let childNode;
948
+ {
949
+ if (!win.document) {
950
+ throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");
951
+ }
952
+ elm = newVNode2.$elm$ = win.document.createElement(
953
+ newVNode2.$tag$
954
+ );
955
+ {
956
+ updateElement(null, newVNode2, isSvgMode);
957
+ }
958
+ if (newVNode2.$children$) {
959
+ const appendTarget = newVNode2.$tag$ === "template" ? elm.content : elm;
960
+ for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
961
+ childNode = createElm(oldParentVNode, newVNode2, i2);
962
+ if (childNode) {
963
+ appendTarget.appendChild(childNode);
964
+ }
965
+ }
966
+ }
967
+ }
968
+ elm["s-hn"] = hostTagName;
969
+ return elm;
970
+ };
971
+ var relocateToHostRoot = (parentElm) => {
972
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
973
+ const host = parentElm.closest(hostTagName.toLowerCase());
974
+ if (host != null) {
975
+ const contentRefNode = Array.from(host.__childNodes || host.childNodes).find(
976
+ (ref) => ref["s-cr"]
977
+ );
978
+ const childNodeArray = Array.from(
979
+ parentElm.__childNodes || parentElm.childNodes
980
+ );
981
+ for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
982
+ if (childNode["s-sh"] != null) {
983
+ insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
984
+ childNode["s-sh"] = void 0;
985
+ }
986
+ }
987
+ }
988
+ plt.$flags$ &= -2 /* isTmpDisconnected */;
989
+ };
990
+ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
991
+ let containerElm = parentElm;
992
+ let childNode;
993
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
994
+ containerElm = containerElm.shadowRoot;
995
+ }
996
+ if (parentVNode.$tag$ === "template") {
997
+ containerElm = containerElm.content;
998
+ }
999
+ for (; startIdx <= endIdx; ++startIdx) {
1000
+ if (vnodes[startIdx]) {
1001
+ childNode = createElm(null, parentVNode, startIdx);
1002
+ if (childNode) {
1003
+ vnodes[startIdx].$elm$ = childNode;
1004
+ insertBefore(containerElm, childNode, before);
1005
+ }
1006
+ }
1007
+ }
1008
+ };
1009
+ var removeVnodes = (vnodes, startIdx, endIdx) => {
1010
+ for (let index = startIdx; index <= endIdx; ++index) {
1011
+ const vnode = vnodes[index];
1012
+ if (vnode) {
1013
+ const elm = vnode.$elm$;
1014
+ nullifyVNodeRefs(vnode);
1015
+ if (elm) {
1016
+ elm.remove();
1017
+ }
1018
+ }
1019
+ }
1020
+ };
1021
+ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
1022
+ let oldStartIdx = 0;
1023
+ let newStartIdx = 0;
1024
+ let idxInOld = 0;
1025
+ let i2 = 0;
1026
+ let oldEndIdx = oldCh.length - 1;
1027
+ let oldStartVnode = oldCh[0];
1028
+ let oldEndVnode = oldCh[oldEndIdx];
1029
+ let newEndIdx = newCh.length - 1;
1030
+ let newStartVnode = newCh[0];
1031
+ let newEndVnode = newCh[newEndIdx];
1032
+ let node;
1033
+ let elmToMove;
1034
+ const containerElm = newVNode2.$tag$ === "template" ? parentElm.content : parentElm;
1035
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
1036
+ if (oldStartVnode == null) {
1037
+ oldStartVnode = oldCh[++oldStartIdx];
1038
+ } else if (oldEndVnode == null) {
1039
+ oldEndVnode = oldCh[--oldEndIdx];
1040
+ } else if (newStartVnode == null) {
1041
+ newStartVnode = newCh[++newStartIdx];
1042
+ } else if (newEndVnode == null) {
1043
+ newEndVnode = newCh[--newEndIdx];
1044
+ } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
1045
+ patch(oldStartVnode, newStartVnode, isInitialRender);
1046
+ oldStartVnode = oldCh[++oldStartIdx];
1047
+ newStartVnode = newCh[++newStartIdx];
1048
+ } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
1049
+ patch(oldEndVnode, newEndVnode, isInitialRender);
1050
+ oldEndVnode = oldCh[--oldEndIdx];
1051
+ newEndVnode = newCh[--newEndIdx];
1052
+ } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
1053
+ patch(oldStartVnode, newEndVnode, isInitialRender);
1054
+ insertBefore(containerElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
1055
+ oldStartVnode = oldCh[++oldStartIdx];
1056
+ newEndVnode = newCh[--newEndIdx];
1057
+ } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
1058
+ patch(oldEndVnode, newStartVnode, isInitialRender);
1059
+ insertBefore(containerElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
1060
+ oldEndVnode = oldCh[--oldEndIdx];
1061
+ newStartVnode = newCh[++newStartIdx];
1062
+ } else {
1063
+ idxInOld = -1;
1064
+ {
1065
+ for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
1066
+ if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
1067
+ idxInOld = i2;
1068
+ break;
1069
+ }
1070
+ }
1071
+ }
1072
+ if (idxInOld >= 0) {
1073
+ elmToMove = oldCh[idxInOld];
1074
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
1075
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
1076
+ } else {
1077
+ patch(elmToMove, newStartVnode, isInitialRender);
1078
+ oldCh[idxInOld] = void 0;
1079
+ node = elmToMove.$elm$;
1080
+ }
1081
+ newStartVnode = newCh[++newStartIdx];
1082
+ } else {
1083
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
1084
+ newStartVnode = newCh[++newStartIdx];
1085
+ }
1086
+ if (node) {
1087
+ {
1088
+ insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
1089
+ }
1090
+ }
1091
+ }
1092
+ }
1093
+ if (oldStartIdx > oldEndIdx) {
1094
+ addVnodes(
1095
+ parentElm,
1096
+ newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,
1097
+ newVNode2,
1098
+ newCh,
1099
+ newStartIdx,
1100
+ newEndIdx
1101
+ );
1102
+ } else if (newStartIdx > newEndIdx) {
1103
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
1104
+ }
1105
+ };
1106
+ var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
1107
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
1108
+ if (!isInitialRender) {
1109
+ return leftVNode.$key$ === rightVNode.$key$;
1110
+ }
1111
+ if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
1112
+ leftVNode.$key$ = rightVNode.$key$;
1113
+ }
1114
+ return true;
1115
+ }
1116
+ return false;
1117
+ };
1118
+ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
1119
+ const elm = newVNode2.$elm$ = oldVNode.$elm$;
1120
+ const oldChildren = oldVNode.$children$;
1121
+ const newChildren = newVNode2.$children$;
1122
+ const tag = newVNode2.$tag$;
1123
+ {
1124
+ {
1125
+ if (tag === "slot" && !useNativeShadowDom) {
1126
+ if (oldVNode.$name$ !== newVNode2.$name$) {
1127
+ newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
1128
+ relocateToHostRoot(newVNode2.$elm$.parentElement);
1129
+ }
1130
+ }
1131
+ updateElement(oldVNode, newVNode2, isSvgMode);
1132
+ }
1133
+ if (oldChildren !== null && newChildren !== null) {
1134
+ updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
1135
+ } else if (newChildren !== null) {
1136
+ addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
1137
+ } else if (
1138
+ // don't do this on initial render as it can cause non-hydrated content to be removed
1139
+ !isInitialRender && BUILD.updatable && oldChildren !== null
1140
+ ) {
1141
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
1142
+ } else ;
1143
+ }
1144
+ };
1145
+ var nullifyVNodeRefs = (vNode) => {
1146
+ {
1147
+ if (vNode.$attrs$ && vNode.$attrs$.ref) {
1148
+ refCallbacksToRemove.push(() => vNode.$attrs$.ref(null));
1149
+ }
1150
+ vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
1151
+ }
1152
+ };
1153
+ var queueRefAttachment = (refCallback, elm) => {
1154
+ {
1155
+ refCallbacksToAttach.push(() => refCallback(elm));
1156
+ }
1157
+ };
1158
+ var flushQueuedRefCallbacks = () => {
1159
+ {
1160
+ refCallbacksToRemove.forEach((cb) => cb());
1161
+ refCallbacksToRemove.length = 0;
1162
+ refCallbacksToAttach.forEach((cb) => cb());
1163
+ refCallbacksToAttach.length = 0;
1164
+ }
1165
+ };
1166
+ var insertBefore = (parent, newNode, reference, isInitialLoad) => {
1167
+ if (parent.__insertBefore) {
1168
+ return parent.__insertBefore(newNode, reference);
1169
+ } else {
1170
+ return parent == null ? void 0 : parent.insertBefore(newNode, reference);
1171
+ }
1172
+ };
1173
+ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1174
+ const hostElm = hostRef.$hostElement$;
1175
+ const cmpMeta = hostRef.$cmpMeta$;
1176
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1177
+ const isHostElement = isHost(renderFnResults);
1178
+ const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
1179
+ hostTagName = hostElm.tagName;
1180
+ if (cmpMeta.$attrsToReflect$) {
1181
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1182
+ cmpMeta.$attrsToReflect$.forEach(([propName, attribute]) => {
1183
+ {
1184
+ rootVnode.$attrs$[attribute] = hostElm[propName];
1185
+ }
1186
+ });
1187
+ }
1188
+ if (isInitialLoad && rootVnode.$attrs$) {
1189
+ for (const key of Object.keys(rootVnode.$attrs$)) {
1190
+ if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
1191
+ rootVnode.$attrs$[key] = hostElm[key];
1192
+ }
1193
+ }
1194
+ }
1195
+ rootVnode.$tag$ = null;
1196
+ rootVnode.$flags$ |= 4 /* isHost */;
1197
+ hostRef.$vnode$ = rootVnode;
1198
+ rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
1199
+ useNativeShadowDom = !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */);
1200
+ patch(oldVNode, rootVnode, isInitialLoad);
1201
+ flushQueuedRefCallbacks();
1202
+ };
1203
+
1204
+ // src/runtime/update-component.ts
1205
+ var attachToAncestor = (hostRef, ancestorComponent) => {
1206
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
1207
+ const index = ancestorComponent["s-p"].push(
1208
+ new Promise(
1209
+ (r) => hostRef.$onRenderResolve$ = () => {
1210
+ ancestorComponent["s-p"].splice(index - 1, 1);
1211
+ r();
1212
+ }
1213
+ )
1214
+ );
1215
+ }
1216
+ };
1217
+ var scheduleUpdate = (hostRef, isInitialLoad) => {
1218
+ {
1219
+ hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1220
+ }
1221
+ if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
1222
+ hostRef.$flags$ |= 512 /* needsRerender */;
1223
+ return;
1224
+ }
1225
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1226
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1227
+ if (isInitialLoad) {
1228
+ queueMicrotask(() => {
1229
+ dispatch();
1230
+ });
1231
+ return;
1232
+ }
1233
+ return writeTask(dispatch) ;
1234
+ };
1235
+ var dispatchHooks = (hostRef, isInitialLoad) => {
1236
+ const elm = hostRef.$hostElement$;
1237
+ const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
1238
+ const instance = hostRef.$lazyInstance$ ;
1239
+ if (!instance) {
1240
+ throw new Error(
1241
+ `Can't render component <${elm.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`
1242
+ );
1243
+ }
1244
+ let maybePromise;
1245
+ if (isInitialLoad) {
1246
+ {
1247
+ if (hostRef.$fetchedCbList$.length) {
1248
+ hostRef.$fetchedCbList$.forEach((cb) => cb(elm));
1249
+ }
1250
+ }
1251
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
1252
+ } else {
1253
+ maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
1254
+ }
1255
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
1256
+ endSchedule();
1257
+ return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
1258
+ };
1259
+ var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err) => {
1260
+ console.error(err);
1261
+ fn();
1262
+ }) : fn();
1263
+ var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
1264
+ var updateComponent = async (hostRef, instance, isInitialLoad) => {
1265
+ var _a;
1266
+ const elm = hostRef.$hostElement$;
1267
+ const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
1268
+ const rc = elm["s-rc"];
1269
+ if (isInitialLoad) {
1270
+ attachStyles(hostRef);
1271
+ }
1272
+ const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
1273
+ {
1274
+ callRender(hostRef, instance, elm, isInitialLoad);
1275
+ }
1276
+ if (rc) {
1277
+ rc.map((cb) => cb());
1278
+ elm["s-rc"] = void 0;
1279
+ }
1280
+ endRender();
1281
+ endUpdate();
1282
+ {
1283
+ const childrenPromises = (_a = elm["s-p"]) != null ? _a : [];
1284
+ const postUpdate = () => postUpdateComponent(hostRef);
1285
+ if (childrenPromises.length === 0) {
1286
+ postUpdate();
1287
+ } else {
1288
+ Promise.all(childrenPromises).then(postUpdate).catch(postUpdate);
1289
+ hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1290
+ childrenPromises.length = 0;
1291
+ }
1292
+ }
1293
+ };
1294
+ var callRender = (hostRef, instance, elm, isInitialLoad) => {
1295
+ try {
1296
+ instance = instance.render() ;
1297
+ {
1298
+ hostRef.$flags$ &= -17 /* isQueuedForUpdate */;
1299
+ }
1300
+ {
1301
+ hostRef.$flags$ |= 2 /* hasRendered */;
1302
+ }
1303
+ {
1304
+ {
1305
+ {
1306
+ renderVdom(hostRef, instance, isInitialLoad);
1307
+ }
1308
+ }
1309
+ }
1310
+ } catch (e) {
1311
+ consoleError(e, hostRef.$hostElement$);
1312
+ }
1313
+ return null;
1314
+ };
1315
+ var postUpdateComponent = (hostRef) => {
1316
+ const tagName = hostRef.$cmpMeta$.$tagName$;
1317
+ const elm = hostRef.$hostElement$;
1318
+ const endPostUpdate = createTime("postUpdate", tagName);
1319
+ const instance = hostRef.$lazyInstance$ ;
1320
+ const ancestorComponent = hostRef.$ancestorComponent$;
1321
+ safeCall(instance, "componentDidRender", void 0, elm);
1322
+ if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1323
+ hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1324
+ {
1325
+ addHydratedFlag(elm);
1326
+ }
1327
+ safeCall(instance, "componentDidLoad", void 0, elm);
1328
+ endPostUpdate();
1329
+ {
1330
+ hostRef.$onReadyResolve$(elm);
1331
+ if (!ancestorComponent) {
1332
+ appDidLoad();
1333
+ }
1334
+ }
1335
+ } else {
1336
+ safeCall(instance, "componentDidUpdate", void 0, elm);
1337
+ endPostUpdate();
1338
+ }
1339
+ {
1340
+ hostRef.$onInstanceResolve$(elm);
1341
+ }
1342
+ {
1343
+ if (hostRef.$onRenderResolve$) {
1344
+ hostRef.$onRenderResolve$();
1345
+ hostRef.$onRenderResolve$ = void 0;
1346
+ }
1347
+ if (hostRef.$flags$ & 512 /* needsRerender */) {
1348
+ nextTick(() => scheduleUpdate(hostRef, false));
1349
+ }
1350
+ hostRef.$flags$ &= -517;
1351
+ }
1352
+ };
1353
+ var appDidLoad = (who) => {
1354
+ nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
1355
+ };
1356
+ var safeCall = (instance, method, arg, elm) => {
1357
+ if (instance && instance[method]) {
1358
+ try {
1359
+ return instance[method](arg);
1360
+ } catch (e) {
1361
+ consoleError(e, elm);
1362
+ }
1363
+ }
1364
+ return void 0;
1365
+ };
1366
+ var addHydratedFlag = (elm) => {
1367
+ var _a;
1368
+ return elm.classList.add((_a = BUILD.hydratedSelectorName) != null ? _a : "hydrated") ;
1369
+ };
1370
+
1371
+ // src/runtime/set-value.ts
1372
+ var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1373
+ var setValue = (ref, propName, newVal, cmpMeta) => {
1374
+ const hostRef = getHostRef(ref);
1375
+ if (!hostRef) {
1376
+ return;
1377
+ }
1378
+ if (!hostRef) {
1379
+ throw new Error(
1380
+ `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`
1381
+ );
1382
+ }
1383
+ const elm = hostRef.$hostElement$ ;
1384
+ const oldVal = hostRef.$instanceValues$.get(propName);
1385
+ const flags = hostRef.$flags$;
1386
+ const instance = hostRef.$lazyInstance$ ;
1387
+ newVal = parsePropertyValue(
1388
+ newVal,
1389
+ cmpMeta.$members$[propName][0]);
1390
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1391
+ const didValueChange = newVal !== oldVal && !areBothNaN;
1392
+ if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
1393
+ hostRef.$instanceValues$.set(propName, newVal);
1394
+ if (cmpMeta.$watchers$) {
1395
+ const watchMethods = cmpMeta.$watchers$[propName];
1396
+ if (watchMethods) {
1397
+ watchMethods.map((watcher) => {
1398
+ try {
1399
+ const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
1400
+ if (flags & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */) {
1401
+ if (!instance) {
1402
+ hostRef.$fetchedCbList$.push(() => {
1403
+ hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
1404
+ });
1405
+ } else {
1406
+ instance[watchMethodName](newVal, oldVal, propName);
1407
+ }
1408
+ }
1409
+ } catch (e) {
1410
+ consoleError(e, elm);
1411
+ }
1412
+ });
1413
+ }
1414
+ }
1415
+ if (flags & 2 /* hasRendered */) {
1416
+ if (instance.componentShouldUpdate) {
1417
+ const shouldUpdate = instance.componentShouldUpdate(newVal, oldVal, propName);
1418
+ if (shouldUpdate === false && !(flags & 16 /* isQueuedForUpdate */)) {
1419
+ return;
1420
+ }
1421
+ }
1422
+ if (!(flags & 16 /* isQueuedForUpdate */)) {
1423
+ scheduleUpdate(hostRef, false);
1424
+ }
1425
+ }
1426
+ }
1427
+ };
1428
+
1429
+ // src/runtime/proxy-component.ts
1430
+ var proxyComponent = (Cstr, cmpMeta, flags) => {
1431
+ var _a, _b;
1432
+ const prototype = Cstr.prototype;
1433
+ if (cmpMeta.$members$ || BUILD.propChangeCallback) {
1434
+ {
1435
+ if (Cstr.watchers && !cmpMeta.$watchers$) {
1436
+ cmpMeta.$watchers$ = Cstr.watchers;
1437
+ }
1438
+ if (Cstr.deserializers && !cmpMeta.$deserializers$) {
1439
+ cmpMeta.$deserializers$ = Cstr.deserializers;
1440
+ }
1441
+ if (Cstr.serializers && !cmpMeta.$serializers$) {
1442
+ cmpMeta.$serializers$ = Cstr.serializers;
1443
+ }
1444
+ }
1445
+ const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
1446
+ members.map(([memberName, [memberFlags]]) => {
1447
+ if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
1448
+ const { get: origGetter, set: origSetter } = getPropertyDescriptor(prototype, memberName) || {};
1449
+ if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
1450
+ if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
1451
+ if (flags & 1 /* isElementConstructor */ || !origGetter) {
1452
+ Object.defineProperty(prototype, memberName, {
1453
+ get() {
1454
+ {
1455
+ if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
1456
+ return getValue(this, memberName);
1457
+ }
1458
+ const ref = getHostRef(this);
1459
+ const instance = ref ? ref.$lazyInstance$ : prototype;
1460
+ if (!instance) return;
1461
+ return instance[memberName];
1462
+ }
1463
+ },
1464
+ configurable: true,
1465
+ enumerable: true
1466
+ });
1467
+ }
1468
+ Object.defineProperty(prototype, memberName, {
1469
+ set(newValue) {
1470
+ const ref = getHostRef(this);
1471
+ if (!ref) {
1472
+ return;
1473
+ }
1474
+ if (origSetter) {
1475
+ const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1476
+ if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
1477
+ newValue = ref.$instanceValues$.get(memberName);
1478
+ }
1479
+ origSetter.apply(this, [
1480
+ parsePropertyValue(
1481
+ newValue,
1482
+ memberFlags)
1483
+ ]);
1484
+ newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1485
+ setValue(this, memberName, newValue, cmpMeta);
1486
+ return;
1487
+ }
1488
+ {
1489
+ if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
1490
+ setValue(this, memberName, newValue, cmpMeta);
1491
+ if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
1492
+ ref.$fetchedCbList$.push(() => {
1493
+ if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
1494
+ ref.$lazyInstance$[memberName] = newValue;
1495
+ }
1496
+ });
1497
+ }
1498
+ return;
1499
+ }
1500
+ const setterSetVal = () => {
1501
+ const currentValue = ref.$lazyInstance$[memberName];
1502
+ if (!ref.$instanceValues$.get(memberName) && currentValue) {
1503
+ ref.$instanceValues$.set(memberName, currentValue);
1504
+ }
1505
+ ref.$lazyInstance$[memberName] = parsePropertyValue(
1506
+ newValue,
1507
+ memberFlags);
1508
+ setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
1509
+ };
1510
+ if (ref.$lazyInstance$) {
1511
+ setterSetVal();
1512
+ } else {
1513
+ ref.$fetchedCbList$.push(() => {
1514
+ setterSetVal();
1515
+ });
1516
+ }
1517
+ }
1518
+ }
1519
+ });
1520
+ } else if (flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
1521
+ Object.defineProperty(prototype, memberName, {
1522
+ value(...args) {
1523
+ var _a2;
1524
+ const ref = getHostRef(this);
1525
+ return (_a2 = ref == null ? void 0 : ref.$onInstancePromise$) == null ? void 0 : _a2.then(() => {
1526
+ var _a3;
1527
+ return (_a3 = ref.$lazyInstance$) == null ? void 0 : _a3[memberName](...args);
1528
+ });
1529
+ }
1530
+ });
1531
+ }
1532
+ });
1533
+ if ((flags & 1 /* isElementConstructor */)) {
1534
+ const attrNameToPropName = /* @__PURE__ */ new Map();
1535
+ prototype.attributeChangedCallback = function(attrName, oldValue, newValue) {
1536
+ plt.jmp(() => {
1537
+ var _a2;
1538
+ const propName = attrNameToPropName.get(attrName);
1539
+ const hostRef = getHostRef(this);
1540
+ if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
1541
+ newValue = this[propName];
1542
+ delete this[propName];
1543
+ }
1544
+ if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
1545
+ this[propName] == newValue) {
1546
+ return;
1547
+ } else if (propName == null) {
1548
+ const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
1549
+ if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) && newValue !== oldValue) {
1550
+ const instance = hostRef.$lazyInstance$ ;
1551
+ const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
1552
+ entry == null ? void 0 : entry.forEach((watcher) => {
1553
+ const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
1554
+ if (instance[watchMethodName] != null && (flags2 & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */)) {
1555
+ instance[watchMethodName].call(instance, newValue, oldValue, attrName);
1556
+ }
1557
+ });
1558
+ }
1559
+ return;
1560
+ }
1561
+ const propFlags = members.find(([m]) => m === propName);
1562
+ if (propFlags && propFlags[1][0] & 4 /* Boolean */) {
1563
+ newValue = newValue === null || newValue === "false" ? false : true;
1564
+ }
1565
+ const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
1566
+ if (newValue != this[propName] && (!propDesc.get || !!propDesc.set)) {
1567
+ this[propName] = newValue;
1568
+ }
1569
+ });
1570
+ };
1571
+ Cstr.observedAttributes = Array.from(
1572
+ /* @__PURE__ */ new Set([
1573
+ ...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
1574
+ ...members.filter(([_, m]) => m[0] & 31 /* HasAttribute */).map(([propName, m]) => {
1575
+ var _a2;
1576
+ const attrName = m[1] || propName;
1577
+ attrNameToPropName.set(attrName, propName);
1578
+ if (m[0] & 512 /* ReflectAttr */) {
1579
+ (_a2 = cmpMeta.$attrsToReflect$) == null ? void 0 : _a2.push([propName, attrName]);
1580
+ }
1581
+ return attrName;
1582
+ })
1583
+ ])
1584
+ );
1585
+ }
1586
+ }
1587
+ return Cstr;
1588
+ };
1589
+
1590
+ // src/runtime/initialize-component.ts
1591
+ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1592
+ let Cstr;
1593
+ try {
1594
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1595
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1596
+ const bundleId = cmpMeta.$lazyBundleId$;
1597
+ if (bundleId) {
1598
+ const CstrImport = loadModule(cmpMeta, hostRef);
1599
+ if (CstrImport && "then" in CstrImport) {
1600
+ const endLoad = uniqueTime();
1601
+ Cstr = await CstrImport;
1602
+ endLoad();
1603
+ } else {
1604
+ Cstr = CstrImport;
1605
+ }
1606
+ if (!Cstr) {
1607
+ throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
1608
+ }
1609
+ if (!Cstr.isProxied) {
1610
+ {
1611
+ cmpMeta.$watchers$ = Cstr.watchers;
1612
+ cmpMeta.$serializers$ = Cstr.serializers;
1613
+ cmpMeta.$deserializers$ = Cstr.deserializers;
1614
+ }
1615
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1616
+ Cstr.isProxied = true;
1617
+ }
1618
+ const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
1619
+ {
1620
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
1621
+ }
1622
+ try {
1623
+ new Cstr(hostRef);
1624
+ } catch (e) {
1625
+ consoleError(e, elm);
1626
+ }
1627
+ {
1628
+ hostRef.$flags$ &= -9 /* isConstructingInstance */;
1629
+ }
1630
+ {
1631
+ hostRef.$flags$ |= 128 /* isWatchReady */;
1632
+ }
1633
+ endNewInstance();
1634
+ {
1635
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1636
+ }
1637
+ } else {
1638
+ Cstr = elm.constructor;
1639
+ const cmpTag = elm.localName;
1640
+ customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
1641
+ }
1642
+ if (Cstr && Cstr.style) {
1643
+ let style;
1644
+ if (typeof Cstr.style === "string") {
1645
+ style = Cstr.style;
1646
+ }
1647
+ const scopeId2 = getScopeId(cmpMeta);
1648
+ if (!styles.has(scopeId2) || BUILD.hotModuleReplacement) {
1649
+ const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
1650
+ registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1651
+ endRegisterStyles();
1652
+ }
1653
+ }
1654
+ }
1655
+ const ancestorComponent = hostRef.$ancestorComponent$;
1656
+ const schedule = () => scheduleUpdate(hostRef, true);
1657
+ if (ancestorComponent && ancestorComponent["s-rc"]) {
1658
+ ancestorComponent["s-rc"].push(schedule);
1659
+ } else {
1660
+ schedule();
1661
+ }
1662
+ } catch (e) {
1663
+ consoleError(e, elm);
1664
+ if (hostRef.$onRenderResolve$) {
1665
+ hostRef.$onRenderResolve$();
1666
+ hostRef.$onRenderResolve$ = void 0;
1667
+ }
1668
+ if (hostRef.$onReadyResolve$) {
1669
+ hostRef.$onReadyResolve$(elm);
1670
+ }
1671
+ }
1672
+ };
1673
+ var fireConnectedCallback = (instance, elm) => {
1674
+ {
1675
+ safeCall(instance, "connectedCallback", void 0, elm);
1676
+ }
1677
+ };
1678
+
1679
+ // src/runtime/connected-callback.ts
1680
+ var connectedCallback = (elm) => {
1681
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1682
+ const hostRef = getHostRef(elm);
1683
+ if (!hostRef) {
1684
+ return;
1685
+ }
1686
+ const cmpMeta = hostRef.$cmpMeta$;
1687
+ const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
1688
+ if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1689
+ hostRef.$flags$ |= 1 /* hasConnected */;
1690
+ {
1691
+ let ancestorComponent = elm;
1692
+ while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
1693
+ if (ancestorComponent["s-p"]) {
1694
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
1695
+ break;
1696
+ }
1697
+ }
1698
+ }
1699
+ if (cmpMeta.$members$) {
1700
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1701
+ if (memberFlags & 31 /* Prop */ && Object.prototype.hasOwnProperty.call(elm, memberName)) {
1702
+ const value = elm[memberName];
1703
+ delete elm[memberName];
1704
+ elm[memberName] = value;
1705
+ }
1706
+ });
1707
+ }
1708
+ {
1709
+ initializeComponent(elm, hostRef, cmpMeta);
1710
+ }
1711
+ } else {
1712
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1713
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1714
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1715
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
1716
+ }
1717
+ }
1718
+ endConnected();
1719
+ }
1720
+ };
1721
+ var disconnectInstance = (instance, elm) => {
1722
+ {
1723
+ safeCall(instance, "disconnectedCallback", void 0, elm || instance);
1724
+ }
1725
+ };
1726
+ var disconnectedCallback = async (elm) => {
1727
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1728
+ const hostRef = getHostRef(elm);
1729
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1730
+ disconnectInstance(hostRef.$lazyInstance$, elm);
1731
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1732
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
1733
+ }
1734
+ }
1735
+ if (rootAppliedStyles.has(elm)) {
1736
+ rootAppliedStyles.delete(elm);
1737
+ }
1738
+ if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
1739
+ rootAppliedStyles.delete(elm.shadowRoot);
1740
+ }
1741
+ };
1742
+
1743
+ // src/runtime/bootstrap-lazy.ts
1744
+ var bootstrapLazy = (lazyBundles, options = {}) => {
1745
+ var _a;
1746
+ if (!win.document) {
1747
+ console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");
1748
+ return;
1749
+ }
1750
+ const endBootstrap = createTime();
1751
+ const cmpTags = [];
1752
+ const exclude = options.exclude || [];
1753
+ const customElements2 = win.customElements;
1754
+ const head = win.document.head;
1755
+ const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
1756
+ const dataStyles = /* @__PURE__ */ win.document.createElement("style");
1757
+ const deferredConnectedCallbacks = [];
1758
+ let appLoadFallback;
1759
+ let isBootstrapping = true;
1760
+ Object.assign(plt, options);
1761
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
1762
+ lazyBundles.map((lazyBundle) => {
1763
+ lazyBundle[1].map((compactMeta) => {
1764
+ var _a2, _b, _c;
1765
+ const cmpMeta = {
1766
+ $flags$: compactMeta[0],
1767
+ $tagName$: compactMeta[1],
1768
+ $members$: compactMeta[2],
1769
+ $listeners$: compactMeta[3]
1770
+ };
1771
+ {
1772
+ cmpMeta.$members$ = compactMeta[2];
1773
+ }
1774
+ {
1775
+ cmpMeta.$attrsToReflect$ = [];
1776
+ }
1777
+ {
1778
+ cmpMeta.$watchers$ = (_a2 = compactMeta[4]) != null ? _a2 : {};
1779
+ cmpMeta.$serializers$ = (_b = compactMeta[5]) != null ? _b : {};
1780
+ cmpMeta.$deserializers$ = (_c = compactMeta[6]) != null ? _c : {};
1781
+ }
1782
+ const tagName = transformTag(cmpMeta.$tagName$);
1783
+ const HostElement = class extends HTMLElement {
1784
+ ["s-p"];
1785
+ ["s-rc"];
1786
+ hasRegisteredEventListeners = false;
1787
+ // StencilLazyHost
1788
+ constructor(self) {
1789
+ super(self);
1790
+ self = this;
1791
+ registerHost(self, cmpMeta);
1792
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1793
+ {
1794
+ if (!self.shadowRoot) {
1795
+ createShadowRoot.call(self, cmpMeta);
1796
+ } else {
1797
+ if (self.shadowRoot.mode !== "open") {
1798
+ throw new Error(
1799
+ `Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${self.shadowRoot.mode} but Stencil only supports open shadow roots.`
1800
+ );
1801
+ }
1802
+ }
1803
+ }
1804
+ }
1805
+ }
1806
+ connectedCallback() {
1807
+ const hostRef = getHostRef(this);
1808
+ if (!hostRef) {
1809
+ return;
1810
+ }
1811
+ if (!this.hasRegisteredEventListeners) {
1812
+ this.hasRegisteredEventListeners = true;
1813
+ }
1814
+ if (appLoadFallback) {
1815
+ clearTimeout(appLoadFallback);
1816
+ appLoadFallback = null;
1817
+ }
1818
+ if (isBootstrapping) {
1819
+ deferredConnectedCallbacks.push(this);
1820
+ } else {
1821
+ plt.jmp(() => connectedCallback(this));
1822
+ }
1823
+ }
1824
+ disconnectedCallback() {
1825
+ plt.jmp(() => disconnectedCallback(this));
1826
+ plt.raf(() => {
1827
+ var _a3;
1828
+ const hostRef = getHostRef(this);
1829
+ if (!hostRef) {
1830
+ return;
1831
+ }
1832
+ const i2 = deferredConnectedCallbacks.findIndex((host) => host === this);
1833
+ if (i2 > -1) {
1834
+ deferredConnectedCallbacks.splice(i2, 1);
1835
+ }
1836
+ if (((_a3 = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a3.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
1837
+ delete hostRef.$vnode$.$elm$;
1838
+ }
1839
+ });
1840
+ }
1841
+ componentOnReady() {
1842
+ var _a3;
1843
+ return (_a3 = getHostRef(this)) == null ? void 0 : _a3.$onReadyPromise$;
1844
+ }
1845
+ };
1846
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1847
+ if (!exclude.includes(tagName) && !customElements2.get(tagName)) {
1848
+ cmpTags.push(tagName);
1849
+ customElements2.define(
1850
+ tagName,
1851
+ proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */)
1852
+ );
1853
+ }
1854
+ });
1855
+ });
1856
+ if (cmpTags.length > 0) {
1857
+ {
1858
+ dataStyles.textContent += cmpTags.sort() + HYDRATED_CSS;
1859
+ }
1860
+ if (dataStyles.innerHTML.length) {
1861
+ dataStyles.setAttribute("data-styles", "");
1862
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1863
+ if (nonce != null) {
1864
+ dataStyles.setAttribute("nonce", nonce);
1865
+ }
1866
+ head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
1867
+ }
1868
+ }
1869
+ isBootstrapping = false;
1870
+ if (deferredConnectedCallbacks.length) {
1871
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
1872
+ } else {
1873
+ {
1874
+ plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30));
1875
+ }
1876
+ }
1877
+ endBootstrap();
1878
+ };
1879
+
1880
+ // src/runtime/nonce.ts
1881
+ var setNonce = (nonce) => plt.$nonce$ = nonce;
1882
+ function transformTag(tag) {
1883
+ return tag;
1884
+ }
1885
+
1886
+ export { Host as H, getElement as a, bootstrapLazy as b, createEvent as c, globalScripts as g, h, promiseResolve as p, registerInstance as r, setNonce as s };