miqro 7.3.1 → 7.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/lib.cjs CHANGED
@@ -32,165 +32,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
32
32
  ));
33
33
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
34
 
35
- // node_modules/cookie/dist/index.js
36
- var require_dist = __commonJS({
37
- "node_modules/cookie/dist/index.js"(exports2) {
38
- "use strict";
39
- Object.defineProperty(exports2, "__esModule", { value: true });
40
- exports2.parse = parse2;
41
- exports2.serialize = serialize2;
42
- var cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
43
- var cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
44
- var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
45
- var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
46
- var __toString = Object.prototype.toString;
47
- var NullObject = /* @__PURE__ */ (() => {
48
- const C = function() {
49
- };
50
- C.prototype = /* @__PURE__ */ Object.create(null);
51
- return C;
52
- })();
53
- function parse2(str, options) {
54
- const obj = new NullObject();
55
- const len = str.length;
56
- if (len < 2)
57
- return obj;
58
- const dec = options?.decode || decode2;
59
- let index = 0;
60
- do {
61
- const eqIdx = str.indexOf("=", index);
62
- if (eqIdx === -1)
63
- break;
64
- const colonIdx = str.indexOf(";", index);
65
- const endIdx = colonIdx === -1 ? len : colonIdx;
66
- if (eqIdx > endIdx) {
67
- index = str.lastIndexOf(";", eqIdx - 1) + 1;
68
- continue;
69
- }
70
- const keyStartIdx = startIndex(str, index, eqIdx);
71
- const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
72
- const key = str.slice(keyStartIdx, keyEndIdx);
73
- if (obj[key] === void 0) {
74
- let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
75
- let valEndIdx = endIndex(str, endIdx, valStartIdx);
76
- const value = dec(str.slice(valStartIdx, valEndIdx));
77
- obj[key] = value;
78
- }
79
- index = endIdx + 1;
80
- } while (index < len);
81
- return obj;
82
- }
83
- function startIndex(str, index, max) {
84
- do {
85
- const code = str.charCodeAt(index);
86
- if (code !== 32 && code !== 9)
87
- return index;
88
- } while (++index < max);
89
- return max;
90
- }
91
- function endIndex(str, index, min) {
92
- while (index > min) {
93
- const code = str.charCodeAt(--index);
94
- if (code !== 32 && code !== 9)
95
- return index + 1;
96
- }
97
- return min;
98
- }
99
- function serialize2(name, val, options) {
100
- const enc = options?.encode || encodeURIComponent;
101
- if (!cookieNameRegExp.test(name)) {
102
- throw new TypeError(`argument name is invalid: ${name}`);
103
- }
104
- const value = enc(val);
105
- if (!cookieValueRegExp.test(value)) {
106
- throw new TypeError(`argument val is invalid: ${val}`);
107
- }
108
- let str = name + "=" + value;
109
- if (!options)
110
- return str;
111
- if (options.maxAge !== void 0) {
112
- if (!Number.isInteger(options.maxAge)) {
113
- throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
114
- }
115
- str += "; Max-Age=" + options.maxAge;
116
- }
117
- if (options.domain) {
118
- if (!domainValueRegExp.test(options.domain)) {
119
- throw new TypeError(`option domain is invalid: ${options.domain}`);
120
- }
121
- str += "; Domain=" + options.domain;
122
- }
123
- if (options.path) {
124
- if (!pathValueRegExp.test(options.path)) {
125
- throw new TypeError(`option path is invalid: ${options.path}`);
126
- }
127
- str += "; Path=" + options.path;
128
- }
129
- if (options.expires) {
130
- if (!isDate(options.expires) || !Number.isFinite(options.expires.valueOf())) {
131
- throw new TypeError(`option expires is invalid: ${options.expires}`);
132
- }
133
- str += "; Expires=" + options.expires.toUTCString();
134
- }
135
- if (options.httpOnly) {
136
- str += "; HttpOnly";
137
- }
138
- if (options.secure) {
139
- str += "; Secure";
140
- }
141
- if (options.partitioned) {
142
- str += "; Partitioned";
143
- }
144
- if (options.priority) {
145
- const priority = typeof options.priority === "string" ? options.priority.toLowerCase() : void 0;
146
- switch (priority) {
147
- case "low":
148
- str += "; Priority=Low";
149
- break;
150
- case "medium":
151
- str += "; Priority=Medium";
152
- break;
153
- case "high":
154
- str += "; Priority=High";
155
- break;
156
- default:
157
- throw new TypeError(`option priority is invalid: ${options.priority}`);
158
- }
159
- }
160
- if (options.sameSite) {
161
- const sameSite = typeof options.sameSite === "string" ? options.sameSite.toLowerCase() : options.sameSite;
162
- switch (sameSite) {
163
- case true:
164
- case "strict":
165
- str += "; SameSite=Strict";
166
- break;
167
- case "lax":
168
- str += "; SameSite=Lax";
169
- break;
170
- case "none":
171
- str += "; SameSite=None";
172
- break;
173
- default:
174
- throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
175
- }
176
- }
177
- return str;
178
- }
179
- function decode2(str) {
180
- if (str.indexOf("%") === -1)
181
- return str;
182
- try {
183
- return decodeURIComponent(str);
184
- } catch (e) {
185
- return str;
186
- }
187
- }
188
- function isDate(val) {
189
- return __toString.call(val) === "[object Date]";
190
- }
191
- }
192
- });
193
-
194
35
  // node_modules/@miqro/parser/build/built-in-parsers.js
195
36
  function newParseOptionsError(baseOption, option, name) {
196
37
  return new ParseOptionsError(option.usage ? String(option.usage) : `${name ? `${name} ` : ""}not ${baseOption.type}${option.type === "number" && option.numberMin !== void 0 ? `${option.numberMin}:` : ""}${option.type === "number" && option.numberMax !== void 0 ? `:${option.numberMax}` : ""}${option.numberMinDecimals !== void 0 ? ` min decimals[${option.numberMinDecimals}]` : ""}${option.numberMaxDecimals !== void 0 ? ` max decimals[${option.numberMaxDecimals}]` : ""}${option.type === "string" && option.stringMinLength !== void 0 ? `${option.stringMinLength}:` : ""}${option.type === "string" && option.stringMaxLength !== void 0 ? `:${option.stringMaxLength}` : ""}${option.type === "array" && option.arrayMinLength !== void 0 ? `${option.arrayMinLength}:` : ""}${option.type === "array" && option.arrayMaxLength !== void 0 ? `:${option.arrayMaxLength}` : ""}${option.type === "array" && option.arrayType ? option.arrayType !== "enum" ? ` of ${option.arrayType}` : ` of ${option.arrayType} as defined. valid values [${option.enumValues}]` : ""}${option.type === "enum" ? ` as defined. valid values [${option.enumValues}]` : ""}`, name);
@@ -688,103 +529,262 @@ var init_lib = __esm({
688
529
  }
689
530
  });
690
531
 
691
- // node_modules/@miqro/core/build/middleware/body-parser.js
692
- function ReadBuffer(options) {
693
- let limit = DEFAULT_READ_BUFFER_LIMIT;
694
- let timeout = DEFAULT_READ_BUFFER_TIMEOUT;
695
- if (options) {
696
- limit = options.limit !== void 0 ? options.limit : limit;
697
- timeout = options.timeout !== void 0 ? options.timeout : timeout;
698
- } else {
699
- const [limitS, timeoutS] = checkEnvVariables(["READ_BUFFER_LIMIT", "READ_BUFFER_TIMEOUT"], [String(DEFAULT_READ_BUFFER_LIMIT), String(DEFAULT_READ_BUFFER_TIMEOUT)]);
700
- limit = parseInt(limitS, 10);
701
- timeout = parseInt(timeoutS, 10);
702
- }
703
- return async function ReadBuffer3(req, res) {
704
- return new Promise((resolve24, reject) => {
705
- try {
706
- const readTimeout = setTimeout(() => {
707
- clearTimeout(readTimeout);
708
- req.removeListener("error", errorListener);
709
- req.removeListener("data", chunkListener);
710
- req.removeListener("end", endListener);
711
- reject(new BadRequestError(`Read Timeout`));
712
- return;
713
- }, timeout);
714
- let cLength = 0;
715
- const buffers = [];
716
- const endListener = () => {
717
- clearTimeout(readTimeout);
718
- req.removeListener("error", errorListener);
719
- req.removeListener("data", chunkListener);
720
- req.removeListener("end", endListener);
721
- try {
722
- const concatBuffers = Buffer.concat(buffers);
723
- const responseBuffer = req.headers["content-encoding"] === "gzip" ? (0, import_zlib.gunzipSync)(concatBuffers) : concatBuffers;
724
- req.logger.trace("ctx.buffer %o", responseBuffer);
725
- req.buffer = responseBuffer;
726
- resolve24();
727
- } catch (e) {
728
- reject(e);
729
- }
730
- };
731
- const errorListener = (err) => {
732
- clearTimeout(readTimeout);
733
- req.removeListener("error", errorListener);
734
- req.removeListener("data", chunkListener);
735
- req.removeListener("end", endListener);
736
- reject(err);
737
- };
738
- const chunkListener = (chunk) => {
739
- cLength += chunk.length;
740
- if (cLength > limit) {
741
- clearTimeout(readTimeout);
742
- req.removeListener("error", errorListener);
743
- req.removeListener("data", chunkListener);
744
- req.removeListener("end", endListener);
745
- req.logger.error(`ctx.buffer.length ${cLength} > ${limit}. To accept this body set READ_BUFFER_LIMIT to a higher value.`);
746
- reject(new BadRequestError(`buffer.length ${cLength} > ${limit}`));
747
- return;
748
- }
749
- buffers.push(chunk);
750
- };
751
- req.on("error", errorListener);
752
- req.on("data", chunkListener);
753
- req.on("end", endListener);
754
- } catch (e) {
755
- reject(e);
756
- }
757
- });
758
- };
759
- }
760
- function URLEncodedParser(options) {
761
- let maxKeys = DEFAULT_FORM_MAX_KEYS;
762
- let limit = DEFAULT_READ_BUFFER_LIMIT;
763
- let type = "application/x-www-form-urlencoded";
764
- if (options) {
765
- limit = options.limit !== void 0 ? options.limit : limit;
766
- type = options.type !== void 0 ? options.type : type;
767
- maxKeys = options.maxKeys !== void 0 ? options.maxKeys : maxKeys;
768
- } else {
769
- const [limitS, typeS, maxKeysS] = checkEnvVariables(["BODY_PARSER_URL_ENCODED_LIMIT", "BODY_PARSER_URL_ENCODED_TYPE", "BODY_PARSER_URL_ENCODED_MAX_KEYS"], [String(DEFAULT_READ_BUFFER_LIMIT), "application/x-www-form-urlencoded", String(DEFAULT_FORM_MAX_KEYS)]);
770
- limit = parseInt(limitS, 10);
771
- type = typeS;
772
- maxKeys = maxKeysS !== "undefined" ? parseInt(maxKeysS, 10) : DEFAULT_FORM_MAX_KEYS;
773
- }
774
- const readBuffer = ReadBuffer({
775
- limit
776
- });
777
- return async function URLEncodedParser3(req, res) {
778
- try {
779
- const isType = req.body === void 0 && req.headers["content-type"] ? req.headers["content-type"].toLocaleLowerCase().indexOf(type.toLocaleLowerCase()) !== -1 : false;
780
- if (isType && !req.buffer) {
781
- await readBuffer(req, res);
782
- }
783
- if (isType && req.buffer && req.buffer.length <= limit) {
784
- const string = req.buffer.toString();
785
- if (string) {
786
- const body = {
787
- ...(0, import_querystring.parse)(string, void 0, void 0, {
532
+ // node_modules/cookie/dist/index.js
533
+ var require_dist = __commonJS({
534
+ "node_modules/cookie/dist/index.js"(exports2) {
535
+ "use strict";
536
+ Object.defineProperty(exports2, "__esModule", { value: true });
537
+ exports2.parse = parse2;
538
+ exports2.serialize = serialize2;
539
+ var cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
540
+ var cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
541
+ var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
542
+ var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
543
+ var __toString = Object.prototype.toString;
544
+ var NullObject = /* @__PURE__ */ (() => {
545
+ const C = function() {
546
+ };
547
+ C.prototype = /* @__PURE__ */ Object.create(null);
548
+ return C;
549
+ })();
550
+ function parse2(str, options) {
551
+ const obj = new NullObject();
552
+ const len = str.length;
553
+ if (len < 2)
554
+ return obj;
555
+ const dec = options?.decode || decode2;
556
+ let index = 0;
557
+ do {
558
+ const eqIdx = str.indexOf("=", index);
559
+ if (eqIdx === -1)
560
+ break;
561
+ const colonIdx = str.indexOf(";", index);
562
+ const endIdx = colonIdx === -1 ? len : colonIdx;
563
+ if (eqIdx > endIdx) {
564
+ index = str.lastIndexOf(";", eqIdx - 1) + 1;
565
+ continue;
566
+ }
567
+ const keyStartIdx = startIndex(str, index, eqIdx);
568
+ const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
569
+ const key = str.slice(keyStartIdx, keyEndIdx);
570
+ if (obj[key] === void 0) {
571
+ let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
572
+ let valEndIdx = endIndex(str, endIdx, valStartIdx);
573
+ const value = dec(str.slice(valStartIdx, valEndIdx));
574
+ obj[key] = value;
575
+ }
576
+ index = endIdx + 1;
577
+ } while (index < len);
578
+ return obj;
579
+ }
580
+ function startIndex(str, index, max) {
581
+ do {
582
+ const code = str.charCodeAt(index);
583
+ if (code !== 32 && code !== 9)
584
+ return index;
585
+ } while (++index < max);
586
+ return max;
587
+ }
588
+ function endIndex(str, index, min) {
589
+ while (index > min) {
590
+ const code = str.charCodeAt(--index);
591
+ if (code !== 32 && code !== 9)
592
+ return index + 1;
593
+ }
594
+ return min;
595
+ }
596
+ function serialize2(name, val, options) {
597
+ const enc = options?.encode || encodeURIComponent;
598
+ if (!cookieNameRegExp.test(name)) {
599
+ throw new TypeError(`argument name is invalid: ${name}`);
600
+ }
601
+ const value = enc(val);
602
+ if (!cookieValueRegExp.test(value)) {
603
+ throw new TypeError(`argument val is invalid: ${val}`);
604
+ }
605
+ let str = name + "=" + value;
606
+ if (!options)
607
+ return str;
608
+ if (options.maxAge !== void 0) {
609
+ if (!Number.isInteger(options.maxAge)) {
610
+ throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
611
+ }
612
+ str += "; Max-Age=" + options.maxAge;
613
+ }
614
+ if (options.domain) {
615
+ if (!domainValueRegExp.test(options.domain)) {
616
+ throw new TypeError(`option domain is invalid: ${options.domain}`);
617
+ }
618
+ str += "; Domain=" + options.domain;
619
+ }
620
+ if (options.path) {
621
+ if (!pathValueRegExp.test(options.path)) {
622
+ throw new TypeError(`option path is invalid: ${options.path}`);
623
+ }
624
+ str += "; Path=" + options.path;
625
+ }
626
+ if (options.expires) {
627
+ if (!isDate(options.expires) || !Number.isFinite(options.expires.valueOf())) {
628
+ throw new TypeError(`option expires is invalid: ${options.expires}`);
629
+ }
630
+ str += "; Expires=" + options.expires.toUTCString();
631
+ }
632
+ if (options.httpOnly) {
633
+ str += "; HttpOnly";
634
+ }
635
+ if (options.secure) {
636
+ str += "; Secure";
637
+ }
638
+ if (options.partitioned) {
639
+ str += "; Partitioned";
640
+ }
641
+ if (options.priority) {
642
+ const priority = typeof options.priority === "string" ? options.priority.toLowerCase() : void 0;
643
+ switch (priority) {
644
+ case "low":
645
+ str += "; Priority=Low";
646
+ break;
647
+ case "medium":
648
+ str += "; Priority=Medium";
649
+ break;
650
+ case "high":
651
+ str += "; Priority=High";
652
+ break;
653
+ default:
654
+ throw new TypeError(`option priority is invalid: ${options.priority}`);
655
+ }
656
+ }
657
+ if (options.sameSite) {
658
+ const sameSite = typeof options.sameSite === "string" ? options.sameSite.toLowerCase() : options.sameSite;
659
+ switch (sameSite) {
660
+ case true:
661
+ case "strict":
662
+ str += "; SameSite=Strict";
663
+ break;
664
+ case "lax":
665
+ str += "; SameSite=Lax";
666
+ break;
667
+ case "none":
668
+ str += "; SameSite=None";
669
+ break;
670
+ default:
671
+ throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
672
+ }
673
+ }
674
+ return str;
675
+ }
676
+ function decode2(str) {
677
+ if (str.indexOf("%") === -1)
678
+ return str;
679
+ try {
680
+ return decodeURIComponent(str);
681
+ } catch (e) {
682
+ return str;
683
+ }
684
+ }
685
+ function isDate(val) {
686
+ return __toString.call(val) === "[object Date]";
687
+ }
688
+ }
689
+ });
690
+
691
+ // node_modules/@miqro/core/build/middleware/body-parser.js
692
+ function ReadBuffer(options) {
693
+ let limit = DEFAULT_READ_BUFFER_LIMIT;
694
+ let timeout = DEFAULT_READ_BUFFER_TIMEOUT;
695
+ if (options) {
696
+ limit = options.limit !== void 0 ? options.limit : limit;
697
+ timeout = options.timeout !== void 0 ? options.timeout : timeout;
698
+ } else {
699
+ const [limitS, timeoutS] = checkEnvVariables(["READ_BUFFER_LIMIT", "READ_BUFFER_TIMEOUT"], [String(DEFAULT_READ_BUFFER_LIMIT), String(DEFAULT_READ_BUFFER_TIMEOUT)]);
700
+ limit = parseInt(limitS, 10);
701
+ timeout = parseInt(timeoutS, 10);
702
+ }
703
+ return async function ReadBuffer3(req, res) {
704
+ return new Promise((resolve24, reject) => {
705
+ try {
706
+ const readTimeout = setTimeout(() => {
707
+ clearTimeout(readTimeout);
708
+ req.removeListener("error", errorListener);
709
+ req.removeListener("data", chunkListener);
710
+ req.removeListener("end", endListener);
711
+ reject(new BadRequestError(`Read Timeout`));
712
+ return;
713
+ }, timeout);
714
+ let cLength = 0;
715
+ const buffers = [];
716
+ const endListener = () => {
717
+ clearTimeout(readTimeout);
718
+ req.removeListener("error", errorListener);
719
+ req.removeListener("data", chunkListener);
720
+ req.removeListener("end", endListener);
721
+ try {
722
+ const concatBuffers = Buffer.concat(buffers);
723
+ const responseBuffer = req.headers["content-encoding"] === "gzip" ? (0, import_zlib.gunzipSync)(concatBuffers) : concatBuffers;
724
+ req.logger.trace("ctx.buffer %o", responseBuffer);
725
+ req.buffer = responseBuffer;
726
+ resolve24();
727
+ } catch (e) {
728
+ reject(e);
729
+ }
730
+ };
731
+ const errorListener = (err) => {
732
+ clearTimeout(readTimeout);
733
+ req.removeListener("error", errorListener);
734
+ req.removeListener("data", chunkListener);
735
+ req.removeListener("end", endListener);
736
+ reject(err);
737
+ };
738
+ const chunkListener = (chunk) => {
739
+ cLength += chunk.length;
740
+ if (cLength > limit) {
741
+ clearTimeout(readTimeout);
742
+ req.removeListener("error", errorListener);
743
+ req.removeListener("data", chunkListener);
744
+ req.removeListener("end", endListener);
745
+ req.logger.error(`ctx.buffer.length ${cLength} > ${limit}. To accept this body set READ_BUFFER_LIMIT to a higher value.`);
746
+ reject(new BadRequestError(`buffer.length ${cLength} > ${limit}`));
747
+ return;
748
+ }
749
+ buffers.push(chunk);
750
+ };
751
+ req.on("error", errorListener);
752
+ req.on("data", chunkListener);
753
+ req.on("end", endListener);
754
+ } catch (e) {
755
+ reject(e);
756
+ }
757
+ });
758
+ };
759
+ }
760
+ function URLEncodedParser(options) {
761
+ let maxKeys = DEFAULT_FORM_MAX_KEYS;
762
+ let limit = DEFAULT_READ_BUFFER_LIMIT;
763
+ let type = "application/x-www-form-urlencoded";
764
+ if (options) {
765
+ limit = options.limit !== void 0 ? options.limit : limit;
766
+ type = options.type !== void 0 ? options.type : type;
767
+ maxKeys = options.maxKeys !== void 0 ? options.maxKeys : maxKeys;
768
+ } else {
769
+ const [limitS, typeS, maxKeysS] = checkEnvVariables(["BODY_PARSER_URL_ENCODED_LIMIT", "BODY_PARSER_URL_ENCODED_TYPE", "BODY_PARSER_URL_ENCODED_MAX_KEYS"], [String(DEFAULT_READ_BUFFER_LIMIT), "application/x-www-form-urlencoded", String(DEFAULT_FORM_MAX_KEYS)]);
770
+ limit = parseInt(limitS, 10);
771
+ type = typeS;
772
+ maxKeys = maxKeysS !== "undefined" ? parseInt(maxKeysS, 10) : DEFAULT_FORM_MAX_KEYS;
773
+ }
774
+ const readBuffer = ReadBuffer({
775
+ limit
776
+ });
777
+ return async function URLEncodedParser3(req, res) {
778
+ try {
779
+ const isType = req.body === void 0 && req.headers["content-type"] ? req.headers["content-type"].toLocaleLowerCase().indexOf(type.toLocaleLowerCase()) !== -1 : false;
780
+ if (isType && !req.buffer) {
781
+ await readBuffer(req, res);
782
+ }
783
+ if (isType && req.buffer && req.buffer.length <= limit) {
784
+ const string = req.buffer.toString();
785
+ if (string) {
786
+ const body = {
787
+ ...(0, import_querystring.parse)(string, void 0, void 0, {
788
788
  maxKeys
789
789
  })
790
790
  };
@@ -1439,7 +1439,7 @@ function getSlashIndex(input) {
1439
1439
  }
1440
1440
  return slashIndex;
1441
1441
  }
1442
- function normalizePath2(path) {
1442
+ function normalizePath3(path) {
1443
1443
  if (typeof path !== "string") {
1444
1444
  throw new Error("path not string");
1445
1445
  }
@@ -1656,7 +1656,7 @@ var init_types = __esm({
1656
1656
  vURL = v;
1657
1657
  const url = newURL2(vURL ? vURL : "/");
1658
1658
  this.searchParams = url.searchParams;
1659
- this.path = normalizePath2(url.pathname);
1659
+ this.path = normalizePath3(url.pathname);
1660
1660
  this.hash = url.hash;
1661
1661
  this.query = parseSearchParams(this.searchParams);
1662
1662
  }
@@ -1779,9 +1779,9 @@ var init_types = __esm({
1779
1779
  }
1780
1780
  async asyncWrite(chunk) {
1781
1781
  return new Promise((resolve24, reject) => {
1782
- this.write(chunk, function(error2) {
1783
- if (error2) {
1784
- reject(error2);
1782
+ this.write(chunk, function(error3) {
1783
+ if (error3) {
1784
+ reject(error3);
1785
1785
  } else {
1786
1786
  resolve24();
1787
1787
  }
@@ -1949,7 +1949,7 @@ function routerDefaultLoggerFactory(uuid, req) {
1949
1949
  try {
1950
1950
  const url = newURL2(req.url ? req.url : "/");
1951
1951
  query = url.searchParams.toString();
1952
- path = normalizePath2(url.pathname);
1952
+ path = normalizePath3(url.pathname);
1953
1953
  method = req.method ? req.method.toUpperCase() : "GET";
1954
1954
  remoteAddress = req.socket.remoteAddress;
1955
1955
  } catch (e) {
@@ -2274,7 +2274,7 @@ var init_common = __esm({
2274
2274
  });
2275
2275
 
2276
2276
  // node_modules/@miqro/core/build/middleware/router.js
2277
- var Router2, RouterHandler;
2277
+ var Router3, RouterHandler;
2278
2278
  var init_router = __esm({
2279
2279
  "node_modules/@miqro/core/build/middleware/router.js"() {
2280
2280
  init_common();
@@ -2283,7 +2283,7 @@ var init_router = __esm({
2283
2283
  init_body_parser();
2284
2284
  init_lib2();
2285
2285
  init_built_in_parsers();
2286
- Router2 = class {
2286
+ Router3 = class {
2287
2287
  constructor(config) {
2288
2288
  this.config = config;
2289
2289
  this.handlers = [];
@@ -2325,7 +2325,7 @@ var init_router = __esm({
2325
2325
  return this.use(handler, path, "options", options);
2326
2326
  }
2327
2327
  use(handler, path, method, options) {
2328
- const nPath = path !== void 0 ? normalizePath2(path) : void 0;
2328
+ const nPath = path !== void 0 ? normalizePath3(path) : void 0;
2329
2329
  const nMethod = method ? method.toLowerCase() : method;
2330
2330
  this.handlers.push(new RouterHandler(handler, nPath, nMethod, options));
2331
2331
  return this;
@@ -2465,7 +2465,7 @@ ${tab}${tab}${methodData.description}` : ""}`;
2465
2465
  this.handler = handlers;
2466
2466
  }
2467
2467
  getJSONDoc(doc = {}, prePath = "") {
2468
- const pp = normalizePath2(removeStartingBackSlashes(this.path ? this.path : "/"));
2468
+ const pp = normalizePath3(removeStartingBackSlashes(this.path ? this.path : "/"));
2469
2469
  const nPath = pp.length > 1 ? pp.substring(1) : "";
2470
2470
  const nMethod = this.method ? this.method : "";
2471
2471
  if (this.isRouter) {
@@ -2566,7 +2566,7 @@ var init_app = __esm({
2566
2566
  init_router();
2567
2567
  init_common();
2568
2568
  import_crypto = require("crypto");
2569
- App = class extends Router2 {
2569
+ App = class extends Router3 {
2570
2570
  constructor(config) {
2571
2571
  super(config);
2572
2572
  this.shouldCloseConnection = false;
@@ -2925,12 +2925,12 @@ var init_websocket = __esm({
2925
2925
  socket.destroy();
2926
2926
  }
2927
2927
  });
2928
- socket.on("error", async (error2) => {
2928
+ socket.on("error", async (error3) => {
2929
2929
  req.logger.debug("upgraded connection error!");
2930
- req.logger.error(error2);
2930
+ req.logger.error(error3);
2931
2931
  if (this.options.onError) {
2932
2932
  try {
2933
- await this.options.onError(client, error2);
2933
+ await this.options.onError(client, error3);
2934
2934
  } catch (e) {
2935
2935
  req.logger.error(e);
2936
2936
  }
@@ -7029,10 +7029,10 @@ __export(restart_api_exports, {
7029
7029
  parseInflateErrors: () => parseInflateErrors
7030
7030
  });
7031
7031
  function parseInflateErrors(errors) {
7032
- return errors?.map((error2) => {
7032
+ return errors?.map((error3) => {
7033
7033
  return {
7034
- filePath: (0, import_node_path24.relative)(BASE_PATH, error2.filePath),
7035
- error: error2.error.message
7034
+ filePath: (0, import_node_path24.relative)(BASE_PATH, error3.filePath),
7035
+ error: error3.error.message
7036
7036
  };
7037
7037
  });
7038
7038
  }
@@ -7087,10 +7087,10 @@ __export(reload_api_exports, {
7087
7087
  parseInflateErrors: () => parseInflateErrors2
7088
7088
  });
7089
7089
  function parseInflateErrors2(errors) {
7090
- return errors?.map((error2) => {
7090
+ return errors?.map((error3) => {
7091
7091
  return {
7092
- filePath: (0, import_node_path25.relative)(BASE_PATH, error2.filePath),
7093
- error: error2.error.message
7092
+ filePath: (0, import_node_path25.relative)(BASE_PATH, error3.filePath),
7093
+ error: error3.error.message
7094
7094
  };
7095
7095
  });
7096
7096
  }
@@ -7150,108 +7150,1541 @@ function HTMLEncode2(str) {
7150
7150
  aRet[i] = str[i];
7151
7151
  }
7152
7152
  }
7153
- return aRet.join("");
7153
+ return aRet.join("");
7154
+ }
7155
+ var init_html_encode = __esm({
7156
+ "editor/common/html-encode.ts"() {
7157
+ }
7158
+ });
7159
+
7160
+ // editor/common/editor-index.tsx
7161
+ var editor_index_exports = {};
7162
+ __export(editor_index_exports, {
7163
+ EditorIndex: () => EditorIndex
7164
+ });
7165
+ function EditorIndex(editorCSS, editorJS, enableHotReload) {
7166
+ return async function editorIndex(req, res) {
7167
+ const admin = req.editor;
7168
+ const errors = parseInflateErrors(admin ? admin.getInflateErrors() : []);
7169
+ const files = scanDir(req);
7170
+ const migrations = admin ? admin.getMigrations().map((m) => m.name) : [];
7171
+ const services = admin ? admin.getServices() : ["."];
7172
+ const hotReload = enableHotReload ? admin ? admin.getHotReloadHTML() : "" : "";
7173
+ res.html(`<!DOCTYPE html><html><body><style>${editorCSS}</style><script type="module">${editorJS}</script><editor-component class="main-container" reloadstring="${req.uuid}" migrations="${HTMLEncode2(JSON.stringify(migrations))}" services="${HTMLEncode2(JSON.stringify(services))}" errors="${HTMLEncode2(JSON.stringify(errors))}" files="${HTMLEncode2(JSON.stringify(files))}"><noscript>Enable JavaScript</noscript></editor-component>${hotReload}</body></html>`);
7174
+ };
7175
+ }
7176
+ var init_editor_index = __esm({
7177
+ "editor/common/editor-index.tsx"() {
7178
+ init_scan_api();
7179
+ init_restart_api();
7180
+ init_html_encode();
7181
+ }
7182
+ });
7183
+
7184
+ // src/lib.ts
7185
+ var lib_exports3 = {};
7186
+ __export(lib_exports3, {
7187
+ App: () => App,
7188
+ ClusterCache: () => ClusterCache,
7189
+ ClusterWebSocketServer2: () => ClusterWebSocketServer2,
7190
+ DBManager: () => DBManager,
7191
+ JSX: () => JSX3,
7192
+ LocalCache: () => LocalCache,
7193
+ LogProvider: () => LogProvider,
7194
+ LoggerHandler: () => LoggerHandler,
7195
+ Miqro: () => Miqro,
7196
+ Router: () => Router3,
7197
+ ServerRequestHandler: () => ServerRequestHandler,
7198
+ WebSocketManager: () => WebSocketManager,
7199
+ appendAPIModule: () => appendAPIModule,
7200
+ createLogProviderOptions: () => createLogProviderOptions,
7201
+ createServerInterface: () => createServerInterface,
7202
+ defineRoute: () => defineRoute2,
7203
+ jsx: () => lib_exports,
7204
+ jsx2HTML: () => jsx2HTML,
7205
+ jwt: () => jwt,
7206
+ middleware: () => middleware,
7207
+ migration: () => lib_exports2
7208
+ });
7209
+ module.exports = __toCommonJS(lib_exports3);
7210
+
7211
+ // node_modules/@miqro/jsx/build/esm/lib.js
7212
+ var lib_exports = {};
7213
+ __export(lib_exports, {
7214
+ Fragment: () => Fragment,
7215
+ JSX: () => JSX,
7216
+ Link: () => Link,
7217
+ Router: () => Router,
7218
+ createContainer: () => createContainer,
7219
+ createContext: () => createContext,
7220
+ createElement: () => createElement,
7221
+ default: () => lib_default,
7222
+ enableDebugLog: () => enableDebugLog,
7223
+ isPathLocation: () => isPathLocation,
7224
+ setDefaultOptions: () => setDefaultOptions,
7225
+ useAllQuery: () => useAllQuery,
7226
+ useConditional: () => useConditional,
7227
+ useContext: () => useContext,
7228
+ useEffect: () => useEffect,
7229
+ useElement: () => useElement,
7230
+ useIsLocationPathNameActive: () => useIsLocationPathNameActive,
7231
+ usePathname: () => usePathname,
7232
+ useQuery: () => useQuery,
7233
+ useRef: () => useRef,
7234
+ useRefresh: () => useRefresh,
7235
+ useRuntime: () => useRuntime,
7236
+ useState: () => useState
7237
+ });
7238
+
7239
+ // node_modules/@miqro/jsx/build/esm/vdom/log.js
7240
+ var debugLogEnabled = false;
7241
+ function debug(runtime, message2, ...args) {
7242
+ if (debugLogEnabled) {
7243
+ runtime.consoleLog(message2, ...args);
7244
+ }
7245
+ }
7246
+ function error(runtime, message2, ...args) {
7247
+ runtime.consoleError(message2, ...args);
7248
+ }
7249
+ function enableDebugLog() {
7250
+ debugLogEnabled = true;
7251
+ }
7252
+
7253
+ // node_modules/@miqro/jsx/build/esm/vdom/actions.js
7254
+ function createAppendAction(node, runtime) {
7255
+ return {
7256
+ isDestructive: true,
7257
+ execute: () => {
7258
+ const parent = node.parent;
7259
+ const nodeRef = node.ref;
7260
+ let changes = 0;
7261
+ if (parent) {
7262
+ debug(runtime, "%s.children.add(%s)", parent.getName(), node.getName());
7263
+ parent.children.add(node);
7264
+ if (nodeRef) {
7265
+ let currentParent = parent;
7266
+ if (currentParent.ref) {
7267
+ debug(runtime, "%s.appendChild(%s)", currentParent.getName(), node.getName());
7268
+ if (currentParent.state?.shadowRoot) {
7269
+ currentParent.state.shadowRoot.appendChild(nodeRef);
7270
+ } else {
7271
+ currentParent.ref.appendChild(nodeRef);
7272
+ }
7273
+ changes++;
7274
+ return changes;
7275
+ } else {
7276
+ while (currentParent !== null) {
7277
+ currentParent = currentParent.parent;
7278
+ if (currentParent && currentParent.ref) {
7279
+ debug(runtime, "%s.appendChild(%s)", currentParent.getName(), node.getName());
7280
+ if (currentParent.state?.shadowRoot) {
7281
+ currentParent.state.shadowRoot.appendChild(nodeRef);
7282
+ } else {
7283
+ currentParent.ref.appendChild(nodeRef);
7284
+ }
7285
+ changes++;
7286
+ return changes;
7287
+ }
7288
+ }
7289
+ }
7290
+ } else {
7291
+ return changes;
7292
+ }
7293
+ }
7294
+ throw new Error("cannot find real parent(3)");
7295
+ }
7296
+ };
7297
+ }
7298
+ function createRemoveAttributesAction(node, toRemove, runtime) {
7299
+ return {
7300
+ execute: () => {
7301
+ const ref = node.ref;
7302
+ let changes = 0;
7303
+ if (ref) {
7304
+ const element = ref;
7305
+ for (const name of toRemove) {
7306
+ debug(runtime, "%s.removeAttribute(%s)", node.getName(), name);
7307
+ element.removeAttribute(name);
7308
+ changes++;
7309
+ if (name === "checked") {
7310
+ debug(runtime, "%s.%s=...", node.getName(), "checked");
7311
+ element.checked = false;
7312
+ changes++;
7313
+ }
7314
+ }
7315
+ }
7316
+ return changes;
7317
+ }
7318
+ };
7319
+ }
7320
+ function createSetAttributesAction(node, toSet, runtime) {
7321
+ return {
7322
+ execute: () => {
7323
+ const ref = node.ref;
7324
+ let changes = 0;
7325
+ if (ref) {
7326
+ const element = ref;
7327
+ for (const s of toSet) {
7328
+ if (s.name === "className") {
7329
+ s.name = "class";
7330
+ }
7331
+ debug(runtime, "%s.setAttribute(%s, ...)", node.getName(), s.name);
7332
+ element.setAttribute(s.name, s.value);
7333
+ changes++;
7334
+ if (s.name === "value") {
7335
+ debug(runtime, "%s.%s=...", node.getName(), s.name);
7336
+ element.value = s.value;
7337
+ changes++;
7338
+ } else if (s.name === "checked") {
7339
+ debug(runtime, "%s.%s=...", node.getName(), s.name);
7340
+ element.checked = true;
7341
+ changes++;
7342
+ }
7343
+ }
7344
+ }
7345
+ return changes;
7346
+ }
7347
+ };
7348
+ }
7349
+ function createFlushEffects(node, options, runtime) {
7350
+ return {
7351
+ postExecute: () => {
7352
+ const meta = node.state;
7353
+ const func = node.component;
7354
+ const changes = 0;
7355
+ if (func && meta) {
7356
+ debug(runtime, "flush effects callbacks for [%s]", node.getName());
7357
+ flushEffectCallbacks(meta.effectCallbacks, options.disableEffects, runtime);
7358
+ debug(runtime, "flush effects for [%s]", node.getName());
7359
+ flushEffects(meta.effects, meta.effectQueueCallbacks, options.disableEffects, runtime);
7360
+ }
7361
+ return changes;
7362
+ }
7363
+ };
7364
+ }
7365
+ function createFlushEffectsRemove(node, options, runtime) {
7366
+ return {
7367
+ execute: () => {
7368
+ const meta = node.state;
7369
+ const changes = 0;
7370
+ if (node.component && meta) {
7371
+ debug(runtime, "flush effects callbacks for [%s]", node.getName());
7372
+ flushEffectCallbacks(meta.effectCallbacks, options.disableEffects, runtime);
7373
+ debug(runtime, "flush effects for [%s]", node.getName());
7374
+ flushEffectCallbacks(meta.effectQueueCallbacks, options.disableEffects, runtime);
7375
+ }
7376
+ return changes;
7377
+ }
7378
+ };
7379
+ }
7380
+ function flushEffectCallbacks(callbacks, disableEffects, runtime) {
7381
+ const keys = Object.keys(callbacks);
7382
+ for (const key of keys) {
7383
+ if (!disableEffects) {
7384
+ try {
7385
+ callbacks[key]();
7386
+ } catch (e) {
7387
+ error(runtime, e);
7388
+ }
7389
+ }
7390
+ delete callbacks[key];
7391
+ }
7392
+ }
7393
+ function flushEffects(effects, callbacks, disableEffects, runtime) {
7394
+ const keys = Object.keys(effects);
7395
+ for (const key of keys) {
7396
+ if (!disableEffects) {
7397
+ try {
7398
+ const callback = effects[key]();
7399
+ if (callback) {
7400
+ callbacks[key] = callback;
7401
+ }
7402
+ } catch (e) {
7403
+ error(runtime, e);
7404
+ }
7405
+ }
7406
+ delete effects[key];
7407
+ }
7408
+ }
7409
+ function createRemoveListeners(node, runtime) {
7410
+ return {
7411
+ execute: () => {
7412
+ const ref = node.ref;
7413
+ let changes = 0;
7414
+ if (!ref) {
7415
+ throw new Error("cannot update listeners without a ref");
7416
+ }
7417
+ const element = ref;
7418
+ for (const listener of node.currentEventListeners) {
7419
+ debug(runtime, "%s.removeEventListener(%s, ...)", node.getName(), listener.eventName);
7420
+ element.removeEventListener(listener.eventName, listener.listener);
7421
+ changes++;
7422
+ }
7423
+ node.currentEventListeners = [];
7424
+ return changes;
7425
+ }
7426
+ };
7427
+ }
7428
+ function createUpdateListeners(node, listeners, runtime) {
7429
+ return {
7430
+ execute: () => {
7431
+ const ref = node.ref;
7432
+ let changes = 0;
7433
+ if (!ref) {
7434
+ throw new Error("cannot update listeners without a ref");
7435
+ }
7436
+ const element = ref;
7437
+ for (const listener of node.currentEventListeners) {
7438
+ debug(runtime, "%s.removeEventListener(%s, ...)", node.getName(), listener.eventName);
7439
+ element.removeEventListener(listener.eventName, listener.listener);
7440
+ changes++;
7441
+ }
7442
+ node.currentEventListeners = [];
7443
+ for (const listener of listeners) {
7444
+ debug(runtime, "%s.addEventListener(%s, ...)", node.getName(), listener.eventName);
7445
+ element.addEventListener(listener.eventName, listener.listener);
7446
+ changes++;
7447
+ }
7448
+ node.currentEventListeners = listeners;
7449
+ return changes;
7450
+ }
7451
+ };
7452
+ }
7453
+ function createNotifyRef(node, refListener, runtime) {
7454
+ return {
7455
+ postExecute: () => {
7456
+ const ref = node.ref;
7457
+ let changes = 0;
7458
+ if (!ref) {
7459
+ throw new Error("cannot notify ref without a ref");
7460
+ }
7461
+ debug(runtime, "calling ref [%s]", node.getName());
7462
+ refListener(ref);
7463
+ return changes;
7464
+ }
7465
+ };
7466
+ }
7467
+ function createRemoveNode(node, options, runtime) {
7468
+ return {
7469
+ isDestructive: true,
7470
+ execute: () => {
7471
+ const meta = node.state;
7472
+ let changes = 0;
7473
+ if (node.component && meta) {
7474
+ debug(runtime, "[%s].remove()", node.getName());
7475
+ }
7476
+ const parent = node.parent;
7477
+ if (!parent) {
7478
+ throw new Error(`cannot remove from tree ${node.type} ${node.textContent}`);
7479
+ }
7480
+ parent.children.delete(node);
7481
+ const nodeRef = node.ref;
7482
+ if (nodeRef) {
7483
+ changes++;
7484
+ debug(runtime, "%s.remove()", node.getName());
7485
+ nodeRef.remove();
7486
+ }
7487
+ node.parent = null;
7488
+ return changes;
7489
+ }
7490
+ };
7491
+ }
7492
+ function createSetTextAction(node, textContent, runtime) {
7493
+ return {
7494
+ execute: () => {
7495
+ const ref = node.ref;
7496
+ let changes = 0;
7497
+ if (ref) {
7498
+ debug(runtime, "%s.textContent = ...", node.getName());
7499
+ ref.textContent = textContent ? textContent : "";
7500
+ node.textContent = textContent;
7501
+ changes++;
7502
+ }
7503
+ return changes;
7504
+ }
7505
+ };
7506
+ }
7507
+ function createUpdateLastRenderArgs(node, options, runtime, props, children) {
7508
+ return {
7509
+ postExecute: () => {
7510
+ node.lastRenderArgs = {
7511
+ props,
7512
+ children
7513
+ };
7514
+ return 0;
7515
+ }
7516
+ };
7517
+ }
7518
+ function createSetInnerHTMLAction(node, innerHTML, runtime) {
7519
+ return {
7520
+ execute: () => {
7521
+ const ref = node.ref;
7522
+ let changes = 0;
7523
+ if (ref) {
7524
+ debug(runtime, "%s.innerHTML = ...", node.getName());
7525
+ if (innerHTML !== null && innerHTML !== void 0) {
7526
+ ref.innerHTML = String(innerHTML);
7527
+ changes++;
7528
+ }
7529
+ node.innerHTML = innerHTML;
7530
+ }
7531
+ return changes;
7532
+ }
7533
+ };
7534
+ }
7535
+
7536
+ // node_modules/@miqro/jsx/build/esm/vdom/nodes/base-node.js
7537
+ function setDefaultOptions(options) {
7538
+ if (defaultOptionsFuse) {
7539
+ throw new Error("cannot override default options once and before an element has been created!");
7540
+ }
7541
+ defaultOptionsFuse = true;
7542
+ DEFAULT_OPTIONS = options;
7543
+ Object.freeze(DEFAULT_OPTIONS);
7544
+ }
7545
+ var BaseNode = class {
7546
+ type;
7547
+ parent;
7548
+ children = /* @__PURE__ */ new Set();
7549
+ currentEventListeners = [];
7550
+ contextKey;
7551
+ contextValue;
7552
+ state;
7553
+ tagName;
7554
+ lastRenderArgs = {};
7555
+ component;
7556
+ textContent;
7557
+ innerHTML;
7558
+ ref;
7559
+ isRoot;
7560
+ constructor(type, parent) {
7561
+ this.type = type;
7562
+ this.parent = parent;
7563
+ }
7564
+ create(runtime, options, change, parent, list) {
7565
+ this.parent = parent;
7566
+ this.update(runtime, options, change, list, true);
7567
+ list.push(createAppendAction(this, runtime));
7568
+ this.lastRenderArgs = {
7569
+ props: change.props,
7570
+ children: change.children
7571
+ };
7572
+ return this;
7573
+ }
7574
+ update(runtime, options, change, list, initial) {
7575
+ return this;
7576
+ }
7577
+ compare(change) {
7578
+ return this.type === change.type && this.component === change.func && this.tagName === change.tagName && this.contextKey === change.contextKey;
7579
+ }
7580
+ remove(runtime, options, list) {
7581
+ if (this.children) {
7582
+ for (const child of this.children) {
7583
+ child.remove(runtime, options, list);
7584
+ }
7585
+ }
7586
+ if (this.state && this.component) {
7587
+ list.push(createFlushEffectsRemove(this, options, runtime));
7588
+ }
7589
+ list.push(createRemoveNode(this, options, runtime));
7590
+ return this;
7591
+ }
7592
+ calculateChildren(runtime, options, change, list) {
7593
+ return change.children ? change.children : [];
7594
+ }
7595
+ getName() {
7596
+ return this.component ? this.component.name : this.tagName ? this.tagName : this.type;
7597
+ }
7598
+ initComponentState(runtime, options) {
7599
+ if (this.state) {
7600
+ throw new Error("already initialized");
7601
+ }
7602
+ const ref = this.ref;
7603
+ const o = options ? {
7604
+ ...getDefaultOptions(),
7605
+ ...options ? options : {}
7606
+ } : {
7607
+ ...getDefaultOptions()
7608
+ };
7609
+ const shadowInit = o.shadowInit;
7610
+ const renderAsFragment = o.asFragment;
7611
+ if (!ref && !renderAsFragment) {
7612
+ throw new Error("createMeta without ref");
7613
+ }
7614
+ this.state = {
7615
+ effectConditions: {},
7616
+ effectCallbacks: {},
7617
+ effectQueueCallbacks: {},
7618
+ effects: {},
7619
+ shadowRoot: renderAsFragment || !runtime.isIntanceOfHTMLElement(ref) || shadowInit === false ? void 0 : runtime.attachShadow(ref, shadowInit === void 0 || shadowInit === true ? {
7620
+ mode: "closed"
7621
+ } : shadowInit)
7622
+ };
7623
+ return this;
7624
+ }
7625
+ abortApply(runtime) {
7626
+ if (!this.state) {
7627
+ throw new Error("no meta");
7628
+ }
7629
+ runtime.clearTimeout(this.state.refreshTimeout);
7630
+ if (this.state.abort) {
7631
+ this.state.abort.abort("abortApply!");
7632
+ }
7633
+ this.state.abort = runtime.createAbortController();
7634
+ return this.state.abort;
7635
+ }
7636
+ };
7637
+ var DEFAULT_OPTIONS = {
7638
+ /*shadowInit: {
7639
+ mode: "closed"
7640
+ },
7641
+ asFragment: false*/
7642
+ /*shadowInit: false*/
7643
+ shadowInit: false,
7644
+ asFragment: true
7645
+ };
7646
+ var defaultOptionsFuse = false;
7647
+ function getDefaultOptions() {
7648
+ defaultOptionsFuse = true;
7649
+ return DEFAULT_OPTIONS;
7650
+ }
7651
+
7652
+ // node_modules/@miqro/jsx/build/esm/jsx.js
7653
+ var Fragment = /* @__PURE__ */ Symbol("Fragment");
7654
+ function createElement(tag2, attributes, ...children) {
7655
+ if (!tag2) {
7656
+ throw new Error(`cannot call createElement with [${String(tag2)}] `);
7657
+ }
7658
+ const isFragment = tag2 === Fragment;
7659
+ const fAsFragment = typeof tag2 === "string" || isFragment ? getDefaultOptions().asFragment : tag2.asFragment !== void 0 ? tag2.asFragment : getDefaultOptions().asFragment;
7660
+ const tagName = typeof tag2 === "string" ? tag2 : isFragment ? "Fragment" : `${!tag2.name ? "no-name" : tag2.name}-component`.toLowerCase();
7661
+ return isFragment ? {
7662
+ type: "Fragment",
7663
+ children
7664
+ } : typeof tag2 === "function" ? {
7665
+ type: fAsFragment ? "FragmentComponent" : "Component",
7666
+ tagName: !fAsFragment ? tagName : void 0,
7667
+ props: attributes ? attributes : /* @__PURE__ */ Object.create(null),
7668
+ func: tag2,
7669
+ children
7670
+ } : {
7671
+ type: "Element",
7672
+ tagName,
7673
+ props: attributes ? attributes : /* @__PURE__ */ Object.create(null),
7674
+ children
7675
+ };
7676
+ }
7677
+ var JSX = /* @__PURE__ */ Object.create(null);
7678
+ var objectDefineProperty = Object.defineProperty;
7679
+ objectDefineProperty(JSX, "createElement", {
7680
+ configurable: false,
7681
+ enumerable: true,
7682
+ writable: false,
7683
+ value: createElement
7684
+ });
7685
+ objectDefineProperty(JSX, "jsxFactory", {
7686
+ configurable: false,
7687
+ enumerable: true,
7688
+ writable: false,
7689
+ value: createElement
7690
+ });
7691
+ objectDefineProperty(JSX, "Fragment", {
7692
+ configurable: false,
7693
+ enumerable: true,
7694
+ writable: false,
7695
+ value: Fragment
7696
+ });
7697
+ objectDefineProperty(JSX, "jsxFragmentFactory", {
7698
+ configurable: false,
7699
+ enumerable: true,
7700
+ writable: false,
7701
+ value: Fragment
7702
+ });
7703
+ Object.freeze(JSX);
7704
+
7705
+ // node_modules/@miqro/jsx/build/esm/vdom/types.js
7706
+ var CHANGE_TYPES_SET = /* @__PURE__ */ new Set(["FragmentComponent", "Component", "Element", "Ref", "Fragment", "ContextProvider"]);
7707
+
7708
+ // node_modules/@miqro/jsx/build/esm/vdom/nodes/context-provider.js
7709
+ var ContextProvider = class extends BaseNode {
7710
+ constructor(parent) {
7711
+ super("ContextProvider", parent);
7712
+ }
7713
+ create(runtime, options, change, parent, list) {
7714
+ if (!change.contextKey) {
7715
+ throw new Error("cannot create ContextProvider without contextKey");
7716
+ }
7717
+ this.contextKey = change.contextKey;
7718
+ this.contextValue = change.contextValue;
7719
+ this.parent = parent;
7720
+ const children = this.calculateChildren(runtime, options, change, list);
7721
+ for (const child of children) {
7722
+ createNewNodeFromChange(runtime, options, normalizeChild(runtime, child), this, list);
7723
+ }
7724
+ return super.create(runtime, options, change, parent, list);
7725
+ }
7726
+ update(runtime, options, change, list, initial) {
7727
+ this.contextValue = change.contextValue;
7728
+ return this;
7729
+ }
7730
+ };
7731
+
7732
+ // node_modules/@miqro/jsx/build/esm/vdom/nodes/fragment.js
7733
+ var Fragment2 = class extends BaseNode {
7734
+ constructor(parent) {
7735
+ super("Fragment", parent);
7736
+ }
7737
+ create(runtime, options, change, parent, list) {
7738
+ this.parent = parent;
7739
+ const children = this.calculateChildren(runtime, options, change, list);
7740
+ for (const child of children) {
7741
+ createNewNodeFromChange(runtime, options, normalizeChild(runtime, child), this, list);
7742
+ }
7743
+ super.create(runtime, options, change, parent, list);
7744
+ return this;
7745
+ }
7746
+ };
7747
+
7748
+ // node_modules/@miqro/jsx/build/esm/component/render.js
7749
+ var currentContext = null;
7750
+ function useConditional(name) {
7751
+ return pushContextCall(currentContext, name);
7752
+ }
7753
+ function useRenderContext() {
7754
+ if (!currentContext) {
7755
+ throw new Error("useContext not in render");
7756
+ }
7757
+ return currentContext;
7758
+ }
7759
+ function renderComponent(runtime, component, options, list, props, children) {
7760
+ try {
7761
+ const meta = component.state;
7762
+ const func = component.component;
7763
+ if (!meta || !func) {
7764
+ throw new Error("meta not found!");
7765
+ }
7766
+ if (meta.conditionalUseDetected) {
7767
+ throw new Error("conditional this.use calls detected(4)!");
7768
+ }
7769
+ const context = {
7770
+ calls: [],
7771
+ node: component,
7772
+ options,
7773
+ runtime
7774
+ };
7775
+ list.push(createUpdateLastRenderArgs(component, options, runtime, props, children));
7776
+ currentContext = null;
7777
+ currentContext = context;
7778
+ const output = func(props, children);
7779
+ currentContext = null;
7780
+ if (meta.lastContextCalls && meta.lastContextCalls.length !== context.calls.length) {
7781
+ meta.conditionalUseDetected = true;
7782
+ throw new Error("conditional this.use calls detected(3)!");
7783
+ }
7784
+ meta.lastContextCalls = context.calls;
7785
+ return [output];
7786
+ } catch (e) {
7787
+ currentContext = null;
7788
+ throw e;
7789
+ }
7790
+ }
7791
+ function pushContextCall(context, name) {
7792
+ if (!context) {
7793
+ throw new Error("not in render(7)");
7794
+ }
7795
+ const meta = context.node.state;
7796
+ if (!meta) {
7797
+ throw new Error("not in render(-1)");
7798
+ }
7799
+ const callIndex = context.calls.length;
7800
+ const key = `${callIndex}-${name}`;
7801
+ context.calls.push({
7802
+ key
7803
+ });
7804
+ if (!meta.lastContextCalls) {
7805
+ return key;
7806
+ }
7807
+ if (context.calls > meta.lastContextCalls) {
7808
+ meta.conditionalUseDetected = true;
7809
+ throw new Error("conditional this.use calls detected(1)!");
7810
+ }
7811
+ const lastCall = meta.lastContextCalls[callIndex];
7812
+ if (lastCall === void 0 || lastCall.key !== key) {
7813
+ meta.conditionalUseDetected = true;
7814
+ throw new Error("conditional this.use calls detected(2)!");
7815
+ }
7816
+ return key;
7817
+ }
7818
+
7819
+ // node_modules/@miqro/jsx/build/esm/vdom/nodes/component-fragment.js
7820
+ var FragmentComponent = class extends Fragment2 {
7821
+ constructor(parent) {
7822
+ super(parent);
7823
+ this.type = "FragmentComponent";
7824
+ }
7825
+ create(runtime, options, change, parent, list) {
7826
+ if (change.func === void 0) {
7827
+ throw new Error("cannot create FragmentFunction without func");
7828
+ }
7829
+ this.component = change.func;
7830
+ const o = {
7831
+ asFragment: true
7832
+ };
7833
+ if (this.component.shadowInit !== void 0) {
7834
+ o.shadowInit = this.component.shadowInit;
7835
+ }
7836
+ this.initComponentState(runtime, o);
7837
+ this.parent = parent;
7838
+ this.lastRenderArgs = {
7839
+ props: change.props,
7840
+ children: change.children
7841
+ };
7842
+ return super.create(runtime, options, change, parent, list);
7843
+ }
7844
+ calculateChildren(runtime, options, change, list) {
7845
+ if (this.component && this.state) {
7846
+ list.push(createFlushEffects(this, options, runtime));
7847
+ const out = renderComponent(runtime, this, options, list, change.props, change.children);
7848
+ return out ? out : [];
7849
+ } else {
7850
+ return change.children ? change.children : [];
7851
+ }
7852
+ }
7853
+ };
7854
+
7855
+ // node_modules/@miqro/jsx/build/esm/vdom/nodes/element.js
7856
+ var ATTRIBUTES_WITHOUT_VALUE = /* @__PURE__ */ new Set([
7857
+ "disabled",
7858
+ "checked",
7859
+ "selected",
7860
+ "hidden"
7861
+ ]);
7862
+ var Element = class extends BaseNode {
7863
+ constructor(parent) {
7864
+ super("Element", parent);
7865
+ }
7866
+ create(runtime, options, change, parent, list) {
7867
+ if (change.tagName === void 0) {
7868
+ throw new Error("cannot create element without a tagName");
7869
+ }
7870
+ this.tagName = change.tagName;
7871
+ this.ref = runtime.createElement(change.tagName);
7872
+ this.parent = parent;
7873
+ const children = this.calculateChildren(runtime, options, change, list);
7874
+ for (const child of children) {
7875
+ createNewNodeFromChange(runtime, options, normalizeChild(runtime, child), this, list);
7876
+ }
7877
+ return super.create(runtime, options, change, parent, list);
7878
+ }
7879
+ update(runtime, options, change, list, initial) {
7880
+ const attributesSet = [];
7881
+ let setInnerHTMLFlag = true;
7882
+ let setInnerHTML = void 0;
7883
+ const attributesRemove = [];
7884
+ const listenerChanges = [];
7885
+ let refListener = null;
7886
+ const changeProps = change.props ? change.props : {};
7887
+ const changePropNames = new Set(Object.keys(changeProps));
7888
+ const element = this.ref;
7889
+ const currentAttributeNames = new Set(element.getAttributeNames());
7890
+ for (const changePropName of changePropNames) {
7891
+ const changePropValue = changeProps[changePropName];
7892
+ if (typeof changePropValue === "function") {
7893
+ if (changePropName === "ref") {
7894
+ if (!initial) {
7895
+ continue;
7896
+ } else {
7897
+ refListener = changePropValue;
7898
+ continue;
7899
+ }
7900
+ } else if (changePropName.indexOf("on") === 0) {
7901
+ const eventName = changePropName.substring("on".length);
7902
+ listenerChanges.push({
7903
+ eventName,
7904
+ listener: changePropValue
7905
+ });
7906
+ continue;
7907
+ } else if (changePropName.indexOf("data-on") === 0) {
7908
+ const eventName = changePropName.substring("data-on".length);
7909
+ listenerChanges.push({
7910
+ eventName,
7911
+ listener: changePropValue
7912
+ });
7913
+ continue;
7914
+ }
7915
+ continue;
7916
+ }
7917
+ if (!this.component) {
7918
+ if (changePropName === "innerHTML") {
7919
+ if (changePropValue !== this.innerHTML) {
7920
+ setInnerHTMLFlag = true;
7921
+ setInnerHTML = changePropValue;
7922
+ }
7923
+ continue;
7924
+ }
7925
+ const attributeName = changePropName === "className" ? "class" : changePropName;
7926
+ currentAttributeNames.delete(attributeName);
7927
+ const currentAttributeValue = attributeName === "value" ? element.value : attributeName === "checked" ? element.checked : element.getAttribute(attributeName);
7928
+ if (typeof changePropValue === "boolean" && ATTRIBUTES_WITHOUT_VALUE.has(attributeName)) {
7929
+ if (attributeName === "checked") {
7930
+ if (changePropValue) {
7931
+ attributesSet.push({
7932
+ name: attributeName,
7933
+ value: ""
7934
+ });
7935
+ } else {
7936
+ attributesRemove.push(attributeName);
7937
+ }
7938
+ } else if (!changePropValue && currentAttributeValue !== null) {
7939
+ attributesRemove.push(attributeName);
7940
+ } else if (changePropValue && currentAttributeValue === null) {
7941
+ attributesSet.push({
7942
+ name: attributeName,
7943
+ value: ""
7944
+ });
7945
+ }
7946
+ } else {
7947
+ const sValue = String(changePropValue);
7948
+ if (sValue !== currentAttributeValue) {
7949
+ attributesSet.push({
7950
+ name: attributeName,
7951
+ value: String(changePropValue)
7952
+ });
7953
+ }
7954
+ }
7955
+ }
7956
+ }
7957
+ if (!this.component) {
7958
+ if (currentAttributeNames.size > 0) {
7959
+ for (const name of currentAttributeNames) {
7960
+ attributesRemove.push(name);
7961
+ }
7962
+ }
7963
+ }
7964
+ if (this.currentEventListeners.length > 0) {
7965
+ list.push(createRemoveListeners(this, runtime));
7966
+ }
7967
+ if (attributesRemove.length > 0) {
7968
+ list.push(createRemoveAttributesAction(this, attributesRemove, runtime));
7969
+ }
7970
+ if (attributesSet.length > 0) {
7971
+ list.push(createSetAttributesAction(this, attributesSet, runtime));
7972
+ }
7973
+ if (listenerChanges.length > 0) {
7974
+ list.push(createUpdateListeners(this, listenerChanges, runtime));
7975
+ }
7976
+ if (refListener !== null) {
7977
+ list.push(createNotifyRef(this, refListener, runtime));
7978
+ }
7979
+ if (setInnerHTMLFlag) {
7980
+ list.push(createSetInnerHTMLAction(this, setInnerHTML, runtime));
7981
+ }
7982
+ return super.update(runtime, options, change, list);
7983
+ }
7984
+ };
7985
+
7986
+ // node_modules/@miqro/jsx/build/esm/vdom/nodes/component.js
7987
+ var Component = class extends Element {
7988
+ constructor(parent) {
7989
+ super(parent);
7990
+ this.type = "Component";
7991
+ }
7992
+ create(runtime, options, change, parent, list) {
7993
+ if (change.func === void 0) {
7994
+ throw new Error("cannot create Function without func");
7995
+ }
7996
+ if (change.tagName === void 0) {
7997
+ throw new Error("cannot create element without a tagName");
7998
+ }
7999
+ this.component = change.func;
8000
+ this.tagName = change.tagName;
8001
+ this.ref = runtime.createElement(change.tagName);
8002
+ if (this.component) {
8003
+ const o = {};
8004
+ if (this.component.asFragment !== void 0) {
8005
+ o.asFragment = this.component.asFragment;
8006
+ }
8007
+ if (this.component.shadowInit !== void 0) {
8008
+ o.shadowInit = this.component.shadowInit;
8009
+ }
8010
+ this.initComponentState(runtime, o);
8011
+ }
8012
+ this.parent = parent;
8013
+ const children = this.calculateChildren(runtime, options, change, list);
8014
+ for (const child of children) {
8015
+ createNewNodeFromChange(runtime, options, normalizeChild(runtime, child), this, list);
8016
+ }
8017
+ this.parent = parent;
8018
+ this.update(runtime, options, change, list, true);
8019
+ list.push(createAppendAction(this, runtime));
8020
+ this.lastRenderArgs = {
8021
+ props: change.props,
8022
+ children: change.children
8023
+ };
8024
+ return this;
8025
+ }
8026
+ calculateChildren(runtime, options, change, list) {
8027
+ if (this.component && this.state) {
8028
+ list.push(createFlushEffects(this, options, runtime));
8029
+ const out = renderComponent(runtime, this, options, list, change.props, change.children);
8030
+ return out ? out : [];
8031
+ } else {
8032
+ return super.calculateChildren(runtime, options, change, list);
8033
+ }
8034
+ }
8035
+ };
8036
+
8037
+ // node_modules/@miqro/jsx/build/esm/vdom/nodes/ref.js
8038
+ var Ref = class extends BaseNode {
8039
+ constructor(parent) {
8040
+ super("Ref", parent);
8041
+ }
8042
+ create(runtime, options, change, parent, list) {
8043
+ if (!change.ref) {
8044
+ throw new Error("cannot create ref without ref");
8045
+ }
8046
+ this.ref = change.ref;
8047
+ this.parent = parent;
8048
+ list.push(createAppendAction(this, runtime));
8049
+ return this;
8050
+ }
8051
+ compare(change) {
8052
+ return this.type === change.type && this.ref === change.ref && this.component === change.func && this.tagName === change.tagName && this.ref === change.ref;
8053
+ }
8054
+ };
8055
+
8056
+ // node_modules/@miqro/jsx/build/esm/vdom/nodes/text.js
8057
+ var Text = class extends BaseNode {
8058
+ constructor(parent) {
8059
+ super("Text", parent);
8060
+ }
8061
+ create(runtime, options, change, parent, list) {
8062
+ if (change.textContent === void 0) {
8063
+ throw new Error("cannot create text without a textContent");
8064
+ }
8065
+ this.ref = runtime.createTextNode(change.textContent);
8066
+ this.textContent = change.textContent;
8067
+ this.parent = parent;
8068
+ list.push(createAppendAction(this, runtime));
8069
+ return this;
8070
+ }
8071
+ update(runtime, options, change, list, initial) {
8072
+ if (this.textContent !== change.textContent) {
8073
+ list.push(createSetTextAction(this, change.textContent, runtime));
8074
+ }
8075
+ return this;
8076
+ }
8077
+ };
8078
+
8079
+ // node_modules/@miqro/jsx/build/esm/vdom/tree.js
8080
+ var Tree = class extends BaseNode {
8081
+ name;
8082
+ constructor(name, ref, runtime, shadowInit) {
8083
+ super("Fragment", null);
8084
+ this.isRoot = true;
8085
+ this.parent = null;
8086
+ this.ref = ref;
8087
+ this.initComponentState(runtime, {
8088
+ asFragment: false,
8089
+ shadowInit
8090
+ });
8091
+ this.name = name;
8092
+ }
8093
+ getName() {
8094
+ return this.name;
8095
+ }
8096
+ };
8097
+ function createNewNodeFromChange(runtime, options, change, parent, list) {
8098
+ switch (change.type) {
8099
+ case "ContextProvider":
8100
+ return new ContextProvider(parent).create(runtime, options, change, parent, list);
8101
+ case "Element":
8102
+ return new Element(parent).create(runtime, options, change, parent, list);
8103
+ case "Component":
8104
+ return new Component(parent).create(runtime, options, change, parent, list);
8105
+ case "Ref":
8106
+ return new Ref(parent).create(runtime, options, change, parent, list);
8107
+ case "Text":
8108
+ return new Text(parent).create(runtime, options, change, parent, list);
8109
+ case "Fragment":
8110
+ return new Fragment2(parent).create(runtime, options, change, parent, list);
8111
+ case "FragmentComponent":
8112
+ return new FragmentComponent(parent).create(runtime, options, change, parent, list);
8113
+ default:
8114
+ throw new Error(`unsopported change.type = %${change.type}`);
8115
+ }
8116
+ }
8117
+ function normalizeChild(runtime, c) {
8118
+ if (typeof c === "object") {
8119
+ if (c instanceof Array) {
8120
+ return {
8121
+ type: "Fragment",
8122
+ children: c
8123
+ };
8124
+ } else if (runtime.isInstanceofNode(c)) {
8125
+ return {
8126
+ type: "Ref",
8127
+ ref: c
8128
+ };
8129
+ } else if (c && CHANGE_TYPES_SET.has(c.type)) {
8130
+ return c;
8131
+ }
8132
+ }
8133
+ return {
8134
+ type: "Text",
8135
+ textContent: String(c)
8136
+ };
8137
+ }
8138
+
8139
+ // node_modules/@miqro/jsx/build/esm/vdom/diff.js
8140
+ function diff(abortSignal, tree, changes, actions, options, runtime, lo = false) {
8141
+ if (changes === void 0 || changes === null || abortSignal.aborted) {
8142
+ return actions;
8143
+ }
8144
+ const currentChildren = tree.children.values();
8145
+ let currentChildrenRet = currentChildren.next();
8146
+ for (const change of changes) {
8147
+ const normalizedChange = normalizeChild(runtime, change);
8148
+ const actualChild = currentChildrenRet.value;
8149
+ if (actualChild === void 0) {
8150
+ createNewNodeFromChange(runtime, options, normalizedChange, tree, actions);
8151
+ } else if (!actualChild.compare(normalizedChange)) {
8152
+ currentChildrenRet = removeFrom(runtime, currentChildren, currentChildrenRet, actions, options);
8153
+ createNewNodeFromChange(runtime, options, normalizedChange, tree, actions);
8154
+ } else {
8155
+ actualChild.update(runtime, options, normalizedChange, actions);
8156
+ if (actualChild.type === "Fragment" || actualChild.type === "FragmentComponent" || actualChild.type === "ContextProvider") {
8157
+ const fragmentActions = [];
8158
+ diff(abortSignal, actualChild, actualChild.calculateChildren(runtime, options, normalizedChange, fragmentActions), fragmentActions, options, runtime, true);
8159
+ if (areActionDestructive(fragmentActions)) {
8160
+ currentChildrenRet = currentChildren.next();
8161
+ currentChildrenRet = removeFrom(runtime, currentChildren, currentChildrenRet, actions, options);
8162
+ }
8163
+ actions.push(...fragmentActions);
8164
+ } else {
8165
+ diff(abortSignal, actualChild, actualChild.calculateChildren(runtime, options, normalizedChange, actions), actions, options, runtime);
8166
+ }
8167
+ }
8168
+ currentChildrenRet = currentChildren.next();
8169
+ }
8170
+ currentChildrenRet = removeFrom(runtime, currentChildren, currentChildrenRet, actions, options);
8171
+ return actions;
8172
+ }
8173
+ function removeFrom(runtime, nodeIterator, nodeIteratorRet, currentActions, options) {
8174
+ while (nodeIteratorRet.value !== void 0) {
8175
+ nodeIteratorRet.value.remove(runtime, options, currentActions);
8176
+ nodeIteratorRet = nodeIterator.next();
8177
+ }
8178
+ return nodeIteratorRet;
8179
+ }
8180
+ function areActionDestructive(actions) {
8181
+ for (const fragmentAction of actions) {
8182
+ if (fragmentAction.isDestructive) {
8183
+ return true;
8184
+ }
8185
+ }
8186
+ return false;
8187
+ }
8188
+
8189
+ // node_modules/@miqro/jsx/build/esm/vdom/execute.js
8190
+ function execute(abortSignal, runtime, actions) {
8191
+ if (abortSignal.aborted) {
8192
+ return 0;
8193
+ }
8194
+ let changes = 0;
8195
+ const postExecute = [];
8196
+ for (const action of actions) {
8197
+ try {
8198
+ if (action.execute) {
8199
+ const actionChanges = action.execute();
8200
+ changes += actionChanges;
8201
+ }
8202
+ if (action.postExecute) {
8203
+ postExecute.push(action);
8204
+ }
8205
+ } catch (e) {
8206
+ error(runtime, e);
8207
+ throw e;
8208
+ }
8209
+ }
8210
+ for (const action of postExecute) {
8211
+ try {
8212
+ const actionChanges = action.postExecute();
8213
+ changes += actionChanges;
8214
+ } catch (e) {
8215
+ error(runtime, e);
8216
+ throw e;
8217
+ }
8218
+ }
8219
+ return changes;
8220
+ }
8221
+
8222
+ // node_modules/@miqro/jsx/build/esm/vdom/render.js
8223
+ function render(runtime, tree, treeOptions, change, preActions = [], props, children) {
8224
+ const meta = tree.state;
8225
+ if (!meta) {
8226
+ throw new Error("cannot find meta");
8227
+ }
8228
+ const abortSignal = tree.abortApply(runtime).signal;
8229
+ debug(runtime, "render for [%s]", tree.getName());
8230
+ if (tree.isRoot || tree.parent !== null) {
8231
+ const applyStart = Date.now();
8232
+ const out = change instanceof Array ? change : change === true ? renderComponent(runtime, tree, treeOptions, preActions, props, children) : void 0;
8233
+ const changes = execute(abortSignal, runtime, diff(abortSignal, tree, out, preActions, treeOptions, runtime));
8234
+ const took = Date.now() - applyStart;
8235
+ if (took > 5e3) {
8236
+ error(runtime, "render for [%s] with [%s] changes took [%s]ms", tree.getName(), changes, took);
8237
+ } else {
8238
+ debug(runtime, "render for [%s] with [%s] changes took [%s]ms", tree.getName(), changes, took);
8239
+ }
8240
+ return changes;
8241
+ } else {
8242
+ debug(runtime, "render skipped for [%s]", tree.getName());
8243
+ return 0;
8244
+ }
8245
+ }
8246
+
8247
+ // node_modules/@miqro/jsx/build/esm/component/container.js
8248
+ var objectDefineProperty2 = Object.defineProperty;
8249
+ function createContainer(element, runtime, args) {
8250
+ const name = `DOMContainer [${String(element)}]`;
8251
+ const tree = new Tree(name, element, runtime, args?.shadowInit);
8252
+ const treeOptions = args && args.runtimeOptions ? {
8253
+ disableEffects: false,
8254
+ disableRefListener: false,
8255
+ disableRefresh: false,
8256
+ disableEvents: false,
8257
+ ...args.runtimeOptions
8258
+ } : {
8259
+ disableEffects: false,
8260
+ disableRefListener: false,
8261
+ disableRefresh: false,
8262
+ disableEvents: false
8263
+ };
8264
+ const container = /* @__PURE__ */ Object.create(null);
8265
+ objectDefineProperty2(container, "name", {
8266
+ configurable: false,
8267
+ enumerable: true,
8268
+ writable: false,
8269
+ value: name
8270
+ });
8271
+ objectDefineProperty2(container, "render", {
8272
+ configurable: false,
8273
+ enumerable: true,
8274
+ writable: false,
8275
+ value: function render3(out) {
8276
+ return render(runtime, tree, treeOptions, [out]);
8277
+ }
8278
+ });
8279
+ objectDefineProperty2(container, "disconnect", {
8280
+ configurable: false,
8281
+ enumerable: true,
8282
+ writable: false,
8283
+ value: function disconnect() {
8284
+ return render(runtime, tree, treeOptions, []);
8285
+ }
8286
+ });
8287
+ Object.freeze(container);
8288
+ return container;
8289
+ }
8290
+
8291
+ // node_modules/@miqro/jsx/build/esm/hooks/runtime.js
8292
+ function useRuntime() {
8293
+ useConditional("useRuntime");
8294
+ const currentContext3 = useRenderContext();
8295
+ if (!currentContext3) {
8296
+ throw new Error("useRuntime not in render");
8297
+ }
8298
+ return currentContext3.runtime;
8299
+ }
8300
+
8301
+ // node_modules/@miqro/jsx/build/esm/hooks/refresh.js
8302
+ var REFRESH_TIMEOUT_MS = 0;
8303
+ function useRefresh() {
8304
+ useConditional("useRefresh");
8305
+ const currentContext3 = useRenderContext();
8306
+ if (!currentContext3) {
8307
+ throw new Error("useRefresh not in render");
8308
+ }
8309
+ const meta = currentContext3.node.state;
8310
+ if (!meta) {
8311
+ throw new Error("useRefresh without meta");
8312
+ }
8313
+ const runtime = useRuntime();
8314
+ const options = currentContext3.options;
8315
+ const node = currentContext3.node;
8316
+ const component = node.component;
8317
+ if (!component) {
8318
+ throw new Error("useRefresh without func");
8319
+ }
8320
+ return (cb) => {
8321
+ runtime.clearTimeout(meta.refreshTimeout);
8322
+ if (options.disableRefresh) {
8323
+ debug(runtime, "useRefresh.refresh() disabled for [%s]", component.name);
8324
+ } else {
8325
+ meta.refreshTimeout = runtime.setTimeout(() => {
8326
+ debug(runtime, "useRefresh.refresh() for [%s]", component.name);
8327
+ const props = node.lastRenderArgs.props;
8328
+ const children = node.lastRenderArgs.children;
8329
+ const changes = render(runtime, node, options, true, [createFlushEffects(node, options, runtime)], props, children);
8330
+ if (cb) {
8331
+ runtime.setTimeout(() => cb(changes), 0);
8332
+ }
8333
+ }, REFRESH_TIMEOUT_MS);
8334
+ }
8335
+ };
8336
+ }
8337
+
8338
+ // node_modules/@miqro/jsx/build/esm/hooks/state.js
8339
+ function useState(defaultValue) {
8340
+ const key = useConditional("useState");
8341
+ const currentContext3 = useRenderContext();
8342
+ if (!currentContext3) {
8343
+ throw new Error("useState not in render");
8344
+ }
8345
+ const refresh = useRefresh();
8346
+ const meta = currentContext3.node.state;
8347
+ const runtime = useRuntime();
8348
+ if (!meta) {
8349
+ throw new Error("useState without meta");
8350
+ }
8351
+ if (!meta.state) {
8352
+ meta.state = /* @__PURE__ */ Object.create(null);
8353
+ }
8354
+ if (!meta.state) {
8355
+ throw new Error("useState without meta.state");
8356
+ }
8357
+ const name = currentContext3.node.component?.name;
8358
+ const currentStateItem = meta.state[key];
8359
+ if (currentStateItem === void 0) {
8360
+ const stateItem = {
8361
+ value: defaultValue,
8362
+ set: (newValue, refreshOnSet = true) => {
8363
+ debug(runtime, "setState() for [%s]", name);
8364
+ if (stateItem.value !== newValue) {
8365
+ stateItem.value = newValue;
8366
+ if (refreshOnSet) {
8367
+ refresh(typeof refreshOnSet === "function" ? refreshOnSet : void 0);
8368
+ }
8369
+ }
8370
+ },
8371
+ get: () => {
8372
+ return stateItem.value;
8373
+ }
8374
+ };
8375
+ meta.state[key] = stateItem;
8376
+ return [
8377
+ stateItem.value,
8378
+ stateItem.set,
8379
+ stateItem.get
8380
+ ];
8381
+ } else {
8382
+ return [
8383
+ currentStateItem.value,
8384
+ currentStateItem.set,
8385
+ currentStateItem.get
8386
+ ];
8387
+ }
8388
+ }
8389
+
8390
+ // node_modules/@miqro/jsx/build/esm/hooks/effect.js
8391
+ function useEffect(effect, condition) {
8392
+ const currentContext3 = useRenderContext();
8393
+ if (!currentContext3) {
8394
+ throw new Error("useEffect not in render");
8395
+ }
8396
+ const key = useConditional("useEffect");
8397
+ const meta = currentContext3.node.state;
8398
+ if (!meta) {
8399
+ throw new Error("useEffect without meta");
8400
+ }
8401
+ const c = condition ? condition : false;
8402
+ if (meta.effectConditions[key] === void 0 || condition === void 0 && meta.effectConditions[key] === false || !equalArray(meta.effectConditions[key], c)) {
8403
+ meta.effectConditions[key] = c;
8404
+ const oldCallback = meta.effectQueueCallbacks[key];
8405
+ delete meta.effectQueueCallbacks[key];
8406
+ if (meta.effectCallbacks[key]) {
8407
+ meta.conditionalUseDetected = true;
8408
+ throw new Error("invalid state. component lock.");
8409
+ }
8410
+ if (oldCallback) {
8411
+ meta.effectCallbacks[key] = oldCallback;
8412
+ }
8413
+ meta.effects[key] = effect;
8414
+ }
8415
+ }
8416
+ function equalArray(a, c) {
8417
+ if (typeof a !== typeof c) {
8418
+ return false;
8419
+ }
8420
+ if (typeof a === "undefined" || typeof a === "boolean") {
8421
+ return a === c;
8422
+ }
8423
+ const l1 = a;
8424
+ const l2 = c;
8425
+ if (l1.length !== l2.length) {
8426
+ return false;
8427
+ }
8428
+ for (let i = 0; i < l1.length; i++) {
8429
+ if (l1[i] !== l2[i]) {
8430
+ return false;
8431
+ }
8432
+ }
8433
+ return true;
8434
+ }
8435
+
8436
+ // node_modules/@miqro/jsx/build/esm/hooks/pathname.js
8437
+ function usePathname() {
8438
+ const runtime = useRuntime();
8439
+ const pathname = runtime.getLocation().pathname;
8440
+ const [currentLocation, setCurrentLocation, getL] = useState(pathname);
8441
+ debug(runtime, "usePathname [%s]", currentLocation);
8442
+ useEffect(function usePathnameEffect() {
8443
+ const listener = () => {
8444
+ const newLocation = runtime.getLocation().pathname;
8445
+ setCurrentLocation(newLocation);
8446
+ };
8447
+ runtime.addPathListener(listener);
8448
+ return function usePathnameEffectUnLoad() {
8449
+ runtime.removePathListener(listener);
8450
+ };
8451
+ }, []);
8452
+ return String(currentLocation);
8453
+ }
8454
+
8455
+ // node_modules/@miqro/jsx/build/esm/component/router.js
8456
+ function useIsLocationPathNameActive(path) {
8457
+ useConditional("useIsLocationPathNameMatch");
8458
+ const runtime = useRuntime();
8459
+ const basePath = runtime.getBasePath();
8460
+ return isPathLocation(basePath, path, usePathname());
8461
+ }
8462
+ function Router(props) {
8463
+ const defaultElement = props.defaultElement;
8464
+ const locationPathName = usePathname();
8465
+ const runtime = useRuntime();
8466
+ const active = getActiveRoute(locationPathName, props.routes, runtime);
8467
+ return active ? active.element : defaultElement;
8468
+ }
8469
+ Router.asFragment = true;
8470
+ Router.shadowInit = false;
8471
+ function Link(props, children) {
8472
+ const path = props.path;
8473
+ const runtime = useRuntime();
8474
+ const basePath = runtime.getBasePath();
8475
+ const className = props.className ? props.className : "";
8476
+ const activeClass = props.classNameActive ? props.classNameActive : "active";
8477
+ const inactiveClass = props.classNameInactive ? props.classNameInactive : "inactive";
8478
+ const isActive = useIsLocationPathNameActive(path);
8479
+ const newClassName = `${className ? `${className} ` : ""}${isActive ? activeClass : inactiveClass}`;
8480
+ const fullPath = getFullPath(basePath, path);
8481
+ const element = {
8482
+ type: "Element",
8483
+ tagName: "a",
8484
+ props: {
8485
+ class: newClassName,
8486
+ href: fullPath
8487
+ },
8488
+ children
8489
+ };
8490
+ return props.disableHandler ? element : {
8491
+ ...element,
8492
+ props: {
8493
+ ...element.props,
8494
+ onclick: (ev) => {
8495
+ ev.preventDefault();
8496
+ runtime.pushPath(fullPath);
8497
+ }
8498
+ }
8499
+ };
8500
+ }
8501
+ Link.asFragment = true;
8502
+ Link.shadowInit = false;
8503
+ function getFullPath(basePath, p) {
8504
+ return normalizePath(`${basePath ? basePath : ""}${p}`);
8505
+ }
8506
+ function isPathLocation(basePath, p, currentLocation) {
8507
+ const path = getFullPath(basePath, p);
8508
+ const pathname = normalizePath(currentLocation);
8509
+ return pathname.toLocaleLowerCase() === path.toLowerCase();
8510
+ }
8511
+ function getActiveRoute(locationPathName, routes, runtime) {
8512
+ let activeRoute;
8513
+ const basePath = runtime.getBasePath() ? runtime.getBasePath() : "";
8514
+ for (const route of routes) {
8515
+ if (isPathLocation(basePath, route.path, locationPathName)) {
8516
+ activeRoute = route;
8517
+ break;
8518
+ }
8519
+ }
8520
+ return activeRoute;
8521
+ }
8522
+ function normalizePath(path) {
8523
+ if (path.length > 1 && path.charAt(path.length - 1) === "/") {
8524
+ path = path.substring(0, path.length - 1);
8525
+ }
8526
+ return path;
8527
+ }
8528
+
8529
+ // node_modules/@miqro/jsx/build/esm/hooks/ref.js
8530
+ function useRef() {
8531
+ const [ref, setRef] = useState(null);
8532
+ function useRefFunction(newRef) {
8533
+ setRef(newRef);
8534
+ }
8535
+ ;
8536
+ useRefFunction.current = ref;
8537
+ return useRefFunction;
8538
+ }
8539
+
8540
+ // node_modules/@miqro/jsx/build/esm/hooks/query.js
8541
+ function useAllQuery(watch2 = true) {
8542
+ const key = useConditional(`useAllQuery`);
8543
+ const runtime = useRuntime();
8544
+ const [last, setLast, getLast] = useState(getQueryValue(runtime));
8545
+ useEffect(function useQueryEffect() {
8546
+ if (watch2) {
8547
+ let useQueryEffectPathListener = function() {
8548
+ const current = getQueryValue(runtime);
8549
+ if (getLast() !== current) {
8550
+ debug(runtime, "useQuery listener for %s", key);
8551
+ setLast(current);
8552
+ }
8553
+ };
8554
+ runtime.addPathListener(useQueryEffectPathListener);
8555
+ return function useQueryEffectUnLoad() {
8556
+ runtime.removePathListener(useQueryEffectPathListener);
8557
+ };
8558
+ }
8559
+ }, []);
8560
+ return last;
8561
+ }
8562
+ function useQuery(name, defaultValue, watch2 = true) {
8563
+ const key = useConditional(`useQuery-${name}-${defaultValue}`);
8564
+ const runtime = useRuntime();
8565
+ const [last, setLast, getLast] = useState(getQueryValue(runtime, name, defaultValue));
8566
+ useEffect(function useQueryEffect() {
8567
+ if (watch2) {
8568
+ let useQueryEffectPathListener = function() {
8569
+ const current = getQueryValue(runtime, name, defaultValue);
8570
+ if (getLast() !== current) {
8571
+ debug(runtime, "useQuery listener for %s", key);
8572
+ setLast(current);
8573
+ }
8574
+ };
8575
+ runtime.addPathListener(useQueryEffectPathListener);
8576
+ return function useQueryEffectUnLoad() {
8577
+ runtime.removePathListener(useQueryEffectPathListener);
8578
+ };
8579
+ }
8580
+ }, []);
8581
+ return [
8582
+ last,
8583
+ function setQuery(newValue) {
8584
+ setQueryValue(runtime, name, newValue, watch2);
8585
+ setLast(newValue);
8586
+ },
8587
+ function getQuery() {
8588
+ return getQueryValue(runtime, name, defaultValue);
8589
+ }
8590
+ ];
8591
+ }
8592
+ function getQueryValue(runtime, name, defaultValue) {
8593
+ if (!name) {
8594
+ return runtime.getLocation().searchParams.toString();
8595
+ } else {
8596
+ const ret = runtime.getLocation().searchParams.getAll(name);
8597
+ if (ret.length === 0) {
8598
+ return defaultValue !== void 0 ? defaultValue : null;
8599
+ }
8600
+ return ret && ret.length === 1 && !(defaultValue instanceof Array) ? ret[0] : ret;
8601
+ }
7154
8602
  }
7155
- var init_html_encode = __esm({
7156
- "editor/common/html-encode.ts"() {
8603
+ function setQueryValue(runtime, name, value, watch2 = true) {
8604
+ const url = runtime.getLocation();
8605
+ if (value instanceof Array) {
8606
+ url.searchParams.delete(name);
8607
+ for (const v of value) {
8608
+ url.searchParams.append(name, v);
8609
+ }
8610
+ } else if (value !== null) {
8611
+ url.searchParams.set(name, value);
8612
+ } else {
8613
+ url.searchParams.delete(name);
7157
8614
  }
7158
- });
8615
+ if (watch2) {
8616
+ runtime.pushPath(String(url));
8617
+ }
8618
+ }
7159
8619
 
7160
- // editor/common/editor-index.tsx
7161
- var editor_index_exports = {};
7162
- __export(editor_index_exports, {
7163
- EditorIndex: () => EditorIndex
7164
- });
7165
- function EditorIndex(editorCSS, editorJS, enableHotReload) {
7166
- return async function editorIndex(req, res) {
7167
- const admin = req.editor;
7168
- const errors = parseInflateErrors(admin ? admin.getInflateErrors() : []);
7169
- const files = scanDir(req);
7170
- const migrations = admin ? admin.getMigrations().map((m) => m.name) : [];
7171
- const services = admin ? admin.getServices() : ["."];
7172
- const hotReload = enableHotReload ? admin ? admin.getHotReloadHTML() : "" : "";
7173
- res.html(`<!DOCTYPE html><html><body><style>${editorCSS}</style><script type="module">${editorJS}</script><editor-component class="main-container" reloadstring="${req.uuid}" migrations="${HTMLEncode2(JSON.stringify(migrations))}" services="${HTMLEncode2(JSON.stringify(services))}" errors="${HTMLEncode2(JSON.stringify(errors))}" files="${HTMLEncode2(JSON.stringify(files))}"><noscript>Enable JavaScript</noscript></editor-component>${hotReload}</body></html>`);
8620
+ // node_modules/@miqro/jsx/build/esm/hooks/useelement.js
8621
+ function useElement() {
8622
+ useConditional("useElement");
8623
+ const currentContext3 = useRenderContext();
8624
+ if (!currentContext3) {
8625
+ throw new Error("useElement not in render");
8626
+ }
8627
+ return currentContext3.node.ref ? currentContext3.node.ref : null;
8628
+ }
8629
+
8630
+ // node_modules/@miqro/jsx/build/esm/hooks/context.js
8631
+ function createContext(defaultValue) {
8632
+ const symbol = /* @__PURE__ */ Symbol();
8633
+ return {
8634
+ provider: createContextProvider(symbol, defaultValue),
8635
+ symbol
7174
8636
  };
7175
8637
  }
7176
- var init_editor_index = __esm({
7177
- "editor/common/editor-index.tsx"() {
7178
- init_scan_api();
7179
- init_restart_api();
7180
- init_html_encode();
8638
+ function useContext(context) {
8639
+ useConditional("useContext");
8640
+ const currentContext3 = useRenderContext();
8641
+ if (!currentContext3) {
8642
+ throw new Error("useContext not in render");
7181
8643
  }
7182
- });
7183
-
7184
- // src/lib.ts
7185
- var lib_exports3 = {};
7186
- __export(lib_exports3, {
7187
- App: () => App,
7188
- ClusterCache: () => ClusterCache,
7189
- ClusterWebSocketServer2: () => ClusterWebSocketServer2,
7190
- DBManager: () => DBManager,
7191
- JSX: () => JSX2,
7192
- LocalCache: () => LocalCache,
7193
- LogProvider: () => LogProvider,
7194
- LoggerHandler: () => LoggerHandler,
7195
- Miqro: () => Miqro,
7196
- Router: () => Router2,
7197
- ServerRequestHandler: () => ServerRequestHandler,
7198
- WebSocketManager: () => WebSocketManager,
7199
- appendAPIModule: () => appendAPIModule,
7200
- createLogProviderOptions: () => createLogProviderOptions,
7201
- createServerInterface: () => createServerInterface,
7202
- defineRoute: () => defineRoute2,
7203
- jsx: () => lib_exports,
7204
- jsx2HTML: () => jsx2HTML,
7205
- jwt: () => jwt,
7206
- middleware: () => middleware,
7207
- migration: () => lib_exports2
7208
- });
7209
- module.exports = __toCommonJS(lib_exports3);
8644
+ let currentNode = currentContext3.node;
8645
+ while (currentNode) {
8646
+ if (currentNode.type === "ContextProvider" && currentNode.contextKey === context.symbol) {
8647
+ return currentNode.contextValue;
8648
+ }
8649
+ currentNode = currentNode.parent;
8650
+ }
8651
+ throw new Error("cannot find provider!");
8652
+ }
8653
+ function createContextProvider(symbol, defaultValue) {
8654
+ function ContextProvider3({ value }, ...children) {
8655
+ useConditional("ContextProvider");
8656
+ const currentContext3 = useRenderContext();
8657
+ if (!currentContext3) {
8658
+ throw new Error("ContextProvider not in render");
8659
+ }
8660
+ return {
8661
+ type: "ContextProvider",
8662
+ contextKey: symbol,
8663
+ contextValue: value === void 0 ? defaultValue : value,
8664
+ children
8665
+ };
8666
+ }
8667
+ ContextProvider3.asFragment = true;
8668
+ ContextProvider3.shadowInit = false;
8669
+ return ContextProvider3;
8670
+ }
7210
8671
 
7211
8672
  // node_modules/@miqro/jsx/build/esm/lib.js
7212
- var lib_exports = {};
7213
- __export(lib_exports, {
7214
- Fragment: () => Fragment,
7215
- JSX: () => JSX,
7216
- Link: () => Link,
7217
- Router: () => Router,
7218
- createContainer: () => createContainer,
7219
- createContext: () => createContext,
7220
- createElement: () => createElement,
7221
- default: () => lib_default,
7222
- enableDebugLog: () => enableDebugLog,
7223
- isPathLocation: () => isPathLocation,
7224
- setDefaultOptions: () => setDefaultOptions,
7225
- useAllQuery: () => useAllQuery,
7226
- useConditional: () => useConditional,
7227
- useContext: () => useContext,
7228
- useEffect: () => useEffect,
7229
- useElement: () => useElement,
7230
- useIsLocationPathNameActive: () => useIsLocationPathNameActive,
7231
- usePathname: () => usePathname,
7232
- useQuery: () => useQuery,
7233
- useRef: () => useRef,
7234
- useRefresh: () => useRefresh,
7235
- useRuntime: () => useRuntime,
7236
- useState: () => useState
7237
- });
8673
+ var lib_default = JSX;
7238
8674
 
7239
- // node_modules/@miqro/jsx/build/esm/vdom/log.js
7240
- var debugLogEnabled = false;
7241
- function debug(runtime, message2, ...args) {
7242
- if (debugLogEnabled) {
8675
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/log.js
8676
+ var debugLogEnabled2 = false;
8677
+ function debug2(runtime, message2, ...args) {
8678
+ if (debugLogEnabled2) {
7243
8679
  runtime.consoleLog(message2, ...args);
7244
8680
  }
7245
8681
  }
7246
- function error(runtime, message2, ...args) {
8682
+ function error2(runtime, message2, ...args) {
7247
8683
  runtime.consoleError(message2, ...args);
7248
8684
  }
7249
- function enableDebugLog() {
7250
- debugLogEnabled = true;
7251
- }
7252
8685
 
7253
- // node_modules/@miqro/jsx/build/esm/vdom/actions.js
7254
- function createAppendAction(node, runtime) {
8686
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/actions.js
8687
+ function createAppendAction2(node, runtime) {
7255
8688
  return {
7256
8689
  isDestructive: true,
7257
8690
  execute: () => {
@@ -7259,12 +8692,12 @@ function createAppendAction(node, runtime) {
7259
8692
  const nodeRef = node.ref;
7260
8693
  let changes = 0;
7261
8694
  if (parent) {
7262
- debug(runtime, "%s.children.add(%s)", parent.getName(), node.getName());
8695
+ debug2(runtime, "%s.children.add(%s)", parent.getName(), node.getName());
7263
8696
  parent.children.add(node);
7264
8697
  if (nodeRef) {
7265
8698
  let currentParent = parent;
7266
8699
  if (currentParent.ref) {
7267
- debug(runtime, "%s.appendChild(%s)", currentParent.getName(), node.getName());
8700
+ debug2(runtime, "%s.appendChild(%s)", currentParent.getName(), node.getName());
7268
8701
  if (currentParent.state?.shadowRoot) {
7269
8702
  currentParent.state.shadowRoot.appendChild(nodeRef);
7270
8703
  } else {
@@ -7276,7 +8709,7 @@ function createAppendAction(node, runtime) {
7276
8709
  while (currentParent !== null) {
7277
8710
  currentParent = currentParent.parent;
7278
8711
  if (currentParent && currentParent.ref) {
7279
- debug(runtime, "%s.appendChild(%s)", currentParent.getName(), node.getName());
8712
+ debug2(runtime, "%s.appendChild(%s)", currentParent.getName(), node.getName());
7280
8713
  if (currentParent.state?.shadowRoot) {
7281
8714
  currentParent.state.shadowRoot.appendChild(nodeRef);
7282
8715
  } else {
@@ -7295,7 +8728,7 @@ function createAppendAction(node, runtime) {
7295
8728
  }
7296
8729
  };
7297
8730
  }
7298
- function createRemoveAttributesAction(node, toRemove, runtime) {
8731
+ function createRemoveAttributesAction2(node, toRemove, runtime) {
7299
8732
  return {
7300
8733
  execute: () => {
7301
8734
  const ref = node.ref;
@@ -7303,11 +8736,11 @@ function createRemoveAttributesAction(node, toRemove, runtime) {
7303
8736
  if (ref) {
7304
8737
  const element = ref;
7305
8738
  for (const name of toRemove) {
7306
- debug(runtime, "%s.removeAttribute(%s)", node.getName(), name);
8739
+ debug2(runtime, "%s.removeAttribute(%s)", node.getName(), name);
7307
8740
  element.removeAttribute(name);
7308
8741
  changes++;
7309
8742
  if (name === "checked") {
7310
- debug(runtime, "%s.%s=...", node.getName(), "checked");
8743
+ debug2(runtime, "%s.%s=...", node.getName(), "checked");
7311
8744
  element.checked = false;
7312
8745
  changes++;
7313
8746
  }
@@ -7317,7 +8750,7 @@ function createRemoveAttributesAction(node, toRemove, runtime) {
7317
8750
  }
7318
8751
  };
7319
8752
  }
7320
- function createSetAttributesAction(node, toSet, runtime) {
8753
+ function createSetAttributesAction2(node, toSet, runtime) {
7321
8754
  return {
7322
8755
  execute: () => {
7323
8756
  const ref = node.ref;
@@ -7328,15 +8761,15 @@ function createSetAttributesAction(node, toSet, runtime) {
7328
8761
  if (s.name === "className") {
7329
8762
  s.name = "class";
7330
8763
  }
7331
- debug(runtime, "%s.setAttribute(%s, ...)", node.getName(), s.name);
8764
+ debug2(runtime, "%s.setAttribute(%s, ...)", node.getName(), s.name);
7332
8765
  element.setAttribute(s.name, s.value);
7333
8766
  changes++;
7334
8767
  if (s.name === "value") {
7335
- debug(runtime, "%s.%s=...", node.getName(), s.name);
8768
+ debug2(runtime, "%s.%s=...", node.getName(), s.name);
7336
8769
  element.value = s.value;
7337
8770
  changes++;
7338
8771
  } else if (s.name === "checked") {
7339
- debug(runtime, "%s.%s=...", node.getName(), s.name);
8772
+ debug2(runtime, "%s.%s=...", node.getName(), s.name);
7340
8773
  element.checked = true;
7341
8774
  changes++;
7342
8775
  }
@@ -7346,51 +8779,51 @@ function createSetAttributesAction(node, toSet, runtime) {
7346
8779
  }
7347
8780
  };
7348
8781
  }
7349
- function createFlushEffects(node, options, runtime) {
8782
+ function createFlushEffects2(node, options, runtime) {
7350
8783
  return {
7351
8784
  postExecute: () => {
7352
8785
  const meta = node.state;
7353
8786
  const func = node.component;
7354
8787
  const changes = 0;
7355
8788
  if (func && meta) {
7356
- debug(runtime, "flush effects callbacks for [%s]", node.getName());
7357
- flushEffectCallbacks(meta.effectCallbacks, options.disableEffects, runtime);
7358
- debug(runtime, "flush effects for [%s]", node.getName());
7359
- flushEffects(meta.effects, meta.effectQueueCallbacks, options.disableEffects, runtime);
8789
+ debug2(runtime, "flush effects callbacks for [%s]", node.getName());
8790
+ flushEffectCallbacks2(meta.effectCallbacks, options.disableEffects, runtime);
8791
+ debug2(runtime, "flush effects for [%s]", node.getName());
8792
+ flushEffects2(meta.effects, meta.effectQueueCallbacks, options.disableEffects, runtime);
7360
8793
  }
7361
8794
  return changes;
7362
8795
  }
7363
8796
  };
7364
8797
  }
7365
- function createFlushEffectsRemove(node, options, runtime) {
8798
+ function createFlushEffectsRemove2(node, options, runtime) {
7366
8799
  return {
7367
8800
  execute: () => {
7368
8801
  const meta = node.state;
7369
8802
  const changes = 0;
7370
8803
  if (node.component && meta) {
7371
- debug(runtime, "flush effects callbacks for [%s]", node.getName());
7372
- flushEffectCallbacks(meta.effectCallbacks, options.disableEffects, runtime);
7373
- debug(runtime, "flush effects for [%s]", node.getName());
7374
- flushEffectCallbacks(meta.effectQueueCallbacks, options.disableEffects, runtime);
8804
+ debug2(runtime, "flush effects callbacks for [%s]", node.getName());
8805
+ flushEffectCallbacks2(meta.effectCallbacks, options.disableEffects, runtime);
8806
+ debug2(runtime, "flush effects for [%s]", node.getName());
8807
+ flushEffectCallbacks2(meta.effectQueueCallbacks, options.disableEffects, runtime);
7375
8808
  }
7376
8809
  return changes;
7377
8810
  }
7378
8811
  };
7379
8812
  }
7380
- function flushEffectCallbacks(callbacks, disableEffects, runtime) {
8813
+ function flushEffectCallbacks2(callbacks, disableEffects, runtime) {
7381
8814
  const keys = Object.keys(callbacks);
7382
8815
  for (const key of keys) {
7383
8816
  if (!disableEffects) {
7384
8817
  try {
7385
8818
  callbacks[key]();
7386
8819
  } catch (e) {
7387
- error(runtime, e);
8820
+ error2(runtime, e);
7388
8821
  }
7389
8822
  }
7390
8823
  delete callbacks[key];
7391
8824
  }
7392
8825
  }
7393
- function flushEffects(effects, callbacks, disableEffects, runtime) {
8826
+ function flushEffects2(effects, callbacks, disableEffects, runtime) {
7394
8827
  const keys = Object.keys(effects);
7395
8828
  for (const key of keys) {
7396
8829
  if (!disableEffects) {
@@ -7400,13 +8833,13 @@ function flushEffects(effects, callbacks, disableEffects, runtime) {
7400
8833
  callbacks[key] = callback;
7401
8834
  }
7402
8835
  } catch (e) {
7403
- error(runtime, e);
8836
+ error2(runtime, e);
7404
8837
  }
7405
8838
  }
7406
8839
  delete effects[key];
7407
8840
  }
7408
8841
  }
7409
- function createRemoveListeners(node, runtime) {
8842
+ function createRemoveListeners2(node, runtime) {
7410
8843
  return {
7411
8844
  execute: () => {
7412
8845
  const ref = node.ref;
@@ -7416,7 +8849,7 @@ function createRemoveListeners(node, runtime) {
7416
8849
  }
7417
8850
  const element = ref;
7418
8851
  for (const listener of node.currentEventListeners) {
7419
- debug(runtime, "%s.removeEventListener(%s, ...)", node.getName(), listener.eventName);
8852
+ debug2(runtime, "%s.removeEventListener(%s, ...)", node.getName(), listener.eventName);
7420
8853
  element.removeEventListener(listener.eventName, listener.listener);
7421
8854
  changes++;
7422
8855
  }
@@ -7425,7 +8858,7 @@ function createRemoveListeners(node, runtime) {
7425
8858
  }
7426
8859
  };
7427
8860
  }
7428
- function createUpdateListeners(node, listeners, runtime) {
8861
+ function createUpdateListeners2(node, listeners, runtime) {
7429
8862
  return {
7430
8863
  execute: () => {
7431
8864
  const ref = node.ref;
@@ -7435,13 +8868,13 @@ function createUpdateListeners(node, listeners, runtime) {
7435
8868
  }
7436
8869
  const element = ref;
7437
8870
  for (const listener of node.currentEventListeners) {
7438
- debug(runtime, "%s.removeEventListener(%s, ...)", node.getName(), listener.eventName);
8871
+ debug2(runtime, "%s.removeEventListener(%s, ...)", node.getName(), listener.eventName);
7439
8872
  element.removeEventListener(listener.eventName, listener.listener);
7440
8873
  changes++;
7441
8874
  }
7442
8875
  node.currentEventListeners = [];
7443
8876
  for (const listener of listeners) {
7444
- debug(runtime, "%s.addEventListener(%s, ...)", node.getName(), listener.eventName);
8877
+ debug2(runtime, "%s.addEventListener(%s, ...)", node.getName(), listener.eventName);
7445
8878
  element.addEventListener(listener.eventName, listener.listener);
7446
8879
  changes++;
7447
8880
  }
@@ -7450,7 +8883,7 @@ function createUpdateListeners(node, listeners, runtime) {
7450
8883
  }
7451
8884
  };
7452
8885
  }
7453
- function createNotifyRef(node, refListener, runtime) {
8886
+ function createNotifyRef2(node, refListener, runtime) {
7454
8887
  return {
7455
8888
  postExecute: () => {
7456
8889
  const ref = node.ref;
@@ -7458,20 +8891,20 @@ function createNotifyRef(node, refListener, runtime) {
7458
8891
  if (!ref) {
7459
8892
  throw new Error("cannot notify ref without a ref");
7460
8893
  }
7461
- debug(runtime, "calling ref [%s]", node.getName());
8894
+ debug2(runtime, "calling ref [%s]", node.getName());
7462
8895
  refListener(ref);
7463
8896
  return changes;
7464
8897
  }
7465
8898
  };
7466
8899
  }
7467
- function createRemoveNode(node, options, runtime) {
8900
+ function createRemoveNode2(node, options, runtime) {
7468
8901
  return {
7469
8902
  isDestructive: true,
7470
8903
  execute: () => {
7471
8904
  const meta = node.state;
7472
8905
  let changes = 0;
7473
8906
  if (node.component && meta) {
7474
- debug(runtime, "[%s].remove()", node.getName());
8907
+ debug2(runtime, "[%s].remove()", node.getName());
7475
8908
  }
7476
8909
  const parent = node.parent;
7477
8910
  if (!parent) {
@@ -7481,7 +8914,7 @@ function createRemoveNode(node, options, runtime) {
7481
8914
  const nodeRef = node.ref;
7482
8915
  if (nodeRef) {
7483
8916
  changes++;
7484
- debug(runtime, "%s.remove()", node.getName());
8917
+ debug2(runtime, "%s.remove()", node.getName());
7485
8918
  nodeRef.remove();
7486
8919
  }
7487
8920
  node.parent = null;
@@ -7489,13 +8922,13 @@ function createRemoveNode(node, options, runtime) {
7489
8922
  }
7490
8923
  };
7491
8924
  }
7492
- function createSetTextAction(node, textContent, runtime) {
8925
+ function createSetTextAction2(node, textContent, runtime) {
7493
8926
  return {
7494
8927
  execute: () => {
7495
8928
  const ref = node.ref;
7496
8929
  let changes = 0;
7497
8930
  if (ref) {
7498
- debug(runtime, "%s.textContent = ...", node.getName());
8931
+ debug2(runtime, "%s.textContent = ...", node.getName());
7499
8932
  ref.textContent = textContent ? textContent : "";
7500
8933
  node.textContent = textContent;
7501
8934
  changes++;
@@ -7504,7 +8937,7 @@ function createSetTextAction(node, textContent, runtime) {
7504
8937
  }
7505
8938
  };
7506
8939
  }
7507
- function createUpdateLastRenderArgs(node, options, runtime, props, children) {
8940
+ function createUpdateLastRenderArgs2(node, options, runtime, props, children) {
7508
8941
  return {
7509
8942
  postExecute: () => {
7510
8943
  node.lastRenderArgs = {
@@ -7515,13 +8948,13 @@ function createUpdateLastRenderArgs(node, options, runtime, props, children) {
7515
8948
  }
7516
8949
  };
7517
8950
  }
7518
- function createSetInnerHTMLAction(node, innerHTML, runtime) {
8951
+ function createSetInnerHTMLAction2(node, innerHTML, runtime) {
7519
8952
  return {
7520
8953
  execute: () => {
7521
8954
  const ref = node.ref;
7522
8955
  let changes = 0;
7523
8956
  if (ref) {
7524
- debug(runtime, "%s.innerHTML = ...", node.getName());
8957
+ debug2(runtime, "%s.innerHTML = ...", node.getName());
7525
8958
  if (innerHTML !== null && innerHTML !== void 0) {
7526
8959
  ref.innerHTML = String(innerHTML);
7527
8960
  changes++;
@@ -7533,16 +8966,8 @@ function createSetInnerHTMLAction(node, innerHTML, runtime) {
7533
8966
  };
7534
8967
  }
7535
8968
 
7536
- // node_modules/@miqro/jsx/build/esm/vdom/nodes/base-node.js
7537
- function setDefaultOptions(options) {
7538
- if (defaultOptionsFuse) {
7539
- throw new Error("cannot override default options once and before an element has been created!");
7540
- }
7541
- defaultOptionsFuse = true;
7542
- DEFAULT_OPTIONS = options;
7543
- Object.freeze(DEFAULT_OPTIONS);
7544
- }
7545
- var BaseNode = class {
8969
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/base-node.js
8970
+ var BaseNode2 = class {
7546
8971
  type;
7547
8972
  parent;
7548
8973
  children = /* @__PURE__ */ new Set();
@@ -7564,7 +8989,7 @@ var BaseNode = class {
7564
8989
  create(runtime, options, change, parent, list) {
7565
8990
  this.parent = parent;
7566
8991
  this.update(runtime, options, change, list, true);
7567
- list.push(createAppendAction(this, runtime));
8992
+ list.push(createAppendAction2(this, runtime));
7568
8993
  this.lastRenderArgs = {
7569
8994
  props: change.props,
7570
8995
  children: change.children
@@ -7584,9 +9009,9 @@ var BaseNode = class {
7584
9009
  }
7585
9010
  }
7586
9011
  if (this.state && this.component) {
7587
- list.push(createFlushEffectsRemove(this, options, runtime));
9012
+ list.push(createFlushEffectsRemove2(this, options, runtime));
7588
9013
  }
7589
- list.push(createRemoveNode(this, options, runtime));
9014
+ list.push(createRemoveNode2(this, options, runtime));
7590
9015
  return this;
7591
9016
  }
7592
9017
  calculateChildren(runtime, options, change, list) {
@@ -7601,10 +9026,10 @@ var BaseNode = class {
7601
9026
  }
7602
9027
  const ref = this.ref;
7603
9028
  const o = options ? {
7604
- ...getDefaultOptions(),
9029
+ ...getDefaultOptions2(),
7605
9030
  ...options ? options : {}
7606
9031
  } : {
7607
- ...getDefaultOptions()
9032
+ ...getDefaultOptions2()
7608
9033
  };
7609
9034
  const shadowInit = o.shadowInit;
7610
9035
  const renderAsFragment = o.asFragment;
@@ -7634,7 +9059,7 @@ var BaseNode = class {
7634
9059
  return this.state.abort;
7635
9060
  }
7636
9061
  };
7637
- var DEFAULT_OPTIONS = {
9062
+ var DEFAULT_OPTIONS2 = {
7638
9063
  /*shadowInit: {
7639
9064
  mode: "closed"
7640
9065
  },
@@ -7643,20 +9068,20 @@ var DEFAULT_OPTIONS = {
7643
9068
  shadowInit: false,
7644
9069
  asFragment: true
7645
9070
  };
7646
- var defaultOptionsFuse = false;
7647
- function getDefaultOptions() {
7648
- defaultOptionsFuse = true;
7649
- return DEFAULT_OPTIONS;
9071
+ var defaultOptionsFuse2 = false;
9072
+ function getDefaultOptions2() {
9073
+ defaultOptionsFuse2 = true;
9074
+ return DEFAULT_OPTIONS2;
7650
9075
  }
7651
9076
 
7652
- // node_modules/@miqro/jsx/build/esm/jsx.js
7653
- var Fragment = /* @__PURE__ */ Symbol("Fragment");
7654
- function createElement(tag2, attributes, ...children) {
9077
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/jsx.js
9078
+ var Fragment3 = /* @__PURE__ */ Symbol("Fragment");
9079
+ function createElement2(tag2, attributes, ...children) {
7655
9080
  if (!tag2) {
7656
9081
  throw new Error(`cannot call createElement with [${String(tag2)}] `);
7657
9082
  }
7658
- const isFragment = tag2 === Fragment;
7659
- const fAsFragment = typeof tag2 === "string" || isFragment ? getDefaultOptions().asFragment : tag2.asFragment !== void 0 ? tag2.asFragment : getDefaultOptions().asFragment;
9083
+ const isFragment = tag2 === Fragment3;
9084
+ const fAsFragment = typeof tag2 === "string" || isFragment ? getDefaultOptions2().asFragment : tag2.asFragment !== void 0 ? tag2.asFragment : getDefaultOptions2().asFragment;
7660
9085
  const tagName = typeof tag2 === "string" ? tag2 : isFragment ? "Fragment" : `${!tag2.name ? "no-name" : tag2.name}-component`.toLowerCase();
7661
9086
  return isFragment ? {
7662
9087
  type: "Fragment",
@@ -7674,39 +9099,39 @@ function createElement(tag2, attributes, ...children) {
7674
9099
  children
7675
9100
  };
7676
9101
  }
7677
- var JSX = /* @__PURE__ */ Object.create(null);
7678
- var objectDefineProperty = Object.defineProperty;
7679
- objectDefineProperty(JSX, "createElement", {
9102
+ var JSX2 = /* @__PURE__ */ Object.create(null);
9103
+ var objectDefineProperty3 = Object.defineProperty;
9104
+ objectDefineProperty3(JSX2, "createElement", {
7680
9105
  configurable: false,
7681
9106
  enumerable: true,
7682
9107
  writable: false,
7683
- value: createElement
9108
+ value: createElement2
7684
9109
  });
7685
- objectDefineProperty(JSX, "jsxFactory", {
9110
+ objectDefineProperty3(JSX2, "jsxFactory", {
7686
9111
  configurable: false,
7687
9112
  enumerable: true,
7688
9113
  writable: false,
7689
- value: createElement
9114
+ value: createElement2
7690
9115
  });
7691
- objectDefineProperty(JSX, "Fragment", {
9116
+ objectDefineProperty3(JSX2, "Fragment", {
7692
9117
  configurable: false,
7693
9118
  enumerable: true,
7694
9119
  writable: false,
7695
- value: Fragment
9120
+ value: Fragment3
7696
9121
  });
7697
- objectDefineProperty(JSX, "jsxFragmentFactory", {
9122
+ objectDefineProperty3(JSX2, "jsxFragmentFactory", {
7698
9123
  configurable: false,
7699
9124
  enumerable: true,
7700
9125
  writable: false,
7701
- value: Fragment
9126
+ value: Fragment3
7702
9127
  });
7703
- Object.freeze(JSX);
9128
+ Object.freeze(JSX2);
7704
9129
 
7705
- // node_modules/@miqro/jsx/build/esm/vdom/types.js
7706
- var CHANGE_TYPES_SET = /* @__PURE__ */ new Set(["FragmentComponent", "Component", "Element", "Ref", "Fragment", "ContextProvider"]);
9130
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/types.js
9131
+ var CHANGE_TYPES_SET2 = /* @__PURE__ */ new Set(["FragmentComponent", "Component", "Element", "Ref", "Fragment", "ContextProvider"]);
7707
9132
 
7708
- // node_modules/@miqro/jsx/build/esm/vdom/nodes/context-provider.js
7709
- var ContextProvider = class extends BaseNode {
9133
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/context-provider.js
9134
+ var ContextProvider2 = class extends BaseNode2 {
7710
9135
  constructor(parent) {
7711
9136
  super("ContextProvider", parent);
7712
9137
  }
@@ -7719,7 +9144,7 @@ var ContextProvider = class extends BaseNode {
7719
9144
  this.parent = parent;
7720
9145
  const children = this.calculateChildren(runtime, options, change, list);
7721
9146
  for (const child of children) {
7722
- createNewNodeFromChange(runtime, options, normalizeChild(runtime, child), this, list);
9147
+ createNewNodeFromChange2(runtime, options, normalizeChild2(runtime, child), this, list);
7723
9148
  }
7724
9149
  return super.create(runtime, options, change, parent, list);
7725
9150
  }
@@ -7729,8 +9154,8 @@ var ContextProvider = class extends BaseNode {
7729
9154
  }
7730
9155
  };
7731
9156
 
7732
- // node_modules/@miqro/jsx/build/esm/vdom/nodes/fragment.js
7733
- var Fragment2 = class extends BaseNode {
9157
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/fragment.js
9158
+ var Fragment4 = class extends BaseNode2 {
7734
9159
  constructor(parent) {
7735
9160
  super("Fragment", parent);
7736
9161
  }
@@ -7738,25 +9163,25 @@ var Fragment2 = class extends BaseNode {
7738
9163
  this.parent = parent;
7739
9164
  const children = this.calculateChildren(runtime, options, change, list);
7740
9165
  for (const child of children) {
7741
- createNewNodeFromChange(runtime, options, normalizeChild(runtime, child), this, list);
9166
+ createNewNodeFromChange2(runtime, options, normalizeChild2(runtime, child), this, list);
7742
9167
  }
7743
9168
  super.create(runtime, options, change, parent, list);
7744
9169
  return this;
7745
9170
  }
7746
9171
  };
7747
9172
 
7748
- // node_modules/@miqro/jsx/build/esm/component/render.js
7749
- var currentContext = null;
7750
- function useConditional(name) {
7751
- return pushContextCall(currentContext, name);
9173
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/component/render.js
9174
+ var currentContext2 = null;
9175
+ function useConditional2(name) {
9176
+ return pushContextCall2(currentContext2, name);
7752
9177
  }
7753
- function useRenderContext() {
7754
- if (!currentContext) {
9178
+ function useRenderContext2() {
9179
+ if (!currentContext2) {
7755
9180
  throw new Error("useContext not in render");
7756
9181
  }
7757
- return currentContext;
9182
+ return currentContext2;
7758
9183
  }
7759
- function renderComponent(runtime, component, options, list, props, children) {
9184
+ function renderComponent2(runtime, component, options, list, props, children) {
7760
9185
  try {
7761
9186
  const meta = component.state;
7762
9187
  const func = component.component;
@@ -7772,11 +9197,11 @@ function renderComponent(runtime, component, options, list, props, children) {
7772
9197
  options,
7773
9198
  runtime
7774
9199
  };
7775
- list.push(createUpdateLastRenderArgs(component, options, runtime, props, children));
7776
- currentContext = null;
7777
- currentContext = context;
9200
+ list.push(createUpdateLastRenderArgs2(component, options, runtime, props, children));
9201
+ currentContext2 = null;
9202
+ currentContext2 = context;
7778
9203
  const output = func(props, children);
7779
- currentContext = null;
9204
+ currentContext2 = null;
7780
9205
  if (meta.lastContextCalls && meta.lastContextCalls.length !== context.calls.length) {
7781
9206
  meta.conditionalUseDetected = true;
7782
9207
  throw new Error("conditional this.use calls detected(3)!");
@@ -7784,11 +9209,11 @@ function renderComponent(runtime, component, options, list, props, children) {
7784
9209
  meta.lastContextCalls = context.calls;
7785
9210
  return [output];
7786
9211
  } catch (e) {
7787
- currentContext = null;
9212
+ currentContext2 = null;
7788
9213
  throw e;
7789
9214
  }
7790
9215
  }
7791
- function pushContextCall(context, name) {
9216
+ function pushContextCall2(context, name) {
7792
9217
  if (!context) {
7793
9218
  throw new Error("not in render(7)");
7794
9219
  }
@@ -7816,8 +9241,8 @@ function pushContextCall(context, name) {
7816
9241
  return key;
7817
9242
  }
7818
9243
 
7819
- // node_modules/@miqro/jsx/build/esm/vdom/nodes/component-fragment.js
7820
- var FragmentComponent = class extends Fragment2 {
9244
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/component-fragment.js
9245
+ var FragmentComponent2 = class extends Fragment4 {
7821
9246
  constructor(parent) {
7822
9247
  super(parent);
7823
9248
  this.type = "FragmentComponent";
@@ -7843,8 +9268,8 @@ var FragmentComponent = class extends Fragment2 {
7843
9268
  }
7844
9269
  calculateChildren(runtime, options, change, list) {
7845
9270
  if (this.component && this.state) {
7846
- list.push(createFlushEffects(this, options, runtime));
7847
- const out = renderComponent(runtime, this, options, list, change.props, change.children);
9271
+ list.push(createFlushEffects2(this, options, runtime));
9272
+ const out = renderComponent2(runtime, this, options, list, change.props, change.children);
7848
9273
  return out ? out : [];
7849
9274
  } else {
7850
9275
  return change.children ? change.children : [];
@@ -7852,14 +9277,14 @@ var FragmentComponent = class extends Fragment2 {
7852
9277
  }
7853
9278
  };
7854
9279
 
7855
- // node_modules/@miqro/jsx/build/esm/vdom/nodes/element.js
7856
- var ATTRIBUTES_WITHOUT_VALUE = /* @__PURE__ */ new Set([
9280
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/element.js
9281
+ var ATTRIBUTES_WITHOUT_VALUE2 = /* @__PURE__ */ new Set([
7857
9282
  "disabled",
7858
9283
  "checked",
7859
9284
  "selected",
7860
9285
  "hidden"
7861
9286
  ]);
7862
- var Element = class extends BaseNode {
9287
+ var Element2 = class extends BaseNode2 {
7863
9288
  constructor(parent) {
7864
9289
  super("Element", parent);
7865
9290
  }
@@ -7872,7 +9297,7 @@ var Element = class extends BaseNode {
7872
9297
  this.parent = parent;
7873
9298
  const children = this.calculateChildren(runtime, options, change, list);
7874
9299
  for (const child of children) {
7875
- createNewNodeFromChange(runtime, options, normalizeChild(runtime, child), this, list);
9300
+ createNewNodeFromChange2(runtime, options, normalizeChild2(runtime, child), this, list);
7876
9301
  }
7877
9302
  return super.create(runtime, options, change, parent, list);
7878
9303
  }
@@ -7925,7 +9350,7 @@ var Element = class extends BaseNode {
7925
9350
  const attributeName = changePropName === "className" ? "class" : changePropName;
7926
9351
  currentAttributeNames.delete(attributeName);
7927
9352
  const currentAttributeValue = attributeName === "value" ? element.value : attributeName === "checked" ? element.checked : element.getAttribute(attributeName);
7928
- if (typeof changePropValue === "boolean" && ATTRIBUTES_WITHOUT_VALUE.has(attributeName)) {
9353
+ if (typeof changePropValue === "boolean" && ATTRIBUTES_WITHOUT_VALUE2.has(attributeName)) {
7929
9354
  if (attributeName === "checked") {
7930
9355
  if (changePropValue) {
7931
9356
  attributesSet.push({
@@ -7962,29 +9387,29 @@ var Element = class extends BaseNode {
7962
9387
  }
7963
9388
  }
7964
9389
  if (this.currentEventListeners.length > 0) {
7965
- list.push(createRemoveListeners(this, runtime));
9390
+ list.push(createRemoveListeners2(this, runtime));
7966
9391
  }
7967
9392
  if (attributesRemove.length > 0) {
7968
- list.push(createRemoveAttributesAction(this, attributesRemove, runtime));
9393
+ list.push(createRemoveAttributesAction2(this, attributesRemove, runtime));
7969
9394
  }
7970
9395
  if (attributesSet.length > 0) {
7971
- list.push(createSetAttributesAction(this, attributesSet, runtime));
9396
+ list.push(createSetAttributesAction2(this, attributesSet, runtime));
7972
9397
  }
7973
9398
  if (listenerChanges.length > 0) {
7974
- list.push(createUpdateListeners(this, listenerChanges, runtime));
9399
+ list.push(createUpdateListeners2(this, listenerChanges, runtime));
7975
9400
  }
7976
9401
  if (refListener !== null) {
7977
- list.push(createNotifyRef(this, refListener, runtime));
9402
+ list.push(createNotifyRef2(this, refListener, runtime));
7978
9403
  }
7979
9404
  if (setInnerHTMLFlag) {
7980
- list.push(createSetInnerHTMLAction(this, setInnerHTML, runtime));
9405
+ list.push(createSetInnerHTMLAction2(this, setInnerHTML, runtime));
7981
9406
  }
7982
9407
  return super.update(runtime, options, change, list);
7983
9408
  }
7984
9409
  };
7985
-
7986
- // node_modules/@miqro/jsx/build/esm/vdom/nodes/component.js
7987
- var Component = class extends Element {
9410
+
9411
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/component.js
9412
+ var Component2 = class extends Element2 {
7988
9413
  constructor(parent) {
7989
9414
  super(parent);
7990
9415
  this.type = "Component";
@@ -8012,11 +9437,11 @@ var Component = class extends Element {
8012
9437
  this.parent = parent;
8013
9438
  const children = this.calculateChildren(runtime, options, change, list);
8014
9439
  for (const child of children) {
8015
- createNewNodeFromChange(runtime, options, normalizeChild(runtime, child), this, list);
9440
+ createNewNodeFromChange2(runtime, options, normalizeChild2(runtime, child), this, list);
8016
9441
  }
8017
9442
  this.parent = parent;
8018
9443
  this.update(runtime, options, change, list, true);
8019
- list.push(createAppendAction(this, runtime));
9444
+ list.push(createAppendAction2(this, runtime));
8020
9445
  this.lastRenderArgs = {
8021
9446
  props: change.props,
8022
9447
  children: change.children
@@ -8025,8 +9450,8 @@ var Component = class extends Element {
8025
9450
  }
8026
9451
  calculateChildren(runtime, options, change, list) {
8027
9452
  if (this.component && this.state) {
8028
- list.push(createFlushEffects(this, options, runtime));
8029
- const out = renderComponent(runtime, this, options, list, change.props, change.children);
9453
+ list.push(createFlushEffects2(this, options, runtime));
9454
+ const out = renderComponent2(runtime, this, options, list, change.props, change.children);
8030
9455
  return out ? out : [];
8031
9456
  } else {
8032
9457
  return super.calculateChildren(runtime, options, change, list);
@@ -8034,8 +9459,8 @@ var Component = class extends Element {
8034
9459
  }
8035
9460
  };
8036
9461
 
8037
- // node_modules/@miqro/jsx/build/esm/vdom/nodes/ref.js
8038
- var Ref = class extends BaseNode {
9462
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/ref.js
9463
+ var Ref2 = class extends BaseNode2 {
8039
9464
  constructor(parent) {
8040
9465
  super("Ref", parent);
8041
9466
  }
@@ -8045,7 +9470,7 @@ var Ref = class extends BaseNode {
8045
9470
  }
8046
9471
  this.ref = change.ref;
8047
9472
  this.parent = parent;
8048
- list.push(createAppendAction(this, runtime));
9473
+ list.push(createAppendAction2(this, runtime));
8049
9474
  return this;
8050
9475
  }
8051
9476
  compare(change) {
@@ -8053,8 +9478,8 @@ var Ref = class extends BaseNode {
8053
9478
  }
8054
9479
  };
8055
9480
 
8056
- // node_modules/@miqro/jsx/build/esm/vdom/nodes/text.js
8057
- var Text = class extends BaseNode {
9481
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/text.js
9482
+ var Text2 = class extends BaseNode2 {
8058
9483
  constructor(parent) {
8059
9484
  super("Text", parent);
8060
9485
  }
@@ -8065,19 +9490,19 @@ var Text = class extends BaseNode {
8065
9490
  this.ref = runtime.createTextNode(change.textContent);
8066
9491
  this.textContent = change.textContent;
8067
9492
  this.parent = parent;
8068
- list.push(createAppendAction(this, runtime));
9493
+ list.push(createAppendAction2(this, runtime));
8069
9494
  return this;
8070
9495
  }
8071
9496
  update(runtime, options, change, list, initial) {
8072
9497
  if (this.textContent !== change.textContent) {
8073
- list.push(createSetTextAction(this, change.textContent, runtime));
9498
+ list.push(createSetTextAction2(this, change.textContent, runtime));
8074
9499
  }
8075
9500
  return this;
8076
9501
  }
8077
9502
  };
8078
9503
 
8079
- // node_modules/@miqro/jsx/build/esm/vdom/tree.js
8080
- var Tree = class extends BaseNode {
9504
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/tree.js
9505
+ var Tree2 = class extends BaseNode2 {
8081
9506
  name;
8082
9507
  constructor(name, ref, runtime, shadowInit) {
8083
9508
  super("Fragment", null);
@@ -8094,27 +9519,27 @@ var Tree = class extends BaseNode {
8094
9519
  return this.name;
8095
9520
  }
8096
9521
  };
8097
- function createNewNodeFromChange(runtime, options, change, parent, list) {
9522
+ function createNewNodeFromChange2(runtime, options, change, parent, list) {
8098
9523
  switch (change.type) {
8099
9524
  case "ContextProvider":
8100
- return new ContextProvider(parent).create(runtime, options, change, parent, list);
9525
+ return new ContextProvider2(parent).create(runtime, options, change, parent, list);
8101
9526
  case "Element":
8102
- return new Element(parent).create(runtime, options, change, parent, list);
9527
+ return new Element2(parent).create(runtime, options, change, parent, list);
8103
9528
  case "Component":
8104
- return new Component(parent).create(runtime, options, change, parent, list);
9529
+ return new Component2(parent).create(runtime, options, change, parent, list);
8105
9530
  case "Ref":
8106
- return new Ref(parent).create(runtime, options, change, parent, list);
9531
+ return new Ref2(parent).create(runtime, options, change, parent, list);
8107
9532
  case "Text":
8108
- return new Text(parent).create(runtime, options, change, parent, list);
9533
+ return new Text2(parent).create(runtime, options, change, parent, list);
8109
9534
  case "Fragment":
8110
- return new Fragment2(parent).create(runtime, options, change, parent, list);
9535
+ return new Fragment4(parent).create(runtime, options, change, parent, list);
8111
9536
  case "FragmentComponent":
8112
- return new FragmentComponent(parent).create(runtime, options, change, parent, list);
9537
+ return new FragmentComponent2(parent).create(runtime, options, change, parent, list);
8113
9538
  default:
8114
9539
  throw new Error(`unsopported change.type = %${change.type}`);
8115
9540
  }
8116
9541
  }
8117
- function normalizeChild(runtime, c) {
9542
+ function normalizeChild2(runtime, c) {
8118
9543
  if (typeof c === "object") {
8119
9544
  if (c instanceof Array) {
8120
9545
  return {
@@ -8126,7 +9551,7 @@ function normalizeChild(runtime, c) {
8126
9551
  type: "Ref",
8127
9552
  ref: c
8128
9553
  };
8129
- } else if (c && CHANGE_TYPES_SET.has(c.type)) {
9554
+ } else if (c && CHANGE_TYPES_SET2.has(c.type)) {
8130
9555
  return c;
8131
9556
  }
8132
9557
  }
@@ -8136,48 +9561,48 @@ function normalizeChild(runtime, c) {
8136
9561
  };
8137
9562
  }
8138
9563
 
8139
- // node_modules/@miqro/jsx/build/esm/vdom/diff.js
8140
- function diff(abortSignal, tree, changes, actions, options, runtime, lo = false) {
9564
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/diff.js
9565
+ function diff2(abortSignal, tree, changes, actions, options, runtime, lo = false) {
8141
9566
  if (changes === void 0 || changes === null || abortSignal.aborted) {
8142
9567
  return actions;
8143
9568
  }
8144
9569
  const currentChildren = tree.children.values();
8145
9570
  let currentChildrenRet = currentChildren.next();
8146
9571
  for (const change of changes) {
8147
- const normalizedChange = normalizeChild(runtime, change);
9572
+ const normalizedChange = normalizeChild2(runtime, change);
8148
9573
  const actualChild = currentChildrenRet.value;
8149
9574
  if (actualChild === void 0) {
8150
- createNewNodeFromChange(runtime, options, normalizedChange, tree, actions);
9575
+ createNewNodeFromChange2(runtime, options, normalizedChange, tree, actions);
8151
9576
  } else if (!actualChild.compare(normalizedChange)) {
8152
- currentChildrenRet = removeFrom(runtime, currentChildren, currentChildrenRet, actions, options);
8153
- createNewNodeFromChange(runtime, options, normalizedChange, tree, actions);
9577
+ currentChildrenRet = removeFrom2(runtime, currentChildren, currentChildrenRet, actions, options);
9578
+ createNewNodeFromChange2(runtime, options, normalizedChange, tree, actions);
8154
9579
  } else {
8155
9580
  actualChild.update(runtime, options, normalizedChange, actions);
8156
9581
  if (actualChild.type === "Fragment" || actualChild.type === "FragmentComponent" || actualChild.type === "ContextProvider") {
8157
9582
  const fragmentActions = [];
8158
- diff(abortSignal, actualChild, actualChild.calculateChildren(runtime, options, normalizedChange, fragmentActions), fragmentActions, options, runtime, true);
8159
- if (areActionDestructive(fragmentActions)) {
9583
+ diff2(abortSignal, actualChild, actualChild.calculateChildren(runtime, options, normalizedChange, fragmentActions), fragmentActions, options, runtime, true);
9584
+ if (areActionDestructive2(fragmentActions)) {
8160
9585
  currentChildrenRet = currentChildren.next();
8161
- currentChildrenRet = removeFrom(runtime, currentChildren, currentChildrenRet, actions, options);
9586
+ currentChildrenRet = removeFrom2(runtime, currentChildren, currentChildrenRet, actions, options);
8162
9587
  }
8163
9588
  actions.push(...fragmentActions);
8164
9589
  } else {
8165
- diff(abortSignal, actualChild, actualChild.calculateChildren(runtime, options, normalizedChange, actions), actions, options, runtime);
9590
+ diff2(abortSignal, actualChild, actualChild.calculateChildren(runtime, options, normalizedChange, actions), actions, options, runtime);
8166
9591
  }
8167
9592
  }
8168
9593
  currentChildrenRet = currentChildren.next();
8169
9594
  }
8170
- currentChildrenRet = removeFrom(runtime, currentChildren, currentChildrenRet, actions, options);
9595
+ currentChildrenRet = removeFrom2(runtime, currentChildren, currentChildrenRet, actions, options);
8171
9596
  return actions;
8172
9597
  }
8173
- function removeFrom(runtime, nodeIterator, nodeIteratorRet, currentActions, options) {
9598
+ function removeFrom2(runtime, nodeIterator, nodeIteratorRet, currentActions, options) {
8174
9599
  while (nodeIteratorRet.value !== void 0) {
8175
9600
  nodeIteratorRet.value.remove(runtime, options, currentActions);
8176
9601
  nodeIteratorRet = nodeIterator.next();
8177
9602
  }
8178
9603
  return nodeIteratorRet;
8179
9604
  }
8180
- function areActionDestructive(actions) {
9605
+ function areActionDestructive2(actions) {
8181
9606
  for (const fragmentAction of actions) {
8182
9607
  if (fragmentAction.isDestructive) {
8183
9608
  return true;
@@ -8186,8 +9611,8 @@ function areActionDestructive(actions) {
8186
9611
  return false;
8187
9612
  }
8188
9613
 
8189
- // node_modules/@miqro/jsx/build/esm/vdom/execute.js
8190
- function execute(abortSignal, runtime, actions) {
9614
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/execute.js
9615
+ function execute2(abortSignal, runtime, actions) {
8191
9616
  if (abortSignal.aborted) {
8192
9617
  return 0;
8193
9618
  }
@@ -8203,7 +9628,7 @@ function execute(abortSignal, runtime, actions) {
8203
9628
  postExecute.push(action);
8204
9629
  }
8205
9630
  } catch (e) {
8206
- error(runtime, e);
9631
+ error2(runtime, e);
8207
9632
  throw e;
8208
9633
  }
8209
9634
  }
@@ -8212,43 +9637,43 @@ function execute(abortSignal, runtime, actions) {
8212
9637
  const actionChanges = action.postExecute();
8213
9638
  changes += actionChanges;
8214
9639
  } catch (e) {
8215
- error(runtime, e);
9640
+ error2(runtime, e);
8216
9641
  throw e;
8217
9642
  }
8218
9643
  }
8219
9644
  return changes;
8220
9645
  }
8221
9646
 
8222
- // node_modules/@miqro/jsx/build/esm/vdom/render.js
8223
- function render(runtime, tree, treeOptions, change, preActions = [], props, children) {
9647
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/render.js
9648
+ function render2(runtime, tree, treeOptions, change, preActions = [], props, children) {
8224
9649
  const meta = tree.state;
8225
9650
  if (!meta) {
8226
9651
  throw new Error("cannot find meta");
8227
9652
  }
8228
9653
  const abortSignal = tree.abortApply(runtime).signal;
8229
- debug(runtime, "render for [%s]", tree.getName());
9654
+ debug2(runtime, "render for [%s]", tree.getName());
8230
9655
  if (tree.isRoot || tree.parent !== null) {
8231
9656
  const applyStart = Date.now();
8232
- const out = change instanceof Array ? change : change === true ? renderComponent(runtime, tree, treeOptions, preActions, props, children) : void 0;
8233
- const changes = execute(abortSignal, runtime, diff(abortSignal, tree, out, preActions, treeOptions, runtime));
9657
+ const out = change instanceof Array ? change : change === true ? renderComponent2(runtime, tree, treeOptions, preActions, props, children) : void 0;
9658
+ const changes = execute2(abortSignal, runtime, diff2(abortSignal, tree, out, preActions, treeOptions, runtime));
8234
9659
  const took = Date.now() - applyStart;
8235
9660
  if (took > 5e3) {
8236
- error(runtime, "render for [%s] with [%s] changes took [%s]ms", tree.getName(), changes, took);
9661
+ error2(runtime, "render for [%s] with [%s] changes took [%s]ms", tree.getName(), changes, took);
8237
9662
  } else {
8238
- debug(runtime, "render for [%s] with [%s] changes took [%s]ms", tree.getName(), changes, took);
9663
+ debug2(runtime, "render for [%s] with [%s] changes took [%s]ms", tree.getName(), changes, took);
8239
9664
  }
8240
9665
  return changes;
8241
9666
  } else {
8242
- debug(runtime, "render skipped for [%s]", tree.getName());
9667
+ debug2(runtime, "render skipped for [%s]", tree.getName());
8243
9668
  return 0;
8244
9669
  }
8245
9670
  }
8246
9671
 
8247
- // node_modules/@miqro/jsx/build/esm/component/container.js
8248
- var objectDefineProperty2 = Object.defineProperty;
8249
- function createContainer(element, runtime, args) {
9672
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/component/container.js
9673
+ var objectDefineProperty4 = Object.defineProperty;
9674
+ function createContainer2(element, runtime, args) {
8250
9675
  const name = `DOMContainer [${String(element)}]`;
8251
- const tree = new Tree(name, element, runtime, args?.shadowInit);
9676
+ const tree = new Tree2(name, element, runtime, args?.shadowInit);
8252
9677
  const treeOptions = args && args.runtimeOptions ? {
8253
9678
  disableEffects: false,
8254
9679
  disableRefListener: false,
@@ -8262,57 +9687,57 @@ function createContainer(element, runtime, args) {
8262
9687
  disableEvents: false
8263
9688
  };
8264
9689
  const container = /* @__PURE__ */ Object.create(null);
8265
- objectDefineProperty2(container, "name", {
9690
+ objectDefineProperty4(container, "name", {
8266
9691
  configurable: false,
8267
9692
  enumerable: true,
8268
9693
  writable: false,
8269
9694
  value: name
8270
9695
  });
8271
- objectDefineProperty2(container, "render", {
9696
+ objectDefineProperty4(container, "render", {
8272
9697
  configurable: false,
8273
9698
  enumerable: true,
8274
9699
  writable: false,
8275
- value: function render2(out) {
8276
- return render(runtime, tree, treeOptions, [out]);
9700
+ value: function render3(out) {
9701
+ return render2(runtime, tree, treeOptions, [out]);
8277
9702
  }
8278
9703
  });
8279
- objectDefineProperty2(container, "disconnect", {
9704
+ objectDefineProperty4(container, "disconnect", {
8280
9705
  configurable: false,
8281
9706
  enumerable: true,
8282
9707
  writable: false,
8283
9708
  value: function disconnect() {
8284
- return render(runtime, tree, treeOptions, []);
9709
+ return render2(runtime, tree, treeOptions, []);
8285
9710
  }
8286
9711
  });
8287
9712
  Object.freeze(container);
8288
9713
  return container;
8289
9714
  }
8290
9715
 
8291
- // node_modules/@miqro/jsx/build/esm/hooks/runtime.js
8292
- function useRuntime() {
8293
- useConditional("useRuntime");
8294
- const currentContext2 = useRenderContext();
8295
- if (!currentContext2) {
9716
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/hooks/runtime.js
9717
+ function useRuntime2() {
9718
+ useConditional2("useRuntime");
9719
+ const currentContext3 = useRenderContext2();
9720
+ if (!currentContext3) {
8296
9721
  throw new Error("useRuntime not in render");
8297
9722
  }
8298
- return currentContext2.runtime;
9723
+ return currentContext3.runtime;
8299
9724
  }
8300
9725
 
8301
- // node_modules/@miqro/jsx/build/esm/hooks/refresh.js
8302
- var REFRESH_TIMEOUT_MS = 0;
8303
- function useRefresh() {
8304
- useConditional("useRefresh");
8305
- const currentContext2 = useRenderContext();
8306
- if (!currentContext2) {
9726
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/hooks/refresh.js
9727
+ var REFRESH_TIMEOUT_MS2 = 0;
9728
+ function useRefresh2() {
9729
+ useConditional2("useRefresh");
9730
+ const currentContext3 = useRenderContext2();
9731
+ if (!currentContext3) {
8307
9732
  throw new Error("useRefresh not in render");
8308
9733
  }
8309
- const meta = currentContext2.node.state;
9734
+ const meta = currentContext3.node.state;
8310
9735
  if (!meta) {
8311
9736
  throw new Error("useRefresh without meta");
8312
9737
  }
8313
- const runtime = useRuntime();
8314
- const options = currentContext2.options;
8315
- const node = currentContext2.node;
9738
+ const runtime = useRuntime2();
9739
+ const options = currentContext3.options;
9740
+ const node = currentContext3.node;
8316
9741
  const component = node.component;
8317
9742
  if (!component) {
8318
9743
  throw new Error("useRefresh without func");
@@ -8320,31 +9745,31 @@ function useRefresh() {
8320
9745
  return (cb) => {
8321
9746
  runtime.clearTimeout(meta.refreshTimeout);
8322
9747
  if (options.disableRefresh) {
8323
- debug(runtime, "useRefresh.refresh() disabled for [%s]", component.name);
9748
+ debug2(runtime, "useRefresh.refresh() disabled for [%s]", component.name);
8324
9749
  } else {
8325
9750
  meta.refreshTimeout = runtime.setTimeout(() => {
8326
- debug(runtime, "useRefresh.refresh() for [%s]", component.name);
9751
+ debug2(runtime, "useRefresh.refresh() for [%s]", component.name);
8327
9752
  const props = node.lastRenderArgs.props;
8328
9753
  const children = node.lastRenderArgs.children;
8329
- const changes = render(runtime, node, options, true, [createFlushEffects(node, options, runtime)], props, children);
9754
+ const changes = render2(runtime, node, options, true, [createFlushEffects2(node, options, runtime)], props, children);
8330
9755
  if (cb) {
8331
9756
  runtime.setTimeout(() => cb(changes), 0);
8332
9757
  }
8333
- }, REFRESH_TIMEOUT_MS);
9758
+ }, REFRESH_TIMEOUT_MS2);
8334
9759
  }
8335
9760
  };
8336
9761
  }
8337
9762
 
8338
- // node_modules/@miqro/jsx/build/esm/hooks/state.js
8339
- function useState(defaultValue) {
8340
- const key = useConditional("useState");
8341
- const currentContext2 = useRenderContext();
8342
- if (!currentContext2) {
9763
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/hooks/state.js
9764
+ function useState2(defaultValue) {
9765
+ const key = useConditional2("useState");
9766
+ const currentContext3 = useRenderContext2();
9767
+ if (!currentContext3) {
8343
9768
  throw new Error("useState not in render");
8344
9769
  }
8345
- const refresh = useRefresh();
8346
- const meta = currentContext2.node.state;
8347
- const runtime = useRuntime();
9770
+ const refresh = useRefresh2();
9771
+ const meta = currentContext3.node.state;
9772
+ const runtime = useRuntime2();
8348
9773
  if (!meta) {
8349
9774
  throw new Error("useState without meta");
8350
9775
  }
@@ -8354,13 +9779,13 @@ function useState(defaultValue) {
8354
9779
  if (!meta.state) {
8355
9780
  throw new Error("useState without meta.state");
8356
9781
  }
8357
- const name = currentContext2.node.component?.name;
9782
+ const name = currentContext3.node.component?.name;
8358
9783
  const currentStateItem = meta.state[key];
8359
9784
  if (currentStateItem === void 0) {
8360
9785
  const stateItem = {
8361
9786
  value: defaultValue,
8362
9787
  set: (newValue, refreshOnSet = true) => {
8363
- debug(runtime, "setState() for [%s]", name);
9788
+ debug2(runtime, "setState() for [%s]", name);
8364
9789
  if (stateItem.value !== newValue) {
8365
9790
  stateItem.value = newValue;
8366
9791
  if (refreshOnSet) {
@@ -8387,19 +9812,19 @@ function useState(defaultValue) {
8387
9812
  }
8388
9813
  }
8389
9814
 
8390
- // node_modules/@miqro/jsx/build/esm/hooks/effect.js
8391
- function useEffect(effect, condition) {
8392
- const currentContext2 = useRenderContext();
8393
- if (!currentContext2) {
9815
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/hooks/effect.js
9816
+ function useEffect2(effect, condition) {
9817
+ const currentContext3 = useRenderContext2();
9818
+ if (!currentContext3) {
8394
9819
  throw new Error("useEffect not in render");
8395
9820
  }
8396
- const key = useConditional("useEffect");
8397
- const meta = currentContext2.node.state;
9821
+ const key = useConditional2("useEffect");
9822
+ const meta = currentContext3.node.state;
8398
9823
  if (!meta) {
8399
9824
  throw new Error("useEffect without meta");
8400
9825
  }
8401
9826
  const c = condition ? condition : false;
8402
- if (meta.effectConditions[key] === void 0 || condition === void 0 && meta.effectConditions[key] === false || !equalArray(meta.effectConditions[key], c)) {
9827
+ if (meta.effectConditions[key] === void 0 || condition === void 0 && meta.effectConditions[key] === false || !equalArray2(meta.effectConditions[key], c)) {
8403
9828
  meta.effectConditions[key] = c;
8404
9829
  const oldCallback = meta.effectQueueCallbacks[key];
8405
9830
  delete meta.effectQueueCallbacks[key];
@@ -8413,7 +9838,7 @@ function useEffect(effect, condition) {
8413
9838
  meta.effects[key] = effect;
8414
9839
  }
8415
9840
  }
8416
- function equalArray(a, c) {
9841
+ function equalArray2(a, c) {
8417
9842
  if (typeof a !== typeof c) {
8418
9843
  return false;
8419
9844
  }
@@ -8433,13 +9858,13 @@ function equalArray(a, c) {
8433
9858
  return true;
8434
9859
  }
8435
9860
 
8436
- // node_modules/@miqro/jsx/build/esm/hooks/pathname.js
8437
- function usePathname() {
8438
- const runtime = useRuntime();
9861
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/hooks/pathname.js
9862
+ function usePathname2() {
9863
+ const runtime = useRuntime2();
8439
9864
  const pathname = runtime.getLocation().pathname;
8440
- const [currentLocation, setCurrentLocation, getL] = useState(pathname);
8441
- debug(runtime, "usePathname [%s]", currentLocation);
8442
- useEffect(function usePathnameEffect() {
9865
+ const [currentLocation, setCurrentLocation, getL] = useState2(pathname);
9866
+ debug2(runtime, "usePathname [%s]", currentLocation);
9867
+ useEffect2(function usePathnameEffect() {
8443
9868
  const listener = () => {
8444
9869
  const newLocation = runtime.getLocation().pathname;
8445
9870
  setCurrentLocation(newLocation);
@@ -8452,32 +9877,32 @@ function usePathname() {
8452
9877
  return String(currentLocation);
8453
9878
  }
8454
9879
 
8455
- // node_modules/@miqro/jsx/build/esm/component/router.js
8456
- function useIsLocationPathNameActive(path) {
8457
- useConditional("useIsLocationPathNameMatch");
8458
- const runtime = useRuntime();
9880
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/component/router.js
9881
+ function useIsLocationPathNameActive2(path) {
9882
+ useConditional2("useIsLocationPathNameMatch");
9883
+ const runtime = useRuntime2();
8459
9884
  const basePath = runtime.getBasePath();
8460
- return isPathLocation(basePath, path, usePathname());
9885
+ return isPathLocation2(basePath, path, usePathname2());
8461
9886
  }
8462
- function Router(props) {
9887
+ function Router2(props) {
8463
9888
  const defaultElement = props.defaultElement;
8464
- const locationPathName = usePathname();
8465
- const runtime = useRuntime();
8466
- const active = getActiveRoute(locationPathName, props.routes, runtime);
9889
+ const locationPathName = usePathname2();
9890
+ const runtime = useRuntime2();
9891
+ const active = getActiveRoute2(locationPathName, props.routes, runtime);
8467
9892
  return active ? active.element : defaultElement;
8468
9893
  }
8469
- Router.asFragment = true;
8470
- Router.shadowInit = false;
8471
- function Link(props, children) {
9894
+ Router2.asFragment = true;
9895
+ Router2.shadowInit = false;
9896
+ function Link2(props, children) {
8472
9897
  const path = props.path;
8473
- const runtime = useRuntime();
9898
+ const runtime = useRuntime2();
8474
9899
  const basePath = runtime.getBasePath();
8475
9900
  const className = props.className ? props.className : "";
8476
9901
  const activeClass = props.classNameActive ? props.classNameActive : "active";
8477
9902
  const inactiveClass = props.classNameInactive ? props.classNameInactive : "inactive";
8478
- const isActive = useIsLocationPathNameActive(path);
9903
+ const isActive = useIsLocationPathNameActive2(path);
8479
9904
  const newClassName = `${className ? `${className} ` : ""}${isActive ? activeClass : inactiveClass}`;
8480
- const fullPath = getFullPath(basePath, path);
9905
+ const fullPath = getFullPath2(basePath, path);
8481
9906
  const element = {
8482
9907
  type: "Element",
8483
9908
  tagName: "a",
@@ -8498,181 +9923,35 @@ function Link(props, children) {
8498
9923
  }
8499
9924
  };
8500
9925
  }
8501
- Link.asFragment = true;
8502
- Link.shadowInit = false;
8503
- function getFullPath(basePath, p) {
8504
- return normalizePath(`${basePath ? basePath : ""}${p}`);
9926
+ Link2.asFragment = true;
9927
+ Link2.shadowInit = false;
9928
+ function getFullPath2(basePath, p) {
9929
+ return normalizePath2(`${basePath ? basePath : ""}${p}`);
8505
9930
  }
8506
- function isPathLocation(basePath, p, currentLocation) {
8507
- const path = getFullPath(basePath, p);
8508
- const pathname = normalizePath(currentLocation);
9931
+ function isPathLocation2(basePath, p, currentLocation) {
9932
+ const path = getFullPath2(basePath, p);
9933
+ const pathname = normalizePath2(currentLocation);
8509
9934
  return pathname.toLocaleLowerCase() === path.toLowerCase();
8510
9935
  }
8511
- function getActiveRoute(locationPathName, routes, runtime) {
9936
+ function getActiveRoute2(locationPathName, routes, runtime) {
8512
9937
  let activeRoute;
8513
9938
  const basePath = runtime.getBasePath() ? runtime.getBasePath() : "";
8514
9939
  for (const route of routes) {
8515
- if (isPathLocation(basePath, route.path, locationPathName)) {
9940
+ if (isPathLocation2(basePath, route.path, locationPathName)) {
8516
9941
  activeRoute = route;
8517
9942
  break;
8518
9943
  }
8519
9944
  }
8520
9945
  return activeRoute;
8521
9946
  }
8522
- function normalizePath(path) {
9947
+ function normalizePath2(path) {
8523
9948
  if (path.length > 1 && path.charAt(path.length - 1) === "/") {
8524
9949
  path = path.substring(0, path.length - 1);
8525
9950
  }
8526
9951
  return path;
8527
9952
  }
8528
9953
 
8529
- // node_modules/@miqro/jsx/build/esm/hooks/ref.js
8530
- function useRef() {
8531
- const [ref, setRef] = useState(null);
8532
- function useRefFunction(newRef) {
8533
- setRef(newRef);
8534
- }
8535
- ;
8536
- useRefFunction.current = ref;
8537
- return useRefFunction;
8538
- }
8539
-
8540
- // node_modules/@miqro/jsx/build/esm/hooks/query.js
8541
- function useAllQuery(watch2 = true) {
8542
- const key = useConditional(`useAllQuery`);
8543
- const runtime = useRuntime();
8544
- const [last, setLast, getLast] = useState(getQueryValue(runtime));
8545
- useEffect(function useQueryEffect() {
8546
- if (watch2) {
8547
- let useQueryEffectPathListener = function() {
8548
- const current = getQueryValue(runtime);
8549
- if (getLast() !== current) {
8550
- debug(runtime, "useQuery listener for %s", key);
8551
- setLast(current);
8552
- }
8553
- };
8554
- runtime.addPathListener(useQueryEffectPathListener);
8555
- return function useQueryEffectUnLoad() {
8556
- runtime.removePathListener(useQueryEffectPathListener);
8557
- };
8558
- }
8559
- }, []);
8560
- return last;
8561
- }
8562
- function useQuery(name, defaultValue, watch2 = true) {
8563
- const key = useConditional(`useQuery-${name}-${defaultValue}`);
8564
- const runtime = useRuntime();
8565
- const [last, setLast, getLast] = useState(getQueryValue(runtime, name, defaultValue));
8566
- useEffect(function useQueryEffect() {
8567
- if (watch2) {
8568
- let useQueryEffectPathListener = function() {
8569
- const current = getQueryValue(runtime, name, defaultValue);
8570
- if (getLast() !== current) {
8571
- debug(runtime, "useQuery listener for %s", key);
8572
- setLast(current);
8573
- }
8574
- };
8575
- runtime.addPathListener(useQueryEffectPathListener);
8576
- return function useQueryEffectUnLoad() {
8577
- runtime.removePathListener(useQueryEffectPathListener);
8578
- };
8579
- }
8580
- }, []);
8581
- return [
8582
- last,
8583
- function setQuery(newValue) {
8584
- setQueryValue(runtime, name, newValue, watch2);
8585
- setLast(newValue);
8586
- },
8587
- function getQuery() {
8588
- return getQueryValue(runtime, name, defaultValue);
8589
- }
8590
- ];
8591
- }
8592
- function getQueryValue(runtime, name, defaultValue) {
8593
- if (!name) {
8594
- return runtime.getLocation().searchParams.toString();
8595
- } else {
8596
- const ret = runtime.getLocation().searchParams.getAll(name);
8597
- if (ret.length === 0) {
8598
- return defaultValue !== void 0 ? defaultValue : null;
8599
- }
8600
- return ret && ret.length === 1 && !(defaultValue instanceof Array) ? ret[0] : ret;
8601
- }
8602
- }
8603
- function setQueryValue(runtime, name, value, watch2 = true) {
8604
- const url = runtime.getLocation();
8605
- if (value instanceof Array) {
8606
- url.searchParams.delete(name);
8607
- for (const v of value) {
8608
- url.searchParams.append(name, v);
8609
- }
8610
- } else if (value !== null) {
8611
- url.searchParams.set(name, value);
8612
- } else {
8613
- url.searchParams.delete(name);
8614
- }
8615
- if (watch2) {
8616
- runtime.pushPath(String(url));
8617
- }
8618
- }
8619
-
8620
- // node_modules/@miqro/jsx/build/esm/hooks/useelement.js
8621
- function useElement() {
8622
- useConditional("useElement");
8623
- const currentContext2 = useRenderContext();
8624
- if (!currentContext2) {
8625
- throw new Error("useElement not in render");
8626
- }
8627
- return currentContext2.node.ref ? currentContext2.node.ref : null;
8628
- }
8629
-
8630
- // node_modules/@miqro/jsx/build/esm/hooks/context.js
8631
- function createContext(defaultValue) {
8632
- const symbol = /* @__PURE__ */ Symbol();
8633
- return {
8634
- provider: createContextProvider(symbol, defaultValue),
8635
- symbol
8636
- };
8637
- }
8638
- function useContext(context) {
8639
- useConditional("useContext");
8640
- const currentContext2 = useRenderContext();
8641
- if (!currentContext2) {
8642
- throw new Error("useContext not in render");
8643
- }
8644
- let currentNode = currentContext2.node;
8645
- while (currentNode) {
8646
- if (currentNode.type === "ContextProvider" && currentNode.contextKey === context.symbol) {
8647
- return currentNode.contextValue;
8648
- }
8649
- currentNode = currentNode.parent;
8650
- }
8651
- throw new Error("cannot find provider!");
8652
- }
8653
- function createContextProvider(symbol, defaultValue) {
8654
- function ContextProvider2({ value }, ...children) {
8655
- useConditional("ContextProvider");
8656
- const currentContext2 = useRenderContext();
8657
- if (!currentContext2) {
8658
- throw new Error("ContextProvider not in render");
8659
- }
8660
- return {
8661
- type: "ContextProvider",
8662
- contextKey: symbol,
8663
- contextValue: value === void 0 ? defaultValue : value,
8664
- children
8665
- };
8666
- }
8667
- ContextProvider2.asFragment = true;
8668
- ContextProvider2.shadowInit = false;
8669
- return ContextProvider2;
8670
- }
8671
-
8672
- // node_modules/@miqro/jsx/build/esm/lib.js
8673
- var lib_default = JSX;
8674
-
8675
- // node_modules/@miqro/jsx-node/build/esm/runtime.js
9954
+ // ../jsx-node/build/esm/runtime.js
8676
9955
  var import_events = require("events");
8677
9956
  var SELF_CLOSING_TAGS = /* @__PURE__ */ new Set([
8678
9957
  "area",
@@ -8785,7 +10064,7 @@ var SSRAttributeMap = class extends Map {
8785
10064
  kIterator = keys.next();
8786
10065
  }
8787
10066
  if (this.node.value) {
8788
- ret = `${ret} ${AttributeEncode("value")}="${this.node.value}"`;
10067
+ ret = `${ret} ${AttributeEncode("value")}="${AttributeEncode(String(this.node.value))}"`;
8789
10068
  }
8790
10069
  return ret;
8791
10070
  }
@@ -8934,7 +10213,7 @@ function HTMLEncode(str) {
8934
10213
  return aRet.join("");
8935
10214
  }
8936
10215
  function AttributeEncode(str) {
8937
- return str.replaceAll('"', "&quot;");
10216
+ return str.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
8938
10217
  }
8939
10218
  var containerMap = /* @__PURE__ */ new WeakMap();
8940
10219
  var originalChildNodesMap = /* @__PURE__ */ new WeakMap();
@@ -8961,7 +10240,7 @@ function runtimeDefine(runtime, tagName, component, options) {
8961
10240
  props[name] = self.getAttribute(name);
8962
10241
  }
8963
10242
  props["$element$"] = self;
8964
- container.render(createElement(component, props, originalChildNodes));
10243
+ container.render(createElement2(component, props, originalChildNodes));
8965
10244
  }
8966
10245
  disconnectedCallback() {
8967
10246
  const container = containerMap.get(this);
@@ -8985,7 +10264,7 @@ function runtimeDefine(runtime, tagName, component, options) {
8985
10264
  props[name] = self.getAttribute(name);
8986
10265
  }
8987
10266
  props["$element$"] = self;
8988
- container.render(createElement(component, props, originalChildNodes));
10267
+ container.render(createElement2(component, props, originalChildNodes));
8989
10268
  }
8990
10269
  reCalculateOriginalChildren() {
8991
10270
  if (originalChildNodesMap.has(this)) {
@@ -9025,7 +10304,7 @@ function createNodeRuntime(options) {
9025
10304
  basePath: options?.basePath
9026
10305
  };
9027
10306
  const customElementMap = {};
9028
- const elementByIdMap = {};
10307
+ const elementByIdMap = /* @__PURE__ */ Object.create(null);
9029
10308
  const runtime = {
9030
10309
  name: "node",
9031
10310
  customElementMap,
@@ -9046,7 +10325,7 @@ function createNodeRuntime(options) {
9046
10325
  return runtime._activeElement;
9047
10326
  },
9048
10327
  createContainer: (element, options2) => {
9049
- return createContainer(element, runtime, options2);
10328
+ return createContainer2(element, runtime, options2);
9050
10329
  },
9051
10330
  getElementById: (id) => {
9052
10331
  return elementByIdMap[id] ? elementByIdMap[id] : null;
@@ -9086,13 +10365,6 @@ function createNodeRuntime(options) {
9086
10365
  return runtime;
9087
10366
  }
9088
10367
 
9089
- // node_modules/@miqro/jsx-node/build/esm/handler.js
9090
- init_lib3();
9091
-
9092
- // node_modules/@miqro/jsx-node/build/esm/constants.js
9093
- var import_os = require("os");
9094
- var DEFAULT_BUILD_DIR = (0, import_os.tmpdir)();
9095
-
9096
10368
  // src/common/jsx.ts
9097
10369
  var import_node_path6 = require("node:path");
9098
10370
  var import_node_crypto4 = require("node:crypto");
@@ -10377,17 +11649,17 @@ async function sqlite3Executor(config) {
10377
11649
  transformOutput: sqliteTransformOutput,
10378
11650
  query: async function sqlite3Executor2(sql, values) {
10379
11651
  return new Promise((resolve24, reject) => {
10380
- const st = driver.prepare(sql, values, function(error2) {
10381
- if (error2) {
10382
- reject(error2);
11652
+ const st = driver.prepare(sql, values, function(error3) {
11653
+ if (error3) {
11654
+ reject(error3);
10383
11655
  } else {
10384
- st.all(function(error3, rows) {
10385
- if (error3) {
10386
- reject(error3);
11656
+ st.all(function(error4, rows) {
11657
+ if (error4) {
11658
+ reject(error4);
10387
11659
  } else {
10388
- st.finalize((error4) => {
10389
- if (error4) {
10390
- reject(error4);
11660
+ st.finalize((error5) => {
11661
+ if (error5) {
11662
+ reject(error5);
10391
11663
  } else {
10392
11664
  resolve24(rows);
10393
11665
  }
@@ -11682,7 +12954,7 @@ var ClusterWebSocketServer2 = class extends WebSocketServer {
11682
12954
  return options.validate ? options.validate(req) : true;
11683
12955
  }
11684
12956
  },
11685
- onError: (req, error2) => {
12957
+ onError: (req, error3) => {
11686
12958
  if (process.send) {
11687
12959
  process.send({
11688
12960
  type: ClusterWebSocketServer2MessageType,
@@ -11690,13 +12962,13 @@ var ClusterWebSocketServer2 = class extends WebSocketServer {
11690
12962
  target: this.name,
11691
12963
  clientUUID: req.uuid,
11692
12964
  fromPID: String(process.pid),
11693
- errorMessage: error2.message
12965
+ errorMessage: error3.message
11694
12966
  });
11695
12967
  }
11696
- this.logger?.error("[%s] error from (%s) error [%s]", req.uuid, req.req.socket.remoteAddress, error2);
11697
- this.logger?.error(error2);
12968
+ this.logger?.error("[%s] error from (%s) error [%s]", req.uuid, req.req.socket.remoteAddress, error3);
12969
+ this.logger?.error(error3);
11698
12970
  if (options.onError) {
11699
- options.onError(req, error2);
12971
+ options.onError(req, error3);
11700
12972
  }
11701
12973
  },
11702
12974
  onConnection: (req) => {
@@ -12386,7 +13658,7 @@ var LogProvider = class {
12386
13658
  try {
12387
13659
  const url = newURL2(req.url ? req.url : "/");
12388
13660
  query = url.searchParams.toString();
12389
- path = normalizePath2(url.pathname);
13661
+ path = normalizePath3(url.pathname);
12390
13662
  method = req.method ? req.method.toUpperCase() : "GET";
12391
13663
  remoteAddress = req.socket.remoteAddress;
12392
13664
  } catch (e) {
@@ -12707,7 +13979,7 @@ function getRoutes(prePath, defaultPath, apiOptions) {
12707
13979
  inflatePath: p !== "/" ? (0, import_node_path9.join)(prePath, p) : defaultInflatePath,
12708
13980
  defaultInflatePath,
12709
13981
  method: m.toLocaleLowerCase() !== "use" ? m.toUpperCase() : void 0,
12710
- path: normalizePath2((0, import_node_path9.join)(prePath, p))
13982
+ path: normalizePath3((0, import_node_path9.join)(prePath, p))
12711
13983
  });
12712
13984
  }
12713
13985
  }
@@ -12820,7 +14092,7 @@ async function setupError(logger, servicePath, service, mainRouter, inflateDir,
12820
14092
 
12821
14093
  // src/inflate/setup-http.ts
12822
14094
  async function setupHTTPRouter(importOptions, inflateOptions, server, logger, hotreload, servicePath, service, routeFileMap, staticFileMap, inflateDir, inflateSea, errors, inflateParallel) {
12823
- const mainRouter = new Router2();
14095
+ const mainRouter = new Router3();
12824
14096
  const apiRouterPath = getHTTPRouterPath(servicePath);
12825
14097
  let middlewareConfig = null;
12826
14098
  await setupError(logger, servicePath, service, mainRouter, inflateDir, inflateSea, importOptions, errors);
@@ -12858,7 +14130,7 @@ async function createStaticRoute(inflateJSXOptions, service, logger, router, dir
12858
14130
  routeFileMap[file.filePath] = {
12859
14131
  routes: [{
12860
14132
  method: "GET",
12861
- path: normalizePath2(path)
14133
+ path: normalizePath3(path)
12862
14134
  }],
12863
14135
  service,
12864
14136
  filePath: file.filePath,
@@ -12882,7 +14154,7 @@ async function createStaticRoute(inflateJSXOptions, service, logger, router, dir
12882
14154
  filePath: file.filePath,
12883
14155
  previewMethod: "html",
12884
14156
  method: "GET",
12885
- path: normalizePath2(path),
14157
+ path: normalizePath3(path),
12886
14158
  body: Buffer.from(body),
12887
14159
  inflatePath: inflateDir ? (0, import_node_path12.join)(inflateDir, !inflateJSXOptions.inflateFlat ? service : "", "static", path) : void 0
12888
14160
  };
@@ -12924,7 +14196,7 @@ async function createStaticRoute(inflateJSXOptions, service, logger, router, dir
12924
14196
  });
12925
14197
  }
12926
14198
  async function createStaticRouterFromDirectory(inflateOptions, service, logger, dir, inflateDir, routeFileMap, staticFileMap, inflateParallel) {
12927
- const router = new Router2();
14199
+ const router = new Router3();
12928
14200
  const maxParallel = inflateParallel ? inflateParallel : 1;
12929
14201
  logger.debug("loading static directory with parallel [%s]", maxParallel);
12930
14202
  let tR = [];
@@ -12943,7 +14215,7 @@ async function createStaticRouterFromDirectory(inflateOptions, service, logger,
12943
14215
  return router;
12944
14216
  }
12945
14217
  async function createRouterFromDirectory(importOptions, inflateJSXOptions, server, hotreload, service, logger, dir, errors = [], routeFileMap = {}, staticFileMap = null, inflateDir, inflateSea, inflateParallel) {
12946
- const router = new Router2();
14218
+ const router = new Router3();
12947
14219
  const maxParallel = inflateParallel ? inflateParallel : 1;
12948
14220
  server.logger.debug("loading http directory with parallel [%s]", maxParallel);
12949
14221
  let tR = [];
@@ -14055,7 +15327,7 @@ async function inflateApp({ inflateParallel, serverInterface, logger, hotreload,
14055
15327
  const errors = [];
14056
15328
  let routeFileMap = {};
14057
15329
  const wsConfigList = [];
14058
- const router = new Router2();
15330
+ const router = new Router3();
14059
15331
  const logConfigMap = {};
14060
15332
  for (const service of services) {
14061
15333
  const serviceRouteFileMap = {};
@@ -14219,8 +15491,8 @@ var server_default = {
14219
15491
  init_lib3();
14220
15492
  init_constants();
14221
15493
  async function createEditorRouter(adminInterface) {
14222
- const router = new Router2();
14223
- const innerRouter = new Router2();
15494
+ const router = new Router3();
15495
+ const innerRouter = new Router3();
14224
15496
  innerRouter.use(async (req, res) => {
14225
15497
  res.setHeader("x-uuid", req.uuid);
14226
15498
  req.editor = adminInterface;
@@ -14394,13 +15666,13 @@ function setupExitHandlers(app) {
14394
15666
  }
14395
15667
  process.exit(EXIT_CODES.ABNORMAL_UNCONTROLLED);
14396
15668
  });
14397
- process.on("exit", function(code) {
15669
+ process.on("exit", async function(code) {
14398
15670
  if (exceptionOccured) {
14399
15671
  app.logger?.error("Exception occured");
14400
15672
  } else {
14401
15673
  cleanJSX(app);
14402
15674
  if (app.server) {
14403
- app.stop();
15675
+ await app.stop();
14404
15676
  }
14405
15677
  }
14406
15678
  });
@@ -17517,7 +18789,7 @@ var Miqro = class _Miqro {
17517
18789
  }
17518
18790
  this.inflated = void 0;
17519
18791
  this.inflated = {
17520
- router: inflated && inflated.router ? inflated.router : new Router2(),
18792
+ router: inflated && inflated.router ? inflated.router : new Router3(),
17521
18793
  errors: inflated && inflated.errors ? inflated.errors : [],
17522
18794
  fileMap: inflated && inflated.fileMap ? inflated.fileMap : {},
17523
18795
  logConfigMap: inflated && inflated.logConfigMap ? inflated.logConfigMap : {},
@@ -17604,7 +18876,7 @@ var Miqro = class _Miqro {
17604
18876
  _Miqro.initAssetsPromise = initAssets(this.logger);
17605
18877
  }
17606
18878
  await _Miqro.initAssetsPromise;
17607
- const router = new Router2();
18879
+ const router = new Router3();
17608
18880
  const wsConfigList = [];
17609
18881
  const { dbList, errors: dbConfigErrors } = await this.loadDBConfig(options);
17610
18882
  await Promise.all(dbList.map((db) => this.dbManager.setupDB(db.dbConfig)));
@@ -17623,7 +18895,7 @@ var Miqro = class _Miqro {
17623
18895
  path: HOT_RELOAD_PATH
17624
18896
  });
17625
18897
  this.logger?.debug("setting up hot-reload script on [%s]", HOT_RELOAD_SCRIPT_PATH);
17626
- const hotReloadScriptRouter = new Router2();
18898
+ const hotReloadScriptRouter = new Router3();
17627
18899
  hotReloadScriptRouter.get(HOT_RELOAD_SCRIPT_PATH, async (req, res) => res.js(HOT_RELOAD_JS_SCRIPT));
17628
18900
  router.use(hotReloadScriptRouter);
17629
18901
  }
@@ -17697,10 +18969,10 @@ var Miqro = class _Miqro {
17697
18969
  this.connect();
17698
18970
  await this.dbManager.connectAll();
17699
18971
  this.server = new App({
17700
- onUpgrade: (req, socket, head) => {
18972
+ onUpgrade: async (req, socket, head) => {
17701
18973
  try {
17702
18974
  req.server = this.serverInterface;
17703
- return this.webSocketManager.onUpgrade(req, socket, head);
18975
+ return await this.webSocketManager.onUpgrade(req, socket, head);
17704
18976
  } catch (e) {
17705
18977
  this.logger?.error(e);
17706
18978
  }
@@ -17942,7 +19214,7 @@ async function appendAPIModule(router, dir, filePath, module2) {
17942
19214
 
17943
19215
  // src/lib.ts
17944
19216
  init_lib3();
17945
- var JSX2 = {
19217
+ var JSX3 = {
17946
19218
  createElement: (...args) => {
17947
19219
  const ret = createElement(...args);
17948
19220
  ret.toString = () => jsx2HTML(ret);