miqro 7.3.0 → 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
  }
@@ -1808,7 +1808,10 @@ var init_types = __esm({
1808
1808
  return;
1809
1809
  } else {
1810
1810
  if (this.useETag) {
1811
- const incomingETag = this.req.headers["if-none-match"];
1811
+ let incomingETag = this.req.headers["if-none-match"];
1812
+ if (incomingETag && incomingETag.indexOf("W/") === 0) {
1813
+ incomingETag = incomingETag.substring("W/".length);
1814
+ }
1812
1815
  const etag = typeof this.useETag === "function" ? await this.useETag(args) : defaultETag({ body: nBody });
1813
1816
  if (incomingETag && etag && etag === incomingETag && nStatus >= 200 && nStatus < 300) {
1814
1817
  this.statusCode = 304;
@@ -1946,7 +1949,7 @@ function routerDefaultLoggerFactory(uuid, req) {
1946
1949
  try {
1947
1950
  const url = newURL2(req.url ? req.url : "/");
1948
1951
  query = url.searchParams.toString();
1949
- path = normalizePath2(url.pathname);
1952
+ path = normalizePath3(url.pathname);
1950
1953
  method = req.method ? req.method.toUpperCase() : "GET";
1951
1954
  remoteAddress = req.socket.remoteAddress;
1952
1955
  } catch (e) {
@@ -2271,7 +2274,7 @@ var init_common = __esm({
2271
2274
  });
2272
2275
 
2273
2276
  // node_modules/@miqro/core/build/middleware/router.js
2274
- var Router2, RouterHandler;
2277
+ var Router3, RouterHandler;
2275
2278
  var init_router = __esm({
2276
2279
  "node_modules/@miqro/core/build/middleware/router.js"() {
2277
2280
  init_common();
@@ -2280,7 +2283,7 @@ var init_router = __esm({
2280
2283
  init_body_parser();
2281
2284
  init_lib2();
2282
2285
  init_built_in_parsers();
2283
- Router2 = class {
2286
+ Router3 = class {
2284
2287
  constructor(config) {
2285
2288
  this.config = config;
2286
2289
  this.handlers = [];
@@ -2322,7 +2325,7 @@ var init_router = __esm({
2322
2325
  return this.use(handler, path, "options", options);
2323
2326
  }
2324
2327
  use(handler, path, method, options) {
2325
- const nPath = path !== void 0 ? normalizePath2(path) : void 0;
2328
+ const nPath = path !== void 0 ? normalizePath3(path) : void 0;
2326
2329
  const nMethod = method ? method.toLowerCase() : method;
2327
2330
  this.handlers.push(new RouterHandler(handler, nPath, nMethod, options));
2328
2331
  return this;
@@ -2462,7 +2465,7 @@ ${tab}${tab}${methodData.description}` : ""}`;
2462
2465
  this.handler = handlers;
2463
2466
  }
2464
2467
  getJSONDoc(doc = {}, prePath = "") {
2465
- const pp = normalizePath2(removeStartingBackSlashes(this.path ? this.path : "/"));
2468
+ const pp = normalizePath3(removeStartingBackSlashes(this.path ? this.path : "/"));
2466
2469
  const nPath = pp.length > 1 ? pp.substring(1) : "";
2467
2470
  const nMethod = this.method ? this.method : "";
2468
2471
  if (this.isRouter) {
@@ -2563,7 +2566,7 @@ var init_app = __esm({
2563
2566
  init_router();
2564
2567
  init_common();
2565
2568
  import_crypto = require("crypto");
2566
- App = class extends Router2 {
2569
+ App = class extends Router3 {
2567
2570
  constructor(config) {
2568
2571
  super(config);
2569
2572
  this.shouldCloseConnection = false;
@@ -2922,12 +2925,12 @@ var init_websocket = __esm({
2922
2925
  socket.destroy();
2923
2926
  }
2924
2927
  });
2925
- socket.on("error", async (error2) => {
2928
+ socket.on("error", async (error3) => {
2926
2929
  req.logger.debug("upgraded connection error!");
2927
- req.logger.error(error2);
2930
+ req.logger.error(error3);
2928
2931
  if (this.options.onError) {
2929
2932
  try {
2930
- await this.options.onError(client, error2);
2933
+ await this.options.onError(client, error3);
2931
2934
  } catch (e) {
2932
2935
  req.logger.error(e);
2933
2936
  }
@@ -7026,10 +7029,10 @@ __export(restart_api_exports, {
7026
7029
  parseInflateErrors: () => parseInflateErrors
7027
7030
  });
7028
7031
  function parseInflateErrors(errors) {
7029
- return errors?.map((error2) => {
7032
+ return errors?.map((error3) => {
7030
7033
  return {
7031
- filePath: (0, import_node_path24.relative)(BASE_PATH, error2.filePath),
7032
- error: error2.error.message
7034
+ filePath: (0, import_node_path24.relative)(BASE_PATH, error3.filePath),
7035
+ error: error3.error.message
7033
7036
  };
7034
7037
  });
7035
7038
  }
@@ -7084,10 +7087,10 @@ __export(reload_api_exports, {
7084
7087
  parseInflateErrors: () => parseInflateErrors2
7085
7088
  });
7086
7089
  function parseInflateErrors2(errors) {
7087
- return errors?.map((error2) => {
7090
+ return errors?.map((error3) => {
7088
7091
  return {
7089
- filePath: (0, import_node_path25.relative)(BASE_PATH, error2.filePath),
7090
- error: error2.error.message
7092
+ filePath: (0, import_node_path25.relative)(BASE_PATH, error3.filePath),
7093
+ error: error3.error.message
7091
7094
  };
7092
7095
  });
7093
7096
  }
@@ -7147,108 +7150,1541 @@ function HTMLEncode2(str) {
7147
7150
  aRet[i] = str[i];
7148
7151
  }
7149
7152
  }
7150
- 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
+ }
7151
8602
  }
7152
- var init_html_encode = __esm({
7153
- "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);
7154
8614
  }
7155
- });
8615
+ if (watch2) {
8616
+ runtime.pushPath(String(url));
8617
+ }
8618
+ }
7156
8619
 
7157
- // editor/common/editor-index.tsx
7158
- var editor_index_exports = {};
7159
- __export(editor_index_exports, {
7160
- EditorIndex: () => EditorIndex
7161
- });
7162
- function EditorIndex(editorCSS, editorJS, enableHotReload) {
7163
- return async function editorIndex(req, res) {
7164
- const admin = req.editor;
7165
- const errors = parseInflateErrors(admin ? admin.getInflateErrors() : []);
7166
- const files = scanDir(req);
7167
- const migrations = admin ? admin.getMigrations().map((m) => m.name) : [];
7168
- const services = admin ? admin.getServices() : ["."];
7169
- const hotReload = enableHotReload ? admin ? admin.getHotReloadHTML() : "" : "";
7170
- 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
7171
8636
  };
7172
8637
  }
7173
- var init_editor_index = __esm({
7174
- "editor/common/editor-index.tsx"() {
7175
- init_scan_api();
7176
- init_restart_api();
7177
- 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");
7178
8643
  }
7179
- });
7180
-
7181
- // src/lib.ts
7182
- var lib_exports3 = {};
7183
- __export(lib_exports3, {
7184
- App: () => App,
7185
- ClusterCache: () => ClusterCache,
7186
- ClusterWebSocketServer2: () => ClusterWebSocketServer2,
7187
- DBManager: () => DBManager,
7188
- JSX: () => JSX2,
7189
- LocalCache: () => LocalCache,
7190
- LogProvider: () => LogProvider,
7191
- LoggerHandler: () => LoggerHandler,
7192
- Miqro: () => Miqro,
7193
- Router: () => Router2,
7194
- ServerRequestHandler: () => ServerRequestHandler,
7195
- WebSocketManager: () => WebSocketManager,
7196
- appendAPIModule: () => appendAPIModule,
7197
- createLogProviderOptions: () => createLogProviderOptions,
7198
- createServerInterface: () => createServerInterface,
7199
- defineRoute: () => defineRoute2,
7200
- jsx: () => lib_exports,
7201
- jsx2HTML: () => jsx2HTML,
7202
- jwt: () => jwt,
7203
- middleware: () => middleware,
7204
- migration: () => lib_exports2
7205
- });
7206
- 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
+ }
7207
8671
 
7208
8672
  // node_modules/@miqro/jsx/build/esm/lib.js
7209
- var lib_exports = {};
7210
- __export(lib_exports, {
7211
- Fragment: () => Fragment,
7212
- JSX: () => JSX,
7213
- Link: () => Link,
7214
- Router: () => Router,
7215
- createContainer: () => createContainer,
7216
- createContext: () => createContext,
7217
- createElement: () => createElement,
7218
- default: () => lib_default,
7219
- enableDebugLog: () => enableDebugLog,
7220
- isPathLocation: () => isPathLocation,
7221
- setDefaultOptions: () => setDefaultOptions,
7222
- useAllQuery: () => useAllQuery,
7223
- useConditional: () => useConditional,
7224
- useContext: () => useContext,
7225
- useEffect: () => useEffect,
7226
- useElement: () => useElement,
7227
- useIsLocationPathNameActive: () => useIsLocationPathNameActive,
7228
- usePathname: () => usePathname,
7229
- useQuery: () => useQuery,
7230
- useRef: () => useRef,
7231
- useRefresh: () => useRefresh,
7232
- useRuntime: () => useRuntime,
7233
- useState: () => useState
7234
- });
8673
+ var lib_default = JSX;
7235
8674
 
7236
- // node_modules/@miqro/jsx/build/esm/vdom/log.js
7237
- var debugLogEnabled = false;
7238
- function debug(runtime, message2, ...args) {
7239
- 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) {
7240
8679
  runtime.consoleLog(message2, ...args);
7241
8680
  }
7242
8681
  }
7243
- function error(runtime, message2, ...args) {
8682
+ function error2(runtime, message2, ...args) {
7244
8683
  runtime.consoleError(message2, ...args);
7245
8684
  }
7246
- function enableDebugLog() {
7247
- debugLogEnabled = true;
7248
- }
7249
8685
 
7250
- // node_modules/@miqro/jsx/build/esm/vdom/actions.js
7251
- function createAppendAction(node, runtime) {
8686
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/actions.js
8687
+ function createAppendAction2(node, runtime) {
7252
8688
  return {
7253
8689
  isDestructive: true,
7254
8690
  execute: () => {
@@ -7256,12 +8692,12 @@ function createAppendAction(node, runtime) {
7256
8692
  const nodeRef = node.ref;
7257
8693
  let changes = 0;
7258
8694
  if (parent) {
7259
- debug(runtime, "%s.children.add(%s)", parent.getName(), node.getName());
8695
+ debug2(runtime, "%s.children.add(%s)", parent.getName(), node.getName());
7260
8696
  parent.children.add(node);
7261
8697
  if (nodeRef) {
7262
8698
  let currentParent = parent;
7263
8699
  if (currentParent.ref) {
7264
- debug(runtime, "%s.appendChild(%s)", currentParent.getName(), node.getName());
8700
+ debug2(runtime, "%s.appendChild(%s)", currentParent.getName(), node.getName());
7265
8701
  if (currentParent.state?.shadowRoot) {
7266
8702
  currentParent.state.shadowRoot.appendChild(nodeRef);
7267
8703
  } else {
@@ -7273,7 +8709,7 @@ function createAppendAction(node, runtime) {
7273
8709
  while (currentParent !== null) {
7274
8710
  currentParent = currentParent.parent;
7275
8711
  if (currentParent && currentParent.ref) {
7276
- debug(runtime, "%s.appendChild(%s)", currentParent.getName(), node.getName());
8712
+ debug2(runtime, "%s.appendChild(%s)", currentParent.getName(), node.getName());
7277
8713
  if (currentParent.state?.shadowRoot) {
7278
8714
  currentParent.state.shadowRoot.appendChild(nodeRef);
7279
8715
  } else {
@@ -7292,7 +8728,7 @@ function createAppendAction(node, runtime) {
7292
8728
  }
7293
8729
  };
7294
8730
  }
7295
- function createRemoveAttributesAction(node, toRemove, runtime) {
8731
+ function createRemoveAttributesAction2(node, toRemove, runtime) {
7296
8732
  return {
7297
8733
  execute: () => {
7298
8734
  const ref = node.ref;
@@ -7300,11 +8736,11 @@ function createRemoveAttributesAction(node, toRemove, runtime) {
7300
8736
  if (ref) {
7301
8737
  const element = ref;
7302
8738
  for (const name of toRemove) {
7303
- debug(runtime, "%s.removeAttribute(%s)", node.getName(), name);
8739
+ debug2(runtime, "%s.removeAttribute(%s)", node.getName(), name);
7304
8740
  element.removeAttribute(name);
7305
8741
  changes++;
7306
8742
  if (name === "checked") {
7307
- debug(runtime, "%s.%s=...", node.getName(), "checked");
8743
+ debug2(runtime, "%s.%s=...", node.getName(), "checked");
7308
8744
  element.checked = false;
7309
8745
  changes++;
7310
8746
  }
@@ -7314,7 +8750,7 @@ function createRemoveAttributesAction(node, toRemove, runtime) {
7314
8750
  }
7315
8751
  };
7316
8752
  }
7317
- function createSetAttributesAction(node, toSet, runtime) {
8753
+ function createSetAttributesAction2(node, toSet, runtime) {
7318
8754
  return {
7319
8755
  execute: () => {
7320
8756
  const ref = node.ref;
@@ -7325,15 +8761,15 @@ function createSetAttributesAction(node, toSet, runtime) {
7325
8761
  if (s.name === "className") {
7326
8762
  s.name = "class";
7327
8763
  }
7328
- debug(runtime, "%s.setAttribute(%s, ...)", node.getName(), s.name);
8764
+ debug2(runtime, "%s.setAttribute(%s, ...)", node.getName(), s.name);
7329
8765
  element.setAttribute(s.name, s.value);
7330
8766
  changes++;
7331
8767
  if (s.name === "value") {
7332
- debug(runtime, "%s.%s=...", node.getName(), s.name);
8768
+ debug2(runtime, "%s.%s=...", node.getName(), s.name);
7333
8769
  element.value = s.value;
7334
8770
  changes++;
7335
8771
  } else if (s.name === "checked") {
7336
- debug(runtime, "%s.%s=...", node.getName(), s.name);
8772
+ debug2(runtime, "%s.%s=...", node.getName(), s.name);
7337
8773
  element.checked = true;
7338
8774
  changes++;
7339
8775
  }
@@ -7343,51 +8779,51 @@ function createSetAttributesAction(node, toSet, runtime) {
7343
8779
  }
7344
8780
  };
7345
8781
  }
7346
- function createFlushEffects(node, options, runtime) {
8782
+ function createFlushEffects2(node, options, runtime) {
7347
8783
  return {
7348
8784
  postExecute: () => {
7349
8785
  const meta = node.state;
7350
8786
  const func = node.component;
7351
8787
  const changes = 0;
7352
8788
  if (func && meta) {
7353
- debug(runtime, "flush effects callbacks for [%s]", node.getName());
7354
- flushEffectCallbacks(meta.effectCallbacks, options.disableEffects, runtime);
7355
- debug(runtime, "flush effects for [%s]", node.getName());
7356
- 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);
7357
8793
  }
7358
8794
  return changes;
7359
8795
  }
7360
8796
  };
7361
8797
  }
7362
- function createFlushEffectsRemove(node, options, runtime) {
8798
+ function createFlushEffectsRemove2(node, options, runtime) {
7363
8799
  return {
7364
8800
  execute: () => {
7365
8801
  const meta = node.state;
7366
8802
  const changes = 0;
7367
8803
  if (node.component && meta) {
7368
- debug(runtime, "flush effects callbacks for [%s]", node.getName());
7369
- flushEffectCallbacks(meta.effectCallbacks, options.disableEffects, runtime);
7370
- debug(runtime, "flush effects for [%s]", node.getName());
7371
- 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);
7372
8808
  }
7373
8809
  return changes;
7374
8810
  }
7375
8811
  };
7376
8812
  }
7377
- function flushEffectCallbacks(callbacks, disableEffects, runtime) {
8813
+ function flushEffectCallbacks2(callbacks, disableEffects, runtime) {
7378
8814
  const keys = Object.keys(callbacks);
7379
8815
  for (const key of keys) {
7380
8816
  if (!disableEffects) {
7381
8817
  try {
7382
8818
  callbacks[key]();
7383
8819
  } catch (e) {
7384
- error(runtime, e);
8820
+ error2(runtime, e);
7385
8821
  }
7386
8822
  }
7387
8823
  delete callbacks[key];
7388
8824
  }
7389
8825
  }
7390
- function flushEffects(effects, callbacks, disableEffects, runtime) {
8826
+ function flushEffects2(effects, callbacks, disableEffects, runtime) {
7391
8827
  const keys = Object.keys(effects);
7392
8828
  for (const key of keys) {
7393
8829
  if (!disableEffects) {
@@ -7397,13 +8833,13 @@ function flushEffects(effects, callbacks, disableEffects, runtime) {
7397
8833
  callbacks[key] = callback;
7398
8834
  }
7399
8835
  } catch (e) {
7400
- error(runtime, e);
8836
+ error2(runtime, e);
7401
8837
  }
7402
8838
  }
7403
8839
  delete effects[key];
7404
8840
  }
7405
8841
  }
7406
- function createRemoveListeners(node, runtime) {
8842
+ function createRemoveListeners2(node, runtime) {
7407
8843
  return {
7408
8844
  execute: () => {
7409
8845
  const ref = node.ref;
@@ -7413,7 +8849,7 @@ function createRemoveListeners(node, runtime) {
7413
8849
  }
7414
8850
  const element = ref;
7415
8851
  for (const listener of node.currentEventListeners) {
7416
- debug(runtime, "%s.removeEventListener(%s, ...)", node.getName(), listener.eventName);
8852
+ debug2(runtime, "%s.removeEventListener(%s, ...)", node.getName(), listener.eventName);
7417
8853
  element.removeEventListener(listener.eventName, listener.listener);
7418
8854
  changes++;
7419
8855
  }
@@ -7422,7 +8858,7 @@ function createRemoveListeners(node, runtime) {
7422
8858
  }
7423
8859
  };
7424
8860
  }
7425
- function createUpdateListeners(node, listeners, runtime) {
8861
+ function createUpdateListeners2(node, listeners, runtime) {
7426
8862
  return {
7427
8863
  execute: () => {
7428
8864
  const ref = node.ref;
@@ -7432,13 +8868,13 @@ function createUpdateListeners(node, listeners, runtime) {
7432
8868
  }
7433
8869
  const element = ref;
7434
8870
  for (const listener of node.currentEventListeners) {
7435
- debug(runtime, "%s.removeEventListener(%s, ...)", node.getName(), listener.eventName);
8871
+ debug2(runtime, "%s.removeEventListener(%s, ...)", node.getName(), listener.eventName);
7436
8872
  element.removeEventListener(listener.eventName, listener.listener);
7437
8873
  changes++;
7438
8874
  }
7439
8875
  node.currentEventListeners = [];
7440
8876
  for (const listener of listeners) {
7441
- debug(runtime, "%s.addEventListener(%s, ...)", node.getName(), listener.eventName);
8877
+ debug2(runtime, "%s.addEventListener(%s, ...)", node.getName(), listener.eventName);
7442
8878
  element.addEventListener(listener.eventName, listener.listener);
7443
8879
  changes++;
7444
8880
  }
@@ -7447,7 +8883,7 @@ function createUpdateListeners(node, listeners, runtime) {
7447
8883
  }
7448
8884
  };
7449
8885
  }
7450
- function createNotifyRef(node, refListener, runtime) {
8886
+ function createNotifyRef2(node, refListener, runtime) {
7451
8887
  return {
7452
8888
  postExecute: () => {
7453
8889
  const ref = node.ref;
@@ -7455,20 +8891,20 @@ function createNotifyRef(node, refListener, runtime) {
7455
8891
  if (!ref) {
7456
8892
  throw new Error("cannot notify ref without a ref");
7457
8893
  }
7458
- debug(runtime, "calling ref [%s]", node.getName());
8894
+ debug2(runtime, "calling ref [%s]", node.getName());
7459
8895
  refListener(ref);
7460
8896
  return changes;
7461
8897
  }
7462
8898
  };
7463
8899
  }
7464
- function createRemoveNode(node, options, runtime) {
8900
+ function createRemoveNode2(node, options, runtime) {
7465
8901
  return {
7466
8902
  isDestructive: true,
7467
8903
  execute: () => {
7468
8904
  const meta = node.state;
7469
8905
  let changes = 0;
7470
8906
  if (node.component && meta) {
7471
- debug(runtime, "[%s].remove()", node.getName());
8907
+ debug2(runtime, "[%s].remove()", node.getName());
7472
8908
  }
7473
8909
  const parent = node.parent;
7474
8910
  if (!parent) {
@@ -7478,7 +8914,7 @@ function createRemoveNode(node, options, runtime) {
7478
8914
  const nodeRef = node.ref;
7479
8915
  if (nodeRef) {
7480
8916
  changes++;
7481
- debug(runtime, "%s.remove()", node.getName());
8917
+ debug2(runtime, "%s.remove()", node.getName());
7482
8918
  nodeRef.remove();
7483
8919
  }
7484
8920
  node.parent = null;
@@ -7486,13 +8922,13 @@ function createRemoveNode(node, options, runtime) {
7486
8922
  }
7487
8923
  };
7488
8924
  }
7489
- function createSetTextAction(node, textContent, runtime) {
8925
+ function createSetTextAction2(node, textContent, runtime) {
7490
8926
  return {
7491
8927
  execute: () => {
7492
8928
  const ref = node.ref;
7493
8929
  let changes = 0;
7494
8930
  if (ref) {
7495
- debug(runtime, "%s.textContent = ...", node.getName());
8931
+ debug2(runtime, "%s.textContent = ...", node.getName());
7496
8932
  ref.textContent = textContent ? textContent : "";
7497
8933
  node.textContent = textContent;
7498
8934
  changes++;
@@ -7501,7 +8937,7 @@ function createSetTextAction(node, textContent, runtime) {
7501
8937
  }
7502
8938
  };
7503
8939
  }
7504
- function createUpdateLastRenderArgs(node, options, runtime, props, children) {
8940
+ function createUpdateLastRenderArgs2(node, options, runtime, props, children) {
7505
8941
  return {
7506
8942
  postExecute: () => {
7507
8943
  node.lastRenderArgs = {
@@ -7512,13 +8948,13 @@ function createUpdateLastRenderArgs(node, options, runtime, props, children) {
7512
8948
  }
7513
8949
  };
7514
8950
  }
7515
- function createSetInnerHTMLAction(node, innerHTML, runtime) {
8951
+ function createSetInnerHTMLAction2(node, innerHTML, runtime) {
7516
8952
  return {
7517
8953
  execute: () => {
7518
8954
  const ref = node.ref;
7519
8955
  let changes = 0;
7520
8956
  if (ref) {
7521
- debug(runtime, "%s.innerHTML = ...", node.getName());
8957
+ debug2(runtime, "%s.innerHTML = ...", node.getName());
7522
8958
  if (innerHTML !== null && innerHTML !== void 0) {
7523
8959
  ref.innerHTML = String(innerHTML);
7524
8960
  changes++;
@@ -7530,16 +8966,8 @@ function createSetInnerHTMLAction(node, innerHTML, runtime) {
7530
8966
  };
7531
8967
  }
7532
8968
 
7533
- // node_modules/@miqro/jsx/build/esm/vdom/nodes/base-node.js
7534
- function setDefaultOptions(options) {
7535
- if (defaultOptionsFuse) {
7536
- throw new Error("cannot override default options once and before an element has been created!");
7537
- }
7538
- defaultOptionsFuse = true;
7539
- DEFAULT_OPTIONS = options;
7540
- Object.freeze(DEFAULT_OPTIONS);
7541
- }
7542
- var BaseNode = class {
8969
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/base-node.js
8970
+ var BaseNode2 = class {
7543
8971
  type;
7544
8972
  parent;
7545
8973
  children = /* @__PURE__ */ new Set();
@@ -7561,7 +8989,7 @@ var BaseNode = class {
7561
8989
  create(runtime, options, change, parent, list) {
7562
8990
  this.parent = parent;
7563
8991
  this.update(runtime, options, change, list, true);
7564
- list.push(createAppendAction(this, runtime));
8992
+ list.push(createAppendAction2(this, runtime));
7565
8993
  this.lastRenderArgs = {
7566
8994
  props: change.props,
7567
8995
  children: change.children
@@ -7581,9 +9009,9 @@ var BaseNode = class {
7581
9009
  }
7582
9010
  }
7583
9011
  if (this.state && this.component) {
7584
- list.push(createFlushEffectsRemove(this, options, runtime));
9012
+ list.push(createFlushEffectsRemove2(this, options, runtime));
7585
9013
  }
7586
- list.push(createRemoveNode(this, options, runtime));
9014
+ list.push(createRemoveNode2(this, options, runtime));
7587
9015
  return this;
7588
9016
  }
7589
9017
  calculateChildren(runtime, options, change, list) {
@@ -7598,10 +9026,10 @@ var BaseNode = class {
7598
9026
  }
7599
9027
  const ref = this.ref;
7600
9028
  const o = options ? {
7601
- ...getDefaultOptions(),
9029
+ ...getDefaultOptions2(),
7602
9030
  ...options ? options : {}
7603
9031
  } : {
7604
- ...getDefaultOptions()
9032
+ ...getDefaultOptions2()
7605
9033
  };
7606
9034
  const shadowInit = o.shadowInit;
7607
9035
  const renderAsFragment = o.asFragment;
@@ -7631,7 +9059,7 @@ var BaseNode = class {
7631
9059
  return this.state.abort;
7632
9060
  }
7633
9061
  };
7634
- var DEFAULT_OPTIONS = {
9062
+ var DEFAULT_OPTIONS2 = {
7635
9063
  /*shadowInit: {
7636
9064
  mode: "closed"
7637
9065
  },
@@ -7640,20 +9068,20 @@ var DEFAULT_OPTIONS = {
7640
9068
  shadowInit: false,
7641
9069
  asFragment: true
7642
9070
  };
7643
- var defaultOptionsFuse = false;
7644
- function getDefaultOptions() {
7645
- defaultOptionsFuse = true;
7646
- return DEFAULT_OPTIONS;
9071
+ var defaultOptionsFuse2 = false;
9072
+ function getDefaultOptions2() {
9073
+ defaultOptionsFuse2 = true;
9074
+ return DEFAULT_OPTIONS2;
7647
9075
  }
7648
9076
 
7649
- // node_modules/@miqro/jsx/build/esm/jsx.js
7650
- var Fragment = /* @__PURE__ */ Symbol("Fragment");
7651
- 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) {
7652
9080
  if (!tag2) {
7653
9081
  throw new Error(`cannot call createElement with [${String(tag2)}] `);
7654
9082
  }
7655
- const isFragment = tag2 === Fragment;
7656
- 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;
7657
9085
  const tagName = typeof tag2 === "string" ? tag2 : isFragment ? "Fragment" : `${!tag2.name ? "no-name" : tag2.name}-component`.toLowerCase();
7658
9086
  return isFragment ? {
7659
9087
  type: "Fragment",
@@ -7671,39 +9099,39 @@ function createElement(tag2, attributes, ...children) {
7671
9099
  children
7672
9100
  };
7673
9101
  }
7674
- var JSX = /* @__PURE__ */ Object.create(null);
7675
- var objectDefineProperty = Object.defineProperty;
7676
- objectDefineProperty(JSX, "createElement", {
9102
+ var JSX2 = /* @__PURE__ */ Object.create(null);
9103
+ var objectDefineProperty3 = Object.defineProperty;
9104
+ objectDefineProperty3(JSX2, "createElement", {
7677
9105
  configurable: false,
7678
9106
  enumerable: true,
7679
9107
  writable: false,
7680
- value: createElement
9108
+ value: createElement2
7681
9109
  });
7682
- objectDefineProperty(JSX, "jsxFactory", {
9110
+ objectDefineProperty3(JSX2, "jsxFactory", {
7683
9111
  configurable: false,
7684
9112
  enumerable: true,
7685
9113
  writable: false,
7686
- value: createElement
9114
+ value: createElement2
7687
9115
  });
7688
- objectDefineProperty(JSX, "Fragment", {
9116
+ objectDefineProperty3(JSX2, "Fragment", {
7689
9117
  configurable: false,
7690
9118
  enumerable: true,
7691
9119
  writable: false,
7692
- value: Fragment
9120
+ value: Fragment3
7693
9121
  });
7694
- objectDefineProperty(JSX, "jsxFragmentFactory", {
9122
+ objectDefineProperty3(JSX2, "jsxFragmentFactory", {
7695
9123
  configurable: false,
7696
9124
  enumerable: true,
7697
9125
  writable: false,
7698
- value: Fragment
9126
+ value: Fragment3
7699
9127
  });
7700
- Object.freeze(JSX);
9128
+ Object.freeze(JSX2);
7701
9129
 
7702
- // node_modules/@miqro/jsx/build/esm/vdom/types.js
7703
- 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"]);
7704
9132
 
7705
- // node_modules/@miqro/jsx/build/esm/vdom/nodes/context-provider.js
7706
- 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 {
7707
9135
  constructor(parent) {
7708
9136
  super("ContextProvider", parent);
7709
9137
  }
@@ -7716,7 +9144,7 @@ var ContextProvider = class extends BaseNode {
7716
9144
  this.parent = parent;
7717
9145
  const children = this.calculateChildren(runtime, options, change, list);
7718
9146
  for (const child of children) {
7719
- createNewNodeFromChange(runtime, options, normalizeChild(runtime, child), this, list);
9147
+ createNewNodeFromChange2(runtime, options, normalizeChild2(runtime, child), this, list);
7720
9148
  }
7721
9149
  return super.create(runtime, options, change, parent, list);
7722
9150
  }
@@ -7726,8 +9154,8 @@ var ContextProvider = class extends BaseNode {
7726
9154
  }
7727
9155
  };
7728
9156
 
7729
- // node_modules/@miqro/jsx/build/esm/vdom/nodes/fragment.js
7730
- var Fragment2 = class extends BaseNode {
9157
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/fragment.js
9158
+ var Fragment4 = class extends BaseNode2 {
7731
9159
  constructor(parent) {
7732
9160
  super("Fragment", parent);
7733
9161
  }
@@ -7735,25 +9163,25 @@ var Fragment2 = class extends BaseNode {
7735
9163
  this.parent = parent;
7736
9164
  const children = this.calculateChildren(runtime, options, change, list);
7737
9165
  for (const child of children) {
7738
- createNewNodeFromChange(runtime, options, normalizeChild(runtime, child), this, list);
9166
+ createNewNodeFromChange2(runtime, options, normalizeChild2(runtime, child), this, list);
7739
9167
  }
7740
9168
  super.create(runtime, options, change, parent, list);
7741
9169
  return this;
7742
9170
  }
7743
9171
  };
7744
9172
 
7745
- // node_modules/@miqro/jsx/build/esm/component/render.js
7746
- var currentContext = null;
7747
- function useConditional(name) {
7748
- 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);
7749
9177
  }
7750
- function useRenderContext() {
7751
- if (!currentContext) {
9178
+ function useRenderContext2() {
9179
+ if (!currentContext2) {
7752
9180
  throw new Error("useContext not in render");
7753
9181
  }
7754
- return currentContext;
9182
+ return currentContext2;
7755
9183
  }
7756
- function renderComponent(runtime, component, options, list, props, children) {
9184
+ function renderComponent2(runtime, component, options, list, props, children) {
7757
9185
  try {
7758
9186
  const meta = component.state;
7759
9187
  const func = component.component;
@@ -7769,11 +9197,11 @@ function renderComponent(runtime, component, options, list, props, children) {
7769
9197
  options,
7770
9198
  runtime
7771
9199
  };
7772
- list.push(createUpdateLastRenderArgs(component, options, runtime, props, children));
7773
- currentContext = null;
7774
- currentContext = context;
9200
+ list.push(createUpdateLastRenderArgs2(component, options, runtime, props, children));
9201
+ currentContext2 = null;
9202
+ currentContext2 = context;
7775
9203
  const output = func(props, children);
7776
- currentContext = null;
9204
+ currentContext2 = null;
7777
9205
  if (meta.lastContextCalls && meta.lastContextCalls.length !== context.calls.length) {
7778
9206
  meta.conditionalUseDetected = true;
7779
9207
  throw new Error("conditional this.use calls detected(3)!");
@@ -7781,11 +9209,11 @@ function renderComponent(runtime, component, options, list, props, children) {
7781
9209
  meta.lastContextCalls = context.calls;
7782
9210
  return [output];
7783
9211
  } catch (e) {
7784
- currentContext = null;
9212
+ currentContext2 = null;
7785
9213
  throw e;
7786
9214
  }
7787
9215
  }
7788
- function pushContextCall(context, name) {
9216
+ function pushContextCall2(context, name) {
7789
9217
  if (!context) {
7790
9218
  throw new Error("not in render(7)");
7791
9219
  }
@@ -7813,8 +9241,8 @@ function pushContextCall(context, name) {
7813
9241
  return key;
7814
9242
  }
7815
9243
 
7816
- // node_modules/@miqro/jsx/build/esm/vdom/nodes/component-fragment.js
7817
- 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 {
7818
9246
  constructor(parent) {
7819
9247
  super(parent);
7820
9248
  this.type = "FragmentComponent";
@@ -7840,8 +9268,8 @@ var FragmentComponent = class extends Fragment2 {
7840
9268
  }
7841
9269
  calculateChildren(runtime, options, change, list) {
7842
9270
  if (this.component && this.state) {
7843
- list.push(createFlushEffects(this, options, runtime));
7844
- 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);
7845
9273
  return out ? out : [];
7846
9274
  } else {
7847
9275
  return change.children ? change.children : [];
@@ -7849,14 +9277,14 @@ var FragmentComponent = class extends Fragment2 {
7849
9277
  }
7850
9278
  };
7851
9279
 
7852
- // node_modules/@miqro/jsx/build/esm/vdom/nodes/element.js
7853
- 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([
7854
9282
  "disabled",
7855
9283
  "checked",
7856
9284
  "selected",
7857
9285
  "hidden"
7858
9286
  ]);
7859
- var Element = class extends BaseNode {
9287
+ var Element2 = class extends BaseNode2 {
7860
9288
  constructor(parent) {
7861
9289
  super("Element", parent);
7862
9290
  }
@@ -7869,7 +9297,7 @@ var Element = class extends BaseNode {
7869
9297
  this.parent = parent;
7870
9298
  const children = this.calculateChildren(runtime, options, change, list);
7871
9299
  for (const child of children) {
7872
- createNewNodeFromChange(runtime, options, normalizeChild(runtime, child), this, list);
9300
+ createNewNodeFromChange2(runtime, options, normalizeChild2(runtime, child), this, list);
7873
9301
  }
7874
9302
  return super.create(runtime, options, change, parent, list);
7875
9303
  }
@@ -7922,7 +9350,7 @@ var Element = class extends BaseNode {
7922
9350
  const attributeName = changePropName === "className" ? "class" : changePropName;
7923
9351
  currentAttributeNames.delete(attributeName);
7924
9352
  const currentAttributeValue = attributeName === "value" ? element.value : attributeName === "checked" ? element.checked : element.getAttribute(attributeName);
7925
- if (typeof changePropValue === "boolean" && ATTRIBUTES_WITHOUT_VALUE.has(attributeName)) {
9353
+ if (typeof changePropValue === "boolean" && ATTRIBUTES_WITHOUT_VALUE2.has(attributeName)) {
7926
9354
  if (attributeName === "checked") {
7927
9355
  if (changePropValue) {
7928
9356
  attributesSet.push({
@@ -7959,29 +9387,29 @@ var Element = class extends BaseNode {
7959
9387
  }
7960
9388
  }
7961
9389
  if (this.currentEventListeners.length > 0) {
7962
- list.push(createRemoveListeners(this, runtime));
9390
+ list.push(createRemoveListeners2(this, runtime));
7963
9391
  }
7964
9392
  if (attributesRemove.length > 0) {
7965
- list.push(createRemoveAttributesAction(this, attributesRemove, runtime));
9393
+ list.push(createRemoveAttributesAction2(this, attributesRemove, runtime));
7966
9394
  }
7967
9395
  if (attributesSet.length > 0) {
7968
- list.push(createSetAttributesAction(this, attributesSet, runtime));
9396
+ list.push(createSetAttributesAction2(this, attributesSet, runtime));
7969
9397
  }
7970
9398
  if (listenerChanges.length > 0) {
7971
- list.push(createUpdateListeners(this, listenerChanges, runtime));
9399
+ list.push(createUpdateListeners2(this, listenerChanges, runtime));
7972
9400
  }
7973
9401
  if (refListener !== null) {
7974
- list.push(createNotifyRef(this, refListener, runtime));
9402
+ list.push(createNotifyRef2(this, refListener, runtime));
7975
9403
  }
7976
9404
  if (setInnerHTMLFlag) {
7977
- list.push(createSetInnerHTMLAction(this, setInnerHTML, runtime));
9405
+ list.push(createSetInnerHTMLAction2(this, setInnerHTML, runtime));
7978
9406
  }
7979
9407
  return super.update(runtime, options, change, list);
7980
9408
  }
7981
9409
  };
7982
-
7983
- // node_modules/@miqro/jsx/build/esm/vdom/nodes/component.js
7984
- 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 {
7985
9413
  constructor(parent) {
7986
9414
  super(parent);
7987
9415
  this.type = "Component";
@@ -8009,11 +9437,11 @@ var Component = class extends Element {
8009
9437
  this.parent = parent;
8010
9438
  const children = this.calculateChildren(runtime, options, change, list);
8011
9439
  for (const child of children) {
8012
- createNewNodeFromChange(runtime, options, normalizeChild(runtime, child), this, list);
9440
+ createNewNodeFromChange2(runtime, options, normalizeChild2(runtime, child), this, list);
8013
9441
  }
8014
9442
  this.parent = parent;
8015
9443
  this.update(runtime, options, change, list, true);
8016
- list.push(createAppendAction(this, runtime));
9444
+ list.push(createAppendAction2(this, runtime));
8017
9445
  this.lastRenderArgs = {
8018
9446
  props: change.props,
8019
9447
  children: change.children
@@ -8022,8 +9450,8 @@ var Component = class extends Element {
8022
9450
  }
8023
9451
  calculateChildren(runtime, options, change, list) {
8024
9452
  if (this.component && this.state) {
8025
- list.push(createFlushEffects(this, options, runtime));
8026
- 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);
8027
9455
  return out ? out : [];
8028
9456
  } else {
8029
9457
  return super.calculateChildren(runtime, options, change, list);
@@ -8031,8 +9459,8 @@ var Component = class extends Element {
8031
9459
  }
8032
9460
  };
8033
9461
 
8034
- // node_modules/@miqro/jsx/build/esm/vdom/nodes/ref.js
8035
- var Ref = class extends BaseNode {
9462
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/ref.js
9463
+ var Ref2 = class extends BaseNode2 {
8036
9464
  constructor(parent) {
8037
9465
  super("Ref", parent);
8038
9466
  }
@@ -8042,7 +9470,7 @@ var Ref = class extends BaseNode {
8042
9470
  }
8043
9471
  this.ref = change.ref;
8044
9472
  this.parent = parent;
8045
- list.push(createAppendAction(this, runtime));
9473
+ list.push(createAppendAction2(this, runtime));
8046
9474
  return this;
8047
9475
  }
8048
9476
  compare(change) {
@@ -8050,8 +9478,8 @@ var Ref = class extends BaseNode {
8050
9478
  }
8051
9479
  };
8052
9480
 
8053
- // node_modules/@miqro/jsx/build/esm/vdom/nodes/text.js
8054
- var Text = class extends BaseNode {
9481
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/nodes/text.js
9482
+ var Text2 = class extends BaseNode2 {
8055
9483
  constructor(parent) {
8056
9484
  super("Text", parent);
8057
9485
  }
@@ -8062,19 +9490,19 @@ var Text = class extends BaseNode {
8062
9490
  this.ref = runtime.createTextNode(change.textContent);
8063
9491
  this.textContent = change.textContent;
8064
9492
  this.parent = parent;
8065
- list.push(createAppendAction(this, runtime));
9493
+ list.push(createAppendAction2(this, runtime));
8066
9494
  return this;
8067
9495
  }
8068
9496
  update(runtime, options, change, list, initial) {
8069
9497
  if (this.textContent !== change.textContent) {
8070
- list.push(createSetTextAction(this, change.textContent, runtime));
9498
+ list.push(createSetTextAction2(this, change.textContent, runtime));
8071
9499
  }
8072
9500
  return this;
8073
9501
  }
8074
9502
  };
8075
9503
 
8076
- // node_modules/@miqro/jsx/build/esm/vdom/tree.js
8077
- var Tree = class extends BaseNode {
9504
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/tree.js
9505
+ var Tree2 = class extends BaseNode2 {
8078
9506
  name;
8079
9507
  constructor(name, ref, runtime, shadowInit) {
8080
9508
  super("Fragment", null);
@@ -8091,27 +9519,27 @@ var Tree = class extends BaseNode {
8091
9519
  return this.name;
8092
9520
  }
8093
9521
  };
8094
- function createNewNodeFromChange(runtime, options, change, parent, list) {
9522
+ function createNewNodeFromChange2(runtime, options, change, parent, list) {
8095
9523
  switch (change.type) {
8096
9524
  case "ContextProvider":
8097
- return new ContextProvider(parent).create(runtime, options, change, parent, list);
9525
+ return new ContextProvider2(parent).create(runtime, options, change, parent, list);
8098
9526
  case "Element":
8099
- return new Element(parent).create(runtime, options, change, parent, list);
9527
+ return new Element2(parent).create(runtime, options, change, parent, list);
8100
9528
  case "Component":
8101
- return new Component(parent).create(runtime, options, change, parent, list);
9529
+ return new Component2(parent).create(runtime, options, change, parent, list);
8102
9530
  case "Ref":
8103
- return new Ref(parent).create(runtime, options, change, parent, list);
9531
+ return new Ref2(parent).create(runtime, options, change, parent, list);
8104
9532
  case "Text":
8105
- return new Text(parent).create(runtime, options, change, parent, list);
9533
+ return new Text2(parent).create(runtime, options, change, parent, list);
8106
9534
  case "Fragment":
8107
- return new Fragment2(parent).create(runtime, options, change, parent, list);
9535
+ return new Fragment4(parent).create(runtime, options, change, parent, list);
8108
9536
  case "FragmentComponent":
8109
- return new FragmentComponent(parent).create(runtime, options, change, parent, list);
9537
+ return new FragmentComponent2(parent).create(runtime, options, change, parent, list);
8110
9538
  default:
8111
9539
  throw new Error(`unsopported change.type = %${change.type}`);
8112
9540
  }
8113
9541
  }
8114
- function normalizeChild(runtime, c) {
9542
+ function normalizeChild2(runtime, c) {
8115
9543
  if (typeof c === "object") {
8116
9544
  if (c instanceof Array) {
8117
9545
  return {
@@ -8123,7 +9551,7 @@ function normalizeChild(runtime, c) {
8123
9551
  type: "Ref",
8124
9552
  ref: c
8125
9553
  };
8126
- } else if (c && CHANGE_TYPES_SET.has(c.type)) {
9554
+ } else if (c && CHANGE_TYPES_SET2.has(c.type)) {
8127
9555
  return c;
8128
9556
  }
8129
9557
  }
@@ -8133,48 +9561,48 @@ function normalizeChild(runtime, c) {
8133
9561
  };
8134
9562
  }
8135
9563
 
8136
- // node_modules/@miqro/jsx/build/esm/vdom/diff.js
8137
- 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) {
8138
9566
  if (changes === void 0 || changes === null || abortSignal.aborted) {
8139
9567
  return actions;
8140
9568
  }
8141
9569
  const currentChildren = tree.children.values();
8142
9570
  let currentChildrenRet = currentChildren.next();
8143
9571
  for (const change of changes) {
8144
- const normalizedChange = normalizeChild(runtime, change);
9572
+ const normalizedChange = normalizeChild2(runtime, change);
8145
9573
  const actualChild = currentChildrenRet.value;
8146
9574
  if (actualChild === void 0) {
8147
- createNewNodeFromChange(runtime, options, normalizedChange, tree, actions);
9575
+ createNewNodeFromChange2(runtime, options, normalizedChange, tree, actions);
8148
9576
  } else if (!actualChild.compare(normalizedChange)) {
8149
- currentChildrenRet = removeFrom(runtime, currentChildren, currentChildrenRet, actions, options);
8150
- createNewNodeFromChange(runtime, options, normalizedChange, tree, actions);
9577
+ currentChildrenRet = removeFrom2(runtime, currentChildren, currentChildrenRet, actions, options);
9578
+ createNewNodeFromChange2(runtime, options, normalizedChange, tree, actions);
8151
9579
  } else {
8152
9580
  actualChild.update(runtime, options, normalizedChange, actions);
8153
9581
  if (actualChild.type === "Fragment" || actualChild.type === "FragmentComponent" || actualChild.type === "ContextProvider") {
8154
9582
  const fragmentActions = [];
8155
- diff(abortSignal, actualChild, actualChild.calculateChildren(runtime, options, normalizedChange, fragmentActions), fragmentActions, options, runtime, true);
8156
- if (areActionDestructive(fragmentActions)) {
9583
+ diff2(abortSignal, actualChild, actualChild.calculateChildren(runtime, options, normalizedChange, fragmentActions), fragmentActions, options, runtime, true);
9584
+ if (areActionDestructive2(fragmentActions)) {
8157
9585
  currentChildrenRet = currentChildren.next();
8158
- currentChildrenRet = removeFrom(runtime, currentChildren, currentChildrenRet, actions, options);
9586
+ currentChildrenRet = removeFrom2(runtime, currentChildren, currentChildrenRet, actions, options);
8159
9587
  }
8160
9588
  actions.push(...fragmentActions);
8161
9589
  } else {
8162
- 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);
8163
9591
  }
8164
9592
  }
8165
9593
  currentChildrenRet = currentChildren.next();
8166
9594
  }
8167
- currentChildrenRet = removeFrom(runtime, currentChildren, currentChildrenRet, actions, options);
9595
+ currentChildrenRet = removeFrom2(runtime, currentChildren, currentChildrenRet, actions, options);
8168
9596
  return actions;
8169
9597
  }
8170
- function removeFrom(runtime, nodeIterator, nodeIteratorRet, currentActions, options) {
9598
+ function removeFrom2(runtime, nodeIterator, nodeIteratorRet, currentActions, options) {
8171
9599
  while (nodeIteratorRet.value !== void 0) {
8172
9600
  nodeIteratorRet.value.remove(runtime, options, currentActions);
8173
9601
  nodeIteratorRet = nodeIterator.next();
8174
9602
  }
8175
9603
  return nodeIteratorRet;
8176
9604
  }
8177
- function areActionDestructive(actions) {
9605
+ function areActionDestructive2(actions) {
8178
9606
  for (const fragmentAction of actions) {
8179
9607
  if (fragmentAction.isDestructive) {
8180
9608
  return true;
@@ -8183,8 +9611,8 @@ function areActionDestructive(actions) {
8183
9611
  return false;
8184
9612
  }
8185
9613
 
8186
- // node_modules/@miqro/jsx/build/esm/vdom/execute.js
8187
- function execute(abortSignal, runtime, actions) {
9614
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/vdom/execute.js
9615
+ function execute2(abortSignal, runtime, actions) {
8188
9616
  if (abortSignal.aborted) {
8189
9617
  return 0;
8190
9618
  }
@@ -8200,7 +9628,7 @@ function execute(abortSignal, runtime, actions) {
8200
9628
  postExecute.push(action);
8201
9629
  }
8202
9630
  } catch (e) {
8203
- error(runtime, e);
9631
+ error2(runtime, e);
8204
9632
  throw e;
8205
9633
  }
8206
9634
  }
@@ -8209,43 +9637,43 @@ function execute(abortSignal, runtime, actions) {
8209
9637
  const actionChanges = action.postExecute();
8210
9638
  changes += actionChanges;
8211
9639
  } catch (e) {
8212
- error(runtime, e);
9640
+ error2(runtime, e);
8213
9641
  throw e;
8214
9642
  }
8215
9643
  }
8216
9644
  return changes;
8217
9645
  }
8218
9646
 
8219
- // node_modules/@miqro/jsx/build/esm/vdom/render.js
8220
- 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) {
8221
9649
  const meta = tree.state;
8222
9650
  if (!meta) {
8223
9651
  throw new Error("cannot find meta");
8224
9652
  }
8225
9653
  const abortSignal = tree.abortApply(runtime).signal;
8226
- debug(runtime, "render for [%s]", tree.getName());
9654
+ debug2(runtime, "render for [%s]", tree.getName());
8227
9655
  if (tree.isRoot || tree.parent !== null) {
8228
9656
  const applyStart = Date.now();
8229
- const out = change instanceof Array ? change : change === true ? renderComponent(runtime, tree, treeOptions, preActions, props, children) : void 0;
8230
- 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));
8231
9659
  const took = Date.now() - applyStart;
8232
9660
  if (took > 5e3) {
8233
- 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);
8234
9662
  } else {
8235
- 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);
8236
9664
  }
8237
9665
  return changes;
8238
9666
  } else {
8239
- debug(runtime, "render skipped for [%s]", tree.getName());
9667
+ debug2(runtime, "render skipped for [%s]", tree.getName());
8240
9668
  return 0;
8241
9669
  }
8242
9670
  }
8243
9671
 
8244
- // node_modules/@miqro/jsx/build/esm/component/container.js
8245
- var objectDefineProperty2 = Object.defineProperty;
8246
- 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) {
8247
9675
  const name = `DOMContainer [${String(element)}]`;
8248
- const tree = new Tree(name, element, runtime, args?.shadowInit);
9676
+ const tree = new Tree2(name, element, runtime, args?.shadowInit);
8249
9677
  const treeOptions = args && args.runtimeOptions ? {
8250
9678
  disableEffects: false,
8251
9679
  disableRefListener: false,
@@ -8259,57 +9687,57 @@ function createContainer(element, runtime, args) {
8259
9687
  disableEvents: false
8260
9688
  };
8261
9689
  const container = /* @__PURE__ */ Object.create(null);
8262
- objectDefineProperty2(container, "name", {
9690
+ objectDefineProperty4(container, "name", {
8263
9691
  configurable: false,
8264
9692
  enumerable: true,
8265
9693
  writable: false,
8266
9694
  value: name
8267
9695
  });
8268
- objectDefineProperty2(container, "render", {
9696
+ objectDefineProperty4(container, "render", {
8269
9697
  configurable: false,
8270
9698
  enumerable: true,
8271
9699
  writable: false,
8272
- value: function render2(out) {
8273
- return render(runtime, tree, treeOptions, [out]);
9700
+ value: function render3(out) {
9701
+ return render2(runtime, tree, treeOptions, [out]);
8274
9702
  }
8275
9703
  });
8276
- objectDefineProperty2(container, "disconnect", {
9704
+ objectDefineProperty4(container, "disconnect", {
8277
9705
  configurable: false,
8278
9706
  enumerable: true,
8279
9707
  writable: false,
8280
9708
  value: function disconnect() {
8281
- return render(runtime, tree, treeOptions, []);
9709
+ return render2(runtime, tree, treeOptions, []);
8282
9710
  }
8283
9711
  });
8284
9712
  Object.freeze(container);
8285
9713
  return container;
8286
9714
  }
8287
9715
 
8288
- // node_modules/@miqro/jsx/build/esm/hooks/runtime.js
8289
- function useRuntime() {
8290
- useConditional("useRuntime");
8291
- const currentContext2 = useRenderContext();
8292
- 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) {
8293
9721
  throw new Error("useRuntime not in render");
8294
9722
  }
8295
- return currentContext2.runtime;
9723
+ return currentContext3.runtime;
8296
9724
  }
8297
9725
 
8298
- // node_modules/@miqro/jsx/build/esm/hooks/refresh.js
8299
- var REFRESH_TIMEOUT_MS = 0;
8300
- function useRefresh() {
8301
- useConditional("useRefresh");
8302
- const currentContext2 = useRenderContext();
8303
- 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) {
8304
9732
  throw new Error("useRefresh not in render");
8305
9733
  }
8306
- const meta = currentContext2.node.state;
9734
+ const meta = currentContext3.node.state;
8307
9735
  if (!meta) {
8308
9736
  throw new Error("useRefresh without meta");
8309
9737
  }
8310
- const runtime = useRuntime();
8311
- const options = currentContext2.options;
8312
- const node = currentContext2.node;
9738
+ const runtime = useRuntime2();
9739
+ const options = currentContext3.options;
9740
+ const node = currentContext3.node;
8313
9741
  const component = node.component;
8314
9742
  if (!component) {
8315
9743
  throw new Error("useRefresh without func");
@@ -8317,31 +9745,31 @@ function useRefresh() {
8317
9745
  return (cb) => {
8318
9746
  runtime.clearTimeout(meta.refreshTimeout);
8319
9747
  if (options.disableRefresh) {
8320
- debug(runtime, "useRefresh.refresh() disabled for [%s]", component.name);
9748
+ debug2(runtime, "useRefresh.refresh() disabled for [%s]", component.name);
8321
9749
  } else {
8322
9750
  meta.refreshTimeout = runtime.setTimeout(() => {
8323
- debug(runtime, "useRefresh.refresh() for [%s]", component.name);
9751
+ debug2(runtime, "useRefresh.refresh() for [%s]", component.name);
8324
9752
  const props = node.lastRenderArgs.props;
8325
9753
  const children = node.lastRenderArgs.children;
8326
- 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);
8327
9755
  if (cb) {
8328
9756
  runtime.setTimeout(() => cb(changes), 0);
8329
9757
  }
8330
- }, REFRESH_TIMEOUT_MS);
9758
+ }, REFRESH_TIMEOUT_MS2);
8331
9759
  }
8332
9760
  };
8333
9761
  }
8334
9762
 
8335
- // node_modules/@miqro/jsx/build/esm/hooks/state.js
8336
- function useState(defaultValue) {
8337
- const key = useConditional("useState");
8338
- const currentContext2 = useRenderContext();
8339
- 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) {
8340
9768
  throw new Error("useState not in render");
8341
9769
  }
8342
- const refresh = useRefresh();
8343
- const meta = currentContext2.node.state;
8344
- const runtime = useRuntime();
9770
+ const refresh = useRefresh2();
9771
+ const meta = currentContext3.node.state;
9772
+ const runtime = useRuntime2();
8345
9773
  if (!meta) {
8346
9774
  throw new Error("useState without meta");
8347
9775
  }
@@ -8351,13 +9779,13 @@ function useState(defaultValue) {
8351
9779
  if (!meta.state) {
8352
9780
  throw new Error("useState without meta.state");
8353
9781
  }
8354
- const name = currentContext2.node.component?.name;
9782
+ const name = currentContext3.node.component?.name;
8355
9783
  const currentStateItem = meta.state[key];
8356
9784
  if (currentStateItem === void 0) {
8357
9785
  const stateItem = {
8358
9786
  value: defaultValue,
8359
9787
  set: (newValue, refreshOnSet = true) => {
8360
- debug(runtime, "setState() for [%s]", name);
9788
+ debug2(runtime, "setState() for [%s]", name);
8361
9789
  if (stateItem.value !== newValue) {
8362
9790
  stateItem.value = newValue;
8363
9791
  if (refreshOnSet) {
@@ -8384,19 +9812,19 @@ function useState(defaultValue) {
8384
9812
  }
8385
9813
  }
8386
9814
 
8387
- // node_modules/@miqro/jsx/build/esm/hooks/effect.js
8388
- function useEffect(effect, condition) {
8389
- const currentContext2 = useRenderContext();
8390
- 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) {
8391
9819
  throw new Error("useEffect not in render");
8392
9820
  }
8393
- const key = useConditional("useEffect");
8394
- const meta = currentContext2.node.state;
9821
+ const key = useConditional2("useEffect");
9822
+ const meta = currentContext3.node.state;
8395
9823
  if (!meta) {
8396
9824
  throw new Error("useEffect without meta");
8397
9825
  }
8398
9826
  const c = condition ? condition : false;
8399
- 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)) {
8400
9828
  meta.effectConditions[key] = c;
8401
9829
  const oldCallback = meta.effectQueueCallbacks[key];
8402
9830
  delete meta.effectQueueCallbacks[key];
@@ -8410,7 +9838,7 @@ function useEffect(effect, condition) {
8410
9838
  meta.effects[key] = effect;
8411
9839
  }
8412
9840
  }
8413
- function equalArray(a, c) {
9841
+ function equalArray2(a, c) {
8414
9842
  if (typeof a !== typeof c) {
8415
9843
  return false;
8416
9844
  }
@@ -8430,13 +9858,13 @@ function equalArray(a, c) {
8430
9858
  return true;
8431
9859
  }
8432
9860
 
8433
- // node_modules/@miqro/jsx/build/esm/hooks/pathname.js
8434
- function usePathname() {
8435
- const runtime = useRuntime();
9861
+ // ../jsx-node/node_modules/@miqro/jsx/build/esm/hooks/pathname.js
9862
+ function usePathname2() {
9863
+ const runtime = useRuntime2();
8436
9864
  const pathname = runtime.getLocation().pathname;
8437
- const [currentLocation, setCurrentLocation, getL] = useState(pathname);
8438
- debug(runtime, "usePathname [%s]", currentLocation);
8439
- useEffect(function usePathnameEffect() {
9865
+ const [currentLocation, setCurrentLocation, getL] = useState2(pathname);
9866
+ debug2(runtime, "usePathname [%s]", currentLocation);
9867
+ useEffect2(function usePathnameEffect() {
8440
9868
  const listener = () => {
8441
9869
  const newLocation = runtime.getLocation().pathname;
8442
9870
  setCurrentLocation(newLocation);
@@ -8449,32 +9877,32 @@ function usePathname() {
8449
9877
  return String(currentLocation);
8450
9878
  }
8451
9879
 
8452
- // node_modules/@miqro/jsx/build/esm/component/router.js
8453
- function useIsLocationPathNameActive(path) {
8454
- useConditional("useIsLocationPathNameMatch");
8455
- 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();
8456
9884
  const basePath = runtime.getBasePath();
8457
- return isPathLocation(basePath, path, usePathname());
9885
+ return isPathLocation2(basePath, path, usePathname2());
8458
9886
  }
8459
- function Router(props) {
9887
+ function Router2(props) {
8460
9888
  const defaultElement = props.defaultElement;
8461
- const locationPathName = usePathname();
8462
- const runtime = useRuntime();
8463
- const active = getActiveRoute(locationPathName, props.routes, runtime);
9889
+ const locationPathName = usePathname2();
9890
+ const runtime = useRuntime2();
9891
+ const active = getActiveRoute2(locationPathName, props.routes, runtime);
8464
9892
  return active ? active.element : defaultElement;
8465
9893
  }
8466
- Router.asFragment = true;
8467
- Router.shadowInit = false;
8468
- function Link(props, children) {
9894
+ Router2.asFragment = true;
9895
+ Router2.shadowInit = false;
9896
+ function Link2(props, children) {
8469
9897
  const path = props.path;
8470
- const runtime = useRuntime();
9898
+ const runtime = useRuntime2();
8471
9899
  const basePath = runtime.getBasePath();
8472
9900
  const className = props.className ? props.className : "";
8473
9901
  const activeClass = props.classNameActive ? props.classNameActive : "active";
8474
9902
  const inactiveClass = props.classNameInactive ? props.classNameInactive : "inactive";
8475
- const isActive = useIsLocationPathNameActive(path);
9903
+ const isActive = useIsLocationPathNameActive2(path);
8476
9904
  const newClassName = `${className ? `${className} ` : ""}${isActive ? activeClass : inactiveClass}`;
8477
- const fullPath = getFullPath(basePath, path);
9905
+ const fullPath = getFullPath2(basePath, path);
8478
9906
  const element = {
8479
9907
  type: "Element",
8480
9908
  tagName: "a",
@@ -8495,181 +9923,35 @@ function Link(props, children) {
8495
9923
  }
8496
9924
  };
8497
9925
  }
8498
- Link.asFragment = true;
8499
- Link.shadowInit = false;
8500
- function getFullPath(basePath, p) {
8501
- return normalizePath(`${basePath ? basePath : ""}${p}`);
9926
+ Link2.asFragment = true;
9927
+ Link2.shadowInit = false;
9928
+ function getFullPath2(basePath, p) {
9929
+ return normalizePath2(`${basePath ? basePath : ""}${p}`);
8502
9930
  }
8503
- function isPathLocation(basePath, p, currentLocation) {
8504
- const path = getFullPath(basePath, p);
8505
- const pathname = normalizePath(currentLocation);
9931
+ function isPathLocation2(basePath, p, currentLocation) {
9932
+ const path = getFullPath2(basePath, p);
9933
+ const pathname = normalizePath2(currentLocation);
8506
9934
  return pathname.toLocaleLowerCase() === path.toLowerCase();
8507
9935
  }
8508
- function getActiveRoute(locationPathName, routes, runtime) {
9936
+ function getActiveRoute2(locationPathName, routes, runtime) {
8509
9937
  let activeRoute;
8510
9938
  const basePath = runtime.getBasePath() ? runtime.getBasePath() : "";
8511
9939
  for (const route of routes) {
8512
- if (isPathLocation(basePath, route.path, locationPathName)) {
9940
+ if (isPathLocation2(basePath, route.path, locationPathName)) {
8513
9941
  activeRoute = route;
8514
9942
  break;
8515
9943
  }
8516
9944
  }
8517
9945
  return activeRoute;
8518
9946
  }
8519
- function normalizePath(path) {
9947
+ function normalizePath2(path) {
8520
9948
  if (path.length > 1 && path.charAt(path.length - 1) === "/") {
8521
9949
  path = path.substring(0, path.length - 1);
8522
9950
  }
8523
9951
  return path;
8524
9952
  }
8525
9953
 
8526
- // node_modules/@miqro/jsx/build/esm/hooks/ref.js
8527
- function useRef() {
8528
- const [ref, setRef] = useState(null);
8529
- function useRefFunction(newRef) {
8530
- setRef(newRef);
8531
- }
8532
- ;
8533
- useRefFunction.current = ref;
8534
- return useRefFunction;
8535
- }
8536
-
8537
- // node_modules/@miqro/jsx/build/esm/hooks/query.js
8538
- function useAllQuery(watch2 = true) {
8539
- const key = useConditional(`useAllQuery`);
8540
- const runtime = useRuntime();
8541
- const [last, setLast, getLast] = useState(getQueryValue(runtime));
8542
- useEffect(function useQueryEffect() {
8543
- if (watch2) {
8544
- let useQueryEffectPathListener = function() {
8545
- const current = getQueryValue(runtime);
8546
- if (getLast() !== current) {
8547
- debug(runtime, "useQuery listener for %s", key);
8548
- setLast(current);
8549
- }
8550
- };
8551
- runtime.addPathListener(useQueryEffectPathListener);
8552
- return function useQueryEffectUnLoad() {
8553
- runtime.removePathListener(useQueryEffectPathListener);
8554
- };
8555
- }
8556
- }, []);
8557
- return last;
8558
- }
8559
- function useQuery(name, defaultValue, watch2 = true) {
8560
- const key = useConditional(`useQuery-${name}-${defaultValue}`);
8561
- const runtime = useRuntime();
8562
- const [last, setLast, getLast] = useState(getQueryValue(runtime, name, defaultValue));
8563
- useEffect(function useQueryEffect() {
8564
- if (watch2) {
8565
- let useQueryEffectPathListener = function() {
8566
- const current = getQueryValue(runtime, name, defaultValue);
8567
- if (getLast() !== current) {
8568
- debug(runtime, "useQuery listener for %s", key);
8569
- setLast(current);
8570
- }
8571
- };
8572
- runtime.addPathListener(useQueryEffectPathListener);
8573
- return function useQueryEffectUnLoad() {
8574
- runtime.removePathListener(useQueryEffectPathListener);
8575
- };
8576
- }
8577
- }, []);
8578
- return [
8579
- last,
8580
- function setQuery(newValue) {
8581
- setQueryValue(runtime, name, newValue, watch2);
8582
- setLast(newValue);
8583
- },
8584
- function getQuery() {
8585
- return getQueryValue(runtime, name, defaultValue);
8586
- }
8587
- ];
8588
- }
8589
- function getQueryValue(runtime, name, defaultValue) {
8590
- if (!name) {
8591
- return runtime.getLocation().searchParams.toString();
8592
- } else {
8593
- const ret = runtime.getLocation().searchParams.getAll(name);
8594
- if (ret.length === 0) {
8595
- return defaultValue !== void 0 ? defaultValue : null;
8596
- }
8597
- return ret && ret.length === 1 && !(defaultValue instanceof Array) ? ret[0] : ret;
8598
- }
8599
- }
8600
- function setQueryValue(runtime, name, value, watch2 = true) {
8601
- const url = runtime.getLocation();
8602
- if (value instanceof Array) {
8603
- url.searchParams.delete(name);
8604
- for (const v of value) {
8605
- url.searchParams.append(name, v);
8606
- }
8607
- } else if (value !== null) {
8608
- url.searchParams.set(name, value);
8609
- } else {
8610
- url.searchParams.delete(name);
8611
- }
8612
- if (watch2) {
8613
- runtime.pushPath(String(url));
8614
- }
8615
- }
8616
-
8617
- // node_modules/@miqro/jsx/build/esm/hooks/useelement.js
8618
- function useElement() {
8619
- useConditional("useElement");
8620
- const currentContext2 = useRenderContext();
8621
- if (!currentContext2) {
8622
- throw new Error("useElement not in render");
8623
- }
8624
- return currentContext2.node.ref ? currentContext2.node.ref : null;
8625
- }
8626
-
8627
- // node_modules/@miqro/jsx/build/esm/hooks/context.js
8628
- function createContext(defaultValue) {
8629
- const symbol = /* @__PURE__ */ Symbol();
8630
- return {
8631
- provider: createContextProvider(symbol, defaultValue),
8632
- symbol
8633
- };
8634
- }
8635
- function useContext(context) {
8636
- useConditional("useContext");
8637
- const currentContext2 = useRenderContext();
8638
- if (!currentContext2) {
8639
- throw new Error("useContext not in render");
8640
- }
8641
- let currentNode = currentContext2.node;
8642
- while (currentNode) {
8643
- if (currentNode.type === "ContextProvider" && currentNode.contextKey === context.symbol) {
8644
- return currentNode.contextValue;
8645
- }
8646
- currentNode = currentNode.parent;
8647
- }
8648
- throw new Error("cannot find provider!");
8649
- }
8650
- function createContextProvider(symbol, defaultValue) {
8651
- function ContextProvider2({ value }, ...children) {
8652
- useConditional("ContextProvider");
8653
- const currentContext2 = useRenderContext();
8654
- if (!currentContext2) {
8655
- throw new Error("ContextProvider not in render");
8656
- }
8657
- return {
8658
- type: "ContextProvider",
8659
- contextKey: symbol,
8660
- contextValue: value === void 0 ? defaultValue : value,
8661
- children
8662
- };
8663
- }
8664
- ContextProvider2.asFragment = true;
8665
- ContextProvider2.shadowInit = false;
8666
- return ContextProvider2;
8667
- }
8668
-
8669
- // node_modules/@miqro/jsx/build/esm/lib.js
8670
- var lib_default = JSX;
8671
-
8672
- // node_modules/@miqro/jsx-node/build/esm/runtime.js
9954
+ // ../jsx-node/build/esm/runtime.js
8673
9955
  var import_events = require("events");
8674
9956
  var SELF_CLOSING_TAGS = /* @__PURE__ */ new Set([
8675
9957
  "area",
@@ -8782,7 +10064,7 @@ var SSRAttributeMap = class extends Map {
8782
10064
  kIterator = keys.next();
8783
10065
  }
8784
10066
  if (this.node.value) {
8785
- ret = `${ret} ${AttributeEncode("value")}="${this.node.value}"`;
10067
+ ret = `${ret} ${AttributeEncode("value")}="${AttributeEncode(String(this.node.value))}"`;
8786
10068
  }
8787
10069
  return ret;
8788
10070
  }
@@ -8931,7 +10213,7 @@ function HTMLEncode(str) {
8931
10213
  return aRet.join("");
8932
10214
  }
8933
10215
  function AttributeEncode(str) {
8934
- return str.replaceAll('"', "&quot;");
10216
+ return str.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
8935
10217
  }
8936
10218
  var containerMap = /* @__PURE__ */ new WeakMap();
8937
10219
  var originalChildNodesMap = /* @__PURE__ */ new WeakMap();
@@ -8958,7 +10240,7 @@ function runtimeDefine(runtime, tagName, component, options) {
8958
10240
  props[name] = self.getAttribute(name);
8959
10241
  }
8960
10242
  props["$element$"] = self;
8961
- container.render(createElement(component, props, originalChildNodes));
10243
+ container.render(createElement2(component, props, originalChildNodes));
8962
10244
  }
8963
10245
  disconnectedCallback() {
8964
10246
  const container = containerMap.get(this);
@@ -8982,7 +10264,7 @@ function runtimeDefine(runtime, tagName, component, options) {
8982
10264
  props[name] = self.getAttribute(name);
8983
10265
  }
8984
10266
  props["$element$"] = self;
8985
- container.render(createElement(component, props, originalChildNodes));
10267
+ container.render(createElement2(component, props, originalChildNodes));
8986
10268
  }
8987
10269
  reCalculateOriginalChildren() {
8988
10270
  if (originalChildNodesMap.has(this)) {
@@ -9022,7 +10304,7 @@ function createNodeRuntime(options) {
9022
10304
  basePath: options?.basePath
9023
10305
  };
9024
10306
  const customElementMap = {};
9025
- const elementByIdMap = {};
10307
+ const elementByIdMap = /* @__PURE__ */ Object.create(null);
9026
10308
  const runtime = {
9027
10309
  name: "node",
9028
10310
  customElementMap,
@@ -9043,7 +10325,7 @@ function createNodeRuntime(options) {
9043
10325
  return runtime._activeElement;
9044
10326
  },
9045
10327
  createContainer: (element, options2) => {
9046
- return createContainer(element, runtime, options2);
10328
+ return createContainer2(element, runtime, options2);
9047
10329
  },
9048
10330
  getElementById: (id) => {
9049
10331
  return elementByIdMap[id] ? elementByIdMap[id] : null;
@@ -9083,13 +10365,6 @@ function createNodeRuntime(options) {
9083
10365
  return runtime;
9084
10366
  }
9085
10367
 
9086
- // node_modules/@miqro/jsx-node/build/esm/handler.js
9087
- init_lib3();
9088
-
9089
- // node_modules/@miqro/jsx-node/build/esm/constants.js
9090
- var import_os = require("os");
9091
- var DEFAULT_BUILD_DIR = (0, import_os.tmpdir)();
9092
-
9093
10368
  // src/common/jsx.ts
9094
10369
  var import_node_path6 = require("node:path");
9095
10370
  var import_node_crypto4 = require("node:crypto");
@@ -10374,17 +11649,17 @@ async function sqlite3Executor(config) {
10374
11649
  transformOutput: sqliteTransformOutput,
10375
11650
  query: async function sqlite3Executor2(sql, values) {
10376
11651
  return new Promise((resolve24, reject) => {
10377
- const st = driver.prepare(sql, values, function(error2) {
10378
- if (error2) {
10379
- reject(error2);
11652
+ const st = driver.prepare(sql, values, function(error3) {
11653
+ if (error3) {
11654
+ reject(error3);
10380
11655
  } else {
10381
- st.all(function(error3, rows) {
10382
- if (error3) {
10383
- reject(error3);
11656
+ st.all(function(error4, rows) {
11657
+ if (error4) {
11658
+ reject(error4);
10384
11659
  } else {
10385
- st.finalize((error4) => {
10386
- if (error4) {
10387
- reject(error4);
11660
+ st.finalize((error5) => {
11661
+ if (error5) {
11662
+ reject(error5);
10388
11663
  } else {
10389
11664
  resolve24(rows);
10390
11665
  }
@@ -11679,7 +12954,7 @@ var ClusterWebSocketServer2 = class extends WebSocketServer {
11679
12954
  return options.validate ? options.validate(req) : true;
11680
12955
  }
11681
12956
  },
11682
- onError: (req, error2) => {
12957
+ onError: (req, error3) => {
11683
12958
  if (process.send) {
11684
12959
  process.send({
11685
12960
  type: ClusterWebSocketServer2MessageType,
@@ -11687,13 +12962,13 @@ var ClusterWebSocketServer2 = class extends WebSocketServer {
11687
12962
  target: this.name,
11688
12963
  clientUUID: req.uuid,
11689
12964
  fromPID: String(process.pid),
11690
- errorMessage: error2.message
12965
+ errorMessage: error3.message
11691
12966
  });
11692
12967
  }
11693
- this.logger?.error("[%s] error from (%s) error [%s]", req.uuid, req.req.socket.remoteAddress, error2);
11694
- 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);
11695
12970
  if (options.onError) {
11696
- options.onError(req, error2);
12971
+ options.onError(req, error3);
11697
12972
  }
11698
12973
  },
11699
12974
  onConnection: (req) => {
@@ -12383,7 +13658,7 @@ var LogProvider = class {
12383
13658
  try {
12384
13659
  const url = newURL2(req.url ? req.url : "/");
12385
13660
  query = url.searchParams.toString();
12386
- path = normalizePath2(url.pathname);
13661
+ path = normalizePath3(url.pathname);
12387
13662
  method = req.method ? req.method.toUpperCase() : "GET";
12388
13663
  remoteAddress = req.socket.remoteAddress;
12389
13664
  } catch (e) {
@@ -12704,7 +13979,7 @@ function getRoutes(prePath, defaultPath, apiOptions) {
12704
13979
  inflatePath: p !== "/" ? (0, import_node_path9.join)(prePath, p) : defaultInflatePath,
12705
13980
  defaultInflatePath,
12706
13981
  method: m.toLocaleLowerCase() !== "use" ? m.toUpperCase() : void 0,
12707
- path: normalizePath2((0, import_node_path9.join)(prePath, p))
13982
+ path: normalizePath3((0, import_node_path9.join)(prePath, p))
12708
13983
  });
12709
13984
  }
12710
13985
  }
@@ -12817,7 +14092,7 @@ async function setupError(logger, servicePath, service, mainRouter, inflateDir,
12817
14092
 
12818
14093
  // src/inflate/setup-http.ts
12819
14094
  async function setupHTTPRouter(importOptions, inflateOptions, server, logger, hotreload, servicePath, service, routeFileMap, staticFileMap, inflateDir, inflateSea, errors, inflateParallel) {
12820
- const mainRouter = new Router2();
14095
+ const mainRouter = new Router3();
12821
14096
  const apiRouterPath = getHTTPRouterPath(servicePath);
12822
14097
  let middlewareConfig = null;
12823
14098
  await setupError(logger, servicePath, service, mainRouter, inflateDir, inflateSea, importOptions, errors);
@@ -12855,7 +14130,7 @@ async function createStaticRoute(inflateJSXOptions, service, logger, router, dir
12855
14130
  routeFileMap[file.filePath] = {
12856
14131
  routes: [{
12857
14132
  method: "GET",
12858
- path: normalizePath2(path)
14133
+ path: normalizePath3(path)
12859
14134
  }],
12860
14135
  service,
12861
14136
  filePath: file.filePath,
@@ -12879,7 +14154,7 @@ async function createStaticRoute(inflateJSXOptions, service, logger, router, dir
12879
14154
  filePath: file.filePath,
12880
14155
  previewMethod: "html",
12881
14156
  method: "GET",
12882
- path: normalizePath2(path),
14157
+ path: normalizePath3(path),
12883
14158
  body: Buffer.from(body),
12884
14159
  inflatePath: inflateDir ? (0, import_node_path12.join)(inflateDir, !inflateJSXOptions.inflateFlat ? service : "", "static", path) : void 0
12885
14160
  };
@@ -12921,7 +14196,7 @@ async function createStaticRoute(inflateJSXOptions, service, logger, router, dir
12921
14196
  });
12922
14197
  }
12923
14198
  async function createStaticRouterFromDirectory(inflateOptions, service, logger, dir, inflateDir, routeFileMap, staticFileMap, inflateParallel) {
12924
- const router = new Router2();
14199
+ const router = new Router3();
12925
14200
  const maxParallel = inflateParallel ? inflateParallel : 1;
12926
14201
  logger.debug("loading static directory with parallel [%s]", maxParallel);
12927
14202
  let tR = [];
@@ -12940,7 +14215,7 @@ async function createStaticRouterFromDirectory(inflateOptions, service, logger,
12940
14215
  return router;
12941
14216
  }
12942
14217
  async function createRouterFromDirectory(importOptions, inflateJSXOptions, server, hotreload, service, logger, dir, errors = [], routeFileMap = {}, staticFileMap = null, inflateDir, inflateSea, inflateParallel) {
12943
- const router = new Router2();
14218
+ const router = new Router3();
12944
14219
  const maxParallel = inflateParallel ? inflateParallel : 1;
12945
14220
  server.logger.debug("loading http directory with parallel [%s]", maxParallel);
12946
14221
  let tR = [];
@@ -14052,7 +15327,7 @@ async function inflateApp({ inflateParallel, serverInterface, logger, hotreload,
14052
15327
  const errors = [];
14053
15328
  let routeFileMap = {};
14054
15329
  const wsConfigList = [];
14055
- const router = new Router2();
15330
+ const router = new Router3();
14056
15331
  const logConfigMap = {};
14057
15332
  for (const service of services) {
14058
15333
  const serviceRouteFileMap = {};
@@ -14216,8 +15491,8 @@ var server_default = {
14216
15491
  init_lib3();
14217
15492
  init_constants();
14218
15493
  async function createEditorRouter(adminInterface) {
14219
- const router = new Router2();
14220
- const innerRouter = new Router2();
15494
+ const router = new Router3();
15495
+ const innerRouter = new Router3();
14221
15496
  innerRouter.use(async (req, res) => {
14222
15497
  res.setHeader("x-uuid", req.uuid);
14223
15498
  req.editor = adminInterface;
@@ -14391,13 +15666,13 @@ function setupExitHandlers(app) {
14391
15666
  }
14392
15667
  process.exit(EXIT_CODES.ABNORMAL_UNCONTROLLED);
14393
15668
  });
14394
- process.on("exit", function(code) {
15669
+ process.on("exit", async function(code) {
14395
15670
  if (exceptionOccured) {
14396
15671
  app.logger?.error("Exception occured");
14397
15672
  } else {
14398
15673
  cleanJSX(app);
14399
15674
  if (app.server) {
14400
- app.stop();
15675
+ await app.stop();
14401
15676
  }
14402
15677
  }
14403
15678
  });
@@ -17514,7 +18789,7 @@ var Miqro = class _Miqro {
17514
18789
  }
17515
18790
  this.inflated = void 0;
17516
18791
  this.inflated = {
17517
- router: inflated && inflated.router ? inflated.router : new Router2(),
18792
+ router: inflated && inflated.router ? inflated.router : new Router3(),
17518
18793
  errors: inflated && inflated.errors ? inflated.errors : [],
17519
18794
  fileMap: inflated && inflated.fileMap ? inflated.fileMap : {},
17520
18795
  logConfigMap: inflated && inflated.logConfigMap ? inflated.logConfigMap : {},
@@ -17601,7 +18876,7 @@ var Miqro = class _Miqro {
17601
18876
  _Miqro.initAssetsPromise = initAssets(this.logger);
17602
18877
  }
17603
18878
  await _Miqro.initAssetsPromise;
17604
- const router = new Router2();
18879
+ const router = new Router3();
17605
18880
  const wsConfigList = [];
17606
18881
  const { dbList, errors: dbConfigErrors } = await this.loadDBConfig(options);
17607
18882
  await Promise.all(dbList.map((db) => this.dbManager.setupDB(db.dbConfig)));
@@ -17620,7 +18895,7 @@ var Miqro = class _Miqro {
17620
18895
  path: HOT_RELOAD_PATH
17621
18896
  });
17622
18897
  this.logger?.debug("setting up hot-reload script on [%s]", HOT_RELOAD_SCRIPT_PATH);
17623
- const hotReloadScriptRouter = new Router2();
18898
+ const hotReloadScriptRouter = new Router3();
17624
18899
  hotReloadScriptRouter.get(HOT_RELOAD_SCRIPT_PATH, async (req, res) => res.js(HOT_RELOAD_JS_SCRIPT));
17625
18900
  router.use(hotReloadScriptRouter);
17626
18901
  }
@@ -17694,10 +18969,10 @@ var Miqro = class _Miqro {
17694
18969
  this.connect();
17695
18970
  await this.dbManager.connectAll();
17696
18971
  this.server = new App({
17697
- onUpgrade: (req, socket, head) => {
18972
+ onUpgrade: async (req, socket, head) => {
17698
18973
  try {
17699
18974
  req.server = this.serverInterface;
17700
- return this.webSocketManager.onUpgrade(req, socket, head);
18975
+ return await this.webSocketManager.onUpgrade(req, socket, head);
17701
18976
  } catch (e) {
17702
18977
  this.logger?.error(e);
17703
18978
  }
@@ -17939,7 +19214,7 @@ async function appendAPIModule(router, dir, filePath, module2) {
17939
19214
 
17940
19215
  // src/lib.ts
17941
19216
  init_lib3();
17942
- var JSX2 = {
19217
+ var JSX3 = {
17943
19218
  createElement: (...args) => {
17944
19219
  const ret = createElement(...args);
17945
19220
  ret.toString = () => jsx2HTML(ret);