@dooboostore/simple-web-component 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.
Files changed (89) hide show
  1. package/README.md +216 -3424
  2. package/dist/cjs/decorators/addEventListener.js +4 -0
  3. package/dist/cjs/decorators/addEventListener.js.map +2 -2
  4. package/dist/cjs/decorators/attribute.js +32 -43
  5. package/dist/cjs/decorators/attribute.js.map +3 -3
  6. package/dist/cjs/decorators/elementDefine.js +45 -19
  7. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  8. package/dist/cjs/decorators/index.js +1 -0
  9. package/dist/cjs/decorators/index.js.map +2 -2
  10. package/dist/cjs/decorators/lifecycles.js +5 -5
  11. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  12. package/dist/cjs/decorators/query.js +4 -4
  13. package/dist/cjs/decorators/query.js.map +2 -2
  14. package/dist/cjs/decorators/queryAll.js +4 -4
  15. package/dist/cjs/decorators/queryAll.js.map +2 -2
  16. package/dist/cjs/decorators/subscribeSwcAppRouteChange.js +59 -0
  17. package/dist/cjs/decorators/subscribeSwcAppRouteChange.js.map +7 -0
  18. package/dist/cjs/elements/SwcAppEngine.js +18 -63
  19. package/dist/cjs/elements/SwcAppEngine.js.map +3 -3
  20. package/dist/cjs/elements/SwcAppMixin.js +103 -24
  21. package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
  22. package/dist/cjs/elements/register.js +0 -1
  23. package/dist/cjs/elements/register.js.map +2 -2
  24. package/dist/cjs/utils/Utils.js +18 -0
  25. package/dist/cjs/utils/Utils.js.map +3 -3
  26. package/dist/esm/decorators/addEventListener.js +4 -0
  27. package/dist/esm/decorators/addEventListener.js.map +2 -2
  28. package/dist/esm/decorators/attribute.js +32 -43
  29. package/dist/esm/decorators/attribute.js.map +3 -3
  30. package/dist/esm/decorators/elementDefine.js +46 -20
  31. package/dist/esm/decorators/elementDefine.js.map +2 -2
  32. package/dist/esm/decorators/index.js +1 -0
  33. package/dist/esm/decorators/index.js.map +2 -2
  34. package/dist/esm/decorators/lifecycles.js +5 -5
  35. package/dist/esm/decorators/lifecycles.js.map +2 -2
  36. package/dist/esm/decorators/query.js +4 -4
  37. package/dist/esm/decorators/query.js.map +2 -2
  38. package/dist/esm/decorators/queryAll.js +4 -4
  39. package/dist/esm/decorators/queryAll.js.map +2 -2
  40. package/dist/esm/decorators/subscribeSwcAppRouteChange.js +40 -0
  41. package/dist/esm/decorators/subscribeSwcAppRouteChange.js.map +7 -0
  42. package/dist/esm/elements/SwcAppEngine.js +18 -63
  43. package/dist/esm/elements/SwcAppEngine.js.map +2 -2
  44. package/dist/esm/elements/SwcAppMixin.js +103 -24
  45. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  46. package/dist/esm/elements/register.js +0 -1
  47. package/dist/esm/elements/register.js.map +2 -2
  48. package/dist/esm/utils/Utils.js +18 -0
  49. package/dist/esm/utils/Utils.js.map +3 -3
  50. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +177 -2477
  51. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  52. package/dist/types/decorators/addEventListener.d.ts +8 -1
  53. package/dist/types/decorators/addEventListener.d.ts.map +1 -1
  54. package/dist/types/decorators/attribute.d.ts +0 -1
  55. package/dist/types/decorators/attribute.d.ts.map +1 -1
  56. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  57. package/dist/types/decorators/index.d.ts +1 -0
  58. package/dist/types/decorators/index.d.ts.map +1 -1
  59. package/dist/types/decorators/lifecycles.d.ts +2 -2
  60. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  61. package/dist/types/decorators/query.d.ts +1 -1
  62. package/dist/types/decorators/query.d.ts.map +1 -1
  63. package/dist/types/decorators/queryAll.d.ts +1 -1
  64. package/dist/types/decorators/queryAll.d.ts.map +1 -1
  65. package/dist/types/decorators/subscribeSwcAppRouteChange.d.ts +18 -0
  66. package/dist/types/decorators/subscribeSwcAppRouteChange.d.ts.map +1 -0
  67. package/dist/types/elements/SwcAppEngine.d.ts +3 -5
  68. package/dist/types/elements/SwcAppEngine.d.ts.map +1 -1
  69. package/dist/types/elements/SwcAppMixin.d.ts +9 -0
  70. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  71. package/dist/types/elements/register.d.ts +1 -1
  72. package/dist/types/elements/register.d.ts.map +1 -1
  73. package/dist/types/utils/Utils.d.ts +3 -0
  74. package/dist/types/utils/Utils.d.ts.map +1 -1
  75. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +177 -2477
  76. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  77. package/package.json +2 -2
  78. package/src/decorators/addEventListener.ts +11 -1
  79. package/src/decorators/attribute.ts +62 -53
  80. package/src/decorators/elementDefine.ts +93 -30
  81. package/src/decorators/index.ts +1 -0
  82. package/src/decorators/lifecycles.ts +2 -2
  83. package/src/decorators/query.ts +5 -5
  84. package/src/decorators/queryAll.ts +8 -7
  85. package/src/decorators/subscribeSwcAppRouteChange.ts +71 -0
  86. package/src/elements/SwcAppEngine.ts +25 -81
  87. package/src/elements/SwcAppMixin.ts +143 -28
  88. package/src/elements/register.ts +0 -2
  89. package/src/utils/Utils.ts +33 -0
@@ -303,8 +303,8 @@ var dooboostoreSimpleWebComponent = (() => {
303
303
  keys.push(key);
304
304
  }
305
305
  }
306
- for (var _a4 = 0, parentKeys_1 = parentKeys; _a4 < parentKeys_1.length; _a4++) {
307
- var key = parentKeys_1[_a4];
306
+ for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) {
307
+ var key = parentKeys_1[_a];
308
308
  var hasKey = set.has(key);
309
309
  if (!hasKey) {
310
310
  set.add(key);
@@ -1139,15 +1139,17 @@ var dooboostoreSimpleWebComponent = (() => {
1139
1139
  ON_BEFORE_ADOPTED_METADATA_KEY: () => ON_BEFORE_ADOPTED_METADATA_KEY,
1140
1140
  ON_BEFORE_CONNECTED_METADATA_KEY: () => ON_BEFORE_CONNECTED_METADATA_KEY,
1141
1141
  ON_BEFORE_DISCONNECTED_METADATA_KEY: () => ON_BEFORE_DISCONNECTED_METADATA_KEY,
1142
- ON_CONSTRUCTOR_METADATA_KEY: () => ON_CONSTRUCTOR_METADATA_KEY,
1142
+ ON_INITIALIZE_METADATA_KEY: () => ON_INITIALIZE_METADATA_KEY,
1143
1143
  QUERY_ALL_METADATA_KEY: () => QUERY_ALL_METADATA_KEY,
1144
1144
  QUERY_METADATA_KEY: () => QUERY_METADATA_KEY,
1145
1145
  STYLE_METADATA_KEY: () => STYLE_METADATA_KEY,
1146
+ SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY: () => SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY,
1146
1147
  SWC_NOT_FOUND: () => SWC_NOT_FOUND,
1147
1148
  SwcUtils: () => SwcUtils,
1148
1149
  addClass: () => addClass,
1149
1150
  addClassHost: () => addClassHost,
1150
1151
  addEventListener: () => addEventListener,
1152
+ addEventListenerAppHost: () => addEventListenerAppHost,
1151
1153
  addEventListenerHost: () => addEventListenerHost,
1152
1154
  allAppHost: () => allAppHost,
1153
1155
  allFirstAppHost: () => allFirstAppHost,
@@ -1194,6 +1196,7 @@ var dooboostoreSimpleWebComponent = (() => {
1194
1196
  getOnConnectedInnerHtmlMetadata: () => getOnConnectedInnerHtmlMetadata,
1195
1197
  getQueryAllMetadata: () => getQueryAllMetadata,
1196
1198
  getQueryMetadata: () => getQueryMetadata,
1199
+ getSubscribeSwcAppRouteChangeMetadata: () => getSubscribeSwcAppRouteChangeMetadata,
1197
1200
  host: () => host,
1198
1201
  htmlAElement: () => htmlAElement,
1199
1202
  htmlArticleElement: () => htmlArticleElement,
@@ -1218,8 +1221,8 @@ var dooboostoreSimpleWebComponent = (() => {
1218
1221
  onBeforeDisconnected: () => onBeforeDisconnected,
1219
1222
  onConnected: () => onConnected,
1220
1223
  onConnectedInnerHtml: () => onConnectedInnerHtml,
1221
- onConstructor: () => onConstructor,
1222
1224
  onDisconnected: () => onDisconnected,
1225
+ onInitialize: () => onInitialize,
1223
1226
  parentHost: () => parentHost,
1224
1227
  query: () => query,
1225
1228
  queryAll: () => queryAll,
@@ -1238,6 +1241,7 @@ var dooboostoreSimpleWebComponent = (() => {
1238
1241
  setClassHost: () => setClassHost,
1239
1242
  setStyle: () => setStyle,
1240
1243
  setStyleHost: () => setStyleHost,
1244
+ subscribeSwcAppRouteChange: () => subscribeSwcAppRouteChange,
1241
1245
  textNode: () => textNode,
1242
1246
  toggleClass: () => toggleClass,
1243
1247
  toggleClassHost: () => toggleClassHost,
@@ -1248,10 +1252,10 @@ var dooboostoreSimpleWebComponent = (() => {
1248
1252
  updateStyle: () => updateStyle,
1249
1253
  updateStyleHost: () => updateStyleHost
1250
1254
  });
1251
- var import_reflect_metadata3 = __toESM(require_Reflect(), 1);
1255
+ var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
1252
1256
 
1253
1257
  // src/index.ts
1254
- var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
1258
+ var import_reflect_metadata = __toESM(require_Reflect(), 1);
1255
1259
 
1256
1260
  // ../core/dist/esm/valid/ValidUtils.js
1257
1261
  var ValidUtils;
@@ -4927,107 +4931,6 @@ var dooboostoreSimpleWebComponent = (() => {
4927
4931
  }
4928
4932
  };
4929
4933
 
4930
- // ../core/dist/esm/message/Subject.js
4931
- var Subject = class extends Observable {
4932
- constructor() {
4933
- super((subscriber) => {
4934
- return this._subscribeToSubject(subscriber);
4935
- });
4936
- this._observers = /* @__PURE__ */ new Set();
4937
- this._isStopped = false;
4938
- this._hasError = false;
4939
- }
4940
- _subscribeToSubject(subscriber) {
4941
- const partialObserver = {
4942
- next: subscriber.next.bind(subscriber),
4943
- error: subscriber.error.bind(subscriber),
4944
- complete: subscriber.complete.bind(subscriber)
4945
- };
4946
- if (this._isStopped) {
4947
- if (this._hasError) {
4948
- partialObserver.error?.(this._error);
4949
- } else {
4950
- partialObserver.complete?.();
4951
- }
4952
- return Subscription.EMPTY;
4953
- }
4954
- this._observers.add(partialObserver);
4955
- return new Subscription(() => {
4956
- this._observers.delete(partialObserver);
4957
- });
4958
- }
4959
- next(data) {
4960
- if (this._isStopped) {
4961
- return;
4962
- }
4963
- this._observers.forEach((observer) => {
4964
- observer.next?.(data);
4965
- });
4966
- }
4967
- error(err) {
4968
- if (this._isStopped) {
4969
- return;
4970
- }
4971
- this._hasError = true;
4972
- this._error = err;
4973
- this._isStopped = true;
4974
- this._observers.forEach((observer) => observer.error?.(err));
4975
- this._observers.clear();
4976
- }
4977
- complete() {
4978
- if (this._isStopped) {
4979
- return;
4980
- }
4981
- this._isStopped = true;
4982
- this._observers.forEach((observer) => observer.complete?.());
4983
- this._observers.clear();
4984
- }
4985
- asObservable() {
4986
- return new Observable((subscriber) => {
4987
- return this._subscribeToSubject(subscriber);
4988
- });
4989
- }
4990
- };
4991
-
4992
- // ../core/dist/esm/message/ReplaySubject.js
4993
- var ReplaySubject = class extends Subject {
4994
- // Removed: private _error: E | undefined;
4995
- // Removed: private _isStopped = false;
4996
- constructor(bufferSize = Infinity) {
4997
- super();
4998
- this.bufferSize = bufferSize;
4999
- this._buffer = [];
5000
- }
5001
- next(data) {
5002
- if (this._isStopped) {
5003
- return;
5004
- }
5005
- this._buffer.push(data);
5006
- if (this._buffer.length > this.bufferSize) {
5007
- this._buffer.shift();
5008
- }
5009
- super.next(data);
5010
- }
5011
- error(err) {
5012
- super.error(err);
5013
- }
5014
- complete() {
5015
- super.complete();
5016
- }
5017
- _subscribeToSubject(subscriber) {
5018
- this._buffer.forEach((value) => subscriber.next(value));
5019
- if (this._isStopped) {
5020
- if (this._hasError) {
5021
- subscriber.error(this._error);
5022
- } else {
5023
- subscriber.complete();
5024
- }
5025
- return Subscription.EMPTY;
5026
- }
5027
- return super._subscribeToSubject(subscriber);
5028
- }
5029
- };
5030
-
5031
4934
  // ../core/dist/esm/message/AutoCloseSubscription.js
5032
4935
  var AutoCloseSubscription = class extends Subscription {
5033
4936
  constructor(userUnsubscribe) {
@@ -5362,284 +5265,6 @@ var dooboostoreSimpleWebComponent = (() => {
5362
5265
  })(Result = Promises2.Result || (Promises2.Result = {}));
5363
5266
  })(Promises || (Promises = {}));
5364
5267
 
5365
- // ../core/dist/esm/fetch/Fetcher.js
5366
- var Fetcher = class {
5367
- createPipe(config) {
5368
- return {};
5369
- }
5370
- fetch(config) {
5371
- return new Promise((resolve, reject) => {
5372
- const pipe = this.createPipe(config);
5373
- Promise.resolve().then(() => {
5374
- this.before(config, pipe);
5375
- config?.before?.();
5376
- }).then(() => {
5377
- return this.execute(config);
5378
- }).then((data) => {
5379
- const hasError = config.config?.hasErrorChecker?.(data);
5380
- if (hasError) {
5381
- throw hasError;
5382
- }
5383
- pipe.responseData = data;
5384
- this.afterSuccess(config, pipe);
5385
- config?.afterSuccess?.();
5386
- const gdata = config?.transform ? config.transform(data) : data;
5387
- this.afterSuccessTransform(config, pipe);
5388
- resolve(gdata);
5389
- }).catch(async (e) => {
5390
- this.error(config, pipe, e);
5391
- config?.error?.();
5392
- if (config?.errorTransform) {
5393
- e = await config.errorTransform(e);
5394
- }
5395
- e = await this.errorTransform(e);
5396
- reject(e);
5397
- }).finally(() => {
5398
- this.finally(config, pipe);
5399
- config?.finally?.();
5400
- });
5401
- });
5402
- }
5403
- };
5404
-
5405
- // ../core/dist/esm/fetch/HttpFetcher.js
5406
- var HttpResponseError = class extends Error {
5407
- };
5408
- var HttpFetcher = class extends Fetcher {
5409
- get(config) {
5410
- config.config ?? (config.config = {});
5411
- config.config.fetch = config.config?.fetch ?? {};
5412
- config.config.fetch.method = "GET";
5413
- return this.fetch(config);
5414
- }
5415
- post(config) {
5416
- config.config ?? (config.config = {});
5417
- config.config.fetch = config.config?.fetch ?? {};
5418
- config.config.fetch.method = "POST";
5419
- return this.fetch(config);
5420
- }
5421
- patch(config) {
5422
- config.config ?? (config.config = {});
5423
- config.config.fetch = config.config?.fetch ?? {};
5424
- config.config.fetch.method = "PATCH";
5425
- return this.fetch(config);
5426
- }
5427
- put(config) {
5428
- config.config ?? (config.config = {});
5429
- config.config.fetch = config.config?.fetch ?? {};
5430
- config.config.fetch.method = "PUT";
5431
- return this.fetch(config);
5432
- }
5433
- head(config) {
5434
- config.config ?? (config.config = {});
5435
- config.config.fetch = config.config?.fetch ?? {};
5436
- config.config.fetch.method = "HEAD";
5437
- return this.fetch(config);
5438
- }
5439
- delete(config) {
5440
- config.config ?? (config.config = {});
5441
- config.config.fetch = config.config?.fetch ?? {};
5442
- config.config.fetch.method = "DELETE";
5443
- return this.fetch(config);
5444
- }
5445
- async beforeProxyFetch(config) {
5446
- return config;
5447
- }
5448
- async afterProxyFetch(config) {
5449
- return config.response;
5450
- }
5451
- afterSuccess(config, pipe) {
5452
- }
5453
- afterSuccessTransform(config, pipe) {
5454
- }
5455
- before(config, pipe) {
5456
- }
5457
- error(config, pipe, e) {
5458
- }
5459
- finally(config, pipe) {
5460
- }
5461
- beforeFetch(fetch2) {
5462
- }
5463
- afterFetch(fetch2, response) {
5464
- }
5465
- // protected async errorTransform(e: any): Promise<HttpResponseError<any>> {
5466
- async errorTransform(e) {
5467
- const httpResponseError = new HttpResponseError();
5468
- httpResponseError.error = e;
5469
- if (e instanceof Response) {
5470
- httpResponseError.response = e;
5471
- try {
5472
- httpResponseError.body = await e.clone().text();
5473
- httpResponseError.message = e.statusText;
5474
- } catch (e2) {
5475
- httpResponseError.body = e2;
5476
- httpResponseError.message = e2.message;
5477
- }
5478
- } else {
5479
- httpResponseError.body = e;
5480
- httpResponseError.message = e.message;
5481
- }
5482
- return httpResponseError;
5483
- }
5484
- async execute(fetcherRequest) {
5485
- let target = fetcherRequest.target;
5486
- let config = fetcherRequest.config;
5487
- if (!(target instanceof URL) && typeof target !== "string") {
5488
- const searchParams = ConvertUtils.toURLSearchParams(target.searchParams ?? {});
5489
- try {
5490
- const url = typeof target.url === "string" ? new URL(target.url) : target.url;
5491
- searchParams.forEach((value, key) => {
5492
- url.searchParams.append(key, value);
5493
- });
5494
- target = url;
5495
- } catch (e) {
5496
- if (typeof target.url === "string") {
5497
- const searchParamString = searchParams.toString();
5498
- target = target.url + (searchParamString ? "?" + searchParamString : "");
5499
- } else {
5500
- target = "";
5501
- }
5502
- }
5503
- }
5504
- const beforeProxyData = { requestInfo: target, init: config?.fetch };
5505
- let beforeData = config?.beforeProxyFetch ? await config?.beforeProxyFetch(config) : beforeProxyData.requestInfo;
5506
- beforeData = config?.skipGlobalBeforeProxyFetch ? beforeProxyData : await this.beforeProxyFetch(beforeProxyData);
5507
- target = beforeData.requestInfo;
5508
- if (beforeData.init) {
5509
- config ?? (config = {});
5510
- config.fetch = beforeData.init;
5511
- }
5512
- let abortedTimeout;
5513
- if (config?.fetch && "timeout" in config.fetch) {
5514
- const abortController = new AbortController();
5515
- abortedTimeout = setTimeout(() => {
5516
- if (config?.fetch?.signal) {
5517
- const inputSignal = config.fetch.signal;
5518
- const listener = () => {
5519
- if (!abortController.signal.aborted) {
5520
- abortController.abort();
5521
- }
5522
- inputSignal.removeEventListener("abort", listener);
5523
- };
5524
- inputSignal.addEventListener("abort", listener);
5525
- }
5526
- if (!abortController.signal.aborted) {
5527
- abortController.abort();
5528
- }
5529
- }, config.fetch.timeout);
5530
- config.fetch.signal = abortController.signal;
5531
- }
5532
- this.beforeFetch({ target, requestInit: config?.fetch });
5533
- return (config.fetcher ?? fetch)(target, config?.fetch).then(async (it) => {
5534
- this.afterFetch({ target, requestInit: config?.fetch }, it);
5535
- const afterProxyData = {
5536
- fetch: { target, requestInit: config.fetch },
5537
- config: beforeData,
5538
- response: it
5539
- };
5540
- it = config?.afterProxyFetch ? await config.afterProxyFetch(afterProxyData) : it;
5541
- it = config?.skipGlobalAfterProxyFetch ? it : await this.afterProxyFetch(afterProxyData);
5542
- config?.fetchResponseAfterCallBack?.(it, config);
5543
- if (!config?.allowedResponseNotOk && !it.ok) {
5544
- throw it;
5545
- }
5546
- const data = config?.hasResponseErrorChecker?.(it, config);
5547
- if (data) {
5548
- throw data;
5549
- }
5550
- return it;
5551
- }).finally(() => {
5552
- if (abortedTimeout) {
5553
- clearTimeout(abortedTimeout);
5554
- }
5555
- });
5556
- }
5557
- };
5558
-
5559
- // ../core/dist/esm/fetch/HttpJsonFetcher.js
5560
- var HttpJsonFetcher = class extends HttpFetcher {
5561
- updateJsonFetchConfigAndData(config) {
5562
- var _a4, _b2;
5563
- const headers = {
5564
- "Content-Type": "application/json",
5565
- Accept: "application/json, text/plain, */*"
5566
- };
5567
- config.config ?? (config.config = {});
5568
- (_a4 = config.config).fetch ?? (_a4.fetch = {});
5569
- (_b2 = config.config.fetch).headers ?? (_b2.headers = {});
5570
- config.config.fetch.headers = { ...headers, ...config.config.fetch?.headers };
5571
- if (config.config?.fetch?.body && typeof config.config?.fetch?.body !== "string") {
5572
- config.config.fetch.body = JSON.stringify(config.config.fetch.body);
5573
- }
5574
- return config;
5575
- }
5576
- get(config) {
5577
- return super.get(config);
5578
- }
5579
- delete(config) {
5580
- return super.delete(config);
5581
- }
5582
- post(config) {
5583
- return super.post(config);
5584
- }
5585
- patch(config) {
5586
- return super.patch(config);
5587
- }
5588
- put(config) {
5589
- return super.put(config);
5590
- }
5591
- head(config) {
5592
- return super.head(config);
5593
- }
5594
- postJson(config) {
5595
- return super.post(this.updateJsonFetchConfigAndData(config));
5596
- }
5597
- patchJson(config) {
5598
- return super.patch(this.updateJsonFetchConfigAndData(config));
5599
- }
5600
- putJson(config) {
5601
- return super.put(this.updateJsonFetchConfigAndData(config));
5602
- }
5603
- async errorTransform(e) {
5604
- const httpResponseError = new HttpResponseError();
5605
- httpResponseError.error = e;
5606
- if (e instanceof Response) {
5607
- httpResponseError.response = e;
5608
- try {
5609
- httpResponseError.body = await e.clone().json();
5610
- httpResponseError.message = e.statusText;
5611
- } catch (parseError) {
5612
- httpResponseError.body = parseError;
5613
- httpResponseError.message = parseError.message;
5614
- }
5615
- } else {
5616
- httpResponseError.body = e;
5617
- httpResponseError.message = e.message;
5618
- }
5619
- return httpResponseError;
5620
- }
5621
- // protected execute(target: HttpFetcherTarget, config?: HttpJsonFetcherConfig<C, any>): Promise<any> {
5622
- execute(fetcherRequest) {
5623
- return super.execute(fetcherRequest).then((response) => {
5624
- const config = fetcherRequest.config;
5625
- const transform = config?.responseTransform ?? (config?.bypassTransform ? "response" : config?.transformText ? "text" : void 0);
5626
- if (transform === "response") {
5627
- return response;
5628
- } else if (transform === "text") {
5629
- return response?.text();
5630
- } else if (typeof transform === "function") {
5631
- return transform(response);
5632
- } else {
5633
- return response?.text().then((it) => {
5634
- if ((it ?? "").length > 0) {
5635
- return JSON.parse(it);
5636
- }
5637
- });
5638
- }
5639
- });
5640
- }
5641
- };
5642
-
5643
5268
  // ../core/dist/esm/entity/object/obj/RenderDrawObj.js
5644
5269
  var RenderDrawObj = class extends Obj {
5645
5270
  render(draw, config) {
@@ -5916,7 +5541,7 @@ var dooboostoreSimpleWebComponent = (() => {
5916
5541
  // ../core/dist/esm/schedule/Schedule.js
5917
5542
  var Schedule;
5918
5543
  ((Schedule2) => {
5919
- Schedule2.SYMBOL = Symbol("Schedule");
5544
+ Schedule2.SYMBOL = Symbol.for("core:schedule-token");
5920
5545
  })(Schedule || (Schedule = {}));
5921
5546
 
5922
5547
  // ../core/dist/esm/url/UrlUtils.js
@@ -6070,6 +5695,17 @@ var dooboostoreSimpleWebComponent = (() => {
6070
5695
  Reflect.defineMetadata(metadataKey, value, target);
6071
5696
  }
6072
5697
  };
5698
+ ReflectUtils2.copyMetadata = (from, to, propertyKey) => {
5699
+ const keys = propertyKey ? Reflect.getOwnMetadataKeys(from, propertyKey) : Reflect.getOwnMetadataKeys(from);
5700
+ for (const key of keys) {
5701
+ const data = propertyKey ? Reflect.getOwnMetadata(key, from, propertyKey) : Reflect.getOwnMetadata(key, from);
5702
+ if (propertyKey) {
5703
+ Reflect.defineMetadata(key, data, to, propertyKey);
5704
+ } else {
5705
+ Reflect.defineMetadata(key, data, to);
5706
+ }
5707
+ }
5708
+ };
6073
5709
  })(ReflectUtils || (ReflectUtils = {}));
6074
5710
 
6075
5711
  // ../core/dist/esm/function/FunctionUtils.js
@@ -6252,9 +5888,12 @@ var dooboostoreSimpleWebComponent = (() => {
6252
5888
  function addEventListenerHost(type, options) {
6253
5889
  return addEventListener(":host", type, options);
6254
5890
  }
5891
+ function addEventListenerAppHost(type, options) {
5892
+ return addEventListener(":appHost", type, options);
5893
+ }
6255
5894
 
6256
5895
  // src/decorators/lifecycles.ts
6257
- var ON_CONSTRUCTOR_METADATA_KEY = Symbol.for("simple-web-component:on-constructor");
5896
+ var ON_INITIALIZE_METADATA_KEY = Symbol.for("simple-web-component:on-constructor");
6258
5897
  var ON_BEFORE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-connected");
6259
5898
  var ON_AFTER_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-connected");
6260
5899
  var ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-disconnected");
@@ -6275,7 +5914,7 @@ var dooboostoreSimpleWebComponent = (() => {
6275
5914
  list.push(propertyKey);
6276
5915
  };
6277
5916
  }
6278
- var onConstructor = createLifecycleDecorator(ON_CONSTRUCTOR_METADATA_KEY);
5917
+ var onInitialize = createLifecycleDecorator(ON_INITIALIZE_METADATA_KEY);
6279
5918
  var onBeforeConnected = createLifecycleDecorator(ON_BEFORE_CONNECTED_METADATA_KEY);
6280
5919
  var onAfterConnected = createLifecycleDecorator(ON_AFTER_CONNECTED_METADATA_KEY);
6281
5920
  var onConnected = onAfterConnected;
@@ -6390,49 +6029,37 @@ var dooboostoreSimpleWebComponent = (() => {
6390
6029
  }
6391
6030
  });
6392
6031
  };
6393
- Object.defineProperty(target, propertyKey, {
6394
- get() {
6395
- const attrName = options.name || String(propertyKey);
6396
- const conf = getElementConfig(this);
6397
- const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6398
- const targetType = options.type || designType;
6399
- if (this.__swc_syncing_init || options.connectedInitialize && !this.__swc_connected) {
6400
- return convertValue(this[privateKey], targetType);
6401
- }
6402
- const targets = resolveTargetEls(this, selector, options, currentWin);
6403
- const primaryTarget = targets[0];
6404
- if (primaryTarget && typeof primaryTarget.hasAttribute === "function") {
6405
- if (primaryTarget.hasAttribute(attrName)) {
6406
- const domVal = primaryTarget.getAttribute(attrName);
6407
- return convertValue(domVal, targetType);
6408
- }
6409
- return null;
6410
- }
6411
- return convertValue(this[privateKey], targetType);
6412
- },
6413
- set(nv) {
6414
- const attrName = options.name || String(propertyKey);
6415
- const conf = getElementConfig(this);
6416
- const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6417
- if (this.__swc_syncing_init) {
6418
- if (options.connectedInitialize === true) {
6419
- const targets2 = resolveTargetEls(this, selector, options, currentWin);
6420
- applySetAttribute(this, targets2, attrName, nv);
6421
- } else {
6422
- this[privateKey] = nv;
6032
+ try {
6033
+ Object.defineProperty(target, propertyKey, {
6034
+ get() {
6035
+ const attrName = options.name || String(propertyKey);
6036
+ const conf = getElementConfig(this);
6037
+ const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6038
+ const targetType = options.type || designType;
6039
+ const targets = resolveTargetEls(this, selector, options, currentWin);
6040
+ const primaryTarget = targets[0];
6041
+ if (primaryTarget && typeof primaryTarget.hasAttribute === "function") {
6042
+ if (primaryTarget.hasAttribute(attrName)) {
6043
+ const domVal = primaryTarget.getAttribute(attrName);
6044
+ return convertValue(domVal, targetType);
6045
+ }
6046
+ return null;
6423
6047
  }
6424
- return;
6425
- }
6426
- if (!this.__swc_connected) {
6427
- this[privateKey] = nv;
6428
- return;
6429
- }
6430
- const targets = resolveTargetEls(this, selector, options, currentWin);
6431
- applySetAttribute(this, targets, attrName, nv);
6432
- },
6433
- enumerable: true,
6434
- configurable: true
6435
- });
6048
+ return convertValue(this[privateKey], targetType);
6049
+ },
6050
+ set(nv) {
6051
+ const attrName = options.name || String(propertyKey);
6052
+ const conf = getElementConfig(this);
6053
+ const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6054
+ const targets = resolveTargetEls(this, selector, options, currentWin);
6055
+ applySetAttribute(this, targets, attrName, nv);
6056
+ },
6057
+ enumerable: true,
6058
+ configurable: true
6059
+ });
6060
+ } catch (err) {
6061
+ console.error("[SWC] defineProperty error:", err);
6062
+ }
6436
6063
  };
6437
6064
  }
6438
6065
  function attributeHost(targetOrAttrOrOptions, propertyKeyOrOptions) {
@@ -6455,7 +6082,8 @@ var dooboostoreSimpleWebComponent = (() => {
6455
6082
  }
6456
6083
  }
6457
6084
  var findAllAttributeMetadata = (target) => {
6458
- return ReflectUtils.findAllMetadata(ATTRIBUTE_FIELD_METADATA_KEY, target).flat();
6085
+ const actualTarget = target instanceof Function ? target : target.constructor;
6086
+ return ReflectUtils.findAllMetadata(ATTRIBUTE_FIELD_METADATA_KEY, actualTarget).flat();
6459
6087
  };
6460
6088
 
6461
6089
  // src/decorators/changedAttributeHost.ts
@@ -6711,10 +6339,6 @@ var dooboostoreSimpleWebComponent = (() => {
6711
6339
  });
6712
6340
  };
6713
6341
  }
6714
- var getQueryMetadata = (target) => {
6715
- const constructor = target instanceof Function ? target : target.constructor;
6716
- return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
6717
- };
6718
6342
  function queryHost(targetOrOptions, propertyKey) {
6719
6343
  if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6720
6344
  return query(":host", {})(targetOrOptions, propertyKey);
@@ -6786,6 +6410,10 @@ var dooboostoreSimpleWebComponent = (() => {
6786
6410
  return query(":lastAppHost", {});
6787
6411
  }
6788
6412
  }
6413
+ var getQueryMetadata = (target) => {
6414
+ const constructor = target instanceof Function ? target : target.constructor;
6415
+ return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
6416
+ };
6789
6417
 
6790
6418
  // src/decorators/queryAll.ts
6791
6419
  var QUERY_ALL_METADATA_KEY = Symbol.for("simple-web-component:query-all");
@@ -6879,10 +6507,6 @@ var dooboostoreSimpleWebComponent = (() => {
6879
6507
  });
6880
6508
  };
6881
6509
  }
6882
- var getQueryAllMetadata = (target) => {
6883
- const constructor = target instanceof Function ? target : target.constructor;
6884
- return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
6885
- };
6886
6510
  function queryAllHost(targetOrOptions, propertyKey) {
6887
6511
  if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6888
6512
  return queryAll(":host", {})(targetOrOptions, propertyKey);
@@ -6954,6 +6578,10 @@ var dooboostoreSimpleWebComponent = (() => {
6954
6578
  return queryAll(":lastAppHost", {});
6955
6579
  }
6956
6580
  }
6581
+ var getQueryAllMetadata = (target) => {
6582
+ const constructor = target instanceof Function ? target : target.constructor;
6583
+ return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
6584
+ };
6957
6585
 
6958
6586
  // src/decorators/applyClass.ts
6959
6587
  var CLASS_METADATA_KEY = Symbol.for("simple-web-component:class");
@@ -7299,6 +6927,41 @@ var dooboostoreSimpleWebComponent = (() => {
7299
6927
  return result;
7300
6928
  };
7301
6929
 
6930
+ // src/decorators/subscribeSwcAppRouteChange.ts
6931
+ var SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY = Symbol.for("simple-web-component:subscribe-swc-app-route-change");
6932
+ function createSwcAppRouteChangeSubscriber(options) {
6933
+ return (target, propertyKey, descriptor) => {
6934
+ const pathPattern = options?.path;
6935
+ const filter = options?.filter;
6936
+ const constructor = target.constructor;
6937
+ let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY, constructor);
6938
+ if (!list) {
6939
+ list = [];
6940
+ ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY, list, constructor);
6941
+ }
6942
+ list.push({ propertyKey, pathPattern, filter });
6943
+ return descriptor;
6944
+ };
6945
+ }
6946
+ function subscribeSwcAppRouteChange(targetOrOptions, propertyKey, descriptor) {
6947
+ if (propertyKey && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6948
+ return createSwcAppRouteChangeSubscriber({})(targetOrOptions, propertyKey, descriptor);
6949
+ }
6950
+ let options = {};
6951
+ if (Array.isArray(targetOrOptions)) {
6952
+ options.path = targetOrOptions;
6953
+ } else if (typeof targetOrOptions === "string") {
6954
+ options.path = targetOrOptions;
6955
+ } else if (targetOrOptions && typeof targetOrOptions === "object") {
6956
+ options = targetOrOptions;
6957
+ }
6958
+ return createSwcAppRouteChangeSubscriber(options);
6959
+ }
6960
+ var getSubscribeSwcAppRouteChangeMetadata = (target) => {
6961
+ const constructor = target instanceof Function ? target : target.constructor;
6962
+ return ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY, constructor);
6963
+ };
6964
+
7302
6965
  // src/utils/Utils.ts
7303
6966
  var SWC_NOT_FOUND = Symbol.for("simple-web-component:not-found");
7304
6967
  var htmlFragment = (html, doc) => {
@@ -7534,6 +7197,24 @@ var dooboostoreSimpleWebComponent = (() => {
7534
7197
  ...loopContext
7535
7198
  };
7536
7199
  };
7200
+ SwcUtils2.parsePathPattern = (pattern, currentPath) => {
7201
+ if (pattern === null || pattern === void 0) return {};
7202
+ const trimmedPattern = pattern.trim();
7203
+ if (trimmedPattern === "" && pattern !== "") return {};
7204
+ const paramNames = [];
7205
+ const regexPattern = trimmedPattern.replace(/{(\w+)(?::(.+?))?}/g, (match2, paramName, customRegex) => {
7206
+ paramNames.push(paramName);
7207
+ return `(${customRegex || "[^/]+"})`;
7208
+ });
7209
+ const regex = new RegExp(`^${regexPattern}$`);
7210
+ const match = currentPath.match(regex);
7211
+ if (!match) return null;
7212
+ const result = {};
7213
+ paramNames.forEach((name, index) => {
7214
+ result[name] = match[index + 1];
7215
+ });
7216
+ return result;
7217
+ };
7537
7218
  })(SwcUtils || (SwcUtils = {}));
7538
7219
 
7539
7220
  // src/decorators/emitCustomEvent.ts
@@ -7701,46 +7382,7 @@ var dooboostoreSimpleWebComponent = (() => {
7701
7382
  return this.containers.find(predicate);
7702
7383
  }
7703
7384
  };
7704
- var isTargetSymbol = (config) => {
7705
- return "symbol" in config && config.symbol !== void 0;
7706
- };
7707
- var isTargetType = (config) => {
7708
- return "type" in config && config.type !== void 0;
7709
- };
7710
- var isTargetScheme = (config) => {
7711
- return "scheme" in config && config.scheme !== void 0;
7712
- };
7713
- var isTargetFactory = (config) => {
7714
- return "factory" in config && typeof config.factory === "function" && !("symbol" in config) && !("type" in config) && !("scheme" in config);
7715
- };
7716
- var InjectMetadataKey = Symbol("Inject");
7717
- var injectProcess = (config, target, propertyKey, parameterIndex) => {
7718
- if (propertyKey && typeof target === "object") {
7719
- const otarget = target;
7720
- target = target.constructor;
7721
- const saves = Reflect.getOwnMetadata(InjectMetadataKey, target, propertyKey) || [];
7722
- const type = ReflectUtils.getParameterTypes(otarget, propertyKey)[parameterIndex];
7723
- saves.push({ index: parameterIndex, config, propertyKey, type });
7724
- ReflectUtils.defineMetadata(InjectMetadataKey, saves, target, propertyKey);
7725
- } else if (!propertyKey || typeof target === "function") {
7726
- const existingInjectdParameters = ReflectUtils.getMetadata(InjectMetadataKey, target) || [];
7727
- const type = ReflectUtils.getParameterTypes(target)[parameterIndex];
7728
- existingInjectdParameters.push({ index: parameterIndex, config, type });
7729
- ReflectUtils.defineMetadata(InjectMetadataKey, existingInjectdParameters, target);
7730
- }
7731
- };
7732
- function Inject(configOrTarget, propertyKey, parameterIndex) {
7733
- if (propertyKey && parameterIndex !== void 0) {
7734
- injectProcess({}, configOrTarget, propertyKey, parameterIndex);
7735
- } else {
7736
- return (target, propertyKey2, parameterIndex2) => {
7737
- injectProcess(configOrTarget, target, propertyKey2, parameterIndex2);
7738
- };
7739
- }
7740
- }
7741
- var getInject = (target, propertyKey) => {
7742
- return ReflectUtils.findMetadata(InjectMetadataKey, target, propertyKey) ?? [];
7743
- };
7385
+ var InjectMetadataKey = Symbol.for("simple-boot:inject-metadata");
7744
7386
 
7745
7387
  // src/types.ts
7746
7388
  var InjectSituationType = /* @__PURE__ */ ((InjectSituationType2) => {
@@ -7769,9 +7411,26 @@ var dooboostoreSimpleWebComponent = (() => {
7769
7411
  inst._emitHandlers = /* @__PURE__ */ new Map();
7770
7412
  inst._boundListeners = [];
7771
7413
  inst.__swc_initialized = true;
7414
+ const target = inst instanceof Function ? inst : inst.constructor;
7415
+ const attributeList = findAllAttributeMetadata(target);
7416
+ attributeList.forEach((meta) => {
7417
+ delete inst[meta.propertyKey];
7418
+ });
7419
+ const queryList = getQueryMetadata(target);
7420
+ if (queryList) {
7421
+ queryList.forEach((meta) => {
7422
+ delete inst[meta.propertyKey];
7423
+ });
7424
+ }
7425
+ const queryAllList = getQueryAllMetadata(target);
7426
+ if (queryAllList) {
7427
+ queryAllList.forEach((meta) => {
7428
+ delete inst[meta.propertyKey];
7429
+ });
7430
+ }
7772
7431
  const hostSet = SwcUtils.getHostSet(inst);
7773
7432
  inst._executeSwcScript?.("swc-on-constructor", hostSet);
7774
- const cMethods = findAllLifecycleMetadata(inst, ON_CONSTRUCTOR_METADATA_KEY);
7433
+ const cMethods = findAllLifecycleMetadata(inst, ON_INITIALIZE_METADATA_KEY);
7775
7434
  if (cMethods) {
7776
7435
  for (const m of cMethods) inst._invokeLifecycleMethod(m, hostSet);
7777
7436
  }
@@ -7938,12 +7597,12 @@ var dooboostoreSimpleWebComponent = (() => {
7938
7597
  const swcLifecycleAttributes = ["swc-on-constructor", "swc-on-connected", "swc-on-disconnected", "swc-on-before-connected", "swc-on-after-connected", "swc-on-before-disconnected", "swc-on-after-disconnected", "swc-on-before-adopted", "swc-on-after-adopted", "swc-on-attribute-changed"];
7939
7598
  const swcOnEvents = DOM_EVENT_NAMES.map((e) => `swc-on-${e}`);
7940
7599
  const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.options.name).filter(Boolean);
7941
- const attributeListNames = attributeList.map((it) => it.options.name || String(it.propertyKey));
7600
+ const hostAttributes = attributeList.filter((it) => it.selector === ":host").map((it) => it.options.name || String(it.propertyKey));
7942
7601
  const mergedObservedAttributes = [.../* @__PURE__ */ new Set([
7943
7602
  ...metadata.observedAttributes ?? [],
7944
7603
  ...attrChangeMap.keys(),
7945
7604
  ...attributeApplyNames,
7946
- ...attributeListNames,
7605
+ ...hostAttributes,
7947
7606
  ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean),
7948
7607
  ...swcLifecycleAttributes,
7949
7608
  ...swcOnEvents
@@ -7954,30 +7613,18 @@ var dooboostoreSimpleWebComponent = (() => {
7954
7613
  const originalConnected = proto.connectedCallback;
7955
7614
  proto.connectedCallback = function() {
7956
7615
  ensureInit2(this);
7616
+ const hostSet = SwcUtils.getHostSet(this);
7617
+ const appHost2 = hostSet.$appHost;
7618
+ const conf = getElementConfig(this);
7619
+ const currentWin = this._resolveWindow(conf);
7957
7620
  if (connectedInnerHtmlList.some((it) => it.options.useShadow === true) && !this.shadowRoot) {
7958
7621
  this.attachShadow({ mode: "open" });
7959
7622
  }
7960
- const conf = getElementConfig(this);
7961
- const currentWin = this._resolveWindow(conf);
7962
- const hostSet = SwcUtils.getHostSet(this);
7963
7623
  this._executeSwcScript("swc-on-before-connected", hostSet);
7964
7624
  const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_CONNECTED_METADATA_KEY);
7965
7625
  if (bMethods) {
7966
7626
  for (const m of bMethods) this._invokeLifecycleMethod(m, hostSet);
7967
7627
  }
7968
- attributeList.forEach((meta) => {
7969
- if (meta.options.connectedInitialize === true) {
7970
- this.__swc_syncing_init = true;
7971
- try {
7972
- const memoryVal = this[meta.privateKey];
7973
- if (memoryVal !== void 0) {
7974
- this[meta.propertyKey] = memoryVal;
7975
- }
7976
- } finally {
7977
- this.__swc_syncing_init = false;
7978
- }
7979
- }
7980
- });
7981
7628
  if (connectedInnerHtmlList.length > 0) {
7982
7629
  let sContent = "", lContent = "";
7983
7630
  for (const meta of connectedInnerHtmlList) {
@@ -8038,6 +7685,12 @@ var dooboostoreSimpleWebComponent = (() => {
8038
7685
  const { selector, options } = meta;
8039
7686
  const matchedEl = event.target.closest(selector);
8040
7687
  if (matchedEl && br.contains(matchedEl)) {
7688
+ if (options.filter) {
7689
+ const helper = SwcUtils.getHelperAndHostSet(currentWin, matchedEl);
7690
+ if (!options.filter(event, helper)) {
7691
+ continue;
7692
+ }
7693
+ }
8041
7694
  if (options.stopPropagation) event.stopPropagation();
8042
7695
  if (options.stopImmediatePropagation) event.stopImmediatePropagation();
8043
7696
  if (options.preventDefault) event.preventDefault();
@@ -8092,6 +7745,12 @@ var dooboostoreSimpleWebComponent = (() => {
8092
7745
  }
8093
7746
  bindTargets.forEach((t) => {
8094
7747
  const handler = async (event) => {
7748
+ if (options.filter) {
7749
+ const helper = SwcUtils.getHelperAndHostSet(currentWin, t);
7750
+ if (!options.filter(event, helper)) {
7751
+ return;
7752
+ }
7753
+ }
8095
7754
  if (options.stopPropagation) event.stopPropagation();
8096
7755
  if (options.stopImmediatePropagation) event.stopImmediatePropagation();
8097
7756
  if (options.preventDefault) event.preventDefault();
@@ -8113,6 +7772,9 @@ var dooboostoreSimpleWebComponent = (() => {
8113
7772
  this._executeSwcScript("swc-on-connected", hostSet);
8114
7773
  this._executeSwcScript("swc-on-after-connected", hostSet);
8115
7774
  this.__swc_connected = true;
7775
+ if (appHost2 && typeof appHost2._connected === "function") {
7776
+ appHost2._connected(this);
7777
+ }
8116
7778
  };
8117
7779
  const originalDisconnected = proto.disconnectedCallback;
8118
7780
  proto.disconnectedCallback = function() {
@@ -8134,6 +7796,10 @@ var dooboostoreSimpleWebComponent = (() => {
8134
7796
  this._executeSwcScript("swc-on-disconnected", hostSet);
8135
7797
  this._executeSwcScript("swc-on-after-disconnected", hostSet);
8136
7798
  this.__swc_connected = false;
7799
+ const appHost2 = hostSet.$appHost;
7800
+ if (appHost2 && typeof appHost2._disconnected === "function") {
7801
+ appHost2._disconnected(this);
7802
+ }
8137
7803
  };
8138
7804
  const originalAdopted = proto.adoptedCallback;
8139
7805
  proto.adoptedCallback = function() {
@@ -8182,1178 +7848,27 @@ var dooboostoreSimpleWebComponent = (() => {
8182
7848
  return constructor;
8183
7849
  };
8184
7850
 
8185
- // ../simple-boot/dist/esm/throwable/SimError.js
8186
- var SimError = class {
8187
- constructor(message, name, stack) {
8188
- this.message = message;
8189
- this.name = name;
8190
- this.stack = stack;
8191
- }
8192
- };
8193
-
8194
- // ../simple-boot/dist/esm/throwable/SimNoSuch.js
8195
- var SimNoSuch = class extends SimError {
8196
- constructor(message, name, stack) {
8197
- super(message, name, stack);
8198
- }
8199
- };
8200
-
8201
7851
  // ../simple-boot/dist/esm/decorators/SimDecorator.js
8202
- var Lifecycle = /* @__PURE__ */ ((Lifecycle2) => {
8203
- Lifecycle2["Singleton"] = "Singleton";
8204
- Lifecycle2["Transient"] = "Transient";
8205
- return Lifecycle2;
8206
- })(Lifecycle || {});
8207
- var sims = /* @__PURE__ */ new Map();
8208
- var containers = /* @__PURE__ */ new Set();
8209
- var SimMetadataKey = Symbol("Sim");
8210
- var isNotNullObjetInstance = (target) => target != null && target !== void 0 && typeof target === "object";
8211
- var simProcess = (config, inputTarget) => {
8212
- const target = (() => {
8213
- if (typeof inputTarget === "object") {
8214
- return config.scope === "Singleton" ? inputTarget : ValidUtils.isPlainObject(inputTarget) ? { ...inputTarget } : inputTarget;
8215
- }
8216
- if (ValidUtils.isArrowFunction(inputTarget)) {
8217
- return () => inputTarget();
8218
- }
8219
- return inputTarget;
8220
- })();
8221
- let targetType;
8222
- if (isNotNullObjetInstance(target)) {
8223
- targetType = target.constructor;
8224
- } else {
8225
- targetType = target;
8226
- }
8227
- config.scope = config?.scope ?? "Singleton";
8228
- ReflectUtils.defineMetadata(SimMetadataKey, config, targetType);
8229
- const adding = (targetKey, target2 = targetKey) => {
8230
- const items = sims.get(targetKey) ?? /* @__PURE__ */ new Set();
8231
- items.add(target2);
8232
- sims.set(targetKey, items);
8233
- };
8234
- if (Array.isArray(config?.type)) {
8235
- config?.type.forEach((it) => {
8236
- adding(it, target);
8237
- });
8238
- } else if (config.type) {
8239
- adding(config?.type, target);
8240
- } else {
8241
- adding(target);
8242
- }
8243
- };
8244
- function Sim(configOrTarget) {
8245
- if (typeof configOrTarget === "function") {
8246
- simProcess({}, configOrTarget);
8247
- } else {
8248
- return (target) => {
8249
- simProcess(configOrTarget, target);
8250
- };
8251
- }
8252
- }
8253
- var getSim = (target) => {
8254
- if (target != null && target !== void 0 && typeof target === "object") {
8255
- target = Object.getPrototypeOf(target).constructor;
8256
- }
8257
- try {
8258
- return ReflectUtils.getMetadata(SimMetadataKey, target);
8259
- } catch (e) {
8260
- }
8261
- };
8262
- var PostConstructMetadataKey = Symbol("PostConstruct");
8263
- var getPostConstructs = (target) => {
8264
- return ReflectUtils.getMetadata(PostConstructMetadataKey, target) ?? [];
8265
- };
7852
+ var SimMetadataKey = Symbol.for("simple-boot:sim-metadata");
7853
+ var PostConstructMetadataKey = Symbol.for("simple-boot:post-construct-metadata");
8266
7854
 
8267
- // ../simple-boot/dist/esm/simstance/SimAtomic.js
8268
- var SimAtomic = class {
8269
- constructor(type, simstanceManager, config) {
8270
- this.type = type;
8271
- this.simstanceManager = simstanceManager;
8272
- this.config = config;
8273
- this.value = type.value;
8274
- }
8275
- getConfig(key = SimMetadataKey) {
8276
- return ReflectUtils.getMetadata(key, this.type.originalType);
8277
- }
8278
- getConfigs() {
8279
- return ReflectUtils.getMetadatas(this.type.originalType);
8280
- }
8281
- getValue(config) {
8282
- if (config?.refresh) {
8283
- this.value = void 0;
8284
- }
8285
- if (!this.value) {
8286
- if (typeof this.type.targetKeyType === "symbol") {
8287
- this.value = this.simstanceManager.findFirstSim(this.type.targetKeyType)?.getValue();
8288
- } else {
8289
- this.value = this.simstanceManager.getOrNewSim({ target: this.type.targetKeyType, originTypeTarget: this.type.originalType, newInstanceCarrier: config?.newInstanceCarrier });
8290
- }
8291
- }
8292
- return this.value;
8293
- }
8294
- };
7855
+ // ../simple-boot/dist/esm/decorators/aop/AOPDecorator.js
7856
+ var AfterMetadataKey = Symbol.for("simple-boot:after-metadata");
7857
+ var BeforeMetadataKey = Symbol.for("simple-boot:before-metadata");
7858
+ var AroundMetadataKey = Symbol.for("simple-boot:around-metadata");
8295
7859
 
8296
- // ../simple-boot/dist/esm/SimOption.js
8297
- var SimOption = class {
8298
- constructor({ rootRouter, container, cache, advice = [], excludeProxys, proxy, using } = {}) {
8299
- this.rootRouter = rootRouter;
8300
- this.container = container;
8301
- this.advice = advice;
8302
- this.excludeProxys = excludeProxys;
8303
- this.proxy = proxy;
8304
- this.using = using;
8305
- this.cache = cache;
8306
- }
8307
- addAdvicce(advice) {
8308
- this.advice ?? (this.advice = []);
8309
- this.advice.push(advice);
8310
- }
8311
- setAdvice(...advice) {
8312
- this.advice = advice;
8313
- return this;
8314
- }
8315
- };
7860
+ // ../simple-boot/dist/esm/decorators/exception/ExceptionDecorator.js
7861
+ var ExceptionHandlerMetadataKey = Symbol.for("simple-boot:exception-handler-metadata");
8316
7862
 
8317
- // ../simple-boot/dist/esm/decorators/MetaDataAtomic.js
8318
- var MetaDataAtomic = class {
8319
- constructor(target, metaData) {
8320
- this.target = target;
8321
- this.metaData = metaData;
8322
- }
8323
- };
8324
- var MetaDataPropertyAtomic = class extends MetaDataAtomic {
8325
- constructor(target, metaData, property, parameter) {
8326
- super(target, metaData);
8327
- this.property = property;
8328
- this.parameter = parameter;
8329
- }
8330
- call(...parameter) {
8331
- return this.target[this.property](...parameter);
8332
- }
8333
- };
8334
-
8335
- // ../simple-boot/dist/esm/decorators/aop/AOPDecorator.js
8336
- var AfterMetadataKey = Symbol("After");
8337
- var BeforeMetadataKey = Symbol("Before");
8338
- var AroundMetadataKey = Symbol("Around");
8339
- var getAfter = (target, propertyKey) => {
8340
- return ReflectUtils.getMetadata(AfterMetadataKey, target, propertyKey);
8341
- };
8342
- var getAfters = (target) => {
8343
- return ObjectUtils.allProtoTypeName(target).map((it) => new MetaDataPropertyAtomic(target, getAfter(target, it), it)).filter((it) => it.metaData !== void 0) || [];
8344
- };
8345
- var getProtoAfters = (target, propertyKey, type) => {
8346
- return getAfters(target).filter((it) => propertyKey === it.metaData?.property && type === it.metaData.type?.prototype) || [];
8347
- };
8348
- var getBefore = (target, propertyKey) => {
8349
- return ReflectUtils.getMetadata(BeforeMetadataKey, target, propertyKey);
8350
- };
8351
- var getBefores = (target) => {
8352
- return ObjectUtils.allProtoTypeName(target).map((it) => new MetaDataPropertyAtomic(target, getBefore(target, it), it)).filter((it) => it.metaData !== void 0) || [];
8353
- };
8354
- var getProtoBefores = (target, propertyKey, type) => {
8355
- return getBefores(target).filter((it) => propertyKey === it.metaData?.property && type === it.metaData.type?.prototype) || [];
8356
- };
8357
-
8358
- // ../simple-boot/dist/esm/decorators/exception/ExceptionDecorator.js
8359
- var ExceptionHandlerSituationType = /* @__PURE__ */ ((ExceptionHandlerSituationType2) => {
8360
- ExceptionHandlerSituationType2["ERROR_OBJECT"] = "SIMPLE_BOOT_CORE://ExceptionHandler/ERROR_OBJECT";
8361
- ExceptionHandlerSituationType2["PARAMETER"] = "SIMPLE_BOOT_CORE://ExceptionHandler/PARAMETER";
8362
- return ExceptionHandlerSituationType2;
8363
- })(ExceptionHandlerSituationType || {});
8364
- var ExceptionHandlerMetadataKey = Symbol("ExceptionHandler");
8365
- var getExceptionHandlers = (target) => {
8366
- if (target !== null && void 0 !== target && typeof target === "object") {
8367
- target = target.constructor;
8368
- }
8369
- return ReflectUtils.getMetadata(ExceptionHandlerMetadataKey, target);
8370
- };
8371
- var targetExceptionHandlers = (target, error) => {
8372
- const exceptionHandlers = getExceptionHandlers(target);
8373
- const emptyTargets = exceptionHandlers?.filter((it) => it.config.type === void 0);
8374
- const targets = exceptionHandlers?.filter((it) => ObjectUtils.isPrototypeOfTarget(it.config.type, error));
8375
- const targetSorts = targets?.sort((a, b) => {
8376
- const aPrototypeOfDepth = ObjectUtils.prototypeOfDepth(error, a.config.type);
8377
- const bPrototypeOfDepth = ObjectUtils.prototypeOfDepth(error, b.config.type);
8378
- return aPrototypeOfDepth.length - bPrototypeOfDepth.length;
8379
- });
8380
- return (targetSorts ?? []).concat(...emptyTargets ?? []);
8381
- };
8382
- var targetExceptionHandler = (target, error, excludeMethods = []) => {
8383
- let exceptionHandlers = targetExceptionHandlers(target, error);
8384
- exceptionHandlers = exceptionHandlers?.filter((it) => !excludeMethods.includes(it.method));
8385
- if (exceptionHandlers && exceptionHandlers.length > 0) {
8386
- return exceptionHandlers[0];
8387
- } else {
8388
- return void 0;
8389
- }
8390
- };
8391
-
8392
- // ../simple-boot/dist/esm/proxy/SimProxyHandler.js
8393
- var SimProxyHandler = class {
8394
- constructor(simpleApplication, simstanceManager, simOption) {
8395
- this.simpleApplication = simpleApplication;
8396
- this.simstanceManager = simstanceManager;
8397
- this.simOption = simOption;
8398
- }
8399
- // 잘받게 해놨네 ㅋㅋ simstanceManager
8400
- get(target, name) {
8401
- if (name === "_SimpleBoot_application") {
8402
- return this.simpleApplication;
8403
- } else if (name === "_SimpleBoot_simstanceManager") {
8404
- return this.simstanceManager;
8405
- } else if (name === "_SimpleBoot_simOption") {
8406
- return this.simOption;
8407
- } else if (name === "_SimpleBoot_origin") {
8408
- return target;
8409
- } else {
8410
- return target[name];
8411
- }
8412
- }
8413
- set(obj, prop, value, receiver) {
8414
- value = this.simstanceManager?.proxy(value);
8415
- obj[prop] = value;
8416
- return true;
8417
- }
8418
- apply(target, thisArg, argumentsList) {
8419
- let r;
8420
- try {
8421
- this.aopBefore(thisArg, target);
8422
- try {
8423
- r = Reflect.apply(target, thisArg, argumentsList);
8424
- } catch (e) {
8425
- throw e;
8426
- } finally {
8427
- this.aopAfter(thisArg, target);
8428
- }
8429
- } catch (e) {
8430
- console.error(e);
8431
- const inHandlers = this.getExceptionHandler(e, thisArg, target);
8432
- if (inHandlers.length > 0 && inHandlers[0]) {
8433
- const inHandler = inHandlers[0];
8434
- this.executeExceptionHandler(e, inHandler, argumentsList);
8435
- } else {
8436
- throw e;
8437
- }
8438
- }
8439
- return r;
8440
- }
8441
- executeExceptionHandler(e, inHandler, argumentsList) {
8442
- const otherStorage = /* @__PURE__ */ new Map();
8443
- otherStorage.set(e.constructor, e);
8444
- const situationErrorTypeContainer = new SituationTypeContainer({
8445
- situationType: ExceptionHandlerSituationType.ERROR_OBJECT,
8446
- data: e
8447
- });
8448
- const situationParameterTypeContainer = new SituationTypeContainer({
8449
- situationType: ExceptionHandlerSituationType.PARAMETER,
8450
- data: argumentsList
8451
- });
8452
- otherStorage.set(SituationTypeContainers, new SituationTypeContainers([situationErrorTypeContainer, situationParameterTypeContainer]));
8453
- argumentsList?.forEach((it) => {
8454
- otherStorage.set(it.constructor, it);
8455
- });
8456
- try {
8457
- this.simstanceManager.executeBindParameterSim(
8458
- {
8459
- target: inHandler.thisArg,
8460
- targetKey: inHandler.config.propertyKey
8461
- },
8462
- otherStorage
8463
- );
8464
- } catch (es) {
8465
- e = es;
8466
- }
8467
- if (inHandler.config.config.throw) {
8468
- const exceptionHandler = this.getExceptionHandler(e, inHandler.thisArg, inHandler.config.method);
8469
- if ((exceptionHandler?.length ?? 0) > 0) {
8470
- this.executeExceptionHandler(e, exceptionHandler[0], argumentsList);
8471
- }
8472
- }
8473
- }
8474
- getExceptionHandler(e, thisArg, target) {
8475
- const globalConfigSets = this.simOption.advice.map((it) => this.simstanceManager?.getOrNewSim({ target: it })).filter((it) => it).map((it) => {
8476
- return { thisArg: it, config: targetExceptionHandler(it, e, [target]) };
8477
- }) ?? [];
8478
- const thisConfigSet = { thisArg, config: targetExceptionHandler(thisArg, e, [target]) };
8479
- const inHandlers = [thisConfigSet, ...globalConfigSets].filter((it) => it && it.config);
8480
- return inHandlers;
8481
- }
8482
- aopBefore(obj, protoType) {
8483
- const propertyName = ObjectUtils.prototypeName(obj, protoType);
8484
- if (propertyName && obj) {
8485
- getProtoBefores(obj, propertyName).forEach((it) => {
8486
- it.call(obj, protoType, propertyName);
8487
- });
8488
- for (let i = 0; i < this.simOption.advice.length; i++) {
8489
- const sim = this.simstanceManager?.getOrNewSim({ target: this.simOption.advice[i] });
8490
- const protoBefores = getProtoBefores(sim, propertyName, Object.getPrototypeOf(obj));
8491
- protoBefores.forEach((it) => {
8492
- it.call(obj, protoType, propertyName);
8493
- });
8494
- }
8495
- }
8496
- }
8497
- aopAfter(obj, protoType) {
8498
- const propertyName = ObjectUtils.prototypeName(obj, protoType);
8499
- if (propertyName) {
8500
- getProtoAfters(obj, propertyName).forEach((it) => {
8501
- it.call(obj, protoType, propertyName);
8502
- });
8503
- for (let i = 0; i < this.simOption.advice.length; i++) {
8504
- const sim = this.simstanceManager?.getOrNewSim({ target: this.simOption.advice[i] });
8505
- const protoBefores = getProtoAfters(sim, propertyName, Object.getPrototypeOf(obj));
8506
- protoBefores.forEach((it) => {
8507
- it.call(obj, protoType, propertyName);
8508
- });
8509
- }
8510
- }
8511
- }
8512
- has(target, key) {
8513
- if (key === "_SimpleBoot_isProxy") {
8514
- return true;
8515
- }
8516
- return key in target;
8517
- }
8518
- };
8519
-
8520
- // ../simple-boot/dist/esm/lifecycle/OnSimCreate.js
8521
- var isOnSimCreate = (obj) => {
8522
- return typeof obj?.onSimCreate === "function";
8523
- };
8524
-
8525
- // ../simple-boot/dist/esm/lifecycle/OnSimCreateCompleted.js
8526
- var isOnSimCreateProxyCompleted = (obj) => {
8527
- return typeof obj?.onSimCreateProxyCompleted === "function";
8528
- };
8529
-
8530
- // ../simple-boot/dist/esm/decorators/SimNoProxy.js
8531
- var SimNoProxyKey = Symbol("Sim:NoProxy");
8532
- var getSimNoProxy = (target, propertyKey) => {
8533
- try {
8534
- if (propertyKey === void 0) {
8535
- return Reflect.getMetadata(SimNoProxyKey, target);
8536
- }
8537
- return Reflect.getMetadata(SimNoProxyKey, target, propertyKey);
8538
- } catch (e) {
8539
- return void 0;
8540
- }
8541
- };
8542
- var isSimNoProxy = (target, propertyKey) => {
8543
- if (target === null || target === void 0) {
8544
- return false;
8545
- }
8546
- return getSimNoProxy(target, propertyKey) === true;
8547
- };
8548
-
8549
- // ../simple-boot/dist/esm/simstance/SimstanceManager.js
8550
- var SimstanceManager = class _SimstanceManager {
8551
- // private otherInstanceSim?: Map<ConstructorType<any> | Function, any>;
8552
- constructor(simpleApplication, option) {
8553
- this.simpleApplication = simpleApplication;
8554
- this.option = option;
8555
- this._storage = /* @__PURE__ */ new Map();
8556
- this.name = "simstanceManager-" + RandomUtils.uuid4();
8557
- this.setStoreSet(SimpleApplication, this.simpleApplication);
8558
- this.setStoreSet(_SimstanceManager, this);
8559
- this.setStoreSet(option.constructor, option);
8560
- this.setStoreSet(SimOption, option);
8561
- this.simProxyHandler = new SimProxyHandler(this.simpleApplication, this, option);
8562
- }
8563
- get storage() {
8564
- return this._storage;
8565
- }
8566
- getSimAtomics() {
8567
- const r = [];
8568
- Array.from(this.storage.entries()).forEach(([targetKeyType, targetMap]) => {
8569
- r.push(
8570
- ...Array.from(Array.from(targetMap.keys())).map(
8571
- (sit) => new SimAtomic(
8572
- {
8573
- targetKeyType,
8574
- originalType: sit
8575
- },
8576
- this
8577
- )
8578
- )
8579
- );
8580
- });
8581
- return r;
8582
- }
8583
- getSimConfig(schemeOrSymbol) {
8584
- const newVar = this.getSimAtomics().filter((it) => {
8585
- const config = it?.getConfig();
8586
- const symbols = ConvertUtils.flatArray(config?.symbol);
8587
- const schemes = ConvertUtils.flatArray(config?.scheme);
8588
- if (typeof schemeOrSymbol === "symbol") {
8589
- return schemeOrSymbol && it && symbols.includes(schemeOrSymbol);
8590
- } else if (typeof schemeOrSymbol === "string") {
8591
- return schemeOrSymbol && it && schemes.includes(schemeOrSymbol);
8592
- } else {
8593
- return false;
8594
- }
8595
- }) || [];
8596
- return newVar;
8597
- }
8598
- findSims(data) {
8599
- let r = [];
8600
- if (data) {
8601
- const simAtomics = this.getSimAtomics();
8602
- r = simAtomics.filter((it) => {
8603
- let b = false;
8604
- const config = it.getConfig();
8605
- const symbols = ConvertUtils.flatArray(config?.symbol).filter(ValidUtils.isDefined);
8606
- const schemes = ConvertUtils.flatArray(config?.scheme).filter(ValidUtils.isDefined);
8607
- if (typeof data === "symbol") {
8608
- b = symbols.includes(data);
8609
- } else {
8610
- const { scheme, type } = data;
8611
- b = (scheme ? schemes.includes(scheme) : true) && (type ? it.type.targetKeyType === type : true);
8612
- }
8613
- return b;
8614
- });
8615
- }
8616
- return r;
8617
- }
8618
- findFirstSim(data) {
8619
- if (typeof data === "symbol") {
8620
- return this.findSims(data)[0];
8621
- } else {
8622
- return this.findSims(data)[0];
8623
- }
8624
- }
8625
- findLastSim(data) {
8626
- if (typeof data === "symbol") {
8627
- return this.findSims(data).reverse()[0];
8628
- } else {
8629
- return this.findSims(data).reverse()[0];
8630
- }
8631
- }
8632
- flatStoreSets() {
8633
- return new Map(
8634
- Array.from(this.storage.values()).map((it) => Array.from(it.entries())).flat()
8635
- );
8636
- }
8637
- getStoreSets(targetKey) {
8638
- const map = this.storage.get(targetKey);
8639
- const datas = (Array.from(map?.entries?.() ?? []) ?? []).reverse();
8640
- return datas.map((it) => ({ type: it[0], instance: it[1] }));
8641
- }
8642
- getStoreSet(targetKey, target) {
8643
- const sets = this.getStoreSets(targetKey);
8644
- let find = sets.find((it) => it.type === target);
8645
- if (!find && (!target || target === targetKey)) {
8646
- find = sets.find((it) => it.instance);
8647
- }
8648
- if (!find?.instance) {
8649
- const type = target ?? targetKey;
8650
- if (typeof type === "object") {
8651
- const find2 = this.storage.get(type);
8652
- if (find2) {
8653
- return { type, instance: type };
8654
- }
8655
- }
8656
- const flatStoreSets = this.flatStoreSets();
8657
- const data = flatStoreSets.get(type);
8658
- if (data) {
8659
- this.setStoreSet(targetKey, data, type);
8660
- }
8661
- return { type, instance: data };
8662
- } else {
8663
- return find;
8664
- }
8665
- }
8666
- getStoreInstance(targetKey, target) {
8667
- return this.getStoreSet(targetKey, target)?.instance;
8668
- }
8669
- getOrNewSim({ target, originTypeTarget = target, newInstanceCarrier }) {
8670
- if (target) {
8671
- const registed = this.getStoreSet(target, originTypeTarget);
8672
- if (registed?.type && !registed?.instance) {
8673
- return this.resolve({
8674
- targetKey: target,
8675
- target: originTypeTarget,
8676
- newInstanceCarrier
8677
- });
8678
- }
8679
- return registed?.instance;
8680
- }
8681
- }
8682
- setStoreSet(targetKey, obj, target = targetKey) {
8683
- const itemMap = this.storage.get(targetKey) ?? /* @__PURE__ */ new Map();
8684
- itemMap.set(target, obj);
8685
- this.storage.set(targetKey, itemMap);
8686
- }
8687
- registerStore(targetKey, regTyps) {
8688
- const itemMap = this.storage.get(targetKey) ?? /* @__PURE__ */ new Map();
8689
- regTyps.forEach((it) => {
8690
- const { type, value } = typeof it === "object" ? { type: it.constructor, value: it } : { type: it, value: void 0 };
8691
- if (!itemMap.has(type) || value !== void 0 && itemMap.get(type) === void 0) {
8692
- itemMap.set(type, value);
8693
- }
8694
- });
8695
- this.storage.set(targetKey, itemMap);
8696
- }
8697
- // 진입점
8698
- resolve({ target, targetKey, newInstanceCarrier = { newInstances: [], depth: 0 } }) {
8699
- const registed = this.getStoreSet(targetKey, target);
8700
- if (registed?.instance) {
8701
- return registed.instance;
8702
- }
8703
- if (this.storage.has(targetKey) && void 0 === registed?.instance) {
8704
- newInstanceCarrier.depth++;
8705
- const newSim = this.newSim({
8706
- target: registed?.type ?? targetKey,
8707
- newInstanceCarrier,
8708
- simCreateAfter: (data) => {
8709
- if (getSim(registed?.type ?? target ?? targetKey)?.scope === Lifecycle.Singleton) {
8710
- this.setStoreSet(targetKey, data, target);
8711
- }
8712
- }
8713
- });
8714
- newInstanceCarrier.depth--;
8715
- if (newInstanceCarrier.depth === 0) {
8716
- newInstanceCarrier.newInstances.forEach((it) => {
8717
- this.callBindPostConstruct(it);
8718
- });
8719
- }
8720
- if (isOnSimCreate(newSim)) {
8721
- newSim.onSimCreate();
8722
- }
8723
- return newSim;
8724
- }
8725
- const simNoSuch = new SimNoSuch("SimNoSuch: no simple instance(resolve) name:" + targetKey?.prototype?.constructor?.name + "," + targetKey);
8726
- console.error(simNoSuch);
8727
- throw simNoSuch;
8728
- }
8729
- newSim({ target, simCreateAfter, otherStorage, newInstanceCarrier }) {
8730
- const parameters = this.getParameterSim({
8731
- target,
8732
- otherStorage,
8733
- newInstanceCarrier
8734
- });
8735
- const r = ValidUtils.isFunction(target) && !target.prototype ? target(...parameters) : new target(...parameters);
8736
- let p = this.proxy(r);
8737
- const config = getSim(target);
8738
- if (config?.proxy) {
8739
- const proxys = (Array.isArray(config.proxy) ? config.proxy : [config.proxy]).filter(ValidUtils.isDefined);
8740
- proxys.forEach((it) => {
8741
- if (typeof it === "object") {
8742
- p = new Proxy(p, it);
8743
- } else {
8744
- const simConfig = getSim(it);
8745
- p = new Proxy(p, simConfig ? this.getOrNewSim({ target: it }) : this.newSim({ target: it }));
8746
- }
8747
- });
8748
- }
8749
- newInstanceCarrier?.newInstances.push(p);
8750
- simCreateAfter?.(p);
8751
- if (isOnSimCreateProxyCompleted(p)) {
8752
- p.onSimCreateProxyCompleted(p);
8753
- }
8754
- return p;
8755
- }
8756
- callBindPostConstruct(obj) {
8757
- const postConstruct = getPostConstructs(obj);
8758
- postConstruct.forEach((it) => {
8759
- obj[it.property](...this.getParameterSim({ target: obj, targetKey: it.property }));
8760
- });
8761
- }
8762
- async executeBindParameterSimPromise({ target, targetKey, firstCheckMaker, parameterCount, inputParameters }, otherStorage) {
8763
- const binds = this.getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, parameterCount, inputParameters });
8764
- if (typeof target === "object" && targetKey) {
8765
- const targetMethod = target[targetKey];
8766
- return targetMethod?.bind(target)?.(...binds);
8767
- } else if (typeof target === "function" && !targetKey) {
8768
- return new target(...binds);
8769
- }
8770
- }
8771
- executeBindParameterSim({ target, targetKey, firstCheckMaker, parameterCount, inputParameters }, otherStorage) {
8772
- const binds = this.getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, parameterCount, inputParameters });
8773
- if (typeof target === "object" && targetKey) {
8774
- const targetMethod = target[targetKey];
8775
- return targetMethod?.bind(target)?.(...binds);
8776
- } else if (typeof target === "function" && !targetKey) {
8777
- return new target(...binds);
8778
- }
8779
- }
8780
- getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, newInstanceCarrier, parameterCount, inputParameters = [] }) {
8781
- const paramTypes = ReflectUtils.getParameterTypes(target, targetKey) || [];
8782
- let injections = [];
8783
- const injects = getInject(target, targetKey);
8784
- const loopCount = Math.max(paramTypes.length, parameterCount ?? 0);
8785
- const loopArray = new Array(loopCount).fill(void 0);
8786
- injections = loopArray.map((_, idx) => {
8787
- const token = paramTypes[idx];
8788
- const saveInject = injects?.find((it) => it.index === idx);
8789
- for (const f of firstCheckMaker ?? []) {
8790
- const firstCheckObj = f({ target, targetKey }, token, idx, saveInject);
8791
- if (void 0 !== firstCheckObj) {
8792
- return firstCheckObj;
8793
- }
8794
- }
8795
- if (saveInject) {
8796
- const inject = saveInject.config;
8797
- let obj = otherStorage?.get(token);
8798
- if (token === Array && (isTargetType(inject) || isTargetScheme(inject) || isTargetSymbol(inject))) {
8799
- const p = [];
8800
- if (isTargetType(inject) && inject.type) {
8801
- p.push(
8802
- ...this.getStoreSets(inject.type).map(
8803
- (it) => this.resolve({
8804
- targetKey: inject.type,
8805
- target: it.type,
8806
- newInstanceCarrier
8807
- })
8808
- ).reverse()
8809
- );
8810
- }
8811
- if (isTargetSymbol(inject)) {
8812
- p.push(...this.getSimConfig(inject.symbol).map((it) => it.getValue({ newInstanceCarrier })));
8813
- }
8814
- if (isTargetScheme(inject)) {
8815
- p.push(...this.getSimConfig(inject.scheme).map((it) => it.getValue({ newInstanceCarrier })));
8816
- }
8817
- return p;
8818
- }
8819
- if (inject.situationType && otherStorage) {
8820
- const situations = otherStorage.get(SituationTypeContainers);
8821
- const situation = otherStorage.get(SituationTypeContainer);
8822
- if (inject.situationType === situation?.situationType) {
8823
- obj = situation.data;
8824
- } else if (situations && situations.length > 0) {
8825
- const find = situations.find((a) => {
8826
- if (a.index !== void 0) {
8827
- return a.situationType === inject.situationType && a.index === idx;
8828
- } else {
8829
- return a.situationType === inject.situationType;
8830
- }
8831
- });
8832
- if (find) {
8833
- obj = find.data;
8834
- }
8835
- }
8836
- }
8837
- if (!obj) {
8838
- const currentInstance = typeof target === "object" ? target : void 0;
8839
- if (isTargetFactory(inject)) {
8840
- obj = inject.factory({
8841
- instance: currentInstance,
8842
- methodName: String(targetKey),
8843
- parameter: inputParameters,
8844
- application: this.simpleApplication
8845
- });
8846
- } else {
8847
- let findLastSim;
8848
- if (isTargetSymbol(inject)) {
8849
- findLastSim = this.findLastSim(inject.symbol);
8850
- } else if (isTargetType(inject) || isTargetScheme(inject)) {
8851
- findLastSim = this.findLastSim(inject);
8852
- }
8853
- try {
8854
- obj = findLastSim ? this.resolve({
8855
- targetKey: findLastSim?.type.targetKeyType ?? token,
8856
- newInstanceCarrier
8857
- }) : this.resolve({
8858
- targetKey: token,
8859
- newInstanceCarrier
8860
- });
8861
- if (inject.factory && obj) {
8862
- if (typeof inject.factory === "function") {
8863
- obj = inject.factory({
8864
- instance: currentInstance,
8865
- methodName: String(targetKey),
8866
- parameter: inputParameters,
8867
- application: this.simpleApplication,
8868
- injectInstance: obj
8869
- });
8870
- }
8871
- }
8872
- } catch (e) {
8873
- if (inject.optional) {
8874
- return void 0;
8875
- } else {
8876
- throw e;
8877
- }
8878
- }
8879
- }
8880
- }
8881
- if (inject.proxy && obj) {
8882
- if (ValidUtils.isConstructor(inject.proxy)) {
8883
- const handler = getSim(inject.proxy) ? this.getOrNewSim({ target: inject.proxy }) : new inject.proxy();
8884
- if (handler) {
8885
- obj = new Proxy(obj, handler);
8886
- }
8887
- } else if (typeof inject.proxy === "function") {
8888
- const handler = inject.proxy({
8889
- application: this.simpleApplication,
8890
- instance: obj
8891
- });
8892
- if (handler) {
8893
- obj = new Proxy(obj, handler);
8894
- }
8895
- }
8896
- }
8897
- return obj;
8898
- } else {
8899
- return otherStorage?.get(token) ?? (token ? this.resolve({ targetKey: token, newInstanceCarrier }) : void 0);
8900
- }
8901
- });
8902
- return injections;
8903
- }
8904
- proxy(target) {
8905
- try {
8906
- const noProxy = isSimNoProxy(target);
8907
- const isExcludeProxy = this.option.excludeProxys?.some((it) => target instanceof it);
8908
- if (!noProxy && !isExcludeProxy && target !== null && getSim(target) && typeof target === "object" && !("_SimpleBoot_isProxy" in target)) {
8909
- for (const key in target) {
8910
- if (!isSimNoProxy(target, key)) {
8911
- target[key] = this.proxy(target[key]);
8912
- }
8913
- }
8914
- const protoTypeName = ObjectUtils.ownPropertyNames(target);
8915
- protoTypeName.filter((it) => typeof target[it] === "function").filter((it) => !isSimNoProxy(target, it)).filter((it) => !("_SimpleBoot_isProxy" in target[it])).forEach((it) => {
8916
- target[it] = new Proxy(target[it], this.simProxyHandler);
8917
- });
8918
- if (this.simProxyHandler) {
8919
- target = new Proxy(target, this.simProxyHandler);
8920
- }
8921
- }
8922
- if (this.option.proxy) {
8923
- target = this.option.proxy.onAfterProxy(target);
8924
- }
8925
- return target;
8926
- } catch (e) {
8927
- console.log("sim proxy error");
8928
- throw e;
8929
- }
8930
- }
8931
- run(otherInstanceSim = /* @__PURE__ */ new Map()) {
8932
- for (const [k, v] of Array.from(otherInstanceSim.entries())) {
8933
- if (typeof k === "symbol") {
8934
- simProcess({ symbol: k }, v);
8935
- } else if (typeof k === "object") {
8936
- simProcess(k, v);
8937
- } else {
8938
- simProcess({ type: k }, v);
8939
- }
8940
- }
8941
- const myContainers = ConvertUtils.flatArray(this.option.container).filter(ValidUtils.isDefined);
8942
- Array.from(sims.entries()).forEach(([type, value]) => {
8943
- const targetContainers = ConvertUtils.flatArray(getSim(type)?.container).filter(ValidUtils.isDefined);
8944
- let isInclude = false;
8945
- if (myContainers.length <= 0 && targetContainers.length <= 0) {
8946
- isInclude = true;
8947
- } else if (targetContainers.length <= 0) {
8948
- isInclude = true;
8949
- } else {
8950
- isInclude = myContainers.some((it) => targetContainers.includes(it));
8951
- }
8952
- this.registerStore(type, value);
8953
- });
8954
- this.callBindPostConstruct(this);
8955
- this.getSimAtomics().forEach((it) => {
8956
- if (it.getConfig()?.autoCreate) {
8957
- it.getValue();
8958
- }
8959
- });
8960
- }
8961
- };
8962
-
8963
- // ../simple-boot/dist/esm/intent/Intent.js
8964
- var Intent = class {
8965
- constructor(uri, data, event) {
8966
- this.uri = uri;
8967
- this.data = data;
8968
- this.event = event;
8969
- this.sessionData = /* @__PURE__ */ new Map();
8970
- if (typeof uri === "string") {
8971
- const match = uri.match(/^Symbol\.for\((.+)\):\/(.*)$/);
8972
- if (match) {
8973
- const symbol = Symbol.for(match[1]);
8974
- this.uri = {
8975
- symbol,
8976
- uri: match[2]
8977
- };
8978
- }
8979
- }
8980
- }
8981
- get symbols() {
8982
- if (typeof this.uri === "object") {
8983
- return Array.isArray(this.uri.symbol) ? this.uri.symbol : [this.uri.symbol];
8984
- }
8985
- return void 0;
8986
- }
8987
- get scheme() {
8988
- if (typeof this.uri === "string") {
8989
- const parts = this.uri.split("://");
8990
- if (parts.length > 1) {
8991
- return parts[0];
8992
- }
8993
- return void 0;
8994
- } else {
8995
- return void 0;
8996
- }
8997
- }
8998
- get paths() {
8999
- return this.pathname.split("/") ?? [];
9000
- }
9001
- get fullPath() {
9002
- const uri = typeof this.uri === "string" ? this.uri : this.uri.uri;
9003
- const paths = uri.split("://");
9004
- return paths[paths.length >= 2 ? 1 : 0] ?? "";
9005
- }
9006
- get pathname() {
9007
- const paths = this.fullPath.split("?");
9008
- return paths[0];
9009
- }
9010
- get query() {
9011
- const paths = this.fullPath.split("?");
9012
- return paths[1] ?? "";
9013
- }
9014
- getQueryParamDecodeURI(key) {
9015
- const p = this.queryParamsDecodeURI;
9016
- if (key) {
9017
- return p[key];
9018
- } else {
9019
- return p;
9020
- }
9021
- }
9022
- getQueryParamDecodeURIFirst(key) {
9023
- const param = this.getQueryParamDecodeURI(key);
9024
- if (Array.isArray(param)) {
9025
- return param[0];
9026
- } else {
9027
- return param;
9028
- }
9029
- }
9030
- getQueryParam(key) {
9031
- const p = this.queryParams;
9032
- if (key) {
9033
- return p[key];
9034
- } else {
9035
- return p;
9036
- }
9037
- }
9038
- getQueryParamFirst(key) {
9039
- const param = this.getQueryParam(key);
9040
- if (Array.isArray(param)) {
9041
- return param[0];
9042
- } else {
9043
- return param;
9044
- }
9045
- }
9046
- get queryParams() {
9047
- const param = {};
9048
- this.query.split("&")?.forEach((it) => {
9049
- const a = it.split("=");
9050
- if (param[a[0]]) {
9051
- if (Array.isArray(param[a[0]])) {
9052
- param[a[0]].push(a[1]);
9053
- } else {
9054
- param[a[0]] = [param[a[0]], a[1]];
9055
- }
9056
- } else {
9057
- param[a[0]] = a[1];
9058
- }
9059
- });
9060
- return param;
9061
- }
9062
- get queryParamsDecodeURI() {
9063
- const params = this.queryParams;
9064
- for (const key in params) {
9065
- if (params.hasOwnProperty(key)) {
9066
- const param = params[key];
9067
- if (Array.isArray(param)) {
9068
- params[key] = param.map((p) => decodeURIComponent(p));
9069
- } else {
9070
- params[key] = decodeURIComponent(param);
9071
- }
9072
- }
9073
- }
9074
- return params;
9075
- }
9076
- getPathnameData(urlExpression) {
9077
- return Expression.Path.pathNameData(this.pathname, urlExpression);
9078
- }
9079
- get isSymbolScheme() {
9080
- return this.symbols !== void 0;
9081
- }
9082
- };
9083
-
9084
- // ../simple-boot/dist/esm/intent/IntentSubscribe.js
9085
- var isIntentSubscribe = (obj) => {
9086
- return !!obj && typeof obj.intentSubscribe === "function";
9087
- };
9088
-
9089
- // ../simple-boot/dist/esm/intent/IntentManager.js
9090
- var isRouterPublishType = (it) => typeof it === "object" && it !== null && typeof it.router === "string" && typeof it.rootRouter === "function";
9091
- var isSymbolPublishType = (it) => typeof it === "object" && it !== null && "symbol" in it && "path" in it;
9092
- var isSchemePublishType = (it) => typeof it === "object" && it !== null && "scheme" in it && "path" in it;
9093
- var IntentManager = class {
9094
- constructor(simpleApplication, simstanceManager, routerManager, simOption) {
9095
- this.simpleApplication = simpleApplication;
9096
- this.simstanceManager = simstanceManager;
9097
- this.routerManager = routerManager;
9098
- this.simOption = simOption;
9099
- this.subject = new Subject();
9100
- }
9101
- get observable() {
9102
- return this.subject.asObservable();
9103
- }
9104
- async makeIntentData(it, data) {
9105
- const target = [];
9106
- const rootRouter = isRouterPublishType(it) ? it.rootRouter : this.simOption.rootRouter;
9107
- if (isRouterPublishType(it)) {
9108
- it = it.router;
9109
- }
9110
- const routerMatch = typeof it === "string" && it.match(/^Router\((.+)\):\/(.*)$/);
9111
- if (routerMatch && typeof it === "string") {
9112
- const routerBasePath = routerMatch[1];
9113
- const actualPath = routerMatch[2];
9114
- const routerModule = await this.routerManager.routing(routerBasePath, {
9115
- router: rootRouter
9116
- });
9117
- const instance = routerModule.getModuleInstance();
9118
- if (instance) {
9119
- target.push(instance);
9120
- }
9121
- it = new Intent(actualPath, data);
9122
- } else if (isSymbolPublishType(it)) {
9123
- it = new Intent({ symbol: it.symbol, uri: it.path }, data);
9124
- } else if (isSchemePublishType(it)) {
9125
- it = new Intent(`${it.scheme}://${it.path}`, data);
9126
- } else if (typeof it === "string") {
9127
- it = new Intent(it, data);
9128
- }
9129
- const intent = it;
9130
- if (!routerMatch) {
9131
- if (intent.symbols) {
9132
- target.push(...intent.symbols.map((sym) => this.simstanceManager.findSims(sym)).flat());
9133
- } else if (intent.scheme) {
9134
- target.push(...this.simstanceManager.getSimConfig(intent.scheme));
9135
- } else {
9136
- target.push(...this.simstanceManager.getSimAtomics());
9137
- }
9138
- }
9139
- return { intent, target };
9140
- }
9141
- async publishMeta(it, data) {
9142
- const { intent, target } = await this.makeIntentData(it, data);
9143
- const r = [];
9144
- const targetInstances = target.map((it2) => {
9145
- if (it2 instanceof SimAtomic) {
9146
- return it2.getValue();
9147
- } else {
9148
- return it2;
9149
- }
9150
- });
9151
- this.subject.next(intent);
9152
- for (let data2 of targetInstances) {
9153
- let orNewSim = data2;
9154
- if (orNewSim) {
9155
- const filteredPaths = intent.paths.filter((i) => i);
9156
- if (filteredPaths.length > 0) {
9157
- let callthis = orNewSim;
9158
- let lastProp = "";
9159
- filteredPaths.forEach((i) => {
9160
- callthis = orNewSim;
9161
- orNewSim = orNewSim?.[i];
9162
- lastProp = i;
9163
- });
9164
- if (orNewSim && typeof orNewSim === "function") {
9165
- const intentData = Array.isArray(intent.data) ? intent.data : intent.data !== void 0 ? [intent.data] : [];
9166
- const result = await this.simstanceManager.executeBindParameterSimPromise({
9167
- target: callthis,
9168
- targetKey: lastProp,
9169
- parameterCount: intentData.length,
9170
- inputParameters: intentData,
9171
- firstCheckMaker: [
9172
- (obj, token, idx) => {
9173
- if (idx < intentData.length) {
9174
- return intentData[idx];
9175
- }
9176
- if (token === Intent && idx === 0) {
9177
- return intent;
9178
- }
9179
- }
9180
- ]
9181
- });
9182
- r.push(result);
9183
- } else if (orNewSim) {
9184
- callthis[lastProp] = intent.data;
9185
- r.push(callthis[lastProp]);
9186
- }
9187
- } else {
9188
- const intentData = Array.isArray(intent.data) ? intent.data : intent.data !== void 0 ? [intent.data] : [];
9189
- if (isIntentSubscribe(orNewSim)) {
9190
- r.push(orNewSim.intentSubscribe(...intentData));
9191
- }
9192
- }
9193
- }
9194
- }
9195
- return { return: r, target };
9196
- }
9197
- async publish(it, data) {
9198
- const rdata = await this.publishMeta(it, data);
9199
- return rdata.return;
9200
- }
9201
- };
7863
+ // ../simple-boot/dist/esm/decorators/SimNoProxy.js
7864
+ var SimNoProxyKey = Symbol.for("simple-boot:sim-no-proxy-metadata");
9202
7865
 
9203
7866
  // ../simple-boot/dist/esm/decorators/inject/Injection.js
9204
- var InjectionMetadataKey = Symbol("Injection");
9205
- var getInjection = (target, propertyKey) => {
9206
- return ReflectUtils.getMetadata(InjectionMetadataKey, target, propertyKey);
9207
- };
9208
-
9209
- // ../simple-boot/dist/esm/throwable/MethodNoSuch.js
9210
- var MethodNoSuch = class extends SimError {
9211
- constructor(message, name, propertyKeys, stack) {
9212
- super(message, name, stack);
9213
- this.propertyKeys = propertyKeys;
9214
- }
9215
- };
7867
+ var InjectionMetadataKey = Symbol("Injection");
9216
7868
 
9217
7869
  // ../simple-boot/dist/esm/decorators/route/Router.js
9218
- var RouterMetadataKey = Symbol("Router");
9219
- var getRouter = (target) => {
9220
- if (target != null && typeof target === "object") {
9221
- target = target.constructor;
9222
- }
9223
- try {
9224
- return ReflectUtils.getMetadata(RouterMetadataKey, target);
9225
- } catch (e) {
9226
- }
9227
- };
9228
- var RouteMetadataKey = Symbol("RouteMetadataKey");
9229
-
9230
- // ../simple-boot/dist/esm/route/RouterModule.js
9231
- var RouterModule = class {
9232
- constructor(simstanceManager, router, module, routerChains = []) {
9233
- this.simstanceManager = simstanceManager;
9234
- this.router = router;
9235
- this.module = module;
9236
- this.routerChains = routerChains;
9237
- }
9238
- get path() {
9239
- return this._path;
9240
- }
9241
- set path(value) {
9242
- this._path = value;
9243
- }
9244
- get data() {
9245
- return this._data;
9246
- }
9247
- set data(value) {
9248
- this._data = value;
9249
- }
9250
- get intent() {
9251
- return this._intent;
9252
- }
9253
- set intent(value) {
9254
- this._intent = value;
9255
- }
9256
- get propertyKeys() {
9257
- return this._propertyKeys;
9258
- }
9259
- set propertyKeys(value) {
9260
- this._propertyKeys = value;
9261
- }
9262
- get pathData() {
9263
- return this._pathData;
9264
- }
9265
- getPathData() {
9266
- return this._pathData;
9267
- }
9268
- set pathData(value) {
9269
- this._pathData = value;
9270
- }
9271
- getRouterPath(join = "") {
9272
- return this.getRouterPaths().map((it) => it ?? "").join(join);
9273
- }
9274
- getRouterPaths() {
9275
- return this.routerChains.map((it) => getRouter(it instanceof SimAtomic ? it.type.targetKeyType : it)?.path);
9276
- }
9277
- getRouterPathData(pathName) {
9278
- return Expression.Path.pathNameData(pathName, this.getRouterPath());
9279
- }
9280
- getModuleInstance(propertyKey, instanceBind = true) {
9281
- const instance = this.simstanceManager.getOrNewSim({ target: this.module?.targetKeyType, originTypeTarget: this.module?.originalType });
9282
- if (propertyKey && this.propertyKeys && this.propertyKeys.includes(propertyKey)) {
9283
- let instanceElement = instance[propertyKey];
9284
- if (instanceBind && typeof instanceBind === "boolean") {
9285
- instanceElement = instanceElement.bind(instance);
9286
- } else if (instanceBind && typeof instanceBind === "object") {
9287
- instanceElement = instanceElement.bind(instanceBind);
9288
- }
9289
- return instanceElement;
9290
- } else {
9291
- return instance;
9292
- }
9293
- }
9294
- executeModuleProperty(propertyKey, ...param) {
9295
- const target = this.getModuleInstance();
9296
- if (propertyKey) {
9297
- const config = getInjection(target, propertyKey);
9298
- if (config) {
9299
- const other = /* @__PURE__ */ new Map();
9300
- param.forEach((it) => other.set(it.constructor, it));
9301
- return this.simstanceManager.executeBindParameterSim({ target, targetKey: propertyKey }, other);
9302
- } else {
9303
- if (target[propertyKey]) {
9304
- return target[propertyKey]?.(...param);
9305
- } else {
9306
- throw new MethodNoSuch(`${propertyKey.toString()} noSuch`, propertyKey.toString(), propertyKey);
9307
- }
9308
- }
9309
- }
9310
- }
9311
- get firstRouteChain() {
9312
- return this.routerChains[0];
9313
- }
9314
- get firstRouteChainValue() {
9315
- return this.firstRouteChain?.getValue();
9316
- }
9317
- get lastRouteChain() {
9318
- return this.routerChains[this.routerChains.length - 1];
9319
- }
9320
- get lastRouteChainValue() {
9321
- return this.lastRouteChain?.getValue();
9322
- }
9323
- hasActivateInLastRoute(obj) {
9324
- return this.lastRouteChainValue?.hasActivate(obj) === true;
9325
- }
9326
- getQueryParamDecodeURI(key) {
9327
- if (this.intent) {
9328
- return this.intent.getQueryParamDecodeURI(key);
9329
- }
9330
- }
9331
- getQueryParamDecodeURIFirst(key) {
9332
- if (this.intent) {
9333
- return this.intent.getQueryParamDecodeURIFirst(key);
9334
- }
9335
- }
9336
- getQueryParam(key) {
9337
- if (this.intent) {
9338
- return this.intent.getQueryParam(key);
9339
- }
9340
- }
9341
- getQueryParamFirst(key) {
9342
- if (this.intent) {
9343
- return this.intent.getQueryParamFirst(key);
9344
- }
9345
- }
9346
- get queryParams() {
9347
- if (this.intent) {
9348
- return this.intent.queryParams;
9349
- }
9350
- }
9351
- get queryParamsAfterDecodeURI() {
9352
- if (this.intent) {
9353
- return this.intent.queryParamsDecodeURI;
9354
- }
9355
- }
9356
- };
7870
+ var RouterMetadataKey = Symbol.for("simple-boot:router-metadata");
7871
+ var RouteMetadataKey = Symbol.for("simple-boot:route-metadata");
9357
7872
 
9358
7873
  // ../simple-boot/dist/esm/route/RouterAction.js
9359
7874
  var RouterAction;
@@ -9369,435 +7884,6 @@ var dooboostoreSimpleWebComponent = (() => {
9369
7884
  };
9370
7885
  })(RouterAction || (RouterAction = {}));
9371
7886
 
9372
- // ../simple-boot/dist/esm/route/RouterManager.js
9373
- var RouterManager = class {
9374
- constructor(simpleApplication, simstanceManager, simOption) {
9375
- this.simpleApplication = simpleApplication;
9376
- this.simstanceManager = simstanceManager;
9377
- this.simOption = simOption;
9378
- this.subject = new Subject();
9379
- }
9380
- // @SimNoProxy
9381
- get observable() {
9382
- return this.subject.asObservable();
9383
- }
9384
- routingMap(option) {
9385
- const targetRouter = option?.router ?? this.simOption.rootRouter;
9386
- if (!targetRouter) {
9387
- throw new Error("no router");
9388
- }
9389
- const map = {};
9390
- if (targetRouter) {
9391
- const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
9392
- const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
9393
- const routerAtomic = new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
9394
- const routerData = routerAtomic.getConfig(RouterMetadataKey);
9395
- if (routerData) {
9396
- const currentPrefix = (option?.prefix ?? "") + routerData.path;
9397
- if (routerData.route && routerData.route[""]) {
9398
- map[currentPrefix] = routerData.route[""];
9399
- }
9400
- if (routerData.route) {
9401
- Object.entries(routerData.route).forEach(([key, value]) => {
9402
- map[currentPrefix + key] = value;
9403
- });
9404
- }
9405
- routerData.routers?.forEach((it) => {
9406
- Object.assign(map, this.routingMap({ ...option, router: it, prefix: currentPrefix }));
9407
- });
9408
- }
9409
- }
9410
- return map;
9411
- }
9412
- /** 일반적인 lifecycle 타지않는 그냥 find.. 의미가없을듯.
9413
- * @deprecated
9414
- */
9415
- async routings(intent, option) {
9416
- const targetRouter = option?.router ?? this.simOption.rootRouter;
9417
- if (!targetRouter) {
9418
- throw new Error("no router");
9419
- }
9420
- const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
9421
- const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
9422
- const routerAtomic = new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
9423
- const allMatches = this._collectAllMatchingModules(routerAtomic, intent, []);
9424
- const exactModuleMatches = allMatches.filter((rm) => rm.path === intent.pathname && rm.module);
9425
- if (exactModuleMatches.length > 0) {
9426
- exactModuleMatches.forEach((it) => this.subject.next({ intent, routerManager: this, routerModule: it }));
9427
- return exactModuleMatches;
9428
- }
9429
- const exactPathMatches = allMatches.filter((rm) => rm.path === intent.pathname);
9430
- if (exactPathMatches.length > 0) {
9431
- exactPathMatches.forEach((it) => this.subject.next({ intent, routerManager: this, routerModule: it }));
9432
- return exactPathMatches;
9433
- }
9434
- return [];
9435
- }
9436
- async routing(intent, option) {
9437
- if (typeof intent === "string") {
9438
- intent = new Intent(intent);
9439
- }
9440
- const targetRouter = option?.router ?? this.simOption.rootRouter;
9441
- const callCheckOnRouting = option?.noOnRouting !== true;
9442
- if (!targetRouter) {
9443
- debugger;
9444
- throw new Error("no router");
9445
- }
9446
- const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
9447
- const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
9448
- const routerAtomic = typeof targetType === "symbol" ? this.simstanceManager.findFirstSim(targetType) : new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
9449
- const rootRouter = routerAtomic.getValue();
9450
- const executeModuleResult = this.getExecuteModule(routerAtomic, intent, [], option);
9451
- if (executeModuleResult) {
9452
- const [executeModule, routerChains] = executeModuleResult;
9453
- executeModule.routerChains = routerChains;
9454
- this.activeRouterModule = executeModule;
9455
- const routingDataSet = { intent, routerModule: executeModule, routerManager: this };
9456
- if (routerChains.length > 0) {
9457
- for (let i = 0; i < routerChains.length; i++) {
9458
- const current = routerChains[i];
9459
- const next = routerChains[i + 1];
9460
- const value = current.getValue();
9461
- if (RouterAction.isCanActivate(value) && next) {
9462
- await value.canActivate(routingDataSet, next.getValue());
9463
- }
9464
- if (callCheckOnRouting && RouterAction.isOnRouting(value) && next) {
9465
- await value.onRouting(routingDataSet);
9466
- }
9467
- }
9468
- }
9469
- this.activeRouterModule = executeModule;
9470
- const moduleInstance = executeModule.getModuleInstance();
9471
- if (!executeModule?.module) {
9472
- const routerChain = executeModule.routerChains[executeModule.routerChains.length - 1];
9473
- const value = routerChain?.getValue();
9474
- if (RouterAction.isCanActivate(value)) {
9475
- await value.canActivate(routingDataSet, moduleInstance);
9476
- }
9477
- if (callCheckOnRouting && RouterAction.isOnRouting(value)) {
9478
- await value.onRouting(routingDataSet);
9479
- }
9480
- } else {
9481
- const value = executeModule.router?.getValue();
9482
- if (RouterAction.isCanActivate(value)) {
9483
- await value.canActivate(routingDataSet, moduleInstance);
9484
- }
9485
- if (callCheckOnRouting && RouterAction.isOnRouting(value)) {
9486
- await value.onRouting(routingDataSet);
9487
- }
9488
- if (moduleInstance && callCheckOnRouting && RouterAction.isOnRouting(moduleInstance)) {
9489
- await moduleInstance.onRouting(routingDataSet);
9490
- }
9491
- }
9492
- const find = this.activeRouterModule;
9493
- this.subject.next({ intent, routerModule: find, routerManager: this });
9494
- return find;
9495
- } else {
9496
- const empty = await this._handleNotFoundRouting(rootRouter, intent);
9497
- this.subject.next({ intent, routerModule: empty, routerManager: this });
9498
- return empty;
9499
- }
9500
- }
9501
- /**
9502
- * URL과 일치하는 라우트를 찾지 못했을 경우를 처리합니다.
9503
- * "Not Found" 상태를 나타내는 비어있는 RouterModule 객체를 생성하여 반환합니다.
9504
- * 이 과정에서 rootRouter의 라이프사이클을 호출하여 공통 레이아웃등을 처리할 수 있습니다.
9505
- * @param rootRouter 앱의 최상위 라우터 인스턴스
9506
- * @param intent 확인에 실패한 원본 Intent 객체
9507
- * @private
9508
- */
9509
- async _handleNotFoundRouting(rootRouter, intent) {
9510
- const routerModule = new RouterModule(this.simstanceManager, rootRouter, void 0, []);
9511
- const routingDataSet = { intent, routerModule, routerManager: this };
9512
- const value = rootRouter;
9513
- if (RouterAction.isCanActivate(value)) {
9514
- await value.canActivate(routingDataSet, null);
9515
- }
9516
- if (RouterAction.isOnRouting(value)) {
9517
- await value.onRouting(routingDataSet);
9518
- }
9519
- this.activeRouterModule = routerModule;
9520
- return this.activeRouterModule;
9521
- }
9522
- getExecuteModule(router, intent, parentRouters, option) {
9523
- const path = intent.pathname;
9524
- const routerConfig = router.getConfig(RouterMetadataKey);
9525
- if (routerConfig) {
9526
- const filters = [];
9527
- if (Array.isArray(routerConfig.filters)) {
9528
- filters.push(...routerConfig.filters);
9529
- } else if (routerConfig.filters) {
9530
- filters.push(routerConfig.filters);
9531
- }
9532
- const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9533
- if (noAccept) {
9534
- return;
9535
- }
9536
- const routerStrings = parentRouters.map((it) => it.getConfig(RouterMetadataKey)?.path || "");
9537
- const isRoot = this.isRootUrl(routerConfig.path, routerStrings, path);
9538
- if (isRoot) {
9539
- const currentParentRouters = [...parentRouters, router];
9540
- if (routerConfig.routers && routerConfig.routers.length > 0) {
9541
- let bestMatchModule = void 0;
9542
- let bestMatchLength = -1;
9543
- for (const child of routerConfig.routers) {
9544
- const routerAtomic = typeof child === "symbol" ? this.simstanceManager.findFirstSim(child) : new SimAtomic({ targetKeyType: child, originalType: child }, this.simstanceManager);
9545
- if (!routerAtomic) {
9546
- continue;
9547
- }
9548
- const executeModule = this.getExecuteModule(routerAtomic, intent, currentParentRouters, option);
9549
- if (executeModule) {
9550
- const [rm, chains] = executeModule;
9551
- const currentMatchLength = rm.path?.length || 0;
9552
- if (currentMatchLength > bestMatchLength) {
9553
- bestMatchLength = currentMatchLength;
9554
- bestMatchModule = executeModule;
9555
- } else if (currentMatchLength === bestMatchLength) {
9556
- if (option?.find?.router === "last") {
9557
- bestMatchModule = executeModule;
9558
- }
9559
- }
9560
- }
9561
- }
9562
- if (bestMatchModule) {
9563
- return bestMatchModule;
9564
- }
9565
- }
9566
- const module = this.findRouterOrModule(router, routerConfig, routerStrings, intent);
9567
- if (module) {
9568
- return [module, currentParentRouters];
9569
- }
9570
- }
9571
- }
9572
- }
9573
- // path: 지금 내 라우터의 path, parentRoots: 부모router path들, url: 사용자가 원하는 full intent url
9574
- isRootUrl(path, parentRoots, url) {
9575
- const searchString = parentRoots.join("") + (path || "");
9576
- if (searchString === "/") {
9577
- return true;
9578
- }
9579
- const searchs = searchString.split("/");
9580
- const urls = url.split("/");
9581
- const trimmedUrls = urls.slice(0, searchs.length).join("/");
9582
- return !!Expression.Path.pathNameData(trimmedUrls, searchString);
9583
- }
9584
- _collectAllMatchingModules(router, intent, parentRouters) {
9585
- const matches = [];
9586
- const path = intent.pathname;
9587
- const routerConfig = router.getConfig(RouterMetadataKey);
9588
- if (routerConfig) {
9589
- const filters = [];
9590
- if (Array.isArray(routerConfig.filters)) {
9591
- filters.push(...routerConfig.filters);
9592
- } else if (routerConfig.filters) {
9593
- filters.push(routerConfig.filters);
9594
- }
9595
- const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9596
- if (noAccept) {
9597
- return matches;
9598
- }
9599
- const routerStrings = parentRouters.map((it) => it.getConfig(RouterMetadataKey)?.path || "");
9600
- const isRoot = this.isRootUrl(routerConfig.path, routerStrings, path);
9601
- if (isRoot) {
9602
- const currentParentRouters = [...parentRouters, router];
9603
- if (routerConfig.routers && routerConfig.routers.length > 0) {
9604
- for (const child of routerConfig.routers) {
9605
- const routerAtomic = typeof child === "symbol" ? this.simstanceManager.findFirstSim(child) : new SimAtomic({ targetKeyType: child, originalType: child }, this.simstanceManager);
9606
- if (!routerAtomic) {
9607
- continue;
9608
- }
9609
- matches.push(...this._collectAllMatchingModules(routerAtomic, intent, currentParentRouters));
9610
- }
9611
- }
9612
- const module = this.findRouterOrModule(router, routerConfig, routerStrings, intent);
9613
- if (module) {
9614
- module.routerChains = currentParentRouters;
9615
- matches.push(module);
9616
- }
9617
- }
9618
- }
9619
- return matches;
9620
- }
9621
- findRouterOrModule(router, routerData, parentRoots, intent) {
9622
- const module = this.findRouting(router, routerData, parentRoots, intent);
9623
- if (module?.module) {
9624
- module.intent = intent;
9625
- return module;
9626
- }
9627
- const urlRoot = parentRoots.join("") + (routerData.path || "");
9628
- if (this.isRootUrl(routerData.path, parentRoots, intent.pathname)) {
9629
- const rm = new RouterModule(this.simstanceManager, router);
9630
- rm.intent = intent;
9631
- rm.path = urlRoot;
9632
- rm.pathData = intent.getPathnameData(urlRoot);
9633
- return rm;
9634
- }
9635
- return void 0;
9636
- }
9637
- findRouting(router, routerData, parentRoots, intent) {
9638
- const urlRoot = parentRoots.join("") + routerData.path;
9639
- if (routerData.route) {
9640
- for (const it of Object.keys(routerData.route).filter((it2) => !it2.startsWith("_"))) {
9641
- const path = urlRoot + it;
9642
- const pathnameData = intent.getPathnameData(path);
9643
- if (pathnameData) {
9644
- try {
9645
- const dataSet = this.findRouteProperty(routerData.route, it, intent);
9646
- const rm = new RouterModule(this.simstanceManager, router, dataSet.child);
9647
- rm.data = dataSet.data;
9648
- rm.path = path;
9649
- rm.pathData = pathnameData;
9650
- rm.propertyKeys = dataSet.propertyKeys;
9651
- return rm;
9652
- } catch (e) {
9653
- }
9654
- }
9655
- }
9656
- }
9657
- }
9658
- findRouteProperty(route, propertyName, intent) {
9659
- let child;
9660
- let data;
9661
- let propertyKeys;
9662
- const routeElement = route[propertyName];
9663
- if (typeof routeElement === "function") {
9664
- child = { targetKeyType: routeElement, originalType: routeElement };
9665
- } else if (typeof routeElement === "symbol") {
9666
- const findSimType = this.simstanceManager.findLastSim(routeElement)?.type;
9667
- if (findSimType?.originalType) {
9668
- child = { targetKeyType: findSimType.originalType, originalType: findSimType.originalType };
9669
- }
9670
- } else if (typeof routeElement === "string") {
9671
- return this.findRouteProperty(route, routeElement, intent);
9672
- } else if (Array.isArray(routeElement)) {
9673
- const r = routeElement?.[0];
9674
- if (typeof r === "object" && "filters" in r && "target" in r) {
9675
- const filters = [];
9676
- if (Array.isArray(r.filters)) {
9677
- filters.push(...r.filters);
9678
- } else if (r.filters) {
9679
- filters.push(r.filters);
9680
- }
9681
- const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9682
- if (!noAccept) {
9683
- child = { targetKeyType: r.target, originalType: r.target };
9684
- }
9685
- } else {
9686
- child = { targetKeyType: r, originalType: r };
9687
- }
9688
- data = routeElement?.[1];
9689
- } else if (typeof routeElement === "object" && "target" in routeElement && "propertyKeys" in routeElement) {
9690
- const noAccept = routeElement.filters?.filter((it) => it).some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9691
- if (!noAccept) {
9692
- child = { targetKeyType: routeElement.target, originalType: routeElement.target };
9693
- propertyKeys = routeElement.propertyKeys;
9694
- }
9695
- } else if (typeof routeElement === "object" && "filters" in routeElement && "target" in routeElement) {
9696
- const filters = [];
9697
- if (Array.isArray(routeElement.filters)) {
9698
- filters.push(...routeElement.filters);
9699
- } else if (routeElement.filters) {
9700
- filters.push(routeElement.filters);
9701
- }
9702
- const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9703
- if (!noAccept) {
9704
- child = { targetKeyType: routeElement.target, originalType: routeElement.target };
9705
- }
9706
- }
9707
- return {
9708
- child,
9709
- data,
9710
- propertyKeys
9711
- };
9712
- }
9713
- };
9714
-
9715
- // ../simple-boot/dist/esm/SimpleApplication.js
9716
- var SimpleApplication = class _SimpleApplication {
9717
- // public rootRouter?: ConstructorType<any>;
9718
- // constructor();
9719
- // constructor(option: SimOption);
9720
- // constructor(rootRouter?: ConstructorType<Object> | Function);
9721
- // constructor(rootRouter?: ConstructorType<Object> | Function, option?: SimOption);
9722
- // constructor(rootRouter?: (ConstructorType<Object> | Function) | SimOption, option = new SimOption()) {
9723
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
9724
- constructor(option = new SimOption()) {
9725
- this.option = option;
9726
- this.simstanceManager = new SimstanceManager(this, option);
9727
- this.simstanceManager.setStoreSet(SimstanceManager, this.simstanceManager);
9728
- this.routerManager = new RouterManager(this, this.simstanceManager, option);
9729
- this.intentManager = new IntentManager(this, this.simstanceManager, this.routerManager, option);
9730
- this.simstanceManager.setStoreSet(IntentManager, this.intentManager);
9731
- this.simstanceManager.setStoreSet(RouterManager, this.routerManager);
9732
- containers.add(this);
9733
- }
9734
- getSimstanceManager() {
9735
- return this.simstanceManager;
9736
- }
9737
- getIntentManager() {
9738
- return this.intentManager;
9739
- }
9740
- getRouterManager() {
9741
- return this.routerManager;
9742
- }
9743
- run(otherInstanceSim) {
9744
- otherInstanceSim ?? (otherInstanceSim = /* @__PURE__ */ new Map());
9745
- otherInstanceSim.set(_SimpleApplication, this);
9746
- this.simstanceManager.run(otherInstanceSim);
9747
- return this;
9748
- }
9749
- simAtomic(type) {
9750
- if (typeof type === "symbol") {
9751
- return this.simstanceManager.findFirstSim(type);
9752
- } else if (typeof type === "function") {
9753
- return this.simstanceManager.findFirstSim({ type });
9754
- }
9755
- }
9756
- simAtomics(type) {
9757
- if (typeof type === "symbol") {
9758
- return this.simstanceManager.findSims(type) ?? [];
9759
- } else if (typeof type === "function") {
9760
- return this.simstanceManager.findSims({ type }) ?? [];
9761
- } else {
9762
- return [];
9763
- }
9764
- }
9765
- getInstance(type) {
9766
- const i = this.sim(type);
9767
- if (i) {
9768
- return i;
9769
- } else {
9770
- throw new SimNoSuch("SimNoSuch: no simple instance(getInstance) name:" + type?.prototype?.constructor?.name + "," + type);
9771
- }
9772
- }
9773
- sim(type) {
9774
- return this.simAtomic(type)?.getValue();
9775
- }
9776
- sims(type) {
9777
- return this.simAtomics(type).map((it) => it.getValue());
9778
- }
9779
- addSim(configOrTarget, target) {
9780
- const r = Sim(configOrTarget);
9781
- if (typeof r === "function" && target) {
9782
- r(target);
9783
- }
9784
- }
9785
- publishIntent(i, data) {
9786
- return this.intentManager.publish(i, data);
9787
- }
9788
- routing(i, option) {
9789
- if (i instanceof Intent) {
9790
- return this.routerManager.routing(i, option);
9791
- } else if (typeof i === "string") {
9792
- const intent = new Intent(i);
9793
- return this.routerManager.routing(intent, option);
9794
- } else {
9795
- const intent = new Intent(i.path, i.data);
9796
- return this.routerManager.routing(intent, option);
9797
- }
9798
- }
9799
- };
9800
-
9801
7887
  // ../core-web/dist/esm/element/CanvasUtils.js
9802
7888
  var CanvasUtils;
9803
7889
  ((CanvasUtils2) => {
@@ -10558,392 +8644,6 @@ var dooboostoreSimpleWebComponent = (() => {
10558
8644
  return /Mobi/i.test(targetWindow.navigator.userAgent);
10559
8645
  };
10560
8646
  })(ValidUtils2 || (ValidUtils2 = {}));
10561
-
10562
- // ../simple-boot/dist/esm/index.js
10563
- var import_reflect_metadata = __toESM(require_Reflect(), 1);
10564
-
10565
- // ../simple-boot/dist/esm/alert/AlertAction.js
10566
- var AlertAction = /* @__PURE__ */ ((AlertAction2) => {
10567
- AlertAction2["ACTIVE"] = "ACTIVE";
10568
- AlertAction2["IN_ACTIVE"] = "IN_ACTIVE";
10569
- return AlertAction2;
10570
- })(AlertAction || {});
10571
-
10572
- // ../simple-boot/dist/esm/alert/Alert.js
10573
- var Alert = class {
10574
- constructor(alertService, config) {
10575
- this.alertService = alertService;
10576
- this.config = config;
10577
- this.isActive = false;
10578
- this.activateBefore = [];
10579
- this.activateAfter = [];
10580
- this.deActivateBefore = [];
10581
- this.deActivateAfter = [];
10582
- this.data = /* @__PURE__ */ new Map();
10583
- if (config?.uuid) {
10584
- this.uuid = config.uuid;
10585
- } else {
10586
- this.uuid = RandomUtils.uuid();
10587
- }
10588
- }
10589
- addOpenBefore(fn) {
10590
- this.activateBefore.push(fn);
10591
- }
10592
- addOpenAfter(fn) {
10593
- this.activateAfter.push(fn);
10594
- }
10595
- addCloseBefore(fn) {
10596
- this.deActivateBefore.push(fn);
10597
- }
10598
- addCloseAfter(fn) {
10599
- this.deActivateAfter.push(fn);
10600
- }
10601
- setData(key, value) {
10602
- this.data.set(key, value);
10603
- }
10604
- getData(key) {
10605
- return this.data.get(key);
10606
- }
10607
- async activate() {
10608
- try {
10609
- await Promise.allSettled(this.activateBefore.map((it) => it())).then((it) => {
10610
- this.result = this.make();
10611
- this.alertService?.publish({ action: AlertAction.ACTIVE, alert: this });
10612
- this.isActive = true;
10613
- if (this.config?.closeTime !== void 0 && this.config?.closeTime > 0) {
10614
- setTimeout(() => {
10615
- this.deActivate();
10616
- }, this.config.closeTime);
10617
- }
10618
- this.config?.activate?.(this.result, this);
10619
- });
10620
- } catch (e) {
10621
- } finally {
10622
- await Promise.allSettled(this.activateAfter.map((it) => it())).then((it) => {
10623
- });
10624
- }
10625
- }
10626
- async deActivate() {
10627
- try {
10628
- await Promise.allSettled(this.deActivateBefore.map((it) => it())).then((it) => {
10629
- this.alertService?.publish({ action: AlertAction.IN_ACTIVE, alert: this });
10630
- this.isActive = false;
10631
- this.config?.deActivate?.(this.result, this);
10632
- });
10633
- } catch (e) {
10634
- } finally {
10635
- await Promise.allSettled(this.deActivateAfter.map((it) => it())).then((it) => {
10636
- });
10637
- }
10638
- }
10639
- };
10640
-
10641
- // ../simple-boot/dist/esm/alert/AlertFactory.js
10642
- var __decorate = function(decorators, target, key, desc) {
10643
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10644
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10645
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10646
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10647
- };
10648
- var AlertFactory;
10649
- (function(AlertFactory2) {
10650
- AlertFactory2.SYMBOL = Symbol("AlertFactory");
10651
- })(AlertFactory || (AlertFactory = {}));
10652
- var DefaultAlertFactory = class DefaultAlertFactory2 {
10653
- create(data) {
10654
- return void 0;
10655
- }
10656
- };
10657
- DefaultAlertFactory = __decorate([
10658
- Sim({ symbol: AlertFactory.SYMBOL })
10659
- ], DefaultAlertFactory);
10660
-
10661
- // ../simple-boot/dist/esm/alert/AlertType.js
10662
- var AlertType = /* @__PURE__ */ ((AlertType2) => {
10663
- AlertType2["DANGER"] = "DANGER";
10664
- AlertType2["NORMAL"] = "NORMAL";
10665
- AlertType2["PROGRESS"] = "PROGRESS";
10666
- AlertType2["SUCCESS"] = "SUCCESS";
10667
- AlertType2["ERROR"] = "ERROR";
10668
- AlertType2["INFO"] = "INFO";
10669
- AlertType2["WARNING"] = "WARNING";
10670
- AlertType2["CONSOLE"] = "CONSOLE";
10671
- AlertType2["ETC"] = "ETC";
10672
- return AlertType2;
10673
- })(AlertType || {});
10674
-
10675
- // ../simple-boot/dist/esm/alert/AlertService.js
10676
- var __decorate2 = function(decorators, target, key, desc) {
10677
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10678
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10679
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10680
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10681
- };
10682
- var __metadata = function(k, v) {
10683
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10684
- };
10685
- var __param = function(paramIndex, decorator) {
10686
- return function(target, key) {
10687
- decorator(target, key, paramIndex);
10688
- };
10689
- };
10690
- var _a;
10691
- var AlertService = class AlertService2 {
10692
- constructor(alertFactory) {
10693
- this.name = (/* @__PURE__ */ new Date()).toUTCString();
10694
- this.subject = new ReplaySubject();
10695
- this.alertFactory = alertFactory;
10696
- }
10697
- // @PostConstruct
10698
- // postConstruct(
10699
- // ) {
10700
- // this.alertFactory = alertFactory;
10701
- // }
10702
- get observable() {
10703
- return this.subject.asObservable();
10704
- }
10705
- publish(data) {
10706
- this.subject.next(data);
10707
- }
10708
- create(factory, config) {
10709
- return new class extends Alert {
10710
- make() {
10711
- return factory(this);
10712
- }
10713
- }(this, config);
10714
- }
10715
- createFromFactory(type, config) {
10716
- return this.alertFactory?.create({ caller: this, type, config });
10717
- }
10718
- danger(config) {
10719
- return this.createFromFactory(AlertType.DANGER, config);
10720
- }
10721
- progress(config) {
10722
- config = config ?? {};
10723
- return this.createFromFactory(AlertType.PROGRESS, config);
10724
- }
10725
- success(config) {
10726
- return this.createFromFactory(AlertType.SUCCESS, config);
10727
- }
10728
- info(config) {
10729
- return this.createFromFactory(AlertType.INFO, config);
10730
- }
10731
- error(config) {
10732
- return this.createFromFactory(AlertType.ERROR, config);
10733
- }
10734
- warning(config) {
10735
- return this.createFromFactory(AlertType.WARNING, config);
10736
- }
10737
- };
10738
- AlertService = __decorate2([
10739
- Sim,
10740
- __param(0, Inject({ symbol: AlertFactory.SYMBOL })),
10741
- __metadata("design:paramtypes", [typeof (_a = typeof AlertFactory !== "undefined" && AlertFactory) === "function" ? _a : Object])
10742
- ], AlertService);
10743
-
10744
- // ../simple-boot/dist/esm/decorators/cache/CacheDecorator.js
10745
- var simpleApplicationCache = /* @__PURE__ */ new WeakMap();
10746
- var getCacheSet = (simpleApplication) => {
10747
- return simpleApplicationCache.get(simpleApplication);
10748
- };
10749
- var findCacheByKey = (simpleApplication, key) => {
10750
- const storage = simpleApplicationCache.get(simpleApplication);
10751
- if (storage) {
10752
- return Array.from(storage.config.entries()).find(([k, v]) => k === key);
10753
- }
10754
- };
10755
- var findCacheByKeyStartWith = (simpleApplication, key) => {
10756
- const storage = simpleApplicationCache.get(simpleApplication);
10757
- if (storage) {
10758
- return Array.from(storage.config.entries()).filter(([k, v]) => k.startsWith(key));
10759
- } else {
10760
- return [];
10761
- }
10762
- };
10763
- var deleteCacheByKey = (simpleApplication, key) => {
10764
- const storage = simpleApplicationCache.get(simpleApplication);
10765
- if (storage) {
10766
- storage.storage.delete(key);
10767
- findCacheByKeyStartWith(simpleApplication, key).forEach(([k, v]) => {
10768
- const data = storage.config.get(k);
10769
- if (data?.expireTimeout) {
10770
- clearTimeout(data.expireTimeout);
10771
- }
10772
- storage.config.delete(k);
10773
- storage.storage.delete(k);
10774
- });
10775
- }
10776
- };
10777
- var deleteCacheByKeyStartWith = (simpleApplication, key) => {
10778
- findCacheByKeyStartWith(simpleApplication, key).forEach(([key2, data]) => deleteCacheByKey(simpleApplication, key2));
10779
- };
10780
- var CacheMetadataKey = Symbol("Cache");
10781
-
10782
- // ../simple-boot/dist/esm/cache/CacheManager.js
10783
- var __decorate3 = function(decorators, target, key, desc) {
10784
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10785
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10786
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10787
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10788
- };
10789
- var __metadata2 = function(k, v) {
10790
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10791
- };
10792
- var _a2;
10793
- var CacheManager = class CacheManager2 {
10794
- constructor(simpleApplication) {
10795
- this.simpleApplication = simpleApplication;
10796
- }
10797
- findCacheByKey(key) {
10798
- return findCacheByKey(this.simpleApplication, key);
10799
- }
10800
- findCacheByKeyStartWith(key) {
10801
- return findCacheByKeyStartWith(this.simpleApplication, key);
10802
- }
10803
- deleteCacheByKey(key) {
10804
- return deleteCacheByKey(this.simpleApplication, key);
10805
- }
10806
- deleteCacheByKeyStartWith(key) {
10807
- return deleteCacheByKeyStartWith(this.simpleApplication, key);
10808
- }
10809
- getCacheSet() {
10810
- return getCacheSet(this.simpleApplication);
10811
- }
10812
- };
10813
- CacheManager = __decorate3([
10814
- Sim,
10815
- __metadata2("design:paramtypes", [typeof (_a2 = typeof SimpleApplication !== "undefined" && SimpleApplication) === "function" ? _a2 : Object])
10816
- ], CacheManager);
10817
-
10818
- // ../simple-boot/dist/esm/decorators/event/EventListener.js
10819
- var EventListenerMetadataKey = Symbol("EventListener");
10820
-
10821
- // ../simple-boot/dist/esm/decorators/validate/Validation.js
10822
- var ValidMetadataKey = Symbol("ValidMetadataKey");
10823
- var ValidationMetadataKey = Symbol("ValidationMetadataKey");
10824
-
10825
- // ../simple-boot/dist/esm/fetch/ApiService.js
10826
- var __decorate4 = function(decorators, target, key, desc) {
10827
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10828
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10829
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10830
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10831
- };
10832
- var __metadata3 = function(k, v) {
10833
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10834
- };
10835
- var _a3;
10836
- var _b;
10837
- var ApiServiceInterceptor;
10838
- (function(ApiServiceInterceptor2) {
10839
- ApiServiceInterceptor2.TOKEN = Symbol("ApiServiceInterceptor");
10840
- ApiServiceInterceptor2.resolveAll = (simstanceManager) => {
10841
- try {
10842
- return (simstanceManager.findSims(ApiServiceInterceptor2.TOKEN) ?? []).map((it) => it.getValue()).filter(ValidUtils.isDefined);
10843
- } catch (e) {
10844
- return [];
10845
- }
10846
- };
10847
- })(ApiServiceInterceptor || (ApiServiceInterceptor = {}));
10848
- var ApiService = class ApiService2 extends HttpJsonFetcher {
10849
- constructor(simstanceManager, alertService) {
10850
- super();
10851
- this.simstanceManager = simstanceManager;
10852
- this.subject = new Subject();
10853
- this.alertService = alertService;
10854
- }
10855
- // @PostConstruct
10856
- // postConstruct(alertService: AlertService<any>) {
10857
- // this.alertService = alertService;
10858
- // }
10859
- get observable() {
10860
- return this.subject.asObservable();
10861
- }
10862
- createPipe(config) {
10863
- return {};
10864
- }
10865
- async beforeProxyFetch(config) {
10866
- let interceptors = ApiServiceInterceptor.resolveAll(this.simstanceManager);
10867
- for (const interceptor of interceptors) {
10868
- if (interceptor.beforeProxyFetch) {
10869
- config = await interceptor.beforeProxyFetch(config);
10870
- }
10871
- }
10872
- this.subject.next({ type: "beforeFetchData", config });
10873
- return config;
10874
- }
10875
- async afterProxyFetch(config) {
10876
- let interceptors = ApiServiceInterceptor.resolveAll(this.simstanceManager);
10877
- let r = config.response;
10878
- for (const interceptor of interceptors) {
10879
- if (interceptor.afterProxyFetch) {
10880
- r = await interceptor.afterProxyFetch(config);
10881
- }
10882
- }
10883
- this.subject.next({ type: "afterFetchData", response: r });
10884
- return r;
10885
- }
10886
- beforeFetch(fetch2) {
10887
- this.subject.next({ type: "beforeFetch", fetch: fetch2 });
10888
- }
10889
- afterFetch(fetch2, response) {
10890
- this.subject.next({ type: "afterFetch", fetch: fetch2, response });
10891
- }
10892
- before(config, pipe) {
10893
- this.subject.next({ type: "progress", config, pipe });
10894
- config.config?.config?.callBackProgress?.(config, pipe);
10895
- if (config.config?.config?.alertProgress) {
10896
- const alert = this.alertService?.progress({ title: config.config.config.title });
10897
- if (alert) {
10898
- pipe.progress = alert;
10899
- alert.activate();
10900
- }
10901
- }
10902
- }
10903
- afterSuccess(config, pipe) {
10904
- this.subject.next({ type: "success", config, pipe });
10905
- config.config?.config?.callBackSuccess?.(config, pipe);
10906
- if (config.config?.config?.alertSuccessMsg) {
10907
- this.alertService?.success({ title: config.config.config.title })?.activate();
10908
- }
10909
- }
10910
- afterSuccessTransform(config, pipe) {
10911
- }
10912
- finally(config, pipe) {
10913
- this.subject.next({ type: "final", config, pipe });
10914
- config.config?.config?.callBackFinal?.(config, pipe);
10915
- pipe.progress?.deActivate();
10916
- }
10917
- error(config, pipe, e) {
10918
- console.log("error", e);
10919
- this.subject.next({ type: "error", config, pipe, e });
10920
- config.config?.config?.callBackError?.(config, pipe, e);
10921
- if (config.config?.config?.alertErrorMsg) {
10922
- this.alertService?.danger({
10923
- title: `${config.config.config.title ? config.config.config.title : ""}${e.message ? `(${e.message})` : ""}`
10924
- })?.activate();
10925
- }
10926
- if (config.config?.config?.enableErrorConsole) {
10927
- console.error(`apiService Error ${config?.config?.config?.title}`, e);
10928
- }
10929
- }
10930
- async execute(fetcherRequest) {
10931
- const target = fetcherRequest.target;
10932
- const config = fetcherRequest.config;
10933
- let r = { target, config };
10934
- const interceptor = ApiServiceInterceptor.resolveAll(this.simstanceManager) ?? [];
10935
- for (const apiServiceInterceptor of interceptor) {
10936
- if (apiServiceInterceptor.beforeProxyExecute) {
10937
- r = await apiServiceInterceptor.beforeProxyExecute?.(r);
10938
- }
10939
- }
10940
- return super.execute(r);
10941
- }
10942
- };
10943
- ApiService = __decorate4([
10944
- Sim,
10945
- __metadata3("design:paramtypes", [typeof (_a3 = typeof SimstanceManager !== "undefined" && SimstanceManager) === "function" ? _a3 : Object, typeof (_b = typeof AlertService !== "undefined" && AlertService) === "function" ? _b : Object])
10946
- ], ApiService);
10947
8647
  return __toCommonJS(bundle_entry_exports);
10948
8648
  })();
10949
8649
  /*! Bundled license information: