ontotext-yasgui-web-component 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +72 -0
  3. package/dist/cjs/index-c487dc05.js +1152 -0
  4. package/dist/cjs/index.cjs.js +2 -0
  5. package/dist/cjs/loader.cjs.js +21 -0
  6. package/dist/cjs/ontotext-yasgui-web-component.cjs.js +19 -0
  7. package/dist/cjs/ontotext-yasgui.cjs.entry.js +391 -0
  8. package/dist/collection/collection-manifest.json +12 -0
  9. package/dist/collection/components/ontotext-yasgui-web-component/ontotext-yasgui-web-component.css +2361 -0
  10. package/dist/collection/components/ontotext-yasgui-web-component/ontotext-yasgui-web-component.js +152 -0
  11. package/dist/collection/components/yasgui/yasgui-script.js +4 -0
  12. package/dist/collection/index.js +1 -0
  13. package/dist/collection/js/main.js +8 -0
  14. package/dist/collection/models/ontotext-yasgui.js +41 -0
  15. package/dist/collection/models/yasgui-configuration.js +11 -0
  16. package/dist/collection/pages/default-view/main.js +8 -0
  17. package/dist/collection/pages/view-configurations/main.js +31 -0
  18. package/dist/collection/pages/view-modes/main.js +18 -0
  19. package/dist/collection/services/yasgui/configuration/configurator.js +1 -0
  20. package/dist/collection/services/yasgui/configuration/yasgui-configuration-builder.js +28 -0
  21. package/dist/collection/services/yasgui/configuration/yasgui-configurator.js +45 -0
  22. package/dist/collection/services/yasgui/configuration/yasqe-configurator.js +17 -0
  23. package/dist/collection/services/yasgui/configuration/yasr-configurator.js +12 -0
  24. package/dist/collection/services/yasgui/yasgui-builder.js +26 -0
  25. package/dist/components/index.d.ts +22 -0
  26. package/dist/components/index.js +2 -0
  27. package/dist/components/ontotext-yasgui.d.ts +11 -0
  28. package/dist/components/ontotext-yasgui.js +407 -0
  29. package/dist/esm/index-5e3f8118.js +1124 -0
  30. package/dist/esm/index.js +1 -0
  31. package/dist/esm/loader.js +17 -0
  32. package/dist/esm/ontotext-yasgui-web-component.js +17 -0
  33. package/dist/esm/ontotext-yasgui.entry.js +387 -0
  34. package/dist/esm/polyfills/core-js.js +11 -0
  35. package/dist/esm/polyfills/css-shim.js +1 -0
  36. package/dist/esm/polyfills/dom.js +79 -0
  37. package/dist/esm/polyfills/es5-html-element.js +1 -0
  38. package/dist/esm/polyfills/index.js +34 -0
  39. package/dist/esm/polyfills/system.js +6 -0
  40. package/dist/index.cjs.js +1 -0
  41. package/dist/index.js +1 -0
  42. package/dist/ontotext-yasgui-web-component/index.esm.js +0 -0
  43. package/dist/ontotext-yasgui-web-component/ontotext-yasgui-web-component.esm.js +1 -0
  44. package/dist/ontotext-yasgui-web-component/p-498af5d3.js +2 -0
  45. package/dist/ontotext-yasgui-web-component/p-88daf135.entry.js +2 -0
  46. package/dist/types/components/ontotext-yasgui-web-component/ontotext-yasgui-web-component.d.ts +21 -0
  47. package/dist/types/components.d.ts +46 -0
  48. package/dist/types/index.d.ts +1 -0
  49. package/dist/types/models/ontotext-yasgui.d.ts +17 -0
  50. package/dist/types/models/yasgui-configuration.d.ts +40 -0
  51. package/dist/types/services/yasgui/configuration/configurator.d.ts +15 -0
  52. package/dist/types/services/yasgui/configuration/yasgui-configuration-builder.d.ts +18 -0
  53. package/dist/types/services/yasgui/configuration/yasgui-configurator.d.ts +14 -0
  54. package/dist/types/services/yasgui/configuration/yasqe-configurator.d.ts +8 -0
  55. package/dist/types/services/yasgui/configuration/yasr-configurator.d.ts +8 -0
  56. package/dist/types/services/yasgui/yasgui-builder.d.ts +20 -0
  57. package/dist/types/stencil-public-runtime.d.ts +1581 -0
  58. package/loader/cdn.js +3 -0
  59. package/loader/index.cjs.js +3 -0
  60. package/loader/index.d.ts +12 -0
  61. package/loader/index.es2017.js +3 -0
  62. package/loader/index.js +4 -0
  63. package/loader/package.json +11 -0
  64. package/package.json +41 -0
@@ -0,0 +1,1124 @@
1
+ const NAMESPACE = 'ontotext-yasgui-web-component';
2
+
3
+ /**
4
+ * Virtual DOM patching algorithm based on Snabbdom by
5
+ * Simon Friis Vindum (@paldepind)
6
+ * Licensed under the MIT License
7
+ * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
8
+ *
9
+ * Modified for Stencil's renderer and slot projection
10
+ */
11
+ let queuePending = false;
12
+ const createTime = (fnName, tagName = '') => {
13
+ {
14
+ return () => {
15
+ return;
16
+ };
17
+ }
18
+ };
19
+ const uniqueTime = (key, measureText) => {
20
+ {
21
+ return () => {
22
+ return;
23
+ };
24
+ }
25
+ };
26
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
27
+ const isComplexType = (o) => {
28
+ // https://jsperf.com/typeof-fn-object/5
29
+ o = typeof o;
30
+ return o === 'object' || o === 'function';
31
+ };
32
+ /**
33
+ * Production h() function based on Preact by
34
+ * Jason Miller (@developit)
35
+ * Licensed under the MIT License
36
+ * https://github.com/developit/preact/blob/master/LICENSE
37
+ *
38
+ * Modified for Stencil's compiler and vdom
39
+ */
40
+ // const stack: any[] = [];
41
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
42
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
43
+ const h = (nodeName, vnodeData, ...children) => {
44
+ let child = null;
45
+ let simple = false;
46
+ let lastSimple = false;
47
+ const vNodeChildren = [];
48
+ const walk = (c) => {
49
+ for (let i = 0; i < c.length; i++) {
50
+ child = c[i];
51
+ if (Array.isArray(child)) {
52
+ walk(child);
53
+ }
54
+ else if (child != null && typeof child !== 'boolean') {
55
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
56
+ child = String(child);
57
+ }
58
+ if (simple && lastSimple) {
59
+ // If the previous child was simple (string), we merge both
60
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
61
+ }
62
+ else {
63
+ // Append a new vNode, if it's text, we create a text vNode
64
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
65
+ }
66
+ lastSimple = simple;
67
+ }
68
+ }
69
+ };
70
+ walk(children);
71
+ const vnode = newVNode(nodeName, null);
72
+ vnode.$attrs$ = vnodeData;
73
+ if (vNodeChildren.length > 0) {
74
+ vnode.$children$ = vNodeChildren;
75
+ }
76
+ return vnode;
77
+ };
78
+ const newVNode = (tag, text) => {
79
+ const vnode = {
80
+ $flags$: 0,
81
+ $tag$: tag,
82
+ $text$: text,
83
+ $elm$: null,
84
+ $children$: null,
85
+ };
86
+ return vnode;
87
+ };
88
+ const Host = {};
89
+ const isHost = (node) => node && node.$tag$ === Host;
90
+ /**
91
+ * Parse a new property value for a given property type.
92
+ *
93
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
94
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
95
+ * 1. `any`, the type given to `propValue` in the function signature
96
+ * 2. the type stored from `propType`.
97
+ *
98
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
99
+ *
100
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
101
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
102
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
103
+ * ```tsx
104
+ * <my-cmp prop-val={0}></my-cmp>
105
+ * ```
106
+ *
107
+ * HTML prop values on the other hand, will always a string
108
+ *
109
+ * @param propValue the new value to coerce to some type
110
+ * @param propType the type of the prop, expressed as a binary number
111
+ * @returns the parsed/coerced value
112
+ */
113
+ const parsePropertyValue = (propValue, propType) => {
114
+ // ensure this value is of the correct prop type
115
+ if (propValue != null && !isComplexType(propValue)) {
116
+ // redundant return here for better minification
117
+ return propValue;
118
+ }
119
+ // not sure exactly what type we want
120
+ // so no need to change to a different type
121
+ return propValue;
122
+ };
123
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
124
+ const createEvent = (ref, name, flags) => {
125
+ const elm = getElement(ref);
126
+ return {
127
+ emit: (detail) => {
128
+ return emitEvent(elm, name, {
129
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
130
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
131
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
132
+ detail,
133
+ });
134
+ },
135
+ };
136
+ };
137
+ /**
138
+ * Helper function to create & dispatch a custom Event on a provided target
139
+ * @param elm the target of the Event
140
+ * @param name the name to give the custom Event
141
+ * @param opts options for configuring a custom Event
142
+ * @returns the custom Event
143
+ */
144
+ const emitEvent = (elm, name, opts) => {
145
+ const ev = plt.ce(name, opts);
146
+ elm.dispatchEvent(ev);
147
+ return ev;
148
+ };
149
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
150
+ const registerStyle = (scopeId, cssText, allowCS) => {
151
+ let style = styles.get(scopeId);
152
+ if (supportsConstructableStylesheets && allowCS) {
153
+ style = (style || new CSSStyleSheet());
154
+ if (typeof style === 'string') {
155
+ style = cssText;
156
+ }
157
+ else {
158
+ style.replaceSync(cssText);
159
+ }
160
+ }
161
+ else {
162
+ style = cssText;
163
+ }
164
+ styles.set(scopeId, style);
165
+ };
166
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
167
+ let scopeId = getScopeId(cmpMeta);
168
+ const style = styles.get(scopeId);
169
+ // if an element is NOT connected then getRootNode() will return the wrong root node
170
+ // so the fallback is to always use the document for the root node in those cases
171
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
172
+ if (style) {
173
+ if (typeof style === 'string') {
174
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
175
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
176
+ let styleElm;
177
+ if (!appliedStyles) {
178
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
179
+ }
180
+ if (!appliedStyles.has(scopeId)) {
181
+ {
182
+ {
183
+ styleElm = doc.createElement('style');
184
+ styleElm.innerHTML = style;
185
+ }
186
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
187
+ }
188
+ if (appliedStyles) {
189
+ appliedStyles.add(scopeId);
190
+ }
191
+ }
192
+ }
193
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
194
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
195
+ }
196
+ }
197
+ return scopeId;
198
+ };
199
+ const attachStyles = (hostRef) => {
200
+ const cmpMeta = hostRef.$cmpMeta$;
201
+ const elm = hostRef.$hostElement$;
202
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
203
+ addStyle(elm.getRootNode(), cmpMeta);
204
+ endAttachStyles();
205
+ };
206
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
207
+ /**
208
+ * Create a DOM Node corresponding to one of the children of a given VNode.
209
+ *
210
+ * @param oldParentVNode the parent VNode from the previous render
211
+ * @param newParentVNode the parent VNode from the current render
212
+ * @param childIndex the index of the VNode, in the _new_ parent node's
213
+ * children, for which we will create a new DOM node
214
+ * @param parentElm the parent DOM node which our new node will be a child of
215
+ * @returns the newly created node
216
+ */
217
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
218
+ // tslint:disable-next-line: prefer-const
219
+ const newVNode = newParentVNode.$children$[childIndex];
220
+ let i = 0;
221
+ let elm;
222
+ let childNode;
223
+ {
224
+ // create element
225
+ elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
226
+ if (newVNode.$children$) {
227
+ for (i = 0; i < newVNode.$children$.length; ++i) {
228
+ // create the node
229
+ childNode = createElm(oldParentVNode, newVNode, i);
230
+ // return node could have been null
231
+ if (childNode) {
232
+ // append our new node
233
+ elm.appendChild(childNode);
234
+ }
235
+ }
236
+ }
237
+ }
238
+ return elm;
239
+ };
240
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
241
+ let containerElm = (parentElm);
242
+ let childNode;
243
+ for (; startIdx <= endIdx; ++startIdx) {
244
+ if (vnodes[startIdx]) {
245
+ childNode = createElm(null, parentVNode, startIdx);
246
+ if (childNode) {
247
+ vnodes[startIdx].$elm$ = childNode;
248
+ containerElm.insertBefore(childNode, before);
249
+ }
250
+ }
251
+ }
252
+ };
253
+ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
254
+ for (; startIdx <= endIdx; ++startIdx) {
255
+ if ((vnode = vnodes[startIdx])) {
256
+ elm = vnode.$elm$;
257
+ // remove the vnode's element from the dom
258
+ elm.remove();
259
+ }
260
+ }
261
+ };
262
+ /**
263
+ * Reconcile the children of a new VNode with the children of an old VNode by
264
+ * traversing the two collections of children, identifying nodes that are
265
+ * conserved or changed, calling out to `patch` to make any necessary
266
+ * updates to the DOM, and rearranging DOM nodes as needed.
267
+ *
268
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
269
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
270
+ * 'windows' by storing start and end indices and references to the
271
+ * corresponding array entries. Initially the two 'windows' are basically equal
272
+ * to the entire array, but we progressively narrow the windows until there are
273
+ * no children left to update by doing the following:
274
+ *
275
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
276
+ * that if we have an initial array like the following we'll end up dealing
277
+ * only with a window bounded by the highlighted elements:
278
+ *
279
+ * [null, null, VNode1 , ... , VNode2, null, null]
280
+ * ^^^^^^ ^^^^^^
281
+ *
282
+ * 2. Check to see if the elements at the head and tail positions are equal
283
+ * across the windows. This will basically detect elements which haven't
284
+ * been added, removed, or changed position, i.e. if you had the following
285
+ * VNode elements (represented as HTML):
286
+ *
287
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
288
+ * newVNode: `<div><p><span>THERE</span></p></div>`
289
+ *
290
+ * Then when comparing the children of the `<div>` tag we check the equality
291
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
292
+ * same tag in the same position, we'd be able to avoid completely
293
+ * re-rendering the subtree under them with a new DOM element and would just
294
+ * call out to `patch` to handle reconciling their children and so on.
295
+ *
296
+ * 3. Check, for both windows, to see if the element at the beginning of the
297
+ * window corresponds to the element at the end of the other window. This is
298
+ * a heuristic which will let us identify _some_ situations in which
299
+ * elements have changed position, for instance it _should_ detect that the
300
+ * children nodes themselves have not changed but merely moved in the
301
+ * following example:
302
+ *
303
+ * oldVNode: `<div><element-one /><element-two /></div>`
304
+ * newVNode: `<div><element-two /><element-one /></div>`
305
+ *
306
+ * If we find cases like this then we also need to move the concrete DOM
307
+ * elements corresponding to the moved children to write the re-order to the
308
+ * DOM.
309
+ *
310
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
311
+ * nodes in the old children which have the same key as the first element in
312
+ * our window on the new children. If we find such a node we handle calling
313
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
314
+ * what we find.
315
+ *
316
+ * Finally, once we've narrowed our 'windows' to the point that either of them
317
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
318
+ * insertion or deletion that needs to happen to get a DOM state that correctly
319
+ * reflects the new child VNodes. If, for instance, after our window on the old
320
+ * children has collapsed we still have more nodes on the new children that
321
+ * we haven't dealt with yet then we need to add them, or if the new children
322
+ * collapse but we still have unhandled _old_ children then we need to make
323
+ * sure the corresponding DOM nodes are removed.
324
+ *
325
+ * @param parentElm the node into which the parent VNode is rendered
326
+ * @param oldCh the old children of the parent node
327
+ * @param newVNode the new VNode which will replace the parent
328
+ * @param newCh the new children of the parent node
329
+ */
330
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
331
+ let oldStartIdx = 0;
332
+ let newStartIdx = 0;
333
+ let oldEndIdx = oldCh.length - 1;
334
+ let oldStartVnode = oldCh[0];
335
+ let oldEndVnode = oldCh[oldEndIdx];
336
+ let newEndIdx = newCh.length - 1;
337
+ let newStartVnode = newCh[0];
338
+ let newEndVnode = newCh[newEndIdx];
339
+ let node;
340
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
341
+ if (oldStartVnode == null) {
342
+ // VNode might have been moved left
343
+ oldStartVnode = oldCh[++oldStartIdx];
344
+ }
345
+ else if (oldEndVnode == null) {
346
+ oldEndVnode = oldCh[--oldEndIdx];
347
+ }
348
+ else if (newStartVnode == null) {
349
+ newStartVnode = newCh[++newStartIdx];
350
+ }
351
+ else if (newEndVnode == null) {
352
+ newEndVnode = newCh[--newEndIdx];
353
+ }
354
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
355
+ // if the start nodes are the same then we should patch the new VNode
356
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
357
+ // indices to reflect that. We don't need to move any DOM Nodes around
358
+ // since things are matched up in order.
359
+ patch(oldStartVnode, newStartVnode);
360
+ oldStartVnode = oldCh[++oldStartIdx];
361
+ newStartVnode = newCh[++newStartIdx];
362
+ }
363
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
364
+ // likewise, if the end nodes are the same we patch new onto old and
365
+ // decrement our end indices, and also likewise in this case we don't
366
+ // need to move any DOM Nodes.
367
+ patch(oldEndVnode, newEndVnode);
368
+ oldEndVnode = oldCh[--oldEndIdx];
369
+ newEndVnode = newCh[--newEndIdx];
370
+ }
371
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
372
+ patch(oldStartVnode, newEndVnode);
373
+ // We need to move the element for `oldStartVnode` into a position which
374
+ // will be appropriate for `newEndVnode`. For this we can use
375
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
376
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
377
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
378
+ //
379
+ // <old-start-node />
380
+ // <some-intervening-node />
381
+ // <old-end-node />
382
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
383
+ // <next-sibling />
384
+ //
385
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
386
+ // the node for `oldStartVnode` at the end of the children of
387
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
388
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
389
+ // append it to the children of the parent element.
390
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
391
+ oldStartVnode = oldCh[++oldStartIdx];
392
+ newEndVnode = newCh[--newEndIdx];
393
+ }
394
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
395
+ patch(oldEndVnode, newStartVnode);
396
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
397
+ // the same node, so since we're here we know that they are not. Thus we
398
+ // can move the element for `oldEndVnode` _before_ the element for
399
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
400
+ // future.
401
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
402
+ oldEndVnode = oldCh[--oldEndIdx];
403
+ newStartVnode = newCh[++newStartIdx];
404
+ }
405
+ else {
406
+ {
407
+ // We either didn't find an element in the old children that matches
408
+ // the key of the first new child OR the build is not using `key`
409
+ // attributes at all. In either case we need to create a new element
410
+ // for the new node.
411
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
412
+ newStartVnode = newCh[++newStartIdx];
413
+ }
414
+ if (node) {
415
+ // if we created a new node then handle inserting it to the DOM
416
+ {
417
+ oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
418
+ }
419
+ }
420
+ }
421
+ }
422
+ if (oldStartIdx > oldEndIdx) {
423
+ // we have some more new nodes to add which don't match up with old nodes
424
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
425
+ }
426
+ else if (newStartIdx > newEndIdx) {
427
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
428
+ // in the new array, so lets remove them (which entails cleaning up the
429
+ // relevant DOM nodes)
430
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
431
+ }
432
+ };
433
+ /**
434
+ * Compare two VNodes to determine if they are the same
435
+ *
436
+ * **NB**: This function is an equality _heuristic_ based on the available
437
+ * information set on the two VNodes and can be misleading under certain
438
+ * circumstances. In particular, if the two nodes do not have `key` attrs
439
+ * (available under `$key$` on VNodes) then the function falls back on merely
440
+ * checking that they have the same tag.
441
+ *
442
+ * So, in other words, if `key` attrs are not set on VNodes which may be
443
+ * changing order within a `children` array or something along those lines then
444
+ * we could obtain a false positive and then have to do needless re-rendering.
445
+ *
446
+ * @param leftVNode the first VNode to check
447
+ * @param rightVNode the second VNode to check
448
+ * @returns whether they're equal or not
449
+ */
450
+ const isSameVnode = (leftVNode, rightVNode) => {
451
+ // compare if two vnode to see if they're "technically" the same
452
+ // need to have the same element tag, and same key to be the same
453
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
454
+ return true;
455
+ }
456
+ return false;
457
+ };
458
+ /**
459
+ * Handle reconciling an outdated VNode with a new one which corresponds to
460
+ * it. This function handles flushing updates to the DOM and reconciling the
461
+ * children of the two nodes (if any).
462
+ *
463
+ * @param oldVNode an old VNode whose DOM element and children we want to update
464
+ * @param newVNode a new VNode representing an updated version of the old one
465
+ */
466
+ const patch = (oldVNode, newVNode) => {
467
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
468
+ const oldChildren = oldVNode.$children$;
469
+ const newChildren = newVNode.$children$;
470
+ {
471
+ if (oldChildren !== null && newChildren !== null) {
472
+ // looks like there's child vnodes for both the old and new vnodes
473
+ // so we need to call `updateChildren` to reconcile them
474
+ updateChildren(elm, oldChildren, newVNode, newChildren);
475
+ }
476
+ else if (newChildren !== null) {
477
+ // add the new vnode children
478
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
479
+ }
480
+ else if (oldChildren !== null) {
481
+ // no new child vnodes, but there are old child vnodes to remove
482
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
483
+ }
484
+ }
485
+ };
486
+ const renderVdom = (hostRef, renderFnResults) => {
487
+ const hostElm = hostRef.$hostElement$;
488
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
489
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
490
+ rootVnode.$tag$ = null;
491
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
492
+ hostRef.$vnode$ = rootVnode;
493
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
494
+ // synchronous patch
495
+ patch(oldVNode, rootVnode);
496
+ };
497
+ const attachToAncestor = (hostRef, ancestorComponent) => {
498
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
499
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
500
+ }
501
+ };
502
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
503
+ {
504
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
505
+ }
506
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
507
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
508
+ return;
509
+ }
510
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
511
+ // there is no ancestor component or the ancestor component
512
+ // has already fired off its lifecycle update then
513
+ // fire off the initial update
514
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
515
+ return writeTask(dispatch) ;
516
+ };
517
+ const dispatchHooks = (hostRef, isInitialLoad) => {
518
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
519
+ const instance = hostRef.$lazyInstance$ ;
520
+ let promise;
521
+ if (isInitialLoad) {
522
+ {
523
+ hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
524
+ if (hostRef.$queuedListeners$) {
525
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
526
+ hostRef.$queuedListeners$ = null;
527
+ }
528
+ }
529
+ {
530
+ promise = safeCall(instance, 'componentWillLoad');
531
+ }
532
+ }
533
+ endSchedule();
534
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
535
+ };
536
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
537
+ // updateComponent
538
+ const elm = hostRef.$hostElement$;
539
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
540
+ const rc = elm['s-rc'];
541
+ if (isInitialLoad) {
542
+ // DOM WRITE!
543
+ attachStyles(hostRef);
544
+ }
545
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
546
+ {
547
+ callRender(hostRef, instance);
548
+ }
549
+ if (rc) {
550
+ // ok, so turns out there are some child host elements
551
+ // waiting on this parent element to load
552
+ // let's fire off all update callbacks waiting
553
+ rc.map((cb) => cb());
554
+ elm['s-rc'] = undefined;
555
+ }
556
+ endRender();
557
+ endUpdate();
558
+ {
559
+ const childrenPromises = elm['s-p'];
560
+ const postUpdate = () => postUpdateComponent(hostRef);
561
+ if (childrenPromises.length === 0) {
562
+ postUpdate();
563
+ }
564
+ else {
565
+ Promise.all(childrenPromises).then(postUpdate);
566
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
567
+ childrenPromises.length = 0;
568
+ }
569
+ }
570
+ };
571
+ const callRender = (hostRef, instance, elm) => {
572
+ try {
573
+ instance = instance.render() ;
574
+ {
575
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
576
+ }
577
+ {
578
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
579
+ }
580
+ {
581
+ {
582
+ // looks like we've got child nodes to render into this host element
583
+ // or we need to update the css class/attrs on the host element
584
+ // DOM WRITE!
585
+ {
586
+ renderVdom(hostRef, instance);
587
+ }
588
+ }
589
+ }
590
+ }
591
+ catch (e) {
592
+ consoleError(e, hostRef.$hostElement$);
593
+ }
594
+ return null;
595
+ };
596
+ const postUpdateComponent = (hostRef) => {
597
+ const tagName = hostRef.$cmpMeta$.$tagName$;
598
+ const elm = hostRef.$hostElement$;
599
+ const endPostUpdate = createTime('postUpdate', tagName);
600
+ const instance = hostRef.$lazyInstance$ ;
601
+ const ancestorComponent = hostRef.$ancestorComponent$;
602
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
603
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
604
+ {
605
+ // DOM WRITE!
606
+ addHydratedFlag(elm);
607
+ }
608
+ {
609
+ safeCall(instance, 'componentDidLoad');
610
+ }
611
+ endPostUpdate();
612
+ {
613
+ hostRef.$onReadyResolve$(elm);
614
+ if (!ancestorComponent) {
615
+ appDidLoad();
616
+ }
617
+ }
618
+ }
619
+ else {
620
+ endPostUpdate();
621
+ }
622
+ {
623
+ hostRef.$onInstanceResolve$(elm);
624
+ }
625
+ // load events fire from bottom to top
626
+ // the deepest elements load first then bubbles up
627
+ {
628
+ if (hostRef.$onRenderResolve$) {
629
+ hostRef.$onRenderResolve$();
630
+ hostRef.$onRenderResolve$ = undefined;
631
+ }
632
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
633
+ nextTick(() => scheduleUpdate(hostRef, false));
634
+ }
635
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
636
+ }
637
+ // ( •_•)
638
+ // ( •_•)>⌐■-■
639
+ // (⌐■_■)
640
+ };
641
+ const appDidLoad = (who) => {
642
+ // on appload
643
+ // we have finish the first big initial render
644
+ {
645
+ addHydratedFlag(doc.documentElement);
646
+ }
647
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
648
+ };
649
+ const safeCall = (instance, method, arg) => {
650
+ if (instance && instance[method]) {
651
+ try {
652
+ return instance[method](arg);
653
+ }
654
+ catch (e) {
655
+ consoleError(e);
656
+ }
657
+ }
658
+ return undefined;
659
+ };
660
+ const then = (promise, thenFn) => {
661
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
662
+ };
663
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
664
+ ;
665
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
666
+ const setValue = (ref, propName, newVal, cmpMeta) => {
667
+ // check our new property value against our internal value
668
+ const hostRef = getHostRef(ref);
669
+ const elm = hostRef.$hostElement$ ;
670
+ const oldVal = hostRef.$instanceValues$.get(propName);
671
+ const flags = hostRef.$flags$;
672
+ const instance = hostRef.$lazyInstance$ ;
673
+ newVal = parsePropertyValue(newVal);
674
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
675
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
676
+ const didValueChange = newVal !== oldVal && !areBothNaN;
677
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
678
+ // gadzooks! the property's value has changed!!
679
+ // set our new value!
680
+ hostRef.$instanceValues$.set(propName, newVal);
681
+ if (instance) {
682
+ // get an array of method names of watch functions to call
683
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
684
+ const watchMethods = cmpMeta.$watchers$[propName];
685
+ if (watchMethods) {
686
+ // this instance is watching for when this property changed
687
+ watchMethods.map((watchMethodName) => {
688
+ try {
689
+ // fire off each of the watch methods that are watching this property
690
+ instance[watchMethodName](newVal, oldVal, propName);
691
+ }
692
+ catch (e) {
693
+ consoleError(e, elm);
694
+ }
695
+ });
696
+ }
697
+ }
698
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
699
+ // looks like this value actually changed, so we've got work to do!
700
+ // but only if we've already rendered, otherwise just chill out
701
+ // queue that we need to do an update, but don't worry about queuing
702
+ // up millions cuz this function ensures it only runs once
703
+ scheduleUpdate(hostRef, false);
704
+ }
705
+ }
706
+ }
707
+ };
708
+ /**
709
+ * Attach a series of runtime constructs to a compiled Stencil component
710
+ * constructor, including getters and setters for the `@Prop` and `@State`
711
+ * decorators, callbacks for when attributes change, and so on.
712
+ *
713
+ * @param Cstr the constructor for a component that we need to process
714
+ * @param cmpMeta metadata collected previously about the component
715
+ * @param flags a number used to store a series of bit flags
716
+ * @returns a reference to the same constructor passed in (but now mutated)
717
+ */
718
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
719
+ if (cmpMeta.$members$) {
720
+ if (Cstr.watchers) {
721
+ cmpMeta.$watchers$ = Cstr.watchers;
722
+ }
723
+ // It's better to have a const than two Object.entries()
724
+ const members = Object.entries(cmpMeta.$members$);
725
+ const prototype = Cstr.prototype;
726
+ members.map(([memberName, [memberFlags]]) => {
727
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
728
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
729
+ // proxyComponent - prop
730
+ Object.defineProperty(prototype, memberName, {
731
+ get() {
732
+ // proxyComponent, get value
733
+ return getValue(this, memberName);
734
+ },
735
+ set(newValue) {
736
+ // proxyComponent, set value
737
+ setValue(this, memberName, newValue, cmpMeta);
738
+ },
739
+ configurable: true,
740
+ enumerable: true,
741
+ });
742
+ }
743
+ else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
744
+ memberFlags & 64 /* MEMBER_FLAGS.Method */) {
745
+ // proxyComponent - method
746
+ Object.defineProperty(prototype, memberName, {
747
+ value(...args) {
748
+ const ref = getHostRef(this);
749
+ return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
750
+ },
751
+ });
752
+ }
753
+ });
754
+ }
755
+ return Cstr;
756
+ };
757
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
758
+ // initializeComponent
759
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
760
+ {
761
+ // we haven't initialized this element yet
762
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
763
+ // lazy loaded components
764
+ // request the component's implementation to be
765
+ // wired up with the host element
766
+ Cstr = loadModule(cmpMeta);
767
+ if (Cstr.then) {
768
+ // Await creates a micro-task avoid if possible
769
+ const endLoad = uniqueTime();
770
+ Cstr = await Cstr;
771
+ endLoad();
772
+ }
773
+ if (!Cstr.isProxied) {
774
+ // we've never proxied this Constructor before
775
+ // let's add the getters/setters to its prototype before
776
+ // the first time we create an instance of the implementation
777
+ {
778
+ cmpMeta.$watchers$ = Cstr.watchers;
779
+ }
780
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
781
+ Cstr.isProxied = true;
782
+ }
783
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
784
+ // ok, time to construct the instance
785
+ // but let's keep track of when we start and stop
786
+ // so that the getters/setters don't incorrectly step on data
787
+ {
788
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
789
+ }
790
+ // construct the lazy-loaded component implementation
791
+ // passing the hostRef is very important during
792
+ // construction in order to directly wire together the
793
+ // host element and the lazy-loaded instance
794
+ try {
795
+ new Cstr(hostRef);
796
+ }
797
+ catch (e) {
798
+ consoleError(e);
799
+ }
800
+ {
801
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
802
+ }
803
+ {
804
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
805
+ }
806
+ endNewInstance();
807
+ }
808
+ if (Cstr.style) {
809
+ // this component has styles but we haven't registered them yet
810
+ let style = Cstr.style;
811
+ const scopeId = getScopeId(cmpMeta);
812
+ if (!styles.has(scopeId)) {
813
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
814
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
815
+ endRegisterStyles();
816
+ }
817
+ }
818
+ }
819
+ // we've successfully created a lazy instance
820
+ const ancestorComponent = hostRef.$ancestorComponent$;
821
+ const schedule = () => scheduleUpdate(hostRef, true);
822
+ if (ancestorComponent && ancestorComponent['s-rc']) {
823
+ // this is the initial load and this component it has an ancestor component
824
+ // but the ancestor component has NOT fired its will update lifecycle yet
825
+ // so let's just cool our jets and wait for the ancestor to continue first
826
+ // this will get fired off when the ancestor component
827
+ // finally gets around to rendering its lazy self
828
+ // fire off the initial update
829
+ ancestorComponent['s-rc'].push(schedule);
830
+ }
831
+ else {
832
+ schedule();
833
+ }
834
+ };
835
+ const connectedCallback = (elm) => {
836
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
837
+ const hostRef = getHostRef(elm);
838
+ const cmpMeta = hostRef.$cmpMeta$;
839
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
840
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
841
+ // first time this component has connected
842
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
843
+ {
844
+ // find the first ancestor component (if there is one) and register
845
+ // this component as one of the actively loading child components for its ancestor
846
+ let ancestorComponent = elm;
847
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
848
+ // climb up the ancestors looking for the first
849
+ // component that hasn't finished its lifecycle update yet
850
+ if (ancestorComponent['s-p']) {
851
+ // we found this components first ancestor component
852
+ // keep a reference to this component's ancestor component
853
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
854
+ break;
855
+ }
856
+ }
857
+ }
858
+ // Lazy properties
859
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
860
+ if (cmpMeta.$members$) {
861
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
862
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
863
+ const value = elm[memberName];
864
+ delete elm[memberName];
865
+ elm[memberName] = value;
866
+ }
867
+ });
868
+ }
869
+ {
870
+ initializeComponent(elm, hostRef, cmpMeta);
871
+ }
872
+ }
873
+ else {
874
+ // not the first time this has connected
875
+ // reattach any event listeners to the host
876
+ // since they would have been removed when disconnected
877
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
878
+ }
879
+ endConnected();
880
+ }
881
+ };
882
+ const disconnectedCallback = (elm) => {
883
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
884
+ const hostRef = getHostRef(elm);
885
+ const instance = hostRef.$lazyInstance$ ;
886
+ {
887
+ if (hostRef.$rmListeners$) {
888
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
889
+ hostRef.$rmListeners$ = undefined;
890
+ }
891
+ }
892
+ {
893
+ safeCall(instance, 'disconnectedCallback');
894
+ }
895
+ }
896
+ };
897
+ const bootstrapLazy = (lazyBundles, options = {}) => {
898
+ const endBootstrap = createTime();
899
+ const cmpTags = [];
900
+ const exclude = options.exclude || [];
901
+ const customElements = win.customElements;
902
+ const head = doc.head;
903
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
904
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
905
+ const deferredConnectedCallbacks = [];
906
+ let appLoadFallback;
907
+ let isBootstrapping = true;
908
+ Object.assign(plt, options);
909
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
910
+ lazyBundles.map((lazyBundle) => {
911
+ lazyBundle[1].map((compactMeta) => {
912
+ const cmpMeta = {
913
+ $flags$: compactMeta[0],
914
+ $tagName$: compactMeta[1],
915
+ $members$: compactMeta[2],
916
+ $listeners$: compactMeta[3],
917
+ };
918
+ {
919
+ cmpMeta.$members$ = compactMeta[2];
920
+ }
921
+ {
922
+ cmpMeta.$listeners$ = compactMeta[3];
923
+ }
924
+ {
925
+ cmpMeta.$watchers$ = {};
926
+ }
927
+ const tagName = cmpMeta.$tagName$;
928
+ const HostElement = class extends HTMLElement {
929
+ // StencilLazyHost
930
+ constructor(self) {
931
+ // @ts-ignore
932
+ super(self);
933
+ self = this;
934
+ registerHost(self, cmpMeta);
935
+ }
936
+ connectedCallback() {
937
+ if (appLoadFallback) {
938
+ clearTimeout(appLoadFallback);
939
+ appLoadFallback = null;
940
+ }
941
+ if (isBootstrapping) {
942
+ // connectedCallback will be processed once all components have been registered
943
+ deferredConnectedCallbacks.push(this);
944
+ }
945
+ else {
946
+ plt.jmp(() => connectedCallback(this));
947
+ }
948
+ }
949
+ disconnectedCallback() {
950
+ plt.jmp(() => disconnectedCallback(this));
951
+ }
952
+ componentOnReady() {
953
+ return getHostRef(this).$onReadyPromise$;
954
+ }
955
+ };
956
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
957
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
958
+ cmpTags.push(tagName);
959
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
960
+ }
961
+ });
962
+ });
963
+ {
964
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
965
+ visibilityStyle.setAttribute('data-styles', '');
966
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
967
+ }
968
+ // Process deferred connectedCallbacks now all components have been registered
969
+ isBootstrapping = false;
970
+ if (deferredConnectedCallbacks.length) {
971
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
972
+ }
973
+ else {
974
+ {
975
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
976
+ }
977
+ }
978
+ // Fallback appLoad event
979
+ endBootstrap();
980
+ };
981
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
982
+ if (listeners) {
983
+ listeners.map(([flags, name, method]) => {
984
+ const target = getHostListenerTarget(elm, flags) ;
985
+ const handler = hostListenerProxy(hostRef, method);
986
+ const opts = hostListenerOpts(flags);
987
+ plt.ael(target, name, handler, opts);
988
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
989
+ });
990
+ }
991
+ };
992
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
993
+ try {
994
+ {
995
+ if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
996
+ // instance is ready, let's call it's member method for this event
997
+ hostRef.$lazyInstance$[methodName](ev);
998
+ }
999
+ else {
1000
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
1001
+ }
1002
+ }
1003
+ }
1004
+ catch (e) {
1005
+ consoleError(e);
1006
+ }
1007
+ };
1008
+ const getHostListenerTarget = (elm, flags) => {
1009
+ if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
1010
+ return win;
1011
+ return elm;
1012
+ };
1013
+ // prettier-ignore
1014
+ const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1015
+ const hostRefs = /*@__PURE__*/ new WeakMap();
1016
+ const getHostRef = (ref) => hostRefs.get(ref);
1017
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1018
+ const registerHost = (elm, cmpMeta) => {
1019
+ const hostRef = {
1020
+ $flags$: 0,
1021
+ $hostElement$: elm,
1022
+ $cmpMeta$: cmpMeta,
1023
+ $instanceValues$: new Map(),
1024
+ };
1025
+ {
1026
+ hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
1027
+ }
1028
+ {
1029
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1030
+ elm['s-p'] = [];
1031
+ elm['s-rc'] = [];
1032
+ }
1033
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1034
+ return hostRefs.set(elm, hostRef);
1035
+ };
1036
+ const consoleError = (e, el) => (0, console.error)(e, el);
1037
+ const cmpModules = /*@__PURE__*/ new Map();
1038
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1039
+ // loadModuleImport
1040
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1041
+ const bundleId = cmpMeta.$lazyBundleId$;
1042
+ const module = cmpModules.get(bundleId) ;
1043
+ if (module) {
1044
+ return module[exportName];
1045
+ }
1046
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
1047
+ return import(
1048
+ /* @vite-ignore */
1049
+ /* webpackInclude: /\.entry\.js$/ */
1050
+ /* webpackExclude: /\.system\.entry\.js$/ */
1051
+ /* webpackMode: "lazy" */
1052
+ `./${bundleId}.entry.js${''}`).then((importedModule) => {
1053
+ {
1054
+ cmpModules.set(bundleId, importedModule);
1055
+ }
1056
+ return importedModule[exportName];
1057
+ }, consoleError);
1058
+ };
1059
+ const styles = /*@__PURE__*/ new Map();
1060
+ const win = typeof window !== 'undefined' ? window : {};
1061
+ const doc = win.document || { head: {} };
1062
+ const plt = {
1063
+ $flags$: 0,
1064
+ $resourcesUrl$: '',
1065
+ jmp: (h) => h(),
1066
+ raf: (h) => requestAnimationFrame(h),
1067
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1068
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1069
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
1070
+ };
1071
+ const promiseResolve = (v) => Promise.resolve(v);
1072
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
1073
+ try {
1074
+ new CSSStyleSheet();
1075
+ return typeof new CSSStyleSheet().replaceSync === 'function';
1076
+ }
1077
+ catch (e) { }
1078
+ return false;
1079
+ })()
1080
+ ;
1081
+ const queueDomReads = [];
1082
+ const queueDomWrites = [];
1083
+ const queueTask = (queue, write) => (cb) => {
1084
+ queue.push(cb);
1085
+ if (!queuePending) {
1086
+ queuePending = true;
1087
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1088
+ nextTick(flush);
1089
+ }
1090
+ else {
1091
+ plt.raf(flush);
1092
+ }
1093
+ }
1094
+ };
1095
+ const consume = (queue) => {
1096
+ for (let i = 0; i < queue.length; i++) {
1097
+ try {
1098
+ queue[i](performance.now());
1099
+ }
1100
+ catch (e) {
1101
+ consoleError(e);
1102
+ }
1103
+ }
1104
+ queue.length = 0;
1105
+ };
1106
+ const flush = () => {
1107
+ // always force a bunch of medium callbacks to run, but still have
1108
+ // a throttle on how many can run in a certain time
1109
+ // DOM READS!!!
1110
+ consume(queueDomReads);
1111
+ // DOM WRITES!!!
1112
+ {
1113
+ consume(queueDomWrites);
1114
+ if ((queuePending = queueDomReads.length > 0)) {
1115
+ // still more to do yet, but we've run out of time
1116
+ // let's let this thing cool off and try again in the next tick
1117
+ plt.raf(flush);
1118
+ }
1119
+ }
1120
+ };
1121
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1122
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1123
+
1124
+ export { Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r };