extension-develop 4.1.11 → 4.1.13

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.
Files changed (110) hide show
  1. package/dist/0~dev-server.mjs +147 -81
  2. package/dist/0~rspack-config.mjs +1096 -694
  3. package/dist/0~zip.mjs +1 -1
  4. package/dist/101.mjs +185 -895
  5. package/dist/129.mjs +89 -0
  6. package/dist/278.mjs +52 -0
  7. package/dist/292.mjs +61 -0
  8. package/dist/372.mjs +87 -0
  9. package/dist/518.mjs +434 -0
  10. package/dist/77.mjs +928 -0
  11. package/dist/839.mjs +178 -40
  12. package/dist/845.mjs +10 -1
  13. package/dist/887.mjs +1 -1
  14. package/dist/bridge-entry.d.ts +2 -1
  15. package/dist/bridge.mjs +56 -7
  16. package/dist/css-parse-guard-loader.mjs +3 -0
  17. package/dist/dead-css-url-loader.mjs +51 -24
  18. package/dist/dev-server/cleanup.d.ts +2 -1
  19. package/dist/dev-server/control-bridge/broker.d.ts +1 -0
  20. package/dist/dev-server/control-bridge/contracts.d.ts +2 -0
  21. package/dist/dev-server/control-bridge/logs-query.d.ts +12 -1
  22. package/dist/dev-server/control-bridge/producer-runtime.d.ts +1 -1
  23. package/dist/dev-server/messages.d.ts +8 -0
  24. package/dist/dev-server/session-restart.d.ts +29 -0
  25. package/dist/ensure-hmr-for-scripts.js +37 -20
  26. package/dist/ensure-hmr-for-scripts.mjs +37 -20
  27. package/dist/extension-js-devtools/chrome/content_scripts/content-0.js +2 -2
  28. package/dist/extension-js-devtools/chrome/scripts/logger-client.js +1 -1
  29. package/dist/extension-js-devtools/chromium/content_scripts/content-0.js +2 -2
  30. package/dist/extension-js-devtools/chromium/scripts/logger-client.js +1 -1
  31. package/dist/extension-js-devtools/edge/content_scripts/content-0.js +2 -2
  32. package/dist/extension-js-devtools/edge/scripts/logger-client.js +1 -1
  33. package/dist/extension-js-devtools/firefox/content_scripts/content-0.js +2 -2
  34. package/dist/extension-js-devtools/firefox/scripts/logger-client.js +1 -1
  35. package/dist/feature-scripts-classic-concat-loader.js +58 -5
  36. package/dist/feature-scripts-classic-concat-loader.mjs +58 -5
  37. package/dist/feature-scripts-content-script-wrapper.js +14 -17
  38. package/dist/feature-scripts-content-script-wrapper.mjs +14 -17
  39. package/dist/feature-scripts-native-geturl-import-loader.mjs +10 -3
  40. package/dist/lib/asset-source-maps.d.ts +7 -0
  41. package/dist/lib/config-loader.d.ts +7 -34
  42. package/dist/lib/loader-source-maps.d.ts +17 -0
  43. package/dist/lib/messages.d.ts +1 -0
  44. package/dist/lib/msg-placeholders.d.ts +2 -0
  45. package/dist/lib/paths.d.ts +2 -0
  46. package/dist/lib/project.d.ts +3 -0
  47. package/dist/lib/session-project-root.d.ts +1 -0
  48. package/dist/minimum-script-file.js +41 -1
  49. package/dist/minimum-script-file.mjs +41 -1
  50. package/dist/module.d.ts +1 -1
  51. package/dist/module.mjs +1 -1
  52. package/dist/plugin-css/css-lib/dead-url-refs.d.ts +5 -0
  53. package/dist/plugin-css/css-lib/inline-content-script-css.d.ts +32 -0
  54. package/dist/plugin-css/css-lib/messages.d.ts +3 -0
  55. package/dist/plugin-css/css-lib/verbatim-css.d.ts +9 -0
  56. package/dist/plugin-css/css-parse-guard-loader.d.ts +3 -0
  57. package/dist/plugin-css/css-tools/postcss.d.ts +1 -0
  58. package/dist/plugin-css/dead-css-url-loader.d.ts +8 -4
  59. package/dist/plugin-css/index.d.ts +1 -0
  60. package/dist/plugin-js-frameworks/js-frameworks-lib/jsx-transform.d.ts +10 -0
  61. package/dist/plugin-js-frameworks/js-tools/solid-jsx-runtime.d.ts +8 -0
  62. package/dist/plugin-js-frameworks/js-tools/solid.d.ts +3 -0
  63. package/dist/plugin-js-frameworks/swc-targets.d.ts +3 -0
  64. package/dist/plugin-reload/classify-reload.d.ts +6 -0
  65. package/dist/plugin-reload/index.d.ts +2 -1
  66. package/dist/plugin-reload/reload-dispatch.d.ts +1 -0
  67. package/dist/plugin-special-folders/folder-extensions/resolve-dirs.d.ts +1 -0
  68. package/dist/plugin-special-folders/folder-extensions/utils.d.ts +3 -0
  69. package/dist/plugin-special-folders/messages.d.ts +2 -0
  70. package/dist/plugin-special-folders/resolve-public-folder.d.ts +13 -0
  71. package/dist/plugin-web-extension/feature-html/html-lib/assets.d.ts +1 -1
  72. package/dist/plugin-web-extension/feature-html/html-lib/base-href.d.ts +11 -0
  73. package/dist/plugin-web-extension/feature-html/html-lib/patch-html.d.ts +2 -2
  74. package/dist/plugin-web-extension/feature-html/html-lib/utils.d.ts +13 -0
  75. package/dist/plugin-web-extension/feature-html/index.d.ts +1 -0
  76. package/dist/plugin-web-extension/feature-html/steps/ensure-hmr-for-scripts.d.ts +1 -1
  77. package/dist/plugin-web-extension/feature-icons/extract-action-theme-icons.d.ts +2 -0
  78. package/dist/plugin-web-extension/feature-icons/omnibox-fields.d.ts +2 -0
  79. package/dist/plugin-web-extension/feature-icons/theme-image-fields.d.ts +2 -0
  80. package/dist/plugin-web-extension/feature-json/json-validation.d.ts +1 -0
  81. package/dist/plugin-web-extension/feature-manifest/index.d.ts +1 -0
  82. package/dist/plugin-web-extension/feature-manifest/manifest-lib/manifest.d.ts +1 -1
  83. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/index.d.ts +1 -1
  84. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/sandbox.d.ts +1 -1
  85. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/storage.d.ts +1 -1
  86. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/theme.d.ts +1 -1
  87. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/index.d.ts +1 -1
  88. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/mv2/chrome_settings_overrides.d.ts +1 -1
  89. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/mv2/index.d.ts +1 -1
  90. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/mv2/theme_experiment.d.ts +1 -1
  91. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/mv3/action.d.ts +2 -1
  92. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/mv3/declarative_net_request.d.ts +1 -1
  93. package/dist/plugin-web-extension/feature-manifest/manifest-overrides/mv3/index.d.ts +1 -1
  94. package/dist/plugin-web-extension/feature-manifest/messages.d.ts +2 -0
  95. package/dist/plugin-web-extension/feature-manifest/normalize-manifest-path.d.ts +4 -0
  96. package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults-lib/patch-csp.d.ts +1 -1
  97. package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults.d.ts +1 -0
  98. package/dist/plugin-web-extension/feature-scripts/steps/native-geturl-import-loader.d.ts +7 -2
  99. package/dist/plugin-web-extension/feature-web-resources/collect-entry-imports.d.ts +1 -0
  100. package/dist/plugin-web-extension/index.d.ts +1 -0
  101. package/dist/plugin-web-extension/shared/html-surfaces.d.ts +19 -0
  102. package/dist/plugin-web-extension/shared/manifest-fields-change-detector.d.ts +1 -0
  103. package/dist/plugin-web-extension/shared/manifest-fields.d.ts +18 -0
  104. package/dist/plugin-web-extension/shared/manifest-path-assets.d.ts +4 -0
  105. package/dist/plugin-web-extension/shared/paths.d.ts +1 -0
  106. package/dist/solid-jsx-runtime.mjs +15 -0
  107. package/dist/types.d.ts +20 -7
  108. package/package.json +1 -1
  109. package/dist/494.mjs +0 -89
  110. package/dist/86.mjs +0 -36
@@ -1 +1 @@
1
- (()=>{"use strict";var t={},e={};function r(o){var n=e[o];if(void 0!==n)return n.exports;var i=e[o]={exports:{}};return t[o](i,i.exports,r),i.exports}var o="scripts/logger-client.ts",n="scripts/logger-client.ts",i="bc08ac8f";function a(){var t="";try{var e="object"==typeof globalThis&&globalThis&&(globalThis.browser&&globalThis.browser.runtime||globalThis.chrome&&globalThis.chrome.runtime)||null;e&&e.id&&(t=String(e.id))}catch(t){}return String(n||"")+(t?"@"+t:"")}var c=[];!function(){try{if("u"<typeof document||"function"!=typeof document.querySelectorAll)return;c=Array.from(document.querySelectorAll("#extension-root,[data-extension-root]"))}catch(t){c=[]}}();var u=[],l="object"==typeof globalThis&&globalThis?globalThis.__EXTENSIONJS_DEV_REINJECT__||(globalThis.__EXTENSIONJS_DEV_REINJECT__={}):{},s=[];function f(t){return"function"==typeof t&&s.push(t),t}function g(t,e,r){try{return}catch(t){}}function h(t){try{if("u"<typeof document||"function"!=typeof document.querySelectorAll)return;for(var e=a(),r=Array.from(document.querySelectorAll('#extension-root,[data-extension-root]:not([data-extension-root="extension-js-devtools"])')),o=0;o<r.length;o++){var c=r[o];if(c&&"function"==typeof c.getAttribute){var u=String(c.getAttribute("data-extjs-reinject-owner")||"");if(u&&u===e){var l=String(c.getAttribute("data-extjs-reinject-build")||""),s=String(i||"");if(t||!l||!s||l!==s){try{var f=document.documentElement;f&&"function"==typeof f.setAttribute&&(f.setAttribute("data-extjs-debug-stage","cleanup-known-roots"),f.setAttribute("data-extjs-debug-last-removal","cleanup-known-roots"),f.setAttribute("data-extjs-debug-last-removal-key",String(n||"")),f.setAttribute("data-extjs-debug-last-removal-source","cleanup-known-roots"),f.setAttribute("data-extjs-debug-last-removed-node-tag",String(c.tagName||"").toLowerCase()))}catch(t){}try{c.remove()}catch(t){}}}}}}catch(t){}}try{"object"==typeof globalThis&&globalThis&&(globalThis.__EXTENSIONJS_registerCleanup=f,globalThis.registerCleanup=f)}catch(t){}var b=l[n],y=function(t){try{if(!t)return 0;if("function"==typeof t&&"number"==typeof t.__extjsGeneration)return t.__extjsGeneration;if("object"==typeof t){if("number"==typeof t.__extjsGeneration)return t.__extjsGeneration;if("number"==typeof t.generation)return t.generation;if("function"==typeof t.cleanup&&"number"==typeof t.cleanup.__extjsGeneration)return t.cleanup.__extjsGeneration}}catch(t){}return 0}(b);try{try{"u"<typeof document||document.querySelectorAll}catch(t){}}catch(t){}try{var m="function"==typeof b?b:b&&"function"==typeof b.cleanup?b.cleanup:null;"function"==typeof m&&m()}catch(t){}try{h(!b)}catch(t){}function d(){try{var t="";try{"object"==typeof globalThis&&globalThis&&globalThis.browser&&globalThis.browser.runtime&&"function"==typeof globalThis.browser.runtime.getURL?t=String(globalThis.browser.runtime.getURL("/")):"object"==typeof globalThis&&globalThis&&globalThis.chrome&&globalThis.chrome.runtime&&"function"==typeof globalThis.chrome.runtime.getURL&&(t=String(globalThis.chrome.runtime.getURL("/")))}catch(t){}if(!t)try{"object"==typeof document&&document&&document.documentElement&&(t=String(document.documentElement.getAttribute("data-extjs-extension-base")||""))}catch(t){}if(!t)return!1;"/"!==t.charAt(t.length-1)&&(t+="/");try{r.p=t}catch(t){}try{r.b=t}catch(t){}return!0}catch(t){}return!1}try{if(!d()){var p=0,T=function(){try{if(d())return}catch(t){}p++<50&&setTimeout(T,100)};T()}}catch(t){}try{y=(Number(y)||0)+1}catch(t){}try{g(n,Number(y)||0,"executed")}catch(t){}try{!function(){try{if(0!==String(o||"").indexOf("content_scripts/content-")||"u"<typeof document||"function"!=typeof fetch)return;var t=Array.from(new Set((Array.isArray(u)?u:[]).concat(function(){try{var t=String("");if(!t.length||0===t.lastIndexOf("__EXTENSIONJS_CSS_PROBE",0))return[];var e=function(t){try{if("object"==typeof globalThis&&globalThis&&globalThis.browser&&globalThis.browser.runtime&&"function"==typeof globalThis.browser.runtime.getURL)return globalThis.browser.runtime.getURL(t);if("object"==typeof globalThis&&globalThis&&globalThis.chrome&&globalThis.chrome.runtime&&"function"==typeof globalThis.chrome.runtime.getURL)return globalThis.chrome.runtime.getURL(t)}catch(t){}try{var e="object"==typeof globalThis&&globalThis&&globalThis.__EXTJS_EXTENSION_BASE__?String(globalThis.__EXTJS_EXTENSION_BASE__):"";if(!e&&"object"==typeof document&&document&&document.documentElement&&(e=String(document.documentElement.getAttribute("data-extjs-extension-base")||"")),!e)return"";return e.replace(/\/+$/,"/")+String(t||"").replace(/^\/+/,"")}catch(t){}return""}(t);if("string"!=typeof e||!e.length||"/"===e.charAt(e.length-1))return[];return[e]}catch(t){return[]}}()).filter(function(t){return"string"==typeof t&&t.trim().length>0})));if(!t.length)return;var e="",r=null,i=0,l=function(){try{for(var u=a(),s=Array.from(document.querySelectorAll('#extension-root,[data-extension-root]:not([data-extension-root="extension-js-devtools"])')),f=0;f<s.length;f++){var g=s[f];if(g&&g.shadowRoot&&"function"==typeof g.getAttribute){var h=String(g.getAttribute("data-extjs-reinject-owner")||"");if((!h||h===u)&&h&&(h||-1===c.indexOf(g))&&(!(!h&&String(g.getAttribute("data-extjs-reinject-key")||""))||String(g.getAttribute("data-extjs-reinject-key")||"")===String(o||""))){for(var b=g.shadowRoot,y=Array.from(b.querySelectorAll("style")),m=y.some(function(t){return t&&"true"!==t.getAttribute("data-extjs-bundle-css")&&String(t.textContent||"").trim().length>0}),d=null,p=0;p<y.length;p++)if(y[p]&&"true"===y[p].getAttribute("data-extjs-bundle-css")){var T=String(y[p].getAttribute("data-extjs-style-owner")||"");if(!T||T===u){d=y[p];break}}if(m){d&&d.parentNode&&d.parentNode.removeChild(d);return}if("string"==typeof e&&e.trim()){d||((d=document.createElement("style")).setAttribute("data-extjs-bundle-css","true"),d.setAttribute("data-extjs-reinject-key",String(n||"")),b.insertBefore(d,b.firstChild||null)),d.setAttribute("data-extjs-style-owner",u),String(d.textContent||"")!==e&&(d.textContent=e);return}}}}}catch(t){}i++<20&&(!r&&(r||(r=(function e(r){return r>=t.length?Promise.resolve(""):fetch(t[r]).then(function(t){return t&&t.ok?t.text():""}).catch(function(){return""}).then(function(t){return"string"==typeof t&&t.trim().length>0?t:e(r+1)})})(0).then(function(t){e="string"==typeof t?t:"";try{setTimeout(l,0)}catch(t){}return e}).catch(function(){return""}))),setTimeout(l,250))};l()}catch(t){}}()}catch(t){}try{l[n]={cleanup:function(){try{!function(t){try{if(!Array.isArray(t))return;for(var e=t.length-1;e>=0;e--)try{"function"==typeof t[e]&&t[e]()}catch(t){}}catch(t){}}(s)}catch(t){}try{h()}catch(t){}try{g(n,Number(y)||0,"cleaned")}catch(t){}},generation:Number(y)||0,build:i}}catch(t){}})();
1
+ (()=>{"use strict";var t={},e={};function r(o){var n=e[o];if(void 0!==n)return n.exports;var i=e[o]={exports:{}};return t[o](i,i.exports,r),i.exports}var o="scripts/logger-client.ts",n="scripts/logger-client.ts",i="bc08ac8f";function a(){var t="";try{var e="object"==typeof globalThis&&globalThis&&(globalThis.browser&&globalThis.browser.runtime||globalThis.chrome&&globalThis.chrome.runtime)||null;e&&e.id&&(t=String(e.id))}catch(t){}return String(n||"")+(t?"@"+t:"")}var c=[];!function(){try{if("u"<typeof document||"function"!=typeof document.querySelectorAll)return;c=Array.from(document.querySelectorAll("#extension-root,[data-extension-root]"))}catch(t){c=[]}}();var u=[],l="object"==typeof globalThis&&globalThis?globalThis.__EXTENSIONJS_DEV_REINJECT__||(globalThis.__EXTENSIONJS_DEV_REINJECT__={}):{},s=[];function f(t){return"function"==typeof t&&s.push(t),t}function g(t,e,r){try{return}catch(t){}}function h(t){try{if("u"<typeof document||"function"!=typeof document.querySelectorAll)return;for(var e=a(),r=Array.from(document.querySelectorAll('#extension-root,[data-extension-root]:not([data-extension-root="extension-js-devtools"])')),o=0;o<r.length;o++){var c=r[o];if(c&&"function"==typeof c.getAttribute){var u=String(c.getAttribute("data-extjs-reinject-owner")||"");if(u&&u===e){var l=String(c.getAttribute("data-extjs-reinject-build")||""),s=String(i||"");if(t||!l||!s||l!==s){try{var f=document.documentElement;f&&"function"==typeof f.setAttribute&&(f.setAttribute("data-extjs-debug-stage","cleanup-known-roots"),f.setAttribute("data-extjs-debug-last-removal","cleanup-known-roots"),f.setAttribute("data-extjs-debug-last-removal-key",String(n||"")),f.setAttribute("data-extjs-debug-last-removal-source","cleanup-known-roots"),f.setAttribute("data-extjs-debug-last-removed-node-tag",String(c.tagName||"").toLowerCase()))}catch(t){}try{c.remove()}catch(t){}}}}}}catch(t){}}try{"object"==typeof globalThis&&globalThis&&(globalThis.__EXTENSIONJS_registerCleanup=f,globalThis.registerCleanup=f)}catch(t){}var b=l[n],y=function(t){try{if(!t)return 0;if("function"==typeof t&&"number"==typeof t.__extjsGeneration)return t.__extjsGeneration;if("object"==typeof t){if("number"==typeof t.__extjsGeneration)return t.__extjsGeneration;if("number"==typeof t.generation)return t.generation;if("function"==typeof t.cleanup&&"number"==typeof t.cleanup.__extjsGeneration)return t.cleanup.__extjsGeneration}}catch(t){}return 0}(b);try{try{"u"<typeof document||document.querySelectorAll}catch(t){}}catch(t){}try{var m="function"==typeof b?b:b&&"function"==typeof b.cleanup?b.cleanup:null;"function"==typeof m&&m()}catch(t){}try{h(!b)}catch(t){}function d(){try{var t="";try{"object"==typeof globalThis&&globalThis&&globalThis.browser&&globalThis.browser.runtime&&"function"==typeof globalThis.browser.runtime.getURL?t=String(globalThis.browser.runtime.getURL("/")):"object"==typeof globalThis&&globalThis&&globalThis.chrome&&globalThis.chrome.runtime&&"function"==typeof globalThis.chrome.runtime.getURL&&(t=String(globalThis.chrome.runtime.getURL("/")))}catch(t){}if(!t)try{"object"==typeof document&&document&&document.documentElement&&(t=String(document.documentElement.getAttribute("data-extjs-extension-base")||""))}catch(t){}if(!t)return!1;"/"!==t.charAt(t.length-1)&&(t+="/");try{r.p=t}catch(t){}try{r.b=t}catch(t){}return!0}catch(t){}return!1}try{if(!d()){var p=0,T=function(){try{if(d())return}catch(t){}p++<50&&setTimeout(T,100)};T()}}catch(t){}function _(t){try{if("object"==typeof globalThis&&globalThis&&globalThis.browser&&globalThis.browser.runtime&&"function"==typeof globalThis.browser.runtime.getURL)return globalThis.browser.runtime.getURL(t);if("object"==typeof globalThis&&globalThis&&globalThis.chrome&&globalThis.chrome.runtime&&"function"==typeof globalThis.chrome.runtime.getURL)return globalThis.chrome.runtime.getURL(t)}catch(t){}try{var e="object"==typeof globalThis&&globalThis&&globalThis.__EXTJS_EXTENSION_BASE__?String(globalThis.__EXTJS_EXTENSION_BASE__):"";if(!e&&"object"==typeof document&&document&&document.documentElement&&(e=String(document.documentElement.getAttribute("data-extjs-extension-base")||"")),!e)return"";return e.replace(/\/+$/,"/")+String(t||"").replace(/^\/+/,"")}catch(t){}return""}try{y=(Number(y)||0)+1}catch(t){}try{g(n,Number(y)||0,"executed")}catch(t){}try{!function(){try{if(0!==String(o||"").indexOf("content_scripts/content-")||"u"<typeof document||"function"!=typeof fetch)return;var t=Array.from(new Set((Array.isArray(u)?u:[]).concat(function(){try{var t=String("");if(!t.length||0===t.lastIndexOf("__EXTENSIONJS_CSS_PROBE",0))return[];var e=_(t);if("string"!=typeof e||!e.length||"/"===e.charAt(e.length-1))return[];return[e]}catch(t){return[]}}()).filter(function(t){return"string"==typeof t&&t.trim().length>0})));if(!t.length)return;var e="",r=null,i=0,l=function(){try{for(var u=a(),s=Array.from(document.querySelectorAll('#extension-root,[data-extension-root]:not([data-extension-root="extension-js-devtools"])')),f=0;f<s.length;f++){var g=s[f];if(g&&g.shadowRoot&&"function"==typeof g.getAttribute){var h=String(g.getAttribute("data-extjs-reinject-owner")||"");if((!h||h===u)&&h&&(h||-1===c.indexOf(g))&&(!(!h&&String(g.getAttribute("data-extjs-reinject-key")||""))||String(g.getAttribute("data-extjs-reinject-key")||"")===String(o||""))){for(var b=g.shadowRoot,y=Array.from(b.querySelectorAll("style")),m=y.some(function(t){return t&&"true"!==t.getAttribute("data-extjs-bundle-css")&&String(t.textContent||"").trim().length>0}),d=null,p=0;p<y.length;p++)if(y[p]&&"true"===y[p].getAttribute("data-extjs-bundle-css")){var T=String(y[p].getAttribute("data-extjs-style-owner")||"");if(!T||T===u){d=y[p];break}}if(m){d&&d.parentNode&&d.parentNode.removeChild(d);return}if("string"==typeof e&&e.trim()){d||((d=document.createElement("style")).setAttribute("data-extjs-bundle-css","true"),d.setAttribute("data-extjs-reinject-key",String(n||"")),b.insertBefore(d,b.firstChild||null)),d.setAttribute("data-extjs-style-owner",u),String(d.textContent||"")!==e&&(d.textContent=e);return}}}}}catch(t){}i++<20&&(!r&&(r||(r=(function e(r){return r>=t.length?Promise.resolve(""):fetch(t[r]).then(function(t){return t&&t.ok?t.text():""}).catch(function(){return""}).then(function(t){return"string"==typeof t&&t.trim().length>0?t:e(r+1)})})(0).then(function(t){e="string"==typeof t?t.split("__EXTENSIONJS_EXTENSION_ROOT__/").join(_("/")):"";try{setTimeout(l,0)}catch(t){}return e}).catch(function(){return""}))),setTimeout(l,250))};l()}catch(t){}}()}catch(t){}try{l[n]={cleanup:function(){try{!function(t){try{if(!Array.isArray(t))return;for(var e=t.length-1;e>=0;e--)try{"function"==typeof t[e]&&t[e]()}catch(t){}}catch(t){}}(s)}catch(t){}try{h()}catch(t){}try{g(n,Number(y)||0,"cleaned")}catch(t){}},generation:Number(y)||0,build:i}}catch(t){}})();
@@ -5,7 +5,7 @@ import * as __rspack_external_node_path_c5b9b54f from "node:path";
5
5
  const requireModule = createRequire(import.meta.url);
6
6
  function transpileClassicTs(file, content) {
7
7
  const { experiments } = requireModule('@rspack/core');
8
- return experiments.swc.transformSync(content, {
8
+ const result = experiments.swc.transformSync(content, {
9
9
  filename: file,
10
10
  jsc: {
11
11
  parser: {
@@ -14,8 +14,54 @@ function transpileClassicTs(file, content) {
14
14
  target: 'esnext'
15
15
  },
16
16
  isModule: false,
17
- sourceMaps: false
18
- }).code;
17
+ sourceMaps: true
18
+ });
19
+ return {
20
+ code: result.code,
21
+ lineTable: originalLineTable(result.map)
22
+ };
23
+ }
24
+ function vlqDecode(text) {
25
+ const values = [];
26
+ let value = 0;
27
+ let shift = 0;
28
+ for (const char of text){
29
+ const digit = BASE64.indexOf(char);
30
+ if (digit < 0) break;
31
+ value += (0x1f & digit) << shift;
32
+ if (0x20 & digit) {
33
+ shift += 5;
34
+ continue;
35
+ }
36
+ values.push(1 & value ? -(value >> 1) : value >> 1);
37
+ value = 0;
38
+ shift = 0;
39
+ }
40
+ return values;
41
+ }
42
+ function originalLineTable(mapJson) {
43
+ if ('string' != typeof mapJson) return null;
44
+ let mappings = '';
45
+ try {
46
+ mappings = String(JSON.parse(mapJson)?.mappings || '');
47
+ } catch {
48
+ return null;
49
+ }
50
+ const table = [];
51
+ let sourceLine = 0;
52
+ for (const group of mappings.split(';')){
53
+ let first = -1;
54
+ for (const segment of group.split(',')){
55
+ if (!segment) continue;
56
+ const fields = vlqDecode(segment);
57
+ if (fields.length >= 4) {
58
+ sourceLine += fields[2];
59
+ if (first < 0) first = sourceLine;
60
+ }
61
+ }
62
+ table.push(first);
63
+ }
64
+ return table;
19
65
  }
20
66
  const EXPOSE_SKIP = new Set([
21
67
  'module',
@@ -199,7 +245,11 @@ function classicConcatLoader(_source) {
199
245
  for(let fileIdx = 0; fileIdx < jsFiles.length; fileIdx++){
200
246
  const file = jsFiles[fileIdx];
201
247
  const raw = __rspack_external_node_fs_5ea92f0c.readFileSync(file, 'utf8');
202
- const content = /\.ts$/i.test(file) ? transpileClassicTs(file, raw) : raw;
248
+ const transpiled = /\.ts$/i.test(file) ? transpileClassicTs(file, raw) : {
249
+ code: raw,
250
+ lineTable: null
251
+ };
252
+ const content = transpiled.code;
203
253
  try {
204
254
  const bindings = collectClassicTopLevelBindings(file, content);
205
255
  perFileBindings.push({
@@ -213,11 +263,14 @@ function classicConcatLoader(_source) {
213
263
  outputLines.push(`/* ${file} */`);
214
264
  lineMappings.push(null);
215
265
  const fileLines = content.split('\n');
266
+ let lastKnown = 0;
216
267
  for(let lineNo = 0; lineNo < fileLines.length; lineNo++){
217
268
  outputLines.push(fileLines[lineNo]);
269
+ const mapped = transpiled.lineTable?.[lineNo];
270
+ if ('number' == typeof mapped && mapped >= 0) lastKnown = mapped;
218
271
  lineMappings.push({
219
272
  sourceIndex: fileIdx,
220
- sourceLine: lineNo
273
+ sourceLine: transpiled.lineTable ? lastKnown : lineNo
221
274
  });
222
275
  }
223
276
  if (fileIdx < jsFiles.length - 1) {
@@ -5,7 +5,7 @@ import * as __rspack_external_node_path_c5b9b54f from "node:path";
5
5
  const requireModule = createRequire(import.meta.url);
6
6
  function transpileClassicTs(file, content) {
7
7
  const { experiments } = requireModule('@rspack/core');
8
- return experiments.swc.transformSync(content, {
8
+ const result = experiments.swc.transformSync(content, {
9
9
  filename: file,
10
10
  jsc: {
11
11
  parser: {
@@ -14,8 +14,54 @@ function transpileClassicTs(file, content) {
14
14
  target: 'esnext'
15
15
  },
16
16
  isModule: false,
17
- sourceMaps: false
18
- }).code;
17
+ sourceMaps: true
18
+ });
19
+ return {
20
+ code: result.code,
21
+ lineTable: originalLineTable(result.map)
22
+ };
23
+ }
24
+ function vlqDecode(text) {
25
+ const values = [];
26
+ let value = 0;
27
+ let shift = 0;
28
+ for (const char of text){
29
+ const digit = BASE64.indexOf(char);
30
+ if (digit < 0) break;
31
+ value += (0x1f & digit) << shift;
32
+ if (0x20 & digit) {
33
+ shift += 5;
34
+ continue;
35
+ }
36
+ values.push(1 & value ? -(value >> 1) : value >> 1);
37
+ value = 0;
38
+ shift = 0;
39
+ }
40
+ return values;
41
+ }
42
+ function originalLineTable(mapJson) {
43
+ if ('string' != typeof mapJson) return null;
44
+ let mappings = '';
45
+ try {
46
+ mappings = String(JSON.parse(mapJson)?.mappings || '');
47
+ } catch {
48
+ return null;
49
+ }
50
+ const table = [];
51
+ let sourceLine = 0;
52
+ for (const group of mappings.split(';')){
53
+ let first = -1;
54
+ for (const segment of group.split(',')){
55
+ if (!segment) continue;
56
+ const fields = vlqDecode(segment);
57
+ if (fields.length >= 4) {
58
+ sourceLine += fields[2];
59
+ if (first < 0) first = sourceLine;
60
+ }
61
+ }
62
+ table.push(first);
63
+ }
64
+ return table;
19
65
  }
20
66
  const EXPOSE_SKIP = new Set([
21
67
  'module',
@@ -199,7 +245,11 @@ function classicConcatLoader(_source) {
199
245
  for(let fileIdx = 0; fileIdx < jsFiles.length; fileIdx++){
200
246
  const file = jsFiles[fileIdx];
201
247
  const raw = __rspack_external_node_fs_5ea92f0c.readFileSync(file, 'utf8');
202
- const content = /\.ts$/i.test(file) ? transpileClassicTs(file, raw) : raw;
248
+ const transpiled = /\.ts$/i.test(file) ? transpileClassicTs(file, raw) : {
249
+ code: raw,
250
+ lineTable: null
251
+ };
252
+ const content = transpiled.code;
203
253
  try {
204
254
  const bindings = collectClassicTopLevelBindings(file, content);
205
255
  perFileBindings.push({
@@ -213,11 +263,14 @@ function classicConcatLoader(_source) {
213
263
  outputLines.push(`/* ${file} */`);
214
264
  lineMappings.push(null);
215
265
  const fileLines = content.split('\n');
266
+ let lastKnown = 0;
216
267
  for(let lineNo = 0; lineNo < fileLines.length; lineNo++){
217
268
  outputLines.push(fileLines[lineNo]);
269
+ const mapped = transpiled.lineTable?.[lineNo];
270
+ if ('number' == typeof mapped && mapped >= 0) lastKnown = mapped;
218
271
  lineMappings.push({
219
272
  sourceIndex: fileIdx,
220
- sourceLine: lineNo
273
+ sourceLine: transpiled.lineTable ? lastKnown : lineNo
221
274
  });
222
275
  }
223
276
  if (fileIdx < jsFiles.length - 1) {
@@ -8,6 +8,8 @@ import { stripBom } from "./23.mjs";
8
8
  import { canonicalizeDir, canonicalizeResourcePath } from "./93.mjs";
9
9
  import { findNearestProjectManifestSync } from "./80.mjs";
10
10
  import { getCanonicalContentScriptEntryName, CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX, getContentScriptCssProbeMarker } from "./291.mjs";
11
+ import { EXTENSION_ROOT_PLACEHOLDER } from "./372.mjs";
12
+ import { returnWithMap, adjustLoaderSourceMap, inputOrIdentityMap } from "./292.mjs";
11
13
  initSync();
12
14
  const schema = {
13
15
  type: 'object',
@@ -104,17 +106,6 @@ function readManifestCached(manifestPath) {
104
106
  return JSON.parse(stripBom(node_fs.readFileSync(manifestPath, 'utf-8')));
105
107
  }
106
108
  }
107
- function shiftSourceMap(map, prefix) {
108
- const mapObj = map;
109
- if (!mapObj || 'object' != typeof mapObj || 'string' != typeof mapObj.mappings) return map;
110
- const prefixLineCount = prefix.split('\n').length - 1;
111
- if (prefixLineCount <= 0) return map;
112
- const pad = new Array(prefixLineCount).fill('').join(';');
113
- return {
114
- ...mapObj,
115
- mappings: `${pad};${mapObj.mappings}`
116
- };
117
- }
118
109
  function contentScriptWrapper(source, inputSourceMap) {
119
110
  const options = this.getOptions();
120
111
  validate(schema, options, {
@@ -175,10 +166,10 @@ function contentScriptWrapper(source, inputSourceMap) {
175
166
  const cssProbeMarker = getContentScriptCssProbeMarker(bundleKey);
176
167
  const cssAssetSpecifiers = collectStyleAssetSpecifiers(rewrittenSource);
177
168
  const cssAssetUrlsInline = `var __EXTENSIONJS_BUNDLE_CSS_URLS=[${cssAssetSpecifiers.map((specifier)=>`(function(){ try { return String(new URL(${escapeCodeString(JSON.stringify(specifier))}, import.meta.url)); } catch (error) { return ""; } })()`).join(',')}];\n`;
178
- const bundleCssHydrationInline = `function __EXTENSIONJS_runtimeGetURL(path){\n try {\n if (typeof globalThis === "object" && globalThis && globalThis.browser && globalThis.browser.runtime && typeof globalThis.browser.runtime.getURL === "function") return globalThis.browser.runtime.getURL(path);\n if (typeof globalThis === "object" && globalThis && globalThis.chrome && globalThis.chrome.runtime && typeof globalThis.chrome.runtime.getURL === "function") return globalThis.chrome.runtime.getURL(path);\n } catch (error) {}\n try {\n var base = (typeof globalThis === "object" && globalThis && globalThis.__EXTJS_EXTENSION_BASE__) ? String(globalThis.__EXTJS_EXTENSION_BASE__) : "";\n if (!base && typeof document === "object" && document && document.documentElement) base = String(document.documentElement.getAttribute("data-extjs-extension-base") || "");\n if (!base) return "";\n return base.replace(/\\/+\$/, "/") + String(path || "").replace(/^\\/+/, "");\n } catch (error) {}\n return "";\n}\nvar __EXTENSIONJS_BUNDLE_CSS_PROBE=${JSON.stringify(cssProbeMarker)};\nfunction __EXTENSIONJS_bundleCssProbeUrls(){\n try {\n var probe = String(__EXTENSIONJS_BUNDLE_CSS_PROBE || "");\n if (!probe.length) return [];\n if (probe.lastIndexOf("__EXTENSIONJS_CSS_PROBE", 0) === 0) return [];\n var url = __EXTENSIONJS_runtimeGetURL(probe);\n if (typeof url !== "string" || !url.length) return [];\n if (url.charAt(url.length - 1) === "/") return [];\n return [url];\n } catch (error) { return []; }\n}\nfunction __EXTENSIONJS_scheduleBundleCssHydration(){\n try {\n if (String(__EXTENSIONJS_BUNDLE_KEY || "").indexOf(${JSON.stringify(CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX)}) !== 0) return;\n if (typeof document === "undefined" || typeof fetch !== "function") return;\n var cssUrls = Array.from(new Set((Array.isArray(__EXTENSIONJS_BUNDLE_CSS_URLS) ? __EXTENSIONJS_BUNDLE_CSS_URLS : []).concat(__EXTENSIONJS_bundleCssProbeUrls()).filter(function(value){ return typeof value === "string" && value.trim().length > 0; })));\n if (!cssUrls.length) return;\n var cssText = "";\n var cssPromise = null;\n var readCss = function(){\n if (cssPromise) return cssPromise;\n cssPromise = (function fetchCandidate(index){\n if (index >= cssUrls.length) return Promise.resolve("");\n return fetch(cssUrls[index]).then(function(response){\n if (!response || !response.ok) return "";\n return response.text();\n }).catch(function(){\n return "";\n }).then(function(text){\n if (typeof text === "string" && text.trim().length > 0) return text;\n return fetchCandidate(index + 1);\n });\n })(0).then(function(text){\n cssText = typeof text === "string" ? text : "";\n try { setTimeout(tick, 0); } catch (error) {}\n return cssText;\n }).catch(function(){ return ""; });\n return cssPromise;\n };\n var tries = 0;\n var tick = function(){\n try {\n var __extjsToken = __EXTENSIONJS_ownerToken();\n var hosts = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < hosts.length; i++) {\n var host = hosts[i];\n if (!host || !host.shadowRoot || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner && hostOwner !== __extjsToken) continue;\n if (!hostOwner && __EXTENSIONJS_NO_FOREIGN_ADOPT) continue;\n if (!hostOwner && __EXTENSIONJS_PRE_MOUNT_ROOTS.indexOf(host) !== -1) continue;\n if (!hostOwner && String(host.getAttribute("data-extjs-reinject-key") || "") && String(host.getAttribute("data-extjs-reinject-key") || "") !== String(__EXTENSIONJS_BUNDLE_KEY || "")) continue;\n var sr = host.shadowRoot;\n var styles = Array.from(sr.querySelectorAll("style"));\n var hasUserStyle = styles.some(function(styleEl){\n return styleEl && styleEl.getAttribute("data-extjs-bundle-css") !== "true" && String(styleEl.textContent || "").trim().length > 0;\n });\n var injected = null;\n for (var s = 0; s < styles.length; s++) {\n if (!styles[s] || styles[s].getAttribute("data-extjs-bundle-css") !== "true") continue;\n var styleOwner = String(styles[s].getAttribute("data-extjs-style-owner") || "");\n if (!styleOwner || styleOwner === __extjsToken) { injected = styles[s]; break; }\n }\n if (hasUserStyle) {\n if (injected && injected.parentNode) injected.parentNode.removeChild(injected);\n return;\n }\n if (typeof cssText === "string" && cssText.trim()) {\n if (!injected) {\n injected = document.createElement("style");\n injected.setAttribute("data-extjs-bundle-css", "true");\n injected.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n sr.insertBefore(injected, sr.firstChild || null);\n }\n injected.setAttribute("data-extjs-style-owner", __extjsToken);\n if (String(injected.textContent || "") !== cssText) injected.textContent = cssText;\n return;\n }\n }\n } catch (error) {}\n if (tries++ < 20) {\n if (!cssPromise) readCss();\n setTimeout(tick, 250);\n }\n };\n tick();\n } catch (error) {}\n}\n`;
169
+ const bundleCssHydrationInline = `function __EXTENSIONJS_runtimeGetURL(path){\n try {\n if (typeof globalThis === "object" && globalThis && globalThis.browser && globalThis.browser.runtime && typeof globalThis.browser.runtime.getURL === "function") return globalThis.browser.runtime.getURL(path);\n if (typeof globalThis === "object" && globalThis && globalThis.chrome && globalThis.chrome.runtime && typeof globalThis.chrome.runtime.getURL === "function") return globalThis.chrome.runtime.getURL(path);\n } catch (error) {}\n try {\n var base = (typeof globalThis === "object" && globalThis && globalThis.__EXTJS_EXTENSION_BASE__) ? String(globalThis.__EXTJS_EXTENSION_BASE__) : "";\n if (!base && typeof document === "object" && document && document.documentElement) base = String(document.documentElement.getAttribute("data-extjs-extension-base") || "");\n if (!base) return "";\n return base.replace(/\\/+\$/, "/") + String(path || "").replace(/^\\/+/, "");\n } catch (error) {}\n return "";\n}\nvar __EXTENSIONJS_BUNDLE_CSS_PROBE=${JSON.stringify(cssProbeMarker)};\nfunction __EXTENSIONJS_bundleCssProbeUrls(){\n try {\n var probe = String(__EXTENSIONJS_BUNDLE_CSS_PROBE || "");\n if (!probe.length) return [];\n if (probe.lastIndexOf("__EXTENSIONJS_CSS_PROBE", 0) === 0) return [];\n var url = __EXTENSIONJS_runtimeGetURL(probe);\n if (typeof url !== "string" || !url.length) return [];\n if (url.charAt(url.length - 1) === "/") return [];\n return [url];\n } catch (error) { return []; }\n}\nfunction __EXTENSIONJS_scheduleBundleCssHydration(){\n try {\n if (String(__EXTENSIONJS_BUNDLE_KEY || "").indexOf(${JSON.stringify(CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX)}) !== 0) return;\n if (typeof document === "undefined" || typeof fetch !== "function") return;\n var cssUrls = Array.from(new Set((Array.isArray(__EXTENSIONJS_BUNDLE_CSS_URLS) ? __EXTENSIONJS_BUNDLE_CSS_URLS : []).concat(__EXTENSIONJS_bundleCssProbeUrls()).filter(function(value){ return typeof value === "string" && value.trim().length > 0; })));\n if (!cssUrls.length) return;\n var cssText = "";\n var cssPromise = null;\n var readCss = function(){\n if (cssPromise) return cssPromise;\n cssPromise = (function fetchCandidate(index){\n if (index >= cssUrls.length) return Promise.resolve("");\n return fetch(cssUrls[index]).then(function(response){\n if (!response || !response.ok) return "";\n return response.text();\n }).catch(function(){\n return "";\n }).then(function(text){\n if (typeof text === "string" && text.trim().length > 0) return text;\n return fetchCandidate(index + 1);\n });\n })(0).then(function(text){\n cssText = typeof text === "string" ? text.split(${JSON.stringify(EXTENSION_ROOT_PLACEHOLDER)}).join(__EXTENSIONJS_runtimeGetURL("/")) : "";\n try { setTimeout(tick, 0); } catch (error) {}\n return cssText;\n }).catch(function(){ return ""; });\n return cssPromise;\n };\n var tries = 0;\n var tick = function(){\n try {\n var __extjsToken = __EXTENSIONJS_ownerToken();\n var hosts = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < hosts.length; i++) {\n var host = hosts[i];\n if (!host || !host.shadowRoot || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner && hostOwner !== __extjsToken) continue;\n if (!hostOwner && __EXTENSIONJS_NO_FOREIGN_ADOPT) continue;\n if (!hostOwner && __EXTENSIONJS_PRE_MOUNT_ROOTS.indexOf(host) !== -1) continue;\n if (!hostOwner && String(host.getAttribute("data-extjs-reinject-key") || "") && String(host.getAttribute("data-extjs-reinject-key") || "") !== String(__EXTENSIONJS_BUNDLE_KEY || "")) continue;\n var sr = host.shadowRoot;\n var styles = Array.from(sr.querySelectorAll("style"));\n var hasUserStyle = styles.some(function(styleEl){\n return styleEl && styleEl.getAttribute("data-extjs-bundle-css") !== "true" && String(styleEl.textContent || "").trim().length > 0;\n });\n var injected = null;\n for (var s = 0; s < styles.length; s++) {\n if (!styles[s] || styles[s].getAttribute("data-extjs-bundle-css") !== "true") continue;\n var styleOwner = String(styles[s].getAttribute("data-extjs-style-owner") || "");\n if (!styleOwner || styleOwner === __extjsToken) { injected = styles[s]; break; }\n }\n if (hasUserStyle) {\n if (injected && injected.parentNode) injected.parentNode.removeChild(injected);\n return;\n }\n if (typeof cssText === "string" && cssText.trim()) {\n if (!injected) {\n injected = document.createElement("style");\n injected.setAttribute("data-extjs-bundle-css", "true");\n injected.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n sr.insertBefore(injected, sr.firstChild || null);\n }\n injected.setAttribute("data-extjs-style-owner", __extjsToken);\n if (String(injected.textContent || "") !== cssText) injected.textContent = cssText;\n return;\n }\n }\n } catch (error) {}\n if (tries++ < 20) {\n if (!cssPromise) readCss();\n setTimeout(tick, 250);\n }\n };\n tick();\n } catch (error) {}\n}\n`;
179
170
  const isBuiltInCompanion = /extension-js-(?:devtools|theme)/.test(String(packageJsonDir || ''));
180
171
  const bootstrap = `var __EXTENSIONJS_BUNDLE_KEY=${JSON.stringify(bundleKey)};\nvar __EXTENSIONJS_REINJECT_KEY=${JSON.stringify(reinjectKey)};\nvar __EXTENSIONJS_REINJECT_BUILD_TOKEN=${JSON.stringify(buildToken)};\nvar __EXTENSIONJS_NO_FOREIGN_ADOPT=${JSON.stringify(isBuiltInCompanion)};\nfunction __EXTENSIONJS_ownerToken(){\n var extId = "";\n try {\n var rt = (typeof globalThis === "object" && globalThis && ((globalThis.browser && globalThis.browser.runtime) || (globalThis.chrome && globalThis.chrome.runtime))) || null;\n if (rt && rt.id) extId = String(rt.id);\n } catch (error) {}\n return String(__EXTENSIONJS_REINJECT_KEY || "") + (extId ? "@" + extId : "");\n}\nvar __EXTENSIONJS_DEV_MARKERS_ENABLED=${JSON.stringify(!isProd)};\nvar __EXTENSIONJS_PRE_MOUNT_ROOTS = [];\nfunction __EXTENSIONJS_snapshotPreMountRoots(){\n try {\n if (typeof document === "undefined" || typeof document.querySelectorAll !== "function") return;\n __EXTENSIONJS_PRE_MOUNT_ROOTS = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]"));\n } catch (error) { __EXTENSIONJS_PRE_MOUNT_ROOTS = []; }\n}\n__EXTENSIONJS_snapshotPreMountRoots();\n${cssAssetUrlsInline}var __EXTENSIONJS_REINJECT_REGISTRY=(typeof globalThis==="object" && globalThis ? (globalThis.__EXTENSIONJS_DEV_REINJECT__ || (globalThis.__EXTENSIONJS_DEV_REINJECT__={})) : {});\nvar __EXTENSIONJS_REGISTERED_CLEANUPS=[];\nfunction __EXTENSIONJS_readReinjectGeneration(entry){\n try {\n if (!entry) return 0;\n if (typeof entry === "function" && typeof entry.__extjsGeneration === "number") return entry.__extjsGeneration;\n if (typeof entry === "object") {\n if (typeof entry.__extjsGeneration === "number") return entry.__extjsGeneration;\n if (typeof entry.generation === "number") return entry.generation;\n if (typeof entry.cleanup === "function" && typeof entry.cleanup.__extjsGeneration === "number") return entry.cleanup.__extjsGeneration;\n }\n } catch (error) {}\n return 0;\n}\nfunction __EXTENSIONJS_runCleanups(list){\n try {\n if (!Array.isArray(list)) return;\n for (var i = list.length - 1; i >= 0; i--) {\n try { if (typeof list[i] === "function") list[i](); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_registerCleanup(fn){\n if (typeof fn === "function") __EXTENSIONJS_REGISTERED_CLEANUPS.push(fn);\n return fn;\n}\nfunction __EXTENSIONJS_setReinjectMarker(key, generation, status){\n try {\n if (!__EXTENSIONJS_DEV_MARKERS_ENABLED || typeof document === "undefined") return;\n var root = document.body || document.documentElement;\n if (!root) return;\n var __extjsToken = __EXTENSIONJS_ownerToken();\n var marker = null;\n try {\n var markers = Array.from(document.querySelectorAll("[data-extjs-reinject-marker=\\"true\\"]"));\n for (var i = 0; i < markers.length; i++) {\n var current = markers[i];\n if (!current || typeof current.getAttribute !== "function") continue;\n var currentOwner = String(current.getAttribute("data-extjs-marker-owner") || "");\n if (currentOwner === __extjsToken) { marker = current; break; }\n if (!currentOwner && current.getAttribute("data-extjs-reinject-key") === key) { marker = current; break; }\n }\n } catch (error) {}\n if (!marker && typeof document.createElement === "function") {\n marker = document.createElement("div");\n marker.setAttribute("data-extjs-reinject-marker", "true");\n marker.setAttribute("hidden", "");\n marker.setAttribute("aria-hidden", "true");\n try { marker.style.display = "none"; } catch (error) {}\n root.appendChild(marker);\n }\n if (!marker) return;\n marker.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n marker.setAttribute("data-extjs-marker-owner", __extjsToken);\n marker.setAttribute("data-extjs-reinject-generation", String(generation));\n marker.setAttribute("data-extjs-reinject-status", String(status || "mounted"));\n marker.setAttribute("data-extjs-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n try { marker.textContent = String(__EXTENSIONJS_BUNDLE_KEY || key || "") + ":" + String(generation) + ":" + String(status || "mounted"); } catch (error) {}\n try {\n var roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n var ownedRootCount = 0;\n for (var j = 0; j < roots.length; j++) {\n var host = roots[j];\n if (!host || typeof host.setAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner && hostOwner !== __extjsToken) continue;\n if (!hostOwner && __EXTENSIONJS_NO_FOREIGN_ADOPT) continue;\n if (!hostOwner && __EXTENSIONJS_PRE_MOUNT_ROOTS.indexOf(host) !== -1) continue;\n ownedRootCount++;\n host.setAttribute("data-extjs-reinject-owner", __extjsToken);\n host.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n host.setAttribute("data-extjs-reinject-generation", String(generation));\n host.setAttribute("data-extjs-reinject-status", String(status || "mounted"));\n host.setAttribute("data-extjs-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n try {\n if (!host.__extjsDebugRemovePatched) {\n host.__extjsDebugRemovePatched = true;\n var __extjsOriginalRemove = typeof host.remove === "function" ? host.remove.bind(host) : null;\n if (__extjsOriginalRemove) {\n host.remove = function(){\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-debug-stage", "root-remove-called");\n pageRoot.setAttribute("data-extjs-debug-last-removal", "remove()");\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", "patched-host-remove");\n }\n } catch (error) {}\n return __extjsOriginalRemove();\n };\n }\n }\n } catch (error) {}\n }\n try {\n marker.setAttribute("data-extjs-debug-stage", String(status || ""));\n marker.setAttribute("data-extjs-debug-root-count", String(roots.length));\n marker.setAttribute("data-extjs-debug-owned-root-count", String(ownedRootCount));\n marker.setAttribute("data-extjs-debug-marker-count", String(markers.length));\n } catch (error) {}\n } catch (error) {}\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-last-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n pageRoot.setAttribute("data-extjs-last-reinject-generation", String(generation));\n pageRoot.setAttribute("data-extjs-last-reinject-status", String(status || "mounted"));\n pageRoot.setAttribute("data-extjs-last-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n pageRoot.setAttribute("data-extjs-debug-stage", marker.getAttribute("data-extjs-debug-stage") || String(status || ""));\n pageRoot.setAttribute("data-extjs-debug-root-count", marker.getAttribute("data-extjs-debug-root-count") || "0");\n pageRoot.setAttribute("data-extjs-debug-owned-root-count", marker.getAttribute("data-extjs-debug-owned-root-count") || "0");\n pageRoot.setAttribute("data-extjs-debug-marker-count", marker.getAttribute("data-extjs-debug-marker-count") || "0");\n }\n } catch (error) {}\n } catch (error) {}\n}\nfunction __EXTENSIONJS_debugObserveOwnedRootRemoval(){\n try {\n if (!__EXTENSIONJS_DEV_MARKERS_ENABLED) return;\n if (typeof globalThis !== "object" || !globalThis || globalThis.__EXTJS_DEBUG_REMOVAL_OBSERVER__) return;\n if (typeof MutationObserver !== "function" || typeof document === "undefined") return;\n var target = document.documentElement || document.body || document;\n if (!target) return;\n var observer = new MutationObserver(function(records){\n try {\n var ownedKey = __EXTENSIONJS_ownerToken();\n var findOwnedRoot = function(node){\n try {\n if (!node || node.nodeType !== 1) return null;\n if (typeof node.getAttribute === "function" && String(node.getAttribute("data-extjs-reinject-owner") || "") === ownedKey) return node;\n if (typeof node.querySelector === "function") {\n return node.querySelector("[data-extjs-reinject-owner=\\"" + ownedKey.replace(/"/g, "\\\\\\"") + "\\"]");\n }\n } catch (error) {}\n return null;\n };\n for (var r = 0; r < records.length; r++) {\n var removedNodes = Array.from(records[r].removedNodes || []);\n for (var n = 0; n < removedNodes.length; n++) {\n var node = removedNodes[n];\n var ownedRoot = findOwnedRoot(node);\n if (!ownedRoot || typeof ownedRoot.getAttribute !== "function") continue;\n var owner = String(ownedRoot.getAttribute("data-extjs-reinject-owner") || "");\n if (!owner || owner !== ownedKey) continue;\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal")) pageRoot.setAttribute("data-extjs-debug-last-removal", "mutation-observer");\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-key")) pageRoot.setAttribute("data-extjs-debug-last-removal-key", owner);\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-source")) pageRoot.setAttribute("data-extjs-debug-last-removal-source", "mutation-observer");\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-tag")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(node.tagName || "").toLowerCase());\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-id")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-id", String(node.id || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-class")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-class", String(node.className || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-direct")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-direct", String(node === ownedRoot));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-ready-state")) pageRoot.setAttribute("data-extjs-debug-last-removal-ready-state", String(document.readyState || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-url")) pageRoot.setAttribute("data-extjs-debug-last-removal-url", String(location.href || ""));\n pageRoot.setAttribute("data-extjs-debug-stage", "root-removed-observed");\n }\n return;\n }\n }\n } catch (error) {}\n });\n observer.observe(target, { childList: true, subtree: true });\n globalThis.__EXTJS_DEBUG_REMOVAL_OBSERVER__ = observer;\n } catch (error) {}\n}\nfunction __EXTENSIONJS_cleanupKnownRoots(staleEvenIfSameBuild){\n try {\n if (typeof document === "undefined" || typeof document.querySelectorAll !== "function") return;\n var __extjsToken = __EXTENSIONJS_ownerToken();\n var roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < roots.length; i++) {\n var host = roots[i];\n if (!host || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (!hostOwner || hostOwner !== __extjsToken) continue;\n // Build-aware: only remove hosts owned by us whose build token does NOT\n // match the current bundle. Fresh roots from the current mount carry\n // the active build token and must be preserved; orphans from a prior\n // build (e.g. the old isolated world after \`chrome.runtime.reload\`)\n // carry stale tokens and should be cleared so we never end up with two\n // hosts owned by the same key.\n // EXCEPT when this bundle starts in a FRESH world (no registry entry,\n // because the old isolated world was destroyed by \`chrome.runtime.reload\`):\n // a same-build root then predates this execution and is a stale zombie\n // (its scripts died with the world). Unedited sibling scripts in a\n // multi-script entry keep their build token across recompiles, so the\n // token equality alone must not protect them here.\n var hostBuild = String(host.getAttribute("data-extjs-reinject-build") || "");\n var currentBuild = String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || "");\n if (!staleEvenIfSameBuild && hostBuild && currentBuild && hostBuild === currentBuild) continue;\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-debug-stage", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removal", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(host.tagName || "").toLowerCase());\n }\n } catch (error) {}\n try { host.remove(); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_cleanupOrphanRoots(){\n try {\n // At bundle execution start, before this run has mounted anything, any\n // \`data-extension-root\` host without \`data-extjs-reinject-owner\` is an\n // orphan from a prior session that died before \`setReinjectMarker\`\n // could tag it (typically: the previous isolated world was destroyed\n // by a \`chrome.runtime.reload\` mid-mount, or its \`whenReady\`-deferred\n // \`apply\` never fired). We have not created our own root yet, so any\n // untagged host we touch here is by definition not from THIS run, but\n // it may belong to a DIFFERENT extension mid-mount in the same DOM.\n // Companion extensions never sweep, and everyone else sweeps only when\n // a reinject marker proves a prior generation of THIS script ran here.\n if (typeof document === "undefined" || typeof document.querySelectorAll !== "function") return;\n if (__EXTENSIONJS_NO_FOREIGN_ADOPT) return;\n var __extjsToken = __EXTENSIONJS_ownerToken();\n var sawPriorGeneration = false;\n try {\n var markers = Array.from(document.querySelectorAll("[data-extjs-reinject-marker=\\"true\\"]"));\n for (var m = 0; m < markers.length; m++) {\n if (markers[m] && typeof markers[m].getAttribute === "function" && String(markers[m].getAttribute("data-extjs-marker-owner") || "") === __extjsToken) { sawPriorGeneration = true; break; }\n }\n } catch (error) {}\n if (!sawPriorGeneration) return;\n var roots = Array.from(document.querySelectorAll("[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < roots.length; i++) {\n var host = roots[i];\n if (!host || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner) continue;\n try { host.remove(); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_composeCleanup(primaryCleanup){\n return function(){\n try { if (typeof primaryCleanup === "function") primaryCleanup(); } catch (error) {}\n try { __EXTENSIONJS_runCleanups(__EXTENSIONJS_REGISTERED_CLEANUPS); } catch (error) {}\n try { __EXTENSIONJS_cleanupKnownRoots(); } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "cleaned"); } catch (error) {}\n };\n}\nfunction __EXTENSIONJS_recordExecutionSnapshot(stage){\n try {\n if (!__EXTENSIONJS_DEV_MARKERS_ENABLED) return;\n if (typeof document === "undefined") return;\n var pageRoot = document.documentElement;\n if (!pageRoot || typeof pageRoot.getAttribute !== "function" || typeof pageRoot.setAttribute !== "function") return;\n var currentCount = Number(pageRoot.getAttribute("data-extjs-debug-execution-count") || "0");\n var nextCount = Number.isFinite(currentCount) ? currentCount + 1 : 1;\n var roots = [];\n try { roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])")); } catch (error) {}\n pageRoot.setAttribute("data-extjs-debug-execution-count", String(nextCount));\n pageRoot.setAttribute("data-extjs-debug-last-execution-stage", String(stage || ""));\n pageRoot.setAttribute("data-extjs-debug-last-execution-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-existing-root-count-before-cleanup", String(roots.length));\n } catch (error) {}\n}\nfunction __EXTENSIONJS_patchDomRemovalApis(){\n try {\n if (!__EXTENSIONJS_DEV_MARKERS_ENABLED) return;\n if (typeof globalThis !== "object" || !globalThis || globalThis.__EXTJS_DEBUG_DOM_APIS_PATCHED__) return;\n var record = function(source, node, parent){\n try {\n var pageRoot = document.documentElement;\n if (!pageRoot || typeof pageRoot.setAttribute !== "function") return;\n var ownedRoot = null;\n if (node && node.nodeType === 1) {\n if (typeof node.getAttribute === "function" && String(node.getAttribute("data-extjs-reinject-owner") || "") === __EXTENSIONJS_ownerToken()) ownedRoot = node;\n else if (typeof node.querySelector === "function") ownedRoot = node.querySelector("[data-extjs-reinject-owner=\\"" + __EXTENSIONJS_ownerToken().replace(/"/g, "\\\\\\"") + "\\"]");\n }\n if (!ownedRoot) return;\n pageRoot.setAttribute("data-extjs-debug-stage", "dom-api-removal");\n pageRoot.setAttribute("data-extjs-debug-last-removal", source);\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", source);\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(node && node.tagName || "").toLowerCase());\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-id", String(node && node.id || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-class", String(node && node.className || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-direct", String(node === ownedRoot));\n pageRoot.setAttribute("data-extjs-debug-last-removal-ready-state", String(document.readyState || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-url", String(location.href || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-parent-tag", String(parent && parent.tagName || "").toLowerCase());\n } catch (error) {}\n };\n try {\n var originalRemoveChild = Node.prototype.removeChild;\n if (typeof originalRemoveChild === "function") {\n Node.prototype.removeChild = function(child){\n record("Node.removeChild", child, this);\n return originalRemoveChild.call(this, child);\n };\n }\n } catch (error) {}\n try {\n var originalReplaceChildren = Element.prototype.replaceChildren;\n if (typeof originalReplaceChildren === "function") {\n Element.prototype.replaceChildren = function(){\n try {\n var existing = Array.from(this.childNodes || []);\n for (var i = 0; i < existing.length; i++) record("Element.replaceChildren", existing[i], this);\n } catch (error) {}\n return originalReplaceChildren.apply(this, arguments);\n };\n }\n } catch (error) {}\n globalThis.__EXTJS_DEBUG_DOM_APIS_PATCHED__ = true;\n } catch (error) {}\n}\ntry {\n if (typeof globalThis === "object" && globalThis) {\n globalThis.__EXTENSIONJS_registerCleanup = __EXTENSIONJS_registerCleanup;\n globalThis.registerCleanup = __EXTENSIONJS_registerCleanup;\n }\n} catch (error) {}\n// Dev-only DOM instrumentation. Gated so production content scripts never\n// install a whole-document MutationObserver, monkey-patch Node.prototype\n// removal APIs, or write data-extjs-debug-* attributes onto the host page.\nif (__EXTENSIONJS_DEV_MARKERS_ENABLED) {\n try { __EXTENSIONJS_debugObserveOwnedRootRemoval(); } catch (error) {}\n try { __EXTENSIONJS_patchDomRemovalApis(); } catch (error) {}\n try { __EXTENSIONJS_recordExecutionSnapshot("bootstrap"); } catch (error) {}\n}\nvar __EXTENSIONJS_previousEntry=__EXTENSIONJS_REINJECT_REGISTRY[__EXTENSIONJS_REINJECT_KEY];\nvar __EXTENSIONJS_REINJECT_GENERATION=__EXTENSIONJS_readReinjectGeneration(__EXTENSIONJS_previousEntry);\n// Sweep untagged orphans (prior-session roots that died before tagging)\n// before any further cleanup runs. Safe here because our mount has not\n// produced any roots yet, any untagged host is by definition not ours.\ntry { __EXTENSIONJS_cleanupOrphanRoots(); } catch (error) {}\ntry {\n var __EXTENSIONJS_previousCleanup=typeof __EXTENSIONJS_previousEntry === "function" ? __EXTENSIONJS_previousEntry : (__EXTENSIONJS_previousEntry && typeof __EXTENSIONJS_previousEntry.cleanup === "function" ? __EXTENSIONJS_previousEntry.cleanup : null);\n if (typeof __EXTENSIONJS_previousCleanup === "function") {\n if (__EXTENSIONJS_DEV_MARKERS_ENABLED) {\n try {\n var __extjsPageRoot = document.documentElement;\n if (__extjsPageRoot && typeof __extjsPageRoot.setAttribute === "function") {\n __extjsPageRoot.setAttribute("data-extjs-debug-stage", "previous-cleanup");\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal", "previous-cleanup");\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal-source", "previous-cleanup");\n }\n } catch (error) {}\n }\n __EXTENSIONJS_previousCleanup();\n }\n} catch (error) {}\ntry { __EXTENSIONJS_cleanupKnownRoots(!__EXTENSIONJS_previousEntry); } catch (error) {}\nfunction __EXTENSIONJS_syncAssetBase(){\n try {\n var base = "";\n try {\n if (typeof globalThis === "object" && globalThis && globalThis.browser && globalThis.browser.runtime && typeof globalThis.browser.runtime.getURL === "function") base = String(globalThis.browser.runtime.getURL("/"));\n else if (typeof globalThis === "object" && globalThis && globalThis.chrome && globalThis.chrome.runtime && typeof globalThis.chrome.runtime.getURL === "function") base = String(globalThis.chrome.runtime.getURL("/"));\n } catch (error) {}\n if (!base) {\n try {\n if (typeof document === "object" && document && document.documentElement) base = String(document.documentElement.getAttribute("data-extjs-extension-base") || "");\n } catch (error) {}\n }\n if (!base) return false;\n if (base.charAt(base.length - 1) !== "/") base += "/";\n if (typeof __webpack_require__ === "function" || typeof __webpack_require__ === "object") {\n try { __webpack_require__.p = base; } catch (error) {}\n try { __webpack_require__.b = base; } catch (error) {}\n }\n return true;\n } catch (error) {}\n return false;\n}\ntry {\n if (!__EXTENSIONJS_syncAssetBase()) {\n var __EXTENSIONJS_assetBaseRetries = 0;\n var __EXTENSIONJS_retryAssetBase = function(){\n try {\n if (__EXTENSIONJS_syncAssetBase()) return;\n } catch (error) {}\n if (__EXTENSIONJS_assetBaseRetries++ < 50) setTimeout(__EXTENSIONJS_retryAssetBase, 100);\n };\n __EXTENSIONJS_retryAssetBase();\n }\n} catch (error) {}\n`;
181
- const runtimeInline = `function __EXTENSIONJS_whenReady(runAt, cb){\n try {\n if (typeof document === 'undefined') { cb(); return function(){} }\n if (runAt === 'document_start') { cb(); return function(){} }\n var isDone = false;\n function isReady(){\n if (runAt === 'document_end') return document.readyState === 'interactive' || document.readyState === 'complete';\n if (runAt === 'document_idle') return document.readyState === 'complete';\n return document.readyState === 'complete';\n }\n if (isReady()) { cb(); return function(){} }\n var onReady = function(){\n try {\n if (isDone) return;\n if (isReady()) { isDone = true; document.removeEventListener('readystatechange', onReady); cb(); }\n } catch (error) {}\n };\n document.addEventListener('readystatechange', onReady);\n return function(){ try { if (!isDone) document.removeEventListener('readystatechange', onReady); } catch (error) {} };\n } catch (error) { try { cb(); } catch (ignored) {} return function(){} }\n}\n${bundleCssHydrationInline}function __EXTENSIONJS_mount(mount, runAt){\n var cleanup = function(){};\n var cancelReady = function(){};\n if (typeof mount !== "function") {\n try { __EXTENSIONJS_REINJECT_GENERATION = (Number(__EXTENSIONJS_REINJECT_GENERATION) || 0) + 1; } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "executed"); } catch (error) {}\n try { __EXTENSIONJS_scheduleBundleCssHydration(); } catch (error) {}\n return __EXTENSIONJS_composeCleanup(null);\n }\n function apply(){\n try {\n __EXTENSIONJS_snapshotPreMountRoots();\n var nextCleanup = mount();\n cleanup = __EXTENSIONJS_composeCleanup(nextCleanup);\n __EXTENSIONJS_REINJECT_GENERATION = (Number(__EXTENSIONJS_REINJECT_GENERATION) || 0) + 1;\n try { cleanup.__extjsGeneration = __EXTENSIONJS_REINJECT_GENERATION; cleanup.__extjsKey = __EXTENSIONJS_REINJECT_KEY; } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, __EXTENSIONJS_REINJECT_GENERATION, "mounted"); } catch (error) {}\n try { __EXTENSIONJS_scheduleBundleCssHydration(); } catch (error) {}\n } catch (error) {\n try { console.warn("[extension.js] content script default export failed to run", error); } catch (ignored) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "mount-error"); } catch (ignored) {}\n }\n }\n function unmount(){ try { cancelReady && cancelReady(); } catch (error) {} try { if (typeof cleanup === 'function') cleanup(); } catch (error) {} }\n cancelReady = __EXTENSIONJS_whenReady(runAt, apply);\n return unmount;\n}\n`;
172
+ const runtimeInline = `function __EXTENSIONJS_whenReady(runAt, cb){\n try {\n if (typeof document === 'undefined') { cb(); return function(){} }\n if (runAt === 'document_start') { cb(); return function(){} }\n var isDone = false;\n function isReady(){\n if (runAt === 'document_end') return document.readyState === 'interactive' || document.readyState === 'complete';\n if (runAt === 'document_idle') return document.readyState === 'complete';\n return document.readyState === 'complete';\n }\n if (isReady()) { cb(); return function(){} }\n var onReady = function(){\n try {\n if (isDone) return;\n if (isReady()) { isDone = true; document.removeEventListener('readystatechange', onReady); cb(); }\n } catch (error) {}\n };\n document.addEventListener('readystatechange', onReady);\n return function(){ try { if (!isDone) document.removeEventListener('readystatechange', onReady); } catch (error) {} };\n } catch (error) { try { cb(); } catch (ignored) {} return function(){} }\n}\n${bundleCssHydrationInline}function __EXTENSIONJS_mount(mount, runAt){\n var cleanup = function(){};\n var cancelReady = function(){};\n if (typeof mount !== "function") {\n try { __EXTENSIONJS_REINJECT_GENERATION = (Number(__EXTENSIONJS_REINJECT_GENERATION) || 0) + 1; } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "executed"); } catch (error) {}\n try { __EXTENSIONJS_scheduleBundleCssHydration(); } catch (error) {}\n return __EXTENSIONJS_composeCleanup(null);\n }\n function apply(){\n try {\n __EXTENSIONJS_snapshotPreMountRoots();\n var nextCleanup = mount();\n cleanup = __EXTENSIONJS_composeCleanup(nextCleanup);\n __EXTENSIONJS_REINJECT_GENERATION = (Number(__EXTENSIONJS_REINJECT_GENERATION) || 0) + 1;\n try { cleanup.__extjsGeneration = __EXTENSIONJS_REINJECT_GENERATION; cleanup.__extjsKey = __EXTENSIONJS_REINJECT_KEY; } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, __EXTENSIONJS_REINJECT_GENERATION, "mounted"); } catch (error) {}\n try { __EXTENSIONJS_scheduleBundleCssHydration(); } catch (error) {}\n } catch (error) {\n try { console.warn("Extension.js: the content script default export failed to run.", error); } catch (ignored) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "mount-error"); } catch (ignored) {}\n }\n }\n function unmount(){ try { cancelReady && cancelReady(); } catch (error) {} try { if (typeof cleanup === 'function') cleanup(); } catch (error) {} }\n cancelReady = __EXTENSIONJS_whenReady(runAt, apply);\n return unmount;\n}\n`;
182
173
  if (!hasDefaultExport(rewrittenSource, this.resourcePath, compilation)) {
183
174
  const prefix = `var __EXTJS_WRAPPER_KIND="FS3_INLINE";\n${bootstrap}${runtimeInline}`;
184
175
  const suffix = `try { __EXTENSIONJS_REINJECT_GENERATION = (Number(__EXTENSIONJS_REINJECT_GENERATION) || 0) + 1; } catch (error) {
@@ -191,8 +182,11 @@ function contentScriptWrapper(source, inputSourceMap) {
191
182
  // Ignore
192
183
  }\n`;
193
184
  const wrapped = `${prefix}${rewrittenSource}\n${suffix}`;
194
- if (inputSourceMap) return void this.callback(null, wrapped, shiftSourceMap(inputSourceMap, prefix));
195
- return wrapped;
185
+ return returnWithMap(this, wrapped, adjustLoaderSourceMap(inputOrIdentityMap(inputSourceMap, this.resourcePath, rewrittenSource), {
186
+ prefix,
187
+ before: rewrittenSource,
188
+ after: rewrittenSource
189
+ }));
196
190
  }
197
191
  const replaced = rewrittenSource.replace(/\bexport\s+default\b/, 'const __EXTENSIONJS_default__ =');
198
192
  let defaultName;
@@ -220,7 +214,10 @@ function contentScriptWrapper(source, inputSourceMap) {
220
214
  // Ignore
221
215
  }\nexport default __EXTENSIONJS_default__\n`;
222
216
  const wrappedResult = `${wrapPrefix}${cleaned}\n${wrapSuffix}`;
223
- if (inputSourceMap) return void this.callback(null, wrappedResult, shiftSourceMap(inputSourceMap, wrapPrefix));
224
- return wrappedResult;
217
+ return returnWithMap(this, wrappedResult, adjustLoaderSourceMap(inputOrIdentityMap(inputSourceMap, this.resourcePath, rewrittenSource), {
218
+ prefix: wrapPrefix,
219
+ before: replaced,
220
+ after: cleaned
221
+ }));
225
222
  }
226
223
  export default contentScriptWrapper;
@@ -8,6 +8,8 @@ import { stripBom } from "./23.mjs";
8
8
  import { canonicalizeDir, canonicalizeResourcePath } from "./93.mjs";
9
9
  import { findNearestProjectManifestSync } from "./80.mjs";
10
10
  import { getCanonicalContentScriptEntryName, CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX, getContentScriptCssProbeMarker } from "./291.mjs";
11
+ import { EXTENSION_ROOT_PLACEHOLDER } from "./372.mjs";
12
+ import { returnWithMap, adjustLoaderSourceMap, inputOrIdentityMap } from "./292.mjs";
11
13
  initSync();
12
14
  const schema = {
13
15
  type: 'object',
@@ -104,17 +106,6 @@ function readManifestCached(manifestPath) {
104
106
  return JSON.parse(stripBom(node_fs.readFileSync(manifestPath, 'utf-8')));
105
107
  }
106
108
  }
107
- function shiftSourceMap(map, prefix) {
108
- const mapObj = map;
109
- if (!mapObj || 'object' != typeof mapObj || 'string' != typeof mapObj.mappings) return map;
110
- const prefixLineCount = prefix.split('\n').length - 1;
111
- if (prefixLineCount <= 0) return map;
112
- const pad = new Array(prefixLineCount).fill('').join(';');
113
- return {
114
- ...mapObj,
115
- mappings: `${pad};${mapObj.mappings}`
116
- };
117
- }
118
109
  function contentScriptWrapper(source, inputSourceMap) {
119
110
  const options = this.getOptions();
120
111
  validate(schema, options, {
@@ -175,10 +166,10 @@ function contentScriptWrapper(source, inputSourceMap) {
175
166
  const cssProbeMarker = getContentScriptCssProbeMarker(bundleKey);
176
167
  const cssAssetSpecifiers = collectStyleAssetSpecifiers(rewrittenSource);
177
168
  const cssAssetUrlsInline = `var __EXTENSIONJS_BUNDLE_CSS_URLS=[${cssAssetSpecifiers.map((specifier)=>`(function(){ try { return String(new URL(${escapeCodeString(JSON.stringify(specifier))}, import.meta.url)); } catch (error) { return ""; } })()`).join(',')}];\n`;
178
- const bundleCssHydrationInline = `function __EXTENSIONJS_runtimeGetURL(path){\n try {\n if (typeof globalThis === "object" && globalThis && globalThis.browser && globalThis.browser.runtime && typeof globalThis.browser.runtime.getURL === "function") return globalThis.browser.runtime.getURL(path);\n if (typeof globalThis === "object" && globalThis && globalThis.chrome && globalThis.chrome.runtime && typeof globalThis.chrome.runtime.getURL === "function") return globalThis.chrome.runtime.getURL(path);\n } catch (error) {}\n try {\n var base = (typeof globalThis === "object" && globalThis && globalThis.__EXTJS_EXTENSION_BASE__) ? String(globalThis.__EXTJS_EXTENSION_BASE__) : "";\n if (!base && typeof document === "object" && document && document.documentElement) base = String(document.documentElement.getAttribute("data-extjs-extension-base") || "");\n if (!base) return "";\n return base.replace(/\\/+\$/, "/") + String(path || "").replace(/^\\/+/, "");\n } catch (error) {}\n return "";\n}\nvar __EXTENSIONJS_BUNDLE_CSS_PROBE=${JSON.stringify(cssProbeMarker)};\nfunction __EXTENSIONJS_bundleCssProbeUrls(){\n try {\n var probe = String(__EXTENSIONJS_BUNDLE_CSS_PROBE || "");\n if (!probe.length) return [];\n if (probe.lastIndexOf("__EXTENSIONJS_CSS_PROBE", 0) === 0) return [];\n var url = __EXTENSIONJS_runtimeGetURL(probe);\n if (typeof url !== "string" || !url.length) return [];\n if (url.charAt(url.length - 1) === "/") return [];\n return [url];\n } catch (error) { return []; }\n}\nfunction __EXTENSIONJS_scheduleBundleCssHydration(){\n try {\n if (String(__EXTENSIONJS_BUNDLE_KEY || "").indexOf(${JSON.stringify(CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX)}) !== 0) return;\n if (typeof document === "undefined" || typeof fetch !== "function") return;\n var cssUrls = Array.from(new Set((Array.isArray(__EXTENSIONJS_BUNDLE_CSS_URLS) ? __EXTENSIONJS_BUNDLE_CSS_URLS : []).concat(__EXTENSIONJS_bundleCssProbeUrls()).filter(function(value){ return typeof value === "string" && value.trim().length > 0; })));\n if (!cssUrls.length) return;\n var cssText = "";\n var cssPromise = null;\n var readCss = function(){\n if (cssPromise) return cssPromise;\n cssPromise = (function fetchCandidate(index){\n if (index >= cssUrls.length) return Promise.resolve("");\n return fetch(cssUrls[index]).then(function(response){\n if (!response || !response.ok) return "";\n return response.text();\n }).catch(function(){\n return "";\n }).then(function(text){\n if (typeof text === "string" && text.trim().length > 0) return text;\n return fetchCandidate(index + 1);\n });\n })(0).then(function(text){\n cssText = typeof text === "string" ? text : "";\n try { setTimeout(tick, 0); } catch (error) {}\n return cssText;\n }).catch(function(){ return ""; });\n return cssPromise;\n };\n var tries = 0;\n var tick = function(){\n try {\n var __extjsToken = __EXTENSIONJS_ownerToken();\n var hosts = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < hosts.length; i++) {\n var host = hosts[i];\n if (!host || !host.shadowRoot || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner && hostOwner !== __extjsToken) continue;\n if (!hostOwner && __EXTENSIONJS_NO_FOREIGN_ADOPT) continue;\n if (!hostOwner && __EXTENSIONJS_PRE_MOUNT_ROOTS.indexOf(host) !== -1) continue;\n if (!hostOwner && String(host.getAttribute("data-extjs-reinject-key") || "") && String(host.getAttribute("data-extjs-reinject-key") || "") !== String(__EXTENSIONJS_BUNDLE_KEY || "")) continue;\n var sr = host.shadowRoot;\n var styles = Array.from(sr.querySelectorAll("style"));\n var hasUserStyle = styles.some(function(styleEl){\n return styleEl && styleEl.getAttribute("data-extjs-bundle-css") !== "true" && String(styleEl.textContent || "").trim().length > 0;\n });\n var injected = null;\n for (var s = 0; s < styles.length; s++) {\n if (!styles[s] || styles[s].getAttribute("data-extjs-bundle-css") !== "true") continue;\n var styleOwner = String(styles[s].getAttribute("data-extjs-style-owner") || "");\n if (!styleOwner || styleOwner === __extjsToken) { injected = styles[s]; break; }\n }\n if (hasUserStyle) {\n if (injected && injected.parentNode) injected.parentNode.removeChild(injected);\n return;\n }\n if (typeof cssText === "string" && cssText.trim()) {\n if (!injected) {\n injected = document.createElement("style");\n injected.setAttribute("data-extjs-bundle-css", "true");\n injected.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n sr.insertBefore(injected, sr.firstChild || null);\n }\n injected.setAttribute("data-extjs-style-owner", __extjsToken);\n if (String(injected.textContent || "") !== cssText) injected.textContent = cssText;\n return;\n }\n }\n } catch (error) {}\n if (tries++ < 20) {\n if (!cssPromise) readCss();\n setTimeout(tick, 250);\n }\n };\n tick();\n } catch (error) {}\n}\n`;
169
+ const bundleCssHydrationInline = `function __EXTENSIONJS_runtimeGetURL(path){\n try {\n if (typeof globalThis === "object" && globalThis && globalThis.browser && globalThis.browser.runtime && typeof globalThis.browser.runtime.getURL === "function") return globalThis.browser.runtime.getURL(path);\n if (typeof globalThis === "object" && globalThis && globalThis.chrome && globalThis.chrome.runtime && typeof globalThis.chrome.runtime.getURL === "function") return globalThis.chrome.runtime.getURL(path);\n } catch (error) {}\n try {\n var base = (typeof globalThis === "object" && globalThis && globalThis.__EXTJS_EXTENSION_BASE__) ? String(globalThis.__EXTJS_EXTENSION_BASE__) : "";\n if (!base && typeof document === "object" && document && document.documentElement) base = String(document.documentElement.getAttribute("data-extjs-extension-base") || "");\n if (!base) return "";\n return base.replace(/\\/+\$/, "/") + String(path || "").replace(/^\\/+/, "");\n } catch (error) {}\n return "";\n}\nvar __EXTENSIONJS_BUNDLE_CSS_PROBE=${JSON.stringify(cssProbeMarker)};\nfunction __EXTENSIONJS_bundleCssProbeUrls(){\n try {\n var probe = String(__EXTENSIONJS_BUNDLE_CSS_PROBE || "");\n if (!probe.length) return [];\n if (probe.lastIndexOf("__EXTENSIONJS_CSS_PROBE", 0) === 0) return [];\n var url = __EXTENSIONJS_runtimeGetURL(probe);\n if (typeof url !== "string" || !url.length) return [];\n if (url.charAt(url.length - 1) === "/") return [];\n return [url];\n } catch (error) { return []; }\n}\nfunction __EXTENSIONJS_scheduleBundleCssHydration(){\n try {\n if (String(__EXTENSIONJS_BUNDLE_KEY || "").indexOf(${JSON.stringify(CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX)}) !== 0) return;\n if (typeof document === "undefined" || typeof fetch !== "function") return;\n var cssUrls = Array.from(new Set((Array.isArray(__EXTENSIONJS_BUNDLE_CSS_URLS) ? __EXTENSIONJS_BUNDLE_CSS_URLS : []).concat(__EXTENSIONJS_bundleCssProbeUrls()).filter(function(value){ return typeof value === "string" && value.trim().length > 0; })));\n if (!cssUrls.length) return;\n var cssText = "";\n var cssPromise = null;\n var readCss = function(){\n if (cssPromise) return cssPromise;\n cssPromise = (function fetchCandidate(index){\n if (index >= cssUrls.length) return Promise.resolve("");\n return fetch(cssUrls[index]).then(function(response){\n if (!response || !response.ok) return "";\n return response.text();\n }).catch(function(){\n return "";\n }).then(function(text){\n if (typeof text === "string" && text.trim().length > 0) return text;\n return fetchCandidate(index + 1);\n });\n })(0).then(function(text){\n cssText = typeof text === "string" ? text.split(${JSON.stringify(EXTENSION_ROOT_PLACEHOLDER)}).join(__EXTENSIONJS_runtimeGetURL("/")) : "";\n try { setTimeout(tick, 0); } catch (error) {}\n return cssText;\n }).catch(function(){ return ""; });\n return cssPromise;\n };\n var tries = 0;\n var tick = function(){\n try {\n var __extjsToken = __EXTENSIONJS_ownerToken();\n var hosts = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < hosts.length; i++) {\n var host = hosts[i];\n if (!host || !host.shadowRoot || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner && hostOwner !== __extjsToken) continue;\n if (!hostOwner && __EXTENSIONJS_NO_FOREIGN_ADOPT) continue;\n if (!hostOwner && __EXTENSIONJS_PRE_MOUNT_ROOTS.indexOf(host) !== -1) continue;\n if (!hostOwner && String(host.getAttribute("data-extjs-reinject-key") || "") && String(host.getAttribute("data-extjs-reinject-key") || "") !== String(__EXTENSIONJS_BUNDLE_KEY || "")) continue;\n var sr = host.shadowRoot;\n var styles = Array.from(sr.querySelectorAll("style"));\n var hasUserStyle = styles.some(function(styleEl){\n return styleEl && styleEl.getAttribute("data-extjs-bundle-css") !== "true" && String(styleEl.textContent || "").trim().length > 0;\n });\n var injected = null;\n for (var s = 0; s < styles.length; s++) {\n if (!styles[s] || styles[s].getAttribute("data-extjs-bundle-css") !== "true") continue;\n var styleOwner = String(styles[s].getAttribute("data-extjs-style-owner") || "");\n if (!styleOwner || styleOwner === __extjsToken) { injected = styles[s]; break; }\n }\n if (hasUserStyle) {\n if (injected && injected.parentNode) injected.parentNode.removeChild(injected);\n return;\n }\n if (typeof cssText === "string" && cssText.trim()) {\n if (!injected) {\n injected = document.createElement("style");\n injected.setAttribute("data-extjs-bundle-css", "true");\n injected.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n sr.insertBefore(injected, sr.firstChild || null);\n }\n injected.setAttribute("data-extjs-style-owner", __extjsToken);\n if (String(injected.textContent || "") !== cssText) injected.textContent = cssText;\n return;\n }\n }\n } catch (error) {}\n if (tries++ < 20) {\n if (!cssPromise) readCss();\n setTimeout(tick, 250);\n }\n };\n tick();\n } catch (error) {}\n}\n`;
179
170
  const isBuiltInCompanion = /extension-js-(?:devtools|theme)/.test(String(packageJsonDir || ''));
180
171
  const bootstrap = `var __EXTENSIONJS_BUNDLE_KEY=${JSON.stringify(bundleKey)};\nvar __EXTENSIONJS_REINJECT_KEY=${JSON.stringify(reinjectKey)};\nvar __EXTENSIONJS_REINJECT_BUILD_TOKEN=${JSON.stringify(buildToken)};\nvar __EXTENSIONJS_NO_FOREIGN_ADOPT=${JSON.stringify(isBuiltInCompanion)};\nfunction __EXTENSIONJS_ownerToken(){\n var extId = "";\n try {\n var rt = (typeof globalThis === "object" && globalThis && ((globalThis.browser && globalThis.browser.runtime) || (globalThis.chrome && globalThis.chrome.runtime))) || null;\n if (rt && rt.id) extId = String(rt.id);\n } catch (error) {}\n return String(__EXTENSIONJS_REINJECT_KEY || "") + (extId ? "@" + extId : "");\n}\nvar __EXTENSIONJS_DEV_MARKERS_ENABLED=${JSON.stringify(!isProd)};\nvar __EXTENSIONJS_PRE_MOUNT_ROOTS = [];\nfunction __EXTENSIONJS_snapshotPreMountRoots(){\n try {\n if (typeof document === "undefined" || typeof document.querySelectorAll !== "function") return;\n __EXTENSIONJS_PRE_MOUNT_ROOTS = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]"));\n } catch (error) { __EXTENSIONJS_PRE_MOUNT_ROOTS = []; }\n}\n__EXTENSIONJS_snapshotPreMountRoots();\n${cssAssetUrlsInline}var __EXTENSIONJS_REINJECT_REGISTRY=(typeof globalThis==="object" && globalThis ? (globalThis.__EXTENSIONJS_DEV_REINJECT__ || (globalThis.__EXTENSIONJS_DEV_REINJECT__={})) : {});\nvar __EXTENSIONJS_REGISTERED_CLEANUPS=[];\nfunction __EXTENSIONJS_readReinjectGeneration(entry){\n try {\n if (!entry) return 0;\n if (typeof entry === "function" && typeof entry.__extjsGeneration === "number") return entry.__extjsGeneration;\n if (typeof entry === "object") {\n if (typeof entry.__extjsGeneration === "number") return entry.__extjsGeneration;\n if (typeof entry.generation === "number") return entry.generation;\n if (typeof entry.cleanup === "function" && typeof entry.cleanup.__extjsGeneration === "number") return entry.cleanup.__extjsGeneration;\n }\n } catch (error) {}\n return 0;\n}\nfunction __EXTENSIONJS_runCleanups(list){\n try {\n if (!Array.isArray(list)) return;\n for (var i = list.length - 1; i >= 0; i--) {\n try { if (typeof list[i] === "function") list[i](); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_registerCleanup(fn){\n if (typeof fn === "function") __EXTENSIONJS_REGISTERED_CLEANUPS.push(fn);\n return fn;\n}\nfunction __EXTENSIONJS_setReinjectMarker(key, generation, status){\n try {\n if (!__EXTENSIONJS_DEV_MARKERS_ENABLED || typeof document === "undefined") return;\n var root = document.body || document.documentElement;\n if (!root) return;\n var __extjsToken = __EXTENSIONJS_ownerToken();\n var marker = null;\n try {\n var markers = Array.from(document.querySelectorAll("[data-extjs-reinject-marker=\\"true\\"]"));\n for (var i = 0; i < markers.length; i++) {\n var current = markers[i];\n if (!current || typeof current.getAttribute !== "function") continue;\n var currentOwner = String(current.getAttribute("data-extjs-marker-owner") || "");\n if (currentOwner === __extjsToken) { marker = current; break; }\n if (!currentOwner && current.getAttribute("data-extjs-reinject-key") === key) { marker = current; break; }\n }\n } catch (error) {}\n if (!marker && typeof document.createElement === "function") {\n marker = document.createElement("div");\n marker.setAttribute("data-extjs-reinject-marker", "true");\n marker.setAttribute("hidden", "");\n marker.setAttribute("aria-hidden", "true");\n try { marker.style.display = "none"; } catch (error) {}\n root.appendChild(marker);\n }\n if (!marker) return;\n marker.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n marker.setAttribute("data-extjs-marker-owner", __extjsToken);\n marker.setAttribute("data-extjs-reinject-generation", String(generation));\n marker.setAttribute("data-extjs-reinject-status", String(status || "mounted"));\n marker.setAttribute("data-extjs-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n try { marker.textContent = String(__EXTENSIONJS_BUNDLE_KEY || key || "") + ":" + String(generation) + ":" + String(status || "mounted"); } catch (error) {}\n try {\n var roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n var ownedRootCount = 0;\n for (var j = 0; j < roots.length; j++) {\n var host = roots[j];\n if (!host || typeof host.setAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner && hostOwner !== __extjsToken) continue;\n if (!hostOwner && __EXTENSIONJS_NO_FOREIGN_ADOPT) continue;\n if (!hostOwner && __EXTENSIONJS_PRE_MOUNT_ROOTS.indexOf(host) !== -1) continue;\n ownedRootCount++;\n host.setAttribute("data-extjs-reinject-owner", __extjsToken);\n host.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n host.setAttribute("data-extjs-reinject-generation", String(generation));\n host.setAttribute("data-extjs-reinject-status", String(status || "mounted"));\n host.setAttribute("data-extjs-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n try {\n if (!host.__extjsDebugRemovePatched) {\n host.__extjsDebugRemovePatched = true;\n var __extjsOriginalRemove = typeof host.remove === "function" ? host.remove.bind(host) : null;\n if (__extjsOriginalRemove) {\n host.remove = function(){\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-debug-stage", "root-remove-called");\n pageRoot.setAttribute("data-extjs-debug-last-removal", "remove()");\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", "patched-host-remove");\n }\n } catch (error) {}\n return __extjsOriginalRemove();\n };\n }\n }\n } catch (error) {}\n }\n try {\n marker.setAttribute("data-extjs-debug-stage", String(status || ""));\n marker.setAttribute("data-extjs-debug-root-count", String(roots.length));\n marker.setAttribute("data-extjs-debug-owned-root-count", String(ownedRootCount));\n marker.setAttribute("data-extjs-debug-marker-count", String(markers.length));\n } catch (error) {}\n } catch (error) {}\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-last-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n pageRoot.setAttribute("data-extjs-last-reinject-generation", String(generation));\n pageRoot.setAttribute("data-extjs-last-reinject-status", String(status || "mounted"));\n pageRoot.setAttribute("data-extjs-last-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n pageRoot.setAttribute("data-extjs-debug-stage", marker.getAttribute("data-extjs-debug-stage") || String(status || ""));\n pageRoot.setAttribute("data-extjs-debug-root-count", marker.getAttribute("data-extjs-debug-root-count") || "0");\n pageRoot.setAttribute("data-extjs-debug-owned-root-count", marker.getAttribute("data-extjs-debug-owned-root-count") || "0");\n pageRoot.setAttribute("data-extjs-debug-marker-count", marker.getAttribute("data-extjs-debug-marker-count") || "0");\n }\n } catch (error) {}\n } catch (error) {}\n}\nfunction __EXTENSIONJS_debugObserveOwnedRootRemoval(){\n try {\n if (!__EXTENSIONJS_DEV_MARKERS_ENABLED) return;\n if (typeof globalThis !== "object" || !globalThis || globalThis.__EXTJS_DEBUG_REMOVAL_OBSERVER__) return;\n if (typeof MutationObserver !== "function" || typeof document === "undefined") return;\n var target = document.documentElement || document.body || document;\n if (!target) return;\n var observer = new MutationObserver(function(records){\n try {\n var ownedKey = __EXTENSIONJS_ownerToken();\n var findOwnedRoot = function(node){\n try {\n if (!node || node.nodeType !== 1) return null;\n if (typeof node.getAttribute === "function" && String(node.getAttribute("data-extjs-reinject-owner") || "") === ownedKey) return node;\n if (typeof node.querySelector === "function") {\n return node.querySelector("[data-extjs-reinject-owner=\\"" + ownedKey.replace(/"/g, "\\\\\\"") + "\\"]");\n }\n } catch (error) {}\n return null;\n };\n for (var r = 0; r < records.length; r++) {\n var removedNodes = Array.from(records[r].removedNodes || []);\n for (var n = 0; n < removedNodes.length; n++) {\n var node = removedNodes[n];\n var ownedRoot = findOwnedRoot(node);\n if (!ownedRoot || typeof ownedRoot.getAttribute !== "function") continue;\n var owner = String(ownedRoot.getAttribute("data-extjs-reinject-owner") || "");\n if (!owner || owner !== ownedKey) continue;\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal")) pageRoot.setAttribute("data-extjs-debug-last-removal", "mutation-observer");\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-key")) pageRoot.setAttribute("data-extjs-debug-last-removal-key", owner);\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-source")) pageRoot.setAttribute("data-extjs-debug-last-removal-source", "mutation-observer");\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-tag")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(node.tagName || "").toLowerCase());\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-id")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-id", String(node.id || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-class")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-class", String(node.className || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-direct")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-direct", String(node === ownedRoot));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-ready-state")) pageRoot.setAttribute("data-extjs-debug-last-removal-ready-state", String(document.readyState || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-url")) pageRoot.setAttribute("data-extjs-debug-last-removal-url", String(location.href || ""));\n pageRoot.setAttribute("data-extjs-debug-stage", "root-removed-observed");\n }\n return;\n }\n }\n } catch (error) {}\n });\n observer.observe(target, { childList: true, subtree: true });\n globalThis.__EXTJS_DEBUG_REMOVAL_OBSERVER__ = observer;\n } catch (error) {}\n}\nfunction __EXTENSIONJS_cleanupKnownRoots(staleEvenIfSameBuild){\n try {\n if (typeof document === "undefined" || typeof document.querySelectorAll !== "function") return;\n var __extjsToken = __EXTENSIONJS_ownerToken();\n var roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < roots.length; i++) {\n var host = roots[i];\n if (!host || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (!hostOwner || hostOwner !== __extjsToken) continue;\n // Build-aware: only remove hosts owned by us whose build token does NOT\n // match the current bundle. Fresh roots from the current mount carry\n // the active build token and must be preserved; orphans from a prior\n // build (e.g. the old isolated world after \`chrome.runtime.reload\`)\n // carry stale tokens and should be cleared so we never end up with two\n // hosts owned by the same key.\n // EXCEPT when this bundle starts in a FRESH world (no registry entry,\n // because the old isolated world was destroyed by \`chrome.runtime.reload\`):\n // a same-build root then predates this execution and is a stale zombie\n // (its scripts died with the world). Unedited sibling scripts in a\n // multi-script entry keep their build token across recompiles, so the\n // token equality alone must not protect them here.\n var hostBuild = String(host.getAttribute("data-extjs-reinject-build") || "");\n var currentBuild = String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || "");\n if (!staleEvenIfSameBuild && hostBuild && currentBuild && hostBuild === currentBuild) continue;\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-debug-stage", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removal", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(host.tagName || "").toLowerCase());\n }\n } catch (error) {}\n try { host.remove(); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_cleanupOrphanRoots(){\n try {\n // At bundle execution start, before this run has mounted anything, any\n // \`data-extension-root\` host without \`data-extjs-reinject-owner\` is an\n // orphan from a prior session that died before \`setReinjectMarker\`\n // could tag it (typically: the previous isolated world was destroyed\n // by a \`chrome.runtime.reload\` mid-mount, or its \`whenReady\`-deferred\n // \`apply\` never fired). We have not created our own root yet, so any\n // untagged host we touch here is by definition not from THIS run, but\n // it may belong to a DIFFERENT extension mid-mount in the same DOM.\n // Companion extensions never sweep, and everyone else sweeps only when\n // a reinject marker proves a prior generation of THIS script ran here.\n if (typeof document === "undefined" || typeof document.querySelectorAll !== "function") return;\n if (__EXTENSIONJS_NO_FOREIGN_ADOPT) return;\n var __extjsToken = __EXTENSIONJS_ownerToken();\n var sawPriorGeneration = false;\n try {\n var markers = Array.from(document.querySelectorAll("[data-extjs-reinject-marker=\\"true\\"]"));\n for (var m = 0; m < markers.length; m++) {\n if (markers[m] && typeof markers[m].getAttribute === "function" && String(markers[m].getAttribute("data-extjs-marker-owner") || "") === __extjsToken) { sawPriorGeneration = true; break; }\n }\n } catch (error) {}\n if (!sawPriorGeneration) return;\n var roots = Array.from(document.querySelectorAll("[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < roots.length; i++) {\n var host = roots[i];\n if (!host || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner) continue;\n try { host.remove(); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_composeCleanup(primaryCleanup){\n return function(){\n try { if (typeof primaryCleanup === "function") primaryCleanup(); } catch (error) {}\n try { __EXTENSIONJS_runCleanups(__EXTENSIONJS_REGISTERED_CLEANUPS); } catch (error) {}\n try { __EXTENSIONJS_cleanupKnownRoots(); } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "cleaned"); } catch (error) {}\n };\n}\nfunction __EXTENSIONJS_recordExecutionSnapshot(stage){\n try {\n if (!__EXTENSIONJS_DEV_MARKERS_ENABLED) return;\n if (typeof document === "undefined") return;\n var pageRoot = document.documentElement;\n if (!pageRoot || typeof pageRoot.getAttribute !== "function" || typeof pageRoot.setAttribute !== "function") return;\n var currentCount = Number(pageRoot.getAttribute("data-extjs-debug-execution-count") || "0");\n var nextCount = Number.isFinite(currentCount) ? currentCount + 1 : 1;\n var roots = [];\n try { roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])")); } catch (error) {}\n pageRoot.setAttribute("data-extjs-debug-execution-count", String(nextCount));\n pageRoot.setAttribute("data-extjs-debug-last-execution-stage", String(stage || ""));\n pageRoot.setAttribute("data-extjs-debug-last-execution-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-existing-root-count-before-cleanup", String(roots.length));\n } catch (error) {}\n}\nfunction __EXTENSIONJS_patchDomRemovalApis(){\n try {\n if (!__EXTENSIONJS_DEV_MARKERS_ENABLED) return;\n if (typeof globalThis !== "object" || !globalThis || globalThis.__EXTJS_DEBUG_DOM_APIS_PATCHED__) return;\n var record = function(source, node, parent){\n try {\n var pageRoot = document.documentElement;\n if (!pageRoot || typeof pageRoot.setAttribute !== "function") return;\n var ownedRoot = null;\n if (node && node.nodeType === 1) {\n if (typeof node.getAttribute === "function" && String(node.getAttribute("data-extjs-reinject-owner") || "") === __EXTENSIONJS_ownerToken()) ownedRoot = node;\n else if (typeof node.querySelector === "function") ownedRoot = node.querySelector("[data-extjs-reinject-owner=\\"" + __EXTENSIONJS_ownerToken().replace(/"/g, "\\\\\\"") + "\\"]");\n }\n if (!ownedRoot) return;\n pageRoot.setAttribute("data-extjs-debug-stage", "dom-api-removal");\n pageRoot.setAttribute("data-extjs-debug-last-removal", source);\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", source);\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(node && node.tagName || "").toLowerCase());\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-id", String(node && node.id || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-class", String(node && node.className || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-direct", String(node === ownedRoot));\n pageRoot.setAttribute("data-extjs-debug-last-removal-ready-state", String(document.readyState || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-url", String(location.href || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-parent-tag", String(parent && parent.tagName || "").toLowerCase());\n } catch (error) {}\n };\n try {\n var originalRemoveChild = Node.prototype.removeChild;\n if (typeof originalRemoveChild === "function") {\n Node.prototype.removeChild = function(child){\n record("Node.removeChild", child, this);\n return originalRemoveChild.call(this, child);\n };\n }\n } catch (error) {}\n try {\n var originalReplaceChildren = Element.prototype.replaceChildren;\n if (typeof originalReplaceChildren === "function") {\n Element.prototype.replaceChildren = function(){\n try {\n var existing = Array.from(this.childNodes || []);\n for (var i = 0; i < existing.length; i++) record("Element.replaceChildren", existing[i], this);\n } catch (error) {}\n return originalReplaceChildren.apply(this, arguments);\n };\n }\n } catch (error) {}\n globalThis.__EXTJS_DEBUG_DOM_APIS_PATCHED__ = true;\n } catch (error) {}\n}\ntry {\n if (typeof globalThis === "object" && globalThis) {\n globalThis.__EXTENSIONJS_registerCleanup = __EXTENSIONJS_registerCleanup;\n globalThis.registerCleanup = __EXTENSIONJS_registerCleanup;\n }\n} catch (error) {}\n// Dev-only DOM instrumentation. Gated so production content scripts never\n// install a whole-document MutationObserver, monkey-patch Node.prototype\n// removal APIs, or write data-extjs-debug-* attributes onto the host page.\nif (__EXTENSIONJS_DEV_MARKERS_ENABLED) {\n try { __EXTENSIONJS_debugObserveOwnedRootRemoval(); } catch (error) {}\n try { __EXTENSIONJS_patchDomRemovalApis(); } catch (error) {}\n try { __EXTENSIONJS_recordExecutionSnapshot("bootstrap"); } catch (error) {}\n}\nvar __EXTENSIONJS_previousEntry=__EXTENSIONJS_REINJECT_REGISTRY[__EXTENSIONJS_REINJECT_KEY];\nvar __EXTENSIONJS_REINJECT_GENERATION=__EXTENSIONJS_readReinjectGeneration(__EXTENSIONJS_previousEntry);\n// Sweep untagged orphans (prior-session roots that died before tagging)\n// before any further cleanup runs. Safe here because our mount has not\n// produced any roots yet, any untagged host is by definition not ours.\ntry { __EXTENSIONJS_cleanupOrphanRoots(); } catch (error) {}\ntry {\n var __EXTENSIONJS_previousCleanup=typeof __EXTENSIONJS_previousEntry === "function" ? __EXTENSIONJS_previousEntry : (__EXTENSIONJS_previousEntry && typeof __EXTENSIONJS_previousEntry.cleanup === "function" ? __EXTENSIONJS_previousEntry.cleanup : null);\n if (typeof __EXTENSIONJS_previousCleanup === "function") {\n if (__EXTENSIONJS_DEV_MARKERS_ENABLED) {\n try {\n var __extjsPageRoot = document.documentElement;\n if (__extjsPageRoot && typeof __extjsPageRoot.setAttribute === "function") {\n __extjsPageRoot.setAttribute("data-extjs-debug-stage", "previous-cleanup");\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal", "previous-cleanup");\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal-source", "previous-cleanup");\n }\n } catch (error) {}\n }\n __EXTENSIONJS_previousCleanup();\n }\n} catch (error) {}\ntry { __EXTENSIONJS_cleanupKnownRoots(!__EXTENSIONJS_previousEntry); } catch (error) {}\nfunction __EXTENSIONJS_syncAssetBase(){\n try {\n var base = "";\n try {\n if (typeof globalThis === "object" && globalThis && globalThis.browser && globalThis.browser.runtime && typeof globalThis.browser.runtime.getURL === "function") base = String(globalThis.browser.runtime.getURL("/"));\n else if (typeof globalThis === "object" && globalThis && globalThis.chrome && globalThis.chrome.runtime && typeof globalThis.chrome.runtime.getURL === "function") base = String(globalThis.chrome.runtime.getURL("/"));\n } catch (error) {}\n if (!base) {\n try {\n if (typeof document === "object" && document && document.documentElement) base = String(document.documentElement.getAttribute("data-extjs-extension-base") || "");\n } catch (error) {}\n }\n if (!base) return false;\n if (base.charAt(base.length - 1) !== "/") base += "/";\n if (typeof __webpack_require__ === "function" || typeof __webpack_require__ === "object") {\n try { __webpack_require__.p = base; } catch (error) {}\n try { __webpack_require__.b = base; } catch (error) {}\n }\n return true;\n } catch (error) {}\n return false;\n}\ntry {\n if (!__EXTENSIONJS_syncAssetBase()) {\n var __EXTENSIONJS_assetBaseRetries = 0;\n var __EXTENSIONJS_retryAssetBase = function(){\n try {\n if (__EXTENSIONJS_syncAssetBase()) return;\n } catch (error) {}\n if (__EXTENSIONJS_assetBaseRetries++ < 50) setTimeout(__EXTENSIONJS_retryAssetBase, 100);\n };\n __EXTENSIONJS_retryAssetBase();\n }\n} catch (error) {}\n`;
181
- const runtimeInline = `function __EXTENSIONJS_whenReady(runAt, cb){\n try {\n if (typeof document === 'undefined') { cb(); return function(){} }\n if (runAt === 'document_start') { cb(); return function(){} }\n var isDone = false;\n function isReady(){\n if (runAt === 'document_end') return document.readyState === 'interactive' || document.readyState === 'complete';\n if (runAt === 'document_idle') return document.readyState === 'complete';\n return document.readyState === 'complete';\n }\n if (isReady()) { cb(); return function(){} }\n var onReady = function(){\n try {\n if (isDone) return;\n if (isReady()) { isDone = true; document.removeEventListener('readystatechange', onReady); cb(); }\n } catch (error) {}\n };\n document.addEventListener('readystatechange', onReady);\n return function(){ try { if (!isDone) document.removeEventListener('readystatechange', onReady); } catch (error) {} };\n } catch (error) { try { cb(); } catch (ignored) {} return function(){} }\n}\n${bundleCssHydrationInline}function __EXTENSIONJS_mount(mount, runAt){\n var cleanup = function(){};\n var cancelReady = function(){};\n if (typeof mount !== "function") {\n try { __EXTENSIONJS_REINJECT_GENERATION = (Number(__EXTENSIONJS_REINJECT_GENERATION) || 0) + 1; } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "executed"); } catch (error) {}\n try { __EXTENSIONJS_scheduleBundleCssHydration(); } catch (error) {}\n return __EXTENSIONJS_composeCleanup(null);\n }\n function apply(){\n try {\n __EXTENSIONJS_snapshotPreMountRoots();\n var nextCleanup = mount();\n cleanup = __EXTENSIONJS_composeCleanup(nextCleanup);\n __EXTENSIONJS_REINJECT_GENERATION = (Number(__EXTENSIONJS_REINJECT_GENERATION) || 0) + 1;\n try { cleanup.__extjsGeneration = __EXTENSIONJS_REINJECT_GENERATION; cleanup.__extjsKey = __EXTENSIONJS_REINJECT_KEY; } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, __EXTENSIONJS_REINJECT_GENERATION, "mounted"); } catch (error) {}\n try { __EXTENSIONJS_scheduleBundleCssHydration(); } catch (error) {}\n } catch (error) {\n try { console.warn("[extension.js] content script default export failed to run", error); } catch (ignored) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "mount-error"); } catch (ignored) {}\n }\n }\n function unmount(){ try { cancelReady && cancelReady(); } catch (error) {} try { if (typeof cleanup === 'function') cleanup(); } catch (error) {} }\n cancelReady = __EXTENSIONJS_whenReady(runAt, apply);\n return unmount;\n}\n`;
172
+ const runtimeInline = `function __EXTENSIONJS_whenReady(runAt, cb){\n try {\n if (typeof document === 'undefined') { cb(); return function(){} }\n if (runAt === 'document_start') { cb(); return function(){} }\n var isDone = false;\n function isReady(){\n if (runAt === 'document_end') return document.readyState === 'interactive' || document.readyState === 'complete';\n if (runAt === 'document_idle') return document.readyState === 'complete';\n return document.readyState === 'complete';\n }\n if (isReady()) { cb(); return function(){} }\n var onReady = function(){\n try {\n if (isDone) return;\n if (isReady()) { isDone = true; document.removeEventListener('readystatechange', onReady); cb(); }\n } catch (error) {}\n };\n document.addEventListener('readystatechange', onReady);\n return function(){ try { if (!isDone) document.removeEventListener('readystatechange', onReady); } catch (error) {} };\n } catch (error) { try { cb(); } catch (ignored) {} return function(){} }\n}\n${bundleCssHydrationInline}function __EXTENSIONJS_mount(mount, runAt){\n var cleanup = function(){};\n var cancelReady = function(){};\n if (typeof mount !== "function") {\n try { __EXTENSIONJS_REINJECT_GENERATION = (Number(__EXTENSIONJS_REINJECT_GENERATION) || 0) + 1; } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "executed"); } catch (error) {}\n try { __EXTENSIONJS_scheduleBundleCssHydration(); } catch (error) {}\n return __EXTENSIONJS_composeCleanup(null);\n }\n function apply(){\n try {\n __EXTENSIONJS_snapshotPreMountRoots();\n var nextCleanup = mount();\n cleanup = __EXTENSIONJS_composeCleanup(nextCleanup);\n __EXTENSIONJS_REINJECT_GENERATION = (Number(__EXTENSIONJS_REINJECT_GENERATION) || 0) + 1;\n try { cleanup.__extjsGeneration = __EXTENSIONJS_REINJECT_GENERATION; cleanup.__extjsKey = __EXTENSIONJS_REINJECT_KEY; } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, __EXTENSIONJS_REINJECT_GENERATION, "mounted"); } catch (error) {}\n try { __EXTENSIONJS_scheduleBundleCssHydration(); } catch (error) {}\n } catch (error) {\n try { console.warn("Extension.js: the content script default export failed to run.", error); } catch (ignored) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "mount-error"); } catch (ignored) {}\n }\n }\n function unmount(){ try { cancelReady && cancelReady(); } catch (error) {} try { if (typeof cleanup === 'function') cleanup(); } catch (error) {} }\n cancelReady = __EXTENSIONJS_whenReady(runAt, apply);\n return unmount;\n}\n`;
182
173
  if (!hasDefaultExport(rewrittenSource, this.resourcePath, compilation)) {
183
174
  const prefix = `var __EXTJS_WRAPPER_KIND="FS3_INLINE";\n${bootstrap}${runtimeInline}`;
184
175
  const suffix = `try { __EXTENSIONJS_REINJECT_GENERATION = (Number(__EXTENSIONJS_REINJECT_GENERATION) || 0) + 1; } catch (error) {
@@ -191,8 +182,11 @@ function contentScriptWrapper(source, inputSourceMap) {
191
182
  // Ignore
192
183
  }\n`;
193
184
  const wrapped = `${prefix}${rewrittenSource}\n${suffix}`;
194
- if (inputSourceMap) return void this.callback(null, wrapped, shiftSourceMap(inputSourceMap, prefix));
195
- return wrapped;
185
+ return returnWithMap(this, wrapped, adjustLoaderSourceMap(inputOrIdentityMap(inputSourceMap, this.resourcePath, rewrittenSource), {
186
+ prefix,
187
+ before: rewrittenSource,
188
+ after: rewrittenSource
189
+ }));
196
190
  }
197
191
  const replaced = rewrittenSource.replace(/\bexport\s+default\b/, 'const __EXTENSIONJS_default__ =');
198
192
  let defaultName;
@@ -220,7 +214,10 @@ function contentScriptWrapper(source, inputSourceMap) {
220
214
  // Ignore
221
215
  }\nexport default __EXTENSIONJS_default__\n`;
222
216
  const wrappedResult = `${wrapPrefix}${cleaned}\n${wrapSuffix}`;
223
- if (inputSourceMap) return void this.callback(null, wrappedResult, shiftSourceMap(inputSourceMap, wrapPrefix));
224
- return wrappedResult;
217
+ return returnWithMap(this, wrappedResult, adjustLoaderSourceMap(inputOrIdentityMap(inputSourceMap, this.resourcePath, rewrittenSource), {
218
+ prefix: wrapPrefix,
219
+ before: replaced,
220
+ after: cleaned
221
+ }));
225
222
  }
226
223
  export default contentScriptWrapper;
@@ -1,4 +1,5 @@
1
1
  import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
2
+ import { inputOrIdentityMap } from "./292.mjs";
2
3
  const GETURL_ARG = /\bruntime\s*\.\s*getURL\s*\(/;
3
4
  const BARE_IDENTIFIER = /^[A-Za-z_$][\w$]*$/;
4
5
  const MEMBER_PATH = /^[A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*)+$/;
@@ -126,9 +127,15 @@ function annotateGetURLDynamicImports(source) {
126
127
  }
127
128
  return out + source.slice(last);
128
129
  }
129
- function nativeGetURLImportLoader(source) {
130
- if (!source.includes('import') || !/runtime\s*\.\s*getURL/.test(source)) return source;
131
- return annotateGetURLDynamicImports(source);
130
+ function nativeGetURLImportLoader(source, inputSourceMap) {
131
+ const untouched = !source.includes('import') || !/runtime\s*\.\s*getURL/.test(source);
132
+ const out = untouched ? source : annotateGetURLDynamicImports(source);
133
+ if ('function' == typeof this?.callback) {
134
+ const map = untouched ? inputSourceMap : inputOrIdentityMap(inputSourceMap, String(this.resourcePath || ''), source);
135
+ this.callback(null, out, map);
136
+ return;
137
+ }
138
+ return out;
132
139
  }
133
140
  function readBalancedArgs(code, openIndex) {
134
141
  if ('(' !== code[openIndex]) return null;
@@ -0,0 +1,7 @@
1
+ import type { Compilation } from '@rspack/core';
2
+ export declare function prependToEmittedAsset(compilation: Pick<Compilation, 'updateAsset'> & Partial<Pick<Compilation, 'getAsset'>>, asset: {
3
+ name: string;
4
+ source: {
5
+ source(): string | Buffer;
6
+ };
7
+ }, prefix: string): void;