@dooboostore/simple-web-component 1.0.36 → 1.0.37

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 (210) hide show
  1. package/README.md +41 -4
  2. package/dist/cjs/{elements/SwcAppEngine.js → SwcAppEngine.js} +6 -6
  3. package/dist/cjs/SwcAppEngine.js.map +7 -0
  4. package/dist/cjs/decorators/applyNode.js +14 -13
  5. package/dist/cjs/decorators/applyNode.js.map +2 -2
  6. package/dist/cjs/decorators/applySlot.js +122 -0
  7. package/dist/cjs/decorators/applySlot.js.map +7 -0
  8. package/dist/cjs/decorators/elementDefine.js +38 -30
  9. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  10. package/dist/cjs/decorators/index.js +1 -0
  11. package/dist/cjs/decorators/index.js.map +2 -2
  12. package/dist/cjs/decorators/lifecycles.js +56 -8
  13. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  14. package/dist/cjs/elements/{SwcAppMixin.js → SwcApp.js} +107 -57
  15. package/dist/cjs/elements/SwcApp.js.map +7 -0
  16. package/dist/cjs/elements/index.js +21 -2
  17. package/dist/cjs/elements/index.js.map +3 -3
  18. package/dist/cjs/elements/tt/SwcAppMixin.js +1 -0
  19. package/dist/cjs/elements/tt/SwcAppMixin.js.map +7 -0
  20. package/dist/cjs/elements/tt/SwcAsync.js +1 -0
  21. package/dist/cjs/elements/tt/SwcAsync.js.map +7 -0
  22. package/dist/cjs/elements/tt/SwcAsyncTemplate.js +1 -0
  23. package/dist/cjs/elements/tt/SwcAsyncTemplate.js.map +7 -0
  24. package/dist/cjs/elements/tt/SwcChoose.js +1 -0
  25. package/dist/cjs/elements/tt/SwcChoose.js.map +7 -0
  26. package/dist/cjs/elements/tt/SwcChooseTemplate.js +1 -0
  27. package/dist/cjs/elements/tt/SwcChooseTemplate.js.map +7 -0
  28. package/dist/cjs/elements/tt/SwcIf.js +1 -0
  29. package/dist/cjs/elements/tt/SwcIf.js.map +7 -0
  30. package/dist/cjs/elements/tt/SwcIfTemplate.js +1 -0
  31. package/dist/cjs/elements/tt/SwcIfTemplate.js.map +7 -0
  32. package/dist/cjs/elements/tt/SwcLoop.js +1 -0
  33. package/dist/cjs/elements/tt/SwcLoop.js.map +7 -0
  34. package/dist/cjs/elements/tt/SwcLoopTemplate.js +1 -0
  35. package/dist/cjs/elements/tt/SwcLoopTemplate.js.map +7 -0
  36. package/dist/cjs/elements/tt/SwcSubTemplates.js +1 -0
  37. package/dist/cjs/elements/tt/SwcSubTemplates.js.map +7 -0
  38. package/dist/cjs/elements/tt/register.js +1 -0
  39. package/dist/cjs/elements/tt/register.js.map +7 -0
  40. package/dist/cjs/index.js +12 -8
  41. package/dist/cjs/index.js.map +2 -2
  42. package/dist/cjs/types/window.d.js +16 -0
  43. package/dist/cjs/types/window.d.js.map +7 -0
  44. package/dist/cjs/types.js.map +1 -1
  45. package/dist/cjs/utils/Utils.js +9 -6
  46. package/dist/cjs/utils/Utils.js.map +2 -2
  47. package/dist/esm/{elements/SwcAppEngine.js → SwcAppEngine.js} +4 -4
  48. package/dist/esm/SwcAppEngine.js.map +7 -0
  49. package/dist/esm/decorators/applyNode.js +14 -13
  50. package/dist/esm/decorators/applyNode.js.map +2 -2
  51. package/dist/esm/decorators/applySlot.js +103 -0
  52. package/dist/esm/decorators/applySlot.js.map +7 -0
  53. package/dist/esm/decorators/elementDefine.js +41 -33
  54. package/dist/esm/decorators/elementDefine.js.map +2 -2
  55. package/dist/esm/decorators/index.js +1 -0
  56. package/dist/esm/decorators/index.js.map +2 -2
  57. package/dist/esm/decorators/lifecycles.js +56 -8
  58. package/dist/esm/decorators/lifecycles.js.map +2 -2
  59. package/dist/esm/elements/{SwcAppMixin.js → SwcApp.js} +102 -53
  60. package/dist/esm/elements/SwcApp.js.map +7 -0
  61. package/dist/esm/elements/index.js +7 -1
  62. package/dist/esm/elements/index.js.map +2 -2
  63. package/dist/esm/elements/tt/SwcAppMixin.js +1 -0
  64. package/dist/esm/elements/tt/SwcAppMixin.js.map +7 -0
  65. package/dist/esm/elements/tt/SwcAsync.js +1 -0
  66. package/dist/esm/elements/tt/SwcAsync.js.map +7 -0
  67. package/dist/esm/elements/tt/SwcAsyncTemplate.js +1 -0
  68. package/dist/esm/elements/tt/SwcAsyncTemplate.js.map +7 -0
  69. package/dist/esm/elements/tt/SwcChoose.js +1 -0
  70. package/dist/esm/elements/tt/SwcChoose.js.map +7 -0
  71. package/dist/esm/elements/tt/SwcChooseTemplate.js +1 -0
  72. package/dist/esm/elements/tt/SwcChooseTemplate.js.map +7 -0
  73. package/dist/esm/elements/tt/SwcIf.js +1 -0
  74. package/dist/esm/elements/tt/SwcIf.js.map +7 -0
  75. package/dist/esm/elements/tt/SwcIfTemplate.js +1 -0
  76. package/dist/esm/elements/tt/SwcIfTemplate.js.map +7 -0
  77. package/dist/esm/elements/tt/SwcLoop.js +1 -0
  78. package/dist/esm/elements/tt/SwcLoop.js.map +7 -0
  79. package/dist/esm/elements/tt/SwcLoopTemplate.js +1 -0
  80. package/dist/esm/elements/tt/SwcLoopTemplate.js.map +7 -0
  81. package/dist/esm/elements/tt/SwcSubTemplates.js +1 -0
  82. package/dist/esm/elements/tt/SwcSubTemplates.js.map +7 -0
  83. package/dist/esm/elements/tt/register.js +1 -0
  84. package/dist/esm/elements/tt/register.js.map +7 -0
  85. package/dist/esm/index.js +13 -9
  86. package/dist/esm/index.js.map +2 -2
  87. package/dist/esm/types/window.d.js +1 -0
  88. package/dist/esm/types/window.d.js.map +7 -0
  89. package/dist/esm/types.js.map +1 -1
  90. package/dist/esm/utils/Utils.js +9 -6
  91. package/dist/esm/utils/Utils.js.map +2 -2
  92. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +3867 -97
  93. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  94. package/dist/types/{elements/SwcAppEngine.d.ts → SwcAppEngine.d.ts} +9 -4
  95. package/dist/types/SwcAppEngine.d.ts.map +1 -0
  96. package/dist/types/decorators/applyNode.d.ts +7 -7
  97. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  98. package/dist/types/decorators/applySlot.d.ts +27 -0
  99. package/dist/types/decorators/applySlot.d.ts.map +1 -0
  100. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  101. package/dist/types/decorators/index.d.ts +1 -0
  102. package/dist/types/decorators/index.d.ts.map +1 -1
  103. package/dist/types/decorators/lifecycles.d.ts +21 -6
  104. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  105. package/dist/types/elements/SwcApp.d.ts +7 -0
  106. package/dist/types/elements/SwcApp.d.ts.map +1 -0
  107. package/dist/types/elements/index.d.ts +2 -1
  108. package/dist/types/elements/index.d.ts.map +1 -1
  109. package/dist/types/elements/tt/SwcAppMixin.d.ts +1 -0
  110. package/dist/types/elements/tt/SwcAppMixin.d.ts.map +1 -0
  111. package/dist/types/elements/tt/SwcAsync.d.ts +1 -0
  112. package/dist/types/elements/tt/SwcAsync.d.ts.map +1 -0
  113. package/dist/types/elements/tt/SwcAsyncTemplate.d.ts +1 -0
  114. package/dist/types/elements/tt/SwcAsyncTemplate.d.ts.map +1 -0
  115. package/dist/types/elements/tt/SwcChoose.d.ts +1 -0
  116. package/dist/types/elements/tt/SwcChoose.d.ts.map +1 -0
  117. package/dist/types/elements/tt/SwcChooseTemplate.d.ts +1 -0
  118. package/dist/types/elements/tt/SwcChooseTemplate.d.ts.map +1 -0
  119. package/dist/types/elements/tt/SwcIf.d.ts +1 -0
  120. package/dist/types/elements/{SwcIf.d.ts.map → tt/SwcIf.d.ts.map} +1 -1
  121. package/dist/types/elements/tt/SwcIfTemplate.d.ts +1 -0
  122. package/dist/types/elements/tt/SwcIfTemplate.d.ts.map +1 -0
  123. package/dist/types/elements/tt/SwcLoop.d.ts +1 -0
  124. package/dist/types/elements/tt/SwcLoop.d.ts.map +1 -0
  125. package/dist/types/elements/tt/SwcLoopTemplate.d.ts +1 -0
  126. package/dist/types/elements/tt/SwcLoopTemplate.d.ts.map +1 -0
  127. package/dist/types/elements/tt/SwcSubTemplates.d.ts +1 -0
  128. package/dist/types/elements/tt/SwcSubTemplates.d.ts.map +1 -0
  129. package/dist/types/elements/tt/register.d.ts +1 -0
  130. package/dist/types/elements/tt/register.d.ts.map +1 -0
  131. package/dist/types/index.d.ts +2 -2
  132. package/dist/types/index.d.ts.map +1 -1
  133. package/dist/types/types.d.ts +3 -3
  134. package/dist/types/types.d.ts.map +1 -1
  135. package/dist/types/utils/Utils.d.ts +6 -5
  136. package/dist/types/utils/Utils.d.ts.map +1 -1
  137. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +3867 -97
  138. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  139. package/package.json +2 -2
  140. package/src/{elements/SwcAppEngine.ts → SwcAppEngine.ts} +12 -7
  141. package/src/decorators/applyNode.ts +15 -13
  142. package/src/decorators/applySlot.ts +228 -0
  143. package/src/decorators/elementDefine.ts +59 -37
  144. package/src/decorators/index.ts +1 -0
  145. package/src/decorators/lifecycles.ts +76 -11
  146. package/src/elements/{SwcAppMixin.ts → SwcApp.ts} +98 -31
  147. package/src/elements/index.ts +11 -1
  148. package/src/elements/tt/SwcAppMixin.ts +13 -0
  149. package/src/elements/tt/SwcAsync.ts +139 -0
  150. package/src/elements/tt/SwcAsyncTemplate.ts +126 -0
  151. package/src/elements/tt/SwcChoose.ts +182 -0
  152. package/src/elements/tt/SwcChooseTemplate.ts +229 -0
  153. package/src/elements/tt/SwcIf.ts +145 -0
  154. package/src/elements/tt/SwcIfTemplate.ts +158 -0
  155. package/src/elements/tt/SwcLoop.ts +222 -0
  156. package/src/elements/tt/SwcLoopTemplate.ts +255 -0
  157. package/src/elements/tt/SwcSubTemplates.ts +6 -0
  158. package/src/elements/tt/register.ts +720 -0
  159. package/src/index.ts +13 -9
  160. package/src/types/window.d.ts +43 -0
  161. package/src/types.ts +4 -3
  162. package/src/utils/Utils.ts +11 -6
  163. package/dist/cjs/elements/SwcAppEngine.js.map +0 -7
  164. package/dist/cjs/elements/SwcAppMixin.js.map +0 -7
  165. package/dist/cjs/elements/SwcAsync.js +0 -129
  166. package/dist/cjs/elements/SwcAsync.js.map +0 -7
  167. package/dist/cjs/elements/SwcChoose.js +0 -155
  168. package/dist/cjs/elements/SwcChoose.js.map +0 -7
  169. package/dist/cjs/elements/SwcIf.js +0 -117
  170. package/dist/cjs/elements/SwcIf.js.map +0 -7
  171. package/dist/cjs/elements/SwcLoop.js +0 -176
  172. package/dist/cjs/elements/SwcLoop.js.map +0 -7
  173. package/dist/cjs/elements/SwcSubTemplates.js +0 -13
  174. package/dist/cjs/elements/SwcSubTemplates.js.map +0 -7
  175. package/dist/cjs/elements/register.js +0 -1026
  176. package/dist/cjs/elements/register.js.map +0 -7
  177. package/dist/esm/elements/SwcAppEngine.js.map +0 -7
  178. package/dist/esm/elements/SwcAppMixin.js.map +0 -7
  179. package/dist/esm/elements/SwcAsync.js +0 -129
  180. package/dist/esm/elements/SwcAsync.js.map +0 -7
  181. package/dist/esm/elements/SwcChoose.js +0 -155
  182. package/dist/esm/elements/SwcChoose.js.map +0 -7
  183. package/dist/esm/elements/SwcIf.js +0 -117
  184. package/dist/esm/elements/SwcIf.js.map +0 -7
  185. package/dist/esm/elements/SwcLoop.js +0 -176
  186. package/dist/esm/elements/SwcLoop.js.map +0 -7
  187. package/dist/esm/elements/SwcSubTemplates.js +0 -13
  188. package/dist/esm/elements/SwcSubTemplates.js.map +0 -7
  189. package/dist/esm/elements/register.js +0 -1007
  190. package/dist/esm/elements/register.js.map +0 -7
  191. package/dist/types/elements/SwcAppEngine.d.ts.map +0 -1
  192. package/dist/types/elements/SwcAppMixin.d.ts +0 -386
  193. package/dist/types/elements/SwcAppMixin.d.ts.map +0 -1
  194. package/dist/types/elements/SwcAsync.d.ts +0 -2
  195. package/dist/types/elements/SwcAsync.d.ts.map +0 -1
  196. package/dist/types/elements/SwcChoose.d.ts +0 -2
  197. package/dist/types/elements/SwcChoose.d.ts.map +0 -1
  198. package/dist/types/elements/SwcIf.d.ts +0 -2
  199. package/dist/types/elements/SwcLoop.d.ts +0 -2
  200. package/dist/types/elements/SwcLoop.d.ts.map +0 -1
  201. package/dist/types/elements/SwcSubTemplates.d.ts +0 -13
  202. package/dist/types/elements/SwcSubTemplates.d.ts.map +0 -1
  203. package/dist/types/elements/register.d.ts +0 -4
  204. package/dist/types/elements/register.d.ts.map +0 -1
  205. package/src/elements/SwcAsync.ts +0 -126
  206. package/src/elements/SwcChoose.ts +0 -190
  207. package/src/elements/SwcIf.ts +0 -124
  208. package/src/elements/SwcLoop.ts +0 -205
  209. package/src/elements/SwcSubTemplates.ts +0 -6
  210. package/src/elements/register.ts +0 -1022
@@ -4,6 +4,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
8
  var __commonJS = (cb, mod) => function __require() {
8
9
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
10
  };
@@ -23,6 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
25
  mod
25
26
  ));
27
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
26
28
 
27
29
  // ../../../node_modules/.pnpm/reflect-metadata@0.2.2/node_modules/reflect-metadata/Reflect.js
28
30
  var require_Reflect = __commonJS({
@@ -1110,10 +1112,10 @@ var require_Reflect = __commonJS({
1110
1112
  });
1111
1113
 
1112
1114
  // src/bundle-entry.ts
1113
- var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
1115
+ var import_reflect_metadata3 = __toESM(require_Reflect(), 1);
1114
1116
 
1115
1117
  // src/index.ts
1116
- var import_reflect_metadata = __toESM(require_Reflect(), 1);
1118
+ var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
1117
1119
 
1118
1120
  // ../core/dist/esm/valid/ValidUtils.js
1119
1121
  var ValidUtils;
@@ -4789,6 +4791,137 @@ var Observable = class {
4789
4791
  }
4790
4792
  };
4791
4793
 
4794
+ // ../core/dist/esm/message/Subject.js
4795
+ var Subject = class extends Observable {
4796
+ constructor() {
4797
+ super((subscriber) => {
4798
+ return this._subscribeToSubject(subscriber);
4799
+ });
4800
+ this._observers = /* @__PURE__ */ new Set();
4801
+ this._isStopped = false;
4802
+ this._hasError = false;
4803
+ }
4804
+ _subscribeToSubject(subscriber) {
4805
+ const partialObserver = {
4806
+ next: subscriber.next.bind(subscriber),
4807
+ error: subscriber.error.bind(subscriber),
4808
+ complete: subscriber.complete.bind(subscriber)
4809
+ };
4810
+ if (this._isStopped) {
4811
+ if (this._hasError) {
4812
+ partialObserver.error?.(this._error);
4813
+ } else {
4814
+ partialObserver.complete?.();
4815
+ }
4816
+ return Subscription.EMPTY;
4817
+ }
4818
+ this._observers.add(partialObserver);
4819
+ return new Subscription(() => {
4820
+ this._observers.delete(partialObserver);
4821
+ });
4822
+ }
4823
+ next(data) {
4824
+ if (this._isStopped) {
4825
+ return;
4826
+ }
4827
+ this._observers.forEach((observer) => {
4828
+ observer.next?.(data);
4829
+ });
4830
+ }
4831
+ error(err) {
4832
+ if (this._isStopped) {
4833
+ return;
4834
+ }
4835
+ this._hasError = true;
4836
+ this._error = err;
4837
+ this._isStopped = true;
4838
+ this._observers.forEach((observer) => observer.error?.(err));
4839
+ this._observers.clear();
4840
+ }
4841
+ complete() {
4842
+ if (this._isStopped) {
4843
+ return;
4844
+ }
4845
+ this._isStopped = true;
4846
+ this._observers.forEach((observer) => observer.complete?.());
4847
+ this._observers.clear();
4848
+ }
4849
+ asObservable() {
4850
+ return new Observable((subscriber) => {
4851
+ return this._subscribeToSubject(subscriber);
4852
+ });
4853
+ }
4854
+ };
4855
+
4856
+ // ../core/dist/esm/message/BehaviorSubject.js
4857
+ var BehaviorSubject = class extends Subject {
4858
+ // BehaviorSubject always has a current value
4859
+ constructor(initialValue) {
4860
+ super();
4861
+ this._value = initialValue;
4862
+ }
4863
+ next(data) {
4864
+ this._value = data;
4865
+ super.next(data);
4866
+ }
4867
+ _subscribeToSubject(subscriber) {
4868
+ const subscription = super._subscribeToSubject(subscriber);
4869
+ if (!this._isStopped) {
4870
+ subscriber.next(this._value);
4871
+ } else if (this._hasError) {
4872
+ subscriber.error(this._error);
4873
+ } else {
4874
+ subscriber.complete();
4875
+ }
4876
+ return subscription;
4877
+ }
4878
+ getValue() {
4879
+ if (this._hasError) {
4880
+ throw this._error;
4881
+ }
4882
+ return this._value;
4883
+ }
4884
+ };
4885
+
4886
+ // ../core/dist/esm/message/ReplaySubject.js
4887
+ var ReplaySubject = class extends Subject {
4888
+ // Removed: private _error: E | undefined;
4889
+ // Removed: private _isStopped = false;
4890
+ constructor(bufferSize = Infinity) {
4891
+ super();
4892
+ this.bufferSize = bufferSize;
4893
+ this._buffer = [];
4894
+ }
4895
+ next(data) {
4896
+ if (this._isStopped) {
4897
+ return;
4898
+ }
4899
+ this._buffer.push(data);
4900
+ if (this._buffer.length > this.bufferSize) {
4901
+ this._buffer.shift();
4902
+ }
4903
+ super.next(data);
4904
+ }
4905
+ error(err) {
4906
+ super.error(err);
4907
+ }
4908
+ complete() {
4909
+ super.complete();
4910
+ }
4911
+ _subscribeToSubject(subscriber) {
4912
+ this._buffer.forEach((value) => subscriber.next(value));
4913
+ if (this._isStopped) {
4914
+ if (this._hasError) {
4915
+ subscriber.error(this._error);
4916
+ } else {
4917
+ subscriber.complete();
4918
+ }
4919
+ return Subscription.EMPTY;
4920
+ }
4921
+ return super._subscribeToSubject(subscriber);
4922
+ }
4923
+ };
4924
+
4792
4925
  // ../core/dist/esm/message/AutoCloseSubscription.js
4793
4926
  var AutoCloseSubscription = class extends Subscription {
4794
4927
  constructor(userUnsubscribe) {
@@ -4796,6 +4929,19 @@ var AutoCloseSubscription = class extends Subscription {
4796
4929
  }
4797
4930
  };
4798
4931
 
4932
+ // ../core/dist/esm/message/index.js
4933
+ var debounceTimeIntervalLock = (unlockChecker, unlocked, intervalTime, config) => {
4934
+ const clearIntervalFn = config?.clearInterval || clearInterval;
4935
+ const setIntervalFn = config?.setInterval || setInterval;
4936
+ const nextIntervalId = setIntervalFn(() => {
4937
+ if (unlockChecker()) {
4938
+ clearIntervalFn(nextIntervalId);
4939
+ unlocked();
4940
+ }
4941
+ }, intervalTime);
4942
+ return nextIntervalId;
4943
+ };
4944
+
4799
4945
  // ../core/dist/esm/promise/AbortablePromise.js
4800
4946
  var AbortablePromise = class _AbortablePromise {
4801
4947
  constructor(executor, signal) {
@@ -5123,6 +5269,284 @@ var Promises;
5123
5269
  })(Result = Promises2.Result || (Promises2.Result = {}));
5124
5270
  })(Promises || (Promises = {}));
5125
5271
 
5272
+ // ../core/dist/esm/fetch/Fetcher.js
5273
+ var Fetcher = class {
5274
+ createPipe(config) {
5275
+ return {};
5276
+ }
5277
+ fetch(config) {
5278
+ return new Promise((resolve, reject) => {
5279
+ const pipe = this.createPipe(config);
5280
+ Promise.resolve().then(() => {
5281
+ this.before(config, pipe);
5282
+ config?.before?.();
5283
+ }).then(() => {
5284
+ return this.execute(config);
5285
+ }).then((data) => {
5286
+ const hasError = config.config?.hasErrorChecker?.(data);
5287
+ if (hasError) {
5288
+ throw hasError;
5289
+ }
5290
+ pipe.responseData = data;
5291
+ this.afterSuccess(config, pipe);
5292
+ config?.afterSuccess?.();
5293
+ const gdata = config?.transform ? config.transform(data) : data;
5294
+ this.afterSuccessTransform(config, pipe);
5295
+ resolve(gdata);
5296
+ }).catch(async (e) => {
5297
+ this.error(config, pipe, e);
5298
+ config?.error?.();
5299
+ if (config?.errorTransform) {
5300
+ e = await config.errorTransform(e);
5301
+ }
5302
+ e = await this.errorTransform(e);
5303
+ reject(e);
5304
+ }).finally(() => {
5305
+ this.finally(config, pipe);
5306
+ config?.finally?.();
5307
+ });
5308
+ });
5309
+ }
5310
+ };
5311
+
5312
+ // ../core/dist/esm/fetch/HttpFetcher.js
5313
+ var HttpResponseError = class extends Error {
5314
+ };
5315
+ var HttpFetcher = class extends Fetcher {
5316
+ get(config) {
5317
+ config.config ?? (config.config = {});
5318
+ config.config.fetch = config.config?.fetch ?? {};
5319
+ config.config.fetch.method = "GET";
5320
+ return this.fetch(config);
5321
+ }
5322
+ post(config) {
5323
+ config.config ?? (config.config = {});
5324
+ config.config.fetch = config.config?.fetch ?? {};
5325
+ config.config.fetch.method = "POST";
5326
+ return this.fetch(config);
5327
+ }
5328
+ patch(config) {
5329
+ config.config ?? (config.config = {});
5330
+ config.config.fetch = config.config?.fetch ?? {};
5331
+ config.config.fetch.method = "PATCH";
5332
+ return this.fetch(config);
5333
+ }
5334
+ put(config) {
5335
+ config.config ?? (config.config = {});
5336
+ config.config.fetch = config.config?.fetch ?? {};
5337
+ config.config.fetch.method = "PUT";
5338
+ return this.fetch(config);
5339
+ }
5340
+ head(config) {
5341
+ config.config ?? (config.config = {});
5342
+ config.config.fetch = config.config?.fetch ?? {};
5343
+ config.config.fetch.method = "HEAD";
5344
+ return this.fetch(config);
5345
+ }
5346
+ delete(config) {
5347
+ config.config ?? (config.config = {});
5348
+ config.config.fetch = config.config?.fetch ?? {};
5349
+ config.config.fetch.method = "DELETE";
5350
+ return this.fetch(config);
5351
+ }
5352
+ async beforeProxyFetch(config) {
5353
+ return config;
5354
+ }
5355
+ async afterProxyFetch(config) {
5356
+ return config.response;
5357
+ }
5358
+ afterSuccess(config, pipe) {
5359
+ }
5360
+ afterSuccessTransform(config, pipe) {
5361
+ }
5362
+ before(config, pipe) {
5363
+ }
5364
+ error(config, pipe, e) {
5365
+ }
5366
+ finally(config, pipe) {
5367
+ }
5368
+ beforeFetch(fetch2) {
5369
+ }
5370
+ afterFetch(fetch2, response) {
5371
+ }
5372
+ // protected async errorTransform(e: any): Promise<HttpResponseError<any>> {
5373
+ async errorTransform(e) {
5374
+ const httpResponseError = new HttpResponseError();
5375
+ httpResponseError.error = e;
5376
+ if (e instanceof Response) {
5377
+ httpResponseError.response = e;
5378
+ try {
5379
+ httpResponseError.body = await e.clone().text();
5380
+ httpResponseError.message = e.statusText;
5381
+ } catch (e2) {
5382
+ httpResponseError.body = e2;
5383
+ httpResponseError.message = e2.message;
5384
+ }
5385
+ } else {
5386
+ httpResponseError.body = e;
5387
+ httpResponseError.message = e.message;
5388
+ }
5389
+ return httpResponseError;
5390
+ }
5391
+ async execute(fetcherRequest) {
5392
+ let target = fetcherRequest.target;
5393
+ let config = fetcherRequest.config;
5394
+ if (!(target instanceof URL) && typeof target !== "string") {
5395
+ const searchParams = ConvertUtils.toURLSearchParams(target.searchParams ?? {});
5396
+ try {
5397
+ const url = typeof target.url === "string" ? new URL(target.url) : target.url;
5398
+ searchParams.forEach((value, key) => {
5399
+ url.searchParams.append(key, value);
5400
+ });
5401
+ target = url;
5402
+ } catch (e) {
5403
+ if (typeof target.url === "string") {
5404
+ const searchParamString = searchParams.toString();
5405
+ target = target.url + (searchParamString ? "?" + searchParamString : "");
5406
+ } else {
5407
+ target = "";
5408
+ }
5409
+ }
5410
+ }
5411
+ const beforeProxyData = { requestInfo: target, init: config?.fetch };
5412
+ let beforeData = config?.beforeProxyFetch ? await config?.beforeProxyFetch(config) : beforeProxyData.requestInfo;
5413
+ beforeData = config?.skipGlobalBeforeProxyFetch ? beforeProxyData : await this.beforeProxyFetch(beforeProxyData);
5414
+ target = beforeData.requestInfo;
5415
+ if (beforeData.init) {
5416
+ config ?? (config = {});
5417
+ config.fetch = beforeData.init;
5418
+ }
5419
+ let abortedTimeout;
5420
+ if (config?.fetch && "timeout" in config.fetch) {
5421
+ const abortController = new AbortController();
5422
+ abortedTimeout = setTimeout(() => {
5423
+ if (config?.fetch?.signal) {
5424
+ const inputSignal = config.fetch.signal;
5425
+ const listener = () => {
5426
+ if (!abortController.signal.aborted) {
5427
+ abortController.abort();
5428
+ }
5429
+ inputSignal.removeEventListener("abort", listener);
5430
+ };
5431
+ inputSignal.addEventListener("abort", listener);
5432
+ }
5433
+ if (!abortController.signal.aborted) {
5434
+ abortController.abort();
5435
+ }
5436
+ }, config.fetch.timeout);
5437
+ config.fetch.signal = abortController.signal;
5438
+ }
5439
+ this.beforeFetch({ target, requestInit: config?.fetch });
5440
+ return (config.fetcher ?? fetch)(target, config?.fetch).then(async (it) => {
5441
+ this.afterFetch({ target, requestInit: config?.fetch }, it);
5442
+ const afterProxyData = {
5443
+ fetch: { target, requestInit: config.fetch },
5444
+ config: beforeData,
5445
+ response: it
5446
+ };
5447
+ it = config?.afterProxyFetch ? await config.afterProxyFetch(afterProxyData) : it;
5448
+ it = config?.skipGlobalAfterProxyFetch ? it : await this.afterProxyFetch(afterProxyData);
5449
+ config?.fetchResponseAfterCallBack?.(it, config);
5450
+ if (!config?.allowedResponseNotOk && !it.ok) {
5451
+ throw it;
5452
+ }
5453
+ const data = config?.hasResponseErrorChecker?.(it, config);
5454
+ if (data) {
5455
+ throw data;
5456
+ }
5457
+ return it;
5458
+ }).finally(() => {
5459
+ if (abortedTimeout) {
5460
+ clearTimeout(abortedTimeout);
5461
+ }
5462
+ });
5463
+ }
5464
+ };
5465
+
5466
+ // ../core/dist/esm/fetch/HttpJsonFetcher.js
5467
+ var HttpJsonFetcher = class extends HttpFetcher {
5468
+ updateJsonFetchConfigAndData(config) {
5469
+ var _a, _b;
5470
+ const headers = {
5471
+ "Content-Type": "application/json",
5472
+ Accept: "application/json, text/plain, */*"
5473
+ };
5474
+ config.config ?? (config.config = {});
5475
+ (_a = config.config).fetch ?? (_a.fetch = {});
5476
+ (_b = config.config.fetch).headers ?? (_b.headers = {});
5477
+ config.config.fetch.headers = { ...headers, ...config.config.fetch?.headers };
5478
+ if (config.config?.fetch?.body && typeof config.config?.fetch?.body !== "string") {
5479
+ config.config.fetch.body = JSON.stringify(config.config.fetch.body);
5480
+ }
5481
+ return config;
5482
+ }
5483
+ get(config) {
5484
+ return super.get(config);
5485
+ }
5486
+ delete(config) {
5487
+ return super.delete(config);
5488
+ }
5489
+ post(config) {
5490
+ return super.post(config);
5491
+ }
5492
+ patch(config) {
5493
+ return super.patch(config);
5494
+ }
5495
+ put(config) {
5496
+ return super.put(config);
5497
+ }
5498
+ head(config) {
5499
+ return super.head(config);
5500
+ }
5501
+ postJson(config) {
5502
+ return super.post(this.updateJsonFetchConfigAndData(config));
5503
+ }
5504
+ patchJson(config) {
5505
+ return super.patch(this.updateJsonFetchConfigAndData(config));
5506
+ }
5507
+ putJson(config) {
5508
+ return super.put(this.updateJsonFetchConfigAndData(config));
5509
+ }
5510
+ async errorTransform(e) {
5511
+ const httpResponseError = new HttpResponseError();
5512
+ httpResponseError.error = e;
5513
+ if (e instanceof Response) {
5514
+ httpResponseError.response = e;
5515
+ try {
5516
+ httpResponseError.body = await e.clone().json();
5517
+ httpResponseError.message = e.statusText;
5518
+ } catch (parseError) {
5519
+ httpResponseError.body = parseError;
5520
+ httpResponseError.message = parseError.message;
5521
+ }
5522
+ } else {
5523
+ httpResponseError.body = e;
5524
+ httpResponseError.message = e.message;
5525
+ }
5526
+ return httpResponseError;
5527
+ }
5528
+ // protected execute(target: HttpFetcherTarget, config?: HttpJsonFetcherConfig<C, any>): Promise<any> {
5529
+ execute(fetcherRequest) {
5530
+ return super.execute(fetcherRequest).then((response) => {
5531
+ const config = fetcherRequest.config;
5532
+ const transform = config?.responseTransform ?? (config?.bypassTransform ? "response" : config?.transformText ? "text" : void 0);
5533
+ if (transform === "response") {
5534
+ return response;
5535
+ } else if (transform === "text") {
5536
+ return response?.text();
5537
+ } else if (typeof transform === "function") {
5538
+ return transform(response);
5539
+ } else {
5540
+ return response?.text().then((it) => {
5541
+ if ((it ?? "").length > 0) {
5542
+ return JSON.parse(it);
5543
+ }
5544
+ });
5545
+ }
5546
+ });
5547
+ }
5548
+ };
5549
+
5126
5550
  // ../core/dist/esm/entity/object/obj/RenderDrawObj.js
5127
5551
  var RenderDrawObj = class extends Obj {
5128
5552
  render(draw, config) {
@@ -5895,9 +6319,44 @@ var ON_AFTER_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-aft
5895
6319
  var ON_BEFORE_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-adopted");
5896
6320
  var ON_AFTER_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-adopted");
5897
6321
  var ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:on-add-event-listener");
6322
+ var ON_CONNECTED_INNER_HTML_METADATA_KEY = Symbol.for("simple-web-component:inner-html");
5898
6323
  var ON_CONNECTED_SWC_APP_METADATA_KEY = Symbol.for("simple-web-component:on-connected-swc-app");
5899
- var INNER_HTML_METADATA_KEY = Symbol.for("simple-web-component:inner-html");
6324
+ var ON_CONNECTED_COMPLETED_METADATA_KEY = Symbol.for("simple-web-component:on-completed");
5900
6325
  var ATTRIBUTE_CHANGED_WILDCARD = "*";
6326
+ function onConnectedBefore(arg1, arg2, arg3) {
6327
+ const decorator = (options, target, propertyKey) => {
6328
+ const constructor = target.constructor;
6329
+ let list = ReflectUtils.getMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, constructor);
6330
+ if (!list) {
6331
+ list = [];
6332
+ ReflectUtils.defineMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, list, constructor);
6333
+ }
6334
+ list.push({ propertyKey, options });
6335
+ };
6336
+ if (arg2) {
6337
+ return decorator({}, arg1, arg2);
6338
+ }
6339
+ return (target, propertyKey) => {
6340
+ decorator(arg1 || {}, target, propertyKey);
6341
+ };
6342
+ }
6343
+ function onConnectedAfter(arg1, arg2, arg3) {
6344
+ const decorator = (options, target, propertyKey) => {
6345
+ const constructor = target.constructor;
6346
+ let list = ReflectUtils.getMetadata(ON_AFTER_CONNECTED_METADATA_KEY, constructor);
6347
+ if (!list) {
6348
+ list = [];
6349
+ ReflectUtils.defineMetadata(ON_AFTER_CONNECTED_METADATA_KEY, list, constructor);
6350
+ }
6351
+ list.push({ propertyKey, options });
6352
+ };
6353
+ if (arg2) {
6354
+ return decorator({}, arg1, arg2);
6355
+ }
6356
+ return (target, propertyKey) => {
6357
+ decorator(arg1 || {}, target, propertyKey);
6358
+ };
6359
+ }
5901
6360
  function createLifecycleDecorator(metadataKey) {
5902
6361
  return (target, propertyKey) => {
5903
6362
  const constructor = target.constructor;
@@ -5910,8 +6369,6 @@ function createLifecycleDecorator(metadataKey) {
5910
6369
  };
5911
6370
  }
5912
6371
  var onInitialize = createLifecycleDecorator(ON_INITIALIZE_METADATA_KEY);
5913
- var onConnectedBefore = createLifecycleDecorator(ON_BEFORE_CONNECTED_METADATA_KEY);
5914
- var onConnectedAfter = createLifecycleDecorator(ON_AFTER_CONNECTED_METADATA_KEY);
5915
6372
  var onConnected = onConnectedAfter;
5916
6373
  var onDisconnectedBefore = createLifecycleDecorator(ON_BEFORE_DISCONNECTED_METADATA_KEY);
5917
6374
  var onDisconnectedAfter = createLifecycleDecorator(ON_AFTER_DISCONNECTED_METADATA_KEY);
@@ -5920,13 +6377,15 @@ var onAdoptedBefore = createLifecycleDecorator(ON_BEFORE_ADOPTED_METADATA_KEY);
5920
6377
  var onAdoptedAfter = createLifecycleDecorator(ON_AFTER_ADOPTED_METADATA_KEY);
5921
6378
  var onAdopted = onAdoptedAfter;
5922
6379
  var onAddEventListener = createLifecycleDecorator(ON_ADD_EVENT_LISTENER_METADATA_KEY);
6380
+ var onConnectedSwcApp = createLifecycleDecorator(ON_CONNECTED_SWC_APP_METADATA_KEY);
6381
+ var onConnectedCompleted = createLifecycleDecorator(ON_CONNECTED_COMPLETED_METADATA_KEY);
5923
6382
  function onConnectedInnerHtml(arg1, arg2, arg3) {
5924
6383
  const decorator = (options, target, propertyKey) => {
5925
6384
  const constructor = target.constructor;
5926
- let list = ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
6385
+ let list = ReflectUtils.getMetadata(ON_CONNECTED_INNER_HTML_METADATA_KEY, constructor);
5927
6386
  if (!list) {
5928
6387
  list = [];
5929
- ReflectUtils.defineMetadata(INNER_HTML_METADATA_KEY, list, constructor);
6388
+ ReflectUtils.defineMetadata(ON_CONNECTED_INNER_HTML_METADATA_KEY, list, constructor);
5930
6389
  }
5931
6390
  list.push({ propertyKey, options });
5932
6391
  };
@@ -5939,11 +6398,19 @@ function onConnectedInnerHtml(arg1, arg2, arg3) {
5939
6398
  }
5940
6399
  var findAllLifecycleMetadata = (target, metadataKey) => {
5941
6400
  const results = ReflectUtils.findAllMetadataFlatten(metadataKey, target);
5942
- return results.length > 0 ? results : void 0;
6401
+ return results;
5943
6402
  };
5944
6403
  var getOnConnectedInnerHtmlMetadata = (target) => {
5945
6404
  const constructor = target instanceof Function ? target : target.constructor;
5946
- return ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
6405
+ return ReflectUtils.getMetadata(ON_CONNECTED_INNER_HTML_METADATA_KEY, constructor) ?? [];
6406
+ };
6407
+ var getOnConnectedBeforeMetadata = (target) => {
6408
+ const constructor = target instanceof Function ? target : target.constructor;
6409
+ return ReflectUtils.getMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, constructor) ?? [];
6410
+ };
6411
+ var getOnConnectedAfterMetadata = (target) => {
6412
+ const constructor = target instanceof Function ? target : target.constructor;
6413
+ return ReflectUtils.getMetadata(ON_AFTER_CONNECTED_METADATA_KEY, constructor) ?? [];
5947
6414
  };
5948
6415
 
5949
6416
  // src/utils/Utils.ts
@@ -5965,14 +6432,17 @@ var commentNode = (comment, doc) => {
5965
6432
  if (!d) throw new Error("Document is not available");
5966
6433
  return d.createComment(comment !== void 0 && comment !== null ? String(comment) : "");
5967
6434
  };
5968
- var createElement = (tagName, options) => {
5969
- const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
5970
- if (!d) throw new Error("Document is not available");
5971
- const el = d.createElement(tagName);
5972
- if (options?.html) el.innerHTML = options.html;
6435
+ var createElement = (documentOrWindow, tagName2, options) => {
6436
+ const doc = "document" in documentOrWindow ? documentOrWindow.document : documentOrWindow;
6437
+ if (!doc) throw new Error("Document is not available");
6438
+ const el = doc.createElement(tagName2);
6439
+ if (options?.innerHtml) el.innerHTML = options.innerHtml;
5973
6440
  if (options?.attrs) {
5974
6441
  Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
5975
6442
  }
6443
+ if (options?.property) {
6444
+ Object.entries(options.property).forEach(([k, v]) => el[k] = v);
6445
+ }
5976
6446
  return el;
5977
6447
  };
5978
6448
  var htmlDivElement = (html, options) => {
@@ -6226,7 +6696,7 @@ var SwcUtils;
6226
6696
  $hosts,
6227
6697
  $firstHost,
6228
6698
  $lastHost: $host,
6229
- $templateHost: el.__swc_template_host,
6699
+ // $templateHost: (el as any).__swc_template_host,
6230
6700
  $appHost,
6231
6701
  $appHosts,
6232
6702
  $firstAppHost,
@@ -6905,7 +7375,22 @@ var SituationTypeContainers = class {
6905
7375
  return this.containers.find(predicate);
6906
7376
  }
6907
7377
  };
7378
+ var isTargetSymbol = (config) => {
7379
+ return "symbol" in config && config.symbol !== void 0;
7380
+ };
7381
+ var isTargetType = (config) => {
7382
+ return "type" in config && config.type !== void 0;
7383
+ };
7384
+ var isTargetScheme = (config) => {
7385
+ return "scheme" in config && config.scheme !== void 0;
7386
+ };
7387
+ var isTargetFactory = (config) => {
7388
+ return "factory" in config && typeof config.factory === "function" && !("symbol" in config) && !("type" in config) && !("scheme" in config);
7389
+ };
6908
7390
  var InjectMetadataKey = Symbol.for("simple-boot:inject-metadata");
7391
+ var getInject = (target, propertyKey) => {
7392
+ return ReflectUtils.findMetadata(InjectMetadataKey, target, propertyKey) ?? [];
7393
+ };
6909
7394
 
6910
7395
  // src/types.ts
6911
7396
  var InjectSituationType = /* @__PURE__ */ ((InjectSituationType2) => {
@@ -7177,6 +7662,379 @@ var NodeUtils;
7177
7662
  };
7178
7663
  })(NodeUtils || (NodeUtils = {}));
7179
7664
 
7665
+ // ../core-web/dist/esm/node/slot/Slot.js
7666
+ var Slot = class {
7667
+ constructor(start, end) {
7668
+ this.start = start;
7669
+ this.end = end;
7670
+ }
7671
+ // Parse mixed Node|string items into Node[] within the context of this slot's
7672
+ // document. This is a private helper that uses the slot's start comment to
7673
+ // resolve the ownerDocument. mode: 'html'|'text'|'auto'
7674
+ parseItems(items, mode = "html") {
7675
+ const out = [];
7676
+ const host = this.start;
7677
+ const doc = host && host.ownerDocument ? host.ownerDocument : typeof document !== "undefined" ? document : void 0;
7678
+ if (!doc) return out;
7679
+ for (const it of items) {
7680
+ if (typeof it === "string") {
7681
+ if (mode === "text") {
7682
+ out.push(doc.createTextNode(it));
7683
+ } else {
7684
+ const template = doc.createElement("template");
7685
+ template.innerHTML = it;
7686
+ const childNodes = Array.from(template.content.childNodes);
7687
+ out.push(...childNodes);
7688
+ }
7689
+ } else {
7690
+ out.push(it);
7691
+ }
7692
+ }
7693
+ return out;
7694
+ }
7695
+ // Return nodes between start and end (exclusive) using nextSibling traversal
7696
+ nodes() {
7697
+ const out = [];
7698
+ let cur = this.start.nextSibling;
7699
+ while (cur && cur !== this.end) {
7700
+ out.push(cur);
7701
+ cur = cur.nextSibling;
7702
+ }
7703
+ return out;
7704
+ }
7705
+ append(...items) {
7706
+ if (!items || items.length === 0) return;
7707
+ const nodesToInsert = this.parseItems(items);
7708
+ if (nodesToInsert.length === 0) return;
7709
+ const parent = this.end ? this.end.parentNode : this.start.parentNode;
7710
+ const ref = this.end || null;
7711
+ for (const n of nodesToInsert) {
7712
+ if (ref) parent.insertBefore(n, ref);
7713
+ else parent.appendChild(n);
7714
+ }
7715
+ }
7716
+ // Explicit HTML/text variants
7717
+ appendHtml(...items) {
7718
+ this.append(...items);
7719
+ }
7720
+ appendText(...items) {
7721
+ const nodesToInsert = this.parseItems(items, "text");
7722
+ if (!nodesToInsert || nodesToInsert.length === 0) return;
7723
+ this.append(...nodesToInsert);
7724
+ }
7725
+ prepend(...items) {
7726
+ if (!items || items.length === 0) return;
7727
+ const nodesToInsert = this.parseItems(items);
7728
+ if (nodesToInsert.length === 0) return;
7729
+ const parent = this.start.parentNode;
7730
+ const before = this.start.nextSibling;
7731
+ for (let i = nodesToInsert.length - 1; i >= 0; i--) {
7732
+ const n = nodesToInsert[i];
7733
+ parent.insertBefore(n, before);
7734
+ }
7735
+ }
7736
+ prependHtml(...items) {
7737
+ this.prepend(...items);
7738
+ }
7739
+ prependText(...items) {
7740
+ const nodesToInsert = this.parseItems(items, "text");
7741
+ if (!nodesToInsert || nodesToInsert.length === 0) return;
7742
+ this.prepend(...nodesToInsert);
7743
+ }
7744
+ clear() {
7745
+ let cur = this.start.nextSibling;
7746
+ while (cur && cur !== this.end) {
7747
+ const next = cur.nextSibling;
7748
+ if ("remove" in cur && typeof cur.remove === "function")
7749
+ cur.remove();
7750
+ cur = next;
7751
+ }
7752
+ }
7753
+ // Replace all children between start and end with provided items.
7754
+ // Items can be Node or string (HTML/text). Uses parseItems to create
7755
+ // insertion nodes and then appends them (after clearing existing children).
7756
+ replaceChildren(...items) {
7757
+ this.clear();
7758
+ if (!items || items.length === 0) return;
7759
+ const nodesToInsert = this.parseItems(items);
7760
+ if (!nodesToInsert || nodesToInsert.length === 0) return;
7761
+ this.append(...nodesToInsert);
7762
+ }
7763
+ /**
7764
+ * Explicit HTML variant of replaceChildren — alias for replaceChildren
7765
+ * to make intent clear.
7766
+ */
7767
+ replaceChildrenHtml(...items) {
7768
+ this.replaceChildren(...items);
7769
+ }
7770
+ /**
7771
+ * Explicit text variant of replaceChildren — parses strings as text nodes
7772
+ * and replaces the children with those text nodes.
7773
+ */
7774
+ replaceChildrenText(...items) {
7775
+ this.clear();
7776
+ if (!items || items.length === 0) return;
7777
+ const nodesToInsert = this.parseItems(items, "text");
7778
+ if (!nodesToInsert || nodesToInsert.length === 0) return;
7779
+ this.append(...nodesToInsert);
7780
+ }
7781
+ findAll(predicate) {
7782
+ if (!predicate) return this.nodes();
7783
+ return this.nodes().filter(predicate);
7784
+ }
7785
+ querySelector(selector) {
7786
+ if (!selector) return null;
7787
+ for (const n of this.nodes()) {
7788
+ if (n.nodeType === Node.ELEMENT_NODE) {
7789
+ const el = n;
7790
+ if (el.matches && el.matches(selector)) return el;
7791
+ const found = el.querySelector(selector);
7792
+ if (found) return found;
7793
+ }
7794
+ }
7795
+ return null;
7796
+ }
7797
+ querySelectorAll(selector) {
7798
+ if (!selector) return [];
7799
+ const out = [];
7800
+ for (const n of this.nodes()) {
7801
+ if (n.nodeType === Node.ELEMENT_NODE) {
7802
+ const el = n;
7803
+ if (el.matches && el.matches(selector)) out.push(el);
7804
+ const found = el.querySelectorAll(selector);
7805
+ if (found && found.length) out.push(...Array.from(found));
7806
+ }
7807
+ }
7808
+ return out;
7809
+ }
7810
+ /**
7811
+ * Append clones of provided items into this slot.
7812
+ * Strings will be parsed and resulting nodes cloned; Node items will be cloned.
7813
+ */
7814
+ appendCopy(...items) {
7815
+ const parsed = this.parseItems(items);
7816
+ if (!parsed || parsed.length === 0) return;
7817
+ const clones = parsed.map((n) => n.cloneNode(true));
7818
+ if (clones.length === 0) return;
7819
+ this.append(...clones);
7820
+ }
7821
+ /**
7822
+ * Prepend clones of provided items into this slot.
7823
+ */
7824
+ prependCopy(...items) {
7825
+ const parsed = this.parseItems(items);
7826
+ if (!parsed || parsed.length === 0) return;
7827
+ const clones = parsed.map((n) => n.cloneNode(true));
7828
+ if (clones.length === 0) return;
7829
+ this.prepend(...clones);
7830
+ }
7831
+ };
7832
+
7833
+ // ../core-web/dist/esm/node/slot/NodeSlot.js
7834
+ var NodeSlot = class _NodeSlot {
7835
+ constructor(host, id) {
7836
+ if (!host) throw new Error("host node is required");
7837
+ if (!id) throw new Error("id is required");
7838
+ this.host = host;
7839
+ this.id = id;
7840
+ const markerData = _NodeSlot.startEndMarkerData(id);
7841
+ this.startMarkerData = markerData.start;
7842
+ this.endMarkerData = markerData.end;
7843
+ }
7844
+ static startEndMarkerData(id) {
7845
+ return {
7846
+ start: `__slot_start__:${id}`,
7847
+ end: `__slot_end__:${id}`
7848
+ };
7849
+ }
7850
+ static slot(id) {
7851
+ const uid = RandomUtils.uuid();
7852
+ const markerData = _NodeSlot.startEndMarkerData(id);
7853
+ const start = `<!--${markerData.start}:${uid}-->`;
7854
+ const end = `<!--${markerData.end}:${uid}-->`;
7855
+ return `${start}${end}`;
7856
+ }
7857
+ /**
7858
+ * Return HTML comment string pair for embedding into templates.
7859
+ * Example: host.innerHTML = `<div>...${nodeSlot}...</div>`
7860
+ */
7861
+ get slot() {
7862
+ return _NodeSlot.slot(this.id);
7863
+ }
7864
+ // startCommentString and endCommentString getters removed — use slot() which
7865
+ // generates the full start/end comment pair including a unique uid per
7866
+ // insertion to ensure correct pairing when multiple slots with the same id
7867
+ // are inserted into the DOM.
7868
+ // toString removed intentionally to avoid accidental implicit string coercion.
7869
+ // Note: Symbol.toPrimitive removed to avoid custom primitive coercion logic.
7870
+ // valueOf and Symbol.toStringTag removed — prefer explicit use of slot getter/string conversion.
7871
+ findSlots() {
7872
+ const result = [];
7873
+ const doc = this.host.ownerDocument || (typeof document !== "undefined" ? document : void 0);
7874
+ const win = doc?.defaultView;
7875
+ if (!doc || !win) return result;
7876
+ const find = (target) => {
7877
+ const walker = doc.createTreeWalker(target, win.NodeFilter.SHOW_COMMENT, null, false);
7878
+ let node = walker.nextNode();
7879
+ const startPrefix = this.startMarkerData + ":";
7880
+ while (node) {
7881
+ const data = node.data;
7882
+ if (data && data.indexOf(startPrefix) === 0) {
7883
+ const uid = data.substring(startPrefix.length);
7884
+ const expectedEnd = `${this.endMarkerData}:${uid}`;
7885
+ let sibling = node.nextSibling;
7886
+ let foundEnd = null;
7887
+ while (sibling) {
7888
+ if (sibling.nodeType === win.Node.COMMENT_NODE && sibling.data === expectedEnd && sibling.parentNode === node.parentNode) {
7889
+ foundEnd = sibling;
7890
+ break;
7891
+ }
7892
+ sibling = sibling.nextSibling;
7893
+ }
7894
+ result.push(new Slot(node, foundEnd));
7895
+ }
7896
+ node = walker.nextNode();
7897
+ }
7898
+ };
7899
+ if (this.host.shadowRoot) {
7900
+ find(this.host.shadowRoot);
7901
+ }
7902
+ find(this.host);
7903
+ return result;
7904
+ }
7905
+ /**
7906
+ * Return an array of node arrays — for each found slot pair (via findSlots())
7907
+ * returns the nodes between its start and end (exclusive). Uses sibling
7908
+ * traversal (nextSibling) because findSlots pairs only same-parent markers.
7909
+ */
7910
+ nodes() {
7911
+ const slots = this.findSlots();
7912
+ return slots.map((s) => s.nodes());
7913
+ }
7914
+ append(...items) {
7915
+ if (!items || items.length === 0) return;
7916
+ const slots = this.findSlots();
7917
+ if (!slots || slots.length === 0) return;
7918
+ for (const s of slots) {
7919
+ s.append(...items);
7920
+ }
7921
+ }
7922
+ appendHtml(...items) {
7923
+ const slots = this.findSlots();
7924
+ for (const s of slots) s.appendHtml(...items);
7925
+ }
7926
+ appendText(...items) {
7927
+ const slots = this.findSlots();
7928
+ for (const s of slots) s.appendText(...items);
7929
+ }
7930
+ /**
7931
+ * Append copies of the provided items into each found slot.
7932
+ */
7933
+ appendCopy(...items) {
7934
+ if (!items || items.length === 0) return;
7935
+ const slots = this.findSlots();
7936
+ if (!slots || slots.length === 0) return;
7937
+ for (const s of slots) {
7938
+ s.appendCopy(...items);
7939
+ }
7940
+ }
7941
+ prepend(...items) {
7942
+ if (!items || items.length === 0) return;
7943
+ const slots = this.findSlots();
7944
+ if (!slots || slots.length === 0) return;
7945
+ for (const s of slots) {
7946
+ s.prepend(...items);
7947
+ }
7948
+ }
7949
+ prependHtml(...items) {
7950
+ const slots = this.findSlots();
7951
+ for (const s of slots) s.prependHtml(...items);
7952
+ }
7953
+ prependText(...items) {
7954
+ const slots = this.findSlots();
7955
+ for (const s of slots) s.prependText(...items);
7956
+ }
7957
+ /**
7958
+ * Prepend copies of the provided items into each found slot.
7959
+ */
7960
+ prependCopy(...items) {
7961
+ if (!items || items.length === 0) return;
7962
+ const slots = this.findSlots();
7963
+ if (!slots || slots.length === 0) return;
7964
+ for (const s of slots) {
7965
+ s.prependCopy(...items);
7966
+ }
7967
+ }
7968
+ clear() {
7969
+ const slots = this.findSlots();
7970
+ for (const s of slots) {
7971
+ s.clear();
7972
+ }
7973
+ }
7974
+ /**
7975
+ * Replace children inside each found slot with the provided items.
7976
+ * Items can be Node or string (HTML).
7977
+ */
7978
+ replaceChildren(...items) {
7979
+ const slots = this.findSlots();
7980
+ if (!slots || slots.length === 0) return;
7981
+ for (const s of slots) {
7982
+ s.replaceChildren(...items);
7983
+ }
7984
+ }
7985
+ replaceChildrenHtml(...items) {
7986
+ const slots = this.findSlots();
7987
+ if (!slots || slots.length === 0) return;
7988
+ for (const s of slots) {
7989
+ s.replaceChildrenHtml(...items);
7990
+ }
7991
+ }
7992
+ replaceChildrenText(...items) {
7993
+ const slots = this.findSlots();
7994
+ if (!slots || slots.length === 0) return;
7995
+ for (const s of slots) {
7996
+ s.replaceChildrenText(...items);
7997
+ }
7998
+ }
7999
+ findAll(predicate) {
8000
+ const groups = this.nodes();
8001
+ const flat = groups.reduce((acc, cur) => acc.concat(cur), []);
8002
+ if (!predicate) return flat;
8003
+ return flat.filter(predicate);
8004
+ }
8005
+ querySelector(selector) {
8006
+ if (!selector) return null;
8007
+ const groups = this.nodes();
8008
+ for (const nodes of groups) {
8009
+ for (const n of nodes) {
8010
+ if (n.nodeType === Node.ELEMENT_NODE) {
8011
+ const el = n;
8012
+ if (el.matches && el.matches(selector)) return el;
8013
+ const found = el.querySelector(selector);
8014
+ if (found) return found;
8015
+ }
8016
+ }
8017
+ }
8018
+ return null;
8019
+ }
8020
+ querySelectorAll(selector) {
8021
+ if (!selector) return [];
8022
+ const out = [];
8023
+ const groups = this.nodes();
8024
+ for (const nodes of groups) {
8025
+ for (const n of nodes) {
8026
+ if (n.nodeType === Node.ELEMENT_NODE) {
8027
+ const el = n;
8028
+ if (el.matches && el.matches(selector)) out.push(el);
8029
+ const found = el.querySelectorAll(selector);
8030
+ if (found && found.length) out.push(...Array.from(found));
8031
+ }
8032
+ }
8033
+ }
8034
+ return out;
8035
+ }
8036
+ };
8037
+
7180
8038
  // ../core-web/dist/esm/document/DocumentUtils.js
7181
8039
  var DocumentUtils;
7182
8040
  ((DocumentUtils2) => {
@@ -7571,8 +8429,360 @@ var LocationUtils;
7571
8429
  };
7572
8430
  })(LocationUtils || (LocationUtils = {}));
7573
8431
 
7574
- // ../core-web/dist/esm/stylecss/StyleCssUtils.js
7575
- var StyleCssUtils;
8432
+ // ../core-web/dist/esm/routers/Router.js
8433
+ var ROUTER_NO_EVENT_MARKER = "__ROUTER_NO_EVENT__";
8434
+ var Router = class {
8435
+ constructor(config) {
8436
+ this._config = config;
8437
+ let routeData;
8438
+ if (config?.firstUrl) {
8439
+ const path = config.firstUrl.split("?");
8440
+ const urlSearchParams = new URLSearchParams(path[1] ?? "");
8441
+ routeData = {
8442
+ url: config.firstUrl,
8443
+ path: path[0],
8444
+ searchParams: urlSearchParams,
8445
+ router: this,
8446
+ search: urlSearchParams.size > 0 ? `?${urlSearchParams.toString()}` : "",
8447
+ triggerPoint: "first-end"
8448
+ };
8449
+ this.behaviorSubject = new BehaviorSubject(routeData);
8450
+ this.go(config.firstUrl);
8451
+ } else {
8452
+ routeData = { ...this.getRouteData(), triggerPoint: "first-end" };
8453
+ this.behaviorSubject = new BehaviorSubject(routeData);
8454
+ }
8455
+ this.config.window.addEventListener("popstate", (event) => {
8456
+ const routeData2 = { ...this.getRouteData(), triggerPoint: "end" };
8457
+ this.behaviorSubject.next(routeData2);
8458
+ });
8459
+ }
8460
+ get value() {
8461
+ return this.behaviorSubject.getValue();
8462
+ }
8463
+ get observable() {
8464
+ return this.behaviorSubject.asObservable();
8465
+ }
8466
+ get searchParamObject() {
8467
+ return ConvertUtils.toObject(this.getSearchParams());
8468
+ }
8469
+ getSearchParamObject() {
8470
+ return this.searchParamObject;
8471
+ }
8472
+ get config() {
8473
+ return this._config;
8474
+ }
8475
+ getSearchFirstParamsObject(defaultValue) {
8476
+ const a = ConvertUtils.toObject(this.getSearchParams(), { firstValue: true });
8477
+ return Object.assign({}, defaultValue, a);
8478
+ }
8479
+ getHashSearchFirstParamsObject() {
8480
+ return ConvertUtils.toObject(this.getHashSearchParams(), { firstValue: true });
8481
+ }
8482
+ // async attach(): Promise<void> {
8483
+ // // const proxy = getDomRenderProxy(this.config.rootObject)
8484
+ // // if (proxy) {
8485
+ // // const key = `___${EventManager.ROUTER_VARNAME}`;
8486
+ // // await proxy.render(key);
8487
+ // // }
8488
+ // }
8489
+ testRegexp(regexp) {
8490
+ if (regexp) {
8491
+ const b = RegExp(regexp).test(this.getPathName());
8492
+ return b;
8493
+ } else {
8494
+ return false;
8495
+ }
8496
+ }
8497
+ test(urlExpression) {
8498
+ if (urlExpression && this.getPathData(urlExpression)) {
8499
+ return true;
8500
+ } else {
8501
+ return false;
8502
+ }
8503
+ }
8504
+ getRouteData(config) {
8505
+ let path = this.getPathName();
8506
+ let url = this.getUrl();
8507
+ let searchParams = this.getSearchParams();
8508
+ let search = this.getSearch();
8509
+ if (config?.pathOrUrl) {
8510
+ const paths = config.pathOrUrl.split("?");
8511
+ search = paths[1] ? `?${paths[1]}` : "";
8512
+ searchParams = new URLSearchParams(search);
8513
+ const firstUrl = paths[0];
8514
+ if (ValidUtils.isUrl(firstUrl)) {
8515
+ path = new URL(firstUrl).pathname;
8516
+ } else {
8517
+ path = firstUrl;
8518
+ }
8519
+ url = config.pathOrUrl;
8520
+ }
8521
+ const newVar = {
8522
+ path,
8523
+ url,
8524
+ searchParams,
8525
+ // 이렇게 하면 진짜 문자열이 변형이 될수 있다 따라서 그냥 문자열 자른 원본을넣어줘야한다
8526
+ // search: searchParams.size > 0 ? `?${searchParams.toString()}` : '',
8527
+ search,
8528
+ router: this
8529
+ };
8530
+ const data = this.getData();
8531
+ if (data) {
8532
+ newVar.data = data;
8533
+ }
8534
+ if (config?.urlExpression) {
8535
+ const data2 = this.getPathData(config.urlExpression);
8536
+ if (data2) {
8537
+ newVar.pathData = data2;
8538
+ }
8539
+ }
8540
+ return Object.freeze(newVar);
8541
+ }
8542
+ pushState(data, title, path, config) {
8543
+ const stateData = config?.noEventAndPublish ? { ...data, [ROUTER_NO_EVENT_MARKER]: true } : data;
8544
+ if (!config?.noEventAndPublish) {
8545
+ this.behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: "start" });
8546
+ }
8547
+ this.config.window.history?.pushState(stateData, title ?? "", path);
8548
+ if (!config?.noEventAndPublish) {
8549
+ this.behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: "end" });
8550
+ }
8551
+ return { data: stateData };
8552
+ }
8553
+ replaceState(data, title, path, config) {
8554
+ const stateData = config?.noEventAndPublish ? { ...data, [ROUTER_NO_EVENT_MARKER]: true } : data;
8555
+ if (!config?.noEventAndPublish) {
8556
+ this.behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: "start" });
8557
+ }
8558
+ this.config.window.history?.replaceState(stateData, title ?? "", path);
8559
+ if (!config?.noEventAndPublish) {
8560
+ this.behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: "end" });
8561
+ }
8562
+ return { data: stateData };
8563
+ }
8564
+ getData() {
8565
+ return this.config.window.history?.state;
8566
+ }
8567
+ getPathData(urlExpression, currentUrl = this.getPathName()) {
8568
+ return Expression.Path.pathNameData(currentUrl, urlExpression);
8569
+ }
8570
+ back(config) {
8571
+ if (!config?.noEventAndPublish) {
8572
+ this.behaviorSubject.next({ ...this.getRouteData(), triggerPoint: "start" });
8573
+ }
8574
+ this.config.window.history.back();
8575
+ }
8576
+ forward(config) {
8577
+ if (!config?.noEventAndPublish) {
8578
+ this.behaviorSubject.next({ ...this.getRouteData(), triggerPoint: "start" });
8579
+ }
8580
+ this.config.window.history?.forward();
8581
+ }
8582
+ go(config, changeStateConfig) {
8583
+ if (typeof config === "number") {
8584
+ if (!changeStateConfig?.noEventAndPublish) {
8585
+ this.behaviorSubject.next({ ...this.getRouteData(), triggerPoint: "start" });
8586
+ }
8587
+ this.config.window.history?.go(config);
8588
+ return;
8589
+ }
8590
+ if (typeof config === "string") {
8591
+ config = { path: config };
8592
+ }
8593
+ if (config?.replace) {
8594
+ this.replace(config.path, config.state);
8595
+ } else {
8596
+ this.push(config.path, config.state);
8597
+ }
8598
+ if (config.scrollToTop !== false) {
8599
+ try {
8600
+ this._config.window?.scrollTo?.(0, 0);
8601
+ } catch (e) {
8602
+ }
8603
+ }
8604
+ }
8605
+ toUrl(data) {
8606
+ let targetPath;
8607
+ if (typeof data === "string") {
8608
+ targetPath = data;
8609
+ } else {
8610
+ const tpath = data.path ?? this.getPathName();
8611
+ const s = data.searchParams ? ConvertUtils.toRawQueryString(data.searchParams, { valueEncodeURIComponent: true }) : "";
8612
+ targetPath = `${tpath}${s.length > 0 ? "?" : ""}${s}`;
8613
+ }
8614
+ return targetPath;
8615
+ }
8616
+ reload() {
8617
+ const currentUrl = this.getUrl();
8618
+ this.replace(currentUrl);
8619
+ }
8620
+ };
8621
+
8622
+ // ../core-web/dist/esm/routers/HashRouter.js
8623
+ var HashRouter = class extends Router {
8624
+ constructor(config) {
8625
+ super(config);
8626
+ }
8627
+ getSearchParams(data) {
8628
+ const hashSearch = LocationUtils.hashSearch(this.config.window);
8629
+ const searchParams = hashSearch ? new URLSearchParams(hashSearch) : new URL(this.config.window.document.location.href).searchParams;
8630
+ return UrlUtils.manipulateSearchParams(searchParams, data);
8631
+ }
8632
+ push(path, state) {
8633
+ if (path === "/") {
8634
+ return super.pushState(state?.data, state?.title, "/", state?.config);
8635
+ } else {
8636
+ return super.pushState(state?.data, state?.title, `#${this.toUrl(path)}`, state?.config);
8637
+ }
8638
+ }
8639
+ replace(path, state) {
8640
+ if (path === "/") {
8641
+ return super.replaceState(state?.data, state?.title, "/", state?.config);
8642
+ } else {
8643
+ return super.replaceState(state?.data, state?.title, `#${this.toUrl(path)}`, state?.config);
8644
+ }
8645
+ }
8646
+ setDeleteHashSearchParam(name, state) {
8647
+ }
8648
+ pushDeleteHashSearchParam(name, state) {
8649
+ const s = this.getHashSearchParams({ delete: Array.isArray(name) ? name : [name] });
8650
+ const size = Array.from(s.entries()).length;
8651
+ const href = `${this.config.window.location.pathname}${this.config.window.location.search}${size > 0 ? "#" + s.toString() : ""}`;
8652
+ super.pushState(state?.data, state?.title, href, state?.config);
8653
+ }
8654
+ pushDeleteSearchParam(name, state) {
8655
+ const s = this.getSearchParams({ delete: Array.isArray(name) ? name : [name] });
8656
+ this.push({ searchParams: s }, state);
8657
+ }
8658
+ pushAddSearchParam(params, state) {
8659
+ const s = this.getSearchParams({ append: params });
8660
+ this.push({ searchParams: s }, state);
8661
+ }
8662
+ pushUpsertSearchParam(params, state) {
8663
+ const s = this.getSearchParams();
8664
+ UrlUtils.upsertSearchParam(s, params);
8665
+ this.push({ searchParams: s }, state);
8666
+ }
8667
+ replaceDeleteHashSearchParam(name, state) {
8668
+ const s = this.getHashSearchParams({ delete: Array.isArray(name) ? name : [name] });
8669
+ const size = Array.from(s.entries()).length;
8670
+ const href = `${this.config.window.location.pathname}${this.config.window.location.search}${size > 0 ? "#" + s.toString() : ""}`;
8671
+ super.pushState(state?.data, state?.title, href, state?.config);
8672
+ }
8673
+ replaceDeleteSearchParam(name, state) {
8674
+ const s = this.getSearchParams({ delete: Array.isArray(name) ? name : [name] });
8675
+ this.push({ searchParams: s }, state);
8676
+ }
8677
+ replaceAddSearchParam(params, state) {
8678
+ const s = this.getSearchParams({ append: params });
8679
+ this.push({ searchParams: s }, state);
8680
+ }
8681
+ replaceUpsertSearchParam(params, state) {
8682
+ const s = this.getSearchParams();
8683
+ UrlUtils.upsertSearchParam(s, params);
8684
+ this.replace({ searchParams: s }, state);
8685
+ }
8686
+ getUrl() {
8687
+ return LocationUtils.hash(this.config.window) || "/";
8688
+ }
8689
+ getHref() {
8690
+ return this.config.window.location.href;
8691
+ }
8692
+ getPathName() {
8693
+ return LocationUtils.hashPath(this.config.window) || "/";
8694
+ }
8695
+ getSearch() {
8696
+ return LocationUtils.hashSearch(this.config.window);
8697
+ }
8698
+ getHashSearchParams(data) {
8699
+ const hash = this.config.window.location.hash;
8700
+ const queryIndex = hash.indexOf("?");
8701
+ const searchParams = queryIndex !== -1 ? new URLSearchParams(hash.slice(queryIndex + 1)) : new URLSearchParams();
8702
+ return UrlUtils.manipulateSearchParams(searchParams, data);
8703
+ }
8704
+ };
8705
+
8706
+ // ../core-web/dist/esm/routers/PathRouter.js
8707
+ var PathRouter = class extends Router {
8708
+ constructor(config) {
8709
+ super(config);
8710
+ }
8711
+ getSearchParams(data) {
8712
+ if (!this.config.window.document?.location?.href) {
8713
+ return new URLSearchParams();
8714
+ }
8715
+ const searchParams = new URL(this.config.window.document.location?.href).searchParams;
8716
+ return UrlUtils.manipulateSearchParams(searchParams, data);
8717
+ }
8718
+ push(path, state) {
8719
+ return super.pushState(state?.data, state?.title, this.toUrl(path), state?.config);
8720
+ }
8721
+ replace(path, state) {
8722
+ return super.replaceState(state?.data, state?.title, this.toUrl(path), state?.config);
8723
+ }
8724
+ pushDeleteSearchParam(name, state) {
8725
+ const s = this.getSearchParams({ delete: Array.isArray(name) ? name : [name] });
8726
+ this.push({ searchParams: s }, state);
8727
+ }
8728
+ pushDeleteHashSearchParam(name, state) {
8729
+ const s = this.getHashSearchParams({ delete: Array.isArray(name) ? name : [name] });
8730
+ const size = Array.from(s.entries()).length;
8731
+ const href = `${this.config.window.location?.pathname ?? "/"}${this.config.window.location?.search}${size > 0 ? "#" + s.toString() : ""}`;
8732
+ super.pushState(state?.data, state?.title, href, state?.config);
8733
+ }
8734
+ pushAddSearchParam(params, state) {
8735
+ const s = this.getSearchParams({ append: params });
8736
+ this.push({ searchParams: s }, state);
8737
+ }
8738
+ pushUpsertSearchParam(params, state) {
8739
+ const s = this.getSearchParams();
8740
+ UrlUtils.upsertSearchParam(s, params);
8741
+ this.push({ searchParams: s }, state);
8742
+ }
8743
+ replaceDeleteSearchParam(name, state) {
8744
+ const s = this.getSearchParams({ delete: Array.isArray(name) ? name : [name] });
8745
+ this.replace({ searchParams: s }, state);
8746
+ }
8747
+ replaceDeleteHashSearchParam(name, state) {
8748
+ const s = this.getHashSearchParams({ delete: Array.isArray(name) ? name : [name] });
8749
+ const size = Array.from(s.entries()).length;
8750
+ const href = `${this.config.window.location?.pathname ?? "/"}${this.config.window.location?.search}${size > 0 ? "#" + s.toString() : ""}`;
8751
+ super.replaceState(state?.data, state?.title, href, state?.config);
8752
+ }
8753
+ replaceAddSearchParam(params, state) {
8754
+ const s = this.getSearchParams({ append: params });
8755
+ this.replace({ searchParams: s }, state);
8756
+ }
8757
+ replaceUpsertSearchParam(params, state) {
8758
+ const s = this.getSearchParams();
8759
+ UrlUtils.upsertSearchParam(s, params);
8760
+ this.replace({ searchParams: s }, state);
8761
+ }
8762
+ getUrl() {
8763
+ if (!this.config.window.document?.location?.href) {
8764
+ return "/";
8765
+ }
8766
+ const url = new URL(this.config.window.document.location?.href);
8767
+ return url.pathname + url.search;
8768
+ }
8769
+ getHref() {
8770
+ return this.config.window.location?.href ?? "/";
8771
+ }
8772
+ getPathName() {
8773
+ return this.config.window.location?.pathname ?? "/";
8774
+ }
8775
+ getSearch() {
8776
+ return this.config.window.location?.search ?? "";
8777
+ }
8778
+ getHashSearchParams(data) {
8779
+ const searchParams = new URLSearchParams(this.config.window.location?.hash.slice(1) ?? "");
8780
+ return UrlUtils.manipulateSearchParams(searchParams, data);
8781
+ }
8782
+ };
8783
+
8784
+ // ../core-web/dist/esm/stylecss/StyleCssUtils.js
8785
+ var StyleCssUtils;
7576
8786
  ((StyleCssUtils2) => {
7577
8787
  StyleCssUtils2.getPropertyValue = (valueName, config) => {
7578
8788
  return config.window.getComputedStyle(config.el).getPropertyValue(valueName);
@@ -7689,6 +8899,91 @@ var ValidUtils2;
7689
8899
  };
7690
8900
  })(ValidUtils2 || (ValidUtils2 = {}));
7691
8901
 
8902
+ // src/decorators/applySlot.ts
8903
+ var APPLY_SLOT_METADATA_KEY = Symbol.for("simple-web-component:apply-slot");
8904
+ function applySlot(id, options = { position: "replaceChildrenHtml" }) {
8905
+ return (targetObj, propertyKey, descriptor) => {
8906
+ const type = descriptor === void 0 ? "property" : "method";
8907
+ if (type === "property") {
8908
+ Object.defineProperty(targetObj, propertyKey, {
8909
+ get() {
8910
+ const nodeSlot = new NodeSlot(this, `${this._swcId}-${id}`);
8911
+ return nodeSlot;
8912
+ },
8913
+ configurable: true,
8914
+ enumerable: true
8915
+ });
8916
+ }
8917
+ const constructor = targetObj.constructor;
8918
+ let metaList = ReflectUtils.getOwnMetadata(APPLY_SLOT_METADATA_KEY, constructor);
8919
+ if (!metaList) {
8920
+ metaList = [];
8921
+ ReflectUtils.defineMetadata(APPLY_SLOT_METADATA_KEY, metaList, constructor);
8922
+ }
8923
+ metaList.push({ propertyKey, id, type, options });
8924
+ if (type === "method") {
8925
+ const original = descriptor.value;
8926
+ descriptor.value = function(...args) {
8927
+ ensureInit(this);
8928
+ const conf = getElementConfig(this);
8929
+ const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
8930
+ const currentDoc = currentWin.document;
8931
+ const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
8932
+ const res = original.apply(this, args);
8933
+ if (res) {
8934
+ const nodeSlot = new NodeSlot(this, `${this._swcId}-${id}`);
8935
+ const pos = options.position || "replaceChildrenHtml";
8936
+ const doc = currentWin.document;
8937
+ if (pos === "replaceChildrenHtml") {
8938
+ nodeSlot.replaceChildrenHtml(res);
8939
+ } else if (pos === "replaceChildrenText") {
8940
+ nodeSlot.replaceChildrenText(res);
8941
+ } else if (pos === "appendHtml") {
8942
+ nodeSlot.appendHtml(res);
8943
+ } else if (pos === "appendText") {
8944
+ nodeSlot.appendText(res);
8945
+ } else if (pos === "prependHtml") {
8946
+ nodeSlot.prependHtml(res);
8947
+ } else if (pos === "prependText") {
8948
+ nodeSlot.prependText(res);
8949
+ } else if (pos === "clear") {
8950
+ nodeSlot.clear();
8951
+ }
8952
+ }
8953
+ return res;
8954
+ };
8955
+ }
8956
+ };
8957
+ }
8958
+ var findAllApplySlotMetadata = (target) => {
8959
+ const constructor = target instanceof Function ? target : target.constructor;
8960
+ return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);
8961
+ };
8962
+ function applySlotClear(id) {
8963
+ return applySlot(id, { position: "clear" });
8964
+ }
8965
+ function applySlotPrependHtml(id) {
8966
+ return applySlot(id, { position: "prependHtml" });
8967
+ }
8968
+ var applySlotPrepend = applySlotPrependHtml;
8969
+ function applySlotPrependText(id) {
8970
+ return applySlot(id, { position: "prependText" });
8971
+ }
8972
+ function applySlotAppendHtml(id) {
8973
+ return applySlot(id, { position: "appendHtml" });
8974
+ }
8975
+ function applySlotAppendText(id) {
8976
+ return applySlot(id, { position: "appendText" });
8977
+ }
8978
+ var applySlotAppend = applySlotAppendHtml;
8979
+ function applySlotReplaceChildrenHtml(id) {
8980
+ return applySlot(id, { position: "replaceChildrenHtml" });
8981
+ }
8982
+ var applySlotReplaceChildren = applySlotReplaceChildrenHtml;
8983
+ function applySlotReplaceChildrenText(id) {
8984
+ return applySlot(id, { position: "replaceChildrenText" });
8985
+ }
8986
+
7692
8987
  // src/decorators/elementDefine.ts
7693
8988
  var ELEMENT_CONFIG_KEY = Symbol.for("simple-web-component:element-config");
7694
8989
  var getElementConfig = (target) => {
@@ -7697,7 +8992,7 @@ var getElementConfig = (target) => {
7697
8992
  };
7698
8993
  var ensureInit = (inst) => {
7699
8994
  if (!inst.__swc_initialized) {
7700
- inst._swcId = Math.random().toString(36).substring(2, 11);
8995
+ inst._swcId = inst?.getAttribute?.("swc-use-ssr") ?? Math.random().toString(36).substring(2, 11);
7701
8996
  inst._emitHandlers = /* @__PURE__ */ new Map();
7702
8997
  inst._boundListeners = [];
7703
8998
  inst.__swc_initialized = true;
@@ -7718,6 +9013,12 @@ var ensureInit = (inst) => {
7718
9013
  delete inst[meta.propertyKey];
7719
9014
  });
7720
9015
  }
9016
+ const slotAllList = findAllApplySlotMetadata(target);
9017
+ if (slotAllList) {
9018
+ slotAllList.filter((it) => it.type === "property").forEach((meta) => {
9019
+ delete inst[meta.propertyKey];
9020
+ });
9021
+ }
7721
9022
  const hostSet = SwcUtils.getHostSet(inst);
7722
9023
  const appHosts = SwcUtils.findAllAppHostsIncludingSelfDirect(inst);
7723
9024
  inst._executeSwcScript?.("swc-on-constructor", hostSet);
@@ -7760,7 +9061,7 @@ var getHandlers = (inst) => {
7760
9061
  if (!inst.__swc_attributeEventHandlers) inst.__swc_attributeEventHandlers = /* @__PURE__ */ new Map();
7761
9062
  return inst.__swc_attributeEventHandlers;
7762
9063
  };
7763
- var setupPrototype = (proto) => {
9064
+ var setupPrototype = (proto, win) => {
7764
9065
  if (proto.__swc_proto_setup) return;
7765
9066
  proto.__swc_proto_setup = true;
7766
9067
  proto._executeSwcScript = function(attrName, hostSet, extraArgs = {}) {
@@ -7791,7 +9092,7 @@ var setupPrototype = (proto) => {
7791
9092
  proto._invokeLifecycleMethod = function(methodName, hostSet, extraArgs = []) {
7792
9093
  ensureInit(this);
7793
9094
  if (typeof this[methodName] !== "function") return;
7794
- const useHostSet = hostSet ?? SwcUtils.getHostSet(this);
9095
+ const useHostSet = hostSet ?? SwcUtils.getHelperAndHostSet(win, this);
7795
9096
  const app = useHostSet?.$appHost?.simpleApplication;
7796
9097
  if (app) {
7797
9098
  const otherStorage = /* @__PURE__ */ new Map();
@@ -7896,61 +9197,57 @@ var elementDefine = (name, config = {}) => (constructor) => {
7896
9197
  const hostAttributes = attributeList.filter((it) => it.selector === "$this").map((it) => it.options.name || String(it.propertyKey));
7897
9198
  const originalStaticObservedAttributes = constructor.observedAttributes ?? [];
7898
9199
  const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...metadata.observedAttributes ?? [], ...originalStaticObservedAttributes, ...attrChangeMap.keys(), ...attributeApplyNames, ...hostAttributes, ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean), ...swcLifecycleAttributes, ...swcOnEvents])];
7899
- const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];
7900
9200
  const proto = constructor.prototype;
7901
- setupPrototype(proto);
9201
+ setupPrototype(proto, win);
7902
9202
  let helperHostSet = null;
7903
9203
  const originalConnected = proto.connectedCallback;
7904
9204
  proto.connectedCallback = async function() {
7905
9205
  ensureInit(this);
7906
9206
  helperHostSet = SwcUtils.getHelperAndHostSet(win, this);
7907
9207
  const appHost = helperHostSet.$appHost;
9208
+ const useSsr = isSSR(this);
7908
9209
  try {
7909
9210
  if (appHost && typeof appHost._connected === "function") {
7910
9211
  await appHost._connected(this);
7911
9212
  } else if (appHost && typeof appHost) {
7912
- appHost._connected_safari ?? (appHost._connected_safari = []);
7913
- appHost._connected_safari.push(this);
9213
+ appHost._connected_safari_and_standby ?? (appHost._connected_safari_and_standby = []);
9214
+ appHost._connected_safari_and_standby.push(this);
7914
9215
  }
7915
9216
  const conf = getElementConfig(this);
7916
9217
  const currentWin = this._resolveWindow(conf);
7917
- const shadowMode = conf?.useShadow || connectedInnerHtmlList.find((it) => it.options.useShadow)?.options.useShadow;
9218
+ const bMethods = getOnConnectedBeforeMetadata(this).filter((it) => useSsr ? !it.options.ssrFirst : true);
9219
+ if (bMethods) {
9220
+ for (const m of bMethods) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
9221
+ }
9222
+ this._executeSwcScript("swc-on-before-connected", helperHostSet);
9223
+ const targetConnectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor).filter((it) => useSsr ? !it.options.ssrFirst : true);
9224
+ const shadowMode = conf?.useShadow || targetConnectedInnerHtmlList.find((it) => it.options.useShadow)?.options.useShadow;
7918
9225
  if (shadowMode && !this.shadowRoot) {
7919
9226
  const mode = shadowMode === true ? "open" : shadowMode;
7920
9227
  this.attachShadow({ mode });
7921
9228
  }
7922
- const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_CONNECTED_METADATA_KEY);
7923
- if (bMethods) {
7924
- for (const m of bMethods) await this._invokeLifecycleMethod(m, helperHostSet);
7925
- }
7926
- this._executeSwcScript("swc-on-before-connected", helperHostSet);
7927
- if (connectedInnerHtmlList.length > 0) {
9229
+ if (targetConnectedInnerHtmlList.length > 0) {
7928
9230
  let sContent = "", lContent = "";
7929
- for (const meta of connectedInnerHtmlList) {
9231
+ for (const meta of targetConnectedInnerHtmlList) {
7930
9232
  let res = await this._invokeLifecycleMethod(meta.propertyKey, helperHostSet);
7931
9233
  const actionExpression = new ActionExpression(res, {
7932
9234
  expression: {
7933
9235
  replace: {
7934
- start: meta.options.replaceWrap?.start || "{%{",
7935
- end: meta.options.replaceWrap?.end || "}%}"
9236
+ start: meta.options.replaceWrap?.start || "[[",
9237
+ end: meta.options.replaceWrap?.end || "]]"
7936
9238
  },
7937
9239
  callReturn: {
7938
- start: meta.options.replaceWrap?.start || "{%{=",
7939
- end: meta.options.replaceWrap?.end || "}%}"
9240
+ start: meta.options.replaceWrap?.start || "[[=",
9241
+ end: meta.options.replaceWrap?.end || "]]"
7940
9242
  },
7941
9243
  call: {
7942
- start: meta.options.replaceWrap?.start || "{%{@",
7943
- end: meta.options.replaceWrap?.end || "}%}"
9244
+ start: meta.options.replaceWrap?.start || "[[@",
9245
+ end: meta.options.replaceWrap?.end || "]]"
7944
9246
  }
7945
9247
  }
7946
9248
  });
7947
9249
  actionExpression.getExpressions().filter((it) => it.type === "replace").forEach((it) => {
7948
- try {
7949
- const sr = FunctionUtils.executeReturn({ script: it.script, context: this, args: helperHostSet });
7950
- actionExpression.replace(it, sr);
7951
- } catch (e) {
7952
- console.error(`[SWC] Failed to execute connectedInnerHTML:`, e);
7953
- }
9250
+ actionExpression.replace(it, NodeSlot.slot(`${this._swcId}-${it.script}`));
7954
9251
  });
7955
9252
  res = actionExpression.getUnprocessedTemplate();
7956
9253
  if (res !== void 0) {
@@ -8098,9 +9395,11 @@ var elementDefine = (name, config = {}) => (constructor) => {
8098
9395
  });
8099
9396
  });
8100
9397
  if (originalConnected) await originalConnected.apply(this);
8101
- const aMethods = findAllLifecycleMetadata(this, ON_AFTER_CONNECTED_METADATA_KEY);
9398
+ const aMethods = getOnConnectedAfterMetadata(this).filter((it) => {
9399
+ return useSsr ? !it.options.ssrFirst : true;
9400
+ });
8102
9401
  if (aMethods) {
8103
- for (const m of aMethods) await this._invokeLifecycleMethod(m, helperHostSet);
9402
+ for (const m of aMethods) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
8104
9403
  }
8105
9404
  this._executeSwcScript("swc-on-connected", helperHostSet);
8106
9405
  this._executeSwcScript("swc-on-after-connected", helperHostSet);
@@ -8116,6 +9415,9 @@ var elementDefine = (name, config = {}) => (constructor) => {
8116
9415
  }
8117
9416
  }
8118
9417
  } finally {
9418
+ for (let mPropertyKey of findAllLifecycleMetadata(this, ON_CONNECTED_COMPLETED_METADATA_KEY)) {
9419
+ await this._invokeLifecycleMethod(mPropertyKey, helperHostSet);
9420
+ }
8119
9421
  if (appHost && typeof appHost._connectedDone === "function") {
8120
9422
  await appHost._connectedDone(this);
8121
9423
  }
@@ -8123,7 +9425,6 @@ var elementDefine = (name, config = {}) => (constructor) => {
8123
9425
  };
8124
9426
  const originalDisconnected = proto.disconnectedCallback;
8125
9427
  proto.disconnectedCallback = function() {
8126
- console.log("disconnnnnnnnnnnnnnnnnnn", helperHostSet, this);
8127
9428
  const appHost = helperHostSet.$appHost;
8128
9429
  if (appHost && typeof appHost._disconnected === "function") {
8129
9430
  appHost._disconnected(this);
@@ -8385,8 +9686,9 @@ var normalizeNodes = (res, doc) => {
8385
9686
  return doc.createTextNode(it !== void 0 && it !== null ? String(it) : "");
8386
9687
  });
8387
9688
  };
8388
- var applyToDom = (targetEl, res, pos, doc) => {
9689
+ var applyToDom = (targetEl, res, pos, win) => {
8389
9690
  if (!targetEl) return;
9691
+ const doc = win.document;
8390
9692
  if (pos === "innerHtml") {
8391
9693
  targetEl.innerHTML = res !== void 0 && res !== null ? String(res) : "";
8392
9694
  return;
@@ -8397,7 +9699,7 @@ var applyToDom = (targetEl, res, pos, doc) => {
8397
9699
  }
8398
9700
  return;
8399
9701
  }
8400
- const isShadowRoot = targetEl instanceof ShadowRoot;
9702
+ const isShadowRoot = targetEl instanceof win.ShadowRoot;
8401
9703
  const nodes = normalizeNodes(res, doc);
8402
9704
  if (pos === "replace") {
8403
9705
  if (!isShadowRoot) targetEl.replaceWith(...nodes);
@@ -8450,7 +9752,7 @@ function applyNode(selector, options = { position: "beforeEnd" }) {
8450
9752
  const runApply = (target, val) => {
8451
9753
  const pos = options.position || "beforeEnd";
8452
9754
  if (!options.filter || options.filter(target, val, { currentThis: this, helper: hostSet })) {
8453
- applyToDom(target, val, pos, currentDoc);
9755
+ applyToDom(target, val, pos, currentWin);
8454
9756
  }
8455
9757
  };
8456
9758
  if (res instanceof Promise) {
@@ -8484,23 +9786,23 @@ function applyNodeThis(targetOrOptions, propertyKey, descriptor) {
8484
9786
  const opt = targetOrOptions || {};
8485
9787
  return applyNode("$this", { position: "beforeEnd", ...opt });
8486
9788
  }
8487
- function applyReplaceChildrenNodeThis(targetOrOptions, propertyKey, descriptor) {
9789
+ function applyNodeThisReplaceChildren(targetOrOptions, propertyKey, descriptor) {
8488
9790
  if (propertyKey !== void 0) return applyNode("$this", { position: "replaceChildren" })(targetOrOptions, propertyKey, descriptor);
8489
9791
  const opt = targetOrOptions || {};
8490
9792
  return applyNode("$this", { position: "replaceChildren", ...opt });
8491
9793
  }
8492
- function applyInnerHtmlNodeThis(targetOrOptions, propertyKey, descriptor) {
9794
+ function applyThisInnerHtmlNode(targetOrOptions, propertyKey, descriptor) {
8493
9795
  if (propertyKey !== void 0) return applyNode("$this", { position: "innerHtml" })(targetOrOptions, propertyKey, descriptor);
8494
9796
  const opt = targetOrOptions || {};
8495
9797
  return applyNode("$this", { position: "innerHtml", ...opt });
8496
9798
  }
8497
- function applyReplaceChildrenNode(selector, options = {}) {
9799
+ function applyNodeReplaceChildren(selector, options = {}) {
8498
9800
  return applyNode(selector, { ...options, position: "replaceChildren" });
8499
9801
  }
8500
- function applyInnerHtmlNode(selector, options = {}) {
9802
+ function applyNodeInnerHtml(selector, options = {}) {
8501
9803
  return applyNode(selector, { ...options, position: "innerHtml" });
8502
9804
  }
8503
- function applyInnerTextNode(selector, options = {}) {
9805
+ function applyNodeInnerText(selector, options = {}) {
8504
9806
  return applyNode(selector, { ...options, position: "innerText" });
8505
9807
  }
8506
9808
 
@@ -8972,60 +10274,2509 @@ var getPublishSwcAppMessageMetadata = (target) => {
8972
10274
  return ReflectUtils.getOwnMetadata(PUBLISH_SWC_APP_MESSAGE_METADATA_KEY, constructor);
8973
10275
  };
8974
10276
 
10277
+ // ../simple-boot/dist/esm/index.js
10278
+ var import_reflect_metadata = __toESM(require_Reflect(), 1);
10279
+
10280
+ // ../simple-boot/dist/esm/throwable/SimError.js
10281
+ var SimError = class {
10282
+ constructor(message, name, stack) {
10283
+ this.message = message;
10284
+ this.name = name;
10285
+ this.stack = stack;
10286
+ }
10287
+ };
10288
+
10289
+ // ../simple-boot/dist/esm/throwable/SimNoSuch.js
10290
+ var SimNoSuch = class extends SimError {
10291
+ constructor(message, name, stack) {
10292
+ super(message, name, stack);
10293
+ }
10294
+ };
10295
+
8975
10296
  // ../simple-boot/dist/esm/decorators/SimDecorator.js
10297
+ var Lifecycle = /* @__PURE__ */ ((Lifecycle2) => {
10298
+ Lifecycle2["Singleton"] = "Singleton";
10299
+ Lifecycle2["Transient"] = "Transient";
10300
+ return Lifecycle2;
10301
+ })(Lifecycle || {});
10302
+ var sims = /* @__PURE__ */ new Map();
10303
+ var containers = /* @__PURE__ */ new Set();
8976
10304
  var SimMetadataKey = Symbol.for("simple-boot:sim-metadata");
10305
+ var isNotNullObjetInstance = (target) => target != null && target !== void 0 && typeof target === "object";
10306
+ var simProcess = (config, inputTarget) => {
10307
+ const target = (() => {
10308
+ if (typeof inputTarget === "object") {
10309
+ return config.scope === "Singleton" ? inputTarget : ValidUtils.isPlainObject(inputTarget) ? { ...inputTarget } : inputTarget;
10310
+ }
10311
+ if (ValidUtils.isArrowFunction(inputTarget)) {
10312
+ return () => inputTarget();
10313
+ }
10314
+ return inputTarget;
10315
+ })();
10316
+ let targetType;
10317
+ if (isNotNullObjetInstance(target)) {
10318
+ targetType = target.constructor;
10319
+ } else {
10320
+ targetType = target;
10321
+ }
10322
+ config.scope = config?.scope ?? "Singleton";
10323
+ ReflectUtils.defineMetadata(SimMetadataKey, config, targetType);
10324
+ const adding = (targetKey, target2 = targetKey) => {
10325
+ const items = sims.get(targetKey) ?? /* @__PURE__ */ new Set();
10326
+ items.add(target2);
10327
+ sims.set(targetKey, items);
10328
+ };
10329
+ if (Array.isArray(config?.type)) {
10330
+ config?.type.forEach((it) => {
10331
+ adding(it, target);
10332
+ });
10333
+ } else if (config.type) {
10334
+ adding(config?.type, target);
10335
+ } else {
10336
+ adding(target);
10337
+ }
10338
+ };
10339
+ function Sim(configOrTarget) {
10340
+ if (typeof configOrTarget === "symbol") {
10341
+ return (target) => {
10342
+ simProcess({ symbol: configOrTarget }, target);
10343
+ };
10344
+ } else if (typeof configOrTarget === "function") {
10345
+ simProcess({}, configOrTarget);
10346
+ } else {
10347
+ return (target) => {
10348
+ simProcess(configOrTarget, target);
10349
+ };
10350
+ }
10351
+ }
10352
+ var getSim = (target) => {
10353
+ if (target != null && target !== void 0 && typeof target === "object") {
10354
+ target = Object.getPrototypeOf(target).constructor;
10355
+ }
10356
+ try {
10357
+ return ReflectUtils.getMetadata(SimMetadataKey, target);
10358
+ } catch (e) {
10359
+ }
10360
+ };
8977
10361
  var PostConstructMetadataKey = Symbol.for("simple-boot:post-construct-metadata");
10362
+ var getPostConstructs = (target) => {
10363
+ return ReflectUtils.getMetadata(PostConstructMetadataKey, target) ?? [];
10364
+ };
10365
+
10366
+ // ../simple-boot/dist/esm/simstance/SimAtomic.js
10367
+ var SimAtomic = class {
10368
+ constructor(type, simstanceManager, config) {
10369
+ this.type = type;
10370
+ this.simstanceManager = simstanceManager;
10371
+ this.config = config;
10372
+ this.value = type.value;
10373
+ }
10374
+ getConfig(key = SimMetadataKey) {
10375
+ return ReflectUtils.getMetadata(key, this.type.originalType);
10376
+ }
10377
+ getConfigs() {
10378
+ return ReflectUtils.getMetadatas(this.type.originalType);
10379
+ }
10380
+ getValue(config) {
10381
+ if (config?.refresh) {
10382
+ this.value = void 0;
10383
+ }
10384
+ if (!this.value) {
10385
+ if (typeof this.type.targetKeyType === "symbol") {
10386
+ this.value = this.simstanceManager.findFirstSim(this.type.targetKeyType)?.getValue();
10387
+ } else {
10388
+ this.value = this.simstanceManager.getOrNewSim({ target: this.type.targetKeyType, originTypeTarget: this.type.originalType, newInstanceCarrier: config?.newInstanceCarrier });
10389
+ }
10390
+ }
10391
+ return this.value;
10392
+ }
10393
+ };
10394
+
10395
+ // ../simple-boot/dist/esm/SimOption.js
10396
+ var SimOption = class {
10397
+ constructor({ rootRouter, container, cache, advice = [], excludeProxys, proxy, using } = {}) {
10398
+ this.rootRouter = rootRouter;
10399
+ this.container = container;
10400
+ this.advice = advice;
10401
+ this.excludeProxys = excludeProxys;
10402
+ this.proxy = proxy;
10403
+ this.using = using;
10404
+ this.cache = cache;
10405
+ }
10406
+ addAdvicce(advice) {
10407
+ this.advice ?? (this.advice = []);
10408
+ this.advice.push(advice);
10409
+ }
10410
+ setAdvice(...advice) {
10411
+ this.advice = advice;
10412
+ return this;
10413
+ }
10414
+ };
10415
+
10416
+ // ../simple-boot/dist/esm/decorators/MetaDataAtomic.js
10417
+ var MetaDataAtomic = class {
10418
+ constructor(target, metaData) {
10419
+ this.target = target;
10420
+ this.metaData = metaData;
10421
+ }
10422
+ };
10423
+ var MetaDataPropertyAtomic = class extends MetaDataAtomic {
10424
+ constructor(target, metaData, property, parameter) {
10425
+ super(target, metaData);
10426
+ this.property = property;
10427
+ this.parameter = parameter;
10428
+ }
10429
+ call(...parameter) {
10430
+ return this.target[this.property](...parameter);
10431
+ }
10432
+ };
8978
10433
 
8979
10434
  // ../simple-boot/dist/esm/decorators/aop/AOPDecorator.js
8980
10435
  var AfterMetadataKey = Symbol.for("simple-boot:after-metadata");
8981
10436
  var BeforeMetadataKey = Symbol.for("simple-boot:before-metadata");
8982
10437
  var AroundMetadataKey = Symbol.for("simple-boot:around-metadata");
10438
+ var getAfter = (target, propertyKey) => {
10439
+ return ReflectUtils.getMetadata(AfterMetadataKey, target, propertyKey);
10440
+ };
10441
+ var getAfters = (target) => {
10442
+ return ObjectUtils.allProtoTypeName(target).map((it) => new MetaDataPropertyAtomic(target, getAfter(target, it), it)).filter((it) => it.metaData !== void 0) || [];
10443
+ };
10444
+ var getProtoAfters = (target, propertyKey, type) => {
10445
+ return getAfters(target).filter((it) => propertyKey === it.metaData?.property && type === it.metaData.type?.prototype) || [];
10446
+ };
10447
+ var getBefore = (target, propertyKey) => {
10448
+ return ReflectUtils.getMetadata(BeforeMetadataKey, target, propertyKey);
10449
+ };
10450
+ var getBefores = (target) => {
10451
+ return ObjectUtils.allProtoTypeName(target).map((it) => new MetaDataPropertyAtomic(target, getBefore(target, it), it)).filter((it) => it.metaData !== void 0) || [];
10452
+ };
10453
+ var getProtoBefores = (target, propertyKey, type) => {
10454
+ return getBefores(target).filter((it) => propertyKey === it.metaData?.property && type === it.metaData.type?.prototype) || [];
10455
+ };
8983
10456
 
8984
10457
  // ../simple-boot/dist/esm/decorators/exception/ExceptionDecorator.js
10458
+ var ExceptionHandlerSituationType = /* @__PURE__ */ ((ExceptionHandlerSituationType2) => {
10459
+ ExceptionHandlerSituationType2["ERROR_OBJECT"] = "SIMPLE_BOOT_CORE://ExceptionHandler/ERROR_OBJECT";
10460
+ ExceptionHandlerSituationType2["PARAMETER"] = "SIMPLE_BOOT_CORE://ExceptionHandler/PARAMETER";
10461
+ return ExceptionHandlerSituationType2;
10462
+ })(ExceptionHandlerSituationType || {});
8985
10463
  var ExceptionHandlerMetadataKey = Symbol.for("simple-boot:exception-handler-metadata");
10464
+ var getExceptionHandlers = (target) => {
10465
+ if (target !== null && void 0 !== target && typeof target === "object") {
10466
+ target = target.constructor;
10467
+ }
10468
+ return ReflectUtils.getMetadata(ExceptionHandlerMetadataKey, target);
10469
+ };
10470
+ var targetExceptionHandlers = (target, error) => {
10471
+ const exceptionHandlers = getExceptionHandlers(target);
10472
+ const emptyTargets = exceptionHandlers?.filter((it) => it.config.type === void 0);
10473
+ const targets = exceptionHandlers?.filter((it) => ObjectUtils.isPrototypeOfTarget(it.config.type, error));
10474
+ const targetSorts = targets?.sort((a, b) => {
10475
+ const aPrototypeOfDepth = ObjectUtils.prototypeOfDepth(error, a.config.type);
10476
+ const bPrototypeOfDepth = ObjectUtils.prototypeOfDepth(error, b.config.type);
10477
+ return aPrototypeOfDepth.length - bPrototypeOfDepth.length;
10478
+ });
10479
+ return (targetSorts ?? []).concat(...emptyTargets ?? []);
10480
+ };
10481
+ var targetExceptionHandler = (target, error, excludeMethods = []) => {
10482
+ let exceptionHandlers = targetExceptionHandlers(target, error);
10483
+ exceptionHandlers = exceptionHandlers?.filter((it) => !excludeMethods.includes(it.method));
10484
+ if (exceptionHandlers && exceptionHandlers.length > 0) {
10485
+ return exceptionHandlers[0];
10486
+ } else {
10487
+ return void 0;
10488
+ }
10489
+ };
8986
10490
 
8987
- // ../simple-boot/dist/esm/decorators/SimNoProxy.js
8988
- var SimNoProxyKey = Symbol.for("simple-boot:sim-no-proxy-metadata");
8989
-
8990
- // ../simple-boot/dist/esm/decorators/inject/Injection.js
8991
- var InjectionMetadataKey = Symbol("Injection");
8992
-
8993
- // ../simple-boot/dist/esm/decorators/route/Router.js
8994
- var RouterMetadataKey = Symbol.for("simple-boot:router-metadata");
8995
- var RouteMetadataKey = Symbol.for("simple-boot:route-metadata");
8996
-
8997
- // ../simple-boot/dist/esm/route/RouterAction.js
8998
- var RouterAction;
8999
- ((RouterAction2) => {
9000
- RouterAction2.isCanActivate = (obj) => {
9001
- return typeof obj?.canActivate === "function";
9002
- };
9003
- RouterAction2.isOnRouting = (obj) => {
9004
- return typeof obj?.onRouting === "function";
9005
- };
9006
- RouterAction2.isHasActivate = (obj) => {
9007
- return typeof obj?.hasActivate === "function";
9008
- };
9009
- })(RouterAction || (RouterAction = {}));
9010
-
9011
- // ../simple-boot/dist/esm/decorators/cache/CacheDecorator.js
9012
- var CacheMetadataKey = Symbol.for("simple-boot:cache-metadata");
9013
-
9014
- // ../simple-boot/dist/esm/fetch/ApiService.js
9015
- var ApiServiceInterceptor;
9016
- ((ApiServiceInterceptor2) => {
9017
- ApiServiceInterceptor2.TOKEN = Symbol.for("simple-boot:api-service-interceptor-token");
9018
- ApiServiceInterceptor2.resolveAll = (simstanceManager) => {
10491
+ // ../simple-boot/dist/esm/proxy/SimProxyHandler.js
10492
+ var SimProxyHandler = class {
10493
+ constructor(simpleApplication, simstanceManager, simOption) {
10494
+ this.simpleApplication = simpleApplication;
10495
+ this.simstanceManager = simstanceManager;
10496
+ this.simOption = simOption;
10497
+ }
10498
+ // 잘받게 해놨네 ㅋㅋ simstanceManager
10499
+ get(target, name) {
10500
+ if (name === "_SimpleBoot_application") {
10501
+ return this.simpleApplication;
10502
+ } else if (name === "_SimpleBoot_simstanceManager") {
10503
+ return this.simstanceManager;
10504
+ } else if (name === "_SimpleBoot_simOption") {
10505
+ return this.simOption;
10506
+ } else if (name === "_SimpleBoot_origin") {
10507
+ return target;
10508
+ } else {
10509
+ return target[name];
10510
+ }
10511
+ }
10512
+ set(obj, prop, value, receiver) {
10513
+ value = this.simstanceManager?.proxy(value);
10514
+ obj[prop] = value;
10515
+ return true;
10516
+ }
10517
+ apply(target, thisArg, argumentsList) {
10518
+ let r;
9019
10519
  try {
9020
- return (simstanceManager.findSims(ApiServiceInterceptor2.TOKEN) ?? []).map((it) => it.getValue()).filter(ValidUtils.isDefined);
10520
+ this.aopBefore(thisArg, target);
10521
+ try {
10522
+ r = Reflect.apply(target, thisArg, argumentsList);
10523
+ } catch (e) {
10524
+ throw e;
10525
+ } finally {
10526
+ this.aopAfter(thisArg, target);
10527
+ }
9021
10528
  } catch (e) {
9022
- return [];
10529
+ console.error(e);
10530
+ const inHandlers = this.getExceptionHandler(e, thisArg, target);
10531
+ if (inHandlers.length > 0 && inHandlers[0]) {
10532
+ const inHandler = inHandlers[0];
10533
+ this.executeExceptionHandler(e, inHandler, argumentsList);
10534
+ } else {
10535
+ throw e;
10536
+ }
9023
10537
  }
9024
- };
9025
- })(ApiServiceInterceptor || (ApiServiceInterceptor = {}));
10538
+ return r;
10539
+ }
10540
+ executeExceptionHandler(e, inHandler, argumentsList) {
10541
+ const otherStorage = /* @__PURE__ */ new Map();
10542
+ otherStorage.set(e.constructor, e);
10543
+ const situationErrorTypeContainer = new SituationTypeContainer({
10544
+ situationType: ExceptionHandlerSituationType.ERROR_OBJECT,
10545
+ data: e
10546
+ });
10547
+ const situationParameterTypeContainer = new SituationTypeContainer({
10548
+ situationType: ExceptionHandlerSituationType.PARAMETER,
10549
+ data: argumentsList
10550
+ });
10551
+ otherStorage.set(SituationTypeContainers, new SituationTypeContainers([situationErrorTypeContainer, situationParameterTypeContainer]));
10552
+ argumentsList?.forEach((it) => {
10553
+ otherStorage.set(it.constructor, it);
10554
+ });
10555
+ try {
10556
+ this.simstanceManager.executeBindParameterSim(
10557
+ {
10558
+ target: inHandler.thisArg,
10559
+ targetKey: inHandler.config.propertyKey
10560
+ },
10561
+ otherStorage
10562
+ );
10563
+ } catch (es) {
10564
+ e = es;
10565
+ }
10566
+ if (inHandler.config.config.throw) {
10567
+ const exceptionHandler = this.getExceptionHandler(e, inHandler.thisArg, inHandler.config.method);
10568
+ if ((exceptionHandler?.length ?? 0) > 0) {
10569
+ this.executeExceptionHandler(e, exceptionHandler[0], argumentsList);
10570
+ }
10571
+ }
10572
+ }
10573
+ getExceptionHandler(e, thisArg, target) {
10574
+ const globalConfigSets = this.simOption.advice.map((it) => this.simstanceManager?.getOrNewSim({ target: it })).filter((it) => it).map((it) => {
10575
+ return { thisArg: it, config: targetExceptionHandler(it, e, [target]) };
10576
+ }) ?? [];
10577
+ const thisConfigSet = { thisArg, config: targetExceptionHandler(thisArg, e, [target]) };
10578
+ const inHandlers = [thisConfigSet, ...globalConfigSets].filter((it) => it && it.config);
10579
+ return inHandlers;
10580
+ }
10581
+ aopBefore(obj, protoType) {
10582
+ const propertyName = ObjectUtils.prototypeName(obj, protoType);
10583
+ if (propertyName && obj) {
10584
+ getProtoBefores(obj, propertyName).forEach((it) => {
10585
+ it.call(obj, protoType, propertyName);
10586
+ });
10587
+ for (let i = 0; i < this.simOption.advice.length; i++) {
10588
+ const sim = this.simstanceManager?.getOrNewSim({ target: this.simOption.advice[i] });
10589
+ const protoBefores = getProtoBefores(sim, propertyName, Object.getPrototypeOf(obj));
10590
+ protoBefores.forEach((it) => {
10591
+ it.call(obj, protoType, propertyName);
10592
+ });
10593
+ }
10594
+ }
10595
+ }
10596
+ aopAfter(obj, protoType) {
10597
+ const propertyName = ObjectUtils.prototypeName(obj, protoType);
10598
+ if (propertyName) {
10599
+ getProtoAfters(obj, propertyName).forEach((it) => {
10600
+ it.call(obj, protoType, propertyName);
10601
+ });
10602
+ for (let i = 0; i < this.simOption.advice.length; i++) {
10603
+ const sim = this.simstanceManager?.getOrNewSim({ target: this.simOption.advice[i] });
10604
+ const protoBefores = getProtoAfters(sim, propertyName, Object.getPrototypeOf(obj));
10605
+ protoBefores.forEach((it) => {
10606
+ it.call(obj, protoType, propertyName);
10607
+ });
10608
+ }
10609
+ }
10610
+ }
10611
+ has(target, key) {
10612
+ if (key === "_SimpleBoot_isProxy") {
10613
+ return true;
10614
+ }
10615
+ return key in target;
10616
+ }
10617
+ };
10618
+
10619
+ // ../simple-boot/dist/esm/lifecycle/OnSimCreate.js
10620
+ var isOnSimCreate = (obj) => {
10621
+ return typeof obj?.onSimCreate === "function";
10622
+ };
10623
+
10624
+ // ../simple-boot/dist/esm/lifecycle/OnSimCreateCompleted.js
10625
+ var isOnSimCreateProxyCompleted = (obj) => {
10626
+ return typeof obj?.onSimCreateProxyCompleted === "function";
10627
+ };
10628
+
10629
+ // ../simple-boot/dist/esm/decorators/SimNoProxy.js
10630
+ var SimNoProxyKey = Symbol.for("simple-boot:sim-no-proxy-metadata");
10631
+ var getSimNoProxy = (target, propertyKey) => {
10632
+ try {
10633
+ if (propertyKey === void 0) {
10634
+ return Reflect.getMetadata(SimNoProxyKey, target);
10635
+ }
10636
+ return Reflect.getMetadata(SimNoProxyKey, target, propertyKey);
10637
+ } catch (e) {
10638
+ return void 0;
10639
+ }
10640
+ };
10641
+ var isSimNoProxy = (target, propertyKey) => {
10642
+ if (target === null || target === void 0) {
10643
+ return false;
10644
+ }
10645
+ return getSimNoProxy(target, propertyKey) === true;
10646
+ };
10647
+
10648
+ // ../simple-boot/dist/esm/simstance/SimstanceManager.js
10649
+ var SimstanceManager = class _SimstanceManager {
10650
+ // private otherInstanceSim?: Map<ConstructorType<any> | Function, any>;
10651
+ constructor(simpleApplication, option) {
10652
+ this.simpleApplication = simpleApplication;
10653
+ this.option = option;
10654
+ this._storage = /* @__PURE__ */ new Map();
10655
+ this.name = "simstanceManager-" + RandomUtils.uuid4();
10656
+ this.setStoreSet(SimpleApplication, this.simpleApplication);
10657
+ this.setStoreSet(_SimstanceManager, this);
10658
+ this.setStoreSet(option.constructor, option);
10659
+ this.setStoreSet(SimOption, option);
10660
+ this.simProxyHandler = new SimProxyHandler(this.simpleApplication, this, option);
10661
+ }
10662
+ get storage() {
10663
+ return this._storage;
10664
+ }
10665
+ getSimAtomics() {
10666
+ const r = [];
10667
+ Array.from(this.storage.entries()).forEach(([targetKeyType, targetMap]) => {
10668
+ r.push(
10669
+ ...Array.from(Array.from(targetMap.keys())).map(
10670
+ (sit) => new SimAtomic(
10671
+ {
10672
+ targetKeyType,
10673
+ originalType: sit
10674
+ },
10675
+ this
10676
+ )
10677
+ )
10678
+ );
10679
+ });
10680
+ return r;
10681
+ }
10682
+ getSimConfig(schemeOrSymbol) {
10683
+ const newVar = this.getSimAtomics().filter((it) => {
10684
+ const config = it?.getConfig();
10685
+ const symbols = ConvertUtils.flatArray(config?.symbol);
10686
+ const schemes = ConvertUtils.flatArray(config?.scheme);
10687
+ if (typeof schemeOrSymbol === "symbol") {
10688
+ return schemeOrSymbol && it && symbols.includes(schemeOrSymbol);
10689
+ } else if (typeof schemeOrSymbol === "string") {
10690
+ return schemeOrSymbol && it && schemes.includes(schemeOrSymbol);
10691
+ } else {
10692
+ return false;
10693
+ }
10694
+ }) || [];
10695
+ return newVar;
10696
+ }
10697
+ findSims(data) {
10698
+ let r = [];
10699
+ if (data) {
10700
+ const simAtomics = this.getSimAtomics();
10701
+ r = simAtomics.filter((it) => {
10702
+ let b = false;
10703
+ const config = it.getConfig();
10704
+ const symbols = ConvertUtils.flatArray(config?.symbol).filter(ValidUtils.isDefined);
10705
+ const schemes = ConvertUtils.flatArray(config?.scheme).filter(ValidUtils.isDefined);
10706
+ if (typeof data === "symbol") {
10707
+ b = symbols.includes(data);
10708
+ } else {
10709
+ const { scheme, type } = data;
10710
+ b = (scheme ? schemes.includes(scheme) : true) && (type ? it.type.targetKeyType === type : true);
10711
+ }
10712
+ return b;
10713
+ });
10714
+ }
10715
+ return r;
10716
+ }
10717
+ findFirstSim(data) {
10718
+ if (typeof data === "symbol") {
10719
+ return this.findSims(data)[0];
10720
+ } else {
10721
+ return this.findSims(data)[0];
10722
+ }
10723
+ }
10724
+ findLastSim(data) {
10725
+ if (typeof data === "symbol") {
10726
+ return this.findSims(data).reverse()[0];
10727
+ } else {
10728
+ return this.findSims(data).reverse()[0];
10729
+ }
10730
+ }
10731
+ flatStoreSets() {
10732
+ return new Map(
10733
+ Array.from(this.storage.values()).map((it) => Array.from(it.entries())).flat()
10734
+ );
10735
+ }
10736
+ getStoreSets(targetKey) {
10737
+ const map = this.storage.get(targetKey);
10738
+ const datas = (Array.from(map?.entries?.() ?? []) ?? []).reverse();
10739
+ return datas.map((it) => ({ type: it[0], instance: it[1] }));
10740
+ }
10741
+ getStoreSet(targetKey, target) {
10742
+ const sets = this.getStoreSets(targetKey);
10743
+ let find = sets.find((it) => it.type === target);
10744
+ if (!find && (!target || target === targetKey)) {
10745
+ find = sets.find((it) => it.instance);
10746
+ }
10747
+ if (!find?.instance) {
10748
+ const type = target ?? targetKey;
10749
+ if (typeof type === "object") {
10750
+ const find2 = this.storage.get(type);
10751
+ if (find2) {
10752
+ return { type, instance: type };
10753
+ }
10754
+ }
10755
+ const flatStoreSets = this.flatStoreSets();
10756
+ const data = flatStoreSets.get(type);
10757
+ if (data) {
10758
+ this.setStoreSet(targetKey, data, type);
10759
+ }
10760
+ return { type, instance: data };
10761
+ } else {
10762
+ return find;
10763
+ }
10764
+ }
10765
+ getStoreInstance(targetKey, target) {
10766
+ return this.getStoreSet(targetKey, target)?.instance;
10767
+ }
10768
+ getOrNewSim({ target, originTypeTarget = target, newInstanceCarrier }) {
10769
+ if (target) {
10770
+ const registed = this.getStoreSet(target, originTypeTarget);
10771
+ if (registed?.type && !registed?.instance) {
10772
+ return this.resolve({
10773
+ targetKey: target,
10774
+ target: originTypeTarget,
10775
+ newInstanceCarrier
10776
+ });
10777
+ }
10778
+ return registed?.instance;
10779
+ }
10780
+ }
10781
+ setStoreSet(targetKey, obj, target = targetKey) {
10782
+ const itemMap = this.storage.get(targetKey) ?? /* @__PURE__ */ new Map();
10783
+ itemMap.set(target, obj);
10784
+ this.storage.set(targetKey, itemMap);
10785
+ }
10786
+ registerStore(targetKey, regTyps) {
10787
+ const itemMap = this.storage.get(targetKey) ?? /* @__PURE__ */ new Map();
10788
+ regTyps.forEach((it) => {
10789
+ const { type, value } = typeof it === "object" ? { type: it.constructor, value: it } : { type: it, value: void 0 };
10790
+ if (!itemMap.has(type) || value !== void 0 && itemMap.get(type) === void 0) {
10791
+ itemMap.set(type, value);
10792
+ }
10793
+ });
10794
+ this.storage.set(targetKey, itemMap);
10795
+ }
10796
+ // 진입점
10797
+ resolve({ target, targetKey, newInstanceCarrier = { newInstances: [], depth: 0 } }) {
10798
+ const registed = this.getStoreSet(targetKey, target);
10799
+ if (registed?.instance) {
10800
+ return registed.instance;
10801
+ }
10802
+ if (this.storage.has(targetKey) && void 0 === registed?.instance) {
10803
+ newInstanceCarrier.depth++;
10804
+ const newSim = this.newSim({
10805
+ target: registed?.type ?? targetKey,
10806
+ newInstanceCarrier,
10807
+ simCreateAfter: (data) => {
10808
+ if (getSim(registed?.type ?? target ?? targetKey)?.scope === Lifecycle.Singleton) {
10809
+ this.setStoreSet(targetKey, data, target);
10810
+ }
10811
+ }
10812
+ });
10813
+ newInstanceCarrier.depth--;
10814
+ if (newInstanceCarrier.depth === 0) {
10815
+ newInstanceCarrier.newInstances.forEach((it) => {
10816
+ this.callBindPostConstruct(it);
10817
+ });
10818
+ }
10819
+ if (isOnSimCreate(newSim)) {
10820
+ newSim.onSimCreate();
10821
+ }
10822
+ return newSim;
10823
+ }
10824
+ const simNoSuch = new SimNoSuch("SimNoSuch: no simple instance(resolve) name:" + targetKey?.prototype?.constructor?.name + "," + targetKey);
10825
+ console.error(simNoSuch);
10826
+ throw simNoSuch;
10827
+ }
10828
+ newSim({ target, simCreateAfter, otherStorage, newInstanceCarrier }) {
10829
+ const parameters = this.getParameterSim({
10830
+ target,
10831
+ otherStorage,
10832
+ newInstanceCarrier
10833
+ });
10834
+ const r = ValidUtils.isFunction(target) && !target.prototype ? target(...parameters) : new target(...parameters);
10835
+ let p = this.proxy(r);
10836
+ const config = getSim(target);
10837
+ if (config?.proxy) {
10838
+ const proxys = (Array.isArray(config.proxy) ? config.proxy : [config.proxy]).filter(ValidUtils.isDefined);
10839
+ proxys.forEach((it) => {
10840
+ if (typeof it === "object") {
10841
+ p = new Proxy(p, it);
10842
+ } else {
10843
+ const simConfig = getSim(it);
10844
+ p = new Proxy(p, simConfig ? this.getOrNewSim({ target: it }) : this.newSim({ target: it }));
10845
+ }
10846
+ });
10847
+ }
10848
+ newInstanceCarrier?.newInstances.push(p);
10849
+ simCreateAfter?.(p);
10850
+ if (isOnSimCreateProxyCompleted(p)) {
10851
+ p.onSimCreateProxyCompleted(p);
10852
+ }
10853
+ return p;
10854
+ }
10855
+ callBindPostConstruct(obj) {
10856
+ const postConstruct = getPostConstructs(obj);
10857
+ postConstruct.forEach((it) => {
10858
+ obj[it.property](...this.getParameterSim({ target: obj, targetKey: it.property }));
10859
+ });
10860
+ }
10861
+ async executeBindParameterSimPromise({ target, targetKey, firstCheckMaker, parameterCount, inputParameters }, otherStorage) {
10862
+ const binds = this.getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, parameterCount, inputParameters });
10863
+ const resolvedBinds = await Promise.all(binds);
10864
+ if (typeof target === "object" && targetKey) {
10865
+ const targetMethod = target[targetKey];
10866
+ return targetMethod?.bind(target)?.(...resolvedBinds);
10867
+ } else if (typeof target === "function" && !targetKey) {
10868
+ return new target(...resolvedBinds);
10869
+ }
10870
+ }
10871
+ executeBindParameterSim({ target, targetKey, firstCheckMaker, parameterCount, inputParameters }, otherStorage) {
10872
+ const binds = this.getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, parameterCount, inputParameters });
10873
+ if (typeof target === "object" && targetKey) {
10874
+ const targetMethod = target[targetKey];
10875
+ return targetMethod?.bind(target)?.(...binds);
10876
+ } else if (typeof target === "function" && !targetKey) {
10877
+ return new target(...binds);
10878
+ }
10879
+ }
10880
+ getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, newInstanceCarrier, parameterCount, inputParameters = [] }) {
10881
+ const paramTypes = ReflectUtils.getParameterTypes(target, targetKey) || [];
10882
+ let injections = [];
10883
+ const injects = getInject(target, targetKey);
10884
+ const loopCount = Math.max(paramTypes.length, parameterCount ?? 0);
10885
+ injections = [];
10886
+ for (let idx = 0; idx < loopCount; idx++) {
10887
+ const token = paramTypes[idx];
10888
+ const saveInject = injects?.find((it) => it.index === idx);
10889
+ let isFirstChecked = false;
10890
+ for (const f of firstCheckMaker ?? []) {
10891
+ const firstCheckObj = f({ target, targetKey }, token, idx, saveInject);
10892
+ if (void 0 !== firstCheckObj) {
10893
+ injections.push(firstCheckObj);
10894
+ isFirstChecked = true;
10895
+ break;
10896
+ }
10897
+ }
10898
+ if (isFirstChecked) continue;
10899
+ if (saveInject) {
10900
+ const inject = saveInject.config;
10901
+ let obj = otherStorage?.get(token);
10902
+ if (token === Array && (isTargetType(inject) || isTargetScheme(inject) || isTargetSymbol(inject))) {
10903
+ const p = [];
10904
+ if (isTargetType(inject) && inject.type) {
10905
+ p.push(
10906
+ ...this.getStoreSets(inject.type).map(
10907
+ (it) => this.resolve({
10908
+ targetKey: inject.type,
10909
+ target: it.type,
10910
+ newInstanceCarrier
10911
+ })
10912
+ ).reverse()
10913
+ );
10914
+ }
10915
+ if (isTargetSymbol(inject)) {
10916
+ p.push(...this.getSimConfig(inject.symbol).map((it) => it.getValue({ newInstanceCarrier })));
10917
+ }
10918
+ if (isTargetScheme(inject)) {
10919
+ p.push(...this.getSimConfig(inject.scheme).map((it) => it.getValue({ newInstanceCarrier })));
10920
+ }
10921
+ injections.push(p);
10922
+ continue;
10923
+ }
10924
+ if (inject.situationType && otherStorage) {
10925
+ const situations = otherStorage.get(SituationTypeContainers);
10926
+ const situation = otherStorage.get(SituationTypeContainer);
10927
+ if (inject.situationType === situation?.situationType) {
10928
+ obj = situation.data;
10929
+ } else if (situations && situations.length > 0) {
10930
+ const find = situations.find((a) => {
10931
+ if (a.index !== void 0) {
10932
+ return a.situationType === inject.situationType && a.index === idx;
10933
+ } else {
10934
+ return a.situationType === inject.situationType;
10935
+ }
10936
+ });
10937
+ if (find) {
10938
+ obj = find.data;
10939
+ }
10940
+ }
10941
+ }
10942
+ if (!obj) {
10943
+ const currentInstance = typeof target === "object" ? target : void 0;
10944
+ if (isTargetFactory(inject)) {
10945
+ const combinedParameters = injections.length > 0 ? injections : inputParameters;
10946
+ obj = inject.factory({
10947
+ instance: currentInstance,
10948
+ methodName: String(targetKey),
10949
+ parameter: combinedParameters,
10950
+ application: this.simpleApplication
10951
+ });
10952
+ } else {
10953
+ let findLastSim;
10954
+ if (isTargetSymbol(inject)) {
10955
+ findLastSim = this.findLastSim(inject.symbol);
10956
+ } else if (isTargetType(inject) || isTargetScheme(inject)) {
10957
+ findLastSim = this.findLastSim(inject);
10958
+ }
10959
+ try {
10960
+ obj = findLastSim ? this.resolve({
10961
+ targetKey: findLastSim?.type.targetKeyType ?? token,
10962
+ newInstanceCarrier
10963
+ }) : this.resolve({
10964
+ targetKey: token,
10965
+ newInstanceCarrier
10966
+ });
10967
+ if (inject.factory && obj) {
10968
+ if (typeof inject.factory === "function") {
10969
+ const combinedParameters = injections.length > 0 ? injections : inputParameters;
10970
+ obj = inject.factory({
10971
+ instance: currentInstance,
10972
+ methodName: String(targetKey),
10973
+ parameter: combinedParameters,
10974
+ application: this.simpleApplication,
10975
+ injectInstance: obj
10976
+ });
10977
+ }
10978
+ }
10979
+ } catch (e) {
10980
+ if (inject.optional) {
10981
+ injections.push(void 0);
10982
+ continue;
10983
+ } else {
10984
+ throw e;
10985
+ }
10986
+ }
10987
+ }
10988
+ }
10989
+ if (inject.proxy && obj) {
10990
+ if (ValidUtils.isConstructor(inject.proxy)) {
10991
+ const handler = getSim(inject.proxy) ? this.getOrNewSim({ target: inject.proxy }) : new inject.proxy();
10992
+ if (handler) {
10993
+ obj = new Proxy(obj, handler);
10994
+ }
10995
+ } else if (typeof inject.proxy === "function") {
10996
+ const handler = inject.proxy({
10997
+ application: this.simpleApplication,
10998
+ instance: obj
10999
+ });
11000
+ if (handler) {
11001
+ obj = new Proxy(obj, handler);
11002
+ }
11003
+ }
11004
+ }
11005
+ injections.push(obj);
11006
+ } else {
11007
+ const obj = otherStorage?.get(token) ?? (token ? this.resolve({ targetKey: token, newInstanceCarrier }) : void 0);
11008
+ injections.push(obj);
11009
+ }
11010
+ }
11011
+ return injections;
11012
+ }
11013
+ proxy(target) {
11014
+ try {
11015
+ const noProxy = isSimNoProxy(target);
11016
+ const isExcludeProxy = this.option.excludeProxys?.some((it) => target instanceof it);
11017
+ if (!noProxy && !isExcludeProxy && target !== null && getSim(target) && typeof target === "object" && !("_SimpleBoot_isProxy" in target)) {
11018
+ for (const key in target) {
11019
+ if (!isSimNoProxy(target, key)) {
11020
+ target[key] = this.proxy(target[key]);
11021
+ }
11022
+ }
11023
+ const protoTypeName = ObjectUtils.ownPropertyNames(target);
11024
+ protoTypeName.filter((it) => typeof target[it] === "function").filter((it) => !isSimNoProxy(target, it)).filter((it) => !("_SimpleBoot_isProxy" in target[it])).forEach((it) => {
11025
+ target[it] = new Proxy(target[it], this.simProxyHandler);
11026
+ });
11027
+ if (this.simProxyHandler) {
11028
+ target = new Proxy(target, this.simProxyHandler);
11029
+ }
11030
+ }
11031
+ if (this.option.proxy) {
11032
+ target = this.option.proxy.onAfterProxy(target);
11033
+ }
11034
+ return target;
11035
+ } catch (e) {
11036
+ console.log("sim proxy error");
11037
+ throw e;
11038
+ }
11039
+ }
11040
+ run(otherInstanceSim = /* @__PURE__ */ new Map()) {
11041
+ for (const [k, v] of Array.from(otherInstanceSim.entries())) {
11042
+ const storageKey = typeof k === "object" && k !== null && "type" in k ? k.type : k;
11043
+ this.registerStore(storageKey, /* @__PURE__ */ new Set([v]));
11044
+ if (typeof k === "object" && k !== null && "symbol" in k && k.symbol) {
11045
+ this.registerStore(k.symbol, /* @__PURE__ */ new Set([v]));
11046
+ }
11047
+ }
11048
+ const myContainers = ConvertUtils.flatArray(this.option.container).filter(ValidUtils.isDefined);
11049
+ if (!myContainers.includes(this.simpleApplication)) {
11050
+ myContainers.push(this.simpleApplication);
11051
+ }
11052
+ Array.from(sims.entries()).forEach(([type, implementations]) => {
11053
+ const filteredSet = /* @__PURE__ */ new Set();
11054
+ implementations.forEach((impl) => {
11055
+ const config = getSim(impl);
11056
+ const targetContainers = ConvertUtils.flatArray(config?.container).filter(ValidUtils.isDefined);
11057
+ let isInclude = false;
11058
+ if (targetContainers.length <= 0) {
11059
+ if (myContainers.length === 1 && myContainers[0] === this.simpleApplication) {
11060
+ isInclude = true;
11061
+ }
11062
+ } else {
11063
+ isInclude = myContainers.some((it) => targetContainers.includes(it));
11064
+ }
11065
+ if (isInclude) {
11066
+ filteredSet.add(impl);
11067
+ }
11068
+ });
11069
+ if (filteredSet.size > 0) {
11070
+ this.registerStore(type, filteredSet);
11071
+ }
11072
+ });
11073
+ this.callBindPostConstruct(this);
11074
+ this.getSimAtomics().forEach((it) => {
11075
+ if (it.getConfig()?.autoCreate) {
11076
+ it.getValue();
11077
+ }
11078
+ });
11079
+ }
11080
+ };
11081
+
11082
+ // ../simple-boot/dist/esm/intent/Intent.js
11083
+ var Intent = class {
11084
+ constructor(uri, data) {
11085
+ this.uri = uri;
11086
+ this.data = data;
11087
+ this.sessionData = /* @__PURE__ */ new Map();
11088
+ if (typeof uri === "string") {
11089
+ const match = uri.match(/^Symbol\.for\((.+)\):\/(.*)$/);
11090
+ if (match) {
11091
+ const symbol = Symbol.for(match[1]);
11092
+ this.uri = {
11093
+ symbol,
11094
+ uri: `/${match[2]}`
11095
+ };
11096
+ }
11097
+ }
11098
+ }
11099
+ get symbols() {
11100
+ if (typeof this.uri === "object" && "symbol" in this.uri) {
11101
+ return Array.isArray(this.uri.symbol) ? this.uri.symbol : [this.uri.symbol];
11102
+ }
11103
+ return void 0;
11104
+ }
11105
+ get types() {
11106
+ if (typeof this.uri === "object" && "type" in this.uri) {
11107
+ return this.uri.type;
11108
+ }
11109
+ return void 0;
11110
+ }
11111
+ get scheme() {
11112
+ if (typeof this.uri === "string") {
11113
+ const parts = this.uri.split("://");
11114
+ if (parts.length > 1) {
11115
+ return parts[0];
11116
+ }
11117
+ return void 0;
11118
+ } else {
11119
+ return void 0;
11120
+ }
11121
+ }
11122
+ get paths() {
11123
+ if (typeof this.uri === "object" && "type" in this.uri && "target" in this.uri) {
11124
+ return [String(this.uri.target)];
11125
+ }
11126
+ return this.pathname.split("/") ?? [];
11127
+ }
11128
+ get fullPath() {
11129
+ if (typeof this.uri === "object" && "type" in this.uri && "target" in this.uri) {
11130
+ return `/${String(this.uri.target)}`;
11131
+ }
11132
+ const uri = typeof this.uri === "string" ? this.uri : this.uri.uri;
11133
+ const paths = uri.split("://");
11134
+ return paths[paths.length >= 2 ? 1 : 0] ?? "";
11135
+ }
11136
+ get pathname() {
11137
+ const paths = this.fullPath.split("?");
11138
+ return paths[0];
11139
+ }
11140
+ get query() {
11141
+ const paths = this.fullPath.split("?");
11142
+ return paths[1] ?? "";
11143
+ }
11144
+ getQueryParamDecodeURI(key) {
11145
+ const p = this.queryParamsDecodeURI;
11146
+ if (key) {
11147
+ return p[key];
11148
+ } else {
11149
+ return p;
11150
+ }
11151
+ }
11152
+ getQueryParamDecodeURIFirst(key) {
11153
+ const param = this.getQueryParamDecodeURI(key);
11154
+ if (Array.isArray(param)) {
11155
+ return param[0];
11156
+ } else {
11157
+ return param;
11158
+ }
11159
+ }
11160
+ getQueryParam(key) {
11161
+ const p = this.queryParams;
11162
+ if (key) {
11163
+ return p[key];
11164
+ } else {
11165
+ return p;
11166
+ }
11167
+ }
11168
+ getQueryParamFirst(key) {
11169
+ const param = this.getQueryParam(key);
11170
+ if (Array.isArray(param)) {
11171
+ return param[0];
11172
+ } else {
11173
+ return param;
11174
+ }
11175
+ }
11176
+ get queryParams() {
11177
+ const param = {};
11178
+ this.query.split("&")?.forEach((it) => {
11179
+ const a = it.split("=");
11180
+ if (param[a[0]]) {
11181
+ if (Array.isArray(param[a[0]])) {
11182
+ param[a[0]].push(a[1]);
11183
+ } else {
11184
+ param[a[0]] = [param[a[0]], a[1]];
11185
+ }
11186
+ } else {
11187
+ param[a[0]] = a[1];
11188
+ }
11189
+ });
11190
+ return param;
11191
+ }
11192
+ get queryParamsDecodeURI() {
11193
+ const params = this.queryParams;
11194
+ for (const key in params) {
11195
+ if (params.hasOwnProperty(key)) {
11196
+ const param = params[key];
11197
+ if (Array.isArray(param)) {
11198
+ params[key] = param.map((p) => decodeURIComponent(p));
11199
+ } else {
11200
+ params[key] = decodeURIComponent(param);
11201
+ }
11202
+ }
11203
+ }
11204
+ return params;
11205
+ }
11206
+ getPathnameData(urlExpression) {
11207
+ return Expression.Path.pathNameData(this.pathname, urlExpression);
11208
+ }
11209
+ get isSymbolScheme() {
11210
+ return this.symbols !== void 0;
11211
+ }
11212
+ };
11213
+
11214
+ // ../simple-boot/dist/esm/intent/IntentSubscribe.js
11215
+ var isIntentSubscribe = (obj) => {
11216
+ return !!obj && typeof obj.intentSubscribe === "function";
11217
+ };
11218
+
11219
+ // ../simple-boot/dist/esm/intent/IntentManager.js
11220
+ var isRouterPublishType = (it) => typeof it === "object" && it !== null && typeof it.router === "string" && typeof it.rootRouter === "function";
11221
+ var isSymbolPublishType = (it) => typeof it === "object" && it !== null && "symbol" in it && "path" in it;
11222
+ var isSchemePublishType = (it) => typeof it === "object" && it !== null && "scheme" in it && "path" in it;
11223
+ var isTypePublishType = (it) => typeof it === "object" && it !== null && "type" in it && "target" in it;
11224
+ var IntentManager = class {
11225
+ constructor(simpleApplication, simstanceManager, routerManager, simOption) {
11226
+ this.simpleApplication = simpleApplication;
11227
+ this.simstanceManager = simstanceManager;
11228
+ this.routerManager = routerManager;
11229
+ this.simOption = simOption;
11230
+ this.subject = new Subject();
11231
+ }
11232
+ get observable() {
11233
+ return this.subject.asObservable();
11234
+ }
11235
+ async makeIntentData(it, data) {
11236
+ const target = [];
11237
+ const rootRouter = isRouterPublishType(it) ? it.rootRouter : this.simOption.rootRouter;
11238
+ if (isRouterPublishType(it)) {
11239
+ it = it.router;
11240
+ }
11241
+ const routerMatch = typeof it === "string" && it.match(/^Router\((.+)\):\/(.*)$/);
11242
+ if (routerMatch && typeof it === "string") {
11243
+ const routerBasePath = routerMatch[1];
11244
+ const actualPath = routerMatch[2];
11245
+ const routerModule = await this.routerManager.routing(routerBasePath, {
11246
+ router: rootRouter
11247
+ });
11248
+ const instance = routerModule.getModuleInstance();
11249
+ if (instance) {
11250
+ target.push(instance);
11251
+ }
11252
+ it = new Intent(actualPath, data);
11253
+ } else if (isSymbolPublishType(it)) {
11254
+ it = new Intent({ symbol: it.symbol, uri: it.path }, data);
11255
+ } else if (isTypePublishType(it)) {
11256
+ it = new Intent({ type: it.type, target: it.target }, data);
11257
+ } else if (isSchemePublishType(it)) {
11258
+ it = new Intent(`${it.scheme}://${it.path}`, data);
11259
+ } else if (typeof it === "string") {
11260
+ it = new Intent(it, data);
11261
+ }
11262
+ const intent = it;
11263
+ if (!routerMatch) {
11264
+ if (intent.types) {
11265
+ target.push(...this.simstanceManager.findSims({ type: intent.types }));
11266
+ } else if (intent.symbols) {
11267
+ target.push(...intent.symbols.map((sym) => this.simstanceManager.findSims(sym)).flat());
11268
+ } else if (intent.scheme) {
11269
+ target.push(...this.simstanceManager.getSimConfig(intent.scheme));
11270
+ } else {
11271
+ target.push(...this.simstanceManager.getSimAtomics());
11272
+ }
11273
+ }
11274
+ return { intent, target };
11275
+ }
11276
+ async publishMeta(it, data) {
11277
+ const { intent, target } = await this.makeIntentData(it, data);
11278
+ const r = [];
11279
+ const targetInstances = target.map((it2) => {
11280
+ if (it2 instanceof SimAtomic) {
11281
+ return it2.getValue();
11282
+ } else {
11283
+ return it2;
11284
+ }
11285
+ });
11286
+ this.subject.next(intent);
11287
+ for (let data2 of targetInstances) {
11288
+ let orNewSim = data2;
11289
+ if (orNewSim) {
11290
+ const filteredPaths = intent.paths.filter((i) => i);
11291
+ if (filteredPaths.length > 0) {
11292
+ let callthis = orNewSim;
11293
+ let lastProp = "";
11294
+ filteredPaths.forEach((i) => {
11295
+ callthis = orNewSim;
11296
+ orNewSim = orNewSim?.[i];
11297
+ lastProp = i;
11298
+ });
11299
+ if (orNewSim && typeof orNewSim === "function") {
11300
+ const intentData = Array.isArray(intent.data) ? intent.data : intent.data !== void 0 ? [intent.data] : [];
11301
+ const result = await this.simstanceManager.executeBindParameterSimPromise({
11302
+ target: callthis,
11303
+ targetKey: String(lastProp),
11304
+ parameterCount: intentData.length,
11305
+ inputParameters: intentData,
11306
+ firstCheckMaker: [
11307
+ (obj, token, idx) => {
11308
+ if (idx < intentData.length) {
11309
+ return intentData[idx];
11310
+ }
11311
+ if (token === Intent && idx === 0) {
11312
+ return intent;
11313
+ }
11314
+ }
11315
+ ]
11316
+ });
11317
+ r.push(result);
11318
+ } else if (orNewSim) {
11319
+ callthis[lastProp] = intent.data;
11320
+ r.push(callthis[lastProp]);
11321
+ }
11322
+ } else {
11323
+ const intentData = Array.isArray(intent.data) ? intent.data : intent.data !== void 0 ? [intent.data] : [];
11324
+ if (isIntentSubscribe(orNewSim)) {
11325
+ r.push(orNewSim.intentSubscribe(...intentData));
11326
+ }
11327
+ }
11328
+ }
11329
+ }
11330
+ return { return: r, target };
11331
+ }
11332
+ async publish(it, data) {
11333
+ const rdata = await this.publishMeta(it, data);
11334
+ return rdata.return;
11335
+ }
11336
+ };
11337
+
11338
+ // ../simple-boot/dist/esm/decorators/inject/Injection.js
11339
+ var InjectionMetadataKey = Symbol("Injection");
11340
+ var getInjection = (target, propertyKey) => {
11341
+ return ReflectUtils.getMetadata(InjectionMetadataKey, target, propertyKey);
11342
+ };
11343
+
11344
+ // ../simple-boot/dist/esm/throwable/MethodNoSuch.js
11345
+ var MethodNoSuch = class extends SimError {
11346
+ constructor(message, name, propertyKeys, stack) {
11347
+ super(message, name, stack);
11348
+ this.propertyKeys = propertyKeys;
11349
+ }
11350
+ };
11351
+
11352
+ // ../simple-boot/dist/esm/decorators/route/Router.js
11353
+ var RouterMetadataKey = Symbol.for("simple-boot:router-metadata");
11354
+ var getRouter = (target) => {
11355
+ if (target != null && typeof target === "object") {
11356
+ target = target.constructor;
11357
+ }
11358
+ try {
11359
+ return ReflectUtils.getMetadata(RouterMetadataKey, target);
11360
+ } catch (e) {
11361
+ }
11362
+ };
11363
+ var RouteMetadataKey = Symbol.for("simple-boot:route-metadata");
11364
+
11365
+ // ../simple-boot/dist/esm/route/RouterModule.js
11366
+ var RouterModule = class {
11367
+ constructor(simstanceManager, router, module, routerChains = []) {
11368
+ this.simstanceManager = simstanceManager;
11369
+ this.router = router;
11370
+ this.module = module;
11371
+ this.routerChains = routerChains;
11372
+ }
11373
+ get path() {
11374
+ return this._path;
11375
+ }
11376
+ set path(value) {
11377
+ this._path = value;
11378
+ }
11379
+ get data() {
11380
+ return this._data;
11381
+ }
11382
+ set data(value) {
11383
+ this._data = value;
11384
+ }
11385
+ get intent() {
11386
+ return this._intent;
11387
+ }
11388
+ set intent(value) {
11389
+ this._intent = value;
11390
+ }
11391
+ get propertyKeys() {
11392
+ return this._propertyKeys;
11393
+ }
11394
+ set propertyKeys(value) {
11395
+ this._propertyKeys = value;
11396
+ }
11397
+ get pathData() {
11398
+ return this._pathData;
11399
+ }
11400
+ getPathData() {
11401
+ return this._pathData;
11402
+ }
11403
+ set pathData(value) {
11404
+ this._pathData = value;
11405
+ }
11406
+ getRouterPath(join = "") {
11407
+ return this.getRouterPaths().map((it) => it ?? "").join(join);
11408
+ }
11409
+ getRouterPaths() {
11410
+ return this.routerChains.map((it) => getRouter(it instanceof SimAtomic ? it.type.targetKeyType : it)?.path);
11411
+ }
11412
+ getRouterPathData(pathName) {
11413
+ return Expression.Path.pathNameData(pathName, this.getRouterPath());
11414
+ }
11415
+ getModuleInstance(propertyKey, instanceBind = true) {
11416
+ const instance = this.simstanceManager.getOrNewSim({ target: this.module?.targetKeyType, originTypeTarget: this.module?.originalType });
11417
+ if (propertyKey && this.propertyKeys && this.propertyKeys.includes(propertyKey)) {
11418
+ let instanceElement = instance[propertyKey];
11419
+ if (instanceBind && typeof instanceBind === "boolean") {
11420
+ instanceElement = instanceElement.bind(instance);
11421
+ } else if (instanceBind && typeof instanceBind === "object") {
11422
+ instanceElement = instanceElement.bind(instanceBind);
11423
+ }
11424
+ return instanceElement;
11425
+ } else {
11426
+ return instance;
11427
+ }
11428
+ }
11429
+ executeModuleProperty(propertyKey, ...param) {
11430
+ const target = this.getModuleInstance();
11431
+ if (propertyKey) {
11432
+ const config = getInjection(target, propertyKey);
11433
+ if (config) {
11434
+ const other = /* @__PURE__ */ new Map();
11435
+ param.forEach((it) => other.set(it.constructor, it));
11436
+ return this.simstanceManager.executeBindParameterSim({ target, targetKey: propertyKey }, other);
11437
+ } else {
11438
+ if (target[propertyKey]) {
11439
+ return target[propertyKey]?.(...param);
11440
+ } else {
11441
+ throw new MethodNoSuch(`${propertyKey.toString()} noSuch`, propertyKey.toString(), propertyKey);
11442
+ }
11443
+ }
11444
+ }
11445
+ }
11446
+ get firstRouteChain() {
11447
+ return this.routerChains[0];
11448
+ }
11449
+ get firstRouteChainValue() {
11450
+ return this.firstRouteChain?.getValue();
11451
+ }
11452
+ get lastRouteChain() {
11453
+ return this.routerChains[this.routerChains.length - 1];
11454
+ }
11455
+ get lastRouteChainValue() {
11456
+ return this.lastRouteChain?.getValue();
11457
+ }
11458
+ hasActivateInLastRoute(obj) {
11459
+ return this.lastRouteChainValue?.hasActivate(obj) === true;
11460
+ }
11461
+ getQueryParamDecodeURI(key) {
11462
+ if (this.intent) {
11463
+ return this.intent.getQueryParamDecodeURI(key);
11464
+ }
11465
+ }
11466
+ getQueryParamDecodeURIFirst(key) {
11467
+ if (this.intent) {
11468
+ return this.intent.getQueryParamDecodeURIFirst(key);
11469
+ }
11470
+ }
11471
+ getQueryParam(key) {
11472
+ if (this.intent) {
11473
+ return this.intent.getQueryParam(key);
11474
+ }
11475
+ }
11476
+ getQueryParamFirst(key) {
11477
+ if (this.intent) {
11478
+ return this.intent.getQueryParamFirst(key);
11479
+ }
11480
+ }
11481
+ get queryParams() {
11482
+ if (this.intent) {
11483
+ return this.intent.queryParams;
11484
+ }
11485
+ }
11486
+ get queryParamsAfterDecodeURI() {
11487
+ if (this.intent) {
11488
+ return this.intent.queryParamsDecodeURI;
11489
+ }
11490
+ }
11491
+ };
11492
+
11493
+ // ../simple-boot/dist/esm/route/RouterAction.js
11494
+ var RouterAction;
11495
+ ((RouterAction2) => {
11496
+ RouterAction2.isCanActivate = (obj) => {
11497
+ return typeof obj?.canActivate === "function";
11498
+ };
11499
+ RouterAction2.isOnRouting = (obj) => {
11500
+ return typeof obj?.onRouting === "function";
11501
+ };
11502
+ RouterAction2.isHasActivate = (obj) => {
11503
+ return typeof obj?.hasActivate === "function";
11504
+ };
11505
+ })(RouterAction || (RouterAction = {}));
11506
+
11507
+ // ../simple-boot/dist/esm/route/RouterManager.js
11508
+ var RouterManager = class {
11509
+ constructor(simpleApplication, simstanceManager, simOption) {
11510
+ this.simpleApplication = simpleApplication;
11511
+ this.simstanceManager = simstanceManager;
11512
+ this.simOption = simOption;
11513
+ this.subject = new Subject();
11514
+ }
11515
+ // @SimNoProxy
11516
+ get observable() {
11517
+ return this.subject.asObservable();
11518
+ }
11519
+ routingMap(option) {
11520
+ const targetRouter = option?.router ?? this.simOption.rootRouter;
11521
+ if (!targetRouter) {
11522
+ throw new Error("no router");
11523
+ }
11524
+ const map = {};
11525
+ if (targetRouter) {
11526
+ const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
11527
+ const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
11528
+ const routerAtomic = new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
11529
+ const routerData = routerAtomic.getConfig(RouterMetadataKey);
11530
+ if (routerData) {
11531
+ const currentPrefix = (option?.prefix ?? "") + routerData.path;
11532
+ if (routerData.route && routerData.route[""]) {
11533
+ map[currentPrefix] = routerData.route[""];
11534
+ }
11535
+ if (routerData.route) {
11536
+ Object.entries(routerData.route).forEach(([key, value]) => {
11537
+ map[currentPrefix + key] = value;
11538
+ });
11539
+ }
11540
+ routerData.routers?.forEach((it) => {
11541
+ Object.assign(map, this.routingMap({ ...option, router: it, prefix: currentPrefix }));
11542
+ });
11543
+ }
11544
+ }
11545
+ return map;
11546
+ }
11547
+ /** 일반적인 lifecycle 타지않는 그냥 find.. 의미가없을듯.
11548
+ * @deprecated
11549
+ */
11550
+ async routings(intent, option) {
11551
+ const targetRouter = option?.router ?? this.simOption.rootRouter;
11552
+ if (!targetRouter) {
11553
+ throw new Error("no router");
11554
+ }
11555
+ const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
11556
+ const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
11557
+ const routerAtomic = new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
11558
+ const allMatches = this._collectAllMatchingModules(routerAtomic, intent, []);
11559
+ const exactModuleMatches = allMatches.filter((rm) => rm.path === intent.pathname && rm.module);
11560
+ if (exactModuleMatches.length > 0) {
11561
+ exactModuleMatches.forEach((it) => this.subject.next({ intent, routerManager: this, routerModule: it }));
11562
+ return exactModuleMatches;
11563
+ }
11564
+ const exactPathMatches = allMatches.filter((rm) => rm.path === intent.pathname);
11565
+ if (exactPathMatches.length > 0) {
11566
+ exactPathMatches.forEach((it) => this.subject.next({ intent, routerManager: this, routerModule: it }));
11567
+ return exactPathMatches;
11568
+ }
11569
+ return [];
11570
+ }
11571
+ async routing(intent, option) {
11572
+ if (typeof intent === "string") {
11573
+ intent = new Intent(intent);
11574
+ }
11575
+ const targetRouter = option?.router ?? this.simOption.rootRouter;
11576
+ const callCheckOnRouting = option?.noOnRouting !== true;
11577
+ if (!targetRouter) {
11578
+ debugger;
11579
+ throw new Error("no router");
11580
+ }
11581
+ const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
11582
+ const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
11583
+ const routerAtomic = typeof targetType === "symbol" ? this.simstanceManager.findFirstSim(targetType) : new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
11584
+ const rootRouter = routerAtomic.getValue();
11585
+ const executeModuleResult = this.getExecuteModule(routerAtomic, intent, [], option);
11586
+ if (executeModuleResult) {
11587
+ const [executeModule, routerChains] = executeModuleResult;
11588
+ executeModule.routerChains = routerChains;
11589
+ this.activeRouterModule = executeModule;
11590
+ const routingDataSet = { intent, routerModule: executeModule, routerManager: this };
11591
+ if (routerChains.length > 0) {
11592
+ for (let i = 0; i < routerChains.length; i++) {
11593
+ const current = routerChains[i];
11594
+ const next = routerChains[i + 1];
11595
+ const value = current.getValue();
11596
+ if (RouterAction.isCanActivate(value) && next) {
11597
+ await value.canActivate(routingDataSet, next.getValue());
11598
+ }
11599
+ if (callCheckOnRouting && RouterAction.isOnRouting(value) && next) {
11600
+ await value.onRouting(routingDataSet);
11601
+ }
11602
+ }
11603
+ }
11604
+ this.activeRouterModule = executeModule;
11605
+ const moduleInstance = executeModule.getModuleInstance();
11606
+ if (!executeModule?.module) {
11607
+ const routerChain = executeModule.routerChains[executeModule.routerChains.length - 1];
11608
+ const value = routerChain?.getValue();
11609
+ if (RouterAction.isCanActivate(value)) {
11610
+ await value.canActivate(routingDataSet, moduleInstance);
11611
+ }
11612
+ if (callCheckOnRouting && RouterAction.isOnRouting(value)) {
11613
+ await value.onRouting(routingDataSet);
11614
+ }
11615
+ } else {
11616
+ const value = executeModule.router?.getValue();
11617
+ if (RouterAction.isCanActivate(value)) {
11618
+ await value.canActivate(routingDataSet, moduleInstance);
11619
+ }
11620
+ if (callCheckOnRouting && RouterAction.isOnRouting(value)) {
11621
+ await value.onRouting(routingDataSet);
11622
+ }
11623
+ if (moduleInstance && callCheckOnRouting && RouterAction.isOnRouting(moduleInstance)) {
11624
+ await moduleInstance.onRouting(routingDataSet);
11625
+ }
11626
+ }
11627
+ const find = this.activeRouterModule;
11628
+ this.subject.next({ intent, routerModule: find, routerManager: this });
11629
+ return find;
11630
+ } else {
11631
+ const empty = await this._handleNotFoundRouting(rootRouter, intent);
11632
+ this.subject.next({ intent, routerModule: empty, routerManager: this });
11633
+ return empty;
11634
+ }
11635
+ }
11636
+ /**
11637
+ * URL과 일치하는 라우트를 찾지 못했을 경우를 처리합니다.
11638
+ * "Not Found" 상태를 나타내는 비어있는 RouterModule 객체를 생성하여 반환합니다.
11639
+ * 이 과정에서 rootRouter의 라이프사이클을 호출하여 공통 레이아웃등을 처리할 수 있습니다.
11640
+ * @param rootRouter 앱의 최상위 라우터 인스턴스
11641
+ * @param intent 확인에 실패한 원본 Intent 객체
11642
+ * @private
11643
+ */
11644
+ async _handleNotFoundRouting(rootRouter, intent) {
11645
+ const routerModule = new RouterModule(this.simstanceManager, rootRouter, void 0, []);
11646
+ const routingDataSet = { intent, routerModule, routerManager: this };
11647
+ const value = rootRouter;
11648
+ if (RouterAction.isCanActivate(value)) {
11649
+ await value.canActivate(routingDataSet, null);
11650
+ }
11651
+ if (RouterAction.isOnRouting(value)) {
11652
+ await value.onRouting(routingDataSet);
11653
+ }
11654
+ this.activeRouterModule = routerModule;
11655
+ return this.activeRouterModule;
11656
+ }
11657
+ getExecuteModule(router, intent, parentRouters, option) {
11658
+ const path = intent.pathname;
11659
+ const routerConfig = router.getConfig(RouterMetadataKey);
11660
+ if (routerConfig) {
11661
+ const filters = [];
11662
+ if (Array.isArray(routerConfig.filters)) {
11663
+ filters.push(...routerConfig.filters);
11664
+ } else if (routerConfig.filters) {
11665
+ filters.push(routerConfig.filters);
11666
+ }
11667
+ const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
11668
+ if (noAccept) {
11669
+ return;
11670
+ }
11671
+ const routerStrings = parentRouters.map((it) => it.getConfig(RouterMetadataKey)?.path || "");
11672
+ const isRoot = this.isRootUrl(routerConfig.path, routerStrings, path);
11673
+ if (isRoot) {
11674
+ const currentParentRouters = [...parentRouters, router];
11675
+ if (routerConfig.routers && routerConfig.routers.length > 0) {
11676
+ let bestMatchModule = void 0;
11677
+ let bestMatchLength = -1;
11678
+ for (const child of routerConfig.routers) {
11679
+ const routerAtomic = typeof child === "symbol" ? this.simstanceManager.findFirstSim(child) : new SimAtomic({ targetKeyType: child, originalType: child }, this.simstanceManager);
11680
+ if (!routerAtomic) {
11681
+ continue;
11682
+ }
11683
+ const executeModule = this.getExecuteModule(routerAtomic, intent, currentParentRouters, option);
11684
+ if (executeModule) {
11685
+ const [rm, chains] = executeModule;
11686
+ const currentMatchLength = rm.path?.length || 0;
11687
+ if (currentMatchLength > bestMatchLength) {
11688
+ bestMatchLength = currentMatchLength;
11689
+ bestMatchModule = executeModule;
11690
+ } else if (currentMatchLength === bestMatchLength) {
11691
+ if (option?.find?.router === "last") {
11692
+ bestMatchModule = executeModule;
11693
+ }
11694
+ }
11695
+ }
11696
+ }
11697
+ if (bestMatchModule) {
11698
+ return bestMatchModule;
11699
+ }
11700
+ }
11701
+ const module = this.findRouterOrModule(router, routerConfig, routerStrings, intent);
11702
+ if (module) {
11703
+ return [module, currentParentRouters];
11704
+ }
11705
+ }
11706
+ }
11707
+ }
11708
+ // path: 지금 내 라우터의 path, parentRoots: 부모router path들, url: 사용자가 원하는 full intent url
11709
+ isRootUrl(path, parentRoots, url) {
11710
+ const searchString = parentRoots.join("") + (path || "");
11711
+ if (searchString === "/") {
11712
+ return true;
11713
+ }
11714
+ const searchs = searchString.split("/");
11715
+ const urls = url.split("/");
11716
+ const trimmedUrls = urls.slice(0, searchs.length).join("/");
11717
+ return !!Expression.Path.pathNameData(trimmedUrls, searchString);
11718
+ }
11719
+ _collectAllMatchingModules(router, intent, parentRouters) {
11720
+ const matches = [];
11721
+ const path = intent.pathname;
11722
+ const routerConfig = router.getConfig(RouterMetadataKey);
11723
+ if (routerConfig) {
11724
+ const filters = [];
11725
+ if (Array.isArray(routerConfig.filters)) {
11726
+ filters.push(...routerConfig.filters);
11727
+ } else if (routerConfig.filters) {
11728
+ filters.push(routerConfig.filters);
11729
+ }
11730
+ const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
11731
+ if (noAccept) {
11732
+ return matches;
11733
+ }
11734
+ const routerStrings = parentRouters.map((it) => it.getConfig(RouterMetadataKey)?.path || "");
11735
+ const isRoot = this.isRootUrl(routerConfig.path, routerStrings, path);
11736
+ if (isRoot) {
11737
+ const currentParentRouters = [...parentRouters, router];
11738
+ if (routerConfig.routers && routerConfig.routers.length > 0) {
11739
+ for (const child of routerConfig.routers) {
11740
+ const routerAtomic = typeof child === "symbol" ? this.simstanceManager.findFirstSim(child) : new SimAtomic({ targetKeyType: child, originalType: child }, this.simstanceManager);
11741
+ if (!routerAtomic) {
11742
+ continue;
11743
+ }
11744
+ matches.push(...this._collectAllMatchingModules(routerAtomic, intent, currentParentRouters));
11745
+ }
11746
+ }
11747
+ const module = this.findRouterOrModule(router, routerConfig, routerStrings, intent);
11748
+ if (module) {
11749
+ module.routerChains = currentParentRouters;
11750
+ matches.push(module);
11751
+ }
11752
+ }
11753
+ }
11754
+ return matches;
11755
+ }
11756
+ findRouterOrModule(router, routerData, parentRoots, intent) {
11757
+ const module = this.findRouting(router, routerData, parentRoots, intent);
11758
+ if (module?.module) {
11759
+ module.intent = intent;
11760
+ return module;
11761
+ }
11762
+ const urlRoot = parentRoots.join("") + (routerData.path || "");
11763
+ if (this.isRootUrl(routerData.path, parentRoots, intent.pathname)) {
11764
+ const rm = new RouterModule(this.simstanceManager, router);
11765
+ rm.intent = intent;
11766
+ rm.path = urlRoot;
11767
+ rm.pathData = intent.getPathnameData(urlRoot);
11768
+ return rm;
11769
+ }
11770
+ return void 0;
11771
+ }
11772
+ findRouting(router, routerData, parentRoots, intent) {
11773
+ const urlRoot = parentRoots.join("") + routerData.path;
11774
+ if (routerData.route) {
11775
+ for (const it of Object.keys(routerData.route).filter((it2) => !it2.startsWith("_"))) {
11776
+ const path = urlRoot + it;
11777
+ const pathnameData = intent.getPathnameData(path);
11778
+ if (pathnameData) {
11779
+ try {
11780
+ const dataSet = this.findRouteProperty(routerData.route, it, intent);
11781
+ const rm = new RouterModule(this.simstanceManager, router, dataSet.child);
11782
+ rm.data = dataSet.data;
11783
+ rm.path = path;
11784
+ rm.pathData = pathnameData;
11785
+ rm.propertyKeys = dataSet.propertyKeys;
11786
+ return rm;
11787
+ } catch (e) {
11788
+ }
11789
+ }
11790
+ }
11791
+ }
11792
+ }
11793
+ findRouteProperty(route, propertyName, intent) {
11794
+ let child;
11795
+ let data;
11796
+ let propertyKeys;
11797
+ const routeElement = route[propertyName];
11798
+ if (typeof routeElement === "function") {
11799
+ child = { targetKeyType: routeElement, originalType: routeElement };
11800
+ } else if (typeof routeElement === "symbol") {
11801
+ const findSimType = this.simstanceManager.findLastSim(routeElement)?.type;
11802
+ if (findSimType?.originalType) {
11803
+ child = { targetKeyType: findSimType.originalType, originalType: findSimType.originalType };
11804
+ }
11805
+ } else if (typeof routeElement === "string") {
11806
+ return this.findRouteProperty(route, routeElement, intent);
11807
+ } else if (Array.isArray(routeElement)) {
11808
+ const r = routeElement?.[0];
11809
+ if (typeof r === "object" && "filters" in r && "target" in r) {
11810
+ const filters = [];
11811
+ if (Array.isArray(r.filters)) {
11812
+ filters.push(...r.filters);
11813
+ } else if (r.filters) {
11814
+ filters.push(r.filters);
11815
+ }
11816
+ const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
11817
+ if (!noAccept) {
11818
+ child = { targetKeyType: r.target, originalType: r.target };
11819
+ }
11820
+ } else {
11821
+ child = { targetKeyType: r, originalType: r };
11822
+ }
11823
+ data = routeElement?.[1];
11824
+ } else if (typeof routeElement === "object" && "target" in routeElement && "propertyKeys" in routeElement) {
11825
+ const noAccept = routeElement.filters?.filter((it) => it).some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
11826
+ if (!noAccept) {
11827
+ child = { targetKeyType: routeElement.target, originalType: routeElement.target };
11828
+ propertyKeys = routeElement.propertyKeys;
11829
+ }
11830
+ } else if (typeof routeElement === "object" && "filters" in routeElement && "target" in routeElement) {
11831
+ const filters = [];
11832
+ if (Array.isArray(routeElement.filters)) {
11833
+ filters.push(...routeElement.filters);
11834
+ } else if (routeElement.filters) {
11835
+ filters.push(routeElement.filters);
11836
+ }
11837
+ const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
11838
+ if (!noAccept) {
11839
+ child = { targetKeyType: routeElement.target, originalType: routeElement.target };
11840
+ }
11841
+ }
11842
+ return {
11843
+ child,
11844
+ data,
11845
+ propertyKeys
11846
+ };
11847
+ }
11848
+ };
11849
+
11850
+ // ../simple-boot/dist/esm/decorators/cache/CacheDecorator.js
11851
+ var simpleApplicationCache = /* @__PURE__ */ new WeakMap();
11852
+ var getCacheSet = (simpleApplication) => {
11853
+ return simpleApplicationCache.get(simpleApplication);
11854
+ };
11855
+ var findCacheByKey = (simpleApplication, key) => {
11856
+ const storage = simpleApplicationCache.get(simpleApplication);
11857
+ if (storage) {
11858
+ return Array.from(storage.config.entries()).find(([k, v]) => k === key);
11859
+ }
11860
+ };
11861
+ var findCacheByKeyStartWith = (simpleApplication, key) => {
11862
+ const storage = simpleApplicationCache.get(simpleApplication);
11863
+ if (storage) {
11864
+ return Array.from(storage.config.entries()).filter(([k, v]) => k.startsWith(key));
11865
+ } else {
11866
+ return [];
11867
+ }
11868
+ };
11869
+ var deleteCacheByKey = (simpleApplication, key) => {
11870
+ const storage = simpleApplicationCache.get(simpleApplication);
11871
+ if (storage) {
11872
+ storage.storage.delete(key);
11873
+ findCacheByKeyStartWith(simpleApplication, key).forEach(([k, v]) => {
11874
+ const data = storage.config.get(k);
11875
+ if (data?.expireTimeout) {
11876
+ clearTimeout(data.expireTimeout);
11877
+ }
11878
+ storage.config.delete(k);
11879
+ storage.storage.delete(k);
11880
+ });
11881
+ }
11882
+ };
11883
+ var deleteCacheByKeyStartWith = (simpleApplication, key) => {
11884
+ findCacheByKeyStartWith(simpleApplication, key).forEach(([key2, data]) => deleteCacheByKey(simpleApplication, key2));
11885
+ };
11886
+ var CacheMetadataKey = Symbol.for("simple-boot:cache-metadata");
11887
+
11888
+ // ../simple-boot/dist/esm/cache/CacheManager.js
11889
+ var CacheManager = class {
11890
+ constructor(simpleApplication) {
11891
+ this.simpleApplication = simpleApplication;
11892
+ }
11893
+ findCacheByKey(key) {
11894
+ return findCacheByKey(this.simpleApplication, key);
11895
+ }
11896
+ findCacheByKeyStartWith(key) {
11897
+ return findCacheByKeyStartWith(this.simpleApplication, key);
11898
+ }
11899
+ deleteCacheByKey(key) {
11900
+ return deleteCacheByKey(this.simpleApplication, key);
11901
+ }
11902
+ deleteCacheByKeyStartWith(key) {
11903
+ return deleteCacheByKeyStartWith(this.simpleApplication, key);
11904
+ }
11905
+ getCacheSet() {
11906
+ return getCacheSet(this.simpleApplication);
11907
+ }
11908
+ };
11909
+
11910
+ // ../simple-boot/dist/esm/fetch/ApiService.js
11911
+ var ApiServiceInterceptor;
11912
+ ((ApiServiceInterceptor2) => {
11913
+ ApiServiceInterceptor2.TOKEN = Symbol.for("simple-boot:api-service-interceptor-token");
11914
+ ApiServiceInterceptor2.resolveAll = (simstanceManager) => {
11915
+ try {
11916
+ return (simstanceManager.findSims(ApiServiceInterceptor2.TOKEN) ?? []).map((it) => it.getValue()).filter(ValidUtils.isDefined);
11917
+ } catch (e) {
11918
+ return [];
11919
+ }
11920
+ };
11921
+ })(ApiServiceInterceptor || (ApiServiceInterceptor = {}));
11922
+ var ApiService = class extends HttpJsonFetcher {
11923
+ constructor(simstanceManager, alertService) {
11924
+ super();
11925
+ this.simstanceManager = simstanceManager;
11926
+ this.subject = new Subject();
11927
+ this.alertService = alertService;
11928
+ }
11929
+ // @PostConstruct
11930
+ // postConstruct(alertService: AlertService<any>) {
11931
+ // this.alertService = alertService;
11932
+ // }
11933
+ get observable() {
11934
+ return this.subject.asObservable();
11935
+ }
11936
+ createPipe(config) {
11937
+ return {};
11938
+ }
11939
+ async beforeProxyFetch(config) {
11940
+ let interceptors = ApiServiceInterceptor.resolveAll(this.simstanceManager);
11941
+ for (const interceptor of interceptors) {
11942
+ if (interceptor.beforeProxyFetch) {
11943
+ config = await interceptor.beforeProxyFetch(config);
11944
+ }
11945
+ }
11946
+ this.subject.next({ type: "beforeFetchData", config });
11947
+ return config;
11948
+ }
11949
+ async afterProxyFetch(config) {
11950
+ let interceptors = ApiServiceInterceptor.resolveAll(this.simstanceManager);
11951
+ let r = config.response;
11952
+ for (const interceptor of interceptors) {
11953
+ if (interceptor.afterProxyFetch) {
11954
+ r = await interceptor.afterProxyFetch(config);
11955
+ }
11956
+ }
11957
+ this.subject.next({ type: "afterFetchData", response: r });
11958
+ return r;
11959
+ }
11960
+ beforeFetch(fetch2) {
11961
+ this.subject.next({ type: "beforeFetch", fetch: fetch2 });
11962
+ }
11963
+ afterFetch(fetch2, response) {
11964
+ this.subject.next({ type: "afterFetch", fetch: fetch2, response });
11965
+ }
11966
+ before(config, pipe) {
11967
+ this.subject.next({ type: "progress", config, pipe });
11968
+ config.config?.config?.callBackProgress?.(config, pipe);
11969
+ if (config.config?.config?.alertProgress) {
11970
+ const alert = this.alertService?.progress({ title: config.config.config.title });
11971
+ if (alert) {
11972
+ pipe.progress = alert;
11973
+ alert.activate();
11974
+ }
11975
+ }
11976
+ }
11977
+ afterSuccess(config, pipe) {
11978
+ this.subject.next({ type: "success", config, pipe });
11979
+ config.config?.config?.callBackSuccess?.(config, pipe);
11980
+ if (config.config?.config?.alertSuccessMsg) {
11981
+ this.alertService?.success({ title: config.config.config.title })?.activate();
11982
+ }
11983
+ }
11984
+ afterSuccessTransform(config, pipe) {
11985
+ }
11986
+ finally(config, pipe) {
11987
+ this.subject.next({ type: "final", config, pipe });
11988
+ config.config?.config?.callBackFinal?.(config, pipe);
11989
+ pipe.progress?.deActivate();
11990
+ }
11991
+ error(config, pipe, e) {
11992
+ console.log("error", e);
11993
+ this.subject.next({ type: "error", config, pipe, e });
11994
+ config.config?.config?.callBackError?.(config, pipe, e);
11995
+ if (config.config?.config?.alertErrorMsg) {
11996
+ this.alertService?.danger({
11997
+ title: `${config.config.config.title ? config.config.config.title : ""}${e.message ? `(${e.message})` : ""}`
11998
+ })?.activate();
11999
+ }
12000
+ if (config.config?.config?.enableErrorConsole) {
12001
+ console.error(`apiService Error ${config?.config?.config?.title}`, e);
12002
+ }
12003
+ }
12004
+ async execute(fetcherRequest) {
12005
+ const target = fetcherRequest.target;
12006
+ const config = fetcherRequest.config;
12007
+ let r = { target, config };
12008
+ const interceptor = ApiServiceInterceptor.resolveAll(this.simstanceManager) ?? [];
12009
+ for (const apiServiceInterceptor of interceptor) {
12010
+ if (apiServiceInterceptor.beforeProxyExecute) {
12011
+ r = await apiServiceInterceptor.beforeProxyExecute?.(r);
12012
+ }
12013
+ }
12014
+ return super.execute(r);
12015
+ }
12016
+ };
12017
+
12018
+ // ../simple-boot/dist/esm/alert/AlertAction.js
12019
+ var AlertAction = /* @__PURE__ */ ((AlertAction2) => {
12020
+ AlertAction2["ACTIVE"] = "ACTIVE";
12021
+ AlertAction2["IN_ACTIVE"] = "IN_ACTIVE";
12022
+ return AlertAction2;
12023
+ })(AlertAction || {});
12024
+
12025
+ // ../simple-boot/dist/esm/alert/Alert.js
12026
+ var Alert = class {
12027
+ constructor(alertService, config) {
12028
+ this.alertService = alertService;
12029
+ this.config = config;
12030
+ this.isActive = false;
12031
+ this.activateBefore = [];
12032
+ this.activateAfter = [];
12033
+ this.deActivateBefore = [];
12034
+ this.deActivateAfter = [];
12035
+ this.data = /* @__PURE__ */ new Map();
12036
+ if (config?.uuid) {
12037
+ this.uuid = config.uuid;
12038
+ } else {
12039
+ this.uuid = RandomUtils.uuid();
12040
+ }
12041
+ }
12042
+ addOpenBefore(fn) {
12043
+ this.activateBefore.push(fn);
12044
+ }
12045
+ addOpenAfter(fn) {
12046
+ this.activateAfter.push(fn);
12047
+ }
12048
+ addCloseBefore(fn) {
12049
+ this.deActivateBefore.push(fn);
12050
+ }
12051
+ addCloseAfter(fn) {
12052
+ this.deActivateAfter.push(fn);
12053
+ }
12054
+ setData(key, value) {
12055
+ this.data.set(key, value);
12056
+ }
12057
+ getData(key) {
12058
+ return this.data.get(key);
12059
+ }
12060
+ async activate() {
12061
+ try {
12062
+ await Promise.allSettled(this.activateBefore.map((it) => it())).then((it) => {
12063
+ this.result = this.make();
12064
+ this.alertService?.publish({ action: AlertAction.ACTIVE, alert: this });
12065
+ this.isActive = true;
12066
+ if (this.config?.closeTime !== void 0 && this.config?.closeTime > 0) {
12067
+ setTimeout(() => {
12068
+ this.deActivate();
12069
+ }, this.config.closeTime);
12070
+ }
12071
+ this.config?.activate?.(this.result, this);
12072
+ });
12073
+ } catch (e) {
12074
+ } finally {
12075
+ await Promise.allSettled(this.activateAfter.map((it) => it())).then((it) => {
12076
+ });
12077
+ }
12078
+ }
12079
+ async deActivate() {
12080
+ try {
12081
+ await Promise.allSettled(this.deActivateBefore.map((it) => it())).then((it) => {
12082
+ this.alertService?.publish({ action: AlertAction.IN_ACTIVE, alert: this });
12083
+ this.isActive = false;
12084
+ this.config?.deActivate?.(this.result, this);
12085
+ });
12086
+ } catch (e) {
12087
+ } finally {
12088
+ await Promise.allSettled(this.deActivateAfter.map((it) => it())).then((it) => {
12089
+ });
12090
+ }
12091
+ }
12092
+ };
12093
+
12094
+ // ../simple-boot/dist/esm/alert/AlertFactory.js
12095
+ var AlertFactory = class {
12096
+ };
12097
+ var DefaultAlertFactory = class extends AlertFactory {
12098
+ create(data) {
12099
+ return void 0;
12100
+ }
12101
+ };
12102
+
12103
+ // ../simple-boot/dist/esm/alert/AlertType.js
12104
+ var AlertType = /* @__PURE__ */ ((AlertType2) => {
12105
+ AlertType2["DANGER"] = "DANGER";
12106
+ AlertType2["NORMAL"] = "NORMAL";
12107
+ AlertType2["PROGRESS"] = "PROGRESS";
12108
+ AlertType2["SUCCESS"] = "SUCCESS";
12109
+ AlertType2["ERROR"] = "ERROR";
12110
+ AlertType2["INFO"] = "INFO";
12111
+ AlertType2["WARNING"] = "WARNING";
12112
+ AlertType2["CONSOLE"] = "CONSOLE";
12113
+ AlertType2["ETC"] = "ETC";
12114
+ return AlertType2;
12115
+ })(AlertType || {});
12116
+
12117
+ // ../simple-boot/dist/esm/alert/AlertService.js
12118
+ var AlertService = class {
12119
+ constructor(alertFactory) {
12120
+ this.name = (/* @__PURE__ */ new Date()).toUTCString();
12121
+ this.subject = new ReplaySubject();
12122
+ this.alertFactory = alertFactory;
12123
+ }
12124
+ // @PostConstruct
12125
+ // postConstruct(
12126
+ // ) {
12127
+ // this.alertFactory = alertFactory;
12128
+ // }
12129
+ // @PostConstruct
12130
+ // postConstruct(apiService: ApiService) {
12131
+ // this.apiService = alertFactory;
12132
+ // }
12133
+ get observable() {
12134
+ return this.subject.asObservable();
12135
+ }
12136
+ publish(data) {
12137
+ this.subject.next(data);
12138
+ }
12139
+ create(factory, config) {
12140
+ return new class extends Alert {
12141
+ make() {
12142
+ return factory(this);
12143
+ }
12144
+ }(this, config);
12145
+ }
12146
+ createFromFactory(type, config) {
12147
+ return this.alertFactory?.create({ caller: this, type, config });
12148
+ }
12149
+ danger(config) {
12150
+ return this.createFromFactory(AlertType.DANGER, config);
12151
+ }
12152
+ progress(config) {
12153
+ config = config ?? {};
12154
+ return this.createFromFactory(AlertType.PROGRESS, config);
12155
+ }
12156
+ success(config) {
12157
+ return this.createFromFactory(AlertType.SUCCESS, config);
12158
+ }
12159
+ info(config) {
12160
+ return this.createFromFactory(AlertType.INFO, config);
12161
+ }
12162
+ error(config) {
12163
+ return this.createFromFactory(AlertType.ERROR, config);
12164
+ }
12165
+ warning(config) {
12166
+ return this.createFromFactory(AlertType.WARNING, config);
12167
+ }
12168
+ };
12169
+
12170
+ // ../simple-boot/dist/esm/SimpleApplication.js
12171
+ var SimpleApplication = class _SimpleApplication {
12172
+ // public rootRouter?: ConstructorType<any>;
12173
+ // constructor();
12174
+ // constructor(option: SimOption);
12175
+ // constructor(rootRouter?: ConstructorType<Object> | Function);
12176
+ // constructor(rootRouter?: ConstructorType<Object> | Function, option?: SimOption);
12177
+ // constructor(rootRouter?: (ConstructorType<Object> | Function) | SimOption, option = new SimOption()) {
12178
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
12179
+ // private alertService: AlertService<any>;
12180
+ constructor(option = new SimOption()) {
12181
+ this.option = option;
12182
+ this.simstanceManager = new SimstanceManager(this, option);
12183
+ this.simstanceManager.setStoreSet(SimstanceManager, this.simstanceManager);
12184
+ this.routerManager = new RouterManager(this, this.simstanceManager, option);
12185
+ this.intentManager = new IntentManager(this, this.simstanceManager, this.routerManager, option);
12186
+ this.cacheManager = new CacheManager(this);
12187
+ if (!this.simstanceManager.getStoreSet(AlertFactory)) {
12188
+ this.simstanceManager.setStoreSet(AlertFactory, new DefaultAlertFactory());
12189
+ }
12190
+ Sim({ container: this.option.container })(AlertService);
12191
+ Sim({ container: this.option.container })(ApiService);
12192
+ this.simstanceManager.setStoreSet(IntentManager, this.intentManager);
12193
+ this.simstanceManager.setStoreSet(RouterManager, this.routerManager);
12194
+ this.simstanceManager.setStoreSet(CacheManager, this.cacheManager);
12195
+ containers.add(this);
12196
+ }
12197
+ getSimstanceManager() {
12198
+ return this.simstanceManager;
12199
+ }
12200
+ getIntentManager() {
12201
+ return this.intentManager;
12202
+ }
12203
+ getRouterManager() {
12204
+ return this.routerManager;
12205
+ }
12206
+ run(otherInstanceSim) {
12207
+ otherInstanceSim ?? (otherInstanceSim = /* @__PURE__ */ new Map());
12208
+ otherInstanceSim.set(_SimpleApplication, this);
12209
+ this.simstanceManager.run(otherInstanceSim);
12210
+ return this;
12211
+ }
12212
+ simAtomic(type) {
12213
+ if (typeof type === "symbol") {
12214
+ return this.simstanceManager.findFirstSim(type);
12215
+ } else if (typeof type === "function") {
12216
+ return this.simstanceManager.findFirstSim({ type });
12217
+ }
12218
+ }
12219
+ simAtomics(type) {
12220
+ if (typeof type === "symbol") {
12221
+ return this.simstanceManager.findSims(type) ?? [];
12222
+ } else if (typeof type === "function") {
12223
+ return this.simstanceManager.findSims({ type }) ?? [];
12224
+ } else {
12225
+ return [];
12226
+ }
12227
+ }
12228
+ getInstance(type) {
12229
+ const i = this.sim(type);
12230
+ if (i) {
12231
+ return i;
12232
+ } else {
12233
+ throw new SimNoSuch("SimNoSuch: no simple instance(getInstance) name:" + type?.prototype?.constructor?.name + "," + type);
12234
+ }
12235
+ }
12236
+ sim(type) {
12237
+ return this.simAtomic(type)?.getValue();
12238
+ }
12239
+ sims(type) {
12240
+ return this.simAtomics(type).map((it) => it.getValue());
12241
+ }
12242
+ addSim(configOrTarget, target) {
12243
+ const r = Sim(configOrTarget);
12244
+ if (typeof r === "function" && target) {
12245
+ r(target);
12246
+ }
12247
+ }
12248
+ publishIntent(i, data) {
12249
+ return this.intentManager.publish(i, data);
12250
+ }
12251
+ routing(i, option) {
12252
+ if (i instanceof Intent) {
12253
+ return this.routerManager.routing(i, option);
12254
+ } else if (typeof i === "string") {
12255
+ const intent = new Intent(i);
12256
+ return this.routerManager.routing(intent, option);
12257
+ } else {
12258
+ const intent = new Intent(i.path, i.data);
12259
+ return this.routerManager.routing(intent, option);
12260
+ }
12261
+ }
12262
+ };
12263
+
12264
+ // ../simple-boot/dist/esm/decorators/event/EventListener.js
12265
+ var EventListenerMetadataKey = Symbol.for("simple-boot:event-listener-metadata");
12266
+
12267
+ // ../simple-boot/dist/esm/decorators/validate/Validation.js
12268
+ var ValidMetadataKey = Symbol.for("simple-boot:valid-metadata");
12269
+ var ValidationMetadataKey = Symbol.for("simple-boot:validation-metadata");
12270
+
12271
+ // src/router/ElementRouter.ts
12272
+ var ElementRouter = class extends Router {
12273
+ constructor(config) {
12274
+ super(config);
12275
+ __publicField(this, "_history", []);
12276
+ __publicField(this, "_currentIndex", -1);
12277
+ }
12278
+ // Override pushState to manage internal history
12279
+ pushState(data, title, path, config) {
12280
+ const behaviorSubject = this.behaviorSubject;
12281
+ if (!config?.noEventAndPublish && behaviorSubject) {
12282
+ behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: "start" });
12283
+ }
12284
+ if (!this._history) this._history = [];
12285
+ this._history = this._history.slice(0, this._currentIndex + 1);
12286
+ this._history.push({ url: path, data, title });
12287
+ this._currentIndex++;
12288
+ if (!config?.noEventAndPublish && behaviorSubject) {
12289
+ behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: "end" });
12290
+ }
12291
+ return { data };
12292
+ }
12293
+ // Override replaceState to manage internal history
12294
+ replaceState(data, title, path, config) {
12295
+ const behaviorSubject = this.behaviorSubject;
12296
+ if (!config?.noEventAndPublish && behaviorSubject) {
12297
+ behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: "start" });
12298
+ }
12299
+ if (!this._history) this._history = [];
12300
+ if (this._currentIndex === -1) {
12301
+ this._history.push({ url: path, data, title });
12302
+ this._currentIndex = 0;
12303
+ } else {
12304
+ this._history[this._currentIndex] = { url: path, data, title };
12305
+ }
12306
+ if (!config?.noEventAndPublish && behaviorSubject) {
12307
+ behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: "end" });
12308
+ }
12309
+ return { data };
12310
+ }
12311
+ push(path, state) {
12312
+ this.pushState(state?.data, state?.title, this.toUrl(path), state?.config);
12313
+ }
12314
+ replace(path, state) {
12315
+ this.replaceState(state?.data, state?.title, this.toUrl(path), state?.config);
12316
+ }
12317
+ back(config) {
12318
+ if (this._currentIndex > 0) {
12319
+ this.go(-1, config);
12320
+ }
12321
+ }
12322
+ forward(config) {
12323
+ if (this._currentIndex < this._history.length - 1) {
12324
+ this.go(1, config);
12325
+ }
12326
+ }
12327
+ go(config, changeStateConfig) {
12328
+ if (typeof config === "number") {
12329
+ const targetIndex = this._currentIndex + config;
12330
+ if (this._history && targetIndex >= 0 && targetIndex < this._history.length) {
12331
+ const behaviorSubject = this.behaviorSubject;
12332
+ if (!changeStateConfig?.noEventAndPublish && behaviorSubject) {
12333
+ behaviorSubject.next({ ...this.getRouteData(), triggerPoint: "start" });
12334
+ }
12335
+ this._currentIndex = targetIndex;
12336
+ const entry = this._history[this._currentIndex];
12337
+ if (!changeStateConfig?.noEventAndPublish && behaviorSubject) {
12338
+ behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: entry.url }), triggerPoint: "end" });
12339
+ }
12340
+ }
12341
+ return;
12342
+ }
12343
+ return super.go(config, changeStateConfig);
12344
+ }
12345
+ getData() {
12346
+ return this._history?.[this._currentIndex]?.data;
12347
+ }
12348
+ getUrl() {
12349
+ return this._history?.[this._currentIndex]?.url ?? this.config?.firstUrl ?? "/";
12350
+ }
12351
+ getHref() {
12352
+ return this.getUrl();
12353
+ }
12354
+ getPathName() {
12355
+ return this.getUrl().split("?")[0];
12356
+ }
12357
+ getSearch() {
12358
+ const parts = this.getUrl().split("?");
12359
+ return parts[1] ? `?${parts[1]}` : "";
12360
+ }
12361
+ getSearchParams(data) {
12362
+ const search = this.getSearch();
12363
+ const searchParams = new URLSearchParams(search);
12364
+ return UrlUtils.manipulateSearchParams(searchParams, data);
12365
+ }
12366
+ getHashSearchParams(data) {
12367
+ const url = this.getUrl();
12368
+ const hashIdx = url.indexOf("#");
12369
+ const hash = hashIdx !== -1 ? url.slice(hashIdx + 1) : "";
12370
+ const searchParams = new URLSearchParams(hash);
12371
+ return UrlUtils.manipulateSearchParams(searchParams, data);
12372
+ }
12373
+ pushAddSearchParam(params, state) {
12374
+ const s = this.getSearchParams({ append: params });
12375
+ this.push({ searchParams: s }, state);
12376
+ }
12377
+ pushDeleteHashSearchParam(name, state) {
12378
+ const s = this.getHashSearchParams({ delete: Array.isArray(name) ? name : [name] });
12379
+ const url = this.getUrl().split("#")[0];
12380
+ const size = Array.from(s.entries()).length;
12381
+ this.push(url + (size > 0 ? "#" + s.toString() : ""), state);
12382
+ }
12383
+ pushDeleteSearchParam(name, state) {
12384
+ const s = this.getSearchParams({ delete: Array.isArray(name) ? name : [name] });
12385
+ this.push({ searchParams: s }, state);
12386
+ }
12387
+ pushUpsertSearchParam(params, state) {
12388
+ const s = this.getSearchParams();
12389
+ UrlUtils.upsertSearchParam(s, params);
12390
+ this.push({ searchParams: s }, state);
12391
+ }
12392
+ replaceAddSearchParam(params, state) {
12393
+ const s = this.getSearchParams({ append: params });
12394
+ this.replace({ searchParams: s }, state);
12395
+ }
12396
+ replaceDeleteHashSearchParam(name, state) {
12397
+ const s = this.getHashSearchParams({ delete: Array.isArray(name) ? name : [name] });
12398
+ const url = this.getUrl().split("#")[0];
12399
+ const size = Array.from(s.entries()).length;
12400
+ this.replace(url + (size > 0 ? "#" + s.toString() : ""), state);
12401
+ }
12402
+ replaceDeleteSearchParam(name, state) {
12403
+ const s = this.getSearchParams({ delete: Array.isArray(name) ? name : [name] });
12404
+ this.replace({ searchParams: s }, state);
12405
+ }
12406
+ replaceUpsertSearchParam(params, state) {
12407
+ const s = this.getSearchParamObject();
12408
+ UrlUtils.upsertSearchParam(s, params);
12409
+ this.replace({ searchParams: s }, state);
12410
+ }
12411
+ };
12412
+
12413
+ // src/SwcAppEngine.ts
12414
+ var SwcAppEngine = class {
12415
+ constructor(host) {
12416
+ this.host = host;
12417
+ __publicField(this, "simpleApplication");
12418
+ __publicField(this, "router");
12419
+ __publicField(this, "routerSubscription");
12420
+ __publicField(this, "_config");
12421
+ }
12422
+ get config() {
12423
+ return this._config;
12424
+ }
12425
+ async connect(config) {
12426
+ try {
12427
+ this._config = config;
12428
+ if (this._config.routeType === "path") {
12429
+ this.router = new PathRouter({ window: this._config.window, firstUrl: this._config.path });
12430
+ } else if (this._config.routeType === "hash") {
12431
+ this.router = new HashRouter({ window: this._config.window, firstUrl: this._config.path });
12432
+ } else if (this._config.routeType === "element") {
12433
+ this.router = new ElementRouter({ window: this._config.window, firstUrl: this._config.path });
12434
+ }
12435
+ this.simpleApplication = new SimpleApplication(
12436
+ new SimOption({
12437
+ excludeProxys: [this._config.window.Node],
12438
+ container: this._config.container
12439
+ })
12440
+ );
12441
+ const otherInstanceSim = /* @__PURE__ */ new Map();
12442
+ this.config?.otherInstanceSim?.forEach((v, k) => {
12443
+ otherInstanceSim.set(k, v);
12444
+ });
12445
+ if (this.router) otherInstanceSim.set(Router, this.router);
12446
+ this.simpleApplication.run(otherInstanceSim);
12447
+ if (this._config.onEngineStarted) {
12448
+ await this._config.onEngineStarted(this.simpleApplication, this.host);
12449
+ }
12450
+ } catch (e) {
12451
+ console.error("[SWC-APP-ENGINE] Init failed:", e, this._config);
12452
+ }
12453
+ }
12454
+ disconnect() {
12455
+ this.routerSubscription?.unsubscribe();
12456
+ }
12457
+ };
12458
+
12459
+ // src/elements/SwcApp.ts
12460
+ var __decorate = function(decorators, target, key, desc) {
12461
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12462
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12463
+ 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;
12464
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
12465
+ };
12466
+ var isSSR = (i) => {
12467
+ return i.hasAttribute("swc-use-ssr");
12468
+ };
12469
+ var setSSRAttribute = (i) => {
12470
+ i.setAttribute("swc-use-ssr", i._swcId ?? "");
12471
+ };
12472
+ var removeSSRAttribute = (i) => {
12473
+ i.removeAttribute("swc-use-ssr");
12474
+ };
12475
+ var tagName = "swc-app";
12476
+ var SwcApp_default = async (w) => {
12477
+ const existing = w.customElements.get(tagName);
12478
+ if (existing)
12479
+ return existing;
12480
+ let SwcApp = class SwcApp extends w.HTMLElement {
12481
+ constructor() {
12482
+ super(...arguments);
12483
+ this.__swc_engine = new SwcAppEngine(this);
12484
+ this._swc_connected_instance = /* @__PURE__ */ new Set();
12485
+ this._routeChangeInvocations = 0;
12486
+ this._connectedInvocations = 0;
12487
+ this._connected_safari_and_standby = [];
12488
+ }
12489
+ get simpleApplication() {
12490
+ return this.__swc_engine.simpleApplication;
12491
+ }
12492
+ get config() {
12493
+ return this.__swc_engine?.config;
12494
+ }
12495
+ get router() {
12496
+ return this.__swc_engine?.router;
12497
+ }
12498
+ async _invokeRouteChangeSubscribers(instance, re) {
12499
+ if (instance.isConnected === false)
12500
+ return;
12501
+ this._routeChangeInvocations++;
12502
+ if (this._childrenRouteChangedInterval) {
12503
+ this.config.window.clearInterval(this._childrenRouteChangedInterval);
12504
+ }
12505
+ const intervalConfig = { setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window) };
12506
+ this._childrenRouteChangedInterval = debounceTimeIntervalLock(
12507
+ () => this._routeChangeInvocations === 0,
12508
+ () => {
12509
+ this._childrenRouteChangedInterval = null;
12510
+ this.config.onChildrenRouteChanged?.(re, this);
12511
+ },
12512
+ this.config?.childrenConnectedDoneCheckIntervalTime ?? 30,
12513
+ intervalConfig
12514
+ // {setInterval: window.setInterval, clearInterval: window.clearInterval}
12515
+ );
12516
+ try {
12517
+ const routeChangeSubscribers = getSubscribeSwcAppRouteChangeWhileConnectedMetadata(instance);
12518
+ if (routeChangeSubscribers && Array.isArray(routeChangeSubscribers)) {
12519
+ const ps = routeChangeSubscribers.map(async (metadata) => {
12520
+ const methodName = metadata.propertyKey;
12521
+ let pathPattern = metadata.options?.path;
12522
+ const filter = metadata.options?.filter;
12523
+ if (typeof pathPattern === "function") {
12524
+ pathPattern = pathPattern(instance);
12525
+ }
12526
+ let pathMatched = false;
12527
+ let pathData = null;
12528
+ if (!pathPattern) {
12529
+ pathMatched = true;
12530
+ pathData = {};
12531
+ } else if (Array.isArray(pathPattern)) {
12532
+ for (const pattern of pathPattern) {
12533
+ const data = SwcUtils.parsePathPattern(pattern, re.path || "/");
12534
+ if (data !== null) {
12535
+ pathMatched = true;
12536
+ pathData = data;
12537
+ break;
12538
+ }
12539
+ }
12540
+ } else {
12541
+ pathData = SwcUtils.parsePathPattern(pathPattern, re.path || "/");
12542
+ pathMatched = pathData !== null;
12543
+ }
12544
+ const filterPassed = !filter || filter(this.router, instance);
12545
+ if (pathMatched && filterPassed && instance[methodName]) {
12546
+ await instance[methodName]({ ...re, pathData });
12547
+ }
12548
+ });
12549
+ await Promise.allSettled(ps);
12550
+ }
12551
+ } finally {
12552
+ if (this.config?.ssr) {
12553
+ setSSRAttribute(instance);
12554
+ } else {
12555
+ removeSSRAttribute(instance);
12556
+ }
12557
+ this._routeChangeInvocations = Math.max(0, this._routeChangeInvocations - 1);
12558
+ }
12559
+ }
12560
+ async _connected(instance, option) {
12561
+ if (instance) {
12562
+ if (!this.simpleApplication && !this.config) {
12563
+ this._connected_safari_and_standby.push(instance);
12564
+ return;
12565
+ }
12566
+ this.config.onConnectedChildBefore?.(instance);
12567
+ if (!option?.noIncrements) {
12568
+ this._connectedInvocations++;
12569
+ }
12570
+ this._swc_connected_instance.add(instance);
12571
+ const connectedSwcAppCallBacks = findAllLifecycleMetadata(instance, ON_CONNECTED_SWC_APP_METADATA_KEY) ?? [];
12572
+ for (let connectedSwcAppCallBack of connectedSwcAppCallBacks) {
12573
+ await instance?._invokeLifecycleMethod?.(connectedSwcAppCallBack);
12574
+ }
12575
+ if (this._childrenConnectedDoneInterval) {
12576
+ this.config.window.clearInterval(this._childrenConnectedDoneInterval);
12577
+ }
12578
+ const intervalConfig = { setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window) };
12579
+ this._childrenConnectedDoneInterval = debounceTimeIntervalLock(() => this._connectedInvocations === 0, () => {
12580
+ this._childrenConnectedDoneInterval = null;
12581
+ this.config.onChildrenConnectedDone?.(this);
12582
+ }, this.config?.childrenConnectedDoneCheckIntervalTime ?? 30, intervalConfig);
12583
+ if (this.simpleApplication) {
12584
+ try {
12585
+ if (this.router && this._lastRouterEvent) {
12586
+ await this._invokeRouteChangeSubscribers(instance, this._lastRouterEvent);
12587
+ }
12588
+ } catch (e) {
12589
+ throw e;
12590
+ }
12591
+ }
12592
+ if (this.config?.ssr) {
12593
+ setSSRAttribute(instance);
12594
+ } else {
12595
+ removeSSRAttribute(instance);
12596
+ }
12597
+ }
12598
+ this.config.onConnectedChildAfter?.(instance);
12599
+ return this;
12600
+ }
12601
+ async _connectedDone(instance) {
12602
+ try {
12603
+ } finally {
12604
+ this._connectedInvocations = Math.max(0, this._connectedInvocations - 1);
12605
+ }
12606
+ }
12607
+ _disconnected(instance) {
12608
+ if (instance) {
12609
+ this._swc_connected_instance.delete(instance);
12610
+ this.config?.onDisconnectedChildAfter?.(instance);
12611
+ }
12612
+ }
12613
+ async _handleRouteChange(route) {
12614
+ this._lastRouterEvent = route;
12615
+ const swcConnectedInstance = Array.from(this._swc_connected_instance);
12616
+ const ps = swcConnectedInstance.map((instance) => this._invokeRouteChangeSubscribers(instance, route));
12617
+ await Promise.allSettled(ps);
12618
+ }
12619
+ async connect(config) {
12620
+ console.log("[SWC] connect");
12621
+ const swcConfig = {
12622
+ routeType: "element",
12623
+ window: config?.window,
12624
+ ...config
12625
+ };
12626
+ const mode = config?.connectMode || "direct";
12627
+ if (mode === "direct" || mode === "hydrate") {
12628
+ this.setAttribute("swc-connect-mode", mode);
12629
+ await this.__swc_engine.connect(swcConfig);
12630
+ } else if (mode === "swap" || mode === "clear-swap") {
12631
+ if (!this.parentNode) {
12632
+ await this.__swc_engine.connect(swcConfig);
12633
+ this.setAttribute("swc-connect-mode", "direct");
12634
+ } else {
12635
+ const clonedApp = this.cloneNode(mode === "swap");
12636
+ clonedApp.style.display = "none";
12637
+ this.parentNode.insertBefore(clonedApp, this.nextSibling);
12638
+ try {
12639
+ await clonedApp.connect({ ...config || {}, connectMode: "direct" });
12640
+ if (this.parentNode) {
12641
+ this.parentNode.removeChild(this);
12642
+ }
12643
+ clonedApp.style.display = "";
12644
+ clonedApp.setAttribute("swc-connect-mode", mode);
12645
+ return;
12646
+ } catch (e) {
12647
+ if (clonedApp.parentNode) {
12648
+ clonedApp.parentNode.removeChild(clonedApp);
12649
+ }
12650
+ await this.__swc_engine.connect(swcConfig);
12651
+ this.setAttribute("swc-connect-mode", "direct");
12652
+ }
12653
+ }
12654
+ }
12655
+ this._connected_safari_and_standby.forEach((instance) => {
12656
+ this._connected(instance, { noIncrements: true });
12657
+ });
12658
+ if (!this._routerSubscription && this.router) {
12659
+ const config2 = this.__swc_engine.config;
12660
+ this._routerSubscription = this.router.observable.subscribe(async (route) => {
12661
+ console.log("[SWC] Router event received:", route.triggerPoint);
12662
+ if (route.triggerPoint === "end") {
12663
+ await this._handleRouteChange(route);
12664
+ }
12665
+ });
12666
+ if (config2?.path) {
12667
+ console.log("[DEBUG] Navigating to initial path:", config2.path);
12668
+ }
12669
+ }
12670
+ }
12671
+ // async _invokeOnConnectedSwcAppStarted(instance: any) {
12672
+ // this._swcAppStartedInvocations++;
12673
+ // try {
12674
+ // // 이미 시작된 인스턴스라면 스킵 (비동기 병렬 중복 호출 방지)
12675
+ // if (this._swc_started_instances.has(instance)) return;
12676
+ // this._swc_started_instances.add(instance);
12677
+ //
12678
+ // const startedMethods = findAllLifecycleMetadata(instance, ON_CONNECTED_SWC_APP_METADATA_KEY);
12679
+ // if (startedMethods) {
12680
+ // const ps = startedMethods.map(m => instance._invokeLifecycleMethod(m));
12681
+ // await Promise.allSettled(ps);
12682
+ // }
12683
+ // } finally {
12684
+ // this._swcAppStartedInvocations--;
12685
+ // }
12686
+ // }
12687
+ connectedCallback() {
12688
+ if (super.connectedCallback)
12689
+ super.connectedCallback();
12690
+ const configStr = this.getAttribute("swc-get-application-config");
12691
+ const win = this.ownerDocument?.defaultView || window;
12692
+ if (configStr && win) {
12693
+ try {
12694
+ const userConfig = FunctionUtils.executeReturn({
12695
+ script: configStr,
12696
+ context: this,
12697
+ args: SwcUtils.getHelperAndHostSet(win, this)
12698
+ });
12699
+ this.connect(userConfig);
12700
+ } catch (e) {
12701
+ console.error("[SWC-APP-ENGINE] Script execution failed:", e);
12702
+ }
12703
+ }
12704
+ this._connected(this);
12705
+ this.__swc_engine?.config?.onConnected?.(this);
12706
+ this._connectedDone(this);
12707
+ }
12708
+ disconnectedCallback() {
12709
+ if (super.disconnectedCallback)
12710
+ super.disconnectedCallback();
12711
+ this._routerSubscription?.unsubscribe();
12712
+ this._routerSubscription = void 0;
12713
+ this._lastRouterEvent = void 0;
12714
+ this.__swc_engine.disconnect();
12715
+ this.__swc_engine?.config?.onDisconnected?.(this);
12716
+ this._disconnected(this);
12717
+ }
12718
+ async routing(path) {
12719
+ await this.router?.go(path);
12720
+ }
12721
+ back() {
12722
+ this.router?.back();
12723
+ }
12724
+ forward() {
12725
+ this.router?.forward();
12726
+ }
12727
+ reload() {
12728
+ this.router?.reload();
12729
+ }
12730
+ // async completedSwcApp() {
12731
+ // const ss = Array.from(this._swc_connected_instance).flatMap((it) => {
12732
+ // const ms = findAllLifecycleMetadata(it, ON_CONNECTED_COMPLETED_SWC_APP_METADATA_KEY) ?? [];
12733
+ // return ms.map((sit) => it[sit](this));
12734
+ // });
12735
+ // await Promise.allSettled(ss);
12736
+ // }
12737
+ publishMessage(message) {
12738
+ this._swc_connected_instance.forEach((instance) => {
12739
+ this._invokeMessageSubscribers(instance, message);
12740
+ });
12741
+ }
12742
+ _invokeMessageSubscribers(instance, message) {
12743
+ const messageSubscribers = getSubscribeSwcAppMessageWhileConnectedMetadata(instance);
12744
+ if (messageSubscribers && Array.isArray(messageSubscribers)) {
12745
+ messageSubscribers.forEach((metadata) => {
12746
+ const methodName = metadata.propertyKey;
12747
+ const messageType = metadata.messageType;
12748
+ const filter = metadata.filter;
12749
+ let typeMatched = false;
12750
+ if (!messageType) {
12751
+ typeMatched = true;
12752
+ } else if (message.type === messageType) {
12753
+ typeMatched = true;
12754
+ }
12755
+ let filterMatched = true;
12756
+ if (filter && typeMatched) {
12757
+ filterMatched = filter(message, instance);
12758
+ }
12759
+ if (typeMatched && filterMatched && typeof instance[methodName] === "function") {
12760
+ instance[methodName](message);
12761
+ }
12762
+ });
12763
+ }
12764
+ }
12765
+ };
12766
+ SwcApp = __decorate([
12767
+ elementDefine(tagName, { window: w })
12768
+ ], SwcApp);
12769
+ ;
12770
+ return w.customElements.whenDefined(tagName);
12771
+ };
12772
+
12773
+ // src/elements/index.ts
12774
+ var registerSwcApp = SwcApp_default;
12775
+ var register = [SwcApp_default];
9026
12776
  export {
9027
12777
  ADD_EVENT_LISTENER_METADATA_KEY,
9028
12778
  APPLY_NODE_METADATA_KEY,
12779
+ APPLY_SLOT_METADATA_KEY,
9029
12780
  ATTRIBUTE_APPLY_METADATA_KEY,
9030
12781
  ATTRIBUTE_CHANGED_WILDCARD,
9031
12782
  ATTRIBUTE_FIELD_METADATA_KEY,
@@ -9035,7 +12786,6 @@ export {
9035
12786
  ELEMENT_CONFIG_KEY,
9036
12787
  EMIT_CUSTOM_EVENT_METADATA_KEY,
9037
12788
  HTML_TAG_ENTRIES,
9038
- INNER_HTML_METADATA_KEY,
9039
12789
  InjectSituationType,
9040
12790
  ON_ADD_EVENT_LISTENER_METADATA_KEY,
9041
12791
  ON_AFTER_ADOPTED_METADATA_KEY,
@@ -9045,6 +12795,8 @@ export {
9045
12795
  ON_BEFORE_ADOPTED_METADATA_KEY,
9046
12796
  ON_BEFORE_CONNECTED_METADATA_KEY,
9047
12797
  ON_BEFORE_DISCONNECTED_METADATA_KEY,
12798
+ ON_CONNECTED_COMPLETED_METADATA_KEY,
12799
+ ON_CONNECTED_INNER_HTML_METADATA_KEY,
9048
12800
  ON_CONNECTED_SWC_APP_METADATA_KEY,
9049
12801
  ON_INITIALIZE_METADATA_KEY,
9050
12802
  PROPERTY_SET_METADATA_KEY,
@@ -9069,15 +12821,26 @@ export {
9069
12821
  applyAttributeThis,
9070
12822
  applyClass,
9071
12823
  applyClassThis,
9072
- applyInnerHtmlNode,
9073
- applyInnerHtmlNodeThis,
9074
- applyInnerTextNode,
9075
12824
  applyNode,
12825
+ applyNodeInnerHtml,
12826
+ applyNodeInnerText,
12827
+ applyNodeReplaceChildren,
9076
12828
  applyNodeThis,
9077
- applyReplaceChildrenNode,
9078
- applyReplaceChildrenNodeThis,
12829
+ applyNodeThisReplaceChildren,
12830
+ applySlot,
12831
+ applySlotAppend,
12832
+ applySlotAppendHtml,
12833
+ applySlotAppendText,
12834
+ applySlotClear,
12835
+ applySlotPrepend,
12836
+ applySlotPrependHtml,
12837
+ applySlotPrependText,
12838
+ applySlotReplaceChildren,
12839
+ applySlotReplaceChildrenHtml,
12840
+ applySlotReplaceChildrenText,
9079
12841
  applyStyle,
9080
12842
  applyStyleThis,
12843
+ applyThisInnerHtmlNode,
9081
12844
  attribute,
9082
12845
  attributeThis,
9083
12846
  changedAttributeThis,
@@ -9090,6 +12853,7 @@ export {
9090
12853
  emitCustomEventThis,
9091
12854
  ensureInit,
9092
12855
  findAllApplyNodeMetadata,
12856
+ findAllApplySlotMetadata,
9093
12857
  findAllAttributeApplyMetadata,
9094
12858
  findAllAttributeChangedMetadata,
9095
12859
  findAllAttributeMetadata,
@@ -9101,6 +12865,8 @@ export {
9101
12865
  getChangedAttributeMetadata,
9102
12866
  getElementConfig,
9103
12867
  getEmitCustomEventMetadataList,
12868
+ getOnConnectedAfterMetadata,
12869
+ getOnConnectedBeforeMetadata,
9104
12870
  getOnConnectedInnerHtmlMetadata,
9105
12871
  getPublishSwcAppMessageMetadata,
9106
12872
  getQueryAllMetadata,
@@ -9125,7 +12891,9 @@ export {
9125
12891
  onConnected,
9126
12892
  onConnectedAfter,
9127
12893
  onConnectedBefore,
12894
+ onConnectedCompleted,
9128
12895
  onConnectedInnerHtml,
12896
+ onConnectedSwcApp,
9129
12897
  onDisconnected,
9130
12898
  onDisconnectedAfter,
9131
12899
  onDisconnectedBefore,
@@ -9139,6 +12907,8 @@ export {
9139
12907
  queryHost,
9140
12908
  queryThis,
9141
12909
  queryWindow,
12910
+ register,
12911
+ registerSwcApp,
9142
12912
  removeAttribute,
9143
12913
  removeAttributeThis,
9144
12914
  removeClass,