@gui-chat-plugin/google-map 0.3.0

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/core.js ADDED
@@ -0,0 +1,458 @@
1
+ const s = "mapControl", c = {
2
+ type: "function",
3
+ name: s,
4
+ description: `Control a Google Map interactively. Supports showing locations, adding markers, searching for places, and getting directions.
5
+
6
+ Available actions:
7
+ - showLocation: Display a location on the map (default action)
8
+ - setCenter: Change the map center without markers
9
+ - setZoom: Change the zoom level (1-21)
10
+ - addMarker: Add a marker to the map
11
+ - clearMarkers: Remove all markers from the map
12
+ - findPlaces: Search for nearby places using Google Places API
13
+ - getDirections: Get directions between two locations`,
14
+ parameters: {
15
+ type: "object",
16
+ properties: {
17
+ action: {
18
+ type: "string",
19
+ enum: [
20
+ "showLocation",
21
+ "setCenter",
22
+ "setZoom",
23
+ "addMarker",
24
+ "clearMarkers",
25
+ "findPlaces",
26
+ "getDirections"
27
+ ],
28
+ description: "The action to perform. Defaults to 'showLocation' if not specified."
29
+ },
30
+ location: {
31
+ type: "string",
32
+ description: "Location name, address, or place (e.g., 'Tokyo Station', 'Paris, France'). Used with showLocation, setCenter, addMarker actions."
33
+ },
34
+ lat: {
35
+ type: "number",
36
+ description: "Latitude coordinate. Can be used instead of location for precise positioning."
37
+ },
38
+ lng: {
39
+ type: "number",
40
+ description: "Longitude coordinate. Can be used instead of location for precise positioning."
41
+ },
42
+ zoom: {
43
+ type: "integer",
44
+ minimum: 1,
45
+ maximum: 21,
46
+ description: "Zoom level for setZoom action (1=world, 15=streets, 21=buildings). Default is 15."
47
+ },
48
+ searchQuery: {
49
+ type: "string",
50
+ description: "Text search query for findPlaces action (e.g., 'ramen', 'coffee shop')."
51
+ },
52
+ placeType: {
53
+ type: "string",
54
+ enum: [
55
+ "accounting",
56
+ "airport",
57
+ "amusement_park",
58
+ "aquarium",
59
+ "art_gallery",
60
+ "atm",
61
+ "bakery",
62
+ "bank",
63
+ "bar",
64
+ "beauty_salon",
65
+ "bicycle_store",
66
+ "book_store",
67
+ "bowling_alley",
68
+ "bus_station",
69
+ "cafe",
70
+ "campground",
71
+ "car_dealer",
72
+ "car_rental",
73
+ "car_repair",
74
+ "car_wash",
75
+ "casino",
76
+ "cemetery",
77
+ "church",
78
+ "city_hall",
79
+ "clothing_store",
80
+ "convenience_store",
81
+ "courthouse",
82
+ "dentist",
83
+ "department_store",
84
+ "doctor",
85
+ "drugstore",
86
+ "electrician",
87
+ "electronics_store",
88
+ "embassy",
89
+ "fire_station",
90
+ "florist",
91
+ "funeral_home",
92
+ "furniture_store",
93
+ "gas_station",
94
+ "gym",
95
+ "hair_care",
96
+ "hardware_store",
97
+ "hindu_temple",
98
+ "home_goods_store",
99
+ "hospital",
100
+ "insurance_agency",
101
+ "jewelry_store",
102
+ "laundry",
103
+ "lawyer",
104
+ "library",
105
+ "light_rail_station",
106
+ "liquor_store",
107
+ "local_government_office",
108
+ "locksmith",
109
+ "lodging",
110
+ "meal_delivery",
111
+ "meal_takeaway",
112
+ "mosque",
113
+ "movie_rental",
114
+ "movie_theater",
115
+ "moving_company",
116
+ "museum",
117
+ "night_club",
118
+ "painter",
119
+ "park",
120
+ "parking",
121
+ "pet_store",
122
+ "pharmacy",
123
+ "physiotherapist",
124
+ "plumber",
125
+ "police",
126
+ "post_office",
127
+ "primary_school",
128
+ "real_estate_agency",
129
+ "restaurant",
130
+ "roofing_contractor",
131
+ "rv_park",
132
+ "school",
133
+ "secondary_school",
134
+ "shoe_store",
135
+ "shopping_mall",
136
+ "spa",
137
+ "stadium",
138
+ "storage",
139
+ "store",
140
+ "subway_station",
141
+ "supermarket",
142
+ "synagogue",
143
+ "taxi_stand",
144
+ "tourist_attraction",
145
+ "train_station",
146
+ "transit_station",
147
+ "travel_agency",
148
+ "university",
149
+ "veterinary_care",
150
+ "zoo"
151
+ ],
152
+ description: "Type of place to search for with findPlaces action. Use with or instead of searchQuery."
153
+ },
154
+ origin: {
155
+ type: "string",
156
+ description: "Starting point for getDirections action. Can be a place name or address."
157
+ },
158
+ destination: {
159
+ type: "string",
160
+ description: "End point for getDirections action. Can be a place name or address."
161
+ },
162
+ travelMode: {
163
+ type: "string",
164
+ enum: ["DRIVING", "WALKING", "BICYCLING", "TRANSIT"],
165
+ description: "Travel mode for getDirections action. Defaults to DRIVING."
166
+ },
167
+ markerTitle: {
168
+ type: "string",
169
+ description: "Title for the marker (shown on hover) when using addMarker."
170
+ },
171
+ markerLabel: {
172
+ type: "string",
173
+ description: "Single character label displayed on the marker when using addMarker."
174
+ }
175
+ },
176
+ required: []
177
+ }
178
+ }, l = "showLocation", d = 15, m = "DRIVING", p = () => `marker_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`, h = (o) => Number.isInteger(o) && o >= 1 && o <= 21, g = (o) => !!(o.location || o.lat !== void 0 && o.lng !== void 0), u = (o) => o.lat !== void 0 && o.lng !== void 0 ? { lat: o.lat, lng: o.lng } : o.location, i = async (o, e) => {
179
+ const a = e.action || l;
180
+ switch (a) {
181
+ case "showLocation":
182
+ case "setCenter":
183
+ case "addMarker": {
184
+ if (!g(e))
185
+ throw new Error(
186
+ `${a} requires either 'location' or both 'lat' and 'lng' parameters`
187
+ );
188
+ const t = u(e), n = { action: a, location: t };
189
+ a === "addMarker" && (n.marker = {
190
+ id: p(),
191
+ position: typeof t == "string" ? { lat: 0, lng: 0 } : t,
192
+ title: e.markerTitle,
193
+ label: e.markerLabel?.charAt(0)
194
+ });
195
+ const r = typeof t == "string" ? t : `${t?.lat}, ${t?.lng}`;
196
+ return {
197
+ message: {
198
+ showLocation: `Showing ${r} on the map`,
199
+ setCenter: `Centering map on ${r}`,
200
+ addMarker: `Adding marker at ${r}`
201
+ }[a],
202
+ data: n
203
+ };
204
+ }
205
+ case "setZoom": {
206
+ const t = e.zoom ?? d;
207
+ if (!h(t))
208
+ throw new Error("Zoom level must be an integer between 1 and 21");
209
+ return {
210
+ message: `Setting zoom level to ${t}`,
211
+ data: { action: a, zoom: t }
212
+ };
213
+ }
214
+ case "clearMarkers":
215
+ return {
216
+ message: "Clearing all markers from the map",
217
+ data: { action: a }
218
+ };
219
+ case "findPlaces": {
220
+ if (!e.searchQuery && !e.placeType)
221
+ throw new Error(
222
+ "findPlaces requires either 'searchQuery' or 'placeType' parameter"
223
+ );
224
+ return {
225
+ message: `Searching for ${e.searchQuery ? `"${e.searchQuery}"` : e.placeType} nearby`,
226
+ data: {
227
+ action: a,
228
+ searchQuery: e.searchQuery,
229
+ placeType: e.placeType
230
+ }
231
+ };
232
+ }
233
+ case "getDirections": {
234
+ if (!e.origin || !e.destination)
235
+ throw new Error(
236
+ "getDirections requires both 'origin' and 'destination' parameters"
237
+ );
238
+ const t = e.travelMode || m;
239
+ return {
240
+ message: `Getting ${t.toLowerCase()} directions from ${e.origin} to ${e.destination}`,
241
+ data: {
242
+ action: a,
243
+ origin: e.origin,
244
+ destination: e.destination,
245
+ travelMode: t
246
+ }
247
+ };
248
+ }
249
+ default:
250
+ throw new Error(`Unknown action: ${a}`);
251
+ }
252
+ }, y = `You have access to the mapControl tool for interactive map operations.
253
+
254
+ ## Basic Usage
255
+
256
+ Show a location:
257
+ \`\`\`
258
+ mapControl(location: "Tokyo Station")
259
+ mapControl(action: "showLocation", location: "Paris, France")
260
+ \`\`\`
261
+
262
+ ## Available Actions
263
+
264
+ ### showLocation (default)
265
+ Display a location on the map with a marker.
266
+ - Use \`location\` for place names/addresses
267
+ - Or use \`lat\` and \`lng\` for coordinates
268
+
269
+ ### setCenter
270
+ Move the map center without adding markers.
271
+ \`\`\`
272
+ mapControl(action: "setCenter", location: "Shibuya, Tokyo")
273
+ \`\`\`
274
+
275
+ ### setZoom
276
+ Change the zoom level (1-21).
277
+ - 1-5: Continent/Country level
278
+ - 6-10: Region/City level
279
+ - 11-15: Street level
280
+ - 16-21: Building level
281
+ \`\`\`
282
+ mapControl(action: "setZoom", zoom: 12)
283
+ \`\`\`
284
+
285
+ ### addMarker
286
+ Add a marker at a location (without centering).
287
+ \`\`\`
288
+ mapControl(action: "addMarker", location: "Tokyo Tower", markerTitle: "Tokyo Tower", markerLabel: "T")
289
+ \`\`\`
290
+
291
+ ### clearMarkers
292
+ Remove all markers from the map.
293
+ \`\`\`
294
+ mapControl(action: "clearMarkers")
295
+ \`\`\`
296
+
297
+ ### findPlaces
298
+ Search for nearby places using Google Places API.
299
+ \`\`\`
300
+ mapControl(action: "findPlaces", searchQuery: "ramen")
301
+ mapControl(action: "findPlaces", placeType: "restaurant")
302
+ mapControl(action: "findPlaces", searchQuery: "coffee", placeType: "cafe")
303
+ \`\`\`
304
+
305
+ ### getDirections
306
+ Get directions between two locations.
307
+ \`\`\`
308
+ mapControl(action: "getDirections", origin: "Tokyo Station", destination: "Tokyo Tower", travelMode: "WALKING")
309
+ \`\`\`
310
+ Travel modes: DRIVING, WALKING, BICYCLING, TRANSIT
311
+
312
+ ## Response Data
313
+
314
+ The map will return JSON data with the results of each action, including:
315
+ - Current center coordinates and zoom level
316
+ - Markers on the map
317
+ - Place search results with ratings and addresses
318
+ - Route information with distance and duration`, k = {
319
+ toolDefinition: c,
320
+ execute: i,
321
+ generatingMessage: "Loading map...",
322
+ isEnabled: (o) => !!o?.googleMapKey,
323
+ backends: ["map"],
324
+ systemPrompt: y
325
+ }, w = i, _ = [
326
+ // showLocation samples
327
+ {
328
+ name: "Show Tokyo Station",
329
+ args: {
330
+ action: "showLocation",
331
+ location: "Tokyo Station, Japan"
332
+ }
333
+ },
334
+ {
335
+ name: "Show Eiffel Tower",
336
+ args: {
337
+ action: "showLocation",
338
+ location: "Eiffel Tower, Paris, France"
339
+ }
340
+ },
341
+ {
342
+ name: "Show coordinates",
343
+ args: {
344
+ action: "showLocation",
345
+ lat: 40.7128,
346
+ lng: -74.006
347
+ }
348
+ },
349
+ // setCenter samples
350
+ {
351
+ name: "Center on Shibuya",
352
+ args: {
353
+ action: "setCenter",
354
+ location: "Shibuya, Tokyo"
355
+ }
356
+ },
357
+ // setZoom samples
358
+ {
359
+ name: "Zoom to street level",
360
+ args: {
361
+ action: "setZoom",
362
+ zoom: 17
363
+ }
364
+ },
365
+ {
366
+ name: "Zoom to city level",
367
+ args: {
368
+ action: "setZoom",
369
+ zoom: 12
370
+ }
371
+ },
372
+ // addMarker samples
373
+ {
374
+ name: "Add marker at Tokyo Tower",
375
+ args: {
376
+ action: "addMarker",
377
+ location: "Tokyo Tower, Japan",
378
+ markerTitle: "Tokyo Tower",
379
+ markerLabel: "T"
380
+ }
381
+ },
382
+ {
383
+ name: "Add marker with coordinates",
384
+ args: {
385
+ action: "addMarker",
386
+ lat: 35.6586,
387
+ lng: 139.7454,
388
+ markerTitle: "Custom Location"
389
+ }
390
+ },
391
+ // clearMarkers sample
392
+ {
393
+ name: "Clear all markers",
394
+ args: {
395
+ action: "clearMarkers"
396
+ }
397
+ },
398
+ // findPlaces samples
399
+ {
400
+ name: "Find nearby ramen",
401
+ args: {
402
+ action: "findPlaces",
403
+ searchQuery: "ramen"
404
+ }
405
+ },
406
+ {
407
+ name: "Find restaurants",
408
+ args: {
409
+ action: "findPlaces",
410
+ placeType: "restaurant"
411
+ }
412
+ },
413
+ {
414
+ name: "Find coffee shops",
415
+ args: {
416
+ action: "findPlaces",
417
+ searchQuery: "coffee",
418
+ placeType: "cafe"
419
+ }
420
+ },
421
+ // getDirections samples
422
+ {
423
+ name: "Directions: Tokyo Station to Shibuya",
424
+ args: {
425
+ action: "getDirections",
426
+ origin: "Tokyo Station",
427
+ destination: "Shibuya Station",
428
+ travelMode: "TRANSIT"
429
+ }
430
+ },
431
+ {
432
+ name: "Walking directions",
433
+ args: {
434
+ action: "getDirections",
435
+ origin: "Shinjuku Station",
436
+ destination: "Tokyo Metropolitan Government Building",
437
+ travelMode: "WALKING"
438
+ }
439
+ },
440
+ {
441
+ name: "Driving directions",
442
+ args: {
443
+ action: "getDirections",
444
+ origin: "Narita Airport",
445
+ destination: "Tokyo Station",
446
+ travelMode: "DRIVING"
447
+ }
448
+ }
449
+ ];
450
+ export {
451
+ c as TOOL_DEFINITION,
452
+ s as TOOL_NAME,
453
+ w as executeMap,
454
+ i as executeMapControl,
455
+ k as pluginCore,
456
+ _ as samples,
457
+ y as systemPrompt
458
+ };
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./core.cjs");exports.TOOL_DEFINITION=e.TOOL_DEFINITION;exports.TOOL_NAME=e.TOOL_NAME;exports.executeMap=e.executeMap;exports.executeMapControl=e.executeMapControl;exports.pluginCore=e.pluginCore;exports.samples=e.samples;exports.systemPrompt=e.systemPrompt;
@@ -0,0 +1,2 @@
1
+ export * from "./core";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import { TOOL_DEFINITION as p, TOOL_NAME as t, executeMap as r, executeMapControl as O, pluginCore as m, samples as s, systemPrompt as a } from "./core.js";
2
+ export {
3
+ p as TOOL_DEFINITION,
4
+ t as TOOL_NAME,
5
+ r as executeMap,
6
+ O as executeMapControl,
7
+ m as pluginCore,
8
+ s as samples,
9
+ a as systemPrompt
10
+ };
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-100:oklch(93.6% .032 17.717);--color-red-300:oklch(80.8% .114 19.571);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-orange-50:oklch(98% .016 73.684);--color-orange-600:oklch(64.6% .222 41.116);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-600:oklch(66.6% .179 58.318);--color-yellow-50:oklch(98.7% .026 102.212);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-700:oklch(55.4% .135 66.442);--color-green-50:oklch(98.2% .018 155.826);--color-green-600:oklch(62.7% .194 149.214);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-800:oklch(43.2% .095 166.913);--color-blue-50:oklch(97% .014 254.604);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-purple-50:oklch(97.7% .014 308.299);--color-purple-600:oklch(55.8% .288 302.321);--color-slate-900:oklch(20.8% .042 265.755);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--container-6xl:72rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-md:.375rem;--radius-lg:.5rem;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.absolute{position:absolute}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.top-4{top:calc(var(--spacing)*4)}.right-4{right:calc(var(--spacing)*4)}.bottom-4{bottom:calc(var(--spacing)*4)}.left-4{left:calc(var(--spacing)*4)}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.m-0{margin:calc(var(--spacing)*0)}.mx-auto{margin-inline:auto}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mr-1{margin-right:calc(var(--spacing)*1)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.inline-block{display:inline-block}.h-4{height:calc(var(--spacing)*4)}.h-8{height:calc(var(--spacing)*8)}.h-96{height:calc(var(--spacing)*96)}.h-\[600px\]{height:600px}.h-full{height:100%}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-screen{min-height:100vh}.w-4{width:calc(var(--spacing)*4)}.w-8{width:calc(var(--spacing)*8)}.w-24{width:calc(var(--spacing)*24)}.w-80{width:calc(var(--spacing)*80)}.w-\[100px\]{width:100px}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-\[85\%\]{max-width:85%}.max-w-\[200px\]{max-width:200px}.flex-1{flex:1}.animate-pulse{animation:var(--animate-pulse)}.cursor-pointer{cursor:pointer}.resize-y{resize:vertical}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-none{--tw-border-style:none;border-style:none}.border-emerald-200{border-color:var(--color-emerald-200)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-indigo-200{border-color:var(--color-indigo-200)}.border-red-300{border-color:var(--color-red-300)}.bg-\[\#1a1a2e\]{background-color:#1a1a2e}.bg-amber-50{background-color:var(--color-amber-50)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-green-50{background-color:var(--color-green-50)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-orange-50{background-color:var(--color-orange-50)}.bg-purple-50{background-color:var(--color-purple-50)}.bg-red-100{background-color:var(--color-red-100)}.bg-slate-900{background-color:var(--color-slate-900)}.bg-white{background-color:var(--color-white)}.bg-yellow-50{background-color:var(--color-yellow-50)}.p-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-8{padding:calc(var(--spacing)*8)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-600{color:var(--color-amber-600)}.text-blue-600{color:var(--color-blue-600)}.text-emerald-800{color:var(--color-emerald-800)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-green-600{color:var(--color-green-600)}.text-indigo-600{color:var(--color-indigo-600)}.text-indigo-700{color:var(--color-indigo-700)}.text-orange-600{color:var(--color-orange-600)}.text-purple-600{color:var(--color-purple-600)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-white{color:var(--color-white)}.text-yellow-500{color:var(--color-yellow-500)}.text-yellow-700{color:var(--color-yellow-700)}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media(hover:hover){.hover\:border-indigo-300:hover{border-color:var(--color-indigo-300)}.hover\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\:bg-gray-300:hover{background-color:var(--color-gray-300)}.hover\:bg-indigo-200:hover{background-color:var(--color-indigo-200)}.hover\:bg-indigo-700:hover{background-color:var(--color-indigo-700)}}.focus\:border-indigo-500:focus{border-color:var(--color-indigo-500)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-\[3px\]:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-indigo-500:focus{--tw-ring-color:var(--color-indigo-500)}.focus\:ring-indigo-500\/10:focus{--tw-ring-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.focus\:ring-indigo-500\/10:focus{--tw-ring-color:color-mix(in oklab,var(--color-indigo-500)10%,transparent)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-gray-100:disabled{background-color:var(--color-gray-100)}.disabled\:bg-gray-400:disabled{background-color:var(--color-gray-400)}@media(min-width:64rem){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@keyframes pulse{50%{opacity:.5}}
@@ -0,0 +1,9 @@
1
+ import type { ToolResult } from "gui-chat-protocol";
2
+ import type { MapToolData } from "../core/types";
3
+ type __VLS_Props = {
4
+ result: ToolResult<MapToolData>;
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
9
+ //# sourceMappingURL=Preview.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Preview.vue.d.ts","sourceRoot":"","sources":["../../src/vue/Preview.vue"],"names":[],"mappings":"AA+FA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAU,MAAM,eAAe,CAAC;AAEzD,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;CACjC,CAAC;AA2HF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -0,0 +1,11 @@
1
+ import type { ToolResult } from "gui-chat-protocol";
2
+ import type { MapToolData, MapJsonData } from "../core/types";
3
+ type __VLS_Props = {
4
+ selectedResult: ToolResult<MapToolData> | null;
5
+ googleMapKey?: string | null;
6
+ onUpdateResult?: (jsonData: MapJsonData) => void;
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
11
+ //# sourceMappingURL=View.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"View.vue.d.ts","sourceRoot":"","sources":["../../src/vue/View.vue"],"names":[],"mappings":"AA8pBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EAKZ,MAAM,eAAe,CAAC;AAEvB,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;IAC/C,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,KAAK,IAAI,CAAC;CAClD,CAAC;AAq3BF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -0,0 +1,15 @@
1
+ import "../style.css";
2
+ import type { ToolPlugin } from "gui-chat-protocol/vue";
3
+ import type { MapToolData, MapJsonData, MapArgs } from "../core/types";
4
+ import View from "./View.vue";
5
+ import Preview from "./Preview.vue";
6
+ export declare const plugin: ToolPlugin<MapToolData, MapJsonData, MapArgs>;
7
+ export type { MapToolData, MapJsonData, MapArgs, MapAction, PlaceType, TravelMode, LatLng, MarkerData, PlaceResult, DirectionRoute, DirectionStep, } from "../core/types";
8
+ export { TOOL_NAME, TOOL_DEFINITION, executeMap, pluginCore, } from "../core/plugin";
9
+ export { samples } from "../core/samples";
10
+ export { View, Preview };
11
+ declare const _default: {
12
+ plugin: ToolPlugin<MapToolData, MapJsonData, MapArgs, import("gui-chat-protocol/vue").InputHandler, Record<string, unknown>>;
13
+ };
14
+ export default _default;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vue/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGvE,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,OAAO,MAAM,eAAe,CAAC;AAEpC,eAAO,MAAM,MAAM,EAAE,UAAU,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAKhE,CAAC;AAEF,YAAY,EACV,WAAW,EACX,WAAW,EACX,OAAO,EACP,SAAS,EACT,SAAS,EACT,UAAU,EACV,MAAM,EACN,UAAU,EACV,WAAW,EACX,cAAc,EACd,aAAa,GACd,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,SAAS,EACT,eAAe,EACf,UAAU,EACV,UAAU,GACX,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;;;AAEzB,wBAA0B"}
package/dist/vue.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("./core.cjs"),e=require("vue"),W={class:"w-full h-full bg-white flex flex-col relative"},J={class:"p-4 border-b border-gray-200"},X={class:"text-xl font-bold text-gray-800"},Y={key:0,class:"text-gray-600 text-sm"},ee={class:"flex-1 min-h-0 flex"},te={class:"flex-1 relative"},oe={key:1,class:"w-full h-full flex items-center justify-center bg-gray-100"},re={class:"text-center p-8"},ne=["href"],ae={key:2,class:"absolute inset-0 bg-white bg-opacity-75 flex items-center justify-center"},se={key:3,class:"absolute bottom-4 left-4 right-4 bg-red-100 border border-red-300 text-red-700 px-4 py-3 rounded"},le={key:4,class:"absolute top-4 right-4 flex flex-col gap-1"},ce={key:0,class:"w-80 border-l border-gray-200 overflow-y-auto"},ie={key:0,class:"p-4"},ue={class:"space-y-3"},de=["onClick"],me={class:"font-medium text-gray-800"},ge={class:"text-sm text-gray-600 mt-1"},pe={key:0,class:"flex items-center mt-1"},ve={class:"text-sm text-gray-600"},fe={key:0,class:"text-gray-400"},ye={key:1,class:"p-4"},ke={class:"bg-blue-50 rounded-lg p-3 mb-4"},he={class:"text-lg font-medium text-gray-800"},we={class:"text-gray-600"},be={class:"text-sm text-gray-600 mb-3"},xe={class:"space-y-2"},_e=["innerHTML"],Ee={class:"text-gray-500 mt-1"},Z=e.defineComponent({__name:"View",props:{selectedResult:{},googleMapKey:{},onUpdateResult:{type:Function}},setup(w){const c=w,k=e.ref(null),a=e.ref(null),v=e.ref(new Map),b=e.ref(null),x=e.ref(null),n=e.ref(null),g=e.ref(null),_=e.ref(!1),E=e.ref(null),h=e.ref([]),m=e.ref(null),C=e.ref(null),M=e.ref(15),z=e.computed(()=>{const t=c.selectedResult?.data?.action;return{showLocation:"Map Location",setCenter:"Map View",setZoom:"Map View",addMarker:"Map Marker",clearMarkers:"Map",findPlaces:"Place Search",getDirections:"Directions"}[t||"showLocation"]||"Map"}),B=e.computed(()=>{const t=c.selectedResult?.data;if(!t)return"";switch(t.action){case"showLocation":case"setCenter":case"addMarker":return S(t.location);case"setZoom":return`Zoom level: ${t.zoom}`;case"findPlaces":return t.searchQuery||t.placeType||"";case"getDirections":return`${t.origin} → ${t.destination}`;default:return""}}),A=e.computed(()=>h.value.length>0||m.value!==null),D=e.computed(()=>{const t=c.selectedResult?.data;if(!t?.location)return"";const o=S(t.location);return`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(o)}`}),S=t=>t?typeof t=="string"?t:`${t.lat}, ${t.lng}`:"",F=()=>{const t=[];return v.value.forEach((o,r)=>{const s=o.getPosition();s&&t.push({id:r,position:{lat:s.lat(),lng:s.lng()},title:o.getTitle()||void 0,label:typeof o.getLabel()=="string"?o.getLabel():o.getLabel()?.text})}),t},p=(t,o,r)=>{if(!c.onUpdateResult)return;const i={action:c.selectedResult?.data?.action||"showLocation",success:t,center:C.value||void 0,zoom:M.value,markers:F(),...r};o&&(i.error=o),c.onUpdateResult(i)},q=()=>new Promise((t,o)=>{if(typeof google<"u"&&google.maps){t();return}const r=document.querySelector('script[src*="maps.googleapis.com"]');if(r){r.addEventListener("load",()=>t()),r.addEventListener("error",()=>o(new Error("Failed to load Google Maps")));return}const s=document.createElement("script");s.src=`https://maps.googleapis.com/maps/api/js?key=${c.googleMapKey}&libraries=places`,s.async=!0,s.defer=!0,s.onload=()=>t(),s.onerror=()=>o(new Error("Failed to load Google Maps")),document.head.appendChild(s)}),K=async()=>{if(!(!k.value||!c.googleMapKey))try{await q();const t={lat:35.6812,lng:139.7671};a.value=new google.maps.Map(k.value,{center:t,zoom:M.value,mapTypeControl:!0,streetViewControl:!0,fullscreenControl:!0}),g.value=new google.maps.Geocoder,b.value=new google.maps.places.PlacesService(a.value),x.value=new google.maps.DirectionsService,n.value=new google.maps.DirectionsRenderer,n.value.setMap(a.value),a.value.addListener("center_changed",()=>{const o=a.value?.getCenter();o&&(C.value={lat:o.lat(),lng:o.lng()})}),a.value.addListener("zoom_changed",()=>{M.value=a.value?.getZoom()||15}),c.selectedResult?.data&&await O(c.selectedResult.data)}catch(t){E.value=t instanceof Error?t.message:"Failed to initialize map"}},P=async t=>typeof t!="string"?t:g.value?new Promise(o=>{g.value.geocode({address:t},(r,s)=>{if(s==="OK"&&r&&r[0]){const i=r[0].geometry.location;o({lat:i.lat(),lng:i.lng()})}else o(null)})}):null,V=(t,o,r,s)=>{const i=new google.maps.Marker({position:t,map:a.value,title:r,label:s?{text:s,color:"white"}:void 0,animation:google.maps.Animation.DROP});return v.value.set(o,i),i},R=()=>{v.value.forEach(t=>{t.setMap(null)}),v.value.clear()},O=async t=>{if(a.value){_.value=!0,E.value=null;try{switch(t.action){case"showLocation":case"setCenter":{if(!t.location)throw new Error("Location is required");const o=await P(t.location);if(!o)throw new Error("Could not find location");if(a.value.setCenter(o),C.value=o,t.action==="showLocation"){const r=`location_${Date.now()}`;V(o,r,typeof t.location=="string"?t.location:void 0)}p(!0);break}case"setZoom":{const o=t.zoom||15;a.value.setZoom(o),M.value=o,p(!0);break}case"addMarker":{if(!t.location)throw new Error("Location is required for marker");const o=await P(t.location);if(!o)throw new Error("Could not find location for marker");const r=t.marker?.id||`marker_${Date.now()}`;V(o,r,t.marker?.title,t.marker?.label),p(!0);break}case"clearMarkers":{R(),n.value?.setDirections({routes:[],request:{}}),h.value=[],m.value=null,p(!0);break}case"findPlaces":{await G(t.searchQuery,t.placeType);break}case"getDirections":{if(!t.origin||!t.destination)throw new Error("Origin and destination are required");await j(t.origin,t.destination,t.travelMode||"DRIVING");break}}}catch(o){const r=o instanceof Error?o.message:"An error occurred";E.value=r,p(!1,r)}finally{_.value=!1}}},G=async(t,o)=>{if(!b.value||!a.value)return;const r=a.value.getCenter();if(!r)return;const s={location:r,radius:5e3,query:t||o||""};return o&&!t&&(s.type=o),new Promise(i=>{b.value.textSearch(s,(f,L)=>{if(L===google.maps.places.PlacesServiceStatus.OK&&f){v.value.forEach((l,d)=>{d.startsWith("place_")&&(l.setMap(null),v.value.delete(d))});const u=f.slice(0,10).map((l,d)=>{const N=l.geometry?.location,T=N?{lat:N.lat(),lng:N.lng()}:{lat:0,lng:0};return N&&V(T,`place_${l.place_id}`,l.name,String(d+1)),{placeId:l.place_id||"",name:l.name||"",address:l.formatted_address||"",location:T,rating:l.rating,userRatingsTotal:l.user_ratings_total,types:l.types,openNow:l.opening_hours?.isOpen?.()}});if(h.value=u,m.value=null,u.length>0){const l=new google.maps.LatLngBounds;u.forEach(d=>{l.extend(d.location)}),a.value?.fitBounds(l)}p(!0,void 0,{places:u})}else p(!1,"No places found");i()})})},j=async(t,o,r)=>{if(!x.value||!n.value)return;const s={origin:t,destination:o,travelMode:r};return new Promise(i=>{x.value.route(s,(f,L)=>{if(L===google.maps.DirectionsStatus.OK&&f){n.value.setDirections(f);const u=f.routes[0]?.legs[0];if(u){const l={summary:f.routes[0].summary||"",distance:u.distance?.text||"",duration:u.duration?.text||"",startAddress:u.start_address||"",endAddress:u.end_address||"",steps:u.steps?.map(d=>({instruction:d.instructions||"",distance:d.distance?.text||"",duration:d.duration?.text||"",travelMode:d.travel_mode||""}))||[],polyline:f.routes[0].overview_polyline||""};m.value=l,h.value=[],p(!0,void 0,{route:l})}}else p(!1,"Could not find directions");i()})})},U=t=>{a.value&&(a.value.setCenter(t.location),a.value.setZoom(17))},Q=()=>{if(!a.value)return;const t=a.value.getZoom()||15;t<21&&a.value.setZoom(t+1)},H=()=>{if(!a.value)return;const t=a.value.getZoom()||15;t>1&&a.value.setZoom(t-1)};return e.watch(()=>c.selectedResult?.data,async t=>{t&&a.value&&await O(t)}),e.onMounted(()=>{c.googleMapKey&&K()}),e.onUnmounted(()=>{R()}),(t,o)=>(e.openBlock(),e.createElementBlock("div",W,[e.createElementVNode("div",J,[e.createElementVNode("h2",X,e.toDisplayString(z.value),1),B.value?(e.openBlock(),e.createElementBlock("p",Y,e.toDisplayString(B.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",ee,[e.createElementVNode("div",te,[w.googleMapKey?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"mapContainer",ref:k,class:"w-full h-full"},null,512)):(e.openBlock(),e.createElementBlock("div",oe,[e.createElementVNode("div",re,[o[0]||(o[0]=e.createElementVNode("div",{class:"text-gray-500 mb-4"},"Google Maps API key not configured",-1)),D.value?(e.openBlock(),e.createElementBlock("a",{key:0,href:D.value,target:"_blank",class:"inline-block px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors"}," Open in Google Maps ",8,ne)):e.createCommentVNode("",!0)])])),_.value?(e.openBlock(),e.createElementBlock("div",ae,[...o[1]||(o[1]=[e.createElementVNode("div",{class:"text-gray-600"},"Loading...",-1)])])):e.createCommentVNode("",!0),E.value?(e.openBlock(),e.createElementBlock("div",se,e.toDisplayString(E.value),1)):e.createCommentVNode("",!0),w.googleMapKey&&a.value?(e.openBlock(),e.createElementBlock("div",le,[e.createElementVNode("button",{onClick:Q,class:"w-8 h-8 bg-white border border-gray-300 rounded shadow text-lg font-bold text-gray-700 hover:bg-gray-100 flex items-center justify-center",title:"Zoom in"}," + "),e.createElementVNode("button",{onClick:H,class:"w-8 h-8 bg-white border border-gray-300 rounded shadow text-lg font-bold text-gray-700 hover:bg-gray-100 flex items-center justify-center",title:"Zoom out"}," − ")])):e.createCommentVNode("",!0)]),A.value?(e.openBlock(),e.createElementBlock("div",ce,[h.value.length>0?(e.openBlock(),e.createElementBlock("div",ie,[o[3]||(o[3]=e.createElementVNode("h3",{class:"font-semibold text-gray-800 mb-3"},"Search Results",-1)),e.createElementVNode("div",ue,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,r=>(e.openBlock(),e.createElementBlock("div",{key:r.placeId,class:"p-3 bg-gray-50 rounded-lg cursor-pointer hover:bg-gray-100 transition-colors",onClick:s=>U(r)},[e.createElementVNode("div",me,e.toDisplayString(r.name),1),e.createElementVNode("div",ge,e.toDisplayString(r.address),1),r.rating?(e.openBlock(),e.createElementBlock("div",pe,[o[2]||(o[2]=e.createElementVNode("span",{class:"text-yellow-500 mr-1"},"★",-1)),e.createElementVNode("span",ve,[e.createTextVNode(e.toDisplayString(r.rating.toFixed(1))+" ",1),r.userRatingsTotal?(e.openBlock(),e.createElementBlock("span",fe," ("+e.toDisplayString(r.userRatingsTotal)+") ",1)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),r.openNow!==void 0?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass([r.openNow?"text-green-600":"text-red-600","text-sm mt-1"])},e.toDisplayString(r.openNow?"Open now":"Closed"),3)):e.createCommentVNode("",!0)],8,de))),128))])])):e.createCommentVNode("",!0),m.value?(e.openBlock(),e.createElementBlock("div",ye,[o[6]||(o[6]=e.createElementVNode("h3",{class:"font-semibold text-gray-800 mb-3"},"Directions",-1)),e.createElementVNode("div",ke,[e.createElementVNode("div",he,e.toDisplayString(m.value.distance),1),e.createElementVNode("div",we,e.toDisplayString(m.value.duration),1)]),e.createElementVNode("div",be,[e.createElementVNode("div",null,[o[4]||(o[4]=e.createElementVNode("strong",null,"From:",-1)),e.createTextVNode(" "+e.toDisplayString(m.value.startAddress),1)]),e.createElementVNode("div",null,[o[5]||(o[5]=e.createElementVNode("strong",null,"To:",-1)),e.createTextVNode(" "+e.toDisplayString(m.value.endAddress),1)])]),e.createElementVNode("div",xe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value.steps,(r,s)=>(e.openBlock(),e.createElementBlock("div",{key:s,class:"p-2 bg-gray-50 rounded text-sm"},[e.createElementVNode("div",{innerHTML:r.instruction,class:"text-gray-800"},null,8,_e),e.createElementVNode("div",Ee,e.toDisplayString(r.distance)+" · "+e.toDisplayString(r.duration),1)]))),128))])])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])]))}}),Me={class:"text-xs text-gray-600 mt-1 truncate"},$=e.defineComponent({__name:"Preview",props:{result:{}},setup(w){const c=w,k=n=>n?typeof n=="string"?n:`${n.lat.toFixed(4)}, ${n.lng.toFixed(4)}`:"",a=e.computed(()=>{const n=c.result.data?.action;return{showLocation:"Map Location",setCenter:"Center Map",setZoom:"Zoom",addMarker:"Add Marker",clearMarkers:"Clear Markers",findPlaces:"Place Search",getDirections:"Directions"}[n||"showLocation"]||"Map"}),v=e.computed(()=>{const n=c.result.data;if(!n)return"";switch(n.action){case"showLocation":case"setCenter":case"addMarker":return k(n.location);case"setZoom":return`Level ${n.zoom}`;case"clearMarkers":return"All markers cleared";case"findPlaces":return n.searchQuery||n.placeType||"Search";case"getDirections":{const g=typeof n.origin=="string"?n.origin:"Start",_=typeof n.destination=="string"?n.destination:"End";return`${g} → ${_}`}default:return k(n.location)}}),b=e.computed(()=>{const n=c.result.data?.action;return{showLocation:"bg-blue-50",setCenter:"bg-blue-50",setZoom:"bg-purple-50",addMarker:"bg-green-50",clearMarkers:"bg-gray-50",findPlaces:"bg-yellow-50",getDirections:"bg-orange-50"}[n||"showLocation"]||"bg-blue-50"}),x=e.computed(()=>{const n=c.result.data?.action;return{showLocation:"text-blue-600",setCenter:"text-blue-600",setZoom:"text-purple-600",addMarker:"text-green-600",clearMarkers:"text-gray-600",findPlaces:"text-yellow-700",getDirections:"text-orange-600"}[n||"showLocation"]||"text-blue-600"});return(n,g)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["text-center p-4 rounded",b.value])},[e.createElementVNode("div",{class:e.normalizeClass(["font-medium",x.value])},e.toDisplayString(a.value),3),e.createElementVNode("div",Me,e.toDisplayString(v.value),1)],2))}}),I={...y.pluginCore,viewComponent:Z,previewComponent:$,samples:y.samples},Ne={plugin:I};exports.TOOL_DEFINITION=y.TOOL_DEFINITION;exports.TOOL_NAME=y.TOOL_NAME;exports.executeMap=y.executeMap;exports.pluginCore=y.pluginCore;exports.samples=y.samples;exports.Preview=$;exports.View=Z;exports.default=Ne;exports.plugin=I;