@lwrjs/loader 0.22.14 → 0.23.2

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.22.14 */
7
+ /* LWR Error Shim v0.23.2 */
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.22.14 */
7
+ /* LWR Legacy Module Loader Shim v0.23.2 */
8
8
  (function () {
9
9
  'use strict';
10
10
 
@@ -285,27 +285,6 @@
285
285
  // eslint-disable-next-line no-undef
286
286
  hasProcess$1 && process.env;
287
287
 
288
- /**
289
- * List of protected module patterns that cannot be remapped.
290
- * Uses case-insensitive matching to prevent bypass attempts (e.g., HF-1027).
291
- */
292
- const PROTECTED_PATTERNS = [
293
- /^lwc$/i, // Core LWC
294
- /^lwc\/v\//i, // Versioned LWC variants
295
- /^@lwc\//i, // LWC scoped packages
296
- /^lightningmobileruntime\//i, // Lightning mobile runtime
297
- ];
298
-
299
- /**
300
- * Checks if a specifier matches any protected module pattern.
301
- *
302
- * @param specifier - The module specifier to check
303
- * @returns true if the specifier is protected, false otherwise
304
- */
305
- function isProtectedSpecifier(specifier) {
306
- return PROTECTED_PATTERNS.some((pattern) => pattern.test(specifier));
307
- }
308
-
309
288
  /**
310
289
  * Validates that a URI does not use dangerous URL schemes.
311
290
  *
@@ -330,19 +309,15 @@
330
309
  }
331
310
 
332
311
  /**
333
- * Validates that a specifier is well-formed and not protected.
312
+ * Validates that a specifier is well-formed.
334
313
  *
335
314
  * @param specifier - The module specifier to validate
336
- * @throws Error if the specifier is invalid or protected
315
+ * @throws Error if the specifier is invalid
337
316
  */
338
317
  function validateSpecifier(specifier) {
339
318
  if (typeof specifier !== 'string' || specifier.length === 0) {
340
319
  throw new Error('Specifier must be a non-empty string');
341
320
  }
342
-
343
- if (isProtectedSpecifier(specifier)) {
344
- throw new Error(`Cannot remap protected module: ${specifier}`);
345
- }
346
321
  }
347
322
 
348
323
  /**
@@ -461,7 +436,7 @@
461
436
  // Parse configuration
462
437
  this.global = global;
463
438
  this.config = global.LWR ;
464
- this.loaderModule = 'lwr/loaderLegacy/v/0_22_14';
439
+ this.loaderModule = 'lwr/loaderLegacy/v/0_23_2';
465
440
 
466
441
  // Set up error handler
467
442
  this.errorHandler = this.config.onError ;
@@ -661,7 +636,7 @@
661
636
  const exporter = (exports) => {
662
637
  Object.assign(exports, { logOperationStart, logOperationEnd });
663
638
  };
664
- define('lwr/profiler/v/0_22_14', ['exports'], exporter, {});
639
+ define('lwr/profiler/v/0_23_2', ['exports'], exporter, {});
665
640
  }
666
641
 
667
642
  // Set up the application globals, import map, root custom element...
@@ -758,14 +733,14 @@
758
733
  // The loader module is ALWAYS required
759
734
  const GLOBAL = globalThis ;
760
735
  GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
761
- if (GLOBAL.LWR.requiredModules.indexOf('lwr/loaderLegacy/v/0_22_14') < 0) {
762
- GLOBAL.LWR.requiredModules.push('lwr/loaderLegacy/v/0_22_14');
736
+ if (GLOBAL.LWR.requiredModules.indexOf('lwr/loaderLegacy/v/0_23_2') < 0) {
737
+ GLOBAL.LWR.requiredModules.push('lwr/loaderLegacy/v/0_23_2');
763
738
  }
764
739
  new LoaderShim(GLOBAL);
765
740
 
766
741
  })();
767
742
 
768
- LWR.define('lwr/loaderLegacy/v/0_22_14', ['exports'], (function (exports) { 'use strict';
743
+ LWR.define('lwr/loaderLegacy/v/0_23_2', ['exports'], (function (exports) { 'use strict';
769
744
 
770
745
  const templateRegex = /\{([0-9]+)\}/g;
771
746
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -2511,27 +2486,6 @@ LWR.define('lwr/loaderLegacy/v/0_22_14', ['exports'], (function (exports) { 'use
2511
2486
  return importMapPromise;
2512
2487
  }
2513
2488
 
2514
- /**
2515
- * List of protected module patterns that cannot be remapped.
2516
- * Uses case-insensitive matching to prevent bypass attempts (e.g., HF-1027).
2517
- */
2518
- const PROTECTED_PATTERNS = [
2519
- /^lwc$/i, // Core LWC
2520
- /^lwc\/v\//i, // Versioned LWC variants
2521
- /^@lwc\//i, // LWC scoped packages
2522
- /^lightningmobileruntime\//i, // Lightning mobile runtime
2523
- ];
2524
-
2525
- /**
2526
- * Checks if a specifier matches any protected module pattern.
2527
- *
2528
- * @param specifier - The module specifier to check
2529
- * @returns true if the specifier is protected, false otherwise
2530
- */
2531
- function isProtectedSpecifier(specifier) {
2532
- return PROTECTED_PATTERNS.some((pattern) => pattern.test(specifier));
2533
- }
2534
-
2535
2489
  /**
2536
2490
  * Validates that a URI does not use dangerous URL schemes.
2537
2491
  *
@@ -2556,19 +2510,15 @@ LWR.define('lwr/loaderLegacy/v/0_22_14', ['exports'], (function (exports) { 'use
2556
2510
  }
2557
2511
 
2558
2512
  /**
2559
- * Validates that a specifier is well-formed and not protected.
2513
+ * Validates that a specifier is well-formed.
2560
2514
  *
2561
2515
  * @param specifier - The module specifier to validate
2562
- * @throws Error if the specifier is invalid or protected
2516
+ * @throws Error if the specifier is invalid
2563
2517
  */
2564
2518
  function validateSpecifier(specifier) {
2565
2519
  if (typeof specifier !== 'string' || specifier.length === 0) {
2566
2520
  throw new Error('Specifier must be a non-empty string');
2567
2521
  }
2568
-
2569
- if (isProtectedSpecifier(specifier)) {
2570
- throw new Error(`Cannot remap protected module: ${specifier}`);
2571
- }
2572
2522
  }
2573
2523
 
2574
2524
  /**
@@ -4,9 +4,9 @@
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.22.14 */
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,n=void 0!==o&&"function"==typeof o.mark&&"function"==typeof o.clearMarks&&"function"==typeof o.measure&&"function"==typeof o.clearMeasures;function i(e,t){return t?`${e}-${t}`:e}function s(e,t,r){const o=i(e,t);return t&&r?`${o}_${r}`:o}function a(e,t){const r=e||t?{...t}:null;return r&&e&&(r.specifier=e),r}function l({id:r,specifier:i,specifierIndex:l,metadata:c}){if(t)t({id:r,phase:e.Start,specifier:i,metadata:c,specifierIndex:l});else if(n){const e=s(r,i,l),t=a(i,c);o.mark(e,{detail:t})}}function c({id:r,specifier:l,specifierIndex:c,metadata:d}){if(t)t({id:r,phase:e.End,specifier:l,metadata:d,specifierIndex:c});else if(n){const e=s(r,l,c),t=i(r,l),n=a(l,d);o.measure(t,{start:e,detail:n}),o.clearMarks(e),o.clearMeasures(t)}}function d(e){const[,t,r]=e;if(Array.isArray(t)&&"function"==typeof r)return{deps:t,factory:r};if("function"==typeof t)return{deps:[],factory:t};throw new Error("Invalid module definition")}function p(e,t,r){if("exports"===e)return t;const o=r[e];if(!o)throw new Error(`Dependency "${e}" not found in defineCache for loader`);try{return function(e){const{deps:t,factory:r}=d(e);if(t.length>1||1===t.length&&"exports"!==t[0])throw new Error(`Loader dependencies must have no deps or only ['exports']; got [${t.join(", ")}]`);const o={},n=r(o);return void 0!==n?n:o}(o)}catch(t){const r=t instanceof Error?t.message:String(t);throw new Error(`Loader dependency "${e}" has invalid definition: ${r}`)}}function u(e,t,r){try{const{deps:e,factory:o}=function(e){const{deps:t,factory:r}=d(e);if(t.includes("exports"))return{deps:t,factory:r};const o=0===t.length;return{deps:["exports",...t],factory:(e,...t)=>{const n=o?r(e):r(...t);void 0!==n&&"object"==typeof n&&Object.assign(e,n)}}}(t),n={};return{factory:o,args:e.map((e=>p(e,n,r))),exportsObj:n}}catch(t){const r=t instanceof Error?t.message:String(t);throw new Error(`Expected loader with specifier "${e}" to be a module. ${r}`)}}function f(e,t,o,n){const{autoBoot:i,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")}(i,s),s){s({initializeApp:t,define:o,onBootstrapError:n,attachDispatcher:r},e)}}const h="undefined"!=typeof console;"undefined"!=typeof process&&process.env;const m=[/^lwc$/i,/^lwc\/v\//i,/^@lwc\//i,/^lightningmobileruntime\//i];function g(e,t){const r=e.toLowerCase();if(r.startsWith("blob:"))throw new Error(`Cannot map ${t} to blob: URL`);if(r.startsWith("data:"))throw new Error(`Cannot map ${t} to data: URL`)}function E(e){if("string"!=typeof e||0===e.length)throw new Error("Specifier must be a non-empty string");if(function(e){return m.some((t=>t.test(e)))}(e))throw new Error(`Cannot remap protected module: ${e}`)}function y(e,t,r){const o=r[e];void 0!==o?o!==t&&function(e,t,r){h&&console.warn("Package target "+r+", resolving target '"+t+"' for "+e)}(e,t,`already mapped to "${o}", ignoring conflicting mapping`):r[e]=t}function O(e){let t,r=e[0],o=1;for(;o<e.length;){const n=e[o],i=e[o+1];if(o+=2,("optionalAccess"===n||"optionalCall"===n)&&null==r)return;"access"===n||"optionalAccess"===n?(t=r,r=i(r)):"call"!==n&&"optionalCall"!==n||(r=i(((...e)=>r.call(t,...e))),t=void 0)}return r}const R="function"==typeof setTimeout,M="undefined"!=typeof console;class _{__init(){this.defineCache={}}__init2(){this.orderedDefs=[]}__init3(){this.importMapUpdatesCache={}}constructor(e){_.prototype.__init.call(this),_.prototype.__init2.call(this),_.prototype.__init3.call(this),R&&(this.watchdogTimerId=this.startWatchdogTimer()),this.global=e,this.config=e.LWR,this.loaderModule="lwr/loaderLegacy/v/0_22_14",this.errorHandler=this.config.onError;const t=this.tempDefine.bind(this);e.LWR.define=t;const r=this.tempImportMap.bind(this);e.LWR.importMap=r,this.bootReady=this.config.autoBoot;try{this.createProfilerModule(e.LWR.define),f(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()&&(R&&clearTimeout(this.watchdogTimerId),this.initApp())}tempImportMap(e){try{const t=function(e){if(!e||"object"!=typeof e)throw new Error("LWR.importMap() requires an object argument");const t=Object.entries(e);if(0===t.length)return h&&console.warn("LWR.importMap() called with empty update object"),null;const r={};for(const[e,o]of t){if(!Array.isArray(o))throw new Error("moduleNames must be an array");if(!e||"string"!=typeof e)throw new Error("moduleScriptURL must be a string");g(e,e);for(const t of o)E(t),t in r?h&&console.warn(`LWR.importMap(): duplicate module "${t}" — already mapped to "${r[t]}", ignoring mapping to "${e}"`):r[t]=e}return{imports:r}}(e);if(!t)return;for(const[e,r]of Object.entries(t.imports))y(e,r,this.importMapUpdatesCache)}catch(e){this.enterErrorState(e)}}getImportMappingsWithUpdates(){const e=this.config.importMappings,t={...O([e,"optionalAccess",e=>e.imports])||{}};for(const[e,r]of Object.entries(this.importMapUpdatesCache))y(e,r,t);return{...e||{},imports:t}}postCustomInit(){this.bootReady=!0,this.canInit()&&(R&&clearTimeout(this.watchdogTimerId),this.initApp())}initApp(){try{const e={baseUrl:this.config.baseUrl,profiler:{logOperationStart:l,logOperationEnd:c},appMetadata:{appId:this.config.appId,bootstrapModule:this.config.bootstrapModule,rootComponent:this.config.rootComponent,rootComponents:this.config.rootComponents}},t=function(e,t,r,o,n){if(!t||"function"!=typeof t[2])throw new Error(`Expected loader with specifier "${e}" to be a module`);const i={};if(n){const{factory:r,args:o,exportsObj:s}=u(e,t,n);r(...o),Object.assign(i,s)}else t[2].call(null,i);const{Loader:s}=i;if(!s)throw new Error("Expected Loader class to be defined");const a=new s(r);return o&&o.length&&a.registerExternalModules(o),a.define(e,["exports"],(e=>{Object.assign(e,{define:a.define.bind(a),load:a.load.bind(a),services:a.services,clearRegistry:a.clearRegistry.bind(a)})}),t[3]),a}(this.loaderModule,this.defineCache[this.loaderModule],e,this.config.preloadModules,this.defineCache);this.mountApp(t),t&&t.getModuleWarnings}catch(e){this.enterErrorState(e)}}waitForBody(){return new Promise((e=>{if(document.body)e();else{const t=new MutationObserver((()=>{document.body&&(t.disconnect(),e())}));t.observe(document.documentElement,{childList:!0})}}))}waitForDOMContentLoaded(){return"interactive"===document.readyState||"complete"===document.readyState?Promise.resolve():new Promise((e=>{document.addEventListener("DOMContentLoaded",(()=>{e()}))}))}createProfilerModule(e){e("lwr/profiler/v/0_22_14",["exports"],(e=>{Object.assign(e,{logOperationStart:l,logOperationEnd:c})}),{})}mountApp(e){const{bootstrapModule:t,rootComponent:r,rootComponents:o,serverData:n,endpoints:i}=this.config,s=this.getImportMappingsWithUpdates();this.global.LWR=Object.freeze({define:e.define.bind(e),importMap:e.importMap.bind(e),rootComponent:r,rootComponents:o,serverData:n||{},importMappings:s,endpoints:i,env:this.global.LWR.env}),this.orderedDefs.forEach((t=>{t!==this.loaderModule&&e.define(...this.defineCache[t])}));const{initDeferDOM:a}=this.config;e.registerImportMappings(s).then((()=>"undefined"==typeof window||"undefined"==typeof document?Promise.resolve():a?this.waitForDOMContentLoaded():this.waitForBody())).then((()=>e.load(t))).catch((e=>{this.enterErrorState(new Error(`Application ${r||t} could not be loaded: ${e}`))}))}enterErrorState(e){l({id:"lwr.bootstrap.error"}),this.errorHandler?this.errorHandler(e):M&&console.error(`An error occurred during LWR bootstrap. ${e.message}`,e.stack)}startWatchdogTimer(){return setTimeout((()=>{const e=this.config.requiredModules&&this.config.requiredModules.filter((e=>!this.orderedDefs.includes(e)))||[];this.enterErrorState(new Error(`Failed to load required modules - timed out: ${e.join(", ")}`))}),6e4)}logWarnings(e){for(const t in e)e[t].length&&console.warn(t,e[t])}}const w=globalThis;w.LWR.requiredModules=w.LWR.requiredModules||[],w.LWR.requiredModules.indexOf("lwr/loaderLegacy/v/0_22_14")<0&&w.LWR.requiredModules.push("lwr/loaderLegacy/v/0_22_14"),new _(w)}(),LWR.define("lwr/loaderLegacy/v/0_22_14",["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}"});Object.freeze({code:3008,level:0,message:"Error loading empty code for {0}"});const UNRESOLVED=Object.freeze({code:3009,level:0,message:"Unable to resolve bare specifier: {0}"}),NO_BASE_URL=Object.freeze({code:3010,level:0,message:"baseUrl not set"});Object.freeze({code:3011,level:0,message:"Cannot set a loader service multiple times"});const INVALID_HOOK=Object.freeze({code:3012,level:0,message:"Invalid hook received"}),INVALID_LOADER_SERVICE_RESPONSE=Object.freeze({code:3013,level:0,message:"Invalid response received from hook"}),MODULE_LOAD_TIMEOUT=Object.freeze({code:3014,level:0,message:"Error loading {0} - timed out"}),HTTP_FAIL_LOAD=Object.freeze({code:3015,level:0,message:"Error loading {0}, status code {1}"}),STALE_HOOK_ERROR=Object.freeze({code:3016,level:0,message:"An error occurred handling module conflict"});Object.freeze({code:3017,level:0,message:"Marking module(s) as externally loaded, but they are already loaded: {0}"});const FAIL_HOOK_LOAD=Object.freeze({code:3018,level:0,message:'Error loading "{0}" from hook'}),EXPORTER_ERROR=Object.freeze({code:3021,level:0,message:'Error evaluating module "{0}", error was {1}'}),NO_IMPORT_LWC=Object.freeze({code:3022,level:0,message:'Cannot dynamically import "lwc" with importer "{0}"'}),NO_BLOB_IMPORT=Object.freeze({code:3023,level:0,message:"Cannot import a blob URL"}),NO_IMPORT_LOADER=Object.freeze({code:3024,level:0,message:'Cannot dynamically import the LWR loader with importer "{0}"'}),NO_IMPORT_TRANSPORT=Object.freeze({code:3025,level:0,message:'Cannot dynamically import "transport" with importer "{0}"'}),BAD_IMPORT_MAP=Object.freeze({code:3011,level:0,message:"import map is not valid"}),hasDocument="undefined"!=typeof document,hasSetTimeout="function"==typeof setTimeout,hasConsole="undefined"!=typeof console,hasProcess="undefined"!=typeof process;function getBaseUrl(){let e;if(hasDocument){const t=document.querySelector("base[href]");e=t&&t.href}if(!e&&"undefined"!=typeof location){e=location.href.split("#")[0].split("?")[0];const t=e.lastIndexOf("/");-1!==t&&(e=e.slice(0,t+1))}return e}function isUrl(e){return-1!==e.indexOf("://")}function resolveIfNotPlainOrUrl(e,t){if(-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/")),"/"===e[0]&&"/"===e[1])return t.slice(0,t.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const r=t.slice(0,t.indexOf(":")+1);let o;if("/"===t[r.length+1]?"file:"!==r?(o=t.slice(r.length+2),o=o.slice(o.indexOf("/")+1)):o=t.slice(8):o=t.slice(r.length+("/"===t[r.length]?1:0)),"/"===e[0])return t.slice(0,t.length-o.length-1)+e;const n=o.slice(0,o.lastIndexOf("/")+1)+e,i=[];let s=-1;for(let e=0;e<n.length;e++)-1!==s?"/"===n[e]&&(i.push(n.slice(s,e+1)),s=-1):"."===n[e]?"."!==n[e+1]||"/"!==n[e+2]&&e+2!==n.length?"/"===n[e+1]||e+1===n.length?e+=1:s=e:(i.pop(),e+=2):s=e;return-1!==s&&i.push(n.slice(s)),t.slice(0,t.length-o.length)+i.join("")}}function resolveUrl(e,t){return resolveIfNotPlainOrUrl(e,t)||(isUrl(e)?e:resolveIfNotPlainOrUrl("./"+e,t))}function createScript(e){const t=document.createElement("script");return t.async=!0,t.crossOrigin="anonymous",t.src=e,t}let lastWindowError$1,lastWindowErrorUrl;function loadModuleDef(e){return new Promise((function(t,r){if(hasDocument){const o=createScript(e);o.addEventListener("error",(()=>{r(new LoaderError(FAIL_LOAD,[e]))})),o.addEventListener("load",(()=>{document.head.removeChild(o),lastWindowErrorUrl===e?r(lastWindowError$1):t()})),document.head.appendChild(o)}}))}hasProcess&&process.env,hasDocument&&window.addEventListener("error",(e=>{lastWindowErrorUrl=e.filename,lastWindowError$1=e.error}));const MODULE_LOAD_TIMEOUT_TIMER=6e4;var MODULE_WARNING;!function(e){e.MODULE_REDEFINE="Module redefine attempted";e.MODULE_ALREADY_LOADED="Marking module(s) as externally loaded, but they are already loaded";e.ALIAS_UPDATE="Alias update attempt"}(MODULE_WARNING||(MODULE_WARNING={}));
7
+ /* LWR Legacy Module Loader Shim v0.23.2 */
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,n=void 0!==o&&"function"==typeof o.mark&&"function"==typeof o.clearMarks&&"function"==typeof o.measure&&"function"==typeof o.clearMeasures;function i(e,t){return t?`${e}-${t}`:e}function s(e,t,r){const o=i(e,t);return t&&r?`${o}_${r}`:o}function a(e,t){const r=e||t?{...t}:null;return r&&e&&(r.specifier=e),r}function l({id:r,specifier:i,specifierIndex:l,metadata:c}){if(t)t({id:r,phase:e.Start,specifier:i,metadata:c,specifierIndex:l});else if(n){const e=s(r,i,l),t=a(i,c);o.mark(e,{detail:t})}}function c({id:r,specifier:l,specifierIndex:c,metadata:d}){if(t)t({id:r,phase:e.End,specifier:l,metadata:d,specifierIndex:c});else if(n){const e=s(r,l,c),t=i(r,l),n=a(l,d);o.measure(t,{start:e,detail:n}),o.clearMarks(e),o.clearMeasures(t)}}function d(e){const[,t,r]=e;if(Array.isArray(t)&&"function"==typeof r)return{deps:t,factory:r};if("function"==typeof t)return{deps:[],factory:t};throw new Error("Invalid module definition")}function p(e,t,r){if("exports"===e)return t;const o=r[e];if(!o)throw new Error(`Dependency "${e}" not found in defineCache for loader`);try{return function(e){const{deps:t,factory:r}=d(e);if(t.length>1||1===t.length&&"exports"!==t[0])throw new Error(`Loader dependencies must have no deps or only ['exports']; got [${t.join(", ")}]`);const o={},n=r(o);return void 0!==n?n:o}(o)}catch(t){const r=t instanceof Error?t.message:String(t);throw new Error(`Loader dependency "${e}" has invalid definition: ${r}`)}}function u(e,t,r){try{const{deps:e,factory:o}=function(e){const{deps:t,factory:r}=d(e);if(t.includes("exports"))return{deps:t,factory:r};const o=0===t.length;return{deps:["exports",...t],factory:(e,...t)=>{const n=o?r(e):r(...t);void 0!==n&&"object"==typeof n&&Object.assign(e,n)}}}(t),n={};return{factory:o,args:e.map((e=>p(e,n,r))),exportsObj:n}}catch(t){const r=t instanceof Error?t.message:String(t);throw new Error(`Expected loader with specifier "${e}" to be a module. ${r}`)}}function f(e,t,o,n){const{autoBoot:i,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")}(i,s),s){s({initializeApp:t,define:o,onBootstrapError:n,attachDispatcher:r},e)}}const h="undefined"!=typeof console;function m(e,t){const r=e.toLowerCase();if(r.startsWith("blob:"))throw new Error(`Cannot map ${t} to blob: URL`);if(r.startsWith("data:"))throw new Error(`Cannot map ${t} to data: URL`)}function g(e){if("string"!=typeof e||0===e.length)throw new Error("Specifier must be a non-empty string")}function E(e,t,r){const o=r[e];void 0!==o?o!==t&&function(e,t,r){h&&console.warn("Package target "+r+", resolving target '"+t+"' for "+e)}(e,t,`already mapped to "${o}", ignoring conflicting mapping`):r[e]=t}function y(e){let t,r=e[0],o=1;for(;o<e.length;){const n=e[o],i=e[o+1];if(o+=2,("optionalAccess"===n||"optionalCall"===n)&&null==r)return;"access"===n||"optionalAccess"===n?(t=r,r=i(r)):"call"!==n&&"optionalCall"!==n||(r=i(((...e)=>r.call(t,...e))),t=void 0)}return r}"undefined"!=typeof process&&process.env;const O="function"==typeof setTimeout,M="undefined"!=typeof console;class R{__init(){this.defineCache={}}__init2(){this.orderedDefs=[]}__init3(){this.importMapUpdatesCache={}}constructor(e){R.prototype.__init.call(this),R.prototype.__init2.call(this),R.prototype.__init3.call(this),O&&(this.watchdogTimerId=this.startWatchdogTimer()),this.global=e,this.config=e.LWR,this.loaderModule="lwr/loaderLegacy/v/0_23_2",this.errorHandler=this.config.onError;const t=this.tempDefine.bind(this);e.LWR.define=t;const r=this.tempImportMap.bind(this);e.LWR.importMap=r,this.bootReady=this.config.autoBoot;try{this.createProfilerModule(e.LWR.define),f(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()&&(O&&clearTimeout(this.watchdogTimerId),this.initApp())}tempImportMap(e){try{const t=function(e){if(!e||"object"!=typeof e)throw new Error("LWR.importMap() requires an object argument");const t=Object.entries(e);if(0===t.length)return h&&console.warn("LWR.importMap() called with empty update object"),null;const r={};for(const[e,o]of t){if(!Array.isArray(o))throw new Error("moduleNames must be an array");if(!e||"string"!=typeof e)throw new Error("moduleScriptURL must be a string");m(e,e);for(const t of o)g(t),t in r?h&&console.warn(`LWR.importMap(): duplicate module "${t}" — already mapped to "${r[t]}", ignoring mapping to "${e}"`):r[t]=e}return{imports:r}}(e);if(!t)return;for(const[e,r]of Object.entries(t.imports))E(e,r,this.importMapUpdatesCache)}catch(e){this.enterErrorState(e)}}getImportMappingsWithUpdates(){const e=this.config.importMappings,t={...y([e,"optionalAccess",e=>e.imports])||{}};for(const[e,r]of Object.entries(this.importMapUpdatesCache))E(e,r,t);return{...e||{},imports:t}}postCustomInit(){this.bootReady=!0,this.canInit()&&(O&&clearTimeout(this.watchdogTimerId),this.initApp())}initApp(){try{const e={baseUrl:this.config.baseUrl,profiler:{logOperationStart:l,logOperationEnd:c},appMetadata:{appId:this.config.appId,bootstrapModule:this.config.bootstrapModule,rootComponent:this.config.rootComponent,rootComponents:this.config.rootComponents}},t=function(e,t,r,o,n){if(!t||"function"!=typeof t[2])throw new Error(`Expected loader with specifier "${e}" to be a module`);const i={};if(n){const{factory:r,args:o,exportsObj:s}=u(e,t,n);r(...o),Object.assign(i,s)}else t[2].call(null,i);const{Loader:s}=i;if(!s)throw new Error("Expected Loader class to be defined");const a=new s(r);return o&&o.length&&a.registerExternalModules(o),a.define(e,["exports"],(e=>{Object.assign(e,{define:a.define.bind(a),load:a.load.bind(a),services:a.services,clearRegistry:a.clearRegistry.bind(a)})}),t[3]),a}(this.loaderModule,this.defineCache[this.loaderModule],e,this.config.preloadModules,this.defineCache);this.mountApp(t),t&&t.getModuleWarnings}catch(e){this.enterErrorState(e)}}waitForBody(){return new Promise((e=>{if(document.body)e();else{const t=new MutationObserver((()=>{document.body&&(t.disconnect(),e())}));t.observe(document.documentElement,{childList:!0})}}))}waitForDOMContentLoaded(){return"interactive"===document.readyState||"complete"===document.readyState?Promise.resolve():new Promise((e=>{document.addEventListener("DOMContentLoaded",(()=>{e()}))}))}createProfilerModule(e){e("lwr/profiler/v/0_23_2",["exports"],(e=>{Object.assign(e,{logOperationStart:l,logOperationEnd:c})}),{})}mountApp(e){const{bootstrapModule:t,rootComponent:r,rootComponents:o,serverData:n,endpoints:i}=this.config,s=this.getImportMappingsWithUpdates();this.global.LWR=Object.freeze({define:e.define.bind(e),importMap:e.importMap.bind(e),rootComponent:r,rootComponents:o,serverData:n||{},importMappings:s,endpoints:i,env:this.global.LWR.env}),this.orderedDefs.forEach((t=>{t!==this.loaderModule&&e.define(...this.defineCache[t])}));const{initDeferDOM:a}=this.config;e.registerImportMappings(s).then((()=>"undefined"==typeof window||"undefined"==typeof document?Promise.resolve():a?this.waitForDOMContentLoaded():this.waitForBody())).then((()=>e.load(t))).catch((e=>{this.enterErrorState(new Error(`Application ${r||t} could not be loaded: ${e}`))}))}enterErrorState(e){l({id:"lwr.bootstrap.error"}),this.errorHandler?this.errorHandler(e):M&&console.error(`An error occurred during LWR bootstrap. ${e.message}`,e.stack)}startWatchdogTimer(){return setTimeout((()=>{const e=this.config.requiredModules&&this.config.requiredModules.filter((e=>!this.orderedDefs.includes(e)))||[];this.enterErrorState(new Error(`Failed to load required modules - timed out: ${e.join(", ")}`))}),6e4)}logWarnings(e){for(const t in e)e[t].length&&console.warn(t,e[t])}}const _=globalThis;_.LWR.requiredModules=_.LWR.requiredModules||[],_.LWR.requiredModules.indexOf("lwr/loaderLegacy/v/0_23_2")<0&&_.LWR.requiredModules.push("lwr/loaderLegacy/v/0_23_2"),new R(_)}(),LWR.define("lwr/loaderLegacy/v/0_23_2",["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}"});Object.freeze({code:3008,level:0,message:"Error loading empty code for {0}"});const UNRESOLVED=Object.freeze({code:3009,level:0,message:"Unable to resolve bare specifier: {0}"}),NO_BASE_URL=Object.freeze({code:3010,level:0,message:"baseUrl not set"});Object.freeze({code:3011,level:0,message:"Cannot set a loader service multiple times"});const INVALID_HOOK=Object.freeze({code:3012,level:0,message:"Invalid hook received"}),INVALID_LOADER_SERVICE_RESPONSE=Object.freeze({code:3013,level:0,message:"Invalid response received from hook"}),MODULE_LOAD_TIMEOUT=Object.freeze({code:3014,level:0,message:"Error loading {0} - timed out"}),HTTP_FAIL_LOAD=Object.freeze({code:3015,level:0,message:"Error loading {0}, status code {1}"}),STALE_HOOK_ERROR=Object.freeze({code:3016,level:0,message:"An error occurred handling module conflict"});Object.freeze({code:3017,level:0,message:"Marking module(s) as externally loaded, but they are already loaded: {0}"});const FAIL_HOOK_LOAD=Object.freeze({code:3018,level:0,message:'Error loading "{0}" from hook'}),EXPORTER_ERROR=Object.freeze({code:3021,level:0,message:'Error evaluating module "{0}", error was {1}'}),NO_IMPORT_LWC=Object.freeze({code:3022,level:0,message:'Cannot dynamically import "lwc" with importer "{0}"'}),NO_BLOB_IMPORT=Object.freeze({code:3023,level:0,message:"Cannot import a blob URL"}),NO_IMPORT_LOADER=Object.freeze({code:3024,level:0,message:'Cannot dynamically import the LWR loader with importer "{0}"'}),NO_IMPORT_TRANSPORT=Object.freeze({code:3025,level:0,message:'Cannot dynamically import "transport" with importer "{0}"'}),BAD_IMPORT_MAP=Object.freeze({code:3011,level:0,message:"import map is not valid"}),hasDocument="undefined"!=typeof document,hasSetTimeout="function"==typeof setTimeout,hasConsole="undefined"!=typeof console,hasProcess="undefined"!=typeof process;function getBaseUrl(){let e;if(hasDocument){const t=document.querySelector("base[href]");e=t&&t.href}if(!e&&"undefined"!=typeof location){e=location.href.split("#")[0].split("?")[0];const t=e.lastIndexOf("/");-1!==t&&(e=e.slice(0,t+1))}return e}function isUrl(e){return-1!==e.indexOf("://")}function resolveIfNotPlainOrUrl(e,t){if(-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/")),"/"===e[0]&&"/"===e[1])return t.slice(0,t.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const r=t.slice(0,t.indexOf(":")+1);let o;if("/"===t[r.length+1]?"file:"!==r?(o=t.slice(r.length+2),o=o.slice(o.indexOf("/")+1)):o=t.slice(8):o=t.slice(r.length+("/"===t[r.length]?1:0)),"/"===e[0])return t.slice(0,t.length-o.length-1)+e;const n=o.slice(0,o.lastIndexOf("/")+1)+e,i=[];let s=-1;for(let e=0;e<n.length;e++)-1!==s?"/"===n[e]&&(i.push(n.slice(s,e+1)),s=-1):"."===n[e]?"."!==n[e+1]||"/"!==n[e+2]&&e+2!==n.length?"/"===n[e+1]||e+1===n.length?e+=1:s=e:(i.pop(),e+=2):s=e;return-1!==s&&i.push(n.slice(s)),t.slice(0,t.length-o.length)+i.join("")}}function resolveUrl(e,t){return resolveIfNotPlainOrUrl(e,t)||(isUrl(e)?e:resolveIfNotPlainOrUrl("./"+e,t))}function createScript(e){const t=document.createElement("script");return t.async=!0,t.crossOrigin="anonymous",t.src=e,t}let lastWindowError$1,lastWindowErrorUrl;function loadModuleDef(e){return new Promise((function(t,r){if(hasDocument){const o=createScript(e);o.addEventListener("error",(()=>{r(new LoaderError(FAIL_LOAD,[e]))})),o.addEventListener("load",(()=>{document.head.removeChild(o),lastWindowErrorUrl===e?r(lastWindowError$1):t()})),document.head.appendChild(o)}}))}hasProcess&&process.env,hasDocument&&window.addEventListener("error",(e=>{lastWindowErrorUrl=e.filename,lastWindowError$1=e.error}));const MODULE_LOAD_TIMEOUT_TIMER=6e4;var MODULE_WARNING;!function(e){e.MODULE_REDEFINE="Module redefine attempted";e.MODULE_ALREADY_LOADED="Marking module(s) as externally loaded, but they are already loaded";e.ALIAS_UPDATE="Alias update attempt"}(MODULE_WARNING||(MODULE_WARNING={}));
9
9
  /*!
10
10
  * Copyright (C) 2023 salesforce.com, inc.
11
11
  */
12
- const SUPPORTS_TRUSTED_TYPES="undefined"!=typeof trustedTypes,trustedTypePolicyRegistry={__proto__:null};function createDuplicateSafeTrustedTypesPolicy(e,t){return trustedTypePolicyRegistry[e]?trustedTypePolicyRegistry[e]:trustedTypePolicyRegistry[e]=trustedTypes.createPolicy(e,t)}function createDuplicateSafeFallbackPolicy(e,t){return trustedTypePolicyRegistry[e]?trustedTypePolicyRegistry[e]:trustedTypePolicyRegistry[e]=t}const createPolicy=SUPPORTS_TRUSTED_TYPES?createDuplicateSafeTrustedTypesPolicy:createDuplicateSafeFallbackPolicy,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,[`empty code for ${id}`]);code=`${code}\n//# sourceURL=${id}`;try{eval(trusted.createScript(code))}catch(e){throw new LoaderError(FAIL_LOAD,[`"${id}": ${e instanceof Error?e.message:String(e)}`])}if(lastWindowError)throw new LoaderError(FAIL_LOAD,[`"${id}": window error ${lastWindowError instanceof Error?lastWindowError.message:String(lastWindowError)}`]);return!0}))}async function evaluateLoadHook(e,t){return hasSetTimeout?new Promise(((r,o)=>{const n=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(n)}))})):t}function reportError(e){hasConsole&&console.error(e)}function evaluateHandleStaleModuleHooks(e,t){const{name:r,oldHash:o,newHash:n}=t;for(let t=0;t<e.length;t++){const i=e[t];try{if(null!==i({name:r,oldHash:o,newHash:n}))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`;function _optionalChain$1(e){let t,r=e[0],o=1;for(;o<e.length;){const n=e[o],i=e[o+1];if(o+=2,("optionalAccess"===n||"optionalCall"===n)&&null==r)return;"access"===n||"optionalAccess"===n?(t=r,r=i(r)):"call"!==n&&"optionalCall"!==n||(r=i(((...e)=>r.call(t,...e))),t=void 0)}return r}let timeOfLastYield=0;async function yieldIfNecessary(){const e=checkShouldYield(timeOfLastYield);e.shouldYield&&(timeOfLastYield=e.timeOfLastYield,await yieldToMainThread())}function checkShouldYield(e){if(!globalThis.performance||!getSSREnabled())return{shouldYield:!1,timeOfLastYield:e};const t=globalThis.performance.now();return t-e>50?{shouldYield:!0,timeOfLastYield:t}:{shouldYield:!1,timeOfLastYield:e}}async function yieldToMainThread(){const e=globalThis.scheduler;return _optionalChain$1([e,"optionalAccess",e=>e.yield])?e.yield():new Promise((e=>setTimeout(e,0)))}function getSSREnabled(){const e=globalThis,{SSREnabled:t}=e.LWR&&e.LWR.env||{};return!!t}class ModuleRegistry{__init(){this.isAppMounted=!1}constructor(e){ModuleRegistry.prototype.__init.call(this),ModuleRegistry.prototype.__init2.call(this),ModuleRegistry.prototype.__init3.call(this),ModuleRegistry.prototype.__init4.call(this),this.baseUrl=e.baseUrl||"",this.profiler=e.profiler,this.warnings={[MODULE_WARNING.MODULE_REDEFINE]:[],[MODULE_WARNING.MODULE_ALREADY_LOADED]:[],[MODULE_WARNING.ALIAS_UPDATE]:[]}}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),n=await this.getModuleRecord(o,e);return n.evaluated?n.module:(n.evaluationPromise||(n.evaluationPromise=this.topLevelEvaluation(n)),n.evaluationPromise)}async resolve(e,t){const r=this.baseUrl;let o,n=e;const i=this.resolveHook;let s=!0;if(i){for(let e=0;e<i.length;e++){const t=(0,i[e])(n,{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);n=s;continue}if(o=s&&s.url&&(resolveIfNotPlainOrUrl(s.url,r)||s.url),!o)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);break}}if(n!==e){if(!o&&this.namedDefineRegistry.has(n))return n;e=n}}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,s=e?!!e.defaultUri:s,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 s&&t&&isUrl(o)&&(o+=`?importer=${encodeURIComponent(t)}`),o}has(e){return this.moduleRegistry.has(e)}define(e,t,r,o){const n=this.namedDefineRegistry.get(e);if(n&&n.defined)return void(this.lastDefine=n);const i={name:e,dependencies:t,exporter:r,signatures:o,defined:!0};n&&n.external&&n.external.resolveExternal(i),this.profiler.logOperationStart({id:MODULE_DEFINE,specifier:e}),this.namedDefineRegistry.set(e,i),this.lastDefine=i,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,n)=>{t=o,r=setTimeout((()=>{n(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER)})).finally((()=>{clearTimeout(r)})),n={name:e,defined:!1,external:{resolveExternal:t,moduleDefPromise:o}};this.namedDefineRegistry.set(e,n)}}))}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}__init2(){this.namedDefineRegistry=new Map}__init3(){this.moduleRegistry=new Map}__init4(){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),n=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)})),i={id:e,module:Object.create(null),dependencyRecords:n,instantiation:o,evaluated:!1,evaluationPromise:null};return this.moduleRegistry.set(e,i),this.storeModuleAlias(t,e),n.then((()=>i))}storeModuleAlias(e,t){e!==t&&(this.aliases.has(e)||this.aliases.set(e,t))}async getModuleDependencyRecord(e){let t=await this.resolve(e);if(isUrl(t)){const r=this.moduleRegistry.get(t);r&&!this.aliases.has(e)&&(await r.instantiation,t=await this.resolve(e))}return this.getModuleRecord(t,e)}async topLevelEvaluation(e){return this.evaluateModule(e,{})}async evaluateModule(e,t){await yieldIfNecessary();const r=await e.dependencyRecords;r.length>0&&(t[e.id]=!0,await this.evaluateModuleDependencies(r,t));const{exporter:o,dependencies:n}=await e.instantiation,i={},s=n?await Promise.all(n.map((async e=>{if("exports"===e)return i;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(i)&&Object.defineProperty(i,"__useDefault",{value:!0});const l=a||i;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 n=this.baseUrl,i=r||t;return this.profiler.logOperationStart({id:MODULE_FETCH,specifier:i}),Promise.resolve().then((async()=>{const t=this.loadHook;if(t)for(let r=0;r<t.length;r++){const o=(0,t[r])(e,n),i=isResponseAPromise(o)?await evaluateLoadHook(e,o):o;if(void 0===i)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(i&&null!==i)return evaluateLoadHookResponse(i,e)}return!1})).then((t=>{if(!0!==t&&hasDocument)return loadModuleDef(e)})).then((()=>{if(o=r&&this.namedDefineRegistry.get(r),o||(this.logMessage("warning",`${r} not found, falling back to the last loader.define call`),o=this.lastDefine),!o)throw new LoaderError(FAIL_INSTANTIATE,[e]);return this.profiler.logOperationEnd({id:MODULE_FETCH,specifier:i}),o})).catch((e=>{throw e instanceof LoaderError||this.profiler.logOperationStart({id:MODULE_ERROR,specifier:i}),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}getModuleWarnings(e=!1){return this.isAppMounted=e,this.warnings}logMessage(e,t){}}function _nullishCoalesce(e,t){return null!=e?e:t()}function validateLoadSpecifier(e,t,r,o){const{LoaderError:n,NO_IMPORT_LWC:i,NO_IMPORT_LOADER:s,NO_IMPORT_TRANSPORT:a,NO_BLOB_IMPORT:l}=o;if("lwc"===e||e.startsWith("lwc/v/"))throw new n(i,[_nullishCoalesce(t,(()=>"unknown"))]);if(e===r||e.startsWith(`${r}/v/`))throw new n(s,[_nullishCoalesce(t,(()=>"unknown"))]);if("transport"===e||e.startsWith("transport/v/")||"webruntime/transport"===e||e.startsWith("webruntime/transport/v/"))throw new n(a,[_nullishCoalesce(t,(()=>"unknown"))]);if(e.toLowerCase().startsWith("blob:"))throw new n(l)}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;r=e.lastIndexOf("/",r-1)}while(r>0)}function targetWarning(e,t,r){hasConsole&&console.warn("Package target "+r+", resolving target '"+t+"' for "+e)}function mergeImportMapEntry(e,t,r){const o=r[e];void 0!==o?o!==t&&targetWarning(e,t,`already mapped to "${o}", ignoring conflicting mapping`):r[e]=t}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 n=r&&getMatch(r,o);for(;n;){const e=applyPackages(t,o[n]);if(e)return e;n=getMatch(n.slice(0,n.lastIndexOf("/")),o)}return applyPackages(t,e.imports,e.default)||isUrl(t)&&{uri:t}||void 0}function resolveAndComposePackages(e,t,r,o,n){for(const i in e){const s=resolveIfNotPlainOrUrl(i,r)||i,a=e[i];if("string"!=typeof a)continue;const l=resolveImportMapEntry(o,resolveIfNotPlainOrUrl(a,r)||a,n);l?mergeImportMapEntry(s,l.uri,t):targetWarning(i,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 n in e.scopes){const i=resolveUrl(n,t);resolveAndComposePackages(e.scopes[n],o.scopes[i]||(o.scopes[i]={}),t,r,i)}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)}addImportMapEntries(e){if(e.imports){const t=this.importMap;t.imports||(t.imports={});for(const r in e.imports)mergeImportMapEntry(r,e.imports[r],t.imports)}}}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}const PROTECTED_PATTERNS=[/^lwc$/i,/^lwc\/v\//i,/^@lwc\//i,/^lightningmobileruntime\//i];function isProtectedSpecifier(e){return PROTECTED_PATTERNS.some((t=>t.test(e)))}function validateMappingUri(e,t){const r=e.toLowerCase();if(r.startsWith("blob:"))throw new Error(`Cannot map ${t} to blob: URL`);if(r.startsWith("data:"))throw new Error(`Cannot map ${t} to data: URL`)}function validateSpecifier(e){if("string"!=typeof e||0===e.length)throw new Error("Specifier must be a non-empty string");if(isProtectedSpecifier(e))throw new Error(`Cannot remap protected module: ${e}`)}function validateAndConvertImportMapUpdate(e){if(!e||"object"!=typeof e)throw new Error("LWR.importMap() requires an object argument");const t=Object.entries(e);if(0===t.length)return hasConsole&&console.warn("LWR.importMap() called with empty update object"),null;const r={};for(const[e,o]of t){if(!Array.isArray(o))throw new Error("moduleNames must be an array");if(!e||"string"!=typeof e)throw new Error("moduleScriptURL must be a string");validateMappingUri(e,e);for(const t of o)validateSpecifier(t),t in r?hasConsole&&console.warn(`LWR.importMap(): duplicate module "${t}" — already mapped to "${r[t]}", ignoring mapping to "${e}"`):r[t]=e}return{imports:r}}function _optionalChain(e){let t,r=e[0],o=1;for(;o<e.length;){const n=e[o],i=e[o+1];if(o+=2,("optionalAccess"===n||"optionalCall"===n)&&null==r)return;"access"===n||"optionalAccess"===n?(t=r,r=i(r)):"call"!==n&&"optionalCall"!==n||(r=i(((...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 n=r,i=t,s=o;"function"==typeof i&&(n=t,i=[],s=r),invariant(Array.isArray(i),INVALID_DEPS),this.registry.define(e,i,n,s||{})}async load(e,t){return validateLoadSpecifier(e,t,"lwr/loaderLegacy",{LoaderError:LoaderError,NO_IMPORT_LWC:NO_IMPORT_LWC,NO_IMPORT_LOADER:NO_IMPORT_LOADER,NO_IMPORT_TRANSPORT:NO_IMPORT_TRANSPORT,NO_BLOB_IMPORT:NO_BLOB_IMPORT}),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),t){if(this.importMapResolver||this.parentImportMap)throw new LoaderError(BAD_IMPORT_MAP);this.importMapResolver=new ImportMapResolver(t),this.registry.setImportResolver(this.importMapResolver),this.parentImportMap=this.importMapResolver.importMap}}registerExternalModules(e){this.registry.registerExternalModules(e)}importMap(e){const t=validateAndConvertImportMapUpdate(e);if(!t)return;if(!this.parentImportMap||!this.importMapResolver)throw new LoaderError(BAD_IMPORT_MAP);const r=resolveAndComposeImportMap(t,this.baseUrl,this.parentImportMap);this.importMapResolver.addImportMapEntries(r),this.parentImportMap=this.importMapResolver.importMap}getModuleWarnings(e=!1){return this.registry.getModuleWarnings(e)}}exports.Loader=Loader,Object.defineProperty(exports,"__esModule",{value:!0})}));
12
+ const SUPPORTS_TRUSTED_TYPES="undefined"!=typeof trustedTypes,trustedTypePolicyRegistry={__proto__:null};function createDuplicateSafeTrustedTypesPolicy(e,t){return trustedTypePolicyRegistry[e]?trustedTypePolicyRegistry[e]:trustedTypePolicyRegistry[e]=trustedTypes.createPolicy(e,t)}function createDuplicateSafeFallbackPolicy(e,t){return trustedTypePolicyRegistry[e]?trustedTypePolicyRegistry[e]:trustedTypePolicyRegistry[e]=t}const createPolicy=SUPPORTS_TRUSTED_TYPES?createDuplicateSafeTrustedTypesPolicy:createDuplicateSafeFallbackPolicy,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,[`empty code for ${id}`]);code=`${code}\n//# sourceURL=${id}`;try{eval(trusted.createScript(code))}catch(e){throw new LoaderError(FAIL_LOAD,[`"${id}": ${e instanceof Error?e.message:String(e)}`])}if(lastWindowError)throw new LoaderError(FAIL_LOAD,[`"${id}": window error ${lastWindowError instanceof Error?lastWindowError.message:String(lastWindowError)}`]);return!0}))}async function evaluateLoadHook(e,t){return hasSetTimeout?new Promise(((r,o)=>{const n=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(n)}))})):t}function reportError(e){hasConsole&&console.error(e)}function evaluateHandleStaleModuleHooks(e,t){const{name:r,oldHash:o,newHash:n}=t;for(let t=0;t<e.length;t++){const i=e[t];try{if(null!==i({name:r,oldHash:o,newHash:n}))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`;function _optionalChain$1(e){let t,r=e[0],o=1;for(;o<e.length;){const n=e[o],i=e[o+1];if(o+=2,("optionalAccess"===n||"optionalCall"===n)&&null==r)return;"access"===n||"optionalAccess"===n?(t=r,r=i(r)):"call"!==n&&"optionalCall"!==n||(r=i(((...e)=>r.call(t,...e))),t=void 0)}return r}let timeOfLastYield=0;async function yieldIfNecessary(){const e=checkShouldYield(timeOfLastYield);e.shouldYield&&(timeOfLastYield=e.timeOfLastYield,await yieldToMainThread())}function checkShouldYield(e){if(!globalThis.performance||!getSSREnabled())return{shouldYield:!1,timeOfLastYield:e};const t=globalThis.performance.now();return t-e>50?{shouldYield:!0,timeOfLastYield:t}:{shouldYield:!1,timeOfLastYield:e}}async function yieldToMainThread(){const e=globalThis.scheduler;return _optionalChain$1([e,"optionalAccess",e=>e.yield])?e.yield():new Promise((e=>setTimeout(e,0)))}function getSSREnabled(){const e=globalThis,{SSREnabled:t}=e.LWR&&e.LWR.env||{};return!!t}class ModuleRegistry{__init(){this.isAppMounted=!1}constructor(e){ModuleRegistry.prototype.__init.call(this),ModuleRegistry.prototype.__init2.call(this),ModuleRegistry.prototype.__init3.call(this),ModuleRegistry.prototype.__init4.call(this),this.baseUrl=e.baseUrl||"",this.profiler=e.profiler,this.warnings={[MODULE_WARNING.MODULE_REDEFINE]:[],[MODULE_WARNING.MODULE_ALREADY_LOADED]:[],[MODULE_WARNING.ALIAS_UPDATE]:[]}}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),n=await this.getModuleRecord(o,e);return n.evaluated?n.module:(n.evaluationPromise||(n.evaluationPromise=this.topLevelEvaluation(n)),n.evaluationPromise)}async resolve(e,t){const r=this.baseUrl;let o,n=e;const i=this.resolveHook;let s=!0;if(i){for(let e=0;e<i.length;e++){const t=(0,i[e])(n,{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);n=s;continue}if(o=s&&s.url&&(resolveIfNotPlainOrUrl(s.url,r)||s.url),!o)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);break}}if(n!==e){if(!o&&this.namedDefineRegistry.has(n))return n;e=n}}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,s=e?!!e.defaultUri:s,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 s&&t&&isUrl(o)&&(o+=`?importer=${encodeURIComponent(t)}`),o}has(e){return this.moduleRegistry.has(e)}define(e,t,r,o){const n=this.namedDefineRegistry.get(e);if(n&&n.defined)return void(this.lastDefine=n);const i={name:e,dependencies:t,exporter:r,signatures:o,defined:!0};n&&n.external&&n.external.resolveExternal(i),this.profiler.logOperationStart({id:MODULE_DEFINE,specifier:e}),this.namedDefineRegistry.set(e,i),this.lastDefine=i,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,n)=>{t=o,r=setTimeout((()=>{n(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER)})).finally((()=>{clearTimeout(r)})),n={name:e,defined:!1,external:{resolveExternal:t,moduleDefPromise:o}};this.namedDefineRegistry.set(e,n)}}))}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}__init2(){this.namedDefineRegistry=new Map}__init3(){this.moduleRegistry=new Map}__init4(){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),n=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)})),i={id:e,module:Object.create(null),dependencyRecords:n,instantiation:o,evaluated:!1,evaluationPromise:null};return this.moduleRegistry.set(e,i),this.storeModuleAlias(t,e),n.then((()=>i))}storeModuleAlias(e,t){e!==t&&(this.aliases.has(e)||this.aliases.set(e,t))}async getModuleDependencyRecord(e){let t=await this.resolve(e);if(isUrl(t)){const r=this.moduleRegistry.get(t);r&&!this.aliases.has(e)&&(await r.instantiation,t=await this.resolve(e))}return this.getModuleRecord(t,e)}async topLevelEvaluation(e){return this.evaluateModule(e,{})}async evaluateModule(e,t){await yieldIfNecessary();const r=await e.dependencyRecords;r.length>0&&(t[e.id]=!0,await this.evaluateModuleDependencies(r,t));const{exporter:o,dependencies:n}=await e.instantiation,i={},s=n?await Promise.all(n.map((async e=>{if("exports"===e)return i;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(i)&&Object.defineProperty(i,"__useDefault",{value:!0});const l=a||i;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 n=this.baseUrl,i=r||t;return this.profiler.logOperationStart({id:MODULE_FETCH,specifier:i}),Promise.resolve().then((async()=>{const t=this.loadHook;if(t)for(let r=0;r<t.length;r++){const o=(0,t[r])(e,n),i=isResponseAPromise(o)?await evaluateLoadHook(e,o):o;if(void 0===i)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(i&&null!==i)return evaluateLoadHookResponse(i,e)}return!1})).then((t=>{if(!0!==t&&hasDocument)return loadModuleDef(e)})).then((()=>{if(o=r&&this.namedDefineRegistry.get(r),o||(this.logMessage("warning",`${r} not found, falling back to the last loader.define call`),o=this.lastDefine),!o)throw new LoaderError(FAIL_INSTANTIATE,[e]);return this.profiler.logOperationEnd({id:MODULE_FETCH,specifier:i}),o})).catch((e=>{throw e instanceof LoaderError||this.profiler.logOperationStart({id:MODULE_ERROR,specifier:i}),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}getModuleWarnings(e=!1){return this.isAppMounted=e,this.warnings}logMessage(e,t){}}function _nullishCoalesce(e,t){return null!=e?e:t()}function validateLoadSpecifier(e,t,r,o){const{LoaderError:n,NO_IMPORT_LWC:i,NO_IMPORT_LOADER:s,NO_IMPORT_TRANSPORT:a,NO_BLOB_IMPORT:l}=o;if("lwc"===e||e.startsWith("lwc/v/"))throw new n(i,[_nullishCoalesce(t,(()=>"unknown"))]);if(e===r||e.startsWith(`${r}/v/`))throw new n(s,[_nullishCoalesce(t,(()=>"unknown"))]);if("transport"===e||e.startsWith("transport/v/")||"webruntime/transport"===e||e.startsWith("webruntime/transport/v/"))throw new n(a,[_nullishCoalesce(t,(()=>"unknown"))]);if(e.toLowerCase().startsWith("blob:"))throw new n(l)}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;r=e.lastIndexOf("/",r-1)}while(r>0)}function targetWarning(e,t,r){hasConsole&&console.warn("Package target "+r+", resolving target '"+t+"' for "+e)}function mergeImportMapEntry(e,t,r){const o=r[e];void 0!==o?o!==t&&targetWarning(e,t,`already mapped to "${o}", ignoring conflicting mapping`):r[e]=t}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 n=r&&getMatch(r,o);for(;n;){const e=applyPackages(t,o[n]);if(e)return e;n=getMatch(n.slice(0,n.lastIndexOf("/")),o)}return applyPackages(t,e.imports,e.default)||isUrl(t)&&{uri:t}||void 0}function resolveAndComposePackages(e,t,r,o,n){for(const i in e){const s=resolveIfNotPlainOrUrl(i,r)||i,a=e[i];if("string"!=typeof a)continue;const l=resolveImportMapEntry(o,resolveIfNotPlainOrUrl(a,r)||a,n);l?mergeImportMapEntry(s,l.uri,t):targetWarning(i,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 n in e.scopes){const i=resolveUrl(n,t);resolveAndComposePackages(e.scopes[n],o.scopes[i]||(o.scopes[i]={}),t,r,i)}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)}addImportMapEntries(e){if(e.imports){const t=this.importMap;t.imports||(t.imports={});for(const r in e.imports)mergeImportMapEntry(r,e.imports[r],t.imports)}}}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 validateMappingUri(e,t){const r=e.toLowerCase();if(r.startsWith("blob:"))throw new Error(`Cannot map ${t} to blob: URL`);if(r.startsWith("data:"))throw new Error(`Cannot map ${t} to data: URL`)}function validateSpecifier(e){if("string"!=typeof e||0===e.length)throw new Error("Specifier must be a non-empty string")}function validateAndConvertImportMapUpdate(e){if(!e||"object"!=typeof e)throw new Error("LWR.importMap() requires an object argument");const t=Object.entries(e);if(0===t.length)return hasConsole&&console.warn("LWR.importMap() called with empty update object"),null;const r={};for(const[e,o]of t){if(!Array.isArray(o))throw new Error("moduleNames must be an array");if(!e||"string"!=typeof e)throw new Error("moduleScriptURL must be a string");validateMappingUri(e,e);for(const t of o)validateSpecifier(t),t in r?hasConsole&&console.warn(`LWR.importMap(): duplicate module "${t}" — already mapped to "${r[t]}", ignoring mapping to "${e}"`):r[t]=e}return{imports:r}}function _optionalChain(e){let t,r=e[0],o=1;for(;o<e.length;){const n=e[o],i=e[o+1];if(o+=2,("optionalAccess"===n||"optionalCall"===n)&&null==r)return;"access"===n||"optionalAccess"===n?(t=r,r=i(r)):"call"!==n&&"optionalCall"!==n||(r=i(((...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 n=r,i=t,s=o;"function"==typeof i&&(n=t,i=[],s=r),invariant(Array.isArray(i),INVALID_DEPS),this.registry.define(e,i,n,s||{})}async load(e,t){return validateLoadSpecifier(e,t,"lwr/loaderLegacy",{LoaderError:LoaderError,NO_IMPORT_LWC:NO_IMPORT_LWC,NO_IMPORT_LOADER:NO_IMPORT_LOADER,NO_IMPORT_TRANSPORT:NO_IMPORT_TRANSPORT,NO_BLOB_IMPORT:NO_BLOB_IMPORT}),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),t){if(this.importMapResolver||this.parentImportMap)throw new LoaderError(BAD_IMPORT_MAP);this.importMapResolver=new ImportMapResolver(t),this.registry.setImportResolver(this.importMapResolver),this.parentImportMap=this.importMapResolver.importMap}}registerExternalModules(e){this.registry.registerExternalModules(e)}importMap(e){const t=validateAndConvertImportMapUpdate(e);if(!t)return;if(!this.parentImportMap||!this.importMapResolver)throw new LoaderError(BAD_IMPORT_MAP);const r=resolveAndComposeImportMap(t,this.baseUrl,this.parentImportMap);this.importMapResolver.addImportMapEntries(r),this.parentImportMap=this.importMapResolver.importMap}getModuleWarnings(e=!1){return this.registry.getModuleWarnings(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.22.14 */
7
+ /* LWR Legacy Module Loader Shim v0.23.2 */
8
8
  (function () {
9
9
  'use strict';
10
10
 
@@ -285,27 +285,6 @@
285
285
  // eslint-disable-next-line no-undef
286
286
  hasProcess$1 && process.env;
287
287
 
288
- /**
289
- * List of protected module patterns that cannot be remapped.
290
- * Uses case-insensitive matching to prevent bypass attempts (e.g., HF-1027).
291
- */
292
- const PROTECTED_PATTERNS = [
293
- /^lwc$/i, // Core LWC
294
- /^lwc\/v\//i, // Versioned LWC variants
295
- /^@lwc\//i, // LWC scoped packages
296
- /^lightningmobileruntime\//i, // Lightning mobile runtime
297
- ];
298
-
299
- /**
300
- * Checks if a specifier matches any protected module pattern.
301
- *
302
- * @param specifier - The module specifier to check
303
- * @returns true if the specifier is protected, false otherwise
304
- */
305
- function isProtectedSpecifier(specifier) {
306
- return PROTECTED_PATTERNS.some((pattern) => pattern.test(specifier));
307
- }
308
-
309
288
  /**
310
289
  * Validates that a URI does not use dangerous URL schemes.
311
290
  *
@@ -330,19 +309,15 @@
330
309
  }
331
310
 
332
311
  /**
333
- * Validates that a specifier is well-formed and not protected.
312
+ * Validates that a specifier is well-formed.
334
313
  *
335
314
  * @param specifier - The module specifier to validate
336
- * @throws Error if the specifier is invalid or protected
315
+ * @throws Error if the specifier is invalid
337
316
  */
338
317
  function validateSpecifier(specifier) {
339
318
  if (typeof specifier !== 'string' || specifier.length === 0) {
340
319
  throw new Error('Specifier must be a non-empty string');
341
320
  }
342
-
343
- if (isProtectedSpecifier(specifier)) {
344
- throw new Error(`Cannot remap protected module: ${specifier}`);
345
- }
346
321
  }
347
322
 
348
323
  /**
@@ -461,7 +436,7 @@
461
436
  // Parse configuration
462
437
  this.global = global;
463
438
  this.config = global.LWR ;
464
- this.loaderModule = 'lwr/loaderLegacy/v/0_22_14';
439
+ this.loaderModule = 'lwr/loaderLegacy/v/0_23_2';
465
440
 
466
441
  // Set up error handler
467
442
  this.errorHandler = this.config.onError ;
@@ -661,7 +636,7 @@
661
636
  const exporter = (exports) => {
662
637
  Object.assign(exports, { logOperationStart, logOperationEnd });
663
638
  };
664
- define('lwr/profiler/v/0_22_14', ['exports'], exporter, {});
639
+ define('lwr/profiler/v/0_23_2', ['exports'], exporter, {});
665
640
  }
666
641
 
667
642
  // Set up the application globals, import map, root custom element...
@@ -758,8 +733,8 @@
758
733
  // The loader module is ALWAYS required
759
734
  const GLOBAL = globalThis ;
760
735
  GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
761
- if (GLOBAL.LWR.requiredModules.indexOf('lwr/loaderLegacy/v/0_22_14') < 0) {
762
- GLOBAL.LWR.requiredModules.push('lwr/loaderLegacy/v/0_22_14');
736
+ if (GLOBAL.LWR.requiredModules.indexOf('lwr/loaderLegacy/v/0_23_2') < 0) {
737
+ GLOBAL.LWR.requiredModules.push('lwr/loaderLegacy/v/0_23_2');
763
738
  }
764
739
  new LoaderShim(GLOBAL);
765
740
 
@@ -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.22.14 */
7
+ /* LWR Module Loader Shim v0.23.2 */
8
8
  (function () {
9
9
  'use strict';
10
10
 
@@ -310,7 +310,7 @@
310
310
  // Parse configuration
311
311
  this.global = global;
312
312
  this.config = global.LWR ;
313
- this.loaderSpecifier = 'lwr/loader/v/0_22_14';
313
+ this.loaderSpecifier = 'lwr/loader/v/0_23_2';
314
314
 
315
315
  // Set up error handler
316
316
  this.errorHandler = this.config.onError ;
@@ -475,7 +475,7 @@
475
475
  const exporter = (exports) => {
476
476
  Object.assign(exports, { logOperationStart, logOperationEnd });
477
477
  };
478
- define('lwr/profiler/v/0_22_14', ['exports'], exporter);
478
+ define('lwr/profiler/v/0_23_2', ['exports'], exporter);
479
479
  }
480
480
 
481
481
  // Set up the application globals, import map, root custom element...
@@ -576,14 +576,14 @@
576
576
  // The loader module is ALWAYS required
577
577
  const GLOBAL = globalThis ;
578
578
  GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
579
- if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_22_14') < 0) {
580
- GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_22_14');
579
+ if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_23_2') < 0) {
580
+ GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_23_2');
581
581
  }
582
582
  new LoaderShim(GLOBAL);
583
583
 
584
584
  })();
585
585
 
586
- LWR.define('lwr/loader/v/0_22_14', ['exports'], (function (exports) { 'use strict';
586
+ LWR.define('lwr/loader/v/0_23_2', ['exports'], (function (exports) { 'use strict';
587
587
 
588
588
  const templateRegex = /\{([0-9]+)\}/g;
589
589
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -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.22.14 */
8
- !function(){"use strict";var e=function(e){return e[e.Start=0]="Start",e[e.End=1]="End",e}(e||{});let t;function r(e){t=e}const o=globalThis.performance,i=void 0!==o&&"function"==typeof o.mark&&"function"==typeof o.clearMarks&&"function"==typeof o.measure&&"function"==typeof o.clearMeasures;function n(e,t){return t?`${e}-${t}`:e}function s(e,t,r){const o=n(e,t);return t&&r?`${o}_${r}`:o}function a(e,t){const r=e||t?{...t}:null;return r&&e&&(r.specifier=e),r}function l({id:r,specifier:n,specifierIndex:l,metadata:d}){if(t)t({id:r,phase:e.Start,specifier:n,metadata:d,specifierIndex:l});else if(i){const e=s(r,n,l),t=a(n,d);o.mark(e,{detail:t})}}function d({id:r,specifier:l,specifierIndex:d,metadata:c}){if(t)t({id:r,phase:e.End,specifier:l,metadata:c,specifierIndex:d});else if(i){const e=s(r,l,d),t=n(r,l),i=a(l,c);o.measure(t,{start:e,detail:i}),o.clearMarks(e),o.clearMeasures(t)}}function c(e){const[,t,r]=e;if(Array.isArray(t)&&"function"==typeof r)return{deps:t,factory:r};if("function"==typeof t)return{deps:[],factory:t};throw new Error("Invalid module definition")}function p(e,t,r){if("exports"===e)return t;const o=r[e];if(!o)throw new Error(`Dependency "${e}" not found in defineCache for loader`);try{return function(e){const{deps:t,factory:r}=c(e);if(t.length>1||1===t.length&&"exports"!==t[0])throw new Error(`Loader dependencies must have no deps or only ['exports']; got [${t.join(", ")}]`);const o={},i=r(o);return void 0!==i?i:o}(o)}catch(t){const r=t instanceof Error?t.message:String(t);throw new Error(`Loader dependency "${e}" has invalid definition: ${r}`)}}function u(e,t,r){try{const{deps:e,factory:o}=function(e){const{deps:t,factory:r}=c(e);if(t.includes("exports"))return{deps:t,factory:r};const o=0===t.length;return{deps:["exports",...t],factory:(e,...t)=>{const i=o?r(e):r(...t);void 0!==i&&"object"==typeof i&&Object.assign(e,i)}}}(t),i={};return{factory:o,args:e.map((e=>p(e,i,r))),exportsObj:i}}catch(t){const r=t instanceof Error?t.message:String(t);throw new Error(`Expected loader with specifier "${e}" to be a module. ${r}`)}}function h(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 f="function"==typeof setTimeout,g="undefined"!=typeof console;class m{__init(){this.defineCache={}}__init2(){this.orderedDefs=[]}constructor(e){m.prototype.__init.call(this),m.prototype.__init2.call(this),f&&(this.watchdogTimerId=this.startWatchdogTimer()),this.global=e,this.config=e.LWR,this.loaderSpecifier="lwr/loader/v/0_22_14",this.errorHandler=this.config.onError,this.initAppHandler=this.config.onInitApp;const t=this.tempDefine.bind(this);e.LWR.define=t,this.bootReady=this.config.autoBoot;try{this.createProfilerModule(e.LWR.define),h(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()&&(f&&clearTimeout(this.watchdogTimerId),this.initApp())}postCustomInit(){this.bootReady=!0,this.canInit()&&(f&&clearTimeout(this.watchdogTimerId),this.initApp())}initApp(){try{this.initAppHandler&&this.initAppHandler()}catch(e){console.error(`An error occurred in the onInitApp function. ${e.message}`,e.stack)}try{const e={endpoints:this.config.endpoints,baseUrl:this.config.baseUrl,flags:this.config.flags,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,i){if(!t||"function"!=typeof t[2])throw new Error(`Expected loader with specifier "${e}" to be a module`);const n={};if(i){const{factory:r,args:o,exportsObj:s}=u(e,t,i);r(...o),Object.assign(n,s)}else t[2].call(null,n);const{Loader:s}=n;if(!s)throw new Error("Expected Loader class to be defined");const a=new s(r);return o&&o.length&&a.registerExternalModules(o),a.define(e,["exports"],(e=>{Object.assign(e,{define:a.define.bind(a),load:a.load.bind(a),services:a.services})})),a}(this.loaderSpecifier,this.defineCache[this.loaderSpecifier],e,this.config.preloadModules,this.defineCache);this.mountApp(t),t&&t.getModuleWarnings}catch(e){this.enterErrorState(e)}}waitForBody(){return new Promise((e=>{if(document.body)e();else{const t=new MutationObserver((()=>{document.body&&(t.disconnect(),e())}));t.observe(document.documentElement,{childList:!0})}}))}waitForDOMContentLoaded(){return"interactive"===document.readyState||"complete"===document.readyState?Promise.resolve():new Promise((e=>{document.addEventListener("DOMContentLoaded",(()=>{e()}))}))}createProfilerModule(e){e("lwr/profiler/v/0_22_14",["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),importMap:t=>e.importMap(t),rootComponent:r,rootComponents:o,serverData:i||{},endpoints:n,imports:l,index:a||{},env:this.global.LWR.env}),this.orderedDefs.forEach((t=>{t!==this.loaderSpecifier&&e.define(...this.defineCache[t])}));const{initDeferDOM:d}=this.config;e.importMap({imports:l,index:a},[t,r]).then((()=>"undefined"==typeof window||"undefined"==typeof document?Promise.resolve():d?this.waitForDOMContentLoaded():this.waitForBody())).then((()=>e.load(t))).catch((e=>{this.enterErrorState(new Error(`Application ${r||t} could not be loaded: ${e}`))}))}enterErrorState(e){l({id:"lwr.bootstrap.error"}),this.errorHandler?this.errorHandler(e):g&&console.error(`An error occurred during LWR bootstrap. ${e.message}`,e.stack)}startWatchdogTimer(){return setTimeout((()=>{const e=this.config.requiredModules&&this.config.requiredModules.filter((e=>!this.orderedDefs.includes(e)))||[];this.enterErrorState(new Error(`Failed to load required modules - timed out: ${e.join(", ")}`))}),6e4)}logWarnings(e){for(const t in e)e[t].length&&console.warn(t,e[t])}}const E=globalThis;E.LWR.requiredModules=E.LWR.requiredModules||[],E.LWR.requiredModules.indexOf("lwr/loader/v/0_22_14")<0&&E.LWR.requiredModules.push("lwr/loader/v/0_22_14"),new m(E)}(),LWR.define("lwr/loader/v/0_22_14",["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}"});Object.freeze({code:3008,level:0,message:"Error loading empty code for {0}"});const UNRESOLVED=Object.freeze({code:3009,level:0,message:"Unable to resolve bare specifier: {0}"}),NO_BASE_URL=Object.freeze({code:3010,level:0,message:"baseUrl not set"});Object.freeze({code:3011,level:0,message:"Cannot set a loader service multiple times"});const INVALID_HOOK=Object.freeze({code:3012,level:0,message:"Invalid hook received"}),INVALID_LOADER_SERVICE_RESPONSE=Object.freeze({code:3013,level:0,message:"Invalid response received from hook"}),MODULE_LOAD_TIMEOUT=Object.freeze({code:3014,level:0,message:"Error loading {0} - timed out"}),HTTP_FAIL_LOAD=Object.freeze({code:3015,level:0,message:"Error loading {0}, status code {1}"}),STALE_HOOK_ERROR=Object.freeze({code:3016,level:0,message:"An error occurred handling module conflict"});Object.freeze({code:3017,level:0,message:"Marking module(s) as externally loaded, but they are already loaded:"});const FAIL_HOOK_LOAD=Object.freeze({code:3018,level:0,message:'Error loading "{0}" from hook'}),NO_MAPPING_URL=Object.freeze({code:3019,level:0,message:"Mapping endpoint not set"}),BAD_IMPORT_METADATA=Object.freeze({code:3020,level:0,message:"Invalid import metadata: {0} {1}"}),EXPORTER_ERROR=Object.freeze({code:3021,level:0,message:'Error evaluating module "{0}", error was "{1}"'}),UNRESOLVEABLE_MAPPING_ERROR=Object.freeze({code:3022,level:0,message:'Unexpected undefined URI resolving mapping for "{0}"'}),NO_IMPORT_LWC=Object.freeze({code:3023,level:0,message:'Cannot dynamically import "lwc" with importer "{0}"'}),NO_IMPORT_LOADER=Object.freeze({code:3024,level:0,message:'Cannot dynamically import the LWR loader with importer "{0}"'}),NO_BLOB_IMPORT=Object.freeze({code:3024,level:0,message:"Cannot import a blob URL"}),NO_IMPORT_TRANSPORT=Object.freeze({code:3025,level:0,message:'Cannot dynamically import "transport" with importer "{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;function getBaseUrl(){let e;if(hasDocument){const t=document.querySelector("base[href]");e=t&&t.href}if(!e&&"undefined"!=typeof location){e=location.href.split("#")[0].split("?")[0];const t=e.lastIndexOf("/");-1!==t&&(e=e.slice(0,t+1))}return e}function isUrl(e){return-1!==e.indexOf("://")}function resolveIfNotPlainOrUrl(e,t){if(-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/")),"/"===e[0]&&"/"===e[1])return t.slice(0,t.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const r=t.slice(0,t.indexOf(":")+1);let o;if("/"===t[r.length+1]?"file:"!==r?(o=t.slice(r.length+2),o=o.slice(o.indexOf("/")+1)):o=t.slice(8):o=t.slice(r.length+("/"===t[r.length]?1:0)),"/"===e[0])return t.slice(0,t.length-o.length-1)+e;const i=o.slice(0,o.lastIndexOf("/")+1)+e,n=[];let s=-1;for(let e=0;e<i.length;e++)-1!==s?"/"===i[e]&&(n.push(i.slice(s,e+1)),s=-1):"."===i[e]?"."!==i[e+1]||"/"!==i[e+2]&&e+2!==i.length?"/"===i[e+1]||e+1===i.length?e+=1:s=e:(n.pop(),e+=2):s=e;return-1!==s&&n.push(i.slice(s)),t.slice(0,t.length-o.length)+n.join("")}}function resolveUrl(e,t){return resolveIfNotPlainOrUrl(e,t)||(isUrl(e)?e:resolveIfNotPlainOrUrl("./"+e,t))}function createScript(e){const t=document.createElement("script");return t.async=!0,t.crossOrigin="anonymous",t.src=e,t}let lastWindowError$1,lastWindowErrorUrl;function loadModuleDef(e){return new Promise((function(t,r){if(hasDocument){const o=createScript(e);o.addEventListener("error",(()=>{r(new LoaderError(FAIL_LOAD,[e]))})),o.addEventListener("load",(()=>{document.head.removeChild(o),lastWindowErrorUrl===e?r(lastWindowError$1):t()})),document.head.appendChild(o)}}))}hasProcess&&process.env,hasDocument&&window.addEventListener("error",(e=>{lastWindowErrorUrl=e.filename,lastWindowError$1=e.error}));const LOADER_PREFIX="lwr.loader.",MODULE_DEFINE=`${LOADER_PREFIX}module.define`,MODULE_DYNAMIC_LOAD=`${LOADER_PREFIX}module.dynamicLoad`,MODULE_FETCH=`${LOADER_PREFIX}module.fetch`,MODULE_ERROR=`${LOADER_PREFIX}module.error`,MAPPINGS_FETCH=`${LOADER_PREFIX}mappings.fetch`,MAPPINGS_ERROR=`${LOADER_PREFIX}mappings.error`;function _optionalChain(e){let t,r=e[0],o=1;for(;o<e.length;){const i=e[o],n=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==r)return;"access"===i||"optionalAccess"===i?(t=r,r=n(r)):"call"!==i&&"optionalCall"!==i||(r=n(((...e)=>r.call(t,...e))),t=void 0)}return r}class ImportMetadataResolver{__init(){this.importURICache=new Map}__init2(){this.pendingURICache=new Map}__init3(){this.loadMappingHooks=[]}__init4(){this.batchSpecifiers=[]}constructor(e,t){ImportMetadataResolver.prototype.__init.call(this),ImportMetadataResolver.prototype.__init2.call(this),ImportMetadataResolver.prototype.__init3.call(this),ImportMetadataResolver.prototype.__init4.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(!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))}))}getMappingUri(e){return _optionalChain([this,"access",e=>e.importURICache,"access",e=>e.get,"call",t=>t(e),"optionalAccess",e=>e.uri])}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(!hasSetTimeout||!_optionalChain([this,"access",e=>e.config,"optionalAccess",e=>e.flags,"optionalAccess",e=>e.batchMappings]))return this.fetchNewMappingsInner(e);const t=()=>{const e=this.batchSpecifiers.join(",");return this.batchSpecifiers=[],clearTimeout(this.batchTimer),this.batchTimer=void 0,this.fetchNewMappingsInner(e)};return this.batchPromise&&0!==this.batchSpecifiers.length||(this.batchPromise=new Promise((e=>{this.batchTimer=setTimeout((()=>e(t())),0)}))),this.batchSpecifiers.push(e),this.batchPromise}async fetchNewMappingsInner(e){if("function"!=typeof globalThis.fetch)throw new LoaderError(UNRESOLVED,[e]);const t=resolveUrl(this.buildMappingUrl(e),this.getBaseUrl());if(!t)throw new LoaderError(UNRESOLVEABLE_MAPPING_ERROR,[e]);return globalThis.fetch(t).then((t=>{if(!t.ok)throw this.config.profiler.logOperationStart({id:MAPPINGS_ERROR,specifier:e}),new LoaderError(UNRESOLVED,[e]);return t.json().then((e=>e))})).catch((t=>{throw new LoaderError(UNRESOLVED,[e])}))}saveImportURIRecord(e,t,r,o){r&&t!==r?this.importURICache.set(e,{uri:t,identity:r,isRoot:o}):this.importURICache.set(e,{uri:t,isRoot:o})}}function reportError(e){hasConsole&&console.error(e)}function evaluateHandleStaleModuleHooks(e,t){const{name:r,oldUrl:o,newUrl:i}=t;for(let t=0;t<e.length;t++){const n=e[t];try{if(null!==n({name:r,oldUrl:o,newUrl:i}))break}catch(e){reportError(new LoaderError(STALE_HOOK_ERROR))}}}const MODULE_LOAD_TIMEOUT_TIMER=6e4;var MODULE_WARNING;!function(e){e.MODULE_REDEFINE="Module redefine attempted";e.MODULE_ALREADY_LOADED="Marking module(s) as externally loaded, but they are already loaded";e.ALIAS_UPDATE="Alias update attempt"}(MODULE_WARNING||(MODULE_WARNING={}));
7
+ /* LWR Module Loader Shim v0.23.2 */
8
+ !function(){"use strict";var e=function(e){return e[e.Start=0]="Start",e[e.End=1]="End",e}(e||{});let t;function r(e){t=e}const o=globalThis.performance,i=void 0!==o&&"function"==typeof o.mark&&"function"==typeof o.clearMarks&&"function"==typeof o.measure&&"function"==typeof o.clearMeasures;function n(e,t){return t?`${e}-${t}`:e}function s(e,t,r){const o=n(e,t);return t&&r?`${o}_${r}`:o}function a(e,t){const r=e||t?{...t}:null;return r&&e&&(r.specifier=e),r}function l({id:r,specifier:n,specifierIndex:l,metadata:d}){if(t)t({id:r,phase:e.Start,specifier:n,metadata:d,specifierIndex:l});else if(i){const e=s(r,n,l),t=a(n,d);o.mark(e,{detail:t})}}function d({id:r,specifier:l,specifierIndex:d,metadata:c}){if(t)t({id:r,phase:e.End,specifier:l,metadata:c,specifierIndex:d});else if(i){const e=s(r,l,d),t=n(r,l),i=a(l,c);o.measure(t,{start:e,detail:i}),o.clearMarks(e),o.clearMeasures(t)}}function c(e){const[,t,r]=e;if(Array.isArray(t)&&"function"==typeof r)return{deps:t,factory:r};if("function"==typeof t)return{deps:[],factory:t};throw new Error("Invalid module definition")}function p(e,t,r){if("exports"===e)return t;const o=r[e];if(!o)throw new Error(`Dependency "${e}" not found in defineCache for loader`);try{return function(e){const{deps:t,factory:r}=c(e);if(t.length>1||1===t.length&&"exports"!==t[0])throw new Error(`Loader dependencies must have no deps or only ['exports']; got [${t.join(", ")}]`);const o={},i=r(o);return void 0!==i?i:o}(o)}catch(t){const r=t instanceof Error?t.message:String(t);throw new Error(`Loader dependency "${e}" has invalid definition: ${r}`)}}function u(e,t,r){try{const{deps:e,factory:o}=function(e){const{deps:t,factory:r}=c(e);if(t.includes("exports"))return{deps:t,factory:r};const o=0===t.length;return{deps:["exports",...t],factory:(e,...t)=>{const i=o?r(e):r(...t);void 0!==i&&"object"==typeof i&&Object.assign(e,i)}}}(t),i={};return{factory:o,args:e.map((e=>p(e,i,r))),exportsObj:i}}catch(t){const r=t instanceof Error?t.message:String(t);throw new Error(`Expected loader with specifier "${e}" to be a module. ${r}`)}}function h(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 f="function"==typeof setTimeout,g="undefined"!=typeof console;class m{__init(){this.defineCache={}}__init2(){this.orderedDefs=[]}constructor(e){m.prototype.__init.call(this),m.prototype.__init2.call(this),f&&(this.watchdogTimerId=this.startWatchdogTimer()),this.global=e,this.config=e.LWR,this.loaderSpecifier="lwr/loader/v/0_23_2",this.errorHandler=this.config.onError,this.initAppHandler=this.config.onInitApp;const t=this.tempDefine.bind(this);e.LWR.define=t,this.bootReady=this.config.autoBoot;try{this.createProfilerModule(e.LWR.define),h(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()&&(f&&clearTimeout(this.watchdogTimerId),this.initApp())}postCustomInit(){this.bootReady=!0,this.canInit()&&(f&&clearTimeout(this.watchdogTimerId),this.initApp())}initApp(){try{this.initAppHandler&&this.initAppHandler()}catch(e){console.error(`An error occurred in the onInitApp function. ${e.message}`,e.stack)}try{const e={endpoints:this.config.endpoints,baseUrl:this.config.baseUrl,flags:this.config.flags,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,i){if(!t||"function"!=typeof t[2])throw new Error(`Expected loader with specifier "${e}" to be a module`);const n={};if(i){const{factory:r,args:o,exportsObj:s}=u(e,t,i);r(...o),Object.assign(n,s)}else t[2].call(null,n);const{Loader:s}=n;if(!s)throw new Error("Expected Loader class to be defined");const a=new s(r);return o&&o.length&&a.registerExternalModules(o),a.define(e,["exports"],(e=>{Object.assign(e,{define:a.define.bind(a),load:a.load.bind(a),services:a.services})})),a}(this.loaderSpecifier,this.defineCache[this.loaderSpecifier],e,this.config.preloadModules,this.defineCache);this.mountApp(t),t&&t.getModuleWarnings}catch(e){this.enterErrorState(e)}}waitForBody(){return new Promise((e=>{if(document.body)e();else{const t=new MutationObserver((()=>{document.body&&(t.disconnect(),e())}));t.observe(document.documentElement,{childList:!0})}}))}waitForDOMContentLoaded(){return"interactive"===document.readyState||"complete"===document.readyState?Promise.resolve():new Promise((e=>{document.addEventListener("DOMContentLoaded",(()=>{e()}))}))}createProfilerModule(e){e("lwr/profiler/v/0_23_2",["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),importMap:t=>e.importMap(t),rootComponent:r,rootComponents:o,serverData:i||{},endpoints:n,imports:l,index:a||{},env:this.global.LWR.env}),this.orderedDefs.forEach((t=>{t!==this.loaderSpecifier&&e.define(...this.defineCache[t])}));const{initDeferDOM:d}=this.config;e.importMap({imports:l,index:a},[t,r]).then((()=>"undefined"==typeof window||"undefined"==typeof document?Promise.resolve():d?this.waitForDOMContentLoaded():this.waitForBody())).then((()=>e.load(t))).catch((e=>{this.enterErrorState(new Error(`Application ${r||t} could not be loaded: ${e}`))}))}enterErrorState(e){l({id:"lwr.bootstrap.error"}),this.errorHandler?this.errorHandler(e):g&&console.error(`An error occurred during LWR bootstrap. ${e.message}`,e.stack)}startWatchdogTimer(){return setTimeout((()=>{const e=this.config.requiredModules&&this.config.requiredModules.filter((e=>!this.orderedDefs.includes(e)))||[];this.enterErrorState(new Error(`Failed to load required modules - timed out: ${e.join(", ")}`))}),6e4)}logWarnings(e){for(const t in e)e[t].length&&console.warn(t,e[t])}}const E=globalThis;E.LWR.requiredModules=E.LWR.requiredModules||[],E.LWR.requiredModules.indexOf("lwr/loader/v/0_23_2")<0&&E.LWR.requiredModules.push("lwr/loader/v/0_23_2"),new m(E)}(),LWR.define("lwr/loader/v/0_23_2",["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}"});Object.freeze({code:3008,level:0,message:"Error loading empty code for {0}"});const UNRESOLVED=Object.freeze({code:3009,level:0,message:"Unable to resolve bare specifier: {0}"}),NO_BASE_URL=Object.freeze({code:3010,level:0,message:"baseUrl not set"});Object.freeze({code:3011,level:0,message:"Cannot set a loader service multiple times"});const INVALID_HOOK=Object.freeze({code:3012,level:0,message:"Invalid hook received"}),INVALID_LOADER_SERVICE_RESPONSE=Object.freeze({code:3013,level:0,message:"Invalid response received from hook"}),MODULE_LOAD_TIMEOUT=Object.freeze({code:3014,level:0,message:"Error loading {0} - timed out"}),HTTP_FAIL_LOAD=Object.freeze({code:3015,level:0,message:"Error loading {0}, status code {1}"}),STALE_HOOK_ERROR=Object.freeze({code:3016,level:0,message:"An error occurred handling module conflict"});Object.freeze({code:3017,level:0,message:"Marking module(s) as externally loaded, but they are already loaded:"});const FAIL_HOOK_LOAD=Object.freeze({code:3018,level:0,message:'Error loading "{0}" from hook'}),NO_MAPPING_URL=Object.freeze({code:3019,level:0,message:"Mapping endpoint not set"}),BAD_IMPORT_METADATA=Object.freeze({code:3020,level:0,message:"Invalid import metadata: {0} {1}"}),EXPORTER_ERROR=Object.freeze({code:3021,level:0,message:'Error evaluating module "{0}", error was "{1}"'}),UNRESOLVEABLE_MAPPING_ERROR=Object.freeze({code:3022,level:0,message:'Unexpected undefined URI resolving mapping for "{0}"'}),NO_IMPORT_LWC=Object.freeze({code:3023,level:0,message:'Cannot dynamically import "lwc" with importer "{0}"'}),NO_IMPORT_LOADER=Object.freeze({code:3024,level:0,message:'Cannot dynamically import the LWR loader with importer "{0}"'}),NO_BLOB_IMPORT=Object.freeze({code:3024,level:0,message:"Cannot import a blob URL"}),NO_IMPORT_TRANSPORT=Object.freeze({code:3025,level:0,message:'Cannot dynamically import "transport" with importer "{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;function getBaseUrl(){let e;if(hasDocument){const t=document.querySelector("base[href]");e=t&&t.href}if(!e&&"undefined"!=typeof location){e=location.href.split("#")[0].split("?")[0];const t=e.lastIndexOf("/");-1!==t&&(e=e.slice(0,t+1))}return e}function isUrl(e){return-1!==e.indexOf("://")}function resolveIfNotPlainOrUrl(e,t){if(-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/")),"/"===e[0]&&"/"===e[1])return t.slice(0,t.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const r=t.slice(0,t.indexOf(":")+1);let o;if("/"===t[r.length+1]?"file:"!==r?(o=t.slice(r.length+2),o=o.slice(o.indexOf("/")+1)):o=t.slice(8):o=t.slice(r.length+("/"===t[r.length]?1:0)),"/"===e[0])return t.slice(0,t.length-o.length-1)+e;const i=o.slice(0,o.lastIndexOf("/")+1)+e,n=[];let s=-1;for(let e=0;e<i.length;e++)-1!==s?"/"===i[e]&&(n.push(i.slice(s,e+1)),s=-1):"."===i[e]?"."!==i[e+1]||"/"!==i[e+2]&&e+2!==i.length?"/"===i[e+1]||e+1===i.length?e+=1:s=e:(n.pop(),e+=2):s=e;return-1!==s&&n.push(i.slice(s)),t.slice(0,t.length-o.length)+n.join("")}}function resolveUrl(e,t){return resolveIfNotPlainOrUrl(e,t)||(isUrl(e)?e:resolveIfNotPlainOrUrl("./"+e,t))}function createScript(e){const t=document.createElement("script");return t.async=!0,t.crossOrigin="anonymous",t.src=e,t}let lastWindowError$1,lastWindowErrorUrl;function loadModuleDef(e){return new Promise((function(t,r){if(hasDocument){const o=createScript(e);o.addEventListener("error",(()=>{r(new LoaderError(FAIL_LOAD,[e]))})),o.addEventListener("load",(()=>{document.head.removeChild(o),lastWindowErrorUrl===e?r(lastWindowError$1):t()})),document.head.appendChild(o)}}))}hasProcess&&process.env,hasDocument&&window.addEventListener("error",(e=>{lastWindowErrorUrl=e.filename,lastWindowError$1=e.error}));const LOADER_PREFIX="lwr.loader.",MODULE_DEFINE=`${LOADER_PREFIX}module.define`,MODULE_DYNAMIC_LOAD=`${LOADER_PREFIX}module.dynamicLoad`,MODULE_FETCH=`${LOADER_PREFIX}module.fetch`,MODULE_ERROR=`${LOADER_PREFIX}module.error`,MAPPINGS_FETCH=`${LOADER_PREFIX}mappings.fetch`,MAPPINGS_ERROR=`${LOADER_PREFIX}mappings.error`;function _optionalChain(e){let t,r=e[0],o=1;for(;o<e.length;){const i=e[o],n=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==r)return;"access"===i||"optionalAccess"===i?(t=r,r=n(r)):"call"!==i&&"optionalCall"!==i||(r=n(((...e)=>r.call(t,...e))),t=void 0)}return r}class ImportMetadataResolver{__init(){this.importURICache=new Map}__init2(){this.pendingURICache=new Map}__init3(){this.loadMappingHooks=[]}__init4(){this.batchSpecifiers=[]}constructor(e,t){ImportMetadataResolver.prototype.__init.call(this),ImportMetadataResolver.prototype.__init2.call(this),ImportMetadataResolver.prototype.__init3.call(this),ImportMetadataResolver.prototype.__init4.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(!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))}))}getMappingUri(e){return _optionalChain([this,"access",e=>e.importURICache,"access",e=>e.get,"call",t=>t(e),"optionalAccess",e=>e.uri])}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(!hasSetTimeout||!_optionalChain([this,"access",e=>e.config,"optionalAccess",e=>e.flags,"optionalAccess",e=>e.batchMappings]))return this.fetchNewMappingsInner(e);const t=()=>{const e=this.batchSpecifiers.join(",");return this.batchSpecifiers=[],clearTimeout(this.batchTimer),this.batchTimer=void 0,this.fetchNewMappingsInner(e)};return this.batchPromise&&0!==this.batchSpecifiers.length||(this.batchPromise=new Promise((e=>{this.batchTimer=setTimeout((()=>e(t())),0)}))),this.batchSpecifiers.push(e),this.batchPromise}async fetchNewMappingsInner(e){if("function"!=typeof globalThis.fetch)throw new LoaderError(UNRESOLVED,[e]);const t=resolveUrl(this.buildMappingUrl(e),this.getBaseUrl());if(!t)throw new LoaderError(UNRESOLVEABLE_MAPPING_ERROR,[e]);return globalThis.fetch(t).then((t=>{if(!t.ok)throw this.config.profiler.logOperationStart({id:MAPPINGS_ERROR,specifier:e}),new LoaderError(UNRESOLVED,[e]);return t.json().then((e=>e))})).catch((t=>{throw new LoaderError(UNRESOLVED,[e])}))}saveImportURIRecord(e,t,r,o){r&&t!==r?this.importURICache.set(e,{uri:t,identity:r,isRoot:o}):this.importURICache.set(e,{uri:t,isRoot:o})}}function reportError(e){hasConsole&&console.error(e)}function evaluateHandleStaleModuleHooks(e,t){const{name:r,oldUrl:o,newUrl:i}=t;for(let t=0;t<e.length;t++){const n=e[t];try{if(null!==n({name:r,oldUrl:o,newUrl:i}))break}catch(e){reportError(new LoaderError(STALE_HOOK_ERROR))}}}const MODULE_LOAD_TIMEOUT_TIMER=6e4;var MODULE_WARNING;!function(e){e.MODULE_REDEFINE="Module redefine attempted";e.MODULE_ALREADY_LOADED="Marking module(s) as externally loaded, but they are already loaded";e.ALIAS_UPDATE="Alias update attempt"}(MODULE_WARNING||(MODULE_WARNING={}));
9
9
  /*!
10
10
  * Copyright (C) 2023 salesforce.com, inc.
11
11
  */
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
6
  */
7
- /* LWR Module Loader Shim v0.22.14 */
7
+ /* LWR Module Loader Shim v0.23.2 */
8
8
  (function () {
9
9
  'use strict';
10
10
 
@@ -310,7 +310,7 @@
310
310
  // Parse configuration
311
311
  this.global = global;
312
312
  this.config = global.LWR ;
313
- this.loaderSpecifier = 'lwr/loader/v/0_22_14';
313
+ this.loaderSpecifier = 'lwr/loader/v/0_23_2';
314
314
 
315
315
  // Set up error handler
316
316
  this.errorHandler = this.config.onError ;
@@ -475,7 +475,7 @@
475
475
  const exporter = (exports) => {
476
476
  Object.assign(exports, { logOperationStart, logOperationEnd });
477
477
  };
478
- define('lwr/profiler/v/0_22_14', ['exports'], exporter);
478
+ define('lwr/profiler/v/0_23_2', ['exports'], exporter);
479
479
  }
480
480
 
481
481
  // Set up the application globals, import map, root custom element...
@@ -576,8 +576,8 @@
576
576
  // The loader module is ALWAYS required
577
577
  const GLOBAL = globalThis ;
578
578
  GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
579
- if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_22_14') < 0) {
580
- GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_22_14');
579
+ if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_23_2') < 0) {
580
+ GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_23_2');
581
581
  }
582
582
  new LoaderShim(GLOBAL);
583
583
 
@@ -24,21 +24,11 @@ var __toModule = (module2) => {
24
24
  // packages/@lwrjs/loader/src/modules/lwr/loaderLegacy/utils/validation.ts
25
25
  __markAsModule(exports);
26
26
  __export(exports, {
27
- isProtectedSpecifier: () => isProtectedSpecifier,
28
27
  validateAndConvertImportMapUpdate: () => validateAndConvertImportMapUpdate,
29
28
  validateMappingUri: () => validateMappingUri,
30
29
  validateSpecifier: () => validateSpecifier
31
30
  });
32
31
  var import_dom = __toModule(require("../utils/dom.cjs"));
33
- var PROTECTED_PATTERNS = [
34
- /^lwc$/i,
35
- /^lwc\/v\//i,
36
- /^@lwc\//i,
37
- /^lightningmobileruntime\//i
38
- ];
39
- function isProtectedSpecifier(specifier) {
40
- return PROTECTED_PATTERNS.some((pattern) => pattern.test(specifier));
41
- }
42
32
  function validateMappingUri(uri, specifier) {
43
33
  const lowerUri = uri.toLowerCase();
44
34
  if (lowerUri.startsWith("blob:")) {
@@ -52,9 +42,6 @@ function validateSpecifier(specifier) {
52
42
  if (typeof specifier !== "string" || specifier.length === 0) {
53
43
  throw new Error("Specifier must be a non-empty string");
54
44
  }
55
- if (isProtectedSpecifier(specifier)) {
56
- throw new Error(`Cannot remap protected module: ${specifier}`);
57
- }
58
45
  }
59
46
  function validateAndConvertImportMapUpdate(update) {
60
47
  if (!update || typeof update !== "object") {
@@ -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.22.14 */
7
+ /* LWR ESM Module Loader v0.23.2 */
8
8
  function _optionalChain$1(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
9
9
 
10
10
 
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
6
  */
7
- /* LWR Module Loader v0.22.14 */
7
+ /* LWR Module Loader v0.23.2 */
8
8
  const templateRegex = /\{([0-9]+)\}/g;
9
9
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
10
  function templateString(template, args) {
@@ -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.22.14 */
7
+ /* LWR Legacy Module Loader v0.23.2 */
8
8
  const templateRegex = /\{([0-9]+)\}/g;
9
9
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
10
  function templateString(template, args) {
@@ -1750,27 +1750,6 @@ async function evaluateImportMaps(baseUrl) {
1750
1750
  return importMapPromise;
1751
1751
  }
1752
1752
 
1753
- /**
1754
- * List of protected module patterns that cannot be remapped.
1755
- * Uses case-insensitive matching to prevent bypass attempts (e.g., HF-1027).
1756
- */
1757
- const PROTECTED_PATTERNS = [
1758
- /^lwc$/i, // Core LWC
1759
- /^lwc\/v\//i, // Versioned LWC variants
1760
- /^@lwc\//i, // LWC scoped packages
1761
- /^lightningmobileruntime\//i, // Lightning mobile runtime
1762
- ];
1763
-
1764
- /**
1765
- * Checks if a specifier matches any protected module pattern.
1766
- *
1767
- * @param specifier - The module specifier to check
1768
- * @returns true if the specifier is protected, false otherwise
1769
- */
1770
- function isProtectedSpecifier(specifier) {
1771
- return PROTECTED_PATTERNS.some((pattern) => pattern.test(specifier));
1772
- }
1773
-
1774
1753
  /**
1775
1754
  * Validates that a URI does not use dangerous URL schemes.
1776
1755
  *
@@ -1795,19 +1774,15 @@ function validateMappingUri(uri, specifier) {
1795
1774
  }
1796
1775
 
1797
1776
  /**
1798
- * Validates that a specifier is well-formed and not protected.
1777
+ * Validates that a specifier is well-formed.
1799
1778
  *
1800
1779
  * @param specifier - The module specifier to validate
1801
- * @throws Error if the specifier is invalid or protected
1780
+ * @throws Error if the specifier is invalid
1802
1781
  */
1803
1782
  function validateSpecifier(specifier) {
1804
1783
  if (typeof specifier !== 'string' || specifier.length === 0) {
1805
1784
  throw new Error('Specifier must be a non-empty string');
1806
1785
  }
1807
-
1808
- if (isProtectedSpecifier(specifier)) {
1809
- throw new Error(`Cannot remap protected module: ${specifier}`);
1810
- }
1811
1786
  }
1812
1787
 
1813
1788
  /**
@@ -2,19 +2,11 @@
2
2
  * Validation logic for LWR.importMap() API
3
3
  *
4
4
  * This module provides validation functions to ensure that import map updates:
5
- * 1. Do not remap protected system modules (lwc, lwr/*, etc.)
6
- * 2. Do not use dangerous URL schemes (blob:, data:)
7
- * 3. Have well-formed specifiers and URIs
5
+ * 1. Do not use dangerous URL schemes (blob:, data:)
6
+ * 2. Have well-formed specifiers and URIs
8
7
  */
9
8
  import type { ImportMapUpdate } from '../../../../types.js';
10
9
  import type { ImportMap } from '../importMap/importMap.js';
11
- /**
12
- * Checks if a specifier matches any protected module pattern.
13
- *
14
- * @param specifier - The module specifier to check
15
- * @returns true if the specifier is protected, false otherwise
16
- */
17
- export declare function isProtectedSpecifier(specifier: string): boolean;
18
10
  /**
19
11
  * Validates that a URI does not use dangerous URL schemes.
20
12
  *
@@ -28,10 +20,10 @@ export declare function isProtectedSpecifier(specifier: string): boolean;
28
20
  */
29
21
  export declare function validateMappingUri(uri: string, specifier: string): void;
30
22
  /**
31
- * Validates that a specifier is well-formed and not protected.
23
+ * Validates that a specifier is well-formed.
32
24
  *
33
25
  * @param specifier - The module specifier to validate
34
- * @throws Error if the specifier is invalid or protected
26
+ * @throws Error if the specifier is invalid
35
27
  */
36
28
  export declare function validateSpecifier(specifier: string): void;
37
29
  /**
@@ -2,30 +2,10 @@
2
2
  * Validation logic for LWR.importMap() API
3
3
  *
4
4
  * This module provides validation functions to ensure that import map updates:
5
- * 1. Do not remap protected system modules (lwc, lwr/*, etc.)
6
- * 2. Do not use dangerous URL schemes (blob:, data:)
7
- * 3. Have well-formed specifiers and URIs
5
+ * 1. Do not use dangerous URL schemes (blob:, data:)
6
+ * 2. Have well-formed specifiers and URIs
8
7
  */
9
8
  import { hasConsole } from '../utils/dom.js';
10
- /**
11
- * List of protected module patterns that cannot be remapped.
12
- * Uses case-insensitive matching to prevent bypass attempts (e.g., HF-1027).
13
- */
14
- const PROTECTED_PATTERNS = [
15
- /^lwc$/i,
16
- /^lwc\/v\//i,
17
- /^@lwc\//i,
18
- /^lightningmobileruntime\//i, // Lightning mobile runtime
19
- ];
20
- /**
21
- * Checks if a specifier matches any protected module pattern.
22
- *
23
- * @param specifier - The module specifier to check
24
- * @returns true if the specifier is protected, false otherwise
25
- */
26
- export function isProtectedSpecifier(specifier) {
27
- return PROTECTED_PATTERNS.some((pattern) => pattern.test(specifier));
28
- }
29
9
  /**
30
10
  * Validates that a URI does not use dangerous URL schemes.
31
11
  *
@@ -47,18 +27,15 @@ export function validateMappingUri(uri, specifier) {
47
27
  }
48
28
  }
49
29
  /**
50
- * Validates that a specifier is well-formed and not protected.
30
+ * Validates that a specifier is well-formed.
51
31
  *
52
32
  * @param specifier - The module specifier to validate
53
- * @throws Error if the specifier is invalid or protected
33
+ * @throws Error if the specifier is invalid
54
34
  */
55
35
  export function validateSpecifier(specifier) {
56
36
  if (typeof specifier !== 'string' || specifier.length === 0) {
57
37
  throw new Error('Specifier must be a non-empty string');
58
38
  }
59
- if (isProtectedSpecifier(specifier)) {
60
- throw new Error(`Cannot remap protected module: ${specifier}`);
61
- }
62
39
  }
63
40
  /**
64
41
  * Validates and converts an ImportMapUpdate to ImportMap format.
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
- "version": "0.22.14",
8
+ "version": "0.23.2",
9
9
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
10
10
  "repository": {
11
11
  "type": "git",
@@ -61,16 +61,16 @@
61
61
  },
62
62
  "devDependencies": {
63
63
  "@locker/trusted-types": "0.26.4",
64
- "@lwrjs/diagnostics": "0.22.14",
65
- "@lwrjs/types": "0.22.14",
64
+ "@lwrjs/diagnostics": "0.23.2",
65
+ "@lwrjs/types": "0.23.2",
66
66
  "@rollup/plugin-node-resolve": "^15.2.3",
67
- "@rollup/plugin-sucrase": "^5.0.2",
67
+ "@rollup/plugin-sucrase": "^5.1.0",
68
68
  "@rollup/plugin-terser": "^0.4.4",
69
69
  "rollup": "^2.80.0"
70
70
  },
71
71
  "dependencies": {
72
- "@lwrjs/client-modules": "0.22.14",
73
- "@lwrjs/shared-utils": "0.22.14"
72
+ "@lwrjs/client-modules": "0.23.2",
73
+ "@lwrjs/shared-utils": "0.23.2"
74
74
  },
75
75
  "lwc": {
76
76
  "modules": [
@@ -90,5 +90,5 @@
90
90
  "volta": {
91
91
  "extends": "../../../package.json"
92
92
  },
93
- "gitHead": "d502ef08ff191ef2e30429cb0e4b983cf9da7a3f"
93
+ "gitHead": "86f6d81fc6909358184c24c603a5df2d6d462f6c"
94
94
  }