@angular-wave/angular.ts 0.7.5 → 0.7.8

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 (174) hide show
  1. package/@types/animations/raf-scheduler.d.ts +2 -2
  2. package/@types/animations/shared.d.ts +0 -1
  3. package/@types/core/compile/attributes.d.ts +3 -3
  4. package/@types/core/compile/compile.d.ts +1 -1
  5. package/@types/core/di/injector.d.ts +0 -1
  6. package/@types/core/di/internal-injector.d.ts +1 -0
  7. package/@types/core/di/ng-module.d.ts +5 -0
  8. package/@types/core/filter/filter.d.ts +11 -13
  9. package/@types/core/sanitize/sanitize-uri.d.ts +3 -6
  10. package/@types/core/scope/scope.d.ts +1 -3
  11. package/@types/directive/attrs/attrs.d.ts +7 -1
  12. package/@types/directive/events/events.d.ts +9 -3
  13. package/@types/directive/http/http.d.ts +6 -2
  14. package/@types/directive/include/include.d.ts +2 -2
  15. package/@types/directive/input/input.d.ts +2 -12
  16. package/@types/directive/messages/messages.d.ts +9 -48
  17. package/@types/directive/model/model.d.ts +3 -3
  18. package/@types/directive/options/options.d.ts +13 -20
  19. package/@types/directive/setter/setter.d.ts +2 -2
  20. package/@types/directive/switch/switch.d.ts +1 -0
  21. package/@types/directive/transclude/transclude.d.ts +10 -6
  22. package/@types/interface.d.ts +54 -18
  23. package/@types/router/common/glob.d.ts +5 -1
  24. package/@types/router/directives/view-directive.d.ts +2 -19
  25. package/@types/router/globals.d.ts +1 -2
  26. package/@types/router/state/state-registry.d.ts +1 -2
  27. package/@types/router/url/url-service.d.ts +7 -9
  28. package/@types/services/anchor-scroll.d.ts +1 -1
  29. package/@types/{core → services/exception}/exception-handler.d.ts +4 -4
  30. package/@types/{core/error-handler.d.ts → services/exception/interface.d.ts} +1 -1
  31. package/@types/services/http/http.d.ts +0 -2
  32. package/@types/services/http/interface.d.ts +2 -2
  33. package/@types/services/http-backend/http-backend.d.ts +13 -21
  34. package/@types/services/location/interface.d.ts +8 -0
  35. package/@types/{core → services}/location/location.d.ts +52 -12
  36. package/@types/{core → services}/sce/sce.d.ts +1 -1
  37. package/@types/services/template-cache/interface.d.ts +8 -2
  38. package/@types/services/template-cache/template-cache.d.ts +1 -1
  39. package/@types/services/template-request.d.ts +1 -1
  40. package/@types/shared/cache.d.ts +0 -2
  41. package/@types/shared/dom.d.ts +6 -0
  42. package/@types/shared/test-utils.d.ts +1 -0
  43. package/@types/shared/url-utils/interface.d.ts +47 -0
  44. package/@types/{core → shared}/url-utils/url-utils.d.ts +26 -13
  45. package/@types/shared/utils.d.ts +23 -0
  46. package/Makefile +3 -2
  47. package/dist/angular-ts.esm.js +1188 -1364
  48. package/dist/angular-ts.umd.js +1188 -1364
  49. package/dist/angular-ts.umd.min.js +1 -1
  50. package/docs/assets/scss/index.scss +12 -0
  51. package/docs/content/_index.md +15 -4
  52. package/docs/content/docs/directive/bind.md +72 -0
  53. package/docs/content/docs/directive/click.md +3 -0
  54. package/docs/content/docs/directive/dblclick.md +3 -0
  55. package/docs/content/docs/directive/get.md +203 -0
  56. package/docs/content/docs/directive/keydown.md +38 -0
  57. package/docs/content/docs/directive/keyup.md +38 -0
  58. package/docs/content/docs/directive/load.md +43 -0
  59. package/docs/content/docs/provider/templateCacheProvider.md +66 -1
  60. package/docs/content/docs/service/templateCache.md +2 -2
  61. package/docs/layouts/partials/hooks/head-end.html +1 -1
  62. package/docs/layouts/shortcodes/showcss.html +2 -0
  63. package/docs/static/examples/ng-bind/ng-bind.html +9 -0
  64. package/docs/static/examples/ng-keydown/ng-keydown.html +9 -0
  65. package/docs/static/examples/ng-keyup/ng-keyup.html +9 -0
  66. package/docs/static/examples/ng-load/ng-load.html +8 -0
  67. package/docs/static/typedoc/assets/hierarchy.js +1 -1
  68. package/docs/static/typedoc/assets/navigation.js +1 -1
  69. package/docs/static/typedoc/assets/search.js +1 -1
  70. package/docs/static/typedoc/classes/NgModule.html +32 -0
  71. package/docs/static/typedoc/classes/TemplateCacheProvider.html +1 -1
  72. package/docs/static/typedoc/hierarchy.html +1 -1
  73. package/docs/static/typedoc/index.html +1 -1
  74. package/docs/static/typedoc/interfaces/Directive.html +5 -4
  75. package/docs/static/typedoc/interfaces/HttpProviderDefaults.html +1 -1
  76. package/docs/static/typedoc/interfaces/HttpResponse.html +2 -3
  77. package/docs/static/typedoc/interfaces/Provider.html +15 -10
  78. package/docs/static/typedoc/interfaces/RequestConfig.html +1 -1
  79. package/docs/static/typedoc/interfaces/RequestShortcutConfig.html +1 -1
  80. package/docs/static/typedoc/interfaces/TemplateCache.html +7 -0
  81. package/docs/static/typedoc/types/AnnotatedDirectiveFactory.html +1 -0
  82. package/docs/static/typedoc/types/DirectiveFactory.html +1 -2
  83. package/docs/static/typedoc/types/DirectiveFactoryFn.html +1 -0
  84. package/docs/static/typedoc/types/HttpResponseStatus.html +1 -0
  85. package/docs/static/typedoc/types/{TemplateCache.html → SwapModeType.html} +1 -1
  86. package/docs/static/typedoc/variables/SwapMode.html +11 -0
  87. package/legacy.d.ts +0 -14
  88. package/package.json +1 -3
  89. package/src/animations/animate-children-directive.js +2 -2
  90. package/src/animations/raf-scheduler.js +1 -1
  91. package/src/animations/shared.js +0 -9
  92. package/src/core/compile/attributes.js +1 -1
  93. package/src/core/compile/compile.js +3 -3
  94. package/src/core/di/injector.js +4 -17
  95. package/src/core/di/internal-injector.js +4 -1
  96. package/src/core/di/ng-module.js +12 -27
  97. package/src/core/filter/filter.js +28 -28
  98. package/src/core/parse/interpreter.js +32 -38
  99. package/src/core/sanitize/sanitize-uri.js +3 -3
  100. package/src/core/scope/scope.js +2 -7
  101. package/src/directive/attrs/attrs.js +7 -4
  102. package/src/directive/bind/bind.js +16 -4
  103. package/src/directive/bind/bind.spec.js +13 -0
  104. package/src/directive/events/events.js +7 -3
  105. package/src/directive/events/events.md +0 -41
  106. package/src/directive/http/delete.spec.js +2 -0
  107. package/src/directive/http/get.spec.js +280 -3
  108. package/src/directive/http/http.js +100 -12
  109. package/src/directive/http/http.test.js +2 -2
  110. package/src/directive/http/post.spec.js +2 -0
  111. package/src/directive/http/put.spec.js +2 -0
  112. package/src/directive/include/include.js +7 -7
  113. package/src/directive/input/input.js +6 -28
  114. package/src/directive/messages/messages.js +5 -1
  115. package/src/directive/model/model.js +1 -1
  116. package/src/directive/options/options.js +454 -464
  117. package/src/directive/repeat/repeat.js +175 -153
  118. package/src/directive/setter/setter.js +13 -15
  119. package/src/directive/setter/setter.spec.js +39 -16
  120. package/src/directive/switch/switch.js +1 -0
  121. package/src/directive/switch/switch.spec.js +1 -1
  122. package/src/directive/transclude/transclude.js +87 -89
  123. package/src/injection-tokens.js +1 -1
  124. package/src/interface.ts +68 -19
  125. package/src/loader.js +4 -9
  126. package/src/public.js +9 -15
  127. package/src/router/common/glob.js +5 -0
  128. package/src/router/directives/state-directives.js +4 -6
  129. package/src/router/directives/state-directives.spec.js +1 -1
  130. package/src/router/directives/view-directive.js +9 -1
  131. package/src/router/globals.js +0 -1
  132. package/src/router/state/state-registry.js +0 -1
  133. package/src/router/state-filters.js +2 -2
  134. package/src/router/url/url-service.js +5 -9
  135. package/src/services/anchor-scroll.html +0 -7
  136. package/src/services/anchor-scroll.js +2 -2
  137. package/src/{core → services/exception}/exception-handler.js +2 -2
  138. package/src/{core/error-handler.ts → services/exception/interface.ts} +1 -1
  139. package/src/services/http/http.js +2 -13
  140. package/src/services/http/interface.ts +2 -2
  141. package/src/services/http-backend/http-backend.js +4 -14
  142. package/src/services/http-backend/http-backend.spec.js +1 -4
  143. package/src/services/location/interface.ts +8 -0
  144. package/src/{core → services}/location/location.html +4 -1
  145. package/src/{core → services}/location/location.js +129 -27
  146. package/src/{core → services}/location/location.spec.js +2 -2
  147. package/src/{core → services}/location/location.test.js +1 -1
  148. package/src/{core → services}/sce/sce.html +1 -1
  149. package/src/{core → services}/sce/sce.js +9 -3
  150. package/src/{core → services}/sce/sce.spec.js +2 -3
  151. package/src/{core → services}/sce/sce.test.js +1 -1
  152. package/src/services/template-cache/interface.ts +8 -2
  153. package/src/services/template-cache/template-cache.js +3 -1
  154. package/src/services/template-cache/template-cache.spec.js +72 -0
  155. package/src/services/template-request.js +2 -1
  156. package/src/shared/cache.js +0 -2
  157. package/src/shared/dom.js +10 -0
  158. package/src/shared/test-utils.js +1 -0
  159. package/src/shared/url-utils/interface.ts +56 -0
  160. package/src/{core → shared}/url-utils/url-utils.html +4 -1
  161. package/src/{core → shared}/url-utils/url-utils.js +26 -23
  162. package/src/{core → shared}/url-utils/url-utils.spec.js +0 -8
  163. package/src/{core → shared}/url-utils/url-utils.test.js +1 -1
  164. package/src/shared/utils.js +47 -1
  165. package/utils/express.js +9 -1
  166. package/@types/core/task-tracker-factory.d.ts +0 -76
  167. package/@types/services/browser.d.ts +0 -101
  168. package/docs/static/typedoc/types/SwapInsertPosition.html +0 -2
  169. package/jsdoc.json +0 -22
  170. package/src/core/task-tracker-factory.js +0 -145
  171. package/src/services/browser.js +0 -212
  172. /package/src/{core → services}/location/location.md +0 -0
  173. /package/src/{core → services}/sce/sce.md +0 -0
  174. /package/src/{core → shared}/url-utils/url-utils.md +0 -0
@@ -1,4 +1,4 @@
1
- /* Version: 0.7.5 - July 12, 2025 01:24:07 */
1
+ /* Version: 0.7.8 - July 17, 2025 02:51:20 */
2
2
  const VALID_CLASS = "ng-valid";
3
3
  const INVALID_CLASS = "ng-invalid";
4
4
  const PRISTINE_CLASS = "ng-pristine";
@@ -241,7 +241,7 @@ function isWindow(obj) {
241
241
  * @returns {boolean}
242
242
  */
243
243
  function isScope(obj) {
244
- return obj && obj.$evalAsync && obj.$watch;
244
+ return obj && obj.$watch;
245
245
  }
246
246
 
247
247
  /**
@@ -1130,11 +1130,55 @@ function hasOwn(obj, key) {
1130
1130
  return Object.prototype.hasOwnProperty.call(obj, key);
1131
1131
  }
1132
1132
 
1133
+ /**
1134
+ * Wraps a function so it can only be called once.
1135
+ * Subsequent calls do nothing and return undefined.
1136
+ *
1137
+ * @param {Function} fn - The function to wrap.
1138
+ * @returns {Function} A new function that will call `fn` only once.
1139
+ */
1140
+ function callBackOnce(fn) {
1141
+ let called = false;
1142
+
1143
+ return function (...args) {
1144
+ if (!called) {
1145
+ called = true;
1146
+ return fn.apply(this, args);
1147
+ }
1148
+ };
1149
+ }
1150
+
1151
+ /**
1152
+ * Wraps a function so it will only be called starting from the second invocation.
1153
+ * The first call does nothing and returns undefined.
1154
+ *
1155
+ * @param {Function} fn - The function to wrap.
1156
+ * @returns {Function} A new function that will skip the first call.
1157
+ */
1158
+ function callBackAfterFirst(fn) {
1159
+ let calledOnce = false;
1160
+
1161
+ return function (...args) {
1162
+ if (calledOnce) {
1163
+ return fn.apply(this, args);
1164
+ }
1165
+ calledOnce = true;
1166
+ };
1167
+ }
1168
+
1169
+ /**
1170
+ * Delays execution for a specified number of milliseconds.
1171
+ *
1172
+ * @param {number} [t=0] - The number of milliseconds to wait. Defaults to 0.
1173
+ * @returns {Promise<void>} A promise that resolves after the delay.
1174
+ */
1175
+ function wait(t = 0) {
1176
+ return new Promise((resolve) => setTimeout(resolve, t));
1177
+ }
1178
+
1133
1179
  /**
1134
1180
  * Expando cache for adding properties to DOM nodes with JavaScript.
1135
1181
  * This used to be an Object in JQLite decorator, but swapped out for a Map
1136
- * for performance reasons and convenience methods. A proxy is available for
1137
- * additional logic handling.
1138
1182
  *
1139
1183
  * @type {Map<number, import('../interface.ts').ExpandoStore>}
1140
1184
  */
@@ -1687,6 +1731,16 @@ function extractElementNode$1(element) {
1687
1731
  }
1688
1732
  }
1689
1733
 
1734
+ /**
1735
+ * Returns the base href of the document.
1736
+ *
1737
+ * @returns {string} The base href.
1738
+ */
1739
+ function getBaseHref() {
1740
+ const href = document.querySelector("base")?.getAttribute("href");
1741
+ return href ? href.replace(/^(https?:)?\/\/[^/]*/, "") : "";
1742
+ }
1743
+
1690
1744
  /**
1691
1745
  * A helper list of tokens matching the standard injectables that come predefined in the core `ng` module.
1692
1746
  * These string tokens are commonly injected into services, directives, or components via `$inject`.
@@ -1719,7 +1773,7 @@ const $injectTokens = Object.freeze({
1719
1773
  $animate: "$animate",
1720
1774
  $animateCss: "$animateCss",
1721
1775
  $aria: "$aria",
1722
- $browser: "$browser",
1776
+ $compile: "$compile",
1723
1777
  $controller: "$controller",
1724
1778
  $eventBus: "$eventBus",
1725
1779
  $exceptionHandler: "$exceptionHandler",
@@ -1762,10 +1816,15 @@ function provider(services) {
1762
1816
  return services.map((x) => x + "Provider");
1763
1817
  }
1764
1818
 
1819
+ /** @private */
1765
1820
  const INJECTOR_LITERAL = "$injector";
1821
+ /** @private */
1766
1822
  const COMPILE_LITERAL = "$compileProvider";
1823
+ /** @private */
1767
1824
  const ANIMATION_LITERAL = "$animateProvider";
1825
+ /** @private */
1768
1826
  const FILTER_LITERAL = "$filterProvider";
1827
+ /** @private */
1769
1828
  const CONTROLLER_LITERAL = "$controllerProvider";
1770
1829
 
1771
1830
  /**
@@ -1832,11 +1891,7 @@ class NgModule {
1832
1891
  * @returns {NgModule}
1833
1892
  */
1834
1893
  constant(name, object) {
1835
- this.invokeQueue.unshift([
1836
- $injectTokens.$provide,
1837
- "constant",
1838
- [name, object],
1839
- ]);
1894
+ this.invokeQueue.unshift([$injectTokens.$provide, "constant", [name, object]]);
1840
1895
  return this;
1841
1896
  }
1842
1897
 
@@ -1881,11 +1936,7 @@ class NgModule {
1881
1936
  if (providerFunction && isFunction(providerFunction)) {
1882
1937
  providerFunction.$$moduleName = name;
1883
1938
  }
1884
- this.invokeQueue.push([
1885
- $injectTokens.$provide,
1886
- "factory",
1887
- [name, providerFunction],
1888
- ]);
1939
+ this.invokeQueue.push([$injectTokens.$provide, "factory", [name, providerFunction]]);
1889
1940
  return this;
1890
1941
  }
1891
1942
 
@@ -1898,11 +1949,7 @@ class NgModule {
1898
1949
  if (serviceFunction && isFunction(serviceFunction)) {
1899
1950
  serviceFunction.$$moduleName = name;
1900
1951
  }
1901
- this.invokeQueue.push([
1902
- $injectTokens.$provide,
1903
- "service",
1904
- [name, serviceFunction],
1905
- ]);
1952
+ this.invokeQueue.push([$injectTokens.$provide, "service", [name, serviceFunction]]);
1906
1953
  return this;
1907
1954
  }
1908
1955
 
@@ -1915,11 +1962,7 @@ class NgModule {
1915
1962
  if (providerType && isFunction(providerType)) {
1916
1963
  providerType.$$moduleName = name;
1917
1964
  }
1918
- this.invokeQueue.push([
1919
- $injectTokens.$provide,
1920
- "provider",
1921
- [name, providerType],
1922
- ]);
1965
+ this.invokeQueue.push([$injectTokens.$provide, "provider", [name, providerType]]);
1923
1966
  return this;
1924
1967
  }
1925
1968
 
@@ -1932,11 +1975,7 @@ class NgModule {
1932
1975
  if (decorFn && isFunction(decorFn)) {
1933
1976
  decorFn.$$moduleName = name;
1934
1977
  }
1935
- this.configBlocks.push([
1936
- $injectTokens.$provide,
1937
- "decorator",
1938
- [name, decorFn],
1939
- ]);
1978
+ this.configBlocks.push([$injectTokens.$provide, "decorator", [name, decorFn]]);
1940
1979
  return this;
1941
1980
  }
1942
1981
 
@@ -2181,8 +2220,11 @@ class InjectorService extends AbstractInjector {
2181
2220
  */
2182
2221
  constructor(providerInjector, strictDi) {
2183
2222
  super(strictDi);
2223
+
2224
+ /** @type {ProviderInjector} */
2184
2225
  this.providerInjector = providerInjector;
2185
- this.modules = this.providerInjector.modules;
2226
+ /** @type {Object.<string, import("./ng-module.js").NgModule>} */
2227
+ this.modules = providerInjector.modules;
2186
2228
  }
2187
2229
 
2188
2230
  /**
@@ -2299,9 +2341,6 @@ function createInjector(modulesToLoad, strictDi = false) {
2299
2341
  const loadedModules = new Map(); // Keep track of loaded modules to avoid circular dependencies
2300
2342
 
2301
2343
  const providerCache = {
2302
- /**
2303
- * @type {import('../../interface.ts').Provider}
2304
- */
2305
2344
  $provide: {
2306
2345
  provider: supportObject(provider),
2307
2346
  factory: supportObject(factory),
@@ -2328,15 +2367,10 @@ function createInjector(modulesToLoad, strictDi = false) {
2328
2367
  const runBlocks = loadModules(modulesToLoad);
2329
2368
  instanceInjector = protoInstanceInjector.get(INJECTOR_LITERAL);
2330
2369
 
2331
- runBlocks.forEach((fn) => {
2332
- if (fn) instanceInjector.invoke(fn);
2333
- });
2370
+ runBlocks.forEach((fn) => fn && instanceInjector.invoke(fn));
2334
2371
 
2335
- instanceInjector.loadNewModules = function (mods) {
2336
- loadModules(mods).forEach((fn) => {
2337
- if (fn) instanceInjector.invoke(fn);
2338
- });
2339
- };
2372
+ instanceInjector.loadNewModules = (mods) =>
2373
+ loadModules(mods).forEach((fn) => fn && instanceInjector.invoke(fn));
2340
2374
 
2341
2375
  return instanceInjector;
2342
2376
 
@@ -2465,7 +2499,7 @@ function createInjector(modulesToLoad, strictDi = false) {
2465
2499
 
2466
2500
  try {
2467
2501
  if (isString(module)) {
2468
- /** @type {import('./ng-module').NgModule} */
2502
+ /** @type {import('./ng-module.js').NgModule} */
2469
2503
  const moduleFn = window["angular"].module(module);
2470
2504
  instanceInjector.modules[/** @type {string } */ (module)] = moduleFn;
2471
2505
  runBlocks = runBlocks
@@ -2531,7 +2565,6 @@ function extractArgs(fn) {
2531
2565
  }
2532
2566
 
2533
2567
  /**
2534
- *
2535
2568
  * @param {any} fn
2536
2569
  * @param {boolean} [strictDi]
2537
2570
  * @param {String} [name]
@@ -2570,10 +2603,6 @@ function annotate(fn, strictDi, name) {
2570
2603
  return $inject;
2571
2604
  }
2572
2605
 
2573
- /**
2574
- * @param {function(string, any):any} delegate
2575
- * @returns {any}
2576
- */
2577
2606
  function supportObject(delegate) {
2578
2607
  return function (key, value) {
2579
2608
  if (isObject(key)) {
@@ -2989,32 +3018,25 @@ class ControllerProvider {
2989
3018
  }
2990
3019
  }
2991
3020
 
2992
- /**
2993
- * HTTP protocol
2994
- * @typedef {"http"|"https"} HttpProtocol
2995
- */
2996
-
2997
3021
  const urlParsingNode = document.createElement("a");
2998
3022
  const originUrl = urlResolve(window.location.href);
2999
3023
  let baseUrlParsingNode;
3000
3024
 
3001
3025
  urlParsingNode.href = "http://[::1]";
3002
3026
 
3027
+ /**
3028
+ * @param {import("./interface.js").ResolvableUrl} url
3029
+ * @return {import("./interface.js").ParsedUrl}
3030
+ */
3003
3031
  function urlResolve(url) {
3004
- if (!isString(url)) return url;
3032
+ if (!isString(url))
3033
+ return /** @type {import("./interface.js").ParsedUrl} */ (url);
3005
3034
 
3006
- const href = url;
3035
+ urlParsingNode.setAttribute("href", /** @type {string} */ (url));
3007
3036
 
3008
- urlParsingNode.setAttribute("href", href);
3009
-
3010
- let { hostname } = urlParsingNode;
3011
- // Support: IE 9-11 only, Edge 16-17 only (fixed in 18 Preview)
3012
- // IE/Edge don't wrap IPv6 addresses' hostnames in square brackets
3013
- // when parsed out of an anchor element.
3014
- const ipv6InBrackets = urlParsingNode.hostname === "[::1]";
3015
- if (!ipv6InBrackets && hostname.indexOf(":") > -1) {
3016
- hostname = `[${hostname}]`;
3017
- }
3037
+ const hostname = urlParsingNode.hostname.includes(":")
3038
+ ? `[${urlParsingNode.hostname}]`
3039
+ : urlParsingNode.hostname;
3018
3040
 
3019
3041
  return {
3020
3042
  href: urlParsingNode.href,
@@ -3039,7 +3061,7 @@ function urlResolve(url) {
3039
3061
  * Parse a request URL and determine whether this is a same-origin request as the application
3040
3062
  * document.
3041
3063
  *
3042
- * @param {string|object} requestUrl The url of the request as a string that will be resolved
3064
+ * @param {import("./interface.js").ResolvableUrl} requestUrl The url of the request as a string that will be resolved
3043
3065
  * or a parsed URL object.
3044
3066
  * @returns {boolean} Whether the request is for the same origin as the application document.
3045
3067
  */
@@ -3053,7 +3075,7 @@ function urlIsSameOrigin(requestUrl) {
3053
3075
  * Note: The base URL is usually the same as the document location (`location.href`) but can
3054
3076
  * be overriden by using the `<base>` tag.
3055
3077
  *
3056
- * @param {string|object} requestUrl The url of the request as a string that will be resolved
3078
+ * @param {import("./interface.js").ResolvableUrl} requestUrl The url of the request as a string that will be resolved
3057
3079
  * or a parsed URL object.
3058
3080
  * @returns {boolean} Whether the URL is same-origin as the document base URL.
3059
3081
  */
@@ -3067,7 +3089,7 @@ function urlIsSameOriginAsBaseUrl(requestUrl) {
3067
3089
  *
3068
3090
  * @param {string[]} trustedOriginUrls - A list of URLs (strings), whose origins are trusted.
3069
3091
  *
3070
- * @returns {Function} - A function that receives a URL (string or parsed URL object) and returns
3092
+ * @returns {(url: import("./interface.js").ResolvableUrl) => boolean } - A function that receives a URL (string or parsed URL object) and returns
3071
3093
  * whether it is of an allowed origin.
3072
3094
  */
3073
3095
  function urlIsAllowedOriginFactory(trustedOriginUrls) {
@@ -3080,7 +3102,7 @@ function urlIsAllowedOriginFactory(trustedOriginUrls) {
3080
3102
  * based on a list of trusted-origin URLs. The current location's origin is implicitly
3081
3103
  * trusted.
3082
3104
  *
3083
- * @param {string|Object} requestUrl - The URL to be checked (provided as a string that will be
3105
+ * @param {import("./interface.js").ResolvableUrl} requestUrl - The URL to be checked (provided as a string that will be
3084
3106
  * resolved or a parsed URL object).
3085
3107
  *
3086
3108
  * @returns {boolean} - Whether the specified URL is of an allowed origin.
@@ -3096,9 +3118,9 @@ function urlIsAllowedOriginFactory(trustedOriginUrls) {
3096
3118
  /**
3097
3119
  * Determine if two URLs share the same origin.
3098
3120
  *
3099
- * @param {string|Object} url1 - First URL to compare as a string or a normalized URL in the form of
3121
+ * @param {import("./interface.js").ResolvableUrl} url1 - First URL to compare as a string or a normalized URL in the form of
3100
3122
  * a dictionary object returned by `urlResolve()`.
3101
- * @param {string|object} url2 - Second URL to compare as a string or a normalized URL in the form
3123
+ * @param {import("./interface.js").ResolvableUrl} url2 - Second URL to compare as a string or a normalized URL in the form
3102
3124
  * of a dictionary object returned by `urlResolve()`.
3103
3125
  *
3104
3126
  * @returns {boolean} - True if both URLs have the same origin, and false otherwise.
@@ -3131,7 +3153,17 @@ function getBaseUrl() {
3131
3153
  return baseUrlParsingNode.href;
3132
3154
  }
3133
3155
 
3134
- /** @typedef {import("../error-handler.ts").ErrorHandler } ErrorHandler */
3156
+ /**
3157
+ * Removes a trailing hash ('#') from the given URL if it exists.
3158
+ *
3159
+ * @param {string} url
3160
+ * @returns {string}
3161
+ */
3162
+ function trimEmptyHash(url) {
3163
+ return url.replace(/#$/, "");
3164
+ }
3165
+
3166
+ /** @typedef {import("../exception/interface.ts").Interface } ErrorHandler */
3135
3167
 
3136
3168
  const $sceMinErr = minErr("$sce");
3137
3169
 
@@ -3187,6 +3219,7 @@ function adjustMatcher(matcher) {
3187
3219
  .replace(/\\\*/g, "[^:/.?&;]*");
3188
3220
  return new RegExp(`^${matcher}$`);
3189
3221
  }
3222
+
3190
3223
  if (isRegExp(matcher)) {
3191
3224
  // The only other type of matcher allowed is a Regexp.
3192
3225
  // Match entire URL / disallow partial matches.
@@ -3448,6 +3481,11 @@ class SceDelegateProvider {
3448
3481
  htmlSanitizer = $injector.get("$sanitize");
3449
3482
  }
3450
3483
 
3484
+ /**
3485
+ * @param {string|RegExp} matcher
3486
+ * @param {import("../../shared/url-utils/interface").ParsedUrl} parsedUrl
3487
+ * @return {boolean}
3488
+ */
3451
3489
  function matchUrl(matcher, parsedUrl) {
3452
3490
  if (matcher === "self") {
3453
3491
  return (
@@ -3455,7 +3493,7 @@ class SceDelegateProvider {
3455
3493
  );
3456
3494
  }
3457
3495
  // definitely a regex. See adjustMatchers()
3458
- return !!matcher.exec(parsedUrl.href);
3496
+ return !!(/** @type {RegExp} */ (matcher).exec(parsedUrl.href));
3459
3497
  }
3460
3498
 
3461
3499
  function isResourceUrlAllowedByPolicy(url) {
@@ -3960,9 +3998,13 @@ function SceProvider() {
3960
3998
  * A collection of directives that allows creation of custom event handlers that are defined as
3961
3999
  * AngularTS expressions and are compiled and executed within the current scope.
3962
4000
  */
4001
+
4002
+ /**
4003
+ * @type {Record<string, import("../../interface.js").DirectiveFactory>}
4004
+ */
3963
4005
  const ngEventDirectives = {};
3964
4006
 
3965
- "click copy cut dblclick focus blur keydown keyup keypress load mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup paste submit touchstart touchend touchmove"
4007
+ "click copy cut dblclick focus blur keydown keyup load mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup paste submit touchstart touchend touchmove"
3966
4008
  .split(" ")
3967
4009
  .forEach((eventName) => {
3968
4010
  const directiveName = directiveNormalize(`ng-${eventName}`);
@@ -3971,7 +4013,7 @@ const ngEventDirectives = {};
3971
4013
  "$exceptionHandler",
3972
4014
  /**
3973
4015
  * @param {import("../../core/parse/interface.ts").ParseService} $parse
3974
- * @param {import('../../core/exception-handler.js').ErrorHandler} $exceptionHandler
4016
+ * @param {import('../../services/exception/exception-handler.js').ErrorHandler} $exceptionHandler
3975
4017
  * @returns
3976
4018
  */
3977
4019
  ($parse, $exceptionHandler) => {
@@ -3988,7 +4030,7 @@ const ngEventDirectives = {};
3988
4030
  /**
3989
4031
  *
3990
4032
  * @param {import("../../core/parse/interface.ts").ParseService} $parse
3991
- * @param {import('../../core/exception-handler.js').ErrorHandler} $exceptionHandler
4033
+ * @param {import('../../services/exception/exception-handler.js').ErrorHandler} $exceptionHandler
3992
4034
  * @param {string} directiveName
3993
4035
  * @param {string} eventName
3994
4036
  * @returns {import("../../interface.ts").Directive}
@@ -4029,7 +4071,7 @@ class Attributes {
4029
4071
  /**
4030
4072
  * @param {import('../scope/scope.js').Scope} $rootScope
4031
4073
  * @param {*} $animate
4032
- * @param {import("../exception-handler.js").ErrorHandler} $exceptionHandler
4074
+ * @param {import("../../services/exception/exception-handler.js").ErrorHandler} $exceptionHandler
4033
4075
  * @param {*} $sce
4034
4076
  * @param {import("../../shared/noderef.js").NodeRef} [nodeRef]
4035
4077
  * @param {Object} [attributesToCopy]
@@ -4627,7 +4669,7 @@ class CompileProvider {
4627
4669
  "$exceptionHandler",
4628
4670
  /**
4629
4671
  * @param {import("../../core/di/internal-injector.js").InjectorService} $injector
4630
- * @param {import('../exception-handler.js').ErrorHandler} $exceptionHandler
4672
+ * @param {import('../../services/exception/exception-handler.js').ErrorHandler} $exceptionHandler
4631
4673
  */
4632
4674
  function ($injector, $exceptionHandler) {
4633
4675
  const directives = [];
@@ -4955,7 +4997,7 @@ class CompileProvider {
4955
4997
  /**
4956
4998
  * @param {import("../../core/di/internal-injector.js").InjectorService} $injector
4957
4999
  * @param {*} $interpolate
4958
- * @param {import("../exception-handler.js").ErrorHandler} $exceptionHandler
5000
+ * @param {import("../../services/exception/exception-handler.js").ErrorHandler} $exceptionHandler
4959
5001
  * @param {*} $templateRequest
4960
5002
  * @param {import("../parse/interface.ts").ParseService} $parse
4961
5003
  * @param {*} $controller
@@ -8440,7 +8482,7 @@ class NgModelController {
8440
8482
 
8441
8483
  /**
8442
8484
  * @param {import('../../core/scope/scope.js').Scope} $scope
8443
- * @param {import('../../core/exception-handler.js').ErrorHandler} $exceptionHandler
8485
+ * @param {import('../../services/exception/exception-handler.js').ErrorHandler} $exceptionHandler
8444
8486
  * @param {import('../../core/compile/attributes.js').Attributes} $attr
8445
8487
  * @param {Element} $element
8446
8488
  * @param {import("../../core/parse/interface.ts").ParseService} $parse
@@ -9837,7 +9879,6 @@ function createDateInputType(type, regexp, parseDate) {
9837
9879
  element,
9838
9880
  attr,
9839
9881
  ctrl,
9840
- $browser,
9841
9882
  $filter,
9842
9883
  $parse,
9843
9884
  ) {
@@ -10114,15 +10155,7 @@ function isValidForStep(viewValue, stepBase, step) {
10114
10155
  return (value - stepBase) % step === 0;
10115
10156
  }
10116
10157
 
10117
- function numberInputType(
10118
- scope,
10119
- element,
10120
- attr,
10121
- ctrl,
10122
- $browser,
10123
- $filter,
10124
- $parse,
10125
- ) {
10158
+ function numberInputType(scope, element, attr, ctrl, $filter, $parse) {
10126
10159
  badInputChecker(scope, element, attr, ctrl, "number");
10127
10160
  numberFormatterParser(ctrl);
10128
10161
  baseInputType(scope, element, attr, ctrl);
@@ -10438,15 +10471,7 @@ function parseConstantExpr($parse, context, name, expression, fallback) {
10438
10471
  return fallback;
10439
10472
  }
10440
10473
 
10441
- function checkboxInputType(
10442
- scope,
10443
- element,
10444
- attr,
10445
- ctrl,
10446
- $browser,
10447
- $filter,
10448
- $parse,
10449
- ) {
10474
+ function checkboxInputType(scope, element, attr, ctrl, $filter, $parse) {
10450
10475
  const trueValue = parseConstantExpr(
10451
10476
  $parse,
10452
10477
  scope,
@@ -10484,30 +10509,25 @@ function checkboxInputType(
10484
10509
  ctrl.$parsers.push((value) => (value ? trueValue : falseValue));
10485
10510
  }
10486
10511
 
10487
- /**
10488
- * @returns {import('../../interface.ts').Directive}
10489
- */
10490
- inputDirective.$inject = ["$browser", "$filter", "$parse"];
10512
+ inputDirective.$inject = ["$filter", "$parse"];
10491
10513
 
10492
10514
  /**
10493
- * @param {import('../../services/browser').Browser} $browser
10494
10515
  * @param {*} $filter
10495
10516
  * @param {*} $parse
10496
- * @returns
10517
+ * @returns {import('../../interface.ts').Directive}
10497
10518
  */
10498
- function inputDirective($browser, $filter, $parse) {
10519
+ function inputDirective($filter, $parse) {
10499
10520
  return {
10500
10521
  restrict: "E",
10501
10522
  require: ["?ngModel"],
10502
10523
  link: {
10503
10524
  pre(scope, element, attr, ctrls) {
10504
10525
  if (ctrls[0]) {
10505
- (inputType[lowercase(attr.type)] || inputType.text)(
10526
+ (inputType[lowercase(attr["type"])] || inputType.text)(
10506
10527
  scope,
10507
10528
  element,
10508
10529
  attr,
10509
10530
  ctrls[0],
10510
- $browser,
10511
10531
  $filter,
10512
10532
  $parse,
10513
10533
  );
@@ -11216,9 +11236,15 @@ function ngBindDirective() {
11216
11236
  * @param {import('../../core/compile/attributes.js').Attributes} attr
11217
11237
  */
11218
11238
  link(scope, element, attr) {
11219
- scope.$watch(attr["ngBind"], (value) => {
11220
- element.textContent = stringify$1(isProxy(value) ? value.$target : value);
11221
- });
11239
+ scope.$watch(
11240
+ attr["ngBind"],
11241
+ (value) => {
11242
+ element.textContent = stringify$1(
11243
+ isProxy(value) ? value.$target : value,
11244
+ );
11245
+ },
11246
+ isDefined(attr["lazy"]),
11247
+ );
11222
11248
  },
11223
11249
  };
11224
11250
  }
@@ -11620,7 +11646,7 @@ ngIncludeDirective.$inject = [
11620
11646
  * @param {*} $templateRequest
11621
11647
  * @param {import("../../services/anchor-scroll.js").AnchorScrollFunction} $anchorScroll
11622
11648
  * @param {*} $animate
11623
- * @param {import('../../core/error-handler.js').ErrorHandler} $exceptionHandler
11649
+ * @param {import('../../services/exception/interface.ts').Interface} $exceptionHandler
11624
11650
  * @returns {import('../../interface.js').Directive}
11625
11651
  */
11626
11652
  function ngIncludeDirective(
@@ -11739,7 +11765,7 @@ function ngIncludeDirective(
11739
11765
  // We need this directive so that the element content is already filled when
11740
11766
  // the link function of another directive on the same element as ngInclude
11741
11767
  // is called.
11742
- ngIncludeFillContentDirective.$inject = ["$compile"];
11768
+ ngIncludeFillContentDirective.$inject = [$injectTokens.$compile];
11743
11769
 
11744
11770
  /**
11745
11771
  * @param {import("../../core/compile/compile.js").CompileFn} $compile
@@ -11945,7 +11971,7 @@ function ngRepeatDirective($animate) {
11945
11971
  transclude: "element",
11946
11972
  priority: 1000,
11947
11973
  terminal: true,
11948
- compile: (_$element, $attr) => {
11974
+ compile: ($element, $attr) => {
11949
11975
  const expression = $attr["ngRepeat"];
11950
11976
  const hasAnimate = !!$attr["animate"];
11951
11977
 
@@ -11991,6 +12017,14 @@ function ngRepeatDirective($animate) {
11991
12017
  );
11992
12018
  }
11993
12019
 
12020
+ const swap = callBackOnce(() => {
12021
+ if (isDefined($attr["lazy"]) && isDefined($attr["swap"])) {
12022
+ document
12023
+ .querySelectorAll($attr["swap"])
12024
+ .forEach((x) => removeElement(x));
12025
+ }
12026
+ });
12027
+
11994
12028
  return function ngRepeatLink($scope, $element, $attr, ctrl, $transclude) {
11995
12029
  // Store a list of elements from previous run. This is a hash where key is the item from the
11996
12030
  // iterator, and the value is objects with following properties.
@@ -12002,174 +12036,181 @@ function ngRepeatDirective($animate) {
12002
12036
  // hasOwnProperty.
12003
12037
  let lastBlockMap = Object.create(null);
12004
12038
  // watch props
12005
- $scope.$watch(rhs, (collection) => {
12006
- let index,
12007
- length,
12008
- previousNode = $element, // node that cloned nodes should be inserted after
12009
- // initialized to the comment node anchor
12010
- nextNode;
12011
- const // Same as lastBlockMap but it has the current state. It will become the
12012
- // lastBlockMap on the next iteration.
12013
- nextBlockMap = Object.create(null);
12014
- let collectionLength,
12015
- key,
12016
- value, // key/value of iteration
12017
- trackById,
12018
- trackByIdFn,
12019
- collectionKeys,
12020
- block, // last object information {scope, element, id}
12021
- nextBlockOrder,
12022
- elementsToRemove;
12023
-
12024
- if (aliasAs) {
12025
- $scope[aliasAs] = collection;
12026
- }
12027
-
12028
- if (isArrayLike(collection)) {
12029
- collectionKeys = collection;
12030
- trackByIdFn = trackByIdArrayFn;
12031
- } else {
12032
- trackByIdFn = trackByIdObjFn;
12033
- // if object, extract keys, in enumeration order, unsorted
12034
- collectionKeys = [];
12035
- for (const itemKey in collection) {
12036
- if (hasOwn(collection, itemKey) && itemKey.charAt(0) !== "$") {
12037
- collectionKeys.push(itemKey);
12038
- }
12039
+ $scope.$watch(
12040
+ rhs,
12041
+ (collection) => {
12042
+ swap();
12043
+ let index,
12044
+ length,
12045
+ previousNode = $element, // node that cloned nodes should be inserted after
12046
+ // initialized to the comment node anchor
12047
+ nextNode;
12048
+ const // Same as lastBlockMap but it has the current state. It will become the
12049
+ // lastBlockMap on the next iteration.
12050
+ nextBlockMap = Object.create(null);
12051
+ let collectionLength,
12052
+ key,
12053
+ value, // key/value of iteration
12054
+ trackById,
12055
+ trackByIdFn,
12056
+ collectionKeys,
12057
+ block, // last object information {scope, element, id}
12058
+ nextBlockOrder,
12059
+ elementsToRemove;
12060
+
12061
+ if (aliasAs) {
12062
+ $scope[aliasAs] = collection;
12039
12063
  }
12040
- }
12041
12064
 
12042
- collectionLength = collectionKeys.length;
12043
- nextBlockOrder = new Array(collectionLength);
12044
-
12045
- // locate existing items
12046
- for (index = 0; index < collectionLength; index++) {
12047
- key = collection === collectionKeys ? index : collectionKeys[index];
12048
- value = collection[key];
12049
- trackById = trackByIdFn($scope, key, value);
12050
- if (lastBlockMap[trackById]) {
12051
- // found previously seen block
12052
- block = lastBlockMap[trackById];
12053
- delete lastBlockMap[trackById];
12054
- nextBlockMap[trackById] = block;
12055
- nextBlockOrder[index] = block;
12056
- } else if (nextBlockMap[trackById]) {
12057
- // if collision detected. restore lastBlockMap and throw an error
12058
- Object.values(nextBlockOrder).forEach((block) => {
12059
- if (block && block.scope) lastBlockMap[block.id] = block;
12060
- });
12061
- throw ngRepeatMinErr(
12062
- "dupes",
12063
- "Duplicates keys in a repeater are not allowed. Repeater: {0}, Duplicate key: {1} for value: {2}",
12064
- expression,
12065
- trackById,
12066
- value,
12067
- );
12065
+ if (isArrayLike(collection)) {
12066
+ collectionKeys = collection;
12067
+ trackByIdFn = trackByIdArrayFn;
12068
12068
  } else {
12069
- // new never before seen block
12070
- nextBlockOrder[index] = {
12071
- id: trackById,
12072
- scope: undefined,
12073
- clone: undefined,
12074
- };
12075
- nextBlockMap[trackById] = true;
12069
+ trackByIdFn = trackByIdObjFn;
12070
+ // if object, extract keys, in enumeration order, unsorted
12071
+ collectionKeys = [];
12072
+ for (const itemKey in collection) {
12073
+ if (hasOwn(collection, itemKey) && itemKey.charAt(0) !== "$") {
12074
+ collectionKeys.push(itemKey);
12075
+ }
12076
+ }
12076
12077
  }
12077
- }
12078
12078
 
12079
- // remove leftover items
12080
- for (let blockKey in lastBlockMap) {
12081
- block = lastBlockMap[blockKey];
12082
- elementsToRemove = block.clone;
12083
- if (hasAnimate) {
12084
- $animate.leave(elementsToRemove);
12085
- } else {
12086
- elementsToRemove.remove();
12079
+ collectionLength = collectionKeys.length;
12080
+ nextBlockOrder = new Array(collectionLength);
12081
+
12082
+ // locate existing items
12083
+ for (index = 0; index < collectionLength; index++) {
12084
+ key =
12085
+ collection === collectionKeys ? index : collectionKeys[index];
12086
+ value = collection[key];
12087
+ trackById = trackByIdFn($scope, key, value);
12088
+ if (lastBlockMap[trackById]) {
12089
+ // found previously seen block
12090
+ block = lastBlockMap[trackById];
12091
+ delete lastBlockMap[trackById];
12092
+ nextBlockMap[trackById] = block;
12093
+ nextBlockOrder[index] = block;
12094
+ } else if (nextBlockMap[trackById]) {
12095
+ // if collision detected. restore lastBlockMap and throw an error
12096
+ Object.values(nextBlockOrder).forEach((block) => {
12097
+ if (block && block.scope) lastBlockMap[block.id] = block;
12098
+ });
12099
+ throw ngRepeatMinErr(
12100
+ "dupes",
12101
+ "Duplicates keys in a repeater are not allowed. Repeater: {0}, Duplicate key: {1} for value: {2}",
12102
+ expression,
12103
+ trackById,
12104
+ value,
12105
+ );
12106
+ } else {
12107
+ // new never before seen block
12108
+ nextBlockOrder[index] = {
12109
+ id: trackById,
12110
+ scope: undefined,
12111
+ clone: undefined,
12112
+ };
12113
+ nextBlockMap[trackById] = true;
12114
+ }
12087
12115
  }
12088
- if (elementsToRemove.parentNode) {
12089
- // if the element was not removed yet because of pending animation, mark it as deleted
12090
- // so that we can ignore it later
12091
- for (
12092
- index = 0, length = elementsToRemove.length;
12093
- index < length;
12094
- index++
12095
- ) {
12096
- elementsToRemove[index][NG_REMOVED] = true;
12116
+
12117
+ // remove leftover items
12118
+ for (let blockKey in lastBlockMap) {
12119
+ block = lastBlockMap[blockKey];
12120
+ elementsToRemove = block.clone;
12121
+ if (hasAnimate) {
12122
+ $animate.leave(elementsToRemove);
12123
+ } else {
12124
+ elementsToRemove.remove();
12097
12125
  }
12126
+ if (elementsToRemove.parentNode) {
12127
+ // if the element was not removed yet because of pending animation, mark it as deleted
12128
+ // so that we can ignore it later
12129
+ for (
12130
+ index = 0, length = elementsToRemove.length;
12131
+ index < length;
12132
+ index++
12133
+ ) {
12134
+ elementsToRemove[index][NG_REMOVED] = true;
12135
+ }
12136
+ }
12137
+ block.scope.$destroy();
12098
12138
  }
12099
- block.scope.$destroy();
12100
- }
12101
12139
 
12102
- for (index = 0; index < collectionLength; index++) {
12103
- key = collection === collectionKeys ? index : collectionKeys[index];
12104
- value = collection[key];
12105
- block = nextBlockOrder[index];
12140
+ for (index = 0; index < collectionLength; index++) {
12141
+ key =
12142
+ collection === collectionKeys ? index : collectionKeys[index];
12143
+ value = collection[key];
12144
+ block = nextBlockOrder[index];
12106
12145
 
12107
- if (block.scope) {
12108
- // if we have already seen this object, then we need to reuse the
12109
- // associated scope/element
12146
+ if (block.scope) {
12147
+ // if we have already seen this object, then we need to reuse the
12148
+ // associated scope/element
12110
12149
 
12111
- nextNode = previousNode;
12150
+ nextNode = previousNode;
12112
12151
 
12113
- // skip nodes that are already pending removal via leave animation
12114
- do {
12115
- nextNode = nextNode.nextSibling;
12116
- } while (nextNode && nextNode[NG_REMOVED]);
12152
+ // skip nodes that are already pending removal via leave animation
12153
+ do {
12154
+ nextNode = nextNode.nextSibling;
12155
+ } while (nextNode && nextNode[NG_REMOVED]);
12117
12156
 
12118
- if (getBlockStart(block) !== nextNode) {
12119
- // existing item which got moved
12120
- $animate.move(getBlockNodes(block.clone), null, previousNode);
12121
- }
12122
- previousNode = getBlockEnd(block);
12123
- updateScope(
12124
- block.scope,
12125
- index,
12126
- valueIdentifier,
12127
- value,
12128
- keyIdentifier,
12129
- key,
12130
- collectionLength,
12131
- );
12132
- } else {
12133
- // new item which we don't know about
12134
- $transclude(
12135
- /**
12136
- * Clone attach function
12137
- * @param {Array<NodeList>} clone
12138
- * @param {import("../../core/scope/scope.js").Scope} scope
12139
- */
12140
-
12141
- (clone, scope) => {
12142
- block.scope = scope;
12143
- const endNode = clone;
12144
- if (hasAnimate) {
12145
- $animate.enter(clone, null, previousNode);
12146
- } else {
12147
- // @ts-ignore
12148
- previousNode.after(clone);
12149
- }
12157
+ if (getBlockStart(block) !== nextNode) {
12158
+ // existing item which got moved
12159
+ $animate.move(getBlockNodes(block.clone), null, previousNode);
12160
+ }
12161
+ previousNode = getBlockEnd(block);
12162
+ updateScope(
12163
+ block.scope,
12164
+ index,
12165
+ valueIdentifier,
12166
+ value,
12167
+ keyIdentifier,
12168
+ key,
12169
+ collectionLength,
12170
+ );
12171
+ } else {
12172
+ // new item which we don't know about
12173
+ $transclude(
12174
+ /**
12175
+ * Clone attach function
12176
+ * @param {Array<NodeList>} clone
12177
+ * @param {import("../../core/scope/scope.js").Scope} scope
12178
+ */
12150
12179
 
12151
- // @ts-ignore
12152
- previousNode = endNode;
12153
- // Note: We only need the first/last node of the cloned nodes.
12154
- // However, we need to keep the reference to the dom wrapper as it might be changed later
12155
- // by a directive with templateUrl when its template arrives.
12156
- block.clone = clone;
12157
- nextBlockMap[block.id] = block;
12158
- updateScope(
12159
- block.scope,
12160
- index,
12161
- valueIdentifier,
12162
- value,
12163
- keyIdentifier,
12164
- key,
12165
- collectionLength,
12166
- );
12167
- },
12168
- );
12180
+ (clone, scope) => {
12181
+ block.scope = scope;
12182
+ const endNode = clone;
12183
+ if (hasAnimate) {
12184
+ $animate.enter(clone, null, previousNode);
12185
+ } else {
12186
+ // @ts-ignore
12187
+ previousNode.after(clone);
12188
+ }
12189
+
12190
+ // @ts-ignore
12191
+ previousNode = endNode;
12192
+ // Note: We only need the first/last node of the cloned nodes.
12193
+ // However, we need to keep the reference to the dom wrapper as it might be changed later
12194
+ // by a directive with templateUrl when its template arrives.
12195
+ block.clone = clone;
12196
+ nextBlockMap[block.id] = block;
12197
+ updateScope(
12198
+ block.scope,
12199
+ index,
12200
+ valueIdentifier,
12201
+ value,
12202
+ keyIdentifier,
12203
+ key,
12204
+ collectionLength,
12205
+ );
12206
+ },
12207
+ );
12208
+ }
12169
12209
  }
12170
- }
12171
- lastBlockMap = nextBlockMap;
12172
- });
12210
+ lastBlockMap = nextBlockMap;
12211
+ },
12212
+ isDefined($attr["lazy"]),
12213
+ );
12173
12214
  };
12174
12215
  },
12175
12216
  };
@@ -12206,6 +12247,7 @@ function ngStyleDirective() {
12206
12247
  ngSwitchDirective.$inject = ["$animate"];
12207
12248
 
12208
12249
  /**
12250
+ * @param {*} $animate
12209
12251
  * @returns {import('../../interface.ts').Directive}
12210
12252
  */
12211
12253
  function ngSwitchDirective($animate) {
@@ -12353,525 +12395,515 @@ const NG_OPTIONS_REGEXP =
12353
12395
  // 8: collection expression
12354
12396
  // 9: track by expression
12355
12397
 
12356
- const ngOptionsDirective = [
12357
- "$compile",
12358
- "$parse",
12398
+ ngOptionsDirective.$inject = ["$compile", "$parse"];
12399
+ /**
12400
+ *
12401
+ * @param {import("../../core/compile/compile.js").CompileFn} $compile
12402
+ * @param {import("../../core/parse/interface.ts").ParseService} $parse
12403
+ * @returns {import("../../interface.ts").Directive}
12404
+ */
12405
+ function ngOptionsDirective($compile, $parse) {
12359
12406
  /**
12360
- *
12361
- * @param {import("../../core/compile/compile.js").CompileFn} $compile
12362
- * @param {import("../../core/parse/interface.ts").ParseService} $parse
12407
+ * @param {import('../../interface.ts').Expression} optionsExp
12408
+ * @param {HTMLSelectElement} selectElement
12409
+ * @param {import('../../core/scope/scope.js').Scope} scope
12363
12410
  * @returns
12364
12411
  */
12365
- function ($compile, $parse) {
12366
- /**
12367
- * @param {import('../../interface.ts').Expression} optionsExp
12368
- * @param {HTMLSelectElement} selectElement
12369
- * @param {import('../../core/scope/scope.js').Scope} scope
12370
- * @returns
12371
- */
12372
- function parseOptionsExpression(optionsExp, selectElement, scope) {
12373
- const match = optionsExp.match(NG_OPTIONS_REGEXP);
12374
- if (!match) {
12375
- throw ngOptionsMinErr(
12376
- "iexp",
12377
- "Expected expression in form of " +
12378
- "'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'" +
12379
- " but got '{0}'. Element: {1}",
12380
- optionsExp,
12381
- startingTag(selectElement),
12382
- );
12383
- }
12384
- // Extract the parts from the ngOptions expression
12385
-
12386
- // The variable name for the value of the item in the collection
12387
- const valueName = match[5] || match[7];
12388
- // The variable name for the key of the item in the collection
12389
- const keyName = match[6];
12390
-
12391
- // An expression that generates the viewValue for an option if there is a label expression
12392
- const selectAs = / as /.test(match[0]) && match[1];
12393
- // An expression that is used to track the id of each object in the options collection
12394
- const trackBy = match[9];
12395
- // An expression that generates the viewValue for an option if there is no label expression
12396
- const valueFn = $parse(match[2] ? match[1] : valueName);
12397
- const selectAsFn = selectAs && $parse(selectAs);
12398
- const viewValueFn = selectAsFn || valueFn;
12399
- const trackByFn = trackBy && $parse(trackBy);
12400
-
12401
- // Get the value by which we are going to track the option
12402
- // if we have a trackFn then use that (passing scope and locals)
12403
- // otherwise just hash the given viewValue
12404
- const getTrackByValueFn = trackBy
12405
- ? function (value, locals) {
12406
- return trackByFn(scope, locals);
12407
- }
12408
- : function getHashOfValue(value) {
12409
- return hashKey(value);
12410
- };
12411
- const getTrackByValue = function (value, key) {
12412
- return getTrackByValueFn(value, getLocals(value, key));
12413
- };
12412
+ function parseOptionsExpression(optionsExp, selectElement, scope) {
12413
+ const match = optionsExp.match(NG_OPTIONS_REGEXP);
12414
+ if (!match) {
12415
+ throw ngOptionsMinErr(
12416
+ "iexp",
12417
+ "Expected expression in form of " +
12418
+ "'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'" +
12419
+ " but got '{0}'. Element: {1}",
12420
+ optionsExp,
12421
+ startingTag(selectElement),
12422
+ );
12423
+ }
12424
+ // Extract the parts from the ngOptions expression
12425
+
12426
+ // The variable name for the value of the item in the collection
12427
+ const valueName = match[5] || match[7];
12428
+ // The variable name for the key of the item in the collection
12429
+ const keyName = match[6];
12430
+
12431
+ // An expression that generates the viewValue for an option if there is a label expression
12432
+ const selectAs = / as /.test(match[0]) && match[1];
12433
+ // An expression that is used to track the id of each object in the options collection
12434
+ const trackBy = match[9];
12435
+ // An expression that generates the viewValue for an option if there is no label expression
12436
+ const valueFn = $parse(match[2] ? match[1] : valueName);
12437
+ const selectAsFn = selectAs && $parse(selectAs);
12438
+ const viewValueFn = selectAsFn || valueFn;
12439
+ const trackByFn = trackBy && $parse(trackBy);
12440
+
12441
+ // Get the value by which we are going to track the option
12442
+ // if we have a trackFn then use that (passing scope and locals)
12443
+ // otherwise just hash the given viewValue
12444
+ const getTrackByValueFn = trackBy
12445
+ ? function (value, locals) {
12446
+ return trackByFn(scope, locals);
12447
+ }
12448
+ : function getHashOfValue(value) {
12449
+ return hashKey(value);
12450
+ };
12451
+ const getTrackByValue = function (value, key) {
12452
+ return getTrackByValueFn(value, getLocals(value, key));
12453
+ };
12414
12454
 
12415
- const displayFn = $parse(match[2] || match[1]);
12416
- const groupByFn = $parse(match[3] || "");
12417
- const disableWhenFn = $parse(match[4] || "");
12418
- const valuesFn = $parse(match[8]);
12419
-
12420
- const locals = {};
12421
- let getLocals = keyName
12422
- ? function (value, key) {
12423
- locals[keyName] = key;
12424
- locals[valueName] = value;
12425
- return locals;
12426
- }
12427
- : function (value) {
12428
- locals[valueName] = value;
12429
- return locals;
12430
- };
12455
+ const displayFn = $parse(match[2] || match[1]);
12456
+ const groupByFn = $parse(match[3] || "");
12457
+ const disableWhenFn = $parse(match[4] || "");
12458
+ const valuesFn = $parse(match[8]);
12459
+
12460
+ const locals = {};
12461
+ let getLocals = keyName
12462
+ ? function (value, key) {
12463
+ locals[keyName] = key;
12464
+ locals[valueName] = value;
12465
+ return locals;
12466
+ }
12467
+ : function (value) {
12468
+ locals[valueName] = value;
12469
+ return locals;
12470
+ };
12431
12471
 
12432
- class Option {
12433
- constructor(selectValue, viewValue, label, group, disabled) {
12434
- this.selectValue = selectValue;
12435
- this.viewValue = viewValue;
12436
- this.label = label;
12437
- this.group = group;
12438
- this.disabled = disabled;
12439
- }
12472
+ class Option {
12473
+ constructor(selectValue, viewValue, label, group, disabled) {
12474
+ this.selectValue = selectValue;
12475
+ this.viewValue = viewValue;
12476
+ this.label = label;
12477
+ this.group = group;
12478
+ this.disabled = disabled;
12440
12479
  }
12480
+ }
12441
12481
 
12442
- function getOptionValuesKeys(optionValues) {
12443
- let optionValuesKeys;
12482
+ function getOptionValuesKeys(optionValues) {
12483
+ let optionValuesKeys;
12444
12484
 
12445
- if (!keyName && isArrayLike(optionValues)) {
12446
- optionValuesKeys = optionValues;
12447
- } else {
12448
- // if object, extract keys, in enumeration order, unsorted
12449
- optionValuesKeys = [];
12450
- for (const itemKey in optionValues) {
12451
- if (hasOwn(optionValues, itemKey) && itemKey.charAt(0) !== "$") {
12452
- optionValuesKeys.push(itemKey);
12453
- }
12485
+ if (!keyName && isArrayLike(optionValues)) {
12486
+ optionValuesKeys = optionValues;
12487
+ } else {
12488
+ // if object, extract keys, in enumeration order, unsorted
12489
+ optionValuesKeys = [];
12490
+ for (const itemKey in optionValues) {
12491
+ if (hasOwn(optionValues, itemKey) && itemKey.charAt(0) !== "$") {
12492
+ optionValuesKeys.push(itemKey);
12454
12493
  }
12455
12494
  }
12456
- return optionValuesKeys;
12457
12495
  }
12496
+ return optionValuesKeys;
12497
+ }
12458
12498
 
12459
- return {
12460
- trackBy,
12461
- getTrackByValue,
12462
- getWatchables: $parse(valuesFn, (optionValues) => {
12463
- // Create a collection of things that we would like to watch (watchedArray)
12464
- // so that they can all be watched using a single $watchCollection
12465
- // that only runs the handler once if anything changes
12466
- const watchedArray = [];
12467
- optionValues = optionValues || [];
12468
-
12469
- const optionValuesKeys = getOptionValuesKeys(optionValues);
12470
- const optionValuesLength = optionValuesKeys.length;
12471
- for (let index = 0; index < optionValuesLength; index++) {
12472
- const key =
12473
- optionValues === optionValuesKeys
12474
- ? index
12475
- : optionValuesKeys[index];
12476
- const value = optionValues[key];
12477
-
12478
- const locals = getLocals(value, key);
12479
- const selectValue = getTrackByValueFn(value, locals);
12480
- watchedArray.push(selectValue);
12481
-
12482
- // Only need to watch the displayFn if there is a specific label expression
12483
- if (match[2] || match[1]) {
12484
- const label = displayFn(scope, locals);
12485
- watchedArray.push(label);
12486
- }
12487
-
12488
- // Only need to watch the disableWhenFn if there is a specific disable expression
12489
- if (match[4]) {
12490
- const disableWhen = disableWhenFn(scope, locals);
12491
- watchedArray.push(disableWhen);
12492
- }
12493
- }
12494
- return watchedArray;
12495
- }),
12496
-
12497
- getOptions() {
12498
- /** @type {Option[]} */
12499
- const optionItems = [];
12500
- /** @type {Object.<string, Option>} */
12501
- const selectValueMap = {};
12502
-
12503
- // The option values were already computed in the `getWatchables` fn,
12504
- // which must have been called to trigger `getOptions`
12505
- const optionValues = valuesFn(scope) || [];
12506
- const optionValuesKeys = getOptionValuesKeys(optionValues);
12507
- const optionValuesLength = optionValuesKeys.length;
12508
-
12509
- for (let index = 0; index < optionValuesLength; index++) {
12510
- const key =
12511
- optionValues === optionValuesKeys
12512
- ? index
12513
- : optionValuesKeys[index];
12514
- const value = optionValues[key];
12515
- const locals = getLocals(value, key);
12516
- const viewValue = viewValueFn(scope, locals);
12517
- const selectValue = getTrackByValueFn(viewValue, locals);
12499
+ return {
12500
+ trackBy,
12501
+ getTrackByValue,
12502
+ getWatchables: $parse(valuesFn, (optionValues) => {
12503
+ // Create a collection of things that we would like to watch (watchedArray)
12504
+ // so that they can all be watched using a single $watchCollection
12505
+ // that only runs the handler once if anything changes
12506
+ const watchedArray = [];
12507
+ optionValues = optionValues || [];
12508
+
12509
+ const optionValuesKeys = getOptionValuesKeys(optionValues);
12510
+ const optionValuesLength = optionValuesKeys.length;
12511
+ for (let index = 0; index < optionValuesLength; index++) {
12512
+ const key =
12513
+ optionValues === optionValuesKeys ? index : optionValuesKeys[index];
12514
+ const value = optionValues[key];
12515
+
12516
+ const locals = getLocals(value, key);
12517
+ const selectValue = getTrackByValueFn(value, locals);
12518
+ watchedArray.push(selectValue);
12519
+
12520
+ // Only need to watch the displayFn if there is a specific label expression
12521
+ if (match[2] || match[1]) {
12518
12522
  const label = displayFn(scope, locals);
12519
- const group = groupByFn(scope, locals);
12520
- const disabled = disableWhenFn(scope, locals);
12521
- const optionItem = new Option(
12522
- selectValue,
12523
- viewValue,
12524
- label,
12525
- group,
12526
- disabled,
12527
- );
12523
+ watchedArray.push(label);
12524
+ }
12525
+
12526
+ // Only need to watch the disableWhenFn if there is a specific disable expression
12527
+ if (match[4]) {
12528
+ const disableWhen = disableWhenFn(scope, locals);
12529
+ watchedArray.push(disableWhen);
12530
+ }
12531
+ }
12532
+ return watchedArray;
12533
+ }),
12534
+
12535
+ getOptions() {
12536
+ /** @type {Option[]} */
12537
+ const optionItems = [];
12538
+ /** @type {Object.<string, Option>} */
12539
+ const selectValueMap = {};
12540
+
12541
+ // The option values were already computed in the `getWatchables` fn,
12542
+ // which must have been called to trigger `getOptions`
12543
+ const optionValues = valuesFn(scope) || [];
12544
+ const optionValuesKeys = getOptionValuesKeys(optionValues);
12545
+ const optionValuesLength = optionValuesKeys.length;
12546
+
12547
+ for (let index = 0; index < optionValuesLength; index++) {
12548
+ const key =
12549
+ optionValues === optionValuesKeys ? index : optionValuesKeys[index];
12550
+ const value = optionValues[key];
12551
+ const locals = getLocals(value, key);
12552
+ const viewValue = viewValueFn(scope, locals);
12553
+ const selectValue = getTrackByValueFn(viewValue, locals);
12554
+ const label = displayFn(scope, locals);
12555
+ const group = groupByFn(scope, locals);
12556
+ const disabled = disableWhenFn(scope, locals);
12557
+ const optionItem = new Option(
12558
+ selectValue,
12559
+ viewValue,
12560
+ label,
12561
+ group,
12562
+ disabled,
12563
+ );
12528
12564
 
12529
- optionItems.push(optionItem);
12530
- selectValueMap[selectValue] = optionItem;
12531
- }
12565
+ optionItems.push(optionItem);
12566
+ selectValueMap[selectValue] = optionItem;
12567
+ }
12532
12568
 
12533
- return {
12534
- items: optionItems,
12535
- selectValueMap,
12536
- getOptionFromViewValue(value) {
12537
- return selectValueMap[getTrackByValue(value)];
12538
- },
12539
- getViewValueFromOption(option) {
12540
- // If the viewValue could be an object that may be mutated by the application,
12541
- // we need to make a copy and not return the reference to the value on the option.
12542
- return trackBy
12543
- ? structuredClone(option.viewValue)
12544
- : option.viewValue;
12545
- },
12546
- };
12547
- },
12548
- };
12549
- }
12569
+ return {
12570
+ items: optionItems,
12571
+ selectValueMap,
12572
+ getOptionFromViewValue(value) {
12573
+ return selectValueMap[getTrackByValue(value)];
12574
+ },
12575
+ getViewValueFromOption(option) {
12576
+ // If the viewValue could be an object that may be mutated by the application,
12577
+ // we need to make a copy and not return the reference to the value on the option.
12578
+ return trackBy
12579
+ ? structuredClone(option.viewValue)
12580
+ : option.viewValue;
12581
+ },
12582
+ };
12583
+ },
12584
+ };
12585
+ }
12550
12586
 
12551
- /**
12552
- *
12553
- * @param {import("../../core/scope/scope.js").Scope} scope
12554
- * @param {HTMLSelectElement} selectElement
12555
- * @param {import("../../core/compile/attributes.js").Attributes} attr
12556
- * @param {*} ctrls
12557
- */
12558
- function ngOptionsPostLink(scope, selectElement, attr, ctrls) {
12559
- const selectCtrl = ctrls[0];
12560
- const ngModelCtrl = ctrls[1];
12561
- const multiple = attr["multiple"];
12562
-
12563
- // The emptyOption allows the application developer to provide their own custom "empty"
12564
- // option when the viewValue does not match any of the option values.
12565
- for (
12566
- let i = 0, children = selectElement.childNodes, ii = children.length;
12567
- i < ii;
12568
- i++
12569
- ) {
12570
- if (/** @type {HTMLOptionElement} */ (children[i]).value === "") {
12571
- selectCtrl.hasEmptyOption = true;
12572
- selectCtrl.emptyOption = children[i];
12573
- break;
12574
- }
12587
+ /**
12588
+ *
12589
+ * @param {import("../../core/scope/scope.js").Scope} scope
12590
+ * @param {HTMLSelectElement} selectElement
12591
+ * @param {import("../../core/compile/attributes.js").Attributes} attr
12592
+ * @param {*} ctrls
12593
+ */
12594
+ function ngOptionsPostLink(scope, selectElement, attr, ctrls) {
12595
+ const selectCtrl = ctrls[0];
12596
+ const ngModelCtrl = ctrls[1];
12597
+ const multiple = attr["multiple"];
12598
+
12599
+ // The emptyOption allows the application developer to provide their own custom "empty"
12600
+ // option when the viewValue does not match any of the option values.
12601
+ for (
12602
+ let i = 0, children = selectElement.childNodes, ii = children.length;
12603
+ i < ii;
12604
+ i++
12605
+ ) {
12606
+ if (/** @type {HTMLOptionElement} */ (children[i]).value === "") {
12607
+ selectCtrl.hasEmptyOption = true;
12608
+ selectCtrl.emptyOption = children[i];
12609
+ break;
12575
12610
  }
12611
+ }
12576
12612
 
12577
- // The empty option will be compiled and rendered before we first generate the options
12578
- emptyElement(selectElement);
12613
+ // The empty option will be compiled and rendered before we first generate the options
12614
+ emptyElement(selectElement);
12579
12615
 
12580
- const providedEmptyOption = !!selectCtrl.emptyOption;
12616
+ const providedEmptyOption = !!selectCtrl.emptyOption;
12581
12617
 
12582
- const unknownOption = optionTemplate.cloneNode(false);
12583
- // TODO double check
12584
- unknownOption.nodeValue = "?";
12618
+ const unknownOption = optionTemplate.cloneNode(false);
12619
+ // TODO double check
12620
+ unknownOption.nodeValue = "?";
12585
12621
 
12586
- let options;
12587
- const ngOptions = parseOptionsExpression(
12588
- attr["ngOptions"],
12589
- selectElement,
12590
- scope,
12591
- );
12592
- // This stores the newly created options before they are appended to the select.
12593
- // Since the contents are removed from the fragment when it is appended,
12594
- // we only need to create it once.
12595
- const listFragment = document.createDocumentFragment();
12596
-
12597
- // Overwrite the implementation. ngOptions doesn't use hashes
12598
- selectCtrl.generateUnknownOptionValue = () => "?";
12599
-
12600
- // Update the controller methods for multiple selectable options
12601
- if (!multiple) {
12602
- selectCtrl.writeValue = function writeNgOptionsValue(value) {
12603
- // The options might not be defined yet when ngModel tries to render
12604
- if (!options) return;
12605
-
12606
- const selectedOption =
12607
- selectElement.options[selectElement.selectedIndex];
12608
- const option = options.getOptionFromViewValue(value);
12609
-
12610
- // Make sure to remove the selected attribute from the previously selected option
12611
- // Otherwise, screen readers might get confused
12612
- if (selectedOption) selectedOption.removeAttribute("selected");
12613
-
12614
- if (option) {
12615
- // Don't update the option when it is already selected.
12616
- // For example, the browser will select the first option by default. In that case,
12617
- // most properties are set automatically - except the `selected` attribute, which we
12618
- // set always
12619
-
12620
- if (selectElement.value !== option.selectValue) {
12621
- selectCtrl.removeUnknownOption();
12622
-
12623
- selectElement.value = option.selectValue;
12624
- option.element.selected = true;
12625
- }
12622
+ let options;
12623
+ const ngOptions = parseOptionsExpression(
12624
+ attr["ngOptions"],
12625
+ selectElement,
12626
+ scope,
12627
+ );
12628
+ // This stores the newly created options before they are appended to the select.
12629
+ // Since the contents are removed from the fragment when it is appended,
12630
+ // we only need to create it once.
12631
+ const listFragment = document.createDocumentFragment();
12632
+
12633
+ // Overwrite the implementation. ngOptions doesn't use hashes
12634
+ selectCtrl.generateUnknownOptionValue = () => "?";
12635
+
12636
+ // Update the controller methods for multiple selectable options
12637
+ if (!multiple) {
12638
+ selectCtrl.writeValue = function writeNgOptionsValue(value) {
12639
+ // The options might not be defined yet when ngModel tries to render
12640
+ if (!options) return;
12641
+
12642
+ const selectedOption =
12643
+ selectElement.options[selectElement.selectedIndex];
12644
+ const option = options.getOptionFromViewValue(value);
12645
+
12646
+ // Make sure to remove the selected attribute from the previously selected option
12647
+ // Otherwise, screen readers might get confused
12648
+ if (selectedOption) selectedOption.removeAttribute("selected");
12649
+
12650
+ if (option) {
12651
+ // Don't update the option when it is already selected.
12652
+ // For example, the browser will select the first option by default. In that case,
12653
+ // most properties are set automatically - except the `selected` attribute, which we
12654
+ // set always
12655
+
12656
+ if (selectElement.value !== option.selectValue) {
12657
+ selectCtrl.removeUnknownOption();
12626
12658
 
12627
- option.element.setAttribute("selected", "selected");
12628
- } else {
12629
- selectCtrl.selectUnknownOrEmptyOption(value);
12659
+ selectElement.value = option.selectValue;
12660
+ option.element.selected = true;
12630
12661
  }
12631
- };
12632
12662
 
12633
- selectCtrl.readValue = function readNgOptionsValue() {
12634
- const selectedOption = options.selectValueMap[selectElement.value];
12663
+ option.element.setAttribute("selected", "selected");
12664
+ } else {
12665
+ selectCtrl.selectUnknownOrEmptyOption(value);
12666
+ }
12667
+ };
12635
12668
 
12636
- if (selectedOption && !selectedOption.disabled) {
12637
- selectCtrl.unselectEmptyOption();
12638
- selectCtrl.removeUnknownOption();
12639
- return options.getViewValueFromOption(selectedOption);
12640
- }
12641
- return null;
12642
- };
12669
+ selectCtrl.readValue = function readNgOptionsValue() {
12670
+ const selectedOption = options.selectValueMap[selectElement.value];
12643
12671
 
12644
- // If we are using `track by` then we must watch the tracked value on the model
12645
- // since ngModel only watches for object identity change
12646
- // FIXME: When a user selects an option, this watch will fire needlessly
12647
- if (ngOptions.trackBy) {
12648
- scope.$watch(
12649
- ngOptions.getTrackByValue(ngModelCtrl.$viewValue),
12650
- () => {
12651
- ngModelCtrl.$render();
12652
- },
12653
- );
12672
+ if (selectedOption && !selectedOption.disabled) {
12673
+ selectCtrl.unselectEmptyOption();
12674
+ selectCtrl.removeUnknownOption();
12675
+ return options.getViewValueFromOption(selectedOption);
12654
12676
  }
12655
- } else {
12656
- selectCtrl.writeValue = function writeNgOptionsMultiple(values) {
12657
- // The options might not be defined yet when ngModel tries to render
12658
- if (!options) return;
12659
-
12660
- // Only set `<option>.selected` if necessary, in order to prevent some browsers from
12661
- // scrolling to `<option>` elements that are outside the `<select>` element's viewport.
12662
- const selectedOptions =
12663
- (values && values.map(getAndUpdateSelectedOption)) || [];
12664
-
12665
- options.items.forEach((option) => {
12666
- if (option.element.selected && !includes(selectedOptions, option)) {
12667
- option.element.selected = false;
12668
- }
12669
- });
12670
- };
12677
+ return null;
12678
+ };
12671
12679
 
12672
- selectCtrl.readValue = function readNgOptionsMultiple() {
12673
- const selectedValues = selectElement.value || [];
12674
- const selections = [];
12675
- // @ts-ignore
12676
- selectedValues.forEach((value) => {
12677
- const option = options.selectValueMap[value];
12678
- if (option && !option.disabled)
12679
- selections.push(options.getViewValueFromOption(option));
12680
- });
12680
+ // If we are using `track by` then we must watch the tracked value on the model
12681
+ // since ngModel only watches for object identity change
12682
+ // FIXME: When a user selects an option, this watch will fire needlessly
12683
+ if (ngOptions.trackBy) {
12684
+ scope.$watch(ngOptions.getTrackByValue(ngModelCtrl.$viewValue), () => {
12685
+ ngModelCtrl.$render();
12686
+ });
12687
+ }
12688
+ } else {
12689
+ selectCtrl.writeValue = function writeNgOptionsMultiple(values) {
12690
+ // The options might not be defined yet when ngModel tries to render
12691
+ if (!options) return;
12681
12692
 
12682
- return selections;
12683
- };
12693
+ // Only set `<option>.selected` if necessary, in order to prevent some browsers from
12694
+ // scrolling to `<option>` elements that are outside the `<select>` element's viewport.
12695
+ const selectedOptions =
12696
+ (values && values.map(getAndUpdateSelectedOption)) || [];
12684
12697
 
12685
- // If we are using `track by` then we must watch these tracked values on the model
12686
- // since ngModel only watches for object identity change
12687
- // if (ngOptions.trackBy) {
12688
- // scope.$watchCollection(
12689
- // () => {
12690
- // if (Array.isArray(ngModelCtrl.$viewValue)) {
12691
- // return ngModelCtrl.$viewValue.map((value) =>
12692
- // ngOptions.getTrackByValue(value),
12693
- // );
12694
- // }
12695
- // },
12696
- // () => {
12697
- // ngModelCtrl.$render();
12698
- // },
12699
- // );
12700
- // }
12701
- }
12698
+ options.items.forEach((option) => {
12699
+ if (option.element.selected && !includes(selectedOptions, option)) {
12700
+ option.element.selected = false;
12701
+ }
12702
+ });
12703
+ };
12702
12704
 
12703
- if (providedEmptyOption) {
12704
- // compile the element since there might be bindings in it
12705
- const linkFn = $compile(selectCtrl.emptyOption);
12706
- assertArg$1(linkFn, "LinkFn required");
12707
- selectElement.prepend(selectCtrl.emptyOption);
12708
- linkFn(scope);
12705
+ selectCtrl.readValue = function readNgOptionsMultiple() {
12706
+ const selectedValues = selectElement.value || [];
12707
+ const selections = [];
12708
+ // @ts-ignore
12709
+ selectedValues.forEach((value) => {
12710
+ const option = options.selectValueMap[value];
12711
+ if (option && !option.disabled)
12712
+ selections.push(options.getViewValueFromOption(option));
12713
+ });
12714
+
12715
+ return selections;
12716
+ };
12709
12717
 
12710
- if (selectCtrl.emptyOption.nodeType === Node.COMMENT_NODE) {
12711
- // This means the empty option has currently no actual DOM node, probably because
12712
- // it has been modified by a transclusion directive.
12713
- selectCtrl.hasEmptyOption = false;
12718
+ // If we are using `track by` then we must watch these tracked values on the model
12719
+ // since ngModel only watches for object identity change
12720
+ // if (ngOptions.trackBy) {
12721
+ // scope.$watchCollection(
12722
+ // () => {
12723
+ // if (Array.isArray(ngModelCtrl.$viewValue)) {
12724
+ // return ngModelCtrl.$viewValue.map((value) =>
12725
+ // ngOptions.getTrackByValue(value),
12726
+ // );
12727
+ // }
12728
+ // },
12729
+ // () => {
12730
+ // ngModelCtrl.$render();
12731
+ // },
12732
+ // );
12733
+ // }
12734
+ }
12714
12735
 
12715
- // Redefine the registerOption function, which will catch
12716
- // options that are added by ngIf etc. (rendering of the node is async because of
12717
- // lazy transclusion)
12718
- selectCtrl.registerOption = function (optionScope, optionEl) {
12719
- if (optionEl.value === "") {
12720
- selectCtrl.hasEmptyOption = true;
12721
- selectCtrl.emptyOption = optionEl;
12722
- // This ensures the new empty option is selected if previously no option was selected
12723
- ngModelCtrl.$render();
12736
+ if (providedEmptyOption) {
12737
+ // compile the element since there might be bindings in it
12738
+ const linkFn = $compile(selectCtrl.emptyOption);
12739
+ assertArg$1(linkFn, "LinkFn required");
12740
+ selectElement.prepend(selectCtrl.emptyOption);
12741
+ linkFn(scope);
12742
+
12743
+ if (selectCtrl.emptyOption.nodeType === Node.COMMENT_NODE) {
12744
+ // This means the empty option has currently no actual DOM node, probably because
12745
+ // it has been modified by a transclusion directive.
12746
+ selectCtrl.hasEmptyOption = false;
12747
+
12748
+ // Redefine the registerOption function, which will catch
12749
+ // options that are added by ngIf etc. (rendering of the node is async because of
12750
+ // lazy transclusion)
12751
+ selectCtrl.registerOption = function (optionScope, optionEl) {
12752
+ if (optionEl.value === "") {
12753
+ selectCtrl.hasEmptyOption = true;
12754
+ selectCtrl.emptyOption = optionEl;
12755
+ // This ensures the new empty option is selected if previously no option was selected
12756
+ ngModelCtrl.$render();
12724
12757
 
12725
- optionEl.addEventListener("$destroy", () => {
12726
- const needsRerender = selectCtrl.$isEmptyOptionSelected();
12758
+ optionEl.addEventListener("$destroy", () => {
12759
+ const needsRerender = selectCtrl.$isEmptyOptionSelected();
12727
12760
 
12728
- selectCtrl.hasEmptyOption = false;
12729
- selectCtrl.emptyOption = undefined;
12761
+ selectCtrl.hasEmptyOption = false;
12762
+ selectCtrl.emptyOption = undefined;
12730
12763
 
12731
- if (needsRerender) ngModelCtrl.$render();
12732
- });
12733
- }
12734
- };
12735
- }
12764
+ if (needsRerender) ngModelCtrl.$render();
12765
+ });
12766
+ }
12767
+ };
12736
12768
  }
12769
+ }
12737
12770
 
12738
- // We will re-render the option elements if the option values or labels change
12771
+ // We will re-render the option elements if the option values or labels change
12739
12772
 
12740
- // let watchables = ngOptions.getWatchables();
12741
- // watchables.forEach((i) => {
12742
- // scope.$watch(i, updateOptions);
12743
- // });
12744
- scope.$watch(
12745
- ngOptions.getWatchables.decoratedNode.body[0].expression.name,
12746
- updateOptions,
12747
- );
12773
+ // let watchables = ngOptions.getWatchables();
12774
+ // watchables.forEach((i) => {
12775
+ // scope.$watch(i, updateOptions);
12776
+ // });
12777
+ scope.$watch(
12778
+ ngOptions.getWatchables.decoratedNode.body[0].expression.name,
12779
+ updateOptions,
12780
+ );
12748
12781
 
12749
- // ------------------------------------------------------------------ //
12782
+ // ------------------------------------------------------------------ //
12750
12783
 
12751
- function addOptionElement(option, parent) {
12752
- /**
12753
- * @type {HTMLOptionElement}
12754
- */
12755
- const optionElement = /** @type {HTMLOptionElement} */ (
12756
- optionTemplate.cloneNode(false)
12757
- );
12758
- parent.appendChild(optionElement);
12759
- updateOptionElement(option, optionElement);
12760
- }
12784
+ function addOptionElement(option, parent) {
12785
+ /**
12786
+ * @type {HTMLOptionElement}
12787
+ */
12788
+ const optionElement = /** @type {HTMLOptionElement} */ (
12789
+ optionTemplate.cloneNode(false)
12790
+ );
12791
+ parent.appendChild(optionElement);
12792
+ updateOptionElement(option, optionElement);
12793
+ }
12761
12794
 
12762
- function getAndUpdateSelectedOption(viewValue) {
12763
- const option = options.getOptionFromViewValue(viewValue);
12764
- const element = option && option.element;
12795
+ function getAndUpdateSelectedOption(viewValue) {
12796
+ const option = options.getOptionFromViewValue(viewValue);
12797
+ const element = option && option.element;
12765
12798
 
12766
- if (element && !element.selected) element.selected = true;
12799
+ if (element && !element.selected) element.selected = true;
12767
12800
 
12768
- return option;
12769
- }
12801
+ return option;
12802
+ }
12770
12803
 
12771
- function updateOptionElement(option, element) {
12772
- option.element = element;
12773
- element.disabled = option.disabled;
12774
- // Support: IE 11 only, Edge 12-13 only
12775
- // NOTE: The label must be set before the value, otherwise IE 11 & Edge create unresponsive
12776
- // selects in certain circumstances when multiple selects are next to each other and display
12777
- // the option list in listbox style, i.e. the select is [multiple], or specifies a [size].
12778
- // See https://github.com/angular/angular.js/issues/11314 for more info.
12779
- // This is unfortunately untestable with unit / e2e tests
12780
- if (option.label !== element.label) {
12781
- element.label = option.label;
12782
- element.textContent = option.label;
12783
- }
12784
- element.value = option.selectValue;
12804
+ function updateOptionElement(option, element) {
12805
+ option.element = element;
12806
+ element.disabled = option.disabled;
12807
+ // Support: IE 11 only, Edge 12-13 only
12808
+ // NOTE: The label must be set before the value, otherwise IE 11 & Edge create unresponsive
12809
+ // selects in certain circumstances when multiple selects are next to each other and display
12810
+ // the option list in listbox style, i.e. the select is [multiple], or specifies a [size].
12811
+ // See https://github.com/angular/angular.js/issues/11314 for more info.
12812
+ // This is unfortunately untestable with unit / e2e tests
12813
+ if (option.label !== element.label) {
12814
+ element.label = option.label;
12815
+ element.textContent = option.label;
12785
12816
  }
12817
+ element.value = option.selectValue;
12818
+ }
12786
12819
 
12787
- function updateOptions() {
12788
- const previousValue = options && selectCtrl.readValue();
12820
+ function updateOptions() {
12821
+ const previousValue = options && selectCtrl.readValue();
12789
12822
 
12790
- // We must remove all current options, but cannot simply set innerHTML = null
12791
- // since the providedEmptyOption might have an ngIf on it that inserts comments which we
12792
- // must preserve.
12793
- // Instead, iterate over the current option elements and remove them or their optgroup
12794
- // parents
12795
- if (options) {
12796
- for (let i = options.items.length - 1; i >= 0; i--) {
12797
- const option = options.items[i];
12798
- if (isDefined(option.group)) {
12799
- removeElement(option.element.parentNode);
12800
- } else {
12801
- removeElement(option.element);
12802
- }
12823
+ // We must remove all current options, but cannot simply set innerHTML = null
12824
+ // since the providedEmptyOption might have an ngIf on it that inserts comments which we
12825
+ // must preserve.
12826
+ // Instead, iterate over the current option elements and remove them or their optgroup
12827
+ // parents
12828
+ if (options) {
12829
+ for (let i = options.items.length - 1; i >= 0; i--) {
12830
+ const option = options.items[i];
12831
+ if (isDefined(option.group)) {
12832
+ removeElement(option.element.parentNode);
12833
+ } else {
12834
+ removeElement(option.element);
12803
12835
  }
12804
12836
  }
12837
+ }
12805
12838
 
12806
- options = ngOptions.getOptions();
12839
+ options = ngOptions.getOptions();
12807
12840
 
12808
- const groupElementMap = {};
12841
+ const groupElementMap = {};
12809
12842
 
12810
- options.items.forEach((option) => {
12811
- let groupElement;
12843
+ options.items.forEach((option) => {
12844
+ let groupElement;
12812
12845
 
12813
- if (isDefined(option.group)) {
12814
- // This option is to live in a group
12815
- // See if we have already created this group
12816
- groupElement = groupElementMap[option.group];
12817
-
12818
- if (!groupElement) {
12819
- groupElement = optGroupTemplate.cloneNode(false);
12820
- listFragment.appendChild(groupElement);
12821
-
12822
- // Update the label on the group element
12823
- // "null" is special cased because of Safari
12824
- /** @type {HTMLOptGroupElement} */
12825
- (groupElement).label =
12826
- option.group === null ? "null" : option.group;
12827
-
12828
- // Store it for use later
12829
- groupElementMap[option.group] = groupElement;
12830
- }
12846
+ if (isDefined(option.group)) {
12847
+ // This option is to live in a group
12848
+ // See if we have already created this group
12849
+ groupElement = groupElementMap[option.group];
12831
12850
 
12832
- addOptionElement(option, groupElement);
12833
- } else {
12834
- // This option is not in a group
12835
- addOptionElement(option, listFragment);
12851
+ if (!groupElement) {
12852
+ groupElement = optGroupTemplate.cloneNode(false);
12853
+ listFragment.appendChild(groupElement);
12854
+
12855
+ // Update the label on the group element
12856
+ // "null" is special cased because of Safari
12857
+ /** @type {HTMLOptGroupElement} */
12858
+ (groupElement).label =
12859
+ option.group === null ? "null" : option.group;
12860
+
12861
+ // Store it for use later
12862
+ groupElementMap[option.group] = groupElement;
12836
12863
  }
12837
- });
12838
12864
 
12839
- selectElement.appendChild(listFragment);
12865
+ addOptionElement(option, groupElement);
12866
+ } else {
12867
+ // This option is not in a group
12868
+ addOptionElement(option, listFragment);
12869
+ }
12870
+ });
12840
12871
 
12841
- ngModelCtrl.$render();
12872
+ selectElement.appendChild(listFragment);
12842
12873
 
12843
- // Check to see if the value has changed due to the update to the options
12844
- if (!ngModelCtrl.$isEmpty(previousValue)) {
12845
- const nextValue = selectCtrl.readValue();
12846
- const isNotPrimitive = ngOptions.trackBy || multiple;
12847
- if (
12848
- isNotPrimitive
12849
- ? !equals$1(previousValue, nextValue)
12850
- : previousValue !== nextValue
12851
- ) {
12852
- ngModelCtrl.$setViewValue(nextValue);
12853
- ngModelCtrl.$render();
12854
- }
12874
+ ngModelCtrl.$render();
12875
+
12876
+ // Check to see if the value has changed due to the update to the options
12877
+ if (!ngModelCtrl.$isEmpty(previousValue)) {
12878
+ const nextValue = selectCtrl.readValue();
12879
+ const isNotPrimitive = ngOptions.trackBy || multiple;
12880
+ if (
12881
+ isNotPrimitive
12882
+ ? !equals$1(previousValue, nextValue)
12883
+ : previousValue !== nextValue
12884
+ ) {
12885
+ ngModelCtrl.$setViewValue(nextValue);
12886
+ ngModelCtrl.$render();
12855
12887
  }
12856
12888
  }
12857
12889
  }
12890
+ }
12858
12891
 
12859
- return {
12860
- restrict: "A",
12861
- terminal: true,
12862
- require: ["select", "ngModel"],
12863
- link: {
12864
- pre: function ngOptionsPreLink(scope, selectElement, attr, ctrls) {
12865
- // Deactivate the SelectController.register method to prevent
12866
- // option directives from accidentally registering themselves
12867
- // (and unwanted $destroy handlers etc.)
12868
- ctrls[0].registerOption = () => {};
12869
- },
12870
- post: ngOptionsPostLink,
12892
+ return {
12893
+ restrict: "A",
12894
+ terminal: true,
12895
+ require: ["select", "ngModel"],
12896
+ link: {
12897
+ pre: function ngOptionsPreLink(scope, selectElement, attr, ctrls) {
12898
+ // Deactivate the SelectController.register method to prevent
12899
+ // option directives from accidentally registering themselves
12900
+ // (and unwanted $destroy handlers etc.)
12901
+ ctrls[0].registerOption = () => {};
12871
12902
  },
12872
- };
12873
- },
12874
- ];
12903
+ post: ngOptionsPostLink,
12904
+ },
12905
+ };
12906
+ }
12875
12907
 
12876
12908
  /**
12877
12909
  * Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.
@@ -12890,113 +12922,114 @@ const ngOptionsDirective = [
12890
12922
  * or its value is the same as the name of the attribute then the default slot is used.
12891
12923
  */
12892
12924
  const ngTranscludeMinErr = minErr("ngTransclude");
12893
- const ngTranscludeDirective = [
12894
- "$compile",
12895
12925
 
12896
- /**
12897
- * @param {import("../../core/compile/compile.js").CompileFn} $compile
12898
- * @returns {import("../../interface.ts").Directive}
12899
- */
12900
- function ($compile) {
12901
- return {
12902
- compile: function ngTranscludeCompile(tElement) {
12903
- // Remove and cache any original content to act as a fallback
12904
- const fallbackLinkFn = $compile(tElement.childNodes);
12905
- emptyElement(tElement);
12926
+ ngTranscludeDirective.$inject = ["$compile"];
12927
+ /**
12928
+ * @param {import("../../core/compile/compile.js").CompileFn} $compile
12929
+ * @returns {import("../../interface.ts").Directive}
12930
+ */
12931
+ function ngTranscludeDirective($compile) {
12932
+ return {
12933
+ compile: function ngTranscludeCompile(tElement) {
12934
+ // Remove and cache any original content to act as a fallback
12935
+ const fallbackLinkFn = $compile(tElement.childNodes);
12936
+ emptyElement(tElement);
12906
12937
 
12907
- /**
12908
- *
12909
- * @param {import("../../core/scope/scope.js").Scope} $scope
12910
- * @param {Element} $element
12911
- * @param {import("../../core/compile/attributes.js").Attributes} $attrs
12912
- * @param {*} _controller
12913
- * @param {*} $transclude
12914
- */
12915
- function ngTranscludePostLink(
12916
- $scope,
12917
- $element,
12918
- $attrs,
12919
- _controller,
12920
- $transclude,
12921
- ) {
12922
- if (!$transclude) {
12923
- throw ngTranscludeMinErr(
12924
- "orphan",
12925
- "Illegal use of ngTransclude directive in the template! " +
12926
- "No parent directive that requires a transclusion found. " +
12927
- "Element: {0}",
12928
- startingTag($element),
12929
- );
12930
- }
12938
+ /**
12939
+ *
12940
+ * @param {import("../../core/scope/scope.js").Scope} $scope
12941
+ * @param {Element} $element
12942
+ * @param {import("../../core/compile/attributes.js").Attributes} $attrs
12943
+ * @param {*} _controller
12944
+ * @param {*} $transclude
12945
+ */
12946
+ function ngTranscludePostLink(
12947
+ $scope,
12948
+ $element,
12949
+ $attrs,
12950
+ _controller,
12951
+ $transclude,
12952
+ ) {
12953
+ if (!$transclude) {
12954
+ throw ngTranscludeMinErr(
12955
+ "orphan",
12956
+ "Illegal use of ngTransclude directive in the template! " +
12957
+ "No parent directive that requires a transclusion found. " +
12958
+ "Element: {0}",
12959
+ startingTag($element),
12960
+ );
12961
+ }
12931
12962
 
12932
- // If the attribute is of the form: `ng-transclude="ng-transclude"` then treat it like the default
12933
- if ($attrs["ngTransclude"] === $attrs.$attr.ngTransclude) {
12934
- $attrs["ngTransclude"] = "";
12935
- }
12936
- const slotName = $attrs["ngTransclude"] || $attrs["ngTranscludeSlot"];
12963
+ // If the attribute is of the form: `ng-transclude="ng-transclude"` then treat it like the default
12964
+ if ($attrs["ngTransclude"] === $attrs.$attr.ngTransclude) {
12965
+ $attrs["ngTransclude"] = "";
12966
+ }
12967
+ const slotName = $attrs["ngTransclude"] || $attrs["ngTranscludeSlot"];
12937
12968
 
12938
- // If the slot is required and no transclusion content is provided then this call will throw an error
12939
- $transclude(ngTranscludeCloneAttachFn, null, slotName);
12969
+ // If the slot is required and no transclusion content is provided then this call will throw an error
12970
+ $transclude(ngTranscludeCloneAttachFn, null, slotName);
12940
12971
 
12941
- // If the slot is optional and no transclusion content is provided then use the fallback content
12942
- if (slotName && !$transclude.isSlotFilled(slotName)) {
12943
- useFallbackContent();
12944
- }
12972
+ // If the slot is optional and no transclusion content is provided then use the fallback content
12973
+ if (slotName && !$transclude.isSlotFilled(slotName)) {
12974
+ useFallbackContent();
12975
+ }
12945
12976
 
12946
- /**
12947
- * @param {NodeList | Node} clone
12948
- * @param {import("../../core/scope/scope.js").Scope} transcludedScope
12949
- */
12950
- function ngTranscludeCloneAttachFn(clone, transcludedScope) {
12951
- if (notWhitespace(clone)) {
12952
- if (clone instanceof NodeList) {
12953
- Array.from(clone).forEach((el) => {
12954
- $element.append(el);
12955
- });
12956
- } else {
12957
- $element.append(/** @type {Node} */ (clone));
12958
- }
12977
+ /**
12978
+ * @param {NodeList | Node} clone
12979
+ * @param {import("../../core/scope/scope.js").Scope} transcludedScope
12980
+ */
12981
+ function ngTranscludeCloneAttachFn(clone, transcludedScope) {
12982
+ if (notWhitespace(clone)) {
12983
+ if (clone instanceof NodeList) {
12984
+ Array.from(clone).forEach((el) => {
12985
+ $element.append(el);
12986
+ });
12959
12987
  } else {
12960
- useFallbackContent();
12961
- // There is nothing linked against the transcluded scope since no content was available,
12962
- // so it should be safe to clean up the generated scope.
12963
- transcludedScope.$destroy();
12988
+ $element.append(/** @type {Node} */ (clone));
12964
12989
  }
12990
+ } else {
12991
+ useFallbackContent();
12992
+ // There is nothing linked against the transcluded scope since no content was available,
12993
+ // so it should be safe to clean up the generated scope.
12994
+ transcludedScope.$destroy();
12965
12995
  }
12996
+ }
12966
12997
 
12967
- function useFallbackContent() {
12968
- // Since this is the fallback content rather than the transcluded content,
12969
- // we link against the scope of this directive rather than the transcluded scope
12970
- fallbackLinkFn(
12971
- $scope,
12998
+ function useFallbackContent() {
12999
+ // Since this is the fallback content rather than the transcluded content,
13000
+ // we link against the scope of this directive rather than the transcluded scope
13001
+ fallbackLinkFn(
13002
+ $scope,
12972
13003
 
12973
- (clone) => {
12974
- // @ts-ignore
12975
- $element.append(clone);
12976
- },
12977
- );
12978
- }
13004
+ (clone) => {
13005
+ // @ts-ignore
13006
+ $element.append(clone);
13007
+ },
13008
+ );
13009
+ }
12979
13010
 
12980
- function notWhitespace(node) {
12981
- if (node instanceof Array) {
12982
- return false;
12983
- } else if (
12984
- node.nodeType !== Node.TEXT_NODE ||
12985
- node.nodeValue.trim()
12986
- ) {
12987
- return true;
12988
- }
13011
+ function notWhitespace(node) {
13012
+ if (node instanceof Array) {
13013
+ return false;
13014
+ } else if (
13015
+ node.nodeType !== Node.TEXT_NODE ||
13016
+ node.nodeValue.trim()
13017
+ ) {
13018
+ return true;
12989
13019
  }
12990
13020
  }
13021
+ }
12991
13022
 
12992
- return ngTranscludePostLink;
12993
- },
12994
- };
12995
- },
12996
- ];
13023
+ return ngTranscludePostLink;
13024
+ },
13025
+ };
13026
+ }
12997
13027
 
12998
13028
  const REGEX_STRING_REGEXP = /^\/(.+)\/([a-z]*)$/;
12999
13029
 
13030
+ /**
13031
+ * @type {Record<string, import("../../interface.js").DirectiveFactory>}
13032
+ */
13000
13033
  const ngAttributeAliasDirectives = {};
13001
13034
 
13002
13035
  // boolean attrs are evaluated
@@ -13039,10 +13072,10 @@ Object.entries(ALIASED_ATTR).forEach(([ngAttr]) => {
13039
13072
  link(scope, element, attr) {
13040
13073
  // special case ngPattern when a literal regular expression value
13041
13074
  // is used as the expression (this way we don't have to watch anything).
13042
- if (ngAttr === "ngPattern" && attr.ngPattern.charAt(0) === "/") {
13043
- const match = attr.ngPattern.match(REGEX_STRING_REGEXP);
13075
+ if (ngAttr === "ngPattern" && attr["ngPattern"].charAt(0) === "/") {
13076
+ const match = attr["ngPattern"].match(REGEX_STRING_REGEXP);
13044
13077
  if (match) {
13045
- attr.$set("ngPattern", new RegExp(match[1], match[2]));
13078
+ attr.$set("ngPattern", new RegExp(match[1], match[2]).toString());
13046
13079
  return;
13047
13080
  }
13048
13081
  }
@@ -13068,7 +13101,7 @@ Object.entries(ALIASED_ATTR).forEach(([ngAttr]) => {
13068
13101
 
13069
13102
  if (
13070
13103
  attrName === "href" &&
13071
- toString.call(element.href) === "[object SVGAnimatedString]"
13104
+ toString.call(element["href"]) === "[object SVGAnimatedString]"
13072
13105
  ) {
13073
13106
  name = "xlinkHref";
13074
13107
  attr.$attr[name] = "href";
@@ -13454,7 +13487,7 @@ class AnchorScrollProvider {
13454
13487
  "$rootScope",
13455
13488
  /**
13456
13489
  *
13457
- * @param {import('../core/location/location.js').Location} $location
13490
+ * @param {import('../services/location/location.js').Location} $location
13458
13491
  * @param {import('../core/scope/scope.js').Scope} $rootScope
13459
13492
  * @returns
13460
13493
  */
@@ -13553,7 +13586,7 @@ class AnchorScrollProvider {
13553
13586
  // skip the initial scroll if $location.hash is empty
13554
13587
  if (newVal === oldVal && newVal === "") return;
13555
13588
 
13556
- const action = () => $rootScope.$evalAsync(scroll);
13589
+ const action = () => Promise.resolve().then(scroll);
13557
13590
  if (document.readyState === "complete") {
13558
13591
  // Force the action to be run async for consistent behavior
13559
13592
  // from the action's point of view
@@ -14472,216 +14505,6 @@ function AnimateProvider($provide) {
14472
14505
  ];
14473
14506
  }
14474
14507
 
14475
- /**
14476
- * Removes a trailing hash ('#') from the given URL if it exists.
14477
- *
14478
- * @param {string} url
14479
- * @returns {string}
14480
- */
14481
- function trimEmptyHash(url) {
14482
- return url.replace(/#$/, "");
14483
- }
14484
-
14485
- /**
14486
- * @typedef {function(string, string|null): any} UrlChangeListener
14487
- */
14488
-
14489
- /**
14490
- * This object has two goals:
14491
- *
14492
- * - hide all the global state in the browser caused by the window object
14493
- * - abstract away all the browser specific features and inconsistencies
14494
- */
14495
- class Browser {
14496
- /**
14497
- * @param {import('../core/task-tracker-factory.js').TaskTracker} taskTracker
14498
- */
14499
- constructor(taskTracker) {
14500
- /**
14501
- * @type {import('../core/task-tracker-factory.js').TaskTracker} taskTracker
14502
- */
14503
- this.taskTracker = taskTracker;
14504
- this.pendingDeferIds = {};
14505
- /** @type {Array<UrlChangeListener>} */
14506
- this.urlChangeListeners = [];
14507
- this.urlChangeInit = false;
14508
-
14509
- /** @type {any} */
14510
- this.cachedState = null;
14511
- /** @type {any} */
14512
- this.lastHistoryState = null;
14513
- /** @type {string} */
14514
- this.lastBrowserUrl = window.location.href;
14515
- /** @type {HTMLBaseElement | null} */
14516
- this.baseElement = document.querySelector("base");
14517
-
14518
- // Task-tracking API
14519
- this.$$completeOutstandingRequest =
14520
- this.taskTracker.completeTask.bind(taskTracker);
14521
- this.$$incOutstandingRequestCount =
14522
- this.taskTracker.incTaskCount.bind(taskTracker);
14523
- this.notifyWhenNoOutstandingRequests =
14524
- this.taskTracker.notifyWhenNoPendingTasks.bind(taskTracker);
14525
-
14526
- this.cacheState();
14527
- }
14528
-
14529
- /// ///////////////////////////////////////////////////////////
14530
- // URL API
14531
- /// ///////////////////////////////////////////////////////////
14532
-
14533
- url(url, state) {
14534
- if (state === undefined) {
14535
- state = null;
14536
- }
14537
-
14538
- // setter
14539
- if (url) {
14540
- url = urlResolve(url).href;
14541
-
14542
- if (this.lastBrowserUrl === url && this.lastHistoryState === state) {
14543
- return this;
14544
- }
14545
-
14546
- this.lastBrowserUrl = url;
14547
- this.lastHistoryState = state;
14548
- history.pushState(state, "", url);
14549
- this.cacheState();
14550
- return this;
14551
- }
14552
-
14553
- // getter
14554
- return trimEmptyHash(window.location.href);
14555
- }
14556
-
14557
- /**
14558
- * Returns the cached state.
14559
- *
14560
- * @returns {any} The cached state.
14561
- */
14562
- state() {
14563
- return this.cachedState;
14564
- }
14565
-
14566
- /**
14567
- * Caches the current state and fires the URL change event.
14568
- *
14569
- * @private
14570
- */
14571
- cacheStateAndFireUrlChange() {
14572
- this.fireStateOrUrlChange();
14573
- }
14574
-
14575
- /**
14576
- * Caches the current state.
14577
- *
14578
- * @private
14579
- */
14580
- cacheState() {
14581
- const currentState = history.state ?? null;
14582
- if (!equals$1(currentState, this.lastCachedState)) {
14583
- this.cachedState = currentState;
14584
- this.lastCachedState = currentState;
14585
- this.lastHistoryState = currentState;
14586
- }
14587
- }
14588
-
14589
- /**
14590
- * Fires the state or URL change event.
14591
- *
14592
- * @private
14593
- */
14594
- fireStateOrUrlChange() {
14595
- const prevLastHistoryState = this.lastHistoryState;
14596
- this.cacheState();
14597
-
14598
- if (
14599
- this.lastBrowserUrl === this.url() &&
14600
- prevLastHistoryState === this.cachedState
14601
- ) {
14602
- return;
14603
- }
14604
-
14605
- this.lastBrowserUrl = /** @type {string} */ (this.url());
14606
- this.lastHistoryState = this.cachedState;
14607
- this.urlChangeListeners.forEach((listener) => {
14608
- listener(trimEmptyHash(window.location.href), this.cachedState);
14609
- });
14610
- }
14611
-
14612
- /**
14613
- * Registers a callback to be called when the URL changes.
14614
- *
14615
- * @param {UrlChangeListener} callback - The callback function to register.
14616
- * @returns {UrlChangeListener} The registered callback function.
14617
- */
14618
- onUrlChange(callback) {
14619
- if (!this.urlChangeInit) {
14620
- window.addEventListener(
14621
- "popstate",
14622
- this.cacheStateAndFireUrlChange.bind(this),
14623
- );
14624
- window.addEventListener(
14625
- "hashchange",
14626
- this.cacheStateAndFireUrlChange.bind(this),
14627
- );
14628
-
14629
- this.urlChangeInit = true;
14630
- }
14631
-
14632
- this.urlChangeListeners.push(callback);
14633
- return callback;
14634
- }
14635
-
14636
- $$applicationDestroyed() {
14637
- window.removeEventListener(
14638
- "popstate",
14639
- this.cacheStateAndFireUrlChange.bind(this),
14640
- );
14641
- window.removeEventListener(
14642
- "hashchange",
14643
- this.cacheStateAndFireUrlChange.bind(this),
14644
- );
14645
- }
14646
-
14647
- $$checkUrlChange() {
14648
- this.fireStateOrUrlChange();
14649
- }
14650
-
14651
- /// ///////////////////////////////////////////////////////////
14652
- // Misc API
14653
- /// ///////////////////////////////////////////////////////////
14654
-
14655
- /**
14656
- * Returns the base href of the document.
14657
- *
14658
- * @returns {string} The base href.
14659
- */
14660
- baseHref() {
14661
- const href = this.baseElement?.getAttribute("href");
14662
- return href ? href.replace(/^(https?:)?\/\/[^/]*/, "") : "";
14663
- }
14664
- }
14665
-
14666
- /**
14667
- * This object has two goals:
14668
- *
14669
- * - hide all the global state in the browser caused by the window object
14670
- * - abstract away all the browser specific features and inconsistencies
14671
- *
14672
- * Remove this in the future
14673
- */
14674
- class BrowserProvider {
14675
- $get = [
14676
- "$$taskTrackerFactory",
14677
- /**
14678
- * @param {import('../core/task-tracker-factory.js').TaskTracker} $$taskTrackerFactory
14679
- * @returns {Browser}
14680
- */
14681
- ($$taskTrackerFactory) => new Browser($$taskTrackerFactory),
14682
- ];
14683
- }
14684
-
14685
14508
  function AnimateAsyncRunFactoryProvider() {
14686
14509
  this.$get = [
14687
14510
  function () {
@@ -14887,7 +14710,9 @@ class TemplateCacheProvider {
14887
14710
  /**
14888
14711
  * @returns {import('./interface.ts').TemplateCache}
14889
14712
  */
14890
- $get = () => this.cache;
14713
+ $get() {
14714
+ return this.cache;
14715
+ }
14891
14716
  }
14892
14717
 
14893
14718
  /**
@@ -14934,9 +14759,9 @@ class TemplateCacheProvider {
14934
14759
  * @see {@link angular.ErrorHandler AngularTS ErrorHandler}
14935
14760
  */
14936
14761
 
14937
- /** @typedef {import('../services/log/interface.ts').LogService} LogService */
14762
+ /** @typedef {import('../log/interface.ts').LogService} LogService */
14938
14763
 
14939
- /** @typedef {import("./error-handler.ts").ErrorHandler} ErrorHandler */
14764
+ /** @typedef {import("./interface.ts").Interface} ErrorHandler */
14940
14765
 
14941
14766
  /**
14942
14767
  * Provider for `$exceptionHandler` service. Delegates uncaught exceptions to `$log.error()` by default.
@@ -15420,7 +15245,7 @@ function $IsStateFilter($state) {
15420
15245
  const isFilter = function (state, params, options) {
15421
15246
  return $state.is(state, params, options);
15422
15247
  };
15423
- //isFilter.$stateful = true;
15248
+ isFilter.$stateful = true;
15424
15249
  return isFilter;
15425
15250
  }
15426
15251
  /**
@@ -15441,53 +15266,52 @@ function $IncludedByStateFilter($state) {
15441
15266
  const includesFilter = function (state, params, options) {
15442
15267
  return $state.includes(state, params, options);
15443
15268
  };
15444
- //includesFilter.$stateful = true;
15269
+ includesFilter.$stateful = true;
15445
15270
  return includesFilter;
15446
15271
  }
15447
15272
 
15448
- FilterProvider.$inject = ["$provide"];
15273
+ const SUFFIX = "Filter";
15449
15274
 
15450
- /**
15451
- * @param {import('../../interface.ts').Provider} $provide
15452
- */
15453
- function FilterProvider($provide) {
15454
- const suffix = "Filter";
15275
+ class FilterProvider {
15276
+ static $inject = [$injectTokens.$provide];
15277
+
15278
+ /**
15279
+ * @param {import('../../interface.ts').Provider} $provide
15280
+ */
15281
+ constructor($provide) {
15282
+ this.$provide = $provide;
15283
+ this.register({
15284
+ filter: filterFilter,
15285
+ json: jsonFilter,
15286
+ limitTo: limitToFilter,
15287
+ orderBy: orderByFilter,
15288
+ isState: $IsStateFilter,
15289
+ includedByState: $IncludedByStateFilter,
15290
+ });
15291
+ }
15455
15292
 
15456
15293
  /**
15457
15294
  * @param {string|Record<string, import('../../interface.ts').FilterFactory>} name
15458
- * @param {import('../../interface.ts').FilterFactory} factory
15459
- * @return {import('../../interface.ts').ServiceProvider}
15295
+ * @param {import('../../interface.ts').FilterFactory} [factory]
15296
+ * @return {import('../../interface.ts').Provider}
15460
15297
  */
15461
- function register(name, factory) {
15298
+ register(name, factory) {
15462
15299
  if (isObject(name)) {
15463
15300
  Object.entries(name).forEach(([key, filter]) => {
15464
- register(key, filter);
15301
+ this.register(key, filter);
15465
15302
  });
15466
15303
  }
15467
- return $provide.factory(name + suffix, factory);
15304
+ return this.$provide.factory(name + SUFFIX, factory);
15468
15305
  }
15469
15306
 
15470
- this.register = register;
15471
-
15472
- this.$get = [
15473
- "$injector",
15307
+ $get = [
15308
+ $injectTokens.$injector,
15474
15309
  /**
15475
15310
  * @param {import("../../core/di/internal-injector.js").InjectorService} $injector
15476
- * @returns
15311
+ * @returns {import('../../interface.ts').FilterFn}
15477
15312
  */
15478
- function ($injector) {
15479
- return function (name) {
15480
- return $injector.get(name + suffix);
15481
- };
15482
- },
15313
+ ($injector) => (/** @type {string} */ name) => $injector.get(name + SUFFIX),
15483
15314
  ];
15484
-
15485
- register("filter", filterFilter);
15486
- register("json", jsonFilter);
15487
- register("limitTo", limitToFilter);
15488
- register("orderBy", orderByFilter);
15489
- register("isState", $IsStateFilter);
15490
- register("includedByState", $IncludedByStateFilter);
15491
15315
  }
15492
15316
 
15493
15317
  const PURITY_ABSOLUTE = 1;
@@ -15626,7 +15450,7 @@ class ASTInterpreter {
15626
15450
  if (ast.filter) right = this.$filter(ast.callee.name);
15627
15451
  if (!ast.filter) right = this.recurse(ast.callee, true);
15628
15452
  return ast.filter
15629
- ? function (scope, locals, assign) {
15453
+ ? (scope, locals, assign) => {
15630
15454
  const values = [];
15631
15455
  for (let i = 0; i < args.length; ++i) {
15632
15456
  const res = args[i](scope, locals, assign);
@@ -15639,7 +15463,7 @@ class ASTInterpreter {
15639
15463
  ? { context: undefined, name: undefined, value }
15640
15464
  : value;
15641
15465
  }
15642
- : function (scope, locals, assign) {
15466
+ : (scope, locals, assign) => {
15643
15467
  const rhs = right(scope, locals, assign);
15644
15468
  let value;
15645
15469
  if (rhs.value != null && isFunction(rhs.value)) {
@@ -15655,7 +15479,7 @@ class ASTInterpreter {
15655
15479
  case ASTType.AssignmentExpression:
15656
15480
  left = this.recurse(ast.left, true, 1);
15657
15481
  right = this.recurse(ast.right);
15658
- return function (scope, locals, assign) {
15482
+ return (scope, locals, assign) => {
15659
15483
  const lhs = left(scope, locals, assign);
15660
15484
  const rhs = right(scope, locals, assign);
15661
15485
  lhs.context[lhs.name] = rhs;
@@ -15666,7 +15490,7 @@ class ASTInterpreter {
15666
15490
  ast.elements.forEach((expr) => {
15667
15491
  args.push(self.recurse(expr));
15668
15492
  });
15669
- return function (scope, locals, assign) {
15493
+ return (scope, locals, assign) => {
15670
15494
  const value = [];
15671
15495
  for (let i = 0; i < args.length; ++i) {
15672
15496
  value.push(args[i](scope, locals, assign));
@@ -15693,7 +15517,7 @@ class ASTInterpreter {
15693
15517
  });
15694
15518
  }
15695
15519
  });
15696
- return function (scope, locals, assign) {
15520
+ return (scope, locals, assign) => {
15697
15521
  const value = {};
15698
15522
  for (let i = 0; i < args.length; ++i) {
15699
15523
  if (args[i].computed) {
@@ -15709,17 +15533,12 @@ class ASTInterpreter {
15709
15533
  return context ? { value } : value;
15710
15534
  };
15711
15535
  case ASTType.ThisExpression:
15712
- return function (scope) {
15713
- return context ? { value: scope } : scope;
15714
- };
15536
+ return (scope) => (context ? { value: scope } : scope);
15715
15537
  case ASTType.LocalsExpression:
15716
- return function (scope, locals) {
15717
- return context ? { value: locals } : locals;
15718
- };
15538
+ return (scope, locals) => (context ? { value: locals } : locals);
15719
15539
  case ASTType.NGValueParameter:
15720
- return function (scope, locals, assign) {
15721
- return context ? { value: assign } : assign;
15722
- };
15540
+ return (scope, locals, assign) =>
15541
+ context ? { value: assign } : assign;
15723
15542
  }
15724
15543
  }
15725
15544
 
@@ -15730,7 +15549,7 @@ class ASTInterpreter {
15730
15549
  * @returns {function} The unary plus function.
15731
15550
  */
15732
15551
  "unary+"(argument, context) {
15733
- return function (scope, locals, assign) {
15552
+ return (scope, locals, assign) => {
15734
15553
  let arg = argument(scope, locals, assign);
15735
15554
  if (isDefined(arg)) {
15736
15555
  arg = +arg;
@@ -15748,7 +15567,7 @@ class ASTInterpreter {
15748
15567
  * @returns {function} The unary minus function.
15749
15568
  */
15750
15569
  "unary-"(argument, context) {
15751
- return function (scope, locals, assign) {
15570
+ return (scope, locals, assign) => {
15752
15571
  let arg = argument(scope, locals, assign);
15753
15572
  if (isDefined(arg)) {
15754
15573
  arg = -arg;
@@ -15766,7 +15585,7 @@ class ASTInterpreter {
15766
15585
  * @returns {function} The unary negation function.
15767
15586
  */
15768
15587
  "unary!"(argument, context) {
15769
- return function (scope, locals, assign) {
15588
+ return (scope, locals, assign) => {
15770
15589
  const arg = !argument(scope, locals, assign);
15771
15590
  return context ? { value: arg } : arg;
15772
15591
  };
@@ -15780,7 +15599,7 @@ class ASTInterpreter {
15780
15599
  * @returns {function} The binary plus function.
15781
15600
  */
15782
15601
  "binary+"(left, right, context) {
15783
- return function (scope, locals, assign) {
15602
+ return (scope, locals, assign) => {
15784
15603
  const lhs = left(scope, locals, assign);
15785
15604
  const rhs = right(scope, locals, assign);
15786
15605
  const arg = plusFn(lhs, rhs);
@@ -15796,7 +15615,7 @@ class ASTInterpreter {
15796
15615
  * @returns {function} The binary minus function.
15797
15616
  */
15798
15617
  "binary-"(left, right, context) {
15799
- return function (scope, locals, assign) {
15618
+ return (scope, locals, assign) => {
15800
15619
  const lhs = left(scope, locals, assign);
15801
15620
  const rhs = right(scope, locals, assign);
15802
15621
  const arg = (isDefined(lhs) ? lhs : 0) - (isDefined(rhs) ? rhs : 0);
@@ -15812,14 +15631,14 @@ class ASTInterpreter {
15812
15631
  * @returns {function} The binary multiplication function.
15813
15632
  */
15814
15633
  "binary*"(left, right, context) {
15815
- return function (scope, locals, assign) {
15634
+ return (scope, locals, assign) => {
15816
15635
  const arg = left(scope, locals, assign) * right(scope, locals, assign);
15817
15636
  return context ? { value: arg } : arg;
15818
15637
  };
15819
15638
  }
15820
15639
 
15821
15640
  "binary/"(left, right, context) {
15822
- return function (scope, locals, assign) {
15641
+ return (scope, locals, assign) => {
15823
15642
  const arg = left(scope, locals, assign) / right(scope, locals, assign);
15824
15643
  return context ? { value: arg } : arg;
15825
15644
  };
@@ -15833,7 +15652,7 @@ class ASTInterpreter {
15833
15652
  * @returns {function} The binary division function.
15834
15653
  */
15835
15654
  "binary%"(left, right, context) {
15836
- return function (scope, locals, assign) {
15655
+ return (scope, locals, assign) => {
15837
15656
  const arg = left(scope, locals, assign) % right(scope, locals, assign);
15838
15657
  return context ? { value: arg } : arg;
15839
15658
  };
@@ -15847,7 +15666,7 @@ class ASTInterpreter {
15847
15666
  * @returns {function} The binary strict equality function.
15848
15667
  */
15849
15668
  "binary==="(left, right, context) {
15850
- return function (scope, locals, assign) {
15669
+ return (scope, locals, assign) => {
15851
15670
  const arg = left(scope, locals, assign) === right(scope, locals, assign);
15852
15671
  return context ? { value: arg } : arg;
15853
15672
  };
@@ -15861,7 +15680,7 @@ class ASTInterpreter {
15861
15680
  * @returns {function} The binary strict inequality function.
15862
15681
  */
15863
15682
  "binary!=="(left, right, context) {
15864
- return function (scope, locals, assign) {
15683
+ return (scope, locals, assign) => {
15865
15684
  const arg = left(scope, locals, assign) !== right(scope, locals, assign);
15866
15685
  return context ? { value: arg } : arg;
15867
15686
  };
@@ -15875,7 +15694,7 @@ class ASTInterpreter {
15875
15694
  * @returns {function} The binary equality function.
15876
15695
  */
15877
15696
  "binary=="(left, right, context) {
15878
- return function (scope, locals, assign) {
15697
+ return (scope, locals, assign) => {
15879
15698
  const arg = left(scope, locals, assign) == right(scope, locals, assign);
15880
15699
  return context ? { value: arg } : arg;
15881
15700
  };
@@ -15889,7 +15708,7 @@ class ASTInterpreter {
15889
15708
  * @returns {function} The binary inequality function.
15890
15709
  */
15891
15710
  "binary!="(left, right, context) {
15892
- return function (scope, locals, assign) {
15711
+ return (scope, locals, assign) => {
15893
15712
  const arg = left(scope, locals, assign) != right(scope, locals, assign);
15894
15713
  return context ? { value: arg } : arg;
15895
15714
  };
@@ -15903,7 +15722,7 @@ class ASTInterpreter {
15903
15722
  * @returns {function} The binary less-than function.
15904
15723
  */
15905
15724
  "binary<"(left, right, context) {
15906
- return function (scope, locals, assign) {
15725
+ return (scope, locals, assign) => {
15907
15726
  const arg = left(scope, locals, assign) < right(scope, locals, assign);
15908
15727
  return context ? { value: arg } : arg;
15909
15728
  };
@@ -15917,7 +15736,7 @@ class ASTInterpreter {
15917
15736
  * @returns {function} The binary greater-than function.
15918
15737
  */
15919
15738
  "binary>"(left, right, context) {
15920
- return function (scope, locals, assign) {
15739
+ return (scope, locals, assign) => {
15921
15740
  const arg = left(scope, locals, assign) > right(scope, locals, assign);
15922
15741
  return context ? { value: arg } : arg;
15923
15742
  };
@@ -15931,7 +15750,7 @@ class ASTInterpreter {
15931
15750
  * @returns {function} The binary less-than-or-equal-to function.
15932
15751
  */
15933
15752
  "binary<="(left, right, context) {
15934
- return function (scope, locals, assign) {
15753
+ return (scope, locals, assign) => {
15935
15754
  const arg = left(scope, locals, assign) <= right(scope, locals, assign);
15936
15755
  return context ? { value: arg } : arg;
15937
15756
  };
@@ -15945,7 +15764,7 @@ class ASTInterpreter {
15945
15764
  * @returns {function} The binary greater-than-or-equal-to function.
15946
15765
  */
15947
15766
  "binary>="(left, right, context) {
15948
- return function (scope, locals, assign) {
15767
+ return (scope, locals, assign) => {
15949
15768
  const arg = left(scope, locals, assign) >= right(scope, locals, assign);
15950
15769
  return context ? { value: arg } : arg;
15951
15770
  };
@@ -15972,7 +15791,7 @@ class ASTInterpreter {
15972
15791
  * @returns {function} The binary logical OR function.
15973
15792
  */
15974
15793
  "binary||"(left, right, context) {
15975
- return function (scope, locals, assign) {
15794
+ return (scope, locals, assign) => {
15976
15795
  const arg = left(scope, locals, assign) || right(scope, locals, assign);
15977
15796
  return context ? { value: arg } : arg;
15978
15797
  };
@@ -15987,7 +15806,7 @@ class ASTInterpreter {
15987
15806
  * @returns {function} The ternary conditional function.
15988
15807
  */
15989
15808
  "ternary?:"(test, alternate, consequent, context) {
15990
- return function (scope, locals, assign) {
15809
+ return (scope, locals, assign) => {
15991
15810
  const arg = test(scope, locals, assign)
15992
15811
  ? alternate(scope, locals, assign)
15993
15812
  : consequent(scope, locals, assign);
@@ -16002,9 +15821,8 @@ class ASTInterpreter {
16002
15821
  * @returns {import("./interface.ts").CompiledExpressionFunction} The function returning the literal value.
16003
15822
  */
16004
15823
  value(value, context) {
16005
- return function () {
16006
- return context ? { context: undefined, name: undefined, value } : value;
16007
- };
15824
+ return () =>
15825
+ context ? { context: undefined, name: undefined, value } : value;
16008
15826
  }
16009
15827
 
16010
15828
  /**
@@ -16015,7 +15833,7 @@ class ASTInterpreter {
16015
15833
  * @returns {import("./interface.ts").CompiledExpressionFunction} The function returning the identifier value.
16016
15834
  */
16017
15835
  identifier(name, context, create) {
16018
- return function (scope, locals) {
15836
+ return (scope, locals) => {
16019
15837
  const base = locals && name in locals ? locals : scope;
16020
15838
  if (create && create !== 1 && base && base[name] == null) {
16021
15839
  base[name] = {};
@@ -16040,7 +15858,7 @@ class ASTInterpreter {
16040
15858
  * @returns {function} The function returning the computed member value.
16041
15859
  */
16042
15860
  computedMember(left, right, context, create) {
16043
- return function (scope, locals, assign) {
15861
+ return (scope, locals, assign) => {
16044
15862
  const lhs = left(scope, locals, assign);
16045
15863
  let rhs;
16046
15864
  let value;
@@ -16070,7 +15888,7 @@ class ASTInterpreter {
16070
15888
  * @returns {function} The function returning the non-computed member value.
16071
15889
  */
16072
15890
  nonComputedMember(left, right, context, create) {
16073
- return function (scope, locals, assign) {
15891
+ return (scope, locals, assign) => {
16074
15892
  const lhs = left(scope, locals, assign);
16075
15893
  if (create && create !== 1) {
16076
15894
  if (lhs && lhs[right] == null) {
@@ -18491,21 +18309,17 @@ function HttpProvider() {
18491
18309
  });
18492
18310
 
18493
18311
  this.$get = [
18494
- "$browser",
18495
18312
  "$httpBackend",
18496
- "$rootScope",
18497
18313
  "$injector",
18498
18314
  "$sce",
18499
18315
  /**
18500
18316
  *
18501
- * @param {*} $browser
18502
18317
  * @param {*} $httpBackend
18503
- * @param {import("../../core/scope/scope.js").Scope} $rootScope
18504
18318
  * @param {import("../../core/di/internal-injector.js").InjectorService} $injector
18505
18319
  * @param {*} $sce
18506
18320
  * @returns
18507
18321
  */
18508
- function ($browser, $httpBackend, $rootScope, $injector, $sce) {
18322
+ function ($httpBackend, $injector, $sce) {
18509
18323
  /**
18510
18324
  * @type {Map<string, string>}
18511
18325
  */
@@ -18575,8 +18389,6 @@ function HttpProvider() {
18575
18389
  ? $injector.get(config.paramSerializer)
18576
18390
  : config.paramSerializer;
18577
18391
 
18578
- $browser.$$incOutstandingRequestCount("$http");
18579
-
18580
18392
  const requestInterceptors = [];
18581
18393
  const responseInterceptors = [];
18582
18394
  let promise = Promise.resolve(config);
@@ -18600,7 +18412,6 @@ function HttpProvider() {
18600
18412
  promise = chainInterceptors(promise, requestInterceptors);
18601
18413
  promise = promise.then(serverRequest);
18602
18414
  promise = chainInterceptors(promise, responseInterceptors);
18603
- promise = promise.finally(completeOutstandingRequest);
18604
18415
 
18605
18416
  return promise;
18606
18417
 
@@ -18617,10 +18428,6 @@ function HttpProvider() {
18617
18428
  return promise;
18618
18429
  }
18619
18430
 
18620
- function completeOutstandingRequest() {
18621
- $browser.$$completeOutstandingRequest(() => {}, "$http");
18622
- }
18623
-
18624
18431
  function executeHeaderFns(headers, config) {
18625
18432
  let headerContent;
18626
18433
  const processedHeaders = {};
@@ -19059,24 +18866,14 @@ function HttpProvider() {
19059
18866
  */
19060
18867
  class HttpBackendProvider {
19061
18868
  constructor() {
19062
- this.$get = [
19063
- "$browser",
19064
- /**
19065
- * @param {import('../browser.js').Browser} $browser
19066
- * @returns
19067
- */
19068
- function ($browser) {
19069
- return createHttpBackend($browser);
19070
- },
19071
- ];
18869
+ this.$get = [() => createHttpBackend()];
19072
18870
  }
19073
18871
  }
19074
18872
 
19075
18873
  /**
19076
- * @param {import('../browser.js').Browser} $browser
19077
18874
  * @returns
19078
18875
  */
19079
- function createHttpBackend($browser) {
18876
+ function createHttpBackend() {
19080
18877
  // TODO(vojta): fix the signature
19081
18878
  return function (
19082
18879
  method,
@@ -19090,7 +18887,7 @@ function createHttpBackend($browser) {
19090
18887
  eventHandlers,
19091
18888
  uploadEventHandlers,
19092
18889
  ) {
19093
- url = url || $browser.url();
18890
+ url = url || trimEmptyHash(window.location.href);
19094
18891
 
19095
18892
  const xhr = new XMLHttpRequest();
19096
18893
  let abortedByTimeout = false;
@@ -19298,7 +19095,7 @@ class Location {
19298
19095
  */
19299
19096
  this.$$replace = false;
19300
19097
 
19301
- /** @type {import('../url-utils/url-utils').HttpProtocol} */
19098
+ /** @type {string} */
19302
19099
  this.$$protocol = parsedUrl.protocol;
19303
19100
 
19304
19101
  /** @type {string} */
@@ -19365,7 +19162,7 @@ class Location {
19365
19162
  /**
19366
19163
  *
19367
19164
  * Return protocol of current URL.
19368
- * @return {import("../url-utils/url-utils").HttpProtocol} protocol of current URL
19165
+ * @return {string} protocol of current URL
19369
19166
  */
19370
19167
  protocol() {
19371
19168
  return this.$$protocol;
@@ -19666,12 +19463,13 @@ class LocationHtml5Url extends Location {
19666
19463
  * This object is exposed as $location service when developer doesn't opt into html5 mode.
19667
19464
  * It also serves as the base class for html5 mode fallback on legacy browsers.
19668
19465
  *
19669
- * @constructor
19670
- * @param {string} appBase application base URL
19671
- * @param {string} appBaseNoFile application base URL stripped of any filename
19672
- * @param {string} hashPrefix hashbang prefix
19673
19466
  */
19674
19467
  class LocationHashbangUrl extends Location {
19468
+ /**
19469
+ * @param {string} appBase application base URL
19470
+ * @param {string} appBaseNoFile application base URL stripped of any filename
19471
+ * @param {string} hashPrefix hashbang prefix
19472
+ */
19675
19473
  constructor(appBase, appBaseNoFile, hashPrefix) {
19676
19474
  super(appBase, appBaseNoFile);
19677
19475
  this.hashPrefix = hashPrefix;
@@ -19782,6 +19580,111 @@ class LocationProvider {
19782
19580
  requireBase: true,
19783
19581
  rewriteLinks: true,
19784
19582
  };
19583
+
19584
+ /** @type {Array<import("./interface.js").UrlChangeListener>} */
19585
+ this.urlChangeListeners = [];
19586
+ this.urlChangeInit = false;
19587
+
19588
+ /** @type {History['state']} */
19589
+ this.cachedState = null;
19590
+ /** @typeof {History.state} */
19591
+ this.lastHistoryState = null;
19592
+ /** @type {string} */
19593
+ this.lastBrowserUrl = window.location.href;
19594
+ this.cacheState();
19595
+ }
19596
+
19597
+ /// ///////////////////////////////////////////////////////////
19598
+ // URL API
19599
+ /// ///////////////////////////////////////////////////////////
19600
+
19601
+ setUrl(url, state) {
19602
+ if (state === undefined) {
19603
+ state = null;
19604
+ }
19605
+
19606
+ // setter
19607
+ if (url) {
19608
+ url = urlResolve(url).href;
19609
+
19610
+ if (this.lastBrowserUrl === url && this.lastHistoryState === state) {
19611
+ return this;
19612
+ }
19613
+
19614
+ this.lastBrowserUrl = url;
19615
+ this.lastHistoryState = state;
19616
+ history.pushState(state, "", url);
19617
+ this.cacheState();
19618
+ }
19619
+ }
19620
+
19621
+ /**
19622
+ * Returns the current URL with any empty hash (`#`) removed.
19623
+ * @return {string}
19624
+ */
19625
+ getUrl() {
19626
+ return trimEmptyHash(window.location.href);
19627
+ }
19628
+
19629
+ /**
19630
+ * Returns the cached state.
19631
+ * @returns {History['state']} The cached state.
19632
+ */
19633
+ state() {
19634
+ return this.cachedState;
19635
+ }
19636
+
19637
+ /**
19638
+ * Caches the current state.
19639
+ *
19640
+ * @private
19641
+ */
19642
+ cacheState() {
19643
+ const currentState = history.state ?? null;
19644
+ if (!equals$1(currentState, this.lastCachedState)) {
19645
+ this.cachedState = currentState;
19646
+ this.lastCachedState = currentState;
19647
+ this.lastHistoryState = currentState;
19648
+ }
19649
+ }
19650
+
19651
+ /**
19652
+ * Fires the state or URL change event.
19653
+ *
19654
+ * @private
19655
+ */
19656
+ fireStateOrUrlChange() {
19657
+ const prevLastHistoryState = this.lastHistoryState;
19658
+ this.cacheState();
19659
+ if (
19660
+ this.lastBrowserUrl === this.getUrl() &&
19661
+ prevLastHistoryState === this.cachedState
19662
+ ) {
19663
+ return;
19664
+ }
19665
+ this.lastBrowserUrl = this.getUrl();
19666
+ this.lastHistoryState = this.cachedState;
19667
+ this.urlChangeListeners.forEach((listener) => {
19668
+ listener(trimEmptyHash(window.location.href), this.cachedState);
19669
+ });
19670
+ }
19671
+
19672
+ /**
19673
+ * Registers a callback to be called when the URL changes.
19674
+ *
19675
+ * @param {import("./interface.js").UrlChangeListener} callback - The callback function to register.
19676
+ * @returns void
19677
+ */
19678
+ onUrlChange(callback) {
19679
+ if (!this.urlChangeInit) {
19680
+ window.addEventListener("popstate", this.fireStateOrUrlChange.bind(this));
19681
+ window.addEventListener(
19682
+ "hashchange",
19683
+ this.fireStateOrUrlChange.bind(this),
19684
+ );
19685
+ this.urlChangeInit = true;
19686
+ }
19687
+ this.urlChangeListeners.push(callback);
19785
19688
  }
19786
19689
 
19787
19690
  /**
@@ -19843,21 +19746,19 @@ class LocationProvider {
19843
19746
 
19844
19747
  $get = [
19845
19748
  "$rootScope",
19846
- "$browser",
19847
19749
  "$rootElement",
19848
19750
  /**
19849
19751
  *
19850
- * @param {import('../scope/scope.js').Scope} $rootScope
19851
- * @param {import('../../services/browser').Browser} $browser
19752
+ * @param {import('../../core/scope/scope.js').Scope} $rootScope
19852
19753
  * @param {Element} $rootElement
19853
19754
  * @returns
19854
19755
  */
19855
- ($rootScope, $browser, $rootElement) => {
19756
+ ($rootScope, $rootElement) => {
19856
19757
  /** @type {Location} */
19857
19758
  let $location;
19858
19759
  let LocationMode;
19859
- const baseHref = $browser.baseHref(); // if base[href] is undefined, it defaults to ''
19860
- const initialUrl = /** @type {string} */ ($browser.url());
19760
+ const baseHref = getBaseHref(); // if base[href] is undefined, it defaults to ''
19761
+ const initialUrl = trimEmptyHash(window.location.href);
19861
19762
  let appBase;
19862
19763
 
19863
19764
  if (this.getHtml5Mode().enabled) {
@@ -19882,20 +19783,20 @@ class LocationProvider {
19882
19783
  );
19883
19784
  $location.$$parseLinkUrl(initialUrl, initialUrl);
19884
19785
 
19885
- $location.$$state = $browser.state();
19786
+ $location.$$state = this.state();
19886
19787
 
19887
19788
  const IGNORE_URI_REGEXP = /^\s*(javascript|mailto):/i;
19888
19789
 
19889
- function setBrowserUrlWithFallback(url, state) {
19790
+ const setBrowserUrlWithFallback = (url, state) => {
19890
19791
  const oldUrl = $location.url();
19891
19792
  const oldState = $location.$$state;
19892
19793
  try {
19893
- $browser.url(url, state);
19794
+ this.setUrl(url, state);
19894
19795
 
19895
19796
  // Make sure $location.state() returns referentially identical (not just deeply equal)
19896
19797
  // state object; this makes possible quick checking if the state changed in the digest
19897
19798
  // loop. Checking deep equality would be too expensive.
19898
- $location.$$state = $browser.state();
19799
+ $location.$$state = this.state();
19899
19800
  } catch (e) {
19900
19801
  // Restore old values if pushState fails
19901
19802
  $location.url(/** @type {string} */ (oldUrl));
@@ -19903,7 +19804,7 @@ class LocationProvider {
19903
19804
 
19904
19805
  throw e;
19905
19806
  }
19906
- }
19807
+ };
19907
19808
 
19908
19809
  $rootElement.addEventListener(
19909
19810
  "click",
@@ -19971,10 +19872,6 @@ class LocationProvider {
19971
19872
  // in html5mode and also without, so that we are able to abort navigation without
19972
19873
  // getting double entries in the location history.
19973
19874
  event.preventDefault();
19974
- // update location manually
19975
- // if ($location.absUrl() !== $browser.url()) {
19976
- // $rootScope.$apply();
19977
- // }
19978
19875
  }
19979
19876
  }
19980
19877
  },
@@ -19982,20 +19879,20 @@ class LocationProvider {
19982
19879
 
19983
19880
  // rewrite hashbang url <> html5 url
19984
19881
  if ($location.absUrl() !== initialUrl) {
19985
- $browser.url($location.absUrl(), true);
19882
+ this.setUrl($location.absUrl(), true);
19986
19883
  }
19987
19884
 
19988
19885
  let initializing = true;
19989
19886
 
19990
19887
  // update $location when $browser url changes
19991
- $browser.onUrlChange((newUrl, newState) => {
19888
+ this.onUrlChange((newUrl, newState) => {
19992
19889
  if (!startsWith(newUrl, appBaseNoFile)) {
19993
19890
  // If we are navigating outside of the app then force a reload
19994
19891
  window.location.href = newUrl;
19995
19892
  return;
19996
19893
  }
19997
19894
 
19998
- $rootScope.$evalAsync(() => {
19895
+ Promise.resolve().then(() => {
19999
19896
  const oldUrl = $location.absUrl();
20000
19897
  const oldState = $location.$$state;
20001
19898
  let defaultPrevented;
@@ -20030,9 +19927,9 @@ class LocationProvider {
20030
19927
  if (initializing || $location.$$urlUpdatedByLocation) {
20031
19928
  $location.$$urlUpdatedByLocation = false;
20032
19929
 
20033
- const oldUrl = /** @type {string} */ ($browser.url());
19930
+ const oldUrl = /** @type {string} */ (this.getUrl());
20034
19931
  const newUrl = $location.absUrl();
20035
- const oldState = $browser.state();
19932
+ const oldState = this.state();
20036
19933
  const urlOrStateChanged =
20037
19934
  !urlsEqual(oldUrl, newUrl) ||
20038
19935
  ($location.$$html5 && oldState !== $location.$$state);
@@ -20291,7 +20188,7 @@ function nextId() {
20291
20188
  */
20292
20189
  let $parse;
20293
20190
 
20294
- /**@type {import('../exception-handler.js').ErrorHandler} */
20191
+ /**@type {import('../../services/exception/exception-handler.js').ErrorHandler} */
20295
20192
  let $exceptionHandler;
20296
20193
 
20297
20194
  /**
@@ -20312,7 +20209,7 @@ class RootScopeProvider {
20312
20209
  "$exceptionHandler",
20313
20210
  "$parse",
20314
20211
  /**
20315
- * @param {import('../exception-handler.js').ErrorHandler} exceptionHandler
20212
+ * @param {import('../../services/exception/exception-handler.js').ErrorHandler} exceptionHandler
20316
20213
  * @param {import('../parse/interface.ts').ParseService} parse
20317
20214
  */
20318
20215
  (exceptionHandler, parse) => {
@@ -20723,7 +20620,6 @@ class Scope {
20723
20620
  $destroy: this.$destroy.bind(this),
20724
20621
  $eval: this.$eval.bind(this),
20725
20622
  $apply: this.$apply.bind(this),
20726
- $evalAsync: this.$evalAsync.bind(this),
20727
20623
  $postUpdate: this.$postUpdate.bind(this),
20728
20624
  $isRoot: this.#isRoot.bind(this),
20729
20625
  $target: target,
@@ -21229,10 +21125,6 @@ class Scope {
21229
21125
  return res;
21230
21126
  }
21231
21127
 
21232
- async $evalAsync(expr, locals) {
21233
- return await this.$eval(expr, locals);
21234
- }
21235
-
21236
21128
  /**
21237
21129
  * @param {Object} newTarget
21238
21130
  */
@@ -21514,152 +21406,6 @@ function collectChildIds(child) {
21514
21406
  return ids;
21515
21407
  }
21516
21408
 
21517
- /** @typedef {import('../interface.ts').ServiceProvider} ServiceProvider */
21518
- /** @typedef {import('../interface.ts').AnnotatedFactory} AnnotatedFactory */
21519
-
21520
- /**
21521
- * @implements {ServiceProvider}
21522
- */
21523
- class TaskTrackerFactoryProvider {
21524
- /** @type {AnnotatedFactory} */
21525
- $get = [
21526
- "$log",
21527
- /**
21528
- * Creates a new `TaskTracker` instance.
21529
- *
21530
- * @param {import('../services/log/interface.ts').LogService} log - The logging service.
21531
- * @returns {TaskTracker} A new `TaskTracker` instance.
21532
- */
21533
- (log) => new TaskTracker(log),
21534
- ];
21535
- }
21536
-
21537
- /**
21538
- * A factory function to create `TaskTracker` instances.
21539
- *
21540
- * A `TaskTracker` tracks pending tasks (grouped by type) and notifies interested
21541
- * parties when all pending tasks (or tasks of a specific type) have been completed.
21542
- */
21543
- class TaskTracker {
21544
- /**
21545
- * @param {import('../services/log/interface.ts').LogService} log - The logging service.
21546
- */
21547
- constructor(log) {
21548
- /** @private */
21549
- this.log = log;
21550
-
21551
- /** @private */
21552
- this.taskCounts = {};
21553
-
21554
- /** @private */
21555
- this.taskCallbacks = [];
21556
-
21557
- /**
21558
- * Special task types used for tracking all tasks and default tasks.
21559
- * @type {string}
21560
- */
21561
- this.ALL_TASKS_TYPE = "$$all$$";
21562
-
21563
- /**
21564
- * Default task type.
21565
- * @type {string}
21566
- */
21567
- this.DEFAULT_TASK_TYPE = "$$default$$";
21568
- }
21569
-
21570
- /**
21571
- * Completes a task and decrements the associated task counter.
21572
- * If the counter reaches 0, all corresponding callbacks are executed.
21573
- *
21574
- * @param {Function} fn - The function to execute when completing the task.
21575
- * @param {string} [taskType=this.DEFAULT_TASK_TYPE] - The type of task being completed.
21576
- */
21577
- completeTask(fn, taskType = this.DEFAULT_TASK_TYPE) {
21578
- try {
21579
- fn();
21580
- } finally {
21581
- if (this.taskCounts[taskType]) {
21582
- this.taskCounts[taskType]--;
21583
- this.taskCounts[this.ALL_TASKS_TYPE]--;
21584
- }
21585
-
21586
- const countForType = this.taskCounts[taskType];
21587
- const countForAll = this.taskCounts[this.ALL_TASKS_TYPE];
21588
-
21589
- // If either the overall task queue or the specific task type queue is empty, run callbacks.
21590
- if (!countForAll || !countForType) {
21591
- const getNextCallback = !countForAll
21592
- ? this.getLastCallback.bind(this)
21593
- : () => this.getLastCallbackForType(taskType);
21594
-
21595
- let nextCb;
21596
- while ((nextCb = getNextCallback())) {
21597
- try {
21598
- nextCb();
21599
- } catch (e) {
21600
- this.log.error(e);
21601
- }
21602
- }
21603
- }
21604
- }
21605
- }
21606
-
21607
- /**
21608
- * Increments the task count for the specified task type.
21609
- *
21610
- * @param {string} [taskType=this.DEFAULT_TASK_TYPE] - The type of task whose count will be increased.
21611
- */
21612
- incTaskCount(taskType = this.DEFAULT_TASK_TYPE) {
21613
- this.taskCounts[taskType] = (this.taskCounts[taskType] || 0) + 1;
21614
- this.taskCounts[this.ALL_TASKS_TYPE] =
21615
- (this.taskCounts[this.ALL_TASKS_TYPE] || 0) + 1;
21616
- }
21617
-
21618
- /**
21619
- * Registers a callback to be executed when all pending tasks of the specified type are completed.
21620
- * If there are no pending tasks of the specified type, the callback is executed immediately.
21621
- *
21622
- * @param {Function} callback - The function to execute when no pending tasks remain.
21623
- * @param {string} [taskType=this.ALL_TASKS_TYPE] - The type of tasks to wait for completion.
21624
- */
21625
- notifyWhenNoPendingTasks(callback, taskType = this.ALL_TASKS_TYPE) {
21626
- if (!this.taskCounts[taskType]) {
21627
- callback();
21628
- } else {
21629
- this.taskCallbacks.push({ type: taskType, cb: callback });
21630
- }
21631
- }
21632
-
21633
- /**
21634
- * Retrieves and removes the last registered callback from the queue.
21635
- *
21636
- * @private
21637
- * @returns {Function|undefined} The last callback function or undefined if none exist.
21638
- */
21639
- getLastCallback() {
21640
- const cbInfo = this.taskCallbacks.pop();
21641
- return cbInfo ? cbInfo.cb : undefined;
21642
- }
21643
-
21644
- /**
21645
- * Retrieves and removes the last registered callback for the specified task type.
21646
- *
21647
- * @private
21648
- * @param {string} taskType - The type of task for which the callback was registered.
21649
- * @returns {Function|undefined} The last callback function for the task type, or undefined if none exist.
21650
- */
21651
- getLastCallbackForType(taskType) {
21652
- for (let i = this.taskCallbacks.length - 1; i >= 0; --i) {
21653
- const cbInfo = this.taskCallbacks[i];
21654
- if (cbInfo.type === taskType) {
21655
- this.taskCallbacks.splice(i, 1);
21656
- return cbInfo.cb;
21657
- }
21658
- }
21659
- return undefined;
21660
- }
21661
- }
21662
-
21663
21409
  const $templateRequestMinErr = minErr("$templateRequest");
21664
21410
 
21665
21411
  /**
@@ -21719,7 +21465,7 @@ function TemplateRequestProvider() {
21719
21465
  "$sce",
21720
21466
  /**
21721
21467
  *
21722
- * @param {import('../core/exception-handler.js').ErrorHandler} $exceptionHandler
21468
+ * @param {import('./exception/exception-handler.js').ErrorHandler} $exceptionHandler
21723
21469
  * @param {import('../services/template-cache/interface.ts').TemplateCache} $templateCache
21724
21470
  * @param {import("interface.ts").HttpService} $http
21725
21471
  * @param {*} $sce
@@ -21734,6 +21480,7 @@ function TemplateRequestProvider() {
21734
21480
  // resources for keys that already are included in there. This also makes
21735
21481
  // AngularTS accept any script directive, no matter its name. However, we
21736
21482
  // still need to unwrap trusted types.
21483
+
21737
21484
  if (!isString(tpl) || !$templateCache.has(tpl)) {
21738
21485
  try {
21739
21486
  tpl = $sce.getTrustedResourceUrl(tpl);
@@ -21799,7 +21546,7 @@ function TemplateRequestProvider() {
21799
21546
  ];
21800
21547
  }
21801
21548
 
21802
- /** @typedef {import('../../interface.ts').ServiceProvider} ServiceProvider } */
21549
+ /** @typedef {import('../../interface.ts').ServiceProvider} ServiceProvider */
21803
21550
 
21804
21551
  /**
21805
21552
  * Private service to sanitize uris for links and images. Used by $compile.
@@ -21851,7 +21598,7 @@ class SanitizeUriProvider {
21851
21598
  }
21852
21599
 
21853
21600
  /**
21854
- * @returns {import("./interface.js").SanitizerFn} Sanitizer function.
21601
+ * @returns {import("./interface").SanitizerFn}
21855
21602
  */
21856
21603
  $get() {
21857
21604
  return (uri, isMediaUrl) => {
@@ -21975,7 +21722,7 @@ class NgMessageCtrl {
21975
21722
  reRender() {
21976
21723
  if (!this.renderLater) {
21977
21724
  this.renderLater = true;
21978
- this.$scope.$evalAsync(() => {
21725
+ Promise.resolve().then(() => {
21979
21726
  if (this.renderLater && this.cachedCollection) {
21980
21727
  this.render(this.cachedCollection);
21981
21728
  }
@@ -22108,6 +21855,10 @@ const ngMessageDirective = ngMessageDirectiveFactory(false);
22108
21855
  const ngMessageExpDirective = ngMessageDirectiveFactory(false);
22109
21856
  const ngMessageDefaultDirective = ngMessageDirectiveFactory(true);
22110
21857
 
21858
+ /**
21859
+ * @param {boolean} isDefault
21860
+ * @returns {(any) => import("../../interface.js").Directive}
21861
+ */
22111
21862
  function ngMessageDirectiveFactory(isDefault) {
22112
21863
  ngMessageDirective.$inject = ["$animate"];
22113
21864
  function ngMessageDirective($animate) {
@@ -25188,7 +24939,7 @@ function AnimationProvider() {
25188
24939
 
25189
24940
  /**
25190
24941
  * Service provider that creates a requestAnimationFrame-based scheduler.
25191
- * @implements {ServiceProvider}
24942
+ * @type {ServiceProvider}
25192
24943
  */
25193
24944
  class RafSchedulerProvider {
25194
24945
  constructor() {
@@ -26940,7 +26691,6 @@ class Queue {
26940
26691
  *
26941
26692
  * This is where we hold the global mutable state such as current state, current
26942
26693
  * params, current transition, etc.
26943
- * @implements {ServiceProvider}
26944
26694
  */
26945
26695
  class RouterGlobals {
26946
26696
  constructor() {
@@ -29581,6 +29331,11 @@ class Glob {
29581
29331
  */
29582
29332
  this.regexp = new RegExp("^" + regexpString + "$");
29583
29333
  }
29334
+
29335
+ /**
29336
+ * @param {string} name
29337
+ * @return {boolean}
29338
+ */
29584
29339
  matches(name) {
29585
29340
  return this.regexp.test("." + name);
29586
29341
  }
@@ -33515,7 +33270,7 @@ class UrlService {
33515
33270
  ];
33516
33271
 
33517
33272
  /**
33518
- * @param {import("../../core/location/location").LocationProvider} $locationProvider
33273
+ * @param {import("../../services/location/location").LocationProvider} $locationProvider
33519
33274
  * @param {import("../../router/state/state-service.js").StateProvider} stateService
33520
33275
  * @param globals
33521
33276
  * @param {import("../../router/url/url-config.js").UrlConfigProvider} urlConfigProvider
@@ -33524,9 +33279,7 @@ class UrlService {
33524
33279
  this.stateService = stateService;
33525
33280
  this.stateService.urlService = this; // circular wiring
33526
33281
  this.$locationProvider = $locationProvider;
33527
-
33528
33282
  this.$location = undefined;
33529
- this.$browser = undefined;
33530
33283
 
33531
33284
  /** Provides services related to the URL */
33532
33285
  this.urlRuleFactory = new UrlRuleFactory(this, this.stateService, globals);
@@ -33579,18 +33332,15 @@ class UrlService {
33579
33332
 
33580
33333
  $get = [
33581
33334
  "$location",
33582
- "$browser",
33583
33335
  "$rootScope",
33584
33336
  /**
33585
33337
  *
33586
- * @param {import('../../core/location/location.js').Location} $location
33587
- * @param {import('../../services/browser.js').Browser} $browser
33338
+ * @param {import('../../services/location/location.js').Location} $location
33588
33339
  * @param {import('../../core/scope/scope.js').Scope} $rootScope
33589
33340
  * @returns {UrlService}
33590
33341
  */
33591
- ($location, $browser, $rootScope) => {
33342
+ ($location, $rootScope) => {
33592
33343
  this.$location = $location;
33593
- this.$browser = $browser;
33594
33344
  $rootScope.$on("$locationChangeSuccess", (evt) => {
33595
33345
  this._urlListeners.forEach((fn) => {
33596
33346
  fn(evt);
@@ -33614,7 +33364,7 @@ class UrlService {
33614
33364
  baseHref() {
33615
33365
  return (
33616
33366
  this._baseHref ||
33617
- (this._baseHref = this.$browser.baseHref() || window.location.pathname)
33367
+ (this._baseHref = getBaseHref() || window.location.pathname)
33618
33368
  );
33619
33369
  }
33620
33370
 
@@ -34461,7 +34211,6 @@ class StateQueueManager {
34461
34211
  *
34462
34212
  * This API is found at `$stateRegistry` ([[UIRouter.stateRegistry]])
34463
34213
  *
34464
- * @implements {ServiceProvider}
34465
34214
  */
34466
34215
  class StateRegistryProvider {
34467
34216
  static $inject = provider([
@@ -35090,12 +34839,10 @@ function $StateRefActiveDirective(
35090
34839
  const removeClasses = allClasses.filter(
35091
34840
  (cls) => !addClasses.includes(cls),
35092
34841
  );
35093
- $scope.$evalAsync(() => {
35094
- addClasses.forEach((className) => $element.classList.add(className));
35095
- removeClasses.forEach((className) =>
35096
- $element.classList.remove(className),
35097
- );
35098
- });
34842
+ addClasses.forEach((className) => $element.classList.add(className));
34843
+ removeClasses.forEach((className) =>
34844
+ $element.classList.remove(className),
34845
+ );
35099
34846
  }
35100
34847
  update();
35101
34848
  },
@@ -35227,11 +34974,20 @@ function $StateRefActiveDirective(
35227
34974
  * });
35228
34975
  * ```
35229
34976
  */
34977
+
34978
+ /** @type {import("../../interface.js").AnnotatedDirectiveFactory} */
35230
34979
  let ngView = [
35231
34980
  "$view",
35232
34981
  "$animate",
35233
34982
  "$ngViewScroll",
35234
34983
  "$interpolate",
34984
+ /**
34985
+ * @param {*} $view
34986
+ * @param {*} $animate
34987
+ * @param {*} $ngViewScroll
34988
+ * @param {*} $interpolate
34989
+ * @returns {import("../../interface.js").Directive}
34990
+ */
35235
34991
  function $ViewDirective($view, $animate, $ngViewScroll, $interpolate) {
35236
34992
  function getRenderer() {
35237
34993
  return {
@@ -35262,7 +35018,6 @@ let ngView = [
35262
35018
  };
35263
35019
  const directive = {
35264
35020
  count: 0,
35265
-
35266
35021
  terminal: true,
35267
35022
  priority: 400,
35268
35023
  transclude: "element",
@@ -35599,11 +35354,12 @@ function ngChannelDirective($eventBus) {
35599
35354
  };
35600
35355
  }
35601
35356
 
35602
- ngSetterDirective.$inject = ["$parse", "$log"];
35357
+ ngSetterDirective.$inject = [$injectTokens.$parse, $injectTokens.$log];
35358
+
35603
35359
  /**
35604
35360
  * @param {import('../../core/parse/interface.ts').ParseService} $parse
35605
35361
  * @param {import('../../services/log/interface.ts').LogService} $log
35606
- * @returns {import('../../interface.ts').Directive}
35362
+ * @returns {import('interface.ts').Directive}
35607
35363
  */
35608
35364
  function ngSetterDirective($parse, $log) {
35609
35365
  return {
@@ -35612,19 +35368,19 @@ function ngSetterDirective($parse, $log) {
35612
35368
  const modelExpression = attrs["ngSetter"];
35613
35369
 
35614
35370
  if (!modelExpression) {
35615
- $log.warn("ngSetter: Model expression is not provided.");
35371
+ $log.warn("ng-setter: expression null");
35616
35372
  return;
35617
35373
  }
35618
35374
 
35619
35375
  const assignModel = $parse(modelExpression).assign;
35620
35376
 
35621
35377
  if (!assignModel) {
35622
- $log.warn("ngSetter: Invalid model expression.");
35378
+ $log.warn("ng-setter: expression invalid");
35623
35379
  return;
35624
35380
  }
35625
35381
 
35626
35382
  const updateModel = (value) => {
35627
- assignModel(scope, value);
35383
+ assignModel(scope, value.trim());
35628
35384
  };
35629
35385
 
35630
35386
  const observer = new MutationObserver((mutationsList) => {
@@ -35644,16 +35400,11 @@ function ngSetterDirective($parse, $log) {
35644
35400
  }
35645
35401
  });
35646
35402
 
35647
- if (element && element) {
35648
- observer.observe(element, {
35649
- childList: true,
35650
- subtree: true,
35651
- characterData: true,
35652
- });
35653
- } else {
35654
- $log.warn("ngSetter: Element is not a valid DOM node.");
35655
- return;
35656
- }
35403
+ observer.observe(element, {
35404
+ childList: true,
35405
+ subtree: true,
35406
+ characterData: true,
35407
+ });
35657
35408
 
35658
35409
  scope.$on("$destroy", () => observer.disconnect());
35659
35410
  updateModel(element.innerHTML);
@@ -35668,13 +35419,20 @@ function ngSetterDirective($parse, $log) {
35668
35419
  function defineDirective(method) {
35669
35420
  const attrName = "ng" + method.charAt(0).toUpperCase() + method.slice(1);
35670
35421
  const directive = createHttpDirective(method, attrName);
35671
- directive["$inject"] = ["$http", "$compile", "$log"];
35422
+ directive["$inject"] = [$injectTokens.$http, $injectTokens.$compile, $injectTokens.$log, $injectTokens.$parse, $injectTokens.$state];
35672
35423
  return directive;
35673
35424
  }
35674
35425
 
35426
+ /** @type {import('../../interface.ts').DirectiveFactory} */
35675
35427
  const ngGetDirective = defineDirective("get");
35428
+
35429
+ /** @type {import('../../interface.ts').DirectiveFactory} */
35676
35430
  const ngDeleteDirective = defineDirective("delete");
35431
+
35432
+ /** @type {import('../../interface.ts').DirectiveFactory} */
35677
35433
  const ngPostDirective = defineDirective("post");
35434
+
35435
+ /** @type {import('../../interface.ts').DirectiveFactory} */
35678
35436
  const ngPutDirective = defineDirective("put");
35679
35437
 
35680
35438
  /**
@@ -35701,7 +35459,7 @@ function getEventNameForElement(element) {
35701
35459
  * Handles DOM manipulation based on a swap strategy and server-rendered HTML.
35702
35460
  *
35703
35461
  * @param {string} html - The HTML string returned from the server.
35704
- * @param {import("../../interface.ts").SwapInsertPosition} swap
35462
+ * @param {import("../../interface.ts").SwapModeType} swap
35705
35463
  * @param {Element} target - The target DOM element to apply the swap to.
35706
35464
  * @param {import('../../core/scope/scope.js').Scope} scope
35707
35465
  * @param {import('../../core/compile/compile.js').CompileFn} $compile
@@ -35792,9 +35550,11 @@ function createHttpDirective(method, attrName) {
35792
35550
  * @param {import("interface.ts").HttpService} $http
35793
35551
  * @param {import("../../core/compile/compile.js").CompileFn} $compile
35794
35552
  * @param {import("../../services/log/interface.ts").LogService} $log
35553
+ * @param {import("../../core/parse/interface.ts").ParseService} $parse
35554
+ * @param {import("../../router/state/state-service.js").StateProvider} $state
35795
35555
  * @returns {import('../../interface.ts').Directive}
35796
35556
  */
35797
- return function ($http, $compile, $log) {
35557
+ return function ($http, $compile, $log, $parse, $state) {
35798
35558
  /**
35799
35559
  * Collects form data from the element or its associated form.
35800
35560
  *
@@ -35855,16 +35615,38 @@ function createHttpDirective(method, attrName) {
35855
35615
  restrict: "A",
35856
35616
  terminal: true,
35857
35617
  link(scope, element, attrs) {
35858
- /** @type {EventType} */
35859
- const eventName = getEventNameForElement(element);
35618
+ const eventName =
35619
+ attrs["trigger"] ||
35620
+ /** @type {EventType} */ getEventNameForElement(element);
35621
+
35860
35622
  const tag = element.tagName.toLowerCase();
35861
35623
 
35862
- element.addEventListener(eventName, (event) => {
35624
+ if (isDefined(attrs["latch"])) {
35625
+ attrs.$observe(
35626
+ "latch",
35627
+ callBackAfterFirst(() =>
35628
+ element.dispatchEvent(new Event(eventName)),
35629
+ ),
35630
+ );
35631
+ }
35632
+
35633
+ let throttled = false;
35634
+ let intervalId;
35635
+
35636
+ if (isDefined(attrs["interval"])) {
35637
+ element.dispatchEvent(new Event(eventName));
35638
+ intervalId = setInterval(
35639
+ () => element.dispatchEvent(new Event(eventName)),
35640
+ parseInt(attrs["interval"]) || 1000,
35641
+ );
35642
+ }
35643
+
35644
+ element.addEventListener(eventName, async (event) => {
35863
35645
  if (/** @type {HTMLButtonElement} */ (element).disabled) return;
35864
35646
  if (tag === "form") event.preventDefault();
35865
35647
 
35866
- const swap = element.dataset.swap || "innerHTML";
35867
- const targetSelector = element.dataset.target;
35648
+ const swap = attrs["swap"] || "innerHTML";
35649
+ const targetSelector = attrs["target"];
35868
35650
  const target = targetSelector
35869
35651
  ? document.querySelector(targetSelector)
35870
35652
  : element;
@@ -35881,18 +35663,67 @@ function createHttpDirective(method, attrName) {
35881
35663
  }
35882
35664
 
35883
35665
  const handler = (res) => {
35666
+ if (isDefined(attrs["loading"])) {
35667
+ attrs.$set("loading", false);
35668
+ }
35669
+
35670
+ if (isDefined(attrs["loadingClass"])) {
35671
+ attrs.$removeClass(attrs["loadingClass"]);
35672
+ }
35673
+
35884
35674
  const html = res.data;
35675
+ if (200 <= res.status && res.status <= 299) {
35676
+ if (isDefined(attrs["success"])) {
35677
+ $parse(attrs["success"])(scope, { $res: html });
35678
+ }
35679
+
35680
+ if (isDefined(attrs["stateSuccess"])) {
35681
+ $state.go(attrs["stateSuccess"]);
35682
+ }
35683
+ } else if (400 <= res.status && res.status <= 599) {
35684
+ if (isDefined(attrs["error"])) {
35685
+ $parse(attrs["error"])(scope, { $res: html });
35686
+ }
35687
+
35688
+ if (isDefined(attrs["stateError"])) {
35689
+ $state.go(attrs["stateError"]);
35690
+ }
35691
+ }
35692
+
35885
35693
  handleSwapResponse(
35886
35694
  html,
35887
- /** @type {import("../../interface.ts").SwapInsertPosition} */ (
35888
- swap
35889
- ),
35695
+ /** @type {import("../../interface.ts").SwapModeType} */ (swap),
35890
35696
  target,
35891
35697
  scope,
35892
35698
  $compile,
35893
35699
  );
35894
35700
  };
35895
35701
 
35702
+ if (isDefined(attrs["delay"])) {
35703
+ await wait(parseInt(attrs["delay"]) | 0);
35704
+ }
35705
+
35706
+ if (throttled) {
35707
+ return;
35708
+ }
35709
+
35710
+ if (isDefined(attrs["throttle"])) {
35711
+ throttled = true;
35712
+ attrs.$set("throttled", true);
35713
+ setTimeout(() => {
35714
+ attrs.$set("throttled", false);
35715
+ throttled = false;
35716
+ }, parseInt(attrs["throttle"]));
35717
+ }
35718
+
35719
+ if (isDefined(attrs["loading"])) {
35720
+ attrs.$set("loading", true);
35721
+ }
35722
+
35723
+ if (isDefined(attrs["loadingClass"])) {
35724
+ attrs.$addClass(attrs["loadingClass"]);
35725
+ }
35726
+
35896
35727
  if (method === "post" || method === "put") {
35897
35728
  const data = collectFormData(element);
35898
35729
  $http[method](url, data).then(handler).catch(handler);
@@ -35900,6 +35731,8 @@ function createHttpDirective(method, attrName) {
35900
35731
  $http[method](url).then(handler).catch(handler);
35901
35732
  }
35902
35733
  });
35734
+
35735
+ scope.$on("$destroy", () => clearInterval(intervalId));
35903
35736
  },
35904
35737
  };
35905
35738
  };
@@ -35911,13 +35744,13 @@ function createHttpDirective(method, attrName) {
35911
35744
  * @returns {import('./core/di/ng-module.js').NgModule} `ng` module
35912
35745
  */
35913
35746
  function registerNgModule(angular) {
35914
- const ng = angular
35747
+ return angular
35915
35748
  .module(
35916
35749
  "ng",
35917
35750
  [],
35918
35751
  [
35919
35752
  "$provide",
35920
- /** @type {import('./interface.js').Provider} */
35753
+ /** @param {import("./interface.js").Provider} $provide */
35921
35754
  ($provide) => {
35922
35755
  // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
35923
35756
  $provide.provider({
@@ -36018,7 +35851,6 @@ function registerNgModule(angular) {
36018
35851
  $$animateQueue: AnimateQueueProvider,
36019
35852
  $$AnimateRunner: AnimateRunnerFactoryProvider,
36020
35853
  $$animateAsyncRun: AnimateAsyncRunFactoryProvider,
36021
- $browser: BrowserProvider,
36022
35854
  $controller: ControllerProvider,
36023
35855
  $exceptionHandler: ExceptionHandlerProvider,
36024
35856
  $filter: FilterProvider,
@@ -36034,7 +35866,6 @@ function registerNgModule(angular) {
36034
35866
  $routerGlobals: RouterGlobals,
36035
35867
  $sce: SceProvider,
36036
35868
  $sceDelegate: SceDelegateProvider,
36037
- $$taskTrackerFactory: TaskTrackerFactoryProvider,
36038
35869
  $templateCache: TemplateCacheProvider,
36039
35870
  $templateRequest: TemplateRequestProvider,
36040
35871
  $urlConfig: UrlConfigProvider,
@@ -36061,8 +35892,6 @@ function registerNgModule(angular) {
36061
35892
  },
36062
35893
  ])
36063
35894
  .value("$trace", trace);
36064
-
36065
- return ng;
36066
35895
  }
36067
35896
 
36068
35897
  const ngMinErr = minErr("ng");
@@ -36088,7 +35917,7 @@ class Angular {
36088
35917
  /**
36089
35918
  * @type {string} `version` from `package.json`
36090
35919
  */
36091
- this.version = "0.7.5"; //inserted via rollup plugin
35920
+ this.version = "0.7.8"; //inserted via rollup plugin
36092
35921
 
36093
35922
  /** @type {!Array<string|any>} */
36094
35923
  this.bootsrappedModules = [];
@@ -36328,12 +36157,7 @@ class Angular {
36328
36157
  name,
36329
36158
  );
36330
36159
  }
36331
- const moduleInstance = new NgModule(
36332
- name,
36333
- requires,
36334
- /** @type {Function} */ (configFn),
36335
- );
36336
- return moduleInstance;
36160
+ return new NgModule(name, requires, /** @type {Function} */ (configFn));
36337
36161
  });
36338
36162
  }
36339
36163
  }