@stryke/prisma-trpc-generator 0.3.2 → 0.3.3

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
@@ -667,164 +667,1959 @@ var require_pluralize = __commonJS({
667
667
  }
668
668
  });
669
669
 
670
- // src/index.ts
671
- init_cjs_shims();
672
-
673
- // src/prisma-generator.ts
674
- init_cjs_shims();
675
-
676
- // ../fs/src/helpers.ts
677
- init_cjs_shims();
678
-
679
- // ../path/src/exists.ts
680
- init_cjs_shims();
681
- var import_promises = require("node:fs/promises");
682
- var exists = /* @__PURE__ */ __name(async (filePath) => {
683
- return (0, import_promises.access)(filePath, import_promises.constants.F_OK).then(() => true).catch(() => false);
684
- }, "exists");
685
-
686
- // ../fs/src/helpers.ts
687
- var import_promises2 = require("node:fs/promises");
688
- async function createDirectory(path6) {
689
- if (await exists(path6)) {
690
- return;
670
+ // ../../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
671
+ var require_base64_js = __commonJS({
672
+ "../../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js"(exports2) {
673
+ "use strict";
674
+ init_cjs_shims();
675
+ exports2.byteLength = byteLength;
676
+ exports2.toByteArray = toByteArray;
677
+ exports2.fromByteArray = fromByteArray;
678
+ var lookup = [];
679
+ var revLookup = [];
680
+ var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
681
+ var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
682
+ for (i = 0, len = code.length; i < len; ++i) {
683
+ lookup[i] = code[i];
684
+ revLookup[code.charCodeAt(i)] = i;
685
+ }
686
+ var i;
687
+ var len;
688
+ revLookup["-".charCodeAt(0)] = 62;
689
+ revLookup["_".charCodeAt(0)] = 63;
690
+ function getLens(b64) {
691
+ var len2 = b64.length;
692
+ if (len2 % 4 > 0) {
693
+ throw new Error("Invalid string. Length must be a multiple of 4");
694
+ }
695
+ var validLen = b64.indexOf("=");
696
+ if (validLen === -1) validLen = len2;
697
+ var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;
698
+ return [
699
+ validLen,
700
+ placeHoldersLen
701
+ ];
702
+ }
703
+ __name(getLens, "getLens");
704
+ function byteLength(b64) {
705
+ var lens = getLens(b64);
706
+ var validLen = lens[0];
707
+ var placeHoldersLen = lens[1];
708
+ return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
709
+ }
710
+ __name(byteLength, "byteLength");
711
+ function _byteLength(b64, validLen, placeHoldersLen) {
712
+ return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
713
+ }
714
+ __name(_byteLength, "_byteLength");
715
+ function toByteArray(b64) {
716
+ var tmp;
717
+ var lens = getLens(b64);
718
+ var validLen = lens[0];
719
+ var placeHoldersLen = lens[1];
720
+ var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
721
+ var curByte = 0;
722
+ var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen;
723
+ var i2;
724
+ for (i2 = 0; i2 < len2; i2 += 4) {
725
+ tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)];
726
+ arr[curByte++] = tmp >> 16 & 255;
727
+ arr[curByte++] = tmp >> 8 & 255;
728
+ arr[curByte++] = tmp & 255;
729
+ }
730
+ if (placeHoldersLen === 2) {
731
+ tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4;
732
+ arr[curByte++] = tmp & 255;
733
+ }
734
+ if (placeHoldersLen === 1) {
735
+ tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2;
736
+ arr[curByte++] = tmp >> 8 & 255;
737
+ arr[curByte++] = tmp & 255;
738
+ }
739
+ return arr;
740
+ }
741
+ __name(toByteArray, "toByteArray");
742
+ function tripletToBase64(num) {
743
+ return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
744
+ }
745
+ __name(tripletToBase64, "tripletToBase64");
746
+ function encodeChunk(uint8, start, end) {
747
+ var tmp;
748
+ var output = [];
749
+ for (var i2 = start; i2 < end; i2 += 3) {
750
+ tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255);
751
+ output.push(tripletToBase64(tmp));
752
+ }
753
+ return output.join("");
754
+ }
755
+ __name(encodeChunk, "encodeChunk");
756
+ function fromByteArray(uint8) {
757
+ var tmp;
758
+ var len2 = uint8.length;
759
+ var extraBytes = len2 % 3;
760
+ var parts = [];
761
+ var maxChunkLength = 16383;
762
+ for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) {
763
+ parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength));
764
+ }
765
+ if (extraBytes === 1) {
766
+ tmp = uint8[len2 - 1];
767
+ parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==");
768
+ } else if (extraBytes === 2) {
769
+ tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1];
770
+ parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=");
771
+ }
772
+ return parts.join("");
773
+ }
774
+ __name(fromByteArray, "fromByteArray");
691
775
  }
692
- return (0, import_promises2.mkdir)(path6, {
693
- recursive: true
694
- });
695
- }
696
- __name(createDirectory, "createDirectory");
776
+ });
697
777
 
698
- // ../path/src/join-paths.ts
699
- init_cjs_shims();
700
- var _DRIVE_LETTER_START_RE = /^[A-Z]:\//i;
701
- function normalizeWindowsPath(input = "") {
702
- if (!input) {
703
- return input;
704
- }
705
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
706
- }
707
- __name(normalizeWindowsPath, "normalizeWindowsPath");
708
- var _UNC_REGEX = /^[/\\]{2}/;
709
- var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i;
710
- var _DRIVE_LETTER_RE = /^[A-Z]:$/i;
711
- var isAbsolute = /* @__PURE__ */ __name(function(p) {
712
- return _IS_ABSOLUTE_RE.test(p);
713
- }, "isAbsolute");
714
- var correctPaths = /* @__PURE__ */ __name(function(path6) {
715
- if (!path6 || path6.length === 0) {
716
- return ".";
778
+ // ../../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js
779
+ var require_ieee754 = __commonJS({
780
+ "../../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js"(exports2) {
781
+ "use strict";
782
+ init_cjs_shims();
783
+ exports2.read = function(buffer, offset, isLE, mLen, nBytes) {
784
+ var e, m;
785
+ var eLen = nBytes * 8 - mLen - 1;
786
+ var eMax = (1 << eLen) - 1;
787
+ var eBias = eMax >> 1;
788
+ var nBits = -7;
789
+ var i = isLE ? nBytes - 1 : 0;
790
+ var d = isLE ? -1 : 1;
791
+ var s = buffer[offset + i];
792
+ i += d;
793
+ e = s & (1 << -nBits) - 1;
794
+ s >>= -nBits;
795
+ nBits += eLen;
796
+ for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {
797
+ }
798
+ m = e & (1 << -nBits) - 1;
799
+ e >>= -nBits;
800
+ nBits += mLen;
801
+ for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {
802
+ }
803
+ if (e === 0) {
804
+ e = 1 - eBias;
805
+ } else if (e === eMax) {
806
+ return m ? NaN : (s ? -1 : 1) * Infinity;
807
+ } else {
808
+ m = m + Math.pow(2, mLen);
809
+ e = e - eBias;
810
+ }
811
+ return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
812
+ };
813
+ exports2.write = function(buffer, value, offset, isLE, mLen, nBytes) {
814
+ var e, m, c;
815
+ var eLen = nBytes * 8 - mLen - 1;
816
+ var eMax = (1 << eLen) - 1;
817
+ var eBias = eMax >> 1;
818
+ var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
819
+ var i = isLE ? 0 : nBytes - 1;
820
+ var d = isLE ? 1 : -1;
821
+ var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
822
+ value = Math.abs(value);
823
+ if (isNaN(value) || value === Infinity) {
824
+ m = isNaN(value) ? 1 : 0;
825
+ e = eMax;
826
+ } else {
827
+ e = Math.floor(Math.log(value) / Math.LN2);
828
+ if (value * (c = Math.pow(2, -e)) < 1) {
829
+ e--;
830
+ c *= 2;
831
+ }
832
+ if (e + eBias >= 1) {
833
+ value += rt / c;
834
+ } else {
835
+ value += rt * Math.pow(2, 1 - eBias);
836
+ }
837
+ if (value * c >= 2) {
838
+ e++;
839
+ c /= 2;
840
+ }
841
+ if (e + eBias >= eMax) {
842
+ m = 0;
843
+ e = eMax;
844
+ } else if (e + eBias >= 1) {
845
+ m = (value * c - 1) * Math.pow(2, mLen);
846
+ e = e + eBias;
847
+ } else {
848
+ m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
849
+ e = 0;
850
+ }
851
+ }
852
+ for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {
853
+ }
854
+ e = e << mLen | m;
855
+ eLen += mLen;
856
+ for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {
857
+ }
858
+ buffer[offset + i - d] |= s * 128;
859
+ };
717
860
  }
718
- path6 = normalizeWindowsPath(path6);
719
- const isUNCPath = path6.match(_UNC_REGEX);
720
- const isPathAbsolute = isAbsolute(path6);
721
- const trailingSeparator = path6[path6.length - 1] === "/";
722
- path6 = normalizeString(path6, !isPathAbsolute);
723
- if (path6.length === 0) {
724
- if (isPathAbsolute) {
725
- return "/";
861
+ });
862
+
863
+ // ../../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js
864
+ var require_buffer = __commonJS({
865
+ "../../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js"(exports2) {
866
+ "use strict";
867
+ init_cjs_shims();
868
+ var base64 = require_base64_js();
869
+ var ieee754 = require_ieee754();
870
+ var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
871
+ exports2.Buffer = Buffer3;
872
+ exports2.SlowBuffer = SlowBuffer;
873
+ exports2.INSPECT_MAX_BYTES = 50;
874
+ var K_MAX_LENGTH = 2147483647;
875
+ exports2.kMaxLength = K_MAX_LENGTH;
876
+ Buffer3.TYPED_ARRAY_SUPPORT = typedArraySupport();
877
+ if (!Buffer3.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
878
+ console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
879
+ }
880
+ function typedArraySupport() {
881
+ try {
882
+ const arr = new Uint8Array(1);
883
+ const proto = {
884
+ foo: /* @__PURE__ */ __name(function() {
885
+ return 42;
886
+ }, "foo")
887
+ };
888
+ Object.setPrototypeOf(proto, Uint8Array.prototype);
889
+ Object.setPrototypeOf(arr, proto);
890
+ return arr.foo() === 42;
891
+ } catch (e) {
892
+ return false;
893
+ }
726
894
  }
727
- return trailingSeparator ? "./" : ".";
728
- }
729
- if (trailingSeparator) {
730
- path6 += "/";
731
- }
732
- if (_DRIVE_LETTER_RE.test(path6)) {
733
- path6 += "/";
734
- }
735
- if (isUNCPath) {
736
- if (!isPathAbsolute) {
737
- return `//./${path6}`;
895
+ __name(typedArraySupport, "typedArraySupport");
896
+ Object.defineProperty(Buffer3.prototype, "parent", {
897
+ enumerable: true,
898
+ get: /* @__PURE__ */ __name(function() {
899
+ if (!Buffer3.isBuffer(this)) return void 0;
900
+ return this.buffer;
901
+ }, "get")
902
+ });
903
+ Object.defineProperty(Buffer3.prototype, "offset", {
904
+ enumerable: true,
905
+ get: /* @__PURE__ */ __name(function() {
906
+ if (!Buffer3.isBuffer(this)) return void 0;
907
+ return this.byteOffset;
908
+ }, "get")
909
+ });
910
+ function createBuffer(length) {
911
+ if (length > K_MAX_LENGTH) {
912
+ throw new RangeError('The value "' + length + '" is invalid for option "size"');
913
+ }
914
+ const buf = new Uint8Array(length);
915
+ Object.setPrototypeOf(buf, Buffer3.prototype);
916
+ return buf;
917
+ }
918
+ __name(createBuffer, "createBuffer");
919
+ function Buffer3(arg, encodingOrOffset, length) {
920
+ if (typeof arg === "number") {
921
+ if (typeof encodingOrOffset === "string") {
922
+ throw new TypeError('The "string" argument must be of type string. Received type number');
923
+ }
924
+ return allocUnsafe(arg);
925
+ }
926
+ return from(arg, encodingOrOffset, length);
738
927
  }
739
- return `//${path6}`;
740
- }
741
- return isPathAbsolute && !isAbsolute(path6) ? `/${path6}` : path6;
742
- }, "correctPaths");
743
- var joinPaths = /* @__PURE__ */ __name(function(...segments) {
744
- let path6 = "";
745
- for (const seg of segments) {
746
- if (!seg) {
747
- continue;
928
+ __name(Buffer3, "Buffer");
929
+ Buffer3.poolSize = 8192;
930
+ function from(value, encodingOrOffset, length) {
931
+ if (typeof value === "string") {
932
+ return fromString(value, encodingOrOffset);
933
+ }
934
+ if (ArrayBuffer.isView(value)) {
935
+ return fromArrayView(value);
936
+ }
937
+ if (value == null) {
938
+ throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);
939
+ }
940
+ if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {
941
+ return fromArrayBuffer(value, encodingOrOffset, length);
942
+ }
943
+ if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) {
944
+ return fromArrayBuffer(value, encodingOrOffset, length);
945
+ }
946
+ if (typeof value === "number") {
947
+ throw new TypeError('The "value" argument must not be of type number. Received type number');
948
+ }
949
+ const valueOf = value.valueOf && value.valueOf();
950
+ if (valueOf != null && valueOf !== value) {
951
+ return Buffer3.from(valueOf, encodingOrOffset, length);
952
+ }
953
+ const b = fromObject(value);
954
+ if (b) return b;
955
+ if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
956
+ return Buffer3.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);
957
+ }
958
+ throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);
748
959
  }
749
- if (path6.length > 0) {
750
- const pathTrailing = path6[path6.length - 1] === "/";
751
- const segLeading = seg[0] === "/";
752
- const both = pathTrailing && segLeading;
753
- if (both) {
754
- path6 += seg.slice(1);
960
+ __name(from, "from");
961
+ Buffer3.from = function(value, encodingOrOffset, length) {
962
+ return from(value, encodingOrOffset, length);
963
+ };
964
+ Object.setPrototypeOf(Buffer3.prototype, Uint8Array.prototype);
965
+ Object.setPrototypeOf(Buffer3, Uint8Array);
966
+ function assertSize(size) {
967
+ if (typeof size !== "number") {
968
+ throw new TypeError('"size" argument must be of type number');
969
+ } else if (size < 0) {
970
+ throw new RangeError('The value "' + size + '" is invalid for option "size"');
971
+ }
972
+ }
973
+ __name(assertSize, "assertSize");
974
+ function alloc(size, fill, encoding) {
975
+ assertSize(size);
976
+ if (size <= 0) {
977
+ return createBuffer(size);
978
+ }
979
+ if (fill !== void 0) {
980
+ return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);
981
+ }
982
+ return createBuffer(size);
983
+ }
984
+ __name(alloc, "alloc");
985
+ Buffer3.alloc = function(size, fill, encoding) {
986
+ return alloc(size, fill, encoding);
987
+ };
988
+ function allocUnsafe(size) {
989
+ assertSize(size);
990
+ return createBuffer(size < 0 ? 0 : checked(size) | 0);
991
+ }
992
+ __name(allocUnsafe, "allocUnsafe");
993
+ Buffer3.allocUnsafe = function(size) {
994
+ return allocUnsafe(size);
995
+ };
996
+ Buffer3.allocUnsafeSlow = function(size) {
997
+ return allocUnsafe(size);
998
+ };
999
+ function fromString(string, encoding) {
1000
+ if (typeof encoding !== "string" || encoding === "") {
1001
+ encoding = "utf8";
1002
+ }
1003
+ if (!Buffer3.isEncoding(encoding)) {
1004
+ throw new TypeError("Unknown encoding: " + encoding);
1005
+ }
1006
+ const length = byteLength(string, encoding) | 0;
1007
+ let buf = createBuffer(length);
1008
+ const actual = buf.write(string, encoding);
1009
+ if (actual !== length) {
1010
+ buf = buf.slice(0, actual);
1011
+ }
1012
+ return buf;
1013
+ }
1014
+ __name(fromString, "fromString");
1015
+ function fromArrayLike(array) {
1016
+ const length = array.length < 0 ? 0 : checked(array.length) | 0;
1017
+ const buf = createBuffer(length);
1018
+ for (let i = 0; i < length; i += 1) {
1019
+ buf[i] = array[i] & 255;
1020
+ }
1021
+ return buf;
1022
+ }
1023
+ __name(fromArrayLike, "fromArrayLike");
1024
+ function fromArrayView(arrayView) {
1025
+ if (isInstance(arrayView, Uint8Array)) {
1026
+ const copy2 = new Uint8Array(arrayView);
1027
+ return fromArrayBuffer(copy2.buffer, copy2.byteOffset, copy2.byteLength);
1028
+ }
1029
+ return fromArrayLike(arrayView);
1030
+ }
1031
+ __name(fromArrayView, "fromArrayView");
1032
+ function fromArrayBuffer(array, byteOffset, length) {
1033
+ if (byteOffset < 0 || array.byteLength < byteOffset) {
1034
+ throw new RangeError('"offset" is outside of buffer bounds');
1035
+ }
1036
+ if (array.byteLength < byteOffset + (length || 0)) {
1037
+ throw new RangeError('"length" is outside of buffer bounds');
1038
+ }
1039
+ let buf;
1040
+ if (byteOffset === void 0 && length === void 0) {
1041
+ buf = new Uint8Array(array);
1042
+ } else if (length === void 0) {
1043
+ buf = new Uint8Array(array, byteOffset);
755
1044
  } else {
756
- path6 += pathTrailing || segLeading ? seg : `/${seg}`;
1045
+ buf = new Uint8Array(array, byteOffset, length);
1046
+ }
1047
+ Object.setPrototypeOf(buf, Buffer3.prototype);
1048
+ return buf;
1049
+ }
1050
+ __name(fromArrayBuffer, "fromArrayBuffer");
1051
+ function fromObject(obj) {
1052
+ if (Buffer3.isBuffer(obj)) {
1053
+ const len = checked(obj.length) | 0;
1054
+ const buf = createBuffer(len);
1055
+ if (buf.length === 0) {
1056
+ return buf;
1057
+ }
1058
+ obj.copy(buf, 0, 0, len);
1059
+ return buf;
1060
+ }
1061
+ if (obj.length !== void 0) {
1062
+ if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {
1063
+ return createBuffer(0);
1064
+ }
1065
+ return fromArrayLike(obj);
1066
+ }
1067
+ if (obj.type === "Buffer" && Array.isArray(obj.data)) {
1068
+ return fromArrayLike(obj.data);
757
1069
  }
758
- } else {
759
- path6 += seg;
760
1070
  }
761
- }
762
- return correctPaths(path6);
763
- }, "joinPaths");
764
- function normalizeString(path6, allowAboveRoot) {
765
- let res = "";
766
- let lastSegmentLength = 0;
767
- let lastSlash = -1;
768
- let dots = 0;
769
- let char = null;
770
- for (let index = 0; index <= path6.length; ++index) {
771
- if (index < path6.length) {
772
- char = path6[index];
773
- } else if (char === "/") {
774
- break;
775
- } else {
776
- char = "/";
1071
+ __name(fromObject, "fromObject");
1072
+ function checked(length) {
1073
+ if (length >= K_MAX_LENGTH) {
1074
+ throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");
1075
+ }
1076
+ return length | 0;
777
1077
  }
778
- if (char === "/") {
779
- if (lastSlash === index - 1 || dots === 1) {
780
- } else if (dots === 2) {
781
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
782
- if (res.length > 2) {
783
- const lastSlashIndex = res.lastIndexOf("/");
784
- if (lastSlashIndex === -1) {
785
- res = "";
786
- lastSegmentLength = 0;
787
- } else {
788
- res = res.slice(0, lastSlashIndex);
789
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
1078
+ __name(checked, "checked");
1079
+ function SlowBuffer(length) {
1080
+ if (+length != length) {
1081
+ length = 0;
1082
+ }
1083
+ return Buffer3.alloc(+length);
1084
+ }
1085
+ __name(SlowBuffer, "SlowBuffer");
1086
+ Buffer3.isBuffer = /* @__PURE__ */ __name(function isBuffer(b) {
1087
+ return b != null && b._isBuffer === true && b !== Buffer3.prototype;
1088
+ }, "isBuffer");
1089
+ Buffer3.compare = /* @__PURE__ */ __name(function compare(a, b) {
1090
+ if (isInstance(a, Uint8Array)) a = Buffer3.from(a, a.offset, a.byteLength);
1091
+ if (isInstance(b, Uint8Array)) b = Buffer3.from(b, b.offset, b.byteLength);
1092
+ if (!Buffer3.isBuffer(a) || !Buffer3.isBuffer(b)) {
1093
+ throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');
1094
+ }
1095
+ if (a === b) return 0;
1096
+ let x = a.length;
1097
+ let y = b.length;
1098
+ for (let i = 0, len = Math.min(x, y); i < len; ++i) {
1099
+ if (a[i] !== b[i]) {
1100
+ x = a[i];
1101
+ y = b[i];
1102
+ break;
1103
+ }
1104
+ }
1105
+ if (x < y) return -1;
1106
+ if (y < x) return 1;
1107
+ return 0;
1108
+ }, "compare");
1109
+ Buffer3.isEncoding = /* @__PURE__ */ __name(function isEncoding(encoding) {
1110
+ switch (String(encoding).toLowerCase()) {
1111
+ case "hex":
1112
+ case "utf8":
1113
+ case "utf-8":
1114
+ case "ascii":
1115
+ case "latin1":
1116
+ case "binary":
1117
+ case "base64":
1118
+ case "ucs2":
1119
+ case "ucs-2":
1120
+ case "utf16le":
1121
+ case "utf-16le":
1122
+ return true;
1123
+ default:
1124
+ return false;
1125
+ }
1126
+ }, "isEncoding");
1127
+ Buffer3.concat = /* @__PURE__ */ __name(function concat(list, length) {
1128
+ if (!Array.isArray(list)) {
1129
+ throw new TypeError('"list" argument must be an Array of Buffers');
1130
+ }
1131
+ if (list.length === 0) {
1132
+ return Buffer3.alloc(0);
1133
+ }
1134
+ let i;
1135
+ if (length === void 0) {
1136
+ length = 0;
1137
+ for (i = 0; i < list.length; ++i) {
1138
+ length += list[i].length;
1139
+ }
1140
+ }
1141
+ const buffer = Buffer3.allocUnsafe(length);
1142
+ let pos = 0;
1143
+ for (i = 0; i < list.length; ++i) {
1144
+ let buf = list[i];
1145
+ if (isInstance(buf, Uint8Array)) {
1146
+ if (pos + buf.length > buffer.length) {
1147
+ if (!Buffer3.isBuffer(buf)) buf = Buffer3.from(buf);
1148
+ buf.copy(buffer, pos);
1149
+ } else {
1150
+ Uint8Array.prototype.set.call(buffer, buf, pos);
1151
+ }
1152
+ } else if (!Buffer3.isBuffer(buf)) {
1153
+ throw new TypeError('"list" argument must be an Array of Buffers');
1154
+ } else {
1155
+ buf.copy(buffer, pos);
1156
+ }
1157
+ pos += buf.length;
1158
+ }
1159
+ return buffer;
1160
+ }, "concat");
1161
+ function byteLength(string, encoding) {
1162
+ if (Buffer3.isBuffer(string)) {
1163
+ return string.length;
1164
+ }
1165
+ if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
1166
+ return string.byteLength;
1167
+ }
1168
+ if (typeof string !== "string") {
1169
+ throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string);
1170
+ }
1171
+ const len = string.length;
1172
+ const mustMatch = arguments.length > 2 && arguments[2] === true;
1173
+ if (!mustMatch && len === 0) return 0;
1174
+ let loweredCase = false;
1175
+ for (; ; ) {
1176
+ switch (encoding) {
1177
+ case "ascii":
1178
+ case "latin1":
1179
+ case "binary":
1180
+ return len;
1181
+ case "utf8":
1182
+ case "utf-8":
1183
+ return utf8ToBytes(string).length;
1184
+ case "ucs2":
1185
+ case "ucs-2":
1186
+ case "utf16le":
1187
+ case "utf-16le":
1188
+ return len * 2;
1189
+ case "hex":
1190
+ return len >>> 1;
1191
+ case "base64":
1192
+ return base64ToBytes(string).length;
1193
+ default:
1194
+ if (loweredCase) {
1195
+ return mustMatch ? -1 : utf8ToBytes(string).length;
790
1196
  }
791
- lastSlash = index;
792
- dots = 0;
793
- continue;
794
- } else if (res.length > 0) {
795
- res = "";
796
- lastSegmentLength = 0;
797
- lastSlash = index;
798
- dots = 0;
799
- continue;
1197
+ encoding = ("" + encoding).toLowerCase();
1198
+ loweredCase = true;
1199
+ }
1200
+ }
1201
+ }
1202
+ __name(byteLength, "byteLength");
1203
+ Buffer3.byteLength = byteLength;
1204
+ function slowToString(encoding, start, end) {
1205
+ let loweredCase = false;
1206
+ if (start === void 0 || start < 0) {
1207
+ start = 0;
1208
+ }
1209
+ if (start > this.length) {
1210
+ return "";
1211
+ }
1212
+ if (end === void 0 || end > this.length) {
1213
+ end = this.length;
1214
+ }
1215
+ if (end <= 0) {
1216
+ return "";
1217
+ }
1218
+ end >>>= 0;
1219
+ start >>>= 0;
1220
+ if (end <= start) {
1221
+ return "";
1222
+ }
1223
+ if (!encoding) encoding = "utf8";
1224
+ while (true) {
1225
+ switch (encoding) {
1226
+ case "hex":
1227
+ return hexSlice(this, start, end);
1228
+ case "utf8":
1229
+ case "utf-8":
1230
+ return utf8Slice(this, start, end);
1231
+ case "ascii":
1232
+ return asciiSlice(this, start, end);
1233
+ case "latin1":
1234
+ case "binary":
1235
+ return latin1Slice(this, start, end);
1236
+ case "base64":
1237
+ return base64Slice(this, start, end);
1238
+ case "ucs2":
1239
+ case "ucs-2":
1240
+ case "utf16le":
1241
+ case "utf-16le":
1242
+ return utf16leSlice(this, start, end);
1243
+ default:
1244
+ if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
1245
+ encoding = (encoding + "").toLowerCase();
1246
+ loweredCase = true;
1247
+ }
1248
+ }
1249
+ }
1250
+ __name(slowToString, "slowToString");
1251
+ Buffer3.prototype._isBuffer = true;
1252
+ function swap(b, n, m) {
1253
+ const i = b[n];
1254
+ b[n] = b[m];
1255
+ b[m] = i;
1256
+ }
1257
+ __name(swap, "swap");
1258
+ Buffer3.prototype.swap16 = /* @__PURE__ */ __name(function swap16() {
1259
+ const len = this.length;
1260
+ if (len % 2 !== 0) {
1261
+ throw new RangeError("Buffer size must be a multiple of 16-bits");
1262
+ }
1263
+ for (let i = 0; i < len; i += 2) {
1264
+ swap(this, i, i + 1);
1265
+ }
1266
+ return this;
1267
+ }, "swap16");
1268
+ Buffer3.prototype.swap32 = /* @__PURE__ */ __name(function swap32() {
1269
+ const len = this.length;
1270
+ if (len % 4 !== 0) {
1271
+ throw new RangeError("Buffer size must be a multiple of 32-bits");
1272
+ }
1273
+ for (let i = 0; i < len; i += 4) {
1274
+ swap(this, i, i + 3);
1275
+ swap(this, i + 1, i + 2);
1276
+ }
1277
+ return this;
1278
+ }, "swap32");
1279
+ Buffer3.prototype.swap64 = /* @__PURE__ */ __name(function swap64() {
1280
+ const len = this.length;
1281
+ if (len % 8 !== 0) {
1282
+ throw new RangeError("Buffer size must be a multiple of 64-bits");
1283
+ }
1284
+ for (let i = 0; i < len; i += 8) {
1285
+ swap(this, i, i + 7);
1286
+ swap(this, i + 1, i + 6);
1287
+ swap(this, i + 2, i + 5);
1288
+ swap(this, i + 3, i + 4);
1289
+ }
1290
+ return this;
1291
+ }, "swap64");
1292
+ Buffer3.prototype.toString = /* @__PURE__ */ __name(function toString() {
1293
+ const length = this.length;
1294
+ if (length === 0) return "";
1295
+ if (arguments.length === 0) return utf8Slice(this, 0, length);
1296
+ return slowToString.apply(this, arguments);
1297
+ }, "toString");
1298
+ Buffer3.prototype.toLocaleString = Buffer3.prototype.toString;
1299
+ Buffer3.prototype.equals = /* @__PURE__ */ __name(function equals(b) {
1300
+ if (!Buffer3.isBuffer(b)) throw new TypeError("Argument must be a Buffer");
1301
+ if (this === b) return true;
1302
+ return Buffer3.compare(this, b) === 0;
1303
+ }, "equals");
1304
+ Buffer3.prototype.inspect = /* @__PURE__ */ __name(function inspect() {
1305
+ let str = "";
1306
+ const max = exports2.INSPECT_MAX_BYTES;
1307
+ str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
1308
+ if (this.length > max) str += " ... ";
1309
+ return "<Buffer " + str + ">";
1310
+ }, "inspect");
1311
+ if (customInspectSymbol) {
1312
+ Buffer3.prototype[customInspectSymbol] = Buffer3.prototype.inspect;
1313
+ }
1314
+ Buffer3.prototype.compare = /* @__PURE__ */ __name(function compare(target, start, end, thisStart, thisEnd) {
1315
+ if (isInstance(target, Uint8Array)) {
1316
+ target = Buffer3.from(target, target.offset, target.byteLength);
1317
+ }
1318
+ if (!Buffer3.isBuffer(target)) {
1319
+ throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target);
1320
+ }
1321
+ if (start === void 0) {
1322
+ start = 0;
1323
+ }
1324
+ if (end === void 0) {
1325
+ end = target ? target.length : 0;
1326
+ }
1327
+ if (thisStart === void 0) {
1328
+ thisStart = 0;
1329
+ }
1330
+ if (thisEnd === void 0) {
1331
+ thisEnd = this.length;
1332
+ }
1333
+ if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
1334
+ throw new RangeError("out of range index");
1335
+ }
1336
+ if (thisStart >= thisEnd && start >= end) {
1337
+ return 0;
1338
+ }
1339
+ if (thisStart >= thisEnd) {
1340
+ return -1;
1341
+ }
1342
+ if (start >= end) {
1343
+ return 1;
1344
+ }
1345
+ start >>>= 0;
1346
+ end >>>= 0;
1347
+ thisStart >>>= 0;
1348
+ thisEnd >>>= 0;
1349
+ if (this === target) return 0;
1350
+ let x = thisEnd - thisStart;
1351
+ let y = end - start;
1352
+ const len = Math.min(x, y);
1353
+ const thisCopy = this.slice(thisStart, thisEnd);
1354
+ const targetCopy = target.slice(start, end);
1355
+ for (let i = 0; i < len; ++i) {
1356
+ if (thisCopy[i] !== targetCopy[i]) {
1357
+ x = thisCopy[i];
1358
+ y = targetCopy[i];
1359
+ break;
1360
+ }
1361
+ }
1362
+ if (x < y) return -1;
1363
+ if (y < x) return 1;
1364
+ return 0;
1365
+ }, "compare");
1366
+ function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
1367
+ if (buffer.length === 0) return -1;
1368
+ if (typeof byteOffset === "string") {
1369
+ encoding = byteOffset;
1370
+ byteOffset = 0;
1371
+ } else if (byteOffset > 2147483647) {
1372
+ byteOffset = 2147483647;
1373
+ } else if (byteOffset < -2147483648) {
1374
+ byteOffset = -2147483648;
1375
+ }
1376
+ byteOffset = +byteOffset;
1377
+ if (numberIsNaN(byteOffset)) {
1378
+ byteOffset = dir ? 0 : buffer.length - 1;
1379
+ }
1380
+ if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
1381
+ if (byteOffset >= buffer.length) {
1382
+ if (dir) return -1;
1383
+ else byteOffset = buffer.length - 1;
1384
+ } else if (byteOffset < 0) {
1385
+ if (dir) byteOffset = 0;
1386
+ else return -1;
1387
+ }
1388
+ if (typeof val === "string") {
1389
+ val = Buffer3.from(val, encoding);
1390
+ }
1391
+ if (Buffer3.isBuffer(val)) {
1392
+ if (val.length === 0) {
1393
+ return -1;
1394
+ }
1395
+ return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
1396
+ } else if (typeof val === "number") {
1397
+ val = val & 255;
1398
+ if (typeof Uint8Array.prototype.indexOf === "function") {
1399
+ if (dir) {
1400
+ return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
1401
+ } else {
1402
+ return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
800
1403
  }
801
1404
  }
802
- if (allowAboveRoot) {
803
- res += res.length > 0 ? "/.." : "..";
804
- lastSegmentLength = 2;
1405
+ return arrayIndexOf(buffer, [
1406
+ val
1407
+ ], byteOffset, encoding, dir);
1408
+ }
1409
+ throw new TypeError("val must be string, number or Buffer");
1410
+ }
1411
+ __name(bidirectionalIndexOf, "bidirectionalIndexOf");
1412
+ function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
1413
+ let indexSize = 1;
1414
+ let arrLength = arr.length;
1415
+ let valLength = val.length;
1416
+ if (encoding !== void 0) {
1417
+ encoding = String(encoding).toLowerCase();
1418
+ if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
1419
+ if (arr.length < 2 || val.length < 2) {
1420
+ return -1;
1421
+ }
1422
+ indexSize = 2;
1423
+ arrLength /= 2;
1424
+ valLength /= 2;
1425
+ byteOffset /= 2;
1426
+ }
1427
+ }
1428
+ function read(buf, i2) {
1429
+ if (indexSize === 1) {
1430
+ return buf[i2];
1431
+ } else {
1432
+ return buf.readUInt16BE(i2 * indexSize);
1433
+ }
1434
+ }
1435
+ __name(read, "read");
1436
+ let i;
1437
+ if (dir) {
1438
+ let foundIndex = -1;
1439
+ for (i = byteOffset; i < arrLength; i++) {
1440
+ if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
1441
+ if (foundIndex === -1) foundIndex = i;
1442
+ if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
1443
+ } else {
1444
+ if (foundIndex !== -1) i -= i - foundIndex;
1445
+ foundIndex = -1;
1446
+ }
805
1447
  }
806
1448
  } else {
807
- if (res.length > 0) {
808
- res += `/${path6.slice(lastSlash + 1, index)}`;
1449
+ if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
1450
+ for (i = byteOffset; i >= 0; i--) {
1451
+ let found = true;
1452
+ for (let j = 0; j < valLength; j++) {
1453
+ if (read(arr, i + j) !== read(val, j)) {
1454
+ found = false;
1455
+ break;
1456
+ }
1457
+ }
1458
+ if (found) return i;
1459
+ }
1460
+ }
1461
+ return -1;
1462
+ }
1463
+ __name(arrayIndexOf, "arrayIndexOf");
1464
+ Buffer3.prototype.includes = /* @__PURE__ */ __name(function includes2(val, byteOffset, encoding) {
1465
+ return this.indexOf(val, byteOffset, encoding) !== -1;
1466
+ }, "includes");
1467
+ Buffer3.prototype.indexOf = /* @__PURE__ */ __name(function indexOf(val, byteOffset, encoding) {
1468
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
1469
+ }, "indexOf");
1470
+ Buffer3.prototype.lastIndexOf = /* @__PURE__ */ __name(function lastIndexOf(val, byteOffset, encoding) {
1471
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
1472
+ }, "lastIndexOf");
1473
+ function hexWrite(buf, string, offset, length) {
1474
+ offset = Number(offset) || 0;
1475
+ const remaining = buf.length - offset;
1476
+ if (!length) {
1477
+ length = remaining;
1478
+ } else {
1479
+ length = Number(length);
1480
+ if (length > remaining) {
1481
+ length = remaining;
1482
+ }
1483
+ }
1484
+ const strLen = string.length;
1485
+ if (length > strLen / 2) {
1486
+ length = strLen / 2;
1487
+ }
1488
+ let i;
1489
+ for (i = 0; i < length; ++i) {
1490
+ const parsed = parseInt(string.substr(i * 2, 2), 16);
1491
+ if (numberIsNaN(parsed)) return i;
1492
+ buf[offset + i] = parsed;
1493
+ }
1494
+ return i;
1495
+ }
1496
+ __name(hexWrite, "hexWrite");
1497
+ function utf8Write(buf, string, offset, length) {
1498
+ return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
1499
+ }
1500
+ __name(utf8Write, "utf8Write");
1501
+ function asciiWrite(buf, string, offset, length) {
1502
+ return blitBuffer(asciiToBytes(string), buf, offset, length);
1503
+ }
1504
+ __name(asciiWrite, "asciiWrite");
1505
+ function base64Write(buf, string, offset, length) {
1506
+ return blitBuffer(base64ToBytes(string), buf, offset, length);
1507
+ }
1508
+ __name(base64Write, "base64Write");
1509
+ function ucs2Write(buf, string, offset, length) {
1510
+ return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
1511
+ }
1512
+ __name(ucs2Write, "ucs2Write");
1513
+ Buffer3.prototype.write = /* @__PURE__ */ __name(function write(string, offset, length, encoding) {
1514
+ if (offset === void 0) {
1515
+ encoding = "utf8";
1516
+ length = this.length;
1517
+ offset = 0;
1518
+ } else if (length === void 0 && typeof offset === "string") {
1519
+ encoding = offset;
1520
+ length = this.length;
1521
+ offset = 0;
1522
+ } else if (isFinite(offset)) {
1523
+ offset = offset >>> 0;
1524
+ if (isFinite(length)) {
1525
+ length = length >>> 0;
1526
+ if (encoding === void 0) encoding = "utf8";
809
1527
  } else {
810
- res = path6.slice(lastSlash + 1, index);
1528
+ encoding = length;
1529
+ length = void 0;
811
1530
  }
812
- lastSegmentLength = index - lastSlash - 1;
1531
+ } else {
1532
+ throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
1533
+ }
1534
+ const remaining = this.length - offset;
1535
+ if (length === void 0 || length > remaining) length = remaining;
1536
+ if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
1537
+ throw new RangeError("Attempt to write outside buffer bounds");
1538
+ }
1539
+ if (!encoding) encoding = "utf8";
1540
+ let loweredCase = false;
1541
+ for (; ; ) {
1542
+ switch (encoding) {
1543
+ case "hex":
1544
+ return hexWrite(this, string, offset, length);
1545
+ case "utf8":
1546
+ case "utf-8":
1547
+ return utf8Write(this, string, offset, length);
1548
+ case "ascii":
1549
+ case "latin1":
1550
+ case "binary":
1551
+ return asciiWrite(this, string, offset, length);
1552
+ case "base64":
1553
+ return base64Write(this, string, offset, length);
1554
+ case "ucs2":
1555
+ case "ucs-2":
1556
+ case "utf16le":
1557
+ case "utf-16le":
1558
+ return ucs2Write(this, string, offset, length);
1559
+ default:
1560
+ if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
1561
+ encoding = ("" + encoding).toLowerCase();
1562
+ loweredCase = true;
1563
+ }
1564
+ }
1565
+ }, "write");
1566
+ Buffer3.prototype.toJSON = /* @__PURE__ */ __name(function toJSON() {
1567
+ return {
1568
+ type: "Buffer",
1569
+ data: Array.prototype.slice.call(this._arr || this, 0)
1570
+ };
1571
+ }, "toJSON");
1572
+ function base64Slice(buf, start, end) {
1573
+ if (start === 0 && end === buf.length) {
1574
+ return base64.fromByteArray(buf);
1575
+ } else {
1576
+ return base64.fromByteArray(buf.slice(start, end));
813
1577
  }
814
- lastSlash = index;
815
- dots = 0;
816
- } else if (char === "." && dots !== -1) {
817
- ++dots;
818
- } else {
819
- dots = -1;
820
1578
  }
821
- }
1579
+ __name(base64Slice, "base64Slice");
1580
+ function utf8Slice(buf, start, end) {
1581
+ end = Math.min(buf.length, end);
1582
+ const res = [];
1583
+ let i = start;
1584
+ while (i < end) {
1585
+ const firstByte = buf[i];
1586
+ let codePoint = null;
1587
+ let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
1588
+ if (i + bytesPerSequence <= end) {
1589
+ let secondByte, thirdByte, fourthByte, tempCodePoint;
1590
+ switch (bytesPerSequence) {
1591
+ case 1:
1592
+ if (firstByte < 128) {
1593
+ codePoint = firstByte;
1594
+ }
1595
+ break;
1596
+ case 2:
1597
+ secondByte = buf[i + 1];
1598
+ if ((secondByte & 192) === 128) {
1599
+ tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
1600
+ if (tempCodePoint > 127) {
1601
+ codePoint = tempCodePoint;
1602
+ }
1603
+ }
1604
+ break;
1605
+ case 3:
1606
+ secondByte = buf[i + 1];
1607
+ thirdByte = buf[i + 2];
1608
+ if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
1609
+ tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
1610
+ if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
1611
+ codePoint = tempCodePoint;
1612
+ }
1613
+ }
1614
+ break;
1615
+ case 4:
1616
+ secondByte = buf[i + 1];
1617
+ thirdByte = buf[i + 2];
1618
+ fourthByte = buf[i + 3];
1619
+ if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
1620
+ tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
1621
+ if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
1622
+ codePoint = tempCodePoint;
1623
+ }
1624
+ }
1625
+ }
1626
+ }
1627
+ if (codePoint === null) {
1628
+ codePoint = 65533;
1629
+ bytesPerSequence = 1;
1630
+ } else if (codePoint > 65535) {
1631
+ codePoint -= 65536;
1632
+ res.push(codePoint >>> 10 & 1023 | 55296);
1633
+ codePoint = 56320 | codePoint & 1023;
1634
+ }
1635
+ res.push(codePoint);
1636
+ i += bytesPerSequence;
1637
+ }
1638
+ return decodeCodePointsArray(res);
1639
+ }
1640
+ __name(utf8Slice, "utf8Slice");
1641
+ var MAX_ARGUMENTS_LENGTH = 4096;
1642
+ function decodeCodePointsArray(codePoints) {
1643
+ const len = codePoints.length;
1644
+ if (len <= MAX_ARGUMENTS_LENGTH) {
1645
+ return String.fromCharCode.apply(String, codePoints);
1646
+ }
1647
+ let res = "";
1648
+ let i = 0;
1649
+ while (i < len) {
1650
+ res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
1651
+ }
1652
+ return res;
1653
+ }
1654
+ __name(decodeCodePointsArray, "decodeCodePointsArray");
1655
+ function asciiSlice(buf, start, end) {
1656
+ let ret = "";
1657
+ end = Math.min(buf.length, end);
1658
+ for (let i = start; i < end; ++i) {
1659
+ ret += String.fromCharCode(buf[i] & 127);
1660
+ }
1661
+ return ret;
1662
+ }
1663
+ __name(asciiSlice, "asciiSlice");
1664
+ function latin1Slice(buf, start, end) {
1665
+ let ret = "";
1666
+ end = Math.min(buf.length, end);
1667
+ for (let i = start; i < end; ++i) {
1668
+ ret += String.fromCharCode(buf[i]);
1669
+ }
1670
+ return ret;
1671
+ }
1672
+ __name(latin1Slice, "latin1Slice");
1673
+ function hexSlice(buf, start, end) {
1674
+ const len = buf.length;
1675
+ if (!start || start < 0) start = 0;
1676
+ if (!end || end < 0 || end > len) end = len;
1677
+ let out = "";
1678
+ for (let i = start; i < end; ++i) {
1679
+ out += hexSliceLookupTable[buf[i]];
1680
+ }
1681
+ return out;
1682
+ }
1683
+ __name(hexSlice, "hexSlice");
1684
+ function utf16leSlice(buf, start, end) {
1685
+ const bytes = buf.slice(start, end);
1686
+ let res = "";
1687
+ for (let i = 0; i < bytes.length - 1; i += 2) {
1688
+ res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
1689
+ }
1690
+ return res;
1691
+ }
1692
+ __name(utf16leSlice, "utf16leSlice");
1693
+ Buffer3.prototype.slice = /* @__PURE__ */ __name(function slice(start, end) {
1694
+ const len = this.length;
1695
+ start = ~~start;
1696
+ end = end === void 0 ? len : ~~end;
1697
+ if (start < 0) {
1698
+ start += len;
1699
+ if (start < 0) start = 0;
1700
+ } else if (start > len) {
1701
+ start = len;
1702
+ }
1703
+ if (end < 0) {
1704
+ end += len;
1705
+ if (end < 0) end = 0;
1706
+ } else if (end > len) {
1707
+ end = len;
1708
+ }
1709
+ if (end < start) end = start;
1710
+ const newBuf = this.subarray(start, end);
1711
+ Object.setPrototypeOf(newBuf, Buffer3.prototype);
1712
+ return newBuf;
1713
+ }, "slice");
1714
+ function checkOffset(offset, ext, length) {
1715
+ if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
1716
+ if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
1717
+ }
1718
+ __name(checkOffset, "checkOffset");
1719
+ Buffer3.prototype.readUintLE = Buffer3.prototype.readUIntLE = /* @__PURE__ */ __name(function readUIntLE(offset, byteLength2, noAssert) {
1720
+ offset = offset >>> 0;
1721
+ byteLength2 = byteLength2 >>> 0;
1722
+ if (!noAssert) checkOffset(offset, byteLength2, this.length);
1723
+ let val = this[offset];
1724
+ let mul = 1;
1725
+ let i = 0;
1726
+ while (++i < byteLength2 && (mul *= 256)) {
1727
+ val += this[offset + i] * mul;
1728
+ }
1729
+ return val;
1730
+ }, "readUIntLE");
1731
+ Buffer3.prototype.readUintBE = Buffer3.prototype.readUIntBE = /* @__PURE__ */ __name(function readUIntBE(offset, byteLength2, noAssert) {
1732
+ offset = offset >>> 0;
1733
+ byteLength2 = byteLength2 >>> 0;
1734
+ if (!noAssert) {
1735
+ checkOffset(offset, byteLength2, this.length);
1736
+ }
1737
+ let val = this[offset + --byteLength2];
1738
+ let mul = 1;
1739
+ while (byteLength2 > 0 && (mul *= 256)) {
1740
+ val += this[offset + --byteLength2] * mul;
1741
+ }
1742
+ return val;
1743
+ }, "readUIntBE");
1744
+ Buffer3.prototype.readUint8 = Buffer3.prototype.readUInt8 = /* @__PURE__ */ __name(function readUInt8(offset, noAssert) {
1745
+ offset = offset >>> 0;
1746
+ if (!noAssert) checkOffset(offset, 1, this.length);
1747
+ return this[offset];
1748
+ }, "readUInt8");
1749
+ Buffer3.prototype.readUint16LE = Buffer3.prototype.readUInt16LE = /* @__PURE__ */ __name(function readUInt16LE(offset, noAssert) {
1750
+ offset = offset >>> 0;
1751
+ if (!noAssert) checkOffset(offset, 2, this.length);
1752
+ return this[offset] | this[offset + 1] << 8;
1753
+ }, "readUInt16LE");
1754
+ Buffer3.prototype.readUint16BE = Buffer3.prototype.readUInt16BE = /* @__PURE__ */ __name(function readUInt16BE(offset, noAssert) {
1755
+ offset = offset >>> 0;
1756
+ if (!noAssert) checkOffset(offset, 2, this.length);
1757
+ return this[offset] << 8 | this[offset + 1];
1758
+ }, "readUInt16BE");
1759
+ Buffer3.prototype.readUint32LE = Buffer3.prototype.readUInt32LE = /* @__PURE__ */ __name(function readUInt32LE(offset, noAssert) {
1760
+ offset = offset >>> 0;
1761
+ if (!noAssert) checkOffset(offset, 4, this.length);
1762
+ return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
1763
+ }, "readUInt32LE");
1764
+ Buffer3.prototype.readUint32BE = Buffer3.prototype.readUInt32BE = /* @__PURE__ */ __name(function readUInt32BE(offset, noAssert) {
1765
+ offset = offset >>> 0;
1766
+ if (!noAssert) checkOffset(offset, 4, this.length);
1767
+ return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
1768
+ }, "readUInt32BE");
1769
+ Buffer3.prototype.readBigUInt64LE = defineBigIntMethod(/* @__PURE__ */ __name(function readBigUInt64LE(offset) {
1770
+ offset = offset >>> 0;
1771
+ validateNumber(offset, "offset");
1772
+ const first = this[offset];
1773
+ const last = this[offset + 7];
1774
+ if (first === void 0 || last === void 0) {
1775
+ boundsError(offset, this.length - 8);
1776
+ }
1777
+ const lo = first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24;
1778
+ const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24;
1779
+ return BigInt(lo) + (BigInt(hi) << BigInt(32));
1780
+ }, "readBigUInt64LE"));
1781
+ Buffer3.prototype.readBigUInt64BE = defineBigIntMethod(/* @__PURE__ */ __name(function readBigUInt64BE(offset) {
1782
+ offset = offset >>> 0;
1783
+ validateNumber(offset, "offset");
1784
+ const first = this[offset];
1785
+ const last = this[offset + 7];
1786
+ if (first === void 0 || last === void 0) {
1787
+ boundsError(offset, this.length - 8);
1788
+ }
1789
+ const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
1790
+ const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last;
1791
+ return (BigInt(hi) << BigInt(32)) + BigInt(lo);
1792
+ }, "readBigUInt64BE"));
1793
+ Buffer3.prototype.readIntLE = /* @__PURE__ */ __name(function readIntLE(offset, byteLength2, noAssert) {
1794
+ offset = offset >>> 0;
1795
+ byteLength2 = byteLength2 >>> 0;
1796
+ if (!noAssert) checkOffset(offset, byteLength2, this.length);
1797
+ let val = this[offset];
1798
+ let mul = 1;
1799
+ let i = 0;
1800
+ while (++i < byteLength2 && (mul *= 256)) {
1801
+ val += this[offset + i] * mul;
1802
+ }
1803
+ mul *= 128;
1804
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength2);
1805
+ return val;
1806
+ }, "readIntLE");
1807
+ Buffer3.prototype.readIntBE = /* @__PURE__ */ __name(function readIntBE(offset, byteLength2, noAssert) {
1808
+ offset = offset >>> 0;
1809
+ byteLength2 = byteLength2 >>> 0;
1810
+ if (!noAssert) checkOffset(offset, byteLength2, this.length);
1811
+ let i = byteLength2;
1812
+ let mul = 1;
1813
+ let val = this[offset + --i];
1814
+ while (i > 0 && (mul *= 256)) {
1815
+ val += this[offset + --i] * mul;
1816
+ }
1817
+ mul *= 128;
1818
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength2);
1819
+ return val;
1820
+ }, "readIntBE");
1821
+ Buffer3.prototype.readInt8 = /* @__PURE__ */ __name(function readInt8(offset, noAssert) {
1822
+ offset = offset >>> 0;
1823
+ if (!noAssert) checkOffset(offset, 1, this.length);
1824
+ if (!(this[offset] & 128)) return this[offset];
1825
+ return (255 - this[offset] + 1) * -1;
1826
+ }, "readInt8");
1827
+ Buffer3.prototype.readInt16LE = /* @__PURE__ */ __name(function readInt16LE(offset, noAssert) {
1828
+ offset = offset >>> 0;
1829
+ if (!noAssert) checkOffset(offset, 2, this.length);
1830
+ const val = this[offset] | this[offset + 1] << 8;
1831
+ return val & 32768 ? val | 4294901760 : val;
1832
+ }, "readInt16LE");
1833
+ Buffer3.prototype.readInt16BE = /* @__PURE__ */ __name(function readInt16BE(offset, noAssert) {
1834
+ offset = offset >>> 0;
1835
+ if (!noAssert) checkOffset(offset, 2, this.length);
1836
+ const val = this[offset + 1] | this[offset] << 8;
1837
+ return val & 32768 ? val | 4294901760 : val;
1838
+ }, "readInt16BE");
1839
+ Buffer3.prototype.readInt32LE = /* @__PURE__ */ __name(function readInt32LE(offset, noAssert) {
1840
+ offset = offset >>> 0;
1841
+ if (!noAssert) checkOffset(offset, 4, this.length);
1842
+ return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
1843
+ }, "readInt32LE");
1844
+ Buffer3.prototype.readInt32BE = /* @__PURE__ */ __name(function readInt32BE(offset, noAssert) {
1845
+ offset = offset >>> 0;
1846
+ if (!noAssert) checkOffset(offset, 4, this.length);
1847
+ return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
1848
+ }, "readInt32BE");
1849
+ Buffer3.prototype.readBigInt64LE = defineBigIntMethod(/* @__PURE__ */ __name(function readBigInt64LE(offset) {
1850
+ offset = offset >>> 0;
1851
+ validateNumber(offset, "offset");
1852
+ const first = this[offset];
1853
+ const last = this[offset + 7];
1854
+ if (first === void 0 || last === void 0) {
1855
+ boundsError(offset, this.length - 8);
1856
+ }
1857
+ const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24);
1858
+ return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24);
1859
+ }, "readBigInt64LE"));
1860
+ Buffer3.prototype.readBigInt64BE = defineBigIntMethod(/* @__PURE__ */ __name(function readBigInt64BE(offset) {
1861
+ offset = offset >>> 0;
1862
+ validateNumber(offset, "offset");
1863
+ const first = this[offset];
1864
+ const last = this[offset + 7];
1865
+ if (first === void 0 || last === void 0) {
1866
+ boundsError(offset, this.length - 8);
1867
+ }
1868
+ const val = (first << 24) + // Overflow
1869
+ this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
1870
+ return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last);
1871
+ }, "readBigInt64BE"));
1872
+ Buffer3.prototype.readFloatLE = /* @__PURE__ */ __name(function readFloatLE(offset, noAssert) {
1873
+ offset = offset >>> 0;
1874
+ if (!noAssert) checkOffset(offset, 4, this.length);
1875
+ return ieee754.read(this, offset, true, 23, 4);
1876
+ }, "readFloatLE");
1877
+ Buffer3.prototype.readFloatBE = /* @__PURE__ */ __name(function readFloatBE(offset, noAssert) {
1878
+ offset = offset >>> 0;
1879
+ if (!noAssert) checkOffset(offset, 4, this.length);
1880
+ return ieee754.read(this, offset, false, 23, 4);
1881
+ }, "readFloatBE");
1882
+ Buffer3.prototype.readDoubleLE = /* @__PURE__ */ __name(function readDoubleLE(offset, noAssert) {
1883
+ offset = offset >>> 0;
1884
+ if (!noAssert) checkOffset(offset, 8, this.length);
1885
+ return ieee754.read(this, offset, true, 52, 8);
1886
+ }, "readDoubleLE");
1887
+ Buffer3.prototype.readDoubleBE = /* @__PURE__ */ __name(function readDoubleBE(offset, noAssert) {
1888
+ offset = offset >>> 0;
1889
+ if (!noAssert) checkOffset(offset, 8, this.length);
1890
+ return ieee754.read(this, offset, false, 52, 8);
1891
+ }, "readDoubleBE");
1892
+ function checkInt(buf, value, offset, ext, max, min) {
1893
+ if (!Buffer3.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
1894
+ if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
1895
+ if (offset + ext > buf.length) throw new RangeError("Index out of range");
1896
+ }
1897
+ __name(checkInt, "checkInt");
1898
+ Buffer3.prototype.writeUintLE = Buffer3.prototype.writeUIntLE = /* @__PURE__ */ __name(function writeUIntLE(value, offset, byteLength2, noAssert) {
1899
+ value = +value;
1900
+ offset = offset >>> 0;
1901
+ byteLength2 = byteLength2 >>> 0;
1902
+ if (!noAssert) {
1903
+ const maxBytes = Math.pow(2, 8 * byteLength2) - 1;
1904
+ checkInt(this, value, offset, byteLength2, maxBytes, 0);
1905
+ }
1906
+ let mul = 1;
1907
+ let i = 0;
1908
+ this[offset] = value & 255;
1909
+ while (++i < byteLength2 && (mul *= 256)) {
1910
+ this[offset + i] = value / mul & 255;
1911
+ }
1912
+ return offset + byteLength2;
1913
+ }, "writeUIntLE");
1914
+ Buffer3.prototype.writeUintBE = Buffer3.prototype.writeUIntBE = /* @__PURE__ */ __name(function writeUIntBE(value, offset, byteLength2, noAssert) {
1915
+ value = +value;
1916
+ offset = offset >>> 0;
1917
+ byteLength2 = byteLength2 >>> 0;
1918
+ if (!noAssert) {
1919
+ const maxBytes = Math.pow(2, 8 * byteLength2) - 1;
1920
+ checkInt(this, value, offset, byteLength2, maxBytes, 0);
1921
+ }
1922
+ let i = byteLength2 - 1;
1923
+ let mul = 1;
1924
+ this[offset + i] = value & 255;
1925
+ while (--i >= 0 && (mul *= 256)) {
1926
+ this[offset + i] = value / mul & 255;
1927
+ }
1928
+ return offset + byteLength2;
1929
+ }, "writeUIntBE");
1930
+ Buffer3.prototype.writeUint8 = Buffer3.prototype.writeUInt8 = /* @__PURE__ */ __name(function writeUInt8(value, offset, noAssert) {
1931
+ value = +value;
1932
+ offset = offset >>> 0;
1933
+ if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
1934
+ this[offset] = value & 255;
1935
+ return offset + 1;
1936
+ }, "writeUInt8");
1937
+ Buffer3.prototype.writeUint16LE = Buffer3.prototype.writeUInt16LE = /* @__PURE__ */ __name(function writeUInt16LE(value, offset, noAssert) {
1938
+ value = +value;
1939
+ offset = offset >>> 0;
1940
+ if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
1941
+ this[offset] = value & 255;
1942
+ this[offset + 1] = value >>> 8;
1943
+ return offset + 2;
1944
+ }, "writeUInt16LE");
1945
+ Buffer3.prototype.writeUint16BE = Buffer3.prototype.writeUInt16BE = /* @__PURE__ */ __name(function writeUInt16BE(value, offset, noAssert) {
1946
+ value = +value;
1947
+ offset = offset >>> 0;
1948
+ if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
1949
+ this[offset] = value >>> 8;
1950
+ this[offset + 1] = value & 255;
1951
+ return offset + 2;
1952
+ }, "writeUInt16BE");
1953
+ Buffer3.prototype.writeUint32LE = Buffer3.prototype.writeUInt32LE = /* @__PURE__ */ __name(function writeUInt32LE(value, offset, noAssert) {
1954
+ value = +value;
1955
+ offset = offset >>> 0;
1956
+ if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
1957
+ this[offset + 3] = value >>> 24;
1958
+ this[offset + 2] = value >>> 16;
1959
+ this[offset + 1] = value >>> 8;
1960
+ this[offset] = value & 255;
1961
+ return offset + 4;
1962
+ }, "writeUInt32LE");
1963
+ Buffer3.prototype.writeUint32BE = Buffer3.prototype.writeUInt32BE = /* @__PURE__ */ __name(function writeUInt32BE(value, offset, noAssert) {
1964
+ value = +value;
1965
+ offset = offset >>> 0;
1966
+ if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
1967
+ this[offset] = value >>> 24;
1968
+ this[offset + 1] = value >>> 16;
1969
+ this[offset + 2] = value >>> 8;
1970
+ this[offset + 3] = value & 255;
1971
+ return offset + 4;
1972
+ }, "writeUInt32BE");
1973
+ function wrtBigUInt64LE(buf, value, offset, min, max) {
1974
+ checkIntBI(value, min, max, buf, offset, 7);
1975
+ let lo = Number(value & BigInt(4294967295));
1976
+ buf[offset++] = lo;
1977
+ lo = lo >> 8;
1978
+ buf[offset++] = lo;
1979
+ lo = lo >> 8;
1980
+ buf[offset++] = lo;
1981
+ lo = lo >> 8;
1982
+ buf[offset++] = lo;
1983
+ let hi = Number(value >> BigInt(32) & BigInt(4294967295));
1984
+ buf[offset++] = hi;
1985
+ hi = hi >> 8;
1986
+ buf[offset++] = hi;
1987
+ hi = hi >> 8;
1988
+ buf[offset++] = hi;
1989
+ hi = hi >> 8;
1990
+ buf[offset++] = hi;
1991
+ return offset;
1992
+ }
1993
+ __name(wrtBigUInt64LE, "wrtBigUInt64LE");
1994
+ function wrtBigUInt64BE(buf, value, offset, min, max) {
1995
+ checkIntBI(value, min, max, buf, offset, 7);
1996
+ let lo = Number(value & BigInt(4294967295));
1997
+ buf[offset + 7] = lo;
1998
+ lo = lo >> 8;
1999
+ buf[offset + 6] = lo;
2000
+ lo = lo >> 8;
2001
+ buf[offset + 5] = lo;
2002
+ lo = lo >> 8;
2003
+ buf[offset + 4] = lo;
2004
+ let hi = Number(value >> BigInt(32) & BigInt(4294967295));
2005
+ buf[offset + 3] = hi;
2006
+ hi = hi >> 8;
2007
+ buf[offset + 2] = hi;
2008
+ hi = hi >> 8;
2009
+ buf[offset + 1] = hi;
2010
+ hi = hi >> 8;
2011
+ buf[offset] = hi;
2012
+ return offset + 8;
2013
+ }
2014
+ __name(wrtBigUInt64BE, "wrtBigUInt64BE");
2015
+ Buffer3.prototype.writeBigUInt64LE = defineBigIntMethod(/* @__PURE__ */ __name(function writeBigUInt64LE(value, offset = 0) {
2016
+ return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
2017
+ }, "writeBigUInt64LE"));
2018
+ Buffer3.prototype.writeBigUInt64BE = defineBigIntMethod(/* @__PURE__ */ __name(function writeBigUInt64BE(value, offset = 0) {
2019
+ return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
2020
+ }, "writeBigUInt64BE"));
2021
+ Buffer3.prototype.writeIntLE = /* @__PURE__ */ __name(function writeIntLE(value, offset, byteLength2, noAssert) {
2022
+ value = +value;
2023
+ offset = offset >>> 0;
2024
+ if (!noAssert) {
2025
+ const limit = Math.pow(2, 8 * byteLength2 - 1);
2026
+ checkInt(this, value, offset, byteLength2, limit - 1, -limit);
2027
+ }
2028
+ let i = 0;
2029
+ let mul = 1;
2030
+ let sub = 0;
2031
+ this[offset] = value & 255;
2032
+ while (++i < byteLength2 && (mul *= 256)) {
2033
+ if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
2034
+ sub = 1;
2035
+ }
2036
+ this[offset + i] = (value / mul >> 0) - sub & 255;
2037
+ }
2038
+ return offset + byteLength2;
2039
+ }, "writeIntLE");
2040
+ Buffer3.prototype.writeIntBE = /* @__PURE__ */ __name(function writeIntBE(value, offset, byteLength2, noAssert) {
2041
+ value = +value;
2042
+ offset = offset >>> 0;
2043
+ if (!noAssert) {
2044
+ const limit = Math.pow(2, 8 * byteLength2 - 1);
2045
+ checkInt(this, value, offset, byteLength2, limit - 1, -limit);
2046
+ }
2047
+ let i = byteLength2 - 1;
2048
+ let mul = 1;
2049
+ let sub = 0;
2050
+ this[offset + i] = value & 255;
2051
+ while (--i >= 0 && (mul *= 256)) {
2052
+ if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
2053
+ sub = 1;
2054
+ }
2055
+ this[offset + i] = (value / mul >> 0) - sub & 255;
2056
+ }
2057
+ return offset + byteLength2;
2058
+ }, "writeIntBE");
2059
+ Buffer3.prototype.writeInt8 = /* @__PURE__ */ __name(function writeInt8(value, offset, noAssert) {
2060
+ value = +value;
2061
+ offset = offset >>> 0;
2062
+ if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
2063
+ if (value < 0) value = 255 + value + 1;
2064
+ this[offset] = value & 255;
2065
+ return offset + 1;
2066
+ }, "writeInt8");
2067
+ Buffer3.prototype.writeInt16LE = /* @__PURE__ */ __name(function writeInt16LE(value, offset, noAssert) {
2068
+ value = +value;
2069
+ offset = offset >>> 0;
2070
+ if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
2071
+ this[offset] = value & 255;
2072
+ this[offset + 1] = value >>> 8;
2073
+ return offset + 2;
2074
+ }, "writeInt16LE");
2075
+ Buffer3.prototype.writeInt16BE = /* @__PURE__ */ __name(function writeInt16BE(value, offset, noAssert) {
2076
+ value = +value;
2077
+ offset = offset >>> 0;
2078
+ if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
2079
+ this[offset] = value >>> 8;
2080
+ this[offset + 1] = value & 255;
2081
+ return offset + 2;
2082
+ }, "writeInt16BE");
2083
+ Buffer3.prototype.writeInt32LE = /* @__PURE__ */ __name(function writeInt32LE(value, offset, noAssert) {
2084
+ value = +value;
2085
+ offset = offset >>> 0;
2086
+ if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
2087
+ this[offset] = value & 255;
2088
+ this[offset + 1] = value >>> 8;
2089
+ this[offset + 2] = value >>> 16;
2090
+ this[offset + 3] = value >>> 24;
2091
+ return offset + 4;
2092
+ }, "writeInt32LE");
2093
+ Buffer3.prototype.writeInt32BE = /* @__PURE__ */ __name(function writeInt32BE(value, offset, noAssert) {
2094
+ value = +value;
2095
+ offset = offset >>> 0;
2096
+ if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
2097
+ if (value < 0) value = 4294967295 + value + 1;
2098
+ this[offset] = value >>> 24;
2099
+ this[offset + 1] = value >>> 16;
2100
+ this[offset + 2] = value >>> 8;
2101
+ this[offset + 3] = value & 255;
2102
+ return offset + 4;
2103
+ }, "writeInt32BE");
2104
+ Buffer3.prototype.writeBigInt64LE = defineBigIntMethod(/* @__PURE__ */ __name(function writeBigInt64LE(value, offset = 0) {
2105
+ return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
2106
+ }, "writeBigInt64LE"));
2107
+ Buffer3.prototype.writeBigInt64BE = defineBigIntMethod(/* @__PURE__ */ __name(function writeBigInt64BE(value, offset = 0) {
2108
+ return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
2109
+ }, "writeBigInt64BE"));
2110
+ function checkIEEE754(buf, value, offset, ext, max, min) {
2111
+ if (offset + ext > buf.length) throw new RangeError("Index out of range");
2112
+ if (offset < 0) throw new RangeError("Index out of range");
2113
+ }
2114
+ __name(checkIEEE754, "checkIEEE754");
2115
+ function writeFloat(buf, value, offset, littleEndian, noAssert) {
2116
+ value = +value;
2117
+ offset = offset >>> 0;
2118
+ if (!noAssert) {
2119
+ checkIEEE754(buf, value, offset, 4, 34028234663852886e22, -34028234663852886e22);
2120
+ }
2121
+ ieee754.write(buf, value, offset, littleEndian, 23, 4);
2122
+ return offset + 4;
2123
+ }
2124
+ __name(writeFloat, "writeFloat");
2125
+ Buffer3.prototype.writeFloatLE = /* @__PURE__ */ __name(function writeFloatLE(value, offset, noAssert) {
2126
+ return writeFloat(this, value, offset, true, noAssert);
2127
+ }, "writeFloatLE");
2128
+ Buffer3.prototype.writeFloatBE = /* @__PURE__ */ __name(function writeFloatBE(value, offset, noAssert) {
2129
+ return writeFloat(this, value, offset, false, noAssert);
2130
+ }, "writeFloatBE");
2131
+ function writeDouble(buf, value, offset, littleEndian, noAssert) {
2132
+ value = +value;
2133
+ offset = offset >>> 0;
2134
+ if (!noAssert) {
2135
+ checkIEEE754(buf, value, offset, 8, 17976931348623157e292, -17976931348623157e292);
2136
+ }
2137
+ ieee754.write(buf, value, offset, littleEndian, 52, 8);
2138
+ return offset + 8;
2139
+ }
2140
+ __name(writeDouble, "writeDouble");
2141
+ Buffer3.prototype.writeDoubleLE = /* @__PURE__ */ __name(function writeDoubleLE(value, offset, noAssert) {
2142
+ return writeDouble(this, value, offset, true, noAssert);
2143
+ }, "writeDoubleLE");
2144
+ Buffer3.prototype.writeDoubleBE = /* @__PURE__ */ __name(function writeDoubleBE(value, offset, noAssert) {
2145
+ return writeDouble(this, value, offset, false, noAssert);
2146
+ }, "writeDoubleBE");
2147
+ Buffer3.prototype.copy = /* @__PURE__ */ __name(function copy2(target, targetStart, start, end) {
2148
+ if (!Buffer3.isBuffer(target)) throw new TypeError("argument should be a Buffer");
2149
+ if (!start) start = 0;
2150
+ if (!end && end !== 0) end = this.length;
2151
+ if (targetStart >= target.length) targetStart = target.length;
2152
+ if (!targetStart) targetStart = 0;
2153
+ if (end > 0 && end < start) end = start;
2154
+ if (end === start) return 0;
2155
+ if (target.length === 0 || this.length === 0) return 0;
2156
+ if (targetStart < 0) {
2157
+ throw new RangeError("targetStart out of bounds");
2158
+ }
2159
+ if (start < 0 || start >= this.length) throw new RangeError("Index out of range");
2160
+ if (end < 0) throw new RangeError("sourceEnd out of bounds");
2161
+ if (end > this.length) end = this.length;
2162
+ if (target.length - targetStart < end - start) {
2163
+ end = target.length - targetStart + start;
2164
+ }
2165
+ const len = end - start;
2166
+ if (this === target && typeof Uint8Array.prototype.copyWithin === "function") {
2167
+ this.copyWithin(targetStart, start, end);
2168
+ } else {
2169
+ Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart);
2170
+ }
2171
+ return len;
2172
+ }, "copy");
2173
+ Buffer3.prototype.fill = /* @__PURE__ */ __name(function fill(val, start, end, encoding) {
2174
+ if (typeof val === "string") {
2175
+ if (typeof start === "string") {
2176
+ encoding = start;
2177
+ start = 0;
2178
+ end = this.length;
2179
+ } else if (typeof end === "string") {
2180
+ encoding = end;
2181
+ end = this.length;
2182
+ }
2183
+ if (encoding !== void 0 && typeof encoding !== "string") {
2184
+ throw new TypeError("encoding must be a string");
2185
+ }
2186
+ if (typeof encoding === "string" && !Buffer3.isEncoding(encoding)) {
2187
+ throw new TypeError("Unknown encoding: " + encoding);
2188
+ }
2189
+ if (val.length === 1) {
2190
+ const code = val.charCodeAt(0);
2191
+ if (encoding === "utf8" && code < 128 || encoding === "latin1") {
2192
+ val = code;
2193
+ }
2194
+ }
2195
+ } else if (typeof val === "number") {
2196
+ val = val & 255;
2197
+ } else if (typeof val === "boolean") {
2198
+ val = Number(val);
2199
+ }
2200
+ if (start < 0 || this.length < start || this.length < end) {
2201
+ throw new RangeError("Out of range index");
2202
+ }
2203
+ if (end <= start) {
2204
+ return this;
2205
+ }
2206
+ start = start >>> 0;
2207
+ end = end === void 0 ? this.length : end >>> 0;
2208
+ if (!val) val = 0;
2209
+ let i;
2210
+ if (typeof val === "number") {
2211
+ for (i = start; i < end; ++i) {
2212
+ this[i] = val;
2213
+ }
2214
+ } else {
2215
+ const bytes = Buffer3.isBuffer(val) ? val : Buffer3.from(val, encoding);
2216
+ const len = bytes.length;
2217
+ if (len === 0) {
2218
+ throw new TypeError('The value "' + val + '" is invalid for argument "value"');
2219
+ }
2220
+ for (i = 0; i < end - start; ++i) {
2221
+ this[i + start] = bytes[i % len];
2222
+ }
2223
+ }
2224
+ return this;
2225
+ }, "fill");
2226
+ var errors = {};
2227
+ function E(sym, getMessage, Base) {
2228
+ errors[sym] = class NodeError extends Base {
2229
+ static {
2230
+ __name(this, "NodeError");
2231
+ }
2232
+ constructor() {
2233
+ super();
2234
+ Object.defineProperty(this, "message", {
2235
+ value: getMessage.apply(this, arguments),
2236
+ writable: true,
2237
+ configurable: true
2238
+ });
2239
+ this.name = `${this.name} [${sym}]`;
2240
+ this.stack;
2241
+ delete this.name;
2242
+ }
2243
+ get code() {
2244
+ return sym;
2245
+ }
2246
+ set code(value) {
2247
+ Object.defineProperty(this, "code", {
2248
+ configurable: true,
2249
+ enumerable: true,
2250
+ value,
2251
+ writable: true
2252
+ });
2253
+ }
2254
+ toString() {
2255
+ return `${this.name} [${sym}]: ${this.message}`;
2256
+ }
2257
+ };
2258
+ }
2259
+ __name(E, "E");
2260
+ E("ERR_BUFFER_OUT_OF_BOUNDS", function(name) {
2261
+ if (name) {
2262
+ return `${name} is outside of buffer bounds`;
2263
+ }
2264
+ return "Attempt to access memory outside buffer bounds";
2265
+ }, RangeError);
2266
+ E("ERR_INVALID_ARG_TYPE", function(name, actual) {
2267
+ return `The "${name}" argument must be of type number. Received type ${typeof actual}`;
2268
+ }, TypeError);
2269
+ E("ERR_OUT_OF_RANGE", function(str, range, input) {
2270
+ let msg = `The value of "${str}" is out of range.`;
2271
+ let received = input;
2272
+ if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
2273
+ received = addNumericalSeparator(String(input));
2274
+ } else if (typeof input === "bigint") {
2275
+ received = String(input);
2276
+ if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {
2277
+ received = addNumericalSeparator(received);
2278
+ }
2279
+ received += "n";
2280
+ }
2281
+ msg += ` It must be ${range}. Received ${received}`;
2282
+ return msg;
2283
+ }, RangeError);
2284
+ function addNumericalSeparator(val) {
2285
+ let res = "";
2286
+ let i = val.length;
2287
+ const start = val[0] === "-" ? 1 : 0;
2288
+ for (; i >= start + 4; i -= 3) {
2289
+ res = `_${val.slice(i - 3, i)}${res}`;
2290
+ }
2291
+ return `${val.slice(0, i)}${res}`;
2292
+ }
2293
+ __name(addNumericalSeparator, "addNumericalSeparator");
2294
+ function checkBounds(buf, offset, byteLength2) {
2295
+ validateNumber(offset, "offset");
2296
+ if (buf[offset] === void 0 || buf[offset + byteLength2] === void 0) {
2297
+ boundsError(offset, buf.length - (byteLength2 + 1));
2298
+ }
2299
+ }
2300
+ __name(checkBounds, "checkBounds");
2301
+ function checkIntBI(value, min, max, buf, offset, byteLength2) {
2302
+ if (value > max || value < min) {
2303
+ const n = typeof min === "bigint" ? "n" : "";
2304
+ let range;
2305
+ if (byteLength2 > 3) {
2306
+ if (min === 0 || min === BigInt(0)) {
2307
+ range = `>= 0${n} and < 2${n} ** ${(byteLength2 + 1) * 8}${n}`;
2308
+ } else {
2309
+ range = `>= -(2${n} ** ${(byteLength2 + 1) * 8 - 1}${n}) and < 2 ** ${(byteLength2 + 1) * 8 - 1}${n}`;
2310
+ }
2311
+ } else {
2312
+ range = `>= ${min}${n} and <= ${max}${n}`;
2313
+ }
2314
+ throw new errors.ERR_OUT_OF_RANGE("value", range, value);
2315
+ }
2316
+ checkBounds(buf, offset, byteLength2);
2317
+ }
2318
+ __name(checkIntBI, "checkIntBI");
2319
+ function validateNumber(value, name) {
2320
+ if (typeof value !== "number") {
2321
+ throw new errors.ERR_INVALID_ARG_TYPE(name, "number", value);
2322
+ }
2323
+ }
2324
+ __name(validateNumber, "validateNumber");
2325
+ function boundsError(value, length, type) {
2326
+ if (Math.floor(value) !== value) {
2327
+ validateNumber(value, type);
2328
+ throw new errors.ERR_OUT_OF_RANGE(type || "offset", "an integer", value);
2329
+ }
2330
+ if (length < 0) {
2331
+ throw new errors.ERR_BUFFER_OUT_OF_BOUNDS();
2332
+ }
2333
+ throw new errors.ERR_OUT_OF_RANGE(type || "offset", `>= ${type ? 1 : 0} and <= ${length}`, value);
2334
+ }
2335
+ __name(boundsError, "boundsError");
2336
+ var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
2337
+ function base64clean(str) {
2338
+ str = str.split("=")[0];
2339
+ str = str.trim().replace(INVALID_BASE64_RE, "");
2340
+ if (str.length < 2) return "";
2341
+ while (str.length % 4 !== 0) {
2342
+ str = str + "=";
2343
+ }
2344
+ return str;
2345
+ }
2346
+ __name(base64clean, "base64clean");
2347
+ function utf8ToBytes(string, units) {
2348
+ units = units || Infinity;
2349
+ let codePoint;
2350
+ const length = string.length;
2351
+ let leadSurrogate = null;
2352
+ const bytes = [];
2353
+ for (let i = 0; i < length; ++i) {
2354
+ codePoint = string.charCodeAt(i);
2355
+ if (codePoint > 55295 && codePoint < 57344) {
2356
+ if (!leadSurrogate) {
2357
+ if (codePoint > 56319) {
2358
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
2359
+ continue;
2360
+ } else if (i + 1 === length) {
2361
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
2362
+ continue;
2363
+ }
2364
+ leadSurrogate = codePoint;
2365
+ continue;
2366
+ }
2367
+ if (codePoint < 56320) {
2368
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
2369
+ leadSurrogate = codePoint;
2370
+ continue;
2371
+ }
2372
+ codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
2373
+ } else if (leadSurrogate) {
2374
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
2375
+ }
2376
+ leadSurrogate = null;
2377
+ if (codePoint < 128) {
2378
+ if ((units -= 1) < 0) break;
2379
+ bytes.push(codePoint);
2380
+ } else if (codePoint < 2048) {
2381
+ if ((units -= 2) < 0) break;
2382
+ bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128);
2383
+ } else if (codePoint < 65536) {
2384
+ if ((units -= 3) < 0) break;
2385
+ bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
2386
+ } else if (codePoint < 1114112) {
2387
+ if ((units -= 4) < 0) break;
2388
+ bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
2389
+ } else {
2390
+ throw new Error("Invalid code point");
2391
+ }
2392
+ }
2393
+ return bytes;
2394
+ }
2395
+ __name(utf8ToBytes, "utf8ToBytes");
2396
+ function asciiToBytes(str) {
2397
+ const byteArray = [];
2398
+ for (let i = 0; i < str.length; ++i) {
2399
+ byteArray.push(str.charCodeAt(i) & 255);
2400
+ }
2401
+ return byteArray;
2402
+ }
2403
+ __name(asciiToBytes, "asciiToBytes");
2404
+ function utf16leToBytes(str, units) {
2405
+ let c, hi, lo;
2406
+ const byteArray = [];
2407
+ for (let i = 0; i < str.length; ++i) {
2408
+ if ((units -= 2) < 0) break;
2409
+ c = str.charCodeAt(i);
2410
+ hi = c >> 8;
2411
+ lo = c % 256;
2412
+ byteArray.push(lo);
2413
+ byteArray.push(hi);
2414
+ }
2415
+ return byteArray;
2416
+ }
2417
+ __name(utf16leToBytes, "utf16leToBytes");
2418
+ function base64ToBytes(str) {
2419
+ return base64.toByteArray(base64clean(str));
2420
+ }
2421
+ __name(base64ToBytes, "base64ToBytes");
2422
+ function blitBuffer(src, dst, offset, length) {
2423
+ let i;
2424
+ for (i = 0; i < length; ++i) {
2425
+ if (i + offset >= dst.length || i >= src.length) break;
2426
+ dst[i + offset] = src[i];
2427
+ }
2428
+ return i;
2429
+ }
2430
+ __name(blitBuffer, "blitBuffer");
2431
+ function isInstance(obj, type) {
2432
+ return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
2433
+ }
2434
+ __name(isInstance, "isInstance");
2435
+ function numberIsNaN(obj) {
2436
+ return obj !== obj;
2437
+ }
2438
+ __name(numberIsNaN, "numberIsNaN");
2439
+ var hexSliceLookupTable = function() {
2440
+ const alphabet = "0123456789abcdef";
2441
+ const table = new Array(256);
2442
+ for (let i = 0; i < 16; ++i) {
2443
+ const i16 = i * 16;
2444
+ for (let j = 0; j < 16; ++j) {
2445
+ table[i16 + j] = alphabet[i] + alphabet[j];
2446
+ }
2447
+ }
2448
+ return table;
2449
+ }();
2450
+ function defineBigIntMethod(fn) {
2451
+ return typeof BigInt === "undefined" ? BufferBigIntNotDefined : fn;
2452
+ }
2453
+ __name(defineBigIntMethod, "defineBigIntMethod");
2454
+ function BufferBigIntNotDefined() {
2455
+ throw new Error("BigInt not supported");
2456
+ }
2457
+ __name(BufferBigIntNotDefined, "BufferBigIntNotDefined");
2458
+ }
2459
+ });
2460
+
2461
+ // src/index.ts
2462
+ init_cjs_shims();
2463
+
2464
+ // src/prisma-generator.ts
2465
+ init_cjs_shims();
2466
+
2467
+ // ../fs/src/helpers.ts
2468
+ init_cjs_shims();
2469
+
2470
+ // ../path/src/exists.ts
2471
+ init_cjs_shims();
2472
+ var import_node_fs = require("node:fs");
2473
+ var import_promises = require("node:fs/promises");
2474
+ var existsSync = /* @__PURE__ */ __name((filePath) => {
2475
+ return (0, import_node_fs.existsSync)(filePath);
2476
+ }, "existsSync");
2477
+ var exists = /* @__PURE__ */ __name(async (filePath) => {
2478
+ return (0, import_promises.access)(filePath, import_promises.constants.F_OK).then(() => true).catch(() => false);
2479
+ }, "exists");
2480
+
2481
+ // ../fs/src/helpers.ts
2482
+ var import_promises2 = require("node:fs/promises");
2483
+ async function createDirectory(path5) {
2484
+ if (await exists(path5)) {
2485
+ return;
2486
+ }
2487
+ return (0, import_promises2.mkdir)(path5, {
2488
+ recursive: true
2489
+ });
2490
+ }
2491
+ __name(createDirectory, "createDirectory");
2492
+
2493
+ // ../path/src/join-paths.ts
2494
+ init_cjs_shims();
2495
+ var _DRIVE_LETTER_START_RE = /^[A-Z]:\//i;
2496
+ function normalizeWindowsPath(input = "") {
2497
+ if (!input) {
2498
+ return input;
2499
+ }
2500
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
2501
+ }
2502
+ __name(normalizeWindowsPath, "normalizeWindowsPath");
2503
+ var _UNC_REGEX = /^[/\\]{2}/;
2504
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i;
2505
+ var _DRIVE_LETTER_RE = /^[A-Z]:$/i;
2506
+ var isAbsolute = /* @__PURE__ */ __name(function(p) {
2507
+ return _IS_ABSOLUTE_RE.test(p);
2508
+ }, "isAbsolute");
2509
+ var correctPaths = /* @__PURE__ */ __name(function(path5) {
2510
+ if (!path5 || path5.length === 0) {
2511
+ return ".";
2512
+ }
2513
+ path5 = normalizeWindowsPath(path5);
2514
+ const isUNCPath = path5.match(_UNC_REGEX);
2515
+ const isPathAbsolute = isAbsolute(path5);
2516
+ const trailingSeparator = path5[path5.length - 1] === "/";
2517
+ path5 = normalizeString(path5, !isPathAbsolute);
2518
+ if (path5.length === 0) {
2519
+ if (isPathAbsolute) {
2520
+ return "/";
2521
+ }
2522
+ return trailingSeparator ? "./" : ".";
2523
+ }
2524
+ if (trailingSeparator) {
2525
+ path5 += "/";
2526
+ }
2527
+ if (_DRIVE_LETTER_RE.test(path5)) {
2528
+ path5 += "/";
2529
+ }
2530
+ if (isUNCPath) {
2531
+ if (!isPathAbsolute) {
2532
+ return `//./${path5}`;
2533
+ }
2534
+ return `//${path5}`;
2535
+ }
2536
+ return isPathAbsolute && !isAbsolute(path5) ? `/${path5}` : path5;
2537
+ }, "correctPaths");
2538
+ var joinPaths = /* @__PURE__ */ __name(function(...segments) {
2539
+ let path5 = "";
2540
+ for (const seg of segments) {
2541
+ if (!seg) {
2542
+ continue;
2543
+ }
2544
+ if (path5.length > 0) {
2545
+ const pathTrailing = path5[path5.length - 1] === "/";
2546
+ const segLeading = seg[0] === "/";
2547
+ const both = pathTrailing && segLeading;
2548
+ if (both) {
2549
+ path5 += seg.slice(1);
2550
+ } else {
2551
+ path5 += pathTrailing || segLeading ? seg : `/${seg}`;
2552
+ }
2553
+ } else {
2554
+ path5 += seg;
2555
+ }
2556
+ }
2557
+ return correctPaths(path5);
2558
+ }, "joinPaths");
2559
+ function normalizeString(path5, allowAboveRoot) {
2560
+ let res = "";
2561
+ let lastSegmentLength = 0;
2562
+ let lastSlash = -1;
2563
+ let dots = 0;
2564
+ let char = null;
2565
+ for (let index = 0; index <= path5.length; ++index) {
2566
+ if (index < path5.length) {
2567
+ char = path5[index];
2568
+ } else if (char === "/") {
2569
+ break;
2570
+ } else {
2571
+ char = "/";
2572
+ }
2573
+ if (char === "/") {
2574
+ if (lastSlash === index - 1 || dots === 1) {
2575
+ } else if (dots === 2) {
2576
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
2577
+ if (res.length > 2) {
2578
+ const lastSlashIndex = res.lastIndexOf("/");
2579
+ if (lastSlashIndex === -1) {
2580
+ res = "";
2581
+ lastSegmentLength = 0;
2582
+ } else {
2583
+ res = res.slice(0, lastSlashIndex);
2584
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
2585
+ }
2586
+ lastSlash = index;
2587
+ dots = 0;
2588
+ continue;
2589
+ } else if (res.length > 0) {
2590
+ res = "";
2591
+ lastSegmentLength = 0;
2592
+ lastSlash = index;
2593
+ dots = 0;
2594
+ continue;
2595
+ }
2596
+ }
2597
+ if (allowAboveRoot) {
2598
+ res += res.length > 0 ? "/.." : "..";
2599
+ lastSegmentLength = 2;
2600
+ }
2601
+ } else {
2602
+ if (res.length > 0) {
2603
+ res += `/${path5.slice(lastSlash + 1, index)}`;
2604
+ } else {
2605
+ res = path5.slice(lastSlash + 1, index);
2606
+ }
2607
+ lastSegmentLength = index - lastSlash - 1;
2608
+ }
2609
+ lastSlash = index;
2610
+ dots = 0;
2611
+ } else if (char === "." && dots !== -1) {
2612
+ ++dots;
2613
+ } else {
2614
+ dots = -1;
2615
+ }
2616
+ }
822
2617
  return res;
823
2618
  }
824
2619
  __name(normalizeString, "normalizeString");
825
2620
 
826
2621
  // src/prisma-generator.ts
827
- var import_node_path6 = __toESM(require("node:path"), 1);
2622
+ var import_node_path5 = __toESM(require("node:path"), 1);
828
2623
  var import_pluralize = __toESM(require_pluralize(), 1);
829
2624
 
830
2625
  // src/config.ts
@@ -1192,8 +2987,8 @@ function getErrorMap() {
1192
2987
  }
1193
2988
  __name(getErrorMap, "getErrorMap");
1194
2989
  var makeIssue = /* @__PURE__ */ __name((params) => {
1195
- const { data, path: path6, errorMaps, issueData } = params;
1196
- const fullPath = [...path6, ...issueData.path || []];
2990
+ const { data, path: path5, errorMaps, issueData } = params;
2991
+ const fullPath = [...path5, ...issueData.path || []];
1197
2992
  const fullIssue = {
1198
2993
  ...issueData,
1199
2994
  path: fullPath
@@ -1327,11 +3122,11 @@ var ParseInputLazyPath = class {
1327
3122
  static {
1328
3123
  __name(this, "ParseInputLazyPath");
1329
3124
  }
1330
- constructor(parent, value, path6, key) {
3125
+ constructor(parent, value, path5, key) {
1331
3126
  this._cachedPath = [];
1332
3127
  this.parent = parent;
1333
3128
  this.data = value;
1334
- this._path = path6;
3129
+ this._path = path5;
1335
3130
  this._key = key;
1336
3131
  }
1337
3132
  get path() {
@@ -5281,16 +7076,16 @@ var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name
5281
7076
  }), "__name");
5282
7077
 
5283
7078
  // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
5284
- var import_node_fs = require("node:fs");
7079
+ var import_node_fs2 = require("node:fs");
5285
7080
  var import_node_path2 = require("node:path");
5286
7081
  var MAX_PATH_SEARCH_DEPTH = 30;
5287
7082
  var depth = 0;
5288
7083
  function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
5289
7084
  const _startPath = startPath ?? process.cwd();
5290
- if (endDirectoryNames.some((endDirName) => (0, import_node_fs.existsSync)((0, import_node_path2.join)(_startPath, endDirName)))) {
7085
+ if (endDirectoryNames.some((endDirName) => (0, import_node_fs2.existsSync)((0, import_node_path2.join)(_startPath, endDirName)))) {
5291
7086
  return _startPath;
5292
7087
  }
5293
- if (endFileNames.some((endFileName) => (0, import_node_fs.existsSync)((0, import_node_path2.join)(_startPath, endFileName)))) {
7088
+ if (endFileNames.some((endFileName) => (0, import_node_fs2.existsSync)((0, import_node_path2.join)(_startPath, endFileName)))) {
5294
7089
  return _startPath;
5295
7090
  }
5296
7091
  if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
@@ -5316,34 +7111,34 @@ __name2(normalizeWindowsPath2, "normalizeWindowsPath");
5316
7111
  var _UNC_REGEX2 = /^[/\\]{2}/;
5317
7112
  var _IS_ABSOLUTE_RE2 = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
5318
7113
  var _DRIVE_LETTER_RE2 = /^[A-Za-z]:$/;
5319
- var correctPaths2 = /* @__PURE__ */ __name2(function(path6) {
5320
- if (!path6 || path6.length === 0) {
7114
+ var correctPaths2 = /* @__PURE__ */ __name2(function(path5) {
7115
+ if (!path5 || path5.length === 0) {
5321
7116
  return ".";
5322
7117
  }
5323
- path6 = normalizeWindowsPath2(path6);
5324
- const isUNCPath = path6.match(_UNC_REGEX2);
5325
- const isPathAbsolute = isAbsolute2(path6);
5326
- const trailingSeparator = path6[path6.length - 1] === "/";
5327
- path6 = normalizeString2(path6, !isPathAbsolute);
5328
- if (path6.length === 0) {
7118
+ path5 = normalizeWindowsPath2(path5);
7119
+ const isUNCPath = path5.match(_UNC_REGEX2);
7120
+ const isPathAbsolute = isAbsolute2(path5);
7121
+ const trailingSeparator = path5[path5.length - 1] === "/";
7122
+ path5 = normalizeString2(path5, !isPathAbsolute);
7123
+ if (path5.length === 0) {
5329
7124
  if (isPathAbsolute) {
5330
7125
  return "/";
5331
7126
  }
5332
7127
  return trailingSeparator ? "./" : ".";
5333
7128
  }
5334
7129
  if (trailingSeparator) {
5335
- path6 += "/";
7130
+ path5 += "/";
5336
7131
  }
5337
- if (_DRIVE_LETTER_RE2.test(path6)) {
5338
- path6 += "/";
7132
+ if (_DRIVE_LETTER_RE2.test(path5)) {
7133
+ path5 += "/";
5339
7134
  }
5340
7135
  if (isUNCPath) {
5341
7136
  if (!isPathAbsolute) {
5342
- return `//./${path6}`;
7137
+ return `//./${path5}`;
5343
7138
  }
5344
- return `//${path6}`;
7139
+ return `//${path5}`;
5345
7140
  }
5346
- return isPathAbsolute && !isAbsolute2(path6) ? `/${path6}` : path6;
7141
+ return isPathAbsolute && !isAbsolute2(path5) ? `/${path5}` : path5;
5347
7142
  }, "correctPaths");
5348
7143
  function cwd() {
5349
7144
  if (typeof process !== "undefined" && typeof process.cwd === "function") {
@@ -5353,15 +7148,15 @@ function cwd() {
5353
7148
  }
5354
7149
  __name(cwd, "cwd");
5355
7150
  __name2(cwd, "cwd");
5356
- function normalizeString2(path6, allowAboveRoot) {
7151
+ function normalizeString2(path5, allowAboveRoot) {
5357
7152
  let res = "";
5358
7153
  let lastSegmentLength = 0;
5359
7154
  let lastSlash = -1;
5360
7155
  let dots = 0;
5361
7156
  let char = null;
5362
- for (let index = 0; index <= path6.length; ++index) {
5363
- if (index < path6.length) {
5364
- char = path6[index];
7157
+ for (let index = 0; index <= path5.length; ++index) {
7158
+ if (index < path5.length) {
7159
+ char = path5[index];
5365
7160
  } else if (char === "/") {
5366
7161
  break;
5367
7162
  } else {
@@ -5397,9 +7192,9 @@ function normalizeString2(path6, allowAboveRoot) {
5397
7192
  }
5398
7193
  } else {
5399
7194
  if (res.length > 0) {
5400
- res += `/${path6.slice(lastSlash + 1, index)}`;
7195
+ res += `/${path5.slice(lastSlash + 1, index)}`;
5401
7196
  } else {
5402
- res = path6.slice(lastSlash + 1, index);
7197
+ res = path5.slice(lastSlash + 1, index);
5403
7198
  }
5404
7199
  lastSegmentLength = index - lastSlash - 1;
5405
7200
  }
@@ -5490,6 +7285,7 @@ init_cjs_shims();
5490
7285
 
5491
7286
  // ../types/src/base.ts
5492
7287
  init_cjs_shims();
7288
+ var EMPTY_STRING = "";
5493
7289
  var $NestedValue = Symbol("NestedValue");
5494
7290
 
5495
7291
  // ../path/src/correct-path.ts
@@ -5497,21 +7293,21 @@ init_cjs_shims();
5497
7293
 
5498
7294
  // ../path/src/is-file.ts
5499
7295
  init_cjs_shims();
5500
- var import_node_fs2 = require("node:fs");
5501
- function isFile(path6, additionalPath) {
5502
- return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path6) : path6, {
7296
+ var import_node_fs3 = require("node:fs");
7297
+ function isFile(path5, additionalPath) {
7298
+ return Boolean((0, import_node_fs3.statSync)(additionalPath ? joinPaths(additionalPath, path5) : path5, {
5503
7299
  throwIfNoEntry: false
5504
7300
  })?.isFile());
5505
7301
  }
5506
7302
  __name(isFile, "isFile");
5507
- function isDirectory(path6, additionalPath) {
5508
- return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path6) : path6, {
7303
+ function isDirectory(path5, additionalPath) {
7304
+ return Boolean((0, import_node_fs3.statSync)(additionalPath ? joinPaths(additionalPath, path5) : path5, {
5509
7305
  throwIfNoEntry: false
5510
7306
  })?.isDirectory());
5511
7307
  }
5512
7308
  __name(isDirectory, "isDirectory");
5513
- function isAbsolutePath(path6) {
5514
- return !/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i.test(path6);
7309
+ function isAbsolutePath(path5) {
7310
+ return !/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i.test(path5);
5515
7311
  }
5516
7312
  __name(isAbsolutePath, "isAbsolutePath");
5517
7313
 
@@ -5524,15 +7320,47 @@ function normalizeWindowsPath3(input = "") {
5524
7320
  return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE3, (r) => r.toUpperCase());
5525
7321
  }
5526
7322
  __name(normalizeWindowsPath3, "normalizeWindowsPath");
5527
- function normalizeString3(path6, allowAboveRoot) {
7323
+ var _UNC_REGEX3 = /^[/\\]{2}/;
7324
+ var _DRIVE_LETTER_RE3 = /^[A-Z]:$/i;
7325
+ function correctPath(path5) {
7326
+ if (!path5 || path5.length === 0) {
7327
+ return ".";
7328
+ }
7329
+ path5 = normalizeWindowsPath3(path5);
7330
+ const isUNCPath = path5.match(_UNC_REGEX3);
7331
+ const isPathAbsolute = isAbsolutePath(path5);
7332
+ const trailingSeparator = path5[path5.length - 1] === "/";
7333
+ path5 = normalizeString3(path5, !isPathAbsolute);
7334
+ if (path5.length === 0) {
7335
+ if (isPathAbsolute) {
7336
+ return "/";
7337
+ }
7338
+ return trailingSeparator ? "./" : ".";
7339
+ }
7340
+ if (trailingSeparator) {
7341
+ path5 += "/";
7342
+ }
7343
+ if (_DRIVE_LETTER_RE3.test(path5)) {
7344
+ path5 += "/";
7345
+ }
7346
+ if (isUNCPath) {
7347
+ if (!isPathAbsolute) {
7348
+ return `//./${path5}`;
7349
+ }
7350
+ return `//${path5}`;
7351
+ }
7352
+ return isPathAbsolute && !isAbsolutePath(path5) ? `/${path5}` : path5;
7353
+ }
7354
+ __name(correctPath, "correctPath");
7355
+ function normalizeString3(path5, allowAboveRoot) {
5528
7356
  let res = "";
5529
7357
  let lastSegmentLength = 0;
5530
7358
  let lastSlash = -1;
5531
7359
  let dots = 0;
5532
7360
  let char = null;
5533
- for (let index = 0; index <= path6.length; ++index) {
5534
- if (index < path6.length) {
5535
- char = path6[index];
7361
+ for (let index = 0; index <= path5.length; ++index) {
7362
+ if (index < path5.length) {
7363
+ char = path5[index];
5536
7364
  } else if (char === "/") {
5537
7365
  break;
5538
7366
  } else {
@@ -5568,9 +7396,9 @@ function normalizeString3(path6, allowAboveRoot) {
5568
7396
  }
5569
7397
  } else {
5570
7398
  if (res.length > 0) {
5571
- res += `/${path6.slice(lastSlash + 1, index)}`;
7399
+ res += `/${path5.slice(lastSlash + 1, index)}`;
5572
7400
  } else {
5573
- res = path6.slice(lastSlash + 1, index);
7401
+ res = path5.slice(lastSlash + 1, index);
5574
7402
  }
5575
7403
  lastSegmentLength = index - lastSlash - 1;
5576
7404
  }
@@ -5587,17 +7415,35 @@ function normalizeString3(path6, allowAboveRoot) {
5587
7415
  __name(normalizeString3, "normalizeString");
5588
7416
 
5589
7417
  // ../path/src/file-path-fns.ts
5590
- function resolvePath(path6, cwd2 = getWorkspaceRoot()) {
5591
- const paths = normalizeWindowsPath3(path6).split("/");
7418
+ function findFileName(filePath, { requireExtension, withExtension } = {}) {
7419
+ const result = normalizeWindowsPath3(filePath)?.split(filePath?.includes("\\") ? "\\" : "/")?.pop() ?? "";
7420
+ if (requireExtension === true && !result.includes(".")) {
7421
+ return EMPTY_STRING;
7422
+ }
7423
+ if (withExtension === false && result.includes(".")) {
7424
+ return result.split(".").slice(-1).join(".") || EMPTY_STRING;
7425
+ }
7426
+ return result;
7427
+ }
7428
+ __name(findFileName, "findFileName");
7429
+ function findFilePath(filePath) {
7430
+ const normalizedPath = normalizeWindowsPath3(filePath);
7431
+ return normalizedPath.replace(findFileName(normalizedPath, {
7432
+ requireExtension: true
7433
+ }), "");
7434
+ }
7435
+ __name(findFilePath, "findFilePath");
7436
+ function resolvePath(path5, cwd2 = getWorkspaceRoot()) {
7437
+ const paths = normalizeWindowsPath3(path5).split("/");
5592
7438
  let resolvedPath = "";
5593
7439
  let resolvedAbsolute = false;
5594
7440
  for (let index = paths.length - 1; index >= -1 && !resolvedAbsolute; index--) {
5595
- const path7 = index >= 0 ? paths[index] : cwd2;
5596
- if (!path7 || path7.length === 0) {
7441
+ const path6 = index >= 0 ? paths[index] : cwd2;
7442
+ if (!path6 || path6.length === 0) {
5597
7443
  continue;
5598
7444
  }
5599
- resolvedPath = joinPaths(path7, resolvedPath);
5600
- resolvedAbsolute = isAbsolutePath(path7);
7445
+ resolvedPath = joinPaths(path6, resolvedPath);
7446
+ resolvedAbsolute = isAbsolutePath(path6);
5601
7447
  }
5602
7448
  resolvedPath = normalizeString3(resolvedPath, !resolvedAbsolute);
5603
7449
  if (resolvedAbsolute && !isAbsolutePath(resolvedPath)) {
@@ -5607,13 +7453,13 @@ function resolvePath(path6, cwd2 = getWorkspaceRoot()) {
5607
7453
  }
5608
7454
  __name(resolvePath, "resolvePath");
5609
7455
  function resolvePaths(...paths) {
5610
- return resolvePath(joinPaths(...paths.map((path6) => normalizeWindowsPath3(path6))));
7456
+ return resolvePath(joinPaths(...paths.map((path5) => normalizeWindowsPath3(path5))));
5611
7457
  }
5612
7458
  __name(resolvePaths, "resolvePaths");
5613
7459
 
5614
7460
  // ../path/src/get-parent-path.ts
5615
- var resolveParentPath = /* @__PURE__ */ __name((path6) => {
5616
- return resolvePaths(path6, "..");
7461
+ var resolveParentPath = /* @__PURE__ */ __name((path5) => {
7462
+ return resolvePaths(path5, "..");
5617
7463
  }, "resolveParentPath");
5618
7464
  var getParentPath = /* @__PURE__ */ __name((name, cwd2, options) => {
5619
7465
  const ignoreCase = options?.ignoreCase ?? true;
@@ -6017,121 +7863,2390 @@ function resolveModelsComments(models, hiddenModels) {
6017
7863
  parsedAttributeArgs[key] = JSON.parse(value);
6018
7864
  }
6019
7865
  }
6020
- if (parsedAttributeArgs.hide) {
6021
- hiddenModels.push(model.name);
7866
+ if (parsedAttributeArgs.hide) {
7867
+ hiddenModels.push(model.name);
7868
+ }
7869
+ }
7870
+ }
7871
+ }
7872
+ __name(resolveModelsComments, "resolveModelsComments");
7873
+ var getImports = /* @__PURE__ */ __name((type, newPath) => {
7874
+ let statement = "";
7875
+ if (type === "trpc") {
7876
+ statement = "import * as trpc from '@trpc/server';\n";
7877
+ } else if (type === "trpc-shield") {
7878
+ statement = "import { shield, allow } from 'trpc-shield';\n";
7879
+ } else if (type === "context") {
7880
+ statement = `import { Context } from '${newPath}';
7881
+ `;
7882
+ }
7883
+ return statement;
7884
+ }, "getImports");
7885
+ var wrapWithObject = /* @__PURE__ */ __name(({ shieldItemLines }) => {
7886
+ let wrapped = "{";
7887
+ wrapped += "\n";
7888
+ wrapped += Array.isArray(shieldItemLines) ? ` ${shieldItemLines.join(",\r\n")}` : ` ${shieldItemLines}`;
7889
+ wrapped += "\n";
7890
+ wrapped += "}";
7891
+ return wrapped;
7892
+ }, "wrapWithObject");
7893
+ var wrapWithTrpcShieldCall = /* @__PURE__ */ __name(({ shieldObjectTextWrapped }) => {
7894
+ let wrapped = "shield<Context>(";
7895
+ wrapped += "\n";
7896
+ wrapped += ` ${shieldObjectTextWrapped}`;
7897
+ wrapped += "\n";
7898
+ wrapped += ")";
7899
+ return wrapped;
7900
+ }, "wrapWithTrpcShieldCall");
7901
+ var wrapWithExport = /* @__PURE__ */ __name(({ shieldObjectText }) => {
7902
+ return `export const permissions = ${shieldObjectText};`;
7903
+ }, "wrapWithExport");
7904
+ var constructShield = /* @__PURE__ */ __name(async ({ queries, mutations, subscriptions }, config, options) => {
7905
+ if (queries.length === 0 && mutations.length === 0 && subscriptions.length === 0) {
7906
+ return "";
7907
+ }
7908
+ let rootItems = "";
7909
+ if (queries.length > 0) {
7910
+ const queryLinesWrapped = `query: ${wrapWithObject({
7911
+ shieldItemLines: queries.map((query) => `${query}: allow`)
7912
+ })},`;
7913
+ rootItems += queryLinesWrapped;
7914
+ }
7915
+ if (mutations.length > 0) {
7916
+ const mutationLinesWrapped = `mutation: ${wrapWithObject({
7917
+ shieldItemLines: mutations.map((mutation) => `${mutation}: allow`)
7918
+ })},`;
7919
+ rootItems += mutationLinesWrapped;
7920
+ }
7921
+ if (subscriptions.length > 0) {
7922
+ const subscriptionLinesWrapped = `subscription: ${wrapWithObject({
7923
+ shieldItemLines: subscriptions.map((subscription) => `${subscription}: allow`)
7924
+ })},`;
7925
+ rootItems += subscriptionLinesWrapped;
7926
+ }
7927
+ if (rootItems.length === 0) return "";
7928
+ let shieldText = getImports("trpc-shield");
7929
+ const internals = await getPrismaInternals();
7930
+ const outputDir = internals.parseEnvValue(options.generator.output);
7931
+ shieldText += getImports("context", getRelativePath(outputDir, config.contextPath, true, options.schemaPath));
7932
+ shieldText += "\n\n";
7933
+ shieldText += wrapWithExport({
7934
+ shieldObjectText: wrapWithTrpcShieldCall({
7935
+ shieldObjectTextWrapped: wrapWithObject({
7936
+ shieldItemLines: rootItems
7937
+ })
7938
+ })
7939
+ });
7940
+ return shieldText;
7941
+ }, "constructShield");
7942
+
7943
+ // src/project.ts
7944
+ init_cjs_shims();
7945
+ var import_ts_morph = require("ts-morph");
7946
+ var compilerOptions = {
7947
+ target: import_ts_morph.ScriptTarget.ESNext,
7948
+ module: import_ts_morph.ModuleKind.ESNext,
7949
+ emitDecoratorMetadata: true,
7950
+ experimentalDecorators: true,
7951
+ esModuleInterop: true
7952
+ };
7953
+ var project = new import_ts_morph.Project({
7954
+ compilerOptions: {
7955
+ ...compilerOptions
7956
+ }
7957
+ });
7958
+
7959
+ // src/utils/remove-dir.ts
7960
+ init_cjs_shims();
7961
+ var import_node_fs4 = require("node:fs");
7962
+ var import_node_path4 = __toESM(require("node:path"), 1);
7963
+ async function removeDir(dirPath, onlyContent) {
7964
+ const dirEntries = await import_node_fs4.promises.readdir(dirPath, {
7965
+ withFileTypes: true
7966
+ });
7967
+ await Promise.all(dirEntries.map(async (dirEntry) => {
7968
+ const fullPath = import_node_path4.default.join(dirPath, dirEntry.name);
7969
+ return dirEntry.isDirectory() ? removeDir(fullPath, false) : import_node_fs4.promises.unlink(fullPath);
7970
+ }));
7971
+ if (!onlyContent) {
7972
+ await import_node_fs4.promises.rmdir(dirPath);
7973
+ }
7974
+ }
7975
+ __name(removeDir, "removeDir");
7976
+
7977
+ // src/utils/write-file-safely.ts
7978
+ init_cjs_shims();
7979
+
7980
+ // ../fs/src/write-file.ts
7981
+ init_cjs_shims();
7982
+
7983
+ // ../json/src/storm-json.ts
7984
+ init_cjs_shims();
7985
+
7986
+ // ../type-checks/src/is-object.ts
7987
+ init_cjs_shims();
7988
+
7989
+ // ../type-checks/src/is-plain-object.ts
7990
+ init_cjs_shims();
7991
+
7992
+ // ../type-checks/src/get-object-tag.ts
7993
+ init_cjs_shims();
7994
+ var getObjectTag = /* @__PURE__ */ __name((value) => {
7995
+ if (value == null) {
7996
+ return value === void 0 ? "[object Undefined]" : "[object Null]";
7997
+ }
7998
+ return Object.prototype.toString.call(value);
7999
+ }, "getObjectTag");
8000
+
8001
+ // ../type-checks/src/is-plain-object.ts
8002
+ var isObjectLike = /* @__PURE__ */ __name((obj) => {
8003
+ return typeof obj === "object" && obj !== null;
8004
+ }, "isObjectLike");
8005
+ var isPlainObject = /* @__PURE__ */ __name((obj) => {
8006
+ if (!isObjectLike(obj) || getObjectTag(obj) !== "[object Object]") {
8007
+ return false;
8008
+ }
8009
+ if (Object.getPrototypeOf(obj) === null) {
8010
+ return true;
8011
+ }
8012
+ let proto = obj;
8013
+ while (Object.getPrototypeOf(proto) !== null) {
8014
+ proto = Object.getPrototypeOf(proto);
8015
+ }
8016
+ return Object.getPrototypeOf(obj) === proto;
8017
+ }, "isPlainObject");
8018
+
8019
+ // ../type-checks/src/is-object.ts
8020
+ var isObject = /* @__PURE__ */ __name((value) => {
8021
+ try {
8022
+ return typeof value === "object" || Boolean(value) && value?.constructor === Object || isPlainObject(value);
8023
+ } catch {
8024
+ return false;
8025
+ }
8026
+ }, "isObject");
8027
+
8028
+ // ../json/src/storm-json.ts
8029
+ var import_buffer = __toESM(require_buffer(), 1);
8030
+
8031
+ // ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
8032
+ init_cjs_shims();
8033
+
8034
+ // ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/format.js
8035
+ init_cjs_shims();
8036
+
8037
+ // ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
8038
+ init_cjs_shims();
8039
+ function createScanner(text, ignoreTrivia = false) {
8040
+ const len = text.length;
8041
+ let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
8042
+ function scanHexDigits(count, exact) {
8043
+ let digits = 0;
8044
+ let value2 = 0;
8045
+ while (digits < count || !exact) {
8046
+ let ch = text.charCodeAt(pos);
8047
+ if (ch >= 48 && ch <= 57) {
8048
+ value2 = value2 * 16 + ch - 48;
8049
+ } else if (ch >= 65 && ch <= 70) {
8050
+ value2 = value2 * 16 + ch - 65 + 10;
8051
+ } else if (ch >= 97 && ch <= 102) {
8052
+ value2 = value2 * 16 + ch - 97 + 10;
8053
+ } else {
8054
+ break;
8055
+ }
8056
+ pos++;
8057
+ digits++;
8058
+ }
8059
+ if (digits < count) {
8060
+ value2 = -1;
8061
+ }
8062
+ return value2;
8063
+ }
8064
+ __name(scanHexDigits, "scanHexDigits");
8065
+ function setPosition(newPosition) {
8066
+ pos = newPosition;
8067
+ value = "";
8068
+ tokenOffset = 0;
8069
+ token = 16;
8070
+ scanError = 0;
8071
+ }
8072
+ __name(setPosition, "setPosition");
8073
+ function scanNumber() {
8074
+ let start = pos;
8075
+ if (text.charCodeAt(pos) === 48) {
8076
+ pos++;
8077
+ } else {
8078
+ pos++;
8079
+ while (pos < text.length && isDigit(text.charCodeAt(pos))) {
8080
+ pos++;
8081
+ }
8082
+ }
8083
+ if (pos < text.length && text.charCodeAt(pos) === 46) {
8084
+ pos++;
8085
+ if (pos < text.length && isDigit(text.charCodeAt(pos))) {
8086
+ pos++;
8087
+ while (pos < text.length && isDigit(text.charCodeAt(pos))) {
8088
+ pos++;
8089
+ }
8090
+ } else {
8091
+ scanError = 3;
8092
+ return text.substring(start, pos);
8093
+ }
8094
+ }
8095
+ let end = pos;
8096
+ if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
8097
+ pos++;
8098
+ if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
8099
+ pos++;
8100
+ }
8101
+ if (pos < text.length && isDigit(text.charCodeAt(pos))) {
8102
+ pos++;
8103
+ while (pos < text.length && isDigit(text.charCodeAt(pos))) {
8104
+ pos++;
8105
+ }
8106
+ end = pos;
8107
+ } else {
8108
+ scanError = 3;
8109
+ }
8110
+ }
8111
+ return text.substring(start, end);
8112
+ }
8113
+ __name(scanNumber, "scanNumber");
8114
+ function scanString() {
8115
+ let result = "", start = pos;
8116
+ while (true) {
8117
+ if (pos >= len) {
8118
+ result += text.substring(start, pos);
8119
+ scanError = 2;
8120
+ break;
8121
+ }
8122
+ const ch = text.charCodeAt(pos);
8123
+ if (ch === 34) {
8124
+ result += text.substring(start, pos);
8125
+ pos++;
8126
+ break;
8127
+ }
8128
+ if (ch === 92) {
8129
+ result += text.substring(start, pos);
8130
+ pos++;
8131
+ if (pos >= len) {
8132
+ scanError = 2;
8133
+ break;
8134
+ }
8135
+ const ch2 = text.charCodeAt(pos++);
8136
+ switch (ch2) {
8137
+ case 34:
8138
+ result += '"';
8139
+ break;
8140
+ case 92:
8141
+ result += "\\";
8142
+ break;
8143
+ case 47:
8144
+ result += "/";
8145
+ break;
8146
+ case 98:
8147
+ result += "\b";
8148
+ break;
8149
+ case 102:
8150
+ result += "\f";
8151
+ break;
8152
+ case 110:
8153
+ result += "\n";
8154
+ break;
8155
+ case 114:
8156
+ result += "\r";
8157
+ break;
8158
+ case 116:
8159
+ result += " ";
8160
+ break;
8161
+ case 117:
8162
+ const ch3 = scanHexDigits(4, true);
8163
+ if (ch3 >= 0) {
8164
+ result += String.fromCharCode(ch3);
8165
+ } else {
8166
+ scanError = 4;
8167
+ }
8168
+ break;
8169
+ default:
8170
+ scanError = 5;
8171
+ }
8172
+ start = pos;
8173
+ continue;
8174
+ }
8175
+ if (ch >= 0 && ch <= 31) {
8176
+ if (isLineBreak(ch)) {
8177
+ result += text.substring(start, pos);
8178
+ scanError = 2;
8179
+ break;
8180
+ } else {
8181
+ scanError = 6;
8182
+ }
8183
+ }
8184
+ pos++;
8185
+ }
8186
+ return result;
8187
+ }
8188
+ __name(scanString, "scanString");
8189
+ function scanNext() {
8190
+ value = "";
8191
+ scanError = 0;
8192
+ tokenOffset = pos;
8193
+ lineStartOffset = lineNumber;
8194
+ prevTokenLineStartOffset = tokenLineStartOffset;
8195
+ if (pos >= len) {
8196
+ tokenOffset = len;
8197
+ return token = 17;
8198
+ }
8199
+ let code = text.charCodeAt(pos);
8200
+ if (isWhiteSpace(code)) {
8201
+ do {
8202
+ pos++;
8203
+ value += String.fromCharCode(code);
8204
+ code = text.charCodeAt(pos);
8205
+ } while (isWhiteSpace(code));
8206
+ return token = 15;
8207
+ }
8208
+ if (isLineBreak(code)) {
8209
+ pos++;
8210
+ value += String.fromCharCode(code);
8211
+ if (code === 13 && text.charCodeAt(pos) === 10) {
8212
+ pos++;
8213
+ value += "\n";
8214
+ }
8215
+ lineNumber++;
8216
+ tokenLineStartOffset = pos;
8217
+ return token = 14;
8218
+ }
8219
+ switch (code) {
8220
+ // tokens: []{}:,
8221
+ case 123:
8222
+ pos++;
8223
+ return token = 1;
8224
+ case 125:
8225
+ pos++;
8226
+ return token = 2;
8227
+ case 91:
8228
+ pos++;
8229
+ return token = 3;
8230
+ case 93:
8231
+ pos++;
8232
+ return token = 4;
8233
+ case 58:
8234
+ pos++;
8235
+ return token = 6;
8236
+ case 44:
8237
+ pos++;
8238
+ return token = 5;
8239
+ // strings
8240
+ case 34:
8241
+ pos++;
8242
+ value = scanString();
8243
+ return token = 10;
8244
+ // comments
8245
+ case 47:
8246
+ const start = pos - 1;
8247
+ if (text.charCodeAt(pos + 1) === 47) {
8248
+ pos += 2;
8249
+ while (pos < len) {
8250
+ if (isLineBreak(text.charCodeAt(pos))) {
8251
+ break;
8252
+ }
8253
+ pos++;
8254
+ }
8255
+ value = text.substring(start, pos);
8256
+ return token = 12;
8257
+ }
8258
+ if (text.charCodeAt(pos + 1) === 42) {
8259
+ pos += 2;
8260
+ const safeLength = len - 1;
8261
+ let commentClosed = false;
8262
+ while (pos < safeLength) {
8263
+ const ch = text.charCodeAt(pos);
8264
+ if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
8265
+ pos += 2;
8266
+ commentClosed = true;
8267
+ break;
8268
+ }
8269
+ pos++;
8270
+ if (isLineBreak(ch)) {
8271
+ if (ch === 13 && text.charCodeAt(pos) === 10) {
8272
+ pos++;
8273
+ }
8274
+ lineNumber++;
8275
+ tokenLineStartOffset = pos;
8276
+ }
8277
+ }
8278
+ if (!commentClosed) {
8279
+ pos++;
8280
+ scanError = 1;
8281
+ }
8282
+ value = text.substring(start, pos);
8283
+ return token = 13;
8284
+ }
8285
+ value += String.fromCharCode(code);
8286
+ pos++;
8287
+ return token = 16;
8288
+ // numbers
8289
+ case 45:
8290
+ value += String.fromCharCode(code);
8291
+ pos++;
8292
+ if (pos === len || !isDigit(text.charCodeAt(pos))) {
8293
+ return token = 16;
8294
+ }
8295
+ // found a minus, followed by a number so
8296
+ // we fall through to proceed with scanning
8297
+ // numbers
8298
+ case 48:
8299
+ case 49:
8300
+ case 50:
8301
+ case 51:
8302
+ case 52:
8303
+ case 53:
8304
+ case 54:
8305
+ case 55:
8306
+ case 56:
8307
+ case 57:
8308
+ value += scanNumber();
8309
+ return token = 11;
8310
+ // literals and unknown symbols
8311
+ default:
8312
+ while (pos < len && isUnknownContentCharacter(code)) {
8313
+ pos++;
8314
+ code = text.charCodeAt(pos);
8315
+ }
8316
+ if (tokenOffset !== pos) {
8317
+ value = text.substring(tokenOffset, pos);
8318
+ switch (value) {
8319
+ case "true":
8320
+ return token = 8;
8321
+ case "false":
8322
+ return token = 9;
8323
+ case "null":
8324
+ return token = 7;
8325
+ }
8326
+ return token = 16;
8327
+ }
8328
+ value += String.fromCharCode(code);
8329
+ pos++;
8330
+ return token = 16;
8331
+ }
8332
+ }
8333
+ __name(scanNext, "scanNext");
8334
+ function isUnknownContentCharacter(code) {
8335
+ if (isWhiteSpace(code) || isLineBreak(code)) {
8336
+ return false;
8337
+ }
8338
+ switch (code) {
8339
+ case 125:
8340
+ case 93:
8341
+ case 123:
8342
+ case 91:
8343
+ case 34:
8344
+ case 58:
8345
+ case 44:
8346
+ case 47:
8347
+ return false;
8348
+ }
8349
+ return true;
8350
+ }
8351
+ __name(isUnknownContentCharacter, "isUnknownContentCharacter");
8352
+ function scanNextNonTrivia() {
8353
+ let result;
8354
+ do {
8355
+ result = scanNext();
8356
+ } while (result >= 12 && result <= 15);
8357
+ return result;
8358
+ }
8359
+ __name(scanNextNonTrivia, "scanNextNonTrivia");
8360
+ return {
8361
+ setPosition,
8362
+ getPosition: /* @__PURE__ */ __name(() => pos, "getPosition"),
8363
+ scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
8364
+ getToken: /* @__PURE__ */ __name(() => token, "getToken"),
8365
+ getTokenValue: /* @__PURE__ */ __name(() => value, "getTokenValue"),
8366
+ getTokenOffset: /* @__PURE__ */ __name(() => tokenOffset, "getTokenOffset"),
8367
+ getTokenLength: /* @__PURE__ */ __name(() => pos - tokenOffset, "getTokenLength"),
8368
+ getTokenStartLine: /* @__PURE__ */ __name(() => lineStartOffset, "getTokenStartLine"),
8369
+ getTokenStartCharacter: /* @__PURE__ */ __name(() => tokenOffset - prevTokenLineStartOffset, "getTokenStartCharacter"),
8370
+ getTokenError: /* @__PURE__ */ __name(() => scanError, "getTokenError")
8371
+ };
8372
+ }
8373
+ __name(createScanner, "createScanner");
8374
+ function isWhiteSpace(ch) {
8375
+ return ch === 32 || ch === 9;
8376
+ }
8377
+ __name(isWhiteSpace, "isWhiteSpace");
8378
+ function isLineBreak(ch) {
8379
+ return ch === 10 || ch === 13;
8380
+ }
8381
+ __name(isLineBreak, "isLineBreak");
8382
+ function isDigit(ch) {
8383
+ return ch >= 48 && ch <= 57;
8384
+ }
8385
+ __name(isDigit, "isDigit");
8386
+ var CharacterCodes;
8387
+ (function(CharacterCodes2) {
8388
+ CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
8389
+ CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
8390
+ CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
8391
+ CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
8392
+ CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
8393
+ CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
8394
+ CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
8395
+ CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
8396
+ CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
8397
+ CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
8398
+ CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
8399
+ CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
8400
+ CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
8401
+ CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
8402
+ CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
8403
+ CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
8404
+ CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
8405
+ CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
8406
+ CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
8407
+ CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
8408
+ CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
8409
+ CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
8410
+ CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
8411
+ CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
8412
+ CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
8413
+ CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
8414
+ CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
8415
+ CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
8416
+ CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
8417
+ CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
8418
+ CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
8419
+ CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
8420
+ CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
8421
+ CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
8422
+ CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
8423
+ CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
8424
+ CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
8425
+ CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
8426
+ CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
8427
+ CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
8428
+ CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
8429
+ CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
8430
+ CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
8431
+ CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
8432
+ CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
8433
+ CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
8434
+ CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
8435
+ CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
8436
+ CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
8437
+ CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
8438
+ CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
8439
+ CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
8440
+ CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
8441
+ CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
8442
+ CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
8443
+ CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
8444
+ CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
8445
+ CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
8446
+ CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
8447
+ CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
8448
+ CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
8449
+ CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
8450
+ CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
8451
+ CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
8452
+ CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
8453
+ CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
8454
+ CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
8455
+ CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
8456
+ CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
8457
+ CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
8458
+ CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
8459
+ CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
8460
+ CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
8461
+ CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
8462
+ CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
8463
+ CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
8464
+ CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
8465
+ CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
8466
+ CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
8467
+ CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
8468
+ })(CharacterCodes || (CharacterCodes = {}));
8469
+
8470
+ // ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/string-intern.js
8471
+ init_cjs_shims();
8472
+ var cachedSpaces = new Array(20).fill(0).map((_, index) => {
8473
+ return " ".repeat(index);
8474
+ });
8475
+ var maxCachedValues = 200;
8476
+ var cachedBreakLinesWithSpaces = {
8477
+ " ": {
8478
+ "\n": new Array(maxCachedValues).fill(0).map((_, index) => {
8479
+ return "\n" + " ".repeat(index);
8480
+ }),
8481
+ "\r": new Array(maxCachedValues).fill(0).map((_, index) => {
8482
+ return "\r" + " ".repeat(index);
8483
+ }),
8484
+ "\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
8485
+ return "\r\n" + " ".repeat(index);
8486
+ })
8487
+ },
8488
+ " ": {
8489
+ "\n": new Array(maxCachedValues).fill(0).map((_, index) => {
8490
+ return "\n" + " ".repeat(index);
8491
+ }),
8492
+ "\r": new Array(maxCachedValues).fill(0).map((_, index) => {
8493
+ return "\r" + " ".repeat(index);
8494
+ }),
8495
+ "\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
8496
+ return "\r\n" + " ".repeat(index);
8497
+ })
8498
+ }
8499
+ };
8500
+
8501
+ // ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/edit.js
8502
+ init_cjs_shims();
8503
+
8504
+ // ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js
8505
+ init_cjs_shims();
8506
+ var ParseOptions;
8507
+ (function(ParseOptions2) {
8508
+ ParseOptions2.DEFAULT = {
8509
+ allowTrailingComma: false
8510
+ };
8511
+ })(ParseOptions || (ParseOptions = {}));
8512
+ function parse(text, errors = [], options = ParseOptions.DEFAULT) {
8513
+ let currentProperty = null;
8514
+ let currentParent = [];
8515
+ const previousParents = [];
8516
+ function onValue(value) {
8517
+ if (Array.isArray(currentParent)) {
8518
+ currentParent.push(value);
8519
+ } else if (currentProperty !== null) {
8520
+ currentParent[currentProperty] = value;
8521
+ }
8522
+ }
8523
+ __name(onValue, "onValue");
8524
+ const visitor = {
8525
+ onObjectBegin: /* @__PURE__ */ __name(() => {
8526
+ const object = {};
8527
+ onValue(object);
8528
+ previousParents.push(currentParent);
8529
+ currentParent = object;
8530
+ currentProperty = null;
8531
+ }, "onObjectBegin"),
8532
+ onObjectProperty: /* @__PURE__ */ __name((name) => {
8533
+ currentProperty = name;
8534
+ }, "onObjectProperty"),
8535
+ onObjectEnd: /* @__PURE__ */ __name(() => {
8536
+ currentParent = previousParents.pop();
8537
+ }, "onObjectEnd"),
8538
+ onArrayBegin: /* @__PURE__ */ __name(() => {
8539
+ const array = [];
8540
+ onValue(array);
8541
+ previousParents.push(currentParent);
8542
+ currentParent = array;
8543
+ currentProperty = null;
8544
+ }, "onArrayBegin"),
8545
+ onArrayEnd: /* @__PURE__ */ __name(() => {
8546
+ currentParent = previousParents.pop();
8547
+ }, "onArrayEnd"),
8548
+ onLiteralValue: onValue,
8549
+ onError: /* @__PURE__ */ __name((error, offset, length) => {
8550
+ errors.push({
8551
+ error,
8552
+ offset,
8553
+ length
8554
+ });
8555
+ }, "onError")
8556
+ };
8557
+ visit(text, visitor, options);
8558
+ return currentParent[0];
8559
+ }
8560
+ __name(parse, "parse");
8561
+ function visit(text, visitor, options = ParseOptions.DEFAULT) {
8562
+ const _scanner = createScanner(text, false);
8563
+ const _jsonPath = [];
8564
+ let suppressedCallbacks = 0;
8565
+ function toNoArgVisit(visitFunction) {
8566
+ return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
8567
+ }
8568
+ __name(toNoArgVisit, "toNoArgVisit");
8569
+ function toOneArgVisit(visitFunction) {
8570
+ return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
8571
+ }
8572
+ __name(toOneArgVisit, "toOneArgVisit");
8573
+ function toOneArgVisitWithPath(visitFunction) {
8574
+ return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
8575
+ }
8576
+ __name(toOneArgVisitWithPath, "toOneArgVisitWithPath");
8577
+ function toBeginVisit(visitFunction) {
8578
+ return visitFunction ? () => {
8579
+ if (suppressedCallbacks > 0) {
8580
+ suppressedCallbacks++;
8581
+ } else {
8582
+ let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());
8583
+ if (cbReturn === false) {
8584
+ suppressedCallbacks = 1;
8585
+ }
8586
+ }
8587
+ } : () => true;
8588
+ }
8589
+ __name(toBeginVisit, "toBeginVisit");
8590
+ function toEndVisit(visitFunction) {
8591
+ return visitFunction ? () => {
8592
+ if (suppressedCallbacks > 0) {
8593
+ suppressedCallbacks--;
8594
+ }
8595
+ if (suppressedCallbacks === 0) {
8596
+ visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
8597
+ }
8598
+ } : () => true;
8599
+ }
8600
+ __name(toEndVisit, "toEndVisit");
8601
+ const onObjectBegin = toBeginVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toEndVisit(visitor.onObjectEnd), onArrayBegin = toBeginVisit(visitor.onArrayBegin), onArrayEnd = toEndVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);
8602
+ const disallowComments = options && options.disallowComments;
8603
+ const allowTrailingComma = options && options.allowTrailingComma;
8604
+ function scanNext() {
8605
+ while (true) {
8606
+ const token = _scanner.scan();
8607
+ switch (_scanner.getTokenError()) {
8608
+ case 4:
8609
+ handleError(
8610
+ 14
8611
+ /* ParseErrorCode.InvalidUnicode */
8612
+ );
8613
+ break;
8614
+ case 5:
8615
+ handleError(
8616
+ 15
8617
+ /* ParseErrorCode.InvalidEscapeCharacter */
8618
+ );
8619
+ break;
8620
+ case 3:
8621
+ handleError(
8622
+ 13
8623
+ /* ParseErrorCode.UnexpectedEndOfNumber */
8624
+ );
8625
+ break;
8626
+ case 1:
8627
+ if (!disallowComments) {
8628
+ handleError(
8629
+ 11
8630
+ /* ParseErrorCode.UnexpectedEndOfComment */
8631
+ );
8632
+ }
8633
+ break;
8634
+ case 2:
8635
+ handleError(
8636
+ 12
8637
+ /* ParseErrorCode.UnexpectedEndOfString */
8638
+ );
8639
+ break;
8640
+ case 6:
8641
+ handleError(
8642
+ 16
8643
+ /* ParseErrorCode.InvalidCharacter */
8644
+ );
8645
+ break;
8646
+ }
8647
+ switch (token) {
8648
+ case 12:
8649
+ case 13:
8650
+ if (disallowComments) {
8651
+ handleError(
8652
+ 10
8653
+ /* ParseErrorCode.InvalidCommentToken */
8654
+ );
8655
+ } else {
8656
+ onComment();
8657
+ }
8658
+ break;
8659
+ case 16:
8660
+ handleError(
8661
+ 1
8662
+ /* ParseErrorCode.InvalidSymbol */
8663
+ );
8664
+ break;
8665
+ case 15:
8666
+ case 14:
8667
+ break;
8668
+ default:
8669
+ return token;
8670
+ }
8671
+ }
8672
+ }
8673
+ __name(scanNext, "scanNext");
8674
+ function handleError(error, skipUntilAfter = [], skipUntil = []) {
8675
+ onError(error);
8676
+ if (skipUntilAfter.length + skipUntil.length > 0) {
8677
+ let token = _scanner.getToken();
8678
+ while (token !== 17) {
8679
+ if (skipUntilAfter.indexOf(token) !== -1) {
8680
+ scanNext();
8681
+ break;
8682
+ } else if (skipUntil.indexOf(token) !== -1) {
8683
+ break;
8684
+ }
8685
+ token = scanNext();
8686
+ }
8687
+ }
8688
+ }
8689
+ __name(handleError, "handleError");
8690
+ function parseString(isValue) {
8691
+ const value = _scanner.getTokenValue();
8692
+ if (isValue) {
8693
+ onLiteralValue(value);
8694
+ } else {
8695
+ onObjectProperty(value);
8696
+ _jsonPath.push(value);
8697
+ }
8698
+ scanNext();
8699
+ return true;
8700
+ }
8701
+ __name(parseString, "parseString");
8702
+ function parseLiteral() {
8703
+ switch (_scanner.getToken()) {
8704
+ case 11:
8705
+ const tokenValue = _scanner.getTokenValue();
8706
+ let value = Number(tokenValue);
8707
+ if (isNaN(value)) {
8708
+ handleError(
8709
+ 2
8710
+ /* ParseErrorCode.InvalidNumberFormat */
8711
+ );
8712
+ value = 0;
8713
+ }
8714
+ onLiteralValue(value);
8715
+ break;
8716
+ case 7:
8717
+ onLiteralValue(null);
8718
+ break;
8719
+ case 8:
8720
+ onLiteralValue(true);
8721
+ break;
8722
+ case 9:
8723
+ onLiteralValue(false);
8724
+ break;
8725
+ default:
8726
+ return false;
8727
+ }
8728
+ scanNext();
8729
+ return true;
8730
+ }
8731
+ __name(parseLiteral, "parseLiteral");
8732
+ function parseProperty() {
8733
+ if (_scanner.getToken() !== 10) {
8734
+ handleError(3, [], [
8735
+ 2,
8736
+ 5
8737
+ /* SyntaxKind.CommaToken */
8738
+ ]);
8739
+ return false;
8740
+ }
8741
+ parseString(false);
8742
+ if (_scanner.getToken() === 6) {
8743
+ onSeparator(":");
8744
+ scanNext();
8745
+ if (!parseValue()) {
8746
+ handleError(4, [], [
8747
+ 2,
8748
+ 5
8749
+ /* SyntaxKind.CommaToken */
8750
+ ]);
8751
+ }
8752
+ } else {
8753
+ handleError(5, [], [
8754
+ 2,
8755
+ 5
8756
+ /* SyntaxKind.CommaToken */
8757
+ ]);
8758
+ }
8759
+ _jsonPath.pop();
8760
+ return true;
8761
+ }
8762
+ __name(parseProperty, "parseProperty");
8763
+ function parseObject() {
8764
+ onObjectBegin();
8765
+ scanNext();
8766
+ let needsComma = false;
8767
+ while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
8768
+ if (_scanner.getToken() === 5) {
8769
+ if (!needsComma) {
8770
+ handleError(4, [], []);
8771
+ }
8772
+ onSeparator(",");
8773
+ scanNext();
8774
+ if (_scanner.getToken() === 2 && allowTrailingComma) {
8775
+ break;
8776
+ }
8777
+ } else if (needsComma) {
8778
+ handleError(6, [], []);
8779
+ }
8780
+ if (!parseProperty()) {
8781
+ handleError(4, [], [
8782
+ 2,
8783
+ 5
8784
+ /* SyntaxKind.CommaToken */
8785
+ ]);
8786
+ }
8787
+ needsComma = true;
8788
+ }
8789
+ onObjectEnd();
8790
+ if (_scanner.getToken() !== 2) {
8791
+ handleError(7, [
8792
+ 2
8793
+ /* SyntaxKind.CloseBraceToken */
8794
+ ], []);
8795
+ } else {
8796
+ scanNext();
8797
+ }
8798
+ return true;
8799
+ }
8800
+ __name(parseObject, "parseObject");
8801
+ function parseArray() {
8802
+ onArrayBegin();
8803
+ scanNext();
8804
+ let isFirstElement = true;
8805
+ let needsComma = false;
8806
+ while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
8807
+ if (_scanner.getToken() === 5) {
8808
+ if (!needsComma) {
8809
+ handleError(4, [], []);
8810
+ }
8811
+ onSeparator(",");
8812
+ scanNext();
8813
+ if (_scanner.getToken() === 4 && allowTrailingComma) {
8814
+ break;
8815
+ }
8816
+ } else if (needsComma) {
8817
+ handleError(6, [], []);
8818
+ }
8819
+ if (isFirstElement) {
8820
+ _jsonPath.push(0);
8821
+ isFirstElement = false;
8822
+ } else {
8823
+ _jsonPath[_jsonPath.length - 1]++;
8824
+ }
8825
+ if (!parseValue()) {
8826
+ handleError(4, [], [
8827
+ 4,
8828
+ 5
8829
+ /* SyntaxKind.CommaToken */
8830
+ ]);
8831
+ }
8832
+ needsComma = true;
8833
+ }
8834
+ onArrayEnd();
8835
+ if (!isFirstElement) {
8836
+ _jsonPath.pop();
8837
+ }
8838
+ if (_scanner.getToken() !== 4) {
8839
+ handleError(8, [
8840
+ 4
8841
+ /* SyntaxKind.CloseBracketToken */
8842
+ ], []);
8843
+ } else {
8844
+ scanNext();
8845
+ }
8846
+ return true;
8847
+ }
8848
+ __name(parseArray, "parseArray");
8849
+ function parseValue() {
8850
+ switch (_scanner.getToken()) {
8851
+ case 3:
8852
+ return parseArray();
8853
+ case 1:
8854
+ return parseObject();
8855
+ case 10:
8856
+ return parseString(true);
8857
+ default:
8858
+ return parseLiteral();
8859
+ }
8860
+ }
8861
+ __name(parseValue, "parseValue");
8862
+ scanNext();
8863
+ if (_scanner.getToken() === 17) {
8864
+ if (options.allowEmptyContent) {
8865
+ return true;
8866
+ }
8867
+ handleError(4, [], []);
8868
+ return false;
8869
+ }
8870
+ if (!parseValue()) {
8871
+ handleError(4, [], []);
8872
+ return false;
8873
+ }
8874
+ if (_scanner.getToken() !== 17) {
8875
+ handleError(9, [], []);
8876
+ }
8877
+ return true;
8878
+ }
8879
+ __name(visit, "visit");
8880
+
8881
+ // ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
8882
+ var ScanError;
8883
+ (function(ScanError2) {
8884
+ ScanError2[ScanError2["None"] = 0] = "None";
8885
+ ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
8886
+ ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
8887
+ ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
8888
+ ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
8889
+ ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
8890
+ ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
8891
+ })(ScanError || (ScanError = {}));
8892
+ var SyntaxKind;
8893
+ (function(SyntaxKind2) {
8894
+ SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
8895
+ SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
8896
+ SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
8897
+ SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
8898
+ SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
8899
+ SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
8900
+ SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
8901
+ SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
8902
+ SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
8903
+ SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
8904
+ SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
8905
+ SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
8906
+ SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
8907
+ SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
8908
+ SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
8909
+ SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
8910
+ SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
8911
+ })(SyntaxKind || (SyntaxKind = {}));
8912
+ var parse2 = parse;
8913
+ var ParseErrorCode;
8914
+ (function(ParseErrorCode2) {
8915
+ ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
8916
+ ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
8917
+ ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
8918
+ ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
8919
+ ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
8920
+ ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
8921
+ ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
8922
+ ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
8923
+ ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
8924
+ ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
8925
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
8926
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
8927
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
8928
+ ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
8929
+ ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
8930
+ ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
8931
+ })(ParseErrorCode || (ParseErrorCode = {}));
8932
+ function printParseErrorCode(code) {
8933
+ switch (code) {
8934
+ case 1:
8935
+ return "InvalidSymbol";
8936
+ case 2:
8937
+ return "InvalidNumberFormat";
8938
+ case 3:
8939
+ return "PropertyNameExpected";
8940
+ case 4:
8941
+ return "ValueExpected";
8942
+ case 5:
8943
+ return "ColonExpected";
8944
+ case 6:
8945
+ return "CommaExpected";
8946
+ case 7:
8947
+ return "CloseBraceExpected";
8948
+ case 8:
8949
+ return "CloseBracketExpected";
8950
+ case 9:
8951
+ return "EndOfFileExpected";
8952
+ case 10:
8953
+ return "InvalidCommentToken";
8954
+ case 11:
8955
+ return "UnexpectedEndOfComment";
8956
+ case 12:
8957
+ return "UnexpectedEndOfString";
8958
+ case 13:
8959
+ return "UnexpectedEndOfNumber";
8960
+ case 14:
8961
+ return "InvalidUnicode";
8962
+ case 15:
8963
+ return "InvalidEscapeCharacter";
8964
+ case 16:
8965
+ return "InvalidCharacter";
8966
+ }
8967
+ return "<unknown ParseErrorCode>";
8968
+ }
8969
+ __name(printParseErrorCode, "printParseErrorCode");
8970
+
8971
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.js
8972
+ init_cjs_shims();
8973
+
8974
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/class-registry.js
8975
+ init_cjs_shims();
8976
+
8977
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/registry.js
8978
+ init_cjs_shims();
8979
+
8980
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/double-indexed-kv.js
8981
+ init_cjs_shims();
8982
+ var DoubleIndexedKV = class {
8983
+ static {
8984
+ __name(this, "DoubleIndexedKV");
8985
+ }
8986
+ constructor() {
8987
+ this.keyToValue = /* @__PURE__ */ new Map();
8988
+ this.valueToKey = /* @__PURE__ */ new Map();
8989
+ }
8990
+ set(key, value) {
8991
+ this.keyToValue.set(key, value);
8992
+ this.valueToKey.set(value, key);
8993
+ }
8994
+ getByKey(key) {
8995
+ return this.keyToValue.get(key);
8996
+ }
8997
+ getByValue(value) {
8998
+ return this.valueToKey.get(value);
8999
+ }
9000
+ clear() {
9001
+ this.keyToValue.clear();
9002
+ this.valueToKey.clear();
9003
+ }
9004
+ };
9005
+
9006
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/registry.js
9007
+ var Registry = class {
9008
+ static {
9009
+ __name(this, "Registry");
9010
+ }
9011
+ constructor(generateIdentifier) {
9012
+ this.generateIdentifier = generateIdentifier;
9013
+ this.kv = new DoubleIndexedKV();
9014
+ }
9015
+ register(value, identifier) {
9016
+ if (this.kv.getByValue(value)) {
9017
+ return;
9018
+ }
9019
+ if (!identifier) {
9020
+ identifier = this.generateIdentifier(value);
9021
+ }
9022
+ this.kv.set(identifier, value);
9023
+ }
9024
+ clear() {
9025
+ this.kv.clear();
9026
+ }
9027
+ getIdentifier(value) {
9028
+ return this.kv.getByValue(value);
9029
+ }
9030
+ getValue(identifier) {
9031
+ return this.kv.getByKey(identifier);
9032
+ }
9033
+ };
9034
+
9035
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/class-registry.js
9036
+ var ClassRegistry = class extends Registry {
9037
+ static {
9038
+ __name(this, "ClassRegistry");
9039
+ }
9040
+ constructor() {
9041
+ super((c) => c.name);
9042
+ this.classToAllowedProps = /* @__PURE__ */ new Map();
9043
+ }
9044
+ register(value, options) {
9045
+ if (typeof options === "object") {
9046
+ if (options.allowProps) {
9047
+ this.classToAllowedProps.set(value, options.allowProps);
9048
+ }
9049
+ super.register(value, options.identifier);
9050
+ } else {
9051
+ super.register(value, options);
9052
+ }
9053
+ }
9054
+ getAllowedProps(value) {
9055
+ return this.classToAllowedProps.get(value);
9056
+ }
9057
+ };
9058
+
9059
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/custom-transformer-registry.js
9060
+ init_cjs_shims();
9061
+
9062
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/util.js
9063
+ init_cjs_shims();
9064
+ function valuesOfObj(record) {
9065
+ if ("values" in Object) {
9066
+ return Object.values(record);
9067
+ }
9068
+ const values = [];
9069
+ for (const key in record) {
9070
+ if (record.hasOwnProperty(key)) {
9071
+ values.push(record[key]);
9072
+ }
9073
+ }
9074
+ return values;
9075
+ }
9076
+ __name(valuesOfObj, "valuesOfObj");
9077
+ function find(record, predicate) {
9078
+ const values = valuesOfObj(record);
9079
+ if ("find" in values) {
9080
+ return values.find(predicate);
9081
+ }
9082
+ const valuesNotNever = values;
9083
+ for (let i = 0; i < valuesNotNever.length; i++) {
9084
+ const value = valuesNotNever[i];
9085
+ if (predicate(value)) {
9086
+ return value;
9087
+ }
9088
+ }
9089
+ return void 0;
9090
+ }
9091
+ __name(find, "find");
9092
+ function forEach(record, run) {
9093
+ Object.entries(record).forEach(([key, value]) => run(value, key));
9094
+ }
9095
+ __name(forEach, "forEach");
9096
+ function includes(arr, value) {
9097
+ return arr.indexOf(value) !== -1;
9098
+ }
9099
+ __name(includes, "includes");
9100
+ function findArr(record, predicate) {
9101
+ for (let i = 0; i < record.length; i++) {
9102
+ const value = record[i];
9103
+ if (predicate(value)) {
9104
+ return value;
9105
+ }
9106
+ }
9107
+ return void 0;
9108
+ }
9109
+ __name(findArr, "findArr");
9110
+
9111
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/custom-transformer-registry.js
9112
+ var CustomTransformerRegistry = class {
9113
+ static {
9114
+ __name(this, "CustomTransformerRegistry");
9115
+ }
9116
+ constructor() {
9117
+ this.transfomers = {};
9118
+ }
9119
+ register(transformer) {
9120
+ this.transfomers[transformer.name] = transformer;
9121
+ }
9122
+ findApplicable(v) {
9123
+ return find(this.transfomers, (transformer) => transformer.isApplicable(v));
9124
+ }
9125
+ findByName(name) {
9126
+ return this.transfomers[name];
9127
+ }
9128
+ };
9129
+
9130
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/plainer.js
9131
+ init_cjs_shims();
9132
+
9133
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/is.js
9134
+ init_cjs_shims();
9135
+ var getType = /* @__PURE__ */ __name((payload) => Object.prototype.toString.call(payload).slice(8, -1), "getType");
9136
+ var isUndefined = /* @__PURE__ */ __name((payload) => typeof payload === "undefined", "isUndefined");
9137
+ var isNull = /* @__PURE__ */ __name((payload) => payload === null, "isNull");
9138
+ var isPlainObject2 = /* @__PURE__ */ __name((payload) => {
9139
+ if (typeof payload !== "object" || payload === null) return false;
9140
+ if (payload === Object.prototype) return false;
9141
+ if (Object.getPrototypeOf(payload) === null) return true;
9142
+ return Object.getPrototypeOf(payload) === Object.prototype;
9143
+ }, "isPlainObject");
9144
+ var isEmptyObject = /* @__PURE__ */ __name((payload) => isPlainObject2(payload) && Object.keys(payload).length === 0, "isEmptyObject");
9145
+ var isArray = /* @__PURE__ */ __name((payload) => Array.isArray(payload), "isArray");
9146
+ var isString2 = /* @__PURE__ */ __name((payload) => typeof payload === "string", "isString");
9147
+ var isNumber = /* @__PURE__ */ __name((payload) => typeof payload === "number" && !isNaN(payload), "isNumber");
9148
+ var isBoolean = /* @__PURE__ */ __name((payload) => typeof payload === "boolean", "isBoolean");
9149
+ var isRegExp = /* @__PURE__ */ __name((payload) => payload instanceof RegExp, "isRegExp");
9150
+ var isMap = /* @__PURE__ */ __name((payload) => payload instanceof Map, "isMap");
9151
+ var isSet = /* @__PURE__ */ __name((payload) => payload instanceof Set, "isSet");
9152
+ var isSymbol = /* @__PURE__ */ __name((payload) => getType(payload) === "Symbol", "isSymbol");
9153
+ var isDate = /* @__PURE__ */ __name((payload) => payload instanceof Date && !isNaN(payload.valueOf()), "isDate");
9154
+ var isError = /* @__PURE__ */ __name((payload) => payload instanceof Error, "isError");
9155
+ var isNaNValue = /* @__PURE__ */ __name((payload) => typeof payload === "number" && isNaN(payload), "isNaNValue");
9156
+ var isPrimitive = /* @__PURE__ */ __name((payload) => isBoolean(payload) || isNull(payload) || isUndefined(payload) || isNumber(payload) || isString2(payload) || isSymbol(payload), "isPrimitive");
9157
+ var isBigint = /* @__PURE__ */ __name((payload) => typeof payload === "bigint", "isBigint");
9158
+ var isInfinite = /* @__PURE__ */ __name((payload) => payload === Infinity || payload === -Infinity, "isInfinite");
9159
+ var isTypedArray = /* @__PURE__ */ __name((payload) => ArrayBuffer.isView(payload) && !(payload instanceof DataView), "isTypedArray");
9160
+ var isURL = /* @__PURE__ */ __name((payload) => payload instanceof URL, "isURL");
9161
+
9162
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/pathstringifier.js
9163
+ init_cjs_shims();
9164
+ var escapeKey = /* @__PURE__ */ __name((key) => key.replace(/\./g, "\\."), "escapeKey");
9165
+ var stringifyPath = /* @__PURE__ */ __name((path5) => path5.map(String).map(escapeKey).join("."), "stringifyPath");
9166
+ var parsePath = /* @__PURE__ */ __name((string) => {
9167
+ const result = [];
9168
+ let segment = "";
9169
+ for (let i = 0; i < string.length; i++) {
9170
+ let char = string.charAt(i);
9171
+ const isEscapedDot = char === "\\" && string.charAt(i + 1) === ".";
9172
+ if (isEscapedDot) {
9173
+ segment += ".";
9174
+ i++;
9175
+ continue;
9176
+ }
9177
+ const isEndOfSegment = char === ".";
9178
+ if (isEndOfSegment) {
9179
+ result.push(segment);
9180
+ segment = "";
9181
+ continue;
9182
+ }
9183
+ segment += char;
9184
+ }
9185
+ const lastSegment = segment;
9186
+ result.push(lastSegment);
9187
+ return result;
9188
+ }, "parsePath");
9189
+
9190
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/transformer.js
9191
+ init_cjs_shims();
9192
+ function simpleTransformation(isApplicable, annotation, transform, untransform) {
9193
+ return {
9194
+ isApplicable,
9195
+ annotation,
9196
+ transform,
9197
+ untransform
9198
+ };
9199
+ }
9200
+ __name(simpleTransformation, "simpleTransformation");
9201
+ var simpleRules = [
9202
+ simpleTransformation(isUndefined, "undefined", () => null, () => void 0),
9203
+ simpleTransformation(isBigint, "bigint", (v) => v.toString(), (v) => {
9204
+ if (typeof BigInt !== "undefined") {
9205
+ return BigInt(v);
9206
+ }
9207
+ console.error("Please add a BigInt polyfill.");
9208
+ return v;
9209
+ }),
9210
+ simpleTransformation(isDate, "Date", (v) => v.toISOString(), (v) => new Date(v)),
9211
+ simpleTransformation(isError, "Error", (v, superJson) => {
9212
+ const baseError = {
9213
+ name: v.name,
9214
+ message: v.message
9215
+ };
9216
+ superJson.allowedErrorProps.forEach((prop) => {
9217
+ baseError[prop] = v[prop];
9218
+ });
9219
+ return baseError;
9220
+ }, (v, superJson) => {
9221
+ const e = new Error(v.message);
9222
+ e.name = v.name;
9223
+ e.stack = v.stack;
9224
+ superJson.allowedErrorProps.forEach((prop) => {
9225
+ e[prop] = v[prop];
9226
+ });
9227
+ return e;
9228
+ }),
9229
+ simpleTransformation(isRegExp, "regexp", (v) => "" + v, (regex) => {
9230
+ const body = regex.slice(1, regex.lastIndexOf("/"));
9231
+ const flags = regex.slice(regex.lastIndexOf("/") + 1);
9232
+ return new RegExp(body, flags);
9233
+ }),
9234
+ simpleTransformation(
9235
+ isSet,
9236
+ "set",
9237
+ // (sets only exist in es6+)
9238
+ // eslint-disable-next-line es5/no-es6-methods
9239
+ (v) => [
9240
+ ...v.values()
9241
+ ],
9242
+ (v) => new Set(v)
9243
+ ),
9244
+ simpleTransformation(isMap, "map", (v) => [
9245
+ ...v.entries()
9246
+ ], (v) => new Map(v)),
9247
+ simpleTransformation((v) => isNaNValue(v) || isInfinite(v), "number", (v) => {
9248
+ if (isNaNValue(v)) {
9249
+ return "NaN";
9250
+ }
9251
+ if (v > 0) {
9252
+ return "Infinity";
9253
+ } else {
9254
+ return "-Infinity";
9255
+ }
9256
+ }, Number),
9257
+ simpleTransformation((v) => v === 0 && 1 / v === -Infinity, "number", () => {
9258
+ return "-0";
9259
+ }, Number),
9260
+ simpleTransformation(isURL, "URL", (v) => v.toString(), (v) => new URL(v))
9261
+ ];
9262
+ function compositeTransformation(isApplicable, annotation, transform, untransform) {
9263
+ return {
9264
+ isApplicable,
9265
+ annotation,
9266
+ transform,
9267
+ untransform
9268
+ };
9269
+ }
9270
+ __name(compositeTransformation, "compositeTransformation");
9271
+ var symbolRule = compositeTransformation((s, superJson) => {
9272
+ if (isSymbol(s)) {
9273
+ const isRegistered = !!superJson.symbolRegistry.getIdentifier(s);
9274
+ return isRegistered;
9275
+ }
9276
+ return false;
9277
+ }, (s, superJson) => {
9278
+ const identifier = superJson.symbolRegistry.getIdentifier(s);
9279
+ return [
9280
+ "symbol",
9281
+ identifier
9282
+ ];
9283
+ }, (v) => v.description, (_, a, superJson) => {
9284
+ const value = superJson.symbolRegistry.getValue(a[1]);
9285
+ if (!value) {
9286
+ throw new Error("Trying to deserialize unknown symbol");
9287
+ }
9288
+ return value;
9289
+ });
9290
+ var constructorToName = [
9291
+ Int8Array,
9292
+ Uint8Array,
9293
+ Int16Array,
9294
+ Uint16Array,
9295
+ Int32Array,
9296
+ Uint32Array,
9297
+ Float32Array,
9298
+ Float64Array,
9299
+ Uint8ClampedArray
9300
+ ].reduce((obj, ctor) => {
9301
+ obj[ctor.name] = ctor;
9302
+ return obj;
9303
+ }, {});
9304
+ var typedArrayRule = compositeTransformation(isTypedArray, (v) => [
9305
+ "typed-array",
9306
+ v.constructor.name
9307
+ ], (v) => [
9308
+ ...v
9309
+ ], (v, a) => {
9310
+ const ctor = constructorToName[a[1]];
9311
+ if (!ctor) {
9312
+ throw new Error("Trying to deserialize unknown typed array");
9313
+ }
9314
+ return new ctor(v);
9315
+ });
9316
+ function isInstanceOfRegisteredClass(potentialClass, superJson) {
9317
+ if (potentialClass?.constructor) {
9318
+ const isRegistered = !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
9319
+ return isRegistered;
9320
+ }
9321
+ return false;
9322
+ }
9323
+ __name(isInstanceOfRegisteredClass, "isInstanceOfRegisteredClass");
9324
+ var classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, superJson) => {
9325
+ const identifier = superJson.classRegistry.getIdentifier(clazz.constructor);
9326
+ return [
9327
+ "class",
9328
+ identifier
9329
+ ];
9330
+ }, (clazz, superJson) => {
9331
+ const allowedProps = superJson.classRegistry.getAllowedProps(clazz.constructor);
9332
+ if (!allowedProps) {
9333
+ return {
9334
+ ...clazz
9335
+ };
9336
+ }
9337
+ const result = {};
9338
+ allowedProps.forEach((prop) => {
9339
+ result[prop] = clazz[prop];
9340
+ });
9341
+ return result;
9342
+ }, (v, a, superJson) => {
9343
+ const clazz = superJson.classRegistry.getValue(a[1]);
9344
+ if (!clazz) {
9345
+ throw new Error(`Trying to deserialize unknown class '${a[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
9346
+ }
9347
+ return Object.assign(Object.create(clazz.prototype), v);
9348
+ });
9349
+ var customRule = compositeTransformation((value, superJson) => {
9350
+ return !!superJson.customTransformerRegistry.findApplicable(value);
9351
+ }, (value, superJson) => {
9352
+ const transformer = superJson.customTransformerRegistry.findApplicable(value);
9353
+ return [
9354
+ "custom",
9355
+ transformer.name
9356
+ ];
9357
+ }, (value, superJson) => {
9358
+ const transformer = superJson.customTransformerRegistry.findApplicable(value);
9359
+ return transformer.serialize(value);
9360
+ }, (v, a, superJson) => {
9361
+ const transformer = superJson.customTransformerRegistry.findByName(a[1]);
9362
+ if (!transformer) {
9363
+ throw new Error("Trying to deserialize unknown custom value");
9364
+ }
9365
+ return transformer.deserialize(v);
9366
+ });
9367
+ var compositeRules = [
9368
+ classRule,
9369
+ symbolRule,
9370
+ customRule,
9371
+ typedArrayRule
9372
+ ];
9373
+ var transformValue = /* @__PURE__ */ __name((value, superJson) => {
9374
+ const applicableCompositeRule = findArr(compositeRules, (rule) => rule.isApplicable(value, superJson));
9375
+ if (applicableCompositeRule) {
9376
+ return {
9377
+ value: applicableCompositeRule.transform(value, superJson),
9378
+ type: applicableCompositeRule.annotation(value, superJson)
9379
+ };
9380
+ }
9381
+ const applicableSimpleRule = findArr(simpleRules, (rule) => rule.isApplicable(value, superJson));
9382
+ if (applicableSimpleRule) {
9383
+ return {
9384
+ value: applicableSimpleRule.transform(value, superJson),
9385
+ type: applicableSimpleRule.annotation
9386
+ };
9387
+ }
9388
+ return void 0;
9389
+ }, "transformValue");
9390
+ var simpleRulesByAnnotation = {};
9391
+ simpleRules.forEach((rule) => {
9392
+ simpleRulesByAnnotation[rule.annotation] = rule;
9393
+ });
9394
+ var untransformValue = /* @__PURE__ */ __name((json, type, superJson) => {
9395
+ if (isArray(type)) {
9396
+ switch (type[0]) {
9397
+ case "symbol":
9398
+ return symbolRule.untransform(json, type, superJson);
9399
+ case "class":
9400
+ return classRule.untransform(json, type, superJson);
9401
+ case "custom":
9402
+ return customRule.untransform(json, type, superJson);
9403
+ case "typed-array":
9404
+ return typedArrayRule.untransform(json, type, superJson);
9405
+ default:
9406
+ throw new Error("Unknown transformation: " + type);
9407
+ }
9408
+ } else {
9409
+ const transformation = simpleRulesByAnnotation[type];
9410
+ if (!transformation) {
9411
+ throw new Error("Unknown transformation: " + type);
9412
+ }
9413
+ return transformation.untransform(json, superJson);
9414
+ }
9415
+ }, "untransformValue");
9416
+
9417
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/accessDeep.js
9418
+ init_cjs_shims();
9419
+ var getNthKey = /* @__PURE__ */ __name((value, n) => {
9420
+ if (n > value.size) throw new Error("index out of bounds");
9421
+ const keys = value.keys();
9422
+ while (n > 0) {
9423
+ keys.next();
9424
+ n--;
9425
+ }
9426
+ return keys.next().value;
9427
+ }, "getNthKey");
9428
+ function validatePath(path5) {
9429
+ if (includes(path5, "__proto__")) {
9430
+ throw new Error("__proto__ is not allowed as a property");
9431
+ }
9432
+ if (includes(path5, "prototype")) {
9433
+ throw new Error("prototype is not allowed as a property");
9434
+ }
9435
+ if (includes(path5, "constructor")) {
9436
+ throw new Error("constructor is not allowed as a property");
9437
+ }
9438
+ }
9439
+ __name(validatePath, "validatePath");
9440
+ var getDeep = /* @__PURE__ */ __name((object, path5) => {
9441
+ validatePath(path5);
9442
+ for (let i = 0; i < path5.length; i++) {
9443
+ const key = path5[i];
9444
+ if (isSet(object)) {
9445
+ object = getNthKey(object, +key);
9446
+ } else if (isMap(object)) {
9447
+ const row = +key;
9448
+ const type = +path5[++i] === 0 ? "key" : "value";
9449
+ const keyOfRow = getNthKey(object, row);
9450
+ switch (type) {
9451
+ case "key":
9452
+ object = keyOfRow;
9453
+ break;
9454
+ case "value":
9455
+ object = object.get(keyOfRow);
9456
+ break;
9457
+ }
9458
+ } else {
9459
+ object = object[key];
9460
+ }
9461
+ }
9462
+ return object;
9463
+ }, "getDeep");
9464
+ var setDeep = /* @__PURE__ */ __name((object, path5, mapper) => {
9465
+ validatePath(path5);
9466
+ if (path5.length === 0) {
9467
+ return mapper(object);
9468
+ }
9469
+ let parent = object;
9470
+ for (let i = 0; i < path5.length - 1; i++) {
9471
+ const key = path5[i];
9472
+ if (isArray(parent)) {
9473
+ const index = +key;
9474
+ parent = parent[index];
9475
+ } else if (isPlainObject2(parent)) {
9476
+ parent = parent[key];
9477
+ } else if (isSet(parent)) {
9478
+ const row = +key;
9479
+ parent = getNthKey(parent, row);
9480
+ } else if (isMap(parent)) {
9481
+ const isEnd = i === path5.length - 2;
9482
+ if (isEnd) {
9483
+ break;
9484
+ }
9485
+ const row = +key;
9486
+ const type = +path5[++i] === 0 ? "key" : "value";
9487
+ const keyOfRow = getNthKey(parent, row);
9488
+ switch (type) {
9489
+ case "key":
9490
+ parent = keyOfRow;
9491
+ break;
9492
+ case "value":
9493
+ parent = parent.get(keyOfRow);
9494
+ break;
9495
+ }
9496
+ }
9497
+ }
9498
+ const lastKey = path5[path5.length - 1];
9499
+ if (isArray(parent)) {
9500
+ parent[+lastKey] = mapper(parent[+lastKey]);
9501
+ } else if (isPlainObject2(parent)) {
9502
+ parent[lastKey] = mapper(parent[lastKey]);
9503
+ }
9504
+ if (isSet(parent)) {
9505
+ const oldValue = getNthKey(parent, +lastKey);
9506
+ const newValue = mapper(oldValue);
9507
+ if (oldValue !== newValue) {
9508
+ parent.delete(oldValue);
9509
+ parent.add(newValue);
9510
+ }
9511
+ }
9512
+ if (isMap(parent)) {
9513
+ const row = +path5[path5.length - 2];
9514
+ const keyToRow = getNthKey(parent, row);
9515
+ const type = +lastKey === 0 ? "key" : "value";
9516
+ switch (type) {
9517
+ case "key": {
9518
+ const newKey = mapper(keyToRow);
9519
+ parent.set(newKey, parent.get(keyToRow));
9520
+ if (newKey !== keyToRow) {
9521
+ parent.delete(keyToRow);
9522
+ }
9523
+ break;
9524
+ }
9525
+ case "value": {
9526
+ parent.set(keyToRow, mapper(parent.get(keyToRow)));
9527
+ break;
6022
9528
  }
6023
9529
  }
6024
9530
  }
9531
+ return object;
9532
+ }, "setDeep");
9533
+
9534
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/plainer.js
9535
+ function traverse(tree, walker2, origin = []) {
9536
+ if (!tree) {
9537
+ return;
9538
+ }
9539
+ if (!isArray(tree)) {
9540
+ forEach(tree, (subtree, key) => traverse(subtree, walker2, [
9541
+ ...origin,
9542
+ ...parsePath(key)
9543
+ ]));
9544
+ return;
9545
+ }
9546
+ const [nodeValue, children] = tree;
9547
+ if (children) {
9548
+ forEach(children, (child, key) => {
9549
+ traverse(child, walker2, [
9550
+ ...origin,
9551
+ ...parsePath(key)
9552
+ ]);
9553
+ });
9554
+ }
9555
+ walker2(nodeValue, origin);
6025
9556
  }
6026
- __name(resolveModelsComments, "resolveModelsComments");
6027
- var getImports = /* @__PURE__ */ __name((type, newPath) => {
6028
- let statement = "";
6029
- if (type === "trpc") {
6030
- statement = "import * as trpc from '@trpc/server';\n";
6031
- } else if (type === "trpc-shield") {
6032
- statement = "import { shield, allow } from 'trpc-shield';\n";
6033
- } else if (type === "context") {
6034
- statement = `import { Context } from '${newPath}';
6035
- `;
9557
+ __name(traverse, "traverse");
9558
+ function applyValueAnnotations(plain, annotations, superJson) {
9559
+ traverse(annotations, (type, path5) => {
9560
+ plain = setDeep(plain, path5, (v) => untransformValue(v, type, superJson));
9561
+ });
9562
+ return plain;
9563
+ }
9564
+ __name(applyValueAnnotations, "applyValueAnnotations");
9565
+ function applyReferentialEqualityAnnotations(plain, annotations) {
9566
+ function apply(identicalPaths, path5) {
9567
+ const object = getDeep(plain, parsePath(path5));
9568
+ identicalPaths.map(parsePath).forEach((identicalObjectPath) => {
9569
+ plain = setDeep(plain, identicalObjectPath, () => object);
9570
+ });
6036
9571
  }
6037
- return statement;
6038
- }, "getImports");
6039
- var wrapWithObject = /* @__PURE__ */ __name(({ shieldItemLines }) => {
6040
- let wrapped = "{";
6041
- wrapped += "\n";
6042
- wrapped += Array.isArray(shieldItemLines) ? ` ${shieldItemLines.join(",\r\n")}` : ` ${shieldItemLines}`;
6043
- wrapped += "\n";
6044
- wrapped += "}";
6045
- return wrapped;
6046
- }, "wrapWithObject");
6047
- var wrapWithTrpcShieldCall = /* @__PURE__ */ __name(({ shieldObjectTextWrapped }) => {
6048
- let wrapped = "shield<Context>(";
6049
- wrapped += "\n";
6050
- wrapped += ` ${shieldObjectTextWrapped}`;
6051
- wrapped += "\n";
6052
- wrapped += ")";
6053
- return wrapped;
6054
- }, "wrapWithTrpcShieldCall");
6055
- var wrapWithExport = /* @__PURE__ */ __name(({ shieldObjectText }) => {
6056
- return `export const permissions = ${shieldObjectText};`;
6057
- }, "wrapWithExport");
6058
- var constructShield = /* @__PURE__ */ __name(async ({ queries, mutations, subscriptions }, config, options) => {
6059
- if (queries.length === 0 && mutations.length === 0 && subscriptions.length === 0) {
6060
- return "";
9572
+ __name(apply, "apply");
9573
+ if (isArray(annotations)) {
9574
+ const [root, other] = annotations;
9575
+ root.forEach((identicalPath) => {
9576
+ plain = setDeep(plain, parsePath(identicalPath), () => plain);
9577
+ });
9578
+ if (other) {
9579
+ forEach(other, apply);
9580
+ }
9581
+ } else {
9582
+ forEach(annotations, apply);
6061
9583
  }
6062
- let rootItems = "";
6063
- if (queries.length > 0) {
6064
- const queryLinesWrapped = `query: ${wrapWithObject({
6065
- shieldItemLines: queries.map((query) => `${query}: allow`)
6066
- })},`;
6067
- rootItems += queryLinesWrapped;
9584
+ return plain;
9585
+ }
9586
+ __name(applyReferentialEqualityAnnotations, "applyReferentialEqualityAnnotations");
9587
+ var isDeep = /* @__PURE__ */ __name((object, superJson) => isPlainObject2(object) || isArray(object) || isMap(object) || isSet(object) || isInstanceOfRegisteredClass(object, superJson), "isDeep");
9588
+ function addIdentity(object, path5, identities) {
9589
+ const existingSet = identities.get(object);
9590
+ if (existingSet) {
9591
+ existingSet.push(path5);
9592
+ } else {
9593
+ identities.set(object, [
9594
+ path5
9595
+ ]);
6068
9596
  }
6069
- if (mutations.length > 0) {
6070
- const mutationLinesWrapped = `mutation: ${wrapWithObject({
6071
- shieldItemLines: mutations.map((mutation) => `${mutation}: allow`)
6072
- })},`;
6073
- rootItems += mutationLinesWrapped;
9597
+ }
9598
+ __name(addIdentity, "addIdentity");
9599
+ function generateReferentialEqualityAnnotations(identitites, dedupe) {
9600
+ const result = {};
9601
+ let rootEqualityPaths = void 0;
9602
+ identitites.forEach((paths) => {
9603
+ if (paths.length <= 1) {
9604
+ return;
9605
+ }
9606
+ if (!dedupe) {
9607
+ paths = paths.map((path5) => path5.map(String)).sort((a, b) => a.length - b.length);
9608
+ }
9609
+ const [representativePath, ...identicalPaths] = paths;
9610
+ if (representativePath.length === 0) {
9611
+ rootEqualityPaths = identicalPaths.map(stringifyPath);
9612
+ } else {
9613
+ result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
9614
+ }
9615
+ });
9616
+ if (rootEqualityPaths) {
9617
+ if (isEmptyObject(result)) {
9618
+ return [
9619
+ rootEqualityPaths
9620
+ ];
9621
+ } else {
9622
+ return [
9623
+ rootEqualityPaths,
9624
+ result
9625
+ ];
9626
+ }
9627
+ } else {
9628
+ return isEmptyObject(result) ? void 0 : result;
6074
9629
  }
6075
- if (subscriptions.length > 0) {
6076
- const subscriptionLinesWrapped = `subscription: ${wrapWithObject({
6077
- shieldItemLines: subscriptions.map((subscription) => `${subscription}: allow`)
6078
- })},`;
6079
- rootItems += subscriptionLinesWrapped;
9630
+ }
9631
+ __name(generateReferentialEqualityAnnotations, "generateReferentialEqualityAnnotations");
9632
+ var walker = /* @__PURE__ */ __name((object, identities, superJson, dedupe, path5 = [], objectsInThisPath = [], seenObjects = /* @__PURE__ */ new Map()) => {
9633
+ const primitive = isPrimitive(object);
9634
+ if (!primitive) {
9635
+ addIdentity(object, path5, identities);
9636
+ const seen = seenObjects.get(object);
9637
+ if (seen) {
9638
+ return dedupe ? {
9639
+ transformedValue: null
9640
+ } : seen;
9641
+ }
9642
+ }
9643
+ if (!isDeep(object, superJson)) {
9644
+ const transformed2 = transformValue(object, superJson);
9645
+ const result2 = transformed2 ? {
9646
+ transformedValue: transformed2.value,
9647
+ annotations: [
9648
+ transformed2.type
9649
+ ]
9650
+ } : {
9651
+ transformedValue: object
9652
+ };
9653
+ if (!primitive) {
9654
+ seenObjects.set(object, result2);
9655
+ }
9656
+ return result2;
6080
9657
  }
6081
- if (rootItems.length === 0) return "";
6082
- let shieldText = getImports("trpc-shield");
6083
- const internals = await getPrismaInternals();
6084
- const outputDir = internals.parseEnvValue(options.generator.output);
6085
- shieldText += getImports("context", getRelativePath(outputDir, config.contextPath, true, options.schemaPath));
6086
- shieldText += "\n\n";
6087
- shieldText += wrapWithExport({
6088
- shieldObjectText: wrapWithTrpcShieldCall({
6089
- shieldObjectTextWrapped: wrapWithObject({
6090
- shieldItemLines: rootItems
6091
- })
6092
- })
9658
+ if (includes(objectsInThisPath, object)) {
9659
+ return {
9660
+ transformedValue: null
9661
+ };
9662
+ }
9663
+ const transformationResult = transformValue(object, superJson);
9664
+ const transformed = transformationResult?.value ?? object;
9665
+ const transformedValue = isArray(transformed) ? [] : {};
9666
+ const innerAnnotations = {};
9667
+ forEach(transformed, (value, index) => {
9668
+ if (index === "__proto__" || index === "constructor" || index === "prototype") {
9669
+ throw new Error(`Detected property ${index}. This is a prototype pollution risk, please remove it from your object.`);
9670
+ }
9671
+ const recursiveResult = walker(value, identities, superJson, dedupe, [
9672
+ ...path5,
9673
+ index
9674
+ ], [
9675
+ ...objectsInThisPath,
9676
+ object
9677
+ ], seenObjects);
9678
+ transformedValue[index] = recursiveResult.transformedValue;
9679
+ if (isArray(recursiveResult.annotations)) {
9680
+ innerAnnotations[index] = recursiveResult.annotations;
9681
+ } else if (isPlainObject2(recursiveResult.annotations)) {
9682
+ forEach(recursiveResult.annotations, (tree, key) => {
9683
+ innerAnnotations[escapeKey(index) + "." + key] = tree;
9684
+ });
9685
+ }
6093
9686
  });
6094
- return shieldText;
6095
- }, "constructShield");
9687
+ const result = isEmptyObject(innerAnnotations) ? {
9688
+ transformedValue,
9689
+ annotations: !!transformationResult ? [
9690
+ transformationResult.type
9691
+ ] : void 0
9692
+ } : {
9693
+ transformedValue,
9694
+ annotations: !!transformationResult ? [
9695
+ transformationResult.type,
9696
+ innerAnnotations
9697
+ ] : innerAnnotations
9698
+ };
9699
+ if (!primitive) {
9700
+ seenObjects.set(object, result);
9701
+ }
9702
+ return result;
9703
+ }, "walker");
6096
9704
 
6097
- // src/project.ts
9705
+ // ../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
6098
9706
  init_cjs_shims();
6099
- var import_ts_morph = require("ts-morph");
6100
- var compilerOptions = {
6101
- target: import_ts_morph.ScriptTarget.ESNext,
6102
- module: import_ts_morph.ModuleKind.ESNext,
6103
- emitDecoratorMetadata: true,
6104
- experimentalDecorators: true,
6105
- esModuleInterop: true
6106
- };
6107
- var project = new import_ts_morph.Project({
6108
- compilerOptions: {
6109
- ...compilerOptions
9707
+
9708
+ // ../../node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.js
9709
+ init_cjs_shims();
9710
+ function getType2(payload) {
9711
+ return Object.prototype.toString.call(payload).slice(8, -1);
9712
+ }
9713
+ __name(getType2, "getType");
9714
+ function isArray2(payload) {
9715
+ return getType2(payload) === "Array";
9716
+ }
9717
+ __name(isArray2, "isArray");
9718
+ function isPlainObject3(payload) {
9719
+ if (getType2(payload) !== "Object") return false;
9720
+ const prototype = Object.getPrototypeOf(payload);
9721
+ return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
9722
+ }
9723
+ __name(isPlainObject3, "isPlainObject");
9724
+ function isNull2(payload) {
9725
+ return getType2(payload) === "Null";
9726
+ }
9727
+ __name(isNull2, "isNull");
9728
+ function isOneOf(a, b, c, d, e) {
9729
+ return (value) => a(value) || b(value) || !!c && c(value) || !!d && d(value) || !!e && e(value);
9730
+ }
9731
+ __name(isOneOf, "isOneOf");
9732
+ function isUndefined2(payload) {
9733
+ return getType2(payload) === "Undefined";
9734
+ }
9735
+ __name(isUndefined2, "isUndefined");
9736
+ var isNullOrUndefined = isOneOf(isNull2, isUndefined2);
9737
+
9738
+ // ../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
9739
+ function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
9740
+ const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable";
9741
+ if (propType === "enumerable") carry[key] = newVal;
9742
+ if (includeNonenumerable && propType === "nonenumerable") {
9743
+ Object.defineProperty(carry, key, {
9744
+ value: newVal,
9745
+ enumerable: false,
9746
+ writable: true,
9747
+ configurable: true
9748
+ });
6110
9749
  }
6111
- });
9750
+ }
9751
+ __name(assignProp, "assignProp");
9752
+ function copy(target, options = {}) {
9753
+ if (isArray2(target)) {
9754
+ return target.map((item) => copy(item, options));
9755
+ }
9756
+ if (!isPlainObject3(target)) {
9757
+ return target;
9758
+ }
9759
+ const props = Object.getOwnPropertyNames(target);
9760
+ const symbols = Object.getOwnPropertySymbols(target);
9761
+ return [
9762
+ ...props,
9763
+ ...symbols
9764
+ ].reduce((carry, key) => {
9765
+ if (isArray2(options.props) && !options.props.includes(key)) {
9766
+ return carry;
9767
+ }
9768
+ const val = target[key];
9769
+ const newVal = copy(val, options);
9770
+ assignProp(carry, key, newVal, target, options.nonenumerable);
9771
+ return carry;
9772
+ }, {});
9773
+ }
9774
+ __name(copy, "copy");
6112
9775
 
6113
- // src/utils/remove-dir.ts
9776
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.js
9777
+ var SuperJSON = class {
9778
+ static {
9779
+ __name(this, "SuperJSON");
9780
+ }
9781
+ /**
9782
+ * @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
9783
+ */
9784
+ constructor({ dedupe = false } = {}) {
9785
+ this.classRegistry = new ClassRegistry();
9786
+ this.symbolRegistry = new Registry((s) => s.description ?? "");
9787
+ this.customTransformerRegistry = new CustomTransformerRegistry();
9788
+ this.allowedErrorProps = [];
9789
+ this.dedupe = dedupe;
9790
+ }
9791
+ serialize(object) {
9792
+ const identities = /* @__PURE__ */ new Map();
9793
+ const output = walker(object, identities, this, this.dedupe);
9794
+ const res = {
9795
+ json: output.transformedValue
9796
+ };
9797
+ if (output.annotations) {
9798
+ res.meta = {
9799
+ ...res.meta,
9800
+ values: output.annotations
9801
+ };
9802
+ }
9803
+ const equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
9804
+ if (equalityAnnotations) {
9805
+ res.meta = {
9806
+ ...res.meta,
9807
+ referentialEqualities: equalityAnnotations
9808
+ };
9809
+ }
9810
+ return res;
9811
+ }
9812
+ deserialize(payload) {
9813
+ const { json, meta } = payload;
9814
+ let result = copy(json);
9815
+ if (meta?.values) {
9816
+ result = applyValueAnnotations(result, meta.values, this);
9817
+ }
9818
+ if (meta?.referentialEqualities) {
9819
+ result = applyReferentialEqualityAnnotations(result, meta.referentialEqualities);
9820
+ }
9821
+ return result;
9822
+ }
9823
+ stringify(object) {
9824
+ return JSON.stringify(this.serialize(object));
9825
+ }
9826
+ parse(string) {
9827
+ return this.deserialize(JSON.parse(string));
9828
+ }
9829
+ registerClass(v, options) {
9830
+ this.classRegistry.register(v, options);
9831
+ }
9832
+ registerSymbol(v, identifier) {
9833
+ this.symbolRegistry.register(v, identifier);
9834
+ }
9835
+ registerCustom(transformer, name) {
9836
+ this.customTransformerRegistry.register({
9837
+ name,
9838
+ ...transformer
9839
+ });
9840
+ }
9841
+ allowErrorProps(...props) {
9842
+ this.allowedErrorProps.push(...props);
9843
+ }
9844
+ };
9845
+ SuperJSON.defaultInstance = new SuperJSON();
9846
+ SuperJSON.serialize = SuperJSON.defaultInstance.serialize.bind(SuperJSON.defaultInstance);
9847
+ SuperJSON.deserialize = SuperJSON.defaultInstance.deserialize.bind(SuperJSON.defaultInstance);
9848
+ SuperJSON.stringify = SuperJSON.defaultInstance.stringify.bind(SuperJSON.defaultInstance);
9849
+ SuperJSON.parse = SuperJSON.defaultInstance.parse.bind(SuperJSON.defaultInstance);
9850
+ SuperJSON.registerClass = SuperJSON.defaultInstance.registerClass.bind(SuperJSON.defaultInstance);
9851
+ SuperJSON.registerSymbol = SuperJSON.defaultInstance.registerSymbol.bind(SuperJSON.defaultInstance);
9852
+ SuperJSON.registerCustom = SuperJSON.defaultInstance.registerCustom.bind(SuperJSON.defaultInstance);
9853
+ SuperJSON.allowErrorProps = SuperJSON.defaultInstance.allowErrorProps.bind(SuperJSON.defaultInstance);
9854
+ var serialize = SuperJSON.serialize;
9855
+ var deserialize = SuperJSON.deserialize;
9856
+ var stringify = SuperJSON.stringify;
9857
+ var parse3 = SuperJSON.parse;
9858
+ var registerClass = SuperJSON.registerClass;
9859
+ var registerCustom = SuperJSON.registerCustom;
9860
+ var registerSymbol = SuperJSON.registerSymbol;
9861
+ var allowErrorProps = SuperJSON.allowErrorProps;
9862
+
9863
+ // ../json/src/utils/parse-error.ts
6114
9864
  init_cjs_shims();
6115
- var import_node_fs3 = require("node:fs");
6116
- var import_node_path4 = __toESM(require("node:path"), 1);
6117
- async function removeDir(dirPath, onlyContent) {
6118
- const dirEntries = await import_node_fs3.promises.readdir(dirPath, {
6119
- withFileTypes: true
6120
- });
6121
- await Promise.all(dirEntries.map(async (dirEntry) => {
6122
- const fullPath = import_node_path4.default.join(dirPath, dirEntry.name);
6123
- return dirEntry.isDirectory() ? removeDir(fullPath, false) : import_node_fs3.promises.unlink(fullPath);
6124
- }));
6125
- if (!onlyContent) {
6126
- await import_node_fs3.promises.rmdir(dirPath);
9865
+
9866
+ // ../../node_modules/.pnpm/lines-and-columns@2.0.4/node_modules/lines-and-columns/build/index.mjs
9867
+ init_cjs_shims();
9868
+ var LF = "\n";
9869
+ var CR = "\r";
9870
+ var LinesAndColumns = (
9871
+ /** @class */
9872
+ function() {
9873
+ function LinesAndColumns2(string) {
9874
+ this.length = string.length;
9875
+ var offsets = [0];
9876
+ for (var offset = 0; offset < string.length; ) {
9877
+ switch (string[offset]) {
9878
+ case LF:
9879
+ offset += LF.length;
9880
+ offsets.push(offset);
9881
+ break;
9882
+ case CR:
9883
+ offset += CR.length;
9884
+ if (string[offset] === LF) {
9885
+ offset += LF.length;
9886
+ }
9887
+ offsets.push(offset);
9888
+ break;
9889
+ default:
9890
+ offset++;
9891
+ break;
9892
+ }
9893
+ }
9894
+ this.offsets = offsets;
9895
+ }
9896
+ __name(LinesAndColumns2, "LinesAndColumns");
9897
+ LinesAndColumns2.prototype.locationForIndex = function(index) {
9898
+ if (index < 0 || index > this.length) {
9899
+ return null;
9900
+ }
9901
+ var line = 0;
9902
+ var offsets = this.offsets;
9903
+ while (offsets[line + 1] <= index) {
9904
+ line++;
9905
+ }
9906
+ var column = index - offsets[line];
9907
+ return { line, column };
9908
+ };
9909
+ LinesAndColumns2.prototype.indexForLocation = function(location) {
9910
+ var line = location.line, column = location.column;
9911
+ if (line < 0 || line >= this.offsets.length) {
9912
+ return null;
9913
+ }
9914
+ if (column < 0 || column > this.lengthOfLine(line)) {
9915
+ return null;
9916
+ }
9917
+ return this.offsets[line] + column;
9918
+ };
9919
+ LinesAndColumns2.prototype.lengthOfLine = function(line) {
9920
+ var offset = this.offsets[line];
9921
+ var nextOffset = line === this.offsets.length - 1 ? this.length : this.offsets[line + 1];
9922
+ return nextOffset - offset;
9923
+ };
9924
+ return LinesAndColumns2;
9925
+ }()
9926
+ );
9927
+
9928
+ // ../json/src/utils/code-frames.ts
9929
+ init_cjs_shims();
9930
+ var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
9931
+ function getMarkerLines(loc, source, opts = {}) {
9932
+ const startLoc = {
9933
+ column: 0,
9934
+ line: -1,
9935
+ ...loc.start
9936
+ };
9937
+ const endLoc = {
9938
+ ...startLoc,
9939
+ ...loc.end
9940
+ };
9941
+ const { linesAbove = 2, linesBelow = 3 } = opts || {};
9942
+ const startLine = startLoc.line;
9943
+ const startColumn = startLoc.column;
9944
+ const endLine = endLoc.line;
9945
+ const endColumn = endLoc.column;
9946
+ let start = Math.max(startLine - (linesAbove + 1), 0);
9947
+ let end = Math.min(source.length, endLine + linesBelow);
9948
+ if (startLine === -1) {
9949
+ start = 0;
9950
+ }
9951
+ if (endLine === -1) {
9952
+ end = source.length;
9953
+ }
9954
+ const lineDiff = endLine - startLine;
9955
+ const markerLines = {};
9956
+ if (lineDiff) {
9957
+ for (let i = 0; i <= lineDiff; i++) {
9958
+ const lineNumber = i + startLine;
9959
+ if (!startColumn) {
9960
+ markerLines[lineNumber] = true;
9961
+ } else if (i === 0) {
9962
+ const sourceLength = source[lineNumber - 1]?.length ?? 0;
9963
+ markerLines[lineNumber] = [
9964
+ startColumn,
9965
+ sourceLength - startColumn + 1
9966
+ ];
9967
+ } else if (i === lineDiff) {
9968
+ markerLines[lineNumber] = [
9969
+ 0,
9970
+ endColumn
9971
+ ];
9972
+ } else {
9973
+ const sourceLength = source[lineNumber - i]?.length ?? 0;
9974
+ markerLines[lineNumber] = [
9975
+ 0,
9976
+ sourceLength
9977
+ ];
9978
+ }
9979
+ }
9980
+ } else if (startColumn === endColumn) {
9981
+ markerLines[startLine] = startColumn ? [
9982
+ startColumn,
9983
+ 0
9984
+ ] : true;
9985
+ } else {
9986
+ markerLines[startLine] = [
9987
+ startColumn,
9988
+ endColumn - startColumn
9989
+ ];
6127
9990
  }
9991
+ return {
9992
+ start,
9993
+ end,
9994
+ markerLines
9995
+ };
6128
9996
  }
6129
- __name(removeDir, "removeDir");
9997
+ __name(getMarkerLines, "getMarkerLines");
9998
+ function codeFrameColumns(rawLines, loc, opts = {}) {
9999
+ const lines = rawLines.split(NEWLINE);
10000
+ const { start, end, markerLines } = getMarkerLines(loc, lines, opts);
10001
+ const numberMaxWidth = String(end).length;
10002
+ const highlightedLines = opts.highlight ? opts.highlight(rawLines) : rawLines;
10003
+ const frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => {
10004
+ const number = start + 1 + index;
10005
+ const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
10006
+ const gutter = ` ${paddedNumber} | `;
10007
+ const hasMarker = Boolean(markerLines[number] ?? false);
10008
+ if (hasMarker) {
10009
+ let markerLine = "";
10010
+ if (Array.isArray(hasMarker)) {
10011
+ const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
10012
+ const numberOfMarkers = hasMarker[1] || 1;
10013
+ markerLine = [
10014
+ "\n ",
10015
+ gutter.replace(/\d/g, " "),
10016
+ markerSpacing,
10017
+ "^".repeat(numberOfMarkers)
10018
+ ].join("");
10019
+ }
10020
+ return [
10021
+ ">",
10022
+ gutter,
10023
+ line,
10024
+ markerLine
10025
+ ].join("");
10026
+ }
10027
+ return ` ${gutter}${line}`;
10028
+ }).join("\n");
10029
+ return frame;
10030
+ }
10031
+ __name(codeFrameColumns, "codeFrameColumns");
6130
10032
 
6131
- // src/utils/write-file-safely.ts
10033
+ // ../json/src/utils/parse-error.ts
10034
+ function formatParseError(input, parseError) {
10035
+ const { error, offset, length } = parseError;
10036
+ const result = new LinesAndColumns(input).locationForIndex(offset);
10037
+ let line = result?.line ?? 0;
10038
+ let column = result?.column ?? 0;
10039
+ line++;
10040
+ column++;
10041
+ return `${printParseErrorCode(error)} in JSON at ${line}:${column}
10042
+ ${codeFrameColumns(input, {
10043
+ start: {
10044
+ line,
10045
+ column
10046
+ },
10047
+ end: {
10048
+ line,
10049
+ column: column + length
10050
+ }
10051
+ })}
10052
+ `;
10053
+ }
10054
+ __name(formatParseError, "formatParseError");
10055
+
10056
+ // ../json/src/utils/stringify.ts
6132
10057
  init_cjs_shims();
6133
- var import_node_fs4 = __toESM(require("node:fs"), 1);
6134
- var import_node_path5 = __toESM(require("node:path"), 1);
10058
+
10059
+ // ../type-checks/src/is-number.ts
10060
+ init_cjs_shims();
10061
+ var isNumber2 = /* @__PURE__ */ __name((value) => {
10062
+ try {
10063
+ return value instanceof Number || typeof value === "number" || Number(value) === value;
10064
+ } catch {
10065
+ return false;
10066
+ }
10067
+ }, "isNumber");
10068
+
10069
+ // ../json/src/utils/stringify.ts
10070
+ var stringify2 = /* @__PURE__ */ __name((value, spacing = 2) => {
10071
+ const space = isNumber2(spacing) ? " ".repeat(spacing) : spacing;
10072
+ switch (value) {
10073
+ case null: {
10074
+ return "null";
10075
+ }
10076
+ case void 0: {
10077
+ return "undefined";
10078
+ }
10079
+ case true: {
10080
+ return "true";
10081
+ }
10082
+ case false: {
10083
+ return "false";
10084
+ }
10085
+ }
10086
+ if (Array.isArray(value)) {
10087
+ return `[${space}${value.map((v) => stringify2(v, space)).join(`,${space}`)}${space}]`;
10088
+ }
10089
+ if (value instanceof Uint8Array) {
10090
+ return value.toString();
10091
+ }
10092
+ switch (typeof value) {
10093
+ case "number": {
10094
+ return `${value}`;
10095
+ }
10096
+ case "string": {
10097
+ return JSON.stringify(value);
10098
+ }
10099
+ case "object": {
10100
+ const keys = Object.keys(value);
10101
+ return `{${space}${keys.map((k) => `${k}: ${space}${stringify2(value[k], space)}`).join(`,${space}`)}${space}}`;
10102
+ }
10103
+ default:
10104
+ return "null";
10105
+ }
10106
+ }, "stringify");
10107
+
10108
+ // ../json/src/storm-json.ts
10109
+ var StormJSON = class _StormJSON extends SuperJSON {
10110
+ static {
10111
+ __name(this, "StormJSON");
10112
+ }
10113
+ static #instance;
10114
+ static get instance() {
10115
+ if (!_StormJSON.#instance) {
10116
+ _StormJSON.#instance = new _StormJSON();
10117
+ }
10118
+ return _StormJSON.#instance;
10119
+ }
10120
+ /**
10121
+ * Deserialize the given value with superjson using the given metadata
10122
+ */
10123
+ static deserialize(payload) {
10124
+ return _StormJSON.instance.deserialize(payload);
10125
+ }
10126
+ /**
10127
+ * Serialize the given value with superjson
10128
+ *
10129
+ *
10130
+ */
10131
+ static serialize(object) {
10132
+ return _StormJSON.instance.serialize(object);
10133
+ }
10134
+ /**
10135
+ * Parse the given string value with superjson using the given metadata
10136
+ *
10137
+ * @param value - The string value to parse
10138
+ * @returns The parsed data
10139
+ */
10140
+ static parse(value) {
10141
+ return _StormJSON.instance.parse(value);
10142
+ }
10143
+ /**
10144
+ * Serializes the given data to a JSON string.
10145
+ * By default the JSON string is formatted with a 2 space indentation to be easy readable.
10146
+ *
10147
+ * @param value - Object which should be serialized to JSON
10148
+ * @param options - JSON serialize options
10149
+ * @returns the formatted JSON representation of the object
10150
+ */
10151
+ static stringify(value, options) {
10152
+ const customTransformer = _StormJSON.instance.customTransformerRegistry.findApplicable(value);
10153
+ let result = value;
10154
+ if (customTransformer) {
10155
+ result = customTransformer.serialize(result);
10156
+ }
10157
+ return stringify2(result?.json ? result?.json : result, options?.spaces);
10158
+ }
10159
+ /**
10160
+ * Stringify the given value with superjson
10161
+ *
10162
+ * @param obj - The object to stringify
10163
+ * @returns The stringified object
10164
+ */
10165
+ static stringifyBase(obj) {
10166
+ return _StormJSON.instance.stringify(obj);
10167
+ }
10168
+ /**
10169
+ * Parses the given JSON string and returns the object the JSON content represents.
10170
+ * By default javascript-style comments and trailing commas are allowed.
10171
+ *
10172
+ * @param strData - JSON content as string
10173
+ * @param options - JSON parse options
10174
+ * @returns Object the JSON content represents
10175
+ */
10176
+ static parseJson(strData, options) {
10177
+ try {
10178
+ if (options?.expectComments === false) {
10179
+ return _StormJSON.instance.parse(strData);
10180
+ }
10181
+ } catch {
10182
+ }
10183
+ const errors = [];
10184
+ const opts = {
10185
+ allowTrailingComma: true,
10186
+ ...options
10187
+ };
10188
+ const result = parse2(strData, errors, opts);
10189
+ if (errors.length > 0 && errors[0]) {
10190
+ throw new Error(formatParseError(strData, errors[0]));
10191
+ }
10192
+ return result;
10193
+ }
10194
+ /**
10195
+ * Register a custom schema with superjson
10196
+ *
10197
+ * @param name - The name of the schema
10198
+ * @param serialize - The function to serialize the schema
10199
+ * @param deserialize - The function to deserialize the schema
10200
+ * @param isApplicable - The function to check if the schema is applicable
10201
+ */
10202
+ static register(name, serialize2, deserialize2, isApplicable) {
10203
+ _StormJSON.instance.registerCustom({
10204
+ isApplicable,
10205
+ serialize: serialize2,
10206
+ deserialize: deserialize2
10207
+ }, name);
10208
+ }
10209
+ /**
10210
+ * Register a class with superjson
10211
+ *
10212
+ * @param classConstructor - The class constructor to register
10213
+ */
10214
+ static registerClass(classConstructor, options) {
10215
+ _StormJSON.instance.registerClass(classConstructor, {
10216
+ identifier: isString(options) ? options : options?.identifier || classConstructor.name,
10217
+ allowProps: options && isObject(options) && options?.allowProps && Array.isArray(options.allowProps) ? options.allowProps : [
10218
+ "__typename"
10219
+ ]
10220
+ });
10221
+ }
10222
+ constructor() {
10223
+ super({
10224
+ dedupe: true
10225
+ });
10226
+ }
10227
+ };
10228
+ StormJSON.instance.registerCustom({
10229
+ isApplicable: /* @__PURE__ */ __name((v) => import_buffer.Buffer.isBuffer(v), "isApplicable"),
10230
+ serialize: /* @__PURE__ */ __name((v) => v.toString("base64"), "serialize"),
10231
+ deserialize: /* @__PURE__ */ __name((v) => import_buffer.Buffer.from(v, "base64"), "deserialize")
10232
+ }, "Bytes");
10233
+
10234
+ // ../fs/src/write-file.ts
10235
+ var import_promises3 = require("node:fs/promises");
10236
+ var writeFile = /* @__PURE__ */ __name(async (filePath, content, options) => {
10237
+ if (!filePath) {
10238
+ throw new Error("No file path provided to read data");
10239
+ }
10240
+ const directory = findFilePath(correctPath(filePath));
10241
+ if (!existsSync(directory)) {
10242
+ if (options?.createDirectory !== false) {
10243
+ await createDirectory(directory);
10244
+ } else {
10245
+ throw new Error(`Directory ${directory} does not exist`);
10246
+ }
10247
+ }
10248
+ return (0, import_promises3.writeFile)(filePath, content || "", options);
10249
+ }, "writeFile");
6135
10250
 
6136
10251
  // src/utils/format-file.ts
6137
10252
  init_cjs_shims();
@@ -6160,10 +10275,11 @@ __name(formatFile, "formatFile");
6160
10275
 
6161
10276
  // src/utils/write-file-safely.ts
6162
10277
  var writeFileSafely = /* @__PURE__ */ __name(async (writeLocation, content) => {
6163
- import_node_fs4.default.mkdirSync(import_node_path5.default.dirname(writeLocation), {
6164
- recursive: true
6165
- });
6166
- import_node_fs4.default.writeFileSync(writeLocation, await formatFile(content));
10278
+ const [fileContent] = await Promise.all([
10279
+ formatFile(content),
10280
+ createDirectory(findFilePath(writeLocation))
10281
+ ]);
10282
+ await writeFile(writeLocation, fileContent);
6167
10283
  }, "writeFileSafely");
6168
10284
 
6169
10285
  // src/prisma-generator.ts
@@ -6243,7 +10359,7 @@ async function generate(options) {
6243
10359
  mutations.sort();
6244
10360
  subscriptions.sort();
6245
10361
  consoleLog("Constructing tRPC Shield source file");
6246
- const shieldText = constructShield({
10362
+ const shieldText = await constructShield({
6247
10363
  queries,
6248
10364
  mutations,
6249
10365
  subscriptions
@@ -6269,7 +10385,7 @@ async function generate(options) {
6269
10385
  }
6270
10386
  consoleLog(`Generating tRPC source code for ${models.length} models`);
6271
10387
  resolveModelsComments(models, hiddenModels);
6272
- const createRouter = project.createSourceFile(import_node_path6.default.resolve(outputDir, "routers", "helpers", "createRouter.ts"), void 0, {
10388
+ const createRouter = project.createSourceFile(import_node_path5.default.resolve(outputDir, "routers", "helpers", "createRouter.ts"), void 0, {
6273
10389
  overwrite: true
6274
10390
  });
6275
10391
  consoleLog("Generating tRPC imports");
@@ -6282,7 +10398,7 @@ async function generate(options) {
6282
10398
  createRouter.formatText({
6283
10399
  indentSize: 2
6284
10400
  });
6285
- const appRouter = project.createSourceFile(import_node_path6.default.resolve(outputDir, "routers", `index.ts`), void 0, {
10401
+ const appRouter = project.createSourceFile(import_node_path5.default.resolve(outputDir, "routers", `index.ts`), void 0, {
6286
10402
  overwrite: true
6287
10403
  });
6288
10404
  consoleLog("Generating tRPC router imports");
@@ -6304,7 +10420,7 @@ async function generate(options) {
6304
10420
  const plural = (0, import_pluralize.default)(model.toLowerCase());
6305
10421
  consoleLog(`Generating tRPC router for model ${model}`);
6306
10422
  generateRouterImport(appRouter, plural, model);
6307
- const modelRouter = project.createSourceFile(import_node_path6.default.resolve(outputDir, "routers", `${model}.router.ts`), void 0, {
10423
+ const modelRouter = project.createSourceFile(import_node_path5.default.resolve(outputDir, "routers", `${model}.router.ts`), void 0, {
6308
10424
  overwrite: true
6309
10425
  });
6310
10426
  generateCreateRouterImport({
@@ -6371,3 +10487,16 @@ getPrismaGeneratorHelper().then((helpers) => {
6371
10487
  }).catch((reason) => {
6372
10488
  console.error(`An error occured while generating prisma tRPC source code: ${reason}`);
6373
10489
  });
10490
+ /*! Bundled license information:
10491
+
10492
+ ieee754/index.js:
10493
+ (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
10494
+
10495
+ buffer/index.js:
10496
+ (*!
10497
+ * The buffer module from node.js, for the browser.
10498
+ *
10499
+ * @author Feross Aboukhadijeh <https://feross.org>
10500
+ * @license MIT
10501
+ *)
10502
+ */