@lwrjs/loader 0.13.1 → 0.13.3

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.13.1 */
7
+ /* LWR Error Shim v0.13.3 */
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.13.1 */
7
+ /* LWR Legacy Module Loader Shim v0.13.3 */
8
8
  (function () {
9
9
  'use strict';
10
10
 
@@ -206,7 +206,7 @@
206
206
  // Parse configuration
207
207
  this.global = global;
208
208
  this.config = global.LWR ;
209
- this.loaderModule = 'lwr/loaderLegacy/v/0_13_1';
209
+ this.loaderModule = 'lwr/loaderLegacy/v/0_13_3';
210
210
 
211
211
  // Set up error handler
212
212
  this.errorHandler = this.config.onError ;
@@ -333,7 +333,7 @@
333
333
  const exporter = (exports) => {
334
334
  Object.assign(exports, { logOperationStart, logOperationEnd });
335
335
  };
336
- define('lwr/profiler/v/0_13_1', ['exports'], exporter, {});
336
+ define('lwr/profiler/v/0_13_3', ['exports'], exporter, {});
337
337
  }
338
338
 
339
339
  // Set up the application globals, import map, root custom element...
@@ -405,14 +405,14 @@
405
405
  // The loader module is ALWAYS required
406
406
  const GLOBAL = globalThis ;
407
407
  GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
408
- if (GLOBAL.LWR.requiredModules.indexOf('lwr/loaderLegacy/v/0_13_1') < 0) {
409
- GLOBAL.LWR.requiredModules.push('lwr/loaderLegacy/v/0_13_1');
408
+ if (GLOBAL.LWR.requiredModules.indexOf('lwr/loaderLegacy/v/0_13_3') < 0) {
409
+ GLOBAL.LWR.requiredModules.push('lwr/loaderLegacy/v/0_13_3');
410
410
  }
411
411
  new LoaderShim(GLOBAL);
412
412
 
413
413
  })();
414
414
 
415
- LWR.define('lwr/loaderLegacy/v/0_13_1', ['exports'], (function (exports) { 'use strict';
415
+ LWR.define('lwr/loaderLegacy/v/0_13_3', ['exports'], (function (exports) { 'use strict';
416
416
 
417
417
  const templateRegex = /\{([0-9]+)\}/g;
418
418
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -546,7 +546,11 @@ LWR.define('lwr/loaderLegacy/v/0_13_1', ['exports'], (function (exports) { 'use
546
546
  const hasSetTimeout = typeof setTimeout === 'function';
547
547
 
548
548
  const hasConsole = typeof console !== 'undefined';
549
- /* eslint-enable lwr/no-unguarded-apis */
549
+
550
+ const hasProcess = typeof process !== 'undefined';
551
+
552
+ // eslint-disable-next-line no-undef
553
+ const hasProcessEnv = hasProcess && process.env;
550
554
 
551
555
  function getBaseUrl() {
552
556
  let baseUrl = undefined;
@@ -786,7 +790,7 @@ LWR.define('lwr/loaderLegacy/v/0_13_1', ['exports'], (function (exports) { 'use
786
790
  // swallow
787
791
  }
788
792
  const trusted = createPolicy('trusted', policyOptions);
789
- /*! version: 0.22.4 */
793
+ /*! version: 0.22.5 */
790
794
 
791
795
  /* global console,process */
792
796
 
@@ -798,6 +802,7 @@ LWR.define('lwr/loaderLegacy/v/0_13_1', ['exports'], (function (exports) { 'use
798
802
  });
799
803
  }
800
804
 
805
+ // eslint-disable-next-line lwr/no-unguarded-apis
801
806
  if (process.env.NODE_ENV !== 'production') {
802
807
  if (!hasSetTimeout && hasConsole) {
803
808
  // eslint-disable-next-line lwr/no-unguarded-apis
@@ -857,6 +862,7 @@ LWR.define('lwr/loaderLegacy/v/0_13_1', ['exports'], (function (exports) { 'use
857
862
  // TODO eval source maps for debugging
858
863
  eval(trusted.createScript(code));
859
864
  } catch (e) {
865
+ // eslint-disable-next-line lwr/no-unguarded-apis
860
866
  if (process.env.NODE_ENV !== 'production' && hasConsole) {
861
867
  // eslint-disable-next-line lwr/no-unguarded-apis
862
868
  console.error(e);
@@ -1121,7 +1127,14 @@ LWR.define('lwr/loaderLegacy/v/0_13_1', ['exports'], (function (exports) { 'use
1121
1127
  const mod = this.namedDefineRegistry.get(name);
1122
1128
  // Don't allow redefining a module.
1123
1129
  if (mod && mod.defined) {
1124
- if (process.env.NODE_ENV !== 'production' && process.env.MRT_HMR !== 'true' && hasConsole) {
1130
+ if (
1131
+ hasProcessEnv &&
1132
+ // eslint-disable-next-line lwr/no-unguarded-apis
1133
+ process.env.NODE_ENV !== 'production' &&
1134
+ // eslint-disable-next-line lwr/no-unguarded-apis
1135
+ process.env.MRT_HMR !== 'true' &&
1136
+ hasConsole
1137
+ ) {
1125
1138
  // eslint-disable-next-line lwr/no-unguarded-apis
1126
1139
  console.warn(`Module redefine attempted: ${name}`);
1127
1140
  }
@@ -1184,6 +1197,7 @@ LWR.define('lwr/loaderLegacy/v/0_13_1', ['exports'], (function (exports) { 'use
1184
1197
  },
1185
1198
  };
1186
1199
  this.namedDefineRegistry.set(id, moduleDef );
1200
+ // eslint-disable-next-line lwr/no-unguarded-apis
1187
1201
  } else if (process.env.NODE_ENV !== 'production' && hasConsole) {
1188
1202
  // eslint-disable-next-line lwr/no-unguarded-apis
1189
1203
  console.warn(MODULE_ALREADY_LOADED.message, id);
@@ -1216,6 +1230,7 @@ LWR.define('lwr/loaderLegacy/v/0_13_1', ['exports'], (function (exports) { 'use
1216
1230
  newHash: signature,
1217
1231
  });
1218
1232
  } else {
1233
+ // eslint-disable-next-line lwr/no-unguarded-apis
1219
1234
  if (process.env.NODE_ENV !== 'production' && hasConsole) {
1220
1235
  // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
1221
1236
  console.warn(
@@ -1314,6 +1329,7 @@ LWR.define('lwr/loaderLegacy/v/0_13_1', ['exports'], (function (exports) { 'use
1314
1329
  // Warn the user if they were not aliasing to the resolvedId
1315
1330
  const currentResolvedId = this.aliases.get(aliasId);
1316
1331
  if (currentResolvedId !== resolvedId) {
1332
+ // eslint-disable-next-line lwr/no-unguarded-apis
1317
1333
  if (process.env.NODE_ENV !== 'production' && hasConsole) {
1318
1334
  // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
1319
1335
  console.warn(`Alias update attempt: ${aliasId}=>${currentResolvedId}, ${resolvedId}`);
@@ -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.13.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 n(e,t){return t?`${e}-${t}`:e}function i(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});else if(s){const e=i(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});else if(s){const e=i(r,l,d),t=n(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:n,customInit:i}=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,i),i){i({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_13_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:n}=s;if(!n)throw new Error("Expected Loader class to be defined");const i=new n(r);return o&&o.length&&i.registerExternalModules(o),i.define(e,["exports"],(e=>{Object.assign(e,{define:i.define.bind(i),load:i.load.bind(i),services:i.services,clearRegistry:i.clearRegistry.bind(i)})}),t[3]),i}(this.loaderModule,this.defineCache[this.loaderModule],e,this.config.preloadModules);this.mountApp(t)}catch(e){this.enterErrorState(e)}}waitForDOMContentLoaded(){return void 0===typeof document||"interactive"===document.readyState||"complete"===document.readyState?Promise.resolve():new Promise((e=>{document.addEventListener("DOMContentLoaded",(()=>{e()}))}))}createProfilerModule(e){e("lwr/profiler/v/0_13_1",["exports"],(e=>{Object.assign(e,{logOperationStart:l,logOperationEnd:d})}),{})}mountApp(e){const{bootstrapModule:t,rootComponent:r,importMappings:o,rootComponents:s,serverData:n,endpoints:i}=this.config;this.global.LWR=Object.freeze({define:e.define.bind(e),rootComponent:r,rootComponents:s,serverData:n||{},importMappings:o,endpoints:i,env:this.global.LWR.env}),this.orderedDefs.forEach((t=>{t!==this.loaderModule&&e.define(...this.defineCache[t])}));const{disableInitDefer:a}=this.config;e.registerImportMappings(o).then((()=>{if(!a)return this.waitForDOMContentLoaded()})).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)}}const h=globalThis;h.LWR.requiredModules=h.LWR.requiredModules||[],h.LWR.requiredModules.indexOf("lwr/loaderLegacy/v/0_13_1")<0&&h.LWR.requiredModules.push("lwr/loaderLegacy/v/0_13_1"),new f(h)}(),LWR.define("lwr/loaderLegacy/v/0_13_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}'}),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;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,n=[];let i=-1;for(let e=0;e<s.length;e++)-1!==i?"/"===s[e]&&(n.push(s.slice(i,e+1)),i=-1):"."===s[e]?"."!==s[e+1]||"/"!==s[e+2]&&e+2!==s.length?"/"===s[e+1]||e+1===s.length?e+=1:i=e:(n.pop(),e+=2):i=e;return-1!==i&&n.push(s.slice(i)),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 MODULE_LOAD_TIMEOUT_TIMER=6e4,SUPPORTS_TRUSTED_TYPES="undefined"!=typeof trustedTypes;
7
+ /* LWR Legacy Module Loader Shim v0.13.3 */
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 n(e,t){return t?`${e}-${t}`:e}function i(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});else if(s){const e=i(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});else if(s){const e=i(r,l,d),t=n(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:n,customInit:i}=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,i),i){i({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_13_3",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:n}=s;if(!n)throw new Error("Expected Loader class to be defined");const i=new n(r);return o&&o.length&&i.registerExternalModules(o),i.define(e,["exports"],(e=>{Object.assign(e,{define:i.define.bind(i),load:i.load.bind(i),services:i.services,clearRegistry:i.clearRegistry.bind(i)})}),t[3]),i}(this.loaderModule,this.defineCache[this.loaderModule],e,this.config.preloadModules);this.mountApp(t)}catch(e){this.enterErrorState(e)}}waitForDOMContentLoaded(){return void 0===typeof document||"interactive"===document.readyState||"complete"===document.readyState?Promise.resolve():new Promise((e=>{document.addEventListener("DOMContentLoaded",(()=>{e()}))}))}createProfilerModule(e){e("lwr/profiler/v/0_13_3",["exports"],(e=>{Object.assign(e,{logOperationStart:l,logOperationEnd:d})}),{})}mountApp(e){const{bootstrapModule:t,rootComponent:r,importMappings:o,rootComponents:s,serverData:n,endpoints:i}=this.config;this.global.LWR=Object.freeze({define:e.define.bind(e),rootComponent:r,rootComponents:s,serverData:n||{},importMappings:o,endpoints:i,env:this.global.LWR.env}),this.orderedDefs.forEach((t=>{t!==this.loaderModule&&e.define(...this.defineCache[t])}));const{disableInitDefer:a}=this.config;e.registerImportMappings(o).then((()=>{if(!a)return this.waitForDOMContentLoaded()})).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)}}const h=globalThis;h.LWR.requiredModules=h.LWR.requiredModules||[],h.LWR.requiredModules.indexOf("lwr/loaderLegacy/v/0_13_3")<0&&h.LWR.requiredModules.push("lwr/loaderLegacy/v/0_13_3"),new f(h)}(),LWR.define("lwr/loaderLegacy/v/0_13_3",["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}'}),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,n=[];let i=-1;for(let e=0;e<s.length;e++)-1!==i?"/"===s[e]&&(n.push(s.slice(i,e+1)),i=-1):"."===s[e]?"."!==s[e+1]||"/"!==s[e+2]&&e+2!==s.length?"/"===s[e+1]||e+1===s.length?e+=1:i=e:(n.pop(),e+=2):i=e;return-1!==i&&n.push(s.slice(i)),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 MODULE_LOAD_TIMEOUT_TIMER=6e4,SUPPORTS_TRUSTED_TYPES="undefined"!=typeof trustedTypes;
9
9
  /*!
10
10
  * Copyright (C) 2023 salesforce.com, inc.
11
11
  */function createTrustedTypesPolicy(e,t){return trustedTypes.createPolicy(e,t)}function createFallbackPolicy(e,t){return t}const createPolicy=SUPPORTS_TRUSTED_TYPES?createTrustedTypesPolicy:createFallbackPolicy,policyOptions={createHTML:e=>e,createScript:e=>e,createScriptURL:e=>e};try{createPolicy("default",{createHTML:e=>e,createScript(e){if("null"===e||"undefined"===e)return e},createScriptURL:e=>e})}catch(e){}const trusted=createPolicy("trusted",policyOptions);let lastWindowError;function isCustomResponse(e){return Object.prototype.hasOwnProperty.call(e,"data")&&!Object.prototype.hasOwnProperty.call(e,"blob")}function isFetchResponse(e){return"function"==typeof e.blob}function isResponseAPromise(e){return!(!e||!e.then)}async function evaluateLoadHookResponse(response,id){return Promise.resolve().then((async()=>{if(!response||!response.status)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(200!==response.status)throw new LoaderError(HTTP_FAIL_LOAD,[id,`${response.status}`]);const isResponse=isFetchResponse(response);let code;if(isCustomResponse(response))code=response.data;else{if(!isResponse)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);code=await response.text()}if(!code)throw new LoaderError(FAIL_LOAD,[id]);code=`${code}\n//# sourceURL=${id}`;try{eval(trusted.createScript(code))}catch(e){throw new LoaderError(FAIL_LOAD,[id])}if(lastWindowError)throw new LoaderError(FAIL_LOAD,[id]);return!0}))}async function evaluateLoadHook(e,t){return hasSetTimeout?new Promise(((r,o)=>{const s=setTimeout((()=>{o(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER);t.then((e=>{r(e)})).catch((()=>{o(new LoaderError(FAIL_HOOK_LOAD,[e]))})).finally((()=>{clearTimeout(s)}))})):t}function reportError(e){hasConsole&&console.error(e)}function evaluateHandleStaleModuleHooks(e,t){const{name:r,oldHash:o,newHash:s}=t;for(let t=0;t<e.length;t++){const n=e[t];try{if(null!==n({name:r,oldHash:o,newHash:s}))break}catch(e){reportError(new LoaderError(STALE_HOOK_ERROR))}}}hasDocument&&globalThis.addEventListener("error",(e=>{lastWindowError=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`;class ModuleRegistry{constructor(e){ModuleRegistry.prototype.__init.call(this),ModuleRegistry.prototype.__init2.call(this),ModuleRegistry.prototype.__init3.call(this),this.baseUrl=e.baseUrl||"",this.profiler=e.profiler}clearRegistry(){this.moduleRegistry=new Map}async load(e,t){const r=t?{importer:t}:{};this.profiler.logOperationStart({id:MODULE_DYNAMIC_LOAD,specifier:e,metadata:r});const o=await this.resolve(e,t),s=await this.getModuleRecord(o,e);return s.evaluated?s.module:(s.evaluationPromise||(s.evaluationPromise=this.topLevelEvaluation(s)),s.evaluationPromise)}async resolve(e,t){const r=this.baseUrl;let o,s=e;const n=this.resolveHook;let i=!0;if(n){for(let e=0;e<n.length;e++){const t=(0,n[e])(s,{parentUrl:r});let i;if((t||null===t)&&(i=isResponseAPromise(t)?await t:t),!this.isValidResolveResponse(i))throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(null!==i){if("string"==typeof i){if(resolveIfNotPlainOrUrl(i,r))throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);s=i;continue}if(o=i&&i.url&&(resolveIfNotPlainOrUrl(i.url,r)||i.url),!o)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);break}}if(s!==e){if(!o&&this.namedDefineRegistry.has(s))return s;e=s}}if(!o){const t=resolveIfNotPlainOrUrl(e,r)||e;if(this.moduleRegistry.has(t))return t;if(this.resolver){const e=this.resolver.resolve(t,r);if(o=e&&e.uri,i=e?!!e.defaultUri:i,this.namedDefineRegistry.has(t)){const e=this.namedDefineRegistry.get(t);if(e.external||e.defined){if(!this.moduleRegistry.get(o)||!this.aliases.has(t))return t}}}else o=t}if(!o||!isUrl(o)){if(this.namedDefineRegistry.has(e))return e;throw new LoaderError(UNRESOLVED,[e])}return i&&t&&isUrl(o)&&(o+=`?importer=${encodeURIComponent(t)}`),o}has(e){return this.moduleRegistry.has(e)}define(e,t,r,o){const s=this.namedDefineRegistry.get(e);if(s&&s.defined)return void(this.lastDefine=s);const n={name:e,dependencies:t,exporter:r,signatures:o,defined:!0};s&&s.external&&s.external.resolveExternal(n),this.profiler.logOperationStart({id:MODULE_DEFINE,specifier:e}),this.namedDefineRegistry.set(e,n),this.lastDefine=n,o.hashes&&Object.entries(o.hashes).forEach((([e,t])=>{this.checkModuleSignature(e,t)}))}registerExternalModules(e){e.map((e=>{if(!this.namedDefineRegistry.has(e)){let t,r;const o=new Promise(((o,s)=>{t=o,r=setTimeout((()=>{s(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER)})).finally((()=>{clearTimeout(r)})),s={name:e,defined:!1,external:{resolveExternal:t,moduleDefPromise:o}};this.namedDefineRegistry.set(e,s)}}))}checkModuleSignature(e,t){const r=this.namedDefineRegistry.get(e);if(!r){const r={name:e,signatures:{ownHash:t},defined:!1};return void this.namedDefineRegistry.set(e,r)}const o=r.signatures?r.signatures.ownHash:void 0;if(o&&t!==o){const r=this.handleStaleModuleHook;r&&evaluateHandleStaleModuleHooks(r,{name:e,oldHash:o,newHash:t})}}setImportResolver(e){this.resolver=e}__init(){this.namedDefineRegistry=new Map}__init2(){this.moduleRegistry=new Map}__init3(){this.aliases=new Map}getExistingModuleRecord(e,t){const r=this.moduleRegistry.get(e);if(r)return this.storeModuleAlias(t,e),r;if(e!==t){const e=this.aliases.get(t);if(e){const t=this.moduleRegistry.get(e);if(t)return t}}return r}async getModuleRecord(e,t){const r=this.getExistingModuleRecord(e,t);if(r)return r;const o=this.getModuleDef(e,t),s=o.then((e=>{const t=(e&&e.dependencies||[]).map((e=>{if("exports"!==e)return invariant("require"!==e,NO_AMD_REQUIRE),this.getModuleDependencyRecord.call(this,e)})).filter((e=>void 0!==e));return Promise.all(t)})),n={id:e,module:Object.create(null),dependencyRecords:s,instantiation:o,evaluated:!1,evaluationPromise:null};return this.moduleRegistry.set(e,n),this.storeModuleAlias(t,e),s.then((()=>n))}storeModuleAlias(e,t){e!==t&&(this.aliases.has(e)?hasConsole&&this.aliases.get(e):this.aliases.set(e,t))}async getModuleDependencyRecord(e){const t=await this.resolve(e);return this.getModuleRecord(t,e)}async topLevelEvaluation(e){return await this.instantiateAll(e,{}),this.evaluateModule(e,{})}async instantiateAll(e,t){if(!t[e.id]){t[e.id]=!0;const r=await e.dependencyRecords;if(r)for(let e=0;e<r.length;e++){const o=r[e];await this.instantiateAll(o,t)}}}async evaluateModule(e,t){const r=await e.dependencyRecords;r.length>0&&(t[e.id]=!0,await this.evaluateModuleDependencies(r,t));const{exporter:o,dependencies:s}=await e.instantiation,n={},i=s?await Promise.all(s.map((async e=>{if("exports"===e)return n;const t=await this.resolve(e),r=this.moduleRegistry.get(t);if(!r)throw new LoaderError(FAILED_DEP,[t]);const o=r.module;if(!r.evaluated)return this.getCircularDependencyWrapper(o);if(o)return o.__defaultInterop?o.default:o;throw new LoaderError(FAILED_DEP,[t])}))):[];if(e.evaluated)return e.module;let a;try{a=o(...i)}catch(t){throw new LoaderError(EXPORTER_ERROR,[e.id,t.message||t])}void 0!==a?(a={default:a},Object.defineProperty(a,"__defaultInterop",{value:!0})):this.isNamedExportDefaultOnly(n)&&Object.defineProperty(n,"__useDefault",{value:!0});const l=a||n;for(const t in l)Object.defineProperty(e.module,t,{enumerable:!0,set(e){l[t]=e},get:()=>l[t]});return l.__useDefault&&Object.defineProperty(e.module,"__useDefault",{value:!0}),l.__defaultInterop&&Object.defineProperty(e.module,"__defaultInterop",{value:!0}),l.__esModule&&Object.defineProperty(e.module,"__esModule",{value:!0}),e.evaluated=!0,Object.freeze(e.module),e.module}isNamedExportDefaultOnly(e){return void 0!==e&&2===Object.getOwnPropertyNames(e).length&&Object.prototype.hasOwnProperty.call(e,"default")&&Object.prototype.hasOwnProperty.call(e,"__esModule")}getCircularDependencyWrapper(e){const t=()=>e.__useDefault||e.__defaultInterop?e.default:e;return t.__circular__=!0,t}async evaluateModuleDependencies(e,t){for(let r=0;r<e.length;r++){const o=e[r];o.evaluated||t[o.id]||(t[o.id]=!0,await this.evaluateModule(o,t))}}async getModuleDef(e,t){this.lastDefine=void 0;const r=isUrl(e)?t!==e?t:void 0:e;let o=r&&this.namedDefineRegistry.get(r);if(o&&o.external)return o.external.moduleDefPromise;if(o&&o.defined)return o;const s=this.baseUrl,n=r||t;return this.profiler.logOperationStart({id:MODULE_FETCH,specifier:n}),Promise.resolve().then((async()=>{const t=this.loadHook;if(t)for(let r=0;r<t.length;r++){const o=(0,t[r])(e,s),n=isResponseAPromise(o)?await evaluateLoadHook(e,o):o;if(void 0===n)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(n&&null!==n)return evaluateLoadHookResponse(n,e)}return!1})).then((t=>{if(!0!==t&&hasDocument)return loadModuleDef(e)})).then((()=>{if(o=r&&this.namedDefineRegistry.get(r),o||(o=this.lastDefine),!o)throw new LoaderError(FAIL_INSTANTIATE,[e]);return this.profiler.logOperationEnd({id:MODULE_FETCH,specifier:n}),o})).catch((e=>{throw e instanceof LoaderError||this.profiler.logOperationStart({id:MODULE_ERROR,specifier:n}),e}))}addLoaderPlugin(e){if("object"!=typeof e)throw new LoaderError(INVALID_HOOK);const{loadModule:t,resolveModule:r}=e;r&&(this.resolveHook?this.resolveHook.push(r):this.resolveHook=[r]),t&&(this.loadHook?this.loadHook.push(t):this.loadHook=[t])}registerHandleStaleModuleHook(e){this.handleStaleModuleHook?this.handleStaleModuleHook.push(e):this.handleStaleModuleHook=[e]}isValidResolveResponse(e){return null===e||"string"==typeof e||e&&"string"==typeof e.url}}function getMatch(e,t){if(t[e])return e;let r=e.length;do{const o=e.slice(0,r+1);if(o in t)return o}while(e.length>1&&-1!==(r=e.lastIndexOf("/",r-1)))}function targetWarning(e,t,r){hasConsole&&console.warn("Package target "+r+", resolving target '"+t+"' for "+e)}function applyPackages(e,t,r){const o=getMatch(e,t);if(o){const r=t[o];if(null===r)return;if(!(e.length>o.length&&"/"!==r[r.length-1])){if(e.length>o.length&&"/"===r[r.length-1]&&r.lastIndexOf(o)===r.length-o.length){return{uri:r.substring(0,r.lastIndexOf(o))+encodeURIComponent(e)}}return{uri:r+e.slice(o.length)}}targetWarning(o,r,"should have a trailing '/'")}else if(r&&!isUrl(e)){return{uri:r+encodeURIComponent(e),defaultUri:!0}}}function resolveImportMapEntry(e,t,r){e.scopes||(e.scopes={}),e.imports||(e.imports={});const o=e.scopes;let s=r&&getMatch(r,o);for(;s;){const e=applyPackages(t,o[s]);if(e)return e;s=getMatch(s.slice(0,s.lastIndexOf("/")),o)}return applyPackages(t,e.imports,e.default)||isUrl(t)&&{uri:t}||void 0}function resolveAndComposePackages(e,t,r,o,s){for(const n in e){const i=resolveIfNotPlainOrUrl(n,r)||n,a=e[n];if("string"!=typeof a)continue;const l=resolveImportMapEntry(o,resolveIfNotPlainOrUrl(a,r)||a,s);l?t[i]=l.uri:targetWarning(n,a,"bare specifier did not resolve")}}function resolveAndComposeImportMap(e,t,r={imports:{},scopes:{}}){const o={imports:Object.assign({},r.imports),scopes:Object.assign({},r.scopes),default:e.default};if(e.imports&&resolveAndComposePackages(e.imports,o.imports,t,r),e.scopes)for(const s in e.scopes){const n=resolveUrl(s,t);resolveAndComposePackages(e.scopes[s],o.scopes[n]||(o.scopes[n]={}),t,r,n)}return e.default&&(o.default=resolveIfNotPlainOrUrl(e.default,t)),o}class ImportMapResolver{constructor(e){this.importMap=e}resolve(e,t){return resolveImportMapEntry(this.importMap,e,t)}}const IMPORTMAP_SCRIPT_TYPE="lwr-importmap";function iterateDocumentImportMaps(e,t){const r=document.querySelectorAll(`script[type="${IMPORTMAP_SCRIPT_TYPE}"]`+t),o=Array.from(r).filter((e=>!e.src||(hasConsole&&console.warn("LWR does not support import maps from script src"),!1)));Array.prototype.forEach.call(o,e)}async function getImportMapFromScript(e){return Promise.resolve(e.innerHTML)}async function evaluateImportMaps(e){let t={imports:{},scopes:{}},r=Promise.resolve(t);if(hasDocument){if(e||(e=getBaseUrl()),!e)throw new LoaderError(NO_BASE_URL);iterateDocumentImportMaps((o=>{r=r.then((()=>getImportMapFromScript(o))).then((e=>{try{return JSON.parse(e)}catch(e){throw new LoaderError(BAD_IMPORT_MAP)}})).then((r=>(t=resolveAndComposeImportMap(r,o.src||e,t),t)))}),"")}return r}function _optionalChain(e){let t,r=e[0],o=1;for(;o<e.length;){const s=e[o],n=e[o+1];if(o+=2,("optionalAccess"===s||"optionalCall"===s)&&null==r)return;"access"===s||"optionalAccess"===s?(t=r,r=n(r)):"call"!==s&&"optionalCall"!==s||(r=n(((...e)=>r.call(t,...e))),t=void 0)}return r}class Loader{constructor(e){const t=e||{};let r=t.baseUrl,o=t.profiler;if(r&&(r=r.replace(/\/?$/,"/")),r||(r=getBaseUrl()),!r)throw new LoaderError(NO_BASE_URL);this.baseUrl=r,o||(o={logOperationStart:()=>{},logOperationEnd:()=>{}}),this.registry=new ModuleRegistry({baseUrl:r,profiler:o}),this.services=Object.freeze({addLoaderPlugin:this.registry.addLoaderPlugin.bind(this.registry),handleStaleModule:this.registry.registerHandleStaleModuleHook.bind(this.registry),appMetadata:_optionalChain([e,"optionalAccess",e=>e.appMetadata])})}define(e,t,r,o){invariant("string"==typeof e,MISSING_NAME);let s=r,n=t,i=o;"function"==typeof n&&(s=t,n=[],i=r),i=i||{},invariant(Array.isArray(n),INVALID_DEPS),this.registry.define(e,n,s,i)}async load(e,t){return this.registry.load(e,t)}clearRegistry(){this.registry.clearRegistry()}has(e){return this.registry.has(e)}async resolve(e,t){return this.registry.resolve(e,t)}async registerImportMappings(e){let t;if(t=e?resolveAndComposeImportMap(e,this.baseUrl,this.parentImportMap):await evaluateImportMaps(this.baseUrl),this.parentImportMap=t,this.parentImportMap){const e=new ImportMapResolver(this.parentImportMap);this.registry.setImportResolver(e)}}registerExternalModules(e){this.registry.registerExternalModules(e)}}exports.Loader=Loader,Object.defineProperty(exports,"__esModule",{value:!0})}));
@@ -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.13.1 */
7
+ /* LWR Legacy Module Loader Shim v0.13.3 */
8
8
  (function () {
9
9
  'use strict';
10
10
 
@@ -206,7 +206,7 @@
206
206
  // Parse configuration
207
207
  this.global = global;
208
208
  this.config = global.LWR ;
209
- this.loaderModule = 'lwr/loaderLegacy/v/0_13_1';
209
+ this.loaderModule = 'lwr/loaderLegacy/v/0_13_3';
210
210
 
211
211
  // Set up error handler
212
212
  this.errorHandler = this.config.onError ;
@@ -333,7 +333,7 @@
333
333
  const exporter = (exports) => {
334
334
  Object.assign(exports, { logOperationStart, logOperationEnd });
335
335
  };
336
- define('lwr/profiler/v/0_13_1', ['exports'], exporter, {});
336
+ define('lwr/profiler/v/0_13_3', ['exports'], exporter, {});
337
337
  }
338
338
 
339
339
  // Set up the application globals, import map, root custom element...
@@ -405,8 +405,8 @@
405
405
  // The loader module is ALWAYS required
406
406
  const GLOBAL = globalThis ;
407
407
  GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
408
- if (GLOBAL.LWR.requiredModules.indexOf('lwr/loaderLegacy/v/0_13_1') < 0) {
409
- GLOBAL.LWR.requiredModules.push('lwr/loaderLegacy/v/0_13_1');
408
+ if (GLOBAL.LWR.requiredModules.indexOf('lwr/loaderLegacy/v/0_13_3') < 0) {
409
+ GLOBAL.LWR.requiredModules.push('lwr/loaderLegacy/v/0_13_3');
410
410
  }
411
411
  new LoaderShim(GLOBAL);
412
412
 
@@ -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.13.1 */
7
+ /* LWR Module Loader Shim v0.13.3 */
8
8
  (function () {
9
9
  'use strict';
10
10
 
@@ -209,7 +209,7 @@
209
209
  // Parse configuration
210
210
  this.global = global;
211
211
  this.config = global.LWR ;
212
- this.loaderSpecifier = 'lwr/loader/v/0_13_1';
212
+ this.loaderSpecifier = 'lwr/loader/v/0_13_3';
213
213
 
214
214
  // Set up error handler
215
215
  this.errorHandler = this.config.onError ;
@@ -337,7 +337,7 @@
337
337
  const exporter = (exports) => {
338
338
  Object.assign(exports, { logOperationStart, logOperationEnd });
339
339
  };
340
- define('lwr/profiler/v/0_13_1', ['exports'], exporter);
340
+ define('lwr/profiler/v/0_13_3', ['exports'], exporter);
341
341
  }
342
342
 
343
343
  // Set up the application globals, import map, root custom element...
@@ -414,14 +414,14 @@
414
414
  // The loader module is ALWAYS required
415
415
  const GLOBAL = globalThis ;
416
416
  GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
417
- if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_13_1') < 0) {
418
- GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_13_1');
417
+ if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_13_3') < 0) {
418
+ GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_13_3');
419
419
  }
420
420
  new LoaderShim(GLOBAL);
421
421
 
422
422
  })();
423
423
 
424
- LWR.define('lwr/loader/v/0_13_1', ['exports'], (function (exports) { 'use strict';
424
+ LWR.define('lwr/loader/v/0_13_3', ['exports'], (function (exports) { 'use strict';
425
425
 
426
426
  const templateRegex = /\{([0-9]+)\}/g;
427
427
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -570,7 +570,11 @@ LWR.define('lwr/loader/v/0_13_1', ['exports'], (function (exports) { 'use strict
570
570
  const hasSetTimeout = typeof setTimeout === 'function';
571
571
 
572
572
  const hasConsole = typeof console !== 'undefined';
573
- /* eslint-enable lwr/no-unguarded-apis */
573
+
574
+ const hasProcess = typeof process !== 'undefined';
575
+
576
+ // eslint-disable-next-line no-undef
577
+ const hasProcessEnv = hasProcess && process.env;
574
578
 
575
579
  function getBaseUrl() {
576
580
  let baseUrl = undefined;
@@ -1072,7 +1076,7 @@ LWR.define('lwr/loader/v/0_13_1', ['exports'], (function (exports) { 'use strict
1072
1076
  // swallow
1073
1077
  }
1074
1078
  const trusted = createPolicy('trusted', policyOptions);
1075
- /*! version: 0.22.4 */
1079
+ /*! version: 0.22.5 */
1076
1080
 
1077
1081
  /* global console,process */
1078
1082
 
@@ -1084,6 +1088,7 @@ LWR.define('lwr/loader/v/0_13_1', ['exports'], (function (exports) { 'use strict
1084
1088
  });
1085
1089
  }
1086
1090
 
1091
+ // eslint-disable-next-line lwr/no-unguarded-apis
1087
1092
  if (process.env.NODE_ENV !== 'production') {
1088
1093
  if (!hasSetTimeout && hasConsole) {
1089
1094
  // eslint-disable-next-line lwr/no-unguarded-apis
@@ -1143,6 +1148,7 @@ LWR.define('lwr/loader/v/0_13_1', ['exports'], (function (exports) { 'use strict
1143
1148
  // TODO eval source maps for debugging
1144
1149
  eval(trusted.createScript(code));
1145
1150
  } catch (e) {
1151
+ // eslint-disable-next-line lwr/no-unguarded-apis
1146
1152
  if (process.env.NODE_ENV !== 'production' && hasConsole) {
1147
1153
  // eslint-disable-next-line lwr/no-unguarded-apis
1148
1154
  console.error(e);
@@ -1364,7 +1370,14 @@ LWR.define('lwr/loader/v/0_13_1', ['exports'], (function (exports) { 'use strict
1364
1370
  const mod = this.namedDefineRegistry.get(name);
1365
1371
  // Don't allow redefining a module.
1366
1372
  if (mod && mod.defined) {
1367
- if (process.env.NODE_ENV !== 'production' && process.env.MRT_HMR !== 'true' && hasConsole) {
1373
+ if (
1374
+ hasProcessEnv &&
1375
+ // eslint-disable-next-line lwr/no-unguarded-apis
1376
+ process.env.NODE_ENV !== 'production' &&
1377
+ // eslint-disable-next-line lwr/no-unguarded-apis
1378
+ process.env.MRT_HMR !== 'true' &&
1379
+ hasConsole
1380
+ ) {
1368
1381
  // eslint-disable-next-line lwr/no-unguarded-apis
1369
1382
  console.warn(`Module redefine attempted: ${name}`);
1370
1383
  }
@@ -1419,6 +1432,7 @@ LWR.define('lwr/loader/v/0_13_1', ['exports'], (function (exports) { 'use strict
1419
1432
  },
1420
1433
  };
1421
1434
  this.namedDefineRegistry.set(id, moduleDef );
1435
+ // eslint-disable-next-line lwr/no-unguarded-apis
1422
1436
  } else if (process.env.NODE_ENV !== 'production' && hasConsole) {
1423
1437
  // eslint-disable-next-line lwr/no-unguarded-apis
1424
1438
  console.warn(MODULE_ALREADY_LOADED.message, id);
@@ -1510,6 +1524,7 @@ LWR.define('lwr/loader/v/0_13_1', ['exports'], (function (exports) { 'use strict
1510
1524
  if (aliasId !== resolvedId) {
1511
1525
  if (!this.aliases.has(aliasId)) {
1512
1526
  this.aliases.set(aliasId, resolvedId);
1527
+ // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
1513
1528
  } else if (process.env.NODE_ENV !== 'production' && hasConsole) {
1514
1529
  // Warn the user if they were not aliasing to the resolvedId
1515
1530
  const currentResolvedId = this.aliases.get(aliasId);
@@ -1808,6 +1823,7 @@ LWR.define('lwr/loader/v/0_13_1', ['exports'], (function (exports) { 'use strict
1808
1823
  newUrl,
1809
1824
  });
1810
1825
  } else {
1826
+ // eslint-disable-next-line lwr/no-unguarded-apis
1811
1827
  if (process.env.NODE_ENV !== 'production' && hasConsole) {
1812
1828
  // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
1813
1829
  console.warn(`stale module detected ${name}, current URL:${oldUrl}, new URL:${newUrl}`);
@@ -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.13.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});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});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_13_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()&&(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)}catch(e){this.enterErrorState(e)}}waitForDOMContentLoaded(){return void 0===typeof document||"interactive"===document.readyState||"complete"===document.readyState?Promise.resolve():new Promise((e=>{document.addEventListener("DOMContentLoaded",(()=>{e()}))}))}createProfilerModule(e){e("lwr/profiler/v/0_13_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{disableInitDefer:d}=this.config;e.registerImportMappings({imports:l,index:a},[t,r]).then((()=>{if(!d)return this.waitForDOMContentLoaded()})).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)}}const f=globalThis;f.LWR.requiredModules=f.LWR.requiredModules||[],f.LWR.requiredModules.indexOf("lwr/loader/v/0_13_1")<0&&f.LWR.requiredModules.push("lwr/loader/v/0_13_1"),new h(f)}(),LWR.define("lwr/loader/v/0_13_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}"'});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;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,SUPPORTS_TRUSTED_TYPES="undefined"!=typeof trustedTypes;
7
+ /* LWR Module Loader Shim v0.13.3 */
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});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});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_13_3",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)}catch(e){this.enterErrorState(e)}}waitForDOMContentLoaded(){return void 0===typeof document||"interactive"===document.readyState||"complete"===document.readyState?Promise.resolve():new Promise((e=>{document.addEventListener("DOMContentLoaded",(()=>{e()}))}))}createProfilerModule(e){e("lwr/profiler/v/0_13_3",["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{disableInitDefer:d}=this.config;e.registerImportMappings({imports:l,index:a},[t,r]).then((()=>{if(!d)return this.waitForDOMContentLoaded()})).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)}}const f=globalThis;f.LWR.requiredModules=f.LWR.requiredModules||[],f.LWR.requiredModules.indexOf("lwr/loader/v/0_13_3")<0&&f.LWR.requiredModules.push("lwr/loader/v/0_13_3"),new h(f)}(),LWR.define("lwr/loader/v/0_13_3",["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}"'});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,SUPPORTS_TRUSTED_TYPES="undefined"!=typeof trustedTypes;
9
9
  /*!
10
10
  * Copyright (C) 2023 salesforce.com, inc.
11
11
  */function createTrustedTypesPolicy(e,t){return trustedTypes.createPolicy(e,t)}function createFallbackPolicy(e,t){return t}const createPolicy=SUPPORTS_TRUSTED_TYPES?createTrustedTypesPolicy:createFallbackPolicy,policyOptions={createHTML:e=>e,createScript:e=>e,createScriptURL:e=>e};try{createPolicy("default",{createHTML:e=>e,createScript(e){if("null"===e||"undefined"===e)return e},createScriptURL:e=>e})}catch(e){}const trusted=createPolicy("trusted",policyOptions);let lastWindowError;function isCustomResponse(e){return Object.prototype.hasOwnProperty.call(e,"data")&&!Object.prototype.hasOwnProperty.call(e,"blob")}function isFetchResponse(e){return"function"==typeof e.blob}function isResponseAPromise(e){return!(!e||!e.then)}async function evaluateLoadHookResponse(response,id){return Promise.resolve().then((async()=>{if(!response||!response.status)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(200!==response.status)throw new LoaderError(HTTP_FAIL_LOAD,[id,`${response.status}`]);const isResponse=isFetchResponse(response);let code;if(isCustomResponse(response))code=response.data;else{if(!isResponse)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);code=await response.text()}if(!code)throw new LoaderError(FAIL_LOAD,[id]);code=`${code}\n//# sourceURL=${id}`;try{eval(trusted.createScript(code))}catch(e){throw new LoaderError(FAIL_LOAD,[id])}if(lastWindowError)throw new LoaderError(FAIL_LOAD,[id]);return!0}))}async function evaluateLoadHook(e,t){return hasSetTimeout?new Promise(((r,o)=>{const i=setTimeout((()=>{o(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER);t.then((e=>{r(e)})).catch((()=>{o(new LoaderError(FAIL_HOOK_LOAD,[e]))})).finally((()=>{clearTimeout(i)}))})):t}hasDocument&&globalThis.addEventListener("error",(e=>{lastWindowError=e.error}));class ModuleRegistry{constructor(e){ModuleRegistry.prototype.__init.call(this),ModuleRegistry.prototype.__init2.call(this),ModuleRegistry.prototype.__init3.call(this),this.profiler=e.profiler,this.resolver=new ImportMetadataResolver(e,this.importMetadataInvalidationCallback.bind(this))}async load(e,t){const r=t?{importer:t}:{};this.profiler.logOperationStart({id:MODULE_DYNAMIC_LOAD,specifier:e,metadata:r});const o=await this.resolve(e,t),i=await this.getModuleRecord(o,e);return i.evaluated?i.module:(i.evaluationPromise||(i.evaluationPromise=this.topLevelEvaluation(i)),i.evaluationPromise)}async resolve(e,t){const r=this.resolver.getBaseUrl();let o,i=e;const n=this.resolveHook;if(n){for(let e=0;e<n.length;e++){const t=(0,n[e])(i,{parentUrl:r});let s;if((t||null===t)&&(s=isResponseAPromise(t)?await t:t),!this.isValidResolveResponse(s))throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(null!==s){if("string"==typeof s){if(resolveIfNotPlainOrUrl(s,r))throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);i=s;continue}if(o=s&&s.url&&(resolveIfNotPlainOrUrl(s.url,r)||s.url),!o)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);break}}if(i!==e){if(!o&&this.namedDefineRegistry.has(i))return i;e=i}}if(!o){const t=resolveIfNotPlainOrUrl(e,r)||e;if(this.moduleRegistry.has(t))return t;const i=this.resolver.resolveLocal(t);if(i){if(this.namedDefineRegistry.has(t)){const e=this.namedDefineRegistry.get(t);if(e.external||e.defined){if(!this.moduleRegistry.get(i)||!this.aliases.has(t))return t}}return i}if(this.namedDefineRegistry.has(t))return t;try{o=await this.resolver.resolve(t)}catch(e){}}if(!o||!isUrl(o)){if(this.namedDefineRegistry.has(e))return e;throw new LoaderError(UNRESOLVED,[e])}return t&&isUrl(o)&&(o+=`?importer=${encodeURIComponent(t)}`),o}has(e){return this.moduleRegistry.has(e)}define(e,t,r){const o=this.namedDefineRegistry.get(e);if(o&&o.defined)return void(this.lastDefine=o);const i={name:e,dependencies:t,exporter:r,defined:!0};o&&o.external&&o.external.resolveExternal(i),this.profiler.logOperationStart({id:MODULE_DEFINE,specifier:e}),this.namedDefineRegistry.set(e,i),this.lastDefine=i}registerExternalModules(e){e.map((e=>{if(!this.namedDefineRegistry.has(e)){let t,r;const o=new Promise(((o,i)=>{t=o,r=setTimeout((()=>{i(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER)})).finally((()=>{clearTimeout(r)})),i={name:e,defined:!1,external:{resolveExternal:t,moduleDefPromise:o}};this.namedDefineRegistry.set(e,i)}}))}__init(){this.namedDefineRegistry=new Map}__init2(){this.moduleRegistry=new Map}__init3(){this.aliases=new Map}getImportMetadataResolver(){return this.resolver}getExistingModuleRecord(e,t){const r=this.moduleRegistry.get(e);if(r)return this.storeModuleAlias(t,e),r;if(e!==t){const e=this.aliases.get(t);if(e){const t=this.moduleRegistry.get(e);if(t)return t}}return r}async getModuleRecord(e,t){const r=this.getExistingModuleRecord(e,t);if(r)return r;const o=this.getModuleDef(e,t),i=o.then((e=>{const t=(e.dependencies||[]).map((e=>{if("exports"!==e)return invariant("require"!==e,NO_AMD_REQUIRE),this.getModuleDependencyRecord.call(this,e)})).filter((e=>void 0!==e));return Promise.all(t)})),n={id:e,module:Object.create(null),dependencyRecords:i,instantiation:o,evaluated:!1,evaluationPromise:null};return this.moduleRegistry.set(e,n),this.storeModuleAlias(t,e),i.then((()=>n))}storeModuleAlias(e,t){e!==t&&(this.aliases.has(e)||this.aliases.set(e,t))}async getModuleDependencyRecord(e){const t=await this.resolve(e);return this.getModuleRecord(t,e)}async topLevelEvaluation(e){return await this.instantiateAll(e,{}),this.evaluateModule(e,{})}async instantiateAll(e,t){if(!t[e.id]){t[e.id]=!0;const r=await e.dependencyRecords;if(r)for(let e=0;e<r.length;e++){const o=r[e];await this.instantiateAll(o,t)}}}async evaluateModule(e,t){const r=await e.dependencyRecords;r.length>0&&(t[e.id]=!0,await this.evaluateModuleDependencies(r,t));const{exporter:o,dependencies:i}=await e.instantiation,n={},s=i?await Promise.all(i.map((async e=>{if("exports"===e)return n;const t=await this.resolve(e),r=this.moduleRegistry.get(t);if(!r)throw new LoaderError(FAILED_DEP,[t]);const o=r.module;if(!r.evaluated)return this.getCircularDependencyWrapper(o);if(o)return o.__defaultInterop?o.default:o;throw new LoaderError(FAILED_DEP,[t])}))):[];if(e.evaluated)return e.module;let a;try{a=o(...s)}catch(t){throw new LoaderError(EXPORTER_ERROR,[e.id,t.message||t])}void 0!==a?(a={default:a},Object.defineProperty(a,"__defaultInterop",{value:!0})):this.isNamedExportDefaultOnly(n)&&Object.defineProperty(n,"__useDefault",{value:!0});const l=a||n;for(const t in l)Object.defineProperty(e.module,t,{enumerable:!0,set(e){l[t]=e},get:()=>l[t]});return l.__useDefault&&Object.defineProperty(e.module,"__useDefault",{value:!0}),l.__defaultInterop&&Object.defineProperty(e.module,"__defaultInterop",{value:!0}),l.__esModule&&Object.defineProperty(e.module,"__esModule",{value:!0}),e.evaluated=!0,Object.freeze(e.module),e.module}isNamedExportDefaultOnly(e){return void 0!==e&&2===Object.getOwnPropertyNames(e).length&&Object.prototype.hasOwnProperty.call(e,"default")&&Object.prototype.hasOwnProperty.call(e,"__esModule")}getCircularDependencyWrapper(e){const t=()=>e.__useDefault||e.__defaultInterop?e.default:e;return t.__circular__=!0,t}async evaluateModuleDependencies(e,t){for(let r=0;r<e.length;r++){const o=e[r];o.evaluated||t[o.id]||(t[o.id]=!0,await this.evaluateModule(o,t))}}async getModuleDef(e,t){this.lastDefine=void 0;const r=isUrl(e)?t!==e?t:void 0:e;let o=r&&this.namedDefineRegistry.get(r);if(o&&o.external)return o.external.moduleDefPromise;if(o&&o.defined)return o;const i=this.resolver.getBaseUrl(),n=r||t;return this.profiler.logOperationStart({id:MODULE_FETCH,specifier:n}),Promise.resolve().then((async()=>{const t=this.loadHook;if(t)for(let r=0;r<t.length;r++){const o=(0,t[r])(e,i),n=isResponseAPromise(o)?await evaluateLoadHook(e,o):o;if(void 0===n)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(n&&null!==n)return evaluateLoadHookResponse(n,e)}return!1})).then((t=>{if(!0!==t&&hasDocument)return loadModuleDef(e)})).then((()=>{if(o=r&&this.namedDefineRegistry.get(r),o||(o=this.lastDefine),!o)throw new LoaderError(FAIL_INSTANTIATE,[e]);return this.profiler.logOperationEnd({id:MODULE_FETCH,specifier:n}),o})).catch((e=>{throw e instanceof LoaderError||this.profiler.logOperationStart({id:MODULE_ERROR,specifier:n}),e}))}addLoaderPlugin(e){if("object"!=typeof e)throw new LoaderError(INVALID_HOOK);const{loadModule:t,resolveModule:r,loadMapping:o}=e;r&&(this.resolveHook?this.resolveHook.push(r):this.resolveHook=[r]),t&&(this.loadHook?this.loadHook.push(t):this.loadHook=[t]),o&&this.resolver.addLoadMappingHook(o)}importMetadataInvalidationCallback({name:e,oldUrl:t,newUrl:r}){const o=this.handleStaleModuleHook;o&&evaluateHandleStaleModuleHooks(o,{name:e,oldUrl:t,newUrl:r})}registerHandleStaleModuleHook(e){this.handleStaleModuleHook?this.handleStaleModuleHook.push(e):this.handleStaleModuleHook=[e]}isValidResolveResponse(e){return null===e||"string"==typeof e||e&&"string"==typeof e.url}}class Loader{constructor(e){let t=e.baseUrl;const r=e.endpoints?e.endpoints.uris.mapping:void 0;let o=e.profiler;if(!r||!e.endpoints)throw new LoaderError(NO_MAPPING_URL);if(e.endpoints.uris.mapping=r.replace(/\/?$/,"/"),t&&(t=t.replace(/\/?$/,"/")),t||(t=getBaseUrl()),!t)throw new LoaderError(NO_BASE_URL);if(o||(o={logOperationStart:()=>{},logOperationEnd:()=>{}}),this.registry=new ModuleRegistry(Object.freeze({endpoints:e.endpoints,baseUrl:t,profiler:o})),e.appMetadata&&!e.appMetadata.appId){const t=e.appMetadata.bootstrapModule.match(/@lwr-bootstrap\/(.+)\/v\/.+/),r=t&&t[1];e.appMetadata.appId=r}this.services=Object.freeze({addLoaderPlugin:this.registry.addLoaderPlugin.bind(this.registry),handleStaleModule:this.registry.registerHandleStaleModuleHook.bind(this.registry),appMetadata:e.appMetadata})}define(e,t,r){invariant("string"==typeof e,MISSING_NAME);let o=r,i=t;"function"==typeof i&&(o=t,i=[]),invariant(Array.isArray(i),INVALID_DEPS),this.registry.define(e,i,o)}async load(e,t){return this.registry.load(e,t)}has(e){return this.registry.has(e)}async resolve(e,t){return this.registry.resolve(e,t)}async registerImportMappings(e,t){this.registry.getImportMetadataResolver().registerImportMappings(e,t)}registerExternalModules(e){this.registry.registerExternalModules(e)}}exports.Loader=Loader,Object.defineProperty(exports,"__esModule",{value:!0})}));
@@ -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.13.1 */
7
+ /* LWR Module Loader Shim v0.13.3 */
8
8
  (function () {
9
9
  'use strict';
10
10
 
@@ -209,7 +209,7 @@
209
209
  // Parse configuration
210
210
  this.global = global;
211
211
  this.config = global.LWR ;
212
- this.loaderSpecifier = 'lwr/loader/v/0_13_1';
212
+ this.loaderSpecifier = 'lwr/loader/v/0_13_3';
213
213
 
214
214
  // Set up error handler
215
215
  this.errorHandler = this.config.onError ;
@@ -337,7 +337,7 @@
337
337
  const exporter = (exports) => {
338
338
  Object.assign(exports, { logOperationStart, logOperationEnd });
339
339
  };
340
- define('lwr/profiler/v/0_13_1', ['exports'], exporter);
340
+ define('lwr/profiler/v/0_13_3', ['exports'], exporter);
341
341
  }
342
342
 
343
343
  // Set up the application globals, import map, root custom element...
@@ -414,8 +414,8 @@
414
414
  // The loader module is ALWAYS required
415
415
  const GLOBAL = globalThis ;
416
416
  GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
417
- if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_13_1') < 0) {
418
- GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_13_1');
417
+ if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_13_3') < 0) {
418
+ GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_13_3');
419
419
  }
420
420
  new LoaderShim(GLOBAL);
421
421
 
@@ -143,7 +143,7 @@ var ModuleRegistry = class {
143
143
  define(name, dependencies, exporter) {
144
144
  const mod = this.namedDefineRegistry.get(name);
145
145
  if (mod && mod.defined) {
146
- if (process.env.NODE_ENV !== "production" && process.env.MRT_HMR !== "true" && import_dom.hasConsole) {
146
+ if (import_dom.hasProcessEnv && process.env.NODE_ENV !== "production" && process.env.MRT_HMR !== "true" && import_dom.hasConsole) {
147
147
  console.warn(`Module redefine attempted: ${name}`);
148
148
  }
149
149
  this.lastDefine = mod;
@@ -10,8 +10,12 @@ __markAsModule(exports);
10
10
  __export(exports, {
11
11
  hasConsole: () => hasConsole,
12
12
  hasDocument: () => hasDocument,
13
+ hasProcess: () => hasProcess,
14
+ hasProcessEnv: () => hasProcessEnv,
13
15
  hasSetTimeout: () => hasSetTimeout
14
16
  });
15
17
  var hasDocument = typeof document !== "undefined";
16
18
  var hasSetTimeout = typeof setTimeout === "function";
17
19
  var hasConsole = typeof console !== "undefined";
20
+ var hasProcess = typeof process !== "undefined";
21
+ var hasProcessEnv = hasProcess && process.env;
@@ -142,7 +142,7 @@ var ModuleRegistry = class {
142
142
  define(name, dependencies, exporter, signatures) {
143
143
  const mod = this.namedDefineRegistry.get(name);
144
144
  if (mod && mod.defined) {
145
- if (process.env.NODE_ENV !== "production" && process.env.MRT_HMR !== "true" && import_dom.hasConsole) {
145
+ if (import_dom.hasProcessEnv && process.env.NODE_ENV !== "production" && process.env.MRT_HMR !== "true" && import_dom.hasConsole) {
146
146
  console.warn(`Module redefine attempted: ${name}`);
147
147
  }
148
148
  this.lastDefine = mod;
@@ -10,8 +10,12 @@ __markAsModule(exports);
10
10
  __export(exports, {
11
11
  hasConsole: () => hasConsole,
12
12
  hasDocument: () => hasDocument,
13
+ hasProcess: () => hasProcess,
14
+ hasProcessEnv: () => hasProcessEnv,
13
15
  hasSetTimeout: () => hasSetTimeout
14
16
  });
15
17
  var hasDocument = typeof document !== "undefined";
16
18
  var hasSetTimeout = typeof setTimeout === "function";
17
19
  var hasConsole = typeof console !== "undefined";
20
+ var hasProcess = typeof process !== "undefined";
21
+ var hasProcessEnv = hasProcess && process.env;
@@ -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.13.1 */
7
+ /* LWR ESM Module Loader v0.13.3 */
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
 
@@ -10,6 +10,7 @@ if (hasDocument) {
10
10
  lastWindowError = evt.error;
11
11
  });
12
12
  }
13
+ // eslint-disable-next-line lwr/no-unguarded-apis
13
14
  if (process.env.NODE_ENV !== 'production') {
14
15
  if (!hasSetTimeout && hasConsole) {
15
16
  // eslint-disable-next-line lwr/no-unguarded-apis
@@ -56,6 +57,7 @@ export async function evaluateLoadHookResponse(response, id) {
56
57
  eval(trusted.createScript(code));
57
58
  }
58
59
  catch (e) {
60
+ // eslint-disable-next-line lwr/no-unguarded-apis
59
61
  if (process.env.NODE_ENV !== 'production' && hasConsole) {
60
62
  // eslint-disable-next-line lwr/no-unguarded-apis
61
63
  console.error(e);
@@ -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.13.1 */
7
+ /* LWR Module Loader v0.13.3 */
8
8
  const templateRegex = /\{([0-9]+)\}/g;
9
9
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
10
  function templateString(template, args) {
@@ -152,7 +152,11 @@ const hasDocument = typeof document !== 'undefined';
152
152
  const hasSetTimeout = typeof setTimeout === 'function';
153
153
 
154
154
  const hasConsole = typeof console !== 'undefined';
155
- /* eslint-enable lwr/no-unguarded-apis */
155
+
156
+ const hasProcess = typeof process !== 'undefined';
157
+
158
+ // eslint-disable-next-line no-undef
159
+ const hasProcessEnv = hasProcess && process.env;
156
160
 
157
161
  function getBaseUrl() {
158
162
  let baseUrl = undefined;
@@ -654,7 +658,7 @@ try {
654
658
  // swallow
655
659
  }
656
660
  const trusted = createPolicy('trusted', policyOptions);
657
- /*! version: 0.22.4 */
661
+ /*! version: 0.22.5 */
658
662
 
659
663
  /* global console,process */
660
664
 
@@ -666,6 +670,7 @@ if (hasDocument) {
666
670
  });
667
671
  }
668
672
 
673
+ // eslint-disable-next-line lwr/no-unguarded-apis
669
674
  if (process.env.NODE_ENV !== 'production') {
670
675
  if (!hasSetTimeout && hasConsole) {
671
676
  // eslint-disable-next-line lwr/no-unguarded-apis
@@ -725,6 +730,7 @@ async function evaluateLoadHookResponse(response, id) {
725
730
  // TODO eval source maps for debugging
726
731
  eval(trusted.createScript(code));
727
732
  } catch (e) {
733
+ // eslint-disable-next-line lwr/no-unguarded-apis
728
734
  if (process.env.NODE_ENV !== 'production' && hasConsole) {
729
735
  // eslint-disable-next-line lwr/no-unguarded-apis
730
736
  console.error(e);
@@ -946,7 +952,14 @@ class ModuleRegistry {
946
952
  const mod = this.namedDefineRegistry.get(name);
947
953
  // Don't allow redefining a module.
948
954
  if (mod && mod.defined) {
949
- if (process.env.NODE_ENV !== 'production' && process.env.MRT_HMR !== 'true' && hasConsole) {
955
+ if (
956
+ hasProcessEnv &&
957
+ // eslint-disable-next-line lwr/no-unguarded-apis
958
+ process.env.NODE_ENV !== 'production' &&
959
+ // eslint-disable-next-line lwr/no-unguarded-apis
960
+ process.env.MRT_HMR !== 'true' &&
961
+ hasConsole
962
+ ) {
950
963
  // eslint-disable-next-line lwr/no-unguarded-apis
951
964
  console.warn(`Module redefine attempted: ${name}`);
952
965
  }
@@ -1001,6 +1014,7 @@ class ModuleRegistry {
1001
1014
  },
1002
1015
  };
1003
1016
  this.namedDefineRegistry.set(id, moduleDef );
1017
+ // eslint-disable-next-line lwr/no-unguarded-apis
1004
1018
  } else if (process.env.NODE_ENV !== 'production' && hasConsole) {
1005
1019
  // eslint-disable-next-line lwr/no-unguarded-apis
1006
1020
  console.warn(MODULE_ALREADY_LOADED.message, id);
@@ -1092,6 +1106,7 @@ class ModuleRegistry {
1092
1106
  if (aliasId !== resolvedId) {
1093
1107
  if (!this.aliases.has(aliasId)) {
1094
1108
  this.aliases.set(aliasId, resolvedId);
1109
+ // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
1095
1110
  } else if (process.env.NODE_ENV !== 'production' && hasConsole) {
1096
1111
  // Warn the user if they were not aliasing to the resolvedId
1097
1112
  const currentResolvedId = this.aliases.get(aliasId);
@@ -1390,6 +1405,7 @@ class ModuleRegistry {
1390
1405
  newUrl,
1391
1406
  });
1392
1407
  } else {
1408
+ // eslint-disable-next-line lwr/no-unguarded-apis
1393
1409
  if (process.env.NODE_ENV !== 'production' && hasConsole) {
1394
1410
  // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
1395
1411
  console.warn(`stale module detected ${name}, current URL:${oldUrl}, new URL:${newUrl}`);
@@ -1,7 +1,7 @@
1
1
  /* global console,process */
2
2
  import { invariant, NO_AMD_REQUIRE, LoaderError, FAIL_INSTANTIATE, FAILED_DEP, UNRESOLVED, INVALID_HOOK, INVALID_LOADER_SERVICE_RESPONSE, MODULE_ALREADY_LOADED, MODULE_LOAD_TIMEOUT, EXPORTER_ERROR, } from '../errors/messages.js';
3
3
  import { resolveIfNotPlainOrUrl, isUrl } from '../utils/url.js';
4
- import { hasDocument, hasConsole } from '../utils/dom.js';
4
+ import { hasDocument, hasConsole, hasProcessEnv } from '../utils/dom.js';
5
5
  import { loadModuleDef } from './scriptLoad.js';
6
6
  import { ImportMetadataResolver } from './importMetadataResolver.js';
7
7
  import { evaluateHandleStaleModuleHooks } from '../hooks/moduleInvalidation.js';
@@ -132,7 +132,12 @@ export class ModuleRegistry {
132
132
  const mod = this.namedDefineRegistry.get(name);
133
133
  // Don't allow redefining a module.
134
134
  if (mod && mod.defined) {
135
- if (process.env.NODE_ENV !== 'production' && process.env.MRT_HMR !== 'true' && hasConsole) {
135
+ if (hasProcessEnv &&
136
+ // eslint-disable-next-line lwr/no-unguarded-apis
137
+ process.env.NODE_ENV !== 'production' &&
138
+ // eslint-disable-next-line lwr/no-unguarded-apis
139
+ process.env.MRT_HMR !== 'true' &&
140
+ hasConsole) {
136
141
  // eslint-disable-next-line lwr/no-unguarded-apis
137
142
  console.warn(`Module redefine attempted: ${name}`);
138
143
  }
@@ -183,6 +188,7 @@ export class ModuleRegistry {
183
188
  },
184
189
  };
185
190
  this.namedDefineRegistry.set(id, moduleDef);
191
+ // eslint-disable-next-line lwr/no-unguarded-apis
186
192
  }
187
193
  else if (process.env.NODE_ENV !== 'production' && hasConsole) {
188
194
  // eslint-disable-next-line lwr/no-unguarded-apis
@@ -252,6 +258,7 @@ export class ModuleRegistry {
252
258
  if (aliasId !== resolvedId) {
253
259
  if (!this.aliases.has(aliasId)) {
254
260
  this.aliases.set(aliasId, resolvedId);
261
+ // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
255
262
  }
256
263
  else if (process.env.NODE_ENV !== 'production' && hasConsole) {
257
264
  // Warn the user if they were not aliasing to the resolvedId
@@ -509,6 +516,7 @@ export class ModuleRegistry {
509
516
  });
510
517
  }
511
518
  else {
519
+ // eslint-disable-next-line lwr/no-unguarded-apis
512
520
  if (process.env.NODE_ENV !== 'production' && hasConsole) {
513
521
  // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
514
522
  console.warn(`stale module detected ${name}, current URL:${oldUrl}, new URL:${newUrl}`);
@@ -1,4 +1,7 @@
1
+ /// <reference types="node" />
1
2
  export declare const hasDocument: boolean;
2
3
  export declare const hasSetTimeout: boolean;
3
4
  export declare const hasConsole: boolean;
5
+ export declare const hasProcess: boolean;
6
+ export declare const hasProcessEnv: false | NodeJS.ProcessEnv;
4
7
  //# sourceMappingURL=dom.d.ts.map
@@ -2,5 +2,7 @@
2
2
  export const hasDocument = typeof document !== 'undefined';
3
3
  export const hasSetTimeout = typeof setTimeout === 'function';
4
4
  export const hasConsole = typeof console !== 'undefined';
5
- /* eslint-enable lwr/no-unguarded-apis */
5
+ export const hasProcess = typeof process !== 'undefined';
6
+ // eslint-disable-next-line no-undef
7
+ export const hasProcessEnv = hasProcess && process.env;
6
8
  //# sourceMappingURL=dom.js.map
@@ -10,6 +10,7 @@ if (hasDocument) {
10
10
  lastWindowError = evt.error;
11
11
  });
12
12
  }
13
+ // eslint-disable-next-line lwr/no-unguarded-apis
13
14
  if (process.env.NODE_ENV !== 'production') {
14
15
  if (!hasSetTimeout && hasConsole) {
15
16
  // eslint-disable-next-line lwr/no-unguarded-apis
@@ -56,6 +57,7 @@ export async function evaluateLoadHookResponse(response, id) {
56
57
  eval(trusted.createScript(code));
57
58
  }
58
59
  catch (e) {
60
+ // eslint-disable-next-line lwr/no-unguarded-apis
59
61
  if (process.env.NODE_ENV !== 'production' && hasConsole) {
60
62
  // eslint-disable-next-line lwr/no-unguarded-apis
61
63
  console.error(e);
@@ -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.13.1 */
7
+ /* LWR Legacy Module Loader v0.13.3 */
8
8
  const templateRegex = /\{([0-9]+)\}/g;
9
9
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
10
  function templateString(template, args) {
@@ -137,7 +137,11 @@ const hasDocument = typeof document !== 'undefined';
137
137
  const hasSetTimeout = typeof setTimeout === 'function';
138
138
 
139
139
  const hasConsole = typeof console !== 'undefined';
140
- /* eslint-enable lwr/no-unguarded-apis */
140
+
141
+ const hasProcess = typeof process !== 'undefined';
142
+
143
+ // eslint-disable-next-line no-undef
144
+ const hasProcessEnv = hasProcess && process.env;
141
145
 
142
146
  function getBaseUrl() {
143
147
  let baseUrl = undefined;
@@ -377,7 +381,7 @@ try {
377
381
  // swallow
378
382
  }
379
383
  const trusted = createPolicy('trusted', policyOptions);
380
- /*! version: 0.22.4 */
384
+ /*! version: 0.22.5 */
381
385
 
382
386
  /* global console,process */
383
387
 
@@ -389,6 +393,7 @@ if (hasDocument) {
389
393
  });
390
394
  }
391
395
 
396
+ // eslint-disable-next-line lwr/no-unguarded-apis
392
397
  if (process.env.NODE_ENV !== 'production') {
393
398
  if (!hasSetTimeout && hasConsole) {
394
399
  // eslint-disable-next-line lwr/no-unguarded-apis
@@ -448,6 +453,7 @@ async function evaluateLoadHookResponse(response, id) {
448
453
  // TODO eval source maps for debugging
449
454
  eval(trusted.createScript(code));
450
455
  } catch (e) {
456
+ // eslint-disable-next-line lwr/no-unguarded-apis
451
457
  if (process.env.NODE_ENV !== 'production' && hasConsole) {
452
458
  // eslint-disable-next-line lwr/no-unguarded-apis
453
459
  console.error(e);
@@ -712,7 +718,14 @@ class ModuleRegistry {
712
718
  const mod = this.namedDefineRegistry.get(name);
713
719
  // Don't allow redefining a module.
714
720
  if (mod && mod.defined) {
715
- if (process.env.NODE_ENV !== 'production' && process.env.MRT_HMR !== 'true' && hasConsole) {
721
+ if (
722
+ hasProcessEnv &&
723
+ // eslint-disable-next-line lwr/no-unguarded-apis
724
+ process.env.NODE_ENV !== 'production' &&
725
+ // eslint-disable-next-line lwr/no-unguarded-apis
726
+ process.env.MRT_HMR !== 'true' &&
727
+ hasConsole
728
+ ) {
716
729
  // eslint-disable-next-line lwr/no-unguarded-apis
717
730
  console.warn(`Module redefine attempted: ${name}`);
718
731
  }
@@ -775,6 +788,7 @@ class ModuleRegistry {
775
788
  },
776
789
  };
777
790
  this.namedDefineRegistry.set(id, moduleDef );
791
+ // eslint-disable-next-line lwr/no-unguarded-apis
778
792
  } else if (process.env.NODE_ENV !== 'production' && hasConsole) {
779
793
  // eslint-disable-next-line lwr/no-unguarded-apis
780
794
  console.warn(MODULE_ALREADY_LOADED.message, id);
@@ -807,6 +821,7 @@ class ModuleRegistry {
807
821
  newHash: signature,
808
822
  });
809
823
  } else {
824
+ // eslint-disable-next-line lwr/no-unguarded-apis
810
825
  if (process.env.NODE_ENV !== 'production' && hasConsole) {
811
826
  // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
812
827
  console.warn(
@@ -905,6 +920,7 @@ class ModuleRegistry {
905
920
  // Warn the user if they were not aliasing to the resolvedId
906
921
  const currentResolvedId = this.aliases.get(aliasId);
907
922
  if (currentResolvedId !== resolvedId) {
923
+ // eslint-disable-next-line lwr/no-unguarded-apis
908
924
  if (process.env.NODE_ENV !== 'production' && hasConsole) {
909
925
  // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
910
926
  console.warn(`Alias update attempt: ${aliasId}=>${currentResolvedId}, ${resolvedId}`);
@@ -1,7 +1,7 @@
1
1
  /* global console,process */
2
2
  import { invariant, NO_AMD_REQUIRE, LoaderError, FAIL_INSTANTIATE, FAILED_DEP, UNRESOLVED, INVALID_HOOK, INVALID_LOADER_SERVICE_RESPONSE, MODULE_ALREADY_LOADED, MODULE_LOAD_TIMEOUT, EXPORTER_ERROR, } from '../errors/messages.js';
3
3
  import { resolveIfNotPlainOrUrl, isUrl } from '../utils/url.js';
4
- import { hasDocument, hasConsole } from '../utils/dom.js';
4
+ import { hasDocument, hasConsole, hasProcessEnv } from '../utils/dom.js';
5
5
  import { loadModuleDef } from './scriptLoad.js';
6
6
  import { evaluateLoadHookResponse, evaluateLoadHook, isResponseAPromise, } from '../hooks/resolveAndLoadHook.js';
7
7
  import { evaluateHandleStaleModuleHooks } from '../hooks/moduleInvalidation.js';
@@ -130,7 +130,12 @@ export class ModuleRegistry {
130
130
  const mod = this.namedDefineRegistry.get(name);
131
131
  // Don't allow redefining a module.
132
132
  if (mod && mod.defined) {
133
- if (process.env.NODE_ENV !== 'production' && process.env.MRT_HMR !== 'true' && hasConsole) {
133
+ if (hasProcessEnv &&
134
+ // eslint-disable-next-line lwr/no-unguarded-apis
135
+ process.env.NODE_ENV !== 'production' &&
136
+ // eslint-disable-next-line lwr/no-unguarded-apis
137
+ process.env.MRT_HMR !== 'true' &&
138
+ hasConsole) {
134
139
  // eslint-disable-next-line lwr/no-unguarded-apis
135
140
  console.warn(`Module redefine attempted: ${name}`);
136
141
  }
@@ -188,6 +193,7 @@ export class ModuleRegistry {
188
193
  },
189
194
  };
190
195
  this.namedDefineRegistry.set(id, moduleDef);
196
+ // eslint-disable-next-line lwr/no-unguarded-apis
191
197
  }
192
198
  else if (process.env.NODE_ENV !== 'production' && hasConsole) {
193
199
  // eslint-disable-next-line lwr/no-unguarded-apis
@@ -220,6 +226,7 @@ export class ModuleRegistry {
220
226
  });
221
227
  }
222
228
  else {
229
+ // eslint-disable-next-line lwr/no-unguarded-apis
223
230
  if (process.env.NODE_ENV !== 'production' && hasConsole) {
224
231
  // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
225
232
  console.warn(`stale module detected ${name}, current sig:${currentSig}, new sig:${signature}`);
@@ -294,6 +301,7 @@ export class ModuleRegistry {
294
301
  // Warn the user if they were not aliasing to the resolvedId
295
302
  const currentResolvedId = this.aliases.get(aliasId);
296
303
  if (currentResolvedId !== resolvedId) {
304
+ // eslint-disable-next-line lwr/no-unguarded-apis
297
305
  if (process.env.NODE_ENV !== 'production' && hasConsole) {
298
306
  // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
299
307
  console.warn(`Alias update attempt: ${aliasId}=>${currentResolvedId}, ${resolvedId}`);
@@ -1,4 +1,7 @@
1
+ /// <reference types="node" />
1
2
  export declare const hasDocument: boolean;
2
3
  export declare const hasSetTimeout: boolean;
3
4
  export declare const hasConsole: boolean;
5
+ export declare const hasProcess: boolean;
6
+ export declare const hasProcessEnv: false | NodeJS.ProcessEnv;
4
7
  //# sourceMappingURL=dom.d.ts.map
@@ -2,5 +2,7 @@
2
2
  export const hasDocument = typeof document !== 'undefined';
3
3
  export const hasSetTimeout = typeof setTimeout === 'function';
4
4
  export const hasConsole = typeof console !== 'undefined';
5
- /* eslint-enable lwr/no-unguarded-apis */
5
+ export const hasProcess = typeof process !== 'undefined';
6
+ // eslint-disable-next-line no-undef
7
+ export const hasProcessEnv = hasProcess && process.env;
6
8
  //# sourceMappingURL=dom.js.map
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
- "version": "0.13.1",
8
+ "version": "0.13.3",
9
9
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
10
10
  "repository": {
11
11
  "type": "git",
@@ -60,17 +60,17 @@
60
60
  "build": "yarn build:ts && yarn build:error-shim && yarn build:shim && yarn build:loader && yarn build:shim:bundle && yarn build:shim:bundle:minify"
61
61
  },
62
62
  "devDependencies": {
63
- "@locker/trusted-types": "0.22.4",
64
- "@lwrjs/diagnostics": "0.13.1",
65
- "@lwrjs/types": "0.13.1",
63
+ "@locker/trusted-types": "0.22.5",
64
+ "@lwrjs/diagnostics": "0.13.3",
65
+ "@lwrjs/types": "0.13.3",
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.78.0"
70
70
  },
71
71
  "dependencies": {
72
- "@lwrjs/client-modules": "0.13.1",
73
- "@lwrjs/shared-utils": "0.13.1"
72
+ "@lwrjs/client-modules": "0.13.3",
73
+ "@lwrjs/shared-utils": "0.13.3"
74
74
  },
75
75
  "lwc": {
76
76
  "modules": [
@@ -90,5 +90,5 @@
90
90
  "volta": {
91
91
  "extends": "../../../package.json"
92
92
  },
93
- "gitHead": "548b27ed22f5bfba7031d6b356d64898e15bd609"
93
+ "gitHead": "adaedf286df20aed374d9eb07eaf74668084073c"
94
94
  }