@openclaw/line 2026.7.2-beta.4 → 2026.7.2-beta.7

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 (149) hide show
  1. package/README.md +1 -1
  2. package/dist/accounts-BqEVsDoB.js +103 -0
  3. package/dist/api.js +2 -2
  4. package/dist/{card-command-Ch0TwcDW.js → card-command-ty11OJNt.js} +1 -2
  5. package/dist/{channel-CNcv74n2.js → channel-D4i_K4fQ.js} +9 -9
  6. package/dist/channel-plugin-api.js +1 -1
  7. package/dist/channel.runtime-BdhK8Xw7.js +4 -0
  8. package/dist/contract-api.js +1 -1
  9. package/dist/flex-templates-iKJsyCq-.js +1339 -0
  10. package/dist/index.js +1 -1
  11. package/dist/{markdown-to-line-DWIdzBfy.js → markdown-to-line-DMDQTMhx.js} +27 -12
  12. package/dist/{monitor-BinAXvIY.js → monitor-DXEodYFJ.js} +63 -106
  13. package/dist/monitor.runtime-CZquR7jI.js +2 -0
  14. package/dist/{outbound.runtime-DRyoVa81.js → outbound.runtime-BS0IhU_M.js} +1 -1
  15. package/dist/{probe-BslD77tJ.js → probe-CM03wo6r.js} +7 -9
  16. package/dist/probe.runtime-D13ZtXsd.js +2 -0
  17. package/dist/{reply-payload-transform-d57WYHFm.js → reply-payload-transform-D5-dHB8b.js} +1 -1
  18. package/dist/runtime-api.js +9 -9
  19. package/dist/setup-api.js +1 -1
  20. package/dist/{setup-surface-Bili5gWy.js → setup-surface-DRQ7n0En.js} +93 -129
  21. package/package.json +4 -5
  22. package/dist/accounts-BUBOoW5Q.js +0 -169
  23. package/dist/basic-cards-Rb-Ow7LN.js +0 -307
  24. package/dist/channel.runtime-BBCZvRa_.js +0 -4
  25. package/dist/flex-templates-KiKaVYgi.js +0 -813
  26. package/dist/monitor.runtime-DKj4FHkA.js +0 -2
  27. package/dist/probe.runtime-CRhVGqwl.js +0 -2
  28. package/npm-shrinkwrap.json +0 -60
  29. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/LICENSE +0 -0
  30. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/README.md +0 -0
  31. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/assert/strict.d.ts +0 -0
  32. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/assert.d.ts +0 -0
  33. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/async_hooks.d.ts +0 -0
  34. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/buffer.buffer.d.ts +0 -0
  35. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/buffer.d.ts +0 -0
  36. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/child_process.d.ts +0 -0
  37. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/cluster.d.ts +0 -0
  38. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/compatibility/iterators.d.ts +0 -0
  39. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/console.d.ts +0 -0
  40. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/constants.d.ts +0 -0
  41. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/crypto.d.ts +0 -0
  42. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/dgram.d.ts +0 -0
  43. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/diagnostics_channel.d.ts +0 -0
  44. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/dns/promises.d.ts +0 -0
  45. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/dns.d.ts +0 -0
  46. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/domain.d.ts +0 -0
  47. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/events.d.ts +0 -0
  48. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/fs/promises.d.ts +0 -0
  49. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/fs.d.ts +0 -0
  50. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/globals.d.ts +0 -0
  51. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/globals.typedarray.d.ts +0 -0
  52. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/http.d.ts +0 -0
  53. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/http2.d.ts +0 -0
  54. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/https.d.ts +0 -0
  55. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/index.d.ts +0 -0
  56. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/inspector.d.ts +0 -0
  57. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/inspector.generated.d.ts +0 -0
  58. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/module.d.ts +0 -0
  59. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/net.d.ts +0 -0
  60. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/os.d.ts +0 -0
  61. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/package.json +0 -0
  62. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/path.d.ts +0 -0
  63. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/perf_hooks.d.ts +0 -0
  64. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/process.d.ts +0 -0
  65. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/punycode.d.ts +0 -0
  66. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/querystring.d.ts +0 -0
  67. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/readline/promises.d.ts +0 -0
  68. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/readline.d.ts +0 -0
  69. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/repl.d.ts +0 -0
  70. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/sea.d.ts +0 -0
  71. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/sqlite.d.ts +0 -0
  72. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/stream/consumers.d.ts +0 -0
  73. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/stream/promises.d.ts +0 -0
  74. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/stream/web.d.ts +0 -0
  75. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/stream.d.ts +0 -0
  76. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/string_decoder.d.ts +0 -0
  77. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/test.d.ts +0 -0
  78. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/timers/promises.d.ts +0 -0
  79. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/timers.d.ts +0 -0
  80. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/tls.d.ts +0 -0
  81. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/trace_events.d.ts +0 -0
  82. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/ts5.6/buffer.buffer.d.ts +0 -0
  83. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/ts5.6/compatibility/float16array.d.ts +0 -0
  84. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/ts5.6/globals.typedarray.d.ts +0 -0
  85. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/ts5.6/index.d.ts +0 -0
  86. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/ts5.7/compatibility/float16array.d.ts +0 -0
  87. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/ts5.7/index.d.ts +0 -0
  88. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/tty.d.ts +0 -0
  89. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/url.d.ts +0 -0
  90. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/util.d.ts +0 -0
  91. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/v8.d.ts +0 -0
  92. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/vm.d.ts +0 -0
  93. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/wasi.d.ts +0 -0
  94. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/abortcontroller.d.ts +0 -0
  95. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/crypto.d.ts +0 -0
  96. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/domexception.d.ts +0 -0
  97. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/events.d.ts +0 -0
  98. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/fetch.d.ts +0 -0
  99. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/navigator.d.ts +0 -0
  100. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/storage.d.ts +0 -0
  101. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/web-globals/streams.d.ts +0 -0
  102. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/worker_threads.d.ts +0 -0
  103. /package/node_modules/{@types → @line/bot-sdk/node_modules/@types}/node/zlib.d.ts +0 -0
  104. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/LICENSE +0 -0
  105. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/README.md +0 -0
  106. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/agent.d.ts +0 -0
  107. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/api.d.ts +0 -0
  108. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/balanced-pool.d.ts +0 -0
  109. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/cache-interceptor.d.ts +0 -0
  110. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/cache.d.ts +0 -0
  111. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/client-stats.d.ts +0 -0
  112. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/client.d.ts +0 -0
  113. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/connector.d.ts +0 -0
  114. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/content-type.d.ts +0 -0
  115. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/cookies.d.ts +0 -0
  116. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/diagnostics-channel.d.ts +0 -0
  117. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/dispatcher.d.ts +0 -0
  118. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/env-http-proxy-agent.d.ts +0 -0
  119. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/errors.d.ts +0 -0
  120. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/eventsource.d.ts +0 -0
  121. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/fetch.d.ts +0 -0
  122. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/formdata.d.ts +0 -0
  123. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/global-dispatcher.d.ts +0 -0
  124. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/global-origin.d.ts +0 -0
  125. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/h2c-client.d.ts +0 -0
  126. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/handlers.d.ts +0 -0
  127. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/header.d.ts +0 -0
  128. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/index.d.ts +0 -0
  129. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/interceptors.d.ts +0 -0
  130. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/mock-agent.d.ts +0 -0
  131. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/mock-call-history.d.ts +0 -0
  132. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/mock-client.d.ts +0 -0
  133. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/mock-errors.d.ts +0 -0
  134. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/mock-interceptor.d.ts +0 -0
  135. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/mock-pool.d.ts +0 -0
  136. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/package.json +0 -0
  137. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/patch.d.ts +0 -0
  138. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/pool-stats.d.ts +0 -0
  139. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/pool.d.ts +0 -0
  140. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/proxy-agent.d.ts +0 -0
  141. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/readable.d.ts +0 -0
  142. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/retry-agent.d.ts +0 -0
  143. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/retry-handler.d.ts +0 -0
  144. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/round-robin-pool.d.ts +0 -0
  145. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/snapshot-agent.d.ts +0 -0
  146. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/util.d.ts +0 -0
  147. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/utility.d.ts +0 -0
  148. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/webidl.d.ts +0 -0
  149. /package/node_modules/{undici-types → @line/bot-sdk/node_modules/undici-types}/websocket.d.ts +0 -0
@@ -0,0 +1,1339 @@
1
+ import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
2
+ import { isRecord } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
3
+ //#region extensions/line/src/actions.ts
4
+ const LINE_ACTION_LABEL_LIMIT = 20;
5
+ const LINE_ACTION_DATA_LIMIT = 300;
6
+ const LINE_ACTION_URI_LIMIT = 1e3;
7
+ const LINE_CLIPBOARD_TEXT_LIMIT = 1e3;
8
+ const LINE_RICH_MENU_ALIAS_LIMIT = 32;
9
+ const LINE_IMAGEMAP_ACTION_LABEL_LIMIT = 100;
10
+ const LINE_IMAGEMAP_MESSAGE_TEXT_LIMIT = 400;
11
+ const LINE_IMAGEMAP_EXTERNAL_LINK_LABEL_LIMIT = 30;
12
+ const LINE_IMAGEMAP_ACTION_LIMIT = 50;
13
+ const graphemeSegmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
14
+ function truncateLineActionText(text, limit) {
15
+ let result = "";
16
+ let count = 0;
17
+ for (const { segment } of graphemeSegmenter.segment(text)) {
18
+ const codePointCount = Array.from(segment).length;
19
+ if (count + codePointCount > limit) break;
20
+ result += segment;
21
+ count += codePointCount;
22
+ }
23
+ return result;
24
+ }
25
+ function truncateLineActionLabel(label, limit = LINE_ACTION_LABEL_LIMIT) {
26
+ return truncateLineActionText(label, limit) || (label ? "…" : "");
27
+ }
28
+ function truncateLineActionData(data) {
29
+ return truncateUtf16Safe(data, LINE_ACTION_DATA_LIMIT);
30
+ }
31
+ const unavailableActionMarker = Symbol("lineUnavailableAction");
32
+ function unavailableAction(kind, reason) {
33
+ const action = {
34
+ type: "message",
35
+ label: "Unavailable",
36
+ text: `${kind} unavailable: ${reason}`
37
+ };
38
+ Object.defineProperty(action, unavailableActionMarker, { value: true });
39
+ return action;
40
+ }
41
+ const actionTypes = /* @__PURE__ */ new Set([
42
+ "camera",
43
+ "cameraRoll",
44
+ "clipboard",
45
+ "datetimepicker",
46
+ "location",
47
+ "message",
48
+ "postback",
49
+ "richmenuswitch",
50
+ "uri"
51
+ ]);
52
+ function isLineAction(value) {
53
+ return isRecord(value) && typeof value.type === "string" && actionTypes.has(value.type);
54
+ }
55
+ function isUnavailableAction(action) {
56
+ return action[unavailableActionMarker] === true;
57
+ }
58
+ function normalizeNestedActions(value, labelLimit, warnings) {
59
+ if (Array.isArray(value)) {
60
+ const normalized = [];
61
+ for (const item of value) normalized.push(normalizeNestedActions(item, labelLimit, warnings));
62
+ return normalized;
63
+ }
64
+ if (!isRecord(value)) return value;
65
+ const normalized = { ...value };
66
+ for (const [key, nested] of Object.entries(value)) if ((key === "action" || key === "defaultAction") && isLineAction(nested)) {
67
+ const action = normalizeLineAction(nested, labelLimit);
68
+ if (warnings && key === "action" && (value.type === "video" && action.type !== "uri" || value.type !== "button" && isUnavailableAction(action))) {
69
+ delete normalized[key];
70
+ warnings.push(isUnavailableAction(action) ? action.text ?? "Action unavailable." : "Action unavailable in this video.");
71
+ } else normalized[key] = action;
72
+ } else if (key === "actions" && Array.isArray(nested)) normalized[key] = nested.map((action) => isLineAction(action) ? normalizeLineAction(action, labelLimit) : action);
73
+ else normalized[key] = normalizeNestedActions(nested, labelLimit, warnings);
74
+ return normalized;
75
+ }
76
+ function normalizeFlexBubbleActions(value) {
77
+ if (!isRecord(value) || value.type !== "bubble") return normalizeNestedActions(value, 40);
78
+ const warnings = [];
79
+ const normalized = normalizeNestedActions(value, 40, warnings);
80
+ if (!isRecord(normalized) || warnings.length === 0) return normalized;
81
+ const warning = {
82
+ type: "text",
83
+ text: [...new Set(warnings)].join("\n"),
84
+ wrap: true,
85
+ size: "sm",
86
+ color: "#B45309",
87
+ margin: "md"
88
+ };
89
+ const body = normalized.body;
90
+ if (isRecord(body) && Array.isArray(body.contents)) normalized.body = {
91
+ ...body,
92
+ contents: [...body.contents, warning]
93
+ };
94
+ else normalized.body = {
95
+ type: "box",
96
+ layout: "vertical",
97
+ contents: [warning]
98
+ };
99
+ return normalized;
100
+ }
101
+ function normalizeFlexContainerActions(value) {
102
+ if (!isRecord(value)) return value;
103
+ if (value.type === "bubble") return normalizeFlexBubbleActions(value);
104
+ if (value.type === "carousel" && Array.isArray(value.contents)) return {
105
+ ...value,
106
+ contents: value.contents.map((bubble) => normalizeFlexBubbleActions(bubble))
107
+ };
108
+ return normalizeNestedActions(value, 40);
109
+ }
110
+ function unavailableImagemapAction(kind, reason, area) {
111
+ return {
112
+ type: "message",
113
+ label: "Unavailable",
114
+ text: `${kind} unavailable: ${reason}`,
115
+ area
116
+ };
117
+ }
118
+ function normalizeImagemapAction(action) {
119
+ const label = action.label === void 0 ? void 0 : truncateLineActionText(action.label, LINE_IMAGEMAP_ACTION_LABEL_LIMIT);
120
+ if (action.type === "uri") {
121
+ if (truncateUtf16Safe(action.linkUri, LINE_ACTION_URI_LIMIT) !== action.linkUri) return unavailableImagemapAction("Link", "URL exceeds LINE's limit.", action.area);
122
+ return {
123
+ ...action,
124
+ label
125
+ };
126
+ }
127
+ if (action.type === "message") {
128
+ const text = truncateUtf16Safe(action.text, LINE_IMAGEMAP_MESSAGE_TEXT_LIMIT);
129
+ if (text !== action.text) return unavailableImagemapAction("Action", "message text exceeds LINE's limit.", action.area);
130
+ return {
131
+ ...action,
132
+ label,
133
+ text
134
+ };
135
+ }
136
+ if (truncateUtf16Safe(action.clipboardText, LINE_CLIPBOARD_TEXT_LIMIT) !== action.clipboardText) return unavailableImagemapAction("Action", "clipboard text exceeds LINE's limit.", action.area);
137
+ return {
138
+ ...action,
139
+ label
140
+ };
141
+ }
142
+ function normalizeImagemapVideo(video) {
143
+ const externalLink = video.externalLink;
144
+ if (!externalLink) return { video };
145
+ const label = externalLink.label === void 0 ? void 0 : truncateUtf16Safe(externalLink.label, LINE_IMAGEMAP_EXTERNAL_LINK_LABEL_LIMIT) || (externalLink.label ? "…" : "");
146
+ if (externalLink.linkUri !== void 0 && truncateUtf16Safe(externalLink.linkUri, LINE_ACTION_URI_LIMIT) !== externalLink.linkUri) {
147
+ const normalizedVideo = { ...video };
148
+ delete normalizedVideo.externalLink;
149
+ return {
150
+ video: normalizedVideo,
151
+ fallbackAction: video.area === void 0 ? void 0 : unavailableImagemapAction("Link", "URL exceeds LINE's limit.", video.area)
152
+ };
153
+ }
154
+ return { video: {
155
+ ...video,
156
+ externalLink: {
157
+ ...externalLink,
158
+ label
159
+ }
160
+ } };
161
+ }
162
+ function normalizeLineMessageActions(message) {
163
+ let normalized;
164
+ if (message.type === "flex") normalized = {
165
+ ...message,
166
+ contents: normalizeFlexContainerActions(message.contents)
167
+ };
168
+ else if (message.type === "template") {
169
+ const labelLimit = message.template.type === "image_carousel" ? 12 : 20;
170
+ normalized = {
171
+ ...message,
172
+ template: normalizeNestedActions(message.template, labelLimit)
173
+ };
174
+ } else if (message.type === "imagemap") {
175
+ const actions = message.actions.map(normalizeImagemapAction);
176
+ const videoResult = message.video ? normalizeImagemapVideo(message.video) : void 0;
177
+ if (videoResult?.fallbackAction) {
178
+ if (actions.length < LINE_IMAGEMAP_ACTION_LIMIT) actions.push(videoResult.fallbackAction);
179
+ }
180
+ normalized = {
181
+ ...message,
182
+ actions,
183
+ video: videoResult?.video
184
+ };
185
+ } else normalized = { ...message };
186
+ if (message.quickReply) normalized = {
187
+ ...normalized,
188
+ quickReply: normalizeNestedActions(message.quickReply, 20)
189
+ };
190
+ return normalized;
191
+ }
192
+ function normalizeLineAction(action, labelLimit = LINE_ACTION_LABEL_LIMIT) {
193
+ if (isUnavailableAction(action)) return action;
194
+ const label = action.label === void 0 ? void 0 : truncateLineActionLabel(action.label, labelLimit);
195
+ if (action.type === "uri") {
196
+ const uriTooLong = action.uri !== void 0 && truncateUtf16Safe(action.uri, LINE_ACTION_URI_LIMIT) !== action.uri;
197
+ const desktopUri = action.altUri?.desktop;
198
+ const desktopUriTooLong = desktopUri !== void 0 && truncateUtf16Safe(desktopUri, LINE_ACTION_URI_LIMIT) !== desktopUri;
199
+ if (uriTooLong || desktopUriTooLong) return unavailableAction("Link", "URL exceeds LINE's limit.");
200
+ return {
201
+ ...action,
202
+ label
203
+ };
204
+ }
205
+ if (action.type === "postback") {
206
+ const data = action.data === void 0 ? void 0 : truncateLineActionData(action.data);
207
+ if (data !== action.data) return unavailableAction("Action", "callback data exceeds LINE's limit.");
208
+ const text = action.text === void 0 ? void 0 : truncateLineActionText(action.text, LINE_ACTION_DATA_LIMIT);
209
+ const fillInText = action.fillInText === void 0 ? void 0 : truncateLineActionText(action.fillInText, LINE_ACTION_DATA_LIMIT);
210
+ if (text !== action.text || fillInText !== action.fillInText) return unavailableAction("Action", "message text exceeds LINE's limit.");
211
+ return {
212
+ ...action,
213
+ label,
214
+ data,
215
+ displayText: action.displayText === void 0 ? void 0 : truncateLineActionText(action.displayText, LINE_ACTION_DATA_LIMIT),
216
+ text,
217
+ fillInText
218
+ };
219
+ }
220
+ if (action.type === "datetimepicker") {
221
+ const data = action.data === void 0 ? void 0 : truncateLineActionData(action.data);
222
+ if (data !== action.data) return unavailableAction("Action", "callback data exceeds LINE's limit.");
223
+ return {
224
+ ...action,
225
+ label,
226
+ data
227
+ };
228
+ }
229
+ if (action.type === "message") {
230
+ const text = action.text === void 0 ? void 0 : truncateLineActionText(action.text, LINE_ACTION_DATA_LIMIT);
231
+ if (text !== action.text) return unavailableAction("Action", "message text exceeds LINE's limit.");
232
+ return {
233
+ ...action,
234
+ label,
235
+ text
236
+ };
237
+ }
238
+ if (action.type === "clipboard") {
239
+ if (truncateUtf16Safe(action.clipboardText, LINE_CLIPBOARD_TEXT_LIMIT) !== action.clipboardText) return unavailableAction("Action", "clipboard text exceeds LINE's limit.");
240
+ return {
241
+ ...action,
242
+ label
243
+ };
244
+ }
245
+ if (action.type === "richmenuswitch") {
246
+ const data = action.data === void 0 ? void 0 : truncateLineActionData(action.data);
247
+ const aliasTooLong = action.richMenuAliasId !== void 0 && truncateUtf16Safe(action.richMenuAliasId, LINE_RICH_MENU_ALIAS_LIMIT) !== action.richMenuAliasId;
248
+ if (data !== action.data || aliasTooLong) return unavailableAction("Action", "rich menu data exceeds LINE's limit.");
249
+ return {
250
+ ...action,
251
+ label,
252
+ data
253
+ };
254
+ }
255
+ return action.label === label ? action : {
256
+ ...action,
257
+ label
258
+ };
259
+ }
260
+ /**
261
+ * Create a message action (sends text when tapped)
262
+ */
263
+ function messageAction(label, text) {
264
+ return normalizeLineAction({
265
+ type: "message",
266
+ label,
267
+ text: text ?? label
268
+ });
269
+ }
270
+ /**
271
+ * Create a URI action (opens a URL when tapped)
272
+ */
273
+ function uriAction(label, uri) {
274
+ return normalizeLineAction({
275
+ type: "uri",
276
+ label,
277
+ uri
278
+ });
279
+ }
280
+ /**
281
+ * Create a postback action (sends data to webhook when tapped)
282
+ */
283
+ function postbackAction(label, data, displayText) {
284
+ return normalizeLineAction({
285
+ type: "postback",
286
+ label,
287
+ data,
288
+ displayText
289
+ });
290
+ }
291
+ /**
292
+ * Create a datetime picker action
293
+ */
294
+ function datetimePickerAction(label, data, mode, options) {
295
+ return normalizeLineAction({
296
+ type: "datetimepicker",
297
+ label,
298
+ data,
299
+ mode,
300
+ initial: options?.initial,
301
+ max: options?.max,
302
+ min: options?.min
303
+ });
304
+ }
305
+ //#endregion
306
+ //#region extensions/line/src/flex-templates/common.ts
307
+ function attachFooterText(bubble, footer) {
308
+ bubble.footer = {
309
+ type: "box",
310
+ layout: "vertical",
311
+ contents: [{
312
+ type: "text",
313
+ text: footer,
314
+ size: "xs",
315
+ color: "#AAAAAA",
316
+ wrap: true,
317
+ align: "center"
318
+ }],
319
+ paddingAll: "lg",
320
+ backgroundColor: "#FAFAFA"
321
+ };
322
+ }
323
+ //#endregion
324
+ //#region extensions/line/src/flex-templates/basic-cards.ts
325
+ /**
326
+ * Create an info card with title, body, and optional footer
327
+ *
328
+ * Editorial design: Clean hierarchy with accent bar, generous spacing,
329
+ * and subtle background zones for visual separation.
330
+ */
331
+ function createInfoCard(title, body, footer) {
332
+ const bubble = {
333
+ type: "bubble",
334
+ size: "mega",
335
+ body: {
336
+ type: "box",
337
+ layout: "vertical",
338
+ contents: [{
339
+ type: "box",
340
+ layout: "horizontal",
341
+ contents: [{
342
+ type: "box",
343
+ layout: "vertical",
344
+ contents: [],
345
+ width: "4px",
346
+ backgroundColor: "#06C755",
347
+ cornerRadius: "2px"
348
+ }, {
349
+ type: "text",
350
+ text: title,
351
+ weight: "bold",
352
+ size: "xl",
353
+ color: "#111111",
354
+ wrap: true,
355
+ flex: 1,
356
+ margin: "lg"
357
+ }]
358
+ }, {
359
+ type: "box",
360
+ layout: "vertical",
361
+ contents: [{
362
+ type: "text",
363
+ text: body,
364
+ size: "md",
365
+ color: "#444444",
366
+ wrap: true,
367
+ lineSpacing: "6px"
368
+ }],
369
+ margin: "xl",
370
+ paddingAll: "lg",
371
+ backgroundColor: "#F8F9FA",
372
+ cornerRadius: "lg"
373
+ }],
374
+ paddingAll: "xl",
375
+ backgroundColor: "#FFFFFF"
376
+ }
377
+ };
378
+ if (footer) attachFooterText(bubble, footer);
379
+ return bubble;
380
+ }
381
+ /**
382
+ * Create a list card with title and multiple items
383
+ *
384
+ * Editorial design: Numbered/bulleted list with clear visual hierarchy,
385
+ * accent dots for each item, and generous spacing.
386
+ */
387
+ function createListCard(title, items) {
388
+ const itemContents = items.slice(0, 8).map((item, index) => {
389
+ const itemContentsLocal = [{
390
+ type: "text",
391
+ text: item.title,
392
+ size: "md",
393
+ weight: "bold",
394
+ color: "#1a1a1a",
395
+ wrap: true
396
+ }];
397
+ if (item.subtitle) itemContentsLocal.push({
398
+ type: "text",
399
+ text: item.subtitle,
400
+ size: "sm",
401
+ color: "#888888",
402
+ wrap: true,
403
+ margin: "xs"
404
+ });
405
+ const itemBox = {
406
+ type: "box",
407
+ layout: "horizontal",
408
+ contents: [{
409
+ type: "box",
410
+ layout: "vertical",
411
+ contents: [{
412
+ type: "box",
413
+ layout: "vertical",
414
+ contents: [],
415
+ width: "8px",
416
+ height: "8px",
417
+ backgroundColor: index === 0 ? "#06C755" : "#DDDDDD",
418
+ cornerRadius: "4px"
419
+ }],
420
+ width: "20px",
421
+ alignItems: "center",
422
+ paddingTop: "sm"
423
+ }, {
424
+ type: "box",
425
+ layout: "vertical",
426
+ contents: itemContentsLocal,
427
+ flex: 1
428
+ }],
429
+ margin: index > 0 ? "lg" : void 0
430
+ };
431
+ if (item.action) itemBox.action = normalizeLineAction(item.action, 40);
432
+ return itemBox;
433
+ });
434
+ return {
435
+ type: "bubble",
436
+ size: "mega",
437
+ body: {
438
+ type: "box",
439
+ layout: "vertical",
440
+ contents: [
441
+ {
442
+ type: "text",
443
+ text: title,
444
+ weight: "bold",
445
+ size: "xl",
446
+ color: "#111111",
447
+ wrap: true
448
+ },
449
+ {
450
+ type: "separator",
451
+ margin: "lg",
452
+ color: "#EEEEEE"
453
+ },
454
+ {
455
+ type: "box",
456
+ layout: "vertical",
457
+ contents: itemContents,
458
+ margin: "lg"
459
+ }
460
+ ],
461
+ paddingAll: "xl",
462
+ backgroundColor: "#FFFFFF"
463
+ }
464
+ };
465
+ }
466
+ /**
467
+ * Create an image card with image, title, and optional body text
468
+ */
469
+ function createImageCard(imageUrl, title, body, options) {
470
+ const bubble = {
471
+ type: "bubble",
472
+ hero: {
473
+ type: "image",
474
+ url: imageUrl,
475
+ size: "full",
476
+ aspectRatio: options?.aspectRatio ?? "20:13",
477
+ aspectMode: options?.aspectMode ?? "cover",
478
+ action: options?.action === void 0 ? void 0 : normalizeLineAction(options.action, 40)
479
+ },
480
+ body: {
481
+ type: "box",
482
+ layout: "vertical",
483
+ contents: [{
484
+ type: "text",
485
+ text: title,
486
+ weight: "bold",
487
+ size: "xl",
488
+ wrap: true
489
+ }],
490
+ paddingAll: "lg"
491
+ }
492
+ };
493
+ if (body && bubble.body) bubble.body.contents.push({
494
+ type: "text",
495
+ text: body,
496
+ size: "md",
497
+ wrap: true,
498
+ margin: "md",
499
+ color: "#666666"
500
+ });
501
+ return bubble;
502
+ }
503
+ /**
504
+ * Create an action card with title, body, and action buttons
505
+ */
506
+ function createActionCard(title, body, actions, options) {
507
+ const bubble = {
508
+ type: "bubble",
509
+ body: {
510
+ type: "box",
511
+ layout: "vertical",
512
+ contents: [{
513
+ type: "text",
514
+ text: title,
515
+ weight: "bold",
516
+ size: "xl",
517
+ wrap: true
518
+ }, {
519
+ type: "text",
520
+ text: body,
521
+ size: "md",
522
+ wrap: true,
523
+ margin: "md",
524
+ color: "#666666"
525
+ }],
526
+ paddingAll: "lg"
527
+ },
528
+ footer: {
529
+ type: "box",
530
+ layout: "vertical",
531
+ contents: actions.slice(0, 4).map((action, index) => ({
532
+ type: "button",
533
+ action: normalizeLineAction(action.action, 40),
534
+ style: index === 0 ? "primary" : "secondary",
535
+ margin: index > 0 ? "sm" : void 0
536
+ })),
537
+ paddingAll: "md"
538
+ }
539
+ };
540
+ if (options?.imageUrl) bubble.hero = {
541
+ type: "image",
542
+ url: options.imageUrl,
543
+ size: "full",
544
+ aspectRatio: options.aspectRatio ?? "20:13",
545
+ aspectMode: "cover"
546
+ };
547
+ return bubble;
548
+ }
549
+ /**
550
+ * Create a carousel container from multiple bubbles
551
+ * LINE allows max 12 bubbles in a carousel
552
+ */
553
+ function createCarousel(bubbles) {
554
+ return {
555
+ type: "carousel",
556
+ contents: bubbles.slice(0, 12)
557
+ };
558
+ }
559
+ /**
560
+ * Create a notification bubble (for alerts, status updates)
561
+ *
562
+ * Editorial design: Bold status indicator with accent color,
563
+ * clear typography, optional icon for context.
564
+ */
565
+ function createNotificationBubble(text, options) {
566
+ const typeColors = {
567
+ info: {
568
+ accent: "#3B82F6",
569
+ bg: "#EFF6FF"
570
+ },
571
+ success: {
572
+ accent: "#06C755",
573
+ bg: "#F0FDF4"
574
+ },
575
+ warning: {
576
+ accent: "#F59E0B",
577
+ bg: "#FFFBEB"
578
+ },
579
+ error: {
580
+ accent: "#EF4444",
581
+ bg: "#FEF2F2"
582
+ }
583
+ }[options?.type ?? "info"];
584
+ const contents = [];
585
+ contents.push({
586
+ type: "box",
587
+ layout: "vertical",
588
+ contents: [],
589
+ width: "4px",
590
+ backgroundColor: typeColors.accent,
591
+ cornerRadius: "2px"
592
+ });
593
+ const textContents = [];
594
+ if (options?.title) textContents.push({
595
+ type: "text",
596
+ text: options.title,
597
+ size: "md",
598
+ weight: "bold",
599
+ color: "#111111",
600
+ wrap: true
601
+ });
602
+ textContents.push({
603
+ type: "text",
604
+ text,
605
+ size: options?.title ? "sm" : "md",
606
+ color: options?.title ? "#666666" : "#333333",
607
+ wrap: true,
608
+ margin: options?.title ? "sm" : void 0
609
+ });
610
+ contents.push({
611
+ type: "box",
612
+ layout: "vertical",
613
+ contents: textContents,
614
+ flex: 1,
615
+ paddingStart: "lg"
616
+ });
617
+ return {
618
+ type: "bubble",
619
+ body: {
620
+ type: "box",
621
+ layout: "horizontal",
622
+ contents,
623
+ paddingAll: "xl",
624
+ backgroundColor: typeColors.bg
625
+ }
626
+ };
627
+ }
628
+ //#endregion
629
+ //#region extensions/line/src/flex-templates/schedule-cards.ts
630
+ function buildTitleSubtitleHeader(params) {
631
+ const { title, subtitle } = params;
632
+ const headerContents = [{
633
+ type: "text",
634
+ text: title,
635
+ weight: "bold",
636
+ size: "xl",
637
+ color: "#111111",
638
+ wrap: true
639
+ }];
640
+ if (subtitle) headerContents.push({
641
+ type: "text",
642
+ text: subtitle,
643
+ size: "sm",
644
+ color: "#888888",
645
+ margin: "sm",
646
+ wrap: true
647
+ });
648
+ return headerContents;
649
+ }
650
+ function buildCardHeaderSections(headerContents) {
651
+ return [{
652
+ type: "box",
653
+ layout: "vertical",
654
+ contents: headerContents,
655
+ paddingBottom: "lg"
656
+ }, {
657
+ type: "separator",
658
+ color: "#EEEEEE"
659
+ }];
660
+ }
661
+ function createMegaBubbleWithFooter(params) {
662
+ const bubble = {
663
+ type: "bubble",
664
+ size: "mega",
665
+ body: {
666
+ type: "box",
667
+ layout: "vertical",
668
+ contents: params.bodyContents,
669
+ paddingAll: "xl",
670
+ backgroundColor: "#FFFFFF"
671
+ }
672
+ };
673
+ if (params.footer) attachFooterText(bubble, params.footer);
674
+ return bubble;
675
+ }
676
+ /**
677
+ * Create a receipt/summary card (for orders, transactions, data tables)
678
+ *
679
+ * Editorial design: Clean table layout with alternating row backgrounds,
680
+ * prominent total section, and clear visual hierarchy.
681
+ */
682
+ function createReceiptCard(params) {
683
+ const { title, subtitle, items, total, footer } = params;
684
+ const itemRows = items.slice(0, 12).map((item, index) => ({
685
+ type: "box",
686
+ layout: "horizontal",
687
+ contents: [{
688
+ type: "text",
689
+ text: item.name,
690
+ size: "sm",
691
+ color: item.highlight ? "#111111" : "#666666",
692
+ weight: item.highlight ? "bold" : "regular",
693
+ flex: 3,
694
+ wrap: true
695
+ }, {
696
+ type: "text",
697
+ text: item.value,
698
+ size: "sm",
699
+ color: item.highlight ? "#06C755" : "#333333",
700
+ weight: item.highlight ? "bold" : "regular",
701
+ flex: 2,
702
+ align: "end",
703
+ wrap: true
704
+ }],
705
+ paddingAll: "md",
706
+ backgroundColor: index % 2 === 0 ? "#FFFFFF" : "#FAFAFA"
707
+ }));
708
+ const bodyContents = [...buildCardHeaderSections(buildTitleSubtitleHeader({
709
+ title,
710
+ subtitle
711
+ })), {
712
+ type: "box",
713
+ layout: "vertical",
714
+ contents: itemRows,
715
+ margin: "md",
716
+ cornerRadius: "md",
717
+ borderWidth: "light",
718
+ borderColor: "#EEEEEE"
719
+ }];
720
+ if (total) bodyContents.push({
721
+ type: "box",
722
+ layout: "horizontal",
723
+ contents: [{
724
+ type: "text",
725
+ text: total.label,
726
+ size: "lg",
727
+ weight: "bold",
728
+ color: "#111111",
729
+ flex: 2
730
+ }, {
731
+ type: "text",
732
+ text: total.value,
733
+ size: "xl",
734
+ weight: "bold",
735
+ color: "#06C755",
736
+ flex: 2,
737
+ align: "end"
738
+ }],
739
+ margin: "xl",
740
+ paddingAll: "lg",
741
+ backgroundColor: "#F0FDF4",
742
+ cornerRadius: "lg"
743
+ });
744
+ return createMegaBubbleWithFooter({
745
+ bodyContents,
746
+ footer
747
+ });
748
+ }
749
+ /**
750
+ * Create a calendar event card (for meetings, appointments, reminders)
751
+ *
752
+ * Editorial design: Date as hero, strong typographic hierarchy,
753
+ * color-blocked zones, full text wrapping for readability.
754
+ */
755
+ function createEventCard(params) {
756
+ const { title, date, time, location, description, calendar, isAllDay, action } = params;
757
+ const dateBlock = {
758
+ type: "box",
759
+ layout: "vertical",
760
+ contents: [{
761
+ type: "text",
762
+ text: date.toUpperCase(),
763
+ size: "sm",
764
+ weight: "bold",
765
+ color: "#06C755",
766
+ wrap: true
767
+ }, {
768
+ type: "text",
769
+ text: isAllDay ? "ALL DAY" : time ?? "",
770
+ size: "xxl",
771
+ weight: "bold",
772
+ color: "#111111",
773
+ wrap: true,
774
+ margin: "xs"
775
+ }],
776
+ paddingBottom: "lg",
777
+ borderWidth: "none"
778
+ };
779
+ if (!time && !isAllDay) dateBlock.contents = [{
780
+ type: "text",
781
+ text: date,
782
+ size: "xl",
783
+ weight: "bold",
784
+ color: "#111111",
785
+ wrap: true
786
+ }];
787
+ const bodyContents = [dateBlock, {
788
+ type: "box",
789
+ layout: "horizontal",
790
+ contents: [{
791
+ type: "box",
792
+ layout: "vertical",
793
+ contents: [],
794
+ width: "4px",
795
+ backgroundColor: "#06C755",
796
+ cornerRadius: "2px"
797
+ }, {
798
+ type: "box",
799
+ layout: "vertical",
800
+ contents: [{
801
+ type: "text",
802
+ text: title,
803
+ size: "lg",
804
+ weight: "bold",
805
+ color: "#1a1a1a",
806
+ wrap: true
807
+ }, ...calendar ? [{
808
+ type: "text",
809
+ text: calendar,
810
+ size: "xs",
811
+ color: "#888888",
812
+ margin: "sm",
813
+ wrap: true
814
+ }] : []],
815
+ flex: 1,
816
+ paddingStart: "lg"
817
+ }],
818
+ paddingTop: "lg",
819
+ paddingBottom: "lg",
820
+ borderWidth: "light",
821
+ borderColor: "#EEEEEE"
822
+ }];
823
+ if (location || description) {
824
+ const detailItems = [];
825
+ if (location) detailItems.push({
826
+ type: "box",
827
+ layout: "horizontal",
828
+ contents: [{
829
+ type: "text",
830
+ text: "📍",
831
+ size: "sm",
832
+ flex: 0
833
+ }, {
834
+ type: "text",
835
+ text: location,
836
+ size: "sm",
837
+ color: "#444444",
838
+ margin: "md",
839
+ flex: 1,
840
+ wrap: true
841
+ }],
842
+ alignItems: "flex-start"
843
+ });
844
+ if (description) detailItems.push({
845
+ type: "text",
846
+ text: description,
847
+ size: "sm",
848
+ color: "#666666",
849
+ wrap: true,
850
+ margin: location ? "lg" : "none"
851
+ });
852
+ bodyContents.push({
853
+ type: "box",
854
+ layout: "vertical",
855
+ contents: detailItems,
856
+ margin: "lg",
857
+ paddingAll: "lg",
858
+ backgroundColor: "#F8F9FA",
859
+ cornerRadius: "lg"
860
+ });
861
+ }
862
+ return {
863
+ type: "bubble",
864
+ size: "mega",
865
+ body: {
866
+ type: "box",
867
+ layout: "vertical",
868
+ contents: bodyContents,
869
+ paddingAll: "xl",
870
+ backgroundColor: "#FFFFFF",
871
+ action: action === void 0 ? void 0 : normalizeLineAction(action, 40)
872
+ }
873
+ };
874
+ }
875
+ /**
876
+ * Create a calendar agenda card showing multiple events
877
+ *
878
+ * Editorial timeline design: Time-focused left column with event details
879
+ * on the right. Visual accent bars indicate event priority/recency.
880
+ */
881
+ function createAgendaCard(params) {
882
+ const { title, subtitle, events, footer } = params;
883
+ const headerContents = buildTitleSubtitleHeader({
884
+ title,
885
+ subtitle
886
+ });
887
+ const eventItems = events.slice(0, 6).map((event, index) => {
888
+ const isActive = event.isNow || index === 0;
889
+ const accentColor = isActive ? "#06C755" : "#E5E5E5";
890
+ const timeColumn = {
891
+ type: "box",
892
+ layout: "vertical",
893
+ contents: [{
894
+ type: "text",
895
+ text: event.time ?? "—",
896
+ size: "sm",
897
+ weight: isActive ? "bold" : "regular",
898
+ color: isActive ? "#06C755" : "#666666",
899
+ align: "end",
900
+ wrap: true
901
+ }],
902
+ width: "65px",
903
+ justifyContent: "flex-start"
904
+ };
905
+ const dotColumn = {
906
+ type: "box",
907
+ layout: "vertical",
908
+ contents: [{
909
+ type: "box",
910
+ layout: "vertical",
911
+ contents: [],
912
+ width: "10px",
913
+ height: "10px",
914
+ backgroundColor: accentColor,
915
+ cornerRadius: "5px"
916
+ }],
917
+ width: "24px",
918
+ alignItems: "center",
919
+ justifyContent: "flex-start",
920
+ paddingTop: "xs"
921
+ };
922
+ const detailContents = [{
923
+ type: "text",
924
+ text: event.title,
925
+ size: "md",
926
+ weight: "bold",
927
+ color: "#1a1a1a",
928
+ wrap: true
929
+ }];
930
+ const secondaryParts = [];
931
+ if (event.location) secondaryParts.push(event.location);
932
+ if (event.calendar) secondaryParts.push(event.calendar);
933
+ if (secondaryParts.length > 0) detailContents.push({
934
+ type: "text",
935
+ text: secondaryParts.join(" · "),
936
+ size: "xs",
937
+ color: "#888888",
938
+ wrap: true,
939
+ margin: "xs"
940
+ });
941
+ return {
942
+ type: "box",
943
+ layout: "horizontal",
944
+ contents: [
945
+ timeColumn,
946
+ dotColumn,
947
+ {
948
+ type: "box",
949
+ layout: "vertical",
950
+ contents: detailContents,
951
+ flex: 1
952
+ }
953
+ ],
954
+ margin: index > 0 ? "xl" : void 0,
955
+ alignItems: "flex-start"
956
+ };
957
+ });
958
+ return createMegaBubbleWithFooter({
959
+ bodyContents: [...buildCardHeaderSections(headerContents), {
960
+ type: "box",
961
+ layout: "vertical",
962
+ contents: eventItems,
963
+ paddingTop: "xl"
964
+ }],
965
+ footer
966
+ });
967
+ }
968
+ //#endregion
969
+ //#region extensions/line/src/flex-templates/media-control-cards.ts
970
+ /**
971
+ * Create a media player card for Sonos, Spotify, Apple Music, etc.
972
+ *
973
+ * Editorial design: Album art hero with gradient overlay for text,
974
+ * prominent now-playing indicator, refined playback controls.
975
+ */
976
+ function createMediaPlayerCard(params) {
977
+ const { title, subtitle, source, imageUrl, isPlaying, progress, controls, extraActions } = params;
978
+ const trackInfo = [{
979
+ type: "text",
980
+ text: title,
981
+ weight: "bold",
982
+ size: "xl",
983
+ color: "#111111",
984
+ wrap: true
985
+ }];
986
+ if (subtitle) trackInfo.push({
987
+ type: "text",
988
+ text: subtitle,
989
+ size: "md",
990
+ color: "#666666",
991
+ wrap: true,
992
+ margin: "sm"
993
+ });
994
+ const statusItems = [];
995
+ if (isPlaying !== void 0) statusItems.push({
996
+ type: "box",
997
+ layout: "horizontal",
998
+ contents: [{
999
+ type: "box",
1000
+ layout: "vertical",
1001
+ contents: [],
1002
+ width: "8px",
1003
+ height: "8px",
1004
+ backgroundColor: isPlaying ? "#06C755" : "#CCCCCC",
1005
+ cornerRadius: "4px"
1006
+ }, {
1007
+ type: "text",
1008
+ text: isPlaying ? "Now Playing" : "Paused",
1009
+ size: "xs",
1010
+ color: isPlaying ? "#06C755" : "#888888",
1011
+ weight: "bold",
1012
+ margin: "sm"
1013
+ }],
1014
+ alignItems: "center"
1015
+ });
1016
+ if (source) statusItems.push({
1017
+ type: "text",
1018
+ text: source,
1019
+ size: "xs",
1020
+ color: "#AAAAAA",
1021
+ margin: statusItems.length > 0 ? "lg" : void 0
1022
+ });
1023
+ if (progress) statusItems.push({
1024
+ type: "text",
1025
+ text: progress,
1026
+ size: "xs",
1027
+ color: "#888888",
1028
+ align: "end",
1029
+ flex: 1
1030
+ });
1031
+ const bodyContents = [{
1032
+ type: "box",
1033
+ layout: "vertical",
1034
+ contents: trackInfo
1035
+ }];
1036
+ if (statusItems.length > 0) bodyContents.push({
1037
+ type: "box",
1038
+ layout: "horizontal",
1039
+ contents: statusItems,
1040
+ margin: "lg",
1041
+ alignItems: "center"
1042
+ });
1043
+ const bubble = {
1044
+ type: "bubble",
1045
+ size: "mega",
1046
+ body: {
1047
+ type: "box",
1048
+ layout: "vertical",
1049
+ contents: bodyContents,
1050
+ paddingAll: "xl",
1051
+ backgroundColor: "#FFFFFF"
1052
+ }
1053
+ };
1054
+ if (imageUrl) bubble.hero = {
1055
+ type: "image",
1056
+ url: imageUrl,
1057
+ size: "full",
1058
+ aspectRatio: "1:1",
1059
+ aspectMode: "cover"
1060
+ };
1061
+ if (controls || extraActions?.length) {
1062
+ const footerContents = [];
1063
+ if (controls) {
1064
+ const controlButtons = [];
1065
+ if (controls.previous) controlButtons.push({
1066
+ type: "button",
1067
+ action: postbackAction("⏮", controls.previous.data),
1068
+ style: "secondary",
1069
+ flex: 1,
1070
+ height: "sm"
1071
+ });
1072
+ if (controls.play) controlButtons.push({
1073
+ type: "button",
1074
+ action: postbackAction("▶", controls.play.data),
1075
+ style: isPlaying ? "secondary" : "primary",
1076
+ flex: 1,
1077
+ height: "sm",
1078
+ margin: controls.previous ? "md" : void 0
1079
+ });
1080
+ if (controls.pause) controlButtons.push({
1081
+ type: "button",
1082
+ action: postbackAction("⏸", controls.pause.data),
1083
+ style: isPlaying ? "primary" : "secondary",
1084
+ flex: 1,
1085
+ height: "sm",
1086
+ margin: controlButtons.length > 0 ? "md" : void 0
1087
+ });
1088
+ if (controls.next) controlButtons.push({
1089
+ type: "button",
1090
+ action: postbackAction("⏭", controls.next.data),
1091
+ style: "secondary",
1092
+ flex: 1,
1093
+ height: "sm",
1094
+ margin: controlButtons.length > 0 ? "md" : void 0
1095
+ });
1096
+ if (controlButtons.length > 0) footerContents.push({
1097
+ type: "box",
1098
+ layout: "horizontal",
1099
+ contents: controlButtons
1100
+ });
1101
+ }
1102
+ if (extraActions?.length) footerContents.push({
1103
+ type: "box",
1104
+ layout: "horizontal",
1105
+ contents: extraActions.slice(0, 2).map((action, index) => ({
1106
+ type: "button",
1107
+ action: postbackAction(truncateLineActionLabel(action.label, 15), action.data),
1108
+ style: "secondary",
1109
+ flex: 1,
1110
+ height: "sm",
1111
+ margin: index > 0 ? "md" : void 0
1112
+ })),
1113
+ margin: "md"
1114
+ });
1115
+ if (footerContents.length > 0) bubble.footer = {
1116
+ type: "box",
1117
+ layout: "vertical",
1118
+ contents: footerContents,
1119
+ paddingAll: "lg",
1120
+ backgroundColor: "#FAFAFA"
1121
+ };
1122
+ }
1123
+ return bubble;
1124
+ }
1125
+ /**
1126
+ * Create an Apple TV remote card with a D-pad and control rows.
1127
+ */
1128
+ function createAppleTvRemoteCard(params) {
1129
+ const { deviceName, status, actionData } = params;
1130
+ const headerContents = [{
1131
+ type: "text",
1132
+ text: deviceName,
1133
+ weight: "bold",
1134
+ size: "xl",
1135
+ color: "#111111",
1136
+ wrap: true
1137
+ }];
1138
+ if (status) headerContents.push({
1139
+ type: "text",
1140
+ text: status,
1141
+ size: "sm",
1142
+ color: "#666666",
1143
+ wrap: true,
1144
+ margin: "sm"
1145
+ });
1146
+ const makeButton = (label, data, style = "secondary") => ({
1147
+ type: "button",
1148
+ action: postbackAction(label, data),
1149
+ style,
1150
+ height: "sm",
1151
+ flex: 1
1152
+ });
1153
+ const dpadRows = [
1154
+ {
1155
+ type: "box",
1156
+ layout: "horizontal",
1157
+ contents: [
1158
+ { type: "filler" },
1159
+ makeButton("↑", actionData.up),
1160
+ { type: "filler" }
1161
+ ]
1162
+ },
1163
+ {
1164
+ type: "box",
1165
+ layout: "horizontal",
1166
+ contents: [
1167
+ makeButton("←", actionData.left),
1168
+ makeButton("OK", actionData.select, "primary"),
1169
+ makeButton("→", actionData.right)
1170
+ ],
1171
+ margin: "md"
1172
+ },
1173
+ {
1174
+ type: "box",
1175
+ layout: "horizontal",
1176
+ contents: [
1177
+ { type: "filler" },
1178
+ makeButton("↓", actionData.down),
1179
+ { type: "filler" }
1180
+ ],
1181
+ margin: "md"
1182
+ }
1183
+ ];
1184
+ const menuRow = {
1185
+ type: "box",
1186
+ layout: "horizontal",
1187
+ contents: [makeButton("Menu", actionData.menu), makeButton("Home", actionData.home)],
1188
+ margin: "lg"
1189
+ };
1190
+ const playbackRow = {
1191
+ type: "box",
1192
+ layout: "horizontal",
1193
+ contents: [makeButton("Play", actionData.play), makeButton("Pause", actionData.pause)],
1194
+ margin: "md"
1195
+ };
1196
+ const volumeRow = {
1197
+ type: "box",
1198
+ layout: "horizontal",
1199
+ contents: [
1200
+ makeButton("Vol +", actionData.volumeUp),
1201
+ makeButton("Mute", actionData.mute),
1202
+ makeButton("Vol -", actionData.volumeDown)
1203
+ ],
1204
+ margin: "md"
1205
+ };
1206
+ return {
1207
+ type: "bubble",
1208
+ size: "mega",
1209
+ body: {
1210
+ type: "box",
1211
+ layout: "vertical",
1212
+ contents: [
1213
+ {
1214
+ type: "box",
1215
+ layout: "vertical",
1216
+ contents: headerContents
1217
+ },
1218
+ {
1219
+ type: "separator",
1220
+ margin: "lg",
1221
+ color: "#EEEEEE"
1222
+ },
1223
+ ...dpadRows,
1224
+ menuRow,
1225
+ playbackRow,
1226
+ volumeRow
1227
+ ],
1228
+ paddingAll: "xl",
1229
+ backgroundColor: "#FFFFFF"
1230
+ }
1231
+ };
1232
+ }
1233
+ /**
1234
+ * Create a device control card for Apple TV, smart home devices, etc.
1235
+ *
1236
+ * Editorial design: Device-focused header with status indicator,
1237
+ * clean control grid with clear visual hierarchy.
1238
+ */
1239
+ function createDeviceControlCard(params) {
1240
+ const { deviceName, deviceType, status, isOnline, imageUrl, controls } = params;
1241
+ const headerContents = [{
1242
+ type: "box",
1243
+ layout: "horizontal",
1244
+ contents: [{
1245
+ type: "box",
1246
+ layout: "vertical",
1247
+ contents: [],
1248
+ width: "10px",
1249
+ height: "10px",
1250
+ backgroundColor: isOnline !== false ? "#06C755" : "#FF5555",
1251
+ cornerRadius: "5px"
1252
+ }, {
1253
+ type: "text",
1254
+ text: deviceName,
1255
+ weight: "bold",
1256
+ size: "xl",
1257
+ color: "#111111",
1258
+ wrap: true,
1259
+ flex: 1,
1260
+ margin: "md"
1261
+ }],
1262
+ alignItems: "center"
1263
+ }];
1264
+ if (deviceType) headerContents.push({
1265
+ type: "text",
1266
+ text: deviceType,
1267
+ size: "sm",
1268
+ color: "#888888",
1269
+ margin: "sm"
1270
+ });
1271
+ if (status) headerContents.push({
1272
+ type: "box",
1273
+ layout: "vertical",
1274
+ contents: [{
1275
+ type: "text",
1276
+ text: status,
1277
+ size: "sm",
1278
+ color: "#444444",
1279
+ wrap: true
1280
+ }],
1281
+ margin: "lg",
1282
+ paddingAll: "md",
1283
+ backgroundColor: "#F8F9FA",
1284
+ cornerRadius: "md"
1285
+ });
1286
+ const bubble = {
1287
+ type: "bubble",
1288
+ size: "mega",
1289
+ body: {
1290
+ type: "box",
1291
+ layout: "vertical",
1292
+ contents: headerContents,
1293
+ paddingAll: "xl",
1294
+ backgroundColor: "#FFFFFF"
1295
+ }
1296
+ };
1297
+ if (imageUrl) bubble.hero = {
1298
+ type: "image",
1299
+ url: imageUrl,
1300
+ size: "full",
1301
+ aspectRatio: "16:9",
1302
+ aspectMode: "cover"
1303
+ };
1304
+ if (controls.length > 0) {
1305
+ const rows = [];
1306
+ const limitedControls = controls.slice(0, 6);
1307
+ for (let i = 0; i < limitedControls.length; i += 2) {
1308
+ const rowButtons = [];
1309
+ for (const [offset, ctrl] of limitedControls.slice(i, i + 2).entries()) {
1310
+ const buttonLabel = ctrl.icon ? `${ctrl.icon} ${ctrl.label}` : ctrl.label;
1311
+ rowButtons.push({
1312
+ type: "button",
1313
+ action: postbackAction(truncateLineActionLabel(buttonLabel, 18), ctrl.data),
1314
+ style: ctrl.style ?? "secondary",
1315
+ flex: 1,
1316
+ height: "sm",
1317
+ margin: offset > 0 ? "md" : void 0
1318
+ });
1319
+ }
1320
+ if (rowButtons.length === 1) rowButtons.push({ type: "filler" });
1321
+ rows.push({
1322
+ type: "box",
1323
+ layout: "horizontal",
1324
+ contents: rowButtons,
1325
+ margin: i > 0 ? "md" : void 0
1326
+ });
1327
+ }
1328
+ bubble.footer = {
1329
+ type: "box",
1330
+ layout: "vertical",
1331
+ contents: rows,
1332
+ paddingAll: "lg",
1333
+ backgroundColor: "#FAFAFA"
1334
+ };
1335
+ }
1336
+ return bubble;
1337
+ }
1338
+ //#endregion
1339
+ export { postbackAction as _, createEventCard as a, createCarousel as c, createListCard as d, createNotificationBubble as f, normalizeLineMessageActions as g, normalizeLineAction as h, createAgendaCard as i, createImageCard as l, messageAction as m, createDeviceControlCard as n, createReceiptCard as o, datetimePickerAction as p, createMediaPlayerCard as r, createActionCard as s, createAppleTvRemoteCard as t, createInfoCard as u, uriAction as v };