@dooboostore/simple-web-component 1.0.37 → 1.0.39

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 (157) hide show
  1. package/README.md +280 -791
  2. package/dist/cjs/SwcAppEngine.js +3 -0
  3. package/dist/cjs/SwcAppEngine.js.map +2 -2
  4. package/dist/cjs/decorators/addEventListener.js +20 -4
  5. package/dist/cjs/decorators/addEventListener.js.map +2 -2
  6. package/dist/cjs/decorators/applyAttribute.js.map +1 -1
  7. package/dist/cjs/decorators/applyClass.js.map +1 -1
  8. package/dist/cjs/decorators/applyNode.js +104 -35
  9. package/dist/cjs/decorators/applyNode.js.map +2 -2
  10. package/dist/cjs/decorators/applySlot.js +69 -57
  11. package/dist/cjs/decorators/applySlot.js.map +3 -3
  12. package/dist/cjs/decorators/applyStyle.js.map +2 -2
  13. package/dist/cjs/decorators/attribute.js.map +1 -1
  14. package/dist/cjs/decorators/elementDefine.js +65 -42
  15. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  16. package/dist/cjs/decorators/emitCustomEvent.js.map +1 -1
  17. package/dist/cjs/decorators/index.js +1 -0
  18. package/dist/cjs/decorators/index.js.map +2 -2
  19. package/dist/cjs/decorators/lifecycles.js +47 -31
  20. package/dist/cjs/decorators/lifecycles.js.map +3 -3
  21. package/dist/cjs/decorators/publishSwcAppMessage.js.map +2 -2
  22. package/dist/cjs/decorators/query.js +1 -1
  23. package/dist/cjs/decorators/query.js.map +2 -2
  24. package/dist/cjs/decorators/queryAll.js.map +1 -1
  25. package/dist/cjs/decorators/setProperty.js.map +1 -1
  26. package/dist/cjs/decorators/state.js +83 -0
  27. package/dist/cjs/decorators/state.js.map +7 -0
  28. package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js.map +1 -1
  29. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  30. package/dist/cjs/elements/SwcApp.js +193 -305
  31. package/dist/cjs/elements/SwcApp.js.map +3 -3
  32. package/dist/cjs/elements/SwcAppMixin.js +291 -0
  33. package/dist/cjs/elements/SwcAppMixin.js.map +7 -0
  34. package/dist/cjs/elements/index.js +3 -21
  35. package/dist/cjs/elements/index.js.map +3 -3
  36. package/dist/cjs/index.js +1 -3
  37. package/dist/cjs/index.js.map +2 -2
  38. package/dist/cjs/{types.js → types/index.js} +1 -1
  39. package/dist/cjs/types/index.js.map +7 -0
  40. package/dist/cjs/types/window.d.js.map +1 -1
  41. package/dist/cjs/utils/Utils.js +159 -20
  42. package/dist/cjs/utils/Utils.js.map +3 -3
  43. package/dist/esm/SwcAppEngine.js +3 -0
  44. package/dist/esm/SwcAppEngine.js.map +2 -2
  45. package/dist/esm/decorators/addEventListener.js +20 -4
  46. package/dist/esm/decorators/addEventListener.js.map +2 -2
  47. package/dist/esm/decorators/applyAttribute.js.map +1 -1
  48. package/dist/esm/decorators/applyClass.js.map +1 -1
  49. package/dist/esm/decorators/applyNode.js +104 -35
  50. package/dist/esm/decorators/applyNode.js.map +2 -2
  51. package/dist/esm/decorators/applySlot.js +69 -57
  52. package/dist/esm/decorators/applySlot.js.map +3 -3
  53. package/dist/esm/decorators/applyStyle.js.map +2 -2
  54. package/dist/esm/decorators/attribute.js.map +1 -1
  55. package/dist/esm/decorators/elementDefine.js +69 -46
  56. package/dist/esm/decorators/elementDefine.js.map +2 -2
  57. package/dist/esm/decorators/emitCustomEvent.js.map +1 -1
  58. package/dist/esm/decorators/index.js +1 -0
  59. package/dist/esm/decorators/index.js.map +2 -2
  60. package/dist/esm/decorators/lifecycles.js +47 -31
  61. package/dist/esm/decorators/lifecycles.js.map +3 -3
  62. package/dist/esm/decorators/publishSwcAppMessage.js.map +2 -2
  63. package/dist/esm/decorators/query.js +1 -1
  64. package/dist/esm/decorators/query.js.map +2 -2
  65. package/dist/esm/decorators/queryAll.js.map +1 -1
  66. package/dist/esm/decorators/setProperty.js.map +1 -1
  67. package/dist/esm/decorators/state.js +64 -0
  68. package/dist/esm/decorators/state.js.map +7 -0
  69. package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js.map +1 -1
  70. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  71. package/dist/esm/elements/SwcApp.js +195 -307
  72. package/dist/esm/elements/SwcApp.js.map +3 -3
  73. package/dist/esm/elements/SwcAppMixin.js +273 -0
  74. package/dist/esm/elements/SwcAppMixin.js.map +7 -0
  75. package/dist/esm/elements/index.js +2 -7
  76. package/dist/esm/elements/index.js.map +2 -2
  77. package/dist/esm/index.js +2 -4
  78. package/dist/esm/index.js.map +2 -2
  79. package/dist/esm/{types.js → types/index.js} +1 -1
  80. package/dist/esm/types/index.js.map +7 -0
  81. package/dist/esm/utils/Utils.js +159 -20
  82. package/dist/esm/utils/Utils.js.map +3 -3
  83. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +3448 -2584
  84. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  85. package/dist/types/SwcAppEngine.d.ts +1 -1
  86. package/dist/types/SwcAppEngine.d.ts.map +1 -1
  87. package/dist/types/decorators/addEventListener.d.ts +5 -2
  88. package/dist/types/decorators/addEventListener.d.ts.map +1 -1
  89. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  90. package/dist/types/decorators/applyClass.d.ts.map +1 -1
  91. package/dist/types/decorators/applyNode.d.ts +23 -7
  92. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  93. package/dist/types/decorators/applySlot.d.ts +14 -12
  94. package/dist/types/decorators/applySlot.d.ts.map +1 -1
  95. package/dist/types/decorators/applyStyle.d.ts.map +1 -1
  96. package/dist/types/decorators/attribute.d.ts.map +1 -1
  97. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  98. package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
  99. package/dist/types/decorators/index.d.ts +1 -0
  100. package/dist/types/decorators/index.d.ts.map +1 -1
  101. package/dist/types/decorators/lifecycles.d.ts +10 -14
  102. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  103. package/dist/types/decorators/publishSwcAppMessage.d.ts.map +1 -1
  104. package/dist/types/decorators/query.d.ts +1 -1
  105. package/dist/types/decorators/query.d.ts.map +1 -1
  106. package/dist/types/decorators/queryAll.d.ts.map +1 -1
  107. package/dist/types/decorators/setProperty.d.ts +1 -1
  108. package/dist/types/decorators/setProperty.d.ts.map +1 -1
  109. package/dist/types/decorators/state.d.ts +9 -0
  110. package/dist/types/decorators/state.d.ts.map +1 -0
  111. package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts.map +1 -1
  112. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +5 -1
  113. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
  114. package/dist/types/elements/SwcApp.d.ts +35 -6
  115. package/dist/types/elements/SwcApp.d.ts.map +1 -1
  116. package/dist/types/elements/SwcAppMixin.d.ts +405 -0
  117. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -0
  118. package/dist/types/elements/index.d.ts +2 -2
  119. package/dist/types/elements/index.d.ts.map +1 -1
  120. package/dist/types/index.d.ts +1 -1
  121. package/dist/types/index.d.ts.map +1 -1
  122. package/dist/types/{types.d.ts → types/index.d.ts} +11 -11
  123. package/dist/types/types/index.d.ts.map +1 -0
  124. package/dist/types/utils/Utils.d.ts +14 -2
  125. package/dist/types/utils/Utils.d.ts.map +1 -1
  126. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +3431 -2567
  127. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  128. package/package.json +4 -4
  129. package/src/SwcAppEngine.ts +6 -2
  130. package/src/decorators/addEventListener.ts +21 -5
  131. package/src/decorators/applyAttribute.ts +1 -1
  132. package/src/decorators/applyClass.ts +1 -1
  133. package/src/decorators/applyNode.ts +183 -73
  134. package/src/decorators/applySlot.ts +99 -128
  135. package/src/decorators/applyStyle.ts +4 -4
  136. package/src/decorators/attribute.ts +1 -1
  137. package/src/decorators/elementDefine.ts +112 -60
  138. package/src/decorators/emitCustomEvent.ts +1 -1
  139. package/src/decorators/index.ts +2 -0
  140. package/src/decorators/lifecycles.ts +50 -26
  141. package/src/decorators/publishSwcAppMessage.ts +2 -3
  142. package/src/decorators/query.ts +4 -4
  143. package/src/decorators/queryAll.ts +1 -1
  144. package/src/decorators/setProperty.ts +1 -1
  145. package/src/decorators/state.ts +83 -0
  146. package/src/decorators/subscribeSwcAppMessageWhileConnected.ts +1 -1
  147. package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +4 -3
  148. package/src/elements/SwcApp.ts +239 -441
  149. package/src/elements/SwcAppMixin.ts +328 -0
  150. package/src/elements/index.ts +2 -9
  151. package/src/index.ts +2 -4
  152. package/src/{types.ts → types/index.ts} +13 -10
  153. package/src/types/window.d.ts +3 -0
  154. package/src/utils/Utils.ts +205 -20
  155. package/dist/cjs/types.js.map +0 -7
  156. package/dist/esm/types.js.map +0 -7
  157. package/dist/types/types.d.ts.map +0 -1
@@ -1,10 +1,20 @@
1
1
  import { getElementConfig } from "../decorators/index.js";
2
+ import { ActionExpression } from "@dooboostore/core";
3
+ import { ElementApply, NodeSlot } from "@dooboostore/core-web";
2
4
  const SWC_NOT_FOUND = Symbol.for("simple-web-component:not-found");
3
- const htmlFragment = (html, doc) => {
4
- const d = doc || (typeof document !== "undefined" ? document : void 0);
5
- if (!d) throw new Error("Document is not available");
6
- const template = d.createElement("template");
7
- template.innerHTML = html.trim();
5
+ const html = (str, document2) => {
6
+ return [...document2.createRange().createContextualFragment(str).childNodes];
7
+ };
8
+ const htmlFragment = (html2, doc) => {
9
+ if (!doc) throw new Error("Document is not available");
10
+ const template = doc.createElement("template");
11
+ if (typeof html2 === "string") {
12
+ template.innerHTML = html2.trim();
13
+ } else if (html2 instanceof Node) {
14
+ template.appendChild(html2);
15
+ } else if (Array.isArray(html2)) {
16
+ template.append(...html2);
17
+ }
8
18
  return template.content;
9
19
  };
10
20
  const textNode = (text, doc) => {
@@ -23,38 +33,38 @@ const createElement = (documentOrWindow, tagName, options) => {
23
33
  const el = doc.createElement(tagName);
24
34
  if (options?.innerHtml) el.innerHTML = options.innerHtml;
25
35
  if (options?.attrs) {
26
- Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
36
+ Object.entries(options.attrs).filter(([k, v]) => v).forEach(([k, v]) => el.setAttribute(k, String(v)));
27
37
  }
28
38
  if (options?.property) {
29
39
  Object.entries(options.property).forEach(([k, v]) => el[k] = v);
30
40
  }
31
41
  return el;
32
42
  };
33
- const htmlDivElement = (html, options) => {
43
+ const htmlDivElement = (html2, options) => {
34
44
  const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
35
45
  if (!d) throw new Error("Document is not available");
36
46
  const el = d.createElement("div");
37
- el.innerHTML = html.trim();
47
+ el.innerHTML = html2.trim();
38
48
  if (options?.attrs) {
39
49
  Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
40
50
  }
41
51
  return el;
42
52
  };
43
- const htmlSpanElement = (html, options) => {
53
+ const htmlSpanElement = (html2, options) => {
44
54
  const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
45
55
  if (!d) throw new Error("Document is not available");
46
56
  const el = d.createElement("span");
47
- el.innerHTML = html.trim();
57
+ el.innerHTML = html2.trim();
48
58
  if (options?.attrs) {
49
59
  Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
50
60
  }
51
61
  return el;
52
62
  };
53
- const htmlButtonElement = (html, options) => {
63
+ const htmlButtonElement = (html2, options) => {
54
64
  const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
55
65
  if (!d) throw new Error("Document is not available");
56
66
  const el = d.createElement("button");
57
- el.innerHTML = html.trim();
67
+ el.innerHTML = html2.trim();
58
68
  if (options?.attrs) {
59
69
  Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
60
70
  }
@@ -69,42 +79,42 @@ const htmlUlElement = (options) => {
69
79
  }
70
80
  return el;
71
81
  };
72
- const htmlLiElement = (html, options) => {
82
+ const htmlLiElement = (html2, options) => {
73
83
  const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
74
84
  if (!d) throw new Error("Document is not available");
75
85
  const el = d.createElement("li");
76
- el.innerHTML = html.trim();
86
+ el.innerHTML = html2.trim();
77
87
  if (options?.attrs) {
78
88
  Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
79
89
  }
80
90
  return el;
81
91
  };
82
- const htmlAElement = (html, options) => {
92
+ const htmlAElement = (html2, options) => {
83
93
  const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
84
94
  if (!d) throw new Error("Document is not available");
85
95
  const el = d.createElement("a");
86
- el.innerHTML = html.trim();
96
+ el.innerHTML = html2.trim();
87
97
  if (options?.href) el.href = options.href;
88
98
  if (options?.attrs) {
89
99
  Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
90
100
  }
91
101
  return el;
92
102
  };
93
- const htmlPElement = (html, options) => {
103
+ const htmlPElement = (html2, options) => {
94
104
  const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
95
105
  if (!d) throw new Error("Document is not available");
96
106
  const el = d.createElement("p");
97
- el.innerHTML = html.trim();
107
+ el.innerHTML = html2.trim();
98
108
  if (options?.attrs) {
99
109
  Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
100
110
  }
101
111
  return el;
102
112
  };
103
- const htmlHeadingElement = (level, html, options) => {
113
+ const htmlHeadingElement = (level, html2, options) => {
104
114
  const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
105
115
  if (!d) throw new Error("Document is not available");
106
116
  const el = d.createElement(`h${level}`);
107
- el.innerHTML = html.trim();
117
+ el.innerHTML = html2.trim();
108
118
  if (options?.attrs) {
109
119
  Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
110
120
  }
@@ -219,6 +229,134 @@ var SwcUtils;
219
229
  if (getElementConfig(el)) return el;
220
230
  return (0, SwcUtils2.findNearestSwcHostIncludingSelf)(el);
221
231
  };
232
+ function projectProcessHtml(id, htmlOrNode, document2) {
233
+ if (typeof htmlOrNode === "string") {
234
+ let t = htmlOrNode;
235
+ t = SwcUtils2.processHtml(id, t, { document: document2, replaceWrap: { start: "<!--[[", end: "]]-->" }, replacer: (id2, script) => NodeSlot.slot(id2, script) });
236
+ t = SwcUtils2.processHtml(id, t, { document: document2, replaceWrap: { start: "<!--[html", end: "]-->" }, replacer: (id2, script) => ElementApply.html(id2, script) });
237
+ t = SwcUtils2.processHtml(id, t, { document: document2, replaceWrap: { start: "<!--[text", end: "]-->" }, replacer: (id2, script) => ElementApply.text(id2, script) });
238
+ t = SwcUtils2.processHtml(id, t, {
239
+ document: document2,
240
+ replaceWrap: { start: /a::\w+=\s*"/, end: /"\s/ },
241
+ replacer: (id2, script, er) => {
242
+ console.log("start: /a-->", er);
243
+ const match = er.expressionStart.match(/^\w+::(\w+)="/);
244
+ const name = match?.[1];
245
+ return ElementApply.attribute(id2, name, script);
246
+ }
247
+ });
248
+ t = SwcUtils2.processHtml(id, t, {
249
+ document: document2,
250
+ replaceWrap: { start: /e::\w+=\s*"/, end: /"\s/ },
251
+ replacer: (id2, script, er) => {
252
+ console.log("start: /e-->", er);
253
+ const match = er.expressionStart.match(/^\w+::(\w+)="/);
254
+ const name = match?.[1];
255
+ return ElementApply.event(id2, name, script);
256
+ }
257
+ });
258
+ t = SwcUtils2.processHtml(id, t, {
259
+ document: document2,
260
+ replaceWrap: { start: /p:\w+=\s*"/, end: /"\s/ },
261
+ replacer: (id2, script, er) => {
262
+ console.log("start: /p-->", er);
263
+ const match = er.expressionStart.match(/^\w+:(\w+)="/);
264
+ const name = match?.[1];
265
+ return ElementApply.property(id2, name, script);
266
+ }
267
+ });
268
+ return t;
269
+ } else if (htmlOrNode) {
270
+ const nodes = Array.isArray(htmlOrNode) ? htmlOrNode : [htmlOrNode];
271
+ const window2 = document2.defaultView;
272
+ nodes.forEach((node) => {
273
+ node.normalize();
274
+ const nodes2 = document2.createTreeWalker(node, window2.NodeFilter.SHOW_ELEMENT | window2.NodeFilter.SHOW_COMMENT);
275
+ const getSlotData = (s) => {
276
+ return s.match(/^\[\[([\s\S]+)\]\]$/)?.[1]?.trim();
277
+ };
278
+ const getHtmlData = (s) => {
279
+ return s.match(/^\[html([\s\S]+)\]$/)?.[1]?.trim();
280
+ };
281
+ const getTextData = (s) => {
282
+ return s.match(/^\[text([\s\S]+)\]$/)?.[1]?.trim();
283
+ };
284
+ while (nodes2.nextNode()) {
285
+ const currentNode = nodes2.currentNode;
286
+ if (currentNode.nodeType === window2.Node.COMMENT_NODE) {
287
+ const targetNode = currentNode;
288
+ const v = targetNode.data.trim();
289
+ const slotData = getSlotData(v);
290
+ const htmlData = getHtmlData(v);
291
+ const textData = getTextData(v);
292
+ if (v && slotData) {
293
+ const res = NodeSlot.slotIds(id, slotData);
294
+ targetNode.data = res.start;
295
+ const end = document2.createComment(res.end);
296
+ targetNode.parentNode?.insertBefore(end, targetNode.nextSibling);
297
+ } else if (v && htmlData) {
298
+ const s = ElementApply.htmlDataSet(id, htmlData);
299
+ targetNode.data = s.start;
300
+ const end = document2.createComment(s.end);
301
+ targetNode.parentNode?.insertBefore(end, targetNode.nextSibling);
302
+ } else if (v && textData) {
303
+ const s = ElementApply.textDataSet(id, textData);
304
+ const end = document2.createComment(s.end);
305
+ targetNode.data = s.start;
306
+ targetNode.parentNode?.insertBefore(end, targetNode.nextSibling);
307
+ }
308
+ } else if (currentNode.nodeType === window2.Node.ELEMENT_NODE) {
309
+ const targetNode = currentNode;
310
+ targetNode.getAttributeNames().forEach((it) => {
311
+ const e = it.match(/e::(\w+)$/);
312
+ const eventName = e?.[1];
313
+ const p = it.match(/p::(\w+)$/);
314
+ const propertyName = p?.[1];
315
+ const a = it.match(/a::(\w+)$/);
316
+ const attributeName = a?.[1];
317
+ const value = targetNode.getAttribute(it);
318
+ if (eventName) {
319
+ targetNode.setAttribute(ElementApply.eventName(id, eventName), value);
320
+ targetNode.removeAttribute(it);
321
+ } else if (propertyName) {
322
+ targetNode.setAttribute(ElementApply.propertyName(id, propertyName), value);
323
+ targetNode.removeAttribute(it);
324
+ } else if (attributeName) {
325
+ targetNode.setAttribute(ElementApply.attributeName(id, attributeName), value);
326
+ targetNode.removeAttribute(it);
327
+ }
328
+ });
329
+ }
330
+ }
331
+ });
332
+ return nodes;
333
+ }
334
+ }
335
+ SwcUtils2.projectProcessHtml = projectProcessHtml;
336
+ function processHtml(id, html2, config) {
337
+ const replaceStart = config.replaceWrap.start;
338
+ const replaceEnd = config.replaceWrap.end;
339
+ const callReturnStart = `${config.replaceWrap.start}=`;
340
+ const callReturnEnd = `${config.replaceWrap.end}`;
341
+ const callStart = `${config.replaceWrap.start}@`;
342
+ const callEnd = `${config.replaceWrap.end}`;
343
+ const hasPattern = (text, start, end) => {
344
+ if (!text) return false;
345
+ const s = text.indexOf(start);
346
+ const e = text.indexOf(end, s + start.length);
347
+ return s !== -1 && e !== -1 && s < e;
348
+ };
349
+ const actionConfig = { expression: { replace: { start: replaceStart, end: replaceEnd }, callReturn: { start: callReturnStart, end: callReturnEnd }, call: { start: callStart, end: callEnd } } };
350
+ const runActionExpression = (source) => {
351
+ const actionExpression = new ActionExpression(source, actionConfig);
352
+ actionExpression.getExpressions().filter((it) => it.type === "replace").forEach((it) => {
353
+ actionExpression.replace(it, config.replacer(id, it.script?.trim(), it));
354
+ });
355
+ return actionExpression.toResult();
356
+ };
357
+ return runActionExpression(html2);
358
+ }
359
+ SwcUtils2.processHtml = processHtml;
222
360
  SwcUtils2.getAppHosts = (el) => {
223
361
  const hosts = SwcUtils2.findAllAppHostsIncludingSelfDirect(el);
224
362
  return hosts;
@@ -314,6 +452,7 @@ export {
314
452
  SwcUtils,
315
453
  commentNode,
316
454
  createElement,
455
+ html,
317
456
  htmlAElement,
318
457
  htmlArticleElement,
319
458
  htmlButtonElement,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/utils/Utils.ts"],
4
- "sourcesContent": ["import { SwcAppInterface, HostSet, HelperSet, HelperHostSet } from '../types';\nimport {getElementConfig} from \"../decorators\";\nimport { getExpression, ExpressionResult, GetExpressionConfig, GetExpressionResult } from '@dooboostore/core';\nimport {Router} from \"@dooboostore/core-web\";\n\nexport const SWC_NOT_FOUND = Symbol.for('simple-web-component:not-found');\n\n// DOM Creation Utilities\nexport const htmlFragment = (html: string, doc?: Document): DocumentFragment => {\n const d = doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const template = d.createElement('template');\n template.innerHTML = html.trim();\n return template.content;\n};\n\nexport const textNode = (text: string | any, doc?: Document): Text => {\n const d = doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n return d.createTextNode(text !== undefined && text !== null ? String(text) : '');\n};\n\nexport const commentNode = (comment: string | any, doc?: Document): Comment => {\n const d = doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n return d.createComment(comment !== undefined && comment !== null ? String(comment) : '');\n};\n\nexport type CreateElementConfig = { innerHtml?: string; property?: Record<string, any>, attrs?: Record<string, string>; };\nexport const createElement = <T extends HTMLElement>(\n documentOrWindow: Document | Window,\n tagName: string,\n options?: CreateElementConfig\n): T => {\n const doc = 'document' in documentOrWindow ? documentOrWindow.document : documentOrWindow;\n if (!doc) throw new Error('Document is not available');\n const el = doc.createElement(tagName) as T;\n if (options?.innerHtml) el.innerHTML = options.innerHtml;\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n if (options?.property) {\n Object.entries(options.property).forEach(([k, v]) => el[k] =v);\n }\n return el;\n};\n\n// Element factory functions\nexport const htmlDivElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLDivElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('div') as HTMLDivElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlSpanElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLSpanElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('span') as HTMLSpanElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlButtonElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLButtonElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('button') as HTMLButtonElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlUlElement = (options?: { doc?: Document; attrs?: Record<string, any> }): HTMLUListElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('ul') as HTMLUListElement;\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlLiElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLLIElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('li') as HTMLLIElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlAElement = (html: string, options?: { href?: string; doc?: Document; attrs?: Record<string, any> }): HTMLAnchorElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('a') as HTMLAnchorElement;\n el.innerHTML = html.trim();\n if (options?.href) el.href = options.href;\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlPElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLParagraphElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('p') as HTMLParagraphElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlHeadingElement = (level: 1 | 2 | 3 | 4 | 5 | 6, html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLHeadingElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement(`h${level}`) as HTMLHeadingElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlSectionElement = (options?: { doc?: Document; attrs?: Record<string, any> }): HTMLElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('section');\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlArticleElement = (options?: { doc?: Document; attrs?: Record<string, any> }): HTMLElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('article');\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport namespace SwcUtils {\n\n\n export const getParentContainer = (e: Node) => {\n return e.parentElement ?? e.getRootNode() as any;\n }\n\n export const parsePathPatternsSetAttributeString = (pathPattern: string[], path: string) => {\n return JSON.stringify(SwcUtils.parsePathPatternsSet(pathPattern, path)).replace(/\"/g, \"'\");\n }\n\n export const parsePathPatternsSet = (pathPattern: string[], urlAndRouter?: string | Router) => {\n // if (!path) {\n // return;\n // }\n urlAndRouter ??= '/'\n const p = typeof urlAndRouter === 'string' ? urlAndRouter : urlAndRouter.value.url;\n const searchParams = new URLSearchParams();\n const qs = p.split('?')[1];\n qs?.split('&').forEach(it => {\n const [k, v] = it.split('=');\n searchParams.set(k,v);\n })\n return {\n path: p,\n searchParams,\n pathData: SwcUtils.parsePathPatterns(pathPattern, p)\n };\n };\n export const parsePathPatterns = (pathPattern: string[], path: string) => {\n for (const pattern of pathPattern) {\n const data = SwcUtils.parsePathPattern(pattern, path || '/');\n if (data !== null) {\n return data;\n }\n }\n };\n\n export const getHelperSet = (win: Window): HelperSet => {\n const doc: Document = win.document;\n return {\n $d: doc,\n $w: win,\n $q: (sel: string, root?: Element | Document | ShadowRoot) => (root ?? doc).querySelector(sel),\n $qa: (sel: string, root?: Element | Document | ShadowRoot) => Array.from((root ?? doc).querySelectorAll(sel)) as HTMLElement[],\n $qi: (id: string, root?: Document | ShadowRoot) => (root ?? doc).getElementById(id) as HTMLElement\n } as const;\n };\n\n export const getHelperAndHostSet = (win: Window, el: HTMLElement): HelperHostSet => {\n const helperSet = getHelperSet(win);\n const hostSet = getHostSet(el);\n return {\n ...helperSet,\n ...hostSet,\n $this: el,\n };\n };\n\n export const getValueByPath = (obj: any, path: string, rootName: string) => {\n if (!obj || !path) return SWC_NOT_FOUND;\n\n const parts = path.split('.');\n let current = obj;\n\n for (const part of parts) {\n if (current === null || current === undefined) return SWC_NOT_FOUND;\n current = current[part];\n }\n return current;\n };\n\n /**\n * Finds the nearest logical SWC host for an element.\n * Checks __swc_host property first, then climbs the DOM tree.\n */\n export const findNearestSwcHostIncludingSelf = (el: HTMLElement | Node): HTMLElement | undefined => {\n const el1 = el as any;\n if (el1.__swc_host) return el1.__swc_host;\n\n let current: any = el.parentElement || (el.getRootNode?.() as any)?.host;\n const doc = el.ownerDocument;\n const win = doc?.defaultView || ((typeof window !== 'undefined' ? window : undefined) as any);\n while (current && current !== doc && current !== win) {\n if (current.__swc_host) return current.__swc_host;\n if (getElementConfig(current)) return current as HTMLElement;\n current = current.parentElement || (current.getRootNode?.() as any)?.host;\n }\n return undefined;\n };\n\n /**\n * Returns all SWC ancestors (excluding self) in [root, ..., parent] order.\n */\n export const findAllSwcHostsIncludingSelf = (el: HTMLElement | Node): HTMLElement[] => {\n const hosts: HTMLElement[] = [];\n let current = findNearestSwcHostIncludingSelf(el);\n while (current) {\n hosts.push(current);\n // To find the next ancestor, we must start searching from the PARENT of the found host\n current = findNearestSwcHostIncludingSelf(current);\n }\n return hosts.reverse();\n };\n\n export const getHosts = (el: HTMLElement): HTMLElement[] => {\n const ancestors = findAllSwcHostsIncludingSelf(el);\n if (getElementConfig(el)) return [...ancestors, el];\n return ancestors;\n };\n\n export const getHost = (el: HTMLElement): HTMLElement | undefined => {\n if (getElementConfig(el)) return el;\n return findNearestSwcHostIncludingSelf(el);\n };\n\n export const getAppHosts = (el: HTMLElement): SwcAppInterface[] => {\n // const hosts = getHosts(el);\n // return hosts.filter(host => host.tagName.toLowerCase() === 'swc-app' || host.getAttribute('is')?.startsWith('swc-app-')) as SwcAppInterface[];\n const hosts = SwcUtils.findAllAppHostsIncludingSelfDirect(el);\n return hosts;\n };\n\n export const getAppHost = (el: HTMLElement): SwcAppInterface | undefined => {\n const appHosts = getAppHosts(el);\n const appHostsWithoutSelf = appHosts.filter(h => h !== el);\n return appHostsWithoutSelf.length > 0 ? appHostsWithoutSelf[appHostsWithoutSelf.length - 1] : undefined;\n };\n\n /**\n * Find the closest app host by traversing DOM tree directly, including the element itself.\n * Only checks tagName and is attribute - no SWC host discovery.\n * Useful for Safari polyfill compatibility where is=\"\" elements upgrade in child-first order.\n */\n export const findAppHostIncludingSelfDirect = (el: HTMLElement): SwcAppInterface | null => {\n const appHosts = findAllAppHostsIncludingSelfDirect(el);\n return appHosts.length > 0 ? appHosts[appHosts.length - 1] : null;\n };\n\n /**\n * Find all app hosts by traversing DOM tree directly, including the element itself.\n * Returns array of all app hosts in [root, ..., closest-parent-or-self] order.\n * Only checks tagName and is attribute - no SWC host discovery.\n * Useful for Safari polyfill compatibility where is=\"\" elements upgrade in child-first order.\n */\n export const findAllAppHostsIncludingSelfDirect = (el: HTMLElement): SwcAppInterface[] => {\n const appHosts: SwcAppInterface[] = [];\n\n const w = el.ownerDocument?.defaultView || ((typeof window !== 'undefined' ? window : undefined) as any);\n\n // Guard against SSR environment where window might be undefined\n if (!w) {\n return appHosts;\n }\n\n // console.log('------?',w.ShadowRoot);\n // el \uC790\uCCB4\uBD80\uD130 \uC2DC\uC791 (el\uC774 app host\uC77C \uC218\uB3C4 \uC788\uC74C)\n let current: HTMLElement | null = el;\n\n while (current) {\n const isAppHost =\n current.tagName.toLowerCase() === 'swc-app' ||\n current.getAttribute('is')?.startsWith('swc-app-');\n if (isAppHost) {\n appHosts.push(current as SwcAppInterface);\n }\n\n // \uB2E4\uC74C \uBD80\uBAA8 \uCC3E\uAE30\n if (current.parentElement) {\n // Light DOM: \uC815\uC0C1\uC801\uC778 \uBD80\uBAA8 \uC694\uC18C\n current = current.parentElement;\n } else {\n // parentElement\uAC00 \uC5C6\uC74C = Shadow root\uC758 \uC9C1\uC811 \uC790\uC2DD\uC77C \uC218 \uC788\uC74C\n const root = current.getRootNode();\n if (w.ShadowRoot && root instanceof w.ShadowRoot) {\n // Shadow host\uB85C \uC62C\uB77C\uAC00\uAE30\n current = (root as ShadowRoot).host as HTMLElement;\n } else {\n // Document root \uB3C4\uB2EC\n break;\n }\n }\n }\n return appHosts.reverse(); // [root, ..., closest-parent-or-self]\n };\n\n export const getHostSet = (el: HTMLElement): HostSet => {\n const ancestors = findAllSwcHostsIncludingSelf(el); // [root, ..., parent]\n \n const $host = ancestors.length > 0 ? ancestors[ancestors.length - 1] : null;\n const $parentHost = ancestors.length > 1 ? ancestors[ancestors.length - 2] : null;\n const $hosts = ancestors;\n const $firstHost = ancestors.length > 0 ? ancestors[0] : null;\n\n // Collect loop contexts\n const loopContext: Record<string, any> = {};\n let curr: any = el;\n const rootEl = el.ownerDocument?.documentElement;\n while (curr && curr !== rootEl) {\n if (curr.__swc_loop_context) {\n Object.assign(loopContext, curr.__swc_loop_context);\n }\n curr = curr.parentElement || (curr.getRootNode() as any).host;\n }\n\n const $appHosts = SwcUtils.findAllAppHostsIncludingSelfDirect(el);\n const $appHost = $appHosts.length > 0 ? ($appHosts[$appHosts.length - 1] === el ? ($appHosts.length > 1 ? $appHosts[$appHosts.length - 2] : null) : $appHosts[$appHosts.length - 1]) : null;\n const $firstAppHost = $appHosts.length > 0 ? $appHosts[0] : null;\n\n return {\n $host,\n $parentHost,\n $hosts,\n $firstHost,\n $lastHost: $host,\n // $templateHost: (el as any).__swc_template_host,\n $appHost,\n $appHosts,\n $firstAppHost,\n $lastAppHost: $appHost,\n ...loopContext\n } as any;\n };\n\n export const parsePathPattern = (pattern: string | undefined, currentPath: string): { [key: string]: string } | null => {\n // pattern\uC774 null/undefined\uBA74 \uC640\uC77C\uB4DC\uCE74\uB4DC (\uBAA8\uB4E0 \uACBD\uB85C \uB9E4\uCE6D)\n if (pattern === null || pattern === undefined) return {};\n \n // \uACF5\uBC31\uB9CC \uC788\uB294 \uD328\uD134\uB3C4 \uC640\uC77C\uB4DC\uCE74\uB4DC\n const trimmedPattern = pattern.trim();\n if (trimmedPattern === '' && pattern !== '') return {}; // \uACF5\uBC31 \uBB38\uC790\uB9CC \uC788\uB294 \uACBD\uC6B0\n \n // \uD328\uD134\uC744 \uC815\uADDC\uC2DD\uC73C\uB85C \uBCC0\uD658\n // \uC9C0\uC6D0 \uD615\uC2DD:\n // {id} \u2192 ([^/]+) \uAE30\uBCF8 (/ \uC81C\uC678\uD55C \uBAA8\uB4E0 \uBB38\uC790)\n // {tail:.*} \u2192 (.*) \uC815\uADDC\uD45C\uD604\uC2DD \uC9C1\uC811 \uC9C0\uC815\n // {slug:[a-z0-9-]+} \u2192 ([a-z0-9-]+)\n const paramNames: string[] = [];\n const regexPattern = trimmedPattern.replace(/{(\\w+)(?::(.+?))?}/g, (match, paramName, customRegex) => {\n paramNames.push(paramName);\n // customRegex\uAC00 \uC788\uC73C\uBA74 \uC0AC\uC6A9, \uC5C6\uC73C\uBA74 \uAE30\uBCF8\uAC12 ([^/]+)\n return `(${customRegex || '[^/]+'})`;\n });\n \n const regex = new RegExp(`^${regexPattern}$`);\n const match = currentPath.match(regex);\n \n if (!match) return null;\n \n const result: { [key: string]: string } = {};\n paramNames.forEach((name, index) => {\n result[name] = match[index + 1];\n });\n \n return result;\n };\n\n\n};\n"],
5
- "mappings": "AACA,SAAQ,wBAAuB;AAIxB,MAAM,gBAAgB,OAAO,IAAI,gCAAgC;AAGjE,MAAM,eAAe,CAAC,MAAc,QAAqC;AAC9E,QAAM,IAAI,QAAQ,OAAO,aAAa,cAAc,WAAW;AAC/D,MAAI,CAAC,EAAG,OAAM,IAAI,MAAM,2BAA2B;AACnD,QAAM,WAAW,EAAE,cAAc,UAAU;AAC3C,WAAS,YAAY,KAAK,KAAK;AAC/B,SAAO,SAAS;AAClB;AAEO,MAAM,WAAW,CAAC,MAAoB,QAAyB;AACpE,QAAM,IAAI,QAAQ,OAAO,aAAa,cAAc,WAAW;AAC/D,MAAI,CAAC,EAAG,OAAM,IAAI,MAAM,2BAA2B;AACnD,SAAO,EAAE,eAAe,SAAS,UAAa,SAAS,OAAO,OAAO,IAAI,IAAI,EAAE;AACjF;AAEO,MAAM,cAAc,CAAC,SAAuB,QAA4B;AAC7E,QAAM,IAAI,QAAQ,OAAO,aAAa,cAAc,WAAW;AAC/D,MAAI,CAAC,EAAG,OAAM,IAAI,MAAM,2BAA2B;AACnD,SAAO,EAAE,cAAc,YAAY,UAAa,YAAY,OAAO,OAAO,OAAO,IAAI,EAAE;AACzF;AAGO,MAAM,gBAAgB,CAC3B,kBACA,SACA,YACM;AACN,QAAM,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WAAW,UAAU,SAAS,IAAK,UAAU,UAAU,SAAS,CAAC,MAAM,KAAM,UAAU,SAAS,IAAI,UAAU,UAAU,SAAS,CAAC,IAAI,OAAQ,UAAU,UAAU,SAAS,CAAC,IAAK;AACvL,UAAM,gBAAgB,UAAU,SAAS,IAAI,UAAU,CAAC,IAAI;AAE5D,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA;AAAA,MAEX;AAAA,MACA;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd,GAAG;AAAA,IACL;AAAA,EACF;AAEO,EAAMA,UAAA,mBAAmB,CAAC,SAA6B,gBAA0D;AAEtH,QAAI,YAAY,QAAQ,YAAY,OAAW,QAAO,CAAC;AAGvD,UAAM,iBAAiB,QAAQ,KAAK;AACpC,QAAI,mBAAmB,MAAM,YAAY,GAAI,QAAO,CAAC;AAOrD,UAAM,aAAuB,CAAC;AAC9B,UAAM,eAAe,eAAe,QAAQ,uBAAuB,CAACC,QAAO,WAAW,gBAAgB;AACpG,iBAAW,KAAK,SAAS;AAEzB,aAAO,IAAI,eAAe,OAAO;AAAA,IACnC,CAAC;AAED,UAAM,QAAQ,IAAI,OAAO,IAAI,YAAY,GAAG;AAC5C,UAAM,QAAQ,YAAY,MAAM,KAAK;AAErC,QAAI,CAAC,MAAO,QAAO;AAEnB,UAAM,SAAoC,CAAC;AAC3C,eAAW,QAAQ,CAAC,MAAM,UAAU;AAClC,aAAO,IAAI,IAAI,MAAM,QAAQ,CAAC;AAAA,IAChC,CAAC;AAED,WAAO;AAAA,EACT;AAAA,GA/Pe;AAkQhB;",
6
- "names": ["SwcUtils", "match"]
4
+ "sourcesContent": ["import {SwcAppInterface, HostSet, HelperSet, HelperHostSet} from '../types';\nimport {getElementConfig} from \"../decorators\";\nimport {getExpression, ExpressionResult, GetExpressionConfig, GetExpressionResult, ActionExpression} from '@dooboostore/core';\nimport {ElementApply, NodeSlot, Router} from \"@dooboostore/core-web\";\n\nexport const SWC_NOT_FOUND = Symbol.for('simple-web-component:not-found');\n\n\nexport const html = (str: string, document: Document) => {\n return [...document.createRange().createContextualFragment(str).childNodes];\n}\n// DOM Creation Utilities\nexport const htmlFragment = (html: string | Node | Node[], doc: Document): DocumentFragment => {\n if (!doc) throw new Error('Document is not available');\n const template = doc.createElement('template');\n if (typeof html === 'string') {\n template.innerHTML = html.trim();\n } else if (html instanceof Node) {\n template.appendChild(html);\n } else if (Array.isArray(html)) {\n template.append(...html);\n }\n // template.innerHTML = html.trim();\n return template.content;\n};\n\nexport const textNode = (text: string | any, doc?: Document): Text => {\n const d = doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n return d.createTextNode(text !== undefined && text !== null ? String(text) : '');\n};\n\nexport const commentNode = (comment: string | any, doc?: Document): Comment => {\n const d = doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n return d.createComment(comment !== undefined && comment !== null ? String(comment) : '');\n};\n\nexport type CreateElementConfig = { innerHtml?: string; property?: Record<string, any>, attrs?: Record<string, any>; };\nexport const createElement = <T extends HTMLElement>(\n documentOrWindow: Document | Window,\n tagName: string,\n options?: CreateElementConfig\n): T => {\n const doc = 'document' in documentOrWindow ? documentOrWindow.document : documentOrWindow;\n if (!doc) throw new Error('Document is not available');\n const el = doc.createElement(tagName) as T;\n if (options?.innerHtml) el.innerHTML = options.innerHtml;\n if (options?.attrs) {\n Object.entries(options.attrs).filter(([k,v])=>v).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n if (options?.property) {\n Object.entries(options.property).forEach(([k, v]) => el[k] = v);\n }\n return el;\n};\n\n// Element factory functions\nexport const htmlDivElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLDivElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('div') as HTMLDivElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlSpanElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLSpanElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('span') as HTMLSpanElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlButtonElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLButtonElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('button') as HTMLButtonElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlUlElement = (options?: { doc?: Document; attrs?: Record<string, any> }): HTMLUListElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('ul') as HTMLUListElement;\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlLiElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLLIElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('li') as HTMLLIElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlAElement = (html: string, options?: { href?: string; doc?: Document; attrs?: Record<string, any> }): HTMLAnchorElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('a') as HTMLAnchorElement;\n el.innerHTML = html.trim();\n if (options?.href) el.href = options.href;\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlPElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLParagraphElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('p') as HTMLParagraphElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlHeadingElement = (level: 1 | 2 | 3 | 4 | 5 | 6, html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLHeadingElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement(`h${level}`) as HTMLHeadingElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlSectionElement = (options?: { doc?: Document; attrs?: Record<string, any> }): HTMLElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('section');\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlArticleElement = (options?: { doc?: Document; attrs?: Record<string, any> }): HTMLElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('article');\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport namespace SwcUtils {\n\n\n export const getParentContainer = (e: Node) => {\n return e.parentElement ?? e.getRootNode() as any;\n }\n\n export const parsePathPatternsSetAttributeString = (pathPattern: string[], path: string) => {\n return JSON.stringify(SwcUtils.parsePathPatternsSet(pathPattern, path)).replace(/\"/g, \"'\");\n }\n\n export const parsePathPatternsSet = (pathPattern: string[], urlAndRouter?: string | Router) => {\n // if (!path) {\n // return;\n // }\n urlAndRouter ??= '/'\n const p = typeof urlAndRouter === 'string' ? urlAndRouter : urlAndRouter.value.url;\n const searchParams = new URLSearchParams();\n const qs = p.split('?')[1];\n qs?.split('&').forEach(it => {\n const [k, v] = it.split('=');\n searchParams.set(k, v);\n })\n return {\n path: p,\n searchParams,\n pathData: SwcUtils.parsePathPatterns(pathPattern, p)\n };\n };\n export const parsePathPatterns = (pathPattern: string[], path: string) => {\n for (const pattern of pathPattern) {\n const data = SwcUtils.parsePathPattern(pattern, path || '/');\n if (data !== null) {\n return data;\n }\n }\n };\n\n export const getHelperSet = (win: Window): HelperSet => {\n const doc: Document = win.document;\n return {\n $d: doc,\n $w: win,\n $q: (sel: string, root?: Element | Document | ShadowRoot) => (root ?? doc).querySelector(sel),\n $qa: (sel: string, root?: Element | Document | ShadowRoot) => Array.from((root ?? doc).querySelectorAll(sel)) as HTMLElement[],\n $qi: (id: string, root?: Document | ShadowRoot) => (root ?? doc).getElementById(id) as HTMLElement\n } as const;\n };\n\n export const getHelperAndHostSet = (win: Window, el: HTMLElement): HelperHostSet => {\n const helperSet = getHelperSet(win);\n const hostSet = getHostSet(el);\n return {\n ...helperSet,\n ...hostSet,\n $this: el,\n };\n };\n\n export const getValueByPath = (obj: any, path: string, rootName: string) => {\n if (!obj || !path) return SWC_NOT_FOUND;\n\n const parts = path.split('.');\n let current = obj;\n\n for (const part of parts) {\n if (current === null || current === undefined) return SWC_NOT_FOUND;\n current = current[part];\n }\n return current;\n };\n\n /**\n * Finds the nearest logical SWC host for an element.\n * Checks __swc_host property first, then climbs the DOM tree.\n */\n export const findNearestSwcHostIncludingSelf = (el: HTMLElement | Node): HTMLElement | undefined => {\n const el1 = el as any;\n if (el1.__swc_host) return el1.__swc_host;\n\n let current: any = el.parentElement || (el.getRootNode?.() as any)?.host;\n const doc = el.ownerDocument;\n const win = doc?.defaultView || ((typeof window !== 'undefined' ? window : undefined) as any);\n while (current && current !== doc && current !== win) {\n if (current.__swc_host) return current.__swc_host;\n if (getElementConfig(current)) return current as HTMLElement;\n current = current.parentElement || (current.getRootNode?.() as any)?.host;\n }\n return undefined;\n };\n\n /**\n * Returns all SWC ancestors (excluding self) in [root, ..., parent] order.\n */\n export const findAllSwcHostsIncludingSelf = (el: HTMLElement | Node): HTMLElement[] => {\n const hosts: HTMLElement[] = [];\n let current = findNearestSwcHostIncludingSelf(el);\n while (current) {\n hosts.push(current);\n // To find the next ancestor, we must start searching from the PARENT of the found host\n current = findNearestSwcHostIncludingSelf(current);\n }\n return hosts.reverse();\n };\n\n export const getHosts = (el: HTMLElement): HTMLElement[] => {\n const ancestors = findAllSwcHostsIncludingSelf(el);\n if (getElementConfig(el)) return [...ancestors, el];\n return ancestors;\n };\n\n export const getHost = (el: HTMLElement): HTMLElement | undefined => {\n if (getElementConfig(el)) return el;\n return findNearestSwcHostIncludingSelf(el);\n };\n\n\n export function projectProcessHtml(id: string, htmlOrNode: string, document: Document): string;\n export function projectProcessHtml(id: string, htmlOrNode: ((Node)[]) | Node, document: Document): (Node)[];\n export function projectProcessHtml(id: string, htmlOrNode: string | ((Node)[]) | Node, document: Document): string | (Node)[] {\n if (typeof htmlOrNode === 'string') {\n // slot\n let t = htmlOrNode;\n // if (!config?.excludeSlot) {\n t = SwcUtils.processHtml(id, t, {document: document, replaceWrap: {start: '<!--[[', end: ']]-->'}, replacer: (id, script) => NodeSlot.slot(id, script)});\n // }\n // if (!config?.excludeHtml) {\n // Ea html\n t = SwcUtils.processHtml(id, t, {document: document, replaceWrap: {start: '<!--[html', end: ']-->'}, replacer: (id, script) => ElementApply.html(id, script)});\n // }\n\n // if (!config?.excludeText) {\n // Ea text\n t = SwcUtils.processHtml(id, t, {document: document, replaceWrap: {start: '<!--[text', end: ']-->'}, replacer: (id, script) => ElementApply.text(id, script)});\n // }\n\n // if (!config.excludeAttribute) {\n // Ea attribute\n t = SwcUtils.processHtml(id, t, {\n document: document,\n replaceWrap: {start: /a::\\w+=\\s*\"/, end: /\"\\s/}, replacer: (id, script, er) => {\n console.log('start: /a-->', er)\n const match = er.expressionStart.match(/^\\w+::(\\w+)=\"/)\n const name = match?.[1];\n return ElementApply.attribute(id, name, script)\n }\n });\n // }\n\n // if (!config.excludeEvent) {\n t = SwcUtils.processHtml(id, t, {\n document: document,\n replaceWrap: {start: /e::\\w+=\\s*\"/, end: /\"\\s/}, replacer: (id, script, er) => {\n console.log('start: /e-->', er)\n const match = er.expressionStart.match(/^\\w+::(\\w+)=\"/)\n const name = match?.[1];\n return ElementApply.event(id, name, script)\n }\n });\n // }\n\n\n // if (!config.excludeProperty) {\n t = SwcUtils.processHtml(id, t, {\n document: document,\n replaceWrap: {start: /p:\\w+=\\s*\"/, end: /\"\\s/}, replacer: (id, script, er) => {\n console.log('start: /p-->', er)\n const match = er.expressionStart.match(/^\\w+:(\\w+)=\"/)\n const name = match?.[1];\n return ElementApply.property(id, name, script)\n }\n });\n return t;\n } else if (htmlOrNode) {\n\n // \uC544\uB798 node\uC77C\uB584\uB3C4 \uCC98\uB9AC\uD558\uB3C4\uB85D \uB9CC\uB4EC \uC544\uC9C1\uD14C\uC2A4\uD2B8\uB294 \uC548\uD574\uBD04 \uD14C\uC2A4\uD2B8\uD6C4 \uC8FC\uC11D\uC9C0\uC6B8\uAC83.\n const nodes = Array.isArray(htmlOrNode) ? htmlOrNode : [htmlOrNode];\n const window = document.defaultView;\n nodes.forEach(node => {\n // TextNode \uD569\uCE58\uAE30\n node.normalize();\n const nodes = document.createTreeWalker(node, window.NodeFilter.SHOW_ELEMENT | window.NodeFilter.SHOW_COMMENT)\n\n const getSlotData = (s: string) => {\n return s.match(/^\\[\\[([\\s\\S]+)\\]\\]$/)?.[1]?.trim();\n }\n const getHtmlData = (s: string) => {\n return s.match(/^\\[html([\\s\\S]+)\\]$/)?.[1]?.trim();\n // return s.startsWith('[html') && s.endsWith(']');\n }\n const getTextData = (s: string) => {\n return s.match(/^\\[text([\\s\\S]+)\\]$/)?.[1]?.trim();\n // return s.startsWith('[text') && s.endsWith(']');\n }\n while (nodes.nextNode()) {\n const currentNode = nodes.currentNode;\n if (currentNode.nodeType === window.Node.COMMENT_NODE) {\n const targetNode = currentNode as Comment;\n const v = targetNode.data.trim();\n const slotData = getSlotData(v);\n const htmlData = getHtmlData(v);\n const textData = getTextData(v);\n if (v && slotData) {\n const res = NodeSlot.slotIds(id, slotData)\n targetNode.data = res.start;\n const end = document.createComment(res.end)\n targetNode.parentNode?.insertBefore(end, targetNode.nextSibling);\n // document.createTe\n\n } else if (v && htmlData) {\n const s = ElementApply.htmlDataSet(id, htmlData);\n targetNode.data = s.start;\n const end = document.createComment(s.end)\n targetNode.parentNode?.insertBefore(end, targetNode.nextSibling);\n } else if (v && textData) {\n const s = ElementApply.textDataSet(id, textData);\n const end = document.createComment(s.end)\n targetNode.data = s.start;\n targetNode.parentNode?.insertBefore(end, targetNode.nextSibling);\n }\n\n } else if (currentNode.nodeType === window.Node.ELEMENT_NODE) {\n const targetNode = currentNode as Element;\n targetNode.getAttributeNames().forEach(it => {\n const e = it.match(/e::(\\w+)$/);\n const eventName = e?.[1];\n const p = it.match(/p::(\\w+)$/);\n const propertyName = p?.[1];\n const a = it.match(/a::(\\w+)$/);\n const attributeName = a?.[1];\n\n const value = targetNode.getAttribute(it);\n if (eventName) {\n targetNode.setAttribute(ElementApply.eventName(id, eventName), value);\n targetNode.removeAttribute(it);\n } else if (propertyName) {\n targetNode.setAttribute(ElementApply.propertyName(id, propertyName), value);\n targetNode.removeAttribute(it);\n } else if (attributeName) {\n targetNode.setAttribute(ElementApply.attributeName(id, attributeName), value);\n targetNode.removeAttribute(it);\n }\n })\n }\n }\n\n })\n\n return nodes;\n }\n // }\n\n\n }\n\n // export function processHtml(id: string, htmlOrNode: string, config: { document: Document, replaceWrap: { start: string | RegExp, end: string | RegExp }, replacer: (id: string, script: string, er: ExpressionResult) => string }): string;\n // export function processHtml(id: string, htmlOrNode: (Node | string)[], config: { document: Document, replaceWrap: { start: string | RegExp, end: string | RegExp }, replacer: (id: string, script: string, er: ExpressionResult) => string }): (Node | string)[] ;\n export function processHtml(\n id: string,\n html: string,\n config: { document: Document, replaceWrap: { start: string | RegExp, end: string | RegExp }, replacer: (id: string, script: string, er: ExpressionResult) => string }\n ): string {\n const replaceStart = config.replaceWrap.start;\n const replaceEnd = config.replaceWrap.end;\n const callReturnStart = `${config.replaceWrap.start}=`;\n const callReturnEnd = `${config.replaceWrap.end}`;\n const callStart = `${config.replaceWrap.start}@`;\n const callEnd = `${config.replaceWrap.end}`;\n const hasPattern = (text: string | null | undefined, start: string, end: string) => {\n if (!text) return false;\n const s = text.indexOf(start);\n const e = text.indexOf(end, s + start.length);\n return s !== -1 && e !== -1 && s < e;\n };\n\n const actionConfig: GetExpressionConfig = {expression: {replace: {start: replaceStart, end: replaceEnd}, callReturn: {start: callReturnStart, end: callReturnEnd}, call: {start: callStart, end: callEnd}}};\n const runActionExpression = (source: string) => {\n const actionExpression = new ActionExpression(source, actionConfig);\n actionExpression.getExpressions().filter(it => it.type === 'replace').forEach(it => {\n actionExpression.replace(it, config.replacer(id, it.script?.trim(), it));\n });\n return actionExpression.toResult();\n };\n\n return runActionExpression(html);\n // if (typeof html === 'string') {\n // } else {\n // }\n }\n\n export const getAppHosts = (el: HTMLElement): SwcAppInterface[] => {\n // const hosts = getHosts(el);\n // return hosts.filter(host => host.tagName.toLowerCase() === 'swc-app' || host.getAttribute('is')?.startsWith('swc-app-')) as SwcAppInterface[];\n const hosts = SwcUtils.findAllAppHostsIncludingSelfDirect(el);\n return hosts;\n };\n\n export const getAppHost = (el: HTMLElement): SwcAppInterface | undefined => {\n const appHosts = getAppHosts(el);\n const appHostsWithoutSelf = appHosts.filter(h => h !== el);\n return appHostsWithoutSelf.length > 0 ? appHostsWithoutSelf[appHostsWithoutSelf.length - 1] : undefined;\n };\n\n /**\n * Find the closest app host by traversing DOM tree directly, including the element itself.\n * Only checks tagName and is attribute - no SWC host discovery.\n * Useful for Safari polyfill compatibility where is=\"\" elements upgrade in child-first order.\n */\n export const findAppHostIncludingSelfDirect = (el: HTMLElement): SwcAppInterface | null => {\n const appHosts = findAllAppHostsIncludingSelfDirect(el);\n return appHosts.length > 0 ? appHosts[appHosts.length - 1] : null;\n };\n\n /**\n * Find all app hosts by traversing DOM tree directly, including the element itself.\n * Returns array of all app hosts in [root, ..., closest-parent-or-self] order.\n * Only checks tagName and is attribute - no SWC host discovery.\n * Useful for Safari polyfill compatibility where is=\"\" elements upgrade in child-first order.\n */\n export const findAllAppHostsIncludingSelfDirect = (el: HTMLElement): SwcAppInterface[] => {\n const appHosts: SwcAppInterface[] = [];\n\n const w = el.ownerDocument?.defaultView || ((typeof window !== 'undefined' ? window : undefined) as any);\n\n // Guard against SSR environment where window might be undefined\n if (!w) {\n return appHosts;\n }\n\n // console.log('------?',w.ShadowRoot);\n // el \uC790\uCCB4\uBD80\uD130 \uC2DC\uC791 (el\uC774 app host\uC77C \uC218\uB3C4 \uC788\uC74C)\n let current: HTMLElement | null = el;\n\n while (current) {\n const isAppHost =\n current.tagName.toLowerCase() === 'swc-app' ||\n current.getAttribute('is')?.startsWith('swc-app-');\n if (isAppHost) {\n appHosts.push(current as SwcAppInterface);\n }\n\n // \uB2E4\uC74C \uBD80\uBAA8 \uCC3E\uAE30\n if (current.parentElement) {\n // Light DOM: \uC815\uC0C1\uC801\uC778 \uBD80\uBAA8 \uC694\uC18C\n current = current.parentElement;\n } else {\n // parentElement\uAC00 \uC5C6\uC74C = Shadow root\uC758 \uC9C1\uC811 \uC790\uC2DD\uC77C \uC218 \uC788\uC74C\n const root = current.getRootNode();\n if (w.ShadowRoot && root instanceof w.ShadowRoot) {\n // Shadow host\uB85C \uC62C\uB77C\uAC00\uAE30\n current = (root as ShadowRoot).host as HTMLElement;\n } else {\n // Document root \uB3C4\uB2EC\n break;\n }\n }\n }\n return appHosts.reverse(); // [root, ..., closest-parent-or-self]\n };\n\n export const getHostSet = (el: HTMLElement): HostSet => {\n const ancestors = findAllSwcHostsIncludingSelf(el); // [root, ..., parent]\n\n const $host = ancestors.length > 0 ? ancestors[ancestors.length - 1] : null;\n const $parentHost = ancestors.length > 1 ? ancestors[ancestors.length - 2] : null;\n const $hosts = ancestors;\n const $firstHost = ancestors.length > 0 ? ancestors[0] : null;\n\n // Collect loop contexts\n const loopContext: Record<string, any> = {};\n let curr: any = el;\n const rootEl = el.ownerDocument?.documentElement;\n while (curr && curr !== rootEl) {\n if (curr.__swc_loop_context) {\n Object.assign(loopContext, curr.__swc_loop_context);\n }\n curr = curr.parentElement || (curr.getRootNode() as any).host;\n }\n\n const $appHosts = SwcUtils.findAllAppHostsIncludingSelfDirect(el);\n const $appHost = $appHosts.length > 0 ? ($appHosts[$appHosts.length - 1] === el ? ($appHosts.length > 1 ? $appHosts[$appHosts.length - 2] : null) : $appHosts[$appHosts.length - 1]) : null;\n const $firstAppHost = $appHosts.length > 0 ? $appHosts[0] : null;\n\n return {\n $host,\n $parentHost,\n $hosts,\n $firstHost,\n $lastHost: $host,\n // $templateHost: (el as any).__swc_template_host,\n $appHost,\n $appHosts,\n $firstAppHost,\n $lastAppHost: $appHost,\n ...loopContext\n } as any;\n };\n\n export const parsePathPattern = (pattern: string | undefined, currentPath: string): { [key: string]: string } | null => {\n // pattern\uC774 null/undefined\uBA74 \uC640\uC77C\uB4DC\uCE74\uB4DC (\uBAA8\uB4E0 \uACBD\uB85C \uB9E4\uCE6D)\n if (pattern === null || pattern === undefined) return {};\n\n // \uACF5\uBC31\uB9CC \uC788\uB294 \uD328\uD134\uB3C4 \uC640\uC77C\uB4DC\uCE74\uB4DC\n const trimmedPattern = pattern.trim();\n if (trimmedPattern === '' && pattern !== '') return {}; // \uACF5\uBC31 \uBB38\uC790\uB9CC \uC788\uB294 \uACBD\uC6B0\n\n // \uD328\uD134\uC744 \uC815\uADDC\uC2DD\uC73C\uB85C \uBCC0\uD658\n // \uC9C0\uC6D0 \uD615\uC2DD:\n // {id} \u2192 ([^/]+) \uAE30\uBCF8 (/ \uC81C\uC678\uD55C \uBAA8\uB4E0 \uBB38\uC790)\n // {tail:.*} \u2192 (.*) \uC815\uADDC\uD45C\uD604\uC2DD \uC9C1\uC811 \uC9C0\uC815\n // {slug:[a-z0-9-]+} \u2192 ([a-z0-9-]+)\n const paramNames: string[] = [];\n const regexPattern = trimmedPattern.replace(/{(\\w+)(?::(.+?))?}/g, (match, paramName, customRegex) => {\n paramNames.push(paramName);\n // customRegex\uAC00 \uC788\uC73C\uBA74 \uC0AC\uC6A9, \uC5C6\uC73C\uBA74 \uAE30\uBCF8\uAC12 ([^/]+)\n return `(${customRegex || '[^/]+'})`;\n });\n\n const regex = new RegExp(`^${regexPattern}$`);\n const match = currentPath.match(regex);\n\n if (!match) return null;\n\n const result: { [key: string]: string } = {};\n paramNames.forEach((name, index) => {\n result[name] = match[index + 1];\n });\n\n return result;\n };\n\n\n}\n;\n"],
5
+ "mappings": "AACA,SAAQ,wBAAuB;AAC/B,SAAmF,wBAAuB;AAC1G,SAAQ,cAAc,gBAAuB;AAEtC,MAAM,gBAAgB,OAAO,IAAI,gCAAgC;AAGjE,MAAM,OAAO,CAAC,KAAaA,cAAuB;AACvD,SAAO,CAAC,GAAGA,UAAS,YAAY,EAAE,yBAAyB,GAAG,EAAE,UAAU;AAC5E;AAEO,MAAM,eAAe,CAACC,OAA8B,QAAoC;AAC7F,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,2BAA2B;AACrD,QAAM,WAAW,IAAI,cAAc,UAAU;AAC7C,MAAI,OAAOA,UAAS,UAAU;AAC5B,aAAS,YAAYA,MAAK,KAAK;AAAA,EACjC,WAAWA,iBAAgB,MAAM;AAC/B,aAAS,YAAYA,KAAI;AAAA,EAC3B,WAAW,MAAM,QAAQA,KAAI,GAAG;AAC9B,aAAS,OAAO,GAAGA,KAAI;AAAA,EACzB;AAEA,SAAO,SAAS;AAClB;AAEO,MAAM,WAAW,CAAC,M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