{
  "version": 3,
  "sources": ["../../../src/assets/dynamic-importmap/index.ts"],
  "sourcesContent": ["/**\n * This code is derived from the following projects:\n *\n * 1. dynamic-importmap (https://github.com/keller-mark/dynamic-importmap)\n * 2. es-module-shims (https://github.com/guybedford/es-module-shims)\n *\n * The original implementation was created by Guy Bedford in es-module-shims,\n * then adapted by Mark Keller in dynamic-importmap, and further modified\n * for use in this project.\n *\n * Both projects are licensed under the MIT license.\n *\n * MIT License: https://opensource.org/licenses/MIT\n */\n\n/**\n * Internal dependencies\n */\nimport { addImportMap, resolve } from './resolver';\nimport { initPromise, topLevelLoad, preloadModule } from './loader';\n\ntype ImportMap = {\n\timports?: Record< string, string >;\n\tscopes?: Record< string, Record< string, string > >;\n};\n\n// TODO: check if this baseURI should change per document, and so\n// it need to be passed as a parameter to methods like `importWithMap`\n// and `preloadWithMap`.\nconst baseUrl = document.baseURI;\nconst pageBaseUrl = baseUrl;\n\nObject.defineProperty( self, 'wpInteractivityRouterImport', {\n\tvalue: importShim,\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: false,\n} );\n\nasync function importShim< Module = unknown >( id: string ) {\n\tawait initPromise;\n\treturn topLevelLoad< Module >( resolve( id, pageBaseUrl ), {\n\t\tcredentials: 'same-origin',\n\t} );\n}\n\n/**\n * Imports the module with the passed ID.\n *\n * The module is resolved against the internal dynamic import map,\n * extended with the passed import map.\n *\n * @param id          Module ID.\n * @param importMapIn Import map.\n * @return Resolved module.\n */\nexport async function importWithMap< Module = unknown >(\n\tid: string,\n\timportMapIn: ImportMap\n) {\n\taddImportMap( importMapIn );\n\treturn importShim< Module >( id );\n}\n\n/**\n * Preloads the module with the passed ID along with its dependencies.\n *\n * The module is resolved against the internal dynamic import map,\n * extended with the passed import map.\n *\n * @param id          Module ID.\n * @param importMapIn Import map.\n * @return Resolved `ModuleLoad` instance.\n */\nexport async function preloadWithMap( id: string, importMapIn: ImportMap ) {\n\taddImportMap( importMapIn );\n\tawait initPromise;\n\treturn preloadModule( resolve( id, pageBaseUrl ), {\n\t\tcredentials: 'same-origin',\n\t} );\n}\n\nexport {\n\tinitialImportMap,\n\timportPreloadedModule,\n\ttype ModuleLoad,\n} from './loader';\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBA,sBAAsC;AACtC,oBAAyD;AA+DzD,IAAAA,iBAIO;AAzDP,IAAM,UAAU,SAAS;AACzB,IAAM,cAAc;AAEpB,OAAO,eAAgB,MAAM,+BAA+B;AAAA,EAC3D,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,cAAc;AACf,CAAE;AAEF,eAAe,WAAgC,IAAa;AAC3D,QAAM;AACN,aAAO,gCAAwB,yBAAS,IAAI,WAAY,GAAG;AAAA,IAC1D,aAAa;AAAA,EACd,CAAE;AACH;AAYA,eAAsB,cACrB,IACA,aACC;AACD,oCAAc,WAAY;AAC1B,SAAO,WAAsB,EAAG;AACjC;AAYA,eAAsB,eAAgB,IAAY,aAAyB;AAC1E,oCAAc,WAAY;AAC1B,QAAM;AACN,aAAO,iCAAe,yBAAS,IAAI,WAAY,GAAG;AAAA,IACjD,aAAa;AAAA,EACd,CAAE;AACH;",
  "names": ["import_loader"]
}
