@lwrjs/loader 0.19.0-alpha.9 → 0.19.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.
@@ -4,5 +4,5 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
6
  */
7
- /* LWR Error Shim v0.19.0-alpha.9 */
7
+ /* LWR Error Shim v0.19.1 */
8
8
  !function(){"use strict";const o=globalThis;if(!(o.LWR&&o.LWR.define)){const r=new Error("The LWR application failed to bootstrap");if(!o.LWR||!o.LWR.onError)throw r;o.LWR.onError(r)}}();
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
6
  */
7
- /* LWR Legacy Module Loader Shim v0.19.0-alpha.9 */
7
+ /* LWR Legacy Module Loader Shim v0.19.1 */
8
8
  (function () {
9
9
  'use strict';
10
10
 
@@ -210,7 +210,7 @@
210
210
  // Parse configuration
211
211
  this.global = global;
212
212
  this.config = global.LWR ;
213
- this.loaderModule = 'lwr/loaderLegacy/v/0_19_0-alpha_9';
213
+ this.loaderModule = 'lwr/loaderLegacy/v/0_19_1';
214
214
 
215
215
  // Set up error handler
216
216
  this.errorHandler = this.config.onError ;
@@ -313,7 +313,7 @@
313
313
  hasProcess &&
314
314
  hasConsole &&
315
315
  // eslint-disable-next-line lwr/no-unguarded-apis
316
- process.env.NODE_ENV !== 'production'
316
+ "development" !== 'production'
317
317
  ) {
318
318
  this.logWarnings(loader.getModuleWarnings(true)); // the true indicates the app is mounted
319
319
  }
@@ -360,7 +360,7 @@
360
360
  const exporter = (exports) => {
361
361
  Object.assign(exports, { logOperationStart, logOperationEnd });
362
362
  };
363
- define('lwr/profiler/v/0_19_0-alpha_9', ['exports'], exporter, {});
363
+ define('lwr/profiler/v/0_19_1', ['exports'], exporter, {});
364
364
  }
365
365
 
366
366
  // Set up the application globals, import map, root custom element...
@@ -447,14 +447,14 @@
447
447
  // The loader module is ALWAYS required
448
448
  const GLOBAL = globalThis ;
449
449
  GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
450
- if (GLOBAL.LWR.requiredModules.indexOf('lwr/loaderLegacy/v/0_19_0-alpha_9') < 0) {
451
- GLOBAL.LWR.requiredModules.push('lwr/loaderLegacy/v/0_19_0-alpha_9');
450
+ if (GLOBAL.LWR.requiredModules.indexOf('lwr/loaderLegacy/v/0_19_1') < 0) {
451
+ GLOBAL.LWR.requiredModules.push('lwr/loaderLegacy/v/0_19_1');
452
452
  }
453
453
  new LoaderShim(GLOBAL);
454
454
 
455
455
  })();
456
456
 
457
- LWR.define('lwr/loaderLegacy/v/0_19_0-alpha_9', ['exports'], (function (exports) { 'use strict';
457
+ LWR.define('lwr/loaderLegacy/v/0_19_1', ['exports'], (function (exports) { 'use strict';
458
458
 
459
459
  const templateRegex = /\{([0-9]+)\}/g;
460
460
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -874,7 +874,7 @@ LWR.define('lwr/loaderLegacy/v/0_19_0-alpha_9', ['exports'], (function (exports)
874
874
  }
875
875
 
876
876
  // eslint-disable-next-line lwr/no-unguarded-apis
877
- if (process.env.NODE_ENV !== 'production') {
877
+ {
878
878
  if (!hasSetTimeout && hasConsole) {
879
879
  // eslint-disable-next-line lwr/no-unguarded-apis
880
880
  console.warn('setTimeout API is not available, watchdog timer on load hook will not be set');
@@ -934,7 +934,7 @@ LWR.define('lwr/loaderLegacy/v/0_19_0-alpha_9', ['exports'], (function (exports)
934
934
  eval(trusted.createScript(code) );
935
935
  } catch (e) {
936
936
  // eslint-disable-next-line lwr/no-unguarded-apis
937
- if (process.env.NODE_ENV !== 'production' && hasConsole) {
937
+ if (hasConsole) {
938
938
  // eslint-disable-next-line lwr/no-unguarded-apis
939
939
  console.error(e);
940
940
  }
@@ -1206,9 +1206,9 @@ LWR.define('lwr/loaderLegacy/v/0_19_0-alpha_9', ['exports'], (function (exports)
1206
1206
  // Don't allow redefining a module.
1207
1207
  if (mod && mod.defined) {
1208
1208
  if (
1209
- hasProcessEnv &&
1209
+ // note: we always expect "development" to be replaced at build time
1210
1210
  // eslint-disable-next-line lwr/no-unguarded-apis
1211
- process.env.NODE_ENV !== 'production' &&
1211
+ hasProcessEnv &&
1212
1212
  // eslint-disable-next-line lwr/no-unguarded-apis
1213
1213
  process.env.MRT_HMR !== 'true'
1214
1214
  ) {
@@ -1279,7 +1279,7 @@ LWR.define('lwr/loaderLegacy/v/0_19_0-alpha_9', ['exports'], (function (exports)
1279
1279
  };
1280
1280
  this.namedDefineRegistry.set(id, moduleDef );
1281
1281
  // eslint-disable-next-line lwr/no-unguarded-apis
1282
- } else if (process.env.NODE_ENV !== 'production') {
1282
+ } else {
1283
1283
  if (!this.warnings[MODULE_WARNING.MODULE_ALREADY_LOADED].includes(id)) {
1284
1284
  this.warnings[MODULE_WARNING.MODULE_ALREADY_LOADED].push(id);
1285
1285
  }
@@ -1316,7 +1316,7 @@ LWR.define('lwr/loaderLegacy/v/0_19_0-alpha_9', ['exports'], (function (exports)
1316
1316
  });
1317
1317
  } else {
1318
1318
  // eslint-disable-next-line lwr/no-unguarded-apis
1319
- if (process.env.NODE_ENV !== 'production' && hasConsole) {
1319
+ if (hasConsole) {
1320
1320
  // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
1321
1321
  console.warn(
1322
1322
  `stale module detected ${name}, current sig:${currentSig}, new sig:${signature}`,
@@ -1411,7 +1411,7 @@ LWR.define('lwr/loaderLegacy/v/0_19_0-alpha_9', ['exports'], (function (exports)
1411
1411
  if (!this.aliases.has(aliasId)) {
1412
1412
  this.aliases.set(aliasId, resolvedId);
1413
1413
  // eslint-disable-next-line lwr/no-unguarded-apis
1414
- } else if (hasConsole && process.env.NODE_ENV !== 'production') {
1414
+ } else if (hasConsole && "development" !== 'production') {
1415
1415
  // Warn the user if they were not aliasing to the resolvedId
1416
1416
  const currentResolvedId = this.aliases.get(aliasId);
1417
1417
  if (currentResolvedId !== resolvedId) {
@@ -1741,9 +1741,10 @@ LWR.define('lwr/loaderLegacy/v/0_19_0-alpha_9', ['exports'], (function (exports)
1741
1741
 
1742
1742
  logMessage(logType, message) {
1743
1743
  if (
1744
- !hasProcessEnv ||
1745
- !hasConsole || // eslint-disable-next-line lwr/no-unguarded-apis
1746
- process.env.NODE_ENV === 'production'
1744
+ !hasConsole ||
1745
+ // note: we always expect this to be replaced at build time
1746
+ // eslint-disable-next-line lwr/no-unguarded-apis
1747
+ "development" === 'production'
1747
1748
  ) {
1748
1749
  return;
1749
1750
  }
@@ -4,8 +4,8 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
6
  */
7
- /* LWR Legacy Module Loader Shim v0.19.0-alpha.9 */
8
- !function(){"use strict";var e=function(e){return e[e.Start=0]="Start",e[e.End=1]="End",e}(e||{});let t;function r(e){t=e}const o=globalThis.performance,s=void 0!==o&&"function"==typeof o.mark&&"function"==typeof o.clearMarks&&"function"==typeof o.measure&&"function"==typeof o.clearMeasures;function i(e,t){return t?`${e}-${t}`:e}function n(e,t,r){const o=i(e,t);return t&&r?`${o}_${r}`:o}function a(e,t){const r=e||t?{...t}:null;return r&&e&&(r.specifier=e),r}function l({id:r,specifier:i,specifierIndex:l,metadata:d}){if(t)t({id:r,phase:e.Start,specifier:i,metadata:d,specifierIndex:l});else if(s){const e=n(r,i,l),t=a(i,d);o.mark(e,{detail:t})}}function d({id:r,specifier:l,specifierIndex:d,metadata:c}){if(t)t({id:r,phase:e.End,specifier:l,metadata:c,specifierIndex:d});else if(s){const e=n(r,l,d),t=i(r,l),s=a(l,c);o.measure(t,{start:e,detail:s}),o.clearMarks(e),o.clearMeasures(t)}}function c(e,t,o,s){const{autoBoot:i,customInit:n}=e;if(function(e,t){if(!e&&!t)throw new Error("The customInit hook is required when autoBoot is false");if(e&&t)throw new Error("The customInit hook must not be defined when autoBoot is true")}(i,n),n){n({initializeApp:t,define:o,onBootstrapError:s,attachDispatcher:r},e)}}const u="function"==typeof setTimeout,p="undefined"!=typeof console;class f{__init(){this.defineCache={}}__init2(){this.orderedDefs=[]}constructor(e){f.prototype.__init.call(this),f.prototype.__init2.call(this),u&&(this.watchdogTimerId=this.startWatchdogTimer()),this.global=e,this.config=e.LWR,this.loaderModule="lwr/loaderLegacy/v/0_19_0-alpha_9",this.errorHandler=this.config.onError;const t=this.tempDefine.bind(this);e.LWR.define=t,this.bootReady=this.config.autoBoot;try{this.createProfilerModule(e.LWR.define),c(Object.freeze(this.config),this.postCustomInit.bind(this),t,(e=>{this.errorHandler=e}))}catch(e){this.enterErrorState(e)}}canInit(){if(!this.config.requiredModules)throw new Error("Unexpected missing requiredModules");const e=this.config.requiredModules.every((e=>this.orderedDefs.includes(e)));return this.bootReady&&e}tempDefine(...e){const t=e[0];this.defineCache[t]=e,this.orderedDefs.push(t),this.canInit()&&(u&&clearTimeout(this.watchdogTimerId),this.initApp())}postCustomInit(){this.bootReady=!0,this.canInit()&&(u&&clearTimeout(this.watchdogTimerId),this.initApp())}initApp(){try{const e={baseUrl:this.config.baseUrl,profiler:{logOperationStart:l,logOperationEnd:d},appMetadata:{appId:this.config.appId,bootstrapModule:this.config.bootstrapModule,rootComponent:this.config.rootComponent,rootComponents:this.config.rootComponents}},t=function(e,t,r,o){if(!t||"function"!=typeof t[2])throw new Error(`Expected loader with specifier "${e}" to be a module`);const s={};t[2].call(null,s);const{Loader:i}=s;if(!i)throw new Error("Expected Loader class to be defined");const n=new i(r);return o&&o.length&&n.registerExternalModules(o),n.define(e,["exports"],(e=>{Object.assign(e,{define:n.define.bind(n),load:n.load.bind(n),services:n.services,clearRegistry:n.clearRegistry.bind(n)})}),t[3]),n}(this.loaderModule,this.defineCache[this.loaderModule],e,this.config.preloadModules);this.mountApp(t),t&&t.getModuleWarnings}catch(e){this.enterErrorState(e)}}waitForBody(){return new Promise((e=>{if(document.body)e();else{const t=new MutationObserver((()=>{document.body&&(t.disconnect(),e())}));t.observe(document.documentElement,{childList:!0})}}))}waitForDOMContentLoaded(){return"interactive"===document.readyState||"complete"===document.readyState?Promise.resolve():new Promise((e=>{document.addEventListener("DOMContentLoaded",(()=>{e()}))}))}createProfilerModule(e){e("lwr/profiler/v/0_19_0-alpha_9",["exports"],(e=>{Object.assign(e,{logOperationStart:l,logOperationEnd:d})}),{})}mountApp(e){const{bootstrapModule:t,rootComponent:r,importMappings:o,rootComponents:s,serverData:i,endpoints:n}=this.config;this.global.LWR=Object.freeze({define:e.define.bind(e),rootComponent:r,rootComponents:s,serverData:i||{},importMappings:o,endpoints:n,env:this.global.LWR.env}),this.orderedDefs.forEach((t=>{t!==this.loaderModule&&e.define(...this.defineCache[t])}));const{initDeferDOM:a}=this.config;e.registerImportMappings(o).then((()=>"undefined"==typeof window||void 0===typeof document?Promise.resolve():a?this.waitForDOMContentLoaded():this.waitForBody())).then((()=>e.load(t))).catch((e=>{this.enterErrorState(new Error(`Application ${r||t} could not be loaded: ${e}`))}))}enterErrorState(e){l({id:"lwr.bootstrap.error"}),this.errorHandler?this.errorHandler(e):p&&console.error(`An error occurred during LWR bootstrap. ${e.message}`,e.stack)}startWatchdogTimer(){return setTimeout((()=>{this.enterErrorState(new Error("Failed to load required modules - timed out"))}),6e4)}logWarnings(e){for(const t in e)e[t].length&&console.warn(t,e[t])}}const h=globalThis;h.LWR.requiredModules=h.LWR.requiredModules||[],h.LWR.requiredModules.indexOf("lwr/loaderLegacy/v/0_19_0-alpha_9")<0&&h.LWR.requiredModules.push("lwr/loaderLegacy/v/0_19_0-alpha_9"),new f(h)}(),LWR.define("lwr/loaderLegacy/v/0_19_0-alpha_9",["exports"],(function(exports){"use strict";const templateRegex=/\{([0-9]+)\}/g;function templateString(e,t){return e.replace(templateRegex,((e,r)=>t[r]))}function generateErrorMessage(e,t){const r=Array.isArray(t)?templateString(e.message,t):e.message;return`LWR${e.code}: ${r}`}class LoaderError extends Error{constructor(e,t){super(),this.message=generateErrorMessage(e,t)}}function invariant(e,t){if(!e)throw new LoaderError(t)}const MISSING_NAME=Object.freeze({code:3e3,message:"A module name is required.",level:0}),FAIL_INSTANTIATE=Object.freeze({code:3004,message:"Failed to instantiate module: {0}",level:0}),NO_AMD_REQUIRE=Object.freeze({code:3005,message:"AMD require not supported.",level:0}),FAILED_DEP=Object.freeze({code:3006,level:0,message:"Failed to load dependency: {0}"}),INVALID_DEPS=Object.freeze({code:3007,message:"Unexpected value received for dependencies argument; expected an array.",level:0}),FAIL_LOAD=Object.freeze({code:3008,level:0,message:"Error loading {0}"}),UNRESOLVED=Object.freeze({code:3009,level:0,message:"Unable to resolve bare specifier: {0}"}),NO_BASE_URL=Object.freeze({code:3010,level:0,message:"baseUrl not set"});Object.freeze({code:3011,level:0,message:"Cannot set a loader service multiple times"});const INVALID_HOOK=Object.freeze({code:3012,level:0,message:"Invalid hook received"}),INVALID_LOADER_SERVICE_RESPONSE=Object.freeze({code:3013,level:0,message:"Invalid response received from hook"}),MODULE_LOAD_TIMEOUT=Object.freeze({code:3014,level:0,message:"Error loading {0} - timed out"}),HTTP_FAIL_LOAD=Object.freeze({code:3015,level:0,message:"Error loading {0}, status code {1}"}),STALE_HOOK_ERROR=Object.freeze({code:3016,level:0,message:"An error occurred handling module conflict"});Object.freeze({code:3017,level:0,message:"Marking module(s) as externally loaded, but they are already loaded: {0}"});const FAIL_HOOK_LOAD=Object.freeze({code:3018,level:0,message:'Error loading "{0}" from hook'}),EXPORTER_ERROR=Object.freeze({code:3021,level:0,message:'Error evaluating module "{0}", error was {1}'}),NO_IMPORT_LWC=Object.freeze({code:3022,level:0,message:'Cannot dynamically import "lwc" with importer "{0}"'}),NO_BLOB_IMPORT=Object.freeze({code:3023,level:0,message:"Cannot import a blob URL"}),BAD_IMPORT_MAP=Object.freeze({code:3011,level:0,message:"import map is not valid"}),hasDocument="undefined"!=typeof document,hasSetTimeout="function"==typeof setTimeout,hasConsole="undefined"!=typeof console,hasProcess="undefined"!=typeof process,hasProcessEnv=hasProcess&&process.env;function getBaseUrl(){let e;if(hasDocument){const t=document.querySelector("base[href]");e=t&&t.href}if(!e&&"undefined"!=typeof location){e=location.href.split("#")[0].split("?")[0];const t=e.lastIndexOf("/");-1!==t&&(e=e.slice(0,t+1))}return e}function isUrl(e){return-1!==e.indexOf("://")}function resolveIfNotPlainOrUrl(e,t){if(-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/")),"/"===e[0]&&"/"===e[1])return t.slice(0,t.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const r=t.slice(0,t.indexOf(":")+1);let o;if("/"===t[r.length+1]?"file:"!==r?(o=t.slice(r.length+2),o=o.slice(o.indexOf("/")+1)):o=t.slice(8):o=t.slice(r.length+("/"===t[r.length]?1:0)),"/"===e[0])return t.slice(0,t.length-o.length-1)+e;const s=o.slice(0,o.lastIndexOf("/")+1)+e,i=[];let n=-1;for(let e=0;e<s.length;e++)-1!==n?"/"===s[e]&&(i.push(s.slice(n,e+1)),n=-1):"."===s[e]?"."!==s[e+1]||"/"!==s[e+2]&&e+2!==s.length?"/"===s[e+1]||e+1===s.length?e+=1:n=e:(i.pop(),e+=2):n=e;return-1!==n&&i.push(s.slice(n)),t.slice(0,t.length-o.length)+i.join("")}}function resolveUrl(e,t){return resolveIfNotPlainOrUrl(e,t)||(isUrl(e)?e:resolveIfNotPlainOrUrl("./"+e,t))}function createScript(e){const t=document.createElement("script");return t.async=!0,t.crossOrigin="anonymous",t.src=e,t}let lastWindowError$1,lastWindowErrorUrl;function loadModuleDef(e){return new Promise((function(t,r){if(hasDocument){const o=createScript(e);o.addEventListener("error",(()=>{r(new LoaderError(FAIL_LOAD,[e]))})),o.addEventListener("load",(()=>{document.head.removeChild(o),lastWindowErrorUrl===e?r(lastWindowError$1):t()})),document.head.appendChild(o)}}))}hasDocument&&window.addEventListener("error",(e=>{lastWindowErrorUrl=e.filename,lastWindowError$1=e.error}));const MODULE_LOAD_TIMEOUT_TIMER=6e4;var MODULE_WARNING;!function(e){e.MODULE_REDEFINE="Module redefine attempted";e.MODULE_ALREADY_LOADED="Marking module(s) as externally loaded, but they are already loaded";e.ALIAS_UPDATE="Alias update attempt"}(MODULE_WARNING||(MODULE_WARNING={}));
7
+ /* LWR Legacy Module Loader Shim v0.19.1 */
8
+ !function(){"use strict";var e=function(e){return e[e.Start=0]="Start",e[e.End=1]="End",e}(e||{});let t;function r(e){t=e}const o=globalThis.performance,s=void 0!==o&&"function"==typeof o.mark&&"function"==typeof o.clearMarks&&"function"==typeof o.measure&&"function"==typeof o.clearMeasures;function i(e,t){return t?`${e}-${t}`:e}function n(e,t,r){const o=i(e,t);return t&&r?`${o}_${r}`:o}function a(e,t){const r=e||t?{...t}:null;return r&&e&&(r.specifier=e),r}function l({id:r,specifier:i,specifierIndex:l,metadata:d}){if(t)t({id:r,phase:e.Start,specifier:i,metadata:d,specifierIndex:l});else if(s){const e=n(r,i,l),t=a(i,d);o.mark(e,{detail:t})}}function d({id:r,specifier:l,specifierIndex:d,metadata:c}){if(t)t({id:r,phase:e.End,specifier:l,metadata:c,specifierIndex:d});else if(s){const e=n(r,l,d),t=i(r,l),s=a(l,c);o.measure(t,{start:e,detail:s}),o.clearMarks(e),o.clearMeasures(t)}}function c(e,t,o,s){const{autoBoot:i,customInit:n}=e;if(function(e,t){if(!e&&!t)throw new Error("The customInit hook is required when autoBoot is false");if(e&&t)throw new Error("The customInit hook must not be defined when autoBoot is true")}(i,n),n){n({initializeApp:t,define:o,onBootstrapError:s,attachDispatcher:r},e)}}const u="function"==typeof setTimeout,p="undefined"!=typeof console;class f{__init(){this.defineCache={}}__init2(){this.orderedDefs=[]}constructor(e){f.prototype.__init.call(this),f.prototype.__init2.call(this),u&&(this.watchdogTimerId=this.startWatchdogTimer()),this.global=e,this.config=e.LWR,this.loaderModule="lwr/loaderLegacy/v/0_19_1",this.errorHandler=this.config.onError;const t=this.tempDefine.bind(this);e.LWR.define=t,this.bootReady=this.config.autoBoot;try{this.createProfilerModule(e.LWR.define),c(Object.freeze(this.config),this.postCustomInit.bind(this),t,(e=>{this.errorHandler=e}))}catch(e){this.enterErrorState(e)}}canInit(){if(!this.config.requiredModules)throw new Error("Unexpected missing requiredModules");const e=this.config.requiredModules.every((e=>this.orderedDefs.includes(e)));return this.bootReady&&e}tempDefine(...e){const t=e[0];this.defineCache[t]=e,this.orderedDefs.push(t),this.canInit()&&(u&&clearTimeout(this.watchdogTimerId),this.initApp())}postCustomInit(){this.bootReady=!0,this.canInit()&&(u&&clearTimeout(this.watchdogTimerId),this.initApp())}initApp(){try{const e={baseUrl:this.config.baseUrl,profiler:{logOperationStart:l,logOperationEnd:d},appMetadata:{appId:this.config.appId,bootstrapModule:this.config.bootstrapModule,rootComponent:this.config.rootComponent,rootComponents:this.config.rootComponents}},t=function(e,t,r,o){if(!t||"function"!=typeof t[2])throw new Error(`Expected loader with specifier "${e}" to be a module`);const s={};t[2].call(null,s);const{Loader:i}=s;if(!i)throw new Error("Expected Loader class to be defined");const n=new i(r);return o&&o.length&&n.registerExternalModules(o),n.define(e,["exports"],(e=>{Object.assign(e,{define:n.define.bind(n),load:n.load.bind(n),services:n.services,clearRegistry:n.clearRegistry.bind(n)})}),t[3]),n}(this.loaderModule,this.defineCache[this.loaderModule],e,this.config.preloadModules);this.mountApp(t),t&&t.getModuleWarnings}catch(e){this.enterErrorState(e)}}waitForBody(){return new Promise((e=>{if(document.body)e();else{const t=new MutationObserver((()=>{document.body&&(t.disconnect(),e())}));t.observe(document.documentElement,{childList:!0})}}))}waitForDOMContentLoaded(){return"interactive"===document.readyState||"complete"===document.readyState?Promise.resolve():new Promise((e=>{document.addEventListener("DOMContentLoaded",(()=>{e()}))}))}createProfilerModule(e){e("lwr/profiler/v/0_19_1",["exports"],(e=>{Object.assign(e,{logOperationStart:l,logOperationEnd:d})}),{})}mountApp(e){const{bootstrapModule:t,rootComponent:r,importMappings:o,rootComponents:s,serverData:i,endpoints:n}=this.config;this.global.LWR=Object.freeze({define:e.define.bind(e),rootComponent:r,rootComponents:s,serverData:i||{},importMappings:o,endpoints:n,env:this.global.LWR.env}),this.orderedDefs.forEach((t=>{t!==this.loaderModule&&e.define(...this.defineCache[t])}));const{initDeferDOM:a}=this.config;e.registerImportMappings(o).then((()=>"undefined"==typeof window||void 0===typeof document?Promise.resolve():a?this.waitForDOMContentLoaded():this.waitForBody())).then((()=>e.load(t))).catch((e=>{this.enterErrorState(new Error(`Application ${r||t} could not be loaded: ${e}`))}))}enterErrorState(e){l({id:"lwr.bootstrap.error"}),this.errorHandler?this.errorHandler(e):p&&console.error(`An error occurred during LWR bootstrap. ${e.message}`,e.stack)}startWatchdogTimer(){return setTimeout((()=>{this.enterErrorState(new Error("Failed to load required modules - timed out"))}),6e4)}logWarnings(e){for(const t in e)e[t].length&&console.warn(t,e[t])}}const h=globalThis;h.LWR.requiredModules=h.LWR.requiredModules||[],h.LWR.requiredModules.indexOf("lwr/loaderLegacy/v/0_19_1")<0&&h.LWR.requiredModules.push("lwr/loaderLegacy/v/0_19_1"),new f(h)}(),LWR.define("lwr/loaderLegacy/v/0_19_1",["exports"],(function(exports){"use strict";const templateRegex=/\{([0-9]+)\}/g;function templateString(e,t){return e.replace(templateRegex,((e,r)=>t[r]))}function generateErrorMessage(e,t){const r=Array.isArray(t)?templateString(e.message,t):e.message;return`LWR${e.code}: ${r}`}class LoaderError extends Error{constructor(e,t){super(),this.message=generateErrorMessage(e,t)}}function invariant(e,t){if(!e)throw new LoaderError(t)}const MISSING_NAME=Object.freeze({code:3e3,message:"A module name is required.",level:0}),FAIL_INSTANTIATE=Object.freeze({code:3004,message:"Failed to instantiate module: {0}",level:0}),NO_AMD_REQUIRE=Object.freeze({code:3005,message:"AMD require not supported.",level:0}),FAILED_DEP=Object.freeze({code:3006,level:0,message:"Failed to load dependency: {0}"}),INVALID_DEPS=Object.freeze({code:3007,message:"Unexpected value received for dependencies argument; expected an array.",level:0}),FAIL_LOAD=Object.freeze({code:3008,level:0,message:"Error loading {0}"}),UNRESOLVED=Object.freeze({code:3009,level:0,message:"Unable to resolve bare specifier: {0}"}),NO_BASE_URL=Object.freeze({code:3010,level:0,message:"baseUrl not set"});Object.freeze({code:3011,level:0,message:"Cannot set a loader service multiple times"});const INVALID_HOOK=Object.freeze({code:3012,level:0,message:"Invalid hook received"}),INVALID_LOADER_SERVICE_RESPONSE=Object.freeze({code:3013,level:0,message:"Invalid response received from hook"}),MODULE_LOAD_TIMEOUT=Object.freeze({code:3014,level:0,message:"Error loading {0} - timed out"}),HTTP_FAIL_LOAD=Object.freeze({code:3015,level:0,message:"Error loading {0}, status code {1}"}),STALE_HOOK_ERROR=Object.freeze({code:3016,level:0,message:"An error occurred handling module conflict"});Object.freeze({code:3017,level:0,message:"Marking module(s) as externally loaded, but they are already loaded: {0}"});const FAIL_HOOK_LOAD=Object.freeze({code:3018,level:0,message:'Error loading "{0}" from hook'}),EXPORTER_ERROR=Object.freeze({code:3021,level:0,message:'Error evaluating module "{0}", error was {1}'}),NO_IMPORT_LWC=Object.freeze({code:3022,level:0,message:'Cannot dynamically import "lwc" with importer "{0}"'}),NO_BLOB_IMPORT=Object.freeze({code:3023,level:0,message:"Cannot import a blob URL"}),BAD_IMPORT_MAP=Object.freeze({code:3011,level:0,message:"import map is not valid"}),hasDocument="undefined"!=typeof document,hasSetTimeout="function"==typeof setTimeout,hasConsole="undefined"!=typeof console,hasProcess="undefined"!=typeof process;function getBaseUrl(){let e;if(hasDocument){const t=document.querySelector("base[href]");e=t&&t.href}if(!e&&"undefined"!=typeof location){e=location.href.split("#")[0].split("?")[0];const t=e.lastIndexOf("/");-1!==t&&(e=e.slice(0,t+1))}return e}function isUrl(e){return-1!==e.indexOf("://")}function resolveIfNotPlainOrUrl(e,t){if(-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/")),"/"===e[0]&&"/"===e[1])return t.slice(0,t.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const r=t.slice(0,t.indexOf(":")+1);let o;if("/"===t[r.length+1]?"file:"!==r?(o=t.slice(r.length+2),o=o.slice(o.indexOf("/")+1)):o=t.slice(8):o=t.slice(r.length+("/"===t[r.length]?1:0)),"/"===e[0])return t.slice(0,t.length-o.length-1)+e;const s=o.slice(0,o.lastIndexOf("/")+1)+e,i=[];let n=-1;for(let e=0;e<s.length;e++)-1!==n?"/"===s[e]&&(i.push(s.slice(n,e+1)),n=-1):"."===s[e]?"."!==s[e+1]||"/"!==s[e+2]&&e+2!==s.length?"/"===s[e+1]||e+1===s.length?e+=1:n=e:(i.pop(),e+=2):n=e;return-1!==n&&i.push(s.slice(n)),t.slice(0,t.length-o.length)+i.join("")}}function resolveUrl(e,t){return resolveIfNotPlainOrUrl(e,t)||(isUrl(e)?e:resolveIfNotPlainOrUrl("./"+e,t))}function createScript(e){const t=document.createElement("script");return t.async=!0,t.crossOrigin="anonymous",t.src=e,t}let lastWindowError$1,lastWindowErrorUrl;function loadModuleDef(e){return new Promise((function(t,r){if(hasDocument){const o=createScript(e);o.addEventListener("error",(()=>{r(new LoaderError(FAIL_LOAD,[e]))})),o.addEventListener("load",(()=>{document.head.removeChild(o),lastWindowErrorUrl===e?r(lastWindowError$1):t()})),document.head.appendChild(o)}}))}hasProcess&&process.env,hasDocument&&window.addEventListener("error",(e=>{lastWindowErrorUrl=e.filename,lastWindowError$1=e.error}));const MODULE_LOAD_TIMEOUT_TIMER=6e4;var MODULE_WARNING;!function(e){e.MODULE_REDEFINE="Module redefine attempted";e.MODULE_ALREADY_LOADED="Marking module(s) as externally loaded, but they are already loaded";e.ALIAS_UPDATE="Alias update attempt"}(MODULE_WARNING||(MODULE_WARNING={}));
9
9
  /*!
10
10
  * Copyright (C) 2023 salesforce.com, inc.
11
11
  */
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
6
  */
7
- /* LWR Legacy Module Loader Shim v0.19.0-alpha.9 */
7
+ /* LWR Legacy Module Loader Shim v0.19.1 */
8
8
  (function () {
9
9
  'use strict';
10
10
 
@@ -210,7 +210,7 @@
210
210
  // Parse configuration
211
211
  this.global = global;
212
212
  this.config = global.LWR ;
213
- this.loaderModule = 'lwr/loaderLegacy/v/0_19_0-alpha_9';
213
+ this.loaderModule = 'lwr/loaderLegacy/v/0_19_1';
214
214
 
215
215
  // Set up error handler
216
216
  this.errorHandler = this.config.onError ;
@@ -360,7 +360,7 @@
360
360
  const exporter = (exports) => {
361
361
  Object.assign(exports, { logOperationStart, logOperationEnd });
362
362
  };
363
- define('lwr/profiler/v/0_19_0-alpha_9', ['exports'], exporter, {});
363
+ define('lwr/profiler/v/0_19_1', ['exports'], exporter, {});
364
364
  }
365
365
 
366
366
  // Set up the application globals, import map, root custom element...
@@ -447,8 +447,8 @@
447
447
  // The loader module is ALWAYS required
448
448
  const GLOBAL = globalThis ;
449
449
  GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
450
- if (GLOBAL.LWR.requiredModules.indexOf('lwr/loaderLegacy/v/0_19_0-alpha_9') < 0) {
451
- GLOBAL.LWR.requiredModules.push('lwr/loaderLegacy/v/0_19_0-alpha_9');
450
+ if (GLOBAL.LWR.requiredModules.indexOf('lwr/loaderLegacy/v/0_19_1') < 0) {
451
+ GLOBAL.LWR.requiredModules.push('lwr/loaderLegacy/v/0_19_1');
452
452
  }
453
453
  new LoaderShim(GLOBAL);
454
454
 
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
6
  */
7
- /* LWR Module Loader Shim v0.19.0-alpha.9 */
7
+ /* LWR Module Loader Shim v0.19.1 */
8
8
  (function () {
9
9
  'use strict';
10
10
 
@@ -213,7 +213,7 @@
213
213
  // Parse configuration
214
214
  this.global = global;
215
215
  this.config = global.LWR ;
216
- this.loaderSpecifier = 'lwr/loader/v/0_19_0-alpha_9';
216
+ this.loaderSpecifier = 'lwr/loader/v/0_19_1';
217
217
 
218
218
  // Set up error handler
219
219
  this.errorHandler = this.config.onError ;
@@ -317,7 +317,7 @@
317
317
  hasProcess &&
318
318
  hasConsole &&
319
319
  // eslint-disable-next-line lwr/no-unguarded-apis
320
- process.env.NODE_ENV !== 'production'
320
+ "development" !== 'production'
321
321
  ) {
322
322
  this.logWarnings(loader.getModuleWarnings(true)); // the true indicates the app is mounted
323
323
  }
@@ -364,7 +364,7 @@
364
364
  const exporter = (exports) => {
365
365
  Object.assign(exports, { logOperationStart, logOperationEnd });
366
366
  };
367
- define('lwr/profiler/v/0_19_0-alpha_9', ['exports'], exporter);
367
+ define('lwr/profiler/v/0_19_1', ['exports'], exporter);
368
368
  }
369
369
 
370
370
  // Set up the application globals, import map, root custom element...
@@ -456,14 +456,14 @@
456
456
  // The loader module is ALWAYS required
457
457
  const GLOBAL = globalThis ;
458
458
  GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
459
- if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_19_0-alpha_9') < 0) {
460
- GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_19_0-alpha_9');
459
+ if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_19_1') < 0) {
460
+ GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_19_1');
461
461
  }
462
462
  new LoaderShim(GLOBAL);
463
463
 
464
464
  })();
465
465
 
466
- LWR.define('lwr/loader/v/0_19_0-alpha_9', ['exports'], (function (exports) { 'use strict';
466
+ LWR.define('lwr/loader/v/0_19_1', ['exports'], (function (exports) { 'use strict';
467
467
 
468
468
  const templateRegex = /\{([0-9]+)\}/g;
469
469
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1161,7 +1161,7 @@ LWR.define('lwr/loader/v/0_19_0-alpha_9', ['exports'], (function (exports) { 'us
1161
1161
  }
1162
1162
 
1163
1163
  // eslint-disable-next-line lwr/no-unguarded-apis
1164
- if (process.env.NODE_ENV !== 'production') {
1164
+ {
1165
1165
  if (!hasSetTimeout && hasConsole) {
1166
1166
  // eslint-disable-next-line lwr/no-unguarded-apis
1167
1167
  console.warn('setTimeout API is not available, watchdog timer on load hook will not be set');
@@ -1221,7 +1221,7 @@ LWR.define('lwr/loader/v/0_19_0-alpha_9', ['exports'], (function (exports) { 'us
1221
1221
  eval(trusted.createScript(code) );
1222
1222
  } catch (e) {
1223
1223
  // eslint-disable-next-line lwr/no-unguarded-apis
1224
- if (process.env.NODE_ENV !== 'production' && hasConsole) {
1224
+ if (hasConsole) {
1225
1225
  // eslint-disable-next-line lwr/no-unguarded-apis
1226
1226
  console.error(e);
1227
1227
  }
@@ -1450,9 +1450,9 @@ LWR.define('lwr/loader/v/0_19_0-alpha_9', ['exports'], (function (exports) { 'us
1450
1450
  // Don't allow redefining a module.
1451
1451
  if (mod && mod.defined) {
1452
1452
  if (
1453
- hasProcessEnv &&
1453
+ // note: we always expect "development" to be replaced at build time
1454
1454
  // eslint-disable-next-line lwr/no-unguarded-apis
1455
- process.env.NODE_ENV !== 'production' &&
1455
+ hasProcessEnv &&
1456
1456
  // eslint-disable-next-line lwr/no-unguarded-apis
1457
1457
  process.env.MRT_HMR !== 'true'
1458
1458
  ) {
@@ -1515,7 +1515,7 @@ LWR.define('lwr/loader/v/0_19_0-alpha_9', ['exports'], (function (exports) { 'us
1515
1515
  };
1516
1516
  this.namedDefineRegistry.set(id, moduleDef );
1517
1517
  // eslint-disable-next-line lwr/no-unguarded-apis
1518
- } else if (process.env.NODE_ENV !== 'production') {
1518
+ } else {
1519
1519
  if (!this.warnings[MODULE_WARNING.MODULE_ALREADY_LOADED].includes(id)) {
1520
1520
  this.warnings[MODULE_WARNING.MODULE_ALREADY_LOADED].push(id);
1521
1521
  }
@@ -1611,7 +1611,7 @@ LWR.define('lwr/loader/v/0_19_0-alpha_9', ['exports'], (function (exports) { 'us
1611
1611
  if (!this.aliases.has(aliasId)) {
1612
1612
  this.aliases.set(aliasId, resolvedId);
1613
1613
  // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
1614
- } else if (process.env.NODE_ENV !== 'production' && hasConsole) {
1614
+ } else if (hasConsole) {
1615
1615
  // Warn the user if they were not aliasing to the resolvedId
1616
1616
  const currentResolvedId = this.aliases.get(aliasId);
1617
1617
  if (currentResolvedId !== resolvedId) {
@@ -1934,7 +1934,7 @@ LWR.define('lwr/loader/v/0_19_0-alpha_9', ['exports'], (function (exports) { 'us
1934
1934
  });
1935
1935
  } else {
1936
1936
  // eslint-disable-next-line lwr/no-unguarded-apis
1937
- if (process.env.NODE_ENV !== 'production' && hasConsole) {
1937
+ if (hasConsole) {
1938
1938
  // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
1939
1939
  console.warn(`stale module detected ${name}, current URL:${oldUrl}, new URL:${newUrl}`);
1940
1940
  }
@@ -1963,9 +1963,10 @@ LWR.define('lwr/loader/v/0_19_0-alpha_9', ['exports'], (function (exports) { 'us
1963
1963
 
1964
1964
  logMessage(logType, message) {
1965
1965
  if (
1966
- !hasProcessEnv ||
1967
- !hasConsole || // eslint-disable-next-line lwr/no-unguarded-apis
1968
- process.env.NODE_ENV === 'production'
1966
+ !hasConsole ||
1967
+ // note: we always expect this to be replaced at build time
1968
+ // eslint-disable-next-line lwr/no-unguarded-apis
1969
+ "development" === 'production'
1969
1970
  ) {
1970
1971
  return;
1971
1972
  }
@@ -4,8 +4,8 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
6
  */
7
- /* LWR Module Loader Shim v0.19.0-alpha.9 */
8
- !function(){"use strict";var e=function(e){return e[e.Start=0]="Start",e[e.End=1]="End",e}(e||{});let t;function r(e){t=e}const o=globalThis.performance,i=void 0!==o&&"function"==typeof o.mark&&"function"==typeof o.clearMarks&&"function"==typeof o.measure&&"function"==typeof o.clearMeasures;function n(e,t){return t?`${e}-${t}`:e}function s(e,t,r){const o=n(e,t);return t&&r?`${o}_${r}`:o}function a(e,t){const r=e||t?{...t}:null;return r&&e&&(r.specifier=e),r}function l({id:r,specifier:n,specifierIndex:l,metadata:d}){if(t)t({id:r,phase:e.Start,specifier:n,metadata:d,specifierIndex:l});else if(i){const e=s(r,n,l),t=a(n,d);o.mark(e,{detail:t})}}function d({id:r,specifier:l,specifierIndex:d,metadata:c}){if(t)t({id:r,phase:e.End,specifier:l,metadata:c,specifierIndex:d});else if(i){const e=s(r,l,d),t=n(r,l),i=a(l,c);o.measure(t,{start:e,detail:i}),o.clearMarks(e),o.clearMeasures(t)}}function c(e,t,o,i){const{autoBoot:n,customInit:s}=e;if(function(e,t){if(!e&&!t)throw new Error("The customInit hook is required when autoBoot is false");if(e&&t)throw new Error("The customInit hook must not be defined when autoBoot is true")}(n,s),s){s({initializeApp:t,define:o,onBootstrapError:i,attachDispatcher:r},e)}}const p="function"==typeof setTimeout,u="undefined"!=typeof console;class h{__init(){this.defineCache={}}__init2(){this.orderedDefs=[]}constructor(e){h.prototype.__init.call(this),h.prototype.__init2.call(this),p&&(this.watchdogTimerId=this.startWatchdogTimer()),this.global=e,this.config=e.LWR,this.loaderSpecifier="lwr/loader/v/0_19_0-alpha_9",this.errorHandler=this.config.onError;const t=this.tempDefine.bind(this);e.LWR.define=t,this.bootReady=this.config.autoBoot;try{this.createProfilerModule(e.LWR.define),c(Object.freeze(this.config),this.postCustomInit.bind(this),t,(e=>{this.errorHandler=e}))}catch(e){this.enterErrorState(e)}}canInit(){if(!this.config.requiredModules)throw new Error("Unexpected missing requiredModules");const e=this.config.requiredModules.every((e=>this.orderedDefs.includes(e)));return this.bootReady&&e}tempDefine(...e){const t=e[0];this.defineCache[t]=e,this.orderedDefs.push(t),this.canInit()&&(p&&clearTimeout(this.watchdogTimerId),this.initApp())}postCustomInit(){this.bootReady=!0,this.canInit()&&(p&&clearTimeout(this.watchdogTimerId),this.initApp())}initApp(){try{const e={endpoints:this.config.endpoints,baseUrl:this.config.baseUrl,profiler:{logOperationStart:l,logOperationEnd:d},appMetadata:{appId:this.config.appId,bootstrapModule:this.config.bootstrapModule,rootComponent:this.config.rootComponent,rootComponents:this.config.rootComponents}},t=function(e,t,r,o){if(!t||"function"!=typeof t[2])throw new Error(`Expected loader with specifier "${e}" to be a module`);const i={};t[2].call(null,i);const{Loader:n}=i;if(!n)throw new Error("Expected Loader class to be defined");const s=new n(r);return o&&o.length&&s.registerExternalModules(o),s.define(e,["exports"],(e=>{Object.assign(e,{define:s.define.bind(s),load:s.load.bind(s),services:s.services})})),s}(this.loaderSpecifier,this.defineCache[this.loaderSpecifier],e,this.config.preloadModules);this.mountApp(t),t&&t.getModuleWarnings}catch(e){this.enterErrorState(e)}}waitForBody(){return new Promise((e=>{if(document.body)e();else{const t=new MutationObserver((()=>{document.body&&(t.disconnect(),e())}));t.observe(document.documentElement,{childList:!0})}}))}waitForDOMContentLoaded(){return"interactive"===document.readyState||"complete"===document.readyState?Promise.resolve():new Promise((e=>{document.addEventListener("DOMContentLoaded",(()=>{e()}))}))}createProfilerModule(e){e("lwr/profiler/v/0_19_0-alpha_9",["exports"],(e=>{Object.assign(e,{logOperationStart:l,logOperationEnd:d})}))}mountApp(e){const{bootstrapModule:t,rootComponent:r,rootComponents:o,serverData:i,endpoints:n,imports:s,index:a}=this.config,l=s||{};this.global.LWR=Object.freeze({define:e.define.bind(e),rootComponent:r,rootComponents:o,serverData:i||{},endpoints:n,imports:l,index:a||{},env:this.global.LWR.env}),this.orderedDefs.forEach((t=>{t!==this.loaderSpecifier&&e.define(...this.defineCache[t])}));const{initDeferDOM:d}=this.config;e.registerImportMappings({imports:l,index:a},[t,r]).then((()=>"undefined"==typeof window||void 0===typeof document?Promise.resolve():d?this.waitForDOMContentLoaded():this.waitForBody())).then((()=>e.load(t))).catch((e=>{this.enterErrorState(new Error(`Application ${r||t} could not be loaded: ${e}`))}))}enterErrorState(e){l({id:"lwr.bootstrap.error"}),this.errorHandler?this.errorHandler(e):u&&console.error(`An error occurred during LWR bootstrap. ${e.message}`,e.stack)}startWatchdogTimer(){return setTimeout((()=>{this.enterErrorState(new Error("Failed to load required modules - timed out"))}),6e4)}logWarnings(e){for(const t in e)e[t].length&&console.warn(t,e[t])}}const f=globalThis;f.LWR.requiredModules=f.LWR.requiredModules||[],f.LWR.requiredModules.indexOf("lwr/loader/v/0_19_0-alpha_9")<0&&f.LWR.requiredModules.push("lwr/loader/v/0_19_0-alpha_9"),new h(f)}(),LWR.define("lwr/loader/v/0_19_0-alpha_9",["exports"],(function(exports){"use strict";const templateRegex=/\{([0-9]+)\}/g;function templateString(e,t){return e.replace(templateRegex,((e,r)=>t[r]))}function generateErrorMessage(e,t){const r=Array.isArray(t)?templateString(e.message,t):e.message;return`LWR${e.code}: ${r}`}class LoaderError extends Error{constructor(e,t){super(),this.message=generateErrorMessage(e,t)}}function invariant(e,t){if(!e)throw new LoaderError(t)}const MISSING_NAME=Object.freeze({code:3e3,message:"A module name is required.",level:0}),FAIL_INSTANTIATE=Object.freeze({code:3004,message:"Failed to instantiate module: {0}",level:0}),NO_AMD_REQUIRE=Object.freeze({code:3005,message:"AMD require not supported.",level:0}),FAILED_DEP=Object.freeze({code:3006,level:0,message:"Failed to load dependency: {0}"}),INVALID_DEPS=Object.freeze({code:3007,message:"Unexpected value received for dependencies argument; expected an array.",level:0}),FAIL_LOAD=Object.freeze({code:3008,level:0,message:"Error loading {0}"}),UNRESOLVED=Object.freeze({code:3009,level:0,message:"Unable to resolve bare specifier: {0}"}),NO_BASE_URL=Object.freeze({code:3010,level:0,message:"baseUrl not set"});Object.freeze({code:3011,level:0,message:"Cannot set a loader service multiple times"});const INVALID_HOOK=Object.freeze({code:3012,level:0,message:"Invalid hook received"}),INVALID_LOADER_SERVICE_RESPONSE=Object.freeze({code:3013,level:0,message:"Invalid response received from hook"}),MODULE_LOAD_TIMEOUT=Object.freeze({code:3014,level:0,message:"Error loading {0} - timed out"}),HTTP_FAIL_LOAD=Object.freeze({code:3015,level:0,message:"Error loading {0}, status code {1}"}),STALE_HOOK_ERROR=Object.freeze({code:3016,level:0,message:"An error occurred handling module conflict"});Object.freeze({code:3017,level:0,message:"Marking module(s) as externally loaded, but they are already loaded:"});const FAIL_HOOK_LOAD=Object.freeze({code:3018,level:0,message:'Error loading "{0}" from hook'}),NO_MAPPING_URL=Object.freeze({code:3019,level:0,message:"Mapping endpoint not set"}),BAD_IMPORT_METADATA=Object.freeze({code:3020,level:0,message:"Invalid import metadata: {0} {1}"}),EXPORTER_ERROR=Object.freeze({code:3021,level:0,message:'Error evaluating module "{0}", error was "{1}"'}),UNRESOLVEABLE_MAPPING_ERROR=Object.freeze({code:3022,level:0,message:'Unexpected undefined URI resolving mapping for "{0}"'}),NO_IMPORT_LWC=Object.freeze({code:3023,level:0,message:'Cannot dynamically import "lwc" with importer "{0}"'}),NO_BLOB_IMPORT=Object.freeze({code:3024,level:0,message:"Cannot import a blob URL"});Object.freeze({code:3011,level:0,message:"import map is not valid"});const hasDocument="undefined"!=typeof document,hasSetTimeout="function"==typeof setTimeout,hasConsole="undefined"!=typeof console,hasProcess="undefined"!=typeof process,hasProcessEnv=hasProcess&&process.env;function getBaseUrl(){let e;if(hasDocument){const t=document.querySelector("base[href]");e=t&&t.href}if(!e&&"undefined"!=typeof location){e=location.href.split("#")[0].split("?")[0];const t=e.lastIndexOf("/");-1!==t&&(e=e.slice(0,t+1))}return e}function isUrl(e){return-1!==e.indexOf("://")}function resolveIfNotPlainOrUrl(e,t){if(-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/")),"/"===e[0]&&"/"===e[1])return t.slice(0,t.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const r=t.slice(0,t.indexOf(":")+1);let o;if("/"===t[r.length+1]?"file:"!==r?(o=t.slice(r.length+2),o=o.slice(o.indexOf("/")+1)):o=t.slice(8):o=t.slice(r.length+("/"===t[r.length]?1:0)),"/"===e[0])return t.slice(0,t.length-o.length-1)+e;const i=o.slice(0,o.lastIndexOf("/")+1)+e,n=[];let s=-1;for(let e=0;e<i.length;e++)-1!==s?"/"===i[e]&&(n.push(i.slice(s,e+1)),s=-1):"."===i[e]?"."!==i[e+1]||"/"!==i[e+2]&&e+2!==i.length?"/"===i[e+1]||e+1===i.length?e+=1:s=e:(n.pop(),e+=2):s=e;return-1!==s&&n.push(i.slice(s)),t.slice(0,t.length-o.length)+n.join("")}}function resolveUrl(e,t){return resolveIfNotPlainOrUrl(e,t)||(isUrl(e)?e:resolveIfNotPlainOrUrl("./"+e,t))}function createScript(e){const t=document.createElement("script");return t.async=!0,t.crossOrigin="anonymous",t.src=e,t}let lastWindowError$1,lastWindowErrorUrl;function loadModuleDef(e){return new Promise((function(t,r){if(hasDocument){const o=createScript(e);o.addEventListener("error",(()=>{r(new LoaderError(FAIL_LOAD,[e]))})),o.addEventListener("load",(()=>{document.head.removeChild(o),lastWindowErrorUrl===e?r(lastWindowError$1):t()})),document.head.appendChild(o)}}))}hasDocument&&window.addEventListener("error",(e=>{lastWindowErrorUrl=e.filename,lastWindowError$1=e.error}));const LOADER_PREFIX="lwr.loader.",MODULE_DEFINE=`${LOADER_PREFIX}module.define`,MODULE_DYNAMIC_LOAD=`${LOADER_PREFIX}module.dynamicLoad`,MODULE_FETCH=`${LOADER_PREFIX}module.fetch`,MODULE_ERROR=`${LOADER_PREFIX}module.error`,MAPPINGS_FETCH=`${LOADER_PREFIX}mappings.fetch`,MAPPINGS_ERROR=`${LOADER_PREFIX}mappings.error`;class ImportMetadataResolver{__init(){this.importURICache=new Map}__init2(){this.pendingURICache=new Map}__init3(){this.loadMappingHooks=[]}constructor(e,t){ImportMetadataResolver.prototype.__init.call(this),ImportMetadataResolver.prototype.__init2.call(this),ImportMetadataResolver.prototype.__init3.call(this),this.config=e,this.invalidationCallback=t}addLoadMappingHook(e){this.loadMappingHooks.push(e)}getMappingEndpoint(){return this.config.endpoints&&this.config.endpoints.uris?this.config.endpoints.uris.mapping:void 0}getModifiersAsUrlParams(){const e=this.config.endpoints?this.config.endpoints.modifiers:void 0;if(e){return`?${Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&")}`}return""}buildMappingUrl(e){return`${this.getMappingEndpoint()}${encodeURIComponent(e)}${this.getModifiersAsUrlParams()}`}getBaseUrl(){return this.config.baseUrl||""}registerImportMappings(e,t){if(!t||0===t.length){const r=e?JSON.stringify(e):"undefined";throw new LoaderError(BAD_IMPORT_METADATA,[r,t?"[]":"undefined"])}if(!e)throw new LoaderError(BAD_IMPORT_METADATA,["undefined",JSON.stringify(t)]);if(!e.imports||0===Object.keys(e.imports).length)throw new LoaderError(BAD_IMPORT_METADATA,[JSON.stringify(e),JSON.stringify(t)]);const r=e.index||{};for(const[o,i]of Object.entries(e.imports))i.forEach((e=>{const i=r[e],n=this.importURICache.get(e);if(n){const t=i||o,r=n.identity||n.uri;r!==t&&this.invalidationCallback({name:e,oldUrl:r,newUrl:t})}else this.saveImportURIRecord(e,o,i,t.includes(e))}))}getURI(e){return this.importURICache&&this.importURICache.has(e)?resolveUrl(this.importURICache.get(e).uri,this.getBaseUrl()):void 0}resolveLocal(e){const t=this.getURI(e);return t||(isUrl(e)||e.startsWith("/")?e:void 0)}async resolve(e){let t=this.getURI(e);if(t)return t;if(isUrl(e)||e.startsWith("/"))return e;{const r=this.pendingURICache.get(e);if(r)return r;this.config.profiler.logOperationStart({id:MAPPINGS_FETCH,specifier:e});const o=(this.hasMappingHooks()?this.evaluateMappingHooks:this.fetchNewMappings).bind(this)(e).then((r=>{if(!r||!r.imports)throw new LoaderError(UNRESOLVED,[e]);if(this.registerImportMappings(r,[e]),t=this.getURI(e),!t)throw new LoaderError(UNRESOLVED,[e]);return this.config.profiler.logOperationEnd({id:MAPPINGS_FETCH,specifier:e}),t})).finally((()=>{this.pendingURICache.delete(e)}));return this.pendingURICache.set(e,o),o}}hasMappingHooks(){return this.loadMappingHooks.length>0}async evaluateMappingHooks(e){const t=this.loadMappingHooks;if(t.length){const r=Array.from(this.importURICache.keys());for(let o=0;o<t.length;o++){const i=t[o],n=await i(e,{knownModules:r});if(n||void 0===n)return n}}return this.fetchNewMappings(e)}async fetchNewMappings(e){if("function"!=typeof globalThis.fetch)throw new LoaderError(UNRESOLVED,[e]);const t=resolveUrl(this.buildMappingUrl(e),this.getBaseUrl());if(!t)throw new LoaderError(UNRESOLVEABLE_MAPPING_ERROR,[e]);return globalThis.fetch(t).then((t=>{if(!t.ok)throw this.config.profiler.logOperationStart({id:MAPPINGS_ERROR,specifier:e}),new LoaderError(UNRESOLVED,[e]);return t.json().then((e=>e))})).catch((t=>{throw new LoaderError(UNRESOLVED,[e])}))}saveImportURIRecord(e,t,r,o){r&&t!==r?this.importURICache.set(e,{uri:t,identity:r,isRoot:o}):this.importURICache.set(e,{uri:t,isRoot:o})}}function reportError(e){hasConsole&&console.error(e)}function evaluateHandleStaleModuleHooks(e,t){const{name:r,oldUrl:o,newUrl:i}=t;for(let t=0;t<e.length;t++){const n=e[t];try{if(null!==n({name:r,oldUrl:o,newUrl:i}))break}catch(e){reportError(new LoaderError(STALE_HOOK_ERROR))}}}const MODULE_LOAD_TIMEOUT_TIMER=6e4;var MODULE_WARNING;!function(e){e.MODULE_REDEFINE="Module redefine attempted";e.MODULE_ALREADY_LOADED="Marking module(s) as externally loaded, but they are already loaded";e.ALIAS_UPDATE="Alias update attempt"}(MODULE_WARNING||(MODULE_WARNING={}));
7
+ /* LWR Module Loader Shim v0.19.1 */
8
+ !function(){"use strict";var e=function(e){return e[e.Start=0]="Start",e[e.End=1]="End",e}(e||{});let t;function r(e){t=e}const o=globalThis.performance,i=void 0!==o&&"function"==typeof o.mark&&"function"==typeof o.clearMarks&&"function"==typeof o.measure&&"function"==typeof o.clearMeasures;function n(e,t){return t?`${e}-${t}`:e}function s(e,t,r){const o=n(e,t);return t&&r?`${o}_${r}`:o}function a(e,t){const r=e||t?{...t}:null;return r&&e&&(r.specifier=e),r}function l({id:r,specifier:n,specifierIndex:l,metadata:d}){if(t)t({id:r,phase:e.Start,specifier:n,metadata:d,specifierIndex:l});else if(i){const e=s(r,n,l),t=a(n,d);o.mark(e,{detail:t})}}function d({id:r,specifier:l,specifierIndex:d,metadata:c}){if(t)t({id:r,phase:e.End,specifier:l,metadata:c,specifierIndex:d});else if(i){const e=s(r,l,d),t=n(r,l),i=a(l,c);o.measure(t,{start:e,detail:i}),o.clearMarks(e),o.clearMeasures(t)}}function c(e,t,o,i){const{autoBoot:n,customInit:s}=e;if(function(e,t){if(!e&&!t)throw new Error("The customInit hook is required when autoBoot is false");if(e&&t)throw new Error("The customInit hook must not be defined when autoBoot is true")}(n,s),s){s({initializeApp:t,define:o,onBootstrapError:i,attachDispatcher:r},e)}}const u="function"==typeof setTimeout,p="undefined"!=typeof console;class h{__init(){this.defineCache={}}__init2(){this.orderedDefs=[]}constructor(e){h.prototype.__init.call(this),h.prototype.__init2.call(this),u&&(this.watchdogTimerId=this.startWatchdogTimer()),this.global=e,this.config=e.LWR,this.loaderSpecifier="lwr/loader/v/0_19_1",this.errorHandler=this.config.onError;const t=this.tempDefine.bind(this);e.LWR.define=t,this.bootReady=this.config.autoBoot;try{this.createProfilerModule(e.LWR.define),c(Object.freeze(this.config),this.postCustomInit.bind(this),t,(e=>{this.errorHandler=e}))}catch(e){this.enterErrorState(e)}}canInit(){if(!this.config.requiredModules)throw new Error("Unexpected missing requiredModules");const e=this.config.requiredModules.every((e=>this.orderedDefs.includes(e)));return this.bootReady&&e}tempDefine(...e){const t=e[0];this.defineCache[t]=e,this.orderedDefs.push(t),this.canInit()&&(u&&clearTimeout(this.watchdogTimerId),this.initApp())}postCustomInit(){this.bootReady=!0,this.canInit()&&(u&&clearTimeout(this.watchdogTimerId),this.initApp())}initApp(){try{const e={endpoints:this.config.endpoints,baseUrl:this.config.baseUrl,profiler:{logOperationStart:l,logOperationEnd:d},appMetadata:{appId:this.config.appId,bootstrapModule:this.config.bootstrapModule,rootComponent:this.config.rootComponent,rootComponents:this.config.rootComponents}},t=function(e,t,r,o){if(!t||"function"!=typeof t[2])throw new Error(`Expected loader with specifier "${e}" to be a module`);const i={};t[2].call(null,i);const{Loader:n}=i;if(!n)throw new Error("Expected Loader class to be defined");const s=new n(r);return o&&o.length&&s.registerExternalModules(o),s.define(e,["exports"],(e=>{Object.assign(e,{define:s.define.bind(s),load:s.load.bind(s),services:s.services})})),s}(this.loaderSpecifier,this.defineCache[this.loaderSpecifier],e,this.config.preloadModules);this.mountApp(t),t&&t.getModuleWarnings}catch(e){this.enterErrorState(e)}}waitForBody(){return new Promise((e=>{if(document.body)e();else{const t=new MutationObserver((()=>{document.body&&(t.disconnect(),e())}));t.observe(document.documentElement,{childList:!0})}}))}waitForDOMContentLoaded(){return"interactive"===document.readyState||"complete"===document.readyState?Promise.resolve():new Promise((e=>{document.addEventListener("DOMContentLoaded",(()=>{e()}))}))}createProfilerModule(e){e("lwr/profiler/v/0_19_1",["exports"],(e=>{Object.assign(e,{logOperationStart:l,logOperationEnd:d})}))}mountApp(e){const{bootstrapModule:t,rootComponent:r,rootComponents:o,serverData:i,endpoints:n,imports:s,index:a}=this.config,l=s||{};this.global.LWR=Object.freeze({define:e.define.bind(e),rootComponent:r,rootComponents:o,serverData:i||{},endpoints:n,imports:l,index:a||{},env:this.global.LWR.env}),this.orderedDefs.forEach((t=>{t!==this.loaderSpecifier&&e.define(...this.defineCache[t])}));const{initDeferDOM:d}=this.config;e.registerImportMappings({imports:l,index:a},[t,r]).then((()=>"undefined"==typeof window||void 0===typeof document?Promise.resolve():d?this.waitForDOMContentLoaded():this.waitForBody())).then((()=>e.load(t))).catch((e=>{this.enterErrorState(new Error(`Application ${r||t} could not be loaded: ${e}`))}))}enterErrorState(e){l({id:"lwr.bootstrap.error"}),this.errorHandler?this.errorHandler(e):p&&console.error(`An error occurred during LWR bootstrap. ${e.message}`,e.stack)}startWatchdogTimer(){return setTimeout((()=>{this.enterErrorState(new Error("Failed to load required modules - timed out"))}),6e4)}logWarnings(e){for(const t in e)e[t].length&&console.warn(t,e[t])}}const f=globalThis;f.LWR.requiredModules=f.LWR.requiredModules||[],f.LWR.requiredModules.indexOf("lwr/loader/v/0_19_1")<0&&f.LWR.requiredModules.push("lwr/loader/v/0_19_1"),new h(f)}(),LWR.define("lwr/loader/v/0_19_1",["exports"],(function(exports){"use strict";const templateRegex=/\{([0-9]+)\}/g;function templateString(e,t){return e.replace(templateRegex,((e,r)=>t[r]))}function generateErrorMessage(e,t){const r=Array.isArray(t)?templateString(e.message,t):e.message;return`LWR${e.code}: ${r}`}class LoaderError extends Error{constructor(e,t){super(),this.message=generateErrorMessage(e,t)}}function invariant(e,t){if(!e)throw new LoaderError(t)}const MISSING_NAME=Object.freeze({code:3e3,message:"A module name is required.",level:0}),FAIL_INSTANTIATE=Object.freeze({code:3004,message:"Failed to instantiate module: {0}",level:0}),NO_AMD_REQUIRE=Object.freeze({code:3005,message:"AMD require not supported.",level:0}),FAILED_DEP=Object.freeze({code:3006,level:0,message:"Failed to load dependency: {0}"}),INVALID_DEPS=Object.freeze({code:3007,message:"Unexpected value received for dependencies argument; expected an array.",level:0}),FAIL_LOAD=Object.freeze({code:3008,level:0,message:"Error loading {0}"}),UNRESOLVED=Object.freeze({code:3009,level:0,message:"Unable to resolve bare specifier: {0}"}),NO_BASE_URL=Object.freeze({code:3010,level:0,message:"baseUrl not set"});Object.freeze({code:3011,level:0,message:"Cannot set a loader service multiple times"});const INVALID_HOOK=Object.freeze({code:3012,level:0,message:"Invalid hook received"}),INVALID_LOADER_SERVICE_RESPONSE=Object.freeze({code:3013,level:0,message:"Invalid response received from hook"}),MODULE_LOAD_TIMEOUT=Object.freeze({code:3014,level:0,message:"Error loading {0} - timed out"}),HTTP_FAIL_LOAD=Object.freeze({code:3015,level:0,message:"Error loading {0}, status code {1}"}),STALE_HOOK_ERROR=Object.freeze({code:3016,level:0,message:"An error occurred handling module conflict"});Object.freeze({code:3017,level:0,message:"Marking module(s) as externally loaded, but they are already loaded:"});const FAIL_HOOK_LOAD=Object.freeze({code:3018,level:0,message:'Error loading "{0}" from hook'}),NO_MAPPING_URL=Object.freeze({code:3019,level:0,message:"Mapping endpoint not set"}),BAD_IMPORT_METADATA=Object.freeze({code:3020,level:0,message:"Invalid import metadata: {0} {1}"}),EXPORTER_ERROR=Object.freeze({code:3021,level:0,message:'Error evaluating module "{0}", error was "{1}"'}),UNRESOLVEABLE_MAPPING_ERROR=Object.freeze({code:3022,level:0,message:'Unexpected undefined URI resolving mapping for "{0}"'}),NO_IMPORT_LWC=Object.freeze({code:3023,level:0,message:'Cannot dynamically import "lwc" with importer "{0}"'}),NO_BLOB_IMPORT=Object.freeze({code:3024,level:0,message:"Cannot import a blob URL"});Object.freeze({code:3011,level:0,message:"import map is not valid"});const hasDocument="undefined"!=typeof document,hasSetTimeout="function"==typeof setTimeout,hasConsole="undefined"!=typeof console,hasProcess="undefined"!=typeof process;function getBaseUrl(){let e;if(hasDocument){const t=document.querySelector("base[href]");e=t&&t.href}if(!e&&"undefined"!=typeof location){e=location.href.split("#")[0].split("?")[0];const t=e.lastIndexOf("/");-1!==t&&(e=e.slice(0,t+1))}return e}function isUrl(e){return-1!==e.indexOf("://")}function resolveIfNotPlainOrUrl(e,t){if(-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/")),"/"===e[0]&&"/"===e[1])return t.slice(0,t.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const r=t.slice(0,t.indexOf(":")+1);let o;if("/"===t[r.length+1]?"file:"!==r?(o=t.slice(r.length+2),o=o.slice(o.indexOf("/")+1)):o=t.slice(8):o=t.slice(r.length+("/"===t[r.length]?1:0)),"/"===e[0])return t.slice(0,t.length-o.length-1)+e;const i=o.slice(0,o.lastIndexOf("/")+1)+e,n=[];let s=-1;for(let e=0;e<i.length;e++)-1!==s?"/"===i[e]&&(n.push(i.slice(s,e+1)),s=-1):"."===i[e]?"."!==i[e+1]||"/"!==i[e+2]&&e+2!==i.length?"/"===i[e+1]||e+1===i.length?e+=1:s=e:(n.pop(),e+=2):s=e;return-1!==s&&n.push(i.slice(s)),t.slice(0,t.length-o.length)+n.join("")}}function resolveUrl(e,t){return resolveIfNotPlainOrUrl(e,t)||(isUrl(e)?e:resolveIfNotPlainOrUrl("./"+e,t))}function createScript(e){const t=document.createElement("script");return t.async=!0,t.crossOrigin="anonymous",t.src=e,t}let lastWindowError$1,lastWindowErrorUrl;function loadModuleDef(e){return new Promise((function(t,r){if(hasDocument){const o=createScript(e);o.addEventListener("error",(()=>{r(new LoaderError(FAIL_LOAD,[e]))})),o.addEventListener("load",(()=>{document.head.removeChild(o),lastWindowErrorUrl===e?r(lastWindowError$1):t()})),document.head.appendChild(o)}}))}hasProcess&&process.env,hasDocument&&window.addEventListener("error",(e=>{lastWindowErrorUrl=e.filename,lastWindowError$1=e.error}));const LOADER_PREFIX="lwr.loader.",MODULE_DEFINE=`${LOADER_PREFIX}module.define`,MODULE_DYNAMIC_LOAD=`${LOADER_PREFIX}module.dynamicLoad`,MODULE_FETCH=`${LOADER_PREFIX}module.fetch`,MODULE_ERROR=`${LOADER_PREFIX}module.error`,MAPPINGS_FETCH=`${LOADER_PREFIX}mappings.fetch`,MAPPINGS_ERROR=`${LOADER_PREFIX}mappings.error`;class ImportMetadataResolver{__init(){this.importURICache=new Map}__init2(){this.pendingURICache=new Map}__init3(){this.loadMappingHooks=[]}constructor(e,t){ImportMetadataResolver.prototype.__init.call(this),ImportMetadataResolver.prototype.__init2.call(this),ImportMetadataResolver.prototype.__init3.call(this),this.config=e,this.invalidationCallback=t}addLoadMappingHook(e){this.loadMappingHooks.push(e)}getMappingEndpoint(){return this.config.endpoints&&this.config.endpoints.uris?this.config.endpoints.uris.mapping:void 0}getModifiersAsUrlParams(){const e=this.config.endpoints?this.config.endpoints.modifiers:void 0;if(e){return`?${Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&")}`}return""}buildMappingUrl(e){return`${this.getMappingEndpoint()}${encodeURIComponent(e)}${this.getModifiersAsUrlParams()}`}getBaseUrl(){return this.config.baseUrl||""}registerImportMappings(e,t){if(!t||0===t.length){const r=e?JSON.stringify(e):"undefined";throw new LoaderError(BAD_IMPORT_METADATA,[r,t?"[]":"undefined"])}if(!e)throw new LoaderError(BAD_IMPORT_METADATA,["undefined",JSON.stringify(t)]);if(!e.imports||0===Object.keys(e.imports).length)throw new LoaderError(BAD_IMPORT_METADATA,[JSON.stringify(e),JSON.stringify(t)]);const r=e.index||{};for(const[o,i]of Object.entries(e.imports))i.forEach((e=>{const i=r[e],n=this.importURICache.get(e);if(n){const t=i||o,r=n.identity||n.uri;r!==t&&this.invalidationCallback({name:e,oldUrl:r,newUrl:t})}else this.saveImportURIRecord(e,o,i,t.includes(e))}))}getURI(e){return this.importURICache&&this.importURICache.has(e)?resolveUrl(this.importURICache.get(e).uri,this.getBaseUrl()):void 0}resolveLocal(e){const t=this.getURI(e);return t||(isUrl(e)||e.startsWith("/")?e:void 0)}async resolve(e){let t=this.getURI(e);if(t)return t;if(isUrl(e)||e.startsWith("/"))return e;{const r=this.pendingURICache.get(e);if(r)return r;this.config.profiler.logOperationStart({id:MAPPINGS_FETCH,specifier:e});const o=(this.hasMappingHooks()?this.evaluateMappingHooks:this.fetchNewMappings).bind(this)(e).then((r=>{if(!r||!r.imports)throw new LoaderError(UNRESOLVED,[e]);if(this.registerImportMappings(r,[e]),t=this.getURI(e),!t)throw new LoaderError(UNRESOLVED,[e]);return this.config.profiler.logOperationEnd({id:MAPPINGS_FETCH,specifier:e}),t})).finally((()=>{this.pendingURICache.delete(e)}));return this.pendingURICache.set(e,o),o}}hasMappingHooks(){return this.loadMappingHooks.length>0}async evaluateMappingHooks(e){const t=this.loadMappingHooks;if(t.length){const r=Array.from(this.importURICache.keys());for(let o=0;o<t.length;o++){const i=t[o],n=await i(e,{knownModules:r});if(n||void 0===n)return n}}return this.fetchNewMappings(e)}async fetchNewMappings(e){if("function"!=typeof globalThis.fetch)throw new LoaderError(UNRESOLVED,[e]);const t=resolveUrl(this.buildMappingUrl(e),this.getBaseUrl());if(!t)throw new LoaderError(UNRESOLVEABLE_MAPPING_ERROR,[e]);return globalThis.fetch(t).then((t=>{if(!t.ok)throw this.config.profiler.logOperationStart({id:MAPPINGS_ERROR,specifier:e}),new LoaderError(UNRESOLVED,[e]);return t.json().then((e=>e))})).catch((t=>{throw new LoaderError(UNRESOLVED,[e])}))}saveImportURIRecord(e,t,r,o){r&&t!==r?this.importURICache.set(e,{uri:t,identity:r,isRoot:o}):this.importURICache.set(e,{uri:t,isRoot:o})}}function reportError(e){hasConsole&&console.error(e)}function evaluateHandleStaleModuleHooks(e,t){const{name:r,oldUrl:o,newUrl:i}=t;for(let t=0;t<e.length;t++){const n=e[t];try{if(null!==n({name:r,oldUrl:o,newUrl:i}))break}catch(e){reportError(new LoaderError(STALE_HOOK_ERROR))}}}const MODULE_LOAD_TIMEOUT_TIMER=6e4;var MODULE_WARNING;!function(e){e.MODULE_REDEFINE="Module redefine attempted";e.MODULE_ALREADY_LOADED="Marking module(s) as externally loaded, but they are already loaded";e.ALIAS_UPDATE="Alias update attempt"}(MODULE_WARNING||(MODULE_WARNING={}));
9
9
  /*!
10
10
  * Copyright (C) 2023 salesforce.com, inc.
11
11
  */
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
6
  */
7
- /* LWR Module Loader Shim v0.19.0-alpha.9 */
7
+ /* LWR Module Loader Shim v0.19.1 */
8
8
  (function () {
9
9
  'use strict';
10
10
 
@@ -213,7 +213,7 @@
213
213
  // Parse configuration
214
214
  this.global = global;
215
215
  this.config = global.LWR ;
216
- this.loaderSpecifier = 'lwr/loader/v/0_19_0-alpha_9';
216
+ this.loaderSpecifier = 'lwr/loader/v/0_19_1';
217
217
 
218
218
  // Set up error handler
219
219
  this.errorHandler = this.config.onError ;
@@ -364,7 +364,7 @@
364
364
  const exporter = (exports) => {
365
365
  Object.assign(exports, { logOperationStart, logOperationEnd });
366
366
  };
367
- define('lwr/profiler/v/0_19_0-alpha_9', ['exports'], exporter);
367
+ define('lwr/profiler/v/0_19_1', ['exports'], exporter);
368
368
  }
369
369
 
370
370
  // Set up the application globals, import map, root custom element...
@@ -456,8 +456,8 @@
456
456
  // The loader module is ALWAYS required
457
457
  const GLOBAL = globalThis ;
458
458
  GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
459
- if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_19_0-alpha_9') < 0) {
460
- GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_19_0-alpha_9');
459
+ if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_19_1') < 0) {
460
+ GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_19_1');
461
461
  }
462
462
  new LoaderShim(GLOBAL);
463
463
 
@@ -149,7 +149,7 @@ var ModuleRegistry = class {
149
149
  define(name, dependencies, exporter) {
150
150
  const mod = this.namedDefineRegistry.get(name);
151
151
  if (mod && mod.defined) {
152
- if (import_dom.hasProcessEnv && process.env.NODE_ENV !== "production" && process.env.MRT_HMR !== "true") {
152
+ if (process.env.NODE_ENV !== "production" && import_dom.hasProcessEnv && process.env.MRT_HMR !== "true") {
153
153
  if (!this.warnings[import_constants.MODULE_WARNING.MODULE_REDEFINE].includes(name)) {
154
154
  this.warnings[import_constants.MODULE_WARNING.MODULE_REDEFINE].push(name);
155
155
  }
@@ -489,7 +489,7 @@ var ModuleRegistry = class {
489
489
  return this.warnings;
490
490
  }
491
491
  logMessage(logType, message) {
492
- if (!import_dom.hasProcessEnv || !import_dom.hasConsole || process.env.NODE_ENV === "production") {
492
+ if (!import_dom.hasConsole || process.env.NODE_ENV === "production") {
493
493
  return;
494
494
  }
495
495
  if (logType == "warning") {
@@ -148,7 +148,7 @@ var ModuleRegistry = class {
148
148
  define(name, dependencies, exporter, signatures) {
149
149
  const mod = this.namedDefineRegistry.get(name);
150
150
  if (mod && mod.defined) {
151
- if (import_dom.hasProcessEnv && process.env.NODE_ENV !== "production" && process.env.MRT_HMR !== "true") {
151
+ if (process.env.NODE_ENV !== "production" && import_dom.hasProcessEnv && process.env.MRT_HMR !== "true") {
152
152
  if (!this.warnings[import_constants.MODULE_WARNING.MODULE_REDEFINE].includes(name)) {
153
153
  this.warnings[import_constants.MODULE_WARNING.MODULE_REDEFINE].push(name);
154
154
  }
@@ -506,7 +506,7 @@ var ModuleRegistry = class {
506
506
  return this.warnings;
507
507
  }
508
508
  logMessage(logType, message) {
509
- if (!import_dom.hasProcessEnv || !import_dom.hasConsole || process.env.NODE_ENV === "production") {
509
+ if (!import_dom.hasConsole || process.env.NODE_ENV === "production") {
510
510
  return;
511
511
  }
512
512
  if (logType == "warning") {
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
6
  */
7
- /* LWR ESM Module Loader v0.19.0-alpha.9 */
7
+ /* LWR ESM Module Loader v0.19.1 */
8
8
  function _optionalChain$1(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
9
9
 
10
10
 
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
6
  */
7
- /* LWR Module Loader v0.19.0-alpha.9 */
7
+ /* LWR Module Loader v0.19.1 */
8
8
  const templateRegex = /\{([0-9]+)\}/g;
9
9
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
10
  function templateString(template, args) {
@@ -990,9 +990,10 @@ class ModuleRegistry {
990
990
  // Don't allow redefining a module.
991
991
  if (mod && mod.defined) {
992
992
  if (
993
- hasProcessEnv &&
993
+ // note: we always expect process.env.NODE_ENV to be replaced at build time
994
994
  // eslint-disable-next-line lwr/no-unguarded-apis
995
995
  process.env.NODE_ENV !== 'production' &&
996
+ hasProcessEnv &&
996
997
  // eslint-disable-next-line lwr/no-unguarded-apis
997
998
  process.env.MRT_HMR !== 'true'
998
999
  ) {
@@ -1503,8 +1504,9 @@ class ModuleRegistry {
1503
1504
 
1504
1505
  logMessage(logType, message) {
1505
1506
  if (
1506
- !hasProcessEnv ||
1507
- !hasConsole || // eslint-disable-next-line lwr/no-unguarded-apis
1507
+ !hasConsole ||
1508
+ // note: we always expect this to be replaced at build time
1509
+ // eslint-disable-next-line lwr/no-unguarded-apis
1508
1510
  process.env.NODE_ENV === 'production'
1509
1511
  ) {
1510
1512
  return;
@@ -138,9 +138,11 @@ export class ModuleRegistry {
138
138
  const mod = this.namedDefineRegistry.get(name);
139
139
  // Don't allow redefining a module.
140
140
  if (mod && mod.defined) {
141
- if (hasProcessEnv &&
142
- // eslint-disable-next-line lwr/no-unguarded-apis
143
- process.env.NODE_ENV !== 'production' &&
141
+ if (
142
+ // note: we always expect process.env.NODE_ENV to be replaced at build time
143
+ // eslint-disable-next-line lwr/no-unguarded-apis
144
+ process.env.NODE_ENV !== 'production' &&
145
+ hasProcessEnv &&
144
146
  // eslint-disable-next-line lwr/no-unguarded-apis
145
147
  process.env.MRT_HMR !== 'true') {
146
148
  if (!this.warnings[MODULE_WARNING.MODULE_REDEFINE].includes(name)) {
@@ -571,8 +573,9 @@ export class ModuleRegistry {
571
573
  return this.warnings;
572
574
  }
573
575
  logMessage(logType, message) {
574
- if (!hasProcessEnv ||
575
- !hasConsole || // eslint-disable-next-line lwr/no-unguarded-apis
576
+ if (!hasConsole ||
577
+ // note: we always expect this to be replaced at build time
578
+ // eslint-disable-next-line lwr/no-unguarded-apis
576
579
  process.env.NODE_ENV === 'production') {
577
580
  return;
578
581
  }
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
6
  */
7
- /* LWR Legacy Module Loader v0.19.0-alpha.9 */
7
+ /* LWR Legacy Module Loader v0.19.1 */
8
8
  const templateRegex = /\{([0-9]+)\}/g;
9
9
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
10
  function templateString(template, args) {
@@ -755,9 +755,10 @@ class ModuleRegistry {
755
755
  // Don't allow redefining a module.
756
756
  if (mod && mod.defined) {
757
757
  if (
758
- hasProcessEnv &&
758
+ // note: we always expect process.env.NODE_ENV to be replaced at build time
759
759
  // eslint-disable-next-line lwr/no-unguarded-apis
760
760
  process.env.NODE_ENV !== 'production' &&
761
+ hasProcessEnv &&
761
762
  // eslint-disable-next-line lwr/no-unguarded-apis
762
763
  process.env.MRT_HMR !== 'true'
763
764
  ) {
@@ -1290,8 +1291,9 @@ class ModuleRegistry {
1290
1291
 
1291
1292
  logMessage(logType, message) {
1292
1293
  if (
1293
- !hasProcessEnv ||
1294
- !hasConsole || // eslint-disable-next-line lwr/no-unguarded-apis
1294
+ !hasConsole ||
1295
+ // note: we always expect this to be replaced at build time
1296
+ // eslint-disable-next-line lwr/no-unguarded-apis
1295
1297
  process.env.NODE_ENV === 'production'
1296
1298
  ) {
1297
1299
  return;
@@ -136,9 +136,11 @@ export class ModuleRegistry {
136
136
  const mod = this.namedDefineRegistry.get(name);
137
137
  // Don't allow redefining a module.
138
138
  if (mod && mod.defined) {
139
- if (hasProcessEnv &&
140
- // eslint-disable-next-line lwr/no-unguarded-apis
141
- process.env.NODE_ENV !== 'production' &&
139
+ if (
140
+ // note: we always expect process.env.NODE_ENV to be replaced at build time
141
+ // eslint-disable-next-line lwr/no-unguarded-apis
142
+ process.env.NODE_ENV !== 'production' &&
143
+ hasProcessEnv &&
142
144
  // eslint-disable-next-line lwr/no-unguarded-apis
143
145
  process.env.MRT_HMR !== 'true') {
144
146
  if (!this.warnings[MODULE_WARNING.MODULE_REDEFINE].includes(name)) {
@@ -588,8 +590,9 @@ export class ModuleRegistry {
588
590
  return this.warnings;
589
591
  }
590
592
  logMessage(logType, message) {
591
- if (!hasProcessEnv ||
592
- !hasConsole || // eslint-disable-next-line lwr/no-unguarded-apis
593
+ if (!hasConsole ||
594
+ // note: we always expect this to be replaced at build time
595
+ // eslint-disable-next-line lwr/no-unguarded-apis
593
596
  process.env.NODE_ENV === 'production') {
594
597
  return;
595
598
  }
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
- "version": "0.19.0-alpha.9",
8
+ "version": "0.19.1",
9
9
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
10
10
  "repository": {
11
11
  "type": "git",
@@ -61,16 +61,16 @@
61
61
  },
62
62
  "devDependencies": {
63
63
  "@locker/trusted-types": "0.24.6",
64
- "@lwrjs/diagnostics": "0.19.0-alpha.9",
65
- "@lwrjs/types": "0.19.0-alpha.9",
64
+ "@lwrjs/diagnostics": "0.19.1",
65
+ "@lwrjs/types": "0.19.1",
66
66
  "@rollup/plugin-node-resolve": "^15.2.3",
67
67
  "@rollup/plugin-sucrase": "^5.0.2",
68
68
  "@rollup/plugin-terser": "^0.4.4",
69
69
  "rollup": "^2.79.2"
70
70
  },
71
71
  "dependencies": {
72
- "@lwrjs/client-modules": "0.19.0-alpha.9",
73
- "@lwrjs/shared-utils": "0.19.0-alpha.9"
72
+ "@lwrjs/client-modules": "0.19.1",
73
+ "@lwrjs/shared-utils": "0.19.1"
74
74
  },
75
75
  "lwc": {
76
76
  "modules": [
@@ -90,5 +90,5 @@
90
90
  "volta": {
91
91
  "extends": "../../../package.json"
92
92
  },
93
- "gitHead": "4d1ec7ea2d9a7edffd1e9e1f86e8668a5436462d"
93
+ "gitHead": "04c6989df90465662f58f61e3d6c482c086a7c44"
94
94
  }