@h3ravel/support 0.15.6 → 0.16.0

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.
package/dist/index.cjs CHANGED
@@ -5,21 +5,30 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (all) => {
8
+ var __export = (all, symbols) => {
9
9
  let target = {};
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
10
+ for (var name in all) {
11
+ __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ }
16
+ if (symbols) {
17
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
18
+ }
14
19
  return target;
15
20
  };
16
21
  var __copyProps = (to, from, except, desc) => {
17
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
18
- key = keys[i];
19
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
20
- get: ((k) => from[k]).bind(null, key),
21
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
22
- });
22
+ if (from && typeof from === "object" || typeof from === "function") {
23
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
24
+ key = keys[i];
25
+ if (!__hasOwnProp.call(to, key) && key !== except) {
26
+ __defProp(to, key, {
27
+ get: ((k) => from[k]).bind(null, key),
28
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
29
+ });
30
+ }
31
+ }
23
32
  }
24
33
  return to;
25
34
  };
@@ -29,7 +38,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
38
  }) : target, mod));
30
39
 
31
40
  //#endregion
32
- let crypto = require("crypto");
41
+ const require_RuntimeException = require('./RuntimeException-CmsL83ow.cjs');
42
+ let __h3ravel_collect_js = require("@h3ravel/collect.js");
43
+ let crypto$1 = require("crypto");
33
44
  let process = require("process");
34
45
  process = __toESM(process);
35
46
  let util = require("util");
@@ -52,27 +63,48 @@ let dayjs_plugin_timezone_js = require("dayjs/plugin/timezone.js");
52
63
  dayjs_plugin_timezone_js = __toESM(dayjs_plugin_timezone_js);
53
64
  let dayjs_plugin_utc_js = require("dayjs/plugin/utc.js");
54
65
  dayjs_plugin_utc_js = __toESM(dayjs_plugin_utc_js);
66
+ let node_net = require("node:net");
67
+ let __h3ravel_shared = require("@h3ravel/shared");
68
+ let node_fs_promises = require("node:fs/promises");
69
+ let __h3ravel_contracts = require("@h3ravel/contracts");
70
+ let node_path = require("node:path");
71
+ let node_fs = require("node:fs");
55
72
 
56
- //#region src/Exceptions/InvalidArgumentException.ts
73
+ //#region src/Collection.ts
74
+ var Collection = class extends __h3ravel_collect_js.Collection {
75
+ /**
76
+ *
77
+ * @param collection
78
+ */
79
+ constructor(collection) {
80
+ super(collection);
81
+ }
82
+ };
57
83
  /**
58
- * Custom error for invalid type coercion
84
+ *
85
+ * @param collection
86
+ * @returns
59
87
  */
60
- var InvalidArgumentException = class extends Error {
61
- constructor(message) {
62
- super(message);
63
- this.name = "InvalidArgumentException";
64
- }
88
+ const collect = (collection) => {
89
+ return new Collection(collection);
65
90
  };
66
91
 
67
92
  //#endregion
68
- //#region src/Exceptions/RuntimeException.ts
93
+ //#region src/Exceptions/BadMethodCallException.ts
94
+ /**
95
+ * Exception thrown if an error with a method call occurs.
96
+ */
97
+ var BadMethodCallException = class extends Error {};
98
+
99
+ //#endregion
100
+ //#region src/Exceptions/InvalidArgumentException.ts
69
101
  /**
70
102
  * Custom error for invalid type coercion
71
103
  */
72
- var RuntimeException = class extends Error {
104
+ var InvalidArgumentException = class extends Error {
73
105
  constructor(message) {
74
106
  super(message);
75
- this.name = "RuntimeException";
107
+ this.name = "InvalidArgumentException";
76
108
  }
77
109
  };
78
110
 
@@ -100,7 +132,7 @@ var Crypto_exports = /* @__PURE__ */ __export({
100
132
  * @returns A random UUID string
101
133
  */
102
134
  const uuid = () => {
103
- return (0, crypto.randomUUID)();
135
+ return (0, crypto$1.randomUUID)();
104
136
  };
105
137
  /**
106
138
  * Generate a random string of specified length.
@@ -121,7 +153,7 @@ const random = (length = 16, charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMN
121
153
  * @returns A cryptographically secure random string
122
154
  */
123
155
  const randomSecure = (length = 32) => {
124
- return (0, crypto.randomBytes)(Math.ceil(length / 2)).toString("hex").slice(0, length);
156
+ return (0, crypto$1.randomBytes)(Math.ceil(length / 2)).toString("hex").slice(0, length);
125
157
  };
126
158
  /**
127
159
  * Hash a string using the specified algorithm.
@@ -131,7 +163,7 @@ const randomSecure = (length = 32) => {
131
163
  * @returns Hexadecimal hash string
132
164
  */
133
165
  const hash = (data, algorithm = "sha256") => {
134
- return (0, crypto.createHash)(algorithm).update(data).digest("hex");
166
+ return (0, crypto$1.createHash)(algorithm).update(data).digest("hex");
135
167
  };
136
168
  /**
137
169
  * Hash a string with salt using HMAC.
@@ -142,7 +174,7 @@ const hash = (data, algorithm = "sha256") => {
142
174
  * @returns Hexadecimal hash string
143
175
  */
144
176
  const hmac = (data, key, algorithm = "sha256") => {
145
- return (0, crypto.createHmac)(algorithm, key).update(data).digest("hex");
177
+ return (0, crypto$1.createHmac)(algorithm, key).update(data).digest("hex");
146
178
  };
147
179
  /**
148
180
  * Encode data to base64.
@@ -210,7 +242,7 @@ const randomPassword = (length = 16, options = {}) => {
210
242
  * @returns A secure token string
211
243
  */
212
244
  const secureToken = (strength = 32) => {
213
- return (0, crypto.randomBytes)(strength).toString("hex");
245
+ return (0, crypto$1.randomBytes)(strength).toString("hex");
214
246
  };
215
247
  /**
216
248
  * Create a checksum for data integrity verification.
@@ -465,7 +497,7 @@ const toHumanTime = (seconds = 0, worded = false) => {
465
497
  * with dot-separated keys.
466
498
  *
467
499
  * Example:
468
- * doter({
500
+ * dot({
469
501
  * user: { name: "John", address: { city: "NY" } },
470
502
  * active: true
471
503
  * })
@@ -608,6 +640,9 @@ const slugifyKeys = (obj, only = [], separator = "_") => {
608
640
  * - Arrays: included if truthy
609
641
  * - Objects: keys included if value is truthy
610
642
  * - Strings: included as-is
643
+ *
644
+ * @param input
645
+ * @returns
611
646
  */
612
647
  function toCssClasses(input) {
613
648
  if (!input) return "";
@@ -626,6 +661,9 @@ function toCssClasses(input) {
626
661
  *
627
662
  * Convert object input into CSS style string.
628
663
  * - Only includes truthy values (ignores null/undefined/false)
664
+ *
665
+ * @param styles
666
+ * @returns
629
667
  */
630
668
  function toCssStyles(styles) {
631
669
  const parts = [];
@@ -642,6 +680,9 @@ function toCssStyles(styles) {
642
680
  *
643
681
  * Example:
644
682
  * undot({ 'a.b': 1, 'c.0': 2 }) -> { a: { b: 1 }, c: [2] }
683
+ *
684
+ * @param obj
685
+ * @returns
645
686
  */
646
687
  function undot(obj) {
647
688
  const result = {};
@@ -666,6 +707,11 @@ function undot(obj) {
666
707
  * data_get
667
708
  *
668
709
  * Get a value from an object using dot notation.
710
+ *
711
+ * @param obj
712
+ * @param path
713
+ * @param defaultValue
714
+ * @returns
669
715
  */
670
716
  function data_get(obj, path, defaultValue) {
671
717
  if (!obj) return defaultValue;
@@ -681,6 +727,10 @@ function data_get(obj, path, defaultValue) {
681
727
  * data_set
682
728
  *
683
729
  * Set a value in an object using dot notation. Mutates the object.
730
+ *
731
+ * @param obj
732
+ * @param path
733
+ * @param value
684
734
  */
685
735
  function data_set(obj, path, value) {
686
736
  const parts = Array.isArray(path) ? path : path.split(".");
@@ -698,6 +748,10 @@ function data_set(obj, path, value) {
698
748
  * data_fill
699
749
  *
700
750
  * Like data_set, but only sets the value if the key does NOT exist.
751
+ *
752
+ * @param obj
753
+ * @param path
754
+ * @param value
701
755
  */
702
756
  function data_fill(obj, path, value) {
703
757
  if (data_get(obj, path) === void 0) data_set(obj, path, value);
@@ -706,6 +760,9 @@ function data_fill(obj, path, value) {
706
760
  * data_forget
707
761
  *
708
762
  * Remove a key from an object using dot notation.
763
+ *
764
+ * @param obj
765
+ * @param path
709
766
  */
710
767
  function data_forget(obj, path) {
711
768
  const parts = Array.isArray(path) ? path : path.split(".");
@@ -723,14 +780,18 @@ function data_forget(obj, path) {
723
780
  * Checks if a value is a plain object (not array, function, etc.)
724
781
  *
725
782
  * @param value
783
+ * @param allowArray
726
784
  * @returns
727
785
  */
728
- function isPlainObject(value) {
729
- return value !== null && typeof value === "object" && !Array.isArray(value) && Object.prototype.toString.call(value) === "[object Object]";
786
+ function isPlainObject(value, allowArray) {
787
+ return value !== null && typeof value === "object" && (Array.isArray(value) === false || allowArray === true) && Object.prototype.toString.call(value) === "[object Object]";
730
788
  }
731
789
  var Obj = class Obj {
732
790
  /**
733
791
  * Check if the value is a non-null object (associative/accessible).
792
+ *
793
+ * @param value
794
+ * @returns
734
795
  */
735
796
  static accessible(value) {
736
797
  return value !== null && typeof value === "object";
@@ -739,6 +800,11 @@ var Obj = class Obj {
739
800
  * Add a key-value pair to an object only if the key does not already exist.
740
801
  *
741
802
  * Returns a new object (does not mutate original).
803
+ *
804
+ * @param obj
805
+ * @param key
806
+ * @param value
807
+ * @returns
742
808
  */
743
809
  static add(obj, key, value) {
744
810
  if (!(key in obj)) return {
@@ -770,12 +836,43 @@ var Obj = class Obj {
770
836
  }
771
837
  /**
772
838
  * Split object into [keys, values]
839
+ *
840
+ * @param obj
841
+ * @returns
773
842
  */
774
843
  static divide(obj) {
775
844
  return [Object.keys(obj), Object.values(obj)];
776
845
  }
777
846
  /**
847
+ * Flattens a nested object into a single-level object
848
+ * with dot-separated keys.
849
+ *
850
+ * Example:
851
+ * dot({
852
+ * user: { name: "John", address: { city: "NY" } },
853
+ * active: true
854
+ * })
855
+ *
856
+ * Output:
857
+ * {
858
+ * "user.name": "John",
859
+ * "user.address.city": "NY",
860
+ * "active": true
861
+ * }
862
+ *
863
+ * @template T - The type of the input object
864
+ * @param obj - The nested object to flatten
865
+ * @returns A flattened object with dotted keys and inferred types
866
+ */
867
+ static dot(obj) {
868
+ return dot(obj);
869
+ }
870
+ /**
778
871
  * Check if a key exists in the object.
872
+ *
873
+ * @param obj
874
+ * @param key
875
+ * @returns
779
876
  */
780
877
  static exists(obj, key) {
781
878
  return Object.prototype.hasOwnProperty.call(obj, key);
@@ -785,6 +882,11 @@ var Obj = class Obj {
785
882
  *
786
883
  * Example:
787
884
  * Obj.get({a:{b:1}}, 'a.b') -> 1
885
+ *
886
+ * @param obj
887
+ * @param path
888
+ * @param defaultValue
889
+ * @returns
788
890
  */
789
891
  static get(obj, path, defaultValue) {
790
892
  if (!Obj.accessible(obj)) return defaultValue;
@@ -798,6 +900,10 @@ var Obj = class Obj {
798
900
  }
799
901
  /**
800
902
  * Check if the object has a given key or keys (dot notation supported).
903
+ *
904
+ * @param obj
905
+ * @param keys
906
+ * @returns
801
907
  */
802
908
  static has(obj, keys) {
803
909
  if (!Obj.accessible(obj)) return false;
@@ -813,13 +919,30 @@ var Obj = class Obj {
813
919
  }
814
920
  /**
815
921
  * Check if an object is associative (has at least one non-numeric key).
922
+ *
923
+ * @param obj
924
+ * @returns
816
925
  */
817
926
  static isAssoc(obj) {
818
927
  if (!Obj.accessible(obj)) return false;
819
928
  return Object.keys(obj).some((k) => isNaN(Number(k)));
820
929
  }
821
930
  /**
931
+ * Checks if a value is a plain object (not array, function, etc.)
932
+ *
933
+ * @param value
934
+ * @param allowArray
935
+ * @returns
936
+ */
937
+ static isPlainObject(value, allowArray) {
938
+ return isPlainObject(value, allowArray);
939
+ }
940
+ /**
822
941
  * Add a prefix to all keys of the object.
942
+ *
943
+ * @param obj
944
+ * @param prefix
945
+ * @returns
823
946
  */
824
947
  static prependKeysWith(obj, prefix) {
825
948
  if (!Obj.accessible(obj)) return {};
@@ -831,6 +954,9 @@ var Obj = class Obj {
831
954
  * Convert an object into a URL query string.
832
955
  *
833
956
  * Nested objects/arrays are flattened using bracket notation.
957
+ *
958
+ * @param obj
959
+ * @returns
834
960
  */
835
961
  static query(obj) {
836
962
  const encode = encodeURIComponent;
@@ -843,6 +969,20 @@ var Obj = class Obj {
843
969
  Object.entries(obj).forEach(([k, v]) => build(k, v));
844
970
  return parts.join("&");
845
971
  }
972
+ /**
973
+ * undot
974
+ *
975
+ * Convert a dot-notated object back into nested structure.
976
+ *
977
+ * Example:
978
+ * undot({ 'a.b': 1, 'c.0': 2 }) -> { a: { b: 1 }, c: [2] }
979
+ *
980
+ * @param obj
981
+ * @returns
982
+ */
983
+ undot(obj) {
984
+ return undot(obj);
985
+ }
846
986
  };
847
987
 
848
988
  //#endregion
@@ -1379,6 +1519,7 @@ var Arr = class Arr {
1379
1519
  */
1380
1520
  static whereNotNull(array, key) {
1381
1521
  if (!Array.isArray(array)) return [];
1522
+ if (!key) return array.filter((item) => item !== null && item !== void 0);
1382
1523
  return array.filter((item) => item[key] !== null && item[key] !== void 0);
1383
1524
  }
1384
1525
  /**
@@ -1517,6 +1658,15 @@ var Arr = class Arr {
1517
1658
  if (size <= 0 || !Number.isFinite(size)) return [];
1518
1659
  return Array.from({ length: size }, (_, i) => startAt + i);
1519
1660
  }
1661
+ /**
1662
+ * Filters an array and returns only unique values
1663
+ *
1664
+ * @param items
1665
+ * @returns
1666
+ */
1667
+ static unique(items) {
1668
+ return items.filter((value, index, self) => self.indexOf(value) === index);
1669
+ }
1520
1670
  };
1521
1671
 
1522
1672
  //#endregion
@@ -1536,9 +1686,9 @@ function format(date, fmt) {
1536
1686
  const TimeClass = class {};
1537
1687
  var DateTime = class DateTime extends TimeClass {
1538
1688
  instance;
1539
- constructor(config) {
1689
+ constructor(config, format$1, locale, strict) {
1540
1690
  super(config);
1541
- this.instance = (0, dayjs.default)(config);
1691
+ this.instance = (0, dayjs.default)(config, format$1, locale, strict);
1542
1692
  return new Proxy(this, { get: (target, prop, receiver) => {
1543
1693
  if (prop in target) return Reflect.get(target, prop, receiver);
1544
1694
  const value = Reflect.get(this.instance, prop, receiver);
@@ -1906,18 +2056,6 @@ var Str = class Str {
1906
2056
  return result;
1907
2057
  }
1908
2058
  /**
1909
- * Determine if a given string doesn't contain a given substring.
1910
- *
1911
- * @param { string } haystack
1912
- * @param { string | string[] } needles
1913
- * @param { boolean } ignoreCase
1914
- *
1915
- * @return { boolean }
1916
- */
1917
- static doesntContain(haystack, needles, ignoreCase = false) {
1918
- return !this.contains(haystack, needles, ignoreCase);
1919
- }
1920
- /**
1921
2059
  * Convert the case of a string.
1922
2060
  *
1923
2061
  * @param { string } string
@@ -1955,6 +2093,46 @@ var Str = class Str {
1955
2093
  return string;
1956
2094
  }
1957
2095
  /**
2096
+ * Detect content type
2097
+ *
2098
+ * @param content
2099
+ * @returns
2100
+ */
2101
+ static detectContentType(content) {
2102
+ if (typeof content !== "string") return "json";
2103
+ const trimmed = content.trim();
2104
+ /**
2105
+ * JSON check
2106
+ */
2107
+ if (/^[[{]/.test(trimmed)) try {
2108
+ JSON.parse(trimmed);
2109
+ return "json";
2110
+ } catch {}
2111
+ /**
2112
+ * XML check
2113
+ */
2114
+ if (/^<\?xml/i.test(trimmed) || /^<[A-Za-z]+[^>]*>/.test(trimmed)) {
2115
+ if (!/^<!DOCTYPE html>/i.test(trimmed) && !/<html[\s>]/i.test(trimmed)) return "xml";
2116
+ }
2117
+ /**
2118
+ * HTML check
2119
+ */
2120
+ if (/<(html|head|body|div|span|p|!DOCTYPE)/i.test(trimmed)) return "html";
2121
+ return "text";
2122
+ }
2123
+ /**
2124
+ * Determine if a given string doesn't contain a given substring.
2125
+ *
2126
+ * @param { string } haystack
2127
+ * @param { string | string[] } needles
2128
+ * @param { boolean } ignoreCase
2129
+ *
2130
+ * @return { boolean }
2131
+ */
2132
+ static doesntContain(haystack, needles, ignoreCase = false) {
2133
+ return !this.contains(haystack, needles, ignoreCase);
2134
+ }
2135
+ /**
1958
2136
  * Replace consecutive instances of a given character with a single character in the given string.
1959
2137
  *
1960
2138
  * @param { string } string
@@ -2099,7 +2277,7 @@ var Str = class Str {
2099
2277
  for (let pattern$1 of patterns) {
2100
2278
  if (pattern$1 === value) return true;
2101
2279
  if (ignoreCase && pattern$1.toLowerCase() === value.toLowerCase()) return true;
2102
- pattern$1 = pattern$1.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&").replace(/\\\*/g, ".*");
2280
+ pattern$1 = pattern$1.replace(/[\\^$*+?.()|[\]{}]/g, "\\$&").replace(/\\\*/g, ".*");
2103
2281
  if (new RegExp("^" + pattern$1 + "$", ignoreCase ? "iu" : "u").test(value)) return true;
2104
2282
  }
2105
2283
  return false;
@@ -2227,6 +2405,19 @@ var Str = class Str {
2227
2405
  return value.toLowerCase();
2228
2406
  }
2229
2407
  /**
2408
+ * Parse a Class[@]method style callback into class and method.
2409
+ *
2410
+ * @param callback
2411
+ * @param defaultValue
2412
+ */
2413
+ static parseCallback(callback, defaultValue) {
2414
+ if (this.contains(callback, "anonymous")) {
2415
+ if (this.substrCount(callback, "@") > 1) return [this.beforeLast(callback, "@"), this.afterLast(callback, "@")];
2416
+ return [callback, defaultValue];
2417
+ }
2418
+ return this.contains(callback, "@") ? callback.split("@", 2) : [callback, defaultValue];
2419
+ }
2420
+ /**
2230
2421
  * Get substring by start/stop indexes.
2231
2422
  *
2232
2423
  * @param string
@@ -3676,10 +3867,9 @@ var Str = class Str {
3676
3867
  static trim(value, characters = null) {
3677
3868
  if (characters === null) return value.trim();
3678
3869
  if (characters === "") return value;
3679
- if (characters === " ") return value.replaceAll(" ", "");
3680
- characters = characters.split("").join("|");
3681
- const regex = new RegExp(`${characters}+`, "g");
3682
- return value.replace(regex, "") ?? value;
3870
+ for (const char of characters) while (value.startsWith(char)) value = value.substring(char.length);
3871
+ for (const char of characters) while (value.endsWith(char)) value = value.substring(0, value.length - char.length);
3872
+ return value;
3683
3873
  }
3684
3874
  /**
3685
3875
  * Remove all whitespace from the beginning of a string.
@@ -3692,8 +3882,7 @@ var Str = class Str {
3692
3882
  static ltrim(value, characters = null) {
3693
3883
  if (characters === null) return value.trimStart();
3694
3884
  if (characters === "") return value;
3695
- if (characters === " ") return this.replaceStart(" ", "", value);
3696
- characters.split("").forEach((character) => value = this.replaceStart(character, "", value));
3885
+ for (const char of characters) while (value.startsWith(char)) value = value.substring(char.length);
3697
3886
  return value;
3698
3887
  }
3699
3888
  /**
@@ -3707,8 +3896,7 @@ var Str = class Str {
3707
3896
  static rtrim(value, characters = null) {
3708
3897
  if (characters === null) return value.trimEnd();
3709
3898
  if (characters === "") return value;
3710
- if (characters === " ") return this.replaceEnd(" ", "", value);
3711
- characters.split("").forEach((character) => value = this.replaceEnd(character, "", value));
3899
+ for (const char of characters) while (value.endsWith(char)) value = value.substring(0, value.length - char.length);
3712
3900
  return value;
3713
3901
  }
3714
3902
  /**
@@ -4059,6 +4247,23 @@ var Str = class Str {
4059
4247
  return result;
4060
4248
  }
4061
4249
  /**
4250
+ * Validate an IP address
4251
+ *
4252
+ * @param host
4253
+ * @param type
4254
+ *
4255
+ * @return { boolean }
4256
+ */
4257
+ static validateIp(host, type) {
4258
+ const code = {
4259
+ ipv4: 4,
4260
+ ipv6: 6
4261
+ };
4262
+ const result = (0, node_net.isIP)(host);
4263
+ if (type) return result === code[type];
4264
+ return result > 0;
4265
+ }
4266
+ /**
4062
4267
  * Generate a time-ordered UUID (version 4).
4063
4268
  *
4064
4269
  * @return { string }
@@ -4431,6 +4636,16 @@ var Stringable = class Stringable {
4431
4636
  return Str.containsAll(this.#value, needles, ignoreCase);
4432
4637
  }
4433
4638
  /**
4639
+ * Convert the case of a string.
4640
+ *
4641
+ * @param { Mode | number } mode
4642
+ *
4643
+ * @return { Stringable }
4644
+ */
4645
+ convertCase(mode = Mode.MB_CASE_FOLD) {
4646
+ return new Stringable(Str.convertCase(this.#value, mode));
4647
+ }
4648
+ /**
4434
4649
  * Determine if a given string doesn't contain a given substring.
4435
4650
  *
4436
4651
  * @param { string | string[] } needles
@@ -4442,14 +4657,13 @@ var Stringable = class Stringable {
4442
4657
  return !this.contains(needles, ignoreCase);
4443
4658
  }
4444
4659
  /**
4445
- * Convert the case of a string.
4446
- *
4447
- * @param { Mode | number } mode
4448
- *
4449
- * @return { Stringable }
4660
+ * Detect content type
4661
+ *
4662
+ * @param content
4663
+ * @returns
4450
4664
  */
4451
- convertCase(mode = Mode.MB_CASE_FOLD) {
4452
- return new Stringable(Str.convertCase(this.#value, mode));
4665
+ static detectContentType(content) {
4666
+ return Str.detectContentType(content);
4453
4667
  }
4454
4668
  /**
4455
4669
  * Replace consecutive instances of a given character with a single character in the given string.
@@ -5262,6 +5476,16 @@ var Stringable = class Stringable {
5262
5476
  return this;
5263
5477
  }
5264
5478
  /**
5479
+ * Validate an IP address
5480
+ *
5481
+ * @param host
5482
+ * @param type
5483
+ * @returns
5484
+ */
5485
+ validateIp(type = "ipv4") {
5486
+ return Str.validateIp(this.#value, type);
5487
+ }
5488
+ /**
5265
5489
  * Execute the given callback if the string contains a given substring.
5266
5490
  *
5267
5491
  * @param { string | string[] } needles
@@ -6076,6 +6300,7 @@ function loadHelpers(target = globalThis) {
6076
6300
  last: Arr.last,
6077
6301
  prepend: Arr.prepend,
6078
6302
  flatten: Arr.flatten,
6303
+ unique: Arr.unique,
6079
6304
  dot,
6080
6305
  undot,
6081
6306
  extractProperties,
@@ -6090,6 +6315,7 @@ function loadHelpers(target = globalThis) {
6090
6315
  data_set,
6091
6316
  data_fill,
6092
6317
  data_forget,
6318
+ isPlainObject,
6093
6319
  uuid,
6094
6320
  random,
6095
6321
  randomSecure,
@@ -6214,8 +6440,605 @@ function cleanHelpers(target = globalThis) {
6214
6440
  });
6215
6441
  }
6216
6442
 
6443
+ //#endregion
6444
+ //#region src/HigherOrderTapProxy.ts
6445
+ var HigherOrderTapProxy = class {
6446
+ /**
6447
+ * The target being tapped.
6448
+ */
6449
+ target;
6450
+ /**
6451
+ * Create a new tap proxy instance.
6452
+ */
6453
+ constructor(target) {
6454
+ this.target = target;
6455
+ }
6456
+ /**
6457
+ * Dynamically pass method calls to the target.
6458
+ *
6459
+ * @param method
6460
+ * @param parameters
6461
+ */
6462
+ __call(method, parameters) {
6463
+ this.target[method](...parameters);
6464
+ return this.target;
6465
+ }
6466
+ };
6467
+
6468
+ //#endregion
6469
+ //#region src/Helpers.ts
6470
+ /**
6471
+ * Call the given Closure with the given value then return the value.
6472
+ *
6473
+ * @param value
6474
+ * @param callback
6475
+ */
6476
+ const tap = (value, callback) => {
6477
+ if (!callback) return new HigherOrderTapProxy(value);
6478
+ callback(value);
6479
+ return value;
6480
+ };
6481
+ /**
6482
+ * Optional Proxy factory
6483
+ *
6484
+ * @param value
6485
+ * @returns
6486
+ */
6487
+ const createOptionalProxy = (value) => {
6488
+ return new Proxy({}, { get(_, prop) {
6489
+ if (prop === "value") return () => value ?? void 0;
6490
+ if (value == null) return createOptionalProxy(void 0);
6491
+ const result = value[prop];
6492
+ if (typeof result === "function") return (...args) => {
6493
+ try {
6494
+ return createOptionalProxy(result.apply(value, args));
6495
+ } catch {
6496
+ return createOptionalProxy(void 0);
6497
+ }
6498
+ };
6499
+ return createOptionalProxy(result);
6500
+ } });
6501
+ };
6502
+ /**
6503
+ * Provide access to optional objects.
6504
+ *
6505
+ * @param value
6506
+ * @param callback
6507
+ */
6508
+ const optional = (value, callback) => {
6509
+ if (callback) return value != null ? callback(value) : void 0;
6510
+ return createOptionalProxy(value);
6511
+ };
6512
+ /**
6513
+ * Checks if the givevn value is a class
6514
+ *
6515
+ * @param C
6516
+ */
6517
+ const isClass = (C) => {
6518
+ return typeof C === "function" && C.prototype !== void 0 && Object.toString.call(C).substring(0, 5) === "class";
6519
+ };
6520
+ /**
6521
+ * Checks if the givevn value is an abstract class
6522
+ *
6523
+ * @param C
6524
+ */
6525
+ const isAbstract = (C) => {
6526
+ return isClass(C) && C.name.startsWith("I");
6527
+ };
6528
+ /**
6529
+ * Checks if the givevn value is callable
6530
+ *
6531
+ * @param C
6532
+ */
6533
+ const isCallable = (C) => {
6534
+ return typeof C === "function" && !isClass(C);
6535
+ };
6536
+
6537
+ //#endregion
6538
+ //#region src/Macroable.ts
6539
+ const Macroable = () => (0, __h3ravel_shared.trait)((Base) => {
6540
+ return class Macroable$1 extends Base {
6541
+ static macros = {};
6542
+ constructor(...args) {
6543
+ super(...args);
6544
+ return new Proxy(this, { get(target, prop, receiver) {
6545
+ if (typeof prop === "string") {
6546
+ const ctor = target.constructor;
6547
+ if (ctor.hasMacro(prop)) return (...args$1) => ctor.macros[prop].apply(receiver, args$1);
6548
+ }
6549
+ return Reflect.get(target, prop, receiver);
6550
+ } });
6551
+ }
6552
+ static macro(name, macro) {
6553
+ this.macros[name] = macro;
6554
+ }
6555
+ static hasMacro(name) {
6556
+ return Object.prototype.hasOwnProperty.call(this.macros, name);
6557
+ }
6558
+ static flushMacros() {
6559
+ this.macros = {};
6560
+ }
6561
+ static mixin(mixin, replace = true) {
6562
+ const proto = Object.getPrototypeOf(mixin);
6563
+ for (const key of Object.getOwnPropertyNames(proto)) {
6564
+ if (key === "constructor") continue;
6565
+ const desc = Object.getOwnPropertyDescriptor(proto, key);
6566
+ if (!desc || typeof desc.value !== "function") continue;
6567
+ if (replace || !this.hasMacro(key)) this.macro(key, desc.value.bind(mixin));
6568
+ }
6569
+ }
6570
+ static createProxy() {
6571
+ return new Proxy(this, { get(target, prop, receiver) {
6572
+ if (typeof prop === "string" && target.hasMacro(prop)) return (...args) => target.macros[prop](...args);
6573
+ return Reflect.get(target, prop, receiver);
6574
+ } });
6575
+ }
6576
+ /**
6577
+ * Dynamically handle calls to the class.
6578
+ *
6579
+ * @param method
6580
+ * @param parameters
6581
+ *
6582
+ * @throws {BadMethodCallException}
6583
+ */
6584
+ static macroCallStatic(method, parameters = []) {
6585
+ if (!Macroable$1.hasMacro(method)) throw new BadMethodCallException(`Method ${Macroable$1.constructor.name}.${method} does not exist.`);
6586
+ let macro = Macroable$1.macros[method];
6587
+ if (typeof macro === "function") macro = macro.bind(this);
6588
+ if (typeof macro === "function") macro = macro.bind(this);
6589
+ return macro(...parameters);
6590
+ }
6591
+ /**
6592
+ * Dynamically handle calls to the class.
6593
+ *
6594
+ * @param method
6595
+ * @param parameters
6596
+ *
6597
+ * @throws {BadMethodCallException}
6598
+ */
6599
+ macroCall(method, parameters = []) {
6600
+ if (!Macroable$1.hasMacro(method)) throw new BadMethodCallException(`Method ${Macroable$1.constructor.name}.${method} does not exist.`);
6601
+ let macro = Macroable$1.macros[method];
6602
+ if (typeof macro === "function") macro = macro.bind(this);
6603
+ return macro(...parameters);
6604
+ }
6605
+ };
6606
+ });
6607
+ const MacroableClass = Macroable().factory(class {});
6608
+
6609
+ //#endregion
6610
+ //#region src/Providers/ServiceProvider.ts
6611
+ var ServiceProvider = class extends __h3ravel_contracts.IServiceProvider {
6612
+ /**
6613
+ * The current app instance
6614
+ */
6615
+ app;
6616
+ /**
6617
+ * Unique Identifier for the service providers
6618
+ */
6619
+ static uid;
6620
+ /**
6621
+ * Sort order
6622
+ */
6623
+ static order;
6624
+ /**
6625
+ * Sort priority
6626
+ */
6627
+ static priority = 0;
6628
+ /**
6629
+ * Indicate that this service provider only runs in console
6630
+ */
6631
+ static console = false;
6632
+ /**
6633
+ * Indicate that this service provider only runs in console
6634
+ */
6635
+ console = false;
6636
+ /**
6637
+ * Indicate that this service provider only runs in console
6638
+ */
6639
+ runsInConsole = false;
6640
+ /**
6641
+ * List of registered console commands
6642
+ */
6643
+ registeredCommands = [];
6644
+ /**
6645
+ * All of the registered booted callbacks.
6646
+ */
6647
+ bootedCallbacks = [];
6648
+ constructor(app) {
6649
+ super();
6650
+ this.app = app;
6651
+ }
6652
+ /**
6653
+ * Register a booted callback to be run after the "boot" method is called.
6654
+ *
6655
+ * @param callback
6656
+ */
6657
+ booted(callback) {
6658
+ this.bootedCallbacks.push(callback);
6659
+ }
6660
+ /**
6661
+ * Call the registered booted callbacks.
6662
+ */
6663
+ async callBootedCallbacks() {
6664
+ let index = 0;
6665
+ while (index < this.bootedCallbacks.length) {
6666
+ await this.app.call(this.bootedCallbacks[index]);
6667
+ index++;
6668
+ }
6669
+ }
6670
+ /**
6671
+ * Register the listed service providers.
6672
+ *
6673
+ * @param commands An array of console commands to register.
6674
+ *
6675
+ * @deprecated since version 1.16.0. Will be removed in future versions, use `registerCommands` instead
6676
+ */
6677
+ commands(commands) {
6678
+ this.registerCommands(commands);
6679
+ }
6680
+ /**
6681
+ * Register the listed service providers.
6682
+ *
6683
+ * @param commands An array of console commands to register.
6684
+ */
6685
+ registerCommands(commands) {
6686
+ this.registeredCommands = commands;
6687
+ }
6688
+ };
6689
+
6690
+ //#endregion
6691
+ //#region ../../node_modules/.pnpm/h3@2.0.1-rc.5/node_modules/h3/dist/h3.mjs
6692
+ const kEventNS = "h3.internal.event.";
6693
+ const kEventRes = /* @__PURE__ */ Symbol.for(`${kEventNS}res`);
6694
+ const kEventResHeaders = /* @__PURE__ */ Symbol.for(`${kEventNS}res.headers`);
6695
+ const DISALLOWED_STATUS_CHARS = /[^\u0009\u0020-\u007E]/g;
6696
+ function sanitizeStatusMessage(statusMessage = "") {
6697
+ return statusMessage.replace(DISALLOWED_STATUS_CHARS, "");
6698
+ }
6699
+ function sanitizeStatusCode(statusCode, defaultStatusCode = 200) {
6700
+ if (!statusCode) return defaultStatusCode;
6701
+ if (typeof statusCode === "string") statusCode = +statusCode;
6702
+ if (statusCode < 100 || statusCode > 599) return defaultStatusCode;
6703
+ return statusCode;
6704
+ }
6705
+ var HTTPError = class HTTPError$1 extends Error {
6706
+ get name() {
6707
+ return "HTTPError";
6708
+ }
6709
+ status;
6710
+ statusText;
6711
+ headers;
6712
+ cause;
6713
+ data;
6714
+ body;
6715
+ unhandled;
6716
+ static isError(input) {
6717
+ return input instanceof Error && input?.name === "HTTPError";
6718
+ }
6719
+ static status(status, statusText, details) {
6720
+ return new HTTPError$1({
6721
+ ...details,
6722
+ statusText,
6723
+ status
6724
+ });
6725
+ }
6726
+ constructor(arg1, arg2) {
6727
+ let messageInput;
6728
+ let details;
6729
+ if (typeof arg1 === "string") {
6730
+ messageInput = arg1;
6731
+ details = arg2;
6732
+ } else details = arg1;
6733
+ const status = sanitizeStatusCode(details?.status || (details?.cause)?.status || details?.status || details?.statusCode, 500);
6734
+ const statusText = sanitizeStatusMessage(details?.statusText || (details?.cause)?.statusText || details?.statusText || details?.statusMessage);
6735
+ const message = messageInput || details?.message || (details?.cause)?.message || details?.statusText || details?.statusMessage || [
6736
+ "HTTPError",
6737
+ status,
6738
+ statusText
6739
+ ].filter(Boolean).join(" ");
6740
+ super(message, { cause: details });
6741
+ this.cause = details;
6742
+ Error.captureStackTrace?.(this, this.constructor);
6743
+ this.status = status;
6744
+ this.statusText = statusText || void 0;
6745
+ const rawHeaders = details?.headers || (details?.cause)?.headers;
6746
+ this.headers = rawHeaders ? new Headers(rawHeaders) : void 0;
6747
+ this.unhandled = details?.unhandled ?? (details?.cause)?.unhandled ?? void 0;
6748
+ this.data = details?.data;
6749
+ this.body = details?.body;
6750
+ }
6751
+ get statusCode() {
6752
+ return this.status;
6753
+ }
6754
+ get statusMessage() {
6755
+ return this.statusText;
6756
+ }
6757
+ toJSON() {
6758
+ const unhandled = this.unhandled;
6759
+ return {
6760
+ status: this.status,
6761
+ statusText: this.statusText,
6762
+ unhandled,
6763
+ message: unhandled ? "HTTPError" : this.message,
6764
+ data: unhandled ? void 0 : this.data,
6765
+ ...unhandled ? void 0 : this.body
6766
+ };
6767
+ }
6768
+ };
6769
+ var HTTPResponse = class {
6770
+ #headers;
6771
+ #init;
6772
+ body;
6773
+ constructor(body, init) {
6774
+ this.body = body;
6775
+ this.#init = init;
6776
+ }
6777
+ get status() {
6778
+ return this.#init?.status || 200;
6779
+ }
6780
+ get statusText() {
6781
+ return this.#init?.statusText || "OK";
6782
+ }
6783
+ get headers() {
6784
+ return this.#headers ||= new Headers(this.#init?.headers);
6785
+ }
6786
+ };
6787
+ function withLeadingSlash(path) {
6788
+ if (!path || path === "/") return "/";
6789
+ return path[0] === "/" ? path : `/${path}`;
6790
+ }
6791
+ function withoutTrailingSlash(path) {
6792
+ if (!path || path === "/") return "/";
6793
+ return path[path.length - 1] === "/" ? path.slice(0, -1) : path;
6794
+ }
6795
+ const COMMON_MIME_TYPES = {
6796
+ ".html": "text/html",
6797
+ ".htm": "text/html",
6798
+ ".css": "text/css",
6799
+ ".js": "text/javascript",
6800
+ ".json": "application/json",
6801
+ ".txt": "text/plain",
6802
+ ".xml": "application/xml",
6803
+ ".gif": "image/gif",
6804
+ ".ico": "image/vnd.microsoft.icon",
6805
+ ".jpeg": "image/jpeg",
6806
+ ".jpg": "image/jpeg",
6807
+ ".png": "image/png",
6808
+ ".svg": "image/svg+xml",
6809
+ ".webp": "image/webp",
6810
+ ".woff": "font/woff",
6811
+ ".woff2": "font/woff2",
6812
+ ".mp4": "video/mp4",
6813
+ ".webm": "video/webm",
6814
+ ".zip": "application/zip",
6815
+ ".pdf": "application/pdf"
6816
+ };
6817
+ function getExtension(path) {
6818
+ const filename = path.split("/").pop();
6819
+ if (!filename) return;
6820
+ const separatorIndex = filename.lastIndexOf(".");
6821
+ if (separatorIndex !== -1) return filename.slice(separatorIndex);
6822
+ }
6823
+ function getType(ext) {
6824
+ return ext ? COMMON_MIME_TYPES[ext] : void 0;
6825
+ }
6826
+ async function serveStatic(event, options) {
6827
+ if (options.headers) {
6828
+ const entries = Array.isArray(options.headers) ? options.headers : typeof options.headers.entries === "function" ? options.headers.entries() : Object.entries(options.headers);
6829
+ for (const [key, value] of entries) event.res.headers.set(key, value);
6830
+ }
6831
+ if (event.req.method !== "GET" && event.req.method !== "HEAD") {
6832
+ if (options.fallthrough) return;
6833
+ event.res.headers.set("allow", "GET, HEAD");
6834
+ throw new HTTPError({ status: 405 });
6835
+ }
6836
+ const originalId = decodeURI(withLeadingSlash(withoutTrailingSlash(event.url.pathname)));
6837
+ const acceptEncodings = parseAcceptEncoding(event.req.headers.get("accept-encoding") || "", options.encodings);
6838
+ if (acceptEncodings.length > 1) event.res.headers.set("vary", "accept-encoding");
6839
+ let id = originalId;
6840
+ let meta;
6841
+ const _ids = idSearchPaths(originalId, acceptEncodings, options.indexNames || ["/index.html"]);
6842
+ for (const _id of _ids) {
6843
+ const _meta = await options.getMeta(_id);
6844
+ if (_meta) {
6845
+ meta = _meta;
6846
+ id = _id;
6847
+ break;
6848
+ }
6849
+ }
6850
+ if (!meta) {
6851
+ if (options.fallthrough) return;
6852
+ throw new HTTPError({ statusCode: 404 });
6853
+ }
6854
+ if (meta.mtime) {
6855
+ const mtimeDate = new Date(meta.mtime);
6856
+ const ifModifiedSinceH = event.req.headers.get("if-modified-since");
6857
+ if (ifModifiedSinceH && new Date(ifModifiedSinceH) >= mtimeDate) return new HTTPResponse(null, {
6858
+ status: 304,
6859
+ statusText: "Not Modified"
6860
+ });
6861
+ if (!event.res.headers.get("last-modified")) event.res.headers.set("last-modified", mtimeDate.toUTCString());
6862
+ }
6863
+ if (meta.etag && !event.res.headers.has("etag")) event.res.headers.set("etag", meta.etag);
6864
+ if (meta.etag && event.req.headers.get("if-none-match") === meta.etag) return new HTTPResponse(null, {
6865
+ status: 304,
6866
+ statusText: "Not Modified"
6867
+ });
6868
+ if (!event.res.headers.get("content-type")) if (meta.type) event.res.headers.set("content-type", meta.type);
6869
+ else {
6870
+ const ext = getExtension(id);
6871
+ const type = ext ? options.getType?.(ext) ?? getType(ext) : void 0;
6872
+ if (type) event.res.headers.set("content-type", type);
6873
+ }
6874
+ if (meta.encoding && !event.res.headers.get("content-encoding")) event.res.headers.set("content-encoding", meta.encoding);
6875
+ if (meta.size !== void 0 && meta.size > 0 && !event.req.headers.get("content-length")) event.res.headers.set("content-length", meta.size + "");
6876
+ if (event.req.method === "HEAD") return new HTTPResponse(null, { status: 200 });
6877
+ return new HTTPResponse(await options.getContents(id) || null, { status: 200 });
6878
+ }
6879
+ function parseAcceptEncoding(header, encodingMap) {
6880
+ if (!encodingMap || !header) return [];
6881
+ return String(header || "").split(",").map((e) => encodingMap[e.trim()]).filter(Boolean);
6882
+ }
6883
+ function idSearchPaths(id, encodings, indexNames) {
6884
+ const ids = [];
6885
+ for (const suffix of ["", ...indexNames]) for (const encoding of [...encodings, ""]) ids.push(`${id}${suffix}${encoding}`);
6886
+ return ids;
6887
+ }
6888
+
6889
+ //#endregion
6890
+ //#region src/Providers/AssetsServiceProvider.ts
6891
+ /**
6892
+ * Handles public assets loading
6893
+ *
6894
+ * Auto-Registered
6895
+ */
6896
+ var AssetsServiceProvider = class extends ServiceProvider {
6897
+ static priority = 996;
6898
+ register() {
6899
+ const app = this.app.make("router");
6900
+ const publicPath = this.app.getPath("public");
6901
+ /**
6902
+ * Use a middleware to check if this request for for a file
6903
+ */
6904
+ app.h3middleware((event) => {
6905
+ const { pathname } = new URL(event.req.url);
6906
+ /**
6907
+ * Only serve if it looks like a static asset (has an extension)
6908
+ * but skip dotfiles or sensitive files
6909
+ */
6910
+ if (!/\.[a-zA-Z0-9]+$/.test(pathname)) return;
6911
+ if (pathname.startsWith("/.") || pathname.includes("..")) return;
6912
+ /**
6913
+ * Serve the asset
6914
+ */
6915
+ return serveStatic(event, {
6916
+ indexNames: ["/index.html"],
6917
+ getContents: (id) => {
6918
+ return (0, node_fs_promises.readFile)((0, node_path.join)(Str.before(publicPath, id), id));
6919
+ },
6920
+ getMeta: async (id) => {
6921
+ const stats = await (0, node_fs_promises.stat)((0, node_path.join)(Str.before(publicPath, id), id)).catch(() => {});
6922
+ if (stats?.isFile()) return {
6923
+ size: stats.size,
6924
+ mtime: stats.mtimeMs
6925
+ };
6926
+ }
6927
+ });
6928
+ });
6929
+ this.app.singleton("asset", () => {
6930
+ return (key, def) => {
6931
+ if (def) try {
6932
+ (0, node_fs.statSync)((0, node_path.join)(Str.before(publicPath, key), key));
6933
+ } catch {
6934
+ key = def;
6935
+ }
6936
+ return key;
6937
+ };
6938
+ });
6939
+ }
6940
+ };
6941
+
6942
+ //#endregion
6943
+ //#region src/Providers/RouteServiceProvider.ts
6944
+ /**
6945
+ * Handles routing registration
6946
+ *
6947
+ * Load route files (web.ts, api.ts).
6948
+ * Map controllers to routes.
6949
+ * Register route-related middleware.
6950
+ */
6951
+ var RouteServiceProvider = class RouteServiceProvider extends ServiceProvider {
6952
+ static priority = 997;
6953
+ /**
6954
+ * The callback that should be used to load the application's routes.
6955
+ */
6956
+ loadRoutesUsing;
6957
+ /**
6958
+ * The global callback that should be used to load the application's routes.
6959
+ */
6960
+ static alwaysLoadRoutesUsing;
6961
+ async register() {
6962
+ const { RouteListCommand, Router, SubstituteBindings } = await import("@h3ravel/router");
6963
+ this.app.bindMiddleware("SubstituteBindings", SubstituteBindings);
6964
+ this.booted(() => {
6965
+ const router$1 = this.app.make(__h3ravel_contracts.IRouter);
6966
+ if (typeof router$1.getRoutes === "function") {
6967
+ router$1.getRoutes().refreshActionLookups();
6968
+ router$1.getRoutes().refreshNameLookups();
6969
+ }
6970
+ });
6971
+ const router = () => {
6972
+ try {
6973
+ return new Router(this.app.make("http.app"), this.app);
6974
+ } catch (error) {
6975
+ if (String(error.message).includes("http.app")) __h3ravel_shared.Logger.log([
6976
+ ["The", "white"],
6977
+ ["@h3ravel/http", ["italic", "gray"]],
6978
+ ["package is required to use the routing system.", "white"]
6979
+ ], " ");
6980
+ else __h3ravel_shared.Logger.log(error, "white");
6981
+ }
6982
+ return {};
6983
+ };
6984
+ this.app.singleton("router", router);
6985
+ this.app.alias(Router, "router");
6986
+ this.app.alias(__h3ravel_contracts.IRouter, "router");
6987
+ this.registerCommands([RouteListCommand]);
6988
+ }
6989
+ /**
6990
+ * Load routes from src/routes
6991
+ */
6992
+ async boot() {
6993
+ await this.loadRoutes();
6994
+ }
6995
+ /**
6996
+ * Register the callback that will be used to load the application's routes.
6997
+ *
6998
+ * @param routesCallback
6999
+ */
7000
+ routes(routesCallback) {
7001
+ this.loadRoutesUsing = routesCallback;
7002
+ return this;
7003
+ }
7004
+ /**
7005
+ * Register the callback that will be used to load the application's routes.
7006
+ *
7007
+ * @param routesCallback
7008
+ */
7009
+ static loadRoutesUsing(routesCallback) {
7010
+ this.alwaysLoadRoutesUsing = routesCallback;
7011
+ }
7012
+ /**
7013
+ * Load the application routes.
7014
+ */
7015
+ async loadRoutes() {
7016
+ if (RouteServiceProvider.alwaysLoadRoutesUsing != null) this.app.call(RouteServiceProvider.alwaysLoadRoutesUsing);
7017
+ if (this.loadRoutesUsing != null) this.app.call(this.loadRoutesUsing);
7018
+ else if (typeof this["map"] === "function") this.app.call(this["map"]);
7019
+ }
7020
+ };
7021
+
7022
+ //#endregion
7023
+ //#region src/Tappable.ts
7024
+ const Tappable = (Base) => {
7025
+ return class extends Base {
7026
+ /**
7027
+ * Call the given Closure with this instance then return the instance.
7028
+ *
7029
+ * @param callback
7030
+ */
7031
+ tap(callback) {
7032
+ return tap(this, callback);
7033
+ }
7034
+ };
7035
+ };
7036
+
6217
7037
  //#endregion
6218
7038
  exports.Arr = Arr;
7039
+ exports.AssetsServiceProvider = AssetsServiceProvider;
7040
+ exports.BadMethodCallException = BadMethodCallException;
7041
+ exports.Collection = Collection;
6219
7042
  Object.defineProperty(exports, 'Crypto', {
6220
7043
  enumerable: true,
6221
7044
  get: function () {
@@ -6223,8 +7046,11 @@ Object.defineProperty(exports, 'Crypto', {
6223
7046
  }
6224
7047
  });
6225
7048
  exports.DateTime = DateTime;
7049
+ exports.HigherOrderTapProxy = HigherOrderTapProxy;
6226
7050
  exports.HtmlString = HtmlString;
6227
7051
  exports.InvalidArgumentException = InvalidArgumentException;
7052
+ exports.Macroable = Macroable;
7053
+ exports.MacroableClass = MacroableClass;
6228
7054
  exports.Mode = Mode;
6229
7055
  Object.defineProperty(exports, 'Number', {
6230
7056
  enumerable: true,
@@ -6233,15 +7059,21 @@ Object.defineProperty(exports, 'Number', {
6233
7059
  }
6234
7060
  });
6235
7061
  exports.Obj = Obj;
6236
- exports.RuntimeException = RuntimeException;
7062
+ exports.RouteServiceProvider = RouteServiceProvider;
7063
+ exports.RuntimeException = require_RuntimeException.RuntimeException;
7064
+ exports.ServiceProvider = ServiceProvider;
6237
7065
  exports.Str = Str;
6238
7066
  exports.Stringable = Stringable;
7067
+ exports.Tappable = Tappable;
7068
+ exports.__toESM = __toESM;
6239
7069
  exports.abbreviate = abbreviate;
6240
7070
  exports.base64Decode = base64Decode;
6241
7071
  exports.base64Encode = base64Encode;
6242
7072
  exports.caesarCipher = caesarCipher;
6243
7073
  exports.checksum = checksum;
6244
7074
  exports.cleanHelpers = cleanHelpers;
7075
+ exports.collect = collect;
7076
+ exports.createOptionalProxy = createOptionalProxy;
6245
7077
  exports.data_fill = data_fill;
6246
7078
  exports.data_forget = data_forget;
6247
7079
  exports.data_get = data_get;
@@ -6255,9 +7087,13 @@ exports.getValue = getValue;
6255
7087
  exports.hash = hash;
6256
7088
  exports.hmac = hmac;
6257
7089
  exports.humanize = humanize;
7090
+ exports.isAbstract = isAbstract;
7091
+ exports.isCallable = isCallable;
7092
+ exports.isClass = isClass;
6258
7093
  exports.isPlainObject = isPlainObject;
6259
7094
  exports.loadHelpers = loadHelpers;
6260
7095
  exports.modObj = modObj;
7096
+ exports.optional = optional;
6261
7097
  exports.random = random;
6262
7098
  exports.randomColor = randomColor;
6263
7099
  exports.randomPassword = randomPassword;
@@ -6267,6 +7103,7 @@ exports.secureToken = secureToken;
6267
7103
  exports.setNested = setNested;
6268
7104
  exports.slugifyKeys = slugifyKeys;
6269
7105
  exports.str = str;
7106
+ exports.tap = tap;
6270
7107
  exports.toBytes = toBytes;
6271
7108
  exports.toCssClasses = toCssClasses;
6272
7109
  exports.toCssStyles = toCssStyles;