1 | 'use strict';
|
2 |
|
3 | const index = require('./index-13dd6f26.js');
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | const noop = () => {
|
9 |
|
10 | };
|
11 | const IS_DENO_ENV = typeof Deno !== 'undefined';
|
12 | const IS_NODE_ENV = !IS_DENO_ENV &&
|
13 | typeof global !== 'undefined' &&
|
14 | typeof require === 'function' &&
|
15 | !!global.process &&
|
16 | typeof __filename === 'string' &&
|
17 | (!global.origin || typeof global.origin !== 'string');
|
18 | const IS_DENO_WINDOWS_ENV = IS_DENO_ENV && Deno.build.os === 'windows';
|
19 | const getCurrentDirectory = IS_NODE_ENV ? process.cwd : IS_DENO_ENV ? Deno.cwd : () => '/';
|
20 | const exit = IS_NODE_ENV ? process.exit : IS_DENO_ENV ? Deno.exit : noop;
|
21 | const getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\s|-/g, '_')}`;
|
22 | const patchEsm = () => {
|
23 |
|
24 |
|
25 | if (index.BUILD.cssVarShim && !(index.CSS && index.CSS.supports && index.CSS.supports('color', 'var(--c)'))) {
|
26 |
|
27 | return Promise.resolve().then(function () { return require( './css-shim-d42fc40a.js'); }).then(() => {
|
28 | if ((index.plt.$cssShim$ = index.win.__cssshim)) {
|
29 | return index.plt.$cssShim$.i();
|
30 | }
|
31 | else {
|
32 |
|
33 | return 0;
|
34 | }
|
35 | });
|
36 | }
|
37 | return index.promiseResolve();
|
38 | };
|
39 | const patchBrowser = () => {
|
40 |
|
41 | if (index.BUILD.isDev && !index.BUILD.isTesting) {
|
42 | index.consoleDevInfo('Running in development mode.');
|
43 | }
|
44 | if (index.BUILD.cssVarShim) {
|
45 |
|
46 | index.plt.$cssShim$ = index.win.__cssshim;
|
47 | }
|
48 | if (index.BUILD.cloneNodeFix) {
|
49 |
|
50 | patchCloneNodeFix(index.H.prototype);
|
51 | }
|
52 | if (index.BUILD.profile && !performance.mark) {
|
53 |
|
54 | performance.mark = performance.measure = () => {
|
55 |
|
56 | };
|
57 | performance.getEntriesByName = () => [];
|
58 | }
|
59 |
|
60 | const scriptElm = index.BUILD.scriptDataOpts || index.BUILD.safari10 || index.BUILD.dynamicImportShim
|
61 | ? Array.from(index.doc.querySelectorAll('script')).find(s => new RegExp(`\/${index.NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) || s.getAttribute('data-stencil-namespace') === index.NAMESPACE)
|
62 | : null;
|
63 | const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('app-globals-cce8b566.js', document.baseURI).href));
|
64 | const opts = index.BUILD.scriptDataOpts ? scriptElm['data-opts'] || {} : {};
|
65 | if (index.BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration ) {
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 | return {
|
74 | then() {
|
75 |
|
76 | },
|
77 | };
|
78 | }
|
79 | if (!index.BUILD.safari10 && importMeta !== '') {
|
80 | opts.resourcesUrl = new URL('.', importMeta).href;
|
81 | }
|
82 | else if (index.BUILD.dynamicImportShim || index.BUILD.safari10) {
|
83 | opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, index.win.location.href)).href;
|
84 | if (index.BUILD.dynamicImportShim) {
|
85 | patchDynamicImport(opts.resourcesUrl, scriptElm);
|
86 | }
|
87 | if (index.BUILD.dynamicImportShim && !index.win.customElements) {
|
88 |
|
89 |
|
90 | return Promise.resolve().then(function () { return require( './dom-05038921.js'); }).then(() => opts);
|
91 | }
|
92 | }
|
93 | return index.promiseResolve(opts);
|
94 | };
|
95 | const patchDynamicImport = (base, orgScriptElm) => {
|
96 | const importFunctionName = getDynamicImportFunction(index.NAMESPACE);
|
97 | try {
|
98 |
|
99 |
|
100 |
|
101 |
|
102 | index.win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);
|
103 | }
|
104 | catch (e) {
|
105 |
|
106 |
|
107 |
|
108 | const moduleMap = new Map();
|
109 | index.win[importFunctionName] = (src) => {
|
110 | const url = new URL(src, base).href;
|
111 | let mod = moduleMap.get(url);
|
112 | if (!mod) {
|
113 | const script = index.doc.createElement('script');
|
114 | script.type = 'module';
|
115 | script.crossOrigin = orgScriptElm.crossOrigin;
|
116 | script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], { type: 'application/javascript' }));
|
117 | mod = new Promise(resolve => {
|
118 | script.onload = () => {
|
119 | resolve(index.win[importFunctionName].m);
|
120 | script.remove();
|
121 | };
|
122 | });
|
123 | moduleMap.set(url, mod);
|
124 | index.doc.head.appendChild(script);
|
125 | }
|
126 | return mod;
|
127 | };
|
128 | }
|
129 | };
|
130 | const patchCloneNodeFix = (HTMLElementPrototype) => {
|
131 | const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;
|
132 | HTMLElementPrototype.cloneNode = function (deep) {
|
133 | if (this.nodeName === 'TEMPLATE') {
|
134 | return nativeCloneNodeFn.call(this, deep);
|
135 | }
|
136 | const clonedNode = nativeCloneNodeFn.call(this, false);
|
137 | const srcChildNodes = this.childNodes;
|
138 | if (deep) {
|
139 | for (let i = 0; i < srcChildNodes.length; i++) {
|
140 |
|
141 | if (srcChildNodes[i].nodeType !== 2) {
|
142 | clonedNode.appendChild(srcChildNodes[i].cloneNode(true));
|
143 | }
|
144 | }
|
145 | }
|
146 | return clonedNode;
|
147 | };
|
148 | };
|
149 |
|
150 | const globalScripts = () => {};
|
151 |
|
152 | exports.globalScripts = globalScripts;
|
153 | exports.patchBrowser = patchBrowser;
|
154 | exports.patchEsm = patchEsm;
|