@angular-wave/angular.ts 0.15.0 → 0.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/@types/angular.d.ts +4 -1
  2. package/@types/core/compile/attributes.d.ts +28 -4
  3. package/@types/core/compile/inteface.d.ts +5 -1
  4. package/@types/core/di/inteface.d.ts +11 -0
  5. package/@types/core/parse/ast/ast-node.d.ts +2 -0
  6. package/@types/core/parse/parse.d.ts +4 -1
  7. package/@types/core/scope/interface.d.ts +26 -0
  8. package/@types/core/scope/scope.d.ts +16 -24
  9. package/@types/directive/bind/bind.d.ts +5 -7
  10. package/@types/directive/form/form.d.ts +12 -9
  11. package/@types/directive/init/init.d.ts +2 -2
  12. package/@types/directive/input/input.d.ts +8 -24
  13. package/@types/directive/listener/listener.d.ts +4 -0
  14. package/@types/directive/model/interface.d.ts +18 -0
  15. package/@types/directive/model/model.d.ts +20 -18
  16. package/@types/directive/non-bindable/non-bindable.d.ts +2 -2
  17. package/@types/directive/select/select.d.ts +2 -2
  18. package/@types/directive/setter/setter.d.ts +2 -2
  19. package/@types/directive/show-hide/show-hide.d.ts +3 -4
  20. package/@types/directive/switch/switch.d.ts +4 -4
  21. package/@types/interface.d.ts +22 -1
  22. package/@types/namespace.d.ts +16 -2
  23. package/@types/router/router.d.ts +5 -3
  24. package/@types/router/scroll/interface.d.ts +1 -1
  25. package/@types/router/state/interface.d.ts +5 -0
  26. package/@types/router/state/state-builder.d.ts +10 -6
  27. package/@types/router/state/state-matcher.d.ts +11 -3
  28. package/@types/router/state/state-object.d.ts +3 -5
  29. package/@types/router/state/state-queue-manager.d.ts +14 -8
  30. package/@types/router/state/state-registry.d.ts +12 -3
  31. package/@types/router/state/state-service.d.ts +8 -2
  32. package/@types/router/transition/hook-registry.d.ts +15 -5
  33. package/@types/router/transition/transition.d.ts +4 -2
  34. package/@types/router/url/url-rules.d.ts +3 -84
  35. package/@types/router/url/url-service.d.ts +9 -8
  36. package/@types/services/cookie/cookie.d.ts +3 -11
  37. package/@types/services/http/http.d.ts +6 -31
  38. package/@types/services/http/interface.d.ts +22 -7
  39. package/@types/services/location/location.d.ts +14 -13
  40. package/@types/services/sce/interface.d.ts +25 -0
  41. package/@types/services/sse/interface.d.ts +8 -1
  42. package/@types/services/sse/sse.d.ts +10 -18
  43. package/@types/services/storage/storage.d.ts +6 -6
  44. package/@types/services/stream/interface.d.ts +1 -1
  45. package/@types/services/stream/stream.d.ts +98 -0
  46. package/@types/services/template-request/interface.d.ts +2 -9
  47. package/@types/services/template-request/template-request.d.ts +7 -40
  48. package/@types/shared/common.d.ts +2 -2
  49. package/@types/shared/dom.d.ts +21 -42
  50. package/@types/shared/hof.d.ts +27 -37
  51. package/@types/shared/noderef.d.ts +2 -2
  52. package/@types/shared/strings.d.ts +13 -4
  53. package/@types/shared/utils.d.ts +123 -76
  54. package/@types/shared/validate.d.ts +7 -0
  55. package/dist/angular-ts.esm.js +1129 -1407
  56. package/dist/angular-ts.umd.js +1129 -1407
  57. package/dist/angular-ts.umd.min.js +1 -1
  58. package/dist/angular-ts.umd.min.js.gz +0 -0
  59. package/dist/angular-ts.umd.min.js.map +1 -1
  60. package/package.json +1 -1
  61. package/@types/router/state-filters.d.ts +0 -39
  62. package/@types/shared/cache.d.ts +0 -7
@@ -1,4 +1,4 @@
1
- /* Version: 0.15.0 - December 14, 2025 04:42:37 */
1
+ /* Version: 0.15.2 - December 24, 2025 03:47:38 */
2
2
  const VALID_CLASS = "ng-valid";
3
3
  const INVALID_CLASS = "ng-invalid";
4
4
  const PRISTINE_CLASS = "ng-pristine";
@@ -102,14 +102,14 @@ function isArrayLike(obj) {
102
102
  // via the forEach method when constructing the JQLite object in the first place
103
103
  if (isArray(obj) || obj instanceof Array || isString(obj)) return true;
104
104
 
105
- const len = /** @type {Object} */ (obj).length;
105
+ const len = /** @type {ArrayLike<any>} */ (obj).length;
106
106
 
107
107
  // NodeList objects (with `item` method) and
108
108
  // other objects with suitable length characteristics are array-like
109
109
  return (
110
110
  isNumber(len) &&
111
111
  ((len >= 0 && len - 1 in /** @type {Object} */ (obj)) ||
112
- typeof (/** @type {Object} */ (obj).item) === "function")
112
+ typeof (/** @type {NodeList} */ (obj).item) === "function")
113
113
  );
114
114
  }
115
115
 
@@ -149,7 +149,7 @@ function isArray(array) {
149
149
  * @param {new (...args: any[]) => T} type The constructor to test against
150
150
  * @returns {val is T}
151
151
  */
152
- function isIntanceOf(val, type) {
152
+ function isInstanceOf(val, type) {
153
153
  return val instanceof type;
154
154
  }
155
155
 
@@ -168,8 +168,7 @@ function isObject(value) {
168
168
 
169
169
  /**
170
170
  * Determines if a reference is a `string`.
171
- *
172
- * @param value - The value to check.
171
+ * @param {unknown} value - The value to check.
173
172
  * @returns {value is string} True if `value` is a string.
174
173
  */
175
174
  function isString(value) {
@@ -282,7 +281,7 @@ function isRegExp(value) {
282
281
  * @returns {obj is Window} True if `obj` is a window obj.
283
282
  */
284
283
  function isWindow(obj) {
285
- return obj && isIntanceOf(obj, Window);
284
+ return isInstanceOf(obj, Window);
286
285
  }
287
286
 
288
287
  /**
@@ -341,25 +340,30 @@ function trim(value) {
341
340
  return isString(value) ? value.trim() : value;
342
341
  }
343
342
 
343
+ /**
344
+ * @param {string} name
345
+ * @param {string} separator
346
+ */
344
347
  function snakeCase(name, separator) {
345
348
  const modseparator = separator;
346
349
 
347
350
  return name.replace(
348
351
  /[A-Z]/g,
349
- (letter, pos) => (pos ? modseparator : "") + letter.toLowerCase(),
352
+ (/** @type {string} */ letter, /** @type {any} */ pos) =>
353
+ (pos ? modseparator : "") + letter.toLowerCase(),
350
354
  );
351
355
  }
352
356
 
353
357
  /**
354
358
  * Set or clear the hashkey for an object.
355
- * @param obj object
356
- * @param hashkey the hashkey (!truthy to delete the hashkey)
359
+ * @param {{ [x: string]: any; _hashKey?: any; }} obj object
360
+ * @param {any} hashkey the hashkey (!truthy to delete the hashkey)
357
361
  */
358
362
  function setHashKey(obj, hashkey) {
359
363
  if (hashkey) {
360
- obj.$$hashKey = hashkey;
364
+ obj._hashKey = hashkey;
361
365
  } else {
362
- delete obj.$$hashKey;
366
+ delete obj._hashKey;
363
367
  }
364
368
  }
365
369
 
@@ -374,7 +378,7 @@ function setHashKey(obj, hashkey) {
374
378
  * @returns {Object<string, any>} The extended destination object.
375
379
  */
376
380
  function baseExtend(dst, objs, deep = false) {
377
- const hasKey = dst.$$hashKey;
381
+ const hasKey = dst._hashKey;
378
382
 
379
383
  for (let i = 0, ii = objs.length; i < ii; ++i) {
380
384
  const obj = objs[i];
@@ -441,6 +445,10 @@ function inherit$1(parent, extra) {
441
445
  return extend(Object.create(parent), extra);
442
446
  }
443
447
 
448
+ /**
449
+ * @param {{ toString: () => string; }} obj
450
+ * @returns {boolean}
451
+ */
444
452
  function hasCustomToString(obj) {
445
453
  return isFunction(obj.toString) && obj.toString !== toString;
446
454
  }
@@ -451,12 +459,16 @@ function hasCustomToString(obj) {
451
459
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/nodeName)
452
460
  *
453
461
  * @param {Element} element
454
- * @returns
462
+ * @returns {string}
455
463
  */
456
464
  function getNodeName(element) {
457
465
  return lowercase(element.nodeName);
458
466
  }
459
467
 
468
+ /**
469
+ * @param {any} array
470
+ * @param {string} obj
471
+ */
460
472
  function includes(array, obj) {
461
473
  return Array.prototype.indexOf.call(array, obj) !== -1;
462
474
  }
@@ -479,6 +491,10 @@ function arrayRemove(array, value) {
479
491
  return index;
480
492
  }
481
493
 
494
+ /**
495
+ * @param {unknown} val1
496
+ * @param {unknown} val2
497
+ */
482
498
  function simpleCompare(val1, val2) {
483
499
  return val1 === val2 || (Number.isNaN(val1) && Number.isNaN(val2));
484
500
  }
@@ -633,6 +649,10 @@ function assertNotHasOwnProperty(name, context) {
633
649
  }
634
650
  }
635
651
 
652
+ /**
653
+ * @param {unknown} value
654
+ * @returns {string | unknown}
655
+ */
636
656
  function stringify$1(value) {
637
657
  if (isNull(value) || isUndefined(value)) {
638
658
  return "";
@@ -644,10 +664,14 @@ function stringify$1(value) {
644
664
  value = `${value}`;
645
665
  break;
646
666
  default:
647
- if (hasCustomToString(value) && !isArray(value) && !isDate(value)) {
648
- value = value.toString();
667
+ if (
668
+ hasCustomToString(/** @type {Object} */ (value)) &&
669
+ !isArray(value) &&
670
+ !isDate(value)
671
+ ) {
672
+ value = /** @type {Object} */ (value).toString();
649
673
  } else {
650
- value = toJson(value);
674
+ value = toJson(/** @type {any[]} */ (value));
651
675
  }
652
676
  }
653
677
 
@@ -662,10 +686,19 @@ function isValidObjectMaxDepth(maxDepth) {
662
686
  return isNumber(maxDepth) && maxDepth > 0;
663
687
  }
664
688
 
689
+ /**
690
+ * @param {any[]} array1
691
+ * @param {IArguments | any[] | NodeListOf<ChildNode>} array2
692
+ * @param {number | undefined} [index]
693
+ */
665
694
  function concat(array1, array2, index) {
666
695
  return array1.concat(Array.prototype.slice.call(array2, index));
667
696
  }
668
697
 
698
+ /**
699
+ * @param {IArguments | [string, ...any[]]} args
700
+ * @param {number} startIndex
701
+ */
669
702
  function sliceArgs(args, startIndex) {
670
703
  return Array.prototype.slice.call(args, startIndex);
671
704
  }
@@ -701,6 +734,10 @@ function bind(context, fn) {
701
734
  return fn;
702
735
  }
703
736
 
737
+ /**
738
+ * @param {string} key
739
+ * @param {unknown} value
740
+ */
704
741
  function toJsonReplacer(key, value) {
705
742
  let val = value;
706
743
 
@@ -722,93 +759,44 @@ function toJsonReplacer(key, value) {
722
759
  }
723
760
 
724
761
  /**
725
- * Serializes input into a JSON-formatted string. Properties with leading $$ characters will be
726
- * stripped since AngularTS uses this notation internally.
727
- *
728
- * @param {Object|Array|Date|string|number|boolean} obj Input to be serialized into JSON.
729
- * @param {boolean|number} [pretty=2] If set to true, the JSON output will contain newlines and whitespace.
730
- * If set to an integer, the JSON output will contain that many spaces per indentation.
731
- * @returns {string|undefined} JSON-ified string representing `obj`.
732
- * @knownIssue
762
+ * Serializes input into a JSON-formatted string. Properties with leading `$$` characters
763
+ * will be stripped since AngularTS uses this notation internally.
733
764
  *
734
- * The Safari browser throws a `RangeError` instead of returning `null` when it tries to stringify a `Date`
735
- * object with an invalid date value. The only reliable way to prevent this is to monkeypatch the
736
- * `Date.prototype.toJSON` method as follows:
737
- *
738
- * ```
739
- * let _DatetoJSON = Date.prototype.toJSON;
740
- * Date.prototype.toJSON = function() {
741
- * try {
742
- * return _DatetoJSON.call(this);
743
- * } catch(e) {
744
- * if (e instanceof RangeError) {
745
- * return null;
746
- * }
747
- * throw e;
748
- * }
749
- * };
750
- * ```
751
- *
752
- * See https://github.com/angular/angular.js/pull/14221 for more information.
765
+ * @param {Object|Array<any>|Date|string|number|boolean} obj
766
+ * Input to be serialized into JSON.
767
+ * @param {boolean|number} [pretty=2]
768
+ * If `true`, the JSON output will contain newlines and whitespace (2 spaces).
769
+ * If a number, the JSON output will contain that many spaces per indentation.
770
+ * @returns {string|undefined}
771
+ * JSON-ified string representing `obj`, or `undefined` if `obj` is undefined.
753
772
  */
754
773
  function toJson(obj, pretty) {
755
774
  if (isUndefined(obj)) return undefined;
756
775
 
757
776
  if (!isNumber(pretty)) {
758
- pretty = pretty ? 2 : null;
777
+ pretty = pretty ? 2 : undefined;
759
778
  }
760
779
 
761
- return JSON.stringify(obj, toJsonReplacer, /** @type {Number} */ (pretty));
780
+ return JSON.stringify(obj, toJsonReplacer, /** @type {number} */ (pretty));
762
781
  }
763
782
 
764
783
  /**
765
784
  * Deserializes a JSON string.
766
785
  *
767
786
  * @param {string} json JSON string to deserialize.
768
- * @returns {Object|Array|string|number} Deserialized JSON string.
787
+ * @returns {Object|Array<any>|string|number} Deserialized JSON string.
769
788
  */
770
789
  function fromJson(json) {
771
790
  return isString(json) ? JSON.parse(json) : json;
772
791
  }
773
792
 
774
- const MS_PER_MINUTE = 60_000; // 60,000 ms in a minute
775
-
776
- function timezoneToOffset(timezone, fallback) {
777
- const requestedTimezoneOffset =
778
- Date.parse(`Jan 01, 1970 00:00:00 ${timezone}`) / MS_PER_MINUTE;
779
-
780
- return isNumberNaN(requestedTimezoneOffset)
781
- ? fallback
782
- : requestedTimezoneOffset;
783
- }
784
-
785
- function addDateMinutes(date, minutes) {
786
- const newDate = new Date(date.getTime());
787
-
788
- newDate.setMinutes(newDate.getMinutes() + minutes);
789
-
790
- return newDate;
791
- }
792
-
793
- function convertTimezoneToLocal(date, timezone, reverse) {
794
- const doReverse = 1;
795
-
796
- const dateTimezoneOffset = date.getTimezoneOffset();
797
-
798
- const timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
799
-
800
- return addDateMinutes(
801
- date,
802
- doReverse * (timezoneOffset - dateTimezoneOffset),
803
- );
804
- }
805
-
806
793
  /**
807
794
  * Parses an escaped url query string into key-value pairs.
808
795
  * @param {string} keyValue
809
- * @returns {Object.<string,boolean|Array>}
796
+ * @returns {Object.<string,boolean|Array<any>>}
810
797
  */
811
798
  function parseKeyValue(keyValue) {
799
+ /** @type {Record<string, boolean | string | Array<any>>} */
812
800
  const obj = {};
813
801
 
814
802
  (keyValue || "").split("&").forEach((item) => {
@@ -832,9 +820,9 @@ function parseKeyValue(keyValue) {
832
820
  val = isDefined(val) ? tryDecodeURIComponent(val) : true;
833
821
 
834
822
  if (!hasOwn(obj, /** @type {string} */ (key))) {
835
- obj[key] = val;
823
+ obj[key] = /** @type {string } */ (val);
836
824
  } else if (isArray(obj[key])) {
837
- obj[key].push(val);
825
+ /** @type {Array<any>} */ (obj[key]).push(val);
838
826
  } else {
839
827
  obj[key] = [obj[key], val];
840
828
  }
@@ -842,10 +830,16 @@ function parseKeyValue(keyValue) {
842
830
  }
843
831
  });
844
832
 
845
- return /** @type {Object.<string,boolean|Array>} */ (obj);
833
+ return /** @type {Object.<string,boolean|Array<any>>} */ (obj);
846
834
  }
847
835
 
836
+ /**
837
+ * @param {string | { [s: string]: any; } | ArrayLike<any> | null} obj
838
+ */
848
839
  function toKeyValue(obj) {
840
+ /**
841
+ * @type {string[]}
842
+ */
849
843
  const parts = [];
850
844
 
851
845
  obj &&
@@ -913,6 +907,8 @@ function encodeUriSegment(val) {
913
907
  * pct-encoded = "%" HEXDIG HEXDIG
914
908
  * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
915
909
  * / "*" / "+" / "," / ";" / "="
910
+ * @param {string | number | boolean} val
911
+ * @param {boolean | undefined} [pctEncodeSpaces]
916
912
  */
917
913
  function encodeUriQuery(val, pctEncodeSpaces) {
918
914
  return encodeURIComponent(val)
@@ -927,28 +923,39 @@ function encodeUriQuery(val, pctEncodeSpaces) {
927
923
  const ngAttrPrefixes = ["ng-", "data-ng-"];
928
924
 
929
925
  /**
930
- * Creates a shallow copy of an object, an array or a primitive.
926
+ * Creates a shallow copy of an object, an array, or returns primitives as-is.
927
+ *
928
+ * Assumes there are no proto properties.
931
929
  *
932
- * Assumes that there are no proto properties for objects.
930
+ * @template T
931
+ * @param {T} src
932
+ * @param {T extends any[] ? T : Record<string, unknown>} [dst]
933
+ * @returns {T}
933
934
  */
934
935
  function shallowCopy(src, dst) {
935
936
  if (isArray(src)) {
936
- dst = dst || [];
937
+ /** @type {any[]} */
938
+ const out = /** @type {any[]} */ (dst) || [];
937
939
 
938
- for (let i = 0, ii = src.length; i < ii; i++) {
939
- dst[i] = src[i];
940
- }
941
- } else if (isObject(src)) {
942
- dst = dst || {};
940
+ out.push(...src);
941
+
942
+ return /** @type {T} */ (out);
943
+ }
944
+
945
+ if (isObject(src)) {
946
+ const out = /** @type {Record<string, unknown>} */ (dst) || {};
943
947
 
944
948
  for (const key in src) {
945
- if (!(key.startsWith("$") && key.charAt(1) === "$")) {
946
- dst[key] = src[key];
949
+ // Copy all properties except $$-prefixed
950
+ if (!key.startsWith("$$")) {
951
+ out[key] = src[key];
947
952
  }
948
953
  }
954
+
955
+ return /** @type {T} */ (out);
949
956
  }
950
957
 
951
- return dst || src;
958
+ return src;
952
959
  }
953
960
 
954
961
  /**
@@ -964,6 +971,9 @@ function assert(argument, errorMsg = "Assertion failed") {
964
971
 
965
972
  /**
966
973
  * Throw error if the argument is falsy.
974
+ * @param {string | boolean | Object} arg
975
+ * @param {string} name
976
+ * @param {string | undefined} [reason]
967
977
  */
968
978
  function assertArg(arg, name, reason) {
969
979
  if (!arg) {
@@ -978,6 +988,11 @@ function assertArg(arg, name, reason) {
978
988
  return arg;
979
989
  }
980
990
 
991
+ /**
992
+ * @param {string | Function | any[]} arg
993
+ * @param {string} name
994
+ * @param {boolean | undefined} [acceptArrayAnnotation]
995
+ */
981
996
  function assertArgFn(arg, name, acceptArrayAnnotation) {
982
997
  if (acceptArrayAnnotation && isArray(arg)) {
983
998
  arg = arg[arg.length - 1];
@@ -1065,7 +1080,7 @@ function minErr(module) {
1065
1080
 
1066
1081
  const templateArgs = sliceArgs(args, 2).map((arg) => toDebugString(arg));
1067
1082
 
1068
- message += template.replace(/\{\d+\}/g, (match) => {
1083
+ message += template.replace(/\{\d+\}/g, (/** @type {string} */ match) => {
1069
1084
  const index = +match.slice(1, -1);
1070
1085
 
1071
1086
  if (index < templateArgs.length) {
@@ -1124,19 +1139,19 @@ function toDebugString(obj) {
1124
1139
  * Hash of a:
1125
1140
  * string is string
1126
1141
  * number is number as string
1127
- * object is either result of calling $$hashKey function on the object or uniquely generated id,
1128
- * that is also assigned to the $$hashKey property of the object.
1142
+ * object is either result of calling _hashKey function on the object or uniquely generated id,
1143
+ * that is also assigned to the _hashKey property of the object.
1129
1144
  *
1130
1145
  * @param {*} obj
1131
1146
  * @returns {string} hash string such that the same input will have the same hash string.
1132
1147
  * The resulting string key is in 'type:hashKey' format.
1133
1148
  */
1134
1149
  function hashKey(obj) {
1135
- const key = obj && obj.$$hashKey;
1150
+ const key = obj && obj._hashKey;
1136
1151
 
1137
1152
  if (key) {
1138
1153
  if (typeof key === "function") {
1139
- return obj.$$hashKey();
1154
+ return obj._hashKey();
1140
1155
  }
1141
1156
 
1142
1157
  return key;
@@ -1145,9 +1160,9 @@ function hashKey(obj) {
1145
1160
  const objType = typeof obj;
1146
1161
 
1147
1162
  if (objType === "function" || (objType === "object" && obj !== null)) {
1148
- obj.$$hashKey = `${objType}:${nextUid()}`;
1163
+ obj._hashKey = `${objType}:${nextUid()}`;
1149
1164
 
1150
- return obj.$$hashKey;
1165
+ return obj._hashKey;
1151
1166
  }
1152
1167
 
1153
1168
  if (objType === "undefined") {
@@ -1409,14 +1424,6 @@ function isArrowFunction(fn) {
1409
1424
  return typeof fn === "function" && !fn.prototype;
1410
1425
  }
1411
1426
 
1412
- /**
1413
- * Expando cache for adding properties to DOM nodes with JavaScript.
1414
- * This used to be an Object in JQLite decorator, but swapped out for a Map
1415
- *
1416
- * @type {Map<number, import('../interface.ts').ExpandoStore>}
1417
- */
1418
- const Cache = new Map();
1419
-
1420
1427
  const ADD_CLASS_SUFFIX = "-add";
1421
1428
  const REMOVE_CLASS_SUFFIX = "-remove";
1422
1429
  const EVENT_CLASS_PREFIX = "ng-";
@@ -1843,10 +1850,18 @@ const ISOLATE_SCOPE_KEY = "$isolateScope";
1843
1850
 
1844
1851
  const EXPANDO = "ng";
1845
1852
 
1853
+ /**
1854
+ * Expando cache for adding properties to DOM nodes with JavaScript.
1855
+ * This used to be an Object in JQLite decorator, but swapped out for a Map
1856
+ *
1857
+ * @type {Map<number, import('../interface.ts').ExpandoStore>}
1858
+ */
1859
+ const Cache = new Map();
1860
+
1846
1861
  /**
1847
1862
  * Key for storing scope data, attached to an element
1848
1863
  */
1849
- const SCOPE_KEY = "$scope";
1864
+ const SCOPE_KEY = $injectTokens._scope;
1850
1865
 
1851
1866
  const DASH_LOWERCASE_REGEXP = /-([a-z])/g;
1852
1867
 
@@ -2289,7 +2304,7 @@ function startingTag(elementOrStr) {
2289
2304
  /**
2290
2305
  * Return the DOM siblings between the first and last node in the given array.
2291
2306
  * @param {Array<Node>} nodes An array-like object
2292
- * @returns {Element} the inputted object or a JQLite collection containing the nodes
2307
+ * @returns {*[]|Array<Node>} the inputted object or a JQLite collection containing the nodes
2293
2308
  */
2294
2309
  function getBlockNodes(nodes) {
2295
2310
  // TODO(perf): update `nodes` instead of creating a new object?
@@ -2399,7 +2414,7 @@ function emptyElement(element) {
2399
2414
  * @param {HTMLElement | Element} parentElement
2400
2415
  * The parent element that will receive the inserted element.
2401
2416
  *
2402
- * @param {HTMLElement | Element | null} [afterElement]
2417
+ * @param {ChildNode | Element | null} [afterElement]
2403
2418
  * An optional sibling element — if present and valid, `element`
2404
2419
  * will be inserted after it. If omitted or invalid, `element`
2405
2420
  * is prepended to `parentElement`.
@@ -2425,6 +2440,11 @@ function domInsert(element, parentElement, afterElement) {
2425
2440
  }
2426
2441
  }
2427
2442
 
2443
+ /**
2444
+ * @param {HTMLElement} element
2445
+ * @param {HTMLElement} parent
2446
+ * @param {ChildNode | null | undefined} after
2447
+ */
2428
2448
  function animatedomInsert(element, parent, after) {
2429
2449
  const originalVisibility = element.style.visibility;
2430
2450
 
@@ -2792,11 +2812,11 @@ class InjectorService extends AbstractInjector {
2792
2812
  * Creates a proxy that automatically persists an object's state
2793
2813
  * into a storage backend whenever a property is set.
2794
2814
  *
2795
- * @param {object} target - The object to wrap
2815
+ * @param {Record<PropertyKey, any>} target - The object to wrap
2796
2816
  * @param {string} key - The storage key
2797
- * @param {object} storage - Any storage-like object with getItem/setItem/removeItem
2817
+ * @param {import("../../core/di/inteface").StorageLike & import("../../core/di/inteface").PersistentStoreConfig} storage - Any storage-like object with getItem/setItem/removeItem
2798
2818
  * @param {{serialize?: function, deserialize?: function}} [options] - Optional custom (de)serialization
2799
- * @returns {Proxy}
2819
+ * @returns {Record<PropertyKey, any>}
2800
2820
  */
2801
2821
  function createPersistentProxy(target, key, storage, options = {}) {
2802
2822
  const serialize = options.serialize || JSON.stringify;
@@ -2862,7 +2882,6 @@ function isPromise(obj) {
2862
2882
  }
2863
2883
 
2864
2884
  const BADARG = "badarg";
2865
- const BADARGVALUE = "badarg: value";
2866
2885
 
2867
2886
  /** @type {Map<ng.Validator, string>} */
2868
2887
  const reasons = new Map([
@@ -2965,6 +2984,25 @@ function createInjector(modulesToLoad, strictDi = false) {
2965
2984
  /** @type {Map<String|Function, boolean>} */
2966
2985
  const loadedModules = new Map(); // Keep track of loaded modules to avoid circular dependencies
2967
2986
 
2987
+ /**
2988
+ * @typedef {{
2989
+ * $provide: {
2990
+ * provider: Function,
2991
+ * factory: Function,
2992
+ * service: Function,
2993
+ * value: Function,
2994
+ * constant: Function,
2995
+ * store: Function,
2996
+ * decorator: Function,
2997
+ * },
2998
+ * $injectorProvider?: {
2999
+ * $get: () => unknown
3000
+ * },
3001
+ * $injector?: ProviderInjector
3002
+ * }} ProviderCache
3003
+ */
3004
+
3005
+ /** @type {ProviderCache} */
2968
3006
  const providerCache = {
2969
3007
  $provide: {
2970
3008
  provider: supportObject(provider),
@@ -3121,12 +3159,11 @@ function createInjector(modulesToLoad, strictDi = false) {
3121
3159
  * Registers a service persisted in a storage
3122
3160
  *
3123
3161
  * @param {string} name - Service name
3124
- * @param {Function} ctor - Constructor for the service
3162
+ * @param {import("../../interface.ts").Constructor} ctor - Constructor for the service
3125
3163
  * @param {ng.StorageType} type - Type of storage to be instantiated
3126
- * @param {Storage|Object} backendOrConfig - Either a Storage-like object (getItem/setItem) or a config object
3127
- * with { backend, serialize, deserialize }
3164
+ * @param {import("./inteface.ts").StorageLike & import("./inteface.ts").PersistentStoreConfig} [backendOrConfig]
3128
3165
  */
3129
- function store(name, ctor, type, backendOrConfig = {}) {
3166
+ function store(name, ctor, type, backendOrConfig) {
3130
3167
  return provider(name, {
3131
3168
  $get: /** @param {ng.InjectorService} $injector */ ($injector) => {
3132
3169
  switch (type) {
@@ -3145,11 +3182,11 @@ function createInjector(modulesToLoad, strictDi = false) {
3145
3182
 
3146
3183
  const $cookie = $injector.get($injectTokens._cookie);
3147
3184
 
3148
- const serialize = backendOrConfig.serialize ?? JSON.stringify;
3185
+ const serialize = backendOrConfig?.serialize ?? JSON.stringify;
3149
3186
 
3150
- const deserialize = backendOrConfig.deserialize ?? JSON.parse;
3187
+ const deserialize = backendOrConfig?.deserialize ?? JSON.parse;
3151
3188
 
3152
- const cookieOpts = backendOrConfig.cookie ?? {};
3189
+ const cookieOpts = backendOrConfig?.cookie ?? {};
3153
3190
 
3154
3191
  return createPersistentProxy(instance, name, {
3155
3192
  getItem(key) {
@@ -3199,10 +3236,15 @@ function createInjector(modulesToLoad, strictDi = false) {
3199
3236
  backend = localStorage;
3200
3237
  }
3201
3238
 
3202
- return createPersistentProxy(instance, name, backend, {
3203
- serialize,
3204
- deserialize,
3205
- });
3239
+ return createPersistentProxy(
3240
+ instance,
3241
+ name,
3242
+ /** @type {import("./inteface.ts").StorageLike} */ (backend),
3243
+ {
3244
+ serialize,
3245
+ deserialize,
3246
+ },
3247
+ );
3206
3248
  }
3207
3249
  }
3208
3250
 
@@ -3679,7 +3721,7 @@ function HttpProvider() {
3679
3721
  *
3680
3722
  * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the
3681
3723
  * XSRF token. Defaults value is `'X-XSRF-TOKEN'`.
3682
- *
3724
+ * @type {import("./interface.ts").HttpProviderDefaults}
3683
3725
  */
3684
3726
  const defaults = (this.defaults = {
3685
3727
  // transform incoming response data
@@ -3748,6 +3790,7 @@ function HttpProvider() {
3748
3790
  * array, on request, but reverse order, on response.
3749
3791
  *
3750
3792
  * {@link ng.$http#interceptors Interceptors detailed info}
3793
+ * @type {Array<string | ng.Injectable<import("./interface.ts").HttpInterceptorFactory>>}
3751
3794
  */
3752
3795
  this.interceptors = [];
3753
3796
 
@@ -3791,19 +3834,6 @@ function HttpProvider() {
3791
3834
  */
3792
3835
  this.xsrfTrustedOrigins = [];
3793
3836
 
3794
- /**
3795
- * This property is deprecated. Use {@link $httpProvider#xsrfTrustedOrigins xsrfTrustedOrigins}
3796
- * instead.
3797
- */
3798
- Object.defineProperty(this, "xsrfWhitelistedOrigins", {
3799
- get() {
3800
- return this.xsrfTrustedOrigins;
3801
- },
3802
- set(origins) {
3803
- this.xsrfTrustedOrigins = origins;
3804
- },
3805
- });
3806
-
3807
3837
  const that = this;
3808
3838
 
3809
3839
  this.$get = [
@@ -4688,14 +4718,14 @@ function createHttpDirective(method, attrName) {
4688
4718
  * @param {import("./interface.ts").SwapModeType} swap
4689
4719
  * @param {ng.Scope} scopeParam
4690
4720
  * @param {ng.Attributes} attrsParam
4691
- * @param {Element} elmenetParam
4721
+ * @param {Element} elementParam
4692
4722
  */
4693
4723
  function handleSwapResponse(
4694
4724
  html,
4695
4725
  swap,
4696
4726
  scopeParam,
4697
4727
  attrsParam,
4698
- elmenetParam,
4728
+ elementParam,
4699
4729
  ) {
4700
4730
  let animationEnabled = false;
4701
4731
 
@@ -4718,7 +4748,7 @@ function createHttpDirective(method, attrName) {
4718
4748
 
4719
4749
  const target = targetSelector
4720
4750
  ? document.querySelector(targetSelector)
4721
- : elmenetParam;
4751
+ : elementParam;
4722
4752
 
4723
4753
  if (!target) {
4724
4754
  $log.warn(`${attrName}: target "${targetSelector}" not found`);
@@ -5679,14 +5709,14 @@ class NodeRef {
5679
5709
  * @throws {Error} If the argument is invalid or cannot be wrapped properly.
5680
5710
  */
5681
5711
  constructor(element) {
5682
- /** @private @type {Node | ChildNode | null} */
5683
- this._node = null;
5712
+ /** @private @type {Node | ChildNode | undefined} */
5713
+ this._node = undefined;
5684
5714
 
5685
5715
  /** @type {Element | undefined} */
5686
5716
  this._element = undefined;
5687
5717
 
5688
- /** @private @type {Array<Node> | undefined} a stable list on nodes */
5689
- this._nodes = undefined;
5718
+ /** @private @type {Array<Node>} a stable list on nodes */
5719
+ this._nodes = [];
5690
5720
 
5691
5721
  /** @type {boolean} */
5692
5722
  this._isList = false;
@@ -5804,7 +5834,9 @@ class NodeRef {
5804
5834
  if (this._isList) {
5805
5835
  return this._nodes[0];
5806
5836
  } else {
5807
- return this._element || this._node;
5837
+ return /** @type {Element | Node | ChildNode} */ (
5838
+ this._element || this._node
5839
+ );
5808
5840
  }
5809
5841
  }
5810
5842
 
@@ -5813,7 +5845,9 @@ class NodeRef {
5813
5845
  if (this._isList) {
5814
5846
  return this._nodes;
5815
5847
  } else {
5816
- return this._element || this._node;
5848
+ return /** @type {Element | Node | ChildNode} */ (
5849
+ this._element || this._node
5850
+ );
5817
5851
  }
5818
5852
  }
5819
5853
 
@@ -5822,7 +5856,9 @@ class NodeRef {
5822
5856
  if (this._isList) {
5823
5857
  return Array.from(this._nodes);
5824
5858
  } else {
5825
- return [this._element || this._node];
5859
+ return [
5860
+ /** @type {Element | Node | ChildNode} */ (this._element || this._node),
5861
+ ];
5826
5862
  }
5827
5863
  }
5828
5864
 
@@ -6978,10 +7014,29 @@ const SIMPLE_ATTR_NAME = /^\w/;
6978
7014
 
6979
7015
  const specialAttrHolder = document.createElement("div");
6980
7016
 
7017
+ /**
7018
+ * @extends {Record<string, any>}
7019
+ */
6981
7020
  class Attributes {
6982
7021
  static $nonscope = true;
6983
7022
 
6984
7023
  /**
7024
+ * Creates an Attributes instance.
7025
+ *
7026
+ * There are two construction modes:
7027
+ *
7028
+ * 1. **Fresh instance** (no `attributesToCopy`):
7029
+ * - Used when compiling a DOM element for the first time.
7030
+ * - Initializes a new `$attr` map to track normalized → DOM attribute names.
7031
+ *
7032
+ * 2. **Clone instance** (`attributesToCopy` provided):
7033
+ * - Used when cloning attributes for directive linking / child scopes.
7034
+ * - Performs a shallow copy of all properties from the source Attributes object,
7035
+ * including `$attr`, normalized attribute values, and internal fields
7036
+ * (e.g. `$$observers`).
7037
+ * - `$attr` is intentionally **not reinitialized** in this case, because the
7038
+ * source object already contains the correct normalized → DOM attribute mapping.
7039
+ *
6985
7040
  * @param {ng.AnimateService} $animate
6986
7041
  * @param {ng.ExceptionHandlerService} $exceptionHandler
6987
7042
  * @param {*} $sce
@@ -7002,16 +7057,20 @@ class Attributes {
7002
7057
  this[key] = attributesToCopy[key];
7003
7058
  }
7004
7059
  } else {
7060
+ /**
7061
+ * A map of DOM element attribute names to the normalized name. This is needed
7062
+ * to do reverse lookup from normalized name back to actual name.
7063
+ */
7005
7064
  this.$attr = {};
7006
7065
  }
7007
7066
 
7008
7067
  /** @type {import("../../shared/noderef.js").NodeRef} */
7009
- this.$nodeRef = nodeRef;
7068
+ this._nodeRef = nodeRef;
7010
7069
  }
7011
7070
 
7012
7071
  /** @type {Node|Element} */
7013
7072
  get $$element() {
7014
- return this.$nodeRef.node;
7073
+ return this._nodeRef.node;
7015
7074
  }
7016
7075
 
7017
7076
  /**
@@ -7040,7 +7099,7 @@ class Attributes {
7040
7099
  classVal,
7041
7100
  );
7042
7101
  } else {
7043
- this.$nodeRef.element.classList.add(classVal);
7102
+ this._nodeRef.element.classList.add(classVal);
7044
7103
  }
7045
7104
  }
7046
7105
  }
@@ -7059,7 +7118,7 @@ class Attributes {
7059
7118
  classVal,
7060
7119
  );
7061
7120
  } else {
7062
- this.$nodeRef.element.classList.remove(classVal);
7121
+ this._nodeRef.element.classList.remove(classVal);
7063
7122
  }
7064
7123
  }
7065
7124
  }
@@ -7078,7 +7137,7 @@ class Attributes {
7078
7137
  if (hasAnimate(this.$$element)) {
7079
7138
  this._$animate.addClass(/** @type {Element }*/ (this.$$element), toAdd);
7080
7139
  } else {
7081
- this.$nodeRef.element.classList.add(...toAdd.trim().split(/\s+/));
7140
+ this._nodeRef.element.classList.add(...toAdd.trim().split(/\s+/));
7082
7141
  }
7083
7142
  }
7084
7143
  const toRemove = tokenDifference(oldClasses, newClasses);
@@ -7090,7 +7149,7 @@ class Attributes {
7090
7149
  toRemove,
7091
7150
  );
7092
7151
  } else {
7093
- this.$nodeRef.element.classList.remove(...toRemove.trim().split(/\s+/));
7152
+ this._nodeRef.element.classList.remove(...toRemove.trim().split(/\s+/));
7094
7153
  }
7095
7154
  }
7096
7155
  }
@@ -7138,7 +7197,7 @@ class Attributes {
7138
7197
  }
7139
7198
  }
7140
7199
 
7141
- const nodeName = this.$nodeRef.node.nodeName.toLowerCase();
7200
+ const nodeName = this._nodeRef.node.nodeName.toLowerCase();
7142
7201
 
7143
7202
  let maybeSanitizedValue;
7144
7203
 
@@ -7199,6 +7258,7 @@ class Attributes {
7199
7258
  }
7200
7259
 
7201
7260
  /**
7261
+ * @template T
7202
7262
  * Observes an interpolated attribute.
7203
7263
  *
7204
7264
  * The observer function will be invoked once during the next `$digest` following
@@ -7206,11 +7266,11 @@ class Attributes {
7206
7266
  * changes.
7207
7267
  *
7208
7268
  * @param {string} key Normalized key. (ie ngAttribute) .
7209
- * @param {any} fn Function that will be called whenever
7269
+ * @param {(value?: T) => any} fn Function that will be called whenever
7210
7270
  the interpolated value of the attribute changes.
7211
7271
  * See the {@link guide/interpolation#how-text-and-attribute-bindings-work Interpolation
7212
7272
  * guide} for more info.
7213
- * @returns {function()} Returns a deregistration function for this observer.
7273
+ * @returns {Function} Returns a deregistration function for this observer.
7214
7274
  */
7215
7275
  $observe(key, fn) {
7216
7276
  const $$observers =
@@ -8364,7 +8424,7 @@ class CompileProvider {
8364
8424
  * @param {Attributes|any} attrs The shared attrs object which is used to populate the normalized attributes.
8365
8425
  * @param {number=} maxPriority Max directive priority.
8366
8426
  * @param {string} [ignoreDirective]
8367
- * @return {import('../../interface.ts').Directive[]} An array to which the directives are added to. This array is sorted before the function returns.
8427
+ * @return {ng.Directive[]} An array to which the directives are added to. This array is sorted before the function returns.
8368
8428
  */
8369
8429
  function collectDirectives(node, attrs, maxPriority, ignoreDirective) {
8370
8430
  /**
@@ -8615,7 +8675,7 @@ class CompileProvider {
8615
8675
 
8616
8676
  const { index } = previousCompileContext;
8617
8677
 
8618
- templateAttrs.$nodeRef = compileNodeRef;
8678
+ templateAttrs._nodeRef = compileNodeRef;
8619
8679
  let directive;
8620
8680
 
8621
8681
  let directiveName;
@@ -8666,7 +8726,7 @@ class CompileProvider {
8666
8726
 
8667
8727
  if (compileNode === linkNode) {
8668
8728
  attrs = templateAttrs;
8669
- $element = templateAttrs.$nodeRef;
8729
+ $element = templateAttrs._nodeRef;
8670
8730
  } else {
8671
8731
  $element = new NodeRef(linkNode);
8672
8732
  attrs = new Attributes(
@@ -9092,7 +9152,7 @@ class CompileProvider {
9092
9152
  terminalPriority = directive.priority;
9093
9153
  $template = compileNodeRef;
9094
9154
  compileNodeRef = new NodeRef(document.createComment(""));
9095
- templateAttrs.$nodeRef = compileNodeRef;
9155
+ templateAttrs._nodeRef = compileNodeRef;
9096
9156
  compileNode = compileNodeRef.node;
9097
9157
  ctxNodeRef.node = compileNode;
9098
9158
  replaceWith(
@@ -9863,7 +9923,7 @@ class CompileProvider {
9863
9923
 
9864
9924
  let linkNode = $compileNode._getAny();
9865
9925
 
9866
- if (scope.$$destroyed) {
9926
+ if (scope._destroyed) {
9867
9927
  continue;
9868
9928
  }
9869
9929
 
@@ -9930,7 +9990,7 @@ class CompileProvider {
9930
9990
  ) {
9931
9991
  let childBoundTranscludeFn = boundTranscludeFn;
9932
9992
 
9933
- if (scope.$$destroyed) {
9993
+ if (scope._destroyed) {
9934
9994
  return;
9935
9995
  }
9936
9996
 
@@ -10791,13 +10851,13 @@ function assertValidDirectiveName(name) {
10791
10851
  * $nonscope: boolean,
10792
10852
  * $addControl: Function,
10793
10853
  * $getControls: () => any[],
10794
- * $$renameControl: Function,
10854
+ * _renameControl: Function,
10795
10855
  * $removeControl: Function,
10796
10856
  * $setValidity: Function | ((key: any, isValid: boolean, control: any) => any),
10797
10857
  * $setDirty: Function,
10798
10858
  * $setPristine: Function,
10799
10859
  * $setSubmitted: Function,
10800
- * $$setSubmitted: Function
10860
+ * _setSubmitted: Function
10801
10861
  * }}
10802
10862
  */
10803
10863
  const nullFormCtrl = {
@@ -10806,7 +10866,7 @@ const nullFormCtrl = {
10806
10866
  /* empty */
10807
10867
  },
10808
10868
  $getControls: () => [],
10809
- $$renameControl: (control, name) => {
10869
+ _renameControl: (control, name) => {
10810
10870
  control.$name = name;
10811
10871
  },
10812
10872
  $removeControl: () => {
@@ -10824,7 +10884,7 @@ const nullFormCtrl = {
10824
10884
  $setSubmitted: () => {
10825
10885
  /* empty */
10826
10886
  },
10827
- $$setSubmitted: () => {
10887
+ _setSubmitted: () => {
10828
10888
  /* empty */
10829
10889
  },
10830
10890
  };
@@ -10881,11 +10941,11 @@ const SUBMITTED_CLASS = "ng-submitted";
10881
10941
  class FormController {
10882
10942
  static $nonscope = true;
10883
10943
  /* @ignore */ static $inject = [
10884
- "$element",
10885
- "$attrs",
10886
- "$scope",
10887
- "$animate",
10888
- "$interpolate",
10944
+ $injectTokens._element,
10945
+ $injectTokens._attrs,
10946
+ $injectTokens._scope,
10947
+ $injectTokens._animate,
10948
+ $injectTokens._interpolate,
10889
10949
  ];
10890
10950
 
10891
10951
  /**
@@ -10896,7 +10956,7 @@ class FormController {
10896
10956
  * @param {ng.InterpolateService} $interpolate
10897
10957
  */
10898
10958
  constructor($element, $attrs, $scope, $animate, $interpolate) {
10899
- this.$$controls = [];
10959
+ this._controls = [];
10900
10960
 
10901
10961
  this.$name = $interpolate($attrs.name || $attrs.ngForm || "")($scope);
10902
10962
 
@@ -10925,6 +10985,7 @@ class FormController {
10925
10985
 
10926
10986
  this.$$classCache[VALID_CLASS] = isValid;
10927
10987
  this.$$classCache[INVALID_CLASS] = !isValid;
10988
+ this.$target = {};
10928
10989
  }
10929
10990
 
10930
10991
  /**
@@ -10935,7 +10996,7 @@ class FormController {
10935
10996
  * a form that uses `ng-model-options` to pend updates.
10936
10997
  */
10937
10998
  $rollbackViewValue() {
10938
- this.$$controls.forEach((control) => {
10999
+ this._controls.forEach((control) => {
10939
11000
  control.$rollbackViewValue();
10940
11001
  });
10941
11002
  }
@@ -10948,7 +11009,7 @@ class FormController {
10948
11009
  * usually handles calling this in response to input events.
10949
11010
  */
10950
11011
  $commitViewValue() {
10951
- this.$$controls.forEach((control) => {
11012
+ this._controls.forEach((control) => {
10952
11013
  control.$commitViewValue();
10953
11014
  });
10954
11015
  }
@@ -10972,7 +11033,7 @@ class FormController {
10972
11033
  // Breaking change - before, inputs whose name was "hasOwnProperty" were quietly ignored
10973
11034
  // and not added to the scope. Now we throw an error.
10974
11035
  assertNotHasOwnProperty(control.$name, "input");
10975
- this.$$controls.push(control);
11036
+ this._controls.push(control);
10976
11037
 
10977
11038
  if (control.$name) {
10978
11039
  this[control.$name] = control;
@@ -10994,13 +11055,14 @@ class FormController {
10994
11055
  * Likewise, adding a control to, or removing a control from the form is not reflected
10995
11056
  * in the shallow copy. That means you should get a fresh copy from `$getControls()` every time
10996
11057
  * you need access to the controls.
11058
+ * @returns {ReadonlyArray<FormController>}
10997
11059
  */
10998
11060
  $getControls() {
10999
- return shallowCopy(this.$$controls);
11061
+ return shallowCopy(this._controls);
11000
11062
  }
11001
11063
 
11002
11064
  // Private API: rename a form control
11003
- $$renameControl(control, newName) {
11065
+ _renameControl(control, newName) {
11004
11066
  const oldName = control.$name;
11005
11067
 
11006
11068
  if (this[oldName] === control) {
@@ -11019,6 +11081,7 @@ class FormController {
11019
11081
  * form. `$dirty`, `$submitted` states will not be changed, because the expected behavior can be
11020
11082
  * different from case to case. For example, removing the only `$dirty` control from a form may or
11021
11083
  * may not mean that the form is still `$dirty`.
11084
+ * @param {FormController } control
11022
11085
  */
11023
11086
  $removeControl(control) {
11024
11087
  if (control.$name && this[control.$name] === control) {
@@ -11037,7 +11100,7 @@ class FormController {
11037
11100
  this.$setValidity(name, null, control);
11038
11101
  });
11039
11102
 
11040
- arrayRemove(this.$$controls, control);
11103
+ arrayRemove(this._controls, control);
11041
11104
 
11042
11105
  control.$target.$$parentForm = nullFormCtrl;
11043
11106
  }
@@ -11090,7 +11153,7 @@ class FormController {
11090
11153
  this.$dirty = false;
11091
11154
  this.$pristine = true;
11092
11155
  this.$submitted = false;
11093
- this.$$controls.forEach((control) => {
11156
+ this._controls.forEach((control) => {
11094
11157
  control.$setPristine();
11095
11158
  });
11096
11159
  }
@@ -11105,7 +11168,7 @@ class FormController {
11105
11168
  * back to its pristine state.
11106
11169
  */
11107
11170
  $setUntouched() {
11108
- this.$$controls.forEach((control) => {
11171
+ this._controls.forEach((control) => {
11109
11172
  control.$setUntouched();
11110
11173
  });
11111
11174
  }
@@ -11121,19 +11184,19 @@ class FormController {
11121
11184
  while (rootForm.$$parentForm && rootForm.$$parentForm !== nullFormCtrl) {
11122
11185
  rootForm = rootForm.$$parentForm;
11123
11186
  }
11124
- rootForm.$$setSubmitted();
11187
+ rootForm._setSubmitted();
11125
11188
  }
11126
11189
 
11127
- $$setSubmitted() {
11190
+ _setSubmitted() {
11128
11191
  if (hasAnimate(this.$$element)) {
11129
11192
  this.$$animate.addClass(this.$$element, SUBMITTED_CLASS);
11130
11193
  } else {
11131
11194
  this.$$element.classList.add(SUBMITTED_CLASS);
11132
11195
  }
11133
11196
  this.$submitted = true;
11134
- this.$$controls.forEach((control) => {
11135
- if (control.$$setSubmitted) {
11136
- control.$$setSubmitted();
11197
+ this._controls.forEach((control) => {
11198
+ if (control._setSubmitted) {
11199
+ control._setSubmitted();
11137
11200
  }
11138
11201
  });
11139
11202
  }
@@ -11451,7 +11514,7 @@ const formDirectiveFactory = function (isNgForm) {
11451
11514
  attrParam.$observe(nameAttr, (newValue) => {
11452
11515
  if (controller.$name === newValue) return;
11453
11516
  scope.$target[controller.$name] = undefined;
11454
- controller.$$parentForm.$$renameControl(controller, newValue);
11517
+ controller.$$parentForm._renameControl(controller, newValue);
11455
11518
 
11456
11519
  if (
11457
11520
  scope.$target !== controller.$$parentForm &&
@@ -11674,12 +11737,12 @@ const ngModelMinErr = minErr("ngModel");
11674
11737
  */
11675
11738
 
11676
11739
  class NgModelController {
11677
- static $nonscope = true;
11740
+ /* @ignore */ static $nonscope = true;
11678
11741
  /* @ignore */ static $inject = [
11679
- "$scope",
11742
+ $injectTokens._scope,
11680
11743
  $injectTokens._exceptionHandler,
11681
- "$attrs",
11682
- "$element",
11744
+ $injectTokens._attrs,
11745
+ $injectTokens._element,
11683
11746
  $injectTokens._parse,
11684
11747
  $injectTokens._animate,
11685
11748
  $injectTokens._interpolate,
@@ -11711,19 +11774,19 @@ class NgModelController {
11711
11774
  /** @type {any} */
11712
11775
  this.$$rawModelValue = undefined; // stores the parsed modelValue / model set from scope regardless of validity.
11713
11776
 
11714
- /** @type {any} */
11777
+ /** @type {import("./interface.ts").ModelValidators} */
11715
11778
  this.$validators = {};
11716
11779
 
11717
- /** @type {any} */
11780
+ /** @type {import("./interface.ts").AsyncModelValidators} */
11718
11781
  this.$asyncValidators = {};
11719
11782
 
11720
- /** @type {Array<any>} */
11783
+ /** @type {Array<import("./interface.ts").ModelParser>} */
11721
11784
  this.$parsers = [];
11722
11785
 
11723
- /** @type {Array<any>} */
11786
+ /** @type {Array<import("./interface.ts").ModelFormatter>} */
11724
11787
  this.$formatters = [];
11725
11788
 
11726
- /** @type {Array<any>} */
11789
+ /** @type {Array<import("./interface.ts").ModelViewChangeListener>} */
11727
11790
  this.$viewChangeListeners = [];
11728
11791
 
11729
11792
  /** @type {boolean} */
@@ -11754,15 +11817,15 @@ class NgModelController {
11754
11817
  // Attach the correct context to the event handler function for updateOn
11755
11818
  this.$$updateEventHandler = this.$$updateEventHandler.bind(this);
11756
11819
 
11757
- this.$$parsedNgModel = $parse($attr.ngModel);
11758
- this.$$parsedNgModelAssign = this.$$parsedNgModel.assign;
11820
+ this._parsedNgModel = $parse($attr.ngModel);
11821
+ this._parsedNgModelAssign = this._parsedNgModel.assign;
11759
11822
 
11760
11823
  /**
11761
11824
  * @type {import("../../core/parse/interface.ts").CompiledExpression |
11762
11825
  * (function(ng.Scope): any)}
11763
11826
  */
11764
- this.$$ngModelGet = this.$$parsedNgModel;
11765
- this.$$ngModelSet = this.$$parsedNgModelAssign;
11827
+ this._ngModelGet = this._parsedNgModel;
11828
+ this._ngModelSet = this._parsedNgModelAssign;
11766
11829
  this.$$pendingDebounce = null;
11767
11830
  this.$$parserValid = undefined;
11768
11831
 
@@ -11911,8 +11974,8 @@ class NgModelController {
11911
11974
 
11912
11975
  const invokeModelSetter = this.$$parse(`${this.$$attr.ngModel}($$$p)`);
11913
11976
 
11914
- this.$$ngModelGet = ($scope) => {
11915
- let modelValue = this.$$parsedNgModel($scope);
11977
+ this._ngModelGet = ($scope) => {
11978
+ let modelValue = this._parsedNgModel($scope);
11916
11979
 
11917
11980
  if (isFunction(modelValue)) {
11918
11981
  modelValue = invokeModelGetter($scope);
@@ -11920,14 +11983,14 @@ class NgModelController {
11920
11983
 
11921
11984
  return modelValue;
11922
11985
  };
11923
- this.$$ngModelSet = ($scope, newValue) => {
11924
- if (isFunction(this.$$parsedNgModel($scope))) {
11986
+ this._ngModelSet = ($scope, newValue) => {
11987
+ if (isFunction(this._parsedNgModel($scope))) {
11925
11988
  invokeModelSetter($scope, { $$$p: newValue });
11926
11989
  } else {
11927
- this.$$parsedNgModelAssign($scope, newValue);
11990
+ this._parsedNgModelAssign($scope, newValue);
11928
11991
  }
11929
11992
  };
11930
- } else if (!this.$$parsedNgModel.assign) {
11993
+ } else if (!this._parsedNgModel.assign) {
11931
11994
  throw ngModelMinErr(
11932
11995
  "nonassign",
11933
11996
  "Expression '{0}' is non-assignable. Element: {1}",
@@ -12403,7 +12466,7 @@ class NgModelController {
12403
12466
  if (isNumberNaN(this.$modelValue)) {
12404
12467
  // this.$modelValue has not been touched yet...
12405
12468
  // @ts-ignore
12406
- this.$modelValue = this.$$ngModelGet(this.$$scope);
12469
+ this.$modelValue = this._ngModelGet(this.$$scope);
12407
12470
  }
12408
12471
  const prevModelValue = this.$modelValue;
12409
12472
 
@@ -12440,13 +12503,15 @@ class NgModelController {
12440
12503
  // intentional loose equality
12441
12504
  // eslint-disable-next-line eqeqeq
12442
12505
  if (that.$modelValue != prevModelValue) {
12506
+ if (isNull(that.$modelValue) && prevModelValue === "") return;
12507
+
12443
12508
  that.$$writeModelToScope();
12444
12509
  }
12445
12510
  }
12446
12511
  }
12447
12512
 
12448
12513
  $$writeModelToScope() {
12449
- this.$$ngModelSet(this.$$scope, this.$modelValue);
12514
+ this._ngModelSet(this.$$scope, this.$modelValue);
12450
12515
  Object.values(this.$viewChangeListeners).forEach((listener) => {
12451
12516
  try {
12452
12517
  listener();
@@ -12564,7 +12629,7 @@ class NgModelController {
12564
12629
  * **Note:** it is not possible to override the `getterSetter` option.
12565
12630
  * </div>
12566
12631
  *
12567
- * @param {Object} options a hash of settings to override the previous options
12632
+ * @param {import("../../interface.ts").NgModelOptions} options a hash of settings to override the previous options
12568
12633
  *
12569
12634
  */
12570
12635
  $overrideModelOptions(options) {
@@ -12763,7 +12828,7 @@ function setupModelWatcher(ctrl) {
12763
12828
  // ng-change executes in apply phase
12764
12829
  // 4. view should be changed back to 'a'
12765
12830
  ctrl.$$scope.$watch("value", () => {
12766
- const modelValue = ctrl.$$ngModelGet(ctrl.$$scope);
12831
+ const modelValue = ctrl._ngModelGet(ctrl.$$scope);
12767
12832
 
12768
12833
  // if scope model value and ngModel value are out of sync
12769
12834
  // This cannot be moved to the action function, because it would not catch the
@@ -12812,7 +12877,7 @@ function ngModelDirective() {
12812
12877
 
12813
12878
  attr.$observe("name", (newValue) => {
12814
12879
  if (modelCtrl.$name !== newValue) {
12815
- modelCtrl.$$parentForm.$$renameControl(modelCtrl, newValue);
12880
+ modelCtrl.$$parentForm._renameControl(modelCtrl, newValue);
12816
12881
  }
12817
12882
  });
12818
12883
  const deregisterWatch = scope.$watch(attr.ngModel, (val) => {
@@ -12847,9 +12912,6 @@ function ngModelDirective() {
12847
12912
  };
12848
12913
  }
12849
12914
 
12850
- // Regex code was initially obtained from SO prior to modification: https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime#answer-3143231
12851
- const ISO_DATE_REGEXP =
12852
- /^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/;
12853
12915
  // See valid URLs in RFC3987 (http://tools.ietf.org/html/rfc3987)
12854
12916
  // Note: We are being more lenient, because browsers are too.
12855
12917
  // 1. Scheme
@@ -12897,35 +12959,14 @@ const PARTIAL_VALIDATION_TYPES = new Map();
12897
12959
 
12898
12960
  const inputType = {
12899
12961
  text: textInputType,
12900
- date: createDateInputType(
12901
- "date",
12902
- DATE_REGEXP,
12903
- createDateParser(DATE_REGEXP, ["yyyy", "MM", "dd"]),
12904
- ),
12905
- "datetime-local": createDateInputType(
12962
+ date: createStringDateInputType("date", DATE_REGEXP),
12963
+ "datetime-local": createStringDateInputType(
12906
12964
  "datetimelocal",
12907
12965
  DATETIMELOCAL_REGEXP,
12908
- createDateParser(DATETIMELOCAL_REGEXP, [
12909
- "yyyy",
12910
- "MM",
12911
- "dd",
12912
- "HH",
12913
- "mm",
12914
- "ss",
12915
- "sss",
12916
- ]),
12917
- ),
12918
- time: createDateInputType(
12919
- "time",
12920
- TIME_REGEXP,
12921
- createDateParser(TIME_REGEXP, ["HH", "mm", "ss", "sss"]),
12922
- ),
12923
- week: createDateInputType("week", WEEK_REGEXP, weekParser),
12924
- month: createDateInputType(
12925
- "month",
12926
- MONTH_REGEXP,
12927
- createDateParser(MONTH_REGEXP, ["yyyy", "MM"]),
12928
12966
  ),
12967
+ time: createStringDateInputType("time", TIME_REGEXP),
12968
+ week: createStringDateInputType("week", WEEK_REGEXP),
12969
+ month: createStringDateInputType("month", MONTH_REGEXP),
12929
12970
  number: numberInputType,
12930
12971
  url: urlInputType,
12931
12972
  email: emailInputType,
@@ -13054,318 +13095,56 @@ function baseInputType(_, element, attr, ctrl) {
13054
13095
  };
13055
13096
  }
13056
13097
 
13057
- function weekParser(isoWeek, existingDate) {
13058
- if (isDate(isoWeek)) {
13059
- return isoWeek;
13060
- }
13061
-
13062
- function getFirstThursdayOfYear(year) {
13063
- // 0 = index of January
13064
- const dayOfWeekOnFirst = new Date(year, 0, 1).getDay();
13065
-
13066
- // 4 = index of Thursday (+1 to account for 1st = 5)
13067
- // 11 = index of *next* Thursday (+1 account for 1st = 12)
13068
- return new Date(
13069
- year,
13070
- 0,
13071
- // eslint-disable-next-line no-magic-numbers
13072
- (dayOfWeekOnFirst <= 4 ? 5 : 12) - dayOfWeekOnFirst,
13073
- );
13074
- }
13075
-
13076
- if (isString(isoWeek)) {
13077
- WEEK_REGEXP.lastIndex = 0;
13078
- const parts = WEEK_REGEXP.exec(isoWeek);
13079
-
13080
- if (parts) {
13081
- const year = +parts[1];
13082
-
13083
- const week = +parts[2];
13084
-
13085
- let hours = 0;
13086
-
13087
- let minutes = 0;
13088
-
13089
- let seconds = 0;
13090
-
13091
- let milliseconds = 0;
13092
-
13093
- const firstThurs = getFirstThursdayOfYear(year);
13094
-
13095
- const DAYS = 7;
13096
-
13097
- const addDays = (week - 1) * DAYS;
13098
-
13099
- if (existingDate) {
13100
- hours = existingDate.getHours();
13101
- minutes = existingDate.getMinutes();
13102
- seconds = existingDate.getSeconds();
13103
- milliseconds = existingDate.getMilliseconds();
13104
- }
13105
-
13106
- return new Date(
13107
- year,
13108
- 0,
13109
- firstThurs.getDate() + addDays,
13110
- hours,
13111
- minutes,
13112
- seconds,
13113
- milliseconds,
13114
- );
13115
- }
13116
- }
13117
-
13118
- return NaN;
13119
- }
13120
-
13121
- function createDateParser(regexp, mapping) {
13122
- return function (iso, previousDate) {
13123
- let parts;
13124
-
13125
- let map;
13126
-
13127
- if (isDate(iso)) {
13128
- return iso;
13129
- }
13130
-
13131
- if (isString(iso)) {
13132
- // When a date is JSON'ified to wraps itself inside of an extra
13133
- // set of double quotes. This makes the date parsing code unable
13134
- // to match the date string and parse it as a date.
13135
- if (iso.charAt(0) === '"' && iso.charAt(iso.length - 1) === '"') {
13136
- iso = iso.substring(1, iso.length - 1);
13137
- }
13138
-
13139
- if (ISO_DATE_REGEXP.test(iso)) {
13140
- return new Date(iso);
13141
- }
13142
- regexp.lastIndex = 0;
13143
- parts = regexp.exec(iso);
13144
-
13145
- if (parts) {
13146
- parts.shift();
13147
-
13148
- if (previousDate) {
13149
- map = {
13150
- yyyy: previousDate.getFullYear(),
13151
- MM: previousDate.getMonth() + 1,
13152
- dd: previousDate.getDate(),
13153
- HH: previousDate.getHours(),
13154
- mm: previousDate.getMinutes(),
13155
- ss: previousDate.getSeconds(),
13156
- sss: previousDate.getMilliseconds() / 1000,
13157
- };
13158
- } else {
13159
- map = { yyyy: 1970, MM: 1, dd: 1, HH: 0, mm: 0, ss: 0, sss: 0 };
13160
- }
13161
-
13162
- Object.entries(parts).forEach(([index, part]) => {
13163
- if (index < mapping.length) {
13164
- map[mapping[index]] = +part;
13165
- }
13166
- });
13167
-
13168
- const date = new Date(
13169
- map.yyyy,
13170
- map.MM - 1,
13171
- map.dd,
13172
- map.HH,
13173
- map.mm,
13174
- map.ss || 0,
13175
- map.sss * 1000 || 0,
13176
- );
13177
-
13178
- if (map.yyyy < 100) {
13179
- // In the constructor, 2-digit years map to 1900-1999.
13180
- // Use `setFullYear()` to set the correct year.
13181
- date.setFullYear(map.yyyy);
13182
- }
13183
-
13184
- return date;
13185
- }
13186
- }
13187
-
13188
- return NaN;
13189
- };
13190
- }
13191
-
13192
- const MONTH_INPUT_FORMAT = /\b\d{4}-(0[1-9]|1[0-2])\b/;
13193
-
13194
- function createDateInputType(type, regexp, parseDate) {
13195
- return function dynamicDateInputType(
13196
- scope,
13197
- element,
13198
- attr,
13199
- ctrl,
13200
- $filter,
13201
- $parse,
13202
- ) {
13203
- badInputChecker(scope, element, attr, ctrl, type);
13098
+ /**
13099
+ * @param {string} type
13100
+ * @param {RegExp} regexp
13101
+ * @returns {*}
13102
+ */
13103
+ function createStringDateInputType(type, regexp) {
13104
+ return function stringDateInputType(scope, element, attr, ctrl, $parse) {
13204
13105
  baseInputType(scope, element, attr, ctrl);
13205
- let previousDate;
13206
-
13207
13106
  ctrl.$parsers.push((value) => {
13208
13107
  if (ctrl.$isEmpty(value)) return null;
13209
13108
 
13210
- if (regexp.test(value)) {
13211
- // Do not convert for native HTML
13212
- if (["month", "week", "datetimelocal", "time", "date"].includes(type)) {
13213
- return value;
13214
- }
13109
+ if (regexp.test(value)) return value;
13215
13110
 
13216
- // Note: We cannot read ctrl.$modelValue, as there might be a different
13217
- // parser/formatter in the processing chain so that the model
13218
- // contains some different data format!
13219
- return parseDateAndConvertTimeZoneToLocal(value, previousDate);
13220
- }
13221
13111
  ctrl.$$parserName = type;
13222
13112
 
13223
13113
  return undefined;
13224
13114
  });
13225
13115
 
13226
- ctrl.$formatters.push(function (value) {
13227
- if (value && !isString(value)) {
13228
- throw ngModelMinErr("datefmt", "Expected `{0}` to be a String", value);
13229
- }
13230
-
13231
- if (type === "month") {
13232
- if (isNullOrUndefined(value)) {
13233
- return "";
13234
- }
13235
-
13236
- if (!MONTH_INPUT_FORMAT.test(value)) {
13237
- throw ngModelMinErr(
13238
- "datefmt",
13239
- "Expected month `{0}` to be a 'YYYY-DD'",
13240
- value,
13241
- );
13242
- }
13243
- }
13244
-
13245
- if (type === "week") {
13246
- if (isNullOrUndefined(value)) {
13247
- return "";
13248
- }
13249
-
13250
- if (!WEEK_REGEXP.test(value)) {
13251
- throw ngModelMinErr(
13252
- "datefmt",
13253
- "Expected week `{0}` to be a 'yyyy-Www'",
13254
- value,
13255
- );
13256
- }
13257
- }
13258
-
13259
- if (type === "datetimelocal") {
13260
- if (isNullOrUndefined(value)) {
13261
- return "";
13262
- }
13116
+ ctrl.$formatters.push((value) => {
13117
+ if (ctrl.$isEmpty(value)) return "";
13263
13118
 
13264
- if (!DATETIMELOCAL_REGEXP.test(value)) {
13265
- throw ngModelMinErr(
13266
- "datefmt",
13267
- "Expected week `{0}` to be a in date time format. See: https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats#local_date_and_time_strings",
13268
- value,
13269
- );
13270
- }
13119
+ if (!isString(value)) {
13120
+ throw ngModelMinErr("datefmt", "Expected `{0}` to be a string", value);
13271
13121
  }
13272
13122
 
13273
13123
  return value;
13274
-
13275
- // if (isValidDate(value)) {
13276
- // previousDate = value;
13277
- // const timezone = ctrl.$options.getOption("timezone");
13278
-
13279
- // if (timezone) {
13280
- // previousTimezone = timezone;
13281
- // previousDate = convertTimezoneToLocal(previousDate, timezone, true);
13282
- // }
13283
-
13284
- // return value;
13285
- // }
13286
- // previousDate = null;
13287
- // previousTimezone = null;
13288
- // return "";
13289
13124
  });
13290
13125
 
13126
+ // Optional min/max
13291
13127
  if (isDefined(attr.min) || attr.ngMin) {
13292
- let minVal = attr.min || $parse(attr.ngMin)(scope);
13128
+ let minVal = attr.min || $parse?.(attr.ngMin)(scope);
13293
13129
 
13294
- let parsedMinVal = parseObservedDateValue(deProxy(minVal));
13295
-
13296
- ctrl.$validators.min = function (value) {
13297
- if (type === "month") {
13298
- return (
13299
- isUndefined(parsedMinVal) ||
13300
- parseDate(value) >= parseDate(parsedMinVal)
13301
- );
13302
- }
13303
-
13304
- return (
13305
- !isValidDate(value) ||
13306
- isUndefined(parsedMinVal) ||
13307
- parseDate(value) >= parsedMinVal
13308
- );
13309
- };
13130
+ ctrl.$validators.min = (_modelValue, viewValue) =>
13131
+ ctrl.$isEmpty(viewValue) || viewValue >= minVal;
13310
13132
  attr.$observe("min", (val) => {
13311
- if (val !== minVal) {
13312
- parsedMinVal = parseObservedDateValue(val);
13313
- minVal = val;
13314
- ctrl.$validate();
13315
- }
13133
+ minVal = val;
13134
+ ctrl.$validate();
13316
13135
  });
13317
13136
  }
13318
13137
 
13319
13138
  if (isDefined(attr.max) || attr.ngMax) {
13320
- let maxVal = attr.max || $parse(attr.ngMax)(scope);
13321
-
13322
- let parsedMaxVal = parseObservedDateValue(deProxy(maxVal));
13323
-
13324
- ctrl.$validators.max = function (value) {
13325
- if (type === "month") {
13326
- return (
13327
- isUndefined(parsedMaxVal) ||
13328
- parseDate(value) <= parseDate(parsedMaxVal)
13329
- );
13330
- }
13139
+ let maxVal = attr.max || $parse?.(attr.ngMax)(scope);
13331
13140
 
13332
- return (
13333
- !isValidDate(value) ||
13334
- isUndefined(parsedMaxVal) ||
13335
- parseDate(value) <= parsedMaxVal
13336
- );
13337
- };
13141
+ ctrl.$validators.max = (_modelValue, viewValue) =>
13142
+ ctrl.$isEmpty(viewValue) || viewValue <= maxVal;
13338
13143
  attr.$observe("max", (val) => {
13339
- if (val !== maxVal) {
13340
- parsedMaxVal = parseObservedDateValue(val);
13341
- maxVal = val;
13342
- ctrl.$validate();
13343
- }
13144
+ maxVal = val;
13145
+ ctrl.$validate();
13344
13146
  });
13345
13147
  }
13346
-
13347
- function isValidDate(value) {
13348
- // Invalid Date: getTime() returns NaN
13349
- return value && !(value.getTime && Number.isNaN(value.getTime()));
13350
- }
13351
-
13352
- function parseObservedDateValue(val) {
13353
- return isDefined(val) && !isDate(val)
13354
- ? parseDateAndConvertTimeZoneToLocal(val) || undefined
13355
- : val;
13356
- }
13357
-
13358
- function parseDateAndConvertTimeZoneToLocal(value, previousDateParam) {
13359
- const timezone = ctrl.$options.getOption("timezone");
13360
-
13361
- let parsedDate = parseDate(value, previousDateParam);
13362
-
13363
- if (!Number.isNaN(parsedDate) && timezone) {
13364
- parsedDate = convertTimezoneToLocal(parsedDate, timezone);
13365
- }
13366
-
13367
- return parsedDate;
13368
- }
13369
13148
  };
13370
13149
  }
13371
13150
 
@@ -13490,7 +13269,7 @@ function isValidForStep(viewValue, stepBase, step) {
13490
13269
  return (value - stepBase) % step === 0;
13491
13270
  }
13492
13271
 
13493
- function numberInputType(scope, element, attr, ctrl, $filter, $parse) {
13272
+ function numberInputType(scope, element, attr, ctrl, $parse) {
13494
13273
  badInputChecker(scope, element, attr, ctrl, "number");
13495
13274
  numberFormatterParser(ctrl);
13496
13275
  baseInputType(scope, element, attr, ctrl);
@@ -13829,7 +13608,7 @@ function parseConstantExpr($parse, context, name, expression, fallback) {
13829
13608
  return fallback;
13830
13609
  }
13831
13610
 
13832
- function checkboxInputType(scope, element, attr, ctrl, $filter, $parse) {
13611
+ function checkboxInputType(scope, element, attr, ctrl, $parse) {
13833
13612
  const trueValue = parseConstantExpr(
13834
13613
  $parse,
13835
13614
  scope,
@@ -13868,14 +13647,13 @@ function checkboxInputType(scope, element, attr, ctrl, $filter, $parse) {
13868
13647
  ctrl.$parsers.push((value) => (value ? trueValue : falseValue));
13869
13648
  }
13870
13649
 
13871
- inputDirective.$inject = [$injectTokens._filter, $injectTokens._parse];
13650
+ inputDirective.$inject = [$injectTokens._parse];
13872
13651
 
13873
13652
  /**
13874
- * @param {ng.FilterFactory} $filter
13875
13653
  * @param {ng.ParseService} $parse
13876
13654
  * @returns {ng.Directive}
13877
13655
  */
13878
- function inputDirective($filter, $parse) {
13656
+ function inputDirective($parse) {
13879
13657
  return {
13880
13658
  restrict: "E",
13881
13659
  require: ["?ngModel"],
@@ -13887,7 +13665,6 @@ function inputDirective($filter, $parse) {
13887
13665
  element,
13888
13666
  attr,
13889
13667
  ctrls[0],
13890
- $filter,
13891
13668
  $parse,
13892
13669
  );
13893
13670
  }
@@ -13899,47 +13676,18 @@ function inputDirective($filter, $parse) {
13899
13676
  /**
13900
13677
  * @returns {ng.Directive}
13901
13678
  */
13902
- function hiddenInputBrowserCacheDirective() {
13903
- const valueProperty = {
13904
- configurable: true,
13905
- enumerable: false,
13906
- get() {
13907
- return this.getAttribute("value") || "";
13908
- },
13909
- set(val) {
13910
- this.setAttribute("value", val);
13911
- },
13912
- };
13913
-
13679
+ function hiddenInputDirective() {
13914
13680
  return {
13915
13681
  restrict: "E",
13916
- priority: 200,
13917
13682
  compile(_, attr) {
13918
- if (attr.type?.toLowerCase() !== "hidden") {
13919
- return undefined;
13920
- }
13683
+ if (attr.type?.toLowerCase() !== "hidden") return undefined;
13921
13684
 
13922
- const res = {
13685
+ return {
13923
13686
  pre(_scope, element) {
13924
- const node = element;
13925
-
13926
- // Support: Edge
13927
- // Moving the DOM around prevents autofillling
13928
- if (node.parentNode) {
13929
- node.parentNode.insertBefore(node, node.nextSibling);
13930
- }
13931
-
13932
- // Support: FF, IE
13933
- // Avoiding direct assignment to .value prevents autofillling
13934
- if (Object.defineProperty) {
13935
- Object.defineProperty(node, "value", valueProperty);
13936
- }
13937
-
13938
- return undefined;
13687
+ /** @type {HTMLInputElement} */ (element).value =
13688
+ element.getAttribute("value") ?? "";
13939
13689
  },
13940
13690
  };
13941
-
13942
- return res;
13943
13691
  },
13944
13692
  };
13945
13693
  }
@@ -14011,8 +13759,6 @@ class SelectController {
14011
13759
  "selectValueMap",
14012
13760
  "emptyOption",
14013
13761
  "optionsMap",
14014
- "$scope",
14015
- "$element",
14016
13762
  ];
14017
13763
 
14018
13764
  /**
@@ -14040,8 +13786,8 @@ class SelectController {
14040
13786
  /** @type {boolean} */
14041
13787
  this.multiple = false;
14042
13788
 
14043
- /** @type {HTMLOptionElement} */
14044
- this.unknownOption = document.createElement("option");
13789
+ /** @private @type {HTMLOptionElement} */
13790
+ this._unknownOption = document.createElement("option");
14045
13791
 
14046
13792
  /** @type {boolean} */
14047
13793
  this.hasEmptyOption = false;
@@ -14073,10 +13819,10 @@ class SelectController {
14073
13819
  renderUnknownOption(val) {
14074
13820
  const unknownVal = this.generateUnknownOptionValue(val);
14075
13821
 
14076
- this.unknownOption.value = unknownVal;
14077
- this.$element.prepend(this.unknownOption);
14078
- this.unknownOption.selected = true;
14079
- this.unknownOption.setAttribute("selected", "selected");
13822
+ this._unknownOption.value = unknownVal;
13823
+ this.$element.prepend(this._unknownOption);
13824
+ this._unknownOption.selected = true;
13825
+ this._unknownOption.setAttribute("selected", "selected");
14080
13826
  this.$element.value = unknownVal;
14081
13827
  }
14082
13828
 
@@ -14087,9 +13833,9 @@ class SelectController {
14087
13833
  updateUnknownOption(val) {
14088
13834
  const unknownVal = this.generateUnknownOptionValue(val);
14089
13835
 
14090
- this.unknownOption.value = unknownVal;
14091
- this.unknownOption.selected = true;
14092
- this.unknownOption.setAttribute("selected", "selected");
13836
+ this._unknownOption.value = unknownVal;
13837
+ this._unknownOption.selected = true;
13838
+ this._unknownOption.setAttribute("selected", "selected");
14093
13839
  this.$element.value = unknownVal;
14094
13840
  }
14095
13841
 
@@ -14110,7 +13856,7 @@ class SelectController {
14110
13856
  * Remove the unknown option from the select element if it exists.
14111
13857
  */
14112
13858
  removeUnknownOption() {
14113
- if (this.unknownOption.parentElement) this.unknownOption.remove();
13859
+ if (this._unknownOption.parentElement) this._unknownOption.remove();
14114
13860
  }
14115
13861
 
14116
13862
  /**
@@ -14235,7 +13981,7 @@ class SelectController {
14235
13981
  * @returns {boolean} Whether the unknown option is currently selected.
14236
13982
  */
14237
13983
  $isUnknownOptionSelected() {
14238
- return this.$element.options[0] === this.unknownOption;
13984
+ return this.$element.options[0] === this._unknownOption;
14239
13985
  }
14240
13986
 
14241
13987
  /**
@@ -14256,7 +14002,7 @@ class SelectController {
14256
14002
  if (isNullOrUndefined(value) && this.emptyOption) {
14257
14003
  this.removeUnknownOption();
14258
14004
  this.selectEmptyOption();
14259
- } else if (this.unknownOption.parentElement) {
14005
+ } else if (this._unknownOption.parentElement) {
14260
14006
  this.updateUnknownOption(value);
14261
14007
  } else {
14262
14008
  this.renderUnknownOption(value);
@@ -14415,7 +14161,7 @@ class SelectController {
14415
14161
  }
14416
14162
 
14417
14163
  /**
14418
- * @returns {import('../../interface.ts').Directive}
14164
+ * @returns {ng.Directive}
14419
14165
  */
14420
14166
  function selectDirective() {
14421
14167
  return {
@@ -14638,7 +14384,9 @@ function ngBindDirective() {
14638
14384
  scope.$watch(
14639
14385
  attr.ngBind,
14640
14386
  (value) => {
14641
- element.textContent = stringify$1(deProxy(value));
14387
+ element.textContent = /** @type {string} */ (
14388
+ stringify$1(deProxy(value))
14389
+ );
14642
14390
  },
14643
14391
  isDefined(attr.lazy),
14644
14392
  );
@@ -14647,17 +14395,17 @@ function ngBindDirective() {
14647
14395
  }
14648
14396
 
14649
14397
  /**
14650
- * @returns {import('../../interface.ts').Directive}
14398
+ * @returns {ng.Directive}
14651
14399
  */
14652
14400
  function ngBindTemplateDirective() {
14653
14401
  return {
14654
14402
  /**
14655
14403
  * @param {ng.Scope} _scope
14656
14404
  * @param {Element} element
14657
- * @param {import('../../core/compile/attributes.js').Attributes} attr
14405
+ * @param {ng.Attributes} attr
14658
14406
  */
14659
14407
  link(_scope, element, attr) {
14660
- attr.$observe("ngBindTemplate", (value) => {
14408
+ attr.$observe("ngBindTemplate", (/** @type {string | null} */ value) => {
14661
14409
  element.textContent = isUndefined(value) ? "" : value;
14662
14410
  });
14663
14411
  },
@@ -14666,8 +14414,8 @@ function ngBindTemplateDirective() {
14666
14414
 
14667
14415
  ngBindHtmlDirective.$inject = [$injectTokens._parse];
14668
14416
  /**
14669
- * @param {import('../../core/parse/interface.ts').ParseService} $parse
14670
- * @returns {import('../../interface.ts').Directive}
14417
+ * @param {ng.ParseService} $parse
14418
+ * @returns {ng.Directive}
14671
14419
  */
14672
14420
  function ngBindHtmlDirective($parse) {
14673
14421
  return {
@@ -14956,7 +14704,8 @@ function ngShowDirective($animate) {
14956
14704
 
14957
14705
  ngHideDirective.$inject = [$injectTokens._animate];
14958
14706
  /**
14959
- * @returns {import('../../interface.ts').Directive}
14707
+ * @param {ng.AnimateService} $animate
14708
+ * @returns {ng.Directive}
14960
14709
  */
14961
14710
  function ngHideDirective($animate) {
14962
14711
  return {
@@ -14998,7 +14747,7 @@ function ngIfDirective($animate) {
14998
14747
  * @param {Element} $element
14999
14748
  * @param {ng.Attributes} $attr
15000
14749
  * @param {*} _ctrl
15001
- * @param {*} $transclude
14750
+ * @param {ng.TranscludeFn} $transclude
15002
14751
  */
15003
14752
  link($scope, $element, $attr, _ctrl, $transclude) {
15004
14753
  /** @type {Element | null | undefined} */
@@ -15013,23 +14762,28 @@ function ngIfDirective($animate) {
15013
14762
  $scope.$watch($attr.ngIf, (value) => {
15014
14763
  if (value) {
15015
14764
  if (!childScope) {
15016
- $transclude((clone, newScope) => {
15017
- childScope = newScope;
15018
- // Note: We only need the first/last node of the cloned nodes.
15019
- // However, we need to keep the reference to the dom wrapper as it might be changed later
15020
- // by a directive with templateUrl when its template arrives.
15021
- block = clone;
15022
-
15023
- if (hasAnimate(clone)) {
15024
- $animate.enter(
15025
- clone,
15026
- /** @type {Element} */ ($element.parentElement),
15027
- $element,
15028
- );
15029
- } else {
15030
- $element.after(clone);
15031
- }
15032
- });
14765
+ $transclude(
14766
+ (
14767
+ /** @type {Element} */ clone,
14768
+ /** @type {ng.Scope} */ newScope,
14769
+ ) => {
14770
+ childScope = newScope;
14771
+ // Note: We only need the first/last node of the cloned nodes.
14772
+ // However, we need to keep the reference to the dom wrapper as it might be changed later
14773
+ // by a directive with templateUrl when its template arrives.
14774
+ block = clone;
14775
+
14776
+ if (hasAnimate(/** @type {Node} */ (clone))) {
14777
+ $animate.enter(
14778
+ /** @type {Element} */ (clone),
14779
+ /** @type {Element} */ ($element.parentElement),
14780
+ $element,
14781
+ );
14782
+ } else {
14783
+ $element.after(/** @type {Node} */ (clone));
14784
+ }
14785
+ },
14786
+ );
15033
14787
  }
15034
14788
  } else {
15035
14789
  if (previousElements) {
@@ -15148,9 +14902,9 @@ function ngIncludeDirective(
15148
14902
  if (src) {
15149
14903
  // set the 2nd param to true to ignore the template request error so that the inner
15150
14904
  // contents and scope can be cleaned up.
15151
- await $templateRequest(src, true).then(
14905
+ await $templateRequest(src).then(
15152
14906
  (response) => {
15153
- if (scope.$$destroyed) return;
14907
+ if (scope._destroyed) return;
15154
14908
 
15155
14909
  if (thisChangeId !== changeCounter) return;
15156
14910
  const newScope = scope.$new();
@@ -15182,7 +14936,7 @@ function ngIncludeDirective(
15182
14936
  scope.$eval(onloadExp);
15183
14937
  },
15184
14938
  (err) => {
15185
- if (scope.$$destroyed) return;
14939
+ if (scope._destroyed) return;
15186
14940
 
15187
14941
  if (thisChangeId === changeCounter) {
15188
14942
  cleanupLastIncludeContent();
@@ -15225,7 +14979,7 @@ function ngIncludeFillContentDirective($compile) {
15225
14979
  }
15226
14980
 
15227
14981
  /**
15228
- * @returns {import('../../interface.ts').Directive}
14982
+ * @returns {ng.Directive}
15229
14983
  */
15230
14984
  function ngInitDirective() {
15231
14985
  return {
@@ -15247,7 +15001,7 @@ function ngInitDirective() {
15247
15001
  }
15248
15002
 
15249
15003
  /**
15250
- * @returns {import('../../interface.ts').Directive}
15004
+ * @returns {ng.Directive}
15251
15005
  */
15252
15006
  function ngNonBindableDirective() {
15253
15007
  return {
@@ -15393,7 +15147,7 @@ function ngRepeatDirective($animate) {
15393
15147
  if (keyIdentifier) scope[keyIdentifier] = key;
15394
15148
 
15395
15149
  if (value) {
15396
- scope.$target.$$hashKey = value.$$hashKey;
15150
+ scope.$target._hashKey = value._hashKey;
15397
15151
  }
15398
15152
  scope.$index = index;
15399
15153
  scope.$first = index === 0;
@@ -15721,7 +15475,7 @@ function ngSwitchDirective($animate) {
15721
15475
 
15722
15476
  // asks for $scope to fool the BC controller module
15723
15477
  controller: [
15724
- "$scope",
15478
+ $injectTokens._scope,
15725
15479
  class {
15726
15480
  constructor() {
15727
15481
  this.cases = {};
@@ -15750,19 +15504,20 @@ function ngSwitchDirective($animate) {
15750
15504
 
15751
15505
  let ii;
15752
15506
 
15507
+ let runner;
15508
+
15753
15509
  // Start with the last, in case the array is modified during the loop
15754
15510
  while (previousLeaveAnimations.length) {
15755
15511
  $animate.cancel(previousLeaveAnimations.pop());
15756
15512
  }
15757
15513
 
15758
15514
  for (i = 0, ii = selectedScopes.length; i < ii; ++i) {
15759
- const selected = getBlockNodes(selectedElements[i].clone);
15515
+ const selected = selectedElements[i].clone;
15760
15516
 
15761
15517
  selectedScopes[i].$destroy();
15762
15518
 
15763
15519
  if (hasAnimate(selected)) {
15764
- const runner = (previousLeaveAnimations[i] =
15765
- $animate.leave(selected));
15520
+ runner = previousLeaveAnimations[i] = $animate.leave(selected);
15766
15521
 
15767
15522
  runner.done(spliceFactory(previousLeaveAnimations, i));
15768
15523
  } else {
@@ -15792,7 +15547,13 @@ function ngSwitchDirective($animate) {
15792
15547
  selectedElements.push(block);
15793
15548
 
15794
15549
  if (hasAnimate(caseElement)) {
15795
- $animate.enter(caseElement, anchor.parentElement, anchor);
15550
+ if (runner) {
15551
+ requestAnimationFrame(() => {
15552
+ $animate.enter(caseElement, anchor.parentElement, anchor);
15553
+ });
15554
+ } else {
15555
+ $animate.enter(caseElement, anchor.parentElement, anchor);
15556
+ }
15796
15557
  } else {
15797
15558
  domInsert(caseElement, anchor.parentElement, anchor);
15798
15559
  }
@@ -15805,7 +15566,7 @@ function ngSwitchDirective($animate) {
15805
15566
  }
15806
15567
 
15807
15568
  /**
15808
- * @returns {import('../../interface.ts').Directive}
15569
+ * @returns {ng.Directive}
15809
15570
  */
15810
15571
  function ngSwitchWhenDirective() {
15811
15572
  return {
@@ -15835,7 +15596,7 @@ function ngSwitchWhenDirective() {
15835
15596
  }
15836
15597
 
15837
15598
  /**
15838
- * @returns {import('../../interface.ts').Directive}
15599
+ * @returns {ng.Directive}
15839
15600
  */
15840
15601
  function ngSwitchDefaultDirective() {
15841
15602
  return {
@@ -17465,13 +17226,21 @@ function AnimateProvider($provide) {
17465
17226
  *
17466
17227
  * @param {Element} element - the element which will be inserted into the DOM
17467
17228
  * @param {Element} parent - the parent element which will append the element as a child (so long as the after element is not present)
17468
- * @param {Element} [after] - after the sibling element after which the element will be appended
17229
+ * @param {ChildNode | null | undefined} [after] - after the sibling element after which the element will be appended
17469
17230
  * @param {import("./interface.ts").AnimationOptions} [options] - an optional collection of options/styles that will be applied to the element.
17470
17231
  * @returns {import('./runner/animate-runner.js').AnimateRunner} the animation runner
17471
17232
  */
17472
17233
  enter(element, parent, after, options) {
17473
17234
  parent = parent || after.parentElement;
17474
- animatedomInsert(element, parent, after);
17235
+
17236
+ if (
17237
+ isInstanceOf(element, HTMLElement) &&
17238
+ isInstanceOf(parent, HTMLElement)
17239
+ ) {
17240
+ animatedomInsert(element, parent, after);
17241
+ } else {
17242
+ domInsert(element, parent, after);
17243
+ }
17475
17244
 
17476
17245
  return $$animateQueue.push(
17477
17246
  element,
@@ -17494,7 +17263,15 @@ function AnimateProvider($provide) {
17494
17263
  */
17495
17264
  move(element, parent, after, options) {
17496
17265
  parent = parent || after.parentElement;
17497
- animatedomInsert(element, parent, after);
17266
+
17267
+ if (
17268
+ isInstanceOf(element, HTMLElement) &&
17269
+ isInstanceOf(parent, HTMLElement)
17270
+ ) {
17271
+ animatedomInsert(element, parent, after);
17272
+ } else {
17273
+ domInsert(element, parent, after);
17274
+ }
17498
17275
 
17499
17276
  return $$animateQueue.push(
17500
17277
  element,
@@ -17533,7 +17310,7 @@ function AnimateProvider($provide) {
17533
17310
  *
17534
17311
  * @param {Element} element the element which the CSS classes will be applied to
17535
17312
  * @param {string} className the CSS class(es) that will be added (multiple classes are separated via spaces)
17536
- * @param {import("./interface").AnimationOptions} [options] an optional collection of options/styles that will be applied to the element.
17313
+ * @param {import("./interface.ts").AnimationOptions} [options] an optional collection of options/styles that will be applied to the element.
17537
17314
  * @return {import('./runner/animate-runner.js').AnimateRunner}} animationRunner the animation runner
17538
17315
  */
17539
17316
  addClass(element, className, options) {
@@ -17553,7 +17330,7 @@ function AnimateProvider($provide) {
17553
17330
  *
17554
17331
  * @param {Element} element the element which the CSS classes will be applied to
17555
17332
  * @param {string} className the CSS class(es) that will be removed (multiple classes are separated via spaces)
17556
- * @param {import("./interface").AnimationOptions} [options] an optional collection of options/styles that will be applied to the element. *
17333
+ * @param {import("./interface.ts").AnimationOptions} [options] an optional collection of options/styles that will be applied to the element. *
17557
17334
  * @return {import('./runner/animate-runner.js').AnimateRunner} animationRunner the animation runner
17558
17335
  */
17559
17336
  removeClass(element, className, options) {
@@ -18175,55 +17952,6 @@ function orderByFilter($parse) {
18175
17952
  }
18176
17953
  }
18177
17954
 
18178
- $IsStateFilter.$inject = [$injectTokens._state];
18179
-
18180
- /**
18181
- * `isState` Filter: truthy if the current state is the parameter
18182
- *
18183
- * Translates to [[StateService.is]] `$state.is("stateName")`.
18184
- *
18185
- * #### Example:
18186
- * ```html
18187
- * <div ng-if="'stateName' | isState">show if state is 'stateName'</div>
18188
- * ```
18189
- *
18190
- * @param {import('./state/state-service.js').StateProvider} $state
18191
- * @returns {ng.FilterFn}
18192
- */
18193
- function $IsStateFilter($state) {
18194
- const isFilter = (state, params, options) =>
18195
- $state.is(state, params, options);
18196
-
18197
- isFilter.$stateful = true;
18198
-
18199
- return isFilter;
18200
- }
18201
-
18202
- $IncludedByStateFilter.$inject = [$injectTokens._state];
18203
-
18204
- /**
18205
- * `includedByState` Filter: truthy if the current state includes the parameter
18206
- *
18207
- * Translates to [[StateService.includes]]` $state.is("fullOrPartialStateName")`.
18208
- *
18209
- * #### Example:
18210
- * ```html
18211
- * <div ng-if="'fullOrPartialStateName' | includedByState">show if state includes 'fullOrPartialStateName'</div>
18212
- * ```
18213
- *
18214
- * @param {import('./state/state-service.js').StateProvider} $state
18215
- * @returns {ng.FilterFn}
18216
- */
18217
- function $IncludedByStateFilter($state) {
18218
- const includesFilter = function (state, params, options) {
18219
- return $state.includes(state, params, options);
18220
- };
18221
-
18222
- includesFilter.$stateful = true;
18223
-
18224
- return includesFilter;
18225
- }
18226
-
18227
17955
  /* @ignore */
18228
17956
  const SUFFIX = "Filter";
18229
17957
 
@@ -18247,8 +17975,6 @@ class FilterProvider {
18247
17975
  json: jsonFilter,
18248
17976
  limitTo: limitToFilter,
18249
17977
  orderBy: orderByFilter,
18250
- isState: $IsStateFilter,
18251
- includedByState: $IncludedByStateFilter,
18252
17978
  }).forEach(([k, v]) =>
18253
17979
  this.register(k, /** @type {ng.FilterFactory} */ (v)),
18254
17980
  );
@@ -18372,9 +18098,9 @@ class ASTInterpreter {
18372
18098
  : function (scope, locals) {
18373
18099
  let lastValue;
18374
18100
 
18375
- expressions.forEach((exp) => {
18376
- lastValue = exp(scope, locals);
18377
- });
18101
+ for (let i = 0, j = expressions.length; i < j; i++) {
18102
+ lastValue = expressions[i](scope, locals);
18103
+ }
18378
18104
 
18379
18105
  return lastValue;
18380
18106
  };
@@ -19021,7 +18747,7 @@ function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
19021
18747
 
19022
18748
  let argsToWatch;
19023
18749
 
19024
- let isStatelessFilter;
18750
+ let isFilter;
19025
18751
 
19026
18752
  const decoratedNode = /** @type {DecoratedASTNode} */ (ast);
19027
18753
 
@@ -19152,10 +18878,8 @@ function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
19152
18878
 
19153
18879
  return decoratedNode;
19154
18880
  case ASTType._CallExpression:
19155
- isStatelessFilter = ast.filter
19156
- ? isStateless($filter, ast.callee.name)
19157
- : false;
19158
- allConstants = isStatelessFilter;
18881
+ isFilter = ast.filter;
18882
+ allConstants = isFilter;
19159
18883
  argsToWatch = [];
19160
18884
  ast.arguments.forEach((expr) => {
19161
18885
  decorated = findConstantAndWatchExpressions(expr, $filter, astIsPure);
@@ -19163,7 +18887,7 @@ function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
19163
18887
  argsToWatch.push.apply(argsToWatch, decorated.toWatch);
19164
18888
  });
19165
18889
  decoratedNode.constant = allConstants;
19166
- decoratedNode.toWatch = isStatelessFilter ? argsToWatch : [decoratedNode];
18890
+ decoratedNode.toWatch = isFilter ? argsToWatch : [decoratedNode];
19167
18891
 
19168
18892
  return decoratedNode;
19169
18893
  case ASTType._AssignmentExpression:
@@ -19310,12 +19034,6 @@ function isPure(node, parentIsPure) {
19310
19034
  return undefined === parentIsPure ? PURITY_RELATIVE : parentIsPure;
19311
19035
  }
19312
19036
 
19313
- function isStateless($filter, filterName) {
19314
- const fn = $filter(filterName);
19315
-
19316
- return !fn.$stateful;
19317
- }
19318
-
19319
19037
  /**
19320
19038
  * Converts parameter to strings property name for use as keys in an object.
19321
19039
  * Any non-string object, including a number, is typecasted into a string via the toString method.
@@ -20357,7 +20075,7 @@ class Parser {
20357
20075
  const fn = this._astCompiler.compile(ast);
20358
20076
 
20359
20077
  fn.literal = isLiteral(ast);
20360
- fn.constant = isConstant(ast);
20078
+ fn.constant = !!ast.constant;
20361
20079
 
20362
20080
  return fn;
20363
20081
  }
@@ -20375,18 +20093,25 @@ class Parser {
20375
20093
  }
20376
20094
  }
20377
20095
 
20096
+ /**
20097
+ * @param {import("../ast/ast-node.d.ts").ASTNode} ast
20098
+ * @returns {boolean}
20099
+ */
20378
20100
  function isLiteral(ast) {
20379
- return (
20380
- ast.body.length === 0 ||
20381
- (ast.body.length === 1 &&
20382
- (ast.body[0].expression.type === ASTType._Literal ||
20383
- ast.body[0].expression.type === ASTType._ArrayExpression ||
20384
- ast.body[0].expression.type === ASTType._ObjectExpression))
20385
- );
20386
- }
20101
+ const { body } = ast;
20387
20102
 
20388
- function isConstant(ast) {
20389
- return ast.constant;
20103
+ if (body && body.length === 1) {
20104
+ switch (body[0].expression?.type) {
20105
+ case ASTType._Literal:
20106
+ case ASTType._ArrayExpression:
20107
+ case ASTType._ObjectExpression:
20108
+ return true;
20109
+ default:
20110
+ return false;
20111
+ }
20112
+ } else {
20113
+ return true;
20114
+ }
20390
20115
  }
20391
20116
 
20392
20117
  class ParseProvider {
@@ -20431,7 +20156,7 @@ class ParseProvider {
20431
20156
  /**
20432
20157
  *
20433
20158
  * @param {(any) => any} $filter
20434
- * @returns {import('./interface').ParseService}
20159
+ * @returns {import('./interface.ts').ParseService}
20435
20160
  */
20436
20161
  function ($filter) {
20437
20162
  /** @type {import("./lexer/lexer.js").LexerOptions} */
@@ -20482,7 +20207,7 @@ class ParseProvider {
20482
20207
  /**
20483
20208
  * @param {Function} parsedExpression
20484
20209
  * @param interceptorFn
20485
- * @returns {import('./interface').CompiledExpression|*}
20210
+ * @returns {import('./interface.ts').CompiledExpression|*}
20486
20211
  */
20487
20212
  function addInterceptor(parsedExpression, interceptorFn) {
20488
20213
  if (!interceptorFn) {
@@ -20611,7 +20336,7 @@ function addWatchDelegate(parsedExpression) {
20611
20336
  * @param {ng.Scope} scope
20612
20337
  * @param {Function} listener
20613
20338
  * @param {*} objectEquality
20614
- * @param {import('./interface').CompiledExpression} parsedExpression
20339
+ * @param {import('./interface.ts').CompiledExpression} parsedExpression
20615
20340
  * @returns {any}
20616
20341
  */
20617
20342
  function inputsWatchDelegate(
@@ -21178,19 +20903,19 @@ let urlUpdatedByLocation = false;
21178
20903
  * The pathname, beginning with "/"
21179
20904
  * @type {string}
21180
20905
  */
21181
- let $$path;
20906
+ let _path;
21182
20907
 
21183
20908
  /**
21184
- * @type {Object.<string,boolean|Array>}
20909
+ * @type {Object.<string,boolean|Array<any>>}
21185
20910
  */
21186
- let $$search;
20911
+ let _search;
21187
20912
 
21188
20913
  /**
21189
20914
  * @ignore
21190
20915
  * The hash string, minus the hash symbol
21191
20916
  * @type {string}
21192
20917
  */
21193
- let $$hash;
20918
+ let _hash;
21194
20919
 
21195
20920
  class Location {
21196
20921
  /**
@@ -21227,14 +20952,14 @@ class Location {
21227
20952
  * Current url
21228
20953
  * @type {string}
21229
20954
  */
21230
- this.$$url = undefined;
20955
+ this._url = undefined;
21231
20956
 
21232
20957
  /**
21233
20958
  * @ignore
21234
20959
  * Callback to update browser url
21235
- * @type {Function}
20960
+ * @type {Function | undefined}
21236
20961
  */
21237
- this.$$updateBrowser = undefined;
20962
+ this._updateBrowser = undefined;
21238
20963
  }
21239
20964
 
21240
20965
  /**
@@ -21265,7 +20990,7 @@ class Location {
21265
20990
  * @return {string} url
21266
20991
  */
21267
20992
  getUrl() {
21268
- return this.$$url;
20993
+ return this._url;
21269
20994
  }
21270
20995
 
21271
20996
  /**
@@ -21277,8 +21002,8 @@ class Location {
21277
21002
  setPath(path) {
21278
21003
  const newPath = path !== null ? path.toString() : "";
21279
21004
 
21280
- $$path = newPath.charAt(0) === "/" ? newPath : `/${newPath}`;
21281
- this.$$compose();
21005
+ _path = newPath.charAt(0) === "/" ? newPath : `/${newPath}`;
21006
+ this._compose();
21282
21007
 
21283
21008
  return this;
21284
21009
  }
@@ -21290,7 +21015,7 @@ class Location {
21290
21015
  * @return {string}
21291
21016
  */
21292
21017
  getPath() {
21293
- return $$path;
21018
+ return _path;
21294
21019
  }
21295
21020
 
21296
21021
  /**
@@ -21299,8 +21024,8 @@ class Location {
21299
21024
  * @return {Location} hash
21300
21025
  */
21301
21026
  setHash(hash) {
21302
- $$hash = hash !== null ? hash.toString() : "";
21303
- this.$$compose();
21027
+ _hash = hash !== null ? hash.toString() : "";
21028
+ this._compose();
21304
21029
 
21305
21030
  return this;
21306
21031
  }
@@ -21310,7 +21035,7 @@ class Location {
21310
21035
  * @return {string} hash
21311
21036
  */
21312
21037
  getHash() {
21313
- return $$hash;
21038
+ return _hash;
21314
21039
  }
21315
21040
 
21316
21041
  /**
@@ -21325,7 +21050,7 @@ class Location {
21325
21050
  case 1:
21326
21051
  if (isString(search) || isNumber(search)) {
21327
21052
  search = search.toString();
21328
- $$search = parseKeyValue(search);
21053
+ _search = parseKeyValue(search);
21329
21054
  } else if (isObject(search)) {
21330
21055
  search = structuredClone(search, {});
21331
21056
  // remove object undefined or null properties
@@ -21333,7 +21058,7 @@ class Location {
21333
21058
  if (isNull(value)) delete search[key];
21334
21059
  });
21335
21060
 
21336
- $$search = search;
21061
+ _search = search;
21337
21062
  } else {
21338
21063
  throw $locationMinErr(
21339
21064
  "isrcharg",
@@ -21343,14 +21068,14 @@ class Location {
21343
21068
  break;
21344
21069
  default:
21345
21070
  if (isUndefined(paramValue) || paramValue === null) {
21346
- delete $$search[search];
21071
+ delete _search[search];
21347
21072
  } else {
21348
21073
  // @ts-ignore
21349
- $$search[search] = paramValue;
21074
+ _search[search] = paramValue;
21350
21075
  }
21351
21076
  }
21352
21077
 
21353
- this.$$compose();
21078
+ this._compose();
21354
21079
 
21355
21080
  return this;
21356
21081
  }
@@ -21361,20 +21086,20 @@ class Location {
21361
21086
  * @returns {Object} Search object or Location object
21362
21087
  */
21363
21088
  getSearch() {
21364
- return $$search;
21089
+ return _search;
21365
21090
  }
21366
21091
 
21367
21092
  /**
21368
21093
  * @private
21369
21094
  * Compose url and update `url` and `absUrl` property
21370
21095
  */
21371
- $$compose() {
21372
- this.$$url = normalizePath($$path, $$search, $$hash);
21096
+ _compose() {
21097
+ this._url = normalizePath(_path, _search, _hash);
21373
21098
  this.absUrl = this.html5
21374
- ? this.appBaseNoFile + this.$$url.substring(1)
21375
- : this.appBase + (this.$$url ? this.hashPrefix + this.$$url : "");
21099
+ ? this.appBaseNoFile + this._url.substring(1)
21100
+ : this.appBase + (this._url ? this.hashPrefix + this._url : "");
21376
21101
  urlUpdatedByLocation = true;
21377
- setTimeout(() => this.$$updateBrowser && this.$$updateBrowser());
21102
+ setTimeout(() => this._updateBrowser && this._updateBrowser());
21378
21103
  }
21379
21104
 
21380
21105
  /**
@@ -21485,11 +21210,11 @@ class Location {
21485
21210
 
21486
21211
  parseAppUrl(pathUrl, true);
21487
21212
 
21488
- if (!$$path) {
21489
- $$path = "/";
21213
+ if (!_path) {
21214
+ _path = "/";
21490
21215
  }
21491
21216
 
21492
- this.$$compose();
21217
+ this._compose();
21493
21218
  } else {
21494
21219
  const withoutBaseUrl =
21495
21220
  stripBaseUrl(this.appBase, url) ||
@@ -21523,9 +21248,9 @@ class Location {
21523
21248
 
21524
21249
  parseAppUrl(withoutHashUrl, false);
21525
21250
 
21526
- $$path = removeWindowsDriveName($$path, withoutHashUrl, this.appBase);
21251
+ _path = removeWindowsDriveName(_path, withoutHashUrl, this.appBase);
21527
21252
 
21528
- this.$$compose();
21253
+ this._compose();
21529
21254
 
21530
21255
  /*
21531
21256
  * In Windows, on an anchor node on documents loaded from
@@ -21575,16 +21300,17 @@ class LocationProvider {
21575
21300
  rewriteLinks: true,
21576
21301
  };
21577
21302
 
21578
- /** @type {Array<import("./interface.ts").UrlChangeListener>} */
21579
- this.urlChangeListeners = [];
21580
- this.urlChangeInit = false;
21581
-
21582
- /** @type {History['state']} */
21583
- this.cachedState = null;
21584
- /** @type {History['state']} */
21585
- this.lastHistoryState = null;
21586
- /** @type {string} */
21587
- this.lastBrowserUrl = window.location.href;
21303
+ /** @private @type {Array<import("./interface.ts").UrlChangeListener>} */
21304
+ this._urlChangeListeners = [];
21305
+ /** @private */
21306
+ this._urlChangeInit = false;
21307
+
21308
+ /** @private @type {History['state']} */
21309
+ this._cachedState = null;
21310
+ /** @private @type {History['state']} */
21311
+ this._lastHistoryState = null;
21312
+ /** @private @type {string} */
21313
+ this._lastBrowserUrl = window.location.href;
21588
21314
  this.cacheState();
21589
21315
  }
21590
21316
 
@@ -21607,12 +21333,12 @@ class LocationProvider {
21607
21333
  if (url) {
21608
21334
  url = new URL(url).href;
21609
21335
 
21610
- if (this.lastBrowserUrl === url && this.lastHistoryState === state) {
21336
+ if (this._lastBrowserUrl === url && this._lastHistoryState === state) {
21611
21337
  return this;
21612
21338
  }
21613
21339
 
21614
- this.lastBrowserUrl = url;
21615
- this.lastHistoryState = state;
21340
+ this._lastBrowserUrl = url;
21341
+ this._lastHistoryState = state;
21616
21342
  history.pushState(state, "", url);
21617
21343
  this.cacheState();
21618
21344
  }
@@ -21633,7 +21359,7 @@ class LocationProvider {
21633
21359
  * @returns {History['state']} The cached state.
21634
21360
  */
21635
21361
  state() {
21636
- return this.cachedState;
21362
+ return this._cachedState;
21637
21363
  }
21638
21364
 
21639
21365
  /**
@@ -21645,9 +21371,9 @@ class LocationProvider {
21645
21371
  const currentState = history.state ?? null;
21646
21372
 
21647
21373
  if (!equals$1(currentState, this.lastCachedState)) {
21648
- this.cachedState = currentState;
21374
+ this._cachedState = currentState;
21649
21375
  this.lastCachedState = currentState;
21650
- this.lastHistoryState = currentState;
21376
+ this._lastHistoryState = currentState;
21651
21377
  }
21652
21378
  }
21653
21379
 
@@ -21655,20 +21381,20 @@ class LocationProvider {
21655
21381
  * Fires the state or URL change event.
21656
21382
  */
21657
21383
  #fireStateOrUrlChange() {
21658
- const prevLastHistoryState = this.lastHistoryState;
21384
+ const prevLastHistoryState = this._lastHistoryState;
21659
21385
 
21660
21386
  this.cacheState();
21661
21387
 
21662
21388
  if (
21663
- this.lastBrowserUrl === this.getBrowserUrl() &&
21664
- prevLastHistoryState === this.cachedState
21389
+ this._lastBrowserUrl === this.getBrowserUrl() &&
21390
+ prevLastHistoryState === this._cachedState
21665
21391
  ) {
21666
21392
  return;
21667
21393
  }
21668
- this.lastBrowserUrl = this.getBrowserUrl();
21669
- this.lastHistoryState = this.cachedState;
21670
- this.urlChangeListeners.forEach((listener) => {
21671
- listener(trimEmptyHash(window.location.href), this.cachedState);
21394
+ this._lastBrowserUrl = this.getBrowserUrl();
21395
+ this._lastHistoryState = this._cachedState;
21396
+ this._urlChangeListeners.forEach((listener) => {
21397
+ listener(trimEmptyHash(window.location.href), this._cachedState);
21672
21398
  });
21673
21399
  }
21674
21400
 
@@ -21679,7 +21405,7 @@ class LocationProvider {
21679
21405
  * @returns void
21680
21406
  */
21681
21407
  #onUrlChange(callback) {
21682
- if (!this.urlChangeInit) {
21408
+ if (!this._urlChangeInit) {
21683
21409
  window.addEventListener(
21684
21410
  "popstate",
21685
21411
  this.#fireStateOrUrlChange.bind(this),
@@ -21688,9 +21414,9 @@ class LocationProvider {
21688
21414
  "hashchange",
21689
21415
  this.#fireStateOrUrlChange.bind(this),
21690
21416
  );
21691
- this.urlChangeInit = true;
21417
+ this._urlChangeInit = true;
21692
21418
  }
21693
- this.urlChangeListeners.push(callback);
21419
+ this._urlChangeListeners.push(callback);
21694
21420
  }
21695
21421
 
21696
21422
  $get = [
@@ -21926,12 +21652,16 @@ class LocationProvider {
21926
21652
  }
21927
21653
  };
21928
21654
 
21929
- $location.$$updateBrowser = updateBrowser;
21655
+ $location._updateBrowser = updateBrowser;
21930
21656
  updateBrowser();
21931
21657
  $rootScope.$on("$updateBrowser", updateBrowser);
21932
21658
 
21933
21659
  return $location;
21934
21660
 
21661
+ /**
21662
+ * @param {string} oldUrl
21663
+ * @param {any} oldState
21664
+ */
21935
21665
  function afterLocationChange(oldUrl, oldState) {
21936
21666
  $rootScope.$broadcast(
21937
21667
  "$locationChangeSuccess",
@@ -22085,13 +21815,13 @@ function parseAppUrl(url, html5Mode) {
22085
21815
  ? match.pathname.substring(1)
22086
21816
  : match.pathname;
22087
21817
 
22088
- $$path = decodePath(path, html5Mode);
22089
- $$search = parseKeyValue(match.search);
22090
- $$hash = decodeURIComponent(match.hash);
21818
+ _path = decodePath(path, html5Mode);
21819
+ _search = parseKeyValue(match.search);
21820
+ _hash = decodeURIComponent(match.hash);
22091
21821
 
22092
21822
  // make sure path starts with '/';
22093
- if ($$path && $$path.charAt(0) !== "/") {
22094
- $$path = `/${$$path}`;
21823
+ if (_path && _path.charAt(0) !== "/") {
21824
+ _path = `/${_path}`;
22095
21825
  }
22096
21826
  }
22097
21827
 
@@ -22251,7 +21981,8 @@ class LogProvider {
22251
21981
  * @param {string} type
22252
21982
  */
22253
21983
  _consoleLog(type) {
22254
- const console = window.console || {};
21984
+ const console =
21985
+ window.console || /** @type {Partial<Record<string, Function>>} */ ({});
22255
21986
 
22256
21987
  const logFn =
22257
21988
  console[type] ||
@@ -22260,7 +21991,7 @@ class LogProvider {
22260
21991
  /* empty */
22261
21992
  });
22262
21993
 
22263
- return (...args) => {
21994
+ return (/** @type {any[]} */ ...args) => {
22264
21995
  const formattedArgs = args.map((arg) => this._formatError(arg));
22265
21996
 
22266
21997
  return logFn.apply(console, formattedArgs);
@@ -22343,7 +22074,7 @@ class RootScopeProvider {
22343
22074
  *
22344
22075
  * @param {Object} target - The object to be wrapped in a proxy.
22345
22076
  * @param {Scope} [context] - The context for the handler, used to track listeners.
22346
- * @returns {Scope} - A proxy that intercepts operations on the target object,
22077
+ * @returns {Scope|Object} - A proxy that intercepts operations on the target object,
22347
22078
  * or the original value if the target is not an object.
22348
22079
  */
22349
22080
  function createScope(target = {}, context) {
@@ -22399,7 +22130,8 @@ function isNonScope(target) {
22399
22130
  target instanceof Promise ||
22400
22131
  target instanceof HTMLCollection ||
22401
22132
  target instanceof NodeList ||
22402
- target instanceof Event
22133
+ target instanceof Event ||
22134
+ target instanceof Date
22403
22135
  ) {
22404
22136
  return true;
22405
22137
  }
@@ -22434,20 +22166,17 @@ class Scope {
22434
22166
  /** @type {Map<string, Array<import('./interface.ts').Listener>>} Watch listeners */
22435
22167
  this.watchers = context ? context.watchers : new Map();
22436
22168
 
22437
- /** @type {Map<String, Function[]>} Event listeners */
22438
- this.$$listeners = new Map();
22439
-
22440
- /** @type {Map<string, Array<import('./interface.ts').Listener>>} Watch listeners from other proxies */
22441
- this.foreignListeners = context ? context.foreignListeners : new Map();
22169
+ /** @private @type {Map<String, Function[]>} Event listeners */
22170
+ this._listeners = new Map();
22442
22171
 
22443
- /** @type {Set<Proxy<ng.Scope>>} */
22444
- this.foreignProxies = context ? context.foreignProxies : new Set();
22172
+ /** @private @type {Map<string, Array<import('./interface.ts').Listener>>} Watch listeners from other proxies */
22173
+ this._foreignListeners = context ? context._foreignListeners : new Map();
22445
22174
 
22446
- /** @type {WeakMap<Object, Array<string>>} */
22447
- this.objectListeners = context ? context.objectListeners : new WeakMap();
22175
+ /** @private @type {Set<Proxy<ng.Scope>>} */
22176
+ this._foreignProxies = context ? context._foreignProxies : new Set();
22448
22177
 
22449
- /** @type {Map<Function, {oldValue: any, fn: Function}>} */
22450
- this.functionListeners = context ? context.functionListeners : new Map();
22178
+ /** @private @type {WeakMap<Object, Array<string>>} */
22179
+ this._objectListeners = context ? context._objectListeners : new WeakMap();
22451
22180
 
22452
22181
  /** @type {Proxy<Scope>} Current proxy being operated on */
22453
22182
  this.$proxy = null;
@@ -22482,40 +22211,39 @@ class Scope {
22482
22211
  ? null
22483
22212
  : context;
22484
22213
 
22485
- this.filters = [];
22486
-
22487
- /** @type {boolean} */
22488
- this.$$destroyed = false;
22214
+ /** @ignore @type {boolean} */
22215
+ this._destroyed = false;
22489
22216
 
22490
- this.scheduled = [];
22217
+ /** @private @type {import("./interface.ts").Listener[]} A list of scheduled Event listeners */
22218
+ this._scheduled = [];
22491
22219
 
22492
22220
  this.$scopename = undefined;
22493
22221
 
22494
22222
  /** @private */
22495
22223
  this.propertyMap = {
22496
- $watch: this.$watch.bind(this),
22497
- $new: this.$new.bind(this),
22498
- $newIsolate: this.$newIsolate.bind(this),
22499
- $destroy: this.$destroy.bind(this),
22500
- $flushQueue: this.$flushQueue.bind(this),
22501
- $eval: this.$eval.bind(this),
22502
22224
  $apply: this.$apply.bind(this),
22503
- $postUpdate: this.$postUpdate.bind(this),
22504
- $isRoot: this.#isRoot.bind(this),
22505
- $on: this.$on.bind(this),
22506
- $emit: this.$emit.bind(this),
22507
22225
  $broadcast: this.$broadcast.bind(this),
22508
- $transcluded: this.$transcluded.bind(this),
22226
+ $children: this.$children,
22227
+ $destroy: this.$destroy.bind(this),
22228
+ $emit: this.$emit.bind(this),
22229
+ $eval: this.$eval.bind(this),
22230
+ $flushQueue: this.$flushQueue.bind(this),
22231
+ $getById: this.$getById.bind(this),
22509
22232
  $handler: /** @type {Scope} */ (this),
22233
+ $id: this.$id,
22234
+ $isRoot: this.#isRoot.bind(this),
22510
22235
  $merge: this.$merge.bind(this),
22511
- $getById: this.$getById.bind(this),
22512
- $searchByName: this.$searchByName.bind(this),
22513
- $proxy: this.$proxy,
22236
+ $new: this.$new.bind(this),
22237
+ $newIsolate: this.$newIsolate.bind(this),
22238
+ $on: this.$on.bind(this),
22514
22239
  $parent: this.$parent,
22240
+ $postUpdate: this.$postUpdate.bind(this),
22241
+ $proxy: this.$proxy,
22515
22242
  $root: this.$root,
22516
- $children: this.$children,
22517
- $id: this.$id,
22518
22243
  $scopename: this.$scopename,
22244
+ $searchByName: this.$searchByName.bind(this),
22245
+ $transcluded: this.$transcluded.bind(this),
22246
+ $watch: this.$watch.bind(this),
22519
22247
  };
22520
22248
  }
22521
22249
 
@@ -22575,18 +22303,18 @@ class Scope {
22575
22303
  this.#scheduleListener(listeners);
22576
22304
  }
22577
22305
 
22578
- const foreignListeners = this.foreignListeners.get(property);
22306
+ const _foreignListeners = this._foreignListeners.get(property);
22579
22307
 
22580
- if (foreignListeners) {
22581
- this.#scheduleListener(foreignListeners);
22308
+ if (_foreignListeners) {
22309
+ this.#scheduleListener(_foreignListeners);
22582
22310
  }
22583
22311
  }
22584
22312
 
22585
- if (this.objectListeners.get(target[property])) {
22586
- this.objectListeners.delete(target[property]);
22313
+ if (this._objectListeners.get(target[property])) {
22314
+ this._objectListeners.delete(target[property]);
22587
22315
  }
22588
22316
  target[property] = createScope(value, this);
22589
- this.objectListeners.set(target[property], [property]);
22317
+ this._objectListeners.set(target[property], [property]);
22590
22318
 
22591
22319
  return true;
22592
22320
  }
@@ -22607,10 +22335,10 @@ class Scope {
22607
22335
  this.#scheduleListener(listeners);
22608
22336
  }
22609
22337
 
22610
- const foreignListeners = this.foreignListeners.get(property);
22338
+ const _foreignListeners = this._foreignListeners.get(property);
22611
22339
 
22612
- if (foreignListeners) {
22613
- this.#scheduleListener(foreignListeners);
22340
+ if (_foreignListeners) {
22341
+ this.#scheduleListener(_foreignListeners);
22614
22342
  }
22615
22343
 
22616
22344
  this.#checkeListenersForAllKeys(value);
@@ -22663,8 +22391,8 @@ class Scope {
22663
22391
  }
22664
22392
 
22665
22393
  if (isArray(target)) {
22666
- if (this.objectListeners.has(proxy) && property !== "length") {
22667
- const keyList = this.objectListeners.get(proxy);
22394
+ if (this._objectListeners.has(proxy) && property !== "length") {
22395
+ const keyList = this._objectListeners.get(proxy);
22668
22396
 
22669
22397
  for (let i = 0, l = keyList.length; i < l; i++) {
22670
22398
  const currentListeners = this.watchers.get(keyList[i]);
@@ -22680,7 +22408,7 @@ class Scope {
22680
22408
  return true;
22681
22409
  } else {
22682
22410
  if (isUndefined(target[property]) && isProxy(value)) {
22683
- this.foreignProxies.add(/** @type {Proxy<ng.Scope>} */ (value));
22411
+ this._foreignProxies.add(/** @type {Proxy<ng.Scope>} */ (value));
22684
22412
  target[property] = value;
22685
22413
 
22686
22414
  if (!this.watchers.has(property)) {
@@ -22701,8 +22429,8 @@ class Scope {
22701
22429
 
22702
22430
  // Handle the case where we need to start observing object after a watcher has been set
22703
22431
  if (isUndefined(oldValue) && isObject(target[property])) {
22704
- if (!this.objectListeners.has(target[property])) {
22705
- this.objectListeners.set(target[property], [property]);
22432
+ if (!this._objectListeners.has(target[property])) {
22433
+ this._objectListeners.set(target[property], [property]);
22706
22434
  }
22707
22435
  const keyList = keys(value);
22708
22436
 
@@ -22765,25 +22493,25 @@ class Scope {
22765
22493
  });
22766
22494
  }
22767
22495
 
22768
- let foreignListeners = this.foreignListeners.get(property);
22496
+ let _foreignListeners = this._foreignListeners.get(property);
22769
22497
 
22770
- if (!foreignListeners && this.$parent?.foreignListeners) {
22771
- foreignListeners = this.$parent.foreignListeners.get(property);
22498
+ if (!_foreignListeners && this.$parent?._foreignListeners) {
22499
+ _foreignListeners = this.$parent._foreignListeners.get(property);
22772
22500
  }
22773
22501
 
22774
- if (foreignListeners) {
22775
- let scheduled = foreignListeners;
22502
+ if (_foreignListeners) {
22503
+ let scheduled = _foreignListeners;
22776
22504
 
22777
22505
  // filter for repeaters
22778
- const hashKey = this.$target.$$hashKey;
22506
+ const hashKey = this.$target._hashKey;
22779
22507
 
22780
22508
  if (hashKey) {
22781
22509
  scheduled = [];
22782
22510
 
22783
- for (let i = 0, l = foreignListeners.length; i < l; i++) {
22784
- const listener = foreignListeners[i];
22511
+ for (let i = 0, l = _foreignListeners.length; i < l; i++) {
22512
+ const listener = _foreignListeners[i];
22785
22513
 
22786
- if (listener.originalTarget.$$hashKey === hashKey) {
22514
+ if (listener.originalTarget._hashKey === hashKey) {
22787
22515
  scheduled.push(listener);
22788
22516
  }
22789
22517
  }
@@ -22795,15 +22523,15 @@ class Scope {
22795
22523
  }
22796
22524
  }
22797
22525
 
22798
- if (this.objectListeners.has(proxy) && property !== "length") {
22799
- const keyList = this.objectListeners.get(proxy);
22526
+ if (this._objectListeners.has(proxy) && property !== "length") {
22527
+ const keyList = this._objectListeners.get(proxy);
22800
22528
 
22801
22529
  for (let i = 0, l = keyList.length; i < l; i++) {
22802
22530
  const key = keyList[i];
22803
22531
 
22804
22532
  const listeners = this.watchers.get(key);
22805
22533
 
22806
- if (listeners && this.scheduled !== listeners) {
22534
+ if (listeners && this._scheduled !== listeners) {
22807
22535
  this.#scheduleListener(listeners);
22808
22536
  }
22809
22537
  }
@@ -22843,8 +22571,8 @@ class Scope {
22843
22571
  isArray(target) &&
22844
22572
  ["pop", "shift", "unshift"].includes(/** @type { string } */ (property))
22845
22573
  ) {
22846
- if (this.objectListeners.has(proxy)) {
22847
- const keyList = this.objectListeners.get(proxy);
22574
+ if (this._objectListeners.has(proxy)) {
22575
+ const keyList = this._objectListeners.get(proxy);
22848
22576
 
22849
22577
  for (let i = 0, l = keyList.length; i < l; i++) {
22850
22578
  const key = keyList[i];
@@ -22852,13 +22580,13 @@ class Scope {
22852
22580
  const listeners = this.watchers.get(key);
22853
22581
 
22854
22582
  if (listeners) {
22855
- this.scheduled = listeners;
22583
+ this._scheduled = listeners;
22856
22584
  }
22857
22585
  }
22858
22586
  }
22859
22587
 
22860
22588
  if (property === "unshift") {
22861
- this.#scheduleListener(this.scheduled);
22589
+ this.#scheduleListener(this._scheduled);
22862
22590
  }
22863
22591
  }
22864
22592
 
@@ -22883,8 +22611,8 @@ class Scope {
22883
22611
  this.#scheduleListener(listeners);
22884
22612
  }
22885
22613
 
22886
- if (this.objectListeners.has(this.$proxy)) {
22887
- const keyList = this.objectListeners.get(this.$proxy);
22614
+ if (this._objectListeners.has(this.$proxy)) {
22615
+ const keyList = this._objectListeners.get(this.$proxy);
22888
22616
 
22889
22617
  for (let i = 0, l = keyList.length; i < l; i++) {
22890
22618
  const key = keyList[i];
@@ -22895,9 +22623,9 @@ class Scope {
22895
22623
  }
22896
22624
  }
22897
22625
 
22898
- if (this.scheduled) {
22899
- this.#scheduleListener(this.scheduled);
22900
- this.scheduled = [];
22626
+ if (this._scheduled) {
22627
+ this.#scheduleListener(this._scheduled);
22628
+ this._scheduled = [];
22901
22629
  }
22902
22630
 
22903
22631
  return true;
@@ -22905,8 +22633,8 @@ class Scope {
22905
22633
 
22906
22634
  delete target[property];
22907
22635
 
22908
- if (this.objectListeners.has(this.$proxy)) {
22909
- const keyList = this.objectListeners.get(this.$proxy);
22636
+ if (this._objectListeners.has(this.$proxy)) {
22637
+ const keyList = this._objectListeners.get(this.$proxy);
22910
22638
 
22911
22639
  for (let i = 0, l = keyList.length; i < l; i++) {
22912
22640
  const key = keyList[i];
@@ -23148,7 +22876,7 @@ class Scope {
23148
22876
  watchProp.split(".").slice(0, -1).join("."),
23149
22877
  )(/** @type {Scope} */ (listener.originalTarget));
23150
22878
 
23151
- if (potentialProxy && this.foreignProxies.has(potentialProxy)) {
22879
+ if (potentialProxy && this._foreignProxies.has(potentialProxy)) {
23152
22880
  potentialProxy.$handler.#registerForeignKey(key, listener);
23153
22881
  potentialProxy.$handler.#scheduleListener([listener]);
23154
22882
 
@@ -23231,7 +22959,7 @@ class Scope {
23231
22959
  const listenerObject = listener.watchFn(this.$target);
23232
22960
 
23233
22961
  if (isObject(listenerObject)) {
23234
- this.objectListeners.set(listenerObject, [key]);
22962
+ this._objectListeners.set(listenerObject, [key]);
23235
22963
  }
23236
22964
 
23237
22965
  if (keySet.length > 0) {
@@ -23325,10 +23053,10 @@ class Scope {
23325
23053
 
23326
23054
  /** @internal **/
23327
23055
  #registerForeignKey(key, listener) {
23328
- if (this.foreignListeners.has(key)) {
23329
- this.foreignListeners.get(key).push(listener);
23056
+ if (this._foreignListeners.has(key)) {
23057
+ this._foreignListeners.get(key).push(listener);
23330
23058
  } else {
23331
- this.foreignListeners.set(key, [listener]);
23059
+ this._foreignListeners.set(key, [listener]);
23332
23060
  }
23333
23061
  }
23334
23062
 
@@ -23353,7 +23081,7 @@ class Scope {
23353
23081
  }
23354
23082
 
23355
23083
  // #deregisterForeignKey(key, id) {
23356
- // const listenerList = this.foreignListeners.get(key);
23084
+ // const listenerList = this._foreignListeners.get(key);
23357
23085
  // if (!listenerList) return false;
23358
23086
 
23359
23087
  // const index = listenerList.findIndex((x) => x.id === id);
@@ -23361,9 +23089,9 @@ class Scope {
23361
23089
 
23362
23090
  // listenerList.splice(index, 1);
23363
23091
  // if (listenerList.length) {
23364
- // this.foreignListeners.set(key, listenerList);
23092
+ // this._foreignListeners.set(key, listenerList);
23365
23093
  // } else {
23366
- // this.foreignListeners.delete(key);
23094
+ // this._foreignListeners.delete(key);
23367
23095
  // }
23368
23096
  // return true;
23369
23097
  // }
@@ -23423,11 +23151,11 @@ class Scope {
23423
23151
  * @returns {(function(): void)|*}
23424
23152
  */
23425
23153
  $on(name, listener) {
23426
- let namedListeners = this.$$listeners.get(name);
23154
+ let namedListeners = this._listeners.get(name);
23427
23155
 
23428
23156
  if (!namedListeners) {
23429
23157
  namedListeners = [];
23430
- this.$$listeners.set(name, namedListeners);
23158
+ this._listeners.set(name, namedListeners);
23431
23159
  }
23432
23160
  namedListeners.push(listener);
23433
23161
 
@@ -23438,7 +23166,7 @@ class Scope {
23438
23166
  namedListeners.splice(indexOfListener, 1);
23439
23167
 
23440
23168
  if (namedListeners.length === 0) {
23441
- this.$$listeners.delete(name);
23169
+ this._listeners.delete(name);
23442
23170
  }
23443
23171
  }
23444
23172
  };
@@ -23474,7 +23202,7 @@ class Scope {
23474
23202
  */
23475
23203
  #eventHelper({ name, event, broadcast }, ...args) {
23476
23204
  if (!broadcast) {
23477
- if (!this.$$listeners.has(name)) {
23205
+ if (!this._listeners.has(name)) {
23478
23206
  if (this.$parent) {
23479
23207
  return this.$parent.$handler.#eventHelper(
23480
23208
  { name, event, broadcast },
@@ -23506,7 +23234,7 @@ class Scope {
23506
23234
 
23507
23235
  const listenerArgs = concat([event], [event].concat(args), 1);
23508
23236
 
23509
- const listeners = this.$$listeners.get(name);
23237
+ const listeners = this._listeners.get(name);
23510
23238
 
23511
23239
  if (listeners) {
23512
23240
  let { length } = listeners;
@@ -23573,7 +23301,7 @@ class Scope {
23573
23301
  }
23574
23302
 
23575
23303
  $destroy() {
23576
- if (this.$$destroyed) return;
23304
+ if (this._destroyed) return;
23577
23305
 
23578
23306
  this.$broadcast("$destroy");
23579
23307
 
@@ -23604,8 +23332,8 @@ class Scope {
23604
23332
  }
23605
23333
  }
23606
23334
 
23607
- this.$$listeners.clear();
23608
- this.$$destroyed = true;
23335
+ this._listeners.clear();
23336
+ this._destroyed = true;
23609
23337
  }
23610
23338
 
23611
23339
  /**
@@ -23687,31 +23415,23 @@ class Scope {
23687
23415
  * @returns {ng.Scope|undefined}
23688
23416
  */
23689
23417
  $searchByName(name) {
23690
- /**
23691
- * @param {ng.Scope} scope
23692
- * @param {string} nameParam
23693
- * @returns {ng.Scope|undefined}
23694
- */
23695
- function getByName(scope, nameParam) {
23696
- if (scope.$scopename === nameParam) {
23697
- return scope;
23698
- } else {
23699
- let res = undefined;
23418
+ const stack = [this.$root];
23700
23419
 
23701
- for (const child of scope.$children) {
23702
- const found = getByName(child, nameParam);
23420
+ while (stack.length) {
23421
+ const scope = stack.pop();
23703
23422
 
23704
- if (found) {
23705
- res = found;
23706
- break;
23707
- }
23708
- }
23423
+ if (scope.$scopename === name) {
23424
+ return scope;
23425
+ }
23709
23426
 
23710
- return res;
23427
+ if (scope.$children?.length) {
23428
+ for (let i = scope.$children.length - 1; i >= 0; i--) {
23429
+ stack.push(scope.$children[i]);
23430
+ }
23711
23431
  }
23712
23432
  }
23713
23433
 
23714
- return getByName(this.$root, name);
23434
+ return undefined;
23715
23435
  }
23716
23436
  }
23717
23437
 
@@ -23763,146 +23483,65 @@ function collectChildIds(child) {
23763
23483
  return ids;
23764
23484
  }
23765
23485
 
23766
- const $templateRequestMinErr = minErr("$templateRequest");
23767
-
23768
23486
  /**
23769
- * Used to configure the options passed to the {@link $http} service when making a template request.
23487
+ * Provider for the `$templateRequest` service.
23770
23488
  *
23771
- * For example, it can be used for specifying the "Accept" header that is sent to the server, when
23772
- * requesting a template.
23489
+ * Fetches templates via HTTP and caches them in `$templateCache`.
23490
+ * Templates are assumed trusted. This provider allows configuring
23491
+ * per-request `$http` options such as headers, timeout, or transform functions.
23773
23492
  */
23774
- function TemplateRequestProvider() {
23775
- let httpOptions;
23493
+ class TemplateRequestProvider {
23494
+ /** @type {ng.RequestShortcutConfig|undefined} */
23495
+ httpOptions;
23776
23496
 
23777
- /**
23778
- * The options to be passed to the {@link $http} service when making the request.
23779
- * You can use this to override options such as the "Accept" header for template requests.
23780
- * The {@link $templateRequest} will set the `cache` and the `transformResponse` properties of the
23781
- * options if not overridden here.
23782
- *
23783
- * @param {string=} val new value for the {@link $http} options.
23784
- * @returns {string|TemplateRequestProvider} Returns the {@link $http} options when used as getter and self if used as setter.
23785
- */
23786
- this.httpOptions = function (val) {
23787
- if (val) {
23788
- httpOptions = val;
23789
-
23790
- return this;
23791
- }
23792
-
23793
- return httpOptions;
23794
- };
23795
-
23796
- /**
23797
- * The `$templateRequest` service runs security checks then downloads the provided template using
23798
- * `$http` and, upon success, stores the contents inside of `$templateCache`. If the HTTP request
23799
- * fails or the response data of the HTTP request is empty, a `$compile` error will be thrown (the
23800
- * exception can be thwarted by setting the 2nd parameter of the function to true). Note that the
23801
- * contents of `$templateCache` are trusted, so the call to `$sce.getTrustedUrl(tpl)` is omitted
23802
- * when `tpl` is of type string and `$templateCache` has the matching entry.
23803
- *
23804
- * If you want to pass custom options to the `$http` service, such as setting the Accept header you
23805
- * can configure this via {@link $templateRequestProvider#httpOptions}.
23806
- *
23807
- * `$templateRequest` is used internally by {@link $compile}, {@link ngRoute.$route}, and directives such
23808
- * as {@link ngInclude} to download and cache templates.
23809
- *
23810
- * 3rd party modules should use `$templateRequest` if their services or directives are loading
23811
- * templates.
23812
- *
23813
- * @param {string} tpl The HTTP request template URL
23814
- * @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty
23815
- *
23816
- * @return {Promise} a promise for the HTTP response data of the given URL.
23817
- *
23818
- * @property {number} totalPendingRequests total amount of pending template requests being downloaded.
23819
- */
23820
- this.$get = [
23821
- $injectTokens._exceptionHandler,
23497
+ /** @returns {Array} DI tokens for Angular.ts injection */
23498
+ $get = [
23822
23499
  $injectTokens._templateCache,
23823
23500
  $injectTokens._http,
23824
- $injectTokens._sce,
23825
23501
  /**
23826
- *
23827
- * @param {ng.ExceptionHandlerService} $exceptionHandler
23828
23502
  * @param {ng.TemplateCacheService} $templateCache
23829
23503
  * @param {ng.HttpService} $http
23830
- * @param {*} $sce
23831
23504
  * @returns {ng.TemplateRequestService}
23832
23505
  */
23833
- function ($exceptionHandler, $templateCache, $http, $sce) {
23834
- function handleRequestFn(tpl, ignoreRequestError) {
23835
- handleRequestFn.totalPendingRequests++;
23836
-
23837
- // We consider the template cache holds only trusted templates, so
23838
- // there's no need to go through adding the template again to the trusted
23839
- // resources for keys that already are included in there. This also makes
23840
- // AngularTS accept any script directive, no matter its name. However, we
23841
- // still need to unwrap trusted types.
23842
-
23843
- if (!isString(tpl) || !$templateCache.has(tpl)) {
23844
- try {
23845
- tpl = $sce.getTrustedResourceUrl(tpl);
23846
-
23847
- if (!tpl) {
23848
- return Promise.reject("Template not found");
23849
- }
23850
- } catch (err) {
23851
- return Promise.reject(err.message);
23852
- }
23853
- }
23854
-
23855
- let transformResponse =
23856
- $http.defaults && $http.defaults.transformResponse;
23506
+ ($templateCache, $http) => {
23507
+ /**
23508
+ * Fetch a template via HTTP and cache it.
23509
+ *
23510
+ * @param {string} templateUrl URL of the template
23511
+ * @returns {Promise<string>} Resolves with template content
23512
+ */
23513
+ const fetchTemplate = (templateUrl) => {
23514
+ // Filter out default transformResponse for template requests
23515
+ let transformResponse = $http.defaults?.transformResponse ?? null;
23857
23516
 
23858
23517
  if (isArray(transformResponse)) {
23859
- transformResponse = transformResponse.filter(function (transformer) {
23860
- return transformer !== defaultHttpResponseTransform;
23861
- });
23518
+ transformResponse = transformResponse.filter(
23519
+ (x) => x !== defaultHttpResponseTransform,
23520
+ );
23862
23521
  } else if (transformResponse === defaultHttpResponseTransform) {
23863
23522
  transformResponse = null;
23864
23523
  }
23865
23524
 
23866
- return $http
23867
- .get(
23868
- tpl,
23869
- extend(
23870
- {
23871
- cache: $templateCache,
23872
- transformResponse,
23873
- },
23874
- httpOptions,
23875
- ),
23876
- )
23877
- .finally(function () {
23878
- handleRequestFn.totalPendingRequests--;
23879
- })
23880
- .then(function (response) {
23881
- $templateCache.set(tpl, response.data);
23882
-
23883
- return response.data;
23884
- }, handleError);
23885
-
23886
- function handleError(resp) {
23887
- if (!ignoreRequestError) {
23888
- resp = $templateRequestMinErr(
23889
- "tpload",
23890
- "Failed to load template: {0} (HTTP status: {1} {2})",
23891
- tpl,
23892
- resp.status,
23893
- resp.statusText,
23894
- );
23895
-
23896
- $exceptionHandler(resp);
23897
- }
23525
+ /** @type {ng.RequestShortcutConfig} */
23526
+ const config = extend(
23527
+ {
23528
+ cache: $templateCache,
23529
+ transformResponse,
23530
+ },
23531
+ this.httpOptions || {},
23532
+ );
23898
23533
 
23899
- return Promise.reject(resp);
23900
- }
23901
- }
23534
+ return $http.get(templateUrl, config).then(
23535
+ (response) => {
23536
+ $templateCache.set(templateUrl, response.data);
23902
23537
 
23903
- handleRequestFn.totalPendingRequests = 0;
23538
+ return response.data;
23539
+ },
23540
+ (resp) => Promise.reject(resp),
23541
+ );
23542
+ };
23904
23543
 
23905
- return handleRequestFn;
23544
+ return fetchTemplate;
23906
23545
  },
23907
23546
  ];
23908
23547
  }
@@ -24242,12 +23881,12 @@ function ngMessagesIncludeDirective($templateRequest, $compile) {
24242
23881
  const src = attrs.ngMessagesInclude || attrs.src;
24243
23882
 
24244
23883
  $templateRequest(src).then((html) => {
24245
- if ($scope.$$destroyed) return;
23884
+ if ($scope._destroyed) return;
24246
23885
 
24247
23886
  if (isString(html) && !html.trim()) ; else {
24248
23887
  // Non-empty template - compile and link
24249
23888
  $compile(html)($scope, (contents) => {
24250
- isIntanceOf(contents, Node) && element.after(contents);
23889
+ isInstanceOf(contents, Node) && element.after(contents);
24251
23890
  });
24252
23891
  }
24253
23892
  });
@@ -24398,11 +24037,7 @@ const nativeAriaNodeNames = [
24398
24037
  ];
24399
24038
 
24400
24039
  const isNodeOneOf = function (elem, nodeTypeArray) {
24401
- if (nodeTypeArray.indexOf(elem.nodeName) !== -1) {
24402
- return true;
24403
- }
24404
-
24405
- return false;
24040
+ return nodeTypeArray.indexOf(elem.nodeName) !== -1;
24406
24041
  };
24407
24042
 
24408
24043
  /**
@@ -27640,7 +27275,7 @@ class RafSchedulerProvider {
27640
27275
  _nextTick() {
27641
27276
  if (!this._queue.length) return;
27642
27277
 
27643
- const items = this._queue.shift();
27278
+ const items = /** @type{Array<() => void>} */ (this._queue.shift());
27644
27279
 
27645
27280
  items.forEach((fn) => fn());
27646
27281
 
@@ -28577,7 +28212,7 @@ function applyPairs(memo, keyValTuple) {
28577
28212
  /**
28578
28213
  * Returns the last element of an array, or undefined if the array is empty.
28579
28214
  * @template T
28580
- * @param {T[]} arr - The input array.
28215
+ * @param {any[]|string} arr - The input array.
28581
28216
  * @returns {T | undefined} The last element or undefined.
28582
28217
  */
28583
28218
  function tail(arr) {
@@ -28648,16 +28283,16 @@ const silentRejection = (error) =>
28648
28283
  *
28649
28284
  * ```
28650
28285
  *
28651
- * @param fn
28286
+ * @param {Function} fn
28652
28287
  * @returns {*|function(): (*|any)}
28653
28288
  */
28654
28289
  function curry(fn) {
28655
- const curried = (...args) => {
28290
+ const curried = (/** @type {any[]} */ ...args) => {
28656
28291
  if (args.length >= fn.length) {
28657
28292
  return fn(...args);
28658
28293
  }
28659
28294
 
28660
- return (...nextArgs) => curried(...args, ...nextArgs);
28295
+ return (/** @type {any} */ ...nextArgs) => curried(...args, ...nextArgs);
28661
28296
  };
28662
28297
 
28663
28298
  return curried;
@@ -28670,7 +28305,13 @@ function curry(fn) {
28670
28305
  * let getName = propEq("name", "blarg");
28671
28306
  * getName(obj) === true
28672
28307
  */
28673
- const propEq = curry((name, _val, obj) => obj && obj[name] === _val);
28308
+ const propEq = curry(
28309
+ (
28310
+ /** @type {string | number} */ name,
28311
+ /** @type {any} */ _val,
28312
+ /** @type {{ [x: string]: any; }} */ obj,
28313
+ ) => obj && obj[name] === _val,
28314
+ );
28674
28315
  /**
28675
28316
  * Given a dotted property name, returns a function that returns a nested property from an object, or undefined
28676
28317
  * let obj = { id: 1, nestedObj: { foo: 1, name: "blarg" }, };
@@ -28679,10 +28320,11 @@ const propEq = curry((name, _val, obj) => obj && obj[name] === _val);
28679
28320
  * let propNotFound = prop("this.property.doesnt.exist");
28680
28321
  * propNotFound(obj) === undefined
28681
28322
  */
28682
- const parse = (path) => {
28323
+ const parse = (/** @type {string} */ path) => {
28683
28324
  const parts = path.split(".");
28684
28325
 
28685
- return (obj) => parts.reduce((acc, key) => acc && acc[key], obj);
28326
+ return (/** @type {any} */ obj) =>
28327
+ parts.reduce((acc, key) => acc && acc[key], obj);
28686
28328
  };
28687
28329
 
28688
28330
  /**
@@ -28707,7 +28349,12 @@ function is(ctor) {
28707
28349
  };
28708
28350
  }
28709
28351
 
28710
- /** Given a value, returns a function which returns the value */
28352
+ /**
28353
+ * Given a value, returns a function which returns that value.
28354
+ * @template T
28355
+ * @param {T} value - The value to wrap in a function.
28356
+ * @returns {() => T} A function that returns the given value.
28357
+ */
28711
28358
  const val = (value) => () => value;
28712
28359
 
28713
28360
  /**
@@ -28724,31 +28371,28 @@ const val = (value) => () => value;
28724
28371
  * of size 2: [ predicate, mapFn ]
28725
28372
  *
28726
28373
  * These 2-tuples should be put in an outer array.
28727
- *
28728
- * @example
28729
- * ```
28730
- *
28731
- * // Here's a 2-tuple where the first element is the isString predicate
28732
- * // and the second element is a function that returns a description of the input
28733
- * let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ];
28734
- *
28735
- * // Second tuple: predicate "isNumber", mapfn returns a description
28736
- * let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ];
28737
- *
28738
- * let third = [ (input) => input === null, (input) => `Oh, null...` ];
28739
- *
28740
- * let fourth = [ (input) => input === undefined, (input) => `notdefined` ];
28741
- *
28742
- * let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]);
28743
- *
28744
- * console.log(descriptionOf(undefined)); // 'notdefined'
28745
- * console.log(descriptionOf(55)); // '(55) That's a number!'
28746
- * console.log(descriptionOf("foo")); // 'Here's your string foo'
28747
- * ```
28748
- *
28749
- * @param struct A 2D array. Each element of the array should be an array, a 2-tuple,
28750
- * with a Predicate and a mapping/output function
28751
- * @returns {function(any): *}
28374
+ * @example ```
28375
+
28376
+ // Here's a 2-tuple where the first element is the isString predicate
28377
+ // and the second element is a function that returns a description of the input
28378
+ let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ];
28379
+
28380
+ // Second tuple: predicate "isNumber", mapfn returns a description
28381
+ let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ];
28382
+
28383
+ let third = [ (input) => input === null, (input) => `Oh, null...` ];
28384
+
28385
+ let fourth = [ (input) => input === undefined, (input) => `notdefined` ];
28386
+
28387
+ let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]);
28388
+
28389
+ console.log(descriptionOf(undefined)); // 'notdefined'
28390
+ console.log(descriptionOf(55)); // '(55) That's a number!'
28391
+ console.log(descriptionOf("foo")); // 'Here's your string foo'
28392
+ ```
28393
+ * @param {string | any[]} struct A 2D array. Each element of the array should be an array, a 2-tuple,
28394
+ with a Predicate and a mapping/output function
28395
+ * @returns {function(any):*}
28752
28396
  */
28753
28397
  function pattern(struct) {
28754
28398
  return function (item) {
@@ -29408,17 +29052,23 @@ class RouterProvider {
29408
29052
  /**
29409
29053
  * @type {number}
29410
29054
  */
29411
- this.lastStartedTransitionId = -1;
29055
+ this._lastStartedTransitionId = -1;
29412
29056
 
29413
29057
  /**
29414
29058
  * @type {Queue<import("./transition/transition.js").Transition>}
29415
29059
  */
29416
- this.transitionHistory = new Queue([], 1);
29060
+ this._transitionHistory = new Queue(
29061
+ /** @type {Array<import("./transition/transition.js").Transition>} */ ([]),
29062
+ 1,
29063
+ );
29417
29064
 
29418
29065
  /**
29419
29066
  * @type {Queue<import("./transition/transition.js").Transition>}
29420
29067
  */
29421
- this.successfulTransitions = new Queue([], 1);
29068
+ this._successfulTransitions = new Queue(
29069
+ /** @type {Array<import("./transition/transition.js").Transition>} */ ([]),
29070
+ 1,
29071
+ );
29422
29072
 
29423
29073
  /**
29424
29074
  * @type {import("./state/interface.ts").StateDeclaration|undefined}
@@ -29517,10 +29167,17 @@ function fnToString(fn) {
29517
29167
  return (_fn && _fn.toString()) || "undefined";
29518
29168
  }
29519
29169
 
29170
+ /**
29171
+ * @param {any} value
29172
+ * @returns {string|*|string}
29173
+ */
29520
29174
  function stringify(value) {
29175
+ /**
29176
+ * @type {any[]}
29177
+ */
29521
29178
  const seen = [];
29522
29179
 
29523
- const isRejection = (obj) => {
29180
+ const isRejection = (/** @type {Promise<any>} */ obj) => {
29524
29181
  return (
29525
29182
  obj &&
29526
29183
  typeof obj.then === "function" &&
@@ -29528,7 +29185,9 @@ function stringify(value) {
29528
29185
  );
29529
29186
  };
29530
29187
 
29531
- const hasToString = (obj) =>
29188
+ const hasToString = (
29189
+ /** @type {{ constructor: ObjectConstructor; toString: any; }} */ obj,
29190
+ ) =>
29532
29191
  isObject(obj) &&
29533
29192
  !isArray(obj) &&
29534
29193
  obj.constructor !== Object &&
@@ -29538,12 +29197,23 @@ function stringify(value) {
29538
29197
  [isUndefined, val("undefined")],
29539
29198
  [isNull, val("null")],
29540
29199
  [isPromise, val("[Promise]")],
29541
- [isRejection, (reg) => reg._transitionRejection.toString()],
29542
- [hasToString, (str) => str.toString()],
29200
+ [
29201
+ isRejection,
29202
+ (
29203
+ /** @type {{ _transitionRejection: { toString: () => any; }; }} */ reg,
29204
+ ) => reg._transitionRejection.toString(),
29205
+ ],
29206
+ [
29207
+ hasToString,
29208
+ (/** @type {{ toString: () => any; }} */ str) => str.toString(),
29209
+ ],
29543
29210
  [isInjectable, functionToString],
29544
- [val(true), (bool) => bool],
29211
+ [val(true), (/** @type {any} */ bool) => bool],
29545
29212
  ]);
29546
29213
 
29214
+ /**
29215
+ * @param {any} item
29216
+ */
29547
29217
  function format(item) {
29548
29218
  if (isObject(item)) {
29549
29219
  if (seen.indexOf(item) !== -1) return "[circular ref]";
@@ -29566,7 +29236,9 @@ function stringify(value) {
29566
29236
  );
29567
29237
  }
29568
29238
 
29569
- const stripLastPathElement = (str) => str.replace(/\/[^/]*$/, "");
29239
+ const stripLastPathElement = (/** @type {string} */ str) =>
29240
+ str.replace(/\/[^/]*$/, "");
29241
+
29570
29242
  /**
29571
29243
  * Splits on a delimiter, but returns the delimiters in the array
29572
29244
  *
@@ -29576,12 +29248,14 @@ const stripLastPathElement = (str) => str.replace(/\/[^/]*$/, "");
29576
29248
  * splitOnSlashes("/foo"); // ["/", "foo"]
29577
29249
  * splitOnSlashes("/foo/"); // ["/", "foo", "/"]
29578
29250
  * ```
29251
+ * @param {string} delim
29579
29252
  */
29580
29253
  function splitOnDelim(delim) {
29581
29254
  const re = new RegExp(`(${delim})`, "g");
29582
29255
 
29583
- return (str) => str.split(re).filter(Boolean);
29256
+ return (/** @type {string} */ str) => str.split(re).filter(Boolean);
29584
29257
  }
29258
+
29585
29259
  /**
29586
29260
  * Reduce fn that joins neighboring strings
29587
29261
  *
@@ -29593,10 +29267,12 @@ function splitOnDelim(delim) {
29593
29267
  * let arr = ["foo", "bar", 1, "baz", "", "qux" ];
29594
29268
  * arr.reduce(joinNeighborsR, []) // ["foobar", 1, "bazqux" ]
29595
29269
  * ```
29270
+ * @param {string | any[]} acc
29271
+ * @param {unknown} str
29596
29272
  */
29597
29273
  function joinNeighborsR(acc, str) {
29598
- if (isString(tail(acc)) && isString(str))
29599
- return acc.slice(0, -1).concat(tail(acc) + str);
29274
+ if (isString(tail(/** @type {string} */ (acc))) && isString(str))
29275
+ return acc.slice(0, -1).concat(tail(/** @type {string} */ (acc)) + str);
29600
29276
 
29601
29277
  return pushR(acc, str);
29602
29278
  }
@@ -32166,18 +31842,24 @@ class RegisteredHook {
32166
31842
  this._deregistered = true;
32167
31843
  }
32168
31844
  }
32169
- /** Return a registration function of the requested type. */
32170
- function makeEvent(registry, transitionService, eventType) {
31845
+ /**
31846
+ * Return a registration function of the requested type.
31847
+ * @param {ng.TransitionProvider| import("./transition.js").Transition} hookSource
31848
+ * @param {ng.TransitionProvider} transitionService
31849
+ * @param {import("./transition-event-type.js").TransitionEventType} eventType
31850
+ * @returns {( matchObject: any, callback: Function, options?: Record<string, any> ) => () => void }
31851
+ */
31852
+ function makeEvent(hookSource, transitionService, eventType) {
32171
31853
  // Create the object which holds the registered transition hooks.
32172
- const _registeredHooks = (registry._registeredHooks =
32173
- registry._registeredHooks || {});
31854
+ const _registeredHooks = (hookSource._registeredHooks =
31855
+ hookSource._registeredHooks || {});
32174
31856
 
32175
31857
  const hooks = (_registeredHooks[eventType.name] = []);
32176
31858
 
32177
31859
  const removeHookFn = (x) => removeFrom(hooks, x);
32178
31860
 
32179
31861
  // Create hook registration function on the HookRegistry for the event
32180
- registry[eventType.name] = hookRegistrationFn;
31862
+ hookSource[eventType.name] = hookRegistrationFn;
32181
31863
  function hookRegistrationFn(matchObject, callback, options = {}) {
32182
31864
  const registeredHook = new RegisteredHook(
32183
31865
  transitionService,
@@ -32222,7 +31904,7 @@ class HookBuilder {
32222
31904
  * @returns
32223
31905
  */
32224
31906
  buildHooksForPhase(phase) {
32225
- return this.transition._transitionService
31907
+ return this.transition._transitionProvider
32226
31908
  ._getEvents(phase)
32227
31909
  .map((type) => this.buildHooks(type))
32228
31910
  .reduce(unnestR, [])
@@ -32283,7 +31965,7 @@ class HookBuilder {
32283
31965
  state,
32284
31966
  hook,
32285
31967
  _options,
32286
- this.transition._transitionService._$exceptionHandler,
31968
+ this.transition._transitionProvider._$exceptionHandler,
32287
31969
  );
32288
31970
 
32289
31971
  return { hook, node, transitionHook };
@@ -32312,7 +31994,7 @@ class HookBuilder {
32312
31994
  const isCreate = hookType.hookPhase === TransitionHookPhase._CREATE;
32313
31995
 
32314
31996
  // Instance and Global hook registries
32315
- const $transitions = this.transition._transitionService;
31997
+ const $transitions = this.transition._transitionProvider;
32316
31998
 
32317
31999
  const registries = isCreate
32318
32000
  ? [$transitions]
@@ -32377,7 +32059,11 @@ class Transition {
32377
32059
  * @type {import('../router.js').RouterProvider}
32378
32060
  */
32379
32061
  this._globals = globals;
32380
- this._transitionService = transitionService;
32062
+
32063
+ /** @type {ng.TransitionProvider} */
32064
+ this._transitionProvider = transitionService;
32065
+
32066
+ /** @type {PromiseWithResolvers<any>} */
32381
32067
  this._deferred = Promise.withResolvers();
32382
32068
 
32383
32069
  /**
@@ -32433,10 +32119,12 @@ class Transition {
32433
32119
  * (which can then be used to register hooks)
32434
32120
  */
32435
32121
  createTransitionHookRegFns() {
32436
- this._transitionService
32122
+ this._transitionProvider
32437
32123
  ._getEvents()
32438
32124
  .filter((type) => type.hookPhase !== TransitionHookPhase._CREATE)
32439
- .forEach((type) => makeEvent(this, this._transitionService, type));
32125
+ .forEach((type) => {
32126
+ return makeEvent(this, this._transitionProvider, type);
32127
+ });
32440
32128
  }
32441
32129
 
32442
32130
  getHooks(hookName) {
@@ -32447,7 +32135,7 @@ class Transition {
32447
32135
  const enteringStates = this._treeChanges.entering.map((node) => node.state);
32448
32136
 
32449
32137
  PathUtils.applyViewConfigs(
32450
- this._transitionService.$view,
32138
+ this._transitionProvider.$view,
32451
32139
  this._treeChanges.to,
32452
32140
  enteringStates,
32453
32141
  );
@@ -32767,7 +32455,7 @@ class Transition {
32767
32455
  );
32768
32456
 
32769
32457
  targetState = targetState.withOptions(newOptions, true);
32770
- const newTransition = this._transitionService.create(
32458
+ const newTransition = this._transitionProvider.create(
32771
32459
  this._treeChanges.from,
32772
32460
  targetState,
32773
32461
  );
@@ -32953,9 +32641,9 @@ class Transition {
32953
32641
  const startTransition = () => {
32954
32642
  const { _globals } = this;
32955
32643
 
32956
- _globals.lastStartedTransitionId = this.$id;
32644
+ _globals._lastStartedTransitionId = this.$id;
32957
32645
  _globals.transition = this;
32958
- _globals.transitionHistory.enqueue(this);
32646
+ _globals._transitionHistory.enqueue(this);
32959
32647
  trace.traceTransitionStart(this);
32960
32648
 
32961
32649
  return Promise.resolve();
@@ -33296,7 +32984,7 @@ const updateGlobalState = (trans) => {
33296
32984
  const globals = trans._globals;
33297
32985
 
33298
32986
  const transitionSuccessful = () => {
33299
- globals.successfulTransitions.enqueue(trans);
32987
+ globals._successfulTransitions.enqueue(trans);
33300
32988
  globals.$current = trans.$to();
33301
32989
  globals.current = globals.$current.self;
33302
32990
  copy(trans.params(), globals.params);
@@ -33345,12 +33033,19 @@ function registerLazyLoadHook(
33345
33033
  stateRegistry,
33346
33034
  ) {
33347
33035
  return transitionService.onBefore(
33348
- { entering: (state) => !!state.lazyLoad },
33349
- (transition) => {
33036
+ {
33037
+ entering: (state) => {
33038
+ return !!state.lazyLoad;
33039
+ },
33040
+ },
33041
+ /** @param {import("../transition/transition.js").Transition} transition*/ (
33042
+ transition,
33043
+ ) => {
33350
33044
  function retryTransition() {
33351
33045
  if (transition.originalTransition().options().source !== "url") {
33352
33046
  // The original transition was not triggered via url sync
33353
33047
  // The lazy state should be loaded now, so re-try the original transition
33048
+
33354
33049
  const orig = transition.targetState();
33355
33050
 
33356
33051
  return stateService.target(
@@ -33649,7 +33344,7 @@ class TransitionProvider {
33649
33344
 
33650
33345
  /** @type {ng.ExceptionHandlerService} */
33651
33346
  this._$exceptionHandler = $exceptionHandler.handler;
33652
- globals.successfulTransitions.onEvict(treeChangesCleanup);
33347
+ globals._successfulTransitions.onEvict(treeChangesCleanup);
33653
33348
  }
33654
33349
 
33655
33350
  $get = [
@@ -33934,8 +33629,15 @@ class StateProvider {
33934
33629
  * @param {ng.ExceptionHandlerProvider} exceptionHandlerProvider
33935
33630
  */
33936
33631
  constructor(globals, transitionService, exceptionHandlerProvider) {
33632
+ /**
33633
+ * @type {ng.RouterProvider}
33634
+ */
33937
33635
  this.globals = globals;
33636
+ /**
33637
+ * @type {ng.TransitionProvider}
33638
+ */
33938
33639
  this.transitionService = transitionService;
33640
+
33939
33641
  this.stateRegistry = undefined;
33940
33642
 
33941
33643
  /** @type {ng.UrlService} */
@@ -34090,7 +33792,7 @@ class StateProvider {
34090
33792
 
34091
33793
  const { globals } = this;
34092
33794
 
34093
- const latestThing = () => globals.transitionHistory.peekTail();
33795
+ const latestThing = () => globals._transitionHistory.peekTail();
34094
33796
 
34095
33797
  const latest = latestThing();
34096
33798
 
@@ -34305,7 +34007,7 @@ class StateProvider {
34305
34007
  getCurrentPath() {
34306
34008
  const { globals } = this;
34307
34009
 
34308
- const latestSuccess = globals.successfulTransitions.peekTail();
34010
+ const latestSuccess = globals._successfulTransitions.peekTail();
34309
34011
 
34310
34012
  const rootPath = () => [new PathNode(this.stateRegistry.root())];
34311
34013
 
@@ -34364,7 +34066,7 @@ class StateProvider {
34364
34066
  */
34365
34067
  const rejectedTransitionHandler = (trans) => (error) => {
34366
34068
  if (error instanceof Rejection) {
34367
- const isLatest = this.globals.lastStartedTransitionId <= trans.$id;
34069
+ const isLatest = this.globals._lastStartedTransitionId <= trans.$id;
34368
34070
 
34369
34071
  if (error.type === RejectType._IGNORED) {
34370
34072
  isLatest && this.urlService.update();
@@ -34660,10 +34362,10 @@ class ViewScrollProvider {
34660
34362
  return $anchorScroll;
34661
34363
  }
34662
34364
 
34663
- return async function ($element) {
34365
+ return (/** @type {Element} */ $element) => {
34664
34366
  validateInstanceOf($element, Element, "$element");
34665
34367
 
34666
- return setTimeout(() => {
34368
+ setTimeout(() => {
34667
34369
  $element.scrollIntoView(false);
34668
34370
  }, 0);
34669
34371
  };
@@ -34828,7 +34530,9 @@ class TemplateFactoryProvider {
34828
34530
  fromProvider(provider, params, context) {
34829
34531
  const deps = annotate(provider);
34830
34532
 
34831
- const providerFn = isArray(provider) ? tail(provider) : provider;
34533
+ const providerFn = isArray(provider)
34534
+ ? /** @type {Function} */ (tail(provider))
34535
+ : provider;
34832
34536
 
34833
34537
  const resolvable = new Resolvable("", providerFn, deps);
34834
34538
 
@@ -35594,8 +35298,6 @@ function encodeDashes(str) {
35594
35298
  );
35595
35299
  }
35596
35300
 
35597
- /** @typedef {import('./interface.ts').StateDeclaration} StateDeclaration */
35598
-
35599
35301
  /**
35600
35302
  * Internal representation of a ng-router state.
35601
35303
  *
@@ -35605,16 +35307,16 @@ function encodeDashes(str) {
35605
35307
  *
35606
35308
  * This class prototypally inherits from the corresponding [[StateDeclaration]].
35607
35309
  * Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]].
35608
- * @implements {StateDeclaration}
35310
+ * @implements {ng.StateDeclaration}
35609
35311
  */
35610
35312
  class StateObject {
35611
- name = undefined;
35612
- navigable = undefined;
35313
+ name;
35314
+ navigable;
35613
35315
  /** @type {?StateObject} */
35614
- parent = undefined;
35615
- params = undefined;
35616
- url = undefined;
35617
- includes = undefined;
35316
+ parent;
35317
+ params;
35318
+ url;
35319
+ includes;
35618
35320
 
35619
35321
  /**
35620
35322
  * @param {import('./interface.ts').StateDeclaration} config
@@ -35633,7 +35335,7 @@ class StateObject {
35633
35335
  */
35634
35336
  const nameGlob = this.name ? Glob.fromString(this.name) : null;
35635
35337
 
35636
- this.__stateObjectCache = { nameGlob };
35338
+ this._stateObjectCache = { nameGlob };
35637
35339
  }
35638
35340
 
35639
35341
  /**
@@ -35715,7 +35417,7 @@ class StateObject {
35715
35417
  /** Predicate which returns true if the object is a [[StateDeclaration]] object */
35716
35418
  StateObject.isStateDeclaration = (obj) => isFunction(obj.$$state);
35717
35419
  /** Predicate which returns true if the object is an internal [[StateObject]] object */
35718
- StateObject.isState = (obj) => isObject(obj.__stateObjectCache);
35420
+ StateObject.isState = (obj) => isObject(obj._stateObjectCache);
35719
35421
 
35720
35422
  /**
35721
35423
  * Creates a [[UrlRule]]
@@ -36019,20 +35721,6 @@ function defaultRuleSortFn(a, b) {
36019
35721
  return idSort(a, b);
36020
35722
  }
36021
35723
 
36022
- function getHandlerFn(handler) {
36023
- if (
36024
- !isFunction(handler) &&
36025
- !isString(handler) &&
36026
- !is(TargetState)(handler) &&
36027
- !TargetState.isDef(handler)
36028
- ) {
36029
- throw new Error(
36030
- "'handler' must be a string, function, TargetState, or have a state: 'newtarget' property",
36031
- );
36032
- }
36033
-
36034
- return isFunction(handler) ? handler : val(handler);
36035
- }
36036
35724
  /**
36037
35725
  * API for managing URL rules
36038
35726
  *
@@ -36049,102 +35737,7 @@ class UrlRules {
36049
35737
  this._sortFn = defaultRuleSortFn;
36050
35738
  this._rules = [];
36051
35739
  this._id = 0;
36052
- this.urlRuleFactory = urlRuleFactory;
36053
- }
36054
-
36055
- /**
36056
- * Defines the initial state, path, or behavior to use when the app starts.
36057
- *
36058
- * This rule defines the initial/starting state for the application.
36059
- *
36060
- * This rule is triggered the first time the URL is checked (when the app initially loads).
36061
- * The rule is triggered only when the url matches either `""` or `"/"`.
36062
- *
36063
- * Note: The rule is intended to be used when the root of the application is directly linked to.
36064
- * When the URL is *not* `""` or `"/"` and doesn't match other rules, the [[otherwise]] rule is triggered.
36065
- * This allows 404-like behavior when an unknown URL is deep-linked.
36066
- *
36067
- * #### Example:
36068
- * Start app at `home` state.
36069
- * ```js
36070
- * .initial({ state: 'home' });
36071
- * ```
36072
- *
36073
- * #### Example:
36074
- * Start app at `/home` (by url)
36075
- * ```js
36076
- * .initial('/home');
36077
- * ```
36078
- *
36079
- * #### Example:
36080
- * When no other url rule matches, go to `home` state
36081
- * ```js
36082
- * .initial((matchValue, url, router) => {
36083
- * console.log('initial state');
36084
- * return { state: 'home' };
36085
- * })
36086
- * ```
36087
- *
36088
- * @param handler The initial state or url path, or a function which returns the state or url path (or performs custom logic).
36089
- */
36090
- initial(handler) {
36091
- const handlerFn = getHandlerFn(handler);
36092
-
36093
- const matchFn = (urlParts, router) =>
36094
- router.globals.transitionHistory.size() === 0 &&
36095
- !!/^\/?$/.exec(urlParts.path);
36096
-
36097
- this.rule(this.urlRuleFactory.create(matchFn, handlerFn));
36098
- }
36099
-
36100
- /**
36101
- * Defines the state, url, or behavior to use when no other rule matches the URL.
36102
- *
36103
- * This rule is matched when *no other rule* matches.
36104
- * It is generally used to handle unknown URLs (similar to "404" behavior, but on the client side).
36105
- *
36106
- * - If `handler` a string, it is treated as a url redirect
36107
- *
36108
- * #### Example:
36109
- * When no other url rule matches, redirect to `/index`
36110
- * ```js
36111
- * .otherwise('/index');
36112
- * ```
36113
- *
36114
- * - If `handler` is an object with a `state` property, the state is activated.
36115
- *
36116
- * #### Example:
36117
- * When no other url rule matches, redirect to `home` and provide a `dashboard` parameter value.
36118
- * ```js
36119
- * .otherwise({ state: 'home', params: { dashboard: 'default' } });
36120
- * ```
36121
- *
36122
- * - If `handler` is a function, the function receives the current url ([[UrlParts]]) and the [[UIRouter]] object.
36123
- * The function can perform actions, and/or return a value.
36124
- *
36125
- * #### Example:
36126
- * When no other url rule matches, manually trigger a transition to the `home` state
36127
- * ```js
36128
- * .otherwise((matchValue, urlParts, router) => {
36129
- * router.stateService.go('home');
36130
- * });
36131
- * ```
36132
- *
36133
- * #### Example:
36134
- * When no other url rule matches, go to `home` state
36135
- * ```js
36136
- * .otherwise((matchValue, urlParts, router) => {
36137
- * return { state: 'home' };
36138
- * });
36139
- * ```
36140
- *
36141
- * @param handler The url path to redirect to, or a function which returns the url path (or performs custom logic).
36142
- */
36143
- otherwise(handler) {
36144
- const handlerFn = getHandlerFn(handler);
36145
-
36146
- this._otherwiseFn = this.urlRuleFactory.create(val(true), handlerFn);
36147
- this._sorted = false;
35740
+ this._urlRuleFactory = urlRuleFactory;
36148
35741
  }
36149
35742
 
36150
35743
  /**
@@ -36166,7 +35759,7 @@ class UrlRules {
36166
35759
  * A rule should have a `match` function which returns truthy if the rule matched.
36167
35760
  * It should also have a `handler` function which is invoked if the rule is the best match.
36168
35761
  *
36169
- * @return a function that deregisters the rule
35762
+ * @returns {() => void } a function that deregisters the rule
36170
35763
  */
36171
35764
  rule(rule) {
36172
35765
  if (!UrlRuleFactory.isUrlRule(rule)) throw new Error("invalid rule");
@@ -36186,7 +35779,7 @@ class UrlRules {
36186
35779
  rules() {
36187
35780
  this.ensureSorted();
36188
35781
 
36189
- return this._rules.concat(this._otherwiseFn ? [this._otherwiseFn] : []);
35782
+ return this._rules;
36190
35783
  }
36191
35784
 
36192
35785
  /**
@@ -36330,7 +35923,7 @@ class UrlRules {
36330
35923
  * @return the registered [[UrlRule]]
36331
35924
  */
36332
35925
  when(matcher, handler, options) {
36333
- const rule = this.urlRuleFactory.create(matcher, handler);
35926
+ const rule = this._urlRuleFactory.create(matcher, handler);
36334
35927
 
36335
35928
  if (isDefined(options && options.priority))
36336
35929
  rule.priority = options.priority;
@@ -36380,31 +35973,32 @@ class UrlService {
36380
35973
 
36381
35974
  /**
36382
35975
  * @param {ng.LocationProvider} $locationProvider
36383
- * @param {import("../../router/state/state-service.js").StateProvider} stateService
35976
+ * @param {import("../../router/state/state-service.js").StateProvider} stateProvider
36384
35977
  * @param {import("../router.js").RouterProvider} globals
36385
35978
  * @param {import("../../router/url/url-config.js").UrlConfigProvider} urlConfigProvider
36386
35979
  */
36387
- constructor($locationProvider, stateService, globals, urlConfigProvider) {
35980
+ constructor($locationProvider, stateProvider, globals, urlConfigProvider) {
36388
35981
  /** @private */
36389
35982
  this._locationProvider = $locationProvider;
36390
- this.stateService = stateService;
35983
+ this.stateService = stateProvider;
36391
35984
 
36392
- /** Provides services related to the URL */
36393
- this.urlRuleFactory = new UrlRuleFactory(this, this.stateService, globals);
35985
+ /** @type {UrlRuleFactory} Provides services related to the URL */
35986
+ this._urlRuleFactory = new UrlRuleFactory(this, this.stateService, globals);
36394
35987
 
36395
35988
  /**
36396
35989
  * The nested [[UrlRules]] API for managing URL rules and rewrites
35990
+ * @ignore
36397
35991
  * @type {UrlRules}
36398
35992
  */
36399
- this.rules = new UrlRules(this.urlRuleFactory);
35993
+ this._rules = new UrlRules(this._urlRuleFactory);
36400
35994
  /**
36401
35995
  * The nested [[UrlConfig]] API to configure the URL and retrieve URL information
36402
35996
  * @type {import("./url-config.js").UrlConfigProvider}
36403
35997
  */
36404
- this.config = urlConfigProvider;
35998
+ this._config = urlConfigProvider;
36405
35999
 
36406
- /** Creates a new [[Param]] for a given location (DefType) */
36407
- this.paramFactory = new ParamFactory(this.config);
36000
+ /** @type {ParamFactory} Creates a new [[Param]] for a given location (DefType) */
36001
+ this._paramFactory = new ParamFactory(this._config);
36408
36002
 
36409
36003
  this._urlListeners = [];
36410
36004
  }
@@ -36666,7 +36260,7 @@ class UrlService {
36666
36260
  */
36667
36261
  match(url) {
36668
36262
  url = Object.assign({ path: "", search: {}, hash: "" }, url);
36669
- const rules = this.rules.rules();
36263
+ const rules = this._rules.rules();
36670
36264
 
36671
36265
  // Checks a single rule. Returns { rule: rule, match: match, weight: weight } if it matched, or undefined
36672
36266
  /**
@@ -36777,7 +36371,7 @@ class UrlService {
36777
36371
  * @returns The UrlMatcher.
36778
36372
  */
36779
36373
  compile(urlPattern, config) {
36780
- const urlConfig = this.config;
36374
+ const urlConfig = this._config;
36781
36375
 
36782
36376
  // backward-compatible support for config.params -> config.state.params
36783
36377
  const params = config && !config.state && config.params;
@@ -36791,7 +36385,7 @@ class UrlService {
36791
36385
  return new UrlMatcher(
36792
36386
  urlPattern,
36793
36387
  urlConfig.paramTypes,
36794
- this.paramFactory,
36388
+ this._paramFactory,
36795
36389
  Object.assign(globalConfig, config),
36796
36390
  );
36797
36391
  }
@@ -36828,8 +36422,10 @@ function appendBasePath(url, isHtml5, absolute, baseHref) {
36828
36422
  }
36829
36423
 
36830
36424
  class StateMatcher {
36831
- constructor(_states) {
36832
- this._states = _states;
36425
+ /** @param {import("./interface.ts").StateStore} states */
36426
+ constructor(states) {
36427
+ /** @type {import("./interface.ts").StateStore} */
36428
+ this._states = states;
36833
36429
  }
36834
36430
 
36835
36431
  isRelative(stateName) {
@@ -36854,12 +36450,10 @@ class StateMatcher {
36854
36450
  ) {
36855
36451
  return state;
36856
36452
  } else if (isStr && matchGlob) {
36857
- const _states = Object.values(this._states);
36453
+ const states = Object.values(this._states);
36858
36454
 
36859
- const matches = _states.filter(
36860
- (_state) =>
36861
- _state.__stateObjectCache.nameGlob &&
36862
- _state.__stateObjectCache.nameGlob.matches(name),
36455
+ const matches = states.filter((stateObj) =>
36456
+ stateObj._stateObjectCache.nameGlob?.matches(name),
36863
36457
  );
36864
36458
 
36865
36459
  if (matches.length > 1) {
@@ -37188,11 +36782,11 @@ function resolvablesBuilder(state) {
37188
36782
  class StateBuilder {
37189
36783
  /**
37190
36784
  * @param {import('./state-matcher.js').StateMatcher} matcher
37191
- * @param urlService
36785
+ * @param {ng.UrlService} urlService
37192
36786
  */
37193
36787
  constructor(matcher, urlService) {
37194
- this.matcher = matcher;
37195
- this.$injector = undefined;
36788
+ this._matcher = matcher;
36789
+ this._$injector = undefined;
37196
36790
  const self = this;
37197
36791
 
37198
36792
  const root = () => matcher.find("");
@@ -37202,7 +36796,7 @@ class StateBuilder {
37202
36796
 
37203
36797
  return matcher.find(self.parentName(state)) || root();
37204
36798
  }
37205
- this.builders = {
36799
+ this._builders = {
37206
36800
  name: [(state) => state.name],
37207
36801
  self: [selfBuilder],
37208
36802
  parent: [parentBuilder],
@@ -37212,7 +36806,7 @@ class StateBuilder {
37212
36806
  // Keep track of the closest ancestor state that has a URL (i.e. is navigable)
37213
36807
  navigable: [getNavigableBuilder(isRoot)],
37214
36808
  // TODO
37215
- params: [getParamsBuilder(urlService.paramFactory)],
36809
+ params: [getParamsBuilder(urlService._paramFactory)],
37216
36810
  // Each framework-specific ng-router implementation should define its own `views` builder
37217
36811
  // e.g., src/ng1/statebuilders/views.ts
37218
36812
  views: [],
@@ -37225,7 +36819,7 @@ class StateBuilder {
37225
36819
  }
37226
36820
 
37227
36821
  builder(name, fn) {
37228
- const { builders } = this;
36822
+ const { _builders: builders } = this;
37229
36823
 
37230
36824
  const array = builders[name] || [];
37231
36825
 
@@ -37248,7 +36842,7 @@ class StateBuilder {
37248
36842
  * @returns the built State object
37249
36843
  */
37250
36844
  build(state) {
37251
- const { matcher, builders } = this;
36845
+ const { _matcher: matcher, _builders: builders } = this;
37252
36846
 
37253
36847
  const parent = this.parentName(state);
37254
36848
 
@@ -37324,13 +36918,14 @@ function getToken(provider) {
37324
36918
  class StateQueueManager {
37325
36919
  /**
37326
36920
  * @param {import("./state-registry.js").StateRegistryProvider} stateRegistry
37327
- * @param {*} urlServiceRules
37328
- * @param {Record<string, ng.StateObject>} states
36921
+ * @param {import("../url/url-rules.js").UrlRules} urlServiceRules
36922
+ * @param {import("./interface.ts").StateStore} states
37329
36923
  * @param {*} builder
37330
36924
  * @param {*} listeners
37331
36925
  */
37332
36926
  constructor(stateRegistry, urlServiceRules, states, builder, listeners) {
37333
36927
  this.stateRegistry = stateRegistry;
36928
+ /** @type {import("../url/url-rules.js").UrlRules} */
37334
36929
  this.urlServiceRules = urlServiceRules;
37335
36930
  this.states = states;
37336
36931
  this.builder = builder;
@@ -37426,11 +37021,16 @@ class StateQueueManager {
37426
37021
  return states;
37427
37022
  }
37428
37023
 
37024
+ /**
37025
+ *
37026
+ * @param {ng.StateDeclaration} state
37027
+ * @returns {() => void} a function that deregisters the rule
37028
+ */
37429
37029
  attachRoute(state) {
37430
37030
  if (state.abstract || !state.url) return;
37431
37031
  const rulesApi = this.urlServiceRules;
37432
37032
 
37433
- rulesApi.rule(rulesApi.urlRuleFactory.create(state));
37033
+ rulesApi.rule(rulesApi._urlRuleFactory.create(state));
37434
37034
  }
37435
37035
  }
37436
37036
 
@@ -37456,12 +37056,12 @@ class StateRegistryProvider {
37456
37056
  * @param {ng.ViewService} viewService
37457
37057
  */
37458
37058
  constructor(urlService, stateService, globals, viewService) {
37459
- /** @type {Record<string, import("./state-object.js").StateObject>} */
37059
+ /** @type {import("./interface.ts").StateStore} */
37460
37060
  this.states = {};
37461
37061
 
37462
37062
  stateService.stateRegistry = this; // <- circular wiring
37463
37063
  this.urlService = urlService;
37464
- this.urlServiceRules = urlService.rules;
37064
+ this.urlServiceRules = urlService._rules;
37465
37065
  this.$injector = undefined;
37466
37066
  this.listeners = [];
37467
37067
  this.matcher = new StateMatcher(this.states);
@@ -37496,7 +37096,7 @@ class StateRegistryProvider {
37496
37096
  */
37497
37097
  ($injector) => {
37498
37098
  this.$injector = $injector;
37499
- this.builder.$injector = $injector;
37099
+ this.builder._$injector = $injector;
37500
37100
 
37501
37101
  return this;
37502
37102
  },
@@ -37622,7 +37222,7 @@ class StateRegistryProvider {
37622
37222
  }
37623
37223
 
37624
37224
  _deregisterTree(state) {
37625
- const all = this.get().map((x) => x.$$state());
37225
+ const all = this.getAll().map((x) => x.$$state());
37626
37226
 
37627
37227
  const getChildren = (states) => {
37628
37228
  const _children = all.filter((x) => states.indexOf(x.parent) !== -1);
@@ -37661,11 +37261,18 @@ class StateRegistryProvider {
37661
37261
  * @returns {import('./state-object').StateObject[]} a list of removed states
37662
37262
  */
37663
37263
  deregister(stateOrName) {
37664
- const _state = this.get(stateOrName);
37264
+ const state =
37265
+ /** @type {import("./interface.ts").BuiltStateDeclaration} */ (
37266
+ this.get(stateOrName)
37267
+ );
37665
37268
 
37666
- if (!_state)
37269
+ if (!state)
37667
37270
  throw new Error(`Can't deregister state; not found: ${stateOrName}`);
37668
- const deregisteredStates = this._deregisterTree(_state.$$state());
37271
+ const deregisteredStates = this._deregisterTree(
37272
+ /** @type {import("./interface.ts").BuiltStateDeclaration} */ (
37273
+ state
37274
+ ).$$state(),
37275
+ );
37669
37276
 
37670
37277
  this.listeners.forEach((listener) =>
37671
37278
  listener(
@@ -38752,20 +38359,26 @@ ngChannelDirective.$inject = [$injectTokens._eventBus];
38752
38359
  */
38753
38360
  function ngChannelDirective($eventBus) {
38754
38361
  return {
38362
+ scope: false,
38755
38363
  link: (scope, element, attrs) => {
38756
38364
  const channel = attrs.ngChannel;
38757
38365
 
38758
38366
  const hasTemplateContent = element.childNodes.length > 0;
38759
38367
 
38760
- const unsubscribe = $eventBus.subscribe(channel, (value) => {
38761
- if (hasTemplateContent) {
38762
- if (isObject(value)) {
38763
- scope.$merge(value);
38368
+ const unsubscribe = $eventBus.subscribe(
38369
+ channel,
38370
+ (/** @type {string | Object} */ value) => {
38371
+ if (hasTemplateContent) {
38372
+ if (isObject(value)) {
38373
+ scope.$merge(value);
38374
+ }
38375
+ } else if (isString(value)) {
38376
+ element.innerHTML = value;
38377
+ } else {
38378
+ element.innerHTML = value.toString();
38764
38379
  }
38765
- } else {
38766
- element.innerHTML = value;
38767
- }
38768
- });
38380
+ },
38381
+ );
38769
38382
 
38770
38383
  scope.$on("$destroy", () => unsubscribe());
38771
38384
  },
@@ -38777,7 +38390,7 @@ ngSetterDirective.$inject = [$injectTokens._parse, $injectTokens._log];
38777
38390
  /**
38778
38391
  * @param {ng.ParseService} $parse
38779
38392
  * @param {ng.LogService} $log
38780
- * @returns {import('interface.ts').Directive}
38393
+ * @returns {ng.Directive}
38781
38394
  */
38782
38395
  function ngSetterDirective($parse, $log) {
38783
38396
  return {
@@ -38799,7 +38412,7 @@ function ngSetterDirective($parse, $log) {
38799
38412
  return;
38800
38413
  }
38801
38414
 
38802
- const updateModel = (value) => {
38415
+ const updateModel = (/** @type {string} */ value) => {
38803
38416
  assignModel(scope, value.trim());
38804
38417
  };
38805
38418
 
@@ -38937,7 +38550,7 @@ class PubSub {
38937
38550
 
38938
38551
  let called = false;
38939
38552
 
38940
- const wrapper = (...args) => {
38553
+ const wrapper = (/** @type {any[]} */ ...args) => {
38941
38554
  if (called) return;
38942
38555
  called = true;
38943
38556
 
@@ -39084,28 +38697,206 @@ function ngElDirective() {
39084
38697
  }
39085
38698
 
39086
38699
  /**
39087
- * SSE Provider
39088
- *
39089
- * Usage:
39090
- * const source = $sse('/events', {
39091
- * onMessage: (data) => console.log(data),
39092
- * onError: (err) => console.error(err),
39093
- * retryDelay: 2000,
39094
- * heartbeatTimeout: 10000,
39095
- * });
39096
- *
39097
- * source.close();
38700
+ * Shared Stream Connection Manager
38701
+ * Handles reconnect, heartbeat, and event callbacks for SSE or WebSocket
39098
38702
  */
38703
+ class StreamConnection {
38704
+ /**
38705
+ * @param {() => EventSource | WebSocket} createFn - Function that creates a new EventSource or WebSocket.
38706
+ * @param {ng.StreamConnectionConfig} config - Configuration object with callbacks, retries, heartbeat, transformMessage.
38707
+ * @param {ng.LogService} log - Optional logger (default: console).
38708
+ */
38709
+ constructor(createFn, config = {}, log = console) {
38710
+ /** @private @type {() => EventSource | WebSocket} */
38711
+ this._createFn = createFn;
38712
+ this._config = {
38713
+ retryDelay: 1000,
38714
+ maxRetries: Infinity,
38715
+ heartbeatTimeout: 15000,
38716
+ transformMessage: (/** @type {string} */ data) => {
38717
+ try {
38718
+ return JSON.parse(data);
38719
+ } catch {
38720
+ return data;
38721
+ }
38722
+ },
38723
+ ...config,
38724
+ };
38725
+ this._log = log;
38726
+ this._retryCount = 0;
38727
+ this._closed = false;
38728
+ this._heartbeatTimer = undefined;
38729
+ /** @type {EventSource | WebSocket | null} */
38730
+ this._connection = null;
38731
+
38732
+ this.connect();
38733
+ }
38734
+
38735
+ /**
38736
+ * Establishes a new connection using the provided createFn.
38737
+ * Closes any existing connection before creating a new one.
38738
+ */
38739
+ connect() {
38740
+ if (this._closed) return;
38741
+
38742
+ // Close the old connection if it exists
38743
+ if (this._connection && typeof this._connection.close === "function") {
38744
+ this._connection.close();
38745
+ }
38746
+
38747
+ // Create new connection
38748
+ this._connection = this._createFn();
38749
+
38750
+ // Bind events for the new connection
38751
+ this._bindEvents();
38752
+ }
38753
+
38754
+ /**
38755
+ * Sends data over a WebSocket connection.
38756
+ * Logs a warning if called on a non-WebSocket connection.
38757
+ * @param {any} data - Data to send.
38758
+ */
38759
+ send(data) {
38760
+ if (this._connection instanceof WebSocket) {
38761
+ this._connection.send(JSON.stringify(data));
38762
+ } else {
38763
+ this._log.warn("Send is only supported on WebSocket connections");
38764
+ }
38765
+ }
38766
+
38767
+ /**
38768
+ * Closes the connection manually and clears the heartbeat timer.
38769
+ */
38770
+ close() {
38771
+ this._closed = true;
38772
+ clearTimeout(this._heartbeatTimer);
38773
+
38774
+ if (this._connection && this._connection.close) {
38775
+ this._connection.close();
38776
+ }
38777
+ }
38778
+
38779
+ /**
38780
+ * @private
38781
+ * Binds event handlers to the underlying connection (EventSource or WebSocket)
38782
+ * for open, message, error, and close events.
38783
+ */
38784
+ _bindEvents() {
38785
+ const conn = this._connection;
38786
+
38787
+ if (conn instanceof EventSource) {
38788
+ conn.addEventListener("open", (err) => this._handleOpen(err));
38789
+ conn.addEventListener("message", (err) =>
38790
+ this._handleMessage(err.data, err),
38791
+ );
38792
+ conn.addEventListener("error", (err) => this._handleError(err));
38793
+ } else if (conn instanceof WebSocket) {
38794
+ conn.onopen = (err) => this._handleOpen(err);
38795
+ conn.onmessage = (err) => this._handleMessage(err.data, err);
38796
+ conn.onerror = (err) => this._handleError(err);
38797
+ conn.onclose = () => this._handleClose();
38798
+ }
38799
+ }
38800
+
38801
+ /**
38802
+ * @private
38803
+ * Handles the open event from the connection.
38804
+ * @param {Event} event - The open event.
38805
+ */
38806
+ _handleOpen(event) {
38807
+ this._retryCount = 0;
38808
+ this._config.onOpen?.(event);
38809
+ this._resetHeartbeat();
38810
+ }
38811
+
38812
+ /**
38813
+ * @private
38814
+ * Handles incoming messages, applies the transformMessage function,
38815
+ * and calls the onMessage callback.
38816
+ * @param {any} data - Raw message data.
38817
+ * @param {Event} event - The message event.
38818
+ */
38819
+ _handleMessage(data, event) {
38820
+ try {
38821
+ data = this._config.transformMessage?.(data) ?? data;
38822
+ } catch {
38823
+ /* empty */
38824
+ }
38825
+ this._config.onMessage?.(data, event);
38826
+ this._resetHeartbeat();
38827
+ }
38828
+
38829
+ /**
38830
+ * @private
38831
+ * Handles errors emitted from the connection.
38832
+ * Calls onError callback and schedules a reconnect.
38833
+ * @param {any} err - Error object or message.
38834
+ */
38835
+ _handleError(err) {
38836
+ this._config.onError?.(err);
38837
+ this._scheduleReconnect();
38838
+ }
38839
+
38840
+ /**
38841
+ * @private
38842
+ * Handles close events for WebSocket connections.
38843
+ * Triggers reconnect logic.
38844
+ */
38845
+ _handleClose() {
38846
+ this._scheduleReconnect();
38847
+ }
38848
+
38849
+ /**
38850
+ * @private
38851
+ * Schedules a reconnect attempt based on retryCount and config.maxRetries.
38852
+ * Calls onReconnect callback if reconnecting.
38853
+ */
38854
+ _scheduleReconnect() {
38855
+ if (this._closed) return;
38856
+
38857
+ if (this._retryCount < this._config.maxRetries) {
38858
+ this._retryCount++;
38859
+ this._config.onReconnect?.(this._retryCount);
38860
+ setTimeout(() => this.connect(), this._config.retryDelay);
38861
+ } else {
38862
+ this._log.warn("StreamConnection: Max retries reached");
38863
+ }
38864
+ }
38865
+
38866
+ /**
38867
+ * @private
38868
+ * Resets the heartbeat timer. If the timer expires, the connection is closed
38869
+ * and a reconnect is attempted.
38870
+ */
38871
+ _resetHeartbeat() {
38872
+ if (!this._config.heartbeatTimeout) return;
38873
+
38874
+ clearTimeout(this._heartbeatTimer);
38875
+ this._heartbeatTimer = setTimeout(() => {
38876
+ this._log.warn("StreamConnection: heartbeat timeout, reconnecting...");
38877
+ this._closeInternal();
38878
+ this._retryCount++;
38879
+ this._config.onReconnect?.(this._retryCount);
38880
+ this.connect();
38881
+ }, this._config.heartbeatTimeout);
38882
+ }
38883
+
38884
+ /**
38885
+ * @private
38886
+ */
38887
+ _closeInternal() {
38888
+ clearTimeout(this._heartbeatTimer);
38889
+ this._connection?.close();
38890
+ }
38891
+ }
38892
+
39099
38893
  class SseProvider {
39100
38894
  constructor() {
39101
- /**
39102
- * Optional provider-level defaults
39103
- * @type {ng.SseConfig}
39104
- */
38895
+ /** @type {ng.SseConfig} */
39105
38896
  this.defaults = {
39106
38897
  retryDelay: 1000,
39107
38898
  maxRetries: Infinity,
39108
- heartbeatTimeout: 15000, // 15 seconds
38899
+ heartbeatTimeout: 15000,
39109
38900
  transformMessage(data) {
39110
38901
  try {
39111
38902
  return JSON.parse(data);
@@ -39118,20 +38909,32 @@ class SseProvider {
39118
38909
 
39119
38910
  $get = [
39120
38911
  $injectTokens._log,
39121
- /**
39122
- * Returns the $sse service function
39123
- * @param {ng.LogService} log
39124
- * @returns {ng.SseService}
39125
- */
39126
- (log) => {
38912
+ /** @param {ng.LogService} log */ (log) => {
39127
38913
  this._$log = log;
39128
38914
 
38915
+ /** @type {ng.SseService} */
39129
38916
  return (url, config = {}) => {
39130
38917
  const mergedConfig = { ...this.defaults, ...config };
39131
38918
 
39132
38919
  const finalUrl = this.#buildUrl(url, mergedConfig.params);
39133
38920
 
39134
- return this.#createConnection(finalUrl, mergedConfig);
38921
+ return new StreamConnection(
38922
+ () =>
38923
+ new EventSource(finalUrl, {
38924
+ withCredentials: !!mergedConfig.withCredentials,
38925
+ }),
38926
+ {
38927
+ ...mergedConfig,
38928
+ onMessage: (data, event) => {
38929
+ // Cast Event -> MessageEvent safely
38930
+ mergedConfig.onMessage?.(
38931
+ data,
38932
+ /** @type{MessageEvent} */ (event),
38933
+ );
38934
+ },
38935
+ },
38936
+ this._$log,
38937
+ );
39135
38938
  };
39136
38939
  },
39137
38940
  ];
@@ -39141,6 +38944,7 @@ class SseProvider {
39141
38944
  * @param {string} url
39142
38945
  * @param {Record<string, any>=} params
39143
38946
  * @returns {string}
38947
+ * @throws {URIError}
39144
38948
  */
39145
38949
  #buildUrl(url, params) {
39146
38950
  if (!params) return url;
@@ -39150,91 +38954,6 @@ class SseProvider {
39150
38954
 
39151
38955
  return url + (url.includes("?") ? "&" : "?") + query;
39152
38956
  }
39153
-
39154
- /**
39155
- * Creates a managed SSE connection with reconnect and heartbeat
39156
- * @param {string} url
39157
- * @param {ng.SseConfig} config
39158
- * @returns {import("./interface.ts").SseConnection}
39159
- */
39160
- #createConnection(url, config) {
39161
- let es;
39162
-
39163
- let retryCount = 0;
39164
-
39165
- let closed = false;
39166
-
39167
- let heartbeatTimer;
39168
-
39169
- const connect = () => {
39170
- if (closed) return;
39171
-
39172
- es = new EventSource(url, {
39173
- withCredentials: !!config.withCredentials,
39174
- });
39175
-
39176
- es.addEventListener("open", (event) => {
39177
- retryCount = 0;
39178
- config.onOpen?.(event);
39179
-
39180
- if (config.heartbeatTimeout) resetHeartbeat();
39181
- });
39182
-
39183
- es.addEventListener("message", (event) => {
39184
- let { data } = event;
39185
-
39186
- try {
39187
- data = config.transformMessage ? config.transformMessage(data) : data;
39188
- } catch {
39189
- /* empty */
39190
- }
39191
- config.onMessage?.(data, event);
39192
-
39193
- if (config.heartbeatTimeout) resetHeartbeat();
39194
- });
39195
-
39196
- es.addEventListener("error", (err) => {
39197
- config.onError?.(err);
39198
-
39199
- if (closed) return;
39200
- es.close();
39201
-
39202
- if (retryCount < config.maxRetries) {
39203
- retryCount++;
39204
- config.onReconnect?.(retryCount);
39205
- setTimeout(connect, config.retryDelay);
39206
- } else {
39207
- this._$log.warn("SSE: Max retries reached");
39208
- }
39209
- });
39210
- };
39211
-
39212
- const resetHeartbeat = () => {
39213
- clearTimeout(heartbeatTimer);
39214
- heartbeatTimer = setTimeout(() => {
39215
- this._$log.warn("SSE: heartbeat timeout, reconnecting...");
39216
- es.close();
39217
- config.onReconnect?.(++retryCount);
39218
- connect();
39219
- }, config.heartbeatTimeout);
39220
- };
39221
-
39222
- connect();
39223
-
39224
- return {
39225
- close() {
39226
- closed = true;
39227
- clearTimeout(heartbeatTimer);
39228
- es.close();
39229
- },
39230
- connect() {
39231
- if (closed === false) {
39232
- close();
39233
- }
39234
- connect();
39235
- },
39236
- };
39237
- }
39238
38957
  }
39239
38958
 
39240
38959
  /**
@@ -39329,11 +39048,7 @@ class CookieProvider {
39329
39048
  this.defaults = {};
39330
39049
  }
39331
39050
 
39332
- $get = [
39333
- $injectTokens._exceptionHandler,
39334
- /** @param {ng.ExceptionHandlerService} $exceptionHandler */
39335
- ($exceptionHandler) => new CookieService(this.defaults, $exceptionHandler),
39336
- ];
39051
+ $get = () => new CookieService(this.defaults);
39337
39052
  }
39338
39053
 
39339
39054
  /**
@@ -39347,14 +39062,10 @@ class CookieService {
39347
39062
  /**
39348
39063
  * @param {ng.CookieOptions} defaults
39349
39064
  * Default cookie attributes defined by `$cookiesProvider.defaults`.
39350
- * @param {ng.ExceptionHandlerService} $exceptionHandler
39351
39065
  */
39352
- constructor(defaults, $exceptionHandler) {
39066
+ constructor(defaults) {
39353
39067
  /** @private @type {ng.CookieOptions} */
39354
39068
  this._defaults = Object.freeze({ ...defaults });
39355
-
39356
- /** @private @type {ng.ExceptionHandlerService} */
39357
- this._$exceptionHandler = $exceptionHandler;
39358
39069
  }
39359
39070
 
39360
39071
  /**
@@ -39366,14 +39077,9 @@ class CookieService {
39366
39077
  */
39367
39078
  get(key) {
39368
39079
  validateIsString(key, "key");
39080
+ const all = parseCookies();
39369
39081
 
39370
- try {
39371
- const all = parseCookies();
39372
-
39373
- return all[key] || null;
39374
- } catch (err) {
39375
- throw this._$exceptionHandler(err);
39376
- }
39082
+ return all[key] || null;
39377
39083
  }
39378
39084
 
39379
39085
  /**
@@ -39391,13 +39097,7 @@ class CookieService {
39391
39097
 
39392
39098
  if (!raw) return null;
39393
39099
 
39394
- try {
39395
- return /** @type {T} */ (JSON.parse(raw));
39396
- } catch (err) {
39397
- this._$exceptionHandler(err);
39398
-
39399
- return null;
39400
- }
39100
+ return /** @type {T} */ (JSON.parse(raw));
39401
39101
  }
39402
39102
 
39403
39103
  /**
@@ -39407,11 +39107,7 @@ class CookieService {
39407
39107
  * @throws {URIError} – If decodeURIComponent fails
39408
39108
  */
39409
39109
  getAll() {
39410
- try {
39411
- return parseCookies();
39412
- } catch (err) {
39413
- return this._$exceptionHandler(err);
39414
- }
39110
+ return parseCookies();
39415
39111
  }
39416
39112
 
39417
39113
  /**
@@ -39420,6 +39116,7 @@ class CookieService {
39420
39116
  * @param {string} key
39421
39117
  * @param {string} value
39422
39118
  * @param {ng.CookieOptions} [options]
39119
+ * @throws {URIError} if key or value cannot be encoded
39423
39120
  */
39424
39121
  put(key, value, options = {}) {
39425
39122
  validateIsString(key, "key");
@@ -39428,14 +39125,10 @@ class CookieService {
39428
39125
 
39429
39126
  const encodedVal = encodeURIComponent(value);
39430
39127
 
39431
- try {
39432
- document.cookie = `${encodedKey}=${encodedVal}${buildOptions({
39433
- ...this._defaults,
39434
- ...options,
39435
- })}`;
39436
- } catch (err) {
39437
- this._$exceptionHandler(err);
39438
- }
39128
+ document.cookie = `${encodedKey}=${encodedVal}${buildOptions({
39129
+ ...this._defaults,
39130
+ ...options,
39131
+ })}`;
39439
39132
  }
39440
39133
 
39441
39134
  /**
@@ -39449,19 +39142,9 @@ class CookieService {
39449
39142
  putObject(key, value, options) {
39450
39143
  validateIsString(key, "key");
39451
39144
  validateRequired(value, "value");
39452
- assert(!isNullOrUndefined(value), BADARGVALUE);
39453
-
39454
- try {
39455
- const str = JSON.stringify(value);
39145
+ const str = JSON.stringify(value);
39456
39146
 
39457
- this.put(key, str, options);
39458
- } catch (err) {
39459
- this._$exceptionHandler(
39460
- new TypeError(
39461
- `badserialize: "${key}" => ${/** @type {Error} */ (err).message}`,
39462
- ),
39463
- );
39464
- }
39147
+ this.put(key, str, options);
39465
39148
  }
39466
39149
 
39467
39150
  /**
@@ -40110,6 +39793,37 @@ class RestProvider {
40110
39793
  ];
40111
39794
  }
40112
39795
 
39796
+ /**
39797
+ * @returns {ng.Directive}
39798
+ */
39799
+ function ngListenerDirective() {
39800
+ return {
39801
+ scope: false,
39802
+ link: (scope, element, attrs) => {
39803
+ const channel = attrs.ngListener || element.id;
39804
+
39805
+ const hasTemplateContent = element.childNodes.length;
39806
+
39807
+ /** @type {EventListener} */
39808
+ const fn = (event) => {
39809
+ const value = /** @type {CustomEvent} */ (event).detail;
39810
+
39811
+ if (hasTemplateContent) {
39812
+ if (isObject(value)) {
39813
+ scope.$merge(value);
39814
+ }
39815
+ } else if (isString(value)) {
39816
+ element.innerHTML = value;
39817
+ }
39818
+ };
39819
+
39820
+ element.addEventListener(channel, fn);
39821
+
39822
+ scope.$on("$destroy", () => element.removeEventListener(channel, fn));
39823
+ },
39824
+ };
39825
+ }
39826
+
40113
39827
  /**
40114
39828
  * Initializes core `ng` module.
40115
39829
  * @param {ng.Angular} angular
@@ -40159,6 +39873,7 @@ function registerNgModule(angular) {
40159
39873
  ngInclude: ngIncludeDirective,
40160
39874
  ngInject: ngInjectDirective,
40161
39875
  ngInit: ngInitDirective,
39876
+ ngListener: ngListenerDirective,
40162
39877
  ngMessages: ngMessagesDirective,
40163
39878
  ngMessage: ngMessageDirective,
40164
39879
  ngMessageExp: ngMessageExpDirective,
@@ -40195,7 +39910,7 @@ function registerNgModule(angular) {
40195
39910
  ngScope: ngScopeDirective,
40196
39911
  })
40197
39912
  .directive({
40198
- input: hiddenInputBrowserCacheDirective,
39913
+ input: hiddenInputDirective,
40199
39914
  ngAnimateSwap: ngAnimateSwapDirective,
40200
39915
  ngAnimateChildren: $$AnimateChildrenDirective,
40201
39916
  // aria directives
@@ -40287,8 +40002,13 @@ const STRICT_DI = "strict-di";
40287
40002
  /** @type {ModuleRegistry} */
40288
40003
  const moduleRegistry = {};
40289
40004
 
40290
- class Angular {
40291
- constructor() {
40005
+ class Angular extends EventTarget {
40006
+ constructor(submodule = false) {
40007
+ super();
40008
+
40009
+ /** @private @type {boolean} */
40010
+ this._submodule = submodule;
40011
+
40292
40012
  /** @private @type {!Array<string|any>} */
40293
40013
  this._bootsrappedModules = [];
40294
40014
 
@@ -40302,7 +40022,7 @@ class Angular {
40302
40022
  * @public
40303
40023
  * @type {string} `version` from `package.json`
40304
40024
  */
40305
- this.version = "0.15.0"; //inserted via rollup plugin
40025
+ this.version = "0.15.2"; //inserted via rollup plugin
40306
40026
 
40307
40027
  /**
40308
40028
  * Gets the controller instance for a given element, if exists. Defaults to "ngControllerController"
@@ -40332,7 +40052,9 @@ class Angular {
40332
40052
  /** @type {any} */ (this.$t)[i] = i;
40333
40053
  });
40334
40054
 
40335
- window.angular = this;
40055
+ if (!submodule) {
40056
+ window.angular = this;
40057
+ }
40336
40058
  registerNgModule(this);
40337
40059
  }
40338
40060