@dooboostore/simple-boot-http-server 1.0.26 → 1.0.28
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/README.md +138 -17
- package/dist/cjs/SimpleBootHttpServer.js +33 -16
- package/dist/cjs/SimpleBootHttpServer.js.map +2 -2
- package/dist/cjs/codes/Mimes.js +2 -0
- package/dist/cjs/codes/Mimes.js.map +2 -2
- package/dist/cjs/decorators/MethodMapping.js +2 -2
- package/dist/cjs/decorators/MethodMapping.js.map +2 -2
- package/dist/cjs/filters/ResourceFilter.js +0 -1
- package/dist/cjs/filters/ResourceFilter.js.map +2 -2
- package/dist/cjs/models/RequestResponse.js +52 -0
- package/dist/cjs/models/RequestResponse.js.map +3 -3
- package/dist/cjs/proxy/RequestResponseInjectProxy.js +35 -0
- package/dist/cjs/proxy/RequestResponseInjectProxy.js.map +7 -0
- package/dist/cjs/proxy/SymbolIntentApiServiceProxy.js +1 -1
- package/dist/cjs/proxy/SymbolIntentApiServiceProxy.js.map +2 -2
- package/dist/cjs/proxy/index.js +3 -1
- package/dist/cjs/proxy/index.js.map +2 -2
- package/dist/cjs/resolvers/Resolver.js.map +1 -1
- package/dist/cjs/websocket/WebSocketManager.js +68 -40
- package/dist/cjs/websocket/WebSocketManager.js.map +2 -2
- package/dist/esm/SimpleBootHttpServer.js +34 -17
- package/dist/esm/SimpleBootHttpServer.js.map +2 -2
- package/dist/esm/codes/Mimes.js +2 -0
- package/dist/esm/codes/Mimes.js.map +2 -2
- package/dist/esm/decorators/MethodMapping.js +2 -2
- package/dist/esm/decorators/MethodMapping.js.map +2 -2
- package/dist/esm/filters/ResourceFilter.js +0 -1
- package/dist/esm/filters/ResourceFilter.js.map +2 -2
- package/dist/esm/models/RequestResponse.js +52 -0
- package/dist/esm/models/RequestResponse.js.map +2 -2
- package/dist/esm/proxy/RequestResponseInjectProxy.js +12 -0
- package/dist/esm/proxy/RequestResponseInjectProxy.js.map +7 -0
- package/dist/esm/proxy/SymbolIntentApiServiceProxy.js +1 -1
- package/dist/esm/proxy/SymbolIntentApiServiceProxy.js.map +2 -2
- package/dist/esm/proxy/index.js +1 -0
- package/dist/esm/proxy/index.js.map +2 -2
- package/dist/esm/websocket/WebSocketManager.js +68 -40
- package/dist/esm/websocket/WebSocketManager.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js +572 -387
- package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js.map +4 -4
- package/dist/types/SimpleBootHttpServer.d.ts.map +1 -1
- package/dist/types/codes/Mimes.d.ts +2 -0
- package/dist/types/codes/Mimes.d.ts.map +1 -1
- package/dist/types/decorators/MethodMapping.d.ts +13 -8
- package/dist/types/decorators/MethodMapping.d.ts.map +1 -1
- package/dist/types/filters/ResourceFilter.d.ts.map +1 -1
- package/dist/types/models/RequestResponse.d.ts +9 -0
- package/dist/types/models/RequestResponse.d.ts.map +1 -1
- package/dist/types/proxy/RequestResponseInjectProxy.d.ts +22 -0
- package/dist/types/proxy/RequestResponseInjectProxy.d.ts.map +1 -0
- package/dist/types/proxy/index.d.ts +1 -0
- package/dist/types/proxy/index.d.ts.map +1 -1
- package/dist/types/resolvers/Resolver.d.ts +2 -1
- package/dist/types/resolvers/Resolver.d.ts.map +1 -1
- package/dist/types/websocket/WebSocketManager.d.ts +3 -1
- package/dist/types/websocket/WebSocketManager.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js +572 -387
- package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js.map +4 -4
- package/dist/umd-bundle/websocket-client.umd.js +315 -149
- package/dist/umd-bundle/websocket-client.umd.js.map +4 -4
- package/package.json +9 -9
- package/src/SimpleBootHttpServer.ts +38 -17
- package/src/codes/Mimes.ts +2 -0
- package/src/decorators/MethodMapping.ts +151 -152
- package/src/filters/ResourceFilter.ts +0 -1
- package/src/models/RequestResponse.ts +50 -0
- package/src/proxy/RequestResponseInjectProxy.ts +30 -0
- package/src/proxy/SymbolIntentApiServiceProxy.ts +1 -1
- package/src/proxy/index.ts +1 -0
- package/src/resolvers/Resolver.ts +2 -1
- package/src/websocket/WebSocketManager.ts +69 -41
|
@@ -34,9 +34,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
34
34
|
mod
|
|
35
35
|
));
|
|
36
36
|
|
|
37
|
-
//
|
|
37
|
+
// ../../../node_modules/.pnpm/reflect-metadata@0.2.2/node_modules/reflect-metadata/Reflect.js
|
|
38
38
|
var require_Reflect = __commonJS({
|
|
39
|
-
"
|
|
39
|
+
"../../../node_modules/.pnpm/reflect-metadata@0.2.2/node_modules/reflect-metadata/Reflect.js"() {
|
|
40
40
|
var Reflect2;
|
|
41
41
|
(function(Reflect3) {
|
|
42
42
|
(function(factory) {
|
|
@@ -1119,9 +1119,9 @@ var require_Reflect = __commonJS({
|
|
|
1119
1119
|
}
|
|
1120
1120
|
});
|
|
1121
1121
|
|
|
1122
|
-
//
|
|
1122
|
+
// ../../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/db.json
|
|
1123
1123
|
var require_db = __commonJS({
|
|
1124
|
-
"
|
|
1124
|
+
"../../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/db.json"(exports, module) {
|
|
1125
1125
|
module.exports = {
|
|
1126
1126
|
"application/1d-interleaved-parityfec": {
|
|
1127
1127
|
source: "iana"
|
|
@@ -9644,16 +9644,16 @@ var require_db = __commonJS({
|
|
|
9644
9644
|
}
|
|
9645
9645
|
});
|
|
9646
9646
|
|
|
9647
|
-
//
|
|
9647
|
+
// ../../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/index.js
|
|
9648
9648
|
var require_mime_db = __commonJS({
|
|
9649
|
-
"
|
|
9649
|
+
"../../../node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/index.js"(exports, module) {
|
|
9650
9650
|
module.exports = require_db();
|
|
9651
9651
|
}
|
|
9652
9652
|
});
|
|
9653
9653
|
|
|
9654
|
-
//
|
|
9654
|
+
// ../../../node_modules/.pnpm/mime-types@2.1.35/node_modules/mime-types/index.js
|
|
9655
9655
|
var require_mime_types = __commonJS({
|
|
9656
|
-
"
|
|
9656
|
+
"../../../node_modules/.pnpm/mime-types@2.1.35/node_modules/mime-types/index.js"(exports) {
|
|
9657
9657
|
"use strict";
|
|
9658
9658
|
var db = require_mime_db();
|
|
9659
9659
|
var extname2 = __require("path").extname;
|
|
@@ -9741,9 +9741,9 @@ var require_mime_types = __commonJS({
|
|
|
9741
9741
|
}
|
|
9742
9742
|
});
|
|
9743
9743
|
|
|
9744
|
-
//
|
|
9744
|
+
// ../../../node_modules/.pnpm/node-gzip@1.1.2/node_modules/node-gzip/dist/index.js
|
|
9745
9745
|
var require_dist = __commonJS({
|
|
9746
|
-
"
|
|
9746
|
+
"../../../node_modules/.pnpm/node-gzip@1.1.2/node_modules/node-gzip/dist/index.js"(exports, module) {
|
|
9747
9747
|
"use strict";
|
|
9748
9748
|
var zlib = __require("zlib");
|
|
9749
9749
|
module.exports = {
|
|
@@ -9769,9 +9769,9 @@ var require_dist = __commonJS({
|
|
|
9769
9769
|
}
|
|
9770
9770
|
});
|
|
9771
9771
|
|
|
9772
|
-
//
|
|
9772
|
+
// ../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/helpers.js
|
|
9773
9773
|
var require_helpers = __commonJS({
|
|
9774
|
-
"
|
|
9774
|
+
"../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/helpers.js"(exports) {
|
|
9775
9775
|
var __extends = exports && exports.__extends || /* @__PURE__ */ function() {
|
|
9776
9776
|
var extendStatics = function(d, b) {
|
|
9777
9777
|
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
@@ -9937,9 +9937,9 @@ var require_helpers = __commonJS({
|
|
|
9937
9937
|
}
|
|
9938
9938
|
});
|
|
9939
9939
|
|
|
9940
|
-
//
|
|
9940
|
+
// ../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/core.js
|
|
9941
9941
|
var require_core = __commonJS({
|
|
9942
|
-
"
|
|
9942
|
+
"../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/core.js"(exports) {
|
|
9943
9943
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9944
9944
|
var helpers_js_1 = require_helpers();
|
|
9945
9945
|
exports.JsonPatchError = helpers_js_1.PatchError;
|
|
@@ -10270,9 +10270,9 @@ var require_core = __commonJS({
|
|
|
10270
10270
|
}
|
|
10271
10271
|
});
|
|
10272
10272
|
|
|
10273
|
-
//
|
|
10273
|
+
// ../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/duplex.js
|
|
10274
10274
|
var require_duplex = __commonJS({
|
|
10275
|
-
"
|
|
10275
|
+
"../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/commonjs/duplex.js"(exports) {
|
|
10276
10276
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10277
10277
|
var helpers_js_1 = require_helpers();
|
|
10278
10278
|
var core_js_1 = require_core();
|
|
@@ -10444,9 +10444,9 @@ var require_duplex = __commonJS({
|
|
|
10444
10444
|
}
|
|
10445
10445
|
});
|
|
10446
10446
|
|
|
10447
|
-
//
|
|
10447
|
+
// ../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/index.js
|
|
10448
10448
|
var require_fast_json_patch = __commonJS({
|
|
10449
|
-
"
|
|
10449
|
+
"../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/index.js"(exports) {
|
|
10450
10450
|
var core = require_core();
|
|
10451
10451
|
Object.assign(exports, core);
|
|
10452
10452
|
var duplex = require_duplex();
|
|
@@ -10459,9 +10459,9 @@ var require_fast_json_patch = __commonJS({
|
|
|
10459
10459
|
}
|
|
10460
10460
|
});
|
|
10461
10461
|
|
|
10462
|
-
//
|
|
10462
|
+
// ../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/constants.js
|
|
10463
10463
|
var require_constants = __commonJS({
|
|
10464
|
-
"
|
|
10464
|
+
"../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/constants.js"(exports, module) {
|
|
10465
10465
|
"use strict";
|
|
10466
10466
|
var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
|
|
10467
10467
|
var hasBlob = typeof Blob !== "undefined";
|
|
@@ -10482,9 +10482,9 @@ var require_constants = __commonJS({
|
|
|
10482
10482
|
}
|
|
10483
10483
|
});
|
|
10484
10484
|
|
|
10485
|
-
//
|
|
10485
|
+
// ../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/buffer-util.js
|
|
10486
10486
|
var require_buffer_util = __commonJS({
|
|
10487
|
-
"
|
|
10487
|
+
"../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/buffer-util.js"(exports, module) {
|
|
10488
10488
|
"use strict";
|
|
10489
10489
|
var { EMPTY_BUFFER } = require_constants();
|
|
10490
10490
|
var FastBuffer = Buffer[Symbol.species];
|
|
@@ -10557,9 +10557,9 @@ var require_buffer_util = __commonJS({
|
|
|
10557
10557
|
}
|
|
10558
10558
|
});
|
|
10559
10559
|
|
|
10560
|
-
//
|
|
10560
|
+
// ../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/limiter.js
|
|
10561
10561
|
var require_limiter = __commonJS({
|
|
10562
|
-
"
|
|
10562
|
+
"../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/limiter.js"(exports, module) {
|
|
10563
10563
|
"use strict";
|
|
10564
10564
|
var kDone = Symbol("kDone");
|
|
10565
10565
|
var kRun = Symbol("kRun");
|
|
@@ -10607,9 +10607,9 @@ var require_limiter = __commonJS({
|
|
|
10607
10607
|
}
|
|
10608
10608
|
});
|
|
10609
10609
|
|
|
10610
|
-
//
|
|
10610
|
+
// ../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/permessage-deflate.js
|
|
10611
10611
|
var require_permessage_deflate = __commonJS({
|
|
10612
|
-
"
|
|
10612
|
+
"../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/permessage-deflate.js"(exports, module) {
|
|
10613
10613
|
"use strict";
|
|
10614
10614
|
var zlib = __require("zlib");
|
|
10615
10615
|
var bufferUtil = require_buffer_util();
|
|
@@ -10990,9 +10990,9 @@ var require_permessage_deflate = __commonJS({
|
|
|
10990
10990
|
}
|
|
10991
10991
|
});
|
|
10992
10992
|
|
|
10993
|
-
//
|
|
10993
|
+
// ../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/validation.js
|
|
10994
10994
|
var require_validation = __commonJS({
|
|
10995
|
-
"
|
|
10995
|
+
"../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/validation.js"(exports, module) {
|
|
10996
10996
|
"use strict";
|
|
10997
10997
|
var { isUtf8 } = __require("buffer");
|
|
10998
10998
|
var { hasBlob } = require_constants();
|
|
@@ -11191,9 +11191,9 @@ var require_validation = __commonJS({
|
|
|
11191
11191
|
}
|
|
11192
11192
|
});
|
|
11193
11193
|
|
|
11194
|
-
//
|
|
11194
|
+
// ../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/receiver.js
|
|
11195
11195
|
var require_receiver = __commonJS({
|
|
11196
|
-
"
|
|
11196
|
+
"../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/receiver.js"(exports, module) {
|
|
11197
11197
|
"use strict";
|
|
11198
11198
|
var { Writable } = __require("stream");
|
|
11199
11199
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
@@ -11226,10 +11226,6 @@ var require_receiver = __commonJS({
|
|
|
11226
11226
|
* extensions
|
|
11227
11227
|
* @param {Boolean} [options.isServer=false] Specifies whether to operate in
|
|
11228
11228
|
* client or server mode
|
|
11229
|
-
* @param {Number} [options.maxBufferedChunks=0] The maximum number of
|
|
11230
|
-
* buffered data chunks
|
|
11231
|
-
* @param {Number} [options.maxFragments=0] The maximum number of message
|
|
11232
|
-
* fragments
|
|
11233
11229
|
* @param {Number} [options.maxPayload=0] The maximum allowed message length
|
|
11234
11230
|
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
11235
11231
|
* not to skip UTF-8 validation for text and close messages
|
|
@@ -11240,8 +11236,6 @@ var require_receiver = __commonJS({
|
|
|
11240
11236
|
this._binaryType = options.binaryType || BINARY_TYPES[0];
|
|
11241
11237
|
this._extensions = options.extensions || {};
|
|
11242
11238
|
this._isServer = !!options.isServer;
|
|
11243
|
-
this._maxBufferedChunks = options.maxBufferedChunks | 0;
|
|
11244
|
-
this._maxFragments = options.maxFragments | 0;
|
|
11245
11239
|
this._maxPayload = options.maxPayload | 0;
|
|
11246
11240
|
this._skipUTF8Validation = !!options.skipUTF8Validation;
|
|
11247
11241
|
this[kWebSocket] = void 0;
|
|
@@ -11271,18 +11265,6 @@ var require_receiver = __commonJS({
|
|
|
11271
11265
|
*/
|
|
11272
11266
|
_write(chunk, encoding, cb) {
|
|
11273
11267
|
if (this._opcode === 8 && this._state == GET_INFO) return cb();
|
|
11274
|
-
if (this._maxBufferedChunks > 0 && this._buffers.length >= this._maxBufferedChunks) {
|
|
11275
|
-
cb(
|
|
11276
|
-
this.createError(
|
|
11277
|
-
RangeError,
|
|
11278
|
-
"Too many buffered chunks",
|
|
11279
|
-
false,
|
|
11280
|
-
1008,
|
|
11281
|
-
"WS_ERR_TOO_MANY_BUFFERED_PARTS"
|
|
11282
|
-
)
|
|
11283
|
-
);
|
|
11284
|
-
return;
|
|
11285
|
-
}
|
|
11286
11268
|
this._bufferedBytes += chunk.length;
|
|
11287
11269
|
this._buffers.push(chunk);
|
|
11288
11270
|
this.startLoop(cb);
|
|
@@ -11612,17 +11594,6 @@ var require_receiver = __commonJS({
|
|
|
11612
11594
|
return;
|
|
11613
11595
|
}
|
|
11614
11596
|
if (data.length) {
|
|
11615
|
-
if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
|
|
11616
|
-
const error = this.createError(
|
|
11617
|
-
RangeError,
|
|
11618
|
-
"Too many message fragments",
|
|
11619
|
-
false,
|
|
11620
|
-
1008,
|
|
11621
|
-
"WS_ERR_TOO_MANY_BUFFERED_PARTS"
|
|
11622
|
-
);
|
|
11623
|
-
cb(error);
|
|
11624
|
-
return;
|
|
11625
|
-
}
|
|
11626
11597
|
this._messageLength = this._totalPayloadLength;
|
|
11627
11598
|
this._fragments.push(data);
|
|
11628
11599
|
}
|
|
@@ -11652,17 +11623,6 @@ var require_receiver = __commonJS({
|
|
|
11652
11623
|
cb(error);
|
|
11653
11624
|
return;
|
|
11654
11625
|
}
|
|
11655
|
-
if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
|
|
11656
|
-
const error = this.createError(
|
|
11657
|
-
RangeError,
|
|
11658
|
-
"Too many message fragments",
|
|
11659
|
-
false,
|
|
11660
|
-
1008,
|
|
11661
|
-
"WS_ERR_TOO_MANY_BUFFERED_PARTS"
|
|
11662
|
-
);
|
|
11663
|
-
cb(error);
|
|
11664
|
-
return;
|
|
11665
|
-
}
|
|
11666
11626
|
this._fragments.push(buf);
|
|
11667
11627
|
}
|
|
11668
11628
|
this.dataMessage(cb);
|
|
@@ -11823,15 +11783,12 @@ var require_receiver = __commonJS({
|
|
|
11823
11783
|
}
|
|
11824
11784
|
});
|
|
11825
11785
|
|
|
11826
|
-
//
|
|
11786
|
+
// ../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/sender.js
|
|
11827
11787
|
var require_sender = __commonJS({
|
|
11828
|
-
"
|
|
11788
|
+
"../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/sender.js"(exports, module) {
|
|
11829
11789
|
"use strict";
|
|
11830
11790
|
var { Duplex } = __require("stream");
|
|
11831
11791
|
var { randomFillSync } = __require("crypto");
|
|
11832
|
-
var {
|
|
11833
|
-
types: { isUint8Array }
|
|
11834
|
-
} = __require("util");
|
|
11835
11792
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
11836
11793
|
var { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants();
|
|
11837
11794
|
var { isBlob, isValidStatusCode } = require_validation();
|
|
@@ -11985,10 +11942,8 @@ var require_sender = __commonJS({
|
|
|
11985
11942
|
buf.writeUInt16BE(code, 0);
|
|
11986
11943
|
if (typeof data === "string") {
|
|
11987
11944
|
buf.write(data, 2);
|
|
11988
|
-
} else if (isUint8Array(data)) {
|
|
11989
|
-
buf.set(data, 2);
|
|
11990
11945
|
} else {
|
|
11991
|
-
|
|
11946
|
+
buf.set(data, 2);
|
|
11992
11947
|
}
|
|
11993
11948
|
}
|
|
11994
11949
|
const options = {
|
|
@@ -12316,9 +12271,9 @@ var require_sender = __commonJS({
|
|
|
12316
12271
|
}
|
|
12317
12272
|
});
|
|
12318
12273
|
|
|
12319
|
-
//
|
|
12274
|
+
// ../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/event-target.js
|
|
12320
12275
|
var require_event_target = __commonJS({
|
|
12321
|
-
"
|
|
12276
|
+
"../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/event-target.js"(exports, module) {
|
|
12322
12277
|
"use strict";
|
|
12323
12278
|
var { kForOnEventAttribute, kListener } = require_constants();
|
|
12324
12279
|
var kCode = Symbol("kCode");
|
|
@@ -12545,9 +12500,9 @@ var require_event_target = __commonJS({
|
|
|
12545
12500
|
}
|
|
12546
12501
|
});
|
|
12547
12502
|
|
|
12548
|
-
//
|
|
12503
|
+
// ../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/extension.js
|
|
12549
12504
|
var require_extension = __commonJS({
|
|
12550
|
-
"
|
|
12505
|
+
"../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/extension.js"(exports, module) {
|
|
12551
12506
|
"use strict";
|
|
12552
12507
|
var { tokenChars } = require_validation();
|
|
12553
12508
|
function push(dest, name, elem) {
|
|
@@ -12698,9 +12653,9 @@ var require_extension = __commonJS({
|
|
|
12698
12653
|
}
|
|
12699
12654
|
});
|
|
12700
12655
|
|
|
12701
|
-
//
|
|
12656
|
+
// ../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket.js
|
|
12702
12657
|
var require_websocket = __commonJS({
|
|
12703
|
-
"
|
|
12658
|
+
"../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket.js"(exports, module) {
|
|
12704
12659
|
"use strict";
|
|
12705
12660
|
var EventEmitter = __require("events");
|
|
12706
12661
|
var https = __require("https");
|
|
@@ -12869,10 +12824,6 @@ var require_websocket = __commonJS({
|
|
|
12869
12824
|
* multiple times in the same tick
|
|
12870
12825
|
* @param {Function} [options.generateMask] The function used to generate the
|
|
12871
12826
|
* masking key
|
|
12872
|
-
* @param {Number} [options.maxBufferedChunks=0] The maximum number of
|
|
12873
|
-
* buffered data chunks
|
|
12874
|
-
* @param {Number} [options.maxFragments=0] The maximum number of message
|
|
12875
|
-
* fragments
|
|
12876
12827
|
* @param {Number} [options.maxPayload=0] The maximum allowed message size
|
|
12877
12828
|
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
12878
12829
|
* not to skip UTF-8 validation for text and close messages
|
|
@@ -12884,8 +12835,6 @@ var require_websocket = __commonJS({
|
|
|
12884
12835
|
binaryType: this.binaryType,
|
|
12885
12836
|
extensions: this._extensions,
|
|
12886
12837
|
isServer: this._isServer,
|
|
12887
|
-
maxBufferedChunks: options.maxBufferedChunks,
|
|
12888
|
-
maxFragments: options.maxFragments,
|
|
12889
12838
|
maxPayload: options.maxPayload,
|
|
12890
12839
|
skipUTF8Validation: options.skipUTF8Validation
|
|
12891
12840
|
});
|
|
@@ -13185,8 +13134,6 @@ var require_websocket = __commonJS({
|
|
|
13185
13134
|
autoPong: true,
|
|
13186
13135
|
closeTimeout: CLOSE_TIMEOUT,
|
|
13187
13136
|
protocolVersion: protocolVersions[1],
|
|
13188
|
-
maxBufferedChunks: 1024 * 1024,
|
|
13189
|
-
maxFragments: 128 * 1024,
|
|
13190
13137
|
maxPayload: 100 * 1024 * 1024,
|
|
13191
13138
|
skipUTF8Validation: false,
|
|
13192
13139
|
perMessageDeflate: true,
|
|
@@ -13429,8 +13376,6 @@ var require_websocket = __commonJS({
|
|
|
13429
13376
|
websocket.setSocket(socket, head, {
|
|
13430
13377
|
allowSynchronousEvents: opts.allowSynchronousEvents,
|
|
13431
13378
|
generateMask: opts.generateMask,
|
|
13432
|
-
maxBufferedChunks: opts.maxBufferedChunks,
|
|
13433
|
-
maxFragments: opts.maxFragments,
|
|
13434
13379
|
maxPayload: opts.maxPayload,
|
|
13435
13380
|
skipUTF8Validation: opts.skipUTF8Validation
|
|
13436
13381
|
});
|
|
@@ -13594,9 +13539,9 @@ var require_websocket = __commonJS({
|
|
|
13594
13539
|
}
|
|
13595
13540
|
});
|
|
13596
13541
|
|
|
13597
|
-
//
|
|
13542
|
+
// ../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/stream.js
|
|
13598
13543
|
var require_stream = __commonJS({
|
|
13599
|
-
"
|
|
13544
|
+
"../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/stream.js"(exports, module) {
|
|
13600
13545
|
"use strict";
|
|
13601
13546
|
var WebSocket3 = require_websocket();
|
|
13602
13547
|
var { Duplex } = __require("stream");
|
|
@@ -13692,9 +13637,9 @@ var require_stream = __commonJS({
|
|
|
13692
13637
|
}
|
|
13693
13638
|
});
|
|
13694
13639
|
|
|
13695
|
-
//
|
|
13640
|
+
// ../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/subprotocol.js
|
|
13696
13641
|
var require_subprotocol = __commonJS({
|
|
13697
|
-
"
|
|
13642
|
+
"../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/subprotocol.js"(exports, module) {
|
|
13698
13643
|
"use strict";
|
|
13699
13644
|
var { tokenChars } = require_validation();
|
|
13700
13645
|
function parse2(header) {
|
|
@@ -13737,9 +13682,9 @@ var require_subprotocol = __commonJS({
|
|
|
13737
13682
|
}
|
|
13738
13683
|
});
|
|
13739
13684
|
|
|
13740
|
-
//
|
|
13685
|
+
// ../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket-server.js
|
|
13741
13686
|
var require_websocket_server = __commonJS({
|
|
13742
|
-
"
|
|
13687
|
+
"../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket-server.js"(exports, module) {
|
|
13743
13688
|
"use strict";
|
|
13744
13689
|
var EventEmitter = __require("events");
|
|
13745
13690
|
var http = __require("http");
|
|
@@ -13773,10 +13718,6 @@ var require_websocket_server = __commonJS({
|
|
|
13773
13718
|
* called
|
|
13774
13719
|
* @param {Function} [options.handleProtocols] A hook to handle protocols
|
|
13775
13720
|
* @param {String} [options.host] The hostname where to bind the server
|
|
13776
|
-
* @param {Number} [options.maxBufferedChunks=1048576] The maximum number of
|
|
13777
|
-
* buffered data chunks
|
|
13778
|
-
* @param {Number} [options.maxFragments=131072] The maximum number of message
|
|
13779
|
-
* fragments
|
|
13780
13721
|
* @param {Number} [options.maxPayload=104857600] The maximum allowed message
|
|
13781
13722
|
* size
|
|
13782
13723
|
* @param {Boolean} [options.noServer=false] Enable no server mode
|
|
@@ -13798,8 +13739,6 @@ var require_websocket_server = __commonJS({
|
|
|
13798
13739
|
options = {
|
|
13799
13740
|
allowSynchronousEvents: true,
|
|
13800
13741
|
autoPong: true,
|
|
13801
|
-
maxBufferedChunks: 1024 * 1024,
|
|
13802
|
-
maxFragments: 128 * 1024,
|
|
13803
13742
|
maxPayload: 100 * 1024 * 1024,
|
|
13804
13743
|
skipUTF8Validation: false,
|
|
13805
13744
|
perMessageDeflate: false,
|
|
@@ -14079,8 +14018,6 @@ var require_websocket_server = __commonJS({
|
|
|
14079
14018
|
socket.removeListener("error", socketOnError);
|
|
14080
14019
|
ws.setSocket(socket, head, {
|
|
14081
14020
|
allowSynchronousEvents: this.options.allowSynchronousEvents,
|
|
14082
|
-
maxBufferedChunks: this.options.maxBufferedChunks,
|
|
14083
|
-
maxFragments: this.options.maxFragments,
|
|
14084
14021
|
maxPayload: this.options.maxPayload,
|
|
14085
14022
|
skipUTF8Validation: this.options.skipUTF8Validation
|
|
14086
14023
|
});
|
|
@@ -14168,6 +14105,8 @@ var Mimes = /* @__PURE__ */ ((Mimes2) => {
|
|
|
14168
14105
|
Mimes2["ImageXpixmap"] = "image/x-xpixmap";
|
|
14169
14106
|
Mimes2["ImageXxbm"] = "image/x-xbm";
|
|
14170
14107
|
Mimes2["MultipartFormData"] = "multipart/form-data";
|
|
14108
|
+
Mimes2["TextEventStream"] = "text/event-stream";
|
|
14109
|
+
Mimes2["ApplicationXndjson"] = "application/x-ndjson";
|
|
14171
14110
|
Mimes2["ApplicationJsonPostSimpleBootSsrIntentScheme"] = "application/json-post+simple-boot-ssr-intent-scheme";
|
|
14172
14111
|
Mimes2["Intent"] = "intent";
|
|
14173
14112
|
return Mimes2;
|
|
@@ -14300,6 +14239,7 @@ __export(esm_exports, {
|
|
|
14300
14239
|
Fetcher: () => Fetcher,
|
|
14301
14240
|
FormValidator: () => FormValidator,
|
|
14302
14241
|
FunctionUtils: () => FunctionUtils,
|
|
14242
|
+
HashUtils: () => HashUtils,
|
|
14303
14243
|
HttpFetcher: () => HttpFetcher,
|
|
14304
14244
|
HttpJsonFetcher: () => HttpJsonFetcher,
|
|
14305
14245
|
HttpResponseError: () => HttpResponseError,
|
|
@@ -14380,6 +14320,7 @@ __export(esm_exports, {
|
|
|
14380
14320
|
isCssCommentItem: () => isCssCommentItem,
|
|
14381
14321
|
isCssDeclarationItem: () => isCssDeclarationItem,
|
|
14382
14322
|
isCssRuleItem: () => isCssRuleItem,
|
|
14323
|
+
isDefined: () => isDefined,
|
|
14383
14324
|
isHttpResponseError: () => isHttpResponseError,
|
|
14384
14325
|
isPoint2DType: () => isPoint2DType,
|
|
14385
14326
|
isPoint3DType: () => isPoint3DType,
|
|
@@ -14425,6 +14366,12 @@ var ValidUtils;
|
|
|
14425
14366
|
return false;
|
|
14426
14367
|
}
|
|
14427
14368
|
};
|
|
14369
|
+
ValidUtils22.isGenerator = (value) => {
|
|
14370
|
+
return value !== null && typeof value === "object" && typeof value.next === "function" && typeof value[Symbol.iterator] === "function";
|
|
14371
|
+
};
|
|
14372
|
+
ValidUtils22.isAsyncGenerator = (value) => {
|
|
14373
|
+
return value !== null && typeof value === "object" && typeof value.next === "function" && typeof value[Symbol.asyncIterator] === "function";
|
|
14374
|
+
};
|
|
14428
14375
|
ValidUtils22.isFrozen = (obj) => {
|
|
14429
14376
|
return Object.isFrozen(obj);
|
|
14430
14377
|
};
|
|
@@ -16339,6 +16286,12 @@ var Vector = class _Vector {
|
|
|
16339
16286
|
this.z = z ?? 0;
|
|
16340
16287
|
}
|
|
16341
16288
|
}
|
|
16289
|
+
/**
|
|
16290
|
+
* 성분 대입 (파괴적). 벡터 전달 시 그 성분을 복사.
|
|
16291
|
+
* @example
|
|
16292
|
+
* v.set(1, 2, 3); // v = (1, 2, 3)
|
|
16293
|
+
* v.set(otherVector); // v = other와 동일 성분
|
|
16294
|
+
*/
|
|
16342
16295
|
set(v, y = 0, z = 0) {
|
|
16343
16296
|
if (v instanceof _Vector || v instanceof Point3D) {
|
|
16344
16297
|
this.set(v.x || 0, v.y || 0, v.z || 0);
|
|
@@ -16349,16 +16302,45 @@ var Vector = class _Vector {
|
|
|
16349
16302
|
}
|
|
16350
16303
|
return this;
|
|
16351
16304
|
}
|
|
16305
|
+
/**
|
|
16306
|
+
* 복사본 반환 (비파괴). 파괴적 메서드와 조합해 원본 보존용.
|
|
16307
|
+
* @example
|
|
16308
|
+
* const s = a.get(); s.add(b); // s = a+b, a는 그대로
|
|
16309
|
+
*/
|
|
16352
16310
|
get() {
|
|
16353
16311
|
return new _Vector(this.x, this.y, this.z);
|
|
16354
16312
|
}
|
|
16355
|
-
|
|
16356
|
-
|
|
16313
|
+
/**
|
|
16314
|
+
* 노름(norm). 평평한 공간(유클리드 공간)에서의 직선 거리.
|
|
16315
|
+
* - 수식: ‖v‖ = √(x² + y² + z²)
|
|
16316
|
+
* - 2D에서는 피타고라스 정리 그 자체. 3D는 두 번 적용한 것과 같음.
|
|
16317
|
+
* (바닥 대각선 √(x²+y²) → 공간 대각선 √((바닥)²+z²))
|
|
16318
|
+
* - "유클리드"는 평평한 공간의 기하학을 말함 (좌표계는 데카르트의 것, 유클리드는 좌표 없이 기하학을 세움).
|
|
16319
|
+
* 휘어진 공간(구면·쌍곡)에서는 이 공식이 성립하지 않음.
|
|
16320
|
+
* @example
|
|
16321
|
+
* new Vector(3, 4, 0).norm(); // 5
|
|
16322
|
+
* new Vector(6, 8, 0).norm(); // 10
|
|
16323
|
+
*/
|
|
16324
|
+
norm() {
|
|
16357
16325
|
const x = this.x;
|
|
16358
16326
|
const y = this.y;
|
|
16359
16327
|
const z = this.z;
|
|
16360
16328
|
return Math.sqrt(x * x + y * y + z * z);
|
|
16361
16329
|
}
|
|
16330
|
+
/**
|
|
16331
|
+
* norm()의 별칭 (p5.js 호환).
|
|
16332
|
+
* @example
|
|
16333
|
+
* new Vector(3, 4, 0).mag(); // 5
|
|
16334
|
+
*/
|
|
16335
|
+
mag() {
|
|
16336
|
+
return this.norm();
|
|
16337
|
+
}
|
|
16338
|
+
/**
|
|
16339
|
+
* 덧셈 (파괴적). 성분별 합. 기하학적으로 평행사변형의 대각선.
|
|
16340
|
+
* - 수식: a + b = (ax+bx, ay+by, az+bz)
|
|
16341
|
+
* @example
|
|
16342
|
+
* const a = new Vector(4, 2); a.add(new Vector(-2, 3)); // a = (2, 5)
|
|
16343
|
+
*/
|
|
16362
16344
|
add(v, y = 0, z = 0) {
|
|
16363
16345
|
if (v instanceof _Vector || v instanceof Point3D) {
|
|
16364
16346
|
this.x += v.x;
|
|
@@ -16370,12 +16352,24 @@ var Vector = class _Vector {
|
|
|
16370
16352
|
this.z += z;
|
|
16371
16353
|
}
|
|
16372
16354
|
}
|
|
16355
|
+
/**
|
|
16356
|
+
* 덧셈 결과의 새 벡터 반환 (비파괴).
|
|
16357
|
+
* - 수식: a + b = (ax+bx, ay+by, az+bz)
|
|
16358
|
+
* @example
|
|
16359
|
+
* const s = a.toAdd(a, b); // s = a+b, a·b는 그대로
|
|
16360
|
+
*/
|
|
16373
16361
|
toAdd(v1, v2) {
|
|
16374
16362
|
return new _Vector(v1.x + v2.x, v1.y + v2.y, v1.x + v2.y);
|
|
16375
16363
|
}
|
|
16376
16364
|
// public static add(v1: Vector, v2: Vector): Vector {
|
|
16377
16365
|
// return new Vector(v1.x + v2.x, v1.y + v2.y, v1.x + v2.y);
|
|
16378
16366
|
// }
|
|
16367
|
+
/**
|
|
16368
|
+
* 뺄셈 (파괴적). a - b는 "a에서 b를 되돌리는" 벡터.
|
|
16369
|
+
* - 수식: a - b = (ax-bx, ay-by, az-bz)
|
|
16370
|
+
* @example
|
|
16371
|
+
* const a = new Vector(4, 2); a.sub(new Vector(1, 1)); // a = (3, 1)
|
|
16372
|
+
*/
|
|
16379
16373
|
sub(v, y = 0, z = 0) {
|
|
16380
16374
|
if (v instanceof _Vector || v instanceof Point3D) {
|
|
16381
16375
|
this.x -= v.x;
|
|
@@ -16387,6 +16381,12 @@ var Vector = class _Vector {
|
|
|
16387
16381
|
this.z -= z;
|
|
16388
16382
|
}
|
|
16389
16383
|
}
|
|
16384
|
+
/**
|
|
16385
|
+
* 뺄셈 결과의 새 벡터 반환 (비파괴).
|
|
16386
|
+
* - 수식: a - b = (ax-bx, ay-by, az-bz)
|
|
16387
|
+
* @example
|
|
16388
|
+
* const d = a.toSub(b); // d = a-b, a·b는 그대로
|
|
16389
|
+
*/
|
|
16390
16390
|
toSub(v2) {
|
|
16391
16391
|
const v1 = this;
|
|
16392
16392
|
return new _Vector(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z);
|
|
@@ -16395,6 +16395,12 @@ var Vector = class _Vector {
|
|
|
16395
16395
|
// public static sub(v1: Vector, v2: Vector): Vector {
|
|
16396
16396
|
// return new Vector(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z);
|
|
16397
16397
|
// }
|
|
16398
|
+
/**
|
|
16399
|
+
* 스칼라배 또는 성분별 곱 (파괴적). 스칼라 k>1이면 늘어나고, 0<k<1이면 줄어듦. k<0이면 반대 방향.
|
|
16400
|
+
* - 수식(스칼라): k·v = (k·x, k·y, k·z)
|
|
16401
|
+
* @example
|
|
16402
|
+
* const v = new Vector(1, 2); v.mult(3); // v = (3, 6)
|
|
16403
|
+
*/
|
|
16398
16404
|
mult(v) {
|
|
16399
16405
|
if (v instanceof _Vector || v instanceof Point3D) {
|
|
16400
16406
|
this.x *= v.x;
|
|
@@ -16407,6 +16413,12 @@ var Vector = class _Vector {
|
|
|
16407
16413
|
}
|
|
16408
16414
|
return this;
|
|
16409
16415
|
}
|
|
16416
|
+
/**
|
|
16417
|
+
* 성분별 곱 결과의 새 벡터 반환 (비파괴).
|
|
16418
|
+
* - 수식: (ax·bx, ay·by, az·bz)
|
|
16419
|
+
* @example
|
|
16420
|
+
* const m = a.toMult(b); // m = 성분별 곱, a·b는 그대로
|
|
16421
|
+
*/
|
|
16410
16422
|
toMult(v2) {
|
|
16411
16423
|
const v1 = this;
|
|
16412
16424
|
return new _Vector(v1.x *= v2.x, v1.y *= v2.y, v1.z *= v2.z);
|
|
@@ -16414,6 +16426,12 @@ var Vector = class _Vector {
|
|
|
16414
16426
|
// public static mult(v1: Vector, v2: Vector) {
|
|
16415
16427
|
// return new Vector(v1.x *= v2.x, v1.y *= v2.y, v1.z *= v2.z);
|
|
16416
16428
|
// }
|
|
16429
|
+
/**
|
|
16430
|
+
* 스칼라 나눗셈 또는 성분별 나눗셈 (파괴적). 정규화의 핵심 연산.
|
|
16431
|
+
* - 수식(스칼라): v/k = (x/k, y/k, z/k)
|
|
16432
|
+
* @example
|
|
16433
|
+
* const v = new Vector(6, 8); v.div(2); // v = (3, 4)
|
|
16434
|
+
*/
|
|
16417
16435
|
div(v) {
|
|
16418
16436
|
if (v instanceof _Vector || v instanceof Point3D) {
|
|
16419
16437
|
this.x /= v.x;
|
|
@@ -16426,6 +16444,12 @@ var Vector = class _Vector {
|
|
|
16426
16444
|
}
|
|
16427
16445
|
return this;
|
|
16428
16446
|
}
|
|
16447
|
+
/**
|
|
16448
|
+
* 스칼라 나눗셈 결과의 새 벡터 반환 (비파괴).
|
|
16449
|
+
* - 수식: v/k = (x/k, y/k, z/k)
|
|
16450
|
+
* @example
|
|
16451
|
+
* const h = v.toDiv(2); // h = v/2, v는 그대로
|
|
16452
|
+
*/
|
|
16429
16453
|
toDiv(d) {
|
|
16430
16454
|
const v = this;
|
|
16431
16455
|
const rv = v.get();
|
|
@@ -16441,10 +16465,22 @@ var Vector = class _Vector {
|
|
|
16441
16465
|
// rv.z /= d;
|
|
16442
16466
|
// return rv;
|
|
16443
16467
|
// }
|
|
16468
|
+
/**
|
|
16469
|
+
* 두 점(벡터) 사이 거리. 차 벡터의 크기.
|
|
16470
|
+
* - 수식: d = √((dx)² + (dy)² + (dz)²)
|
|
16471
|
+
* @example
|
|
16472
|
+
* new Vector(0, 0).dist(new Vector(3, 4)); // 5
|
|
16473
|
+
*/
|
|
16444
16474
|
dist(v) {
|
|
16445
16475
|
const dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;
|
|
16446
16476
|
return Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
16447
16477
|
}
|
|
16478
|
+
/**
|
|
16479
|
+
* 두 점(벡터) 사이 거리 (toDist는 dist와 동일, 비파괴).
|
|
16480
|
+
* - 수식: d = √((dx)² + (dy)² + (dz)²)
|
|
16481
|
+
* @example
|
|
16482
|
+
* a.toDist(b); // a와 b 사이 거리
|
|
16483
|
+
*/
|
|
16448
16484
|
toDist(v2) {
|
|
16449
16485
|
const v1 = this;
|
|
16450
16486
|
const dx = v1.x - v2.x, dy = v1.y - v2.y, dz = v1.z - v2.z;
|
|
@@ -16456,36 +16492,90 @@ var Vector = class _Vector {
|
|
|
16456
16492
|
// dz = v1.z - v2.z;
|
|
16457
16493
|
// return Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
16458
16494
|
// }
|
|
16459
|
-
|
|
16495
|
+
/**
|
|
16496
|
+
* 내적(dot product). 두 벡터가 같은 방향을 향하는 정도.
|
|
16497
|
+
* - 수식: a·b = ax·bx + ay·by + az·bz = |a||b|cosθ
|
|
16498
|
+
* - θ=90°면 0(직교), 0°면 최대(같은 방향).
|
|
16499
|
+
* - 벡터 전달 시 y·z 생략 가능, 스칼라(x) 전달 시 y·z와 함께 사용.
|
|
16500
|
+
* @example
|
|
16501
|
+
* new Vector(5, 12).dot(new Vector(-5, 12)); // -25+144 = 119
|
|
16502
|
+
* new Vector(1, 0).dot(new Vector(0, 1)); // 0 (직각)
|
|
16503
|
+
* new Vector(1, 2).dot(3, 4); // 1*3+2*4 = 11
|
|
16504
|
+
*/
|
|
16505
|
+
dot(v, y = 0, z = 0) {
|
|
16460
16506
|
if (v instanceof _Vector || v instanceof Point3D) {
|
|
16461
16507
|
return this.x * v.x + this.y * v.y + this.z * v.z;
|
|
16462
16508
|
}
|
|
16463
16509
|
;
|
|
16464
16510
|
return this.x * v + this.y * y + this.z * z;
|
|
16465
16511
|
}
|
|
16512
|
+
/**
|
|
16513
|
+
* 외적(cross product). 두 벡터에 수직인 벡터. 오른손 법칙 방향.
|
|
16514
|
+
* - 수식: a×b = (ay·bz − az·by, az·bx − ax·bz, ax·by − ay·bx)
|
|
16515
|
+
* - 2D에서는 z값 = ax·by − ay·bx (부호 있는 면적, 회전 방향 판정용).
|
|
16516
|
+
* @example
|
|
16517
|
+
* new Vector(1, 0, 0).cross(new Vector(0, 1, 0)); // (0, 0, 1)
|
|
16518
|
+
*/
|
|
16466
16519
|
cross(v) {
|
|
16467
16520
|
const x = this.x, y = this.y, z = this.z;
|
|
16468
16521
|
return new _Vector(y * v.z - v.y * z, z * v.x - v.z * x, x * v.y - v.x * y);
|
|
16469
16522
|
}
|
|
16523
|
+
/**
|
|
16524
|
+
* 정규화 (파괴적). 방향은 그대로, 크기를 1로. 단위벡터 v̂ 생성.
|
|
16525
|
+
* - 수식: v̂ = v / |v|
|
|
16526
|
+
* - 영벡터(|v|=0)는 0으로 나누지 않고 그대로 둠.
|
|
16527
|
+
* @example
|
|
16528
|
+
* const v = new Vector(6, 8); v.normalize(); // v = (0.6, 0.8), |v| = 1
|
|
16529
|
+
*/
|
|
16470
16530
|
normalize() {
|
|
16471
|
-
const m = this.
|
|
16531
|
+
const m = this.norm();
|
|
16472
16532
|
if (m > 0) this.div(m);
|
|
16473
16533
|
}
|
|
16534
|
+
/**
|
|
16535
|
+
* 크기 상한 (파괴적). 속도가 high를 넘으면 방향 유지한 채 high로 자름. 물리 시뮬레이션 최고속도용.
|
|
16536
|
+
* - 수식: |v| > high → v = v̂ · high
|
|
16537
|
+
* @example
|
|
16538
|
+
* const v = new Vector(6, 8); v.limit(5); // |v|=10 → 5, v = (3, 4)
|
|
16539
|
+
*/
|
|
16474
16540
|
limit(high) {
|
|
16475
|
-
if (this.
|
|
16541
|
+
if (this.norm() > high) {
|
|
16476
16542
|
this.normalize();
|
|
16477
16543
|
this.mult(high);
|
|
16478
16544
|
}
|
|
16479
16545
|
}
|
|
16546
|
+
/**
|
|
16547
|
+
* 2D 방향각. +x축 기준 반시계 방향 라디안 (-π ~ π).
|
|
16548
|
+
* - 수식: θ = atan2(y, x)
|
|
16549
|
+
* @example
|
|
16550
|
+
* new Vector(1, 1).heading2D(); // π/4 (45°)
|
|
16551
|
+
* new Vector(-1, 0).heading2D(); // π (180°)
|
|
16552
|
+
*/
|
|
16480
16553
|
heading2D() {
|
|
16481
16554
|
return -Math.atan2(-this.y, this.x);
|
|
16482
16555
|
}
|
|
16556
|
+
/**
|
|
16557
|
+
* 무작위 방향 단위벡터 반환 (새 Vector, 자신은 변경 안 함).
|
|
16558
|
+
* @example
|
|
16559
|
+
* const r = new Vector().random2D(); // |r| = 1, 방향 랜덤
|
|
16560
|
+
*/
|
|
16483
16561
|
random2D() {
|
|
16484
16562
|
return this.fromAngle(Math.random() * (2 * Math.PI));
|
|
16485
16563
|
}
|
|
16564
|
+
/**
|
|
16565
|
+
* 각도→벡터. 각도 θ, 길이 L인 2D 벡터 반환 (새 Vector).
|
|
16566
|
+
* - 수식: (L·cosθ, L·sinθ, 0)
|
|
16567
|
+
* @example
|
|
16568
|
+
* new Vector().fromAngle(Math.PI / 3, 2); // (1, 1.73, 0)
|
|
16569
|
+
*/
|
|
16486
16570
|
fromAngle(angle, length = 1) {
|
|
16487
16571
|
return new _Vector(length * Math.cos(angle), length * Math.sin(angle), 0);
|
|
16488
16572
|
}
|
|
16573
|
+
/**
|
|
16574
|
+
* 구면좌표→3D 벡터 (새 Vector 반환, p5.js 컨벤션).
|
|
16575
|
+
* - 수식: (L·sinθ·sinφ, −L·cosθ, L·sinθ·cosφ)
|
|
16576
|
+
* @example
|
|
16577
|
+
* new Vector().fromAngles(Math.PI / 2, Math.PI / 2, 1); // (1, 0, 0)
|
|
16578
|
+
*/
|
|
16489
16579
|
fromAngles(theta, phi, length = 1) {
|
|
16490
16580
|
const cosPhi = Math.cos(phi);
|
|
16491
16581
|
const sinPhi = Math.sin(phi);
|
|
@@ -16497,18 +16587,43 @@ var Vector = class _Vector {
|
|
|
16497
16587
|
length * sinTheta * cosPhi
|
|
16498
16588
|
);
|
|
16499
16589
|
}
|
|
16590
|
+
/**
|
|
16591
|
+
* 성분 배열 반환. [x, y, z] 순서.
|
|
16592
|
+
* @example
|
|
16593
|
+
* new Vector(1, 2, 3).array(); // [1, 2, 3]
|
|
16594
|
+
*/
|
|
16500
16595
|
array() {
|
|
16501
16596
|
return [this.x, this.y, this.z];
|
|
16502
16597
|
}
|
|
16598
|
+
/**
|
|
16599
|
+
* Point3D로 변환 (위치 의미로 바꿀 때).
|
|
16600
|
+
* @example
|
|
16601
|
+
* new Vector(1, 2, 3).toPoint3D(); // Point3D(1, 2, 3)
|
|
16602
|
+
*/
|
|
16503
16603
|
toPoint3D() {
|
|
16504
16604
|
return new Point3D(this.x, this.y, this.z);
|
|
16505
16605
|
}
|
|
16606
|
+
/**
|
|
16607
|
+
* Point2D로 변환 (z 버림).
|
|
16608
|
+
* @example
|
|
16609
|
+
* new Vector(1, 2, 3).toPoint2D(); // Point2D(1, 2)
|
|
16610
|
+
*/
|
|
16506
16611
|
toPoint2D() {
|
|
16507
16612
|
return new Point2D(this.x, this.y);
|
|
16508
16613
|
}
|
|
16614
|
+
/**
|
|
16615
|
+
* 복사본 반환 (get()과 동일, 비파괴).
|
|
16616
|
+
* @example
|
|
16617
|
+
* const c = v.copy(); // v와 같은 성분의 새 벡터
|
|
16618
|
+
*/
|
|
16509
16619
|
copy() {
|
|
16510
16620
|
return new _Vector(this.x, this.y, this.z);
|
|
16511
16621
|
}
|
|
16622
|
+
/**
|
|
16623
|
+
* 문자열 표현. "[x, y, z]" 형식.
|
|
16624
|
+
* @example
|
|
16625
|
+
* new Vector(1, 2).toString(); // "[1, 2, 0]"
|
|
16626
|
+
*/
|
|
16512
16627
|
toString() {
|
|
16513
16628
|
return "[" + this.x + ", " + this.y + ", " + this.z + "]";
|
|
16514
16629
|
}
|
|
@@ -18701,87 +18816,64 @@ var throttle = (fn, delay) => {
|
|
|
18701
18816
|
// ../core/dist/esm/promise/AbortablePromise.js
|
|
18702
18817
|
var AbortablePromise = class _AbortablePromise {
|
|
18703
18818
|
constructor(executor, signal) {
|
|
18704
|
-
this.steps = [];
|
|
18705
|
-
this.initialExecutor = executor;
|
|
18706
18819
|
this.signal = signal;
|
|
18820
|
+
if (typeof executor !== "function") {
|
|
18821
|
+
this.source = Promise.resolve(executor);
|
|
18822
|
+
} else if (signal?.aborted) {
|
|
18823
|
+
this.source = Promise.reject(signal.reason);
|
|
18824
|
+
} else {
|
|
18825
|
+
this.source = Promise.resolve().then(executor);
|
|
18826
|
+
}
|
|
18827
|
+
}
|
|
18828
|
+
/**
|
|
18829
|
+
* source 를 abort 와 경쟁시킨 promise. 실제로 소비될 때(then/toPromise) 한 번만 만든다 —
|
|
18830
|
+
* await 는 then() 이 돌려준 새 인스턴스를 버리므로, 미리 만들면 아무도 안 받는 reject 가 unhandled 로 남는다.
|
|
18831
|
+
*/
|
|
18832
|
+
get promise() {
|
|
18833
|
+
if (this.guarded) return this.guarded;
|
|
18834
|
+
const signal = this.signal;
|
|
18835
|
+
if (!signal) return this.guarded = this.source;
|
|
18836
|
+
if (signal.aborted) {
|
|
18837
|
+
this.source.catch(() => {
|
|
18838
|
+
});
|
|
18839
|
+
return this.guarded = Promise.reject(signal.reason);
|
|
18840
|
+
}
|
|
18841
|
+
return this.guarded = new Promise((resolve2, reject) => {
|
|
18842
|
+
const cleanup = () => signal.removeEventListener("abort", onAbort);
|
|
18843
|
+
const onAbort = () => reject(signal.reason);
|
|
18844
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
18845
|
+
this.source.then(
|
|
18846
|
+
(value) => {
|
|
18847
|
+
cleanup();
|
|
18848
|
+
resolve2(value);
|
|
18849
|
+
},
|
|
18850
|
+
(reason) => {
|
|
18851
|
+
cleanup();
|
|
18852
|
+
reject(reason);
|
|
18853
|
+
}
|
|
18854
|
+
);
|
|
18855
|
+
});
|
|
18707
18856
|
}
|
|
18708
18857
|
then(onfulfilled, onrejected) {
|
|
18709
|
-
const
|
|
18710
|
-
|
|
18711
|
-
|
|
18858
|
+
const signal = this.signal;
|
|
18859
|
+
const next = this.promise.then(
|
|
18860
|
+
onfulfilled ? (value) => {
|
|
18861
|
+
if (signal?.aborted) throw signal.reason;
|
|
18862
|
+
return onfulfilled(value);
|
|
18863
|
+
} : void 0,
|
|
18864
|
+
onrejected
|
|
18712
18865
|
);
|
|
18713
|
-
|
|
18714
|
-
if (onfulfilled) {
|
|
18715
|
-
newPromise.steps.push(onfulfilled);
|
|
18716
|
-
}
|
|
18717
|
-
if (onrejected) {
|
|
18718
|
-
newPromise.errorHandler = onrejected;
|
|
18719
|
-
} else if (this.errorHandler) {
|
|
18720
|
-
newPromise.errorHandler = this.errorHandler;
|
|
18721
|
-
}
|
|
18722
|
-
return newPromise;
|
|
18866
|
+
return new _AbortablePromise(next, signal);
|
|
18723
18867
|
}
|
|
18724
18868
|
catch(onrejected) {
|
|
18725
18869
|
return this.then(void 0, onrejected);
|
|
18726
18870
|
}
|
|
18727
18871
|
finally(onfinally) {
|
|
18728
|
-
return this.
|
|
18729
|
-
(value) => {
|
|
18730
|
-
onfinally?.();
|
|
18731
|
-
return value;
|
|
18732
|
-
},
|
|
18733
|
-
(reason) => {
|
|
18734
|
-
onfinally?.();
|
|
18735
|
-
throw reason;
|
|
18736
|
-
}
|
|
18737
|
-
);
|
|
18872
|
+
return new _AbortablePromise(this.promise.finally(onfinally), this.signal);
|
|
18738
18873
|
}
|
|
18739
|
-
|
|
18740
|
-
try {
|
|
18741
|
-
if (this.signal?.aborted) {
|
|
18742
|
-
throw new Error(this.signal.reason || "Aborted");
|
|
18743
|
-
}
|
|
18744
|
-
const abortPromise = new Promise((_, reject) => {
|
|
18745
|
-
if (this.signal?.aborted) {
|
|
18746
|
-
return reject(new Error(this.signal.reason || "Aborted"));
|
|
18747
|
-
}
|
|
18748
|
-
const callback = (e) => {
|
|
18749
|
-
const target = e.target;
|
|
18750
|
-
this.signal?.removeEventListener("abort", callback);
|
|
18751
|
-
reject(new Error(target.reason || "Aborted"));
|
|
18752
|
-
};
|
|
18753
|
-
this.signal?.addEventListener("abort", callback, { once: true });
|
|
18754
|
-
});
|
|
18755
|
-
const pipelineRunner = async () => {
|
|
18756
|
-
let lastResult;
|
|
18757
|
-
if (typeof this.initialExecutor === "function") {
|
|
18758
|
-
if (this.signal?.aborted) {
|
|
18759
|
-
throw new Error(this.signal.reason || "Aborted");
|
|
18760
|
-
}
|
|
18761
|
-
lastResult = await this.initialExecutor();
|
|
18762
|
-
} else {
|
|
18763
|
-
lastResult = await this.initialExecutor;
|
|
18764
|
-
}
|
|
18765
|
-
for (let i = 0; i < this.steps.length; i++) {
|
|
18766
|
-
if (this.signal?.aborted) {
|
|
18767
|
-
throw new Error(this.signal.reason || "Aborted");
|
|
18768
|
-
}
|
|
18769
|
-
const step = this.steps[i];
|
|
18770
|
-
lastResult = await step(lastResult);
|
|
18771
|
-
}
|
|
18772
|
-
return lastResult;
|
|
18773
|
-
};
|
|
18774
|
-
return await Promise.race([pipelineRunner(), abortPromise]);
|
|
18775
|
-
} catch (error) {
|
|
18776
|
-
if (this.errorHandler) {
|
|
18777
|
-
return await this.errorHandler(error);
|
|
18778
|
-
}
|
|
18779
|
-
throw error;
|
|
18780
|
-
}
|
|
18781
|
-
}
|
|
18782
|
-
// Convert to native Promise
|
|
18874
|
+
// 네이티브 Promise 로 변환 (그냥 await 해도 된다)
|
|
18783
18875
|
toPromise() {
|
|
18784
|
-
return this.
|
|
18876
|
+
return this.promise;
|
|
18785
18877
|
}
|
|
18786
18878
|
};
|
|
18787
18879
|
|
|
@@ -19654,11 +19746,15 @@ var Fetcher = class {
|
|
|
19654
19746
|
resolve2(gdata);
|
|
19655
19747
|
}).catch(async (e) => {
|
|
19656
19748
|
this.error(config, pipe, e);
|
|
19657
|
-
config?.error?.();
|
|
19749
|
+
config?.error?.(e);
|
|
19658
19750
|
if (config?.errorTransform) {
|
|
19659
19751
|
e = await config.errorTransform(e);
|
|
19660
19752
|
}
|
|
19661
|
-
|
|
19753
|
+
try {
|
|
19754
|
+
e = await this.errorTransform(e);
|
|
19755
|
+
} catch (ee) {
|
|
19756
|
+
e = ee;
|
|
19757
|
+
}
|
|
19662
19758
|
reject(e);
|
|
19663
19759
|
}).finally(() => {
|
|
19664
19760
|
this.finally(config, pipe);
|
|
@@ -19675,41 +19771,30 @@ var isHttpResponseError = (data) => {
|
|
|
19675
19771
|
return data instanceof HttpResponseError;
|
|
19676
19772
|
};
|
|
19677
19773
|
var HttpFetcher = class extends Fetcher {
|
|
19774
|
+
// get/post/put/patch/head/delete가 전부 config.config.fetch.method를 세팅하려고 caller가
|
|
19775
|
+
// 넘긴 config(.fetch) 객체를 직접 mutate했다 - 같은 config 객체를 여러 호출이 공유하면
|
|
19776
|
+
// (예: Promise.all로 동시에 get/post) 서로의 method를 덮어쓰는 레이스가 생겼다. caller의
|
|
19777
|
+
// 객체는 절대 건드리지 않고, 얕은 복사본 위에 method만 얹어서 반환한다.
|
|
19778
|
+
withMethod(config, method) {
|
|
19779
|
+
return { ...config, config: { ...config.config, fetch: { ...config.config?.fetch, method } } };
|
|
19780
|
+
}
|
|
19678
19781
|
get(config) {
|
|
19679
|
-
|
|
19680
|
-
config.config.fetch = config.config?.fetch ?? {};
|
|
19681
|
-
config.config.fetch.method = "GET";
|
|
19682
|
-
return this.fetch(config);
|
|
19782
|
+
return this.fetch(this.withMethod(config, "GET"));
|
|
19683
19783
|
}
|
|
19684
19784
|
post(config) {
|
|
19685
|
-
|
|
19686
|
-
config.config.fetch = config.config?.fetch ?? {};
|
|
19687
|
-
config.config.fetch.method = "POST";
|
|
19688
|
-
return this.fetch(config);
|
|
19785
|
+
return this.fetch(this.withMethod(config, "POST"));
|
|
19689
19786
|
}
|
|
19690
19787
|
patch(config) {
|
|
19691
|
-
|
|
19692
|
-
config.config.fetch = config.config?.fetch ?? {};
|
|
19693
|
-
config.config.fetch.method = "PATCH";
|
|
19694
|
-
return this.fetch(config);
|
|
19788
|
+
return this.fetch(this.withMethod(config, "PATCH"));
|
|
19695
19789
|
}
|
|
19696
19790
|
put(config) {
|
|
19697
|
-
|
|
19698
|
-
config.config.fetch = config.config?.fetch ?? {};
|
|
19699
|
-
config.config.fetch.method = "PUT";
|
|
19700
|
-
return this.fetch(config);
|
|
19791
|
+
return this.fetch(this.withMethod(config, "PUT"));
|
|
19701
19792
|
}
|
|
19702
19793
|
head(config) {
|
|
19703
|
-
|
|
19704
|
-
config.config.fetch = config.config?.fetch ?? {};
|
|
19705
|
-
config.config.fetch.method = "HEAD";
|
|
19706
|
-
return this.fetch(config);
|
|
19794
|
+
return this.fetch(this.withMethod(config, "HEAD"));
|
|
19707
19795
|
}
|
|
19708
19796
|
delete(config) {
|
|
19709
|
-
|
|
19710
|
-
config.config.fetch = config.config?.fetch ?? {};
|
|
19711
|
-
config.config.fetch.method = "DELETE";
|
|
19712
|
-
return this.fetch(config);
|
|
19797
|
+
return this.fetch(this.withMethod(config, "DELETE"));
|
|
19713
19798
|
}
|
|
19714
19799
|
async beforeProxyFetch(config) {
|
|
19715
19800
|
return config;
|
|
@@ -19746,7 +19831,7 @@ var HttpFetcher = class extends Fetcher {
|
|
|
19746
19831
|
}
|
|
19747
19832
|
} else {
|
|
19748
19833
|
httpResponseError.body = e;
|
|
19749
|
-
httpResponseError.message = e
|
|
19834
|
+
httpResponseError.message = e?.message;
|
|
19750
19835
|
}
|
|
19751
19836
|
return httpResponseError;
|
|
19752
19837
|
}
|
|
@@ -19756,7 +19841,7 @@ var HttpFetcher = class extends Fetcher {
|
|
|
19756
19841
|
if (!(target instanceof URL) && typeof target !== "string") {
|
|
19757
19842
|
const searchParams = ConvertUtils.toURLSearchParams(target.searchParams ?? {});
|
|
19758
19843
|
try {
|
|
19759
|
-
const url =
|
|
19844
|
+
const url = new URL(target.url);
|
|
19760
19845
|
searchParams.forEach((value, key) => {
|
|
19761
19846
|
url.searchParams.append(key, value);
|
|
19762
19847
|
});
|
|
@@ -19771,43 +19856,30 @@ var HttpFetcher = class extends Fetcher {
|
|
|
19771
19856
|
}
|
|
19772
19857
|
}
|
|
19773
19858
|
const beforeProxyData = { requestInfo: target, init: config?.fetch };
|
|
19774
|
-
let beforeData = config?.beforeProxyFetch ? await config?.beforeProxyFetch(
|
|
19775
|
-
beforeData = config?.skipGlobalBeforeProxyFetch ?
|
|
19859
|
+
let beforeData = config?.beforeProxyFetch ? await config?.beforeProxyFetch(beforeProxyData) : beforeProxyData;
|
|
19860
|
+
beforeData = config?.skipGlobalBeforeProxyFetch ? beforeData : await this.beforeProxyFetch(beforeData);
|
|
19776
19861
|
target = beforeData.requestInfo;
|
|
19777
19862
|
if (beforeData.init) {
|
|
19778
19863
|
config ?? (config = {});
|
|
19779
19864
|
config.fetch = beforeData.init;
|
|
19780
19865
|
}
|
|
19781
|
-
let
|
|
19866
|
+
let requestInit = config?.fetch;
|
|
19782
19867
|
if (config?.fetch && "timeout" in config.fetch) {
|
|
19783
|
-
const
|
|
19784
|
-
|
|
19785
|
-
|
|
19786
|
-
const inputSignal = config.fetch.signal;
|
|
19787
|
-
const listener = () => {
|
|
19788
|
-
if (!abortController.signal.aborted) {
|
|
19789
|
-
abortController.abort();
|
|
19790
|
-
}
|
|
19791
|
-
inputSignal.removeEventListener("abort", listener);
|
|
19792
|
-
};
|
|
19793
|
-
inputSignal.addEventListener("abort", listener);
|
|
19794
|
-
}
|
|
19795
|
-
if (!abortController.signal.aborted) {
|
|
19796
|
-
abortController.abort();
|
|
19797
|
-
}
|
|
19798
|
-
}, config.fetch.timeout);
|
|
19799
|
-
config.fetch.signal = abortController.signal;
|
|
19868
|
+
const timeoutSignal = AbortSignal.timeout(config.fetch.timeout);
|
|
19869
|
+
const signal = config.fetch.signal ? AbortSignal.any([timeoutSignal, config.fetch.signal]) : timeoutSignal;
|
|
19870
|
+
requestInit = { ...config.fetch, signal };
|
|
19800
19871
|
}
|
|
19801
|
-
this.beforeFetch({ target, requestInit
|
|
19802
|
-
return (config.fetcher ?? fetch)(target,
|
|
19803
|
-
this.afterFetch({ target, requestInit
|
|
19872
|
+
this.beforeFetch({ target, requestInit });
|
|
19873
|
+
return (config.fetcher ?? fetch)(target, requestInit).then(async (it) => {
|
|
19874
|
+
this.afterFetch({ target, requestInit }, it);
|
|
19804
19875
|
const afterProxyData = {
|
|
19805
|
-
fetch: { target, requestInit
|
|
19876
|
+
fetch: { target, requestInit },
|
|
19806
19877
|
config: beforeData,
|
|
19807
19878
|
response: it
|
|
19808
19879
|
};
|
|
19809
|
-
|
|
19810
|
-
|
|
19880
|
+
afterProxyData.response = config?.afterProxyFetch ? await config.afterProxyFetch(afterProxyData) : it;
|
|
19881
|
+
afterProxyData.response = config?.skipGlobalAfterProxyFetch ? afterProxyData.response : await this.afterProxyFetch(afterProxyData);
|
|
19882
|
+
it = afterProxyData.response;
|
|
19811
19883
|
config?.fetchResponseAfterCallBack?.(it, config);
|
|
19812
19884
|
if (!config?.allowedResponseNotOk && !it.ok) {
|
|
19813
19885
|
throw it;
|
|
@@ -19817,30 +19889,31 @@ var HttpFetcher = class extends Fetcher {
|
|
|
19817
19889
|
throw data;
|
|
19818
19890
|
}
|
|
19819
19891
|
return it;
|
|
19820
|
-
}).finally(() => {
|
|
19821
|
-
if (abortedTimeout) {
|
|
19822
|
-
clearTimeout(abortedTimeout);
|
|
19823
|
-
}
|
|
19824
19892
|
});
|
|
19825
19893
|
}
|
|
19826
19894
|
};
|
|
19827
19895
|
|
|
19828
19896
|
// ../core/dist/esm/fetch/HttpJsonFetcher.js
|
|
19829
19897
|
var HttpJsonFetcher = class extends HttpFetcher {
|
|
19898
|
+
// config.config/config.config.fetch를 직접 mutate하면(예전처럼) 같은 config 객체를 여러
|
|
19899
|
+
// postJson/patchJson/putJson 호출이 동시에 공유할 때 서로의 headers/body를 덮어쓰는 레이스가
|
|
19900
|
+
// 생긴다(HttpFetcher.get/post의 method 레이스랑 같은 문제). caller의 객체는 안 건드리고,
|
|
19901
|
+
// 얕은 복사본을 만들어서 새 config 객체를 리턴한다.
|
|
19830
19902
|
updateJsonFetchConfigAndData(config) {
|
|
19831
|
-
var _a4, _b3;
|
|
19832
19903
|
const headers = {
|
|
19833
19904
|
"Content-Type": "application/json",
|
|
19834
19905
|
Accept: "application/json, text/plain, */*"
|
|
19835
19906
|
};
|
|
19836
|
-
|
|
19837
|
-
|
|
19838
|
-
|
|
19839
|
-
|
|
19840
|
-
if (config.config?.fetch?.body && typeof config.config?.fetch?.body !== "string") {
|
|
19841
|
-
config.config.fetch.body = JSON.stringify(config.config.fetch.body);
|
|
19907
|
+
const fetchInit = { ...config.config?.fetch };
|
|
19908
|
+
const merged = new Headers(headers);
|
|
19909
|
+
if (fetchInit.headers) {
|
|
19910
|
+
new Headers(fetchInit.headers).forEach((value, key) => merged.set(key, value));
|
|
19842
19911
|
}
|
|
19843
|
-
|
|
19912
|
+
fetchInit.headers = merged;
|
|
19913
|
+
if (fetchInit.body && typeof fetchInit.body !== "string") {
|
|
19914
|
+
fetchInit.body = JSON.stringify(fetchInit.body);
|
|
19915
|
+
}
|
|
19916
|
+
return { ...config, config: { ...config.config, fetch: fetchInit } };
|
|
19844
19917
|
}
|
|
19845
19918
|
get(config) {
|
|
19846
19919
|
return super.get(config);
|
|
@@ -21354,7 +21427,7 @@ var StoreLoader = class {
|
|
|
21354
21427
|
|
|
21355
21428
|
// ../core/dist/esm/url/UrlUtils.js
|
|
21356
21429
|
var UrlUtils;
|
|
21357
|
-
((UrlUtils2)
|
|
21430
|
+
(function(UrlUtils2) {
|
|
21358
21431
|
UrlUtils2.origin = (fullurl) => {
|
|
21359
21432
|
return new URL(fullurl).origin;
|
|
21360
21433
|
};
|
|
@@ -21392,15 +21465,28 @@ var UrlUtils;
|
|
|
21392
21465
|
});
|
|
21393
21466
|
return searchParams;
|
|
21394
21467
|
};
|
|
21468
|
+
UrlUtils2.toAbsoluteUrl = (relative2, base) => {
|
|
21469
|
+
return new URL(relative2, base);
|
|
21470
|
+
};
|
|
21471
|
+
function toAbsoluteRequest(input, base) {
|
|
21472
|
+
if (input instanceof URL) {
|
|
21473
|
+
return UrlUtils2.toAbsoluteUrl(input.href, base);
|
|
21474
|
+
}
|
|
21475
|
+
if (typeof input === "string") {
|
|
21476
|
+
return UrlUtils2.toAbsoluteUrl(input, base).href;
|
|
21477
|
+
}
|
|
21478
|
+
return new Request(UrlUtils2.toAbsoluteUrl(input.url, base).href, input);
|
|
21479
|
+
}
|
|
21480
|
+
UrlUtils2.toAbsoluteRequest = toAbsoluteRequest;
|
|
21395
21481
|
UrlUtils2.manipulateSearchParams = (searchParams, options) => {
|
|
21396
21482
|
if (options?.delete) {
|
|
21397
|
-
|
|
21483
|
+
UrlUtils2.deleteSearchParam(searchParams, options.delete);
|
|
21398
21484
|
}
|
|
21399
21485
|
if (options?.append) {
|
|
21400
|
-
|
|
21486
|
+
UrlUtils2.appendSearchParam(searchParams, options.append);
|
|
21401
21487
|
}
|
|
21402
21488
|
if (options?.upsert) {
|
|
21403
|
-
|
|
21489
|
+
UrlUtils2.upsertSearchParam(searchParams, options.upsert);
|
|
21404
21490
|
}
|
|
21405
21491
|
return searchParams;
|
|
21406
21492
|
};
|
|
@@ -21651,12 +21737,13 @@ var ReflectUtils;
|
|
|
21651
21737
|
ReflectUtils2.findMetadata = (metadataKey, target, propertyKey) => {
|
|
21652
21738
|
if (target == null) return void 0;
|
|
21653
21739
|
let searchTarget = typeof target === "object" && typeof target !== "function" ? target.constructor : target;
|
|
21654
|
-
|
|
21740
|
+
const seen = /* @__PURE__ */ new Set();
|
|
21741
|
+
while (searchTarget && searchTarget !== Object && !seen.has(searchTarget)) {
|
|
21742
|
+
seen.add(searchTarget);
|
|
21655
21743
|
const data = propertyKey ? Reflect.getOwnMetadata(metadataKey, searchTarget, propertyKey) : Reflect.getOwnMetadata(metadataKey, searchTarget);
|
|
21656
21744
|
if (data !== void 0) return data;
|
|
21657
21745
|
const proto = Object.getPrototypeOf(searchTarget);
|
|
21658
21746
|
searchTarget = proto && typeof proto === "function" ? proto : proto?.constructor || null;
|
|
21659
|
-
if (searchTarget === target) break;
|
|
21660
21747
|
}
|
|
21661
21748
|
return void 0;
|
|
21662
21749
|
};
|
|
@@ -21664,12 +21751,13 @@ var ReflectUtils;
|
|
|
21664
21751
|
const results = [];
|
|
21665
21752
|
if (target == null) return results;
|
|
21666
21753
|
let searchTarget = typeof target === "object" && typeof target !== "function" ? target.constructor : target;
|
|
21667
|
-
|
|
21754
|
+
const seen = /* @__PURE__ */ new Set();
|
|
21755
|
+
while (searchTarget && searchTarget !== Object && !seen.has(searchTarget)) {
|
|
21756
|
+
seen.add(searchTarget);
|
|
21668
21757
|
const data = propertyKey ? Reflect.getOwnMetadata(metadataKey, searchTarget, propertyKey) : Reflect.getOwnMetadata(metadataKey, searchTarget);
|
|
21669
21758
|
if (data !== void 0) results.unshift(data);
|
|
21670
21759
|
const proto = Object.getPrototypeOf(searchTarget);
|
|
21671
21760
|
searchTarget = proto && typeof proto === "function" ? proto : proto?.constructor || null;
|
|
21672
|
-
if (searchTarget === target) break;
|
|
21673
21761
|
}
|
|
21674
21762
|
return results;
|
|
21675
21763
|
};
|
|
@@ -23794,6 +23882,23 @@ function getExpression(value, config) {
|
|
|
23794
23882
|
};
|
|
23795
23883
|
}
|
|
23796
23884
|
|
|
23885
|
+
// ../core/dist/esm/hash/HashUtils.js
|
|
23886
|
+
var HashUtils;
|
|
23887
|
+
((HashUtils2) => {
|
|
23888
|
+
const core53 = (str, seed) => {
|
|
23889
|
+
let h1 = 3735928559 ^ seed, h2 = 1103547991 ^ seed;
|
|
23890
|
+
for (let i = 0; i < str.length; i++) {
|
|
23891
|
+
const ch = str.charCodeAt(i);
|
|
23892
|
+
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
23893
|
+
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
23894
|
+
}
|
|
23895
|
+
h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909);
|
|
23896
|
+
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
23897
|
+
return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(16).padStart(14, "0");
|
|
23898
|
+
};
|
|
23899
|
+
HashUtils2.hash53 = (str, seed = 0, xyz = 16) => `${core53(str, seed)}${core53(str, seed + 1)}`.slice(0, Math.max(1, xyz));
|
|
23900
|
+
})(HashUtils || (HashUtils = {}));
|
|
23901
|
+
|
|
23797
23902
|
// ../core/dist/esm/index.js
|
|
23798
23903
|
var src_default = {
|
|
23799
23904
|
// Core utilities are exported as named exports above
|
|
@@ -23911,7 +24016,7 @@ var getPATCH = (target, propertyKey) => {
|
|
|
23911
24016
|
return getUrlMapping(target, propertyKey);
|
|
23912
24017
|
};
|
|
23913
24018
|
var getPATCHS = (target) => {
|
|
23914
|
-
return getUrlMappings(target)?.filter((it) => it.config?.method.toUpperCase() === "
|
|
24019
|
+
return getUrlMappings(target)?.filter((it) => it.config?.method.toUpperCase() === "PATCH" /* PATCH */);
|
|
23915
24020
|
};
|
|
23916
24021
|
function OPTIONS(configOrTarget, propertyKey, descriptor) {
|
|
23917
24022
|
if (propertyKey && descriptor) {
|
|
@@ -23943,7 +24048,7 @@ var getHEAD = (target, propertyKey) => {
|
|
|
23943
24048
|
return getUrlMapping(target, propertyKey);
|
|
23944
24049
|
};
|
|
23945
24050
|
var getHEADS = (target) => {
|
|
23946
|
-
return getUrlMappings(target)?.filter((it) => it.config?.method.toUpperCase() === "
|
|
24051
|
+
return getUrlMappings(target)?.filter((it) => it.config?.method.toUpperCase() === "HEAD" /* HEAD */);
|
|
23947
24052
|
};
|
|
23948
24053
|
function TRACE(configOrTarget, propertyKey, descriptor) {
|
|
23949
24054
|
if (propertyKey && descriptor) {
|
|
@@ -24899,7 +25004,16 @@ var SimAtomic = class {
|
|
|
24899
25004
|
}
|
|
24900
25005
|
if (!this.value) {
|
|
24901
25006
|
if (typeof this.type.targetKeyType === "symbol") {
|
|
24902
|
-
|
|
25007
|
+
const stored = this.simstanceManager.getStoreSet(this.type.targetKeyType);
|
|
25008
|
+
if (ValidUtils.isArrowFunction(stored?.instance)) {
|
|
25009
|
+
const fresh = stored.instance();
|
|
25010
|
+
if (this.getConfig()?.scope === Lifecycle.Singleton) {
|
|
25011
|
+
this.simstanceManager.setStoreSet(this.type.targetKeyType, fresh, stored.type);
|
|
25012
|
+
this.value = fresh;
|
|
25013
|
+
}
|
|
25014
|
+
return fresh;
|
|
25015
|
+
}
|
|
25016
|
+
this.value = stored?.instance;
|
|
24903
25017
|
} else {
|
|
24904
25018
|
this.value = this.simstanceManager.getOrNewSim({ target: this.type.targetKeyType, originTypeTarget: this.type.originalType, newInstanceCarrier: config?.newInstanceCarrier });
|
|
24905
25019
|
}
|
|
@@ -25454,7 +25568,7 @@ var SimstanceManager = class _SimstanceManager {
|
|
|
25454
25568
|
registerStore(targetKey, regTyps) {
|
|
25455
25569
|
const itemMap = this.storage.get(targetKey) ?? /* @__PURE__ */ new Map();
|
|
25456
25570
|
regTyps.forEach((it) => {
|
|
25457
|
-
const { type, value } = typeof it === "object" ? { type: it.constructor, value: it } : { type: it, value: void 0 };
|
|
25571
|
+
const { type, value } = ValidUtils.isArrowFunction(it) ? { type: it, value: it } : typeof it === "object" ? { type: it.constructor, value: it } : { type: it, value: void 0 };
|
|
25458
25572
|
if (!itemMap.has(type) || value !== void 0 && itemMap.get(type) === void 0) {
|
|
25459
25573
|
itemMap.set(type, value);
|
|
25460
25574
|
}
|
|
@@ -25707,9 +25821,16 @@ var SimstanceManager = class _SimstanceManager {
|
|
|
25707
25821
|
}
|
|
25708
25822
|
run(otherInstanceSim = /* @__PURE__ */ new Map()) {
|
|
25709
25823
|
for (const [k, v] of Array.from(otherInstanceSim.entries())) {
|
|
25710
|
-
const
|
|
25711
|
-
|
|
25712
|
-
|
|
25824
|
+
const hasType = typeof k === "object" && k !== null && "type" in k;
|
|
25825
|
+
const hasSymbol = typeof k === "object" && k !== null && !!k.symbol;
|
|
25826
|
+
const storageKey = hasType ? k.type : k;
|
|
25827
|
+
if (hasType || !hasSymbol) {
|
|
25828
|
+
this.registerStore(storageKey, /* @__PURE__ */ new Set([v]));
|
|
25829
|
+
}
|
|
25830
|
+
if (hasSymbol) {
|
|
25831
|
+
if (!ReflectUtils.getMetadata(SimMetadataKey, v)) {
|
|
25832
|
+
ReflectUtils.defineMetadata(SimMetadataKey, { ...k, scope: k.scope ?? Lifecycle.Singleton }, v);
|
|
25833
|
+
}
|
|
25713
25834
|
this.registerStore(k.symbol, /* @__PURE__ */ new Set([v]));
|
|
25714
25835
|
}
|
|
25715
25836
|
}
|
|
@@ -27667,7 +27788,6 @@ var ResourceFilter = class {
|
|
|
27667
27788
|
return it.test(url);
|
|
27668
27789
|
}
|
|
27669
27790
|
if (typeof it === "string") {
|
|
27670
|
-
console.log("url!!!!!!!", url);
|
|
27671
27791
|
return it === url;
|
|
27672
27792
|
}
|
|
27673
27793
|
if (typeof it === "function") {
|
|
@@ -27839,7 +27959,7 @@ var createHandler = (apiService) => {
|
|
|
27839
27959
|
fetch: {
|
|
27840
27960
|
credentials: "include",
|
|
27841
27961
|
headers,
|
|
27842
|
-
body: ConvertUtils.toFormData(userConfig
|
|
27962
|
+
body: userConfig?.body ? ConvertUtils.toFormData(userConfig.body) : void 0
|
|
27843
27963
|
}
|
|
27844
27964
|
}
|
|
27845
27965
|
});
|
|
@@ -28152,6 +28272,16 @@ var createTopicHandler = (apiService) => {
|
|
|
28152
28272
|
};
|
|
28153
28273
|
};
|
|
28154
28274
|
|
|
28275
|
+
// src/proxy/RequestResponseInjectProxy.ts
|
|
28276
|
+
var injectRequestResponse = (sim2, rr) => new Proxy(sim2, {
|
|
28277
|
+
get(target, prop) {
|
|
28278
|
+
const value = target[prop];
|
|
28279
|
+
if (prop === "constructor" || typeof value !== "function") return value;
|
|
28280
|
+
if (!rr) return value.bind(target);
|
|
28281
|
+
return (...args) => value.apply(target, [...args, rr]);
|
|
28282
|
+
}
|
|
28283
|
+
});
|
|
28284
|
+
|
|
28155
28285
|
// src/inject/InjectSituationType.ts
|
|
28156
28286
|
var InjectSituationType2;
|
|
28157
28287
|
((InjectSituationType3) => {
|
|
@@ -28176,6 +28306,7 @@ var ReqHeader = class {
|
|
|
28176
28306
|
|
|
28177
28307
|
// src/models/RequestResponse.ts
|
|
28178
28308
|
var import_node_gzip = __toESM(require_dist(), 1);
|
|
28309
|
+
import { createGzip, constants as zlibConstants } from "zlib";
|
|
28179
28310
|
import { Blob as Blob3 } from "node:buffer";
|
|
28180
28311
|
var RequestResponse = class _RequestResponse {
|
|
28181
28312
|
constructor(req, res, config) {
|
|
@@ -28614,6 +28745,57 @@ var RequestResponse = class _RequestResponse {
|
|
|
28614
28745
|
this.createRequestResponseChain(this.res.writeHead(statusCode, headers));
|
|
28615
28746
|
this.res.end();
|
|
28616
28747
|
}
|
|
28748
|
+
/**
|
|
28749
|
+
* 헤더를 즉시 보내고, source 가 내놓는 값을 하나씩 바로 body 에 쓴 뒤 end.
|
|
28750
|
+
* (SSE / 스트리밍 응답용. resWrite 는 버퍼링 후 resEnd 에서 한 번에 보내므로 스트리밍 불가)
|
|
28751
|
+
* - 문자열/Buffer 는 그대로, 그 외는 JSON.stringify
|
|
28752
|
+
* - Accept-Encoding 에 gzip 이 있으면 gzip 스트림으로 압축하고, 청크마다 Z_SYNC_FLUSH 로 바로 내보낸다
|
|
28753
|
+
* (flush 없이 쓰면 zlib 내부 버퍼에 모였다가 늦게 나가서 SSE 실시간성이 깨짐)
|
|
28754
|
+
* - 클라이언트가 끊으면 source.return() 으로 제너레이터를 종료시켜 finally 가 돌게 한다
|
|
28755
|
+
*/
|
|
28756
|
+
async resStream(source) {
|
|
28757
|
+
const res = this.res;
|
|
28758
|
+
const gz = this.reqHeaderFirst(HttpHeaders.AcceptEncoding)?.includes("gzip") ? createGzip() : void 0;
|
|
28759
|
+
if (gz) {
|
|
28760
|
+
res.setHeader(HttpHeaders.ContentEncoding, "gzip");
|
|
28761
|
+
res.removeHeader(HttpHeaders.ContentLength);
|
|
28762
|
+
gz.pipe(res);
|
|
28763
|
+
}
|
|
28764
|
+
const out = gz ?? res;
|
|
28765
|
+
res.flushHeaders();
|
|
28766
|
+
let closed = false;
|
|
28767
|
+
const onClose = () => {
|
|
28768
|
+
closed = true;
|
|
28769
|
+
source.return?.();
|
|
28770
|
+
};
|
|
28771
|
+
res.once("close", onClose);
|
|
28772
|
+
try {
|
|
28773
|
+
for await (const chunk of source) {
|
|
28774
|
+
if (closed) break;
|
|
28775
|
+
const data = typeof chunk === "string" || Buffer2.isBuffer(chunk) ? chunk : JSON.stringify(chunk);
|
|
28776
|
+
const ok = out.write(data);
|
|
28777
|
+
gz?.flush(zlibConstants.Z_SYNC_FLUSH);
|
|
28778
|
+
if (!ok) await new Promise((resolve2) => {
|
|
28779
|
+
out.once("drain", resolve2);
|
|
28780
|
+
res.once("close", resolve2);
|
|
28781
|
+
});
|
|
28782
|
+
}
|
|
28783
|
+
} catch (e) {
|
|
28784
|
+
if (!closed) throw e;
|
|
28785
|
+
} finally {
|
|
28786
|
+
res.off("close", onClose);
|
|
28787
|
+
if (closed) {
|
|
28788
|
+
gz?.destroy();
|
|
28789
|
+
} else if (!res.writableEnded) {
|
|
28790
|
+
const finished = new Promise((resolve2) => {
|
|
28791
|
+
res.once("finish", resolve2);
|
|
28792
|
+
res.once("close", resolve2);
|
|
28793
|
+
});
|
|
28794
|
+
out.end();
|
|
28795
|
+
await finished;
|
|
28796
|
+
}
|
|
28797
|
+
}
|
|
28798
|
+
}
|
|
28617
28799
|
resIsDone() {
|
|
28618
28800
|
return this.res.finished || this.res.writableEnded || this.res.headersSent;
|
|
28619
28801
|
}
|
|
@@ -28861,7 +29043,7 @@ var SessionManager = class {
|
|
|
28861
29043
|
import { IncomingMessage, Server as HttpServer, ServerResponse } from "http";
|
|
28862
29044
|
import { Server as HttpsServer } from "https";
|
|
28863
29045
|
|
|
28864
|
-
//
|
|
29046
|
+
// ../../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/wrapper.mjs
|
|
28865
29047
|
var import_stream = __toESM(require_stream(), 1);
|
|
28866
29048
|
var import_extension = __toESM(require_extension(), 1);
|
|
28867
29049
|
var import_permessage_deflate = __toESM(require_permessage_deflate(), 1);
|
|
@@ -28961,6 +29143,11 @@ var SimpleBootHttpServer = class _SimpleBootHttpServer extends SimpleApplication
|
|
|
28961
29143
|
otherStorage.set(RequestResponse, rr);
|
|
28962
29144
|
otherStorage.set(IncomingMessage, req);
|
|
28963
29145
|
otherStorage.set(ServerResponse, res);
|
|
29146
|
+
const abortController = new AbortController();
|
|
29147
|
+
res.once("close", () => {
|
|
29148
|
+
if (!res.writableFinished) abortController.abort();
|
|
29149
|
+
});
|
|
29150
|
+
otherStorage.set(AbortSignal, abortController.signal);
|
|
28964
29151
|
try {
|
|
28965
29152
|
transactionManager?.try();
|
|
28966
29153
|
if (this.option.requestEndPoints) {
|
|
@@ -29117,23 +29304,35 @@ var SimpleBootHttpServer = class _SimpleBootHttpServer extends SimpleApplication
|
|
|
29117
29304
|
target: moduleInstance,
|
|
29118
29305
|
targetKey: it.propertyKey
|
|
29119
29306
|
}, otherStorage);
|
|
29120
|
-
|
|
29121
|
-
|
|
29122
|
-
|
|
29123
|
-
|
|
29124
|
-
|
|
29125
|
-
|
|
29126
|
-
|
|
29127
|
-
headers
|
|
29128
|
-
|
|
29129
|
-
|
|
29130
|
-
|
|
29131
|
-
|
|
29132
|
-
|
|
29307
|
+
const resConfig = it.config?.res;
|
|
29308
|
+
if (resConfig === "manual") {
|
|
29309
|
+
} else if (ValidUtils.isGenerator(data) || ValidUtils.isAsyncGenerator(data)) {
|
|
29310
|
+
const headers = resConfig?.header ?? {};
|
|
29311
|
+
if (resConfig?.contentType) {
|
|
29312
|
+
headers[HttpHeaders.ContentType] = resConfig.contentType;
|
|
29313
|
+
}
|
|
29314
|
+
rr.resSetHeaders(headers);
|
|
29315
|
+
rr.resSetStatusCode(resConfig?.status ?? 200 /* Ok */);
|
|
29316
|
+
await rr.resStream(data);
|
|
29317
|
+
} else {
|
|
29318
|
+
if (it.config?.resolver) {
|
|
29319
|
+
const execute = typeof it.config.resolver === "function" ? this.simstanceManager.getOrNewSim({ target: it.config.resolver }) : it.config.resolver;
|
|
29320
|
+
data = await execute?.resolve?.(data, rr, resConfig);
|
|
29321
|
+
}
|
|
29322
|
+
const status = resConfig?.status ?? 200 /* Ok */;
|
|
29323
|
+
const headers = resConfig?.header ?? {};
|
|
29324
|
+
if (resConfig?.contentType) {
|
|
29325
|
+
headers[HttpHeaders.ContentType] = resConfig.contentType;
|
|
29326
|
+
}
|
|
29327
|
+
if ((resConfig?.contentType?.toLowerCase().indexOf("application/json" /* ApplicationJson */.toLowerCase()) ?? -1) > -1) {
|
|
29328
|
+
data = JSON.stringify(data);
|
|
29329
|
+
} else if (data && typeof data === "object") {
|
|
29330
|
+
data = JSON.stringify(data);
|
|
29331
|
+
}
|
|
29332
|
+
rr.resSetHeaders(headers);
|
|
29333
|
+
rr.resSetStatusCode(status);
|
|
29334
|
+
rr.resWrite(data);
|
|
29133
29335
|
}
|
|
29134
|
-
rr.resSetHeaders(headers);
|
|
29135
|
-
rr.resSetStatusCode(status);
|
|
29136
|
-
rr.resWrite(data);
|
|
29137
29336
|
}
|
|
29138
29337
|
}
|
|
29139
29338
|
if (this.option.noSuchRouteEndPointMappingThrow && methods.length <= 0 && rr.reqMethod()?.toUpperCase() !== "OPTIONS" /* OPTIONS */) {
|
|
@@ -29430,7 +29629,7 @@ var ElementUtils;
|
|
|
29430
29629
|
var ElementApply = class _ElementApply {
|
|
29431
29630
|
constructor(el, config) {
|
|
29432
29631
|
this.el = el;
|
|
29433
|
-
this.window = this.el.ownerDocument.defaultView;
|
|
29632
|
+
this.window = this.el.ownerDocument.defaultView ?? globalThis;
|
|
29434
29633
|
this.document = this.el.ownerDocument;
|
|
29435
29634
|
this.id = config?.id ?? el.id;
|
|
29436
29635
|
this.variableWrap = config?.variableWrap ?? { start: "@", end: "@" };
|
|
@@ -29453,6 +29652,8 @@ var ElementApply = class _ElementApply {
|
|
|
29453
29652
|
let match;
|
|
29454
29653
|
while ((match = regex.exec(script)) !== null) {
|
|
29455
29654
|
variables.push(match[1]);
|
|
29655
|
+
const root = match[1].split(/[.[(]/)[0].trim();
|
|
29656
|
+
if (root && root !== match[1]) variables.push(root);
|
|
29456
29657
|
}
|
|
29457
29658
|
return variables;
|
|
29458
29659
|
}
|
|
@@ -29557,10 +29758,15 @@ var ElementApply = class _ElementApply {
|
|
|
29557
29758
|
type.variables.forEach((v) => variables.add(v));
|
|
29558
29759
|
});
|
|
29559
29760
|
}
|
|
29761
|
+
const bind = config?.bind;
|
|
29762
|
+
const fromBind = (key) => bind != null && typeof key === "string" && !(key in (config?.context ?? {})) && _ElementApply.isUserMember(bind, key);
|
|
29560
29763
|
const context = new Proxy(config?.context ?? {}, {
|
|
29764
|
+
has(target, key) {
|
|
29765
|
+
return key in target || fromBind(key);
|
|
29766
|
+
},
|
|
29561
29767
|
get(target, key) {
|
|
29562
|
-
const value = target[key];
|
|
29563
|
-
return typeof value === "function" ? value.bind(
|
|
29768
|
+
const value = key in target ? target[key] : fromBind(key) ? bind[key] : void 0;
|
|
29769
|
+
return typeof value === "function" ? value.bind(bind ?? target) : value;
|
|
29564
29770
|
}
|
|
29565
29771
|
});
|
|
29566
29772
|
if (!config?.targetVariableName || config?.targetVariableName && variables.has(config?.targetVariableName)) {
|
|
@@ -29585,7 +29791,6 @@ var ElementApply = class _ElementApply {
|
|
|
29585
29791
|
}
|
|
29586
29792
|
}
|
|
29587
29793
|
`)(context).bind(it.node);
|
|
29588
|
-
console.log("------------------->", it, tit);
|
|
29589
29794
|
if (tit.type === "attribute" && !config?.exclude?.attribute) {
|
|
29590
29795
|
it.node.setAttribute(tit.name, data());
|
|
29591
29796
|
} else if (tit.type === "property" && !config?.exclude?.property) {
|
|
@@ -29605,6 +29810,15 @@ var ElementApply = class _ElementApply {
|
|
|
29605
29810
|
}
|
|
29606
29811
|
}
|
|
29607
29812
|
}
|
|
29813
|
+
/** key 가 네이티브(DOM/내장) prototype 이 아니라 사용자 클래스나 인스턴스에 정의돼 있으면 true */
|
|
29814
|
+
static isUserMember(obj, key) {
|
|
29815
|
+
for (let p = obj; p; p = Object.getPrototypeOf(p)) {
|
|
29816
|
+
if (!Object.prototype.hasOwnProperty.call(p, key)) continue;
|
|
29817
|
+
const ctor = p === obj ? null : p.constructor;
|
|
29818
|
+
return !(typeof ctor === "function" && /\[native code\]/.test(Function.prototype.toString.call(ctor)));
|
|
29819
|
+
}
|
|
29820
|
+
return false;
|
|
29821
|
+
}
|
|
29608
29822
|
removeAllEventListener() {
|
|
29609
29823
|
const m = this.findAllTarget().filter((it) => it.nodeType === "element").flatMap((it) => it.types.map((sit) => ({ ...sit, node: it.node })).filter((it2) => it2.type === "event"));
|
|
29610
29824
|
m.forEach((tit) => {
|
|
@@ -29982,15 +30196,21 @@ var NodeSlot = class _NodeSlot {
|
|
|
29982
30196
|
const slots = this.findSlots();
|
|
29983
30197
|
return slots.map((s) => s.nodes());
|
|
29984
30198
|
}
|
|
29985
|
-
|
|
29986
|
-
|
|
29987
|
-
|
|
29988
|
-
|
|
29989
|
-
|
|
29990
|
-
|
|
29991
|
-
|
|
29992
|
-
|
|
30199
|
+
/**
|
|
30200
|
+
* Shared disambiguation for the `(...items)` / `(targetId, ...items)` overload pair.
|
|
30201
|
+
* Items are always Node instances (or strings meant as literal content) coming from
|
|
30202
|
+
* callers; a leading string is therefore always treated as `targetId`, even when no
|
|
30203
|
+
* items follow — this avoids misclassifying `targetId` itself as content when the
|
|
30204
|
+
* caller has zero items to insert (e.g. a decorated method returning undefined).
|
|
30205
|
+
*/
|
|
30206
|
+
static parseTargetArgs(args) {
|
|
30207
|
+
if (typeof args[0] === "string") {
|
|
30208
|
+
return { targetId: args[0], items: args.slice(1) };
|
|
29993
30209
|
}
|
|
30210
|
+
return { targetId: void 0, items: args };
|
|
30211
|
+
}
|
|
30212
|
+
append(...args) {
|
|
30213
|
+
const { targetId, items } = _NodeSlot.parseTargetArgs(args);
|
|
29994
30214
|
if (!items || items.length === 0) return;
|
|
29995
30215
|
const slots = this.findSlots(targetId);
|
|
29996
30216
|
if (!slots || slots.length === 0) return;
|
|
@@ -29999,38 +30219,17 @@ var NodeSlot = class _NodeSlot {
|
|
|
29999
30219
|
}
|
|
30000
30220
|
}
|
|
30001
30221
|
appendHtml(...args) {
|
|
30002
|
-
|
|
30003
|
-
let items = [];
|
|
30004
|
-
if (typeof args[0] === "string" && args.length > 1) {
|
|
30005
|
-
targetId = args[0];
|
|
30006
|
-
items = args.slice(1);
|
|
30007
|
-
} else {
|
|
30008
|
-
items = args;
|
|
30009
|
-
}
|
|
30222
|
+
const { targetId, items } = _NodeSlot.parseTargetArgs(args);
|
|
30010
30223
|
const slots = this.findSlots(targetId);
|
|
30011
30224
|
for (const s of slots) s.appendHtml(...items);
|
|
30012
30225
|
}
|
|
30013
30226
|
appendText(...args) {
|
|
30014
|
-
|
|
30015
|
-
let items = [];
|
|
30016
|
-
if (typeof args[0] === "string" && args.length > 1) {
|
|
30017
|
-
targetId = args[0];
|
|
30018
|
-
items = args.slice(1);
|
|
30019
|
-
} else {
|
|
30020
|
-
items = args;
|
|
30021
|
-
}
|
|
30227
|
+
const { targetId, items } = _NodeSlot.parseTargetArgs(args);
|
|
30022
30228
|
const slots = this.findSlots(targetId);
|
|
30023
30229
|
for (const s of slots) s.appendText(...items);
|
|
30024
30230
|
}
|
|
30025
30231
|
appendCopy(...args) {
|
|
30026
|
-
|
|
30027
|
-
let items = [];
|
|
30028
|
-
if (typeof args[0] === "string" && args.length > 1) {
|
|
30029
|
-
targetId = args[0];
|
|
30030
|
-
items = args.slice(1);
|
|
30031
|
-
} else {
|
|
30032
|
-
items = args;
|
|
30033
|
-
}
|
|
30232
|
+
const { targetId, items } = _NodeSlot.parseTargetArgs(args);
|
|
30034
30233
|
if (!items || items.length === 0) return;
|
|
30035
30234
|
const slots = this.findSlots(targetId);
|
|
30036
30235
|
if (!slots || slots.length === 0) return;
|
|
@@ -30039,14 +30238,7 @@ var NodeSlot = class _NodeSlot {
|
|
|
30039
30238
|
}
|
|
30040
30239
|
}
|
|
30041
30240
|
prepend(...args) {
|
|
30042
|
-
|
|
30043
|
-
let items = [];
|
|
30044
|
-
if (typeof args[0] === "string" && args.length > 1) {
|
|
30045
|
-
targetId = args[0];
|
|
30046
|
-
items = args.slice(1);
|
|
30047
|
-
} else {
|
|
30048
|
-
items = args;
|
|
30049
|
-
}
|
|
30241
|
+
const { targetId, items } = _NodeSlot.parseTargetArgs(args);
|
|
30050
30242
|
if (!items || items.length === 0) return;
|
|
30051
30243
|
const slots = this.findSlots(targetId);
|
|
30052
30244
|
if (!slots || slots.length === 0) return;
|
|
@@ -30055,38 +30247,17 @@ var NodeSlot = class _NodeSlot {
|
|
|
30055
30247
|
}
|
|
30056
30248
|
}
|
|
30057
30249
|
prependHtml(...args) {
|
|
30058
|
-
|
|
30059
|
-
let items = [];
|
|
30060
|
-
if (typeof args[0] === "string" && args.length > 1) {
|
|
30061
|
-
targetId = args[0];
|
|
30062
|
-
items = args.slice(1);
|
|
30063
|
-
} else {
|
|
30064
|
-
items = args;
|
|
30065
|
-
}
|
|
30250
|
+
const { targetId, items } = _NodeSlot.parseTargetArgs(args);
|
|
30066
30251
|
const slots = this.findSlots(targetId);
|
|
30067
30252
|
for (const s of slots) s.prependHtml(...items);
|
|
30068
30253
|
}
|
|
30069
30254
|
prependText(...args) {
|
|
30070
|
-
|
|
30071
|
-
let items = [];
|
|
30072
|
-
if (typeof args[0] === "string" && args.length > 1) {
|
|
30073
|
-
targetId = args[0];
|
|
30074
|
-
items = args.slice(1);
|
|
30075
|
-
} else {
|
|
30076
|
-
items = args;
|
|
30077
|
-
}
|
|
30255
|
+
const { targetId, items } = _NodeSlot.parseTargetArgs(args);
|
|
30078
30256
|
const slots = this.findSlots(targetId);
|
|
30079
30257
|
for (const s of slots) s.prependText(...items);
|
|
30080
30258
|
}
|
|
30081
30259
|
prependCopy(...args) {
|
|
30082
|
-
|
|
30083
|
-
let items = [];
|
|
30084
|
-
if (typeof args[0] === "string" && args.length > 1) {
|
|
30085
|
-
targetId = args[0];
|
|
30086
|
-
items = args.slice(1);
|
|
30087
|
-
} else {
|
|
30088
|
-
items = args;
|
|
30089
|
-
}
|
|
30260
|
+
const { targetId, items } = _NodeSlot.parseTargetArgs(args);
|
|
30090
30261
|
if (!items || items.length === 0) return;
|
|
30091
30262
|
const slots = this.findSlots(targetId);
|
|
30092
30263
|
if (!slots || slots.length === 0) return;
|
|
@@ -30106,14 +30277,7 @@ var NodeSlot = class _NodeSlot {
|
|
|
30106
30277
|
}
|
|
30107
30278
|
}
|
|
30108
30279
|
replaceChildren(...args) {
|
|
30109
|
-
|
|
30110
|
-
let items = [];
|
|
30111
|
-
if (typeof args[0] === "string" && args.length > 1) {
|
|
30112
|
-
targetId = args[0];
|
|
30113
|
-
items = args.slice(1);
|
|
30114
|
-
} else {
|
|
30115
|
-
items = args;
|
|
30116
|
-
}
|
|
30280
|
+
const { targetId, items } = _NodeSlot.parseTargetArgs(args);
|
|
30117
30281
|
const slots = this.findSlots(targetId);
|
|
30118
30282
|
if (!slots || slots.length === 0) return;
|
|
30119
30283
|
for (const s of slots) {
|
|
@@ -30121,14 +30285,7 @@ var NodeSlot = class _NodeSlot {
|
|
|
30121
30285
|
}
|
|
30122
30286
|
}
|
|
30123
30287
|
replaceChildrenHtml(...args) {
|
|
30124
|
-
|
|
30125
|
-
let items = [];
|
|
30126
|
-
if (typeof args[0] === "string" && args.length > 1) {
|
|
30127
|
-
targetId = args[0];
|
|
30128
|
-
items = args.slice(1);
|
|
30129
|
-
} else {
|
|
30130
|
-
items = args;
|
|
30131
|
-
}
|
|
30288
|
+
const { targetId, items } = _NodeSlot.parseTargetArgs(args);
|
|
30132
30289
|
const slots = this.findSlots(targetId);
|
|
30133
30290
|
if (!slots || slots.length === 0) return;
|
|
30134
30291
|
for (const s of slots) {
|
|
@@ -30136,14 +30293,7 @@ var NodeSlot = class _NodeSlot {
|
|
|
30136
30293
|
}
|
|
30137
30294
|
}
|
|
30138
30295
|
replaceChildrenText(...args) {
|
|
30139
|
-
|
|
30140
|
-
let items = [];
|
|
30141
|
-
if (typeof args[0] === "string" && args.length > 1) {
|
|
30142
|
-
targetId = args[0];
|
|
30143
|
-
items = args.slice(1);
|
|
30144
|
-
} else {
|
|
30145
|
-
items = args;
|
|
30146
|
-
}
|
|
30296
|
+
const { targetId, items } = _NodeSlot.parseTargetArgs(args);
|
|
30147
30297
|
const slots = this.findSlots(targetId);
|
|
30148
30298
|
if (!slots || slots.length === 0) return;
|
|
30149
30299
|
for (const s of slots) {
|
|
@@ -30834,6 +30984,7 @@ var LocationUtils;
|
|
|
30834
30984
|
var ROUTER_NO_EVENT_MARKER = "__ROUTER_NO_EVENT__";
|
|
30835
30985
|
var Router2 = class {
|
|
30836
30986
|
constructor(config) {
|
|
30987
|
+
this.leaveGuards = /* @__PURE__ */ new Set();
|
|
30837
30988
|
this._config = config;
|
|
30838
30989
|
let routeData;
|
|
30839
30990
|
if (config?.firstUrl) {
|
|
@@ -30854,13 +31005,39 @@ var Router2 = class {
|
|
|
30854
31005
|
this.behaviorSubject = new BehaviorSubject(routeData);
|
|
30855
31006
|
}
|
|
30856
31007
|
this.config.window.addEventListener("popstate", (event) => {
|
|
30857
|
-
const
|
|
30858
|
-
this.
|
|
31008
|
+
const publish = () => this.behaviorSubject.next({ ...this.getRouteData(), triggerPoint: "end" });
|
|
31009
|
+
if (!this.leaveGuards.size) return publish();
|
|
31010
|
+
const from = this.value;
|
|
31011
|
+
void this.canLeave(this.getRouteData(), from).then((ok) => {
|
|
31012
|
+
if (ok) publish();
|
|
31013
|
+
else this.config.window.history?.pushState(from.data ?? null, "", from.url);
|
|
31014
|
+
});
|
|
30859
31015
|
});
|
|
30860
31016
|
}
|
|
30861
31017
|
get value() {
|
|
30862
31018
|
return this.behaviorSubject.getValue();
|
|
30863
31019
|
}
|
|
31020
|
+
/**
|
|
31021
|
+
* 이동 전 가드 등록. go() 와 뒤로/앞으로 가기(popstate)에 적용된다 (pushState/replaceState 직접 호출은 제외).
|
|
31022
|
+
* 리턴한 함수를 부르면 해제된다.
|
|
31023
|
+
*/
|
|
31024
|
+
addLeaveGuard(guard) {
|
|
31025
|
+
this.leaveGuards.add(guard);
|
|
31026
|
+
return () => {
|
|
31027
|
+
this.leaveGuards.delete(guard);
|
|
31028
|
+
};
|
|
31029
|
+
}
|
|
31030
|
+
/** 가드가 하나라도 있는지 (없으면 호출자가 동기로 진행해도 된다) */
|
|
31031
|
+
get hasLeaveGuards() {
|
|
31032
|
+
return this.leaveGuards.size > 0;
|
|
31033
|
+
}
|
|
31034
|
+
/** 등록된 가드를 순서대로 평가. 하나라도 false 면 false */
|
|
31035
|
+
async canLeave(to, from) {
|
|
31036
|
+
for (const guard of [...this.leaveGuards]) {
|
|
31037
|
+
if (await guard(to, from) === false) return false;
|
|
31038
|
+
}
|
|
31039
|
+
return true;
|
|
31040
|
+
}
|
|
30864
31041
|
get observable() {
|
|
30865
31042
|
return this.behaviorSubject.asObservable();
|
|
30866
31043
|
}
|
|
@@ -30991,17 +31168,24 @@ var Router2 = class {
|
|
|
30991
31168
|
if (typeof config === "string") {
|
|
30992
31169
|
config = { path: config };
|
|
30993
31170
|
}
|
|
30994
|
-
|
|
30995
|
-
|
|
30996
|
-
|
|
30997
|
-
|
|
30998
|
-
|
|
30999
|
-
|
|
31000
|
-
try {
|
|
31001
|
-
this._config.window?.scrollTo?.(0, 0);
|
|
31002
|
-
} catch (e) {
|
|
31171
|
+
const target = config;
|
|
31172
|
+
const navigate = () => {
|
|
31173
|
+
if (target?.replace) {
|
|
31174
|
+
this.replace(target.path, target.state);
|
|
31175
|
+
} else {
|
|
31176
|
+
this.push(target.path, target.state);
|
|
31003
31177
|
}
|
|
31004
|
-
|
|
31178
|
+
if (target.scrollToTop !== false) {
|
|
31179
|
+
try {
|
|
31180
|
+
this._config.window?.scrollTo?.(0, 0);
|
|
31181
|
+
} catch (e) {
|
|
31182
|
+
}
|
|
31183
|
+
}
|
|
31184
|
+
};
|
|
31185
|
+
if (!this.leaveGuards.size) return navigate();
|
|
31186
|
+
return this.canLeave(this.getRouteData({ pathOrUrl: this.toUrl(target.path) }), this.value).then((ok) => {
|
|
31187
|
+
if (ok) navigate();
|
|
31188
|
+
});
|
|
31005
31189
|
}
|
|
31006
31190
|
toUrl(data) {
|
|
31007
31191
|
let targetPath;
|
|
@@ -38261,6 +38445,7 @@ export {
|
|
|
38261
38445
|
getUrlMapping,
|
|
38262
38446
|
getUrlMappings,
|
|
38263
38447
|
headMethod,
|
|
38448
|
+
injectRequestResponse,
|
|
38264
38449
|
isDataDist,
|
|
38265
38450
|
isPathDist,
|
|
38266
38451
|
makeIntentHeaderBySymbolFor,
|