google-adk 1.5.0__py3-none-any.whl → 1.6.1__py3-none-any.whl

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 (60) hide show
  1. google/adk/a2a/converters/event_converter.py +257 -36
  2. google/adk/a2a/converters/part_converter.py +93 -25
  3. google/adk/a2a/converters/request_converter.py +12 -32
  4. google/adk/a2a/converters/utils.py +22 -4
  5. google/adk/a2a/executor/__init__.py +13 -0
  6. google/adk/a2a/executor/a2a_agent_executor.py +260 -0
  7. google/adk/a2a/executor/task_result_aggregator.py +71 -0
  8. google/adk/a2a/logs/__init__.py +13 -0
  9. google/adk/a2a/logs/log_utils.py +349 -0
  10. google/adk/agents/base_agent.py +54 -0
  11. google/adk/agents/llm_agent.py +15 -0
  12. google/adk/agents/remote_a2a_agent.py +532 -0
  13. google/adk/artifacts/in_memory_artifact_service.py +6 -3
  14. google/adk/cli/browser/chunk-EQDQRRRY.js +1 -0
  15. google/adk/cli/browser/chunk-TXJFAAIW.js +2 -0
  16. google/adk/cli/browser/index.html +4 -3
  17. google/adk/cli/browser/main-RXDVX3K6.js +3914 -0
  18. google/adk/cli/browser/polyfills-FFHMD2TL.js +17 -0
  19. google/adk/cli/cli_deploy.py +4 -1
  20. google/adk/cli/cli_eval.py +8 -6
  21. google/adk/cli/cli_tools_click.py +30 -10
  22. google/adk/cli/fast_api.py +120 -5
  23. google/adk/cli/utils/agent_loader.py +12 -0
  24. google/adk/evaluation/agent_evaluator.py +107 -10
  25. google/adk/evaluation/base_eval_service.py +157 -0
  26. google/adk/evaluation/constants.py +20 -0
  27. google/adk/evaluation/eval_case.py +3 -3
  28. google/adk/evaluation/eval_metrics.py +39 -0
  29. google/adk/evaluation/evaluation_generator.py +1 -1
  30. google/adk/evaluation/final_response_match_v2.py +230 -0
  31. google/adk/evaluation/llm_as_judge.py +141 -0
  32. google/adk/evaluation/llm_as_judge_utils.py +48 -0
  33. google/adk/evaluation/metric_evaluator_registry.py +89 -0
  34. google/adk/evaluation/response_evaluator.py +38 -211
  35. google/adk/evaluation/safety_evaluator.py +54 -0
  36. google/adk/evaluation/trajectory_evaluator.py +16 -2
  37. google/adk/evaluation/vertex_ai_eval_facade.py +147 -0
  38. google/adk/events/event.py +2 -4
  39. google/adk/flows/llm_flows/base_llm_flow.py +2 -0
  40. google/adk/memory/in_memory_memory_service.py +3 -2
  41. google/adk/models/lite_llm.py +50 -10
  42. google/adk/runners.py +27 -10
  43. google/adk/sessions/database_session_service.py +25 -7
  44. google/adk/sessions/in_memory_session_service.py +5 -1
  45. google/adk/sessions/vertex_ai_session_service.py +67 -42
  46. google/adk/tools/bigquery/config.py +11 -1
  47. google/adk/tools/bigquery/query_tool.py +306 -12
  48. google/adk/tools/enterprise_search_tool.py +2 -2
  49. google/adk/tools/function_tool.py +7 -1
  50. google/adk/tools/google_search_tool.py +1 -1
  51. google/adk/tools/mcp_tool/mcp_session_manager.py +44 -30
  52. google/adk/tools/mcp_tool/mcp_tool.py +44 -7
  53. google/adk/version.py +1 -1
  54. {google_adk-1.5.0.dist-info → google_adk-1.6.1.dist-info}/METADATA +6 -4
  55. {google_adk-1.5.0.dist-info → google_adk-1.6.1.dist-info}/RECORD +58 -42
  56. google/adk/cli/browser/main-JAAWEV7F.js +0 -92
  57. google/adk/cli/browser/polyfills-B6TNHZQ6.js +0 -17
  58. {google_adk-1.5.0.dist-info → google_adk-1.6.1.dist-info}/WHEEL +0 -0
  59. {google_adk-1.5.0.dist-info → google_adk-1.6.1.dist-info}/entry_points.txt +0 -0
  60. {google_adk-1.5.0.dist-info → google_adk-1.6.1.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,532 @@
1
+ # Copyright 2025 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import logging
19
+ from pathlib import Path
20
+ from typing import Any
21
+ from typing import AsyncGenerator
22
+ from typing import Optional
23
+ from typing import Union
24
+ from urllib.parse import urlparse
25
+ import uuid
26
+
27
+ try:
28
+ from a2a.client import A2AClient
29
+ from a2a.client.client import A2ACardResolver # Import A2ACardResolver
30
+ from a2a.types import AgentCard
31
+ from a2a.types import Message as A2AMessage
32
+ from a2a.types import MessageSendParams as A2AMessageSendParams
33
+ from a2a.types import Part as A2APart
34
+ from a2a.types import Role
35
+ from a2a.types import SendMessageRequest
36
+ from a2a.types import SendMessageSuccessResponse
37
+ from a2a.types import Task as A2ATask
38
+
39
+ except ImportError as e:
40
+ import sys
41
+
42
+ if sys.version_info < (3, 10):
43
+ raise ImportError(
44
+ "A2A requires Python 3.10 or above. Please upgrade your Python version."
45
+ ) from e
46
+ else:
47
+ raise e
48
+
49
+ from google.genai import types as genai_types
50
+ import httpx
51
+
52
+ from ..a2a.converters.event_converter import convert_a2a_message_to_event
53
+ from ..a2a.converters.event_converter import convert_a2a_task_to_event
54
+ from ..a2a.converters.event_converter import convert_event_to_a2a_message
55
+ from ..a2a.converters.part_converter import convert_genai_part_to_a2a_part
56
+ from ..a2a.logs.log_utils import build_a2a_request_log
57
+ from ..a2a.logs.log_utils import build_a2a_response_log
58
+ from ..agents.invocation_context import InvocationContext
59
+ from ..events.event import Event
60
+ from ..flows.llm_flows.contents import _convert_foreign_event
61
+ from ..flows.llm_flows.contents import _is_other_agent_reply
62
+ from ..flows.llm_flows.functions import find_matching_function_call
63
+ from ..utils.feature_decorator import experimental
64
+ from .base_agent import BaseAgent
65
+
66
+ # Constants
67
+ A2A_METADATA_PREFIX = "a2a:"
68
+ DEFAULT_TIMEOUT = 600.0
69
+
70
+
71
+ logger = logging.getLogger("google_adk." + __name__)
72
+
73
+
74
+ @experimental
75
+ class AgentCardResolutionError(Exception):
76
+ """Raised when agent card resolution fails."""
77
+
78
+ pass
79
+
80
+
81
+ @experimental
82
+ class A2AClientError(Exception):
83
+ """Raised when A2A client operations fail."""
84
+
85
+ pass
86
+
87
+
88
+ @experimental
89
+ class RemoteA2aAgent(BaseAgent):
90
+ """Agent that communicates with a remote A2A agent via A2A client.
91
+
92
+ This agent supports multiple ways to specify the remote agent:
93
+ 1. Direct AgentCard object
94
+ 2. URL to agent card JSON
95
+ 3. File path to agent card JSON
96
+
97
+ The agent handles:
98
+ - Agent card resolution and validation
99
+ - HTTP client management with proper resource cleanup
100
+ - A2A message conversion and error handling
101
+ - Session state management across requests
102
+ """
103
+
104
+ def __init__(
105
+ self,
106
+ name: str,
107
+ agent_card: Union[AgentCard, str],
108
+ description: str = "",
109
+ httpx_client: Optional[httpx.AsyncClient] = None,
110
+ timeout: float = DEFAULT_TIMEOUT,
111
+ **kwargs: Any,
112
+ ) -> None:
113
+ """Initialize RemoteA2aAgent.
114
+
115
+ Args:
116
+ name: Agent name (must be unique identifier)
117
+ agent_card: AgentCard object, URL string, or file path string
118
+ description: Agent description (auto-populated from card if empty)
119
+ httpx_client: Optional shared HTTP client (will create own if not provided)
120
+ timeout: HTTP timeout in seconds
121
+ **kwargs: Additional arguments passed to BaseAgent
122
+
123
+ Raises:
124
+ ValueError: If name is invalid or agent_card is None
125
+ TypeError: If agent_card is not a supported type
126
+ """
127
+ super().__init__(name=name, description=description, **kwargs)
128
+
129
+ if agent_card is None:
130
+ raise ValueError("agent_card cannot be None")
131
+
132
+ self._agent_card: Optional[AgentCard] = None
133
+ self._agent_card_source: Optional[str] = None
134
+ self._rpc_url: Optional[str] = None
135
+ self._a2a_client: Optional[A2AClient] = None
136
+ self._httpx_client = httpx_client
137
+ self._httpx_client_needs_cleanup = httpx_client is None
138
+ self._timeout = timeout
139
+ self._is_resolved = False
140
+
141
+ # Validate and store agent card reference
142
+ if isinstance(agent_card, AgentCard):
143
+ self._agent_card = agent_card
144
+ elif isinstance(agent_card, str):
145
+ if not agent_card.strip():
146
+ raise ValueError("agent_card string cannot be empty")
147
+ self._agent_card_source = agent_card.strip()
148
+ else:
149
+ raise TypeError(
150
+ "agent_card must be AgentCard, URL string, or file path string, "
151
+ f"got {type(agent_card)}"
152
+ )
153
+
154
+ async def _ensure_httpx_client(self) -> httpx.AsyncClient:
155
+ """Ensure HTTP client is available and properly configured."""
156
+ if not self._httpx_client:
157
+ self._httpx_client = httpx.AsyncClient(
158
+ timeout=httpx.Timeout(timeout=self._timeout)
159
+ )
160
+ self._httpx_client_needs_cleanup = True
161
+ return self._httpx_client
162
+
163
+ async def _resolve_agent_card_from_url(self, url: str) -> AgentCard:
164
+ """Resolve agent card from URL."""
165
+ try:
166
+ parsed_url = urlparse(url)
167
+ if not parsed_url.scheme or not parsed_url.netloc:
168
+ raise ValueError(f"Invalid URL format: {url}")
169
+
170
+ base_url = f"{parsed_url.scheme}://{parsed_url.netloc}"
171
+ relative_card_path = parsed_url.path
172
+
173
+ httpx_client = await self._ensure_httpx_client()
174
+ resolver = A2ACardResolver(
175
+ httpx_client=httpx_client,
176
+ base_url=base_url,
177
+ )
178
+ return await resolver.get_agent_card(
179
+ relative_card_path=relative_card_path
180
+ )
181
+ except Exception as e:
182
+ raise AgentCardResolutionError(
183
+ f"Failed to resolve AgentCard from URL {url}: {e}"
184
+ ) from e
185
+
186
+ async def _resolve_agent_card_from_file(self, file_path: str) -> AgentCard:
187
+ """Resolve agent card from file path."""
188
+ try:
189
+ path = Path(file_path)
190
+ if not path.exists():
191
+ raise FileNotFoundError(f"Agent card file not found: {file_path}")
192
+ if not path.is_file():
193
+ raise ValueError(f"Path is not a file: {file_path}")
194
+
195
+ with path.open("r", encoding="utf-8") as f:
196
+ agent_json_data = json.load(f)
197
+ return AgentCard(**agent_json_data)
198
+ except json.JSONDecodeError as e:
199
+ raise AgentCardResolutionError(
200
+ f"Invalid JSON in agent card file {file_path}: {e}"
201
+ ) from e
202
+ except Exception as e:
203
+ raise AgentCardResolutionError(
204
+ f"Failed to resolve AgentCard from file {file_path}: {e}"
205
+ ) from e
206
+
207
+ async def _resolve_agent_card(self) -> AgentCard:
208
+ """Resolve agent card from source."""
209
+
210
+ # Determine if source is URL or file path
211
+ if self._agent_card_source.startswith(("http://", "https://")):
212
+ return await self._resolve_agent_card_from_url(self._agent_card_source)
213
+ else:
214
+ return await self._resolve_agent_card_from_file(self._agent_card_source)
215
+
216
+ async def _validate_agent_card(self, agent_card: AgentCard) -> None:
217
+ """Validate resolved agent card."""
218
+ if not agent_card.url:
219
+ raise AgentCardResolutionError(
220
+ "Agent card must have a valid URL for RPC communication"
221
+ )
222
+
223
+ # Additional validation can be added here
224
+ try:
225
+ parsed_url = urlparse(str(agent_card.url))
226
+ if not parsed_url.scheme or not parsed_url.netloc:
227
+ raise ValueError("Invalid RPC URL format")
228
+ except Exception as e:
229
+ raise AgentCardResolutionError(
230
+ f"Invalid RPC URL in agent card: {agent_card.url}, error: {e}"
231
+ ) from e
232
+
233
+ async def _ensure_resolved(self) -> None:
234
+ """Ensures agent card is resolved, RPC URL is determined, and A2A client is initialized."""
235
+ if self._is_resolved:
236
+ return
237
+
238
+ try:
239
+ # Resolve agent card if needed
240
+ if not self._agent_card:
241
+ self._agent_card = await self._resolve_agent_card()
242
+
243
+ # Validate agent card
244
+ await self._validate_agent_card(self._agent_card)
245
+
246
+ # Set RPC URL
247
+ self._rpc_url = str(self._agent_card.url)
248
+
249
+ # Update description if empty
250
+ if not self.description and self._agent_card.description:
251
+ self.description = self._agent_card.description
252
+
253
+ # Initialize A2A client
254
+ if not self._a2a_client:
255
+ httpx_client = await self._ensure_httpx_client()
256
+ self._a2a_client = A2AClient(
257
+ httpx_client=httpx_client,
258
+ agent_card=self._agent_card,
259
+ url=self._rpc_url,
260
+ )
261
+
262
+ self._is_resolved = True
263
+ logger.info("Successfully resolved remote A2A agent: %s", self.name)
264
+
265
+ except Exception as e:
266
+ logger.error("Failed to resolve remote A2A agent %s: %s", self.name, e)
267
+ raise AgentCardResolutionError(
268
+ f"Failed to initialize remote A2A agent {self.name}: {e}"
269
+ ) from e
270
+
271
+ def _create_a2a_request_for_user_function_response(
272
+ self, ctx: InvocationContext
273
+ ) -> Optional[SendMessageRequest]:
274
+ """Create A2A request for user function response if applicable.
275
+
276
+ Args:
277
+ ctx: The invocation context
278
+
279
+ Returns:
280
+ SendMessageRequest if function response found, None otherwise
281
+ """
282
+ if not ctx.session.events or ctx.session.events[-1].author != "user":
283
+ return None
284
+ function_call_event = find_matching_function_call(ctx.session.events)
285
+ if not function_call_event:
286
+ return None
287
+
288
+ a2a_message = convert_event_to_a2a_message(
289
+ ctx.session.events[-1], ctx, Role.user
290
+ )
291
+ if function_call_event.custom_metadata:
292
+ a2a_message.taskId = (
293
+ function_call_event.custom_metadata.get(
294
+ A2A_METADATA_PREFIX + "task_id"
295
+ )
296
+ if function_call_event.custom_metadata
297
+ else None
298
+ )
299
+ a2a_message.contextId = (
300
+ function_call_event.custom_metadata.get(
301
+ A2A_METADATA_PREFIX + "context_id"
302
+ )
303
+ if function_call_event.custom_metadata
304
+ else None
305
+ )
306
+
307
+ return SendMessageRequest(
308
+ id=str(uuid.uuid4()),
309
+ params=A2AMessageSendParams(
310
+ message=a2a_message,
311
+ ),
312
+ )
313
+
314
+ def _construct_message_parts_from_session(
315
+ self, ctx: InvocationContext
316
+ ) -> tuple[list[A2APart], dict[str, Any], str]:
317
+ """Construct A2A message parts from session events.
318
+
319
+ Args:
320
+ ctx: The invocation context
321
+
322
+ Returns:
323
+ List of A2A parts extracted from session events, context ID
324
+ """
325
+ message_parts: list[A2APart] = []
326
+ context_id = None
327
+ for event in reversed(ctx.session.events):
328
+ if _is_other_agent_reply(self.name, event):
329
+ event = _convert_foreign_event(event)
330
+ elif event.author == self.name:
331
+ # stop on content generated by current a2a agent given it should already
332
+ # be in remote session
333
+ if event.custom_metadata:
334
+ context_id = (
335
+ event.custom_metadata.get(A2A_METADATA_PREFIX + "context_id")
336
+ if event.custom_metadata
337
+ else None
338
+ )
339
+ break
340
+
341
+ if not event.content or not event.content.parts:
342
+ continue
343
+
344
+ for part in event.content.parts:
345
+
346
+ converted_part = convert_genai_part_to_a2a_part(part)
347
+ if converted_part:
348
+ message_parts.append(converted_part)
349
+ else:
350
+ logger.warning("Failed to convert part to A2A format: %s", part)
351
+
352
+ return message_parts[::-1], context_id
353
+
354
+ async def _handle_a2a_response(
355
+ self, a2a_response: Any, ctx: InvocationContext
356
+ ) -> Event:
357
+ """Handle A2A response and convert to Event.
358
+
359
+ Args:
360
+ a2a_response: The A2A response object
361
+ ctx: The invocation context
362
+
363
+ Returns:
364
+ Event object representing the response
365
+ """
366
+ try:
367
+ if isinstance(a2a_response.root, SendMessageSuccessResponse):
368
+ if a2a_response.root.result:
369
+ if isinstance(a2a_response.root.result, A2ATask):
370
+ event = convert_a2a_task_to_event(
371
+ a2a_response.root.result, self.name, ctx
372
+ )
373
+ event.custom_metadata = event.custom_metadata or {}
374
+ event.custom_metadata[A2A_METADATA_PREFIX + "task_id"] = (
375
+ a2a_response.root.result.id
376
+ )
377
+
378
+ else:
379
+ event = convert_a2a_message_to_event(
380
+ a2a_response.root.result, self.name, ctx
381
+ )
382
+ event.custom_metadata = event.custom_metadata or {}
383
+ if a2a_response.root.result.taskId:
384
+ event.custom_metadata[A2A_METADATA_PREFIX + "task_id"] = (
385
+ a2a_response.root.result.taskId
386
+ )
387
+
388
+ if a2a_response.root.result.contextId:
389
+ event.custom_metadata[A2A_METADATA_PREFIX + "context_id"] = (
390
+ a2a_response.root.result.contextId
391
+ )
392
+
393
+ else:
394
+ logger.warning("A2A response has no result: %s", a2a_response.root)
395
+ event = Event(
396
+ author=self.name,
397
+ invocation_id=ctx.invocation_id,
398
+ branch=ctx.branch,
399
+ )
400
+ else:
401
+ # Handle error response
402
+ error_response = a2a_response.root
403
+ logger.error(
404
+ "A2A request failed with error: %s, data: %s",
405
+ error_response.error.message,
406
+ error_response.error.data,
407
+ )
408
+ event = Event(
409
+ author=self.name,
410
+ error_message=error_response.error.message,
411
+ error_code=str(error_response.error.code),
412
+ invocation_id=ctx.invocation_id,
413
+ branch=ctx.branch,
414
+ )
415
+
416
+ return event
417
+ except Exception as e:
418
+ logger.error("Failed to handle A2A response: %s", e)
419
+ return Event(
420
+ author=self.name,
421
+ error_message=f"Failed to process A2A response: {e}",
422
+ invocation_id=ctx.invocation_id,
423
+ branch=ctx.branch,
424
+ )
425
+
426
+ async def _run_async_impl(
427
+ self, ctx: InvocationContext
428
+ ) -> AsyncGenerator[Event, None]:
429
+ """Core implementation for async agent execution."""
430
+ try:
431
+ await self._ensure_resolved()
432
+ except Exception as e:
433
+ yield Event(
434
+ author=self.name,
435
+ error_message=f"Failed to initialize remote A2A agent: {e}",
436
+ invocation_id=ctx.invocation_id,
437
+ branch=ctx.branch,
438
+ )
439
+ return
440
+
441
+ # Create A2A request for function response or regular message
442
+ a2a_request = self._create_a2a_request_for_user_function_response(ctx)
443
+ if not a2a_request:
444
+ message_parts, context_id = self._construct_message_parts_from_session(
445
+ ctx
446
+ )
447
+
448
+ if not message_parts:
449
+ logger.warning(
450
+ "No parts to send to remote A2A agent. Emitting empty event."
451
+ )
452
+ yield Event(
453
+ author=self.name,
454
+ content=genai_types.Content(),
455
+ invocation_id=ctx.invocation_id,
456
+ branch=ctx.branch,
457
+ )
458
+ return
459
+
460
+ a2a_request = SendMessageRequest(
461
+ id=str(uuid.uuid4()),
462
+ params=A2AMessageSendParams(
463
+ message=A2AMessage(
464
+ messageId=str(uuid.uuid4()),
465
+ parts=message_parts,
466
+ role="user",
467
+ contextId=context_id,
468
+ )
469
+ ),
470
+ )
471
+
472
+ logger.info(build_a2a_request_log(a2a_request))
473
+
474
+ try:
475
+ a2a_response = await self._a2a_client.send_message(request=a2a_request)
476
+ logger.info(build_a2a_response_log(a2a_response))
477
+
478
+ event = await self._handle_a2a_response(a2a_response, ctx)
479
+
480
+ # Add metadata about the request and response
481
+ event.custom_metadata = event.custom_metadata or {}
482
+ event.custom_metadata[A2A_METADATA_PREFIX + "request"] = (
483
+ a2a_request.model_dump(exclude_none=True, by_alias=True)
484
+ )
485
+ event.custom_metadata[A2A_METADATA_PREFIX + "response"] = (
486
+ a2a_response.root.model_dump(exclude_none=True, by_alias=True)
487
+ )
488
+
489
+ yield event
490
+
491
+ except Exception as e:
492
+ error_message = f"A2A request failed: {e}"
493
+ logger.error(error_message)
494
+
495
+ yield Event(
496
+ author=self.name,
497
+ error_message=error_message,
498
+ invocation_id=ctx.invocation_id,
499
+ branch=ctx.branch,
500
+ custom_metadata={
501
+ A2A_METADATA_PREFIX
502
+ + "request": a2a_request.model_dump(
503
+ exclude_none=True, by_alias=True
504
+ ),
505
+ A2A_METADATA_PREFIX + "error": error_message,
506
+ },
507
+ )
508
+
509
+ async def _run_live_impl(
510
+ self, ctx: InvocationContext
511
+ ) -> AsyncGenerator[Event, None]:
512
+ """Core implementation for live agent execution (not implemented)."""
513
+ raise NotImplementedError(
514
+ f"_run_live_impl for {type(self)} via A2A is not implemented."
515
+ )
516
+ # This makes the function an async generator but the yield is still unreachable
517
+ yield
518
+
519
+ async def cleanup(self) -> None:
520
+ """Clean up resources, especially the HTTP client if owned by this agent."""
521
+ if self._httpx_client_needs_cleanup and self._httpx_client:
522
+ try:
523
+ await self._httpx_client.aclose()
524
+ logger.debug("Closed HTTP client for agent %s", self.name)
525
+ except Exception as e:
526
+ logger.warning(
527
+ "Failed to close HTTP client for agent %s: %s",
528
+ self.name,
529
+ e,
530
+ )
531
+ finally:
532
+ self._httpx_client = None
@@ -11,8 +11,7 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
-
15
- """An in-memory implementation of the artifact service."""
14
+ from __future__ import annotations
16
15
 
17
16
  import logging
18
17
  from typing import Optional
@@ -28,7 +27,11 @@ logger = logging.getLogger("google_adk." + __name__)
28
27
 
29
28
 
30
29
  class InMemoryArtifactService(BaseArtifactService, BaseModel):
31
- """An in-memory implementation of the artifact service."""
30
+ """An in-memory implementation of the artifact service.
31
+
32
+ It is not suitable for multi-threaded production environments. Use it for
33
+ testing and development only.
34
+ """
32
35
 
33
36
  artifacts: dict[str, list[types.Part]] = Field(default_factory=dict)
34
37
 
@@ -0,0 +1 @@
1
+ var p=Object.create;var j=Object.defineProperty,q=Object.defineProperties,r=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyDescriptors,t=Object.getOwnPropertyNames,g=Object.getOwnPropertySymbols,u=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty,m=Object.prototype.propertyIsEnumerable;var l=(a,b,c)=>b in a?j(a,b,{enumerable:!0,configurable:!0,writable:!0,value:c}):a[b]=c,w=(a,b)=>{for(var c in b||={})k.call(b,c)&&l(a,c,b[c]);if(g)for(var c of g(b))m.call(b,c)&&l(a,c,b[c]);return a},x=(a,b)=>q(a,s(b));var y=(a,b)=>{var c={};for(var d in a)k.call(a,d)&&b.indexOf(d)<0&&(c[d]=a[d]);if(a!=null&&g)for(var d of g(a))b.indexOf(d)<0&&m.call(a,d)&&(c[d]=a[d]);return c};var z=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var v=(a,b,c,d)=>{if(b&&typeof b=="object"||typeof b=="function")for(let e of t(b))!k.call(a,e)&&e!==c&&j(a,e,{get:()=>b[e],enumerable:!(d=r(b,e))||d.enumerable});return a};var A=(a,b,c)=>(c=a!=null?p(u(a)):{},v(b||!a||!a.__esModule?j(c,"default",{value:a,enumerable:!0}):c,a));var B=(a,b,c)=>new Promise((d,e)=>{var n=f=>{try{h(c.next(f))}catch(i){e(i)}},o=f=>{try{h(c.throw(f))}catch(i){e(i)}},h=f=>f.done?d(f.value):Promise.resolve(f.value).then(n,o);h((c=c.apply(a,b)).next())});export{w as a,x as b,y as c,z as d,A as e,B as f};
@@ -0,0 +1,2 @@
1
+ import"./chunk-EQDQRRRY.js";var O=function(l,i){if(!(l instanceof i))throw new TypeError("Cannot call a class as a function")},R=function(){function l(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,r.key,r)}}return function(i,e,t){return e&&l(i.prototype,e),t&&l(i,t),i}}(),y=function(){function l(i,e){var t=[],r=!0,n=!1,o=void 0;try{for(var c=i[Symbol.iterator](),a;!(r=(a=c.next()).done)&&(t.push(a.value),!(e&&t.length===e));r=!0);}catch(s){n=!0,o=s}finally{try{!r&&c.return&&c.return()}finally{if(n)throw o}}return t}return function(i,e){if(Array.isArray(i))return i;if(Symbol.iterator in Object(i))return l(i,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();String.prototype.startsWith=String.prototype.startsWith||function(l){return this.indexOf(l)===0};String.prototype.padStart=String.prototype.padStart||function(l,i){for(var e=this;e.length<l;)e=i+e;return e};var N={cb:"0f8ff",tqw:"aebd7",q:"-ffff",qmrn:"7fffd4",zr:"0ffff",bg:"5f5dc",bsq:"e4c4",bck:"---",nch:"ebcd",b:"--ff",bvt:"8a2be2",brwn:"a52a2a",brw:"deb887",ctb:"5f9ea0",hrt:"7fff-",chcT:"d2691e",cr:"7f50",rnw:"6495ed",crns:"8dc",crms:"dc143c",cn:"-ffff",Db:"--8b",Dcn:"-8b8b",Dgnr:"b8860b",Dgr:"a9a9a9",Dgrn:"-64-",Dkhk:"bdb76b",Dmgn:"8b-8b",Dvgr:"556b2f",Drng:"8c-",Drch:"9932cc",Dr:"8b--",Dsmn:"e9967a",Dsgr:"8fbc8f",DsTb:"483d8b",DsTg:"2f4f4f",Dtrq:"-ced1",Dvt:"94-d3",ppnk:"1493",pskb:"-bfff",mgr:"696969",grb:"1e90ff",rbrc:"b22222",rwht:"af0",stg:"228b22",chs:"-ff",gnsb:"dcdcdc",st:"8f8ff",g:"d7-",gnr:"daa520",gr:"808080",grn:"-8-0",grnw:"adff2f",hnw:"0fff0",htpn:"69b4",nnr:"cd5c5c",ng:"4b-82",vr:"0",khk:"0e68c",vnr:"e6e6fa",nrb:"0f5",wngr:"7cfc-",mnch:"acd",Lb:"add8e6",Lcr:"08080",Lcn:"e0ffff",Lgnr:"afad2",Lgr:"d3d3d3",Lgrn:"90ee90",Lpnk:"b6c1",Lsmn:"a07a",Lsgr:"20b2aa",Lskb:"87cefa",LsTg:"778899",Lstb:"b0c4de",Lw:"e0",m:"-ff-",mgrn:"32cd32",nn:"af0e6",mgnt:"-ff",mrn:"8--0",mqm:"66cdaa",mmb:"--cd",mmrc:"ba55d3",mmpr:"9370db",msg:"3cb371",mmsT:"7b68ee","":"-fa9a",mtr:"48d1cc",mmvt:"c71585",mnLb:"191970",ntc:"5fffa",mstr:"e4e1",mccs:"e4b5",vjw:"dead",nv:"--80",c:"df5e6",v:"808-0",vrb:"6b8e23",rng:"a5-",rngr:"45-",rch:"da70d6",pgnr:"eee8aa",pgrn:"98fb98",ptrq:"afeeee",pvtr:"db7093",ppwh:"efd5",pchp:"dab9",pr:"cd853f",pnk:"c0cb",pm:"dda0dd",pwrb:"b0e0e6",prp:"8-080",cc:"663399",r:"--",sbr:"bc8f8f",rb:"4169e1",sbrw:"8b4513",smn:"a8072",nbr:"4a460",sgrn:"2e8b57",ssh:"5ee",snn:"a0522d",svr:"c0c0c0",skb:"87ceeb",sTb:"6a5acd",sTgr:"708090",snw:"afa",n:"-ff7f",stb:"4682b4",tn:"d2b48c",t:"-8080",thst:"d8bfd8",tmT:"6347",trqs:"40e0d0",vt:"ee82ee",whT:"5deb3",wht:"",hts:"5f5f5",w:"-",wgrn:"9acd32"};function A(l){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,e=i>0?l.toFixed(i).replace(/0+$/,"").replace(/\.$/,""):l.toString();return e||"0"}var z=function(){function l(i,e,t,r){O(this,l);var n=this;function o(a){if(a.startsWith("hsl")){var s=a.match(/([\-\d\.e]+)/g).map(Number),p=y(s,4),u=p[0],f=p[1],d=p[2],b=p[3];b===void 0&&(b=1),u/=360,f/=100,d/=100,n.hsla=[u,f,d,b]}else if(a.startsWith("rgb")){var m=a.match(/([\-\d\.e]+)/g).map(Number),h=y(m,4),v=h[0],g=h[1],S=h[2],k=h[3];k===void 0&&(k=1),n.rgba=[v,g,S,k]}else a.startsWith("#")?n.rgba=l.hexToRgb(a):n.rgba=l.nameToRgb(a)||l.hexToRgb(a)}if(i!==void 0)if(Array.isArray(i))this.rgba=i;else if(t===void 0){var c=i&&""+i;c&&o(c.toLowerCase())}else this.rgba=[i,e,t,r===void 0?1:r]}return R(l,[{key:"printRGB",value:function(e){var t=e?this.rgba:this.rgba.slice(0,3),r=t.map(function(n,o){return A(n,o===3?3:0)});return e?"rgba("+r+")":"rgb("+r+")"}},{key:"printHSL",value:function(e){var t=[360,100,100,1],r=["","%","%",""],n=e?this.hsla:this.hsla.slice(0,3),o=n.map(function(c,a){return A(c*t[a],a===3?3:1)+r[a]});return e?"hsla("+o+")":"hsl("+o+")"}},{key:"printHex",value:function(e){var t=this.hex;return e?t:t.substring(0,7)}},{key:"rgba",get:function(){if(this._rgba)return this._rgba;if(!this._hsla)throw new Error("No color is set");return this._rgba=l.hslToRgb(this._hsla)},set:function(e){e.length===3&&(e[3]=1),this._rgba=e,this._hsla=null}},{key:"rgbString",get:function(){return this.printRGB()}},{key:"rgbaString",get:function(){return this.printRGB(!0)}},{key:"hsla",get:function(){if(this._hsla)return this._hsla;if(!this._rgba)throw new Error("No color is set");return this._hsla=l.rgbToHsl(this._rgba)},set:function(e){e.length===3&&(e[3]=1),this._hsla=e,this._rgba=null}},{key:"hslString",get:function(){return this.printHSL()}},{key:"hslaString",get:function(){return this.printHSL(!0)}},{key:"hex",get:function(){var e=this.rgba,t=e.map(function(r,n){return n<3?r.toString(16):Math.round(r*255).toString(16)});return"#"+t.map(function(r){return r.padStart(2,"0")}).join("")},set:function(e){this.rgba=l.hexToRgb(e)}}],[{key:"hexToRgb",value:function(e){var t=(e.startsWith("#")?e.slice(1):e).replace(/^(\w{3})$/,"$1F").replace(/^(\w)(\w)(\w)(\w)$/,"$1$1$2$2$3$3$4$4").replace(/^(\w{6})$/,"$1FF");if(!t.match(/^([0-9a-fA-F]{8})$/))throw new Error("Unknown hex color; "+e);var r=t.match(/^(\w\w)(\w\w)(\w\w)(\w\w)$/).slice(1).map(function(n){return parseInt(n,16)});return r[3]=r[3]/255,r}},{key:"nameToRgb",value:function(e){var t=e.toLowerCase().replace("at","T").replace(/[aeiouyldf]/g,"").replace("ght","L").replace("rk","D").slice(-5,4),r=N[t];return r===void 0?r:l.hexToRgb(r.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(e){var t=y(e,4),r=t[0],n=t[1],o=t[2],c=t[3];r/=255,n/=255,o/=255;var a=Math.max(r,n,o),s=Math.min(r,n,o),p=void 0,u=void 0,f=(a+s)/2;if(a===s)p=u=0;else{var d=a-s;switch(u=f>.5?d/(2-a-s):d/(a+s),a){case r:p=(n-o)/d+(n<o?6:0);break;case n:p=(o-r)/d+2;break;case o:p=(r-n)/d+4;break}p/=6}return[p,u,f,c]}},{key:"hslToRgb",value:function(e){var t=y(e,4),r=t[0],n=t[1],o=t[2],c=t[3],a=void 0,s=void 0,p=void 0;if(n===0)a=s=p=o;else{var u=function(h,v,g){return g<0&&(g+=1),g>1&&(g-=1),g<.16666666666666666?h+(v-h)*6*g:g<.5?v:g<.6666666666666666?h+(v-h)*(.6666666666666666-g)*6:h},f=o<.5?o*(1+n):o+n-o*n,d=2*o-f;a=u(d,f,r+1/3),s=u(d,f,r),p=u(d,f,r-1/3)}var b=[a*255,s*255,p*255].map(Math.round);return b[3]=c,b}}]),l}(),F=function(){function l(){O(this,l),this._events=[]}return R(l,[{key:"add",value:function(e,t,r){e.addEventListener(t,r,!1),this._events.push({target:e,type:t,handler:r})}},{key:"remove",value:function(e,t,r){this._events=this._events.filter(function(n){var o=!0;return e&&e!==n.target&&(o=!1),t&&t!==n.type&&(o=!1),r&&r!==n.handler&&(o=!1),o&&l._doRemove(n.target,n.type,n.handler),!o})}},{key:"destroy",value:function(){this._events.forEach(function(e){return l._doRemove(e.target,e.type,e.handler)}),this._events=[]}}],[{key:"_doRemove",value:function(e,t,r){e.removeEventListener(t,r,!1)}}]),l}();function U(l){var i=document.createElement("div");return i.innerHTML=l,i.firstElementChild}function T(l,i,e){var t=!1;function r(a,s,p){return Math.max(s,Math.min(a,p))}function n(a,s,p){if(p&&(t=!0),!!t){a.preventDefault();var u=i.getBoundingClientRect(),f=u.width,d=u.height,b=s.clientX,m=s.clientY,h=r(b-u.left,0,f),v=r(m-u.top,0,d);e(h/f,v/d)}}function o(a,s){var p=a.buttons===void 0?a.which:a.buttons;p===1?n(a,a,s):t=!1}function c(a,s){a.touches.length===1?n(a,a.touches[0],s):t=!1}l.add(i,"mousedown",function(a){o(a,!0)}),l.add(i,"touchstart",function(a){c(a,!0)}),l.add(window,"mousemove",o),l.add(i,"touchmove",c),l.add(window,"mouseup",function(a){t=!1}),l.add(i,"touchend",function(a){t=!1}),l.add(i,"touchcancel",function(a){t=!1})}var B=`linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0 / 2em 2em,
2
+ linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em`,G=360,P="keydown",x="mousedown",H="focusin";function _(l,i){return(i||document).querySelector(l)}function M(l){l.preventDefault(),l.stopPropagation()}function D(l,i,e,t,r){l.add(i,P,function(n){e.indexOf(n.key)>=0&&(r&&M(n),t(n))})}var W=function(){function l(i){O(this,l),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new F,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(i)}return R(l,[{key:"setOptions",value:function(e){var t=this;if(!e)return;var r=this.settings;function n(s,p,u){for(var f in s)u&&u.indexOf(f)>=0||(p[f]=s[f])}if(e instanceof HTMLElement)r.parent=e;else{r.parent&&e.parent&&r.parent!==e.parent&&(this._events.remove(r.parent),this._popupInited=!1),n(e,r),e.onChange&&(this.onChange=e.onChange),e.onDone&&(this.onDone=e.onDone),e.onOpen&&(this.onOpen=e.onOpen),e.onClose&&(this.onClose=e.onClose);var o=e.color||e.colour;o&&this._setColor(o)}var c=r.parent;if(c&&r.popup&&!this._popupInited){var a=function(p){return t.openHandler(p)};this._events.add(c,"click",a),D(this._events,c,[" ","Spacebar","Enter"],a),this._popupInited=!0}else e.parent&&!r.popup&&this.show()}},{key:"openHandler",value:function(e){if(this.show()){e&&e.preventDefault(),this.settings.parent.style.pointerEvents="none";var t=e&&e.type===P?this._domEdit:this.domElement;setTimeout(function(){return t.focus()},100),this.onOpen&&this.onOpen(this.colour)}}},{key:"closeHandler",value:function(e){var t=e&&e.type,r=!1;if(!e)r=!0;else if(t===x||t===H){var n=(this.__containedEvent||0)+100;e.timeStamp>n&&(r=!0)}else M(e),r=!0;r&&this.hide()&&(this.settings.parent.style.pointerEvents="",t!==x&&this.settings.parent.focus(),this.onClose&&this.onClose(this.colour))}},{key:"movePopup",value:function(e,t){this.closeHandler(),this.setOptions(e),t&&this.openHandler()}},{key:"setColor",value:function(e,t){this._setColor(e,{silent:t})}},{key:"_setColor",value:function(e,t){if(typeof e=="string"&&(e=e.trim()),!!e){t=t||{};var r=void 0;try{r=new z(e)}catch(o){if(t.failSilently)return;throw o}if(!this.settings.alpha){var n=r.hsla;n[3]=1,r.hsla=n}this.colour=this.color=r,this._setHSLA(null,null,null,null,t)}}},{key:"setColour",value:function(e,t){this.setColor(e,t)}},{key:"show",value:function(){var e=this.settings.parent;if(!e)return!1;if(this.domElement){var t=this._toggleDOM(!0);return this._setPosition(),t}var r=this.settings.template||'<div class="picker_wrapper" tabindex="-1"><div class="picker_arrow"></div><div class="picker_hue picker_slider"><div class="picker_selector"></div></div><div class="picker_sl"><div class="picker_selector"></div></div><div class="picker_alpha picker_slider"><div class="picker_selector"></div></div><div class="picker_editor"><input aria-label="Type a color name or hex value"/></div><div class="picker_sample"></div><div class="picker_done"><button>Ok</button></div><div class="picker_cancel"><button>Cancel</button></div></div>',n=U(r);return this.domElement=n,this._domH=_(".picker_hue",n),this._domSL=_(".picker_sl",n),this._domA=_(".picker_alpha",n),this._domEdit=_(".picker_editor input",n),this._domSample=_(".picker_sample",n),this._domOkay=_(".picker_done button",n),this._domCancel=_(".picker_cancel button",n),n.classList.add("layout_"+this.settings.layout),this.settings.alpha||n.classList.add("no_alpha"),this.settings.editor||n.classList.add("no_editor"),this.settings.cancelButton||n.classList.add("no_cancel"),this._ifPopup(function(){return n.classList.add("popup")}),this._setPosition(),this.colour?this._updateUI():this._setColor(this.settings.defaultColor),this._bindEvents(),!0}},{key:"hide",value:function(){return this._toggleDOM(!1)}},{key:"destroy",value:function(){this._events.destroy(),this.domElement&&this.settings.parent.removeChild(this.domElement)}},{key:"_bindEvents",value:function(){var e=this,t=this,r=this.domElement,n=this._events;function o(s,p,u){n.add(s,p,u)}o(r,"click",function(s){return s.preventDefault()}),T(n,this._domH,function(s,p){return t._setHSLA(s)}),T(n,this._domSL,function(s,p){return t._setHSLA(null,s,1-p)}),this.settings.alpha&&T(n,this._domA,function(s,p){return t._setHSLA(null,null,null,1-p)});var c=this._domEdit;o(c,"input",function(s){t._setColor(this.value,{fromEditor:!0,failSilently:!0})}),o(c,"focus",function(s){var p=this;p.selectionStart===p.selectionEnd&&p.select()}),this._ifPopup(function(){var s=function(f){return e.closeHandler(f)};o(window,x,s),o(window,H,s),D(n,r,["Esc","Escape"],s);var p=function(f){e.__containedEvent=f.timeStamp};o(r,x,p),o(r,H,p),o(e._domCancel,"click",s)});var a=function(p){e._ifPopup(function(){return e.closeHandler(p)}),e.onDone&&e.onDone(e.colour)};o(this._domOkay,"click",a),D(n,r,["Enter"],a)}},{key:"_setPosition",value:function(){var e=this.settings.parent,t=this.domElement;e!==t.parentNode&&e.appendChild(t),this._ifPopup(function(r){getComputedStyle(e).position==="static"&&(e.style.position="relative");var n=r===!0?"popup_right":"popup_"+r;["popup_top","popup_bottom","popup_left","popup_right"].forEach(function(o){o===n?t.classList.add(o):t.classList.remove(o)}),t.classList.add(n)})}},{key:"_setHSLA",value:function(e,t,r,n,o){o=o||{};var c=this.colour,a=c.hsla;[e,t,r,n].forEach(function(s,p){(s||s===0)&&(a[p]=s)}),c.hsla=a,this._updateUI(o),this.onChange&&!o.silent&&this.onChange(c)}},{key:"_updateUI",value:function(e){if(!this.domElement)return;e=e||{};var t=this.colour,r=t.hsla,n="hsl("+r[0]*G+", 100%, 50%)",o=t.hslString,c=t.hslaString,a=this._domH,s=this._domSL,p=this._domA,u=_(".picker_selector",a),f=_(".picker_selector",s),d=_(".picker_selector",p);function b(I,C,L){C.style.left=L*100+"%"}function m(I,C,L){C.style.top=L*100+"%"}b(a,u,r[0]),this._domSL.style.backgroundColor=this._domH.style.color=n,b(s,f,r[1]),m(s,f,1-r[2]),s.style.color=o,m(p,d,1-r[3]);var h=o,v=h.replace("hsl","hsla").replace(")",", 0)"),g="linear-gradient("+[h,v]+")";if(this._domA.style.background=g+", "+B,!e.fromEditor){var S=this.settings.editorFormat,k=this.settings.alpha,w=void 0;switch(S){case"rgb":w=t.printRGB(k);break;case"hsl":w=t.printHSL(k);break;default:w=t.printHex(k)}this._domEdit.value=w}this._domSample.style.color=c}},{key:"_ifPopup",value:function(e,t){this.settings.parent&&this.settings.popup?e&&e(this.settings.popup):t&&t()}},{key:"_toggleDOM",value:function(e){var t=this.domElement;if(!t)return!1;var r=e?"":"none",n=t.style.display!==r;return n&&(t.style.display=r),n}}]),l}();E=document.createElement("style"),E.textContent='.picker_wrapper.no_alpha .picker_alpha{display:none}.picker_wrapper.no_editor .picker_editor{position:absolute;z-index:-1;opacity:0}.picker_wrapper.no_cancel .picker_cancel{display:none}.layout_default.picker_wrapper{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:stretch;font-size:10px;width:25em;padding:.5em}.layout_default.picker_wrapper input,.layout_default.picker_wrapper button{font-size:1rem}.layout_default.picker_wrapper>*{margin:.5em}.layout_default.picker_wrapper::before{content:"";display:block;width:100%;height:0;order:1}.layout_default .picker_slider,.layout_default .picker_selector{padding:1em}.layout_default .picker_hue{width:100%}.layout_default .picker_sl{flex:1 1 auto}.layout_default .picker_sl::before{content:"";display:block;padding-bottom:100%}.layout_default .picker_editor{order:1;width:6.5rem}.layout_default .picker_editor input{width:100%;height:100%}.layout_default .picker_sample{order:1;flex:1 1 auto}.layout_default .picker_done,.layout_default .picker_cancel{order:1}.picker_wrapper{box-sizing:border-box;background:#f2f2f2;box-shadow:0 0 0 1px silver;cursor:default;font-family:sans-serif;color:#444;pointer-events:auto}.picker_wrapper:focus{outline:none}.picker_wrapper button,.picker_wrapper input{box-sizing:border-box;border:none;box-shadow:0 0 0 1px silver;outline:none}.picker_wrapper button:focus,.picker_wrapper button:active,.picker_wrapper input:focus,.picker_wrapper input:active{box-shadow:0 0 2px 1px #1e90ff}.picker_wrapper button{padding:.4em .6em;cursor:pointer;background-color:#f5f5f5;background-image:linear-gradient(0deg, gainsboro, transparent)}.picker_wrapper button:active{background-image:linear-gradient(0deg, transparent, gainsboro)}.picker_wrapper button:hover{background-color:#fff}.picker_selector{position:absolute;z-index:1;display:block;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);border:2px solid #fff;border-radius:100%;box-shadow:0 0 3px 1px #67b9ff;background:currentColor;cursor:pointer}.picker_slider .picker_selector{border-radius:2px}.picker_hue{position:relative;background-image:linear-gradient(90deg, red, yellow, lime, cyan, blue, magenta, red);box-shadow:0 0 0 1px silver}.picker_sl{position:relative;box-shadow:0 0 0 1px silver;background-image:linear-gradient(180deg, white, rgba(255, 255, 255, 0) 50%),linear-gradient(0deg, black, rgba(0, 0, 0, 0) 50%),linear-gradient(90deg, #808080, rgba(128, 128, 128, 0))}.picker_alpha,.picker_sample{position:relative;background:linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0/2em 2em,linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em/2em 2em;box-shadow:0 0 0 1px silver}.picker_alpha .picker_selector,.picker_sample .picker_selector{background:none}.picker_editor input{font-family:monospace;padding:.2em .4em}.picker_sample::before{content:"";position:absolute;display:block;width:100%;height:100%;background:currentColor}.picker_arrow{position:absolute;z-index:-1}.picker_wrapper.popup{position:absolute;z-index:2;margin:1.5em}.picker_wrapper.popup,.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{background:#f2f2f2;box-shadow:0 0 10px 1px rgba(0,0,0,.4)}.picker_wrapper.popup .picker_arrow{width:3em;height:3em;margin:0}.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{content:"";display:block;position:absolute;top:0;left:0;z-index:-99}.picker_wrapper.popup .picker_arrow::before{width:100%;height:100%;-webkit-transform:skew(45deg);transform:skew(45deg);-webkit-transform-origin:0 100%;transform-origin:0 100%}.picker_wrapper.popup .picker_arrow::after{width:150%;height:150%;box-shadow:none}.popup.popup_top{bottom:100%;left:0}.popup.popup_top .picker_arrow{bottom:0;left:0;-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.popup.popup_bottom{top:100%;left:0}.popup.popup_bottom .picker_arrow{top:0;left:0;-webkit-transform:rotate(90deg) scale(1, -1);transform:rotate(90deg) scale(1, -1)}.popup.popup_left{top:0;right:100%}.popup.popup_left .picker_arrow{top:0;right:0;-webkit-transform:scale(-1, 1);transform:scale(-1, 1)}.popup.popup_right{top:0;left:100%}.popup.popup_right .picker_arrow{top:0;left:0}',document.documentElement.firstElementChild.appendChild(E),W.StyleElement=E;var E;export{W as default};