@openclaw/line 2026.8.1-beta.3 → 2026.9.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +1 -1
- package/dist/{card-command-CyDSm-OU.js → card-command-CmU47gD9.js} +16 -10
- package/dist/{channel-DmoKZXmG.js → channel-CsQLcrsA.js} +32 -15
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel.runtime-B83x7k_i.js +4 -0
- package/dist/index.js +1 -1
- package/dist/{markdown-to-line-rEaras_0.js → markdown-to-line-BmZ4hhfC.js} +17 -22
- package/dist/media-control-cards-CksNB8Wk.js +474 -0
- package/dist/{monitor-BYXS_B6r.js → monitor-Bd9XDV1i.js} +20 -11
- package/dist/monitor.runtime-BCCa6qTX.js +2 -0
- package/dist/{outbound.runtime-DDTeqaBW.js → outbound.runtime-D4w0-Gkc.js} +2 -2
- package/dist/runtime-api.js +6 -7
- package/dist/{send-BJCeiiOB.js → send-Dce0m539.js} +13 -9
- package/dist/{send-receipt-DKZzgHMO.js → send-receipt-CCPTalf9.js} +1 -371
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/openclaw.plugin.json +10 -0
- package/package.json +6 -6
- package/dist/channel.runtime-qrUV6wPE.js +0 -4
- package/dist/config-schema-Be3azjB_.js +0 -47
- package/dist/monitor.runtime-B2z_5ugU.js +0 -2
- package/dist/quick-reply-fallback-D86FwAfr.js +0 -56
- package/node_modules/typebox/build/format/_idna.d.mts +0 -2
- package/node_modules/typebox/build/format/_idna.mjs +0 -246
- package/node_modules/typebox/build/format/_puny.d.mts +0 -1
- package/node_modules/typebox/build/format/_puny.mjs +0 -77
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
- package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
|
@@ -976,376 +976,6 @@ function createAgendaCard(params) {
|
|
|
976
976
|
});
|
|
977
977
|
}
|
|
978
978
|
//#endregion
|
|
979
|
-
//#region extensions/line/src/flex-templates/media-control-cards.ts
|
|
980
|
-
/**
|
|
981
|
-
* Create a media player card for Sonos, Spotify, Apple Music, etc.
|
|
982
|
-
*
|
|
983
|
-
* Editorial design: Album art hero with gradient overlay for text,
|
|
984
|
-
* prominent now-playing indicator, refined playback controls.
|
|
985
|
-
*/
|
|
986
|
-
function createMediaPlayerCard(params) {
|
|
987
|
-
const { title, subtitle, source, imageUrl, isPlaying, progress, controls, extraActions } = params;
|
|
988
|
-
const trackInfo = [{
|
|
989
|
-
type: "text",
|
|
990
|
-
text: title,
|
|
991
|
-
weight: "bold",
|
|
992
|
-
size: "xl",
|
|
993
|
-
color: "#111111",
|
|
994
|
-
wrap: true
|
|
995
|
-
}];
|
|
996
|
-
if (subtitle) trackInfo.push({
|
|
997
|
-
type: "text",
|
|
998
|
-
text: subtitle,
|
|
999
|
-
size: "md",
|
|
1000
|
-
color: "#666666",
|
|
1001
|
-
wrap: true,
|
|
1002
|
-
margin: "sm"
|
|
1003
|
-
});
|
|
1004
|
-
const statusItems = [];
|
|
1005
|
-
if (isPlaying !== void 0) statusItems.push({
|
|
1006
|
-
type: "box",
|
|
1007
|
-
layout: "horizontal",
|
|
1008
|
-
contents: [{
|
|
1009
|
-
type: "box",
|
|
1010
|
-
layout: "vertical",
|
|
1011
|
-
contents: [],
|
|
1012
|
-
width: "8px",
|
|
1013
|
-
height: "8px",
|
|
1014
|
-
backgroundColor: isPlaying ? "#06C755" : "#CCCCCC",
|
|
1015
|
-
cornerRadius: "4px"
|
|
1016
|
-
}, {
|
|
1017
|
-
type: "text",
|
|
1018
|
-
text: isPlaying ? "Now Playing" : "Paused",
|
|
1019
|
-
size: "xs",
|
|
1020
|
-
color: isPlaying ? "#06C755" : "#888888",
|
|
1021
|
-
weight: "bold",
|
|
1022
|
-
margin: "sm"
|
|
1023
|
-
}],
|
|
1024
|
-
alignItems: "center"
|
|
1025
|
-
});
|
|
1026
|
-
if (source) statusItems.push({
|
|
1027
|
-
type: "text",
|
|
1028
|
-
text: source,
|
|
1029
|
-
size: "xs",
|
|
1030
|
-
color: "#AAAAAA",
|
|
1031
|
-
margin: statusItems.length > 0 ? "lg" : void 0
|
|
1032
|
-
});
|
|
1033
|
-
if (progress) statusItems.push({
|
|
1034
|
-
type: "text",
|
|
1035
|
-
text: progress,
|
|
1036
|
-
size: "xs",
|
|
1037
|
-
color: "#888888",
|
|
1038
|
-
align: "end",
|
|
1039
|
-
flex: 1
|
|
1040
|
-
});
|
|
1041
|
-
const bodyContents = [{
|
|
1042
|
-
type: "box",
|
|
1043
|
-
layout: "vertical",
|
|
1044
|
-
contents: trackInfo
|
|
1045
|
-
}];
|
|
1046
|
-
if (statusItems.length > 0) bodyContents.push({
|
|
1047
|
-
type: "box",
|
|
1048
|
-
layout: "horizontal",
|
|
1049
|
-
contents: statusItems,
|
|
1050
|
-
margin: "lg",
|
|
1051
|
-
alignItems: "center"
|
|
1052
|
-
});
|
|
1053
|
-
const bubble = {
|
|
1054
|
-
type: "bubble",
|
|
1055
|
-
size: "mega",
|
|
1056
|
-
body: {
|
|
1057
|
-
type: "box",
|
|
1058
|
-
layout: "vertical",
|
|
1059
|
-
contents: bodyContents,
|
|
1060
|
-
paddingAll: "xl",
|
|
1061
|
-
backgroundColor: "#FFFFFF"
|
|
1062
|
-
}
|
|
1063
|
-
};
|
|
1064
|
-
if (imageUrl) bubble.hero = {
|
|
1065
|
-
type: "image",
|
|
1066
|
-
url: imageUrl,
|
|
1067
|
-
size: "full",
|
|
1068
|
-
aspectRatio: "1:1",
|
|
1069
|
-
aspectMode: "cover"
|
|
1070
|
-
};
|
|
1071
|
-
if (controls || extraActions?.length) {
|
|
1072
|
-
const footerContents = [];
|
|
1073
|
-
if (controls) {
|
|
1074
|
-
const controlButtons = [];
|
|
1075
|
-
if (controls.previous) controlButtons.push({
|
|
1076
|
-
type: "button",
|
|
1077
|
-
action: postbackAction("⏮", controls.previous.data),
|
|
1078
|
-
style: "secondary",
|
|
1079
|
-
flex: 1,
|
|
1080
|
-
height: "sm"
|
|
1081
|
-
});
|
|
1082
|
-
if (controls.play) controlButtons.push({
|
|
1083
|
-
type: "button",
|
|
1084
|
-
action: postbackAction("▶", controls.play.data),
|
|
1085
|
-
style: isPlaying ? "secondary" : "primary",
|
|
1086
|
-
flex: 1,
|
|
1087
|
-
height: "sm",
|
|
1088
|
-
margin: controls.previous ? "md" : void 0
|
|
1089
|
-
});
|
|
1090
|
-
if (controls.pause) controlButtons.push({
|
|
1091
|
-
type: "button",
|
|
1092
|
-
action: postbackAction("⏸", controls.pause.data),
|
|
1093
|
-
style: isPlaying ? "primary" : "secondary",
|
|
1094
|
-
flex: 1,
|
|
1095
|
-
height: "sm",
|
|
1096
|
-
margin: controlButtons.length > 0 ? "md" : void 0
|
|
1097
|
-
});
|
|
1098
|
-
if (controls.next) controlButtons.push({
|
|
1099
|
-
type: "button",
|
|
1100
|
-
action: postbackAction("⏭", controls.next.data),
|
|
1101
|
-
style: "secondary",
|
|
1102
|
-
flex: 1,
|
|
1103
|
-
height: "sm",
|
|
1104
|
-
margin: controlButtons.length > 0 ? "md" : void 0
|
|
1105
|
-
});
|
|
1106
|
-
if (controlButtons.length > 0) footerContents.push({
|
|
1107
|
-
type: "box",
|
|
1108
|
-
layout: "horizontal",
|
|
1109
|
-
contents: controlButtons
|
|
1110
|
-
});
|
|
1111
|
-
}
|
|
1112
|
-
if (extraActions?.length) footerContents.push({
|
|
1113
|
-
type: "box",
|
|
1114
|
-
layout: "horizontal",
|
|
1115
|
-
contents: extraActions.slice(0, 2).map((action, index) => ({
|
|
1116
|
-
type: "button",
|
|
1117
|
-
action: postbackAction(truncateLineActionLabel(action.label, 15), action.data),
|
|
1118
|
-
style: "secondary",
|
|
1119
|
-
flex: 1,
|
|
1120
|
-
height: "sm",
|
|
1121
|
-
margin: index > 0 ? "md" : void 0
|
|
1122
|
-
})),
|
|
1123
|
-
margin: "md"
|
|
1124
|
-
});
|
|
1125
|
-
if (footerContents.length > 0) bubble.footer = {
|
|
1126
|
-
type: "box",
|
|
1127
|
-
layout: "vertical",
|
|
1128
|
-
contents: footerContents,
|
|
1129
|
-
paddingAll: "lg",
|
|
1130
|
-
backgroundColor: "#FAFAFA"
|
|
1131
|
-
};
|
|
1132
|
-
}
|
|
1133
|
-
return bubble;
|
|
1134
|
-
}
|
|
1135
|
-
/**
|
|
1136
|
-
* Create an Apple TV remote card with a D-pad and control rows.
|
|
1137
|
-
*/
|
|
1138
|
-
function createAppleTvRemoteCard(params) {
|
|
1139
|
-
const { deviceName, status, actionData } = params;
|
|
1140
|
-
const headerContents = [{
|
|
1141
|
-
type: "text",
|
|
1142
|
-
text: deviceName,
|
|
1143
|
-
weight: "bold",
|
|
1144
|
-
size: "xl",
|
|
1145
|
-
color: "#111111",
|
|
1146
|
-
wrap: true
|
|
1147
|
-
}];
|
|
1148
|
-
if (status) headerContents.push({
|
|
1149
|
-
type: "text",
|
|
1150
|
-
text: status,
|
|
1151
|
-
size: "sm",
|
|
1152
|
-
color: "#666666",
|
|
1153
|
-
wrap: true,
|
|
1154
|
-
margin: "sm"
|
|
1155
|
-
});
|
|
1156
|
-
const makeButton = (label, data, style = "secondary") => ({
|
|
1157
|
-
type: "button",
|
|
1158
|
-
action: postbackAction(label, data),
|
|
1159
|
-
style,
|
|
1160
|
-
height: "sm",
|
|
1161
|
-
flex: 1
|
|
1162
|
-
});
|
|
1163
|
-
const dpadRows = [
|
|
1164
|
-
{
|
|
1165
|
-
type: "box",
|
|
1166
|
-
layout: "horizontal",
|
|
1167
|
-
contents: [
|
|
1168
|
-
{ type: "filler" },
|
|
1169
|
-
makeButton("↑", actionData.up),
|
|
1170
|
-
{ type: "filler" }
|
|
1171
|
-
]
|
|
1172
|
-
},
|
|
1173
|
-
{
|
|
1174
|
-
type: "box",
|
|
1175
|
-
layout: "horizontal",
|
|
1176
|
-
contents: [
|
|
1177
|
-
makeButton("←", actionData.left),
|
|
1178
|
-
makeButton("OK", actionData.select, "primary"),
|
|
1179
|
-
makeButton("→", actionData.right)
|
|
1180
|
-
],
|
|
1181
|
-
margin: "md"
|
|
1182
|
-
},
|
|
1183
|
-
{
|
|
1184
|
-
type: "box",
|
|
1185
|
-
layout: "horizontal",
|
|
1186
|
-
contents: [
|
|
1187
|
-
{ type: "filler" },
|
|
1188
|
-
makeButton("↓", actionData.down),
|
|
1189
|
-
{ type: "filler" }
|
|
1190
|
-
],
|
|
1191
|
-
margin: "md"
|
|
1192
|
-
}
|
|
1193
|
-
];
|
|
1194
|
-
const menuRow = {
|
|
1195
|
-
type: "box",
|
|
1196
|
-
layout: "horizontal",
|
|
1197
|
-
contents: [makeButton("Menu", actionData.menu), makeButton("Home", actionData.home)],
|
|
1198
|
-
margin: "lg"
|
|
1199
|
-
};
|
|
1200
|
-
const playbackRow = {
|
|
1201
|
-
type: "box",
|
|
1202
|
-
layout: "horizontal",
|
|
1203
|
-
contents: [makeButton("Play", actionData.play), makeButton("Pause", actionData.pause)],
|
|
1204
|
-
margin: "md"
|
|
1205
|
-
};
|
|
1206
|
-
const volumeRow = {
|
|
1207
|
-
type: "box",
|
|
1208
|
-
layout: "horizontal",
|
|
1209
|
-
contents: [
|
|
1210
|
-
makeButton("Vol +", actionData.volumeUp),
|
|
1211
|
-
makeButton("Mute", actionData.mute),
|
|
1212
|
-
makeButton("Vol -", actionData.volumeDown)
|
|
1213
|
-
],
|
|
1214
|
-
margin: "md"
|
|
1215
|
-
};
|
|
1216
|
-
return {
|
|
1217
|
-
type: "bubble",
|
|
1218
|
-
size: "mega",
|
|
1219
|
-
body: {
|
|
1220
|
-
type: "box",
|
|
1221
|
-
layout: "vertical",
|
|
1222
|
-
contents: [
|
|
1223
|
-
{
|
|
1224
|
-
type: "box",
|
|
1225
|
-
layout: "vertical",
|
|
1226
|
-
contents: headerContents
|
|
1227
|
-
},
|
|
1228
|
-
{
|
|
1229
|
-
type: "separator",
|
|
1230
|
-
margin: "lg",
|
|
1231
|
-
color: "#EEEEEE"
|
|
1232
|
-
},
|
|
1233
|
-
...dpadRows,
|
|
1234
|
-
menuRow,
|
|
1235
|
-
playbackRow,
|
|
1236
|
-
volumeRow
|
|
1237
|
-
],
|
|
1238
|
-
paddingAll: "xl",
|
|
1239
|
-
backgroundColor: "#FFFFFF"
|
|
1240
|
-
}
|
|
1241
|
-
};
|
|
1242
|
-
}
|
|
1243
|
-
/**
|
|
1244
|
-
* Create a device control card for Apple TV, smart home devices, etc.
|
|
1245
|
-
*
|
|
1246
|
-
* Editorial design: Device-focused header with status indicator,
|
|
1247
|
-
* clean control grid with clear visual hierarchy.
|
|
1248
|
-
*/
|
|
1249
|
-
function createDeviceControlCard(params) {
|
|
1250
|
-
const { deviceName, deviceType, status, isOnline, imageUrl, controls } = params;
|
|
1251
|
-
const headerContents = [{
|
|
1252
|
-
type: "box",
|
|
1253
|
-
layout: "horizontal",
|
|
1254
|
-
contents: [{
|
|
1255
|
-
type: "box",
|
|
1256
|
-
layout: "vertical",
|
|
1257
|
-
contents: [],
|
|
1258
|
-
width: "10px",
|
|
1259
|
-
height: "10px",
|
|
1260
|
-
backgroundColor: isOnline !== false ? "#06C755" : "#FF5555",
|
|
1261
|
-
cornerRadius: "5px"
|
|
1262
|
-
}, {
|
|
1263
|
-
type: "text",
|
|
1264
|
-
text: deviceName,
|
|
1265
|
-
weight: "bold",
|
|
1266
|
-
size: "xl",
|
|
1267
|
-
color: "#111111",
|
|
1268
|
-
wrap: true,
|
|
1269
|
-
flex: 1,
|
|
1270
|
-
margin: "md"
|
|
1271
|
-
}],
|
|
1272
|
-
alignItems: "center"
|
|
1273
|
-
}];
|
|
1274
|
-
if (deviceType) headerContents.push({
|
|
1275
|
-
type: "text",
|
|
1276
|
-
text: deviceType,
|
|
1277
|
-
size: "sm",
|
|
1278
|
-
color: "#888888",
|
|
1279
|
-
margin: "sm"
|
|
1280
|
-
});
|
|
1281
|
-
if (status) headerContents.push({
|
|
1282
|
-
type: "box",
|
|
1283
|
-
layout: "vertical",
|
|
1284
|
-
contents: [{
|
|
1285
|
-
type: "text",
|
|
1286
|
-
text: status,
|
|
1287
|
-
size: "sm",
|
|
1288
|
-
color: "#444444",
|
|
1289
|
-
wrap: true
|
|
1290
|
-
}],
|
|
1291
|
-
margin: "lg",
|
|
1292
|
-
paddingAll: "md",
|
|
1293
|
-
backgroundColor: "#F8F9FA",
|
|
1294
|
-
cornerRadius: "md"
|
|
1295
|
-
});
|
|
1296
|
-
const bubble = {
|
|
1297
|
-
type: "bubble",
|
|
1298
|
-
size: "mega",
|
|
1299
|
-
body: {
|
|
1300
|
-
type: "box",
|
|
1301
|
-
layout: "vertical",
|
|
1302
|
-
contents: headerContents,
|
|
1303
|
-
paddingAll: "xl",
|
|
1304
|
-
backgroundColor: "#FFFFFF"
|
|
1305
|
-
}
|
|
1306
|
-
};
|
|
1307
|
-
if (imageUrl) bubble.hero = {
|
|
1308
|
-
type: "image",
|
|
1309
|
-
url: imageUrl,
|
|
1310
|
-
size: "full",
|
|
1311
|
-
aspectRatio: "16:9",
|
|
1312
|
-
aspectMode: "cover"
|
|
1313
|
-
};
|
|
1314
|
-
if (controls.length > 0) {
|
|
1315
|
-
const rows = [];
|
|
1316
|
-
const limitedControls = controls.slice(0, 6);
|
|
1317
|
-
for (let i = 0; i < limitedControls.length; i += 2) {
|
|
1318
|
-
const rowButtons = [];
|
|
1319
|
-
for (const [offset, ctrl] of limitedControls.slice(i, i + 2).entries()) {
|
|
1320
|
-
const buttonLabel = ctrl.icon ? `${ctrl.icon} ${ctrl.label}` : ctrl.label;
|
|
1321
|
-
rowButtons.push({
|
|
1322
|
-
type: "button",
|
|
1323
|
-
action: postbackAction(truncateLineActionLabel(buttonLabel, 18), ctrl.data),
|
|
1324
|
-
style: ctrl.style ?? "secondary",
|
|
1325
|
-
flex: 1,
|
|
1326
|
-
height: "sm",
|
|
1327
|
-
margin: offset > 0 ? "md" : void 0
|
|
1328
|
-
});
|
|
1329
|
-
}
|
|
1330
|
-
if (rowButtons.length === 1) rowButtons.push({ type: "filler" });
|
|
1331
|
-
rows.push({
|
|
1332
|
-
type: "box",
|
|
1333
|
-
layout: "horizontal",
|
|
1334
|
-
contents: rowButtons,
|
|
1335
|
-
margin: i > 0 ? "md" : void 0
|
|
1336
|
-
});
|
|
1337
|
-
}
|
|
1338
|
-
bubble.footer = {
|
|
1339
|
-
type: "box",
|
|
1340
|
-
layout: "vertical",
|
|
1341
|
-
contents: rows,
|
|
1342
|
-
paddingAll: "lg",
|
|
1343
|
-
backgroundColor: "#FAFAFA"
|
|
1344
|
-
};
|
|
1345
|
-
}
|
|
1346
|
-
return bubble;
|
|
1347
|
-
}
|
|
1348
|
-
//#endregion
|
|
1349
979
|
//#region extensions/line/src/send-receipt.ts
|
|
1350
980
|
function createLineSendReceipt(params) {
|
|
1351
981
|
const messageIds = (params.messageIds ?? [params.messageId]).map((messageId) => messageId.trim()).filter(Boolean);
|
|
@@ -1363,4 +993,4 @@ function createLineSendReceipt(params) {
|
|
|
1363
993
|
});
|
|
1364
994
|
}
|
|
1365
995
|
//#endregion
|
|
1366
|
-
export {
|
|
996
|
+
export { hasLineSpecificMediaOptions as _, createActionCard as a, createListCard as c, normalizeLineAction as d, normalizeLineMessageActions as f, buildLineMediaMessage as g, uriAction as h, createReceiptCard as i, datetimePickerAction as l, truncateLineActionLabel as m, createAgendaCard as n, createImageCard as o, postbackAction as p, createEventCard as r, createInfoCard as s, createLineSendReceipt as t, messageAction as u, resolveLineOutboundMedia as v, validateLineMediaUrl as y };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Returns true if the value is a ISO8601 DateTime string
|
|
3
|
-
* @
|
|
3
|
+
* @specification https://datatracker.ietf.org/doc/html/rfc3339
|
|
4
4
|
* @example `2020-12-12T20:20:40+00:00`
|
|
5
5
|
*/
|
|
6
|
-
export declare function IsDateTime(value: string
|
|
6
|
+
export declare function IsDateTime(value: string): boolean;
|
|
@@ -2,10 +2,10 @@ import { IsDate } from './date.mjs';
|
|
|
2
2
|
import { IsTime } from './time.mjs';
|
|
3
3
|
/**
|
|
4
4
|
* Returns true if the value is a ISO8601 DateTime string
|
|
5
|
-
* @
|
|
5
|
+
* @specification https://datatracker.ietf.org/doc/html/rfc3339
|
|
6
6
|
* @example `2020-12-12T20:20:40+00:00`
|
|
7
7
|
*/
|
|
8
|
-
export function IsDateTime(value
|
|
8
|
+
export function IsDateTime(value) {
|
|
9
9
|
const dateTime = value.split(/T/i);
|
|
10
|
-
return dateTime.length === 2 && IsDate(dateTime[0]) && IsTime(dateTime[1]
|
|
10
|
+
return dateTime.length === 2 && IsDate(dateTime[0]) && IsTime(dateTime[1]);
|
|
11
11
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const Email = /^(
|
|
1
|
+
const Email = /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[^"\\]|\\.)*")@(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*|\[(?:IPv6:[a-f0-9:]+|(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?:\.(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3})\])$/i;
|
|
2
2
|
/**
|
|
3
3
|
* Returns true if the value is an Email
|
|
4
|
-
* @specification
|
|
4
|
+
* @specification https://datatracker.ietf.org/doc/html/rfc5322
|
|
5
5
|
*/
|
|
6
6
|
export function IsEmail(value) {
|
|
7
7
|
return Email.test(value);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as Idna from './
|
|
1
|
+
import * as Idna from './idna/index.mjs';
|
|
2
2
|
/**
|
|
3
3
|
* Returns true if the value is a valid hostname.
|
|
4
4
|
* @specification https://tools.ietf.org/html/rfc1123
|
|
@@ -6,13 +6,5 @@ import * as Idna from './_idna.mjs';
|
|
|
6
6
|
* @specification https://tools.ietf.org/html/rfc5892
|
|
7
7
|
*/
|
|
8
8
|
export function IsHostname(value) {
|
|
9
|
-
|
|
10
|
-
return false;
|
|
11
|
-
if (value.charCodeAt(value.length - 1) === 46)
|
|
12
|
-
return false;
|
|
13
|
-
for (const label of value.split('.')) {
|
|
14
|
-
if (!Idna.IsLabel(label))
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
return true;
|
|
9
|
+
return Idna.IsHostname(value);
|
|
18
10
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const IdnEmail = /^(
|
|
1
|
+
const IdnEmail = /^(?:[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+(?:\.[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+)*|"(?:[^"\\]|\\.)*")@[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-)(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-))*$/iu;
|
|
2
2
|
/**
|
|
3
3
|
* Returns true if the value is an IdnEmail
|
|
4
|
-
* @specification
|
|
4
|
+
* @specification https://datatracker.ietf.org/doc/html/rfc4952
|
|
5
5
|
*/
|
|
6
6
|
export function IsIdnEmail(value) {
|
|
7
|
-
return IdnEmail.test(value);
|
|
7
|
+
return IdnEmail.test(value.normalize('NFC'));
|
|
8
8
|
}
|
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
* @specification https://tools.ietf.org/html/rfc3490
|
|
4
4
|
* @specification https://tools.ietf.org/html/rfc5891
|
|
5
5
|
* @specification https://tools.ietf.org/html/rfc5892
|
|
6
|
+
* @specification https://tools.ietf.org/html/rfc5893
|
|
6
7
|
*/
|
|
7
8
|
export declare function IsIdnHostname(value: string): boolean;
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Idna from './idna/index.mjs';
|
|
2
2
|
/**
|
|
3
3
|
* Returns true if the value is a valid internationalized (IDN) hostname.
|
|
4
4
|
* @specification https://tools.ietf.org/html/rfc3490
|
|
5
5
|
* @specification https://tools.ietf.org/html/rfc5891
|
|
6
6
|
* @specification https://tools.ietf.org/html/rfc5892
|
|
7
|
+
* @specification https://tools.ietf.org/html/rfc5893
|
|
7
8
|
*/
|
|
8
9
|
export function IsIdnHostname(value) {
|
|
9
|
-
|
|
10
|
-
return false;
|
|
11
|
-
const canonical = value.normalize('NFC').replace(/[\u002E\u3002\uFF0E\uFF61]/g, '.');
|
|
12
|
-
if (canonical.length > 253)
|
|
13
|
-
return false;
|
|
14
|
-
for (const label of canonical.split('.')) {
|
|
15
|
-
if (!IsIdnLabel(label))
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
return true;
|
|
10
|
+
return Idna.IsIdnHostname(value);
|
|
19
11
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// deno-fmt-ignore-file
|
|
2
|
+
import * as FormatPuny from './puny.mjs';
|
|
3
|
+
import * as Pattern from '../pattern/pattern.mjs';
|
|
4
|
+
// ------------------------------------------------------------------
|
|
5
|
+
// LOCAL REGEX: Allowed Bidi classes per direction (RFC 5893)
|
|
6
|
+
// ------------------------------------------------------------------
|
|
7
|
+
const RE_RTL_ALLOWED = /^(?:R|AL|AN|EN|ES|CS|ET|ON|BN|NSM)$/;
|
|
8
|
+
const RE_LTR_ALLOWED = /^(?:L|EN|ES|CS|ET|ON|BN|NSM)$/;
|
|
9
|
+
const RE_RTL_CLASSES = /^(?:R|AL|AN)$/;
|
|
10
|
+
// ------------------------------------------------------------------
|
|
11
|
+
// HasBidiChars
|
|
12
|
+
//
|
|
13
|
+
// Decodes a punycode label to its Unicode form (if it is one) and
|
|
14
|
+
// checks whether the result is an RTL label per RFC 5893 §1.4.
|
|
15
|
+
// ------------------------------------------------------------------
|
|
16
|
+
export function HasBidiChars(value) {
|
|
17
|
+
if (FormatPuny.IsAcePrefixed(value)) {
|
|
18
|
+
try {
|
|
19
|
+
return HasRightToLeftCharacters(FormatPuny.Decode(value.slice(4).toLowerCase()));
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return HasRightToLeftCharacters(value);
|
|
26
|
+
}
|
|
27
|
+
// ------------------------------------------------------------------
|
|
28
|
+
// GetBidiClass
|
|
29
|
+
// ------------------------------------------------------------------
|
|
30
|
+
function GetBidiClass(codePoint) {
|
|
31
|
+
const char = String.fromCodePoint(codePoint);
|
|
32
|
+
return (Pattern.RE_EUROPEAN_NUMBER.test(char) ? 'EN' :
|
|
33
|
+
Pattern.RE_ARABIC_INDIC_DIGIT.test(char) ? 'AN' :
|
|
34
|
+
// Pattern.RE_EUROPEAN_SEPARATOR.test(char) ? 'ES' : // (no-spec-coverage)
|
|
35
|
+
// Pattern.RE_COMMON_SEPARATOR.test(char) ? 'CS' : // (no-spec-coverage)
|
|
36
|
+
Pattern.RE_MARK_NONSPACING.test(char) ? 'NSM' :
|
|
37
|
+
Pattern.RE_SCRIPT_HEBREW.test(char) ? 'R' :
|
|
38
|
+
Pattern.RE_SCRIPT_ARABIC_LETTER.test(char) ? 'AL' :
|
|
39
|
+
Pattern.RE_LETTER.test(char) ? 'L' :
|
|
40
|
+
'ON');
|
|
41
|
+
}
|
|
42
|
+
// ------------------------------------------------------------------
|
|
43
|
+
// HasRightToLeftCharacters
|
|
44
|
+
//
|
|
45
|
+
// Per RFC 5893 §1.4: "An RTL label is a label that contains at least
|
|
46
|
+
// one character of type R, AL, or AN." Used to determine whether a
|
|
47
|
+
// domain name is a "Bidi domain name" (RFC 5893 §1.4), in which case
|
|
48
|
+
// the Bidi Rule applies to every label in the domain.
|
|
49
|
+
// ------------------------------------------------------------------
|
|
50
|
+
export function HasRightToLeftCharacters(value) {
|
|
51
|
+
for (const ch of value)
|
|
52
|
+
if (RE_RTL_CLASSES.test(GetBidiClass(ch.codePointAt(0))))
|
|
53
|
+
return true;
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
// ------------------------------------------------------------------
|
|
57
|
+
// SatisfiesBidiRule
|
|
58
|
+
// ------------------------------------------------------------------
|
|
59
|
+
export function SatisfiesBidiRule(value) {
|
|
60
|
+
let isRtl = false;
|
|
61
|
+
let allowed = RE_LTR_ALLOWED;
|
|
62
|
+
let sawEN = false;
|
|
63
|
+
let sawAN = false;
|
|
64
|
+
let isFirst = true;
|
|
65
|
+
// let lastClass: string | null = null // (no-spec-coverage)
|
|
66
|
+
for (const ch of value) {
|
|
67
|
+
const bidiClass = GetBidiClass(ch.codePointAt(0));
|
|
68
|
+
if (isFirst) {
|
|
69
|
+
// 1. The first character must be a character with Bidi property L, R, or AL.
|
|
70
|
+
if (bidiClass !== 'L' && bidiClass !== 'R' && bidiClass !== 'AL')
|
|
71
|
+
return false;
|
|
72
|
+
isRtl = bidiClass === 'R' || bidiClass === 'AL';
|
|
73
|
+
allowed = isRtl ? RE_RTL_ALLOWED : RE_LTR_ALLOWED;
|
|
74
|
+
isFirst = false;
|
|
75
|
+
}
|
|
76
|
+
// 2 / 5. Only characters in the allowed set for this direction may appear.
|
|
77
|
+
if (!allowed.test(bidiClass))
|
|
78
|
+
return false;
|
|
79
|
+
if (bidiClass === 'EN')
|
|
80
|
+
sawEN = true;
|
|
81
|
+
else if (bidiClass === 'AN')
|
|
82
|
+
sawAN = true;
|
|
83
|
+
// if (bidiClass !== 'NSM') lastClass = bidiClass // (no-spec-coverage)
|
|
84
|
+
}
|
|
85
|
+
if (isRtl && sawEN && sawAN)
|
|
86
|
+
return false; // spec coverage path
|
|
87
|
+
// (no-spec-coverage)
|
|
88
|
+
// if (isRtl) {
|
|
89
|
+
// // 3. The end of the label must be R, AL, EN, or AN (ignoring trailing NSM).
|
|
90
|
+
// // if (lastClass !== 'R' && lastClass !== 'AL' && lastClass !== 'EN' && lastClass !== 'AN') return false
|
|
91
|
+
// // 4. If an EN is present, no AN may be present, and vice versa.
|
|
92
|
+
// if (sawEN && sawAN) return false
|
|
93
|
+
// } else {
|
|
94
|
+
// // 6. The end of the label must be L or EN (ignoring trailing NSM).
|
|
95
|
+
// // if (lastClass !== 'L' && lastClass !== 'EN') return false
|
|
96
|
+
// }
|
|
97
|
+
return true;
|
|
98
|
+
}
|