Compare commits
9 Commits
mb/fullsta
...
hush/bigly
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8e9ff62df | ||
|
|
d803737843 | ||
|
|
0c5105e334 | ||
|
|
69ec549e88 | ||
|
|
951a91f4d7 | ||
|
|
571d538eb2 | ||
|
|
5fd6fc99fd | ||
|
|
e411e41753 | ||
|
|
3680b4af21 |
62
CHANGELOG.md
62
CHANGELOG.md
@@ -9,33 +9,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Added
|
||||
|
||||
- `GroqLLMService` and `GrokLLMService` for Groq and Grok API integration, with
|
||||
OpenAI-compatible interface.
|
||||
|
||||
- New examples demonstrating function calling with Groq, Grok, Azure OpenAI,
|
||||
and Fireworks: `14f-function-calling-groq.py`, `14g-function-calling-grok.py`,
|
||||
`14h-function-calling-azure.py`, and `14i-function-calling-fireworks.py`.
|
||||
|
||||
- In order to obtain the audio stored by the `AudioBufferProcessor` you can now
|
||||
also register an `on_audio_data` event handler. The `on_audio_data` handler
|
||||
will be called every time `buffer_size` (a new constructor argument) is
|
||||
reached. If `buffer_size` is 0 (default) you need to manually get the audio as
|
||||
before using `AudioBufferProcessor.merge_audio_buffers()`.
|
||||
|
||||
```
|
||||
@audiobuffer.event_handler("on_audio_data")
|
||||
async def on_audio_data(processor, audio, sample_rate, num_channels):
|
||||
await save_audio(audio, sample_rate, num_channels)
|
||||
```
|
||||
|
||||
- Added a new RTVI message called `disconnect-bot`, which when handled pushes
|
||||
an `EndFrame` to trigger the pipeline to stop.
|
||||
|
||||
### Changed
|
||||
- Added support for the new Pipecat Flows package (pipecat-ai-flows). Learn
|
||||
more at: https://github.com/pipecat-ai/pipecat-flows.
|
||||
|
||||
- All input frames (text, audio, image, etc.) are now system frames. This means
|
||||
they are processed immediately by all processors instead of being queued
|
||||
internally.
|
||||
- Added foundational example `25-conversation-flow.py` showing how to use
|
||||
Pipecat Flows.
|
||||
|
||||
### Changed
|
||||
|
||||
- Expanded the transcriptions.language module to support a superset of
|
||||
languages.
|
||||
@@ -43,39 +26,6 @@ async def on_audio_data(processor, audio, sample_rate, num_channels):
|
||||
- Updated STT and TTS services with language options that match the supported
|
||||
languages for each service.
|
||||
|
||||
- Updated the `AzureLLMService` to use the `OpenAILLMService`. Updated the
|
||||
`api_version` to `2024-09-01-preview`.
|
||||
|
||||
- Updated the `FireworksLLMService` to use the `OpenAILLMService`. Updated the
|
||||
default model to `accounts/fireworks/models/firefunction-v2`.
|
||||
|
||||
### Removed
|
||||
|
||||
- Removed `AppFrame`. This was used as a special user custom frame, but there's
|
||||
actually no use case for that.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed an issue in `DailyTransport` that would cause some internal callbacks to
|
||||
not be executed.
|
||||
|
||||
- Fixed an issue where other frames were being processed while a `CancelFrame`
|
||||
was being pushed down the pipeline.
|
||||
|
||||
- `AudioBufferProcessor` now handles interruptions properly.
|
||||
|
||||
- Fixed a `WebsocketServerTransport` issue that would prevent interruptions with
|
||||
`TwilioSerializer` from working.
|
||||
|
||||
- `DailyTransport.capture_participant_video` now allows capturing user's screen
|
||||
share by simply passing `video_source="screenVideo"`.
|
||||
|
||||
- Fixed Google Gemini message handling to properly convert appended messages to
|
||||
Gemini's required format.
|
||||
|
||||
- Fixed an issue with `FireworksLLMService` where chat completions were failing
|
||||
by removing the `stream_options` from the chat completion options.
|
||||
|
||||
## [0.0.49] - 2024-11-17
|
||||
|
||||
### Added
|
||||
|
||||
@@ -13,7 +13,6 @@ Pipecat is an open source Python framework for building voice and multimodal con
|
||||
- **Multimodal Apps**: Combine voice, video, images, and text
|
||||
- **Creative Tools**: [Story-telling experiences](https://storytelling-chatbot.fly.dev/) and social companions
|
||||
- **Business Solutions**: [Customer intake flows](https://www.youtube.com/watch?v=lDevgsp9vn0) and support bots
|
||||
- **Complex conversational flows**: [Refer to Pipecat Flows](https://github.com/pipecat-ai/pipecat-flows) to learn more
|
||||
|
||||
## See it in action
|
||||
|
||||
@@ -33,8 +32,6 @@ Pipecat is an open source Python framework for building voice and multimodal con
|
||||
- **Real-time Processing**: Frame-based pipeline architecture for fluid interactions
|
||||
- **Production Ready**: Enterprise-grade WebRTC and Websocket support
|
||||
|
||||
💡 Looking to build structured conversations? Check out [Pipecat Flows](https://github.com/pipecat-ai/pipecat-flows) for managing complex conversational states and transitions.
|
||||
|
||||
## Getting started
|
||||
|
||||
You can get started with Pipecat running on your local machine, then move your agent processes to the cloud when you’re ready. You can also add a 📞 telephone number, 🖼️ image output, 📺 video input, use different LLMs, and more.
|
||||
@@ -58,7 +55,7 @@ Available options include:
|
||||
| Category | Services | Install Command Example |
|
||||
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
|
||||
| Speech-to-Text | [AssemblyAI](https://docs.pipecat.ai/api-reference/services/stt/assemblyai), [Azure](https://docs.pipecat.ai/api-reference/services/stt/azure), [Deepgram](https://docs.pipecat.ai/api-reference/services/stt/deepgram), [Gladia](https://docs.pipecat.ai/api-reference/services/stt/gladia), [Whisper](https://docs.pipecat.ai/api-reference/services/stt/whisper) | `pip install "pipecat-ai[deepgram]"` |
|
||||
| LLMs | [Anthropic](https://docs.pipecat.ai/api-reference/services/llm/anthropic), [Azure](https://docs.pipecat.ai/api-reference/services/llm/azure), [Fireworks AI](https://docs.pipecat.ai/api-reference/services/llm/fireworks), [Gemini](https://docs.pipecat.ai/api-reference/services/llm/gemini), [Grok](https://docs.pipecat.ai/api-reference/services/llm/grok), [Groq](https://docs.pipecat.ai/api-reference/services/llm/groq) [Ollama](https://docs.pipecat.ai/api-reference/services/llm/ollama), [OpenAI](https://docs.pipecat.ai/api-reference/services/llm/openai), [Together AI](https://docs.pipecat.ai/api-reference/services/llm/together) | `pip install "pipecat-ai[openai]"` |
|
||||
| LLMs | [Anthropic](https://docs.pipecat.ai/api-reference/services/llm/anthropic), [Azure](https://docs.pipecat.ai/api-reference/services/llm/azure), [Fireworks AI](https://docs.pipecat.ai/api-reference/services/llm/fireworks), [Gemini](https://docs.pipecat.ai/api-reference/services/llm/gemini), [Ollama](https://docs.pipecat.ai/api-reference/services/llm/ollama), [OpenAI](https://docs.pipecat.ai/api-reference/services/llm/openai), [Together AI](https://docs.pipecat.ai/api-reference/services/llm/together) | `pip install "pipecat-ai[openai]"` |
|
||||
| Text-to-Speech | [AWS](https://docs.pipecat.ai/api-reference/services/tts/aws), [Azure](https://docs.pipecat.ai/api-reference/services/tts/azure), [Cartesia](https://docs.pipecat.ai/api-reference/services/tts/cartesia), [Deepgram](https://docs.pipecat.ai/api-reference/services/tts/deepgram), [ElevenLabs](https://docs.pipecat.ai/api-reference/services/tts/elevenlabs), [Google](https://docs.pipecat.ai/api-reference/services/tts/google), [LMNT](https://docs.pipecat.ai/api-reference/services/tts/lmnt), [OpenAI](https://docs.pipecat.ai/api-reference/services/tts/openai), [PlayHT](https://docs.pipecat.ai/api-reference/services/tts/playht), [Rime](https://docs.pipecat.ai/api-reference/services/tts/rime), [XTTS](https://docs.pipecat.ai/api-reference/services/tts/xtts) | `pip install "pipecat-ai[cartesia]"` |
|
||||
| Speech-to-Speech | [OpenAI Realtime](https://docs.pipecat.ai/api-reference/services/s2s/openai) | `pip install "pipecat-ai[openai]"` |
|
||||
| Transport | [Daily (WebRTC)](https://docs.pipecat.ai/api-reference/services/transport/daily), WebSocket, Local | `pip install "pipecat-ai[daily]"` |
|
||||
|
||||
@@ -96,6 +96,9 @@ Notable control frames:
|
||||
|
||||
## 7. Special Purpose Frames
|
||||
|
||||
### AppFrame
|
||||
Base class for application-specific custom frames.
|
||||
|
||||
### MetricsFrame
|
||||
Contains performance metrics data.
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ Next, follow the steps in the README for each demo.
|
||||
| [Dialin Chatbot](dialin-chatbot) | A chatbot that connects to an incoming phone call from Daily or Twilio. | Deepgram, ElevenLabs, OpenAI, Daily, Twilio |
|
||||
| [Twilio Chatbot](twilio-chatbot) | A chatbot that connects to an incoming phone call from Twilio. | Deepgram, ElevenLabs, OpenAI, Daily, Twilio |
|
||||
| [studypal](studypal) | A chatbot to have a conversation about any article on the web | |
|
||||
| [WebSocket Chatbot Server](websocket-server) | A real-time websocket server that handles audio streaming and bot interactions with speech-to-text and text-to-speech capabilities | `python-websockets`, `openai`, `deepgram`, `silero-tts`, `numpy` |
|
||||
|
||||
> [!IMPORTANT]
|
||||
> These example projects use Daily as a WebRTC transport and can be joined using their hosted Prebuilt UI.
|
||||
|
||||
@@ -102,6 +102,7 @@ async def main():
|
||||
audio_buffer_processor=audio_buffer_processor,
|
||||
aiohttp_session=session,
|
||||
api_key=os.getenv("CANONICAL_API_KEY"),
|
||||
api_url=os.getenv("CANONICAL_API_URL"),
|
||||
call_id=str(uuid.uuid4()),
|
||||
assistant="pipecat-chatbot",
|
||||
assistant_speaks_first=True,
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
# SPDX-License-Identifier: BSD 2-Clause License
|
||||
#
|
||||
|
||||
import aiofiles
|
||||
import asyncio
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
|
||||
@@ -34,17 +32,15 @@ logger.remove(0)
|
||||
logger.add(sys.stderr, level="DEBUG")
|
||||
|
||||
|
||||
async def save_audio(audio: bytes, sample_rate: int, num_channels: int):
|
||||
if len(audio) > 0:
|
||||
async def save_audio(audiobuffer):
|
||||
if audiobuffer.has_audio():
|
||||
merged_audio = audiobuffer.merge_audio_buffers()
|
||||
filename = f"conversation_recording{datetime.datetime.now().strftime('%Y%m%d_%H%M%S')}.wav"
|
||||
with io.BytesIO() as buffer:
|
||||
with wave.open(buffer, "wb") as wf:
|
||||
wf.setsampwidth(2)
|
||||
wf.setnchannels(num_channels)
|
||||
wf.setframerate(sample_rate)
|
||||
wf.writeframes(audio)
|
||||
async with aiofiles.open(filename, "wb") as file:
|
||||
await file.write(buffer.getvalue())
|
||||
with wave.open(filename, "wb") as wf:
|
||||
wf.setnchannels(2)
|
||||
wf.setsampwidth(2)
|
||||
wf.setframerate(audiobuffer._sample_rate)
|
||||
wf.writeframes(merged_audio)
|
||||
print(f"Merged audio saved to {filename}")
|
||||
else:
|
||||
print("No audio data to save")
|
||||
@@ -110,9 +106,7 @@ async def main():
|
||||
context = OpenAILLMContext(messages)
|
||||
context_aggregator = llm.create_context_aggregator(context)
|
||||
|
||||
# Save audio every 10 seconds.
|
||||
audiobuffer = AudioBufferProcessor(buffer_size=480000)
|
||||
|
||||
audiobuffer = AudioBufferProcessor()
|
||||
pipeline = Pipeline(
|
||||
[
|
||||
transport.input(), # microphone
|
||||
@@ -127,10 +121,6 @@ async def main():
|
||||
|
||||
task = PipelineTask(pipeline, PipelineParams(allow_interruptions=True))
|
||||
|
||||
@audiobuffer.event_handler("on_audio_data")
|
||||
async def on_audio_data(buffer, audio, sample_rate, num_channels):
|
||||
await save_audio(audio, sample_rate, num_channels)
|
||||
|
||||
@transport.event_handler("on_first_participant_joined")
|
||||
async def on_first_participant_joined(transport, participant):
|
||||
await transport.capture_participant_transcription(participant["id"])
|
||||
@@ -140,6 +130,7 @@ async def main():
|
||||
async def on_participant_left(transport, participant, reason):
|
||||
print(f"Participant left: {participant}")
|
||||
await task.queue_frame(EndFrame())
|
||||
await save_audio(audiobuffer)
|
||||
|
||||
runner = PipelineRunner()
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
aiofiles
|
||||
python-dotenv
|
||||
fastapi[all]
|
||||
uvicorn
|
||||
|
||||
@@ -12,7 +12,7 @@ import sys
|
||||
from dataclasses import dataclass
|
||||
|
||||
from pipecat.frames.frames import (
|
||||
DataFrame,
|
||||
AppFrame,
|
||||
Frame,
|
||||
LLMFullResponseStartFrame,
|
||||
LLMMessagesFrame,
|
||||
@@ -42,7 +42,7 @@ logger.add(sys.stderr, level="DEBUG")
|
||||
|
||||
|
||||
@dataclass
|
||||
class MonthFrame(DataFrame):
|
||||
class MonthFrame(AppFrame):
|
||||
month: str
|
||||
|
||||
def __str__(self):
|
||||
|
||||
@@ -5,15 +5,10 @@
|
||||
#
|
||||
|
||||
import asyncio
|
||||
import aiohttp
|
||||
import os
|
||||
import sys
|
||||
|
||||
import aiohttp
|
||||
from dotenv import load_dotenv
|
||||
from loguru import logger
|
||||
from openai.types.chat import ChatCompletionToolParam
|
||||
from runner import configure
|
||||
|
||||
from pipecat.audio.vad.silero import SileroVADAnalyzer
|
||||
from pipecat.pipeline.pipeline import Pipeline
|
||||
from pipecat.pipeline.runner import PipelineRunner
|
||||
@@ -23,6 +18,14 @@ from pipecat.services.openai import OpenAILLMContext
|
||||
from pipecat.services.together import TogetherLLMService
|
||||
from pipecat.transports.services.daily import DailyParams, DailyTransport
|
||||
|
||||
from openai.types.chat import ChatCompletionToolParam
|
||||
|
||||
from runner import configure
|
||||
|
||||
from loguru import logger
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv(override=True)
|
||||
|
||||
logger.remove(0)
|
||||
@@ -122,7 +125,7 @@ async def main():
|
||||
async def on_first_participant_joined(transport, participant):
|
||||
await transport.capture_participant_transcription(participant["id"])
|
||||
# Kick off the conversation.
|
||||
await task.queue_frames([context_aggregator.user().get_context_frame()])
|
||||
# await tts.say("Hi! Ask me about the weather in San Francisco.")
|
||||
|
||||
runner = PipelineRunner()
|
||||
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2024, Daily
|
||||
#
|
||||
# SPDX-License-Identifier: BSD 2-Clause License
|
||||
#
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
|
||||
import aiohttp
|
||||
from dotenv import load_dotenv
|
||||
from loguru import logger
|
||||
from openai.types.chat import ChatCompletionToolParam
|
||||
from runner import configure
|
||||
|
||||
from pipecat.audio.vad.silero import SileroVADAnalyzer
|
||||
from pipecat.pipeline.pipeline import Pipeline
|
||||
from pipecat.pipeline.runner import PipelineRunner
|
||||
from pipecat.pipeline.task import PipelineParams, PipelineTask
|
||||
from pipecat.services.cartesia import CartesiaTTSService
|
||||
from pipecat.services.groq import GroqLLMService
|
||||
from pipecat.services.openai import OpenAILLMContext
|
||||
from pipecat.transports.services.daily import DailyParams, DailyTransport
|
||||
|
||||
load_dotenv(override=True)
|
||||
|
||||
logger.remove(0)
|
||||
logger.add(sys.stderr, level="DEBUG")
|
||||
|
||||
|
||||
async def start_fetch_weather(function_name, llm, context):
|
||||
# note: we can't push a frame to the LLM here. the bot
|
||||
# can interrupt itself and/or cause audio overlapping glitches.
|
||||
# possible question for Aleix and Chad about what the right way
|
||||
# to trigger speech is, now, with the new queues/async/sync refactors.
|
||||
# await llm.push_frame(TextFrame("Let me check on that."))
|
||||
logger.debug(f"Starting fetch_weather_from_api with function_name: {function_name}")
|
||||
|
||||
|
||||
async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context, result_callback):
|
||||
await result_callback({"conditions": "nice", "temperature": "75"})
|
||||
|
||||
|
||||
async def main():
|
||||
async with aiohttp.ClientSession() as session:
|
||||
(room_url, token) = await configure(session)
|
||||
|
||||
transport = DailyTransport(
|
||||
room_url,
|
||||
token,
|
||||
"Respond bot",
|
||||
DailyParams(
|
||||
audio_out_enabled=True,
|
||||
transcription_enabled=True,
|
||||
vad_enabled=True,
|
||||
vad_analyzer=SileroVADAnalyzer(),
|
||||
),
|
||||
)
|
||||
|
||||
tts = CartesiaTTSService(
|
||||
api_key=os.getenv("CARTESIA_API_KEY"),
|
||||
voice_id="79a125e8-cd45-4c13-8a67-188112f4dd22", # British Lady
|
||||
)
|
||||
|
||||
llm = GroqLLMService(
|
||||
api_key=os.getenv("GROQ_API_KEY"), model="llama3-groq-70b-8192-tool-use-preview"
|
||||
)
|
||||
# Register a function_name of None to get all functions
|
||||
# sent to the same callback with an additional function_name parameter.
|
||||
llm.register_function(None, fetch_weather_from_api, start_callback=start_fetch_weather)
|
||||
|
||||
tools = [
|
||||
ChatCompletionToolParam(
|
||||
type="function",
|
||||
function={
|
||||
"name": "get_current_weather",
|
||||
"description": "Get the current weather",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"location": {
|
||||
"type": "string",
|
||||
"description": "The city and state, e.g. San Francisco, CA",
|
||||
},
|
||||
"unit": {
|
||||
"type": "string",
|
||||
"enum": ["celsius", "fahrenheit"],
|
||||
"description": "The temperature unit to use. Infer this from the users location.",
|
||||
},
|
||||
},
|
||||
"required": ["location"],
|
||||
},
|
||||
},
|
||||
)
|
||||
]
|
||||
messages = [
|
||||
{
|
||||
"role": "system",
|
||||
"content": "You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be converted to audio so don't include special characters in your answers. Respond to what the user said in a creative and helpful way.",
|
||||
},
|
||||
]
|
||||
|
||||
context = OpenAILLMContext(messages, tools)
|
||||
context_aggregator = llm.create_context_aggregator(context)
|
||||
|
||||
pipeline = Pipeline(
|
||||
[
|
||||
transport.input(),
|
||||
context_aggregator.user(),
|
||||
llm,
|
||||
tts,
|
||||
transport.output(),
|
||||
context_aggregator.assistant(),
|
||||
]
|
||||
)
|
||||
|
||||
task = PipelineTask(
|
||||
pipeline,
|
||||
PipelineParams(
|
||||
allow_interruptions=True,
|
||||
enable_metrics=True,
|
||||
enable_usage_metrics=True,
|
||||
),
|
||||
)
|
||||
|
||||
@transport.event_handler("on_first_participant_joined")
|
||||
async def on_first_participant_joined(transport, participant):
|
||||
await transport.capture_participant_transcription(participant["id"])
|
||||
# Kick off the conversation.
|
||||
await task.queue_frames([context_aggregator.user().get_context_frame()])
|
||||
|
||||
runner = PipelineRunner()
|
||||
|
||||
await runner.run(task)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
@@ -1,137 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2024, Daily
|
||||
#
|
||||
# SPDX-License-Identifier: BSD 2-Clause License
|
||||
#
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
|
||||
import aiohttp
|
||||
from dotenv import load_dotenv
|
||||
from loguru import logger
|
||||
from openai.types.chat import ChatCompletionToolParam
|
||||
from runner import configure
|
||||
|
||||
from pipecat.audio.vad.silero import SileroVADAnalyzer
|
||||
from pipecat.pipeline.pipeline import Pipeline
|
||||
from pipecat.pipeline.runner import PipelineRunner
|
||||
from pipecat.pipeline.task import PipelineParams, PipelineTask
|
||||
from pipecat.services.cartesia import CartesiaTTSService
|
||||
from pipecat.services.grok import GrokLLMService
|
||||
from pipecat.services.openai import OpenAILLMContext
|
||||
from pipecat.transports.services.daily import DailyParams, DailyTransport
|
||||
|
||||
load_dotenv(override=True)
|
||||
|
||||
logger.remove(0)
|
||||
logger.add(sys.stderr, level="DEBUG")
|
||||
|
||||
|
||||
async def start_fetch_weather(function_name, llm, context):
|
||||
# note: we can't push a frame to the LLM here. the bot
|
||||
# can interrupt itself and/or cause audio overlapping glitches.
|
||||
# possible question for Aleix and Chad about what the right way
|
||||
# to trigger speech is, now, with the new queues/async/sync refactors.
|
||||
# await llm.push_frame(TextFrame("Let me check on that."))
|
||||
logger.debug(f"Starting fetch_weather_from_api with function_name: {function_name}")
|
||||
|
||||
|
||||
async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context, result_callback):
|
||||
await result_callback({"conditions": "nice", "temperature": "75"})
|
||||
|
||||
|
||||
async def main():
|
||||
async with aiohttp.ClientSession() as session:
|
||||
(room_url, token) = await configure(session)
|
||||
|
||||
transport = DailyTransport(
|
||||
room_url,
|
||||
token,
|
||||
"Respond bot",
|
||||
DailyParams(
|
||||
audio_out_enabled=True,
|
||||
transcription_enabled=True,
|
||||
vad_enabled=True,
|
||||
vad_analyzer=SileroVADAnalyzer(),
|
||||
),
|
||||
)
|
||||
|
||||
tts = CartesiaTTSService(
|
||||
api_key=os.getenv("CARTESIA_API_KEY"),
|
||||
voice_id="79a125e8-cd45-4c13-8a67-188112f4dd22", # British Lady
|
||||
)
|
||||
|
||||
llm = GrokLLMService(api_key=os.getenv("GROK_API_KEY"))
|
||||
# Register a function_name of None to get all functions
|
||||
# sent to the same callback with an additional function_name parameter.
|
||||
llm.register_function(None, fetch_weather_from_api, start_callback=start_fetch_weather)
|
||||
|
||||
tools = [
|
||||
ChatCompletionToolParam(
|
||||
type="function",
|
||||
function={
|
||||
"name": "get_current_weather",
|
||||
"description": "Get the current weather",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"location": {
|
||||
"type": "string",
|
||||
"description": "The city and state, e.g. San Francisco, CA",
|
||||
},
|
||||
"format": {
|
||||
"type": "string",
|
||||
"enum": ["celsius", "fahrenheit"],
|
||||
"description": "The temperature unit to use. Infer this from the users location.",
|
||||
},
|
||||
},
|
||||
"required": ["location", "format"],
|
||||
},
|
||||
},
|
||||
)
|
||||
]
|
||||
messages = [
|
||||
{
|
||||
"role": "system",
|
||||
"content": "You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be converted to audio so don't include special characters in your answers. Respond to what the user said in a creative and helpful way.",
|
||||
},
|
||||
]
|
||||
|
||||
context = OpenAILLMContext(messages, tools)
|
||||
context_aggregator = llm.create_context_aggregator(context)
|
||||
|
||||
pipeline = Pipeline(
|
||||
[
|
||||
transport.input(),
|
||||
context_aggregator.user(),
|
||||
llm,
|
||||
tts,
|
||||
transport.output(),
|
||||
context_aggregator.assistant(),
|
||||
]
|
||||
)
|
||||
|
||||
task = PipelineTask(
|
||||
pipeline,
|
||||
PipelineParams(
|
||||
allow_interruptions=True,
|
||||
enable_metrics=True,
|
||||
enable_usage_metrics=True,
|
||||
),
|
||||
)
|
||||
|
||||
@transport.event_handler("on_first_participant_joined")
|
||||
async def on_first_participant_joined(transport, participant):
|
||||
await transport.capture_participant_transcription(participant["id"])
|
||||
# Kick off the conversation.
|
||||
await task.queue_frames([context_aggregator.user().get_context_frame()])
|
||||
|
||||
runner = PipelineRunner()
|
||||
|
||||
await runner.run(task)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
@@ -1,141 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2024, Daily
|
||||
#
|
||||
# SPDX-License-Identifier: BSD 2-Clause License
|
||||
#
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
|
||||
import aiohttp
|
||||
from dotenv import load_dotenv
|
||||
from loguru import logger
|
||||
from openai.types.chat import ChatCompletionToolParam
|
||||
from runner import configure
|
||||
|
||||
from pipecat.audio.vad.silero import SileroVADAnalyzer
|
||||
from pipecat.pipeline.pipeline import Pipeline
|
||||
from pipecat.pipeline.runner import PipelineRunner
|
||||
from pipecat.pipeline.task import PipelineParams, PipelineTask
|
||||
from pipecat.services.azure import AzureLLMService
|
||||
from pipecat.services.cartesia import CartesiaTTSService
|
||||
from pipecat.services.openai import OpenAILLMContext
|
||||
from pipecat.transports.services.daily import DailyParams, DailyTransport
|
||||
|
||||
load_dotenv(override=True)
|
||||
|
||||
logger.remove(0)
|
||||
logger.add(sys.stderr, level="DEBUG")
|
||||
|
||||
|
||||
async def start_fetch_weather(function_name, llm, context):
|
||||
# note: we can't push a frame to the LLM here. the bot
|
||||
# can interrupt itself and/or cause audio overlapping glitches.
|
||||
# possible question for Aleix and Chad about what the right way
|
||||
# to trigger speech is, now, with the new queues/async/sync refactors.
|
||||
# await llm.push_frame(TextFrame("Let me check on that."))
|
||||
logger.debug(f"Starting fetch_weather_from_api with function_name: {function_name}")
|
||||
|
||||
|
||||
async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context, result_callback):
|
||||
await result_callback({"conditions": "nice", "temperature": "75"})
|
||||
|
||||
|
||||
async def main():
|
||||
async with aiohttp.ClientSession() as session:
|
||||
(room_url, token) = await configure(session)
|
||||
|
||||
transport = DailyTransport(
|
||||
room_url,
|
||||
token,
|
||||
"Respond bot",
|
||||
DailyParams(
|
||||
audio_out_enabled=True,
|
||||
transcription_enabled=True,
|
||||
vad_enabled=True,
|
||||
vad_analyzer=SileroVADAnalyzer(),
|
||||
),
|
||||
)
|
||||
|
||||
tts = CartesiaTTSService(
|
||||
api_key=os.getenv("CARTESIA_API_KEY"),
|
||||
voice_id="79a125e8-cd45-4c13-8a67-188112f4dd22", # British Lady
|
||||
)
|
||||
|
||||
llm = AzureLLMService(
|
||||
api_key=os.getenv("AZURE_CHATGPT_API_KEY"),
|
||||
endpoint=os.getenv("AZURE_CHATGPT_ENDPOINT"),
|
||||
model=os.getenv("AZURE_CHATGPT_MODEL"),
|
||||
)
|
||||
# Register a function_name of None to get all functions
|
||||
# sent to the same callback with an additional function_name parameter.
|
||||
llm.register_function(None, fetch_weather_from_api, start_callback=start_fetch_weather)
|
||||
|
||||
tools = [
|
||||
ChatCompletionToolParam(
|
||||
type="function",
|
||||
function={
|
||||
"name": "get_current_weather",
|
||||
"description": "Get the current weather",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"location": {
|
||||
"type": "string",
|
||||
"description": "The city and state, e.g. San Francisco, CA",
|
||||
},
|
||||
"format": {
|
||||
"type": "string",
|
||||
"enum": ["celsius", "fahrenheit"],
|
||||
"description": "The temperature unit to use. Infer this from the users location.",
|
||||
},
|
||||
},
|
||||
"required": ["location", "format"],
|
||||
},
|
||||
},
|
||||
)
|
||||
]
|
||||
messages = [
|
||||
{
|
||||
"role": "system",
|
||||
"content": "You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be converted to audio so don't include special characters in your answers. Respond to what the user said in a creative and helpful way.",
|
||||
},
|
||||
]
|
||||
|
||||
context = OpenAILLMContext(messages, tools)
|
||||
context_aggregator = llm.create_context_aggregator(context)
|
||||
|
||||
pipeline = Pipeline(
|
||||
[
|
||||
transport.input(),
|
||||
context_aggregator.user(),
|
||||
llm,
|
||||
tts,
|
||||
transport.output(),
|
||||
context_aggregator.assistant(),
|
||||
]
|
||||
)
|
||||
|
||||
task = PipelineTask(
|
||||
pipeline,
|
||||
PipelineParams(
|
||||
allow_interruptions=True,
|
||||
enable_metrics=True,
|
||||
enable_usage_metrics=True,
|
||||
),
|
||||
)
|
||||
|
||||
@transport.event_handler("on_first_participant_joined")
|
||||
async def on_first_participant_joined(transport, participant):
|
||||
await transport.capture_participant_transcription(participant["id"])
|
||||
# Kick off the conversation.
|
||||
await task.queue_frames([context_aggregator.user().get_context_frame()])
|
||||
|
||||
runner = PipelineRunner()
|
||||
|
||||
await runner.run(task)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
@@ -1,140 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2024, Daily
|
||||
#
|
||||
# SPDX-License-Identifier: BSD 2-Clause License
|
||||
#
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
|
||||
import aiohttp
|
||||
from dotenv import load_dotenv
|
||||
from loguru import logger
|
||||
from openai.types.chat import ChatCompletionToolParam
|
||||
from runner import configure
|
||||
|
||||
from pipecat.audio.vad.silero import SileroVADAnalyzer
|
||||
from pipecat.pipeline.pipeline import Pipeline
|
||||
from pipecat.pipeline.runner import PipelineRunner
|
||||
from pipecat.pipeline.task import PipelineParams, PipelineTask
|
||||
from pipecat.services.cartesia import CartesiaTTSService
|
||||
from pipecat.services.fireworks import FireworksLLMService
|
||||
from pipecat.services.openai import OpenAILLMContext
|
||||
from pipecat.transports.services.daily import DailyParams, DailyTransport
|
||||
|
||||
load_dotenv(override=True)
|
||||
|
||||
logger.remove(0)
|
||||
logger.add(sys.stderr, level="DEBUG")
|
||||
|
||||
|
||||
async def start_fetch_weather(function_name, llm, context):
|
||||
# note: we can't push a frame to the LLM here. the bot
|
||||
# can interrupt itself and/or cause audio overlapping glitches.
|
||||
# possible question for Aleix and Chad about what the right way
|
||||
# to trigger speech is, now, with the new queues/async/sync refactors.
|
||||
# await llm.push_frame(TextFrame("Let me check on that."))
|
||||
logger.debug(f"Starting fetch_weather_from_api with function_name: {function_name}")
|
||||
|
||||
|
||||
async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context, result_callback):
|
||||
await result_callback({"conditions": "nice", "temperature": "75"})
|
||||
|
||||
|
||||
async def main():
|
||||
async with aiohttp.ClientSession() as session:
|
||||
(room_url, token) = await configure(session)
|
||||
|
||||
transport = DailyTransport(
|
||||
room_url,
|
||||
token,
|
||||
"Respond bot",
|
||||
DailyParams(
|
||||
audio_out_enabled=True,
|
||||
transcription_enabled=True,
|
||||
vad_enabled=True,
|
||||
vad_analyzer=SileroVADAnalyzer(),
|
||||
),
|
||||
)
|
||||
|
||||
tts = CartesiaTTSService(
|
||||
api_key=os.getenv("CARTESIA_API_KEY"),
|
||||
voice_id="79a125e8-cd45-4c13-8a67-188112f4dd22", # British Lady
|
||||
)
|
||||
|
||||
llm = FireworksLLMService(
|
||||
api_key=os.getenv("FIREWORKS_API_KEY"),
|
||||
model="accounts/fireworks/models/firefunction-v2",
|
||||
)
|
||||
# Register a function_name of None to get all functions
|
||||
# sent to the same callback with an additional function_name parameter.
|
||||
llm.register_function(None, fetch_weather_from_api, start_callback=start_fetch_weather)
|
||||
|
||||
tools = [
|
||||
ChatCompletionToolParam(
|
||||
type="function",
|
||||
function={
|
||||
"name": "get_current_weather",
|
||||
"description": "Get the current weather",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"location": {
|
||||
"type": "string",
|
||||
"description": "The city and state, e.g. San Francisco, CA",
|
||||
},
|
||||
"format": {
|
||||
"type": "string",
|
||||
"enum": ["celsius", "fahrenheit"],
|
||||
"description": "The temperature unit to use. Infer this from the users location.",
|
||||
},
|
||||
},
|
||||
"required": ["location", "format"],
|
||||
},
|
||||
},
|
||||
)
|
||||
]
|
||||
messages = [
|
||||
{
|
||||
"role": "system",
|
||||
"content": "You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be converted to audio so don't include special characters in your answers. Respond to what the user said in a creative and helpful way.",
|
||||
},
|
||||
]
|
||||
|
||||
context = OpenAILLMContext(messages, tools)
|
||||
context_aggregator = llm.create_context_aggregator(context)
|
||||
|
||||
pipeline = Pipeline(
|
||||
[
|
||||
transport.input(),
|
||||
context_aggregator.user(),
|
||||
llm,
|
||||
tts,
|
||||
transport.output(),
|
||||
context_aggregator.assistant(),
|
||||
]
|
||||
)
|
||||
|
||||
task = PipelineTask(
|
||||
pipeline,
|
||||
PipelineParams(
|
||||
allow_interruptions=True,
|
||||
enable_metrics=True,
|
||||
enable_usage_metrics=True,
|
||||
),
|
||||
)
|
||||
|
||||
@transport.event_handler("on_first_participant_joined")
|
||||
async def on_first_participant_joined(transport, participant):
|
||||
await transport.capture_participant_transcription(participant["id"])
|
||||
# Kick off the conversation.
|
||||
await task.queue_frames([context_aggregator.user().get_context_frame()])
|
||||
|
||||
runner = PipelineRunner()
|
||||
|
||||
await runner.run(task)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
266
examples/foundational/25-conversation-flow.py
Normal file
266
examples/foundational/25-conversation-flow.py
Normal file
@@ -0,0 +1,266 @@
|
||||
#
|
||||
# Copyright (c) 2024, Daily
|
||||
#
|
||||
# SPDX-License-Identifier: BSD 2-Clause License
|
||||
#
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
|
||||
import aiohttp
|
||||
from dotenv import load_dotenv
|
||||
from loguru import logger
|
||||
from pipecat_flows import FlowManager
|
||||
from runner import configure
|
||||
|
||||
from pipecat.audio.vad.silero import SileroVADAnalyzer
|
||||
from pipecat.pipeline.pipeline import Pipeline
|
||||
from pipecat.pipeline.runner import PipelineRunner
|
||||
from pipecat.pipeline.task import PipelineParams, PipelineTask
|
||||
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
|
||||
from pipecat.services.deepgram import DeepgramSTTService, DeepgramTTSService
|
||||
from pipecat.services.openai import OpenAILLMService
|
||||
from pipecat.transports.services.daily import DailyParams, DailyTransport
|
||||
|
||||
load_dotenv(override=True)
|
||||
|
||||
logger.remove(0)
|
||||
logger.add(sys.stderr, level="DEBUG")
|
||||
|
||||
# Flow Configuration
|
||||
#
|
||||
# This configuration defines a simple food ordering system with the following states:
|
||||
#
|
||||
# 1. start
|
||||
# - Initial state where user chooses between pizza or sushi
|
||||
# - Functions: choose_pizza, choose_sushi
|
||||
# - Transitions to: choose_pizza or choose_sushi
|
||||
#
|
||||
# 2. choose_pizza
|
||||
# - Handles pizza size selection and order confirmation
|
||||
# - Functions:
|
||||
# * select_pizza_size (terminal function, can be called multiple times)
|
||||
# * end (transitions to end node after order confirmation)
|
||||
# - Pre-action: Immediate TTS acknowledgment
|
||||
#
|
||||
# 3. choose_sushi
|
||||
# - Handles sushi roll count selection and order confirmation
|
||||
# - Functions:
|
||||
# * select_roll_count (terminal function, can be called multiple times)
|
||||
# * end (transitions to end node after order confirmation)
|
||||
# - Pre-action: Immediate TTS acknowledgment
|
||||
#
|
||||
# 4. end
|
||||
# - Final state that closes the conversation
|
||||
# - No functions available
|
||||
# - Pre-action: Farewell message
|
||||
# - Post-action: Ends conversation
|
||||
|
||||
flow_config = {
|
||||
"initial_node": "start",
|
||||
"nodes": {
|
||||
"start": {
|
||||
"messages": [
|
||||
{
|
||||
"role": "system",
|
||||
"content": "You are an order-taking assistant. You must ALWAYS use one of the available functions to progress the conversation. For this step, ask the user if they want pizza or sushi, and wait for them to use a function to choose. Start off by greeting them. Be friendly and casual; you're taking an order for food over the phone.",
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "choose_pizza",
|
||||
"description": "User wants to order pizza",
|
||||
"parameters": {"type": "object", "properties": {}},
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "choose_sushi",
|
||||
"description": "User wants to order sushi",
|
||||
"parameters": {"type": "object", "properties": {}},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
"choose_pizza": {
|
||||
"messages": [
|
||||
{
|
||||
"role": "system",
|
||||
"content": """You are handling a pizza order. Use the available functions:
|
||||
- Use select_pizza_size when the user specifies a size (can be used multiple times if they change their mind)
|
||||
- Use the end function ONLY when the user confirms they are done with their order
|
||||
|
||||
After each size selection, confirm the selection and ask if they want to change it or complete their order.
|
||||
Only use the end function after the user confirms they are satisfied with their order.
|
||||
|
||||
Start off by acknowledging the user's choice. Once they've chosen a size, ask if they'd like anything else.
|
||||
Remember to be friendly and casual.""",
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "select_pizza_size",
|
||||
"description": "Record the selected pizza size",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"size": {
|
||||
"type": "string",
|
||||
"enum": ["small", "medium", "large"],
|
||||
"description": "Size of the pizza",
|
||||
}
|
||||
},
|
||||
"required": ["size"],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "end",
|
||||
"description": "Complete the order (use only after user confirms)",
|
||||
"parameters": {"type": "object", "properties": {}},
|
||||
},
|
||||
},
|
||||
],
|
||||
"pre_actions": [
|
||||
{"type": "tts_say", "text": "Ok, let me help you with your pizza order..."}
|
||||
],
|
||||
},
|
||||
"choose_sushi": {
|
||||
"messages": [
|
||||
{
|
||||
"role": "system",
|
||||
"content": """You are handling a sushi order. Use the available functions:
|
||||
- Use select_roll_count when the user specifies how many rolls (can be used multiple times if they change their mind)
|
||||
- Use the end function ONLY when the user confirms they are done with their order
|
||||
|
||||
After each roll count selection, confirm the count and ask if they want to change it or complete their order.
|
||||
Only use the end function after the user confirms they are satisfied with their order.
|
||||
|
||||
Start off by acknowledging the user's choice. Once they've chosen a size, ask if they'd like anything else.
|
||||
Remember to be friendly and casual.""",
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "select_roll_count",
|
||||
"description": "Record the number of sushi rolls",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"count": {
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 10,
|
||||
"description": "Number of rolls to order",
|
||||
}
|
||||
},
|
||||
"required": ["count"],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "end",
|
||||
"description": "Complete the order (use only after user confirms)",
|
||||
"parameters": {"type": "object", "properties": {}},
|
||||
},
|
||||
},
|
||||
],
|
||||
"pre_actions": [
|
||||
{"type": "tts_say", "text": "Ok, let me help you with your sushi order..."}
|
||||
],
|
||||
},
|
||||
"end": {
|
||||
"messages": [
|
||||
{
|
||||
"role": "system",
|
||||
"content": "The order is complete. Thank the user and end the conversation.",
|
||||
}
|
||||
],
|
||||
"functions": [],
|
||||
"pre_actions": [{"type": "tts_say", "text": "Thank you for your order! Goodbye!"}],
|
||||
"post_actions": [{"type": "end_conversation"}],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
async def main():
|
||||
async with aiohttp.ClientSession() as session:
|
||||
(room_url, _) = await configure(session)
|
||||
|
||||
transport = DailyTransport(
|
||||
room_url,
|
||||
None,
|
||||
"Respond bot",
|
||||
DailyParams(
|
||||
audio_out_enabled=True,
|
||||
vad_enabled=True,
|
||||
vad_analyzer=SileroVADAnalyzer(),
|
||||
vad_audio_passthrough=True,
|
||||
),
|
||||
)
|
||||
|
||||
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY"))
|
||||
tts = DeepgramTTSService(api_key=os.getenv("DEEPGRAM_API_KEY"), voice="aura-helios-en")
|
||||
llm = OpenAILLMService(api_key=os.getenv("OPENAI_API_KEY"), model="gpt-4")
|
||||
|
||||
# Get initial tools from the first node
|
||||
initial_tools = flow_config["nodes"]["start"]["functions"]
|
||||
|
||||
# Create initial context
|
||||
messages = [
|
||||
{
|
||||
"role": "system",
|
||||
"content": "You are an order-taking assistant. You must ALWAYS use the available functions to progress the conversation. Never assume an order is complete without the proper function calls. Your responses will be converted to audio so avoid special characters.",
|
||||
}
|
||||
]
|
||||
|
||||
context = OpenAILLMContext(messages, initial_tools)
|
||||
context_aggregator = llm.create_context_aggregator(context)
|
||||
|
||||
pipeline = Pipeline(
|
||||
[
|
||||
transport.input(), # Transport user input
|
||||
stt, # STT
|
||||
context_aggregator.user(), # User responses
|
||||
llm, # LLM
|
||||
tts, # TTS
|
||||
transport.output(), # Transport bot output
|
||||
context_aggregator.assistant(), # Assistant spoken responses
|
||||
]
|
||||
)
|
||||
|
||||
task = PipelineTask(pipeline, PipelineParams(allow_interruptions=True))
|
||||
|
||||
# Initialize flow manager
|
||||
flow_manager = FlowManager(flow_config, task, tts)
|
||||
|
||||
# Register functions with LLM service
|
||||
await flow_manager.register_functions(llm)
|
||||
|
||||
@transport.event_handler("on_first_participant_joined")
|
||||
async def on_first_participant_joined(transport, participant):
|
||||
await transport.capture_participant_transcription(participant["id"])
|
||||
# Initialize the flow processor
|
||||
await flow_manager.initialize(messages)
|
||||
# Kick off the conversation using the context aggregator
|
||||
await task.queue_frames([context_aggregator.user().get_context_frame()])
|
||||
|
||||
runner = PipelineRunner()
|
||||
await runner.run(task)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
552
examples/foundational/bigly.py
Normal file
552
examples/foundational/bigly.py
Normal file
@@ -0,0 +1,552 @@
|
||||
#### run from in pipecat/examples/foundational
|
||||
|
||||
|
||||
#
|
||||
# Copyright (c) 2024, Daily
|
||||
#
|
||||
# SPDX-License-Identifier: BSD 2-Clause License
|
||||
#
|
||||
|
||||
import argparse
|
||||
import asyncio
|
||||
import os
|
||||
import random
|
||||
import sys
|
||||
|
||||
import aiohttp
|
||||
import requests
|
||||
from dotenv import load_dotenv
|
||||
from loguru import logger
|
||||
from openai.types.chat import ChatCompletionToolParam
|
||||
from runner import configure
|
||||
|
||||
from pipecat.audio.vad.silero import SileroVADAnalyzer, VADParams
|
||||
from pipecat.frames.frames import (
|
||||
EndFrame,
|
||||
Frame,
|
||||
LLMMessagesFrame,
|
||||
StartInterruptionFrame,
|
||||
StopInterruptionFrame,
|
||||
TextFrame,
|
||||
)
|
||||
from pipecat.pipeline.pipeline import Pipeline
|
||||
from pipecat.pipeline.runner import PipelineRunner
|
||||
from pipecat.pipeline.task import PipelineParams, PipelineTask
|
||||
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
|
||||
from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
|
||||
from pipecat.services.cartesia import CartesiaTTSService
|
||||
from pipecat.services.deepgram import DeepgramSTTService
|
||||
from pipecat.services.openai import OpenAILLMService
|
||||
from pipecat.transports.services.daily import DailyParams, DailyTransport
|
||||
from pipecat.transports.services.helpers.daily_rest import DailyRESTHelper
|
||||
|
||||
load_dotenv(override=True)
|
||||
|
||||
logger.remove(0)
|
||||
logger.add(sys.stderr, level="DEBUG")
|
||||
PARTICIPANT_ID = [""] # this will get filled in later
|
||||
|
||||
DEEPGRAM_API_KEY = os.getenv("DEEPGRAM_API_KEY")
|
||||
print(f"_____bigly.py * DEEPGRAM_API_KEY: {DEEPGRAM_API_KEY}")
|
||||
DAILY_API_KEY = os.getenv("DAILY_BOTS_API_KEY")
|
||||
CARTESIA_API_KEY = os.getenv("CARTESIA_API_KEY")
|
||||
|
||||
DAILY_ROOM_NAME = "bigs" #### ENSURE THIS ROOM HAS enable_dialout SET (and exp)
|
||||
|
||||
TO = "+12097135125" # Daily bot that pretends to be a customer asking about solar panels
|
||||
# FROM_DAILY_CALLER_ID = "+13373378501"
|
||||
|
||||
QUESTION_AFFIRMATION = [
|
||||
"Excellent question!",
|
||||
"That's a solid question!",
|
||||
"Good question!",
|
||||
"Great question!",
|
||||
"I am glad you asked that!",
|
||||
]
|
||||
VOICEMAIL_EXAMPLES = [
|
||||
"We are sorry, there is noone available to take your call...",
|
||||
"Please leave a message for ",
|
||||
"Please leave your name and phone and I'll get back to you as soon as I can",
|
||||
"Your call has been forwarded to voicemail, the person you are trying to reach is not available",
|
||||
"The person you're trying to reach is not available",
|
||||
"Hey, it's (user's name) leave a message",
|
||||
"Hey you reached (user's name), please leave a message",
|
||||
"Hi/Hey I'm not available please leave a message",
|
||||
"The number you're trying to reach...",
|
||||
"I'll get back to you as soon as possible",
|
||||
"This voicemail is not receiving any messages",
|
||||
"My VM is full so If you need to reach me, please text me",
|
||||
"Leave a message and I'll call you back",
|
||||
"You've reached my cell phone, I'm not available",
|
||||
"We are sorry, there is noneone available to take your call...",
|
||||
]
|
||||
|
||||
|
||||
class DebugProcessor(FrameProcessor):
|
||||
def __init__(self, name, **kwargs):
|
||||
self._name = name
|
||||
super().__init__(**kwargs)
|
||||
|
||||
async def process_frame(self, frame: Frame, direction: FrameDirection):
|
||||
await super().process_frame(frame, direction)
|
||||
# if not (
|
||||
# isinstance(frame, InputAudioRawFrame)
|
||||
# or isinstance(frame, BotSpeakingFrame)
|
||||
# or isinstance(frame, UserStoppedSpeakingFrame)
|
||||
# or isinstance(frame, TTSAudioRawFrame)
|
||||
# or isinstance(frame, TextFrame)
|
||||
# ):
|
||||
# logger.debug(f"--- DebugProcessor {self._name}: {frame} {direction}")
|
||||
# StopInterruptionFrame
|
||||
if isinstance(frame, StopInterruptionFrame) or isinstance(frame, StartInterruptionFrame):
|
||||
logger.debug(f"--- DebugProcessor {self._name}: {frame} {direction}")
|
||||
|
||||
await self.push_frame(frame, direction)
|
||||
|
||||
|
||||
async def configure(aiohttp_session: aiohttp.ClientSession):
|
||||
(url, token, _) = await configure_with_args(aiohttp_session)
|
||||
return (url, token)
|
||||
|
||||
|
||||
async def configure_with_args(
|
||||
aiohttp_session: aiohttp.ClientSession, parser: argparse.ArgumentParser | None = None
|
||||
):
|
||||
if not parser:
|
||||
parser = argparse.ArgumentParser(description="Daily AI SDK Bot Sample")
|
||||
parser.add_argument(
|
||||
"-u", "--url", type=str, required=False, help="URL of the Daily room to join"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-k",
|
||||
"--apikey",
|
||||
type=str,
|
||||
required=False,
|
||||
help="Daily API Key (needed to create an owner token for the room)",
|
||||
)
|
||||
|
||||
args, unknown = parser.parse_known_args()
|
||||
|
||||
#####
|
||||
url = f"https://pc-5b722fad4e9b47df8faa50cf3626267d.daily.co/{DAILY_ROOM_NAME}"
|
||||
# url = f"https://biglysales-team.daily.co/{DAILY_ROOM_NAME}"
|
||||
key = DAILY_API_KEY
|
||||
print(f"_____bigly.py * key: {key}")
|
||||
|
||||
if not url:
|
||||
raise Exception(
|
||||
"No Daily room specified. use the -u/--url option from the command line, or set DAILY_SAMPLE_ROOM_URL in your environment to specify a Daily room URL."
|
||||
)
|
||||
|
||||
if not key:
|
||||
raise Exception(
|
||||
"No Daily API key specified. use the -k/--apikey option from the command line, or set DAILY_API_KEY in your environment to specify a Daily API key, available from https://dashboard.daily.co/developers."
|
||||
)
|
||||
|
||||
daily_rest_helper = DailyRESTHelper(
|
||||
daily_api_key=key,
|
||||
daily_api_url=os.getenv("DAILY_API_URL", "https://api.daily.co/v1"),
|
||||
aiohttp_session=aiohttp_session,
|
||||
)
|
||||
|
||||
# Create a meeting token for the given room with an expiration 1 hour in
|
||||
# the future.
|
||||
expiry_time: float = 60 * 60
|
||||
|
||||
token = await daily_rest_helper.get_token(url, expiry_time)
|
||||
print(f"_____bigly.py * token: {token}")
|
||||
|
||||
return (url, token, args)
|
||||
|
||||
|
||||
async def cancel_transport_input_task(transport_input) -> None:
|
||||
transport_input._audio_task.cancel()
|
||||
await transport_input._audio_task
|
||||
|
||||
|
||||
def get_cartesia_static_response(text: str, voice_id: str, model_id: str, **kwargs) -> bytes:
|
||||
"""
|
||||
Makes an API call to Cartesia to generate TTS audio bytes.
|
||||
|
||||
Args:
|
||||
text (str): The transcript text.
|
||||
voice_id (str): The ID of the voice to be used.
|
||||
model_id (str): The model ID for the TTS request.
|
||||
**kwargs: Additional parameters like output format.
|
||||
|
||||
Returns:
|
||||
bytes: The audio bytes returned by the API.
|
||||
|
||||
Raises:
|
||||
ValueError: If the API request fails.
|
||||
"""
|
||||
try:
|
||||
output_format = kwargs.get("output_format")
|
||||
response = requests.post(
|
||||
"https://api.cartesia.ai/tts/bytes",
|
||||
headers={
|
||||
"X-API-Key": CARTESIA_API_KEY,
|
||||
"Cartesia-Version": "2024-06-10",
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
json={
|
||||
"model_id": model_id,
|
||||
"transcript": text,
|
||||
"voice": {"mode": "id", "id": voice_id},
|
||||
"output_format": output_format,
|
||||
},
|
||||
)
|
||||
response.raise_for_status()
|
||||
logger.info("Cartesia TTS response cached.")
|
||||
return response.content
|
||||
except Exception as error:
|
||||
logger.opt(exception=True).error("Error Occurred while getting Audio Bytes from Cartesia")
|
||||
raise error
|
||||
|
||||
|
||||
async def say_agent_response(
|
||||
end_response,
|
||||
transport,
|
||||
audio_end_buffer: float,
|
||||
cancel_input_audio: bool = True,
|
||||
) -> None:
|
||||
"""
|
||||
Sends the agent's audio response via the specified transport and adds a buffer delay after playback.
|
||||
Optionally cancels any ongoing audio input tasks before playing the response.
|
||||
|
||||
Args:
|
||||
end_response (bytes): The audio response to be played.
|
||||
transport (Union[DailyTransport, FastAPIWebsocketTransport]): The transport handling audio I/O.
|
||||
audio_end_buffer (int): Time (in seconds) to wait after playing the audio.
|
||||
cancel_input_audio (bool, optional): Whether to cancel ongoing audio input tasks. Defaults to True.
|
||||
|
||||
Retries:
|
||||
Retries up to 3 times in case of an exception, with a 2-second delay between attempts.
|
||||
"""
|
||||
try:
|
||||
if cancel_input_audio and transport:
|
||||
logger.info("Canceling the Audio Input Task")
|
||||
await cancel_transport_input_task(transport._input)
|
||||
await transport._output.write_raw_audio_frames(end_response)
|
||||
await asyncio.sleep(audio_end_buffer)
|
||||
except AttributeError:
|
||||
logger.info("Audio Input Transport already cancelled")
|
||||
except Exception as error:
|
||||
logger.opt(exception=True).error("Error Occurred while Uttering Agent Response.")
|
||||
raise error
|
||||
|
||||
|
||||
async def get_meeting_dates(
|
||||
function_name: str,
|
||||
tool_call_id: str,
|
||||
_args,
|
||||
llm,
|
||||
context: OpenAILLMContext,
|
||||
result_callback,
|
||||
) -> None:
|
||||
logger.info("Invoking `get_meeting_dates` tool with argument {_args}", _args=_args)
|
||||
|
||||
await asyncio.sleep(30)
|
||||
await result_callback("""
|
||||
"1- 8AM Eastern on November 16 2024\n\n2- 9AM Eastern on November 16 2024\n\n3- 10AM Eastern on November 16 2024\n\n4- 11AM Eastern on November 16 2024\n\n5- 12PM Eastern on November 16 2024\n\n6- 1PM Eastern on November 16 2024\n\n7- 2PM Eastern on November 16 2024\n\n8- 3PM Eastern on November 16 2024\n\n9- 4PM Eastern on November 16 2024\n\n10- 5PM Eastern on November 16 2024\n\n11- 6PM Eastern on November 16 2024\n\n12- 7PM Eastern on November 16 2024\n\n"
|
||||
""")
|
||||
|
||||
|
||||
async def transfer_call(
|
||||
function_name: str,
|
||||
tool_call_id: str,
|
||||
_args,
|
||||
llm,
|
||||
context: OpenAILLMContext,
|
||||
result_callback,
|
||||
) -> None:
|
||||
print(f"_____bigly.py * transfer_call * _args: {_args}")
|
||||
await result_callback("CALL TRANSFERED")
|
||||
|
||||
|
||||
async def voicemail(
|
||||
function_name: str, tool_call_id: str, _args, llm, context, result_callback, transport
|
||||
) -> None:
|
||||
logger.info("Invoking `voicemail` tool with argument {_args}", _args=_args)
|
||||
await transport.stop_dialout(PARTICIPANT_ID[0])
|
||||
await result_callback("VOICEMAIL DETECTED")
|
||||
|
||||
|
||||
async def get_knowledge_base(
|
||||
function_name: str, tool_call_id: str, _args, llm, context: OpenAILLMContext, result_callback
|
||||
) -> None:
|
||||
logger.info("Invoking `get_knowledge_base` tool with argument {_args}", _args=_args)
|
||||
|
||||
kb_call_reason = _args.get("reason", "GENERAL_QUESTION")
|
||||
if kb_call_reason == "GENERAL_QUESTION":
|
||||
# await llm.push_frame("aldkjfls oaogi8ovs(*YVSDY*( &*Tqr))")
|
||||
await llm.push_frame(TextFrame(random.choice(QUESTION_AFFIRMATION)))
|
||||
await result_callback(
|
||||
"""Sure! Here are some random facts that could be associated with a solar panel company: 1. **History**: The company was founded in 2008 by a group of renewable energy enthusiasts who wanted to make solar power more accessible to homeowners and businesses. 2. **Headquarters**: Their headquarters is a net-zero energy building powered entirely by their own solar panels, showcasing their commitment to sustainability. 3. **Products**: They produce three main types of solar panels: monocrystalline, polycrystalline, and thin-film, catering to different customer needs and budgets. 4. **Innovation**: The company holds patents for advanced solar cell technology that increases efficiency by 20% compared to industry standards. 5. **Global Reach**: They have installed solar systems in over 40 countries and have manufacturing plants on three continents.6. **Community Impact**: For every 100 solar panels sold, they donate a panel to a school or community center in underprivileged areas. 7. **Workforce**: The company employs over 5,000 people, 40% of whom are in research and development roles. 8. **Recognition**: They won the “Green Energy Innovator of the Year” award in 2022 for their work on solar panels made from recycled materials. 9. **Sustainability**: Their panels are designed to last 25+ years and are 95% recyclable at the end of their life cycle. 10. **Customer Perks**: They offer a 25-year warranty and real-time monitoring systems that allow users to track energy production via an app. 11. **Mission Statement**: "Empowering the world with clean energy, one panel at a time." 12. **Energy Production**: The combined output of all their installations generates enough electricity to power over 2 million homes annually. 13. **R&D Efforts**: They are actively working on integrating solar panels into everyday items like backpacks and electric vehicles. 14. **Solar Farms**: The company has partnered with governments to develop large-scale solar farms, including one that spans over 10,000 acres. 15. **Future Goals**: By 2030, they aim to make solar power the most affordable energy source worldwide. Would you like these customized for a specific scenario?"""
|
||||
)
|
||||
# raise RuntimeError("<><><><><>get_knowledge_base")
|
||||
|
||||
|
||||
async def end_call(
|
||||
function_name: str,
|
||||
tool_call_id: str,
|
||||
_args,
|
||||
llm,
|
||||
context: OpenAILLMContext,
|
||||
result_callback,
|
||||
voice_provider: str,
|
||||
voice_id: str,
|
||||
transport: DailyTransport,
|
||||
) -> None:
|
||||
logger.info("Invoking `end_call` tool with argument {_args}", _args=_args)
|
||||
end_call_sentence = _args.get("end_call_sentence", "Thank you for your time have a great day")
|
||||
estimated_time_end_call_sentence = 15
|
||||
logger.info(
|
||||
"Estimated End Call Sentence Time is {estimated_time_end_call_sentence}",
|
||||
estimated_time_end_call_sentence=estimated_time_end_call_sentence,
|
||||
)
|
||||
await llm.push_frame(TextFrame(end_call_sentence))
|
||||
await transport.stop_dialout(PARTICIPANT_ID[0])
|
||||
await result_callback("CALL ENDED BY ASSISTANT")
|
||||
|
||||
|
||||
async def main():
|
||||
async with aiohttp.ClientSession() as session:
|
||||
(room_url, token) = await configure(session)
|
||||
stt = DeepgramSTTService(
|
||||
api_key=DEEPGRAM_API_KEY,
|
||||
audio_passthrough=False,
|
||||
)
|
||||
transport = DailyTransport(
|
||||
room_url,
|
||||
token,
|
||||
"Test-Bot",
|
||||
DailyParams(
|
||||
api_key=DAILY_API_KEY,
|
||||
audio_in_enabled=True,
|
||||
audio_out_enabled=True,
|
||||
vad_audio_passthrough=True,
|
||||
vad_enabled=True,
|
||||
transcription_enabled=False,
|
||||
vad_analyzer=SileroVADAnalyzer(params=VADParams(start_secs=0.2)),
|
||||
),
|
||||
)
|
||||
print(f"_____bigly.py * transport: {transport}")
|
||||
|
||||
tts = CartesiaTTSService(
|
||||
api_key=CARTESIA_API_KEY,
|
||||
voice_id="7360f116-6306-4e9a-b487-1235f35a0f21",
|
||||
)
|
||||
|
||||
llm = OpenAILLMService(api_key=os.environ["OPENAI_API_KEY"], model="gpt-4o")
|
||||
llm.register_function("get_knowledge_base", get_knowledge_base)
|
||||
# llm.register_function(
|
||||
# "end_call",
|
||||
# partial(
|
||||
# end_call,
|
||||
# transport=transport,
|
||||
# voice_provider="cartesia",
|
||||
# voice_id="7360f116-6306-4e9a-b487-1235f35a0f21",
|
||||
# ),
|
||||
# )
|
||||
# llm.register_function("transfer_call", transfer_call)
|
||||
# llm.register_function("voicemail", partial(voicemail, transport=transport))
|
||||
llm.register_function("get_meeting_dates", get_meeting_dates)
|
||||
|
||||
tools = [
|
||||
ChatCompletionToolParam(
|
||||
type="function",
|
||||
function={
|
||||
"name": "get_knowledge_base",
|
||||
"description": """""
|
||||
Used to find information from the knowledge base. Use this tool in the following scenarios:
|
||||
- When the user asks questions about the company.
|
||||
- If you need to convince the user to purchase solar panels.
|
||||
|
||||
IMPORTANT: ALWAYS call this tool after EVERY question the user asks.
|
||||
""",
|
||||
"strict": True, # type: ignore[typeddict-unknown-key]
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"question": {
|
||||
"type": "string",
|
||||
"description": "The question the user asked.",
|
||||
},
|
||||
"reason": {
|
||||
"type": "string",
|
||||
"enum": ["CONVINCE", "GENERAL_QUESTION"],
|
||||
"description": "Reason why you are using this tool. This can only be one of the category: `CONVINCE`, `GENERAL_QUESTION`.\
|
||||
`CONVINCE` would be in case you are convincing the user otherwise it is `GENERAL_QUESTION`",
|
||||
},
|
||||
},
|
||||
"additionalProperties": False,
|
||||
"required": ["question", "reason"],
|
||||
},
|
||||
},
|
||||
),
|
||||
# ChatCompletionToolParam(
|
||||
# type="function",
|
||||
# function={
|
||||
# "name": "end_call",
|
||||
# "description": "Use this tool to end the call",
|
||||
# "strict": True, # type: ignore[typeddict-unknown-key]
|
||||
# "parameters": {
|
||||
# "type": "object",
|
||||
# "properties": {
|
||||
# "end_call_sentence": {
|
||||
# "type": "string",
|
||||
# "description": "The End Call Sentence that needs to be utter by the AI",
|
||||
# }
|
||||
# },
|
||||
# "additionalProperties": False,
|
||||
# "required": ["end_call_sentence"],
|
||||
# },
|
||||
# },
|
||||
# ),
|
||||
# ChatCompletionToolParam(
|
||||
# type="function",
|
||||
# function={
|
||||
# "name": "transfer_call",
|
||||
# "description": "Use this tool to transfer the call",
|
||||
# "strict": True, # type: ignore[typeddict-unknown-key]
|
||||
# "parameters": {
|
||||
# "type": "object",
|
||||
# "properties": {
|
||||
# "transfer_number_sentence": {
|
||||
# "type": "string",
|
||||
# "description": "The sentence that AI needs to speak before transfering the call",
|
||||
# },
|
||||
# "transfer_number": {
|
||||
# "type": "string",
|
||||
# "description": "The number to use to which we need transfer the call",
|
||||
# },
|
||||
# },
|
||||
# "additionalProperties": False,
|
||||
# "required": ["transfer_number", "transfer_number_sentence"],
|
||||
# },
|
||||
# },
|
||||
# ),
|
||||
# ChatCompletionToolParam(
|
||||
# type="function",
|
||||
# function={
|
||||
# "name": "voicemail",
|
||||
# "description": f"Use this tool if you reach voicemail. Here is some examples: {'\n'.join(VOICEMAIL_EXAMPLES)}",
|
||||
# "parameters": {},
|
||||
# },
|
||||
# ),
|
||||
ChatCompletionToolParam(
|
||||
type="function",
|
||||
function={
|
||||
"name": "get_meeting_dates",
|
||||
"description": "Use this tool to get the meeting dates in order to schedule a meeting date with the user. The output of this\
|
||||
tool are slots which you need to recommend to the user. The slots are given in numerical list in ascending order\
|
||||
(earlier slots to later slots)",
|
||||
"parameters": {},
|
||||
},
|
||||
),
|
||||
]
|
||||
messages = [
|
||||
{
|
||||
"role": "system",
|
||||
"content": """You are a friendly sales person for a solar panel company. Your responses will be converted to audio. Please do not include any special characters in your response other than '!' or '?'. """,
|
||||
},
|
||||
]
|
||||
|
||||
context = OpenAILLMContext(messages, tools)
|
||||
context_aggregator = llm.create_context_aggregator(context)
|
||||
|
||||
dp_post_llm = DebugProcessor("post_llm")
|
||||
dp_post_tts = DebugProcessor("post_tts")
|
||||
|
||||
pipeline = Pipeline(
|
||||
[
|
||||
transport.input(), # Transport user input
|
||||
stt,
|
||||
context_aggregator.user(), # User responses
|
||||
llm, # LLM
|
||||
dp_post_llm, # Debug Processor
|
||||
tts, # TTS
|
||||
dp_post_tts, # Debug Processor
|
||||
transport.output(), # Transport bot output
|
||||
context_aggregator.assistant(), # Assistant spoken responses
|
||||
]
|
||||
)
|
||||
|
||||
task = PipelineTask(
|
||||
pipeline,
|
||||
PipelineParams(
|
||||
allow_interruptions=True,
|
||||
enable_metrics=False, ####
|
||||
enable_usage_metrics=False, #####
|
||||
report_only_initial_ttfb=True,
|
||||
),
|
||||
)
|
||||
|
||||
# @transport.event_handler("on_call_state_updated")
|
||||
# async def on_call_state_updated(transport, state: str) -> None:
|
||||
# logger.info("Call State Updated, state: {state}", state=state)
|
||||
|
||||
# async def _dialout_retry_handler() -> None:
|
||||
# try:
|
||||
# for i in range(3):
|
||||
# logger.info("Attempting a Dial-Out, Attempt: {attempt}", attempt=i + 1)
|
||||
# await transport.start_dialout(
|
||||
# {"phoneNumber": TO, "video": False}
|
||||
# # {"phoneNumber": TO, "callerId": FROM_DAILY_CALLER_ID, "video": False}
|
||||
# )
|
||||
# await asyncio.sleep(15)
|
||||
# current_participant_count = transport.participant_counts()
|
||||
# if current_participant_count["present"] >= 2:
|
||||
# return
|
||||
# raise Exception("Unable to perform a dial-out for Daily-Co ROOM")
|
||||
# except Exception as e:
|
||||
# raise e
|
||||
|
||||
# async def _dialout_task_exception(task: asyncio.Task) -> None:
|
||||
# if task.exception():
|
||||
# await task.queue_frames([EndFrame()])
|
||||
# else:
|
||||
# logger.info("Dial-out completed successfully.")
|
||||
|
||||
# def _handle_dialout_completion(task: asyncio.Task) -> None:
|
||||
# asyncio.create_task(_dialout_task_exception(task))
|
||||
|
||||
# if state == "joined":
|
||||
# task = transport.input().get_event_loop().create_task(_dialout_retry_handler())
|
||||
# task.add_done_callback(_handle_dialout_completion)
|
||||
|
||||
# Event handler for on_first_participant_joined
|
||||
@transport.event_handler("on_first_participant_joined")
|
||||
async def on_first_participant_joined(transport, participant) -> None:
|
||||
logger.info(
|
||||
"First Participant Joined with ID {participant_id}",
|
||||
participant_id=participant["id"],
|
||||
)
|
||||
# PARTICIPANT_ID[0] = participant["id"]
|
||||
# await transport.capture_participant_transcription(participant["id"])
|
||||
|
||||
@transport.event_handler("on_dialout_error")
|
||||
async def on_dialout_error(transport, cdata) -> None:
|
||||
logger.info("Dial-Out error: {data}", data=cdata)
|
||||
await task.queue_frames([LLMMessagesFrame(messages)])
|
||||
|
||||
# Event handler for on_dialout_answered
|
||||
# @transport.event_handler("on_dialout_answered")
|
||||
# async def on_dialout_answered(transport, cdata) -> None:
|
||||
# logger.info("Dial-Out Answered with data as follow: {data}", data=cdata)
|
||||
# await task.queue_frames([LLMMessagesFrame(messages)])
|
||||
|
||||
# Event handler for on_participant_left
|
||||
@transport.event_handler("on_participant_left")
|
||||
async def on_participant_left(transport, participant, reason) -> None:
|
||||
logger.info("Following Participant Left {participant}", participant=participant)
|
||||
await task.queue_frames([EndFrame()])
|
||||
|
||||
runner = PipelineRunner()
|
||||
|
||||
await runner.run(task)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
509
examples/foundational/bigly_original.py
Normal file
509
examples/foundational/bigly_original.py
Normal file
@@ -0,0 +1,509 @@
|
||||
#### run from in pipecat/examples/foundational
|
||||
|
||||
|
||||
#
|
||||
# Copyright (c) 2024, Daily
|
||||
#
|
||||
# SPDX-License-Identifier: BSD 2-Clause License
|
||||
#
|
||||
|
||||
import argparse
|
||||
import asyncio
|
||||
import os
|
||||
import random
|
||||
import sys
|
||||
from functools import partial
|
||||
|
||||
import aiohttp
|
||||
import requests
|
||||
from dotenv import load_dotenv
|
||||
from loguru import logger
|
||||
from openai.types.chat import ChatCompletionToolParam
|
||||
from runner import configure
|
||||
|
||||
from pipecat.audio.vad.silero import SileroVADAnalyzer, VADParams
|
||||
from pipecat.frames.frames import EndFrame, LLMMessagesFrame, TextFrame
|
||||
from pipecat.pipeline.pipeline import Pipeline
|
||||
from pipecat.pipeline.runner import PipelineRunner
|
||||
from pipecat.pipeline.task import PipelineParams, PipelineTask
|
||||
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
|
||||
from pipecat.services.cartesia import CartesiaTTSService
|
||||
from pipecat.services.deepgram import DeepgramSTTService
|
||||
from pipecat.services.openai import OpenAILLMService
|
||||
from pipecat.transports.services.daily import DailyParams, DailyTransport
|
||||
from pipecat.transports.services.helpers.daily_rest import DailyRESTHelper
|
||||
from pipecat.transports.services.helpers.daily_rest import DailyRESTHelper
|
||||
|
||||
load_dotenv(override=True)
|
||||
|
||||
logger.remove(0)
|
||||
logger.add(sys.stderr, level="DEBUG")
|
||||
PARTICIPANT_ID = [""] # this will get filled in later
|
||||
|
||||
DEEPGRAM_API_KEY = os.getenv("DEEPGRAM_API_KEY")
|
||||
DAILY_API_KEY = os.getenv("DAILY_API_KEY")
|
||||
CARTESIA_API_KEY = os.getenv("CARTESIA_API_KEY")
|
||||
|
||||
DAILY_ROOM_NAME = "bigs" #### ENSURE THIS ROOM HAS enable_dialout SET (and exp)
|
||||
|
||||
TO = "+12097135125"
|
||||
# FROM_DAILY_CALLER_ID = "+13373378501"
|
||||
|
||||
QUESTION_AFFIRMATION = [
|
||||
"Excellent question!",
|
||||
"That's a solid question!",
|
||||
"Good question!",
|
||||
"Great question!",
|
||||
"I am glad you asked that!",
|
||||
]
|
||||
VOICEMAIL_EXAMPLES = [
|
||||
"We are sorry, there is noone available to take your call...",
|
||||
"Please leave a message for ",
|
||||
"Please leave your name and phone and I'll get back to you as soon as I can",
|
||||
"Your call has been forwarded to voicemail, the person you are trying to reach is not available",
|
||||
"The person you're trying to reach is not available",
|
||||
"Hey, it's (user's name) leave a message",
|
||||
"Hey you reached (user's name), please leave a message",
|
||||
"Hi/Hey I'm not available please leave a message",
|
||||
"The number you're trying to reach...",
|
||||
"I'll get back to you as soon as possible",
|
||||
"This voicemail is not receiving any messages",
|
||||
"My VM is full so If you need to reach me, please text me",
|
||||
"Leave a message and I'll call you back",
|
||||
"You've reached my cell phone, I'm not available",
|
||||
"We are sorry, there is noneone available to take your call...",
|
||||
]
|
||||
|
||||
async def configure(aiohttp_session: aiohttp.ClientSession):
|
||||
(url, token, _) = await configure_with_args(aiohttp_session)
|
||||
return (url, token)
|
||||
|
||||
|
||||
async def configure_with_args(
|
||||
aiohttp_session: aiohttp.ClientSession, parser: argparse.ArgumentParser | None = None
|
||||
):
|
||||
if not parser:
|
||||
parser = argparse.ArgumentParser(description="Daily AI SDK Bot Sample")
|
||||
parser.add_argument(
|
||||
"-u", "--url", type=str, required=False, help="URL of the Daily room to join"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-k",
|
||||
"--apikey",
|
||||
type=str,
|
||||
required=False,
|
||||
help="Daily API Key (needed to create an owner token for the room)",
|
||||
)
|
||||
|
||||
args, unknown = parser.parse_known_args()
|
||||
|
||||
#####
|
||||
url = f"https://hush.daily.co/{DAILY_ROOM_NAME}"
|
||||
# url = f"https://biglysales-team.daily.co/{DAILY_ROOM_NAME}"
|
||||
key = DAILY_API_KEY
|
||||
print(f"_____bigly.py * key: {key}")
|
||||
|
||||
if not url:
|
||||
raise Exception(
|
||||
"No Daily room specified. use the -u/--url option from the command line, or set DAILY_SAMPLE_ROOM_URL in your environment to specify a Daily room URL."
|
||||
)
|
||||
|
||||
if not key:
|
||||
raise Exception(
|
||||
"No Daily API key specified. use the -k/--apikey option from the command line, or set DAILY_API_KEY in your environment to specify a Daily API key, available from https://dashboard.daily.co/developers."
|
||||
)
|
||||
|
||||
daily_rest_helper = DailyRESTHelper(
|
||||
daily_api_key=key,
|
||||
daily_api_url=os.getenv("DAILY_API_URL", "https://api.daily.co/v1"),
|
||||
aiohttp_session=aiohttp_session,
|
||||
)
|
||||
|
||||
# Create a meeting token for the given room with an expiration 1 hour in
|
||||
# the future.
|
||||
expiry_time: float = 60 * 60
|
||||
|
||||
token = await daily_rest_helper.get_token(url, expiry_time)
|
||||
print(f"_____bigly.py * token: {token}")
|
||||
|
||||
return (url, token, args)
|
||||
|
||||
|
||||
async def cancel_transport_input_task(transport_input) -> None:
|
||||
transport_input._audio_task.cancel()
|
||||
await transport_input._audio_task
|
||||
|
||||
def get_cartesia_static_response(text: str, voice_id: str, model_id: str, **kwargs) -> bytes:
|
||||
"""
|
||||
Makes an API call to Cartesia to generate TTS audio bytes.
|
||||
|
||||
Args:
|
||||
text (str): The transcript text.
|
||||
voice_id (str): The ID of the voice to be used.
|
||||
model_id (str): The model ID for the TTS request.
|
||||
**kwargs: Additional parameters like output format.
|
||||
|
||||
Returns:
|
||||
bytes: The audio bytes returned by the API.
|
||||
|
||||
Raises:
|
||||
ValueError: If the API request fails.
|
||||
"""
|
||||
try:
|
||||
output_format = kwargs.get("output_format")
|
||||
response = requests.post(
|
||||
"https://api.cartesia.ai/tts/bytes",
|
||||
headers={"X-API-Key": CARTESIA_API_KEY, "Cartesia-Version": "2024-06-10", "Content-Type": "application/json"},
|
||||
json={
|
||||
"model_id": model_id,
|
||||
"transcript": text,
|
||||
"voice": {"mode": "id", "id": voice_id},
|
||||
"output_format": output_format,
|
||||
},
|
||||
)
|
||||
response.raise_for_status()
|
||||
logger.info("Cartesia TTS response cached.")
|
||||
return response.content
|
||||
except Exception as error:
|
||||
logger.opt(exception=True).error("Error Occurred while getting Audio Bytes from Cartesia")
|
||||
raise error
|
||||
|
||||
|
||||
async def say_agent_response(
|
||||
end_response,
|
||||
transport,
|
||||
audio_end_buffer: float,
|
||||
cancel_input_audio: bool = True,
|
||||
) -> None:
|
||||
"""
|
||||
Sends the agent's audio response via the specified transport and adds a buffer delay after playback.
|
||||
Optionally cancels any ongoing audio input tasks before playing the response.
|
||||
|
||||
Args:
|
||||
end_response (bytes): The audio response to be played.
|
||||
transport (Union[DailyTransport, FastAPIWebsocketTransport]): The transport handling audio I/O.
|
||||
audio_end_buffer (int): Time (in seconds) to wait after playing the audio.
|
||||
cancel_input_audio (bool, optional): Whether to cancel ongoing audio input tasks. Defaults to True.
|
||||
|
||||
Retries:
|
||||
Retries up to 3 times in case of an exception, with a 2-second delay between attempts.
|
||||
"""
|
||||
try:
|
||||
if cancel_input_audio and transport:
|
||||
logger.info("Canceling the Audio Input Task")
|
||||
await cancel_transport_input_task(transport._input)
|
||||
await transport._output.write_raw_audio_frames(end_response)
|
||||
await asyncio.sleep(audio_end_buffer)
|
||||
except AttributeError:
|
||||
logger.info("Audio Input Transport already cancelled")
|
||||
except Exception as error:
|
||||
logger.opt(exception=True).error("Error Occurred while Uttering Agent Response.")
|
||||
raise error
|
||||
|
||||
async def get_meeting_dates(
|
||||
function_name: str,
|
||||
tool_call_id: str,
|
||||
_args,
|
||||
llm,
|
||||
context: OpenAILLMContext,
|
||||
result_callback,
|
||||
) -> None:
|
||||
logger.info("Invoking `get_meeting_dates` tool with argument {_args}", _args=_args)
|
||||
await result_callback("""
|
||||
"1- 8AM Eastern on November 16 2024\n\n2- 9AM Eastern on November 16 2024\n\n3- 10AM Eastern on November 16 2024\n\n4- 11AM Eastern on November 16 2024\n\n5- 12PM Eastern on November 16 2024\n\n6- 1PM Eastern on November 16 2024\n\n7- 2PM Eastern on November 16 2024\n\n8- 3PM Eastern on November 16 2024\n\n9- 4PM Eastern on November 16 2024\n\n10- 5PM Eastern on November 16 2024\n\n11- 6PM Eastern on November 16 2024\n\n12- 7PM Eastern on November 16 2024\n\n"
|
||||
""")
|
||||
|
||||
|
||||
async def transfer_call(
|
||||
function_name: str,
|
||||
tool_call_id: str,
|
||||
_args,
|
||||
llm,
|
||||
context: OpenAILLMContext,
|
||||
result_callback,
|
||||
) -> None:
|
||||
await result_callback("CALL TRANSFERED")
|
||||
|
||||
|
||||
async def voicemail(
|
||||
function_name: str,
|
||||
tool_call_id: str,
|
||||
_args,
|
||||
llm,
|
||||
context,
|
||||
result_callback,
|
||||
transport
|
||||
) -> None:
|
||||
logger.info("Invoking `voicemail` tool with argument {_args}", _args=_args)
|
||||
await transport.stop_dialout(PARTICIPANT_ID[0])
|
||||
await result_callback("VOICEMAIL DETECTED")
|
||||
|
||||
|
||||
async def get_knowledge_base(
|
||||
function_name: str, tool_call_id: str, _args, llm, context: OpenAILLMContext, result_callback
|
||||
) -> None:
|
||||
logger.info("Invoking `get_knowledge_base` tool with argument {_args}", _args=_args)
|
||||
|
||||
kb_call_reason = _args.get("reason", "GENERAL_QUESTION")
|
||||
if kb_call_reason == "GENERAL_QUESTION":
|
||||
# await llm.push_frame("aldkjfls oaogi8ovs(*YVSDY*( &*Tqr))")
|
||||
await llm.push_frame(TextFrame(random.choice(QUESTION_AFFIRMATION)))
|
||||
await result_callback("""Sure! Here are some random facts that could be associated with a solar panel company: 1. **History**: The company was founded in 2008 by a group of renewable energy enthusiasts who wanted to make solar power more accessible to homeowners and businesses. 2. **Headquarters**: Their headquarters is a net-zero energy building powered entirely by their own solar panels, showcasing their commitment to sustainability. 3. **Products**: They produce three main types of solar panels: monocrystalline, polycrystalline, and thin-film, catering to different customer needs and budgets. 4. **Innovation**: The company holds patents for advanced solar cell technology that increases efficiency by 20% compared to industry standards. 5. **Global Reach**: They have installed solar systems in over 40 countries and have manufacturing plants on three continents.6. **Community Impact**: For every 100 solar panels sold, they donate a panel to a school or community center in underprivileged areas. 7. **Workforce**: The company employs over 5,000 people, 40% of whom are in research and development roles. 8. **Recognition**: They won the “Green Energy Innovator of the Year” award in 2022 for their work on solar panels made from recycled materials. 9. **Sustainability**: Their panels are designed to last 25+ years and are 95% recyclable at the end of their life cycle. 10. **Customer Perks**: They offer a 25-year warranty and real-time monitoring systems that allow users to track energy production via an app. 11. **Mission Statement**: "Empowering the world with clean energy, one panel at a time." 12. **Energy Production**: The combined output of all their installations generates enough electricity to power over 2 million homes annually. 13. **R&D Efforts**: They are actively working on integrating solar panels into everyday items like backpacks and electric vehicles. 14. **Solar Farms**: The company has partnered with governments to develop large-scale solar farms, including one that spans over 10,000 acres. 15. **Future Goals**: By 2030, they aim to make solar power the most affordable energy source worldwide. Would you like these customized for a specific scenario?""")
|
||||
# raise RuntimeError("<><><><><>get_knowledge_base")
|
||||
|
||||
async def end_call(
|
||||
function_name: str,
|
||||
tool_call_id: str,
|
||||
_args,
|
||||
llm,
|
||||
context: OpenAILLMContext,
|
||||
result_callback,
|
||||
voice_provider: str,
|
||||
voice_id: str,
|
||||
transport: DailyTransport,
|
||||
) -> None:
|
||||
logger.info("Invoking `end_call` tool with argument {_args}", _args=_args)
|
||||
end_call_sentence = _args.get("end_call_sentence", "Thank you for your time have a great day")
|
||||
estimated_time_end_call_sentence = 15
|
||||
logger.info(
|
||||
"Estimated End Call Sentence Time is {estimated_time_end_call_sentence}", estimated_time_end_call_sentence=estimated_time_end_call_sentence
|
||||
)
|
||||
if voice_provider == "cartesia":
|
||||
await say_agent_response(
|
||||
get_cartesia_static_response(
|
||||
end_call_sentence,
|
||||
voice_id,
|
||||
"sonic-english",
|
||||
output_format={"container": "raw", "encoding": "pcm_s16le", "sample_rate": 16000},
|
||||
),
|
||||
transport,
|
||||
estimated_time_end_call_sentence,
|
||||
True,
|
||||
)
|
||||
await transport.stop_dialout(PARTICIPANT_ID[0])
|
||||
await result_callback("CALL ENDED BY ASSISTANT")
|
||||
|
||||
|
||||
|
||||
async def main():
|
||||
async with aiohttp.ClientSession() as session:
|
||||
(room_url, token) = await configure(session)
|
||||
stt = DeepgramSTTService(
|
||||
api_key=DEEPGRAM_API_KEY,
|
||||
audio_passthrough=False,
|
||||
)
|
||||
transport = DailyTransport(
|
||||
room_url,
|
||||
token,
|
||||
"Test-Bot",
|
||||
DailyParams(
|
||||
api_key=DAILY_API_KEY,
|
||||
audio_in_enabled=True,
|
||||
audio_out_enabled=True,
|
||||
vad_audio_passthrough=True,
|
||||
vad_enabled=True,
|
||||
transcription_enabled=False,
|
||||
vad_analyzer=SileroVADAnalyzer(params=VADParams(start_secs=0.2)),
|
||||
),
|
||||
)
|
||||
print(f"_____bigly.py * transport: {transport}")
|
||||
|
||||
tts = CartesiaTTSService(
|
||||
api_key=CARTESIA_API_KEY,
|
||||
voice_id="7360f116-6306-4e9a-b487-1235f35a0f21",
|
||||
)
|
||||
|
||||
llm = OpenAILLMService(api_key=os.environ["OPENAI_API_KEY"], model="gpt-4o")
|
||||
llm.register_function('get_knowledge_base', get_knowledge_base)
|
||||
llm.register_function('end_call', partial(end_call,transport=transport, voice_provider='cartesia', voice_id = '7360f116-6306-4e9a-b487-1235f35a0f21'))
|
||||
llm.register_function('transfer_call', transfer_call)
|
||||
llm.register_function('voicemail', partial(voicemail, transport = transport))
|
||||
llm.register_function('get_meeting_dates', get_meeting_dates)
|
||||
|
||||
tools = [
|
||||
ChatCompletionToolParam(
|
||||
type="function",
|
||||
function={
|
||||
"name": "get_knowledge_base",
|
||||
"description": """""Always Use this tool:
|
||||
- When User have Questions about Company
|
||||
- If user is not showing interest and you need to convince them by using information about Company
|
||||
- When User have any General Query and Questions
|
||||
""",
|
||||
"strict": True, # type: ignore[typeddict-unknown-key]
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"question": {
|
||||
"type": "string",
|
||||
"description": "User Question/Concern about Company",
|
||||
},
|
||||
"reason": {
|
||||
"type": "string",
|
||||
"enum": ["CONVINCE", "GENERAL_QUESTION"],
|
||||
"description": "Reason why you are using this tool. This can only be one of the category: `CONVINCE`, `GENERAL_QUESTION`.\
|
||||
`CONVINCE` would be in case you are convincing the user otherwise it is `GENERAL_QUESTION`",
|
||||
},
|
||||
},
|
||||
"additionalProperties": False,
|
||||
"required": ["question", "reason"],
|
||||
},
|
||||
},
|
||||
),
|
||||
ChatCompletionToolParam(
|
||||
type="function",
|
||||
function={
|
||||
"name": "end_call",
|
||||
"description": "Use this tool to end the call",
|
||||
"strict": True, # type: ignore[typeddict-unknown-key]
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"end_call_sentence": {
|
||||
"type": "string",
|
||||
"description": "The End Call Sentence that needs to be utter by the AI",
|
||||
}
|
||||
},
|
||||
"additionalProperties": False,
|
||||
"required": ["end_call_sentence"],
|
||||
},
|
||||
},
|
||||
),
|
||||
ChatCompletionToolParam(
|
||||
type="function",
|
||||
function={
|
||||
"name": "transfer_call",
|
||||
"description": "Use this tool to transfer the call",
|
||||
"strict": True, # type: ignore[typeddict-unknown-key]
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"transfer_number_sentence": {
|
||||
"type": "string",
|
||||
"description": "The sentence that AI needs to speak before transfering the call",
|
||||
},
|
||||
"transfer_number": {
|
||||
"type": "string",
|
||||
"description": "The number to use to which we need transfer the call",
|
||||
},
|
||||
},
|
||||
"additionalProperties": False,
|
||||
"required": ["transfer_number", "transfer_number_sentence"],
|
||||
},
|
||||
},
|
||||
),
|
||||
ChatCompletionToolParam(
|
||||
type="function",
|
||||
function={
|
||||
"name": "voicemail",
|
||||
"description": f"Use this tool if you reach voicemail. Here is some examples: {'\n'.join(VOICEMAIL_EXAMPLES)}",
|
||||
"parameters": {},
|
||||
},
|
||||
),
|
||||
ChatCompletionToolParam(
|
||||
type="function",
|
||||
function={
|
||||
"name": "get_meeting_dates",
|
||||
"description": "Use this tool to get the meeting dates in order to schedule a meeting date with the user. The output of this\
|
||||
tool are slots which you need to recommend to the user. The slots are given in numerical list in ascending order\
|
||||
(earlier slots to later slots)",
|
||||
"parameters": {},
|
||||
},
|
||||
)]
|
||||
messages = [
|
||||
{
|
||||
"role": "system",
|
||||
"content": """Main Prompt""",
|
||||
},
|
||||
]
|
||||
|
||||
context = OpenAILLMContext(messages, tools)
|
||||
context_aggregator = llm.create_context_aggregator(context)
|
||||
|
||||
pipeline = Pipeline(
|
||||
[
|
||||
transport.input(), # Transport user input
|
||||
stt,
|
||||
context_aggregator.user(), # User responses
|
||||
llm, # LLM
|
||||
tts, # TTS
|
||||
transport.output(), # Transport bot output
|
||||
context_aggregator.assistant(), # Assistant spoken responses
|
||||
]
|
||||
)
|
||||
|
||||
task = PipelineTask(
|
||||
pipeline,
|
||||
PipelineParams(
|
||||
allow_interruptions=True,
|
||||
enable_metrics=False,####
|
||||
enable_usage_metrics=False,#####
|
||||
report_only_initial_ttfb=True,
|
||||
),
|
||||
)
|
||||
|
||||
@transport.event_handler("on_call_state_updated")
|
||||
async def on_call_state_updated(transport, state: str) -> None:
|
||||
logger.info("Call State Updated, state: {state}", state=state)
|
||||
|
||||
async def _dialout_retry_handler() -> None:
|
||||
try:
|
||||
for i in range(3):
|
||||
logger.info("Attempting a Dial-Out, Attempt: {attempt}", attempt=i + 1)
|
||||
await transport.start_dialout(
|
||||
{"phoneNumber": TO, "video": False}
|
||||
# {"phoneNumber": TO, "callerId": FROM_DAILY_CALLER_ID, "video": False}
|
||||
)
|
||||
await asyncio.sleep(15)
|
||||
current_participant_count = transport.participant_counts()
|
||||
if current_participant_count["present"] >= 2:
|
||||
return
|
||||
raise Exception("Unable to perform a dial-out for Daily-Co ROOM")
|
||||
except Exception as e:
|
||||
raise e
|
||||
|
||||
async def _dialout_task_exception(task: asyncio.Task) -> None:
|
||||
if task.exception():
|
||||
await task.queue_frames([EndFrame()])
|
||||
else:
|
||||
logger.info("Dial-out completed successfully.")
|
||||
|
||||
def _handle_dialout_completion(task: asyncio.Task) -> None:
|
||||
asyncio.create_task(_dialout_task_exception(task))
|
||||
|
||||
if state == "joined":
|
||||
task = transport.input().get_event_loop().create_task(_dialout_retry_handler())
|
||||
task.add_done_callback(_handle_dialout_completion)
|
||||
|
||||
# Event handler for on_first_participant_joined
|
||||
@transport.event_handler("on_first_participant_joined")
|
||||
async def on_first_participant_joined(transport, participant) -> None:
|
||||
logger.info("First Participant Joined with ID {participant_id}", participant_id=participant["id"])
|
||||
PARTICIPANT_ID[0] = participant["id"]
|
||||
await transport.capture_participant_transcription(participant["id"])
|
||||
|
||||
|
||||
@transport.event_handler("on_dialout_error")
|
||||
async def on_dialout_error(transport, cdata) -> None:
|
||||
logger.info("Dial-Out error: {data}", data=cdata)
|
||||
await task.queue_frames([LLMMessagesFrame(messages)])
|
||||
|
||||
# Event handler for on_dialout_answered
|
||||
@transport.event_handler("on_dialout_answered")
|
||||
async def on_dialout_answered(transport, cdata) -> None:
|
||||
logger.info("Dial-Out Answered with data as follow: {data}", data=cdata)
|
||||
await task.queue_frames([LLMMessagesFrame(messages)])
|
||||
|
||||
# Event handler for on_participant_left
|
||||
@transport.event_handler("on_participant_left")
|
||||
async def on_participant_left(transport, participant, reason) -> None:
|
||||
logger.info("Following Participant Left {participant}", participant=participant)
|
||||
await task.queue_frames([EndFrame()])
|
||||
|
||||
runner = PipelineRunner()
|
||||
|
||||
await runner.run(task)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
@@ -62,11 +62,3 @@ Then, visit `http://localhost:7860/` in your browser to start a chatbot session.
|
||||
docker build -t chatbot .
|
||||
docker run --env-file .env -p 7860:7860 chatbot
|
||||
```
|
||||
## Cartesia best practices
|
||||
|
||||
Since this example is using Cartesia, checkout the best practices given in Cartesia's docs. LLM prompts should be modified accordingly.
|
||||
<https://docs.cartesia.ai/build-with-sonic/formatting-text-for-sonic/best-practices>
|
||||
|
||||
<https://docs.cartesia.ai/build-with-sonic/formatting-text-for-sonic/inserting-breaks-pauses>
|
||||
|
||||
<https://docs.cartesia.ai/build-with-sonic/formatting-text-for-sonic/spelling-out-input-text>
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
# Simple Chatbot Full Stack
|
||||
|
||||
A full-stack implementation of an AI chatbot with real-time audio/video interaction.
|
||||
|
||||
## Structure
|
||||
|
||||
- `server/` - Python-based bot server using FastAPI
|
||||
- `client/` - JavaScript client using RTVI and Daily.co for WebRTC
|
||||
|
||||
## Setup
|
||||
|
||||
### Server Setup
|
||||
|
||||
1. Navigate to the server directory:
|
||||
```bash
|
||||
cd server
|
||||
```
|
||||
2. Create and activate a virtual environment:
|
||||
```bash
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate # On Windows: venv\Scripts\activate
|
||||
```
|
||||
3. Install requirements:
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
4. Copy env.example to .env and add your credentials
|
||||
5. Start the server:
|
||||
```bash
|
||||
python server.py
|
||||
```
|
||||
|
||||
### Client Setup
|
||||
|
||||
1. Navigate to the client directory:
|
||||
```bash
|
||||
cd client
|
||||
```
|
||||
2. Install dependencies:
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
3. Start the development server:
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
4. Open the URL shown in the terminal (usually http://localhost:5173)
|
||||
|
||||
## Usage
|
||||
|
||||
1. Start the server (it will run on port 7860)
|
||||
2. Start the client server (it will run on port 5173)
|
||||
3. Open http://localhost:5173 in your browser
|
||||
4. Click "Connect" to start a session with the bot
|
||||
|
||||
## Requirements
|
||||
|
||||
- Python 3.10+
|
||||
- Node.js 14+
|
||||
- Modern web browser with WebRTC support
|
||||
@@ -1,40 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>AI Chatbot</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="status-bar">
|
||||
<div class="status">
|
||||
Status: <span id="connection-status">Disconnected</span>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<button id="connect-btn">Connect</button>
|
||||
<button id="disconnect-btn" disabled>Disconnect</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="bot-container">
|
||||
<div id="bot-video-container">
|
||||
</div>
|
||||
<audio id="bot-audio" autoplay></audio>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="debug-panel">
|
||||
<h3>Debug Info</h3>
|
||||
<div id="debug-log"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="module" src="/src/app.js"></script>
|
||||
<link rel="stylesheet" href="/src/style.css">
|
||||
</body>
|
||||
|
||||
</html>
|
||||
1
examples/simple-chatbot-fullstack/examples/javascript/node_modules/.bin/esbuild
generated
vendored
1
examples/simple-chatbot-fullstack/examples/javascript/node_modules/.bin/esbuild
generated
vendored
@@ -1 +0,0 @@
|
||||
../esbuild/bin/esbuild
|
||||
1
examples/simple-chatbot-fullstack/examples/javascript/node_modules/.bin/nanoid
generated
vendored
1
examples/simple-chatbot-fullstack/examples/javascript/node_modules/.bin/nanoid
generated
vendored
@@ -1 +0,0 @@
|
||||
../nanoid/bin/nanoid.cjs
|
||||
1
examples/simple-chatbot-fullstack/examples/javascript/node_modules/.bin/rollup
generated
vendored
1
examples/simple-chatbot-fullstack/examples/javascript/node_modules/.bin/rollup
generated
vendored
@@ -1 +0,0 @@
|
||||
../rollup/dist/bin/rollup
|
||||
1
examples/simple-chatbot-fullstack/examples/javascript/node_modules/.bin/uuid
generated
vendored
1
examples/simple-chatbot-fullstack/examples/javascript/node_modules/.bin/uuid
generated
vendored
@@ -1 +0,0 @@
|
||||
../uuid/dist/bin/uuid
|
||||
1
examples/simple-chatbot-fullstack/examples/javascript/node_modules/.bin/vite
generated
vendored
1
examples/simple-chatbot-fullstack/examples/javascript/node_modules/.bin/vite
generated
vendored
@@ -1 +0,0 @@
|
||||
../vite/bin/vite.js
|
||||
593
examples/simple-chatbot-fullstack/examples/javascript/node_modules/.package-lock.json
generated
vendored
593
examples/simple-chatbot-fullstack/examples/javascript/node_modules/.package-lock.json
generated
vendored
@@ -1,593 +0,0 @@
|
||||
{
|
||||
"name": "client",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@babel/runtime": {
|
||||
"version": "7.26.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.0.tgz",
|
||||
"integrity": "sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"regenerator-runtime": "^0.14.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@daily-co/daily-js": {
|
||||
"version": "0.72.2",
|
||||
"resolved": "https://registry.npmjs.org/@daily-co/daily-js/-/daily-js-0.72.2.tgz",
|
||||
"integrity": "sha512-beUN/V4S4++ZYIUAfRnRt/rUjc2jkCrc2YxghMEyUPxjZy1n73OCtbty68RDMpSYkIs89ailJaUNRLcPhIuMaw==",
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@sentry/browser": "^7.60.1",
|
||||
"bowser": "^2.8.1",
|
||||
"dequal": "^2.0.3",
|
||||
"events": "^3.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@daily-co/realtime-ai-daily": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@daily-co/realtime-ai-daily/-/realtime-ai-daily-0.2.1.tgz",
|
||||
"integrity": "sha512-F3S0+bpWx7ALx9kNCSNUkTUAflsDv1DyGW2XLKDG8YsYhaT8WXXBJw6kTKUvV2BF9lzJrI0gg911ATbZMgJyRA==",
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"@daily-co/daily-js": "^0.72.1",
|
||||
"realtime-ai": "0.2.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-arm64": {
|
||||
"version": "0.24.0",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.0.tgz",
|
||||
"integrity": "sha512-CKyDpRbK1hXwv79soeTJNHb5EiG6ct3efd/FTPdzOWdbZZfGhpbcqIpiD0+vwmpu0wTIL97ZRPZu8vUt46nBSw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/rollup-darwin-arm64": {
|
||||
"version": "4.28.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.28.0.tgz",
|
||||
"integrity": "sha512-lmKx9yHsppblnLQZOGxdO66gT77bvdBtr/0P+TPOseowE7D9AJoBw8ZDULRasXRWf1Z86/gcOdpBrV6VDUY36Q==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
]
|
||||
},
|
||||
"node_modules/@sentry-internal/feedback": {
|
||||
"version": "7.120.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-7.120.0.tgz",
|
||||
"integrity": "sha512-+nU2PXMAyrYyK64PlfxXyRZ+LIl6IWAcdnBeX916WqOJy2WWmtdOrAX8muVwLVIXHzp1EMG1nEZgtpL/Vr2XKQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry/core": "7.120.0",
|
||||
"@sentry/types": "7.120.0",
|
||||
"@sentry/utils": "7.120.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry-internal/replay-canvas": {
|
||||
"version": "7.120.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-7.120.0.tgz",
|
||||
"integrity": "sha512-ZEFZBP+Jxmy/8IY7IZDZVPqAJ6pPxAFo1lNTd8xfpbno3WAtHw0FLewLfjrFt0zfIgCk8EXj4PW355zRP3C2NQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry/core": "7.120.0",
|
||||
"@sentry/replay": "7.120.0",
|
||||
"@sentry/types": "7.120.0",
|
||||
"@sentry/utils": "7.120.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry-internal/tracing": {
|
||||
"version": "7.120.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.120.0.tgz",
|
||||
"integrity": "sha512-VymJoIGMV0PcTJyshka9uJ1sKpR7bHooqW5jTEr6g0dYAwB723fPXHjVW+7SETF7i5+yr2KMprYKreqRidKyKA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry/core": "7.120.0",
|
||||
"@sentry/types": "7.120.0",
|
||||
"@sentry/utils": "7.120.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/browser": {
|
||||
"version": "7.120.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.120.0.tgz",
|
||||
"integrity": "sha512-2hRE3QPLBBX+qqZEHY2IbJv4YvfXY7m/bWmNjN15phyNK3oBcm2Pa8ZiKUYrk8u/4DCEGzNUlhOmFgaxwSfpNw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry-internal/feedback": "7.120.0",
|
||||
"@sentry-internal/replay-canvas": "7.120.0",
|
||||
"@sentry-internal/tracing": "7.120.0",
|
||||
"@sentry/core": "7.120.0",
|
||||
"@sentry/integrations": "7.120.0",
|
||||
"@sentry/replay": "7.120.0",
|
||||
"@sentry/types": "7.120.0",
|
||||
"@sentry/utils": "7.120.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/core": {
|
||||
"version": "7.120.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.120.0.tgz",
|
||||
"integrity": "sha512-uTc2sUQ0heZrMI31oFOHGxjKgw16MbV3C2mcT7qcrb6UmSGR9WqPOXZhnVVuzPWCnQ8B5IPPVdynK//J+9/m6g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry/types": "7.120.0",
|
||||
"@sentry/utils": "7.120.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/integrations": {
|
||||
"version": "7.120.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/integrations/-/integrations-7.120.0.tgz",
|
||||
"integrity": "sha512-/Hs9MgSmG4JFNyeQkJ+MWh/fxO/U38Pz0VSH3hDrfyCjI8vH9Vz9inGEQXgB9Ke4eH8XnhsQ7xPnM27lWJts6g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry/core": "7.120.0",
|
||||
"@sentry/types": "7.120.0",
|
||||
"@sentry/utils": "7.120.0",
|
||||
"localforage": "^1.8.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/replay": {
|
||||
"version": "7.120.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.120.0.tgz",
|
||||
"integrity": "sha512-wV9fIYwNtMvFOHQB5eSm+kCorRXsX5+v1DxyTC8Lee1hfzcUQ2Wvqh75VktpXuM9TeZE8h7aQ4Wo4qCgTUdtvA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry-internal/tracing": "7.120.0",
|
||||
"@sentry/core": "7.120.0",
|
||||
"@sentry/types": "7.120.0",
|
||||
"@sentry/utils": "7.120.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/types": {
|
||||
"version": "7.120.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.120.0.tgz",
|
||||
"integrity": "sha512-3mvELhBQBo6EljcRrJzfpGJYHKIZuBXmqh0y8prh03SWE62pwRL614GIYtd4YOC6OP1gfPn8S8h9w3dD5bF5HA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/utils": {
|
||||
"version": "7.120.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.120.0.tgz",
|
||||
"integrity": "sha512-XZsPcBHoYu4+HYn14IOnhabUZgCF99Xn4IdWn8Hjs/c+VPtuAVDhRTsfPyPrpY3OcN8DgO5fZX4qcv/6kNbX1A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry/types": "7.120.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/estree": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz",
|
||||
"integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/events": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.3.tgz",
|
||||
"integrity": "sha512-trOc4AAUThEz9hapPtSd7wf5tiQKvTtu5b371UxXdTuqzIh0ArcRspRP0i0Viu+LXstIQ1z96t1nsPxT9ol01g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/bowser": {
|
||||
"version": "2.11.0",
|
||||
"resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz",
|
||||
"integrity": "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/clone-deep": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz",
|
||||
"integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"is-plain-object": "^2.0.4",
|
||||
"kind-of": "^6.0.2",
|
||||
"shallow-clone": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/dequal": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
|
||||
"integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild": {
|
||||
"version": "0.24.0",
|
||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.0.tgz",
|
||||
"integrity": "sha512-FuLPevChGDshgSicjisSooU0cemp/sGXR841D5LHMB7mTVOmsEHcAxaH3irL53+8YDIeVNQEySh4DaYU/iuPqQ==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"esbuild": "bin/esbuild"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/aix-ppc64": "0.24.0",
|
||||
"@esbuild/android-arm": "0.24.0",
|
||||
"@esbuild/android-arm64": "0.24.0",
|
||||
"@esbuild/android-x64": "0.24.0",
|
||||
"@esbuild/darwin-arm64": "0.24.0",
|
||||
"@esbuild/darwin-x64": "0.24.0",
|
||||
"@esbuild/freebsd-arm64": "0.24.0",
|
||||
"@esbuild/freebsd-x64": "0.24.0",
|
||||
"@esbuild/linux-arm": "0.24.0",
|
||||
"@esbuild/linux-arm64": "0.24.0",
|
||||
"@esbuild/linux-ia32": "0.24.0",
|
||||
"@esbuild/linux-loong64": "0.24.0",
|
||||
"@esbuild/linux-mips64el": "0.24.0",
|
||||
"@esbuild/linux-ppc64": "0.24.0",
|
||||
"@esbuild/linux-riscv64": "0.24.0",
|
||||
"@esbuild/linux-s390x": "0.24.0",
|
||||
"@esbuild/linux-x64": "0.24.0",
|
||||
"@esbuild/netbsd-x64": "0.24.0",
|
||||
"@esbuild/openbsd-arm64": "0.24.0",
|
||||
"@esbuild/openbsd-x64": "0.24.0",
|
||||
"@esbuild/sunos-x64": "0.24.0",
|
||||
"@esbuild/win32-arm64": "0.24.0",
|
||||
"@esbuild/win32-ia32": "0.24.0",
|
||||
"@esbuild/win32-x64": "0.24.0"
|
||||
}
|
||||
},
|
||||
"node_modules/events": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
|
||||
"integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.8.x"
|
||||
}
|
||||
},
|
||||
"node_modules/immediate": {
|
||||
"version": "3.0.6",
|
||||
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
|
||||
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/is-plain-object": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
|
||||
"integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"isobject": "^3.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/isobject": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
|
||||
"integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/kind-of": {
|
||||
"version": "6.0.3",
|
||||
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
|
||||
"integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lie": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz",
|
||||
"integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"immediate": "~3.0.5"
|
||||
}
|
||||
},
|
||||
"node_modules/localforage": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz",
|
||||
"integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"lie": "3.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/nanoid": {
|
||||
"version": "3.3.8",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz",
|
||||
"integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"nanoid": "bin/nanoid.cjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/picocolors": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
||||
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.4.49",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz",
|
||||
"integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
{
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/postcss"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.7",
|
||||
"picocolors": "^1.1.1",
|
||||
"source-map-js": "^1.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/realtime-ai": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/realtime-ai/-/realtime-ai-0.2.1.tgz",
|
||||
"integrity": "sha512-2zhCO9V9zdoBwusjq6FkiEF3yrwyJryLUo+OMYPU0rkXYh4SVcIP1dx06qbEMRTuaB9U2wEWvqxPaEQnXNzovw==",
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"@types/events": "^3.0.3",
|
||||
"clone-deep": "^4.0.1",
|
||||
"events": "^3.3.0",
|
||||
"typed-emitter": "^2.1.0",
|
||||
"uuid": "^10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/regenerator-runtime": {
|
||||
"version": "0.14.1",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
|
||||
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "4.28.0",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.28.0.tgz",
|
||||
"integrity": "sha512-G9GOrmgWHBma4YfCcX8PjH0qhXSdH8B4HDE2o4/jaxj93S4DPCIDoLcXz99eWMji4hB29UFCEd7B2gwGJDR9cQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/estree": "1.0.6"
|
||||
},
|
||||
"bin": {
|
||||
"rollup": "dist/bin/rollup"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0",
|
||||
"npm": ">=8.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@rollup/rollup-android-arm-eabi": "4.28.0",
|
||||
"@rollup/rollup-android-arm64": "4.28.0",
|
||||
"@rollup/rollup-darwin-arm64": "4.28.0",
|
||||
"@rollup/rollup-darwin-x64": "4.28.0",
|
||||
"@rollup/rollup-freebsd-arm64": "4.28.0",
|
||||
"@rollup/rollup-freebsd-x64": "4.28.0",
|
||||
"@rollup/rollup-linux-arm-gnueabihf": "4.28.0",
|
||||
"@rollup/rollup-linux-arm-musleabihf": "4.28.0",
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.28.0",
|
||||
"@rollup/rollup-linux-arm64-musl": "4.28.0",
|
||||
"@rollup/rollup-linux-powerpc64le-gnu": "4.28.0",
|
||||
"@rollup/rollup-linux-riscv64-gnu": "4.28.0",
|
||||
"@rollup/rollup-linux-s390x-gnu": "4.28.0",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.28.0",
|
||||
"@rollup/rollup-linux-x64-musl": "4.28.0",
|
||||
"@rollup/rollup-win32-arm64-msvc": "4.28.0",
|
||||
"@rollup/rollup-win32-ia32-msvc": "4.28.0",
|
||||
"@rollup/rollup-win32-x64-msvc": "4.28.0",
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/rxjs": {
|
||||
"version": "7.8.1",
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz",
|
||||
"integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==",
|
||||
"license": "Apache-2.0",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/shallow-clone": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz",
|
||||
"integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"kind-of": "^6.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||
"license": "0BSD",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/typed-emitter": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/typed-emitter/-/typed-emitter-2.1.0.tgz",
|
||||
"integrity": "sha512-g/KzbYKbH5C2vPkaXGu8DJlHrGKHLsM25Zg9WuC9pMGfuvT+X25tZQWo5fK1BjBm8+UrVE9LDCvaY0CQk+fXDA==",
|
||||
"license": "MIT",
|
||||
"optionalDependencies": {
|
||||
"rxjs": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz",
|
||||
"integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==",
|
||||
"funding": [
|
||||
"https://github.com/sponsors/broofa",
|
||||
"https://github.com/sponsors/ctavan"
|
||||
],
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-6.0.2.tgz",
|
||||
"integrity": "sha512-XdQ+VsY2tJpBsKGs0wf3U/+azx8BBpYRHFAyKm5VeEZNOJZRB63q7Sc8Iup3k0TrN3KO6QgyzFf+opSbfY1y0g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"esbuild": "^0.24.0",
|
||||
"postcss": "^8.4.49",
|
||||
"rollup": "^4.23.0"
|
||||
},
|
||||
"bin": {
|
||||
"vite": "bin/vite.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.0.0 || ^20.0.0 || >=22.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/vitejs/vite?sponsor=1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
|
||||
"jiti": ">=1.21.0",
|
||||
"less": "*",
|
||||
"lightningcss": "^1.21.0",
|
||||
"sass": "*",
|
||||
"sass-embedded": "*",
|
||||
"stylus": "*",
|
||||
"sugarss": "*",
|
||||
"terser": "^5.16.0",
|
||||
"tsx": "^4.8.1",
|
||||
"yaml": "^2.4.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/node": {
|
||||
"optional": true
|
||||
},
|
||||
"jiti": {
|
||||
"optional": true
|
||||
},
|
||||
"less": {
|
||||
"optional": true
|
||||
},
|
||||
"lightningcss": {
|
||||
"optional": true
|
||||
},
|
||||
"sass": {
|
||||
"optional": true
|
||||
},
|
||||
"sass-embedded": {
|
||||
"optional": true
|
||||
},
|
||||
"stylus": {
|
||||
"optional": true
|
||||
},
|
||||
"sugarss": {
|
||||
"optional": true
|
||||
},
|
||||
"terser": {
|
||||
"optional": true
|
||||
},
|
||||
"tsx": {
|
||||
"optional": true
|
||||
},
|
||||
"yaml": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -1,25 +0,0 @@
|
||||
{
|
||||
"hash": "5b0fc1aa",
|
||||
"configHash": "b261e656",
|
||||
"lockfileHash": "49cc3cc9",
|
||||
"browserHash": "0db32c31",
|
||||
"optimized": {
|
||||
"@daily-co/realtime-ai-daily": {
|
||||
"src": "../../@daily-co/realtime-ai-daily/dist/index.module.js",
|
||||
"file": "@daily-co_realtime-ai-daily.js",
|
||||
"fileHash": "1c7897e6",
|
||||
"needsInterop": false
|
||||
},
|
||||
"realtime-ai": {
|
||||
"src": "../../realtime-ai/dist/index.module.js",
|
||||
"file": "realtime-ai.js",
|
||||
"fileHash": "ba7c0239",
|
||||
"needsInterop": false
|
||||
}
|
||||
},
|
||||
"chunks": {
|
||||
"chunk-MC2NFNB2": {
|
||||
"file": "chunk-MC2NFNB2.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
2290
examples/simple-chatbot-fullstack/examples/javascript/node_modules/.vite/deps/chunk-MC2NFNB2.js
generated
vendored
2290
examples/simple-chatbot-fullstack/examples/javascript/node_modules/.vite/deps/chunk-MC2NFNB2.js
generated
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
import {
|
||||
$08bedc6ef0d1c66c$export$4eda4fd287fbbca5,
|
||||
$08bedc6ef0d1c66c$export$59b4786f333aac02,
|
||||
$08bedc6ef0d1c66c$export$885fb96b850e8fbb,
|
||||
$08bedc6ef0d1c66c$export$975d7330b0c579b7,
|
||||
$08bedc6ef0d1c66c$export$c67992fa684a81a6,
|
||||
$08bedc6ef0d1c66c$export$e0624a511a2c4e9,
|
||||
$08bedc6ef0d1c66c$export$e7544ab812238a61,
|
||||
$2665d8e6d1596258$export$86495b081fef8e52,
|
||||
$4a333e41af7a850f$export$3cf39a62d076dd5c,
|
||||
$4a333e41af7a850f$export$441bcd2e10762760,
|
||||
$505461462111ea0b$export$23bc637255b2a471,
|
||||
$74c1449bc91bda44$export$fa42a01c1d60f4a1,
|
||||
$bff4129f8f902365$export$28ad8d0d400d3e2d,
|
||||
$bff4129f8f902365$export$3336fb47fe34a146,
|
||||
$bff4129f8f902365$export$378529d7a8bead8b,
|
||||
$bff4129f8f902365$export$38b3db05cbf0e240,
|
||||
$bff4129f8f902365$export$69aa9ab0334b212,
|
||||
$bff4129f8f902365$export$882b13c7fda338f5,
|
||||
$bff4129f8f902365$export$e9a960646cc432aa,
|
||||
$cbe8e0de0049ed6e$export$6b4624d233c61fcb,
|
||||
$d881613f2029ce0c$export$8728b60ea57bf43e
|
||||
} from "./chunk-MC2NFNB2.js";
|
||||
export {
|
||||
$08bedc6ef0d1c66c$export$885fb96b850e8fbb as BotNotReadyError,
|
||||
$08bedc6ef0d1c66c$export$4eda4fd287fbbca5 as ConfigUpdateError,
|
||||
$08bedc6ef0d1c66c$export$c67992fa684a81a6 as ConnectionTimeoutError,
|
||||
$4a333e41af7a850f$export$3cf39a62d076dd5c as LLMHelper,
|
||||
$4a333e41af7a850f$export$441bcd2e10762760 as LLMMessageType,
|
||||
$bff4129f8f902365$export$e9a960646cc432aa as MessageDispatcher,
|
||||
$bff4129f8f902365$export$378529d7a8bead8b as RTVIActionRequest,
|
||||
$74c1449bc91bda44$export$fa42a01c1d60f4a1 as RTVIClient,
|
||||
$505461462111ea0b$export$23bc637255b2a471 as RTVIClientHelper,
|
||||
$08bedc6ef0d1c66c$export$59b4786f333aac02 as RTVIError,
|
||||
$cbe8e0de0049ed6e$export$6b4624d233c61fcb as RTVIEvent,
|
||||
$bff4129f8f902365$export$69aa9ab0334b212 as RTVIMessage,
|
||||
$bff4129f8f902365$export$38b3db05cbf0e240 as RTVIMessageType,
|
||||
$bff4129f8f902365$export$28ad8d0d400d3e2d as RTVI_ACTION_TYPE,
|
||||
$bff4129f8f902365$export$882b13c7fda338f5 as RTVI_MESSAGE_LABEL,
|
||||
$08bedc6ef0d1c66c$export$e7544ab812238a61 as StartBotError,
|
||||
$2665d8e6d1596258$export$86495b081fef8e52 as Transport,
|
||||
$08bedc6ef0d1c66c$export$e0624a511a2c4e9 as TransportStartError,
|
||||
$08bedc6ef0d1c66c$export$975d7330b0c579b7 as VoiceError,
|
||||
$bff4129f8f902365$export$3336fb47fe34a146 as VoiceMessage,
|
||||
$d881613f2029ce0c$export$8728b60ea57bf43e as httpActionGenerator
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": [],
|
||||
"sourcesContent": [],
|
||||
"mappings": "",
|
||||
"names": []
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -1,19 +0,0 @@
|
||||
# @babel/runtime
|
||||
|
||||
> babel's modular runtime helpers
|
||||
|
||||
See our website [@babel/runtime](https://babeljs.io/docs/babel-runtime) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save @babel/runtime
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/runtime
|
||||
```
|
||||
@@ -1,4 +0,0 @@
|
||||
function _AwaitValue(t) {
|
||||
this.wrapped = t;
|
||||
}
|
||||
module.exports = _AwaitValue, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,4 +0,0 @@
|
||||
function _OverloadYield(e, d) {
|
||||
this.v = e, this.k = d;
|
||||
}
|
||||
module.exports = _OverloadYield, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,9 +0,0 @@
|
||||
function _applyDecoratedDescriptor(i, e, r, n, l) {
|
||||
var a = {};
|
||||
return Object.keys(n).forEach(function (i) {
|
||||
a[i] = n[i];
|
||||
}), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, ("value" in a || a.initializer) && (a.writable = !0), a = r.slice().reverse().reduce(function (r, n) {
|
||||
return n(i, e, r) || r;
|
||||
}, a), l && void 0 !== a.initializer && (a.value = a.initializer ? a.initializer.call(l) : void 0, a.initializer = void 0), void 0 === a.initializer ? (Object.defineProperty(i, e, a), null) : a;
|
||||
}
|
||||
module.exports = _applyDecoratedDescriptor, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,236 +0,0 @@
|
||||
var _typeof = require("./typeof.js")["default"];
|
||||
var setFunctionName = require("./setFunctionName.js");
|
||||
var toPropertyKey = require("./toPropertyKey.js");
|
||||
function old_createMetadataMethodsForProperty(e, t, a, r) {
|
||||
return {
|
||||
getMetadata: function getMetadata(o) {
|
||||
old_assertNotFinished(r, "getMetadata"), old_assertMetadataKey(o);
|
||||
var i = e[o];
|
||||
if (void 0 !== i) if (1 === t) {
|
||||
var n = i["public"];
|
||||
if (void 0 !== n) return n[a];
|
||||
} else if (2 === t) {
|
||||
var l = i["private"];
|
||||
if (void 0 !== l) return l.get(a);
|
||||
} else if (Object.hasOwnProperty.call(i, "constructor")) return i.constructor;
|
||||
},
|
||||
setMetadata: function setMetadata(o, i) {
|
||||
old_assertNotFinished(r, "setMetadata"), old_assertMetadataKey(o);
|
||||
var n = e[o];
|
||||
if (void 0 === n && (n = e[o] = {}), 1 === t) {
|
||||
var l = n["public"];
|
||||
void 0 === l && (l = n["public"] = {}), l[a] = i;
|
||||
} else if (2 === t) {
|
||||
var s = n.priv;
|
||||
void 0 === s && (s = n["private"] = new Map()), s.set(a, i);
|
||||
} else n.constructor = i;
|
||||
}
|
||||
};
|
||||
}
|
||||
function old_convertMetadataMapToFinal(e, t) {
|
||||
var a = e[Symbol.metadata || Symbol["for"]("Symbol.metadata")],
|
||||
r = Object.getOwnPropertySymbols(t);
|
||||
if (0 !== r.length) {
|
||||
for (var o = 0; o < r.length; o++) {
|
||||
var i = r[o],
|
||||
n = t[i],
|
||||
l = a ? a[i] : null,
|
||||
s = n["public"],
|
||||
c = l ? l["public"] : null;
|
||||
s && c && Object.setPrototypeOf(s, c);
|
||||
var d = n["private"];
|
||||
if (d) {
|
||||
var u = Array.from(d.values()),
|
||||
f = l ? l["private"] : null;
|
||||
f && (u = u.concat(f)), n["private"] = u;
|
||||
}
|
||||
l && Object.setPrototypeOf(n, l);
|
||||
}
|
||||
a && Object.setPrototypeOf(t, a), e[Symbol.metadata || Symbol["for"]("Symbol.metadata")] = t;
|
||||
}
|
||||
}
|
||||
function old_createAddInitializerMethod(e, t) {
|
||||
return function (a) {
|
||||
old_assertNotFinished(t, "addInitializer"), old_assertCallable(a, "An initializer"), e.push(a);
|
||||
};
|
||||
}
|
||||
function old_memberDec(e, t, a, r, o, i, n, l, s) {
|
||||
var c;
|
||||
switch (i) {
|
||||
case 1:
|
||||
c = "accessor";
|
||||
break;
|
||||
case 2:
|
||||
c = "method";
|
||||
break;
|
||||
case 3:
|
||||
c = "getter";
|
||||
break;
|
||||
case 4:
|
||||
c = "setter";
|
||||
break;
|
||||
default:
|
||||
c = "field";
|
||||
}
|
||||
var d,
|
||||
u,
|
||||
f = {
|
||||
kind: c,
|
||||
name: l ? "#" + t : toPropertyKey(t),
|
||||
isStatic: n,
|
||||
isPrivate: l
|
||||
},
|
||||
p = {
|
||||
v: !1
|
||||
};
|
||||
if (0 !== i && (f.addInitializer = old_createAddInitializerMethod(o, p)), l) {
|
||||
d = 2, u = Symbol(t);
|
||||
var v = {};
|
||||
0 === i ? (v.get = a.get, v.set = a.set) : 2 === i ? v.get = function () {
|
||||
return a.value;
|
||||
} : (1 !== i && 3 !== i || (v.get = function () {
|
||||
return a.get.call(this);
|
||||
}), 1 !== i && 4 !== i || (v.set = function (e) {
|
||||
a.set.call(this, e);
|
||||
})), f.access = v;
|
||||
} else d = 1, u = t;
|
||||
try {
|
||||
return e(s, Object.assign(f, old_createMetadataMethodsForProperty(r, d, u, p)));
|
||||
} finally {
|
||||
p.v = !0;
|
||||
}
|
||||
}
|
||||
function old_assertNotFinished(e, t) {
|
||||
if (e.v) throw Error("attempted to call " + t + " after decoration was finished");
|
||||
}
|
||||
function old_assertMetadataKey(e) {
|
||||
if ("symbol" != _typeof(e)) throw new TypeError("Metadata keys must be symbols, received: " + e);
|
||||
}
|
||||
function old_assertCallable(e, t) {
|
||||
if ("function" != typeof e) throw new TypeError(t + " must be a function");
|
||||
}
|
||||
function old_assertValidReturnValue(e, t) {
|
||||
var a = _typeof(t);
|
||||
if (1 === e) {
|
||||
if ("object" !== a || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
||||
void 0 !== t.get && old_assertCallable(t.get, "accessor.get"), void 0 !== t.set && old_assertCallable(t.set, "accessor.set"), void 0 !== t.init && old_assertCallable(t.init, "accessor.init"), void 0 !== t.initializer && old_assertCallable(t.initializer, "accessor.initializer");
|
||||
} else if ("function" !== a) throw new TypeError((0 === e ? "field" : 10 === e ? "class" : "method") + " decorators must return a function or void 0");
|
||||
}
|
||||
function old_getInit(e) {
|
||||
var t;
|
||||
return null == (t = e.init) && (t = e.initializer) && void 0 !== console && console.warn(".initializer has been renamed to .init as of March 2022"), t;
|
||||
}
|
||||
function old_applyMemberDec(e, t, a, r, o, i, n, l, s) {
|
||||
var c,
|
||||
d,
|
||||
u,
|
||||
f,
|
||||
p,
|
||||
v,
|
||||
y,
|
||||
h = a[0];
|
||||
if (n ? (0 === o || 1 === o ? (c = {
|
||||
get: a[3],
|
||||
set: a[4]
|
||||
}, u = "get") : 3 === o ? (c = {
|
||||
get: a[3]
|
||||
}, u = "get") : 4 === o ? (c = {
|
||||
set: a[3]
|
||||
}, u = "set") : c = {
|
||||
value: a[3]
|
||||
}, 0 !== o && (1 === o && setFunctionName(a[4], "#" + r, "set"), setFunctionName(a[3], "#" + r, u))) : 0 !== o && (c = Object.getOwnPropertyDescriptor(t, r)), 1 === o ? f = {
|
||||
get: c.get,
|
||||
set: c.set
|
||||
} : 2 === o ? f = c.value : 3 === o ? f = c.get : 4 === o && (f = c.set), "function" == typeof h) void 0 !== (p = old_memberDec(h, r, c, l, s, o, i, n, f)) && (old_assertValidReturnValue(o, p), 0 === o ? d = p : 1 === o ? (d = old_getInit(p), v = p.get || f.get, y = p.set || f.set, f = {
|
||||
get: v,
|
||||
set: y
|
||||
}) : f = p);else for (var m = h.length - 1; m >= 0; m--) {
|
||||
var b;
|
||||
void 0 !== (p = old_memberDec(h[m], r, c, l, s, o, i, n, f)) && (old_assertValidReturnValue(o, p), 0 === o ? b = p : 1 === o ? (b = old_getInit(p), v = p.get || f.get, y = p.set || f.set, f = {
|
||||
get: v,
|
||||
set: y
|
||||
}) : f = p, void 0 !== b && (void 0 === d ? d = b : "function" == typeof d ? d = [d, b] : d.push(b)));
|
||||
}
|
||||
if (0 === o || 1 === o) {
|
||||
if (void 0 === d) d = function d(e, t) {
|
||||
return t;
|
||||
};else if ("function" != typeof d) {
|
||||
var g = d;
|
||||
d = function d(e, t) {
|
||||
for (var a = t, r = 0; r < g.length; r++) a = g[r].call(e, a);
|
||||
return a;
|
||||
};
|
||||
} else {
|
||||
var _ = d;
|
||||
d = function d(e, t) {
|
||||
return _.call(e, t);
|
||||
};
|
||||
}
|
||||
e.push(d);
|
||||
}
|
||||
0 !== o && (1 === o ? (c.get = f.get, c.set = f.set) : 2 === o ? c.value = f : 3 === o ? c.get = f : 4 === o && (c.set = f), n ? 1 === o ? (e.push(function (e, t) {
|
||||
return f.get.call(e, t);
|
||||
}), e.push(function (e, t) {
|
||||
return f.set.call(e, t);
|
||||
})) : 2 === o ? e.push(f) : e.push(function (e, t) {
|
||||
return f.call(e, t);
|
||||
}) : Object.defineProperty(t, r, c));
|
||||
}
|
||||
function old_applyMemberDecs(e, t, a, r, o) {
|
||||
for (var i, n, l = new Map(), s = new Map(), c = 0; c < o.length; c++) {
|
||||
var d = o[c];
|
||||
if (Array.isArray(d)) {
|
||||
var u,
|
||||
f,
|
||||
p,
|
||||
v = d[1],
|
||||
y = d[2],
|
||||
h = d.length > 3,
|
||||
m = v >= 5;
|
||||
if (m ? (u = t, f = r, 0 != (v -= 5) && (p = n = n || [])) : (u = t.prototype, f = a, 0 !== v && (p = i = i || [])), 0 !== v && !h) {
|
||||
var b = m ? s : l,
|
||||
g = b.get(y) || 0;
|
||||
if (!0 === g || 3 === g && 4 !== v || 4 === g && 3 !== v) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + y);
|
||||
!g && v > 2 ? b.set(y, v) : b.set(y, !0);
|
||||
}
|
||||
old_applyMemberDec(e, u, d, y, v, m, h, f, p);
|
||||
}
|
||||
}
|
||||
old_pushInitializers(e, i), old_pushInitializers(e, n);
|
||||
}
|
||||
function old_pushInitializers(e, t) {
|
||||
t && e.push(function (e) {
|
||||
for (var a = 0; a < t.length; a++) t[a].call(e);
|
||||
return e;
|
||||
});
|
||||
}
|
||||
function old_applyClassDecs(e, t, a, r) {
|
||||
if (r.length > 0) {
|
||||
for (var o = [], i = t, n = t.name, l = r.length - 1; l >= 0; l--) {
|
||||
var s = {
|
||||
v: !1
|
||||
};
|
||||
try {
|
||||
var c = Object.assign({
|
||||
kind: "class",
|
||||
name: n,
|
||||
addInitializer: old_createAddInitializerMethod(o, s)
|
||||
}, old_createMetadataMethodsForProperty(a, 0, n, s)),
|
||||
d = r[l](i, c);
|
||||
} finally {
|
||||
s.v = !0;
|
||||
}
|
||||
void 0 !== d && (old_assertValidReturnValue(10, d), i = d);
|
||||
}
|
||||
e.push(i, function () {
|
||||
for (var e = 0; e < o.length; e++) o[e].call(i);
|
||||
});
|
||||
}
|
||||
}
|
||||
function applyDecs(e, t, a) {
|
||||
var r = [],
|
||||
o = {},
|
||||
i = {};
|
||||
return old_applyMemberDecs(r, e, i, o, t), old_convertMetadataMapToFinal(e.prototype, i), old_applyClassDecs(r, e, o, a), old_convertMetadataMapToFinal(e, o), r;
|
||||
}
|
||||
module.exports = applyDecs, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,184 +0,0 @@
|
||||
var _typeof = require("./typeof.js")["default"];
|
||||
function applyDecs2203Factory() {
|
||||
function createAddInitializerMethod(e, t) {
|
||||
return function (r) {
|
||||
!function (e, t) {
|
||||
if (e.v) throw Error("attempted to call addInitializer after decoration was finished");
|
||||
}(t), assertCallable(r, "An initializer"), e.push(r);
|
||||
};
|
||||
}
|
||||
function memberDec(e, t, r, a, n, i, s, o) {
|
||||
var c;
|
||||
switch (n) {
|
||||
case 1:
|
||||
c = "accessor";
|
||||
break;
|
||||
case 2:
|
||||
c = "method";
|
||||
break;
|
||||
case 3:
|
||||
c = "getter";
|
||||
break;
|
||||
case 4:
|
||||
c = "setter";
|
||||
break;
|
||||
default:
|
||||
c = "field";
|
||||
}
|
||||
var l,
|
||||
u,
|
||||
f = {
|
||||
kind: c,
|
||||
name: s ? "#" + t : t,
|
||||
"static": i,
|
||||
"private": s
|
||||
},
|
||||
p = {
|
||||
v: !1
|
||||
};
|
||||
0 !== n && (f.addInitializer = createAddInitializerMethod(a, p)), 0 === n ? s ? (l = r.get, u = r.set) : (l = function l() {
|
||||
return this[t];
|
||||
}, u = function u(e) {
|
||||
this[t] = e;
|
||||
}) : 2 === n ? l = function l() {
|
||||
return r.value;
|
||||
} : (1 !== n && 3 !== n || (l = function l() {
|
||||
return r.get.call(this);
|
||||
}), 1 !== n && 4 !== n || (u = function u(e) {
|
||||
r.set.call(this, e);
|
||||
})), f.access = l && u ? {
|
||||
get: l,
|
||||
set: u
|
||||
} : l ? {
|
||||
get: l
|
||||
} : {
|
||||
set: u
|
||||
};
|
||||
try {
|
||||
return e(o, f);
|
||||
} finally {
|
||||
p.v = !0;
|
||||
}
|
||||
}
|
||||
function assertCallable(e, t) {
|
||||
if ("function" != typeof e) throw new TypeError(t + " must be a function");
|
||||
}
|
||||
function assertValidReturnValue(e, t) {
|
||||
var r = _typeof(t);
|
||||
if (1 === e) {
|
||||
if ("object" !== r || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
||||
void 0 !== t.get && assertCallable(t.get, "accessor.get"), void 0 !== t.set && assertCallable(t.set, "accessor.set"), void 0 !== t.init && assertCallable(t.init, "accessor.init");
|
||||
} else if ("function" !== r) throw new TypeError((0 === e ? "field" : 10 === e ? "class" : "method") + " decorators must return a function or void 0");
|
||||
}
|
||||
function applyMemberDec(e, t, r, a, n, i, s, o) {
|
||||
var c,
|
||||
l,
|
||||
u,
|
||||
f,
|
||||
p,
|
||||
d,
|
||||
h = r[0];
|
||||
if (s ? c = 0 === n || 1 === n ? {
|
||||
get: r[3],
|
||||
set: r[4]
|
||||
} : 3 === n ? {
|
||||
get: r[3]
|
||||
} : 4 === n ? {
|
||||
set: r[3]
|
||||
} : {
|
||||
value: r[3]
|
||||
} : 0 !== n && (c = Object.getOwnPropertyDescriptor(t, a)), 1 === n ? u = {
|
||||
get: c.get,
|
||||
set: c.set
|
||||
} : 2 === n ? u = c.value : 3 === n ? u = c.get : 4 === n && (u = c.set), "function" == typeof h) void 0 !== (f = memberDec(h, a, c, o, n, i, s, u)) && (assertValidReturnValue(n, f), 0 === n ? l = f : 1 === n ? (l = f.init, p = f.get || u.get, d = f.set || u.set, u = {
|
||||
get: p,
|
||||
set: d
|
||||
}) : u = f);else for (var v = h.length - 1; v >= 0; v--) {
|
||||
var g;
|
||||
void 0 !== (f = memberDec(h[v], a, c, o, n, i, s, u)) && (assertValidReturnValue(n, f), 0 === n ? g = f : 1 === n ? (g = f.init, p = f.get || u.get, d = f.set || u.set, u = {
|
||||
get: p,
|
||||
set: d
|
||||
}) : u = f, void 0 !== g && (void 0 === l ? l = g : "function" == typeof l ? l = [l, g] : l.push(g)));
|
||||
}
|
||||
if (0 === n || 1 === n) {
|
||||
if (void 0 === l) l = function l(e, t) {
|
||||
return t;
|
||||
};else if ("function" != typeof l) {
|
||||
var y = l;
|
||||
l = function l(e, t) {
|
||||
for (var r = t, a = 0; a < y.length; a++) r = y[a].call(e, r);
|
||||
return r;
|
||||
};
|
||||
} else {
|
||||
var m = l;
|
||||
l = function l(e, t) {
|
||||
return m.call(e, t);
|
||||
};
|
||||
}
|
||||
e.push(l);
|
||||
}
|
||||
0 !== n && (1 === n ? (c.get = u.get, c.set = u.set) : 2 === n ? c.value = u : 3 === n ? c.get = u : 4 === n && (c.set = u), s ? 1 === n ? (e.push(function (e, t) {
|
||||
return u.get.call(e, t);
|
||||
}), e.push(function (e, t) {
|
||||
return u.set.call(e, t);
|
||||
})) : 2 === n ? e.push(u) : e.push(function (e, t) {
|
||||
return u.call(e, t);
|
||||
}) : Object.defineProperty(t, a, c));
|
||||
}
|
||||
function pushInitializers(e, t) {
|
||||
t && e.push(function (e) {
|
||||
for (var r = 0; r < t.length; r++) t[r].call(e);
|
||||
return e;
|
||||
});
|
||||
}
|
||||
return function (e, t, r) {
|
||||
var a = [];
|
||||
return function (e, t, r) {
|
||||
for (var a, n, i = new Map(), s = new Map(), o = 0; o < r.length; o++) {
|
||||
var c = r[o];
|
||||
if (Array.isArray(c)) {
|
||||
var l,
|
||||
u,
|
||||
f = c[1],
|
||||
p = c[2],
|
||||
d = c.length > 3,
|
||||
h = f >= 5;
|
||||
if (h ? (l = t, 0 != (f -= 5) && (u = n = n || [])) : (l = t.prototype, 0 !== f && (u = a = a || [])), 0 !== f && !d) {
|
||||
var v = h ? s : i,
|
||||
g = v.get(p) || 0;
|
||||
if (!0 === g || 3 === g && 4 !== f || 4 === g && 3 !== f) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + p);
|
||||
!g && f > 2 ? v.set(p, f) : v.set(p, !0);
|
||||
}
|
||||
applyMemberDec(e, l, c, p, f, h, d, u);
|
||||
}
|
||||
}
|
||||
pushInitializers(e, a), pushInitializers(e, n);
|
||||
}(a, e, t), function (e, t, r) {
|
||||
if (r.length > 0) {
|
||||
for (var a = [], n = t, i = t.name, s = r.length - 1; s >= 0; s--) {
|
||||
var o = {
|
||||
v: !1
|
||||
};
|
||||
try {
|
||||
var c = r[s](n, {
|
||||
kind: "class",
|
||||
name: i,
|
||||
addInitializer: createAddInitializerMethod(a, o)
|
||||
});
|
||||
} finally {
|
||||
o.v = !0;
|
||||
}
|
||||
void 0 !== c && (assertValidReturnValue(10, c), n = c);
|
||||
}
|
||||
e.push(n, function () {
|
||||
for (var e = 0; e < a.length; e++) a[e].call(n);
|
||||
});
|
||||
}
|
||||
}(a, e, r), a;
|
||||
};
|
||||
}
|
||||
var applyDecs2203Impl;
|
||||
function applyDecs2203(e, t, r) {
|
||||
return (applyDecs2203Impl = applyDecs2203Impl || applyDecs2203Factory())(e, t, r);
|
||||
}
|
||||
module.exports = applyDecs2203, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,191 +0,0 @@
|
||||
var _typeof = require("./typeof.js")["default"];
|
||||
var setFunctionName = require("./setFunctionName.js");
|
||||
var toPropertyKey = require("./toPropertyKey.js");
|
||||
function applyDecs2203RFactory() {
|
||||
function createAddInitializerMethod(e, t) {
|
||||
return function (r) {
|
||||
!function (e, t) {
|
||||
if (e.v) throw Error("attempted to call addInitializer after decoration was finished");
|
||||
}(t), assertCallable(r, "An initializer"), e.push(r);
|
||||
};
|
||||
}
|
||||
function memberDec(e, t, r, n, a, i, o, s) {
|
||||
var c;
|
||||
switch (a) {
|
||||
case 1:
|
||||
c = "accessor";
|
||||
break;
|
||||
case 2:
|
||||
c = "method";
|
||||
break;
|
||||
case 3:
|
||||
c = "getter";
|
||||
break;
|
||||
case 4:
|
||||
c = "setter";
|
||||
break;
|
||||
default:
|
||||
c = "field";
|
||||
}
|
||||
var l,
|
||||
u,
|
||||
f = {
|
||||
kind: c,
|
||||
name: o ? "#" + t : toPropertyKey(t),
|
||||
"static": i,
|
||||
"private": o
|
||||
},
|
||||
p = {
|
||||
v: !1
|
||||
};
|
||||
0 !== a && (f.addInitializer = createAddInitializerMethod(n, p)), 0 === a ? o ? (l = r.get, u = r.set) : (l = function l() {
|
||||
return this[t];
|
||||
}, u = function u(e) {
|
||||
this[t] = e;
|
||||
}) : 2 === a ? l = function l() {
|
||||
return r.value;
|
||||
} : (1 !== a && 3 !== a || (l = function l() {
|
||||
return r.get.call(this);
|
||||
}), 1 !== a && 4 !== a || (u = function u(e) {
|
||||
r.set.call(this, e);
|
||||
})), f.access = l && u ? {
|
||||
get: l,
|
||||
set: u
|
||||
} : l ? {
|
||||
get: l
|
||||
} : {
|
||||
set: u
|
||||
};
|
||||
try {
|
||||
return e(s, f);
|
||||
} finally {
|
||||
p.v = !0;
|
||||
}
|
||||
}
|
||||
function assertCallable(e, t) {
|
||||
if ("function" != typeof e) throw new TypeError(t + " must be a function");
|
||||
}
|
||||
function assertValidReturnValue(e, t) {
|
||||
var r = _typeof(t);
|
||||
if (1 === e) {
|
||||
if ("object" !== r || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
||||
void 0 !== t.get && assertCallable(t.get, "accessor.get"), void 0 !== t.set && assertCallable(t.set, "accessor.set"), void 0 !== t.init && assertCallable(t.init, "accessor.init");
|
||||
} else if ("function" !== r) throw new TypeError((0 === e ? "field" : 10 === e ? "class" : "method") + " decorators must return a function or void 0");
|
||||
}
|
||||
function applyMemberDec(e, t, r, n, a, i, o, s) {
|
||||
var c,
|
||||
l,
|
||||
u,
|
||||
f,
|
||||
p,
|
||||
d,
|
||||
h,
|
||||
v = r[0];
|
||||
if (o ? (0 === a || 1 === a ? (c = {
|
||||
get: r[3],
|
||||
set: r[4]
|
||||
}, u = "get") : 3 === a ? (c = {
|
||||
get: r[3]
|
||||
}, u = "get") : 4 === a ? (c = {
|
||||
set: r[3]
|
||||
}, u = "set") : c = {
|
||||
value: r[3]
|
||||
}, 0 !== a && (1 === a && setFunctionName(r[4], "#" + n, "set"), setFunctionName(r[3], "#" + n, u))) : 0 !== a && (c = Object.getOwnPropertyDescriptor(t, n)), 1 === a ? f = {
|
||||
get: c.get,
|
||||
set: c.set
|
||||
} : 2 === a ? f = c.value : 3 === a ? f = c.get : 4 === a && (f = c.set), "function" == typeof v) void 0 !== (p = memberDec(v, n, c, s, a, i, o, f)) && (assertValidReturnValue(a, p), 0 === a ? l = p : 1 === a ? (l = p.init, d = p.get || f.get, h = p.set || f.set, f = {
|
||||
get: d,
|
||||
set: h
|
||||
}) : f = p);else for (var g = v.length - 1; g >= 0; g--) {
|
||||
var y;
|
||||
void 0 !== (p = memberDec(v[g], n, c, s, a, i, o, f)) && (assertValidReturnValue(a, p), 0 === a ? y = p : 1 === a ? (y = p.init, d = p.get || f.get, h = p.set || f.set, f = {
|
||||
get: d,
|
||||
set: h
|
||||
}) : f = p, void 0 !== y && (void 0 === l ? l = y : "function" == typeof l ? l = [l, y] : l.push(y)));
|
||||
}
|
||||
if (0 === a || 1 === a) {
|
||||
if (void 0 === l) l = function l(e, t) {
|
||||
return t;
|
||||
};else if ("function" != typeof l) {
|
||||
var m = l;
|
||||
l = function l(e, t) {
|
||||
for (var r = t, n = 0; n < m.length; n++) r = m[n].call(e, r);
|
||||
return r;
|
||||
};
|
||||
} else {
|
||||
var b = l;
|
||||
l = function l(e, t) {
|
||||
return b.call(e, t);
|
||||
};
|
||||
}
|
||||
e.push(l);
|
||||
}
|
||||
0 !== a && (1 === a ? (c.get = f.get, c.set = f.set) : 2 === a ? c.value = f : 3 === a ? c.get = f : 4 === a && (c.set = f), o ? 1 === a ? (e.push(function (e, t) {
|
||||
return f.get.call(e, t);
|
||||
}), e.push(function (e, t) {
|
||||
return f.set.call(e, t);
|
||||
})) : 2 === a ? e.push(f) : e.push(function (e, t) {
|
||||
return f.call(e, t);
|
||||
}) : Object.defineProperty(t, n, c));
|
||||
}
|
||||
function applyMemberDecs(e, t) {
|
||||
for (var r, n, a = [], i = new Map(), o = new Map(), s = 0; s < t.length; s++) {
|
||||
var c = t[s];
|
||||
if (Array.isArray(c)) {
|
||||
var l,
|
||||
u,
|
||||
f = c[1],
|
||||
p = c[2],
|
||||
d = c.length > 3,
|
||||
h = f >= 5;
|
||||
if (h ? (l = e, 0 != (f -= 5) && (u = n = n || [])) : (l = e.prototype, 0 !== f && (u = r = r || [])), 0 !== f && !d) {
|
||||
var v = h ? o : i,
|
||||
g = v.get(p) || 0;
|
||||
if (!0 === g || 3 === g && 4 !== f || 4 === g && 3 !== f) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + p);
|
||||
!g && f > 2 ? v.set(p, f) : v.set(p, !0);
|
||||
}
|
||||
applyMemberDec(a, l, c, p, f, h, d, u);
|
||||
}
|
||||
}
|
||||
return pushInitializers(a, r), pushInitializers(a, n), a;
|
||||
}
|
||||
function pushInitializers(e, t) {
|
||||
t && e.push(function (e) {
|
||||
for (var r = 0; r < t.length; r++) t[r].call(e);
|
||||
return e;
|
||||
});
|
||||
}
|
||||
return function (e, t, r) {
|
||||
return {
|
||||
e: applyMemberDecs(e, t),
|
||||
get c() {
|
||||
return function (e, t) {
|
||||
if (t.length > 0) {
|
||||
for (var r = [], n = e, a = e.name, i = t.length - 1; i >= 0; i--) {
|
||||
var o = {
|
||||
v: !1
|
||||
};
|
||||
try {
|
||||
var s = t[i](n, {
|
||||
kind: "class",
|
||||
name: a,
|
||||
addInitializer: createAddInitializerMethod(r, o)
|
||||
});
|
||||
} finally {
|
||||
o.v = !0;
|
||||
}
|
||||
void 0 !== s && (assertValidReturnValue(10, s), n = s);
|
||||
}
|
||||
return [n, function () {
|
||||
for (var e = 0; e < r.length; e++) r[e].call(n);
|
||||
}];
|
||||
}
|
||||
}(e, r);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
function applyDecs2203R(e, t, r) {
|
||||
return (module.exports = applyDecs2203R = applyDecs2203RFactory(), module.exports.__esModule = true, module.exports["default"] = module.exports)(e, t, r);
|
||||
}
|
||||
module.exports = applyDecs2203R, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,222 +0,0 @@
|
||||
var _typeof = require("./typeof.js")["default"];
|
||||
var checkInRHS = require("./checkInRHS.js");
|
||||
var setFunctionName = require("./setFunctionName.js");
|
||||
var toPropertyKey = require("./toPropertyKey.js");
|
||||
function applyDecs2301Factory() {
|
||||
function createAddInitializerMethod(e, t) {
|
||||
return function (r) {
|
||||
!function (e, t) {
|
||||
if (e.v) throw Error("attempted to call addInitializer after decoration was finished");
|
||||
}(t), assertCallable(r, "An initializer"), e.push(r);
|
||||
};
|
||||
}
|
||||
function assertInstanceIfPrivate(e, t) {
|
||||
if (!e(t)) throw new TypeError("Attempted to access private element on non-instance");
|
||||
}
|
||||
function memberDec(e, t, r, n, a, i, s, o, c) {
|
||||
var u;
|
||||
switch (a) {
|
||||
case 1:
|
||||
u = "accessor";
|
||||
break;
|
||||
case 2:
|
||||
u = "method";
|
||||
break;
|
||||
case 3:
|
||||
u = "getter";
|
||||
break;
|
||||
case 4:
|
||||
u = "setter";
|
||||
break;
|
||||
default:
|
||||
u = "field";
|
||||
}
|
||||
var l,
|
||||
f,
|
||||
p = {
|
||||
kind: u,
|
||||
name: s ? "#" + t : toPropertyKey(t),
|
||||
"static": i,
|
||||
"private": s
|
||||
},
|
||||
d = {
|
||||
v: !1
|
||||
};
|
||||
if (0 !== a && (p.addInitializer = createAddInitializerMethod(n, d)), s || 0 !== a && 2 !== a) {
|
||||
if (2 === a) l = function l(e) {
|
||||
return assertInstanceIfPrivate(c, e), r.value;
|
||||
};else {
|
||||
var h = 0 === a || 1 === a;
|
||||
(h || 3 === a) && (l = s ? function (e) {
|
||||
return assertInstanceIfPrivate(c, e), r.get.call(e);
|
||||
} : function (e) {
|
||||
return r.get.call(e);
|
||||
}), (h || 4 === a) && (f = s ? function (e, t) {
|
||||
assertInstanceIfPrivate(c, e), r.set.call(e, t);
|
||||
} : function (e, t) {
|
||||
r.set.call(e, t);
|
||||
});
|
||||
}
|
||||
} else l = function l(e) {
|
||||
return e[t];
|
||||
}, 0 === a && (f = function f(e, r) {
|
||||
e[t] = r;
|
||||
});
|
||||
var v = s ? c.bind() : function (e) {
|
||||
return t in e;
|
||||
};
|
||||
p.access = l && f ? {
|
||||
get: l,
|
||||
set: f,
|
||||
has: v
|
||||
} : l ? {
|
||||
get: l,
|
||||
has: v
|
||||
} : {
|
||||
set: f,
|
||||
has: v
|
||||
};
|
||||
try {
|
||||
return e(o, p);
|
||||
} finally {
|
||||
d.v = !0;
|
||||
}
|
||||
}
|
||||
function assertCallable(e, t) {
|
||||
if ("function" != typeof e) throw new TypeError(t + " must be a function");
|
||||
}
|
||||
function assertValidReturnValue(e, t) {
|
||||
var r = _typeof(t);
|
||||
if (1 === e) {
|
||||
if ("object" !== r || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
||||
void 0 !== t.get && assertCallable(t.get, "accessor.get"), void 0 !== t.set && assertCallable(t.set, "accessor.set"), void 0 !== t.init && assertCallable(t.init, "accessor.init");
|
||||
} else if ("function" !== r) throw new TypeError((0 === e ? "field" : 10 === e ? "class" : "method") + " decorators must return a function or void 0");
|
||||
}
|
||||
function curryThis2(e) {
|
||||
return function (t) {
|
||||
e(this, t);
|
||||
};
|
||||
}
|
||||
function applyMemberDec(e, t, r, n, a, i, s, o, c) {
|
||||
var u,
|
||||
l,
|
||||
f,
|
||||
p,
|
||||
d,
|
||||
h,
|
||||
v,
|
||||
y,
|
||||
g = r[0];
|
||||
if (s ? (0 === a || 1 === a ? (u = {
|
||||
get: (d = r[3], function () {
|
||||
return d(this);
|
||||
}),
|
||||
set: curryThis2(r[4])
|
||||
}, f = "get") : 3 === a ? (u = {
|
||||
get: r[3]
|
||||
}, f = "get") : 4 === a ? (u = {
|
||||
set: r[3]
|
||||
}, f = "set") : u = {
|
||||
value: r[3]
|
||||
}, 0 !== a && (1 === a && setFunctionName(u.set, "#" + n, "set"), setFunctionName(u[f || "value"], "#" + n, f))) : 0 !== a && (u = Object.getOwnPropertyDescriptor(t, n)), 1 === a ? p = {
|
||||
get: u.get,
|
||||
set: u.set
|
||||
} : 2 === a ? p = u.value : 3 === a ? p = u.get : 4 === a && (p = u.set), "function" == typeof g) void 0 !== (h = memberDec(g, n, u, o, a, i, s, p, c)) && (assertValidReturnValue(a, h), 0 === a ? l = h : 1 === a ? (l = h.init, v = h.get || p.get, y = h.set || p.set, p = {
|
||||
get: v,
|
||||
set: y
|
||||
}) : p = h);else for (var m = g.length - 1; m >= 0; m--) {
|
||||
var b;
|
||||
void 0 !== (h = memberDec(g[m], n, u, o, a, i, s, p, c)) && (assertValidReturnValue(a, h), 0 === a ? b = h : 1 === a ? (b = h.init, v = h.get || p.get, y = h.set || p.set, p = {
|
||||
get: v,
|
||||
set: y
|
||||
}) : p = h, void 0 !== b && (void 0 === l ? l = b : "function" == typeof l ? l = [l, b] : l.push(b)));
|
||||
}
|
||||
if (0 === a || 1 === a) {
|
||||
if (void 0 === l) l = function l(e, t) {
|
||||
return t;
|
||||
};else if ("function" != typeof l) {
|
||||
var I = l;
|
||||
l = function l(e, t) {
|
||||
for (var r = t, n = 0; n < I.length; n++) r = I[n].call(e, r);
|
||||
return r;
|
||||
};
|
||||
} else {
|
||||
var w = l;
|
||||
l = function l(e, t) {
|
||||
return w.call(e, t);
|
||||
};
|
||||
}
|
||||
e.push(l);
|
||||
}
|
||||
0 !== a && (1 === a ? (u.get = p.get, u.set = p.set) : 2 === a ? u.value = p : 3 === a ? u.get = p : 4 === a && (u.set = p), s ? 1 === a ? (e.push(function (e, t) {
|
||||
return p.get.call(e, t);
|
||||
}), e.push(function (e, t) {
|
||||
return p.set.call(e, t);
|
||||
})) : 2 === a ? e.push(p) : e.push(function (e, t) {
|
||||
return p.call(e, t);
|
||||
}) : Object.defineProperty(t, n, u));
|
||||
}
|
||||
function applyMemberDecs(e, t, r) {
|
||||
for (var n, a, i, s = [], o = new Map(), c = new Map(), u = 0; u < t.length; u++) {
|
||||
var l = t[u];
|
||||
if (Array.isArray(l)) {
|
||||
var f,
|
||||
p,
|
||||
d = l[1],
|
||||
h = l[2],
|
||||
v = l.length > 3,
|
||||
y = d >= 5,
|
||||
g = r;
|
||||
if (y ? (f = e, 0 != (d -= 5) && (p = a = a || []), v && !i && (i = function i(t) {
|
||||
return checkInRHS(t) === e;
|
||||
}), g = i) : (f = e.prototype, 0 !== d && (p = n = n || [])), 0 !== d && !v) {
|
||||
var m = y ? c : o,
|
||||
b = m.get(h) || 0;
|
||||
if (!0 === b || 3 === b && 4 !== d || 4 === b && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h);
|
||||
!b && d > 2 ? m.set(h, d) : m.set(h, !0);
|
||||
}
|
||||
applyMemberDec(s, f, l, h, d, y, v, p, g);
|
||||
}
|
||||
}
|
||||
return pushInitializers(s, n), pushInitializers(s, a), s;
|
||||
}
|
||||
function pushInitializers(e, t) {
|
||||
t && e.push(function (e) {
|
||||
for (var r = 0; r < t.length; r++) t[r].call(e);
|
||||
return e;
|
||||
});
|
||||
}
|
||||
return function (e, t, r, n) {
|
||||
return {
|
||||
e: applyMemberDecs(e, t, n),
|
||||
get c() {
|
||||
return function (e, t) {
|
||||
if (t.length > 0) {
|
||||
for (var r = [], n = e, a = e.name, i = t.length - 1; i >= 0; i--) {
|
||||
var s = {
|
||||
v: !1
|
||||
};
|
||||
try {
|
||||
var o = t[i](n, {
|
||||
kind: "class",
|
||||
name: a,
|
||||
addInitializer: createAddInitializerMethod(r, s)
|
||||
});
|
||||
} finally {
|
||||
s.v = !0;
|
||||
}
|
||||
void 0 !== o && (assertValidReturnValue(10, o), n = o);
|
||||
}
|
||||
return [n, function () {
|
||||
for (var e = 0; e < r.length; e++) r[e].call(n);
|
||||
}];
|
||||
}
|
||||
}(e, r);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
function applyDecs2301(e, t, r, n) {
|
||||
return (module.exports = applyDecs2301 = applyDecs2301Factory(), module.exports.__esModule = true, module.exports["default"] = module.exports)(e, t, r, n);
|
||||
}
|
||||
module.exports = applyDecs2301, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,133 +0,0 @@
|
||||
var _typeof = require("./typeof.js")["default"];
|
||||
var checkInRHS = require("./checkInRHS.js");
|
||||
var setFunctionName = require("./setFunctionName.js");
|
||||
var toPropertyKey = require("./toPropertyKey.js");
|
||||
function applyDecs2305(e, t, r, n, o, a) {
|
||||
function i(e, t, r) {
|
||||
return function (n, o) {
|
||||
return r && r(n), e[t].call(n, o);
|
||||
};
|
||||
}
|
||||
function c(e, t) {
|
||||
for (var r = 0; r < e.length; r++) e[r].call(t);
|
||||
return t;
|
||||
}
|
||||
function s(e, t, r, n) {
|
||||
if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined"));
|
||||
return e;
|
||||
}
|
||||
function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) {
|
||||
function m(e) {
|
||||
if (!h(e)) throw new TypeError("Attempted to access private element on non-instance");
|
||||
}
|
||||
var y,
|
||||
v = t[0],
|
||||
g = t[3],
|
||||
b = !u;
|
||||
if (!b) {
|
||||
r || Array.isArray(v) || (v = [v]);
|
||||
var w = {},
|
||||
S = [],
|
||||
A = 3 === o ? "get" : 4 === o || d ? "set" : "value";
|
||||
f ? (p || d ? w = {
|
||||
get: setFunctionName(function () {
|
||||
return g(this);
|
||||
}, n, "get"),
|
||||
set: function set(e) {
|
||||
t[4](this, e);
|
||||
}
|
||||
} : w[A] = g, p || setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n));
|
||||
}
|
||||
for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) {
|
||||
var D = v[j],
|
||||
E = r ? v[j - 1] : void 0,
|
||||
I = {},
|
||||
O = {
|
||||
kind: ["field", "accessor", "method", "getter", "setter", "class"][o],
|
||||
name: n,
|
||||
metadata: a,
|
||||
addInitializer: function (e, t) {
|
||||
if (e.v) throw Error("attempted to call addInitializer after decoration was finished");
|
||||
s(t, "An initializer", "be", !0), c.push(t);
|
||||
}.bind(null, I)
|
||||
};
|
||||
try {
|
||||
if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else {
|
||||
var k, F;
|
||||
O["static"] = l, O["private"] = f, f ? 2 === o ? k = function k(e) {
|
||||
return m(e), w.value;
|
||||
} : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function k(e) {
|
||||
return e[n];
|
||||
}, (o < 2 || 4 === o) && (F = function F(e, t) {
|
||||
e[n] = t;
|
||||
}));
|
||||
var N = O.access = {
|
||||
has: f ? h.bind() : function (e) {
|
||||
return n in e;
|
||||
}
|
||||
};
|
||||
if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? {
|
||||
get: w.get,
|
||||
set: w.set
|
||||
} : w[A], O), d) {
|
||||
if ("object" == _typeof(P) && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
||||
} else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P);
|
||||
}
|
||||
} finally {
|
||||
I.v = !0;
|
||||
}
|
||||
}
|
||||
return (p || d) && u.push(function (e, t) {
|
||||
for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t);
|
||||
return t;
|
||||
}), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P;
|
||||
}
|
||||
function u(e, t) {
|
||||
return Object.defineProperty(e, Symbol.metadata || Symbol["for"]("Symbol.metadata"), {
|
||||
configurable: !0,
|
||||
enumerable: !0,
|
||||
value: t
|
||||
});
|
||||
}
|
||||
if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol["for"]("Symbol.metadata")];
|
||||
var f = Object.create(null == l ? null : l),
|
||||
p = function (e, t, r, n) {
|
||||
var o,
|
||||
a,
|
||||
i = [],
|
||||
s = function s(t) {
|
||||
return checkInRHS(t) === e;
|
||||
},
|
||||
u = new Map();
|
||||
function l(e) {
|
||||
e && i.push(c.bind(null, e));
|
||||
}
|
||||
for (var f = 0; f < t.length; f++) {
|
||||
var p = t[f];
|
||||
if (Array.isArray(p)) {
|
||||
var d = p[1],
|
||||
h = p[2],
|
||||
m = p.length > 3,
|
||||
y = 16 & d,
|
||||
v = !!(8 & d),
|
||||
g = 0 == (d &= 7),
|
||||
b = h + "/" + v;
|
||||
if (!g && !m) {
|
||||
var w = u.get(b);
|
||||
if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h);
|
||||
u.set(b, !(d > 2) || d);
|
||||
}
|
||||
applyDec(v ? e : e.prototype, p, y, m ? "#" + h : toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r);
|
||||
}
|
||||
}
|
||||
return l(o), l(a), i;
|
||||
}(e, t, o, f);
|
||||
return r.length || u(e, f), {
|
||||
e: p,
|
||||
get c() {
|
||||
var t = [];
|
||||
return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)];
|
||||
}
|
||||
};
|
||||
}
|
||||
module.exports = applyDecs2305, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,124 +0,0 @@
|
||||
var _typeof = require("./typeof.js")["default"];
|
||||
var checkInRHS = require("./checkInRHS.js");
|
||||
var setFunctionName = require("./setFunctionName.js");
|
||||
var toPropertyKey = require("./toPropertyKey.js");
|
||||
function applyDecs2311(e, t, n, r, o, i) {
|
||||
var a,
|
||||
c,
|
||||
u,
|
||||
s,
|
||||
f,
|
||||
l,
|
||||
p,
|
||||
d = Symbol.metadata || Symbol["for"]("Symbol.metadata"),
|
||||
m = Object.defineProperty,
|
||||
h = Object.create,
|
||||
y = [h(null), h(null)],
|
||||
v = t.length;
|
||||
function g(t, n, r) {
|
||||
return function (o, i) {
|
||||
n && (i = o, o = e);
|
||||
for (var a = 0; a < t.length; a++) i = t[a].apply(o, r ? [i] : []);
|
||||
return r ? i : o;
|
||||
};
|
||||
}
|
||||
function b(e, t, n, r) {
|
||||
if ("function" != typeof e && (r || void 0 !== e)) throw new TypeError(t + " must " + (n || "be") + " a function" + (r ? "" : " or undefined"));
|
||||
return e;
|
||||
}
|
||||
function applyDec(e, t, n, r, o, i, u, s, f, l, p) {
|
||||
function d(e) {
|
||||
if (!p(e)) throw new TypeError("Attempted to access private element on non-instance");
|
||||
}
|
||||
var h = [].concat(t[0]),
|
||||
v = t[3],
|
||||
w = !u,
|
||||
D = 1 === o,
|
||||
S = 3 === o,
|
||||
j = 4 === o,
|
||||
E = 2 === o;
|
||||
function I(t, n, r) {
|
||||
return function (o, i) {
|
||||
return n && (i = o, o = e), r && r(o), P[t].call(o, i);
|
||||
};
|
||||
}
|
||||
if (!w) {
|
||||
var P = {},
|
||||
k = [],
|
||||
F = S ? "get" : j || D ? "set" : "value";
|
||||
if (f ? (l || D ? P = {
|
||||
get: setFunctionName(function () {
|
||||
return v(this);
|
||||
}, r, "get"),
|
||||
set: function set(e) {
|
||||
t[4](this, e);
|
||||
}
|
||||
} : P[F] = v, l || setFunctionName(P[F], r, E ? "" : F)) : l || (P = Object.getOwnPropertyDescriptor(e, r)), !l && !f) {
|
||||
if ((c = y[+s][r]) && 7 != (c ^ o)) throw Error("Decorating two elements with the same name (" + P[F].name + ") is not supported yet");
|
||||
y[+s][r] = o < 3 ? 1 : o;
|
||||
}
|
||||
}
|
||||
for (var N = e, O = h.length - 1; O >= 0; O -= n ? 2 : 1) {
|
||||
var T = b(h[O], "A decorator", "be", !0),
|
||||
z = n ? h[O - 1] : void 0,
|
||||
A = {},
|
||||
H = {
|
||||
kind: ["field", "accessor", "method", "getter", "setter", "class"][o],
|
||||
name: r,
|
||||
metadata: a,
|
||||
addInitializer: function (e, t) {
|
||||
if (e.v) throw new TypeError("attempted to call addInitializer after decoration was finished");
|
||||
b(t, "An initializer", "be", !0), i.push(t);
|
||||
}.bind(null, A)
|
||||
};
|
||||
if (w) c = T.call(z, N, H), A.v = 1, b(c, "class decorators", "return") && (N = c);else if (H["static"] = s, H["private"] = f, c = H.access = {
|
||||
has: f ? p.bind() : function (e) {
|
||||
return r in e;
|
||||
}
|
||||
}, j || (c.get = f ? E ? function (e) {
|
||||
return d(e), P.value;
|
||||
} : I("get", 0, d) : function (e) {
|
||||
return e[r];
|
||||
}), E || S || (c.set = f ? I("set", 0, d) : function (e, t) {
|
||||
e[r] = t;
|
||||
}), N = T.call(z, D ? {
|
||||
get: P.get,
|
||||
set: P.set
|
||||
} : P[F], H), A.v = 1, D) {
|
||||
if ("object" == _typeof(N) && N) (c = b(N.get, "accessor.get")) && (P.get = c), (c = b(N.set, "accessor.set")) && (P.set = c), (c = b(N.init, "accessor.init")) && k.unshift(c);else if (void 0 !== N) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
|
||||
} else b(N, (l ? "field" : "method") + " decorators", "return") && (l ? k.unshift(N) : P[F] = N);
|
||||
}
|
||||
return o < 2 && u.push(g(k, s, 1), g(i, s, 0)), l || w || (f ? D ? u.splice(-1, 0, I("get", s), I("set", s)) : u.push(E ? P[F] : b.call.bind(P[F])) : m(e, r, P)), N;
|
||||
}
|
||||
function w(e) {
|
||||
return m(e, d, {
|
||||
configurable: !0,
|
||||
enumerable: !0,
|
||||
value: a
|
||||
});
|
||||
}
|
||||
return void 0 !== i && (a = i[d]), a = h(null == a ? null : a), f = [], l = function l(e) {
|
||||
e && f.push(g(e));
|
||||
}, p = function p(t, r) {
|
||||
for (var i = 0; i < n.length; i++) {
|
||||
var a = n[i],
|
||||
c = a[1],
|
||||
l = 7 & c;
|
||||
if ((8 & c) == t && !l == r) {
|
||||
var p = a[2],
|
||||
d = !!a[3],
|
||||
m = 16 & c;
|
||||
applyDec(t ? e : e.prototype, a, m, d ? "#" + p : toPropertyKey(p), l, l < 2 ? [] : t ? s = s || [] : u = u || [], f, !!t, d, r, t && d ? function (t) {
|
||||
return checkInRHS(t) === e;
|
||||
} : o);
|
||||
}
|
||||
}
|
||||
}, p(8, 0), p(0, 0), p(8, 1), p(0, 1), l(u), l(s), c = f, v || w(e), {
|
||||
e: c,
|
||||
get c() {
|
||||
var n = [];
|
||||
return v && [w(e = applyDec(e, [t], r, e.name, 5, n)), g(n, 1)];
|
||||
}
|
||||
};
|
||||
}
|
||||
module.exports = applyDecs2311, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,6 +0,0 @@
|
||||
function _arrayLikeToArray(r, a) {
|
||||
(null == a || a > r.length) && (a = r.length);
|
||||
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
||||
return n;
|
||||
}
|
||||
module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,4 +0,0 @@
|
||||
function _arrayWithHoles(r) {
|
||||
if (Array.isArray(r)) return r;
|
||||
}
|
||||
module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,5 +0,0 @@
|
||||
var arrayLikeToArray = require("./arrayLikeToArray.js");
|
||||
function _arrayWithoutHoles(r) {
|
||||
if (Array.isArray(r)) return arrayLikeToArray(r);
|
||||
}
|
||||
module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,5 +0,0 @@
|
||||
function _assertClassBrand(e, t, n) {
|
||||
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
||||
throw new TypeError("Private element is not present on this object");
|
||||
}
|
||||
module.exports = _assertClassBrand, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,5 +0,0 @@
|
||||
function _assertThisInitialized(e) {
|
||||
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
return e;
|
||||
}
|
||||
module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,24 +0,0 @@
|
||||
var OverloadYield = require("./OverloadYield.js");
|
||||
function _asyncGeneratorDelegate(t) {
|
||||
var e = {},
|
||||
n = !1;
|
||||
function pump(e, r) {
|
||||
return n = !0, r = new Promise(function (n) {
|
||||
n(t[e](r));
|
||||
}), {
|
||||
done: !1,
|
||||
value: new OverloadYield(r, 1)
|
||||
};
|
||||
}
|
||||
return e["undefined" != typeof Symbol && Symbol.iterator || "@@iterator"] = function () {
|
||||
return this;
|
||||
}, e.next = function (t) {
|
||||
return n ? (n = !1, t) : pump("next", t);
|
||||
}, "function" == typeof t["throw"] && (e["throw"] = function (t) {
|
||||
if (n) throw n = !1, t;
|
||||
return pump("throw", t);
|
||||
}), "function" == typeof t["return"] && (e["return"] = function (t) {
|
||||
return n ? (n = !1, t) : pump("return", t);
|
||||
}), e;
|
||||
}
|
||||
module.exports = _asyncGeneratorDelegate, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,45 +0,0 @@
|
||||
function _asyncIterator(r) {
|
||||
var n,
|
||||
t,
|
||||
o,
|
||||
e = 2;
|
||||
for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) {
|
||||
if (t && null != (n = r[t])) return n.call(r);
|
||||
if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r));
|
||||
t = "@@asyncIterator", o = "@@iterator";
|
||||
}
|
||||
throw new TypeError("Object is not async iterable");
|
||||
}
|
||||
function AsyncFromSyncIterator(r) {
|
||||
function AsyncFromSyncIteratorContinuation(r) {
|
||||
if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object."));
|
||||
var n = r.done;
|
||||
return Promise.resolve(r.value).then(function (r) {
|
||||
return {
|
||||
value: r,
|
||||
done: n
|
||||
};
|
||||
});
|
||||
}
|
||||
return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) {
|
||||
this.s = r, this.n = r.next;
|
||||
}, AsyncFromSyncIterator.prototype = {
|
||||
s: null,
|
||||
n: null,
|
||||
next: function next() {
|
||||
return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
|
||||
},
|
||||
"return": function _return(r) {
|
||||
var n = this.s["return"];
|
||||
return void 0 === n ? Promise.resolve({
|
||||
value: r,
|
||||
done: !0
|
||||
}) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
|
||||
},
|
||||
"throw": function _throw(r) {
|
||||
var n = this.s["return"];
|
||||
return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
|
||||
}
|
||||
}, new AsyncFromSyncIterator(r);
|
||||
}
|
||||
module.exports = _asyncIterator, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,26 +0,0 @@
|
||||
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
||||
try {
|
||||
var i = n[a](c),
|
||||
u = i.value;
|
||||
} catch (n) {
|
||||
return void e(n);
|
||||
}
|
||||
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
||||
}
|
||||
function _asyncToGenerator(n) {
|
||||
return function () {
|
||||
var t = this,
|
||||
e = arguments;
|
||||
return new Promise(function (r, o) {
|
||||
var a = n.apply(t, e);
|
||||
function _next(n) {
|
||||
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
||||
}
|
||||
function _throw(n) {
|
||||
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
||||
}
|
||||
_next(void 0);
|
||||
});
|
||||
};
|
||||
}
|
||||
module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,5 +0,0 @@
|
||||
var OverloadYield = require("./OverloadYield.js");
|
||||
function _awaitAsyncGenerator(e) {
|
||||
return new OverloadYield(e, 0);
|
||||
}
|
||||
module.exports = _awaitAsyncGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,7 +0,0 @@
|
||||
var getPrototypeOf = require("./getPrototypeOf.js");
|
||||
var isNativeReflectConstruct = require("./isNativeReflectConstruct.js");
|
||||
var possibleConstructorReturn = require("./possibleConstructorReturn.js");
|
||||
function _callSuper(t, o, e) {
|
||||
return o = getPrototypeOf(o), possibleConstructorReturn(t, isNativeReflectConstruct() ? Reflect.construct(o, e || [], getPrototypeOf(t).constructor) : o.apply(t, e));
|
||||
}
|
||||
module.exports = _callSuper, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,6 +0,0 @@
|
||||
var _typeof = require("./typeof.js")["default"];
|
||||
function _checkInRHS(e) {
|
||||
if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? _typeof(e) : "null"));
|
||||
return e;
|
||||
}
|
||||
module.exports = _checkInRHS, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,4 +0,0 @@
|
||||
function _checkPrivateRedeclaration(e, t) {
|
||||
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
||||
}
|
||||
module.exports = _checkPrivateRedeclaration, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,10 +0,0 @@
|
||||
function _classApplyDescriptorDestructureSet(e, t) {
|
||||
if (t.set) return "__destrObj" in t || (t.__destrObj = {
|
||||
set value(r) {
|
||||
t.set.call(e, r);
|
||||
}
|
||||
}), t.__destrObj;
|
||||
if (!t.writable) throw new TypeError("attempted to set read only private field");
|
||||
return t;
|
||||
}
|
||||
module.exports = _classApplyDescriptorDestructureSet, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,4 +0,0 @@
|
||||
function _classApplyDescriptorGet(e, t) {
|
||||
return t.get ? t.get.call(e) : t.value;
|
||||
}
|
||||
module.exports = _classApplyDescriptorGet, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,7 +0,0 @@
|
||||
function _classApplyDescriptorSet(e, t, l) {
|
||||
if (t.set) t.set.call(e, l);else {
|
||||
if (!t.writable) throw new TypeError("attempted to set read only private field");
|
||||
t.value = l;
|
||||
}
|
||||
}
|
||||
module.exports = _classApplyDescriptorSet, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,4 +0,0 @@
|
||||
function _classCallCheck(a, n) {
|
||||
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
||||
}
|
||||
module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,5 +0,0 @@
|
||||
var assertClassBrand = require("./assertClassBrand.js");
|
||||
function _classCheckPrivateStaticAccess(s, a, r) {
|
||||
return assertClassBrand(a, s, r);
|
||||
}
|
||||
module.exports = _classCheckPrivateStaticAccess, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,4 +0,0 @@
|
||||
function _classCheckPrivateStaticFieldDescriptor(t, e) {
|
||||
if (void 0 === t) throw new TypeError("attempted to " + e + " private static field before its declaration");
|
||||
}
|
||||
module.exports = _classCheckPrivateStaticFieldDescriptor, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,5 +0,0 @@
|
||||
var classPrivateFieldGet2 = require("./classPrivateFieldGet2.js");
|
||||
function _classExtractFieldDescriptor(e, t) {
|
||||
return classPrivateFieldGet2(t, e);
|
||||
}
|
||||
module.exports = _classExtractFieldDescriptor, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,4 +0,0 @@
|
||||
function _classNameTDZError(e) {
|
||||
throw new ReferenceError('Class "' + e + '" cannot be referenced in computed property keys.');
|
||||
}
|
||||
module.exports = _classNameTDZError, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,7 +0,0 @@
|
||||
var classApplyDescriptorDestructureSet = require("./classApplyDescriptorDestructureSet.js");
|
||||
var classPrivateFieldGet2 = require("./classPrivateFieldGet2.js");
|
||||
function _classPrivateFieldDestructureSet(e, t) {
|
||||
var r = classPrivateFieldGet2(t, e);
|
||||
return classApplyDescriptorDestructureSet(e, r);
|
||||
}
|
||||
module.exports = _classPrivateFieldDestructureSet, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,7 +0,0 @@
|
||||
var classApplyDescriptorGet = require("./classApplyDescriptorGet.js");
|
||||
var classPrivateFieldGet2 = require("./classPrivateFieldGet2.js");
|
||||
function _classPrivateFieldGet(e, t) {
|
||||
var r = classPrivateFieldGet2(t, e);
|
||||
return classApplyDescriptorGet(e, r);
|
||||
}
|
||||
module.exports = _classPrivateFieldGet, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,5 +0,0 @@
|
||||
var assertClassBrand = require("./assertClassBrand.js");
|
||||
function _classPrivateFieldGet2(s, a) {
|
||||
return s.get(assertClassBrand(s, a));
|
||||
}
|
||||
module.exports = _classPrivateFieldGet2, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,5 +0,0 @@
|
||||
var checkPrivateRedeclaration = require("./checkPrivateRedeclaration.js");
|
||||
function _classPrivateFieldInitSpec(e, t, a) {
|
||||
checkPrivateRedeclaration(e, t), t.set(e, a);
|
||||
}
|
||||
module.exports = _classPrivateFieldInitSpec, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,5 +0,0 @@
|
||||
function _classPrivateFieldBase(e, t) {
|
||||
if (!{}.hasOwnProperty.call(e, t)) throw new TypeError("attempted to use private field on non-instance");
|
||||
return e;
|
||||
}
|
||||
module.exports = _classPrivateFieldBase, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,5 +0,0 @@
|
||||
var id = 0;
|
||||
function _classPrivateFieldKey(e) {
|
||||
return "__private_" + id++ + "_" + e;
|
||||
}
|
||||
module.exports = _classPrivateFieldKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,7 +0,0 @@
|
||||
var classApplyDescriptorSet = require("./classApplyDescriptorSet.js");
|
||||
var classPrivateFieldGet2 = require("./classPrivateFieldGet2.js");
|
||||
function _classPrivateFieldSet(e, t, r) {
|
||||
var s = classPrivateFieldGet2(t, e);
|
||||
return classApplyDescriptorSet(e, s, r), r;
|
||||
}
|
||||
module.exports = _classPrivateFieldSet, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,5 +0,0 @@
|
||||
var assertClassBrand = require("./assertClassBrand.js");
|
||||
function _classPrivateFieldSet2(s, a, r) {
|
||||
return s.set(assertClassBrand(s, a), r), r;
|
||||
}
|
||||
module.exports = _classPrivateFieldSet2, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,5 +0,0 @@
|
||||
var assertClassBrand = require("./assertClassBrand.js");
|
||||
function _classPrivateGetter(s, r, a) {
|
||||
return a(assertClassBrand(s, r));
|
||||
}
|
||||
module.exports = _classPrivateGetter, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,5 +0,0 @@
|
||||
var assertClassBrand = require("./assertClassBrand.js");
|
||||
function _classPrivateMethodGet(s, a, r) {
|
||||
return assertClassBrand(a, s), r;
|
||||
}
|
||||
module.exports = _classPrivateMethodGet, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,5 +0,0 @@
|
||||
var checkPrivateRedeclaration = require("./checkPrivateRedeclaration.js");
|
||||
function _classPrivateMethodInitSpec(e, a) {
|
||||
checkPrivateRedeclaration(e, a), a.add(e);
|
||||
}
|
||||
module.exports = _classPrivateMethodInitSpec, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,4 +0,0 @@
|
||||
function _classPrivateMethodSet() {
|
||||
throw new TypeError("attempted to reassign private method");
|
||||
}
|
||||
module.exports = _classPrivateMethodSet, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,5 +0,0 @@
|
||||
var assertClassBrand = require("./assertClassBrand.js");
|
||||
function _classPrivateSetter(s, r, a, t) {
|
||||
return r(assertClassBrand(s, a), t), t;
|
||||
}
|
||||
module.exports = _classPrivateSetter, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,7 +0,0 @@
|
||||
var classApplyDescriptorDestructureSet = require("./classApplyDescriptorDestructureSet.js");
|
||||
var assertClassBrand = require("./assertClassBrand.js");
|
||||
var classCheckPrivateStaticFieldDescriptor = require("./classCheckPrivateStaticFieldDescriptor.js");
|
||||
function _classStaticPrivateFieldDestructureSet(t, r, s) {
|
||||
return assertClassBrand(r, t), classCheckPrivateStaticFieldDescriptor(s, "set"), classApplyDescriptorDestructureSet(t, s);
|
||||
}
|
||||
module.exports = _classStaticPrivateFieldDestructureSet, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,7 +0,0 @@
|
||||
var classApplyDescriptorGet = require("./classApplyDescriptorGet.js");
|
||||
var assertClassBrand = require("./assertClassBrand.js");
|
||||
var classCheckPrivateStaticFieldDescriptor = require("./classCheckPrivateStaticFieldDescriptor.js");
|
||||
function _classStaticPrivateFieldSpecGet(t, s, r) {
|
||||
return assertClassBrand(s, t), classCheckPrivateStaticFieldDescriptor(r, "get"), classApplyDescriptorGet(t, r);
|
||||
}
|
||||
module.exports = _classStaticPrivateFieldSpecGet, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,7 +0,0 @@
|
||||
var classApplyDescriptorSet = require("./classApplyDescriptorSet.js");
|
||||
var assertClassBrand = require("./assertClassBrand.js");
|
||||
var classCheckPrivateStaticFieldDescriptor = require("./classCheckPrivateStaticFieldDescriptor.js");
|
||||
function _classStaticPrivateFieldSpecSet(s, t, r, e) {
|
||||
return assertClassBrand(t, s), classCheckPrivateStaticFieldDescriptor(r, "set"), classApplyDescriptorSet(s, r, e), e;
|
||||
}
|
||||
module.exports = _classStaticPrivateFieldSpecSet, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,5 +0,0 @@
|
||||
var assertClassBrand = require("./assertClassBrand.js");
|
||||
function _classStaticPrivateMethodGet(s, a, t) {
|
||||
return assertClassBrand(a, s), t;
|
||||
}
|
||||
module.exports = _classStaticPrivateMethodGet, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,4 +0,0 @@
|
||||
function _classStaticPrivateMethodSet() {
|
||||
throw new TypeError("attempted to set read only static private field");
|
||||
}
|
||||
module.exports = _classStaticPrivateMethodSet, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,10 +0,0 @@
|
||||
var isNativeReflectConstruct = require("./isNativeReflectConstruct.js");
|
||||
var setPrototypeOf = require("./setPrototypeOf.js");
|
||||
function _construct(t, e, r) {
|
||||
if (isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
||||
var o = [null];
|
||||
o.push.apply(o, e);
|
||||
var p = new (t.bind.apply(t, o))();
|
||||
return r && setPrototypeOf(p, r.prototype), p;
|
||||
}
|
||||
module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,13 +0,0 @@
|
||||
var toPropertyKey = require("./toPropertyKey.js");
|
||||
function _defineProperties(e, r) {
|
||||
for (var t = 0; t < r.length; t++) {
|
||||
var o = r[t];
|
||||
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
|
||||
}
|
||||
}
|
||||
function _createClass(e, r, t) {
|
||||
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
||||
writable: !1
|
||||
}), e;
|
||||
}
|
||||
module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,50 +0,0 @@
|
||||
var unsupportedIterableToArray = require("./unsupportedIterableToArray.js");
|
||||
function _createForOfIteratorHelper(r, e) {
|
||||
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
||||
if (!t) {
|
||||
if (Array.isArray(r) || (t = unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
||||
t && (r = t);
|
||||
var _n = 0,
|
||||
F = function F() {};
|
||||
return {
|
||||
s: F,
|
||||
n: function n() {
|
||||
return _n >= r.length ? {
|
||||
done: !0
|
||||
} : {
|
||||
done: !1,
|
||||
value: r[_n++]
|
||||
};
|
||||
},
|
||||
e: function e(r) {
|
||||
throw r;
|
||||
},
|
||||
f: F
|
||||
};
|
||||
}
|
||||
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
||||
}
|
||||
var o,
|
||||
a = !0,
|
||||
u = !1;
|
||||
return {
|
||||
s: function s() {
|
||||
t = t.call(r);
|
||||
},
|
||||
n: function n() {
|
||||
var r = t.next();
|
||||
return a = r.done, r;
|
||||
},
|
||||
e: function e(r) {
|
||||
u = !0, o = r;
|
||||
},
|
||||
f: function f() {
|
||||
try {
|
||||
a || null == t["return"] || t["return"]();
|
||||
} finally {
|
||||
if (u) throw o;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
module.exports = _createForOfIteratorHelper, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,19 +0,0 @@
|
||||
var unsupportedIterableToArray = require("./unsupportedIterableToArray.js");
|
||||
function _createForOfIteratorHelperLoose(r, e) {
|
||||
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
||||
if (t) return (t = t.call(r)).next.bind(t);
|
||||
if (Array.isArray(r) || (t = unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
||||
t && (r = t);
|
||||
var o = 0;
|
||||
return function () {
|
||||
return o >= r.length ? {
|
||||
done: !0
|
||||
} : {
|
||||
done: !1,
|
||||
value: r[o++]
|
||||
};
|
||||
};
|
||||
}
|
||||
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
||||
}
|
||||
module.exports = _createForOfIteratorHelperLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,16 +0,0 @@
|
||||
var getPrototypeOf = require("./getPrototypeOf.js");
|
||||
var isNativeReflectConstruct = require("./isNativeReflectConstruct.js");
|
||||
var possibleConstructorReturn = require("./possibleConstructorReturn.js");
|
||||
function _createSuper(t) {
|
||||
var r = isNativeReflectConstruct();
|
||||
return function () {
|
||||
var e,
|
||||
o = getPrototypeOf(t);
|
||||
if (r) {
|
||||
var s = getPrototypeOf(this).constructor;
|
||||
e = Reflect.construct(o, arguments, s);
|
||||
} else e = o.apply(this, arguments);
|
||||
return possibleConstructorReturn(this, e);
|
||||
};
|
||||
}
|
||||
module.exports = _createSuper, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,250 +0,0 @@
|
||||
var toArray = require("./toArray.js");
|
||||
var toPropertyKey = require("./toPropertyKey.js");
|
||||
function _decorate(e, r, t, i) {
|
||||
var o = _getDecoratorsApi();
|
||||
if (i) for (var n = 0; n < i.length; n++) o = i[n](o);
|
||||
var s = r(function (e) {
|
||||
o.initializeInstanceElements(e, a.elements);
|
||||
}, t),
|
||||
a = o.decorateClass(_coalesceClassElements(s.d.map(_createElementDescriptor)), e);
|
||||
return o.initializeClassElements(s.F, a.elements), o.runClassFinishers(s.F, a.finishers);
|
||||
}
|
||||
function _getDecoratorsApi() {
|
||||
_getDecoratorsApi = function _getDecoratorsApi() {
|
||||
return e;
|
||||
};
|
||||
var e = {
|
||||
elementsDefinitionOrder: [["method"], ["field"]],
|
||||
initializeInstanceElements: function initializeInstanceElements(e, r) {
|
||||
["method", "field"].forEach(function (t) {
|
||||
r.forEach(function (r) {
|
||||
r.kind === t && "own" === r.placement && this.defineClassElement(e, r);
|
||||
}, this);
|
||||
}, this);
|
||||
},
|
||||
initializeClassElements: function initializeClassElements(e, r) {
|
||||
var t = e.prototype;
|
||||
["method", "field"].forEach(function (i) {
|
||||
r.forEach(function (r) {
|
||||
var o = r.placement;
|
||||
if (r.kind === i && ("static" === o || "prototype" === o)) {
|
||||
var n = "static" === o ? e : t;
|
||||
this.defineClassElement(n, r);
|
||||
}
|
||||
}, this);
|
||||
}, this);
|
||||
},
|
||||
defineClassElement: function defineClassElement(e, r) {
|
||||
var t = r.descriptor;
|
||||
if ("field" === r.kind) {
|
||||
var i = r.initializer;
|
||||
t = {
|
||||
enumerable: t.enumerable,
|
||||
writable: t.writable,
|
||||
configurable: t.configurable,
|
||||
value: void 0 === i ? void 0 : i.call(e)
|
||||
};
|
||||
}
|
||||
Object.defineProperty(e, r.key, t);
|
||||
},
|
||||
decorateClass: function decorateClass(e, r) {
|
||||
var t = [],
|
||||
i = [],
|
||||
o = {
|
||||
"static": [],
|
||||
prototype: [],
|
||||
own: []
|
||||
};
|
||||
if (e.forEach(function (e) {
|
||||
this.addElementPlacement(e, o);
|
||||
}, this), e.forEach(function (e) {
|
||||
if (!_hasDecorators(e)) return t.push(e);
|
||||
var r = this.decorateElement(e, o);
|
||||
t.push(r.element), t.push.apply(t, r.extras), i.push.apply(i, r.finishers);
|
||||
}, this), !r) return {
|
||||
elements: t,
|
||||
finishers: i
|
||||
};
|
||||
var n = this.decorateConstructor(t, r);
|
||||
return i.push.apply(i, n.finishers), n.finishers = i, n;
|
||||
},
|
||||
addElementPlacement: function addElementPlacement(e, r, t) {
|
||||
var i = r[e.placement];
|
||||
if (!t && -1 !== i.indexOf(e.key)) throw new TypeError("Duplicated element (" + e.key + ")");
|
||||
i.push(e.key);
|
||||
},
|
||||
decorateElement: function decorateElement(e, r) {
|
||||
for (var t = [], i = [], o = e.decorators, n = o.length - 1; n >= 0; n--) {
|
||||
var s = r[e.placement];
|
||||
s.splice(s.indexOf(e.key), 1);
|
||||
var a = this.fromElementDescriptor(e),
|
||||
l = this.toElementFinisherExtras((0, o[n])(a) || a);
|
||||
e = l.element, this.addElementPlacement(e, r), l.finisher && i.push(l.finisher);
|
||||
var c = l.extras;
|
||||
if (c) {
|
||||
for (var p = 0; p < c.length; p++) this.addElementPlacement(c[p], r);
|
||||
t.push.apply(t, c);
|
||||
}
|
||||
}
|
||||
return {
|
||||
element: e,
|
||||
finishers: i,
|
||||
extras: t
|
||||
};
|
||||
},
|
||||
decorateConstructor: function decorateConstructor(e, r) {
|
||||
for (var t = [], i = r.length - 1; i >= 0; i--) {
|
||||
var o = this.fromClassDescriptor(e),
|
||||
n = this.toClassDescriptor((0, r[i])(o) || o);
|
||||
if (void 0 !== n.finisher && t.push(n.finisher), void 0 !== n.elements) {
|
||||
e = n.elements;
|
||||
for (var s = 0; s < e.length - 1; s++) for (var a = s + 1; a < e.length; a++) if (e[s].key === e[a].key && e[s].placement === e[a].placement) throw new TypeError("Duplicated element (" + e[s].key + ")");
|
||||
}
|
||||
}
|
||||
return {
|
||||
elements: e,
|
||||
finishers: t
|
||||
};
|
||||
},
|
||||
fromElementDescriptor: function fromElementDescriptor(e) {
|
||||
var r = {
|
||||
kind: e.kind,
|
||||
key: e.key,
|
||||
placement: e.placement,
|
||||
descriptor: e.descriptor
|
||||
};
|
||||
return Object.defineProperty(r, Symbol.toStringTag, {
|
||||
value: "Descriptor",
|
||||
configurable: !0
|
||||
}), "field" === e.kind && (r.initializer = e.initializer), r;
|
||||
},
|
||||
toElementDescriptors: function toElementDescriptors(e) {
|
||||
if (void 0 !== e) return toArray(e).map(function (e) {
|
||||
var r = this.toElementDescriptor(e);
|
||||
return this.disallowProperty(e, "finisher", "An element descriptor"), this.disallowProperty(e, "extras", "An element descriptor"), r;
|
||||
}, this);
|
||||
},
|
||||
toElementDescriptor: function toElementDescriptor(e) {
|
||||
var r = e.kind + "";
|
||||
if ("method" !== r && "field" !== r) throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "' + r + '"');
|
||||
var t = toPropertyKey(e.key),
|
||||
i = e.placement + "";
|
||||
if ("static" !== i && "prototype" !== i && "own" !== i) throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "' + i + '"');
|
||||
var o = e.descriptor;
|
||||
this.disallowProperty(e, "elements", "An element descriptor");
|
||||
var n = {
|
||||
kind: r,
|
||||
key: t,
|
||||
placement: i,
|
||||
descriptor: Object.assign({}, o)
|
||||
};
|
||||
return "field" !== r ? this.disallowProperty(e, "initializer", "A method descriptor") : (this.disallowProperty(o, "get", "The property descriptor of a field descriptor"), this.disallowProperty(o, "set", "The property descriptor of a field descriptor"), this.disallowProperty(o, "value", "The property descriptor of a field descriptor"), n.initializer = e.initializer), n;
|
||||
},
|
||||
toElementFinisherExtras: function toElementFinisherExtras(e) {
|
||||
return {
|
||||
element: this.toElementDescriptor(e),
|
||||
finisher: _optionalCallableProperty(e, "finisher"),
|
||||
extras: this.toElementDescriptors(e.extras)
|
||||
};
|
||||
},
|
||||
fromClassDescriptor: function fromClassDescriptor(e) {
|
||||
var r = {
|
||||
kind: "class",
|
||||
elements: e.map(this.fromElementDescriptor, this)
|
||||
};
|
||||
return Object.defineProperty(r, Symbol.toStringTag, {
|
||||
value: "Descriptor",
|
||||
configurable: !0
|
||||
}), r;
|
||||
},
|
||||
toClassDescriptor: function toClassDescriptor(e) {
|
||||
var r = e.kind + "";
|
||||
if ("class" !== r) throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "' + r + '"');
|
||||
this.disallowProperty(e, "key", "A class descriptor"), this.disallowProperty(e, "placement", "A class descriptor"), this.disallowProperty(e, "descriptor", "A class descriptor"), this.disallowProperty(e, "initializer", "A class descriptor"), this.disallowProperty(e, "extras", "A class descriptor");
|
||||
var t = _optionalCallableProperty(e, "finisher");
|
||||
return {
|
||||
elements: this.toElementDescriptors(e.elements),
|
||||
finisher: t
|
||||
};
|
||||
},
|
||||
runClassFinishers: function runClassFinishers(e, r) {
|
||||
for (var t = 0; t < r.length; t++) {
|
||||
var i = (0, r[t])(e);
|
||||
if (void 0 !== i) {
|
||||
if ("function" != typeof i) throw new TypeError("Finishers must return a constructor.");
|
||||
e = i;
|
||||
}
|
||||
}
|
||||
return e;
|
||||
},
|
||||
disallowProperty: function disallowProperty(e, r, t) {
|
||||
if (void 0 !== e[r]) throw new TypeError(t + " can't have a ." + r + " property.");
|
||||
}
|
||||
};
|
||||
return e;
|
||||
}
|
||||
function _createElementDescriptor(e) {
|
||||
var r,
|
||||
t = toPropertyKey(e.key);
|
||||
"method" === e.kind ? r = {
|
||||
value: e.value,
|
||||
writable: !0,
|
||||
configurable: !0,
|
||||
enumerable: !1
|
||||
} : "get" === e.kind ? r = {
|
||||
get: e.value,
|
||||
configurable: !0,
|
||||
enumerable: !1
|
||||
} : "set" === e.kind ? r = {
|
||||
set: e.value,
|
||||
configurable: !0,
|
||||
enumerable: !1
|
||||
} : "field" === e.kind && (r = {
|
||||
configurable: !0,
|
||||
writable: !0,
|
||||
enumerable: !0
|
||||
});
|
||||
var i = {
|
||||
kind: "field" === e.kind ? "field" : "method",
|
||||
key: t,
|
||||
placement: e["static"] ? "static" : "field" === e.kind ? "own" : "prototype",
|
||||
descriptor: r
|
||||
};
|
||||
return e.decorators && (i.decorators = e.decorators), "field" === e.kind && (i.initializer = e.value), i;
|
||||
}
|
||||
function _coalesceGetterSetter(e, r) {
|
||||
void 0 !== e.descriptor.get ? r.descriptor.get = e.descriptor.get : r.descriptor.set = e.descriptor.set;
|
||||
}
|
||||
function _coalesceClassElements(e) {
|
||||
for (var r = [], isSameElement = function isSameElement(e) {
|
||||
return "method" === e.kind && e.key === o.key && e.placement === o.placement;
|
||||
}, t = 0; t < e.length; t++) {
|
||||
var i,
|
||||
o = e[t];
|
||||
if ("method" === o.kind && (i = r.find(isSameElement))) {
|
||||
if (_isDataDescriptor(o.descriptor) || _isDataDescriptor(i.descriptor)) {
|
||||
if (_hasDecorators(o) || _hasDecorators(i)) throw new ReferenceError("Duplicated methods (" + o.key + ") can't be decorated.");
|
||||
i.descriptor = o.descriptor;
|
||||
} else {
|
||||
if (_hasDecorators(o)) {
|
||||
if (_hasDecorators(i)) throw new ReferenceError("Decorators can't be placed on different accessors with for the same property (" + o.key + ").");
|
||||
i.decorators = o.decorators;
|
||||
}
|
||||
_coalesceGetterSetter(o, i);
|
||||
}
|
||||
} else r.push(o);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
function _hasDecorators(e) {
|
||||
return e.decorators && e.decorators.length;
|
||||
}
|
||||
function _isDataDescriptor(e) {
|
||||
return void 0 !== e && !(void 0 === e.value && void 0 === e.writable);
|
||||
}
|
||||
function _optionalCallableProperty(e, r) {
|
||||
var t = e[r];
|
||||
if (void 0 !== t && "function" != typeof t) throw new TypeError("Expected '" + r + "' to be a function");
|
||||
return t;
|
||||
}
|
||||
module.exports = _decorate, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,9 +0,0 @@
|
||||
function _defaults(e, r) {
|
||||
for (var t = Object.getOwnPropertyNames(r), o = 0; o < t.length; o++) {
|
||||
var n = t[o],
|
||||
a = Object.getOwnPropertyDescriptor(r, n);
|
||||
a && a.configurable && void 0 === e[n] && Object.defineProperty(e, n, a);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
module.exports = _defaults, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,8 +0,0 @@
|
||||
function _defineAccessor(e, r, n, t) {
|
||||
var c = {
|
||||
configurable: !0,
|
||||
enumerable: !0
|
||||
};
|
||||
return c[e] = t, Object.defineProperty(r, n, c);
|
||||
}
|
||||
module.exports = _defineAccessor, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,12 +0,0 @@
|
||||
function _defineEnumerableProperties(e, r) {
|
||||
for (var t in r) {
|
||||
var n = r[t];
|
||||
n.configurable = n.enumerable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, t, n);
|
||||
}
|
||||
if (Object.getOwnPropertySymbols) for (var a = Object.getOwnPropertySymbols(r), b = 0; b < a.length; b++) {
|
||||
var i = a[b];
|
||||
(n = r[i]).configurable = n.enumerable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, i, n);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
module.exports = _defineEnumerableProperties, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,10 +0,0 @@
|
||||
var toPropertyKey = require("./toPropertyKey.js");
|
||||
function _defineProperty(e, r, t) {
|
||||
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
||||
value: t,
|
||||
enumerable: !0,
|
||||
configurable: !0,
|
||||
writable: !0
|
||||
}) : e[r] = t, e;
|
||||
}
|
||||
module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,28 +0,0 @@
|
||||
function dispose_SuppressedError(r, e) {
|
||||
return "undefined" != typeof SuppressedError ? dispose_SuppressedError = SuppressedError : (dispose_SuppressedError = function dispose_SuppressedError(r, e) {
|
||||
this.suppressed = e, this.error = r, this.stack = Error().stack;
|
||||
}, dispose_SuppressedError.prototype = Object.create(Error.prototype, {
|
||||
constructor: {
|
||||
value: dispose_SuppressedError,
|
||||
writable: !0,
|
||||
configurable: !0
|
||||
}
|
||||
})), new dispose_SuppressedError(r, e);
|
||||
}
|
||||
function _dispose(r, e, s) {
|
||||
function next() {
|
||||
for (; r.length > 0;) try {
|
||||
var o = r.pop(),
|
||||
p = o.d.call(o.v);
|
||||
if (o.a) return Promise.resolve(p).then(next, err);
|
||||
} catch (r) {
|
||||
return err(r);
|
||||
}
|
||||
if (s) throw e;
|
||||
}
|
||||
function err(r) {
|
||||
return e = s ? new dispose_SuppressedError(e, r) : r, s = !0, next();
|
||||
}
|
||||
return next();
|
||||
}
|
||||
module.exports = _dispose, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -1,4 +0,0 @@
|
||||
function _AwaitValue(t) {
|
||||
this.wrapped = t;
|
||||
}
|
||||
export { _AwaitValue as default };
|
||||
@@ -1,4 +0,0 @@
|
||||
function _OverloadYield(e, d) {
|
||||
this.v = e, this.k = d;
|
||||
}
|
||||
export { _OverloadYield as default };
|
||||
@@ -1,9 +0,0 @@
|
||||
function _applyDecoratedDescriptor(i, e, r, n, l) {
|
||||
var a = {};
|
||||
return Object.keys(n).forEach(function (i) {
|
||||
a[i] = n[i];
|
||||
}), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, ("value" in a || a.initializer) && (a.writable = !0), a = r.slice().reverse().reduce(function (r, n) {
|
||||
return n(i, e, r) || r;
|
||||
}, a), l && void 0 !== a.initializer && (a.value = a.initializer ? a.initializer.call(l) : void 0, a.initializer = void 0), void 0 === a.initializer ? (Object.defineProperty(i, e, a), null) : a;
|
||||
}
|
||||
export { _applyDecoratedDescriptor as default };
|
||||
@@ -1,236 +0,0 @@
|
||||
import _typeof from "./typeof.js";
|
||||
import setFunctionName from "./setFunctionName.js";
|
||||
import toPropertyKey from "./toPropertyKey.js";
|
||||
function old_createMetadataMethodsForProperty(e, t, a, r) {
|
||||
return {
|
||||
getMetadata: function getMetadata(o) {
|
||||
old_assertNotFinished(r, "getMetadata"), old_assertMetadataKey(o);
|
||||
var i = e[o];
|
||||
if (void 0 !== i) if (1 === t) {
|
||||
var n = i["public"];
|
||||
if (void 0 !== n) return n[a];
|
||||
} else if (2 === t) {
|
||||
var l = i["private"];
|
||||
if (void 0 !== l) return l.get(a);
|
||||
} else if (Object.hasOwnProperty.call(i, "constructor")) return i.constructor;
|
||||
},
|
||||
setMetadata: function setMetadata(o, i) {
|
||||
old_assertNotFinished(r, "setMetadata"), old_assertMetadataKey(o);
|
||||
var n = e[o];
|
||||
if (void 0 === n && (n = e[o] = {}), 1 === t) {
|
||||
var l = n["public"];
|
||||
void 0 === l && (l = n["public"] = {}), l[a] = i;
|
||||
} else if (2 === t) {
|
||||
var s = n.priv;
|
||||
void 0 === s && (s = n["private"] = new Map()), s.set(a, i);
|
||||
} else n.constructor = i;
|
||||
}
|
||||
};
|
||||
}
|
||||
function old_convertMetadataMapToFinal(e, t) {
|
||||
var a = e[Symbol.metadata || Symbol["for"]("Symbol.metadata")],
|
||||
r = Object.getOwnPropertySymbols(t);
|
||||
if (0 !== r.length) {
|
||||
for (var o = 0; o < r.length; o++) {
|
||||
var i = r[o],
|
||||
n = t[i],
|
||||
l = a ? a[i] : null,
|
||||
s = n["public"],
|
||||
c = l ? l["public"] : null;
|
||||
s && c && Object.setPrototypeOf(s, c);
|
||||
var d = n["private"];
|
||||
if (d) {
|
||||
var u = Array.from(d.values()),
|
||||
f = l ? l["private"] : null;
|
||||
f && (u = u.concat(f)), n["private"] = u;
|
||||
}
|
||||
l && Object.setPrototypeOf(n, l);
|
||||
}
|
||||
a && Object.setPrototypeOf(t, a), e[Symbol.metadata || Symbol["for"]("Symbol.metadata")] = t;
|
||||
}
|
||||
}
|
||||
function old_createAddInitializerMethod(e, t) {
|
||||
return function (a) {
|
||||
old_assertNotFinished(t, "addInitializer"), old_assertCallable(a, "An initializer"), e.push(a);
|
||||
};
|
||||
}
|
||||
function old_memberDec(e, t, a, r, o, i, n, l, s) {
|
||||
var c;
|
||||
switch (i) {
|
||||
case 1:
|
||||
c = "accessor";
|
||||
break;
|
||||
case 2:
|
||||
c = "method";
|
||||
break;
|
||||
case 3:
|
||||
c = "getter";
|
||||
break;
|
||||
case 4:
|
||||
c = "setter";
|
||||
break;
|
||||
default:
|
||||
c = "field";
|
||||
}
|
||||
var d,
|
||||
u,
|
||||
f = {
|
||||
kind: c,
|
||||
name: l ? "#" + t : toPropertyKey(t),
|
||||
isStatic: n,
|
||||
isPrivate: l
|
||||
},
|
||||
p = {
|
||||
v: !1
|
||||
};
|
||||
if (0 !== i && (f.addInitializer = old_createAddInitializerMethod(o, p)), l) {
|
||||
d = 2, u = Symbol(t);
|
||||
var v = {};
|
||||
0 === i ? (v.get = a.get, v.set = a.set) : 2 === i ? v.get = function () {
|
||||
return a.value;
|
||||
} : (1 !== i && 3 !== i || (v.get = function () {
|
||||
return a.get.call(this);
|
||||
}), 1 !== i && 4 !== i || (v.set = function (e) {
|
||||
a.set.call(this, e);
|
||||
})), f.access = v;
|
||||
} else d = 1, u = t;
|
||||
try {
|
||||
return e(s, Object.assign(f, old_createMetadataMethodsForProperty(r, d, u, p)));
|
||||
} finally {
|
||||
p.v = !0;
|
||||
}
|
||||
}
|
||||
function old_assertNotFinished(e, t) {
|
||||
if (e.v) throw Error("attempted to call " + t + " after decoration was finished");
|
||||
}
|
||||
function old_assertMetadataKey(e) {
|
||||
if ("symbol" != _typeof(e)) throw new TypeError("Metadata keys must be symbols, received: " + e);
|
||||
}
|
||||
function old_assertCallable(e, t) {
|
||||
if ("function" != typeof e) throw new TypeError(t + " must be a function");
|
||||
}
|
||||
function old_assertValidReturnValue(e, t) {
|
||||
var a = _typeof(t);
|
||||
if (1 === e) {
|
||||
if ("object" !== a || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
||||
void 0 !== t.get && old_assertCallable(t.get, "accessor.get"), void 0 !== t.set && old_assertCallable(t.set, "accessor.set"), void 0 !== t.init && old_assertCallable(t.init, "accessor.init"), void 0 !== t.initializer && old_assertCallable(t.initializer, "accessor.initializer");
|
||||
} else if ("function" !== a) throw new TypeError((0 === e ? "field" : 10 === e ? "class" : "method") + " decorators must return a function or void 0");
|
||||
}
|
||||
function old_getInit(e) {
|
||||
var t;
|
||||
return null == (t = e.init) && (t = e.initializer) && void 0 !== console && console.warn(".initializer has been renamed to .init as of March 2022"), t;
|
||||
}
|
||||
function old_applyMemberDec(e, t, a, r, o, i, n, l, s) {
|
||||
var c,
|
||||
d,
|
||||
u,
|
||||
f,
|
||||
p,
|
||||
v,
|
||||
y,
|
||||
h = a[0];
|
||||
if (n ? (0 === o || 1 === o ? (c = {
|
||||
get: a[3],
|
||||
set: a[4]
|
||||
}, u = "get") : 3 === o ? (c = {
|
||||
get: a[3]
|
||||
}, u = "get") : 4 === o ? (c = {
|
||||
set: a[3]
|
||||
}, u = "set") : c = {
|
||||
value: a[3]
|
||||
}, 0 !== o && (1 === o && setFunctionName(a[4], "#" + r, "set"), setFunctionName(a[3], "#" + r, u))) : 0 !== o && (c = Object.getOwnPropertyDescriptor(t, r)), 1 === o ? f = {
|
||||
get: c.get,
|
||||
set: c.set
|
||||
} : 2 === o ? f = c.value : 3 === o ? f = c.get : 4 === o && (f = c.set), "function" == typeof h) void 0 !== (p = old_memberDec(h, r, c, l, s, o, i, n, f)) && (old_assertValidReturnValue(o, p), 0 === o ? d = p : 1 === o ? (d = old_getInit(p), v = p.get || f.get, y = p.set || f.set, f = {
|
||||
get: v,
|
||||
set: y
|
||||
}) : f = p);else for (var m = h.length - 1; m >= 0; m--) {
|
||||
var b;
|
||||
void 0 !== (p = old_memberDec(h[m], r, c, l, s, o, i, n, f)) && (old_assertValidReturnValue(o, p), 0 === o ? b = p : 1 === o ? (b = old_getInit(p), v = p.get || f.get, y = p.set || f.set, f = {
|
||||
get: v,
|
||||
set: y
|
||||
}) : f = p, void 0 !== b && (void 0 === d ? d = b : "function" == typeof d ? d = [d, b] : d.push(b)));
|
||||
}
|
||||
if (0 === o || 1 === o) {
|
||||
if (void 0 === d) d = function d(e, t) {
|
||||
return t;
|
||||
};else if ("function" != typeof d) {
|
||||
var g = d;
|
||||
d = function d(e, t) {
|
||||
for (var a = t, r = 0; r < g.length; r++) a = g[r].call(e, a);
|
||||
return a;
|
||||
};
|
||||
} else {
|
||||
var _ = d;
|
||||
d = function d(e, t) {
|
||||
return _.call(e, t);
|
||||
};
|
||||
}
|
||||
e.push(d);
|
||||
}
|
||||
0 !== o && (1 === o ? (c.get = f.get, c.set = f.set) : 2 === o ? c.value = f : 3 === o ? c.get = f : 4 === o && (c.set = f), n ? 1 === o ? (e.push(function (e, t) {
|
||||
return f.get.call(e, t);
|
||||
}), e.push(function (e, t) {
|
||||
return f.set.call(e, t);
|
||||
})) : 2 === o ? e.push(f) : e.push(function (e, t) {
|
||||
return f.call(e, t);
|
||||
}) : Object.defineProperty(t, r, c));
|
||||
}
|
||||
function old_applyMemberDecs(e, t, a, r, o) {
|
||||
for (var i, n, l = new Map(), s = new Map(), c = 0; c < o.length; c++) {
|
||||
var d = o[c];
|
||||
if (Array.isArray(d)) {
|
||||
var u,
|
||||
f,
|
||||
p,
|
||||
v = d[1],
|
||||
y = d[2],
|
||||
h = d.length > 3,
|
||||
m = v >= 5;
|
||||
if (m ? (u = t, f = r, 0 != (v -= 5) && (p = n = n || [])) : (u = t.prototype, f = a, 0 !== v && (p = i = i || [])), 0 !== v && !h) {
|
||||
var b = m ? s : l,
|
||||
g = b.get(y) || 0;
|
||||
if (!0 === g || 3 === g && 4 !== v || 4 === g && 3 !== v) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + y);
|
||||
!g && v > 2 ? b.set(y, v) : b.set(y, !0);
|
||||
}
|
||||
old_applyMemberDec(e, u, d, y, v, m, h, f, p);
|
||||
}
|
||||
}
|
||||
old_pushInitializers(e, i), old_pushInitializers(e, n);
|
||||
}
|
||||
function old_pushInitializers(e, t) {
|
||||
t && e.push(function (e) {
|
||||
for (var a = 0; a < t.length; a++) t[a].call(e);
|
||||
return e;
|
||||
});
|
||||
}
|
||||
function old_applyClassDecs(e, t, a, r) {
|
||||
if (r.length > 0) {
|
||||
for (var o = [], i = t, n = t.name, l = r.length - 1; l >= 0; l--) {
|
||||
var s = {
|
||||
v: !1
|
||||
};
|
||||
try {
|
||||
var c = Object.assign({
|
||||
kind: "class",
|
||||
name: n,
|
||||
addInitializer: old_createAddInitializerMethod(o, s)
|
||||
}, old_createMetadataMethodsForProperty(a, 0, n, s)),
|
||||
d = r[l](i, c);
|
||||
} finally {
|
||||
s.v = !0;
|
||||
}
|
||||
void 0 !== d && (old_assertValidReturnValue(10, d), i = d);
|
||||
}
|
||||
e.push(i, function () {
|
||||
for (var e = 0; e < o.length; e++) o[e].call(i);
|
||||
});
|
||||
}
|
||||
}
|
||||
function applyDecs(e, t, a) {
|
||||
var r = [],
|
||||
o = {},
|
||||
i = {};
|
||||
return old_applyMemberDecs(r, e, i, o, t), old_convertMetadataMapToFinal(e.prototype, i), old_applyClassDecs(r, e, o, a), old_convertMetadataMapToFinal(e, o), r;
|
||||
}
|
||||
export { applyDecs as default };
|
||||
@@ -1,184 +0,0 @@
|
||||
import _typeof from "./typeof.js";
|
||||
function applyDecs2203Factory() {
|
||||
function createAddInitializerMethod(e, t) {
|
||||
return function (r) {
|
||||
!function (e, t) {
|
||||
if (e.v) throw Error("attempted to call addInitializer after decoration was finished");
|
||||
}(t), assertCallable(r, "An initializer"), e.push(r);
|
||||
};
|
||||
}
|
||||
function memberDec(e, t, r, a, n, i, s, o) {
|
||||
var c;
|
||||
switch (n) {
|
||||
case 1:
|
||||
c = "accessor";
|
||||
break;
|
||||
case 2:
|
||||
c = "method";
|
||||
break;
|
||||
case 3:
|
||||
c = "getter";
|
||||
break;
|
||||
case 4:
|
||||
c = "setter";
|
||||
break;
|
||||
default:
|
||||
c = "field";
|
||||
}
|
||||
var l,
|
||||
u,
|
||||
f = {
|
||||
kind: c,
|
||||
name: s ? "#" + t : t,
|
||||
"static": i,
|
||||
"private": s
|
||||
},
|
||||
p = {
|
||||
v: !1
|
||||
};
|
||||
0 !== n && (f.addInitializer = createAddInitializerMethod(a, p)), 0 === n ? s ? (l = r.get, u = r.set) : (l = function l() {
|
||||
return this[t];
|
||||
}, u = function u(e) {
|
||||
this[t] = e;
|
||||
}) : 2 === n ? l = function l() {
|
||||
return r.value;
|
||||
} : (1 !== n && 3 !== n || (l = function l() {
|
||||
return r.get.call(this);
|
||||
}), 1 !== n && 4 !== n || (u = function u(e) {
|
||||
r.set.call(this, e);
|
||||
})), f.access = l && u ? {
|
||||
get: l,
|
||||
set: u
|
||||
} : l ? {
|
||||
get: l
|
||||
} : {
|
||||
set: u
|
||||
};
|
||||
try {
|
||||
return e(o, f);
|
||||
} finally {
|
||||
p.v = !0;
|
||||
}
|
||||
}
|
||||
function assertCallable(e, t) {
|
||||
if ("function" != typeof e) throw new TypeError(t + " must be a function");
|
||||
}
|
||||
function assertValidReturnValue(e, t) {
|
||||
var r = _typeof(t);
|
||||
if (1 === e) {
|
||||
if ("object" !== r || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
||||
void 0 !== t.get && assertCallable(t.get, "accessor.get"), void 0 !== t.set && assertCallable(t.set, "accessor.set"), void 0 !== t.init && assertCallable(t.init, "accessor.init");
|
||||
} else if ("function" !== r) throw new TypeError((0 === e ? "field" : 10 === e ? "class" : "method") + " decorators must return a function or void 0");
|
||||
}
|
||||
function applyMemberDec(e, t, r, a, n, i, s, o) {
|
||||
var c,
|
||||
l,
|
||||
u,
|
||||
f,
|
||||
p,
|
||||
d,
|
||||
h = r[0];
|
||||
if (s ? c = 0 === n || 1 === n ? {
|
||||
get: r[3],
|
||||
set: r[4]
|
||||
} : 3 === n ? {
|
||||
get: r[3]
|
||||
} : 4 === n ? {
|
||||
set: r[3]
|
||||
} : {
|
||||
value: r[3]
|
||||
} : 0 !== n && (c = Object.getOwnPropertyDescriptor(t, a)), 1 === n ? u = {
|
||||
get: c.get,
|
||||
set: c.set
|
||||
} : 2 === n ? u = c.value : 3 === n ? u = c.get : 4 === n && (u = c.set), "function" == typeof h) void 0 !== (f = memberDec(h, a, c, o, n, i, s, u)) && (assertValidReturnValue(n, f), 0 === n ? l = f : 1 === n ? (l = f.init, p = f.get || u.get, d = f.set || u.set, u = {
|
||||
get: p,
|
||||
set: d
|
||||
}) : u = f);else for (var v = h.length - 1; v >= 0; v--) {
|
||||
var g;
|
||||
void 0 !== (f = memberDec(h[v], a, c, o, n, i, s, u)) && (assertValidReturnValue(n, f), 0 === n ? g = f : 1 === n ? (g = f.init, p = f.get || u.get, d = f.set || u.set, u = {
|
||||
get: p,
|
||||
set: d
|
||||
}) : u = f, void 0 !== g && (void 0 === l ? l = g : "function" == typeof l ? l = [l, g] : l.push(g)));
|
||||
}
|
||||
if (0 === n || 1 === n) {
|
||||
if (void 0 === l) l = function l(e, t) {
|
||||
return t;
|
||||
};else if ("function" != typeof l) {
|
||||
var y = l;
|
||||
l = function l(e, t) {
|
||||
for (var r = t, a = 0; a < y.length; a++) r = y[a].call(e, r);
|
||||
return r;
|
||||
};
|
||||
} else {
|
||||
var m = l;
|
||||
l = function l(e, t) {
|
||||
return m.call(e, t);
|
||||
};
|
||||
}
|
||||
e.push(l);
|
||||
}
|
||||
0 !== n && (1 === n ? (c.get = u.get, c.set = u.set) : 2 === n ? c.value = u : 3 === n ? c.get = u : 4 === n && (c.set = u), s ? 1 === n ? (e.push(function (e, t) {
|
||||
return u.get.call(e, t);
|
||||
}), e.push(function (e, t) {
|
||||
return u.set.call(e, t);
|
||||
})) : 2 === n ? e.push(u) : e.push(function (e, t) {
|
||||
return u.call(e, t);
|
||||
}) : Object.defineProperty(t, a, c));
|
||||
}
|
||||
function pushInitializers(e, t) {
|
||||
t && e.push(function (e) {
|
||||
for (var r = 0; r < t.length; r++) t[r].call(e);
|
||||
return e;
|
||||
});
|
||||
}
|
||||
return function (e, t, r) {
|
||||
var a = [];
|
||||
return function (e, t, r) {
|
||||
for (var a, n, i = new Map(), s = new Map(), o = 0; o < r.length; o++) {
|
||||
var c = r[o];
|
||||
if (Array.isArray(c)) {
|
||||
var l,
|
||||
u,
|
||||
f = c[1],
|
||||
p = c[2],
|
||||
d = c.length > 3,
|
||||
h = f >= 5;
|
||||
if (h ? (l = t, 0 != (f -= 5) && (u = n = n || [])) : (l = t.prototype, 0 !== f && (u = a = a || [])), 0 !== f && !d) {
|
||||
var v = h ? s : i,
|
||||
g = v.get(p) || 0;
|
||||
if (!0 === g || 3 === g && 4 !== f || 4 === g && 3 !== f) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + p);
|
||||
!g && f > 2 ? v.set(p, f) : v.set(p, !0);
|
||||
}
|
||||
applyMemberDec(e, l, c, p, f, h, d, u);
|
||||
}
|
||||
}
|
||||
pushInitializers(e, a), pushInitializers(e, n);
|
||||
}(a, e, t), function (e, t, r) {
|
||||
if (r.length > 0) {
|
||||
for (var a = [], n = t, i = t.name, s = r.length - 1; s >= 0; s--) {
|
||||
var o = {
|
||||
v: !1
|
||||
};
|
||||
try {
|
||||
var c = r[s](n, {
|
||||
kind: "class",
|
||||
name: i,
|
||||
addInitializer: createAddInitializerMethod(a, o)
|
||||
});
|
||||
} finally {
|
||||
o.v = !0;
|
||||
}
|
||||
void 0 !== c && (assertValidReturnValue(10, c), n = c);
|
||||
}
|
||||
e.push(n, function () {
|
||||
for (var e = 0; e < a.length; e++) a[e].call(n);
|
||||
});
|
||||
}
|
||||
}(a, e, r), a;
|
||||
};
|
||||
}
|
||||
var applyDecs2203Impl;
|
||||
function applyDecs2203(e, t, r) {
|
||||
return (applyDecs2203Impl = applyDecs2203Impl || applyDecs2203Factory())(e, t, r);
|
||||
}
|
||||
export { applyDecs2203 as default };
|
||||
@@ -1,191 +0,0 @@
|
||||
import _typeof from "./typeof.js";
|
||||
import setFunctionName from "./setFunctionName.js";
|
||||
import toPropertyKey from "./toPropertyKey.js";
|
||||
function applyDecs2203RFactory() {
|
||||
function createAddInitializerMethod(e, t) {
|
||||
return function (r) {
|
||||
!function (e, t) {
|
||||
if (e.v) throw Error("attempted to call addInitializer after decoration was finished");
|
||||
}(t), assertCallable(r, "An initializer"), e.push(r);
|
||||
};
|
||||
}
|
||||
function memberDec(e, t, r, n, a, i, o, s) {
|
||||
var c;
|
||||
switch (a) {
|
||||
case 1:
|
||||
c = "accessor";
|
||||
break;
|
||||
case 2:
|
||||
c = "method";
|
||||
break;
|
||||
case 3:
|
||||
c = "getter";
|
||||
break;
|
||||
case 4:
|
||||
c = "setter";
|
||||
break;
|
||||
default:
|
||||
c = "field";
|
||||
}
|
||||
var l,
|
||||
u,
|
||||
f = {
|
||||
kind: c,
|
||||
name: o ? "#" + t : toPropertyKey(t),
|
||||
"static": i,
|
||||
"private": o
|
||||
},
|
||||
p = {
|
||||
v: !1
|
||||
};
|
||||
0 !== a && (f.addInitializer = createAddInitializerMethod(n, p)), 0 === a ? o ? (l = r.get, u = r.set) : (l = function l() {
|
||||
return this[t];
|
||||
}, u = function u(e) {
|
||||
this[t] = e;
|
||||
}) : 2 === a ? l = function l() {
|
||||
return r.value;
|
||||
} : (1 !== a && 3 !== a || (l = function l() {
|
||||
return r.get.call(this);
|
||||
}), 1 !== a && 4 !== a || (u = function u(e) {
|
||||
r.set.call(this, e);
|
||||
})), f.access = l && u ? {
|
||||
get: l,
|
||||
set: u
|
||||
} : l ? {
|
||||
get: l
|
||||
} : {
|
||||
set: u
|
||||
};
|
||||
try {
|
||||
return e(s, f);
|
||||
} finally {
|
||||
p.v = !0;
|
||||
}
|
||||
}
|
||||
function assertCallable(e, t) {
|
||||
if ("function" != typeof e) throw new TypeError(t + " must be a function");
|
||||
}
|
||||
function assertValidReturnValue(e, t) {
|
||||
var r = _typeof(t);
|
||||
if (1 === e) {
|
||||
if ("object" !== r || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
||||
void 0 !== t.get && assertCallable(t.get, "accessor.get"), void 0 !== t.set && assertCallable(t.set, "accessor.set"), void 0 !== t.init && assertCallable(t.init, "accessor.init");
|
||||
} else if ("function" !== r) throw new TypeError((0 === e ? "field" : 10 === e ? "class" : "method") + " decorators must return a function or void 0");
|
||||
}
|
||||
function applyMemberDec(e, t, r, n, a, i, o, s) {
|
||||
var c,
|
||||
l,
|
||||
u,
|
||||
f,
|
||||
p,
|
||||
d,
|
||||
h,
|
||||
v = r[0];
|
||||
if (o ? (0 === a || 1 === a ? (c = {
|
||||
get: r[3],
|
||||
set: r[4]
|
||||
}, u = "get") : 3 === a ? (c = {
|
||||
get: r[3]
|
||||
}, u = "get") : 4 === a ? (c = {
|
||||
set: r[3]
|
||||
}, u = "set") : c = {
|
||||
value: r[3]
|
||||
}, 0 !== a && (1 === a && setFunctionName(r[4], "#" + n, "set"), setFunctionName(r[3], "#" + n, u))) : 0 !== a && (c = Object.getOwnPropertyDescriptor(t, n)), 1 === a ? f = {
|
||||
get: c.get,
|
||||
set: c.set
|
||||
} : 2 === a ? f = c.value : 3 === a ? f = c.get : 4 === a && (f = c.set), "function" == typeof v) void 0 !== (p = memberDec(v, n, c, s, a, i, o, f)) && (assertValidReturnValue(a, p), 0 === a ? l = p : 1 === a ? (l = p.init, d = p.get || f.get, h = p.set || f.set, f = {
|
||||
get: d,
|
||||
set: h
|
||||
}) : f = p);else for (var g = v.length - 1; g >= 0; g--) {
|
||||
var y;
|
||||
void 0 !== (p = memberDec(v[g], n, c, s, a, i, o, f)) && (assertValidReturnValue(a, p), 0 === a ? y = p : 1 === a ? (y = p.init, d = p.get || f.get, h = p.set || f.set, f = {
|
||||
get: d,
|
||||
set: h
|
||||
}) : f = p, void 0 !== y && (void 0 === l ? l = y : "function" == typeof l ? l = [l, y] : l.push(y)));
|
||||
}
|
||||
if (0 === a || 1 === a) {
|
||||
if (void 0 === l) l = function l(e, t) {
|
||||
return t;
|
||||
};else if ("function" != typeof l) {
|
||||
var m = l;
|
||||
l = function l(e, t) {
|
||||
for (var r = t, n = 0; n < m.length; n++) r = m[n].call(e, r);
|
||||
return r;
|
||||
};
|
||||
} else {
|
||||
var b = l;
|
||||
l = function l(e, t) {
|
||||
return b.call(e, t);
|
||||
};
|
||||
}
|
||||
e.push(l);
|
||||
}
|
||||
0 !== a && (1 === a ? (c.get = f.get, c.set = f.set) : 2 === a ? c.value = f : 3 === a ? c.get = f : 4 === a && (c.set = f), o ? 1 === a ? (e.push(function (e, t) {
|
||||
return f.get.call(e, t);
|
||||
}), e.push(function (e, t) {
|
||||
return f.set.call(e, t);
|
||||
})) : 2 === a ? e.push(f) : e.push(function (e, t) {
|
||||
return f.call(e, t);
|
||||
}) : Object.defineProperty(t, n, c));
|
||||
}
|
||||
function applyMemberDecs(e, t) {
|
||||
for (var r, n, a = [], i = new Map(), o = new Map(), s = 0; s < t.length; s++) {
|
||||
var c = t[s];
|
||||
if (Array.isArray(c)) {
|
||||
var l,
|
||||
u,
|
||||
f = c[1],
|
||||
p = c[2],
|
||||
d = c.length > 3,
|
||||
h = f >= 5;
|
||||
if (h ? (l = e, 0 != (f -= 5) && (u = n = n || [])) : (l = e.prototype, 0 !== f && (u = r = r || [])), 0 !== f && !d) {
|
||||
var v = h ? o : i,
|
||||
g = v.get(p) || 0;
|
||||
if (!0 === g || 3 === g && 4 !== f || 4 === g && 3 !== f) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + p);
|
||||
!g && f > 2 ? v.set(p, f) : v.set(p, !0);
|
||||
}
|
||||
applyMemberDec(a, l, c, p, f, h, d, u);
|
||||
}
|
||||
}
|
||||
return pushInitializers(a, r), pushInitializers(a, n), a;
|
||||
}
|
||||
function pushInitializers(e, t) {
|
||||
t && e.push(function (e) {
|
||||
for (var r = 0; r < t.length; r++) t[r].call(e);
|
||||
return e;
|
||||
});
|
||||
}
|
||||
return function (e, t, r) {
|
||||
return {
|
||||
e: applyMemberDecs(e, t),
|
||||
get c() {
|
||||
return function (e, t) {
|
||||
if (t.length > 0) {
|
||||
for (var r = [], n = e, a = e.name, i = t.length - 1; i >= 0; i--) {
|
||||
var o = {
|
||||
v: !1
|
||||
};
|
||||
try {
|
||||
var s = t[i](n, {
|
||||
kind: "class",
|
||||
name: a,
|
||||
addInitializer: createAddInitializerMethod(r, o)
|
||||
});
|
||||
} finally {
|
||||
o.v = !0;
|
||||
}
|
||||
void 0 !== s && (assertValidReturnValue(10, s), n = s);
|
||||
}
|
||||
return [n, function () {
|
||||
for (var e = 0; e < r.length; e++) r[e].call(n);
|
||||
}];
|
||||
}
|
||||
}(e, r);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
function applyDecs2203R(e, t, r) {
|
||||
return (applyDecs2203R = applyDecs2203RFactory())(e, t, r);
|
||||
}
|
||||
export { applyDecs2203R as default };
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user