1 | 'use strict';
|
2 |
|
3 | function _interopNamespace(e) {
|
4 | if (e && e.__esModule) { return e; } else {
|
5 | var n = {};
|
6 | if (e) {
|
7 | Object.keys(e).forEach(function (k) {
|
8 | var d = Object.getOwnPropertyDescriptor(e, k);
|
9 | Object.defineProperty(n, k, d.get ? d : {
|
10 | enumerable: true,
|
11 | get: function () {
|
12 | return e[k];
|
13 | }
|
14 | });
|
15 | });
|
16 | }
|
17 | n['default'] = e;
|
18 | return n;
|
19 | }
|
20 | }
|
21 |
|
22 | const BUILD = {"allRenderFn":true,"cmpDidLoad":false,"cmpShouldUpdate":false,"cmpDidUnload":false,"cmpDidUpdate":false,"cmpDidRender":false,"cmpWillLoad":false,"cmpWillUpdate":false,"cmpWillRender":false,"connectedCallback":false,"disconnectedCallback":false,"element":false,"event":false,"hasRenderFn":true,"lifecycle":false,"asyncLoading":true,"hostListener":false,"hostListenerTargetWindow":false,"hostListenerTargetDocument":false,"hostListenerTargetBody":false,"hostListenerTargetParent":false,"hostListenerTarget":false,"member":true,"method":false,"mode":false,"noVdomRender":false,"observeAttribute":true,"prop":true,"propBoolean":true,"propNumber":true,"propString":true,"propMutable":true,"reflect":true,"scoped":false,"shadowDom":false,"slot":true,"slotRelocation":true,"state":false,"style":true,"svg":false,"updatable":true,"vdomAttribute":true,"vdomXlink":false,"vdomClass":true,"vdomFunctional":true,"vdomKey":false,"vdomListener":true,"vdomRef":false,"vdomRender":true,"vdomStyle":false,"vdomText":true,"watchCallback":false,"taskQueue":true,"lazyLoad":true,"hydrateServerSide":false,"cssVarShim":true,"initializeNextTick":true,"hydrateClientSide":true,"isDebug":false,"isDev":false,"devTools":false,"lifecycleDOMEvents":false,"profile":false,"hotModuleReplacement":false,"constructableCSS":true,"cssAnnotations":true};
|
23 | const NAMESPACE = 'bulmil';
|
24 |
|
25 | let queueCongestion = 0;
|
26 | let queuePending = false;
|
27 | let scopeId;
|
28 | let contentRef;
|
29 | let hostTagName;
|
30 | let useNativeShadowDom = false;
|
31 | let checkSlotFallbackVisibility = false;
|
32 | let checkSlotRelocate = false;
|
33 | let isSvgMode = false;
|
34 | const win = window;
|
35 | const doc = document;
|
36 | const plt = {
|
37 | $flags$: 0,
|
38 | $resourcesUrl$: '',
|
39 | jmp: (h) => h(),
|
40 | raf: (h) => requestAnimationFrame(h),
|
41 | ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
42 | rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
43 | };
|
44 | const supportsShadowDom = false;
|
45 | const supportsConstructibleStylesheets = (() => {
|
46 | try {
|
47 | new CSSStyleSheet();
|
48 | return true;
|
49 | }
|
50 | catch (e) { }
|
51 | return false;
|
52 | })() ;
|
53 | const hostRefs = new WeakMap();
|
54 | const getHostRef = (ref) => hostRefs.get(ref);
|
55 | const registerInstance = (lazyInstance, hostRef) => hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
|
56 | const registerHost = (elm) => {
|
57 | const hostRef = {
|
58 | $flags$: 0,
|
59 | $hostElement$: elm,
|
60 | $instanceValues$: new Map()
|
61 | };
|
62 | {
|
63 | hostRef.$onReadyPromise$ = new Promise(r => hostRef.$onReadyResolve$ = r);
|
64 | elm['s-p'] = [];
|
65 | elm['s-rc'] = [];
|
66 | }
|
67 | return hostRefs.set(elm, hostRef);
|
68 | };
|
69 | const isMemberInElement = (elm, memberName) => memberName in elm;
|
70 | const consoleError = (e) => console.error(e);
|
71 | const moduleCache = new Map();
|
72 | const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
73 |
|
74 | const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
|
75 | const bundleId = ( cmpMeta.$lazyBundleIds$);
|
76 | const module = moduleCache.get(bundleId) ;
|
77 | if (module) {
|
78 | return module[exportName];
|
79 | }
|
80 | return new Promise(function (resolve) { resolve(_interopNamespace(require(
|
81 |
|
82 |
|
83 |
|
84 | `./${bundleId}.entry.js${ ''}`))); }).then(importedModule => {
|
85 | {
|
86 | moduleCache.set(bundleId, importedModule);
|
87 | }
|
88 | return importedModule[exportName];
|
89 | }, consoleError);
|
90 | };
|
91 | const styles = new Map();
|
92 | const queueDomReads = [];
|
93 | const queueDomWrites = [];
|
94 | const queueDomWritesLow = [];
|
95 | const queueTask = (queue, write) => (cb) => {
|
96 | queue.push(cb);
|
97 | if (!queuePending) {
|
98 | queuePending = true;
|
99 | if (write && plt.$flags$ & 4 ) {
|
100 | nextTick(flush);
|
101 | }
|
102 | else {
|
103 | plt.raf(flush);
|
104 | }
|
105 | }
|
106 | };
|
107 | const consume = (queue) => {
|
108 | for (let i = 0; i < queue.length; i++) {
|
109 | try {
|
110 | queue[i](performance.now());
|
111 | }
|
112 | catch (e) {
|
113 | consoleError(e);
|
114 | }
|
115 | }
|
116 | queue.length = 0;
|
117 | };
|
118 | const consumeTimeout = (queue, timeout) => {
|
119 | let i = 0;
|
120 | let ts = 0;
|
121 | while (i < queue.length && (ts = performance.now()) < timeout) {
|
122 | try {
|
123 | queue[i++](ts);
|
124 | }
|
125 | catch (e) {
|
126 | consoleError(e);
|
127 | }
|
128 | }
|
129 | if (i === queue.length) {
|
130 | queue.length = 0;
|
131 | }
|
132 | else if (i !== 0) {
|
133 | queue.splice(0, i);
|
134 | }
|
135 | };
|
136 | const flush = () => {
|
137 | queueCongestion++;
|
138 |
|
139 |
|
140 |
|
141 | consume(queueDomReads);
|
142 | const timeout = (plt.$flags$ & 6 ) === 2
|
143 | ? performance.now() + (10 * Math.ceil(queueCongestion * (1.0 / 22.0)))
|
144 | : Infinity;
|
145 |
|
146 | consumeTimeout(queueDomWrites, timeout);
|
147 | consumeTimeout(queueDomWritesLow, timeout);
|
148 | if (queueDomWrites.length > 0) {
|
149 | queueDomWritesLow.push(...queueDomWrites);
|
150 | queueDomWrites.length = 0;
|
151 | }
|
152 | if (queuePending = ((queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length) > 0)) {
|
153 |
|
154 |
|
155 | plt.raf(flush);
|
156 | }
|
157 | else {
|
158 | queueCongestion = 0;
|
159 | }
|
160 | };
|
161 | const nextTick = (cb) => Promise.resolve().then(cb);
|
162 | const writeTask = queueTask(queueDomWrites, true);
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 | const EMPTY_OBJ = {};
|
171 | const isComplexType = (o) => {
|
172 |
|
173 | o = typeof o;
|
174 | return o === 'object' || o === 'function';
|
175 | };
|
176 | const getDynamicImportFunction = (namespace) => {
|
177 | return `__sc_import_${namespace.replace(/\s|-/g, '_')}`;
|
178 | };
|
179 | const patchEsm = () => {
|
180 |
|
181 | if ( !(win.CSS && win.CSS.supports && win.CSS.supports('color', 'var(--c)'))) {
|
182 |
|
183 | return new Promise(function (resolve) { resolve(require('./css-shim-978387b1-52a5db49.js')); }).then(() => {
|
184 | plt.$cssShim$ = win.__stencil_cssshim;
|
185 | if (plt.$cssShim$) {
|
186 | return plt.$cssShim$.initShim();
|
187 | }
|
188 | });
|
189 | }
|
190 | return Promise.resolve();
|
191 | };
|
192 | const patchBrowser = async () => {
|
193 | {
|
194 | plt.$cssShim$ = win.__stencil_cssshim;
|
195 | }
|
196 |
|
197 | const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('core-dd01c714.js', document.baseURI).href));
|
198 | const regex = new RegExp(`\/${NAMESPACE}(\\.esm)?\\.js($|\\?|#)`);
|
199 | const scriptElm = Array.from(doc.querySelectorAll('script')).find(s => (regex.test(s.src) ||
|
200 | s.getAttribute('data-stencil-namespace') === NAMESPACE));
|
201 | const opts = scriptElm['data-opts'];
|
202 | if (importMeta !== '') {
|
203 | return Object.assign(Object.assign({}, opts), { resourcesUrl: new URL('.', importMeta).href });
|
204 | }
|
205 | else {
|
206 | const resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href));
|
207 | patchDynamicImport(resourcesUrl.href);
|
208 | if (!window.customElements) {
|
209 |
|
210 | await new Promise(function (resolve) { resolve(require('./dom-96781eef-e2cadb44.js')); });
|
211 | }
|
212 | return Object.assign(Object.assign({}, opts), { resourcesUrl: resourcesUrl.href });
|
213 | }
|
214 | };
|
215 | const patchDynamicImport = (base) => {
|
216 | const importFunctionName = getDynamicImportFunction(NAMESPACE);
|
217 | try {
|
218 |
|
219 |
|
220 |
|
221 | win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);
|
222 | }
|
223 | catch (e) {
|
224 | const moduleMap = new Map();
|
225 | win[importFunctionName] = (src) => {
|
226 | const url = new URL(src, base).href;
|
227 | let mod = moduleMap.get(url);
|
228 | if (!mod) {
|
229 | const script = doc.createElement('script');
|
230 | script.type = 'module';
|
231 | script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], { type: 'application/javascript' }));
|
232 | mod = new Promise(resolve => {
|
233 | script.onload = () => {
|
234 | resolve(win[importFunctionName].m);
|
235 | script.remove();
|
236 | };
|
237 | });
|
238 | moduleMap.set(url, mod);
|
239 | doc.head.appendChild(script);
|
240 | }
|
241 | return mod;
|
242 | };
|
243 | }
|
244 | };
|
245 | const parsePropertyValue = (propValue, propType) => {
|
246 |
|
247 | if (propValue != null && !isComplexType(propValue)) {
|
248 | if ( propType & 4 ) {
|
249 |
|
250 |
|
251 | return (propValue === 'false' ? false : propValue === '' || !!propValue);
|
252 | }
|
253 | if ( propType & 2 ) {
|
254 |
|
255 | return parseFloat(propValue);
|
256 | }
|
257 | if ( propType & 1 ) {
|
258 |
|
259 |
|
260 | return String(propValue);
|
261 | }
|
262 |
|
263 | return propValue;
|
264 | }
|
265 |
|
266 |
|
267 | return propValue;
|
268 | };
|
269 | const CONTENT_REF_ID = 'r';
|
270 | const ORG_LOCATION_ID = 'o';
|
271 | const SLOT_NODE_ID = 's';
|
272 | const TEXT_NODE_ID = 't';
|
273 | const HYDRATED_CLASS = 'hydrated';
|
274 | const HYDRATE_ID = 's-id';
|
275 | const HYDRATE_CHILD_ID = 'c-id';
|
276 | const createTime = (fnName, tagName = '') => {
|
277 | {
|
278 | return () => { return; };
|
279 | }
|
280 | };
|
281 | const uniqueTime = (key, measureText) => {
|
282 | {
|
283 | return () => { return; };
|
284 | }
|
285 | };
|
286 | const rootAppliedStyles = new WeakMap();
|
287 | const registerStyle = (scopeId, cssText, allowCS) => {
|
288 | let style = styles.get(scopeId);
|
289 | if (supportsConstructibleStylesheets && allowCS) {
|
290 | style = (style || new CSSStyleSheet());
|
291 | style.replace(cssText);
|
292 | }
|
293 | else {
|
294 | style = cssText;
|
295 | }
|
296 | styles.set(scopeId, style);
|
297 | };
|
298 | const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
299 | let scopeId = getScopeId(cmpMeta.$tagName$);
|
300 | let style = styles.get(scopeId);
|
301 |
|
302 |
|
303 | styleContainerNode = (styleContainerNode.nodeType === 11 ? styleContainerNode : doc);
|
304 | if (style) {
|
305 | if (typeof style === 'string') {
|
306 | styleContainerNode = styleContainerNode.head || styleContainerNode;
|
307 | let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
308 | let styleElm;
|
309 | if (!appliedStyles) {
|
310 | rootAppliedStyles.set(styleContainerNode, appliedStyles = new Set());
|
311 | }
|
312 | if (!appliedStyles.has(scopeId)) {
|
313 | if ( styleContainerNode.host && (styleElm = styleContainerNode.firstElementChild) && styleElm.tagName === 'STYLE') {
|
314 |
|
315 | styleElm.innerHTML = style;
|
316 | }
|
317 | else {
|
318 | if ( plt.$cssShim$) {
|
319 | styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 ));
|
320 | const newScopeId = styleElm['s-sc'];
|
321 | if (newScopeId) {
|
322 | scopeId = newScopeId;
|
323 |
|
324 |
|
325 |
|
326 | appliedStyles = null;
|
327 | }
|
328 | }
|
329 | else {
|
330 | styleElm = doc.createElement('style');
|
331 | styleElm.innerHTML = style;
|
332 | }
|
333 | styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
334 | }
|
335 | if (appliedStyles) {
|
336 | appliedStyles.add(scopeId);
|
337 | }
|
338 | }
|
339 | }
|
340 | else if ( !styleContainerNode.adoptedStyleSheets.includes(style)) {
|
341 | styleContainerNode.adoptedStyleSheets = [
|
342 | ...styleContainerNode.adoptedStyleSheets,
|
343 | style
|
344 | ];
|
345 | }
|
346 | }
|
347 | return scopeId;
|
348 | };
|
349 | const attachStyles = (elm, cmpMeta, mode) => {
|
350 | const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
351 | const scopeId = addStyle( elm.getRootNode(), cmpMeta, mode, elm);
|
352 | endAttachStyles();
|
353 | };
|
354 | const getScopeId = (tagName, mode) => 'sc-' + ( tagName);
|
355 |
|
356 |
|
357 |
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 | const h = (nodeName, vnodeData, ...children) => {
|
367 | let child = null;
|
368 | let slotName = null;
|
369 | let simple = false;
|
370 | let lastSimple = false;
|
371 | let vNodeChildren = [];
|
372 | const walk = (c) => {
|
373 | for (let i = 0; i < c.length; i++) {
|
374 | child = c[i];
|
375 | if (Array.isArray(child)) {
|
376 | walk(child);
|
377 | }
|
378 | else if (child != null && typeof child !== 'boolean') {
|
379 | if (simple = typeof nodeName !== 'function' && !isComplexType(child)) {
|
380 | child = String(child);
|
381 | }
|
382 | if (simple && lastSimple) {
|
383 |
|
384 | vNodeChildren[vNodeChildren.length - 1].$text$ += child;
|
385 | }
|
386 | else {
|
387 |
|
388 | vNodeChildren.push(simple ? newVNode(null, child) : child);
|
389 | }
|
390 | lastSimple = simple;
|
391 | }
|
392 | }
|
393 | };
|
394 | walk(children);
|
395 | if (vnodeData) {
|
396 | if ( vnodeData.name) {
|
397 | slotName = vnodeData.name;
|
398 | }
|
399 | {
|
400 | const classData = vnodeData.className || vnodeData.class;
|
401 | if (classData) {
|
402 | vnodeData.class = typeof classData !== 'object'
|
403 | ? classData
|
404 | : Object.keys(classData)
|
405 | .filter(k => classData[k])
|
406 | .join(' ');
|
407 | }
|
408 | }
|
409 | }
|
410 | if ( typeof nodeName === 'function') {
|
411 |
|
412 | return nodeName(vnodeData, vNodeChildren, vdomFnUtils);
|
413 | }
|
414 | const vnode = newVNode(nodeName, null);
|
415 | vnode.$attrs$ = vnodeData;
|
416 | if (vNodeChildren.length > 0) {
|
417 | vnode.$children$ = vNodeChildren;
|
418 | }
|
419 | {
|
420 | vnode.$name$ = slotName;
|
421 | }
|
422 | return vnode;
|
423 | };
|
424 | const newVNode = (tag, text) => {
|
425 | const vnode = {
|
426 | $flags$: 0,
|
427 | $tag$: tag,
|
428 | $text$: text,
|
429 | $elm$: null,
|
430 | $children$: null
|
431 | };
|
432 | {
|
433 | vnode.$attrs$ = null;
|
434 | }
|
435 | {
|
436 | vnode.$name$ = null;
|
437 | }
|
438 | return vnode;
|
439 | };
|
440 | const Host = {};
|
441 | const isHost = (node) => node && node.$tag$ === Host;
|
442 | const vdomFnUtils = {
|
443 | 'forEach': (children, cb) => children.map(convertToPublic).forEach(cb),
|
444 | 'map': (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate)
|
445 | };
|
446 | const convertToPublic = (node) => {
|
447 | return {
|
448 | vattrs: node.$attrs$,
|
449 | vchildren: node.$children$,
|
450 | vkey: node.$key$,
|
451 | vname: node.$name$,
|
452 | vtag: node.$tag$,
|
453 | vtext: node.$text$
|
454 | };
|
455 | };
|
456 | const convertToPrivate = (node) => {
|
457 | const vnode = newVNode(node.vtag, node.vtext);
|
458 | vnode.$attrs$ = node.vattrs;
|
459 | vnode.$children$ = node.vchildren;
|
460 | vnode.$key$ = node.vkey;
|
461 | vnode.$name$ = node.vname;
|
462 | return vnode;
|
463 | };
|
464 |
|
465 |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 |
|
472 | const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
473 | if (oldValue === newValue) {
|
474 | return;
|
475 | }
|
476 | let isProp = isMemberInElement(elm, memberName);
|
477 | let ln = memberName.toLowerCase();
|
478 | if ( memberName === 'class') {
|
479 | const classList = elm.classList;
|
480 | const oldClasses = parseClassList(oldValue);
|
481 | const newClasses = parseClassList(newValue);
|
482 | classList.remove(...oldClasses.filter(c => c && !newClasses.includes(c)));
|
483 | classList.add(...newClasses.filter(c => c && !oldClasses.includes(c)));
|
484 | }
|
485 | else if ( !isProp && memberName[0] === 'o' && memberName[1] === 'n') {
|
486 |
|
487 |
|
488 |
|
489 |
|
490 | if (memberName[2] === '-') {
|
491 |
|
492 |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 |
|
498 | memberName = memberName.slice(3);
|
499 | }
|
500 | else if (isMemberInElement(win, ln)) {
|
501 |
|
502 |
|
503 |
|
504 |
|
505 | memberName = ln.slice(2);
|
506 | }
|
507 | else {
|
508 |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 | memberName = ln[2] + memberName.slice(3);
|
514 | }
|
515 | if (oldValue) {
|
516 | plt.rel(elm, memberName, oldValue, false);
|
517 | }
|
518 | if (newValue) {
|
519 | plt.ael(elm, memberName, newValue, false);
|
520 | }
|
521 | }
|
522 | else {
|
523 |
|
524 | const isComplex = isComplexType(newValue);
|
525 | if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
526 | try {
|
527 | if (!elm.tagName.includes('-')) {
|
528 | let n = newValue == null ? '' : newValue;
|
529 |
|
530 | if (memberName === 'list') {
|
531 | isProp = false;
|
532 |
|
533 | }
|
534 | else if (oldValue == null || elm[memberName] != n) {
|
535 | elm[memberName] = n;
|
536 | }
|
537 | }
|
538 | else {
|
539 | elm[memberName] = newValue;
|
540 | }
|
541 | }
|
542 | catch (e) { }
|
543 | }
|
544 | if (newValue == null || newValue === false) {
|
545 | {
|
546 | elm.removeAttribute(memberName);
|
547 | }
|
548 | }
|
549 | else if ((!isProp || (flags & 4 ) || isSvg) && !isComplex) {
|
550 | newValue = newValue === true ? '' : newValue;
|
551 | {
|
552 | elm.setAttribute(memberName, newValue);
|
553 | }
|
554 | }
|
555 | }
|
556 | };
|
557 | const parseClassListRegex = /\s/;
|
558 | const parseClassList = (value) => (!value) ? [] : value.split(parseClassListRegex);
|
559 | const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
560 |
|
561 |
|
562 |
|
563 | const elm = (newVnode.$elm$.nodeType === 11 && newVnode.$elm$.host) ? newVnode.$elm$.host : newVnode.$elm$;
|
564 | const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
565 | const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
566 | {
|
567 |
|
568 | for (memberName in oldVnodeAttrs) {
|
569 | if (!(memberName in newVnodeAttrs)) {
|
570 | setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
|
571 | }
|
572 | }
|
573 | }
|
574 |
|
575 | for (memberName in newVnodeAttrs) {
|
576 | setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
577 | }
|
578 | };
|
579 | const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
580 |
|
581 | let newVNode = newParentVNode.$children$[childIndex];
|
582 | let i = 0;
|
583 | let elm;
|
584 | let childNode;
|
585 | let oldVNode;
|
586 | if ( !useNativeShadowDom) {
|
587 |
|
588 | checkSlotRelocate = true;
|
589 | if (newVNode.$tag$ === 'slot') {
|
590 | if (scopeId) {
|
591 |
|
592 | parentElm.classList.add(scopeId + '-s');
|
593 | }
|
594 | newVNode.$flags$ |= (newVNode.$children$)
|
595 |
|
596 |
|
597 | ? 2
|
598 |
|
599 |
|
600 |
|
601 | : 1 ;
|
602 | }
|
603 | }
|
604 | if ( newVNode.$text$ !== null) {
|
605 |
|
606 | elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
607 | }
|
608 | else if ( newVNode.$flags$ & 1 ) {
|
609 |
|
610 | elm = newVNode.$elm$ = doc.createTextNode('');
|
611 | }
|
612 | else {
|
613 |
|
614 | elm = newVNode.$elm$ = ( doc.createElement(( newVNode.$flags$ & 2 ) ? 'slot-fb' : newVNode.$tag$));
|
615 |
|
616 | {
|
617 | updateElement(null, newVNode, isSvgMode);
|
618 | }
|
619 | if (newVNode.$children$) {
|
620 | for (i = 0; i < newVNode.$children$.length; ++i) {
|
621 |
|
622 | childNode = createElm(oldParentVNode, newVNode, i, elm);
|
623 |
|
624 | if (childNode) {
|
625 |
|
626 | elm.appendChild(childNode);
|
627 | }
|
628 | }
|
629 | }
|
630 | }
|
631 | {
|
632 | elm['s-hn'] = hostTagName;
|
633 | if (newVNode.$flags$ & (2 | 1 )) {
|
634 |
|
635 | elm['s-sr'] = true;
|
636 |
|
637 | elm['s-cr'] = contentRef;
|
638 |
|
639 | elm['s-sn'] = newVNode.$name$ || '';
|
640 |
|
641 | oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
642 | if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
|
643 |
|
644 |
|
645 | putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
646 | }
|
647 | }
|
648 | }
|
649 | return elm;
|
650 | };
|
651 | const putBackInOriginalLocation = (parentElm, recursive) => {
|
652 | plt.$flags$ |= 1 ;
|
653 | const oldSlotChildNodes = parentElm.childNodes;
|
654 | for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
655 | const childNode = oldSlotChildNodes[i];
|
656 | if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
|
657 |
|
658 |
|
659 |
|
660 |
|
661 | parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
|
662 |
|
663 |
|
664 |
|
665 | childNode['s-ol'].remove();
|
666 | childNode['s-ol'] = undefined;
|
667 | checkSlotRelocate = true;
|
668 | }
|
669 | if (recursive) {
|
670 | putBackInOriginalLocation(childNode, recursive);
|
671 | }
|
672 | }
|
673 | plt.$flags$ &= ~1 ;
|
674 | };
|
675 | const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
676 | let containerElm = (( parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
677 | let childNode;
|
678 | for (; startIdx <= endIdx; ++startIdx) {
|
679 | if (vnodes[startIdx]) {
|
680 | childNode = createElm(null, parentVNode, startIdx, parentElm);
|
681 | if (childNode) {
|
682 | vnodes[startIdx].$elm$ = childNode;
|
683 | containerElm.insertBefore(childNode, referenceNode(before) );
|
684 | }
|
685 | }
|
686 | }
|
687 | };
|
688 | const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
689 | for (; startIdx <= endIdx; ++startIdx) {
|
690 | if (vnode = vnodes[startIdx]) {
|
691 | elm = vnode.$elm$;
|
692 | {
|
693 |
|
694 |
|
695 | checkSlotFallbackVisibility = true;
|
696 | if (elm['s-ol']) {
|
697 |
|
698 | elm['s-ol'].remove();
|
699 | }
|
700 | else {
|
701 |
|
702 |
|
703 | putBackInOriginalLocation(elm, true);
|
704 | }
|
705 | }
|
706 |
|
707 | elm.remove();
|
708 | }
|
709 | }
|
710 | };
|
711 | const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
712 | let oldStartIdx = 0;
|
713 | let newStartIdx = 0;
|
714 | let oldEndIdx = oldCh.length - 1;
|
715 | let oldStartVnode = oldCh[0];
|
716 | let oldEndVnode = oldCh[oldEndIdx];
|
717 | let newEndIdx = newCh.length - 1;
|
718 | let newStartVnode = newCh[0];
|
719 | let newEndVnode = newCh[newEndIdx];
|
720 | let node;
|
721 | while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
722 | if (oldStartVnode == null) {
|
723 |
|
724 | oldStartVnode = oldCh[++oldStartIdx];
|
725 | }
|
726 | else if (oldEndVnode == null) {
|
727 | oldEndVnode = oldCh[--oldEndIdx];
|
728 | }
|
729 | else if (newStartVnode == null) {
|
730 | newStartVnode = newCh[++newStartIdx];
|
731 | }
|
732 | else if (newEndVnode == null) {
|
733 | newEndVnode = newCh[--newEndIdx];
|
734 | }
|
735 | else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
736 | patch(oldStartVnode, newStartVnode);
|
737 | oldStartVnode = oldCh[++oldStartIdx];
|
738 | newStartVnode = newCh[++newStartIdx];
|
739 | }
|
740 | else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
741 | patch(oldEndVnode, newEndVnode);
|
742 | oldEndVnode = oldCh[--oldEndIdx];
|
743 | newEndVnode = newCh[--newEndIdx];
|
744 | }
|
745 | else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
746 |
|
747 | if ( (oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
748 | putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
749 | }
|
750 | patch(oldStartVnode, newEndVnode);
|
751 | parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
752 | oldStartVnode = oldCh[++oldStartIdx];
|
753 | newEndVnode = newCh[--newEndIdx];
|
754 | }
|
755 | else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
756 |
|
757 | if ( (oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
758 | putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
759 | }
|
760 | patch(oldEndVnode, newStartVnode);
|
761 | parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
762 | oldEndVnode = oldCh[--oldEndIdx];
|
763 | newStartVnode = newCh[++newStartIdx];
|
764 | }
|
765 | else {
|
766 | {
|
767 |
|
768 | node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
769 | newStartVnode = newCh[++newStartIdx];
|
770 | }
|
771 | if (node) {
|
772 | {
|
773 | parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
774 | }
|
775 | }
|
776 | }
|
777 | }
|
778 | if (oldStartIdx > oldEndIdx) {
|
779 | addVnodes(parentElm, (newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$), newVNode, newCh, newStartIdx, newEndIdx);
|
780 | }
|
781 | else if ( newStartIdx > newEndIdx) {
|
782 | removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
783 | }
|
784 | };
|
785 | const isSameVnode = (vnode1, vnode2) => {
|
786 |
|
787 |
|
788 | if (vnode1.$tag$ === vnode2.$tag$) {
|
789 | if ( vnode1.$tag$ === 'slot') {
|
790 | return vnode1.$name$ === vnode2.$name$;
|
791 | }
|
792 | return true;
|
793 | }
|
794 | return false;
|
795 | };
|
796 | const referenceNode = (node) => {
|
797 |
|
798 |
|
799 |
|
800 |
|
801 | return (node && node['s-ol']) || node;
|
802 | };
|
803 | const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
804 | const patch = (oldVNode, newVNode) => {
|
805 | const elm = newVNode.$elm$ = oldVNode.$elm$;
|
806 | const oldChildren = oldVNode.$children$;
|
807 | const newChildren = newVNode.$children$;
|
808 | let defaultHolder;
|
809 | if ( newVNode.$text$ === null) {
|
810 |
|
811 | {
|
812 | if ( newVNode.$tag$ === 'slot')
|
813 | ;
|
814 | else {
|
815 |
|
816 |
|
817 |
|
818 | updateElement(oldVNode, newVNode, isSvgMode);
|
819 | }
|
820 | }
|
821 | if ( oldChildren !== null && newChildren !== null) {
|
822 |
|
823 | updateChildren(elm, oldChildren, newVNode, newChildren);
|
824 | }
|
825 | else if (newChildren !== null) {
|
826 |
|
827 | if ( oldVNode.$text$ !== null) {
|
828 |
|
829 | elm.textContent = '';
|
830 | }
|
831 |
|
832 | addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
|
833 | }
|
834 | else if ( oldChildren !== null) {
|
835 |
|
836 | removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
837 | }
|
838 | }
|
839 | else if ( (defaultHolder = elm['s-cr'])) {
|
840 |
|
841 | defaultHolder.parentNode.textContent = newVNode.$text$;
|
842 | }
|
843 | else if ( oldVNode.$text$ !== newVNode.$text$) {
|
844 |
|
845 |
|
846 | elm.data = newVNode.$text$;
|
847 | }
|
848 | };
|
849 | const updateFallbackSlotVisibility = (elm) => {
|
850 |
|
851 | let childNodes = elm.childNodes;
|
852 | let childNode;
|
853 | let i;
|
854 | let ilen;
|
855 | let j;
|
856 | let slotNameAttr;
|
857 | let nodeType;
|
858 | for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
859 | childNode = childNodes[i];
|
860 | if (childNode.nodeType === 1 ) {
|
861 | if (childNode['s-sr']) {
|
862 |
|
863 |
|
864 | slotNameAttr = childNode['s-sn'];
|
865 |
|
866 |
|
867 | childNode.hidden = false;
|
868 | for (j = 0; j < ilen; j++) {
|
869 | if (childNodes[j]['s-hn'] !== childNode['s-hn']) {
|
870 |
|
871 | nodeType = childNodes[j].nodeType;
|
872 | if (slotNameAttr !== '') {
|
873 |
|
874 | if (nodeType === 1 && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
875 | childNode.hidden = true;
|
876 | break;
|
877 | }
|
878 | }
|
879 | else {
|
880 |
|
881 |
|
882 |
|
883 | if (nodeType === 1 || (nodeType === 3 && childNodes[j].textContent.trim() !== '')) {
|
884 | childNode.hidden = true;
|
885 | break;
|
886 | }
|
887 | }
|
888 | }
|
889 | }
|
890 | }
|
891 |
|
892 | updateFallbackSlotVisibility(childNode);
|
893 | }
|
894 | }
|
895 | };
|
896 | const relocateNodes = [];
|
897 | const relocateSlotContent = (elm) => {
|
898 |
|
899 | let childNodes = elm.childNodes;
|
900 | let ilen = childNodes.length;
|
901 | let i = 0;
|
902 | let j = 0;
|
903 | let nodeType = 0;
|
904 | let childNode;
|
905 | let node;
|
906 | let hostContentNodes;
|
907 | let slotNameAttr;
|
908 | for (ilen = childNodes.length; i < ilen; i++) {
|
909 | childNode = childNodes[i];
|
910 | if (childNode['s-sr'] && (node = childNode['s-cr'])) {
|
911 |
|
912 |
|
913 | hostContentNodes = node.parentNode.childNodes;
|
914 | slotNameAttr = childNode['s-sn'];
|
915 | for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
916 | node = hostContentNodes[j];
|
917 | if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
|
918 |
|
919 |
|
920 |
|
921 | nodeType = node.nodeType;
|
922 | if (((nodeType === 3 || nodeType === 8 ) && slotNameAttr === '') ||
|
923 | (nodeType === 1 && node.getAttribute('slot') === null && slotNameAttr === '') ||
|
924 | (nodeType === 1 && node.getAttribute('slot') === slotNameAttr)) {
|
925 |
|
926 | if (!relocateNodes.some(r => r.$nodeToRelocate$ === node)) {
|
927 |
|
928 |
|
929 |
|
930 | checkSlotFallbackVisibility = true;
|
931 | node['s-sn'] = slotNameAttr;
|
932 |
|
933 | relocateNodes.push({
|
934 | $slotRefNode$: childNode,
|
935 | $nodeToRelocate$: node
|
936 | });
|
937 | }
|
938 | }
|
939 | }
|
940 | }
|
941 | }
|
942 | if (childNode.nodeType === 1 ) {
|
943 | relocateSlotContent(childNode);
|
944 | }
|
945 | }
|
946 | };
|
947 | const renderVdom = (hostElm, hostRef, cmpMeta, renderFnResults) => {
|
948 | hostTagName = hostElm.tagName;
|
949 | const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
950 | const rootVnode = isHost(renderFnResults)
|
951 | ? renderFnResults
|
952 | : h(null, null, renderFnResults);
|
953 | if ( cmpMeta.$attrsToReflect$) {
|
954 | rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
955 | cmpMeta.$attrsToReflect$.forEach(([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]);
|
956 | }
|
957 | rootVnode.$tag$ = null;
|
958 | rootVnode.$flags$ |= 4 ;
|
959 | hostRef.$vnode$ = rootVnode;
|
960 | rootVnode.$elm$ = oldVNode.$elm$ = ( hostElm);
|
961 | {
|
962 | contentRef = hostElm['s-cr'];
|
963 | useNativeShadowDom = supportsShadowDom ;
|
964 |
|
965 | checkSlotFallbackVisibility = false;
|
966 | }
|
967 |
|
968 | patch(oldVNode, rootVnode);
|
969 | {
|
970 | if (checkSlotRelocate) {
|
971 | relocateSlotContent(rootVnode.$elm$);
|
972 | for (let i = 0; i < relocateNodes.length; i++) {
|
973 | const relocateNode = relocateNodes[i];
|
974 | if (!relocateNode.$nodeToRelocate$['s-ol']) {
|
975 |
|
976 |
|
977 | const orgLocationNode = doc.createTextNode('');
|
978 | orgLocationNode['s-nr'] = relocateNode.$nodeToRelocate$;
|
979 | relocateNode.$nodeToRelocate$.parentNode.insertBefore((relocateNode.$nodeToRelocate$['s-ol'] = orgLocationNode), relocateNode.$nodeToRelocate$);
|
980 | }
|
981 | }
|
982 |
|
983 |
|
984 | plt.$flags$ |= 1 ;
|
985 | for (let i = 0; i < relocateNodes.length; i++) {
|
986 | const relocateNode = relocateNodes[i];
|
987 |
|
988 |
|
989 | const parentNodeRef = relocateNode.$slotRefNode$.parentNode;
|
990 | let insertBeforeNode = relocateNode.$slotRefNode$.nextSibling;
|
991 | let orgLocationNode = relocateNode.$nodeToRelocate$['s-ol'];
|
992 | while (orgLocationNode = orgLocationNode.previousSibling) {
|
993 | let refNode = orgLocationNode['s-nr'];
|
994 | if (refNode &&
|
995 | refNode['s-sn'] === relocateNode.$nodeToRelocate$['s-sn'] &&
|
996 | parentNodeRef === refNode.parentNode) {
|
997 | refNode = refNode.nextSibling;
|
998 | if (!refNode || !refNode['s-nr']) {
|
999 | insertBeforeNode = refNode;
|
1000 | break;
|
1001 | }
|
1002 | }
|
1003 | }
|
1004 | if ((!insertBeforeNode && parentNodeRef !== relocateNode.$nodeToRelocate$.parentNode) ||
|
1005 | (relocateNode.$nodeToRelocate$.nextSibling !== insertBeforeNode)) {
|
1006 |
|
1007 |
|
1008 |
|
1009 | if (relocateNode.$nodeToRelocate$ !== insertBeforeNode) {
|
1010 |
|
1011 | parentNodeRef.insertBefore(relocateNode.$nodeToRelocate$, insertBeforeNode);
|
1012 | }
|
1013 | }
|
1014 | }
|
1015 |
|
1016 |
|
1017 | plt.$flags$ &= ~1 ;
|
1018 | }
|
1019 | if (checkSlotFallbackVisibility) {
|
1020 | updateFallbackSlotVisibility(rootVnode.$elm$);
|
1021 | }
|
1022 |
|
1023 | relocateNodes.length = 0;
|
1024 | }
|
1025 | };
|
1026 | const attachToAncestor = (hostRef, ancestorComponent) => {
|
1027 | if ( ancestorComponent && !hostRef.$onRenderResolve$) {
|
1028 | ancestorComponent['s-p'].push(new Promise(r => hostRef.$onRenderResolve$ = r));
|
1029 | }
|
1030 | };
|
1031 | const scheduleUpdate = (elm, hostRef, cmpMeta, isInitialLoad) => {
|
1032 | {
|
1033 | hostRef.$flags$ |= 16 ;
|
1034 | }
|
1035 | if ( hostRef.$flags$ & 4 ) {
|
1036 | hostRef.$flags$ |= 512 ;
|
1037 | return;
|
1038 | }
|
1039 | const endSchedule = createTime('scheduleUpdate', cmpMeta.$tagName$);
|
1040 | const ancestorComponent = hostRef.$ancestorComponent$;
|
1041 | const instance = hostRef.$lazyInstance$ ;
|
1042 | const update = () => updateComponent(elm, hostRef, cmpMeta, instance, isInitialLoad);
|
1043 | attachToAncestor(hostRef, ancestorComponent);
|
1044 | let promise;
|
1045 | endSchedule();
|
1046 |
|
1047 |
|
1048 |
|
1049 | return then(promise, () => writeTask(update)
|
1050 | );
|
1051 | };
|
1052 | const updateComponent = (elm, hostRef, cmpMeta, instance, isInitialLoad) => {
|
1053 |
|
1054 | const endUpdate = createTime('update', cmpMeta.$tagName$);
|
1055 | const rc = elm['s-rc'];
|
1056 | if ( isInitialLoad) {
|
1057 |
|
1058 | attachStyles(elm, cmpMeta, hostRef.$modeName$);
|
1059 | }
|
1060 | const endRender = createTime('render', cmpMeta.$tagName$);
|
1061 | {
|
1062 | {
|
1063 | try {
|
1064 |
|
1065 |
|
1066 |
|
1067 | renderVdom(elm, hostRef, cmpMeta, instance.render() );
|
1068 | }
|
1069 | catch (e) {
|
1070 | consoleError(e);
|
1071 | }
|
1072 | }
|
1073 | }
|
1074 | if ( plt.$cssShim$) {
|
1075 | plt.$cssShim$.updateHost(elm);
|
1076 | }
|
1077 | {
|
1078 | hostRef.$flags$ &= ~16 ;
|
1079 | }
|
1080 | {
|
1081 | hostRef.$flags$ |= 2 ;
|
1082 | }
|
1083 | if ( rc) {
|
1084 |
|
1085 |
|
1086 |
|
1087 | rc.forEach(cb => cb());
|
1088 | elm['s-rc'] = undefined;
|
1089 | }
|
1090 | endRender();
|
1091 | endUpdate();
|
1092 | {
|
1093 | const childrenPromises = elm['s-p'];
|
1094 | const postUpdate = () => postUpdateComponent(elm, hostRef, cmpMeta);
|
1095 | if (childrenPromises.length === 0) {
|
1096 | postUpdate();
|
1097 | }
|
1098 | else {
|
1099 | Promise.all(childrenPromises).then(postUpdate);
|
1100 | hostRef.$flags$ |= 4 ;
|
1101 | childrenPromises.length = 0;
|
1102 | }
|
1103 | }
|
1104 | };
|
1105 | const postUpdateComponent = (elm, hostRef, cmpMeta) => {
|
1106 | const endPostUpdate = createTime('postUpdate', cmpMeta.$tagName$);
|
1107 | const ancestorComponent = hostRef.$ancestorComponent$;
|
1108 | if (!(hostRef.$flags$ & 64 )) {
|
1109 | hostRef.$flags$ |= 64 ;
|
1110 | {
|
1111 |
|
1112 |
|
1113 | elm.classList.add(HYDRATED_CLASS);
|
1114 | }
|
1115 | endPostUpdate();
|
1116 | {
|
1117 | hostRef.$onReadyResolve$(elm);
|
1118 | if (!ancestorComponent) {
|
1119 | appDidLoad();
|
1120 | }
|
1121 | }
|
1122 | }
|
1123 | else {
|
1124 | endPostUpdate();
|
1125 | }
|
1126 |
|
1127 |
|
1128 | {
|
1129 | if (hostRef.$onRenderResolve$) {
|
1130 | hostRef.$onRenderResolve$();
|
1131 | hostRef.$onRenderResolve$ = undefined;
|
1132 | }
|
1133 | if (hostRef.$flags$ & 512 ) {
|
1134 | nextTick(() => scheduleUpdate(elm, hostRef, cmpMeta, false));
|
1135 | }
|
1136 | hostRef.$flags$ &= ~(4 | 512 );
|
1137 | }
|
1138 |
|
1139 |
|
1140 |
|
1141 | };
|
1142 | const forceUpdate = (elm, cmpMeta) => {
|
1143 | {
|
1144 | const hostRef = getHostRef(elm);
|
1145 | if ((hostRef.$flags$ & (2 | 16 )) === 2 ) {
|
1146 | scheduleUpdate(elm, hostRef, cmpMeta, false);
|
1147 | }
|
1148 | }
|
1149 | };
|
1150 | const appDidLoad = (who) => {
|
1151 |
|
1152 |
|
1153 | {
|
1154 | doc.documentElement.classList.add(HYDRATED_CLASS);
|
1155 | }
|
1156 | {
|
1157 | plt.$flags$ |= 2 ;
|
1158 | }
|
1159 | };
|
1160 | const then = (promise, thenFn) => {
|
1161 | return promise && promise.then ? promise.then(thenFn) : thenFn();
|
1162 | };
|
1163 | const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
1164 | const setValue = (ref, propName, newVal, cmpMeta) => {
|
1165 |
|
1166 | const hostRef = getHostRef(ref);
|
1167 | const elm = hostRef.$hostElement$ ;
|
1168 | const oldVal = hostRef.$instanceValues$.get(propName);
|
1169 | const flags = hostRef.$flags$;
|
1170 | const instance = hostRef.$lazyInstance$ ;
|
1171 | newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
1172 | if (newVal !== oldVal && ( !(flags & 8 /* isConstructingInstance */) || oldVal === undefined)) {
|
1173 |
|
1174 |
|
1175 | hostRef.$instanceValues$.set(propName, newVal);
|
1176 | if ( instance) {
|
1177 | if ( (flags & (2 | 16 )) === 2 ) {
|
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 | scheduleUpdate(elm, hostRef, cmpMeta, false);
|
1183 | }
|
1184 | }
|
1185 | }
|
1186 | };
|
1187 | const proxyComponent = (Cstr, cmpMeta, flags) => {
|
1188 | if ( cmpMeta.$members$) {
|
1189 |
|
1190 | const members = Object.entries(cmpMeta.$members$);
|
1191 | const prototype = Cstr.prototype;
|
1192 | members.forEach(([memberName, [memberFlags]]) => {
|
1193 | if ( ((memberFlags & 31 ) ||
|
1194 | (( flags & 2 ) &&
|
1195 | (memberFlags & 32 )))) {
|
1196 |
|
1197 | Object.defineProperty(prototype, memberName, {
|
1198 | get() {
|
1199 |
|
1200 | return getValue(this, memberName);
|
1201 | },
|
1202 | set(newValue) {
|
1203 |
|
1204 | setValue(this, memberName, newValue, cmpMeta);
|
1205 | },
|
1206 | configurable: true,
|
1207 | enumerable: true
|
1208 | });
|
1209 | }
|
1210 | });
|
1211 | if ( ( flags & 1 )) {
|
1212 | const attrNameToPropName = new Map();
|
1213 | prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
1214 | plt.jmp(() => {
|
1215 | const propName = attrNameToPropName.get(attrName);
|
1216 | this[propName] = newValue === null && typeof this[propName] === 'boolean'
|
1217 | ? false
|
1218 | : newValue;
|
1219 | });
|
1220 | };
|
1221 |
|
1222 |
|
1223 | Cstr.observedAttributes = members
|
1224 | .filter(([_, m]) => m[0] & 15 )
|
1225 | .map(([propName, m]) => {
|
1226 | const attrName = m[1] || propName;
|
1227 | attrNameToPropName.set(attrName, propName);
|
1228 | if ( m[0] & 512 ) {
|
1229 | cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
1230 | }
|
1231 | return attrName;
|
1232 | });
|
1233 | }
|
1234 | }
|
1235 | return Cstr;
|
1236 | };
|
1237 | const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
1238 | const endHydrate = createTime('hydrateClient', tagName);
|
1239 | const shadowRoot = hostElm.shadowRoot;
|
1240 | const childRenderNodes = [];
|
1241 | const slotNodes = [];
|
1242 | const shadowRootNodes = ( null);
|
1243 | const vnode = hostRef.$vnode$ = newVNode(tagName, null);
|
1244 | if (!plt.$orgLocNodes$) {
|
1245 | initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = new Map());
|
1246 | }
|
1247 | hostElm[HYDRATE_ID] = hostId;
|
1248 | hostElm.removeAttribute(HYDRATE_ID);
|
1249 | clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
|
1250 | childRenderNodes.forEach(c => {
|
1251 | const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
|
1252 | const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
|
1253 | const node = c.$elm$;
|
1254 | if (orgLocationNode && (orgLocationNode['s-sd'] || c.$hostId$ === '0')) {
|
1255 | orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
|
1256 | }
|
1257 | if (!shadowRoot) {
|
1258 | node['s-hn'] = tagName;
|
1259 | if (orgLocationNode) {
|
1260 | node['s-ol'] = orgLocationNode;
|
1261 | node['s-ol']['s-nr'] = node;
|
1262 | }
|
1263 | }
|
1264 | plt.$orgLocNodes$.delete(orgLocationId);
|
1265 | });
|
1266 | endHydrate();
|
1267 | };
|
1268 | const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
|
1269 | let childNodeType;
|
1270 | let childIdSplt;
|
1271 | let childVNode;
|
1272 | let i;
|
1273 | if (node.nodeType === 1 ) {
|
1274 | childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
|
1275 | if (childNodeType) {
|
1276 |
|
1277 |
|
1278 | childIdSplt = childNodeType.split('.');
|
1279 | if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
|
1280 | childVNode = {
|
1281 | $flags$: 0,
|
1282 | $hostId$: childIdSplt[0],
|
1283 | $nodeId$: childIdSplt[1],
|
1284 | $depth$: childIdSplt[2],
|
1285 | $index$: childIdSplt[3],
|
1286 | $tag$: node.tagName.toLowerCase(),
|
1287 | $elm$: node,
|
1288 | $attrs$: null,
|
1289 | $children$: null,
|
1290 | $key$: null,
|
1291 | $name$: null,
|
1292 | $text$: null
|
1293 | };
|
1294 | childRenderNodes.push(childVNode);
|
1295 | node.removeAttribute(HYDRATE_CHILD_ID);
|
1296 |
|
1297 |
|
1298 | if (!parentVNode.$children$) {
|
1299 | parentVNode.$children$ = [];
|
1300 | }
|
1301 |
|
1302 | parentVNode.$children$[childVNode.$index$] = childVNode;
|
1303 |
|
1304 | parentVNode = childVNode;
|
1305 | if (shadowRootNodes && childVNode.$depth$ === '0') {
|
1306 | shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
1307 | }
|
1308 | }
|
1309 | }
|
1310 |
|
1311 | for (i = node.childNodes.length - 1; i >= 0; i--) {
|
1312 | clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
|
1313 | }
|
1314 | if (node.shadowRoot) {
|
1315 |
|
1316 | for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
|
1317 | clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
|
1318 | }
|
1319 | }
|
1320 | }
|
1321 | else if (node.nodeType === 8 ) {
|
1322 |
|
1323 | childIdSplt = node.nodeValue.split('.');
|
1324 | if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
|
1325 |
|
1326 | childNodeType = childIdSplt[0];
|
1327 | childVNode = {
|
1328 | $flags$: 0,
|
1329 | $hostId$: childIdSplt[1],
|
1330 | $nodeId$: childIdSplt[2],
|
1331 | $depth$: childIdSplt[3],
|
1332 | $index$: childIdSplt[4],
|
1333 | $elm$: node,
|
1334 | $attrs$: null,
|
1335 | $children$: null,
|
1336 | $key$: null,
|
1337 | $name$: null,
|
1338 | $tag$: null,
|
1339 | $text$: null
|
1340 | };
|
1341 | if (childNodeType === TEXT_NODE_ID) {
|
1342 | childVNode.$elm$ = node.nextSibling;
|
1343 | if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 ) {
|
1344 | childVNode.$text$ = childVNode.$elm$.textContent;
|
1345 | childRenderNodes.push(childVNode);
|
1346 |
|
1347 | node.remove();
|
1348 | if (!parentVNode.$children$) {
|
1349 | parentVNode.$children$ = [];
|
1350 | }
|
1351 | parentVNode.$children$[childVNode.$index$] = childVNode;
|
1352 | if (shadowRootNodes && childVNode.$depth$ === '0') {
|
1353 | shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
1354 | }
|
1355 | }
|
1356 | }
|
1357 | else if (childVNode.$hostId$ === hostId) {
|
1358 |
|
1359 | if (childNodeType === SLOT_NODE_ID) {
|
1360 |
|
1361 | childVNode.$tag$ = 'slot';
|
1362 | if (childIdSplt[5]) {
|
1363 | node['s-sn'] = childVNode.$name$ = childIdSplt[5];
|
1364 | }
|
1365 | else {
|
1366 | node['s-sn'] = '';
|
1367 | }
|
1368 | node['s-sr'] = true;
|
1369 | slotNodes.push(childVNode);
|
1370 | if (!parentVNode.$children$) {
|
1371 | parentVNode.$children$ = [];
|
1372 | }
|
1373 | parentVNode.$children$[childVNode.$index$] = childVNode;
|
1374 | }
|
1375 | else if (childNodeType === CONTENT_REF_ID) {
|
1376 |
|
1377 | {
|
1378 | hostElm['s-cr'] = node;
|
1379 | node['s-cn'] = true;
|
1380 | }
|
1381 | }
|
1382 | }
|
1383 | }
|
1384 | }
|
1385 | else if (parentVNode && parentVNode.$tag$ === 'style') {
|
1386 | const vnode = newVNode(null, node.textContent);
|
1387 | vnode.$elm$ = node;
|
1388 | vnode.$index$ = '0';
|
1389 | parentVNode.$children$ = [vnode];
|
1390 | }
|
1391 | };
|
1392 | const initializeDocumentHydrate = (node, orgLocNodes) => {
|
1393 | if (node.nodeType === 1 ) {
|
1394 | let i = 0;
|
1395 | for (; i < node.childNodes.length; i++) {
|
1396 | initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
|
1397 | }
|
1398 | if (node.shadowRoot) {
|
1399 | for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
|
1400 | initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
|
1401 | }
|
1402 | }
|
1403 | }
|
1404 | else if (node.nodeType === 8 ) {
|
1405 | const childIdSplt = node.nodeValue.split('.');
|
1406 | if (childIdSplt[0] === ORG_LOCATION_ID) {
|
1407 | orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
|
1408 | node.nodeValue = '';
|
1409 |
|
1410 |
|
1411 | node['s-sd'] = (childIdSplt[3] === '');
|
1412 | }
|
1413 | }
|
1414 | };
|
1415 | const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
1416 |
|
1417 | if ( (hostRef.$flags$ & 32 ) === 0) {
|
1418 |
|
1419 | hostRef.$flags$ |= 32 ;
|
1420 | {
|
1421 |
|
1422 |
|
1423 |
|
1424 | Cstr = loadModule(cmpMeta);
|
1425 | if (Cstr.then) {
|
1426 |
|
1427 | const endLoad = uniqueTime();
|
1428 | Cstr = await Cstr;
|
1429 | endLoad();
|
1430 | }
|
1431 | if ( !Cstr.isProxied) {
|
1432 | proxyComponent(Cstr, cmpMeta, 2 );
|
1433 | Cstr.isProxied = true;
|
1434 | }
|
1435 | const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
1436 |
|
1437 |
|
1438 |
|
1439 | {
|
1440 | hostRef.$flags$ |= 8 ;
|
1441 | }
|
1442 |
|
1443 |
|
1444 |
|
1445 |
|
1446 | try {
|
1447 | new Cstr(hostRef);
|
1448 | }
|
1449 | catch (e) {
|
1450 | consoleError(e);
|
1451 | }
|
1452 | {
|
1453 | hostRef.$flags$ &= ~8 ;
|
1454 | }
|
1455 | endNewInstance();
|
1456 | }
|
1457 | const scopeId = getScopeId(cmpMeta.$tagName$);
|
1458 | if ( !styles.has(scopeId) && Cstr.style) {
|
1459 | const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
1460 |
|
1461 | let style = Cstr.style;
|
1462 | registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 ));
|
1463 | endRegisterStyles();
|
1464 | }
|
1465 | }
|
1466 |
|
1467 | const ancestorComponent = hostRef.$ancestorComponent$;
|
1468 | const schedule = () => scheduleUpdate(elm, hostRef, cmpMeta, true);
|
1469 | if ( ancestorComponent && ancestorComponent['s-rc']) {
|
1470 |
|
1471 |
|
1472 |
|
1473 |
|
1474 |
|
1475 |
|
1476 | ancestorComponent['s-rc'].push(schedule);
|
1477 | }
|
1478 | else {
|
1479 | schedule();
|
1480 | }
|
1481 | };
|
1482 | const connectedCallback = (elm, cmpMeta) => {
|
1483 | if ((plt.$flags$ & 1 ) === 0) {
|
1484 | const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
1485 |
|
1486 | const hostRef = getHostRef(elm);
|
1487 | if (!(hostRef.$flags$ & 1 )) {
|
1488 |
|
1489 | hostRef.$flags$ |= 1 ;
|
1490 | let hostId;
|
1491 | {
|
1492 | hostId = elm.getAttribute(HYDRATE_ID);
|
1493 | if (hostId) {
|
1494 | initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
1495 | }
|
1496 | }
|
1497 | if ( !hostId) {
|
1498 |
|
1499 |
|
1500 |
|
1501 |
|
1502 | if (
|
1503 | ( cmpMeta.$flags$ & 4 ) ||
|
1504 | (BUILD.shadowDom )) {
|
1505 | setContentReference(elm);
|
1506 | }
|
1507 | }
|
1508 | {
|
1509 |
|
1510 |
|
1511 | let ancestorComponent = elm;
|
1512 | while ((ancestorComponent = (ancestorComponent.parentNode || ancestorComponent.host))) {
|
1513 |
|
1514 |
|
1515 | if (( ancestorComponent.nodeType === 1 && ancestorComponent.hasAttribute('s-id')) ||
|
1516 | (ancestorComponent['s-p'])) {
|
1517 |
|
1518 |
|
1519 | attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
1520 | break;
|
1521 | }
|
1522 | }
|
1523 | }
|
1524 |
|
1525 |
|
1526 | if ( cmpMeta.$members$) {
|
1527 | Object.entries(cmpMeta.$members$).forEach(([memberName, [memberFlags]]) => {
|
1528 | if (memberFlags & 31 && elm.hasOwnProperty(memberName)) {
|
1529 | const value = elm[memberName];
|
1530 | delete elm[memberName];
|
1531 | elm[memberName] = value;
|
1532 | }
|
1533 | });
|
1534 | }
|
1535 | {
|
1536 |
|
1537 |
|
1538 |
|
1539 |
|
1540 | nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
|
1541 | }
|
1542 | }
|
1543 | endConnected();
|
1544 | }
|
1545 | };
|
1546 | const setContentReference = (elm) => {
|
1547 |
|
1548 |
|
1549 |
|
1550 |
|
1551 |
|
1552 |
|
1553 | const crName = '';
|
1554 | const contentRefElm = elm['s-cr'] = doc.createComment(crName);
|
1555 | contentRefElm['s-cn'] = true;
|
1556 | elm.insertBefore(contentRefElm, elm.firstChild);
|
1557 | };
|
1558 | const disconnectedCallback = (elm) => {
|
1559 | if ((plt.$flags$ & 1 ) === 0) {
|
1560 | const hostRef = getHostRef(elm);
|
1561 |
|
1562 | if ( plt.$cssShim$) {
|
1563 | plt.$cssShim$.removeHost(elm);
|
1564 | }
|
1565 | }
|
1566 | };
|
1567 | const bootstrapLazy = (lazyBundles, options = {}) => {
|
1568 | const endBootstrap = createTime();
|
1569 | const cmpTags = [];
|
1570 | const exclude = options.exclude || [];
|
1571 | const head = doc.head;
|
1572 | const customElements = win.customElements;
|
1573 | const y = head.querySelector('meta[charset]');
|
1574 | const visibilityStyle = doc.createElement('style');
|
1575 | const deferredConnectedCallbacks = [];
|
1576 | let appLoadFallback;
|
1577 | let isBootstrapping = true;
|
1578 | Object.assign(plt, options);
|
1579 | plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
1580 | if (options.syncQueue) {
|
1581 | plt.$flags$ |= 4 ;
|
1582 | }
|
1583 | {
|
1584 |
|
1585 |
|
1586 | plt.$flags$ |= 2 ;
|
1587 | }
|
1588 | lazyBundles.forEach(lazyBundle => lazyBundle[1].forEach(compactMeta => {
|
1589 | const cmpMeta = {
|
1590 | $flags$: compactMeta[0],
|
1591 | $tagName$: compactMeta[1],
|
1592 | $members$: compactMeta[2],
|
1593 | $listeners$: compactMeta[3],
|
1594 | };
|
1595 | {
|
1596 | cmpMeta.$members$ = compactMeta[2];
|
1597 | }
|
1598 | {
|
1599 | cmpMeta.$attrsToReflect$ = [];
|
1600 | }
|
1601 | const tagName = cmpMeta.$tagName$;
|
1602 | const HostElement = class extends HTMLElement {
|
1603 |
|
1604 | constructor(self) {
|
1605 |
|
1606 | super(self);
|
1607 | self = this;
|
1608 | registerHost(self);
|
1609 | }
|
1610 | connectedCallback() {
|
1611 | if (appLoadFallback) {
|
1612 | clearTimeout(appLoadFallback);
|
1613 | appLoadFallback = null;
|
1614 | }
|
1615 | if (isBootstrapping) {
|
1616 |
|
1617 | deferredConnectedCallbacks.push(this);
|
1618 | }
|
1619 | else {
|
1620 | plt.jmp(() => connectedCallback(this, cmpMeta));
|
1621 | }
|
1622 | }
|
1623 | disconnectedCallback() {
|
1624 | plt.jmp(() => disconnectedCallback(this));
|
1625 | }
|
1626 | 's-hmr'(hmrVersionId) {
|
1627 | }
|
1628 | forceUpdate() {
|
1629 | forceUpdate(this, cmpMeta);
|
1630 | }
|
1631 | componentOnReady() {
|
1632 | return getHostRef(this).$onReadyPromise$;
|
1633 | }
|
1634 | };
|
1635 | cmpMeta.$lazyBundleIds$ = lazyBundle[0];
|
1636 | if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
1637 | cmpTags.push(tagName);
|
1638 | customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 ));
|
1639 | }
|
1640 | }));
|
1641 |
|
1642 | visibilityStyle.innerHTML = cmpTags + '{visibility:hidden}.hydrated{visibility:inherit}';
|
1643 | visibilityStyle.setAttribute('data-styles', '');
|
1644 | head.insertBefore(visibilityStyle, y ? y.nextSibling : head.firstChild);
|
1645 |
|
1646 | isBootstrapping = false;
|
1647 | if (deferredConnectedCallbacks.length > 0) {
|
1648 | deferredConnectedCallbacks.forEach(host => host.connectedCallback());
|
1649 | }
|
1650 | else {
|
1651 | plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30, 'timeout'));
|
1652 | }
|
1653 |
|
1654 | endBootstrap();
|
1655 | };
|
1656 |
|
1657 | exports.Host = Host;
|
1658 | exports.bootstrapLazy = bootstrapLazy;
|
1659 | exports.h = h;
|
1660 | exports.patchBrowser = patchBrowser;
|
1661 | exports.patchEsm = patchEsm;
|
1662 | exports.registerInstance = registerInstance;
|