oidc-spa 8.6.12 → 8.6.14

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 (433) hide show
  1. package/core/createOidc.js +1 -1
  2. package/core/tokenExfiltrationDefense.js +4 -0
  3. package/core/tokenExfiltrationDefense.js.map +1 -1
  4. package/esm/angular.d.ts +4 -4
  5. package/esm/{angular.js → angular.mjs} +19 -14
  6. package/esm/angular.mjs.map +1 -0
  7. package/esm/backend.d.ts +1 -1
  8. package/esm/{backend.js → backend.mjs} +5 -5
  9. package/esm/backend.mjs.map +1 -0
  10. package/esm/core/{AuthResponse.js → AuthResponse.mjs} +2 -2
  11. package/esm/core/AuthResponse.mjs.map +1 -0
  12. package/esm/core/{BASE_URL.js → BASE_URL.mjs} +1 -1
  13. package/esm/core/BASE_URL.mjs.map +1 -0
  14. package/esm/core/Oidc.d.ts +1 -1
  15. package/esm/core/Oidc.mjs +2 -0
  16. package/esm/core/Oidc.mjs.map +1 -0
  17. package/esm/core/{OidcInitializationError.js → OidcInitializationError.mjs} +1 -1
  18. package/esm/core/OidcInitializationError.mjs.map +1 -0
  19. package/esm/core/OidcMetadata.d.ts +1 -1
  20. package/esm/core/{OidcMetadata.js → OidcMetadata.mjs} +3 -3
  21. package/esm/core/OidcMetadata.mjs.map +1 -0
  22. package/esm/core/{StateData.js → StateData.mjs} +4 -4
  23. package/esm/core/StateData.mjs.map +1 -0
  24. package/esm/core/{StateDataCookie.js → StateDataCookie.mjs} +3 -3
  25. package/esm/core/StateDataCookie.mjs.map +1 -0
  26. package/esm/core/{configId.js → configId.mjs} +1 -1
  27. package/esm/core/configId.mjs.map +1 -0
  28. package/esm/core/createOidc.d.ts +2 -2
  29. package/esm/core/{createOidc.js → createOidc.mjs} +46 -46
  30. package/esm/core/createOidc.mjs.map +1 -0
  31. package/esm/core/{desiredPostLoginRedirectUrl.js → desiredPostLoginRedirectUrl.mjs} +1 -1
  32. package/esm/core/desiredPostLoginRedirectUrl.mjs.map +1 -0
  33. package/esm/core/diagnostic.d.ts +1 -1
  34. package/esm/core/{diagnostic.js → diagnostic.mjs} +7 -7
  35. package/esm/core/diagnostic.mjs.map +1 -0
  36. package/esm/core/earlyInit.d.ts +3 -3
  37. package/esm/core/{earlyInit.js → earlyInit.mjs} +9 -9
  38. package/esm/core/earlyInit.mjs.map +1 -0
  39. package/esm/core/evtIsUserActive.d.ts +1 -1
  40. package/esm/core/{evtIsUserActive.js → evtIsUserActive.mjs} +5 -5
  41. package/esm/core/evtIsUserActive.mjs.map +1 -0
  42. package/esm/core/{homeAndRedirectUri.js → homeAndRedirectUri.mjs} +3 -3
  43. package/esm/core/homeAndRedirectUri.mjs.map +1 -0
  44. package/esm/core/index.d.ts +3 -3
  45. package/esm/core/index.mjs +3 -0
  46. package/esm/core/index.mjs.map +1 -0
  47. package/esm/core/instancesThatCantUseIframes.d.ts +1 -1
  48. package/esm/core/{instancesThatCantUseIframes.js → instancesThatCantUseIframes.mjs} +2 -2
  49. package/esm/core/instancesThatCantUseIframes.mjs.map +1 -0
  50. package/esm/core/isNewBrowserSession.d.ts +1 -1
  51. package/esm/core/{isNewBrowserSession.js → isNewBrowserSession.mjs} +1 -1
  52. package/esm/core/isNewBrowserSession.mjs.map +1 -0
  53. package/esm/core/loginOrGoToAuthServer.d.ts +2 -2
  54. package/esm/core/{loginOrGoToAuthServer.js → loginOrGoToAuthServer.mjs} +9 -9
  55. package/esm/core/loginOrGoToAuthServer.mjs.map +1 -0
  56. package/esm/core/{loginPropagationToOtherTabs.js → loginPropagationToOtherTabs.mjs} +3 -3
  57. package/esm/core/loginPropagationToOtherTabs.mjs.map +1 -0
  58. package/esm/core/loginSilent.d.ts +2 -2
  59. package/esm/core/{loginSilent.js → loginSilent.mjs} +11 -11
  60. package/esm/core/loginSilent.mjs.map +1 -0
  61. package/esm/core/{logoutPropagationToOtherTabs.js → logoutPropagationToOtherTabs.mjs} +3 -3
  62. package/esm/core/logoutPropagationToOtherTabs.mjs.map +1 -0
  63. package/esm/core/oidcClientTsUserToTokens.d.ts +2 -2
  64. package/esm/core/{oidcClientTsUserToTokens.js → oidcClientTsUserToTokens.mjs} +7 -7
  65. package/esm/core/oidcClientTsUserToTokens.mjs.map +1 -0
  66. package/esm/core/{ongoingLoginOrRefreshProcesses.js → ongoingLoginOrRefreshProcesses.mjs} +4 -4
  67. package/esm/core/ongoingLoginOrRefreshProcesses.mjs.map +1 -0
  68. package/esm/core/{persistedAuthState.js → persistedAuthState.mjs} +4 -4
  69. package/esm/core/persistedAuthState.mjs.map +1 -0
  70. package/esm/core/{prShouldLoadApp.js → prShouldLoadApp.mjs} +2 -2
  71. package/esm/core/prShouldLoadApp.mjs.map +1 -0
  72. package/esm/core/{tokenExfiltrationDefense.js → tokenExfiltrationDefense.mjs} +9 -5
  73. package/esm/core/tokenExfiltrationDefense.mjs.map +1 -0
  74. package/esm/core/{tokenExfiltrationDefense_legacy.js → tokenExfiltrationDefense_legacy.mjs} +2 -2
  75. package/esm/core/tokenExfiltrationDefense_legacy.mjs.map +1 -0
  76. package/esm/core/{tokenPlaceholderSubstitution.js → tokenPlaceholderSubstitution.mjs} +2 -2
  77. package/esm/core/tokenPlaceholderSubstitution.mjs.map +1 -0
  78. package/esm/entrypoint.d.ts +1 -1
  79. package/esm/entrypoint.mjs +2 -0
  80. package/esm/entrypoint.mjs.map +1 -0
  81. package/esm/index.d.ts +1 -1
  82. package/esm/index.mjs +2 -0
  83. package/esm/index.mjs.map +1 -0
  84. package/esm/keycloak/index.d.ts +3 -3
  85. package/esm/keycloak/index.mjs +3 -0
  86. package/esm/keycloak/index.mjs.map +1 -0
  87. package/esm/keycloak/{isKeycloak.js → isKeycloak.mjs} +1 -1
  88. package/esm/keycloak/isKeycloak.mjs.map +1 -0
  89. package/esm/keycloak/keycloak-js/Keycloak.d.ts +2 -2
  90. package/esm/keycloak/keycloak-js/{Keycloak.js → Keycloak.mjs} +20 -15
  91. package/esm/keycloak/keycloak-js/Keycloak.mjs.map +1 -0
  92. package/esm/keycloak/keycloak-js/index.d.ts +2 -2
  93. package/esm/keycloak/keycloak-js/index.mjs +2 -0
  94. package/esm/keycloak/keycloak-js/index.mjs.map +1 -0
  95. package/esm/keycloak/keycloak-js/types.mjs +2 -0
  96. package/esm/keycloak/keycloak-js/types.mjs.map +1 -0
  97. package/esm/keycloak/{keycloakIssuerUriParsed.js → keycloakIssuerUriParsed.mjs} +3 -3
  98. package/esm/keycloak/keycloakIssuerUriParsed.mjs.map +1 -0
  99. package/esm/keycloak/keycloakUtils.d.ts +1 -1
  100. package/esm/keycloak/{keycloakUtils.js → keycloakUtils.mjs} +4 -4
  101. package/esm/keycloak/keycloakUtils.mjs.map +1 -0
  102. package/esm/keycloak-js.d.ts +1 -1
  103. package/esm/keycloak-js.mjs +2 -0
  104. package/esm/keycloak-js.mjs.map +1 -0
  105. package/esm/mock/index.d.ts +1 -1
  106. package/esm/mock/index.mjs +2 -0
  107. package/esm/mock/index.mjs.map +1 -0
  108. package/esm/mock/oidc.d.ts +1 -1
  109. package/esm/mock/{oidc.js → oidc.mjs} +8 -8
  110. package/esm/mock/oidc.mjs.map +1 -0
  111. package/esm/mock/react.d.ts +8 -8
  112. package/esm/mock/{react.js → react.mjs} +3 -3
  113. package/esm/mock/react.mjs.map +1 -0
  114. package/esm/react/index.d.ts +1 -1
  115. package/esm/react/index.mjs +2 -0
  116. package/esm/react/index.mjs.map +1 -0
  117. package/esm/react/react.d.ts +2 -2
  118. package/esm/react/{react.js → react.mjs} +7 -7
  119. package/esm/react/react.mjs.map +1 -0
  120. package/esm/react-spa/apiBuilder.d.ts +3 -3
  121. package/esm/react-spa/{apiBuilder.js → apiBuilder.mjs} +2 -2
  122. package/esm/react-spa/apiBuilder.mjs.map +1 -0
  123. package/esm/react-spa/createOidcSpaApi.d.ts +3 -3
  124. package/esm/react-spa/{createOidcSpaApi.js → createOidcSpaApi.mjs} +12 -12
  125. package/esm/react-spa/createOidcSpaApi.mjs.map +1 -0
  126. package/esm/react-spa/index.d.ts +2 -2
  127. package/esm/react-spa/index.mjs +3 -0
  128. package/esm/react-spa/index.mjs.map +1 -0
  129. package/esm/react-spa/types.d.ts +2 -2
  130. package/esm/react-spa/types.mjs +2 -0
  131. package/esm/react-spa/types.mjs.map +1 -0
  132. package/esm/tanstack-start/react/accessTokenValidation_rfc9068.d.ts +3 -3
  133. package/esm/tanstack-start/react/{accessTokenValidation_rfc9068.js → accessTokenValidation_rfc9068.mjs} +4 -4
  134. package/esm/tanstack-start/react/accessTokenValidation_rfc9068.mjs.map +1 -0
  135. package/esm/tanstack-start/react/apiBuilder.d.ts +4 -4
  136. package/esm/tanstack-start/react/{apiBuilder.js → apiBuilder.mjs} +4 -4
  137. package/esm/tanstack-start/react/apiBuilder.mjs.map +1 -0
  138. package/esm/tanstack-start/react/createOidcSpaApi.d.ts +3 -3
  139. package/esm/tanstack-start/react/{createOidcSpaApi.js → createOidcSpaApi.mjs} +15 -15
  140. package/esm/tanstack-start/react/createOidcSpaApi.mjs.map +1 -0
  141. package/esm/tanstack-start/react/{disableSsrIfLoginEnforced.js → disableSsrIfLoginEnforced.mjs} +1 -1
  142. package/esm/tanstack-start/react/disableSsrIfLoginEnforced.mjs.map +1 -0
  143. package/esm/tanstack-start/react/index.d.ts +4 -4
  144. package/esm/tanstack-start/react/{index.js → index.mjs} +4 -4
  145. package/esm/tanstack-start/react/index.mjs.map +1 -0
  146. package/esm/tanstack-start/react/types.d.ts +4 -4
  147. package/esm/tanstack-start/react/types.mjs +2 -0
  148. package/esm/tanstack-start/react/types.mjs.map +1 -0
  149. package/esm/tanstack-start/react/{withOidcSpaServerEntry.js → withOidcSpaServerEntry.mjs} +2 -2
  150. package/esm/tanstack-start/react/withOidcSpaServerEntry.mjs.map +1 -0
  151. package/esm/tools/ConcreteClass.mjs +2 -0
  152. package/esm/tools/ConcreteClass.mjs.map +1 -0
  153. package/esm/tools/{Deferred.js → Deferred.mjs} +1 -1
  154. package/esm/tools/Deferred.mjs.map +1 -0
  155. package/esm/tools/{Evt.js → Evt.mjs} +2 -2
  156. package/esm/tools/Evt.mjs.map +1 -0
  157. package/esm/tools/GetterOrDirectValue.mjs +2 -0
  158. package/esm/tools/GetterOrDirectValue.mjs.map +1 -0
  159. package/esm/tools/{INFINITY_TIME.js → INFINITY_TIME.mjs} +1 -1
  160. package/esm/tools/INFINITY_TIME.mjs.map +1 -0
  161. package/esm/tools/MaybeAsync.mjs +2 -0
  162. package/esm/tools/MaybeAsync.mjs.map +1 -0
  163. package/esm/tools/ReadonlyBehaviorSubject.mjs +2 -0
  164. package/esm/tools/ReadonlyBehaviorSubject.mjs.map +1 -0
  165. package/esm/tools/{StatefulEvt.js → StatefulEvt.mjs} +1 -1
  166. package/esm/tools/StatefulEvt.mjs.map +1 -0
  167. package/esm/tools/ValueOrAsyncGetter.mjs +2 -0
  168. package/esm/tools/ValueOrAsyncGetter.mjs.map +1 -0
  169. package/esm/tools/ZodSchemaLike.mjs +2 -0
  170. package/esm/tools/ZodSchemaLike.mjs.map +1 -0
  171. package/esm/tools/{base64.js → base64.mjs} +1 -1
  172. package/esm/tools/base64.mjs.map +1 -0
  173. package/esm/tools/{createObjectThatThrowsIfAccessed.js → createObjectThatThrowsIfAccessed.mjs} +1 -1
  174. package/esm/tools/createObjectThatThrowsIfAccessed.mjs.map +1 -0
  175. package/esm/tools/{decodeJwt.js → decodeJwt.mjs} +1 -1
  176. package/esm/tools/decodeJwt.mjs.map +1 -0
  177. package/esm/tools/{ensureNonBlankPaint.js → ensureNonBlankPaint.mjs} +1 -1
  178. package/esm/tools/ensureNonBlankPaint.mjs.map +1 -0
  179. package/esm/tools/{generateUrlSafeRandom.js → generateUrlSafeRandom.mjs} +1 -1
  180. package/esm/tools/generateUrlSafeRandom.mjs.map +1 -0
  181. package/esm/tools/{getBaseHref.js → getBaseHref.mjs} +1 -1
  182. package/esm/tools/getBaseHref.mjs.map +1 -0
  183. package/esm/tools/{getDownlinkAndRtt.js → getDownlinkAndRtt.mjs} +2 -2
  184. package/esm/tools/getDownlinkAndRtt.mjs.map +1 -0
  185. package/esm/tools/{getIsOnline.js → getIsOnline.mjs} +2 -2
  186. package/esm/tools/getIsOnline.mjs.map +1 -0
  187. package/esm/tools/{getIsValidRemoteJson.js → getIsValidRemoteJson.mjs} +1 -1
  188. package/esm/tools/getIsValidRemoteJson.mjs.map +1 -0
  189. package/esm/tools/{getPrUserInteraction.js → getPrUserInteraction.mjs} +2 -2
  190. package/esm/tools/getPrUserInteraction.mjs.map +1 -0
  191. package/esm/tools/getThisCodebaseRootDirPath_esm.mjs +18 -0
  192. package/esm/tools/getThisCodebaseRootDirPath_esm.mjs.map +1 -0
  193. package/esm/tools/{getUserEnvironmentInfo.js → getUserEnvironmentInfo.mjs} +1 -1
  194. package/esm/tools/getUserEnvironmentInfo.mjs.map +1 -0
  195. package/esm/tools/{haveSharedParentDomain.js → haveSharedParentDomain.mjs} +1 -1
  196. package/esm/tools/haveSharedParentDomain.mjs.map +1 -0
  197. package/esm/tools/{isBrowser.js → isBrowser.mjs} +1 -1
  198. package/esm/tools/isBrowser.mjs.map +1 -0
  199. package/esm/tools/{isDev.js → isDev.mjs} +1 -1
  200. package/esm/tools/isDev.mjs.map +1 -0
  201. package/esm/tools/{isDomain.js → isDomain.mjs} +1 -1
  202. package/esm/tools/isDomain.mjs.map +1 -0
  203. package/esm/tools/{isHostnameAuthorized.js → isHostnameAuthorized.mjs} +3 -3
  204. package/esm/tools/isHostnameAuthorized.mjs.map +1 -0
  205. package/esm/tools/{isLikelyDevServer.js → isLikelyDevServer.mjs} +2 -2
  206. package/esm/tools/isLikelyDevServer.mjs.map +1 -0
  207. package/esm/tools/{lazySessionStorage.js → lazySessionStorage.mjs} +2 -2
  208. package/esm/tools/lazySessionStorage.mjs.map +1 -0
  209. package/esm/tools/{parseKeycloakIssuerUri.js → parseKeycloakIssuerUri.mjs} +2 -2
  210. package/esm/tools/parseKeycloakIssuerUri.mjs.map +1 -0
  211. package/esm/tools/{readExpirationTimeInJwt.js → readExpirationTimeInJwt.mjs} +4 -4
  212. package/esm/tools/readExpirationTimeInJwt.mjs.map +1 -0
  213. package/esm/tools/{startCountdown.js → startCountdown.mjs} +1 -1
  214. package/esm/tools/startCountdown.mjs.map +1 -0
  215. package/esm/tools/{subscribeToUserInteraction.js → subscribeToUserInteraction.mjs} +2 -2
  216. package/esm/tools/subscribeToUserInteraction.mjs.map +1 -0
  217. package/esm/tools/{toFullyQualifiedUrl.js → toFullyQualifiedUrl.mjs} +1 -1
  218. package/esm/tools/toFullyQualifiedUrl.mjs.map +1 -0
  219. package/esm/tools/{toHumanReadableDuration.js → toHumanReadableDuration.mjs} +1 -1
  220. package/esm/tools/toHumanReadableDuration.mjs.map +1 -0
  221. package/esm/tools/tsafe/Equals.d.ts +2 -2
  222. package/esm/tools/tsafe/{Equals.js → Equals.mjs} +1 -1
  223. package/esm/tools/tsafe/Equals.mjs.map +1 -0
  224. package/esm/tools/tsafe/Param0.d.ts +5 -2
  225. package/esm/tools/tsafe/Param0.mjs +2 -0
  226. package/esm/tools/tsafe/Param0.mjs.map +1 -0
  227. package/esm/tools/tsafe/Parameters.mjs +2 -0
  228. package/esm/tools/tsafe/Parameters.mjs.map +1 -0
  229. package/esm/tools/tsafe/{Reflect.js → Reflect.mjs} +1 -1
  230. package/esm/tools/tsafe/Reflect.mjs.map +1 -0
  231. package/esm/tools/tsafe/assert.d.ts +1 -1
  232. package/esm/tools/tsafe/{assert.js → assert.mjs} +1 -1
  233. package/esm/tools/tsafe/assert.mjs.map +1 -0
  234. package/esm/tools/tsafe/{id.js → id.mjs} +1 -1
  235. package/esm/tools/tsafe/id.mjs.map +1 -0
  236. package/esm/tools/tsafe/{isAmong.js → isAmong.mjs} +1 -1
  237. package/esm/tools/tsafe/isAmong.mjs.map +1 -0
  238. package/esm/tools/tsafe/{noUndefined.js → noUndefined.mjs} +1 -1
  239. package/esm/tools/tsafe/noUndefined.mjs.map +1 -0
  240. package/esm/tools/tsafe/tools/StrictEquals.mjs +2 -0
  241. package/esm/tools/tsafe/tools/StrictEquals.mjs.map +1 -0
  242. package/esm/tools/tsafe/tools/Unite.mjs +2 -0
  243. package/esm/tools/tsafe/tools/Unite.mjs.map +1 -0
  244. package/esm/tools/tsafe/{typeGuard.js → typeGuard.mjs} +1 -1
  245. package/esm/tools/tsafe/typeGuard.mjs.map +1 -0
  246. package/esm/tools/tsafe/{uncapitalize.js → uncapitalize.mjs} +1 -1
  247. package/esm/tools/tsafe/uncapitalize.mjs.map +1 -0
  248. package/esm/tools/{urlSearchParams.js → urlSearchParams.mjs} +1 -1
  249. package/esm/tools/urlSearchParams.mjs.map +1 -0
  250. package/esm/tools/{wildcardsMatch.js → wildcardsMatch.mjs} +1 -1
  251. package/esm/tools/wildcardsMatch.mjs.map +1 -0
  252. package/esm/vendor/build-runtime/babel.mjs +44590 -0
  253. package/esm/vendor/build-runtime/magic-string.mjs +1075 -0
  254. package/{vite-plugin → esm/vite-plugin}/handleClientEntrypoint.d.ts +2 -2
  255. package/{vite-plugin/handleClientEntrypoint.js → esm/vite-plugin/handleClientEntrypoint.mjs} +26 -62
  256. package/esm/vite-plugin/handleClientEntrypoint.mjs.map +1 -0
  257. package/{vite-plugin → esm/vite-plugin}/handleServerEntrypoint.d.ts +1 -1
  258. package/{vite-plugin/handleServerEntrypoint.js → esm/vite-plugin/handleServerEntrypoint.mjs} +13 -49
  259. package/esm/vite-plugin/handleServerEntrypoint.mjs.map +1 -0
  260. package/esm/vite-plugin/index.d.ts +1 -0
  261. package/esm/vite-plugin/index.mjs +2 -0
  262. package/esm/vite-plugin/index.mjs.map +1 -0
  263. package/{vite-plugin → esm/vite-plugin}/manageOptimizedDeps.d.ts +1 -1
  264. package/esm/vite-plugin/manageOptimizedDeps.mjs +52 -0
  265. package/esm/vite-plugin/manageOptimizedDeps.mjs.map +1 -0
  266. package/{vite-plugin/projectType.js → esm/vite-plugin/projectType.mjs} +2 -5
  267. package/esm/vite-plugin/projectType.mjs.map +1 -0
  268. package/{vite-plugin/transformTanstackRouterCreateFileRoute.js → esm/vite-plugin/transformTanstackRouterCreateFileRoute.mjs} +14 -17
  269. package/esm/vite-plugin/transformTanstackRouterCreateFileRoute.mjs.map +1 -0
  270. package/esm/vite-plugin/utils.mjs +50 -0
  271. package/esm/vite-plugin/utils.mjs.map +1 -0
  272. package/{vite-plugin → esm/vite-plugin}/vite-plugin.d.ts +1 -1
  273. package/{vite-plugin/vite-plugin.js → esm/vite-plugin/vite-plugin.mjs} +17 -20
  274. package/esm/vite-plugin/vite-plugin.mjs.map +1 -0
  275. package/package.json +48 -34
  276. package/src/core/tokenExfiltrationDefense.ts +5 -0
  277. package/src/tools/{getThisCodebaseRootDirPath_cjs.ts → getThisCodebaseRootDirPath_esm.ts} +3 -1
  278. package/src/vite-plugin/manageOptimizedDeps.ts +3 -1
  279. package/src/vite-plugin/utils.ts +2 -0
  280. package/esm/angular.js.map +0 -1
  281. package/esm/backend.js.map +0 -1
  282. package/esm/core/AuthResponse.js.map +0 -1
  283. package/esm/core/BASE_URL.js.map +0 -1
  284. package/esm/core/Oidc.js +0 -2
  285. package/esm/core/Oidc.js.map +0 -1
  286. package/esm/core/OidcInitializationError.js.map +0 -1
  287. package/esm/core/OidcMetadata.js.map +0 -1
  288. package/esm/core/StateData.js.map +0 -1
  289. package/esm/core/StateDataCookie.js.map +0 -1
  290. package/esm/core/configId.js.map +0 -1
  291. package/esm/core/createOidc.js.map +0 -1
  292. package/esm/core/desiredPostLoginRedirectUrl.js.map +0 -1
  293. package/esm/core/diagnostic.js.map +0 -1
  294. package/esm/core/earlyInit.js.map +0 -1
  295. package/esm/core/evtIsUserActive.js.map +0 -1
  296. package/esm/core/homeAndRedirectUri.js.map +0 -1
  297. package/esm/core/index.js +0 -3
  298. package/esm/core/index.js.map +0 -1
  299. package/esm/core/instancesThatCantUseIframes.js.map +0 -1
  300. package/esm/core/isNewBrowserSession.js.map +0 -1
  301. package/esm/core/loginOrGoToAuthServer.js.map +0 -1
  302. package/esm/core/loginPropagationToOtherTabs.js.map +0 -1
  303. package/esm/core/loginSilent.js.map +0 -1
  304. package/esm/core/logoutPropagationToOtherTabs.js.map +0 -1
  305. package/esm/core/oidcClientTsUserToTokens.js.map +0 -1
  306. package/esm/core/ongoingLoginOrRefreshProcesses.js.map +0 -1
  307. package/esm/core/persistedAuthState.js.map +0 -1
  308. package/esm/core/prShouldLoadApp.js.map +0 -1
  309. package/esm/core/tokenExfiltrationDefense.js.map +0 -1
  310. package/esm/core/tokenExfiltrationDefense_legacy.js.map +0 -1
  311. package/esm/core/tokenPlaceholderSubstitution.js.map +0 -1
  312. package/esm/entrypoint.js +0 -2
  313. package/esm/entrypoint.js.map +0 -1
  314. package/esm/index.js +0 -2
  315. package/esm/index.js.map +0 -1
  316. package/esm/keycloak/index.js +0 -3
  317. package/esm/keycloak/index.js.map +0 -1
  318. package/esm/keycloak/isKeycloak.js.map +0 -1
  319. package/esm/keycloak/keycloak-js/Keycloak.js.map +0 -1
  320. package/esm/keycloak/keycloak-js/index.js +0 -2
  321. package/esm/keycloak/keycloak-js/index.js.map +0 -1
  322. package/esm/keycloak/keycloak-js/types.js +0 -2
  323. package/esm/keycloak/keycloak-js/types.js.map +0 -1
  324. package/esm/keycloak/keycloakIssuerUriParsed.js.map +0 -1
  325. package/esm/keycloak/keycloakUtils.js.map +0 -1
  326. package/esm/keycloak-js.js +0 -2
  327. package/esm/keycloak-js.js.map +0 -1
  328. package/esm/mock/index.js +0 -2
  329. package/esm/mock/index.js.map +0 -1
  330. package/esm/mock/oidc.js.map +0 -1
  331. package/esm/mock/react.js.map +0 -1
  332. package/esm/react/index.js +0 -2
  333. package/esm/react/index.js.map +0 -1
  334. package/esm/react/react.js.map +0 -1
  335. package/esm/react-spa/apiBuilder.js.map +0 -1
  336. package/esm/react-spa/createOidcSpaApi.js.map +0 -1
  337. package/esm/react-spa/index.js +0 -3
  338. package/esm/react-spa/index.js.map +0 -1
  339. package/esm/react-spa/types.js +0 -2
  340. package/esm/react-spa/types.js.map +0 -1
  341. package/esm/tanstack-start/react/accessTokenValidation_rfc9068.js.map +0 -1
  342. package/esm/tanstack-start/react/apiBuilder.js.map +0 -1
  343. package/esm/tanstack-start/react/createOidcSpaApi.js.map +0 -1
  344. package/esm/tanstack-start/react/disableSsrIfLoginEnforced.js.map +0 -1
  345. package/esm/tanstack-start/react/index.js.map +0 -1
  346. package/esm/tanstack-start/react/types.js +0 -2
  347. package/esm/tanstack-start/react/types.js.map +0 -1
  348. package/esm/tanstack-start/react/withOidcSpaServerEntry.js.map +0 -1
  349. package/esm/tools/ConcreteClass.js +0 -2
  350. package/esm/tools/ConcreteClass.js.map +0 -1
  351. package/esm/tools/Deferred.js.map +0 -1
  352. package/esm/tools/Evt.js.map +0 -1
  353. package/esm/tools/GetterOrDirectValue.js +0 -2
  354. package/esm/tools/GetterOrDirectValue.js.map +0 -1
  355. package/esm/tools/INFINITY_TIME.js.map +0 -1
  356. package/esm/tools/MaybeAsync.js +0 -2
  357. package/esm/tools/MaybeAsync.js.map +0 -1
  358. package/esm/tools/ReadonlyBehaviorSubject.js +0 -2
  359. package/esm/tools/ReadonlyBehaviorSubject.js.map +0 -1
  360. package/esm/tools/StatefulEvt.js.map +0 -1
  361. package/esm/tools/ValueOrAsyncGetter.js +0 -2
  362. package/esm/tools/ValueOrAsyncGetter.js.map +0 -1
  363. package/esm/tools/ZodSchemaLike.js +0 -2
  364. package/esm/tools/ZodSchemaLike.js.map +0 -1
  365. package/esm/tools/base64.js.map +0 -1
  366. package/esm/tools/createObjectThatThrowsIfAccessed.js.map +0 -1
  367. package/esm/tools/decodeJwt.js.map +0 -1
  368. package/esm/tools/ensureNonBlankPaint.js.map +0 -1
  369. package/esm/tools/generateUrlSafeRandom.js.map +0 -1
  370. package/esm/tools/getBaseHref.js.map +0 -1
  371. package/esm/tools/getDownlinkAndRtt.js.map +0 -1
  372. package/esm/tools/getIsOnline.js.map +0 -1
  373. package/esm/tools/getIsValidRemoteJson.js.map +0 -1
  374. package/esm/tools/getPrUserInteraction.js.map +0 -1
  375. package/esm/tools/getUserEnvironmentInfo.js.map +0 -1
  376. package/esm/tools/haveSharedParentDomain.js.map +0 -1
  377. package/esm/tools/isBrowser.js.map +0 -1
  378. package/esm/tools/isDev.js.map +0 -1
  379. package/esm/tools/isDomain.js.map +0 -1
  380. package/esm/tools/isHostnameAuthorized.js.map +0 -1
  381. package/esm/tools/isLikelyDevServer.js.map +0 -1
  382. package/esm/tools/lazySessionStorage.js.map +0 -1
  383. package/esm/tools/parseKeycloakIssuerUri.js.map +0 -1
  384. package/esm/tools/readExpirationTimeInJwt.js.map +0 -1
  385. package/esm/tools/startCountdown.js.map +0 -1
  386. package/esm/tools/subscribeToUserInteraction.js.map +0 -1
  387. package/esm/tools/toFullyQualifiedUrl.js.map +0 -1
  388. package/esm/tools/toHumanReadableDuration.js.map +0 -1
  389. package/esm/tools/tsafe/Equals.js.map +0 -1
  390. package/esm/tools/tsafe/Param0.js +0 -2
  391. package/esm/tools/tsafe/Param0.js.map +0 -1
  392. package/esm/tools/tsafe/Parameters.js +0 -2
  393. package/esm/tools/tsafe/Parameters.js.map +0 -1
  394. package/esm/tools/tsafe/Reflect.js.map +0 -1
  395. package/esm/tools/tsafe/assert.js.map +0 -1
  396. package/esm/tools/tsafe/id.js.map +0 -1
  397. package/esm/tools/tsafe/isAmong.js.map +0 -1
  398. package/esm/tools/tsafe/noUndefined.js.map +0 -1
  399. package/esm/tools/tsafe/tools/StrictEquals.js +0 -2
  400. package/esm/tools/tsafe/tools/StrictEquals.js.map +0 -1
  401. package/esm/tools/tsafe/tools/Unite.js +0 -2
  402. package/esm/tools/tsafe/tools/Unite.js.map +0 -1
  403. package/esm/tools/tsafe/typeGuard.js.map +0 -1
  404. package/esm/tools/tsafe/uncapitalize.js.map +0 -1
  405. package/esm/tools/urlSearchParams.js.map +0 -1
  406. package/esm/tools/wildcardsMatch.js.map +0 -1
  407. package/tools/getThisCodebaseRootDirPath_cjs.js +0 -53
  408. package/tools/getThisCodebaseRootDirPath_cjs.js.map +0 -1
  409. package/vendor/build-runtime/babel.js +0 -3
  410. package/vendor/build-runtime/magic-string.js +0 -2
  411. package/vite-plugin/handleClientEntrypoint.js.map +0 -1
  412. package/vite-plugin/handleServerEntrypoint.js.map +0 -1
  413. package/vite-plugin/index.d.ts +0 -1
  414. package/vite-plugin/index.js +0 -6
  415. package/vite-plugin/index.js.map +0 -1
  416. package/vite-plugin/manageOptimizedDeps.js +0 -86
  417. package/vite-plugin/manageOptimizedDeps.js.map +0 -1
  418. package/vite-plugin/projectType.js.map +0 -1
  419. package/vite-plugin/transformTanstackRouterCreateFileRoute.js.map +0 -1
  420. package/vite-plugin/utils.js +0 -88
  421. package/vite-plugin/utils.js.map +0 -1
  422. package/vite-plugin/vite-plugin.js.map +0 -1
  423. /package/{tools/getThisCodebaseRootDirPath_cjs.d.ts → esm/tools/getThisCodebaseRootDirPath_esm.d.ts} +0 -0
  424. /package/esm/vendor/backend/{evt.js → evt.mjs} +0 -0
  425. /package/esm/vendor/backend/{jose.js → jose.mjs} +0 -0
  426. /package/esm/vendor/backend/{tsafe.js → tsafe.mjs} +0 -0
  427. /package/esm/vendor/backend/{zod.js → zod.mjs} +0 -0
  428. /package/{vendor → esm/vendor}/build-runtime/babel.d.ts +0 -0
  429. /package/{vendor → esm/vendor}/build-runtime/magic-string.d.ts +0 -0
  430. /package/esm/vendor/frontend/{oidc-client-ts.js → oidc-client-ts.mjs} +0 -0
  431. /package/{vite-plugin → esm/vite-plugin}/projectType.d.ts +0 -0
  432. /package/{vite-plugin → esm/vite-plugin}/transformTanstackRouterCreateFileRoute.d.ts +0 -0
  433. /package/{vite-plugin → esm/vite-plugin}/utils.d.ts +0 -0
@@ -0,0 +1,1075 @@
1
+ // node_modules/magic-string/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
2
+ var comma = ",".charCodeAt(0);
3
+ var semicolon = ";".charCodeAt(0);
4
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
5
+ var intToChar = new Uint8Array(64);
6
+ var charToInt = new Uint8Array(128);
7
+ for (let i = 0; i < chars.length; i++) {
8
+ const c = chars.charCodeAt(i);
9
+ intToChar[i] = c;
10
+ charToInt[c] = i;
11
+ }
12
+ function encodeInteger(builder, num, relative) {
13
+ let delta = num - relative;
14
+ delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
15
+ do {
16
+ let clamped = delta & 31;
17
+ delta >>>= 5;
18
+ if (delta > 0) clamped |= 32;
19
+ builder.write(intToChar[clamped]);
20
+ } while (delta > 0);
21
+ return num;
22
+ }
23
+ var bufLength = 1024 * 16;
24
+ var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? {
25
+ decode(buf) {
26
+ const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
27
+ return out.toString();
28
+ }
29
+ } : {
30
+ decode(buf) {
31
+ let out = "";
32
+ for (let i = 0; i < buf.length; i++) {
33
+ out += String.fromCharCode(buf[i]);
34
+ }
35
+ return out;
36
+ }
37
+ };
38
+ var StringWriter = class {
39
+ constructor() {
40
+ this.pos = 0;
41
+ this.out = "";
42
+ this.buffer = new Uint8Array(bufLength);
43
+ }
44
+ write(v) {
45
+ const { buffer } = this;
46
+ buffer[this.pos++] = v;
47
+ if (this.pos === bufLength) {
48
+ this.out += td.decode(buffer);
49
+ this.pos = 0;
50
+ }
51
+ }
52
+ flush() {
53
+ const { buffer, out, pos } = this;
54
+ return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
55
+ }
56
+ };
57
+ function encode(decoded) {
58
+ const writer = new StringWriter();
59
+ let sourcesIndex = 0;
60
+ let sourceLine = 0;
61
+ let sourceColumn = 0;
62
+ let namesIndex = 0;
63
+ for (let i = 0; i < decoded.length; i++) {
64
+ const line = decoded[i];
65
+ if (i > 0) writer.write(semicolon);
66
+ if (line.length === 0) continue;
67
+ let genColumn = 0;
68
+ for (let j = 0; j < line.length; j++) {
69
+ const segment = line[j];
70
+ if (j > 0) writer.write(comma);
71
+ genColumn = encodeInteger(writer, segment[0], genColumn);
72
+ if (segment.length === 1) continue;
73
+ sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
74
+ sourceLine = encodeInteger(writer, segment[2], sourceLine);
75
+ sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
76
+ if (segment.length === 4) continue;
77
+ namesIndex = encodeInteger(writer, segment[4], namesIndex);
78
+ }
79
+ }
80
+ return writer.flush();
81
+ }
82
+
83
+ // node_modules/magic-string/dist/magic-string.es.mjs
84
+ var BitSet = class _BitSet {
85
+ constructor(arg) {
86
+ this.bits = arg instanceof _BitSet ? arg.bits.slice() : [];
87
+ }
88
+ add(n2) {
89
+ this.bits[n2 >> 5] |= 1 << (n2 & 31);
90
+ }
91
+ has(n2) {
92
+ return !!(this.bits[n2 >> 5] & 1 << (n2 & 31));
93
+ }
94
+ };
95
+ var Chunk = class _Chunk {
96
+ constructor(start, end, content) {
97
+ this.start = start;
98
+ this.end = end;
99
+ this.original = content;
100
+ this.intro = "";
101
+ this.outro = "";
102
+ this.content = content;
103
+ this.storeName = false;
104
+ this.edited = false;
105
+ {
106
+ this.previous = null;
107
+ this.next = null;
108
+ }
109
+ }
110
+ appendLeft(content) {
111
+ this.outro += content;
112
+ }
113
+ appendRight(content) {
114
+ this.intro = this.intro + content;
115
+ }
116
+ clone() {
117
+ const chunk = new _Chunk(this.start, this.end, this.original);
118
+ chunk.intro = this.intro;
119
+ chunk.outro = this.outro;
120
+ chunk.content = this.content;
121
+ chunk.storeName = this.storeName;
122
+ chunk.edited = this.edited;
123
+ return chunk;
124
+ }
125
+ contains(index) {
126
+ return this.start < index && index < this.end;
127
+ }
128
+ eachNext(fn) {
129
+ let chunk = this;
130
+ while (chunk) {
131
+ fn(chunk);
132
+ chunk = chunk.next;
133
+ }
134
+ }
135
+ eachPrevious(fn) {
136
+ let chunk = this;
137
+ while (chunk) {
138
+ fn(chunk);
139
+ chunk = chunk.previous;
140
+ }
141
+ }
142
+ edit(content, storeName, contentOnly) {
143
+ this.content = content;
144
+ if (!contentOnly) {
145
+ this.intro = "";
146
+ this.outro = "";
147
+ }
148
+ this.storeName = storeName;
149
+ this.edited = true;
150
+ return this;
151
+ }
152
+ prependLeft(content) {
153
+ this.outro = content + this.outro;
154
+ }
155
+ prependRight(content) {
156
+ this.intro = content + this.intro;
157
+ }
158
+ reset() {
159
+ this.intro = "";
160
+ this.outro = "";
161
+ if (this.edited) {
162
+ this.content = this.original;
163
+ this.storeName = false;
164
+ this.edited = false;
165
+ }
166
+ }
167
+ split(index) {
168
+ const sliceIndex = index - this.start;
169
+ const originalBefore = this.original.slice(0, sliceIndex);
170
+ const originalAfter = this.original.slice(sliceIndex);
171
+ this.original = originalBefore;
172
+ const newChunk = new _Chunk(index, this.end, originalAfter);
173
+ newChunk.outro = this.outro;
174
+ this.outro = "";
175
+ this.end = index;
176
+ if (this.edited) {
177
+ newChunk.edit("", false);
178
+ this.content = "";
179
+ } else {
180
+ this.content = originalBefore;
181
+ }
182
+ newChunk.next = this.next;
183
+ if (newChunk.next) newChunk.next.previous = newChunk;
184
+ newChunk.previous = this;
185
+ this.next = newChunk;
186
+ return newChunk;
187
+ }
188
+ toString() {
189
+ return this.intro + this.content + this.outro;
190
+ }
191
+ trimEnd(rx) {
192
+ this.outro = this.outro.replace(rx, "");
193
+ if (this.outro.length) return true;
194
+ const trimmed = this.content.replace(rx, "");
195
+ if (trimmed.length) {
196
+ if (trimmed !== this.content) {
197
+ this.split(this.start + trimmed.length).edit("", void 0, true);
198
+ if (this.edited) {
199
+ this.edit(trimmed, this.storeName, true);
200
+ }
201
+ }
202
+ return true;
203
+ } else {
204
+ this.edit("", void 0, true);
205
+ this.intro = this.intro.replace(rx, "");
206
+ if (this.intro.length) return true;
207
+ }
208
+ }
209
+ trimStart(rx) {
210
+ this.intro = this.intro.replace(rx, "");
211
+ if (this.intro.length) return true;
212
+ const trimmed = this.content.replace(rx, "");
213
+ if (trimmed.length) {
214
+ if (trimmed !== this.content) {
215
+ const newChunk = this.split(this.end - trimmed.length);
216
+ if (this.edited) {
217
+ newChunk.edit(trimmed, this.storeName, true);
218
+ }
219
+ this.edit("", void 0, true);
220
+ }
221
+ return true;
222
+ } else {
223
+ this.edit("", void 0, true);
224
+ this.outro = this.outro.replace(rx, "");
225
+ if (this.outro.length) return true;
226
+ }
227
+ }
228
+ };
229
+ function getBtoa() {
230
+ if (typeof globalThis !== "undefined" && typeof globalThis.btoa === "function") {
231
+ return (str) => globalThis.btoa(unescape(encodeURIComponent(str)));
232
+ } else if (typeof Buffer === "function") {
233
+ return (str) => Buffer.from(str, "utf-8").toString("base64");
234
+ } else {
235
+ return () => {
236
+ throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.");
237
+ };
238
+ }
239
+ }
240
+ var btoa = /* @__PURE__ */ getBtoa();
241
+ var SourceMap = class {
242
+ constructor(properties) {
243
+ this.version = 3;
244
+ this.file = properties.file;
245
+ this.sources = properties.sources;
246
+ this.sourcesContent = properties.sourcesContent;
247
+ this.names = properties.names;
248
+ this.mappings = encode(properties.mappings);
249
+ if (typeof properties.x_google_ignoreList !== "undefined") {
250
+ this.x_google_ignoreList = properties.x_google_ignoreList;
251
+ }
252
+ if (typeof properties.debugId !== "undefined") {
253
+ this.debugId = properties.debugId;
254
+ }
255
+ }
256
+ toString() {
257
+ return JSON.stringify(this);
258
+ }
259
+ toUrl() {
260
+ return "data:application/json;charset=utf-8;base64," + btoa(this.toString());
261
+ }
262
+ };
263
+ function guessIndent(code) {
264
+ const lines = code.split("\n");
265
+ const tabbed = lines.filter((line) => /^\t+/.test(line));
266
+ const spaced = lines.filter((line) => /^ {2,}/.test(line));
267
+ if (tabbed.length === 0 && spaced.length === 0) {
268
+ return null;
269
+ }
270
+ if (tabbed.length >= spaced.length) {
271
+ return " ";
272
+ }
273
+ const min = spaced.reduce((previous, current) => {
274
+ const numSpaces = /^ +/.exec(current)[0].length;
275
+ return Math.min(numSpaces, previous);
276
+ }, Infinity);
277
+ return new Array(min + 1).join(" ");
278
+ }
279
+ function getRelativePath(from, to) {
280
+ const fromParts = from.split(/[/\\]/);
281
+ const toParts = to.split(/[/\\]/);
282
+ fromParts.pop();
283
+ while (fromParts[0] === toParts[0]) {
284
+ fromParts.shift();
285
+ toParts.shift();
286
+ }
287
+ if (fromParts.length) {
288
+ let i = fromParts.length;
289
+ while (i--) fromParts[i] = "..";
290
+ }
291
+ return fromParts.concat(toParts).join("/");
292
+ }
293
+ var toString = Object.prototype.toString;
294
+ function isObject(thing) {
295
+ return toString.call(thing) === "[object Object]";
296
+ }
297
+ function getLocator(source) {
298
+ const originalLines = source.split("\n");
299
+ const lineOffsets = [];
300
+ for (let i = 0, pos = 0; i < originalLines.length; i++) {
301
+ lineOffsets.push(pos);
302
+ pos += originalLines[i].length + 1;
303
+ }
304
+ return function locate(index) {
305
+ let i = 0;
306
+ let j = lineOffsets.length;
307
+ while (i < j) {
308
+ const m = i + j >> 1;
309
+ if (index < lineOffsets[m]) {
310
+ j = m;
311
+ } else {
312
+ i = m + 1;
313
+ }
314
+ }
315
+ const line = i - 1;
316
+ const column = index - lineOffsets[line];
317
+ return { line, column };
318
+ };
319
+ }
320
+ var wordRegex = /\w/;
321
+ var Mappings = class {
322
+ constructor(hires) {
323
+ this.hires = hires;
324
+ this.generatedCodeLine = 0;
325
+ this.generatedCodeColumn = 0;
326
+ this.raw = [];
327
+ this.rawSegments = this.raw[this.generatedCodeLine] = [];
328
+ this.pending = null;
329
+ }
330
+ addEdit(sourceIndex, content, loc, nameIndex) {
331
+ if (content.length) {
332
+ const contentLengthMinusOne = content.length - 1;
333
+ let contentLineEnd = content.indexOf("\n", 0);
334
+ let previousContentLineEnd = -1;
335
+ while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {
336
+ const segment2 = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
337
+ if (nameIndex >= 0) {
338
+ segment2.push(nameIndex);
339
+ }
340
+ this.rawSegments.push(segment2);
341
+ this.generatedCodeLine += 1;
342
+ this.raw[this.generatedCodeLine] = this.rawSegments = [];
343
+ this.generatedCodeColumn = 0;
344
+ previousContentLineEnd = contentLineEnd;
345
+ contentLineEnd = content.indexOf("\n", contentLineEnd + 1);
346
+ }
347
+ const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
348
+ if (nameIndex >= 0) {
349
+ segment.push(nameIndex);
350
+ }
351
+ this.rawSegments.push(segment);
352
+ this.advance(content.slice(previousContentLineEnd + 1));
353
+ } else if (this.pending) {
354
+ this.rawSegments.push(this.pending);
355
+ this.advance(content);
356
+ }
357
+ this.pending = null;
358
+ }
359
+ addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
360
+ let originalCharIndex = chunk.start;
361
+ let first = true;
362
+ let charInHiresBoundary = false;
363
+ while (originalCharIndex < chunk.end) {
364
+ if (original[originalCharIndex] === "\n") {
365
+ loc.line += 1;
366
+ loc.column = 0;
367
+ this.generatedCodeLine += 1;
368
+ this.raw[this.generatedCodeLine] = this.rawSegments = [];
369
+ this.generatedCodeColumn = 0;
370
+ first = true;
371
+ charInHiresBoundary = false;
372
+ } else {
373
+ if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
374
+ const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
375
+ if (this.hires === "boundary") {
376
+ if (wordRegex.test(original[originalCharIndex])) {
377
+ if (!charInHiresBoundary) {
378
+ this.rawSegments.push(segment);
379
+ charInHiresBoundary = true;
380
+ }
381
+ } else {
382
+ this.rawSegments.push(segment);
383
+ charInHiresBoundary = false;
384
+ }
385
+ } else {
386
+ this.rawSegments.push(segment);
387
+ }
388
+ }
389
+ loc.column += 1;
390
+ this.generatedCodeColumn += 1;
391
+ first = false;
392
+ }
393
+ originalCharIndex += 1;
394
+ }
395
+ this.pending = null;
396
+ }
397
+ advance(str) {
398
+ if (!str) return;
399
+ const lines = str.split("\n");
400
+ if (lines.length > 1) {
401
+ for (let i = 0; i < lines.length - 1; i++) {
402
+ this.generatedCodeLine++;
403
+ this.raw[this.generatedCodeLine] = this.rawSegments = [];
404
+ }
405
+ this.generatedCodeColumn = 0;
406
+ }
407
+ this.generatedCodeColumn += lines[lines.length - 1].length;
408
+ }
409
+ };
410
+ var n = "\n";
411
+ var warned = {
412
+ insertLeft: false,
413
+ insertRight: false,
414
+ storeName: false
415
+ };
416
+ var MagicString = class _MagicString {
417
+ constructor(string, options = {}) {
418
+ const chunk = new Chunk(0, string.length, string);
419
+ Object.defineProperties(this, {
420
+ original: { writable: true, value: string },
421
+ outro: { writable: true, value: "" },
422
+ intro: { writable: true, value: "" },
423
+ firstChunk: { writable: true, value: chunk },
424
+ lastChunk: { writable: true, value: chunk },
425
+ lastSearchedChunk: { writable: true, value: chunk },
426
+ byStart: { writable: true, value: {} },
427
+ byEnd: { writable: true, value: {} },
428
+ filename: { writable: true, value: options.filename },
429
+ indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
430
+ sourcemapLocations: { writable: true, value: new BitSet() },
431
+ storedNames: { writable: true, value: {} },
432
+ indentStr: { writable: true, value: void 0 },
433
+ ignoreList: { writable: true, value: options.ignoreList },
434
+ offset: { writable: true, value: options.offset || 0 }
435
+ });
436
+ this.byStart[0] = chunk;
437
+ this.byEnd[string.length] = chunk;
438
+ }
439
+ addSourcemapLocation(char) {
440
+ this.sourcemapLocations.add(char);
441
+ }
442
+ append(content) {
443
+ if (typeof content !== "string") throw new TypeError("outro content must be a string");
444
+ this.outro += content;
445
+ return this;
446
+ }
447
+ appendLeft(index, content) {
448
+ index = index + this.offset;
449
+ if (typeof content !== "string") throw new TypeError("inserted content must be a string");
450
+ this._split(index);
451
+ const chunk = this.byEnd[index];
452
+ if (chunk) {
453
+ chunk.appendLeft(content);
454
+ } else {
455
+ this.intro += content;
456
+ }
457
+ return this;
458
+ }
459
+ appendRight(index, content) {
460
+ index = index + this.offset;
461
+ if (typeof content !== "string") throw new TypeError("inserted content must be a string");
462
+ this._split(index);
463
+ const chunk = this.byStart[index];
464
+ if (chunk) {
465
+ chunk.appendRight(content);
466
+ } else {
467
+ this.outro += content;
468
+ }
469
+ return this;
470
+ }
471
+ clone() {
472
+ const cloned = new _MagicString(this.original, { filename: this.filename, offset: this.offset });
473
+ let originalChunk = this.firstChunk;
474
+ let clonedChunk = cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone();
475
+ while (originalChunk) {
476
+ cloned.byStart[clonedChunk.start] = clonedChunk;
477
+ cloned.byEnd[clonedChunk.end] = clonedChunk;
478
+ const nextOriginalChunk = originalChunk.next;
479
+ const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
480
+ if (nextClonedChunk) {
481
+ clonedChunk.next = nextClonedChunk;
482
+ nextClonedChunk.previous = clonedChunk;
483
+ clonedChunk = nextClonedChunk;
484
+ }
485
+ originalChunk = nextOriginalChunk;
486
+ }
487
+ cloned.lastChunk = clonedChunk;
488
+ if (this.indentExclusionRanges) {
489
+ cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
490
+ }
491
+ cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);
492
+ cloned.intro = this.intro;
493
+ cloned.outro = this.outro;
494
+ return cloned;
495
+ }
496
+ generateDecodedMap(options) {
497
+ options = options || {};
498
+ const sourceIndex = 0;
499
+ const names = Object.keys(this.storedNames);
500
+ const mappings = new Mappings(options.hires);
501
+ const locate = getLocator(this.original);
502
+ if (this.intro) {
503
+ mappings.advance(this.intro);
504
+ }
505
+ this.firstChunk.eachNext((chunk) => {
506
+ const loc = locate(chunk.start);
507
+ if (chunk.intro.length) mappings.advance(chunk.intro);
508
+ if (chunk.edited) {
509
+ mappings.addEdit(
510
+ sourceIndex,
511
+ chunk.content,
512
+ loc,
513
+ chunk.storeName ? names.indexOf(chunk.original) : -1
514
+ );
515
+ } else {
516
+ mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
517
+ }
518
+ if (chunk.outro.length) mappings.advance(chunk.outro);
519
+ });
520
+ if (this.outro) {
521
+ mappings.advance(this.outro);
522
+ }
523
+ return {
524
+ file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
525
+ sources: [
526
+ options.source ? getRelativePath(options.file || "", options.source) : options.file || ""
527
+ ],
528
+ sourcesContent: options.includeContent ? [this.original] : void 0,
529
+ names,
530
+ mappings: mappings.raw,
531
+ x_google_ignoreList: this.ignoreList ? [sourceIndex] : void 0
532
+ };
533
+ }
534
+ generateMap(options) {
535
+ return new SourceMap(this.generateDecodedMap(options));
536
+ }
537
+ _ensureindentStr() {
538
+ if (this.indentStr === void 0) {
539
+ this.indentStr = guessIndent(this.original);
540
+ }
541
+ }
542
+ _getRawIndentString() {
543
+ this._ensureindentStr();
544
+ return this.indentStr;
545
+ }
546
+ getIndentString() {
547
+ this._ensureindentStr();
548
+ return this.indentStr === null ? " " : this.indentStr;
549
+ }
550
+ indent(indentStr, options) {
551
+ const pattern = /^[^\r\n]/gm;
552
+ if (isObject(indentStr)) {
553
+ options = indentStr;
554
+ indentStr = void 0;
555
+ }
556
+ if (indentStr === void 0) {
557
+ this._ensureindentStr();
558
+ indentStr = this.indentStr || " ";
559
+ }
560
+ if (indentStr === "") return this;
561
+ options = options || {};
562
+ const isExcluded = {};
563
+ if (options.exclude) {
564
+ const exclusions = typeof options.exclude[0] === "number" ? [options.exclude] : options.exclude;
565
+ exclusions.forEach((exclusion) => {
566
+ for (let i = exclusion[0]; i < exclusion[1]; i += 1) {
567
+ isExcluded[i] = true;
568
+ }
569
+ });
570
+ }
571
+ let shouldIndentNextCharacter = options.indentStart !== false;
572
+ const replacer = (match) => {
573
+ if (shouldIndentNextCharacter) return `${indentStr}${match}`;
574
+ shouldIndentNextCharacter = true;
575
+ return match;
576
+ };
577
+ this.intro = this.intro.replace(pattern, replacer);
578
+ let charIndex = 0;
579
+ let chunk = this.firstChunk;
580
+ while (chunk) {
581
+ const end = chunk.end;
582
+ if (chunk.edited) {
583
+ if (!isExcluded[charIndex]) {
584
+ chunk.content = chunk.content.replace(pattern, replacer);
585
+ if (chunk.content.length) {
586
+ shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === "\n";
587
+ }
588
+ }
589
+ } else {
590
+ charIndex = chunk.start;
591
+ while (charIndex < end) {
592
+ if (!isExcluded[charIndex]) {
593
+ const char = this.original[charIndex];
594
+ if (char === "\n") {
595
+ shouldIndentNextCharacter = true;
596
+ } else if (char !== "\r" && shouldIndentNextCharacter) {
597
+ shouldIndentNextCharacter = false;
598
+ if (charIndex === chunk.start) {
599
+ chunk.prependRight(indentStr);
600
+ } else {
601
+ this._splitChunk(chunk, charIndex);
602
+ chunk = chunk.next;
603
+ chunk.prependRight(indentStr);
604
+ }
605
+ }
606
+ }
607
+ charIndex += 1;
608
+ }
609
+ }
610
+ charIndex = chunk.end;
611
+ chunk = chunk.next;
612
+ }
613
+ this.outro = this.outro.replace(pattern, replacer);
614
+ return this;
615
+ }
616
+ insert() {
617
+ throw new Error(
618
+ "magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)"
619
+ );
620
+ }
621
+ insertLeft(index, content) {
622
+ if (!warned.insertLeft) {
623
+ console.warn(
624
+ "magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"
625
+ );
626
+ warned.insertLeft = true;
627
+ }
628
+ return this.appendLeft(index, content);
629
+ }
630
+ insertRight(index, content) {
631
+ if (!warned.insertRight) {
632
+ console.warn(
633
+ "magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"
634
+ );
635
+ warned.insertRight = true;
636
+ }
637
+ return this.prependRight(index, content);
638
+ }
639
+ move(start, end, index) {
640
+ start = start + this.offset;
641
+ end = end + this.offset;
642
+ index = index + this.offset;
643
+ if (index >= start && index <= end) throw new Error("Cannot move a selection inside itself");
644
+ this._split(start);
645
+ this._split(end);
646
+ this._split(index);
647
+ const first = this.byStart[start];
648
+ const last = this.byEnd[end];
649
+ const oldLeft = first.previous;
650
+ const oldRight = last.next;
651
+ const newRight = this.byStart[index];
652
+ if (!newRight && last === this.lastChunk) return this;
653
+ const newLeft = newRight ? newRight.previous : this.lastChunk;
654
+ if (oldLeft) oldLeft.next = oldRight;
655
+ if (oldRight) oldRight.previous = oldLeft;
656
+ if (newLeft) newLeft.next = first;
657
+ if (newRight) newRight.previous = last;
658
+ if (!first.previous) this.firstChunk = last.next;
659
+ if (!last.next) {
660
+ this.lastChunk = first.previous;
661
+ this.lastChunk.next = null;
662
+ }
663
+ first.previous = newLeft;
664
+ last.next = newRight || null;
665
+ if (!newLeft) this.firstChunk = first;
666
+ if (!newRight) this.lastChunk = last;
667
+ return this;
668
+ }
669
+ overwrite(start, end, content, options) {
670
+ options = options || {};
671
+ return this.update(start, end, content, { ...options, overwrite: !options.contentOnly });
672
+ }
673
+ update(start, end, content, options) {
674
+ start = start + this.offset;
675
+ end = end + this.offset;
676
+ if (typeof content !== "string") throw new TypeError("replacement content must be a string");
677
+ if (this.original.length !== 0) {
678
+ while (start < 0) start += this.original.length;
679
+ while (end < 0) end += this.original.length;
680
+ }
681
+ if (end > this.original.length) throw new Error("end is out of bounds");
682
+ if (start === end)
683
+ throw new Error(
684
+ "Cannot overwrite a zero-length range \u2013 use appendLeft or prependRight instead"
685
+ );
686
+ this._split(start);
687
+ this._split(end);
688
+ if (options === true) {
689
+ if (!warned.storeName) {
690
+ console.warn(
691
+ "The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"
692
+ );
693
+ warned.storeName = true;
694
+ }
695
+ options = { storeName: true };
696
+ }
697
+ const storeName = options !== void 0 ? options.storeName : false;
698
+ const overwrite = options !== void 0 ? options.overwrite : false;
699
+ if (storeName) {
700
+ const original = this.original.slice(start, end);
701
+ Object.defineProperty(this.storedNames, original, {
702
+ writable: true,
703
+ value: true,
704
+ enumerable: true
705
+ });
706
+ }
707
+ const first = this.byStart[start];
708
+ const last = this.byEnd[end];
709
+ if (first) {
710
+ let chunk = first;
711
+ while (chunk !== last) {
712
+ if (chunk.next !== this.byStart[chunk.end]) {
713
+ throw new Error("Cannot overwrite across a split point");
714
+ }
715
+ chunk = chunk.next;
716
+ chunk.edit("", false);
717
+ }
718
+ first.edit(content, storeName, !overwrite);
719
+ } else {
720
+ const newChunk = new Chunk(start, end, "").edit(content, storeName);
721
+ last.next = newChunk;
722
+ newChunk.previous = last;
723
+ }
724
+ return this;
725
+ }
726
+ prepend(content) {
727
+ if (typeof content !== "string") throw new TypeError("outro content must be a string");
728
+ this.intro = content + this.intro;
729
+ return this;
730
+ }
731
+ prependLeft(index, content) {
732
+ index = index + this.offset;
733
+ if (typeof content !== "string") throw new TypeError("inserted content must be a string");
734
+ this._split(index);
735
+ const chunk = this.byEnd[index];
736
+ if (chunk) {
737
+ chunk.prependLeft(content);
738
+ } else {
739
+ this.intro = content + this.intro;
740
+ }
741
+ return this;
742
+ }
743
+ prependRight(index, content) {
744
+ index = index + this.offset;
745
+ if (typeof content !== "string") throw new TypeError("inserted content must be a string");
746
+ this._split(index);
747
+ const chunk = this.byStart[index];
748
+ if (chunk) {
749
+ chunk.prependRight(content);
750
+ } else {
751
+ this.outro = content + this.outro;
752
+ }
753
+ return this;
754
+ }
755
+ remove(start, end) {
756
+ start = start + this.offset;
757
+ end = end + this.offset;
758
+ if (this.original.length !== 0) {
759
+ while (start < 0) start += this.original.length;
760
+ while (end < 0) end += this.original.length;
761
+ }
762
+ if (start === end) return this;
763
+ if (start < 0 || end > this.original.length) throw new Error("Character is out of bounds");
764
+ if (start > end) throw new Error("end must be greater than start");
765
+ this._split(start);
766
+ this._split(end);
767
+ let chunk = this.byStart[start];
768
+ while (chunk) {
769
+ chunk.intro = "";
770
+ chunk.outro = "";
771
+ chunk.edit("");
772
+ chunk = end > chunk.end ? this.byStart[chunk.end] : null;
773
+ }
774
+ return this;
775
+ }
776
+ reset(start, end) {
777
+ start = start + this.offset;
778
+ end = end + this.offset;
779
+ if (this.original.length !== 0) {
780
+ while (start < 0) start += this.original.length;
781
+ while (end < 0) end += this.original.length;
782
+ }
783
+ if (start === end) return this;
784
+ if (start < 0 || end > this.original.length) throw new Error("Character is out of bounds");
785
+ if (start > end) throw new Error("end must be greater than start");
786
+ this._split(start);
787
+ this._split(end);
788
+ let chunk = this.byStart[start];
789
+ while (chunk) {
790
+ chunk.reset();
791
+ chunk = end > chunk.end ? this.byStart[chunk.end] : null;
792
+ }
793
+ return this;
794
+ }
795
+ lastChar() {
796
+ if (this.outro.length) return this.outro[this.outro.length - 1];
797
+ let chunk = this.lastChunk;
798
+ do {
799
+ if (chunk.outro.length) return chunk.outro[chunk.outro.length - 1];
800
+ if (chunk.content.length) return chunk.content[chunk.content.length - 1];
801
+ if (chunk.intro.length) return chunk.intro[chunk.intro.length - 1];
802
+ } while (chunk = chunk.previous);
803
+ if (this.intro.length) return this.intro[this.intro.length - 1];
804
+ return "";
805
+ }
806
+ lastLine() {
807
+ let lineIndex = this.outro.lastIndexOf(n);
808
+ if (lineIndex !== -1) return this.outro.substr(lineIndex + 1);
809
+ let lineStr = this.outro;
810
+ let chunk = this.lastChunk;
811
+ do {
812
+ if (chunk.outro.length > 0) {
813
+ lineIndex = chunk.outro.lastIndexOf(n);
814
+ if (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr;
815
+ lineStr = chunk.outro + lineStr;
816
+ }
817
+ if (chunk.content.length > 0) {
818
+ lineIndex = chunk.content.lastIndexOf(n);
819
+ if (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr;
820
+ lineStr = chunk.content + lineStr;
821
+ }
822
+ if (chunk.intro.length > 0) {
823
+ lineIndex = chunk.intro.lastIndexOf(n);
824
+ if (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr;
825
+ lineStr = chunk.intro + lineStr;
826
+ }
827
+ } while (chunk = chunk.previous);
828
+ lineIndex = this.intro.lastIndexOf(n);
829
+ if (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr;
830
+ return this.intro + lineStr;
831
+ }
832
+ slice(start = 0, end = this.original.length - this.offset) {
833
+ start = start + this.offset;
834
+ end = end + this.offset;
835
+ if (this.original.length !== 0) {
836
+ while (start < 0) start += this.original.length;
837
+ while (end < 0) end += this.original.length;
838
+ }
839
+ let result = "";
840
+ let chunk = this.firstChunk;
841
+ while (chunk && (chunk.start > start || chunk.end <= start)) {
842
+ if (chunk.start < end && chunk.end >= end) {
843
+ return result;
844
+ }
845
+ chunk = chunk.next;
846
+ }
847
+ if (chunk && chunk.edited && chunk.start !== start)
848
+ throw new Error(`Cannot use replaced character ${start} as slice start anchor.`);
849
+ const startChunk = chunk;
850
+ while (chunk) {
851
+ if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
852
+ result += chunk.intro;
853
+ }
854
+ const containsEnd = chunk.start < end && chunk.end >= end;
855
+ if (containsEnd && chunk.edited && chunk.end !== end)
856
+ throw new Error(`Cannot use replaced character ${end} as slice end anchor.`);
857
+ const sliceStart = startChunk === chunk ? start - chunk.start : 0;
858
+ const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
859
+ result += chunk.content.slice(sliceStart, sliceEnd);
860
+ if (chunk.outro && (!containsEnd || chunk.end === end)) {
861
+ result += chunk.outro;
862
+ }
863
+ if (containsEnd) {
864
+ break;
865
+ }
866
+ chunk = chunk.next;
867
+ }
868
+ return result;
869
+ }
870
+ // TODO deprecate this? not really very useful
871
+ snip(start, end) {
872
+ const clone = this.clone();
873
+ clone.remove(0, start);
874
+ clone.remove(end, clone.original.length);
875
+ return clone;
876
+ }
877
+ _split(index) {
878
+ if (this.byStart[index] || this.byEnd[index]) return;
879
+ let chunk = this.lastSearchedChunk;
880
+ let previousChunk = chunk;
881
+ const searchForward = index > chunk.end;
882
+ while (chunk) {
883
+ if (chunk.contains(index)) return this._splitChunk(chunk, index);
884
+ chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
885
+ if (chunk === previousChunk) return;
886
+ previousChunk = chunk;
887
+ }
888
+ }
889
+ _splitChunk(chunk, index) {
890
+ if (chunk.edited && chunk.content.length) {
891
+ const loc = getLocator(this.original)(index);
892
+ throw new Error(
893
+ `Cannot split a chunk that has already been edited (${loc.line}:${loc.column} \u2013 "${chunk.original}")`
894
+ );
895
+ }
896
+ const newChunk = chunk.split(index);
897
+ this.byEnd[index] = chunk;
898
+ this.byStart[index] = newChunk;
899
+ this.byEnd[newChunk.end] = newChunk;
900
+ if (chunk === this.lastChunk) this.lastChunk = newChunk;
901
+ this.lastSearchedChunk = chunk;
902
+ return true;
903
+ }
904
+ toString() {
905
+ let str = this.intro;
906
+ let chunk = this.firstChunk;
907
+ while (chunk) {
908
+ str += chunk.toString();
909
+ chunk = chunk.next;
910
+ }
911
+ return str + this.outro;
912
+ }
913
+ isEmpty() {
914
+ let chunk = this.firstChunk;
915
+ do {
916
+ if (chunk.intro.length && chunk.intro.trim() || chunk.content.length && chunk.content.trim() || chunk.outro.length && chunk.outro.trim())
917
+ return false;
918
+ } while (chunk = chunk.next);
919
+ return true;
920
+ }
921
+ length() {
922
+ let chunk = this.firstChunk;
923
+ let length = 0;
924
+ do {
925
+ length += chunk.intro.length + chunk.content.length + chunk.outro.length;
926
+ } while (chunk = chunk.next);
927
+ return length;
928
+ }
929
+ trimLines() {
930
+ return this.trim("[\\r\\n]");
931
+ }
932
+ trim(charType) {
933
+ return this.trimStart(charType).trimEnd(charType);
934
+ }
935
+ trimEndAborted(charType) {
936
+ const rx = new RegExp((charType || "\\s") + "+$");
937
+ this.outro = this.outro.replace(rx, "");
938
+ if (this.outro.length) return true;
939
+ let chunk = this.lastChunk;
940
+ do {
941
+ const end = chunk.end;
942
+ const aborted = chunk.trimEnd(rx);
943
+ if (chunk.end !== end) {
944
+ if (this.lastChunk === chunk) {
945
+ this.lastChunk = chunk.next;
946
+ }
947
+ this.byEnd[chunk.end] = chunk;
948
+ this.byStart[chunk.next.start] = chunk.next;
949
+ this.byEnd[chunk.next.end] = chunk.next;
950
+ }
951
+ if (aborted) return true;
952
+ chunk = chunk.previous;
953
+ } while (chunk);
954
+ return false;
955
+ }
956
+ trimEnd(charType) {
957
+ this.trimEndAborted(charType);
958
+ return this;
959
+ }
960
+ trimStartAborted(charType) {
961
+ const rx = new RegExp("^" + (charType || "\\s") + "+");
962
+ this.intro = this.intro.replace(rx, "");
963
+ if (this.intro.length) return true;
964
+ let chunk = this.firstChunk;
965
+ do {
966
+ const end = chunk.end;
967
+ const aborted = chunk.trimStart(rx);
968
+ if (chunk.end !== end) {
969
+ if (chunk === this.lastChunk) this.lastChunk = chunk.next;
970
+ this.byEnd[chunk.end] = chunk;
971
+ this.byStart[chunk.next.start] = chunk.next;
972
+ this.byEnd[chunk.next.end] = chunk.next;
973
+ }
974
+ if (aborted) return true;
975
+ chunk = chunk.next;
976
+ } while (chunk);
977
+ return false;
978
+ }
979
+ trimStart(charType) {
980
+ this.trimStartAborted(charType);
981
+ return this;
982
+ }
983
+ hasChanged() {
984
+ return this.original !== this.toString();
985
+ }
986
+ _replaceRegexp(searchValue, replacement) {
987
+ function getReplacement(match, str) {
988
+ if (typeof replacement === "string") {
989
+ return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => {
990
+ if (i === "$") return "$";
991
+ if (i === "&") return match[0];
992
+ const num = +i;
993
+ if (num < match.length) return match[+i];
994
+ return `$${i}`;
995
+ });
996
+ } else {
997
+ return replacement(...match, match.index, str, match.groups);
998
+ }
999
+ }
1000
+ function matchAll(re, str) {
1001
+ let match;
1002
+ const matches = [];
1003
+ while (match = re.exec(str)) {
1004
+ matches.push(match);
1005
+ }
1006
+ return matches;
1007
+ }
1008
+ if (searchValue.global) {
1009
+ const matches = matchAll(searchValue, this.original);
1010
+ matches.forEach((match) => {
1011
+ if (match.index != null) {
1012
+ const replacement2 = getReplacement(match, this.original);
1013
+ if (replacement2 !== match[0]) {
1014
+ this.overwrite(match.index, match.index + match[0].length, replacement2);
1015
+ }
1016
+ }
1017
+ });
1018
+ } else {
1019
+ const match = this.original.match(searchValue);
1020
+ if (match && match.index != null) {
1021
+ const replacement2 = getReplacement(match, this.original);
1022
+ if (replacement2 !== match[0]) {
1023
+ this.overwrite(match.index, match.index + match[0].length, replacement2);
1024
+ }
1025
+ }
1026
+ }
1027
+ return this;
1028
+ }
1029
+ _replaceString(string, replacement) {
1030
+ const { original } = this;
1031
+ const index = original.indexOf(string);
1032
+ if (index !== -1) {
1033
+ if (typeof replacement === "function") {
1034
+ replacement = replacement(string, index, original);
1035
+ }
1036
+ if (string !== replacement) {
1037
+ this.overwrite(index, index + string.length, replacement);
1038
+ }
1039
+ }
1040
+ return this;
1041
+ }
1042
+ replace(searchValue, replacement) {
1043
+ if (typeof searchValue === "string") {
1044
+ return this._replaceString(searchValue, replacement);
1045
+ }
1046
+ return this._replaceRegexp(searchValue, replacement);
1047
+ }
1048
+ _replaceAllString(string, replacement) {
1049
+ const { original } = this;
1050
+ const stringLength = string.length;
1051
+ for (let index = original.indexOf(string); index !== -1; index = original.indexOf(string, index + stringLength)) {
1052
+ const previous = original.slice(index, index + stringLength);
1053
+ let _replacement = replacement;
1054
+ if (typeof replacement === "function") {
1055
+ _replacement = replacement(previous, index, original);
1056
+ }
1057
+ if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);
1058
+ }
1059
+ return this;
1060
+ }
1061
+ replaceAll(searchValue, replacement) {
1062
+ if (typeof searchValue === "string") {
1063
+ return this._replaceAllString(searchValue, replacement);
1064
+ }
1065
+ if (!searchValue.global) {
1066
+ throw new TypeError(
1067
+ "MagicString.prototype.replaceAll called with a non-global RegExp argument"
1068
+ );
1069
+ }
1070
+ return this._replaceRegexp(searchValue, replacement);
1071
+ }
1072
+ };
1073
+ export {
1074
+ MagicString
1075
+ };