@jcheesepkg/nanobot 0.8.7 → 0.8.9

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 (99) hide show
  1. package/dist/_virtual/_rolldown/runtime.mjs +7 -0
  2. package/dist/agent/tools/flex.test.d.mts +1 -0
  3. package/dist/agent/tools/flex.test.mjs +258 -0
  4. package/dist/agent/tools/flex.test.mjs.map +1 -0
  5. package/dist/channels/line.d.mts +3 -1
  6. package/dist/channels/line.d.mts.map +1 -1
  7. package/dist/channels/line.mjs +56 -6
  8. package/dist/channels/line.mjs.map +1 -1
  9. package/dist/channels/line.test.d.mts +1 -0
  10. package/dist/channels/line.test.mjs +202 -0
  11. package/dist/channels/line.test.mjs.map +1 -0
  12. package/dist/config/schema.d.mts +18 -18
  13. package/dist/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +78 -0
  14. package/dist/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +1 -0
  15. package/dist/node_modules/@vitest/expect/dist/index.mjs +1257 -0
  16. package/dist/node_modules/@vitest/expect/dist/index.mjs.map +1 -0
  17. package/dist/node_modules/@vitest/pretty-format/dist/index.mjs +815 -0
  18. package/dist/node_modules/@vitest/pretty-format/dist/index.mjs.map +1 -0
  19. package/dist/node_modules/@vitest/runner/dist/chunk-tasks.mjs +43 -0
  20. package/dist/node_modules/@vitest/runner/dist/chunk-tasks.mjs.map +1 -0
  21. package/dist/node_modules/@vitest/runner/dist/index.mjs +563 -0
  22. package/dist/node_modules/@vitest/runner/dist/index.mjs.map +1 -0
  23. package/dist/node_modules/@vitest/runner/dist/utils.mjs +3 -0
  24. package/dist/node_modules/@vitest/snapshot/dist/index.mjs +1736 -0
  25. package/dist/node_modules/@vitest/snapshot/dist/index.mjs.map +1 -0
  26. package/dist/node_modules/@vitest/snapshot/node_modules/pathe/dist/shared/pathe.ff20891b.mjs +82 -0
  27. package/dist/node_modules/@vitest/snapshot/node_modules/pathe/dist/shared/pathe.ff20891b.mjs.map +1 -0
  28. package/dist/node_modules/@vitest/spy/dist/index.mjs +139 -0
  29. package/dist/node_modules/@vitest/spy/dist/index.mjs.map +1 -0
  30. package/dist/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.mjs +119 -0
  31. package/dist/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.mjs.map +1 -0
  32. package/dist/node_modules/@vitest/utils/dist/diff.mjs +1227 -0
  33. package/dist/node_modules/@vitest/utils/dist/diff.mjs.map +1 -0
  34. package/dist/node_modules/@vitest/utils/dist/error.mjs +92 -0
  35. package/dist/node_modules/@vitest/utils/dist/error.mjs.map +1 -0
  36. package/dist/node_modules/@vitest/utils/dist/helpers.mjs +113 -0
  37. package/dist/node_modules/@vitest/utils/dist/helpers.mjs.map +1 -0
  38. package/dist/node_modules/@vitest/utils/dist/index.mjs +455 -0
  39. package/dist/node_modules/@vitest/utils/dist/index.mjs.map +1 -0
  40. package/dist/node_modules/@vitest/utils/dist/source-map.mjs +164 -0
  41. package/dist/node_modules/@vitest/utils/dist/source-map.mjs.map +1 -0
  42. package/dist/node_modules/chai/index.mjs +3088 -0
  43. package/dist/node_modules/chai/index.mjs.map +1 -0
  44. package/dist/node_modules/loupe/lib/arguments.mjs +12 -0
  45. package/dist/node_modules/loupe/lib/arguments.mjs.map +1 -0
  46. package/dist/node_modules/loupe/lib/array.mjs +17 -0
  47. package/dist/node_modules/loupe/lib/array.mjs.map +1 -0
  48. package/dist/node_modules/loupe/lib/bigint.mjs +12 -0
  49. package/dist/node_modules/loupe/lib/bigint.mjs.map +1 -0
  50. package/dist/node_modules/loupe/lib/class.mjs +16 -0
  51. package/dist/node_modules/loupe/lib/class.mjs.map +1 -0
  52. package/dist/node_modules/loupe/lib/date.mjs +14 -0
  53. package/dist/node_modules/loupe/lib/date.mjs.map +1 -0
  54. package/dist/node_modules/loupe/lib/error.mjs +35 -0
  55. package/dist/node_modules/loupe/lib/error.mjs.map +1 -0
  56. package/dist/node_modules/loupe/lib/function.mjs +13 -0
  57. package/dist/node_modules/loupe/lib/function.mjs.map +1 -0
  58. package/dist/node_modules/loupe/lib/helpers.mjs +123 -0
  59. package/dist/node_modules/loupe/lib/helpers.mjs.map +1 -0
  60. package/dist/node_modules/loupe/lib/html.mjs +40 -0
  61. package/dist/node_modules/loupe/lib/html.mjs.map +1 -0
  62. package/dist/node_modules/loupe/lib/index.mjs +100 -0
  63. package/dist/node_modules/loupe/lib/index.mjs.map +1 -0
  64. package/dist/node_modules/loupe/lib/map.mjs +26 -0
  65. package/dist/node_modules/loupe/lib/map.mjs.map +1 -0
  66. package/dist/node_modules/loupe/lib/number.mjs +15 -0
  67. package/dist/node_modules/loupe/lib/number.mjs.map +1 -0
  68. package/dist/node_modules/loupe/lib/object.mjs +22 -0
  69. package/dist/node_modules/loupe/lib/object.mjs.map +1 -0
  70. package/dist/node_modules/loupe/lib/promise.mjs +6 -0
  71. package/dist/node_modules/loupe/lib/promise.mjs.map +1 -0
  72. package/dist/node_modules/loupe/lib/regexp.mjs +13 -0
  73. package/dist/node_modules/loupe/lib/regexp.mjs.map +1 -0
  74. package/dist/node_modules/loupe/lib/set.mjs +19 -0
  75. package/dist/node_modules/loupe/lib/set.mjs.map +1 -0
  76. package/dist/node_modules/loupe/lib/string.mjs +26 -0
  77. package/dist/node_modules/loupe/lib/string.mjs.map +1 -0
  78. package/dist/node_modules/loupe/lib/symbol.mjs +9 -0
  79. package/dist/node_modules/loupe/lib/symbol.mjs.map +1 -0
  80. package/dist/node_modules/loupe/lib/typedarray.mjs +31 -0
  81. package/dist/node_modules/loupe/lib/typedarray.mjs.map +1 -0
  82. package/dist/node_modules/magic-string/dist/magic-string.es.mjs +940 -0
  83. package/dist/node_modules/magic-string/dist/magic-string.es.mjs.map +1 -0
  84. package/dist/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.mjs +82 -0
  85. package/dist/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.mjs.map +1 -0
  86. package/dist/node_modules/tinyrainbow/dist/node.mjs +9 -0
  87. package/dist/node_modules/tinyrainbow/dist/node.mjs.map +1 -0
  88. package/dist/node_modules/tinyspy/dist/index.mjs +79 -0
  89. package/dist/node_modules/tinyspy/dist/index.mjs.map +1 -0
  90. package/dist/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.mjs +9 -0
  91. package/dist/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.mjs.map +1 -0
  92. package/dist/node_modules/vitest/dist/chunks/date.W2xKR2qe.mjs +51 -0
  93. package/dist/node_modules/vitest/dist/chunks/date.W2xKR2qe.mjs.map +1 -0
  94. package/dist/node_modules/vitest/dist/chunks/utils.C8RiOc4B.mjs +49 -0
  95. package/dist/node_modules/vitest/dist/chunks/utils.C8RiOc4B.mjs.map +1 -0
  96. package/dist/node_modules/vitest/dist/chunks/vi.DgezovHB.mjs +2425 -0
  97. package/dist/node_modules/vitest/dist/chunks/vi.DgezovHB.mjs.map +1 -0
  98. package/package.json +1 -1
  99. package/skills/skill-creator/SKILL.md +29 -0
@@ -0,0 +1,202 @@
1
+ import { __require } from "../_virtual/_rolldown/runtime.mjs";
2
+ import { MessageBus } from "../bus/queue.mjs";
3
+ import { LineChannel, verifyLineSignature } from "./line.mjs";
4
+ import { describe, it } from "../node_modules/@vitest/runner/dist/index.mjs";
5
+ import { globalExpect } from "../node_modules/vitest/dist/chunks/vi.DgezovHB.mjs";
6
+
7
+ //#region src/channels/line.test.ts
8
+ const ch = new LineChannel({
9
+ enabled: false,
10
+ channelSecret: "test",
11
+ channelAccessToken: "test",
12
+ allowFrom: []
13
+ }, new MessageBus());
14
+ describe("findJsonEnd", () => {
15
+ it("finds end of simple object", () => {
16
+ globalExpect(ch.findJsonEnd("{\"a\":1}")).toBe(7);
17
+ });
18
+ it("finds end of nested object", () => {
19
+ globalExpect(ch.findJsonEnd("{\"a\":{\"b\":{\"c\":1}}}")).toBe(19);
20
+ });
21
+ it("finds end with trailing text", () => {
22
+ globalExpect(ch.findJsonEnd("{\"type\":\"bubble\"} some trailing text")).toBe(17);
23
+ });
24
+ it("handles strings with escaped quotes", () => {
25
+ globalExpect(ch.findJsonEnd("{\"text\":\"say \\\"hello\\\"\"}")).toBe(24);
26
+ });
27
+ it("handles strings with braces inside", () => {
28
+ globalExpect(ch.findJsonEnd("{\"text\":\"{ not a real brace }\"}")).toBe(31);
29
+ });
30
+ it("handles escaped backslash before quote", () => {
31
+ globalExpect(ch.findJsonEnd("{\"path\":\"C:\\\\\"}")).toBe(15);
32
+ });
33
+ it("returns -1 for non-object string", () => {
34
+ globalExpect(ch.findJsonEnd("hello")).toBe(-1);
35
+ });
36
+ it("returns -1 for unclosed object", () => {
37
+ globalExpect(ch.findJsonEnd("{\"a\":1")).toBe(-1);
38
+ });
39
+ it("handles empty object", () => {
40
+ globalExpect(ch.findJsonEnd("{}")).toBe(2);
41
+ });
42
+ it("handles arrays inside objects", () => {
43
+ globalExpect(ch.findJsonEnd("{\"items\":[1,2,3]}")).toBe(17);
44
+ });
45
+ });
46
+ describe("extractAltText", () => {
47
+ it("extracts text from a simple bubble", () => {
48
+ globalExpect(ch.extractAltText({
49
+ type: "bubble",
50
+ body: {
51
+ type: "box",
52
+ contents: [{
53
+ type: "text",
54
+ text: "Hello World"
55
+ }]
56
+ }
57
+ })).toBe("Hello World");
58
+ });
59
+ it("extracts title when present", () => {
60
+ globalExpect(ch.extractAltText({
61
+ type: "bubble",
62
+ title: "Card Title",
63
+ body: {
64
+ type: "box",
65
+ contents: []
66
+ }
67
+ })).toBe("Card Title");
68
+ });
69
+ it("falls back to 'Flex Message' when no text found", () => {
70
+ globalExpect(ch.extractAltText({ type: "bubble" })).toBe("Flex Message");
71
+ });
72
+ it("truncates long text to 100 chars", () => {
73
+ const longText = "x".repeat(200);
74
+ globalExpect(ch.extractAltText({
75
+ type: "bubble",
76
+ body: {
77
+ type: "box",
78
+ contents: [{
79
+ type: "text",
80
+ text: longText
81
+ }]
82
+ }
83
+ }).length).toBe(100);
84
+ });
85
+ });
86
+ describe("parseMessage", () => {
87
+ it("returns plain text for normal messages", () => {
88
+ const result = ch.parseMessage("Hello, world!");
89
+ globalExpect(result).toHaveLength(1);
90
+ globalExpect(result[0].type).toBe("text");
91
+ globalExpect(result[0].text).toBe("Hello, world!");
92
+ });
93
+ it("returns (empty) for empty string", () => {
94
+ const result = ch.parseMessage("");
95
+ globalExpect(result).toHaveLength(1);
96
+ globalExpect(result[0].text).toBe("(empty)");
97
+ });
98
+ it("parses pure JSON flex message", () => {
99
+ const flex = JSON.stringify({
100
+ type: "bubble",
101
+ body: {
102
+ type: "box",
103
+ layout: "vertical",
104
+ contents: [{
105
+ type: "text",
106
+ text: "Test"
107
+ }]
108
+ }
109
+ });
110
+ const result = ch.parseMessage(flex);
111
+ globalExpect(result).toHaveLength(1);
112
+ globalExpect(result[0].type).toBe("flex");
113
+ globalExpect(result[0].altText).toBe("Test");
114
+ });
115
+ it("handles JSON with trailing text", () => {
116
+ const input = JSON.stringify({
117
+ type: "bubble",
118
+ body: {
119
+ type: "box",
120
+ layout: "vertical",
121
+ contents: [{
122
+ type: "text",
123
+ text: "Card"
124
+ }]
125
+ }
126
+ }) + "\n\nHere is some extra text!";
127
+ const result = ch.parseMessage(input);
128
+ globalExpect(result).toHaveLength(2);
129
+ globalExpect(result[0].type).toBe("flex");
130
+ globalExpect(result[1].type).toBe("text");
131
+ globalExpect(result[1].text).toBe("Here is some extra text!");
132
+ });
133
+ it("handles JSON with Japanese trailing text", () => {
134
+ const input = JSON.stringify({
135
+ type: "bubble",
136
+ body: {
137
+ type: "box",
138
+ layout: "vertical",
139
+ contents: [{
140
+ type: "text",
141
+ text: "運勢"
142
+ }]
143
+ }
144
+ }) + "\n\n記録できた!今日もがんばろう。";
145
+ const result = ch.parseMessage(input);
146
+ globalExpect(result).toHaveLength(2);
147
+ globalExpect(result[0].type).toBe("flex");
148
+ globalExpect(result[1].type).toBe("text");
149
+ globalExpect(result[1].text).toBe("記録できた!今日もがんばろう。");
150
+ });
151
+ it("handles whitespace around JSON", () => {
152
+ const flex = JSON.stringify({
153
+ type: "bubble",
154
+ body: {
155
+ type: "box",
156
+ contents: [{
157
+ type: "text",
158
+ text: "OK"
159
+ }]
160
+ }
161
+ });
162
+ const result = ch.parseMessage(" " + flex + " ");
163
+ globalExpect(result).toHaveLength(1);
164
+ globalExpect(result[0].type).toBe("flex");
165
+ });
166
+ it("falls back to text for invalid JSON starting with {", () => {
167
+ const result = ch.parseMessage("{not valid json at all}");
168
+ globalExpect(result).toHaveLength(1);
169
+ globalExpect(result[0].type).toBe("text");
170
+ globalExpect(result[0].text).toBe("{not valid json at all}");
171
+ });
172
+ it("falls back to text for non-JSON curly brace text", () => {
173
+ const result = ch.parseMessage("{incomplete json");
174
+ globalExpect(result).toHaveLength(1);
175
+ globalExpect(result[0].type).toBe("text");
176
+ });
177
+ it("splits real-world flex JSON with trailing Japanese text", () => {
178
+ const result = ch.parseMessage(`{"type":"bubble","body":{"type":"box","layout":"vertical","contents":[{"type":"box","layout":"vertical","contents":[{"type": "text","text":"🌱 水やり記録","size": "xl" ,"weight":"bold"},{"type": "text","text":"前回: 今日\\n植物たち元気?", "color":"#666666","margin":"md"}]},{"type": "separator","margin":"lg"},{"type": "box","layout":"horizontal","margin":"md","spacing":"md","contents":[{"type": "button","style": "primary","color": "#4CAF50","action":{"type": "message","label": "水やりした!", "text": "水やりした"}},{"type": "button","style": "secondary","action":{"type": "message","label": "最後にいつ?", "text": "水やり確認"}}]}]}}\n\n記録できた!今日水やりしたことになってる。緑色のボタンがカワイイでしょ。`);
179
+ globalExpect(result).toHaveLength(2);
180
+ globalExpect(result[0].type).toBe("flex");
181
+ globalExpect(result[1].type).toBe("text");
182
+ globalExpect(result[1].text).toBe("記録できた!今日水やりしたことになってる。緑色のボタンがカワイイでしょ。");
183
+ });
184
+ });
185
+ describe("verifyLineSignature", () => {
186
+ it("returns true for valid signature", () => {
187
+ const secret = "test-secret";
188
+ const body = "{\"events\":[]}";
189
+ const { createHmac } = __require("node:crypto");
190
+ globalExpect(verifyLineSignature(secret, body, createHmac("sha256", secret).update(body).digest("base64"))).toBe(true);
191
+ });
192
+ it("returns false for invalid signature", () => {
193
+ globalExpect(verifyLineSignature("secret", "body", "bad-sig")).toBe(false);
194
+ });
195
+ it("returns false for empty signature", () => {
196
+ globalExpect(verifyLineSignature("secret", "body", "")).toBe(false);
197
+ });
198
+ });
199
+
200
+ //#endregion
201
+ export { };
202
+ //# sourceMappingURL=line.test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line.test.mjs","names":[],"sources":["../../src/channels/line.test.ts"],"sourcesContent":["import { describe, it, expect } from \"vitest\";\nimport { LineChannel } from \"./line.js\";\nimport { MessageBus } from \"../bus/queue.js\";\n\n// Construct a minimal LineChannel for testing private methods\nconst bus = new MessageBus();\nconst channel = new LineChannel(\n { enabled: false, channelSecret: \"test\", channelAccessToken: \"test\", allowFrom: [] },\n bus,\n);\n\n// Access private methods via any\nconst ch = channel as unknown as {\n parseMessage(text: string): Array<{ type: string; text?: string; altText?: string; contents?: unknown }>;\n findJsonEnd(str: string): number;\n extractAltText(contents: Record<string, unknown>): string;\n returnFlexMessage(message: string): Array<{ type: string; altText?: string; contents?: unknown }>;\n};\n\n// ---------------------------------------------------------------------------\n// findJsonEnd\n// ---------------------------------------------------------------------------\ndescribe(\"findJsonEnd\", () => {\n it(\"finds end of simple object\", () => {\n expect(ch.findJsonEnd('{\"a\":1}')).toBe(7);\n });\n\n it(\"finds end of nested object\", () => {\n const json = '{\"a\":{\"b\":{\"c\":1}}}';\n expect(ch.findJsonEnd(json)).toBe(json.length);\n });\n\n it(\"finds end with trailing text\", () => {\n const str = '{\"type\":\"bubble\"} some trailing text';\n expect(ch.findJsonEnd(str)).toBe(17);\n });\n\n it(\"handles strings with escaped quotes\", () => {\n const json = '{\"text\":\"say \\\\\"hello\\\\\"\"}';\n expect(ch.findJsonEnd(json)).toBe(json.length);\n });\n\n it(\"handles strings with braces inside\", () => {\n const json = '{\"text\":\"{ not a real brace }\"}';\n expect(ch.findJsonEnd(json)).toBe(json.length);\n });\n\n it(\"handles escaped backslash before quote\", () => {\n // The string value is: path\\\\ (backslash is escaped, quote is not)\n const json = '{\"path\":\"C:\\\\\\\\\"}';\n expect(ch.findJsonEnd(json)).toBe(json.length);\n });\n\n it(\"returns -1 for non-object string\", () => {\n expect(ch.findJsonEnd(\"hello\")).toBe(-1);\n });\n\n it(\"returns -1 for unclosed object\", () => {\n expect(ch.findJsonEnd('{\"a\":1')).toBe(-1);\n });\n\n it(\"handles empty object\", () => {\n expect(ch.findJsonEnd(\"{}\")).toBe(2);\n });\n\n it(\"handles arrays inside objects\", () => {\n const json = '{\"items\":[1,2,3]}';\n expect(ch.findJsonEnd(json)).toBe(json.length);\n });\n});\n\n// ---------------------------------------------------------------------------\n// extractAltText\n// ---------------------------------------------------------------------------\ndescribe(\"extractAltText\", () => {\n it(\"extracts text from a simple bubble\", () => {\n const result = ch.extractAltText({\n type: \"bubble\",\n body: { type: \"box\", contents: [{ type: \"text\", text: \"Hello World\" }] },\n });\n expect(result).toBe(\"Hello World\");\n });\n\n it(\"extracts title when present\", () => {\n const result = ch.extractAltText({\n type: \"bubble\",\n title: \"Card Title\",\n body: { type: \"box\", contents: [] },\n });\n expect(result).toBe(\"Card Title\");\n });\n\n it(\"falls back to 'Flex Message' when no text found\", () => {\n const result = ch.extractAltText({ type: \"bubble\" });\n expect(result).toBe(\"Flex Message\");\n });\n\n it(\"truncates long text to 100 chars\", () => {\n const longText = \"x\".repeat(200);\n const result = ch.extractAltText({\n type: \"bubble\",\n body: { type: \"box\", contents: [{ type: \"text\", text: longText }] },\n });\n expect(result.length).toBe(100);\n });\n});\n\n// ---------------------------------------------------------------------------\n// parseMessage\n// ---------------------------------------------------------------------------\ndescribe(\"parseMessage\", () => {\n it(\"returns plain text for normal messages\", () => {\n const result = ch.parseMessage(\"Hello, world!\");\n expect(result).toHaveLength(1);\n expect(result[0].type).toBe(\"text\");\n expect(result[0].text).toBe(\"Hello, world!\");\n });\n\n it(\"returns (empty) for empty string\", () => {\n const result = ch.parseMessage(\"\");\n expect(result).toHaveLength(1);\n expect(result[0].text).toBe(\"(empty)\");\n });\n\n it(\"parses pure JSON flex message\", () => {\n const flex = JSON.stringify({\n type: \"bubble\",\n body: { type: \"box\", layout: \"vertical\", contents: [{ type: \"text\", text: \"Test\" }] },\n });\n const result = ch.parseMessage(flex);\n expect(result).toHaveLength(1);\n expect(result[0].type).toBe(\"flex\");\n expect(result[0].altText).toBe(\"Test\");\n });\n\n it(\"handles JSON with trailing text\", () => {\n const flex = JSON.stringify({\n type: \"bubble\",\n body: { type: \"box\", layout: \"vertical\", contents: [{ type: \"text\", text: \"Card\" }] },\n });\n const input = flex + \"\\n\\nHere is some extra text!\";\n const result = ch.parseMessage(input);\n expect(result).toHaveLength(2);\n expect(result[0].type).toBe(\"flex\");\n expect(result[1].type).toBe(\"text\");\n expect(result[1].text).toBe(\"Here is some extra text!\");\n });\n\n it(\"handles JSON with Japanese trailing text\", () => {\n const flex = JSON.stringify({\n type: \"bubble\",\n body: { type: \"box\", layout: \"vertical\", contents: [{ type: \"text\", text: \"運勢\" }] },\n });\n const input = flex + \"\\n\\n記録できた!今日もがんばろう。\";\n const result = ch.parseMessage(input);\n expect(result).toHaveLength(2);\n expect(result[0].type).toBe(\"flex\");\n expect(result[1].type).toBe(\"text\");\n expect(result[1].text).toBe(\"記録できた!今日もがんばろう。\");\n });\n\n it(\"handles whitespace around JSON\", () => {\n const flex = JSON.stringify({ type: \"bubble\", body: { type: \"box\", contents: [{ type: \"text\", text: \"OK\" }] } });\n const result = ch.parseMessage(\" \" + flex + \" \");\n expect(result).toHaveLength(1);\n expect(result[0].type).toBe(\"flex\");\n });\n\n it(\"falls back to text for invalid JSON starting with {\", () => {\n const result = ch.parseMessage(\"{not valid json at all}\");\n expect(result).toHaveLength(1);\n expect(result[0].type).toBe(\"text\");\n expect(result[0].text).toBe(\"{not valid json at all}\");\n });\n\n it(\"falls back to text for non-JSON curly brace text\", () => {\n const result = ch.parseMessage(\"{incomplete json\");\n expect(result).toHaveLength(1);\n expect(result[0].type).toBe(\"text\");\n });\n\n it(\"splits real-world flex JSON with trailing Japanese text\", () => {\n const input = `{\"type\":\"bubble\",\"body\":{\"type\":\"box\",\"layout\":\"vertical\",\"contents\":[{\"type\":\"box\",\"layout\":\"vertical\",\"contents\":[{\"type\": \"text\",\"text\":\"🌱 水やり記録\",\"size\": \"xl\" ,\"weight\":\"bold\"},{\"type\": \"text\",\"text\":\"前回: 今日\\\\n植物たち元気?\", \"color\":\"#666666\",\"margin\":\"md\"}]},{\"type\": \"separator\",\"margin\":\"lg\"},{\"type\": \"box\",\"layout\":\"horizontal\",\"margin\":\"md\",\"spacing\":\"md\",\"contents\":[{\"type\": \"button\",\"style\": \"primary\",\"color\": \"#4CAF50\",\"action\":{\"type\": \"message\",\"label\": \"水やりした!\", \"text\": \"水やりした\"}},{\"type\": \"button\",\"style\": \"secondary\",\"action\":{\"type\": \"message\",\"label\": \"最後にいつ?\", \"text\": \"水やり確認\"}}]}]}}\\n\\n記録できた!今日水やりしたことになってる。緑色のボタンがカワイイでしょ。`;\n const result = ch.parseMessage(input);\n expect(result).toHaveLength(2);\n expect(result[0].type).toBe(\"flex\");\n expect(result[1].type).toBe(\"text\");\n expect(result[1].text).toBe(\"記録できた!今日水やりしたことになってる。緑色のボタンがカワイイでしょ。\");\n });\n});\n\n// ---------------------------------------------------------------------------\n// verifyLineSignature (exported function)\n// ---------------------------------------------------------------------------\nimport { verifyLineSignature } from \"./line.js\";\n\ndescribe(\"verifyLineSignature\", () => {\n it(\"returns true for valid signature\", () => {\n const secret = \"test-secret\";\n const body = '{\"events\":[]}';\n // Compute the expected signature\n const { createHmac } = require(\"node:crypto\");\n const expected = createHmac(\"sha256\", secret).update(body).digest(\"base64\");\n expect(verifyLineSignature(secret, body, expected)).toBe(true);\n });\n\n it(\"returns false for invalid signature\", () => {\n expect(verifyLineSignature(\"secret\", \"body\", \"bad-sig\")).toBe(false);\n });\n\n it(\"returns false for empty signature\", () => {\n expect(verifyLineSignature(\"secret\", \"body\", \"\")).toBe(false);\n });\n});\n"],"mappings":";;;;;;;AAYA,MAAM,KANU,IAAI,YAClB;CAAE,SAAS;CAAO,eAAe;CAAQ,oBAAoB;CAAQ,WAAW,EAAE;CAAE,EAF1E,IAAI,YAAY,CAI3B;AAaD,SAAS,qBAAqB;AAC5B,IAAG,oCAAoC;AACrC,eAAO,GAAG,YAAY,YAAU,CAAC,CAAC,KAAK,EAAE;GACzC;AAEF,IAAG,oCAAoC;AAErC,eAAO,GAAG,YADG,4BACc,CAAC,CAAC,KAAK,GAAY;GAC9C;AAEF,IAAG,sCAAsC;AAEvC,eAAO,GAAG,YADE,2CACc,CAAC,CAAC,KAAK,GAAG;GACpC;AAEF,IAAG,6CAA6C;AAE9C,eAAO,GAAG,YADG,mCACc,CAAC,CAAC,KAAK,GAAY;GAC9C;AAEF,IAAG,4CAA4C;AAE7C,eAAO,GAAG,YADG,sCACc,CAAC,CAAC,KAAK,GAAY;GAC9C;AAEF,IAAG,gDAAgD;AAGjD,eAAO,GAAG,YADG,wBACc,CAAC,CAAC,KAAK,GAAY;GAC9C;AAEF,IAAG,0CAA0C;AAC3C,eAAO,GAAG,YAAY,QAAQ,CAAC,CAAC,KAAK,GAAG;GACxC;AAEF,IAAG,wCAAwC;AACzC,eAAO,GAAG,YAAY,WAAS,CAAC,CAAC,KAAK,GAAG;GACzC;AAEF,IAAG,8BAA8B;AAC/B,eAAO,GAAG,YAAY,KAAK,CAAC,CAAC,KAAK,EAAE;GACpC;AAEF,IAAG,uCAAuC;AAExC,eAAO,GAAG,YADG,sBACc,CAAC,CAAC,KAAK,GAAY;GAC9C;EACF;AAKF,SAAS,wBAAwB;AAC/B,IAAG,4CAA4C;AAK7C,eAJe,GAAG,eAAe;GAC/B,MAAM;GACN,MAAM;IAAE,MAAM;IAAO,UAAU,CAAC;KAAE,MAAM;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D,eAAO,OAAO,CAAC,aAAa,EAAE;AAC9B,eAAO,OAAO,GAAG,KAAK,CAAC,KAAK,OAAO;AACnC,eAAO,OAAO,GAAG,KAAK,CAAC,KAAK,0BAA0B;GACtD;AAEF,IAAG,0DAA0D;EAC3D,MAAM,SAAS,GAAG,aAAa,mBAAmB;AAClD,eAAO,OAAO,CAAC,aAAa,EAAE;AAC9B,eAAO,OAAO,GAAG,KAAK,CAAC,KAAK,OAAO;GACnC;AAEF,IAAG,iEAAiE;EAElE,MAAM,SAAS,GAAG,aADJ,qoBACuB;AACrC,eAAO,OAAO,CAAC,aAAa,EAAE;AAC9B,eAAO,OAAO,GAAG,KAAK,CAAC,KAAK,OAAO;AACnC,eAAO,OAAO,GAAG,KAAK,CAAC,KAAK,OAAO;AACnC,eAAO,OAAO,GAAG,KAAK,CAAC,KAAK,uCAAuC;GACnE;EACF;AAOF,SAAS,6BAA6B;AACpC,IAAG,0CAA0C;EAC3C,MAAM,SAAS;EACf,MAAM,OAAO;EAEb,MAAM,EAAE,yBAAuB,cAAc;AAE7C,eAAO,oBAAoB,QAAQ,MADlB,WAAW,UAAU,OAAO,CAAC,OAAO,KAAK,CAAC,OAAO,SAAS,CACzB,CAAC,CAAC,KAAK,KAAK;GAC9D;AAEF,IAAG,6CAA6C;AAC9C,eAAO,oBAAoB,UAAU,QAAQ,UAAU,CAAC,CAAC,KAAK,MAAM;GACpE;AAEF,IAAG,2CAA2C;AAC5C,eAAO,oBAAoB,UAAU,QAAQ,GAAG,CAAC,CAAC,KAAK,MAAM;GAC7D;EACF"}
@@ -556,15 +556,15 @@ declare const ToolsConfigSchema: z.ZodObject<{
556
556
  export?: string | undefined;
557
557
  }>, "many">>;
558
558
  }, "strip", z.ZodTypeAny, {
559
- exec: {
560
- timeout: number;
561
- };
562
559
  web: {
563
560
  search: {
564
561
  apiKey: string;
565
562
  maxResults: number;
566
563
  };
567
564
  };
565
+ exec: {
566
+ timeout: number;
567
+ };
568
568
  restrictToWorkspace: boolean;
569
569
  enabled?: string[] | undefined;
570
570
  disabled?: string[] | undefined;
@@ -574,9 +574,6 @@ declare const ToolsConfigSchema: z.ZodObject<{
574
574
  export?: string | undefined;
575
575
  }[] | undefined;
576
576
  }, {
577
- exec?: {
578
- timeout?: number | undefined;
579
- } | undefined;
580
577
  enabled?: string[] | undefined;
581
578
  web?: {
582
579
  search?: {
@@ -584,6 +581,9 @@ declare const ToolsConfigSchema: z.ZodObject<{
584
581
  maxResults?: number | undefined;
585
582
  } | undefined;
586
583
  } | undefined;
584
+ exec?: {
585
+ timeout?: number | undefined;
586
+ } | undefined;
587
587
  restrictToWorkspace?: boolean | undefined;
588
588
  disabled?: string[] | undefined;
589
589
  custom?: {
@@ -1015,15 +1015,15 @@ declare const ConfigSchema: z.ZodObject<{
1015
1015
  export?: string | undefined;
1016
1016
  }>, "many">>;
1017
1017
  }, "strip", z.ZodTypeAny, {
1018
- exec: {
1019
- timeout: number;
1020
- };
1021
1018
  web: {
1022
1019
  search: {
1023
1020
  apiKey: string;
1024
1021
  maxResults: number;
1025
1022
  };
1026
1023
  };
1024
+ exec: {
1025
+ timeout: number;
1026
+ };
1027
1027
  restrictToWorkspace: boolean;
1028
1028
  enabled?: string[] | undefined;
1029
1029
  disabled?: string[] | undefined;
@@ -1033,9 +1033,6 @@ declare const ConfigSchema: z.ZodObject<{
1033
1033
  export?: string | undefined;
1034
1034
  }[] | undefined;
1035
1035
  }, {
1036
- exec?: {
1037
- timeout?: number | undefined;
1038
- } | undefined;
1039
1036
  enabled?: string[] | undefined;
1040
1037
  web?: {
1041
1038
  search?: {
@@ -1043,6 +1040,9 @@ declare const ConfigSchema: z.ZodObject<{
1043
1040
  maxResults?: number | undefined;
1044
1041
  } | undefined;
1045
1042
  } | undefined;
1043
+ exec?: {
1044
+ timeout?: number | undefined;
1045
+ } | undefined;
1046
1046
  restrictToWorkspace?: boolean | undefined;
1047
1047
  disabled?: string[] | undefined;
1048
1048
  custom?: {
@@ -1139,15 +1139,15 @@ declare const ConfigSchema: z.ZodObject<{
1139
1139
  port: number;
1140
1140
  };
1141
1141
  tools: {
1142
- exec: {
1143
- timeout: number;
1144
- };
1145
1142
  web: {
1146
1143
  search: {
1147
1144
  apiKey: string;
1148
1145
  maxResults: number;
1149
1146
  };
1150
1147
  };
1148
+ exec: {
1149
+ timeout: number;
1150
+ };
1151
1151
  restrictToWorkspace: boolean;
1152
1152
  enabled?: string[] | undefined;
1153
1153
  disabled?: string[] | undefined;
@@ -1245,9 +1245,6 @@ declare const ConfigSchema: z.ZodObject<{
1245
1245
  port?: number | undefined;
1246
1246
  } | undefined;
1247
1247
  tools?: {
1248
- exec?: {
1249
- timeout?: number | undefined;
1250
- } | undefined;
1251
1248
  enabled?: string[] | undefined;
1252
1249
  web?: {
1253
1250
  search?: {
@@ -1255,6 +1252,9 @@ declare const ConfigSchema: z.ZodObject<{
1255
1252
  maxResults?: number | undefined;
1256
1253
  } | undefined;
1257
1254
  } | undefined;
1255
+ exec?: {
1256
+ timeout?: number | undefined;
1257
+ } | undefined;
1258
1258
  restrictToWorkspace?: boolean | undefined;
1259
1259
  disabled?: string[] | undefined;
1260
1260
  custom?: {
@@ -0,0 +1,78 @@
1
+ //#region node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
2
+ var comma = ",".charCodeAt(0);
3
+ var semicolon = ";".charCodeAt(0);
4
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
5
+ var intToChar = new Uint8Array(64);
6
+ var charToInt = new Uint8Array(128);
7
+ for (let i = 0; i < chars.length; i++) {
8
+ const c = chars.charCodeAt(i);
9
+ intToChar[i] = c;
10
+ charToInt[c] = i;
11
+ }
12
+ function encodeInteger(builder, num, relative) {
13
+ let delta = num - relative;
14
+ delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
15
+ do {
16
+ let clamped = delta & 31;
17
+ delta >>>= 5;
18
+ if (delta > 0) clamped |= 32;
19
+ builder.write(intToChar[clamped]);
20
+ } while (delta > 0);
21
+ return num;
22
+ }
23
+ var bufLength = 1024 * 16;
24
+ var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { decode(buf) {
25
+ return Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength).toString();
26
+ } } : { decode(buf) {
27
+ let out = "";
28
+ for (let i = 0; i < buf.length; i++) out += String.fromCharCode(buf[i]);
29
+ return out;
30
+ } };
31
+ var StringWriter = class {
32
+ constructor() {
33
+ this.pos = 0;
34
+ this.out = "";
35
+ this.buffer = new Uint8Array(bufLength);
36
+ }
37
+ write(v) {
38
+ const { buffer } = this;
39
+ buffer[this.pos++] = v;
40
+ if (this.pos === bufLength) {
41
+ this.out += td.decode(buffer);
42
+ this.pos = 0;
43
+ }
44
+ }
45
+ flush() {
46
+ const { buffer, out, pos } = this;
47
+ return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
48
+ }
49
+ };
50
+ function encode(decoded) {
51
+ const writer = new StringWriter();
52
+ let sourcesIndex = 0;
53
+ let sourceLine = 0;
54
+ let sourceColumn = 0;
55
+ let namesIndex = 0;
56
+ for (let i = 0; i < decoded.length; i++) {
57
+ const line = decoded[i];
58
+ if (i > 0) writer.write(semicolon);
59
+ if (line.length === 0) continue;
60
+ let genColumn = 0;
61
+ for (let j = 0; j < line.length; j++) {
62
+ const segment = line[j];
63
+ if (j > 0) writer.write(comma);
64
+ genColumn = encodeInteger(writer, segment[0], genColumn);
65
+ if (segment.length === 1) continue;
66
+ sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
67
+ sourceLine = encodeInteger(writer, segment[2], sourceLine);
68
+ sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
69
+ if (segment.length === 4) continue;
70
+ namesIndex = encodeInteger(writer, segment[4], namesIndex);
71
+ }
72
+ }
73
+ return writer.flush();
74
+ }
75
+
76
+ //#endregion
77
+ export { encode };
78
+ //# sourceMappingURL=sourcemap-codec.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourcemap-codec.mjs","names":[],"sources":["../../../../../node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs"],"sourcesContent":["// src/vlq.ts\nvar comma = \",\".charCodeAt(0);\nvar semicolon = \";\".charCodeAt(0);\nvar chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nvar intToChar = new Uint8Array(64);\nvar charToInt = new Uint8Array(128);\nfor (let i = 0; i < chars.length; i++) {\n const c = chars.charCodeAt(i);\n intToChar[i] = c;\n charToInt[c] = i;\n}\nfunction decodeInteger(reader, relative) {\n let value = 0;\n let shift = 0;\n let integer = 0;\n do {\n const c = reader.next();\n integer = charToInt[c];\n value |= (integer & 31) << shift;\n shift += 5;\n } while (integer & 32);\n const shouldNegate = value & 1;\n value >>>= 1;\n if (shouldNegate) {\n value = -2147483648 | -value;\n }\n return relative + value;\n}\nfunction encodeInteger(builder, num, relative) {\n let delta = num - relative;\n delta = delta < 0 ? -delta << 1 | 1 : delta << 1;\n do {\n let clamped = delta & 31;\n delta >>>= 5;\n if (delta > 0) clamped |= 32;\n builder.write(intToChar[clamped]);\n } while (delta > 0);\n return num;\n}\nfunction hasMoreVlq(reader, max) {\n if (reader.pos >= max) return false;\n return reader.peek() !== comma;\n}\n\n// src/strings.ts\nvar bufLength = 1024 * 16;\nvar td = typeof TextDecoder !== \"undefined\" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== \"undefined\" ? {\n decode(buf) {\n const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);\n return out.toString();\n }\n} : {\n decode(buf) {\n let out = \"\";\n for (let i = 0; i < buf.length; i++) {\n out += String.fromCharCode(buf[i]);\n }\n return out;\n }\n};\nvar StringWriter = class {\n constructor() {\n this.pos = 0;\n this.out = \"\";\n this.buffer = new Uint8Array(bufLength);\n }\n write(v) {\n const { buffer } = this;\n buffer[this.pos++] = v;\n if (this.pos === bufLength) {\n this.out += td.decode(buffer);\n this.pos = 0;\n }\n }\n flush() {\n const { buffer, out, pos } = this;\n return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;\n }\n};\nvar StringReader = class {\n constructor(buffer) {\n this.pos = 0;\n this.buffer = buffer;\n }\n next() {\n return this.buffer.charCodeAt(this.pos++);\n }\n peek() {\n return this.buffer.charCodeAt(this.pos);\n }\n indexOf(char) {\n const { buffer, pos } = this;\n const idx = buffer.indexOf(char, pos);\n return idx === -1 ? buffer.length : idx;\n }\n};\n\n// src/scopes.ts\nvar EMPTY = [];\nfunction decodeOriginalScopes(input) {\n const { length } = input;\n const reader = new StringReader(input);\n const scopes = [];\n const stack = [];\n let line = 0;\n for (; reader.pos < length; reader.pos++) {\n line = decodeInteger(reader, line);\n const column = decodeInteger(reader, 0);\n if (!hasMoreVlq(reader, length)) {\n const last = stack.pop();\n last[2] = line;\n last[3] = column;\n continue;\n }\n const kind = decodeInteger(reader, 0);\n const fields = decodeInteger(reader, 0);\n const hasName = fields & 1;\n const scope = hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind];\n let vars = EMPTY;\n if (hasMoreVlq(reader, length)) {\n vars = [];\n do {\n const varsIndex = decodeInteger(reader, 0);\n vars.push(varsIndex);\n } while (hasMoreVlq(reader, length));\n }\n scope.vars = vars;\n scopes.push(scope);\n stack.push(scope);\n }\n return scopes;\n}\nfunction encodeOriginalScopes(scopes) {\n const writer = new StringWriter();\n for (let i = 0; i < scopes.length; ) {\n i = _encodeOriginalScopes(scopes, i, writer, [0]);\n }\n return writer.flush();\n}\nfunction _encodeOriginalScopes(scopes, index, writer, state) {\n const scope = scopes[index];\n const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;\n if (index > 0) writer.write(comma);\n state[0] = encodeInteger(writer, startLine, state[0]);\n encodeInteger(writer, startColumn, 0);\n encodeInteger(writer, kind, 0);\n const fields = scope.length === 6 ? 1 : 0;\n encodeInteger(writer, fields, 0);\n if (scope.length === 6) encodeInteger(writer, scope[5], 0);\n for (const v of vars) {\n encodeInteger(writer, v, 0);\n }\n for (index++; index < scopes.length; ) {\n const next = scopes[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || l === endLine && c >= endColumn) {\n break;\n }\n index = _encodeOriginalScopes(scopes, index, writer, state);\n }\n writer.write(comma);\n state[0] = encodeInteger(writer, endLine, state[0]);\n encodeInteger(writer, endColumn, 0);\n return index;\n}\nfunction decodeGeneratedRanges(input) {\n const { length } = input;\n const reader = new StringReader(input);\n const ranges = [];\n const stack = [];\n let genLine = 0;\n let definitionSourcesIndex = 0;\n let definitionScopeIndex = 0;\n let callsiteSourcesIndex = 0;\n let callsiteLine = 0;\n let callsiteColumn = 0;\n let bindingLine = 0;\n let bindingColumn = 0;\n do {\n const semi = reader.indexOf(\";\");\n let genColumn = 0;\n for (; reader.pos < semi; reader.pos++) {\n genColumn = decodeInteger(reader, genColumn);\n if (!hasMoreVlq(reader, semi)) {\n const last = stack.pop();\n last[2] = genLine;\n last[3] = genColumn;\n continue;\n }\n const fields = decodeInteger(reader, 0);\n const hasDefinition = fields & 1;\n const hasCallsite = fields & 2;\n const hasScope = fields & 4;\n let callsite = null;\n let bindings = EMPTY;\n let range;\n if (hasDefinition) {\n const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);\n definitionScopeIndex = decodeInteger(\n reader,\n definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0\n );\n definitionSourcesIndex = defSourcesIndex;\n range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex];\n } else {\n range = [genLine, genColumn, 0, 0];\n }\n range.isScope = !!hasScope;\n if (hasCallsite) {\n const prevCsi = callsiteSourcesIndex;\n const prevLine = callsiteLine;\n callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);\n const sameSource = prevCsi === callsiteSourcesIndex;\n callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);\n callsiteColumn = decodeInteger(\n reader,\n sameSource && prevLine === callsiteLine ? callsiteColumn : 0\n );\n callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];\n }\n range.callsite = callsite;\n if (hasMoreVlq(reader, semi)) {\n bindings = [];\n do {\n bindingLine = genLine;\n bindingColumn = genColumn;\n const expressionsCount = decodeInteger(reader, 0);\n let expressionRanges;\n if (expressionsCount < -1) {\n expressionRanges = [[decodeInteger(reader, 0)]];\n for (let i = -1; i > expressionsCount; i--) {\n const prevBl = bindingLine;\n bindingLine = decodeInteger(reader, bindingLine);\n bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);\n const expression = decodeInteger(reader, 0);\n expressionRanges.push([expression, bindingLine, bindingColumn]);\n }\n } else {\n expressionRanges = [[expressionsCount]];\n }\n bindings.push(expressionRanges);\n } while (hasMoreVlq(reader, semi));\n }\n range.bindings = bindings;\n ranges.push(range);\n stack.push(range);\n }\n genLine++;\n reader.pos = semi + 1;\n } while (reader.pos < length);\n return ranges;\n}\nfunction encodeGeneratedRanges(ranges) {\n if (ranges.length === 0) return \"\";\n const writer = new StringWriter();\n for (let i = 0; i < ranges.length; ) {\n i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);\n }\n return writer.flush();\n}\nfunction _encodeGeneratedRanges(ranges, index, writer, state) {\n const range = ranges[index];\n const {\n 0: startLine,\n 1: startColumn,\n 2: endLine,\n 3: endColumn,\n isScope,\n callsite,\n bindings\n } = range;\n if (state[0] < startLine) {\n catchupLine(writer, state[0], startLine);\n state[0] = startLine;\n state[1] = 0;\n } else if (index > 0) {\n writer.write(comma);\n }\n state[1] = encodeInteger(writer, range[1], state[1]);\n const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0);\n encodeInteger(writer, fields, 0);\n if (range.length === 6) {\n const { 4: sourcesIndex, 5: scopesIndex } = range;\n if (sourcesIndex !== state[2]) {\n state[3] = 0;\n }\n state[2] = encodeInteger(writer, sourcesIndex, state[2]);\n state[3] = encodeInteger(writer, scopesIndex, state[3]);\n }\n if (callsite) {\n const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite;\n if (sourcesIndex !== state[4]) {\n state[5] = 0;\n state[6] = 0;\n } else if (callLine !== state[5]) {\n state[6] = 0;\n }\n state[4] = encodeInteger(writer, sourcesIndex, state[4]);\n state[5] = encodeInteger(writer, callLine, state[5]);\n state[6] = encodeInteger(writer, callColumn, state[6]);\n }\n if (bindings) {\n for (const binding of bindings) {\n if (binding.length > 1) encodeInteger(writer, -binding.length, 0);\n const expression = binding[0][0];\n encodeInteger(writer, expression, 0);\n let bindingStartLine = startLine;\n let bindingStartColumn = startColumn;\n for (let i = 1; i < binding.length; i++) {\n const expRange = binding[i];\n bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);\n bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);\n encodeInteger(writer, expRange[0], 0);\n }\n }\n }\n for (index++; index < ranges.length; ) {\n const next = ranges[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || l === endLine && c >= endColumn) {\n break;\n }\n index = _encodeGeneratedRanges(ranges, index, writer, state);\n }\n if (state[0] < endLine) {\n catchupLine(writer, state[0], endLine);\n state[0] = endLine;\n state[1] = 0;\n } else {\n writer.write(comma);\n }\n state[1] = encodeInteger(writer, endColumn, state[1]);\n return index;\n}\nfunction catchupLine(writer, lastLine, line) {\n do {\n writer.write(semicolon);\n } while (++lastLine < line);\n}\n\n// src/sourcemap-codec.ts\nfunction decode(mappings) {\n const { length } = mappings;\n const reader = new StringReader(mappings);\n const decoded = [];\n let genColumn = 0;\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n do {\n const semi = reader.indexOf(\";\");\n const line = [];\n let sorted = true;\n let lastCol = 0;\n genColumn = 0;\n while (reader.pos < semi) {\n let seg;\n genColumn = decodeInteger(reader, genColumn);\n if (genColumn < lastCol) sorted = false;\n lastCol = genColumn;\n if (hasMoreVlq(reader, semi)) {\n sourcesIndex = decodeInteger(reader, sourcesIndex);\n sourceLine = decodeInteger(reader, sourceLine);\n sourceColumn = decodeInteger(reader, sourceColumn);\n if (hasMoreVlq(reader, semi)) {\n namesIndex = decodeInteger(reader, namesIndex);\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];\n } else {\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];\n }\n } else {\n seg = [genColumn];\n }\n line.push(seg);\n reader.pos++;\n }\n if (!sorted) sort(line);\n decoded.push(line);\n reader.pos = semi + 1;\n } while (reader.pos <= length);\n return decoded;\n}\nfunction sort(line) {\n line.sort(sortComparator);\n}\nfunction sortComparator(a, b) {\n return a[0] - b[0];\n}\nfunction encode(decoded) {\n const writer = new StringWriter();\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n if (i > 0) writer.write(semicolon);\n if (line.length === 0) continue;\n let genColumn = 0;\n for (let j = 0; j < line.length; j++) {\n const segment = line[j];\n if (j > 0) writer.write(comma);\n genColumn = encodeInteger(writer, segment[0], genColumn);\n if (segment.length === 1) continue;\n sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);\n sourceLine = encodeInteger(writer, segment[2], sourceLine);\n sourceColumn = encodeInteger(writer, segment[3], sourceColumn);\n if (segment.length === 4) continue;\n namesIndex = encodeInteger(writer, segment[4], namesIndex);\n }\n }\n return writer.flush();\n}\nexport {\n decode,\n decodeGeneratedRanges,\n decodeOriginalScopes,\n encode,\n encodeGeneratedRanges,\n encodeOriginalScopes\n};\n//# sourceMappingURL=sourcemap-codec.mjs.map\n"],"x_google_ignoreList":[0],"mappings":";AACA,IAAI,QAAQ,IAAI,WAAW,EAAE;AAC7B,IAAI,YAAY,IAAI,WAAW,EAAE;AACjC,IAAI,QAAQ;AACZ,IAAI,YAAY,IAAI,WAAW,GAAG;AAClC,IAA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