From 5491bff53a1883b3449fe2d6477237dcd46356db Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Sun, 21 Apr 2024 02:50:43 +0200 Subject: [PATCH] enhanced --- endpoints/lollms_advanced.py | 68 +++- lollms_webui.py | 17 + .../graphviz_execution_engine.py | 22 +- .../html_execution_engine.py | 25 +- .../javascript_execution_engine.py | 23 +- .../mermaid_execution_engine.py | 24 +- .../python_execution_engine.py | 2 +- .../shell_execution_engine.py | 2 +- .../{index-1841272f.js => index-4fb85597.js} | 384 +++++++++--------- web/dist/index.html | 2 +- web/src/components/CodeBlock.vue | 41 +- 11 files changed, 400 insertions(+), 210 deletions(-) rename web/dist/assets/{index-1841272f.js => index-4fb85597.js} (93%) diff --git a/endpoints/lollms_advanced.py b/endpoints/lollms_advanced.py index 71f25a36..f4638e35 100644 --- a/endpoints/lollms_advanced.py +++ b/endpoints/lollms_advanced.py @@ -94,11 +94,11 @@ async def execute_code(request: CodeRequest): if language=="javascript": ASCIIColors.info("Executing javascript code:") ASCIIColors.yellow(code) - return execute_javascript(code) + return execute_javascript(code, client, message_id) if language in ["html","html5","svg"]: ASCIIColors.info("Executing javascript code:") ASCIIColors.yellow(code) - return execute_html(code) + return execute_html(code, client, message_id) elif language=="latex": ASCIIColors.info("Executing latex code:") @@ -111,18 +111,78 @@ async def execute_code(request: CodeRequest): elif language in ["mermaid"]: ASCIIColors.info("Executing mermaid code:") ASCIIColors.yellow(code) - return execute_mermaid(code) + return execute_mermaid(code, client, message_id) elif language in ["graphviz","dot"]: ASCIIColors.info("Executing graphviz code:") ASCIIColors.yellow(code) - return execute_graphviz(code) + return execute_graphviz(code, client, message_id) return {"status": False, "error": "Unsupported language", "execution_time": 0} except Exception as ex: trace_exception(ex) lollmsElfServer.error(ex) return {"status":False,"error":str(ex)} +@router.post("/execute_code_in_new_tab") +async def execute_code_in_new_tab(request: CodeRequest): + """ + Executes Python code and returns the output. + :param request: The HTTP request object. + :return: A JSON response with the status of the operation. + """ + client = check_access(lollmsElfServer, request.client_id) + if lollmsElfServer.config.headless_server_mode: + return {"status":False,"error":"Code execution is blocked when in headless mode for obvious security reasons!"} + + forbid_remote_access(lollmsElfServer, "Code execution is blocked when the server is exposed outside for very obvious reasons!") + if not lollmsElfServer.config.turn_on_code_execution: + return {"status":False,"error":"Code execution is blocked by the configuration!"} + + if lollmsElfServer.config.turn_on_code_validation: + if not show_yes_no_dialog("Validation","Do you validate the execution of the code?"): + return {"status":False,"error":"User refused the execution!"} + + try: + code = request.code + discussion_id = request.discussion_id + message_id = request.message_id + language = request.language + + if language=="python": + ASCIIColors.info("Executing python code:") + ASCIIColors.yellow(code) + return execute_python(code, client, message_id, True) + if language=="javascript": + ASCIIColors.info("Executing javascript code:") + ASCIIColors.yellow(code) + return execute_javascript(code, client, message_id, True) + if language in ["html","html5","svg"]: + ASCIIColors.info("Executing javascript code:") + ASCIIColors.yellow(code) + return execute_html(code, client, message_id, True) + + elif language=="latex": + ASCIIColors.info("Executing latex code:") + ASCIIColors.yellow(code) + return execute_latex(code, client, message_id, True) + elif language in ["bash","shell","cmd","powershell"]: + ASCIIColors.info("Executing shell code:") + ASCIIColors.yellow(code) + return execute_bash(code, client) + elif language in ["mermaid"]: + ASCIIColors.info("Executing mermaid code:") + ASCIIColors.yellow(code) + return execute_mermaid(code, client, message_id, True) + elif language in ["graphviz","dot"]: + ASCIIColors.info("Executing graphviz code:") + ASCIIColors.yellow(code) + return execute_graphviz(code, client, message_id, True) + return {"status": False, "error": "Unsupported language", "execution_time": 0} + except Exception as ex: + trace_exception(ex) + lollmsElfServer.error(ex) + return {"status":False,"error":str(ex)} + class FilePath(BaseModel): path: Optional[str] = Field(None, max_length=500) diff --git a/lollms_webui.py b/lollms_webui.py index f25814b7..b5c21bb3 100644 --- a/lollms_webui.py +++ b/lollms_webui.py @@ -799,6 +799,22 @@ class LOLLMSWebUI(LOLLMSElfServer): ) ) + def send_refresh(self, client_id): + client = self.session.get_client(client_id) + run_async( + partial(self.sio.emit,'update_message', { + "sender": client.discussion.current_message.sender, + 'id':client.discussion.current_message.id, + 'content': client.discussion.current_message.content, + 'discussion_id':client.discussion.discussion_id, + 'message_type': client.discussion.current_message.message_type, + 'created_at':client.discussion.current_message.created_at, + 'started_generating_at': client.discussion.current_message.started_generating_at, + 'finished_generating_at': client.discussion.current_message.finished_generating_at, + 'nb_tokens': client.discussion.current_message.nb_tokens, + }, to=client_id + ) + ) def update_message(self, client_id, chunk, parameters=None, metadata=[], @@ -1129,6 +1145,7 @@ class LOLLMSWebUI(LOLLMSElfServer): client.discussion.load_message(message_id) client.generated_text = message.content else: + self.send_refresh(client_id) self.new_message(client_id, self.personality.name, "") self.update_message(client_id, "✍ warming up ...", msg_type=MSG_TYPE.MSG_TYPE_STEP_START) diff --git a/utilities/execution_engines/graphviz_execution_engine.py b/utilities/execution_engines/graphviz_execution_engine.py index 49c2e837..3f18d525 100644 --- a/utilities/execution_engines/graphviz_execution_engine.py +++ b/utilities/execution_engines/graphviz_execution_engine.py @@ -12,6 +12,7 @@ import time import subprocess import json from lollms.client_session import Client +from lollms.utilities import discussion_path_2_url lollmsElfServer:LOLLMSWebUI = LOLLMSWebUI.get_instance() @@ -68,6 +69,23 @@ def build_graphviz_output(code, ifram_name="unnamed"): execution_time = time.time() - start_time return {"output": rendered, "execution_time": execution_time} -def execute_graphviz(code): +def execute_graphviz(code, client:Client, message_id, build_file=False): + if build_file: + # Start the timer. + start_time = time.time() + if not "http" in lollmsElfServer.config.host and not "https" in lollmsElfServer.config.host: + host = "http://"+lollmsElfServer.config.host + else: + host = lollmsElfServer.config.host - return build_graphviz_output(code) \ No newline at end of file + # Create a temporary file. + root_folder = client.discussion.discussion_folder + root_folder.mkdir(parents=True,exist_ok=True) + tmp_file = root_folder/f"ai_code_{message_id}.html" + with open(tmp_file,"w",encoding="utf8") as f: + f.write(build_graphviz_output(code)) + link = f"{host}:{lollmsElfServer.config.port}/{discussion_path_2_url(tmp_file)}" + output_json = {"output": f'Page built successfully
Press here to view the page', "execution_time": execution_time} + return output_json + else: + return build_graphviz_output(code) diff --git a/utilities/execution_engines/html_execution_engine.py b/utilities/execution_engines/html_execution_engine.py index 93beef1c..1d10c431 100644 --- a/utilities/execution_engines/html_execution_engine.py +++ b/utilities/execution_engines/html_execution_engine.py @@ -12,6 +12,7 @@ import time import subprocess import json from lollms.client_session import Client +from lollms.utilities import discussion_path_2_url lollmsElfServer:LOLLMSWebUI = LOLLMSWebUI.get_instance() @@ -40,5 +41,25 @@ def build_html_output(code, ifram_name="unnamed"): execution_time = time.time() - start_time return {"output": rendered, "execution_time": execution_time} -def execute_html(code): - return build_html_output(code) \ No newline at end of file +def execute_html(code, client:Client, message_id, build_file=False): + if build_file: + # Start the timer. + start_time = time.time() + if not "http" in lollmsElfServer.config.host and not "https" in lollmsElfServer.config.host: + host = "http://"+lollmsElfServer.config.host + else: + host = lollmsElfServer.config.host + + # Create a temporary file. + root_folder = client.discussion.discussion_folder + root_folder.mkdir(parents=True,exist_ok=True) + tmp_file = root_folder/f"ai_code_{message_id}.html" + with open(tmp_file,"w",encoding="utf8") as f: + f.write(code) + link = f"{host}:{lollmsElfServer.config.port}/{discussion_path_2_url(tmp_file)}" + # Stop the timer. + execution_time = time.time() - start_time + output_json = {"output": f'Page built successfully
Press here to view the page', "execution_time": execution_time} + return output_json + else: + return build_html_output(code) \ No newline at end of file diff --git a/utilities/execution_engines/javascript_execution_engine.py b/utilities/execution_engines/javascript_execution_engine.py index 1d815ab1..df23e9d9 100644 --- a/utilities/execution_engines/javascript_execution_engine.py +++ b/utilities/execution_engines/javascript_execution_engine.py @@ -12,6 +12,7 @@ import time import subprocess import json from lollms.client_session import Client +from lollms.utilities import discussion_path_2_url lollmsElfServer:LOLLMSWebUI = LOLLMSWebUI.get_instance() @@ -49,5 +50,23 @@ def build_javascript_output(code, ifram_name="unnamed"): execution_time = time.time() - start_time return {"output": rendered, "execution_time": execution_time} -def execute_javascript(code): - return build_javascript_output(code) \ No newline at end of file +def execute_javascript(code, client:Client, message_id, build_file=False): + if build_file: + # Start the timer. + start_time = time.time() + if not "http" in lollmsElfServer.config.host and not "https" in lollmsElfServer.config.host: + host = "http://"+lollmsElfServer.config.host + else: + host = lollmsElfServer.config.host + + # Create a temporary file. + root_folder = client.discussion.discussion_folder + root_folder.mkdir(parents=True,exist_ok=True) + tmp_file = root_folder/f"ai_code_{message_id}.html" + with open(tmp_file,"w",encoding="utf8") as f: + f.write(build_javascript_output(code)) + link = f"{host}:{lollmsElfServer.config.port}/{discussion_path_2_url(tmp_file)}" + output_json = {"output": f'Page built successfully
Press here to view the page', "execution_time": execution_time} + return output_json + else: + return build_javascript_output(code) diff --git a/utilities/execution_engines/mermaid_execution_engine.py b/utilities/execution_engines/mermaid_execution_engine.py index e22cb55d..ca322de0 100644 --- a/utilities/execution_engines/mermaid_execution_engine.py +++ b/utilities/execution_engines/mermaid_execution_engine.py @@ -12,6 +12,7 @@ import time import subprocess import json from lollms.client_session import Client +from lollms.utilities import discussion_path_2_url lollmsElfServer:LOLLMSWebUI = LOLLMSWebUI.get_instance() @@ -82,6 +83,25 @@ def build_mermaid_output(code, ifram_name="unnamed"): -def execute_mermaid(code): +def execute_mermaid(code, client:Client, message_id, build_file=False): + if build_file: + # Start the timer. + start_time = time.time() + if not "http" in lollmsElfServer.config.host and not "https" in lollmsElfServer.config.host: + host = "http://"+lollmsElfServer.config.host + else: + host = lollmsElfServer.config.host - return build_mermaid_output(code) \ No newline at end of file + # Create a temporary file. + root_folder = client.discussion.discussion_folder + root_folder.mkdir(parents=True,exist_ok=True) + tmp_file = root_folder/f"ai_code_{message_id}.html" + with open(tmp_file,"w",encoding="utf8") as f: + f.write(build_mermaid_output(code)) + link = f"{host}:{lollmsElfServer.config.port}/{discussion_path_2_url(tmp_file)}" + # Stop the timer. + execution_time = time.time() - start_time + output_json = {"output": f'Page built successfully
Press here to view the page', "execution_time": execution_time} + return output_json + else: + return build_mermaid_output(code) diff --git a/utilities/execution_engines/python_execution_engine.py b/utilities/execution_engines/python_execution_engine.py index 522530e5..0828fed5 100644 --- a/utilities/execution_engines/python_execution_engine.py +++ b/utilities/execution_engines/python_execution_engine.py @@ -16,7 +16,7 @@ from lollms.client_session import Client lollmsElfServer:LOLLMSWebUI = LOLLMSWebUI.get_instance() -def execute_python(code, client:Client, message_id): +def execute_python(code, client:Client, message_id, build_file=True): def spawn_process(code): """Executes Python code and returns the output as JSON.""" diff --git a/utilities/execution_engines/shell_execution_engine.py b/utilities/execution_engines/shell_execution_engine.py index 14e10be0..033868b6 100644 --- a/utilities/execution_engines/shell_execution_engine.py +++ b/utilities/execution_engines/shell_execution_engine.py @@ -15,7 +15,7 @@ from lollms.client_session import Client lollmsElfServer:LOLLMSWebUI = LOLLMSWebUI.get_instance() -def execute_bash(code, client:Client): +def execute_bash(code, client:Client, message_id, build_file=False): def spawn_process(code): """Executes Python code and returns the output as JSON.""" diff --git a/web/dist/assets/index-1841272f.js b/web/dist/assets/index-4fb85597.js similarity index 93% rename from web/dist/assets/index-1841272f.js rename to web/dist/assets/index-4fb85597.js index 08a22f4e..1361e87f 100644 --- a/web/dist/assets/index-1841272f.js +++ b/web/dist/assets/index-4fb85597.js @@ -47,17 +47,17 @@ https://github.com/highlightjs/highlight.js/issues/2277`),ae=P,Q=j),Y===void 0&& "]*"`}]},{className:"built_in",variants:[{begin:"\\b(abs|acos|asin|atan|atan2|atanh|ceil|cloglog|comb|cos|digamma|exp|floor|invcloglog|invlogit|ln|lnfact|lnfactorial|lngamma|log|log10|max|min|mod|reldif|round|sign|sin|sqrt|sum|tan|tanh|trigamma|trunc|betaden|Binomial|binorm|binormal|chi2|chi2tail|dgammapda|dgammapdada|dgammapdadx|dgammapdx|dgammapdxdx|F|Fden|Ftail|gammaden|gammap|ibeta|invbinomial|invchi2|invchi2tail|invF|invFtail|invgammap|invibeta|invnchi2|invnFtail|invnibeta|invnorm|invnormal|invttail|nbetaden|nchi2|nFden|nFtail|nibeta|norm|normal|normalden|normd|npnchi2|tden|ttail|uniform|abbrev|char|index|indexnot|length|lower|ltrim|match|plural|proper|real|regexm|regexr|regexs|reverse|rtrim|string|strlen|strlower|strltrim|strmatch|strofreal|strpos|strproper|strreverse|strrtrim|strtrim|strupper|subinstr|subinword|substr|trim|upper|word|wordcount|_caller|autocode|byteorder|chop|clip|cond|e|epsdouble|epsfloat|group|inlist|inrange|irecode|matrix|maxbyte|maxdouble|maxfloat|maxint|maxlong|mi|minbyte|mindouble|minfloat|minint|minlong|missing|r|recode|replay|return|s|scalar|d|date|day|dow|doy|halfyear|mdy|month|quarter|week|year|d|daily|dofd|dofh|dofm|dofq|dofw|dofy|h|halfyearly|hofd|m|mofd|monthly|q|qofd|quarterly|tin|twithin|w|weekly|wofd|y|yearly|yh|ym|yofd|yq|yw|cholesky|colnumb|colsof|corr|det|diag|diag0cnt|el|get|hadamard|I|inv|invsym|issym|issymmetric|J|matmissing|matuniform|mreldif|nullmat|rownumb|rowsof|sweep|syminv|trace|vec|vecdiag)(?=\\()"}]},e.COMMENT("^[ ]*\\*.*$",!1),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]}}return om=n,om}var am,Vx;function mWe(){if(Vx)return am;Vx=1;function n(e){return{name:"STEP Part 21",aliases:["p21","step","stp"],case_insensitive:!0,keywords:{$pattern:"[A-Z_][A-Z0-9_.]*",keyword:["HEADER","ENDSEC","DATA"]},contains:[{className:"meta",begin:"ISO-10303-21;",relevance:10},{className:"meta",begin:"END-ISO-10303-21;",relevance:10},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.COMMENT("/\\*\\*!","\\*/"),e.C_NUMBER_MODE,e.inherit(e.APOS_STRING_MODE,{illegal:null}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null}),{className:"string",begin:"'",end:"'"},{className:"symbol",variants:[{begin:"#",end:"\\d+",illegal:"\\W"}]}]}}return am=n,am}var lm,Hx;function gWe(){if(Hx)return lm;Hx=1;const n=a=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:a.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[a.APOS_STRING_MODE,a.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:a.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),e=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],t=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],i=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"],s=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],r=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse();function o(a){const l=n(a),d="and or not only",c={className:"variable",begin:"\\$"+a.IDENT_RE},_=["charset","css","debug","extend","font-face","for","import","include","keyframes","media","mixin","page","warn","while"],f="(?=[.\\s\\n[:,(])";return{name:"Stylus",aliases:["styl"],case_insensitive:!1,keywords:"if else for in",illegal:"("+["\\?","(\\bReturn\\b)","(\\bEnd\\b)","(\\bend\\b)","(\\bdef\\b)",";","#\\s","\\*\\s","===\\s","\\|","%"].join("|")+")",contains:[a.QUOTE_STRING_MODE,a.APOS_STRING_MODE,a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,l.HEXCOLOR,{begin:"\\.[a-zA-Z][a-zA-Z0-9_-]*"+f,className:"selector-class"},{begin:"#[a-zA-Z][a-zA-Z0-9_-]*"+f,className:"selector-id"},{begin:"\\b("+e.join("|")+")"+f,className:"selector-tag"},{className:"selector-pseudo",begin:"&?:("+i.join("|")+")"+f},{className:"selector-pseudo",begin:"&?:(:)?("+s.join("|")+")"+f},l.ATTRIBUTE_SELECTOR_MODE,{className:"keyword",begin:/@media/,starts:{end:/[{;}]/,keywords:{$pattern:/[a-z-]+/,keyword:d,attribute:t.join(" ")},contains:[l.CSS_NUMBER_MODE]}},{className:"keyword",begin:"@((-(o|moz|ms|webkit)-)?("+_.join("|")+"))\\b"},c,l.CSS_NUMBER_MODE,{className:"function",begin:"^[a-zA-Z][a-zA-Z0-9_-]*\\(.*\\)",illegal:"[\\n]",returnBegin:!0,contains:[{className:"title",begin:"\\b[a-zA-Z][a-zA-Z0-9_-]*"},{className:"params",begin:/\(/,end:/\)/,contains:[l.HEXCOLOR,c,a.APOS_STRING_MODE,l.CSS_NUMBER_MODE,a.QUOTE_STRING_MODE]}]},l.CSS_VARIABLE,{className:"attribute",begin:"\\b("+r.join("|")+")\\b",starts:{end:/;|$/,contains:[l.HEXCOLOR,c,a.APOS_STRING_MODE,a.QUOTE_STRING_MODE,l.CSS_NUMBER_MODE,a.C_BLOCK_COMMENT_MODE,l.IMPORTANT,l.FUNCTION_DISPATCH],illegal:/\./,relevance:0}},l.FUNCTION_DISPATCH]}}return lm=o,lm}var cm,qx;function bWe(){if(qx)return cm;qx=1;function n(e){return{name:"SubUnit",case_insensitive:!0,contains:[{className:"string",begin:`\\[ (multipart)?`,end:`\\] `},{className:"string",begin:"\\d{4}-\\d{2}-\\d{2}(\\s+)\\d{2}:\\d{2}:\\d{2}.\\d+Z"},{className:"string",begin:"(\\+|-)\\d+"},{className:"keyword",relevance:10,variants:[{begin:"^(test|testing|success|successful|failure|error|skip|xfail|uxsuccess)(:?)\\s+(test)?"},{begin:"^progress(:?)(\\s+)?(pop|push)?"},{begin:"^tags:"},{begin:"^time:"}]}]}}return cm=n,cm}var dm,Yx;function EWe(){if(Yx)return dm;Yx=1;function n(R){return R?typeof R=="string"?R:R.source:null}function e(R){return t("(?=",R,")")}function t(...R){return R.map(A=>n(A)).join("")}function i(R){const S=R[R.length-1];return typeof S=="object"&&S.constructor===Object?(R.splice(R.length-1,1),S):{}}function s(...R){return"("+(i(R).capture?"":"?:")+R.map(U=>n(U)).join("|")+")"}const r=R=>t(/\b/,R,/\w$/.test(R)?/\b/:/\B/),o=["Protocol","Type"].map(r),a=["init","self"].map(r),l=["Any","Self"],d=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],c=["false","nil","true"],_=["assignment","associativity","higherThan","left","lowerThan","none","right"],f=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],m=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],h=s(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),E=s(h,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),b=t(h,E,"*"),g=s(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),v=s(g,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),y=t(g,v,"*"),T=t(/[A-Z]/,v,"*"),C=["attached","autoclosure",t(/convention\(/,s("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",t(/objc\(/,y,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],x=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function O(R){const S={match:/\s+/,relevance:0},A=R.COMMENT("/\\*","\\*/",{contains:["self"]}),U=[R.C_LINE_COMMENT_MODE,A],F={match:[/\./,s(...o,...a)],className:{2:"keyword"}},K={match:t(/\./,s(...d)),relevance:0},L=d.filter(He=>typeof He=="string").concat(["_|0"]),H=d.filter(He=>typeof He!="string").concat(l).map(r),G={variants:[{className:"keyword",match:s(...H,...a)}]},P={$pattern:s(/\b\w+/,/#\w+/),keyword:L.concat(f),literal:c},j=[F,K,G],Y={match:t(/\./,s(...m)),relevance:0},Q={className:"built_in",match:t(/\b/,s(...m),/(?=\()/)},ae=[Y,Q],te={match:/->/,relevance:0},Z={className:"operator",relevance:0,variants:[{match:b},{match:`\\.(\\.|${E})+`}]},me=[te,Z],ve="([0-9]_*)+",Ae="([0-9a-fA-F]_*)+",J={className:"number",relevance:0,variants:[{match:`\\b(${ve})(\\.(${ve}))?([eE][+-]?(${ve}))?\\b`},{match:`\\b0x(${Ae})(\\.(${Ae}))?([pP][+-]?(${ve}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},ge=(He="")=>({className:"subst",variants:[{match:t(/\\/,He,/[0\\tnr"']/)},{match:t(/\\/,He,/u\{[0-9a-fA-F]{1,8}\}/)}]}),ee=(He="")=>({className:"subst",match:t(/\\/,He,/[\t ]*(?:[\r\n]|\r\n)/)}),Se=(He="")=>({className:"subst",label:"interpol",begin:t(/\\/,He,/\(/),end:/\)/}),Ie=(He="")=>({begin:t(He,/"""/),end:t(/"""/,He),contains:[ge(He),ee(He),Se(He)]}),k=(He="")=>({begin:t(He,/"/),end:t(/"/,He),contains:[ge(He),Se(He)]}),B={className:"string",variants:[Ie(),Ie("#"),Ie("##"),Ie("###"),k(),k("#"),k("##"),k("###")]},$=[R.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[R.BACKSLASH_ESCAPE]}],de={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:$},ie=He=>{const et=t(He,/\//),Fe=t(/\//,He);return{begin:et,end:Fe,contains:[...$,{scope:"comment",begin:`#(?!.*${Fe})`,end:/$/}]}},Ce={scope:"regexp",variants:[ie("###"),ie("##"),ie("#"),de]},we={match:t(/`/,y,/`/)},V={className:"variable",match:/\$\d+/},_e={className:"variable",match:`\\$${v}+`},se=[we,V,_e],ce={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:x,contains:[...me,J,B]}]}},D={scope:"keyword",match:t(/@/,s(...C))},I={scope:"meta",match:t(/@/,y)},z=[ce,D,I],he={match:e(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:t(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,v,"+")},{className:"type",match:T,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:t(/\s+&\s+/,e(T)),relevance:0}]},X={begin://,keywords:P,contains:[...U,...j,...z,te,he]};he.contains.push(X);const re={match:t(y,/\s*:/),keywords:"_|0",relevance:0},Re={begin:/\(/,end:/\)/,relevance:0,keywords:P,contains:["self",re,...U,Ce,...j,...ae,...me,J,B,...se,...z,he]},xe={begin://,keywords:"repeat each",contains:[...U,he]},De={begin:s(e(t(y,/\s*:/)),e(t(y,/\s+/,y,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:y}]},ze={begin:/\(/,end:/\)/,keywords:P,contains:[De,...U,...j,...me,J,B,...z,he,Re],endsParent:!0,illegal:/["']/},st={match:[/(func|macro)/,/\s+/,s(we.match,y,b)],className:{1:"keyword",3:"title.function"},contains:[xe,ze,S],illegal:[/\[/,/%/]},ke={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[xe,ze,S],illegal:/\[|%/},lt={match:[/operator/,/\s+/,b],className:{1:"keyword",3:"title"}},Qe={begin:[/precedencegroup/,/\s+/,T],className:{1:"keyword",3:"title"},contains:[he],keywords:[..._,...c],end:/}/};for(const He of B.variants){const et=He.contains.find(pt=>pt.label==="interpol");et.keywords=P;const Fe=[...j,...ae,...me,J,B,...se];et.contains=[...Fe,{begin:/\(/,end:/\)/,contains:["self",...Fe]}]}return{name:"Swift",keywords:P,contains:[...U,st,ke,{beginKeywords:"struct protocol class extension enum actor",end:"\\{",excludeEnd:!0,keywords:P,contains:[R.inherit(R.TITLE_MODE,{className:"title.class",begin:/[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/}),...j]},lt,Qe,{beginKeywords:"import",end:/$/,contains:[...U],relevance:0},Ce,...j,...ae,...me,J,B,...se,...z,he,Re]}}return dm=O,dm}var um,$x;function vWe(){if($x)return um;$x=1;function n(e){return{name:"Tagger Script",contains:[{className:"comment",begin:/\$noop\(/,end:/\)/,contains:[{begin:/\\[()]/},{begin:/\(/,end:/\)/,contains:[{begin:/\\[()]/},"self"]}],relevance:10},{className:"keyword",begin:/\$[_a-zA-Z0-9]+(?=\()/},{className:"variable",begin:/%[_a-zA-Z0-9:]+%/},{className:"symbol",begin:/\\[\\nt$%,()]/},{className:"symbol",begin:/\\u[a-fA-F0-9]{4}/}]}}return um=n,um}var pm,Wx;function yWe(){if(Wx)return pm;Wx=1;function n(e){const t="true false yes no null",i="[\\w#;/?:@&=+$,.~*'()[\\]]+",s={className:"attr",variants:[{begin:"\\w[\\w :\\/.-]*:(?=[ ]|$)"},{begin:'"\\w[\\w :\\/.-]*":(?=[ ]|$)'},{begin:"'\\w[\\w :\\/.-]*':(?=[ ]|$)"}]},r={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},o={className:"string",relevance:0,variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,r]},a=e.inherit(o,{variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),l="[0-9]{4}(-[0-9][0-9]){0,2}",d="([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?",c="(\\.[0-9]*)?",_="([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?",f={className:"number",begin:"\\b"+l+d+c+_+"\\b"},m={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},h={begin:/\{/,end:/\}/,contains:[m],illegal:"\\n",relevance:0},E={begin:"\\[",end:"\\]",contains:[m],illegal:"\\n",relevance:0},b=[s,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+i},{className:"type",begin:"!<"+i+">"},{className:"type",begin:"!"+i},{className:"type",begin:"!!"+i},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},f,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},h,E,o],g=[...b];return g.pop(),g.push(a),m.contains=g,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:b}}return pm=n,pm}var _m,Kx;function SWe(){if(Kx)return _m;Kx=1;function n(e){return{name:"Test Anything Protocol",case_insensitive:!0,contains:[e.HASH_COMMENT_MODE,{className:"meta",variants:[{begin:"^TAP version (\\d+)$"},{begin:"^1\\.\\.(\\d+)$"}]},{begin:/---$/,end:"\\.\\.\\.$",subLanguage:"yaml",relevance:0},{className:"number",begin:" (\\d+) "},{className:"symbol",variants:[{begin:"^ok"},{begin:"^not ok"}]}]}}return _m=n,_m}var hm,jx;function TWe(){if(jx)return hm;jx=1;function n(e){const t=e.regex,i=/[a-zA-Z_][a-zA-Z0-9_]*/,s={className:"number",variants:[e.BINARY_NUMBER_MODE,e.C_NUMBER_MODE]};return{name:"Tcl",aliases:["tk"],keywords:["after","append","apply","array","auto_execok","auto_import","auto_load","auto_mkindex","auto_mkindex_old","auto_qualify","auto_reset","bgerror","binary","break","catch","cd","chan","clock","close","concat","continue","dde","dict","encoding","eof","error","eval","exec","exit","expr","fblocked","fconfigure","fcopy","file","fileevent","filename","flush","for","foreach","format","gets","glob","global","history","http","if","incr","info","interp","join","lappend|10","lassign|10","lindex|10","linsert|10","list","llength|10","load","lrange|10","lrepeat|10","lreplace|10","lreverse|10","lsearch|10","lset|10","lsort|10","mathfunc","mathop","memory","msgcat","namespace","open","package","parray","pid","pkg::create","pkg_mkIndex","platform","platform::shell","proc","puts","pwd","read","refchan","regexp","registry","regsub|10","rename","return","safe","scan","seek","set","socket","source","split","string","subst","switch","tcl_endOfWord","tcl_findLibrary","tcl_startOfNextWord","tcl_startOfPreviousWord","tcl_wordBreakAfter","tcl_wordBreakBefore","tcltest","tclvars","tell","time","tm","trace","unknown","unload","unset","update","uplevel","upvar","variable","vwait","while"],contains:[e.COMMENT(";[ \\t]*#","$"),e.COMMENT("^[ \\t]*#","$"),{beginKeywords:"proc",end:"[\\{]",excludeEnd:!0,contains:[{className:"title",begin:"[ \\t\\n\\r]+(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*",end:"[ \\t\\n\\r]",endsWithParent:!0,excludeEnd:!0}]},{className:"variable",variants:[{begin:t.concat(/\$/,t.optional(/::/),i,"(::",i,")*")},{begin:"\\$\\{(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*",end:"\\}",contains:[s]}]},{className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.inherit(e.QUOTE_STRING_MODE,{illegal:null})]},s]}}return hm=n,hm}var fm,Qx;function xWe(){if(Qx)return fm;Qx=1;function n(e){const t=["bool","byte","i16","i32","i64","double","string","binary"];return{name:"Thrift",keywords:{keyword:["namespace","const","typedef","struct","enum","service","exception","void","oneway","set","list","map","required","optional"],type:t,literal:"true false"},contains:[e.QUOTE_STRING_MODE,e.NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"class",beginKeywords:"struct enum service exception",end:/\{/,illegal:/\n/,contains:[e.inherit(e.TITLE_MODE,{starts:{endsWithParent:!0,excludeEnd:!0}})]},{begin:"\\b(set|list|map)\\s*<",keywords:{type:[...t,"set","list","map"]},end:">",contains:["self"]}]}}return fm=n,fm}var mm,Xx;function CWe(){if(Xx)return mm;Xx=1;function n(e){const t={className:"number",begin:"[1-9][0-9]*",relevance:0},i={className:"symbol",begin:":[^\\]]+"},s={className:"built_in",begin:"(AR|P|PAYLOAD|PR|R|SR|RSR|LBL|VR|UALM|MESSAGE|UTOOL|UFRAME|TIMER|TIMER_OVERFLOW|JOINT_MAX_SPEED|RESUME_PROG|DIAG_REC)\\[",end:"\\]",contains:["self",t,i]},r={className:"built_in",begin:"(AI|AO|DI|DO|F|RI|RO|UI|UO|GI|GO|SI|SO)\\[",end:"\\]",contains:["self",t,e.QUOTE_STRING_MODE,i]};return{name:"TP",keywords:{keyword:["ABORT","ACC","ADJUST","AND","AP_LD","BREAK","CALL","CNT","COL","CONDITION","CONFIG","DA","DB","DIV","DETECT","ELSE","END","ENDFOR","ERR_NUM","ERROR_PROG","FINE","FOR","GP","GUARD","INC","IF","JMP","LINEAR_MAX_SPEED","LOCK","MOD","MONITOR","OFFSET","Offset","OR","OVERRIDE","PAUSE","PREG","PTH","RT_LD","RUN","SELECT","SKIP","Skip","TA","TB","TO","TOOL_OFFSET","Tool_Offset","UF","UT","UFRAME_NUM","UTOOL_NUM","UNLOCK","WAIT","X","Y","Z","W","P","R","STRLEN","SUBSTR","FINDSTR","VOFFSET","PROG","ATTR","MN","POS"],literal:["ON","OFF","max_speed","LPOS","JPOS","ENABLE","DISABLE","START","STOP","RESET"]},contains:[s,r,{className:"keyword",begin:"/(PROG|ATTR|MN|POS|END)\\b"},{className:"keyword",begin:"(CALL|RUN|POINT_LOGIC|LBL)\\b"},{className:"keyword",begin:"\\b(ACC|CNT|Skip|Offset|PSPD|RT_LD|AP_LD|Tool_Offset)"},{className:"number",begin:"\\d+(sec|msec|mm/sec|cm/min|inch/min|deg/sec|mm|in|cm)?\\b",relevance:0},e.COMMENT("//","[;$]"),e.COMMENT("!","[;$]"),e.COMMENT("--eg:","$"),e.QUOTE_STRING_MODE,{className:"string",begin:"'",end:"'"},e.C_NUMBER_MODE,{className:"variable",begin:"\\$[A-Za-z0-9_]+"}]}}return mm=n,mm}var gm,Zx;function RWe(){if(Zx)return gm;Zx=1;function n(e){const t=e.regex,i=["absolute_url","asset|0","asset_version","attribute","block","constant","controller|0","country_timezones","csrf_token","cycle","date","dump","expression","form|0","form_end","form_errors","form_help","form_label","form_rest","form_row","form_start","form_widget","html_classes","include","is_granted","logout_path","logout_url","max","min","parent","path|0","random","range","relative_path","render","render_esi","source","template_from_string","url|0"],s=["abs","abbr_class","abbr_method","batch","capitalize","column","convert_encoding","country_name","currency_name","currency_symbol","data_uri","date","date_modify","default","escape","file_excerpt","file_link","file_relative","filter","first","format","format_args","format_args_as_text","format_currency","format_date","format_datetime","format_file","format_file_from_text","format_number","format_time","html_to_markdown","humanize","inky_to_html","inline_css","join","json_encode","keys","language_name","last","length","locale_name","lower","map","markdown","markdown_to_html","merge","nl2br","number_format","raw","reduce","replace","reverse","round","slice","slug","sort","spaceless","split","striptags","timezone_name","title","trans","transchoice","trim","u|0","upper","url_encode","yaml_dump","yaml_encode"];let r=["apply","autoescape","block","cache","deprecated","do","embed","extends","filter","flush","for","form_theme","from","if","import","include","macro","sandbox","set","stopwatch","trans","trans_default_domain","transchoice","use","verbatim","with"];r=r.concat(r.map(E=>`end${E}`));const o={scope:"string",variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/}]},a={scope:"number",match:/\d+/},l={begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,contains:[o,a]},d={beginKeywords:i.join(" "),keywords:{name:i},relevance:0,contains:[l]},c={match:/\|(?=[A-Za-z_]+:?)/,beginScope:"punctuation",relevance:0,contains:[{match:/[A-Za-z_]+:?/,keywords:s}]},_=(E,{relevance:b})=>({beginScope:{1:"template-tag",3:"name"},relevance:b||2,endScope:"template-tag",begin:[/\{%/,/\s*/,t.either(...E)],end:/%\}/,keywords:"in",contains:[c,d,o,a]}),f=/[a-z_]+/,m=_(r,{relevance:2}),h=_([f],{relevance:1});return{name:"Twig",aliases:["craftcms"],case_insensitive:!0,subLanguage:"xml",contains:[e.COMMENT(/\{#/,/#\}/),m,h,{className:"template-variable",begin:/\{\{/,end:/\}\}/,contains:["self",c,d,o,a]}]}}return gm=n,gm}var bm,Jx;function AWe(){if(Jx)return bm;Jx=1;const n="[A-Za-z$_][0-9A-Za-z$_]*",e=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],t=["true","false","null","undefined","NaN","Infinity"],i=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],s=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],r=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],o=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],a=[].concat(r,i,s);function l(c){const _=c.regex,f=(ge,{after:ee})=>{const Se="",end:""},E=/<[A-Za-z0-9\\._:-]+\s*\/>/,b={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(ge,ee)=>{const Se=ge[0].length+ge.index,Ie=ge.input[Se];if(Ie==="<"||Ie===","){ee.ignoreMatch();return}Ie===">"&&(f(ge,{after:Se})||ee.ignoreMatch());let k;const B=ge.input.substring(Se);if(k=B.match(/^\s*=/)){ee.ignoreMatch();return}if((k=B.match(/^\s+extends\s+/))&&k.index===0){ee.ignoreMatch();return}}},g={$pattern:n,keyword:e,literal:t,built_in:a,"variable.language":o},v="[0-9](_?[0-9])*",y=`\\.(${v})`,T="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",C={className:"number",variants:[{begin:`(\\b(${T})((${y})|\\.)?|(${y}))[eE][+-]?(${v})\\b`},{begin:`\\b(${T})\\b((${y})\\b|\\.)?|(${y})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},x={className:"subst",begin:"\\$\\{",end:"\\}",keywords:g,contains:[]},O={begin:"html`",end:"",starts:{end:"`",returnEnd:!1,contains:[c.BACKSLASH_ESCAPE,x],subLanguage:"xml"}},R={begin:"css`",end:"",starts:{end:"`",returnEnd:!1,contains:[c.BACKSLASH_ESCAPE,x],subLanguage:"css"}},S={begin:"gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[c.BACKSLASH_ESCAPE,x],subLanguage:"graphql"}},A={className:"string",begin:"`",end:"`",contains:[c.BACKSLASH_ESCAPE,x]},F={className:"comment",variants:[c.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:m+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),c.C_BLOCK_COMMENT_MODE,c.C_LINE_COMMENT_MODE]},K=[c.APOS_STRING_MODE,c.QUOTE_STRING_MODE,O,R,S,A,{match:/\$\d+/},C];x.contains=K.concat({begin:/\{/,end:/\}/,keywords:g,contains:["self"].concat(K)});const L=[].concat(F,x.contains),H=L.concat([{begin:/\(/,end:/\)/,keywords:g,contains:["self"].concat(L)}]),G={className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:g,contains:H},P={variants:[{match:[/class/,/\s+/,m,/\s+/,/extends/,/\s+/,_.concat(m,"(",_.concat(/\./,m),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,m],scope:{1:"keyword",3:"title.class"}}]},j={relevance:0,match:_.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...i,...s]}},Y={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Q={variants:[{match:[/function/,/\s+/,m,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[G],illegal:/%/},ae={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function te(ge){return _.concat("(?!",ge.join("|"),")")}const Z={match:_.concat(/\b/,te([...r,"super","import"]),m,_.lookahead(/\(/)),className:"title.function",relevance:0},me={begin:_.concat(/\./,_.lookahead(_.concat(m,/(?![0-9A-Za-z$_(])/))),end:m,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},ve={match:[/get|set/,/\s+/,m,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},G]},Ae="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+c.UNDERSCORE_IDENT_RE+")\\s*=>",J={match:[/const|var|let/,/\s+/,m,/\s*/,/=\s*/,/(async\s*)?/,_.lookahead(Ae)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[G]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:g,exports:{PARAMS_CONTAINS:H,CLASS_REFERENCE:j},illegal:/#(?![$_A-z])/,contains:[c.SHEBANG({label:"shebang",binary:"node",relevance:5}),Y,c.APOS_STRING_MODE,c.QUOTE_STRING_MODE,O,R,S,A,F,{match:/\$\d+/},C,j,{className:"attr",begin:m+_.lookahead(":"),relevance:0},J,{begin:"("+c.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[F,c.REGEXP_MODE,{className:"function",begin:Ae,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:c.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:g,contains:H}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:h.begin,end:h.end},{match:E},{begin:b.begin,"on:begin":b.isTrulyOpeningTag,end:b.end}],subLanguage:"xml",contains:[{begin:b.begin,end:b.end,skip:!0,contains:["self"]}]}]},Q,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+c.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[G,c.inherit(c.TITLE_MODE,{begin:m,className:"title.function"})]},{match:/\.\.\./,relevance:0},me,{match:"\\$"+m,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[G]},Z,ae,P,ve,{match:/\$[(.]/}]}}function d(c){const _=l(c),f=n,m=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],h={beginKeywords:"namespace",end:/\{/,excludeEnd:!0,contains:[_.exports.CLASS_REFERENCE]},E={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:m},contains:[_.exports.CLASS_REFERENCE]},b={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},g=["type","namespace","interface","public","private","protected","implements","declare","abstract","readonly","enum","override"],v={$pattern:n,keyword:e.concat(g),literal:t,built_in:a.concat(m),"variable.language":o},y={className:"meta",begin:"@"+f},T=(x,O,R)=>{const S=x.contains.findIndex(A=>A.label===O);if(S===-1)throw new Error("can not find mode to replace");x.contains.splice(S,1,R)};Object.assign(_.keywords,v),_.exports.PARAMS_CONTAINS.push(y),_.contains=_.contains.concat([y,h,E]),T(_,"shebang",c.SHEBANG()),T(_,"use_strict",b);const C=_.contains.find(x=>x.label==="func.def");return C.relevance=0,Object.assign(_,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),_}return bm=d,bm}var Em,eC;function wWe(){if(eC)return Em;eC=1;function n(e){return{name:"Vala",keywords:{keyword:"char uchar unichar int uint long ulong short ushort int8 int16 int32 int64 uint8 uint16 uint32 uint64 float double bool struct enum string void weak unowned owned async signal static abstract interface override virtual delegate if while do for foreach else switch case break default return try catch public private protected internal using new this get set const stdout stdin stderr var",built_in:"DBus GLib CCode Gee Object Gtk Posix",literal:"false true null"},contains:[{className:"class",beginKeywords:"class interface namespace",end:/\{/,excludeEnd:!0,illegal:"[^,:\\n\\s\\.]",contains:[e.UNDERSCORE_TITLE_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",begin:'"""',end:'"""',relevance:5},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,e.C_NUMBER_MODE,{className:"meta",begin:"^#",end:"$"}]}}return Em=n,Em}var vm,tC;function NWe(){if(tC)return vm;tC=1;function n(e){const t=e.regex,i={className:"string",begin:/"(""|[^/n])"C\b/},s={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},r=/\d{1,2}\/\d{1,2}\/\d{4}/,o=/\d{4}-\d{1,2}-\d{1,2}/,a=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,l=/\d{1,2}(:\d{1,2}){1,2}/,d={className:"literal",variants:[{begin:t.concat(/# */,t.either(o,r),/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,t.either(o,r),/ +/,t.either(a,l),/ *#/)}]},c={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},_={className:"label",begin:/^\w+:/},f=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),m=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[i,s,d,c,_,f,m,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[m]}]}}return vm=n,vm}var ym,nC;function OWe(){if(nC)return ym;nC=1;function n(e){const t=e.regex,i=["lcase","month","vartype","instrrev","ubound","setlocale","getobject","rgb","getref","string","weekdayname","rnd","dateadd","monthname","now","day","minute","isarray","cbool","round","formatcurrency","conversions","csng","timevalue","second","year","space","abs","clng","timeserial","fixs","len","asc","isempty","maths","dateserial","atn","timer","isobject","filter","weekday","datevalue","ccur","isdate","instr","datediff","formatdatetime","replace","isnull","right","sgn","array","snumeric","log","cdbl","hex","chr","lbound","msgbox","ucase","getlocale","cos","cdate","cbyte","rtrim","join","hour","oct","typename","trim","strcomp","int","createobject","loadpicture","tan","formatnumber","mid","split","cint","sin","datepart","ltrim","sqr","time","derived","eval","date","formatpercent","exp","inputbox","left","ascw","chrw","regexp","cstr","err"],s=["server","response","request","scriptengine","scriptenginebuildversion","scriptengineminorversion","scriptenginemajorversion"],r={begin:t.concat(t.either(...i),"\\s*\\("),relevance:0,keywords:{built_in:i}};return{name:"VBScript",aliases:["vbs"],case_insensitive:!0,keywords:{keyword:["call","class","const","dim","do","loop","erase","execute","executeglobal","exit","for","each","next","function","if","then","else","on","error","option","explicit","new","private","property","let","get","public","randomize","redim","rem","select","case","set","stop","sub","while","wend","with","end","to","elseif","is","or","xor","and","not","class_initialize","class_terminate","default","preserve","in","me","byval","byref","step","resume","goto"],built_in:s,literal:["true","false","null","nothing","empty"]},illegal:"//",contains:[r,e.inherit(e.QUOTE_STRING_MODE,{contains:[{begin:'""'}]}),e.COMMENT(/'/,/$/,{relevance:0}),e.C_NUMBER_MODE]}}return ym=n,ym}var Sm,iC;function IWe(){if(iC)return Sm;iC=1;function n(e){return{name:"VBScript in HTML",subLanguage:"xml",contains:[{begin:"<%",end:"%>",subLanguage:"vbscript"}]}}return Sm=n,Sm}var Tm,sC;function MWe(){if(sC)return Tm;sC=1;function n(e){const t=e.regex,i={$pattern:/\$?[\w]+(\$[\w]+)*/,keyword:["accept_on","alias","always","always_comb","always_ff","always_latch","and","assert","assign","assume","automatic","before","begin","bind","bins","binsof","bit","break","buf|0","bufif0","bufif1","byte","case","casex","casez","cell","chandle","checker","class","clocking","cmos","config","const","constraint","context","continue","cover","covergroup","coverpoint","cross","deassign","default","defparam","design","disable","dist","do","edge","else","end","endcase","endchecker","endclass","endclocking","endconfig","endfunction","endgenerate","endgroup","endinterface","endmodule","endpackage","endprimitive","endprogram","endproperty","endspecify","endsequence","endtable","endtask","enum","event","eventually","expect","export","extends","extern","final","first_match","for","force","foreach","forever","fork","forkjoin","function","generate|5","genvar","global","highz0","highz1","if","iff","ifnone","ignore_bins","illegal_bins","implements","implies","import","incdir","include","initial","inout","input","inside","instance","int","integer","interconnect","interface","intersect","join","join_any","join_none","large","let","liblist","library","local","localparam","logic","longint","macromodule","matches","medium","modport","module","nand","negedge","nettype","new","nexttime","nmos","nor","noshowcancelled","not","notif0","notif1","or","output","package","packed","parameter","pmos","posedge","primitive","priority","program","property","protected","pull0","pull1","pulldown","pullup","pulsestyle_ondetect","pulsestyle_onevent","pure","rand","randc","randcase","randsequence","rcmos","real","realtime","ref","reg","reject_on","release","repeat","restrict","return","rnmos","rpmos","rtran","rtranif0","rtranif1","s_always","s_eventually","s_nexttime","s_until","s_until_with","scalared","sequence","shortint","shortreal","showcancelled","signed","small","soft","solve","specify","specparam","static","string","strong","strong0","strong1","struct","super","supply0","supply1","sync_accept_on","sync_reject_on","table","tagged","task","this","throughout","time","timeprecision","timeunit","tran","tranif0","tranif1","tri","tri0","tri1","triand","trior","trireg","type","typedef","union","unique","unique0","unsigned","until","until_with","untyped","use","uwire","var","vectored","virtual","void","wait","wait_order","wand","weak","weak0","weak1","while","wildcard","wire","with","within","wor","xnor","xor"],literal:["null"],built_in:["$finish","$stop","$exit","$fatal","$error","$warning","$info","$realtime","$time","$printtimescale","$bitstoreal","$bitstoshortreal","$itor","$signed","$cast","$bits","$stime","$timeformat","$realtobits","$shortrealtobits","$rtoi","$unsigned","$asserton","$assertkill","$assertpasson","$assertfailon","$assertnonvacuouson","$assertoff","$assertcontrol","$assertpassoff","$assertfailoff","$assertvacuousoff","$isunbounded","$sampled","$fell","$changed","$past_gclk","$fell_gclk","$changed_gclk","$rising_gclk","$steady_gclk","$coverage_control","$coverage_get","$coverage_save","$set_coverage_db_name","$rose","$stable","$past","$rose_gclk","$stable_gclk","$future_gclk","$falling_gclk","$changing_gclk","$display","$coverage_get_max","$coverage_merge","$get_coverage","$load_coverage_db","$typename","$unpacked_dimensions","$left","$low","$increment","$clog2","$ln","$log10","$exp","$sqrt","$pow","$floor","$ceil","$sin","$cos","$tan","$countbits","$onehot","$isunknown","$fatal","$warning","$dimensions","$right","$high","$size","$asin","$acos","$atan","$atan2","$hypot","$sinh","$cosh","$tanh","$asinh","$acosh","$atanh","$countones","$onehot0","$error","$info","$random","$dist_chi_square","$dist_erlang","$dist_exponential","$dist_normal","$dist_poisson","$dist_t","$dist_uniform","$q_initialize","$q_remove","$q_exam","$async$and$array","$async$nand$array","$async$or$array","$async$nor$array","$sync$and$array","$sync$nand$array","$sync$or$array","$sync$nor$array","$q_add","$q_full","$psprintf","$async$and$plane","$async$nand$plane","$async$or$plane","$async$nor$plane","$sync$and$plane","$sync$nand$plane","$sync$or$plane","$sync$nor$plane","$system","$display","$displayb","$displayh","$displayo","$strobe","$strobeb","$strobeh","$strobeo","$write","$readmemb","$readmemh","$writememh","$value$plusargs","$dumpvars","$dumpon","$dumplimit","$dumpports","$dumpportson","$dumpportslimit","$writeb","$writeh","$writeo","$monitor","$monitorb","$monitorh","$monitoro","$writememb","$dumpfile","$dumpoff","$dumpall","$dumpflush","$dumpportsoff","$dumpportsall","$dumpportsflush","$fclose","$fdisplay","$fdisplayb","$fdisplayh","$fdisplayo","$fstrobe","$fstrobeb","$fstrobeh","$fstrobeo","$swrite","$swriteb","$swriteh","$swriteo","$fscanf","$fread","$fseek","$fflush","$feof","$fopen","$fwrite","$fwriteb","$fwriteh","$fwriteo","$fmonitor","$fmonitorb","$fmonitorh","$fmonitoro","$sformat","$sformatf","$fgetc","$ungetc","$fgets","$sscanf","$rewind","$ftell","$ferror"]},s=["__FILE__","__LINE__"],r=["begin_keywords","celldefine","default_nettype","default_decay_time","default_trireg_strength","define","delay_mode_distributed","delay_mode_path","delay_mode_unit","delay_mode_zero","else","elsif","end_keywords","endcelldefine","endif","ifdef","ifndef","include","line","nounconnected_drive","pragma","resetall","timescale","unconnected_drive","undef","undefineall"];return{name:"Verilog",aliases:["v","sv","svh"],case_insensitive:!1,keywords:i,contains:[e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.QUOTE_STRING_MODE,{scope:"number",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/\b((\d+'([bhodBHOD]))[0-9xzXZa-fA-F_]+)/},{begin:/\B(('([bhodBHOD]))[0-9xzXZa-fA-F_]+)/},{begin:/\b[0-9][0-9_]*/,relevance:0}]},{scope:"variable",variants:[{begin:"#\\((?!parameter).+\\)"},{begin:"\\.\\w+",relevance:0}]},{scope:"variable.constant",match:t.concat(/`/,t.either(...s))},{scope:"meta",begin:t.concat(/`/,t.either(...r)),end:/$|\/\/|\/\*/,returnEnd:!0,keywords:r}]}}return Tm=n,Tm}var xm,rC;function DWe(){if(rC)return xm;rC=1;function n(e){const t="\\d(_|\\d)*",i="[eE][-+]?"+t,s=t+"(\\."+t+")?("+i+")?",r="\\w+",a="\\b("+(t+"#"+r+"(\\."+r+")?#("+i+")?")+"|"+s+")";return{name:"VHDL",case_insensitive:!0,keywords:{keyword:["abs","access","after","alias","all","and","architecture","array","assert","assume","assume_guarantee","attribute","begin","block","body","buffer","bus","case","component","configuration","constant","context","cover","disconnect","downto","default","else","elsif","end","entity","exit","fairness","file","for","force","function","generate","generic","group","guarded","if","impure","in","inertial","inout","is","label","library","linkage","literal","loop","map","mod","nand","new","next","nor","not","null","of","on","open","or","others","out","package","parameter","port","postponed","procedure","process","property","protected","pure","range","record","register","reject","release","rem","report","restrict","restrict_guarantee","return","rol","ror","select","sequence","severity","shared","signal","sla","sll","sra","srl","strong","subtype","then","to","transport","type","unaffected","units","until","use","variable","view","vmode","vprop","vunit","wait","when","while","with","xnor","xor"],built_in:["boolean","bit","character","integer","time","delay_length","natural","positive","string","bit_vector","file_open_kind","file_open_status","std_logic","std_logic_vector","unsigned","signed","boolean_vector","integer_vector","std_ulogic","std_ulogic_vector","unresolved_unsigned","u_unsigned","unresolved_signed","u_signed","real_vector","time_vector"],literal:["false","true","note","warning","error","failure","line","text","side","width"]},illegal:/\{/,contains:[e.C_BLOCK_COMMENT_MODE,e.COMMENT("--","$"),e.QUOTE_STRING_MODE,{className:"number",begin:a,relevance:0},{className:"string",begin:"'(U|X|0|1|Z|W|L|H|-)'",contains:[e.BACKSLASH_ESCAPE]},{className:"symbol",begin:"'[A-Za-z](_?[A-Za-z0-9])*",contains:[e.BACKSLASH_ESCAPE]}]}}return xm=n,xm}var Cm,oC;function kWe(){if(oC)return Cm;oC=1;function n(e){return{name:"Vim Script",keywords:{$pattern:/[!#@\w]+/,keyword:"N|0 P|0 X|0 a|0 ab abc abo al am an|0 ar arga argd arge argdo argg argl argu as au aug aun b|0 bN ba bad bd be bel bf bl bm bn bo bp br brea breaka breakd breakl bro bufdo buffers bun bw c|0 cN cNf ca cabc caddb cad caddf cal cat cb cc ccl cd ce cex cf cfir cgetb cgete cg changes chd che checkt cl cla clo cm cmapc cme cn cnew cnf cno cnorea cnoreme co col colo com comc comp con conf cope cp cpf cq cr cs cst cu cuna cunme cw delm deb debugg delc delf dif diffg diffo diffp diffpu diffs diffthis dig di dl dell dj dli do doautoa dp dr ds dsp e|0 ea ec echoe echoh echom echon el elsei em en endfo endf endt endw ene ex exe exi exu f|0 files filet fin fina fini fir fix fo foldc foldd folddoc foldo for fu go gr grepa gu gv ha helpf helpg helpt hi hid his ia iabc if ij il im imapc ime ino inorea inoreme int is isp iu iuna iunme j|0 ju k|0 keepa kee keepj lN lNf l|0 lad laddb laddf la lan lat lb lc lch lcl lcs le lefta let lex lf lfir lgetb lgete lg lgr lgrepa lh ll lla lli lmak lm lmapc lne lnew lnf ln loadk lo loc lockv lol lope lp lpf lr ls lt lu lua luad luaf lv lvimgrepa lw m|0 ma mak map mapc marks mat me menut mes mk mks mksp mkv mkvie mod mz mzf nbc nb nbs new nm nmapc nme nn nnoreme noa no noh norea noreme norm nu nun nunme ol o|0 om omapc ome on ono onoreme opt ou ounme ow p|0 profd prof pro promptr pc ped pe perld po popu pp pre prev ps pt ptN ptf ptj ptl ptn ptp ptr pts pu pw py3 python3 py3d py3f py pyd pyf quita qa rec red redi redr redraws reg res ret retu rew ri rightb rub rubyd rubyf rund ru rv sN san sa sal sav sb sbN sba sbf sbl sbm sbn sbp sbr scrip scripte scs se setf setg setl sf sfir sh sim sig sil sl sla sm smap smapc sme sn sni sno snor snoreme sor so spelld spe spelli spellr spellu spellw sp spr sre st sta startg startr star stopi stj sts sun sunm sunme sus sv sw sy synti sync tN tabN tabc tabdo tabe tabf tabfir tabl tabm tabnew tabn tabo tabp tabr tabs tab ta tags tc tcld tclf te tf th tj tl tm tn to tp tr try ts tu u|0 undoj undol una unh unl unlo unm unme uns up ve verb vert vim vimgrepa vi viu vie vm vmapc vme vne vn vnoreme vs vu vunme windo w|0 wN wa wh wi winc winp wn wp wq wqa ws wu wv x|0 xa xmapc xm xme xn xnoreme xu xunme y|0 z|0 ~ Next Print append abbreviate abclear aboveleft all amenu anoremenu args argadd argdelete argedit argglobal arglocal argument ascii autocmd augroup aunmenu buffer bNext ball badd bdelete behave belowright bfirst blast bmodified bnext botright bprevious brewind break breakadd breakdel breaklist browse bunload bwipeout change cNext cNfile cabbrev cabclear caddbuffer caddexpr caddfile call catch cbuffer cclose center cexpr cfile cfirst cgetbuffer cgetexpr cgetfile chdir checkpath checktime clist clast close cmap cmapclear cmenu cnext cnewer cnfile cnoremap cnoreabbrev cnoremenu copy colder colorscheme command comclear compiler continue confirm copen cprevious cpfile cquit crewind cscope cstag cunmap cunabbrev cunmenu cwindow delete delmarks debug debuggreedy delcommand delfunction diffupdate diffget diffoff diffpatch diffput diffsplit digraphs display deletel djump dlist doautocmd doautoall deletep drop dsearch dsplit edit earlier echo echoerr echohl echomsg else elseif emenu endif endfor endfunction endtry endwhile enew execute exit exusage file filetype find finally finish first fixdel fold foldclose folddoopen folddoclosed foldopen function global goto grep grepadd gui gvim hardcopy help helpfind helpgrep helptags highlight hide history insert iabbrev iabclear ijump ilist imap imapclear imenu inoremap inoreabbrev inoremenu intro isearch isplit iunmap iunabbrev iunmenu join jumps keepalt keepmarks keepjumps lNext lNfile list laddexpr laddbuffer laddfile last language later lbuffer lcd lchdir lclose lcscope left leftabove lexpr lfile lfirst lgetbuffer lgetexpr lgetfile lgrep lgrepadd lhelpgrep llast llist lmake lmap lmapclear lnext lnewer lnfile lnoremap loadkeymap loadview lockmarks lockvar lolder lopen lprevious lpfile lrewind ltag lunmap luado luafile lvimgrep lvimgrepadd lwindow move mark make mapclear match menu menutranslate messages mkexrc mksession mkspell mkvimrc mkview mode mzscheme mzfile nbclose nbkey nbsart next nmap nmapclear nmenu nnoremap nnoremenu noautocmd noremap nohlsearch noreabbrev noremenu normal number nunmap nunmenu oldfiles open omap omapclear omenu only onoremap onoremenu options ounmap ounmenu ownsyntax print profdel profile promptfind promptrepl pclose pedit perl perldo pop popup ppop preserve previous psearch ptag ptNext ptfirst ptjump ptlast ptnext ptprevious ptrewind ptselect put pwd py3do py3file python pydo pyfile quit quitall qall read recover redo redir redraw redrawstatus registers resize retab return rewind right rightbelow ruby rubydo rubyfile rundo runtime rviminfo substitute sNext sandbox sargument sall saveas sbuffer sbNext sball sbfirst sblast sbmodified sbnext sbprevious sbrewind scriptnames scriptencoding scscope set setfiletype setglobal setlocal sfind sfirst shell simalt sign silent sleep slast smagic smapclear smenu snext sniff snomagic snoremap snoremenu sort source spelldump spellgood spellinfo spellrepall spellundo spellwrong split sprevious srewind stop stag startgreplace startreplace startinsert stopinsert stjump stselect sunhide sunmap sunmenu suspend sview swapname syntax syntime syncbind tNext tabNext tabclose tabedit tabfind tabfirst tablast tabmove tabnext tabonly tabprevious tabrewind tag tcl tcldo tclfile tearoff tfirst throw tjump tlast tmenu tnext topleft tprevious trewind tselect tunmenu undo undojoin undolist unabbreviate unhide unlet unlockvar unmap unmenu unsilent update vglobal version verbose vertical vimgrep vimgrepadd visual viusage view vmap vmapclear vmenu vnew vnoremap vnoremenu vsplit vunmap vunmenu write wNext wall while winsize wincmd winpos wnext wprevious wqall wsverb wundo wviminfo xit xall xmapclear xmap xmenu xnoremap xnoremenu xunmap xunmenu yank",built_in:"synIDtrans atan2 range matcharg did_filetype asin feedkeys xor argv complete_check add getwinposx getqflist getwinposy screencol clearmatches empty extend getcmdpos mzeval garbagecollect setreg ceil sqrt diff_hlID inputsecret get getfperm getpid filewritable shiftwidth max sinh isdirectory synID system inputrestore winline atan visualmode inputlist tabpagewinnr round getregtype mapcheck hasmapto histdel argidx findfile sha256 exists toupper getcmdline taglist string getmatches bufnr strftime winwidth bufexists strtrans tabpagebuflist setcmdpos remote_read printf setloclist getpos getline bufwinnr float2nr len getcmdtype diff_filler luaeval resolve libcallnr foldclosedend reverse filter has_key bufname str2float strlen setline getcharmod setbufvar index searchpos shellescape undofile foldclosed setqflist buflisted strchars str2nr virtcol floor remove undotree remote_expr winheight gettabwinvar reltime cursor tabpagenr finddir localtime acos getloclist search tanh matchend rename gettabvar strdisplaywidth type abs py3eval setwinvar tolower wildmenumode log10 spellsuggest bufloaded synconcealed nextnonblank server2client complete settabwinvar executable input wincol setmatches getftype hlID inputsave searchpair or screenrow line settabvar histadd deepcopy strpart remote_peek and eval getftime submatch screenchar winsaveview matchadd mkdir screenattr getfontname libcall reltimestr getfsize winnr invert pow getbufline byte2line soundfold repeat fnameescape tagfiles sin strwidth spellbadword trunc maparg log lispindent hostname setpos globpath remote_foreground getchar synIDattr fnamemodify cscope_connection stridx winbufnr indent min complete_add nr2char searchpairpos inputdialog values matchlist items hlexists strridx browsedir expand fmod pathshorten line2byte argc count getwinvar glob foldtextresult getreg foreground cosh matchdelete has char2nr simplify histget searchdecl iconv winrestcmd pumvisible writefile foldlevel haslocaldir keys cos matchstr foldtext histnr tan tempname getcwd byteidx getbufvar islocked escape eventhandler remote_send serverlist winrestview synstack pyeval prevnonblank readfile cindent filereadable changenr exp"},illegal:/;/,contains:[e.NUMBER_MODE,{className:"string",begin:"'",end:"'",illegal:"\\n"},{className:"string",begin:/"(\\"|\n\\|[^"\n])*"/},e.COMMENT('"',"$"),{className:"variable",begin:/[bwtglsav]:[\w\d_]+/},{begin:[/\b(?:function|function!)/,/\s+/,e.IDENT_RE],className:{1:"keyword",3:"title"},end:"$",relevance:0,contains:[{className:"params",begin:"\\(",end:"\\)"}]},{className:"symbol",begin:/<[\w-]+>/}]}}return Cm=n,Cm}var Rm,aC;function LWe(){if(aC)return Rm;aC=1;function n(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const i=e.COMMENT(/;;/,/$/),s=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],r={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},o={className:"variable",begin:/\$[\w_]+/},a={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},l={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},d={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},c={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:s},contains:[i,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},o,a,r,e.QUOTE_STRING_MODE,d,c,l]}}return Rm=n,Rm}var Am,lC;function PWe(){if(lC)return Am;lC=1;function n(e){const t=e.regex,i=/[a-zA-Z]\w*/,s=["as","break","class","construct","continue","else","for","foreign","if","import","in","is","return","static","var","while"],r=["true","false","null"],o=["this","super"],a=["Bool","Class","Fiber","Fn","List","Map","Null","Num","Object","Range","Sequence","String","System"],l=["-","~",/\*/,"%",/\.\.\./,/\.\./,/\+/,"<<",">>",">=","<=","<",">",/\^/,/!=/,/!/,/\bis\b/,"==","&&","&",/\|\|/,/\|/,/\?:/,"="],d={relevance:0,match:t.concat(/\b(?!(if|while|for|else|super)\b)/,i,/(?=\s*[({])/),className:"title.function"},c={match:t.concat(t.either(t.concat(/\b(?!(if|while|for|else|super)\b)/,i),t.either(...l)),/(?=\s*\([^)]+\)\s*\{)/),className:"title.function",starts:{contains:[{begin:/\(/,end:/\)/,contains:[{relevance:0,scope:"params",match:i}]}]}},_={variants:[{match:[/class\s+/,i,/\s+is\s+/,i]},{match:[/class\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:s},f={relevance:0,match:t.either(...l),className:"operator"},m={className:"string",begin:/"""/,end:/"""/},h={className:"property",begin:t.concat(/\./,t.lookahead(i)),end:i,excludeBegin:!0,relevance:0},E={relevance:0,match:t.concat(/\b_/,i),scope:"variable"},b={relevance:0,match:/\b[A-Z]+[a-z]+([A-Z]+[a-z]+)*/,scope:"title.class",keywords:{_:a}},g=e.C_NUMBER_MODE,v={match:[i,/\s*/,/=/,/\s*/,/\(/,i,/\)\s*\{/],scope:{1:"title.function",3:"operator",6:"params"}},y=e.COMMENT(/\/\*\*/,/\*\//,{contains:[{match:/@[a-z]+/,scope:"doctag"},"self"]}),T={scope:"subst",begin:/%\(/,end:/\)/,contains:[g,b,d,E,f]},C={scope:"string",begin:/"/,end:/"/,contains:[T,{scope:"char.escape",variants:[{match:/\\\\|\\["0%abefnrtv]/},{match:/\\x[0-9A-F]{2}/},{match:/\\u[0-9A-F]{4}/},{match:/\\U[0-9A-F]{8}/}]}]};T.contains.push(C);const x=[...s,...o,...r],O={relevance:0,match:t.concat("\\b(?!",x.join("|"),"\\b)",/[a-zA-Z_]\w*(?:[?!]|\b)/),className:"variable"};return{name:"Wren",keywords:{keyword:s,"variable.language":o,literal:r},contains:[{scope:"comment",variants:[{begin:[/#!?/,/[A-Za-z_]+(?=\()/],beginScope:{},keywords:{literal:r},contains:[],end:/\)/},{begin:[/#!?/,/[A-Za-z_]+/],beginScope:{},end:/$/}]},g,C,m,y,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,_,v,c,d,f,E,h,O]}}return Am=n,Am}var wm,cC;function UWe(){if(cC)return wm;cC=1;function n(e){return{name:"Intel x86 Assembly",case_insensitive:!0,keywords:{$pattern:"[.%]?"+e.IDENT_RE,keyword:"lock rep repe repz repne repnz xaquire xrelease bnd nobnd aaa aad aam aas adc add and arpl bb0_reset bb1_reset bound bsf bsr bswap bt btc btr bts call cbw cdq cdqe clc cld cli clts cmc cmp cmpsb cmpsd cmpsq cmpsw cmpxchg cmpxchg486 cmpxchg8b cmpxchg16b cpuid cpu_read cpu_write cqo cwd cwde daa das dec div dmint emms enter equ f2xm1 fabs fadd faddp fbld fbstp fchs fclex fcmovb fcmovbe fcmove fcmovnb fcmovnbe fcmovne fcmovnu fcmovu fcom fcomi fcomip fcomp fcompp fcos fdecstp fdisi fdiv fdivp fdivr fdivrp femms feni ffree ffreep fiadd ficom ficomp fidiv fidivr fild fimul fincstp finit fist fistp fisttp fisub fisubr fld fld1 fldcw fldenv fldl2e fldl2t fldlg2 fldln2 fldpi fldz fmul fmulp fnclex fndisi fneni fninit fnop fnsave fnstcw fnstenv fnstsw fpatan fprem fprem1 fptan frndint frstor fsave fscale fsetpm fsin fsincos fsqrt fst fstcw fstenv fstp fstsw fsub fsubp fsubr fsubrp ftst fucom fucomi fucomip fucomp fucompp fxam fxch fxtract fyl2x fyl2xp1 hlt ibts icebp idiv imul in inc incbin insb insd insw int int01 int1 int03 int3 into invd invpcid invlpg invlpga iret iretd iretq iretw jcxz jecxz jrcxz jmp jmpe lahf lar lds lea leave les lfence lfs lgdt lgs lidt lldt lmsw loadall loadall286 lodsb lodsd lodsq lodsw loop loope loopne loopnz loopz lsl lss ltr mfence monitor mov movd movq movsb movsd movsq movsw movsx movsxd movzx mul mwait neg nop not or out outsb outsd outsw packssdw packsswb packuswb paddb paddd paddsb paddsiw paddsw paddusb paddusw paddw pand pandn pause paveb pavgusb pcmpeqb pcmpeqd pcmpeqw pcmpgtb pcmpgtd pcmpgtw pdistib pf2id pfacc pfadd pfcmpeq pfcmpge pfcmpgt pfmax pfmin pfmul pfrcp pfrcpit1 pfrcpit2 pfrsqit1 pfrsqrt pfsub pfsubr pi2fd pmachriw pmaddwd pmagw pmulhriw pmulhrwa pmulhrwc pmulhw pmullw pmvgezb pmvlzb pmvnzb pmvzb pop popa popad popaw popf popfd popfq popfw por prefetch prefetchw pslld psllq psllw psrad psraw psrld psrlq psrlw psubb psubd psubsb psubsiw psubsw psubusb psubusw psubw punpckhbw punpckhdq punpckhwd punpcklbw punpckldq punpcklwd push pusha pushad pushaw pushf pushfd pushfq pushfw pxor rcl rcr rdshr rdmsr rdpmc rdtsc rdtscp ret retf retn rol ror rdm rsdc rsldt rsm rsts sahf sal salc sar sbb scasb scasd scasq scasw sfence sgdt shl shld shr shrd sidt sldt skinit smi smint smintold smsw stc std sti stosb stosd stosq stosw str sub svdc svldt svts swapgs syscall sysenter sysexit sysret test ud0 ud1 ud2b ud2 ud2a umov verr verw fwait wbinvd wrshr wrmsr xadd xbts xchg xlatb xlat xor cmove cmovz cmovne cmovnz cmova cmovnbe cmovae cmovnb cmovb cmovnae cmovbe cmovna cmovg cmovnle cmovge cmovnl cmovl cmovnge cmovle cmovng cmovc cmovnc cmovo cmovno cmovs cmovns cmovp cmovpe cmovnp cmovpo je jz jne jnz ja jnbe jae jnb jb jnae jbe jna jg jnle jge jnl jl jnge jle jng jc jnc jo jno js jns jpo jnp jpe jp sete setz setne setnz seta setnbe setae setnb setnc setb setnae setcset setbe setna setg setnle setge setnl setl setnge setle setng sets setns seto setno setpe setp setpo setnp addps addss andnps andps cmpeqps cmpeqss cmpleps cmpless cmpltps cmpltss cmpneqps cmpneqss cmpnleps cmpnless cmpnltps cmpnltss cmpordps cmpordss cmpunordps cmpunordss cmpps cmpss comiss cvtpi2ps cvtps2pi cvtsi2ss cvtss2si cvttps2pi cvttss2si divps divss ldmxcsr maxps maxss minps minss movaps movhps movlhps movlps movhlps movmskps movntps movss movups mulps mulss orps rcpps rcpss rsqrtps rsqrtss shufps sqrtps sqrtss stmxcsr subps subss ucomiss unpckhps unpcklps xorps fxrstor fxrstor64 fxsave fxsave64 xgetbv xsetbv xsave xsave64 xsaveopt xsaveopt64 xrstor xrstor64 prefetchnta prefetcht0 prefetcht1 prefetcht2 maskmovq movntq pavgb pavgw pextrw pinsrw pmaxsw pmaxub pminsw pminub pmovmskb pmulhuw psadbw pshufw pf2iw pfnacc pfpnacc pi2fw pswapd maskmovdqu clflush movntdq movnti movntpd movdqa movdqu movdq2q movq2dq paddq pmuludq pshufd pshufhw pshuflw pslldq psrldq psubq punpckhqdq punpcklqdq addpd addsd andnpd andpd cmpeqpd cmpeqsd cmplepd cmplesd cmpltpd cmpltsd cmpneqpd cmpneqsd cmpnlepd cmpnlesd cmpnltpd cmpnltsd cmpordpd cmpordsd cmpunordpd cmpunordsd cmppd comisd cvtdq2pd cvtdq2ps cvtpd2dq cvtpd2pi cvtpd2ps cvtpi2pd cvtps2dq cvtps2pd cvtsd2si cvtsd2ss cvtsi2sd cvtss2sd cvttpd2pi cvttpd2dq cvttps2dq cvttsd2si divpd divsd maxpd maxsd minpd minsd movapd movhpd movlpd movmskpd movupd mulpd mulsd orpd shufpd sqrtpd sqrtsd subpd subsd ucomisd unpckhpd unpcklpd xorpd addsubpd addsubps haddpd haddps hsubpd hsubps lddqu movddup movshdup movsldup clgi stgi vmcall vmclear vmfunc vmlaunch vmload vmmcall vmptrld vmptrst vmread vmresume vmrun vmsave vmwrite vmxoff vmxon invept invvpid pabsb pabsw pabsd palignr phaddw phaddd phaddsw phsubw phsubd phsubsw pmaddubsw pmulhrsw pshufb psignb psignw psignd extrq insertq movntsd movntss lzcnt blendpd blendps blendvpd blendvps dppd dpps extractps insertps movntdqa mpsadbw packusdw pblendvb pblendw pcmpeqq pextrb pextrd pextrq phminposuw pinsrb pinsrd pinsrq pmaxsb pmaxsd pmaxud pmaxuw pminsb pminsd pminud pminuw pmovsxbw pmovsxbd pmovsxbq pmovsxwd pmovsxwq pmovsxdq pmovzxbw pmovzxbd pmovzxbq pmovzxwd pmovzxwq pmovzxdq pmuldq pmulld ptest roundpd roundps roundsd roundss crc32 pcmpestri pcmpestrm pcmpistri pcmpistrm pcmpgtq popcnt getsec pfrcpv pfrsqrtv movbe aesenc aesenclast aesdec aesdeclast aesimc aeskeygenassist vaesenc vaesenclast vaesdec vaesdeclast vaesimc vaeskeygenassist vaddpd vaddps vaddsd vaddss vaddsubpd vaddsubps vandpd vandps vandnpd vandnps vblendpd vblendps vblendvpd vblendvps vbroadcastss vbroadcastsd vbroadcastf128 vcmpeq_ospd vcmpeqpd vcmplt_ospd vcmpltpd vcmple_ospd vcmplepd vcmpunord_qpd vcmpunordpd vcmpneq_uqpd vcmpneqpd vcmpnlt_uspd vcmpnltpd vcmpnle_uspd vcmpnlepd vcmpord_qpd vcmpordpd vcmpeq_uqpd vcmpnge_uspd vcmpngepd vcmpngt_uspd vcmpngtpd vcmpfalse_oqpd vcmpfalsepd vcmpneq_oqpd vcmpge_ospd vcmpgepd vcmpgt_ospd vcmpgtpd vcmptrue_uqpd vcmptruepd vcmplt_oqpd vcmple_oqpd vcmpunord_spd vcmpneq_uspd vcmpnlt_uqpd vcmpnle_uqpd vcmpord_spd vcmpeq_uspd vcmpnge_uqpd vcmpngt_uqpd vcmpfalse_ospd vcmpneq_ospd vcmpge_oqpd vcmpgt_oqpd vcmptrue_uspd vcmppd vcmpeq_osps vcmpeqps vcmplt_osps vcmpltps vcmple_osps vcmpleps vcmpunord_qps vcmpunordps vcmpneq_uqps vcmpneqps vcmpnlt_usps vcmpnltps vcmpnle_usps vcmpnleps vcmpord_qps vcmpordps vcmpeq_uqps vcmpnge_usps vcmpngeps vcmpngt_usps vcmpngtps vcmpfalse_oqps vcmpfalseps vcmpneq_oqps vcmpge_osps vcmpgeps vcmpgt_osps vcmpgtps vcmptrue_uqps vcmptrueps vcmplt_oqps vcmple_oqps vcmpunord_sps vcmpneq_usps vcmpnlt_uqps vcmpnle_uqps vcmpord_sps vcmpeq_usps vcmpnge_uqps vcmpngt_uqps vcmpfalse_osps vcmpneq_osps vcmpge_oqps vcmpgt_oqps vcmptrue_usps vcmpps vcmpeq_ossd vcmpeqsd vcmplt_ossd vcmpltsd vcmple_ossd vcmplesd vcmpunord_qsd vcmpunordsd vcmpneq_uqsd vcmpneqsd vcmpnlt_ussd vcmpnltsd vcmpnle_ussd vcmpnlesd vcmpord_qsd vcmpordsd vcmpeq_uqsd vcmpnge_ussd vcmpngesd vcmpngt_ussd vcmpngtsd vcmpfalse_oqsd vcmpfalsesd vcmpneq_oqsd vcmpge_ossd vcmpgesd vcmpgt_ossd vcmpgtsd vcmptrue_uqsd vcmptruesd vcmplt_oqsd vcmple_oqsd vcmpunord_ssd vcmpneq_ussd vcmpnlt_uqsd vcmpnle_uqsd vcmpord_ssd vcmpeq_ussd vcmpnge_uqsd vcmpngt_uqsd vcmpfalse_ossd vcmpneq_ossd vcmpge_oqsd vcmpgt_oqsd vcmptrue_ussd vcmpsd vcmpeq_osss vcmpeqss vcmplt_osss vcmpltss vcmple_osss vcmpless vcmpunord_qss vcmpunordss vcmpneq_uqss vcmpneqss vcmpnlt_usss vcmpnltss vcmpnle_usss vcmpnless vcmpord_qss vcmpordss vcmpeq_uqss vcmpnge_usss vcmpngess vcmpngt_usss vcmpngtss vcmpfalse_oqss vcmpfalsess vcmpneq_oqss vcmpge_osss vcmpgess vcmpgt_osss vcmpgtss vcmptrue_uqss vcmptruess vcmplt_oqss vcmple_oqss vcmpunord_sss vcmpneq_usss vcmpnlt_uqss vcmpnle_uqss vcmpord_sss vcmpeq_usss vcmpnge_uqss vcmpngt_uqss vcmpfalse_osss vcmpneq_osss vcmpge_oqss vcmpgt_oqss vcmptrue_usss vcmpss vcomisd vcomiss vcvtdq2pd vcvtdq2ps vcvtpd2dq vcvtpd2ps vcvtps2dq vcvtps2pd vcvtsd2si vcvtsd2ss vcvtsi2sd vcvtsi2ss vcvtss2sd vcvtss2si vcvttpd2dq vcvttps2dq vcvttsd2si vcvttss2si vdivpd vdivps vdivsd vdivss vdppd vdpps vextractf128 vextractps vhaddpd vhaddps vhsubpd vhsubps vinsertf128 vinsertps vlddqu vldqqu vldmxcsr vmaskmovdqu vmaskmovps vmaskmovpd vmaxpd vmaxps vmaxsd vmaxss vminpd vminps vminsd vminss vmovapd vmovaps vmovd vmovq vmovddup vmovdqa vmovqqa vmovdqu vmovqqu vmovhlps vmovhpd vmovhps vmovlhps vmovlpd vmovlps vmovmskpd vmovmskps vmovntdq vmovntqq vmovntdqa vmovntpd vmovntps vmovsd vmovshdup vmovsldup vmovss vmovupd vmovups vmpsadbw vmulpd vmulps vmulsd vmulss vorpd vorps vpabsb vpabsw vpabsd vpacksswb vpackssdw vpackuswb vpackusdw vpaddb vpaddw vpaddd vpaddq vpaddsb vpaddsw vpaddusb vpaddusw vpalignr vpand vpandn vpavgb vpavgw vpblendvb vpblendw vpcmpestri vpcmpestrm vpcmpistri vpcmpistrm vpcmpeqb vpcmpeqw vpcmpeqd vpcmpeqq vpcmpgtb vpcmpgtw vpcmpgtd vpcmpgtq vpermilpd vpermilps vperm2f128 vpextrb vpextrw vpextrd vpextrq vphaddw vphaddd vphaddsw vphminposuw vphsubw vphsubd vphsubsw vpinsrb vpinsrw vpinsrd vpinsrq vpmaddwd vpmaddubsw vpmaxsb vpmaxsw vpmaxsd vpmaxub vpmaxuw vpmaxud vpminsb vpminsw vpminsd vpminub vpminuw vpminud vpmovmskb vpmovsxbw vpmovsxbd vpmovsxbq vpmovsxwd vpmovsxwq vpmovsxdq vpmovzxbw vpmovzxbd vpmovzxbq vpmovzxwd vpmovzxwq vpmovzxdq vpmulhuw vpmulhrsw vpmulhw vpmullw vpmulld vpmuludq vpmuldq vpor vpsadbw vpshufb vpshufd vpshufhw vpshuflw vpsignb vpsignw vpsignd vpslldq vpsrldq vpsllw vpslld vpsllq vpsraw vpsrad vpsrlw vpsrld vpsrlq vptest vpsubb vpsubw vpsubd vpsubq vpsubsb vpsubsw vpsubusb vpsubusw vpunpckhbw vpunpckhwd vpunpckhdq vpunpckhqdq vpunpcklbw vpunpcklwd vpunpckldq vpunpcklqdq vpxor vrcpps vrcpss vrsqrtps vrsqrtss vroundpd vroundps vroundsd vroundss vshufpd vshufps vsqrtpd vsqrtps vsqrtsd vsqrtss vstmxcsr vsubpd vsubps vsubsd vsubss vtestps vtestpd vucomisd vucomiss vunpckhpd vunpckhps vunpcklpd vunpcklps vxorpd vxorps vzeroall vzeroupper pclmullqlqdq pclmulhqlqdq pclmullqhqdq pclmulhqhqdq pclmulqdq vpclmullqlqdq vpclmulhqlqdq vpclmullqhqdq vpclmulhqhqdq vpclmulqdq vfmadd132ps vfmadd132pd vfmadd312ps vfmadd312pd vfmadd213ps vfmadd213pd vfmadd123ps vfmadd123pd vfmadd231ps vfmadd231pd vfmadd321ps vfmadd321pd vfmaddsub132ps vfmaddsub132pd vfmaddsub312ps vfmaddsub312pd vfmaddsub213ps vfmaddsub213pd vfmaddsub123ps vfmaddsub123pd vfmaddsub231ps vfmaddsub231pd vfmaddsub321ps vfmaddsub321pd vfmsub132ps vfmsub132pd vfmsub312ps vfmsub312pd vfmsub213ps vfmsub213pd vfmsub123ps vfmsub123pd vfmsub231ps vfmsub231pd vfmsub321ps vfmsub321pd vfmsubadd132ps vfmsubadd132pd vfmsubadd312ps vfmsubadd312pd vfmsubadd213ps vfmsubadd213pd vfmsubadd123ps vfmsubadd123pd vfmsubadd231ps vfmsubadd231pd vfmsubadd321ps vfmsubadd321pd vfnmadd132ps vfnmadd132pd vfnmadd312ps vfnmadd312pd vfnmadd213ps vfnmadd213pd vfnmadd123ps vfnmadd123pd vfnmadd231ps vfnmadd231pd vfnmadd321ps vfnmadd321pd vfnmsub132ps vfnmsub132pd vfnmsub312ps vfnmsub312pd vfnmsub213ps vfnmsub213pd vfnmsub123ps vfnmsub123pd vfnmsub231ps vfnmsub231pd vfnmsub321ps vfnmsub321pd vfmadd132ss vfmadd132sd vfmadd312ss vfmadd312sd vfmadd213ss vfmadd213sd vfmadd123ss vfmadd123sd vfmadd231ss vfmadd231sd vfmadd321ss vfmadd321sd vfmsub132ss vfmsub132sd vfmsub312ss vfmsub312sd vfmsub213ss vfmsub213sd vfmsub123ss vfmsub123sd vfmsub231ss vfmsub231sd vfmsub321ss vfmsub321sd vfnmadd132ss vfnmadd132sd vfnmadd312ss vfnmadd312sd vfnmadd213ss vfnmadd213sd vfnmadd123ss vfnmadd123sd vfnmadd231ss vfnmadd231sd vfnmadd321ss vfnmadd321sd vfnmsub132ss vfnmsub132sd vfnmsub312ss vfnmsub312sd vfnmsub213ss vfnmsub213sd vfnmsub123ss vfnmsub123sd vfnmsub231ss vfnmsub231sd vfnmsub321ss vfnmsub321sd rdfsbase rdgsbase rdrand wrfsbase wrgsbase vcvtph2ps vcvtps2ph adcx adox rdseed clac stac xstore xcryptecb xcryptcbc xcryptctr xcryptcfb xcryptofb montmul xsha1 xsha256 llwpcb slwpcb lwpval lwpins vfmaddpd vfmaddps vfmaddsd vfmaddss vfmaddsubpd vfmaddsubps vfmsubaddpd vfmsubaddps vfmsubpd vfmsubps vfmsubsd vfmsubss vfnmaddpd vfnmaddps vfnmaddsd vfnmaddss vfnmsubpd vfnmsubps vfnmsubsd vfnmsubss vfrczpd vfrczps vfrczsd vfrczss vpcmov vpcomb vpcomd vpcomq vpcomub vpcomud vpcomuq vpcomuw vpcomw vphaddbd vphaddbq vphaddbw vphadddq vphaddubd vphaddubq vphaddubw vphaddudq vphadduwd vphadduwq vphaddwd vphaddwq vphsubbw vphsubdq vphsubwd vpmacsdd vpmacsdqh vpmacsdql vpmacssdd vpmacssdqh vpmacssdql vpmacsswd vpmacssww vpmacswd vpmacsww vpmadcsswd vpmadcswd vpperm vprotb vprotd vprotq vprotw vpshab vpshad vpshaq vpshaw vpshlb vpshld vpshlq vpshlw vbroadcasti128 vpblendd vpbroadcastb vpbroadcastw vpbroadcastd vpbroadcastq vpermd vpermpd vpermps vpermq vperm2i128 vextracti128 vinserti128 vpmaskmovd vpmaskmovq vpsllvd vpsllvq vpsravd vpsrlvd vpsrlvq vgatherdpd vgatherqpd vgatherdps vgatherqps vpgatherdd vpgatherqd vpgatherdq vpgatherqq xabort xbegin xend xtest andn bextr blci blcic blsi blsic blcfill blsfill blcmsk blsmsk blsr blcs bzhi mulx pdep pext rorx sarx shlx shrx tzcnt tzmsk t1mskc valignd valignq vblendmpd vblendmps vbroadcastf32x4 vbroadcastf64x4 vbroadcasti32x4 vbroadcasti64x4 vcompresspd vcompressps vcvtpd2udq vcvtps2udq vcvtsd2usi vcvtss2usi vcvttpd2udq vcvttps2udq vcvttsd2usi vcvttss2usi vcvtudq2pd vcvtudq2ps vcvtusi2sd vcvtusi2ss vexpandpd vexpandps vextractf32x4 vextractf64x4 vextracti32x4 vextracti64x4 vfixupimmpd vfixupimmps vfixupimmsd vfixupimmss vgetexppd vgetexpps vgetexpsd vgetexpss vgetmantpd vgetmantps vgetmantsd vgetmantss vinsertf32x4 vinsertf64x4 vinserti32x4 vinserti64x4 vmovdqa32 vmovdqa64 vmovdqu32 vmovdqu64 vpabsq vpandd vpandnd vpandnq vpandq vpblendmd vpblendmq vpcmpltd vpcmpled vpcmpneqd vpcmpnltd vpcmpnled vpcmpd vpcmpltq vpcmpleq vpcmpneqq vpcmpnltq vpcmpnleq vpcmpq vpcmpequd vpcmpltud vpcmpleud vpcmpnequd vpcmpnltud vpcmpnleud vpcmpud vpcmpequq vpcmpltuq vpcmpleuq vpcmpnequq vpcmpnltuq vpcmpnleuq vpcmpuq vpcompressd vpcompressq vpermi2d vpermi2pd vpermi2ps vpermi2q vpermt2d vpermt2pd vpermt2ps vpermt2q vpexpandd vpexpandq vpmaxsq vpmaxuq vpminsq vpminuq vpmovdb vpmovdw vpmovqb vpmovqd vpmovqw vpmovsdb vpmovsdw vpmovsqb vpmovsqd vpmovsqw vpmovusdb vpmovusdw vpmovusqb vpmovusqd vpmovusqw vpord vporq vprold vprolq vprolvd vprolvq vprord vprorq vprorvd vprorvq vpscatterdd vpscatterdq vpscatterqd vpscatterqq vpsraq vpsravq vpternlogd vpternlogq vptestmd vptestmq vptestnmd vptestnmq vpxord vpxorq vrcp14pd vrcp14ps vrcp14sd vrcp14ss vrndscalepd vrndscaleps vrndscalesd vrndscaless vrsqrt14pd vrsqrt14ps vrsqrt14sd vrsqrt14ss vscalefpd vscalefps vscalefsd vscalefss vscatterdpd vscatterdps vscatterqpd vscatterqps vshuff32x4 vshuff64x2 vshufi32x4 vshufi64x2 kandnw kandw kmovw knotw kortestw korw kshiftlw kshiftrw kunpckbw kxnorw kxorw vpbroadcastmb2q vpbroadcastmw2d vpconflictd vpconflictq vplzcntd vplzcntq vexp2pd vexp2ps vrcp28pd vrcp28ps vrcp28sd vrcp28ss vrsqrt28pd vrsqrt28ps vrsqrt28sd vrsqrt28ss vgatherpf0dpd vgatherpf0dps vgatherpf0qpd vgatherpf0qps vgatherpf1dpd vgatherpf1dps vgatherpf1qpd vgatherpf1qps vscatterpf0dpd vscatterpf0dps vscatterpf0qpd vscatterpf0qps vscatterpf1dpd vscatterpf1dps vscatterpf1qpd vscatterpf1qps prefetchwt1 bndmk bndcl bndcu bndcn bndmov bndldx bndstx sha1rnds4 sha1nexte sha1msg1 sha1msg2 sha256rnds2 sha256msg1 sha256msg2 hint_nop0 hint_nop1 hint_nop2 hint_nop3 hint_nop4 hint_nop5 hint_nop6 hint_nop7 hint_nop8 hint_nop9 hint_nop10 hint_nop11 hint_nop12 hint_nop13 hint_nop14 hint_nop15 hint_nop16 hint_nop17 hint_nop18 hint_nop19 hint_nop20 hint_nop21 hint_nop22 hint_nop23 hint_nop24 hint_nop25 hint_nop26 hint_nop27 hint_nop28 hint_nop29 hint_nop30 hint_nop31 hint_nop32 hint_nop33 hint_nop34 hint_nop35 hint_nop36 hint_nop37 hint_nop38 hint_nop39 hint_nop40 hint_nop41 hint_nop42 hint_nop43 hint_nop44 hint_nop45 hint_nop46 hint_nop47 hint_nop48 hint_nop49 hint_nop50 hint_nop51 hint_nop52 hint_nop53 hint_nop54 hint_nop55 hint_nop56 hint_nop57 hint_nop58 hint_nop59 hint_nop60 hint_nop61 hint_nop62 hint_nop63",built_in:"ip eip rip al ah bl bh cl ch dl dh sil dil bpl spl r8b r9b r10b r11b r12b r13b r14b r15b ax bx cx dx si di bp sp r8w r9w r10w r11w r12w r13w r14w r15w eax ebx ecx edx esi edi ebp esp eip r8d r9d r10d r11d r12d r13d r14d r15d rax rbx rcx rdx rsi rdi rbp rsp r8 r9 r10 r11 r12 r13 r14 r15 cs ds es fs gs ss st st0 st1 st2 st3 st4 st5 st6 st7 mm0 mm1 mm2 mm3 mm4 mm5 mm6 mm7 xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8 xmm9 xmm10 xmm11 xmm12 xmm13 xmm14 xmm15 xmm16 xmm17 xmm18 xmm19 xmm20 xmm21 xmm22 xmm23 xmm24 xmm25 xmm26 xmm27 xmm28 xmm29 xmm30 xmm31 ymm0 ymm1 ymm2 ymm3 ymm4 ymm5 ymm6 ymm7 ymm8 ymm9 ymm10 ymm11 ymm12 ymm13 ymm14 ymm15 ymm16 ymm17 ymm18 ymm19 ymm20 ymm21 ymm22 ymm23 ymm24 ymm25 ymm26 ymm27 ymm28 ymm29 ymm30 ymm31 zmm0 zmm1 zmm2 zmm3 zmm4 zmm5 zmm6 zmm7 zmm8 zmm9 zmm10 zmm11 zmm12 zmm13 zmm14 zmm15 zmm16 zmm17 zmm18 zmm19 zmm20 zmm21 zmm22 zmm23 zmm24 zmm25 zmm26 zmm27 zmm28 zmm29 zmm30 zmm31 k0 k1 k2 k3 k4 k5 k6 k7 bnd0 bnd1 bnd2 bnd3 cr0 cr1 cr2 cr3 cr4 cr8 dr0 dr1 dr2 dr3 dr8 tr3 tr4 tr5 tr6 tr7 r0 r1 r2 r3 r4 r5 r6 r7 r0b r1b r2b r3b r4b r5b r6b r7b r0w r1w r2w r3w r4w r5w r6w r7w r0d r1d r2d r3d r4d r5d r6d r7d r0h r1h r2h r3h r0l r1l r2l r3l r4l r5l r6l r7l r8l r9l r10l r11l r12l r13l r14l r15l db dw dd dq dt ddq do dy dz resb resw resd resq rest resdq reso resy resz incbin equ times byte word dword qword nosplit rel abs seg wrt strict near far a32 ptr",meta:"%define %xdefine %+ %undef %defstr %deftok %assign %strcat %strlen %substr %rotate %elif %else %endif %if %ifmacro %ifctx %ifidn %ifidni %ifid %ifnum %ifstr %iftoken %ifempty %ifenv %error %warning %fatal %rep %endrep %include %push %pop %repl %pathsearch %depend %use %arg %stacksize %local %line %comment %endcomment .nolist __FILE__ __LINE__ __SECT__ __BITS__ __OUTPUT_FORMAT__ __DATE__ __TIME__ __DATE_NUM__ __TIME_NUM__ __UTC_DATE__ __UTC_TIME__ __UTC_DATE_NUM__ __UTC_TIME_NUM__ __PASS__ struc endstruc istruc at iend align alignb sectalign daz nodaz up down zero default option assume public bits use16 use32 use64 default section segment absolute extern global common cpu float __utf16__ __utf16le__ __utf16be__ __utf32__ __utf32le__ __utf32be__ __float8__ __float16__ __float32__ __float64__ __float80m__ __float80e__ __float128l__ __float128h__ __Infinity__ __QNaN__ __SNaN__ Inf NaN QNaN SNaN float8 float16 float32 float64 float80m float80e float128l float128h __FLOAT_DAZ__ __FLOAT_ROUND__ __FLOAT__"},contains:[e.COMMENT(";","$",{relevance:0}),{className:"number",variants:[{begin:"\\b(?:([0-9][0-9_]*)?\\.[0-9_]*(?:[eE][+-]?[0-9_]+)?|(0[Xx])?[0-9][0-9_]*(\\.[0-9_]*)?(?:[pP](?:[+-]?[0-9_]+)?)?)\\b",relevance:0},{begin:"\\$[0-9][0-9A-Fa-f]*",relevance:0},{begin:"\\b(?:[0-9A-Fa-f][0-9A-Fa-f_]*[Hh]|[0-9][0-9_]*[DdTt]?|[0-7][0-7_]*[QqOo]|[0-1][0-1_]*[BbYy])\\b"},{begin:"\\b(?:0[Xx][0-9A-Fa-f_]+|0[DdTt][0-9_]+|0[QqOo][0-7_]+|0[BbYy][0-1_]+)\\b"}]},e.QUOTE_STRING_MODE,{className:"string",variants:[{begin:"'",end:"[^\\\\]'"},{begin:"`",end:"[^\\\\]`"}],relevance:0},{className:"symbol",variants:[{begin:"^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)"},{begin:"^\\s*%%[A-Za-z0-9_$#@~.?]*:"}],relevance:0},{className:"subst",begin:"%[0-9]+",relevance:0},{className:"subst",begin:"%!S+",relevance:0},{className:"meta",begin:/^\s*\.[\w_-]+/}]}}return wm=n,wm}var Nm,dC;function FWe(){if(dC)return Nm;dC=1;function n(e){const t=["if","then","else","do","while","until","for","loop","import","with","is","as","where","when","by","data","constant","integer","real","text","name","boolean","symbol","infix","prefix","postfix","block","tree"],i=["in","mod","rem","and","or","xor","not","abs","sign","floor","ceil","sqrt","sin","cos","tan","asin","acos","atan","exp","expm1","log","log2","log10","log1p","pi","at","text_length","text_range","text_find","text_replace","contains","page","slide","basic_slide","title_slide","title","subtitle","fade_in","fade_out","fade_at","clear_color","color","line_color","line_width","texture_wrap","texture_transform","texture","scale_?x","scale_?y","scale_?z?","translate_?x","translate_?y","translate_?z?","rotate_?x","rotate_?y","rotate_?z?","rectangle","circle","ellipse","sphere","path","line_to","move_to","quad_to","curve_to","theme","background","contents","locally","time","mouse_?x","mouse_?y","mouse_buttons"],s=["ObjectLoader","Animate","MovieCredits","Slides","Filters","Shading","Materials","LensFlare","Mapping","VLCAudioVideo","StereoDecoder","PointCloud","NetworkAccess","RemoteControl","RegExp","ChromaKey","Snowfall","NodeJS","Speech","Charts"],o={$pattern:/[a-zA-Z][a-zA-Z0-9_?]*/,keyword:t,literal:["true","false","nil"],built_in:i.concat(s)},a={className:"string",begin:'"',end:'"',illegal:"\\n"},l={className:"string",begin:"'",end:"'",illegal:"\\n"},d={className:"string",begin:"<<",end:">>"},c={className:"number",begin:"[0-9]+#[0-9A-Z_]+(\\.[0-9-A-Z_]+)?#?([Ee][+-]?[0-9]+)?"},_={beginKeywords:"import",end:"$",keywords:o,contains:[a]},f={className:"function",begin:/[a-z][^\n]*->/,returnBegin:!0,end:/->/,contains:[e.inherit(e.TITLE_MODE,{starts:{endsWithParent:!0,keywords:o}})]};return{name:"XL",aliases:["tao"],keywords:o,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,a,l,d,f,_,c,e.NUMBER_MODE]}}return Nm=n,Nm}var Om,uC;function BWe(){if(uC)return Om;uC=1;function n(e){return{name:"XQuery",aliases:["xpath","xq","xqm"],case_insensitive:!1,illegal:/(proc)|(abstract)|(extends)|(until)|(#)/,keywords:{$pattern:/[a-zA-Z$][a-zA-Z0-9_:-]*/,keyword:["module","schema","namespace","boundary-space","preserve","no-preserve","strip","default","collation","base-uri","ordering","context","decimal-format","decimal-separator","copy-namespaces","empty-sequence","except","exponent-separator","external","grouping-separator","inherit","no-inherit","lax","minus-sign","per-mille","percent","schema-attribute","schema-element","strict","unordered","zero-digit","declare","import","option","function","validate","variable","for","at","in","let","where","order","group","by","return","if","then","else","tumbling","sliding","window","start","when","only","end","previous","next","stable","ascending","descending","allowing","empty","greatest","least","some","every","satisfies","switch","case","typeswitch","try","catch","and","or","to","union","intersect","instance","of","treat","as","castable","cast","map","array","delete","insert","into","replace","value","rename","copy","modify","update"],type:["item","document-node","node","attribute","document","element","comment","namespace","namespace-node","processing-instruction","text","construction","xs:anyAtomicType","xs:untypedAtomic","xs:duration","xs:time","xs:decimal","xs:float","xs:double","xs:gYearMonth","xs:gYear","xs:gMonthDay","xs:gMonth","xs:gDay","xs:boolean","xs:base64Binary","xs:hexBinary","xs:anyURI","xs:QName","xs:NOTATION","xs:dateTime","xs:dateTimeStamp","xs:date","xs:string","xs:normalizedString","xs:token","xs:language","xs:NMTOKEN","xs:Name","xs:NCName","xs:ID","xs:IDREF","xs:ENTITY","xs:integer","xs:nonPositiveInteger","xs:negativeInteger","xs:long","xs:int","xs:short","xs:byte","xs:nonNegativeInteger","xs:unisignedLong","xs:unsignedInt","xs:unsignedShort","xs:unsignedByte","xs:positiveInteger","xs:yearMonthDuration","xs:dayTimeDuration"],literal:["eq","ne","lt","le","gt","ge","is","self::","child::","descendant::","descendant-or-self::","attribute::","following::","following-sibling::","parent::","ancestor::","ancestor-or-self::","preceding::","preceding-sibling::","NaN"]},contains:[{className:"variable",begin:/[$][\w\-:]+/},{className:"built_in",variants:[{begin:/\barray:/,end:/(?:append|filter|flatten|fold-(?:left|right)|for-each(?:-pair)?|get|head|insert-before|join|put|remove|reverse|size|sort|subarray|tail)\b/},{begin:/\bmap:/,end:/(?:contains|entry|find|for-each|get|keys|merge|put|remove|size)\b/},{begin:/\bmath:/,end:/(?:a(?:cos|sin|tan[2]?)|cos|exp(?:10)?|log(?:10)?|pi|pow|sin|sqrt|tan)\b/},{begin:/\bop:/,end:/\(/,excludeEnd:!0},{begin:/\bfn:/,end:/\(/,excludeEnd:!0},{begin:/[^/,end:/(\/[\w._:-]+>)/,subLanguage:"xml",contains:[{begin:/\{/,end:/\}/,subLanguage:"xquery"},"self"]}]}}return Om=n,Om}var Im,pC;function GWe(){if(pC)return Im;pC=1;function n(e){const t={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.inherit(e.APOS_STRING_MODE,{illegal:null}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null})]},i=e.UNDERSCORE_TITLE_MODE,s={variants:[e.BINARY_NUMBER_MODE,e.C_NUMBER_MODE]},r="namespace class interface use extends function return abstract final public protected private static deprecated throw try catch Exception echo empty isset instanceof unset let var new const self require if else elseif switch case default do while loop for continue break likely unlikely __LINE__ __FILE__ __DIR__ __FUNCTION__ __CLASS__ __TRAIT__ __METHOD__ __NAMESPACE__ array boolean float double integer object resource string char long unsigned bool int uint ulong uchar true false null undefined";return{name:"Zephir",aliases:["zep"],keywords:r,contains:[e.C_LINE_COMMENT_MODE,e.COMMENT(/\/\*/,/\*\//,{contains:[{className:"doctag",begin:/@[A-Za-z]+/}]}),{className:"string",begin:/<<<['"]?\w+['"]?$/,end:/^\w+;/,contains:[e.BACKSLASH_ESCAPE]},{begin:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{className:"function",beginKeywords:"function fn",end:/[;{]/,excludeEnd:!0,illegal:/\$|\[|%/,contains:[i,{className:"params",begin:/\(/,end:/\)/,keywords:r,contains:["self",e.C_BLOCK_COMMENT_MODE,t,s]}]},{className:"class",beginKeywords:"class interface",end:/\{/,excludeEnd:!0,illegal:/[:($"]/,contains:[{beginKeywords:"extends implements"},i]},{beginKeywords:"namespace",end:/;/,illegal:/[.']/,contains:[i]},{beginKeywords:"use",end:/;/,contains:[i]},{begin:/=>/},t,s]}}return Im=n,Im}var ue=dqe;ue.registerLanguage("1c",uqe());ue.registerLanguage("abnf",pqe());ue.registerLanguage("accesslog",_qe());ue.registerLanguage("actionscript",hqe());ue.registerLanguage("ada",fqe());ue.registerLanguage("angelscript",mqe());ue.registerLanguage("apache",gqe());ue.registerLanguage("applescript",bqe());ue.registerLanguage("arcade",Eqe());ue.registerLanguage("arduino",vqe());ue.registerLanguage("armasm",yqe());ue.registerLanguage("xml",Sqe());ue.registerLanguage("asciidoc",Tqe());ue.registerLanguage("aspectj",xqe());ue.registerLanguage("autohotkey",Cqe());ue.registerLanguage("autoit",Rqe());ue.registerLanguage("avrasm",Aqe());ue.registerLanguage("awk",wqe());ue.registerLanguage("axapta",Nqe());ue.registerLanguage("bash",Oqe());ue.registerLanguage("basic",Iqe());ue.registerLanguage("bnf",Mqe());ue.registerLanguage("brainfuck",Dqe());ue.registerLanguage("c",kqe());ue.registerLanguage("cal",Lqe());ue.registerLanguage("capnproto",Pqe());ue.registerLanguage("ceylon",Uqe());ue.registerLanguage("clean",Fqe());ue.registerLanguage("clojure",Bqe());ue.registerLanguage("clojure-repl",Gqe());ue.registerLanguage("cmake",zqe());ue.registerLanguage("coffeescript",Vqe());ue.registerLanguage("coq",Hqe());ue.registerLanguage("cos",qqe());ue.registerLanguage("cpp",Yqe());ue.registerLanguage("crmsh",$qe());ue.registerLanguage("crystal",Wqe());ue.registerLanguage("csharp",Kqe());ue.registerLanguage("csp",jqe());ue.registerLanguage("css",Qqe());ue.registerLanguage("d",Xqe());ue.registerLanguage("markdown",Zqe());ue.registerLanguage("dart",Jqe());ue.registerLanguage("delphi",eYe());ue.registerLanguage("diff",tYe());ue.registerLanguage("django",nYe());ue.registerLanguage("dns",iYe());ue.registerLanguage("dockerfile",sYe());ue.registerLanguage("dos",rYe());ue.registerLanguage("dsconfig",oYe());ue.registerLanguage("dts",aYe());ue.registerLanguage("dust",lYe());ue.registerLanguage("ebnf",cYe());ue.registerLanguage("elixir",dYe());ue.registerLanguage("elm",uYe());ue.registerLanguage("ruby",pYe());ue.registerLanguage("erb",_Ye());ue.registerLanguage("erlang-repl",hYe());ue.registerLanguage("erlang",fYe());ue.registerLanguage("excel",mYe());ue.registerLanguage("fix",gYe());ue.registerLanguage("flix",bYe());ue.registerLanguage("fortran",EYe());ue.registerLanguage("fsharp",vYe());ue.registerLanguage("gams",yYe());ue.registerLanguage("gauss",SYe());ue.registerLanguage("gcode",TYe());ue.registerLanguage("gherkin",xYe());ue.registerLanguage("glsl",CYe());ue.registerLanguage("gml",RYe());ue.registerLanguage("go",AYe());ue.registerLanguage("golo",wYe());ue.registerLanguage("gradle",NYe());ue.registerLanguage("graphql",OYe());ue.registerLanguage("groovy",IYe());ue.registerLanguage("haml",MYe());ue.registerLanguage("handlebars",DYe());ue.registerLanguage("haskell",kYe());ue.registerLanguage("haxe",LYe());ue.registerLanguage("hsp",PYe());ue.registerLanguage("http",UYe());ue.registerLanguage("hy",FYe());ue.registerLanguage("inform7",BYe());ue.registerLanguage("ini",GYe());ue.registerLanguage("irpf90",zYe());ue.registerLanguage("isbl",VYe());ue.registerLanguage("java",HYe());ue.registerLanguage("javascript",qYe());ue.registerLanguage("jboss-cli",YYe());ue.registerLanguage("json",$Ye());ue.registerLanguage("julia",WYe());ue.registerLanguage("julia-repl",KYe());ue.registerLanguage("kotlin",jYe());ue.registerLanguage("lasso",QYe());ue.registerLanguage("latex",XYe());ue.registerLanguage("ldif",ZYe());ue.registerLanguage("leaf",JYe());ue.registerLanguage("less",e$e());ue.registerLanguage("lisp",t$e());ue.registerLanguage("livecodeserver",n$e());ue.registerLanguage("livescript",i$e());ue.registerLanguage("llvm",s$e());ue.registerLanguage("lsl",r$e());ue.registerLanguage("lua",o$e());ue.registerLanguage("makefile",a$e());ue.registerLanguage("mathematica",l$e());ue.registerLanguage("matlab",c$e());ue.registerLanguage("maxima",d$e());ue.registerLanguage("mel",u$e());ue.registerLanguage("mercury",p$e());ue.registerLanguage("mipsasm",_$e());ue.registerLanguage("mizar",h$e());ue.registerLanguage("perl",f$e());ue.registerLanguage("mojolicious",m$e());ue.registerLanguage("monkey",g$e());ue.registerLanguage("moonscript",b$e());ue.registerLanguage("n1ql",E$e());ue.registerLanguage("nestedtext",v$e());ue.registerLanguage("nginx",y$e());ue.registerLanguage("nim",S$e());ue.registerLanguage("nix",T$e());ue.registerLanguage("node-repl",x$e());ue.registerLanguage("nsis",C$e());ue.registerLanguage("objectivec",R$e());ue.registerLanguage("ocaml",A$e());ue.registerLanguage("openscad",w$e());ue.registerLanguage("oxygene",N$e());ue.registerLanguage("parser3",O$e());ue.registerLanguage("pf",I$e());ue.registerLanguage("pgsql",M$e());ue.registerLanguage("php",D$e());ue.registerLanguage("php-template",k$e());ue.registerLanguage("plaintext",L$e());ue.registerLanguage("pony",P$e());ue.registerLanguage("powershell",U$e());ue.registerLanguage("processing",F$e());ue.registerLanguage("profile",B$e());ue.registerLanguage("prolog",G$e());ue.registerLanguage("properties",z$e());ue.registerLanguage("protobuf",V$e());ue.registerLanguage("puppet",H$e());ue.registerLanguage("purebasic",q$e());ue.registerLanguage("python",Y$e());ue.registerLanguage("python-repl",$$e());ue.registerLanguage("q",W$e());ue.registerLanguage("qml",K$e());ue.registerLanguage("r",j$e());ue.registerLanguage("reasonml",Q$e());ue.registerLanguage("rib",X$e());ue.registerLanguage("roboconf",Z$e());ue.registerLanguage("routeros",J$e());ue.registerLanguage("rsl",eWe());ue.registerLanguage("ruleslanguage",tWe());ue.registerLanguage("rust",nWe());ue.registerLanguage("sas",iWe());ue.registerLanguage("scala",sWe());ue.registerLanguage("scheme",rWe());ue.registerLanguage("scilab",oWe());ue.registerLanguage("scss",aWe());ue.registerLanguage("shell",lWe());ue.registerLanguage("smali",cWe());ue.registerLanguage("smalltalk",dWe());ue.registerLanguage("sml",uWe());ue.registerLanguage("sqf",pWe());ue.registerLanguage("sql",_We());ue.registerLanguage("stan",hWe());ue.registerLanguage("stata",fWe());ue.registerLanguage("step21",mWe());ue.registerLanguage("stylus",gWe());ue.registerLanguage("subunit",bWe());ue.registerLanguage("swift",EWe());ue.registerLanguage("taggerscript",vWe());ue.registerLanguage("yaml",yWe());ue.registerLanguage("tap",SWe());ue.registerLanguage("tcl",TWe());ue.registerLanguage("thrift",xWe());ue.registerLanguage("tp",CWe());ue.registerLanguage("twig",RWe());ue.registerLanguage("typescript",AWe());ue.registerLanguage("vala",wWe());ue.registerLanguage("vbnet",NWe());ue.registerLanguage("vbscript",OWe());ue.registerLanguage("vbscript-html",IWe());ue.registerLanguage("verilog",MWe());ue.registerLanguage("vhdl",DWe());ue.registerLanguage("vim",kWe());ue.registerLanguage("wasm",LWe());ue.registerLanguage("wren",PWe());ue.registerLanguage("x86asm",UWe());ue.registerLanguage("xl",FWe());ue.registerLanguage("xquery",BWe());ue.registerLanguage("zephir",GWe());ue.HighlightJS=ue;ue.default=ue;var zWe=ue;const fo=Ys(zWe),VWe="/assets/vscode_black-c05c76d9.svg",HWe="/assets/vscode-b22df1bb.svg";fo.configure({languages:[]});fo.configure({languages:["bash"]});fo.highlightAll();const qWe={props:{host:{type:String,required:!1,default:"http://localhost:9600"},language:{type:String,required:!0},client_id:{type:String,required:!0},code:{type:String,required:!0},discussion_id:{type:[String,Number],required:!0},message_id:{type:[String,Number],required:!0}},data(){return{isExecuting:!1,isCopied:!1,executionOutput:""}},mounted(){Ve(()=>{qe.replace()})},computed:{highlightedCode(){let n;this.language==="vue"||this.language==="vue.js"?n="javascript":n=fo.getLanguage(this.language)?this.language:"plaintext";const e=this.code.trim(),t=e.split(` -`),i=t.length.toString().length,s=t.map((d,c)=>(c+1).toString().padStart(i," ")),r=document.createElement("div");r.classList.add("line-numbers"),r.innerHTML=s.join("
");const o=document.createElement("div");o.classList.add("code-container");const a=document.createElement("pre"),l=document.createElement("code");return l.classList.add("code-content"),l.innerHTML=fo.highlight(e,{language:n,ignoreIllegals:!0}).value,a.appendChild(l),o.appendChild(r),o.appendChild(a),o.outerHTML}},methods:{copyCode(){this.isCopied=!0,console.log("Copying code");const n=document.createElement("textarea");n.value=this.code,document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),Ve(()=>{qe.replace()})},executeCode(){this.isExecuting=!0;const n=JSON.stringify({client_id:this.client_id,code:this.code,discussion_id:this.discussion_id,message_id:this.message_id,language:this.language});console.log(n),fetch(`${this.host}/execute_code`,{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then(e=>(this.isExecuting=!1,e.json())).then(e=>{console.log(e),this.executionOutput=e.output}).catch(e=>{this.isExecuting=!1,console.error("Fetch error:",e)})},openFolderVsCode(){const n=JSON.stringify({client_id:this.client_id,code:this.code,discussion_id:this.discussion_id,message_id:this.message_id});console.log(n),fetch(`${this.host}/open_code_in_vs_code`,{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then(e=>e.json()).then(e=>{console.log(e)}).catch(e=>{console.error("Fetch error:",e)})},openVsCode(){const n=JSON.stringify({client_id:this.client_id,discussion_id:typeof this.discussion_id=="string"?parseInt(this.discussion_id):this.discussion_id,message_id:this.message_id,code:this.code});console.log(n),fetch(`${this.host}/open_code_folder_in_vs_code`,{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then(e=>e.json()).then(e=>{console.log(e)}).catch(e=>{console.error("Fetch error:",e)})},openFolder(){const n=JSON.stringify({client_id:this.client_id,discussion_id:this.discussion_id});console.log(n),fetch(`${this.host}/open_code_folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then(e=>e.json()).then(e=>{console.log(e)}).catch(e=>{console.error("Fetch error:",e)})}}},YWe={class:"bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel p-2 rounded-lg shadow-sm"},$We={class:"flex flex-row bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel p-2 rounded-lg shadow-sm"},WWe={class:"text-2xl"},KWe=u("i",{"data-feather":"copy"},null,-1),jWe=[KWe],QWe=u("i",{"data-feather":"play-circle"},null,-1),XWe=[QWe],ZWe=u("i",{"data-feather":"folder"},null,-1),JWe=[ZWe],eKe=u("img",{src:VWe,width:"25",height:"25"},null,-1),tKe=[eKe],nKe=u("img",{src:HWe,width:"25",height:"25"},null,-1),iKe=[nKe],sKe={class:"hljs p-1 rounded-md break-all grid grid-cols-1"},rKe={class:"code-container"},oKe=["innerHTML"],aKe={key:0,class:"text-2xl"},lKe={key:1,class:"hljs mt-0 p-1 rounded-md break-all grid grid-cols-1"},cKe={class:"container h-[200px] overflow-x-auto break-all scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},dKe=["innerHTML"];function uKe(n,e,t,i,s,r){return w(),M("div",YWe,[u("div",$We,[u("span",WWe,fe(t.language),1),u("button",{onClick:e[0]||(e[0]=(...o)=>r.copyCode&&r.copyCode(...o)),title:"copy",class:Ye([s.isCopied?"bg-green-500":"bg-bg-dark-tone-panel dark:bg-bg-dark-tone","px-2 py-1 ml-2 text-left p-2 text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200"])},jWe,2),["python","sh","shell","bash","cmd","powershell","latex","mermaid","graphviz","dot","javascript","html","html5","svg"].includes(t.language)?(w(),M("button",{key:0,ref:"btn_code_exec",onClick:e[1]||(e[1]=(...o)=>r.executeCode&&r.executeCode(...o)),title:"execute",class:Ye(["px-2 py-1 ml-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200",s.isExecuting?"bg-green-500":""])},XWe,2)):q("",!0),["python","latex"].includes(t.language)?(w(),M("button",{key:1,onClick:e[2]||(e[2]=(...o)=>r.openFolder&&r.openFolder(...o)),title:"open code project folder",class:"px-2 py-1 ml-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200"},JWe)):q("",!0),["python"].includes(t.language)?(w(),M("button",{key:2,onClick:e[3]||(e[3]=(...o)=>r.openFolderVsCode&&r.openFolderVsCode(...o)),title:"open code project folder in vscode",class:"px-2 py-1 ml-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200"},tKe)):q("",!0),["python"].includes(t.language)?(w(),M("button",{key:3,onClick:e[4]||(e[4]=(...o)=>r.openVsCode&&r.openVsCode(...o)),title:"open code in vscode",class:"px-2 py-1 ml-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200"},iKe)):q("",!0)]),u("pre",sKe,[je(" "),u("div",rKe,[je(` - `),u("code",{class:"code-content overflow-x-auto break-all scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",innerHTML:r.highlightedCode},null,8,oKe),je(` +`),i=t.length.toString().length,s=t.map((d,c)=>(c+1).toString().padStart(i," ")),r=document.createElement("div");r.classList.add("line-numbers"),r.innerHTML=s.join("
");const o=document.createElement("div");o.classList.add("code-container");const a=document.createElement("pre"),l=document.createElement("code");return l.classList.add("code-content"),l.innerHTML=fo.highlight(e,{language:n,ignoreIllegals:!0}).value,a.appendChild(l),o.appendChild(r),o.appendChild(a),o.outerHTML}},methods:{copyCode(){this.isCopied=!0,console.log("Copying code");const n=document.createElement("textarea");n.value=this.code,document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),Ve(()=>{qe.replace()})},executeCode(){this.isExecuting=!0;const n=JSON.stringify({client_id:this.client_id,code:this.code,discussion_id:this.discussion_id,message_id:this.message_id,language:this.language});console.log(n),fetch(`${this.host}/execute_code`,{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then(e=>(this.isExecuting=!1,e.json())).then(e=>{console.log(e),this.executionOutput=e.output}).catch(e=>{this.isExecuting=!1,console.error("Fetch error:",e)})},executeCode_in_new_tab(){this.isExecuting=!0;const n=JSON.stringify({client_id:this.client_id,code:this.code,discussion_id:this.discussion_id,message_id:this.message_id,language:this.language});console.log(n),fetch(`${this.host}/execute_code_in_new_tab`,{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then(e=>(this.isExecuting=!1,e.json())).then(e=>{console.log(e),this.executionOutput=e.output}).catch(e=>{this.isExecuting=!1,console.error("Fetch error:",e)})},openFolderVsCode(){const n=JSON.stringify({client_id:this.client_id,code:this.code,discussion_id:this.discussion_id,message_id:this.message_id});console.log(n),fetch(`${this.host}/open_code_in_vs_code`,{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then(e=>e.json()).then(e=>{console.log(e)}).catch(e=>{console.error("Fetch error:",e)})},openVsCode(){const n=JSON.stringify({client_id:this.client_id,discussion_id:typeof this.discussion_id=="string"?parseInt(this.discussion_id):this.discussion_id,message_id:this.message_id,code:this.code});console.log(n),fetch(`${this.host}/open_code_folder_in_vs_code`,{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then(e=>e.json()).then(e=>{console.log(e)}).catch(e=>{console.error("Fetch error:",e)})},openFolder(){const n=JSON.stringify({client_id:this.client_id,discussion_id:this.discussion_id});console.log(n),fetch(`${this.host}/open_code_folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then(e=>e.json()).then(e=>{console.log(e)}).catch(e=>{console.error("Fetch error:",e)})}}},YWe={class:"bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel p-2 rounded-lg shadow-sm"},$We={class:"flex flex-row bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel p-2 rounded-lg shadow-sm"},WWe={class:"text-2xl"},KWe=u("i",{"data-feather":"copy"},null,-1),jWe=[KWe],QWe=u("i",{"data-feather":"play-circle"},null,-1),XWe=[QWe],ZWe=u("i",{"data-feather":"airplay"},null,-1),JWe=[ZWe],eKe=u("i",{"data-feather":"folder"},null,-1),tKe=[eKe],nKe=u("img",{src:VWe,width:"25",height:"25"},null,-1),iKe=[nKe],sKe=u("img",{src:HWe,width:"25",height:"25"},null,-1),rKe=[sKe],oKe={class:"hljs p-1 rounded-md break-all grid grid-cols-1"},aKe={class:"code-container"},lKe=["innerHTML"],cKe={key:0,class:"text-2xl"},dKe={key:1,class:"hljs mt-0 p-1 rounded-md break-all grid grid-cols-1"},uKe={class:"container h-[200px] overflow-x-auto break-all scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},pKe=["innerHTML"];function _Ke(n,e,t,i,s,r){return w(),M("div",YWe,[u("div",$We,[u("span",WWe,fe(t.language),1),u("button",{onClick:e[0]||(e[0]=(...o)=>r.copyCode&&r.copyCode(...o)),title:"copy",class:Ye([s.isCopied?"bg-green-500":"bg-bg-dark-tone-panel dark:bg-bg-dark-tone","px-2 py-1 ml-2 text-left p-2 text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200"])},jWe,2),["python","sh","shell","bash","cmd","powershell","latex","mermaid","graphviz","dot","javascript","html","html5","svg"].includes(t.language)?(w(),M("button",{key:0,ref:"btn_code_exec",onClick:e[1]||(e[1]=(...o)=>r.executeCode&&r.executeCode(...o)),title:"execute",class:Ye(["px-2 py-1 ml-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200",s.isExecuting?"bg-green-500":""])},XWe,2)):q("",!0),["airplay","mermaid","graphviz","dot","javascript","html","html5","svg"].includes(t.language)?(w(),M("button",{key:1,ref:"btn_code_exec_in_new_tab",onClick:e[2]||(e[2]=(...o)=>r.executeCode_in_new_tab&&r.executeCode_in_new_tab(...o)),title:"execute",class:Ye(["px-2 py-1 ml-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200",s.isExecuting?"bg-green-500":""])},JWe,2)):q("",!0),["python","latex","html"].includes(t.language)?(w(),M("button",{key:2,onClick:e[3]||(e[3]=(...o)=>r.openFolder&&r.openFolder(...o)),title:"open code project folder",class:"px-2 py-1 ml-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200"},tKe)):q("",!0),["python","latex","html"].includes(t.language)?(w(),M("button",{key:3,onClick:e[4]||(e[4]=(...o)=>r.openFolderVsCode&&r.openFolderVsCode(...o)),title:"open code project folder in vscode",class:"px-2 py-1 ml-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200"},iKe)):q("",!0),["python","latex","html"].includes(t.language)?(w(),M("button",{key:4,onClick:e[5]||(e[5]=(...o)=>r.openVsCode&&r.openVsCode(...o)),title:"open code in vscode",class:"px-2 py-1 ml-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200"},rKe)):q("",!0)]),u("pre",oKe,[je(" "),u("div",aKe,[je(` + `),u("code",{class:"code-content overflow-x-auto break-all scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",innerHTML:r.highlightedCode},null,8,lKe),je(` `)]),je(` - `)]),s.executionOutput?(w(),M("span",aKe,"Execution output")):q("",!0),s.executionOutput?(w(),M("pre",lKe,[je(" "),u("div",cKe,[je(` - `),u("div",{ref:"execution_output",innerHTML:s.executionOutput},null,8,dKe),je(` + `)]),s.executionOutput?(w(),M("span",cKe,"Execution output")):q("",!0),s.executionOutput?(w(),M("pre",dKe,[je(" "),u("div",uKe,[je(` + `),u("div",{ref:"execution_output",innerHTML:s.executionOutput},null,8,pKe),je(` `)]),je(` - `)])):q("",!0)])}const pKe=bt(qWe,[["render",uKe]]);/*! @license DOMPurify 3.0.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.8/LICENSE */const{entries:DN,setPrototypeOf:_C,isFrozen:_Ke,getPrototypeOf:hKe,getOwnPropertyDescriptor:EE}=Object;let{freeze:$n,seal:qi,create:kN}=Object,{apply:jg,construct:Qg}=typeof Reflect<"u"&&Reflect;$n||($n=function(e){return e});qi||(qi=function(e){return e});jg||(jg=function(e,t,i){return e.apply(t,i)});Qg||(Qg=function(e,t){return new e(...t)});const Gc=Ri(Array.prototype.forEach),hC=Ri(Array.prototype.pop),ul=Ri(Array.prototype.push),Ld=Ri(String.prototype.toLowerCase),Mm=Ri(String.prototype.toString),fKe=Ri(String.prototype.match),pl=Ri(String.prototype.replace),mKe=Ri(String.prototype.indexOf),gKe=Ri(String.prototype.trim),ni=Ri(RegExp.prototype.test),_l=bKe(TypeError);function Ri(n){return function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s2&&arguments[2]!==void 0?arguments[2]:Ld;_C&&_C(n,null);let i=e.length;for(;i--;){let s=e[i];if(typeof s=="string"){const r=t(s);r!==s&&(_Ke(e)||(e[i]=r),s=r)}n[s]=!0}return n}function EKe(n){for(let e=0;e/gm),xKe=qi(/\${[\w\W]*}/gm),CKe=qi(/^data-[\-\w.\u00B7-\uFFFF]/),RKe=qi(/^aria-[\-\w]+$/),LN=qi(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),AKe=qi(/^(?:\w+script|data):/i),wKe=qi(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),PN=qi(/^html$/i);var EC=Object.freeze({__proto__:null,MUSTACHE_EXPR:SKe,ERB_EXPR:TKe,TMPLIT_EXPR:xKe,DATA_ATTR:CKe,ARIA_ATTR:RKe,IS_ALLOWED_URI:LN,IS_SCRIPT_OR_DATA:AKe,ATTR_WHITESPACE:wKe,DOCTYPE_NAME:PN});const NKe=function(){return typeof window>"u"?null:window},OKe=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null;const s="data-tt-policy-suffix";t&&t.hasAttribute(s)&&(i=t.getAttribute(s));const r="dompurify"+(i?"#"+i:"");try{return e.createPolicy(r,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}};function UN(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:NKe();const e=tt=>UN(tt);if(e.version="3.0.8",e.removed=[],!n||!n.document||n.document.nodeType!==9)return e.isSupported=!1,e;let{document:t}=n;const i=t,s=i.currentScript,{DocumentFragment:r,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:d,NamedNodeMap:c=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:_,DOMParser:f,trustedTypes:m}=n,h=l.prototype,E=zc(h,"cloneNode"),b=zc(h,"nextSibling"),g=zc(h,"childNodes"),v=zc(h,"parentNode");if(typeof o=="function"){const tt=t.createElement("template");tt.content&&tt.content.ownerDocument&&(t=tt.content.ownerDocument)}let y,T="";const{implementation:C,createNodeIterator:x,createDocumentFragment:O,getElementsByTagName:R}=t,{importNode:S}=i;let A={};e.isSupported=typeof DN=="function"&&typeof v=="function"&&C&&C.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:U,ERB_EXPR:F,TMPLIT_EXPR:K,DATA_ATTR:L,ARIA_ATTR:H,IS_SCRIPT_OR_DATA:G,ATTR_WHITESPACE:P}=EC;let{IS_ALLOWED_URI:j}=EC,Y=null;const Q=Nt({},[...fC,...Dm,...km,...Lm,...mC]);let ae=null;const te=Nt({},[...gC,...Pm,...bC,...Vc]);let Z=Object.seal(kN(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),me=null,ve=null,Ae=!0,J=!0,ge=!1,ee=!0,Se=!1,Ie=!1,k=!1,B=!1,$=!1,de=!1,ie=!1,Ce=!0,we=!1;const V="user-content-";let _e=!0,se=!1,ce={},D=null;const I=Nt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let z=null;const he=Nt({},["audio","video","img","source","image","track"]);let X=null;const re=Nt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Re="http://www.w3.org/1998/Math/MathML",xe="http://www.w3.org/2000/svg",De="http://www.w3.org/1999/xhtml";let ze=De,st=!1,ke=null;const lt=Nt({},[Re,xe,De],Mm);let Qe=null;const He=["application/xhtml+xml","text/html"],et="text/html";let Fe=null,pt=null;const pe=t.createElement("form"),We=function(N){return N instanceof RegExp||N instanceof Function},Ue=function(){let N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(pt&&pt===N)){if((!N||typeof N!="object")&&(N={}),N=$r(N),Qe=He.indexOf(N.PARSER_MEDIA_TYPE)===-1?et:N.PARSER_MEDIA_TYPE,Fe=Qe==="application/xhtml+xml"?Mm:Ld,Y="ALLOWED_TAGS"in N?Nt({},N.ALLOWED_TAGS,Fe):Q,ae="ALLOWED_ATTR"in N?Nt({},N.ALLOWED_ATTR,Fe):te,ke="ALLOWED_NAMESPACES"in N?Nt({},N.ALLOWED_NAMESPACES,Mm):lt,X="ADD_URI_SAFE_ATTR"in N?Nt($r(re),N.ADD_URI_SAFE_ATTR,Fe):re,z="ADD_DATA_URI_TAGS"in N?Nt($r(he),N.ADD_DATA_URI_TAGS,Fe):he,D="FORBID_CONTENTS"in N?Nt({},N.FORBID_CONTENTS,Fe):I,me="FORBID_TAGS"in N?Nt({},N.FORBID_TAGS,Fe):{},ve="FORBID_ATTR"in N?Nt({},N.FORBID_ATTR,Fe):{},ce="USE_PROFILES"in N?N.USE_PROFILES:!1,Ae=N.ALLOW_ARIA_ATTR!==!1,J=N.ALLOW_DATA_ATTR!==!1,ge=N.ALLOW_UNKNOWN_PROTOCOLS||!1,ee=N.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Se=N.SAFE_FOR_TEMPLATES||!1,Ie=N.WHOLE_DOCUMENT||!1,$=N.RETURN_DOM||!1,de=N.RETURN_DOM_FRAGMENT||!1,ie=N.RETURN_TRUSTED_TYPE||!1,B=N.FORCE_BODY||!1,Ce=N.SANITIZE_DOM!==!1,we=N.SANITIZE_NAMED_PROPS||!1,_e=N.KEEP_CONTENT!==!1,se=N.IN_PLACE||!1,j=N.ALLOWED_URI_REGEXP||LN,ze=N.NAMESPACE||De,Z=N.CUSTOM_ELEMENT_HANDLING||{},N.CUSTOM_ELEMENT_HANDLING&&We(N.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Z.tagNameCheck=N.CUSTOM_ELEMENT_HANDLING.tagNameCheck),N.CUSTOM_ELEMENT_HANDLING&&We(N.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Z.attributeNameCheck=N.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),N.CUSTOM_ELEMENT_HANDLING&&typeof N.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Z.allowCustomizedBuiltInElements=N.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Se&&(J=!1),de&&($=!0),ce&&(Y=Nt({},mC),ae=[],ce.html===!0&&(Nt(Y,fC),Nt(ae,gC)),ce.svg===!0&&(Nt(Y,Dm),Nt(ae,Pm),Nt(ae,Vc)),ce.svgFilters===!0&&(Nt(Y,km),Nt(ae,Pm),Nt(ae,Vc)),ce.mathMl===!0&&(Nt(Y,Lm),Nt(ae,bC),Nt(ae,Vc))),N.ADD_TAGS&&(Y===Q&&(Y=$r(Y)),Nt(Y,N.ADD_TAGS,Fe)),N.ADD_ATTR&&(ae===te&&(ae=$r(ae)),Nt(ae,N.ADD_ATTR,Fe)),N.ADD_URI_SAFE_ATTR&&Nt(X,N.ADD_URI_SAFE_ATTR,Fe),N.FORBID_CONTENTS&&(D===I&&(D=$r(D)),Nt(D,N.FORBID_CONTENTS,Fe)),_e&&(Y["#text"]=!0),Ie&&Nt(Y,["html","head","body"]),Y.table&&(Nt(Y,["tbody"]),delete me.tbody),N.TRUSTED_TYPES_POLICY){if(typeof N.TRUSTED_TYPES_POLICY.createHTML!="function")throw _l('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof N.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw _l('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');y=N.TRUSTED_TYPES_POLICY,T=y.createHTML("")}else y===void 0&&(y=OKe(m,s)),y!==null&&typeof T=="string"&&(T=y.createHTML(""));$n&&$n(N),pt=N}},Ne=Nt({},["mi","mo","mn","ms","mtext"]),Be=Nt({},["foreignobject","desc","title","annotation-xml"]),dt=Nt({},["title","style","font","a","script"]),Et=Nt({},[...Dm,...km,...vKe]),jt=Nt({},[...Lm,...yKe]),ln=function(N){let W=v(N);(!W||!W.tagName)&&(W={namespaceURI:ze,tagName:"template"});const le=Ld(N.tagName),ye=Ld(W.tagName);return ke[N.namespaceURI]?N.namespaceURI===xe?W.namespaceURI===De?le==="svg":W.namespaceURI===Re?le==="svg"&&(ye==="annotation-xml"||Ne[ye]):!!Et[le]:N.namespaceURI===Re?W.namespaceURI===De?le==="math":W.namespaceURI===xe?le==="math"&&Be[ye]:!!jt[le]:N.namespaceURI===De?W.namespaceURI===xe&&!Be[ye]||W.namespaceURI===Re&&!Ne[ye]?!1:!jt[le]&&(dt[le]||!Et[le]):!!(Qe==="application/xhtml+xml"&&ke[N.namespaceURI]):!1},Ct=function(N){ul(e.removed,{element:N});try{N.parentNode.removeChild(N)}catch{N.remove()}},$t=function(N,W){try{ul(e.removed,{attribute:W.getAttributeNode(N),from:W})}catch{ul(e.removed,{attribute:null,from:W})}if(W.removeAttribute(N),N==="is"&&!ae[N])if($||de)try{Ct(W)}catch{}else try{W.setAttribute(N,"")}catch{}},yn=function(N){let W=null,le=null;if(B)N=""+N;else{const Ge=fKe(N,/^[\r\n\t ]+/);le=Ge&&Ge[0]}Qe==="application/xhtml+xml"&&ze===De&&(N=''+N+"");const ye=y?y.createHTML(N):N;if(ze===De)try{W=new f().parseFromString(ye,Qe)}catch{}if(!W||!W.documentElement){W=C.createDocument(ze,"template",null);try{W.documentElement.innerHTML=st?T:ye}catch{}}const Ee=W.body||W.documentElement;return N&&le&&Ee.insertBefore(t.createTextNode(le),Ee.childNodes[0]||null),ze===De?R.call(W,Ie?"html":"body")[0]:Ie?W.documentElement:Ee},gs=function(N){return x.call(N.ownerDocument||N,N,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT,null)},kr=function(N){return N instanceof _&&(typeof N.nodeName!="string"||typeof N.textContent!="string"||typeof N.removeChild!="function"||!(N.attributes instanceof c)||typeof N.removeAttribute!="function"||typeof N.setAttribute!="function"||typeof N.namespaceURI!="string"||typeof N.insertBefore!="function"||typeof N.hasChildNodes!="function")},ci=function(N){return typeof a=="function"&&N instanceof a},Sn=function(N,W,le){A[N]&&Gc(A[N],ye=>{ye.call(e,W,le,pt)})},di=function(N){let W=null;if(Sn("beforeSanitizeElements",N,null),kr(N))return Ct(N),!0;const le=Fe(N.nodeName);if(Sn("uponSanitizeElement",N,{tagName:le,allowedTags:Y}),N.hasChildNodes()&&!ci(N.firstElementChild)&&ni(/<[/\w]/g,N.innerHTML)&&ni(/<[/\w]/g,N.textContent))return Ct(N),!0;if(!Y[le]||me[le]){if(!me[le]&&bs(le)&&(Z.tagNameCheck instanceof RegExp&&ni(Z.tagNameCheck,le)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck(le)))return!1;if(_e&&!D[le]){const ye=v(N)||N.parentNode,Ee=g(N)||N.childNodes;if(Ee&&ye){const Ge=Ee.length;for(let Xe=Ge-1;Xe>=0;--Xe)ye.insertBefore(E(Ee[Xe],!0),b(N))}}return Ct(N),!0}return N instanceof l&&!ln(N)||(le==="noscript"||le==="noembed"||le==="noframes")&&ni(/<\/no(script|embed|frames)/i,N.innerHTML)?(Ct(N),!0):(Se&&N.nodeType===3&&(W=N.textContent,Gc([U,F,K],ye=>{W=pl(W,ye," ")}),N.textContent!==W&&(ul(e.removed,{element:N.cloneNode()}),N.textContent=W)),Sn("afterSanitizeElements",N,null),!1)},Ki=function(N,W,le){if(Ce&&(W==="id"||W==="name")&&(le in t||le in pe))return!1;if(!(J&&!ve[W]&&ni(L,W))){if(!(Ae&&ni(H,W))){if(!ae[W]||ve[W]){if(!(bs(N)&&(Z.tagNameCheck instanceof RegExp&&ni(Z.tagNameCheck,N)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck(N))&&(Z.attributeNameCheck instanceof RegExp&&ni(Z.attributeNameCheck,W)||Z.attributeNameCheck instanceof Function&&Z.attributeNameCheck(W))||W==="is"&&Z.allowCustomizedBuiltInElements&&(Z.tagNameCheck instanceof RegExp&&ni(Z.tagNameCheck,le)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck(le))))return!1}else if(!X[W]){if(!ni(j,pl(le,P,""))){if(!((W==="src"||W==="xlink:href"||W==="href")&&N!=="script"&&mKe(le,"data:")===0&&z[N])){if(!(ge&&!ni(G,pl(le,P,"")))){if(le)return!1}}}}}}return!0},bs=function(N){return N.indexOf("-")>0},Es=function(N){Sn("beforeSanitizeAttributes",N,null);const{attributes:W}=N;if(!W)return;const le={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ae};let ye=W.length;for(;ye--;){const Ee=W[ye],{name:Ge,namespaceURI:Xe,value:nt}=Ee,at=Fe(Ge);let rt=Ge==="value"?nt:gKe(nt);if(le.attrName=at,le.attrValue=rt,le.keepAttr=!0,le.forceKeepAttr=void 0,Sn("uponSanitizeAttribute",N,le),rt=le.attrValue,le.forceKeepAttr||($t(Ge,N),!le.keepAttr))continue;if(!ee&&ni(/\/>/i,rt)){$t(Ge,N);continue}Se&&Gc([U,F,K],ft=>{rt=pl(rt,ft," ")});const _t=Fe(N.nodeName);if(Ki(_t,at,rt)){if(we&&(at==="id"||at==="name")&&($t(Ge,N),rt=V+rt),y&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!Xe)switch(m.getAttributeType(_t,at)){case"TrustedHTML":{rt=y.createHTML(rt);break}case"TrustedScriptURL":{rt=y.createScriptURL(rt);break}}try{Xe?N.setAttributeNS(Xe,Ge,rt):N.setAttribute(Ge,rt),hC(e.removed)}catch{}}}Sn("afterSanitizeAttributes",N,null)},vs=function tt(N){let W=null;const le=gs(N);for(Sn("beforeSanitizeShadowDOM",N,null);W=le.nextNode();)Sn("uponSanitizeShadowNode",W,null),!di(W)&&(W.content instanceof r&&tt(W.content),Es(W));Sn("afterSanitizeShadowDOM",N,null)};return e.sanitize=function(tt){let N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},W=null,le=null,ye=null,Ee=null;if(st=!tt,st&&(tt=""),typeof tt!="string"&&!ci(tt))if(typeof tt.toString=="function"){if(tt=tt.toString(),typeof tt!="string")throw _l("dirty is not a string, aborting")}else throw _l("toString is not a function");if(!e.isSupported)return tt;if(k||Ue(N),e.removed=[],typeof tt=="string"&&(se=!1),se){if(tt.nodeName){const nt=Fe(tt.nodeName);if(!Y[nt]||me[nt])throw _l("root node is forbidden and cannot be sanitized in-place")}}else if(tt instanceof a)W=yn(""),le=W.ownerDocument.importNode(tt,!0),le.nodeType===1&&le.nodeName==="BODY"||le.nodeName==="HTML"?W=le:W.appendChild(le);else{if(!$&&!Se&&!Ie&&tt.indexOf("<")===-1)return y&&ie?y.createHTML(tt):tt;if(W=yn(tt),!W)return $?null:ie?T:""}W&&B&&Ct(W.firstChild);const Ge=gs(se?tt:W);for(;ye=Ge.nextNode();)di(ye)||(ye.content instanceof r&&vs(ye.content),Es(ye));if(se)return tt;if($){if(de)for(Ee=O.call(W.ownerDocument);W.firstChild;)Ee.appendChild(W.firstChild);else Ee=W;return(ae.shadowroot||ae.shadowrootmode)&&(Ee=S.call(i,Ee,!0)),Ee}let Xe=Ie?W.outerHTML:W.innerHTML;return Ie&&Y["!doctype"]&&W.ownerDocument&&W.ownerDocument.doctype&&W.ownerDocument.doctype.name&&ni(PN,W.ownerDocument.doctype.name)&&(Xe=" -`+Xe),Se&&Gc([U,F,K],nt=>{Xe=pl(Xe,nt," ")}),y&&ie?y.createHTML(Xe):Xe},e.setConfig=function(){let tt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ue(tt),k=!0},e.clearConfig=function(){pt=null,k=!1},e.isValidAttribute=function(tt,N,W){pt||Ue({});const le=Fe(tt),ye=Fe(N);return Ki(le,ye,W)},e.addHook=function(tt,N){typeof N=="function"&&(A[tt]=A[tt]||[],ul(A[tt],N))},e.removeHook=function(tt){if(A[tt])return hC(A[tt])},e.removeHooks=function(tt){A[tt]&&(A[tt]=[])},e.removeAllHooks=function(){A={}},e}UN();function IKe(n){return n.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}const MKe={name:"MarkdownRenderer",props:{host:{type:String,required:!1,default:"http://localhost:9600"},client_id:{type:String,required:!0},markdownText:{type:String,required:!0},discussion_id:{type:[String,Number],default:"0",required:!1},message_id:{value:"0",type:[String,Number],required:!1}},components:{CodeBlock:pKe},setup(n){const e=new Gbe({html:!0,highlight:(s,r)=>{const o=r&&fo.getLanguage(r)?r:"plaintext";return fo.highlight(o,s).value},renderInline:!0,breaks:!0}).use(qHe).use(jo).use(s7e,{figcaption:!0}).use(g7e).use(ZHe,{inlineOpen:"$",inlineClose:"$",blockOpen:"$$",blockClose:"$$"}).use(n7e,{enableRowspan:!0,enableColspan:!0,enableGridTables:!0,enableGridTablesExtra:!0,enableTableIndentation:!0,tableCellPadding:" ",tableCellJoiner:"|",multilineCellStartMarker:"|>",multilineCellEndMarker:"<|",multilineCellPadding:" ",multilineCellJoiner:` -`}),t=mt([]),i=()=>{if(n.markdownText){let s=e.parse(n.markdownText,{}),r=[];t.value=[];for(let o=0;o0&&(t.value.push({type:"html",html:e.renderer.render(r,e.options,{})}),r=[]),t.value.push({type:"code",language:IKe(s[o].info),code:s[o].content}));r.length>0&&(t.value.push({type:"html",html:e.renderer.render(r,e.options,{})}),r=[])}else t.value=[];Ve(()=>{qe.replace()})};return qn(()=>n.markdownText,i),qs(i),{markdownItems:t}}},DKe={class:"break-all container w-full"},kKe={ref:"mdRender",class:"markdown-content"},LKe=["innerHTML"];function PKe(n,e,t,i,s,r){const o=ht("code-block");return w(),M("div",DKe,[u("div",kKe,[(w(!0),M($e,null,ct(i.markdownItems,(a,l)=>(w(),M("div",{key:l},[a.type==="code"?(w(),xt(o,{key:0,host:t.host,language:a.language,code:a.code,discussion_id:t.discussion_id,message_id:t.message_id,client_id:t.client_id},null,8,["host","language","code","discussion_id","message_id","client_id"])):(w(),M("div",{key:1,innerHTML:a.html},null,8,LKe))]))),128))],512)])}const ap=bt(MKe,[["render",PKe]]),UKe={data(){return{show:!1,has_button:!0,message:""}},components:{MarkdownRenderer:ap},methods:{hide(){this.show=!1,this.$emit("ok")},showMessage(n){this.message=n,this.has_button=!0,this.show=!0},showBlockingMessage(n){this.message=n,this.has_button=!1,this.show=!0},updateMessage(n){this.message=n,this.show=!0},hideMessage(){this.show=!1}}},FKe={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50 z-50"},BKe={class:"pl-10 pr-10 bg-bg-light dark:bg-bg-dark p-8 rounded-lg shadow-lg"},GKe={class:"container max-h-500 overflow-y-auto"},zKe={class:"text-lg font-medium"},VKe={class:"mt-4 flex justify-center"},HKe={key:1,"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},qKe=u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"},null,-1),YKe=u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"},null,-1),$Ke=[qKe,YKe];function WKe(n,e,t,i,s,r){const o=ht("MarkdownRenderer");return s.show?(w(),M("div",FKe,[u("div",BKe,[u("div",GKe,[u("div",zKe,[Oe(o,{ref:"mdRender",host:"","markdown-text":s.message,message_id:0,discussion_id:0},null,8,["markdown-text"])])]),u("div",VKe,[s.has_button?(w(),M("button",{key:0,onClick:e[0]||(e[0]=(...a)=>r.hide&&r.hide(...a)),class:"bg-primary hover:bg-primary-light active:scale-95 duration-150 text-white px-4 py-2 rounded-lg shadow-lg hover:bg-secondary-dark"}," OK ")):q("",!0),s.has_button?q("",!0):(w(),M("svg",HKe,$Ke))])])])):q("",!0)}const FN=bt(UKe,[["render",WKe]]);const KKe={props:{progress:{type:Number,required:!0}}},jKe={class:"progress-bar-container"};function QKe(n,e,t,i,s,r){return w(),M("div",jKe,[u("div",{class:"progress-bar",style:en({width:`${t.progress}%`})},null,4)])}const ic=bt(KKe,[["render",QKe]]),XKe={setup(){return{}},name:"UniversalForm",data(){return{show:!1,resolve:null,controls_array:[],title:"Universal form",ConfirmButtonText:"Submit",DenyButtonText:"Cancel"}},mounted(){Ve(()=>{qe.replace()})},methods:{btn_clicked(n){console.log(n)},hide(n){this.show=!1,this.resolve&&n&&(this.resolve(this.controls_array),this.resolve=null)},showForm(n,e,t,i){this.ConfirmButtonText=t||this.ConfirmButtonText,this.DenyButtonText=i||this.DenyButtonText;for(let s=0;s{this.controls_array=n,this.show=!0,this.title=e||this.title,this.resolve=s,console.log("show form",this.controls_array)})}},watch:{controls_array:{deep:!0,handler(n){n.forEach(e=>{e.type==="int"?e.value=parseInt(e.value):e.type==="float"&&(e.value=parseFloat(e.value))})}},show(){Ve(()=>{qe.replace()})}}},ZKe={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50 p-4"},JKe={class:"relative w-full max-w-md"},eje={class:"flex flex-col rounded-lg bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel duration-150 shadow-lg max-h-screen"},tje={class:"flex flex-row flex-grow items-center m-2 p-1"},nje={class:"grow flex items-center"},ije=u("i",{"data-feather":"sliders",class:"mr-2 flex-shrink-0"},null,-1),sje={class:"text-lg font-semibold select-none mr-2"},rje={class:"items-end"},oje=u("svg",{"aria-hidden":"true",class:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1),aje=u("span",{class:"sr-only"},"Close form modal",-1),lje=[oje,aje],cje={class:"flex flex-col relative no-scrollbar overflow-y-scroll p-2"},dje={class:"px-2"},uje={key:0},pje={key:0},_je={class:"text-base font-semibold"},hje={key:0,class:"relative inline-flex"},fje=["onUpdate:modelValue"],mje=u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[u("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),gje={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},bje=["onUpdate:modelValue"],Eje={key:1},vje={class:"text-base font-semibold"},yje={key:0,class:"relative inline-flex"},Sje=["onUpdate:modelValue"],Tje=u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[u("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),xje={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},Cje=["onUpdate:modelValue"],Rje=["value","selected"],Aje={key:1},wje={class:"",onclick:"btn_clicked(item)"},Nje={key:2},Oje={key:0},Ije={class:"text-base font-semibold"},Mje={key:0,class:"relative inline-flex"},Dje=["onUpdate:modelValue"],kje=u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[u("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),Lje={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},Pje=["onUpdate:modelValue"],Uje={key:1},Fje={class:"text-base font-semibold"},Bje={key:0,class:"relative inline-flex"},Gje=["onUpdate:modelValue"],zje=u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[u("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),Vje={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},Hje=["onUpdate:modelValue"],qje=["value","selected"],Yje={key:3},$je={class:"text-base font-semibold"},Wje={key:0,class:"relative inline-flex"},Kje=["onUpdate:modelValue"],jje=u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[u("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),Qje={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},Xje=["onUpdate:modelValue"],Zje=["onUpdate:modelValue","min","max"],Jje={key:4},eQe={class:"text-base font-semibold"},tQe={key:0,class:"relative inline-flex"},nQe=["onUpdate:modelValue"],iQe=u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[u("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),sQe={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},rQe=["onUpdate:modelValue"],oQe=["onUpdate:modelValue","min","max"],aQe={key:5},lQe={class:"mb-2 relative flex items-center gap-2"},cQe={for:"default-checkbox",class:"text-base font-semibold"},dQe=["onUpdate:modelValue"],uQe={key:0,class:"relative inline-flex"},pQe=["onUpdate:modelValue"],_Qe=u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[u("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),hQe={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},fQe={key:6},mQe={class:"text-base font-semibold"},gQe={key:0,class:"relative inline-flex"},bQe=["onUpdate:modelValue"],EQe=u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[u("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),vQe={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},yQe=["onUpdate:modelValue"],SQe=u("hr",{class:"h-px my-4 bg-gray-200 border-0 dark:bg-gray-700"},null,-1),TQe={class:"flex flex-row flex-grow gap-3"},xQe={class:"p-2 text-center grow"};function CQe(n,e,t,i,s,r){return s.show?(w(),M("div",ZKe,[u("div",JKe,[u("div",eje,[u("div",tje,[u("div",nje,[ije,u("h3",sje,fe(s.title),1)]),u("div",rje,[u("button",{type:"button",onClick:e[0]||(e[0]=Te(o=>r.hide(!1),["stop"])),title:"Close",class:"bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-800 dark:hover:text-white"},lje)])]),u("div",cje,[(w(!0),M($e,null,ct(s.controls_array,(o,a)=>(w(),M("div",dje,[o.type=="str"||o.type=="string"?(w(),M("div",uje,[o.options?q("",!0):(w(),M("div",pje,[u("label",{class:Ye(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[u("div",_je,fe(o.name)+": ",1),o.help?(w(),M("label",hje,[ne(u("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,fje),[[ut,o.isHelp]]),mje])):q("",!0)],2),o.isHelp?(w(),M("p",gje,fe(o.help),1)):q("",!0),ne(u("input",{type:"text","onUpdate:modelValue":l=>o.value=l,class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Enter string"},null,8,bje),[[Pe,o.value]])])),o.options?(w(),M("div",Eje,[u("label",{class:Ye(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[u("div",vje,fe(o.name)+": ",1),o.help?(w(),M("label",yje,[ne(u("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,Sje),[[ut,o.isHelp]]),Tje])):q("",!0)],2),o.isHelp?(w(),M("p",xje,fe(o.help),1)):q("",!0),ne(u("select",{"onUpdate:modelValue":l=>o.value=l,class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},[(w(!0),M($e,null,ct(o.options,l=>(w(),M("option",{value:l,selected:o.value===l},fe(l),9,Rje))),256))],8,Cje),[[zn,o.value]])])):q("",!0)])):q("",!0),o.type=="btn"?(w(),M("div",Aje,[u("button",wje,fe(o.name),1)])):q("",!0),o.type=="text"?(w(),M("div",Nje,[o.options?q("",!0):(w(),M("div",Oje,[u("label",{class:Ye(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[u("div",Ije,fe(o.name)+": ",1),o.help?(w(),M("label",Mje,[ne(u("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,Dje),[[ut,o.isHelp]]),kje])):q("",!0)],2),o.isHelp?(w(),M("p",Lje,fe(o.help),1)):q("",!0),ne(u("textarea",{"onUpdate:modelValue":l=>o.value=l,class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Enter string"},null,8,Pje),[[Pe,o.value]])])),o.options?(w(),M("div",Uje,[u("label",{class:Ye(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[u("div",Fje,fe(o.name)+": ",1),o.help?(w(),M("label",Bje,[ne(u("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,Gje),[[ut,o.isHelp]]),zje])):q("",!0)],2),o.isHelp?(w(),M("p",Vje,fe(o.help),1)):q("",!0),ne(u("select",{"onUpdate:modelValue":l=>o.value=l,class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},[(w(!0),M($e,null,ct(o.options,l=>(w(),M("option",{value:l,selected:o.value===l},fe(l),9,qje))),256))],8,Hje),[[zn,o.value]])])):q("",!0)])):q("",!0),o.type=="int"?(w(),M("div",Yje,[u("label",{class:Ye(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[u("div",$je,fe(o.name)+": ",1),o.help?(w(),M("label",Wje,[ne(u("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,Kje),[[ut,o.isHelp]]),jje])):q("",!0)],2),o.isHelp?(w(),M("p",Qje,fe(o.help),1)):q("",!0),ne(u("input",{type:"number","onUpdate:modelValue":l=>o.value=l,step:"1",class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Enter number"},null,8,Xje),[[Pe,o.value]]),o.min!=null&&o.max!=null?ne((w(),M("input",{key:1,type:"range","onUpdate:modelValue":l=>o.value=l,min:o.min,max:o.max,step:"1",class:"flex-none h-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,8,Zje)),[[Pe,o.value]]):q("",!0)])):q("",!0),o.type=="float"?(w(),M("div",Jje,[u("label",{class:Ye(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[u("div",eQe,fe(o.name)+": ",1),o.help?(w(),M("label",tQe,[ne(u("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,nQe),[[ut,o.isHelp]]),iQe])):q("",!0)],2),o.isHelp?(w(),M("p",sQe,fe(o.help),1)):q("",!0),ne(u("input",{type:"number","onUpdate:modelValue":l=>o.value=l,class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Enter number"},null,8,rQe),[[Pe,o.value]]),o.min!=null&&o.max!=null?ne((w(),M("input",{key:1,type:"range","onUpdate:modelValue":l=>o.value=l,min:o.min,max:o.max,step:"0.1",class:"flex-none h-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,8,oQe)),[[Pe,o.value]]):q("",!0)])):q("",!0),o.type=="bool"?(w(),M("div",aQe,[u("div",lQe,[u("label",cQe,fe(o.name)+": ",1),ne(u("input",{type:"checkbox","onUpdate:modelValue":l=>o.value=l,class:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"},null,8,dQe),[[ut,o.value]]),o.help?(w(),M("label",uQe,[ne(u("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,pQe),[[ut,o.isHelp]]),_Qe])):q("",!0)]),o.isHelp?(w(),M("p",hQe,fe(o.help),1)):q("",!0)])):q("",!0),o.type=="list"?(w(),M("div",fQe,[u("label",{class:Ye(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[u("div",mQe,fe(o.name)+": ",1),o.help?(w(),M("label",gQe,[ne(u("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,bQe),[[ut,o.isHelp]]),EQe])):q("",!0)],2),o.isHelp?(w(),M("p",vQe,fe(o.help),1)):q("",!0),ne(u("input",{type:"text","onUpdate:modelValue":l=>o.value=l,class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Enter comma separated values"},null,8,yQe),[[Pe,o.value]])])):q("",!0),SQe]))),256)),u("div",TQe,[u("div",xQe,[u("button",{onClick:e[1]||(e[1]=Te(o=>r.hide(!0),["stop"])),type:"button",class:"mr-2 text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"},fe(s.ConfirmButtonText),1),u("button",{onClick:e[2]||(e[2]=Te(o=>r.hide(!1),["stop"])),type:"button",class:"text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-11 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600"},fe(s.DenyButtonText),1)])])])])])])):q("",!0)}const Ec=bt(XKe,[["render",CQe]]),RQe={data(){return{show:!1,message:"",resolve:null,ConfirmButtonText:"Yes, I'm sure",DenyButtonText:"No, cancel"}},methods:{hide(n){this.show=!1,this.resolve&&(this.resolve(n),this.resolve=null)},askQuestion(n,e,t){return this.ConfirmButtonText=e||this.ConfirmButtonText,this.DenyButtonText=t||this.DenyButtonText,new Promise(i=>{this.message=n,this.show=!0,this.resolve=i})}}},AQe={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50"},wQe={class:"relative w-full max-w-md max-h-full"},NQe={class:"relative bg-white rounded-lg shadow dark:bg-gray-700"},OQe=u("svg",{"aria-hidden":"true",class:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1),IQe=u("span",{class:"sr-only"},"Close modal",-1),MQe=[OQe,IQe],DQe={class:"p-4 text-center"},kQe=u("svg",{"aria-hidden":"true",class:"mx-auto mb-4 text-gray-400 w-14 h-14 dark:text-gray-200",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1),LQe={class:"mb-5 text-lg font-normal text-gray-500 dark:text-gray-400 select-none break-all"};function PQe(n,e,t,i,s,r){return s.show?(w(),M("div",AQe,[u("div",wQe,[u("div",NQe,[u("button",{type:"button",onClick:e[0]||(e[0]=o=>r.hide(!1)),class:"absolute top-3 right-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-800 dark:hover:text-white"},MQe),u("div",DQe,[kQe,u("h3",LQe,fe(s.message),1),u("button",{onClick:e[1]||(e[1]=o=>r.hide(!0)),type:"button",class:"text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 dark:focus:ring-red-800 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2"},fe(s.ConfirmButtonText),1),u("button",{onClick:e[2]||(e[2]=o=>r.hide(!1)),type:"button",class:"text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600"},fe(s.DenyButtonText),1)])])])])):q("",!0)}const BN=bt(RQe,[["render",PQe]]),UQe={props:{personality:{type:Object,required:!0},config:{type:Object,required:!0}},data(){return{show:!1,title:"Add AI Agent",iconUrl:"",file:null,tempConfig:{}}},methods:{showForm(){this.showDialog=!0},hideForm(){this.showDialog=!1},selectIcon(n){n.target.files&&(this.file=n.target.files[0],this.iconUrl=URL.createObjectURL(this.file))},showPanel(){this.show=!0},hide(){this.show=!1},submitForm(){Me.post("/set_personality_config",{category:this.personality.category,name:this.personality.folder,config:this.config}).then(n=>{const e=n.data;console.log("Done"),e.status?(this.currentPersonConfig=e.config,this.showPersonalityEditor=!0):console.error(e.error)}).catch(n=>{console.error(n)})}}},FQe={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50 z-20"},BQe={class:"relative w-full max-h-full bg-bg-light dark:bg-bg-dark"},GQe={class:"w-full h-full relative items-center gap-2 rounded-lg border bg-bg-light dark:bg-bg-dark p-1.5 shadow-sm hover:shadow-none dark:border-gray-800 dark:bg-gray-900"},zQe=u("svg",{"aria-hidden":"true",class:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1),VQe=u("span",{class:"sr-only"},"Close modal",-1),HQe=[zQe,VQe],qQe={class:"justify-center text-center items-center w-full bg-bg-light dark:bg-bg-dark"},YQe={class:"w-full flex flex-row mt-4 text-center justify-center"},$Qe={class:"w-full max-h-full container bg-bg-light dark:bg-bg-dark"},WQe={class:"mb-4 w-full"},KQe={class:"w-full bg-bg-light dark:bg-bg-dark"},jQe=u("td",null,[u("label",{for:"personalityConditioning"},"Personality Conditioning:")],-1),QQe=u("td",null,[u("label",{for:"userMessagePrefix"},"User Message Prefix:")],-1),XQe=u("td",null,[u("label",{for:"aiMessagePrefix"},"AI Message Prefix:")],-1),ZQe=u("td",null,[u("label",{for:"linkText"},"Link Text:")],-1),JQe=u("td",null,[u("label",{for:"welcomeMessage"},"Welcome Message:")],-1),eXe=u("td",null,[u("label",{for:"modelTemperature"},"Model Temperature:")],-1),tXe=u("td",null,[u("label",{for:"modelNPredicts"},"Model N Predicts:")],-1),nXe=u("td",null,[u("label",{for:"modelNPredicts"},"Model N Predicts:")],-1),iXe=u("td",null,[u("label",{for:"modelTopK"},"Model Top K:")],-1),sXe=u("td",null,[u("label",{for:"modelTopP"},"Model Top P:")],-1),rXe=u("td",null,[u("label",{for:"modelRepeatPenalty"},"Model Repeat Penalty:")],-1),oXe=u("td",null,[u("label",{for:"modelRepeatLastN"},"Model Repeat Last N:")],-1),aXe=u("td",null,[u("label",{for:"recommendedBinding"},"Recommended Binding:")],-1),lXe=u("td",null,[u("label",{for:"recommendedModel"},"Recommended Model:")],-1),cXe=u("td",null,[u("label",{class:"dark:bg-black dark:text-primary w-full",for:"dependencies"},"Dependencies:")],-1),dXe=u("td",null,[u("label",{for:"antiPrompts"},"Anti Prompts:")],-1);function uXe(n,e,t,i,s,r){return s.show?(w(),M("div",FQe,[u("div",BQe,[u("div",GQe,[u("button",{type:"button",onClick:e[0]||(e[0]=o=>r.hide()),class:"absolute top-1 right-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-800 dark:hover:text-white"},HQe),u("div",qQe,[u("div",YQe,[u("button",{type:"submit",onClick:e[1]||(e[1]=Te((...o)=>r.submitForm&&r.submitForm(...o),["prevent"])),class:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"}," Commit AI to Server "),u("button",{onClick:e[2]||(e[2]=Te(o=>r.hide(),["prevent"])),class:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"}," Close ")]),u("div",$Qe,[u("form",WQe,[u("table",KQe,[u("tr",null,[jQe,u("td",null,[ne(u("textarea",{class:"dark:bg-black dark:text-primary w-full",id:"personalityConditioning","onUpdate:modelValue":e[3]||(e[3]=o=>t.config.personality_conditioning=o)},null,512),[[Pe,t.config.personality_conditioning]])])]),u("tr",null,[QQe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"text",id:"userMessagePrefix","onUpdate:modelValue":e[4]||(e[4]=o=>t.config.user_message_prefix=o)},null,512),[[Pe,t.config.user_message_prefix]])])]),u("tr",null,[XQe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"text",id:"aiMessagePrefix","onUpdate:modelValue":e[5]||(e[5]=o=>t.config.ai_message_prefix=o)},null,512),[[Pe,t.config.ai_message_prefix]])])]),u("tr",null,[ZQe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"text",id:"linkText","onUpdate:modelValue":e[6]||(e[6]=o=>t.config.link_text=o)},null,512),[[Pe,t.config.link_text]])])]),u("tr",null,[JQe,u("td",null,[ne(u("textarea",{class:"dark:bg-black dark:text-primary w-full",id:"welcomeMessage","onUpdate:modelValue":e[7]||(e[7]=o=>t.config.welcome_message=o)},null,512),[[Pe,t.config.welcome_message]])])]),u("tr",null,[eXe,u("td",null,[ne(u("input",{type:"number",id:"modelTemperature","onUpdate:modelValue":e[8]||(e[8]=o=>t.config.model_temperature=o)},null,512),[[Pe,t.config.model_temperature]])])]),u("tr",null,[tXe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"number",id:"modelNPredicts","onUpdate:modelValue":e[9]||(e[9]=o=>t.config.model_n_predicts=o)},null,512),[[Pe,t.config.model_n_predicts]])])]),u("tr",null,[nXe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"number",id:"modelNPredicts","onUpdate:modelValue":e[10]||(e[10]=o=>t.config.model_n_predicts=o)},null,512),[[Pe,t.config.model_n_predicts]])])]),u("tr",null,[iXe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"number",id:"modelTopK","onUpdate:modelValue":e[11]||(e[11]=o=>t.config.model_top_k=o)},null,512),[[Pe,t.config.model_top_k]])])]),u("tr",null,[sXe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"number",id:"modelTopP","onUpdate:modelValue":e[12]||(e[12]=o=>t.config.model_top_p=o)},null,512),[[Pe,t.config.model_top_p]])])]),u("tr",null,[rXe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"number",id:"modelRepeatPenalty","onUpdate:modelValue":e[13]||(e[13]=o=>t.config.model_repeat_penalty=o)},null,512),[[Pe,t.config.model_repeat_penalty]])])]),u("tr",null,[oXe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"number",id:"modelRepeatLastN","onUpdate:modelValue":e[14]||(e[14]=o=>t.config.model_repeat_last_n=o)},null,512),[[Pe,t.config.model_repeat_last_n]])])]),u("tr",null,[aXe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"text",id:"recommendedBinding","onUpdate:modelValue":e[15]||(e[15]=o=>t.config.recommended_binding=o)},null,512),[[Pe,t.config.recommended_binding]])])]),u("tr",null,[lXe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"text",id:"recommendedModel","onUpdate:modelValue":e[16]||(e[16]=o=>t.config.recommended_model=o)},null,512),[[Pe,t.config.recommended_model]])])]),u("tr",null,[cXe,u("td",null,[ne(u("textarea",{class:"dark:bg-black dark:text-primary w-full",id:"dependencies","onUpdate:modelValue":e[17]||(e[17]=o=>t.config.dependencies=o)},null,512),[[Pe,t.config.dependencies]])])]),u("tr",null,[dXe,u("td",null,[ne(u("textarea",{class:"dark:bg-black dark:text-primary w-full",id:"antiPrompts","onUpdate:modelValue":e[18]||(e[18]=o=>t.config.anti_prompts=o)},null,512),[[Pe,t.config.anti_prompts]])])])])])])])])])])):q("",!0)}const GN=bt(UQe,[["render",uXe]]);const pXe={data(){return{showPopup:!1,webpageUrl:"https://lollms.com/"}},methods:{show(){this.showPopup=!0},hide(){this.showPopup=!1},save_configuration(){Me.post("/apply_settings",{client_id:this.$store.state.client_id,config:this.$store.state.config}).then(n=>{this.isLoading=!1,n.data.status?(this.$store.state.toast.showToast("Configuration changed successfully.",4,!0),this.settingsChanged=!1):this.$store.state.toast.showToast("Configuration change failed.",4,!1)})}}},_Xe=n=>(Nr("data-v-d504dfc9"),n=n(),Or(),n),hXe={key:0,class:"fixed inset-0 flex items-center justify-center z-50"},fXe={class:"popup-container"},mXe=["src"],gXe={class:"checkbox-container"},bXe=_Xe(()=>u("label",{for:"startup",class:"checkbox-label"},"Show at startup",-1));function EXe(n,e,t,i,s,r){return w(),xt(ls,{name:"fade"},{default:Je(()=>[s.showPopup?(w(),M("div",hXe,[u("div",fXe,[u("button",{onClick:e[0]||(e[0]=(...o)=>r.hide&&r.hide(...o)),class:"close-button"}," X "),u("iframe",{src:s.webpageUrl,class:"iframe-content"},null,8,mXe),u("div",gXe,[ne(u("input",{type:"checkbox",id:"startup",class:"styled-checkbox","onUpdate:modelValue":e[1]||(e[1]=o=>this.$store.state.config.show_news_panel=o),onChange:e[2]||(e[2]=(...o)=>r.save_configuration&&r.save_configuration(...o))},null,544),[[ut,this.$store.state.config.show_news_panel]]),bXe])])])):q("",!0)]),_:1})}const zN=bt(pXe,[["render",EXe],["__scopeId","data-v-d504dfc9"]]),VN="/assets/fastapi-4a6542d0.png",HN="/assets/discord-6817c341.svg";const vXe={key:0,class:"container flex flex-col sm:flex-row items-center"},yXe={class:"w-full"},SXe={class:"flex flex-row font-medium nav-ul"},qN={__name:"Navigation",setup(n){return(e,t)=>e.$store.state.ready?(w(),M("div",vXe,[u("div",yXe,[u("div",SXe,[Oe(vt(cr),{to:{name:"discussions"},class:"link-item dark:link-item-dark bg-light hover:bg-bg-light-tone dark:bg-bg-dark-tone hover:dark:bg-bg-light-tone"},{default:Je(()=>[je(" Discussions ")]),_:1}),Oe(vt(cr),{to:{name:"playground"},class:"link-item dark:link-item-dark bg-light hover:bg-bg-light-tone dark:bg-bg-dark-tone hover:dark:bg-bg-light-tone"},{default:Je(()=>[je(" Playground ")]),_:1}),e.$store.state.config.enable_comfyui_service?(w(),xt(vt(cr),{key:0,to:{name:"ComfyUI"},class:"link-item dark:link-item-dark bg-light hover:bg-bg-light-tone dark:bg-bg-dark-tone hover:dark:bg-bg-light-tone"},{default:Je(()=>[je(" ComfyUI ")]),_:1})):q("",!0),e.$store.state.config.enable_voice_service?(w(),xt(vt(cr),{key:1,to:{name:"interactive"},class:"link-item dark:link-item-dark bg-light hover:bg-bg-light-tone dark:bg-bg-dark-tone hover:dark:bg-bg-light-tone"},{default:Je(()=>[je(" interactive ")]),_:1})):q("",!0),Oe(vt(cr),{to:{name:"settings"},class:"link-item dark:link-item-dark bg-light hover:bg-bg-light-tone dark:bg-bg-dark-tone hover:dark:bg-bg-light-tone"},{default:Je(()=>[je(" Settings ")]),_:1}),Oe(vt(cr),{to:{name:"help"},class:"link-item dark:link-item-dark bg-light hover:bg-bg-light-tone dark:bg-bg-dark-tone hover:dark:bg-bg-light-tone"},{default:Je(()=>[je(" Help ")]),_:1})])])])):q("",!0)}},YN="/assets/static_info-b284ded1.svg",TXe="/assets/animated_info-7edcb0f9.svg";const xXe={class:"top-0 shadow-lg"},CXe={class:"container flex flex-col lg:flex-row item-center gap-2 pb-0"},RXe=u("div",{class:"flex items-center gap-3 flex-1"},[u("img",{class:"w-12 hover:scale-95 duration-150",title:"LoLLMS WebUI",src:ga,alt:"Logo"}),u("div",{class:"flex flex-col"},[u("p",{class:"text-2xl"},"LoLLMS"),u("p",{class:"text-gray-400"},"One tool to rule them all")])],-1),AXe={class:"flex gap-3 flex-1 items-center justify-end"},wXe={key:0,title:"Model is ok",class:"text-green-500 cursor-pointer"},NXe=u("b",{class:"text-2xl"},"M",-1),OXe=[NXe],IXe={key:1,title:"Model is not ok",class:"text-red-500 cursor-pointer"},MXe=u("b",{class:"text-2xl"},"M",-1),DXe=[MXe],kXe={key:2,title:"Text is not being generated. Ready to generate",class:"text-green-500 cursor-pointer"},LXe=u("i",{"data-feather":"flag"},null,-1),PXe=[LXe],UXe={key:3,title:"Generation in progress...",class:"text-red-500 cursor-pointer"},FXe=u("i",{"data-feather":"flag"},null,-1),BXe=[FXe],GXe={key:4,title:"Connection status: Connected",class:"text-green-500 cursor-pointer"},zXe=u("i",{"data-feather":"zap"},null,-1),VXe=[zXe],HXe={key:5,title:"Connection status: Not connected",class:"text-red-500 cursor-pointer"},qXe=u("i",{"data-feather":"zap-off"},null,-1),YXe=[qXe],$Xe=u("div",{class:"text-2xl hover:text-primary duration-150",title:"restart program"},[u("i",{"data-feather":"power"})],-1),WXe=[$Xe],KXe=u("div",{class:"text-2xl hover:text-primary duration-150",title:"refresh page"},[u("i",{"data-feather":"refresh-ccw"})],-1),jXe=[KXe],QXe={href:"https://github.com/ParisNeo/lollms-webui",target:"_blank"},XXe={class:"text-2xl hover:text-primary duration-150",title:"Fast API doc"},ZXe={href:"/docs",target:"_blank"},JXe=["src"],eZe=zu('
',2),tZe={href:"https://twitter.com/SpaceNerduino",target:"_blank"},nZe={class:"text-2xl hover:fill-primary dark:fill-white dark:hover:fill-primary duration-150",title:"Follow me on my twitter acount"},iZe={class:"w-10 h-10 rounded-lg object-fill dark:text-white",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1668.56 1221.19",style:{"enable-background":"new 0 0 1668.56 1221.19"},"xml:space":"preserve"},sZe=u("g",{id:"layer1",transform:"translate(52.390088,-25.058597)"},[u("path",{id:"path1009",d:`M283.94,167.31l386.39,516.64L281.5,1104h87.51l340.42-367.76L984.48,1104h297.8L874.15,558.3l361.92-390.99\r - h-87.51l-313.51,338.7l-253.31-338.7H283.94z M412.63,231.77h136.81l604.13,807.76h-136.81L412.63,231.77z`})],-1),rZe=[sZe],oZe={href:"https://discord.com/channels/1092918764925882418",target:"_blank"},aZe={class:"text-2xl hover:text-primary duration-150",title:"Visit my discord channel"},lZe=["src"],cZe=u("i",{"data-feather":"sun"},null,-1),dZe=[cZe],uZe=u("i",{"data-feather":"moon"},null,-1),pZe=[uZe],_Ze=["src"],hZe={role:"status",class:"fixed m-0 p-2 left-2 bottom-2 min-w-[24rem] max-w-[24rem] h-20 flex flex-col justify-center items-center pb-4 bg-blue-500 rounded-lg shadow-lg z-50 background-a"},fZe={class:"text-2xl animate-pulse mt-2 text-white"},mZe={id:"app"},gZe=u("body",null,null,-1),bZe={name:"TopBar",computed:{currentPersonConfig(){try{return this.$store.state.currentPersonConfig}catch{console.log("Error finding current personality configuration");return}},selectedPersonality(){try{return this.$store.state.selectedPersonality}catch{console.log("Error finding current personality configuration");return}},loading_infos(){return this.$store.state.loading_infos},isModelOK(){return this.$store.state.isModelOk},isGenerating(){return this.$store.state.isGenerating},isConnected(){return this.$store.state.isConnected}},components:{Toast:fc,MessageBox:FN,ProgressBar:ic,UniversalForm:Ec,YesNoDialog:BN,Navigation:qN,PersonalityEditor:GN,PopupViewer:zN},watch:{isConnected(){this.isConnected?(console.log("this.is_first_connection"),console.log(this.is_first_connection),this.is_first_connection||(this.$store.state.messageBox.hideMessage(),this.$store.state.messageBox.showMessage("Server connected."),this.$store.state.config.activate_audio_infos&&this.connection_recovered_audio.play())):(this.$store.state.messageBox.showBlockingMessage("Server suddenly disconnected. Please reboot the server to recover the connection"),this.is_first_connection=!1,console.log("this.is_first_connection set to false"),console.log(this.is_first_connection),this.$store.state.config.activate_audio_infos&&this.connection_lost_audio.play()),Ve(()=>{qe.replace()})}},data(){return{static_info:YN,animated_info:TXe,is_first_connection:!0,discord:HN,FastAPI:VN,rebooting_audio:new Audio("rebooting.wav"),connection_lost_audio:new Audio("connection_lost.wav"),connection_recovered_audio:new Audio("connection_recovered.wav"),database_selectorDialogVisible:!1,progress_visibility:!1,progress_value:0,codeBlockStylesheet:"",sunIcon:document.querySelector(".sun"),moonIcon:document.querySelector(".moon"),userTheme:localStorage.getItem("theme"),systemTheme:window.matchMedia("prefers-color-scheme: dark").matches}},mounted(){this.$store.state.toast=this.$refs.toast,this.$store.state.news=this.$refs.news,this.$store.state.messageBox=this.$refs.messageBox,this.$store.state.universalForm=this.$refs.universalForm,this.$store.state.yesNoDialog=this.$refs.yesNoDialog,this.$store.state.personality_editor=this.$refs.personality_editor,this.sunIcon=document.querySelector(".sun"),this.moonIcon=document.querySelector(".moon"),this.userTheme=localStorage.getItem("theme"),this.systemTheme=window.matchMedia("prefers-color-scheme: dark").matches,this.themeCheck(),Ve(()=>{qe.replace()})},created(){this.sunIcon=document.querySelector(".sun"),this.moonIcon=document.querySelector(".moon"),this.userTheme=localStorage.getItem("theme"),this.systemTheme=window.matchMedia("prefers-color-scheme: dark").matches},methods:{restartProgram(n){n.preventDefault(),this.$store.state.api_get_req("restart_program"),this.rebooting_audio.play(),this.$store.state.toast.showToast("Rebooting the app. Please wait...",410,!1),console.log("this.$store.state.api_get_req",this.$store.state.api_get_req),setTimeout(()=>{window.close()},2e3)},refreshPage(){window.location.href.split("/").length>4?window.location.href="/":window.location.reload(!0)},handleOk(n){console.log("Input text:",n)},showNews(){this.$store.state.news.show()},themeCheck(){if(this.userTheme=="dark"||!this.userTheme&&this.systemTheme){document.documentElement.classList.add("dark"),this.moonIcon.classList.add("display-none"),Ve(()=>{Fp(()=>Promise.resolve({}),["assets/stackoverflow-dark-57af98f5.css"])});return}Ve(()=>{Fp(()=>Promise.resolve({}),["assets/stackoverflow-light-077a2b3c.css"])}),this.sunIcon.classList.add("display-none")},themeSwitch(){if(document.documentElement.classList.contains("dark")){document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light"),this.userTheme=="light",this.iconToggle();return}Fp(()=>Promise.resolve({}),["assets/tokyo-night-dark-f9656fc4.css"]),document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark"),this.userTheme=="dark",this.iconToggle()},iconToggle(){this.sunIcon.classList.toggle("display-none"),this.moonIcon.classList.toggle("display-none")}}},EZe=Object.assign(bZe,{setup(n){return(e,t)=>(w(),M($e,null,[u("header",xXe,[u("nav",CXe,[Oe(vt(cr),{to:{name:"discussions"}},{default:Je(()=>[RXe]),_:1}),u("div",AXe,[e.isModelOK?(w(),M("div",wXe,OXe)):q("",!0),e.isModelOK?q("",!0):(w(),M("div",IXe,DXe)),e.isGenerating?q("",!0):(w(),M("div",kXe,PXe)),e.isGenerating?(w(),M("div",UXe,BXe)):q("",!0),e.isConnected?(w(),M("div",GXe,VXe)):q("",!0),e.isConnected?q("",!0):(w(),M("div",HXe,YXe)),u("a",{href:"#",onClick:t[0]||(t[0]=(...i)=>e.restartProgram&&e.restartProgram(...i))},WXe),u("a",{href:"#",onClick:t[1]||(t[1]=(...i)=>e.refreshPage&&e.refreshPage(...i))},jXe),u("a",QXe,[u("div",XXe,[u("a",ZXe,[u("img",{src:vt(VN),width:"75",height:"25"},null,8,JXe)])])]),eZe,u("a",tZe,[u("div",nZe,[(w(),M("svg",iZe,rZe))])]),u("a",oZe,[u("div",aZe,[u("img",{src:vt(HN),width:"25",height:"25"},null,8,lZe)])]),u("div",{class:"sun text-2xl w-6 hover:text-primary duration-150 cursor-pointer",title:"Swith to Light theme",onClick:t[2]||(t[2]=i=>e.themeSwitch())},dZe),u("div",{class:"moon text-2xl w-6 hover:text-primary duration-150 cursor-pointer",title:"Swith to Dark theme",onClick:t[3]||(t[3]=i=>e.themeSwitch())},pZe),u("div",{class:"moon text-2xl w-6 hover:text-primary duration-150 cursor-pointer",title:"Lollms News",onClick:t[4]||(t[4]=i=>e.showNews())},[u("img",{src:vt(YN)},null,8,_Ze)])])]),Oe(qN),Oe(fc,{ref:"toast"},null,512),Oe(FN,{ref:"messageBox"},null,512),ne(u("div",hZe,[Oe(ic,{ref:"progress",progress:e.progress_value,class:"w-full h-4"},null,8,["progress"]),u("p",fZe,fe(e.loading_infos)+" ...",1)],512),[[Ot,e.progress_visibility]]),Oe(Ec,{ref:"universalForm",class:"z-20"},null,512),Oe(BN,{ref:"yesNoDialog",class:"z-20"},null,512),Oe(GN,{ref:"personality_editor",config:e.currentPersonConfig,personality:e.selectedPersonality},null,8,["config","personality"]),u("div",mZe,[Oe(zN,{ref:"news"},null,512)])]),gZe],64))}}),vZe={class:"flex overflow-hidden flex-grow w-full"},yZe={__name:"App",setup(n){return(e,t)=>(w(),M("div",{class:Ye([e.currentTheme,"flex flex-col h-screen font-sans bg-bg-light text-slate-950 dark:bg-bg-dark dark:text-slate-50 w-full dark:bg-bg-dark overflow-hidden"])},[Oe(EZe),u("div",vZe,[Oe(vt(Ww),null,{default:Je(({Component:i})=>[(w(),xt(P2,null,[(w(),xt(Fu(i)))],1024))]),_:1})])],2))}},cs=Object.create(null);cs.open="0";cs.close="1";cs.ping="2";cs.pong="3";cs.message="4";cs.upgrade="5";cs.noop="6";const Pd=Object.create(null);Object.keys(cs).forEach(n=>{Pd[cs[n]]=n});const Xg={type:"error",data:"parser error"},$N=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",WN=typeof ArrayBuffer=="function",KN=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,vE=({type:n,data:e},t,i)=>$N&&e instanceof Blob?t?i(e):vC(e,i):WN&&(e instanceof ArrayBuffer||KN(e))?t?i(e):vC(new Blob([e]),i):i(cs[n]+(e||"")),vC=(n,e)=>{const t=new FileReader;return t.onload=function(){const i=t.result.split(",")[1];e("b"+(i||""))},t.readAsDataURL(n)};function yC(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let Um;function SZe(n,e){if($N&&n.data instanceof Blob)return n.data.arrayBuffer().then(yC).then(e);if(WN&&(n.data instanceof ArrayBuffer||KN(n.data)))return e(yC(n.data));vE(n,!1,t=>{Um||(Um=new TextEncoder),e(Um.encode(t))})}const SC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Al=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n{let e=n.length*.75,t=n.length,i,s=0,r,o,a,l;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const d=new ArrayBuffer(e),c=new Uint8Array(d);for(i=0;i>4,c[s++]=(o&15)<<4|a>>2,c[s++]=(a&3)<<6|l&63;return d},xZe=typeof ArrayBuffer=="function",yE=(n,e)=>{if(typeof n!="string")return{type:"message",data:jN(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:CZe(n.substring(1),e)}:Pd[t]?n.length>1?{type:Pd[t],data:n.substring(1)}:{type:Pd[t]}:Xg},CZe=(n,e)=>{if(xZe){const t=TZe(n);return jN(t,e)}else return{base64:!0,data:n}},jN=(n,e)=>{switch(e){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},QN=String.fromCharCode(30),RZe=(n,e)=>{const t=n.length,i=new Array(t);let s=0;n.forEach((r,o)=>{vE(r,!1,a=>{i[o]=a,++s===t&&e(i.join(QN))})})},AZe=(n,e)=>{const t=n.split(QN),i=[];for(let s=0;s{const i=t.length;let s;if(i<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,i);else if(i<65536){s=new Uint8Array(3);const r=new DataView(s.buffer);r.setUint8(0,126),r.setUint16(1,i)}else{s=new Uint8Array(9);const r=new DataView(s.buffer);r.setUint8(0,127),r.setBigUint64(1,BigInt(i))}n.data&&typeof n.data!="string"&&(s[0]|=128),e.enqueue(s),e.enqueue(t)})}})}let Fm;function Hc(n){return n.reduce((e,t)=>e+t.length,0)}function qc(n,e){if(n[0].length===e)return n.shift();const t=new Uint8Array(e);let i=0;for(let s=0;sMath.pow(2,53-32)-1){a.enqueue(Xg);break}s=c*Math.pow(2,32)+d.getUint32(4),i=3}else{if(Hc(t)n){a.enqueue(Xg);break}}}})}const XN=4;function dn(n){if(n)return OZe(n)}function OZe(n){for(var e in dn.prototype)n[e]=dn.prototype[e];return n}dn.prototype.on=dn.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this};dn.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this};dn.prototype.off=dn.prototype.removeListener=dn.prototype.removeAllListeners=dn.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+n];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var i,s=0;stypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function ZN(n,...e){return e.reduce((t,i)=>(n.hasOwnProperty(i)&&(t[i]=n[i]),t),{})}const IZe=mi.setTimeout,MZe=mi.clearTimeout;function lp(n,e){e.useNativeTimers?(n.setTimeoutFn=IZe.bind(mi),n.clearTimeoutFn=MZe.bind(mi)):(n.setTimeoutFn=mi.setTimeout.bind(mi),n.clearTimeoutFn=mi.clearTimeout.bind(mi))}const DZe=1.33;function kZe(n){return typeof n=="string"?LZe(n):Math.ceil((n.byteLength||n.size)*DZe)}function LZe(n){let e=0,t=0;for(let i=0,s=n.length;i=57344?t+=3:(i++,t+=4);return t}function PZe(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function UZe(n){let e={},t=n.split("&");for(let i=0,s=t.length;i0);return e}function eO(){const n=CC(+new Date);return n!==xC?(TC=0,xC=n):n+"."+CC(TC++)}for(;Yc{this.readyState="paused",e()};if(this.polling||!this.writable){let i=0;this.polling&&(i++,this.once("pollComplete",function(){--i||t()})),this.writable||(i++,this.once("drain",function(){--i||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};AZe(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,RZe(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=eO()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new oa(this.uri(),e)}doWrite(e,t){const i=this.request({method:"POST",data:e});i.on("success",t),i.on("error",(s,r)=>{this.onError("xhr post error",s,r)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,i)=>{this.onError("xhr poll error",t,i)}),this.pollXhr=e}}let oa=class Ud extends dn{constructor(e,t){super(),lp(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=t.data!==void 0?t.data:null,this.create()}create(){var e;const t=ZN(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;const i=this.xhr=new nO(t);try{i.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let s in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(s)&&i.setRequestHeader(s,this.opts.extraHeaders[s])}}catch{}if(this.method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(i),"withCredentials"in i&&(i.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(i.timeout=this.opts.requestTimeout),i.onreadystatechange=()=>{var s;i.readyState===3&&((s=this.opts.cookieJar)===null||s===void 0||s.parseCookies(i)),i.readyState===4&&(i.status===200||i.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof i.status=="number"?i.status:0)},0))},i.send(this.data)}catch(s){this.setTimeoutFn(()=>{this.onError(s)},0);return}typeof document<"u"&&(this.index=Ud.requestsCount++,Ud.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=zZe,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Ud.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};oa.requestsCount=0;oa.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",RC);else if(typeof addEventListener=="function"){const n="onpagehide"in mi?"pagehide":"unload";addEventListener(n,RC,!1)}}function RC(){for(let n in oa.requests)oa.requests.hasOwnProperty(n)&&oa.requests[n].abort()}const TE=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0))(),$c=mi.WebSocket||mi.MozWebSocket,AC=!0,qZe="arraybuffer",wC=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class YZe extends SE{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,i=wC?{}:ZN(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=AC&&!wC?t?new $c(e,t):new $c(e):new $c(e,t,i)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t{const o={};try{AC&&this.ws.send(r)}catch{}s&&TE(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=eO()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!$c}}class $Ze extends SE{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{const t=NZe(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(t).getReader(),s=wZe();s.readable.pipeTo(e.writable),this.writer=s.writable.getWriter();const r=()=>{i.read().then(({done:a,value:l})=>{a||(this.onPacket(l),r())}).catch(a=>{})};r();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let t=0;t{s&&TE(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}}const WZe={websocket:YZe,webtransport:$Ze,polling:HZe},KZe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,jZe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Jg(n){const e=n,t=n.indexOf("["),i=n.indexOf("]");t!=-1&&i!=-1&&(n=n.substring(0,t)+n.substring(t,i).replace(/:/g,";")+n.substring(i,n.length));let s=KZe.exec(n||""),r={},o=14;for(;o--;)r[jZe[o]]=s[o]||"";return t!=-1&&i!=-1&&(r.source=e,r.host=r.host.substring(1,r.host.length-1).replace(/;/g,":"),r.authority=r.authority.replace("[","").replace("]","").replace(/;/g,":"),r.ipv6uri=!0),r.pathNames=QZe(r,r.path),r.queryKey=XZe(r,r.query),r}function QZe(n,e){const t=/\/{2,9}/g,i=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}function XZe(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,s,r){s&&(t[s]=r)}),t}let iO=class Ko extends dn{constructor(e,t={}){super(),this.binaryType=qZe,this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=Jg(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=Jg(t.host).host),lp(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=UZe(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=XN,t.transport=e,this.id&&(t.sid=this.id);const i=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new WZe[e](i)}open(){let e;if(this.opts.rememberUpgrade&&Ko.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){let t=this.createTransport(e),i=!1;Ko.priorWebsocketSuccess=!1;const s=()=>{i||(t.send([{type:"ping",data:"probe"}]),t.once("packet",_=>{if(!i)if(_.type==="pong"&&_.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Ko.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const f=new Error("probe error");f.transport=t.name,this.emitReserved("upgradeError",f)}}))};function r(){i||(i=!0,c(),t.close(),t=null)}const o=_=>{const f=new Error("probe error: "+_);f.transport=t.name,r(),this.emitReserved("upgradeError",f)};function a(){o("transport closed")}function l(){o("socket closed")}function d(_){t&&_.name!==t.name&&r()}const c=()=>{t.removeListener("open",s),t.removeListener("error",o),t.removeListener("close",a),this.off("close",l),this.off("upgrading",d)};t.once("open",s),t.once("error",o),t.once("close",a),this.once("close",l),this.once("upgrading",d),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{i||t.open()},200):t.open()}onOpen(){if(this.readyState="open",Ko.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let i=0;i0&&t>this.maxPayload)return this.writeBuffer.slice(0,i);t+=2}return this.writeBuffer}write(e,t,i){return this.sendPacket("message",e,t,i),this}send(e,t,i){return this.sendPacket("message",e,t,i),this}sendPacket(e,t,i,s){if(typeof t=="function"&&(s=t,t=void 0),typeof i=="function"&&(s=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const r={type:e,data:t,options:i};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),s&&this.once("flush",s),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},i=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():e()}):this.upgrading?i():e()),this}onError(e){Ko.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let i=0;const s=e.length;for(;itypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,sO=Object.prototype.toString,tJe=typeof Blob=="function"||typeof Blob<"u"&&sO.call(Blob)==="[object BlobConstructor]",nJe=typeof File=="function"||typeof File<"u"&&sO.call(File)==="[object FileConstructor]";function xE(n){return JZe&&(n instanceof ArrayBuffer||eJe(n))||tJe&&n instanceof Blob||nJe&&n instanceof File}function Fd(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,i=n.length;t=0&&n.num{delete this.acks[e];for(let o=0;o{this.io.clearTimeoutFn(r),t.apply(this,[null,...o])}}emitWithAck(e,...t){const i=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((s,r)=>{t.push((o,a)=>i?o?r(o):s(a):s(o)),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((s,...r)=>i!==this._queue[0]?void 0:(s!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(s)):(this._queue.shift(),t&&t(null,...r)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Dt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Dt.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Dt.EVENT:case Dt.BINARY_EVENT:this.onevent(e);break;case Dt.ACK:case Dt.BINARY_ACK:this.onack(e);break;case Dt.DISCONNECT:this.ondisconnect();break;case Dt.CONNECT_ERROR:this.destroy();const i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const i of t)i.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let i=!1;return function(...s){i||(i=!0,t.packet({type:Dt.ACK,id:e,data:s}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Dt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let i=0;i0&&n.jitter<=1?n.jitter:0,this.attempts=0}Ka.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=Math.floor(e*10)&1?n+t:n-t}return Math.min(n,this.max)|0};Ka.prototype.reset=function(){this.attempts=0};Ka.prototype.setMin=function(n){this.ms=n};Ka.prototype.setMax=function(n){this.max=n};Ka.prototype.setJitter=function(n){this.jitter=n};class nb extends dn{constructor(e,t){var i;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,lp(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((i=t.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Ka({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const s=t.parser||cJe;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new iO(this.uri,this.opts);const t=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const s=ki(t,"open",function(){i.onopen(),e&&e()}),r=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},o=ki(t,"error",r);if(this._timeout!==!1){const a=this._timeout,l=this.setTimeoutFn(()=>{s(),r(new Error("timeout")),t.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(s),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(ki(e,"ping",this.onping.bind(this)),ki(e,"data",this.ondata.bind(this)),ki(e,"error",this.onerror.bind(this)),ki(e,"close",this.onclose.bind(this)),ki(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){TE(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new rO(this,e,t),this.nsps[e]=i),i}_destroy(e){const t=Object.keys(this.nsps);for(const i of t)if(this.nsps[i].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let i=0;ie()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):e.onreconnect()}))},t);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const hl={};function Bd(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=ZZe(n,e.path||"/socket.io"),i=t.source,s=t.id,r=t.path,o=hl[s]&&r in hl[s].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let l;return a?l=new nb(i,e):(hl[s]||(hl[s]=new nb(i,e)),l=hl[s]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(Bd,{Manager:nb,Socket:rO,io:Bd,connect:Bd});const oO="/";console.log(oO);const Ze=new Bd(oO,{reconnection:!0,reconnectionAttempts:10,reconnectionDelay:1e3});const uJe={props:{value:String,inputType:{type:String,default:"text",validator:n=>["text","email","password","file","path","integer","float"].includes(n)},fileAccept:String},data(){return{inputValue:this.value,placeholderText:this.getPlaceholderText()}},watch:{value(n){console.log("Changing value to ",n),this.inputValue=n}},mounted(){Ve(()=>{qe.replace()}),console.log("Changing value to ",this.value),this.inputValue=this.value},methods:{handleSliderInput(n){this.inputValue=n.target.value,this.$emit("input",n.target.value)},getPlaceholderText(){switch(this.inputType){case"text":return"Enter text here";case"email":return"Enter your email";case"password":return"Enter your password";case"file":case"path":return"Choose a file";case"integer":return"Enter an integer";case"float":return"Enter a float";default:return"Enter value here"}},handleInput(n){if(this.inputType==="integer"){const e=n.target.value.replace(/[^0-9]/g,"");this.inputValue=e}console.log("handling input : ",n.target.value),this.$emit("input",n.target.value)},async pasteFromClipboard(){try{const n=await navigator.clipboard.readText();this.handleClipboardData(n)}catch(n){console.error("Failed to read from clipboard:",n)}},handlePaste(n){const e=n.clipboardData.getData("text");this.handleClipboardData(e)},handleClipboardData(n){switch(this.inputType){case"email":this.inputValue=this.isValidEmail(n)?n:"";break;case"password":this.inputValue=n;break;case"file":case"path":this.inputValue="";break;case"integer":this.inputValue=this.parseInteger(n);break;case"float":this.inputValue=this.parseFloat(n);break;default:this.inputValue=n;break}},isValidEmail(n){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)},parseInteger(n){const e=parseInt(n);return isNaN(e)?"":e},parseFloat(n){const e=parseFloat(n);return isNaN(e)?"":e},openFileInput(){this.$refs.fileInput.click()},handleFileInputChange(n){const e=n.target.files[0];e&&(this.inputValue=e.name)}}},pJe={class:"flex items-center space-x-2"},_Je=["value","type","placeholder"],hJe=["value","min","max"],fJe=u("i",{"data-feather":"clipboard"},null,-1),mJe=[fJe],gJe=u("i",{"data-feather":"upload"},null,-1),bJe=[gJe],EJe=["accept"];function vJe(n,e,t,i,s,r){return w(),M("div",pJe,[n.useSlider?(w(),M("input",{key:1,type:"range",value:parseInt(s.inputValue),min:n.minSliderValue,max:n.maxSliderValue,onInput:e[2]||(e[2]=(...o)=>r.handleSliderInput&&r.handleSliderInput(...o)),class:"flex-1 px-4 py-2 text-lg border dark:bg-gray-600 border-gray-300 rounded-md focus:outline-none focus:ring focus:border-blue-500"},null,40,hJe)):(w(),M("input",{key:0,value:s.inputValue,type:t.inputType,placeholder:s.placeholderText,onInput:e[0]||(e[0]=(...o)=>r.handleInput&&r.handleInput(...o)),onPaste:e[1]||(e[1]=(...o)=>r.handlePaste&&r.handlePaste(...o)),class:"flex-1 px-4 py-2 text-lg dark:bg-gray-600 border border-gray-300 rounded-md focus:outline-none focus:ring focus:border-blue-500"},null,40,_Je)),u("button",{onClick:e[3]||(e[3]=(...o)=>r.pasteFromClipboard&&r.pasteFromClipboard(...o)),class:"p-2 bg-blue-500 dark:bg-gray-600 text-white rounded-md hover:bg-blue-600 focus:outline-none focus:ring focus:border-blue-300"},mJe),t.inputType==="file"?(w(),M("button",{key:2,onClick:e[4]||(e[4]=(...o)=>r.openFileInput&&r.openFileInput(...o)),class:"p-2 bg-blue-500 text-white rounded-md hover:bg-blue-600 focus:outline-none focus:ring focus:border-blue-300"},bJe)):q("",!0),t.inputType==="file"?(w(),M("input",{key:3,ref:"fileInput",type:"file",style:{display:"none"},accept:t.fileAccept,onChange:e[5]||(e[5]=(...o)=>r.handleFileInputChange&&r.handleFileInputChange(...o))},null,40,EJe)):q("",!0)])}const RE=bt(uJe,[["render",vJe]]),yJe={name:"TokensHighlighter",props:{namedTokens:{type:Object,required:!0}},data(){return{colors:["#FF6633","#FFB399","#FF33FF","#FFFF99","#00B3E6","#E6B333","#3366E6","#999966","#99FF99","#B34D4D","#80B300","#809900","#E6B3B3","#6680B3","#66991A","#FF99E6","#CCFF1A","#FF1A66","#E6331A","#33FFCC","#66994D","#B366CC","#4D8000","#B33300","#CC80CC","#66664D","#991AFF","#E666FF","#4DB3FF","#1AB399","#E666B3","#33991A","#CC9999","#B3B31A","#00E680","#4D8066","#809980","#E6FF80","#1AFF33","#999933","#FF3380","#CCCC00","#66E64D","#4D80CC","#9900B3","#E64D66","#4DB380","#FF4D4D","#99E6E6","#6666FF"]}}},SJe={class:"w-full"},TJe={class:"break-words"},xJe={class:"break-words mt-2"},CJe={class:"mt-4"};function RJe(n,e,t,i,s,r){return w(),M("div",SJe,[u("div",TJe,[(w(!0),M($e,null,ct(t.namedTokens,(o,a)=>(w(),M("span",{key:a},[u("span",{class:"inline-block whitespace-pre-wrap",style:en({backgroundColor:s.colors[a%s.colors.length]})},fe(o[0]),5)]))),128))]),u("div",xJe,[(w(!0),M($e,null,ct(t.namedTokens,(o,a)=>(w(),M("span",{key:a},[u("span",{class:"inline-block px-1 whitespace-pre-wrap",style:en({backgroundColor:s.colors[a%s.colors.length]})},fe(o[1]),5)]))),128))]),u("div",CJe,[u("strong",null,"Total Tokens: "+fe(t.namedTokens.length),1)])])}const AJe=bt(yJe,[["render",RJe]]);const wJe={props:{is_subcard:{type:Boolean,default:!1},is_shrunk:{type:Boolean,default:!1},title:{type:String,default:""},isHorizontal:{type:Boolean,default:!1},cardWidth:{type:String,default:"w-3/4"},disableHoverAnimation:{type:Boolean,default:!0},disableFocus:{type:Boolean,default:!1}},data(){return{shrink:this.is_shrunk,isHovered:!1,isActive:!1}},computed:{cardClass(){return["bg-gray-50","border","border-gray-300","text-gray-900","text-sm","rounded-lg","focus:ring-blue-500","focus:border-blue-500","w-full","p-2.5","dark:bg-gray-500","dark:border-gray-600","dark:placeholder-gray-400","dark:text-white","dark:focus:ring-blue-500","dark:focus:border-blue-500",{"cursor-pointer":!this.isActive&&!this.disableFocus,"w-auto":!this.isActive}]},cardWidthClass(){return this.isActive?this.cardWidth:""}},methods:{toggleCard(){this.disableFocus||(this.isActive=!this.isActive)}}},NJe={key:1,class:"flex flex-wrap"},OJe={key:2,class:"mb-2"};function IJe(n,e,t,i,s,r){return w(),M($e,null,[s.isActive?(w(),M("div",{key:0,class:"overlay",onClick:e[0]||(e[0]=(...o)=>r.toggleCard&&r.toggleCard(...o))})):q("",!0),ne(u("div",{class:Ye(["border-blue-300 rounded-lg shadow-lg p-2",r.cardWidthClass,"m-2",{"bg-white dark:bg-gray-800":t.is_subcard},{"bg-white dark:bg-gray-900":!t.is_subcard},{hovered:!t.disableHoverAnimation&&s.isHovered,active:s.isActive}]),onMouseenter:e[2]||(e[2]=o=>s.isHovered=!0),onMouseleave:e[3]||(e[3]=o=>s.isHovered=!1),onClick:e[4]||(e[4]=Te((...o)=>r.toggleCard&&r.toggleCard(...o),["self"])),style:en({cursor:this.disableFocus?"":"pointer"})},[t.title?(w(),M("div",{key:0,onClick:e[1]||(e[1]=o=>s.shrink=!0),class:Ye([{"text-center p-2 m-2 bg-gray-200":!t.is_subcard},"bg-gray-100 dark:bg-gray-500 rounded-lg pl-2 pr-2 mb-2 font-bold cursor-pointer"])},fe(t.title),3)):q("",!0),t.isHorizontal?(w(),M("div",NJe,[Dn(n.$slots,"default")])):(w(),M("div",OJe,[Dn(n.$slots,"default")]))],38),[[Ot,s.shrink===!1]]),t.is_subcard?ne((w(),M("div",{key:1,onClick:e[5]||(e[5]=o=>s.shrink=!1),class:"bg-white text-center text-xl bold dark:bg-gray-500 border-blue-300 rounded-lg shadow-lg p-2 h-10 cursor-pointer m-2"},fe(t.title),513)),[[Ot,s.shrink===!0]]):ne((w(),M("div",{key:2,onClick:e[6]||(e[6]=o=>s.shrink=!1),class:"bg-white text-center text-2xl dark:bg-gray-500 border-2 border-blue-300 rounded-lg shadow-lg p-0 h-7 cursor-pointer hover:h-8 hover:bg-blue-300"}," + ",512)),[[Ot,s.shrink===!0]])],64)}const vc=bt(wJe,[["render",IJe]]),aO="/assets/code_block-e2753d3f.svg",lO="/assets/python_block-4008a934.png",cO="/assets/javascript_block-5e59df30.svg",dO="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAOeSURBVGhD7ZhNaBNBGIZHW/EPbSioRSpi0FRpVdRSjQfxkFilB5UciuChIL0JLaKIhR5KIYKIiBSF0mLVS7AIavUgPQjiT4+KB0EP3gwS8VDBgj8d33d2ZrNJt2lCppKWfeBh5pvdncyXmZ3sZokQQsIFz1JdLni8M8L6QkSNf9HMSJBIpREkUmkEiVQaQSKVRpCIH8lkUtbW1sre3l7fB9FoNCrD4fC8PaSyYyudNzU1yZGRkYJ9dXV1yUQiYTMZNX6rM5LJZERHR0fBh0/MmJDSZh4OVhOZmprStf+P1UQmJyd1zaGvr09NuxM5VFVViYmJCR3Zw1oiPT09koP00tjYKNrb23XkEIlERHV1tY7sMuNbK5XR0VGJwcnBwcGi+uns7Cz7Mz24fVnpdGhoSDY0NBTbjxweHi77MzXu+N2KBebsh7PW0tJi6/OIGr/Vm72mpkbXssTj8ZxBp9NpUV9fryN7WE0kn1QqJcfHx3U0v1hNJBQKqXtFh2JsbEx0d3frKMv09LSu2UWtMadaHm1tberxQ+9Koq6uLqff1tZW2dzcLPXviy3c8bsVG/T398+6I8ViMTkwMGDtszRq/MEfdJVGkEilESRSaZSSyCa43anmsAPGII/7wWd7nnMEbmaDD2G41anmsA76tfui9mGnWpAPkOftVpEQuyDfkMz19Bv0cg56j9NP8AQ07IXm2Es2eHgK2b5RRf6Ya7OVOchP5D1kfA0m4GX4CxouQR7/A6/DC/CObqNRSA5A00Y7oeG/JMJBM65TUS7rIV/gefw4GzzchWx/rKJsIu90+REaik6knJv9hy5vw4NO1WU/XAG/w0ds8MABk326NLyGL+A2eJYNpVBOIhd1eRS+gs/hTjYAc4M+06WX+7rkt7zKqbrc0OV5WNIjUzmJDME9MKUiIQ5DvnyshOZfCL/+l+uSz/I/narLA8gvhLsb77miKScR8haegqfhb7gBcoa4M5G4Lr0069Kck88VXZ6B+TNWEHWzONWCpCHPM78lZhkZ3kAePwa36DpthQYulwxke5INwNzst1Tk8ASa66mVXYtLgFPOc7iVroUtOh6F3Gbv6fgLXAPJVWj65vU3IW9oxl+hWWJ+iRyC5lpqJZHP0JxjbnBO+UP4F5pjXNsnoRf+IJqZpNySmRSXoMEvEeL9Iqwkwm20Cfqt12UwAleraHZCcLbHEzLz75fiUeMP3hArjUWTiHdpLWgWyYwI8Q8rrSjH5vAr6AAAAABJRU5ErkJggg==",uO="/assets/cpp_block-109b2fbe.png",pO="/assets/html5_block-205d2852.png",_O="/assets/LaTeX_block-06b165c0.png",hO="/assets/bash_block-7ca80e4e.png",MJe="/assets/tokenize_icon-0553c60f.svg",DJe="/assets/deaf_on-7481cb29.svg",kJe="/assets/deaf_off-c2c46908.svg",LJe="/assets/rec_on-3b37b566.svg",PJe="/assets/rec_off-2c08e836.svg",fO="/assets/loading-c3bdfb0a.svg";const UJe="/";async function OC(n,e="",t=[]){return new Promise((i,s)=>{const r=document.createElement("div");r.className="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 z-50",t.length===0?r.innerHTML=` + `)])):q("",!0)])}const hKe=bt(qWe,[["render",_Ke]]);/*! @license DOMPurify 3.0.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.8/LICENSE */const{entries:DN,setPrototypeOf:_C,isFrozen:fKe,getPrototypeOf:mKe,getOwnPropertyDescriptor:EE}=Object;let{freeze:$n,seal:qi,create:kN}=Object,{apply:jg,construct:Qg}=typeof Reflect<"u"&&Reflect;$n||($n=function(e){return e});qi||(qi=function(e){return e});jg||(jg=function(e,t,i){return e.apply(t,i)});Qg||(Qg=function(e,t){return new e(...t)});const Gc=Ri(Array.prototype.forEach),hC=Ri(Array.prototype.pop),ul=Ri(Array.prototype.push),Ld=Ri(String.prototype.toLowerCase),Mm=Ri(String.prototype.toString),gKe=Ri(String.prototype.match),pl=Ri(String.prototype.replace),bKe=Ri(String.prototype.indexOf),EKe=Ri(String.prototype.trim),ni=Ri(RegExp.prototype.test),_l=vKe(TypeError);function Ri(n){return function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s2&&arguments[2]!==void 0?arguments[2]:Ld;_C&&_C(n,null);let i=e.length;for(;i--;){let s=e[i];if(typeof s=="string"){const r=t(s);r!==s&&(fKe(e)||(e[i]=r),s=r)}n[s]=!0}return n}function yKe(n){for(let e=0;e/gm),RKe=qi(/\${[\w\W]*}/gm),AKe=qi(/^data-[\-\w.\u00B7-\uFFFF]/),wKe=qi(/^aria-[\-\w]+$/),LN=qi(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),NKe=qi(/^(?:\w+script|data):/i),OKe=qi(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),PN=qi(/^html$/i);var EC=Object.freeze({__proto__:null,MUSTACHE_EXPR:xKe,ERB_EXPR:CKe,TMPLIT_EXPR:RKe,DATA_ATTR:AKe,ARIA_ATTR:wKe,IS_ALLOWED_URI:LN,IS_SCRIPT_OR_DATA:NKe,ATTR_WHITESPACE:OKe,DOCTYPE_NAME:PN});const IKe=function(){return typeof window>"u"?null:window},MKe=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null;const s="data-tt-policy-suffix";t&&t.hasAttribute(s)&&(i=t.getAttribute(s));const r="dompurify"+(i?"#"+i:"");try{return e.createPolicy(r,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}};function UN(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:IKe();const e=tt=>UN(tt);if(e.version="3.0.8",e.removed=[],!n||!n.document||n.document.nodeType!==9)return e.isSupported=!1,e;let{document:t}=n;const i=t,s=i.currentScript,{DocumentFragment:r,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:d,NamedNodeMap:c=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:_,DOMParser:f,trustedTypes:m}=n,h=l.prototype,E=zc(h,"cloneNode"),b=zc(h,"nextSibling"),g=zc(h,"childNodes"),v=zc(h,"parentNode");if(typeof o=="function"){const tt=t.createElement("template");tt.content&&tt.content.ownerDocument&&(t=tt.content.ownerDocument)}let y,T="";const{implementation:C,createNodeIterator:x,createDocumentFragment:O,getElementsByTagName:R}=t,{importNode:S}=i;let A={};e.isSupported=typeof DN=="function"&&typeof v=="function"&&C&&C.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:U,ERB_EXPR:F,TMPLIT_EXPR:K,DATA_ATTR:L,ARIA_ATTR:H,IS_SCRIPT_OR_DATA:G,ATTR_WHITESPACE:P}=EC;let{IS_ALLOWED_URI:j}=EC,Y=null;const Q=Nt({},[...fC,...Dm,...km,...Lm,...mC]);let ae=null;const te=Nt({},[...gC,...Pm,...bC,...Vc]);let Z=Object.seal(kN(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),me=null,ve=null,Ae=!0,J=!0,ge=!1,ee=!0,Se=!1,Ie=!1,k=!1,B=!1,$=!1,de=!1,ie=!1,Ce=!0,we=!1;const V="user-content-";let _e=!0,se=!1,ce={},D=null;const I=Nt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let z=null;const he=Nt({},["audio","video","img","source","image","track"]);let X=null;const re=Nt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Re="http://www.w3.org/1998/Math/MathML",xe="http://www.w3.org/2000/svg",De="http://www.w3.org/1999/xhtml";let ze=De,st=!1,ke=null;const lt=Nt({},[Re,xe,De],Mm);let Qe=null;const He=["application/xhtml+xml","text/html"],et="text/html";let Fe=null,pt=null;const pe=t.createElement("form"),We=function(N){return N instanceof RegExp||N instanceof Function},Ue=function(){let N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(pt&&pt===N)){if((!N||typeof N!="object")&&(N={}),N=$r(N),Qe=He.indexOf(N.PARSER_MEDIA_TYPE)===-1?et:N.PARSER_MEDIA_TYPE,Fe=Qe==="application/xhtml+xml"?Mm:Ld,Y="ALLOWED_TAGS"in N?Nt({},N.ALLOWED_TAGS,Fe):Q,ae="ALLOWED_ATTR"in N?Nt({},N.ALLOWED_ATTR,Fe):te,ke="ALLOWED_NAMESPACES"in N?Nt({},N.ALLOWED_NAMESPACES,Mm):lt,X="ADD_URI_SAFE_ATTR"in N?Nt($r(re),N.ADD_URI_SAFE_ATTR,Fe):re,z="ADD_DATA_URI_TAGS"in N?Nt($r(he),N.ADD_DATA_URI_TAGS,Fe):he,D="FORBID_CONTENTS"in N?Nt({},N.FORBID_CONTENTS,Fe):I,me="FORBID_TAGS"in N?Nt({},N.FORBID_TAGS,Fe):{},ve="FORBID_ATTR"in N?Nt({},N.FORBID_ATTR,Fe):{},ce="USE_PROFILES"in N?N.USE_PROFILES:!1,Ae=N.ALLOW_ARIA_ATTR!==!1,J=N.ALLOW_DATA_ATTR!==!1,ge=N.ALLOW_UNKNOWN_PROTOCOLS||!1,ee=N.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Se=N.SAFE_FOR_TEMPLATES||!1,Ie=N.WHOLE_DOCUMENT||!1,$=N.RETURN_DOM||!1,de=N.RETURN_DOM_FRAGMENT||!1,ie=N.RETURN_TRUSTED_TYPE||!1,B=N.FORCE_BODY||!1,Ce=N.SANITIZE_DOM!==!1,we=N.SANITIZE_NAMED_PROPS||!1,_e=N.KEEP_CONTENT!==!1,se=N.IN_PLACE||!1,j=N.ALLOWED_URI_REGEXP||LN,ze=N.NAMESPACE||De,Z=N.CUSTOM_ELEMENT_HANDLING||{},N.CUSTOM_ELEMENT_HANDLING&&We(N.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Z.tagNameCheck=N.CUSTOM_ELEMENT_HANDLING.tagNameCheck),N.CUSTOM_ELEMENT_HANDLING&&We(N.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Z.attributeNameCheck=N.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),N.CUSTOM_ELEMENT_HANDLING&&typeof N.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Z.allowCustomizedBuiltInElements=N.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Se&&(J=!1),de&&($=!0),ce&&(Y=Nt({},mC),ae=[],ce.html===!0&&(Nt(Y,fC),Nt(ae,gC)),ce.svg===!0&&(Nt(Y,Dm),Nt(ae,Pm),Nt(ae,Vc)),ce.svgFilters===!0&&(Nt(Y,km),Nt(ae,Pm),Nt(ae,Vc)),ce.mathMl===!0&&(Nt(Y,Lm),Nt(ae,bC),Nt(ae,Vc))),N.ADD_TAGS&&(Y===Q&&(Y=$r(Y)),Nt(Y,N.ADD_TAGS,Fe)),N.ADD_ATTR&&(ae===te&&(ae=$r(ae)),Nt(ae,N.ADD_ATTR,Fe)),N.ADD_URI_SAFE_ATTR&&Nt(X,N.ADD_URI_SAFE_ATTR,Fe),N.FORBID_CONTENTS&&(D===I&&(D=$r(D)),Nt(D,N.FORBID_CONTENTS,Fe)),_e&&(Y["#text"]=!0),Ie&&Nt(Y,["html","head","body"]),Y.table&&(Nt(Y,["tbody"]),delete me.tbody),N.TRUSTED_TYPES_POLICY){if(typeof N.TRUSTED_TYPES_POLICY.createHTML!="function")throw _l('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof N.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw _l('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');y=N.TRUSTED_TYPES_POLICY,T=y.createHTML("")}else y===void 0&&(y=MKe(m,s)),y!==null&&typeof T=="string"&&(T=y.createHTML(""));$n&&$n(N),pt=N}},Ne=Nt({},["mi","mo","mn","ms","mtext"]),Be=Nt({},["foreignobject","desc","title","annotation-xml"]),dt=Nt({},["title","style","font","a","script"]),Et=Nt({},[...Dm,...km,...SKe]),jt=Nt({},[...Lm,...TKe]),ln=function(N){let W=v(N);(!W||!W.tagName)&&(W={namespaceURI:ze,tagName:"template"});const le=Ld(N.tagName),ye=Ld(W.tagName);return ke[N.namespaceURI]?N.namespaceURI===xe?W.namespaceURI===De?le==="svg":W.namespaceURI===Re?le==="svg"&&(ye==="annotation-xml"||Ne[ye]):!!Et[le]:N.namespaceURI===Re?W.namespaceURI===De?le==="math":W.namespaceURI===xe?le==="math"&&Be[ye]:!!jt[le]:N.namespaceURI===De?W.namespaceURI===xe&&!Be[ye]||W.namespaceURI===Re&&!Ne[ye]?!1:!jt[le]&&(dt[le]||!Et[le]):!!(Qe==="application/xhtml+xml"&&ke[N.namespaceURI]):!1},Ct=function(N){ul(e.removed,{element:N});try{N.parentNode.removeChild(N)}catch{N.remove()}},$t=function(N,W){try{ul(e.removed,{attribute:W.getAttributeNode(N),from:W})}catch{ul(e.removed,{attribute:null,from:W})}if(W.removeAttribute(N),N==="is"&&!ae[N])if($||de)try{Ct(W)}catch{}else try{W.setAttribute(N,"")}catch{}},yn=function(N){let W=null,le=null;if(B)N=""+N;else{const Ge=gKe(N,/^[\r\n\t ]+/);le=Ge&&Ge[0]}Qe==="application/xhtml+xml"&&ze===De&&(N=''+N+"");const ye=y?y.createHTML(N):N;if(ze===De)try{W=new f().parseFromString(ye,Qe)}catch{}if(!W||!W.documentElement){W=C.createDocument(ze,"template",null);try{W.documentElement.innerHTML=st?T:ye}catch{}}const Ee=W.body||W.documentElement;return N&&le&&Ee.insertBefore(t.createTextNode(le),Ee.childNodes[0]||null),ze===De?R.call(W,Ie?"html":"body")[0]:Ie?W.documentElement:Ee},gs=function(N){return x.call(N.ownerDocument||N,N,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT,null)},kr=function(N){return N instanceof _&&(typeof N.nodeName!="string"||typeof N.textContent!="string"||typeof N.removeChild!="function"||!(N.attributes instanceof c)||typeof N.removeAttribute!="function"||typeof N.setAttribute!="function"||typeof N.namespaceURI!="string"||typeof N.insertBefore!="function"||typeof N.hasChildNodes!="function")},ci=function(N){return typeof a=="function"&&N instanceof a},Sn=function(N,W,le){A[N]&&Gc(A[N],ye=>{ye.call(e,W,le,pt)})},di=function(N){let W=null;if(Sn("beforeSanitizeElements",N,null),kr(N))return Ct(N),!0;const le=Fe(N.nodeName);if(Sn("uponSanitizeElement",N,{tagName:le,allowedTags:Y}),N.hasChildNodes()&&!ci(N.firstElementChild)&&ni(/<[/\w]/g,N.innerHTML)&&ni(/<[/\w]/g,N.textContent))return Ct(N),!0;if(!Y[le]||me[le]){if(!me[le]&&bs(le)&&(Z.tagNameCheck instanceof RegExp&&ni(Z.tagNameCheck,le)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck(le)))return!1;if(_e&&!D[le]){const ye=v(N)||N.parentNode,Ee=g(N)||N.childNodes;if(Ee&&ye){const Ge=Ee.length;for(let Xe=Ge-1;Xe>=0;--Xe)ye.insertBefore(E(Ee[Xe],!0),b(N))}}return Ct(N),!0}return N instanceof l&&!ln(N)||(le==="noscript"||le==="noembed"||le==="noframes")&&ni(/<\/no(script|embed|frames)/i,N.innerHTML)?(Ct(N),!0):(Se&&N.nodeType===3&&(W=N.textContent,Gc([U,F,K],ye=>{W=pl(W,ye," ")}),N.textContent!==W&&(ul(e.removed,{element:N.cloneNode()}),N.textContent=W)),Sn("afterSanitizeElements",N,null),!1)},Ki=function(N,W,le){if(Ce&&(W==="id"||W==="name")&&(le in t||le in pe))return!1;if(!(J&&!ve[W]&&ni(L,W))){if(!(Ae&&ni(H,W))){if(!ae[W]||ve[W]){if(!(bs(N)&&(Z.tagNameCheck instanceof RegExp&&ni(Z.tagNameCheck,N)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck(N))&&(Z.attributeNameCheck instanceof RegExp&&ni(Z.attributeNameCheck,W)||Z.attributeNameCheck instanceof Function&&Z.attributeNameCheck(W))||W==="is"&&Z.allowCustomizedBuiltInElements&&(Z.tagNameCheck instanceof RegExp&&ni(Z.tagNameCheck,le)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck(le))))return!1}else if(!X[W]){if(!ni(j,pl(le,P,""))){if(!((W==="src"||W==="xlink:href"||W==="href")&&N!=="script"&&bKe(le,"data:")===0&&z[N])){if(!(ge&&!ni(G,pl(le,P,"")))){if(le)return!1}}}}}}return!0},bs=function(N){return N.indexOf("-")>0},Es=function(N){Sn("beforeSanitizeAttributes",N,null);const{attributes:W}=N;if(!W)return;const le={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ae};let ye=W.length;for(;ye--;){const Ee=W[ye],{name:Ge,namespaceURI:Xe,value:nt}=Ee,at=Fe(Ge);let rt=Ge==="value"?nt:EKe(nt);if(le.attrName=at,le.attrValue=rt,le.keepAttr=!0,le.forceKeepAttr=void 0,Sn("uponSanitizeAttribute",N,le),rt=le.attrValue,le.forceKeepAttr||($t(Ge,N),!le.keepAttr))continue;if(!ee&&ni(/\/>/i,rt)){$t(Ge,N);continue}Se&&Gc([U,F,K],ft=>{rt=pl(rt,ft," ")});const _t=Fe(N.nodeName);if(Ki(_t,at,rt)){if(we&&(at==="id"||at==="name")&&($t(Ge,N),rt=V+rt),y&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!Xe)switch(m.getAttributeType(_t,at)){case"TrustedHTML":{rt=y.createHTML(rt);break}case"TrustedScriptURL":{rt=y.createScriptURL(rt);break}}try{Xe?N.setAttributeNS(Xe,Ge,rt):N.setAttribute(Ge,rt),hC(e.removed)}catch{}}}Sn("afterSanitizeAttributes",N,null)},vs=function tt(N){let W=null;const le=gs(N);for(Sn("beforeSanitizeShadowDOM",N,null);W=le.nextNode();)Sn("uponSanitizeShadowNode",W,null),!di(W)&&(W.content instanceof r&&tt(W.content),Es(W));Sn("afterSanitizeShadowDOM",N,null)};return e.sanitize=function(tt){let N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},W=null,le=null,ye=null,Ee=null;if(st=!tt,st&&(tt=""),typeof tt!="string"&&!ci(tt))if(typeof tt.toString=="function"){if(tt=tt.toString(),typeof tt!="string")throw _l("dirty is not a string, aborting")}else throw _l("toString is not a function");if(!e.isSupported)return tt;if(k||Ue(N),e.removed=[],typeof tt=="string"&&(se=!1),se){if(tt.nodeName){const nt=Fe(tt.nodeName);if(!Y[nt]||me[nt])throw _l("root node is forbidden and cannot be sanitized in-place")}}else if(tt instanceof a)W=yn(""),le=W.ownerDocument.importNode(tt,!0),le.nodeType===1&&le.nodeName==="BODY"||le.nodeName==="HTML"?W=le:W.appendChild(le);else{if(!$&&!Se&&!Ie&&tt.indexOf("<")===-1)return y&&ie?y.createHTML(tt):tt;if(W=yn(tt),!W)return $?null:ie?T:""}W&&B&&Ct(W.firstChild);const Ge=gs(se?tt:W);for(;ye=Ge.nextNode();)di(ye)||(ye.content instanceof r&&vs(ye.content),Es(ye));if(se)return tt;if($){if(de)for(Ee=O.call(W.ownerDocument);W.firstChild;)Ee.appendChild(W.firstChild);else Ee=W;return(ae.shadowroot||ae.shadowrootmode)&&(Ee=S.call(i,Ee,!0)),Ee}let Xe=Ie?W.outerHTML:W.innerHTML;return Ie&&Y["!doctype"]&&W.ownerDocument&&W.ownerDocument.doctype&&W.ownerDocument.doctype.name&&ni(PN,W.ownerDocument.doctype.name)&&(Xe=" +`+Xe),Se&&Gc([U,F,K],nt=>{Xe=pl(Xe,nt," ")}),y&&ie?y.createHTML(Xe):Xe},e.setConfig=function(){let tt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ue(tt),k=!0},e.clearConfig=function(){pt=null,k=!1},e.isValidAttribute=function(tt,N,W){pt||Ue({});const le=Fe(tt),ye=Fe(N);return Ki(le,ye,W)},e.addHook=function(tt,N){typeof N=="function"&&(A[tt]=A[tt]||[],ul(A[tt],N))},e.removeHook=function(tt){if(A[tt])return hC(A[tt])},e.removeHooks=function(tt){A[tt]&&(A[tt]=[])},e.removeAllHooks=function(){A={}},e}UN();function DKe(n){return n.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}const kKe={name:"MarkdownRenderer",props:{host:{type:String,required:!1,default:"http://localhost:9600"},client_id:{type:String,required:!0},markdownText:{type:String,required:!0},discussion_id:{type:[String,Number],default:"0",required:!1},message_id:{value:"0",type:[String,Number],required:!1}},components:{CodeBlock:hKe},setup(n){const e=new Gbe({html:!0,highlight:(s,r)=>{const o=r&&fo.getLanguage(r)?r:"plaintext";return fo.highlight(o,s).value},renderInline:!0,breaks:!0}).use(qHe).use(jo).use(s7e,{figcaption:!0}).use(g7e).use(ZHe,{inlineOpen:"$",inlineClose:"$",blockOpen:"$$",blockClose:"$$"}).use(n7e,{enableRowspan:!0,enableColspan:!0,enableGridTables:!0,enableGridTablesExtra:!0,enableTableIndentation:!0,tableCellPadding:" ",tableCellJoiner:"|",multilineCellStartMarker:"|>",multilineCellEndMarker:"<|",multilineCellPadding:" ",multilineCellJoiner:` +`}),t=mt([]),i=()=>{if(n.markdownText){let s=e.parse(n.markdownText,{}),r=[];t.value=[];for(let o=0;o0&&(t.value.push({type:"html",html:e.renderer.render(r,e.options,{})}),r=[]),t.value.push({type:"code",language:DKe(s[o].info),code:s[o].content}));r.length>0&&(t.value.push({type:"html",html:e.renderer.render(r,e.options,{})}),r=[])}else t.value=[];Ve(()=>{qe.replace()})};return qn(()=>n.markdownText,i),qs(i),{markdownItems:t}}},LKe={class:"break-all container w-full"},PKe={ref:"mdRender",class:"markdown-content"},UKe=["innerHTML"];function FKe(n,e,t,i,s,r){const o=ht("code-block");return w(),M("div",LKe,[u("div",PKe,[(w(!0),M($e,null,ct(i.markdownItems,(a,l)=>(w(),M("div",{key:l},[a.type==="code"?(w(),xt(o,{key:0,host:t.host,language:a.language,code:a.code,discussion_id:t.discussion_id,message_id:t.message_id,client_id:t.client_id},null,8,["host","language","code","discussion_id","message_id","client_id"])):(w(),M("div",{key:1,innerHTML:a.html},null,8,UKe))]))),128))],512)])}const ap=bt(kKe,[["render",FKe]]),BKe={data(){return{show:!1,has_button:!0,message:""}},components:{MarkdownRenderer:ap},methods:{hide(){this.show=!1,this.$emit("ok")},showMessage(n){this.message=n,this.has_button=!0,this.show=!0},showBlockingMessage(n){this.message=n,this.has_button=!1,this.show=!0},updateMessage(n){this.message=n,this.show=!0},hideMessage(){this.show=!1}}},GKe={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50 z-50"},zKe={class:"pl-10 pr-10 bg-bg-light dark:bg-bg-dark p-8 rounded-lg shadow-lg"},VKe={class:"container max-h-500 overflow-y-auto"},HKe={class:"text-lg font-medium"},qKe={class:"mt-4 flex justify-center"},YKe={key:1,"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},$Ke=u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"},null,-1),WKe=u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"},null,-1),KKe=[$Ke,WKe];function jKe(n,e,t,i,s,r){const o=ht("MarkdownRenderer");return s.show?(w(),M("div",GKe,[u("div",zKe,[u("div",VKe,[u("div",HKe,[Oe(o,{ref:"mdRender",host:"","markdown-text":s.message,message_id:0,discussion_id:0},null,8,["markdown-text"])])]),u("div",qKe,[s.has_button?(w(),M("button",{key:0,onClick:e[0]||(e[0]=(...a)=>r.hide&&r.hide(...a)),class:"bg-primary hover:bg-primary-light active:scale-95 duration-150 text-white px-4 py-2 rounded-lg shadow-lg hover:bg-secondary-dark"}," OK ")):q("",!0),s.has_button?q("",!0):(w(),M("svg",YKe,KKe))])])])):q("",!0)}const FN=bt(BKe,[["render",jKe]]);const QKe={props:{progress:{type:Number,required:!0}}},XKe={class:"progress-bar-container"};function ZKe(n,e,t,i,s,r){return w(),M("div",XKe,[u("div",{class:"progress-bar",style:en({width:`${t.progress}%`})},null,4)])}const ic=bt(QKe,[["render",ZKe]]),JKe={setup(){return{}},name:"UniversalForm",data(){return{show:!1,resolve:null,controls_array:[],title:"Universal form",ConfirmButtonText:"Submit",DenyButtonText:"Cancel"}},mounted(){Ve(()=>{qe.replace()})},methods:{btn_clicked(n){console.log(n)},hide(n){this.show=!1,this.resolve&&n&&(this.resolve(this.controls_array),this.resolve=null)},showForm(n,e,t,i){this.ConfirmButtonText=t||this.ConfirmButtonText,this.DenyButtonText=i||this.DenyButtonText;for(let s=0;s{this.controls_array=n,this.show=!0,this.title=e||this.title,this.resolve=s,console.log("show form",this.controls_array)})}},watch:{controls_array:{deep:!0,handler(n){n.forEach(e=>{e.type==="int"?e.value=parseInt(e.value):e.type==="float"&&(e.value=parseFloat(e.value))})}},show(){Ve(()=>{qe.replace()})}}},eje={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50 p-4"},tje={class:"relative w-full max-w-md"},nje={class:"flex flex-col rounded-lg bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel duration-150 shadow-lg max-h-screen"},ije={class:"flex flex-row flex-grow items-center m-2 p-1"},sje={class:"grow flex items-center"},rje=u("i",{"data-feather":"sliders",class:"mr-2 flex-shrink-0"},null,-1),oje={class:"text-lg font-semibold select-none mr-2"},aje={class:"items-end"},lje=u("svg",{"aria-hidden":"true",class:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1),cje=u("span",{class:"sr-only"},"Close form modal",-1),dje=[lje,cje],uje={class:"flex flex-col relative no-scrollbar overflow-y-scroll p-2"},pje={class:"px-2"},_je={key:0},hje={key:0},fje={class:"text-base font-semibold"},mje={key:0,class:"relative inline-flex"},gje=["onUpdate:modelValue"],bje=u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[u("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),Eje={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},vje=["onUpdate:modelValue"],yje={key:1},Sje={class:"text-base font-semibold"},Tje={key:0,class:"relative inline-flex"},xje=["onUpdate:modelValue"],Cje=u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[u("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),Rje={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},Aje=["onUpdate:modelValue"],wje=["value","selected"],Nje={key:1},Oje={class:"",onclick:"btn_clicked(item)"},Ije={key:2},Mje={key:0},Dje={class:"text-base font-semibold"},kje={key:0,class:"relative inline-flex"},Lje=["onUpdate:modelValue"],Pje=u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[u("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),Uje={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},Fje=["onUpdate:modelValue"],Bje={key:1},Gje={class:"text-base font-semibold"},zje={key:0,class:"relative inline-flex"},Vje=["onUpdate:modelValue"],Hje=u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[u("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),qje={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},Yje=["onUpdate:modelValue"],$je=["value","selected"],Wje={key:3},Kje={class:"text-base font-semibold"},jje={key:0,class:"relative inline-flex"},Qje=["onUpdate:modelValue"],Xje=u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[u("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),Zje={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},Jje=["onUpdate:modelValue"],eQe=["onUpdate:modelValue","min","max"],tQe={key:4},nQe={class:"text-base font-semibold"},iQe={key:0,class:"relative inline-flex"},sQe=["onUpdate:modelValue"],rQe=u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[u("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),oQe={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},aQe=["onUpdate:modelValue"],lQe=["onUpdate:modelValue","min","max"],cQe={key:5},dQe={class:"mb-2 relative flex items-center gap-2"},uQe={for:"default-checkbox",class:"text-base font-semibold"},pQe=["onUpdate:modelValue"],_Qe={key:0,class:"relative inline-flex"},hQe=["onUpdate:modelValue"],fQe=u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[u("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),mQe={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},gQe={key:6},bQe={class:"text-base font-semibold"},EQe={key:0,class:"relative inline-flex"},vQe=["onUpdate:modelValue"],yQe=u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[u("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),SQe={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},TQe=["onUpdate:modelValue"],xQe=u("hr",{class:"h-px my-4 bg-gray-200 border-0 dark:bg-gray-700"},null,-1),CQe={class:"flex flex-row flex-grow gap-3"},RQe={class:"p-2 text-center grow"};function AQe(n,e,t,i,s,r){return s.show?(w(),M("div",eje,[u("div",tje,[u("div",nje,[u("div",ije,[u("div",sje,[rje,u("h3",oje,fe(s.title),1)]),u("div",aje,[u("button",{type:"button",onClick:e[0]||(e[0]=Te(o=>r.hide(!1),["stop"])),title:"Close",class:"bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-800 dark:hover:text-white"},dje)])]),u("div",uje,[(w(!0),M($e,null,ct(s.controls_array,(o,a)=>(w(),M("div",pje,[o.type=="str"||o.type=="string"?(w(),M("div",_je,[o.options?q("",!0):(w(),M("div",hje,[u("label",{class:Ye(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[u("div",fje,fe(o.name)+": ",1),o.help?(w(),M("label",mje,[ne(u("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,gje),[[ut,o.isHelp]]),bje])):q("",!0)],2),o.isHelp?(w(),M("p",Eje,fe(o.help),1)):q("",!0),ne(u("input",{type:"text","onUpdate:modelValue":l=>o.value=l,class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Enter string"},null,8,vje),[[Pe,o.value]])])),o.options?(w(),M("div",yje,[u("label",{class:Ye(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[u("div",Sje,fe(o.name)+": ",1),o.help?(w(),M("label",Tje,[ne(u("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,xje),[[ut,o.isHelp]]),Cje])):q("",!0)],2),o.isHelp?(w(),M("p",Rje,fe(o.help),1)):q("",!0),ne(u("select",{"onUpdate:modelValue":l=>o.value=l,class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},[(w(!0),M($e,null,ct(o.options,l=>(w(),M("option",{value:l,selected:o.value===l},fe(l),9,wje))),256))],8,Aje),[[zn,o.value]])])):q("",!0)])):q("",!0),o.type=="btn"?(w(),M("div",Nje,[u("button",Oje,fe(o.name),1)])):q("",!0),o.type=="text"?(w(),M("div",Ije,[o.options?q("",!0):(w(),M("div",Mje,[u("label",{class:Ye(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[u("div",Dje,fe(o.name)+": ",1),o.help?(w(),M("label",kje,[ne(u("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,Lje),[[ut,o.isHelp]]),Pje])):q("",!0)],2),o.isHelp?(w(),M("p",Uje,fe(o.help),1)):q("",!0),ne(u("textarea",{"onUpdate:modelValue":l=>o.value=l,class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Enter string"},null,8,Fje),[[Pe,o.value]])])),o.options?(w(),M("div",Bje,[u("label",{class:Ye(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[u("div",Gje,fe(o.name)+": ",1),o.help?(w(),M("label",zje,[ne(u("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,Vje),[[ut,o.isHelp]]),Hje])):q("",!0)],2),o.isHelp?(w(),M("p",qje,fe(o.help),1)):q("",!0),ne(u("select",{"onUpdate:modelValue":l=>o.value=l,class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},[(w(!0),M($e,null,ct(o.options,l=>(w(),M("option",{value:l,selected:o.value===l},fe(l),9,$je))),256))],8,Yje),[[zn,o.value]])])):q("",!0)])):q("",!0),o.type=="int"?(w(),M("div",Wje,[u("label",{class:Ye(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[u("div",Kje,fe(o.name)+": ",1),o.help?(w(),M("label",jje,[ne(u("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,Qje),[[ut,o.isHelp]]),Xje])):q("",!0)],2),o.isHelp?(w(),M("p",Zje,fe(o.help),1)):q("",!0),ne(u("input",{type:"number","onUpdate:modelValue":l=>o.value=l,step:"1",class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Enter number"},null,8,Jje),[[Pe,o.value]]),o.min!=null&&o.max!=null?ne((w(),M("input",{key:1,type:"range","onUpdate:modelValue":l=>o.value=l,min:o.min,max:o.max,step:"1",class:"flex-none h-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,8,eQe)),[[Pe,o.value]]):q("",!0)])):q("",!0),o.type=="float"?(w(),M("div",tQe,[u("label",{class:Ye(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[u("div",nQe,fe(o.name)+": ",1),o.help?(w(),M("label",iQe,[ne(u("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,sQe),[[ut,o.isHelp]]),rQe])):q("",!0)],2),o.isHelp?(w(),M("p",oQe,fe(o.help),1)):q("",!0),ne(u("input",{type:"number","onUpdate:modelValue":l=>o.value=l,class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Enter number"},null,8,aQe),[[Pe,o.value]]),o.min!=null&&o.max!=null?ne((w(),M("input",{key:1,type:"range","onUpdate:modelValue":l=>o.value=l,min:o.min,max:o.max,step:"0.1",class:"flex-none h-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,8,lQe)),[[Pe,o.value]]):q("",!0)])):q("",!0),o.type=="bool"?(w(),M("div",cQe,[u("div",dQe,[u("label",uQe,fe(o.name)+": ",1),ne(u("input",{type:"checkbox","onUpdate:modelValue":l=>o.value=l,class:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"},null,8,pQe),[[ut,o.value]]),o.help?(w(),M("label",_Qe,[ne(u("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,hQe),[[ut,o.isHelp]]),fQe])):q("",!0)]),o.isHelp?(w(),M("p",mQe,fe(o.help),1)):q("",!0)])):q("",!0),o.type=="list"?(w(),M("div",gQe,[u("label",{class:Ye(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[u("div",bQe,fe(o.name)+": ",1),o.help?(w(),M("label",EQe,[ne(u("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,vQe),[[ut,o.isHelp]]),yQe])):q("",!0)],2),o.isHelp?(w(),M("p",SQe,fe(o.help),1)):q("",!0),ne(u("input",{type:"text","onUpdate:modelValue":l=>o.value=l,class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Enter comma separated values"},null,8,TQe),[[Pe,o.value]])])):q("",!0),xQe]))),256)),u("div",CQe,[u("div",RQe,[u("button",{onClick:e[1]||(e[1]=Te(o=>r.hide(!0),["stop"])),type:"button",class:"mr-2 text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"},fe(s.ConfirmButtonText),1),u("button",{onClick:e[2]||(e[2]=Te(o=>r.hide(!1),["stop"])),type:"button",class:"text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-11 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600"},fe(s.DenyButtonText),1)])])])])])])):q("",!0)}const Ec=bt(JKe,[["render",AQe]]),wQe={data(){return{show:!1,message:"",resolve:null,ConfirmButtonText:"Yes, I'm sure",DenyButtonText:"No, cancel"}},methods:{hide(n){this.show=!1,this.resolve&&(this.resolve(n),this.resolve=null)},askQuestion(n,e,t){return this.ConfirmButtonText=e||this.ConfirmButtonText,this.DenyButtonText=t||this.DenyButtonText,new Promise(i=>{this.message=n,this.show=!0,this.resolve=i})}}},NQe={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50"},OQe={class:"relative w-full max-w-md max-h-full"},IQe={class:"relative bg-white rounded-lg shadow dark:bg-gray-700"},MQe=u("svg",{"aria-hidden":"true",class:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1),DQe=u("span",{class:"sr-only"},"Close modal",-1),kQe=[MQe,DQe],LQe={class:"p-4 text-center"},PQe=u("svg",{"aria-hidden":"true",class:"mx-auto mb-4 text-gray-400 w-14 h-14 dark:text-gray-200",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1),UQe={class:"mb-5 text-lg font-normal text-gray-500 dark:text-gray-400 select-none break-all"};function FQe(n,e,t,i,s,r){return s.show?(w(),M("div",NQe,[u("div",OQe,[u("div",IQe,[u("button",{type:"button",onClick:e[0]||(e[0]=o=>r.hide(!1)),class:"absolute top-3 right-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-800 dark:hover:text-white"},kQe),u("div",LQe,[PQe,u("h3",UQe,fe(s.message),1),u("button",{onClick:e[1]||(e[1]=o=>r.hide(!0)),type:"button",class:"text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 dark:focus:ring-red-800 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2"},fe(s.ConfirmButtonText),1),u("button",{onClick:e[2]||(e[2]=o=>r.hide(!1)),type:"button",class:"text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600"},fe(s.DenyButtonText),1)])])])])):q("",!0)}const BN=bt(wQe,[["render",FQe]]),BQe={props:{personality:{type:Object,required:!0},config:{type:Object,required:!0}},data(){return{show:!1,title:"Add AI Agent",iconUrl:"",file:null,tempConfig:{}}},methods:{showForm(){this.showDialog=!0},hideForm(){this.showDialog=!1},selectIcon(n){n.target.files&&(this.file=n.target.files[0],this.iconUrl=URL.createObjectURL(this.file))},showPanel(){this.show=!0},hide(){this.show=!1},submitForm(){Me.post("/set_personality_config",{category:this.personality.category,name:this.personality.folder,config:this.config}).then(n=>{const e=n.data;console.log("Done"),e.status?(this.currentPersonConfig=e.config,this.showPersonalityEditor=!0):console.error(e.error)}).catch(n=>{console.error(n)})}}},GQe={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50 z-20"},zQe={class:"relative w-full max-h-full bg-bg-light dark:bg-bg-dark"},VQe={class:"w-full h-full relative items-center gap-2 rounded-lg border bg-bg-light dark:bg-bg-dark p-1.5 shadow-sm hover:shadow-none dark:border-gray-800 dark:bg-gray-900"},HQe=u("svg",{"aria-hidden":"true",class:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1),qQe=u("span",{class:"sr-only"},"Close modal",-1),YQe=[HQe,qQe],$Qe={class:"justify-center text-center items-center w-full bg-bg-light dark:bg-bg-dark"},WQe={class:"w-full flex flex-row mt-4 text-center justify-center"},KQe={class:"w-full max-h-full container bg-bg-light dark:bg-bg-dark"},jQe={class:"mb-4 w-full"},QQe={class:"w-full bg-bg-light dark:bg-bg-dark"},XQe=u("td",null,[u("label",{for:"personalityConditioning"},"Personality Conditioning:")],-1),ZQe=u("td",null,[u("label",{for:"userMessagePrefix"},"User Message Prefix:")],-1),JQe=u("td",null,[u("label",{for:"aiMessagePrefix"},"AI Message Prefix:")],-1),eXe=u("td",null,[u("label",{for:"linkText"},"Link Text:")],-1),tXe=u("td",null,[u("label",{for:"welcomeMessage"},"Welcome Message:")],-1),nXe=u("td",null,[u("label",{for:"modelTemperature"},"Model Temperature:")],-1),iXe=u("td",null,[u("label",{for:"modelNPredicts"},"Model N Predicts:")],-1),sXe=u("td",null,[u("label",{for:"modelNPredicts"},"Model N Predicts:")],-1),rXe=u("td",null,[u("label",{for:"modelTopK"},"Model Top K:")],-1),oXe=u("td",null,[u("label",{for:"modelTopP"},"Model Top P:")],-1),aXe=u("td",null,[u("label",{for:"modelRepeatPenalty"},"Model Repeat Penalty:")],-1),lXe=u("td",null,[u("label",{for:"modelRepeatLastN"},"Model Repeat Last N:")],-1),cXe=u("td",null,[u("label",{for:"recommendedBinding"},"Recommended Binding:")],-1),dXe=u("td",null,[u("label",{for:"recommendedModel"},"Recommended Model:")],-1),uXe=u("td",null,[u("label",{class:"dark:bg-black dark:text-primary w-full",for:"dependencies"},"Dependencies:")],-1),pXe=u("td",null,[u("label",{for:"antiPrompts"},"Anti Prompts:")],-1);function _Xe(n,e,t,i,s,r){return s.show?(w(),M("div",GQe,[u("div",zQe,[u("div",VQe,[u("button",{type:"button",onClick:e[0]||(e[0]=o=>r.hide()),class:"absolute top-1 right-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-800 dark:hover:text-white"},YQe),u("div",$Qe,[u("div",WQe,[u("button",{type:"submit",onClick:e[1]||(e[1]=Te((...o)=>r.submitForm&&r.submitForm(...o),["prevent"])),class:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"}," Commit AI to Server "),u("button",{onClick:e[2]||(e[2]=Te(o=>r.hide(),["prevent"])),class:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"}," Close ")]),u("div",KQe,[u("form",jQe,[u("table",QQe,[u("tr",null,[XQe,u("td",null,[ne(u("textarea",{class:"dark:bg-black dark:text-primary w-full",id:"personalityConditioning","onUpdate:modelValue":e[3]||(e[3]=o=>t.config.personality_conditioning=o)},null,512),[[Pe,t.config.personality_conditioning]])])]),u("tr",null,[ZQe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"text",id:"userMessagePrefix","onUpdate:modelValue":e[4]||(e[4]=o=>t.config.user_message_prefix=o)},null,512),[[Pe,t.config.user_message_prefix]])])]),u("tr",null,[JQe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"text",id:"aiMessagePrefix","onUpdate:modelValue":e[5]||(e[5]=o=>t.config.ai_message_prefix=o)},null,512),[[Pe,t.config.ai_message_prefix]])])]),u("tr",null,[eXe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"text",id:"linkText","onUpdate:modelValue":e[6]||(e[6]=o=>t.config.link_text=o)},null,512),[[Pe,t.config.link_text]])])]),u("tr",null,[tXe,u("td",null,[ne(u("textarea",{class:"dark:bg-black dark:text-primary w-full",id:"welcomeMessage","onUpdate:modelValue":e[7]||(e[7]=o=>t.config.welcome_message=o)},null,512),[[Pe,t.config.welcome_message]])])]),u("tr",null,[nXe,u("td",null,[ne(u("input",{type:"number",id:"modelTemperature","onUpdate:modelValue":e[8]||(e[8]=o=>t.config.model_temperature=o)},null,512),[[Pe,t.config.model_temperature]])])]),u("tr",null,[iXe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"number",id:"modelNPredicts","onUpdate:modelValue":e[9]||(e[9]=o=>t.config.model_n_predicts=o)},null,512),[[Pe,t.config.model_n_predicts]])])]),u("tr",null,[sXe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"number",id:"modelNPredicts","onUpdate:modelValue":e[10]||(e[10]=o=>t.config.model_n_predicts=o)},null,512),[[Pe,t.config.model_n_predicts]])])]),u("tr",null,[rXe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"number",id:"modelTopK","onUpdate:modelValue":e[11]||(e[11]=o=>t.config.model_top_k=o)},null,512),[[Pe,t.config.model_top_k]])])]),u("tr",null,[oXe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"number",id:"modelTopP","onUpdate:modelValue":e[12]||(e[12]=o=>t.config.model_top_p=o)},null,512),[[Pe,t.config.model_top_p]])])]),u("tr",null,[aXe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"number",id:"modelRepeatPenalty","onUpdate:modelValue":e[13]||(e[13]=o=>t.config.model_repeat_penalty=o)},null,512),[[Pe,t.config.model_repeat_penalty]])])]),u("tr",null,[lXe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"number",id:"modelRepeatLastN","onUpdate:modelValue":e[14]||(e[14]=o=>t.config.model_repeat_last_n=o)},null,512),[[Pe,t.config.model_repeat_last_n]])])]),u("tr",null,[cXe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"text",id:"recommendedBinding","onUpdate:modelValue":e[15]||(e[15]=o=>t.config.recommended_binding=o)},null,512),[[Pe,t.config.recommended_binding]])])]),u("tr",null,[dXe,u("td",null,[ne(u("input",{class:"dark:bg-black dark:text-primary w-full",type:"text",id:"recommendedModel","onUpdate:modelValue":e[16]||(e[16]=o=>t.config.recommended_model=o)},null,512),[[Pe,t.config.recommended_model]])])]),u("tr",null,[uXe,u("td",null,[ne(u("textarea",{class:"dark:bg-black dark:text-primary w-full",id:"dependencies","onUpdate:modelValue":e[17]||(e[17]=o=>t.config.dependencies=o)},null,512),[[Pe,t.config.dependencies]])])]),u("tr",null,[pXe,u("td",null,[ne(u("textarea",{class:"dark:bg-black dark:text-primary w-full",id:"antiPrompts","onUpdate:modelValue":e[18]||(e[18]=o=>t.config.anti_prompts=o)},null,512),[[Pe,t.config.anti_prompts]])])])])])])])])])])):q("",!0)}const GN=bt(BQe,[["render",_Xe]]);const hXe={data(){return{showPopup:!1,webpageUrl:"https://lollms.com/"}},methods:{show(){this.showPopup=!0},hide(){this.showPopup=!1},save_configuration(){Me.post("/apply_settings",{client_id:this.$store.state.client_id,config:this.$store.state.config}).then(n=>{this.isLoading=!1,n.data.status?(this.$store.state.toast.showToast("Configuration changed successfully.",4,!0),this.settingsChanged=!1):this.$store.state.toast.showToast("Configuration change failed.",4,!1)})}}},fXe=n=>(Nr("data-v-d504dfc9"),n=n(),Or(),n),mXe={key:0,class:"fixed inset-0 flex items-center justify-center z-50"},gXe={class:"popup-container"},bXe=["src"],EXe={class:"checkbox-container"},vXe=fXe(()=>u("label",{for:"startup",class:"checkbox-label"},"Show at startup",-1));function yXe(n,e,t,i,s,r){return w(),xt(ls,{name:"fade"},{default:Je(()=>[s.showPopup?(w(),M("div",mXe,[u("div",gXe,[u("button",{onClick:e[0]||(e[0]=(...o)=>r.hide&&r.hide(...o)),class:"close-button"}," X "),u("iframe",{src:s.webpageUrl,class:"iframe-content"},null,8,bXe),u("div",EXe,[ne(u("input",{type:"checkbox",id:"startup",class:"styled-checkbox","onUpdate:modelValue":e[1]||(e[1]=o=>this.$store.state.config.show_news_panel=o),onChange:e[2]||(e[2]=(...o)=>r.save_configuration&&r.save_configuration(...o))},null,544),[[ut,this.$store.state.config.show_news_panel]]),vXe])])])):q("",!0)]),_:1})}const zN=bt(hXe,[["render",yXe],["__scopeId","data-v-d504dfc9"]]),VN="/assets/fastapi-4a6542d0.png",HN="/assets/discord-6817c341.svg";const SXe={key:0,class:"container flex flex-col sm:flex-row items-center"},TXe={class:"w-full"},xXe={class:"flex flex-row font-medium nav-ul"},qN={__name:"Navigation",setup(n){return(e,t)=>e.$store.state.ready?(w(),M("div",SXe,[u("div",TXe,[u("div",xXe,[Oe(vt(cr),{to:{name:"discussions"},class:"link-item dark:link-item-dark bg-light hover:bg-bg-light-tone dark:bg-bg-dark-tone hover:dark:bg-bg-light-tone"},{default:Je(()=>[je(" Discussions ")]),_:1}),Oe(vt(cr),{to:{name:"playground"},class:"link-item dark:link-item-dark bg-light hover:bg-bg-light-tone dark:bg-bg-dark-tone hover:dark:bg-bg-light-tone"},{default:Je(()=>[je(" Playground ")]),_:1}),e.$store.state.config.enable_comfyui_service?(w(),xt(vt(cr),{key:0,to:{name:"ComfyUI"},class:"link-item dark:link-item-dark bg-light hover:bg-bg-light-tone dark:bg-bg-dark-tone hover:dark:bg-bg-light-tone"},{default:Je(()=>[je(" ComfyUI ")]),_:1})):q("",!0),e.$store.state.config.enable_voice_service?(w(),xt(vt(cr),{key:1,to:{name:"interactive"},class:"link-item dark:link-item-dark bg-light hover:bg-bg-light-tone dark:bg-bg-dark-tone hover:dark:bg-bg-light-tone"},{default:Je(()=>[je(" interactive ")]),_:1})):q("",!0),Oe(vt(cr),{to:{name:"settings"},class:"link-item dark:link-item-dark bg-light hover:bg-bg-light-tone dark:bg-bg-dark-tone hover:dark:bg-bg-light-tone"},{default:Je(()=>[je(" Settings ")]),_:1}),Oe(vt(cr),{to:{name:"help"},class:"link-item dark:link-item-dark bg-light hover:bg-bg-light-tone dark:bg-bg-dark-tone hover:dark:bg-bg-light-tone"},{default:Je(()=>[je(" Help ")]),_:1})])])])):q("",!0)}},YN="/assets/static_info-b284ded1.svg",CXe="/assets/animated_info-7edcb0f9.svg";const RXe={class:"top-0 shadow-lg"},AXe={class:"container flex flex-col lg:flex-row item-center gap-2 pb-0"},wXe=u("div",{class:"flex items-center gap-3 flex-1"},[u("img",{class:"w-12 hover:scale-95 duration-150",title:"LoLLMS WebUI",src:ga,alt:"Logo"}),u("div",{class:"flex flex-col"},[u("p",{class:"text-2xl"},"LoLLMS"),u("p",{class:"text-gray-400"},"One tool to rule them all")])],-1),NXe={class:"flex gap-3 flex-1 items-center justify-end"},OXe={key:0,title:"Model is ok",class:"text-green-500 cursor-pointer"},IXe=u("b",{class:"text-2xl"},"M",-1),MXe=[IXe],DXe={key:1,title:"Model is not ok",class:"text-red-500 cursor-pointer"},kXe=u("b",{class:"text-2xl"},"M",-1),LXe=[kXe],PXe={key:2,title:"Text is not being generated. Ready to generate",class:"text-green-500 cursor-pointer"},UXe=u("i",{"data-feather":"flag"},null,-1),FXe=[UXe],BXe={key:3,title:"Generation in progress...",class:"text-red-500 cursor-pointer"},GXe=u("i",{"data-feather":"flag"},null,-1),zXe=[GXe],VXe={key:4,title:"Connection status: Connected",class:"text-green-500 cursor-pointer"},HXe=u("i",{"data-feather":"zap"},null,-1),qXe=[HXe],YXe={key:5,title:"Connection status: Not connected",class:"text-red-500 cursor-pointer"},$Xe=u("i",{"data-feather":"zap-off"},null,-1),WXe=[$Xe],KXe=u("div",{class:"text-2xl hover:text-primary duration-150",title:"restart program"},[u("i",{"data-feather":"power"})],-1),jXe=[KXe],QXe=u("div",{class:"text-2xl hover:text-primary duration-150",title:"refresh page"},[u("i",{"data-feather":"refresh-ccw"})],-1),XXe=[QXe],ZXe={href:"https://github.com/ParisNeo/lollms-webui",target:"_blank"},JXe={class:"text-2xl hover:text-primary duration-150",title:"Fast API doc"},eZe={href:"/docs",target:"_blank"},tZe=["src"],nZe=zu('
',2),iZe={href:"https://twitter.com/SpaceNerduino",target:"_blank"},sZe={class:"text-2xl hover:fill-primary dark:fill-white dark:hover:fill-primary duration-150",title:"Follow me on my twitter acount"},rZe={class:"w-10 h-10 rounded-lg object-fill dark:text-white",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1668.56 1221.19",style:{"enable-background":"new 0 0 1668.56 1221.19"},"xml:space":"preserve"},oZe=u("g",{id:"layer1",transform:"translate(52.390088,-25.058597)"},[u("path",{id:"path1009",d:`M283.94,167.31l386.39,516.64L281.5,1104h87.51l340.42-367.76L984.48,1104h297.8L874.15,558.3l361.92-390.99\r + h-87.51l-313.51,338.7l-253.31-338.7H283.94z M412.63,231.77h136.81l604.13,807.76h-136.81L412.63,231.77z`})],-1),aZe=[oZe],lZe={href:"https://discord.com/channels/1092918764925882418",target:"_blank"},cZe={class:"text-2xl hover:text-primary duration-150",title:"Visit my discord channel"},dZe=["src"],uZe=u("i",{"data-feather":"sun"},null,-1),pZe=[uZe],_Ze=u("i",{"data-feather":"moon"},null,-1),hZe=[_Ze],fZe=["src"],mZe={role:"status",class:"fixed m-0 p-2 left-2 bottom-2 min-w-[24rem] max-w-[24rem] h-20 flex flex-col justify-center items-center pb-4 bg-blue-500 rounded-lg shadow-lg z-50 background-a"},gZe={class:"text-2xl animate-pulse mt-2 text-white"},bZe={id:"app"},EZe=u("body",null,null,-1),vZe={name:"TopBar",computed:{currentPersonConfig(){try{return this.$store.state.currentPersonConfig}catch{console.log("Error finding current personality configuration");return}},selectedPersonality(){try{return this.$store.state.selectedPersonality}catch{console.log("Error finding current personality configuration");return}},loading_infos(){return this.$store.state.loading_infos},isModelOK(){return this.$store.state.isModelOk},isGenerating(){return this.$store.state.isGenerating},isConnected(){return this.$store.state.isConnected}},components:{Toast:fc,MessageBox:FN,ProgressBar:ic,UniversalForm:Ec,YesNoDialog:BN,Navigation:qN,PersonalityEditor:GN,PopupViewer:zN},watch:{isConnected(){this.isConnected?(console.log("this.is_first_connection"),console.log(this.is_first_connection),this.is_first_connection||(this.$store.state.messageBox.hideMessage(),this.$store.state.messageBox.showMessage("Server connected."),this.$store.state.config.activate_audio_infos&&this.connection_recovered_audio.play())):(this.$store.state.messageBox.showBlockingMessage("Server suddenly disconnected. Please reboot the server to recover the connection"),this.is_first_connection=!1,console.log("this.is_first_connection set to false"),console.log(this.is_first_connection),this.$store.state.config.activate_audio_infos&&this.connection_lost_audio.play()),Ve(()=>{qe.replace()})}},data(){return{static_info:YN,animated_info:CXe,is_first_connection:!0,discord:HN,FastAPI:VN,rebooting_audio:new Audio("rebooting.wav"),connection_lost_audio:new Audio("connection_lost.wav"),connection_recovered_audio:new Audio("connection_recovered.wav"),database_selectorDialogVisible:!1,progress_visibility:!1,progress_value:0,codeBlockStylesheet:"",sunIcon:document.querySelector(".sun"),moonIcon:document.querySelector(".moon"),userTheme:localStorage.getItem("theme"),systemTheme:window.matchMedia("prefers-color-scheme: dark").matches}},mounted(){this.$store.state.toast=this.$refs.toast,this.$store.state.news=this.$refs.news,this.$store.state.messageBox=this.$refs.messageBox,this.$store.state.universalForm=this.$refs.universalForm,this.$store.state.yesNoDialog=this.$refs.yesNoDialog,this.$store.state.personality_editor=this.$refs.personality_editor,this.sunIcon=document.querySelector(".sun"),this.moonIcon=document.querySelector(".moon"),this.userTheme=localStorage.getItem("theme"),this.systemTheme=window.matchMedia("prefers-color-scheme: dark").matches,this.themeCheck(),Ve(()=>{qe.replace()})},created(){this.sunIcon=document.querySelector(".sun"),this.moonIcon=document.querySelector(".moon"),this.userTheme=localStorage.getItem("theme"),this.systemTheme=window.matchMedia("prefers-color-scheme: dark").matches},methods:{restartProgram(n){n.preventDefault(),this.$store.state.api_get_req("restart_program"),this.rebooting_audio.play(),this.$store.state.toast.showToast("Rebooting the app. Please wait...",410,!1),console.log("this.$store.state.api_get_req",this.$store.state.api_get_req),setTimeout(()=>{window.close()},2e3)},refreshPage(){window.location.href.split("/").length>4?window.location.href="/":window.location.reload(!0)},handleOk(n){console.log("Input text:",n)},showNews(){this.$store.state.news.show()},themeCheck(){if(this.userTheme=="dark"||!this.userTheme&&this.systemTheme){document.documentElement.classList.add("dark"),this.moonIcon.classList.add("display-none"),Ve(()=>{Fp(()=>Promise.resolve({}),["assets/stackoverflow-dark-57af98f5.css"])});return}Ve(()=>{Fp(()=>Promise.resolve({}),["assets/stackoverflow-light-077a2b3c.css"])}),this.sunIcon.classList.add("display-none")},themeSwitch(){if(document.documentElement.classList.contains("dark")){document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light"),this.userTheme=="light",this.iconToggle();return}Fp(()=>Promise.resolve({}),["assets/tokyo-night-dark-f9656fc4.css"]),document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark"),this.userTheme=="dark",this.iconToggle()},iconToggle(){this.sunIcon.classList.toggle("display-none"),this.moonIcon.classList.toggle("display-none")}}},yZe=Object.assign(vZe,{setup(n){return(e,t)=>(w(),M($e,null,[u("header",RXe,[u("nav",AXe,[Oe(vt(cr),{to:{name:"discussions"}},{default:Je(()=>[wXe]),_:1}),u("div",NXe,[e.isModelOK?(w(),M("div",OXe,MXe)):q("",!0),e.isModelOK?q("",!0):(w(),M("div",DXe,LXe)),e.isGenerating?q("",!0):(w(),M("div",PXe,FXe)),e.isGenerating?(w(),M("div",BXe,zXe)):q("",!0),e.isConnected?(w(),M("div",VXe,qXe)):q("",!0),e.isConnected?q("",!0):(w(),M("div",YXe,WXe)),u("a",{href:"#",onClick:t[0]||(t[0]=(...i)=>e.restartProgram&&e.restartProgram(...i))},jXe),u("a",{href:"#",onClick:t[1]||(t[1]=(...i)=>e.refreshPage&&e.refreshPage(...i))},XXe),u("a",ZXe,[u("div",JXe,[u("a",eZe,[u("img",{src:vt(VN),width:"75",height:"25"},null,8,tZe)])])]),nZe,u("a",iZe,[u("div",sZe,[(w(),M("svg",rZe,aZe))])]),u("a",lZe,[u("div",cZe,[u("img",{src:vt(HN),width:"25",height:"25"},null,8,dZe)])]),u("div",{class:"sun text-2xl w-6 hover:text-primary duration-150 cursor-pointer",title:"Swith to Light theme",onClick:t[2]||(t[2]=i=>e.themeSwitch())},pZe),u("div",{class:"moon text-2xl w-6 hover:text-primary duration-150 cursor-pointer",title:"Swith to Dark theme",onClick:t[3]||(t[3]=i=>e.themeSwitch())},hZe),u("div",{class:"moon text-2xl w-6 hover:text-primary duration-150 cursor-pointer",title:"Lollms News",onClick:t[4]||(t[4]=i=>e.showNews())},[u("img",{src:vt(YN)},null,8,fZe)])])]),Oe(qN),Oe(fc,{ref:"toast"},null,512),Oe(FN,{ref:"messageBox"},null,512),ne(u("div",mZe,[Oe(ic,{ref:"progress",progress:e.progress_value,class:"w-full h-4"},null,8,["progress"]),u("p",gZe,fe(e.loading_infos)+" ...",1)],512),[[Ot,e.progress_visibility]]),Oe(Ec,{ref:"universalForm",class:"z-20"},null,512),Oe(BN,{ref:"yesNoDialog",class:"z-20"},null,512),Oe(GN,{ref:"personality_editor",config:e.currentPersonConfig,personality:e.selectedPersonality},null,8,["config","personality"]),u("div",bZe,[Oe(zN,{ref:"news"},null,512)])]),EZe],64))}}),SZe={class:"flex overflow-hidden flex-grow w-full"},TZe={__name:"App",setup(n){return(e,t)=>(w(),M("div",{class:Ye([e.currentTheme,"flex flex-col h-screen font-sans bg-bg-light text-slate-950 dark:bg-bg-dark dark:text-slate-50 w-full dark:bg-bg-dark overflow-hidden"])},[Oe(yZe),u("div",SZe,[Oe(vt(Ww),null,{default:Je(({Component:i})=>[(w(),xt(P2,null,[(w(),xt(Fu(i)))],1024))]),_:1})])],2))}},cs=Object.create(null);cs.open="0";cs.close="1";cs.ping="2";cs.pong="3";cs.message="4";cs.upgrade="5";cs.noop="6";const Pd=Object.create(null);Object.keys(cs).forEach(n=>{Pd[cs[n]]=n});const Xg={type:"error",data:"parser error"},$N=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",WN=typeof ArrayBuffer=="function",KN=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,vE=({type:n,data:e},t,i)=>$N&&e instanceof Blob?t?i(e):vC(e,i):WN&&(e instanceof ArrayBuffer||KN(e))?t?i(e):vC(new Blob([e]),i):i(cs[n]+(e||"")),vC=(n,e)=>{const t=new FileReader;return t.onload=function(){const i=t.result.split(",")[1];e("b"+(i||""))},t.readAsDataURL(n)};function yC(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let Um;function xZe(n,e){if($N&&n.data instanceof Blob)return n.data.arrayBuffer().then(yC).then(e);if(WN&&(n.data instanceof ArrayBuffer||KN(n.data)))return e(yC(n.data));vE(n,!1,t=>{Um||(Um=new TextEncoder),e(Um.encode(t))})}const SC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Al=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n{let e=n.length*.75,t=n.length,i,s=0,r,o,a,l;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const d=new ArrayBuffer(e),c=new Uint8Array(d);for(i=0;i>4,c[s++]=(o&15)<<4|a>>2,c[s++]=(a&3)<<6|l&63;return d},RZe=typeof ArrayBuffer=="function",yE=(n,e)=>{if(typeof n!="string")return{type:"message",data:jN(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:AZe(n.substring(1),e)}:Pd[t]?n.length>1?{type:Pd[t],data:n.substring(1)}:{type:Pd[t]}:Xg},AZe=(n,e)=>{if(RZe){const t=CZe(n);return jN(t,e)}else return{base64:!0,data:n}},jN=(n,e)=>{switch(e){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},QN=String.fromCharCode(30),wZe=(n,e)=>{const t=n.length,i=new Array(t);let s=0;n.forEach((r,o)=>{vE(r,!1,a=>{i[o]=a,++s===t&&e(i.join(QN))})})},NZe=(n,e)=>{const t=n.split(QN),i=[];for(let s=0;s{const i=t.length;let s;if(i<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,i);else if(i<65536){s=new Uint8Array(3);const r=new DataView(s.buffer);r.setUint8(0,126),r.setUint16(1,i)}else{s=new Uint8Array(9);const r=new DataView(s.buffer);r.setUint8(0,127),r.setBigUint64(1,BigInt(i))}n.data&&typeof n.data!="string"&&(s[0]|=128),e.enqueue(s),e.enqueue(t)})}})}let Fm;function Hc(n){return n.reduce((e,t)=>e+t.length,0)}function qc(n,e){if(n[0].length===e)return n.shift();const t=new Uint8Array(e);let i=0;for(let s=0;sMath.pow(2,53-32)-1){a.enqueue(Xg);break}s=c*Math.pow(2,32)+d.getUint32(4),i=3}else{if(Hc(t)n){a.enqueue(Xg);break}}}})}const XN=4;function dn(n){if(n)return MZe(n)}function MZe(n){for(var e in dn.prototype)n[e]=dn.prototype[e];return n}dn.prototype.on=dn.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this};dn.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this};dn.prototype.off=dn.prototype.removeListener=dn.prototype.removeAllListeners=dn.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+n];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var i,s=0;stypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function ZN(n,...e){return e.reduce((t,i)=>(n.hasOwnProperty(i)&&(t[i]=n[i]),t),{})}const DZe=mi.setTimeout,kZe=mi.clearTimeout;function lp(n,e){e.useNativeTimers?(n.setTimeoutFn=DZe.bind(mi),n.clearTimeoutFn=kZe.bind(mi)):(n.setTimeoutFn=mi.setTimeout.bind(mi),n.clearTimeoutFn=mi.clearTimeout.bind(mi))}const LZe=1.33;function PZe(n){return typeof n=="string"?UZe(n):Math.ceil((n.byteLength||n.size)*LZe)}function UZe(n){let e=0,t=0;for(let i=0,s=n.length;i=57344?t+=3:(i++,t+=4);return t}function FZe(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function BZe(n){let e={},t=n.split("&");for(let i=0,s=t.length;i0);return e}function eO(){const n=CC(+new Date);return n!==xC?(TC=0,xC=n):n+"."+CC(TC++)}for(;Yc{this.readyState="paused",e()};if(this.polling||!this.writable){let i=0;this.polling&&(i++,this.once("pollComplete",function(){--i||t()})),this.writable||(i++,this.once("drain",function(){--i||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};NZe(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,wZe(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=eO()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new oa(this.uri(),e)}doWrite(e,t){const i=this.request({method:"POST",data:e});i.on("success",t),i.on("error",(s,r)=>{this.onError("xhr post error",s,r)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,i)=>{this.onError("xhr poll error",t,i)}),this.pollXhr=e}}let oa=class Ud extends dn{constructor(e,t){super(),lp(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=t.data!==void 0?t.data:null,this.create()}create(){var e;const t=ZN(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;const i=this.xhr=new nO(t);try{i.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let s in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(s)&&i.setRequestHeader(s,this.opts.extraHeaders[s])}}catch{}if(this.method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(i),"withCredentials"in i&&(i.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(i.timeout=this.opts.requestTimeout),i.onreadystatechange=()=>{var s;i.readyState===3&&((s=this.opts.cookieJar)===null||s===void 0||s.parseCookies(i)),i.readyState===4&&(i.status===200||i.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof i.status=="number"?i.status:0)},0))},i.send(this.data)}catch(s){this.setTimeoutFn(()=>{this.onError(s)},0);return}typeof document<"u"&&(this.index=Ud.requestsCount++,Ud.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=HZe,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Ud.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};oa.requestsCount=0;oa.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",RC);else if(typeof addEventListener=="function"){const n="onpagehide"in mi?"pagehide":"unload";addEventListener(n,RC,!1)}}function RC(){for(let n in oa.requests)oa.requests.hasOwnProperty(n)&&oa.requests[n].abort()}const TE=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0))(),$c=mi.WebSocket||mi.MozWebSocket,AC=!0,$Ze="arraybuffer",wC=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class WZe extends SE{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,i=wC?{}:ZN(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=AC&&!wC?t?new $c(e,t):new $c(e):new $c(e,t,i)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t{const o={};try{AC&&this.ws.send(r)}catch{}s&&TE(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=eO()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!$c}}class KZe extends SE{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{const t=IZe(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(t).getReader(),s=OZe();s.readable.pipeTo(e.writable),this.writer=s.writable.getWriter();const r=()=>{i.read().then(({done:a,value:l})=>{a||(this.onPacket(l),r())}).catch(a=>{})};r();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let t=0;t{s&&TE(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}}const jZe={websocket:WZe,webtransport:KZe,polling:YZe},QZe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,XZe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Jg(n){const e=n,t=n.indexOf("["),i=n.indexOf("]");t!=-1&&i!=-1&&(n=n.substring(0,t)+n.substring(t,i).replace(/:/g,";")+n.substring(i,n.length));let s=QZe.exec(n||""),r={},o=14;for(;o--;)r[XZe[o]]=s[o]||"";return t!=-1&&i!=-1&&(r.source=e,r.host=r.host.substring(1,r.host.length-1).replace(/;/g,":"),r.authority=r.authority.replace("[","").replace("]","").replace(/;/g,":"),r.ipv6uri=!0),r.pathNames=ZZe(r,r.path),r.queryKey=JZe(r,r.query),r}function ZZe(n,e){const t=/\/{2,9}/g,i=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}function JZe(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,s,r){s&&(t[s]=r)}),t}let iO=class Ko extends dn{constructor(e,t={}){super(),this.binaryType=$Ze,this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=Jg(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=Jg(t.host).host),lp(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=BZe(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=XN,t.transport=e,this.id&&(t.sid=this.id);const i=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new jZe[e](i)}open(){let e;if(this.opts.rememberUpgrade&&Ko.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){let t=this.createTransport(e),i=!1;Ko.priorWebsocketSuccess=!1;const s=()=>{i||(t.send([{type:"ping",data:"probe"}]),t.once("packet",_=>{if(!i)if(_.type==="pong"&&_.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Ko.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const f=new Error("probe error");f.transport=t.name,this.emitReserved("upgradeError",f)}}))};function r(){i||(i=!0,c(),t.close(),t=null)}const o=_=>{const f=new Error("probe error: "+_);f.transport=t.name,r(),this.emitReserved("upgradeError",f)};function a(){o("transport closed")}function l(){o("socket closed")}function d(_){t&&_.name!==t.name&&r()}const c=()=>{t.removeListener("open",s),t.removeListener("error",o),t.removeListener("close",a),this.off("close",l),this.off("upgrading",d)};t.once("open",s),t.once("error",o),t.once("close",a),this.once("close",l),this.once("upgrading",d),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{i||t.open()},200):t.open()}onOpen(){if(this.readyState="open",Ko.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let i=0;i0&&t>this.maxPayload)return this.writeBuffer.slice(0,i);t+=2}return this.writeBuffer}write(e,t,i){return this.sendPacket("message",e,t,i),this}send(e,t,i){return this.sendPacket("message",e,t,i),this}sendPacket(e,t,i,s){if(typeof t=="function"&&(s=t,t=void 0),typeof i=="function"&&(s=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const r={type:e,data:t,options:i};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),s&&this.once("flush",s),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},i=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():e()}):this.upgrading?i():e()),this}onError(e){Ko.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let i=0;const s=e.length;for(;itypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,sO=Object.prototype.toString,iJe=typeof Blob=="function"||typeof Blob<"u"&&sO.call(Blob)==="[object BlobConstructor]",sJe=typeof File=="function"||typeof File<"u"&&sO.call(File)==="[object FileConstructor]";function xE(n){return tJe&&(n instanceof ArrayBuffer||nJe(n))||iJe&&n instanceof Blob||sJe&&n instanceof File}function Fd(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,i=n.length;t=0&&n.num{delete this.acks[e];for(let o=0;o{this.io.clearTimeoutFn(r),t.apply(this,[null,...o])}}emitWithAck(e,...t){const i=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((s,r)=>{t.push((o,a)=>i?o?r(o):s(a):s(o)),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((s,...r)=>i!==this._queue[0]?void 0:(s!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(s)):(this._queue.shift(),t&&t(null,...r)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Dt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Dt.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Dt.EVENT:case Dt.BINARY_EVENT:this.onevent(e);break;case Dt.ACK:case Dt.BINARY_ACK:this.onack(e);break;case Dt.DISCONNECT:this.ondisconnect();break;case Dt.CONNECT_ERROR:this.destroy();const i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const i of t)i.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let i=!1;return function(...s){i||(i=!0,t.packet({type:Dt.ACK,id:e,data:s}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Dt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let i=0;i0&&n.jitter<=1?n.jitter:0,this.attempts=0}Ka.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=Math.floor(e*10)&1?n+t:n-t}return Math.min(n,this.max)|0};Ka.prototype.reset=function(){this.attempts=0};Ka.prototype.setMin=function(n){this.ms=n};Ka.prototype.setMax=function(n){this.max=n};Ka.prototype.setJitter=function(n){this.jitter=n};class nb extends dn{constructor(e,t){var i;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,lp(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((i=t.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Ka({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const s=t.parser||uJe;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new iO(this.uri,this.opts);const t=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const s=ki(t,"open",function(){i.onopen(),e&&e()}),r=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},o=ki(t,"error",r);if(this._timeout!==!1){const a=this._timeout,l=this.setTimeoutFn(()=>{s(),r(new Error("timeout")),t.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(s),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(ki(e,"ping",this.onping.bind(this)),ki(e,"data",this.ondata.bind(this)),ki(e,"error",this.onerror.bind(this)),ki(e,"close",this.onclose.bind(this)),ki(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){TE(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new rO(this,e,t),this.nsps[e]=i),i}_destroy(e){const t=Object.keys(this.nsps);for(const i of t)if(this.nsps[i].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let i=0;ie()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):e.onreconnect()}))},t);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const hl={};function Bd(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=eJe(n,e.path||"/socket.io"),i=t.source,s=t.id,r=t.path,o=hl[s]&&r in hl[s].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let l;return a?l=new nb(i,e):(hl[s]||(hl[s]=new nb(i,e)),l=hl[s]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(Bd,{Manager:nb,Socket:rO,io:Bd,connect:Bd});const oO="/";console.log(oO);const Ze=new Bd(oO,{reconnection:!0,reconnectionAttempts:10,reconnectionDelay:1e3});const _Je={props:{value:String,inputType:{type:String,default:"text",validator:n=>["text","email","password","file","path","integer","float"].includes(n)},fileAccept:String},data(){return{inputValue:this.value,placeholderText:this.getPlaceholderText()}},watch:{value(n){console.log("Changing value to ",n),this.inputValue=n}},mounted(){Ve(()=>{qe.replace()}),console.log("Changing value to ",this.value),this.inputValue=this.value},methods:{handleSliderInput(n){this.inputValue=n.target.value,this.$emit("input",n.target.value)},getPlaceholderText(){switch(this.inputType){case"text":return"Enter text here";case"email":return"Enter your email";case"password":return"Enter your password";case"file":case"path":return"Choose a file";case"integer":return"Enter an integer";case"float":return"Enter a float";default:return"Enter value here"}},handleInput(n){if(this.inputType==="integer"){const e=n.target.value.replace(/[^0-9]/g,"");this.inputValue=e}console.log("handling input : ",n.target.value),this.$emit("input",n.target.value)},async pasteFromClipboard(){try{const n=await navigator.clipboard.readText();this.handleClipboardData(n)}catch(n){console.error("Failed to read from clipboard:",n)}},handlePaste(n){const e=n.clipboardData.getData("text");this.handleClipboardData(e)},handleClipboardData(n){switch(this.inputType){case"email":this.inputValue=this.isValidEmail(n)?n:"";break;case"password":this.inputValue=n;break;case"file":case"path":this.inputValue="";break;case"integer":this.inputValue=this.parseInteger(n);break;case"float":this.inputValue=this.parseFloat(n);break;default:this.inputValue=n;break}},isValidEmail(n){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)},parseInteger(n){const e=parseInt(n);return isNaN(e)?"":e},parseFloat(n){const e=parseFloat(n);return isNaN(e)?"":e},openFileInput(){this.$refs.fileInput.click()},handleFileInputChange(n){const e=n.target.files[0];e&&(this.inputValue=e.name)}}},hJe={class:"flex items-center space-x-2"},fJe=["value","type","placeholder"],mJe=["value","min","max"],gJe=u("i",{"data-feather":"clipboard"},null,-1),bJe=[gJe],EJe=u("i",{"data-feather":"upload"},null,-1),vJe=[EJe],yJe=["accept"];function SJe(n,e,t,i,s,r){return w(),M("div",hJe,[n.useSlider?(w(),M("input",{key:1,type:"range",value:parseInt(s.inputValue),min:n.minSliderValue,max:n.maxSliderValue,onInput:e[2]||(e[2]=(...o)=>r.handleSliderInput&&r.handleSliderInput(...o)),class:"flex-1 px-4 py-2 text-lg border dark:bg-gray-600 border-gray-300 rounded-md focus:outline-none focus:ring focus:border-blue-500"},null,40,mJe)):(w(),M("input",{key:0,value:s.inputValue,type:t.inputType,placeholder:s.placeholderText,onInput:e[0]||(e[0]=(...o)=>r.handleInput&&r.handleInput(...o)),onPaste:e[1]||(e[1]=(...o)=>r.handlePaste&&r.handlePaste(...o)),class:"flex-1 px-4 py-2 text-lg dark:bg-gray-600 border border-gray-300 rounded-md focus:outline-none focus:ring focus:border-blue-500"},null,40,fJe)),u("button",{onClick:e[3]||(e[3]=(...o)=>r.pasteFromClipboard&&r.pasteFromClipboard(...o)),class:"p-2 bg-blue-500 dark:bg-gray-600 text-white rounded-md hover:bg-blue-600 focus:outline-none focus:ring focus:border-blue-300"},bJe),t.inputType==="file"?(w(),M("button",{key:2,onClick:e[4]||(e[4]=(...o)=>r.openFileInput&&r.openFileInput(...o)),class:"p-2 bg-blue-500 text-white rounded-md hover:bg-blue-600 focus:outline-none focus:ring focus:border-blue-300"},vJe)):q("",!0),t.inputType==="file"?(w(),M("input",{key:3,ref:"fileInput",type:"file",style:{display:"none"},accept:t.fileAccept,onChange:e[5]||(e[5]=(...o)=>r.handleFileInputChange&&r.handleFileInputChange(...o))},null,40,yJe)):q("",!0)])}const RE=bt(_Je,[["render",SJe]]),TJe={name:"TokensHighlighter",props:{namedTokens:{type:Object,required:!0}},data(){return{colors:["#FF6633","#FFB399","#FF33FF","#FFFF99","#00B3E6","#E6B333","#3366E6","#999966","#99FF99","#B34D4D","#80B300","#809900","#E6B3B3","#6680B3","#66991A","#FF99E6","#CCFF1A","#FF1A66","#E6331A","#33FFCC","#66994D","#B366CC","#4D8000","#B33300","#CC80CC","#66664D","#991AFF","#E666FF","#4DB3FF","#1AB399","#E666B3","#33991A","#CC9999","#B3B31A","#00E680","#4D8066","#809980","#E6FF80","#1AFF33","#999933","#FF3380","#CCCC00","#66E64D","#4D80CC","#9900B3","#E64D66","#4DB380","#FF4D4D","#99E6E6","#6666FF"]}}},xJe={class:"w-full"},CJe={class:"break-words"},RJe={class:"break-words mt-2"},AJe={class:"mt-4"};function wJe(n,e,t,i,s,r){return w(),M("div",xJe,[u("div",CJe,[(w(!0),M($e,null,ct(t.namedTokens,(o,a)=>(w(),M("span",{key:a},[u("span",{class:"inline-block whitespace-pre-wrap",style:en({backgroundColor:s.colors[a%s.colors.length]})},fe(o[0]),5)]))),128))]),u("div",RJe,[(w(!0),M($e,null,ct(t.namedTokens,(o,a)=>(w(),M("span",{key:a},[u("span",{class:"inline-block px-1 whitespace-pre-wrap",style:en({backgroundColor:s.colors[a%s.colors.length]})},fe(o[1]),5)]))),128))]),u("div",AJe,[u("strong",null,"Total Tokens: "+fe(t.namedTokens.length),1)])])}const NJe=bt(TJe,[["render",wJe]]);const OJe={props:{is_subcard:{type:Boolean,default:!1},is_shrunk:{type:Boolean,default:!1},title:{type:String,default:""},isHorizontal:{type:Boolean,default:!1},cardWidth:{type:String,default:"w-3/4"},disableHoverAnimation:{type:Boolean,default:!0},disableFocus:{type:Boolean,default:!1}},data(){return{shrink:this.is_shrunk,isHovered:!1,isActive:!1}},computed:{cardClass(){return["bg-gray-50","border","border-gray-300","text-gray-900","text-sm","rounded-lg","focus:ring-blue-500","focus:border-blue-500","w-full","p-2.5","dark:bg-gray-500","dark:border-gray-600","dark:placeholder-gray-400","dark:text-white","dark:focus:ring-blue-500","dark:focus:border-blue-500",{"cursor-pointer":!this.isActive&&!this.disableFocus,"w-auto":!this.isActive}]},cardWidthClass(){return this.isActive?this.cardWidth:""}},methods:{toggleCard(){this.disableFocus||(this.isActive=!this.isActive)}}},IJe={key:1,class:"flex flex-wrap"},MJe={key:2,class:"mb-2"};function DJe(n,e,t,i,s,r){return w(),M($e,null,[s.isActive?(w(),M("div",{key:0,class:"overlay",onClick:e[0]||(e[0]=(...o)=>r.toggleCard&&r.toggleCard(...o))})):q("",!0),ne(u("div",{class:Ye(["border-blue-300 rounded-lg shadow-lg p-2",r.cardWidthClass,"m-2",{"bg-white dark:bg-gray-800":t.is_subcard},{"bg-white dark:bg-gray-900":!t.is_subcard},{hovered:!t.disableHoverAnimation&&s.isHovered,active:s.isActive}]),onMouseenter:e[2]||(e[2]=o=>s.isHovered=!0),onMouseleave:e[3]||(e[3]=o=>s.isHovered=!1),onClick:e[4]||(e[4]=Te((...o)=>r.toggleCard&&r.toggleCard(...o),["self"])),style:en({cursor:this.disableFocus?"":"pointer"})},[t.title?(w(),M("div",{key:0,onClick:e[1]||(e[1]=o=>s.shrink=!0),class:Ye([{"text-center p-2 m-2 bg-gray-200":!t.is_subcard},"bg-gray-100 dark:bg-gray-500 rounded-lg pl-2 pr-2 mb-2 font-bold cursor-pointer"])},fe(t.title),3)):q("",!0),t.isHorizontal?(w(),M("div",IJe,[Dn(n.$slots,"default")])):(w(),M("div",MJe,[Dn(n.$slots,"default")]))],38),[[Ot,s.shrink===!1]]),t.is_subcard?ne((w(),M("div",{key:1,onClick:e[5]||(e[5]=o=>s.shrink=!1),class:"bg-white text-center text-xl bold dark:bg-gray-500 border-blue-300 rounded-lg shadow-lg p-2 h-10 cursor-pointer m-2"},fe(t.title),513)),[[Ot,s.shrink===!0]]):ne((w(),M("div",{key:2,onClick:e[6]||(e[6]=o=>s.shrink=!1),class:"bg-white text-center text-2xl dark:bg-gray-500 border-2 border-blue-300 rounded-lg shadow-lg p-0 h-7 cursor-pointer hover:h-8 hover:bg-blue-300"}," + ",512)),[[Ot,s.shrink===!0]])],64)}const vc=bt(OJe,[["render",DJe]]),aO="/assets/code_block-e2753d3f.svg",lO="/assets/python_block-4008a934.png",cO="/assets/javascript_block-5e59df30.svg",dO="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAOeSURBVGhD7ZhNaBNBGIZHW/EPbSioRSpi0FRpVdRSjQfxkFilB5UciuChIL0JLaKIhR5KIYKIiBSF0mLVS7AIavUgPQjiT4+KB0EP3gwS8VDBgj8d33d2ZrNJt2lCppKWfeBh5pvdncyXmZ3sZokQQsIFz1JdLni8M8L6QkSNf9HMSJBIpREkUmkEiVQaQSKVRpCIH8lkUtbW1sre3l7fB9FoNCrD4fC8PaSyYyudNzU1yZGRkYJ9dXV1yUQiYTMZNX6rM5LJZERHR0fBh0/MmJDSZh4OVhOZmprStf+P1UQmJyd1zaGvr09NuxM5VFVViYmJCR3Zw1oiPT09koP00tjYKNrb23XkEIlERHV1tY7sMuNbK5XR0VGJwcnBwcGi+uns7Cz7Mz24fVnpdGhoSDY0NBTbjxweHi77MzXu+N2KBebsh7PW0tJi6/OIGr/Vm72mpkbXssTj8ZxBp9NpUV9fryN7WE0kn1QqJcfHx3U0v1hNJBQKqXtFh2JsbEx0d3frKMv09LSu2UWtMadaHm1tberxQ+9Koq6uLqff1tZW2dzcLPXviy3c8bsVG/T398+6I8ViMTkwMGDtszRq/MEfdJVGkEilESRSaZSSyCa43anmsAPGII/7wWd7nnMEbmaDD2G41anmsA76tfui9mGnWpAPkOftVpEQuyDfkMz19Bv0cg56j9NP8AQ07IXm2Es2eHgK2b5RRf6Ya7OVOchP5D1kfA0m4GX4CxouQR7/A6/DC/CObqNRSA5A00Y7oeG/JMJBM65TUS7rIV/gefw4GzzchWx/rKJsIu90+REaik6knJv9hy5vw4NO1WU/XAG/w0ds8MABk326NLyGL+A2eJYNpVBOIhd1eRS+gs/hTjYAc4M+06WX+7rkt7zKqbrc0OV5WNIjUzmJDME9MKUiIQ5DvnyshOZfCL/+l+uSz/I/narLA8gvhLsb77miKScR8haegqfhb7gBcoa4M5G4Lr0069Kck88VXZ6B+TNWEHWzONWCpCHPM78lZhkZ3kAePwa36DpthQYulwxke5INwNzst1Tk8ASa66mVXYtLgFPOc7iVroUtOh6F3Gbv6fgLXAPJVWj65vU3IW9oxl+hWWJ+iRyC5lpqJZHP0JxjbnBO+UP4F5pjXNsnoRf+IJqZpNySmRSXoMEvEeL9Iqwkwm20Cfqt12UwAleraHZCcLbHEzLz75fiUeMP3hArjUWTiHdpLWgWyYwI8Q8rrSjH5vAr6AAAAABJRU5ErkJggg==",uO="/assets/cpp_block-109b2fbe.png",pO="/assets/html5_block-205d2852.png",_O="/assets/LaTeX_block-06b165c0.png",hO="/assets/bash_block-7ca80e4e.png",kJe="/assets/tokenize_icon-0553c60f.svg",LJe="/assets/deaf_on-7481cb29.svg",PJe="/assets/deaf_off-c2c46908.svg",UJe="/assets/rec_on-3b37b566.svg",FJe="/assets/rec_off-2c08e836.svg",fO="/assets/loading-c3bdfb0a.svg";const BJe="/";async function OC(n,e="",t=[]){return new Promise((i,s)=>{const r=document.createElement("div");r.className="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 z-50",t.length===0?r.innerHTML=`

${n}

@@ -77,13 +77,13 @@ https://github.com/highlightjs/highlight.js/issues/2277`),ae=P,Q=j),Y===void 0&&
- `,document.body.appendChild(r);const o=r.querySelector("#cancelButton"),a=r.querySelector("#okButton");o.addEventListener("click",()=>{document.body.removeChild(r),i(null)}),a.addEventListener("click",()=>{if(t.length===0){const d=r.querySelector("#replacementInput").value.trim();document.body.removeChild(r),i(d)}else{const d=r.querySelector("#options_selector").value.trim();document.body.removeChild(r),i(d)}})})}function FJe(n,e){console.log(n);let t={},i=/@<([^>]+)>@/g,s=[],r;for(;(r=i.exec(n))!==null;)s.push("@<"+r[1]+">@");console.log("matches"),console.log(s),s=[...new Set(s)];async function o(l){console.log(l);let d=l.toLowerCase().substring(2,l.length-2);if(d!=="generation_placeholder")if(d.includes(":")){Object.entries({all_language_options:"english:french:german:chinese:japanese:spanish:italian:russian:portuguese:swedish:danish:dutch:norwegian:slovak:czech:hungarian:polish:ukrainian:bulgarian:latvian:lithuanian:estonian:maltese:irish:galician:basque:welsh:breton:georgian:turkmen:kazakh:uzbek:tajik:afghan:sri-lankan:filipino:vietnamese:lao:cambodian:thai:burmese:kenyan:botswanan:zimbabwean:malawian:mozambican:angolan:namibian:south-african:madagascan:seychellois:mauritian:haitian:peruvian:ecuadorian:bolivian:paraguayan:chilean:argentinean:uruguayan:brazilian:colombian:venezuelan:puerto-rican:cuban:dominican:honduran:nicaraguan:salvadorean:guatemalan:el-salvadoran:belizean:panamanian:costa-rican:antiguan:barbudan:dominica's:grenada's:st-lucia's:st-vincent's:gibraltarian:faroe-islander:greenlandic:icelandic:jamaican:trinidadian:tobagonian:barbadian:anguillan:british-virgin-islander:us-virgin-islander:turkish:israeli:palestinian:lebanese:egyptian:libyan:tunisian:algerian:moroccan:bahraini:kuwaiti:saudi-arabian:yemeni:omani:irani:iraqi:afghanistan's:pakistani:indian:nepalese:sri-lankan:maldivan:burmese:thai:lao:vietnamese:kampuchean:malaysian:bruneian:indonesian:australian:new-zealanders:fijians:tongans:samoans:vanuatuans:wallisians:kiribatians:tuvaluans:solomon-islanders:marshallese:micronesians:hawaiians",all_programming_language_options:"python:c:c++:java:javascript:php:ruby:go:swift:kotlin:rust:haskell:erlang:lisp:scheme:prolog:cobol:fortran:pascal:delphi:d:eiffel:h:basic:visual_basic:smalltalk:objective-c:html5:node.js:vue.js:svelte:react:angular:ember:clipper:stex:arduino:brainfuck:r:assembly:mason:lepton:seacat:bbc_microbit:raspberry_pi_gpio:raspberry_pi_spi:raspberry_pi_i2c:raspberry_pi_uart:raspberry_pi_adc:raspberry_pi_ddio"}).forEach(([b,g])=>{console.log(`Key: ${b}, Value: ${g}`);function v(C){return C.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const y=v(b),T=new RegExp(y,"g");d=d.replace(T,g)});let _=d.split(":"),f=_[0],m=_[1]||"",h=[];_.length>2&&(h=_.slice(1));let E=await OC(f,m,h);E!==null&&(t[l]=E)}else{let c=await OC(d);c!==null&&(t[l]=c)}}let a=Promise.resolve();s.forEach(l=>{a=a.then(()=>o(l)).then(d=>{console.log(d)})}),a.then(()=>{Object.entries(t).forEach(([l,d])=>{console.log(`Key: ${l}, Value: ${d}`);function c(m){return m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const _=c(l),f=new RegExp(_,"g");n=n.replace(f,d)}),e(n)})}const BJe={name:"PlayGroundView",data(){return{posts_headers:{accept:"application/json","Content-Type":"application/json"},pending:!1,is_recording:!1,is_deaf_transcribing:!1,cpp_block:uO,html5_block:pO,LaTeX_block:_O,javascript_block:cO,json_block:dO,code_block:aO,python_block:lO,bash_block:hO,tokenize_icon:MJe,deaf_off:kJe,deaf_on:DJe,rec_off:PJe,rec_on:LJe,loading_icon:fO,isSynthesizingVoice:!1,audio_url:null,mdRenderHeight:300,selecting_model:!1,tab_id:"source",generating:!1,isSpeaking:!1,voices:[],isLesteningToVoice:!1,presets:[],selectedPreset:"",cursorPosition:0,namedTokens:[],text:"",pre_text:"",post_text:"",temperature:.1,top_k:50,top_p:.9,repeat_penalty:1.3,repeat_last_n:50,n_crop:-1,n_predicts:2e3,seed:-1,silenceTimeout:5e3}},components:{Toast:fc,MarkdownRenderer:ap,ClipBoardTextInput:RE,TokensHilighter:AJe,Card:vc},mounted(){Me.get("./get_presets").then(n=>{console.log(n.data),this.presets=n.data,this.selectedPreset=this.presets[0]}).catch(n=>{this.$refs.toast.showToast(`Error: ${n}`,4,!1)}),Ze.on("text_chunk",n=>{this.appendToOutput(n.chunk)}),Ze.on("text_generated",n=>{this.generating=!1}),Ze.on("generation_error",n=>{console.log("generation_error:",n),this.$refs.toast.showToast(`Error: ${n}`,4,!1),this.generating=!1}),Ze.on("connect",()=>{console.log("Connected to LoLLMs server"),this.$store.state.isConnected=!0,this.generating=!1}),Ze.on("buzzy",n=>{console.error("Server is busy. Wait for your turn",n),this.$refs.toast.showToast(`Error: ${n.message}`,4,!1),this.generating=!1}),Ze.on("generation_canceled",n=>{this.generating=!1,console.log("Generation canceled OK")}),this.$nextTick(()=>{qe.replace()}),"speechSynthesis"in window?(this.speechSynthesis=window.speechSynthesis,this.voices=this.speechSynthesis.getVoices(),this.voices.length===0&&this.speechSynthesis.addEventListener("voiceschanged",this.onVoicesChanged)):console.error("Speech synthesis is not supported in this browser.")},created(){},watch:{audio_url(n){n&&(console.log("Audio changed url to :",n),this.$refs.audio_player.src=n)}},computed:{selectedModel:{get(){return this.$store.state.selectedModel}},models:{get(){return this.$store.state.modelsArr}},isTalking:{get(){return this.isSpeaking}}},methods:{triggerFileUpload(){this.$refs.fileInput.click()},handleFileUpload(n){this.file=this.$refs.fileInput.files[0],this.buttonText=this.file.name,this.uploadFile()},uploadFile(){console.log("sending file");const n=new FormData;n.append("file",this.file),Me.post("/upload_voice/",n,{headers:{"Content-Type":"multipart/form-data"}}).then(e=>{console.log(e),this.buttonText="Upload a voice"}).catch(e=>{console.error(e)})},addBlock(n){let e=this.$refs.mdTextarea.selectionStart,t=this.$refs.mdTextarea.selectionEnd;e==t?speechSynthesis==0||this.text[e-1]==` + `,document.body.appendChild(r);const o=r.querySelector("#cancelButton"),a=r.querySelector("#okButton");o.addEventListener("click",()=>{document.body.removeChild(r),i(null)}),a.addEventListener("click",()=>{if(t.length===0){const d=r.querySelector("#replacementInput").value.trim();document.body.removeChild(r),i(d)}else{const d=r.querySelector("#options_selector").value.trim();document.body.removeChild(r),i(d)}})})}function GJe(n,e){console.log(n);let t={},i=/@<([^>]+)>@/g,s=[],r;for(;(r=i.exec(n))!==null;)s.push("@<"+r[1]+">@");console.log("matches"),console.log(s),s=[...new Set(s)];async function o(l){console.log(l);let d=l.toLowerCase().substring(2,l.length-2);if(d!=="generation_placeholder")if(d.includes(":")){Object.entries({all_language_options:"english:french:german:chinese:japanese:spanish:italian:russian:portuguese:swedish:danish:dutch:norwegian:slovak:czech:hungarian:polish:ukrainian:bulgarian:latvian:lithuanian:estonian:maltese:irish:galician:basque:welsh:breton:georgian:turkmen:kazakh:uzbek:tajik:afghan:sri-lankan:filipino:vietnamese:lao:cambodian:thai:burmese:kenyan:botswanan:zimbabwean:malawian:mozambican:angolan:namibian:south-african:madagascan:seychellois:mauritian:haitian:peruvian:ecuadorian:bolivian:paraguayan:chilean:argentinean:uruguayan:brazilian:colombian:venezuelan:puerto-rican:cuban:dominican:honduran:nicaraguan:salvadorean:guatemalan:el-salvadoran:belizean:panamanian:costa-rican:antiguan:barbudan:dominica's:grenada's:st-lucia's:st-vincent's:gibraltarian:faroe-islander:greenlandic:icelandic:jamaican:trinidadian:tobagonian:barbadian:anguillan:british-virgin-islander:us-virgin-islander:turkish:israeli:palestinian:lebanese:egyptian:libyan:tunisian:algerian:moroccan:bahraini:kuwaiti:saudi-arabian:yemeni:omani:irani:iraqi:afghanistan's:pakistani:indian:nepalese:sri-lankan:maldivan:burmese:thai:lao:vietnamese:kampuchean:malaysian:bruneian:indonesian:australian:new-zealanders:fijians:tongans:samoans:vanuatuans:wallisians:kiribatians:tuvaluans:solomon-islanders:marshallese:micronesians:hawaiians",all_programming_language_options:"python:c:c++:java:javascript:php:ruby:go:swift:kotlin:rust:haskell:erlang:lisp:scheme:prolog:cobol:fortran:pascal:delphi:d:eiffel:h:basic:visual_basic:smalltalk:objective-c:html5:node.js:vue.js:svelte:react:angular:ember:clipper:stex:arduino:brainfuck:r:assembly:mason:lepton:seacat:bbc_microbit:raspberry_pi_gpio:raspberry_pi_spi:raspberry_pi_i2c:raspberry_pi_uart:raspberry_pi_adc:raspberry_pi_ddio"}).forEach(([b,g])=>{console.log(`Key: ${b}, Value: ${g}`);function v(C){return C.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const y=v(b),T=new RegExp(y,"g");d=d.replace(T,g)});let _=d.split(":"),f=_[0],m=_[1]||"",h=[];_.length>2&&(h=_.slice(1));let E=await OC(f,m,h);E!==null&&(t[l]=E)}else{let c=await OC(d);c!==null&&(t[l]=c)}}let a=Promise.resolve();s.forEach(l=>{a=a.then(()=>o(l)).then(d=>{console.log(d)})}),a.then(()=>{Object.entries(t).forEach(([l,d])=>{console.log(`Key: ${l}, Value: ${d}`);function c(m){return m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const _=c(l),f=new RegExp(_,"g");n=n.replace(f,d)}),e(n)})}const zJe={name:"PlayGroundView",data(){return{posts_headers:{accept:"application/json","Content-Type":"application/json"},pending:!1,is_recording:!1,is_deaf_transcribing:!1,cpp_block:uO,html5_block:pO,LaTeX_block:_O,javascript_block:cO,json_block:dO,code_block:aO,python_block:lO,bash_block:hO,tokenize_icon:kJe,deaf_off:PJe,deaf_on:LJe,rec_off:FJe,rec_on:UJe,loading_icon:fO,isSynthesizingVoice:!1,audio_url:null,mdRenderHeight:300,selecting_model:!1,tab_id:"source",generating:!1,isSpeaking:!1,voices:[],isLesteningToVoice:!1,presets:[],selectedPreset:"",cursorPosition:0,namedTokens:[],text:"",pre_text:"",post_text:"",temperature:.1,top_k:50,top_p:.9,repeat_penalty:1.3,repeat_last_n:50,n_crop:-1,n_predicts:2e3,seed:-1,silenceTimeout:5e3}},components:{Toast:fc,MarkdownRenderer:ap,ClipBoardTextInput:RE,TokensHilighter:NJe,Card:vc},mounted(){Me.get("./get_presets").then(n=>{console.log(n.data),this.presets=n.data,this.selectedPreset=this.presets[0]}).catch(n=>{this.$refs.toast.showToast(`Error: ${n}`,4,!1)}),Ze.on("text_chunk",n=>{this.appendToOutput(n.chunk)}),Ze.on("text_generated",n=>{this.generating=!1}),Ze.on("generation_error",n=>{console.log("generation_error:",n),this.$refs.toast.showToast(`Error: ${n}`,4,!1),this.generating=!1}),Ze.on("connect",()=>{console.log("Connected to LoLLMs server"),this.$store.state.isConnected=!0,this.generating=!1}),Ze.on("buzzy",n=>{console.error("Server is busy. Wait for your turn",n),this.$refs.toast.showToast(`Error: ${n.message}`,4,!1),this.generating=!1}),Ze.on("generation_canceled",n=>{this.generating=!1,console.log("Generation canceled OK")}),this.$nextTick(()=>{qe.replace()}),"speechSynthesis"in window?(this.speechSynthesis=window.speechSynthesis,this.voices=this.speechSynthesis.getVoices(),this.voices.length===0&&this.speechSynthesis.addEventListener("voiceschanged",this.onVoicesChanged)):console.error("Speech synthesis is not supported in this browser.")},created(){},watch:{audio_url(n){n&&(console.log("Audio changed url to :",n),this.$refs.audio_player.src=n)}},computed:{selectedModel:{get(){return this.$store.state.selectedModel}},models:{get(){return this.$store.state.modelsArr}},isTalking:{get(){return this.isSpeaking}}},methods:{triggerFileUpload(){this.$refs.fileInput.click()},handleFileUpload(n){this.file=this.$refs.fileInput.files[0],this.buttonText=this.file.name,this.uploadFile()},uploadFile(){console.log("sending file");const n=new FormData;n.append("file",this.file),Me.post("/upload_voice/",n,{headers:{"Content-Type":"multipart/form-data"}}).then(e=>{console.log(e),this.buttonText="Upload a voice"}).catch(e=>{console.error(e)})},addBlock(n){let e=this.$refs.mdTextarea.selectionStart,t=this.$refs.mdTextarea.selectionEnd;e==t?speechSynthesis==0||this.text[e-1]==` `?(this.text=this.text.slice(0,e)+"```"+n+"\n\n```\n"+this.text.slice(e),e=e+4+n.length):(this.text=this.text.slice(0,e)+"\n```"+n+"\n\n```\n"+this.text.slice(e),e=e+3+n.length):speechSynthesis==0||this.text[e-1]==` `?(this.text=this.text.slice(0,e)+"```"+n+` `+this.text.slice(e,t)+"\n```\n"+this.text.slice(t),e=e+4+n.length):(this.text=this.text.slice(0,e)+"\n```"+n+` -`+this.text.slice(e,t)+"\n```\n"+this.text.slice(t),e=e+3+n.length),this.$refs.mdTextarea.focus(),this.$refs.mdTextarea.selectionStart=this.$refs.mdTextarea.selectionEnd=p},insertTab(n){const e=n.target,t=e.selectionStart,i=e.selectionEnd,s=e.value.substring(0,t),r=e.value.substring(i),o=s+" "+r;this.text=o,this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+4}),n.preventDefault()},mdTextarea_changed(){console.log("mdTextarea_changed"),this.cursorPosition=this.$refs.mdTextarea.selectionStart},mdTextarea_clicked(){console.log(`mdTextarea_clicked: ${this.$refs.mdTextarea.selectionStart}`),this.cursorPosition=this.$refs.mdTextarea.selectionStart},setModel(){this.selecting_model=!0,Me.post("/update_setting",{client_id:this.$store.state.client_id,setting_name:"model_name",setting_value:this.selectedModel}).then(n=>{console.log(n),n.status&&this.$refs.toast.showToast(`Model changed to ${this.selectedModel}`,4,!0),this.selecting_model=!1}).catch(n=>{this.$refs.toast.showToast(`Error ${n}`,4,!0),this.selecting_model=!1})},onVoicesChanged(){this.voices=this.speechSynthesis.getVoices()},read(){console.log("READING..."),this.isSynthesizingVoice=!0;let n=this.$refs.mdTextarea.selectionStart,e=this.$refs.mdTextarea.selectionEnd,t=this.text;n!=e&&(t=t.slice(n,e)),Me.post("./text2Audio",{text:t}).then(i=>{console.log(i.data.url);let s=i.data.url;this.audio_url=UJe+s,this.isSynthesizingVoice=!1,Ve(()=>{qe.replace()})}).catch(i=>{this.$refs.toast.showToast(`Error: ${i}`,4,!1),this.isSynthesizingVoice=!1,Ve(()=>{qe.replace()})})},speak(){if(this.msg){this.speechSynthesis.cancel(),this.msg=null,this.isSpeaking=!1;return}let n=0;console.log("voice on"),this.isSpeaking=!0;const e=200;this.msg=new SpeechSynthesisUtterance,this.msg.pitch=this.$store.state.config.audio_pitch,this.voices.length>0&&(this.msg.voice=this.voices.filter(s=>s.name===this.$store.state.config.audio_out_voice)[0]);const t=s=>{let r=this.text.substring(s,s+e);const o=[".","!","?",` -`];let a=-1;return o.forEach(l=>{const d=r.lastIndexOf(l);d>a&&(a=d)}),a==-1&&(a=r.length),console.log(a),a+s+1},i=()=>{const s=t(n),r=this.text.substring(n,s);this.msg.text=r,n=s+1,this.msg.onend=o=>{n{i()},1):(this.isSpeaking=!1,console.log("voice off :",this.text.length," ",s))},this.speechSynthesis.speak(this.msg)};i()},getCursorPosition(){return this.$refs.mdTextarea.selectionStart},appendToOutput(n){this.pre_text+=n,this.text=this.pre_text+this.post_text},generate_in_placeholder(){console.log("Finding cursor position");let n=this.text.indexOf("@@");if(n<0){this.$refs.toast.showToast("No generation placeholder found",4,!1);return}this.text=this.text.substring(0,n)+this.text.substring(n+26,this.text.length),this.pre_text=this.text.substring(0,n),this.post_text=this.text.substring(n,this.text.length);var e=this.text.substring(0,n);console.log(e),Ze.emit("generate_text",{prompt:e,personality:-1,n_predicts:this.n_predicts,n_crop:this.n_crop,parameters:{temperature:this.temperature,top_k:this.top_k,top_p:this.top_p,repeat_penalty:this.repeat_penalty,repeat_last_n:this.repeat_last_n,seed:parseInt(this.seed)}}),this.generating=!0},async tokenize_text(){const n=await Me.post("/lollms_tokenize",{prompt:this.text},{headers:this.posts_headers});console.log(n.data.named_tokens),this.namedTokens=n.data.named_tokens},generate(){console.log("Finding cursor position"),this.pre_text=this.text.substring(0,this.getCursorPosition()),this.post_text=this.text.substring(this.getCursorPosition(),this.text.length);var n=this.text.substring(0,this.getCursorPosition());console.log(this.text),console.log(`cursor position :${this.getCursorPosition()}`),console.log(`pretext:${this.pre_text}`),console.log(`post_text:${this.post_text}`),console.log(`prompt:${n}`),Ze.emit("generate_text",{prompt:n,personality:-1,n_predicts:this.n_predicts,n_crop:this.n_crop,parameters:{temperature:this.temperature,top_k:this.top_k,top_p:this.top_p,repeat_penalty:this.repeat_penalty,repeat_last_n:this.repeat_last_n,seed:parseInt(this.seed)}}),this.generating=!0},stopGeneration(){Ze.emit("cancel_text_generation",{})},exportText(){const n=this.text,e=document.createElement("a"),t=new Blob([n],{type:"text/plain"});e.href=URL.createObjectURL(t),e.download="exported_text.txt",document.body.appendChild(e),e.click(),document.body.removeChild(e)},importText(){const n=document.getElementById("import-input");n&&(n.addEventListener("change",e=>{if(e.target.files&&e.target.files[0]){const t=new FileReader;t.onload=()=>{this.text=t.result},t.readAsText(e.target.files[0])}else alert("Please select a file.")}),n.click())},setPreset(){console.log("Setting preset"),console.log(this.selectedPreset),this.tab_id="render",this.text=FJe(this.selectedPreset.content,n=>{console.log("Done"),console.log(n),this.text=n})},addPreset(){let n=prompt("Enter the title of the preset:");this.presets[n]={name:n,content:this.text},Me.post("./add_preset",this.presets[n]).then(e=>{console.log(e.data)}).catch(e=>{this.$refs.toast.showToast(`Error: ${e}`,4,!1)})},removePreset(){this.selectedPreset&&delete this.presets[this.selectedPreset.name]},reloadPresets(){Me.get("./get_presets").then(n=>{console.log(n.data),this.presets=n.data,this.selectedPreset=this.presets[0]}).catch(n=>{this.$refs.toast.showToast(`Error: ${n}`,4,!1)})},startRecording(){this.pending=!0,this.is_recording?Me.get("/stop_recording").then(n=>{this.is_recording=!1,this.pending=!1,console.log(n),this.text+=n.data.text,console.log(n.data),this.presets=n.data,this.selectedPreset=this.presets[0]}).catch(n=>{this.$refs.toast.showToast(`Error: ${n}`,4,!1)}):Me.get("/start_recording").then(n=>{this.is_recording=!0,this.pending=!1,console.log(n.data)}).catch(n=>{this.$refs.toast.showToast(`Error: ${n}`,4,!1)})},startRecordingAndTranscribing(){this.pending=!0,this.is_deaf_transcribing?Me.get("/stop_recording").then(n=>{this.is_deaf_transcribing=!1,this.pending=!1,this.text=n.data.text,this.read()}).catch(n=>{this.$refs.toast.showToast(`Error: ${n}`,4,!1)}):Me.get("/start_recording").then(n=>{this.is_deaf_transcribing=!0,this.pending=!1}).catch(n=>{this.$refs.toast.showToast(`Error: ${n}`,4,!1)})},startSpeechRecognition(){"SpeechRecognition"in window||"webkitSpeechRecognition"in window?(this.recognition=new(window.SpeechRecognition||window.webkitSpeechRecognition),this.recognition.lang=this.$store.state.config.audio_in_language,this.recognition.interimResults=!0,this.recognition.onstart=()=>{this.isLesteningToVoice=!0,this.silenceTimer=setTimeout(()=>{this.recognition.stop()},this.silenceTimeout)},this.pre_text=this.text.substring(0,this.getCursorPosition()),this.post_text=this.text.substring(this.getCursorPosition(),this.text.length),this.recognition.onresult=n=>{this.generated="";for(let e=n.resultIndex;e{this.recognition.stop()},this.silenceTimeout)},this.recognition.onerror=n=>{console.error("Speech recognition error:",n.error),this.isLesteningToVoice=!1,clearTimeout(this.silenceTimer)},this.recognition.onend=()=>{console.log("Speech recognition ended."),this.isLesteningToVoice=!1,this.pre_text=this.pre_text+this.generated,this.cursorPosition=this.pre_text.length,clearTimeout(this.silenceTimer)},this.recognition.start()):console.error("Speech recognition is not supported in this browser.")}}},GJe={class:"container bg-bg-light dark:bg-bg-dark shadow-lg overflow-y-auto scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},zJe={class:"container flex flex-row m-2"},VJe={class:"flex-grow max-w-[900px] m-2"},HJe={class:"flex gap-3 flex-1 items-center flex-grow flex-row m-2 p-2 border border-blue-300 rounded-md border-2 border-blue-300 m-2 p-4"},qJe=u("i",{"data-feather":"pen-tool"},null,-1),YJe=[qJe],$Je=u("i",{"data-feather":"archive"},null,-1),WJe=[$Je],KJe=["src"],jJe=u("span",{class:"w-80"},null,-1),QJe=u("i",{"data-feather":"x"},null,-1),XJe=[QJe],ZJe=u("i",{"data-feather":"mic"},null,-1),JJe=[ZJe],eet=u("i",{"data-feather":"volume-2"},null,-1),tet=[eet],net=u("i",{"data-feather":"speaker"},null,-1),iet=[net],set=["src"],ret=["src"],oet=["src"],aet=["src"],cet=u("i",{"data-feather":"voicemail"},null,-1),det=[cet],uet={key:1,"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},pet=u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"},null,-1),_et=u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"},null,-1),het=[pet,_et],fet=u("i",{"data-feather":"upload"},null,-1),met=[fet],get=u("i",{"data-feather":"download"},null,-1),bet=[get],Eet={class:"flex gap-3 flex-1 items-center flex-grow justify-end"},vet=u("input",{type:"file",id:"import-input",class:"hidden"},null,-1),yet={key:0},Tet={class:"flex flex-row justify-end mx-2"},xet=["src"],Cet=["src"],Ret=["src"],Aet=["src"],wet=["src"],Net=["src"],Oet=["src"],Iet=["src"],Met=u("i",{"data-feather":"copy"},null,-1),Det=[Met],ket=["src"],Let={key:2},Pet=["value"],Uet={key:0,title:"Selecting model",class:"flex flex-row flex-grow justify-end"},Fet=u("div",{role:"status"},[u("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),u("span",{class:"sr-only"},"Selecting model...")],-1),Bet=[Fet],Get=["value"],zet=u("br",null,null,-1),Vet=u("i",{"data-feather":"check"},null,-1),Het=[Vet],qet=u("i",{"data-feather":"plus"},null,-1),Yet=[qet],$et=u("i",{"data-feather":"x"},null,-1),Wet=[$et],Ket=u("i",{"data-feather":"refresh-ccw"},null,-1),jet=[Ket],Qet={class:"slider-container ml-2 mr-2"},Xet=u("h3",{class:"text-gray-600"},"Temperature",-1),Zet={class:"slider-value text-gray-500"},Jet={class:"slider-container ml-2 mr-2"},ett=u("h3",{class:"text-gray-600"},"Top K",-1),ttt={class:"slider-value text-gray-500"},ntt={class:"slider-container ml-2 mr-2"},itt=u("h3",{class:"text-gray-600"},"Top P",-1),stt={class:"slider-value text-gray-500"},rtt={class:"slider-container ml-2 mr-2"},ott=u("h3",{class:"text-gray-600"},"Repeat Penalty",-1),att={class:"slider-value text-gray-500"},ltt={class:"slider-container ml-2 mr-2"},ctt=u("h3",{class:"text-gray-600"},"Repeat Last N",-1),dtt={class:"slider-value text-gray-500"},utt={class:"slider-container ml-2 mr-2"},ptt=u("h3",{class:"text-gray-600"},"Number of tokens to crop the text to",-1),_tt={class:"slider-value text-gray-500"},htt={class:"slider-container ml-2 mr-2"},ftt=u("h3",{class:"text-gray-600"},"Number of tokens to generate",-1),mtt={class:"slider-value text-gray-500"},gtt={class:"slider-container ml-2 mr-2"},btt=u("h3",{class:"text-gray-600"},"Seed",-1),Ett={class:"slider-value text-gray-500"};function vtt(n,e,t,i,s,r){const o=ht("tokens-hilighter"),a=ht("MarkdownRenderer"),l=ht("Card"),d=ht("Toast");return w(),M($e,null,[u("div",GJe,[u("div",zJe,[u("div",VJe,[u("div",HJe,[ne(u("button",{id:"generate-button",title:"Generate from current cursor position",onClick:e[0]||(e[0]=(...c)=>r.generate&&r.generate(...c)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},YJe,512),[[Ot,!s.generating]]),ne(u("button",{id:"generate-next-button",title:"Generate from next place holder",onClick:e[1]||(e[1]=(...c)=>r.generate_in_placeholder&&r.generate_in_placeholder(...c)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},WJe,512),[[Ot,!s.generating]]),ne(u("button",{id:"tokenize",title:"Tokenize text",onClick:e[2]||(e[2]=(...c)=>r.tokenize_text&&r.tokenize_text(...c)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},[u("img",{width:"25",height:"25",src:s.tokenize_icon},null,8,KJe)],512),[[Ot,!s.generating]]),jJe,ne(u("button",{id:"stop-button",onClick:e[3]||(e[3]=(...c)=>r.stopGeneration&&r.stopGeneration(...c)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},XJe,512),[[Ot,s.generating]]),u("button",{type:"button",title:"Dictate (using your browser for transcription)",onClick:e[4]||(e[4]=(...c)=>r.startSpeechRecognition&&r.startSpeechRecognition(...c)),class:Ye([{"text-red-500":s.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer"])},JJe,2),u("button",{title:"convert text to audio (not saved and uses your browser tts service)",onClick:e[5]||(e[5]=Te(c=>r.speak(),["stop"])),class:Ye([{"text-red-500":r.isTalking},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer"])},tet,2),u("input",{type:"file",ref:"fileInput",onChange:e[6]||(e[6]=(...c)=>r.handleFileUpload&&r.handleFileUpload(...c)),style:{display:"none"},accept:".wav"},null,544),u("button",{title:"Upload a voice",onClick:e[7]||(e[7]=(...c)=>r.triggerFileUpload&&r.triggerFileUpload(...c))},iet),u("button",{type:"button",title:"Start audio to audio",onClick:e[8]||(e[8]=(...c)=>r.startRecordingAndTranscribing&&r.startRecordingAndTranscribing(...c)),class:Ye([{"text-green-500":s.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer text-red-500"])},[s.pending?q("",!0):(w(),M("img",{key:0,src:s.is_deaf_transcribing?s.deaf_on:s.deaf_off,height:"25"},null,8,set)),s.pending?(w(),M("img",{key:1,src:s.loading_icon,height:"25"},null,8,ret)):q("",!0)],2),u("button",{type:"button",title:"Start recording audio",onClick:e[9]||(e[9]=(...c)=>r.startRecording&&r.startRecording(...c)),class:Ye([{"text-green-500":s.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer text-red-500"])},[s.pending?q("",!0):(w(),M("img",{key:0,src:s.is_recording?s.rec_on:s.rec_off,height:"25"},null,8,oet)),s.pending?(w(),M("img",{key:1,src:s.loading_icon,height:"25"},null,8,aet)):q("",!0)],2),s.isSynthesizingVoice?(w(),M("svg",uet,het)):(w(),M("button",{key:0,title:"generate audio from the text",onClick:e[10]||(e[10]=Te(c=>r.read(),["stop"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},det)),ne(u("button",{id:"export-button",onClick:e[11]||(e[11]=(...c)=>r.exportText&&r.exportText(...c)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},met,512),[[Ot,!s.generating]]),ne(u("button",{id:"import-button",onClick:e[12]||(e[12]=(...c)=>r.importText&&r.importText(...c)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},bet,512),[[Ot,!s.generating]]),u("div",Eet,[u("button",{class:Ye(["border-2 text-blue-600 dark:text-white border-blue-300 p-2 rounded shadow-lg hover:border-gray-600 dark:link-item-dark cursor-pointer",{"bg-blue-200 dark:bg-blue-500":s.tab_id=="source"}]),onClick:e[13]||(e[13]=c=>s.tab_id="source")}," Source ",2),u("button",{class:Ye(["border-2 text-blue-600 dark:text-white border-blue-300 p-2 rounded shadow-lg hover:border-gray-600 dark:link-item-dark cursor-pointer",{"bg-blue-200 dark:bg-blue-500":s.tab_id=="render"}]),onClick:e[14]||(e[14]=c=>s.tab_id="render")}," Render ",2)]),vet]),u("div",{class:Ye(["flex-grow m-2 p-2 border border-blue-300 rounded-md border-2 border-blue-300 m-2 p-4",{"border-red-500":s.generating}])},[s.tab_id==="source"?(w(),M("div",yet,[u("div",Tet,[u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add generic block",onClick:e[15]||(e[15]=Te(c=>r.addBlock(""),["stop"]))},[u("img",{src:s.code_block,width:"25",height:"25"},null,8,xet)]),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add python block",onClick:e[16]||(e[16]=Te(c=>r.addBlock("python"),["stop"]))},[u("img",{src:s.python_block,width:"25",height:"25"},null,8,Cet)]),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add javascript block",onClick:e[17]||(e[17]=Te(c=>r.addBlock("javascript"),["stop"]))},[u("img",{src:s.javascript_block,width:"25",height:"25"},null,8,Ret)]),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add json block",onClick:e[18]||(e[18]=Te(c=>r.addBlock("json"),["stop"]))},[u("img",{src:s.json_block,width:"25",height:"25"},null,8,Aet)]),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add c++ block",onClick:e[19]||(e[19]=Te(c=>r.addBlock("c++"),["stop"]))},[u("img",{src:s.cpp_block,width:"25",height:"25"},null,8,wet)]),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add html block",onClick:e[20]||(e[20]=Te(c=>r.addBlock("html"),["stop"]))},[u("img",{src:s.html5_block,width:"25",height:"25"},null,8,Net)]),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add LaTex block",onClick:e[21]||(e[21]=Te(c=>r.addBlock("latex"),["stop"]))},[u("img",{src:s.LaTeX_block,width:"25",height:"25"},null,8,Oet)]),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add bash block",onClick:e[22]||(e[22]=Te(c=>r.addBlock("bash"),["stop"]))},[u("img",{src:s.bash_block,width:"25",height:"25"},null,8,Iet)]),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Copy message to clipboard",onClick:e[23]||(e[23]=Te(c=>n.copyContentToClipboard(),["stop"]))},Det)]),ne(u("textarea",{ref:"mdTextarea",onKeydown:e[24]||(e[24]=wr(Te((...c)=>r.insertTab&&r.insertTab(...c),["prevent"]),["tab"])),class:"block min-h-500 p-2.5 w-full text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 overflow-y-scroll flex flex-col shadow-lg p-10 pt-0 overflow-y-scroll dark:bg-bg-dark scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",rows:4,style:en({minHeight:s.mdRenderHeight+"px"}),placeholder:"Enter message here...","onUpdate:modelValue":e[25]||(e[25]=c=>s.text=c),onClick:e[26]||(e[26]=Te((...c)=>r.mdTextarea_clicked&&r.mdTextarea_clicked(...c),["prevent"])),onChange:e[27]||(e[27]=Te((...c)=>r.mdTextarea_changed&&r.mdTextarea_changed(...c),["prevent"]))},`\r - `,36),[[Pe,s.text]]),u("span",null,"Cursor position "+fe(s.cursorPosition),1)])):q("",!0),s.audio_url!=null?(w(),M("audio",{controls:"",autoplay:"",key:s.audio_url},[u("source",{src:s.audio_url,type:"audio/wav",ref:"audio_player"},null,8,ket),je(" Your browser does not support the audio element. ")])):q("",!0),Oe(o,{namedTokens:s.namedTokens},null,8,["namedTokens"]),s.tab_id==="render"?(w(),M("div",Let,[Oe(a,{ref:"mdRender","markdown-text":s.text,class:"mt-4 p-2 rounded shadow-lg dark:bg-bg-dark"},null,8,["markdown-text"])])):q("",!0)],2)]),Oe(l,{title:"settings",class:"slider-container ml-0 mr-0",isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[Oe(l,{title:"Model",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[ne(u("select",{"onUpdate:modelValue":e[28]||(e[28]=c=>this.$store.state.selectedModel=c),onChange:e[29]||(e[29]=(...c)=>r.setModel&&r.setModel(...c)),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},[(w(!0),M($e,null,ct(r.models,c=>(w(),M("option",{key:c,value:c},fe(c),9,Pet))),128))],544),[[zn,this.$store.state.selectedModel]]),s.selecting_model?(w(),M("div",Uet,Bet)):q("",!0)]),_:1}),Oe(l,{title:"Presets",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[ne(u("select",{"onUpdate:modelValue":e[30]||(e[30]=c=>s.selectedPreset=c),class:"bg-white dark:bg-black mb-2 border-2 rounded-md shadow-sm w-full"},[(w(!0),M($e,null,ct(s.presets,c=>(w(),M("option",{key:c,value:c},fe(c.name),9,Get))),128))],512),[[zn,s.selectedPreset]]),zet,u("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[31]||(e[31]=(...c)=>r.setPreset&&r.setPreset(...c)),title:"Use preset"},Het),u("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[32]||(e[32]=(...c)=>r.addPreset&&r.addPreset(...c)),title:"Add this text as a preset"},Yet),u("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[33]||(e[33]=(...c)=>r.removePreset&&r.removePreset(...c)),title:"Remove preset"},Wet),u("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[34]||(e[34]=(...c)=>r.reloadPresets&&r.reloadPresets(...c)),title:"Reload presets list"},jet)]),_:1}),Oe(l,{title:"Generation params",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[u("div",Qet,[Xet,ne(u("input",{type:"range","onUpdate:modelValue":e[35]||(e[35]=c=>s.temperature=c),min:"0",max:"5",step:"0.1",class:"w-full"},null,512),[[Pe,s.temperature]]),u("span",Zet,"Current value: "+fe(s.temperature),1)]),u("div",Jet,[ett,ne(u("input",{type:"range","onUpdate:modelValue":e[36]||(e[36]=c=>s.top_k=c),min:"1",max:"100",step:"1",class:"w-full"},null,512),[[Pe,s.top_k]]),u("span",ttt,"Current value: "+fe(s.top_k),1)]),u("div",ntt,[itt,ne(u("input",{type:"range","onUpdate:modelValue":e[37]||(e[37]=c=>s.top_p=c),min:"0",max:"1",step:"0.1",class:"w-full"},null,512),[[Pe,s.top_p]]),u("span",stt,"Current value: "+fe(s.top_p),1)]),u("div",rtt,[ott,ne(u("input",{type:"range","onUpdate:modelValue":e[38]||(e[38]=c=>s.repeat_penalty=c),min:"0",max:"5",step:"0.1",class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[Pe,s.repeat_penalty]]),u("span",att,"Current value: "+fe(s.repeat_penalty),1)]),u("div",ltt,[ctt,ne(u("input",{type:"range","onUpdate:modelValue":e[39]||(e[39]=c=>s.repeat_last_n=c),min:"0",max:"100",step:"1",class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[Pe,s.repeat_last_n]]),u("span",dtt,"Current value: "+fe(s.repeat_last_n),1)]),u("div",utt,[ptt,ne(u("input",{type:"number","onUpdate:modelValue":e[40]||(e[40]=c=>s.n_crop=c),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[Pe,s.n_crop]]),u("span",_tt,"Current value: "+fe(s.n_crop),1)]),u("div",htt,[ftt,ne(u("input",{type:"number","onUpdate:modelValue":e[41]||(e[41]=c=>s.n_predicts=c),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[Pe,s.n_predicts]]),u("span",mtt,"Current value: "+fe(s.n_predicts),1)]),u("div",gtt,[btt,ne(u("input",{type:"number","onUpdate:modelValue":e[42]||(e[42]=c=>s.seed=c),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[Pe,s.seed]]),u("span",Ett,"Current value: "+fe(s.seed),1)])]),_:1})]),_:1})])]),Oe(d,{ref:"toast"},null,512)],64)}const ytt=bt(BJe,[["render",vtt]]);const Stt={data(){return{activeExtension:null}},computed:{activeExtensions(){return console.log(this.$store.state.extensionsZoo),console.log(lM(this.$store.state.extensionsZoo)),this.$store.state.extensionsZoo}},methods:{showExtensionPage(n){this.activeExtension=n}}},Ttt={class:"container overflow-y-scroll flex flex-col shadow-lg p-10 pt-0 overflow-y-scroll w-full dark:bg-bg-dark scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},xtt={key:0},Ctt=["onClick"],Rtt={key:0},Att=["src"],wtt={key:1},Ntt=u("p",null,"No extension is active. Please install and activate an extension.",-1),Ott=[Ntt];function Itt(n,e,t,i,s,r){return w(),M("div",Ttt,[r.activeExtensions.length>0?(w(),M("div",xtt,[(w(!0),M($e,null,ct(r.activeExtensions,o=>(w(),M("div",{key:o.name,onClick:a=>r.showExtensionPage(o)},[u("div",{class:Ye({"active-tab":o===s.activeExtension})},fe(o.name),3)],8,Ctt))),128)),s.activeExtension?(w(),M("div",Rtt,[u("iframe",{src:s.activeExtension.page,width:"100%",height:"500px",frameborder:"0"},null,8,Att)])):q("",!0)])):(w(),M("div",wtt,Ott))])}const Mtt=bt(Stt,[["render",Itt]]);var mO={exports:{}};/* @license +`+this.text.slice(e,t)+"\n```\n"+this.text.slice(t),e=e+3+n.length),this.$refs.mdTextarea.focus(),this.$refs.mdTextarea.selectionStart=this.$refs.mdTextarea.selectionEnd=p},insertTab(n){const e=n.target,t=e.selectionStart,i=e.selectionEnd,s=e.value.substring(0,t),r=e.value.substring(i),o=s+" "+r;this.text=o,this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+4}),n.preventDefault()},mdTextarea_changed(){console.log("mdTextarea_changed"),this.cursorPosition=this.$refs.mdTextarea.selectionStart},mdTextarea_clicked(){console.log(`mdTextarea_clicked: ${this.$refs.mdTextarea.selectionStart}`),this.cursorPosition=this.$refs.mdTextarea.selectionStart},setModel(){this.selecting_model=!0,Me.post("/update_setting",{client_id:this.$store.state.client_id,setting_name:"model_name",setting_value:this.selectedModel}).then(n=>{console.log(n),n.status&&this.$refs.toast.showToast(`Model changed to ${this.selectedModel}`,4,!0),this.selecting_model=!1}).catch(n=>{this.$refs.toast.showToast(`Error ${n}`,4,!0),this.selecting_model=!1})},onVoicesChanged(){this.voices=this.speechSynthesis.getVoices()},read(){console.log("READING..."),this.isSynthesizingVoice=!0;let n=this.$refs.mdTextarea.selectionStart,e=this.$refs.mdTextarea.selectionEnd,t=this.text;n!=e&&(t=t.slice(n,e)),Me.post("./text2Audio",{text:t}).then(i=>{console.log(i.data.url);let s=i.data.url;this.audio_url=BJe+s,this.isSynthesizingVoice=!1,Ve(()=>{qe.replace()})}).catch(i=>{this.$refs.toast.showToast(`Error: ${i}`,4,!1),this.isSynthesizingVoice=!1,Ve(()=>{qe.replace()})})},speak(){if(this.msg){this.speechSynthesis.cancel(),this.msg=null,this.isSpeaking=!1;return}let n=0;console.log("voice on"),this.isSpeaking=!0;const e=200;this.msg=new SpeechSynthesisUtterance,this.msg.pitch=this.$store.state.config.audio_pitch,this.voices.length>0&&(this.msg.voice=this.voices.filter(s=>s.name===this.$store.state.config.audio_out_voice)[0]);const t=s=>{let r=this.text.substring(s,s+e);const o=[".","!","?",` +`];let a=-1;return o.forEach(l=>{const d=r.lastIndexOf(l);d>a&&(a=d)}),a==-1&&(a=r.length),console.log(a),a+s+1},i=()=>{const s=t(n),r=this.text.substring(n,s);this.msg.text=r,n=s+1,this.msg.onend=o=>{n{i()},1):(this.isSpeaking=!1,console.log("voice off :",this.text.length," ",s))},this.speechSynthesis.speak(this.msg)};i()},getCursorPosition(){return this.$refs.mdTextarea.selectionStart},appendToOutput(n){this.pre_text+=n,this.text=this.pre_text+this.post_text},generate_in_placeholder(){console.log("Finding cursor position");let n=this.text.indexOf("@@");if(n<0){this.$refs.toast.showToast("No generation placeholder found",4,!1);return}this.text=this.text.substring(0,n)+this.text.substring(n+26,this.text.length),this.pre_text=this.text.substring(0,n),this.post_text=this.text.substring(n,this.text.length);var e=this.text.substring(0,n);console.log(e),Ze.emit("generate_text",{prompt:e,personality:-1,n_predicts:this.n_predicts,n_crop:this.n_crop,parameters:{temperature:this.temperature,top_k:this.top_k,top_p:this.top_p,repeat_penalty:this.repeat_penalty,repeat_last_n:this.repeat_last_n,seed:parseInt(this.seed)}}),this.generating=!0},async tokenize_text(){const n=await Me.post("/lollms_tokenize",{prompt:this.text},{headers:this.posts_headers});console.log(n.data.named_tokens),this.namedTokens=n.data.named_tokens},generate(){console.log("Finding cursor position"),this.pre_text=this.text.substring(0,this.getCursorPosition()),this.post_text=this.text.substring(this.getCursorPosition(),this.text.length);var n=this.text.substring(0,this.getCursorPosition());console.log(this.text),console.log(`cursor position :${this.getCursorPosition()}`),console.log(`pretext:${this.pre_text}`),console.log(`post_text:${this.post_text}`),console.log(`prompt:${n}`),Ze.emit("generate_text",{prompt:n,personality:-1,n_predicts:this.n_predicts,n_crop:this.n_crop,parameters:{temperature:this.temperature,top_k:this.top_k,top_p:this.top_p,repeat_penalty:this.repeat_penalty,repeat_last_n:this.repeat_last_n,seed:parseInt(this.seed)}}),this.generating=!0},stopGeneration(){Ze.emit("cancel_text_generation",{})},exportText(){const n=this.text,e=document.createElement("a"),t=new Blob([n],{type:"text/plain"});e.href=URL.createObjectURL(t),e.download="exported_text.txt",document.body.appendChild(e),e.click(),document.body.removeChild(e)},importText(){const n=document.getElementById("import-input");n&&(n.addEventListener("change",e=>{if(e.target.files&&e.target.files[0]){const t=new FileReader;t.onload=()=>{this.text=t.result},t.readAsText(e.target.files[0])}else alert("Please select a file.")}),n.click())},setPreset(){console.log("Setting preset"),console.log(this.selectedPreset),this.tab_id="render",this.text=GJe(this.selectedPreset.content,n=>{console.log("Done"),console.log(n),this.text=n})},addPreset(){let n=prompt("Enter the title of the preset:");this.presets[n]={name:n,content:this.text},Me.post("./add_preset",this.presets[n]).then(e=>{console.log(e.data)}).catch(e=>{this.$refs.toast.showToast(`Error: ${e}`,4,!1)})},removePreset(){this.selectedPreset&&delete this.presets[this.selectedPreset.name]},reloadPresets(){Me.get("./get_presets").then(n=>{console.log(n.data),this.presets=n.data,this.selectedPreset=this.presets[0]}).catch(n=>{this.$refs.toast.showToast(`Error: ${n}`,4,!1)})},startRecording(){this.pending=!0,this.is_recording?Me.get("/stop_recording").then(n=>{this.is_recording=!1,this.pending=!1,console.log(n),this.text+=n.data.text,console.log(n.data),this.presets=n.data,this.selectedPreset=this.presets[0]}).catch(n=>{this.$refs.toast.showToast(`Error: ${n}`,4,!1)}):Me.get("/start_recording").then(n=>{this.is_recording=!0,this.pending=!1,console.log(n.data)}).catch(n=>{this.$refs.toast.showToast(`Error: ${n}`,4,!1)})},startRecordingAndTranscribing(){this.pending=!0,this.is_deaf_transcribing?Me.get("/stop_recording").then(n=>{this.is_deaf_transcribing=!1,this.pending=!1,this.text=n.data.text,this.read()}).catch(n=>{this.$refs.toast.showToast(`Error: ${n}`,4,!1)}):Me.get("/start_recording").then(n=>{this.is_deaf_transcribing=!0,this.pending=!1}).catch(n=>{this.$refs.toast.showToast(`Error: ${n}`,4,!1)})},startSpeechRecognition(){"SpeechRecognition"in window||"webkitSpeechRecognition"in window?(this.recognition=new(window.SpeechRecognition||window.webkitSpeechRecognition),this.recognition.lang=this.$store.state.config.audio_in_language,this.recognition.interimResults=!0,this.recognition.onstart=()=>{this.isLesteningToVoice=!0,this.silenceTimer=setTimeout(()=>{this.recognition.stop()},this.silenceTimeout)},this.pre_text=this.text.substring(0,this.getCursorPosition()),this.post_text=this.text.substring(this.getCursorPosition(),this.text.length),this.recognition.onresult=n=>{this.generated="";for(let e=n.resultIndex;e{this.recognition.stop()},this.silenceTimeout)},this.recognition.onerror=n=>{console.error("Speech recognition error:",n.error),this.isLesteningToVoice=!1,clearTimeout(this.silenceTimer)},this.recognition.onend=()=>{console.log("Speech recognition ended."),this.isLesteningToVoice=!1,this.pre_text=this.pre_text+this.generated,this.cursorPosition=this.pre_text.length,clearTimeout(this.silenceTimer)},this.recognition.start()):console.error("Speech recognition is not supported in this browser.")}}},VJe={class:"container bg-bg-light dark:bg-bg-dark shadow-lg overflow-y-auto scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},HJe={class:"container flex flex-row m-2"},qJe={class:"flex-grow max-w-[900px] m-2"},YJe={class:"flex gap-3 flex-1 items-center flex-grow flex-row m-2 p-2 border border-blue-300 rounded-md border-2 border-blue-300 m-2 p-4"},$Je=u("i",{"data-feather":"pen-tool"},null,-1),WJe=[$Je],KJe=u("i",{"data-feather":"archive"},null,-1),jJe=[KJe],QJe=["src"],XJe=u("span",{class:"w-80"},null,-1),ZJe=u("i",{"data-feather":"x"},null,-1),JJe=[ZJe],eet=u("i",{"data-feather":"mic"},null,-1),tet=[eet],net=u("i",{"data-feather":"volume-2"},null,-1),iet=[net],set=u("i",{"data-feather":"speaker"},null,-1),ret=[set],oet=["src"],aet=["src"],cet=["src"],det=["src"],uet=u("i",{"data-feather":"voicemail"},null,-1),pet=[uet],_et={key:1,"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},het=u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"},null,-1),fet=u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"},null,-1),met=[het,fet],get=u("i",{"data-feather":"upload"},null,-1),bet=[get],Eet=u("i",{"data-feather":"download"},null,-1),vet=[Eet],yet={class:"flex gap-3 flex-1 items-center flex-grow justify-end"},Tet=u("input",{type:"file",id:"import-input",class:"hidden"},null,-1),xet={key:0},Cet={class:"flex flex-row justify-end mx-2"},Ret=["src"],Aet=["src"],wet=["src"],Net=["src"],Oet=["src"],Iet=["src"],Met=["src"],Det=["src"],ket=u("i",{"data-feather":"copy"},null,-1),Let=[ket],Pet=["src"],Uet={key:2},Fet=["value"],Bet={key:0,title:"Selecting model",class:"flex flex-row flex-grow justify-end"},Get=u("div",{role:"status"},[u("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),u("span",{class:"sr-only"},"Selecting model...")],-1),zet=[Get],Vet=["value"],Het=u("br",null,null,-1),qet=u("i",{"data-feather":"check"},null,-1),Yet=[qet],$et=u("i",{"data-feather":"plus"},null,-1),Wet=[$et],Ket=u("i",{"data-feather":"x"},null,-1),jet=[Ket],Qet=u("i",{"data-feather":"refresh-ccw"},null,-1),Xet=[Qet],Zet={class:"slider-container ml-2 mr-2"},Jet=u("h3",{class:"text-gray-600"},"Temperature",-1),ett={class:"slider-value text-gray-500"},ttt={class:"slider-container ml-2 mr-2"},ntt=u("h3",{class:"text-gray-600"},"Top K",-1),itt={class:"slider-value text-gray-500"},stt={class:"slider-container ml-2 mr-2"},rtt=u("h3",{class:"text-gray-600"},"Top P",-1),ott={class:"slider-value text-gray-500"},att={class:"slider-container ml-2 mr-2"},ltt=u("h3",{class:"text-gray-600"},"Repeat Penalty",-1),ctt={class:"slider-value text-gray-500"},dtt={class:"slider-container ml-2 mr-2"},utt=u("h3",{class:"text-gray-600"},"Repeat Last N",-1),ptt={class:"slider-value text-gray-500"},_tt={class:"slider-container ml-2 mr-2"},htt=u("h3",{class:"text-gray-600"},"Number of tokens to crop the text to",-1),ftt={class:"slider-value text-gray-500"},mtt={class:"slider-container ml-2 mr-2"},gtt=u("h3",{class:"text-gray-600"},"Number of tokens to generate",-1),btt={class:"slider-value text-gray-500"},Ett={class:"slider-container ml-2 mr-2"},vtt=u("h3",{class:"text-gray-600"},"Seed",-1),ytt={class:"slider-value text-gray-500"};function Stt(n,e,t,i,s,r){const o=ht("tokens-hilighter"),a=ht("MarkdownRenderer"),l=ht("Card"),d=ht("Toast");return w(),M($e,null,[u("div",VJe,[u("div",HJe,[u("div",qJe,[u("div",YJe,[ne(u("button",{id:"generate-button",title:"Generate from current cursor position",onClick:e[0]||(e[0]=(...c)=>r.generate&&r.generate(...c)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},WJe,512),[[Ot,!s.generating]]),ne(u("button",{id:"generate-next-button",title:"Generate from next place holder",onClick:e[1]||(e[1]=(...c)=>r.generate_in_placeholder&&r.generate_in_placeholder(...c)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},jJe,512),[[Ot,!s.generating]]),ne(u("button",{id:"tokenize",title:"Tokenize text",onClick:e[2]||(e[2]=(...c)=>r.tokenize_text&&r.tokenize_text(...c)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},[u("img",{width:"25",height:"25",src:s.tokenize_icon},null,8,QJe)],512),[[Ot,!s.generating]]),XJe,ne(u("button",{id:"stop-button",onClick:e[3]||(e[3]=(...c)=>r.stopGeneration&&r.stopGeneration(...c)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},JJe,512),[[Ot,s.generating]]),u("button",{type:"button",title:"Dictate (using your browser for transcription)",onClick:e[4]||(e[4]=(...c)=>r.startSpeechRecognition&&r.startSpeechRecognition(...c)),class:Ye([{"text-red-500":s.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer"])},tet,2),u("button",{title:"convert text to audio (not saved and uses your browser tts service)",onClick:e[5]||(e[5]=Te(c=>r.speak(),["stop"])),class:Ye([{"text-red-500":r.isTalking},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer"])},iet,2),u("input",{type:"file",ref:"fileInput",onChange:e[6]||(e[6]=(...c)=>r.handleFileUpload&&r.handleFileUpload(...c)),style:{display:"none"},accept:".wav"},null,544),u("button",{title:"Upload a voice",onClick:e[7]||(e[7]=(...c)=>r.triggerFileUpload&&r.triggerFileUpload(...c))},ret),u("button",{type:"button",title:"Start audio to audio",onClick:e[8]||(e[8]=(...c)=>r.startRecordingAndTranscribing&&r.startRecordingAndTranscribing(...c)),class:Ye([{"text-green-500":s.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer text-red-500"])},[s.pending?q("",!0):(w(),M("img",{key:0,src:s.is_deaf_transcribing?s.deaf_on:s.deaf_off,height:"25"},null,8,oet)),s.pending?(w(),M("img",{key:1,src:s.loading_icon,height:"25"},null,8,aet)):q("",!0)],2),u("button",{type:"button",title:"Start recording audio",onClick:e[9]||(e[9]=(...c)=>r.startRecording&&r.startRecording(...c)),class:Ye([{"text-green-500":s.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer text-red-500"])},[s.pending?q("",!0):(w(),M("img",{key:0,src:s.is_recording?s.rec_on:s.rec_off,height:"25"},null,8,cet)),s.pending?(w(),M("img",{key:1,src:s.loading_icon,height:"25"},null,8,det)):q("",!0)],2),s.isSynthesizingVoice?(w(),M("svg",_et,met)):(w(),M("button",{key:0,title:"generate audio from the text",onClick:e[10]||(e[10]=Te(c=>r.read(),["stop"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},pet)),ne(u("button",{id:"export-button",onClick:e[11]||(e[11]=(...c)=>r.exportText&&r.exportText(...c)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},bet,512),[[Ot,!s.generating]]),ne(u("button",{id:"import-button",onClick:e[12]||(e[12]=(...c)=>r.importText&&r.importText(...c)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},vet,512),[[Ot,!s.generating]]),u("div",yet,[u("button",{class:Ye(["border-2 text-blue-600 dark:text-white border-blue-300 p-2 rounded shadow-lg hover:border-gray-600 dark:link-item-dark cursor-pointer",{"bg-blue-200 dark:bg-blue-500":s.tab_id=="source"}]),onClick:e[13]||(e[13]=c=>s.tab_id="source")}," Source ",2),u("button",{class:Ye(["border-2 text-blue-600 dark:text-white border-blue-300 p-2 rounded shadow-lg hover:border-gray-600 dark:link-item-dark cursor-pointer",{"bg-blue-200 dark:bg-blue-500":s.tab_id=="render"}]),onClick:e[14]||(e[14]=c=>s.tab_id="render")}," Render ",2)]),Tet]),u("div",{class:Ye(["flex-grow m-2 p-2 border border-blue-300 rounded-md border-2 border-blue-300 m-2 p-4",{"border-red-500":s.generating}])},[s.tab_id==="source"?(w(),M("div",xet,[u("div",Cet,[u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add generic block",onClick:e[15]||(e[15]=Te(c=>r.addBlock(""),["stop"]))},[u("img",{src:s.code_block,width:"25",height:"25"},null,8,Ret)]),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add python block",onClick:e[16]||(e[16]=Te(c=>r.addBlock("python"),["stop"]))},[u("img",{src:s.python_block,width:"25",height:"25"},null,8,Aet)]),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add javascript block",onClick:e[17]||(e[17]=Te(c=>r.addBlock("javascript"),["stop"]))},[u("img",{src:s.javascript_block,width:"25",height:"25"},null,8,wet)]),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add json block",onClick:e[18]||(e[18]=Te(c=>r.addBlock("json"),["stop"]))},[u("img",{src:s.json_block,width:"25",height:"25"},null,8,Net)]),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add c++ block",onClick:e[19]||(e[19]=Te(c=>r.addBlock("c++"),["stop"]))},[u("img",{src:s.cpp_block,width:"25",height:"25"},null,8,Oet)]),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add html block",onClick:e[20]||(e[20]=Te(c=>r.addBlock("html"),["stop"]))},[u("img",{src:s.html5_block,width:"25",height:"25"},null,8,Iet)]),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add LaTex block",onClick:e[21]||(e[21]=Te(c=>r.addBlock("latex"),["stop"]))},[u("img",{src:s.LaTeX_block,width:"25",height:"25"},null,8,Met)]),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add bash block",onClick:e[22]||(e[22]=Te(c=>r.addBlock("bash"),["stop"]))},[u("img",{src:s.bash_block,width:"25",height:"25"},null,8,Det)]),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Copy message to clipboard",onClick:e[23]||(e[23]=Te(c=>n.copyContentToClipboard(),["stop"]))},Let)]),ne(u("textarea",{ref:"mdTextarea",onKeydown:e[24]||(e[24]=wr(Te((...c)=>r.insertTab&&r.insertTab(...c),["prevent"]),["tab"])),class:"block min-h-500 p-2.5 w-full text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 overflow-y-scroll flex flex-col shadow-lg p-10 pt-0 overflow-y-scroll dark:bg-bg-dark scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",rows:4,style:en({minHeight:s.mdRenderHeight+"px"}),placeholder:"Enter message here...","onUpdate:modelValue":e[25]||(e[25]=c=>s.text=c),onClick:e[26]||(e[26]=Te((...c)=>r.mdTextarea_clicked&&r.mdTextarea_clicked(...c),["prevent"])),onChange:e[27]||(e[27]=Te((...c)=>r.mdTextarea_changed&&r.mdTextarea_changed(...c),["prevent"]))},`\r + `,36),[[Pe,s.text]]),u("span",null,"Cursor position "+fe(s.cursorPosition),1)])):q("",!0),s.audio_url!=null?(w(),M("audio",{controls:"",autoplay:"",key:s.audio_url},[u("source",{src:s.audio_url,type:"audio/wav",ref:"audio_player"},null,8,Pet),je(" Your browser does not support the audio element. ")])):q("",!0),Oe(o,{namedTokens:s.namedTokens},null,8,["namedTokens"]),s.tab_id==="render"?(w(),M("div",Uet,[Oe(a,{ref:"mdRender","markdown-text":s.text,class:"mt-4 p-2 rounded shadow-lg dark:bg-bg-dark"},null,8,["markdown-text"])])):q("",!0)],2)]),Oe(l,{title:"settings",class:"slider-container ml-0 mr-0",isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[Oe(l,{title:"Model",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[ne(u("select",{"onUpdate:modelValue":e[28]||(e[28]=c=>this.$store.state.selectedModel=c),onChange:e[29]||(e[29]=(...c)=>r.setModel&&r.setModel(...c)),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},[(w(!0),M($e,null,ct(r.models,c=>(w(),M("option",{key:c,value:c},fe(c),9,Fet))),128))],544),[[zn,this.$store.state.selectedModel]]),s.selecting_model?(w(),M("div",Bet,zet)):q("",!0)]),_:1}),Oe(l,{title:"Presets",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[ne(u("select",{"onUpdate:modelValue":e[30]||(e[30]=c=>s.selectedPreset=c),class:"bg-white dark:bg-black mb-2 border-2 rounded-md shadow-sm w-full"},[(w(!0),M($e,null,ct(s.presets,c=>(w(),M("option",{key:c,value:c},fe(c.name),9,Vet))),128))],512),[[zn,s.selectedPreset]]),Het,u("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[31]||(e[31]=(...c)=>r.setPreset&&r.setPreset(...c)),title:"Use preset"},Yet),u("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[32]||(e[32]=(...c)=>r.addPreset&&r.addPreset(...c)),title:"Add this text as a preset"},Wet),u("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[33]||(e[33]=(...c)=>r.removePreset&&r.removePreset(...c)),title:"Remove preset"},jet),u("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[34]||(e[34]=(...c)=>r.reloadPresets&&r.reloadPresets(...c)),title:"Reload presets list"},Xet)]),_:1}),Oe(l,{title:"Generation params",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[u("div",Zet,[Jet,ne(u("input",{type:"range","onUpdate:modelValue":e[35]||(e[35]=c=>s.temperature=c),min:"0",max:"5",step:"0.1",class:"w-full"},null,512),[[Pe,s.temperature]]),u("span",ett,"Current value: "+fe(s.temperature),1)]),u("div",ttt,[ntt,ne(u("input",{type:"range","onUpdate:modelValue":e[36]||(e[36]=c=>s.top_k=c),min:"1",max:"100",step:"1",class:"w-full"},null,512),[[Pe,s.top_k]]),u("span",itt,"Current value: "+fe(s.top_k),1)]),u("div",stt,[rtt,ne(u("input",{type:"range","onUpdate:modelValue":e[37]||(e[37]=c=>s.top_p=c),min:"0",max:"1",step:"0.1",class:"w-full"},null,512),[[Pe,s.top_p]]),u("span",ott,"Current value: "+fe(s.top_p),1)]),u("div",att,[ltt,ne(u("input",{type:"range","onUpdate:modelValue":e[38]||(e[38]=c=>s.repeat_penalty=c),min:"0",max:"5",step:"0.1",class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[Pe,s.repeat_penalty]]),u("span",ctt,"Current value: "+fe(s.repeat_penalty),1)]),u("div",dtt,[utt,ne(u("input",{type:"range","onUpdate:modelValue":e[39]||(e[39]=c=>s.repeat_last_n=c),min:"0",max:"100",step:"1",class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[Pe,s.repeat_last_n]]),u("span",ptt,"Current value: "+fe(s.repeat_last_n),1)]),u("div",_tt,[htt,ne(u("input",{type:"number","onUpdate:modelValue":e[40]||(e[40]=c=>s.n_crop=c),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[Pe,s.n_crop]]),u("span",ftt,"Current value: "+fe(s.n_crop),1)]),u("div",mtt,[gtt,ne(u("input",{type:"number","onUpdate:modelValue":e[41]||(e[41]=c=>s.n_predicts=c),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[Pe,s.n_predicts]]),u("span",btt,"Current value: "+fe(s.n_predicts),1)]),u("div",Ett,[vtt,ne(u("input",{type:"number","onUpdate:modelValue":e[42]||(e[42]=c=>s.seed=c),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[Pe,s.seed]]),u("span",ytt,"Current value: "+fe(s.seed),1)])]),_:1})]),_:1})])]),Oe(d,{ref:"toast"},null,512)],64)}const Ttt=bt(zJe,[["render",Stt]]);const xtt={data(){return{activeExtension:null}},computed:{activeExtensions(){return console.log(this.$store.state.extensionsZoo),console.log(lM(this.$store.state.extensionsZoo)),this.$store.state.extensionsZoo}},methods:{showExtensionPage(n){this.activeExtension=n}}},Ctt={class:"container overflow-y-scroll flex flex-col shadow-lg p-10 pt-0 overflow-y-scroll w-full dark:bg-bg-dark scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},Rtt={key:0},Att=["onClick"],wtt={key:0},Ntt=["src"],Ott={key:1},Itt=u("p",null,"No extension is active. Please install and activate an extension.",-1),Mtt=[Itt];function Dtt(n,e,t,i,s,r){return w(),M("div",Ctt,[r.activeExtensions.length>0?(w(),M("div",Rtt,[(w(!0),M($e,null,ct(r.activeExtensions,o=>(w(),M("div",{key:o.name,onClick:a=>r.showExtensionPage(o)},[u("div",{class:Ye({"active-tab":o===s.activeExtension})},fe(o.name),3)],8,Att))),128)),s.activeExtension?(w(),M("div",wtt,[u("iframe",{src:s.activeExtension.page,width:"100%",height:"500px",frameborder:"0"},null,8,Ntt)])):q("",!0)])):(w(),M("div",Ott,Mtt))])}const ktt=bt(xtt,[["render",Dtt]]);var mO={exports:{}};/* @license Papa Parse v5.4.1 https://github.com/mholt/PapaParse @@ -97,7 +97,7 @@ License: MIT `:"\r"}(ee,k)),U=!1,R.delimiter)O(R.delimiter)&&(R.delimiter=R.delimiter(ee),te.meta.delimiter=R.delimiter);else{var B=function(de,ie,Ce,we,V){var _e,se,ce,D;V=V||[","," ","|",";",l.RECORD_SEP,l.UNIT_SEP];for(var I=0;I=L)return ze(!0)}else for(z=P,P++;;){if((z=Y.indexOf(S,z+1))===-1)return ae||ge.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:J.length,index:P}),xe();if(z===te-1)return xe(Y.substring(P,z).replace(I,S));if(S!==G||Y[z+1]!==G){if(S===G||z===0||Y[z-1]!==G){ce!==-1&&ce=L)return ze(!0);break}ge.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:J.length,index:P}),z++}}else z++}return xe();function re(ke){J.push(ke),Se=P}function Re(ke){var lt=0;if(ke!==-1){var Qe=Y.substring(z+1,ke);Qe&&Qe.trim()===""&&(lt=Qe.length)}return lt}function xe(ke){return ae||(ke===void 0&&(ke=Y.substring(P)),ee.push(ke),P=te,re(ee),Ae&&st()),ze()}function De(ke){P=ke,re(ee),ee=[],D=Y.indexOf(U,P)}function ze(ke){return{data:J,errors:ge,meta:{delimiter:A,linebreak:U,aborted:j,truncated:!!ke,cursor:Se+(Q||0)}}}function st(){K(ze()),J=[],ge=[]}},this.abort=function(){j=!0},this.getCharIndex=function(){return P}}function v(R){var S=R.data,A=o[S.workerId],U=!1;if(S.error)A.userError(S.error,S.file);else if(S.results&&S.results.data){var F={abort:function(){U=!0,y(S.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:T,resume:T};if(O(A.userStep)){for(var K=0;Kn.text()).then(n=>{const{data:e}=ktt.parse(n,{header:!0});console.log("Recovered data"),console.log(e),this.faqs=e}).catch(n=>{console.error("Error loading FAQs:",n)})},parseMultiline(n){return n.replace(/\n/g,"
")}}},Ws=n=>(Nr("data-v-b19a05a8"),n=n(),Or(),n),Ptt={class:"container flex-row mx-auto p-4 bg-bg-light-tone dark:bg-bg-dark-tone shadow-lg overflow-y-auto no-scrollbar p-2 pb-0 grid lg:grid-cols-1 md:grid-cols-2 gap-4"},Utt=Ws(()=>u("h2",{class:"text-2xl font-bold mb-2"},"About Lord of large Language Models",-1)),Ftt={class:"mb-4"},Btt=Ws(()=>u("p",null,[je("Discord link: "),u("a",{class:"text-blue-500 hover:text-blue-400 duration-150",href:"https://discord.gg/YgnaFMAQ"},"https://discord.gg/YgnaFMAQ")],-1)),Gtt=Ws(()=>u("h2",{class:"text-2xl font-bold mb-2"},"Frequently Asked Questions",-1)),ztt={class:"list-disc pl-4"},Vtt={class:"text-xl font-bold mb-1"},Htt=["innerHTML"],qtt=Ws(()=>u("h2",{class:"text-2xl font-bold mb-2"},"Contact Us",-1)),Ytt=Ws(()=>u("p",{class:"mb-4"},"If you have any further questions or need assistance, feel free to reach out to me.",-1)),$tt=Ws(()=>u("p",null,[je("Discord link: "),u("a",{class:"text-blue-500 hover:text-blue-400 duration-150",href:"https://discord.gg/YgnaFMAQ"},"https://discord.gg/YgnaFMAQ")],-1)),Wtt=Ws(()=>u("h2",{class:"text-2xl font-bold mb-2"},"Credits",-1)),Ktt=Ws(()=>u("p",{class:"mb-4"},[je("This project is developed by "),u("span",{class:"font-bold"},"ParisNeo"),je(" With help from the community.")],-1)),jtt=Ws(()=>u("p",{class:"mb-4"},[u("span",{class:"font-bold"},[u("a",{href:"https://github.com/ParisNeo/lollms-webui/graphs/contributors"},"Check out the full list of developers here and show them some love.")])],-1)),Qtt=["href"];function Xtt(n,e,t,i,s,r){const o=ht("Card");return w(),M("div",Ptt,[Oe(o,{disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[Utt,u("p",Ftt," Lollms version "+fe(r.version),1),Btt]),_:1}),Oe(o,{disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[Gtt,u("ul",ztt,[(w(!0),M($e,null,ct(s.faqs,(a,l)=>(w(),M("li",{key:l},[u("h3",Vtt,fe(a.question),1),u("p",{class:"mb-4",innerHTML:r.parseMultiline(a.answer)},null,8,Htt)]))),128))])]),_:1}),Oe(o,{disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[qtt,Ytt,$tt]),_:1}),Oe(o,{disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[Wtt,Ktt,jtt,u("p",null,[je("Check out the project on "),u("a",{class:"text-blue-500 hover:text-blue-400 duration-150",href:s.githubLink,target:"_blank",rel:"noopener noreferrer"},"GitHub",8,Qtt),je(".")])]),_:1})])}const Ztt=bt(Ltt,[["render",Xtt],["__scopeId","data-v-b19a05a8"]]);function ss(n,e=!0,t=1){const i=e?1e3:1024;if(Math.abs(n)=i&&r{qe.replace()})},executeCommand(n){this.isMenuOpen=!1,console.log("Selected"),console.log(n.value),typeof n.value=="function"&&(console.log("Command detected",n),n.value()),this.execute_cmd&&(console.log("executing generic command"),this.execute_cmd(n))},positionMenu(){var n;if(this.$refs.menuButton!=null){if(this.force_position==0||this.force_position==null){const e=this.$refs.menuButton.getBoundingClientRect(),t=window.innerHeight;n=e.bottom>t/2}else this.force_position==1?n=!0:n=!1;this.menuPosition.top=n?"auto":"calc(100% + 10px)",this.menuPosition.bottom=n?"100%":"auto"}}},mounted(){window.addEventListener("resize",this.positionMenu),this.positionMenu(),Ve(()=>{qe.replace()})},beforeDestroy(){window.removeEventListener("resize",this.positionMenu)},watch:{isMenuOpen:"positionMenu"}},ent={class:"menu-container"},tnt=["title"],nnt=["src"],int=["data-feather"],snt={key:2,class:"w-5 h-5"},rnt={key:3,"data-feather":"menu"},ont={class:"flex-grow menu-ul"},ant=["onClick"],lnt={key:0,"data-feather":"check"},cnt=["src","alt"],dnt=["data-feather"],unt={key:3,class:"menu-icon"};function pnt(n,e,t,i,s,r){return w(),M("div",ent,[u("button",{onClick:e[0]||(e[0]=Te((...o)=>r.toggleMenu&&r.toggleMenu(...o),["prevent"])),title:t.title,class:Ye([t.menuIconClass,"menu-button m-0 p-0 bg-blue-500 text-white dark:bg-blue-200 dark:text-gray-800 rounded flex items-center justify-center w-6 h-6 border-none cursor-pointer hover:bg-blue-400 w-8 h-8 object-fill text-red-700 border-2 active:scale-90 hover:z-20 hover:-translate-y-2 duration-150 border-gray-300 border-secondary cursor-pointer"]),ref:"menuButton"},[t.icon&&!t.icon.includes("#")&&!t.icon.includes("feather")?(w(),M("img",{key:0,src:t.icon,class:"w-5 h-5 p-0 m-0 shadow-lg bold"},null,8,nnt)):t.icon&&t.icon.includes("feather")?(w(),M("i",{key:1,"data-feather":t.icon.split(":")[1],class:"w-5 h-5"},null,8,int)):t.icon&&t.icon.includes("#")?(w(),M("p",snt,fe(t.icon.split("#")[1]),1)):(w(),M("i",rnt))],10,tnt),Oe(ls,{name:"slide"},{default:Je(()=>[s.isMenuOpen?(w(),M("div",{key:0,class:"menu-list flex-grow",style:en(s.menuPosition),ref:"menu"},[u("ul",ont,[(w(!0),M($e,null,ct(t.commands,(o,a)=>(w(),M("li",{key:a,onClick:Te(l=>r.executeCommand(o),["prevent"]),class:"menu-command menu-li flex-grow hover:bg-blue-400"},[t.selected_entry==o.name?(w(),M("i",lnt)):o.icon&&!o.icon.includes("feather")&&!o.is_file?(w(),M("img",{key:1,src:o.icon,alt:o.name,class:"menu-icon"},null,8,cnt)):q("",!0),o.icon&&o.icon.includes("feather")&&!o.is_file?(w(),M("i",{key:2,"data-feather":o.icon.split(":")[1],class:"mr-2"},null,8,dnt)):(w(),M("span",unt)),u("span",null,fe(o.name),1)],8,ant))),128))])],4)):q("",!0)]),_:1})])}const cp=bt(Jtt,[["render",pnt]]),_nt={components:{InteractiveMenu:cp},props:{isInstalled:Boolean,onInstall:Function,onCancelInstall:Function,onUninstall:Function,onSelected:Function,onCopy:Function,onCopyLink:Function,selected:Boolean,model:Object,model_type:String},data(){return{progress:0,speed:0,total_size:0,downloaded_size:0,start_time:"",installing:!1,uninstalling:!1,failedToLoad:!1,linkNotValid:!1,selected_variant:""}},async mounted(){Ve(()=>{qe.replace()})},methods:{formatFileSize(n){return n<1024?n+" bytes":n<1024*1024?(n/1024).toFixed(2)+" KB":n<1024*1024*1024?(n/(1024*1024)).toFixed(2)+" MB":(n/(1024*1024*1024)).toFixed(2)+" GB"},computedFileSize(n){return ss(n)},getImgUrl(){return this.model.icon==null||this.model.icon==="/images/default_model.png"?Li:this.model.icon},defaultImg(n){n.target.src=Li},install(){this.onInstall(this)},uninstall(){this.isInstalled&&this.onUninstall(this)},toggleInstall(){this.isInstalled?(this.uninstalling=!0,this.onUninstall(this)):this.onInstall(this)},toggleSelected(n){if(console.log("event.target.tagName.toLowerCase()"),console.log(n.target.tagName.toLowerCase()),n.target.tagName.toLowerCase()==="button"||n.target.tagName.toLowerCase()==="svg"){n.stopPropagation();return}this.onSelected(this),this.model.selected=!0,Ve(()=>{qe.replace()})},toggleCopy(){this.onCopy(this)},toggleCopyLink(){this.onCopyLink(this)},toggleCancelInstall(){this.onCancelInstall(this),this.installing=!1},handleSelection(){this.isInstalled&&!this.selected&&this.onSelected(this)},copyContentToClipboard(){this.$emit("copy","this.message.content")}},computed:{computed_classes(){return this.model.isInstalled?this.selected?"border-4 border-gray-200 bg-primary cursor-pointer":"border-0 border-primary bg-primary cursor-pointer":"border-transparent"},commandsList(){let n=[{name:this.model.isInstalled?"Install Extra":"Install",icon:"feather:settings",is_file:!1,value:this.install},{name:"Copy model info to clipboard",icon:"feather:settings",is_file:!1,value:this.toggleCopy}];return this.model.isInstalled&&n.push({name:"UnInstall",icon:"feather:settings",is_file:!1,value:this.uninstall}),this.selected&&n.push({name:"Reload",icon:"feather:refresh-ccw",is_file:!1,value:this.toggleSelected}),n},selected_computed(){return this.selected},fileSize:{get(){if(this.model&&this.model.variants&&this.model.variants.length>0){const n=this.model.variants[0].size;return this.formatFileSize(n)}return null}},speed_computed(){return ss(this.speed)},total_size_computed(){return ss(this.total_size)},downloaded_size_computed(){return ss(this.downloaded_size)}},watch:{linkNotValid(){Ve(()=>{qe.replace()})}}},hnt=["title"],fnt={key:0,class:"flex flex-row"},mnt={class:"max-w-[300px] overflow-x-auto"},gnt={class:"flex gap-3 items-center grow"},bnt=["href"],Ent=["src"],vnt={class:"flex-1 overflow-hidden"},ynt={class:"font-bold font-large text-lg truncate"},Snt={key:1,class:"flex items-center flex-row gap-2 my-1"},Tnt={class:"flex grow items-center"},xnt=u("i",{"data-feather":"box",class:"w-5"},null,-1),Cnt=u("span",{class:"sr-only"},"Custom model / local model",-1),Rnt=[xnt,Cnt],Ant=u("span",{class:"sr-only"},"Remove",-1),wnt={key:2,class:"absolute z-10 -m-4 p-5 shadow-md text-center rounded-lg w-full h-full bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel bg-opacity-70 dark:bg-opacity-70 flex justify-center items-center"},Nnt={class:"relative flex flex-col items-center justify-center flex-grow h-full"},Ont=u("div",{role:"status",class:"justify-center"},[u("svg",{"aria-hidden":"true",class:"w-24 h-24 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),u("span",{class:"sr-only"},"Loading...")],-1),Int={class:"relative flex flex-row flex-grow items-center w-full h-full bottom-0"},Mnt={class:"w-full bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel rounded-lg p-2"},Dnt={class:"flex justify-between mb-1"},knt=u("span",{class:"text-base font-medium text-blue-700 dark:text-white"},"Downloading",-1),Lnt={class:"text-sm font-medium text-blue-700 dark:text-white"},Pnt={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},Unt={class:"flex justify-between mb-1"},Fnt={class:"text-base font-medium text-blue-700 dark:text-white"},Bnt={class:"text-sm font-medium text-blue-700 dark:text-white"},Gnt={class:"flex flex-grow"},znt={class:"flex flex-row flex-grow gap-3"},Vnt={class:"p-2 text-center grow"},Hnt={key:3},qnt={class:"flex flex-row items-center gap-3"},Ynt=["src"],$nt={class:"font-bold font-large text-lg truncate"},Wnt=u("div",{class:"grow"},null,-1),Knt={class:"flex items-center flex-row-reverse gap-2 my-1"},jnt={class:"flex flex-row items-center"},Qnt={key:0,class:"text-base text-red-600 flex items-center mt-1"},Xnt=u("i",{"data-feather":"alert-triangle",class:"flex-shrink-0 mx-1"},null,-1),Znt=["title"],Jnt={class:""},eit={class:"flex flex-row items-center"},tit=u("i",{"data-feather":"download",class:"w-5 m-1 flex-shrink-0"},null,-1),nit=u("b",null,"Card: ",-1),iit=["href","title"],sit=u("div",{class:"grow"},null,-1),rit=u("i",{"data-feather":"clipboard",class:"w-5"},null,-1),oit=[rit],ait={class:"flex items-center"},lit=u("i",{"data-feather":"file",class:"w-5 m-1"},null,-1),cit=u("b",null,"File size: ",-1),dit={class:"flex items-center"},uit=u("i",{"data-feather":"key",class:"w-5 m-1"},null,-1),pit=u("b",null,"License: ",-1),_it={key:0,class:"flex items-center"},hit=u("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),fit=u("b",null,"quantizer: ",-1),mit=["href"],git={class:"flex items-center"},bit=u("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),Eit=u("b",null,"Model creator: ",-1),vit=["href"],yit={class:"flex items-center"},Sit=u("i",{"data-feather":"clock",class:"w-5 m-1"},null,-1),Tit=u("b",null,"Release date: ",-1),xit={class:"flex items-center"},Cit=u("i",{"data-feather":"grid",class:"w-5 m-1"},null,-1),Rit=u("b",null,"Category: ",-1),Ait=["href"];function wit(n,e,t,i,s,r){const o=ht("InteractiveMenu");return w(),M("div",{class:Ye(["relative items-start p-4 hover:bg-primary-light rounded-lg mb-2 shadow-lg border-2 select-none",r.computed_classes]),title:t.model.name,onClick:e[10]||(e[10]=Te(a=>r.toggleSelected(a),["prevent"]))},[t.model.isCustomModel?(w(),M("div",fnt,[u("div",mnt,[u("div",gnt,[u("a",{href:t.model.model_creator_link,target:"_blank"},[u("img",{src:r.getImgUrl(),onError:e[0]||(e[0]=a=>r.defaultImg(a)),class:"w-10 h-10 rounded-lg object-fill"},null,40,Ent)],8,bnt),u("div",vnt,[u("h3",ynt,fe(t.model.name),1)])])])])):q("",!0),t.model.isCustomModel?(w(),M("div",Snt,[u("div",Tnt,[u("button",{type:"button",title:"Custom model / local model",class:"font-medium rounded-lg text-sm p-2 text-center inline-flex items-center",onClick:e[1]||(e[1]=Te(()=>{},["stop"]))},Rnt),je(" Custom model ")]),u("div",null,[t.model.isInstalled?(w(),M("button",{key:0,title:"Delete file from disk",type:"button",onClick:e[2]||(e[2]=Te((...a)=>r.uninstall&&r.uninstall(...a),["stop"])),class:"inline-flex items-center gap-2 px-3 py-2 text-xs font-medium text-center focus:outline-none text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 rounded-lg dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900"},[je(" Uninstall "),Ant])):q("",!0)])])):q("",!0),s.installing?(w(),M("div",wnt,[u("div",Nnt,[Ont,u("div",Int,[u("div",Mnt,[u("div",Dnt,[knt,u("span",Lnt,fe(Math.floor(s.progress))+"%",1)]),u("div",Pnt,[u("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en({width:s.progress+"%"})},null,4)]),u("div",Unt,[u("span",Fnt,"Download speed: "+fe(r.speed_computed)+"/s",1),u("span",Bnt,fe(r.downloaded_size_computed)+"/"+fe(r.total_size_computed),1)])])]),u("div",Gnt,[u("div",znt,[u("div",Vnt,[u("button",{onClick:e[3]||(e[3]=Te((...a)=>r.toggleCancelInstall&&r.toggleCancelInstall(...a),["stop"])),type:"button",title:"Cancel download",class:"text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600"}," Cancel ")])])])])])):q("",!0),t.model.isCustomModel?q("",!0):(w(),M("div",Hnt,[u("div",qnt,[u("img",{ref:"imgElement",src:r.getImgUrl(),onError:e[4]||(e[4]=a=>r.defaultImg(a)),class:Ye(["w-10 h-10 rounded-lg object-fill",s.linkNotValid?"grayscale":""])},null,42,Ynt),u("h3",$nt,fe(t.model.name),1),Wnt,Oe(o,{commands:r.commandsList,force_position:2,title:"Menu"},null,8,["commands"])]),u("div",Knt,[u("div",jnt,[s.linkNotValid?(w(),M("div",Qnt,[Xnt,je(" Link is not valid ")])):q("",!0)])]),u("div",{class:"",title:t.model.isInstalled?t.model.name:"Not installed"},[u("div",Jnt,[u("div",eit,[tit,nit,u("a",{href:"https://huggingface.co/"+t.model.quantizer+"/"+t.model.name,target:"_blank",onClick:e[5]||(e[5]=Te(()=>{},["stop"])),class:"m-1 flex items-center hover:text-secondary duration-75 active:scale-90 truncate",title:s.linkNotValid?"Link is not valid":"Download this manually (faster) and put it in the models/ folder then refresh"}," View full model card ",8,iit),sit,u("button",{class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center",title:"Copy link to clipboard",onClick:e[6]||(e[6]=Te(a=>r.toggleCopyLink(),["stop"]))},oit)]),u("div",ait,[u("div",{class:Ye(["flex flex-shrink-0 items-center",s.linkNotValid?"text-red-600":""])},[lit,cit,je(" "+fe(r.fileSize),1)],2)]),u("div",dit,[uit,pit,je(" "+fe(t.model.license),1)]),t.model.quantizer!="None"&&t.model.type!="transformers"?(w(),M("div",_it,[hit,fit,u("a",{href:"https://huggingface.co/"+t.model.quantizer,target:"_blank",rel:"noopener noreferrer",onClick:e[7]||(e[7]=Te(()=>{},["stop"])),class:"flex hover:text-secondary duration-75 active:scale-90",title:"quantizer's profile"},fe(t.model.quantizer),9,mit)])):q("",!0),u("div",git,[bit,Eit,u("a",{href:t.model.model_creator_link,target:"_blank",rel:"noopener noreferrer",onClick:e[8]||(e[8]=Te(()=>{},["stop"])),class:"flex hover:text-secondary duration-75 active:scale-90",title:"quantizer's profile"},fe(t.model.model_creator),9,vit)]),u("div",yit,[Sit,Tit,je(" "+fe(t.model.last_commit_time),1)]),u("div",xit,[Cit,Rit,u("a",{href:"https://huggingface.co/"+t.model.model_creator,target:"_blank",rel:"noopener noreferrer",onClick:e[9]||(e[9]=Te(()=>{},["stop"])),class:"flex hover:text-secondary duration-75 active:scale-90",title:"quantizer's profile"},fe(t.model.category),9,Ait)])])],8,Znt)]))],10,hnt)}const Nit=bt(_nt,[["render",wit]]),Oit={data(){return{editMode:!1,avatar:"path/to/avatar.jpg",personalityName:"Personality Name",personalityAuthor:"Author Name",personalityDescription:"Personality Description",personalityCategory:"Category",disclaimer:"Disclaimer text",conditioningText:"Conditioning Text",aiPrefix:"AI Prefix",userPrefix:"User Prefix",antipromptsList:[{id:1,text:"Antiprompt 1"},{id:2,text:"Antiprompt 2"},{id:3,text:"Antiprompt 3"}]}},methods:{commitChanges(){console.log("Personality changes committed"),this.editMode=!1}}},Iit={class:"p-4"},Mit={class:"flex items-center mb-4"},Dit=["src"],kit={class:"text-lg font-semibold"},Lit=u("strong",null,"Author:",-1),Pit=u("strong",null,"Description:",-1),Uit=u("strong",null,"Category:",-1),Fit={key:0},Bit=u("strong",null,"Disclaimer:",-1),Git=u("strong",null,"Conditioning Text:",-1),zit=u("strong",null,"AI Prefix:",-1),Vit=u("strong",null,"User Prefix:",-1),Hit=u("strong",null,"Antiprompts:",-1);function qit(n,e,t,i,s,r){return w(),M("div",Iit,[u("div",Mit,[u("img",{src:s.avatar,class:"w-12 h-12 rounded-full mr-2",alt:"Avatar"},null,8,Dit),u("h2",kit,fe(s.personalityName),1)]),u("p",null,[Lit,je(" "+fe(s.personalityAuthor),1)]),u("p",null,[Pit,je(" "+fe(s.personalityDescription),1)]),u("p",null,[Uit,je(" "+fe(s.personalityCategory),1)]),s.disclaimer?(w(),M("p",Fit,[Bit,je(" "+fe(s.disclaimer),1)])):q("",!0),u("p",null,[Git,je(" "+fe(s.conditioningText),1)]),u("p",null,[zit,je(" "+fe(s.aiPrefix),1)]),u("p",null,[Vit,je(" "+fe(s.userPrefix),1)]),u("div",null,[Hit,u("ul",null,[(w(!0),M($e,null,ct(s.antipromptsList,o=>(w(),M("li",{key:o.id},fe(o.text),1))),128))])]),u("button",{onClick:e[0]||(e[0]=o=>s.editMode=!0),class:"mt-4 bg-blue-500 text-white px-4 py-2 rounded"}," Edit "),s.editMode?(w(),M("button",{key:1,onClick:e[1]||(e[1]=(...o)=>r.commitChanges&&r.commitChanges(...o)),class:"mt-4 bg-green-500 text-white px-4 py-2 rounded"}," Commit ")):q("",!0)])}const Yit=bt(Oit,[["render",qit]]),yc="/assets/logo-9d653710.svg",$it="/",Wit={props:{personality:{},select_language:Boolean,selected:Boolean,full_path:String,onTalk:Function,onSelected:Function,onMount:Function,onUnMount:Function,onRemount:Function,onCopyToCustom:Function,onEdit:Function,onReinstall:Function,onSettings:Function,onCopyPersonalityName:Function},components:{InteractiveMenu:cp},data(){return{isMounted:!1,name:this.personality.name}},computed:{commandsList(){let n=[{name:this.isMounted?"unmount":"mount",icon:"feather:settings",is_file:!1,value:this.isMounted?this.unmount:this.mount},{name:"reinstall",icon:"feather:terminal",is_file:!1,value:this.toggleReinstall}];return console.log("this.category",this.personality.category),this.personality.category=="custom_personalities"?n.push({name:"edit",icon:"feather:settings",is_file:!1,value:this.edit}):n.push({name:"Copy to custom personas folder for editing",icon:"feather:copy",is_file:!1,value:this.copyToCustom}),this.isMounted&&n.push({name:"remount",icon:"feather:refresh-ccw",is_file:!1,value:this.reMount}),this.selected&&this.personality.has_scripts&&n.push({name:"settings",icon:"feather:settings",is_file:!1,value:this.toggleSettings}),n},selected_computed(){return this.selected}},mounted(){this.isMounted=this.personality.isMounted,Ve(()=>{qe.replace()})},methods:{getImgUrl(){return $it+this.personality.avatar},defaultImg(n){n.target.src=yc},toggleTalk(){this.onTalk(this)},toggleCopyLink(){this.onCopyPersonalityName(this)},toggleSelected(){this.isMounted&&this.onSelected(this)},edit(){this.onEdit(this)},copyToCustom(){this.onCopyToCustom(this)},reMount(){this.onRemount(this)},mount(){console.log("Mounting"),this.onMount(this)},unmount(){console.log("Unmounting"),console.log(this.onUnMount),this.onUnMount(this),this.isMounted=!1},toggleSettings(){this.onSettings(this)},toggleReinstall(){this.onReinstall(this)}},watch:{selected(){Ve(()=>{qe.replace()})}}},Kit=["title"],jit={class:"flex flex-row items-center flex-shrink-0 gap-3"},Qit=["src"],Xit=u("i",{"data-feather":"clipboard",class:"w-5"},null,-1),Zit=[Xit],Jit={class:""},est={class:""},tst={class:"flex items-center"},nst=u("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),ist=u("b",null,"Author: ",-1),sst={class:"flex items-center"},rst=u("i",{"data-feather":"git-commit",class:"w-5 m-1"},null,-1),ost=u("b",null,"Version: ",-1),ast={key:0,class:"flex items-center"},lst=u("i",{"data-feather":"globe",class:"w-5 m-1"},null,-1),cst=u("b",null,"Languages: ",-1),dst=["selected"],ust={key:1,class:"flex items-center"},pst=u("i",{"data-feather":"globe",class:"w-5 m-1"},null,-1),_st=u("b",null,"Language: ",-1),hst={class:"flex items-center"},fst=u("i",{"data-feather":"bookmark",class:"w-5 m-1"},null,-1),mst=u("b",null,"Category: ",-1),gst=u("div",{class:"flex items-center"},[u("i",{"data-feather":"info",class:"w-5 m-1"}),u("b",null,"Description: "),u("br")],-1),bst=["title","innerHTML"],Est={class:"rounded bg-blue-300"},vst=u("i",{"data-feather":"check"},null,-1),yst=u("span",{class:"sr-only"},"Select",-1),Sst=[vst,yst],Tst=u("i",{"data-feather":"send",class:"w-5"},null,-1),xst=u("span",{class:"sr-only"},"Talk",-1),Cst=[Tst,xst];function Rst(n,e,t,i,s,r){const o=ht("InteractiveMenu");return w(),M("div",{class:Ye(["min-w-96 items-start p-4 hover:bg-primary-light rounded-lg mb-2 shadow-lg border-2 cursor-pointer select-none",r.selected_computed?"border-2 border-primary-light":"border-transparent",s.isMounted?"bg-blue-200 dark:bg-blue-700":""]),tabindex:"-1",title:t.personality.installed?"":"Not installed"},[u("div",{class:Ye(t.personality.installed?"":"border-red-500")},[u("div",jit,[u("img",{onClick:e[0]||(e[0]=(...a)=>r.toggleSelected&&r.toggleSelected(...a)),ref:"imgElement",src:r.getImgUrl(),onError:e[1]||(e[1]=a=>r.defaultImg(a)),class:"w-10 h-10 rounded-full object-fill text-red-700 cursor-pointer"},null,40,Qit),u("h3",{onClick:e[2]||(e[2]=(...a)=>r.toggleSelected&&r.toggleSelected(...a)),class:"font-bold font-large text-lg line-clamp-3 cursor-pointer"},fe(t.personality.name),1),u("button",{class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center",title:"Copy link to clipboard",onClick:e[3]||(e[3]=Te(a=>r.toggleCopyLink(),["stop"]))},Zit)]),u("div",Jit,[u("div",est,[u("div",tst,[nst,ist,je(" "+fe(t.personality.author),1)]),u("div",sst,[rst,ost,je(" "+fe(t.personality.version),1)]),t.personality.languages&&t.select_language?(w(),M("div",ast,[lst,cst,s.isMounted?q("",!0):ne((w(),M("select",{key:0,id:"languages","onUpdate:modelValue":e[4]||(e[4]=a=>t.personality.language=a),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},[(w(!0),M($e,null,ct(t.personality.languages,(a,l)=>(w(),M("option",{key:l,selected:a==t.personality.languages[0]},fe(a),9,dst))),128))],512)),[[zn,t.personality.language]])])):q("",!0),t.personality.language?(w(),M("div",ust,[pst,_st,je(" "+fe(t.personality.language),1)])):q("",!0),u("div",hst,[fst,mst,je(" "+fe(t.personality.category),1)])]),gst,u("p",{class:"mx-1 opacity-80 h-20 overflow-y-auto scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",title:t.personality.description,innerHTML:t.personality.description},null,8,bst)]),u("div",Est,[s.isMounted?(w(),M("button",{key:0,type:"button",title:"Select",onClick:[e[5]||(e[5]=(...a)=>r.toggleSelected&&r.toggleSelected(...a)),e[6]||(e[6]=Te(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},Sst)):q("",!0),s.isMounted?(w(),M("button",{key:1,type:"button",title:"Talk",onClick:[e[7]||(e[7]=(...a)=>r.toggleTalk&&r.toggleTalk(...a)),e[8]||(e[8]=Te(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},Cst)):q("",!0),Oe(o,{commands:r.commandsList,force_position:2,title:"Menu"},null,8,["commands"])])],2)],10,Kit)}const gO=bt(Wit,[["render",Rst]]);const Ast={props:{code:String},data(){return{evaluatedCode:"",componentKey:0}},watch:{code:{handler(n){console.log("Code changed"),this.evaluateScriptTags(n),this.componentKey++},immediate:!0}},methods:{evaluateScriptTags(n){const e=document.createElement("div");e.innerHTML=n,e.querySelectorAll("script").forEach(i=>{const s=document.createElement("script");s.textContent=i.textContent,document.body.appendChild(s),document.body.removeChild(s)}),this.evaluatedCode=e.innerHTML,console.log("evaluated code: "+this.evaluatedCode)}}},wst=["innerHTML"];function Nst(n,e,t,i,s,r){return w(),M("div",{innerHTML:s.evaluatedCode,key:s.componentKey},null,8,wst)}const bO=bt(Ast,[["render",Nst]]),Ost="/",Ist={components:{DynamicUIRenderer:bO},props:{binding:{},onSelected:Function,onReinstall:Function,onInstall:Function,onUnInstall:Function,onSettings:Function,onReloadBinding:Function,selected:Boolean},data(){return{isTemplate:!1}},mounted(){Ve(()=>{qe.replace()})},methods:{copyToClipBoard(n){console.log("Copying to clipboard :",n),navigator.clipboard.writeText(n)},getImgUrl(){return Ost+this.binding.icon},defaultImg(n){n.target.src=yc},toggleSelected(){this.onSelected(this)},toggleInstall(){this.onInstall(this)},toggleUnInstall(){this.onUnInstall(this)},toggleReinstall(){this.onReinstall(this)},toggleReloadBinding(){this.onReloadBinding(this)},toggleSettings(){this.onSettings(this)},getStatus(){(this.binding.folder==="backend_template"||this.binding.folder==="binding_template")&&(this.isTemplate=!0)}},watch:{selected(){Ve(()=>{qe.replace()})}}},Mst=["title"],Dst={class:"flex flex-row items-center gap-3"},kst=["src"],Lst={class:"font-bold font-large text-lg truncate"},Pst=u("div",{class:"grow"},null,-1),Ust={class:"flex-none gap-1"},Fst=u("i",{"data-feather":"refresh-cw",class:"w-5"},null,-1),Bst=u("span",{class:"sr-only"},"Help",-1),Gst=[Fst,Bst],zst={class:"flex items-center flex-row-reverse gap-2 my-1"},Vst=u("span",{class:"sr-only"},"Click to install",-1),Hst=u("span",{class:"sr-only"},"Reinstall",-1),qst=u("span",{class:"sr-only"},"UnInstall",-1),Yst=u("span",{class:"sr-only"},"Settings",-1),$st={class:""},Wst={class:""},Kst={class:"flex items-center"},jst=u("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),Qst=u("b",null,"Author: ",-1),Xst={class:"flex items-center"},Zst=u("i",{"data-feather":"folder",class:"w-5 m-1"},null,-1),Jst=u("b",null,"Folder: ",-1),ert=u("div",{class:"grow"},null,-1),trt=u("i",{"data-feather":"clipboard",class:"w-5"},null,-1),nrt=[trt],irt={class:"flex items-center"},srt=u("i",{"data-feather":"git-merge",class:"w-5 m-1"},null,-1),rrt=u("b",null,"Version: ",-1),ort={class:"flex items-center"},art=u("i",{"data-feather":"github",class:"w-5 m-1"},null,-1),lrt=u("b",null,"Link: ",-1),crt=["href"],drt=u("div",{class:"flex items-center"},[u("i",{"data-feather":"info",class:"w-5 m-1"}),u("b",null,"Description: "),u("br")],-1),urt=["title","innerHTML"];function prt(n,e,t,i,s,r){const o=ht("DynamicUIRenderer");return w(),M("div",{class:Ye(["items-start p-4 hover:bg-primary-light hover:border-primary-light rounded-lg mb-2 shadow-lg border-2 cursor-pointer select-none",t.selected?" border-primary bg-primary":"border-transparent"]),onClick:e[8]||(e[8]=Te((...a)=>r.toggleSelected&&r.toggleSelected(...a),["stop"])),title:t.binding.installed?t.binding.name:"Not installed"},[u("div",null,[u("div",Dst,[u("img",{ref:"imgElement",src:r.getImgUrl(),onError:e[0]||(e[0]=a=>r.defaultImg(a)),class:"w-10 h-10 rounded-full object-fill text-blue-700"},null,40,kst),u("h3",Lst,fe(t.binding.name),1),Pst,u("div",Ust,[t.selected?(w(),M("button",{key:0,type:"button",title:"Reload binding",onClick:[e[1]||(e[1]=(...a)=>r.toggleReloadBinding&&r.toggleReloadBinding(...a)),e[2]||(e[2]=Te(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},Gst)):q("",!0)])]),u("div",zst,[t.binding.installed?q("",!0):(w(),M("button",{key:0,title:"Click to install",type:"button",onClick:e[3]||(e[3]=Te((...a)=>r.toggleInstall&&r.toggleInstall(...a),["stop"])),class:"inline-flex items-center gap-2 px-3 py-2 text-xs font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"},[je(" Install "),Vst])),t.binding.installed?(w(),M("button",{key:1,title:"Click to Reinstall binding",type:"button",onClick:e[4]||(e[4]=Te((...a)=>r.toggleReinstall&&r.toggleReinstall(...a),["stop"])),class:"inline-flex items-center gap-2 px-3 py-2 text-xs font-medium text-center focus:outline-none text-white bg-green-700 hover:bg-red-800 focus:ring-4 focus:ring-green-300 rounded-lg dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-red-900"},[je(" Reinstall "),Hst])):q("",!0),t.binding.installed?(w(),M("button",{key:2,title:"Click to Reinstall binding",type:"button",onClick:e[5]||(e[5]=Te((...a)=>r.toggleUnInstall&&r.toggleUnInstall(...a),["stop"])),class:"inline-flex items-center gap-2 px-3 py-2 text-xs font-medium text-center focus:outline-none text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 rounded-lg dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900"},[je(" Uninstall "),qst])):q("",!0),t.selected?(w(),M("button",{key:3,title:"Click to open Settings",type:"button",onClick:e[6]||(e[6]=Te((...a)=>r.toggleSettings&&r.toggleSettings(...a),["stop"])),class:"inline-flex items-center gap-2 px-3 py-2 text-xs font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"},[je(" Settings "),Yst])):q("",!0)]),t.binding.ui?(w(),xt(o,{key:0,class:"w-full h-full",code:t.binding.ui},null,8,["code"])):q("",!0),u("div",$st,[u("div",Wst,[u("div",Kst,[jst,Qst,je(" "+fe(t.binding.author),1)]),u("div",Xst,[Zst,Jst,je(" "+fe(t.binding.folder)+" ",1),ert,u("button",{class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center",title:"Copy link to clipboard",onClick:e[7]||(e[7]=Te(a=>r.copyToClipBoard(this.binding.folder),["stop"]))},nrt)]),u("div",irt,[srt,rrt,je(" "+fe(t.binding.version),1)]),u("div",ort,[art,lrt,u("a",{href:t.binding.link,target:"_blank",class:"flex items-center hover:text-secondary duration-75 active:scale-90"},fe(t.binding.link),9,crt)])]),drt,u("p",{class:"mx-1 opacity-80 line-clamp-3",title:t.binding.description,innerHTML:t.binding.description},null,8,urt)])])],10,Mst)}const _rt=bt(Ist,[["render",prt]]),hrt="/assets/extension-59119348.png",frt={data(){return{show:!1,model_path:"",resolve:null}},methods:{cancel(){this.resolve(null)},openInputBox(){return new Promise(n=>{this.resolve=n})},hide(n){this.show=!1,this.resolve&&(this.resolve(n),this.resolve=null)},showDialog(n){return new Promise(e=>{this.model_path=n,this.show=!0,this.resolve=e})}}},mrt={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50"},grt={class:"relative w-full max-w-md max-h-full"},brt={class:"relative bg-white rounded-lg shadow dark:bg-gray-700"},Ert=u("svg",{"aria-hidden":"true",class:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1),vrt=u("span",{class:"sr-only"},"Close modal",-1),yrt=[Ert,vrt],Srt={class:"p-4 text-center"},Trt=u("svg",{"aria-hidden":"true",class:"mx-auto mb-4 text-gray-400 w-14 h-14 dark:text-gray-200",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1),xrt={class:"p-4 text-center mx-auto mb-4"},Crt=u("label",{class:"mr-2"},"Model path",-1);function Rrt(n,e,t,i,s,r){return s.show?(w(),M("div",mrt,[u("div",grt,[u("div",brt,[u("button",{type:"button",onClick:e[0]||(e[0]=o=>r.hide(!1)),class:"absolute top-3 right-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-800 dark:hover:text-white"},yrt),u("div",Srt,[Trt,u("div",xrt,[Crt,ne(u("input",{"onUpdate:modelValue":e[1]||(e[1]=o=>s.model_path=o),class:"px-4 py-2 border border-gray-300 rounded-lg",type:"text"},null,512),[[Pe,s.model_path]])]),u("button",{onClick:e[2]||(e[2]=o=>r.hide(!0)),type:"button",class:"text-white bg-green-600 hover:bg-green-800 focus:ring-4 focus:outline-none focus:ring-red-300 dark:focus:ring-red-800 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2"}," Add "),u("button",{onClick:e[3]||(e[3]=o=>r.hide(!1)),type:"button",class:"text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600"},"No, cancel")])])])])):q("",!0)}const Art=bt(frt,[["render",Rrt]]);const wrt={props:{show:{type:Boolean,default:!1,required:!1},can_remove:{type:Boolean,default:!1},title:{type:String,default:"Select an option"},choices:{type:Array,required:!0}},data(){return{selectedChoice:null,showInput:!1,newFilename:""}},methods:{displayName(n){return console.log("choice:",n),typeof n=="string"?n:n&&n.name?n.name:""},selectChoice(n){this.selectedChoice=n,this.$emit("choice-selected",n)},closeDialog(){this.$emit("close-dialog")},validateChoice(){this.$emit("choice-validated",this.selectedChoice)},formatSize(n){return n<1024?n+" bytes":n<1024*1024?(n/1024).toFixed(2)+" KB":n<1024*1024*1024?(n/(1024*1024)).toFixed(2)+" MB":(n/(1024*1024*1024)).toFixed(2)+" GB"},toggleInput(){this.showInput=!this.showInput},addNewFilename(){const n=this.newFilename.trim();n!==""&&(this.choices.push(n),this.newFilename="",this.selectChoice(n)),this.showInput=!1},removeChoice(n,e){this.choices.splice(e,1),n===this.selectedChoice&&(this.selectedChoice=null),this.$emit("choice-removed",n)}}},Nrt={key:0,class:"fixed inset-0 flex items-center justify-center bg-black bg-opacity-50"},Ort={class:"bg-white dark:bg-gray-800 rounded-lg p-6 w-96"},Irt={class:"text-xl font-semibold mb-4"},Mrt={class:"h-48 overflow-y-auto"},Drt=["onClick"],krt={class:"font-bold"},Lrt=u("br",null,null,-1),Prt={key:0,class:"text-xs text-gray-500"},Urt=["onClick"],Frt={key:0,class:"mt-4"},Brt={class:"flex justify-end mt-4"},Grt=["disabled"];function zrt(n,e,t,i,s,r){return w(),xt(ls,{name:"fade"},{default:Je(()=>[t.show?(w(),M("div",Nrt,[u("div",Ort,[u("h2",Irt,fe(t.title),1),u("div",Mrt,[u("ul",null,[(w(!0),M($e,null,ct(t.choices,(o,a)=>(w(),M("li",{key:a,onClick:l=>r.selectChoice(o),class:Ye([{"selected-choice":o===s.selectedChoice},"py-2 px-4 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-700"])},[u("span",krt,fe(r.displayName(o)),1),Lrt,o.size?(w(),M("span",Prt,fe(r.formatSize(o.size)),1)):q("",!0),t.can_remove?(w(),M("button",{key:1,onClick:l=>r.removeChoice(o,a),class:"ml-2 text-red-500 hover:text-red-600"}," X ",8,Urt)):q("",!0)],10,Drt))),128))])]),s.showInput?(w(),M("div",Frt,[ne(u("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>s.newFilename=o),placeholder:"Enter a filename",class:"border border-gray-300 p-2 rounded-lg w-full"},null,512),[[Pe,s.newFilename]]),u("button",{onClick:e[1]||(e[1]=(...o)=>r.addNewFilename&&r.addNewFilename(...o)),class:"mt-2 py-2 px-4 bg-green-500 hover:bg-green-600 text-white rounded-lg transition duration-300"}," Add ")])):q("",!0),u("div",Brt,[u("button",{onClick:e[2]||(e[2]=(...o)=>r.closeDialog&&r.closeDialog(...o)),class:"py-2 px-4 mr-2 bg-red-500 hover:bg-red-600 text-white rounded-lg transition duration-300"}," Cancel "),u("button",{onClick:e[3]||(e[3]=(...o)=>r.validateChoice&&r.validateChoice(...o)),class:Ye([{"bg-gray-400 cursor-not-allowed":!s.selectedChoice,"bg-blue-500 hover:bg-blue-600":s.selectedChoice,"text-white":s.selectedChoice,"text-gray-500":!s.selectedChoice},"py-2 px-4 rounded-lg transition duration-300"]),disabled:!s.selectedChoice}," Validate ",10,Grt),u("button",{onClick:e[4]||(e[4]=(...o)=>r.toggleInput&&r.toggleInput(...o)),class:"py-2 px-4 ml-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg transition duration-300"}," Add New ")])])])):q("",!0)]),_:1})}const AE=bt(wrt,[["render",zrt]]),Vrt={props:{radioOptions:{type:Array,required:!0},defaultValue:{type:String,default:0}},data(){return{selectedValue:this.defaultValue}},methods:{handleRadioChange(n){this.selectedValue!==null&&this.$emit("radio-selected",this.selectedValue,n)}}},Hrt={class:"flex space-x-4"},qrt=["value","onChange"],Yrt={class:"text-gray-700"};function $rt(n,e,t,i,s,r){return w(),M("div",Hrt,[(w(!0),M($e,null,ct(t.radioOptions,(o,a)=>(w(),M("label",{key:o.value,class:"flex items-center space-x-2"},[ne(u("input",{type:"radio",value:o.value,"onUpdate:modelValue":e[0]||(e[0]=l=>s.selectedValue=l),onChange:l=>r.handleRadioChange(a),class:"text-blue-500 focus:ring-2 focus:ring-blue-200"},null,40,qrt),[[jD,s.selectedValue]]),u("span",Yrt,fe(o.label),1)]))),128))])}const Wrt=bt(Vrt,[["render",$rt]]),Krt="/",jrt={props:{extension:{},select_language:Boolean,selected:Boolean,full_path:String,onTalk:Function,onSelected:Function,onMount:Function,onUnMount:Function,onRemount:Function,onReinstall:Function,onSettings:Function},components:{InteractiveMenu:cp},data(){return{isMounted:!1,name:this.extension.name}},computed:{commandsList(){let n=[{name:this.isMounted?"unmount":"mount",icon:"feather:settings",is_file:!1,value:this.isMounted?this.unmount:this.mount},{name:"reinstall",icon:"feather:terminal",is_file:!1,value:this.toggleReinstall}];return this.isMounted&&n.push({name:"remount",icon:"feather:refresh-ccw",is_file:!1,value:this.reMount}),n.push({name:"settings",icon:"feather:settings",is_file:!1,value:this.toggleSettings}),n},selected_computed(){return this.selected}},mounted(){this.isMounted=this.extension.isMounted,Ve(()=>{qe.replace()})},methods:{getImgUrl(){return Krt+this.extension.avatar},defaultImg(n){n.target.src=yc},toggleTalk(){this.onTalk(this)},toggleSelected(){this.isMounted&&this.onSelected(this)},reMount(){this.onRemount(this)},mount(){console.log("Mounting"),this.onMount(this)},unmount(){console.log("Unmounting"),console.log(this.onUnMount),this.onUnMount(this)},toggleSettings(){this.onSettings(this)},toggleReinstall(){this.onReinstall(this)}},watch:{selected(){Ve(()=>{qe.replace()})}}},Qrt=["title"],Xrt={class:"flex flex-row items-center flex-shrink-0 gap-3"},Zrt=["src"],Jrt={class:""},eot={class:""},tot={class:"flex items-center"},not=u("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),iot=u("b",null,"Author: ",-1),sot={class:"flex items-center"},rot=u("i",{"data-feather":"bookmark",class:"w-5 m-1"},null,-1),oot=u("b",null,"Based on: ",-1),aot={key:0,class:"flex items-center"},lot=u("i",{"data-feather":"globe",class:"w-5 m-1"},null,-1),cot=u("b",null,"Languages: ",-1),dot=["selected"],uot={key:1,class:"flex items-center"},pot=u("i",{"data-feather":"globe",class:"w-5 m-1"},null,-1),_ot=u("b",null,"Language: ",-1),hot={class:"flex items-center"},fot=u("i",{"data-feather":"bookmark",class:"w-5 m-1"},null,-1),mot=u("b",null,"Category: ",-1),got=u("div",{class:"flex items-center"},[u("i",{"data-feather":"info",class:"w-5 m-1"}),u("b",null,"Description: "),u("br")],-1),bot=["title","innerHTML"],Eot={class:"rounded bg-blue-300"},vot=u("i",{"data-feather":"check"},null,-1),yot=u("span",{class:"sr-only"},"Select",-1),Sot=[vot,yot],Tot=u("i",{"data-feather":"send",class:"w-5"},null,-1),xot=u("span",{class:"sr-only"},"Talk",-1),Cot=[Tot,xot];function Rot(n,e,t,i,s,r){const o=ht("InteractiveMenu");return w(),M("div",{class:Ye(["min-w-96 items-start p-4 hover:bg-primary-light rounded-lg mb-2 shadow-lg border-2 cursor-pointer select-none",r.selected_computed?"border-2 border-primary-light":"border-transparent",s.isMounted?"bg-blue-200 dark:bg-blue-700":""]),tabindex:"-1",title:t.extension.installed?"":"Not installed"},[u("div",{class:Ye(t.extension.installed?"":"border-red-500")},[u("div",Xrt,[u("img",{onClick:e[0]||(e[0]=(...a)=>r.toggleSelected&&r.toggleSelected(...a)),ref:"imgElement",src:r.getImgUrl(),onError:e[1]||(e[1]=a=>r.defaultImg(a)),class:"w-10 h-10 rounded-full object-fill text-red-700 cursor-pointer"},null,40,Zrt),u("h3",{onClick:e[2]||(e[2]=(...a)=>r.toggleSelected&&r.toggleSelected(...a)),class:"font-bold font-large text-lg line-clamp-3 cursor-pointer"},fe(t.extension.name),1)]),u("div",Jrt,[u("div",eot,[u("div",tot,[not,iot,je(" "+fe(t.extension.author),1)]),u("div",sot,[rot,oot,je(" "+fe(t.extension.based_on),1)]),t.extension.languages&&t.select_language?(w(),M("div",aot,[lot,cot,ne(u("select",{id:"languages","onUpdate:modelValue":e[3]||(e[3]=a=>t.extension.language=a),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},[(w(!0),M($e,null,ct(t.extension.languages,(a,l)=>(w(),M("option",{key:l,selected:a==t.extension.languages[0]},fe(a),9,dot))),128))],512),[[zn,t.extension.language]])])):q("",!0),t.extension.language?(w(),M("div",uot,[pot,_ot,je(" "+fe(t.extension.language),1)])):q("",!0),u("div",hot,[fot,mot,je(" "+fe(t.extension.category),1)])]),got,u("p",{class:"mx-1 opacity-80 h-20 overflow-y-auto scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",title:t.extension.description,innerHTML:t.extension.description},null,8,bot)]),u("div",Eot,[s.isMounted?(w(),M("button",{key:0,type:"button",title:"Select",onClick:[e[4]||(e[4]=(...a)=>r.toggleSelected&&r.toggleSelected(...a)),e[5]||(e[5]=Te(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},Sot)):q("",!0),s.isMounted?(w(),M("button",{key:1,type:"button",title:"Talk",onClick:[e[6]||(e[6]=(...a)=>r.toggleTalk&&r.toggleTalk(...a)),e[7]||(e[7]=Te(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},Cot)):q("",!0),Oe(o,{commands:r.commandsList,force_position:2,title:"Menu"},null,8,["commands"])])],2)],10,Qrt)}const Aot=bt(jrt,[["render",Rot]]),wot="/assets/gpu-df72bf63.svg";const Not="/";Me.defaults.baseURL="/";const Oot={components:{AddModelDialog:Art,ModelEntry:Nit,PersonalityViewer:Yit,PersonalityEntry:gO,BindingEntry:_rt,ChoiceDialog:AE,Card:vc,RadioOptions:Wrt,ExtensionEntry:Aot},data(){return{posts_headers:{accept:"application/json","Content-Type":"application/json"},defaultModelImgPlaceholder:Li,voices:[],voice_languages:{Arabic:"ar","Brazilian Portuguese":"pt",Chinese:"zh-cn",Czech:"cs",Dutch:"nl",English:"en",French:"fr",German:"de",Italian:"it",Polish:"pl",Russian:"ru",Spanish:"es",Turkish:"tr",Japanese:"ja",Korean:"ko",Hungarian:"hu",Hindi:"hi"},binding_changed:!1,SVGGPU:wot,models_zoo:[],models_zoo_initialLoadCount:10,models_zoo_loadMoreCount:5,models_zoo_loadedEntries:[],models_zoo_scrollThreshold:200,sortOptions:[{label:"Sort by Date",value:0},{label:"Sort by Rank",value:1},{label:"Sort by Name",value:2},{label:"Sort by Maker",value:3},{label:"Sort by Quantizer",value:4}],show_only_installed_models:!1,reference_path:"",audioVoices:[],has_updates:!1,variant_choices:[],variantSelectionDialogVisible:!1,currenModelToInstall:null,loading_text:"",extension_category:"bound_extensions",personality_category:null,addModelDialogVisibility:!1,modelPath:"",personalitiesFiltered:[],modelsFiltered:[],extensionsFiltered:[],collapsedArr:[],all_collapsed:!0,data_conf_collapsed:!0,servers_conf_collapsed:!0,minconf_collapsed:!0,bec_collapsed:!0,sort_type:0,is_loading_zoo:!1,mzc_collapsed:!0,mzdc_collapsed:!0,pzc_collapsed:!0,ezc_collapsed:!0,mep_collapsed:!0,bzc_collapsed:!0,pc_collapsed:!0,mc_collapsed:!0,sc_collapsed:!0,mzl_collapsed:!1,pzl_collapsed:!1,ezl_collapsed:!1,bzl_collapsed:!1,extCatgArr:[],persCatgArr:[],persArr:[],showConfirmation:!1,showToast:!1,isLoading:!1,settingsChanged:!1,isModelSelected:!1,isMounted:!1,bUrl:Not,searchPersonality:"",searchExtension:"",searchModel:"",searchPersonalityTimer:{},searchPersonalityTimerInterval:1500,searchModelTimerInterval:1500,searchPersonalityInProgress:!1,searchExtensionInProgress:!1,searchModelInProgress:!1,addModel:{},modelDownlaodInProgress:!1,uploadData:[]}},async created(){Ze.on("loading_text",this.on_loading_text),this.updateHasUpdates()},methods:{reinstallSDService(){Me.get("install_sd").then(n=>{}).catch(n=>{console.error(n)})},upgradeSDService(){Me.get("upgrade_sd").then(n=>{}).catch(n=>{console.error(n)})},startSDService(){Me.get("start_sd").then(n=>{}).catch(n=>{console.error(n)})},showSD(){Me.get("show_sd").then(n=>{}).catch(n=>{console.error(n)})},reinstallComfyUIService(){Me.get("install_comfyui").then(n=>{}).catch(n=>{console.error(n)})},upgradeComfyUIService(){Me.get("upgrade_comfyui").then(n=>{}).catch(n=>{console.error(n)})},startComfyUIService(){Me.get("start_comfyui").then(n=>{}).catch(n=>{console.error(n)})},showComfyui(){Me.get("show_comfyui").then(n=>{}).catch(n=>{console.error(n)})},reinstallMotionCtrlService(){Me.get("install_motion_ctrl").then(n=>{}).catch(n=>{console.error(n)})},reinstallvLLMService(){Me.get("install_vllm").then(n=>{}).catch(n=>{console.error(n)})},startvLLMService(){Me.get("start_vllm").then(n=>{}).catch(n=>{console.error(n)})},startollamaService(){Me.get("start_ollama").then(n=>{}).catch(n=>{console.error(n)})},reinstallPetalsService(){Me.get("install_petals").then(n=>{}).catch(n=>{console.error(n)})},reinstallOLLAMAService(){Me.get("install_ollama").then(n=>{}).catch(n=>{console.error(n)})},reinstallAudioService(){Me.get("install_xtts").then(n=>{}).catch(n=>{console.error(n)})},startAudioService(){Me.get("start_xtts").then(n=>{}).catch(n=>{console.error(n)})},reinstallElasticSearchService(){Me.get("install_vllm").then(n=>{}).catch(n=>{console.error(n)})},getSeviceVoices(){Me.get("list_voices").then(n=>{this.voices=n.data.voices}).catch(n=>{console.error(n)})},load_more_models(){this.models_zoo_initialLoadCount+10{qe.replace()}),this.binding_changed&&!this.mzc_collapsed&&(this.modelsZoo==null||this.modelsZoo.length==0)&&(console.log("Refreshing models"),await this.$store.dispatch("refreshConfig"),this.models_zoo=[],this.refreshModelsZoo(),this.binding_changed=!1)},async selectSortOption(n){this.$store.state.sort_type=n,this.updateModelsZoo(),console.log(`Selected sorting:${n}`),console.log(`models:${this.models_zoo}`)},handleRadioSelected(n){this.isLoading=!0,this.selectSortOption(n).then(()=>{this.isLoading=!1})},filter_installed(n){return console.log("filtering"),n.filter(e=>e.isInstalled===!0)},getVoices(){"speechSynthesis"in window&&(this.audioVoices=speechSynthesis.getVoices(),console.log("Voices:"+this.audioVoices),!this.audio_out_voice&&this.audioVoices.length>0&&(this.audio_out_voice=this.audioVoices[0].name),speechSynthesis.onvoiceschanged=()=>{})},async updateHasUpdates(){let n=await this.api_get_req("check_update");this.has_updates=n.update_availability,console.log("has_updates",this.has_updates)},onVariantChoiceSelected(n){this.selected_variant=n},oncloseVariantChoiceDialog(){this.variantSelectionDialogVisible=!1},onvalidateVariantChoice(n){this.variantSelectionDialogVisible=!1,this.currenModelToInstall.installing=!0;let e=this.currenModelToInstall;if(e.linkNotValid){e.installing=!1,this.$store.state.toast.showToast("Link is not valid, file does not exist",4,!1);return}let t="https://huggingface.co/"+e.model.quantizer+"/"+e.model.name+"/resolve/main/"+this.selected_variant.name;this.showProgress=!0,this.progress=0,this.addModel={model_name:this.selected_variant.name,binding_folder:this.configFile.binding_name,model_url:t},console.log("installing...",this.addModel);const i=s=>{if(console.log("received something"),s.status&&s.progress<=100){if(this.addModel=s,console.log("Progress",s),e.progress=s.progress,e.speed=s.speed,e.total_size=s.total_size,e.downloaded_size=s.downloaded_size,e.start_time=s.start_time,e.installing=!0,e.progress==100){const r=this.models_zoo.findIndex(o=>o.name===e.model.name);this.models_zoo[r].isInstalled=!0,this.showProgress=!1,e.installing=!1,console.log("Received succeeded"),Ze.off("install_progress",i),console.log("Installed successfully"),this.$store.state.toast.showToast(`Model: +`);var P=0,j=!1;this.parse=function(Y,Q,ae){if(typeof Y!="string")throw new Error("Input must be a string");var te=Y.length,Z=A.length,me=U.length,ve=F.length,Ae=O(K),J=[],ge=[],ee=[],Se=P=0;if(!Y)return ze();if(R.header&&!Q){var Ie=Y.split(U)[0].split(A),k=[],B={},$=!1;for(var de in Ie){var ie=Ie[de];O(R.transformHeader)&&(ie=R.transformHeader(ie,de));var Ce=ie,we=B[ie]||0;for(0=L)return ze(!0)}else for(z=P,P++;;){if((z=Y.indexOf(S,z+1))===-1)return ae||ge.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:J.length,index:P}),xe();if(z===te-1)return xe(Y.substring(P,z).replace(I,S));if(S!==G||Y[z+1]!==G){if(S===G||z===0||Y[z-1]!==G){ce!==-1&&ce=L)return ze(!0);break}ge.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:J.length,index:P}),z++}}else z++}return xe();function re(ke){J.push(ke),Se=P}function Re(ke){var lt=0;if(ke!==-1){var Qe=Y.substring(z+1,ke);Qe&&Qe.trim()===""&&(lt=Qe.length)}return lt}function xe(ke){return ae||(ke===void 0&&(ke=Y.substring(P)),ee.push(ke),P=te,re(ee),Ae&&st()),ze()}function De(ke){P=ke,re(ee),ee=[],D=Y.indexOf(U,P)}function ze(ke){return{data:J,errors:ge,meta:{delimiter:A,linebreak:U,aborted:j,truncated:!!ke,cursor:Se+(Q||0)}}}function st(){K(ze()),J=[],ge=[]}},this.abort=function(){j=!0},this.getCharIndex=function(){return P}}function v(R){var S=R.data,A=o[S.workerId],U=!1;if(S.error)A.userError(S.error,S.file);else if(S.results&&S.results.data){var F={abort:function(){U=!0,y(S.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:T,resume:T};if(O(A.userStep)){for(var K=0;Kn.text()).then(n=>{const{data:e}=Ptt.parse(n,{header:!0});console.log("Recovered data"),console.log(e),this.faqs=e}).catch(n=>{console.error("Error loading FAQs:",n)})},parseMultiline(n){return n.replace(/\n/g,"
")}}},Ws=n=>(Nr("data-v-b19a05a8"),n=n(),Or(),n),Ftt={class:"container flex-row mx-auto p-4 bg-bg-light-tone dark:bg-bg-dark-tone shadow-lg overflow-y-auto no-scrollbar p-2 pb-0 grid lg:grid-cols-1 md:grid-cols-2 gap-4"},Btt=Ws(()=>u("h2",{class:"text-2xl font-bold mb-2"},"About Lord of large Language Models",-1)),Gtt={class:"mb-4"},ztt=Ws(()=>u("p",null,[je("Discord link: "),u("a",{class:"text-blue-500 hover:text-blue-400 duration-150",href:"https://discord.gg/YgnaFMAQ"},"https://discord.gg/YgnaFMAQ")],-1)),Vtt=Ws(()=>u("h2",{class:"text-2xl font-bold mb-2"},"Frequently Asked Questions",-1)),Htt={class:"list-disc pl-4"},qtt={class:"text-xl font-bold mb-1"},Ytt=["innerHTML"],$tt=Ws(()=>u("h2",{class:"text-2xl font-bold mb-2"},"Contact Us",-1)),Wtt=Ws(()=>u("p",{class:"mb-4"},"If you have any further questions or need assistance, feel free to reach out to me.",-1)),Ktt=Ws(()=>u("p",null,[je("Discord link: "),u("a",{class:"text-blue-500 hover:text-blue-400 duration-150",href:"https://discord.gg/YgnaFMAQ"},"https://discord.gg/YgnaFMAQ")],-1)),jtt=Ws(()=>u("h2",{class:"text-2xl font-bold mb-2"},"Credits",-1)),Qtt=Ws(()=>u("p",{class:"mb-4"},[je("This project is developed by "),u("span",{class:"font-bold"},"ParisNeo"),je(" With help from the community.")],-1)),Xtt=Ws(()=>u("p",{class:"mb-4"},[u("span",{class:"font-bold"},[u("a",{href:"https://github.com/ParisNeo/lollms-webui/graphs/contributors"},"Check out the full list of developers here and show them some love.")])],-1)),Ztt=["href"];function Jtt(n,e,t,i,s,r){const o=ht("Card");return w(),M("div",Ftt,[Oe(o,{disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[Btt,u("p",Gtt," Lollms version "+fe(r.version),1),ztt]),_:1}),Oe(o,{disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[Vtt,u("ul",Htt,[(w(!0),M($e,null,ct(s.faqs,(a,l)=>(w(),M("li",{key:l},[u("h3",qtt,fe(a.question),1),u("p",{class:"mb-4",innerHTML:r.parseMultiline(a.answer)},null,8,Ytt)]))),128))])]),_:1}),Oe(o,{disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[$tt,Wtt,Ktt]),_:1}),Oe(o,{disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[jtt,Qtt,Xtt,u("p",null,[je("Check out the project on "),u("a",{class:"text-blue-500 hover:text-blue-400 duration-150",href:s.githubLink,target:"_blank",rel:"noopener noreferrer"},"GitHub",8,Ztt),je(".")])]),_:1})])}const ent=bt(Utt,[["render",Jtt],["__scopeId","data-v-b19a05a8"]]);function ss(n,e=!0,t=1){const i=e?1e3:1024;if(Math.abs(n)=i&&r{qe.replace()})},executeCommand(n){this.isMenuOpen=!1,console.log("Selected"),console.log(n.value),typeof n.value=="function"&&(console.log("Command detected",n),n.value()),this.execute_cmd&&(console.log("executing generic command"),this.execute_cmd(n))},positionMenu(){var n;if(this.$refs.menuButton!=null){if(this.force_position==0||this.force_position==null){const e=this.$refs.menuButton.getBoundingClientRect(),t=window.innerHeight;n=e.bottom>t/2}else this.force_position==1?n=!0:n=!1;this.menuPosition.top=n?"auto":"calc(100% + 10px)",this.menuPosition.bottom=n?"100%":"auto"}}},mounted(){window.addEventListener("resize",this.positionMenu),this.positionMenu(),Ve(()=>{qe.replace()})},beforeDestroy(){window.removeEventListener("resize",this.positionMenu)},watch:{isMenuOpen:"positionMenu"}},nnt={class:"menu-container"},int=["title"],snt=["src"],rnt=["data-feather"],ont={key:2,class:"w-5 h-5"},ant={key:3,"data-feather":"menu"},lnt={class:"flex-grow menu-ul"},cnt=["onClick"],dnt={key:0,"data-feather":"check"},unt=["src","alt"],pnt=["data-feather"],_nt={key:3,class:"menu-icon"};function hnt(n,e,t,i,s,r){return w(),M("div",nnt,[u("button",{onClick:e[0]||(e[0]=Te((...o)=>r.toggleMenu&&r.toggleMenu(...o),["prevent"])),title:t.title,class:Ye([t.menuIconClass,"menu-button m-0 p-0 bg-blue-500 text-white dark:bg-blue-200 dark:text-gray-800 rounded flex items-center justify-center w-6 h-6 border-none cursor-pointer hover:bg-blue-400 w-8 h-8 object-fill text-red-700 border-2 active:scale-90 hover:z-20 hover:-translate-y-2 duration-150 border-gray-300 border-secondary cursor-pointer"]),ref:"menuButton"},[t.icon&&!t.icon.includes("#")&&!t.icon.includes("feather")?(w(),M("img",{key:0,src:t.icon,class:"w-5 h-5 p-0 m-0 shadow-lg bold"},null,8,snt)):t.icon&&t.icon.includes("feather")?(w(),M("i",{key:1,"data-feather":t.icon.split(":")[1],class:"w-5 h-5"},null,8,rnt)):t.icon&&t.icon.includes("#")?(w(),M("p",ont,fe(t.icon.split("#")[1]),1)):(w(),M("i",ant))],10,int),Oe(ls,{name:"slide"},{default:Je(()=>[s.isMenuOpen?(w(),M("div",{key:0,class:"menu-list flex-grow",style:en(s.menuPosition),ref:"menu"},[u("ul",lnt,[(w(!0),M($e,null,ct(t.commands,(o,a)=>(w(),M("li",{key:a,onClick:Te(l=>r.executeCommand(o),["prevent"]),class:"menu-command menu-li flex-grow hover:bg-blue-400"},[t.selected_entry==o.name?(w(),M("i",dnt)):o.icon&&!o.icon.includes("feather")&&!o.is_file?(w(),M("img",{key:1,src:o.icon,alt:o.name,class:"menu-icon"},null,8,unt)):q("",!0),o.icon&&o.icon.includes("feather")&&!o.is_file?(w(),M("i",{key:2,"data-feather":o.icon.split(":")[1],class:"mr-2"},null,8,pnt)):(w(),M("span",_nt)),u("span",null,fe(o.name),1)],8,cnt))),128))])],4)):q("",!0)]),_:1})])}const cp=bt(tnt,[["render",hnt]]),fnt={components:{InteractiveMenu:cp},props:{isInstalled:Boolean,onInstall:Function,onCancelInstall:Function,onUninstall:Function,onSelected:Function,onCopy:Function,onCopyLink:Function,selected:Boolean,model:Object,model_type:String},data(){return{progress:0,speed:0,total_size:0,downloaded_size:0,start_time:"",installing:!1,uninstalling:!1,failedToLoad:!1,linkNotValid:!1,selected_variant:""}},async mounted(){Ve(()=>{qe.replace()})},methods:{formatFileSize(n){return n<1024?n+" bytes":n<1024*1024?(n/1024).toFixed(2)+" KB":n<1024*1024*1024?(n/(1024*1024)).toFixed(2)+" MB":(n/(1024*1024*1024)).toFixed(2)+" GB"},computedFileSize(n){return ss(n)},getImgUrl(){return this.model.icon==null||this.model.icon==="/images/default_model.png"?Li:this.model.icon},defaultImg(n){n.target.src=Li},install(){this.onInstall(this)},uninstall(){this.isInstalled&&this.onUninstall(this)},toggleInstall(){this.isInstalled?(this.uninstalling=!0,this.onUninstall(this)):this.onInstall(this)},toggleSelected(n){if(console.log("event.target.tagName.toLowerCase()"),console.log(n.target.tagName.toLowerCase()),n.target.tagName.toLowerCase()==="button"||n.target.tagName.toLowerCase()==="svg"){n.stopPropagation();return}this.onSelected(this),this.model.selected=!0,Ve(()=>{qe.replace()})},toggleCopy(){this.onCopy(this)},toggleCopyLink(){this.onCopyLink(this)},toggleCancelInstall(){this.onCancelInstall(this),this.installing=!1},handleSelection(){this.isInstalled&&!this.selected&&this.onSelected(this)},copyContentToClipboard(){this.$emit("copy","this.message.content")}},computed:{computed_classes(){return this.model.isInstalled?this.selected?"border-4 border-gray-200 bg-primary cursor-pointer":"border-0 border-primary bg-primary cursor-pointer":"border-transparent"},commandsList(){let n=[{name:this.model.isInstalled?"Install Extra":"Install",icon:"feather:settings",is_file:!1,value:this.install},{name:"Copy model info to clipboard",icon:"feather:settings",is_file:!1,value:this.toggleCopy}];return this.model.isInstalled&&n.push({name:"UnInstall",icon:"feather:settings",is_file:!1,value:this.uninstall}),this.selected&&n.push({name:"Reload",icon:"feather:refresh-ccw",is_file:!1,value:this.toggleSelected}),n},selected_computed(){return this.selected},fileSize:{get(){if(this.model&&this.model.variants&&this.model.variants.length>0){const n=this.model.variants[0].size;return this.formatFileSize(n)}return null}},speed_computed(){return ss(this.speed)},total_size_computed(){return ss(this.total_size)},downloaded_size_computed(){return ss(this.downloaded_size)}},watch:{linkNotValid(){Ve(()=>{qe.replace()})}}},mnt=["title"],gnt={key:0,class:"flex flex-row"},bnt={class:"max-w-[300px] overflow-x-auto"},Ent={class:"flex gap-3 items-center grow"},vnt=["href"],ynt=["src"],Snt={class:"flex-1 overflow-hidden"},Tnt={class:"font-bold font-large text-lg truncate"},xnt={key:1,class:"flex items-center flex-row gap-2 my-1"},Cnt={class:"flex grow items-center"},Rnt=u("i",{"data-feather":"box",class:"w-5"},null,-1),Ant=u("span",{class:"sr-only"},"Custom model / local model",-1),wnt=[Rnt,Ant],Nnt=u("span",{class:"sr-only"},"Remove",-1),Ont={key:2,class:"absolute z-10 -m-4 p-5 shadow-md text-center rounded-lg w-full h-full bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel bg-opacity-70 dark:bg-opacity-70 flex justify-center items-center"},Int={class:"relative flex flex-col items-center justify-center flex-grow h-full"},Mnt=u("div",{role:"status",class:"justify-center"},[u("svg",{"aria-hidden":"true",class:"w-24 h-24 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),u("span",{class:"sr-only"},"Loading...")],-1),Dnt={class:"relative flex flex-row flex-grow items-center w-full h-full bottom-0"},knt={class:"w-full bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel rounded-lg p-2"},Lnt={class:"flex justify-between mb-1"},Pnt=u("span",{class:"text-base font-medium text-blue-700 dark:text-white"},"Downloading",-1),Unt={class:"text-sm font-medium text-blue-700 dark:text-white"},Fnt={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},Bnt={class:"flex justify-between mb-1"},Gnt={class:"text-base font-medium text-blue-700 dark:text-white"},znt={class:"text-sm font-medium text-blue-700 dark:text-white"},Vnt={class:"flex flex-grow"},Hnt={class:"flex flex-row flex-grow gap-3"},qnt={class:"p-2 text-center grow"},Ynt={key:3},$nt={class:"flex flex-row items-center gap-3"},Wnt=["src"],Knt={class:"font-bold font-large text-lg truncate"},jnt=u("div",{class:"grow"},null,-1),Qnt={class:"flex items-center flex-row-reverse gap-2 my-1"},Xnt={class:"flex flex-row items-center"},Znt={key:0,class:"text-base text-red-600 flex items-center mt-1"},Jnt=u("i",{"data-feather":"alert-triangle",class:"flex-shrink-0 mx-1"},null,-1),eit=["title"],tit={class:""},nit={class:"flex flex-row items-center"},iit=u("i",{"data-feather":"download",class:"w-5 m-1 flex-shrink-0"},null,-1),sit=u("b",null,"Card: ",-1),rit=["href","title"],oit=u("div",{class:"grow"},null,-1),ait=u("i",{"data-feather":"clipboard",class:"w-5"},null,-1),lit=[ait],cit={class:"flex items-center"},dit=u("i",{"data-feather":"file",class:"w-5 m-1"},null,-1),uit=u("b",null,"File size: ",-1),pit={class:"flex items-center"},_it=u("i",{"data-feather":"key",class:"w-5 m-1"},null,-1),hit=u("b",null,"License: ",-1),fit={key:0,class:"flex items-center"},mit=u("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),git=u("b",null,"quantizer: ",-1),bit=["href"],Eit={class:"flex items-center"},vit=u("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),yit=u("b",null,"Model creator: ",-1),Sit=["href"],Tit={class:"flex items-center"},xit=u("i",{"data-feather":"clock",class:"w-5 m-1"},null,-1),Cit=u("b",null,"Release date: ",-1),Rit={class:"flex items-center"},Ait=u("i",{"data-feather":"grid",class:"w-5 m-1"},null,-1),wit=u("b",null,"Category: ",-1),Nit=["href"];function Oit(n,e,t,i,s,r){const o=ht("InteractiveMenu");return w(),M("div",{class:Ye(["relative items-start p-4 hover:bg-primary-light rounded-lg mb-2 shadow-lg border-2 select-none",r.computed_classes]),title:t.model.name,onClick:e[10]||(e[10]=Te(a=>r.toggleSelected(a),["prevent"]))},[t.model.isCustomModel?(w(),M("div",gnt,[u("div",bnt,[u("div",Ent,[u("a",{href:t.model.model_creator_link,target:"_blank"},[u("img",{src:r.getImgUrl(),onError:e[0]||(e[0]=a=>r.defaultImg(a)),class:"w-10 h-10 rounded-lg object-fill"},null,40,ynt)],8,vnt),u("div",Snt,[u("h3",Tnt,fe(t.model.name),1)])])])])):q("",!0),t.model.isCustomModel?(w(),M("div",xnt,[u("div",Cnt,[u("button",{type:"button",title:"Custom model / local model",class:"font-medium rounded-lg text-sm p-2 text-center inline-flex items-center",onClick:e[1]||(e[1]=Te(()=>{},["stop"]))},wnt),je(" Custom model ")]),u("div",null,[t.model.isInstalled?(w(),M("button",{key:0,title:"Delete file from disk",type:"button",onClick:e[2]||(e[2]=Te((...a)=>r.uninstall&&r.uninstall(...a),["stop"])),class:"inline-flex items-center gap-2 px-3 py-2 text-xs font-medium text-center focus:outline-none text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 rounded-lg dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900"},[je(" Uninstall "),Nnt])):q("",!0)])])):q("",!0),s.installing?(w(),M("div",Ont,[u("div",Int,[Mnt,u("div",Dnt,[u("div",knt,[u("div",Lnt,[Pnt,u("span",Unt,fe(Math.floor(s.progress))+"%",1)]),u("div",Fnt,[u("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en({width:s.progress+"%"})},null,4)]),u("div",Bnt,[u("span",Gnt,"Download speed: "+fe(r.speed_computed)+"/s",1),u("span",znt,fe(r.downloaded_size_computed)+"/"+fe(r.total_size_computed),1)])])]),u("div",Vnt,[u("div",Hnt,[u("div",qnt,[u("button",{onClick:e[3]||(e[3]=Te((...a)=>r.toggleCancelInstall&&r.toggleCancelInstall(...a),["stop"])),type:"button",title:"Cancel download",class:"text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600"}," Cancel ")])])])])])):q("",!0),t.model.isCustomModel?q("",!0):(w(),M("div",Ynt,[u("div",$nt,[u("img",{ref:"imgElement",src:r.getImgUrl(),onError:e[4]||(e[4]=a=>r.defaultImg(a)),class:Ye(["w-10 h-10 rounded-lg object-fill",s.linkNotValid?"grayscale":""])},null,42,Wnt),u("h3",Knt,fe(t.model.name),1),jnt,Oe(o,{commands:r.commandsList,force_position:2,title:"Menu"},null,8,["commands"])]),u("div",Qnt,[u("div",Xnt,[s.linkNotValid?(w(),M("div",Znt,[Jnt,je(" Link is not valid ")])):q("",!0)])]),u("div",{class:"",title:t.model.isInstalled?t.model.name:"Not installed"},[u("div",tit,[u("div",nit,[iit,sit,u("a",{href:"https://huggingface.co/"+t.model.quantizer+"/"+t.model.name,target:"_blank",onClick:e[5]||(e[5]=Te(()=>{},["stop"])),class:"m-1 flex items-center hover:text-secondary duration-75 active:scale-90 truncate",title:s.linkNotValid?"Link is not valid":"Download this manually (faster) and put it in the models/ folder then refresh"}," View full model card ",8,rit),oit,u("button",{class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center",title:"Copy link to clipboard",onClick:e[6]||(e[6]=Te(a=>r.toggleCopyLink(),["stop"]))},lit)]),u("div",cit,[u("div",{class:Ye(["flex flex-shrink-0 items-center",s.linkNotValid?"text-red-600":""])},[dit,uit,je(" "+fe(r.fileSize),1)],2)]),u("div",pit,[_it,hit,je(" "+fe(t.model.license),1)]),t.model.quantizer!="None"&&t.model.type!="transformers"?(w(),M("div",fit,[mit,git,u("a",{href:"https://huggingface.co/"+t.model.quantizer,target:"_blank",rel:"noopener noreferrer",onClick:e[7]||(e[7]=Te(()=>{},["stop"])),class:"flex hover:text-secondary duration-75 active:scale-90",title:"quantizer's profile"},fe(t.model.quantizer),9,bit)])):q("",!0),u("div",Eit,[vit,yit,u("a",{href:t.model.model_creator_link,target:"_blank",rel:"noopener noreferrer",onClick:e[8]||(e[8]=Te(()=>{},["stop"])),class:"flex hover:text-secondary duration-75 active:scale-90",title:"quantizer's profile"},fe(t.model.model_creator),9,Sit)]),u("div",Tit,[xit,Cit,je(" "+fe(t.model.last_commit_time),1)]),u("div",Rit,[Ait,wit,u("a",{href:"https://huggingface.co/"+t.model.model_creator,target:"_blank",rel:"noopener noreferrer",onClick:e[9]||(e[9]=Te(()=>{},["stop"])),class:"flex hover:text-secondary duration-75 active:scale-90",title:"quantizer's profile"},fe(t.model.category),9,Nit)])])],8,eit)]))],10,mnt)}const Iit=bt(fnt,[["render",Oit]]),Mit={data(){return{editMode:!1,avatar:"path/to/avatar.jpg",personalityName:"Personality Name",personalityAuthor:"Author Name",personalityDescription:"Personality Description",personalityCategory:"Category",disclaimer:"Disclaimer text",conditioningText:"Conditioning Text",aiPrefix:"AI Prefix",userPrefix:"User Prefix",antipromptsList:[{id:1,text:"Antiprompt 1"},{id:2,text:"Antiprompt 2"},{id:3,text:"Antiprompt 3"}]}},methods:{commitChanges(){console.log("Personality changes committed"),this.editMode=!1}}},Dit={class:"p-4"},kit={class:"flex items-center mb-4"},Lit=["src"],Pit={class:"text-lg font-semibold"},Uit=u("strong",null,"Author:",-1),Fit=u("strong",null,"Description:",-1),Bit=u("strong",null,"Category:",-1),Git={key:0},zit=u("strong",null,"Disclaimer:",-1),Vit=u("strong",null,"Conditioning Text:",-1),Hit=u("strong",null,"AI Prefix:",-1),qit=u("strong",null,"User Prefix:",-1),Yit=u("strong",null,"Antiprompts:",-1);function $it(n,e,t,i,s,r){return w(),M("div",Dit,[u("div",kit,[u("img",{src:s.avatar,class:"w-12 h-12 rounded-full mr-2",alt:"Avatar"},null,8,Lit),u("h2",Pit,fe(s.personalityName),1)]),u("p",null,[Uit,je(" "+fe(s.personalityAuthor),1)]),u("p",null,[Fit,je(" "+fe(s.personalityDescription),1)]),u("p",null,[Bit,je(" "+fe(s.personalityCategory),1)]),s.disclaimer?(w(),M("p",Git,[zit,je(" "+fe(s.disclaimer),1)])):q("",!0),u("p",null,[Vit,je(" "+fe(s.conditioningText),1)]),u("p",null,[Hit,je(" "+fe(s.aiPrefix),1)]),u("p",null,[qit,je(" "+fe(s.userPrefix),1)]),u("div",null,[Yit,u("ul",null,[(w(!0),M($e,null,ct(s.antipromptsList,o=>(w(),M("li",{key:o.id},fe(o.text),1))),128))])]),u("button",{onClick:e[0]||(e[0]=o=>s.editMode=!0),class:"mt-4 bg-blue-500 text-white px-4 py-2 rounded"}," Edit "),s.editMode?(w(),M("button",{key:1,onClick:e[1]||(e[1]=(...o)=>r.commitChanges&&r.commitChanges(...o)),class:"mt-4 bg-green-500 text-white px-4 py-2 rounded"}," Commit ")):q("",!0)])}const Wit=bt(Mit,[["render",$it]]),yc="/assets/logo-9d653710.svg",Kit="/",jit={props:{personality:{},select_language:Boolean,selected:Boolean,full_path:String,onTalk:Function,onSelected:Function,onMount:Function,onUnMount:Function,onRemount:Function,onCopyToCustom:Function,onEdit:Function,onReinstall:Function,onSettings:Function,onCopyPersonalityName:Function},components:{InteractiveMenu:cp},data(){return{isMounted:!1,name:this.personality.name}},computed:{commandsList(){let n=[{name:this.isMounted?"unmount":"mount",icon:"feather:settings",is_file:!1,value:this.isMounted?this.unmount:this.mount},{name:"reinstall",icon:"feather:terminal",is_file:!1,value:this.toggleReinstall}];return console.log("this.category",this.personality.category),this.personality.category=="custom_personalities"?n.push({name:"edit",icon:"feather:settings",is_file:!1,value:this.edit}):n.push({name:"Copy to custom personas folder for editing",icon:"feather:copy",is_file:!1,value:this.copyToCustom}),this.isMounted&&n.push({name:"remount",icon:"feather:refresh-ccw",is_file:!1,value:this.reMount}),this.selected&&this.personality.has_scripts&&n.push({name:"settings",icon:"feather:settings",is_file:!1,value:this.toggleSettings}),n},selected_computed(){return this.selected}},mounted(){this.isMounted=this.personality.isMounted,Ve(()=>{qe.replace()})},methods:{getImgUrl(){return Kit+this.personality.avatar},defaultImg(n){n.target.src=yc},toggleTalk(){this.onTalk(this)},toggleCopyLink(){this.onCopyPersonalityName(this)},toggleSelected(){this.isMounted&&this.onSelected(this)},edit(){this.onEdit(this)},copyToCustom(){this.onCopyToCustom(this)},reMount(){this.onRemount(this)},mount(){console.log("Mounting"),this.onMount(this)},unmount(){console.log("Unmounting"),console.log(this.onUnMount),this.onUnMount(this),this.isMounted=!1},toggleSettings(){this.onSettings(this)},toggleReinstall(){this.onReinstall(this)}},watch:{selected(){Ve(()=>{qe.replace()})}}},Qit=["title"],Xit={class:"flex flex-row items-center flex-shrink-0 gap-3"},Zit=["src"],Jit=u("i",{"data-feather":"clipboard",class:"w-5"},null,-1),est=[Jit],tst={class:""},nst={class:""},ist={class:"flex items-center"},sst=u("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),rst=u("b",null,"Author: ",-1),ost={class:"flex items-center"},ast=u("i",{"data-feather":"git-commit",class:"w-5 m-1"},null,-1),lst=u("b",null,"Version: ",-1),cst={key:0,class:"flex items-center"},dst=u("i",{"data-feather":"globe",class:"w-5 m-1"},null,-1),ust=u("b",null,"Languages: ",-1),pst=["selected"],_st={key:1,class:"flex items-center"},hst=u("i",{"data-feather":"globe",class:"w-5 m-1"},null,-1),fst=u("b",null,"Language: ",-1),mst={class:"flex items-center"},gst=u("i",{"data-feather":"bookmark",class:"w-5 m-1"},null,-1),bst=u("b",null,"Category: ",-1),Est=u("div",{class:"flex items-center"},[u("i",{"data-feather":"info",class:"w-5 m-1"}),u("b",null,"Description: "),u("br")],-1),vst=["title","innerHTML"],yst={class:"rounded bg-blue-300"},Sst=u("i",{"data-feather":"check"},null,-1),Tst=u("span",{class:"sr-only"},"Select",-1),xst=[Sst,Tst],Cst=u("i",{"data-feather":"send",class:"w-5"},null,-1),Rst=u("span",{class:"sr-only"},"Talk",-1),Ast=[Cst,Rst];function wst(n,e,t,i,s,r){const o=ht("InteractiveMenu");return w(),M("div",{class:Ye(["min-w-96 items-start p-4 hover:bg-primary-light rounded-lg mb-2 shadow-lg border-2 cursor-pointer select-none",r.selected_computed?"border-2 border-primary-light":"border-transparent",s.isMounted?"bg-blue-200 dark:bg-blue-700":""]),tabindex:"-1",title:t.personality.installed?"":"Not installed"},[u("div",{class:Ye(t.personality.installed?"":"border-red-500")},[u("div",Xit,[u("img",{onClick:e[0]||(e[0]=(...a)=>r.toggleSelected&&r.toggleSelected(...a)),ref:"imgElement",src:r.getImgUrl(),onError:e[1]||(e[1]=a=>r.defaultImg(a)),class:"w-10 h-10 rounded-full object-fill text-red-700 cursor-pointer"},null,40,Zit),u("h3",{onClick:e[2]||(e[2]=(...a)=>r.toggleSelected&&r.toggleSelected(...a)),class:"font-bold font-large text-lg line-clamp-3 cursor-pointer"},fe(t.personality.name),1),u("button",{class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center",title:"Copy link to clipboard",onClick:e[3]||(e[3]=Te(a=>r.toggleCopyLink(),["stop"]))},est)]),u("div",tst,[u("div",nst,[u("div",ist,[sst,rst,je(" "+fe(t.personality.author),1)]),u("div",ost,[ast,lst,je(" "+fe(t.personality.version),1)]),t.personality.languages&&t.select_language?(w(),M("div",cst,[dst,ust,s.isMounted?q("",!0):ne((w(),M("select",{key:0,id:"languages","onUpdate:modelValue":e[4]||(e[4]=a=>t.personality.language=a),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},[(w(!0),M($e,null,ct(t.personality.languages,(a,l)=>(w(),M("option",{key:l,selected:a==t.personality.languages[0]},fe(a),9,pst))),128))],512)),[[zn,t.personality.language]])])):q("",!0),t.personality.language?(w(),M("div",_st,[hst,fst,je(" "+fe(t.personality.language),1)])):q("",!0),u("div",mst,[gst,bst,je(" "+fe(t.personality.category),1)])]),Est,u("p",{class:"mx-1 opacity-80 h-20 overflow-y-auto scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",title:t.personality.description,innerHTML:t.personality.description},null,8,vst)]),u("div",yst,[s.isMounted?(w(),M("button",{key:0,type:"button",title:"Select",onClick:[e[5]||(e[5]=(...a)=>r.toggleSelected&&r.toggleSelected(...a)),e[6]||(e[6]=Te(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},xst)):q("",!0),s.isMounted?(w(),M("button",{key:1,type:"button",title:"Talk",onClick:[e[7]||(e[7]=(...a)=>r.toggleTalk&&r.toggleTalk(...a)),e[8]||(e[8]=Te(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},Ast)):q("",!0),Oe(o,{commands:r.commandsList,force_position:2,title:"Menu"},null,8,["commands"])])],2)],10,Qit)}const gO=bt(jit,[["render",wst]]);const Nst={props:{code:String},data(){return{evaluatedCode:"",componentKey:0}},watch:{code:{handler(n){console.log("Code changed"),this.evaluateScriptTags(n),this.componentKey++},immediate:!0}},methods:{evaluateScriptTags(n){const e=document.createElement("div");e.innerHTML=n,e.querySelectorAll("script").forEach(i=>{const s=document.createElement("script");s.textContent=i.textContent,document.body.appendChild(s),document.body.removeChild(s)}),this.evaluatedCode=e.innerHTML,console.log("evaluated code: "+this.evaluatedCode)}}},Ost=["innerHTML"];function Ist(n,e,t,i,s,r){return w(),M("div",{innerHTML:s.evaluatedCode,key:s.componentKey},null,8,Ost)}const bO=bt(Nst,[["render",Ist]]),Mst="/",Dst={components:{DynamicUIRenderer:bO},props:{binding:{},onSelected:Function,onReinstall:Function,onInstall:Function,onUnInstall:Function,onSettings:Function,onReloadBinding:Function,selected:Boolean},data(){return{isTemplate:!1}},mounted(){Ve(()=>{qe.replace()})},methods:{copyToClipBoard(n){console.log("Copying to clipboard :",n),navigator.clipboard.writeText(n)},getImgUrl(){return Mst+this.binding.icon},defaultImg(n){n.target.src=yc},toggleSelected(){this.onSelected(this)},toggleInstall(){this.onInstall(this)},toggleUnInstall(){this.onUnInstall(this)},toggleReinstall(){this.onReinstall(this)},toggleReloadBinding(){this.onReloadBinding(this)},toggleSettings(){this.onSettings(this)},getStatus(){(this.binding.folder==="backend_template"||this.binding.folder==="binding_template")&&(this.isTemplate=!0)}},watch:{selected(){Ve(()=>{qe.replace()})}}},kst=["title"],Lst={class:"flex flex-row items-center gap-3"},Pst=["src"],Ust={class:"font-bold font-large text-lg truncate"},Fst=u("div",{class:"grow"},null,-1),Bst={class:"flex-none gap-1"},Gst=u("i",{"data-feather":"refresh-cw",class:"w-5"},null,-1),zst=u("span",{class:"sr-only"},"Help",-1),Vst=[Gst,zst],Hst={class:"flex items-center flex-row-reverse gap-2 my-1"},qst=u("span",{class:"sr-only"},"Click to install",-1),Yst=u("span",{class:"sr-only"},"Reinstall",-1),$st=u("span",{class:"sr-only"},"UnInstall",-1),Wst=u("span",{class:"sr-only"},"Settings",-1),Kst={class:""},jst={class:""},Qst={class:"flex items-center"},Xst=u("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),Zst=u("b",null,"Author: ",-1),Jst={class:"flex items-center"},ert=u("i",{"data-feather":"folder",class:"w-5 m-1"},null,-1),trt=u("b",null,"Folder: ",-1),nrt=u("div",{class:"grow"},null,-1),irt=u("i",{"data-feather":"clipboard",class:"w-5"},null,-1),srt=[irt],rrt={class:"flex items-center"},ort=u("i",{"data-feather":"git-merge",class:"w-5 m-1"},null,-1),art=u("b",null,"Version: ",-1),lrt={class:"flex items-center"},crt=u("i",{"data-feather":"github",class:"w-5 m-1"},null,-1),drt=u("b",null,"Link: ",-1),urt=["href"],prt=u("div",{class:"flex items-center"},[u("i",{"data-feather":"info",class:"w-5 m-1"}),u("b",null,"Description: "),u("br")],-1),_rt=["title","innerHTML"];function hrt(n,e,t,i,s,r){const o=ht("DynamicUIRenderer");return w(),M("div",{class:Ye(["items-start p-4 hover:bg-primary-light hover:border-primary-light rounded-lg mb-2 shadow-lg border-2 cursor-pointer select-none",t.selected?" border-primary bg-primary":"border-transparent"]),onClick:e[8]||(e[8]=Te((...a)=>r.toggleSelected&&r.toggleSelected(...a),["stop"])),title:t.binding.installed?t.binding.name:"Not installed"},[u("div",null,[u("div",Lst,[u("img",{ref:"imgElement",src:r.getImgUrl(),onError:e[0]||(e[0]=a=>r.defaultImg(a)),class:"w-10 h-10 rounded-full object-fill text-blue-700"},null,40,Pst),u("h3",Ust,fe(t.binding.name),1),Fst,u("div",Bst,[t.selected?(w(),M("button",{key:0,type:"button",title:"Reload binding",onClick:[e[1]||(e[1]=(...a)=>r.toggleReloadBinding&&r.toggleReloadBinding(...a)),e[2]||(e[2]=Te(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},Vst)):q("",!0)])]),u("div",Hst,[t.binding.installed?q("",!0):(w(),M("button",{key:0,title:"Click to install",type:"button",onClick:e[3]||(e[3]=Te((...a)=>r.toggleInstall&&r.toggleInstall(...a),["stop"])),class:"inline-flex items-center gap-2 px-3 py-2 text-xs font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"},[je(" Install "),qst])),t.binding.installed?(w(),M("button",{key:1,title:"Click to Reinstall binding",type:"button",onClick:e[4]||(e[4]=Te((...a)=>r.toggleReinstall&&r.toggleReinstall(...a),["stop"])),class:"inline-flex items-center gap-2 px-3 py-2 text-xs font-medium text-center focus:outline-none text-white bg-green-700 hover:bg-red-800 focus:ring-4 focus:ring-green-300 rounded-lg dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-red-900"},[je(" Reinstall "),Yst])):q("",!0),t.binding.installed?(w(),M("button",{key:2,title:"Click to Reinstall binding",type:"button",onClick:e[5]||(e[5]=Te((...a)=>r.toggleUnInstall&&r.toggleUnInstall(...a),["stop"])),class:"inline-flex items-center gap-2 px-3 py-2 text-xs font-medium text-center focus:outline-none text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 rounded-lg dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900"},[je(" Uninstall "),$st])):q("",!0),t.selected?(w(),M("button",{key:3,title:"Click to open Settings",type:"button",onClick:e[6]||(e[6]=Te((...a)=>r.toggleSettings&&r.toggleSettings(...a),["stop"])),class:"inline-flex items-center gap-2 px-3 py-2 text-xs font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"},[je(" Settings "),Wst])):q("",!0)]),t.binding.ui?(w(),xt(o,{key:0,class:"w-full h-full",code:t.binding.ui},null,8,["code"])):q("",!0),u("div",Kst,[u("div",jst,[u("div",Qst,[Xst,Zst,je(" "+fe(t.binding.author),1)]),u("div",Jst,[ert,trt,je(" "+fe(t.binding.folder)+" ",1),nrt,u("button",{class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center",title:"Copy link to clipboard",onClick:e[7]||(e[7]=Te(a=>r.copyToClipBoard(this.binding.folder),["stop"]))},srt)]),u("div",rrt,[ort,art,je(" "+fe(t.binding.version),1)]),u("div",lrt,[crt,drt,u("a",{href:t.binding.link,target:"_blank",class:"flex items-center hover:text-secondary duration-75 active:scale-90"},fe(t.binding.link),9,urt)])]),prt,u("p",{class:"mx-1 opacity-80 line-clamp-3",title:t.binding.description,innerHTML:t.binding.description},null,8,_rt)])])],10,kst)}const frt=bt(Dst,[["render",hrt]]),mrt="/assets/extension-59119348.png",grt={data(){return{show:!1,model_path:"",resolve:null}},methods:{cancel(){this.resolve(null)},openInputBox(){return new Promise(n=>{this.resolve=n})},hide(n){this.show=!1,this.resolve&&(this.resolve(n),this.resolve=null)},showDialog(n){return new Promise(e=>{this.model_path=n,this.show=!0,this.resolve=e})}}},brt={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50"},Ert={class:"relative w-full max-w-md max-h-full"},vrt={class:"relative bg-white rounded-lg shadow dark:bg-gray-700"},yrt=u("svg",{"aria-hidden":"true",class:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1),Srt=u("span",{class:"sr-only"},"Close modal",-1),Trt=[yrt,Srt],xrt={class:"p-4 text-center"},Crt=u("svg",{"aria-hidden":"true",class:"mx-auto mb-4 text-gray-400 w-14 h-14 dark:text-gray-200",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1),Rrt={class:"p-4 text-center mx-auto mb-4"},Art=u("label",{class:"mr-2"},"Model path",-1);function wrt(n,e,t,i,s,r){return s.show?(w(),M("div",brt,[u("div",Ert,[u("div",vrt,[u("button",{type:"button",onClick:e[0]||(e[0]=o=>r.hide(!1)),class:"absolute top-3 right-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-800 dark:hover:text-white"},Trt),u("div",xrt,[Crt,u("div",Rrt,[Art,ne(u("input",{"onUpdate:modelValue":e[1]||(e[1]=o=>s.model_path=o),class:"px-4 py-2 border border-gray-300 rounded-lg",type:"text"},null,512),[[Pe,s.model_path]])]),u("button",{onClick:e[2]||(e[2]=o=>r.hide(!0)),type:"button",class:"text-white bg-green-600 hover:bg-green-800 focus:ring-4 focus:outline-none focus:ring-red-300 dark:focus:ring-red-800 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2"}," Add "),u("button",{onClick:e[3]||(e[3]=o=>r.hide(!1)),type:"button",class:"text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600"},"No, cancel")])])])])):q("",!0)}const Nrt=bt(grt,[["render",wrt]]);const Ort={props:{show:{type:Boolean,default:!1,required:!1},can_remove:{type:Boolean,default:!1},title:{type:String,default:"Select an option"},choices:{type:Array,required:!0}},data(){return{selectedChoice:null,showInput:!1,newFilename:""}},methods:{displayName(n){return console.log("choice:",n),typeof n=="string"?n:n&&n.name?n.name:""},selectChoice(n){this.selectedChoice=n,this.$emit("choice-selected",n)},closeDialog(){this.$emit("close-dialog")},validateChoice(){this.$emit("choice-validated",this.selectedChoice)},formatSize(n){return n<1024?n+" bytes":n<1024*1024?(n/1024).toFixed(2)+" KB":n<1024*1024*1024?(n/(1024*1024)).toFixed(2)+" MB":(n/(1024*1024*1024)).toFixed(2)+" GB"},toggleInput(){this.showInput=!this.showInput},addNewFilename(){const n=this.newFilename.trim();n!==""&&(this.choices.push(n),this.newFilename="",this.selectChoice(n)),this.showInput=!1},removeChoice(n,e){this.choices.splice(e,1),n===this.selectedChoice&&(this.selectedChoice=null),this.$emit("choice-removed",n)}}},Irt={key:0,class:"fixed inset-0 flex items-center justify-center bg-black bg-opacity-50"},Mrt={class:"bg-white dark:bg-gray-800 rounded-lg p-6 w-96"},Drt={class:"text-xl font-semibold mb-4"},krt={class:"h-48 overflow-y-auto"},Lrt=["onClick"],Prt={class:"font-bold"},Urt=u("br",null,null,-1),Frt={key:0,class:"text-xs text-gray-500"},Brt=["onClick"],Grt={key:0,class:"mt-4"},zrt={class:"flex justify-end mt-4"},Vrt=["disabled"];function Hrt(n,e,t,i,s,r){return w(),xt(ls,{name:"fade"},{default:Je(()=>[t.show?(w(),M("div",Irt,[u("div",Mrt,[u("h2",Drt,fe(t.title),1),u("div",krt,[u("ul",null,[(w(!0),M($e,null,ct(t.choices,(o,a)=>(w(),M("li",{key:a,onClick:l=>r.selectChoice(o),class:Ye([{"selected-choice":o===s.selectedChoice},"py-2 px-4 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-700"])},[u("span",Prt,fe(r.displayName(o)),1),Urt,o.size?(w(),M("span",Frt,fe(r.formatSize(o.size)),1)):q("",!0),t.can_remove?(w(),M("button",{key:1,onClick:l=>r.removeChoice(o,a),class:"ml-2 text-red-500 hover:text-red-600"}," X ",8,Brt)):q("",!0)],10,Lrt))),128))])]),s.showInput?(w(),M("div",Grt,[ne(u("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>s.newFilename=o),placeholder:"Enter a filename",class:"border border-gray-300 p-2 rounded-lg w-full"},null,512),[[Pe,s.newFilename]]),u("button",{onClick:e[1]||(e[1]=(...o)=>r.addNewFilename&&r.addNewFilename(...o)),class:"mt-2 py-2 px-4 bg-green-500 hover:bg-green-600 text-white rounded-lg transition duration-300"}," Add ")])):q("",!0),u("div",zrt,[u("button",{onClick:e[2]||(e[2]=(...o)=>r.closeDialog&&r.closeDialog(...o)),class:"py-2 px-4 mr-2 bg-red-500 hover:bg-red-600 text-white rounded-lg transition duration-300"}," Cancel "),u("button",{onClick:e[3]||(e[3]=(...o)=>r.validateChoice&&r.validateChoice(...o)),class:Ye([{"bg-gray-400 cursor-not-allowed":!s.selectedChoice,"bg-blue-500 hover:bg-blue-600":s.selectedChoice,"text-white":s.selectedChoice,"text-gray-500":!s.selectedChoice},"py-2 px-4 rounded-lg transition duration-300"]),disabled:!s.selectedChoice}," Validate ",10,Vrt),u("button",{onClick:e[4]||(e[4]=(...o)=>r.toggleInput&&r.toggleInput(...o)),class:"py-2 px-4 ml-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg transition duration-300"}," Add New ")])])])):q("",!0)]),_:1})}const AE=bt(Ort,[["render",Hrt]]),qrt={props:{radioOptions:{type:Array,required:!0},defaultValue:{type:String,default:0}},data(){return{selectedValue:this.defaultValue}},methods:{handleRadioChange(n){this.selectedValue!==null&&this.$emit("radio-selected",this.selectedValue,n)}}},Yrt={class:"flex space-x-4"},$rt=["value","onChange"],Wrt={class:"text-gray-700"};function Krt(n,e,t,i,s,r){return w(),M("div",Yrt,[(w(!0),M($e,null,ct(t.radioOptions,(o,a)=>(w(),M("label",{key:o.value,class:"flex items-center space-x-2"},[ne(u("input",{type:"radio",value:o.value,"onUpdate:modelValue":e[0]||(e[0]=l=>s.selectedValue=l),onChange:l=>r.handleRadioChange(a),class:"text-blue-500 focus:ring-2 focus:ring-blue-200"},null,40,$rt),[[jD,s.selectedValue]]),u("span",Wrt,fe(o.label),1)]))),128))])}const jrt=bt(qrt,[["render",Krt]]),Qrt="/",Xrt={props:{extension:{},select_language:Boolean,selected:Boolean,full_path:String,onTalk:Function,onSelected:Function,onMount:Function,onUnMount:Function,onRemount:Function,onReinstall:Function,onSettings:Function},components:{InteractiveMenu:cp},data(){return{isMounted:!1,name:this.extension.name}},computed:{commandsList(){let n=[{name:this.isMounted?"unmount":"mount",icon:"feather:settings",is_file:!1,value:this.isMounted?this.unmount:this.mount},{name:"reinstall",icon:"feather:terminal",is_file:!1,value:this.toggleReinstall}];return this.isMounted&&n.push({name:"remount",icon:"feather:refresh-ccw",is_file:!1,value:this.reMount}),n.push({name:"settings",icon:"feather:settings",is_file:!1,value:this.toggleSettings}),n},selected_computed(){return this.selected}},mounted(){this.isMounted=this.extension.isMounted,Ve(()=>{qe.replace()})},methods:{getImgUrl(){return Qrt+this.extension.avatar},defaultImg(n){n.target.src=yc},toggleTalk(){this.onTalk(this)},toggleSelected(){this.isMounted&&this.onSelected(this)},reMount(){this.onRemount(this)},mount(){console.log("Mounting"),this.onMount(this)},unmount(){console.log("Unmounting"),console.log(this.onUnMount),this.onUnMount(this)},toggleSettings(){this.onSettings(this)},toggleReinstall(){this.onReinstall(this)}},watch:{selected(){Ve(()=>{qe.replace()})}}},Zrt=["title"],Jrt={class:"flex flex-row items-center flex-shrink-0 gap-3"},eot=["src"],tot={class:""},not={class:""},iot={class:"flex items-center"},sot=u("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),rot=u("b",null,"Author: ",-1),oot={class:"flex items-center"},aot=u("i",{"data-feather":"bookmark",class:"w-5 m-1"},null,-1),lot=u("b",null,"Based on: ",-1),cot={key:0,class:"flex items-center"},dot=u("i",{"data-feather":"globe",class:"w-5 m-1"},null,-1),uot=u("b",null,"Languages: ",-1),pot=["selected"],_ot={key:1,class:"flex items-center"},hot=u("i",{"data-feather":"globe",class:"w-5 m-1"},null,-1),fot=u("b",null,"Language: ",-1),mot={class:"flex items-center"},got=u("i",{"data-feather":"bookmark",class:"w-5 m-1"},null,-1),bot=u("b",null,"Category: ",-1),Eot=u("div",{class:"flex items-center"},[u("i",{"data-feather":"info",class:"w-5 m-1"}),u("b",null,"Description: "),u("br")],-1),vot=["title","innerHTML"],yot={class:"rounded bg-blue-300"},Sot=u("i",{"data-feather":"check"},null,-1),Tot=u("span",{class:"sr-only"},"Select",-1),xot=[Sot,Tot],Cot=u("i",{"data-feather":"send",class:"w-5"},null,-1),Rot=u("span",{class:"sr-only"},"Talk",-1),Aot=[Cot,Rot];function wot(n,e,t,i,s,r){const o=ht("InteractiveMenu");return w(),M("div",{class:Ye(["min-w-96 items-start p-4 hover:bg-primary-light rounded-lg mb-2 shadow-lg border-2 cursor-pointer select-none",r.selected_computed?"border-2 border-primary-light":"border-transparent",s.isMounted?"bg-blue-200 dark:bg-blue-700":""]),tabindex:"-1",title:t.extension.installed?"":"Not installed"},[u("div",{class:Ye(t.extension.installed?"":"border-red-500")},[u("div",Jrt,[u("img",{onClick:e[0]||(e[0]=(...a)=>r.toggleSelected&&r.toggleSelected(...a)),ref:"imgElement",src:r.getImgUrl(),onError:e[1]||(e[1]=a=>r.defaultImg(a)),class:"w-10 h-10 rounded-full object-fill text-red-700 cursor-pointer"},null,40,eot),u("h3",{onClick:e[2]||(e[2]=(...a)=>r.toggleSelected&&r.toggleSelected(...a)),class:"font-bold font-large text-lg line-clamp-3 cursor-pointer"},fe(t.extension.name),1)]),u("div",tot,[u("div",not,[u("div",iot,[sot,rot,je(" "+fe(t.extension.author),1)]),u("div",oot,[aot,lot,je(" "+fe(t.extension.based_on),1)]),t.extension.languages&&t.select_language?(w(),M("div",cot,[dot,uot,ne(u("select",{id:"languages","onUpdate:modelValue":e[3]||(e[3]=a=>t.extension.language=a),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},[(w(!0),M($e,null,ct(t.extension.languages,(a,l)=>(w(),M("option",{key:l,selected:a==t.extension.languages[0]},fe(a),9,pot))),128))],512),[[zn,t.extension.language]])])):q("",!0),t.extension.language?(w(),M("div",_ot,[hot,fot,je(" "+fe(t.extension.language),1)])):q("",!0),u("div",mot,[got,bot,je(" "+fe(t.extension.category),1)])]),Eot,u("p",{class:"mx-1 opacity-80 h-20 overflow-y-auto scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",title:t.extension.description,innerHTML:t.extension.description},null,8,vot)]),u("div",yot,[s.isMounted?(w(),M("button",{key:0,type:"button",title:"Select",onClick:[e[4]||(e[4]=(...a)=>r.toggleSelected&&r.toggleSelected(...a)),e[5]||(e[5]=Te(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},xot)):q("",!0),s.isMounted?(w(),M("button",{key:1,type:"button",title:"Talk",onClick:[e[6]||(e[6]=(...a)=>r.toggleTalk&&r.toggleTalk(...a)),e[7]||(e[7]=Te(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},Aot)):q("",!0),Oe(o,{commands:r.commandsList,force_position:2,title:"Menu"},null,8,["commands"])])],2)],10,Zrt)}const Not=bt(Xrt,[["render",wot]]),Oot="/assets/gpu-df72bf63.svg";const Iot="/";Me.defaults.baseURL="/";const Mot={components:{AddModelDialog:Nrt,ModelEntry:Iit,PersonalityViewer:Wit,PersonalityEntry:gO,BindingEntry:frt,ChoiceDialog:AE,Card:vc,RadioOptions:jrt,ExtensionEntry:Not},data(){return{posts_headers:{accept:"application/json","Content-Type":"application/json"},defaultModelImgPlaceholder:Li,voices:[],voice_languages:{Arabic:"ar","Brazilian Portuguese":"pt",Chinese:"zh-cn",Czech:"cs",Dutch:"nl",English:"en",French:"fr",German:"de",Italian:"it",Polish:"pl",Russian:"ru",Spanish:"es",Turkish:"tr",Japanese:"ja",Korean:"ko",Hungarian:"hu",Hindi:"hi"},binding_changed:!1,SVGGPU:Oot,models_zoo:[],models_zoo_initialLoadCount:10,models_zoo_loadMoreCount:5,models_zoo_loadedEntries:[],models_zoo_scrollThreshold:200,sortOptions:[{label:"Sort by Date",value:0},{label:"Sort by Rank",value:1},{label:"Sort by Name",value:2},{label:"Sort by Maker",value:3},{label:"Sort by Quantizer",value:4}],show_only_installed_models:!1,reference_path:"",audioVoices:[],has_updates:!1,variant_choices:[],variantSelectionDialogVisible:!1,currenModelToInstall:null,loading_text:"",extension_category:"bound_extensions",personality_category:null,addModelDialogVisibility:!1,modelPath:"",personalitiesFiltered:[],modelsFiltered:[],extensionsFiltered:[],collapsedArr:[],all_collapsed:!0,data_conf_collapsed:!0,servers_conf_collapsed:!0,minconf_collapsed:!0,bec_collapsed:!0,sort_type:0,is_loading_zoo:!1,mzc_collapsed:!0,mzdc_collapsed:!0,pzc_collapsed:!0,ezc_collapsed:!0,mep_collapsed:!0,bzc_collapsed:!0,pc_collapsed:!0,mc_collapsed:!0,sc_collapsed:!0,mzl_collapsed:!1,pzl_collapsed:!1,ezl_collapsed:!1,bzl_collapsed:!1,extCatgArr:[],persCatgArr:[],persArr:[],showConfirmation:!1,showToast:!1,isLoading:!1,settingsChanged:!1,isModelSelected:!1,isMounted:!1,bUrl:Iot,searchPersonality:"",searchExtension:"",searchModel:"",searchPersonalityTimer:{},searchPersonalityTimerInterval:1500,searchModelTimerInterval:1500,searchPersonalityInProgress:!1,searchExtensionInProgress:!1,searchModelInProgress:!1,addModel:{},modelDownlaodInProgress:!1,uploadData:[]}},async created(){Ze.on("loading_text",this.on_loading_text),this.updateHasUpdates()},methods:{reinstallSDService(){Me.get("install_sd").then(n=>{}).catch(n=>{console.error(n)})},upgradeSDService(){Me.get("upgrade_sd").then(n=>{}).catch(n=>{console.error(n)})},startSDService(){Me.get("start_sd").then(n=>{}).catch(n=>{console.error(n)})},showSD(){Me.get("show_sd").then(n=>{}).catch(n=>{console.error(n)})},reinstallComfyUIService(){Me.get("install_comfyui").then(n=>{}).catch(n=>{console.error(n)})},upgradeComfyUIService(){Me.get("upgrade_comfyui").then(n=>{}).catch(n=>{console.error(n)})},startComfyUIService(){Me.get("start_comfyui").then(n=>{}).catch(n=>{console.error(n)})},showComfyui(){Me.get("show_comfyui").then(n=>{}).catch(n=>{console.error(n)})},reinstallMotionCtrlService(){Me.get("install_motion_ctrl").then(n=>{}).catch(n=>{console.error(n)})},reinstallvLLMService(){Me.get("install_vllm").then(n=>{}).catch(n=>{console.error(n)})},startvLLMService(){Me.get("start_vllm").then(n=>{}).catch(n=>{console.error(n)})},startollamaService(){Me.get("start_ollama").then(n=>{}).catch(n=>{console.error(n)})},reinstallPetalsService(){Me.get("install_petals").then(n=>{}).catch(n=>{console.error(n)})},reinstallOLLAMAService(){Me.get("install_ollama").then(n=>{}).catch(n=>{console.error(n)})},reinstallAudioService(){Me.get("install_xtts").then(n=>{}).catch(n=>{console.error(n)})},startAudioService(){Me.get("start_xtts").then(n=>{}).catch(n=>{console.error(n)})},reinstallElasticSearchService(){Me.get("install_vllm").then(n=>{}).catch(n=>{console.error(n)})},getSeviceVoices(){Me.get("list_voices").then(n=>{this.voices=n.data.voices}).catch(n=>{console.error(n)})},load_more_models(){this.models_zoo_initialLoadCount+10{qe.replace()}),this.binding_changed&&!this.mzc_collapsed&&(this.modelsZoo==null||this.modelsZoo.length==0)&&(console.log("Refreshing models"),await this.$store.dispatch("refreshConfig"),this.models_zoo=[],this.refreshModelsZoo(),this.binding_changed=!1)},async selectSortOption(n){this.$store.state.sort_type=n,this.updateModelsZoo(),console.log(`Selected sorting:${n}`),console.log(`models:${this.models_zoo}`)},handleRadioSelected(n){this.isLoading=!0,this.selectSortOption(n).then(()=>{this.isLoading=!1})},filter_installed(n){return console.log("filtering"),n.filter(e=>e.isInstalled===!0)},getVoices(){"speechSynthesis"in window&&(this.audioVoices=speechSynthesis.getVoices(),console.log("Voices:"+this.audioVoices),!this.audio_out_voice&&this.audioVoices.length>0&&(this.audio_out_voice=this.audioVoices[0].name),speechSynthesis.onvoiceschanged=()=>{})},async updateHasUpdates(){let n=await this.api_get_req("check_update");this.has_updates=n.update_availability,console.log("has_updates",this.has_updates)},onVariantChoiceSelected(n){this.selected_variant=n},oncloseVariantChoiceDialog(){this.variantSelectionDialogVisible=!1},onvalidateVariantChoice(n){this.variantSelectionDialogVisible=!1,this.currenModelToInstall.installing=!0;let e=this.currenModelToInstall;if(e.linkNotValid){e.installing=!1,this.$store.state.toast.showToast("Link is not valid, file does not exist",4,!1);return}let t="https://huggingface.co/"+e.model.quantizer+"/"+e.model.name+"/resolve/main/"+this.selected_variant.name;this.showProgress=!0,this.progress=0,this.addModel={model_name:this.selected_variant.name,binding_folder:this.configFile.binding_name,model_url:t},console.log("installing...",this.addModel);const i=s=>{if(console.log("received something"),s.status&&s.progress<=100){if(this.addModel=s,console.log("Progress",s),e.progress=s.progress,e.speed=s.speed,e.total_size=s.total_size,e.downloaded_size=s.downloaded_size,e.start_time=s.start_time,e.installing=!0,e.progress==100){const r=this.models_zoo.findIndex(o=>o.name===e.model.name);this.models_zoo[r].isInstalled=!0,this.showProgress=!1,e.installing=!1,console.log("Received succeeded"),Ze.off("install_progress",i),console.log("Installed successfully"),this.$store.state.toast.showToast(`Model: `+e.model.name+` installed!`,4,!0),this.$store.dispatch("refreshDiskUsage")}}else Ze.off("install_progress",i),console.log("Install failed"),e.installing=!1,this.showProgress=!1,console.error("Installation failed:",s.error),this.$store.state.toast.showToast(`Model: `+e.model.name+` @@ -167,26 +167,26 @@ Response: `+e,4,!1)),this.isLoading=!1},async unmountExtension(n){if(this.isLoading=!0,!n)return;const e=await this.p_unmount_extension(n.extension||n);if(e.status){this.configFile.extensions=e.extensions,this.$store.state.toast.showToast("Extension unmounted",4,!0);const t=this.extensions.findIndex(o=>o.full_path==n.full_path),i=this.extensionsFiltered.findIndex(o=>o.full_path==n.full_path),s=this.$refs.extensionsZoo.findIndex(o=>o.full_path==n.full_path);console.log("ext",this.extensions[t]),this.extensions[t].isMounted=!1,i>-1&&(this.extensionsFiltered[i].isMounted=!1),s>-1&&(this.$refs.extensionsZoo[s].isMounted=!1),this.$store.dispatch("refreshMountedPersonalities");const r=this.mountedExtensions[this.mountedExtensions.length-1];console.log(r,this.mountedExtensions.length)}else this.$store.state.toast.showToast(`Could not unmount extension Error: `+e.error,4,!1);this.isLoading=!1},async remountExtension(n){await this.unmountExtension(n),await this.mountExtension(n)},onExtensionReinstall(n){console.log("on reinstall ",n),this.isLoading=!0,console.log(n),Me.post("/reinstall_extension",{name:n.extension.full_path}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_extension",e),e.data.status?this.$store.state.toast.showToast("Extension reinstalled successfully!",4,!0):this.$store.state.toast.showToast("Could not reinstall extension",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not reinstall personality `+e.message,4,!1),{status:!1}))},onPersonalityReinstall(n){console.log("on reinstall ",n),this.isLoading=!0,console.log("Personality path:",n.personality.path),Me.post("/reinstall_personality",{client_id:this.$store.state.client_id,name:n.personality.path},{headers:this.posts_headers}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_personality",e),e.data.status?this.$store.state.toast.showToast("Personality reinstalled successfully!",4,!0):this.$store.state.toast.showToast("Could not reinstall personality",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not reinstall personality -`+e.message,4,!1),{status:!1}))},personalityImgPlacehodler(n){n.target.src=ga},extensionImgPlacehodler(n){n.target.src=hrt},searchPersonality_func(){clearTimeout(this.searchPersonalityTimer),this.searchPersonality&&(this.searchPersonalityInProgress=!0,setTimeout(this.filterPersonalities,this.searchPersonalityTimerInterval))},searchModel_func(){this.filterModels()}},async mounted(){console.log("Getting voices"),this.getVoices(),console.log("Constructing"),this.load_everything(),this.getSeviceVoices()},activated(){},computed:{rendered_models_zoo:{get(){return this.searchModel?this.show_only_installed_models?this.modelsFiltered.filter(n=>n.isInstalled===!0):this.modelsFiltered.slice(0,Math.min(this.models_zoo.length,this.models_zoo_initialLoadCount)):(console.log("this.models_zoo"),console.log(this.models_zoo),console.log(this.models_zoo_initialLoadCount),this.show_only_installed_models?this.models_zoo.filter(n=>n.isInstalled===!0):this.models_zoo.slice(0,Math.min(this.models_zoo.length,this.models_zoo_initialLoadCount)))}},imgBinding:{get(){if(!this.isMounted)return Li;try{return this.$refs.bindingZoo[this.$refs.bindingZoo.findIndex(n=>n.binding.folder==this.configFile.binding_name)].$refs.imgElement.src}catch{return Li}}},imgModel:{get(){try{let n=this.$store.state.modelsZoo.findIndex(e=>e.name==this.$store.state.selectedModel);return n>=0?(console.log(`model avatar : ${this.$store.state.modelsZoo[n].icon}`),this.$store.state.modelsZoo[n].icon):Li}catch{console.log("error")}if(!this.isMounted)return Li;try{return this.$refs.bindingZoo[this.$refs.bindingZoo.findIndex(n=>n.binding.folder==this.configFile.binding_name)].$refs.imgElement.src}catch{return Li}}},isReady:{get(){return this.$store.state.ready}},audio_out_voice:{get(){return this.$store.state.config.audio_out_voice},set(n){this.$store.state.config.audio_out_voice=n}},whisperModels(){return["base","base.en","base.fr","base.es","small","small.en","small.fr","small.es","medium","medium.en","medium.fr","medium.es","large","large.en","large.fr","large.es"]},audioLanguages(){return[{code:"en-US",name:"English (US)"},{code:"en-GB",name:"English (UK)"},{code:"es-ES",name:"Spanish (Spain)"},{code:"es-MX",name:"Spanish (Mexico)"},{code:"fr-FR",name:"French (France)"},{code:"fr-CA",name:"French (Canada)"},{code:"de-DE",name:"German (Germany)"},{code:"it-IT",name:"Italian (Italy)"},{code:"pt-BR",name:"Portuguese (Brazil)"},{code:"pt-PT",name:"Portuguese (Portugal)"},{code:"ru-RU",name:"Russian (Russia)"},{code:"zh-CN",name:"Chinese (China)"},{code:"ja-JP",name:"Japanese (Japan)"},{code:"ar-SA",name:"Arabic (Saudi Arabia)"},{code:"tr-TR",name:"Turkish (Turkey)"},{code:"ms-MY",name:"Malay (Malaysia)"},{code:"ko-KR",name:"Korean (South Korea)"},{code:"nl-NL",name:"Dutch (Netherlands)"},{code:"sv-SE",name:"Swedish (Sweden)"},{code:"da-DK",name:"Danish (Denmark)"},{code:"fi-FI",name:"Finnish (Finland)"},{code:"no-NO",name:"Norwegian (Norway)"},{code:"pl-PL",name:"Polish (Poland)"},{code:"el-GR",name:"Greek (Greece)"},{code:"hu-HU",name:"Hungarian (Hungary)"},{code:"cs-CZ",name:"Czech (Czech Republic)"},{code:"th-TH",name:"Thai (Thailand)"},{code:"hi-IN",name:"Hindi (India)"},{code:"he-IL",name:"Hebrew (Israel)"},{code:"id-ID",name:"Indonesian (Indonesia)"},{code:"vi-VN",name:"Vietnamese (Vietnam)"},{code:"uk-UA",name:"Ukrainian (Ukraine)"},{code:"ro-RO",name:"Romanian (Romania)"},{code:"bg-BG",name:"Bulgarian (Bulgaria)"},{code:"hr-HR",name:"Croatian (Croatia)"},{code:"sr-RS",name:"Serbian (Serbia)"},{code:"sk-SK",name:"Slovak (Slovakia)"},{code:"sl-SI",name:"Slovenian (Slovenia)"},{code:"et-EE",name:"Estonian (Estonia)"},{code:"lv-LV",name:"Latvian (Latvia)"},{code:"lt-LT",name:"Lithuanian (Lithuania)"},{code:"ka-GE",name:"Georgian (Georgia)"},{code:"hy-AM",name:"Armenian (Armenia)"},{code:"az-AZ",name:"Azerbaijani (Azerbaijan)"},{code:"kk-KZ",name:"Kazakh (Kazakhstan)"},{code:"uz-UZ",name:"Uzbek (Uzbekistan)"},{code:"kkj-CM",name:"Kako (Cameroon)"},{code:"my-MM",name:"Burmese (Myanmar)"},{code:"ne-NP",name:"Nepali (Nepal)"},{code:"si-LK",name:"Sinhala (Sri Lanka)"}]},configFile:{get(){return this.$store.state.config},set(n){this.$store.commit("setConfig",n)}},userName:{get(){return this.$store.state.config.user_name},set(n){this.$store.state.config.user_name=n}},user_avatar:{get(){return"/user_infos/"+this.$store.state.config.user_avatar},set(n){this.$store.state.config.user_avatar=n}},hardware_mode:{get(){return this.$store.state.config.hardware_mode},set(n){this.$store.state.config.hardware_mode=n}},auto_update:{get(){return this.$store.state.config.auto_update},set(n){this.$store.state.config.auto_update=n}},auto_speak:{get(){return this.$store.state.config.auto_speak},set(n){this.$store.state.config.auto_speak=n}},auto_read:{get(){return this.$store.state.config.auto_read},set(n){this.$store.state.config.auto_read=n}},enable_voice_service:{get(){return this.$store.state.config.enable_voice_service},set(n){this.$store.state.config.enable_voice_service=n}},current_language:{get(){return this.$store.state.config.current_language},set(n){console.log("Current voice set to ",n),this.$store.state.config.current_language=n}},current_voice:{get(){return this.$store.state.config.current_voice===null||this.$store.state.config.current_voice===void 0?(console.log("current voice",this.$store.state.config.current_voice),"main_voice"):this.$store.state.config.current_voice},set(n){n=="main_voice"||n===void 0?(console.log("Current voice set to None"),this.$store.state.config.current_voice=null):(console.log("Current voice set to ",n),this.$store.state.config.current_voice=n)}},audio_pitch:{get(){return this.$store.state.config.audio_pitch},set(n){this.$store.state.config.audio_pitch=n}},audio_in_language:{get(){return this.$store.state.config.audio_in_language},set(n){this.$store.state.config.audio_in_language=n}},use_user_name_in_discussions:{get(){return this.$store.state.config.use_user_name_in_discussions},set(n){this.$store.state.config.use_user_name_in_discussions=n}},discussion_db_name:{get(){return this.$store.state.config.discussion_db_name},set(n){this.$store.state.config.discussion_db_name=n}},personalities:{get(){return this.$store.state.personalities},set(n){this.$store.commit("setPersonalities",n)}},mountedPersArr:{get(){return this.$store.state.mountedPersArr},set(n){this.$store.commit("setMountedPers",n)}},mountedExtensions:{get(){return console.log("this.$store.state.mountedExtensions:",this.$store.state.mountedExtensions),this.$store.state.mountedExtensions},set(n){this.$store.commit("setActiveExtensions",n)}},bindingsZoo:{get(){return this.$store.state.bindingsZoo},set(n){this.$store.commit("setbindingsZoo",n)}},modelsArr:{get(){return this.$store.state.modelsArr},set(n){this.$store.commit("setModelsArr",n)}},models:{get(){return this.models_zoo},set(n){this.$store.commit("setModelsZoo",n)}},installed_models:{get(){return this.models_zoo},set(n){this.$store.commit("setModelsZoo",n)}},diskUsage:{get(){return this.$store.state.diskUsage},set(n){this.$store.commit("setDiskUsage",n)}},ramUsage:{get(){return this.$store.state.ramUsage},set(n){this.$store.commit("setRamUsage",n)}},vramUsage:{get(){return this.$store.state.vramUsage},set(n){this.$store.commit("setVramUsage",n)}},disk_available_space(){return this.computedFileSize(this.diskUsage.available_space)},disk_binding_models_usage(){return console.log(`this.diskUsage : ${this.diskUsage}`),this.computedFileSize(this.diskUsage.binding_models_usage)},disk_percent_usage(){return this.diskUsage.percent_usage},disk_total_space(){return this.computedFileSize(this.diskUsage.total_space)},ram_available_space(){return this.computedFileSize(this.ramUsage.available_space)},ram_usage(){return this.computedFileSize(this.ramUsage.ram_usage)},ram_percent_usage(){return this.ramUsage.percent_usage},ram_total_space(){return this.computedFileSize(this.ramUsage.total_space)},model_name(){if(this.isMounted)return this.configFile.model_name},binding_name(){if(!this.isMounted)return;const n=this.bindingsZoo.findIndex(e=>e.folder===this.configFile.binding_name);if(n>-1)return this.bindingsZoo[n].name},active_pesonality(){if(!this.isMounted)return;const n=this.personalities.findIndex(e=>e.full_path===this.configFile.personalities[this.configFile.active_personality_id]);if(n>-1)return this.personalities[n].name},speed_computed(){return ss(this.addModel.speed)},total_size_computed(){return ss(this.addModel.total_size)},downloaded_size_computed(){return ss(this.addModel.downloaded_size)}},watch:{enable_voice_service(n){n||(this.configFile.auto_read=!1)},bec_collapsed(){Ve(()=>{qe.replace()})},pc_collapsed(){Ve(()=>{qe.replace()})},mc_collapsed(){Ve(()=>{qe.replace()})},sc_collapsed(){Ve(()=>{qe.replace()})},showConfirmation(){Ve(()=>{qe.replace()})},mzl_collapsed(){Ve(()=>{qe.replace()})},pzl_collapsed(){Ve(()=>{qe.replace()})},ezl_collapsed(){Ve(()=>{qe.replace()})},bzl_collapsed(){Ve(()=>{qe.replace()})},all_collapsed(n){this.collapseAll(n),Ve(()=>{qe.replace()})},settingsChanged(n){this.$store.state.settingsChanged=n,Ve(()=>{qe.replace()})},isLoading(){Ve(()=>{qe.replace()})},searchPersonality(n){n==""&&this.filterPersonalities()},mzdc_collapsed(){Ve(()=>{qe.replace()})}},async beforeRouteLeave(n){if(await this.$router.isReady(),this.settingsChanged)return await this.$store.state.yesNoDialog.askQuestion(`Did You forget to apply changes? -You need to apply changes before you leave, or else.`,"Apply configuration","Cancel")&&this.applyConfiguration(),!1}},oe=n=>(Nr("data-v-bbd5a2e4"),n=n(),Or(),n),Iot={class:"container overflow-y-scroll flex flex-row shadow-lg p-10 pt-0 overflow-y-scroll w-full dark:bg-bg-dark scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},Mot={class:"sticky top-0 z-10 flex flex-row mb-2 p-3 gap-3 w-full rounded-b-lg bg-bg-light-tone dark:bg-bg-dark-tone shadow-lg"},Dot={key:0,class:"flex gap-3 flex-1 items-center duration-75"},kot=oe(()=>u("i",{"data-feather":"x"},null,-1)),Lot=[kot],Pot=oe(()=>u("i",{"data-feather":"check"},null,-1)),Uot=[Pot],Fot={key:1,class:"flex gap-3 flex-1 items-center"},Bot=oe(()=>u("i",{"data-feather":"save"},null,-1)),Got=[Bot],zot=oe(()=>u("i",{"data-feather":"refresh-ccw"},null,-1)),Vot=[zot],Hot=oe(()=>u("i",{"data-feather":"list"},null,-1)),qot=[Hot],Yot={class:"flex gap-3 flex-1 items-center justify-end"},$ot=oe(()=>u("i",{"data-feather":"trash-2"},null,-1)),Wot=[$ot],Kot=oe(()=>u("i",{"data-feather":"refresh-ccw"},null,-1)),jot=[Kot],Qot=oe(()=>u("i",{"data-feather":"arrow-up-circle"},null,-1)),Xot={key:0},Zot=oe(()=>u("i",{"data-feather":"alert-circle"},null,-1)),Jot=[Zot],eat={class:"flex gap-3 items-center"},tat={key:0,class:"flex gap-3 items-center"},nat=oe(()=>u("p",{class:"text-red-600 font-bold"},"Apply changes:",-1)),iat=oe(()=>u("i",{"data-feather":"check"},null,-1)),sat=[iat],rat={key:1,role:"status"},oat=oe(()=>u("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1)),aat=oe(()=>u("span",{class:"sr-only"},"Loading...",-1)),lat={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},cat={class:"flex flex-row p-3"},dat=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),uat=[dat],pat=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),_at=[pat],hat=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," System status",-1)),fat=oe(()=>u("div",{class:"mr-2"},"|",-1)),mat={class:"text-base font-semibold cursor-pointer select-none items-center"},gat={class:"flex gap-2 items-center"},bat={key:0},Eat=["src"],vat={class:"font-bold font-large text-lg"},yat={key:1},Sat={class:"flex gap-2 items-center"},Tat=["src"],xat={class:"font-bold font-large text-lg"},Cat=oe(()=>u("i",{"data-feather":"cpu",title:"CPU Ram",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),Rat={class:"font-bold font-large text-lg"},Aat=oe(()=>u("i",{"data-feather":"hard-drive",title:"Hard drive",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),wat={class:"font-bold font-large text-lg"},Nat={class:"mb-2"},Oat=oe(()=>u("label",{class:"flex items-center gap-1 ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},[u("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[u("path",{fill:"currentColor",d:"M17 17H7V7h10m4 4V9h-2V7a2 2 0 0 0-2-2h-2V3h-2v2h-2V3H9v2H7c-1.11 0-2 .89-2 2v2H3v2h2v2H3v2h2v2a2 2 0 0 0 2 2h2v2h2v-2h2v2h2v-2h2a2 2 0 0 0 2-2v-2h2v-2h-2v-2m-6 2h-2v-2h2m2-2H9v6h6V9Z"})]),je(" CPU Ram usage: ")],-1)),Iat={class:"flex flex-col mx-2"},Mat=oe(()=>u("b",null,"Avaliable ram: ",-1)),Dat=oe(()=>u("b",null,"Ram usage: ",-1)),kat={class:"p-2"},Lat={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},Pat={class:"mb-2"},Uat=oe(()=>u("label",{class:"flex items-center gap-1 ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},[u("i",{"data-feather":"hard-drive",class:"w-5 h-5"}),je(" Disk usage: ")],-1)),Fat={class:"flex flex-col mx-2"},Bat=oe(()=>u("b",null,"Avaliable disk space: ",-1)),Gat=oe(()=>u("b",null,"Disk usage: ",-1)),zat={class:"p-2"},Vat={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},Hat={class:"flex items-center gap-1 ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},qat=["src"],Yat={class:"flex flex-col mx-2"},$at=oe(()=>u("b",null,"Model: ",-1)),Wat=oe(()=>u("b",null,"Avaliable vram: ",-1)),Kat=oe(()=>u("b",null,"GPU usage: ",-1)),jat={class:"p-2"},Qat={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},Xat={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},Zat={class:"flex flex-row p-3"},Jat=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),elt=[Jat],tlt=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),nlt=[tlt],ilt=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Main configurations",-1)),slt={class:"flex flex-col mb-2 px-3 pb-2"},rlt={class:"expand-to-fit bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},olt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"hardware_mode",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Hardware mode:")],-1)),alt={class:"text-center items-center"},llt={class:"flex flex-row"},clt=oe(()=>u("option",{value:"cpu"},"CPU",-1)),dlt=oe(()=>u("option",{value:"cpu-noavx"},"CPU (No AVX)",-1)),ult=oe(()=>u("option",{value:"nvidia-tensorcores"},"NVIDIA (Tensor Cores)",-1)),plt=oe(()=>u("option",{value:"nvidia"},"NVIDIA",-1)),_lt=oe(()=>u("option",{value:"amd-noavx"},"AMD (No AVX)",-1)),hlt=oe(()=>u("option",{value:"amd"},"AMD",-1)),flt=oe(()=>u("option",{value:"apple-intel"},"Apple Intel",-1)),mlt=oe(()=>u("option",{value:"apple-silicon"},"Apple Silicon",-1)),glt=[clt,dlt,ult,plt,_lt,hlt,flt,mlt],blt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"discussion_db_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Database path:")],-1)),Elt={style:{width:"100%"}},vlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"copy_to_clipboard_add_all_details",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Add details to messages copied to clipboard:")],-1)),ylt={class:"flex flex-row"},Slt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"auto_show_browser",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto show browser:")],-1)),Tlt={class:"flex flex-row"},xlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"activate_debug",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate debug mode:")],-1)),Clt={class:"flex flex-row"},Rlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"debug_log_file_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Debug file path:")],-1)),Alt={class:"flex flex-row"},wlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"show_news_panel",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Show news panel:")],-1)),Nlt={class:"flex flex-row"},Olt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"auto_save",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto save:")],-1)),Ilt={class:"flex flex-row"},Mlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"auto_update",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto update:")],-1)),Dlt={class:"flex flex-row"},klt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"auto_update",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto title:")],-1)),Llt={class:"flex flex-row"},Plt={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Ult=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"user_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"User name:")],-1)),Flt={style:{width:"100%"}},Blt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"user_description",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"User description:")],-1)),Glt={style:{width:"100%"}},zlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"use_user_informations_in_discussion",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use user description in discussion:")],-1)),Vlt={style:{width:"100%"}},Hlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"use_model_name_in_discussions",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use model name in discussion:")],-1)),qlt={style:{width:"100%"}},Ylt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"user_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"User avatar:")],-1)),$lt={style:{width:"100%"}},Wlt={for:"avatar-upload"},Klt=["src"],jlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"use_user_name_in_discussions",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use User Name in discussions:")],-1)),Qlt={class:"flex flex-row"},Xlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"max_n_predict",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Maximum number of output tokens space (forces the model to have more space to speak):")],-1)),Zlt={style:{width:"100%"}},Jlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"min_n_predict",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Minimum number of output tokens space (forces the model to have more space to speak):")],-1)),ect={style:{width:"100%"}},tct={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},nct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"turn_on_code_execution",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"turn on code execution:")],-1)),ict={style:{width:"100%"}},sct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"turn_on_code_validation",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"turn on code validation (very recommended for security reasons):")],-1)),rct={style:{width:"100%"}},oct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"turn_on_setting_update_validation",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"turn on apply settings validation (very recommended for security reasons):")],-1)),act={style:{width:"100%"}},lct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"turn_on_open_file_validation",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"turn on open file/folder validation:")],-1)),cct={style:{width:"100%"}},dct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"turn_on_send_file_validation",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"turn on send file validation:")],-1)),uct={style:{width:"100%"}},pct={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},_ct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"activate_skills_lib",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate Skills library:")],-1)),hct={class:"flex flex-row"},fct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"discussion_db_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Skills library database name:")],-1)),mct={style:{width:"100%"}},gct={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},bct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"activate_internet_search",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate internet search:")],-1)),Ect={class:"flex flex-row"},vct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"internet_quick_search",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate quick search:")],-1)),yct={class:"flex flex-row"},Sct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"internet_activate_search_decision",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate search decision:")],-1)),Tct={class:"flex flex-row"},xct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"internet_vectorization_chunk_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Internet vectorization chunk size:")],-1)),Cct={class:"flex flex-col"},Rct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"internet_vectorization_overlap_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Internet vectorization overlap size:")],-1)),Act={class:"flex flex-col"},wct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"internet_vectorization_nb_chunks",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Internet vectorization number of chunks:")],-1)),Nct={class:"flex flex-col"},Oct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"internet_nb_search_pages",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Internet number of search pages:")],-1)),Ict={class:"flex flex-col"},Mct={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Dct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"pdf_latex_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"PDF LaTeX path:")],-1)),kct={class:"flex flex-row"},Lct={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Pct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"positive_boost",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Positive Boost:")],-1)),Uct={class:"flex flex-row"},Fct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"negative_boost",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Negative Boost:")],-1)),Bct={class:"flex flex-row"},Gct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"force_output_language_to_be",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Force AI to answer in this language:")],-1)),zct={class:"flex flex-row"},Vct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"fun_mode",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Fun mode:")],-1)),Hct={class:"flex flex-row"},qct={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Yct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"whisper_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Whisper model:")],-1)),$ct={class:"flex flex-row"},Wct=["value"],Kct={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},jct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"activate_audio_infos",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate audio infos:")],-1)),Qct={class:"flex flex-row"},Xct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"audio_auto_send_input",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Send audio input automatically:")],-1)),Zct={class:"flex flex-row"},Jct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"auto_speak",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable auto speak:")],-1)),edt={class:"flex flex-row"},tdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"audio_pitch",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"audio pitch:")],-1)),ndt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"audio_silenceTimer",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"audio in silence timer (ms):")],-1)),idt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"audio_in_language",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Input Audio Language:")],-1)),sdt=["value"],rdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"audio_out_voice",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Output Audio Voice:")],-1)),odt=["value"],adt={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},ldt={class:"flex flex-row p-3"},cdt=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),ddt=[cdt],udt=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),pdt=[udt],_dt=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Data management settings",-1)),hdt={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},fdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"summerize_discussion",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate Continuous Learning from discussions:")],-1)),mdt={class:"flex flex-row"},gdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_visualize_on_vectorization",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"show vectorized data:")],-1)),bdt={class:"flex flex-row"},Edt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_build_keys_words",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Reformulate prompt before querying database (advised):")],-1)),vdt={class:"flex flex-row"},ydt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_force_first_chunk",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Force adding the first chunk of the file to the context:")],-1)),Sdt={class:"flex flex-row"},Tdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_put_chunk_informations_into_context",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Put Chunk Information Into Context:")],-1)),xdt={class:"flex flex-row"},Cdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_method",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization method:")],-1)),Rdt=oe(()=>u("option",{value:"tfidf_vectorizer"},"tfidf Vectorizer",-1)),Adt=oe(()=>u("option",{value:"bm25_vectorizer"},"bm25 Vectorizer",-1)),wdt=oe(()=>u("option",{value:"model_embedding"},"Model Embedding",-1)),Ndt=oe(()=>u("option",{value:"sentense_transformer"},"Sentense Transformer",-1)),Odt=[Rdt,Adt,wdt,Ndt],Idt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_sentense_transformer_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization model (for Sentense Transformer):")],-1)),Mdt={style:{width:"100%"}},Ddt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_visualization_method",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data visualization method:")],-1)),kdt=oe(()=>u("option",{value:"PCA"},"PCA",-1)),Ldt=oe(()=>u("option",{value:"TSNE"},"TSNE",-1)),Pdt=[kdt,Ldt],Udt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_save_db",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Save the new files to the database (The database wil always grow and continue to be the same over many sessions):")],-1)),Fdt={class:"flex flex-row"},Bdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_chunk_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization chunk size(tokens):")],-1)),Gdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_overlap_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization overlap size(tokens):")],-1)),zdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_overlap_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Number of chunks to use for each message:")],-1)),Vdt={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},Hdt={class:"flex flex-row p-3"},qdt=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),Ydt=[qdt],$dt=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),Wdt=[$dt],Kdt=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Servers configurations",-1)),jdt={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Qdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"host",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Host:")],-1)),Xdt={style:{width:"100%"}},Zdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"discussion_db_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Port:")],-1)),Jdt={style:{width:"100%"}},eut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"discussion_db_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate headless server mode (deactivates all code exectuion to protect the PC from attacks):")],-1)),tut={style:{width:"100%"}},nut={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},iut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"enable_sd_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable sd service:")],-1)),sut={class:"flex flex-row"},rut=oe(()=>u("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),out=[rut],aut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"install_sd_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install SD service:")],-1)),lut={class:"flex flex-row"},cut=oe(()=>u("a",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",href:"https://github.com/ParisNeo/stable-diffusion-webui/blob/master/LICENSE.txt",target:"_blank"},"automatic1111's sd licence",-1)),dut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"sd_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"sd base url:")],-1)),uut={class:"flex flex-row"},put={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},_ut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"enable_comfyui_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable comfyui service:")],-1)),hut={class:"flex flex-row"},fut=oe(()=>u("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),mut=[fut],gut=oe(()=>u("td",{style:{"min-width":"200px"}},null,-1)),but={class:"flex flex-row"},Eut=oe(()=>u("a",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",href:"https://github.com/ParisNeo/ComfyUI/blob/master/LICENSE",target:"_blank"},"comfyui licence",-1)),vut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"comfyui_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"comfyui base url:")],-1)),yut={class:"flex flex-row"},Sut={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Tut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"enable_sd_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable Motion Ctrl service:")],-1)),xut={class:"flex flex-row"},Cut=oe(()=>u("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),Rut=[Cut],Aut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"install_sd_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install Motion Ctrl service:")],-1)),wut={class:"flex flex-row"},Nut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"sd_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"sd base url:")],-1)),Out={class:"flex flex-row"},Iut={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Mut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"enable_ollama_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable ollama service:")],-1)),Dut={class:"flex flex-row"},kut=oe(()=>u("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),Lut=[kut],Put=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"ollama_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install Ollama service:")],-1)),Uut={class:"flex flex-row"},Fut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"ollama_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"ollama base url:")],-1)),But={class:"flex flex-row"},Gut={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},zut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"enable_vllm_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable vLLM service:")],-1)),Vut={class:"flex flex-row"},Hut=oe(()=>u("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),qut=[Hut],Yut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"vllm_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install vLLM service:")],-1)),$ut={class:"flex flex-row"},Wut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"vllm_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"vllm base url:")],-1)),Kut={class:"flex flex-row"},jut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"vllm_gpu_memory_utilization",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"gpu memory utilization:")],-1)),Qut={class:"flex flex-col align-bottom"},Xut={class:"relative"},Zut=oe(()=>u("p",{class:"absolute left-0 mt-6"},[u("label",{for:"vllm_gpu_memory_utilization",class:"text-sm font-medium"}," vllm gpu memory utilization: ")],-1)),Jut={class:"absolute right-0"},ept=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"vllm_max_num_seqs",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"vllm max num seqs:")],-1)),tpt={class:"flex flex-row"},npt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"vllm_max_model_len",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"max model len:")],-1)),ipt={class:"flex flex-row"},spt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"vllm_model_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"vllm model path:")],-1)),rpt={class:"flex flex-row"},opt={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},apt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"enable_petals_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable petals service:")],-1)),lpt={class:"flex flex-row"},cpt=oe(()=>u("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),dpt=[cpt],upt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"petals_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install Petals service:")],-1)),ppt={class:"flex flex-row"},_pt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"petals_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"petals base url:")],-1)),hpt={class:"flex flex-row"},fpt={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},mpt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"enable_voice_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable elastic search service:")],-1)),gpt={class:"flex flex-row"},bpt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"install_elastic_search_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Reinstall Elastic Search service:")],-1)),Ept={class:"flex flex-row"},vpt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"elastic_search_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"elastic search base url:")],-1)),ypt={class:"flex flex-row"},Spt={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Tpt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"enable_voice_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable voice service:")],-1)),xpt={class:"flex flex-row"},Cpt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"install_xtts_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"xTTS service:")],-1)),Rpt={class:"flex flex-row"},Apt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"xtts_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"xtts base url:")],-1)),wpt={class:"flex flex-row"},Npt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"current_language",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Current language:")],-1)),Opt={class:"flex flex-row"},Ipt=["disabled"],Mpt=["value"],Dpt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"current_voice",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Current voice:")],-1)),kpt={class:"flex flex-row"},Lpt=["disabled"],Ppt=["value"],Upt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"auto_read",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable auto read:")],-1)),Fpt={class:"flex flex-row"},Bpt=["disabled"],Gpt={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},zpt={class:"flex flex-row p-3"},Vpt=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),Hpt=[Vpt],qpt=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),Ypt=[qpt],$pt=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Binding zoo",-1)),Wpt={key:0,class:"text-base text-red-600 flex gap-3 items-center mr-2"},Kpt=oe(()=>u("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),jpt={key:1,class:"mr-2"},Qpt={key:2,class:"text-base font-semibold cursor-pointer select-none items-center"},Xpt={class:"flex gap-1 items-center"},Zpt=["src"],Jpt={class:"font-bold font-large text-lg line-clamp-1"},e_t={key:0,class:"mb-2"},t_t={for:"binding",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},n_t=oe(()=>u("i",{"data-feather":"chevron-up"},null,-1)),i_t=[n_t],s_t=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),r_t=[s_t],o_t={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},a_t={class:"flex flex-row p-3"},l_t=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),c_t=[l_t],d_t=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),u_t=[d_t],p_t=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Models zoo",-1)),__t={class:"flex flex-row items-center"},h_t={key:0,class:"text-base text-red-600 flex gap-3 items-center mr-2"},f_t=oe(()=>u("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),m_t={key:1,class:"text-base text-red-600 flex gap-3 items-center mr-2"},g_t=oe(()=>u("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),b_t={key:2,class:"mr-2"},E_t={key:3,class:"text-base font-semibold cursor-pointer select-none items-center"},v_t={class:"flex gap-1 items-center"},y_t=["src"],S_t={class:"font-bold font-large text-lg line-clamp-1"},T_t={class:"mx-2 mb-4"},x_t={class:"relative"},C_t={class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},R_t={key:0},A_t=oe(()=>u("div",{role:"status"},[u("svg",{"aria-hidden":"true",class:"inline w-4 h-4 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),u("span",{class:"sr-only"},"Loading...")],-1)),w_t=[A_t],N_t={key:1},O_t=oe(()=>u("svg",{"aria-hidden":"true",class:"w-5 h-5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1)),I_t=[O_t],M_t=oe(()=>u("label",{for:"only_installed"},"Show only installed models",-1)),D_t=oe(()=>u("a",{href:"https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard",target:"_blank",class:"mb-4 font-bold underline text-blue-500 pb-4"},"Hugging face Leaderboard",-1)),k_t={key:0,role:"status",class:"text-center w-full display: flex;align-items: center;"},L_t=oe(()=>u("svg",{"aria-hidden":"true",class:"text-center w-full display: flex;align-items: center; h-20 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1)),P_t=oe(()=>u("p",{class:"heartbeat-text"},"Loading models Zoo",-1)),U_t=[L_t,P_t],F_t={key:1,class:"mb-2"},B_t={for:"model",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},G_t=oe(()=>u("i",{"data-feather":"chevron-up"},null,-1)),z_t=[G_t],V_t=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),H_t=[V_t],q_t={class:"mb-2"},Y_t={class:"p-2"},$_t={class:"mb-3"},W_t=oe(()=>u("label",{class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},"Create a reference from local file path:",-1)),K_t={key:0},j_t={class:"mb-3"},Q_t=oe(()=>u("label",{class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},"Download from web:",-1)),X_t={key:1,class:"relative flex flex-col items-center justify-center flex-grow h-full"},Z_t=oe(()=>u("div",{role:"status",class:"justify-center"},null,-1)),J_t={class:"relative flex flex-row flex-grow items-center w-full h-full bottom-0"},eht={class:"w-full p-2"},tht={class:"flex justify-between mb-1"},nht=zu(' Downloading Loading...',1),iht={class:"text-sm font-medium text-blue-700 dark:text-white"},sht=["title"],rht={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},oht={class:"flex justify-between mb-1"},aht={class:"text-base font-medium text-blue-700 dark:text-white"},lht={class:"text-sm font-medium text-blue-700 dark:text-white"},cht={class:"flex flex-grow"},dht={class:"flex flex-row flex-grow gap-3"},uht={class:"p-2 text-center grow"},pht={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},_ht={class:"flex flex-row p-3 items-center"},hht=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),fht=[hht],mht=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),ght=[mht],bht=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Personalities zoo",-1)),Eht={key:0,class:"mr-2"},vht={class:"mr-2 font-bold font-large text-lg line-clamp-1"},yht={key:1,class:"mr-2"},Sht={key:2,class:"text-base font-semibold cursor-pointer select-none items-center flex flex-row"},Tht={key:0,class:"flex -space-x-4 items-center"},xht={class:"group items-center flex flex-row"},Cht=["onClick"],Rht=["src","title"],Aht=["onClick"],wht=oe(()=>u("span",{class:"hidden group-hover:block top-0 left-7 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2 border-transparent",title:"Unmount personality"},[u("svg",{"aria-hidden":"true",class:"w-4 h-4 text-red-600 hover:text-red-500",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})])],-1)),Nht=[wht],Oht=oe(()=>u("svg",{"aria-hidden":"true",class:"w-4 h-4 text-red-600 hover:text-red-500",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)),Iht=[Oht],Mht={class:"mx-2 mb-4"},Dht=oe(()=>u("label",{for:"personality-search",class:"mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white"},"Search",-1)),kht={class:"relative"},Lht={class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},Pht={key:0},Uht=oe(()=>u("div",{role:"status"},[u("svg",{"aria-hidden":"true",class:"inline w-4 h-4 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),u("span",{class:"sr-only"},"Loading...")],-1)),Fht=[Uht],Bht={key:1},Ght=oe(()=>u("svg",{"aria-hidden":"true",class:"w-5 h-5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1)),zht=[Ght],Vht={key:0,class:"mx-2 mb-4"},Hht={for:"persCat",class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},qht=["selected"],Yht={key:0,class:"mb-2"},$ht={for:"model",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},Wht=oe(()=>u("i",{"data-feather":"chevron-up"},null,-1)),Kht=[Wht],jht=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),Qht=[jht],Xht={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},Zht={class:"flex flex-row p-3 items-center"},Jht=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),eft=[Jht],tft=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),nft=[tft],ift=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Extensions zoo",-1)),sft={key:0,class:"mr-2"},rft={key:1,class:"text-base font-semibold cursor-pointer select-none items-center flex flex-row"},oft={key:0,class:"flex -space-x-4 items-center"},aft={class:"group items-center flex flex-row"},lft=["src","title"],cft=["onClick"],dft=oe(()=>u("span",{class:"hidden group-hover:block top-0 left-7 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2 border-transparent",title:"Unmount personality"},[u("svg",{"aria-hidden":"true",class:"w-4 h-4 text-red-600 hover:text-red-500",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})])],-1)),uft=[dft],pft={class:"mx-2 mb-4"},_ft=oe(()=>u("label",{for:"personality-search",class:"mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white"},"Search",-1)),hft={class:"relative"},fft={class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},mft={key:0},gft=oe(()=>u("div",{role:"status"},[u("svg",{"aria-hidden":"true",class:"inline w-4 h-4 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),u("span",{class:"sr-only"},"Loading...")],-1)),bft=[gft],Eft={key:1},vft=oe(()=>u("svg",{"aria-hidden":"true",class:"w-5 h-5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1)),yft=[vft],Sft={key:0,class:"mx-2 mb-4"},Tft={for:"extCat",class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},xft=["selected"],Cft={key:0,class:"mb-2"},Rft={for:"model",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},Aft=oe(()=>u("i",{"data-feather":"chevron-up"},null,-1)),wft=[Aft],Nft=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),Oft=[Nft],Ift={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},Mft={class:"flex flex-row p-3 items-center"},Dft=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),kft=[Dft],Lft=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),Pft=[Lft],Uft=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Mounted Extensions Priority",-1)),Fft={class:"flex flex-col mb-2 p-3 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},Bft={class:"flex flex-row"},Gft=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),zft=[Gft],Vft=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),Hft=[Vft],qft=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none"}," Model Configuration",-1)),Yft={class:"m-2"},$ft={class:"flex flex-row gap-2 items-center"},Wft=oe(()=>u("label",{for:"override-model-parameters",class:"block text-sm font-medium"}," Override personality model parameters ",-1)),Kft={class:"m-2"},jft=oe(()=>u("label",{for:"seed",class:"block mb-2 text-sm font-medium"}," Seed: ",-1)),Qft={class:"m-2"},Xft={class:"flex flex-col align-bottom"},Zft={class:"relative"},Jft=oe(()=>u("p",{class:"absolute left-0 mt-6"},[u("label",{for:"temperature",class:"text-sm font-medium"}," Temperature: ")],-1)),emt={class:"absolute right-0"},tmt={class:"m-2"},nmt={class:"flex flex-col align-bottom"},imt={class:"relative"},smt=oe(()=>u("p",{class:"absolute left-0 mt-6"},[u("label",{for:"predict",class:"text-sm font-medium"}," N Predict: ")],-1)),rmt={class:"absolute right-0"},omt={class:"m-2"},amt={class:"flex flex-col align-bottom"},lmt={class:"relative"},cmt=oe(()=>u("p",{class:"absolute left-0 mt-6"},[u("label",{for:"top_k",class:"text-sm font-medium"}," Top-K: ")],-1)),dmt={class:"absolute right-0"},umt={class:"m-2"},pmt={class:"flex flex-col align-bottom"},_mt={class:"relative"},hmt=oe(()=>u("p",{class:"absolute left-0 mt-6"},[u("label",{for:"top_p",class:"text-sm font-medium"}," Top-P: ")],-1)),fmt={class:"absolute right-0"},mmt={class:"m-2"},gmt={class:"flex flex-col align-bottom"},bmt={class:"relative"},Emt=oe(()=>u("p",{class:"absolute left-0 mt-6"},[u("label",{for:"repeat_penalty",class:"text-sm font-medium"}," Repeat penalty: ")],-1)),vmt={class:"absolute right-0"},ymt={class:"m-2"},Smt={class:"flex flex-col align-bottom"},Tmt={class:"relative"},xmt=oe(()=>u("p",{class:"absolute left-0 mt-6"},[u("label",{for:"repeat_last_n",class:"text-sm font-medium"}," Repeat last N: ")],-1)),Cmt={class:"absolute right-0"};function Rmt(n,e,t,i,s,r){const o=ht("Card"),a=ht("BindingEntry"),l=ht("RadioOptions"),d=ht("model-entry"),c=ht("personality-entry"),_=ht("ExtensionEntry"),f=ht("AddModelDialog"),m=ht("ChoiceDialog");return w(),M($e,null,[u("div",Iot,[u("div",Mot,[s.showConfirmation?(w(),M("div",Dot,[u("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel",type:"button",onClick:e[0]||(e[0]=Te(h=>s.showConfirmation=!1,["stop"]))},Lot),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm save changes",type:"button",onClick:e[1]||(e[1]=Te(h=>r.save_configuration(),["stop"]))},Uot)])):q("",!0),s.showConfirmation?q("",!0):(w(),M("div",Fot,[u("button",{title:"Save configuration",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[2]||(e[2]=h=>s.showConfirmation=!0)},Got),u("button",{title:"Reset configuration",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[3]||(e[3]=h=>r.reset_configuration())},Vot),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Collapse / Expand all panels",type:"button",onClick:e[4]||(e[4]=Te(h=>s.all_collapsed=!s.all_collapsed,["stop"]))},qot)])),u("div",Yot,[u("button",{title:"Clear uploads",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[5]||(e[5]=h=>r.api_get_req("clear_uploads").then(E=>{E.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast(["failed!"],4,!1)}))},Wot),u("button",{title:"Restart program",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[6]||(e[6]=h=>r.api_get_req("restart_program").then(E=>{E.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast(["failed!"],4,!1)}))},jot),u("button",{title:"Upgrade program ",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[7]||(e[7]=h=>r.api_get_req("update_software").then(E=>{E.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast("Success!",4,!0)}))},[Qot,s.has_updates?(w(),M("div",Xot,Jot)):q("",!0)]),u("div",eat,[s.settingsChanged?(w(),M("div",tat,[nat,s.isLoading?q("",!0):(w(),M("button",{key:0,class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Apply changes",type:"button",onClick:e[8]||(e[8]=Te(h=>r.applyConfiguration(),["stop"]))},sat))])):q("",!0),s.isLoading?(w(),M("div",rat,[u("p",null,fe(s.loading_text),1),oat,aat])):q("",!0)])])]),u("div",{class:Ye(s.isLoading?"pointer-events-none opacity-30 w-full":"w-full")},[u("div",lat,[u("div",cat,[u("button",{onClick:e[9]||(e[9]=Te(h=>s.sc_collapsed=!s.sc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[ne(u("div",null,uat,512),[[Ot,s.sc_collapsed]]),ne(u("div",null,_at,512),[[Ot,!s.sc_collapsed]]),hat,fat,u("div",mat,[u("div",gat,[u("div",null,[r.vramUsage&&r.vramUsage.gpus&&r.vramUsage.gpus.length==1?(w(),M("div",bat,[(w(!0),M($e,null,ct(r.vramUsage.gpus,h=>(w(),M("div",{class:"flex gap-2 items-center",key:h},[u("img",{src:s.SVGGPU,width:"25",height:"25"},null,8,Eat),u("h3",vat,[u("div",null,fe(r.computedFileSize(h.used_vram))+" / "+fe(r.computedFileSize(h.total_vram))+" ("+fe(h.percentage)+"%) ",1)])]))),128))])):q("",!0),r.vramUsage&&r.vramUsage.gpus&&r.vramUsage.gpus.length>1?(w(),M("div",yat,[u("div",Sat,[u("img",{src:s.SVGGPU,width:"25",height:"25"},null,8,Tat),u("h3",xat,[u("div",null,fe(r.vramUsage.gpus.length)+"x ",1)])])])):q("",!0)]),Cat,u("h3",Rat,[u("div",null,fe(r.ram_usage)+" / "+fe(r.ram_total_space)+" ("+fe(r.ram_percent_usage)+"%)",1)]),Aat,u("h3",wat,[u("div",null,fe(r.disk_binding_models_usage)+" / "+fe(r.disk_total_space)+" ("+fe(r.disk_percent_usage)+"%)",1)])])])])]),u("div",{class:Ye([{hidden:s.sc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[u("div",Nat,[Oat,u("div",Iat,[u("div",null,[Mat,je(fe(r.ram_available_space),1)]),u("div",null,[Dat,je(" "+fe(r.ram_usage)+" / "+fe(r.ram_total_space)+" ("+fe(r.ram_percent_usage)+")% ",1)])]),u("div",kat,[u("div",Lat,[u("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en("width: "+r.ram_percent_usage+"%;")},null,4)])])]),u("div",Pat,[Uat,u("div",Fat,[u("div",null,[Bat,je(fe(r.disk_available_space),1)]),u("div",null,[Gat,je(" "+fe(r.disk_binding_models_usage)+" / "+fe(r.disk_total_space)+" ("+fe(r.disk_percent_usage)+"%)",1)])]),u("div",zat,[u("div",Vat,[u("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en("width: "+r.disk_percent_usage+"%;")},null,4)])])]),(w(!0),M($e,null,ct(r.vramUsage.gpus,h=>(w(),M("div",{class:"mb-2",key:h},[u("label",Hat,[u("img",{src:s.SVGGPU,width:"25",height:"25"},null,8,qat),je(" GPU usage: ")]),u("div",Yat,[u("div",null,[$at,je(fe(h.gpu_model),1)]),u("div",null,[Wat,je(fe(this.computedFileSize(h.available_space)),1)]),u("div",null,[Kat,je(" "+fe(this.computedFileSize(h.used_vram))+" / "+fe(this.computedFileSize(h.total_vram))+" ("+fe(h.percentage)+"%)",1)])]),u("div",jat,[u("div",Qat,[u("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en("width: "+h.percentage+"%;")},null,4)])])]))),128))],2)]),u("div",Xat,[u("div",Zat,[u("button",{onClick:e[10]||(e[10]=Te(h=>s.minconf_collapsed=!s.minconf_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[ne(u("div",null,elt,512),[[Ot,s.minconf_collapsed]]),ne(u("div",null,nlt,512),[[Ot,!s.minconf_collapsed]]),ilt])]),u("div",{class:Ye([{hidden:s.minconf_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[u("div",slt,[Oe(o,{title:"General",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",rlt,[u("tr",null,[olt,u("td",alt,[u("div",llt,[ne(u("select",{id:"hardware_mode",required:"","onUpdate:modelValue":e[11]||(e[11]=h=>r.configFile.hardware_mode=h),onChange:e[12]||(e[12]=h=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},glt,544),[[zn,r.configFile.hardware_mode]])])])]),u("tr",null,[blt,u("td",Elt,[ne(u("input",{type:"text",id:"discussion_db_name",required:"","onUpdate:modelValue":e[13]||(e[13]=h=>r.configFile.discussion_db_name=h),onChange:e[14]||(e[14]=h=>s.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Pe,r.configFile.discussion_db_name]])])]),u("tr",null,[vlt,u("td",null,[u("div",ylt,[ne(u("input",{type:"checkbox",id:"copy_to_clipboard_add_all_details",required:"","onUpdate:modelValue":e[15]||(e[15]=h=>r.configFile.copy_to_clipboard_add_all_details=h),onChange:e[16]||(e[16]=h=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.copy_to_clipboard_add_all_details]])])])]),u("tr",null,[Slt,u("td",null,[u("div",Tlt,[ne(u("input",{type:"checkbox",id:"auto_show_browser",required:"","onUpdate:modelValue":e[17]||(e[17]=h=>r.configFile.auto_show_browser=h),onChange:e[18]||(e[18]=h=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.auto_show_browser]])])])]),u("tr",null,[xlt,u("td",null,[u("div",Clt,[ne(u("input",{type:"checkbox",id:"activate_debug",required:"","onUpdate:modelValue":e[19]||(e[19]=h=>r.configFile.debug=h),onChange:e[20]||(e[20]=h=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.debug]])])])]),u("tr",null,[Rlt,u("td",null,[u("div",Alt,[ne(u("input",{type:"text",id:"debug_log_file_path",required:"","onUpdate:modelValue":e[21]||(e[21]=h=>r.configFile.debug_log_file_path=h),onChange:e[22]||(e[22]=h=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.debug_log_file_path]])])])]),u("tr",null,[wlt,u("td",null,[u("div",Nlt,[ne(u("input",{type:"checkbox",id:"show_news_panel",required:"","onUpdate:modelValue":e[23]||(e[23]=h=>r.configFile.show_news_panel=h),onChange:e[24]||(e[24]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.show_news_panel]])])])]),u("tr",null,[Olt,u("td",null,[u("div",Ilt,[ne(u("input",{type:"checkbox",id:"auto_save",required:"","onUpdate:modelValue":e[25]||(e[25]=h=>r.configFile.auto_save=h),onChange:e[26]||(e[26]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.auto_save]])])])]),u("tr",null,[Mlt,u("td",null,[u("div",Dlt,[ne(u("input",{type:"checkbox",id:"auto_update",required:"","onUpdate:modelValue":e[27]||(e[27]=h=>r.configFile.auto_update=h),onChange:e[28]||(e[28]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.auto_update]])])])]),u("tr",null,[klt,u("td",null,[u("div",Llt,[ne(u("input",{type:"checkbox",id:"auto_title",required:"","onUpdate:modelValue":e[29]||(e[29]=h=>r.configFile.auto_title=h),onChange:e[30]||(e[30]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.auto_title]])])])])])]),_:1}),Oe(o,{title:"User",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",Plt,[u("tr",null,[Ult,u("td",Flt,[ne(u("input",{type:"text",id:"user_name",required:"","onUpdate:modelValue":e[31]||(e[31]=h=>r.configFile.user_name=h),onChange:e[32]||(e[32]=h=>s.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.user_name]])])]),u("tr",null,[Blt,u("td",Glt,[ne(u("textarea",{id:"user_description",required:"","onUpdate:modelValue":e[33]||(e[33]=h=>r.configFile.user_description=h),onChange:e[34]||(e[34]=h=>s.settingsChanged=!0),class:"min-h-[500px] w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.user_description]])])]),u("tr",null,[zlt,u("td",Vlt,[ne(u("input",{type:"checkbox",id:"use_user_informations_in_discussion",required:"","onUpdate:modelValue":e[35]||(e[35]=h=>r.configFile.use_user_informations_in_discussion=h),onChange:e[36]||(e[36]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.use_user_informations_in_discussion]])])]),u("tr",null,[Hlt,u("td",qlt,[ne(u("input",{type:"checkbox",id:"use_model_name_in_discussions",required:"","onUpdate:modelValue":e[37]||(e[37]=h=>r.configFile.use_model_name_in_discussions=h),onChange:e[38]||(e[38]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.use_model_name_in_discussions]])])]),u("tr",null,[Ylt,u("td",$lt,[u("label",Wlt,[u("img",{src:"/user_infos/"+r.configFile.user_avatar,class:"w-50 h-50 rounded-full",style:{"max-width":"50px","max-height":"50px",cursor:"pointer"}},null,8,Klt)]),u("input",{type:"file",id:"avatar-upload",style:{display:"none"},onChange:e[39]||(e[39]=(...h)=>r.uploadAvatar&&r.uploadAvatar(...h))},null,32)])]),u("tr",null,[jlt,u("td",null,[u("div",Qlt,[ne(u("input",{type:"checkbox",id:"use_user_name_in_discussions",required:"","onUpdate:modelValue":e[40]||(e[40]=h=>r.configFile.use_user_name_in_discussions=h),onChange:e[41]||(e[41]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.use_user_name_in_discussions]])])])]),u("tr",null,[Xlt,u("td",Zlt,[ne(u("input",{type:"number",id:"max_n_predict",required:"","onUpdate:modelValue":e[42]||(e[42]=h=>r.configFile.min_n_predict=h),onChange:e[43]||(e[43]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.min_n_predict]])])]),u("tr",null,[Jlt,u("td",ect,[ne(u("input",{type:"number",id:"min_n_predict",required:"","onUpdate:modelValue":e[44]||(e[44]=h=>r.configFile.min_n_predict=h),onChange:e[45]||(e[45]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.min_n_predict]])])])])]),_:1}),Oe(o,{title:"Security settings",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",tct,[u("tr",null,[nct,u("td",ict,[ne(u("input",{type:"checkbox",id:"turn_on_code_execution",required:"","onUpdate:modelValue":e[46]||(e[46]=h=>r.configFile.turn_on_code_execution=h),onChange:e[47]||(e[47]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.turn_on_code_execution]])])]),u("tr",null,[sct,u("td",rct,[ne(u("input",{type:"checkbox",id:"turn_on_code_validation",required:"","onUpdate:modelValue":e[48]||(e[48]=h=>r.configFile.turn_on_code_validation=h),onChange:e[49]||(e[49]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.turn_on_code_validation]])])]),u("tr",null,[oct,u("td",act,[ne(u("input",{type:"checkbox",id:"turn_on_setting_update_validation",required:"","onUpdate:modelValue":e[50]||(e[50]=h=>r.configFile.turn_on_setting_update_validation=h),onChange:e[51]||(e[51]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.turn_on_setting_update_validation]])])]),u("tr",null,[lct,u("td",cct,[ne(u("input",{type:"checkbox",id:"turn_on_open_file_validation",required:"","onUpdate:modelValue":e[52]||(e[52]=h=>r.configFile.turn_on_open_file_validation=h),onChange:e[53]||(e[53]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.turn_on_open_file_validation]])])]),u("tr",null,[dct,u("td",uct,[ne(u("input",{type:"checkbox",id:"turn_on_send_file_validation",required:"","onUpdate:modelValue":e[54]||(e[54]=h=>r.configFile.turn_on_send_file_validation=h),onChange:e[55]||(e[55]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.turn_on_send_file_validation]])])])])]),_:1}),Oe(o,{title:"Knowledge database",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",pct,[u("tr",null,[_ct,u("td",null,[u("div",hct,[ne(u("input",{type:"checkbox",id:"activate_skills_lib",required:"","onUpdate:modelValue":e[56]||(e[56]=h=>r.configFile.activate_skills_lib=h),onChange:e[57]||(e[57]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.activate_skills_lib]])])])]),u("tr",null,[fct,u("td",mct,[ne(u("input",{type:"text",id:"skills_lib_database_name",required:"","onUpdate:modelValue":e[58]||(e[58]=h=>r.configFile.skills_lib_database_name=h),onChange:e[59]||(e[59]=h=>s.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Pe,r.configFile.skills_lib_database_name]])])])])]),_:1}),Oe(o,{title:"Internet search",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",gct,[u("tr",null,[bct,u("td",null,[u("div",Ect,[ne(u("input",{type:"checkbox",id:"fun_mode",required:"","onUpdate:modelValue":e[60]||(e[60]=h=>r.configFile.activate_internet_search=h),onChange:e[61]||(e[61]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.activate_internet_search]])])])]),u("tr",null,[vct,u("td",null,[u("div",yct,[ne(u("input",{type:"checkbox",id:"internet_quick_search",required:"","onUpdate:modelValue":e[62]||(e[62]=h=>r.configFile.internet_quick_search=h),onChange:e[63]||(e[63]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.internet_quick_search]])])])]),u("tr",null,[Sct,u("td",null,[u("div",Tct,[ne(u("input",{type:"checkbox",id:"internet_activate_search_decision",required:"","onUpdate:modelValue":e[64]||(e[64]=h=>r.configFile.internet_activate_search_decision=h),onChange:e[65]||(e[65]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.internet_activate_search_decision]])])])]),u("tr",null,[xct,u("td",null,[u("div",Cct,[ne(u("input",{id:"internet_vectorization_chunk_size","onUpdate:modelValue":e[66]||(e[66]=h=>r.configFile.internet_vectorization_chunk_size=h),onChange:e[67]||(e[67]=h=>s.settingsChanged=!0),type:"range",min:"0",max:"64000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.internet_vectorization_chunk_size]]),ne(u("input",{"onUpdate:modelValue":e[68]||(e[68]=h=>r.configFile.internet_vectorization_chunk_size=h),type:"number",onChange:e[69]||(e[69]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.internet_vectorization_chunk_size]])])])]),u("tr",null,[Rct,u("td",null,[u("div",Act,[ne(u("input",{id:"internet_vectorization_overlap_size","onUpdate:modelValue":e[70]||(e[70]=h=>r.configFile.internet_vectorization_overlap_size=h),onChange:e[71]||(e[71]=h=>s.settingsChanged=!0),type:"range",min:"0",max:"1000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.internet_vectorization_overlap_size]]),ne(u("input",{"onUpdate:modelValue":e[72]||(e[72]=h=>r.configFile.internet_vectorization_overlap_size=h),type:"number",onChange:e[73]||(e[73]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.internet_vectorization_overlap_size]])])])]),u("tr",null,[wct,u("td",null,[u("div",Nct,[ne(u("input",{id:"internet_vectorization_nb_chunks","onUpdate:modelValue":e[74]||(e[74]=h=>r.configFile.internet_vectorization_nb_chunks=h),onChange:e[75]||(e[75]=h=>s.settingsChanged=!0),type:"range",min:"0",max:"100",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.internet_vectorization_nb_chunks]]),ne(u("input",{"onUpdate:modelValue":e[76]||(e[76]=h=>r.configFile.internet_vectorization_nb_chunks=h),type:"number",onChange:e[77]||(e[77]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.internet_vectorization_nb_chunks]])])])]),u("tr",null,[Oct,u("td",null,[u("div",Ict,[ne(u("input",{id:"internet_nb_search_pages","onUpdate:modelValue":e[78]||(e[78]=h=>r.configFile.internet_nb_search_pages=h),onChange:e[79]||(e[79]=h=>s.settingsChanged=!0),type:"range",min:"1",max:"100",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.internet_nb_search_pages]]),ne(u("input",{"onUpdate:modelValue":e[80]||(e[80]=h=>r.configFile.internet_nb_search_pages=h),type:"number",onChange:e[81]||(e[81]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.internet_nb_search_pages]])])])])])]),_:1}),Oe(o,{title:"Latex",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",Mct,[u("tr",null,[Dct,u("td",null,[u("div",kct,[ne(u("input",{type:"text",id:"pdf_latex_path",required:"","onUpdate:modelValue":e[82]||(e[82]=h=>r.configFile.pdf_latex_path=h),onChange:e[83]||(e[83]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.pdf_latex_path]])])])])])]),_:1}),Oe(o,{title:"Boost",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",Lct,[u("tr",null,[Pct,u("td",null,[u("div",Uct,[ne(u("input",{type:"text",id:"positive_boost",required:"","onUpdate:modelValue":e[84]||(e[84]=h=>r.configFile.positive_boost=h),onChange:e[85]||(e[85]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.positive_boost]])])])]),u("tr",null,[Fct,u("td",null,[u("div",Bct,[ne(u("input",{type:"text",id:"negative_boost",required:"","onUpdate:modelValue":e[86]||(e[86]=h=>r.configFile.negative_boost=h),onChange:e[87]||(e[87]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.negative_boost]])])])]),u("tr",null,[Gct,u("td",null,[u("div",zct,[ne(u("input",{type:"text",id:"force_output_language_to_be",required:"","onUpdate:modelValue":e[88]||(e[88]=h=>r.configFile.force_output_language_to_be=h),onChange:e[89]||(e[89]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.force_output_language_to_be]])])])]),u("tr",null,[Vct,u("td",null,[u("div",Hct,[ne(u("input",{type:"checkbox",id:"fun_mode",required:"","onUpdate:modelValue":e[90]||(e[90]=h=>r.configFile.fun_mode=h),onChange:e[91]||(e[91]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.fun_mode]])])])])])]),_:1}),Oe(o,{title:"Whisper audio transcription",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",qct,[u("tr",null,[Yct,u("td",null,[u("div",$ct,[ne(u("select",{id:"whisper_model","onUpdate:modelValue":e[92]||(e[92]=h=>r.configFile.whisper_model=h),onChange:e[93]||(e[93]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),M($e,null,ct(r.whisperModels,h=>(w(),M("option",{key:h,value:h},fe(h),9,Wct))),128))],544),[[zn,r.configFile.whisper_model]])])])])])]),_:1}),Oe(o,{title:"Browser Audio",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",Kct,[u("tr",null,[jct,u("td",null,[u("div",Qct,[ne(u("input",{type:"checkbox",id:"activate_audio_infos",required:"","onUpdate:modelValue":e[94]||(e[94]=h=>r.configFile.activate_audio_infos=h),onChange:e[95]||(e[95]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.activate_audio_infos]])])])]),u("tr",null,[Xct,u("td",null,[u("div",Zct,[ne(u("input",{type:"checkbox",id:"audio_auto_send_input",required:"","onUpdate:modelValue":e[96]||(e[96]=h=>r.configFile.audio_auto_send_input=h),onChange:e[97]||(e[97]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.audio_auto_send_input]])])])]),u("tr",null,[Jct,u("td",null,[u("div",edt,[ne(u("input",{type:"checkbox",id:"auto_speak",required:"","onUpdate:modelValue":e[98]||(e[98]=h=>r.configFile.auto_speak=h),onChange:e[99]||(e[99]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.auto_speak]])])])]),u("tr",null,[tdt,u("td",null,[ne(u("input",{id:"audio_pitch","onUpdate:modelValue":e[100]||(e[100]=h=>r.configFile.audio_pitch=h),onChange:e[101]||(e[101]=h=>s.settingsChanged=!0),type:"range",min:"0",max:"10",step:"0.1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.audio_pitch]]),ne(u("input",{"onUpdate:modelValue":e[102]||(e[102]=h=>r.configFile.audio_pitch=h),onChange:e[103]||(e[103]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.audio_pitch]])])]),u("tr",null,[ndt,u("td",null,[ne(u("input",{id:"audio_silenceTimer","onUpdate:modelValue":e[104]||(e[104]=h=>r.configFile.audio_silenceTimer=h),onChange:e[105]||(e[105]=h=>s.settingsChanged=!0),type:"range",min:"0",max:"10000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.audio_silenceTimer]]),ne(u("input",{"onUpdate:modelValue":e[106]||(e[106]=h=>r.configFile.audio_silenceTimer=h),onChange:e[107]||(e[107]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.audio_silenceTimer]])])]),u("tr",null,[idt,u("td",null,[ne(u("select",{id:"audio_in_language","onUpdate:modelValue":e[108]||(e[108]=h=>r.configFile.audio_in_language=h),onChange:e[109]||(e[109]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),M($e,null,ct(r.audioLanguages,h=>(w(),M("option",{key:h.code,value:h.code},fe(h.name),9,sdt))),128))],544),[[zn,r.configFile.audio_in_language]])])]),u("tr",null,[rdt,u("td",null,[ne(u("select",{id:"audio_out_voice","onUpdate:modelValue":e[110]||(e[110]=h=>r.configFile.audio_out_voice=h),onChange:e[111]||(e[111]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),M($e,null,ct(s.audioVoices,h=>(w(),M("option",{key:h.name,value:h.name},fe(h.name),9,odt))),128))],544),[[zn,r.configFile.audio_out_voice]])])])])]),_:1})])],2)]),u("div",adt,[u("div",ldt,[u("button",{onClick:e[112]||(e[112]=Te(h=>s.data_conf_collapsed=!s.data_conf_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[ne(u("div",null,ddt,512),[[Ot,s.data_conf_collapsed]]),ne(u("div",null,pdt,512),[[Ot,!s.data_conf_collapsed]]),_dt])]),u("div",{class:Ye([{hidden:s.data_conf_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[Oe(o,{title:"Data Vectorization",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",hdt,[u("tr",null,[fdt,u("td",null,[u("div",mdt,[ne(u("input",{type:"checkbox",id:"summerize_discussion",required:"","onUpdate:modelValue":e[113]||(e[113]=h=>r.configFile.summerize_discussion=h),onChange:e[114]||(e[114]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.summerize_discussion]])])])]),u("tr",null,[gdt,u("td",null,[u("div",bdt,[ne(u("input",{type:"checkbox",id:"data_vectorization_visualize_on_vectorization",required:"","onUpdate:modelValue":e[115]||(e[115]=h=>r.configFile.data_vectorization_visualize_on_vectorization=h),onChange:e[116]||(e[116]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.data_vectorization_visualize_on_vectorization]])])])]),u("tr",null,[Edt,u("td",null,[u("div",vdt,[ne(u("input",{type:"checkbox",id:"data_vectorization_build_keys_words",required:"","onUpdate:modelValue":e[117]||(e[117]=h=>r.configFile.data_vectorization_build_keys_words=h),onChange:e[118]||(e[118]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.data_vectorization_build_keys_words]])])])]),u("tr",null,[ydt,u("td",null,[u("div",Sdt,[ne(u("input",{type:"checkbox",id:"data_vectorization_force_first_chunk",required:"","onUpdate:modelValue":e[119]||(e[119]=h=>r.configFile.data_vectorization_force_first_chunk=h),onChange:e[120]||(e[120]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.data_vectorization_force_first_chunk]])])])]),u("tr",null,[Tdt,u("td",null,[u("div",xdt,[ne(u("input",{type:"checkbox",id:"data_vectorization_put_chunk_informations_into_context",required:"","onUpdate:modelValue":e[121]||(e[121]=h=>r.configFile.data_vectorization_put_chunk_informations_into_context=h),onChange:e[122]||(e[122]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.data_vectorization_put_chunk_informations_into_context]])])])]),u("tr",null,[Cdt,u("td",null,[ne(u("select",{id:"data_vectorization_method",required:"","onUpdate:modelValue":e[123]||(e[123]=h=>r.configFile.data_vectorization_method=h),onChange:e[124]||(e[124]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},Odt,544),[[zn,r.configFile.data_vectorization_method]])])]),u("tr",null,[Idt,u("td",Mdt,[ne(u("input",{type:"text",id:"data_vectorization_sentense_transformer_model",required:"","onUpdate:modelValue":e[125]||(e[125]=h=>r.configFile.data_vectorization_sentense_transformer_model=h),onChange:e[126]||(e[126]=h=>s.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Pe,r.configFile.data_vectorization_sentense_transformer_model]])])]),u("tr",null,[Ddt,u("td",null,[ne(u("select",{id:"data_visualization_method",required:"","onUpdate:modelValue":e[127]||(e[127]=h=>r.configFile.data_visualization_method=h),onChange:e[128]||(e[128]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},Pdt,544),[[zn,r.configFile.data_visualization_method]])])]),u("tr",null,[Udt,u("td",null,[u("div",Fdt,[ne(u("input",{type:"checkbox",id:"data_vectorization_save_db",required:"","onUpdate:modelValue":e[129]||(e[129]=h=>r.configFile.data_vectorization_save_db=h),onChange:e[130]||(e[130]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.data_vectorization_save_db]])])])]),u("tr",null,[Bdt,u("td",null,[ne(u("input",{id:"data_vectorization_chunk_size","onUpdate:modelValue":e[131]||(e[131]=h=>r.configFile.data_vectorization_chunk_size=h),onChange:e[132]||(e[132]=h=>s.settingsChanged=!0),type:"range",min:"0",max:"64000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.data_vectorization_chunk_size]]),ne(u("input",{"onUpdate:modelValue":e[133]||(e[133]=h=>r.configFile.data_vectorization_chunk_size=h),type:"number",onChange:e[134]||(e[134]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.data_vectorization_chunk_size]])])]),u("tr",null,[Gdt,u("td",null,[ne(u("input",{id:"data_vectorization_overlap_size","onUpdate:modelValue":e[135]||(e[135]=h=>r.configFile.data_vectorization_overlap_size=h),onChange:e[136]||(e[136]=h=>s.settingsChanged=!0),type:"range",min:"0",max:"64000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.data_vectorization_overlap_size]]),ne(u("input",{"onUpdate:modelValue":e[137]||(e[137]=h=>r.configFile.data_vectorization_overlap_size=h),type:"number",onChange:e[138]||(e[138]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.data_vectorization_overlap_size]])])]),u("tr",null,[zdt,u("td",null,[ne(u("input",{id:"data_vectorization_nb_chunks","onUpdate:modelValue":e[139]||(e[139]=h=>r.configFile.data_vectorization_nb_chunks=h),onChange:e[140]||(e[140]=h=>s.settingsChanged=!0),type:"range",min:"0",max:"1000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.data_vectorization_nb_chunks]]),ne(u("input",{"onUpdate:modelValue":e[141]||(e[141]=h=>r.configFile.data_vectorization_nb_chunks=h),type:"number",onChange:e[142]||(e[142]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.data_vectorization_nb_chunks]])])])])]),_:1})],2)]),u("div",Vdt,[u("div",Hdt,[u("button",{onClick:e[143]||(e[143]=Te(h=>s.servers_conf_collapsed=!s.servers_conf_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[ne(u("div",null,Ydt,512),[[Ot,s.servers_conf_collapsed]]),ne(u("div",null,Wdt,512),[[Ot,!s.servers_conf_collapsed]]),Kdt])]),u("div",{class:Ye([{hidden:s.servers_conf_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[Oe(o,{title:"Lollms service",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",jdt,[u("tr",null,[Qdt,u("td",Xdt,[ne(u("input",{type:"text",id:"host",required:"","onUpdate:modelValue":e[144]||(e[144]=h=>r.configFile.host=h),onChange:e[145]||(e[145]=h=>s.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Pe,r.configFile.host]])])]),u("tr",null,[Zdt,u("td",Jdt,[ne(u("input",{type:"number",step:"1",id:"port",required:"","onUpdate:modelValue":e[146]||(e[146]=h=>r.configFile.port=h),onChange:e[147]||(e[147]=h=>s.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Pe,r.configFile.port]])])]),u("tr",null,[eut,u("td",tut,[ne(u("input",{type:"checkbox",id:"headless_server_mode",required:"","onUpdate:modelValue":e[148]||(e[148]=h=>r.configFile.headless_server_mode=h),onChange:e[149]||(e[149]=h=>s.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[ut,r.configFile.headless_server_mode]])])])])]),_:1}),Oe(o,{title:"Stable diffusion service",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",nut,[u("tr",null,[iut,u("td",null,[u("div",sut,[ne(u("input",{type:"checkbox",id:"enable_sd_service",required:"","onUpdate:modelValue":e[150]||(e[150]=h=>r.configFile.enable_sd_service=h),onChange:e[151]||(e[151]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.enable_sd_service]])])]),u("td",null,[u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[152]||(e[152]=h=>this.$store.state.messageBox.showMessage("Activates Stable diffusion service. The service will be automatically loaded at startup alowing you to use the stable diffusion endpoint to generate images"))},out)])]),u("tr",null,[aut,u("td",null,[u("div",lut,[u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[153]||(e[153]=(...h)=>r.reinstallSDService&&r.reinstallSDService(...h))},"install sd service"),u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[154]||(e[154]=(...h)=>r.upgradeSDService&&r.upgradeSDService(...h))},"upgrade sd service"),u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[155]||(e[155]=(...h)=>r.startSDService&&r.startSDService(...h))},"start sd service"),u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[156]||(e[156]=(...h)=>r.showSD&&r.showSD(...h))},"show sd ui"),cut])])]),u("tr",null,[dut,u("td",null,[u("div",uut,[ne(u("input",{type:"text",id:"sd_base_url",required:"","onUpdate:modelValue":e[157]||(e[157]=h=>r.configFile.sd_base_url=h),onChange:e[158]||(e[158]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.sd_base_url]])])])])])]),_:1}),Oe(o,{title:"ComfyUI service",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",put,[u("tr",null,[_ut,u("td",null,[u("div",hut,[ne(u("input",{type:"checkbox",id:"enable_comfyui_service",required:"","onUpdate:modelValue":e[159]||(e[159]=h=>r.configFile.enable_comfyui_service=h),onChange:e[160]||(e[160]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.enable_comfyui_service]])])]),u("td",null,[u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[161]||(e[161]=h=>this.$store.state.messageBox.showMessage("Activates Stable diffusion service. The service will be automatically loaded at startup alowing you to use the stable diffusion endpoint to generate images"))},mut)])]),u("tr",null,[gut,u("td",null,[u("div",but,[u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[162]||(e[162]=(...h)=>r.reinstallComfyUIService&&r.reinstallComfyUIService(...h))},"install comfyui service"),u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[163]||(e[163]=(...h)=>r.upgradeComfyUIService&&r.upgradeComfyUIService(...h))},"upgrade comfyui service"),u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[164]||(e[164]=(...h)=>r.startComfyUIService&&r.startComfyUIService(...h))},"start comfyui service"),u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[165]||(e[165]=(...h)=>r.showComfyui&&r.showComfyui(...h))},"show comfyui"),Eut])])]),u("tr",null,[vut,u("td",null,[u("div",yut,[ne(u("input",{type:"text",id:"comfyui_base_url",required:"","onUpdate:modelValue":e[166]||(e[166]=h=>r.configFile.comfyui_base_url=h),onChange:e[167]||(e[167]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.comfyui_base_url]])])])])])]),_:1}),Oe(o,{title:"Motion Ctrl service",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",Sut,[u("tr",null,[Tut,u("td",null,[u("div",xut,[ne(u("input",{type:"checkbox",id:"enable_motion_ctrl_service",required:"","onUpdate:modelValue":e[168]||(e[168]=h=>r.configFile.enable_motion_ctrl_service=h),onChange:e[169]||(e[169]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.enable_motion_ctrl_service]])])]),u("td",null,[u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[170]||(e[170]=h=>this.$store.state.messageBox.showMessage("Activates Motion ctrl service. The service will be automatically loaded at startup alowing you to use the motoin control endpoint to generate videos"))},Rut)])]),u("tr",null,[Aut,u("td",null,[u("div",wut,[u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[171]||(e[171]=(...h)=>r.reinstallMotionCtrlService&&r.reinstallMotionCtrlService(...h))},"install Motion Ctrl service")])])]),u("tr",null,[Nut,u("td",null,[u("div",Out,[ne(u("input",{type:"text",id:"sd_base_url",required:"","onUpdate:modelValue":e[172]||(e[172]=h=>r.configFile.sd_base_url=h),onChange:e[173]||(e[173]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.sd_base_url]])])])])])]),_:1}),Oe(o,{title:"Ollama service",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",Iut,[u("tr",null,[Mut,u("td",null,[u("div",Dut,[ne(u("input",{type:"checkbox",id:"enable_ollama_service",required:"","onUpdate:modelValue":e[174]||(e[174]=h=>r.configFile.enable_ollama_service=h),onChange:e[175]||(e[175]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.enable_ollama_service]])])]),u("td",null,[u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[176]||(e[176]=h=>this.$store.state.messageBox.showMessage(`Activates ollama service. The service will be automatically loaded at startup alowing you to use the ollama binding. +`+e.message,4,!1),{status:!1}))},personalityImgPlacehodler(n){n.target.src=ga},extensionImgPlacehodler(n){n.target.src=mrt},searchPersonality_func(){clearTimeout(this.searchPersonalityTimer),this.searchPersonality&&(this.searchPersonalityInProgress=!0,setTimeout(this.filterPersonalities,this.searchPersonalityTimerInterval))},searchModel_func(){this.filterModels()}},async mounted(){console.log("Getting voices"),this.getVoices(),console.log("Constructing"),this.load_everything(),this.getSeviceVoices()},activated(){},computed:{rendered_models_zoo:{get(){return this.searchModel?this.show_only_installed_models?this.modelsFiltered.filter(n=>n.isInstalled===!0):this.modelsFiltered.slice(0,Math.min(this.models_zoo.length,this.models_zoo_initialLoadCount)):(console.log("this.models_zoo"),console.log(this.models_zoo),console.log(this.models_zoo_initialLoadCount),this.show_only_installed_models?this.models_zoo.filter(n=>n.isInstalled===!0):this.models_zoo.slice(0,Math.min(this.models_zoo.length,this.models_zoo_initialLoadCount)))}},imgBinding:{get(){if(!this.isMounted)return Li;try{return this.$refs.bindingZoo[this.$refs.bindingZoo.findIndex(n=>n.binding.folder==this.configFile.binding_name)].$refs.imgElement.src}catch{return Li}}},imgModel:{get(){try{let n=this.$store.state.modelsZoo.findIndex(e=>e.name==this.$store.state.selectedModel);return n>=0?(console.log(`model avatar : ${this.$store.state.modelsZoo[n].icon}`),this.$store.state.modelsZoo[n].icon):Li}catch{console.log("error")}if(!this.isMounted)return Li;try{return this.$refs.bindingZoo[this.$refs.bindingZoo.findIndex(n=>n.binding.folder==this.configFile.binding_name)].$refs.imgElement.src}catch{return Li}}},isReady:{get(){return this.$store.state.ready}},audio_out_voice:{get(){return this.$store.state.config.audio_out_voice},set(n){this.$store.state.config.audio_out_voice=n}},whisperModels(){return["base","base.en","base.fr","base.es","small","small.en","small.fr","small.es","medium","medium.en","medium.fr","medium.es","large","large.en","large.fr","large.es"]},audioLanguages(){return[{code:"en-US",name:"English (US)"},{code:"en-GB",name:"English (UK)"},{code:"es-ES",name:"Spanish (Spain)"},{code:"es-MX",name:"Spanish (Mexico)"},{code:"fr-FR",name:"French (France)"},{code:"fr-CA",name:"French (Canada)"},{code:"de-DE",name:"German (Germany)"},{code:"it-IT",name:"Italian (Italy)"},{code:"pt-BR",name:"Portuguese (Brazil)"},{code:"pt-PT",name:"Portuguese (Portugal)"},{code:"ru-RU",name:"Russian (Russia)"},{code:"zh-CN",name:"Chinese (China)"},{code:"ja-JP",name:"Japanese (Japan)"},{code:"ar-SA",name:"Arabic (Saudi Arabia)"},{code:"tr-TR",name:"Turkish (Turkey)"},{code:"ms-MY",name:"Malay (Malaysia)"},{code:"ko-KR",name:"Korean (South Korea)"},{code:"nl-NL",name:"Dutch (Netherlands)"},{code:"sv-SE",name:"Swedish (Sweden)"},{code:"da-DK",name:"Danish (Denmark)"},{code:"fi-FI",name:"Finnish (Finland)"},{code:"no-NO",name:"Norwegian (Norway)"},{code:"pl-PL",name:"Polish (Poland)"},{code:"el-GR",name:"Greek (Greece)"},{code:"hu-HU",name:"Hungarian (Hungary)"},{code:"cs-CZ",name:"Czech (Czech Republic)"},{code:"th-TH",name:"Thai (Thailand)"},{code:"hi-IN",name:"Hindi (India)"},{code:"he-IL",name:"Hebrew (Israel)"},{code:"id-ID",name:"Indonesian (Indonesia)"},{code:"vi-VN",name:"Vietnamese (Vietnam)"},{code:"uk-UA",name:"Ukrainian (Ukraine)"},{code:"ro-RO",name:"Romanian (Romania)"},{code:"bg-BG",name:"Bulgarian (Bulgaria)"},{code:"hr-HR",name:"Croatian (Croatia)"},{code:"sr-RS",name:"Serbian (Serbia)"},{code:"sk-SK",name:"Slovak (Slovakia)"},{code:"sl-SI",name:"Slovenian (Slovenia)"},{code:"et-EE",name:"Estonian (Estonia)"},{code:"lv-LV",name:"Latvian (Latvia)"},{code:"lt-LT",name:"Lithuanian (Lithuania)"},{code:"ka-GE",name:"Georgian (Georgia)"},{code:"hy-AM",name:"Armenian (Armenia)"},{code:"az-AZ",name:"Azerbaijani (Azerbaijan)"},{code:"kk-KZ",name:"Kazakh (Kazakhstan)"},{code:"uz-UZ",name:"Uzbek (Uzbekistan)"},{code:"kkj-CM",name:"Kako (Cameroon)"},{code:"my-MM",name:"Burmese (Myanmar)"},{code:"ne-NP",name:"Nepali (Nepal)"},{code:"si-LK",name:"Sinhala (Sri Lanka)"}]},configFile:{get(){return this.$store.state.config},set(n){this.$store.commit("setConfig",n)}},userName:{get(){return this.$store.state.config.user_name},set(n){this.$store.state.config.user_name=n}},user_avatar:{get(){return"/user_infos/"+this.$store.state.config.user_avatar},set(n){this.$store.state.config.user_avatar=n}},hardware_mode:{get(){return this.$store.state.config.hardware_mode},set(n){this.$store.state.config.hardware_mode=n}},auto_update:{get(){return this.$store.state.config.auto_update},set(n){this.$store.state.config.auto_update=n}},auto_speak:{get(){return this.$store.state.config.auto_speak},set(n){this.$store.state.config.auto_speak=n}},auto_read:{get(){return this.$store.state.config.auto_read},set(n){this.$store.state.config.auto_read=n}},enable_voice_service:{get(){return this.$store.state.config.enable_voice_service},set(n){this.$store.state.config.enable_voice_service=n}},current_language:{get(){return this.$store.state.config.current_language},set(n){console.log("Current voice set to ",n),this.$store.state.config.current_language=n}},current_voice:{get(){return this.$store.state.config.current_voice===null||this.$store.state.config.current_voice===void 0?(console.log("current voice",this.$store.state.config.current_voice),"main_voice"):this.$store.state.config.current_voice},set(n){n=="main_voice"||n===void 0?(console.log("Current voice set to None"),this.$store.state.config.current_voice=null):(console.log("Current voice set to ",n),this.$store.state.config.current_voice=n)}},audio_pitch:{get(){return this.$store.state.config.audio_pitch},set(n){this.$store.state.config.audio_pitch=n}},audio_in_language:{get(){return this.$store.state.config.audio_in_language},set(n){this.$store.state.config.audio_in_language=n}},use_user_name_in_discussions:{get(){return this.$store.state.config.use_user_name_in_discussions},set(n){this.$store.state.config.use_user_name_in_discussions=n}},discussion_db_name:{get(){return this.$store.state.config.discussion_db_name},set(n){this.$store.state.config.discussion_db_name=n}},personalities:{get(){return this.$store.state.personalities},set(n){this.$store.commit("setPersonalities",n)}},mountedPersArr:{get(){return this.$store.state.mountedPersArr},set(n){this.$store.commit("setMountedPers",n)}},mountedExtensions:{get(){return console.log("this.$store.state.mountedExtensions:",this.$store.state.mountedExtensions),this.$store.state.mountedExtensions},set(n){this.$store.commit("setActiveExtensions",n)}},bindingsZoo:{get(){return this.$store.state.bindingsZoo},set(n){this.$store.commit("setbindingsZoo",n)}},modelsArr:{get(){return this.$store.state.modelsArr},set(n){this.$store.commit("setModelsArr",n)}},models:{get(){return this.models_zoo},set(n){this.$store.commit("setModelsZoo",n)}},installed_models:{get(){return this.models_zoo},set(n){this.$store.commit("setModelsZoo",n)}},diskUsage:{get(){return this.$store.state.diskUsage},set(n){this.$store.commit("setDiskUsage",n)}},ramUsage:{get(){return this.$store.state.ramUsage},set(n){this.$store.commit("setRamUsage",n)}},vramUsage:{get(){return this.$store.state.vramUsage},set(n){this.$store.commit("setVramUsage",n)}},disk_available_space(){return this.computedFileSize(this.diskUsage.available_space)},disk_binding_models_usage(){return console.log(`this.diskUsage : ${this.diskUsage}`),this.computedFileSize(this.diskUsage.binding_models_usage)},disk_percent_usage(){return this.diskUsage.percent_usage},disk_total_space(){return this.computedFileSize(this.diskUsage.total_space)},ram_available_space(){return this.computedFileSize(this.ramUsage.available_space)},ram_usage(){return this.computedFileSize(this.ramUsage.ram_usage)},ram_percent_usage(){return this.ramUsage.percent_usage},ram_total_space(){return this.computedFileSize(this.ramUsage.total_space)},model_name(){if(this.isMounted)return this.configFile.model_name},binding_name(){if(!this.isMounted)return;const n=this.bindingsZoo.findIndex(e=>e.folder===this.configFile.binding_name);if(n>-1)return this.bindingsZoo[n].name},active_pesonality(){if(!this.isMounted)return;const n=this.personalities.findIndex(e=>e.full_path===this.configFile.personalities[this.configFile.active_personality_id]);if(n>-1)return this.personalities[n].name},speed_computed(){return ss(this.addModel.speed)},total_size_computed(){return ss(this.addModel.total_size)},downloaded_size_computed(){return ss(this.addModel.downloaded_size)}},watch:{enable_voice_service(n){n||(this.configFile.auto_read=!1)},bec_collapsed(){Ve(()=>{qe.replace()})},pc_collapsed(){Ve(()=>{qe.replace()})},mc_collapsed(){Ve(()=>{qe.replace()})},sc_collapsed(){Ve(()=>{qe.replace()})},showConfirmation(){Ve(()=>{qe.replace()})},mzl_collapsed(){Ve(()=>{qe.replace()})},pzl_collapsed(){Ve(()=>{qe.replace()})},ezl_collapsed(){Ve(()=>{qe.replace()})},bzl_collapsed(){Ve(()=>{qe.replace()})},all_collapsed(n){this.collapseAll(n),Ve(()=>{qe.replace()})},settingsChanged(n){this.$store.state.settingsChanged=n,Ve(()=>{qe.replace()})},isLoading(){Ve(()=>{qe.replace()})},searchPersonality(n){n==""&&this.filterPersonalities()},mzdc_collapsed(){Ve(()=>{qe.replace()})}},async beforeRouteLeave(n){if(await this.$router.isReady(),this.settingsChanged)return await this.$store.state.yesNoDialog.askQuestion(`Did You forget to apply changes? +You need to apply changes before you leave, or else.`,"Apply configuration","Cancel")&&this.applyConfiguration(),!1}},oe=n=>(Nr("data-v-bbd5a2e4"),n=n(),Or(),n),Dot={class:"container overflow-y-scroll flex flex-row shadow-lg p-10 pt-0 overflow-y-scroll w-full dark:bg-bg-dark scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},kot={class:"sticky top-0 z-10 flex flex-row mb-2 p-3 gap-3 w-full rounded-b-lg bg-bg-light-tone dark:bg-bg-dark-tone shadow-lg"},Lot={key:0,class:"flex gap-3 flex-1 items-center duration-75"},Pot=oe(()=>u("i",{"data-feather":"x"},null,-1)),Uot=[Pot],Fot=oe(()=>u("i",{"data-feather":"check"},null,-1)),Bot=[Fot],Got={key:1,class:"flex gap-3 flex-1 items-center"},zot=oe(()=>u("i",{"data-feather":"save"},null,-1)),Vot=[zot],Hot=oe(()=>u("i",{"data-feather":"refresh-ccw"},null,-1)),qot=[Hot],Yot=oe(()=>u("i",{"data-feather":"list"},null,-1)),$ot=[Yot],Wot={class:"flex gap-3 flex-1 items-center justify-end"},Kot=oe(()=>u("i",{"data-feather":"trash-2"},null,-1)),jot=[Kot],Qot=oe(()=>u("i",{"data-feather":"refresh-ccw"},null,-1)),Xot=[Qot],Zot=oe(()=>u("i",{"data-feather":"arrow-up-circle"},null,-1)),Jot={key:0},eat=oe(()=>u("i",{"data-feather":"alert-circle"},null,-1)),tat=[eat],nat={class:"flex gap-3 items-center"},iat={key:0,class:"flex gap-3 items-center"},sat=oe(()=>u("p",{class:"text-red-600 font-bold"},"Apply changes:",-1)),rat=oe(()=>u("i",{"data-feather":"check"},null,-1)),oat=[rat],aat={key:1,role:"status"},lat=oe(()=>u("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1)),cat=oe(()=>u("span",{class:"sr-only"},"Loading...",-1)),dat={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},uat={class:"flex flex-row p-3"},pat=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),_at=[pat],hat=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),fat=[hat],mat=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," System status",-1)),gat=oe(()=>u("div",{class:"mr-2"},"|",-1)),bat={class:"text-base font-semibold cursor-pointer select-none items-center"},Eat={class:"flex gap-2 items-center"},vat={key:0},yat=["src"],Sat={class:"font-bold font-large text-lg"},Tat={key:1},xat={class:"flex gap-2 items-center"},Cat=["src"],Rat={class:"font-bold font-large text-lg"},Aat=oe(()=>u("i",{"data-feather":"cpu",title:"CPU Ram",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),wat={class:"font-bold font-large text-lg"},Nat=oe(()=>u("i",{"data-feather":"hard-drive",title:"Hard drive",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),Oat={class:"font-bold font-large text-lg"},Iat={class:"mb-2"},Mat=oe(()=>u("label",{class:"flex items-center gap-1 ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},[u("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[u("path",{fill:"currentColor",d:"M17 17H7V7h10m4 4V9h-2V7a2 2 0 0 0-2-2h-2V3h-2v2h-2V3H9v2H7c-1.11 0-2 .89-2 2v2H3v2h2v2H3v2h2v2a2 2 0 0 0 2 2h2v2h2v-2h2v2h2v-2h2a2 2 0 0 0 2-2v-2h2v-2h-2v-2m-6 2h-2v-2h2m2-2H9v6h6V9Z"})]),je(" CPU Ram usage: ")],-1)),Dat={class:"flex flex-col mx-2"},kat=oe(()=>u("b",null,"Avaliable ram: ",-1)),Lat=oe(()=>u("b",null,"Ram usage: ",-1)),Pat={class:"p-2"},Uat={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},Fat={class:"mb-2"},Bat=oe(()=>u("label",{class:"flex items-center gap-1 ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},[u("i",{"data-feather":"hard-drive",class:"w-5 h-5"}),je(" Disk usage: ")],-1)),Gat={class:"flex flex-col mx-2"},zat=oe(()=>u("b",null,"Avaliable disk space: ",-1)),Vat=oe(()=>u("b",null,"Disk usage: ",-1)),Hat={class:"p-2"},qat={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},Yat={class:"flex items-center gap-1 ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},$at=["src"],Wat={class:"flex flex-col mx-2"},Kat=oe(()=>u("b",null,"Model: ",-1)),jat=oe(()=>u("b",null,"Avaliable vram: ",-1)),Qat=oe(()=>u("b",null,"GPU usage: ",-1)),Xat={class:"p-2"},Zat={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},Jat={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},elt={class:"flex flex-row p-3"},tlt=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),nlt=[tlt],ilt=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),slt=[ilt],rlt=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Main configurations",-1)),olt={class:"flex flex-col mb-2 px-3 pb-2"},alt={class:"expand-to-fit bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},llt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"hardware_mode",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Hardware mode:")],-1)),clt={class:"text-center items-center"},dlt={class:"flex flex-row"},ult=oe(()=>u("option",{value:"cpu"},"CPU",-1)),plt=oe(()=>u("option",{value:"cpu-noavx"},"CPU (No AVX)",-1)),_lt=oe(()=>u("option",{value:"nvidia-tensorcores"},"NVIDIA (Tensor Cores)",-1)),hlt=oe(()=>u("option",{value:"nvidia"},"NVIDIA",-1)),flt=oe(()=>u("option",{value:"amd-noavx"},"AMD (No AVX)",-1)),mlt=oe(()=>u("option",{value:"amd"},"AMD",-1)),glt=oe(()=>u("option",{value:"apple-intel"},"Apple Intel",-1)),blt=oe(()=>u("option",{value:"apple-silicon"},"Apple Silicon",-1)),Elt=[ult,plt,_lt,hlt,flt,mlt,glt,blt],vlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"discussion_db_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Database path:")],-1)),ylt={style:{width:"100%"}},Slt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"copy_to_clipboard_add_all_details",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Add details to messages copied to clipboard:")],-1)),Tlt={class:"flex flex-row"},xlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"auto_show_browser",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto show browser:")],-1)),Clt={class:"flex flex-row"},Rlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"activate_debug",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate debug mode:")],-1)),Alt={class:"flex flex-row"},wlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"debug_log_file_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Debug file path:")],-1)),Nlt={class:"flex flex-row"},Olt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"show_news_panel",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Show news panel:")],-1)),Ilt={class:"flex flex-row"},Mlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"auto_save",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto save:")],-1)),Dlt={class:"flex flex-row"},klt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"auto_update",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto update:")],-1)),Llt={class:"flex flex-row"},Plt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"auto_update",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto title:")],-1)),Ult={class:"flex flex-row"},Flt={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Blt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"user_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"User name:")],-1)),Glt={style:{width:"100%"}},zlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"user_description",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"User description:")],-1)),Vlt={style:{width:"100%"}},Hlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"use_user_informations_in_discussion",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use user description in discussion:")],-1)),qlt={style:{width:"100%"}},Ylt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"use_model_name_in_discussions",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use model name in discussion:")],-1)),$lt={style:{width:"100%"}},Wlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"user_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"User avatar:")],-1)),Klt={style:{width:"100%"}},jlt={for:"avatar-upload"},Qlt=["src"],Xlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"use_user_name_in_discussions",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use User Name in discussions:")],-1)),Zlt={class:"flex flex-row"},Jlt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"max_n_predict",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Maximum number of output tokens space (forces the model to have more space to speak):")],-1)),ect={style:{width:"100%"}},tct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"min_n_predict",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Minimum number of output tokens space (forces the model to have more space to speak):")],-1)),nct={style:{width:"100%"}},ict={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},sct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"turn_on_code_execution",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"turn on code execution:")],-1)),rct={style:{width:"100%"}},oct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"turn_on_code_validation",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"turn on code validation (very recommended for security reasons):")],-1)),act={style:{width:"100%"}},lct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"turn_on_setting_update_validation",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"turn on apply settings validation (very recommended for security reasons):")],-1)),cct={style:{width:"100%"}},dct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"turn_on_open_file_validation",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"turn on open file/folder validation:")],-1)),uct={style:{width:"100%"}},pct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"turn_on_send_file_validation",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"turn on send file validation:")],-1)),_ct={style:{width:"100%"}},hct={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},fct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"activate_skills_lib",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate Skills library:")],-1)),mct={class:"flex flex-row"},gct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"discussion_db_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Skills library database name:")],-1)),bct={style:{width:"100%"}},Ect={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},vct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"activate_internet_search",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate internet search:")],-1)),yct={class:"flex flex-row"},Sct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"internet_quick_search",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate quick search:")],-1)),Tct={class:"flex flex-row"},xct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"internet_activate_search_decision",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate search decision:")],-1)),Cct={class:"flex flex-row"},Rct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"internet_vectorization_chunk_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Internet vectorization chunk size:")],-1)),Act={class:"flex flex-col"},wct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"internet_vectorization_overlap_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Internet vectorization overlap size:")],-1)),Nct={class:"flex flex-col"},Oct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"internet_vectorization_nb_chunks",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Internet vectorization number of chunks:")],-1)),Ict={class:"flex flex-col"},Mct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"internet_nb_search_pages",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Internet number of search pages:")],-1)),Dct={class:"flex flex-col"},kct={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Lct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"pdf_latex_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"PDF LaTeX path:")],-1)),Pct={class:"flex flex-row"},Uct={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Fct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"positive_boost",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Positive Boost:")],-1)),Bct={class:"flex flex-row"},Gct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"negative_boost",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Negative Boost:")],-1)),zct={class:"flex flex-row"},Vct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"force_output_language_to_be",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Force AI to answer in this language:")],-1)),Hct={class:"flex flex-row"},qct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"fun_mode",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Fun mode:")],-1)),Yct={class:"flex flex-row"},$ct={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Wct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"whisper_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Whisper model:")],-1)),Kct={class:"flex flex-row"},jct=["value"],Qct={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Xct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"activate_audio_infos",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate audio infos:")],-1)),Zct={class:"flex flex-row"},Jct=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"audio_auto_send_input",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Send audio input automatically:")],-1)),edt={class:"flex flex-row"},tdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"auto_speak",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable auto speak:")],-1)),ndt={class:"flex flex-row"},idt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"audio_pitch",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"audio pitch:")],-1)),sdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"audio_silenceTimer",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"audio in silence timer (ms):")],-1)),rdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"audio_in_language",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Input Audio Language:")],-1)),odt=["value"],adt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"audio_out_voice",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Output Audio Voice:")],-1)),ldt=["value"],cdt={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},ddt={class:"flex flex-row p-3"},udt=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),pdt=[udt],_dt=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),hdt=[_dt],fdt=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Data management settings",-1)),mdt={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},gdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"summerize_discussion",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate Continuous Learning from discussions:")],-1)),bdt={class:"flex flex-row"},Edt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_visualize_on_vectorization",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"show vectorized data:")],-1)),vdt={class:"flex flex-row"},ydt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_build_keys_words",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Reformulate prompt before querying database (advised):")],-1)),Sdt={class:"flex flex-row"},Tdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_force_first_chunk",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Force adding the first chunk of the file to the context:")],-1)),xdt={class:"flex flex-row"},Cdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_put_chunk_informations_into_context",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Put Chunk Information Into Context:")],-1)),Rdt={class:"flex flex-row"},Adt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_method",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization method:")],-1)),wdt=oe(()=>u("option",{value:"tfidf_vectorizer"},"tfidf Vectorizer",-1)),Ndt=oe(()=>u("option",{value:"bm25_vectorizer"},"bm25 Vectorizer",-1)),Odt=oe(()=>u("option",{value:"model_embedding"},"Model Embedding",-1)),Idt=oe(()=>u("option",{value:"sentense_transformer"},"Sentense Transformer",-1)),Mdt=[wdt,Ndt,Odt,Idt],Ddt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_sentense_transformer_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization model (for Sentense Transformer):")],-1)),kdt={style:{width:"100%"}},Ldt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_visualization_method",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data visualization method:")],-1)),Pdt=oe(()=>u("option",{value:"PCA"},"PCA",-1)),Udt=oe(()=>u("option",{value:"TSNE"},"TSNE",-1)),Fdt=[Pdt,Udt],Bdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_save_db",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Save the new files to the database (The database wil always grow and continue to be the same over many sessions):")],-1)),Gdt={class:"flex flex-row"},zdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_chunk_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization chunk size(tokens):")],-1)),Vdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_overlap_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization overlap size(tokens):")],-1)),Hdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"data_vectorization_overlap_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Number of chunks to use for each message:")],-1)),qdt={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},Ydt={class:"flex flex-row p-3"},$dt=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),Wdt=[$dt],Kdt=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),jdt=[Kdt],Qdt=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Servers configurations",-1)),Xdt={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Zdt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"host",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Host:")],-1)),Jdt={style:{width:"100%"}},eut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"discussion_db_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Port:")],-1)),tut={style:{width:"100%"}},nut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"discussion_db_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate headless server mode (deactivates all code exectuion to protect the PC from attacks):")],-1)),iut={style:{width:"100%"}},sut={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},rut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"enable_sd_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable sd service:")],-1)),out={class:"flex flex-row"},aut=oe(()=>u("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),lut=[aut],cut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"install_sd_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install SD service:")],-1)),dut={class:"flex flex-row"},uut=oe(()=>u("a",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",href:"https://github.com/ParisNeo/stable-diffusion-webui/blob/master/LICENSE.txt",target:"_blank"},"automatic1111's sd licence",-1)),put=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"sd_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"sd base url:")],-1)),_ut={class:"flex flex-row"},hut={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},fut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"enable_comfyui_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable comfyui service:")],-1)),mut={class:"flex flex-row"},gut=oe(()=>u("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),but=[gut],Eut=oe(()=>u("td",{style:{"min-width":"200px"}},null,-1)),vut={class:"flex flex-row"},yut=oe(()=>u("a",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",href:"https://github.com/ParisNeo/ComfyUI/blob/master/LICENSE",target:"_blank"},"comfyui licence",-1)),Sut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"comfyui_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"comfyui base url:")],-1)),Tut={class:"flex flex-row"},xut={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Cut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"enable_sd_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable Motion Ctrl service:")],-1)),Rut={class:"flex flex-row"},Aut=oe(()=>u("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),wut=[Aut],Nut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"install_sd_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install Motion Ctrl service:")],-1)),Out={class:"flex flex-row"},Iut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"sd_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"sd base url:")],-1)),Mut={class:"flex flex-row"},Dut={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},kut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"enable_ollama_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable ollama service:")],-1)),Lut={class:"flex flex-row"},Put=oe(()=>u("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),Uut=[Put],Fut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"ollama_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install Ollama service:")],-1)),But={class:"flex flex-row"},Gut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"ollama_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"ollama base url:")],-1)),zut={class:"flex flex-row"},Vut={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Hut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"enable_vllm_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable vLLM service:")],-1)),qut={class:"flex flex-row"},Yut=oe(()=>u("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),$ut=[Yut],Wut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"vllm_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install vLLM service:")],-1)),Kut={class:"flex flex-row"},jut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"vllm_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"vllm base url:")],-1)),Qut={class:"flex flex-row"},Xut=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"vllm_gpu_memory_utilization",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"gpu memory utilization:")],-1)),Zut={class:"flex flex-col align-bottom"},Jut={class:"relative"},ept=oe(()=>u("p",{class:"absolute left-0 mt-6"},[u("label",{for:"vllm_gpu_memory_utilization",class:"text-sm font-medium"}," vllm gpu memory utilization: ")],-1)),tpt={class:"absolute right-0"},npt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"vllm_max_num_seqs",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"vllm max num seqs:")],-1)),ipt={class:"flex flex-row"},spt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"vllm_max_model_len",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"max model len:")],-1)),rpt={class:"flex flex-row"},opt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"vllm_model_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"vllm model path:")],-1)),apt={class:"flex flex-row"},lpt={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},cpt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"enable_petals_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable petals service:")],-1)),dpt={class:"flex flex-row"},upt=oe(()=>u("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),ppt=[upt],_pt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"petals_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install Petals service:")],-1)),hpt={class:"flex flex-row"},fpt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"petals_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"petals base url:")],-1)),mpt={class:"flex flex-row"},gpt={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},bpt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"enable_voice_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable elastic search service:")],-1)),Ept={class:"flex flex-row"},vpt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"install_elastic_search_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Reinstall Elastic Search service:")],-1)),ypt={class:"flex flex-row"},Spt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"elastic_search_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"elastic search base url:")],-1)),Tpt={class:"flex flex-row"},xpt={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Cpt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"enable_voice_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable voice service:")],-1)),Rpt={class:"flex flex-row"},Apt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"install_xtts_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"xTTS service:")],-1)),wpt={class:"flex flex-row"},Npt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"xtts_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"xtts base url:")],-1)),Opt={class:"flex flex-row"},Ipt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"current_language",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Current language:")],-1)),Mpt={class:"flex flex-row"},Dpt=["disabled"],kpt=["value"],Lpt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"current_voice",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Current voice:")],-1)),Ppt={class:"flex flex-row"},Upt=["disabled"],Fpt=["value"],Bpt=oe(()=>u("td",{style:{"min-width":"200px"}},[u("label",{for:"auto_read",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable auto read:")],-1)),Gpt={class:"flex flex-row"},zpt=["disabled"],Vpt={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},Hpt={class:"flex flex-row p-3"},qpt=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),Ypt=[qpt],$pt=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),Wpt=[$pt],Kpt=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Binding zoo",-1)),jpt={key:0,class:"text-base text-red-600 flex gap-3 items-center mr-2"},Qpt=oe(()=>u("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),Xpt={key:1,class:"mr-2"},Zpt={key:2,class:"text-base font-semibold cursor-pointer select-none items-center"},Jpt={class:"flex gap-1 items-center"},e_t=["src"],t_t={class:"font-bold font-large text-lg line-clamp-1"},n_t={key:0,class:"mb-2"},i_t={for:"binding",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},s_t=oe(()=>u("i",{"data-feather":"chevron-up"},null,-1)),r_t=[s_t],o_t=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),a_t=[o_t],l_t={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},c_t={class:"flex flex-row p-3"},d_t=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),u_t=[d_t],p_t=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),__t=[p_t],h_t=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Models zoo",-1)),f_t={class:"flex flex-row items-center"},m_t={key:0,class:"text-base text-red-600 flex gap-3 items-center mr-2"},g_t=oe(()=>u("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),b_t={key:1,class:"text-base text-red-600 flex gap-3 items-center mr-2"},E_t=oe(()=>u("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),v_t={key:2,class:"mr-2"},y_t={key:3,class:"text-base font-semibold cursor-pointer select-none items-center"},S_t={class:"flex gap-1 items-center"},T_t=["src"],x_t={class:"font-bold font-large text-lg line-clamp-1"},C_t={class:"mx-2 mb-4"},R_t={class:"relative"},A_t={class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},w_t={key:0},N_t=oe(()=>u("div",{role:"status"},[u("svg",{"aria-hidden":"true",class:"inline w-4 h-4 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),u("span",{class:"sr-only"},"Loading...")],-1)),O_t=[N_t],I_t={key:1},M_t=oe(()=>u("svg",{"aria-hidden":"true",class:"w-5 h-5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1)),D_t=[M_t],k_t=oe(()=>u("label",{for:"only_installed"},"Show only installed models",-1)),L_t=oe(()=>u("a",{href:"https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard",target:"_blank",class:"mb-4 font-bold underline text-blue-500 pb-4"},"Hugging face Leaderboard",-1)),P_t={key:0,role:"status",class:"text-center w-full display: flex;align-items: center;"},U_t=oe(()=>u("svg",{"aria-hidden":"true",class:"text-center w-full display: flex;align-items: center; h-20 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1)),F_t=oe(()=>u("p",{class:"heartbeat-text"},"Loading models Zoo",-1)),B_t=[U_t,F_t],G_t={key:1,class:"mb-2"},z_t={for:"model",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},V_t=oe(()=>u("i",{"data-feather":"chevron-up"},null,-1)),H_t=[V_t],q_t=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),Y_t=[q_t],$_t={class:"mb-2"},W_t={class:"p-2"},K_t={class:"mb-3"},j_t=oe(()=>u("label",{class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},"Create a reference from local file path:",-1)),Q_t={key:0},X_t={class:"mb-3"},Z_t=oe(()=>u("label",{class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},"Download from web:",-1)),J_t={key:1,class:"relative flex flex-col items-center justify-center flex-grow h-full"},eht=oe(()=>u("div",{role:"status",class:"justify-center"},null,-1)),tht={class:"relative flex flex-row flex-grow items-center w-full h-full bottom-0"},nht={class:"w-full p-2"},iht={class:"flex justify-between mb-1"},sht=zu(' Downloading Loading...',1),rht={class:"text-sm font-medium text-blue-700 dark:text-white"},oht=["title"],aht={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},lht={class:"flex justify-between mb-1"},cht={class:"text-base font-medium text-blue-700 dark:text-white"},dht={class:"text-sm font-medium text-blue-700 dark:text-white"},uht={class:"flex flex-grow"},pht={class:"flex flex-row flex-grow gap-3"},_ht={class:"p-2 text-center grow"},hht={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},fht={class:"flex flex-row p-3 items-center"},mht=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),ght=[mht],bht=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),Eht=[bht],vht=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Personalities zoo",-1)),yht={key:0,class:"mr-2"},Sht={class:"mr-2 font-bold font-large text-lg line-clamp-1"},Tht={key:1,class:"mr-2"},xht={key:2,class:"text-base font-semibold cursor-pointer select-none items-center flex flex-row"},Cht={key:0,class:"flex -space-x-4 items-center"},Rht={class:"group items-center flex flex-row"},Aht=["onClick"],wht=["src","title"],Nht=["onClick"],Oht=oe(()=>u("span",{class:"hidden group-hover:block top-0 left-7 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2 border-transparent",title:"Unmount personality"},[u("svg",{"aria-hidden":"true",class:"w-4 h-4 text-red-600 hover:text-red-500",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})])],-1)),Iht=[Oht],Mht=oe(()=>u("svg",{"aria-hidden":"true",class:"w-4 h-4 text-red-600 hover:text-red-500",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)),Dht=[Mht],kht={class:"mx-2 mb-4"},Lht=oe(()=>u("label",{for:"personality-search",class:"mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white"},"Search",-1)),Pht={class:"relative"},Uht={class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},Fht={key:0},Bht=oe(()=>u("div",{role:"status"},[u("svg",{"aria-hidden":"true",class:"inline w-4 h-4 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),u("span",{class:"sr-only"},"Loading...")],-1)),Ght=[Bht],zht={key:1},Vht=oe(()=>u("svg",{"aria-hidden":"true",class:"w-5 h-5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1)),Hht=[Vht],qht={key:0,class:"mx-2 mb-4"},Yht={for:"persCat",class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},$ht=["selected"],Wht={key:0,class:"mb-2"},Kht={for:"model",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},jht=oe(()=>u("i",{"data-feather":"chevron-up"},null,-1)),Qht=[jht],Xht=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),Zht=[Xht],Jht={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},eft={class:"flex flex-row p-3 items-center"},tft=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),nft=[tft],ift=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),sft=[ift],rft=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Extensions zoo",-1)),oft={key:0,class:"mr-2"},aft={key:1,class:"text-base font-semibold cursor-pointer select-none items-center flex flex-row"},lft={key:0,class:"flex -space-x-4 items-center"},cft={class:"group items-center flex flex-row"},dft=["src","title"],uft=["onClick"],pft=oe(()=>u("span",{class:"hidden group-hover:block top-0 left-7 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2 border-transparent",title:"Unmount personality"},[u("svg",{"aria-hidden":"true",class:"w-4 h-4 text-red-600 hover:text-red-500",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})])],-1)),_ft=[pft],hft={class:"mx-2 mb-4"},fft=oe(()=>u("label",{for:"personality-search",class:"mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white"},"Search",-1)),mft={class:"relative"},gft={class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},bft={key:0},Eft=oe(()=>u("div",{role:"status"},[u("svg",{"aria-hidden":"true",class:"inline w-4 h-4 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),u("span",{class:"sr-only"},"Loading...")],-1)),vft=[Eft],yft={key:1},Sft=oe(()=>u("svg",{"aria-hidden":"true",class:"w-5 h-5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1)),Tft=[Sft],xft={key:0,class:"mx-2 mb-4"},Cft={for:"extCat",class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},Rft=["selected"],Aft={key:0,class:"mb-2"},wft={for:"model",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},Nft=oe(()=>u("i",{"data-feather":"chevron-up"},null,-1)),Oft=[Nft],Ift=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),Mft=[Ift],Dft={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},kft={class:"flex flex-row p-3 items-center"},Lft=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),Pft=[Lft],Uft=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),Fft=[Uft],Bft=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Mounted Extensions Priority",-1)),Gft={class:"flex flex-col mb-2 p-3 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},zft={class:"flex flex-row"},Vft=oe(()=>u("i",{"data-feather":"chevron-right"},null,-1)),Hft=[Vft],qft=oe(()=>u("i",{"data-feather":"chevron-down"},null,-1)),Yft=[qft],$ft=oe(()=>u("h3",{class:"text-lg font-semibold cursor-pointer select-none"}," Model Configuration",-1)),Wft={class:"m-2"},Kft={class:"flex flex-row gap-2 items-center"},jft=oe(()=>u("label",{for:"override-model-parameters",class:"block text-sm font-medium"}," Override personality model parameters ",-1)),Qft={class:"m-2"},Xft=oe(()=>u("label",{for:"seed",class:"block mb-2 text-sm font-medium"}," Seed: ",-1)),Zft={class:"m-2"},Jft={class:"flex flex-col align-bottom"},emt={class:"relative"},tmt=oe(()=>u("p",{class:"absolute left-0 mt-6"},[u("label",{for:"temperature",class:"text-sm font-medium"}," Temperature: ")],-1)),nmt={class:"absolute right-0"},imt={class:"m-2"},smt={class:"flex flex-col align-bottom"},rmt={class:"relative"},omt=oe(()=>u("p",{class:"absolute left-0 mt-6"},[u("label",{for:"predict",class:"text-sm font-medium"}," N Predict: ")],-1)),amt={class:"absolute right-0"},lmt={class:"m-2"},cmt={class:"flex flex-col align-bottom"},dmt={class:"relative"},umt=oe(()=>u("p",{class:"absolute left-0 mt-6"},[u("label",{for:"top_k",class:"text-sm font-medium"}," Top-K: ")],-1)),pmt={class:"absolute right-0"},_mt={class:"m-2"},hmt={class:"flex flex-col align-bottom"},fmt={class:"relative"},mmt=oe(()=>u("p",{class:"absolute left-0 mt-6"},[u("label",{for:"top_p",class:"text-sm font-medium"}," Top-P: ")],-1)),gmt={class:"absolute right-0"},bmt={class:"m-2"},Emt={class:"flex flex-col align-bottom"},vmt={class:"relative"},ymt=oe(()=>u("p",{class:"absolute left-0 mt-6"},[u("label",{for:"repeat_penalty",class:"text-sm font-medium"}," Repeat penalty: ")],-1)),Smt={class:"absolute right-0"},Tmt={class:"m-2"},xmt={class:"flex flex-col align-bottom"},Cmt={class:"relative"},Rmt=oe(()=>u("p",{class:"absolute left-0 mt-6"},[u("label",{for:"repeat_last_n",class:"text-sm font-medium"}," Repeat last N: ")],-1)),Amt={class:"absolute right-0"};function wmt(n,e,t,i,s,r){const o=ht("Card"),a=ht("BindingEntry"),l=ht("RadioOptions"),d=ht("model-entry"),c=ht("personality-entry"),_=ht("ExtensionEntry"),f=ht("AddModelDialog"),m=ht("ChoiceDialog");return w(),M($e,null,[u("div",Dot,[u("div",kot,[s.showConfirmation?(w(),M("div",Lot,[u("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel",type:"button",onClick:e[0]||(e[0]=Te(h=>s.showConfirmation=!1,["stop"]))},Uot),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm save changes",type:"button",onClick:e[1]||(e[1]=Te(h=>r.save_configuration(),["stop"]))},Bot)])):q("",!0),s.showConfirmation?q("",!0):(w(),M("div",Got,[u("button",{title:"Save configuration",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[2]||(e[2]=h=>s.showConfirmation=!0)},Vot),u("button",{title:"Reset configuration",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[3]||(e[3]=h=>r.reset_configuration())},qot),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Collapse / Expand all panels",type:"button",onClick:e[4]||(e[4]=Te(h=>s.all_collapsed=!s.all_collapsed,["stop"]))},$ot)])),u("div",Wot,[u("button",{title:"Clear uploads",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[5]||(e[5]=h=>r.api_get_req("clear_uploads").then(E=>{E.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast(["failed!"],4,!1)}))},jot),u("button",{title:"Restart program",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[6]||(e[6]=h=>r.api_get_req("restart_program").then(E=>{E.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast(["failed!"],4,!1)}))},Xot),u("button",{title:"Upgrade program ",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[7]||(e[7]=h=>r.api_get_req("update_software").then(E=>{E.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast("Success!",4,!0)}))},[Zot,s.has_updates?(w(),M("div",Jot,tat)):q("",!0)]),u("div",nat,[s.settingsChanged?(w(),M("div",iat,[sat,s.isLoading?q("",!0):(w(),M("button",{key:0,class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Apply changes",type:"button",onClick:e[8]||(e[8]=Te(h=>r.applyConfiguration(),["stop"]))},oat))])):q("",!0),s.isLoading?(w(),M("div",aat,[u("p",null,fe(s.loading_text),1),lat,cat])):q("",!0)])])]),u("div",{class:Ye(s.isLoading?"pointer-events-none opacity-30 w-full":"w-full")},[u("div",dat,[u("div",uat,[u("button",{onClick:e[9]||(e[9]=Te(h=>s.sc_collapsed=!s.sc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[ne(u("div",null,_at,512),[[Ot,s.sc_collapsed]]),ne(u("div",null,fat,512),[[Ot,!s.sc_collapsed]]),mat,gat,u("div",bat,[u("div",Eat,[u("div",null,[r.vramUsage&&r.vramUsage.gpus&&r.vramUsage.gpus.length==1?(w(),M("div",vat,[(w(!0),M($e,null,ct(r.vramUsage.gpus,h=>(w(),M("div",{class:"flex gap-2 items-center",key:h},[u("img",{src:s.SVGGPU,width:"25",height:"25"},null,8,yat),u("h3",Sat,[u("div",null,fe(r.computedFileSize(h.used_vram))+" / "+fe(r.computedFileSize(h.total_vram))+" ("+fe(h.percentage)+"%) ",1)])]))),128))])):q("",!0),r.vramUsage&&r.vramUsage.gpus&&r.vramUsage.gpus.length>1?(w(),M("div",Tat,[u("div",xat,[u("img",{src:s.SVGGPU,width:"25",height:"25"},null,8,Cat),u("h3",Rat,[u("div",null,fe(r.vramUsage.gpus.length)+"x ",1)])])])):q("",!0)]),Aat,u("h3",wat,[u("div",null,fe(r.ram_usage)+" / "+fe(r.ram_total_space)+" ("+fe(r.ram_percent_usage)+"%)",1)]),Nat,u("h3",Oat,[u("div",null,fe(r.disk_binding_models_usage)+" / "+fe(r.disk_total_space)+" ("+fe(r.disk_percent_usage)+"%)",1)])])])])]),u("div",{class:Ye([{hidden:s.sc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[u("div",Iat,[Mat,u("div",Dat,[u("div",null,[kat,je(fe(r.ram_available_space),1)]),u("div",null,[Lat,je(" "+fe(r.ram_usage)+" / "+fe(r.ram_total_space)+" ("+fe(r.ram_percent_usage)+")% ",1)])]),u("div",Pat,[u("div",Uat,[u("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en("width: "+r.ram_percent_usage+"%;")},null,4)])])]),u("div",Fat,[Bat,u("div",Gat,[u("div",null,[zat,je(fe(r.disk_available_space),1)]),u("div",null,[Vat,je(" "+fe(r.disk_binding_models_usage)+" / "+fe(r.disk_total_space)+" ("+fe(r.disk_percent_usage)+"%)",1)])]),u("div",Hat,[u("div",qat,[u("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en("width: "+r.disk_percent_usage+"%;")},null,4)])])]),(w(!0),M($e,null,ct(r.vramUsage.gpus,h=>(w(),M("div",{class:"mb-2",key:h},[u("label",Yat,[u("img",{src:s.SVGGPU,width:"25",height:"25"},null,8,$at),je(" GPU usage: ")]),u("div",Wat,[u("div",null,[Kat,je(fe(h.gpu_model),1)]),u("div",null,[jat,je(fe(this.computedFileSize(h.available_space)),1)]),u("div",null,[Qat,je(" "+fe(this.computedFileSize(h.used_vram))+" / "+fe(this.computedFileSize(h.total_vram))+" ("+fe(h.percentage)+"%)",1)])]),u("div",Xat,[u("div",Zat,[u("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en("width: "+h.percentage+"%;")},null,4)])])]))),128))],2)]),u("div",Jat,[u("div",elt,[u("button",{onClick:e[10]||(e[10]=Te(h=>s.minconf_collapsed=!s.minconf_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[ne(u("div",null,nlt,512),[[Ot,s.minconf_collapsed]]),ne(u("div",null,slt,512),[[Ot,!s.minconf_collapsed]]),rlt])]),u("div",{class:Ye([{hidden:s.minconf_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[u("div",olt,[Oe(o,{title:"General",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",alt,[u("tr",null,[llt,u("td",clt,[u("div",dlt,[ne(u("select",{id:"hardware_mode",required:"","onUpdate:modelValue":e[11]||(e[11]=h=>r.configFile.hardware_mode=h),onChange:e[12]||(e[12]=h=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},Elt,544),[[zn,r.configFile.hardware_mode]])])])]),u("tr",null,[vlt,u("td",ylt,[ne(u("input",{type:"text",id:"discussion_db_name",required:"","onUpdate:modelValue":e[13]||(e[13]=h=>r.configFile.discussion_db_name=h),onChange:e[14]||(e[14]=h=>s.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Pe,r.configFile.discussion_db_name]])])]),u("tr",null,[Slt,u("td",null,[u("div",Tlt,[ne(u("input",{type:"checkbox",id:"copy_to_clipboard_add_all_details",required:"","onUpdate:modelValue":e[15]||(e[15]=h=>r.configFile.copy_to_clipboard_add_all_details=h),onChange:e[16]||(e[16]=h=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.copy_to_clipboard_add_all_details]])])])]),u("tr",null,[xlt,u("td",null,[u("div",Clt,[ne(u("input",{type:"checkbox",id:"auto_show_browser",required:"","onUpdate:modelValue":e[17]||(e[17]=h=>r.configFile.auto_show_browser=h),onChange:e[18]||(e[18]=h=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.auto_show_browser]])])])]),u("tr",null,[Rlt,u("td",null,[u("div",Alt,[ne(u("input",{type:"checkbox",id:"activate_debug",required:"","onUpdate:modelValue":e[19]||(e[19]=h=>r.configFile.debug=h),onChange:e[20]||(e[20]=h=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.debug]])])])]),u("tr",null,[wlt,u("td",null,[u("div",Nlt,[ne(u("input",{type:"text",id:"debug_log_file_path",required:"","onUpdate:modelValue":e[21]||(e[21]=h=>r.configFile.debug_log_file_path=h),onChange:e[22]||(e[22]=h=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.debug_log_file_path]])])])]),u("tr",null,[Olt,u("td",null,[u("div",Ilt,[ne(u("input",{type:"checkbox",id:"show_news_panel",required:"","onUpdate:modelValue":e[23]||(e[23]=h=>r.configFile.show_news_panel=h),onChange:e[24]||(e[24]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.show_news_panel]])])])]),u("tr",null,[Mlt,u("td",null,[u("div",Dlt,[ne(u("input",{type:"checkbox",id:"auto_save",required:"","onUpdate:modelValue":e[25]||(e[25]=h=>r.configFile.auto_save=h),onChange:e[26]||(e[26]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.auto_save]])])])]),u("tr",null,[klt,u("td",null,[u("div",Llt,[ne(u("input",{type:"checkbox",id:"auto_update",required:"","onUpdate:modelValue":e[27]||(e[27]=h=>r.configFile.auto_update=h),onChange:e[28]||(e[28]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.auto_update]])])])]),u("tr",null,[Plt,u("td",null,[u("div",Ult,[ne(u("input",{type:"checkbox",id:"auto_title",required:"","onUpdate:modelValue":e[29]||(e[29]=h=>r.configFile.auto_title=h),onChange:e[30]||(e[30]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.auto_title]])])])])])]),_:1}),Oe(o,{title:"User",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",Flt,[u("tr",null,[Blt,u("td",Glt,[ne(u("input",{type:"text",id:"user_name",required:"","onUpdate:modelValue":e[31]||(e[31]=h=>r.configFile.user_name=h),onChange:e[32]||(e[32]=h=>s.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.user_name]])])]),u("tr",null,[zlt,u("td",Vlt,[ne(u("textarea",{id:"user_description",required:"","onUpdate:modelValue":e[33]||(e[33]=h=>r.configFile.user_description=h),onChange:e[34]||(e[34]=h=>s.settingsChanged=!0),class:"min-h-[500px] w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.user_description]])])]),u("tr",null,[Hlt,u("td",qlt,[ne(u("input",{type:"checkbox",id:"use_user_informations_in_discussion",required:"","onUpdate:modelValue":e[35]||(e[35]=h=>r.configFile.use_user_informations_in_discussion=h),onChange:e[36]||(e[36]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.use_user_informations_in_discussion]])])]),u("tr",null,[Ylt,u("td",$lt,[ne(u("input",{type:"checkbox",id:"use_model_name_in_discussions",required:"","onUpdate:modelValue":e[37]||(e[37]=h=>r.configFile.use_model_name_in_discussions=h),onChange:e[38]||(e[38]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.use_model_name_in_discussions]])])]),u("tr",null,[Wlt,u("td",Klt,[u("label",jlt,[u("img",{src:"/user_infos/"+r.configFile.user_avatar,class:"w-50 h-50 rounded-full",style:{"max-width":"50px","max-height":"50px",cursor:"pointer"}},null,8,Qlt)]),u("input",{type:"file",id:"avatar-upload",style:{display:"none"},onChange:e[39]||(e[39]=(...h)=>r.uploadAvatar&&r.uploadAvatar(...h))},null,32)])]),u("tr",null,[Xlt,u("td",null,[u("div",Zlt,[ne(u("input",{type:"checkbox",id:"use_user_name_in_discussions",required:"","onUpdate:modelValue":e[40]||(e[40]=h=>r.configFile.use_user_name_in_discussions=h),onChange:e[41]||(e[41]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.use_user_name_in_discussions]])])])]),u("tr",null,[Jlt,u("td",ect,[ne(u("input",{type:"number",id:"max_n_predict",required:"","onUpdate:modelValue":e[42]||(e[42]=h=>r.configFile.min_n_predict=h),onChange:e[43]||(e[43]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.min_n_predict]])])]),u("tr",null,[tct,u("td",nct,[ne(u("input",{type:"number",id:"min_n_predict",required:"","onUpdate:modelValue":e[44]||(e[44]=h=>r.configFile.min_n_predict=h),onChange:e[45]||(e[45]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.min_n_predict]])])])])]),_:1}),Oe(o,{title:"Security settings",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",ict,[u("tr",null,[sct,u("td",rct,[ne(u("input",{type:"checkbox",id:"turn_on_code_execution",required:"","onUpdate:modelValue":e[46]||(e[46]=h=>r.configFile.turn_on_code_execution=h),onChange:e[47]||(e[47]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.turn_on_code_execution]])])]),u("tr",null,[oct,u("td",act,[ne(u("input",{type:"checkbox",id:"turn_on_code_validation",required:"","onUpdate:modelValue":e[48]||(e[48]=h=>r.configFile.turn_on_code_validation=h),onChange:e[49]||(e[49]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.turn_on_code_validation]])])]),u("tr",null,[lct,u("td",cct,[ne(u("input",{type:"checkbox",id:"turn_on_setting_update_validation",required:"","onUpdate:modelValue":e[50]||(e[50]=h=>r.configFile.turn_on_setting_update_validation=h),onChange:e[51]||(e[51]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.turn_on_setting_update_validation]])])]),u("tr",null,[dct,u("td",uct,[ne(u("input",{type:"checkbox",id:"turn_on_open_file_validation",required:"","onUpdate:modelValue":e[52]||(e[52]=h=>r.configFile.turn_on_open_file_validation=h),onChange:e[53]||(e[53]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.turn_on_open_file_validation]])])]),u("tr",null,[pct,u("td",_ct,[ne(u("input",{type:"checkbox",id:"turn_on_send_file_validation",required:"","onUpdate:modelValue":e[54]||(e[54]=h=>r.configFile.turn_on_send_file_validation=h),onChange:e[55]||(e[55]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.turn_on_send_file_validation]])])])])]),_:1}),Oe(o,{title:"Knowledge database",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",hct,[u("tr",null,[fct,u("td",null,[u("div",mct,[ne(u("input",{type:"checkbox",id:"activate_skills_lib",required:"","onUpdate:modelValue":e[56]||(e[56]=h=>r.configFile.activate_skills_lib=h),onChange:e[57]||(e[57]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.activate_skills_lib]])])])]),u("tr",null,[gct,u("td",bct,[ne(u("input",{type:"text",id:"skills_lib_database_name",required:"","onUpdate:modelValue":e[58]||(e[58]=h=>r.configFile.skills_lib_database_name=h),onChange:e[59]||(e[59]=h=>s.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Pe,r.configFile.skills_lib_database_name]])])])])]),_:1}),Oe(o,{title:"Internet search",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",Ect,[u("tr",null,[vct,u("td",null,[u("div",yct,[ne(u("input",{type:"checkbox",id:"fun_mode",required:"","onUpdate:modelValue":e[60]||(e[60]=h=>r.configFile.activate_internet_search=h),onChange:e[61]||(e[61]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.activate_internet_search]])])])]),u("tr",null,[Sct,u("td",null,[u("div",Tct,[ne(u("input",{type:"checkbox",id:"internet_quick_search",required:"","onUpdate:modelValue":e[62]||(e[62]=h=>r.configFile.internet_quick_search=h),onChange:e[63]||(e[63]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.internet_quick_search]])])])]),u("tr",null,[xct,u("td",null,[u("div",Cct,[ne(u("input",{type:"checkbox",id:"internet_activate_search_decision",required:"","onUpdate:modelValue":e[64]||(e[64]=h=>r.configFile.internet_activate_search_decision=h),onChange:e[65]||(e[65]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.internet_activate_search_decision]])])])]),u("tr",null,[Rct,u("td",null,[u("div",Act,[ne(u("input",{id:"internet_vectorization_chunk_size","onUpdate:modelValue":e[66]||(e[66]=h=>r.configFile.internet_vectorization_chunk_size=h),onChange:e[67]||(e[67]=h=>s.settingsChanged=!0),type:"range",min:"0",max:"64000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.internet_vectorization_chunk_size]]),ne(u("input",{"onUpdate:modelValue":e[68]||(e[68]=h=>r.configFile.internet_vectorization_chunk_size=h),type:"number",onChange:e[69]||(e[69]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.internet_vectorization_chunk_size]])])])]),u("tr",null,[wct,u("td",null,[u("div",Nct,[ne(u("input",{id:"internet_vectorization_overlap_size","onUpdate:modelValue":e[70]||(e[70]=h=>r.configFile.internet_vectorization_overlap_size=h),onChange:e[71]||(e[71]=h=>s.settingsChanged=!0),type:"range",min:"0",max:"1000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.internet_vectorization_overlap_size]]),ne(u("input",{"onUpdate:modelValue":e[72]||(e[72]=h=>r.configFile.internet_vectorization_overlap_size=h),type:"number",onChange:e[73]||(e[73]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.internet_vectorization_overlap_size]])])])]),u("tr",null,[Oct,u("td",null,[u("div",Ict,[ne(u("input",{id:"internet_vectorization_nb_chunks","onUpdate:modelValue":e[74]||(e[74]=h=>r.configFile.internet_vectorization_nb_chunks=h),onChange:e[75]||(e[75]=h=>s.settingsChanged=!0),type:"range",min:"0",max:"100",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.internet_vectorization_nb_chunks]]),ne(u("input",{"onUpdate:modelValue":e[76]||(e[76]=h=>r.configFile.internet_vectorization_nb_chunks=h),type:"number",onChange:e[77]||(e[77]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.internet_vectorization_nb_chunks]])])])]),u("tr",null,[Mct,u("td",null,[u("div",Dct,[ne(u("input",{id:"internet_nb_search_pages","onUpdate:modelValue":e[78]||(e[78]=h=>r.configFile.internet_nb_search_pages=h),onChange:e[79]||(e[79]=h=>s.settingsChanged=!0),type:"range",min:"1",max:"100",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.internet_nb_search_pages]]),ne(u("input",{"onUpdate:modelValue":e[80]||(e[80]=h=>r.configFile.internet_nb_search_pages=h),type:"number",onChange:e[81]||(e[81]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.internet_nb_search_pages]])])])])])]),_:1}),Oe(o,{title:"Latex",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",kct,[u("tr",null,[Lct,u("td",null,[u("div",Pct,[ne(u("input",{type:"text",id:"pdf_latex_path",required:"","onUpdate:modelValue":e[82]||(e[82]=h=>r.configFile.pdf_latex_path=h),onChange:e[83]||(e[83]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.pdf_latex_path]])])])])])]),_:1}),Oe(o,{title:"Boost",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",Uct,[u("tr",null,[Fct,u("td",null,[u("div",Bct,[ne(u("input",{type:"text",id:"positive_boost",required:"","onUpdate:modelValue":e[84]||(e[84]=h=>r.configFile.positive_boost=h),onChange:e[85]||(e[85]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.positive_boost]])])])]),u("tr",null,[Gct,u("td",null,[u("div",zct,[ne(u("input",{type:"text",id:"negative_boost",required:"","onUpdate:modelValue":e[86]||(e[86]=h=>r.configFile.negative_boost=h),onChange:e[87]||(e[87]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.negative_boost]])])])]),u("tr",null,[Vct,u("td",null,[u("div",Hct,[ne(u("input",{type:"text",id:"force_output_language_to_be",required:"","onUpdate:modelValue":e[88]||(e[88]=h=>r.configFile.force_output_language_to_be=h),onChange:e[89]||(e[89]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.force_output_language_to_be]])])])]),u("tr",null,[qct,u("td",null,[u("div",Yct,[ne(u("input",{type:"checkbox",id:"fun_mode",required:"","onUpdate:modelValue":e[90]||(e[90]=h=>r.configFile.fun_mode=h),onChange:e[91]||(e[91]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.fun_mode]])])])])])]),_:1}),Oe(o,{title:"Whisper audio transcription",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",$ct,[u("tr",null,[Wct,u("td",null,[u("div",Kct,[ne(u("select",{id:"whisper_model","onUpdate:modelValue":e[92]||(e[92]=h=>r.configFile.whisper_model=h),onChange:e[93]||(e[93]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),M($e,null,ct(r.whisperModels,h=>(w(),M("option",{key:h,value:h},fe(h),9,jct))),128))],544),[[zn,r.configFile.whisper_model]])])])])])]),_:1}),Oe(o,{title:"Browser Audio",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",Qct,[u("tr",null,[Xct,u("td",null,[u("div",Zct,[ne(u("input",{type:"checkbox",id:"activate_audio_infos",required:"","onUpdate:modelValue":e[94]||(e[94]=h=>r.configFile.activate_audio_infos=h),onChange:e[95]||(e[95]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.activate_audio_infos]])])])]),u("tr",null,[Jct,u("td",null,[u("div",edt,[ne(u("input",{type:"checkbox",id:"audio_auto_send_input",required:"","onUpdate:modelValue":e[96]||(e[96]=h=>r.configFile.audio_auto_send_input=h),onChange:e[97]||(e[97]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.audio_auto_send_input]])])])]),u("tr",null,[tdt,u("td",null,[u("div",ndt,[ne(u("input",{type:"checkbox",id:"auto_speak",required:"","onUpdate:modelValue":e[98]||(e[98]=h=>r.configFile.auto_speak=h),onChange:e[99]||(e[99]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.auto_speak]])])])]),u("tr",null,[idt,u("td",null,[ne(u("input",{id:"audio_pitch","onUpdate:modelValue":e[100]||(e[100]=h=>r.configFile.audio_pitch=h),onChange:e[101]||(e[101]=h=>s.settingsChanged=!0),type:"range",min:"0",max:"10",step:"0.1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.audio_pitch]]),ne(u("input",{"onUpdate:modelValue":e[102]||(e[102]=h=>r.configFile.audio_pitch=h),onChange:e[103]||(e[103]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.audio_pitch]])])]),u("tr",null,[sdt,u("td",null,[ne(u("input",{id:"audio_silenceTimer","onUpdate:modelValue":e[104]||(e[104]=h=>r.configFile.audio_silenceTimer=h),onChange:e[105]||(e[105]=h=>s.settingsChanged=!0),type:"range",min:"0",max:"10000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.audio_silenceTimer]]),ne(u("input",{"onUpdate:modelValue":e[106]||(e[106]=h=>r.configFile.audio_silenceTimer=h),onChange:e[107]||(e[107]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.audio_silenceTimer]])])]),u("tr",null,[rdt,u("td",null,[ne(u("select",{id:"audio_in_language","onUpdate:modelValue":e[108]||(e[108]=h=>r.configFile.audio_in_language=h),onChange:e[109]||(e[109]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),M($e,null,ct(r.audioLanguages,h=>(w(),M("option",{key:h.code,value:h.code},fe(h.name),9,odt))),128))],544),[[zn,r.configFile.audio_in_language]])])]),u("tr",null,[adt,u("td",null,[ne(u("select",{id:"audio_out_voice","onUpdate:modelValue":e[110]||(e[110]=h=>r.configFile.audio_out_voice=h),onChange:e[111]||(e[111]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),M($e,null,ct(s.audioVoices,h=>(w(),M("option",{key:h.name,value:h.name},fe(h.name),9,ldt))),128))],544),[[zn,r.configFile.audio_out_voice]])])])])]),_:1})])],2)]),u("div",cdt,[u("div",ddt,[u("button",{onClick:e[112]||(e[112]=Te(h=>s.data_conf_collapsed=!s.data_conf_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[ne(u("div",null,pdt,512),[[Ot,s.data_conf_collapsed]]),ne(u("div",null,hdt,512),[[Ot,!s.data_conf_collapsed]]),fdt])]),u("div",{class:Ye([{hidden:s.data_conf_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[Oe(o,{title:"Data Vectorization",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",mdt,[u("tr",null,[gdt,u("td",null,[u("div",bdt,[ne(u("input",{type:"checkbox",id:"summerize_discussion",required:"","onUpdate:modelValue":e[113]||(e[113]=h=>r.configFile.summerize_discussion=h),onChange:e[114]||(e[114]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.summerize_discussion]])])])]),u("tr",null,[Edt,u("td",null,[u("div",vdt,[ne(u("input",{type:"checkbox",id:"data_vectorization_visualize_on_vectorization",required:"","onUpdate:modelValue":e[115]||(e[115]=h=>r.configFile.data_vectorization_visualize_on_vectorization=h),onChange:e[116]||(e[116]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.data_vectorization_visualize_on_vectorization]])])])]),u("tr",null,[ydt,u("td",null,[u("div",Sdt,[ne(u("input",{type:"checkbox",id:"data_vectorization_build_keys_words",required:"","onUpdate:modelValue":e[117]||(e[117]=h=>r.configFile.data_vectorization_build_keys_words=h),onChange:e[118]||(e[118]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.data_vectorization_build_keys_words]])])])]),u("tr",null,[Tdt,u("td",null,[u("div",xdt,[ne(u("input",{type:"checkbox",id:"data_vectorization_force_first_chunk",required:"","onUpdate:modelValue":e[119]||(e[119]=h=>r.configFile.data_vectorization_force_first_chunk=h),onChange:e[120]||(e[120]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.data_vectorization_force_first_chunk]])])])]),u("tr",null,[Cdt,u("td",null,[u("div",Rdt,[ne(u("input",{type:"checkbox",id:"data_vectorization_put_chunk_informations_into_context",required:"","onUpdate:modelValue":e[121]||(e[121]=h=>r.configFile.data_vectorization_put_chunk_informations_into_context=h),onChange:e[122]||(e[122]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.data_vectorization_put_chunk_informations_into_context]])])])]),u("tr",null,[Adt,u("td",null,[ne(u("select",{id:"data_vectorization_method",required:"","onUpdate:modelValue":e[123]||(e[123]=h=>r.configFile.data_vectorization_method=h),onChange:e[124]||(e[124]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},Mdt,544),[[zn,r.configFile.data_vectorization_method]])])]),u("tr",null,[Ddt,u("td",kdt,[ne(u("input",{type:"text",id:"data_vectorization_sentense_transformer_model",required:"","onUpdate:modelValue":e[125]||(e[125]=h=>r.configFile.data_vectorization_sentense_transformer_model=h),onChange:e[126]||(e[126]=h=>s.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Pe,r.configFile.data_vectorization_sentense_transformer_model]])])]),u("tr",null,[Ldt,u("td",null,[ne(u("select",{id:"data_visualization_method",required:"","onUpdate:modelValue":e[127]||(e[127]=h=>r.configFile.data_visualization_method=h),onChange:e[128]||(e[128]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},Fdt,544),[[zn,r.configFile.data_visualization_method]])])]),u("tr",null,[Bdt,u("td",null,[u("div",Gdt,[ne(u("input",{type:"checkbox",id:"data_vectorization_save_db",required:"","onUpdate:modelValue":e[129]||(e[129]=h=>r.configFile.data_vectorization_save_db=h),onChange:e[130]||(e[130]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.data_vectorization_save_db]])])])]),u("tr",null,[zdt,u("td",null,[ne(u("input",{id:"data_vectorization_chunk_size","onUpdate:modelValue":e[131]||(e[131]=h=>r.configFile.data_vectorization_chunk_size=h),onChange:e[132]||(e[132]=h=>s.settingsChanged=!0),type:"range",min:"0",max:"64000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.data_vectorization_chunk_size]]),ne(u("input",{"onUpdate:modelValue":e[133]||(e[133]=h=>r.configFile.data_vectorization_chunk_size=h),type:"number",onChange:e[134]||(e[134]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.data_vectorization_chunk_size]])])]),u("tr",null,[Vdt,u("td",null,[ne(u("input",{id:"data_vectorization_overlap_size","onUpdate:modelValue":e[135]||(e[135]=h=>r.configFile.data_vectorization_overlap_size=h),onChange:e[136]||(e[136]=h=>s.settingsChanged=!0),type:"range",min:"0",max:"64000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.data_vectorization_overlap_size]]),ne(u("input",{"onUpdate:modelValue":e[137]||(e[137]=h=>r.configFile.data_vectorization_overlap_size=h),type:"number",onChange:e[138]||(e[138]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.data_vectorization_overlap_size]])])]),u("tr",null,[Hdt,u("td",null,[ne(u("input",{id:"data_vectorization_nb_chunks","onUpdate:modelValue":e[139]||(e[139]=h=>r.configFile.data_vectorization_nb_chunks=h),onChange:e[140]||(e[140]=h=>s.settingsChanged=!0),type:"range",min:"0",max:"1000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.data_vectorization_nb_chunks]]),ne(u("input",{"onUpdate:modelValue":e[141]||(e[141]=h=>r.configFile.data_vectorization_nb_chunks=h),type:"number",onChange:e[142]||(e[142]=h=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.data_vectorization_nb_chunks]])])])])]),_:1})],2)]),u("div",qdt,[u("div",Ydt,[u("button",{onClick:e[143]||(e[143]=Te(h=>s.servers_conf_collapsed=!s.servers_conf_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[ne(u("div",null,Wdt,512),[[Ot,s.servers_conf_collapsed]]),ne(u("div",null,jdt,512),[[Ot,!s.servers_conf_collapsed]]),Qdt])]),u("div",{class:Ye([{hidden:s.servers_conf_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[Oe(o,{title:"Lollms service",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",Xdt,[u("tr",null,[Zdt,u("td",Jdt,[ne(u("input",{type:"text",id:"host",required:"","onUpdate:modelValue":e[144]||(e[144]=h=>r.configFile.host=h),onChange:e[145]||(e[145]=h=>s.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Pe,r.configFile.host]])])]),u("tr",null,[eut,u("td",tut,[ne(u("input",{type:"number",step:"1",id:"port",required:"","onUpdate:modelValue":e[146]||(e[146]=h=>r.configFile.port=h),onChange:e[147]||(e[147]=h=>s.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Pe,r.configFile.port]])])]),u("tr",null,[nut,u("td",iut,[ne(u("input",{type:"checkbox",id:"headless_server_mode",required:"","onUpdate:modelValue":e[148]||(e[148]=h=>r.configFile.headless_server_mode=h),onChange:e[149]||(e[149]=h=>s.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[ut,r.configFile.headless_server_mode]])])])])]),_:1}),Oe(o,{title:"Stable diffusion service",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",sut,[u("tr",null,[rut,u("td",null,[u("div",out,[ne(u("input",{type:"checkbox",id:"enable_sd_service",required:"","onUpdate:modelValue":e[150]||(e[150]=h=>r.configFile.enable_sd_service=h),onChange:e[151]||(e[151]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.enable_sd_service]])])]),u("td",null,[u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[152]||(e[152]=h=>this.$store.state.messageBox.showMessage("Activates Stable diffusion service. The service will be automatically loaded at startup alowing you to use the stable diffusion endpoint to generate images"))},lut)])]),u("tr",null,[cut,u("td",null,[u("div",dut,[u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[153]||(e[153]=(...h)=>r.reinstallSDService&&r.reinstallSDService(...h))},"install sd service"),u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[154]||(e[154]=(...h)=>r.upgradeSDService&&r.upgradeSDService(...h))},"upgrade sd service"),u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[155]||(e[155]=(...h)=>r.startSDService&&r.startSDService(...h))},"start sd service"),u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[156]||(e[156]=(...h)=>r.showSD&&r.showSD(...h))},"show sd ui"),uut])])]),u("tr",null,[put,u("td",null,[u("div",_ut,[ne(u("input",{type:"text",id:"sd_base_url",required:"","onUpdate:modelValue":e[157]||(e[157]=h=>r.configFile.sd_base_url=h),onChange:e[158]||(e[158]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.sd_base_url]])])])])])]),_:1}),Oe(o,{title:"ComfyUI service",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",hut,[u("tr",null,[fut,u("td",null,[u("div",mut,[ne(u("input",{type:"checkbox",id:"enable_comfyui_service",required:"","onUpdate:modelValue":e[159]||(e[159]=h=>r.configFile.enable_comfyui_service=h),onChange:e[160]||(e[160]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.enable_comfyui_service]])])]),u("td",null,[u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[161]||(e[161]=h=>this.$store.state.messageBox.showMessage("Activates Stable diffusion service. The service will be automatically loaded at startup alowing you to use the stable diffusion endpoint to generate images"))},but)])]),u("tr",null,[Eut,u("td",null,[u("div",vut,[u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[162]||(e[162]=(...h)=>r.reinstallComfyUIService&&r.reinstallComfyUIService(...h))},"install comfyui service"),u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[163]||(e[163]=(...h)=>r.upgradeComfyUIService&&r.upgradeComfyUIService(...h))},"upgrade comfyui service"),u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[164]||(e[164]=(...h)=>r.startComfyUIService&&r.startComfyUIService(...h))},"start comfyui service"),u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[165]||(e[165]=(...h)=>r.showComfyui&&r.showComfyui(...h))},"show comfyui"),yut])])]),u("tr",null,[Sut,u("td",null,[u("div",Tut,[ne(u("input",{type:"text",id:"comfyui_base_url",required:"","onUpdate:modelValue":e[166]||(e[166]=h=>r.configFile.comfyui_base_url=h),onChange:e[167]||(e[167]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.comfyui_base_url]])])])])])]),_:1}),Oe(o,{title:"Motion Ctrl service",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",xut,[u("tr",null,[Cut,u("td",null,[u("div",Rut,[ne(u("input",{type:"checkbox",id:"enable_motion_ctrl_service",required:"","onUpdate:modelValue":e[168]||(e[168]=h=>r.configFile.enable_motion_ctrl_service=h),onChange:e[169]||(e[169]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.enable_motion_ctrl_service]])])]),u("td",null,[u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[170]||(e[170]=h=>this.$store.state.messageBox.showMessage("Activates Motion ctrl service. The service will be automatically loaded at startup alowing you to use the motoin control endpoint to generate videos"))},wut)])]),u("tr",null,[Nut,u("td",null,[u("div",Out,[u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[171]||(e[171]=(...h)=>r.reinstallMotionCtrlService&&r.reinstallMotionCtrlService(...h))},"install Motion Ctrl service")])])]),u("tr",null,[Iut,u("td",null,[u("div",Mut,[ne(u("input",{type:"text",id:"sd_base_url",required:"","onUpdate:modelValue":e[172]||(e[172]=h=>r.configFile.sd_base_url=h),onChange:e[173]||(e[173]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.sd_base_url]])])])])])]),_:1}),Oe(o,{title:"Ollama service",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",Dut,[u("tr",null,[kut,u("td",null,[u("div",Lut,[ne(u("input",{type:"checkbox",id:"enable_ollama_service",required:"","onUpdate:modelValue":e[174]||(e[174]=h=>r.configFile.enable_ollama_service=h),onChange:e[175]||(e[175]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.enable_ollama_service]])])]),u("td",null,[u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[176]||(e[176]=h=>this.$store.state.messageBox.showMessage(`Activates ollama service. The service will be automatically loaded at startup alowing you to use the ollama binding. If you are using windows, this uses wsl which requires you to have it installed or at least activated. If You are using windows, this will install wsl so you need to activate it. -Here is how you can do that`))},Lut)])]),u("tr",null,[Put,u("td",null,[u("div",Uut,[u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[177]||(e[177]=(...h)=>r.reinstallOLLAMAService&&r.reinstallOLLAMAService(...h))},"install ollama service"),u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[178]||(e[178]=(...h)=>r.startollamaService&&r.startollamaService(...h))},"start ollama service")])])]),u("tr",null,[Fut,u("td",null,[u("div",But,[ne(u("input",{type:"text",id:"ollama_base_url",required:"","onUpdate:modelValue":e[179]||(e[179]=h=>r.configFile.ollama_base_url=h),onChange:e[180]||(e[180]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.ollama_base_url]])])])])])]),_:1}),Oe(o,{title:"vLLM service",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",Gut,[u("tr",null,[zut,u("td",null,[u("div",Vut,[ne(u("input",{type:"checkbox",id:"enable_vllm_service",required:"","onUpdate:modelValue":e[181]||(e[181]=h=>r.configFile.enable_vllm_service=h),onChange:e[182]||(e[182]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.enable_vllm_service]])])]),u("td",null,[u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[183]||(e[183]=h=>this.$store.state.messageBox.showMessage(`Activates vllm service. The service will be automatically loaded at startup alowing you to use the elf binding. +Here is how you can do that`))},Uut)])]),u("tr",null,[Fut,u("td",null,[u("div",But,[u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[177]||(e[177]=(...h)=>r.reinstallOLLAMAService&&r.reinstallOLLAMAService(...h))},"install ollama service"),u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[178]||(e[178]=(...h)=>r.startollamaService&&r.startollamaService(...h))},"start ollama service")])])]),u("tr",null,[Gut,u("td",null,[u("div",zut,[ne(u("input",{type:"text",id:"ollama_base_url",required:"","onUpdate:modelValue":e[179]||(e[179]=h=>r.configFile.ollama_base_url=h),onChange:e[180]||(e[180]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.ollama_base_url]])])])])])]),_:1}),Oe(o,{title:"vLLM service",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",Vut,[u("tr",null,[Hut,u("td",null,[u("div",qut,[ne(u("input",{type:"checkbox",id:"enable_vllm_service",required:"","onUpdate:modelValue":e[181]||(e[181]=h=>r.configFile.enable_vllm_service=h),onChange:e[182]||(e[182]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.enable_vllm_service]])])]),u("td",null,[u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[183]||(e[183]=h=>this.$store.state.messageBox.showMessage(`Activates vllm service. The service will be automatically loaded at startup alowing you to use the elf binding. If you are using windows, this uses wsl which requires you to have it installed or at least activated. If You are using windows, this will install wsl so you need to activate it. -Here is how you can do that`))},qut)])]),u("tr",null,[Yut,u("td",null,[u("div",$ut,[u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[184]||(e[184]=(...h)=>r.reinstallvLLMService&&r.reinstallvLLMService(...h))},"install vLLM service"),u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[185]||(e[185]=(...h)=>r.startvLLMService&&r.startvLLMService(...h))},"start vllm service")])])]),u("tr",null,[Wut,u("td",null,[u("div",Kut,[ne(u("input",{type:"text",id:"vllm_url",required:"","onUpdate:modelValue":e[186]||(e[186]=h=>r.configFile.vllm_url=h),onChange:e[187]||(e[187]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.vllm_url]])])])]),u("tr",null,[jut,u("td",null,[u("div",Qut,[u("div",Xut,[Zut,u("p",Jut,[ne(u("input",{type:"text",id:"temp-val","onUpdate:modelValue":e[188]||(e[188]=h=>r.configFile.vllm_gpu_memory_utilization=h),onChange:e[189]||(e[189]=h=>s.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.vllm_gpu_memory_utilization]])])]),ne(u("input",{id:"vllm_gpu_memory_utilization",onChange:e[190]||(e[190]=h=>s.settingsChanged=!0),type:"range","onUpdate:modelValue":e[191]||(e[191]=h=>r.configFile.vllm_gpu_memory_utilization=h),min:"0.10",max:"1",step:"0.01",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.vllm_gpu_memory_utilization]])])])]),u("tr",null,[ept,u("td",null,[u("div",tpt,[ne(u("input",{type:"number",id:"vllm_max_num_seqs",min:"64",max:"2048",required:"","onUpdate:modelValue":e[192]||(e[192]=h=>r.configFile.vllm_max_num_seqs=h),onChange:e[193]||(e[193]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.vllm_max_num_seqs]])])])]),u("tr",null,[npt,u("td",null,[u("div",ipt,[ne(u("input",{type:"number",id:"vllm_max_model_len",min:"2048",max:"1000000",required:"","onUpdate:modelValue":e[194]||(e[194]=h=>r.configFile.vllm_max_model_len=h),onChange:e[195]||(e[195]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.vllm_max_model_len]])])])]),u("tr",null,[spt,u("td",null,[u("div",rpt,[ne(u("input",{type:"text",id:"vllm_model_path",required:"","onUpdate:modelValue":e[196]||(e[196]=h=>r.configFile.vllm_model_path=h),onChange:e[197]||(e[197]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.vllm_model_path]])])])])])]),_:1}),Oe(o,{title:"Petals service",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",opt,[u("tr",null,[apt,u("td",null,[u("div",lpt,[ne(u("input",{type:"checkbox",id:"enable_petals_service",required:"","onUpdate:modelValue":e[198]||(e[198]=h=>r.configFile.enable_petals_service=h),onChange:e[199]||(e[199]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.enable_petals_service]])])]),u("td",null,[u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[200]||(e[200]=h=>this.$store.state.messageBox.showMessage(`Activates Petals service. The service will be automatically loaded at startup alowing you to use the petals endpoint to generate text in a distributed network. +Here is how you can do that`))},$ut)])]),u("tr",null,[Wut,u("td",null,[u("div",Kut,[u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[184]||(e[184]=(...h)=>r.reinstallvLLMService&&r.reinstallvLLMService(...h))},"install vLLM service"),u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[185]||(e[185]=(...h)=>r.startvLLMService&&r.startvLLMService(...h))},"start vllm service")])])]),u("tr",null,[jut,u("td",null,[u("div",Qut,[ne(u("input",{type:"text",id:"vllm_url",required:"","onUpdate:modelValue":e[186]||(e[186]=h=>r.configFile.vllm_url=h),onChange:e[187]||(e[187]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.vllm_url]])])])]),u("tr",null,[Xut,u("td",null,[u("div",Zut,[u("div",Jut,[ept,u("p",tpt,[ne(u("input",{type:"text",id:"temp-val","onUpdate:modelValue":e[188]||(e[188]=h=>r.configFile.vllm_gpu_memory_utilization=h),onChange:e[189]||(e[189]=h=>s.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.vllm_gpu_memory_utilization]])])]),ne(u("input",{id:"vllm_gpu_memory_utilization",onChange:e[190]||(e[190]=h=>s.settingsChanged=!0),type:"range","onUpdate:modelValue":e[191]||(e[191]=h=>r.configFile.vllm_gpu_memory_utilization=h),min:"0.10",max:"1",step:"0.01",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.vllm_gpu_memory_utilization]])])])]),u("tr",null,[npt,u("td",null,[u("div",ipt,[ne(u("input",{type:"number",id:"vllm_max_num_seqs",min:"64",max:"2048",required:"","onUpdate:modelValue":e[192]||(e[192]=h=>r.configFile.vllm_max_num_seqs=h),onChange:e[193]||(e[193]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.vllm_max_num_seqs]])])])]),u("tr",null,[spt,u("td",null,[u("div",rpt,[ne(u("input",{type:"number",id:"vllm_max_model_len",min:"2048",max:"1000000",required:"","onUpdate:modelValue":e[194]||(e[194]=h=>r.configFile.vllm_max_model_len=h),onChange:e[195]||(e[195]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.vllm_max_model_len]])])])]),u("tr",null,[opt,u("td",null,[u("div",apt,[ne(u("input",{type:"text",id:"vllm_model_path",required:"","onUpdate:modelValue":e[196]||(e[196]=h=>r.configFile.vllm_model_path=h),onChange:e[197]||(e[197]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.vllm_model_path]])])])])])]),_:1}),Oe(o,{title:"Petals service",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",lpt,[u("tr",null,[cpt,u("td",null,[u("div",dpt,[ne(u("input",{type:"checkbox",id:"enable_petals_service",required:"","onUpdate:modelValue":e[198]||(e[198]=h=>r.configFile.enable_petals_service=h),onChange:e[199]||(e[199]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.enable_petals_service]])])]),u("td",null,[u("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[200]||(e[200]=h=>this.$store.state.messageBox.showMessage(`Activates Petals service. The service will be automatically loaded at startup alowing you to use the petals endpoint to generate text in a distributed network. If You are using windows, this will install wsl so you need to activate it. -Here is how you can do that`))},dpt)])]),u("tr",null,[upt,u("td",null,[u("div",ppt,[u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[201]||(e[201]=(...h)=>r.reinstallPetalsService&&r.reinstallPetalsService(...h))},"install petals service")])])]),u("tr",null,[_pt,u("td",null,[u("div",hpt,[ne(u("input",{type:"text",id:"petals_base_url",required:"","onUpdate:modelValue":e[202]||(e[202]=h=>r.configFile.petals_base_url=h),onChange:e[203]||(e[203]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.petals_base_url]])])])])])]),_:1}),Oe(o,{title:"Elastic search Service (under construction)",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",fpt,[u("tr",null,[mpt,u("td",null,[u("div",gpt,[ne(u("input",{type:"checkbox",id:"elastic_search_service",required:"","onUpdate:modelValue":e[204]||(e[204]=h=>r.configFile.elastic_search_service=h),onChange:e[205]||(e[205]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.elastic_search_service]])])])]),u("tr",null,[bpt,u("td",null,[u("div",Ept,[u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[206]||(e[206]=(...h)=>r.reinstallElasticSearchService&&r.reinstallElasticSearchService(...h))},"install ElasticSearch service")])])]),u("tr",null,[vpt,u("td",null,[u("div",ypt,[ne(u("input",{type:"text",id:"elastic_search_url",required:"","onUpdate:modelValue":e[207]||(e[207]=h=>r.configFile.elastic_search_url=h),onChange:e[208]||(e[208]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.elastic_search_url]])])])])])]),_:1}),Oe(o,{title:"XTTS service",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",Spt,[u("tr",null,[Tpt,u("td",null,[u("div",xpt,[ne(u("input",{type:"checkbox",id:"enable_voice_service",required:"","onUpdate:modelValue":e[209]||(e[209]=h=>r.configFile.enable_voice_service=h),onChange:e[210]||(e[210]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.enable_voice_service]])])])]),u("tr",null,[Cpt,u("td",null,[u("div",Rpt,[u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[211]||(e[211]=(...h)=>r.reinstallAudioService&&r.reinstallAudioService(...h))},"install xtts service"),u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[212]||(e[212]=(...h)=>r.startAudioService&&r.startAudioService(...h))},"start xtts service")])])]),u("tr",null,[Apt,u("td",null,[u("div",wpt,[ne(u("input",{type:"text",id:"xtts_base_url",required:"","onUpdate:modelValue":e[213]||(e[213]=h=>r.configFile.xtts_base_url=h),onChange:e[214]||(e[214]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.xtts_base_url]])])])]),u("tr",null,[Npt,u("td",null,[u("div",Opt,[ne(u("select",{"onUpdate:modelValue":e[215]||(e[215]=h=>r.current_language=h),onChange:e[216]||(e[216]=h=>s.settingsChanged=!0),disabled:!r.enable_voice_service},[(w(!0),M($e,null,ct(s.voice_languages,(h,E)=>(w(),M("option",{key:E,value:h},fe(E),9,Mpt))),128))],40,Ipt),[[zn,r.current_language]])])])]),u("tr",null,[Dpt,u("td",null,[u("div",kpt,[ne(u("select",{"onUpdate:modelValue":e[217]||(e[217]=h=>r.current_voice=h),onChange:e[218]||(e[218]=h=>s.settingsChanged=!0),disabled:!r.enable_voice_service},[(w(!0),M($e,null,ct(s.voices,h=>(w(),M("option",{key:h,value:h},fe(h),9,Ppt))),128))],40,Lpt),[[zn,r.current_voice]])])])]),u("tr",null,[Upt,u("td",null,[u("div",Fpt,[ne(u("input",{type:"checkbox",id:"auto_read",required:"","onUpdate:modelValue":e[219]||(e[219]=h=>r.configFile.auto_read=h),onChange:e[220]||(e[220]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600",disabled:!r.enable_voice_service},null,40,Bpt),[[ut,r.configFile.auto_read]])])])])])]),_:1})],2)]),u("div",Gpt,[u("div",zpt,[u("button",{onClick:e[221]||(e[221]=Te(h=>s.bzc_collapsed=!s.bzc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[ne(u("div",null,Hpt,512),[[Ot,s.bzc_collapsed]]),ne(u("div",null,Ypt,512),[[Ot,!s.bzc_collapsed]]),$pt,r.configFile.binding_name?q("",!0):(w(),M("div",Wpt,[Kpt,je(" No binding selected! ")])),r.configFile.binding_name?(w(),M("div",jpt,"|")):q("",!0),r.configFile.binding_name?(w(),M("div",Qpt,[u("div",Xpt,[u("img",{src:r.imgBinding,class:"w-8 h-8 rounded-full object-fill text-blue-700"},null,8,Zpt),u("h3",Jpt,fe(r.binding_name),1)])])):q("",!0)])]),u("div",{class:Ye([{hidden:s.bzc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[r.bindingsZoo&&r.bindingsZoo.length>0?(w(),M("div",e_t,[u("label",t_t," Bindings: ("+fe(r.bindingsZoo.length)+") ",1),u("div",{class:Ye(["overflow-y-auto no-scrollbar p-2 pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4",s.bzl_collapsed?"":"max-h-96"])},[Oe(rs,{name:"list"},{default:Je(()=>[(w(!0),M($e,null,ct(r.bindingsZoo,(h,E)=>(w(),xt(a,{ref_for:!0,ref:"bindingZoo",key:"index-"+E+"-"+h.folder,binding:h,"on-selected":r.onBindingSelected,"on-reinstall":r.onReinstallBinding,"on-unInstall":r.onUnInstallBinding,"on-install":r.onInstallBinding,"on-settings":r.onSettingsBinding,"on-reload-binding":r.onReloadBinding,selected:h.folder===r.configFile.binding_name},null,8,["binding","on-selected","on-reinstall","on-unInstall","on-install","on-settings","on-reload-binding","selected"]))),128))]),_:1})],2)])):q("",!0),s.bzl_collapsed?(w(),M("button",{key:1,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Collapse",type:"button",onClick:e[222]||(e[222]=h=>s.bzl_collapsed=!s.bzl_collapsed)},i_t)):(w(),M("button",{key:2,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Expand",type:"button",onClick:e[223]||(e[223]=h=>s.bzl_collapsed=!s.bzl_collapsed)},r_t))],2)]),u("div",o_t,[u("div",a_t,[u("button",{onClick:e[224]||(e[224]=Te(h=>r.modelsZooToggleCollapse(),["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex items-center"},[ne(u("div",null,c_t,512),[[Ot,s.mzc_collapsed]]),ne(u("div",null,u_t,512),[[Ot,!s.mzc_collapsed]]),p_t,u("div",__t,[r.configFile.binding_name?q("",!0):(w(),M("div",h_t,[f_t,je(" Select binding first! ")])),!r.configFile.model_name&&r.configFile.binding_name?(w(),M("div",m_t,[g_t,je(" No model selected! ")])):q("",!0),r.configFile.model_name?(w(),M("div",b_t,"|")):q("",!0),r.configFile.model_name?(w(),M("div",E_t,[u("div",v_t,[u("img",{src:r.imgModel,class:"w-8 h-8 rounded-lg object-fill"},null,8,y_t),u("h3",S_t,fe(r.configFile.model_name),1)])])):q("",!0)])])]),u("div",{class:Ye([{hidden:s.mzc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[u("div",T_t,[u("div",x_t,[u("div",C_t,[s.searchModelInProgress?(w(),M("div",R_t,w_t)):q("",!0),s.searchModelInProgress?q("",!0):(w(),M("div",N_t,I_t))]),ne(u("input",{type:"search",class:"block w-full p-4 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Search models...",required:"","onUpdate:modelValue":e[225]||(e[225]=h=>s.searchModel=h),onKeyup:e[226]||(e[226]=wr((...h)=>r.searchModel_func&&r.searchModel_func(...h),["enter"]))},null,544),[[Pe,s.searchModel]]),s.searchModel?(w(),M("button",{key:0,onClick:e[227]||(e[227]=Te(h=>s.searchModel="",["stop"])),type:"button",class:"text-white absolute right-2.5 bottom-2.5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"}," Clear search")):q("",!0)])]),u("div",null,[ne(u("input",{"onUpdate:modelValue":e[228]||(e[228]=h=>s.show_only_installed_models=h),class:"m-2 p-2",type:"checkbox",ref:"only_installed"},null,512),[[ut,s.show_only_installed_models]]),M_t]),u("div",null,[Oe(l,{radioOptions:s.sortOptions,onRadioSelected:r.handleRadioSelected},null,8,["radioOptions","onRadioSelected"])]),D_t,s.is_loading_zoo?(w(),M("div",k_t,U_t)):q("",!0),s.models_zoo&&s.models_zoo.length>0?(w(),M("div",F_t,[u("label",B_t," Models: ("+fe(s.models_zoo.length)+") ",1),u("div",{class:Ye(["overflow-y-auto p-2 pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4 overflow-y-scroll w-full dark:bg-bg-dark scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",s.mzl_collapsed?"":"max-h-96"])},[Oe(rs,{name:"list"},{default:Je(()=>[(w(!0),M($e,null,ct(r.rendered_models_zoo,(h,E)=>(w(),xt(d,{ref_for:!0,ref:"modelZoo",key:"index-"+E+"-"+h.name,model:h,"is-installed":h.isInstalled,"on-install":r.onInstall,"on-uninstall":r.onUninstall,"on-selected":r.onModelSelected,selected:h.name===r.configFile.model_name,model_type:h.model_type,"on-copy":r.onCopy,"on-copy-link":r.onCopyLink,"on-cancel-install":r.onCancelInstall},null,8,["model","is-installed","on-install","on-uninstall","on-selected","selected","model_type","on-copy","on-copy-link","on-cancel-install"]))),128)),u("button",{ref:"load_more_models",class:"relative items-start p-4 hover:bg-primary-light rounded-lg mb-2 shadow-lg border-2 select-none",onClick:e[229]||(e[229]=(...h)=>r.load_more_models&&r.load_more_models(...h))},"Load more models",512)]),_:1})],2)])):q("",!0),s.mzl_collapsed?(w(),M("button",{key:2,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Collapse",type:"button",onClick:e[230]||(e[230]=(...h)=>r.open_mzl&&r.open_mzl(...h))},z_t)):(w(),M("button",{key:3,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Expand",type:"button",onClick:e[231]||(e[231]=(...h)=>r.open_mzl&&r.open_mzl(...h))},H_t)),u("div",q_t,[u("div",Y_t,[u("div",null,[u("div",$_t,[W_t,ne(u("input",{type:"text","onUpdate:modelValue":e[232]||(e[232]=h=>s.reference_path=h),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Enter Path ...",required:""},null,512),[[Pe,s.reference_path]])]),u("button",{type:"button",onClick:e[233]||(e[233]=Te(h=>r.onCreateReference(),["stop"])),class:"text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"},"Add reference")]),s.modelDownlaodInProgress?q("",!0):(w(),M("div",K_t,[u("div",j_t,[Q_t,ne(u("input",{type:"text","onUpdate:modelValue":e[234]||(e[234]=h=>s.addModel.url=h),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Enter URL ...",required:""},null,512),[[Pe,s.addModel.url]])]),u("button",{type:"button",onClick:e[235]||(e[235]=Te(h=>r.onInstallAddModel(),["stop"])),class:"text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"},"Download")])),s.modelDownlaodInProgress?(w(),M("div",X_t,[Z_t,u("div",J_t,[u("div",eht,[u("div",tht,[nht,u("span",iht,fe(Math.floor(s.addModel.progress))+"%",1)]),u("div",{class:"mx-1 opacity-80 line-clamp-1",title:s.addModel.url},fe(s.addModel.url),9,sht),u("div",rht,[u("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en({width:s.addModel.progress+"%"})},null,4)]),u("div",oht,[u("span",aht,"Download speed: "+fe(r.speed_computed)+"/s",1),u("span",lht,fe(r.downloaded_size_computed)+"/"+fe(r.total_size_computed),1)])])]),u("div",cht,[u("div",dht,[u("div",uht,[u("button",{onClick:e[236]||(e[236]=Te((...h)=>r.onCancelInstall&&r.onCancelInstall(...h),["stop"])),type:"button",title:"Cancel download",class:"text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600"}," Cancel ")])])])])):q("",!0)])])],2)]),u("div",pht,[u("div",_ht,[u("button",{onClick:e[239]||(e[239]=Te(h=>s.pzc_collapsed=!s.pzc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 text-left w-full flex items-center"},[ne(u("div",null,fht,512),[[Ot,s.pzc_collapsed]]),ne(u("div",null,ght,512),[[Ot,!s.pzc_collapsed]]),bht,r.configFile.personalities?(w(),M("div",Eht,"|")):q("",!0),u("div",vht,fe(r.active_pesonality),1),r.configFile.personalities?(w(),M("div",yht,"|")):q("",!0),r.configFile.personalities?(w(),M("div",Sht,[r.mountedPersArr.length>0?(w(),M("div",Tht,[(w(!0),M($e,null,ct(r.mountedPersArr,(h,E)=>(w(),M("div",{class:"relative hover:-translate-y-2 duration-300 hover:z-10 shrink-0",key:E+"-"+h.name,ref_for:!0,ref:"mountedPersonalities"},[u("div",xht,[u("button",{onClick:Te(b=>r.onPersonalitySelected(h),["stop"])},[u("img",{src:s.bUrl+h.avatar,onError:e[237]||(e[237]=(...b)=>r.personalityImgPlacehodler&&r.personalityImgPlacehodler(...b)),class:Ye(["w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 group-hover:border-secondary",r.configFile.active_personality_id==r.configFile.personalities.indexOf(h.full_path)?"border-secondary":"border-transparent z-0"]),title:h.name},null,42,Rht)],8,Cht),u("button",{onClick:Te(b=>r.unmountPersonality(h),["stop"])},Nht,8,Aht)])]))),128))])):q("",!0)])):q("",!0),u("button",{onClick:e[238]||(e[238]=Te(h=>r.unmountAll(),["stop"])),class:"bg-bg-light hover:border-green-200 ml-5 dark:bg-bg-dark rounded-full border-2 border-transparent",title:"Unmount All"},Iht)])]),u("div",{class:Ye([{hidden:s.pzc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[u("div",Mht,[Dht,u("div",kht,[u("div",Lht,[s.searchPersonalityInProgress?(w(),M("div",Pht,Fht)):q("",!0),s.searchPersonalityInProgress?q("",!0):(w(),M("div",Bht,zht))]),ne(u("input",{type:"search",id:"personality-search",class:"block w-full p-4 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Search personality...",required:"","onUpdate:modelValue":e[240]||(e[240]=h=>s.searchPersonality=h),onKeyup:e[241]||(e[241]=Te((...h)=>r.searchPersonality_func&&r.searchPersonality_func(...h),["stop"]))},null,544),[[Pe,s.searchPersonality]]),s.searchPersonality?(w(),M("button",{key:0,onClick:e[242]||(e[242]=Te(h=>s.searchPersonality="",["stop"])),type:"button",class:"text-white absolute right-2.5 bottom-2.5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"}," Clear search")):q("",!0)])]),s.searchPersonality?q("",!0):(w(),M("div",Vht,[u("label",Hht," Personalities Category: ("+fe(s.persCatgArr.length)+") ",1),u("select",{id:"persCat",onChange:e[243]||(e[243]=h=>r.update_personality_category(h.target.value,r.refresh)),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},[(w(!0),M($e,null,ct(s.persCatgArr,(h,E)=>(w(),M("option",{key:E,selected:h==this.configFile.personality_category},fe(h),9,qht))),128))],32)])),u("div",null,[s.personalitiesFiltered.length>0?(w(),M("div",Yht,[u("label",$ht,fe(s.searchPersonality?"Search results":"Personalities")+": ("+fe(s.personalitiesFiltered.length)+") ",1),u("div",{class:Ye(["overflow-y-auto no-scrollbar p-2 pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4",s.pzl_collapsed?"":"max-h-96"])},[Oe(rs,{name:"bounce"},{default:Je(()=>[(w(!0),M($e,null,ct(s.personalitiesFiltered,(h,E)=>(w(),xt(c,{ref_for:!0,ref:"personalitiesZoo",key:"index-"+E+"-"+h.name,personality:h,select_language:!0,full_path:h.full_path,selected:r.configFile.active_personality_id==r.configFile.personalities.findIndex(b=>b===h.full_path||b===h.full_path+":"+h.language),"on-selected":r.onPersonalitySelected,"on-mount":r.mountPersonality,"on-un-mount":r.unmountPersonality,"on-remount":r.remountPersonality,"on-edit":r.editPersonality,"on-copy-to-custom":r.copyToCustom,"on-reinstall":r.onPersonalityReinstall,"on-settings":r.onSettingsPersonality,"on-copy-personality-name":r.onCopyPersonalityName},null,8,["personality","full_path","selected","on-selected","on-mount","on-un-mount","on-remount","on-edit","on-copy-to-custom","on-reinstall","on-settings","on-copy-personality-name"]))),128))]),_:1})],2)])):q("",!0)]),s.pzl_collapsed?(w(),M("button",{key:1,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Collapse",type:"button",onClick:e[244]||(e[244]=h=>s.pzl_collapsed=!s.pzl_collapsed)},Kht)):(w(),M("button",{key:2,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Expand",type:"button",onClick:e[245]||(e[245]=h=>s.pzl_collapsed=!s.pzl_collapsed)},Qht))],2)]),u("div",Xht,[u("div",Zht,[u("button",{onClick:e[247]||(e[247]=Te(h=>s.ezc_collapsed=!s.ezc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 text-left w-full flex items-center"},[ne(u("div",null,eft,512),[[Ot,s.ezc_collapsed]]),ne(u("div",null,nft,512),[[Ot,!s.ezc_collapsed]]),ift,r.configFile.extensions?(w(),M("div",sft,"|")):q("",!0),r.configFile.extensions?(w(),M("div",rft,[r.mountedExtensions.length>0?(w(),M("div",oft,[(w(!0),M($e,null,ct(r.mountedExtensions,(h,E)=>(w(),M("div",{class:"relative hover:-translate-y-2 duration-300 hover:z-10 shrink-0",key:E+"-"+h.name,ref_for:!0,ref:"mountedExtensions"},[u("div",aft,[u("button",null,[u("img",{src:s.bUrl+h.avatar,onError:e[246]||(e[246]=(...b)=>r.extensionImgPlacehodler&&r.extensionImgPlacehodler(...b)),class:Ye(["w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 group-hover:border-secondary","border-transparent z-0"]),title:h.name},null,40,lft)]),u("button",{onClick:Te(b=>r.unmountExtension(h),["stop"])},uft,8,cft)])]))),128))])):q("",!0)])):q("",!0)])]),u("div",{class:Ye([{hidden:s.ezc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[u("div",pft,[_ft,u("div",hft,[u("div",fft,[s.searchExtensionInProgress?(w(),M("div",mft,bft)):q("",!0),s.searchExtensionInProgress?q("",!0):(w(),M("div",Eft,yft))]),ne(u("input",{type:"search",id:"personality-search",class:"block w-full p-4 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Search extension...",required:"","onUpdate:modelValue":e[248]||(e[248]=h=>s.searchExtension=h),onKeyup:e[249]||(e[249]=Te((...h)=>n.searchExtension_func&&n.searchExtension_func(...h),["stop"]))},null,544),[[Pe,s.searchExtension]]),s.searchExtension?(w(),M("button",{key:0,onClick:e[250]||(e[250]=Te(h=>s.searchExtension="",["stop"])),type:"button",class:"text-white absolute right-2.5 bottom-2.5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"}," Clear search")):q("",!0)])]),s.searchExtension?q("",!0):(w(),M("div",Sft,[u("label",Tft," Extensions Category: ("+fe(s.extCatgArr.length)+") ",1),u("select",{id:"extCat",onChange:e[251]||(e[251]=h=>r.update_extension_category(h.target.value,r.refresh)),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},[(w(!0),M($e,null,ct(s.extCatgArr,(h,E)=>(w(),M("option",{key:E,selected:h==this.extension_category},fe(h),9,xft))),128))],32)])),u("div",null,[s.extensionsFiltered.length>0?(w(),M("div",Cft,[u("label",Rft,fe(s.searchExtension?"Search results":"Personalities")+": ("+fe(s.extensionsFiltered.length)+") ",1),u("div",{class:Ye(["overflow-y-auto no-scrollbar p-2 pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4",s.ezl_collapsed?"":"max-h-96"])},[(w(!0),M($e,null,ct(s.extensionsFiltered,(h,E)=>(w(),xt(_,{ref_for:!0,ref:"extensionsZoo",key:"index-"+E+"-"+h.name,extension:h,select_language:!0,full_path:h.full_path,"on-mount":r.mountExtension,"on-un-mount":r.unmountExtension,"on-remount":r.remountExtension,"on-reinstall":r.onExtensionReinstall,"on-settings":r.onSettingsExtension},null,8,["extension","full_path","on-mount","on-un-mount","on-remount","on-reinstall","on-settings"]))),128))],2)])):q("",!0)]),s.ezc_collapsed?(w(),M("button",{key:1,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Collapse",type:"button",onClick:e[252]||(e[252]=h=>s.ezl_collapsed=!s.ezl_collapsed)},wft)):(w(),M("button",{key:2,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Expand",type:"button",onClick:e[253]||(e[253]=h=>s.ezl_collapsed=!s.ezl_collapsed)},Oft))],2)]),u("div",Ift,[u("div",Mft,[u("button",{onClick:e[254]||(e[254]=Te(h=>s.mep_collapsed=!s.mep_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 text-left w-full flex items-center"},[ne(u("div",null,kft,512),[[Ot,s.mep_collapsed]]),ne(u("div",null,Pft,512),[[Ot,!s.mep_collapsed]]),Uft])]),u("div",{class:Ye([{hidden:s.mep_collapsed},"flex flex-col mb-2 px-3 pb-0"])},null,2)]),u("div",Fft,[u("div",Bft,[u("button",{onClick:e[255]||(e[255]=Te(h=>s.mc_collapsed=!s.mc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex items-center"},[ne(u("div",null,zft,512),[[Ot,s.mc_collapsed]]),ne(u("div",null,Hft,512),[[Ot,!s.mc_collapsed]]),qft])]),u("div",{class:Ye([{hidden:s.mc_collapsed},"flex flex-col mb-2 p-2"])},[u("div",Yft,[u("div",$ft,[ne(u("input",{id:"override-model-parameters",type:"checkbox",class:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-700 dark:focus:ring-offset-gray-700 focus:ring-2 dark:bg-gray-600 dark:border-gray-500",onClick:e[256]||(e[256]=Te(()=>{},["stop"])),"onUpdate:modelValue":e[257]||(e[257]=h=>r.configFile.override_personality_model_parameters=h),onChange:e[258]||(e[258]=h=>r.update_setting("override_personality_model_parameters",r.configFile.override_personality_model_parameters))},null,544),[[ut,r.configFile.override_personality_model_parameters]]),Wft])]),u("div",{class:Ye(r.configFile.override_personality_model_parameters?"":"pointer-events-none opacity-30")},[u("div",Kft,[jft,ne(u("input",{type:"text",id:"seed","onUpdate:modelValue":e[259]||(e[259]=h=>r.configFile.seed=h),class:"bg-gray-50 border border-gray-300 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,512),[[Pe,r.configFile.seed]])]),u("div",Qft,[u("div",Xft,[u("div",Zft,[Jft,u("p",emt,[ne(u("input",{type:"text",id:"temp-val","onUpdate:modelValue":e[260]||(e[260]=h=>r.configFile.temperature=h),onChange:e[261]||(e[261]=h=>s.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.temperature]])])]),ne(u("input",{id:"temperature",onChange:e[262]||(e[262]=h=>s.settingsChanged=!0),type:"range","onUpdate:modelValue":e[263]||(e[263]=h=>r.configFile.temperature=h),min:"0",max:"5",step:"0.1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.temperature]])])]),u("div",tmt,[u("div",nmt,[u("div",imt,[smt,u("p",rmt,[ne(u("input",{type:"text",id:"predict-val","onUpdate:modelValue":e[264]||(e[264]=h=>r.configFile.n_predict=h),onChange:e[265]||(e[265]=h=>s.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.n_predict]])])]),ne(u("input",{id:"predict",type:"range",onChange:e[266]||(e[266]=h=>s.settingsChanged=!0),"onUpdate:modelValue":e[267]||(e[267]=h=>r.configFile.n_predict=h),min:"0",max:"2048",step:"32",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.n_predict]])])]),u("div",omt,[u("div",amt,[u("div",lmt,[cmt,u("p",dmt,[ne(u("input",{type:"text",id:"top_k-val","onUpdate:modelValue":e[268]||(e[268]=h=>r.configFile.top_k=h),onChange:e[269]||(e[269]=h=>s.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.top_k]])])]),ne(u("input",{id:"top_k",type:"range",onChange:e[270]||(e[270]=h=>s.settingsChanged=!0),"onUpdate:modelValue":e[271]||(e[271]=h=>r.configFile.top_k=h),min:"0",max:"100",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.top_k]])])]),u("div",umt,[u("div",pmt,[u("div",_mt,[hmt,u("p",fmt,[ne(u("input",{type:"text",id:"top_p-val","onUpdate:modelValue":e[272]||(e[272]=h=>r.configFile.top_p=h),onChange:e[273]||(e[273]=h=>s.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.top_p]])])]),ne(u("input",{id:"top_p",type:"range","onUpdate:modelValue":e[274]||(e[274]=h=>r.configFile.top_p=h),min:"0",max:"1",step:"0.01",onChange:e[275]||(e[275]=h=>s.settingsChanged=!0),class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.top_p]])])]),u("div",mmt,[u("div",gmt,[u("div",bmt,[Emt,u("p",vmt,[ne(u("input",{type:"text",id:"repeat_penalty-val","onUpdate:modelValue":e[276]||(e[276]=h=>r.configFile.repeat_penalty=h),onChange:e[277]||(e[277]=h=>s.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.repeat_penalty]])])]),ne(u("input",{id:"repeat_penalty",onChange:e[278]||(e[278]=h=>s.settingsChanged=!0),type:"range","onUpdate:modelValue":e[279]||(e[279]=h=>r.configFile.repeat_penalty=h),min:"0",max:"2",step:"0.01",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.repeat_penalty]])])]),u("div",ymt,[u("div",Smt,[u("div",Tmt,[xmt,u("p",Cmt,[ne(u("input",{type:"text",id:"repeat_last_n-val","onUpdate:modelValue":e[280]||(e[280]=h=>r.configFile.repeat_last_n=h),onChange:e[281]||(e[281]=h=>s.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.repeat_last_n]])])]),ne(u("input",{id:"repeat_last_n",type:"range","onUpdate:modelValue":e[282]||(e[282]=h=>r.configFile.repeat_last_n=h),min:"0",max:"100",step:"1",onChange:e[283]||(e[283]=h=>s.settingsChanged=!0),class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.repeat_last_n]])])])],2)],2)])],2)]),Oe(f,{ref:"addmodeldialog"},null,512),Oe(m,{class:"z-20",show:s.variantSelectionDialogVisible,choices:s.variant_choices,onChoiceSelected:r.onVariantChoiceSelected,onCloseDialog:r.oncloseVariantChoiceDialog,onChoiceValidated:r.onvalidateVariantChoice},null,8,["show","choices","onChoiceSelected","onCloseDialog","onChoiceValidated"])],64)}const Amt=bt(Oot,[["render",Rmt],["__scopeId","data-v-bbd5a2e4"]]),wmt={components:{ClipBoardTextInput:RE,Card:vc},data(){return{dataset_path:"",max_length:1024,batch_size:4,lr:5e-5,num_epochs:2,selectedFolder:"",selectedDataset:""}},methods:{submitForm(){const n={model_name:this.selectedModel,dataset_file:this.selectedDataset,max_length:this.max_length,batch_size:this.batch_size,lr:this.lr,num_epochs:this.num_epochs,output_dir:this.selectedFolder};Me.post("/start_training",n).then(e=>{})},openFolderSelector(){this.$refs.folder_selector.click()},selectOutputDirectory(n){var t;console.log("here");const e=(t=n.target.files[0])==null?void 0:t.path;console.log(e),e&&(this.selectedFolder=e)},selectDataset(n){const e=n.target.files;e.length>0&&(this.selectedDataset=e[0])}},computed:{selectedModel:{get(){return this.$store.state.selectedModel}},models:{get(){return this.$store.state.modelsArr}}},watch:{model_name(n){console.log("watching model_name",n),this.$refs.clipboardInput.inputValue=n}}},Nmt={key:0,class:"container overflow-y-scroll flex flex-col no-scrollbar shadow-lg p-10 pt-2 bg-bg-light-tone dark:bg-bg-dark-tone"},Omt={class:"mb-4"},Imt=u("label",{for:"model_name",class:"text-sm"},"Model Name:",-1),Mmt=["value"],Dmt={class:"mb-4"},kmt=u("label",{for:"dataset_path",class:"text-sm"},"Dataset:",-1),Lmt={class:"mb-4"},Pmt=u("label",{for:"lr",class:"text-sm"},"Learning Rate:",-1),Umt={class:"mb-4"},Fmt=u("label",{for:"num_epochs",class:"text-sm"},"Number of Epochs:",-1),Bmt={class:"mb-4"},Gmt=u("label",{for:"max_length",class:"text-sm"},"Max Length:",-1),zmt={class:"mb-4"},Vmt=u("label",{for:"batch_size",class:"text-sm"},"Batch Size:",-1),Hmt={class:"mb-4"},qmt=u("label",{for:"output_dir",class:"text-sm"},"Output Directory:",-1),Ymt=u("button",{class:"bg-blue-500 text-white px-4 py-2 rounded"},"Start training",-1),$mt={key:1};function Wmt(n,e,t,i,s,r){const o=ht("Card"),a=ht("ClipBoardTextInput");return r.selectedModel!==null&&r.selectedModel.toLowerCase().includes("gptq")?(w(),M("div",Nmt,[u("form",{onSubmit:e[2]||(e[2]=Te((...l)=>r.submitForm&&r.submitForm(...l),["prevent"])),class:""},[Oe(o,{title:"Training configuration",isHorizontal:!0,disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[Oe(o,{title:"Model",class:"",isHorizontal:!1},{default:Je(()=>[u("div",Omt,[Imt,ne(u("select",{"onUpdate:modelValue":e[0]||(e[0]=l=>r.selectedModel=l),onChange:e[1]||(e[1]=(...l)=>n.setModel&&n.setModel(...l)),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},[(w(!0),M($e,null,ct(r.models,l=>(w(),M("option",{key:l,value:l},fe(l),9,Mmt))),128))],544),[[zn,r.selectedModel]])])]),_:1}),Oe(o,{title:"Data",isHorizontal:!1},{default:Je(()=>[u("div",Dmt,[kmt,Oe(a,{id:"model_path",inputType:"file",value:s.dataset_path,onchange:"selectDataset()"},null,8,["value"])])]),_:1}),Oe(o,{title:"Training",isHorizontal:!1},{default:Je(()=>[u("div",Lmt,[Pmt,Oe(a,{id:"model_path",inputType:"integer",value:s.lr},null,8,["value"])]),u("div",Umt,[Fmt,Oe(a,{id:"model_path",inputType:"integer",value:s.num_epochs},null,8,["value"])]),u("div",Bmt,[Gmt,Oe(a,{id:"model_path",inputType:"integer",value:s.max_length},null,8,["value"])]),u("div",zmt,[Vmt,Oe(a,{id:"model_path",inputType:"integer",value:s.batch_size},null,8,["value"])])]),_:1}),Oe(o,{title:"Output",isHorizontal:!1},{default:Je(()=>[u("div",Hmt,[qmt,Oe(a,{id:"model_path",inputType:"text",value:n.output_dir},null,8,["value"])])]),_:1})]),_:1}),Oe(o,{disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[Ymt]),_:1})],32)])):(w(),M("div",$mt,[Oe(o,{title:"Info",class:"",isHorizontal:!1},{default:Je(()=>[je(" Only GPTQ models are supported for QLora fine tuning. Please select a GPTQ compatible binding. ")]),_:1})]))}const Kmt=bt(wmt,[["render",Wmt]]),jmt={components:{ClipBoardTextInput:RE,Card:vc},data(){return{model_name:"jondurbin/airoboros-7b-gpt4",tokenizer_name:"jondurbin/airoboros-7b-gpt4",dataset_path:"",max_length:1024,batch_size:4,lr:5e-5,num_epochs:2,selectedFolder:"",selectedDatasetPath:""}},methods:{submitForm(){this.model_name,this.tokenizer_name,this.selectedDatasetPath,this.max_length,this.batch_size,this.lr,this.num_epochs,this.selectedFolder},openFolderSelector(){this.$refs.folder_selector.click()},selectOutputDirectory(n){var t;console.log("here");const e=(t=n.target.files[0])==null?void 0:t.path;console.log(e),e&&(this.selectedFolder=e)},selectDatasetPath(n){const e=n.target.files;e.length>0&&(this.selectedDatasetPath=e[0].webkitRelativePath)}}},Qmt={class:"container overflow-y-scroll flex flex-col no-scrollbar shadow-lg p-10 pt-2 bg-bg-light-tone dark:bg-bg-dark-tone"},Xmt={class:"mb-4"},Zmt=u("label",{for:"model_name",class:"text-sm"},"Model Name:",-1),Jmt={class:"mb-4"},egt=u("label",{for:"tokenizer_name",class:"text-sm"},"Tokenizer Name:",-1),tgt=u("button",{type:"submit",class:"bg-blue-500 text-white px-4 py-2 rounded"},"Quantize LLM",-1);function ngt(n,e,t,i,s,r){const o=ht("ClipBoardTextInput"),a=ht("Card");return w(),M("div",Qmt,[u("form",{onSubmit:e[0]||(e[0]=Te((...l)=>r.submitForm&&r.submitForm(...l),["prevent"])),class:"max-w-md mx-auto"},[Oe(a,{title:"Quantizing configuration",isHorizontal:!0,disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[Oe(a,{title:"Model",class:"",isHorizontal:!1},{default:Je(()=>[u("div",Xmt,[Zmt,Oe(o,{id:"model_path",inputType:"text",value:s.model_name},null,8,["value"])]),u("div",Jmt,[egt,Oe(o,{id:"model_path",inputType:"text",value:s.tokenizer_name},null,8,["value"])])]),_:1})]),_:1}),Oe(a,{disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[tgt]),_:1})],32)])}const igt=bt(jmt,[["render",ngt]]),sgt={name:"Discussion",emits:["delete","select","editTitle","makeTitle","checked"],props:{id:Number,title:String,selected:Boolean,loading:Boolean,isCheckbox:Boolean,checkBoxValue:Boolean},setup(){},data(){return{showConfirmation:!1,editTitleMode:!1,makeTitleMode:!1,deleteMode:!1,editTitle:!1,newTitle:String,checkBoxValue_local:!1}},methods:{cancel(){this.editTitleMode=!1,this.makeTitleMode=!1,this.deleteMode=!1,this.showConfirmation=!1},deleteEvent(){this.showConfirmation=!1,this.$emit("delete")},selectEvent(){this.$emit("select")},editTitleEvent(){this.editTitle=!1,this.editTitleMode=!1,this.makeTitleMode=!1,this.deleteMode=!1,this.showConfirmation=!1,this.$emit("editTitle",{title:this.newTitle,id:this.id})},makeTitleEvent(){this.$emit("makeTitle",{id:this.id}),this.showConfirmation=!1},chnageTitle(n){this.newTitle=n},checkedChangeEvent(n,e){this.$emit("checked",n,e)}},mounted(){this.newTitle=this.title,Ve(()=>{qe.replace()})},watch:{showConfirmation(){Ve(()=>{qe.replace()})},editTitleMode(n){this.showConfirmation=n,this.editTitle=n,n&&Ve(()=>{try{this.$refs.titleBox.focus()}catch{}})},deleteMode(n){this.showConfirmation=n,n&&Ve(()=>{this.$refs.titleBox.focus()})},makeTitleMode(n){this.showConfirmation=n},checkBoxValue(n,e){this.checkBoxValue_local=n}}},rgt=["id"],ogt={class:"flex flex-row items-center gap-2"},agt={key:0},lgt=["title"],cgt=["value"],dgt={class:"flex items-center flex-1 max-h-6"},ugt={key:0,class:"flex gap-3 flex-1 items-center justify-end duration-75"},pgt=u("i",{"data-feather":"x"},null,-1),_gt=[pgt],hgt=u("i",{"data-feather":"check"},null,-1),fgt=[hgt],mgt={key:1,class:"flex gap-3 flex-1 items-center justify-end invisible group-hover:visible duration-75"},ggt=u("i",{"data-feather":"type"},null,-1),bgt=[ggt],Egt=u("i",{"data-feather":"edit-2"},null,-1),vgt=[Egt],ygt=u("i",{"data-feather":"trash"},null,-1),Sgt=[ygt];function Tgt(n,e,t,i,s,r){return w(),M("div",{class:Ye([t.selected?"bg-bg-light-discussion dark:bg-bg-dark-discussion shadow-md min-w-[23rem] max-w-[23rem]":" min-w-[23rem] max-w-[23rem]","flex flex-row sm:flex-row flex-wrap flex-shrink: 0 item-center shadow-sm gap-2 py-2 my-2 hover:shadow-md hover:bg-primary-light dark:hover:bg-primary rounded-md p-2 duration-75 group cursor-pointer"]),id:"dis-"+t.id,onClick:e[12]||(e[12]=Te(o=>r.selectEvent(),["stop"]))},[u("div",ogt,[t.isCheckbox?(w(),M("div",agt,[ne(u("input",{type:"checkbox",class:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-700 dark:focus:ring-offset-gray-700 focus:ring-2 dark:bg-gray-600 dark:border-gray-500",onClick:e[0]||(e[0]=Te(()=>{},["stop"])),"onUpdate:modelValue":e[1]||(e[1]=o=>s.checkBoxValue_local=o),onInput:e[2]||(e[2]=o=>r.checkedChangeEvent(o,t.id))},null,544),[[ut,s.checkBoxValue_local]])])):q("",!0),t.selected?(w(),M("div",{key:1,class:Ye(["min-h-full w-2 rounded-xl self-stretch",t.loading?"animate-bounce bg-accent ":" bg-secondary "])},null,2)):q("",!0),t.selected?q("",!0):(w(),M("div",{key:2,class:Ye(["w-2",t.loading?"min-h-full w-2 rounded-xl self-stretch animate-bounce bg-accent ":" "])},null,2))]),s.editTitle?q("",!0):(w(),M("p",{key:0,title:t.title,class:"line-clamp-1 w-4/6 ml-1 -mx-5"},fe(t.title?t.title==="untitled"?"New discussion":t.title:"New discussion"),9,lgt)),s.editTitle?(w(),M("input",{key:1,type:"text",id:"title-box",ref:"titleBox",class:"bg-bg-light dark:bg-bg-dark rounded-md border-0 w-full -m-1 p-1",value:t.title,required:"",onKeydown:[e[3]||(e[3]=wr(Te(o=>r.editTitleEvent(),["exact"]),["enter"])),e[4]||(e[4]=wr(Te(o=>s.editTitleMode=!1,["exact"]),["esc"]))],onInput:e[5]||(e[5]=o=>r.chnageTitle(o.target.value)),onClick:e[6]||(e[6]=Te(()=>{},["stop"]))},null,40,cgt)):q("",!0),u("div",dgt,[s.showConfirmation?(w(),M("div",ugt,[u("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Discard title changes",type:"button",onClick:e[7]||(e[7]=Te(o=>r.cancel(),["stop"]))},_gt),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm title changes",type:"button",onClick:e[8]||(e[8]=Te(o=>s.editTitleMode?r.editTitleEvent():s.deleteMode?r.deleteEvent():r.makeTitleEvent(),["stop"]))},fgt)])):q("",!0),s.showConfirmation?q("",!0):(w(),M("div",mgt,[u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Make a title",type:"button",onClick:e[9]||(e[9]=Te(o=>s.makeTitleMode=!0,["stop"]))},bgt),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Edit title",type:"button",onClick:e[10]||(e[10]=Te(o=>s.editTitleMode=!0,["stop"]))},vgt),u("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Remove discussion",type:"button",onClick:e[11]||(e[11]=Te(o=>s.deleteMode=!0,["stop"]))},Sgt)]))])],10,rgt)}const wE=bt(sgt,[["render",Tgt]]),xgt={data(){return{show:!1,prompt:"",inputText:""}},methods:{showPanel(){this.show=!0},ok(){this.show=!1,this.$emit("ok",this.inputText)},cancel(){this.show=!1,this.inputText=""}},props:{promptText:{type:String,required:!0}},watch:{promptText(n){this.prompt=n}}},Cgt={key:0,class:"fixed top-0 left-0 w-full h-full flex justify-center items-center bg-black bg-opacity-50"},Rgt={class:"bg-white p-8 rounded"},Agt={class:"text-xl font-bold mb-4"};function wgt(n,e,t,i,s,r){return w(),M("div",null,[s.show?(w(),M("div",Cgt,[u("div",Rgt,[u("h2",Agt,fe(t.promptText),1),ne(u("input",{type:"text","onUpdate:modelValue":e[0]||(e[0]=o=>s.inputText=o),class:"border border-gray-300 px-4 py-2 rounded mb-4"},null,512),[[Pe,s.inputText]]),u("button",{onClick:e[1]||(e[1]=(...o)=>r.ok&&r.ok(...o)),class:"bg-blue-500 text-white px-4 py-2 rounded mr-2"},"OK"),u("button",{onClick:e[2]||(e[2]=(...o)=>r.cancel&&r.cancel(...o)),class:"bg-gray-500 text-white px-4 py-2 rounded"},"Cancel")])])):q("",!0)])}const EO=bt(xgt,[["render",wgt]]),Ngt={data(){return{id:0,loading:!1,isCheckbox:!1,isVisible:!1,categories:[],titles:[],content:"",searchQuery:""}},components:{Discussion:wE,MarkdownRenderer:ap},props:{host:{type:String,required:!1,default:"http://localhost:9600"}},methods:{showSkillsLibrary(){this.isVisible=!0,this.fetchTitles()},closeComponent(){this.isVisible=!1},fetchCategories(){Me.post("/get_skills_library_categories",{client_id:this.$store.state.client_id}).then(n=>{this.categories=n.data.categories}).catch(n=>{console.error("Error fetching categories:",n)})},fetchTitles(){console.log("Fetching categories"),Me.post("/get_skills_library_titles",{client_id:this.$store.state.client_id}).then(n=>{this.titles=n.data.titles,console.log("titles recovered")}).catch(n=>{console.error("Error fetching titles:",n)})},fetchContent(n){Me.post("/get_skills_library_content",{client_id:this.$store.state.client_id,skill_id:n}).then(e=>{const t=e.data.contents[0];this.id=t.id,this.content=t.content}).catch(e=>{console.error("Error fetching content:",e)})},deleteCategory(n){console.log("Delete category")},editCategory(n){console.log("Edit category")},checkUncheckCategory(n){console.log("Unchecked category")},deleteSkill(n){console.log("Delete skill ",n),Me.post("/delete_skill",{client_id:this.$store.state.client_id,skill_id:n}).then(()=>{this.fetchTitles()})},editTitle(n){Me.post("/edit_skill_title",{client_id:this.$store.state.client_id,skill_id:n,title:n}).then(()=>{this.fetchTitles()}),console.log("Edit title")},makeTitle(n){console.log("Make title")},checkUncheckTitle(n){},searchSkills(){}}},Ogt={id:"leftPanel",class:"flex flex-row h-full flex-grow shadow-lg rounded"},Igt={class:"min-w-[23rem] max-w-[23rem] z-10 top-0 bg-bg-light-tone dark:bg-bg-dark-tone shadow-md overflow-y-scroll no-scrollbar"},Mgt={class:"search p-4"},Dgt={classclass:"absolute flex flex-col no-scrollbar shadow-lg min-w-[24rem] max-w-[24rem] bg-bg-light-tone dark:bg-bg-dark-tone top-20 left-20 bottom-20 right-20 bg-bg-light shadow-lg rounded"},kgt=u("h2",{class:"text-xl font-bold m-4"},"Titles",-1),Lgt={class:"z-0 flex flex-col flex-grow overflow-y-auto scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},Pgt=u("h2",{class:"text-xl font-bold m-4"},"Content",-1);function Ugt(n,e,t,i,s,r){const o=ht("Discussion"),a=ht("MarkdownRenderer");return w(),M("div",{class:Ye([{hidden:!s.isVisible},"absolute flex flex-col no-scrollbar shadow-lg bg-bg-light dark:bg-bg-dark top-20 left-20 bottom-20 right-20 shadow-lg rounded"])},[u("div",Ogt,[u("div",Igt,[u("div",Mgt,[ne(u("input",{type:"text","onUpdate:modelValue":e[0]||(e[0]=l=>s.searchQuery=l),placeholder:"Search skills",class:"border border-gray-300 rounded px-2 py-1 mr-2"},null,512),[[Pe,s.searchQuery]]),u("button",{onClick:e[1]||(e[1]=(...l)=>r.searchSkills&&r.searchSkills(...l)),class:"bg-blue-500 text-white rounded px-4 py-1"},"Search")]),u("div",Dgt,[kgt,s.titles.length>0?(w(),xt(rs,{key:0,name:"list"},{default:Je(()=>[(w(!0),M($e,null,ct(s.titles,l=>(w(),xt(o,{key:l.id,id:l.id,title:l.title,selected:r.fetchContent(l.id),loading:s.loading,isCheckbox:s.isCheckbox,checkBoxValue:!1,onSelect:d=>r.fetchContent(l.id),onDelete:d=>r.deleteSkill(l.id),onEditTitle:r.editTitle,onMakeTitle:r.makeTitle,onChecked:r.checkUncheckTitle},null,8,["id","title","selected","loading","isCheckbox","onSelect","onDelete","onEditTitle","onMakeTitle","onChecked"]))),128))]),_:1})):q("",!0)])]),u("div",Lgt,[Pgt,Oe(a,{host:t.host,"markdown-text":s.content,message_id:s.id,discussion_id:s.id,client_id:this.$store.state.client_id},null,8,["host","markdown-text","message_id","discussion_id","client_id"])])]),u("button",{onClick:e[2]||(e[2]=(...l)=>r.closeComponent&&r.closeComponent(...l)),class:"absolute top-2 right-2 bg-red-500 text-white rounded px-2 py-1 hover:bg-red-300"},"Close")],2)}const vO=bt(Ngt,[["render",Ugt]]),Fgt={props:{htmlContent:{type:String,required:!0}}},Bgt=["innerHTML"];function Ggt(n,e,t,i,s,r){return w(),M("div",null,[u("div",{innerHTML:t.htmlContent},null,8,Bgt)])}const zgt=bt(Fgt,[["render",Ggt]]);const Vgt={props:{jsonData:{type:[Object,Array,String],default:null},jsonFormText:{type:String,default:"JSON Form"}},data(){return{collapsed:!0}},computed:{formattedJson(){return typeof this.jsonData=="string"?JSON.stringify(JSON.parse(this.jsonData),null," ").replace(/\n/g,"
"):JSON.stringify(this.jsonData,null," ").replace(/\n/g,"
")},isObject(){return typeof this.jsonData=="object"&&this.jsonData!==null},isContentPresent(){return this.jsonData!==null&&(typeof this.jsonData!="string"||this.jsonData.trim()!=="")}},methods:{toggleCollapsed(){this.collapsed=!this.collapsed},toggleCollapsible(){this.collapsed=!this.collapsed}}},Hgt={key:0},qgt={class:"toggle-icon mr-1"},Ygt={key:0,class:"fas fa-plus-circle text-gray-600"},$gt={key:1,class:"fas fa-minus-circle text-gray-600"},Wgt={class:"json-viewer max-h-64 overflow-auto p-4 bg-gray-100 border border-gray-300 rounded dark:bg-gray-600"},Kgt={key:0,class:"fas fa-plus-circle text-gray-600"},jgt={key:1,class:"fas fa-minus-circle text-gray-600"},Qgt=["innerHTML"];function Xgt(n,e,t,i,s,r){return r.isContentPresent?(w(),M("div",Hgt,[u("div",{class:"collapsible-section cursor-pointer mb-4 font-bold hover:text-gray-900",onClick:e[0]||(e[0]=(...o)=>r.toggleCollapsible&&r.toggleCollapsible(...o))},[u("span",qgt,[s.collapsed?(w(),M("i",Ygt)):(w(),M("i",$gt))]),je(" "+fe(t.jsonFormText),1)]),ne(u("div",null,[u("div",Wgt,[r.isObject?(w(),M("span",{key:0,onClick:e[1]||(e[1]=(...o)=>r.toggleCollapsed&&r.toggleCollapsed(...o)),class:"toggle-icon cursor-pointer mr-1"},[s.collapsed?(w(),M("i",Kgt)):(w(),M("i",jgt))])):q("",!0),u("pre",{innerHTML:r.formattedJson},null,8,Qgt)])],512),[[Ot,!s.collapsed]])])):q("",!0)}const Zgt=bt(Vgt,[["render",Xgt]]),Jgt={props:{done:{type:Boolean,required:!0},message:{type:String,required:!0},status:{type:Boolean,required:!0},step_type:{type:String,required:!1,default:"start_end"}}},ebt={class:"flex items-start"},tbt={class:"step flex items-center mb-4"},nbt={key:0,class:"flex items-center justify-center w-6 h-6 mr-2"},ibt={key:0},sbt=u("i",{"data-feather":"square",class:"text-gray-400 w-4 h-4"},null,-1),rbt=[sbt],obt={key:1},abt=u("i",{"data-feather":"check-square",class:"text-green-500 w-4 h-4"},null,-1),lbt=[abt],cbt={key:2},dbt=u("i",{"data-feather":"x-square",class:"text-red-500 w-4 h-4"},null,-1),ubt=[dbt],pbt={key:1,role:"status",class:"m-15"},_bt=u("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1),hbt=[_bt],fbt={class:"text-sm ml-6"};function mbt(n,e,t,i,s,r){return w(),M("div",ebt,[u("div",tbt,[t.step_type=="start_end"?(w(),M("div",nbt,[t.done?q("",!0):(w(),M("div",ibt,rbt)),t.done&&t.status?(w(),M("div",obt,lbt)):q("",!0),t.done&&!t.status?(w(),M("div",cbt,ubt)):q("",!0)])):q("",!0),t.done?q("",!0):(w(),M("div",pbt,hbt)),u("h3",fbt,fe(t.message),1)])])}const gbt=bt(Jgt,[["render",mbt]]),bbt="/assets/process-61f7a21b.svg",Ebt="/assets/ok-a0b56451.svg",vbt="/assets/failed-183609e7.svg",yO="/assets/send_globe-775ba9b7.svg";const ybt="/",Sbt={name:"Message",emits:["copy","delete","rankUp","rankDown","updateMessage","resendMessage","continueMessage"],components:{MarkdownRenderer:ap,Step:gbt,RenderHTMLJS:zgt,JsonViewer:Zgt,DynamicUIRenderer:bO},props:{host:{type:String,required:!1,default:"http://localhost:9600"},message:Object,avatar:{default:""}},data(){return{isSynthesizingVoice:!1,cpp_block:uO,html5_block:pO,LaTeX_block:_O,json_block:dO,javascript_block:cO,process_svg:bbt,ok_svg:Ebt,failed_svg:vbt,loading_svg:fO,sendGlobe:yO,code_block:aO,python_block:lO,bash_block:hO,audio_url:null,audio:null,msg:null,isSpeaking:!1,speechSynthesis:null,voices:[],expanded:!1,showConfirmation:!1,editMsgMode_:!1,deleteMsgMode:!1,mdRenderHeight:Number}},mounted(){if("speechSynthesis"in window?(this.speechSynthesis=window.speechSynthesis,this.voices=this.speechSynthesis.getVoices(),this.voices.length===0?this.speechSynthesis.addEventListener("voiceschanged",this.onVoicesChanged):console.log("No voices found")):console.error("Speech synthesis is not supported in this browser."),Ve(()=>{qe.replace(),this.mdRenderHeight=this.$refs.mdRender.$el.offsetHeight}),console.log("Checking metadata"),console.log(this.message),Object.prototype.hasOwnProperty.call(this.message,"metadata")&&this.message.metadata!=null){console.log("Metadata found!"),Array.isArray(this.message.metadata)||(this.message.metadata=[]),console.log(typeof this.message.metadata),console.log(this.message.metadata);for(let n of this.message.metadata)Object.prototype.hasOwnProperty.call(n,"audio_url")&&n.audio_url!=null&&(this.audio_url=n.audio_url,console.log("Audio URL:",this.audio_url))}},methods:{computeTimeDiff(n,e){let t=e.getTime()-n.getTime();const i=Math.floor(t/(1e3*60*60));t-=i*(1e3*60*60);const s=Math.floor(t/(1e3*60));t-=s*(1e3*60);const r=Math.floor(t/1e3);return t-=r*1e3,[i,s,r]},insertTab(n){const e=n.target,t=e.selectionStart,i=e.selectionEnd,s=n.shiftKey;if(t===i)if(s){if(e.value.substring(t-4,t)==" "){const r=e.value.substring(0,t-4),o=e.value.substring(i),a=r+o;this.message.content=a,this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t-4})}}else{const r=e.value.substring(0,t),o=e.value.substring(i),a=r+" "+o;this.message.content=a,this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+4})}else{const o=e.value.substring(t,i).split(` +Here is how you can do that`))},ppt)])]),u("tr",null,[_pt,u("td",null,[u("div",hpt,[u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[201]||(e[201]=(...h)=>r.reinstallPetalsService&&r.reinstallPetalsService(...h))},"install petals service")])])]),u("tr",null,[fpt,u("td",null,[u("div",mpt,[ne(u("input",{type:"text",id:"petals_base_url",required:"","onUpdate:modelValue":e[202]||(e[202]=h=>r.configFile.petals_base_url=h),onChange:e[203]||(e[203]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.petals_base_url]])])])])])]),_:1}),Oe(o,{title:"Elastic search Service (under construction)",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",gpt,[u("tr",null,[bpt,u("td",null,[u("div",Ept,[ne(u("input",{type:"checkbox",id:"elastic_search_service",required:"","onUpdate:modelValue":e[204]||(e[204]=h=>r.configFile.elastic_search_service=h),onChange:e[205]||(e[205]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.elastic_search_service]])])])]),u("tr",null,[vpt,u("td",null,[u("div",ypt,[u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[206]||(e[206]=(...h)=>r.reinstallElasticSearchService&&r.reinstallElasticSearchService(...h))},"install ElasticSearch service")])])]),u("tr",null,[Spt,u("td",null,[u("div",Tpt,[ne(u("input",{type:"text",id:"elastic_search_url",required:"","onUpdate:modelValue":e[207]||(e[207]=h=>r.configFile.elastic_search_url=h),onChange:e[208]||(e[208]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.elastic_search_url]])])])])])]),_:1}),Oe(o,{title:"XTTS service",is_subcard:!0,class:"pb-2 m-2"},{default:Je(()=>[u("table",xpt,[u("tr",null,[Cpt,u("td",null,[u("div",Rpt,[ne(u("input",{type:"checkbox",id:"enable_voice_service",required:"","onUpdate:modelValue":e[209]||(e[209]=h=>r.configFile.enable_voice_service=h),onChange:e[210]||(e[210]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ut,r.configFile.enable_voice_service]])])])]),u("tr",null,[Apt,u("td",null,[u("div",wpt,[u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[211]||(e[211]=(...h)=>r.reinstallAudioService&&r.reinstallAudioService(...h))},"install xtts service"),u("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[212]||(e[212]=(...h)=>r.startAudioService&&r.startAudioService(...h))},"start xtts service")])])]),u("tr",null,[Npt,u("td",null,[u("div",Opt,[ne(u("input",{type:"text",id:"xtts_base_url",required:"","onUpdate:modelValue":e[213]||(e[213]=h=>r.configFile.xtts_base_url=h),onChange:e[214]||(e[214]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Pe,r.configFile.xtts_base_url]])])])]),u("tr",null,[Ipt,u("td",null,[u("div",Mpt,[ne(u("select",{"onUpdate:modelValue":e[215]||(e[215]=h=>r.current_language=h),onChange:e[216]||(e[216]=h=>s.settingsChanged=!0),disabled:!r.enable_voice_service},[(w(!0),M($e,null,ct(s.voice_languages,(h,E)=>(w(),M("option",{key:E,value:h},fe(E),9,kpt))),128))],40,Dpt),[[zn,r.current_language]])])])]),u("tr",null,[Lpt,u("td",null,[u("div",Ppt,[ne(u("select",{"onUpdate:modelValue":e[217]||(e[217]=h=>r.current_voice=h),onChange:e[218]||(e[218]=h=>s.settingsChanged=!0),disabled:!r.enable_voice_service},[(w(!0),M($e,null,ct(s.voices,h=>(w(),M("option",{key:h,value:h},fe(h),9,Fpt))),128))],40,Upt),[[zn,r.current_voice]])])])]),u("tr",null,[Bpt,u("td",null,[u("div",Gpt,[ne(u("input",{type:"checkbox",id:"auto_read",required:"","onUpdate:modelValue":e[219]||(e[219]=h=>r.configFile.auto_read=h),onChange:e[220]||(e[220]=h=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600",disabled:!r.enable_voice_service},null,40,zpt),[[ut,r.configFile.auto_read]])])])])])]),_:1})],2)]),u("div",Vpt,[u("div",Hpt,[u("button",{onClick:e[221]||(e[221]=Te(h=>s.bzc_collapsed=!s.bzc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[ne(u("div",null,Ypt,512),[[Ot,s.bzc_collapsed]]),ne(u("div",null,Wpt,512),[[Ot,!s.bzc_collapsed]]),Kpt,r.configFile.binding_name?q("",!0):(w(),M("div",jpt,[Qpt,je(" No binding selected! ")])),r.configFile.binding_name?(w(),M("div",Xpt,"|")):q("",!0),r.configFile.binding_name?(w(),M("div",Zpt,[u("div",Jpt,[u("img",{src:r.imgBinding,class:"w-8 h-8 rounded-full object-fill text-blue-700"},null,8,e_t),u("h3",t_t,fe(r.binding_name),1)])])):q("",!0)])]),u("div",{class:Ye([{hidden:s.bzc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[r.bindingsZoo&&r.bindingsZoo.length>0?(w(),M("div",n_t,[u("label",i_t," Bindings: ("+fe(r.bindingsZoo.length)+") ",1),u("div",{class:Ye(["overflow-y-auto no-scrollbar p-2 pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4",s.bzl_collapsed?"":"max-h-96"])},[Oe(rs,{name:"list"},{default:Je(()=>[(w(!0),M($e,null,ct(r.bindingsZoo,(h,E)=>(w(),xt(a,{ref_for:!0,ref:"bindingZoo",key:"index-"+E+"-"+h.folder,binding:h,"on-selected":r.onBindingSelected,"on-reinstall":r.onReinstallBinding,"on-unInstall":r.onUnInstallBinding,"on-install":r.onInstallBinding,"on-settings":r.onSettingsBinding,"on-reload-binding":r.onReloadBinding,selected:h.folder===r.configFile.binding_name},null,8,["binding","on-selected","on-reinstall","on-unInstall","on-install","on-settings","on-reload-binding","selected"]))),128))]),_:1})],2)])):q("",!0),s.bzl_collapsed?(w(),M("button",{key:1,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Collapse",type:"button",onClick:e[222]||(e[222]=h=>s.bzl_collapsed=!s.bzl_collapsed)},r_t)):(w(),M("button",{key:2,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Expand",type:"button",onClick:e[223]||(e[223]=h=>s.bzl_collapsed=!s.bzl_collapsed)},a_t))],2)]),u("div",l_t,[u("div",c_t,[u("button",{onClick:e[224]||(e[224]=Te(h=>r.modelsZooToggleCollapse(),["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex items-center"},[ne(u("div",null,u_t,512),[[Ot,s.mzc_collapsed]]),ne(u("div",null,__t,512),[[Ot,!s.mzc_collapsed]]),h_t,u("div",f_t,[r.configFile.binding_name?q("",!0):(w(),M("div",m_t,[g_t,je(" Select binding first! ")])),!r.configFile.model_name&&r.configFile.binding_name?(w(),M("div",b_t,[E_t,je(" No model selected! ")])):q("",!0),r.configFile.model_name?(w(),M("div",v_t,"|")):q("",!0),r.configFile.model_name?(w(),M("div",y_t,[u("div",S_t,[u("img",{src:r.imgModel,class:"w-8 h-8 rounded-lg object-fill"},null,8,T_t),u("h3",x_t,fe(r.configFile.model_name),1)])])):q("",!0)])])]),u("div",{class:Ye([{hidden:s.mzc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[u("div",C_t,[u("div",R_t,[u("div",A_t,[s.searchModelInProgress?(w(),M("div",w_t,O_t)):q("",!0),s.searchModelInProgress?q("",!0):(w(),M("div",I_t,D_t))]),ne(u("input",{type:"search",class:"block w-full p-4 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Search models...",required:"","onUpdate:modelValue":e[225]||(e[225]=h=>s.searchModel=h),onKeyup:e[226]||(e[226]=wr((...h)=>r.searchModel_func&&r.searchModel_func(...h),["enter"]))},null,544),[[Pe,s.searchModel]]),s.searchModel?(w(),M("button",{key:0,onClick:e[227]||(e[227]=Te(h=>s.searchModel="",["stop"])),type:"button",class:"text-white absolute right-2.5 bottom-2.5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"}," Clear search")):q("",!0)])]),u("div",null,[ne(u("input",{"onUpdate:modelValue":e[228]||(e[228]=h=>s.show_only_installed_models=h),class:"m-2 p-2",type:"checkbox",ref:"only_installed"},null,512),[[ut,s.show_only_installed_models]]),k_t]),u("div",null,[Oe(l,{radioOptions:s.sortOptions,onRadioSelected:r.handleRadioSelected},null,8,["radioOptions","onRadioSelected"])]),L_t,s.is_loading_zoo?(w(),M("div",P_t,B_t)):q("",!0),s.models_zoo&&s.models_zoo.length>0?(w(),M("div",G_t,[u("label",z_t," Models: ("+fe(s.models_zoo.length)+") ",1),u("div",{class:Ye(["overflow-y-auto p-2 pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4 overflow-y-scroll w-full dark:bg-bg-dark scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",s.mzl_collapsed?"":"max-h-96"])},[Oe(rs,{name:"list"},{default:Je(()=>[(w(!0),M($e,null,ct(r.rendered_models_zoo,(h,E)=>(w(),xt(d,{ref_for:!0,ref:"modelZoo",key:"index-"+E+"-"+h.name,model:h,"is-installed":h.isInstalled,"on-install":r.onInstall,"on-uninstall":r.onUninstall,"on-selected":r.onModelSelected,selected:h.name===r.configFile.model_name,model_type:h.model_type,"on-copy":r.onCopy,"on-copy-link":r.onCopyLink,"on-cancel-install":r.onCancelInstall},null,8,["model","is-installed","on-install","on-uninstall","on-selected","selected","model_type","on-copy","on-copy-link","on-cancel-install"]))),128)),u("button",{ref:"load_more_models",class:"relative items-start p-4 hover:bg-primary-light rounded-lg mb-2 shadow-lg border-2 select-none",onClick:e[229]||(e[229]=(...h)=>r.load_more_models&&r.load_more_models(...h))},"Load more models",512)]),_:1})],2)])):q("",!0),s.mzl_collapsed?(w(),M("button",{key:2,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Collapse",type:"button",onClick:e[230]||(e[230]=(...h)=>r.open_mzl&&r.open_mzl(...h))},H_t)):(w(),M("button",{key:3,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Expand",type:"button",onClick:e[231]||(e[231]=(...h)=>r.open_mzl&&r.open_mzl(...h))},Y_t)),u("div",$_t,[u("div",W_t,[u("div",null,[u("div",K_t,[j_t,ne(u("input",{type:"text","onUpdate:modelValue":e[232]||(e[232]=h=>s.reference_path=h),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Enter Path ...",required:""},null,512),[[Pe,s.reference_path]])]),u("button",{type:"button",onClick:e[233]||(e[233]=Te(h=>r.onCreateReference(),["stop"])),class:"text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"},"Add reference")]),s.modelDownlaodInProgress?q("",!0):(w(),M("div",Q_t,[u("div",X_t,[Z_t,ne(u("input",{type:"text","onUpdate:modelValue":e[234]||(e[234]=h=>s.addModel.url=h),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Enter URL ...",required:""},null,512),[[Pe,s.addModel.url]])]),u("button",{type:"button",onClick:e[235]||(e[235]=Te(h=>r.onInstallAddModel(),["stop"])),class:"text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"},"Download")])),s.modelDownlaodInProgress?(w(),M("div",J_t,[eht,u("div",tht,[u("div",nht,[u("div",iht,[sht,u("span",rht,fe(Math.floor(s.addModel.progress))+"%",1)]),u("div",{class:"mx-1 opacity-80 line-clamp-1",title:s.addModel.url},fe(s.addModel.url),9,oht),u("div",aht,[u("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en({width:s.addModel.progress+"%"})},null,4)]),u("div",lht,[u("span",cht,"Download speed: "+fe(r.speed_computed)+"/s",1),u("span",dht,fe(r.downloaded_size_computed)+"/"+fe(r.total_size_computed),1)])])]),u("div",uht,[u("div",pht,[u("div",_ht,[u("button",{onClick:e[236]||(e[236]=Te((...h)=>r.onCancelInstall&&r.onCancelInstall(...h),["stop"])),type:"button",title:"Cancel download",class:"text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600"}," Cancel ")])])])])):q("",!0)])])],2)]),u("div",hht,[u("div",fht,[u("button",{onClick:e[239]||(e[239]=Te(h=>s.pzc_collapsed=!s.pzc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 text-left w-full flex items-center"},[ne(u("div",null,ght,512),[[Ot,s.pzc_collapsed]]),ne(u("div",null,Eht,512),[[Ot,!s.pzc_collapsed]]),vht,r.configFile.personalities?(w(),M("div",yht,"|")):q("",!0),u("div",Sht,fe(r.active_pesonality),1),r.configFile.personalities?(w(),M("div",Tht,"|")):q("",!0),r.configFile.personalities?(w(),M("div",xht,[r.mountedPersArr.length>0?(w(),M("div",Cht,[(w(!0),M($e,null,ct(r.mountedPersArr,(h,E)=>(w(),M("div",{class:"relative hover:-translate-y-2 duration-300 hover:z-10 shrink-0",key:E+"-"+h.name,ref_for:!0,ref:"mountedPersonalities"},[u("div",Rht,[u("button",{onClick:Te(b=>r.onPersonalitySelected(h),["stop"])},[u("img",{src:s.bUrl+h.avatar,onError:e[237]||(e[237]=(...b)=>r.personalityImgPlacehodler&&r.personalityImgPlacehodler(...b)),class:Ye(["w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 group-hover:border-secondary",r.configFile.active_personality_id==r.configFile.personalities.indexOf(h.full_path)?"border-secondary":"border-transparent z-0"]),title:h.name},null,42,wht)],8,Aht),u("button",{onClick:Te(b=>r.unmountPersonality(h),["stop"])},Iht,8,Nht)])]))),128))])):q("",!0)])):q("",!0),u("button",{onClick:e[238]||(e[238]=Te(h=>r.unmountAll(),["stop"])),class:"bg-bg-light hover:border-green-200 ml-5 dark:bg-bg-dark rounded-full border-2 border-transparent",title:"Unmount All"},Dht)])]),u("div",{class:Ye([{hidden:s.pzc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[u("div",kht,[Lht,u("div",Pht,[u("div",Uht,[s.searchPersonalityInProgress?(w(),M("div",Fht,Ght)):q("",!0),s.searchPersonalityInProgress?q("",!0):(w(),M("div",zht,Hht))]),ne(u("input",{type:"search",id:"personality-search",class:"block w-full p-4 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Search personality...",required:"","onUpdate:modelValue":e[240]||(e[240]=h=>s.searchPersonality=h),onKeyup:e[241]||(e[241]=Te((...h)=>r.searchPersonality_func&&r.searchPersonality_func(...h),["stop"]))},null,544),[[Pe,s.searchPersonality]]),s.searchPersonality?(w(),M("button",{key:0,onClick:e[242]||(e[242]=Te(h=>s.searchPersonality="",["stop"])),type:"button",class:"text-white absolute right-2.5 bottom-2.5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"}," Clear search")):q("",!0)])]),s.searchPersonality?q("",!0):(w(),M("div",qht,[u("label",Yht," Personalities Category: ("+fe(s.persCatgArr.length)+") ",1),u("select",{id:"persCat",onChange:e[243]||(e[243]=h=>r.update_personality_category(h.target.value,r.refresh)),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},[(w(!0),M($e,null,ct(s.persCatgArr,(h,E)=>(w(),M("option",{key:E,selected:h==this.configFile.personality_category},fe(h),9,$ht))),128))],32)])),u("div",null,[s.personalitiesFiltered.length>0?(w(),M("div",Wht,[u("label",Kht,fe(s.searchPersonality?"Search results":"Personalities")+": ("+fe(s.personalitiesFiltered.length)+") ",1),u("div",{class:Ye(["overflow-y-auto no-scrollbar p-2 pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4",s.pzl_collapsed?"":"max-h-96"])},[Oe(rs,{name:"bounce"},{default:Je(()=>[(w(!0),M($e,null,ct(s.personalitiesFiltered,(h,E)=>(w(),xt(c,{ref_for:!0,ref:"personalitiesZoo",key:"index-"+E+"-"+h.name,personality:h,select_language:!0,full_path:h.full_path,selected:r.configFile.active_personality_id==r.configFile.personalities.findIndex(b=>b===h.full_path||b===h.full_path+":"+h.language),"on-selected":r.onPersonalitySelected,"on-mount":r.mountPersonality,"on-un-mount":r.unmountPersonality,"on-remount":r.remountPersonality,"on-edit":r.editPersonality,"on-copy-to-custom":r.copyToCustom,"on-reinstall":r.onPersonalityReinstall,"on-settings":r.onSettingsPersonality,"on-copy-personality-name":r.onCopyPersonalityName},null,8,["personality","full_path","selected","on-selected","on-mount","on-un-mount","on-remount","on-edit","on-copy-to-custom","on-reinstall","on-settings","on-copy-personality-name"]))),128))]),_:1})],2)])):q("",!0)]),s.pzl_collapsed?(w(),M("button",{key:1,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Collapse",type:"button",onClick:e[244]||(e[244]=h=>s.pzl_collapsed=!s.pzl_collapsed)},Qht)):(w(),M("button",{key:2,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Expand",type:"button",onClick:e[245]||(e[245]=h=>s.pzl_collapsed=!s.pzl_collapsed)},Zht))],2)]),u("div",Jht,[u("div",eft,[u("button",{onClick:e[247]||(e[247]=Te(h=>s.ezc_collapsed=!s.ezc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 text-left w-full flex items-center"},[ne(u("div",null,nft,512),[[Ot,s.ezc_collapsed]]),ne(u("div",null,sft,512),[[Ot,!s.ezc_collapsed]]),rft,r.configFile.extensions?(w(),M("div",oft,"|")):q("",!0),r.configFile.extensions?(w(),M("div",aft,[r.mountedExtensions.length>0?(w(),M("div",lft,[(w(!0),M($e,null,ct(r.mountedExtensions,(h,E)=>(w(),M("div",{class:"relative hover:-translate-y-2 duration-300 hover:z-10 shrink-0",key:E+"-"+h.name,ref_for:!0,ref:"mountedExtensions"},[u("div",cft,[u("button",null,[u("img",{src:s.bUrl+h.avatar,onError:e[246]||(e[246]=(...b)=>r.extensionImgPlacehodler&&r.extensionImgPlacehodler(...b)),class:Ye(["w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 group-hover:border-secondary","border-transparent z-0"]),title:h.name},null,40,dft)]),u("button",{onClick:Te(b=>r.unmountExtension(h),["stop"])},_ft,8,uft)])]))),128))])):q("",!0)])):q("",!0)])]),u("div",{class:Ye([{hidden:s.ezc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[u("div",hft,[fft,u("div",mft,[u("div",gft,[s.searchExtensionInProgress?(w(),M("div",bft,vft)):q("",!0),s.searchExtensionInProgress?q("",!0):(w(),M("div",yft,Tft))]),ne(u("input",{type:"search",id:"personality-search",class:"block w-full p-4 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Search extension...",required:"","onUpdate:modelValue":e[248]||(e[248]=h=>s.searchExtension=h),onKeyup:e[249]||(e[249]=Te((...h)=>n.searchExtension_func&&n.searchExtension_func(...h),["stop"]))},null,544),[[Pe,s.searchExtension]]),s.searchExtension?(w(),M("button",{key:0,onClick:e[250]||(e[250]=Te(h=>s.searchExtension="",["stop"])),type:"button",class:"text-white absolute right-2.5 bottom-2.5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"}," Clear search")):q("",!0)])]),s.searchExtension?q("",!0):(w(),M("div",xft,[u("label",Cft," Extensions Category: ("+fe(s.extCatgArr.length)+") ",1),u("select",{id:"extCat",onChange:e[251]||(e[251]=h=>r.update_extension_category(h.target.value,r.refresh)),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},[(w(!0),M($e,null,ct(s.extCatgArr,(h,E)=>(w(),M("option",{key:E,selected:h==this.extension_category},fe(h),9,Rft))),128))],32)])),u("div",null,[s.extensionsFiltered.length>0?(w(),M("div",Aft,[u("label",wft,fe(s.searchExtension?"Search results":"Personalities")+": ("+fe(s.extensionsFiltered.length)+") ",1),u("div",{class:Ye(["overflow-y-auto no-scrollbar p-2 pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4",s.ezl_collapsed?"":"max-h-96"])},[(w(!0),M($e,null,ct(s.extensionsFiltered,(h,E)=>(w(),xt(_,{ref_for:!0,ref:"extensionsZoo",key:"index-"+E+"-"+h.name,extension:h,select_language:!0,full_path:h.full_path,"on-mount":r.mountExtension,"on-un-mount":r.unmountExtension,"on-remount":r.remountExtension,"on-reinstall":r.onExtensionReinstall,"on-settings":r.onSettingsExtension},null,8,["extension","full_path","on-mount","on-un-mount","on-remount","on-reinstall","on-settings"]))),128))],2)])):q("",!0)]),s.ezc_collapsed?(w(),M("button",{key:1,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Collapse",type:"button",onClick:e[252]||(e[252]=h=>s.ezl_collapsed=!s.ezl_collapsed)},Oft)):(w(),M("button",{key:2,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Expand",type:"button",onClick:e[253]||(e[253]=h=>s.ezl_collapsed=!s.ezl_collapsed)},Mft))],2)]),u("div",Dft,[u("div",kft,[u("button",{onClick:e[254]||(e[254]=Te(h=>s.mep_collapsed=!s.mep_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 text-left w-full flex items-center"},[ne(u("div",null,Pft,512),[[Ot,s.mep_collapsed]]),ne(u("div",null,Fft,512),[[Ot,!s.mep_collapsed]]),Bft])]),u("div",{class:Ye([{hidden:s.mep_collapsed},"flex flex-col mb-2 px-3 pb-0"])},null,2)]),u("div",Gft,[u("div",zft,[u("button",{onClick:e[255]||(e[255]=Te(h=>s.mc_collapsed=!s.mc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex items-center"},[ne(u("div",null,Hft,512),[[Ot,s.mc_collapsed]]),ne(u("div",null,Yft,512),[[Ot,!s.mc_collapsed]]),$ft])]),u("div",{class:Ye([{hidden:s.mc_collapsed},"flex flex-col mb-2 p-2"])},[u("div",Wft,[u("div",Kft,[ne(u("input",{id:"override-model-parameters",type:"checkbox",class:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-700 dark:focus:ring-offset-gray-700 focus:ring-2 dark:bg-gray-600 dark:border-gray-500",onClick:e[256]||(e[256]=Te(()=>{},["stop"])),"onUpdate:modelValue":e[257]||(e[257]=h=>r.configFile.override_personality_model_parameters=h),onChange:e[258]||(e[258]=h=>r.update_setting("override_personality_model_parameters",r.configFile.override_personality_model_parameters))},null,544),[[ut,r.configFile.override_personality_model_parameters]]),jft])]),u("div",{class:Ye(r.configFile.override_personality_model_parameters?"":"pointer-events-none opacity-30")},[u("div",Qft,[Xft,ne(u("input",{type:"text",id:"seed","onUpdate:modelValue":e[259]||(e[259]=h=>r.configFile.seed=h),class:"bg-gray-50 border border-gray-300 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,512),[[Pe,r.configFile.seed]])]),u("div",Zft,[u("div",Jft,[u("div",emt,[tmt,u("p",nmt,[ne(u("input",{type:"text",id:"temp-val","onUpdate:modelValue":e[260]||(e[260]=h=>r.configFile.temperature=h),onChange:e[261]||(e[261]=h=>s.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.temperature]])])]),ne(u("input",{id:"temperature",onChange:e[262]||(e[262]=h=>s.settingsChanged=!0),type:"range","onUpdate:modelValue":e[263]||(e[263]=h=>r.configFile.temperature=h),min:"0",max:"5",step:"0.1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.temperature]])])]),u("div",imt,[u("div",smt,[u("div",rmt,[omt,u("p",amt,[ne(u("input",{type:"text",id:"predict-val","onUpdate:modelValue":e[264]||(e[264]=h=>r.configFile.n_predict=h),onChange:e[265]||(e[265]=h=>s.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.n_predict]])])]),ne(u("input",{id:"predict",type:"range",onChange:e[266]||(e[266]=h=>s.settingsChanged=!0),"onUpdate:modelValue":e[267]||(e[267]=h=>r.configFile.n_predict=h),min:"0",max:"2048",step:"32",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.n_predict]])])]),u("div",lmt,[u("div",cmt,[u("div",dmt,[umt,u("p",pmt,[ne(u("input",{type:"text",id:"top_k-val","onUpdate:modelValue":e[268]||(e[268]=h=>r.configFile.top_k=h),onChange:e[269]||(e[269]=h=>s.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.top_k]])])]),ne(u("input",{id:"top_k",type:"range",onChange:e[270]||(e[270]=h=>s.settingsChanged=!0),"onUpdate:modelValue":e[271]||(e[271]=h=>r.configFile.top_k=h),min:"0",max:"100",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.top_k]])])]),u("div",_mt,[u("div",hmt,[u("div",fmt,[mmt,u("p",gmt,[ne(u("input",{type:"text",id:"top_p-val","onUpdate:modelValue":e[272]||(e[272]=h=>r.configFile.top_p=h),onChange:e[273]||(e[273]=h=>s.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.top_p]])])]),ne(u("input",{id:"top_p",type:"range","onUpdate:modelValue":e[274]||(e[274]=h=>r.configFile.top_p=h),min:"0",max:"1",step:"0.01",onChange:e[275]||(e[275]=h=>s.settingsChanged=!0),class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.top_p]])])]),u("div",bmt,[u("div",Emt,[u("div",vmt,[ymt,u("p",Smt,[ne(u("input",{type:"text",id:"repeat_penalty-val","onUpdate:modelValue":e[276]||(e[276]=h=>r.configFile.repeat_penalty=h),onChange:e[277]||(e[277]=h=>s.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.repeat_penalty]])])]),ne(u("input",{id:"repeat_penalty",onChange:e[278]||(e[278]=h=>s.settingsChanged=!0),type:"range","onUpdate:modelValue":e[279]||(e[279]=h=>r.configFile.repeat_penalty=h),min:"0",max:"2",step:"0.01",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.repeat_penalty]])])]),u("div",Tmt,[u("div",xmt,[u("div",Cmt,[Rmt,u("p",Amt,[ne(u("input",{type:"text",id:"repeat_last_n-val","onUpdate:modelValue":e[280]||(e[280]=h=>r.configFile.repeat_last_n=h),onChange:e[281]||(e[281]=h=>s.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.repeat_last_n]])])]),ne(u("input",{id:"repeat_last_n",type:"range","onUpdate:modelValue":e[282]||(e[282]=h=>r.configFile.repeat_last_n=h),min:"0",max:"100",step:"1",onChange:e[283]||(e[283]=h=>s.settingsChanged=!0),class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Pe,r.configFile.repeat_last_n]])])])],2)],2)])],2)]),Oe(f,{ref:"addmodeldialog"},null,512),Oe(m,{class:"z-20",show:s.variantSelectionDialogVisible,choices:s.variant_choices,onChoiceSelected:r.onVariantChoiceSelected,onCloseDialog:r.oncloseVariantChoiceDialog,onChoiceValidated:r.onvalidateVariantChoice},null,8,["show","choices","onChoiceSelected","onCloseDialog","onChoiceValidated"])],64)}const Nmt=bt(Mot,[["render",wmt],["__scopeId","data-v-bbd5a2e4"]]),Omt={components:{ClipBoardTextInput:RE,Card:vc},data(){return{dataset_path:"",max_length:1024,batch_size:4,lr:5e-5,num_epochs:2,selectedFolder:"",selectedDataset:""}},methods:{submitForm(){const n={model_name:this.selectedModel,dataset_file:this.selectedDataset,max_length:this.max_length,batch_size:this.batch_size,lr:this.lr,num_epochs:this.num_epochs,output_dir:this.selectedFolder};Me.post("/start_training",n).then(e=>{})},openFolderSelector(){this.$refs.folder_selector.click()},selectOutputDirectory(n){var t;console.log("here");const e=(t=n.target.files[0])==null?void 0:t.path;console.log(e),e&&(this.selectedFolder=e)},selectDataset(n){const e=n.target.files;e.length>0&&(this.selectedDataset=e[0])}},computed:{selectedModel:{get(){return this.$store.state.selectedModel}},models:{get(){return this.$store.state.modelsArr}}},watch:{model_name(n){console.log("watching model_name",n),this.$refs.clipboardInput.inputValue=n}}},Imt={key:0,class:"container overflow-y-scroll flex flex-col no-scrollbar shadow-lg p-10 pt-2 bg-bg-light-tone dark:bg-bg-dark-tone"},Mmt={class:"mb-4"},Dmt=u("label",{for:"model_name",class:"text-sm"},"Model Name:",-1),kmt=["value"],Lmt={class:"mb-4"},Pmt=u("label",{for:"dataset_path",class:"text-sm"},"Dataset:",-1),Umt={class:"mb-4"},Fmt=u("label",{for:"lr",class:"text-sm"},"Learning Rate:",-1),Bmt={class:"mb-4"},Gmt=u("label",{for:"num_epochs",class:"text-sm"},"Number of Epochs:",-1),zmt={class:"mb-4"},Vmt=u("label",{for:"max_length",class:"text-sm"},"Max Length:",-1),Hmt={class:"mb-4"},qmt=u("label",{for:"batch_size",class:"text-sm"},"Batch Size:",-1),Ymt={class:"mb-4"},$mt=u("label",{for:"output_dir",class:"text-sm"},"Output Directory:",-1),Wmt=u("button",{class:"bg-blue-500 text-white px-4 py-2 rounded"},"Start training",-1),Kmt={key:1};function jmt(n,e,t,i,s,r){const o=ht("Card"),a=ht("ClipBoardTextInput");return r.selectedModel!==null&&r.selectedModel.toLowerCase().includes("gptq")?(w(),M("div",Imt,[u("form",{onSubmit:e[2]||(e[2]=Te((...l)=>r.submitForm&&r.submitForm(...l),["prevent"])),class:""},[Oe(o,{title:"Training configuration",isHorizontal:!0,disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[Oe(o,{title:"Model",class:"",isHorizontal:!1},{default:Je(()=>[u("div",Mmt,[Dmt,ne(u("select",{"onUpdate:modelValue":e[0]||(e[0]=l=>r.selectedModel=l),onChange:e[1]||(e[1]=(...l)=>n.setModel&&n.setModel(...l)),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},[(w(!0),M($e,null,ct(r.models,l=>(w(),M("option",{key:l,value:l},fe(l),9,kmt))),128))],544),[[zn,r.selectedModel]])])]),_:1}),Oe(o,{title:"Data",isHorizontal:!1},{default:Je(()=>[u("div",Lmt,[Pmt,Oe(a,{id:"model_path",inputType:"file",value:s.dataset_path,onchange:"selectDataset()"},null,8,["value"])])]),_:1}),Oe(o,{title:"Training",isHorizontal:!1},{default:Je(()=>[u("div",Umt,[Fmt,Oe(a,{id:"model_path",inputType:"integer",value:s.lr},null,8,["value"])]),u("div",Bmt,[Gmt,Oe(a,{id:"model_path",inputType:"integer",value:s.num_epochs},null,8,["value"])]),u("div",zmt,[Vmt,Oe(a,{id:"model_path",inputType:"integer",value:s.max_length},null,8,["value"])]),u("div",Hmt,[qmt,Oe(a,{id:"model_path",inputType:"integer",value:s.batch_size},null,8,["value"])])]),_:1}),Oe(o,{title:"Output",isHorizontal:!1},{default:Je(()=>[u("div",Ymt,[$mt,Oe(a,{id:"model_path",inputType:"text",value:n.output_dir},null,8,["value"])])]),_:1})]),_:1}),Oe(o,{disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[Wmt]),_:1})],32)])):(w(),M("div",Kmt,[Oe(o,{title:"Info",class:"",isHorizontal:!1},{default:Je(()=>[je(" Only GPTQ models are supported for QLora fine tuning. Please select a GPTQ compatible binding. ")]),_:1})]))}const Qmt=bt(Omt,[["render",jmt]]),Xmt={components:{ClipBoardTextInput:RE,Card:vc},data(){return{model_name:"jondurbin/airoboros-7b-gpt4",tokenizer_name:"jondurbin/airoboros-7b-gpt4",dataset_path:"",max_length:1024,batch_size:4,lr:5e-5,num_epochs:2,selectedFolder:"",selectedDatasetPath:""}},methods:{submitForm(){this.model_name,this.tokenizer_name,this.selectedDatasetPath,this.max_length,this.batch_size,this.lr,this.num_epochs,this.selectedFolder},openFolderSelector(){this.$refs.folder_selector.click()},selectOutputDirectory(n){var t;console.log("here");const e=(t=n.target.files[0])==null?void 0:t.path;console.log(e),e&&(this.selectedFolder=e)},selectDatasetPath(n){const e=n.target.files;e.length>0&&(this.selectedDatasetPath=e[0].webkitRelativePath)}}},Zmt={class:"container overflow-y-scroll flex flex-col no-scrollbar shadow-lg p-10 pt-2 bg-bg-light-tone dark:bg-bg-dark-tone"},Jmt={class:"mb-4"},egt=u("label",{for:"model_name",class:"text-sm"},"Model Name:",-1),tgt={class:"mb-4"},ngt=u("label",{for:"tokenizer_name",class:"text-sm"},"Tokenizer Name:",-1),igt=u("button",{type:"submit",class:"bg-blue-500 text-white px-4 py-2 rounded"},"Quantize LLM",-1);function sgt(n,e,t,i,s,r){const o=ht("ClipBoardTextInput"),a=ht("Card");return w(),M("div",Zmt,[u("form",{onSubmit:e[0]||(e[0]=Te((...l)=>r.submitForm&&r.submitForm(...l),["prevent"])),class:"max-w-md mx-auto"},[Oe(a,{title:"Quantizing configuration",isHorizontal:!0,disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[Oe(a,{title:"Model",class:"",isHorizontal:!1},{default:Je(()=>[u("div",Jmt,[egt,Oe(o,{id:"model_path",inputType:"text",value:s.model_name},null,8,["value"])]),u("div",tgt,[ngt,Oe(o,{id:"model_path",inputType:"text",value:s.tokenizer_name},null,8,["value"])])]),_:1})]),_:1}),Oe(a,{disableHoverAnimation:!0,disableFocus:!0},{default:Je(()=>[igt]),_:1})],32)])}const rgt=bt(Xmt,[["render",sgt]]),ogt={name:"Discussion",emits:["delete","select","editTitle","makeTitle","checked"],props:{id:Number,title:String,selected:Boolean,loading:Boolean,isCheckbox:Boolean,checkBoxValue:Boolean},setup(){},data(){return{showConfirmation:!1,editTitleMode:!1,makeTitleMode:!1,deleteMode:!1,editTitle:!1,newTitle:String,checkBoxValue_local:!1}},methods:{cancel(){this.editTitleMode=!1,this.makeTitleMode=!1,this.deleteMode=!1,this.showConfirmation=!1},deleteEvent(){this.showConfirmation=!1,this.$emit("delete")},selectEvent(){this.$emit("select")},editTitleEvent(){this.editTitle=!1,this.editTitleMode=!1,this.makeTitleMode=!1,this.deleteMode=!1,this.showConfirmation=!1,this.$emit("editTitle",{title:this.newTitle,id:this.id})},makeTitleEvent(){this.$emit("makeTitle",{id:this.id}),this.showConfirmation=!1},chnageTitle(n){this.newTitle=n},checkedChangeEvent(n,e){this.$emit("checked",n,e)}},mounted(){this.newTitle=this.title,Ve(()=>{qe.replace()})},watch:{showConfirmation(){Ve(()=>{qe.replace()})},editTitleMode(n){this.showConfirmation=n,this.editTitle=n,n&&Ve(()=>{try{this.$refs.titleBox.focus()}catch{}})},deleteMode(n){this.showConfirmation=n,n&&Ve(()=>{this.$refs.titleBox.focus()})},makeTitleMode(n){this.showConfirmation=n},checkBoxValue(n,e){this.checkBoxValue_local=n}}},agt=["id"],lgt={class:"flex flex-row items-center gap-2"},cgt={key:0},dgt=["title"],ugt=["value"],pgt={class:"flex items-center flex-1 max-h-6"},_gt={key:0,class:"flex gap-3 flex-1 items-center justify-end duration-75"},hgt=u("i",{"data-feather":"x"},null,-1),fgt=[hgt],mgt=u("i",{"data-feather":"check"},null,-1),ggt=[mgt],bgt={key:1,class:"flex gap-3 flex-1 items-center justify-end invisible group-hover:visible duration-75"},Egt=u("i",{"data-feather":"type"},null,-1),vgt=[Egt],ygt=u("i",{"data-feather":"edit-2"},null,-1),Sgt=[ygt],Tgt=u("i",{"data-feather":"trash"},null,-1),xgt=[Tgt];function Cgt(n,e,t,i,s,r){return w(),M("div",{class:Ye([t.selected?"bg-bg-light-discussion dark:bg-bg-dark-discussion shadow-md min-w-[23rem] max-w-[23rem]":" min-w-[23rem] max-w-[23rem]","flex flex-row sm:flex-row flex-wrap flex-shrink: 0 item-center shadow-sm gap-2 py-2 my-2 hover:shadow-md hover:bg-primary-light dark:hover:bg-primary rounded-md p-2 duration-75 group cursor-pointer"]),id:"dis-"+t.id,onClick:e[12]||(e[12]=Te(o=>r.selectEvent(),["stop"]))},[u("div",lgt,[t.isCheckbox?(w(),M("div",cgt,[ne(u("input",{type:"checkbox",class:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-700 dark:focus:ring-offset-gray-700 focus:ring-2 dark:bg-gray-600 dark:border-gray-500",onClick:e[0]||(e[0]=Te(()=>{},["stop"])),"onUpdate:modelValue":e[1]||(e[1]=o=>s.checkBoxValue_local=o),onInput:e[2]||(e[2]=o=>r.checkedChangeEvent(o,t.id))},null,544),[[ut,s.checkBoxValue_local]])])):q("",!0),t.selected?(w(),M("div",{key:1,class:Ye(["min-h-full w-2 rounded-xl self-stretch",t.loading?"animate-bounce bg-accent ":" bg-secondary "])},null,2)):q("",!0),t.selected?q("",!0):(w(),M("div",{key:2,class:Ye(["w-2",t.loading?"min-h-full w-2 rounded-xl self-stretch animate-bounce bg-accent ":" "])},null,2))]),s.editTitle?q("",!0):(w(),M("p",{key:0,title:t.title,class:"line-clamp-1 w-4/6 ml-1 -mx-5"},fe(t.title?t.title==="untitled"?"New discussion":t.title:"New discussion"),9,dgt)),s.editTitle?(w(),M("input",{key:1,type:"text",id:"title-box",ref:"titleBox",class:"bg-bg-light dark:bg-bg-dark rounded-md border-0 w-full -m-1 p-1",value:t.title,required:"",onKeydown:[e[3]||(e[3]=wr(Te(o=>r.editTitleEvent(),["exact"]),["enter"])),e[4]||(e[4]=wr(Te(o=>s.editTitleMode=!1,["exact"]),["esc"]))],onInput:e[5]||(e[5]=o=>r.chnageTitle(o.target.value)),onClick:e[6]||(e[6]=Te(()=>{},["stop"]))},null,40,ugt)):q("",!0),u("div",pgt,[s.showConfirmation?(w(),M("div",_gt,[u("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Discard title changes",type:"button",onClick:e[7]||(e[7]=Te(o=>r.cancel(),["stop"]))},fgt),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm title changes",type:"button",onClick:e[8]||(e[8]=Te(o=>s.editTitleMode?r.editTitleEvent():s.deleteMode?r.deleteEvent():r.makeTitleEvent(),["stop"]))},ggt)])):q("",!0),s.showConfirmation?q("",!0):(w(),M("div",bgt,[u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Make a title",type:"button",onClick:e[9]||(e[9]=Te(o=>s.makeTitleMode=!0,["stop"]))},vgt),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Edit title",type:"button",onClick:e[10]||(e[10]=Te(o=>s.editTitleMode=!0,["stop"]))},Sgt),u("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Remove discussion",type:"button",onClick:e[11]||(e[11]=Te(o=>s.deleteMode=!0,["stop"]))},xgt)]))])],10,agt)}const wE=bt(ogt,[["render",Cgt]]),Rgt={data(){return{show:!1,prompt:"",inputText:""}},methods:{showPanel(){this.show=!0},ok(){this.show=!1,this.$emit("ok",this.inputText)},cancel(){this.show=!1,this.inputText=""}},props:{promptText:{type:String,required:!0}},watch:{promptText(n){this.prompt=n}}},Agt={key:0,class:"fixed top-0 left-0 w-full h-full flex justify-center items-center bg-black bg-opacity-50"},wgt={class:"bg-white p-8 rounded"},Ngt={class:"text-xl font-bold mb-4"};function Ogt(n,e,t,i,s,r){return w(),M("div",null,[s.show?(w(),M("div",Agt,[u("div",wgt,[u("h2",Ngt,fe(t.promptText),1),ne(u("input",{type:"text","onUpdate:modelValue":e[0]||(e[0]=o=>s.inputText=o),class:"border border-gray-300 px-4 py-2 rounded mb-4"},null,512),[[Pe,s.inputText]]),u("button",{onClick:e[1]||(e[1]=(...o)=>r.ok&&r.ok(...o)),class:"bg-blue-500 text-white px-4 py-2 rounded mr-2"},"OK"),u("button",{onClick:e[2]||(e[2]=(...o)=>r.cancel&&r.cancel(...o)),class:"bg-gray-500 text-white px-4 py-2 rounded"},"Cancel")])])):q("",!0)])}const EO=bt(Rgt,[["render",Ogt]]),Igt={data(){return{id:0,loading:!1,isCheckbox:!1,isVisible:!1,categories:[],titles:[],content:"",searchQuery:""}},components:{Discussion:wE,MarkdownRenderer:ap},props:{host:{type:String,required:!1,default:"http://localhost:9600"}},methods:{showSkillsLibrary(){this.isVisible=!0,this.fetchTitles()},closeComponent(){this.isVisible=!1},fetchCategories(){Me.post("/get_skills_library_categories",{client_id:this.$store.state.client_id}).then(n=>{this.categories=n.data.categories}).catch(n=>{console.error("Error fetching categories:",n)})},fetchTitles(){console.log("Fetching categories"),Me.post("/get_skills_library_titles",{client_id:this.$store.state.client_id}).then(n=>{this.titles=n.data.titles,console.log("titles recovered")}).catch(n=>{console.error("Error fetching titles:",n)})},fetchContent(n){Me.post("/get_skills_library_content",{client_id:this.$store.state.client_id,skill_id:n}).then(e=>{const t=e.data.contents[0];this.id=t.id,this.content=t.content}).catch(e=>{console.error("Error fetching content:",e)})},deleteCategory(n){console.log("Delete category")},editCategory(n){console.log("Edit category")},checkUncheckCategory(n){console.log("Unchecked category")},deleteSkill(n){console.log("Delete skill ",n),Me.post("/delete_skill",{client_id:this.$store.state.client_id,skill_id:n}).then(()=>{this.fetchTitles()})},editTitle(n){Me.post("/edit_skill_title",{client_id:this.$store.state.client_id,skill_id:n,title:n}).then(()=>{this.fetchTitles()}),console.log("Edit title")},makeTitle(n){console.log("Make title")},checkUncheckTitle(n){},searchSkills(){}}},Mgt={id:"leftPanel",class:"flex flex-row h-full flex-grow shadow-lg rounded"},Dgt={class:"min-w-[23rem] max-w-[23rem] z-10 top-0 bg-bg-light-tone dark:bg-bg-dark-tone shadow-md overflow-y-scroll no-scrollbar"},kgt={class:"search p-4"},Lgt={classclass:"absolute flex flex-col no-scrollbar shadow-lg min-w-[24rem] max-w-[24rem] bg-bg-light-tone dark:bg-bg-dark-tone top-20 left-20 bottom-20 right-20 bg-bg-light shadow-lg rounded"},Pgt=u("h2",{class:"text-xl font-bold m-4"},"Titles",-1),Ugt={class:"z-0 flex flex-col flex-grow overflow-y-auto scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},Fgt=u("h2",{class:"text-xl font-bold m-4"},"Content",-1);function Bgt(n,e,t,i,s,r){const o=ht("Discussion"),a=ht("MarkdownRenderer");return w(),M("div",{class:Ye([{hidden:!s.isVisible},"absolute flex flex-col no-scrollbar shadow-lg bg-bg-light dark:bg-bg-dark top-20 left-20 bottom-20 right-20 shadow-lg rounded"])},[u("div",Mgt,[u("div",Dgt,[u("div",kgt,[ne(u("input",{type:"text","onUpdate:modelValue":e[0]||(e[0]=l=>s.searchQuery=l),placeholder:"Search skills",class:"border border-gray-300 rounded px-2 py-1 mr-2"},null,512),[[Pe,s.searchQuery]]),u("button",{onClick:e[1]||(e[1]=(...l)=>r.searchSkills&&r.searchSkills(...l)),class:"bg-blue-500 text-white rounded px-4 py-1"},"Search")]),u("div",Lgt,[Pgt,s.titles.length>0?(w(),xt(rs,{key:0,name:"list"},{default:Je(()=>[(w(!0),M($e,null,ct(s.titles,l=>(w(),xt(o,{key:l.id,id:l.id,title:l.title,selected:r.fetchContent(l.id),loading:s.loading,isCheckbox:s.isCheckbox,checkBoxValue:!1,onSelect:d=>r.fetchContent(l.id),onDelete:d=>r.deleteSkill(l.id),onEditTitle:r.editTitle,onMakeTitle:r.makeTitle,onChecked:r.checkUncheckTitle},null,8,["id","title","selected","loading","isCheckbox","onSelect","onDelete","onEditTitle","onMakeTitle","onChecked"]))),128))]),_:1})):q("",!0)])]),u("div",Ugt,[Fgt,Oe(a,{host:t.host,"markdown-text":s.content,message_id:s.id,discussion_id:s.id,client_id:this.$store.state.client_id},null,8,["host","markdown-text","message_id","discussion_id","client_id"])])]),u("button",{onClick:e[2]||(e[2]=(...l)=>r.closeComponent&&r.closeComponent(...l)),class:"absolute top-2 right-2 bg-red-500 text-white rounded px-2 py-1 hover:bg-red-300"},"Close")],2)}const vO=bt(Igt,[["render",Bgt]]),Ggt={props:{htmlContent:{type:String,required:!0}}},zgt=["innerHTML"];function Vgt(n,e,t,i,s,r){return w(),M("div",null,[u("div",{innerHTML:t.htmlContent},null,8,zgt)])}const Hgt=bt(Ggt,[["render",Vgt]]);const qgt={props:{jsonData:{type:[Object,Array,String],default:null},jsonFormText:{type:String,default:"JSON Form"}},data(){return{collapsed:!0}},computed:{formattedJson(){return typeof this.jsonData=="string"?JSON.stringify(JSON.parse(this.jsonData),null," ").replace(/\n/g,"
"):JSON.stringify(this.jsonData,null," ").replace(/\n/g,"
")},isObject(){return typeof this.jsonData=="object"&&this.jsonData!==null},isContentPresent(){return this.jsonData!==null&&(typeof this.jsonData!="string"||this.jsonData.trim()!=="")}},methods:{toggleCollapsed(){this.collapsed=!this.collapsed},toggleCollapsible(){this.collapsed=!this.collapsed}}},Ygt={key:0},$gt={class:"toggle-icon mr-1"},Wgt={key:0,class:"fas fa-plus-circle text-gray-600"},Kgt={key:1,class:"fas fa-minus-circle text-gray-600"},jgt={class:"json-viewer max-h-64 overflow-auto p-4 bg-gray-100 border border-gray-300 rounded dark:bg-gray-600"},Qgt={key:0,class:"fas fa-plus-circle text-gray-600"},Xgt={key:1,class:"fas fa-minus-circle text-gray-600"},Zgt=["innerHTML"];function Jgt(n,e,t,i,s,r){return r.isContentPresent?(w(),M("div",Ygt,[u("div",{class:"collapsible-section cursor-pointer mb-4 font-bold hover:text-gray-900",onClick:e[0]||(e[0]=(...o)=>r.toggleCollapsible&&r.toggleCollapsible(...o))},[u("span",$gt,[s.collapsed?(w(),M("i",Wgt)):(w(),M("i",Kgt))]),je(" "+fe(t.jsonFormText),1)]),ne(u("div",null,[u("div",jgt,[r.isObject?(w(),M("span",{key:0,onClick:e[1]||(e[1]=(...o)=>r.toggleCollapsed&&r.toggleCollapsed(...o)),class:"toggle-icon cursor-pointer mr-1"},[s.collapsed?(w(),M("i",Qgt)):(w(),M("i",Xgt))])):q("",!0),u("pre",{innerHTML:r.formattedJson},null,8,Zgt)])],512),[[Ot,!s.collapsed]])])):q("",!0)}const ebt=bt(qgt,[["render",Jgt]]),tbt={props:{done:{type:Boolean,required:!0},message:{type:String,required:!0},status:{type:Boolean,required:!0},step_type:{type:String,required:!1,default:"start_end"}}},nbt={class:"flex items-start"},ibt={class:"step flex items-center mb-4"},sbt={key:0,class:"flex items-center justify-center w-6 h-6 mr-2"},rbt={key:0},obt=u("i",{"data-feather":"square",class:"text-gray-400 w-4 h-4"},null,-1),abt=[obt],lbt={key:1},cbt=u("i",{"data-feather":"check-square",class:"text-green-500 w-4 h-4"},null,-1),dbt=[cbt],ubt={key:2},pbt=u("i",{"data-feather":"x-square",class:"text-red-500 w-4 h-4"},null,-1),_bt=[pbt],hbt={key:1,role:"status",class:"m-15"},fbt=u("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1),mbt=[fbt],gbt={class:"text-sm ml-6"};function bbt(n,e,t,i,s,r){return w(),M("div",nbt,[u("div",ibt,[t.step_type=="start_end"?(w(),M("div",sbt,[t.done?q("",!0):(w(),M("div",rbt,abt)),t.done&&t.status?(w(),M("div",lbt,dbt)):q("",!0),t.done&&!t.status?(w(),M("div",ubt,_bt)):q("",!0)])):q("",!0),t.done?q("",!0):(w(),M("div",hbt,mbt)),u("h3",gbt,fe(t.message),1)])])}const Ebt=bt(tbt,[["render",bbt]]),vbt="/assets/process-61f7a21b.svg",ybt="/assets/ok-a0b56451.svg",Sbt="/assets/failed-183609e7.svg",yO="/assets/send_globe-775ba9b7.svg";const Tbt="/",xbt={name:"Message",emits:["copy","delete","rankUp","rankDown","updateMessage","resendMessage","continueMessage"],components:{MarkdownRenderer:ap,Step:Ebt,RenderHTMLJS:Hgt,JsonViewer:ebt,DynamicUIRenderer:bO},props:{host:{type:String,required:!1,default:"http://localhost:9600"},message:Object,avatar:{default:""}},data(){return{isSynthesizingVoice:!1,cpp_block:uO,html5_block:pO,LaTeX_block:_O,json_block:dO,javascript_block:cO,process_svg:vbt,ok_svg:ybt,failed_svg:Sbt,loading_svg:fO,sendGlobe:yO,code_block:aO,python_block:lO,bash_block:hO,audio_url:null,audio:null,msg:null,isSpeaking:!1,speechSynthesis:null,voices:[],expanded:!1,showConfirmation:!1,editMsgMode_:!1,deleteMsgMode:!1,mdRenderHeight:Number}},mounted(){if("speechSynthesis"in window?(this.speechSynthesis=window.speechSynthesis,this.voices=this.speechSynthesis.getVoices(),this.voices.length===0?this.speechSynthesis.addEventListener("voiceschanged",this.onVoicesChanged):console.log("No voices found")):console.error("Speech synthesis is not supported in this browser."),Ve(()=>{qe.replace(),this.mdRenderHeight=this.$refs.mdRender.$el.offsetHeight}),console.log("Checking metadata"),console.log(this.message),Object.prototype.hasOwnProperty.call(this.message,"metadata")&&this.message.metadata!=null){console.log("Metadata found!"),Array.isArray(this.message.metadata)||(this.message.metadata=[]),console.log(typeof this.message.metadata),console.log(this.message.metadata);for(let n of this.message.metadata)Object.prototype.hasOwnProperty.call(n,"audio_url")&&n.audio_url!=null&&(this.audio_url=n.audio_url,console.log("Audio URL:",this.audio_url))}},methods:{computeTimeDiff(n,e){let t=e.getTime()-n.getTime();const i=Math.floor(t/(1e3*60*60));t-=i*(1e3*60*60);const s=Math.floor(t/(1e3*60));t-=s*(1e3*60);const r=Math.floor(t/1e3);return t-=r*1e3,[i,s,r]},insertTab(n){const e=n.target,t=e.selectionStart,i=e.selectionEnd,s=n.shiftKey;if(t===i)if(s){if(e.value.substring(t-4,t)==" "){const r=e.value.substring(0,t-4),o=e.value.substring(i),a=r+o;this.message.content=a,this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t-4})}}else{const r=e.value.substring(0,t),o=e.value.substring(i),a=r+" "+o;this.message.content=a,this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+4})}else{const o=e.value.substring(t,i).split(` `).map(c=>c.trim()===""?c:s?c.startsWith(" ")?c.substring(4):c:" "+c),a=e.value.substring(0,t),l=e.value.substring(i),d=a+o.join(` `)+l;this.message.content=d,this.$nextTick(()=>{e.selectionStart=t,e.selectionEnd=i+o.length*4})}n.preventDefault()},onVoicesChanged(){this.voices=this.speechSynthesis.getVoices()},read(){this.isSynthesizingVoice?(this.isSynthesizingVoice=!1,this.$refs.audio_player.pause()):(this.isSynthesizingVoice=!0,Me.post("./text2Audio",{text:this.message.content}).then(n=>{this.isSynthesizingVoice=!1;let e=n.data.url;console.log(e),this.audio_url=e,this.message.metadata||(this.message.metadata=[]);let t=!1;for(let i of this.message.metadata)Object.prototype.hasOwnProperty.call(i,"audio_url")&&(i.audio_url=this.audio_url,t=!0);t||this.message.metadata.push({audio_url:this.audio_url}),this.$emit("updateMessage",this.message.id,this.message.content,this.audio_url)}).catch(n=>{this.$store.state.toast.showToast(`Error: ${n}`,4,!1),this.isSynthesizingVoice=!1}))},speak(){if(this.msg){this.speechSynthesis.cancel(),this.msg=null,this.isSpeaking=!1;return}let n=0;console.log("voice on"),this.isSpeaking=!0;const e=200;this.message.content,this.msg=new SpeechSynthesisUtterance,this.msg.pitch=this.$store.state.config.audio_pitch,this.voices.length>0&&(this.msg.voice=this.voices.filter(s=>s.name===this.$store.state.config.audio_out_voice)[0]);const t=s=>{let r=this.message.content.substring(s,s+e);const o=[".","!","?",` `];let a=-1;return o.forEach(l=>{const d=r.lastIndexOf(l);d>a&&(a=d)}),a==-1&&(a=r.length),console.log(a),a+s+1},i=()=>{if(this.message.content.includes(".")){const s=t(n),r=this.message.content.substring(n,s);this.msg.text=r,n=s+1,this.msg.onend=o=>{n{i()},1):(this.isSpeaking=!1,console.log("voice off :",this.message.content.length," ",s))},this.speechSynthesis.speak(this.msg)}else setTimeout(()=>{i()},1)};i()},toggleModel(){this.expanded=!this.expanded},addBlock(n){let e=this.$refs.mdTextarea.selectionStart,t=this.$refs.mdTextarea.selectionEnd;e==t?speechSynthesis==0||this.message.content[e-1]==` `?(this.message.content=this.message.content.slice(0,e)+"```"+n+"\n\n```\n"+this.message.content.slice(e),e=e+4+n.length):(this.message.content=this.message.content.slice(0,e)+"\n```"+n+"\n\n```\n"+this.message.content.slice(e),e=e+3+n.length):speechSynthesis==0||this.message.content[e-1]==` `?(this.message.content=this.message.content.slice(0,e)+"```"+n+` `+this.message.content.slice(e,t)+"\n```\n"+this.message.content.slice(t),e=e+4+n.length):(this.message.content=this.message.content.slice(0,e)+"\n```"+n+` -`+this.message.content.slice(e,t)+"\n```\n"+this.message.content.slice(t),p=p+3+n.length),this.$refs.mdTextarea.focus(),this.$refs.mdTextarea.selectionStart=this.$refs.mdTextarea.selectionEnd=p},copyContentToClipboard(){this.$emit("copy",this)},deleteMsg(){this.$emit("delete",this.message.id),this.deleteMsgMode=!1},rankUp(){this.$emit("rankUp",this.message.id)},rankDown(){this.$emit("rankDown",this.message.id)},updateMessage(){this.$emit("updateMessage",this.message.id,this.message.content,this.audio_url),this.editMsgMode=!1},resendMessage(n){this.$emit("resendMessage",this.message.id,this.message.content,n)},continueMessage(){this.$emit("continueMessage",this.message.id,this.message.content)},getImgUrl(){return this.avatar?ybt+this.avatar:(console.log("No avatar found"),ga)},defaultImg(n){n.target.src=ga},parseDate(n){let e=new Date(Date.parse(n)),i=Math.floor((new Date-e)/1e3);return i<=1?"just now":i<20?i+" seconds ago":i<40?"half a minute ago":i<60?"less than a minute ago":i<=90?"one minute ago":i<=3540?Math.round(i/60)+" minutes ago":i<=5400?"1 hour ago":i<=86400?Math.round(i/3600)+" hours ago":i<=129600?"1 day ago":i<604800?Math.round(i/86400)+" days ago":i<=777600?"1 week ago":n},prettyDate(n){let e=new Date((n||"").replace(/-/g,"/").replace(/[TZ]/g," ")),t=(new Date().getTime()-e.getTime())/1e3,i=Math.floor(t/86400);if(!(isNaN(i)||i<0||i>=31))return i==0&&(t<60&&"just now"||t<120&&"1 minute ago"||t<3600&&Math.floor(t/60)+" minutes ago"||t<7200&&"1 hour ago"||t<86400&&Math.floor(t/3600)+" hours ago")||i==1&&"Yesterday"||i<7&&i+" days ago"||i<31&&Math.ceil(i/7)+" weeks ago"},checkForFullSentence(){if(this.message.content.trim().split(" ").length>3){this.speak();return}}},watch:{audio_url(n){n&&(this.$refs.audio_player.src=n)},"message.content":function(n){this.$store.state.config.auto_speak&&(this.isSpeaking||this.checkForFullSentence())},"message.ui":function(n){console.log("ui changed"),console.log(this.message.ui)},showConfirmation(){Ve(()=>{qe.replace()})},deleteMsgMode(){Ve(()=>{qe.replace()})}},computed:{editMsgMode:{get(){return this.message.hasOwnProperty("open")?this.editMsgMode_||this.message.open:this.editMsgMode_},set(n){this.message.open=n,this.editMsgMode_=n,Ve(()=>{qe.replace()})}},isTalking:{get(){return this.isSpeaking}},created_at(){return this.prettyDate(this.message.created_at)},created_at_parsed(){return new Date(Date.parse(this.message.created_at)).toLocaleString()},finished_generating_at_parsed(){return new Date(Date.parse(this.message.finished_generating_at)).toLocaleString()},time_spent(){const n=new Date(Date.parse(this.message.started_generating_at)),e=new Date(Date.parse(this.message.finished_generating_at));if(console.log("Computing the generation duration, ",n," -> ",e),e.getTime()===n.getTime()||!n.getTime()||!e.getTime())return;let[i,s,r]=this.computeTimeDiff(n,e);function o(l){return l<10&&(l="0"+l),l}return o(i)+"h:"+o(s)+"m:"+o(r)+"s"},warmup_duration(){const n=new Date(Date.parse(this.message.created_at)),e=new Date(Date.parse(this.message.started_generating_at));if(console.log("Computing the warmup duration, ",n," -> ",e),e.getTime()===n.getTime())return 0;if(!n.getTime()||!e.getTime())return;let i,s,r;[i,s,r]=this.computeTimeDiff(n,e);function o(l){return l<10&&(l="0"+l),l}return o(i)+"h:"+o(s)+"m:"+o(r)+"s"},generation_rate(){const n=new Date(Date.parse(this.message.started_generating_at)),e=new Date(Date.parse(this.message.finished_generating_at)),t=this.message.nb_tokens;if(console.log("Computing the generation rate, ",t," in ",n," -> ",e),e.getTime()===n.getTime()||!t||!n.getTime()||!e.getTime())return;let s=e.getTime()-n.getTime();const r=Math.floor(s/1e3),o=t/r;return Math.round(o)+" t/s"}}},Tbt={class:"relative w-full group rounded-lg m-2 shadow-lg hover:border-primary dark:hover:border-primary hover:border-solid hover:border-2 border-2 border-transparent even:bg-bg-light-discussion-odd dark:even:bg-bg-dark-discussion-odd flex flex-col flex-grow flex-wrap overflow-visible p-4 pb-2"},xbt={class:"flex flex-row gap-2"},Cbt={class:"flex-shrink-0"},Rbt={class:"group/avatar"},Abt=["src","data-popover-target"],wbt={class:"flex flex-col w-full flex-grow-0"},Nbt={class:"flex flex-row flex-grow items-start"},Obt={class:"flex flex-col mb-2"},Ibt={class:"drop-shadow-sm text-lg text-opacity-95 font-bold grow"},Mbt=["title"],Dbt=u("div",{class:"flex-grow"},null,-1),kbt={class:"flex-row justify-end mx-2"},Lbt={class:"invisible group-hover:visible flex flex-row"},Pbt={key:0,class:"flex items-center duration-75"},Ubt=u("i",{"data-feather":"x"},null,-1),Fbt=[Ubt],Bbt=u("i",{"data-feather":"check"},null,-1),Gbt=[Bbt],zbt=u("i",{"data-feather":"edit"},null,-1),Vbt=[zbt],Hbt=["src"],qbt=["src"],Ybt=["src"],$bt=["src"],Wbt=["src"],Kbt=["src"],jbt=["src"],Qbt=["src"],Xbt=u("i",{"data-feather":"copy"},null,-1),Zbt=[Xbt],Jbt=u("i",{"data-feather":"send"},null,-1),eEt=[Jbt],tEt=["src"],nEt=u("i",{"data-feather":"send"},null,-1),iEt=[nEt],sEt=u("i",{"data-feather":"fast-forward"},null,-1),rEt=[sEt],oEt={key:14,class:"flex items-center duration-75"},aEt=u("i",{"data-feather":"x"},null,-1),lEt=[aEt],cEt=u("i",{"data-feather":"check"},null,-1),dEt=[cEt],uEt=u("i",{"data-feather":"trash"},null,-1),pEt=[uEt],_Et=u("i",{"data-feather":"thumbs-up"},null,-1),hEt=[_Et],fEt={class:"flex flex-row items-center"},mEt=u("i",{"data-feather":"thumbs-down"},null,-1),gEt=[mEt],bEt={class:"flex flex-row items-center"},EEt=u("i",{"data-feather":"volume-2"},null,-1),vEt=[EEt],yEt={class:"flex flex-row items-center"},SEt=u("i",{"data-feather":"voicemail"},null,-1),TEt=[SEt],xEt=["src"],CEt={class:"overflow-x-auto w-full"},REt={class:"flex w-full cursor-pointer rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-gray-900 mb-3.5 max-w-full"},AEt={class:"grid min-w-72 select-none grid-cols-[40px,1fr] items-center gap-2.5 p-2"},wEt={class:"relative grid aspect-square place-content-center overflow-hidden rounded-lg bg-gray-300 dark:bg-gray-200"},NEt=["src"],OEt=["src"],IEt=["src"],MEt={class:"leading-4"},DEt=u("dd",{class:"text-sm"},"Processing infos",-1),kEt={class:"flex items-center gap-1 truncate whitespace-nowrap text-[.82rem] text-gray-400"},LEt={class:"content px-5 pb-5 pt-4"},PEt={class:"list-none"},UEt=u("div",{class:"flex flex-col items-start w-full"},null,-1),FEt={class:"flex flex-col items-start w-full"},BEt={key:1},GEt=["src"],zEt={class:"text-sm text-gray-400 mt-2"},VEt={class:"flex flex-row items-center gap-2"},HEt={key:0},qEt={class:"font-thin"},YEt={key:1},$Et={class:"font-thin"},WEt={key:2},KEt={class:"font-thin"},jEt={key:3},QEt=["title"],XEt={key:4},ZEt=["title"],JEt={key:5},evt=["title"],tvt={key:6},nvt=["title"];function ivt(n,e,t,i,s,r){var _;const o=ht("Step"),a=ht("RenderHTMLJS"),l=ht("MarkdownRenderer"),d=ht("JsonViewer"),c=ht("DynamicUIRenderer");return w(),M("div",Tbt,[u("div",xbt,[u("div",Cbt,[u("div",Rbt,[u("img",{src:r.getImgUrl(),onError:e[0]||(e[0]=f=>r.defaultImg(f)),"data-popover-target":"avatar"+t.message.id,"data-popover-placement":"bottom",class:"w-10 h-10 rounded-full object-fill text-red-700"},null,40,Abt)])]),u("div",wbt,[u("div",Nbt,[u("div",Obt,[u("div",Ibt,fe(t.message.sender)+" ",1),t.message.created_at?(w(),M("div",{key:0,class:"text-sm text-gray-400 font-thin",title:"Created at: "+r.created_at_parsed},fe(r.created_at),9,Mbt)):q("",!0)]),Dbt,u("div",kbt,[u("div",Lbt,[r.editMsgMode?(w(),M("div",Pbt,[u("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90 p-2",title:"Cancel edit",type:"button",onClick:e[1]||(e[1]=Te(f=>r.editMsgMode=!1,["stop"]))},Fbt),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 p-2",title:"Update message",type:"button",onClick:e[2]||(e[2]=Te((...f)=>r.updateMessage&&r.updateMessage(...f),["stop"]))},Gbt)])):q("",!0),r.editMsgMode?q("",!0):(w(),M("div",{key:1,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Edit message",onClick:e[3]||(e[3]=Te(f=>r.editMsgMode=!0,["stop"]))},Vbt)),r.editMsgMode?(w(),M("div",{key:2,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add generic block",onClick:e[4]||(e[4]=Te(f=>r.addBlock(""),["stop"]))},[u("img",{src:s.code_block,width:"25",height:"25"},null,8,Hbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:3,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add python block",onClick:e[5]||(e[5]=Te(f=>r.addBlock("python"),["stop"]))},[u("img",{src:s.python_block,width:"25",height:"25"},null,8,qbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:4,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add javascript block",onClick:e[6]||(e[6]=Te(f=>r.addBlock("javascript"),["stop"]))},[u("img",{src:s.javascript_block,width:"25",height:"25"},null,8,Ybt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:5,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add json block",onClick:e[7]||(e[7]=Te(f=>r.addBlock("json"),["stop"]))},[u("img",{src:s.json_block,width:"25",height:"25"},null,8,$bt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:6,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add c++ block",onClick:e[8]||(e[8]=Te(f=>r.addBlock("c++"),["stop"]))},[u("img",{src:s.cpp_block,width:"25",height:"25"},null,8,Wbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:7,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add html block",onClick:e[9]||(e[9]=Te(f=>r.addBlock("html"),["stop"]))},[u("img",{src:s.html5_block,width:"25",height:"25"},null,8,Kbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:8,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add LaTex block",onClick:e[10]||(e[10]=Te(f=>r.addBlock("latex"),["stop"]))},[u("img",{src:s.LaTeX_block,width:"25",height:"25"},null,8,jbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:9,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add bash block",onClick:e[11]||(e[11]=Te(f=>r.addBlock("bash"),["stop"]))},[u("img",{src:s.bash_block,width:"25",height:"25"},null,8,Qbt)])):q("",!0),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Copy message to clipboard",onClick:e[12]||(e[12]=Te(f=>r.copyContentToClipboard(),["stop"]))},Zbt),!r.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(w(),M("div",{key:10,class:Ye(["text-lg text-red-500 hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",{"text-5xl":r.editMsgMode}]),title:"Resend message with full context",onClick:e[13]||(e[13]=Te(f=>r.resendMessage("full_context"),["stop"]))},eEt,2)):q("",!0),!r.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(w(),M("div",{key:11,class:Ye(["text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",{"text-5xl":r.editMsgMode}]),title:"Resend message without the full context",onClick:e[14]||(e[14]=Te(f=>r.resendMessage("full_context_with_internet"),["stop"]))},[u("img",{src:s.sendGlobe,width:"25",height:"25"},null,8,tEt)],2)):q("",!0),!r.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(w(),M("div",{key:12,class:Ye(["text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",{"text-5xl":r.editMsgMode}]),title:"Resend message without the full context",onClick:e[15]||(e[15]=Te(f=>r.resendMessage("simple_question"),["stop"]))},iEt,2)):q("",!0),!r.editMsgMode&&t.message.sender==this.$store.state.mountedPers.name?(w(),M("div",{key:13,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Resend message",onClick:e[16]||(e[16]=Te(f=>r.continueMessage(),["stop"]))},rEt)):q("",!0),s.deleteMsgMode?(w(),M("div",oEt,[u("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"Cancel removal",type:"button",onClick:e[17]||(e[17]=Te(f=>s.deleteMsgMode=!1,["stop"]))},lEt),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Confirm removal",type:"button",onClick:e[18]||(e[18]=Te(f=>r.deleteMsg(),["stop"]))},dEt)])):q("",!0),!r.editMsgMode&&!s.deleteMsgMode?(w(),M("div",{key:15,class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"Remove message",onClick:e[19]||(e[19]=f=>s.deleteMsgMode=!0)},pEt)):q("",!0),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Upvote",onClick:e[20]||(e[20]=Te(f=>r.rankUp(),["stop"]))},hEt),u("div",fEt,[u("div",{class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"Downvote",onClick:e[21]||(e[21]=Te(f=>r.rankDown(),["stop"]))},gEt),t.message.rank!=0?(w(),M("div",{key:0,class:Ye(["rounded-full px-2 text-sm flex items-center justify-center font-bold cursor-pointer",t.message.rank>0?"bg-secondary":"bg-red-600"]),title:"Rank"},fe(t.message.rank),3)):q("",!0)]),u("div",bEt,[u("div",{class:Ye(["text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",{"text-red-500":r.isTalking}]),title:"speak",onClick:e[22]||(e[22]=Te(f=>r.speak(),["stop"]))},vEt,2)]),u("div",yEt,[s.isSynthesizingVoice?(w(),M("img",{key:1,src:s.loading_svg},null,8,xEt)):(w(),M("div",{key:0,class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"read",onClick:e[23]||(e[23]=Te(f=>r.read(),["stop"]))},TEt))])])])]),u("div",CEt,[ne(u("details",REt,[u("summary",AEt,[u("div",wEt,[t.message.status_message!="Done"&t.message.status_message!="Generation canceled"?(w(),M("img",{key:0,src:s.loading_svg,class:"absolute inset-0 text-gray-100 transition-opacity dark:text-gray-800 opacity-100"},null,8,NEt)):q("",!0),t.message.status_message=="Generation canceled"?(w(),M("img",{key:1,src:s.failed_svg,class:"absolute inset-0 text-gray-100 transition-opacity dark:text-gray-800 opacity-100"},null,8,OEt)):q("",!0),t.message.status_message=="Done"?(w(),M("img",{key:2,src:s.ok_svg,class:"absolute m-2 w-6 inset-0 text-geen-100 transition-opacity dark:text-gray-800 opacity-100"},null,8,IEt)):q("",!0)]),u("dl",MEt,[DEt,u("dt",kEt,fe(t.message==null?"":t.message.status_message),1)])]),u("div",LEt,[u("ol",PEt,[(w(!0),M($e,null,ct(t.message.steps,(f,m)=>(w(),M("div",{key:"step-"+t.message.id+"-"+m,class:"group border-l pb-6 last:!border-transparent last:pb-0 dark:border-gray-800",style:en({backgroundColor:f.done?"transparent":"inherit"})},[Oe(o,{done:f.done,message:f.message,status:f.status,step_type:f.type},null,8,["done","message","status","step_type"])],4))),128))])])],512),[[Ot,t.message!=null&&t.message.steps!=null&&t.message.steps.length>0]]),UEt,u("div",FEt,[(w(!0),M($e,null,ct(t.message.html_js_s,(f,m)=>(w(),M("div",{key:"htmljs-"+t.message.id+"-"+m,class:"htmljs font-bold",style:en({backgroundColor:n.step.done?"transparent":"inherit"})},[Oe(a,{htmlContent:f},null,8,["htmlContent"])],4))),128))]),r.editMsgMode?q("",!0):(w(),xt(l,{key:0,ref:"mdRender",host:t.host,"markdown-text":t.message.content,message_id:t.message.id,discussion_id:t.message.discussion_id,client_id:this.$store.state.client_id},null,8,["host","markdown-text","message_id","discussion_id","client_id"])),u("div",null,[t.message.open?ne((w(),M("textarea",{key:0,ref:"mdTextarea",onKeydown:e[24]||(e[24]=wr(Te((...f)=>r.insertTab&&r.insertTab(...f),["prevent"]),["tab"])),class:"block min-h-[900px] p-2.5 w-full text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 overflow-y-scroll flex flex-col shadow-lg p-10 pt-0 overflow-y-scroll dark:bg-bg-dark scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",rows:4,placeholder:"Enter message here...","onUpdate:modelValue":e[25]||(e[25]=f=>t.message.content=f)},`\r - `,544)),[[Pe,t.message.content]]):q("",!0)]),t.message.metadata!==null?(w(),M("div",BEt,[(w(!0),M($e,null,ct(((_=t.message.metadata)==null?void 0:_.filter(f=>f!=null&&f.hasOwnProperty("title")&&f.hasOwnProperty("content")))||[],(f,m)=>(w(),M("div",{key:"json-"+t.message.id+"-"+m,class:"json font-bold"},[Oe(d,{jsonFormText:f.title,jsonData:f.content},null,8,["jsonFormText","jsonData"])]))),128))])):q("",!0),t.message.ui!==null&&t.message.ui!==void 0&&t.message.ui!==""?(w(),xt(c,{key:2,class:"w-full h-full",code:t.message.ui},null,8,["code"])):q("",!0),s.audio_url!=null?(w(),M("audio",{controls:"",autoplay:"",key:s.audio_url},[u("source",{src:s.audio_url,type:"audio/wav",ref:"audio_player"},null,8,GEt),je(" Your browser does not support the audio element. ")])):q("",!0)]),u("div",zEt,[u("div",VEt,[t.message.binding?(w(),M("p",HEt,[je("Binding: "),u("span",qEt,fe(t.message.binding),1)])):q("",!0),t.message.model?(w(),M("p",YEt,[je("Model: "),u("span",$Et,fe(t.message.model),1)])):q("",!0),t.message.seed?(w(),M("p",WEt,[je("Seed: "),u("span",KEt,fe(t.message.seed),1)])):q("",!0),t.message.nb_tokens?(w(),M("p",jEt,[je("Number of tokens: "),u("span",{class:"font-thin",title:"Number of Tokens: "+t.message.nb_tokens},fe(t.message.nb_tokens),9,QEt)])):q("",!0),r.warmup_duration?(w(),M("p",XEt,[je("Warmup duration: "),u("span",{class:"font-thin",title:"Warmup duration: "+r.warmup_duration},fe(r.warmup_duration),9,ZEt)])):q("",!0),r.time_spent?(w(),M("p",JEt,[je("Generation duration: "),u("span",{class:"font-thin",title:"Finished generating: "+r.time_spent},fe(r.time_spent),9,evt)])):q("",!0),r.generation_rate?(w(),M("p",tvt,[je("Rate: "),u("span",{class:"font-thin",title:"Generation rate: "+r.generation_rate},fe(r.generation_rate),9,nvt)])):q("",!0)])])])])])}const SO=bt(Sbt,[["render",ivt]]),svt="/";Me.defaults.baseURL="/";const rvt={name:"MountedPersonalities",props:{onShowPersList:Function,onReady:Function},components:{Toast:fc,UniversalForm:Ec},data(){return{bUrl:svt,isMounted:!1,show:!1}},async mounted(){await this.constructor(),this.isMounted=!0},async activated(){this.isMounted&&await this.constructor()},computed:{configFile:{get(){return this.$store.state.config},set(n){this.$store.commit("setConfig",n)}},mountedPers:{get(){return this.$store.state.mountedPers},set(n){this.$store.commit("setMountedPers",n)}},personalities:{get(){return this.$store.state.personalities},set(n){this.$store.commit("setPersonalities",n)}},mountedPersArr:{get(){return this.$store.state.mountedPersArr},set(n){this.$store.commit("setMountedPers",n)}}},methods:{onSettingsPersonality(n){try{Me.get("/get_active_personality_settings").then(e=>{e&&(console.log("pers sett",e),e.data&&Object.keys(e.data).length>0?this.$refs.universalForm.showForm(e.data,"Personality settings - "+n.name,"Save changes","Cancel").then(t=>{try{Me.post("/set_active_personality_settings",t).then(i=>{i&&i.data?(console.log("personality set with new settings",i.data),this.$refs.toast.showToast("Personality settings updated successfully!",4,!0)):this.$refs.toast.showToast(`Did not get Personality settings responses. +`+this.message.content.slice(e,t)+"\n```\n"+this.message.content.slice(t),p=p+3+n.length),this.$refs.mdTextarea.focus(),this.$refs.mdTextarea.selectionStart=this.$refs.mdTextarea.selectionEnd=p},copyContentToClipboard(){this.$emit("copy",this)},deleteMsg(){this.$emit("delete",this.message.id),this.deleteMsgMode=!1},rankUp(){this.$emit("rankUp",this.message.id)},rankDown(){this.$emit("rankDown",this.message.id)},updateMessage(){this.$emit("updateMessage",this.message.id,this.message.content,this.audio_url),this.editMsgMode=!1},resendMessage(n){this.$emit("resendMessage",this.message.id,this.message.content,n)},continueMessage(){this.$emit("continueMessage",this.message.id,this.message.content)},getImgUrl(){return this.avatar?Tbt+this.avatar:(console.log("No avatar found"),ga)},defaultImg(n){n.target.src=ga},parseDate(n){let e=new Date(Date.parse(n)),i=Math.floor((new Date-e)/1e3);return i<=1?"just now":i<20?i+" seconds ago":i<40?"half a minute ago":i<60?"less than a minute ago":i<=90?"one minute ago":i<=3540?Math.round(i/60)+" minutes ago":i<=5400?"1 hour ago":i<=86400?Math.round(i/3600)+" hours ago":i<=129600?"1 day ago":i<604800?Math.round(i/86400)+" days ago":i<=777600?"1 week ago":n},prettyDate(n){let e=new Date((n||"").replace(/-/g,"/").replace(/[TZ]/g," ")),t=(new Date().getTime()-e.getTime())/1e3,i=Math.floor(t/86400);if(!(isNaN(i)||i<0||i>=31))return i==0&&(t<60&&"just now"||t<120&&"1 minute ago"||t<3600&&Math.floor(t/60)+" minutes ago"||t<7200&&"1 hour ago"||t<86400&&Math.floor(t/3600)+" hours ago")||i==1&&"Yesterday"||i<7&&i+" days ago"||i<31&&Math.ceil(i/7)+" weeks ago"},checkForFullSentence(){if(this.message.content.trim().split(" ").length>3){this.speak();return}}},watch:{audio_url(n){n&&(this.$refs.audio_player.src=n)},"message.content":function(n){this.$store.state.config.auto_speak&&(this.isSpeaking||this.checkForFullSentence())},"message.ui":function(n){console.log("ui changed"),console.log(this.message.ui)},showConfirmation(){Ve(()=>{qe.replace()})},deleteMsgMode(){Ve(()=>{qe.replace()})}},computed:{editMsgMode:{get(){return this.message.hasOwnProperty("open")?this.editMsgMode_||this.message.open:this.editMsgMode_},set(n){this.message.open=n,this.editMsgMode_=n,Ve(()=>{qe.replace()})}},isTalking:{get(){return this.isSpeaking}},created_at(){return this.prettyDate(this.message.created_at)},created_at_parsed(){return new Date(Date.parse(this.message.created_at)).toLocaleString()},finished_generating_at_parsed(){return new Date(Date.parse(this.message.finished_generating_at)).toLocaleString()},time_spent(){const n=new Date(Date.parse(this.message.started_generating_at)),e=new Date(Date.parse(this.message.finished_generating_at));if(console.log("Computing the generation duration, ",n," -> ",e),e.getTime()===n.getTime()||!n.getTime()||!e.getTime())return;let[i,s,r]=this.computeTimeDiff(n,e);function o(l){return l<10&&(l="0"+l),l}return o(i)+"h:"+o(s)+"m:"+o(r)+"s"},warmup_duration(){const n=new Date(Date.parse(this.message.created_at)),e=new Date(Date.parse(this.message.started_generating_at));if(console.log("Computing the warmup duration, ",n," -> ",e),e.getTime()===n.getTime())return 0;if(!n.getTime()||!e.getTime())return;let i,s,r;[i,s,r]=this.computeTimeDiff(n,e);function o(l){return l<10&&(l="0"+l),l}return o(i)+"h:"+o(s)+"m:"+o(r)+"s"},generation_rate(){const n=new Date(Date.parse(this.message.started_generating_at)),e=new Date(Date.parse(this.message.finished_generating_at)),t=this.message.nb_tokens;if(console.log("Computing the generation rate, ",t," in ",n," -> ",e),e.getTime()===n.getTime()||!t||!n.getTime()||!e.getTime())return;let s=e.getTime()-n.getTime();const r=Math.floor(s/1e3),o=t/r;return Math.round(o)+" t/s"}}},Cbt={class:"relative w-full group rounded-lg m-2 shadow-lg hover:border-primary dark:hover:border-primary hover:border-solid hover:border-2 border-2 border-transparent even:bg-bg-light-discussion-odd dark:even:bg-bg-dark-discussion-odd flex flex-col flex-grow flex-wrap overflow-visible p-4 pb-2"},Rbt={class:"flex flex-row gap-2"},Abt={class:"flex-shrink-0"},wbt={class:"group/avatar"},Nbt=["src","data-popover-target"],Obt={class:"flex flex-col w-full flex-grow-0"},Ibt={class:"flex flex-row flex-grow items-start"},Mbt={class:"flex flex-col mb-2"},Dbt={class:"drop-shadow-sm text-lg text-opacity-95 font-bold grow"},kbt=["title"],Lbt=u("div",{class:"flex-grow"},null,-1),Pbt={class:"flex-row justify-end mx-2"},Ubt={class:"invisible group-hover:visible flex flex-row"},Fbt={key:0,class:"flex items-center duration-75"},Bbt=u("i",{"data-feather":"x"},null,-1),Gbt=[Bbt],zbt=u("i",{"data-feather":"check"},null,-1),Vbt=[zbt],Hbt=u("i",{"data-feather":"edit"},null,-1),qbt=[Hbt],Ybt=["src"],$bt=["src"],Wbt=["src"],Kbt=["src"],jbt=["src"],Qbt=["src"],Xbt=["src"],Zbt=["src"],Jbt=u("i",{"data-feather":"copy"},null,-1),eEt=[Jbt],tEt=u("i",{"data-feather":"send"},null,-1),nEt=[tEt],iEt=["src"],sEt=u("i",{"data-feather":"send"},null,-1),rEt=[sEt],oEt=u("i",{"data-feather":"fast-forward"},null,-1),aEt=[oEt],lEt={key:14,class:"flex items-center duration-75"},cEt=u("i",{"data-feather":"x"},null,-1),dEt=[cEt],uEt=u("i",{"data-feather":"check"},null,-1),pEt=[uEt],_Et=u("i",{"data-feather":"trash"},null,-1),hEt=[_Et],fEt=u("i",{"data-feather":"thumbs-up"},null,-1),mEt=[fEt],gEt={class:"flex flex-row items-center"},bEt=u("i",{"data-feather":"thumbs-down"},null,-1),EEt=[bEt],vEt={class:"flex flex-row items-center"},yEt=u("i",{"data-feather":"volume-2"},null,-1),SEt=[yEt],TEt={class:"flex flex-row items-center"},xEt=u("i",{"data-feather":"voicemail"},null,-1),CEt=[xEt],REt=["src"],AEt={class:"overflow-x-auto w-full"},wEt={class:"flex w-full cursor-pointer rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-gray-900 mb-3.5 max-w-full"},NEt={class:"grid min-w-72 select-none grid-cols-[40px,1fr] items-center gap-2.5 p-2"},OEt={class:"relative grid aspect-square place-content-center overflow-hidden rounded-lg bg-gray-300 dark:bg-gray-200"},IEt=["src"],MEt=["src"],DEt=["src"],kEt={class:"leading-4"},LEt=u("dd",{class:"text-sm"},"Processing infos",-1),PEt={class:"flex items-center gap-1 truncate whitespace-nowrap text-[.82rem] text-gray-400"},UEt={class:"content px-5 pb-5 pt-4"},FEt={class:"list-none"},BEt=u("div",{class:"flex flex-col items-start w-full"},null,-1),GEt={class:"flex flex-col items-start w-full"},zEt={key:1},VEt=["src"],HEt={class:"text-sm text-gray-400 mt-2"},qEt={class:"flex flex-row items-center gap-2"},YEt={key:0},$Et={class:"font-thin"},WEt={key:1},KEt={class:"font-thin"},jEt={key:2},QEt={class:"font-thin"},XEt={key:3},ZEt=["title"],JEt={key:4},evt=["title"],tvt={key:5},nvt=["title"],ivt={key:6},svt=["title"];function rvt(n,e,t,i,s,r){var _;const o=ht("Step"),a=ht("RenderHTMLJS"),l=ht("MarkdownRenderer"),d=ht("JsonViewer"),c=ht("DynamicUIRenderer");return w(),M("div",Cbt,[u("div",Rbt,[u("div",Abt,[u("div",wbt,[u("img",{src:r.getImgUrl(),onError:e[0]||(e[0]=f=>r.defaultImg(f)),"data-popover-target":"avatar"+t.message.id,"data-popover-placement":"bottom",class:"w-10 h-10 rounded-full object-fill text-red-700"},null,40,Nbt)])]),u("div",Obt,[u("div",Ibt,[u("div",Mbt,[u("div",Dbt,fe(t.message.sender)+" ",1),t.message.created_at?(w(),M("div",{key:0,class:"text-sm text-gray-400 font-thin",title:"Created at: "+r.created_at_parsed},fe(r.created_at),9,kbt)):q("",!0)]),Lbt,u("div",Pbt,[u("div",Ubt,[r.editMsgMode?(w(),M("div",Fbt,[u("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90 p-2",title:"Cancel edit",type:"button",onClick:e[1]||(e[1]=Te(f=>r.editMsgMode=!1,["stop"]))},Gbt),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 p-2",title:"Update message",type:"button",onClick:e[2]||(e[2]=Te((...f)=>r.updateMessage&&r.updateMessage(...f),["stop"]))},Vbt)])):q("",!0),r.editMsgMode?q("",!0):(w(),M("div",{key:1,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Edit message",onClick:e[3]||(e[3]=Te(f=>r.editMsgMode=!0,["stop"]))},qbt)),r.editMsgMode?(w(),M("div",{key:2,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add generic block",onClick:e[4]||(e[4]=Te(f=>r.addBlock(""),["stop"]))},[u("img",{src:s.code_block,width:"25",height:"25"},null,8,Ybt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:3,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add python block",onClick:e[5]||(e[5]=Te(f=>r.addBlock("python"),["stop"]))},[u("img",{src:s.python_block,width:"25",height:"25"},null,8,$bt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:4,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add javascript block",onClick:e[6]||(e[6]=Te(f=>r.addBlock("javascript"),["stop"]))},[u("img",{src:s.javascript_block,width:"25",height:"25"},null,8,Wbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:5,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add json block",onClick:e[7]||(e[7]=Te(f=>r.addBlock("json"),["stop"]))},[u("img",{src:s.json_block,width:"25",height:"25"},null,8,Kbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:6,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add c++ block",onClick:e[8]||(e[8]=Te(f=>r.addBlock("c++"),["stop"]))},[u("img",{src:s.cpp_block,width:"25",height:"25"},null,8,jbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:7,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add html block",onClick:e[9]||(e[9]=Te(f=>r.addBlock("html"),["stop"]))},[u("img",{src:s.html5_block,width:"25",height:"25"},null,8,Qbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:8,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add LaTex block",onClick:e[10]||(e[10]=Te(f=>r.addBlock("latex"),["stop"]))},[u("img",{src:s.LaTeX_block,width:"25",height:"25"},null,8,Xbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:9,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add bash block",onClick:e[11]||(e[11]=Te(f=>r.addBlock("bash"),["stop"]))},[u("img",{src:s.bash_block,width:"25",height:"25"},null,8,Zbt)])):q("",!0),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Copy message to clipboard",onClick:e[12]||(e[12]=Te(f=>r.copyContentToClipboard(),["stop"]))},eEt),!r.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(w(),M("div",{key:10,class:Ye(["text-lg text-red-500 hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",{"text-5xl":r.editMsgMode}]),title:"Resend message with full context",onClick:e[13]||(e[13]=Te(f=>r.resendMessage("full_context"),["stop"]))},nEt,2)):q("",!0),!r.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(w(),M("div",{key:11,class:Ye(["text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",{"text-5xl":r.editMsgMode}]),title:"Resend message without the full context",onClick:e[14]||(e[14]=Te(f=>r.resendMessage("full_context_with_internet"),["stop"]))},[u("img",{src:s.sendGlobe,width:"25",height:"25"},null,8,iEt)],2)):q("",!0),!r.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(w(),M("div",{key:12,class:Ye(["text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",{"text-5xl":r.editMsgMode}]),title:"Resend message without the full context",onClick:e[15]||(e[15]=Te(f=>r.resendMessage("simple_question"),["stop"]))},rEt,2)):q("",!0),!r.editMsgMode&&t.message.sender==this.$store.state.mountedPers.name?(w(),M("div",{key:13,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Resend message",onClick:e[16]||(e[16]=Te(f=>r.continueMessage(),["stop"]))},aEt)):q("",!0),s.deleteMsgMode?(w(),M("div",lEt,[u("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"Cancel removal",type:"button",onClick:e[17]||(e[17]=Te(f=>s.deleteMsgMode=!1,["stop"]))},dEt),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Confirm removal",type:"button",onClick:e[18]||(e[18]=Te(f=>r.deleteMsg(),["stop"]))},pEt)])):q("",!0),!r.editMsgMode&&!s.deleteMsgMode?(w(),M("div",{key:15,class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"Remove message",onClick:e[19]||(e[19]=f=>s.deleteMsgMode=!0)},hEt)):q("",!0),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Upvote",onClick:e[20]||(e[20]=Te(f=>r.rankUp(),["stop"]))},mEt),u("div",gEt,[u("div",{class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"Downvote",onClick:e[21]||(e[21]=Te(f=>r.rankDown(),["stop"]))},EEt),t.message.rank!=0?(w(),M("div",{key:0,class:Ye(["rounded-full px-2 text-sm flex items-center justify-center font-bold cursor-pointer",t.message.rank>0?"bg-secondary":"bg-red-600"]),title:"Rank"},fe(t.message.rank),3)):q("",!0)]),u("div",vEt,[u("div",{class:Ye(["text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",{"text-red-500":r.isTalking}]),title:"speak",onClick:e[22]||(e[22]=Te(f=>r.speak(),["stop"]))},SEt,2)]),u("div",TEt,[s.isSynthesizingVoice?(w(),M("img",{key:1,src:s.loading_svg},null,8,REt)):(w(),M("div",{key:0,class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"read",onClick:e[23]||(e[23]=Te(f=>r.read(),["stop"]))},CEt))])])])]),u("div",AEt,[ne(u("details",wEt,[u("summary",NEt,[u("div",OEt,[t.message.status_message!="Done"&t.message.status_message!="Generation canceled"?(w(),M("img",{key:0,src:s.loading_svg,class:"absolute inset-0 text-gray-100 transition-opacity dark:text-gray-800 opacity-100"},null,8,IEt)):q("",!0),t.message.status_message=="Generation canceled"?(w(),M("img",{key:1,src:s.failed_svg,class:"absolute inset-0 text-gray-100 transition-opacity dark:text-gray-800 opacity-100"},null,8,MEt)):q("",!0),t.message.status_message=="Done"?(w(),M("img",{key:2,src:s.ok_svg,class:"absolute m-2 w-6 inset-0 text-geen-100 transition-opacity dark:text-gray-800 opacity-100"},null,8,DEt)):q("",!0)]),u("dl",kEt,[LEt,u("dt",PEt,fe(t.message==null?"":t.message.status_message),1)])]),u("div",UEt,[u("ol",FEt,[(w(!0),M($e,null,ct(t.message.steps,(f,m)=>(w(),M("div",{key:"step-"+t.message.id+"-"+m,class:"group border-l pb-6 last:!border-transparent last:pb-0 dark:border-gray-800",style:en({backgroundColor:f.done?"transparent":"inherit"})},[Oe(o,{done:f.done,message:f.message,status:f.status,step_type:f.type},null,8,["done","message","status","step_type"])],4))),128))])])],512),[[Ot,t.message!=null&&t.message.steps!=null&&t.message.steps.length>0]]),BEt,u("div",GEt,[(w(!0),M($e,null,ct(t.message.html_js_s,(f,m)=>(w(),M("div",{key:"htmljs-"+t.message.id+"-"+m,class:"htmljs font-bold",style:en({backgroundColor:n.step.done?"transparent":"inherit"})},[Oe(a,{htmlContent:f},null,8,["htmlContent"])],4))),128))]),r.editMsgMode?q("",!0):(w(),xt(l,{key:0,ref:"mdRender",host:t.host,"markdown-text":t.message.content,message_id:t.message.id,discussion_id:t.message.discussion_id,client_id:this.$store.state.client_id},null,8,["host","markdown-text","message_id","discussion_id","client_id"])),u("div",null,[t.message.open?ne((w(),M("textarea",{key:0,ref:"mdTextarea",onKeydown:e[24]||(e[24]=wr(Te((...f)=>r.insertTab&&r.insertTab(...f),["prevent"]),["tab"])),class:"block min-h-[900px] p-2.5 w-full text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 overflow-y-scroll flex flex-col shadow-lg p-10 pt-0 overflow-y-scroll dark:bg-bg-dark scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",rows:4,placeholder:"Enter message here...","onUpdate:modelValue":e[25]||(e[25]=f=>t.message.content=f)},`\r + `,544)),[[Pe,t.message.content]]):q("",!0)]),t.message.metadata!==null?(w(),M("div",zEt,[(w(!0),M($e,null,ct(((_=t.message.metadata)==null?void 0:_.filter(f=>f!=null&&f.hasOwnProperty("title")&&f.hasOwnProperty("content")))||[],(f,m)=>(w(),M("div",{key:"json-"+t.message.id+"-"+m,class:"json font-bold"},[Oe(d,{jsonFormText:f.title,jsonData:f.content},null,8,["jsonFormText","jsonData"])]))),128))])):q("",!0),t.message.ui!==null&&t.message.ui!==void 0&&t.message.ui!==""?(w(),xt(c,{key:2,class:"w-full h-full",code:t.message.ui},null,8,["code"])):q("",!0),s.audio_url!=null?(w(),M("audio",{controls:"",autoplay:"",key:s.audio_url},[u("source",{src:s.audio_url,type:"audio/wav",ref:"audio_player"},null,8,VEt),je(" Your browser does not support the audio element. ")])):q("",!0)]),u("div",HEt,[u("div",qEt,[t.message.binding?(w(),M("p",YEt,[je("Binding: "),u("span",$Et,fe(t.message.binding),1)])):q("",!0),t.message.model?(w(),M("p",WEt,[je("Model: "),u("span",KEt,fe(t.message.model),1)])):q("",!0),t.message.seed?(w(),M("p",jEt,[je("Seed: "),u("span",QEt,fe(t.message.seed),1)])):q("",!0),t.message.nb_tokens?(w(),M("p",XEt,[je("Number of tokens: "),u("span",{class:"font-thin",title:"Number of Tokens: "+t.message.nb_tokens},fe(t.message.nb_tokens),9,ZEt)])):q("",!0),r.warmup_duration?(w(),M("p",JEt,[je("Warmup duration: "),u("span",{class:"font-thin",title:"Warmup duration: "+r.warmup_duration},fe(r.warmup_duration),9,evt)])):q("",!0),r.time_spent?(w(),M("p",tvt,[je("Generation duration: "),u("span",{class:"font-thin",title:"Finished generating: "+r.time_spent},fe(r.time_spent),9,nvt)])):q("",!0),r.generation_rate?(w(),M("p",ivt,[je("Rate: "),u("span",{class:"font-thin",title:"Generation rate: "+r.generation_rate},fe(r.generation_rate),9,svt)])):q("",!0)])])])])])}const SO=bt(xbt,[["render",rvt]]),ovt="/";Me.defaults.baseURL="/";const avt={name:"MountedPersonalities",props:{onShowPersList:Function,onReady:Function},components:{Toast:fc,UniversalForm:Ec},data(){return{bUrl:ovt,isMounted:!1,show:!1}},async mounted(){await this.constructor(),this.isMounted=!0},async activated(){this.isMounted&&await this.constructor()},computed:{configFile:{get(){return this.$store.state.config},set(n){this.$store.commit("setConfig",n)}},mountedPers:{get(){return this.$store.state.mountedPers},set(n){this.$store.commit("setMountedPers",n)}},personalities:{get(){return this.$store.state.personalities},set(n){this.$store.commit("setPersonalities",n)}},mountedPersArr:{get(){return this.$store.state.mountedPersArr},set(n){this.$store.commit("setMountedPers",n)}}},methods:{onSettingsPersonality(n){try{Me.get("/get_active_personality_settings").then(e=>{e&&(console.log("pers sett",e),e.data&&Object.keys(e.data).length>0?this.$refs.universalForm.showForm(e.data,"Personality settings - "+n.name,"Save changes","Cancel").then(t=>{try{Me.post("/set_active_personality_settings",t).then(i=>{i&&i.data?(console.log("personality set with new settings",i.data),this.$refs.toast.showToast("Personality settings updated successfully!",4,!0)):this.$refs.toast.showToast(`Did not get Personality settings responses. `+i,4,!1)})}catch(i){this.$refs.toast.showToast(`Did not get Personality settings responses. - Endpoint error: `+i.message,4,!1)}}):this.$refs.toast.showToast("Personality has no settings",4,!1))})}catch(e){this.$refs.toast.showToast("Could not open personality settings. Endpoint error: "+e.message,4,!1)}},toggleShowPersList(){this.onShowPersList()},async constructor(){for(Ve(()=>{qe.replace()});this.$store.state.ready===!1;)await new Promise(n=>setTimeout(n,100));this.onReady()},async api_get_req(n){try{const e=await Me.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(n){n.target.src=yc}}},ovt={class:"w-fit select-none"},avt={key:0,class:"flex -space-x-4"},lvt=["src","title"],cvt={key:1,class:"flex -space-x-4"},dvt=["src","title"],uvt={key:2,title:"Loading personalities"},pvt=u("div",{role:"status"},[u("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),u("span",{class:"sr-only"},"Loading...")],-1),_vt=[pvt];function hvt(n,e,t,i,s,r){const o=ht("UniversalForm");return w(),M($e,null,[u("div",ovt,[r.mountedPersArr.length>1?(w(),M("div",avt,[u("img",{src:s.bUrl+r.mountedPers.avatar,onError:e[0]||(e[0]=(...a)=>r.personalityImgPlacehodler&&r.personalityImgPlacehodler(...a)),class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:z-20 hover:-translate-y-2 duration-150 border-secondary cursor-pointer",title:"Active personality: "+r.mountedPers.name,onClick:e[1]||(e[1]=a=>r.onSettingsPersonality(r.mountedPers))},null,40,lvt),u("div",{class:"flex items-center justify-center w-8 h-8 cursor-pointer text-xs font-medium bg-bg-light dark:bg-bg-dark border-2 hover:border-secondary rounded-full hover:bg-bg-light-tone dark:hover:bg-bg-dark-tone dark:border-gray-800 hover:z-20 hover:-translate-y-2 duration-150 active:scale-90",onClick:e[2]||(e[2]=Te((...a)=>r.toggleShowPersList&&r.toggleShowPersList(...a),["stop"])),title:"Click to show more"},"+"+fe(r.mountedPersArr.length-1),1)])):q("",!0),r.mountedPersArr.length==1?(w(),M("div",cvt,[u("img",{src:s.bUrl+this.$store.state.mountedPers.avatar,onError:e[3]||(e[3]=(...a)=>r.personalityImgPlacehodler&&r.personalityImgPlacehodler(...a)),class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:z-20 cursor-pointer border-secondary",title:"Active personality: "+this.$store.state.mountedPers.name,onClick:e[4]||(e[4]=Te((...a)=>r.toggleShowPersList&&r.toggleShowPersList(...a),["stop"]))},null,40,dvt)])):q("",!0),r.mountedPersArr.length==0?(w(),M("div",uvt,_vt)):q("",!0)]),Oe(o,{ref:"universalForm",class:"z-20"},null,512)],64)}const fvt=bt(rvt,[["render",hvt]]);const mvt="/";Me.defaults.baseURL="/";const gvt={props:{onTalk:Function,onMounted:Function,onUnmounted:Function,onRemounted:Function,discussionPersonalities:Array,onShowPersList:Function},components:{PersonalityEntry:gO,Toast:fc,UniversalForm:Ec},name:"MountedPersonalitiesList",data(){return{bUrl:mvt,isMounted:!1,isLoading:!1}},async mounted(){await this.constructor(),this.isMounted=!0},async activated(){this.isMounted&&await this.constructor()},computed:{configFile:{get(){return this.$store.state.config},set(n){this.$store.commit("setConfig",n)}},personalities:{get(){return this.$store.state.personalities},set(n){this.$store.commit("setPersonalities",n)}},mountedPersArr:{get(){return this.$store.state.mountedPersArr},set(n){this.$store.commit("setMountedPers",n)}}},methods:{toggleShowPersList(){this.onShowPersList()},async constructor(){},async api_get_req(n){try{const e=await Me.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(n){n.target.src=yc},onPersonalityReinstall(n){console.log("on reinstall ",n),this.isLoading=!0,Me.post("/reinstall_personality",{name:n.personality.full_path}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_personality",e),e.data.status?this.$refs.toast.showToast("Personality reinstalled successfully!",4,!0):this.$refs.toast.showToast("Could not reinstall personality",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$refs.toast.showToast(`Could not reinstall personality + Endpoint error: `+i.message,4,!1)}}):this.$refs.toast.showToast("Personality has no settings",4,!1))})}catch(e){this.$refs.toast.showToast("Could not open personality settings. Endpoint error: "+e.message,4,!1)}},toggleShowPersList(){this.onShowPersList()},async constructor(){for(Ve(()=>{qe.replace()});this.$store.state.ready===!1;)await new Promise(n=>setTimeout(n,100));this.onReady()},async api_get_req(n){try{const e=await Me.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(n){n.target.src=yc}}},lvt={class:"w-fit select-none"},cvt={key:0,class:"flex -space-x-4"},dvt=["src","title"],uvt={key:1,class:"flex -space-x-4"},pvt=["src","title"],_vt={key:2,title:"Loading personalities"},hvt=u("div",{role:"status"},[u("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),u("span",{class:"sr-only"},"Loading...")],-1),fvt=[hvt];function mvt(n,e,t,i,s,r){const o=ht("UniversalForm");return w(),M($e,null,[u("div",lvt,[r.mountedPersArr.length>1?(w(),M("div",cvt,[u("img",{src:s.bUrl+r.mountedPers.avatar,onError:e[0]||(e[0]=(...a)=>r.personalityImgPlacehodler&&r.personalityImgPlacehodler(...a)),class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:z-20 hover:-translate-y-2 duration-150 border-secondary cursor-pointer",title:"Active personality: "+r.mountedPers.name,onClick:e[1]||(e[1]=a=>r.onSettingsPersonality(r.mountedPers))},null,40,dvt),u("div",{class:"flex items-center justify-center w-8 h-8 cursor-pointer text-xs font-medium bg-bg-light dark:bg-bg-dark border-2 hover:border-secondary rounded-full hover:bg-bg-light-tone dark:hover:bg-bg-dark-tone dark:border-gray-800 hover:z-20 hover:-translate-y-2 duration-150 active:scale-90",onClick:e[2]||(e[2]=Te((...a)=>r.toggleShowPersList&&r.toggleShowPersList(...a),["stop"])),title:"Click to show more"},"+"+fe(r.mountedPersArr.length-1),1)])):q("",!0),r.mountedPersArr.length==1?(w(),M("div",uvt,[u("img",{src:s.bUrl+this.$store.state.mountedPers.avatar,onError:e[3]||(e[3]=(...a)=>r.personalityImgPlacehodler&&r.personalityImgPlacehodler(...a)),class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:z-20 cursor-pointer border-secondary",title:"Active personality: "+this.$store.state.mountedPers.name,onClick:e[4]||(e[4]=Te((...a)=>r.toggleShowPersList&&r.toggleShowPersList(...a),["stop"]))},null,40,pvt)])):q("",!0),r.mountedPersArr.length==0?(w(),M("div",_vt,fvt)):q("",!0)]),Oe(o,{ref:"universalForm",class:"z-20"},null,512)],64)}const gvt=bt(avt,[["render",mvt]]);const bvt="/";Me.defaults.baseURL="/";const Evt={props:{onTalk:Function,onMounted:Function,onUnmounted:Function,onRemounted:Function,discussionPersonalities:Array,onShowPersList:Function},components:{PersonalityEntry:gO,Toast:fc,UniversalForm:Ec},name:"MountedPersonalitiesList",data(){return{bUrl:bvt,isMounted:!1,isLoading:!1}},async mounted(){await this.constructor(),this.isMounted=!0},async activated(){this.isMounted&&await this.constructor()},computed:{configFile:{get(){return this.$store.state.config},set(n){this.$store.commit("setConfig",n)}},personalities:{get(){return this.$store.state.personalities},set(n){this.$store.commit("setPersonalities",n)}},mountedPersArr:{get(){return this.$store.state.mountedPersArr},set(n){this.$store.commit("setMountedPers",n)}}},methods:{toggleShowPersList(){this.onShowPersList()},async constructor(){},async api_get_req(n){try{const e=await Me.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(n){n.target.src=yc},onPersonalityReinstall(n){console.log("on reinstall ",n),this.isLoading=!0,Me.post("/reinstall_personality",{name:n.personality.full_path}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_personality",e),e.data.status?this.$refs.toast.showToast("Personality reinstalled successfully!",4,!0):this.$refs.toast.showToast("Could not reinstall personality",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$refs.toast.showToast(`Could not reinstall personality `+e.message,4,!1),{status:!1}))},editPersonality(n){n=n.personality,Me.post("/get_personality_config",{category:n.category,name:n.folder}).then(e=>{const t=e.data;console.log("Done"),t.status?(this.$store.state.currentPersonConfig=t.config,this.$store.state.showPersonalityEditor=!0,this.$store.state.personality_editor.showPanel(),this.$store.state.selectedPersonality=n):console.error(t.error)}).catch(e=>{console.error(e)})},onPersonalityMounted(n){this.mountPersonality(n)},onPersonalityUnMounted(n){this.unmountPersonality(n)},onPersonalityRemount(n){this.reMountPersonality(n)},async handleOnTalk(n){if(qe.replace(),console.log("ppa",n),n){if(n.isMounted){const e=await this.select_personality(n);e&&e.status&&(await this.constructor(),this.$refs.toast.showToast(`Selected personality: `+n.name,4,!0))}else this.onPersonalityMounted(n);this.onTalk(n)}},async onPersonalitySelected(n){if(qe.replace(),console.log("Selected personality : ",JSON.stringify(n.personality)),n){if(n.selected){this.$refs.toast.showToast("Personality already selected",4,!0);return}if(n.isMounted){const e=await this.select_personality(n);e&&e.status&&(await this.constructor(),this.$refs.toast.showToast(`Selected personality: `+n.name,4,!0))}else this.onPersonalityMounted(n)}},onSettingsPersonality(n){try{Me.get("/get_active_personality_settings").then(e=>{e&&(console.log("pers sett",e),e.data&&Object.keys(e.data).length>0?this.$refs.universalForm.showForm(e.data,"Personality settings - "+n.personality.name,"Save changes","Cancel").then(t=>{try{Me.post("/set_active_personality_settings",t).then(i=>{i&&i.data?(console.log("personality set with new settings",i.data),this.$refs.toast.showToast("Personality settings updated successfully!",4,!0)):this.$refs.toast.showToast(`Did not get Personality settings responses. @@ -196,15 +196,15 @@ If You are using windows, this will install wsl so you need to activate it. Error: `+e.error,4,!1))},async reMountPersonality(n){if(console.log("remount pers",n),!n)return;if(!this.configFile.personalities.includes(n.personality.full_path)){this.$refs.toast.showToast("Personality not mounted",4,!1);return}const e=await this.remount_personality(n.personality);console.log("remount_personality res",e),e.status?(this.configFile.personalities=e.personalities,this.$refs.toast.showToast("Personality remounted",4,!0),n.isMounted=!0,this.onMounted(this),(await this.select_personality(n.personality)).status&&this.$refs.toast.showToast(`Selected personality: `+n.personality.name,4,!0),this.getMountedPersonalities()):(n.isMounted=!1,this.$refs.toast.showToast(`Could not mount personality Error: `+e.error,4,!1))},async unmountPersonality(n){if(!n)return;console.log(`Unmounting ${JSON.stringify(n.personality)}`);const e=await this.unmount_personality(n.personality);if(e.status){console.log("unmount response",e),this.configFile.active_personality_id=e.active_personality_id,this.configFile.personalities=e.personalities;const t=this.configFile.personalities[this.configFile.active_personality_id],i=this.personalities.findIndex(a=>a.full_path==t),s=this.$refs.personalitiesZoo.findIndex(a=>a.full_path==n.full_path),r=this.personalities[i];r.isMounted=!1,r.selected=!0,this.$refs.personalitiesZoo[s].isMounted=!1,this.getMountedPersonalities(),(await this.select_personality(r)).status&&qe.replace(),this.$refs.toast.showToast("Personality unmounted",4,!0),this.onUnMounted(this)}else this.$refs.toast.showToast(`Could not unmount personality -Error: `+e.error,4,!1)},getMountedPersonalities(){this.isLoading=!0;let n=[];console.log(this.configFile.personalities.length);for(let e=0;er.full_path==t),s=this.personalities[i];if(s)console.log("adding from config"),n.push(s);else{console.log("adding default");const r=this.personalities.findIndex(a=>a.full_path=="english/generic/lollms"),o=this.personalities[r];n.push(o)}}if(this.mountedPersArr=[],this.mountedPersArr=n,console.log("discussionPersonalities",this.discussionPersonalities),this.discussionPersonalities!=null&&this.discussionPersonalities.length>0)for(let e=0;es.full_path==t);if(console.log("discussionPersonalities -includes",i),console.log("discussionPersonalities -mounted list",this.mountedPersArr),i==-1){const s=this.personalities.findIndex(o=>o.full_path==t),r=this.personalities[s];console.log("adding discucc121",r,t),r&&(this.mountedPersArr.push(r),console.log("adding discucc",r))}}this.isLoading=!1,console.log("getMountedPersonalities",this.mountedPersArr),console.log("fig",this.configFile)}}},NE=n=>(Nr("data-v-9c85e2c1"),n=n(),Or(),n),bvt={class:"text-left overflow-visible text-base font-semibold cursor-pointer select-none items-center flex flex-col flex-grow w-full overflow-x-auto scrollbar-thin scrollbar-track-bg-light scrollbar-thumb-bg-light-tone hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark dark:scrollbar-thumb-bg-dark-tone dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},Evt={key:0,role:"status",class:"flex justify-center overflow-y-hidden"},vvt=NE(()=>u("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1)),yvt=NE(()=>u("span",{class:"sr-only"},"Loading...",-1)),Svt=[vvt,yvt],Tvt=NE(()=>u("i",{"data-feather":"chevron-down"},null,-1)),xvt=[Tvt],Cvt={class:"block my-2 text-sm font-medium text-gray-900 dark:text-white"},Rvt={class:"overflow-y-auto no-scrollbar pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4 max-h-96"};function Avt(n,e,t,i,s,r){const o=ht("personality-entry"),a=ht("Toast"),l=ht("UniversalForm");return w(),M("div",bvt,[s.isLoading?(w(),M("div",Evt,Svt)):q("",!0),u("div",null,[r.mountedPersArr.length>0?(w(),M("div",{key:0,class:Ye(s.isLoading?"pointer-events-none opacity-30 cursor-default":"")},[u("button",{class:"mt-0 w-full text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Close personality list",type:"button",onClick:e[0]||(e[0]=Te((...d)=>r.toggleShowPersList&&r.toggleShowPersList(...d),["stop"]))},xvt),u("label",Cvt," Mounted Personalities: ("+fe(r.mountedPersArr.length)+") ",1),u("div",Rvt,[Oe(rs,{name:"bounce"},{default:Je(()=>[(w(!0),M($e,null,ct(this.$store.state.mountedPersArr,(d,c)=>(w(),xt(o,{ref_for:!0,ref:"personalitiesZoo",key:"index-"+c+"-"+d.name,personality:d,full_path:d.full_path,select_language:!1,selected:r.configFile.personalities[r.configFile.active_personality_id]===d.full_path||r.configFile.personalities[r.configFile.active_personality_id]===d.full_path+":"+d.language,"on-selected":r.onPersonalitySelected,"on-mount":r.onPersonalityMounted,"on-edit":r.editPersonality,"on-un-mount":r.onPersonalityUnMounted,"on-remount":r.onPersonalityRemount,"on-settings":r.onSettingsPersonality,"on-reinstall":r.onPersonalityReinstall,"on-talk":r.handleOnTalk},null,8,["personality","full_path","selected","on-selected","on-mount","on-edit","on-un-mount","on-remount","on-settings","on-reinstall","on-talk"]))),128))]),_:1})])],2)):q("",!0)]),Oe(a,{ref:"toast"},null,512),Oe(l,{ref:"universalForm",class:"z-20"},null,512)])}const wvt=bt(gvt,[["render",Avt],["__scopeId","data-v-9c85e2c1"]]);const Nvt={components:{InteractiveMenu:cp},props:{commandsList:{type:Array,required:!0},sendCommand:Function,onShowToastMessage:Function},data(){return{loading:!1,selectedFile:null,showMenu:!1,showHelpText:!1,helpText:"",commands:[]}},async mounted(){nextTick(()=>{qe.replace()})},methods:{isHTML(n){const t=new DOMParser().parseFromString(n,"text/html");return Array.from(t.body.childNodes).some(i=>i.nodeType===Node.ELEMENT_NODE)},selectFile(n,e){const t=document.createElement("input");t.type="file",t.accept=n,t.onchange=i=>{this.selectedFile=i.target.files[0],console.log("File selected"),e()},t.click()},uploadFile(){new FormData().append("file",this.selectedFile),console.log("Uploading file"),this.loading=!0;const e=new FileReader;e.onload=()=>{const t={filename:this.selectedFile.name,fileData:e.result};Ze.on("file_received",i=>{i.status?this.onShowToastMessage("File uploaded successfully",4,!0):this.onShowToastMessage(`Couldn't upload file -`+i.error,4,!1),this.loading=!1,Ze.off("file_received")}),Ze.emit("send_file",t)},e.readAsDataURL(this.selectedFile)},async constructor(){nextTick(()=>{qe.replace()})},toggleMenu(){this.showMenu=!this.showMenu},execute_cmd(n){this.showMenu=!this.showMenu,n.hasOwnProperty("is_file")?(console.log("Need to send a file."),this.selectFile(n.hasOwnProperty("file_types")?n.file_types:"*",()=>{this.selectedFile!=null&&this.uploadFile()})):this.sendCommand(n.value)},handleClickOutside(n){const e=this.$el.querySelector(".commands-menu-items-wrapper");e&&!e.contains(n.target)&&(this.showMenu=!1)}},mounted(){this.commands=this.commandsList,document.addEventListener("click",this.handleClickOutside)},beforeUnmount(){document.removeEventListener("click",this.handleClickOutside)}},Ovt=n=>(Nr("data-v-52cfa09c"),n=n(),Or(),n),Ivt={key:0,title:"Loading..",class:"flex flex-row flex-grow justify-end"},Mvt=Ovt(()=>u("div",{role:"status"},[u("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),u("span",{class:"sr-only"},"Loading...")],-1)),Dvt=[Mvt];function kvt(n,e,t,i,s,r){const o=ht("InteractiveMenu");return s.loading?(w(),M("div",Ivt,Dvt)):(w(),xt(o,{key:1,commands:t.commandsList,execute_cmd:r.execute_cmd},null,8,["commands","execute_cmd"]))}const Lvt=bt(Nvt,[["render",kvt],["__scopeId","data-v-52cfa09c"]]),Pvt="/assets/loader_v0-16906488.svg";console.log("modelImgPlaceholder:",Li);const Uvt="/",Fvt={name:"ChatBox",emits:["messageSentEvent","sendCMDEvent","stopGenerating","loaded","createEmptyUserMessage","createEmptyAIMessage","personalitySelected","addWebLink"],props:{onTalk:Function,discussionList:Array,loading:{default:!1},onShowToastMessage:Function},components:{UniversalForm:Ec,MountedPersonalities:fvt,MountedPersonalitiesList:wvt,PersonalitiesCommands:Lvt},setup(){},data(){return{loader_v0:Pvt,sendGlobe:yO,modelImgPlaceholder:Li,bUrl:Uvt,message:"",selecting_binding:!1,selecting_model:!1,selectedModel:"",isLesteningToVoice:!1,filesList:[],isFileSentList:[],totalSize:0,showfilesList:!0,showPersonalities:!1,personalities_ready:!1,models_menu_icon:"",posts_headers:{accept:"application/json","Content-Type":"application/json"}}},computed:{currentBindingIcon(){return this.currentBinding.icon||this.modelImgPlaceholder},currentBinding(){return this.$store.state.currentBinding||{}},currentModel(){return this.$store.state.currentModel||{}},currentModelIcon(){return this.currentModel.icon||this.modelImgPlaceholder},installedBindings(){return this.$store.state.installedBindings},installedModels(){return this.$store.state.installedModels},mountedPersonalities(){return this.$store.state.mountedPersArr},binding_name(){return this.$store.state.config.binding_name},model_name(){return this.$store.state.config.model_name},personality_name(){return this.$store.state.config.active_personality_id},config(){return this.$store.state.config},mountedPers(){return this.$store.state.mountedPers},allDiscussionPersonalities(){if(this.discussionList.length>0){let n=[];for(let e=0;e{this.isLoading=!1,n.data.status?(this.$store.state.config.activate_internet_search?this.$store.state.toast.showToast("Websearch activated.",4,!0):this.$store.state.toast.showToast("Websearch deactivated.",4,!0),this.settingsChanged=!1):this.$store.state.toast.showToast("Configuration change failed.",4,!1),Ve(()=>{qe.replace()})})},showModelConfig(){try{this.isLoading=!0,Me.get("/get_active_binding_settings").then(n=>{this.isLoading=!1,n&&(console.log("binding sett",n),n.data&&Object.keys(n.data).length>0?this.$refs.universalForm.showForm(n.data,"Binding settings ","Save changes","Cancel").then(e=>{try{Me.post("/set_active_binding_settings",e).then(t=>{t&&t.data?(console.log("binding set with new settings",t.data),this.$store.state.toast.showToast("Binding settings updated successfully!",4,!0)):(this.$store.state.toast.showToast(`Did not get binding settings responses. +Error: `+e.error,4,!1)},getMountedPersonalities(){this.isLoading=!0;let n=[];console.log(this.configFile.personalities.length);for(let e=0;er.full_path==t),s=this.personalities[i];if(s)console.log("adding from config"),n.push(s);else{console.log("adding default");const r=this.personalities.findIndex(a=>a.full_path=="english/generic/lollms"),o=this.personalities[r];n.push(o)}}if(this.mountedPersArr=[],this.mountedPersArr=n,console.log("discussionPersonalities",this.discussionPersonalities),this.discussionPersonalities!=null&&this.discussionPersonalities.length>0)for(let e=0;es.full_path==t);if(console.log("discussionPersonalities -includes",i),console.log("discussionPersonalities -mounted list",this.mountedPersArr),i==-1){const s=this.personalities.findIndex(o=>o.full_path==t),r=this.personalities[s];console.log("adding discucc121",r,t),r&&(this.mountedPersArr.push(r),console.log("adding discucc",r))}}this.isLoading=!1,console.log("getMountedPersonalities",this.mountedPersArr),console.log("fig",this.configFile)}}},NE=n=>(Nr("data-v-9c85e2c1"),n=n(),Or(),n),vvt={class:"text-left overflow-visible text-base font-semibold cursor-pointer select-none items-center flex flex-col flex-grow w-full overflow-x-auto scrollbar-thin scrollbar-track-bg-light scrollbar-thumb-bg-light-tone hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark dark:scrollbar-thumb-bg-dark-tone dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},yvt={key:0,role:"status",class:"flex justify-center overflow-y-hidden"},Svt=NE(()=>u("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1)),Tvt=NE(()=>u("span",{class:"sr-only"},"Loading...",-1)),xvt=[Svt,Tvt],Cvt=NE(()=>u("i",{"data-feather":"chevron-down"},null,-1)),Rvt=[Cvt],Avt={class:"block my-2 text-sm font-medium text-gray-900 dark:text-white"},wvt={class:"overflow-y-auto no-scrollbar pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4 max-h-96"};function Nvt(n,e,t,i,s,r){const o=ht("personality-entry"),a=ht("Toast"),l=ht("UniversalForm");return w(),M("div",vvt,[s.isLoading?(w(),M("div",yvt,xvt)):q("",!0),u("div",null,[r.mountedPersArr.length>0?(w(),M("div",{key:0,class:Ye(s.isLoading?"pointer-events-none opacity-30 cursor-default":"")},[u("button",{class:"mt-0 w-full text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Close personality list",type:"button",onClick:e[0]||(e[0]=Te((...d)=>r.toggleShowPersList&&r.toggleShowPersList(...d),["stop"]))},Rvt),u("label",Avt," Mounted Personalities: ("+fe(r.mountedPersArr.length)+") ",1),u("div",wvt,[Oe(rs,{name:"bounce"},{default:Je(()=>[(w(!0),M($e,null,ct(this.$store.state.mountedPersArr,(d,c)=>(w(),xt(o,{ref_for:!0,ref:"personalitiesZoo",key:"index-"+c+"-"+d.name,personality:d,full_path:d.full_path,select_language:!1,selected:r.configFile.personalities[r.configFile.active_personality_id]===d.full_path||r.configFile.personalities[r.configFile.active_personality_id]===d.full_path+":"+d.language,"on-selected":r.onPersonalitySelected,"on-mount":r.onPersonalityMounted,"on-edit":r.editPersonality,"on-un-mount":r.onPersonalityUnMounted,"on-remount":r.onPersonalityRemount,"on-settings":r.onSettingsPersonality,"on-reinstall":r.onPersonalityReinstall,"on-talk":r.handleOnTalk},null,8,["personality","full_path","selected","on-selected","on-mount","on-edit","on-un-mount","on-remount","on-settings","on-reinstall","on-talk"]))),128))]),_:1})])],2)):q("",!0)]),Oe(a,{ref:"toast"},null,512),Oe(l,{ref:"universalForm",class:"z-20"},null,512)])}const Ovt=bt(Evt,[["render",Nvt],["__scopeId","data-v-9c85e2c1"]]);const Ivt={components:{InteractiveMenu:cp},props:{commandsList:{type:Array,required:!0},sendCommand:Function,onShowToastMessage:Function},data(){return{loading:!1,selectedFile:null,showMenu:!1,showHelpText:!1,helpText:"",commands:[]}},async mounted(){nextTick(()=>{qe.replace()})},methods:{isHTML(n){const t=new DOMParser().parseFromString(n,"text/html");return Array.from(t.body.childNodes).some(i=>i.nodeType===Node.ELEMENT_NODE)},selectFile(n,e){const t=document.createElement("input");t.type="file",t.accept=n,t.onchange=i=>{this.selectedFile=i.target.files[0],console.log("File selected"),e()},t.click()},uploadFile(){new FormData().append("file",this.selectedFile),console.log("Uploading file"),this.loading=!0;const e=new FileReader;e.onload=()=>{const t={filename:this.selectedFile.name,fileData:e.result};Ze.on("file_received",i=>{i.status?this.onShowToastMessage("File uploaded successfully",4,!0):this.onShowToastMessage(`Couldn't upload file +`+i.error,4,!1),this.loading=!1,Ze.off("file_received")}),Ze.emit("send_file",t)},e.readAsDataURL(this.selectedFile)},async constructor(){nextTick(()=>{qe.replace()})},toggleMenu(){this.showMenu=!this.showMenu},execute_cmd(n){this.showMenu=!this.showMenu,n.hasOwnProperty("is_file")?(console.log("Need to send a file."),this.selectFile(n.hasOwnProperty("file_types")?n.file_types:"*",()=>{this.selectedFile!=null&&this.uploadFile()})):this.sendCommand(n.value)},handleClickOutside(n){const e=this.$el.querySelector(".commands-menu-items-wrapper");e&&!e.contains(n.target)&&(this.showMenu=!1)}},mounted(){this.commands=this.commandsList,document.addEventListener("click",this.handleClickOutside)},beforeUnmount(){document.removeEventListener("click",this.handleClickOutside)}},Mvt=n=>(Nr("data-v-52cfa09c"),n=n(),Or(),n),Dvt={key:0,title:"Loading..",class:"flex flex-row flex-grow justify-end"},kvt=Mvt(()=>u("div",{role:"status"},[u("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),u("span",{class:"sr-only"},"Loading...")],-1)),Lvt=[kvt];function Pvt(n,e,t,i,s,r){const o=ht("InteractiveMenu");return s.loading?(w(),M("div",Dvt,Lvt)):(w(),xt(o,{key:1,commands:t.commandsList,execute_cmd:r.execute_cmd},null,8,["commands","execute_cmd"]))}const Uvt=bt(Ivt,[["render",Pvt],["__scopeId","data-v-52cfa09c"]]),Fvt="/assets/loader_v0-16906488.svg";console.log("modelImgPlaceholder:",Li);const Bvt="/",Gvt={name:"ChatBox",emits:["messageSentEvent","sendCMDEvent","stopGenerating","loaded","createEmptyUserMessage","createEmptyAIMessage","personalitySelected","addWebLink"],props:{onTalk:Function,discussionList:Array,loading:{default:!1},onShowToastMessage:Function},components:{UniversalForm:Ec,MountedPersonalities:gvt,MountedPersonalitiesList:Ovt,PersonalitiesCommands:Uvt},setup(){},data(){return{loader_v0:Fvt,sendGlobe:yO,modelImgPlaceholder:Li,bUrl:Bvt,message:"",selecting_binding:!1,selecting_model:!1,selectedModel:"",isLesteningToVoice:!1,filesList:[],isFileSentList:[],totalSize:0,showfilesList:!0,showPersonalities:!1,personalities_ready:!1,models_menu_icon:"",posts_headers:{accept:"application/json","Content-Type":"application/json"}}},computed:{currentBindingIcon(){return this.currentBinding.icon||this.modelImgPlaceholder},currentBinding(){return this.$store.state.currentBinding||{}},currentModel(){return this.$store.state.currentModel||{}},currentModelIcon(){return this.currentModel.icon||this.modelImgPlaceholder},installedBindings(){return this.$store.state.installedBindings},installedModels(){return this.$store.state.installedModels},mountedPersonalities(){return this.$store.state.mountedPersArr},binding_name(){return this.$store.state.config.binding_name},model_name(){return this.$store.state.config.model_name},personality_name(){return this.$store.state.config.active_personality_id},config(){return this.$store.state.config},mountedPers(){return this.$store.state.mountedPers},allDiscussionPersonalities(){if(this.discussionList.length>0){let n=[];for(let e=0;e{this.isLoading=!1,n.data.status?(this.$store.state.config.activate_internet_search?this.$store.state.toast.showToast("Websearch activated.",4,!0):this.$store.state.toast.showToast("Websearch deactivated.",4,!0),this.settingsChanged=!1):this.$store.state.toast.showToast("Configuration change failed.",4,!1),Ve(()=>{qe.replace()})})},showModelConfig(){try{this.isLoading=!0,Me.get("/get_active_binding_settings").then(n=>{this.isLoading=!1,n&&(console.log("binding sett",n),n.data&&Object.keys(n.data).length>0?this.$refs.universalForm.showForm(n.data,"Binding settings ","Save changes","Cancel").then(e=>{try{Me.post("/set_active_binding_settings",e).then(t=>{t&&t.data?(console.log("binding set with new settings",t.data),this.$store.state.toast.showToast("Binding settings updated successfully!",4,!0)):(this.$store.state.toast.showToast(`Did not get binding settings responses. `+t,4,!1),this.isLoading=!1)})}catch(t){this.$store.state.toast.showToast(`Did not get binding settings responses. Endpoint error: `+t.message,4,!1),this.isLoading=!1}}):(this.$store.state.toast.showToast("Binding has no settings",4,!1),this.isLoading=!1))})}catch(n){this.isLoading=!1,this.$store.state.toast.showToast("Could not open binding settings. Endpoint error: "+n.message,4,!1)}},async unmountPersonality(n){if(this.loading=!0,!n)return;const e=await this.unmount_personality(n.personality||n);if(e.status){this.$store.state.config.personalities=e.personalities,this.$store.state.toast.showToast("Personality unmounted",4,!0),this.$store.dispatch("refreshMountedPersonalities");const t=this.$store.state.mountedPersArr[this.$store.state.mountedPersArr.length-1];console.log(t,this.$store.state.mountedPersArr.length),(await this.select_personality(n.personality)).status&&this.$store.state.toast.showToast(`Selected personality: `+t.name,4,!0)}else this.$store.state.toast.showToast(`Could not unmount personality Error: `+e.error,4,!1);this.loading=!1},async unmount_personality(n){if(!n)return{status:!1,error:"no personality - unmount_personality"};const e={language:n.language,category:n.category,folder:n.folder};try{const t=await Me.post("/unmount_personality",e);if(t)return t.data}catch(t){console.log(t.message,"unmount_personality - settings");return}},async onPersonalitySelected(n){if(console.log("on pers",n),console.log("selecting ",n),n){if(n.selected){this.$store.state.toast.showToast("Personality already selected",4,!0);return}const e=n.language===null?n.full_path:n.full_path+":"+n.language;if(console.log("pers_path",e),console.log("this.$store.state.config.personalities",this.$store.state.config.personalities),this.$store.state.config.personalities.includes(e)){const t=await this.select_personality(n);await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshBindings"),await this.$store.dispatch("refreshModelsZoo"),await this.$store.dispatch("refreshModels"),await this.$store.dispatch("refreshMountedPersonalities"),await this.$store.dispatch("refreshConfig"),console.log("pers is mounted",t),t&&t.status&&t.active_personality_id>-1?this.$store.state.toast.showToast(`Selected personality: `+n.name,4,!0):this.$store.state.toast.showToast(`Error on select personality: -`+n.name,4,!1)}else console.log("mounting pers");this.$emit("personalitySelected"),Ve(()=>{qe.replace()})}},async select_personality(n){if(!n)return{status:!1,error:"no personality - select_personality"};const e=n.language===null?n.full_path:n.full_path+":"+n.language;console.log("Selecting personality ",e);const t=this.$store.state.config.personalities.findIndex(s=>s===e),i={client_id:this.$store.state.client_id,id:t};try{const s=await Me.post("/select_personality",i);if(s)return this.$store.dispatch("refreshConfig").then(()=>{this.$store.dispatch("refreshPersonalitiesZoo").then(()=>{this.$store.dispatch("refreshMountedPersonalities")})}),s.data}catch(s){console.log(s.message,"select_personality - settings");return}},emitloaded(){this.$emit("loaded")},showModels(n){n.preventDefault();const e=this.$refs.modelsSelectionList;console.log(e);const t=new MouseEvent("click");e.dispatchEvent(t)},setBinding(n){console.log("Setting binding to "+n.name),this.selecting_binding=!0,this.selectedBinding=n,this.$store.state.messageBox.showBlockingMessage("Loading binding"),Me.post("/update_setting",{client_id:this.$store.state.client_id,setting_name:"binding_name",setting_value:n.name}).then(async e=>{this.$store.state.messageBox.hideMessage(),console.log("UPDATED"),console.log(e),await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshBindings"),await this.$store.dispatch("refreshModelsZoo"),await this.$store.dispatch("refreshModels"),this.$store.state.toast.showToast(`Binding changed to ${this.currentBinding.name}`,4,!0),this.selecting_binding=!1}).catch(e=>{this.$store.state.messageBox.hideMessage(),this.$store.state.toast.showToast(`Error ${e}`,4,!0),this.selecting_binding=!1})},setModel(n){console.log("Setting model to "+n.name),this.selecting_model=!0,this.selectedModel=n,this.$store.state.messageBox.showBlockingMessage("Loading model"),Me.post("/update_setting",{client_id:this.$store.state.client_id,setting_name:"model_name",setting_value:n.name}).then(async e=>{this.$store.state.messageBox.hideMessage(),console.log("UPDATED"),console.log(e),await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshModels"),this.$store.state.toast.showToast(`Model changed to ${this.currentModel.name}`,4,!0),this.selecting_model=!1}).catch(e=>{this.$store.state.messageBox.hideMessage(),this.$store.state.toast.showToast(`Error ${e}`,4,!0),this.selecting_model=!1})},download_files(){Me.get("/download_files")},remove_file(n){Me.get("/remove_file",{client_id:this.$store.state.client_id,name:n}).then(e=>{console.log(e)})},clear_files(){Me.get("/clear_personality_files_list").then(n=>{console.log(n),n.data.state?(this.$store.state.toast.showToast("File removed successfully",4,!0),this.filesList.length=0,this.isFileSentList.length=0,this.totalSize=0):this.$store.state.toast.showToast("Files couldn't be removed",4,!1)})},send_file(n,e){console.log("Send file triggered");const t=new FileReader,i=24*1024;let s=0,r=0;t.onloadend=()=>{if(t.error){console.error("Error reading file:",t.error);return}const a=t.result,l=s+a.byteLength>=n.size;Ze.emit("send_file_chunk",{filename:n.name,chunk:a,offset:s,isLastChunk:l,chunkIndex:r}),s+=a.byteLength,r++,l?(console.log("File sent successfully"),this.isFileSentList[this.filesList.length-1]=!0,console.log(this.isFileSentList),this.$store.state.toast.showToast("File uploaded successfully",4,!0),e()):o()};function o(){const a=n.slice(s,s+i);t.readAsArrayBuffer(a)}console.log("Uploading file"),o()},makeAnEmptyUserMessage(){this.$emit("createEmptyUserMessage",this.message),this.message=""},makeAnEmptyAIMessage(){this.$emit("createEmptyAIMessage")},startSpeechRecognition(){"SpeechRecognition"in window||"webkitSpeechRecognition"in window?(this.recognition=new(window.SpeechRecognition||window.webkitSpeechRecognition),this.recognition.lang=this.$store.state.config.audio_in_language,this.recognition.interimResults=!0,this.recognition.onstart=()=>{this.isLesteningToVoice=!0,this.silenceTimer=setTimeout(()=>{this.recognition.stop()},this.silenceTimeout)},this.recognition.onresult=n=>{let e="";for(let t=n.resultIndex;t{this.recognition.stop()},this.silenceTimeout)},this.recognition.onerror=n=>{console.error("Speech recognition error:",n.error),this.isLesteningToVoice=!1,clearTimeout(this.silenceTimer)},this.recognition.onend=()=>{console.log("Speech recognition ended."),this.isLesteningToVoice=!1,clearTimeout(this.silenceTimer),this.submit()},this.recognition.start()):console.error("Speech recognition is not supported in this browser.")},onPersonalitiesReadyFun(){this.personalities_ready=!0},onShowPersListFun(n){this.showPersonalities=!this.showPersonalities},handleOnTalk(n){this.showPersonalities=!1,this.onTalk(n)},onMountFun(n){console.log("Mounting personality"),this.$refs.mountedPers.constructor()},onUnmountFun(n){console.log("Unmounting personality"),this.$refs.mountedPers.constructor()},onRemount(n){console.log("Remounting chat"),this.$refs.mountedPers.constructor()},computedFileSize(n){return Ve(()=>{qe.replace()}),ss(n)},removeItem(n){console.log("Réemoving ",n.name),Me.post("/remove_file",{client_id:this.$store.state.client_id,name:n.name},{headers:this.posts_headers}).then(()=>{this.filesList=this.filesList.filter(e=>e!=n)}),console.log(this.filesList)},sendMessageEvent(n,e="no_internet"){this.$emit("messageSentEvent",n,e)},sendCMDEvent(n){this.$emit("sendCMDEvent",n)},addWebLink(){console.log("Emitting addWebLink"),this.$emit("addWebLink")},add_file(){const n=document.createElement("input");n.type="file",n.style.display="none",n.multiple=!0,document.body.appendChild(n),n.addEventListener("change",()=>{console.log("Calling Add file..."),this.addFiles(n.files),document.body.removeChild(n)}),n.click()},takePicture(){Ze.emit("take_picture"),Ze.on("picture_taken",()=>{Me.get("/get_current_personality_files_list").then(n=>{this.filesList=n.data.files,this.isFileSentList=n.data.files.map(e=>!0),console.log(`Files recovered: ${this.filesList}`)})})},submitOnEnter(n){this.loading||n.which===13&&(n.preventDefault(),n.repeat||(this.sendMessageEvent(this.message),this.message=""))},submit(){this.message&&(this.sendMessageEvent(this.message),this.message="")},submitWithInternetSearch(){this.message&&(this.sendMessageEvent(this.message,"internet"),this.message="")},stopGenerating(){this.$emit("stopGenerating")},addFiles(n){console.log("Adding files");const e=[...n];let t=0;const i=()=>{if(t>=e.length){console.log(`Files_list: ${this.filesList}`);return}const s=e[t];this.filesList.push(s),this.isFileSentList.push(!1),this.send_file(s,()=>{t++,i()})};i()}},watch:{installedModels:{immediate:!0,handler(n){this.$nextTick(()=>{this.installedModels=n})}},model_name:{immediate:!0,handler(n){this.$nextTick(()=>{this.model_name=n})}},showfilesList(){Ve(()=>{qe.replace()})},loading(n,e){Ve(()=>{qe.replace()})},filesList:{handler(n,e){let t=0;if(n.length>0)for(let i=0;i{qe.replace()})},activated(){Ve(()=>{qe.replace()})}},zt=n=>(Nr("data-v-184e5bea"),n=n(),Or(),n),Bvt={class:"absolute bottom-0 left-0 w-fit min-w-96 w-full justify-center text-center p-4"},Gvt={key:0,class:"items-center gap-2 rounded-lg border bg-bg-light-tone dark:bg-bg-dark-tone p-1.5 shadow-sm hover:shadow-none dark:border-gray-800 w-fit"},zvt={class:"flex"},Vvt=["title"],Hvt=zt(()=>u("i",{"data-feather":"list"},null,-1)),qvt=[Hvt],Yvt={key:0},$vt={class:"flex flex-col max-h-64"},Wvt=["title"],Kvt={class:"flex flex-row items-center gap-1 text-left p-2 text-sm font-medium items-center gap-2 rounded-lg border bg-gray-100 p-1.5 shadow-sm hover:shadow-none dark:border-gray-800 dark:bg-gray-700 hover:bg-primary dark:hover:bg-primary"},jvt={key:0,filesList:"",role:"status"},Qvt=zt(()=>u("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1)),Xvt=zt(()=>u("span",{class:"sr-only"},"Loading...",-1)),Zvt=[Qvt,Xvt],Jvt=zt(()=>u("div",null,[u("i",{"data-feather":"file",class:"w-5 h-5"})],-1)),eyt=zt(()=>u("div",{class:"grow"},null,-1)),tyt={class:"flex flex-row items-center"},nyt={class:"whitespace-nowrap"},iyt=["onClick"],syt=zt(()=>u("i",{"data-feather":"x",class:"w-5 h-5"},null,-1)),ryt=[syt],oyt={key:1,class:"flex mx-1 w-500"},ayt={class:"whitespace-nowrap flex flex-row gap-2"},lyt=zt(()=>u("p",{class:"font-bold"}," Total size: ",-1)),cyt=zt(()=>u("div",{class:"grow"},null,-1)),dyt=zt(()=>u("i",{"data-feather":"trash",class:"w-5 h-5"},null,-1)),uyt=[dyt],pyt=zt(()=>u("i",{"data-feather":"download-cloud",class:"w-5 h-5"},null,-1)),_yt=[pyt],hyt={key:2,class:"mx-1"},fyt={key:1,title:"Selecting model",class:"flex flex-row flex-grow justify-end bg-primary"},myt={role:"status"},gyt=["src"],byt=zt(()=>u("span",{class:"sr-only"},"Selecting model...",-1)),Eyt={class:"flex w-fit pb-3 relative grow w-full"},vyt={class:"relative grow flex h-12.5 cursor-pointer select-none items-center gap-2 rounded-lg border bg-bg-light-tone dark:bg-bg-dark-tone p-1 shadow-sm hover:shadow-none dark:border-gray-800",tabindex:"0"},yyt={key:0,title:"Waiting for reply"},Syt=["src"],Tyt=zt(()=>u("div",{role:"status"},[u("span",{class:"sr-only"},"Loading...")],-1)),xyt={key:1,class:"w-fit group relative"},Cyt={class:"group w-full inline-flex absolute opacity-0 group-hover:opacity-100 transform group-hover:-translate-y-10 group-hover:translate-x-15 transition-all duration-300"},Ryt={key:0,class:"group items-center flex flex-row"},Ayt=["onClick"],wyt=["src","title"],Nyt={class:"group items-center flex flex-row"},Oyt=["src","title"],Iyt={key:2,class:"w-fit group relative"},Myt={class:"group w-full inline-flex absolute opacity-0 group-hover:opacity-100 transform group-hover:-translate-y-10 group-hover:translate-x-15 transition-all duration-300"},Dyt={key:0,class:"group items-center flex flex-row"},kyt=["onClick"],Lyt=["src","title"],Pyt={class:"group items-center flex flex-row"},Uyt=["src","title"],Fyt={class:"w-fit group relative"},Byt={class:"group w-full inline-flex absolute opacity-0 group-hover:opacity-100 transform group-hover:-translate-y-10 group-hover:translate-x-15 transition-all duration-300"},Gyt={key:0,class:"group items-center flex flex-row"},zyt=["onClick"],Vyt=["src","title"],Hyt=["onClick"],qyt=zt(()=>u("span",{class:"hidden hover:block top-3 left-9 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2 border-transparent",title:"Unmount personality"},[u("svg",{"aria-hidden":"true",class:"w-4 h-4 text-red-600 hover:text-red-500",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})])],-1)),Yyt=[qyt],$yt={class:"w-fit"},Wyt={class:"relative grow"},Kyt={class:"group relative w-max"},jyt=zt(()=>u("i",{"data-feather":"send"},null,-1)),Qyt=[jyt],Xyt=zt(()=>u("div",{class:"pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"},[u("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Sends your message to the AI.")],-1)),Zyt={class:"group relative w-max"},Jyt=["src"],eSt=zt(()=>u("div",{class:"pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"},[u("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Sends your message to the AI with internet search.")],-1)),tSt={class:"group relative w-max"},nSt=zt(()=>u("i",{"data-feather":"mic"},null,-1)),iSt=[nSt],sSt=zt(()=>u("div",{class:"pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"},[u("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Press and talk.")],-1)),rSt={key:4,class:"group relative w-max"},oSt=zt(()=>u("i",{"data-feather":"file-plus"},null,-1)),aSt=[oSt],lSt=zt(()=>u("div",{class:"pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"},[u("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Send File to the AI.")],-1)),cSt={class:"group relative w-max"},dSt=zt(()=>u("i",{"data-feather":"camera"},null,-1)),uSt=[dSt],pSt=zt(()=>u("div",{class:"pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"},[u("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Take a shot from webcam.")],-1)),_St={class:"group relative w-max"},hSt=zt(()=>u("i",{"data-feather":"globe"},null,-1)),fSt=[hSt],mSt=zt(()=>u("div",{class:"pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"},[u("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Add a weblink to the discussion.")],-1)),gSt={class:"group relative w-max"},bSt=zt(()=>u("i",{"data-feather":"message-square"},null,-1)),ESt=[bSt],vSt=zt(()=>u("div",{class:"pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"},[u("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"New empty User message.")],-1)),ySt={class:"group relative w-max"},SSt=zt(()=>u("i",{"data-feather":"message-square"},null,-1)),TSt=[SSt],xSt=zt(()=>u("div",{class:"pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"},[u("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"New empty ai message.")],-1)),CSt=zt(()=>u("div",{class:"ml-auto gap-2"},null,-1));function RSt(n,e,t,i,s,r){const o=ht("MountedPersonalitiesList"),a=ht("MountedPersonalities"),l=ht("PersonalitiesCommands"),d=ht("UniversalForm");return w(),M($e,null,[u("form",null,[u("div",Bvt,[s.filesList.length>0||s.showPersonalities?(w(),M("div",Gvt,[u("div",zvt,[u("button",{class:"mx-1 w-full text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:s.showfilesList?"Hide file list":"Show file list",type:"button",onClick:e[0]||(e[0]=Te(c=>s.showfilesList=!s.showfilesList,["stop"]))},qvt,8,Vvt)]),s.filesList.length>0&&s.showfilesList==!0?(w(),M("div",Yvt,[u("div",$vt,[Oe(rs,{name:"list",tag:"div",class:"flex flex-col flex-grow overflow-y-auto scrollbar-thin scrollbar-track-bg-light scrollbar-thumb-bg-light-tone hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark dark:scrollbar-thumb-bg-dark-tone dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},{default:Je(()=>[(w(!0),M($e,null,ct(s.filesList,(c,_)=>(w(),M("div",{key:_+"-"+c.name},[u("div",{class:"m-1",title:c.name},[u("div",Kvt,[s.isFileSentList[_]?q("",!0):(w(),M("div",jvt,Zvt)),Jvt,u("div",{class:Ye(["line-clamp-1 w-3/5",s.isFileSentList[_]?"text-green-500":"text-red-200"])},fe(c.name),3),eyt,u("div",tyt,[u("p",nyt,fe(r.computedFileSize(c.size)),1),u("button",{type:"button",title:"Remove item",class:"flex items-center p-0.5 text-sm rounded-sm hover:text-red-600 active:scale-75",onClick:f=>r.removeItem(c)},ryt,8,iyt)])])],8,Wvt)]))),128))]),_:1})])])):q("",!0),s.filesList.length>0?(w(),M("div",oyt,[u("div",ayt,[lyt,je(" "+fe(s.totalSize)+" ("+fe(s.filesList.length)+") ",1)]),cyt,u("button",{type:"button",title:"Clear all",class:"flex items-center p-0.5 text-sm rounded-sm hover:text-red-600 active:scale-75",onClick:e[1]||(e[1]=(...c)=>r.clear_files&&r.clear_files(...c))},uyt),u("button",{type:"button",title:"Download database",class:"flex items-center p-0.5 text-sm rounded-sm hover:text-red-600 active:scale-75",onClick:e[2]||(e[2]=(...c)=>r.download_files&&r.download_files(...c))},_yt)])):q("",!0),s.showPersonalities?(w(),M("div",hyt,[Oe(o,{ref:"mountedPersList",onShowPersList:r.onShowPersListFun,"on-mounted":r.onMountFun,"on-un-mounted":r.onUnmountFun,"on-remounted":n.onRemountFun,"on-talk":r.handleOnTalk,discussionPersonalities:r.allDiscussionPersonalities},null,8,["onShowPersList","on-mounted","on-un-mounted","on-remounted","on-talk","discussionPersonalities"])])):q("",!0)])):q("",!0),s.selecting_model||s.selecting_binding?(w(),M("div",fyt,[u("div",myt,[u("img",{src:s.loader_v0,class:"w-50 h-50"},null,8,gyt),byt])])):q("",!0),u("div",Eyt,[u("div",vyt,[t.loading?(w(),M("div",yyt,[u("img",{src:s.loader_v0},null,8,Syt),Tyt])):q("",!0),t.loading?q("",!0):(w(),M("div",xyt,[u("div",Cyt,[(w(!0),M($e,null,ct(r.installedBindings,(c,_)=>(w(),M("div",{class:"w-full",key:_+"-"+c.name,ref_for:!0,ref:"installedBindings"},[c.name!=r.binding_name?(w(),M("div",Ryt,[u("button",{onClick:Te(f=>r.setBinding(c),["prevent"]),class:"w-8 h-8"},[u("img",{src:c.icon?c.icon:s.modelImgPlaceholder,class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary",title:c.name},null,8,wyt)],8,Ayt)])):q("",!0)]))),128))]),u("div",Nyt,[u("button",{onClick:e[3]||(e[3]=Te(c=>r.showModelConfig(),["prevent"])),class:"w-8 h-8"},[u("img",{src:r.currentBindingIcon,class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary",title:r.currentBinding?r.currentBinding.name:"unknown"},null,8,Oyt)])])])),t.loading?q("",!0):(w(),M("div",Iyt,[u("div",Myt,[(w(!0),M($e,null,ct(r.installedModels,(c,_)=>(w(),M("div",{class:"w-full",key:_+"-"+c.name,ref_for:!0,ref:"installedModels"},[c.name!=r.model_name?(w(),M("div",Dyt,[u("button",{onClick:Te(f=>r.setModel(c),["prevent"]),class:"w-8 h-8"},[u("img",{src:c.icon?c.icon:s.modelImgPlaceholder,class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary",title:c.name},null,8,Lyt)],8,kyt)])):q("",!0)]))),128))]),u("div",Pyt,[u("button",{onClick:e[4]||(e[4]=Te(c=>r.showModelConfig(),["prevent"])),class:"w-8 h-8"},[u("img",{src:r.currentModelIcon,class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary",title:r.currentModel?r.currentModel.name:"unknown"},null,8,Uyt)])])])),u("div",Fyt,[u("div",Byt,[(w(!0),M($e,null,ct(r.mountedPersonalities,(c,_)=>(w(),M("div",{class:"w-full",key:_+"-"+c.name,ref_for:!0,ref:"mountedPersonalities"},[_!=r.personality_name?(w(),M("div",Gyt,[u("button",{onClick:Te(f=>r.onPersonalitySelected(c),["prevent"]),class:"w-8 h-8"},[u("img",{src:s.bUrl+c.avatar,onError:e[5]||(e[5]=(...f)=>n.personalityImgPlacehodler&&n.personalityImgPlacehodler(...f)),class:Ye(["w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary",this.$store.state.active_personality_id==this.$store.state.personalities.indexOf(c.full_path)?"border-secondary":"border-transparent z-0"]),title:c.name},null,42,Vyt)],8,zyt),u("button",{onClick:Te(f=>r.unmountPersonality(c),["prevent"])},Yyt,8,Hyt)])):q("",!0)]))),128))]),Oe(a,{ref:"mountedPers",onShowPersList:r.onShowPersListFun,onReady:r.onPersonalitiesReadyFun},null,8,["onShowPersList","onReady"])]),u("div",$yt,[s.personalities_ready&&this.$store.state.mountedPersArr[this.$store.state.config.active_personality_id].commands!=""?(w(),xt(l,{key:0,commandsList:this.$store.state.mountedPersArr[this.$store.state.config.active_personality_id].commands,sendCommand:r.sendCMDEvent,"on-show-toast-message":t.onShowToastMessage,ref:"personalityCMD"},null,8,["commandsList","sendCommand","on-show-toast-message"])):q("",!0)]),u("div",Wyt,[ne(u("textarea",{id:"chat",rows:"1","onUpdate:modelValue":e[6]||(e[6]=c=>s.message=c),title:"Hold SHIFT + ENTER to add new line",class:"inline-block no-scrollbar p-2.5 w-full text-sm text-gray-900 bg-bg-light rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-bg-dark dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Send message...",onKeydown:e[7]||(e[7]=wr(Te(c=>r.submitOnEnter(c),["exact"]),["enter"]))},`\r - `,544),[[Pe,s.message]])]),t.loading?(w(),M("button",{key:3,type:"button",class:"bg-red-500 dark:bg-red-800 hover:bg-red-600 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:hover:bg-bg-dark-tone focus:outline-none dark:focus:ring-blue-800",onClick:e[8]||(e[8]=Te((...c)=>r.stopGenerating&&r.stopGenerating(...c),["stop"]))}," Stop generating ")):q("",!0),u("div",Kyt,[t.loading?q("",!0):(w(),M("button",{key:0,type:"button",onClick:e[9]||(e[9]=(...c)=>r.submit&&r.submit(...c)),title:"Send",class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},Qyt)),Xyt]),u("div",Zyt,[t.loading?q("",!0):(w(),M("button",{key:0,type:"button",onClick:e[10]||(e[10]=(...c)=>r.submitWithInternetSearch&&r.submitWithInternetSearch(...c)),title:"Send With internet",class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},[u("img",{src:s.sendGlobe,width:"50",height:"50"},null,8,Jyt)])),eSt]),u("div",tSt,[t.loading?q("",!0):(w(),M("button",{key:0,type:"button",onClick:e[11]||(e[11]=(...c)=>r.startSpeechRecognition&&r.startSpeechRecognition(...c)),class:Ye([{"text-red-500":s.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"])},iSt,2)),sSt]),t.loading?q("",!0):(w(),M("div",rSt,[u("input",{type:"file",ref:"fileDialog",style:{display:"none"},onChange:e[12]||(e[12]=(...c)=>r.addFiles&&r.addFiles(...c)),multiple:""},null,544),u("button",{type:"button",onClick:e[13]||(e[13]=Te((...c)=>r.add_file&&r.add_file(...c),["prevent"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},aSt),lSt])),u("div",cSt,[t.loading?q("",!0):(w(),M("button",{key:0,type:"button",onClick:e[14]||(e[14]=Te((...c)=>r.takePicture&&r.takePicture(...c),["stop"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},uSt)),pSt]),u("div",_St,[t.loading?q("",!0):(w(),M("button",{key:0,type:"button",onClick:e[15]||(e[15]=Te((...c)=>r.addWebLink&&r.addWebLink(...c),["stop"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},fSt)),mSt]),u("div",gSt,[t.loading?q("",!0):(w(),M("button",{key:0,type:"button",onClick:e[16]||(e[16]=Te((...c)=>r.makeAnEmptyUserMessage&&r.makeAnEmptyUserMessage(...c),["stop"])),class:"w-6 text-blue-400 hover:text-secondary duration-75 active:scale-90"},ESt)),vSt]),u("div",ySt,[t.loading?q("",!0):(w(),M("button",{key:0,type:"button",onClick:e[17]||(e[17]=Te((...c)=>r.makeAnEmptyAIMessage&&r.makeAnEmptyAIMessage(...c),["stop"])),class:"w-6 text-red-400 hover:text-secondary duration-75 active:scale-90"},TSt)),xSt])]),CSt])])]),Oe(d,{ref:"universalForm",class:"z-20"},null,512)],64)}const TO=bt(Fvt,[["render",RSt],["__scopeId","data-v-184e5bea"]]),ASt={name:"WelcomeComponent",setup(){return{}}},wSt={class:"flex flex-col text-center"},NSt=zu('
Logo

LoLLMS

One tool to rule them all


Welcome

Please create a new discussion or select existing one to start

',1),OSt=[NSt];function ISt(n,e,t,i,s,r){return w(),M("div",wSt,OSt)}const xO=bt(ASt,[["render",ISt]]);var MSt=function(){function n(e,t){t===void 0&&(t=[]),this._eventType=e,this._eventFunctions=t}return n.prototype.init=function(){var e=this;this._eventFunctions.forEach(function(t){typeof window<"u"&&window.addEventListener(e._eventType,t)})},n}(),ou=globalThis&&globalThis.__assign||function(){return ou=Object.assign||function(n){for(var e,t=1,i=arguments.length;t"u")return!1;var e=ai(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function YSt(n){var e=n.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},s=e.attributes[t]||{},r=e.elements[t];!xi(r)||!ds(r)||(Object.assign(r.style,i),Object.keys(s).forEach(function(o){var a=s[o];a===!1?r.removeAttribute(o):r.setAttribute(o,a===!0?"":a)}))})}function $St(n){var e=n.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(i){var s=e.elements[i],r=e.attributes[i]||{},o=Object.keys(e.styles.hasOwnProperty(i)?e.styles[i]:t[i]),a=o.reduce(function(l,d){return l[d]="",l},{});!xi(s)||!ds(s)||(Object.assign(s.style,a),Object.keys(r).forEach(function(l){s.removeAttribute(l)}))})}}const WSt={name:"applyStyles",enabled:!0,phase:"write",fn:YSt,effect:$St,requires:["computeStyles"]};function os(n){return n.split("-")[0]}var ao=Math.max,du=Math.min,ya=Math.round;function ib(){var n=navigator.userAgentData;return n!=null&&n.brands&&Array.isArray(n.brands)?n.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function IO(){return!/^((?!chrome|android).)*safari/i.test(ib())}function Sa(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=n.getBoundingClientRect(),s=1,r=1;e&&xi(n)&&(s=n.offsetWidth>0&&ya(i.width)/n.offsetWidth||1,r=n.offsetHeight>0&&ya(i.height)/n.offsetHeight||1);var o=mo(n)?ai(n):window,a=o.visualViewport,l=!IO()&&t,d=(i.left+(l&&a?a.offsetLeft:0))/s,c=(i.top+(l&&a?a.offsetTop:0))/r,_=i.width/s,f=i.height/r;return{width:_,height:f,top:c,right:d+_,bottom:c+f,left:d,x:d,y:c}}function PE(n){var e=Sa(n),t=n.offsetWidth,i=n.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:n.offsetLeft,y:n.offsetTop,width:t,height:i}}function MO(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&LE(t)){var i=e;do{if(i&&n.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function zs(n){return ai(n).getComputedStyle(n)}function KSt(n){return["table","td","th"].indexOf(ds(n))>=0}function Mr(n){return((mo(n)?n.ownerDocument:n.document)||window.document).documentElement}function dp(n){return ds(n)==="html"?n:n.assignedSlot||n.parentNode||(LE(n)?n.host:null)||Mr(n)}function kC(n){return!xi(n)||zs(n).position==="fixed"?null:n.offsetParent}function jSt(n){var e=/firefox/i.test(ib()),t=/Trident/i.test(ib());if(t&&xi(n)){var i=zs(n);if(i.position==="fixed")return null}var s=dp(n);for(LE(s)&&(s=s.host);xi(s)&&["html","body"].indexOf(ds(s))<0;){var r=zs(s);if(r.transform!=="none"||r.perspective!=="none"||r.contain==="paint"||["transform","perspective"].indexOf(r.willChange)!==-1||e&&r.willChange==="filter"||e&&r.filter&&r.filter!=="none")return s;s=s.parentNode}return null}function Tc(n){for(var e=ai(n),t=kC(n);t&&KSt(t)&&zs(t).position==="static";)t=kC(t);return t&&(ds(t)==="html"||ds(t)==="body"&&zs(t).position==="static")?e:t||jSt(n)||e}function UE(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function Ll(n,e,t){return ao(n,du(e,t))}function QSt(n,e,t){var i=Ll(n,e,t);return i>t?t:i}function DO(){return{top:0,right:0,bottom:0,left:0}}function kO(n){return Object.assign({},DO(),n)}function LO(n,e){return e.reduce(function(t,i){return t[i]=n,t},{})}var XSt=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,kO(typeof e!="number"?e:LO(e,Sc))};function ZSt(n){var e,t=n.state,i=n.name,s=n.options,r=t.elements.arrow,o=t.modifiersData.popperOffsets,a=os(t.placement),l=UE(a),d=[Xn,wi].indexOf(a)>=0,c=d?"height":"width";if(!(!r||!o)){var _=XSt(s.padding,t),f=PE(r),m=l==="y"?Qn:Xn,h=l==="y"?Ai:wi,E=t.rects.reference[c]+t.rects.reference[l]-o[l]-t.rects.popper[c],b=o[l]-t.rects.reference[l],g=Tc(r),v=g?l==="y"?g.clientHeight||0:g.clientWidth||0:0,y=E/2-b/2,T=_[m],C=v-f[c]-_[h],x=v/2-f[c]/2+y,O=Ll(T,x,C),R=l;t.modifiersData[i]=(e={},e[R]=O,e.centerOffset=O-x,e)}}function JSt(n){var e=n.state,t=n.options,i=t.element,s=i===void 0?"[data-popper-arrow]":i;s!=null&&(typeof s=="string"&&(s=e.elements.popper.querySelector(s),!s)||MO(e.elements.popper,s)&&(e.elements.arrow=s))}const e0t={name:"arrow",enabled:!0,phase:"main",fn:ZSt,effect:JSt,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ta(n){return n.split("-")[1]}var t0t={top:"auto",right:"auto",bottom:"auto",left:"auto"};function n0t(n,e){var t=n.x,i=n.y,s=e.devicePixelRatio||1;return{x:ya(t*s)/s||0,y:ya(i*s)/s||0}}function LC(n){var e,t=n.popper,i=n.popperRect,s=n.placement,r=n.variation,o=n.offsets,a=n.position,l=n.gpuAcceleration,d=n.adaptive,c=n.roundOffsets,_=n.isFixed,f=o.x,m=f===void 0?0:f,h=o.y,E=h===void 0?0:h,b=typeof c=="function"?c({x:m,y:E}):{x:m,y:E};m=b.x,E=b.y;var g=o.hasOwnProperty("x"),v=o.hasOwnProperty("y"),y=Xn,T=Qn,C=window;if(d){var x=Tc(t),O="clientHeight",R="clientWidth";if(x===ai(t)&&(x=Mr(t),zs(x).position!=="static"&&a==="absolute"&&(O="scrollHeight",R="scrollWidth")),x=x,s===Qn||(s===Xn||s===wi)&&r===sc){T=Ai;var S=_&&x===C&&C.visualViewport?C.visualViewport.height:x[O];E-=S-i.height,E*=l?1:-1}if(s===Xn||(s===Qn||s===Ai)&&r===sc){y=wi;var A=_&&x===C&&C.visualViewport?C.visualViewport.width:x[R];m-=A-i.width,m*=l?1:-1}}var U=Object.assign({position:a},d&&t0t),F=c===!0?n0t({x:m,y:E},ai(t)):{x:m,y:E};if(m=F.x,E=F.y,l){var K;return Object.assign({},U,(K={},K[T]=v?"0":"",K[y]=g?"0":"",K.transform=(C.devicePixelRatio||1)<=1?"translate("+m+"px, "+E+"px)":"translate3d("+m+"px, "+E+"px, 0)",K))}return Object.assign({},U,(e={},e[T]=v?E+"px":"",e[y]=g?m+"px":"",e.transform="",e))}function i0t(n){var e=n.state,t=n.options,i=t.gpuAcceleration,s=i===void 0?!0:i,r=t.adaptive,o=r===void 0?!0:r,a=t.roundOffsets,l=a===void 0?!0:a,d={placement:os(e.placement),variation:Ta(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,LC(Object.assign({},d,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,LC(Object.assign({},d,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const s0t={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:i0t,data:{}};var Wc={passive:!0};function r0t(n){var e=n.state,t=n.instance,i=n.options,s=i.scroll,r=s===void 0?!0:s,o=i.resize,a=o===void 0?!0:o,l=ai(e.elements.popper),d=[].concat(e.scrollParents.reference,e.scrollParents.popper);return r&&d.forEach(function(c){c.addEventListener("scroll",t.update,Wc)}),a&&l.addEventListener("resize",t.update,Wc),function(){r&&d.forEach(function(c){c.removeEventListener("scroll",t.update,Wc)}),a&&l.removeEventListener("resize",t.update,Wc)}}const o0t={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:r0t,data:{}};var a0t={left:"right",right:"left",bottom:"top",top:"bottom"};function zd(n){return n.replace(/left|right|bottom|top/g,function(e){return a0t[e]})}var l0t={start:"end",end:"start"};function PC(n){return n.replace(/start|end/g,function(e){return l0t[e]})}function FE(n){var e=ai(n),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function BE(n){return Sa(Mr(n)).left+FE(n).scrollLeft}function c0t(n,e){var t=ai(n),i=Mr(n),s=t.visualViewport,r=i.clientWidth,o=i.clientHeight,a=0,l=0;if(s){r=s.width,o=s.height;var d=IO();(d||!d&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:r,height:o,x:a+BE(n),y:l}}function d0t(n){var e,t=Mr(n),i=FE(n),s=(e=n.ownerDocument)==null?void 0:e.body,r=ao(t.scrollWidth,t.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=ao(t.scrollHeight,t.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-i.scrollLeft+BE(n),l=-i.scrollTop;return zs(s||t).direction==="rtl"&&(a+=ao(t.clientWidth,s?s.clientWidth:0)-r),{width:r,height:o,x:a,y:l}}function GE(n){var e=zs(n),t=e.overflow,i=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+s+i)}function PO(n){return["html","body","#document"].indexOf(ds(n))>=0?n.ownerDocument.body:xi(n)&&GE(n)?n:PO(dp(n))}function Pl(n,e){var t;e===void 0&&(e=[]);var i=PO(n),s=i===((t=n.ownerDocument)==null?void 0:t.body),r=ai(i),o=s?[r].concat(r.visualViewport||[],GE(i)?i:[]):i,a=e.concat(o);return s?a:a.concat(Pl(dp(o)))}function sb(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function u0t(n,e){var t=Sa(n,!1,e==="fixed");return t.top=t.top+n.clientTop,t.left=t.left+n.clientLeft,t.bottom=t.top+n.clientHeight,t.right=t.left+n.clientWidth,t.width=n.clientWidth,t.height=n.clientHeight,t.x=t.left,t.y=t.top,t}function UC(n,e,t){return e===NO?sb(c0t(n,t)):mo(e)?u0t(e,t):sb(d0t(Mr(n)))}function p0t(n){var e=Pl(dp(n)),t=["absolute","fixed"].indexOf(zs(n).position)>=0,i=t&&xi(n)?Tc(n):n;return mo(i)?e.filter(function(s){return mo(s)&&MO(s,i)&&ds(s)!=="body"}):[]}function _0t(n,e,t,i){var s=e==="clippingParents"?p0t(n):[].concat(e),r=[].concat(s,[t]),o=r[0],a=r.reduce(function(l,d){var c=UC(n,d,i);return l.top=ao(c.top,l.top),l.right=du(c.right,l.right),l.bottom=du(c.bottom,l.bottom),l.left=ao(c.left,l.left),l},UC(n,o,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function UO(n){var e=n.reference,t=n.element,i=n.placement,s=i?os(i):null,r=i?Ta(i):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(s){case Qn:l={x:o,y:e.y-t.height};break;case Ai:l={x:o,y:e.y+e.height};break;case wi:l={x:e.x+e.width,y:a};break;case Xn:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var d=s?UE(s):null;if(d!=null){var c=d==="y"?"height":"width";switch(r){case va:l[d]=l[d]-(e[c]/2-t[c]/2);break;case sc:l[d]=l[d]+(e[c]/2-t[c]/2);break}}return l}function rc(n,e){e===void 0&&(e={});var t=e,i=t.placement,s=i===void 0?n.placement:i,r=t.strategy,o=r===void 0?n.strategy:r,a=t.boundary,l=a===void 0?DSt:a,d=t.rootBoundary,c=d===void 0?NO:d,_=t.elementContext,f=_===void 0?fl:_,m=t.altBoundary,h=m===void 0?!1:m,E=t.padding,b=E===void 0?0:E,g=kO(typeof b!="number"?b:LO(b,Sc)),v=f===fl?kSt:fl,y=n.rects.popper,T=n.elements[h?v:f],C=_0t(mo(T)?T:T.contextElement||Mr(n.elements.popper),l,c,o),x=Sa(n.elements.reference),O=UO({reference:x,element:y,strategy:"absolute",placement:s}),R=sb(Object.assign({},y,O)),S=f===fl?R:x,A={top:C.top-S.top+g.top,bottom:S.bottom-C.bottom+g.bottom,left:C.left-S.left+g.left,right:S.right-C.right+g.right},U=n.modifiersData.offset;if(f===fl&&U){var F=U[s];Object.keys(A).forEach(function(K){var L=[wi,Ai].indexOf(K)>=0?1:-1,H=[Qn,Ai].indexOf(K)>=0?"y":"x";A[K]+=F[H]*L})}return A}function h0t(n,e){e===void 0&&(e={});var t=e,i=t.placement,s=t.boundary,r=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,d=l===void 0?OO:l,c=Ta(i),_=c?a?DC:DC.filter(function(h){return Ta(h)===c}):Sc,f=_.filter(function(h){return d.indexOf(h)>=0});f.length===0&&(f=_);var m=f.reduce(function(h,E){return h[E]=rc(n,{placement:E,boundary:s,rootBoundary:r,padding:o})[os(E)],h},{});return Object.keys(m).sort(function(h,E){return m[h]-m[E]})}function f0t(n){if(os(n)===kE)return[];var e=zd(n);return[PC(n),e,PC(e)]}function m0t(n){var e=n.state,t=n.options,i=n.name;if(!e.modifiersData[i]._skip){for(var s=t.mainAxis,r=s===void 0?!0:s,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,d=t.padding,c=t.boundary,_=t.rootBoundary,f=t.altBoundary,m=t.flipVariations,h=m===void 0?!0:m,E=t.allowedAutoPlacements,b=e.options.placement,g=os(b),v=g===b,y=l||(v||!h?[zd(b)]:f0t(b)),T=[b].concat(y).reduce(function(me,ve){return me.concat(os(ve)===kE?h0t(e,{placement:ve,boundary:c,rootBoundary:_,padding:d,flipVariations:h,allowedAutoPlacements:E}):ve)},[]),C=e.rects.reference,x=e.rects.popper,O=new Map,R=!0,S=T[0],A=0;A=0,H=L?"width":"height",G=rc(e,{placement:U,boundary:c,rootBoundary:_,altBoundary:f,padding:d}),P=L?K?wi:Xn:K?Ai:Qn;C[H]>x[H]&&(P=zd(P));var j=zd(P),Y=[];if(r&&Y.push(G[F]<=0),a&&Y.push(G[P]<=0,G[j]<=0),Y.every(function(me){return me})){S=U,R=!1;break}O.set(U,Y)}if(R)for(var Q=h?3:1,ae=function(ve){var Ae=T.find(function(J){var ge=O.get(J);if(ge)return ge.slice(0,ve).every(function(ee){return ee})});if(Ae)return S=Ae,"break"},te=Q;te>0;te--){var Z=ae(te);if(Z==="break")break}e.placement!==S&&(e.modifiersData[i]._skip=!0,e.placement=S,e.reset=!0)}}const g0t={name:"flip",enabled:!0,phase:"main",fn:m0t,requiresIfExists:["offset"],data:{_skip:!1}};function FC(n,e,t){return t===void 0&&(t={x:0,y:0}),{top:n.top-e.height-t.y,right:n.right-e.width+t.x,bottom:n.bottom-e.height+t.y,left:n.left-e.width-t.x}}function BC(n){return[Qn,wi,Ai,Xn].some(function(e){return n[e]>=0})}function b0t(n){var e=n.state,t=n.name,i=e.rects.reference,s=e.rects.popper,r=e.modifiersData.preventOverflow,o=rc(e,{elementContext:"reference"}),a=rc(e,{altBoundary:!0}),l=FC(o,i),d=FC(a,s,r),c=BC(l),_=BC(d);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:d,isReferenceHidden:c,hasPopperEscaped:_},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":_})}const E0t={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:b0t};function v0t(n,e,t){var i=os(n),s=[Xn,Qn].indexOf(i)>=0?-1:1,r=typeof t=="function"?t(Object.assign({},e,{placement:n})):t,o=r[0],a=r[1];return o=o||0,a=(a||0)*s,[Xn,wi].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function y0t(n){var e=n.state,t=n.options,i=n.name,s=t.offset,r=s===void 0?[0,0]:s,o=OO.reduce(function(c,_){return c[_]=v0t(_,e.rects,r),c},{}),a=o[e.placement],l=a.x,d=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=d),e.modifiersData[i]=o}const S0t={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:y0t};function T0t(n){var e=n.state,t=n.name;e.modifiersData[t]=UO({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const x0t={name:"popperOffsets",enabled:!0,phase:"read",fn:T0t,data:{}};function C0t(n){return n==="x"?"y":"x"}function R0t(n){var e=n.state,t=n.options,i=n.name,s=t.mainAxis,r=s===void 0?!0:s,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,d=t.rootBoundary,c=t.altBoundary,_=t.padding,f=t.tether,m=f===void 0?!0:f,h=t.tetherOffset,E=h===void 0?0:h,b=rc(e,{boundary:l,rootBoundary:d,padding:_,altBoundary:c}),g=os(e.placement),v=Ta(e.placement),y=!v,T=UE(g),C=C0t(T),x=e.modifiersData.popperOffsets,O=e.rects.reference,R=e.rects.popper,S=typeof E=="function"?E(Object.assign({},e.rects,{placement:e.placement})):E,A=typeof S=="number"?{mainAxis:S,altAxis:S}:Object.assign({mainAxis:0,altAxis:0},S),U=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,F={x:0,y:0};if(x){if(r){var K,L=T==="y"?Qn:Xn,H=T==="y"?Ai:wi,G=T==="y"?"height":"width",P=x[T],j=P+b[L],Y=P-b[H],Q=m?-R[G]/2:0,ae=v===va?O[G]:R[G],te=v===va?-R[G]:-O[G],Z=e.elements.arrow,me=m&&Z?PE(Z):{width:0,height:0},ve=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:DO(),Ae=ve[L],J=ve[H],ge=Ll(0,O[G],me[G]),ee=y?O[G]/2-Q-ge-Ae-A.mainAxis:ae-ge-Ae-A.mainAxis,Se=y?-O[G]/2+Q+ge+J+A.mainAxis:te+ge+J+A.mainAxis,Ie=e.elements.arrow&&Tc(e.elements.arrow),k=Ie?T==="y"?Ie.clientTop||0:Ie.clientLeft||0:0,B=(K=U==null?void 0:U[T])!=null?K:0,$=P+ee-B-k,de=P+Se-B,ie=Ll(m?du(j,$):j,P,m?ao(Y,de):Y);x[T]=ie,F[T]=ie-P}if(a){var Ce,we=T==="x"?Qn:Xn,V=T==="x"?Ai:wi,_e=x[C],se=C==="y"?"height":"width",ce=_e+b[we],D=_e-b[V],I=[Qn,Xn].indexOf(g)!==-1,z=(Ce=U==null?void 0:U[C])!=null?Ce:0,he=I?ce:_e-O[se]-R[se]-z+A.altAxis,X=I?_e+O[se]+R[se]-z-A.altAxis:D,re=m&&I?QSt(he,_e,X):Ll(m?he:ce,_e,m?X:D);x[C]=re,F[C]=re-_e}e.modifiersData[i]=F}}const A0t={name:"preventOverflow",enabled:!0,phase:"main",fn:R0t,requiresIfExists:["offset"]};function w0t(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function N0t(n){return n===ai(n)||!xi(n)?FE(n):w0t(n)}function O0t(n){var e=n.getBoundingClientRect(),t=ya(e.width)/n.offsetWidth||1,i=ya(e.height)/n.offsetHeight||1;return t!==1||i!==1}function I0t(n,e,t){t===void 0&&(t=!1);var i=xi(e),s=xi(e)&&O0t(e),r=Mr(e),o=Sa(n,s,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(i||!i&&!t)&&((ds(e)!=="body"||GE(r))&&(a=N0t(e)),xi(e)?(l=Sa(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):r&&(l.x=BE(r))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function M0t(n){var e=new Map,t=new Set,i=[];n.forEach(function(r){e.set(r.name,r)});function s(r){t.add(r.name);var o=[].concat(r.requires||[],r.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&s(l)}}),i.push(r)}return n.forEach(function(r){t.has(r.name)||s(r)}),i}function D0t(n){var e=M0t(n);return qSt.reduce(function(t,i){return t.concat(e.filter(function(s){return s.phase===i}))},[])}function k0t(n){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(n())})})),e}}function L0t(n){var e=n.reduce(function(t,i){var s=t[i.name];return t[i.name]=s?Object.assign({},s,i,{options:Object.assign({},s.options,i.options),data:Object.assign({},s.data,i.data)}):i,t},{});return Object.keys(e).map(function(t){return e[t]})}var GC={placement:"bottom",modifiers:[],strategy:"absolute"};function zC(){for(var n=arguments.length,e=new Array(n),t=0;t(Nr("data-v-c27eaae6"),n=n(),Or(),n),B0t={key:0,class:"fixed top-0 left-0 w-screen h-screen flex items-center justify-center"},G0t={class:"flex flex-col text-center"},z0t={class:"flex flex-col text-center items-center"},V0t={class:"flex items-center gap-3 text-5xl drop-shadow-md align-middle pt-24"},H0t=Vt(()=>u("img",{class:"w-24 animate-bounce",title:"LoLLMS WebUI",src:ga,alt:"Logo"},null,-1)),q0t={class:"flex flex-col items-start"},Y0t={class:"text-2xl"},$0t=Vt(()=>u("p",{class:"text-gray-400 text-base"},"One tool to rule them all",-1)),W0t=Vt(()=>u("p",{class:"text-gray-400 text-base"},"by ParisNeo",-1)),K0t=Vt(()=>u("hr",{class:"mt-1 w-96 h-1 mx-auto my-2 md:my-2 dark:bg-bg-dark-tone-panel bg-bg-light-tone-panel border-0 rounded"},null,-1)),j0t=Vt(()=>u("p",{class:"text-2xl mb-10"},"Welcome",-1)),Q0t={role:"status",class:"text-center w-full display: flex; flex-row align-items: center;"},X0t={class:"text-2xl animate-pulse mt-2"},Z0t=Vt(()=>u("i",{"data-feather":"chevron-right"},null,-1)),J0t=[Z0t],eTt=Vt(()=>u("i",{"data-feather":"chevron-left"},null,-1)),tTt=[eTt],nTt={key:0,class:"relative flex flex-col no-scrollbar shadow-lg min-w-[24rem] max-w-[24rem] bg-bg-light-tone dark:bg-bg-dark-tone"},iTt={class:"sticky z-10 top-0 bg-bg-light-tone dark:bg-bg-dark-tone shadow-md"},sTt={class:"flex-row p-4 flex items-center gap-3 flex-0"},rTt=Vt(()=>u("i",{"data-feather":"plus"},null,-1)),oTt=[rTt],aTt=Vt(()=>u("i",{"data-feather":"check-square"},null,-1)),lTt=[aTt],cTt=Vt(()=>u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Reset database, remove all discussions"},[u("i",{"data-feather":"refresh-ccw"})],-1)),dTt=Vt(()=>u("i",{"data-feather":"database"},null,-1)),uTt=[dTt],pTt=Vt(()=>u("i",{"data-feather":"log-in"},null,-1)),_Tt=[pTt],hTt={key:0,class:"dropdown"},fTt=Vt(()=>u("i",{"data-feather":"search"},null,-1)),mTt=[fTt],gTt=Vt(()=>u("i",{"data-feather":"save"},null,-1)),bTt=[gTt],ETt={key:2,class:"flex gap-3 flex-1 items-center duration-75"},vTt=Vt(()=>u("i",{"data-feather":"x"},null,-1)),yTt=[vTt],STt=Vt(()=>u("i",{"data-feather":"check"},null,-1)),TTt=[STt],xTt=["src"],CTt=["src"],RTt=["src"],ATt=["src"],wTt={key:7,title:"Loading..",class:"flex flex-row flex-grow justify-end"},NTt=Vt(()=>u("div",{role:"status"},[u("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),u("span",{class:"sr-only"},"Loading...")],-1)),OTt=[NTt],ITt={key:0,class:"flex-row items-center gap-3 flex-0 w-full"},MTt={class:"p-4 pt-2"},DTt={class:"relative"},kTt=Vt(()=>u("div",{class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},[u("div",{class:"scale-75"},[u("i",{"data-feather":"search"})])],-1)),LTt={class:"absolute inset-y-0 right-0 flex items-center pr-3"},PTt=Vt(()=>u("i",{"data-feather":"x"},null,-1)),UTt=[PTt],FTt={key:1,class:"h-px bg-bg-light p-0 mb-4 px-4 mx-4 border-0 dark:bg-bg-dark"},BTt={key:2,class:"flex flex-row flex-grow p-4 pt-0 items-center"},GTt={class:"flex flex-row flex-grow"},zTt={key:0},VTt={class:"flex flex-row"},HTt={key:0,class:"flex gap-3"},qTt=Vt(()=>u("i",{"data-feather":"trash"},null,-1)),YTt=[qTt],$Tt={key:1,class:"flex gap-3 mx-3 flex-1 items-center justify-end group-hover:visible duration-75"},WTt=Vt(()=>u("i",{"data-feather":"check"},null,-1)),KTt=[WTt],jTt=Vt(()=>u("i",{"data-feather":"x"},null,-1)),QTt=[jTt],XTt={class:"flex gap-3"},ZTt=Vt(()=>u("i",{"data-feather":"log-out"},null,-1)),JTt=[ZTt],ext=Vt(()=>u("i",{"data-feather":"bookmark"},null,-1)),txt=[ext],nxt=Vt(()=>u("i",{"data-feather":"list"},null,-1)),ixt=[nxt],sxt={class:"relative flex flex-row flex-grow mb-10 z-0 w-full"},rxt={key:1,class:"gap-2 py-2 my-2 hover:shadow-md hover:bg-primary-light dark:hover:bg-primary rounded-md p-2 duration-75 group cursor-pointer"},oxt=Vt(()=>u("p",{class:"px-3"},"No discussions are found",-1)),axt=[oxt],lxt=Vt(()=>u("div",{class:"sticky bottom-0 bg-gradient-to-t pointer-events-none from-bg-light-tone dark:from-bg-dark-tone flex flex-grow"},null,-1)),cxt={class:"ml-2"},dxt={key:1,class:"relative flex flex-col flex-grow w-full"},uxt={class:"container pt-4 pb-50 mb-50 w-full"},pxt=Vt(()=>u("div",null,[u("br"),u("br"),u("br"),u("br"),u("br"),u("br"),u("br")],-1)),_xt=Vt(()=>u("div",{class:"absolute w-full bottom-0 bg-transparent p-10 pt-16 bg-gradient-to-t from-bg-light dark:from-bg-dark from-5% via-bg-light dark:via-bg-dark via-10% to-transparent to-100%"},null,-1)),hxt={key:0,class:"bottom-0 flex flex-row items-center justify-center"},fxt={role:"status",class:"fixed m-0 p-2 left-2 bottom-2 min-w-[24rem] max-w-[24rem] h-20 flex flex-col justify-center items-center pb-4 bg-blue-500 rounded-lg shadow-lg z-50 background-a"},mxt={class:"text-2xl animate-pulse mt-2 text-white"},gxt={setup(){},data(){return{memory_icon:YO,active_skills:$O,inactive_skills:WO,skillsRegistry:KO,posts_headers:{accept:"application/json","Content-Type":"application/json"},host:"",progress_visibility_val:!0,progress_value:0,msgTypes:{MSG_TYPE_CHUNK:0,MSG_TYPE_FULL:1,MSG_TYPE_FULL_INVISIBLE_TO_AI:2,MSG_TYPE_FULL_INVISIBLE_TO_USER:3,MSG_TYPE_EXCEPTION:4,MSG_TYPE_WARNING:5,MSG_TYPE_INFO:6,MSG_TYPE_STEP:7,MSG_TYPE_STEP_START:8,MSG_TYPE_STEP_PROGRESS:9,MSG_TYPE_STEP_END:10,MSG_TYPE_JSON_INFOS:11,MSG_TYPE_REF:12,MSG_TYPE_CODE:13,MSG_TYPE_UI:14,MSG_TYPE_NEW_MESSAGE:15,MSG_TYPE_FINISHED_MESSAGE:17},senderTypes:{SENDER_TYPES_USER:0,SENDER_TYPES_AI:1,SENDER_TYPES_SYSTEM:2},list:[],tempList:[],currentDiscussion:{},discussionArr:[],loading:!1,filterTitle:"",filterInProgress:!1,isCreated:!1,isCheckbox:!1,isSelectAll:!1,showSaveConfirmation:!1,showBrainConfirmation:!1,showConfirmation:!1,chime:new Audio("chime_aud.wav"),showToast:!1,isSearch:!1,isDiscussionBottom:!1,personalityAvatars:[],fileList:[],database_selectorDialogVisible:!1,isDragOverDiscussion:!1,isDragOverChat:!1,panelCollapsed:!1,isOpen:!1,discussion_id:0}},methods:{add_webpage(){console.log("addWebLink received"),this.$refs.web_url_input_box.showPanel()},addWebpage(){Me.post("/add_webpage",{client_id:this.client_id,url:this.$refs.web_url_input_box.inputText},{headers:this.posts_headers}).then(n=>{n&&n.status&&(console.log("Done"),this.recoverFiles())})},show_progress(n){this.progress_visibility_val=!0},hide_progress(n){this.progress_visibility_val=!1},update_progress(n){console.log("Progress update"),this.progress_value=n.value},onSettingsBinding(){try{this.isLoading=!0,Me.get("/get_active_binding_settings").then(n=>{this.isLoading=!1,n&&(n.data&&Object.keys(n.data).length>0?this.$store.state.universalForm.showForm(n.data,"Binding settings - "+bindingEntry.binding.name,"Save changes","Cancel").then(e=>{try{Me.post("/set_active_binding_settings",e).then(t=>{t&&t.data?(console.log("binding set with new settings",t.data),this.$store.state.toast.showToast("Binding settings updated successfully!",4,!0)):(this.$store.state.toast.showToast(`Did not get binding settings responses. +`+n.name,4,!1)}else console.log("mounting pers");this.$emit("personalitySelected"),Ve(()=>{qe.replace()})}},async select_personality(n){if(!n)return{status:!1,error:"no personality - select_personality"};const e=n.language===null?n.full_path:n.full_path+":"+n.language;console.log("Selecting personality ",e);const t=this.$store.state.config.personalities.findIndex(s=>s===e),i={client_id:this.$store.state.client_id,id:t};try{const s=await Me.post("/select_personality",i);if(s)return this.$store.dispatch("refreshConfig").then(()=>{this.$store.dispatch("refreshPersonalitiesZoo").then(()=>{this.$store.dispatch("refreshMountedPersonalities")})}),s.data}catch(s){console.log(s.message,"select_personality - settings");return}},emitloaded(){this.$emit("loaded")},showModels(n){n.preventDefault();const e=this.$refs.modelsSelectionList;console.log(e);const t=new MouseEvent("click");e.dispatchEvent(t)},setBinding(n){console.log("Setting binding to "+n.name),this.selecting_binding=!0,this.selectedBinding=n,this.$store.state.messageBox.showBlockingMessage("Loading binding"),Me.post("/update_setting",{client_id:this.$store.state.client_id,setting_name:"binding_name",setting_value:n.name}).then(async e=>{this.$store.state.messageBox.hideMessage(),console.log("UPDATED"),console.log(e),await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshBindings"),await this.$store.dispatch("refreshModelsZoo"),await this.$store.dispatch("refreshModels"),this.$store.state.toast.showToast(`Binding changed to ${this.currentBinding.name}`,4,!0),this.selecting_binding=!1}).catch(e=>{this.$store.state.messageBox.hideMessage(),this.$store.state.toast.showToast(`Error ${e}`,4,!0),this.selecting_binding=!1})},setModel(n){console.log("Setting model to "+n.name),this.selecting_model=!0,this.selectedModel=n,this.$store.state.messageBox.showBlockingMessage("Loading model"),Me.post("/update_setting",{client_id:this.$store.state.client_id,setting_name:"model_name",setting_value:n.name}).then(async e=>{this.$store.state.messageBox.hideMessage(),console.log("UPDATED"),console.log(e),await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshModels"),this.$store.state.toast.showToast(`Model changed to ${this.currentModel.name}`,4,!0),this.selecting_model=!1}).catch(e=>{this.$store.state.messageBox.hideMessage(),this.$store.state.toast.showToast(`Error ${e}`,4,!0),this.selecting_model=!1})},download_files(){Me.get("/download_files")},remove_file(n){Me.get("/remove_file",{client_id:this.$store.state.client_id,name:n}).then(e=>{console.log(e)})},clear_files(){Me.get("/clear_personality_files_list").then(n=>{console.log(n),n.data.state?(this.$store.state.toast.showToast("File removed successfully",4,!0),this.filesList.length=0,this.isFileSentList.length=0,this.totalSize=0):this.$store.state.toast.showToast("Files couldn't be removed",4,!1)})},send_file(n,e){console.log("Send file triggered");const t=new FileReader,i=24*1024;let s=0,r=0;t.onloadend=()=>{if(t.error){console.error("Error reading file:",t.error);return}const a=t.result,l=s+a.byteLength>=n.size;Ze.emit("send_file_chunk",{filename:n.name,chunk:a,offset:s,isLastChunk:l,chunkIndex:r}),s+=a.byteLength,r++,l?(console.log("File sent successfully"),this.isFileSentList[this.filesList.length-1]=!0,console.log(this.isFileSentList),this.$store.state.toast.showToast("File uploaded successfully",4,!0),e()):o()};function o(){const a=n.slice(s,s+i);t.readAsArrayBuffer(a)}console.log("Uploading file"),o()},makeAnEmptyUserMessage(){this.$emit("createEmptyUserMessage",this.message),this.message=""},makeAnEmptyAIMessage(){this.$emit("createEmptyAIMessage")},startSpeechRecognition(){"SpeechRecognition"in window||"webkitSpeechRecognition"in window?(this.recognition=new(window.SpeechRecognition||window.webkitSpeechRecognition),this.recognition.lang=this.$store.state.config.audio_in_language,this.recognition.interimResults=!0,this.recognition.onstart=()=>{this.isLesteningToVoice=!0,this.silenceTimer=setTimeout(()=>{this.recognition.stop()},this.silenceTimeout)},this.recognition.onresult=n=>{let e="";for(let t=n.resultIndex;t{this.recognition.stop()},this.silenceTimeout)},this.recognition.onerror=n=>{console.error("Speech recognition error:",n.error),this.isLesteningToVoice=!1,clearTimeout(this.silenceTimer)},this.recognition.onend=()=>{console.log("Speech recognition ended."),this.isLesteningToVoice=!1,clearTimeout(this.silenceTimer),this.submit()},this.recognition.start()):console.error("Speech recognition is not supported in this browser.")},onPersonalitiesReadyFun(){this.personalities_ready=!0},onShowPersListFun(n){this.showPersonalities=!this.showPersonalities},handleOnTalk(n){this.showPersonalities=!1,this.onTalk(n)},onMountFun(n){console.log("Mounting personality"),this.$refs.mountedPers.constructor()},onUnmountFun(n){console.log("Unmounting personality"),this.$refs.mountedPers.constructor()},onRemount(n){console.log("Remounting chat"),this.$refs.mountedPers.constructor()},computedFileSize(n){return Ve(()=>{qe.replace()}),ss(n)},removeItem(n){console.log("Réemoving ",n.name),Me.post("/remove_file",{client_id:this.$store.state.client_id,name:n.name},{headers:this.posts_headers}).then(()=>{this.filesList=this.filesList.filter(e=>e!=n)}),console.log(this.filesList)},sendMessageEvent(n,e="no_internet"){this.$emit("messageSentEvent",n,e)},sendCMDEvent(n){this.$emit("sendCMDEvent",n)},addWebLink(){console.log("Emitting addWebLink"),this.$emit("addWebLink")},add_file(){const n=document.createElement("input");n.type="file",n.style.display="none",n.multiple=!0,document.body.appendChild(n),n.addEventListener("change",()=>{console.log("Calling Add file..."),this.addFiles(n.files),document.body.removeChild(n)}),n.click()},takePicture(){Ze.emit("take_picture"),Ze.on("picture_taken",()=>{Me.get("/get_current_personality_files_list").then(n=>{this.filesList=n.data.files,this.isFileSentList=n.data.files.map(e=>!0),console.log(`Files recovered: ${this.filesList}`)})})},submitOnEnter(n){this.loading||n.which===13&&(n.preventDefault(),n.repeat||(this.sendMessageEvent(this.message),this.message=""))},submit(){this.message&&(this.sendMessageEvent(this.message),this.message="")},submitWithInternetSearch(){this.message&&(this.sendMessageEvent(this.message,"internet"),this.message="")},stopGenerating(){this.$emit("stopGenerating")},addFiles(n){console.log("Adding files");const e=[...n];let t=0;const i=()=>{if(t>=e.length){console.log(`Files_list: ${this.filesList}`);return}const s=e[t];this.filesList.push(s),this.isFileSentList.push(!1),this.send_file(s,()=>{t++,i()})};i()}},watch:{installedModels:{immediate:!0,handler(n){this.$nextTick(()=>{this.installedModels=n})}},model_name:{immediate:!0,handler(n){this.$nextTick(()=>{this.model_name=n})}},showfilesList(){Ve(()=>{qe.replace()})},loading(n,e){Ve(()=>{qe.replace()})},filesList:{handler(n,e){let t=0;if(n.length>0)for(let i=0;i{qe.replace()})},activated(){Ve(()=>{qe.replace()})}},zt=n=>(Nr("data-v-184e5bea"),n=n(),Or(),n),zvt={class:"absolute bottom-0 left-0 w-fit min-w-96 w-full justify-center text-center p-4"},Vvt={key:0,class:"items-center gap-2 rounded-lg border bg-bg-light-tone dark:bg-bg-dark-tone p-1.5 shadow-sm hover:shadow-none dark:border-gray-800 w-fit"},Hvt={class:"flex"},qvt=["title"],Yvt=zt(()=>u("i",{"data-feather":"list"},null,-1)),$vt=[Yvt],Wvt={key:0},Kvt={class:"flex flex-col max-h-64"},jvt=["title"],Qvt={class:"flex flex-row items-center gap-1 text-left p-2 text-sm font-medium items-center gap-2 rounded-lg border bg-gray-100 p-1.5 shadow-sm hover:shadow-none dark:border-gray-800 dark:bg-gray-700 hover:bg-primary dark:hover:bg-primary"},Xvt={key:0,filesList:"",role:"status"},Zvt=zt(()=>u("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1)),Jvt=zt(()=>u("span",{class:"sr-only"},"Loading...",-1)),eyt=[Zvt,Jvt],tyt=zt(()=>u("div",null,[u("i",{"data-feather":"file",class:"w-5 h-5"})],-1)),nyt=zt(()=>u("div",{class:"grow"},null,-1)),iyt={class:"flex flex-row items-center"},syt={class:"whitespace-nowrap"},ryt=["onClick"],oyt=zt(()=>u("i",{"data-feather":"x",class:"w-5 h-5"},null,-1)),ayt=[oyt],lyt={key:1,class:"flex mx-1 w-500"},cyt={class:"whitespace-nowrap flex flex-row gap-2"},dyt=zt(()=>u("p",{class:"font-bold"}," Total size: ",-1)),uyt=zt(()=>u("div",{class:"grow"},null,-1)),pyt=zt(()=>u("i",{"data-feather":"trash",class:"w-5 h-5"},null,-1)),_yt=[pyt],hyt=zt(()=>u("i",{"data-feather":"download-cloud",class:"w-5 h-5"},null,-1)),fyt=[hyt],myt={key:2,class:"mx-1"},gyt={key:1,title:"Selecting model",class:"flex flex-row flex-grow justify-end bg-primary"},byt={role:"status"},Eyt=["src"],vyt=zt(()=>u("span",{class:"sr-only"},"Selecting model...",-1)),yyt={class:"flex w-fit pb-3 relative grow w-full"},Syt={class:"relative grow flex h-12.5 cursor-pointer select-none items-center gap-2 rounded-lg border bg-bg-light-tone dark:bg-bg-dark-tone p-1 shadow-sm hover:shadow-none dark:border-gray-800",tabindex:"0"},Tyt={key:0,title:"Waiting for reply"},xyt=["src"],Cyt=zt(()=>u("div",{role:"status"},[u("span",{class:"sr-only"},"Loading...")],-1)),Ryt={key:1,class:"w-fit group relative"},Ayt={class:"group w-full inline-flex absolute opacity-0 group-hover:opacity-100 transform group-hover:-translate-y-10 group-hover:translate-x-15 transition-all duration-300"},wyt={key:0,class:"group items-center flex flex-row"},Nyt=["onClick"],Oyt=["src","title"],Iyt={class:"group items-center flex flex-row"},Myt=["src","title"],Dyt={key:2,class:"w-fit group relative"},kyt={class:"group w-full inline-flex absolute opacity-0 group-hover:opacity-100 transform group-hover:-translate-y-10 group-hover:translate-x-15 transition-all duration-300"},Lyt={key:0,class:"group items-center flex flex-row"},Pyt=["onClick"],Uyt=["src","title"],Fyt={class:"group items-center flex flex-row"},Byt=["src","title"],Gyt={class:"w-fit group relative"},zyt={class:"group w-full inline-flex absolute opacity-0 group-hover:opacity-100 transform group-hover:-translate-y-10 group-hover:translate-x-15 transition-all duration-300"},Vyt={key:0,class:"group items-center flex flex-row"},Hyt=["onClick"],qyt=["src","title"],Yyt=["onClick"],$yt=zt(()=>u("span",{class:"hidden hover:block top-3 left-9 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2 border-transparent",title:"Unmount personality"},[u("svg",{"aria-hidden":"true",class:"w-4 h-4 text-red-600 hover:text-red-500",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[u("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})])],-1)),Wyt=[$yt],Kyt={class:"w-fit"},jyt={class:"relative grow"},Qyt={class:"group relative w-max"},Xyt=zt(()=>u("i",{"data-feather":"send"},null,-1)),Zyt=[Xyt],Jyt=zt(()=>u("div",{class:"pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"},[u("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Sends your message to the AI.")],-1)),eSt={class:"group relative w-max"},tSt=["src"],nSt=zt(()=>u("div",{class:"pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"},[u("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Sends your message to the AI with internet search.")],-1)),iSt={class:"group relative w-max"},sSt=zt(()=>u("i",{"data-feather":"mic"},null,-1)),rSt=[sSt],oSt=zt(()=>u("div",{class:"pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"},[u("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Press and talk.")],-1)),aSt={key:4,class:"group relative w-max"},lSt=zt(()=>u("i",{"data-feather":"file-plus"},null,-1)),cSt=[lSt],dSt=zt(()=>u("div",{class:"pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"},[u("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Send File to the AI.")],-1)),uSt={class:"group relative w-max"},pSt=zt(()=>u("i",{"data-feather":"camera"},null,-1)),_St=[pSt],hSt=zt(()=>u("div",{class:"pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"},[u("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Take a shot from webcam.")],-1)),fSt={class:"group relative w-max"},mSt=zt(()=>u("i",{"data-feather":"globe"},null,-1)),gSt=[mSt],bSt=zt(()=>u("div",{class:"pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"},[u("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Add a weblink to the discussion.")],-1)),ESt={class:"group relative w-max"},vSt=zt(()=>u("i",{"data-feather":"message-square"},null,-1)),ySt=[vSt],SSt=zt(()=>u("div",{class:"pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"},[u("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"New empty User message.")],-1)),TSt={class:"group relative w-max"},xSt=zt(()=>u("i",{"data-feather":"message-square"},null,-1)),CSt=[xSt],RSt=zt(()=>u("div",{class:"pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"},[u("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"New empty ai message.")],-1)),ASt=zt(()=>u("div",{class:"ml-auto gap-2"},null,-1));function wSt(n,e,t,i,s,r){const o=ht("MountedPersonalitiesList"),a=ht("MountedPersonalities"),l=ht("PersonalitiesCommands"),d=ht("UniversalForm");return w(),M($e,null,[u("form",null,[u("div",zvt,[s.filesList.length>0||s.showPersonalities?(w(),M("div",Vvt,[u("div",Hvt,[u("button",{class:"mx-1 w-full text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:s.showfilesList?"Hide file list":"Show file list",type:"button",onClick:e[0]||(e[0]=Te(c=>s.showfilesList=!s.showfilesList,["stop"]))},$vt,8,qvt)]),s.filesList.length>0&&s.showfilesList==!0?(w(),M("div",Wvt,[u("div",Kvt,[Oe(rs,{name:"list",tag:"div",class:"flex flex-col flex-grow overflow-y-auto scrollbar-thin scrollbar-track-bg-light scrollbar-thumb-bg-light-tone hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark dark:scrollbar-thumb-bg-dark-tone dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},{default:Je(()=>[(w(!0),M($e,null,ct(s.filesList,(c,_)=>(w(),M("div",{key:_+"-"+c.name},[u("div",{class:"m-1",title:c.name},[u("div",Qvt,[s.isFileSentList[_]?q("",!0):(w(),M("div",Xvt,eyt)),tyt,u("div",{class:Ye(["line-clamp-1 w-3/5",s.isFileSentList[_]?"text-green-500":"text-red-200"])},fe(c.name),3),nyt,u("div",iyt,[u("p",syt,fe(r.computedFileSize(c.size)),1),u("button",{type:"button",title:"Remove item",class:"flex items-center p-0.5 text-sm rounded-sm hover:text-red-600 active:scale-75",onClick:f=>r.removeItem(c)},ayt,8,ryt)])])],8,jvt)]))),128))]),_:1})])])):q("",!0),s.filesList.length>0?(w(),M("div",lyt,[u("div",cyt,[dyt,je(" "+fe(s.totalSize)+" ("+fe(s.filesList.length)+") ",1)]),uyt,u("button",{type:"button",title:"Clear all",class:"flex items-center p-0.5 text-sm rounded-sm hover:text-red-600 active:scale-75",onClick:e[1]||(e[1]=(...c)=>r.clear_files&&r.clear_files(...c))},_yt),u("button",{type:"button",title:"Download database",class:"flex items-center p-0.5 text-sm rounded-sm hover:text-red-600 active:scale-75",onClick:e[2]||(e[2]=(...c)=>r.download_files&&r.download_files(...c))},fyt)])):q("",!0),s.showPersonalities?(w(),M("div",myt,[Oe(o,{ref:"mountedPersList",onShowPersList:r.onShowPersListFun,"on-mounted":r.onMountFun,"on-un-mounted":r.onUnmountFun,"on-remounted":n.onRemountFun,"on-talk":r.handleOnTalk,discussionPersonalities:r.allDiscussionPersonalities},null,8,["onShowPersList","on-mounted","on-un-mounted","on-remounted","on-talk","discussionPersonalities"])])):q("",!0)])):q("",!0),s.selecting_model||s.selecting_binding?(w(),M("div",gyt,[u("div",byt,[u("img",{src:s.loader_v0,class:"w-50 h-50"},null,8,Eyt),vyt])])):q("",!0),u("div",yyt,[u("div",Syt,[t.loading?(w(),M("div",Tyt,[u("img",{src:s.loader_v0},null,8,xyt),Cyt])):q("",!0),t.loading?q("",!0):(w(),M("div",Ryt,[u("div",Ayt,[(w(!0),M($e,null,ct(r.installedBindings,(c,_)=>(w(),M("div",{class:"w-full",key:_+"-"+c.name,ref_for:!0,ref:"installedBindings"},[c.name!=r.binding_name?(w(),M("div",wyt,[u("button",{onClick:Te(f=>r.setBinding(c),["prevent"]),class:"w-8 h-8"},[u("img",{src:c.icon?c.icon:s.modelImgPlaceholder,class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary",title:c.name},null,8,Oyt)],8,Nyt)])):q("",!0)]))),128))]),u("div",Iyt,[u("button",{onClick:e[3]||(e[3]=Te(c=>r.showModelConfig(),["prevent"])),class:"w-8 h-8"},[u("img",{src:r.currentBindingIcon,class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary",title:r.currentBinding?r.currentBinding.name:"unknown"},null,8,Myt)])])])),t.loading?q("",!0):(w(),M("div",Dyt,[u("div",kyt,[(w(!0),M($e,null,ct(r.installedModels,(c,_)=>(w(),M("div",{class:"w-full",key:_+"-"+c.name,ref_for:!0,ref:"installedModels"},[c.name!=r.model_name?(w(),M("div",Lyt,[u("button",{onClick:Te(f=>r.setModel(c),["prevent"]),class:"w-8 h-8"},[u("img",{src:c.icon?c.icon:s.modelImgPlaceholder,class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary",title:c.name},null,8,Uyt)],8,Pyt)])):q("",!0)]))),128))]),u("div",Fyt,[u("button",{onClick:e[4]||(e[4]=Te(c=>r.showModelConfig(),["prevent"])),class:"w-8 h-8"},[u("img",{src:r.currentModelIcon,class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary",title:r.currentModel?r.currentModel.name:"unknown"},null,8,Byt)])])])),u("div",Gyt,[u("div",zyt,[(w(!0),M($e,null,ct(r.mountedPersonalities,(c,_)=>(w(),M("div",{class:"w-full",key:_+"-"+c.name,ref_for:!0,ref:"mountedPersonalities"},[_!=r.personality_name?(w(),M("div",Vyt,[u("button",{onClick:Te(f=>r.onPersonalitySelected(c),["prevent"]),class:"w-8 h-8"},[u("img",{src:s.bUrl+c.avatar,onError:e[5]||(e[5]=(...f)=>n.personalityImgPlacehodler&&n.personalityImgPlacehodler(...f)),class:Ye(["w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary",this.$store.state.active_personality_id==this.$store.state.personalities.indexOf(c.full_path)?"border-secondary":"border-transparent z-0"]),title:c.name},null,42,qyt)],8,Hyt),u("button",{onClick:Te(f=>r.unmountPersonality(c),["prevent"])},Wyt,8,Yyt)])):q("",!0)]))),128))]),Oe(a,{ref:"mountedPers",onShowPersList:r.onShowPersListFun,onReady:r.onPersonalitiesReadyFun},null,8,["onShowPersList","onReady"])]),u("div",Kyt,[s.personalities_ready&&this.$store.state.mountedPersArr[this.$store.state.config.active_personality_id].commands!=""?(w(),xt(l,{key:0,commandsList:this.$store.state.mountedPersArr[this.$store.state.config.active_personality_id].commands,sendCommand:r.sendCMDEvent,"on-show-toast-message":t.onShowToastMessage,ref:"personalityCMD"},null,8,["commandsList","sendCommand","on-show-toast-message"])):q("",!0)]),u("div",jyt,[ne(u("textarea",{id:"chat",rows:"1","onUpdate:modelValue":e[6]||(e[6]=c=>s.message=c),title:"Hold SHIFT + ENTER to add new line",class:"inline-block no-scrollbar p-2.5 w-full text-sm text-gray-900 bg-bg-light rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-bg-dark dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Send message...",onKeydown:e[7]||(e[7]=wr(Te(c=>r.submitOnEnter(c),["exact"]),["enter"]))},`\r + `,544),[[Pe,s.message]])]),t.loading?(w(),M("button",{key:3,type:"button",class:"bg-red-500 dark:bg-red-800 hover:bg-red-600 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:hover:bg-bg-dark-tone focus:outline-none dark:focus:ring-blue-800",onClick:e[8]||(e[8]=Te((...c)=>r.stopGenerating&&r.stopGenerating(...c),["stop"]))}," Stop generating ")):q("",!0),u("div",Qyt,[t.loading?q("",!0):(w(),M("button",{key:0,type:"button",onClick:e[9]||(e[9]=(...c)=>r.submit&&r.submit(...c)),title:"Send",class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},Zyt)),Jyt]),u("div",eSt,[t.loading?q("",!0):(w(),M("button",{key:0,type:"button",onClick:e[10]||(e[10]=(...c)=>r.submitWithInternetSearch&&r.submitWithInternetSearch(...c)),title:"Send With internet",class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},[u("img",{src:s.sendGlobe,width:"50",height:"50"},null,8,tSt)])),nSt]),u("div",iSt,[t.loading?q("",!0):(w(),M("button",{key:0,type:"button",onClick:e[11]||(e[11]=(...c)=>r.startSpeechRecognition&&r.startSpeechRecognition(...c)),class:Ye([{"text-red-500":s.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"])},rSt,2)),oSt]),t.loading?q("",!0):(w(),M("div",aSt,[u("input",{type:"file",ref:"fileDialog",style:{display:"none"},onChange:e[12]||(e[12]=(...c)=>r.addFiles&&r.addFiles(...c)),multiple:""},null,544),u("button",{type:"button",onClick:e[13]||(e[13]=Te((...c)=>r.add_file&&r.add_file(...c),["prevent"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},cSt),dSt])),u("div",uSt,[t.loading?q("",!0):(w(),M("button",{key:0,type:"button",onClick:e[14]||(e[14]=Te((...c)=>r.takePicture&&r.takePicture(...c),["stop"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},_St)),hSt]),u("div",fSt,[t.loading?q("",!0):(w(),M("button",{key:0,type:"button",onClick:e[15]||(e[15]=Te((...c)=>r.addWebLink&&r.addWebLink(...c),["stop"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},gSt)),bSt]),u("div",ESt,[t.loading?q("",!0):(w(),M("button",{key:0,type:"button",onClick:e[16]||(e[16]=Te((...c)=>r.makeAnEmptyUserMessage&&r.makeAnEmptyUserMessage(...c),["stop"])),class:"w-6 text-blue-400 hover:text-secondary duration-75 active:scale-90"},ySt)),SSt]),u("div",TSt,[t.loading?q("",!0):(w(),M("button",{key:0,type:"button",onClick:e[17]||(e[17]=Te((...c)=>r.makeAnEmptyAIMessage&&r.makeAnEmptyAIMessage(...c),["stop"])),class:"w-6 text-red-400 hover:text-secondary duration-75 active:scale-90"},CSt)),RSt])]),ASt])])]),Oe(d,{ref:"universalForm",class:"z-20"},null,512)],64)}const TO=bt(Gvt,[["render",wSt],["__scopeId","data-v-184e5bea"]]),NSt={name:"WelcomeComponent",setup(){return{}}},OSt={class:"flex flex-col text-center"},ISt=zu('
Logo

LoLLMS

One tool to rule them all


Welcome

Please create a new discussion or select existing one to start

',1),MSt=[ISt];function DSt(n,e,t,i,s,r){return w(),M("div",OSt,MSt)}const xO=bt(NSt,[["render",DSt]]);var kSt=function(){function n(e,t){t===void 0&&(t=[]),this._eventType=e,this._eventFunctions=t}return n.prototype.init=function(){var e=this;this._eventFunctions.forEach(function(t){typeof window<"u"&&window.addEventListener(e._eventType,t)})},n}(),ou=globalThis&&globalThis.__assign||function(){return ou=Object.assign||function(n){for(var e,t=1,i=arguments.length;t"u")return!1;var e=ai(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function WSt(n){var e=n.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},s=e.attributes[t]||{},r=e.elements[t];!xi(r)||!ds(r)||(Object.assign(r.style,i),Object.keys(s).forEach(function(o){var a=s[o];a===!1?r.removeAttribute(o):r.setAttribute(o,a===!0?"":a)}))})}function KSt(n){var e=n.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(i){var s=e.elements[i],r=e.attributes[i]||{},o=Object.keys(e.styles.hasOwnProperty(i)?e.styles[i]:t[i]),a=o.reduce(function(l,d){return l[d]="",l},{});!xi(s)||!ds(s)||(Object.assign(s.style,a),Object.keys(r).forEach(function(l){s.removeAttribute(l)}))})}}const jSt={name:"applyStyles",enabled:!0,phase:"write",fn:WSt,effect:KSt,requires:["computeStyles"]};function os(n){return n.split("-")[0]}var ao=Math.max,du=Math.min,ya=Math.round;function ib(){var n=navigator.userAgentData;return n!=null&&n.brands&&Array.isArray(n.brands)?n.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function IO(){return!/^((?!chrome|android).)*safari/i.test(ib())}function Sa(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=n.getBoundingClientRect(),s=1,r=1;e&&xi(n)&&(s=n.offsetWidth>0&&ya(i.width)/n.offsetWidth||1,r=n.offsetHeight>0&&ya(i.height)/n.offsetHeight||1);var o=mo(n)?ai(n):window,a=o.visualViewport,l=!IO()&&t,d=(i.left+(l&&a?a.offsetLeft:0))/s,c=(i.top+(l&&a?a.offsetTop:0))/r,_=i.width/s,f=i.height/r;return{width:_,height:f,top:c,right:d+_,bottom:c+f,left:d,x:d,y:c}}function PE(n){var e=Sa(n),t=n.offsetWidth,i=n.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:n.offsetLeft,y:n.offsetTop,width:t,height:i}}function MO(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&LE(t)){var i=e;do{if(i&&n.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function zs(n){return ai(n).getComputedStyle(n)}function QSt(n){return["table","td","th"].indexOf(ds(n))>=0}function Mr(n){return((mo(n)?n.ownerDocument:n.document)||window.document).documentElement}function dp(n){return ds(n)==="html"?n:n.assignedSlot||n.parentNode||(LE(n)?n.host:null)||Mr(n)}function kC(n){return!xi(n)||zs(n).position==="fixed"?null:n.offsetParent}function XSt(n){var e=/firefox/i.test(ib()),t=/Trident/i.test(ib());if(t&&xi(n)){var i=zs(n);if(i.position==="fixed")return null}var s=dp(n);for(LE(s)&&(s=s.host);xi(s)&&["html","body"].indexOf(ds(s))<0;){var r=zs(s);if(r.transform!=="none"||r.perspective!=="none"||r.contain==="paint"||["transform","perspective"].indexOf(r.willChange)!==-1||e&&r.willChange==="filter"||e&&r.filter&&r.filter!=="none")return s;s=s.parentNode}return null}function Tc(n){for(var e=ai(n),t=kC(n);t&&QSt(t)&&zs(t).position==="static";)t=kC(t);return t&&(ds(t)==="html"||ds(t)==="body"&&zs(t).position==="static")?e:t||XSt(n)||e}function UE(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function Ll(n,e,t){return ao(n,du(e,t))}function ZSt(n,e,t){var i=Ll(n,e,t);return i>t?t:i}function DO(){return{top:0,right:0,bottom:0,left:0}}function kO(n){return Object.assign({},DO(),n)}function LO(n,e){return e.reduce(function(t,i){return t[i]=n,t},{})}var JSt=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,kO(typeof e!="number"?e:LO(e,Sc))};function e0t(n){var e,t=n.state,i=n.name,s=n.options,r=t.elements.arrow,o=t.modifiersData.popperOffsets,a=os(t.placement),l=UE(a),d=[Xn,wi].indexOf(a)>=0,c=d?"height":"width";if(!(!r||!o)){var _=JSt(s.padding,t),f=PE(r),m=l==="y"?Qn:Xn,h=l==="y"?Ai:wi,E=t.rects.reference[c]+t.rects.reference[l]-o[l]-t.rects.popper[c],b=o[l]-t.rects.reference[l],g=Tc(r),v=g?l==="y"?g.clientHeight||0:g.clientWidth||0:0,y=E/2-b/2,T=_[m],C=v-f[c]-_[h],x=v/2-f[c]/2+y,O=Ll(T,x,C),R=l;t.modifiersData[i]=(e={},e[R]=O,e.centerOffset=O-x,e)}}function t0t(n){var e=n.state,t=n.options,i=t.element,s=i===void 0?"[data-popper-arrow]":i;s!=null&&(typeof s=="string"&&(s=e.elements.popper.querySelector(s),!s)||MO(e.elements.popper,s)&&(e.elements.arrow=s))}const n0t={name:"arrow",enabled:!0,phase:"main",fn:e0t,effect:t0t,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ta(n){return n.split("-")[1]}var i0t={top:"auto",right:"auto",bottom:"auto",left:"auto"};function s0t(n,e){var t=n.x,i=n.y,s=e.devicePixelRatio||1;return{x:ya(t*s)/s||0,y:ya(i*s)/s||0}}function LC(n){var e,t=n.popper,i=n.popperRect,s=n.placement,r=n.variation,o=n.offsets,a=n.position,l=n.gpuAcceleration,d=n.adaptive,c=n.roundOffsets,_=n.isFixed,f=o.x,m=f===void 0?0:f,h=o.y,E=h===void 0?0:h,b=typeof c=="function"?c({x:m,y:E}):{x:m,y:E};m=b.x,E=b.y;var g=o.hasOwnProperty("x"),v=o.hasOwnProperty("y"),y=Xn,T=Qn,C=window;if(d){var x=Tc(t),O="clientHeight",R="clientWidth";if(x===ai(t)&&(x=Mr(t),zs(x).position!=="static"&&a==="absolute"&&(O="scrollHeight",R="scrollWidth")),x=x,s===Qn||(s===Xn||s===wi)&&r===sc){T=Ai;var S=_&&x===C&&C.visualViewport?C.visualViewport.height:x[O];E-=S-i.height,E*=l?1:-1}if(s===Xn||(s===Qn||s===Ai)&&r===sc){y=wi;var A=_&&x===C&&C.visualViewport?C.visualViewport.width:x[R];m-=A-i.width,m*=l?1:-1}}var U=Object.assign({position:a},d&&i0t),F=c===!0?s0t({x:m,y:E},ai(t)):{x:m,y:E};if(m=F.x,E=F.y,l){var K;return Object.assign({},U,(K={},K[T]=v?"0":"",K[y]=g?"0":"",K.transform=(C.devicePixelRatio||1)<=1?"translate("+m+"px, "+E+"px)":"translate3d("+m+"px, "+E+"px, 0)",K))}return Object.assign({},U,(e={},e[T]=v?E+"px":"",e[y]=g?m+"px":"",e.transform="",e))}function r0t(n){var e=n.state,t=n.options,i=t.gpuAcceleration,s=i===void 0?!0:i,r=t.adaptive,o=r===void 0?!0:r,a=t.roundOffsets,l=a===void 0?!0:a,d={placement:os(e.placement),variation:Ta(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,LC(Object.assign({},d,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,LC(Object.assign({},d,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const o0t={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:r0t,data:{}};var Wc={passive:!0};function a0t(n){var e=n.state,t=n.instance,i=n.options,s=i.scroll,r=s===void 0?!0:s,o=i.resize,a=o===void 0?!0:o,l=ai(e.elements.popper),d=[].concat(e.scrollParents.reference,e.scrollParents.popper);return r&&d.forEach(function(c){c.addEventListener("scroll",t.update,Wc)}),a&&l.addEventListener("resize",t.update,Wc),function(){r&&d.forEach(function(c){c.removeEventListener("scroll",t.update,Wc)}),a&&l.removeEventListener("resize",t.update,Wc)}}const l0t={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:a0t,data:{}};var c0t={left:"right",right:"left",bottom:"top",top:"bottom"};function zd(n){return n.replace(/left|right|bottom|top/g,function(e){return c0t[e]})}var d0t={start:"end",end:"start"};function PC(n){return n.replace(/start|end/g,function(e){return d0t[e]})}function FE(n){var e=ai(n),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function BE(n){return Sa(Mr(n)).left+FE(n).scrollLeft}function u0t(n,e){var t=ai(n),i=Mr(n),s=t.visualViewport,r=i.clientWidth,o=i.clientHeight,a=0,l=0;if(s){r=s.width,o=s.height;var d=IO();(d||!d&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:r,height:o,x:a+BE(n),y:l}}function p0t(n){var e,t=Mr(n),i=FE(n),s=(e=n.ownerDocument)==null?void 0:e.body,r=ao(t.scrollWidth,t.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=ao(t.scrollHeight,t.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-i.scrollLeft+BE(n),l=-i.scrollTop;return zs(s||t).direction==="rtl"&&(a+=ao(t.clientWidth,s?s.clientWidth:0)-r),{width:r,height:o,x:a,y:l}}function GE(n){var e=zs(n),t=e.overflow,i=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+s+i)}function PO(n){return["html","body","#document"].indexOf(ds(n))>=0?n.ownerDocument.body:xi(n)&&GE(n)?n:PO(dp(n))}function Pl(n,e){var t;e===void 0&&(e=[]);var i=PO(n),s=i===((t=n.ownerDocument)==null?void 0:t.body),r=ai(i),o=s?[r].concat(r.visualViewport||[],GE(i)?i:[]):i,a=e.concat(o);return s?a:a.concat(Pl(dp(o)))}function sb(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function _0t(n,e){var t=Sa(n,!1,e==="fixed");return t.top=t.top+n.clientTop,t.left=t.left+n.clientLeft,t.bottom=t.top+n.clientHeight,t.right=t.left+n.clientWidth,t.width=n.clientWidth,t.height=n.clientHeight,t.x=t.left,t.y=t.top,t}function UC(n,e,t){return e===NO?sb(u0t(n,t)):mo(e)?_0t(e,t):sb(p0t(Mr(n)))}function h0t(n){var e=Pl(dp(n)),t=["absolute","fixed"].indexOf(zs(n).position)>=0,i=t&&xi(n)?Tc(n):n;return mo(i)?e.filter(function(s){return mo(s)&&MO(s,i)&&ds(s)!=="body"}):[]}function f0t(n,e,t,i){var s=e==="clippingParents"?h0t(n):[].concat(e),r=[].concat(s,[t]),o=r[0],a=r.reduce(function(l,d){var c=UC(n,d,i);return l.top=ao(c.top,l.top),l.right=du(c.right,l.right),l.bottom=du(c.bottom,l.bottom),l.left=ao(c.left,l.left),l},UC(n,o,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function UO(n){var e=n.reference,t=n.element,i=n.placement,s=i?os(i):null,r=i?Ta(i):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(s){case Qn:l={x:o,y:e.y-t.height};break;case Ai:l={x:o,y:e.y+e.height};break;case wi:l={x:e.x+e.width,y:a};break;case Xn:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var d=s?UE(s):null;if(d!=null){var c=d==="y"?"height":"width";switch(r){case va:l[d]=l[d]-(e[c]/2-t[c]/2);break;case sc:l[d]=l[d]+(e[c]/2-t[c]/2);break}}return l}function rc(n,e){e===void 0&&(e={});var t=e,i=t.placement,s=i===void 0?n.placement:i,r=t.strategy,o=r===void 0?n.strategy:r,a=t.boundary,l=a===void 0?LSt:a,d=t.rootBoundary,c=d===void 0?NO:d,_=t.elementContext,f=_===void 0?fl:_,m=t.altBoundary,h=m===void 0?!1:m,E=t.padding,b=E===void 0?0:E,g=kO(typeof b!="number"?b:LO(b,Sc)),v=f===fl?PSt:fl,y=n.rects.popper,T=n.elements[h?v:f],C=f0t(mo(T)?T:T.contextElement||Mr(n.elements.popper),l,c,o),x=Sa(n.elements.reference),O=UO({reference:x,element:y,strategy:"absolute",placement:s}),R=sb(Object.assign({},y,O)),S=f===fl?R:x,A={top:C.top-S.top+g.top,bottom:S.bottom-C.bottom+g.bottom,left:C.left-S.left+g.left,right:S.right-C.right+g.right},U=n.modifiersData.offset;if(f===fl&&U){var F=U[s];Object.keys(A).forEach(function(K){var L=[wi,Ai].indexOf(K)>=0?1:-1,H=[Qn,Ai].indexOf(K)>=0?"y":"x";A[K]+=F[H]*L})}return A}function m0t(n,e){e===void 0&&(e={});var t=e,i=t.placement,s=t.boundary,r=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,d=l===void 0?OO:l,c=Ta(i),_=c?a?DC:DC.filter(function(h){return Ta(h)===c}):Sc,f=_.filter(function(h){return d.indexOf(h)>=0});f.length===0&&(f=_);var m=f.reduce(function(h,E){return h[E]=rc(n,{placement:E,boundary:s,rootBoundary:r,padding:o})[os(E)],h},{});return Object.keys(m).sort(function(h,E){return m[h]-m[E]})}function g0t(n){if(os(n)===kE)return[];var e=zd(n);return[PC(n),e,PC(e)]}function b0t(n){var e=n.state,t=n.options,i=n.name;if(!e.modifiersData[i]._skip){for(var s=t.mainAxis,r=s===void 0?!0:s,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,d=t.padding,c=t.boundary,_=t.rootBoundary,f=t.altBoundary,m=t.flipVariations,h=m===void 0?!0:m,E=t.allowedAutoPlacements,b=e.options.placement,g=os(b),v=g===b,y=l||(v||!h?[zd(b)]:g0t(b)),T=[b].concat(y).reduce(function(me,ve){return me.concat(os(ve)===kE?m0t(e,{placement:ve,boundary:c,rootBoundary:_,padding:d,flipVariations:h,allowedAutoPlacements:E}):ve)},[]),C=e.rects.reference,x=e.rects.popper,O=new Map,R=!0,S=T[0],A=0;A=0,H=L?"width":"height",G=rc(e,{placement:U,boundary:c,rootBoundary:_,altBoundary:f,padding:d}),P=L?K?wi:Xn:K?Ai:Qn;C[H]>x[H]&&(P=zd(P));var j=zd(P),Y=[];if(r&&Y.push(G[F]<=0),a&&Y.push(G[P]<=0,G[j]<=0),Y.every(function(me){return me})){S=U,R=!1;break}O.set(U,Y)}if(R)for(var Q=h?3:1,ae=function(ve){var Ae=T.find(function(J){var ge=O.get(J);if(ge)return ge.slice(0,ve).every(function(ee){return ee})});if(Ae)return S=Ae,"break"},te=Q;te>0;te--){var Z=ae(te);if(Z==="break")break}e.placement!==S&&(e.modifiersData[i]._skip=!0,e.placement=S,e.reset=!0)}}const E0t={name:"flip",enabled:!0,phase:"main",fn:b0t,requiresIfExists:["offset"],data:{_skip:!1}};function FC(n,e,t){return t===void 0&&(t={x:0,y:0}),{top:n.top-e.height-t.y,right:n.right-e.width+t.x,bottom:n.bottom-e.height+t.y,left:n.left-e.width-t.x}}function BC(n){return[Qn,wi,Ai,Xn].some(function(e){return n[e]>=0})}function v0t(n){var e=n.state,t=n.name,i=e.rects.reference,s=e.rects.popper,r=e.modifiersData.preventOverflow,o=rc(e,{elementContext:"reference"}),a=rc(e,{altBoundary:!0}),l=FC(o,i),d=FC(a,s,r),c=BC(l),_=BC(d);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:d,isReferenceHidden:c,hasPopperEscaped:_},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":_})}const y0t={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:v0t};function S0t(n,e,t){var i=os(n),s=[Xn,Qn].indexOf(i)>=0?-1:1,r=typeof t=="function"?t(Object.assign({},e,{placement:n})):t,o=r[0],a=r[1];return o=o||0,a=(a||0)*s,[Xn,wi].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function T0t(n){var e=n.state,t=n.options,i=n.name,s=t.offset,r=s===void 0?[0,0]:s,o=OO.reduce(function(c,_){return c[_]=S0t(_,e.rects,r),c},{}),a=o[e.placement],l=a.x,d=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=d),e.modifiersData[i]=o}const x0t={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:T0t};function C0t(n){var e=n.state,t=n.name;e.modifiersData[t]=UO({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const R0t={name:"popperOffsets",enabled:!0,phase:"read",fn:C0t,data:{}};function A0t(n){return n==="x"?"y":"x"}function w0t(n){var e=n.state,t=n.options,i=n.name,s=t.mainAxis,r=s===void 0?!0:s,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,d=t.rootBoundary,c=t.altBoundary,_=t.padding,f=t.tether,m=f===void 0?!0:f,h=t.tetherOffset,E=h===void 0?0:h,b=rc(e,{boundary:l,rootBoundary:d,padding:_,altBoundary:c}),g=os(e.placement),v=Ta(e.placement),y=!v,T=UE(g),C=A0t(T),x=e.modifiersData.popperOffsets,O=e.rects.reference,R=e.rects.popper,S=typeof E=="function"?E(Object.assign({},e.rects,{placement:e.placement})):E,A=typeof S=="number"?{mainAxis:S,altAxis:S}:Object.assign({mainAxis:0,altAxis:0},S),U=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,F={x:0,y:0};if(x){if(r){var K,L=T==="y"?Qn:Xn,H=T==="y"?Ai:wi,G=T==="y"?"height":"width",P=x[T],j=P+b[L],Y=P-b[H],Q=m?-R[G]/2:0,ae=v===va?O[G]:R[G],te=v===va?-R[G]:-O[G],Z=e.elements.arrow,me=m&&Z?PE(Z):{width:0,height:0},ve=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:DO(),Ae=ve[L],J=ve[H],ge=Ll(0,O[G],me[G]),ee=y?O[G]/2-Q-ge-Ae-A.mainAxis:ae-ge-Ae-A.mainAxis,Se=y?-O[G]/2+Q+ge+J+A.mainAxis:te+ge+J+A.mainAxis,Ie=e.elements.arrow&&Tc(e.elements.arrow),k=Ie?T==="y"?Ie.clientTop||0:Ie.clientLeft||0:0,B=(K=U==null?void 0:U[T])!=null?K:0,$=P+ee-B-k,de=P+Se-B,ie=Ll(m?du(j,$):j,P,m?ao(Y,de):Y);x[T]=ie,F[T]=ie-P}if(a){var Ce,we=T==="x"?Qn:Xn,V=T==="x"?Ai:wi,_e=x[C],se=C==="y"?"height":"width",ce=_e+b[we],D=_e-b[V],I=[Qn,Xn].indexOf(g)!==-1,z=(Ce=U==null?void 0:U[C])!=null?Ce:0,he=I?ce:_e-O[se]-R[se]-z+A.altAxis,X=I?_e+O[se]+R[se]-z-A.altAxis:D,re=m&&I?ZSt(he,_e,X):Ll(m?he:ce,_e,m?X:D);x[C]=re,F[C]=re-_e}e.modifiersData[i]=F}}const N0t={name:"preventOverflow",enabled:!0,phase:"main",fn:w0t,requiresIfExists:["offset"]};function O0t(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function I0t(n){return n===ai(n)||!xi(n)?FE(n):O0t(n)}function M0t(n){var e=n.getBoundingClientRect(),t=ya(e.width)/n.offsetWidth||1,i=ya(e.height)/n.offsetHeight||1;return t!==1||i!==1}function D0t(n,e,t){t===void 0&&(t=!1);var i=xi(e),s=xi(e)&&M0t(e),r=Mr(e),o=Sa(n,s,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(i||!i&&!t)&&((ds(e)!=="body"||GE(r))&&(a=I0t(e)),xi(e)?(l=Sa(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):r&&(l.x=BE(r))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function k0t(n){var e=new Map,t=new Set,i=[];n.forEach(function(r){e.set(r.name,r)});function s(r){t.add(r.name);var o=[].concat(r.requires||[],r.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&s(l)}}),i.push(r)}return n.forEach(function(r){t.has(r.name)||s(r)}),i}function L0t(n){var e=k0t(n);return $St.reduce(function(t,i){return t.concat(e.filter(function(s){return s.phase===i}))},[])}function P0t(n){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(n())})})),e}}function U0t(n){var e=n.reduce(function(t,i){var s=t[i.name];return t[i.name]=s?Object.assign({},s,i,{options:Object.assign({},s.options,i.options),data:Object.assign({},s.data,i.data)}):i,t},{});return Object.keys(e).map(function(t){return e[t]})}var GC={placement:"bottom",modifiers:[],strategy:"absolute"};function zC(){for(var n=arguments.length,e=new Array(n),t=0;t(Nr("data-v-c27eaae6"),n=n(),Or(),n),z0t={key:0,class:"fixed top-0 left-0 w-screen h-screen flex items-center justify-center"},V0t={class:"flex flex-col text-center"},H0t={class:"flex flex-col text-center items-center"},q0t={class:"flex items-center gap-3 text-5xl drop-shadow-md align-middle pt-24"},Y0t=Vt(()=>u("img",{class:"w-24 animate-bounce",title:"LoLLMS WebUI",src:ga,alt:"Logo"},null,-1)),$0t={class:"flex flex-col items-start"},W0t={class:"text-2xl"},K0t=Vt(()=>u("p",{class:"text-gray-400 text-base"},"One tool to rule them all",-1)),j0t=Vt(()=>u("p",{class:"text-gray-400 text-base"},"by ParisNeo",-1)),Q0t=Vt(()=>u("hr",{class:"mt-1 w-96 h-1 mx-auto my-2 md:my-2 dark:bg-bg-dark-tone-panel bg-bg-light-tone-panel border-0 rounded"},null,-1)),X0t=Vt(()=>u("p",{class:"text-2xl mb-10"},"Welcome",-1)),Z0t={role:"status",class:"text-center w-full display: flex; flex-row align-items: center;"},J0t={class:"text-2xl animate-pulse mt-2"},eTt=Vt(()=>u("i",{"data-feather":"chevron-right"},null,-1)),tTt=[eTt],nTt=Vt(()=>u("i",{"data-feather":"chevron-left"},null,-1)),iTt=[nTt],sTt={key:0,class:"relative flex flex-col no-scrollbar shadow-lg min-w-[24rem] max-w-[24rem] bg-bg-light-tone dark:bg-bg-dark-tone"},rTt={class:"sticky z-10 top-0 bg-bg-light-tone dark:bg-bg-dark-tone shadow-md"},oTt={class:"flex-row p-4 flex items-center gap-3 flex-0"},aTt=Vt(()=>u("i",{"data-feather":"plus"},null,-1)),lTt=[aTt],cTt=Vt(()=>u("i",{"data-feather":"check-square"},null,-1)),dTt=[cTt],uTt=Vt(()=>u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Reset database, remove all discussions"},[u("i",{"data-feather":"refresh-ccw"})],-1)),pTt=Vt(()=>u("i",{"data-feather":"database"},null,-1)),_Tt=[pTt],hTt=Vt(()=>u("i",{"data-feather":"log-in"},null,-1)),fTt=[hTt],mTt={key:0,class:"dropdown"},gTt=Vt(()=>u("i",{"data-feather":"search"},null,-1)),bTt=[gTt],ETt=Vt(()=>u("i",{"data-feather":"save"},null,-1)),vTt=[ETt],yTt={key:2,class:"flex gap-3 flex-1 items-center duration-75"},STt=Vt(()=>u("i",{"data-feather":"x"},null,-1)),TTt=[STt],xTt=Vt(()=>u("i",{"data-feather":"check"},null,-1)),CTt=[xTt],RTt=["src"],ATt=["src"],wTt=["src"],NTt=["src"],OTt={key:7,title:"Loading..",class:"flex flex-row flex-grow justify-end"},ITt=Vt(()=>u("div",{role:"status"},[u("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),u("span",{class:"sr-only"},"Loading...")],-1)),MTt=[ITt],DTt={key:0,class:"flex-row items-center gap-3 flex-0 w-full"},kTt={class:"p-4 pt-2"},LTt={class:"relative"},PTt=Vt(()=>u("div",{class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},[u("div",{class:"scale-75"},[u("i",{"data-feather":"search"})])],-1)),UTt={class:"absolute inset-y-0 right-0 flex items-center pr-3"},FTt=Vt(()=>u("i",{"data-feather":"x"},null,-1)),BTt=[FTt],GTt={key:1,class:"h-px bg-bg-light p-0 mb-4 px-4 mx-4 border-0 dark:bg-bg-dark"},zTt={key:2,class:"flex flex-row flex-grow p-4 pt-0 items-center"},VTt={class:"flex flex-row flex-grow"},HTt={key:0},qTt={class:"flex flex-row"},YTt={key:0,class:"flex gap-3"},$Tt=Vt(()=>u("i",{"data-feather":"trash"},null,-1)),WTt=[$Tt],KTt={key:1,class:"flex gap-3 mx-3 flex-1 items-center justify-end group-hover:visible duration-75"},jTt=Vt(()=>u("i",{"data-feather":"check"},null,-1)),QTt=[jTt],XTt=Vt(()=>u("i",{"data-feather":"x"},null,-1)),ZTt=[XTt],JTt={class:"flex gap-3"},ext=Vt(()=>u("i",{"data-feather":"log-out"},null,-1)),txt=[ext],nxt=Vt(()=>u("i",{"data-feather":"bookmark"},null,-1)),ixt=[nxt],sxt=Vt(()=>u("i",{"data-feather":"list"},null,-1)),rxt=[sxt],oxt={class:"relative flex flex-row flex-grow mb-10 z-0 w-full"},axt={key:1,class:"gap-2 py-2 my-2 hover:shadow-md hover:bg-primary-light dark:hover:bg-primary rounded-md p-2 duration-75 group cursor-pointer"},lxt=Vt(()=>u("p",{class:"px-3"},"No discussions are found",-1)),cxt=[lxt],dxt=Vt(()=>u("div",{class:"sticky bottom-0 bg-gradient-to-t pointer-events-none from-bg-light-tone dark:from-bg-dark-tone flex flex-grow"},null,-1)),uxt={class:"ml-2"},pxt={key:1,class:"relative flex flex-col flex-grow w-full"},_xt={class:"container pt-4 pb-50 mb-50 w-full"},hxt=Vt(()=>u("div",null,[u("br"),u("br"),u("br"),u("br"),u("br"),u("br"),u("br")],-1)),fxt=Vt(()=>u("div",{class:"absolute w-full bottom-0 bg-transparent p-10 pt-16 bg-gradient-to-t from-bg-light dark:from-bg-dark from-5% via-bg-light dark:via-bg-dark via-10% to-transparent to-100%"},null,-1)),mxt={key:0,class:"bottom-0 flex flex-row items-center justify-center"},gxt={role:"status",class:"fixed m-0 p-2 left-2 bottom-2 min-w-[24rem] max-w-[24rem] h-20 flex flex-col justify-center items-center pb-4 bg-blue-500 rounded-lg shadow-lg z-50 background-a"},bxt={class:"text-2xl animate-pulse mt-2 text-white"},Ext={setup(){},data(){return{memory_icon:YO,active_skills:$O,inactive_skills:WO,skillsRegistry:KO,posts_headers:{accept:"application/json","Content-Type":"application/json"},host:"",progress_visibility_val:!0,progress_value:0,msgTypes:{MSG_TYPE_CHUNK:0,MSG_TYPE_FULL:1,MSG_TYPE_FULL_INVISIBLE_TO_AI:2,MSG_TYPE_FULL_INVISIBLE_TO_USER:3,MSG_TYPE_EXCEPTION:4,MSG_TYPE_WARNING:5,MSG_TYPE_INFO:6,MSG_TYPE_STEP:7,MSG_TYPE_STEP_START:8,MSG_TYPE_STEP_PROGRESS:9,MSG_TYPE_STEP_END:10,MSG_TYPE_JSON_INFOS:11,MSG_TYPE_REF:12,MSG_TYPE_CODE:13,MSG_TYPE_UI:14,MSG_TYPE_NEW_MESSAGE:15,MSG_TYPE_FINISHED_MESSAGE:17},senderTypes:{SENDER_TYPES_USER:0,SENDER_TYPES_AI:1,SENDER_TYPES_SYSTEM:2},list:[],tempList:[],currentDiscussion:{},discussionArr:[],loading:!1,filterTitle:"",filterInProgress:!1,isCreated:!1,isCheckbox:!1,isSelectAll:!1,showSaveConfirmation:!1,showBrainConfirmation:!1,showConfirmation:!1,chime:new Audio("chime_aud.wav"),showToast:!1,isSearch:!1,isDiscussionBottom:!1,personalityAvatars:[],fileList:[],database_selectorDialogVisible:!1,isDragOverDiscussion:!1,isDragOverChat:!1,panelCollapsed:!1,isOpen:!1,discussion_id:0}},methods:{add_webpage(){console.log("addWebLink received"),this.$refs.web_url_input_box.showPanel()},addWebpage(){Me.post("/add_webpage",{client_id:this.client_id,url:this.$refs.web_url_input_box.inputText},{headers:this.posts_headers}).then(n=>{n&&n.status&&(console.log("Done"),this.recoverFiles())})},show_progress(n){this.progress_visibility_val=!0},hide_progress(n){this.progress_visibility_val=!1},update_progress(n){console.log("Progress update"),this.progress_value=n.value},onSettingsBinding(){try{this.isLoading=!0,Me.get("/get_active_binding_settings").then(n=>{this.isLoading=!1,n&&(n.data&&Object.keys(n.data).length>0?this.$store.state.universalForm.showForm(n.data,"Binding settings - "+bindingEntry.binding.name,"Save changes","Cancel").then(e=>{try{Me.post("/set_active_binding_settings",e).then(t=>{t&&t.data?(console.log("binding set with new settings",t.data),this.$store.state.toast.showToast("Binding settings updated successfully!",4,!0)):(this.$store.state.toast.showToast(`Did not get binding settings responses. `+t,4,!1),this.isLoading=!1)})}catch(t){this.$store.state.toast.showToast(`Did not get binding settings responses. Endpoint error: `+t.message,4,!1),this.isLoading=!1}}):(this.$store.state.toast.showToast("Binding has no settings",4,!1),this.isLoading=!1))})}catch(n){this.isLoading=!1,this.$store.state.toast.showToast("Could not open binding settings. Endpoint error: "+n.message,4,!1)}},showDatabaseSelector(){this.database_selectorDialogVisible=!0},async ondatabase_selectorDialogSelected(n){console.log("Selected:",n)},onclosedatabase_selectorDialog(){this.database_selectorDialogVisible=!1},async onvalidatedatabase_selectorChoice(n){if(this.database_selectorDialogVisible=!1,(await Me.post("/select_database",{client_id:this.client_id,name:n},{headers:this.posts_headers})).status){console.log("Selected database"),this.$store.state.config=await Me.get("/get_config"),console.log("new config loaded :",this.$store.state.config);let t=await Me.get("/list_databases").data;console.log("New list of database: ",t),this.$store.state.databases=t,console.log("New list of database: ",this.$store.state.databases),location.reload()}},async addDiscussion2SkillsLibrary(){(await Me.post("/add_discussion_to_skills_library",{client_id:this.client_id},{headers:this.posts_headers})).status&&console.log("done")},async toggleSkillsLib(){this.$store.state.config.activate_skills_lib=!this.$store.state.config.activate_skills_lib,await this.applyConfiguration()},async showSkillsLib(){this.$refs.skills_lib.showSkillsLibrary()},async applyConfiguration(){this.loading=!0;const n=await Me.post("/apply_settings",{config:this.$store.state.config});this.loading=!1,n.data.status?this.$store.state.toast.showToast("Configuration changed successfully.",4,!0):this.$store.state.toast.showToast("Configuration change failed.",4,!1),Ve(()=>{qe.replace()})},save_configuration(){this.showConfirmation=!1,Me.post("/save_settings",{}).then(n=>{if(n)return n.status?this.$store.state.toast.showToast("Settings saved!",4,!0):this.$store.state.messageBox.showMessage("Error: Couldn't save settings!"),n.data}).catch(n=>(console.log(n.message,"save_configuration"),this.$store.state.messageBox.showMessage("Couldn't save settings!"),{status:!1}))},showToastMessage(n,e,t){console.log("sending",n),this.$store.state.toast.showToast(n,e,t)},togglePanel(){this.panelCollapsed=!this.panelCollapsed},toggleDropdown(){this.isOpen=!this.isOpen},importChatGPT(){},async api_get_req(n){try{const e=await Me.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req");return}},async list_discussions(){try{const n=await Me.get("/list_discussions");if(n)return this.createDiscussionList(n.data),n.data}catch(n){return console.log("Error: Could not list discussions",n.message),[]}},load_discussion(n,e){n&&(console.log("Loading discussion",n),this.loading=!0,this.discussionArr=[],this.setDiscussionLoading(n,this.loading),Ze.on("discussion",t=>{console.log("Discussion recovered"),this.loading=!1,this.setDiscussionLoading(n,this.loading),t&&(this.discussionArr=t.filter(i=>i.message_type==this.msgTypes.MSG_TYPE_CHUNK||i.message_type==this.msgTypes.MSG_TYPE_FULL||i.message_type==this.msgTypes.MSG_TYPE_FULL_INVISIBLE_TO_AI||i.message_type==this.msgTypes.MSG_TYPE_CODE||i.message_type==this.msgTypes.MSG_TYPE_JSON_INFOS||i.message_type==this.msgTypes.MSG_TYPE_UI),console.log("this.discussionArr"),console.log(this.discussionArr),e&&e()),Ze.off("discussion")}),Ze.emit("load_discussion",{id:n}),console.log("here"))},recoverFiles(){console.log("Recovering files"),Me.get("/get_current_personality_files_list").then(n=>{this.$refs.chatBox.filesList=n.data.files,this.$refs.chatBox.isFileSentList=n.data.files.map(e=>!0),console.log(`Files recovered: ${this.$refs.chatBox.filesList}`)})},new_discussion(n){try{this.loading=!0,Ze.on("discussion_created",e=>{Ze.off("discussion_created"),this.list_discussions().then(()=>{const t=this.list.findIndex(s=>s.id==e.id),i=this.list[t];this.selectDiscussion(i),this.load_discussion(e.id,()=>{this.loading=!1,this.recoverFiles(),Ve(()=>{const s=document.getElementById("dis-"+e.id);this.scrollToElement(s),console.log("Scrolling tp "+s)})})})}),console.log("new_discussion ",n),Ze.emit("new_discussion",{title:n})}catch(e){return console.log("Error: Could not create new discussion",e.message),{}}},async delete_discussion(n){try{n&&(this.loading=!0,this.setDiscussionLoading(n,this.loading),await Me.post("/delete_discussion",{client_id:this.client_id,id:n},{headers:this.posts_headers}),this.loading=!1,this.setDiscussionLoading(n,this.loading))}catch(e){console.log("Error: Could not delete discussion",e.message),this.loading=!1,this.setDiscussionLoading(n,this.loading)}},async edit_title(n,e){try{if(n){this.loading=!0,this.setDiscussionLoading(n,this.loading);const t=await Me.post("/edit_title",{client_id:this.client_id,id:n,title:e},{headers:this.posts_headers});if(this.loading=!1,this.setDiscussionLoading(n,this.loading),t.status==200){const i=this.list.findIndex(r=>r.id==n),s=this.list[i];s.title=e,this.tempList=this.list}}}catch(t){console.log("Error: Could not edit title",t.message),this.loading=!1,this.setDiscussionLoading(n,this.loading)}},async make_title(n){try{if(n){this.loading=!0,this.setDiscussionLoading(n,this.loading);const e=await Me.post("/make_title",{client_id:this.client_id,id:n},{headers:this.posts_headers});if(console.log("Making title:",e),this.loading=!1,this.setDiscussionLoading(n,this.loading),e.status==200){const t=this.list.findIndex(s=>s.id==n),i=this.list[t];i.title=e.data.title,this.tempList=this.list}}}catch(e){console.log("Error: Could not edit title",e.message),this.loading=!1,this.setDiscussionLoading(n,this.loading)}},async delete_message(n){try{console.log(typeof n),console.log(typeof this.client_id),console.log(n),console.log(this.client_id);const e=await Me.post("/delete_message",{client_id:this.client_id,id:n},{headers:this.posts_headers});if(e)return e.data}catch(e){return console.log("Error: Could delete message",e.message),{}}},async stop_gen(){try{if(this.discussionArr.length>0){const n=this.discussionArr[this.discussionArr.length-1];n.status_message="Generation canceled"}if(Ze.emit("cancel_generation"),res)return res.data}catch(n){return console.log("Error: Could not stop generating",n.message),{}}},async message_rank_up(n){try{const e=await Me.post("/message_rank_up",{client_id:this.client_id,id:n},{headers:this.posts_headers});if(e)return e.data}catch(e){return console.log("Error: Could not rank up message",e.message),{}}},async message_rank_down(n){try{const e=await Me.post("/message_rank_down",{client_id:this.client_id,id:n},{headers:this.posts_headers});if(e)return e.data}catch(e){return console.log("Error: Could not rank down message",e.message),{}}},async edit_message(n,e,t){try{console.log(typeof this.client_id),console.log(typeof n),console.log(typeof e),console.log(typeof{audio_url:t});const i=await Me.post("/edit_message",{client_id:this.client_id,id:n,message:e,metadata:[{audio_url:t}]},{headers:this.posts_headers});if(i)return i.data}catch(i){return console.log("Error: Could not update message",i.message),{}}},async export_multiple_discussions(n,e){try{if(n.length>0){const t=await Me.post("/export_multiple_discussions",{client_id:this.$store.state.client_id,discussion_ids:n,export_format:e},{headers:this.posts_headers});if(t)return t.data}}catch(t){return console.log("Error: Could not export multiple discussions",t.message),{}}},async import_multiple_discussions(n){try{if(n.length>0){console.log("sending import",n);const e=await Me.post("/import_multiple_discussions",{client_id:this.$store.state.client_id,jArray:n},{headers:this.posts_headers});if(e)return console.log("import response",e.data),e.data}}catch(e){console.log("Error: Could not import multiple discussions",e.message);return}},filterDiscussions(){this.filterInProgress||(this.filterInProgress=!0,setTimeout(()=>{this.filterTitle?this.list=this.tempList.filter(n=>n.title&&n.title.includes(this.filterTitle)):this.list=this.tempList,this.filterInProgress=!1},100))},async selectDiscussion(n){if(this.isGenerating){this.$store.state.toast.showToast("You are currently generating a text. Please wait for text generation to finish or stop it before trying to select another discussion",4,!1);return}n&&(this.currentDiscussion===void 0?(this.currentDiscussion=n,this.setPageTitle(n),localStorage.setItem("selected_discussion",this.currentDiscussion.id),this.load_discussion(n.id,()=>{this.discussionArr.length>1&&(this.currentDiscussion.title===""||this.currentDiscussion.title===null)&&this.changeTitleUsingUserMSG(this.currentDiscussion.id,this.discussionArr[1].content)})):this.currentDiscussion.id!=n.id&&(console.log("item",n),console.log("this.currentDiscussion",this.currentDiscussion),this.currentDiscussion=n,console.log("this.currentDiscussion",this.currentDiscussion),this.setPageTitle(n),localStorage.setItem("selected_discussion",this.currentDiscussion.id),this.load_discussion(n.id,()=>{this.discussionArr.length>1&&(this.currentDiscussion.title===""||this.currentDiscussion.title===null)&&this.changeTitleUsingUserMSG(this.currentDiscussion.id,this.discussionArr[1].content)})),Ve(()=>{const e=document.getElementById("dis-"+this.currentDiscussion.id);this.scrollToElementInContainer(e,"leftPanel");const t=document.getElementById("messages-list");this.scrollBottom(t)}))},scrollToElement(n){n?n.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"}):console.log("Error: scrollToElement")},scrollToElementInContainer(n,e){try{const t=n.offsetTop;document.getElementById(e).scrollTo({top:t,behavior:"smooth"})}catch{console.log("error")}},scrollBottom(n){n?n.scrollTo({top:n.scrollHeight,behavior:"smooth"}):console.log("Error: scrollBottom")},scrollTop(n){n?n.scrollTo({top:0,behavior:"smooth"}):console.log("Error: scrollTop")},createUserMsg(n){let e={content:n.message,id:n.id,rank:0,sender:n.user,created_at:n.created_at,steps:[],html_js_s:[],status_message:"Warming up"};this.discussionArr.push(e),Ve(()=>{const t=document.getElementById("messages-list");this.scrollBottom(t)})},updateLastUserMsg(n){const e=this.discussionArr.indexOf(i=>i.id=n.user_id),t={binding:n.binding,content:n.message,created_at:n.created_at,type:n.type,finished_generating_at:n.finished_generating_at,id:n.user_id,model:n.model,personality:n.personality,sender:n.user,steps:[]};e!==-1&&(this.discussionArr[e]=t)},socketIOConnected(){return console.log("socketIOConnected"),this.$store.state.isConnected=!0,this.$store.state.client_id=Ze.id,!0},socketIODisconnected(){return console.log("socketIOConnected"),this.currentDiscussion=null,this.$store.dispatch("refreshModels"),this.$store.state.isConnected=!1,!0},new_message(n){n.sender_type==this.SENDER_TYPES_AI&&(this.isGenerating=!0),console.log("Making a new message"),console.log("New message",n);let e={sender:n.sender,message_type:n.message_type,sender_type:n.sender_type,content:n.content,id:n.id,discussion_id:n.discussion_id,parent_id:n.parent_id,binding:n.binding,model:n.model,personality:n.personality,created_at:n.created_at,finished_generating_at:n.finished_generating_at,rank:0,ui:n.ui,steps:[],parameters:n.parameters,metadata:n.metadata,open:n.open};e.status_message="Warming up",console.log(e),this.discussionArr.push(e),(this.currentDiscussion.title===""||this.currentDiscussion.title===null)&&this.changeTitleUsingUserMSG(this.currentDiscussion.id,n.message),console.log("infos",n)},talk(n){this.isGenerating=!0,this.setDiscussionLoading(this.currentDiscussion.id,this.isGenerating),Me.get("/get_generation_status",{}).then(e=>{e&&(e.data.status?console.log("Already generating"):(console.log("Generating message from ",e.data.status),Ze.emit("generate_msg_from",{id:-1}),this.discussionArr.length>0&&Number(this.discussionArr[this.discussionArr.length-1].id)+1))}).catch(e=>{console.log("Error: Could not get generation status",e)})},createEmptyUserMessage(n){Ze.emit("create_empty_message",{type:0,message:n})},createEmptyAIMessage(){Ze.emit("create_empty_message",{type:1})},sendMsg(n,e){if(!n){this.$store.state.toast.showToast("Message contains no content!",4,!1);return}this.isGenerating=!0,this.setDiscussionLoading(this.currentDiscussion.id,this.isGenerating),Me.get("/get_generation_status",{}).then(t=>{if(t)if(t.data.status)console.log("Already generating");else{e=="internet"?Ze.emit("generate_msg_with_internet",{prompt:n}):Ze.emit("generate_msg",{prompt:n});let i=0;this.discussionArr.length>0&&(i=Number(this.discussionArr[this.discussionArr.length-1].id)+1);let s={message:n,id:i,rank:0,user:this.$store.state.config.user_name,created_at:new Date().toLocaleString(),sender:this.$store.state.config.user_name,message_type:this.msgTypes.MSG_TYPE_FULL,sender_type:this.senderTypes.SENDER_TYPES_USER,content:n,id:i,discussion_id:this.discussion_id,parent_id:i,binding:"",model:"",personality:"",created_at:new Date().toLocaleString(),finished_generating_at:new Date().toLocaleString(),rank:0,steps:[],parameters:null,metadata:[],ui:null};this.createUserMsg(s)}}).catch(t=>{console.log("Error: Could not get generation status",t)})},sendCmd(n){this.isGenerating=!0,Ze.emit("execute_command",{command:n,parameters:[]})},notify(n){self.isGenerating=!1,this.setDiscussionLoading(this.currentDiscussion.id,this.isGenerating),Ve(()=>{const e=document.getElementById("messages-list");this.scrollBottom(e)}),n.display_type==0?this.$store.state.toast.showToast(n.content,n.duration,n.notification_type):n.display_type==1?this.$store.state.messageBox.showMessage(n.content):n.display_type==2?(this.$store.state.messageBox.hideMessage(),this.$store.state.yesNoDialog.askQuestion(n.content,"Yes","No").then(e=>{Ze.emit("yesNoRes",{yesRes:e})})):n.display_type==3?this.$store.state.messageBox.showBlockingMessage(n.content):n.display_type==4&&this.$store.state.messageBox.hideMessage(),this.chime.play()},streamMessageContent(n){if(this.discussion_id=n.discussion_id,this.setDiscussionLoading(this.discussion_id,!0),this.currentDiscussion.id==this.discussion_id){const e=this.discussionArr.findIndex(i=>i.id==n.id),t=this.discussionArr[e];if(t&&(n.message_type==this.msgTypes.MSG_TYPE_FULL||n.message_type==this.msgTypes.MSG_TYPE_FULL_INVISIBLE_TO_AI))this.isGenerating=!0,t.content=n.content,t.created_at=n.created_at,t.started_generating_at=n.started_generating_at,t.nb_tokens=n.nb_tokens,t.finished_generating_at=n.finished_generating_at;else if(t&&n.message_type==this.msgTypes.MSG_TYPE_CHUNK)this.isGenerating=!0,t.content+=n.content,t.created_at=n.created_at,t.started_generating_at=n.started_generating_at,t.nb_tokens=n.nb_tokens,t.finished_generating_at=n.finished_generating_at;else if(n.message_type==this.msgTypes.MSG_TYPE_STEP)t.status_message=n.content,t.steps.push({message:n.content,done:!0,status:!0,type:"instantanious"});else if(n.message_type==this.msgTypes.MSG_TYPE_STEP_START)t.status_message=n.content,t.steps.push({message:n.content,done:!1,status:!0,type:"start_end"});else if(n.message_type==this.msgTypes.MSG_TYPE_STEP_END){console.log("received step end",n);try{const i=t.steps.find(s=>s.message===n.content);if(i){i.done=!0;try{console.log(n.parameters);const s=n.parameters;s!=null&&(i.status=s.status,console.log(s))}catch(s){console.error("Error parsing JSON:",s.message)}}}catch{console.log("error")}}else n.message_type==this.msgTypes.MSG_TYPE_JSON_INFOS?(console.log("JSON message"),console.log(n.metadata),t.metadata=n.metadata):n.message_type==this.msgTypes.MSG_TYPE_UI?(console.log("UI message"),t.ui=n.ui,console.log(t.ui)):n.message_type==this.msgTypes.MSG_TYPE_EXCEPTION&&this.$store.state.toast.showToast(n.content,5,!1)}this.$nextTick(()=>{qe.replace()})},async changeTitleUsingUserMSG(n,e){const t=this.list.findIndex(s=>s.id==n),i=this.list[t];e&&(i.title=e,this.tempList=this.list,await this.edit_title(n,e))},async createNewDiscussion(){this.new_discussion(null)},loadLastUsedDiscussion(){console.log("Loading last discussion");const n=localStorage.getItem("selected_discussion");if(console.log("Last discussion id: ",n),n){const e=this.list.findIndex(i=>i.id==n),t=this.list[e];t&&this.selectDiscussion(t)}},onCopyPersonalityName(n){this.$store.state.toast.showToast("Copied name to clipboard!",4,!0),navigator.clipboard.writeText(n.name)},async deleteDiscussion(n){await this.delete_discussion(n),this.currentDiscussion.id==n&&(this.currentDiscussion={},this.discussionArr=[],this.setPageTitle()),this.list.splice(this.list.findIndex(e=>e.id==n),1),this.createDiscussionList(this.list)},async deleteDiscussionMulti(){const n=this.selectedDiscussions;for(let e=0;ei.id==t.id),1)}this.tempList=this.list,this.isCheckbox=!1,this.$store.state.toast.showToast("Removed ("+n.length+") items",4,!0),this.showConfirmation=!1,console.log("Multi delete done")},async deleteMessage(n){await this.delete_message(n).then(()=>{this.discussionArr.splice(this.discussionArr.findIndex(e=>e.id==n),1)}).catch(()=>{this.$store.state.toast.showToast("Could not remove message",4,!1),console.log("Error: Could not delete message")})},async editTitle(n){const e=this.list.findIndex(i=>i.id==n.id),t=this.list[e];t.title=n.title,t.loading=!0,await this.edit_title(n.id,n.title),t.loading=!1},async makeTitle(n){this.list.findIndex(e=>e.id==n.id),await this.make_title(n.id)},checkUncheckDiscussion(n,e){const t=this.list.findIndex(s=>s.id==e),i=this.list[t];i.checkBoxValue=n.target.checked,this.tempList=this.list},selectAllDiscussions(){this.isSelectAll=!this.tempList.filter(n=>n.checkBoxValue==!1).length>0;for(let n=0;n({id:t.id,title:t.title,selected:!1,loading:!1,checkBoxValue:!1})).sort(function(t,i){return i.id-t.id});this.list=e,this.tempList=e}},setDiscussionLoading(n,e){try{const t=this.list.findIndex(s=>s.id==n),i=this.list[t];i.loading=e}catch{console.log("Error setting discussion loading")}},setPageTitle(n){if(n)if(n.id){const e=n.title?n.title==="untitled"?"New discussion":n.title:"New discussion";document.title="LoLLMS WebUI - "+e}else{const e=n||"Welcome";document.title="LoLLMS WebUI - "+e}else{const e=n||"Welcome";document.title="LoLLMS WebUI - "+e}},async rankUpMessage(n){await this.message_rank_up(n).then(e=>{const t=this.discussionArr[this.discussionArr.findIndex(i=>i.id==n)];t.rank=e.new_rank}).catch(()=>{this.$store.state.toast.showToast("Could not rank up message",4,!1),console.log("Error: Could not rank up message")})},async rankDownMessage(n){await this.message_rank_down(n).then(e=>{const t=this.discussionArr[this.discussionArr.findIndex(i=>i.id==n)];t.rank=e.new_rank}).catch(()=>{this.$store.state.toast.showToast("Could not rank down message",4,!1),console.log("Error: Could not rank down message")})},async updateMessage(n,e,t){await this.edit_message(n,e,t).then(()=>{const i=this.discussionArr[this.discussionArr.findIndex(s=>s.id==n)];i.content=e}).catch(()=>{this.$store.state.toast.showToast("Could not update message",4,!1),console.log("Error: Could not update message")})},resendMessage(n,e,t){Ve(()=>{qe.replace()}),this.isGenerating=!0,this.setDiscussionLoading(this.currentDiscussion.id,this.isGenerating),Me.get("/get_generation_status",{}).then(i=>{i&&(i.data.status?(this.$store.state.toast.showToast("The server is busy. Wait",4,!1),console.log("Already generating")):Ze.emit("generate_msg_from",{prompt:e,id:n,msg_type:t}))}).catch(i=>{console.log("Error: Could not get generation status",i)})},continueMessage(n,e){Ve(()=>{qe.replace()}),this.isGenerating=!0,this.setDiscussionLoading(this.currentDiscussion.id,this.isGenerating),Me.get("/get_generation_status",{}).then(t=>{t&&(t.data.status?console.log("Already generating"):Ze.emit("continue_generate_msg_from",{prompt:e,id:n}))}).catch(t=>{console.log("Error: Could not get generation status",t)})},stopGenerating(){this.stop_gen(),this.isGenerating=!1,this.setDiscussionLoading(this.currentDiscussion.id,this.isGenerating),console.log("Stopped generating"),Ve(()=>{const n=document.getElementById("messages-list");this.scrollBottom(n)})},finalMsgEvent(n){if(console.log("final",n),this.discussion_id=n.discussion_id,this.currentDiscussion.id==this.discussion_id){const i=this.discussionArr.findIndex(s=>s.id==n.id);this.discussionArr[i].content=n.content,this.discussionArr[i].finished_generating_at=n.finished_generating_at}Ve(()=>{const i=document.getElementById("messages-list");this.scrollBottom(i)}),this.isGenerating=!1,this.setDiscussionLoading(this.currentDiscussion.id,this.isGenerating),this.chime.play();const e=this.discussionArr.findIndex(i=>i.id==n.id),t=this.discussionArr[e];t.status_message="Done"},copyToClipBoard(n){let e="";if(n.message.content&&(e=n.message.content),this.$store.state.config.copy_to_clipboard_add_all_details){let t="";n.message.binding&&(t=`Binding: ${n.message.binding}`);let i="";n.message.personality&&(i=` Personality: ${n.message.personality}`);let s="";n.created_at_parsed&&(s=` @@ -215,15 +215,15 @@ ${e} ${l}`;navigator.clipboard.writeText(d)}else navigator.clipboard.writeText(e);this.$store.state.toast.showToast("Copied to clipboard successfully",4,!0),Ve(()=>{qe.replace()})},closeToast(){this.showToast=!1},saveJSONtoFile(n,e){e=e||"data.json";const t=document.createElement("a");t.href=URL.createObjectURL(new Blob([JSON.stringify(n,null,2)],{type:"text/plain"})),t.setAttribute("download",e),document.body.appendChild(t),t.click(),document.body.removeChild(t)},saveMarkdowntoFile(n,e){e=e||"data.md";const t=document.createElement("a");t.href=URL.createObjectURL(new Blob([n],{type:"text/plain"})),t.setAttribute("download",e),document.body.appendChild(t),t.click(),document.body.removeChild(t)},parseJsonObj(n){try{return JSON.parse(n)}catch(e){return this.$store.state.toast.showToast(`Could not parse JSON. `+e.message,4,!1),null}},async parseJsonFile(n){return new Promise((e,t)=>{const i=new FileReader;i.onload=s=>e(this.parseJsonObj(s.target.result)),i.onerror=s=>t(s),i.readAsText(n)})},async exportDiscussionsAsMarkdown(){const n=this.list.filter(e=>e.checkBoxValue==!0).map(e=>e.id);if(n.length>0){console.log("export",n);let e=new Date;const t=e.getFullYear(),i=(e.getMonth()+1).toString().padStart(2,"0"),s=e.getDate().toString().padStart(2,"0"),r=e.getHours().toString().padStart(2,"0"),o=e.getMinutes().toString().padStart(2,"0"),a=e.getSeconds().toString().padStart(2,"0"),d="discussions_export_"+(t+"."+i+"."+s+"."+r+o+a)+".md";this.loading=!0;const c=await this.export_multiple_discussions(n,"markdown");c?(this.saveMarkdowntoFile(c,d),this.$store.state.toast.showToast("Successfully exported",4,!0),this.isCheckbox=!1):this.$store.state.toast.showToast("Failed to export discussions",4,!1),this.loading=!1}},async exportDiscussionsAsJson(){const n=this.list.filter(e=>e.checkBoxValue==!0).map(e=>e.id);if(n.length>0){console.log("export",n);let e=new Date;const t=e.getFullYear(),i=(e.getMonth()+1).toString().padStart(2,"0"),s=e.getDate().toString().padStart(2,"0"),r=e.getHours().toString().padStart(2,"0"),o=e.getMinutes().toString().padStart(2,"0"),a=e.getSeconds().toString().padStart(2,"0"),d="discussions_export_"+(t+"."+i+"."+s+"."+r+o+a)+".json";this.loading=!0;const c=await this.export_multiple_discussions(n,"json");c?(this.saveJSONtoFile(c,d),this.$store.state.toast.showToast("Successfully exported",4,!0),this.isCheckbox=!1):this.$store.state.toast.showToast("Failed to export discussions",4,!1),this.loading=!1}},async importDiscussions(n){const e=await this.parseJsonFile(n.target.files[0]);await this.import_multiple_discussions(e)?(this.$store.state.toast.showToast("Successfully imported ("+e.length+")",4,!0),await this.list_discussions()):this.$store.state.toast.showToast("Failed to import discussions",4,!1)},async getPersonalityAvatars(){for(;this.$store.state.personalities===null;)await new Promise(e=>setTimeout(e,100));let n=this.$store.state.personalities;this.personalityAvatars=n.map(e=>({name:e.name,avatar:e.avatar}))},getAvatar(n){if(n.toLowerCase().trim()==this.$store.state.config.user_name.toLowerCase().trim())return"user_infos/"+this.$store.state.config.user_avatar;const e=this.personalityAvatars.findIndex(i=>i.name===n),t=this.personalityAvatars[e];if(t)return console.log("Avatar",t.avatar),t.avatar},setFileListChat(n){try{this.$refs.chatBox.fileList=this.$refs.chatBox.fileList.concat(n)}catch(e){this.$store.state.toast.showToast(`Failed to set filelist in chatbox -`+e.message,4,!1)}this.isDragOverChat=!1},async setFileListDiscussion(n){if(n.length>1){this.$store.state.toast.showToast("Failed to import discussions. Too many files",4,!1);return}const e=await this.parseJsonFile(n[0]);await this.import_multiple_discussions(e)?(this.$store.state.toast.showToast("Successfully imported ("+e.length+")",4,!0),await this.list_discussions()):this.$store.state.toast.showToast("Failed to import discussions",4,!1),this.isDragOverDiscussion=!1}},async created(){const e=(await Me.get("/get_versionID")).data.versionId;for(this.versionId!==e&&(this.$store.commit("updateVersionId",e),window.location.reload(!0)),this.$nextTick(()=>{qe.replace()}),Ze.on("disucssion_renamed",t=>{console.log("Received new title",t.discussion_id,t.title);const i=this.list.findIndex(r=>r.id==t.discussion_id),s=this.list[i];s.title=t.title}),Ze.onclose=t=>{console.log("WebSocket connection closed:",t.code,t.reason),this.socketIODisconnected()},Ze.on("connect_error",t=>{t.message==="ERR_CONNECTION_REFUSED"?console.error("Connection refused. The server is not available."):console.error("Connection error:",t),this.$store.state.isConnected=!1}),Ze.onerror=t=>{console.log("WebSocket connection error:",t.code,t.reason),this.socketIODisconnected(),Ze.disconnect()},Ze.on("connected",this.socketIOConnected),Ze.on("disconnected",this.socketIODisconnected),console.log("Added events"),console.log("Waiting to be ready");this.$store.state.ready===!1;)await new Promise(t=>setTimeout(t,100)),console.log(this.$store.state.ready);console.log("Ready"),this.setPageTitle(),await this.list_discussions(),this.loadLastUsedDiscussion(),Ze.on("show_progress",this.show_progress),Ze.on("hide_progress",this.hide_progress),Ze.on("update_progress",this.update_progress),Ze.on("notification",this.notify),Ze.on("new_message",this.new_message),Ze.on("update_message",this.streamMessageContent),Ze.on("close_message",this.finalMsgEvent),Ze.onopen=()=>{console.log("WebSocket connection established."),this.currentDiscussion!=null&&(this.setPageTitle(item),localStorage.setItem("selected_discussion",this.currentDiscussion.id),this.load_discussion(item.id,()=>{this.discussionArr.length>1&&(this.currentDiscussion.title===""||this.currentDiscussion.title===null)&&this.changeTitleUsingUserMSG(this.currentDiscussion.id,this.discussionArr[1].content)}))},this.isCreated=!0},async mounted(){Ze.on("refresh_files",()=>{this.recoverFiles()}),this.$nextTick(()=>{qe.replace()})},async activated(){for(;this.isReady===!1;)await new Promise(n=>setTimeout(n,100));await this.getPersonalityAvatars(),console.log("Avatars found:",this.personalityAvatars),this.isCreated&&Ve(()=>{const n=document.getElementById("messages-list");this.scrollBottom(n)}),this.$store.state.config.show_news_panel&&this.$store.state.news.show()},components:{Discussion:wE,Message:SO,ChatBox:TO,WelcomeComponent:xO,ChoiceDialog:AE,ProgressBar:ic,InputBox:EO,SkillsLibraryViewer:vO},watch:{progress_visibility_val(n){console.log("progress_visibility changed")},filterTitle(n){n==""&&(this.filterInProgress=!0,this.list=this.tempList,this.filterInProgress=!1)},isCheckbox(n){Ve(()=>{qe.replace()}),n||(this.isSelectAll=!1)},socketConnected(n){console.log("Websocket connected (watch)",n)},showConfirmation(){Ve(()=>{qe.replace()})},isSearch(){Ve(()=>{qe.replace()})}},computed:{...wk({versionId:n=>n.versionId}),progress_visibility:{get(){return self.progress_visibility_val}},version_info:{get(){return this.$store.state.version!=null&&this.$store.state.version!="unknown"?" v"+this.$store.state.version:""}},loading_infos:{get(){return this.$store.state.loading_infos}},loading_progress:{get(){return this.$store.state.loading_progress}},isModelOk:{get(){return this.$store.state.isModelOk},set(n){this.$store.state.isModelOk=n}},isGenerating:{get(){return this.$store.state.isGenerating},set(n){this.$store.state.isGenerating=n}},formatted_database_name(){return this.$store.state.config.discussion_db_name},UseDiscussionHistory(){return this.$store.state.config.activate_skills_lib},isReady:{get(){return this.$store.state.ready}},databases(){return this.$store.state.databases},client_id(){return Ze.id},isReady(){return console.log("verify ready",this.isCreated),this.isCreated},showPanel(){return this.$store.state.ready&&!this.panelCollapsed},socketConnected(){return console.log(" --- > Websocket connected"),this.$store.commit("setIsConnected",!0),!0},socketDisconnected(){return this.$store.commit("setIsConnected",!1),console.log(" --- > Websocket disconnected"),!0},selectedDiscussions(){return Ve(()=>{qe.replace()}),this.list.filter(n=>n.checkBoxValue==!0)}}},bxt=Object.assign(gxt,{__name:"DiscussionsView",setup(n){return qs(()=>{qO()}),Me.defaults.baseURL="/",(e,t)=>(w(),M($e,null,[Oe(ls,{name:"fade-and-fly"},{default:Je(()=>[e.isReady?q("",!0):(w(),M("div",B0t,[u("div",G0t,[u("div",z0t,[u("div",V0t,[H0t,u("div",q0t,[u("p",Y0t,"LoLLMS "+fe(e.version_info),1),$0t,W0t])]),K0t,j0t,u("div",Q0t,[Oe(ic,{ref:"loading_progress",progress:e.loading_progress},null,8,["progress"]),u("p",X0t,fe(e.loading_infos)+" ...",1)])])])]))]),_:1}),e.isReady?(w(),M("button",{key:0,onClick:t[0]||(t[0]=(...i)=>e.togglePanel&&e.togglePanel(...i)),class:"absolute top-0 left-0 z-50 p-2 m-2 bg-white rounded-full shadow-md bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-primary-light dark:hover:bg-primary"},[ne(u("div",null,J0t,512),[[Ot,e.panelCollapsed]]),ne(u("div",null,tTt,512),[[Ot,!e.panelCollapsed]])])):q("",!0),Oe(ls,{name:"slide-right"},{default:Je(()=>[e.showPanel?(w(),M("div",nTt,[u("div",{id:"leftPanel",class:"flex flex-col flex-grow overflow-y-scroll no-scrollbar",onDragover:t[25]||(t[25]=Te(i=>e.setDropZoneDiscussion(),["stop","prevent"]))},[u("div",iTt,[u("div",sTt,[u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Create new discussion",type:"button",onClick:t[1]||(t[1]=i=>e.createNewDiscussion())},oTt),u("button",{class:Ye(["text-2xl hover:text-secondary duration-75 active:scale-90",e.isCheckbox?"text-secondary":""]),title:"Edit discussion list",type:"button",onClick:t[2]||(t[2]=i=>e.isCheckbox=!e.isCheckbox)},lTt,2),cTt,u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Export database",type:"button",onClick:t[3]||(t[3]=Te(i=>e.database_selectorDialogVisible=!0,["stop"]))},uTt),u("input",{type:"file",ref:"fileDialog",style:{display:"none"},onChange:t[4]||(t[4]=(...i)=>e.importDiscussions&&e.importDiscussions(...i))},null,544),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 rotate-90",title:"Import discussions",type:"button",onClick:t[5]||(t[5]=Te(i=>e.$refs.fileDialog.click(),["stop"]))},_Tt),e.isOpen?(w(),M("div",hTt,[u("button",{onClick:t[6]||(t[6]=(...i)=>e.importDiscussions&&e.importDiscussions(...i))},"LOLLMS"),u("button",{onClick:t[7]||(t[7]=(...i)=>e.importChatGPT&&e.importChatGPT(...i))},"ChatGPT")])):q("",!0),u("button",{class:Ye(["text-2xl hover:text-secondary duration-75 active:scale-90",e.isSearch?"text-secondary":""]),title:"Filter discussions",type:"button",onClick:t[8]||(t[8]=i=>e.isSearch=!e.isSearch)},mTt,2),e.showSaveConfirmation?q("",!0):(w(),M("button",{key:1,title:"Save configuration",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:t[9]||(t[9]=i=>e.showSaveConfirmation=!0)},bTt)),e.showSaveConfirmation?(w(),M("div",ETt,[u("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel",type:"button",onClick:t[10]||(t[10]=Te(i=>e.showSaveConfirmation=!1,["stop"]))},yTt),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm save changes",type:"button",onClick:t[11]||(t[11]=Te(i=>e.save_configuration(),["stop"]))},TTt)])):q("",!0),e.loading?q("",!0):(w(),M("button",{key:3,type:"button",onClick:t[12]||(t[12]=Te((...i)=>e.addDiscussion2SkillsLibrary&&e.addDiscussion2SkillsLibrary(...i),["stop"])),title:"Add this discussion content to skills database",class:"w-6 text-blue-400 hover:text-secondary duration-75 active:scale-90"},[u("img",{src:vt(YO)},null,8,xTt)])),!e.loading&&e.$store.state.config.activate_skills_lib?(w(),M("button",{key:4,type:"button",onClick:t[13]||(t[13]=Te((...i)=>e.toggleSkillsLib&&e.toggleSkillsLib(...i),["stop"])),title:"Skills database is activated",class:"w-6 text-blue-400 hover:text-secondary duration-75 active:scale-90"},[u("img",{src:vt($O)},null,8,CTt)])):q("",!0),!e.loading&&!e.$store.state.config.activate_skills_lib?(w(),M("button",{key:5,type:"button",onClick:t[14]||(t[14]=Te((...i)=>e.toggleSkillsLib&&e.toggleSkillsLib(...i),["stop"])),title:"Skills database is deactivated",class:"w-6 text-blue-400 hover:text-secondary duration-75 active:scale-90"},[u("img",{src:vt(WO)},null,8,RTt)])):q("",!0),e.loading?q("",!0):(w(),M("button",{key:6,type:"button",onClick:t[15]||(t[15]=Te((...i)=>e.showSkillsLib&&e.showSkillsLib(...i),["stop"])),title:"Skills database is deactivated",class:"w-6 text-blue-400 hover:text-secondary duration-75 active:scale-90"},[u("img",{src:vt(KO)},null,8,ATt)])),e.loading?(w(),M("div",wTt,OTt)):q("",!0)]),e.isSearch?(w(),M("div",ITt,[u("div",MTt,[u("div",DTt,[kTt,u("div",LTt,[u("div",{class:Ye(["hover:text-secondary duration-75 active:scale-90",e.filterTitle?"visible":"invisible"]),title:"Clear",onClick:t[16]||(t[16]=i=>e.filterTitle="")},UTt,2)]),ne(u("input",{type:"search",id:"default-search",class:"block w-full p-2 pl-10 pr-10 text-sm border border-gray-300 rounded-lg bg-bg-light focus:ring-secondary focus:border-secondary dark:bg-bg-dark dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-secondary dark:focus:border-secondary",placeholder:"Search...",title:"Filter discussions by title","onUpdate:modelValue":t[17]||(t[17]=i=>e.filterTitle=i),onInput:t[18]||(t[18]=i=>e.filterDiscussions())},null,544),[[Pe,e.filterTitle]])])])])):q("",!0),e.isCheckbox?(w(),M("hr",FTt)):q("",!0),e.isCheckbox?(w(),M("div",BTt,[u("div",GTt,[e.selectedDiscussions.length>0?(w(),M("p",zTt,"Selected: "+fe(e.selectedDiscussions.length),1)):q("",!0)]),u("div",VTt,[e.selectedDiscussions.length>0?(w(),M("div",HTt,[e.showConfirmation?q("",!0):(w(),M("button",{key:0,class:"flex mx-3 flex-1 text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Remove selected",type:"button",onClick:t[19]||(t[19]=Te(i=>e.showConfirmation=!0,["stop"]))},YTt)),e.showConfirmation?(w(),M("div",$Tt,[u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm removal",type:"button",onClick:t[20]||(t[20]=Te((...i)=>e.deleteDiscussionMulti&&e.deleteDiscussionMulti(...i),["stop"]))},KTt),u("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel removal",type:"button",onClick:t[21]||(t[21]=Te(i=>e.showConfirmation=!1,["stop"]))},QTt)])):q("",!0)])):q("",!0),u("div",XTt,[u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 rotate-90",title:"Export selected to a json file",type:"button",onClick:t[22]||(t[22]=Te((...i)=>e.exportDiscussionsAsJson&&e.exportDiscussionsAsJson(...i),["stop"]))},JTt),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 rotate-90",title:"Export selected to a martkdown file",type:"button",onClick:t[23]||(t[23]=Te((...i)=>e.exportDiscussionsAsMarkdown&&e.exportDiscussionsAsMarkdown(...i),["stop"]))},txt),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Select All",type:"button",onClick:t[24]||(t[24]=Te((...i)=>e.selectAllDiscussions&&e.selectAllDiscussions(...i),["stop"]))},ixt)])])])):q("",!0)]),u("div",sxt,[u("div",{class:Ye(["mx-4 flex flex-col flex-grow w-full",e.isDragOverDiscussion?"pointer-events-none":""])},[u("div",{id:"dis-list",class:Ye([e.filterInProgress?"opacity-20 pointer-events-none":"","flex flex-col flex-grow w-full"])},[e.list.length>0?(w(),xt(rs,{key:0,name:"list"},{default:Je(()=>[(w(!0),M($e,null,ct(e.list,(i,s)=>(w(),xt(wE,{key:i.id,id:i.id,title:i.title,selected:e.currentDiscussion.id==i.id,loading:i.loading,isCheckbox:e.isCheckbox,checkBoxValue:i.checkBoxValue,onSelect:r=>e.selectDiscussion(i),onDelete:r=>e.deleteDiscussion(i.id),onEditTitle:e.editTitle,onMakeTitle:e.makeTitle,onChecked:e.checkUncheckDiscussion},null,8,["id","title","selected","loading","isCheckbox","checkBoxValue","onSelect","onDelete","onEditTitle","onMakeTitle","onChecked"]))),128))]),_:1})):q("",!0),e.list.length<1?(w(),M("div",rxt,axt)):q("",!0),lxt],2)],2)])],32),u("div",{class:"absolute bottom-0 left-0 w-full bg-blue-200 dark:bg-blue-800 text-white py-2 cursor-pointer hover:text-green-500",onClick:t[26]||(t[26]=(...i)=>e.showDatabaseSelector&&e.showDatabaseSelector(...i))},[u("p",cxt,"Current database: "+fe(e.formatted_database_name),1)])])):q("",!0)]),_:1}),e.isReady?(w(),M("div",dxt,[u("div",{id:"messages-list",class:Ye(["w-full z-0 flex flex-col flex-grow overflow-y-auto scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",e.isDragOverChat?"pointer-events-none":""])},[u("div",uxt,[e.discussionArr.length>0?(w(),xt(rs,{key:0,name:"list"},{default:Je(()=>[(w(!0),M($e,null,ct(e.discussionArr,(i,s)=>(w(),xt(SO,{key:i.id,message:i,id:"msg-"+i.id,host:e.host,ref_for:!0,ref:"messages",onCopy:e.copyToClipBoard,onDelete:e.deleteMessage,onRankUp:e.rankUpMessage,onRankDown:e.rankDownMessage,onUpdateMessage:e.updateMessage,onResendMessage:e.resendMessage,onContinueMessage:e.continueMessage,avatar:e.getAvatar(i.sender)},null,8,["message","id","host","onCopy","onDelete","onRankUp","onRankDown","onUpdateMessage","onResendMessage","onContinueMessage","avatar"]))),128))]),_:1})):q("",!0),e.currentDiscussion.id?q("",!0):(w(),xt(xO,{key:1})),pxt]),_xt,e.currentDiscussion.id?(w(),M("div",hxt,[Oe(TO,{ref:"chatBox",loading:e.isGenerating,discussionList:e.discussionArr,"on-show-toast-message":e.showToastMessage,"on-talk":e.talk,onPersonalitySelected:e.recoverFiles,onMessageSentEvent:e.sendMsg,onSendCMDEvent:e.sendCmd,onAddWebLink:e.add_webpage,onCreateEmptyUserMessage:e.createEmptyUserMessage,onCreateEmptyAIMessage:e.createEmptyAIMessage,onStopGenerating:e.stopGenerating,onLoaded:e.recoverFiles},null,8,["loading","discussionList","on-show-toast-message","on-talk","onPersonalitySelected","onMessageSentEvent","onSendCMDEvent","onAddWebLink","onCreateEmptyUserMessage","onCreateEmptyAIMessage","onStopGenerating","onLoaded"])])):q("",!0)],2)])):q("",!0),Oe(AE,{reference:"database_selector",class:"z-20",show:e.database_selectorDialogVisible,choices:e.databases,onChoiceSelected:e.ondatabase_selectorDialogSelected,onCloseDialog:e.onclosedatabase_selectorDialog,onChoiceValidated:e.onvalidatedatabase_selectorChoice},null,8,["show","choices","onChoiceSelected","onCloseDialog","onChoiceValidated"]),ne(u("div",fxt,[Oe(ic,{ref:"progress",progress:e.progress_value,class:"w-full h-4"},null,8,["progress"]),u("p",mxt,fe(e.loading_infos)+" ...",1)],512),[[Ot,e.progress_visibility]]),Oe(EO,{"prompt-text":"Enter the url to the page to use as discussion support",onOk:e.addWebpage,ref:"web_url_input_box"},null,8,["onOk"]),Oe(vO,{ref:"skills_lib"},null,512)],64))}}),Ext=bt(bxt,[["__scopeId","data-v-c27eaae6"]]);/** +`+e.message,4,!1)}this.isDragOverChat=!1},async setFileListDiscussion(n){if(n.length>1){this.$store.state.toast.showToast("Failed to import discussions. Too many files",4,!1);return}const e=await this.parseJsonFile(n[0]);await this.import_multiple_discussions(e)?(this.$store.state.toast.showToast("Successfully imported ("+e.length+")",4,!0),await this.list_discussions()):this.$store.state.toast.showToast("Failed to import discussions",4,!1),this.isDragOverDiscussion=!1}},async created(){const e=(await Me.get("/get_versionID")).data.versionId;for(this.versionId!==e&&(this.$store.commit("updateVersionId",e),window.location.reload(!0)),this.$nextTick(()=>{qe.replace()}),Ze.on("disucssion_renamed",t=>{console.log("Received new title",t.discussion_id,t.title);const i=this.list.findIndex(r=>r.id==t.discussion_id),s=this.list[i];s.title=t.title}),Ze.onclose=t=>{console.log("WebSocket connection closed:",t.code,t.reason),this.socketIODisconnected()},Ze.on("connect_error",t=>{t.message==="ERR_CONNECTION_REFUSED"?console.error("Connection refused. The server is not available."):console.error("Connection error:",t),this.$store.state.isConnected=!1}),Ze.onerror=t=>{console.log("WebSocket connection error:",t.code,t.reason),this.socketIODisconnected(),Ze.disconnect()},Ze.on("connected",this.socketIOConnected),Ze.on("disconnected",this.socketIODisconnected),console.log("Added events"),console.log("Waiting to be ready");this.$store.state.ready===!1;)await new Promise(t=>setTimeout(t,100)),console.log(this.$store.state.ready);console.log("Ready"),this.setPageTitle(),await this.list_discussions(),this.loadLastUsedDiscussion(),Ze.on("show_progress",this.show_progress),Ze.on("hide_progress",this.hide_progress),Ze.on("update_progress",this.update_progress),Ze.on("notification",this.notify),Ze.on("new_message",this.new_message),Ze.on("update_message",this.streamMessageContent),Ze.on("close_message",this.finalMsgEvent),Ze.onopen=()=>{console.log("WebSocket connection established."),this.currentDiscussion!=null&&(this.setPageTitle(item),localStorage.setItem("selected_discussion",this.currentDiscussion.id),this.load_discussion(item.id,()=>{this.discussionArr.length>1&&(this.currentDiscussion.title===""||this.currentDiscussion.title===null)&&this.changeTitleUsingUserMSG(this.currentDiscussion.id,this.discussionArr[1].content)}))},this.isCreated=!0},async mounted(){Ze.on("refresh_files",()=>{this.recoverFiles()}),this.$nextTick(()=>{qe.replace()})},async activated(){for(;this.isReady===!1;)await new Promise(n=>setTimeout(n,100));await this.getPersonalityAvatars(),console.log("Avatars found:",this.personalityAvatars),this.isCreated&&Ve(()=>{const n=document.getElementById("messages-list");this.scrollBottom(n)}),this.$store.state.config.show_news_panel&&this.$store.state.news.show()},components:{Discussion:wE,Message:SO,ChatBox:TO,WelcomeComponent:xO,ChoiceDialog:AE,ProgressBar:ic,InputBox:EO,SkillsLibraryViewer:vO},watch:{progress_visibility_val(n){console.log("progress_visibility changed")},filterTitle(n){n==""&&(this.filterInProgress=!0,this.list=this.tempList,this.filterInProgress=!1)},isCheckbox(n){Ve(()=>{qe.replace()}),n||(this.isSelectAll=!1)},socketConnected(n){console.log("Websocket connected (watch)",n)},showConfirmation(){Ve(()=>{qe.replace()})},isSearch(){Ve(()=>{qe.replace()})}},computed:{...wk({versionId:n=>n.versionId}),progress_visibility:{get(){return self.progress_visibility_val}},version_info:{get(){return this.$store.state.version!=null&&this.$store.state.version!="unknown"?" v"+this.$store.state.version:""}},loading_infos:{get(){return this.$store.state.loading_infos}},loading_progress:{get(){return this.$store.state.loading_progress}},isModelOk:{get(){return this.$store.state.isModelOk},set(n){this.$store.state.isModelOk=n}},isGenerating:{get(){return this.$store.state.isGenerating},set(n){this.$store.state.isGenerating=n}},formatted_database_name(){return this.$store.state.config.discussion_db_name},UseDiscussionHistory(){return this.$store.state.config.activate_skills_lib},isReady:{get(){return this.$store.state.ready}},databases(){return this.$store.state.databases},client_id(){return Ze.id},isReady(){return console.log("verify ready",this.isCreated),this.isCreated},showPanel(){return this.$store.state.ready&&!this.panelCollapsed},socketConnected(){return console.log(" --- > Websocket connected"),this.$store.commit("setIsConnected",!0),!0},socketDisconnected(){return this.$store.commit("setIsConnected",!1),console.log(" --- > Websocket disconnected"),!0},selectedDiscussions(){return Ve(()=>{qe.replace()}),this.list.filter(n=>n.checkBoxValue==!0)}}},vxt=Object.assign(Ext,{__name:"DiscussionsView",setup(n){return qs(()=>{qO()}),Me.defaults.baseURL="/",(e,t)=>(w(),M($e,null,[Oe(ls,{name:"fade-and-fly"},{default:Je(()=>[e.isReady?q("",!0):(w(),M("div",z0t,[u("div",V0t,[u("div",H0t,[u("div",q0t,[Y0t,u("div",$0t,[u("p",W0t,"LoLLMS "+fe(e.version_info),1),K0t,j0t])]),Q0t,X0t,u("div",Z0t,[Oe(ic,{ref:"loading_progress",progress:e.loading_progress},null,8,["progress"]),u("p",J0t,fe(e.loading_infos)+" ...",1)])])])]))]),_:1}),e.isReady?(w(),M("button",{key:0,onClick:t[0]||(t[0]=(...i)=>e.togglePanel&&e.togglePanel(...i)),class:"absolute top-0 left-0 z-50 p-2 m-2 bg-white rounded-full shadow-md bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-primary-light dark:hover:bg-primary"},[ne(u("div",null,tTt,512),[[Ot,e.panelCollapsed]]),ne(u("div",null,iTt,512),[[Ot,!e.panelCollapsed]])])):q("",!0),Oe(ls,{name:"slide-right"},{default:Je(()=>[e.showPanel?(w(),M("div",sTt,[u("div",{id:"leftPanel",class:"flex flex-col flex-grow overflow-y-scroll no-scrollbar",onDragover:t[25]||(t[25]=Te(i=>e.setDropZoneDiscussion(),["stop","prevent"]))},[u("div",rTt,[u("div",oTt,[u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Create new discussion",type:"button",onClick:t[1]||(t[1]=i=>e.createNewDiscussion())},lTt),u("button",{class:Ye(["text-2xl hover:text-secondary duration-75 active:scale-90",e.isCheckbox?"text-secondary":""]),title:"Edit discussion list",type:"button",onClick:t[2]||(t[2]=i=>e.isCheckbox=!e.isCheckbox)},dTt,2),uTt,u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Export database",type:"button",onClick:t[3]||(t[3]=Te(i=>e.database_selectorDialogVisible=!0,["stop"]))},_Tt),u("input",{type:"file",ref:"fileDialog",style:{display:"none"},onChange:t[4]||(t[4]=(...i)=>e.importDiscussions&&e.importDiscussions(...i))},null,544),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 rotate-90",title:"Import discussions",type:"button",onClick:t[5]||(t[5]=Te(i=>e.$refs.fileDialog.click(),["stop"]))},fTt),e.isOpen?(w(),M("div",mTt,[u("button",{onClick:t[6]||(t[6]=(...i)=>e.importDiscussions&&e.importDiscussions(...i))},"LOLLMS"),u("button",{onClick:t[7]||(t[7]=(...i)=>e.importChatGPT&&e.importChatGPT(...i))},"ChatGPT")])):q("",!0),u("button",{class:Ye(["text-2xl hover:text-secondary duration-75 active:scale-90",e.isSearch?"text-secondary":""]),title:"Filter discussions",type:"button",onClick:t[8]||(t[8]=i=>e.isSearch=!e.isSearch)},bTt,2),e.showSaveConfirmation?q("",!0):(w(),M("button",{key:1,title:"Save configuration",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:t[9]||(t[9]=i=>e.showSaveConfirmation=!0)},vTt)),e.showSaveConfirmation?(w(),M("div",yTt,[u("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel",type:"button",onClick:t[10]||(t[10]=Te(i=>e.showSaveConfirmation=!1,["stop"]))},TTt),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm save changes",type:"button",onClick:t[11]||(t[11]=Te(i=>e.save_configuration(),["stop"]))},CTt)])):q("",!0),e.loading?q("",!0):(w(),M("button",{key:3,type:"button",onClick:t[12]||(t[12]=Te((...i)=>e.addDiscussion2SkillsLibrary&&e.addDiscussion2SkillsLibrary(...i),["stop"])),title:"Add this discussion content to skills database",class:"w-6 text-blue-400 hover:text-secondary duration-75 active:scale-90"},[u("img",{src:vt(YO)},null,8,RTt)])),!e.loading&&e.$store.state.config.activate_skills_lib?(w(),M("button",{key:4,type:"button",onClick:t[13]||(t[13]=Te((...i)=>e.toggleSkillsLib&&e.toggleSkillsLib(...i),["stop"])),title:"Skills database is activated",class:"w-6 text-blue-400 hover:text-secondary duration-75 active:scale-90"},[u("img",{src:vt($O)},null,8,ATt)])):q("",!0),!e.loading&&!e.$store.state.config.activate_skills_lib?(w(),M("button",{key:5,type:"button",onClick:t[14]||(t[14]=Te((...i)=>e.toggleSkillsLib&&e.toggleSkillsLib(...i),["stop"])),title:"Skills database is deactivated",class:"w-6 text-blue-400 hover:text-secondary duration-75 active:scale-90"},[u("img",{src:vt(WO)},null,8,wTt)])):q("",!0),e.loading?q("",!0):(w(),M("button",{key:6,type:"button",onClick:t[15]||(t[15]=Te((...i)=>e.showSkillsLib&&e.showSkillsLib(...i),["stop"])),title:"Skills database is deactivated",class:"w-6 text-blue-400 hover:text-secondary duration-75 active:scale-90"},[u("img",{src:vt(KO)},null,8,NTt)])),e.loading?(w(),M("div",OTt,MTt)):q("",!0)]),e.isSearch?(w(),M("div",DTt,[u("div",kTt,[u("div",LTt,[PTt,u("div",UTt,[u("div",{class:Ye(["hover:text-secondary duration-75 active:scale-90",e.filterTitle?"visible":"invisible"]),title:"Clear",onClick:t[16]||(t[16]=i=>e.filterTitle="")},BTt,2)]),ne(u("input",{type:"search",id:"default-search",class:"block w-full p-2 pl-10 pr-10 text-sm border border-gray-300 rounded-lg bg-bg-light focus:ring-secondary focus:border-secondary dark:bg-bg-dark dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-secondary dark:focus:border-secondary",placeholder:"Search...",title:"Filter discussions by title","onUpdate:modelValue":t[17]||(t[17]=i=>e.filterTitle=i),onInput:t[18]||(t[18]=i=>e.filterDiscussions())},null,544),[[Pe,e.filterTitle]])])])])):q("",!0),e.isCheckbox?(w(),M("hr",GTt)):q("",!0),e.isCheckbox?(w(),M("div",zTt,[u("div",VTt,[e.selectedDiscussions.length>0?(w(),M("p",HTt,"Selected: "+fe(e.selectedDiscussions.length),1)):q("",!0)]),u("div",qTt,[e.selectedDiscussions.length>0?(w(),M("div",YTt,[e.showConfirmation?q("",!0):(w(),M("button",{key:0,class:"flex mx-3 flex-1 text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Remove selected",type:"button",onClick:t[19]||(t[19]=Te(i=>e.showConfirmation=!0,["stop"]))},WTt)),e.showConfirmation?(w(),M("div",KTt,[u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm removal",type:"button",onClick:t[20]||(t[20]=Te((...i)=>e.deleteDiscussionMulti&&e.deleteDiscussionMulti(...i),["stop"]))},QTt),u("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel removal",type:"button",onClick:t[21]||(t[21]=Te(i=>e.showConfirmation=!1,["stop"]))},ZTt)])):q("",!0)])):q("",!0),u("div",JTt,[u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 rotate-90",title:"Export selected to a json file",type:"button",onClick:t[22]||(t[22]=Te((...i)=>e.exportDiscussionsAsJson&&e.exportDiscussionsAsJson(...i),["stop"]))},txt),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 rotate-90",title:"Export selected to a martkdown file",type:"button",onClick:t[23]||(t[23]=Te((...i)=>e.exportDiscussionsAsMarkdown&&e.exportDiscussionsAsMarkdown(...i),["stop"]))},ixt),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Select All",type:"button",onClick:t[24]||(t[24]=Te((...i)=>e.selectAllDiscussions&&e.selectAllDiscussions(...i),["stop"]))},rxt)])])])):q("",!0)]),u("div",oxt,[u("div",{class:Ye(["mx-4 flex flex-col flex-grow w-full",e.isDragOverDiscussion?"pointer-events-none":""])},[u("div",{id:"dis-list",class:Ye([e.filterInProgress?"opacity-20 pointer-events-none":"","flex flex-col flex-grow w-full"])},[e.list.length>0?(w(),xt(rs,{key:0,name:"list"},{default:Je(()=>[(w(!0),M($e,null,ct(e.list,(i,s)=>(w(),xt(wE,{key:i.id,id:i.id,title:i.title,selected:e.currentDiscussion.id==i.id,loading:i.loading,isCheckbox:e.isCheckbox,checkBoxValue:i.checkBoxValue,onSelect:r=>e.selectDiscussion(i),onDelete:r=>e.deleteDiscussion(i.id),onEditTitle:e.editTitle,onMakeTitle:e.makeTitle,onChecked:e.checkUncheckDiscussion},null,8,["id","title","selected","loading","isCheckbox","checkBoxValue","onSelect","onDelete","onEditTitle","onMakeTitle","onChecked"]))),128))]),_:1})):q("",!0),e.list.length<1?(w(),M("div",axt,cxt)):q("",!0),dxt],2)],2)])],32),u("div",{class:"absolute bottom-0 left-0 w-full bg-blue-200 dark:bg-blue-800 text-white py-2 cursor-pointer hover:text-green-500",onClick:t[26]||(t[26]=(...i)=>e.showDatabaseSelector&&e.showDatabaseSelector(...i))},[u("p",uxt,"Current database: "+fe(e.formatted_database_name),1)])])):q("",!0)]),_:1}),e.isReady?(w(),M("div",pxt,[u("div",{id:"messages-list",class:Ye(["w-full z-0 flex flex-col flex-grow overflow-y-auto scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",e.isDragOverChat?"pointer-events-none":""])},[u("div",_xt,[e.discussionArr.length>0?(w(),xt(rs,{key:0,name:"list"},{default:Je(()=>[(w(!0),M($e,null,ct(e.discussionArr,(i,s)=>(w(),xt(SO,{key:i.id,message:i,id:"msg-"+i.id,host:e.host,ref_for:!0,ref:"messages",onCopy:e.copyToClipBoard,onDelete:e.deleteMessage,onRankUp:e.rankUpMessage,onRankDown:e.rankDownMessage,onUpdateMessage:e.updateMessage,onResendMessage:e.resendMessage,onContinueMessage:e.continueMessage,avatar:e.getAvatar(i.sender)},null,8,["message","id","host","onCopy","onDelete","onRankUp","onRankDown","onUpdateMessage","onResendMessage","onContinueMessage","avatar"]))),128))]),_:1})):q("",!0),e.currentDiscussion.id?q("",!0):(w(),xt(xO,{key:1})),hxt]),fxt,e.currentDiscussion.id?(w(),M("div",mxt,[Oe(TO,{ref:"chatBox",loading:e.isGenerating,discussionList:e.discussionArr,"on-show-toast-message":e.showToastMessage,"on-talk":e.talk,onPersonalitySelected:e.recoverFiles,onMessageSentEvent:e.sendMsg,onSendCMDEvent:e.sendCmd,onAddWebLink:e.add_webpage,onCreateEmptyUserMessage:e.createEmptyUserMessage,onCreateEmptyAIMessage:e.createEmptyAIMessage,onStopGenerating:e.stopGenerating,onLoaded:e.recoverFiles},null,8,["loading","discussionList","on-show-toast-message","on-talk","onPersonalitySelected","onMessageSentEvent","onSendCMDEvent","onAddWebLink","onCreateEmptyUserMessage","onCreateEmptyAIMessage","onStopGenerating","onLoaded"])])):q("",!0)],2)])):q("",!0),Oe(AE,{reference:"database_selector",class:"z-20",show:e.database_selectorDialogVisible,choices:e.databases,onChoiceSelected:e.ondatabase_selectorDialogSelected,onCloseDialog:e.onclosedatabase_selectorDialog,onChoiceValidated:e.onvalidatedatabase_selectorChoice},null,8,["show","choices","onChoiceSelected","onCloseDialog","onChoiceValidated"]),ne(u("div",gxt,[Oe(ic,{ref:"progress",progress:e.progress_value,class:"w-full h-4"},null,8,["progress"]),u("p",bxt,fe(e.loading_infos)+" ...",1)],512),[[Ot,e.progress_visibility]]),Oe(EO,{"prompt-text":"Enter the url to the page to use as discussion support",onOk:e.addWebpage,ref:"web_url_input_box"},null,8,["onOk"]),Oe(vO,{ref:"skills_lib"},null,512)],64))}}),yxt=bt(vxt,[["__scopeId","data-v-c27eaae6"]]);/** * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT - */const jE="159",vxt=0,HC=1,yxt=2,jO=1,Sxt=2,Is=3,Vs=0,Zn=1,Ji=2,Sr=0,aa=1,qC=2,YC=3,$C=4,Txt=5,Jr=100,xxt=101,Cxt=102,WC=103,KC=104,Rxt=200,Axt=201,wxt=202,Nxt=203,ab=204,lb=205,Oxt=206,Ixt=207,Mxt=208,Dxt=209,kxt=210,Lxt=211,Pxt=212,Uxt=213,Fxt=214,Bxt=0,Gxt=1,zxt=2,mu=3,Vxt=4,Hxt=5,qxt=6,Yxt=7,QE=0,$xt=1,Wxt=2,Tr=0,Kxt=1,jxt=2,Qxt=3,Xxt=4,Zxt=5,jC="attached",Jxt="detached",QO=300,xa=301,Ca=302,cb=303,db=304,up=306,Ra=1e3,gi=1001,gu=1002,En=1003,ub=1004,Vd=1005,jn=1006,XO=1007,go=1008,xr=1009,eCt=1010,tCt=1011,XE=1012,ZO=1013,br=1014,ks=1015,oc=1016,JO=1017,eI=1018,lo=1020,nCt=1021,bi=1023,iCt=1024,sCt=1025,co=1026,Aa=1027,rCt=1028,tI=1029,oCt=1030,nI=1031,iI=1033,Bm=33776,Gm=33777,zm=33778,Vm=33779,QC=35840,XC=35841,ZC=35842,JC=35843,sI=36196,e1=37492,t1=37496,n1=37808,i1=37809,s1=37810,r1=37811,o1=37812,a1=37813,l1=37814,c1=37815,d1=37816,u1=37817,p1=37818,_1=37819,h1=37820,f1=37821,Hm=36492,m1=36494,g1=36495,aCt=36283,b1=36284,E1=36285,v1=36286,ac=2300,wa=2301,qm=2302,y1=2400,S1=2401,T1=2402,lCt=2500,cCt=0,rI=1,pb=2,oI=3e3,uo=3001,dCt=3200,uCt=3201,ZE=0,pCt=1,Ei="",rn="srgb",Nn="srgb-linear",JE="display-p3",pp="display-p3-linear",bu="linear",Xt="srgb",Eu="rec709",vu="p3",Oo=7680,x1=519,_Ct=512,hCt=513,fCt=514,aI=515,mCt=516,gCt=517,bCt=518,ECt=519,_b=35044,C1="300 es",hb=1035,Ls=2e3,yu=2001;class ja{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const s=this._listeners[e];if(s!==void 0){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const s=i.slice(0);for(let r=0,o=s.length;r>8&255]+In[n>>16&255]+In[n>>24&255]+"-"+In[e&255]+In[e>>8&255]+"-"+In[e>>16&15|64]+In[e>>24&255]+"-"+In[t&63|128]+In[t>>8&255]+"-"+In[t>>16&255]+In[t>>24&255]+In[i&255]+In[i>>8&255]+In[i>>16&255]+In[i>>24&255]).toLowerCase()}function kn(n,e,t){return Math.max(e,Math.min(t,n))}function ev(n,e){return(n%e+e)%e}function vCt(n,e,t,i,s){return i+(n-e)*(s-i)/(t-e)}function yCt(n,e,t){return n!==e?(t-n)/(e-n):0}function Bl(n,e,t){return(1-t)*n+t*e}function SCt(n,e,t,i){return Bl(n,e,1-Math.exp(-t*i))}function TCt(n,e=1){return e-Math.abs(ev(n,e*2)-e)}function xCt(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function CCt(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function RCt(n,e){return n+Math.floor(Math.random()*(e-n+1))}function ACt(n,e){return n+Math.random()*(e-n)}function wCt(n){return n*(.5-Math.random())}function NCt(n){n!==void 0&&(R1=n);let e=R1+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function OCt(n){return n*Fl}function ICt(n){return n*Na}function fb(n){return(n&n-1)===0&&n!==0}function MCt(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Su(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function DCt(n,e,t,i,s){const r=Math.cos,o=Math.sin,a=r(t/2),l=o(t/2),d=r((e+i)/2),c=o((e+i)/2),_=r((e-i)/2),f=o((e-i)/2),m=r((i-e)/2),h=o((i-e)/2);switch(s){case"XYX":n.set(a*c,l*_,l*f,a*d);break;case"YZY":n.set(l*f,a*c,l*_,a*d);break;case"ZXZ":n.set(l*_,l*f,a*c,a*d);break;case"XZX":n.set(a*c,l*h,l*m,a*d);break;case"YXY":n.set(l*m,a*c,l*h,a*d);break;case"ZYZ":n.set(l*h,l*m,a*c,a*d);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function es(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Ht(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const kCt={DEG2RAD:Fl,RAD2DEG:Na,generateUUID:zi,clamp:kn,euclideanModulo:ev,mapLinear:vCt,inverseLerp:yCt,lerp:Bl,damp:SCt,pingpong:TCt,smoothstep:xCt,smootherstep:CCt,randInt:RCt,randFloat:ACt,randFloatSpread:wCt,seededRandom:NCt,degToRad:OCt,radToDeg:ICt,isPowerOfTwo:fb,ceilPowerOfTwo:MCt,floorPowerOfTwo:Su,setQuaternionFromProperEuler:DCt,normalize:Ht,denormalize:es};class Mt{constructor(e=0,t=0){Mt.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6],this.y=s[1]*t+s[4]*i+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(kn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),s=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*i-o*s+e.x,this.y=r*s+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Rt{constructor(e,t,i,s,r,o,a,l,d){Rt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,s,r,o,a,l,d)}set(e,t,i,s,r,o,a,l,d){const c=this.elements;return c[0]=e,c[1]=s,c[2]=a,c[3]=t,c[4]=r,c[5]=l,c[6]=i,c[7]=o,c[8]=d,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[3],l=i[6],d=i[1],c=i[4],_=i[7],f=i[2],m=i[5],h=i[8],E=s[0],b=s[3],g=s[6],v=s[1],y=s[4],T=s[7],C=s[2],x=s[5],O=s[8];return r[0]=o*E+a*v+l*C,r[3]=o*b+a*y+l*x,r[6]=o*g+a*T+l*O,r[1]=d*E+c*v+_*C,r[4]=d*b+c*y+_*x,r[7]=d*g+c*T+_*O,r[2]=f*E+m*v+h*C,r[5]=f*b+m*y+h*x,r[8]=f*g+m*T+h*O,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],d=e[7],c=e[8];return t*o*c-t*a*d-i*r*c+i*a*l+s*r*d-s*o*l}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],d=e[7],c=e[8],_=c*o-a*d,f=a*l-c*r,m=d*r-o*l,h=t*_+i*f+s*m;if(h===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/h;return e[0]=_*E,e[1]=(s*d-c*i)*E,e[2]=(a*i-s*o)*E,e[3]=f*E,e[4]=(c*t-s*l)*E,e[5]=(s*r-a*t)*E,e[6]=m*E,e[7]=(i*l-d*t)*E,e[8]=(o*t-i*r)*E,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,s,r,o,a){const l=Math.cos(r),d=Math.sin(r);return this.set(i*l,i*d,-i*(l*o+d*a)+o+e,-s*d,s*l,-s*(-d*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Ym.makeScale(e,t)),this}rotate(e){return this.premultiply(Ym.makeRotation(-e)),this}translate(e,t){return this.premultiply(Ym.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<9;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Ym=new Rt;function lI(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function lc(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function LCt(){const n=lc("canvas");return n.style.display="block",n}const A1={};function Gl(n){n in A1||(A1[n]=!0,console.warn(n))}const w1=new Rt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),N1=new Rt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Jc={[Nn]:{transfer:bu,primaries:Eu,toReference:n=>n,fromReference:n=>n},[rn]:{transfer:Xt,primaries:Eu,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[pp]:{transfer:bu,primaries:vu,toReference:n=>n.applyMatrix3(N1),fromReference:n=>n.applyMatrix3(w1)},[JE]:{transfer:Xt,primaries:vu,toReference:n=>n.convertSRGBToLinear().applyMatrix3(N1),fromReference:n=>n.applyMatrix3(w1).convertLinearToSRGB()}},PCt=new Set([Nn,pp]),Ft={enabled:!0,_workingColorSpace:Nn,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(n){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!n},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!PCt.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=Jc[e].toReference,s=Jc[t].fromReference;return s(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return Jc[n].primaries},getTransfer:function(n){return n===Ei?bu:Jc[n].transfer}};function la(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function $m(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Io;class cI{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Io===void 0&&(Io=lc("canvas")),Io.width=e.width,Io.height=e.height;const i=Io.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Io}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=lc("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height),r=s.data;for(let o=0;o0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==QO)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ra:e.x=e.x-Math.floor(e.x);break;case gi:e.x=e.x<0?0:1;break;case gu:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Ra:e.y=e.y-Math.floor(e.y);break;case gi:e.y=e.y<0?0:1;break;case gu:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return Gl("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===rn?uo:oI}set encoding(e){Gl("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===uo?rn:Ei}}wn.DEFAULT_IMAGE=null;wn.DEFAULT_MAPPING=QO;wn.DEFAULT_ANISOTROPY=1;class Wt{constructor(e=0,t=0,i=0,s=1){Wt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,s){return this.x=e,this.y=t,this.z=i,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*s+o[12]*r,this.y=o[1]*t+o[5]*i+o[9]*s+o[13]*r,this.z=o[2]*t+o[6]*i+o[10]*s+o[14]*r,this.w=o[3]*t+o[7]*i+o[11]*s+o[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,s,r;const l=e.elements,d=l[0],c=l[4],_=l[8],f=l[1],m=l[5],h=l[9],E=l[2],b=l[6],g=l[10];if(Math.abs(c-f)<.01&&Math.abs(_-E)<.01&&Math.abs(h-b)<.01){if(Math.abs(c+f)<.1&&Math.abs(_+E)<.1&&Math.abs(h+b)<.1&&Math.abs(d+m+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const y=(d+1)/2,T=(m+1)/2,C=(g+1)/2,x=(c+f)/4,O=(_+E)/4,R=(h+b)/4;return y>T&&y>C?y<.01?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(y),s=x/i,r=O/i):T>C?T<.01?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(T),i=x/s,r=R/s):C<.01?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(C),i=O/r,s=R/r),this.set(i,s,r,t),this}let v=Math.sqrt((b-h)*(b-h)+(_-E)*(_-E)+(f-c)*(f-c));return Math.abs(v)<.001&&(v=1),this.x=(b-h)/v,this.y=(_-E)/v,this.z=(f-c)/v,this.w=Math.acos((d+m+g-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class BCt extends ja{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Wt(0,0,e,t),this.scissorTest=!1,this.viewport=new Wt(0,0,e,t);const s={width:e,height:t,depth:1};i.encoding!==void 0&&(Gl("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===uo?rn:Ei),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:jn,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},i),this.texture=new wn(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps,this.texture.internalFormat=i.internalFormat,this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new dI(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class bo extends BCt{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class uI extends wn{constructor(e=null,t=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:s},this.magFilter=En,this.minFilter=En,this.wrapR=gi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class GCt extends wn{constructor(e=null,t=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:s},this.magFilter=En,this.minFilter=En,this.wrapR=gi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Dr{constructor(e=0,t=0,i=0,s=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=s}static slerpFlat(e,t,i,s,r,o,a){let l=i[s+0],d=i[s+1],c=i[s+2],_=i[s+3];const f=r[o+0],m=r[o+1],h=r[o+2],E=r[o+3];if(a===0){e[t+0]=l,e[t+1]=d,e[t+2]=c,e[t+3]=_;return}if(a===1){e[t+0]=f,e[t+1]=m,e[t+2]=h,e[t+3]=E;return}if(_!==E||l!==f||d!==m||c!==h){let b=1-a;const g=l*f+d*m+c*h+_*E,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){const C=Math.sqrt(y),x=Math.atan2(C,g*v);b=Math.sin(b*x)/C,a=Math.sin(a*x)/C}const T=a*v;if(l=l*b+f*T,d=d*b+m*T,c=c*b+h*T,_=_*b+E*T,b===1-a){const C=1/Math.sqrt(l*l+d*d+c*c+_*_);l*=C,d*=C,c*=C,_*=C}}e[t]=l,e[t+1]=d,e[t+2]=c,e[t+3]=_}static multiplyQuaternionsFlat(e,t,i,s,r,o){const a=i[s],l=i[s+1],d=i[s+2],c=i[s+3],_=r[o],f=r[o+1],m=r[o+2],h=r[o+3];return e[t]=a*h+c*_+l*m-d*f,e[t+1]=l*h+c*f+d*_-a*m,e[t+2]=d*h+c*m+a*f-l*_,e[t+3]=c*h-a*_-l*f-d*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,s){return this._x=e,this._y=t,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const i=e._x,s=e._y,r=e._z,o=e._order,a=Math.cos,l=Math.sin,d=a(i/2),c=a(s/2),_=a(r/2),f=l(i/2),m=l(s/2),h=l(r/2);switch(o){case"XYZ":this._x=f*c*_+d*m*h,this._y=d*m*_-f*c*h,this._z=d*c*h+f*m*_,this._w=d*c*_-f*m*h;break;case"YXZ":this._x=f*c*_+d*m*h,this._y=d*m*_-f*c*h,this._z=d*c*h-f*m*_,this._w=d*c*_+f*m*h;break;case"ZXY":this._x=f*c*_-d*m*h,this._y=d*m*_+f*c*h,this._z=d*c*h+f*m*_,this._w=d*c*_-f*m*h;break;case"ZYX":this._x=f*c*_-d*m*h,this._y=d*m*_+f*c*h,this._z=d*c*h-f*m*_,this._w=d*c*_+f*m*h;break;case"YZX":this._x=f*c*_+d*m*h,this._y=d*m*_+f*c*h,this._z=d*c*h-f*m*_,this._w=d*c*_-f*m*h;break;case"XZY":this._x=f*c*_-d*m*h,this._y=d*m*_-f*c*h,this._z=d*c*h+f*m*_,this._w=d*c*_+f*m*h;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],s=t[4],r=t[8],o=t[1],a=t[5],l=t[9],d=t[2],c=t[6],_=t[10],f=i+a+_;if(f>0){const m=.5/Math.sqrt(f+1);this._w=.25/m,this._x=(c-l)*m,this._y=(r-d)*m,this._z=(o-s)*m}else if(i>a&&i>_){const m=2*Math.sqrt(1+i-a-_);this._w=(c-l)/m,this._x=.25*m,this._y=(s+o)/m,this._z=(r+d)/m}else if(a>_){const m=2*Math.sqrt(1+a-i-_);this._w=(r-d)/m,this._x=(s+o)/m,this._y=.25*m,this._z=(l+c)/m}else{const m=2*Math.sqrt(1+_-i-a);this._w=(o-s)/m,this._x=(r+d)/m,this._y=(l+c)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(kn(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,t/i);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,s=e._y,r=e._z,o=e._w,a=t._x,l=t._y,d=t._z,c=t._w;return this._x=i*c+o*a+s*d-r*l,this._y=s*c+o*l+r*a-i*d,this._z=r*c+o*d+i*l-s*a,this._w=o*c-i*a-s*l-r*d,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,s=this._y,r=this._z,o=this._w;let a=o*e._w+i*e._x+s*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=s,this._z=r,this;const l=1-a*a;if(l<=Number.EPSILON){const m=1-t;return this._w=m*o+t*this._w,this._x=m*i+t*this._x,this._y=m*s+t*this._y,this._z=m*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const d=Math.sqrt(l),c=Math.atan2(d,a),_=Math.sin((1-t)*c)/d,f=Math.sin(t*c)/d;return this._w=o*_+this._w*f,this._x=i*_+this._x*f,this._y=s*_+this._y*f,this._z=r*_+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),s=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(s),i*Math.sin(r),i*Math.cos(r),t*Math.sin(s))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class be{constructor(e=0,t=0,i=0){be.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(O1.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(O1.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*s,this.y=r[1]*t+r[4]*i+r[7]*s,this.z=r[2]*t+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=e.elements,o=1/(r[3]*t+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*s+r[12])*o,this.y=(r[1]*t+r[5]*i+r[9]*s+r[13])*o,this.z=(r[2]*t+r[6]*i+r[10]*s+r[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z,l=e.w,d=2*(o*s-a*i),c=2*(a*t-r*s),_=2*(r*i-o*t);return this.x=t+l*d+o*_-a*c,this.y=i+l*c+a*d-r*_,this.z=s+l*_+r*c-o*d,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*s,this.y=r[1]*t+r[5]*i+r[9]*s,this.z=r[2]*t+r[6]*i+r[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,s=e.y,r=e.z,o=t.x,a=t.y,l=t.z;return this.x=s*l-r*a,this.y=r*o-i*l,this.z=i*a-s*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Km.copy(this).projectOnVector(e),this.sub(Km)}reflect(e){return this.sub(Km.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(kn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return t*t+i*i+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const s=Math.sin(t)*e;return this.x=s*Math.sin(i),this.y=Math.cos(t)*e,this.z=s*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Km=new be,O1=new Dr;class Ks{constructor(e=new be(1/0,1/0,1/0),t=new be(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Ii),Ii.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ml),td.subVectors(this.max,ml),Mo.subVectors(e.a,ml),Do.subVectors(e.b,ml),ko.subVectors(e.c,ml),er.subVectors(Do,Mo),tr.subVectors(ko,Do),Gr.subVectors(Mo,ko);let t=[0,-er.z,er.y,0,-tr.z,tr.y,0,-Gr.z,Gr.y,er.z,0,-er.x,tr.z,0,-tr.x,Gr.z,0,-Gr.x,-er.y,er.x,0,-tr.y,tr.x,0,-Gr.y,Gr.x,0];return!jm(t,Mo,Do,ko,td)||(t=[1,0,0,0,1,0,0,0,1],!jm(t,Mo,Do,ko,td))?!1:(nd.crossVectors(er,tr),t=[nd.x,nd.y,nd.z],jm(t,Mo,Do,ko,td))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ii).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ii).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(xs[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),xs[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),xs[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),xs[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),xs[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),xs[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),xs[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),xs[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(xs),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const xs=[new be,new be,new be,new be,new be,new be,new be,new be],Ii=new be,ed=new Ks,Mo=new be,Do=new be,ko=new be,er=new be,tr=new be,Gr=new be,ml=new be,td=new be,nd=new be,zr=new be;function jm(n,e,t,i,s){for(let r=0,o=n.length-3;r<=o;r+=3){zr.fromArray(n,r);const a=s.x*Math.abs(zr.x)+s.y*Math.abs(zr.y)+s.z*Math.abs(zr.z),l=e.dot(zr),d=t.dot(zr),c=i.dot(zr);if(Math.max(-Math.max(l,d,c),Math.min(l,d,c))>a)return!1}return!0}const zCt=new Ks,gl=new be,Qm=new be;class hs{constructor(e=new be,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):zCt.setFromPoints(e).getCenter(i);let s=0;for(let r=0,o=e.length;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;gl.subVectors(e,this.center);const t=gl.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),s=(i-this.radius)*.5;this.center.addScaledVector(gl,s/i),this.radius+=s}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Qm.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(gl.copy(e.center).add(Qm)),this.expandByPoint(gl.copy(e.center).sub(Qm))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Cs=new be,Xm=new be,id=new be,nr=new be,Zm=new be,sd=new be,Jm=new be;class _p{constructor(e=new be,t=new be(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Cs)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Cs.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Cs.copy(this.origin).addScaledVector(this.direction,t),Cs.distanceToSquared(e))}distanceSqToSegment(e,t,i,s){Xm.copy(e).add(t).multiplyScalar(.5),id.copy(t).sub(e).normalize(),nr.copy(this.origin).sub(Xm);const r=e.distanceTo(t)*.5,o=-this.direction.dot(id),a=nr.dot(this.direction),l=-nr.dot(id),d=nr.lengthSq(),c=Math.abs(1-o*o);let _,f,m,h;if(c>0)if(_=o*l-a,f=o*a-l,h=r*c,_>=0)if(f>=-h)if(f<=h){const E=1/c;_*=E,f*=E,m=_*(_+o*f+2*a)+f*(o*_+f+2*l)+d}else f=r,_=Math.max(0,-(o*f+a)),m=-_*_+f*(f+2*l)+d;else f=-r,_=Math.max(0,-(o*f+a)),m=-_*_+f*(f+2*l)+d;else f<=-h?(_=Math.max(0,-(-o*r+a)),f=_>0?-r:Math.min(Math.max(-r,-l),r),m=-_*_+f*(f+2*l)+d):f<=h?(_=0,f=Math.min(Math.max(-r,-l),r),m=f*(f+2*l)+d):(_=Math.max(0,-(o*r+a)),f=_>0?r:Math.min(Math.max(-r,-l),r),m=-_*_+f*(f+2*l)+d);else f=o>0?-r:r,_=Math.max(0,-(o*f+a)),m=-_*_+f*(f+2*l)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,_),s&&s.copy(Xm).addScaledVector(id,f),m}intersectSphere(e,t){Cs.subVectors(e.center,this.origin);const i=Cs.dot(this.direction),s=Cs.dot(Cs)-i*i,r=e.radius*e.radius;if(s>r)return null;const o=Math.sqrt(r-s),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,s,r,o,a,l;const d=1/this.direction.x,c=1/this.direction.y,_=1/this.direction.z,f=this.origin;return d>=0?(i=(e.min.x-f.x)*d,s=(e.max.x-f.x)*d):(i=(e.max.x-f.x)*d,s=(e.min.x-f.x)*d),c>=0?(r=(e.min.y-f.y)*c,o=(e.max.y-f.y)*c):(r=(e.max.y-f.y)*c,o=(e.min.y-f.y)*c),i>o||r>s||((r>i||isNaN(i))&&(i=r),(o=0?(a=(e.min.z-f.z)*_,l=(e.max.z-f.z)*_):(a=(e.max.z-f.z)*_,l=(e.min.z-f.z)*_),i>l||a>s)||((a>i||i!==i)&&(i=a),(l=0?i:s,t)}intersectsBox(e){return this.intersectBox(e,Cs)!==null}intersectTriangle(e,t,i,s,r){Zm.subVectors(t,e),sd.subVectors(i,e),Jm.crossVectors(Zm,sd);let o=this.direction.dot(Jm),a;if(o>0){if(s)return null;a=1}else if(o<0)a=-1,o=-o;else return null;nr.subVectors(this.origin,e);const l=a*this.direction.dot(sd.crossVectors(nr,sd));if(l<0)return null;const d=a*this.direction.dot(Zm.cross(nr));if(d<0||l+d>o)return null;const c=-a*nr.dot(Jm);return c<0?null:this.at(c/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class At{constructor(e,t,i,s,r,o,a,l,d,c,_,f,m,h,E,b){At.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,s,r,o,a,l,d,c,_,f,m,h,E,b)}set(e,t,i,s,r,o,a,l,d,c,_,f,m,h,E,b){const g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=s,g[1]=r,g[5]=o,g[9]=a,g[13]=l,g[2]=d,g[6]=c,g[10]=_,g[14]=f,g[3]=m,g[7]=h,g[11]=E,g[15]=b,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new At().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,s=1/Lo.setFromMatrixColumn(e,0).length(),r=1/Lo.setFromMatrixColumn(e,1).length(),o=1/Lo.setFromMatrixColumn(e,2).length();return t[0]=i[0]*s,t[1]=i[1]*s,t[2]=i[2]*s,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,s=e.y,r=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(s),d=Math.sin(s),c=Math.cos(r),_=Math.sin(r);if(e.order==="XYZ"){const f=o*c,m=o*_,h=a*c,E=a*_;t[0]=l*c,t[4]=-l*_,t[8]=d,t[1]=m+h*d,t[5]=f-E*d,t[9]=-a*l,t[2]=E-f*d,t[6]=h+m*d,t[10]=o*l}else if(e.order==="YXZ"){const f=l*c,m=l*_,h=d*c,E=d*_;t[0]=f+E*a,t[4]=h*a-m,t[8]=o*d,t[1]=o*_,t[5]=o*c,t[9]=-a,t[2]=m*a-h,t[6]=E+f*a,t[10]=o*l}else if(e.order==="ZXY"){const f=l*c,m=l*_,h=d*c,E=d*_;t[0]=f-E*a,t[4]=-o*_,t[8]=h+m*a,t[1]=m+h*a,t[5]=o*c,t[9]=E-f*a,t[2]=-o*d,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const f=o*c,m=o*_,h=a*c,E=a*_;t[0]=l*c,t[4]=h*d-m,t[8]=f*d+E,t[1]=l*_,t[5]=E*d+f,t[9]=m*d-h,t[2]=-d,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const f=o*l,m=o*d,h=a*l,E=a*d;t[0]=l*c,t[4]=E-f*_,t[8]=h*_+m,t[1]=_,t[5]=o*c,t[9]=-a*c,t[2]=-d*c,t[6]=m*_+h,t[10]=f-E*_}else if(e.order==="XZY"){const f=o*l,m=o*d,h=a*l,E=a*d;t[0]=l*c,t[4]=-_,t[8]=d*c,t[1]=f*_+E,t[5]=o*c,t[9]=m*_-h,t[2]=h*_-m,t[6]=a*c,t[10]=E*_+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(VCt,e,HCt)}lookAt(e,t,i){const s=this.elements;return ii.subVectors(e,t),ii.lengthSq()===0&&(ii.z=1),ii.normalize(),ir.crossVectors(i,ii),ir.lengthSq()===0&&(Math.abs(i.z)===1?ii.x+=1e-4:ii.z+=1e-4,ii.normalize(),ir.crossVectors(i,ii)),ir.normalize(),rd.crossVectors(ii,ir),s[0]=ir.x,s[4]=rd.x,s[8]=ii.x,s[1]=ir.y,s[5]=rd.y,s[9]=ii.y,s[2]=ir.z,s[6]=rd.z,s[10]=ii.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[4],l=i[8],d=i[12],c=i[1],_=i[5],f=i[9],m=i[13],h=i[2],E=i[6],b=i[10],g=i[14],v=i[3],y=i[7],T=i[11],C=i[15],x=s[0],O=s[4],R=s[8],S=s[12],A=s[1],U=s[5],F=s[9],K=s[13],L=s[2],H=s[6],G=s[10],P=s[14],j=s[3],Y=s[7],Q=s[11],ae=s[15];return r[0]=o*x+a*A+l*L+d*j,r[4]=o*O+a*U+l*H+d*Y,r[8]=o*R+a*F+l*G+d*Q,r[12]=o*S+a*K+l*P+d*ae,r[1]=c*x+_*A+f*L+m*j,r[5]=c*O+_*U+f*H+m*Y,r[9]=c*R+_*F+f*G+m*Q,r[13]=c*S+_*K+f*P+m*ae,r[2]=h*x+E*A+b*L+g*j,r[6]=h*O+E*U+b*H+g*Y,r[10]=h*R+E*F+b*G+g*Q,r[14]=h*S+E*K+b*P+g*ae,r[3]=v*x+y*A+T*L+C*j,r[7]=v*O+y*U+T*H+C*Y,r[11]=v*R+y*F+T*G+C*Q,r[15]=v*S+y*K+T*P+C*ae,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],s=e[8],r=e[12],o=e[1],a=e[5],l=e[9],d=e[13],c=e[2],_=e[6],f=e[10],m=e[14],h=e[3],E=e[7],b=e[11],g=e[15];return h*(+r*l*_-s*d*_-r*a*f+i*d*f+s*a*m-i*l*m)+E*(+t*l*m-t*d*f+r*o*f-s*o*m+s*d*c-r*l*c)+b*(+t*d*_-t*a*m-r*o*_+i*o*m+r*a*c-i*d*c)+g*(-s*a*c-t*l*_+t*a*f+s*o*_-i*o*f+i*l*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],d=e[7],c=e[8],_=e[9],f=e[10],m=e[11],h=e[12],E=e[13],b=e[14],g=e[15],v=_*b*d-E*f*d+E*l*m-a*b*m-_*l*g+a*f*g,y=h*f*d-c*b*d-h*l*m+o*b*m+c*l*g-o*f*g,T=c*E*d-h*_*d+h*a*m-o*E*m-c*a*g+o*_*g,C=h*_*l-c*E*l-h*a*f+o*E*f+c*a*b-o*_*b,x=t*v+i*y+s*T+r*C;if(x===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const O=1/x;return e[0]=v*O,e[1]=(E*f*r-_*b*r-E*s*m+i*b*m+_*s*g-i*f*g)*O,e[2]=(a*b*r-E*l*r+E*s*d-i*b*d-a*s*g+i*l*g)*O,e[3]=(_*l*r-a*f*r-_*s*d+i*f*d+a*s*m-i*l*m)*O,e[4]=y*O,e[5]=(c*b*r-h*f*r+h*s*m-t*b*m-c*s*g+t*f*g)*O,e[6]=(h*l*r-o*b*r-h*s*d+t*b*d+o*s*g-t*l*g)*O,e[7]=(o*f*r-c*l*r+c*s*d-t*f*d-o*s*m+t*l*m)*O,e[8]=T*O,e[9]=(h*_*r-c*E*r-h*i*m+t*E*m+c*i*g-t*_*g)*O,e[10]=(o*E*r-h*a*r+h*i*d-t*E*d-o*i*g+t*a*g)*O,e[11]=(c*a*r-o*_*r-c*i*d+t*_*d+o*i*m-t*a*m)*O,e[12]=C*O,e[13]=(c*E*s-h*_*s+h*i*f-t*E*f-c*i*b+t*_*b)*O,e[14]=(h*a*s-o*E*s-h*i*l+t*E*l+o*i*b-t*a*b)*O,e[15]=(o*_*s-c*a*s+c*i*l-t*_*l-o*i*f+t*a*f)*O,this}scale(e){const t=this.elements,i=e.x,s=e.y,r=e.z;return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,s))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),s=Math.sin(t),r=1-i,o=e.x,a=e.y,l=e.z,d=r*o,c=r*a;return this.set(d*o+i,d*a-s*l,d*l+s*a,0,d*a+s*l,c*a+i,c*l-s*o,0,d*l-s*a,c*l+s*o,r*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,s,r,o){return this.set(1,i,r,0,e,1,o,0,t,s,1,0,0,0,0,1),this}compose(e,t,i){const s=this.elements,r=t._x,o=t._y,a=t._z,l=t._w,d=r+r,c=o+o,_=a+a,f=r*d,m=r*c,h=r*_,E=o*c,b=o*_,g=a*_,v=l*d,y=l*c,T=l*_,C=i.x,x=i.y,O=i.z;return s[0]=(1-(E+g))*C,s[1]=(m+T)*C,s[2]=(h-y)*C,s[3]=0,s[4]=(m-T)*x,s[5]=(1-(f+g))*x,s[6]=(b+v)*x,s[7]=0,s[8]=(h+y)*O,s[9]=(b-v)*O,s[10]=(1-(f+E))*O,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,i){const s=this.elements;let r=Lo.set(s[0],s[1],s[2]).length();const o=Lo.set(s[4],s[5],s[6]).length(),a=Lo.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],Mi.copy(this);const d=1/r,c=1/o,_=1/a;return Mi.elements[0]*=d,Mi.elements[1]*=d,Mi.elements[2]*=d,Mi.elements[4]*=c,Mi.elements[5]*=c,Mi.elements[6]*=c,Mi.elements[8]*=_,Mi.elements[9]*=_,Mi.elements[10]*=_,t.setFromRotationMatrix(Mi),i.x=r,i.y=o,i.z=a,this}makePerspective(e,t,i,s,r,o,a=Ls){const l=this.elements,d=2*r/(t-e),c=2*r/(i-s),_=(t+e)/(t-e),f=(i+s)/(i-s);let m,h;if(a===Ls)m=-(o+r)/(o-r),h=-2*o*r/(o-r);else if(a===yu)m=-o/(o-r),h=-o*r/(o-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=d,l[4]=0,l[8]=_,l[12]=0,l[1]=0,l[5]=c,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=h,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,s,r,o,a=Ls){const l=this.elements,d=1/(t-e),c=1/(i-s),_=1/(o-r),f=(t+e)*d,m=(i+s)*c;let h,E;if(a===Ls)h=(o+r)*_,E=-2*_;else if(a===yu)h=r*_,E=-1*_;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*d,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*c,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=E,l[14]=-h,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<16;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const Lo=new be,Mi=new At,VCt=new be(0,0,0),HCt=new be(1,1,1),ir=new be,rd=new be,ii=new be,I1=new At,M1=new Dr;class hp{constructor(e=0,t=0,i=0,s=hp.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,s=this._order){return this._x=e,this._y=t,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const s=e.elements,r=s[0],o=s[4],a=s[8],l=s[1],d=s[5],c=s[9],_=s[2],f=s[6],m=s[10];switch(t){case"XYZ":this._y=Math.asin(kn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,m),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(f,d),this._z=0);break;case"YXZ":this._x=Math.asin(-kn(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,d)):(this._y=Math.atan2(-_,r),this._z=0);break;case"ZXY":this._x=Math.asin(kn(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-_,m),this._z=Math.atan2(-o,d)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-kn(_,-1,1)),Math.abs(_)<.9999999?(this._x=Math.atan2(f,m),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-o,d));break;case"YZX":this._z=Math.asin(kn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-c,d),this._y=Math.atan2(-_,r)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-kn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,d),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-c,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return I1.makeRotationFromQuaternion(e),this.setFromRotationMatrix(I1,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return M1.setFromEuler(this),this.setFromQuaternion(M1,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}hp.DEFAULT_ORDER="XYZ";class pI{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.visibility=this._visibility,s.active=this._active,s.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),s.maxGeometryCount=this._maxGeometryCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.geometryCount=this._geometryCount,s.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(s.boundingSphere={center:s.boundingSphere.center.toArray(),radius:s.boundingSphere.radius}),this.boundingBox!==null&&(s.boundingBox={min:s.boundingBox.min.toArray(),max:s.boundingBox.max.toArray()}));function r(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let d=0,c=l.length;d0){s.children=[];for(let a=0;a0){s.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),d.length>0&&(i.textures=d),c.length>0&&(i.images=c),_.length>0&&(i.shapes=_),f.length>0&&(i.skeletons=f),m.length>0&&(i.animations=m),h.length>0&&(i.nodes=h)}return i.object=s,i;function o(a){const l=[];for(const d in a){const c=a[d];delete c.metadata,l.push(c)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,t,i,s,r){Di.subVectors(s,t),As.subVectors(i,t),eg.subVectors(e,t);const o=Di.dot(Di),a=Di.dot(As),l=Di.dot(eg),d=As.dot(As),c=As.dot(eg),_=o*d-a*a;if(_===0)return r.set(-2,-1,-1);const f=1/_,m=(d*l-a*c)*f,h=(o*c-a*l)*f;return r.set(1-m-h,h,m)}static containsPoint(e,t,i,s){return this.getBarycoord(e,t,i,s,ws),ws.x>=0&&ws.y>=0&&ws.x+ws.y<=1}static getUV(e,t,i,s,r,o,a,l){return ad===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),ad=!0),this.getInterpolation(e,t,i,s,r,o,a,l)}static getInterpolation(e,t,i,s,r,o,a,l){return this.getBarycoord(e,t,i,s,ws),l.setScalar(0),l.addScaledVector(r,ws.x),l.addScaledVector(o,ws.y),l.addScaledVector(a,ws.z),l}static isFrontFacing(e,t,i,s){return Di.subVectors(i,t),As.subVectors(e,t),Di.cross(As).dot(s)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,s){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,i,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,s),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Di.subVectors(this.c,this.b),As.subVectors(this.a,this.b),Di.cross(As).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Pi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Pi.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,s,r){return ad===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),ad=!0),Pi.getInterpolation(e,this.a,this.b,this.c,t,i,s,r)}getInterpolation(e,t,i,s,r){return Pi.getInterpolation(e,this.a,this.b,this.c,t,i,s,r)}containsPoint(e){return Pi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Pi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,s=this.b,r=this.c;let o,a;Uo.subVectors(s,i),Fo.subVectors(r,i),tg.subVectors(e,i);const l=Uo.dot(tg),d=Fo.dot(tg);if(l<=0&&d<=0)return t.copy(i);ng.subVectors(e,s);const c=Uo.dot(ng),_=Fo.dot(ng);if(c>=0&&_<=c)return t.copy(s);const f=l*_-c*d;if(f<=0&&l>=0&&c<=0)return o=l/(l-c),t.copy(i).addScaledVector(Uo,o);ig.subVectors(e,r);const m=Uo.dot(ig),h=Fo.dot(ig);if(h>=0&&m<=h)return t.copy(r);const E=m*d-l*h;if(E<=0&&d>=0&&h<=0)return a=d/(d-h),t.copy(i).addScaledVector(Fo,a);const b=c*h-m*_;if(b<=0&&_-c>=0&&m-h>=0)return U1.subVectors(r,s),a=(_-c)/(_-c+(m-h)),t.copy(s).addScaledVector(U1,a);const g=1/(b+E+f);return o=E*g,a=f*g,t.copy(i).addScaledVector(Uo,o).addScaledVector(Fo,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const _I={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},sr={h:0,s:0,l:0},ld={h:0,s:0,l:0};function sg(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class gt{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=rn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ft.toWorkingColorSpace(this,t),this}setRGB(e,t,i,s=Ft.workingColorSpace){return this.r=e,this.g=t,this.b=i,Ft.toWorkingColorSpace(this,s),this}setHSL(e,t,i,s=Ft.workingColorSpace){if(e=ev(e,1),t=kn(t,0,1),i=kn(i,0,1),t===0)this.r=this.g=this.b=i;else{const r=i<=.5?i*(1+t):i+t-i*t,o=2*i-r;this.r=sg(o,r,e+1/3),this.g=sg(o,r,e),this.b=sg(o,r,e-1/3)}return Ft.toWorkingColorSpace(this,s),this}setStyle(e,t=rn){function i(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=s[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(r,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=rn){const i=_I[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=la(e.r),this.g=la(e.g),this.b=la(e.b),this}copyLinearToSRGB(e){return this.r=$m(e.r),this.g=$m(e.g),this.b=$m(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=rn){return Ft.fromWorkingColorSpace(Mn.copy(this),e),Math.round(kn(Mn.r*255,0,255))*65536+Math.round(kn(Mn.g*255,0,255))*256+Math.round(kn(Mn.b*255,0,255))}getHexString(e=rn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ft.workingColorSpace){Ft.fromWorkingColorSpace(Mn.copy(this),t);const i=Mn.r,s=Mn.g,r=Mn.b,o=Math.max(i,s,r),a=Math.min(i,s,r);let l,d;const c=(a+o)/2;if(a===o)l=0,d=0;else{const _=o-a;switch(d=c<=.5?_/(o+a):_/(2-o-a),o){case i:l=(s-r)/_+(s0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const s=this[t];if(s===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==aa&&(i.blending=this.blending),this.side!==Vs&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==ab&&(i.blendSrc=this.blendSrc),this.blendDst!==lb&&(i.blendDst=this.blendDst),this.blendEquation!==Jr&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==mu&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==x1&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Oo&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Oo&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Oo&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function s(r){const o=[];for(const a in r){const l=r[a];delete l.metadata,o.push(l)}return o}if(t){const r=s(e.textures),o=s(e.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const s=t.length;i=new Array(s);for(let r=0;r!==s;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Er extends Vi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new gt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=QE,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const cn=new be,cd=new Mt;class Yn{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=_b,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=ks,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn('THREE.BufferAttribute: "updateRange" is deprecated and removed in r169. Use "addUpdateRange()" instead.'),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let s=0,r=this.itemSize;s0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const d in l)l[d]!==void 0&&(e[d]=l[d]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const d=i[l];e.data.attributes[l]=d.toJSON(e.data)}const s={};let r=!1;for(const l in this.morphAttributes){const d=this.morphAttributes[l],c=[];for(let _=0,f=d.length;_0&&(s[l]=c,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const s=e.attributes;for(const d in s){const c=s[d];this.setAttribute(d,c.clone(t))}const r=e.morphAttributes;for(const d in r){const c=[],_=r[d];for(let f=0,m=_.length;f0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r(e.far-e.near)**2))&&(F1.copy(r).invert(),Vr.copy(e.ray).applyMatrix4(F1),!(i.boundingBox!==null&&Vr.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Vr)))}_computeIntersections(e,t,i){let s;const r=this.geometry,o=this.material,a=r.index,l=r.attributes.position,d=r.attributes.uv,c=r.attributes.uv1,_=r.attributes.normal,f=r.groups,m=r.drawRange;if(a!==null)if(Array.isArray(o))for(let h=0,E=f.length;ht.far?null:{distance:d,point:md.clone(),object:n}}function gd(n,e,t,i,s,r,o,a,l,d){n.getVertexPosition(a,Go),n.getVertexPosition(l,zo),n.getVertexPosition(d,Vo);const c=XCt(n,e,t,i,Go,zo,Vo,fd);if(c){s&&(pd.fromBufferAttribute(s,a),_d.fromBufferAttribute(s,l),hd.fromBufferAttribute(s,d),c.uv=Pi.getInterpolation(fd,Go,zo,Vo,pd,_d,hd,new Mt)),r&&(pd.fromBufferAttribute(r,a),_d.fromBufferAttribute(r,l),hd.fromBufferAttribute(r,d),c.uv1=Pi.getInterpolation(fd,Go,zo,Vo,pd,_d,hd,new Mt),c.uv2=c.uv1),o&&(G1.fromBufferAttribute(o,a),z1.fromBufferAttribute(o,l),V1.fromBufferAttribute(o,d),c.normal=Pi.getInterpolation(fd,Go,zo,Vo,G1,z1,V1,new be),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));const _={a,b:l,c:d,normal:new be,materialIndex:0};Pi.getNormal(Go,zo,Vo,_.normal),c.face=_}return c}class Cr extends fs{constructor(e=1,t=1,i=1,s=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:s,heightSegments:r,depthSegments:o};const a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);const l=[],d=[],c=[],_=[];let f=0,m=0;h("z","y","x",-1,-1,i,t,e,o,r,0),h("z","y","x",1,-1,i,t,-e,o,r,1),h("x","z","y",1,1,e,i,t,s,o,2),h("x","z","y",1,-1,e,i,-t,s,o,3),h("x","y","z",1,-1,e,t,i,s,r,4),h("x","y","z",-1,-1,e,t,-i,s,r,5),this.setIndex(l),this.setAttribute("position",new Us(d,3)),this.setAttribute("normal",new Us(c,3)),this.setAttribute("uv",new Us(_,2));function h(E,b,g,v,y,T,C,x,O,R,S){const A=T/O,U=C/R,F=T/2,K=C/2,L=x/2,H=O+1,G=R+1;let P=0,j=0;const Y=new be;for(let Q=0;Q0?1:-1,c.push(Y.x,Y.y,Y.z),_.push(te/O),_.push(1-Q/R),P+=1}}for(let Q=0;Q>8&255]+In[n>>16&255]+In[n>>24&255]+"-"+In[e&255]+In[e>>8&255]+"-"+In[e>>16&15|64]+In[e>>24&255]+"-"+In[t&63|128]+In[t>>8&255]+"-"+In[t>>16&255]+In[t>>24&255]+In[i&255]+In[i>>8&255]+In[i>>16&255]+In[i>>24&255]).toLowerCase()}function kn(n,e,t){return Math.max(e,Math.min(t,n))}function ev(n,e){return(n%e+e)%e}function SCt(n,e,t,i,s){return i+(n-e)*(s-i)/(t-e)}function TCt(n,e,t){return n!==e?(t-n)/(e-n):0}function Bl(n,e,t){return(1-t)*n+t*e}function xCt(n,e,t,i){return Bl(n,e,1-Math.exp(-t*i))}function CCt(n,e=1){return e-Math.abs(ev(n,e*2)-e)}function RCt(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function ACt(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function wCt(n,e){return n+Math.floor(Math.random()*(e-n+1))}function NCt(n,e){return n+Math.random()*(e-n)}function OCt(n){return n*(.5-Math.random())}function ICt(n){n!==void 0&&(R1=n);let e=R1+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function MCt(n){return n*Fl}function DCt(n){return n*Na}function fb(n){return(n&n-1)===0&&n!==0}function kCt(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Su(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function LCt(n,e,t,i,s){const r=Math.cos,o=Math.sin,a=r(t/2),l=o(t/2),d=r((e+i)/2),c=o((e+i)/2),_=r((e-i)/2),f=o((e-i)/2),m=r((i-e)/2),h=o((i-e)/2);switch(s){case"XYX":n.set(a*c,l*_,l*f,a*d);break;case"YZY":n.set(l*f,a*c,l*_,a*d);break;case"ZXZ":n.set(l*_,l*f,a*c,a*d);break;case"XZX":n.set(a*c,l*h,l*m,a*d);break;case"YXY":n.set(l*m,a*c,l*h,a*d);break;case"ZYZ":n.set(l*h,l*m,a*c,a*d);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function es(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Ht(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const PCt={DEG2RAD:Fl,RAD2DEG:Na,generateUUID:zi,clamp:kn,euclideanModulo:ev,mapLinear:SCt,inverseLerp:TCt,lerp:Bl,damp:xCt,pingpong:CCt,smoothstep:RCt,smootherstep:ACt,randInt:wCt,randFloat:NCt,randFloatSpread:OCt,seededRandom:ICt,degToRad:MCt,radToDeg:DCt,isPowerOfTwo:fb,ceilPowerOfTwo:kCt,floorPowerOfTwo:Su,setQuaternionFromProperEuler:LCt,normalize:Ht,denormalize:es};class Mt{constructor(e=0,t=0){Mt.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6],this.y=s[1]*t+s[4]*i+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(kn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),s=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*i-o*s+e.x,this.y=r*s+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Rt{constructor(e,t,i,s,r,o,a,l,d){Rt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,s,r,o,a,l,d)}set(e,t,i,s,r,o,a,l,d){const c=this.elements;return c[0]=e,c[1]=s,c[2]=a,c[3]=t,c[4]=r,c[5]=l,c[6]=i,c[7]=o,c[8]=d,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[3],l=i[6],d=i[1],c=i[4],_=i[7],f=i[2],m=i[5],h=i[8],E=s[0],b=s[3],g=s[6],v=s[1],y=s[4],T=s[7],C=s[2],x=s[5],O=s[8];return r[0]=o*E+a*v+l*C,r[3]=o*b+a*y+l*x,r[6]=o*g+a*T+l*O,r[1]=d*E+c*v+_*C,r[4]=d*b+c*y+_*x,r[7]=d*g+c*T+_*O,r[2]=f*E+m*v+h*C,r[5]=f*b+m*y+h*x,r[8]=f*g+m*T+h*O,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],d=e[7],c=e[8];return t*o*c-t*a*d-i*r*c+i*a*l+s*r*d-s*o*l}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],d=e[7],c=e[8],_=c*o-a*d,f=a*l-c*r,m=d*r-o*l,h=t*_+i*f+s*m;if(h===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/h;return e[0]=_*E,e[1]=(s*d-c*i)*E,e[2]=(a*i-s*o)*E,e[3]=f*E,e[4]=(c*t-s*l)*E,e[5]=(s*r-a*t)*E,e[6]=m*E,e[7]=(i*l-d*t)*E,e[8]=(o*t-i*r)*E,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,s,r,o,a){const l=Math.cos(r),d=Math.sin(r);return this.set(i*l,i*d,-i*(l*o+d*a)+o+e,-s*d,s*l,-s*(-d*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Ym.makeScale(e,t)),this}rotate(e){return this.premultiply(Ym.makeRotation(-e)),this}translate(e,t){return this.premultiply(Ym.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<9;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Ym=new Rt;function lI(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function lc(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function UCt(){const n=lc("canvas");return n.style.display="block",n}const A1={};function Gl(n){n in A1||(A1[n]=!0,console.warn(n))}const w1=new Rt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),N1=new Rt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Jc={[Nn]:{transfer:bu,primaries:Eu,toReference:n=>n,fromReference:n=>n},[rn]:{transfer:Xt,primaries:Eu,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[pp]:{transfer:bu,primaries:vu,toReference:n=>n.applyMatrix3(N1),fromReference:n=>n.applyMatrix3(w1)},[JE]:{transfer:Xt,primaries:vu,toReference:n=>n.convertSRGBToLinear().applyMatrix3(N1),fromReference:n=>n.applyMatrix3(w1).convertLinearToSRGB()}},FCt=new Set([Nn,pp]),Ft={enabled:!0,_workingColorSpace:Nn,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(n){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!n},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!FCt.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=Jc[e].toReference,s=Jc[t].fromReference;return s(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return Jc[n].primaries},getTransfer:function(n){return n===Ei?bu:Jc[n].transfer}};function la(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function $m(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Io;class cI{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Io===void 0&&(Io=lc("canvas")),Io.width=e.width,Io.height=e.height;const i=Io.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Io}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=lc("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height),r=s.data;for(let o=0;o0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==QO)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ra:e.x=e.x-Math.floor(e.x);break;case gi:e.x=e.x<0?0:1;break;case gu:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Ra:e.y=e.y-Math.floor(e.y);break;case gi:e.y=e.y<0?0:1;break;case gu:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return Gl("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===rn?uo:oI}set encoding(e){Gl("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===uo?rn:Ei}}wn.DEFAULT_IMAGE=null;wn.DEFAULT_MAPPING=QO;wn.DEFAULT_ANISOTROPY=1;class Wt{constructor(e=0,t=0,i=0,s=1){Wt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,s){return this.x=e,this.y=t,this.z=i,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*s+o[12]*r,this.y=o[1]*t+o[5]*i+o[9]*s+o[13]*r,this.z=o[2]*t+o[6]*i+o[10]*s+o[14]*r,this.w=o[3]*t+o[7]*i+o[11]*s+o[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,s,r;const l=e.elements,d=l[0],c=l[4],_=l[8],f=l[1],m=l[5],h=l[9],E=l[2],b=l[6],g=l[10];if(Math.abs(c-f)<.01&&Math.abs(_-E)<.01&&Math.abs(h-b)<.01){if(Math.abs(c+f)<.1&&Math.abs(_+E)<.1&&Math.abs(h+b)<.1&&Math.abs(d+m+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const y=(d+1)/2,T=(m+1)/2,C=(g+1)/2,x=(c+f)/4,O=(_+E)/4,R=(h+b)/4;return y>T&&y>C?y<.01?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(y),s=x/i,r=O/i):T>C?T<.01?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(T),i=x/s,r=R/s):C<.01?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(C),i=O/r,s=R/r),this.set(i,s,r,t),this}let v=Math.sqrt((b-h)*(b-h)+(_-E)*(_-E)+(f-c)*(f-c));return Math.abs(v)<.001&&(v=1),this.x=(b-h)/v,this.y=(_-E)/v,this.z=(f-c)/v,this.w=Math.acos((d+m+g-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class zCt extends ja{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Wt(0,0,e,t),this.scissorTest=!1,this.viewport=new Wt(0,0,e,t);const s={width:e,height:t,depth:1};i.encoding!==void 0&&(Gl("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===uo?rn:Ei),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:jn,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},i),this.texture=new wn(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps,this.texture.internalFormat=i.internalFormat,this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new dI(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class bo extends zCt{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class uI extends wn{constructor(e=null,t=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:s},this.magFilter=En,this.minFilter=En,this.wrapR=gi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class VCt extends wn{constructor(e=null,t=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:s},this.magFilter=En,this.minFilter=En,this.wrapR=gi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Dr{constructor(e=0,t=0,i=0,s=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=s}static slerpFlat(e,t,i,s,r,o,a){let l=i[s+0],d=i[s+1],c=i[s+2],_=i[s+3];const f=r[o+0],m=r[o+1],h=r[o+2],E=r[o+3];if(a===0){e[t+0]=l,e[t+1]=d,e[t+2]=c,e[t+3]=_;return}if(a===1){e[t+0]=f,e[t+1]=m,e[t+2]=h,e[t+3]=E;return}if(_!==E||l!==f||d!==m||c!==h){let b=1-a;const g=l*f+d*m+c*h+_*E,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){const C=Math.sqrt(y),x=Math.atan2(C,g*v);b=Math.sin(b*x)/C,a=Math.sin(a*x)/C}const T=a*v;if(l=l*b+f*T,d=d*b+m*T,c=c*b+h*T,_=_*b+E*T,b===1-a){const C=1/Math.sqrt(l*l+d*d+c*c+_*_);l*=C,d*=C,c*=C,_*=C}}e[t]=l,e[t+1]=d,e[t+2]=c,e[t+3]=_}static multiplyQuaternionsFlat(e,t,i,s,r,o){const a=i[s],l=i[s+1],d=i[s+2],c=i[s+3],_=r[o],f=r[o+1],m=r[o+2],h=r[o+3];return e[t]=a*h+c*_+l*m-d*f,e[t+1]=l*h+c*f+d*_-a*m,e[t+2]=d*h+c*m+a*f-l*_,e[t+3]=c*h-a*_-l*f-d*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,s){return this._x=e,this._y=t,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const i=e._x,s=e._y,r=e._z,o=e._order,a=Math.cos,l=Math.sin,d=a(i/2),c=a(s/2),_=a(r/2),f=l(i/2),m=l(s/2),h=l(r/2);switch(o){case"XYZ":this._x=f*c*_+d*m*h,this._y=d*m*_-f*c*h,this._z=d*c*h+f*m*_,this._w=d*c*_-f*m*h;break;case"YXZ":this._x=f*c*_+d*m*h,this._y=d*m*_-f*c*h,this._z=d*c*h-f*m*_,this._w=d*c*_+f*m*h;break;case"ZXY":this._x=f*c*_-d*m*h,this._y=d*m*_+f*c*h,this._z=d*c*h+f*m*_,this._w=d*c*_-f*m*h;break;case"ZYX":this._x=f*c*_-d*m*h,this._y=d*m*_+f*c*h,this._z=d*c*h-f*m*_,this._w=d*c*_+f*m*h;break;case"YZX":this._x=f*c*_+d*m*h,this._y=d*m*_+f*c*h,this._z=d*c*h-f*m*_,this._w=d*c*_-f*m*h;break;case"XZY":this._x=f*c*_-d*m*h,this._y=d*m*_-f*c*h,this._z=d*c*h+f*m*_,this._w=d*c*_+f*m*h;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],s=t[4],r=t[8],o=t[1],a=t[5],l=t[9],d=t[2],c=t[6],_=t[10],f=i+a+_;if(f>0){const m=.5/Math.sqrt(f+1);this._w=.25/m,this._x=(c-l)*m,this._y=(r-d)*m,this._z=(o-s)*m}else if(i>a&&i>_){const m=2*Math.sqrt(1+i-a-_);this._w=(c-l)/m,this._x=.25*m,this._y=(s+o)/m,this._z=(r+d)/m}else if(a>_){const m=2*Math.sqrt(1+a-i-_);this._w=(r-d)/m,this._x=(s+o)/m,this._y=.25*m,this._z=(l+c)/m}else{const m=2*Math.sqrt(1+_-i-a);this._w=(o-s)/m,this._x=(r+d)/m,this._y=(l+c)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(kn(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,t/i);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,s=e._y,r=e._z,o=e._w,a=t._x,l=t._y,d=t._z,c=t._w;return this._x=i*c+o*a+s*d-r*l,this._y=s*c+o*l+r*a-i*d,this._z=r*c+o*d+i*l-s*a,this._w=o*c-i*a-s*l-r*d,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,s=this._y,r=this._z,o=this._w;let a=o*e._w+i*e._x+s*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=s,this._z=r,this;const l=1-a*a;if(l<=Number.EPSILON){const m=1-t;return this._w=m*o+t*this._w,this._x=m*i+t*this._x,this._y=m*s+t*this._y,this._z=m*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const d=Math.sqrt(l),c=Math.atan2(d,a),_=Math.sin((1-t)*c)/d,f=Math.sin(t*c)/d;return this._w=o*_+this._w*f,this._x=i*_+this._x*f,this._y=s*_+this._y*f,this._z=r*_+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),s=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(s),i*Math.sin(r),i*Math.cos(r),t*Math.sin(s))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class be{constructor(e=0,t=0,i=0){be.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(O1.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(O1.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*s,this.y=r[1]*t+r[4]*i+r[7]*s,this.z=r[2]*t+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=e.elements,o=1/(r[3]*t+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*s+r[12])*o,this.y=(r[1]*t+r[5]*i+r[9]*s+r[13])*o,this.z=(r[2]*t+r[6]*i+r[10]*s+r[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z,l=e.w,d=2*(o*s-a*i),c=2*(a*t-r*s),_=2*(r*i-o*t);return this.x=t+l*d+o*_-a*c,this.y=i+l*c+a*d-r*_,this.z=s+l*_+r*c-o*d,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*s,this.y=r[1]*t+r[5]*i+r[9]*s,this.z=r[2]*t+r[6]*i+r[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,s=e.y,r=e.z,o=t.x,a=t.y,l=t.z;return this.x=s*l-r*a,this.y=r*o-i*l,this.z=i*a-s*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Km.copy(this).projectOnVector(e),this.sub(Km)}reflect(e){return this.sub(Km.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(kn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return t*t+i*i+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const s=Math.sin(t)*e;return this.x=s*Math.sin(i),this.y=Math.cos(t)*e,this.z=s*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Km=new be,O1=new Dr;class Ks{constructor(e=new be(1/0,1/0,1/0),t=new be(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Ii),Ii.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ml),td.subVectors(this.max,ml),Mo.subVectors(e.a,ml),Do.subVectors(e.b,ml),ko.subVectors(e.c,ml),er.subVectors(Do,Mo),tr.subVectors(ko,Do),Gr.subVectors(Mo,ko);let t=[0,-er.z,er.y,0,-tr.z,tr.y,0,-Gr.z,Gr.y,er.z,0,-er.x,tr.z,0,-tr.x,Gr.z,0,-Gr.x,-er.y,er.x,0,-tr.y,tr.x,0,-Gr.y,Gr.x,0];return!jm(t,Mo,Do,ko,td)||(t=[1,0,0,0,1,0,0,0,1],!jm(t,Mo,Do,ko,td))?!1:(nd.crossVectors(er,tr),t=[nd.x,nd.y,nd.z],jm(t,Mo,Do,ko,td))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ii).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ii).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(xs[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),xs[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),xs[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),xs[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),xs[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),xs[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),xs[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),xs[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(xs),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const xs=[new be,new be,new be,new be,new be,new be,new be,new be],Ii=new be,ed=new Ks,Mo=new be,Do=new be,ko=new be,er=new be,tr=new be,Gr=new be,ml=new be,td=new be,nd=new be,zr=new be;function jm(n,e,t,i,s){for(let r=0,o=n.length-3;r<=o;r+=3){zr.fromArray(n,r);const a=s.x*Math.abs(zr.x)+s.y*Math.abs(zr.y)+s.z*Math.abs(zr.z),l=e.dot(zr),d=t.dot(zr),c=i.dot(zr);if(Math.max(-Math.max(l,d,c),Math.min(l,d,c))>a)return!1}return!0}const HCt=new Ks,gl=new be,Qm=new be;class hs{constructor(e=new be,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):HCt.setFromPoints(e).getCenter(i);let s=0;for(let r=0,o=e.length;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;gl.subVectors(e,this.center);const t=gl.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),s=(i-this.radius)*.5;this.center.addScaledVector(gl,s/i),this.radius+=s}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Qm.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(gl.copy(e.center).add(Qm)),this.expandByPoint(gl.copy(e.center).sub(Qm))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Cs=new be,Xm=new be,id=new be,nr=new be,Zm=new be,sd=new be,Jm=new be;class _p{constructor(e=new be,t=new be(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Cs)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Cs.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Cs.copy(this.origin).addScaledVector(this.direction,t),Cs.distanceToSquared(e))}distanceSqToSegment(e,t,i,s){Xm.copy(e).add(t).multiplyScalar(.5),id.copy(t).sub(e).normalize(),nr.copy(this.origin).sub(Xm);const r=e.distanceTo(t)*.5,o=-this.direction.dot(id),a=nr.dot(this.direction),l=-nr.dot(id),d=nr.lengthSq(),c=Math.abs(1-o*o);let _,f,m,h;if(c>0)if(_=o*l-a,f=o*a-l,h=r*c,_>=0)if(f>=-h)if(f<=h){const E=1/c;_*=E,f*=E,m=_*(_+o*f+2*a)+f*(o*_+f+2*l)+d}else f=r,_=Math.max(0,-(o*f+a)),m=-_*_+f*(f+2*l)+d;else f=-r,_=Math.max(0,-(o*f+a)),m=-_*_+f*(f+2*l)+d;else f<=-h?(_=Math.max(0,-(-o*r+a)),f=_>0?-r:Math.min(Math.max(-r,-l),r),m=-_*_+f*(f+2*l)+d):f<=h?(_=0,f=Math.min(Math.max(-r,-l),r),m=f*(f+2*l)+d):(_=Math.max(0,-(o*r+a)),f=_>0?r:Math.min(Math.max(-r,-l),r),m=-_*_+f*(f+2*l)+d);else f=o>0?-r:r,_=Math.max(0,-(o*f+a)),m=-_*_+f*(f+2*l)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,_),s&&s.copy(Xm).addScaledVector(id,f),m}intersectSphere(e,t){Cs.subVectors(e.center,this.origin);const i=Cs.dot(this.direction),s=Cs.dot(Cs)-i*i,r=e.radius*e.radius;if(s>r)return null;const o=Math.sqrt(r-s),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,s,r,o,a,l;const d=1/this.direction.x,c=1/this.direction.y,_=1/this.direction.z,f=this.origin;return d>=0?(i=(e.min.x-f.x)*d,s=(e.max.x-f.x)*d):(i=(e.max.x-f.x)*d,s=(e.min.x-f.x)*d),c>=0?(r=(e.min.y-f.y)*c,o=(e.max.y-f.y)*c):(r=(e.max.y-f.y)*c,o=(e.min.y-f.y)*c),i>o||r>s||((r>i||isNaN(i))&&(i=r),(o=0?(a=(e.min.z-f.z)*_,l=(e.max.z-f.z)*_):(a=(e.max.z-f.z)*_,l=(e.min.z-f.z)*_),i>l||a>s)||((a>i||i!==i)&&(i=a),(l=0?i:s,t)}intersectsBox(e){return this.intersectBox(e,Cs)!==null}intersectTriangle(e,t,i,s,r){Zm.subVectors(t,e),sd.subVectors(i,e),Jm.crossVectors(Zm,sd);let o=this.direction.dot(Jm),a;if(o>0){if(s)return null;a=1}else if(o<0)a=-1,o=-o;else return null;nr.subVectors(this.origin,e);const l=a*this.direction.dot(sd.crossVectors(nr,sd));if(l<0)return null;const d=a*this.direction.dot(Zm.cross(nr));if(d<0||l+d>o)return null;const c=-a*nr.dot(Jm);return c<0?null:this.at(c/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class At{constructor(e,t,i,s,r,o,a,l,d,c,_,f,m,h,E,b){At.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,s,r,o,a,l,d,c,_,f,m,h,E,b)}set(e,t,i,s,r,o,a,l,d,c,_,f,m,h,E,b){const g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=s,g[1]=r,g[5]=o,g[9]=a,g[13]=l,g[2]=d,g[6]=c,g[10]=_,g[14]=f,g[3]=m,g[7]=h,g[11]=E,g[15]=b,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new At().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,s=1/Lo.setFromMatrixColumn(e,0).length(),r=1/Lo.setFromMatrixColumn(e,1).length(),o=1/Lo.setFromMatrixColumn(e,2).length();return t[0]=i[0]*s,t[1]=i[1]*s,t[2]=i[2]*s,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,s=e.y,r=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(s),d=Math.sin(s),c=Math.cos(r),_=Math.sin(r);if(e.order==="XYZ"){const f=o*c,m=o*_,h=a*c,E=a*_;t[0]=l*c,t[4]=-l*_,t[8]=d,t[1]=m+h*d,t[5]=f-E*d,t[9]=-a*l,t[2]=E-f*d,t[6]=h+m*d,t[10]=o*l}else if(e.order==="YXZ"){const f=l*c,m=l*_,h=d*c,E=d*_;t[0]=f+E*a,t[4]=h*a-m,t[8]=o*d,t[1]=o*_,t[5]=o*c,t[9]=-a,t[2]=m*a-h,t[6]=E+f*a,t[10]=o*l}else if(e.order==="ZXY"){const f=l*c,m=l*_,h=d*c,E=d*_;t[0]=f-E*a,t[4]=-o*_,t[8]=h+m*a,t[1]=m+h*a,t[5]=o*c,t[9]=E-f*a,t[2]=-o*d,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const f=o*c,m=o*_,h=a*c,E=a*_;t[0]=l*c,t[4]=h*d-m,t[8]=f*d+E,t[1]=l*_,t[5]=E*d+f,t[9]=m*d-h,t[2]=-d,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const f=o*l,m=o*d,h=a*l,E=a*d;t[0]=l*c,t[4]=E-f*_,t[8]=h*_+m,t[1]=_,t[5]=o*c,t[9]=-a*c,t[2]=-d*c,t[6]=m*_+h,t[10]=f-E*_}else if(e.order==="XZY"){const f=o*l,m=o*d,h=a*l,E=a*d;t[0]=l*c,t[4]=-_,t[8]=d*c,t[1]=f*_+E,t[5]=o*c,t[9]=m*_-h,t[2]=h*_-m,t[6]=a*c,t[10]=E*_+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(qCt,e,YCt)}lookAt(e,t,i){const s=this.elements;return ii.subVectors(e,t),ii.lengthSq()===0&&(ii.z=1),ii.normalize(),ir.crossVectors(i,ii),ir.lengthSq()===0&&(Math.abs(i.z)===1?ii.x+=1e-4:ii.z+=1e-4,ii.normalize(),ir.crossVectors(i,ii)),ir.normalize(),rd.crossVectors(ii,ir),s[0]=ir.x,s[4]=rd.x,s[8]=ii.x,s[1]=ir.y,s[5]=rd.y,s[9]=ii.y,s[2]=ir.z,s[6]=rd.z,s[10]=ii.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[4],l=i[8],d=i[12],c=i[1],_=i[5],f=i[9],m=i[13],h=i[2],E=i[6],b=i[10],g=i[14],v=i[3],y=i[7],T=i[11],C=i[15],x=s[0],O=s[4],R=s[8],S=s[12],A=s[1],U=s[5],F=s[9],K=s[13],L=s[2],H=s[6],G=s[10],P=s[14],j=s[3],Y=s[7],Q=s[11],ae=s[15];return r[0]=o*x+a*A+l*L+d*j,r[4]=o*O+a*U+l*H+d*Y,r[8]=o*R+a*F+l*G+d*Q,r[12]=o*S+a*K+l*P+d*ae,r[1]=c*x+_*A+f*L+m*j,r[5]=c*O+_*U+f*H+m*Y,r[9]=c*R+_*F+f*G+m*Q,r[13]=c*S+_*K+f*P+m*ae,r[2]=h*x+E*A+b*L+g*j,r[6]=h*O+E*U+b*H+g*Y,r[10]=h*R+E*F+b*G+g*Q,r[14]=h*S+E*K+b*P+g*ae,r[3]=v*x+y*A+T*L+C*j,r[7]=v*O+y*U+T*H+C*Y,r[11]=v*R+y*F+T*G+C*Q,r[15]=v*S+y*K+T*P+C*ae,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],s=e[8],r=e[12],o=e[1],a=e[5],l=e[9],d=e[13],c=e[2],_=e[6],f=e[10],m=e[14],h=e[3],E=e[7],b=e[11],g=e[15];return h*(+r*l*_-s*d*_-r*a*f+i*d*f+s*a*m-i*l*m)+E*(+t*l*m-t*d*f+r*o*f-s*o*m+s*d*c-r*l*c)+b*(+t*d*_-t*a*m-r*o*_+i*o*m+r*a*c-i*d*c)+g*(-s*a*c-t*l*_+t*a*f+s*o*_-i*o*f+i*l*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],d=e[7],c=e[8],_=e[9],f=e[10],m=e[11],h=e[12],E=e[13],b=e[14],g=e[15],v=_*b*d-E*f*d+E*l*m-a*b*m-_*l*g+a*f*g,y=h*f*d-c*b*d-h*l*m+o*b*m+c*l*g-o*f*g,T=c*E*d-h*_*d+h*a*m-o*E*m-c*a*g+o*_*g,C=h*_*l-c*E*l-h*a*f+o*E*f+c*a*b-o*_*b,x=t*v+i*y+s*T+r*C;if(x===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const O=1/x;return e[0]=v*O,e[1]=(E*f*r-_*b*r-E*s*m+i*b*m+_*s*g-i*f*g)*O,e[2]=(a*b*r-E*l*r+E*s*d-i*b*d-a*s*g+i*l*g)*O,e[3]=(_*l*r-a*f*r-_*s*d+i*f*d+a*s*m-i*l*m)*O,e[4]=y*O,e[5]=(c*b*r-h*f*r+h*s*m-t*b*m-c*s*g+t*f*g)*O,e[6]=(h*l*r-o*b*r-h*s*d+t*b*d+o*s*g-t*l*g)*O,e[7]=(o*f*r-c*l*r+c*s*d-t*f*d-o*s*m+t*l*m)*O,e[8]=T*O,e[9]=(h*_*r-c*E*r-h*i*m+t*E*m+c*i*g-t*_*g)*O,e[10]=(o*E*r-h*a*r+h*i*d-t*E*d-o*i*g+t*a*g)*O,e[11]=(c*a*r-o*_*r-c*i*d+t*_*d+o*i*m-t*a*m)*O,e[12]=C*O,e[13]=(c*E*s-h*_*s+h*i*f-t*E*f-c*i*b+t*_*b)*O,e[14]=(h*a*s-o*E*s-h*i*l+t*E*l+o*i*b-t*a*b)*O,e[15]=(o*_*s-c*a*s+c*i*l-t*_*l-o*i*f+t*a*f)*O,this}scale(e){const t=this.elements,i=e.x,s=e.y,r=e.z;return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,s))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),s=Math.sin(t),r=1-i,o=e.x,a=e.y,l=e.z,d=r*o,c=r*a;return this.set(d*o+i,d*a-s*l,d*l+s*a,0,d*a+s*l,c*a+i,c*l-s*o,0,d*l-s*a,c*l+s*o,r*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,s,r,o){return this.set(1,i,r,0,e,1,o,0,t,s,1,0,0,0,0,1),this}compose(e,t,i){const s=this.elements,r=t._x,o=t._y,a=t._z,l=t._w,d=r+r,c=o+o,_=a+a,f=r*d,m=r*c,h=r*_,E=o*c,b=o*_,g=a*_,v=l*d,y=l*c,T=l*_,C=i.x,x=i.y,O=i.z;return s[0]=(1-(E+g))*C,s[1]=(m+T)*C,s[2]=(h-y)*C,s[3]=0,s[4]=(m-T)*x,s[5]=(1-(f+g))*x,s[6]=(b+v)*x,s[7]=0,s[8]=(h+y)*O,s[9]=(b-v)*O,s[10]=(1-(f+E))*O,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,i){const s=this.elements;let r=Lo.set(s[0],s[1],s[2]).length();const o=Lo.set(s[4],s[5],s[6]).length(),a=Lo.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],Mi.copy(this);const d=1/r,c=1/o,_=1/a;return Mi.elements[0]*=d,Mi.elements[1]*=d,Mi.elements[2]*=d,Mi.elements[4]*=c,Mi.elements[5]*=c,Mi.elements[6]*=c,Mi.elements[8]*=_,Mi.elements[9]*=_,Mi.elements[10]*=_,t.setFromRotationMatrix(Mi),i.x=r,i.y=o,i.z=a,this}makePerspective(e,t,i,s,r,o,a=Ls){const l=this.elements,d=2*r/(t-e),c=2*r/(i-s),_=(t+e)/(t-e),f=(i+s)/(i-s);let m,h;if(a===Ls)m=-(o+r)/(o-r),h=-2*o*r/(o-r);else if(a===yu)m=-o/(o-r),h=-o*r/(o-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=d,l[4]=0,l[8]=_,l[12]=0,l[1]=0,l[5]=c,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=h,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,s,r,o,a=Ls){const l=this.elements,d=1/(t-e),c=1/(i-s),_=1/(o-r),f=(t+e)*d,m=(i+s)*c;let h,E;if(a===Ls)h=(o+r)*_,E=-2*_;else if(a===yu)h=r*_,E=-1*_;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*d,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*c,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=E,l[14]=-h,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<16;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const Lo=new be,Mi=new At,qCt=new be(0,0,0),YCt=new be(1,1,1),ir=new be,rd=new be,ii=new be,I1=new At,M1=new Dr;class hp{constructor(e=0,t=0,i=0,s=hp.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,s=this._order){return this._x=e,this._y=t,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const s=e.elements,r=s[0],o=s[4],a=s[8],l=s[1],d=s[5],c=s[9],_=s[2],f=s[6],m=s[10];switch(t){case"XYZ":this._y=Math.asin(kn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,m),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(f,d),this._z=0);break;case"YXZ":this._x=Math.asin(-kn(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,d)):(this._y=Math.atan2(-_,r),this._z=0);break;case"ZXY":this._x=Math.asin(kn(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-_,m),this._z=Math.atan2(-o,d)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-kn(_,-1,1)),Math.abs(_)<.9999999?(this._x=Math.atan2(f,m),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-o,d));break;case"YZX":this._z=Math.asin(kn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-c,d),this._y=Math.atan2(-_,r)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-kn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,d),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-c,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return I1.makeRotationFromQuaternion(e),this.setFromRotationMatrix(I1,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return M1.setFromEuler(this),this.setFromQuaternion(M1,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}hp.DEFAULT_ORDER="XYZ";class pI{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.visibility=this._visibility,s.active=this._active,s.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),s.maxGeometryCount=this._maxGeometryCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.geometryCount=this._geometryCount,s.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(s.boundingSphere={center:s.boundingSphere.center.toArray(),radius:s.boundingSphere.radius}),this.boundingBox!==null&&(s.boundingBox={min:s.boundingBox.min.toArray(),max:s.boundingBox.max.toArray()}));function r(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let d=0,c=l.length;d0){s.children=[];for(let a=0;a0){s.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),d.length>0&&(i.textures=d),c.length>0&&(i.images=c),_.length>0&&(i.shapes=_),f.length>0&&(i.skeletons=f),m.length>0&&(i.animations=m),h.length>0&&(i.nodes=h)}return i.object=s,i;function o(a){const l=[];for(const d in a){const c=a[d];delete c.metadata,l.push(c)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,t,i,s,r){Di.subVectors(s,t),As.subVectors(i,t),eg.subVectors(e,t);const o=Di.dot(Di),a=Di.dot(As),l=Di.dot(eg),d=As.dot(As),c=As.dot(eg),_=o*d-a*a;if(_===0)return r.set(-2,-1,-1);const f=1/_,m=(d*l-a*c)*f,h=(o*c-a*l)*f;return r.set(1-m-h,h,m)}static containsPoint(e,t,i,s){return this.getBarycoord(e,t,i,s,ws),ws.x>=0&&ws.y>=0&&ws.x+ws.y<=1}static getUV(e,t,i,s,r,o,a,l){return ad===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),ad=!0),this.getInterpolation(e,t,i,s,r,o,a,l)}static getInterpolation(e,t,i,s,r,o,a,l){return this.getBarycoord(e,t,i,s,ws),l.setScalar(0),l.addScaledVector(r,ws.x),l.addScaledVector(o,ws.y),l.addScaledVector(a,ws.z),l}static isFrontFacing(e,t,i,s){return Di.subVectors(i,t),As.subVectors(e,t),Di.cross(As).dot(s)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,s){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,i,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,s),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Di.subVectors(this.c,this.b),As.subVectors(this.a,this.b),Di.cross(As).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Pi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Pi.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,s,r){return ad===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),ad=!0),Pi.getInterpolation(e,this.a,this.b,this.c,t,i,s,r)}getInterpolation(e,t,i,s,r){return Pi.getInterpolation(e,this.a,this.b,this.c,t,i,s,r)}containsPoint(e){return Pi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Pi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,s=this.b,r=this.c;let o,a;Uo.subVectors(s,i),Fo.subVectors(r,i),tg.subVectors(e,i);const l=Uo.dot(tg),d=Fo.dot(tg);if(l<=0&&d<=0)return t.copy(i);ng.subVectors(e,s);const c=Uo.dot(ng),_=Fo.dot(ng);if(c>=0&&_<=c)return t.copy(s);const f=l*_-c*d;if(f<=0&&l>=0&&c<=0)return o=l/(l-c),t.copy(i).addScaledVector(Uo,o);ig.subVectors(e,r);const m=Uo.dot(ig),h=Fo.dot(ig);if(h>=0&&m<=h)return t.copy(r);const E=m*d-l*h;if(E<=0&&d>=0&&h<=0)return a=d/(d-h),t.copy(i).addScaledVector(Fo,a);const b=c*h-m*_;if(b<=0&&_-c>=0&&m-h>=0)return U1.subVectors(r,s),a=(_-c)/(_-c+(m-h)),t.copy(s).addScaledVector(U1,a);const g=1/(b+E+f);return o=E*g,a=f*g,t.copy(i).addScaledVector(Uo,o).addScaledVector(Fo,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const _I={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},sr={h:0,s:0,l:0},ld={h:0,s:0,l:0};function sg(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class gt{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=rn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ft.toWorkingColorSpace(this,t),this}setRGB(e,t,i,s=Ft.workingColorSpace){return this.r=e,this.g=t,this.b=i,Ft.toWorkingColorSpace(this,s),this}setHSL(e,t,i,s=Ft.workingColorSpace){if(e=ev(e,1),t=kn(t,0,1),i=kn(i,0,1),t===0)this.r=this.g=this.b=i;else{const r=i<=.5?i*(1+t):i+t-i*t,o=2*i-r;this.r=sg(o,r,e+1/3),this.g=sg(o,r,e),this.b=sg(o,r,e-1/3)}return Ft.toWorkingColorSpace(this,s),this}setStyle(e,t=rn){function i(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=s[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(r,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=rn){const i=_I[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=la(e.r),this.g=la(e.g),this.b=la(e.b),this}copyLinearToSRGB(e){return this.r=$m(e.r),this.g=$m(e.g),this.b=$m(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=rn){return Ft.fromWorkingColorSpace(Mn.copy(this),e),Math.round(kn(Mn.r*255,0,255))*65536+Math.round(kn(Mn.g*255,0,255))*256+Math.round(kn(Mn.b*255,0,255))}getHexString(e=rn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ft.workingColorSpace){Ft.fromWorkingColorSpace(Mn.copy(this),t);const i=Mn.r,s=Mn.g,r=Mn.b,o=Math.max(i,s,r),a=Math.min(i,s,r);let l,d;const c=(a+o)/2;if(a===o)l=0,d=0;else{const _=o-a;switch(d=c<=.5?_/(o+a):_/(2-o-a),o){case i:l=(s-r)/_+(s0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const s=this[t];if(s===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==aa&&(i.blending=this.blending),this.side!==Vs&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==ab&&(i.blendSrc=this.blendSrc),this.blendDst!==lb&&(i.blendDst=this.blendDst),this.blendEquation!==Jr&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==mu&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==x1&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Oo&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Oo&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Oo&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function s(r){const o=[];for(const a in r){const l=r[a];delete l.metadata,o.push(l)}return o}if(t){const r=s(e.textures),o=s(e.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const s=t.length;i=new Array(s);for(let r=0;r!==s;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Er extends Vi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new gt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=QE,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const cn=new be,cd=new Mt;class Yn{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=_b,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=ks,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn('THREE.BufferAttribute: "updateRange" is deprecated and removed in r169. Use "addUpdateRange()" instead.'),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let s=0,r=this.itemSize;s0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const d in l)l[d]!==void 0&&(e[d]=l[d]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const d=i[l];e.data.attributes[l]=d.toJSON(e.data)}const s={};let r=!1;for(const l in this.morphAttributes){const d=this.morphAttributes[l],c=[];for(let _=0,f=d.length;_0&&(s[l]=c,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const s=e.attributes;for(const d in s){const c=s[d];this.setAttribute(d,c.clone(t))}const r=e.morphAttributes;for(const d in r){const c=[],_=r[d];for(let f=0,m=_.length;f0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r(e.far-e.near)**2))&&(F1.copy(r).invert(),Vr.copy(e.ray).applyMatrix4(F1),!(i.boundingBox!==null&&Vr.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Vr)))}_computeIntersections(e,t,i){let s;const r=this.geometry,o=this.material,a=r.index,l=r.attributes.position,d=r.attributes.uv,c=r.attributes.uv1,_=r.attributes.normal,f=r.groups,m=r.drawRange;if(a!==null)if(Array.isArray(o))for(let h=0,E=f.length;ht.far?null:{distance:d,point:md.clone(),object:n}}function gd(n,e,t,i,s,r,o,a,l,d){n.getVertexPosition(a,Go),n.getVertexPosition(l,zo),n.getVertexPosition(d,Vo);const c=JCt(n,e,t,i,Go,zo,Vo,fd);if(c){s&&(pd.fromBufferAttribute(s,a),_d.fromBufferAttribute(s,l),hd.fromBufferAttribute(s,d),c.uv=Pi.getInterpolation(fd,Go,zo,Vo,pd,_d,hd,new Mt)),r&&(pd.fromBufferAttribute(r,a),_d.fromBufferAttribute(r,l),hd.fromBufferAttribute(r,d),c.uv1=Pi.getInterpolation(fd,Go,zo,Vo,pd,_d,hd,new Mt),c.uv2=c.uv1),o&&(G1.fromBufferAttribute(o,a),z1.fromBufferAttribute(o,l),V1.fromBufferAttribute(o,d),c.normal=Pi.getInterpolation(fd,Go,zo,Vo,G1,z1,V1,new be),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));const _={a,b:l,c:d,normal:new be,materialIndex:0};Pi.getNormal(Go,zo,Vo,_.normal),c.face=_}return c}class Cr extends fs{constructor(e=1,t=1,i=1,s=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:s,heightSegments:r,depthSegments:o};const a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);const l=[],d=[],c=[],_=[];let f=0,m=0;h("z","y","x",-1,-1,i,t,e,o,r,0),h("z","y","x",1,-1,i,t,-e,o,r,1),h("x","z","y",1,1,e,i,t,s,o,2),h("x","z","y",1,-1,e,i,-t,s,o,3),h("x","y","z",1,-1,e,t,i,s,r,4),h("x","y","z",-1,-1,e,t,-i,s,r,5),this.setIndex(l),this.setAttribute("position",new Us(d,3)),this.setAttribute("normal",new Us(c,3)),this.setAttribute("uv",new Us(_,2));function h(E,b,g,v,y,T,C,x,O,R,S){const A=T/O,U=C/R,F=T/2,K=C/2,L=x/2,H=O+1,G=R+1;let P=0,j=0;const Y=new be;for(let Q=0;Q0?1:-1,c.push(Y.x,Y.y,Y.z),_.push(te/O),_.push(1-Q/R),P+=1}}for(let Q=0;Q0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class gI extends sn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new At,this.projectionMatrix=new At,this.projectionMatrixInverse=new At,this.coordinateSystem=Ls}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Vn extends gI{constructor(e=50,t=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Na*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Fl*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Na*2*Math.atan(Math.tan(Fl*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,s,r,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Fl*.5*this.fov)/this.zoom,i=2*t,s=this.aspect*i,r=-.5*s;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,d=o.fullHeight;r+=o.offsetX*s/l,t-=o.offsetY*i/d,s*=o.width/l,i*=o.height/d}const a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Ho=-90,qo=1;class n1t extends sn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new Vn(Ho,qo,e,t);s.layers=this.layers,this.add(s);const r=new Vn(Ho,qo,e,t);r.layers=this.layers,this.add(r);const o=new Vn(Ho,qo,e,t);o.layers=this.layers,this.add(o);const a=new Vn(Ho,qo,e,t);a.layers=this.layers,this.add(a);const l=new Vn(Ho,qo,e,t);l.layers=this.layers,this.add(l);const d=new Vn(Ho,qo,e,t);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,s,r,o,a,l]=t;for(const d of t)this.remove(d);if(e===Ls)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===yu)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const d of t)this.add(d),d.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,o,a,l,d,c]=this.children,_=e.getRenderTarget(),f=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),h=e.xr.enabled;e.xr.enabled=!1;const E=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,s),e.render(t,r),e.setRenderTarget(i,1,s),e.render(t,o),e.setRenderTarget(i,2,s),e.render(t,a),e.setRenderTarget(i,3,s),e.render(t,l),e.setRenderTarget(i,4,s),e.render(t,d),i.texture.generateMipmaps=E,e.setRenderTarget(i,5,s),e.render(t,c),e.setRenderTarget(_,f,m),e.xr.enabled=h,i.texture.needsPMREMUpdate=!0}}class bI extends wn{constructor(e,t,i,s,r,o,a,l,d,c){e=e!==void 0?e:[],t=t!==void 0?t:xa,super(e,t,i,s,r,o,a,l,d,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class i1t extends bo{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},s=[i,i,i,i,i,i];t.encoding!==void 0&&(Gl("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===uo?rn:Ei),this.texture=new bI(s,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:jn}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` +}`;class Eo extends Vi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=n1t,this.fragmentShader=i1t,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Oa(e.uniforms),this.uniformsGroups=e1t(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const s in this.uniforms){const o=this.uniforms[s].value;o&&o.isTexture?t.uniforms[s]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[s]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[s]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[s]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[s]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[s]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[s]={type:"m4",value:o.toArray()}:t.uniforms[s]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class gI extends sn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new At,this.projectionMatrix=new At,this.projectionMatrixInverse=new At,this.coordinateSystem=Ls}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Vn extends gI{constructor(e=50,t=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Na*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Fl*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Na*2*Math.atan(Math.tan(Fl*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,s,r,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Fl*.5*this.fov)/this.zoom,i=2*t,s=this.aspect*i,r=-.5*s;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,d=o.fullHeight;r+=o.offsetX*s/l,t-=o.offsetY*i/d,s*=o.width/l,i*=o.height/d}const a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Ho=-90,qo=1;class s1t extends sn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new Vn(Ho,qo,e,t);s.layers=this.layers,this.add(s);const r=new Vn(Ho,qo,e,t);r.layers=this.layers,this.add(r);const o=new Vn(Ho,qo,e,t);o.layers=this.layers,this.add(o);const a=new Vn(Ho,qo,e,t);a.layers=this.layers,this.add(a);const l=new Vn(Ho,qo,e,t);l.layers=this.layers,this.add(l);const d=new Vn(Ho,qo,e,t);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,s,r,o,a,l]=t;for(const d of t)this.remove(d);if(e===Ls)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===yu)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const d of t)this.add(d),d.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,o,a,l,d,c]=this.children,_=e.getRenderTarget(),f=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),h=e.xr.enabled;e.xr.enabled=!1;const E=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,s),e.render(t,r),e.setRenderTarget(i,1,s),e.render(t,o),e.setRenderTarget(i,2,s),e.render(t,a),e.setRenderTarget(i,3,s),e.render(t,l),e.setRenderTarget(i,4,s),e.render(t,d),i.texture.generateMipmaps=E,e.setRenderTarget(i,5,s),e.render(t,c),e.setRenderTarget(_,f,m),e.xr.enabled=h,i.texture.needsPMREMUpdate=!0}}class bI extends wn{constructor(e,t,i,s,r,o,a,l,d,c){e=e!==void 0?e:[],t=t!==void 0?t:xa,super(e,t,i,s,r,o,a,l,d,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class r1t extends bo{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},s=[i,i,i,i,i,i];t.encoding!==void 0&&(Gl("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===uo?rn:Ei),this.texture=new bI(s,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:jn}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; @@ -258,9 +258,9 @@ ${l}`;navigator.clipboard.writeText(d)}else navigator.clipboard.writeText(e);thi gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},s=new Cr(5,5,5),r=new Eo({name:"CubemapFromEquirect",uniforms:Oa(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Zn,blending:Sr});r.uniforms.tEquirect.value=t;const o=new Hn(s,r),a=t.minFilter;return t.minFilter===go&&(t.minFilter=jn),new n1t(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,s){const r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,s);e.setRenderTarget(r)}}const ag=new be,s1t=new be,r1t=new Rt;class Wr{constructor(e=new be(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,s){return this.normal.set(e,t,i),this.constant=s,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const s=ag.subVectors(i,t).cross(s1t.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(s,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(ag),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/s;return r<0||r>1?null:t.copy(e.start).addScaledVector(i,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||r1t.getNormalMatrix(e),s=this.coplanarPoint(ag).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Hr=new hs,bd=new be;class tv{constructor(e=new Wr,t=new Wr,i=new Wr,s=new Wr,r=new Wr,o=new Wr){this.planes=[e,t,i,s,r,o]}set(e,t,i,s,r,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Ls){const i=this.planes,s=e.elements,r=s[0],o=s[1],a=s[2],l=s[3],d=s[4],c=s[5],_=s[6],f=s[7],m=s[8],h=s[9],E=s[10],b=s[11],g=s[12],v=s[13],y=s[14],T=s[15];if(i[0].setComponents(l-r,f-d,b-m,T-g).normalize(),i[1].setComponents(l+r,f+d,b+m,T+g).normalize(),i[2].setComponents(l+o,f+c,b+h,T+v).normalize(),i[3].setComponents(l-o,f-c,b-h,T-v).normalize(),i[4].setComponents(l-a,f-_,b-E,T-y).normalize(),t===Ls)i[5].setComponents(l+a,f+_,b+E,T+y).normalize();else if(t===yu)i[5].setComponents(a,_,E,y).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Hr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Hr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Hr)}intersectsSprite(e){return Hr.center.set(0,0,0),Hr.radius=.7071067811865476,Hr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Hr)}intersectsSphere(e){const t=this.planes,i=e.center,s=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(i)0?e.max.x:e.min.x,bd.y=s.normal.y>0?e.max.y:e.min.y,bd.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(bd)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function EI(){let n=null,e=!1,t=null,i=null;function s(r,o){t(r,o),i=n.requestAnimationFrame(s)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(s),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){n=r}}}function o1t(n,e){const t=e.isWebGL2,i=new WeakMap;function s(d,c){const _=d.array,f=d.usage,m=_.byteLength,h=n.createBuffer();n.bindBuffer(c,h),n.bufferData(c,_,f),d.onUploadCallback();let E;if(_ instanceof Float32Array)E=n.FLOAT;else if(_ instanceof Uint16Array)if(d.isFloat16BufferAttribute)if(t)E=n.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else E=n.UNSIGNED_SHORT;else if(_ instanceof Int16Array)E=n.SHORT;else if(_ instanceof Uint32Array)E=n.UNSIGNED_INT;else if(_ instanceof Int32Array)E=n.INT;else if(_ instanceof Int8Array)E=n.BYTE;else if(_ instanceof Uint8Array)E=n.UNSIGNED_BYTE;else if(_ instanceof Uint8ClampedArray)E=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+_);return{buffer:h,type:E,bytesPerElement:_.BYTES_PER_ELEMENT,version:d.version,size:m}}function r(d,c,_){const f=c.array,m=c._updateRange,h=c.updateRanges;if(n.bindBuffer(_,d),m.count===-1&&h.length===0&&n.bufferSubData(_,0,f),h.length!==0){for(let E=0,b=h.length;E1?null:t.copy(e.start).addScaledVector(i,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||a1t.getNormalMatrix(e),s=this.coplanarPoint(ag).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Hr=new hs,bd=new be;class tv{constructor(e=new Wr,t=new Wr,i=new Wr,s=new Wr,r=new Wr,o=new Wr){this.planes=[e,t,i,s,r,o]}set(e,t,i,s,r,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Ls){const i=this.planes,s=e.elements,r=s[0],o=s[1],a=s[2],l=s[3],d=s[4],c=s[5],_=s[6],f=s[7],m=s[8],h=s[9],E=s[10],b=s[11],g=s[12],v=s[13],y=s[14],T=s[15];if(i[0].setComponents(l-r,f-d,b-m,T-g).normalize(),i[1].setComponents(l+r,f+d,b+m,T+g).normalize(),i[2].setComponents(l+o,f+c,b+h,T+v).normalize(),i[3].setComponents(l-o,f-c,b-h,T-v).normalize(),i[4].setComponents(l-a,f-_,b-E,T-y).normalize(),t===Ls)i[5].setComponents(l+a,f+_,b+E,T+y).normalize();else if(t===yu)i[5].setComponents(a,_,E,y).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Hr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Hr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Hr)}intersectsSprite(e){return Hr.center.set(0,0,0),Hr.radius=.7071067811865476,Hr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Hr)}intersectsSphere(e){const t=this.planes,i=e.center,s=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(i)0?e.max.x:e.min.x,bd.y=s.normal.y>0?e.max.y:e.min.y,bd.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(bd)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function EI(){let n=null,e=!1,t=null,i=null;function s(r,o){t(r,o),i=n.requestAnimationFrame(s)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(s),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){n=r}}}function l1t(n,e){const t=e.isWebGL2,i=new WeakMap;function s(d,c){const _=d.array,f=d.usage,m=_.byteLength,h=n.createBuffer();n.bindBuffer(c,h),n.bufferData(c,_,f),d.onUploadCallback();let E;if(_ instanceof Float32Array)E=n.FLOAT;else if(_ instanceof Uint16Array)if(d.isFloat16BufferAttribute)if(t)E=n.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else E=n.UNSIGNED_SHORT;else if(_ instanceof Int16Array)E=n.SHORT;else if(_ instanceof Uint32Array)E=n.UNSIGNED_INT;else if(_ instanceof Int32Array)E=n.INT;else if(_ instanceof Int8Array)E=n.BYTE;else if(_ instanceof Uint8Array)E=n.UNSIGNED_BYTE;else if(_ instanceof Uint8ClampedArray)E=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+_);return{buffer:h,type:E,bytesPerElement:_.BYTES_PER_ELEMENT,version:d.version,size:m}}function r(d,c,_){const f=c.array,m=c._updateRange,h=c.updateRanges;if(n.bindBuffer(_,d),m.count===-1&&h.length===0&&n.bufferSubData(_,0,f),h.length!==0){for(let E=0,b=h.length;E 0 +#endif`,x1t=`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { @@ -457,26 +457,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve #pragma unroll_loop_end if ( clipped ) discard; #endif -#endif`,T1t=`#if NUM_CLIPPING_PLANES > 0 +#endif`,C1t=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,x1t=`#if NUM_CLIPPING_PLANES > 0 +#endif`,R1t=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; -#endif`,C1t=`#if NUM_CLIPPING_PLANES > 0 +#endif`,A1t=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; -#endif`,R1t=`#if defined( USE_COLOR_ALPHA ) +#endif`,w1t=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; -#endif`,A1t=`#if defined( USE_COLOR_ALPHA ) +#endif`,N1t=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; -#endif`,w1t=`#if defined( USE_COLOR_ALPHA ) +#endif`,O1t=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; -#endif`,N1t=`#if defined( USE_COLOR_ALPHA ) +#endif`,I1t=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) vColor = vec3( 1.0 ); @@ -486,7 +486,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve #endif #ifdef USE_INSTANCING_COLOR vColor.xyz *= instanceColor.xyz; -#endif`,O1t=`#define PI 3.141592653589793 +#endif`,M1t=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 @@ -564,7 +564,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} // validated`,I1t=`#ifdef ENVMAP_TYPE_CUBE_UV +} // validated`,D1t=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { @@ -662,7 +662,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { return vec4( mix( color0, color1, mipF ), 1.0 ); } } -#endif`,M1t=`vec3 transformedNormal = objectNormal; +#endif`,k1t=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif @@ -691,18 +691,18 @@ transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif -#endif`,D1t=`#ifdef USE_DISPLACEMENTMAP +#endif`,L1t=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; -#endif`,k1t=`#ifdef USE_DISPLACEMENTMAP +#endif`,P1t=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,L1t=`#ifdef USE_EMISSIVEMAP +#endif`,U1t=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,P1t=`#ifdef USE_EMISSIVEMAP +#endif`,F1t=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; -#endif`,U1t="gl_FragColor = linearToOutputTexel( gl_FragColor );",F1t=` +#endif`,B1t="gl_FragColor = linearToOutputTexel( gl_FragColor );",G1t=` const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( vec3( 0.8224621, 0.177538, 0.0 ), vec3( 0.0331941, 0.9668058, 0.0 ), @@ -730,7 +730,7 @@ vec4 LinearToLinear( in vec4 value ) { } vec4 LinearTosRGB( in vec4 value ) { return sRGBTransferOETF( value ); -}`,B1t=`#ifdef USE_ENVMAP +}`,z1t=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { @@ -759,7 +759,7 @@ vec4 LinearTosRGB( in vec4 value ) { #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif -#endif`,G1t=`#ifdef USE_ENVMAP +#endif`,V1t=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; #ifdef ENVMAP_TYPE_CUBE @@ -768,7 +768,7 @@ vec4 LinearTosRGB( in vec4 value ) { uniform sampler2D envMap; #endif -#endif`,z1t=`#ifdef USE_ENVMAP +#endif`,H1t=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS @@ -779,7 +779,7 @@ vec4 LinearTosRGB( in vec4 value ) { #else varying vec3 vReflect; #endif -#endif`,V1t=`#ifdef USE_ENVMAP +#endif`,q1t=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif @@ -790,7 +790,7 @@ vec4 LinearTosRGB( in vec4 value ) { varying vec3 vReflect; uniform float refractionRatio; #endif -#endif`,H1t=`#ifdef USE_ENVMAP +#endif`,Y1t=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else @@ -807,18 +807,18 @@ vec4 LinearTosRGB( in vec4 value ) { vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif -#endif`,q1t=`#ifdef USE_FOG - vFogDepth = - mvPosition.z; -#endif`,Y1t=`#ifdef USE_FOG - varying float vFogDepth; #endif`,$1t=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,W1t=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,K1t=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`,W1t=`#ifdef USE_FOG +#endif`,j1t=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 @@ -827,7 +827,7 @@ vec4 LinearTosRGB( in vec4 value ) { uniform float fogNear; uniform float fogFar; #endif -#endif`,K1t=`#ifdef USE_GRADIENTMAP +#endif`,Q1t=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { @@ -839,16 +839,16 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif -}`,j1t=`#ifdef USE_LIGHTMAP +}`,X1t=`#ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; reflectedLight.indirectDiffuse += lightMapIrradiance; -#endif`,Q1t=`#ifdef USE_LIGHTMAP +#endif`,Z1t=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; -#endif`,X1t=`LambertMaterial material; +#endif`,J1t=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,Z1t=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,eRt=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; @@ -862,7 +862,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,J1t=`uniform bool receiveShadow; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,tRt=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; @@ -985,7 +985,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } -#endif`,eRt=`#ifdef USE_ENVMAP +#endif`,nRt=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); @@ -1018,8 +1018,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi #endif } #endif -#endif`,tRt=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,nRt=`varying vec3 vViewPosition; +#endif`,iRt=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,sRt=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; @@ -1031,11 +1031,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,iRt=`BlinnPhongMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,rRt=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; -material.specularStrength = specularStrength;`,sRt=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,oRt=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; @@ -1052,7 +1052,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,rRt=`PhysicalMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,aRt=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); @@ -1135,7 +1135,7 @@ material.roughness = min( material.roughness, 1.0 ); material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; -#endif`,oRt=`struct PhysicalMaterial { +#endif`,lRt=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; @@ -1435,7 +1435,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`,aRt=` +}`,cRt=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); @@ -1550,7 +1550,7 @@ IncidentLight directLight; #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,lRt=`#if defined( RE_IndirectDiffuse ) +#endif`,dRt=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; @@ -1569,25 +1569,25 @@ IncidentLight directLight; #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif -#endif`,cRt=`#if defined( RE_IndirectDiffuse ) +#endif`,uRt=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif`,dRt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) +#endif`,pRt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,uRt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) +#endif`,_Rt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; -#endif`,pRt=`#ifdef USE_LOGDEPTHBUF +#endif`,hRt=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif -#endif`,_Rt=`#ifdef USE_LOGDEPTHBUF +#endif`,fRt=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); @@ -1597,16 +1597,16 @@ IncidentLight directLight; gl_Position.z *= gl_Position.w; } #endif -#endif`,hRt=`#ifdef USE_MAP +#endif`,mRt=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); #endif diffuseColor *= sampledDiffuseColor; -#endif`,fRt=`#ifdef USE_MAP +#endif`,gRt=`#ifdef USE_MAP uniform sampler2D map; -#endif`,mRt=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,bRt=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else @@ -1618,7 +1618,7 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,gRt=`#if defined( USE_POINTS_UV ) +#endif`,ERt=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) @@ -1630,13 +1630,13 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,bRt=`float metalnessFactor = metalness; +#endif`,vRt=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; -#endif`,ERt=`#ifdef USE_METALNESSMAP +#endif`,yRt=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; -#endif`,vRt=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) +#endif`,SRt=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) @@ -1645,7 +1645,7 @@ IncidentLight directLight; if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } -#endif`,yRt=`#ifdef USE_MORPHNORMALS +#endif`,TRt=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { @@ -1657,7 +1657,7 @@ IncidentLight directLight; objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; #endif -#endif`,SRt=`#ifdef USE_MORPHTARGETS +#endif`,xRt=`#ifdef USE_MORPHTARGETS uniform float morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; @@ -1677,7 +1677,7 @@ IncidentLight directLight; uniform float morphTargetInfluences[ 4 ]; #endif #endif -#endif`,TRt=`#ifdef USE_MORPHTARGETS +#endif`,CRt=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { @@ -1695,7 +1695,7 @@ IncidentLight directLight; transformed += morphTarget7 * morphTargetInfluences[ 7 ]; #endif #endif -#endif`,xRt=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#endif`,RRt=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); @@ -1736,7 +1736,7 @@ IncidentLight directLight; tbn2[1] *= faceDirection; #endif #endif -vec3 nonPerturbedNormal = normal;`,CRt=`#ifdef USE_NORMALMAP_OBJECTSPACE +vec3 nonPerturbedNormal = normal;`,ARt=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; @@ -1751,25 +1751,25 @@ vec3 nonPerturbedNormal = normal;`,CRt=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,RRt=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,ARt=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif #endif`,wRt=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,NRt=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,ORt=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif -#endif`,NRt=`#ifdef USE_NORMALMAP +#endif`,IRt=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif @@ -1791,13 +1791,13 @@ vec3 nonPerturbedNormal = normal;`,CRt=`#ifdef USE_NORMALMAP_OBJECTSPACE float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } -#endif`,ORt=`#ifdef USE_CLEARCOAT +#endif`,MRt=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,IRt=`#ifdef USE_CLEARCOAT_NORMALMAP +#endif`,DRt=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,MRt=`#ifdef USE_CLEARCOATMAP +#endif`,kRt=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP @@ -1806,18 +1806,18 @@ vec3 nonPerturbedNormal = normal;`,CRt=`#ifdef USE_NORMALMAP_OBJECTSPACE #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; -#endif`,DRt=`#ifdef USE_IRIDESCENCEMAP +#endif`,LRt=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; -#endif`,kRt=`#ifdef OPAQUE +#endif`,PRt=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,LRt=`vec3 packNormalToRGB( const in vec3 normal ) { +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,URt=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { @@ -1858,9 +1858,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * depth - far ); -}`,PRt=`#ifdef PREMULTIPLIED_ALPHA +}`,FRt=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; -#endif`,URt=`vec4 mvPosition = vec4( transformed, 1.0 ); +#endif`,BRt=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif @@ -1868,22 +1868,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,FRt=`#ifdef DITHERING +gl_Position = projectionMatrix * mvPosition;`,GRt=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,BRt=`#ifdef DITHERING +#endif`,zRt=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } -#endif`,GRt=`float roughnessFactor = roughness; +#endif`,VRt=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; -#endif`,zRt=`#ifdef USE_ROUGHNESSMAP +#endif`,HRt=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; -#endif`,VRt=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,qRt=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 @@ -2060,7 +2060,7 @@ gl_Position = projectionMatrix * mvPosition;`,FRt=`#ifdef DITHERING return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } -#endif`,HRt=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,YRt=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif @@ -2098,7 +2098,7 @@ gl_Position = projectionMatrix * mvPosition;`,FRt=`#ifdef DITHERING }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif -#endif`,qRt=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) +#endif`,$Rt=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif @@ -2130,7 +2130,7 @@ gl_Position = projectionMatrix * mvPosition;`,FRt=`#ifdef DITHERING vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end -#endif`,YRt=`float getShadowMask() { +#endif`,WRt=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 @@ -2162,12 +2162,12 @@ gl_Position = projectionMatrix * mvPosition;`,FRt=`#ifdef DITHERING #endif #endif return shadow; -}`,$Rt=`#ifdef USE_SKINNING +}`,KRt=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,WRt=`#ifdef USE_SKINNING +#endif`,jRt=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; @@ -2182,7 +2182,7 @@ gl_Position = projectionMatrix * mvPosition;`,FRt=`#ifdef DITHERING vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } -#endif`,KRt=`#ifdef USE_SKINNING +#endif`,QRt=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; @@ -2190,7 +2190,7 @@ gl_Position = projectionMatrix * mvPosition;`,FRt=`#ifdef DITHERING skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,jRt=`#ifdef USE_SKINNING +#endif`,XRt=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; @@ -2201,17 +2201,17 @@ gl_Position = projectionMatrix * mvPosition;`,FRt=`#ifdef DITHERING #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif -#endif`,QRt=`float specularStrength; +#endif`,ZRt=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; -#endif`,XRt=`#ifdef USE_SPECULARMAP +#endif`,JRt=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; -#endif`,ZRt=`#if defined( TONE_MAPPING ) +#endif`,eAt=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,JRt=`#ifndef saturate +#endif`,tAt=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; @@ -2247,7 +2247,7 @@ vec3 ACESFilmicToneMapping( vec3 color ) { color = ACESOutputMat * color; return saturate( color ); } -vec3 CustomToneMapping( vec3 color ) { return color; }`,eAt=`#ifdef USE_TRANSMISSION +vec3 CustomToneMapping( vec3 color ) { return color; }`,nAt=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; @@ -2268,7 +2268,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,eAt=`#ifdef USE_TRANSMIS material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,tAt=`#ifdef USE_TRANSMISSION +#endif`,iAt=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; @@ -2374,7 +2374,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,eAt=`#ifdef USE_TRANSMIS float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); } -#endif`,nAt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,sAt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2444,7 +2444,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,eAt=`#ifdef USE_TRANSMIS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,iAt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,rAt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2538,7 +2538,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,eAt=`#ifdef USE_TRANSMIS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,sAt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,oAt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP @@ -2609,7 +2609,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,eAt=`#ifdef USE_TRANSMIS #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,rAt=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 +#endif`,aAt=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING worldPosition = batchingMatrix * worldPosition; @@ -2618,12 +2618,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,eAt=`#ifdef USE_TRANSMIS worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; -#endif`;const oAt=`varying vec2 vUv; +#endif`;const lAt=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,aAt=`uniform sampler2D t2D; +}`,cAt=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { @@ -2635,14 +2635,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,lAt=`varying vec3 vWorldDirection; +}`,dAt=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,cAt=`#ifdef ENVMAP_TYPE_CUBE +}`,uAt=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; @@ -2664,14 +2664,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,dAt=`varying vec3 vWorldDirection; +}`,pAt=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,uAt=`uniform samplerCube tCube; +}`,_At=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; @@ -2681,7 +2681,7 @@ void main() { gl_FragColor.a *= opacity; #include #include -}`,pAt=`#include +}`,hAt=`#include #include #include #include @@ -2707,7 +2707,7 @@ void main() { #include #include vHighPrecisionZW = gl_Position.zw; -}`,_At=`#if DEPTH_PACKING == 3200 +}`,fAt=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include @@ -2737,7 +2737,7 @@ void main() { #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #endif -}`,hAt=`#define DISTANCE +}`,mAt=`#define DISTANCE varying vec3 vWorldPosition; #include #include @@ -2763,7 +2763,7 @@ void main() { #include #include vWorldPosition = worldPosition.xyz; -}`,fAt=`#define DISTANCE +}`,gAt=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; @@ -2787,13 +2787,13 @@ void main () { dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); -}`,mAt=`varying vec3 vWorldDirection; +}`,bAt=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include -}`,gAt=`uniform sampler2D tEquirect; +}`,EAt=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { @@ -2802,7 +2802,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include -}`,bAt=`uniform float scale; +}`,vAt=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include @@ -2823,7 +2823,7 @@ void main() { #include #include #include -}`,EAt=`uniform vec3 diffuse; +}`,yAt=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; @@ -2851,7 +2851,7 @@ void main() { #include #include #include -}`,vAt=`#include +}`,SAt=`#include #include #include #include @@ -2882,7 +2882,7 @@ void main() { #include #include #include -}`,yAt=`uniform vec3 diffuse; +}`,TAt=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; @@ -2930,7 +2930,7 @@ void main() { #include #include #include -}`,SAt=`#define LAMBERT +}`,xAt=`#define LAMBERT varying vec3 vViewPosition; #include #include @@ -2968,7 +2968,7 @@ void main() { #include #include #include -}`,TAt=`#define LAMBERT +}`,CAt=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3025,7 +3025,7 @@ void main() { #include #include #include -}`,xAt=`#define MATCAP +}`,RAt=`#define MATCAP varying vec3 vViewPosition; #include #include @@ -3058,7 +3058,7 @@ void main() { #include #include vViewPosition = - mvPosition.xyz; -}`,CAt=`#define MATCAP +}`,AAt=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; @@ -3104,7 +3104,7 @@ void main() { #include #include #include -}`,RAt=`#define NORMAL +}`,wAt=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif @@ -3136,7 +3136,7 @@ void main() { #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif -}`,AAt=`#define NORMAL +}`,NAt=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; @@ -3157,7 +3157,7 @@ void main() { #ifdef OPAQUE gl_FragColor.a = 1.0; #endif -}`,wAt=`#define PHONG +}`,OAt=`#define PHONG varying vec3 vViewPosition; #include #include @@ -3195,7 +3195,7 @@ void main() { #include #include #include -}`,NAt=`#define PHONG +}`,IAt=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; @@ -3254,7 +3254,7 @@ void main() { #include #include #include -}`,OAt=`#define STANDARD +}`,MAt=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; @@ -3296,7 +3296,7 @@ void main() { #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif -}`,IAt=`#define STANDARD +}`,DAt=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR @@ -3418,7 +3418,7 @@ void main() { #include #include #include -}`,MAt=`#define TOON +}`,kAt=`#define TOON varying vec3 vViewPosition; #include #include @@ -3454,7 +3454,7 @@ void main() { #include #include #include -}`,DAt=`#define TOON +}`,LAt=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3507,7 +3507,7 @@ void main() { #include #include #include -}`,kAt=`uniform float size; +}`,PAt=`uniform float size; uniform float scale; #include #include @@ -3537,7 +3537,7 @@ void main() { #include #include #include -}`,LAt=`uniform vec3 diffuse; +}`,UAt=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3562,7 +3562,7 @@ void main() { #include #include #include -}`,PAt=`#include +}`,FAt=`#include #include #include #include @@ -3584,7 +3584,7 @@ void main() { #include #include #include -}`,UAt=`uniform vec3 color; +}`,BAt=`uniform vec3 color; uniform float opacity; #include #include @@ -3600,7 +3600,7 @@ void main() { #include #include #include -}`,FAt=`uniform float rotation; +}`,GAt=`uniform float rotation; uniform vec2 center; #include #include @@ -3626,7 +3626,7 @@ void main() { #include #include #include -}`,BAt=`uniform vec3 diffuse; +}`,zAt=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3651,7 +3651,7 @@ void main() { #include #include #include -}`,Tt={alphahash_fragment:a1t,alphahash_pars_fragment:l1t,alphamap_fragment:c1t,alphamap_pars_fragment:d1t,alphatest_fragment:u1t,alphatest_pars_fragment:p1t,aomap_fragment:_1t,aomap_pars_fragment:h1t,batching_pars_vertex:f1t,batching_vertex:m1t,begin_vertex:g1t,beginnormal_vertex:b1t,bsdfs:E1t,iridescence_fragment:v1t,bumpmap_pars_fragment:y1t,clipping_planes_fragment:S1t,clipping_planes_pars_fragment:T1t,clipping_planes_pars_vertex:x1t,clipping_planes_vertex:C1t,color_fragment:R1t,color_pars_fragment:A1t,color_pars_vertex:w1t,color_vertex:N1t,common:O1t,cube_uv_reflection_fragment:I1t,defaultnormal_vertex:M1t,displacementmap_pars_vertex:D1t,displacementmap_vertex:k1t,emissivemap_fragment:L1t,emissivemap_pars_fragment:P1t,colorspace_fragment:U1t,colorspace_pars_fragment:F1t,envmap_fragment:B1t,envmap_common_pars_fragment:G1t,envmap_pars_fragment:z1t,envmap_pars_vertex:V1t,envmap_physical_pars_fragment:eRt,envmap_vertex:H1t,fog_vertex:q1t,fog_pars_vertex:Y1t,fog_fragment:$1t,fog_pars_fragment:W1t,gradientmap_pars_fragment:K1t,lightmap_fragment:j1t,lightmap_pars_fragment:Q1t,lights_lambert_fragment:X1t,lights_lambert_pars_fragment:Z1t,lights_pars_begin:J1t,lights_toon_fragment:tRt,lights_toon_pars_fragment:nRt,lights_phong_fragment:iRt,lights_phong_pars_fragment:sRt,lights_physical_fragment:rRt,lights_physical_pars_fragment:oRt,lights_fragment_begin:aRt,lights_fragment_maps:lRt,lights_fragment_end:cRt,logdepthbuf_fragment:dRt,logdepthbuf_pars_fragment:uRt,logdepthbuf_pars_vertex:pRt,logdepthbuf_vertex:_Rt,map_fragment:hRt,map_pars_fragment:fRt,map_particle_fragment:mRt,map_particle_pars_fragment:gRt,metalnessmap_fragment:bRt,metalnessmap_pars_fragment:ERt,morphcolor_vertex:vRt,morphnormal_vertex:yRt,morphtarget_pars_vertex:SRt,morphtarget_vertex:TRt,normal_fragment_begin:xRt,normal_fragment_maps:CRt,normal_pars_fragment:RRt,normal_pars_vertex:ARt,normal_vertex:wRt,normalmap_pars_fragment:NRt,clearcoat_normal_fragment_begin:ORt,clearcoat_normal_fragment_maps:IRt,clearcoat_pars_fragment:MRt,iridescence_pars_fragment:DRt,opaque_fragment:kRt,packing:LRt,premultiplied_alpha_fragment:PRt,project_vertex:URt,dithering_fragment:FRt,dithering_pars_fragment:BRt,roughnessmap_fragment:GRt,roughnessmap_pars_fragment:zRt,shadowmap_pars_fragment:VRt,shadowmap_pars_vertex:HRt,shadowmap_vertex:qRt,shadowmask_pars_fragment:YRt,skinbase_vertex:$Rt,skinning_pars_vertex:WRt,skinning_vertex:KRt,skinnormal_vertex:jRt,specularmap_fragment:QRt,specularmap_pars_fragment:XRt,tonemapping_fragment:ZRt,tonemapping_pars_fragment:JRt,transmission_fragment:eAt,transmission_pars_fragment:tAt,uv_pars_fragment:nAt,uv_pars_vertex:iAt,uv_vertex:sAt,worldpos_vertex:rAt,background_vert:oAt,background_frag:aAt,backgroundCube_vert:lAt,backgroundCube_frag:cAt,cube_vert:dAt,cube_frag:uAt,depth_vert:pAt,depth_frag:_At,distanceRGBA_vert:hAt,distanceRGBA_frag:fAt,equirect_vert:mAt,equirect_frag:gAt,linedashed_vert:bAt,linedashed_frag:EAt,meshbasic_vert:vAt,meshbasic_frag:yAt,meshlambert_vert:SAt,meshlambert_frag:TAt,meshmatcap_vert:xAt,meshmatcap_frag:CAt,meshnormal_vert:RAt,meshnormal_frag:AAt,meshphong_vert:wAt,meshphong_frag:NAt,meshphysical_vert:OAt,meshphysical_frag:IAt,meshtoon_vert:MAt,meshtoon_frag:DAt,points_vert:kAt,points_frag:LAt,shadow_vert:PAt,shadow_frag:UAt,sprite_vert:FAt,sprite_frag:BAt},Ke={common:{diffuse:{value:new gt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Rt},alphaMap:{value:null},alphaMapTransform:{value:new Rt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Rt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Rt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Rt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Rt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Rt},normalScale:{value:new Mt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Rt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Rt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Rt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Rt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new gt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new gt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Rt},alphaTest:{value:0},uvTransform:{value:new Rt}},sprite:{diffuse:{value:new gt(16777215)},opacity:{value:1},center:{value:new Mt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Rt},alphaMap:{value:null},alphaMapTransform:{value:new Rt},alphaTest:{value:0}}},Xi={basic:{uniforms:Gn([Ke.common,Ke.specularmap,Ke.envmap,Ke.aomap,Ke.lightmap,Ke.fog]),vertexShader:Tt.meshbasic_vert,fragmentShader:Tt.meshbasic_frag},lambert:{uniforms:Gn([Ke.common,Ke.specularmap,Ke.envmap,Ke.aomap,Ke.lightmap,Ke.emissivemap,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.fog,Ke.lights,{emissive:{value:new gt(0)}}]),vertexShader:Tt.meshlambert_vert,fragmentShader:Tt.meshlambert_frag},phong:{uniforms:Gn([Ke.common,Ke.specularmap,Ke.envmap,Ke.aomap,Ke.lightmap,Ke.emissivemap,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.fog,Ke.lights,{emissive:{value:new gt(0)},specular:{value:new gt(1118481)},shininess:{value:30}}]),vertexShader:Tt.meshphong_vert,fragmentShader:Tt.meshphong_frag},standard:{uniforms:Gn([Ke.common,Ke.envmap,Ke.aomap,Ke.lightmap,Ke.emissivemap,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.roughnessmap,Ke.metalnessmap,Ke.fog,Ke.lights,{emissive:{value:new gt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Tt.meshphysical_vert,fragmentShader:Tt.meshphysical_frag},toon:{uniforms:Gn([Ke.common,Ke.aomap,Ke.lightmap,Ke.emissivemap,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.gradientmap,Ke.fog,Ke.lights,{emissive:{value:new gt(0)}}]),vertexShader:Tt.meshtoon_vert,fragmentShader:Tt.meshtoon_frag},matcap:{uniforms:Gn([Ke.common,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.fog,{matcap:{value:null}}]),vertexShader:Tt.meshmatcap_vert,fragmentShader:Tt.meshmatcap_frag},points:{uniforms:Gn([Ke.points,Ke.fog]),vertexShader:Tt.points_vert,fragmentShader:Tt.points_frag},dashed:{uniforms:Gn([Ke.common,Ke.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Tt.linedashed_vert,fragmentShader:Tt.linedashed_frag},depth:{uniforms:Gn([Ke.common,Ke.displacementmap]),vertexShader:Tt.depth_vert,fragmentShader:Tt.depth_frag},normal:{uniforms:Gn([Ke.common,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,{opacity:{value:1}}]),vertexShader:Tt.meshnormal_vert,fragmentShader:Tt.meshnormal_frag},sprite:{uniforms:Gn([Ke.sprite,Ke.fog]),vertexShader:Tt.sprite_vert,fragmentShader:Tt.sprite_frag},background:{uniforms:{uvTransform:{value:new Rt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Tt.background_vert,fragmentShader:Tt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Tt.backgroundCube_vert,fragmentShader:Tt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Tt.cube_vert,fragmentShader:Tt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Tt.equirect_vert,fragmentShader:Tt.equirect_frag},distanceRGBA:{uniforms:Gn([Ke.common,Ke.displacementmap,{referencePosition:{value:new be},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Tt.distanceRGBA_vert,fragmentShader:Tt.distanceRGBA_frag},shadow:{uniforms:Gn([Ke.lights,Ke.fog,{color:{value:new gt(0)},opacity:{value:1}}]),vertexShader:Tt.shadow_vert,fragmentShader:Tt.shadow_frag}};Xi.physical={uniforms:Gn([Xi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Rt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Rt},clearcoatNormalScale:{value:new Mt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Rt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Rt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Rt},sheen:{value:0},sheenColor:{value:new gt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Rt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Rt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Rt},transmissionSamplerSize:{value:new Mt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Rt},attenuationDistance:{value:0},attenuationColor:{value:new gt(0)},specularColor:{value:new gt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Rt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Rt},anisotropyVector:{value:new Mt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Rt}}]),vertexShader:Tt.meshphysical_vert,fragmentShader:Tt.meshphysical_frag};const Ed={r:0,b:0,g:0};function GAt(n,e,t,i,s,r,o){const a=new gt(0);let l=r===!0?0:1,d,c,_=null,f=0,m=null;function h(b,g){let v=!1,y=g.isScene===!0?g.background:null;y&&y.isTexture&&(y=(g.backgroundBlurriness>0?t:e).get(y)),y===null?E(a,l):y&&y.isColor&&(E(y,1),v=!0);const T=n.xr.getEnvironmentBlendMode();T==="additive"?i.buffers.color.setClear(0,0,0,1,o):T==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||v)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),y&&(y.isCubeTexture||y.mapping===up)?(c===void 0&&(c=new Hn(new Cr(1,1,1),new Eo({name:"BackgroundCubeMaterial",uniforms:Oa(Xi.backgroundCube.uniforms),vertexShader:Xi.backgroundCube.vertexShader,fragmentShader:Xi.backgroundCube.fragmentShader,side:Zn,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(C,x,O){this.matrixWorld.copyPosition(O.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(c)),c.material.uniforms.envMap.value=y,c.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,c.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,c.material.toneMapped=Ft.getTransfer(y.colorSpace)!==Xt,(_!==y||f!==y.version||m!==n.toneMapping)&&(c.material.needsUpdate=!0,_=y,f=y.version,m=n.toneMapping),c.layers.enableAll(),b.unshift(c,c.geometry,c.material,0,0,null)):y&&y.isTexture&&(d===void 0&&(d=new Hn(new nv(2,2),new Eo({name:"BackgroundMaterial",uniforms:Oa(Xi.background.uniforms),vertexShader:Xi.background.vertexShader,fragmentShader:Xi.background.fragmentShader,side:Vs,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(d)),d.material.uniforms.t2D.value=y,d.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,d.material.toneMapped=Ft.getTransfer(y.colorSpace)!==Xt,y.matrixAutoUpdate===!0&&y.updateMatrix(),d.material.uniforms.uvTransform.value.copy(y.matrix),(_!==y||f!==y.version||m!==n.toneMapping)&&(d.material.needsUpdate=!0,_=y,f=y.version,m=n.toneMapping),d.layers.enableAll(),b.unshift(d,d.geometry,d.material,0,0,null))}function E(b,g){b.getRGB(Ed,mI(n)),i.buffers.color.setClear(Ed.r,Ed.g,Ed.b,g,o)}return{getClearColor:function(){return a},setClearColor:function(b,g=1){a.set(b),l=g,E(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(b){l=b,E(a,l)},render:h}}function zAt(n,e,t,i){const s=n.getParameter(n.MAX_VERTEX_ATTRIBS),r=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||r!==null,a={},l=b(null);let d=l,c=!1;function _(L,H,G,P,j){let Y=!1;if(o){const Q=E(P,G,H);d!==Q&&(d=Q,m(d.object)),Y=g(L,P,G,j),Y&&v(L,P,G,j)}else{const Q=H.wireframe===!0;(d.geometry!==P.id||d.program!==G.id||d.wireframe!==Q)&&(d.geometry=P.id,d.program=G.id,d.wireframe=Q,Y=!0)}j!==null&&t.update(j,n.ELEMENT_ARRAY_BUFFER),(Y||c)&&(c=!1,R(L,H,G,P),j!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(j).buffer))}function f(){return i.isWebGL2?n.createVertexArray():r.createVertexArrayOES()}function m(L){return i.isWebGL2?n.bindVertexArray(L):r.bindVertexArrayOES(L)}function h(L){return i.isWebGL2?n.deleteVertexArray(L):r.deleteVertexArrayOES(L)}function E(L,H,G){const P=G.wireframe===!0;let j=a[L.id];j===void 0&&(j={},a[L.id]=j);let Y=j[H.id];Y===void 0&&(Y={},j[H.id]=Y);let Q=Y[P];return Q===void 0&&(Q=b(f()),Y[P]=Q),Q}function b(L){const H=[],G=[],P=[];for(let j=0;j=0){const me=j[te];let ve=Y[te];if(ve===void 0&&(te==="instanceMatrix"&&L.instanceMatrix&&(ve=L.instanceMatrix),te==="instanceColor"&&L.instanceColor&&(ve=L.instanceColor)),me===void 0||me.attribute!==ve||ve&&me.data!==ve.data)return!0;Q++}return d.attributesNum!==Q||d.index!==P}function v(L,H,G,P){const j={},Y=H.attributes;let Q=0;const ae=G.getAttributes();for(const te in ae)if(ae[te].location>=0){let me=Y[te];me===void 0&&(te==="instanceMatrix"&&L.instanceMatrix&&(me=L.instanceMatrix),te==="instanceColor"&&L.instanceColor&&(me=L.instanceColor));const ve={};ve.attribute=me,me&&me.data&&(ve.data=me.data),j[te]=ve,Q++}d.attributes=j,d.attributesNum=Q,d.index=P}function y(){const L=d.newAttributes;for(let H=0,G=L.length;H=0){let Z=j[ae];if(Z===void 0&&(ae==="instanceMatrix"&&L.instanceMatrix&&(Z=L.instanceMatrix),ae==="instanceColor"&&L.instanceColor&&(Z=L.instanceColor)),Z!==void 0){const me=Z.normalized,ve=Z.itemSize,Ae=t.get(Z);if(Ae===void 0)continue;const J=Ae.buffer,ge=Ae.type,ee=Ae.bytesPerElement,Se=i.isWebGL2===!0&&(ge===n.INT||ge===n.UNSIGNED_INT||Z.gpuType===ZO);if(Z.isInterleavedBufferAttribute){const Ie=Z.data,k=Ie.stride,B=Z.offset;if(Ie.isInstancedInterleavedBuffer){for(let $=0;$0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";O="mediump"}return O==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=r(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const d=o||e.has("WEBGL_draw_buffers"),c=t.logarithmicDepthBuffer===!0,_=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),f=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_TEXTURE_SIZE),h=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),E=n.getParameter(n.MAX_VERTEX_ATTRIBS),b=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),g=n.getParameter(n.MAX_VARYING_VECTORS),v=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),y=f>0,T=o||e.has("OES_texture_float"),C=y&&T,x=o?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:d,getMaxAnisotropy:s,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:c,maxTextures:_,maxVertexTextures:f,maxTextureSize:m,maxCubemapSize:h,maxAttributes:E,maxVertexUniforms:b,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:T,floatVertexTextures:C,maxSamples:x}}function qAt(n){const e=this;let t=null,i=0,s=!1,r=!1;const o=new Wr,a=new Rt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(_,f){const m=_.length!==0||f||i!==0||s;return s=f,i=_.length,m},this.beginShadows=function(){r=!0,c(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(_,f){t=c(_,f,0)},this.setState=function(_,f,m){const h=_.clippingPlanes,E=_.clipIntersection,b=_.clipShadows,g=n.get(_);if(!s||h===null||h.length===0||r&&!b)r?c(null):d();else{const v=r?0:i,y=v*4;let T=g.clippingState||null;l.value=T,T=c(h,f,y,m);for(let C=0;C!==y;++C)T[C]=t[C];g.clippingState=T,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=v}};function d(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function c(_,f,m,h){const E=_!==null?_.length:0;let b=null;if(E!==0){if(b=l.value,h!==!0||b===null){const g=m+E*4,v=f.matrixWorldInverse;a.getNormalMatrix(v),(b===null||b.length0){const d=new i1t(l.height/2);return d.fromEquirectangularTexture(n,o),e.set(o,d),o.addEventListener("dispose",s),t(d.texture,o.mapping)}else return null}}return o}function s(o){const a=o.target;a.removeEventListener("dispose",s);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function r(){e=new WeakMap}return{get:i,dispose:r}}class iv extends gI{constructor(e=-1,t=1,i=1,s=-1,r=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=s,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,s,r,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let r=i-e,o=i+e,a=s+t,l=s-t;if(this.view!==null&&this.view.enabled){const d=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=d*this.view.offsetX,o=r+d*this.view.width,a-=c*this.view.offsetY,l=a-c*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Xo=4,H1=[.125,.215,.35,.446,.526,.582],eo=20,lg=new iv,q1=new gt;let cg=null,dg=0,ug=0;const Kr=(1+Math.sqrt(5))/2,Yo=1/Kr,Y1=[new be(1,1,1),new be(-1,1,1),new be(1,1,-1),new be(-1,1,-1),new be(0,Kr,Yo),new be(0,Kr,-Yo),new be(Yo,0,Kr),new be(-Yo,0,Kr),new be(Kr,Yo,0),new be(-Kr,Yo,0)];class $1{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,s=100){cg=this._renderer.getRenderTarget(),dg=this._renderer.getActiveCubeFace(),ug=this._renderer.getActiveMipmapLevel(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,i,s,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=j1(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=K1(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?y:0,y,y),c.setRenderTarget(s),E&&c.render(h,a),c.render(e,a)}h.geometry.dispose(),h.material.dispose(),c.toneMapping=f,c.autoClear=_,e.background=b}_textureToCubeUV(e,t){const i=this._renderer,s=e.mapping===xa||e.mapping===Ca;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=j1()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=K1());const r=s?this._cubemapMaterial:this._equirectMaterial,o=new Hn(this._lodPlanes[0],r),a=r.uniforms;a.envMap.value=e;const l=this._cubeSize;vd(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,lg)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let s=1;seo&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${eo}`);const g=[];let v=0;for(let O=0;Oy-Xo?s-y+Xo:0),x=4*(this._cubeSize-T);vd(t,C,x,3*T,2*T),l.setRenderTarget(t),l.render(_,lg)}}function $At(n){const e=[],t=[],i=[];let s=n;const r=n-Xo+1+H1.length;for(let o=0;on-Xo?l=H1[o-n+Xo-1]:o===0&&(l=0),i.push(l);const d=1/(a-2),c=-d,_=1+d,f=[c,c,_,c,_,_,c,c,_,_,c,_],m=6,h=6,E=3,b=2,g=1,v=new Float32Array(E*h*m),y=new Float32Array(b*h*m),T=new Float32Array(g*h*m);for(let x=0;x2?0:-1,S=[O,R,0,O+2/3,R,0,O+2/3,R+1,0,O,R,0,O+2/3,R+1,0,O,R+1,0];v.set(S,E*h*x),y.set(f,b*h*x);const A=[x,x,x,x,x,x];T.set(A,g*h*x)}const C=new fs;C.setAttribute("position",new Yn(v,E)),C.setAttribute("uv",new Yn(y,b)),C.setAttribute("faceIndex",new Yn(T,g)),e.push(C),s>Xo&&s--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function W1(n,e,t){const i=new bo(n,e,t);return i.texture.mapping=up,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function vd(n,e,t,i,s){n.viewport.set(e,t,i,s),n.scissor.set(e,t,i,s)}function WAt(n,e,t){const i=new Float32Array(eo),s=new be(0,1,0);return new Eo({name:"SphericalGaussianBlur",defines:{n:eo,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:sv(),fragmentShader:` +}`,Tt={alphahash_fragment:c1t,alphahash_pars_fragment:d1t,alphamap_fragment:u1t,alphamap_pars_fragment:p1t,alphatest_fragment:_1t,alphatest_pars_fragment:h1t,aomap_fragment:f1t,aomap_pars_fragment:m1t,batching_pars_vertex:g1t,batching_vertex:b1t,begin_vertex:E1t,beginnormal_vertex:v1t,bsdfs:y1t,iridescence_fragment:S1t,bumpmap_pars_fragment:T1t,clipping_planes_fragment:x1t,clipping_planes_pars_fragment:C1t,clipping_planes_pars_vertex:R1t,clipping_planes_vertex:A1t,color_fragment:w1t,color_pars_fragment:N1t,color_pars_vertex:O1t,color_vertex:I1t,common:M1t,cube_uv_reflection_fragment:D1t,defaultnormal_vertex:k1t,displacementmap_pars_vertex:L1t,displacementmap_vertex:P1t,emissivemap_fragment:U1t,emissivemap_pars_fragment:F1t,colorspace_fragment:B1t,colorspace_pars_fragment:G1t,envmap_fragment:z1t,envmap_common_pars_fragment:V1t,envmap_pars_fragment:H1t,envmap_pars_vertex:q1t,envmap_physical_pars_fragment:nRt,envmap_vertex:Y1t,fog_vertex:$1t,fog_pars_vertex:W1t,fog_fragment:K1t,fog_pars_fragment:j1t,gradientmap_pars_fragment:Q1t,lightmap_fragment:X1t,lightmap_pars_fragment:Z1t,lights_lambert_fragment:J1t,lights_lambert_pars_fragment:eRt,lights_pars_begin:tRt,lights_toon_fragment:iRt,lights_toon_pars_fragment:sRt,lights_phong_fragment:rRt,lights_phong_pars_fragment:oRt,lights_physical_fragment:aRt,lights_physical_pars_fragment:lRt,lights_fragment_begin:cRt,lights_fragment_maps:dRt,lights_fragment_end:uRt,logdepthbuf_fragment:pRt,logdepthbuf_pars_fragment:_Rt,logdepthbuf_pars_vertex:hRt,logdepthbuf_vertex:fRt,map_fragment:mRt,map_pars_fragment:gRt,map_particle_fragment:bRt,map_particle_pars_fragment:ERt,metalnessmap_fragment:vRt,metalnessmap_pars_fragment:yRt,morphcolor_vertex:SRt,morphnormal_vertex:TRt,morphtarget_pars_vertex:xRt,morphtarget_vertex:CRt,normal_fragment_begin:RRt,normal_fragment_maps:ARt,normal_pars_fragment:wRt,normal_pars_vertex:NRt,normal_vertex:ORt,normalmap_pars_fragment:IRt,clearcoat_normal_fragment_begin:MRt,clearcoat_normal_fragment_maps:DRt,clearcoat_pars_fragment:kRt,iridescence_pars_fragment:LRt,opaque_fragment:PRt,packing:URt,premultiplied_alpha_fragment:FRt,project_vertex:BRt,dithering_fragment:GRt,dithering_pars_fragment:zRt,roughnessmap_fragment:VRt,roughnessmap_pars_fragment:HRt,shadowmap_pars_fragment:qRt,shadowmap_pars_vertex:YRt,shadowmap_vertex:$Rt,shadowmask_pars_fragment:WRt,skinbase_vertex:KRt,skinning_pars_vertex:jRt,skinning_vertex:QRt,skinnormal_vertex:XRt,specularmap_fragment:ZRt,specularmap_pars_fragment:JRt,tonemapping_fragment:eAt,tonemapping_pars_fragment:tAt,transmission_fragment:nAt,transmission_pars_fragment:iAt,uv_pars_fragment:sAt,uv_pars_vertex:rAt,uv_vertex:oAt,worldpos_vertex:aAt,background_vert:lAt,background_frag:cAt,backgroundCube_vert:dAt,backgroundCube_frag:uAt,cube_vert:pAt,cube_frag:_At,depth_vert:hAt,depth_frag:fAt,distanceRGBA_vert:mAt,distanceRGBA_frag:gAt,equirect_vert:bAt,equirect_frag:EAt,linedashed_vert:vAt,linedashed_frag:yAt,meshbasic_vert:SAt,meshbasic_frag:TAt,meshlambert_vert:xAt,meshlambert_frag:CAt,meshmatcap_vert:RAt,meshmatcap_frag:AAt,meshnormal_vert:wAt,meshnormal_frag:NAt,meshphong_vert:OAt,meshphong_frag:IAt,meshphysical_vert:MAt,meshphysical_frag:DAt,meshtoon_vert:kAt,meshtoon_frag:LAt,points_vert:PAt,points_frag:UAt,shadow_vert:FAt,shadow_frag:BAt,sprite_vert:GAt,sprite_frag:zAt},Ke={common:{diffuse:{value:new gt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Rt},alphaMap:{value:null},alphaMapTransform:{value:new Rt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Rt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Rt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Rt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Rt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Rt},normalScale:{value:new Mt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Rt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Rt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Rt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Rt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new gt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new gt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Rt},alphaTest:{value:0},uvTransform:{value:new Rt}},sprite:{diffuse:{value:new gt(16777215)},opacity:{value:1},center:{value:new Mt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Rt},alphaMap:{value:null},alphaMapTransform:{value:new Rt},alphaTest:{value:0}}},Xi={basic:{uniforms:Gn([Ke.common,Ke.specularmap,Ke.envmap,Ke.aomap,Ke.lightmap,Ke.fog]),vertexShader:Tt.meshbasic_vert,fragmentShader:Tt.meshbasic_frag},lambert:{uniforms:Gn([Ke.common,Ke.specularmap,Ke.envmap,Ke.aomap,Ke.lightmap,Ke.emissivemap,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.fog,Ke.lights,{emissive:{value:new gt(0)}}]),vertexShader:Tt.meshlambert_vert,fragmentShader:Tt.meshlambert_frag},phong:{uniforms:Gn([Ke.common,Ke.specularmap,Ke.envmap,Ke.aomap,Ke.lightmap,Ke.emissivemap,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.fog,Ke.lights,{emissive:{value:new gt(0)},specular:{value:new gt(1118481)},shininess:{value:30}}]),vertexShader:Tt.meshphong_vert,fragmentShader:Tt.meshphong_frag},standard:{uniforms:Gn([Ke.common,Ke.envmap,Ke.aomap,Ke.lightmap,Ke.emissivemap,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.roughnessmap,Ke.metalnessmap,Ke.fog,Ke.lights,{emissive:{value:new gt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Tt.meshphysical_vert,fragmentShader:Tt.meshphysical_frag},toon:{uniforms:Gn([Ke.common,Ke.aomap,Ke.lightmap,Ke.emissivemap,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.gradientmap,Ke.fog,Ke.lights,{emissive:{value:new gt(0)}}]),vertexShader:Tt.meshtoon_vert,fragmentShader:Tt.meshtoon_frag},matcap:{uniforms:Gn([Ke.common,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,Ke.fog,{matcap:{value:null}}]),vertexShader:Tt.meshmatcap_vert,fragmentShader:Tt.meshmatcap_frag},points:{uniforms:Gn([Ke.points,Ke.fog]),vertexShader:Tt.points_vert,fragmentShader:Tt.points_frag},dashed:{uniforms:Gn([Ke.common,Ke.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Tt.linedashed_vert,fragmentShader:Tt.linedashed_frag},depth:{uniforms:Gn([Ke.common,Ke.displacementmap]),vertexShader:Tt.depth_vert,fragmentShader:Tt.depth_frag},normal:{uniforms:Gn([Ke.common,Ke.bumpmap,Ke.normalmap,Ke.displacementmap,{opacity:{value:1}}]),vertexShader:Tt.meshnormal_vert,fragmentShader:Tt.meshnormal_frag},sprite:{uniforms:Gn([Ke.sprite,Ke.fog]),vertexShader:Tt.sprite_vert,fragmentShader:Tt.sprite_frag},background:{uniforms:{uvTransform:{value:new Rt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Tt.background_vert,fragmentShader:Tt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Tt.backgroundCube_vert,fragmentShader:Tt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Tt.cube_vert,fragmentShader:Tt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Tt.equirect_vert,fragmentShader:Tt.equirect_frag},distanceRGBA:{uniforms:Gn([Ke.common,Ke.displacementmap,{referencePosition:{value:new be},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Tt.distanceRGBA_vert,fragmentShader:Tt.distanceRGBA_frag},shadow:{uniforms:Gn([Ke.lights,Ke.fog,{color:{value:new gt(0)},opacity:{value:1}}]),vertexShader:Tt.shadow_vert,fragmentShader:Tt.shadow_frag}};Xi.physical={uniforms:Gn([Xi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Rt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Rt},clearcoatNormalScale:{value:new Mt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Rt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Rt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Rt},sheen:{value:0},sheenColor:{value:new gt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Rt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Rt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Rt},transmissionSamplerSize:{value:new Mt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Rt},attenuationDistance:{value:0},attenuationColor:{value:new gt(0)},specularColor:{value:new gt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Rt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Rt},anisotropyVector:{value:new Mt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Rt}}]),vertexShader:Tt.meshphysical_vert,fragmentShader:Tt.meshphysical_frag};const Ed={r:0,b:0,g:0};function VAt(n,e,t,i,s,r,o){const a=new gt(0);let l=r===!0?0:1,d,c,_=null,f=0,m=null;function h(b,g){let v=!1,y=g.isScene===!0?g.background:null;y&&y.isTexture&&(y=(g.backgroundBlurriness>0?t:e).get(y)),y===null?E(a,l):y&&y.isColor&&(E(y,1),v=!0);const T=n.xr.getEnvironmentBlendMode();T==="additive"?i.buffers.color.setClear(0,0,0,1,o):T==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||v)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),y&&(y.isCubeTexture||y.mapping===up)?(c===void 0&&(c=new Hn(new Cr(1,1,1),new Eo({name:"BackgroundCubeMaterial",uniforms:Oa(Xi.backgroundCube.uniforms),vertexShader:Xi.backgroundCube.vertexShader,fragmentShader:Xi.backgroundCube.fragmentShader,side:Zn,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(C,x,O){this.matrixWorld.copyPosition(O.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(c)),c.material.uniforms.envMap.value=y,c.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,c.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,c.material.toneMapped=Ft.getTransfer(y.colorSpace)!==Xt,(_!==y||f!==y.version||m!==n.toneMapping)&&(c.material.needsUpdate=!0,_=y,f=y.version,m=n.toneMapping),c.layers.enableAll(),b.unshift(c,c.geometry,c.material,0,0,null)):y&&y.isTexture&&(d===void 0&&(d=new Hn(new nv(2,2),new Eo({name:"BackgroundMaterial",uniforms:Oa(Xi.background.uniforms),vertexShader:Xi.background.vertexShader,fragmentShader:Xi.background.fragmentShader,side:Vs,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(d)),d.material.uniforms.t2D.value=y,d.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,d.material.toneMapped=Ft.getTransfer(y.colorSpace)!==Xt,y.matrixAutoUpdate===!0&&y.updateMatrix(),d.material.uniforms.uvTransform.value.copy(y.matrix),(_!==y||f!==y.version||m!==n.toneMapping)&&(d.material.needsUpdate=!0,_=y,f=y.version,m=n.toneMapping),d.layers.enableAll(),b.unshift(d,d.geometry,d.material,0,0,null))}function E(b,g){b.getRGB(Ed,mI(n)),i.buffers.color.setClear(Ed.r,Ed.g,Ed.b,g,o)}return{getClearColor:function(){return a},setClearColor:function(b,g=1){a.set(b),l=g,E(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(b){l=b,E(a,l)},render:h}}function HAt(n,e,t,i){const s=n.getParameter(n.MAX_VERTEX_ATTRIBS),r=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||r!==null,a={},l=b(null);let d=l,c=!1;function _(L,H,G,P,j){let Y=!1;if(o){const Q=E(P,G,H);d!==Q&&(d=Q,m(d.object)),Y=g(L,P,G,j),Y&&v(L,P,G,j)}else{const Q=H.wireframe===!0;(d.geometry!==P.id||d.program!==G.id||d.wireframe!==Q)&&(d.geometry=P.id,d.program=G.id,d.wireframe=Q,Y=!0)}j!==null&&t.update(j,n.ELEMENT_ARRAY_BUFFER),(Y||c)&&(c=!1,R(L,H,G,P),j!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(j).buffer))}function f(){return i.isWebGL2?n.createVertexArray():r.createVertexArrayOES()}function m(L){return i.isWebGL2?n.bindVertexArray(L):r.bindVertexArrayOES(L)}function h(L){return i.isWebGL2?n.deleteVertexArray(L):r.deleteVertexArrayOES(L)}function E(L,H,G){const P=G.wireframe===!0;let j=a[L.id];j===void 0&&(j={},a[L.id]=j);let Y=j[H.id];Y===void 0&&(Y={},j[H.id]=Y);let Q=Y[P];return Q===void 0&&(Q=b(f()),Y[P]=Q),Q}function b(L){const H=[],G=[],P=[];for(let j=0;j=0){const me=j[te];let ve=Y[te];if(ve===void 0&&(te==="instanceMatrix"&&L.instanceMatrix&&(ve=L.instanceMatrix),te==="instanceColor"&&L.instanceColor&&(ve=L.instanceColor)),me===void 0||me.attribute!==ve||ve&&me.data!==ve.data)return!0;Q++}return d.attributesNum!==Q||d.index!==P}function v(L,H,G,P){const j={},Y=H.attributes;let Q=0;const ae=G.getAttributes();for(const te in ae)if(ae[te].location>=0){let me=Y[te];me===void 0&&(te==="instanceMatrix"&&L.instanceMatrix&&(me=L.instanceMatrix),te==="instanceColor"&&L.instanceColor&&(me=L.instanceColor));const ve={};ve.attribute=me,me&&me.data&&(ve.data=me.data),j[te]=ve,Q++}d.attributes=j,d.attributesNum=Q,d.index=P}function y(){const L=d.newAttributes;for(let H=0,G=L.length;H=0){let Z=j[ae];if(Z===void 0&&(ae==="instanceMatrix"&&L.instanceMatrix&&(Z=L.instanceMatrix),ae==="instanceColor"&&L.instanceColor&&(Z=L.instanceColor)),Z!==void 0){const me=Z.normalized,ve=Z.itemSize,Ae=t.get(Z);if(Ae===void 0)continue;const J=Ae.buffer,ge=Ae.type,ee=Ae.bytesPerElement,Se=i.isWebGL2===!0&&(ge===n.INT||ge===n.UNSIGNED_INT||Z.gpuType===ZO);if(Z.isInterleavedBufferAttribute){const Ie=Z.data,k=Ie.stride,B=Z.offset;if(Ie.isInstancedInterleavedBuffer){for(let $=0;$0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";O="mediump"}return O==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=r(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const d=o||e.has("WEBGL_draw_buffers"),c=t.logarithmicDepthBuffer===!0,_=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),f=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_TEXTURE_SIZE),h=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),E=n.getParameter(n.MAX_VERTEX_ATTRIBS),b=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),g=n.getParameter(n.MAX_VARYING_VECTORS),v=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),y=f>0,T=o||e.has("OES_texture_float"),C=y&&T,x=o?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:d,getMaxAnisotropy:s,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:c,maxTextures:_,maxVertexTextures:f,maxTextureSize:m,maxCubemapSize:h,maxAttributes:E,maxVertexUniforms:b,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:T,floatVertexTextures:C,maxSamples:x}}function $At(n){const e=this;let t=null,i=0,s=!1,r=!1;const o=new Wr,a=new Rt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(_,f){const m=_.length!==0||f||i!==0||s;return s=f,i=_.length,m},this.beginShadows=function(){r=!0,c(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(_,f){t=c(_,f,0)},this.setState=function(_,f,m){const h=_.clippingPlanes,E=_.clipIntersection,b=_.clipShadows,g=n.get(_);if(!s||h===null||h.length===0||r&&!b)r?c(null):d();else{const v=r?0:i,y=v*4;let T=g.clippingState||null;l.value=T,T=c(h,f,y,m);for(let C=0;C!==y;++C)T[C]=t[C];g.clippingState=T,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=v}};function d(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function c(_,f,m,h){const E=_!==null?_.length:0;let b=null;if(E!==0){if(b=l.value,h!==!0||b===null){const g=m+E*4,v=f.matrixWorldInverse;a.getNormalMatrix(v),(b===null||b.length0){const d=new r1t(l.height/2);return d.fromEquirectangularTexture(n,o),e.set(o,d),o.addEventListener("dispose",s),t(d.texture,o.mapping)}else return null}}return o}function s(o){const a=o.target;a.removeEventListener("dispose",s);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function r(){e=new WeakMap}return{get:i,dispose:r}}class iv extends gI{constructor(e=-1,t=1,i=1,s=-1,r=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=s,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,s,r,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let r=i-e,o=i+e,a=s+t,l=s-t;if(this.view!==null&&this.view.enabled){const d=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=d*this.view.offsetX,o=r+d*this.view.width,a-=c*this.view.offsetY,l=a-c*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Xo=4,H1=[.125,.215,.35,.446,.526,.582],eo=20,lg=new iv,q1=new gt;let cg=null,dg=0,ug=0;const Kr=(1+Math.sqrt(5))/2,Yo=1/Kr,Y1=[new be(1,1,1),new be(-1,1,1),new be(1,1,-1),new be(-1,1,-1),new be(0,Kr,Yo),new be(0,Kr,-Yo),new be(Yo,0,Kr),new be(-Yo,0,Kr),new be(Kr,Yo,0),new be(-Kr,Yo,0)];class $1{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,s=100){cg=this._renderer.getRenderTarget(),dg=this._renderer.getActiveCubeFace(),ug=this._renderer.getActiveMipmapLevel(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,i,s,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=j1(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=K1(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?y:0,y,y),c.setRenderTarget(s),E&&c.render(h,a),c.render(e,a)}h.geometry.dispose(),h.material.dispose(),c.toneMapping=f,c.autoClear=_,e.background=b}_textureToCubeUV(e,t){const i=this._renderer,s=e.mapping===xa||e.mapping===Ca;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=j1()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=K1());const r=s?this._cubemapMaterial:this._equirectMaterial,o=new Hn(this._lodPlanes[0],r),a=r.uniforms;a.envMap.value=e;const l=this._cubeSize;vd(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,lg)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let s=1;seo&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${eo}`);const g=[];let v=0;for(let O=0;Oy-Xo?s-y+Xo:0),x=4*(this._cubeSize-T);vd(t,C,x,3*T,2*T),l.setRenderTarget(t),l.render(_,lg)}}function KAt(n){const e=[],t=[],i=[];let s=n;const r=n-Xo+1+H1.length;for(let o=0;on-Xo?l=H1[o-n+Xo-1]:o===0&&(l=0),i.push(l);const d=1/(a-2),c=-d,_=1+d,f=[c,c,_,c,_,_,c,c,_,_,c,_],m=6,h=6,E=3,b=2,g=1,v=new Float32Array(E*h*m),y=new Float32Array(b*h*m),T=new Float32Array(g*h*m);for(let x=0;x2?0:-1,S=[O,R,0,O+2/3,R,0,O+2/3,R+1,0,O,R,0,O+2/3,R+1,0,O,R+1,0];v.set(S,E*h*x),y.set(f,b*h*x);const A=[x,x,x,x,x,x];T.set(A,g*h*x)}const C=new fs;C.setAttribute("position",new Yn(v,E)),C.setAttribute("uv",new Yn(y,b)),C.setAttribute("faceIndex",new Yn(T,g)),e.push(C),s>Xo&&s--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function W1(n,e,t){const i=new bo(n,e,t);return i.texture.mapping=up,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function vd(n,e,t,i,s){n.viewport.set(e,t,i,s),n.scissor.set(e,t,i,s)}function jAt(n,e,t){const i=new Float32Array(eo),s=new be(0,1,0);return new Eo({name:"SphericalGaussianBlur",defines:{n:eo,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:sv(),fragmentShader:` precision mediump float; precision mediump int; @@ -3801,26 +3801,26 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function KAt(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,d=l===cb||l===db,c=l===xa||l===Ca;if(d||c)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let _=e.get(a);return t===null&&(t=new $1(n)),_=d?t.fromEquirectangular(a,_):t.fromCubemap(a,_),e.set(a,_),_.texture}else{if(e.has(a))return e.get(a).texture;{const _=a.image;if(d&&_&&_.height>0||c&&_&&s(_)){t===null&&(t=new $1(n));const f=d?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,f),a.addEventListener("dispose",r),f.texture}else return null}}}return a}function s(a){let l=0;const d=6;for(let c=0;ce.maxTextureSize&&(U=Math.ceil(A/e.maxTextureSize),A=e.maxTextureSize);const F=new Float32Array(A*U*4*E),K=new uI(F,A,U,E);K.type=ks,K.needsUpdate=!0;const L=S*4;for(let G=0;G0)return n;const s=e*t;let r=Q1[s];if(r===void 0&&(r=new Float32Array(s),Q1[s]=r),e!==0){i.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(r,a)}return r}function fn(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t0||c&&_&&s(_)){t===null&&(t=new $1(n));const f=d?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,f),a.addEventListener("dispose",r),f.texture}else return null}}}return a}function s(a){let l=0;const d=6;for(let c=0;ce.maxTextureSize&&(U=Math.ceil(A/e.maxTextureSize),A=e.maxTextureSize);const F=new Float32Array(A*U*4*E),K=new uI(F,A,U,E);K.type=ks,K.needsUpdate=!0;const L=S*4;for(let G=0;G0)return n;const s=e*t;let r=Q1[s];if(r===void 0&&(r=new Float32Array(s),Q1[s]=r),e!==0){i.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(r,a)}return r}function fn(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${a}: ${t[o]}`)}return i.join(` -`)}function Qwt(n){const e=Ft.getPrimaries(Ft.workingColorSpace),t=Ft.getPrimaries(n);let i;switch(e===t?i="":e===vu&&t===Eu?i="LinearDisplayP3ToLinearSRGB":e===Eu&&t===vu&&(i="LinearSRGBToLinearDisplayP3"),n){case Nn:case pp:return[i,"LinearTransferOETF"];case rn:case JE:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function iR(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),s=n.getShaderInfoLog(e).trim();if(i&&s==="")return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const o=parseInt(r[1]);return t.toUpperCase()+` +`)}function Zwt(n){const e=Ft.getPrimaries(Ft.workingColorSpace),t=Ft.getPrimaries(n);let i;switch(e===t?i="":e===vu&&t===Eu?i="LinearDisplayP3ToLinearSRGB":e===Eu&&t===vu&&(i="LinearSRGBToLinearDisplayP3"),n){case Nn:case pp:return[i,"LinearTransferOETF"];case rn:case JE:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function iR(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),s=n.getShaderInfoLog(e).trim();if(i&&s==="")return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const o=parseInt(r[1]);return t.toUpperCase()+` `+s+` -`+jwt(n.getShaderSource(e),o)}else return s}function Xwt(n,e){const t=Qwt(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function Zwt(n,e){let t;switch(e){case Kxt:t="Linear";break;case jxt:t="Reinhard";break;case Qxt:t="OptimizedCineon";break;case Xxt:t="ACESFilmic";break;case Zxt:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Jwt(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.normalMapTangentSpace||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(wl).join(` -`)}function eNt(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` -`)}function tNt(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let s=0;s/gm;function mb(n){return n.replace(nNt,sNt)}const iNt=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function sNt(n,e){let t=Tt[e];if(t===void 0){const i=iNt.get(e);if(i!==void 0)t=Tt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return mb(t)}const rNt=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function oR(n){return n.replace(rNt,oNt)}function oNt(n,e,t,i){let s="";for(let r=parseInt(e);r/gm;function mb(n){return n.replace(sNt,oNt)}const rNt=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function oNt(n,e){let t=Tt[e];if(t===void 0){const i=rNt.get(e);if(i!==void 0)t=Tt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return mb(t)}const aNt=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function oR(n){return n.replace(aNt,lNt)}function lNt(n,e,t,i){let s="";for(let r=parseInt(e);r0&&(b+=` `),g=[m,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,h].filter(wl).join(` `),g.length>0&&(g+=` `)):(b=[aR(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,h,t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` `].filter(wl).join(` -`),g=[m,aR(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,h,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.envMap?"#define "+c:"",t.envMap?"#define "+_:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Tr?"#define TONE_MAPPING":"",t.toneMapping!==Tr?Tt.tonemapping_pars_fragment:"",t.toneMapping!==Tr?Zwt("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Tt.colorspace_pars_fragment,Xwt("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`),g=[m,aR(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,h,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.envMap?"#define "+c:"",t.envMap?"#define "+_:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Tr?"#define TONE_MAPPING":"",t.toneMapping!==Tr?Tt.tonemapping_pars_fragment:"",t.toneMapping!==Tr?eNt("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Tt.colorspace_pars_fragment,Jwt("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `].filter(wl).join(` `)),o=mb(o),o=sR(o,t),o=rR(o,t),a=mb(a),a=sR(a,t),a=rR(a,t),o=oR(o),a=oR(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(v=`#version 300 es `,b=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` @@ -3831,9 +3831,9 @@ precision `+n.precision+" int;";return n.precision==="highp"?e+=` Program Info Log: `+F+` `+P+` -`+j)}else F!==""?console.warn("THREE.WebGLProgram: Program Info Log:",F):(K===""||L==="")&&(G=!1);G&&(U.diagnostics={runnable:H,programLog:F,vertexShader:{log:K,prefix:b},fragmentShader:{log:L,prefix:g}})}s.deleteShader(C),s.deleteShader(x),R=new Hd(s,E),S=tNt(s,E)}let R;this.getUniforms=function(){return R===void 0&&O(this),R};let S;this.getAttributes=function(){return S===void 0&&O(this),S};let A=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return A===!1&&(A=s.getProgramParameter(E,Wwt)),A},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Kwt++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=C,this.fragmentShader=x,this}let _Nt=0;class hNt{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,s=this._getShaderStage(t),r=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(s)===!1&&(o.add(s),s.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new fNt(e),t.set(e,i)),i}}class fNt{constructor(e){this.id=_Nt++,this.code=e,this.usedTimes=0}}function mNt(n,e,t,i,s,r,o){const a=new pI,l=new hNt,d=[],c=s.isWebGL2,_=s.logarithmicDepthBuffer,f=s.vertexTextures;let m=s.precision;const h={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function E(S){return S===0?"uv":`uv${S}`}function b(S,A,U,F,K){const L=F.fog,H=K.geometry,G=S.isMeshStandardMaterial?F.environment:null,P=(S.isMeshStandardMaterial?t:e).get(S.envMap||G),j=P&&P.mapping===up?P.image.height:null,Y=h[S.type];S.precision!==null&&(m=s.getMaxPrecision(S.precision),m!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",m,"instead."));const Q=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,ae=Q!==void 0?Q.length:0;let te=0;H.morphAttributes.position!==void 0&&(te=1),H.morphAttributes.normal!==void 0&&(te=2),H.morphAttributes.color!==void 0&&(te=3);let Z,me,ve,Ae;if(Y){const ln=Xi[Y];Z=ln.vertexShader,me=ln.fragmentShader}else Z=S.vertexShader,me=S.fragmentShader,l.update(S),ve=l.getVertexShaderID(S),Ae=l.getFragmentShaderID(S);const J=n.getRenderTarget(),ge=K.isInstancedMesh===!0,ee=K.isBatchedMesh===!0,Se=!!S.map,Ie=!!S.matcap,k=!!P,B=!!S.aoMap,$=!!S.lightMap,de=!!S.bumpMap,ie=!!S.normalMap,Ce=!!S.displacementMap,we=!!S.emissiveMap,V=!!S.metalnessMap,_e=!!S.roughnessMap,se=S.anisotropy>0,ce=S.clearcoat>0,D=S.iridescence>0,I=S.sheen>0,z=S.transmission>0,he=se&&!!S.anisotropyMap,X=ce&&!!S.clearcoatMap,re=ce&&!!S.clearcoatNormalMap,Re=ce&&!!S.clearcoatRoughnessMap,xe=D&&!!S.iridescenceMap,De=D&&!!S.iridescenceThicknessMap,ze=I&&!!S.sheenColorMap,st=I&&!!S.sheenRoughnessMap,ke=!!S.specularMap,lt=!!S.specularColorMap,Qe=!!S.specularIntensityMap,He=z&&!!S.transmissionMap,et=z&&!!S.thicknessMap,Fe=!!S.gradientMap,pt=!!S.alphaMap,pe=S.alphaTest>0,We=!!S.alphaHash,Ue=!!S.extensions,Ne=!!H.attributes.uv1,Be=!!H.attributes.uv2,dt=!!H.attributes.uv3;let Et=Tr;return S.toneMapped&&(J===null||J.isXRRenderTarget===!0)&&(Et=n.toneMapping),{isWebGL2:c,shaderID:Y,shaderType:S.type,shaderName:S.name,vertexShader:Z,fragmentShader:me,defines:S.defines,customVertexShaderID:ve,customFragmentShaderID:Ae,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:m,batching:ee,instancing:ge,instancingColor:ge&&K.instanceColor!==null,supportsVertexTextures:f,outputColorSpace:J===null?n.outputColorSpace:J.isXRRenderTarget===!0?J.texture.colorSpace:Nn,map:Se,matcap:Ie,envMap:k,envMapMode:k&&P.mapping,envMapCubeUVHeight:j,aoMap:B,lightMap:$,bumpMap:de,normalMap:ie,displacementMap:f&&Ce,emissiveMap:we,normalMapObjectSpace:ie&&S.normalMapType===pCt,normalMapTangentSpace:ie&&S.normalMapType===ZE,metalnessMap:V,roughnessMap:_e,anisotropy:se,anisotropyMap:he,clearcoat:ce,clearcoatMap:X,clearcoatNormalMap:re,clearcoatRoughnessMap:Re,iridescence:D,iridescenceMap:xe,iridescenceThicknessMap:De,sheen:I,sheenColorMap:ze,sheenRoughnessMap:st,specularMap:ke,specularColorMap:lt,specularIntensityMap:Qe,transmission:z,transmissionMap:He,thicknessMap:et,gradientMap:Fe,opaque:S.transparent===!1&&S.blending===aa,alphaMap:pt,alphaTest:pe,alphaHash:We,combine:S.combine,mapUv:Se&&E(S.map.channel),aoMapUv:B&&E(S.aoMap.channel),lightMapUv:$&&E(S.lightMap.channel),bumpMapUv:de&&E(S.bumpMap.channel),normalMapUv:ie&&E(S.normalMap.channel),displacementMapUv:Ce&&E(S.displacementMap.channel),emissiveMapUv:we&&E(S.emissiveMap.channel),metalnessMapUv:V&&E(S.metalnessMap.channel),roughnessMapUv:_e&&E(S.roughnessMap.channel),anisotropyMapUv:he&&E(S.anisotropyMap.channel),clearcoatMapUv:X&&E(S.clearcoatMap.channel),clearcoatNormalMapUv:re&&E(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Re&&E(S.clearcoatRoughnessMap.channel),iridescenceMapUv:xe&&E(S.iridescenceMap.channel),iridescenceThicknessMapUv:De&&E(S.iridescenceThicknessMap.channel),sheenColorMapUv:ze&&E(S.sheenColorMap.channel),sheenRoughnessMapUv:st&&E(S.sheenRoughnessMap.channel),specularMapUv:ke&&E(S.specularMap.channel),specularColorMapUv:lt&&E(S.specularColorMap.channel),specularIntensityMapUv:Qe&&E(S.specularIntensityMap.channel),transmissionMapUv:He&&E(S.transmissionMap.channel),thicknessMapUv:et&&E(S.thicknessMap.channel),alphaMapUv:pt&&E(S.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(ie||se),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,vertexUv1s:Ne,vertexUv2s:Be,vertexUv3s:dt,pointsUvs:K.isPoints===!0&&!!H.attributes.uv&&(Se||pt),fog:!!L,useFog:S.fog===!0,fogExp2:L&&L.isFogExp2,flatShading:S.flatShading===!0,sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:_,skinning:K.isSkinnedMesh===!0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:ae,morphTextureStride:te,numDirLights:A.directional.length,numPointLights:A.point.length,numSpotLights:A.spot.length,numSpotLightMaps:A.spotLightMap.length,numRectAreaLights:A.rectArea.length,numHemiLights:A.hemi.length,numDirLightShadows:A.directionalShadowMap.length,numPointLightShadows:A.pointShadowMap.length,numSpotLightShadows:A.spotShadowMap.length,numSpotLightShadowsWithMaps:A.numSpotLightShadowsWithMaps,numLightProbes:A.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:S.dithering,shadowMapEnabled:n.shadowMap.enabled&&U.length>0,shadowMapType:n.shadowMap.type,toneMapping:Et,useLegacyLights:n._useLegacyLights,decodeVideoTexture:Se&&S.map.isVideoTexture===!0&&Ft.getTransfer(S.map.colorSpace)===Xt,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===Ji,flipSided:S.side===Zn,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionDerivatives:Ue&&S.extensions.derivatives===!0,extensionFragDepth:Ue&&S.extensions.fragDepth===!0,extensionDrawBuffers:Ue&&S.extensions.drawBuffers===!0,extensionShaderTextureLOD:Ue&&S.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:c||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()}}function g(S){const A=[];if(S.shaderID?A.push(S.shaderID):(A.push(S.customVertexShaderID),A.push(S.customFragmentShaderID)),S.defines!==void 0)for(const U in S.defines)A.push(U),A.push(S.defines[U]);return S.isRawShaderMaterial===!1&&(v(A,S),y(A,S),A.push(n.outputColorSpace)),A.push(S.customProgramCacheKey),A.join()}function v(S,A){S.push(A.precision),S.push(A.outputColorSpace),S.push(A.envMapMode),S.push(A.envMapCubeUVHeight),S.push(A.mapUv),S.push(A.alphaMapUv),S.push(A.lightMapUv),S.push(A.aoMapUv),S.push(A.bumpMapUv),S.push(A.normalMapUv),S.push(A.displacementMapUv),S.push(A.emissiveMapUv),S.push(A.metalnessMapUv),S.push(A.roughnessMapUv),S.push(A.anisotropyMapUv),S.push(A.clearcoatMapUv),S.push(A.clearcoatNormalMapUv),S.push(A.clearcoatRoughnessMapUv),S.push(A.iridescenceMapUv),S.push(A.iridescenceThicknessMapUv),S.push(A.sheenColorMapUv),S.push(A.sheenRoughnessMapUv),S.push(A.specularMapUv),S.push(A.specularColorMapUv),S.push(A.specularIntensityMapUv),S.push(A.transmissionMapUv),S.push(A.thicknessMapUv),S.push(A.combine),S.push(A.fogExp2),S.push(A.sizeAttenuation),S.push(A.morphTargetsCount),S.push(A.morphAttributeCount),S.push(A.numDirLights),S.push(A.numPointLights),S.push(A.numSpotLights),S.push(A.numSpotLightMaps),S.push(A.numHemiLights),S.push(A.numRectAreaLights),S.push(A.numDirLightShadows),S.push(A.numPointLightShadows),S.push(A.numSpotLightShadows),S.push(A.numSpotLightShadowsWithMaps),S.push(A.numLightProbes),S.push(A.shadowMapType),S.push(A.toneMapping),S.push(A.numClippingPlanes),S.push(A.numClipIntersection),S.push(A.depthPacking)}function y(S,A){a.disableAll(),A.isWebGL2&&a.enable(0),A.supportsVertexTextures&&a.enable(1),A.instancing&&a.enable(2),A.instancingColor&&a.enable(3),A.matcap&&a.enable(4),A.envMap&&a.enable(5),A.normalMapObjectSpace&&a.enable(6),A.normalMapTangentSpace&&a.enable(7),A.clearcoat&&a.enable(8),A.iridescence&&a.enable(9),A.alphaTest&&a.enable(10),A.vertexColors&&a.enable(11),A.vertexAlphas&&a.enable(12),A.vertexUv1s&&a.enable(13),A.vertexUv2s&&a.enable(14),A.vertexUv3s&&a.enable(15),A.vertexTangents&&a.enable(16),A.anisotropy&&a.enable(17),A.alphaHash&&a.enable(18),A.batching&&a.enable(19),S.push(a.mask),a.disableAll(),A.fog&&a.enable(0),A.useFog&&a.enable(1),A.flatShading&&a.enable(2),A.logarithmicDepthBuffer&&a.enable(3),A.skinning&&a.enable(4),A.morphTargets&&a.enable(5),A.morphNormals&&a.enable(6),A.morphColors&&a.enable(7),A.premultipliedAlpha&&a.enable(8),A.shadowMapEnabled&&a.enable(9),A.useLegacyLights&&a.enable(10),A.doubleSided&&a.enable(11),A.flipSided&&a.enable(12),A.useDepthPacking&&a.enable(13),A.dithering&&a.enable(14),A.transmission&&a.enable(15),A.sheen&&a.enable(16),A.opaque&&a.enable(17),A.pointsUvs&&a.enable(18),A.decodeVideoTexture&&a.enable(19),S.push(a.mask)}function T(S){const A=h[S.type];let U;if(A){const F=Xi[A];U=JCt.clone(F.uniforms)}else U=S.uniforms;return U}function C(S,A){let U;for(let F=0,K=d.length;F0?i.push(g):m.transparent===!0?s.push(g):t.push(g)}function l(_,f,m,h,E,b){const g=o(_,f,m,h,E,b);m.transmission>0?i.unshift(g):m.transparent===!0?s.unshift(g):t.unshift(g)}function d(_,f){t.length>1&&t.sort(_||bNt),i.length>1&&i.sort(f||lR),s.length>1&&s.sort(f||lR)}function c(){for(let _=e,f=n.length;_=r.length?(o=new cR,r.push(o)):o=r[s],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function vNt(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new be,color:new gt};break;case"SpotLight":t={position:new be,direction:new be,color:new gt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new be,color:new gt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new be,skyColor:new gt,groundColor:new gt};break;case"RectAreaLight":t={color:new gt,position:new be,halfWidth:new be,halfHeight:new be};break}return n[e.id]=t,t}}}function yNt(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Mt};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Mt};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Mt,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let SNt=0;function TNt(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function xNt(n,e){const t=new vNt,i=yNt(),s={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)s.probe.push(new be);const r=new be,o=new At,a=new At;function l(c,_){let f=0,m=0,h=0;for(let F=0;F<9;F++)s.probe[F].set(0,0,0);let E=0,b=0,g=0,v=0,y=0,T=0,C=0,x=0,O=0,R=0,S=0;c.sort(TNt);const A=_===!0?Math.PI:1;for(let F=0,K=c.length;F0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=Ke.LTC_FLOAT_1,s.rectAreaLTC2=Ke.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(s.rectAreaLTC1=Ke.LTC_HALF_1,s.rectAreaLTC2=Ke.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),s.ambient[0]=f,s.ambient[1]=m,s.ambient[2]=h;const U=s.hash;(U.directionalLength!==E||U.pointLength!==b||U.spotLength!==g||U.rectAreaLength!==v||U.hemiLength!==y||U.numDirectionalShadows!==T||U.numPointShadows!==C||U.numSpotShadows!==x||U.numSpotMaps!==O||U.numLightProbes!==S)&&(s.directional.length=E,s.spot.length=g,s.rectArea.length=v,s.point.length=b,s.hemi.length=y,s.directionalShadow.length=T,s.directionalShadowMap.length=T,s.pointShadow.length=C,s.pointShadowMap.length=C,s.spotShadow.length=x,s.spotShadowMap.length=x,s.directionalShadowMatrix.length=T,s.pointShadowMatrix.length=C,s.spotLightMatrix.length=x+O-R,s.spotLightMap.length=O,s.numSpotLightShadowsWithMaps=R,s.numLightProbes=S,U.directionalLength=E,U.pointLength=b,U.spotLength=g,U.rectAreaLength=v,U.hemiLength=y,U.numDirectionalShadows=T,U.numPointShadows=C,U.numSpotShadows=x,U.numSpotMaps=O,U.numLightProbes=S,s.version=SNt++)}function d(c,_){let f=0,m=0,h=0,E=0,b=0;const g=_.matrixWorldInverse;for(let v=0,y=c.length;v=a.length?(l=new dR(n,e),a.push(l)):l=a[o],l}function s(){t=new WeakMap}return{get:i,dispose:s}}class RNt extends Vi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=dCt,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class ANt extends Vi{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const wNt=`void main() { +`+j)}else F!==""?console.warn("THREE.WebGLProgram: Program Info Log:",F):(K===""||L==="")&&(G=!1);G&&(U.diagnostics={runnable:H,programLog:F,vertexShader:{log:K,prefix:b},fragmentShader:{log:L,prefix:g}})}s.deleteShader(C),s.deleteShader(x),R=new Hd(s,E),S=iNt(s,E)}let R;this.getUniforms=function(){return R===void 0&&O(this),R};let S;this.getAttributes=function(){return S===void 0&&O(this),S};let A=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return A===!1&&(A=s.getProgramParameter(E,jwt)),A},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Qwt++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=C,this.fragmentShader=x,this}let fNt=0;class mNt{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,s=this._getShaderStage(t),r=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(s)===!1&&(o.add(s),s.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new gNt(e),t.set(e,i)),i}}class gNt{constructor(e){this.id=fNt++,this.code=e,this.usedTimes=0}}function bNt(n,e,t,i,s,r,o){const a=new pI,l=new mNt,d=[],c=s.isWebGL2,_=s.logarithmicDepthBuffer,f=s.vertexTextures;let m=s.precision;const h={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function E(S){return S===0?"uv":`uv${S}`}function b(S,A,U,F,K){const L=F.fog,H=K.geometry,G=S.isMeshStandardMaterial?F.environment:null,P=(S.isMeshStandardMaterial?t:e).get(S.envMap||G),j=P&&P.mapping===up?P.image.height:null,Y=h[S.type];S.precision!==null&&(m=s.getMaxPrecision(S.precision),m!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",m,"instead."));const Q=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,ae=Q!==void 0?Q.length:0;let te=0;H.morphAttributes.position!==void 0&&(te=1),H.morphAttributes.normal!==void 0&&(te=2),H.morphAttributes.color!==void 0&&(te=3);let Z,me,ve,Ae;if(Y){const ln=Xi[Y];Z=ln.vertexShader,me=ln.fragmentShader}else Z=S.vertexShader,me=S.fragmentShader,l.update(S),ve=l.getVertexShaderID(S),Ae=l.getFragmentShaderID(S);const J=n.getRenderTarget(),ge=K.isInstancedMesh===!0,ee=K.isBatchedMesh===!0,Se=!!S.map,Ie=!!S.matcap,k=!!P,B=!!S.aoMap,$=!!S.lightMap,de=!!S.bumpMap,ie=!!S.normalMap,Ce=!!S.displacementMap,we=!!S.emissiveMap,V=!!S.metalnessMap,_e=!!S.roughnessMap,se=S.anisotropy>0,ce=S.clearcoat>0,D=S.iridescence>0,I=S.sheen>0,z=S.transmission>0,he=se&&!!S.anisotropyMap,X=ce&&!!S.clearcoatMap,re=ce&&!!S.clearcoatNormalMap,Re=ce&&!!S.clearcoatRoughnessMap,xe=D&&!!S.iridescenceMap,De=D&&!!S.iridescenceThicknessMap,ze=I&&!!S.sheenColorMap,st=I&&!!S.sheenRoughnessMap,ke=!!S.specularMap,lt=!!S.specularColorMap,Qe=!!S.specularIntensityMap,He=z&&!!S.transmissionMap,et=z&&!!S.thicknessMap,Fe=!!S.gradientMap,pt=!!S.alphaMap,pe=S.alphaTest>0,We=!!S.alphaHash,Ue=!!S.extensions,Ne=!!H.attributes.uv1,Be=!!H.attributes.uv2,dt=!!H.attributes.uv3;let Et=Tr;return S.toneMapped&&(J===null||J.isXRRenderTarget===!0)&&(Et=n.toneMapping),{isWebGL2:c,shaderID:Y,shaderType:S.type,shaderName:S.name,vertexShader:Z,fragmentShader:me,defines:S.defines,customVertexShaderID:ve,customFragmentShaderID:Ae,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:m,batching:ee,instancing:ge,instancingColor:ge&&K.instanceColor!==null,supportsVertexTextures:f,outputColorSpace:J===null?n.outputColorSpace:J.isXRRenderTarget===!0?J.texture.colorSpace:Nn,map:Se,matcap:Ie,envMap:k,envMapMode:k&&P.mapping,envMapCubeUVHeight:j,aoMap:B,lightMap:$,bumpMap:de,normalMap:ie,displacementMap:f&&Ce,emissiveMap:we,normalMapObjectSpace:ie&&S.normalMapType===hCt,normalMapTangentSpace:ie&&S.normalMapType===ZE,metalnessMap:V,roughnessMap:_e,anisotropy:se,anisotropyMap:he,clearcoat:ce,clearcoatMap:X,clearcoatNormalMap:re,clearcoatRoughnessMap:Re,iridescence:D,iridescenceMap:xe,iridescenceThicknessMap:De,sheen:I,sheenColorMap:ze,sheenRoughnessMap:st,specularMap:ke,specularColorMap:lt,specularIntensityMap:Qe,transmission:z,transmissionMap:He,thicknessMap:et,gradientMap:Fe,opaque:S.transparent===!1&&S.blending===aa,alphaMap:pt,alphaTest:pe,alphaHash:We,combine:S.combine,mapUv:Se&&E(S.map.channel),aoMapUv:B&&E(S.aoMap.channel),lightMapUv:$&&E(S.lightMap.channel),bumpMapUv:de&&E(S.bumpMap.channel),normalMapUv:ie&&E(S.normalMap.channel),displacementMapUv:Ce&&E(S.displacementMap.channel),emissiveMapUv:we&&E(S.emissiveMap.channel),metalnessMapUv:V&&E(S.metalnessMap.channel),roughnessMapUv:_e&&E(S.roughnessMap.channel),anisotropyMapUv:he&&E(S.anisotropyMap.channel),clearcoatMapUv:X&&E(S.clearcoatMap.channel),clearcoatNormalMapUv:re&&E(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Re&&E(S.clearcoatRoughnessMap.channel),iridescenceMapUv:xe&&E(S.iridescenceMap.channel),iridescenceThicknessMapUv:De&&E(S.iridescenceThicknessMap.channel),sheenColorMapUv:ze&&E(S.sheenColorMap.channel),sheenRoughnessMapUv:st&&E(S.sheenRoughnessMap.channel),specularMapUv:ke&&E(S.specularMap.channel),specularColorMapUv:lt&&E(S.specularColorMap.channel),specularIntensityMapUv:Qe&&E(S.specularIntensityMap.channel),transmissionMapUv:He&&E(S.transmissionMap.channel),thicknessMapUv:et&&E(S.thicknessMap.channel),alphaMapUv:pt&&E(S.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(ie||se),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,vertexUv1s:Ne,vertexUv2s:Be,vertexUv3s:dt,pointsUvs:K.isPoints===!0&&!!H.attributes.uv&&(Se||pt),fog:!!L,useFog:S.fog===!0,fogExp2:L&&L.isFogExp2,flatShading:S.flatShading===!0,sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:_,skinning:K.isSkinnedMesh===!0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:ae,morphTextureStride:te,numDirLights:A.directional.length,numPointLights:A.point.length,numSpotLights:A.spot.length,numSpotLightMaps:A.spotLightMap.length,numRectAreaLights:A.rectArea.length,numHemiLights:A.hemi.length,numDirLightShadows:A.directionalShadowMap.length,numPointLightShadows:A.pointShadowMap.length,numSpotLightShadows:A.spotShadowMap.length,numSpotLightShadowsWithMaps:A.numSpotLightShadowsWithMaps,numLightProbes:A.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:S.dithering,shadowMapEnabled:n.shadowMap.enabled&&U.length>0,shadowMapType:n.shadowMap.type,toneMapping:Et,useLegacyLights:n._useLegacyLights,decodeVideoTexture:Se&&S.map.isVideoTexture===!0&&Ft.getTransfer(S.map.colorSpace)===Xt,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===Ji,flipSided:S.side===Zn,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionDerivatives:Ue&&S.extensions.derivatives===!0,extensionFragDepth:Ue&&S.extensions.fragDepth===!0,extensionDrawBuffers:Ue&&S.extensions.drawBuffers===!0,extensionShaderTextureLOD:Ue&&S.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:c||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()}}function g(S){const A=[];if(S.shaderID?A.push(S.shaderID):(A.push(S.customVertexShaderID),A.push(S.customFragmentShaderID)),S.defines!==void 0)for(const U in S.defines)A.push(U),A.push(S.defines[U]);return S.isRawShaderMaterial===!1&&(v(A,S),y(A,S),A.push(n.outputColorSpace)),A.push(S.customProgramCacheKey),A.join()}function v(S,A){S.push(A.precision),S.push(A.outputColorSpace),S.push(A.envMapMode),S.push(A.envMapCubeUVHeight),S.push(A.mapUv),S.push(A.alphaMapUv),S.push(A.lightMapUv),S.push(A.aoMapUv),S.push(A.bumpMapUv),S.push(A.normalMapUv),S.push(A.displacementMapUv),S.push(A.emissiveMapUv),S.push(A.metalnessMapUv),S.push(A.roughnessMapUv),S.push(A.anisotropyMapUv),S.push(A.clearcoatMapUv),S.push(A.clearcoatNormalMapUv),S.push(A.clearcoatRoughnessMapUv),S.push(A.iridescenceMapUv),S.push(A.iridescenceThicknessMapUv),S.push(A.sheenColorMapUv),S.push(A.sheenRoughnessMapUv),S.push(A.specularMapUv),S.push(A.specularColorMapUv),S.push(A.specularIntensityMapUv),S.push(A.transmissionMapUv),S.push(A.thicknessMapUv),S.push(A.combine),S.push(A.fogExp2),S.push(A.sizeAttenuation),S.push(A.morphTargetsCount),S.push(A.morphAttributeCount),S.push(A.numDirLights),S.push(A.numPointLights),S.push(A.numSpotLights),S.push(A.numSpotLightMaps),S.push(A.numHemiLights),S.push(A.numRectAreaLights),S.push(A.numDirLightShadows),S.push(A.numPointLightShadows),S.push(A.numSpotLightShadows),S.push(A.numSpotLightShadowsWithMaps),S.push(A.numLightProbes),S.push(A.shadowMapType),S.push(A.toneMapping),S.push(A.numClippingPlanes),S.push(A.numClipIntersection),S.push(A.depthPacking)}function y(S,A){a.disableAll(),A.isWebGL2&&a.enable(0),A.supportsVertexTextures&&a.enable(1),A.instancing&&a.enable(2),A.instancingColor&&a.enable(3),A.matcap&&a.enable(4),A.envMap&&a.enable(5),A.normalMapObjectSpace&&a.enable(6),A.normalMapTangentSpace&&a.enable(7),A.clearcoat&&a.enable(8),A.iridescence&&a.enable(9),A.alphaTest&&a.enable(10),A.vertexColors&&a.enable(11),A.vertexAlphas&&a.enable(12),A.vertexUv1s&&a.enable(13),A.vertexUv2s&&a.enable(14),A.vertexUv3s&&a.enable(15),A.vertexTangents&&a.enable(16),A.anisotropy&&a.enable(17),A.alphaHash&&a.enable(18),A.batching&&a.enable(19),S.push(a.mask),a.disableAll(),A.fog&&a.enable(0),A.useFog&&a.enable(1),A.flatShading&&a.enable(2),A.logarithmicDepthBuffer&&a.enable(3),A.skinning&&a.enable(4),A.morphTargets&&a.enable(5),A.morphNormals&&a.enable(6),A.morphColors&&a.enable(7),A.premultipliedAlpha&&a.enable(8),A.shadowMapEnabled&&a.enable(9),A.useLegacyLights&&a.enable(10),A.doubleSided&&a.enable(11),A.flipSided&&a.enable(12),A.useDepthPacking&&a.enable(13),A.dithering&&a.enable(14),A.transmission&&a.enable(15),A.sheen&&a.enable(16),A.opaque&&a.enable(17),A.pointsUvs&&a.enable(18),A.decodeVideoTexture&&a.enable(19),S.push(a.mask)}function T(S){const A=h[S.type];let U;if(A){const F=Xi[A];U=t1t.clone(F.uniforms)}else U=S.uniforms;return U}function C(S,A){let U;for(let F=0,K=d.length;F0?i.push(g):m.transparent===!0?s.push(g):t.push(g)}function l(_,f,m,h,E,b){const g=o(_,f,m,h,E,b);m.transmission>0?i.unshift(g):m.transparent===!0?s.unshift(g):t.unshift(g)}function d(_,f){t.length>1&&t.sort(_||vNt),i.length>1&&i.sort(f||lR),s.length>1&&s.sort(f||lR)}function c(){for(let _=e,f=n.length;_=r.length?(o=new cR,r.push(o)):o=r[s],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function SNt(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new be,color:new gt};break;case"SpotLight":t={position:new be,direction:new be,color:new gt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new be,color:new gt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new be,skyColor:new gt,groundColor:new gt};break;case"RectAreaLight":t={color:new gt,position:new be,halfWidth:new be,halfHeight:new be};break}return n[e.id]=t,t}}}function TNt(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Mt};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Mt};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Mt,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let xNt=0;function CNt(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function RNt(n,e){const t=new SNt,i=TNt(),s={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)s.probe.push(new be);const r=new be,o=new At,a=new At;function l(c,_){let f=0,m=0,h=0;for(let F=0;F<9;F++)s.probe[F].set(0,0,0);let E=0,b=0,g=0,v=0,y=0,T=0,C=0,x=0,O=0,R=0,S=0;c.sort(CNt);const A=_===!0?Math.PI:1;for(let F=0,K=c.length;F0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=Ke.LTC_FLOAT_1,s.rectAreaLTC2=Ke.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(s.rectAreaLTC1=Ke.LTC_HALF_1,s.rectAreaLTC2=Ke.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),s.ambient[0]=f,s.ambient[1]=m,s.ambient[2]=h;const U=s.hash;(U.directionalLength!==E||U.pointLength!==b||U.spotLength!==g||U.rectAreaLength!==v||U.hemiLength!==y||U.numDirectionalShadows!==T||U.numPointShadows!==C||U.numSpotShadows!==x||U.numSpotMaps!==O||U.numLightProbes!==S)&&(s.directional.length=E,s.spot.length=g,s.rectArea.length=v,s.point.length=b,s.hemi.length=y,s.directionalShadow.length=T,s.directionalShadowMap.length=T,s.pointShadow.length=C,s.pointShadowMap.length=C,s.spotShadow.length=x,s.spotShadowMap.length=x,s.directionalShadowMatrix.length=T,s.pointShadowMatrix.length=C,s.spotLightMatrix.length=x+O-R,s.spotLightMap.length=O,s.numSpotLightShadowsWithMaps=R,s.numLightProbes=S,U.directionalLength=E,U.pointLength=b,U.spotLength=g,U.rectAreaLength=v,U.hemiLength=y,U.numDirectionalShadows=T,U.numPointShadows=C,U.numSpotShadows=x,U.numSpotMaps=O,U.numLightProbes=S,s.version=xNt++)}function d(c,_){let f=0,m=0,h=0,E=0,b=0;const g=_.matrixWorldInverse;for(let v=0,y=c.length;v=a.length?(l=new dR(n,e),a.push(l)):l=a[o],l}function s(){t=new WeakMap}return{get:i,dispose:s}}class wNt extends Vi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=pCt,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class NNt extends Vi{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const ONt=`void main() { gl_Position = vec4( position, 1.0 ); -}`,NNt=`uniform sampler2D shadow_pass; +}`,INt=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include @@ -3859,8 +3859,8 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function ONt(n,e,t){let i=new tv;const s=new Mt,r=new Mt,o=new Wt,a=new RNt({depthPacking:uCt}),l=new ANt,d={},c=t.maxTextureSize,_={[Vs]:Zn,[Zn]:Vs,[Ji]:Ji},f=new Eo({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Mt},radius:{value:4}},vertexShader:wNt,fragmentShader:NNt}),m=f.clone();m.defines.HORIZONTAL_PASS=1;const h=new fs;h.setAttribute("position",new Yn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new Hn(h,f),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=jO;let g=this.type;this.render=function(C,x,O){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||C.length===0)return;const R=n.getRenderTarget(),S=n.getActiveCubeFace(),A=n.getActiveMipmapLevel(),U=n.state;U.setBlending(Sr),U.buffers.color.setClear(1,1,1,1),U.buffers.depth.setTest(!0),U.setScissorTest(!1);const F=g!==Is&&this.type===Is,K=g===Is&&this.type!==Is;for(let L=0,H=C.length;Lc||s.y>c)&&(s.x>c&&(r.x=Math.floor(c/j.x),s.x=r.x*j.x,P.mapSize.x=r.x),s.y>c&&(r.y=Math.floor(c/j.y),s.y=r.y*j.y,P.mapSize.y=r.y)),P.map===null||F===!0||K===!0){const Q=this.type!==Is?{minFilter:En,magFilter:En}:{};P.map!==null&&P.map.dispose(),P.map=new bo(s.x,s.y,Q),P.map.texture.name=G.name+".shadowMap",P.camera.updateProjectionMatrix()}n.setRenderTarget(P.map),n.clear();const Y=P.getViewportCount();for(let Q=0;Q0||x.map&&x.alphaTest>0){const U=S.uuid,F=x.uuid;let K=d[U];K===void 0&&(K={},d[U]=K);let L=K[F];L===void 0&&(L=S.clone(),K[F]=L),S=L}if(S.visible=x.visible,S.wireframe=x.wireframe,R===Is?S.side=x.shadowSide!==null?x.shadowSide:x.side:S.side=x.shadowSide!==null?x.shadowSide:_[x.side],S.alphaMap=x.alphaMap,S.alphaTest=x.alphaTest,S.map=x.map,S.clipShadows=x.clipShadows,S.clippingPlanes=x.clippingPlanes,S.clipIntersection=x.clipIntersection,S.displacementMap=x.displacementMap,S.displacementScale=x.displacementScale,S.displacementBias=x.displacementBias,S.wireframeLinewidth=x.wireframeLinewidth,S.linewidth=x.linewidth,O.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const U=n.properties.get(S);U.light=O}return S}function T(C,x,O,R,S){if(C.visible===!1)return;if(C.layers.test(x.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&S===Is)&&(!C.frustumCulled||i.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(O.matrixWorldInverse,C.matrixWorld);const F=e.update(C),K=C.material;if(Array.isArray(K)){const L=F.groups;for(let H=0,G=L.length;H=1):Q.indexOf("OpenGL ES")!==-1&&(Y=parseFloat(/^OpenGL ES (\d)/.exec(Q)[1]),j=Y>=2);let ae=null,te={};const Z=n.getParameter(n.SCISSOR_BOX),me=n.getParameter(n.VIEWPORT),ve=new Wt().fromArray(Z),Ae=new Wt().fromArray(me);function J(pe,We,Ue,Ne){const Be=new Uint8Array(4),dt=n.createTexture();n.bindTexture(pe,dt),n.texParameteri(pe,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(pe,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Et=0;Et"u"?!1:/OculusBrowser/g.test(navigator.userAgent),h=new WeakMap;let E;const b=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(D,I){return g?new OffscreenCanvas(D,I):lc("canvas")}function y(D,I,z,he){let X=1;if((D.width>he||D.height>he)&&(X=he/Math.max(D.width,D.height)),X<1||I===!0)if(typeof HTMLImageElement<"u"&&D instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&D instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&D instanceof ImageBitmap){const re=I?Su:Math.floor,Re=re(X*D.width),xe=re(X*D.height);E===void 0&&(E=v(Re,xe));const De=z?v(Re,xe):E;return De.width=Re,De.height=xe,De.getContext("2d").drawImage(D,0,0,Re,xe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+D.width+"x"+D.height+") to ("+Re+"x"+xe+")."),De}else return"data"in D&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+D.width+"x"+D.height+")."),D;return D}function T(D){return fb(D.width)&&fb(D.height)}function C(D){return a?!1:D.wrapS!==gi||D.wrapT!==gi||D.minFilter!==En&&D.minFilter!==jn}function x(D,I){return D.generateMipmaps&&I&&D.minFilter!==En&&D.minFilter!==jn}function O(D){n.generateMipmap(D)}function R(D,I,z,he,X=!1){if(a===!1)return I;if(D!==null){if(n[D]!==void 0)return n[D];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+D+"'")}let re=I;if(I===n.RED&&(z===n.FLOAT&&(re=n.R32F),z===n.HALF_FLOAT&&(re=n.R16F),z===n.UNSIGNED_BYTE&&(re=n.R8)),I===n.RED_INTEGER&&(z===n.UNSIGNED_BYTE&&(re=n.R8UI),z===n.UNSIGNED_SHORT&&(re=n.R16UI),z===n.UNSIGNED_INT&&(re=n.R32UI),z===n.BYTE&&(re=n.R8I),z===n.SHORT&&(re=n.R16I),z===n.INT&&(re=n.R32I)),I===n.RG&&(z===n.FLOAT&&(re=n.RG32F),z===n.HALF_FLOAT&&(re=n.RG16F),z===n.UNSIGNED_BYTE&&(re=n.RG8)),I===n.RGBA){const Re=X?bu:Ft.getTransfer(he);z===n.FLOAT&&(re=n.RGBA32F),z===n.HALF_FLOAT&&(re=n.RGBA16F),z===n.UNSIGNED_BYTE&&(re=Re===Xt?n.SRGB8_ALPHA8:n.RGBA8),z===n.UNSIGNED_SHORT_4_4_4_4&&(re=n.RGBA4),z===n.UNSIGNED_SHORT_5_5_5_1&&(re=n.RGB5_A1)}return(re===n.R16F||re===n.R32F||re===n.RG16F||re===n.RG32F||re===n.RGBA16F||re===n.RGBA32F)&&e.get("EXT_color_buffer_float"),re}function S(D,I,z){return x(D,z)===!0||D.isFramebufferTexture&&D.minFilter!==En&&D.minFilter!==jn?Math.log2(Math.max(I.width,I.height))+1:D.mipmaps!==void 0&&D.mipmaps.length>0?D.mipmaps.length:D.isCompressedTexture&&Array.isArray(D.image)?I.mipmaps.length:1}function A(D){return D===En||D===ub||D===Vd?n.NEAREST:n.LINEAR}function U(D){const I=D.target;I.removeEventListener("dispose",U),K(I),I.isVideoTexture&&h.delete(I)}function F(D){const I=D.target;I.removeEventListener("dispose",F),H(I)}function K(D){const I=i.get(D);if(I.__webglInit===void 0)return;const z=D.source,he=b.get(z);if(he){const X=he[I.__cacheKey];X.usedTimes--,X.usedTimes===0&&L(D),Object.keys(he).length===0&&b.delete(z)}i.remove(D)}function L(D){const I=i.get(D);n.deleteTexture(I.__webglTexture);const z=D.source,he=b.get(z);delete he[I.__cacheKey],o.memory.textures--}function H(D){const I=D.texture,z=i.get(D),he=i.get(I);if(he.__webglTexture!==void 0&&(n.deleteTexture(he.__webglTexture),o.memory.textures--),D.depthTexture&&D.depthTexture.dispose(),D.isWebGLCubeRenderTarget)for(let X=0;X<6;X++){if(Array.isArray(z.__webglFramebuffer[X]))for(let re=0;re=l&&console.warn("THREE.WebGLTextures: Trying to use "+D+" texture units while this GPU supports only "+l),G+=1,D}function Y(D){const I=[];return I.push(D.wrapS),I.push(D.wrapT),I.push(D.wrapR||0),I.push(D.magFilter),I.push(D.minFilter),I.push(D.anisotropy),I.push(D.internalFormat),I.push(D.format),I.push(D.type),I.push(D.generateMipmaps),I.push(D.premultiplyAlpha),I.push(D.flipY),I.push(D.unpackAlignment),I.push(D.colorSpace),I.join()}function Q(D,I){const z=i.get(D);if(D.isVideoTexture&&se(D),D.isRenderTargetTexture===!1&&D.version>0&&z.__version!==D.version){const he=D.image;if(he===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(he.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ee(z,D,I);return}}t.bindTexture(n.TEXTURE_2D,z.__webglTexture,n.TEXTURE0+I)}function ae(D,I){const z=i.get(D);if(D.version>0&&z.__version!==D.version){ee(z,D,I);return}t.bindTexture(n.TEXTURE_2D_ARRAY,z.__webglTexture,n.TEXTURE0+I)}function te(D,I){const z=i.get(D);if(D.version>0&&z.__version!==D.version){ee(z,D,I);return}t.bindTexture(n.TEXTURE_3D,z.__webglTexture,n.TEXTURE0+I)}function Z(D,I){const z=i.get(D);if(D.version>0&&z.__version!==D.version){Se(z,D,I);return}t.bindTexture(n.TEXTURE_CUBE_MAP,z.__webglTexture,n.TEXTURE0+I)}const me={[Ra]:n.REPEAT,[gi]:n.CLAMP_TO_EDGE,[gu]:n.MIRRORED_REPEAT},ve={[En]:n.NEAREST,[ub]:n.NEAREST_MIPMAP_NEAREST,[Vd]:n.NEAREST_MIPMAP_LINEAR,[jn]:n.LINEAR,[XO]:n.LINEAR_MIPMAP_NEAREST,[go]:n.LINEAR_MIPMAP_LINEAR},Ae={[_Ct]:n.NEVER,[ECt]:n.ALWAYS,[hCt]:n.LESS,[aI]:n.LEQUAL,[fCt]:n.EQUAL,[bCt]:n.GEQUAL,[mCt]:n.GREATER,[gCt]:n.NOTEQUAL};function J(D,I,z){if(z?(n.texParameteri(D,n.TEXTURE_WRAP_S,me[I.wrapS]),n.texParameteri(D,n.TEXTURE_WRAP_T,me[I.wrapT]),(D===n.TEXTURE_3D||D===n.TEXTURE_2D_ARRAY)&&n.texParameteri(D,n.TEXTURE_WRAP_R,me[I.wrapR]),n.texParameteri(D,n.TEXTURE_MAG_FILTER,ve[I.magFilter]),n.texParameteri(D,n.TEXTURE_MIN_FILTER,ve[I.minFilter])):(n.texParameteri(D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(D===n.TEXTURE_3D||D===n.TEXTURE_2D_ARRAY)&&n.texParameteri(D,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(I.wrapS!==gi||I.wrapT!==gi)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(D,n.TEXTURE_MAG_FILTER,A(I.magFilter)),n.texParameteri(D,n.TEXTURE_MIN_FILTER,A(I.minFilter)),I.minFilter!==En&&I.minFilter!==jn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),I.compareFunction&&(n.texParameteri(D,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(D,n.TEXTURE_COMPARE_FUNC,Ae[I.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const he=e.get("EXT_texture_filter_anisotropic");if(I.magFilter===En||I.minFilter!==Vd&&I.minFilter!==go||I.type===ks&&e.has("OES_texture_float_linear")===!1||a===!1&&I.type===oc&&e.has("OES_texture_half_float_linear")===!1)return;(I.anisotropy>1||i.get(I).__currentAnisotropy)&&(n.texParameterf(D,he.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(I.anisotropy,s.getMaxAnisotropy())),i.get(I).__currentAnisotropy=I.anisotropy)}}function ge(D,I){let z=!1;D.__webglInit===void 0&&(D.__webglInit=!0,I.addEventListener("dispose",U));const he=I.source;let X=b.get(he);X===void 0&&(X={},b.set(he,X));const re=Y(I);if(re!==D.__cacheKey){X[re]===void 0&&(X[re]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,z=!0),X[re].usedTimes++;const Re=X[D.__cacheKey];Re!==void 0&&(X[D.__cacheKey].usedTimes--,Re.usedTimes===0&&L(I)),D.__cacheKey=re,D.__webglTexture=X[re].texture}return z}function ee(D,I,z){let he=n.TEXTURE_2D;(I.isDataArrayTexture||I.isCompressedArrayTexture)&&(he=n.TEXTURE_2D_ARRAY),I.isData3DTexture&&(he=n.TEXTURE_3D);const X=ge(D,I),re=I.source;t.bindTexture(he,D.__webglTexture,n.TEXTURE0+z);const Re=i.get(re);if(re.version!==Re.__version||X===!0){t.activeTexture(n.TEXTURE0+z);const xe=Ft.getPrimaries(Ft.workingColorSpace),De=I.colorSpace===Ei?null:Ft.getPrimaries(I.colorSpace),ze=I.colorSpace===Ei||xe===De?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,I.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,I.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,ze);const st=C(I)&&T(I.image)===!1;let ke=y(I.image,st,!1,c);ke=ce(I,ke);const lt=T(ke)||a,Qe=r.convert(I.format,I.colorSpace);let He=r.convert(I.type),et=R(I.internalFormat,Qe,He,I.colorSpace,I.isVideoTexture);J(he,I,lt);let Fe;const pt=I.mipmaps,pe=a&&I.isVideoTexture!==!0&&et!==sI,We=Re.__version===void 0||X===!0,Ue=S(I,ke,lt);if(I.isDepthTexture)et=n.DEPTH_COMPONENT,a?I.type===ks?et=n.DEPTH_COMPONENT32F:I.type===br?et=n.DEPTH_COMPONENT24:I.type===lo?et=n.DEPTH24_STENCIL8:et=n.DEPTH_COMPONENT16:I.type===ks&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),I.format===co&&et===n.DEPTH_COMPONENT&&I.type!==XE&&I.type!==br&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),I.type=br,He=r.convert(I.type)),I.format===Aa&&et===n.DEPTH_COMPONENT&&(et=n.DEPTH_STENCIL,I.type!==lo&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),I.type=lo,He=r.convert(I.type))),We&&(pe?t.texStorage2D(n.TEXTURE_2D,1,et,ke.width,ke.height):t.texImage2D(n.TEXTURE_2D,0,et,ke.width,ke.height,0,Qe,He,null));else if(I.isDataTexture)if(pt.length>0&<){pe&&We&&t.texStorage2D(n.TEXTURE_2D,Ue,et,pt[0].width,pt[0].height);for(let Ne=0,Be=pt.length;Ne>=1,Be>>=1}}else if(pt.length>0&<){pe&&We&&t.texStorage2D(n.TEXTURE_2D,Ue,et,pt[0].width,pt[0].height);for(let Ne=0,Be=pt.length;Ne0&&We++,t.texStorage2D(n.TEXTURE_CUBE_MAP,We,Fe,ke[0].width,ke[0].height));for(let Ne=0;Ne<6;Ne++)if(st){pt?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,0,0,0,ke[Ne].width,ke[Ne].height,He,et,ke[Ne].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,0,Fe,ke[Ne].width,ke[Ne].height,0,He,et,ke[Ne].data);for(let Be=0;Be>re),ke=Math.max(1,I.height>>re);X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY?t.texImage3D(X,re,De,st,ke,I.depth,0,Re,xe,null):t.texImage2D(X,re,De,st,ke,0,Re,xe,null)}t.bindFramebuffer(n.FRAMEBUFFER,D),_e(I)?f.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,he,X,i.get(z).__webglTexture,0,V(I)):(X===n.TEXTURE_2D||X>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&X<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,he,X,i.get(z).__webglTexture,re),t.bindFramebuffer(n.FRAMEBUFFER,null)}function k(D,I,z){if(n.bindRenderbuffer(n.RENDERBUFFER,D),I.depthBuffer&&!I.stencilBuffer){let he=a===!0?n.DEPTH_COMPONENT24:n.DEPTH_COMPONENT16;if(z||_e(I)){const X=I.depthTexture;X&&X.isDepthTexture&&(X.type===ks?he=n.DEPTH_COMPONENT32F:X.type===br&&(he=n.DEPTH_COMPONENT24));const re=V(I);_e(I)?f.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,re,he,I.width,I.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,re,he,I.width,I.height)}else n.renderbufferStorage(n.RENDERBUFFER,he,I.width,I.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,D)}else if(I.depthBuffer&&I.stencilBuffer){const he=V(I);z&&_e(I)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,he,n.DEPTH24_STENCIL8,I.width,I.height):_e(I)?f.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,he,n.DEPTH24_STENCIL8,I.width,I.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,I.width,I.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,D)}else{const he=I.isWebGLMultipleRenderTargets===!0?I.texture:[I.texture];for(let X=0;X0){z.__webglFramebuffer[xe]=[];for(let De=0;De0){z.__webglFramebuffer=[];for(let xe=0;xe0&&_e(D)===!1){const xe=re?I:[I];z.__webglMultisampledFramebuffer=n.createFramebuffer(),z.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,z.__webglMultisampledFramebuffer);for(let De=0;De0)for(let De=0;De0)for(let De=0;De0&&_e(D)===!1){const I=D.isWebGLMultipleRenderTargets?D.texture:[D.texture],z=D.width,he=D.height;let X=n.COLOR_BUFFER_BIT;const re=[],Re=D.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,xe=i.get(D),De=D.isWebGLMultipleRenderTargets===!0;if(De)for(let ze=0;ze0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&I.__useRenderToTexture!==!1}function se(D){const I=o.render.frame;h.get(D)!==I&&(h.set(D,I),D.update())}function ce(D,I){const z=D.colorSpace,he=D.format,X=D.type;return D.isCompressedTexture===!0||D.isVideoTexture===!0||D.format===hb||z!==Nn&&z!==Ei&&(Ft.getTransfer(z)===Xt?a===!1?e.has("EXT_sRGB")===!0&&he===bi?(D.format=hb,D.minFilter=jn,D.generateMipmaps=!1):I=cI.sRGBToLinear(I):(he!==bi||X!==xr)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",z)),I}this.allocateTextureUnit=j,this.resetTextureUnits=P,this.setTexture2D=Q,this.setTexture2DArray=ae,this.setTexture3D=te,this.setTextureCube=Z,this.rebindTextures=de,this.setupRenderTarget=ie,this.updateRenderTargetMipmap=Ce,this.updateMultisampleRenderTarget=we,this.setupDepthRenderbuffer=$,this.setupFrameBufferTexture=Ie,this.useMultisampledRTT=_e}function DNt(n,e,t){const i=t.isWebGL2;function s(r,o=Ei){let a;const l=Ft.getTransfer(o);if(r===xr)return n.UNSIGNED_BYTE;if(r===JO)return n.UNSIGNED_SHORT_4_4_4_4;if(r===eI)return n.UNSIGNED_SHORT_5_5_5_1;if(r===eCt)return n.BYTE;if(r===tCt)return n.SHORT;if(r===XE)return n.UNSIGNED_SHORT;if(r===ZO)return n.INT;if(r===br)return n.UNSIGNED_INT;if(r===ks)return n.FLOAT;if(r===oc)return i?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(r===nCt)return n.ALPHA;if(r===bi)return n.RGBA;if(r===iCt)return n.LUMINANCE;if(r===sCt)return n.LUMINANCE_ALPHA;if(r===co)return n.DEPTH_COMPONENT;if(r===Aa)return n.DEPTH_STENCIL;if(r===hb)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(r===rCt)return n.RED;if(r===tI)return n.RED_INTEGER;if(r===oCt)return n.RG;if(r===nI)return n.RG_INTEGER;if(r===iI)return n.RGBA_INTEGER;if(r===Bm||r===Gm||r===zm||r===Vm)if(l===Xt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(r===Bm)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Gm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===zm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Vm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(r===Bm)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Gm)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===zm)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Vm)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===QC||r===XC||r===ZC||r===JC)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(r===QC)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===XC)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===ZC)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===JC)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===sI)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===e1||r===t1)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(r===e1)return l===Xt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(r===t1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===n1||r===i1||r===s1||r===r1||r===o1||r===a1||r===l1||r===c1||r===d1||r===u1||r===p1||r===_1||r===h1||r===f1)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(r===n1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===i1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===s1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===r1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===o1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===a1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===l1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===c1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===d1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===u1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===p1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===_1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===h1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===f1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===Hm||r===m1||r===g1)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(r===Hm)return l===Xt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===m1)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===g1)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===aCt||r===b1||r===E1||r===v1)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(r===Hm)return a.COMPRESSED_RED_RGTC1_EXT;if(r===b1)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===E1)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===v1)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===lo?i?n.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[r]!==void 0?n[r]:null}return{convert:s}}class kNt extends Vn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class io extends sn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const LNt={type:"move"};class _g{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new io,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new io,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new be,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new be),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new io,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new be,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new be),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let s=null,r=null,o=null;const a=this._targetRay,l=this._grip,d=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(d&&e.hand){o=!0;for(const E of e.hand.values()){const b=t.getJointPose(E,i),g=this._getHandJoint(d,E);b!==null&&(g.matrix.fromArray(b.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,g.jointRadius=b.radius),g.visible=b!==null}const c=d.joints["index-finger-tip"],_=d.joints["thumb-tip"],f=c.position.distanceTo(_.position),m=.02,h=.005;d.inputState.pinching&&f>m+h?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!d.inputState.pinching&&f<=m-h&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,i),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(s=t.getPose(e.targetRaySpace,i),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(LNt)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=r!==null),d!==null&&(d.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new io;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class PNt extends ja{constructor(e,t){super();const i=this;let s=null,r=1,o=null,a="local-floor",l=1,d=null,c=null,_=null,f=null,m=null,h=null;const E=t.getContextAttributes();let b=null,g=null;const v=[],y=[],T=new Mt;let C=null;const x=new Vn;x.layers.enable(1),x.viewport=new Wt;const O=new Vn;O.layers.enable(2),O.viewport=new Wt;const R=[x,O],S=new kNt;S.layers.enable(1),S.layers.enable(2);let A=null,U=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Z){let me=v[Z];return me===void 0&&(me=new _g,v[Z]=me),me.getTargetRaySpace()},this.getControllerGrip=function(Z){let me=v[Z];return me===void 0&&(me=new _g,v[Z]=me),me.getGripSpace()},this.getHand=function(Z){let me=v[Z];return me===void 0&&(me=new _g,v[Z]=me),me.getHandSpace()};function F(Z){const me=y.indexOf(Z.inputSource);if(me===-1)return;const ve=v[me];ve!==void 0&&(ve.update(Z.inputSource,Z.frame,d||o),ve.dispatchEvent({type:Z.type,data:Z.inputSource}))}function K(){s.removeEventListener("select",F),s.removeEventListener("selectstart",F),s.removeEventListener("selectend",F),s.removeEventListener("squeeze",F),s.removeEventListener("squeezestart",F),s.removeEventListener("squeezeend",F),s.removeEventListener("end",K),s.removeEventListener("inputsourceschange",L);for(let Z=0;Z=0&&(y[Ae]=null,v[Ae].disconnect(ve))}for(let me=0;me=y.length){y.push(ve),Ae=ge;break}else if(y[ge]===null){y[ge]=ve,Ae=ge;break}if(Ae===-1)break}const J=v[Ae];J&&J.connect(ve)}}const H=new be,G=new be;function P(Z,me,ve){H.setFromMatrixPosition(me.matrixWorld),G.setFromMatrixPosition(ve.matrixWorld);const Ae=H.distanceTo(G),J=me.projectionMatrix.elements,ge=ve.projectionMatrix.elements,ee=J[14]/(J[10]-1),Se=J[14]/(J[10]+1),Ie=(J[9]+1)/J[5],k=(J[9]-1)/J[5],B=(J[8]-1)/J[0],$=(ge[8]+1)/ge[0],de=ee*B,ie=ee*$,Ce=Ae/(-B+$),we=Ce*-B;me.matrixWorld.decompose(Z.position,Z.quaternion,Z.scale),Z.translateX(we),Z.translateZ(Ce),Z.matrixWorld.compose(Z.position,Z.quaternion,Z.scale),Z.matrixWorldInverse.copy(Z.matrixWorld).invert();const V=ee+Ce,_e=Se+Ce,se=de-we,ce=ie+(Ae-we),D=Ie*Se/_e*V,I=k*Se/_e*V;Z.projectionMatrix.makePerspective(se,ce,D,I,V,_e),Z.projectionMatrixInverse.copy(Z.projectionMatrix).invert()}function j(Z,me){me===null?Z.matrixWorld.copy(Z.matrix):Z.matrixWorld.multiplyMatrices(me.matrixWorld,Z.matrix),Z.matrixWorldInverse.copy(Z.matrixWorld).invert()}this.updateCamera=function(Z){if(s===null)return;S.near=O.near=x.near=Z.near,S.far=O.far=x.far=Z.far,(A!==S.near||U!==S.far)&&(s.updateRenderState({depthNear:S.near,depthFar:S.far}),A=S.near,U=S.far);const me=Z.parent,ve=S.cameras;j(S,me);for(let Ae=0;Ae0&&(b.alphaTest.value=g.alphaTest);const v=e.get(g).envMap;if(v&&(b.envMap.value=v,b.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,b.reflectivity.value=g.reflectivity,b.ior.value=g.ior,b.refractionRatio.value=g.refractionRatio),g.lightMap){b.lightMap.value=g.lightMap;const y=n._useLegacyLights===!0?Math.PI:1;b.lightMapIntensity.value=g.lightMapIntensity*y,t(g.lightMap,b.lightMapTransform)}g.aoMap&&(b.aoMap.value=g.aoMap,b.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,b.aoMapTransform))}function o(b,g){b.diffuse.value.copy(g.color),b.opacity.value=g.opacity,g.map&&(b.map.value=g.map,t(g.map,b.mapTransform))}function a(b,g){b.dashSize.value=g.dashSize,b.totalSize.value=g.dashSize+g.gapSize,b.scale.value=g.scale}function l(b,g,v,y){b.diffuse.value.copy(g.color),b.opacity.value=g.opacity,b.size.value=g.size*v,b.scale.value=y*.5,g.map&&(b.map.value=g.map,t(g.map,b.uvTransform)),g.alphaMap&&(b.alphaMap.value=g.alphaMap,t(g.alphaMap,b.alphaMapTransform)),g.alphaTest>0&&(b.alphaTest.value=g.alphaTest)}function d(b,g){b.diffuse.value.copy(g.color),b.opacity.value=g.opacity,b.rotation.value=g.rotation,g.map&&(b.map.value=g.map,t(g.map,b.mapTransform)),g.alphaMap&&(b.alphaMap.value=g.alphaMap,t(g.alphaMap,b.alphaMapTransform)),g.alphaTest>0&&(b.alphaTest.value=g.alphaTest)}function c(b,g){b.specular.value.copy(g.specular),b.shininess.value=Math.max(g.shininess,1e-4)}function _(b,g){g.gradientMap&&(b.gradientMap.value=g.gradientMap)}function f(b,g){b.metalness.value=g.metalness,g.metalnessMap&&(b.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,b.metalnessMapTransform)),b.roughness.value=g.roughness,g.roughnessMap&&(b.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,b.roughnessMapTransform)),e.get(g).envMap&&(b.envMapIntensity.value=g.envMapIntensity)}function m(b,g,v){b.ior.value=g.ior,g.sheen>0&&(b.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),b.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(b.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,b.sheenColorMapTransform)),g.sheenRoughnessMap&&(b.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,b.sheenRoughnessMapTransform))),g.clearcoat>0&&(b.clearcoat.value=g.clearcoat,b.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(b.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,b.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(b.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,b.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(b.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,b.clearcoatNormalMapTransform),b.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===Zn&&b.clearcoatNormalScale.value.negate())),g.iridescence>0&&(b.iridescence.value=g.iridescence,b.iridescenceIOR.value=g.iridescenceIOR,b.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],b.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(b.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,b.iridescenceMapTransform)),g.iridescenceThicknessMap&&(b.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,b.iridescenceThicknessMapTransform))),g.transmission>0&&(b.transmission.value=g.transmission,b.transmissionSamplerMap.value=v.texture,b.transmissionSamplerSize.value.set(v.width,v.height),g.transmissionMap&&(b.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,b.transmissionMapTransform)),b.thickness.value=g.thickness,g.thicknessMap&&(b.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,b.thicknessMapTransform)),b.attenuationDistance.value=g.attenuationDistance,b.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(b.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(b.anisotropyMap.value=g.anisotropyMap,t(g.anisotropyMap,b.anisotropyMapTransform))),b.specularIntensity.value=g.specularIntensity,b.specularColor.value.copy(g.specularColor),g.specularColorMap&&(b.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,b.specularColorMapTransform)),g.specularIntensityMap&&(b.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,b.specularIntensityMapTransform))}function h(b,g){g.matcap&&(b.matcap.value=g.matcap)}function E(b,g){const v=e.get(g).light;b.referencePosition.value.setFromMatrixPosition(v.matrixWorld),b.nearDistance.value=v.shadow.camera.near,b.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function FNt(n,e,t,i){let s={},r={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(v,y){const T=y.program;i.uniformBlockBinding(v,T)}function d(v,y){let T=s[v.id];T===void 0&&(h(v),T=c(v),s[v.id]=T,v.addEventListener("dispose",b));const C=y.program;i.updateUBOMapping(v,C);const x=e.render.frame;r[v.id]!==x&&(f(v),r[v.id]=x)}function c(v){const y=_();v.__bindingPointIndex=y;const T=n.createBuffer(),C=v.__size,x=v.usage;return n.bindBuffer(n.UNIFORM_BUFFER,T),n.bufferData(n.UNIFORM_BUFFER,C,x),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,y,T),T}function _(){for(let v=0;v0){x=T%C;const F=C-x;x!==0&&F-A.boundary<0&&(T+=C-x,S.__offset=T)}T+=A.storage}return x=T%C,x>0&&(T+=C-x),v.__size=T,v.__cache={},this}function E(v){const y={boundary:0,storage:0};return typeof v=="number"?(y.boundary=4,y.storage=4):v.isVector2?(y.boundary=8,y.storage=8):v.isVector3||v.isColor?(y.boundary=16,y.storage=12):v.isVector4?(y.boundary=16,y.storage=16):v.isMatrix3?(y.boundary=48,y.storage=48):v.isMatrix4?(y.boundary=64,y.storage=64):v.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",v),y}function b(v){const y=v.target;y.removeEventListener("dispose",b);const T=o.indexOf(y.__bindingPointIndex);o.splice(T,1),n.deleteBuffer(s[y.id]),delete s[y.id],delete r[y.id]}function g(){for(const v in s)n.deleteBuffer(s[v]);o=[],s={},r={}}return{bind:l,update:d,dispose:g}}class RI{constructor(e={}){const{canvas:t=LCt(),context:i=null,depth:s=!0,stencil:r=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:d=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:_=!1}=e;this.isWebGLRenderer=!0;let f;i!==null?f=i.getContextAttributes().alpha:f=o;const m=new Uint32Array(4),h=new Int32Array(4);let E=null,b=null;const g=[],v=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=rn,this._useLegacyLights=!1,this.toneMapping=Tr,this.toneMappingExposure=1;const y=this;let T=!1,C=0,x=0,O=null,R=-1,S=null;const A=new Wt,U=new Wt;let F=null;const K=new gt(0);let L=0,H=t.width,G=t.height,P=1,j=null,Y=null;const Q=new Wt(0,0,H,G),ae=new Wt(0,0,H,G);let te=!1;const Z=new tv;let me=!1,ve=!1,Ae=null;const J=new At,ge=new Mt,ee=new be,Se={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ie(){return O===null?P:1}let k=i;function B(N,W){for(let le=0;le{function Ge(){if(ye.forEach(function(Xe){we.get(Xe).currentProgram.isReady()&&ye.delete(Xe)}),ye.size===0){Ee(N);return}setTimeout(Ge,10)}$.get("KHR_parallel_shader_compile")!==null?Ge():setTimeout(Ge,10)})};let Et=null;function jt(N){Et&&Et(N)}function ln(){$t.stop()}function Ct(){$t.start()}const $t=new EI;$t.setAnimationLoop(jt),typeof self<"u"&&$t.setContext(self),this.setAnimationLoop=function(N){Et=N,Fe.setAnimationLoop(N),N===null?$t.stop():$t.start()},Fe.addEventListener("sessionstart",ln),Fe.addEventListener("sessionend",Ct),this.render=function(N,W){if(W!==void 0&&W.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),W.parent===null&&W.matrixWorldAutoUpdate===!0&&W.updateMatrixWorld(),Fe.enabled===!0&&Fe.isPresenting===!0&&(Fe.cameraAutoUpdate===!0&&Fe.updateCamera(W),W=Fe.getCamera()),N.isScene===!0&&N.onBeforeRender(y,N,W,O),b=re.get(N,v.length),b.init(),v.push(b),J.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),Z.setFromProjectionMatrix(J),ve=this.localClippingEnabled,me=Re.init(this.clippingPlanes,ve),E=X.get(N,g.length),E.init(),g.push(E),yn(N,W,0,y.sortObjects),E.finish(),y.sortObjects===!0&&E.sort(j,Y),this.info.render.frame++,me===!0&&Re.beginShadows();const le=b.state.shadowsArray;if(xe.render(le,N,W),me===!0&&Re.endShadows(),this.info.autoReset===!0&&this.info.reset(),De.render(E,N),b.setupLights(y._useLegacyLights),W.isArrayCamera){const ye=W.cameras;for(let Ee=0,Ge=ye.length;Ee0?b=v[v.length-1]:b=null,g.pop(),g.length>0?E=g[g.length-1]:E=null};function yn(N,W,le,ye){if(N.visible===!1)return;if(N.layers.test(W.layers)){if(N.isGroup)le=N.renderOrder;else if(N.isLOD)N.autoUpdate===!0&&N.update(W);else if(N.isLight)b.pushLight(N),N.castShadow&&b.pushShadow(N);else if(N.isSprite){if(!N.frustumCulled||Z.intersectsSprite(N)){ye&&ee.setFromMatrixPosition(N.matrixWorld).applyMatrix4(J);const Xe=I.update(N),nt=N.material;nt.visible&&E.push(N,Xe,nt,le,ee.z,null)}}else if((N.isMesh||N.isLine||N.isPoints)&&(!N.frustumCulled||Z.intersectsObject(N))){const Xe=I.update(N),nt=N.material;if(ye&&(N.boundingSphere!==void 0?(N.boundingSphere===null&&N.computeBoundingSphere(),ee.copy(N.boundingSphere.center)):(Xe.boundingSphere===null&&Xe.computeBoundingSphere(),ee.copy(Xe.boundingSphere.center)),ee.applyMatrix4(N.matrixWorld).applyMatrix4(J)),Array.isArray(nt)){const at=Xe.groups;for(let rt=0,_t=at.length;rt<_t;rt++){const ft=at[rt],Kt=nt[ft.materialIndex];Kt&&Kt.visible&&E.push(N,Xe,Kt,le,ee.z,ft)}}else nt.visible&&E.push(N,Xe,nt,le,ee.z,null)}}const Ge=N.children;for(let Xe=0,nt=Ge.length;Xe0&&kr(Ee,Ge,W,le),ye&&ie.viewport(A.copy(ye)),Ee.length>0&&ci(Ee,W,le),Ge.length>0&&ci(Ge,W,le),Xe.length>0&&ci(Xe,W,le),ie.buffers.depth.setTest(!0),ie.buffers.depth.setMask(!0),ie.buffers.color.setMask(!0),ie.setPolygonOffset(!1)}function kr(N,W,le,ye){if((le.isScene===!0?le.overrideMaterial:null)!==null)return;const Ge=de.isWebGL2;Ae===null&&(Ae=new bo(1,1,{generateMipmaps:!0,type:$.has("EXT_color_buffer_half_float")?oc:xr,minFilter:go,samples:Ge?4:0})),y.getDrawingBufferSize(ge),Ge?Ae.setSize(ge.x,ge.y):Ae.setSize(Su(ge.x),Su(ge.y));const Xe=y.getRenderTarget();y.setRenderTarget(Ae),y.getClearColor(K),L=y.getClearAlpha(),L<1&&y.setClearColor(16777215,.5),y.clear();const nt=y.toneMapping;y.toneMapping=Tr,ci(N,le,ye),V.updateMultisampleRenderTarget(Ae),V.updateRenderTargetMipmap(Ae);let at=!1;for(let rt=0,_t=W.length;rt<_t;rt++){const ft=W[rt],Kt=ft.object,Tn=ft.geometry,nn=ft.material,On=ft.group;if(nn.side===Ji&&Kt.layers.test(ye.layers)){const Qt=nn.side;nn.side=Zn,nn.needsUpdate=!0,Sn(Kt,le,ye,Tn,nn,On),nn.side=Qt,nn.needsUpdate=!0,at=!0}}at===!0&&(V.updateMultisampleRenderTarget(Ae),V.updateRenderTargetMipmap(Ae)),y.setRenderTarget(Xe),y.setClearColor(K,L),y.toneMapping=nt}function ci(N,W,le){const ye=W.isScene===!0?W.overrideMaterial:null;for(let Ee=0,Ge=N.length;Ee0),ft=!!le.morphAttributes.position,Kt=!!le.morphAttributes.normal,Tn=!!le.morphAttributes.color;let nn=Tr;ye.toneMapped&&(O===null||O.isXRRenderTarget===!0)&&(nn=y.toneMapping);const On=le.morphAttributes.position||le.morphAttributes.normal||le.morphAttributes.color,Qt=On!==void 0?On.length:0,St=we.get(ye),tl=b.state.lights;if(me===!0&&(ve===!0||N!==S)){const Wn=N===S&&ye.id===R;Re.setState(ye,N,Wn)}let Jt=!1;ye.version===St.__version?(St.needsLights&&St.lightsStateVersion!==tl.state.version||St.outputColorSpace!==nt||Ee.isBatchedMesh&&St.batching===!1||!Ee.isBatchedMesh&&St.batching===!0||Ee.isInstancedMesh&&St.instancing===!1||!Ee.isInstancedMesh&&St.instancing===!0||Ee.isSkinnedMesh&&St.skinning===!1||!Ee.isSkinnedMesh&&St.skinning===!0||Ee.isInstancedMesh&&St.instancingColor===!0&&Ee.instanceColor===null||Ee.isInstancedMesh&&St.instancingColor===!1&&Ee.instanceColor!==null||St.envMap!==at||ye.fog===!0&&St.fog!==Ge||St.numClippingPlanes!==void 0&&(St.numClippingPlanes!==Re.numPlanes||St.numIntersection!==Re.numIntersection)||St.vertexAlphas!==rt||St.vertexTangents!==_t||St.morphTargets!==ft||St.morphNormals!==Kt||St.morphColors!==Tn||St.toneMapping!==nn||de.isWebGL2===!0&&St.morphTargetsCount!==Qt)&&(Jt=!0):(Jt=!0,St.__version=ye.version);let ys=St.currentProgram;Jt===!0&&(ys=di(ye,W,Ee));let Ac=!1,Lr=!1,nl=!1;const gn=ys.getUniforms(),Ss=St.uniforms;if(ie.useProgram(ys.program)&&(Ac=!0,Lr=!0,nl=!0),ye.id!==R&&(R=ye.id,Lr=!0),Ac||S!==N){gn.setValue(k,"projectionMatrix",N.projectionMatrix),gn.setValue(k,"viewMatrix",N.matrixWorldInverse);const Wn=gn.map.cameraPosition;Wn!==void 0&&Wn.setValue(k,ee.setFromMatrixPosition(N.matrixWorld)),de.logarithmicDepthBuffer&&gn.setValue(k,"logDepthBufFC",2/(Math.log(N.far+1)/Math.LN2)),(ye.isMeshPhongMaterial||ye.isMeshToonMaterial||ye.isMeshLambertMaterial||ye.isMeshBasicMaterial||ye.isMeshStandardMaterial||ye.isShaderMaterial)&&gn.setValue(k,"isOrthographic",N.isOrthographicCamera===!0),S!==N&&(S=N,Lr=!0,nl=!0)}if(Ee.isSkinnedMesh){gn.setOptional(k,Ee,"bindMatrix"),gn.setOptional(k,Ee,"bindMatrixInverse");const Wn=Ee.skeleton;Wn&&(de.floatVertexTextures?(Wn.boneTexture===null&&Wn.computeBoneTexture(),gn.setValue(k,"boneTexture",Wn.boneTexture,V)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}Ee.isBatchedMesh&&(gn.setOptional(k,Ee,"batchingTexture"),gn.setValue(k,"batchingTexture",Ee._matricesTexture,V));const il=le.morphAttributes;if((il.position!==void 0||il.normal!==void 0||il.color!==void 0&&de.isWebGL2===!0)&&ze.update(Ee,le,ys),(Lr||St.receiveShadow!==Ee.receiveShadow)&&(St.receiveShadow=Ee.receiveShadow,gn.setValue(k,"receiveShadow",Ee.receiveShadow)),ye.isMeshGouraudMaterial&&ye.envMap!==null&&(Ss.envMap.value=at,Ss.flipEnvMap.value=at.isCubeTexture&&at.isRenderTargetTexture===!1?-1:1),Lr&&(gn.setValue(k,"toneMappingExposure",y.toneMappingExposure),St.needsLights&&vs(Ss,nl),Ge&&ye.fog===!0&&he.refreshFogUniforms(Ss,Ge),he.refreshMaterialUniforms(Ss,ye,P,G,Ae),Hd.upload(k,Ki(St),Ss,V)),ye.isShaderMaterial&&ye.uniformsNeedUpdate===!0&&(Hd.upload(k,Ki(St),Ss,V),ye.uniformsNeedUpdate=!1),ye.isSpriteMaterial&&gn.setValue(k,"center",Ee.center),gn.setValue(k,"modelViewMatrix",Ee.modelViewMatrix),gn.setValue(k,"normalMatrix",Ee.normalMatrix),gn.setValue(k,"modelMatrix",Ee.matrixWorld),ye.isShaderMaterial||ye.isRawShaderMaterial){const Wn=ye.uniformsGroups;for(let sl=0,Ep=Wn.length;sl0&&V.useMultisampledRTT(N)===!1?Ee=we.get(N).__webglMultisampledFramebuffer:Array.isArray(_t)?Ee=_t[le]:Ee=_t,A.copy(N.viewport),U.copy(N.scissor),F=N.scissorTest}else A.copy(Q).multiplyScalar(P).floor(),U.copy(ae).multiplyScalar(P).floor(),F=te;if(ie.bindFramebuffer(k.FRAMEBUFFER,Ee)&&de.drawBuffers&&ye&&ie.drawBuffers(N,Ee),ie.viewport(A),ie.scissor(U),ie.setScissorTest(F),Ge){const at=we.get(N.texture);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_CUBE_MAP_POSITIVE_X+W,at.__webglTexture,le)}else if(Xe){const at=we.get(N.texture),rt=W||0;k.framebufferTextureLayer(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,at.__webglTexture,le||0,rt)}R=-1},this.readRenderTargetPixels=function(N,W,le,ye,Ee,Ge,Xe){if(!(N&&N.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let nt=we.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&Xe!==void 0&&(nt=nt[Xe]),nt){ie.bindFramebuffer(k.FRAMEBUFFER,nt);try{const at=N.texture,rt=at.format,_t=at.type;if(rt!==bi&<.convert(rt)!==k.getParameter(k.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ft=_t===oc&&($.has("EXT_color_buffer_half_float")||de.isWebGL2&&$.has("EXT_color_buffer_float"));if(_t!==xr&<.convert(_t)!==k.getParameter(k.IMPLEMENTATION_COLOR_READ_TYPE)&&!(_t===ks&&(de.isWebGL2||$.has("OES_texture_float")||$.has("WEBGL_color_buffer_float")))&&!ft){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}W>=0&&W<=N.width-ye&&le>=0&&le<=N.height-Ee&&k.readPixels(W,le,ye,Ee,lt.convert(rt),lt.convert(_t),Ge)}finally{const at=O!==null?we.get(O).__webglFramebuffer:null;ie.bindFramebuffer(k.FRAMEBUFFER,at)}}},this.copyFramebufferToTexture=function(N,W,le=0){const ye=Math.pow(2,-le),Ee=Math.floor(W.image.width*ye),Ge=Math.floor(W.image.height*ye);V.setTexture2D(W,0),k.copyTexSubImage2D(k.TEXTURE_2D,le,0,0,N.x,N.y,Ee,Ge),ie.unbindTexture()},this.copyTextureToTexture=function(N,W,le,ye=0){const Ee=W.image.width,Ge=W.image.height,Xe=lt.convert(le.format),nt=lt.convert(le.type);V.setTexture2D(le,0),k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,le.flipY),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,le.premultiplyAlpha),k.pixelStorei(k.UNPACK_ALIGNMENT,le.unpackAlignment),W.isDataTexture?k.texSubImage2D(k.TEXTURE_2D,ye,N.x,N.y,Ee,Ge,Xe,nt,W.image.data):W.isCompressedTexture?k.compressedTexSubImage2D(k.TEXTURE_2D,ye,N.x,N.y,W.mipmaps[0].width,W.mipmaps[0].height,Xe,W.mipmaps[0].data):k.texSubImage2D(k.TEXTURE_2D,ye,N.x,N.y,Xe,nt,W.image),ye===0&&le.generateMipmaps&&k.generateMipmap(k.TEXTURE_2D),ie.unbindTexture()},this.copyTextureToTexture3D=function(N,W,le,ye,Ee=0){if(y.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Ge=N.max.x-N.min.x+1,Xe=N.max.y-N.min.y+1,nt=N.max.z-N.min.z+1,at=lt.convert(ye.format),rt=lt.convert(ye.type);let _t;if(ye.isData3DTexture)V.setTexture3D(ye,0),_t=k.TEXTURE_3D;else if(ye.isDataArrayTexture)V.setTexture2DArray(ye,0),_t=k.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,ye.flipY),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ye.premultiplyAlpha),k.pixelStorei(k.UNPACK_ALIGNMENT,ye.unpackAlignment);const ft=k.getParameter(k.UNPACK_ROW_LENGTH),Kt=k.getParameter(k.UNPACK_IMAGE_HEIGHT),Tn=k.getParameter(k.UNPACK_SKIP_PIXELS),nn=k.getParameter(k.UNPACK_SKIP_ROWS),On=k.getParameter(k.UNPACK_SKIP_IMAGES),Qt=le.isCompressedTexture?le.mipmaps[0]:le.image;k.pixelStorei(k.UNPACK_ROW_LENGTH,Qt.width),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,Qt.height),k.pixelStorei(k.UNPACK_SKIP_PIXELS,N.min.x),k.pixelStorei(k.UNPACK_SKIP_ROWS,N.min.y),k.pixelStorei(k.UNPACK_SKIP_IMAGES,N.min.z),le.isDataTexture||le.isData3DTexture?k.texSubImage3D(_t,Ee,W.x,W.y,W.z,Ge,Xe,nt,at,rt,Qt.data):le.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),k.compressedTexSubImage3D(_t,Ee,W.x,W.y,W.z,Ge,Xe,nt,at,Qt.data)):k.texSubImage3D(_t,Ee,W.x,W.y,W.z,Ge,Xe,nt,at,rt,Qt),k.pixelStorei(k.UNPACK_ROW_LENGTH,ft),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,Kt),k.pixelStorei(k.UNPACK_SKIP_PIXELS,Tn),k.pixelStorei(k.UNPACK_SKIP_ROWS,nn),k.pixelStorei(k.UNPACK_SKIP_IMAGES,On),Ee===0&&ye.generateMipmaps&&k.generateMipmap(_t),ie.unbindTexture()},this.initTexture=function(N){N.isCubeTexture?V.setTextureCube(N,0):N.isData3DTexture?V.setTexture3D(N,0):N.isDataArrayTexture||N.isCompressedArrayTexture?V.setTexture2DArray(N,0):V.setTexture2D(N,0),ie.unbindTexture()},this.resetState=function(){C=0,x=0,O=null,ie.reset(),Qe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ls}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===JE?"display-p3":"srgb",t.unpackColorSpace=Ft.workingColorSpace===pp?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===rn?uo:oI}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===uo?rn:Nn}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class BNt extends RI{}BNt.prototype.isWebGL1Renderer=!0;class GNt extends sn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}class zNt{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=_b,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=zi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn('THREE.InterleavedBuffer: "updateRange" is deprecated and removed in r169. Use "addUpdateRange()" instead.'),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let s=0,r=this.stride;sl)continue;f.applyMatrix4(this.matrixWorld);const R=e.ray.origin.distanceTo(f);Re.far||t.push({distance:R,point:_.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,o.start),v=Math.min(b.count,o.start+o.count);for(let y=g,T=v-1;yl)continue;f.applyMatrix4(this.matrixWorld);const x=e.ray.origin.distanceTo(f);xe.far||t.push({distance:x,point:_.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;rs.far)return;r.push({distance:d,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class lv extends Vi{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new gt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new gt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ZE,this.normalScale=new Mt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class js extends lv{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Mt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return kn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new gt(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new gt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new gt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class RR extends Vi{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new gt(16777215),this.specular=new gt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new gt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ZE,this.normalScale=new Mt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=QE,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}function Rd(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function XNt(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function ZNt(n){function e(s,r){return n[s]-n[r]}const t=n.length,i=new Array(t);for(let s=0;s!==t;++s)i[s]=s;return i.sort(e),i}function AR(n,e,t){const i=n.length,s=new n.constructor(i);for(let r=0,o=0;o!==i;++r){const a=t[r]*e;for(let l=0;l!==e;++l)s[o++]=n[a+l]}return s}function OI(n,e,t,i){let s=1,r=n[0];for(;r!==void 0&&r[i]===void 0;)r=n[s++];if(r===void 0)return;let o=r[i];if(o!==void 0)if(Array.isArray(o))do o=r[i],o!==void 0&&(e.push(r.time),t.push.apply(t,o)),r=n[s++];while(r!==void 0);else if(o.toArray!==void 0)do o=r[i],o!==void 0&&(e.push(r.time),o.toArray(t,t.length)),r=n[s++];while(r!==void 0);else do o=r[i],o!==void 0&&(e.push(r.time),t.push(o)),r=n[s++];while(r!==void 0)}class xc{constructor(e,t,i,s){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,s=t[i],r=t[i-1];e:{t:{let o;n:{i:if(!(e=r)){const a=t[1];e=r)break t}o=i,i=0;break n}break e}for(;i>>1;et;)--o;if(++o,r!==0||o!==s){r>=o&&(o=Math.max(o,1),r=o-1);const a=this.getValueSize();this.times=i.slice(r,o),this.values=this.values.slice(r*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,s=this.values,r=i.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(s!==void 0&&XNt(s))for(let a=0,l=s.length;a!==l;++a){const d=s[a];if(isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,d),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),s=this.getInterpolation()===qm,r=e.length-1;let o=1;for(let a=1;a0){e[o]=e[r];for(let a=r*i,l=o*i,d=0;d!==i;++d)t[l+d]=t[a+d];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,s=new i(this.name,e,t);return s.createInterpolant=this.createInterpolant,s}}ms.prototype.TimeBufferType=Float32Array;ms.prototype.ValueBufferType=Float32Array;ms.prototype.DefaultInterpolation=wa;class Xa extends ms{}Xa.prototype.ValueTypeName="bool";Xa.prototype.ValueBufferType=Array;Xa.prototype.DefaultInterpolation=ac;Xa.prototype.InterpolantFactoryMethodLinear=void 0;Xa.prototype.InterpolantFactoryMethodSmooth=void 0;class II extends ms{}II.prototype.ValueTypeName="color";class Ia extends ms{}Ia.prototype.ValueTypeName="number";class nOt extends xc{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e,t,i,s){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(s-t);let d=e*a;for(let c=d+a;d!==c;d+=4)Dr.slerpFlat(r,0,o,d-a,o,d,l);return r}}class vo extends ms{InterpolantFactoryMethodLinear(e){return new nOt(this.times,this.values,this.getValueSize(),e)}}vo.prototype.ValueTypeName="quaternion";vo.prototype.DefaultInterpolation=wa;vo.prototype.InterpolantFactoryMethodSmooth=void 0;class Za extends ms{}Za.prototype.ValueTypeName="string";Za.prototype.ValueBufferType=Array;Za.prototype.DefaultInterpolation=ac;Za.prototype.InterpolantFactoryMethodLinear=void 0;Za.prototype.InterpolantFactoryMethodSmooth=void 0;class Ma extends ms{}Ma.prototype.ValueTypeName="vector";class iOt{constructor(e,t=-1,i,s=lCt){this.name=e,this.tracks=i,this.duration=t,this.blendMode=s,this.uuid=zi(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,s=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(rOt(i[o]).scale(s));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],i=e.tracks,s={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,o=i.length;r!==o;++r)t.push(ms.toJSON(i[r]));return s}static CreateFromMorphTargetSequence(e,t,i,s){const r=t.length,o=[];for(let a=0;a1){const _=c[1];let f=s[_];f||(s[_]=f=[]),f.push(d)}}const o=[];for(const a in s)o.push(this.CreateFromMorphTargetSequence(a,s[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(_,f,m,h,E){if(m.length!==0){const b=[],g=[];OI(m,b,g,h),b.length!==0&&E.push(new _(f,b,g))}},s=[],r=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const d=e.hierarchy||[];for(let _=0;_{t&&t(r),this.manager.itemEnd(e)},0),r;if(Ns[e]!==void 0){Ns[e].push({onLoad:t,onProgress:i,onError:s});return}Ns[e]=[],Ns[e].push({onLoad:t,onProgress:i,onError:s});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(d=>{if(d.status===200||d.status===0){if(d.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||d.body===void 0||d.body.getReader===void 0)return d;const c=Ns[e],_=d.body.getReader(),f=d.headers.get("Content-Length")||d.headers.get("X-File-Size"),m=f?parseInt(f):0,h=m!==0;let E=0;const b=new ReadableStream({start(g){v();function v(){_.read().then(({done:y,value:T})=>{if(y)g.close();else{E+=T.byteLength;const C=new ProgressEvent("progress",{lengthComputable:h,loaded:E,total:m});for(let x=0,O=c.length;x{switch(l){case"arraybuffer":return d.arrayBuffer();case"blob":return d.blob();case"document":return d.text().then(c=>new DOMParser().parseFromString(c,a));case"json":return d.json();default:if(a===void 0)return d.text();{const _=/charset="?([^;"\s]*)"?/i.exec(a),f=_&&_[1]?_[1].toLowerCase():void 0,m=new TextDecoder(f);return d.arrayBuffer().then(h=>m.decode(h))}}}).then(d=>{Da.add(e,d);const c=Ns[e];delete Ns[e];for(let _=0,f=c.length;_{const c=Ns[e];if(c===void 0)throw this.manager.itemError(e),d;delete Ns[e];for(let _=0,f=c.length;_{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class cOt extends Ja{constructor(e){super(e)}load(e,t,i,s){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=Da.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;const a=lc("img");function l(){c(),Da.add(e,this),t&&t(this),r.manager.itemEnd(e)}function d(_){c(),s&&s(_),r.manager.itemError(e),r.manager.itemEnd(e)}function c(){a.removeEventListener("load",l,!1),a.removeEventListener("error",d,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",d,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}class DI extends Ja{constructor(e){super(e)}load(e,t,i,s){const r=new wn,o=new cOt(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){r.image=a,r.needsUpdate=!0,t!==void 0&&t(r)},i,s),r}}class mp extends sn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new gt(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}const gg=new At,wR=new be,NR=new be;class cv{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Mt(512,512),this.map=null,this.mapPass=null,this.matrix=new At,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new tv,this._frameExtents=new Mt(1,1),this._viewportCount=1,this._viewports=[new Wt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;wR.setFromMatrixPosition(e.matrixWorld),t.position.copy(wR),NR.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(NR),t.updateMatrixWorld(),gg.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(gg),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(gg)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class dOt extends cv{constructor(){super(new Vn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=Na*2*e.angle*this.focus,s=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(i!==t.fov||s!==t.aspect||r!==t.far)&&(t.fov=i,t.aspect=s,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class uOt extends mp{constructor(e,t,i=0,s=Math.PI/3,r=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(sn.DEFAULT_UP),this.updateMatrix(),this.target=new sn,this.distance=i,this.angle=s,this.penumbra=r,this.decay=o,this.map=null,this.shadow=new dOt}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const OR=new At,Sl=new be,bg=new be;class pOt extends cv{constructor(){super(new Vn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Mt(4,2),this._viewportCount=6,this._viewports=[new Wt(2,1,1,1),new Wt(0,1,1,1),new Wt(3,1,1,1),new Wt(1,1,1,1),new Wt(3,0,1,1),new Wt(1,0,1,1)],this._cubeDirections=[new be(1,0,0),new be(-1,0,0),new be(0,0,1),new be(0,0,-1),new be(0,1,0),new be(0,-1,0)],this._cubeUps=[new be(0,1,0),new be(0,1,0),new be(0,1,0),new be(0,1,0),new be(0,0,1),new be(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,s=this.matrix,r=e.distance||i.far;r!==i.far&&(i.far=r,i.updateProjectionMatrix()),Sl.setFromMatrixPosition(e.matrixWorld),i.position.copy(Sl),bg.copy(i.position),bg.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(bg),i.updateMatrixWorld(),s.makeTranslation(-Sl.x,-Sl.y,-Sl.z),OR.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(OR)}}class _Ot extends mp{constructor(e,t,i=0,s=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=s,this.shadow=new pOt}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class hOt extends cv{constructor(){super(new iv(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class kI extends mp{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(sn.DEFAULT_UP),this.updateMatrix(),this.target=new sn,this.shadow=new hOt}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class fOt extends mp{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class zl{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,s=e.length;i"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=Da.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(l){Da.add(e,l),t&&t(l),r.manager.itemEnd(e)}).catch(function(l){s&&s(l),r.manager.itemError(e),r.manager.itemEnd(e)}),r.manager.itemStart(e)}}const dv="\\[\\]\\.:\\/",gOt=new RegExp("["+dv+"]","g"),uv="[^"+dv+"]",bOt="[^"+dv.replace("\\.","")+"]",EOt=/((?:WC+[\/:])*)/.source.replace("WC",uv),vOt=/(WCOD+)?/.source.replace("WCOD",bOt),yOt=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",uv),SOt=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",uv),TOt=new RegExp("^"+EOt+vOt+yOt+SOt+"$"),xOt=["material","materials","bones","map"];class COt{constructor(e,t,i){const s=i||Gt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,s)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,s=this._bindings[i];s!==void 0&&s.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=i.length;s!==r;++s)i[s].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class Gt{constructor(e,t,i){this.path=t,this.parsedPath=i||Gt.parseTrackName(t),this.node=Gt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new Gt.Composite(e,t,i):new Gt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(gOt,"")}static parseTrackName(e){const t=TOt.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){const r=i.nodeName.substring(s+1);xOt.indexOf(r)!==-1&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=r)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(r){for(let o=0;o=2.0 are supported."));return}const d=new sIt(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});d.fileLoader.setRequestHeader(this.requestHeader);for(let c=0;c=0&&a[_]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+_+'".')}}d.setExtensions(o),d.setPlugins(a),d.parse(i,s)}parseAsync(e,t){const i=this;return new Promise(function(s,r){i.parse(e,t,s,r)})}}function AOt(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const It={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class wOt{constructor(e){this.parser=e,this.name=It.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,s=t.length;i=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,o)}}class zOt{constructor(e){this.parser=e,this.name=It.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,s=i.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;const o=r.extensions[t],a=s.images[o.source];let l=i.textureLoader;if(a.uri){const d=i.options.manager.getHandler(a.uri);d!==null&&(l=d)}return this.detectSupport().then(function(d){if(d)return i.loadTextureImage(e,o.source,l);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class VOt{constructor(e){this.parser=e,this.name=It.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,s=i.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;const o=r.extensions[t],a=s.images[o.source];let l=i.textureLoader;if(a.uri){const d=i.options.manager.getHandler(a.uri);d!==null&&(l=d)}return this.detectSupport().then(function(d){if(d)return i.loadTextureImage(e,o.source,l);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class HOt{constructor(e){this.name=It.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const s=i.extensions[this.name],r=this.parser.getDependency("buffer",s.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(a){const l=s.byteOffset||0,d=s.byteLength||0,c=s.count,_=s.byteStride,f=new Uint8Array(a,l,d);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(c,_,f,s.mode,s.filter).then(function(m){return m.buffer}):o.ready.then(function(){const m=new ArrayBuffer(c*_);return o.decodeGltfBuffer(new Uint8Array(m),c,_,f,s.mode,s.filter),m})})}else return null}}class qOt{constructor(e){this.name=It.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const s=t.meshes[i.mesh];for(const d of s.primitives)if(d.mode!==fi.TRIANGLES&&d.mode!==fi.TRIANGLE_STRIP&&d.mode!==fi.TRIANGLE_FAN&&d.mode!==void 0)return null;const o=i.extensions[this.name].attributes,a=[],l={};for(const d in o)a.push(this.parser.getDependency("accessor",o[d]).then(c=>(l[d]=c,l[d])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(d=>{const c=d.pop(),_=c.isGroup?c.children:[c],f=d[0].count,m=[];for(const h of _){const E=new At,b=new be,g=new Dr,v=new be(1,1,1),y=new WNt(h.geometry,h.material,f);for(let T=0;T0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const iIt=new At;class sIt{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new AOt,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,s=!1,r=-1;typeof navigator<"u"&&(i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,s=navigator.userAgent.indexOf("Firefox")>-1,r=s?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||i||s&&r<98?this.textureLoader=new DI(this.options.manager):this.textureLoader=new mOt(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new MI(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,s=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(o){const a={scene:o[0][s.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:s.asset,parser:i,userData:{}};return qr(r,a,s),fr(a,s),Promise.all(i._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let s=0,r=t.length;s{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[d,c]of o.children.entries())r(c,a.children[d])};return r(i,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i=2&&b.setY(S,x[O*l+1]),l>=3&&b.setZ(S,x[O*l+2]),l>=4&&b.setW(S,x[O*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return b})}loadTexture(e){const t=this.json,i=this.options,r=t.textures[e].source,o=t.images[r];let a=this.textureLoader;if(o.uri){const l=i.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,i){const s=this,r=this.json,o=r.textures[e],a=r.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const d=this.loadImageSource(t,i).then(function(c){c.flipY=!1,c.name=o.name||a.name||"",c.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(c.name=a.uri);const f=(r.samplers||{})[o.sampler]||{};return c.magFilter=DR[f.magFilter]||jn,c.minFilter=DR[f.minFilter]||go,c.wrapS=kR[f.wrapS]||Ra,c.wrapT=kR[f.wrapT]||Ra,s.associations.set(c,{textures:e}),c}).catch(function(){return null});return this.textureCache[l]=d,d}loadImageSource(e,t){const i=this,s=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(_=>_.clone());const o=s.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",d=!1;if(o.bufferView!==void 0)l=i.getDependency("bufferView",o.bufferView).then(function(_){d=!0;const f=new Blob([_],{type:o.mimeType});return l=a.createObjectURL(f),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const c=Promise.resolve(l).then(function(_){return new Promise(function(f,m){let h=f;t.isImageBitmapLoader===!0&&(h=function(E){const b=new wn(E);b.needsUpdate=!0,f(b)}),t.load(zl.resolveURL(_,r.path),h,void 0,m)})}).then(function(_){return d===!0&&a.revokeObjectURL(l),_.userData.mimeType=o.mimeType||nIt(o.uri),_}).catch(function(_){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),_});return this.sourceCache[e]=c,c}assignTexture(e,t,i,s){const r=this;return this.getDependency("texture",i.index).then(function(o){if(!o)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(o=o.clone(),o.channel=i.texCoord),r.extensions[It.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[It.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=r.associations.get(o);o=r.extensions[It.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),r.associations.set(o,l)}}return s!==void 0&&(o.colorSpace=s),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const s=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new NI,Vi.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,l.sizeAttenuation=!1,this.cache.add(a,l)),i=l}else if(e.isLine){const a="LineBasicMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new wI,Vi.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,this.cache.add(a,l)),i=l}if(s||r||o){let a="ClonedMaterial:"+i.uuid+":";s&&(a+="derivative-tangents:"),r&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=i.clone(),r&&(l.vertexColors=!0),o&&(l.flatShading=!0),s&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(i))),i=l}e.material=i}getMaterialType(){return lv}loadMaterial(e){const t=this,i=this.json,s=this.extensions,r=i.materials[e];let o;const a={},l=r.extensions||{},d=[];if(l[It.KHR_MATERIALS_UNLIT]){const _=s[It.KHR_MATERIALS_UNLIT];o=_.getMaterialType(),d.push(_.extendParams(a,r,t))}else{const _=r.pbrMetallicRoughness||{};if(a.color=new gt(1,1,1),a.opacity=1,Array.isArray(_.baseColorFactor)){const f=_.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],Nn),a.opacity=f[3]}_.baseColorTexture!==void 0&&d.push(t.assignTexture(a,"map",_.baseColorTexture,rn)),a.metalness=_.metallicFactor!==void 0?_.metallicFactor:1,a.roughness=_.roughnessFactor!==void 0?_.roughnessFactor:1,_.metallicRoughnessTexture!==void 0&&(d.push(t.assignTexture(a,"metalnessMap",_.metallicRoughnessTexture)),d.push(t.assignTexture(a,"roughnessMap",_.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),d.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}r.doubleSided===!0&&(a.side=Ji);const c=r.alphaMode||vg.OPAQUE;if(c===vg.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,c===vg.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&o!==Er&&(d.push(t.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new Mt(1,1),r.normalTexture.scale!==void 0)){const _=r.normalTexture.scale;a.normalScale.set(_,_)}if(r.occlusionTexture!==void 0&&o!==Er&&(d.push(t.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&o!==Er){const _=r.emissiveFactor;a.emissive=new gt().setRGB(_[0],_[1],_[2],Nn)}return r.emissiveTexture!==void 0&&o!==Er&&d.push(t.assignTexture(a,"emissiveMap",r.emissiveTexture,rn)),Promise.all(d).then(function(){const _=new o(a);return r.name&&(_.name=r.name),fr(_,r),t.associations.set(_,{materials:e}),r.extensions&&qr(s,_,r),_})}createUniqueName(e){const t=Gt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,s=this.primitiveCache;function r(a){return i[It.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return LR(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&eIt(g,r),g.name=t.createUniqueName(r.name||"mesh_"+e),fr(g,r),b.extensions&&qr(s,g,b),t.assignFinalMaterial(g),_.push(g)}for(let m=0,h=_.length;m1?c=new io:d.length===1?c=d[0]:c=new sn,c!==d[0])for(let _=0,f=d.length;_{const _=new Map;for(const[f,m]of s.associations)(f instanceof Vi||f instanceof wn)&&_.set(f,m);return c.traverse(f=>{const m=s.associations.get(f);m!=null&&_.set(f,m)}),_};return s.associations=d(r),r})}_createAnimationTracks(e,t,i,s,r){const o=[],a=e.name?e.name:e.uuid,l=[];rr[r.path]===rr.weights?e.traverse(function(f){f.morphTargetInfluences&&l.push(f.name?f.name:f.uuid)}):l.push(a);let d;switch(rr[r.path]){case rr.weights:d=Ia;break;case rr.rotation:d=vo;break;case rr.position:case rr.scale:d=Ma;break;default:switch(i.itemSize){case 1:d=Ia;break;case 2:case 3:default:d=Ma;break}break}const c=s.interpolation!==void 0?XOt[s.interpolation]:wa,_=this._getArrayFromAccessor(i);for(let f=0,m=l.length;f{qe.replace()})},stopVideoStream(){this.isVideoActive=!1,this.imageData=null,Ze.emit("stop_webcam_video_stream"),Ve(()=>{qe.replace()})},startDrag(n){this.isDragging=!0,this.zIndex=5001,this.dragStart.x=n.clientX,this.dragStart.y=n.clientY,document.addEventListener("mousemove",this.drag),document.addEventListener("mouseup",this.stopDrag)},drag(n){if(this.isDragging){const e=n.clientX-this.dragStart.x,t=n.clientY-this.dragStart.y;this.position.bottom-=t,this.position.right-=e,this.dragStart.x=n.clientX,this.dragStart.y=n.clientY}},stopDrag(){this.isDragging=!1,this.zIndex=0,document.removeEventListener("mousemove",this.drag),document.removeEventListener("mouseup",this.stopDrag)}},mounted(){qe.replace(),Ze.on("video_stream_image",n=>{if(this.isVideoActive){this.imageDataUrl="data:image/jpeg;base64,"+n,this.frameCount++;const e=Date.now();e-this.lastFrameTime>=1e3&&(this.frameRate=this.frameCount,this.frameCount=0,this.lastFrameTime=e)}})}},aIt=["src"],lIt=["src"],cIt={class:"controls"},dIt=u("i",{"data-feather":"video"},null,-1),uIt=[dIt],pIt=u("i",{"data-feather":"video"},null,-1),_It=[pIt],hIt={key:2};function fIt(n,e,t,i,s,r){return w(),M("div",{class:"floating-frame bg-white",style:en({bottom:s.position.bottom+"px",right:s.position.right+"px","z-index":s.zIndex}),onMousedown:e[4]||(e[4]=Te((...o)=>r.startDrag&&r.startDrag(...o),["stop"])),onMouseup:e[5]||(e[5]=Te((...o)=>r.stopDrag&&r.stopDrag(...o),["stop"]))},[u("div",{class:"handle",onMousedown:e[0]||(e[0]=Te((...o)=>r.startDrag&&r.startDrag(...o),["stop"])),onMouseup:e[1]||(e[1]=Te((...o)=>r.stopDrag&&r.stopDrag(...o),["stop"]))},"Drag Me",32),s.isVideoActive&&s.imageDataUrl!=null?(w(),M("img",{key:0,src:s.imageDataUrl,alt:"Webcam Frame",width:"300",height:"300"},null,8,aIt)):q("",!0),s.isVideoActive&&s.imageDataUrl==null?(w(),M("p",{key:1,src:s.imageDataUrl,alt:"Webcam Frame",width:"300",height:"300"},"Loading. Please wait...",8,lIt)):q("",!0),u("div",cIt,[s.isVideoActive?q("",!0):(w(),M("button",{key:0,class:"bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded",onClick:e[2]||(e[2]=(...o)=>r.startVideoStream&&r.startVideoStream(...o))},uIt)),s.isVideoActive?(w(),M("button",{key:1,class:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded",onClick:e[3]||(e[3]=(...o)=>r.stopVideoStream&&r.stopVideoStream(...o))},_It)):q("",!0),s.isVideoActive?(w(),M("span",hIt,"FPS: "+fe(s.frameRate),1)):q("",!0)])],36)}const mIt=bt(oIt,[["render",fIt]]);const gIt={data(){return{isAudioActive:!1,imageDataUrl:null,isDragging:!1,position:{bottom:0,right:0},dragStart:{x:0,y:0},zIndex:0,frameRate:0,frameCount:0,lastFrameTime:Date.now()}},methods:{startAudioStream(){Ze.emit("start_audio_stream",()=>{this.isAudioActive=!0}),Ve(()=>{qe.replace()})},stopAudioStream(){Ze.emit("stop_audio_stream",()=>{this.isAudioActive=!1,this.imageDataUrl=null}),Ve(()=>{qe.replace()})},startDrag(n){this.isDragging=!0,this.zIndex=5001,this.dragStart.x=n.clientX,this.dragStart.y=n.clientY,document.addEventListener("mousemove",this.drag),document.addEventListener("mouseup",this.stopDrag)},drag(n){if(this.isDragging){const e=n.clientX-this.dragStart.x,t=n.clientY-this.dragStart.y;this.position.bottom-=t,this.position.right-=e,this.dragStart.x=n.clientX,this.dragStart.y=n.clientY}},stopDrag(){this.isDragging=!1,this.zIndex=0,document.removeEventListener("mousemove",this.drag),document.removeEventListener("mouseup",this.stopDrag)}},mounted(){qe.replace(),Ze.on("update_spectrogram",n=>{if(this.isAudioActive){this.imageDataUrl="data:image/jpeg;base64,"+n,this.frameCount++;const e=Date.now();e-this.lastFrameTime>=1e3&&(this.frameRate=this.frameCount,this.frameCount=0,this.lastFrameTime=e)}})}},bIt=["src"],EIt={class:"controls"},vIt=u("i",{"data-feather":"mic"},null,-1),yIt=[vIt],SIt=u("i",{"data-feather":"mic"},null,-1),TIt=[SIt],xIt={key:2};function CIt(n,e,t,i,s,r){return w(),M("div",{class:"floating-frame bg-white",style:en({bottom:s.position.bottom+"px",right:s.position.right+"px","z-index":s.zIndex}),onMousedown:e[4]||(e[4]=Te((...o)=>r.startDrag&&r.startDrag(...o),["stop"])),onMouseup:e[5]||(e[5]=Te((...o)=>r.stopDrag&&r.stopDrag(...o),["stop"]))},[u("div",{class:"handle",onMousedown:e[0]||(e[0]=Te((...o)=>r.startDrag&&r.startDrag(...o),["stop"])),onMouseup:e[1]||(e[1]=Te((...o)=>r.stopDrag&&r.stopDrag(...o),["stop"]))},"Drag Me",32),s.isAudioActive&&s.imageDataUrl!=null?(w(),M("img",{key:0,src:s.imageDataUrl,alt:"Spectrogram",width:"300",height:"300"},null,8,bIt)):q("",!0),u("div",EIt,[s.isAudioActive?q("",!0):(w(),M("button",{key:0,class:"bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded",onClick:e[2]||(e[2]=(...o)=>r.startAudioStream&&r.startAudioStream(...o))},yIt)),s.isAudioActive?(w(),M("button",{key:1,class:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded",onClick:e[3]||(e[3]=(...o)=>r.stopAudioStream&&r.stopAudioStream(...o))},TIt)):q("",!0),s.isAudioActive?(w(),M("span",xIt,"FPS: "+fe(s.frameRate),1)):q("",!0)])],36)}const RIt=bt(gIt,[["render",CIt]]);const AIt={data(){return{activePersonality:null}},props:{personality:{type:Object,default:()=>({})}},components:{VideoFrame:mIt,AudioFrame:RIt},computed:{isReady:{get(){return this.$store.state.ready}}},watch:{"$store.state.mountedPersArr":"updatePersonality","$store.state.config.active_personality_id":"updatePersonality"},async mounted(){for(;this.isReady===!1;)await new Promise(n=>setTimeout(n,100));console.log("Personality:",this.personality),this.initWebGLScene(),this.updatePersonality(),Ve(()=>{qe.replace()}),this.$refs.video_frame.position={bottom:0,right:0},this.$refs.audio_frame.position={bottom:0,right:100}},beforeDestroy(){},methods:{initWebGLScene(){this.scene=new GNt,this.camera=new Vn(75,window.innerWidth/window.innerHeight,.1,1e3),this.renderer=new RI,this.renderer.setSize(window.innerWidth,window.innerHeight),this.$refs.webglContainer.appendChild(this.renderer.domElement);const n=new Cr,e=new RR({color:65280});this.cube=new Hn(n,e),this.scene.add(this.cube);const t=new fOt(4210752),i=new kI(16777215,.5);i.position.set(0,1,0),this.scene.add(t),this.scene.add(i),this.camera.position.z=5,this.animate()},updatePersonality(){const{mountedPersArr:n,config:e}=this.$store.state;this.activePersonality=n[e.active_personality_id],this.activePersonality.avatar?this.showBoxWithAvatar(this.activePersonality.avatar):this.showDefaultCube(),this.$emit("update:personality",this.activePersonality)},loadScene(n){new ROt().load(n,t=>{this.scene.remove(this.cube),this.cube=t.scene,this.scene.add(this.cube)})},showBoxWithAvatar(n){this.cube&&this.scene.remove(this.cube);const e=new Cr,t=new DI().load(n),i=new Er({map:t});this.cube=new Hn(e,i),this.scene.add(this.cube)},showDefaultCube(){this.scene.remove(this.cube);const n=new Cr,e=new RR({color:65280});this.cube=new Hn(n,e),this.scene.add(this.cube)},animate(){requestAnimationFrame(this.animate),this.cube&&(this.cube.rotation.x+=.01,this.cube.rotation.y+=.01),this.renderer.render(this.scene,this.camera)}}},wIt={ref:"webglContainer"},NIt={class:"flex-col y-overflow scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},OIt={key:0,class:"text-center"},IIt={key:1,class:"text-center"},MIt={class:"floating-frame2"},DIt=["innerHTML"];function kIt(n,e,t,i,s,r){const o=ht("VideoFrame"),a=ht("AudioFrame");return w(),M($e,null,[u("div",wIt,null,512),u("div",NIt,[!s.activePersonality||!s.activePersonality.scene_path?(w(),M("div",OIt," Personality does not have a 3d avatar. ")):q("",!0),!s.activePersonality||!s.activePersonality.avatar||s.activePersonality.avatar===""?(w(),M("div",IIt," Personality does not have an avatar. ")):q("",!0),u("div",MIt,[u("div",{innerHTML:n.htmlContent},null,8,DIt)])]),Oe(o,{ref:"video_frame"},null,512),Oe(a,{ref:"audio_frame"},null,512)],64)}const LIt=bt(AIt,[["render",kIt]]);let Ad;const PIt=new Uint8Array(16);function UIt(){if(!Ad&&(Ad=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ad))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ad(PIt)}const xn=[];for(let n=0;n<256;++n)xn.push((n+256).toString(16).slice(1));function FIt(n,e=0){return xn[n[e+0]]+xn[n[e+1]]+xn[n[e+2]]+xn[n[e+3]]+"-"+xn[n[e+4]]+xn[n[e+5]]+"-"+xn[n[e+6]]+xn[n[e+7]]+"-"+xn[n[e+8]]+xn[n[e+9]]+"-"+xn[n[e+10]]+xn[n[e+11]]+xn[n[e+12]]+xn[n[e+13]]+xn[n[e+14]]+xn[n[e+15]]}const BIt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),PR={randomUUID:BIt};function Fs(n,e,t){if(PR.randomUUID&&!e&&!n)return PR.randomUUID();n=n||{};const i=n.random||(n.rng||UIt)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let s=0;s<16;++s)e[t+s]=i[s];return e}return FIt(i)}class po{constructor(){this.listenerMap=new Map,this._listeners=[],this.proxyMap=new Map,this.proxies=[]}get listeners(){return this._listeners.concat(this.proxies.flatMap(e=>e()))}subscribe(e,t){this.listenerMap.has(e)&&(console.warn(`Already subscribed. Unsubscribing for you. +}`;function MNt(n,e,t){let i=new tv;const s=new Mt,r=new Mt,o=new Wt,a=new wNt({depthPacking:_Ct}),l=new NNt,d={},c=t.maxTextureSize,_={[Vs]:Zn,[Zn]:Vs,[Ji]:Ji},f=new Eo({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Mt},radius:{value:4}},vertexShader:ONt,fragmentShader:INt}),m=f.clone();m.defines.HORIZONTAL_PASS=1;const h=new fs;h.setAttribute("position",new Yn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new Hn(h,f),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=jO;let g=this.type;this.render=function(C,x,O){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||C.length===0)return;const R=n.getRenderTarget(),S=n.getActiveCubeFace(),A=n.getActiveMipmapLevel(),U=n.state;U.setBlending(Sr),U.buffers.color.setClear(1,1,1,1),U.buffers.depth.setTest(!0),U.setScissorTest(!1);const F=g!==Is&&this.type===Is,K=g===Is&&this.type!==Is;for(let L=0,H=C.length;Lc||s.y>c)&&(s.x>c&&(r.x=Math.floor(c/j.x),s.x=r.x*j.x,P.mapSize.x=r.x),s.y>c&&(r.y=Math.floor(c/j.y),s.y=r.y*j.y,P.mapSize.y=r.y)),P.map===null||F===!0||K===!0){const Q=this.type!==Is?{minFilter:En,magFilter:En}:{};P.map!==null&&P.map.dispose(),P.map=new bo(s.x,s.y,Q),P.map.texture.name=G.name+".shadowMap",P.camera.updateProjectionMatrix()}n.setRenderTarget(P.map),n.clear();const Y=P.getViewportCount();for(let Q=0;Q0||x.map&&x.alphaTest>0){const U=S.uuid,F=x.uuid;let K=d[U];K===void 0&&(K={},d[U]=K);let L=K[F];L===void 0&&(L=S.clone(),K[F]=L),S=L}if(S.visible=x.visible,S.wireframe=x.wireframe,R===Is?S.side=x.shadowSide!==null?x.shadowSide:x.side:S.side=x.shadowSide!==null?x.shadowSide:_[x.side],S.alphaMap=x.alphaMap,S.alphaTest=x.alphaTest,S.map=x.map,S.clipShadows=x.clipShadows,S.clippingPlanes=x.clippingPlanes,S.clipIntersection=x.clipIntersection,S.displacementMap=x.displacementMap,S.displacementScale=x.displacementScale,S.displacementBias=x.displacementBias,S.wireframeLinewidth=x.wireframeLinewidth,S.linewidth=x.linewidth,O.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const U=n.properties.get(S);U.light=O}return S}function T(C,x,O,R,S){if(C.visible===!1)return;if(C.layers.test(x.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&S===Is)&&(!C.frustumCulled||i.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(O.matrixWorldInverse,C.matrixWorld);const F=e.update(C),K=C.material;if(Array.isArray(K)){const L=F.groups;for(let H=0,G=L.length;H=1):Q.indexOf("OpenGL ES")!==-1&&(Y=parseFloat(/^OpenGL ES (\d)/.exec(Q)[1]),j=Y>=2);let ae=null,te={};const Z=n.getParameter(n.SCISSOR_BOX),me=n.getParameter(n.VIEWPORT),ve=new Wt().fromArray(Z),Ae=new Wt().fromArray(me);function J(pe,We,Ue,Ne){const Be=new Uint8Array(4),dt=n.createTexture();n.bindTexture(pe,dt),n.texParameteri(pe,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(pe,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Et=0;Et"u"?!1:/OculusBrowser/g.test(navigator.userAgent),h=new WeakMap;let E;const b=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(D,I){return g?new OffscreenCanvas(D,I):lc("canvas")}function y(D,I,z,he){let X=1;if((D.width>he||D.height>he)&&(X=he/Math.max(D.width,D.height)),X<1||I===!0)if(typeof HTMLImageElement<"u"&&D instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&D instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&D instanceof ImageBitmap){const re=I?Su:Math.floor,Re=re(X*D.width),xe=re(X*D.height);E===void 0&&(E=v(Re,xe));const De=z?v(Re,xe):E;return De.width=Re,De.height=xe,De.getContext("2d").drawImage(D,0,0,Re,xe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+D.width+"x"+D.height+") to ("+Re+"x"+xe+")."),De}else return"data"in D&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+D.width+"x"+D.height+")."),D;return D}function T(D){return fb(D.width)&&fb(D.height)}function C(D){return a?!1:D.wrapS!==gi||D.wrapT!==gi||D.minFilter!==En&&D.minFilter!==jn}function x(D,I){return D.generateMipmaps&&I&&D.minFilter!==En&&D.minFilter!==jn}function O(D){n.generateMipmap(D)}function R(D,I,z,he,X=!1){if(a===!1)return I;if(D!==null){if(n[D]!==void 0)return n[D];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+D+"'")}let re=I;if(I===n.RED&&(z===n.FLOAT&&(re=n.R32F),z===n.HALF_FLOAT&&(re=n.R16F),z===n.UNSIGNED_BYTE&&(re=n.R8)),I===n.RED_INTEGER&&(z===n.UNSIGNED_BYTE&&(re=n.R8UI),z===n.UNSIGNED_SHORT&&(re=n.R16UI),z===n.UNSIGNED_INT&&(re=n.R32UI),z===n.BYTE&&(re=n.R8I),z===n.SHORT&&(re=n.R16I),z===n.INT&&(re=n.R32I)),I===n.RG&&(z===n.FLOAT&&(re=n.RG32F),z===n.HALF_FLOAT&&(re=n.RG16F),z===n.UNSIGNED_BYTE&&(re=n.RG8)),I===n.RGBA){const Re=X?bu:Ft.getTransfer(he);z===n.FLOAT&&(re=n.RGBA32F),z===n.HALF_FLOAT&&(re=n.RGBA16F),z===n.UNSIGNED_BYTE&&(re=Re===Xt?n.SRGB8_ALPHA8:n.RGBA8),z===n.UNSIGNED_SHORT_4_4_4_4&&(re=n.RGBA4),z===n.UNSIGNED_SHORT_5_5_5_1&&(re=n.RGB5_A1)}return(re===n.R16F||re===n.R32F||re===n.RG16F||re===n.RG32F||re===n.RGBA16F||re===n.RGBA32F)&&e.get("EXT_color_buffer_float"),re}function S(D,I,z){return x(D,z)===!0||D.isFramebufferTexture&&D.minFilter!==En&&D.minFilter!==jn?Math.log2(Math.max(I.width,I.height))+1:D.mipmaps!==void 0&&D.mipmaps.length>0?D.mipmaps.length:D.isCompressedTexture&&Array.isArray(D.image)?I.mipmaps.length:1}function A(D){return D===En||D===ub||D===Vd?n.NEAREST:n.LINEAR}function U(D){const I=D.target;I.removeEventListener("dispose",U),K(I),I.isVideoTexture&&h.delete(I)}function F(D){const I=D.target;I.removeEventListener("dispose",F),H(I)}function K(D){const I=i.get(D);if(I.__webglInit===void 0)return;const z=D.source,he=b.get(z);if(he){const X=he[I.__cacheKey];X.usedTimes--,X.usedTimes===0&&L(D),Object.keys(he).length===0&&b.delete(z)}i.remove(D)}function L(D){const I=i.get(D);n.deleteTexture(I.__webglTexture);const z=D.source,he=b.get(z);delete he[I.__cacheKey],o.memory.textures--}function H(D){const I=D.texture,z=i.get(D),he=i.get(I);if(he.__webglTexture!==void 0&&(n.deleteTexture(he.__webglTexture),o.memory.textures--),D.depthTexture&&D.depthTexture.dispose(),D.isWebGLCubeRenderTarget)for(let X=0;X<6;X++){if(Array.isArray(z.__webglFramebuffer[X]))for(let re=0;re=l&&console.warn("THREE.WebGLTextures: Trying to use "+D+" texture units while this GPU supports only "+l),G+=1,D}function Y(D){const I=[];return I.push(D.wrapS),I.push(D.wrapT),I.push(D.wrapR||0),I.push(D.magFilter),I.push(D.minFilter),I.push(D.anisotropy),I.push(D.internalFormat),I.push(D.format),I.push(D.type),I.push(D.generateMipmaps),I.push(D.premultiplyAlpha),I.push(D.flipY),I.push(D.unpackAlignment),I.push(D.colorSpace),I.join()}function Q(D,I){const z=i.get(D);if(D.isVideoTexture&&se(D),D.isRenderTargetTexture===!1&&D.version>0&&z.__version!==D.version){const he=D.image;if(he===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(he.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ee(z,D,I);return}}t.bindTexture(n.TEXTURE_2D,z.__webglTexture,n.TEXTURE0+I)}function ae(D,I){const z=i.get(D);if(D.version>0&&z.__version!==D.version){ee(z,D,I);return}t.bindTexture(n.TEXTURE_2D_ARRAY,z.__webglTexture,n.TEXTURE0+I)}function te(D,I){const z=i.get(D);if(D.version>0&&z.__version!==D.version){ee(z,D,I);return}t.bindTexture(n.TEXTURE_3D,z.__webglTexture,n.TEXTURE0+I)}function Z(D,I){const z=i.get(D);if(D.version>0&&z.__version!==D.version){Se(z,D,I);return}t.bindTexture(n.TEXTURE_CUBE_MAP,z.__webglTexture,n.TEXTURE0+I)}const me={[Ra]:n.REPEAT,[gi]:n.CLAMP_TO_EDGE,[gu]:n.MIRRORED_REPEAT},ve={[En]:n.NEAREST,[ub]:n.NEAREST_MIPMAP_NEAREST,[Vd]:n.NEAREST_MIPMAP_LINEAR,[jn]:n.LINEAR,[XO]:n.LINEAR_MIPMAP_NEAREST,[go]:n.LINEAR_MIPMAP_LINEAR},Ae={[fCt]:n.NEVER,[yCt]:n.ALWAYS,[mCt]:n.LESS,[aI]:n.LEQUAL,[gCt]:n.EQUAL,[vCt]:n.GEQUAL,[bCt]:n.GREATER,[ECt]:n.NOTEQUAL};function J(D,I,z){if(z?(n.texParameteri(D,n.TEXTURE_WRAP_S,me[I.wrapS]),n.texParameteri(D,n.TEXTURE_WRAP_T,me[I.wrapT]),(D===n.TEXTURE_3D||D===n.TEXTURE_2D_ARRAY)&&n.texParameteri(D,n.TEXTURE_WRAP_R,me[I.wrapR]),n.texParameteri(D,n.TEXTURE_MAG_FILTER,ve[I.magFilter]),n.texParameteri(D,n.TEXTURE_MIN_FILTER,ve[I.minFilter])):(n.texParameteri(D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(D===n.TEXTURE_3D||D===n.TEXTURE_2D_ARRAY)&&n.texParameteri(D,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(I.wrapS!==gi||I.wrapT!==gi)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(D,n.TEXTURE_MAG_FILTER,A(I.magFilter)),n.texParameteri(D,n.TEXTURE_MIN_FILTER,A(I.minFilter)),I.minFilter!==En&&I.minFilter!==jn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),I.compareFunction&&(n.texParameteri(D,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(D,n.TEXTURE_COMPARE_FUNC,Ae[I.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const he=e.get("EXT_texture_filter_anisotropic");if(I.magFilter===En||I.minFilter!==Vd&&I.minFilter!==go||I.type===ks&&e.has("OES_texture_float_linear")===!1||a===!1&&I.type===oc&&e.has("OES_texture_half_float_linear")===!1)return;(I.anisotropy>1||i.get(I).__currentAnisotropy)&&(n.texParameterf(D,he.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(I.anisotropy,s.getMaxAnisotropy())),i.get(I).__currentAnisotropy=I.anisotropy)}}function ge(D,I){let z=!1;D.__webglInit===void 0&&(D.__webglInit=!0,I.addEventListener("dispose",U));const he=I.source;let X=b.get(he);X===void 0&&(X={},b.set(he,X));const re=Y(I);if(re!==D.__cacheKey){X[re]===void 0&&(X[re]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,z=!0),X[re].usedTimes++;const Re=X[D.__cacheKey];Re!==void 0&&(X[D.__cacheKey].usedTimes--,Re.usedTimes===0&&L(I)),D.__cacheKey=re,D.__webglTexture=X[re].texture}return z}function ee(D,I,z){let he=n.TEXTURE_2D;(I.isDataArrayTexture||I.isCompressedArrayTexture)&&(he=n.TEXTURE_2D_ARRAY),I.isData3DTexture&&(he=n.TEXTURE_3D);const X=ge(D,I),re=I.source;t.bindTexture(he,D.__webglTexture,n.TEXTURE0+z);const Re=i.get(re);if(re.version!==Re.__version||X===!0){t.activeTexture(n.TEXTURE0+z);const xe=Ft.getPrimaries(Ft.workingColorSpace),De=I.colorSpace===Ei?null:Ft.getPrimaries(I.colorSpace),ze=I.colorSpace===Ei||xe===De?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,I.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,I.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,ze);const st=C(I)&&T(I.image)===!1;let ke=y(I.image,st,!1,c);ke=ce(I,ke);const lt=T(ke)||a,Qe=r.convert(I.format,I.colorSpace);let He=r.convert(I.type),et=R(I.internalFormat,Qe,He,I.colorSpace,I.isVideoTexture);J(he,I,lt);let Fe;const pt=I.mipmaps,pe=a&&I.isVideoTexture!==!0&&et!==sI,We=Re.__version===void 0||X===!0,Ue=S(I,ke,lt);if(I.isDepthTexture)et=n.DEPTH_COMPONENT,a?I.type===ks?et=n.DEPTH_COMPONENT32F:I.type===br?et=n.DEPTH_COMPONENT24:I.type===lo?et=n.DEPTH24_STENCIL8:et=n.DEPTH_COMPONENT16:I.type===ks&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),I.format===co&&et===n.DEPTH_COMPONENT&&I.type!==XE&&I.type!==br&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),I.type=br,He=r.convert(I.type)),I.format===Aa&&et===n.DEPTH_COMPONENT&&(et=n.DEPTH_STENCIL,I.type!==lo&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),I.type=lo,He=r.convert(I.type))),We&&(pe?t.texStorage2D(n.TEXTURE_2D,1,et,ke.width,ke.height):t.texImage2D(n.TEXTURE_2D,0,et,ke.width,ke.height,0,Qe,He,null));else if(I.isDataTexture)if(pt.length>0&<){pe&&We&&t.texStorage2D(n.TEXTURE_2D,Ue,et,pt[0].width,pt[0].height);for(let Ne=0,Be=pt.length;Ne>=1,Be>>=1}}else if(pt.length>0&<){pe&&We&&t.texStorage2D(n.TEXTURE_2D,Ue,et,pt[0].width,pt[0].height);for(let Ne=0,Be=pt.length;Ne0&&We++,t.texStorage2D(n.TEXTURE_CUBE_MAP,We,Fe,ke[0].width,ke[0].height));for(let Ne=0;Ne<6;Ne++)if(st){pt?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,0,0,0,ke[Ne].width,ke[Ne].height,He,et,ke[Ne].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,0,Fe,ke[Ne].width,ke[Ne].height,0,He,et,ke[Ne].data);for(let Be=0;Be>re),ke=Math.max(1,I.height>>re);X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY?t.texImage3D(X,re,De,st,ke,I.depth,0,Re,xe,null):t.texImage2D(X,re,De,st,ke,0,Re,xe,null)}t.bindFramebuffer(n.FRAMEBUFFER,D),_e(I)?f.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,he,X,i.get(z).__webglTexture,0,V(I)):(X===n.TEXTURE_2D||X>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&X<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,he,X,i.get(z).__webglTexture,re),t.bindFramebuffer(n.FRAMEBUFFER,null)}function k(D,I,z){if(n.bindRenderbuffer(n.RENDERBUFFER,D),I.depthBuffer&&!I.stencilBuffer){let he=a===!0?n.DEPTH_COMPONENT24:n.DEPTH_COMPONENT16;if(z||_e(I)){const X=I.depthTexture;X&&X.isDepthTexture&&(X.type===ks?he=n.DEPTH_COMPONENT32F:X.type===br&&(he=n.DEPTH_COMPONENT24));const re=V(I);_e(I)?f.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,re,he,I.width,I.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,re,he,I.width,I.height)}else n.renderbufferStorage(n.RENDERBUFFER,he,I.width,I.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,D)}else if(I.depthBuffer&&I.stencilBuffer){const he=V(I);z&&_e(I)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,he,n.DEPTH24_STENCIL8,I.width,I.height):_e(I)?f.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,he,n.DEPTH24_STENCIL8,I.width,I.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,I.width,I.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,D)}else{const he=I.isWebGLMultipleRenderTargets===!0?I.texture:[I.texture];for(let X=0;X0){z.__webglFramebuffer[xe]=[];for(let De=0;De0){z.__webglFramebuffer=[];for(let xe=0;xe0&&_e(D)===!1){const xe=re?I:[I];z.__webglMultisampledFramebuffer=n.createFramebuffer(),z.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,z.__webglMultisampledFramebuffer);for(let De=0;De0)for(let De=0;De0)for(let De=0;De0&&_e(D)===!1){const I=D.isWebGLMultipleRenderTargets?D.texture:[D.texture],z=D.width,he=D.height;let X=n.COLOR_BUFFER_BIT;const re=[],Re=D.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,xe=i.get(D),De=D.isWebGLMultipleRenderTargets===!0;if(De)for(let ze=0;ze0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&I.__useRenderToTexture!==!1}function se(D){const I=o.render.frame;h.get(D)!==I&&(h.set(D,I),D.update())}function ce(D,I){const z=D.colorSpace,he=D.format,X=D.type;return D.isCompressedTexture===!0||D.isVideoTexture===!0||D.format===hb||z!==Nn&&z!==Ei&&(Ft.getTransfer(z)===Xt?a===!1?e.has("EXT_sRGB")===!0&&he===bi?(D.format=hb,D.minFilter=jn,D.generateMipmaps=!1):I=cI.sRGBToLinear(I):(he!==bi||X!==xr)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",z)),I}this.allocateTextureUnit=j,this.resetTextureUnits=P,this.setTexture2D=Q,this.setTexture2DArray=ae,this.setTexture3D=te,this.setTextureCube=Z,this.rebindTextures=de,this.setupRenderTarget=ie,this.updateRenderTargetMipmap=Ce,this.updateMultisampleRenderTarget=we,this.setupDepthRenderbuffer=$,this.setupFrameBufferTexture=Ie,this.useMultisampledRTT=_e}function LNt(n,e,t){const i=t.isWebGL2;function s(r,o=Ei){let a;const l=Ft.getTransfer(o);if(r===xr)return n.UNSIGNED_BYTE;if(r===JO)return n.UNSIGNED_SHORT_4_4_4_4;if(r===eI)return n.UNSIGNED_SHORT_5_5_5_1;if(r===nCt)return n.BYTE;if(r===iCt)return n.SHORT;if(r===XE)return n.UNSIGNED_SHORT;if(r===ZO)return n.INT;if(r===br)return n.UNSIGNED_INT;if(r===ks)return n.FLOAT;if(r===oc)return i?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(r===sCt)return n.ALPHA;if(r===bi)return n.RGBA;if(r===rCt)return n.LUMINANCE;if(r===oCt)return n.LUMINANCE_ALPHA;if(r===co)return n.DEPTH_COMPONENT;if(r===Aa)return n.DEPTH_STENCIL;if(r===hb)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(r===aCt)return n.RED;if(r===tI)return n.RED_INTEGER;if(r===lCt)return n.RG;if(r===nI)return n.RG_INTEGER;if(r===iI)return n.RGBA_INTEGER;if(r===Bm||r===Gm||r===zm||r===Vm)if(l===Xt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(r===Bm)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Gm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===zm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Vm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(r===Bm)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Gm)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===zm)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Vm)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===QC||r===XC||r===ZC||r===JC)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(r===QC)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===XC)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===ZC)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===JC)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===sI)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===e1||r===t1)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(r===e1)return l===Xt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(r===t1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===n1||r===i1||r===s1||r===r1||r===o1||r===a1||r===l1||r===c1||r===d1||r===u1||r===p1||r===_1||r===h1||r===f1)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(r===n1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===i1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===s1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===r1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===o1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===a1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===l1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===c1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===d1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===u1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===p1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===_1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===h1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===f1)return l===Xt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===Hm||r===m1||r===g1)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(r===Hm)return l===Xt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===m1)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===g1)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===cCt||r===b1||r===E1||r===v1)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(r===Hm)return a.COMPRESSED_RED_RGTC1_EXT;if(r===b1)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===E1)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===v1)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===lo?i?n.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[r]!==void 0?n[r]:null}return{convert:s}}class PNt extends Vn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class io extends sn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const UNt={type:"move"};class _g{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new io,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new io,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new be,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new be),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new io,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new be,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new be),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let s=null,r=null,o=null;const a=this._targetRay,l=this._grip,d=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(d&&e.hand){o=!0;for(const E of e.hand.values()){const b=t.getJointPose(E,i),g=this._getHandJoint(d,E);b!==null&&(g.matrix.fromArray(b.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,g.jointRadius=b.radius),g.visible=b!==null}const c=d.joints["index-finger-tip"],_=d.joints["thumb-tip"],f=c.position.distanceTo(_.position),m=.02,h=.005;d.inputState.pinching&&f>m+h?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!d.inputState.pinching&&f<=m-h&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,i),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(s=t.getPose(e.targetRaySpace,i),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(UNt)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=r!==null),d!==null&&(d.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new io;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class FNt extends ja{constructor(e,t){super();const i=this;let s=null,r=1,o=null,a="local-floor",l=1,d=null,c=null,_=null,f=null,m=null,h=null;const E=t.getContextAttributes();let b=null,g=null;const v=[],y=[],T=new Mt;let C=null;const x=new Vn;x.layers.enable(1),x.viewport=new Wt;const O=new Vn;O.layers.enable(2),O.viewport=new Wt;const R=[x,O],S=new PNt;S.layers.enable(1),S.layers.enable(2);let A=null,U=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Z){let me=v[Z];return me===void 0&&(me=new _g,v[Z]=me),me.getTargetRaySpace()},this.getControllerGrip=function(Z){let me=v[Z];return me===void 0&&(me=new _g,v[Z]=me),me.getGripSpace()},this.getHand=function(Z){let me=v[Z];return me===void 0&&(me=new _g,v[Z]=me),me.getHandSpace()};function F(Z){const me=y.indexOf(Z.inputSource);if(me===-1)return;const ve=v[me];ve!==void 0&&(ve.update(Z.inputSource,Z.frame,d||o),ve.dispatchEvent({type:Z.type,data:Z.inputSource}))}function K(){s.removeEventListener("select",F),s.removeEventListener("selectstart",F),s.removeEventListener("selectend",F),s.removeEventListener("squeeze",F),s.removeEventListener("squeezestart",F),s.removeEventListener("squeezeend",F),s.removeEventListener("end",K),s.removeEventListener("inputsourceschange",L);for(let Z=0;Z=0&&(y[Ae]=null,v[Ae].disconnect(ve))}for(let me=0;me=y.length){y.push(ve),Ae=ge;break}else if(y[ge]===null){y[ge]=ve,Ae=ge;break}if(Ae===-1)break}const J=v[Ae];J&&J.connect(ve)}}const H=new be,G=new be;function P(Z,me,ve){H.setFromMatrixPosition(me.matrixWorld),G.setFromMatrixPosition(ve.matrixWorld);const Ae=H.distanceTo(G),J=me.projectionMatrix.elements,ge=ve.projectionMatrix.elements,ee=J[14]/(J[10]-1),Se=J[14]/(J[10]+1),Ie=(J[9]+1)/J[5],k=(J[9]-1)/J[5],B=(J[8]-1)/J[0],$=(ge[8]+1)/ge[0],de=ee*B,ie=ee*$,Ce=Ae/(-B+$),we=Ce*-B;me.matrixWorld.decompose(Z.position,Z.quaternion,Z.scale),Z.translateX(we),Z.translateZ(Ce),Z.matrixWorld.compose(Z.position,Z.quaternion,Z.scale),Z.matrixWorldInverse.copy(Z.matrixWorld).invert();const V=ee+Ce,_e=Se+Ce,se=de-we,ce=ie+(Ae-we),D=Ie*Se/_e*V,I=k*Se/_e*V;Z.projectionMatrix.makePerspective(se,ce,D,I,V,_e),Z.projectionMatrixInverse.copy(Z.projectionMatrix).invert()}function j(Z,me){me===null?Z.matrixWorld.copy(Z.matrix):Z.matrixWorld.multiplyMatrices(me.matrixWorld,Z.matrix),Z.matrixWorldInverse.copy(Z.matrixWorld).invert()}this.updateCamera=function(Z){if(s===null)return;S.near=O.near=x.near=Z.near,S.far=O.far=x.far=Z.far,(A!==S.near||U!==S.far)&&(s.updateRenderState({depthNear:S.near,depthFar:S.far}),A=S.near,U=S.far);const me=Z.parent,ve=S.cameras;j(S,me);for(let Ae=0;Ae0&&(b.alphaTest.value=g.alphaTest);const v=e.get(g).envMap;if(v&&(b.envMap.value=v,b.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,b.reflectivity.value=g.reflectivity,b.ior.value=g.ior,b.refractionRatio.value=g.refractionRatio),g.lightMap){b.lightMap.value=g.lightMap;const y=n._useLegacyLights===!0?Math.PI:1;b.lightMapIntensity.value=g.lightMapIntensity*y,t(g.lightMap,b.lightMapTransform)}g.aoMap&&(b.aoMap.value=g.aoMap,b.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,b.aoMapTransform))}function o(b,g){b.diffuse.value.copy(g.color),b.opacity.value=g.opacity,g.map&&(b.map.value=g.map,t(g.map,b.mapTransform))}function a(b,g){b.dashSize.value=g.dashSize,b.totalSize.value=g.dashSize+g.gapSize,b.scale.value=g.scale}function l(b,g,v,y){b.diffuse.value.copy(g.color),b.opacity.value=g.opacity,b.size.value=g.size*v,b.scale.value=y*.5,g.map&&(b.map.value=g.map,t(g.map,b.uvTransform)),g.alphaMap&&(b.alphaMap.value=g.alphaMap,t(g.alphaMap,b.alphaMapTransform)),g.alphaTest>0&&(b.alphaTest.value=g.alphaTest)}function d(b,g){b.diffuse.value.copy(g.color),b.opacity.value=g.opacity,b.rotation.value=g.rotation,g.map&&(b.map.value=g.map,t(g.map,b.mapTransform)),g.alphaMap&&(b.alphaMap.value=g.alphaMap,t(g.alphaMap,b.alphaMapTransform)),g.alphaTest>0&&(b.alphaTest.value=g.alphaTest)}function c(b,g){b.specular.value.copy(g.specular),b.shininess.value=Math.max(g.shininess,1e-4)}function _(b,g){g.gradientMap&&(b.gradientMap.value=g.gradientMap)}function f(b,g){b.metalness.value=g.metalness,g.metalnessMap&&(b.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,b.metalnessMapTransform)),b.roughness.value=g.roughness,g.roughnessMap&&(b.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,b.roughnessMapTransform)),e.get(g).envMap&&(b.envMapIntensity.value=g.envMapIntensity)}function m(b,g,v){b.ior.value=g.ior,g.sheen>0&&(b.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),b.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(b.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,b.sheenColorMapTransform)),g.sheenRoughnessMap&&(b.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,b.sheenRoughnessMapTransform))),g.clearcoat>0&&(b.clearcoat.value=g.clearcoat,b.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(b.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,b.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(b.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,b.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(b.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,b.clearcoatNormalMapTransform),b.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===Zn&&b.clearcoatNormalScale.value.negate())),g.iridescence>0&&(b.iridescence.value=g.iridescence,b.iridescenceIOR.value=g.iridescenceIOR,b.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],b.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(b.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,b.iridescenceMapTransform)),g.iridescenceThicknessMap&&(b.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,b.iridescenceThicknessMapTransform))),g.transmission>0&&(b.transmission.value=g.transmission,b.transmissionSamplerMap.value=v.texture,b.transmissionSamplerSize.value.set(v.width,v.height),g.transmissionMap&&(b.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,b.transmissionMapTransform)),b.thickness.value=g.thickness,g.thicknessMap&&(b.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,b.thicknessMapTransform)),b.attenuationDistance.value=g.attenuationDistance,b.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(b.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(b.anisotropyMap.value=g.anisotropyMap,t(g.anisotropyMap,b.anisotropyMapTransform))),b.specularIntensity.value=g.specularIntensity,b.specularColor.value.copy(g.specularColor),g.specularColorMap&&(b.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,b.specularColorMapTransform)),g.specularIntensityMap&&(b.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,b.specularIntensityMapTransform))}function h(b,g){g.matcap&&(b.matcap.value=g.matcap)}function E(b,g){const v=e.get(g).light;b.referencePosition.value.setFromMatrixPosition(v.matrixWorld),b.nearDistance.value=v.shadow.camera.near,b.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function GNt(n,e,t,i){let s={},r={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(v,y){const T=y.program;i.uniformBlockBinding(v,T)}function d(v,y){let T=s[v.id];T===void 0&&(h(v),T=c(v),s[v.id]=T,v.addEventListener("dispose",b));const C=y.program;i.updateUBOMapping(v,C);const x=e.render.frame;r[v.id]!==x&&(f(v),r[v.id]=x)}function c(v){const y=_();v.__bindingPointIndex=y;const T=n.createBuffer(),C=v.__size,x=v.usage;return n.bindBuffer(n.UNIFORM_BUFFER,T),n.bufferData(n.UNIFORM_BUFFER,C,x),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,y,T),T}function _(){for(let v=0;v0){x=T%C;const F=C-x;x!==0&&F-A.boundary<0&&(T+=C-x,S.__offset=T)}T+=A.storage}return x=T%C,x>0&&(T+=C-x),v.__size=T,v.__cache={},this}function E(v){const y={boundary:0,storage:0};return typeof v=="number"?(y.boundary=4,y.storage=4):v.isVector2?(y.boundary=8,y.storage=8):v.isVector3||v.isColor?(y.boundary=16,y.storage=12):v.isVector4?(y.boundary=16,y.storage=16):v.isMatrix3?(y.boundary=48,y.storage=48):v.isMatrix4?(y.boundary=64,y.storage=64):v.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",v),y}function b(v){const y=v.target;y.removeEventListener("dispose",b);const T=o.indexOf(y.__bindingPointIndex);o.splice(T,1),n.deleteBuffer(s[y.id]),delete s[y.id],delete r[y.id]}function g(){for(const v in s)n.deleteBuffer(s[v]);o=[],s={},r={}}return{bind:l,update:d,dispose:g}}class RI{constructor(e={}){const{canvas:t=UCt(),context:i=null,depth:s=!0,stencil:r=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:d=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:_=!1}=e;this.isWebGLRenderer=!0;let f;i!==null?f=i.getContextAttributes().alpha:f=o;const m=new Uint32Array(4),h=new Int32Array(4);let E=null,b=null;const g=[],v=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=rn,this._useLegacyLights=!1,this.toneMapping=Tr,this.toneMappingExposure=1;const y=this;let T=!1,C=0,x=0,O=null,R=-1,S=null;const A=new Wt,U=new Wt;let F=null;const K=new gt(0);let L=0,H=t.width,G=t.height,P=1,j=null,Y=null;const Q=new Wt(0,0,H,G),ae=new Wt(0,0,H,G);let te=!1;const Z=new tv;let me=!1,ve=!1,Ae=null;const J=new At,ge=new Mt,ee=new be,Se={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ie(){return O===null?P:1}let k=i;function B(N,W){for(let le=0;le{function Ge(){if(ye.forEach(function(Xe){we.get(Xe).currentProgram.isReady()&&ye.delete(Xe)}),ye.size===0){Ee(N);return}setTimeout(Ge,10)}$.get("KHR_parallel_shader_compile")!==null?Ge():setTimeout(Ge,10)})};let Et=null;function jt(N){Et&&Et(N)}function ln(){$t.stop()}function Ct(){$t.start()}const $t=new EI;$t.setAnimationLoop(jt),typeof self<"u"&&$t.setContext(self),this.setAnimationLoop=function(N){Et=N,Fe.setAnimationLoop(N),N===null?$t.stop():$t.start()},Fe.addEventListener("sessionstart",ln),Fe.addEventListener("sessionend",Ct),this.render=function(N,W){if(W!==void 0&&W.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),W.parent===null&&W.matrixWorldAutoUpdate===!0&&W.updateMatrixWorld(),Fe.enabled===!0&&Fe.isPresenting===!0&&(Fe.cameraAutoUpdate===!0&&Fe.updateCamera(W),W=Fe.getCamera()),N.isScene===!0&&N.onBeforeRender(y,N,W,O),b=re.get(N,v.length),b.init(),v.push(b),J.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),Z.setFromProjectionMatrix(J),ve=this.localClippingEnabled,me=Re.init(this.clippingPlanes,ve),E=X.get(N,g.length),E.init(),g.push(E),yn(N,W,0,y.sortObjects),E.finish(),y.sortObjects===!0&&E.sort(j,Y),this.info.render.frame++,me===!0&&Re.beginShadows();const le=b.state.shadowsArray;if(xe.render(le,N,W),me===!0&&Re.endShadows(),this.info.autoReset===!0&&this.info.reset(),De.render(E,N),b.setupLights(y._useLegacyLights),W.isArrayCamera){const ye=W.cameras;for(let Ee=0,Ge=ye.length;Ee0?b=v[v.length-1]:b=null,g.pop(),g.length>0?E=g[g.length-1]:E=null};function yn(N,W,le,ye){if(N.visible===!1)return;if(N.layers.test(W.layers)){if(N.isGroup)le=N.renderOrder;else if(N.isLOD)N.autoUpdate===!0&&N.update(W);else if(N.isLight)b.pushLight(N),N.castShadow&&b.pushShadow(N);else if(N.isSprite){if(!N.frustumCulled||Z.intersectsSprite(N)){ye&&ee.setFromMatrixPosition(N.matrixWorld).applyMatrix4(J);const Xe=I.update(N),nt=N.material;nt.visible&&E.push(N,Xe,nt,le,ee.z,null)}}else if((N.isMesh||N.isLine||N.isPoints)&&(!N.frustumCulled||Z.intersectsObject(N))){const Xe=I.update(N),nt=N.material;if(ye&&(N.boundingSphere!==void 0?(N.boundingSphere===null&&N.computeBoundingSphere(),ee.copy(N.boundingSphere.center)):(Xe.boundingSphere===null&&Xe.computeBoundingSphere(),ee.copy(Xe.boundingSphere.center)),ee.applyMatrix4(N.matrixWorld).applyMatrix4(J)),Array.isArray(nt)){const at=Xe.groups;for(let rt=0,_t=at.length;rt<_t;rt++){const ft=at[rt],Kt=nt[ft.materialIndex];Kt&&Kt.visible&&E.push(N,Xe,Kt,le,ee.z,ft)}}else nt.visible&&E.push(N,Xe,nt,le,ee.z,null)}}const Ge=N.children;for(let Xe=0,nt=Ge.length;Xe0&&kr(Ee,Ge,W,le),ye&&ie.viewport(A.copy(ye)),Ee.length>0&&ci(Ee,W,le),Ge.length>0&&ci(Ge,W,le),Xe.length>0&&ci(Xe,W,le),ie.buffers.depth.setTest(!0),ie.buffers.depth.setMask(!0),ie.buffers.color.setMask(!0),ie.setPolygonOffset(!1)}function kr(N,W,le,ye){if((le.isScene===!0?le.overrideMaterial:null)!==null)return;const Ge=de.isWebGL2;Ae===null&&(Ae=new bo(1,1,{generateMipmaps:!0,type:$.has("EXT_color_buffer_half_float")?oc:xr,minFilter:go,samples:Ge?4:0})),y.getDrawingBufferSize(ge),Ge?Ae.setSize(ge.x,ge.y):Ae.setSize(Su(ge.x),Su(ge.y));const Xe=y.getRenderTarget();y.setRenderTarget(Ae),y.getClearColor(K),L=y.getClearAlpha(),L<1&&y.setClearColor(16777215,.5),y.clear();const nt=y.toneMapping;y.toneMapping=Tr,ci(N,le,ye),V.updateMultisampleRenderTarget(Ae),V.updateRenderTargetMipmap(Ae);let at=!1;for(let rt=0,_t=W.length;rt<_t;rt++){const ft=W[rt],Kt=ft.object,Tn=ft.geometry,nn=ft.material,On=ft.group;if(nn.side===Ji&&Kt.layers.test(ye.layers)){const Qt=nn.side;nn.side=Zn,nn.needsUpdate=!0,Sn(Kt,le,ye,Tn,nn,On),nn.side=Qt,nn.needsUpdate=!0,at=!0}}at===!0&&(V.updateMultisampleRenderTarget(Ae),V.updateRenderTargetMipmap(Ae)),y.setRenderTarget(Xe),y.setClearColor(K,L),y.toneMapping=nt}function ci(N,W,le){const ye=W.isScene===!0?W.overrideMaterial:null;for(let Ee=0,Ge=N.length;Ee0),ft=!!le.morphAttributes.position,Kt=!!le.morphAttributes.normal,Tn=!!le.morphAttributes.color;let nn=Tr;ye.toneMapped&&(O===null||O.isXRRenderTarget===!0)&&(nn=y.toneMapping);const On=le.morphAttributes.position||le.morphAttributes.normal||le.morphAttributes.color,Qt=On!==void 0?On.length:0,St=we.get(ye),tl=b.state.lights;if(me===!0&&(ve===!0||N!==S)){const Wn=N===S&&ye.id===R;Re.setState(ye,N,Wn)}let Jt=!1;ye.version===St.__version?(St.needsLights&&St.lightsStateVersion!==tl.state.version||St.outputColorSpace!==nt||Ee.isBatchedMesh&&St.batching===!1||!Ee.isBatchedMesh&&St.batching===!0||Ee.isInstancedMesh&&St.instancing===!1||!Ee.isInstancedMesh&&St.instancing===!0||Ee.isSkinnedMesh&&St.skinning===!1||!Ee.isSkinnedMesh&&St.skinning===!0||Ee.isInstancedMesh&&St.instancingColor===!0&&Ee.instanceColor===null||Ee.isInstancedMesh&&St.instancingColor===!1&&Ee.instanceColor!==null||St.envMap!==at||ye.fog===!0&&St.fog!==Ge||St.numClippingPlanes!==void 0&&(St.numClippingPlanes!==Re.numPlanes||St.numIntersection!==Re.numIntersection)||St.vertexAlphas!==rt||St.vertexTangents!==_t||St.morphTargets!==ft||St.morphNormals!==Kt||St.morphColors!==Tn||St.toneMapping!==nn||de.isWebGL2===!0&&St.morphTargetsCount!==Qt)&&(Jt=!0):(Jt=!0,St.__version=ye.version);let ys=St.currentProgram;Jt===!0&&(ys=di(ye,W,Ee));let Ac=!1,Lr=!1,nl=!1;const gn=ys.getUniforms(),Ss=St.uniforms;if(ie.useProgram(ys.program)&&(Ac=!0,Lr=!0,nl=!0),ye.id!==R&&(R=ye.id,Lr=!0),Ac||S!==N){gn.setValue(k,"projectionMatrix",N.projectionMatrix),gn.setValue(k,"viewMatrix",N.matrixWorldInverse);const Wn=gn.map.cameraPosition;Wn!==void 0&&Wn.setValue(k,ee.setFromMatrixPosition(N.matrixWorld)),de.logarithmicDepthBuffer&&gn.setValue(k,"logDepthBufFC",2/(Math.log(N.far+1)/Math.LN2)),(ye.isMeshPhongMaterial||ye.isMeshToonMaterial||ye.isMeshLambertMaterial||ye.isMeshBasicMaterial||ye.isMeshStandardMaterial||ye.isShaderMaterial)&&gn.setValue(k,"isOrthographic",N.isOrthographicCamera===!0),S!==N&&(S=N,Lr=!0,nl=!0)}if(Ee.isSkinnedMesh){gn.setOptional(k,Ee,"bindMatrix"),gn.setOptional(k,Ee,"bindMatrixInverse");const Wn=Ee.skeleton;Wn&&(de.floatVertexTextures?(Wn.boneTexture===null&&Wn.computeBoneTexture(),gn.setValue(k,"boneTexture",Wn.boneTexture,V)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}Ee.isBatchedMesh&&(gn.setOptional(k,Ee,"batchingTexture"),gn.setValue(k,"batchingTexture",Ee._matricesTexture,V));const il=le.morphAttributes;if((il.position!==void 0||il.normal!==void 0||il.color!==void 0&&de.isWebGL2===!0)&&ze.update(Ee,le,ys),(Lr||St.receiveShadow!==Ee.receiveShadow)&&(St.receiveShadow=Ee.receiveShadow,gn.setValue(k,"receiveShadow",Ee.receiveShadow)),ye.isMeshGouraudMaterial&&ye.envMap!==null&&(Ss.envMap.value=at,Ss.flipEnvMap.value=at.isCubeTexture&&at.isRenderTargetTexture===!1?-1:1),Lr&&(gn.setValue(k,"toneMappingExposure",y.toneMappingExposure),St.needsLights&&vs(Ss,nl),Ge&&ye.fog===!0&&he.refreshFogUniforms(Ss,Ge),he.refreshMaterialUniforms(Ss,ye,P,G,Ae),Hd.upload(k,Ki(St),Ss,V)),ye.isShaderMaterial&&ye.uniformsNeedUpdate===!0&&(Hd.upload(k,Ki(St),Ss,V),ye.uniformsNeedUpdate=!1),ye.isSpriteMaterial&&gn.setValue(k,"center",Ee.center),gn.setValue(k,"modelViewMatrix",Ee.modelViewMatrix),gn.setValue(k,"normalMatrix",Ee.normalMatrix),gn.setValue(k,"modelMatrix",Ee.matrixWorld),ye.isShaderMaterial||ye.isRawShaderMaterial){const Wn=ye.uniformsGroups;for(let sl=0,Ep=Wn.length;sl0&&V.useMultisampledRTT(N)===!1?Ee=we.get(N).__webglMultisampledFramebuffer:Array.isArray(_t)?Ee=_t[le]:Ee=_t,A.copy(N.viewport),U.copy(N.scissor),F=N.scissorTest}else A.copy(Q).multiplyScalar(P).floor(),U.copy(ae).multiplyScalar(P).floor(),F=te;if(ie.bindFramebuffer(k.FRAMEBUFFER,Ee)&&de.drawBuffers&&ye&&ie.drawBuffers(N,Ee),ie.viewport(A),ie.scissor(U),ie.setScissorTest(F),Ge){const at=we.get(N.texture);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_CUBE_MAP_POSITIVE_X+W,at.__webglTexture,le)}else if(Xe){const at=we.get(N.texture),rt=W||0;k.framebufferTextureLayer(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,at.__webglTexture,le||0,rt)}R=-1},this.readRenderTargetPixels=function(N,W,le,ye,Ee,Ge,Xe){if(!(N&&N.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let nt=we.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&Xe!==void 0&&(nt=nt[Xe]),nt){ie.bindFramebuffer(k.FRAMEBUFFER,nt);try{const at=N.texture,rt=at.format,_t=at.type;if(rt!==bi&<.convert(rt)!==k.getParameter(k.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ft=_t===oc&&($.has("EXT_color_buffer_half_float")||de.isWebGL2&&$.has("EXT_color_buffer_float"));if(_t!==xr&<.convert(_t)!==k.getParameter(k.IMPLEMENTATION_COLOR_READ_TYPE)&&!(_t===ks&&(de.isWebGL2||$.has("OES_texture_float")||$.has("WEBGL_color_buffer_float")))&&!ft){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}W>=0&&W<=N.width-ye&&le>=0&&le<=N.height-Ee&&k.readPixels(W,le,ye,Ee,lt.convert(rt),lt.convert(_t),Ge)}finally{const at=O!==null?we.get(O).__webglFramebuffer:null;ie.bindFramebuffer(k.FRAMEBUFFER,at)}}},this.copyFramebufferToTexture=function(N,W,le=0){const ye=Math.pow(2,-le),Ee=Math.floor(W.image.width*ye),Ge=Math.floor(W.image.height*ye);V.setTexture2D(W,0),k.copyTexSubImage2D(k.TEXTURE_2D,le,0,0,N.x,N.y,Ee,Ge),ie.unbindTexture()},this.copyTextureToTexture=function(N,W,le,ye=0){const Ee=W.image.width,Ge=W.image.height,Xe=lt.convert(le.format),nt=lt.convert(le.type);V.setTexture2D(le,0),k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,le.flipY),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,le.premultiplyAlpha),k.pixelStorei(k.UNPACK_ALIGNMENT,le.unpackAlignment),W.isDataTexture?k.texSubImage2D(k.TEXTURE_2D,ye,N.x,N.y,Ee,Ge,Xe,nt,W.image.data):W.isCompressedTexture?k.compressedTexSubImage2D(k.TEXTURE_2D,ye,N.x,N.y,W.mipmaps[0].width,W.mipmaps[0].height,Xe,W.mipmaps[0].data):k.texSubImage2D(k.TEXTURE_2D,ye,N.x,N.y,Xe,nt,W.image),ye===0&&le.generateMipmaps&&k.generateMipmap(k.TEXTURE_2D),ie.unbindTexture()},this.copyTextureToTexture3D=function(N,W,le,ye,Ee=0){if(y.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Ge=N.max.x-N.min.x+1,Xe=N.max.y-N.min.y+1,nt=N.max.z-N.min.z+1,at=lt.convert(ye.format),rt=lt.convert(ye.type);let _t;if(ye.isData3DTexture)V.setTexture3D(ye,0),_t=k.TEXTURE_3D;else if(ye.isDataArrayTexture)V.setTexture2DArray(ye,0),_t=k.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,ye.flipY),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ye.premultiplyAlpha),k.pixelStorei(k.UNPACK_ALIGNMENT,ye.unpackAlignment);const ft=k.getParameter(k.UNPACK_ROW_LENGTH),Kt=k.getParameter(k.UNPACK_IMAGE_HEIGHT),Tn=k.getParameter(k.UNPACK_SKIP_PIXELS),nn=k.getParameter(k.UNPACK_SKIP_ROWS),On=k.getParameter(k.UNPACK_SKIP_IMAGES),Qt=le.isCompressedTexture?le.mipmaps[0]:le.image;k.pixelStorei(k.UNPACK_ROW_LENGTH,Qt.width),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,Qt.height),k.pixelStorei(k.UNPACK_SKIP_PIXELS,N.min.x),k.pixelStorei(k.UNPACK_SKIP_ROWS,N.min.y),k.pixelStorei(k.UNPACK_SKIP_IMAGES,N.min.z),le.isDataTexture||le.isData3DTexture?k.texSubImage3D(_t,Ee,W.x,W.y,W.z,Ge,Xe,nt,at,rt,Qt.data):le.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),k.compressedTexSubImage3D(_t,Ee,W.x,W.y,W.z,Ge,Xe,nt,at,Qt.data)):k.texSubImage3D(_t,Ee,W.x,W.y,W.z,Ge,Xe,nt,at,rt,Qt),k.pixelStorei(k.UNPACK_ROW_LENGTH,ft),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,Kt),k.pixelStorei(k.UNPACK_SKIP_PIXELS,Tn),k.pixelStorei(k.UNPACK_SKIP_ROWS,nn),k.pixelStorei(k.UNPACK_SKIP_IMAGES,On),Ee===0&&ye.generateMipmaps&&k.generateMipmap(_t),ie.unbindTexture()},this.initTexture=function(N){N.isCubeTexture?V.setTextureCube(N,0):N.isData3DTexture?V.setTexture3D(N,0):N.isDataArrayTexture||N.isCompressedArrayTexture?V.setTexture2DArray(N,0):V.setTexture2D(N,0),ie.unbindTexture()},this.resetState=function(){C=0,x=0,O=null,ie.reset(),Qe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ls}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===JE?"display-p3":"srgb",t.unpackColorSpace=Ft.workingColorSpace===pp?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===rn?uo:oI}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===uo?rn:Nn}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class zNt extends RI{}zNt.prototype.isWebGL1Renderer=!0;class VNt extends sn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}class HNt{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=_b,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=zi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn('THREE.InterleavedBuffer: "updateRange" is deprecated and removed in r169. Use "addUpdateRange()" instead.'),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let s=0,r=this.stride;sl)continue;f.applyMatrix4(this.matrixWorld);const R=e.ray.origin.distanceTo(f);Re.far||t.push({distance:R,point:_.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,o.start),v=Math.min(b.count,o.start+o.count);for(let y=g,T=v-1;yl)continue;f.applyMatrix4(this.matrixWorld);const x=e.ray.origin.distanceTo(f);xe.far||t.push({distance:x,point:_.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;rs.far)return;r.push({distance:d,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class lv extends Vi{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new gt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new gt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ZE,this.normalScale=new Mt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class js extends lv{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Mt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return kn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new gt(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new gt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new gt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class RR extends Vi{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new gt(16777215),this.specular=new gt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new gt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ZE,this.normalScale=new Mt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=QE,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}function Rd(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function JNt(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function eOt(n){function e(s,r){return n[s]-n[r]}const t=n.length,i=new Array(t);for(let s=0;s!==t;++s)i[s]=s;return i.sort(e),i}function AR(n,e,t){const i=n.length,s=new n.constructor(i);for(let r=0,o=0;o!==i;++r){const a=t[r]*e;for(let l=0;l!==e;++l)s[o++]=n[a+l]}return s}function OI(n,e,t,i){let s=1,r=n[0];for(;r!==void 0&&r[i]===void 0;)r=n[s++];if(r===void 0)return;let o=r[i];if(o!==void 0)if(Array.isArray(o))do o=r[i],o!==void 0&&(e.push(r.time),t.push.apply(t,o)),r=n[s++];while(r!==void 0);else if(o.toArray!==void 0)do o=r[i],o!==void 0&&(e.push(r.time),o.toArray(t,t.length)),r=n[s++];while(r!==void 0);else do o=r[i],o!==void 0&&(e.push(r.time),t.push(o)),r=n[s++];while(r!==void 0)}class xc{constructor(e,t,i,s){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,s=t[i],r=t[i-1];e:{t:{let o;n:{i:if(!(e=r)){const a=t[1];e=r)break t}o=i,i=0;break n}break e}for(;i>>1;et;)--o;if(++o,r!==0||o!==s){r>=o&&(o=Math.max(o,1),r=o-1);const a=this.getValueSize();this.times=i.slice(r,o),this.values=this.values.slice(r*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,s=this.values,r=i.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(s!==void 0&&JNt(s))for(let a=0,l=s.length;a!==l;++a){const d=s[a];if(isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,d),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),s=this.getInterpolation()===qm,r=e.length-1;let o=1;for(let a=1;a0){e[o]=e[r];for(let a=r*i,l=o*i,d=0;d!==i;++d)t[l+d]=t[a+d];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,s=new i(this.name,e,t);return s.createInterpolant=this.createInterpolant,s}}ms.prototype.TimeBufferType=Float32Array;ms.prototype.ValueBufferType=Float32Array;ms.prototype.DefaultInterpolation=wa;class Xa extends ms{}Xa.prototype.ValueTypeName="bool";Xa.prototype.ValueBufferType=Array;Xa.prototype.DefaultInterpolation=ac;Xa.prototype.InterpolantFactoryMethodLinear=void 0;Xa.prototype.InterpolantFactoryMethodSmooth=void 0;class II extends ms{}II.prototype.ValueTypeName="color";class Ia extends ms{}Ia.prototype.ValueTypeName="number";class sOt extends xc{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e,t,i,s){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(s-t);let d=e*a;for(let c=d+a;d!==c;d+=4)Dr.slerpFlat(r,0,o,d-a,o,d,l);return r}}class vo extends ms{InterpolantFactoryMethodLinear(e){return new sOt(this.times,this.values,this.getValueSize(),e)}}vo.prototype.ValueTypeName="quaternion";vo.prototype.DefaultInterpolation=wa;vo.prototype.InterpolantFactoryMethodSmooth=void 0;class Za extends ms{}Za.prototype.ValueTypeName="string";Za.prototype.ValueBufferType=Array;Za.prototype.DefaultInterpolation=ac;Za.prototype.InterpolantFactoryMethodLinear=void 0;Za.prototype.InterpolantFactoryMethodSmooth=void 0;class Ma extends ms{}Ma.prototype.ValueTypeName="vector";class rOt{constructor(e,t=-1,i,s=dCt){this.name=e,this.tracks=i,this.duration=t,this.blendMode=s,this.uuid=zi(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,s=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(aOt(i[o]).scale(s));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],i=e.tracks,s={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,o=i.length;r!==o;++r)t.push(ms.toJSON(i[r]));return s}static CreateFromMorphTargetSequence(e,t,i,s){const r=t.length,o=[];for(let a=0;a1){const _=c[1];let f=s[_];f||(s[_]=f=[]),f.push(d)}}const o=[];for(const a in s)o.push(this.CreateFromMorphTargetSequence(a,s[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(_,f,m,h,E){if(m.length!==0){const b=[],g=[];OI(m,b,g,h),b.length!==0&&E.push(new _(f,b,g))}},s=[],r=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const d=e.hierarchy||[];for(let _=0;_{t&&t(r),this.manager.itemEnd(e)},0),r;if(Ns[e]!==void 0){Ns[e].push({onLoad:t,onProgress:i,onError:s});return}Ns[e]=[],Ns[e].push({onLoad:t,onProgress:i,onError:s});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(d=>{if(d.status===200||d.status===0){if(d.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||d.body===void 0||d.body.getReader===void 0)return d;const c=Ns[e],_=d.body.getReader(),f=d.headers.get("Content-Length")||d.headers.get("X-File-Size"),m=f?parseInt(f):0,h=m!==0;let E=0;const b=new ReadableStream({start(g){v();function v(){_.read().then(({done:y,value:T})=>{if(y)g.close();else{E+=T.byteLength;const C=new ProgressEvent("progress",{lengthComputable:h,loaded:E,total:m});for(let x=0,O=c.length;x{switch(l){case"arraybuffer":return d.arrayBuffer();case"blob":return d.blob();case"document":return d.text().then(c=>new DOMParser().parseFromString(c,a));case"json":return d.json();default:if(a===void 0)return d.text();{const _=/charset="?([^;"\s]*)"?/i.exec(a),f=_&&_[1]?_[1].toLowerCase():void 0,m=new TextDecoder(f);return d.arrayBuffer().then(h=>m.decode(h))}}}).then(d=>{Da.add(e,d);const c=Ns[e];delete Ns[e];for(let _=0,f=c.length;_{const c=Ns[e];if(c===void 0)throw this.manager.itemError(e),d;delete Ns[e];for(let _=0,f=c.length;_{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class uOt extends Ja{constructor(e){super(e)}load(e,t,i,s){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=Da.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;const a=lc("img");function l(){c(),Da.add(e,this),t&&t(this),r.manager.itemEnd(e)}function d(_){c(),s&&s(_),r.manager.itemError(e),r.manager.itemEnd(e)}function c(){a.removeEventListener("load",l,!1),a.removeEventListener("error",d,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",d,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}class DI extends Ja{constructor(e){super(e)}load(e,t,i,s){const r=new wn,o=new uOt(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){r.image=a,r.needsUpdate=!0,t!==void 0&&t(r)},i,s),r}}class mp extends sn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new gt(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}const gg=new At,wR=new be,NR=new be;class cv{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Mt(512,512),this.map=null,this.mapPass=null,this.matrix=new At,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new tv,this._frameExtents=new Mt(1,1),this._viewportCount=1,this._viewports=[new Wt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;wR.setFromMatrixPosition(e.matrixWorld),t.position.copy(wR),NR.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(NR),t.updateMatrixWorld(),gg.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(gg),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(gg)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class pOt extends cv{constructor(){super(new Vn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=Na*2*e.angle*this.focus,s=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(i!==t.fov||s!==t.aspect||r!==t.far)&&(t.fov=i,t.aspect=s,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class _Ot extends mp{constructor(e,t,i=0,s=Math.PI/3,r=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(sn.DEFAULT_UP),this.updateMatrix(),this.target=new sn,this.distance=i,this.angle=s,this.penumbra=r,this.decay=o,this.map=null,this.shadow=new pOt}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const OR=new At,Sl=new be,bg=new be;class hOt extends cv{constructor(){super(new Vn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Mt(4,2),this._viewportCount=6,this._viewports=[new Wt(2,1,1,1),new Wt(0,1,1,1),new Wt(3,1,1,1),new Wt(1,1,1,1),new Wt(3,0,1,1),new Wt(1,0,1,1)],this._cubeDirections=[new be(1,0,0),new be(-1,0,0),new be(0,0,1),new be(0,0,-1),new be(0,1,0),new be(0,-1,0)],this._cubeUps=[new be(0,1,0),new be(0,1,0),new be(0,1,0),new be(0,1,0),new be(0,0,1),new be(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,s=this.matrix,r=e.distance||i.far;r!==i.far&&(i.far=r,i.updateProjectionMatrix()),Sl.setFromMatrixPosition(e.matrixWorld),i.position.copy(Sl),bg.copy(i.position),bg.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(bg),i.updateMatrixWorld(),s.makeTranslation(-Sl.x,-Sl.y,-Sl.z),OR.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(OR)}}class fOt extends mp{constructor(e,t,i=0,s=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=s,this.shadow=new hOt}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class mOt extends cv{constructor(){super(new iv(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class kI extends mp{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(sn.DEFAULT_UP),this.updateMatrix(),this.target=new sn,this.shadow=new mOt}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class gOt extends mp{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class zl{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,s=e.length;i"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=Da.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(l){Da.add(e,l),t&&t(l),r.manager.itemEnd(e)}).catch(function(l){s&&s(l),r.manager.itemError(e),r.manager.itemEnd(e)}),r.manager.itemStart(e)}}const dv="\\[\\]\\.:\\/",EOt=new RegExp("["+dv+"]","g"),uv="[^"+dv+"]",vOt="[^"+dv.replace("\\.","")+"]",yOt=/((?:WC+[\/:])*)/.source.replace("WC",uv),SOt=/(WCOD+)?/.source.replace("WCOD",vOt),TOt=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",uv),xOt=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",uv),COt=new RegExp("^"+yOt+SOt+TOt+xOt+"$"),ROt=["material","materials","bones","map"];class AOt{constructor(e,t,i){const s=i||Gt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,s)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,s=this._bindings[i];s!==void 0&&s.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=i.length;s!==r;++s)i[s].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class Gt{constructor(e,t,i){this.path=t,this.parsedPath=i||Gt.parseTrackName(t),this.node=Gt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new Gt.Composite(e,t,i):new Gt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(EOt,"")}static parseTrackName(e){const t=COt.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){const r=i.nodeName.substring(s+1);ROt.indexOf(r)!==-1&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=r)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(r){for(let o=0;o=2.0 are supported."));return}const d=new oIt(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});d.fileLoader.setRequestHeader(this.requestHeader);for(let c=0;c=0&&a[_]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+_+'".')}}d.setExtensions(o),d.setPlugins(a),d.parse(i,s)}parseAsync(e,t){const i=this;return new Promise(function(s,r){i.parse(e,t,s,r)})}}function NOt(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const It={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class OOt{constructor(e){this.parser=e,this.name=It.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,s=t.length;i=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,o)}}class HOt{constructor(e){this.parser=e,this.name=It.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,s=i.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;const o=r.extensions[t],a=s.images[o.source];let l=i.textureLoader;if(a.uri){const d=i.options.manager.getHandler(a.uri);d!==null&&(l=d)}return this.detectSupport().then(function(d){if(d)return i.loadTextureImage(e,o.source,l);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class qOt{constructor(e){this.parser=e,this.name=It.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,s=i.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;const o=r.extensions[t],a=s.images[o.source];let l=i.textureLoader;if(a.uri){const d=i.options.manager.getHandler(a.uri);d!==null&&(l=d)}return this.detectSupport().then(function(d){if(d)return i.loadTextureImage(e,o.source,l);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class YOt{constructor(e){this.name=It.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const s=i.extensions[this.name],r=this.parser.getDependency("buffer",s.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(a){const l=s.byteOffset||0,d=s.byteLength||0,c=s.count,_=s.byteStride,f=new Uint8Array(a,l,d);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(c,_,f,s.mode,s.filter).then(function(m){return m.buffer}):o.ready.then(function(){const m=new ArrayBuffer(c*_);return o.decodeGltfBuffer(new Uint8Array(m),c,_,f,s.mode,s.filter),m})})}else return null}}class $Ot{constructor(e){this.name=It.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const s=t.meshes[i.mesh];for(const d of s.primitives)if(d.mode!==fi.TRIANGLES&&d.mode!==fi.TRIANGLE_STRIP&&d.mode!==fi.TRIANGLE_FAN&&d.mode!==void 0)return null;const o=i.extensions[this.name].attributes,a=[],l={};for(const d in o)a.push(this.parser.getDependency("accessor",o[d]).then(c=>(l[d]=c,l[d])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(d=>{const c=d.pop(),_=c.isGroup?c.children:[c],f=d[0].count,m=[];for(const h of _){const E=new At,b=new be,g=new Dr,v=new be(1,1,1),y=new jNt(h.geometry,h.material,f);for(let T=0;T0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const rIt=new At;class oIt{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new NOt,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,s=!1,r=-1;typeof navigator<"u"&&(i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,s=navigator.userAgent.indexOf("Firefox")>-1,r=s?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||i||s&&r<98?this.textureLoader=new DI(this.options.manager):this.textureLoader=new bOt(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new MI(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,s=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(o){const a={scene:o[0][s.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:s.asset,parser:i,userData:{}};return qr(r,a,s),fr(a,s),Promise.all(i._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let s=0,r=t.length;s{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[d,c]of o.children.entries())r(c,a.children[d])};return r(i,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i=2&&b.setY(S,x[O*l+1]),l>=3&&b.setZ(S,x[O*l+2]),l>=4&&b.setW(S,x[O*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return b})}loadTexture(e){const t=this.json,i=this.options,r=t.textures[e].source,o=t.images[r];let a=this.textureLoader;if(o.uri){const l=i.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,i){const s=this,r=this.json,o=r.textures[e],a=r.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const d=this.loadImageSource(t,i).then(function(c){c.flipY=!1,c.name=o.name||a.name||"",c.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(c.name=a.uri);const f=(r.samplers||{})[o.sampler]||{};return c.magFilter=DR[f.magFilter]||jn,c.minFilter=DR[f.minFilter]||go,c.wrapS=kR[f.wrapS]||Ra,c.wrapT=kR[f.wrapT]||Ra,s.associations.set(c,{textures:e}),c}).catch(function(){return null});return this.textureCache[l]=d,d}loadImageSource(e,t){const i=this,s=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(_=>_.clone());const o=s.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",d=!1;if(o.bufferView!==void 0)l=i.getDependency("bufferView",o.bufferView).then(function(_){d=!0;const f=new Blob([_],{type:o.mimeType});return l=a.createObjectURL(f),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const c=Promise.resolve(l).then(function(_){return new Promise(function(f,m){let h=f;t.isImageBitmapLoader===!0&&(h=function(E){const b=new wn(E);b.needsUpdate=!0,f(b)}),t.load(zl.resolveURL(_,r.path),h,void 0,m)})}).then(function(_){return d===!0&&a.revokeObjectURL(l),_.userData.mimeType=o.mimeType||sIt(o.uri),_}).catch(function(_){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),_});return this.sourceCache[e]=c,c}assignTexture(e,t,i,s){const r=this;return this.getDependency("texture",i.index).then(function(o){if(!o)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(o=o.clone(),o.channel=i.texCoord),r.extensions[It.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[It.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=r.associations.get(o);o=r.extensions[It.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),r.associations.set(o,l)}}return s!==void 0&&(o.colorSpace=s),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const s=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new NI,Vi.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,l.sizeAttenuation=!1,this.cache.add(a,l)),i=l}else if(e.isLine){const a="LineBasicMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new wI,Vi.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,this.cache.add(a,l)),i=l}if(s||r||o){let a="ClonedMaterial:"+i.uuid+":";s&&(a+="derivative-tangents:"),r&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=i.clone(),r&&(l.vertexColors=!0),o&&(l.flatShading=!0),s&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(i))),i=l}e.material=i}getMaterialType(){return lv}loadMaterial(e){const t=this,i=this.json,s=this.extensions,r=i.materials[e];let o;const a={},l=r.extensions||{},d=[];if(l[It.KHR_MATERIALS_UNLIT]){const _=s[It.KHR_MATERIALS_UNLIT];o=_.getMaterialType(),d.push(_.extendParams(a,r,t))}else{const _=r.pbrMetallicRoughness||{};if(a.color=new gt(1,1,1),a.opacity=1,Array.isArray(_.baseColorFactor)){const f=_.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],Nn),a.opacity=f[3]}_.baseColorTexture!==void 0&&d.push(t.assignTexture(a,"map",_.baseColorTexture,rn)),a.metalness=_.metallicFactor!==void 0?_.metallicFactor:1,a.roughness=_.roughnessFactor!==void 0?_.roughnessFactor:1,_.metallicRoughnessTexture!==void 0&&(d.push(t.assignTexture(a,"metalnessMap",_.metallicRoughnessTexture)),d.push(t.assignTexture(a,"roughnessMap",_.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),d.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}r.doubleSided===!0&&(a.side=Ji);const c=r.alphaMode||vg.OPAQUE;if(c===vg.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,c===vg.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&o!==Er&&(d.push(t.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new Mt(1,1),r.normalTexture.scale!==void 0)){const _=r.normalTexture.scale;a.normalScale.set(_,_)}if(r.occlusionTexture!==void 0&&o!==Er&&(d.push(t.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&o!==Er){const _=r.emissiveFactor;a.emissive=new gt().setRGB(_[0],_[1],_[2],Nn)}return r.emissiveTexture!==void 0&&o!==Er&&d.push(t.assignTexture(a,"emissiveMap",r.emissiveTexture,rn)),Promise.all(d).then(function(){const _=new o(a);return r.name&&(_.name=r.name),fr(_,r),t.associations.set(_,{materials:e}),r.extensions&&qr(s,_,r),_})}createUniqueName(e){const t=Gt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,s=this.primitiveCache;function r(a){return i[It.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return LR(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&nIt(g,r),g.name=t.createUniqueName(r.name||"mesh_"+e),fr(g,r),b.extensions&&qr(s,g,b),t.assignFinalMaterial(g),_.push(g)}for(let m=0,h=_.length;m1?c=new io:d.length===1?c=d[0]:c=new sn,c!==d[0])for(let _=0,f=d.length;_{const _=new Map;for(const[f,m]of s.associations)(f instanceof Vi||f instanceof wn)&&_.set(f,m);return c.traverse(f=>{const m=s.associations.get(f);m!=null&&_.set(f,m)}),_};return s.associations=d(r),r})}_createAnimationTracks(e,t,i,s,r){const o=[],a=e.name?e.name:e.uuid,l=[];rr[r.path]===rr.weights?e.traverse(function(f){f.morphTargetInfluences&&l.push(f.name?f.name:f.uuid)}):l.push(a);let d;switch(rr[r.path]){case rr.weights:d=Ia;break;case rr.rotation:d=vo;break;case rr.position:case rr.scale:d=Ma;break;default:switch(i.itemSize){case 1:d=Ia;break;case 2:case 3:default:d=Ma;break}break}const c=s.interpolation!==void 0?JOt[s.interpolation]:wa,_=this._getArrayFromAccessor(i);for(let f=0,m=l.length;f{qe.replace()})},stopVideoStream(){this.isVideoActive=!1,this.imageData=null,Ze.emit("stop_webcam_video_stream"),Ve(()=>{qe.replace()})},startDrag(n){this.isDragging=!0,this.zIndex=5001,this.dragStart.x=n.clientX,this.dragStart.y=n.clientY,document.addEventListener("mousemove",this.drag),document.addEventListener("mouseup",this.stopDrag)},drag(n){if(this.isDragging){const e=n.clientX-this.dragStart.x,t=n.clientY-this.dragStart.y;this.position.bottom-=t,this.position.right-=e,this.dragStart.x=n.clientX,this.dragStart.y=n.clientY}},stopDrag(){this.isDragging=!1,this.zIndex=0,document.removeEventListener("mousemove",this.drag),document.removeEventListener("mouseup",this.stopDrag)}},mounted(){qe.replace(),Ze.on("video_stream_image",n=>{if(this.isVideoActive){this.imageDataUrl="data:image/jpeg;base64,"+n,this.frameCount++;const e=Date.now();e-this.lastFrameTime>=1e3&&(this.frameRate=this.frameCount,this.frameCount=0,this.lastFrameTime=e)}})}},cIt=["src"],dIt=["src"],uIt={class:"controls"},pIt=u("i",{"data-feather":"video"},null,-1),_It=[pIt],hIt=u("i",{"data-feather":"video"},null,-1),fIt=[hIt],mIt={key:2};function gIt(n,e,t,i,s,r){return w(),M("div",{class:"floating-frame bg-white",style:en({bottom:s.position.bottom+"px",right:s.position.right+"px","z-index":s.zIndex}),onMousedown:e[4]||(e[4]=Te((...o)=>r.startDrag&&r.startDrag(...o),["stop"])),onMouseup:e[5]||(e[5]=Te((...o)=>r.stopDrag&&r.stopDrag(...o),["stop"]))},[u("div",{class:"handle",onMousedown:e[0]||(e[0]=Te((...o)=>r.startDrag&&r.startDrag(...o),["stop"])),onMouseup:e[1]||(e[1]=Te((...o)=>r.stopDrag&&r.stopDrag(...o),["stop"]))},"Drag Me",32),s.isVideoActive&&s.imageDataUrl!=null?(w(),M("img",{key:0,src:s.imageDataUrl,alt:"Webcam Frame",width:"300",height:"300"},null,8,cIt)):q("",!0),s.isVideoActive&&s.imageDataUrl==null?(w(),M("p",{key:1,src:s.imageDataUrl,alt:"Webcam Frame",width:"300",height:"300"},"Loading. Please wait...",8,dIt)):q("",!0),u("div",uIt,[s.isVideoActive?q("",!0):(w(),M("button",{key:0,class:"bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded",onClick:e[2]||(e[2]=(...o)=>r.startVideoStream&&r.startVideoStream(...o))},_It)),s.isVideoActive?(w(),M("button",{key:1,class:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded",onClick:e[3]||(e[3]=(...o)=>r.stopVideoStream&&r.stopVideoStream(...o))},fIt)):q("",!0),s.isVideoActive?(w(),M("span",mIt,"FPS: "+fe(s.frameRate),1)):q("",!0)])],36)}const bIt=bt(lIt,[["render",gIt]]);const EIt={data(){return{isAudioActive:!1,imageDataUrl:null,isDragging:!1,position:{bottom:0,right:0},dragStart:{x:0,y:0},zIndex:0,frameRate:0,frameCount:0,lastFrameTime:Date.now()}},methods:{startAudioStream(){Ze.emit("start_audio_stream",()=>{this.isAudioActive=!0}),Ve(()=>{qe.replace()})},stopAudioStream(){Ze.emit("stop_audio_stream",()=>{this.isAudioActive=!1,this.imageDataUrl=null}),Ve(()=>{qe.replace()})},startDrag(n){this.isDragging=!0,this.zIndex=5001,this.dragStart.x=n.clientX,this.dragStart.y=n.clientY,document.addEventListener("mousemove",this.drag),document.addEventListener("mouseup",this.stopDrag)},drag(n){if(this.isDragging){const e=n.clientX-this.dragStart.x,t=n.clientY-this.dragStart.y;this.position.bottom-=t,this.position.right-=e,this.dragStart.x=n.clientX,this.dragStart.y=n.clientY}},stopDrag(){this.isDragging=!1,this.zIndex=0,document.removeEventListener("mousemove",this.drag),document.removeEventListener("mouseup",this.stopDrag)}},mounted(){qe.replace(),Ze.on("update_spectrogram",n=>{if(this.isAudioActive){this.imageDataUrl="data:image/jpeg;base64,"+n,this.frameCount++;const e=Date.now();e-this.lastFrameTime>=1e3&&(this.frameRate=this.frameCount,this.frameCount=0,this.lastFrameTime=e)}})}},vIt=["src"],yIt={class:"controls"},SIt=u("i",{"data-feather":"mic"},null,-1),TIt=[SIt],xIt=u("i",{"data-feather":"mic"},null,-1),CIt=[xIt],RIt={key:2};function AIt(n,e,t,i,s,r){return w(),M("div",{class:"floating-frame bg-white",style:en({bottom:s.position.bottom+"px",right:s.position.right+"px","z-index":s.zIndex}),onMousedown:e[4]||(e[4]=Te((...o)=>r.startDrag&&r.startDrag(...o),["stop"])),onMouseup:e[5]||(e[5]=Te((...o)=>r.stopDrag&&r.stopDrag(...o),["stop"]))},[u("div",{class:"handle",onMousedown:e[0]||(e[0]=Te((...o)=>r.startDrag&&r.startDrag(...o),["stop"])),onMouseup:e[1]||(e[1]=Te((...o)=>r.stopDrag&&r.stopDrag(...o),["stop"]))},"Drag Me",32),s.isAudioActive&&s.imageDataUrl!=null?(w(),M("img",{key:0,src:s.imageDataUrl,alt:"Spectrogram",width:"300",height:"300"},null,8,vIt)):q("",!0),u("div",yIt,[s.isAudioActive?q("",!0):(w(),M("button",{key:0,class:"bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded",onClick:e[2]||(e[2]=(...o)=>r.startAudioStream&&r.startAudioStream(...o))},TIt)),s.isAudioActive?(w(),M("button",{key:1,class:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded",onClick:e[3]||(e[3]=(...o)=>r.stopAudioStream&&r.stopAudioStream(...o))},CIt)):q("",!0),s.isAudioActive?(w(),M("span",RIt,"FPS: "+fe(s.frameRate),1)):q("",!0)])],36)}const wIt=bt(EIt,[["render",AIt]]);const NIt={data(){return{activePersonality:null}},props:{personality:{type:Object,default:()=>({})}},components:{VideoFrame:bIt,AudioFrame:wIt},computed:{isReady:{get(){return this.$store.state.ready}}},watch:{"$store.state.mountedPersArr":"updatePersonality","$store.state.config.active_personality_id":"updatePersonality"},async mounted(){for(;this.isReady===!1;)await new Promise(n=>setTimeout(n,100));console.log("Personality:",this.personality),this.initWebGLScene(),this.updatePersonality(),Ve(()=>{qe.replace()}),this.$refs.video_frame.position={bottom:0,right:0},this.$refs.audio_frame.position={bottom:0,right:100}},beforeDestroy(){},methods:{initWebGLScene(){this.scene=new VNt,this.camera=new Vn(75,window.innerWidth/window.innerHeight,.1,1e3),this.renderer=new RI,this.renderer.setSize(window.innerWidth,window.innerHeight),this.$refs.webglContainer.appendChild(this.renderer.domElement);const n=new Cr,e=new RR({color:65280});this.cube=new Hn(n,e),this.scene.add(this.cube);const t=new gOt(4210752),i=new kI(16777215,.5);i.position.set(0,1,0),this.scene.add(t),this.scene.add(i),this.camera.position.z=5,this.animate()},updatePersonality(){const{mountedPersArr:n,config:e}=this.$store.state;this.activePersonality=n[e.active_personality_id],this.activePersonality.avatar?this.showBoxWithAvatar(this.activePersonality.avatar):this.showDefaultCube(),this.$emit("update:personality",this.activePersonality)},loadScene(n){new wOt().load(n,t=>{this.scene.remove(this.cube),this.cube=t.scene,this.scene.add(this.cube)})},showBoxWithAvatar(n){this.cube&&this.scene.remove(this.cube);const e=new Cr,t=new DI().load(n),i=new Er({map:t});this.cube=new Hn(e,i),this.scene.add(this.cube)},showDefaultCube(){this.scene.remove(this.cube);const n=new Cr,e=new RR({color:65280});this.cube=new Hn(n,e),this.scene.add(this.cube)},animate(){requestAnimationFrame(this.animate),this.cube&&(this.cube.rotation.x+=.01,this.cube.rotation.y+=.01),this.renderer.render(this.scene,this.camera)}}},OIt={ref:"webglContainer"},IIt={class:"flex-col y-overflow scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},MIt={key:0,class:"text-center"},DIt={key:1,class:"text-center"},kIt={class:"floating-frame2"},LIt=["innerHTML"];function PIt(n,e,t,i,s,r){const o=ht("VideoFrame"),a=ht("AudioFrame");return w(),M($e,null,[u("div",OIt,null,512),u("div",IIt,[!s.activePersonality||!s.activePersonality.scene_path?(w(),M("div",MIt," Personality does not have a 3d avatar. ")):q("",!0),!s.activePersonality||!s.activePersonality.avatar||s.activePersonality.avatar===""?(w(),M("div",DIt," Personality does not have an avatar. ")):q("",!0),u("div",kIt,[u("div",{innerHTML:n.htmlContent},null,8,LIt)])]),Oe(o,{ref:"video_frame"},null,512),Oe(a,{ref:"audio_frame"},null,512)],64)}const UIt=bt(NIt,[["render",PIt]]);let Ad;const FIt=new Uint8Array(16);function BIt(){if(!Ad&&(Ad=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ad))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ad(FIt)}const xn=[];for(let n=0;n<256;++n)xn.push((n+256).toString(16).slice(1));function GIt(n,e=0){return xn[n[e+0]]+xn[n[e+1]]+xn[n[e+2]]+xn[n[e+3]]+"-"+xn[n[e+4]]+xn[n[e+5]]+"-"+xn[n[e+6]]+xn[n[e+7]]+"-"+xn[n[e+8]]+xn[n[e+9]]+"-"+xn[n[e+10]]+xn[n[e+11]]+xn[n[e+12]]+xn[n[e+13]]+xn[n[e+14]]+xn[n[e+15]]}const zIt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),PR={randomUUID:zIt};function Fs(n,e,t){if(PR.randomUUID&&!e&&!n)return PR.randomUUID();n=n||{};const i=n.random||(n.rng||BIt)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let s=0;s<16;++s)e[t+s]=i[s];return e}return GIt(i)}class po{constructor(){this.listenerMap=new Map,this._listeners=[],this.proxyMap=new Map,this.proxies=[]}get listeners(){return this._listeners.concat(this.proxies.flatMap(e=>e()))}subscribe(e,t){this.listenerMap.has(e)&&(console.warn(`Already subscribed. Unsubscribing for you. Please check that you don't accidentally use the same token twice to register two different handlers for the same event/hook.`),this.unsubscribe(e)),this.listenerMap.set(e,t),this._listeners.push(t)}unsubscribe(e){if(this.listenerMap.has(e)){const t=this.listenerMap.get(e);this.listenerMap.delete(e);const i=this._listeners.indexOf(t);i>=0&&this._listeners.splice(i,1)}}registerProxy(e,t){this.proxyMap.has(e)&&(console.warn(`Already subscribed. Unsubscribing for you. -Please check that you don't accidentally use the same token twice to register two different proxies for the same event/hook.`),this.unregisterProxy(e)),this.proxyMap.set(e,t),this.proxies.push(t)}unregisterProxy(e){if(!this.proxyMap.has(e))return;const t=this.proxyMap.get(e);this.proxyMap.delete(e);const i=this.proxies.indexOf(t);i>=0&&this.proxies.splice(i,1)}}class qt extends po{constructor(e){super(),this.entity=e}emit(e){this.listeners.forEach(t=>t(e,this.entity))}}class Pn extends po{constructor(e){super(),this.entity=e}emit(e){let t=!1;const i=()=>[t=!0];for(const s of Array.from(this.listeners.values()))if(s(e,i,this.entity),t)return{prevented:!0};return{prevented:!1}}}class UI extends po{execute(e,t){let i=e;for(const s of this.listeners)i=s(i,t);return i}}class li extends UI{constructor(e){super(),this.entity=e}execute(e){return super.execute(e,this.entity)}}class GIt extends po{constructor(e){super(),this.entity=e}execute(e){const t=[];for(const i of this.listeners)t.push(i(e,this.entity));return t}}function ji(){const n=Symbol(),e=new Map,t=new Set,i=(l,d)=>{d instanceof po&&d.registerProxy(n,()=>{var c,_;return(_=(c=e.get(l))===null||c===void 0?void 0:c.listeners)!==null&&_!==void 0?_:[]})},s=l=>{const d=new po;e.set(l,d),t.forEach(c=>i(l,c[l]))},r=l=>{t.add(l);for(const d of e.keys())i(d,l[d])},o=l=>{for(const d of e.keys())l[d]instanceof po&&l[d].unregisterProxy(n);t.delete(l)},a=()=>{t.forEach(l=>o(l)),e.clear()};return new Proxy({},{get(l,d){return d==="addTarget"?r:d==="removeTarget"?o:d==="destroy"?a:typeof d!="string"||d.startsWith("_")?l[d]:(e.has(d)||s(d),e.get(d))}})}class UR{constructor(e,t){if(this.destructed=!1,this.events={destruct:new qt(this)},!e||!t)throw new Error("Cannot initialize connection with null/undefined for 'from' or 'to' values");this.id=Fs(),this.from=e,this.to=t,this.from.connectionCount++,this.to.connectionCount++}destruct(){this.events.destruct.emit(),this.from.connectionCount--,this.to.connectionCount--,this.destructed=!0}}class FI{constructor(e,t){if(!e||!t)throw new Error("Cannot initialize connection with null/undefined for 'from' or 'to' values");this.id=Fs(),this.from=e,this.to=t}}function yb(n,e){return Object.fromEntries(Object.entries(n).map(([t,i])=>[t,e(i)]))}class BI{constructor(){this._title="",this.id=Fs(),this.events={loaded:new qt(this),beforeAddInput:new Pn(this),addInput:new qt(this),beforeRemoveInput:new Pn(this),removeInput:new qt(this),beforeAddOutput:new Pn(this),addOutput:new qt(this),beforeRemoveOutput:new Pn(this),removeOutput:new qt(this),beforeTitleChanged:new Pn(this),titleChanged:new qt(this),update:new qt(this)},this.hooks={beforeLoad:new li(this),afterSave:new li(this)}}get graph(){return this.graphInstance}get title(){return this._title}set title(e){this.events.beforeTitleChanged.emit(e).prevented||(this._title=e,this.events.titleChanged.emit(e))}addInput(e,t){return this.addInterface("input",e,t)}addOutput(e,t){return this.addInterface("output",e,t)}removeInput(e){return this.removeInterface("input",e)}removeOutput(e){return this.removeInterface("output",e)}registerGraph(e){this.graphInstance=e}load(e){this.hooks.beforeLoad.execute(e),this.id=e.id,this._title=e.title,Object.entries(e.inputs).forEach(([t,i])=>{this.inputs[t]&&(this.inputs[t].load(i),this.inputs[t].nodeId=this.id)}),Object.entries(e.outputs).forEach(([t,i])=>{this.outputs[t]&&(this.outputs[t].load(i),this.outputs[t].nodeId=this.id)}),this.events.loaded.emit(this)}save(){const e=yb(this.inputs,s=>s.save()),t=yb(this.outputs,s=>s.save()),i={type:this.type,id:this.id,title:this.title,inputs:e,outputs:t};return this.hooks.afterSave.execute(i)}onPlaced(){}onDestroy(){}initializeIo(){Object.entries(this.inputs).forEach(([e,t])=>this.initializeIntf("input",e,t)),Object.entries(this.outputs).forEach(([e,t])=>this.initializeIntf("output",e,t))}initializeIntf(e,t,i){i.isInput=e==="input",i.nodeId=this.id,i.events.setValue.subscribe(this,()=>this.events.update.emit({type:e,name:t,intf:i}))}addInterface(e,t,i){const s=e==="input"?this.events.beforeAddInput:this.events.beforeAddOutput,r=e==="input"?this.events.addInput:this.events.addOutput,o=e==="input"?this.inputs:this.outputs;return s.emit(i).prevented?!1:(o[t]=i,this.initializeIntf(e,t,i),r.emit(i),!0)}removeInterface(e,t){const i=e==="input"?this.events.beforeRemoveInput:this.events.beforeRemoveOutput,s=e==="input"?this.events.removeInput:this.events.removeOutput,r=e==="input"?this.inputs[t]:this.outputs[t];if(!r||i.emit(r).prevented)return!1;if(r.connectionCount>0)if(this.graphInstance)this.graphInstance.connections.filter(a=>a.from===r||a.to===r).forEach(a=>{this.graphInstance.removeConnection(a)});else throw new Error("Interface is connected, but no graph instance is specified. Unable to delete interface");return r.events.setValue.unsubscribe(this),e==="input"?delete this.inputs[t]:delete this.outputs[t],s.emit(r),!0}}let GI=class extends BI{load(e){super.load(e)}save(){return super.save()}};function el(n){return class extends GI{constructor(){var e,t;super(),this.type=n.type,this.inputs={},this.outputs={},this.calculate=n.calculate?(i,s)=>n.calculate.call(this,i,s):void 0,this._title=(e=n.title)!==null&&e!==void 0?e:n.type,this.executeFactory("input",n.inputs),this.executeFactory("output",n.outputs),(t=n.onCreate)===null||t===void 0||t.call(this)}onPlaced(){var e;(e=n.onPlaced)===null||e===void 0||e.call(this)}onDestroy(){var e;(e=n.onDestroy)===null||e===void 0||e.call(this)}executeFactory(e,t){Object.keys(t||{}).forEach(i=>{const s=t[i]();e==="input"?this.addInput(i,s):this.addOutput(i,s)})}}}class tn{set connectionCount(e){this._connectionCount=e,this.events.setConnectionCount.emit(e)}get connectionCount(){return this._connectionCount}set value(e){this.events.beforeSetValue.emit(e).prevented||(this._value=e,this.events.setValue.emit(e))}get value(){return this._value}constructor(e,t){this.id=Fs(),this.nodeId="",this.port=!0,this.hidden=!1,this.events={setConnectionCount:new qt(this),beforeSetValue:new Pn(this),setValue:new qt(this),updated:new qt(this)},this.hooks={load:new li(this),save:new li(this)},this._connectionCount=0,this.name=e,this._value=t}load(e){this.id=e.id,this.templateId=e.templateId,this.value=e.value,this.hooks.load.execute(e)}save(){const e={id:this.id,templateId:this.templateId,value:this.value};return this.hooks.save.execute(e)}setComponent(e){return this.component=e,this}setPort(e){return this.port=e,this}setHidden(e){return this.hidden=e,this}use(e,...t){return e(this,...t),this}}const ka="__baklava_SubgraphInputNode",La="__baklava_SubgraphOutputNode";class zI extends GI{constructor(){super(),this.graphInterfaceId=Fs()}onPlaced(){super.onPlaced(),this.initializeIo()}save(){return{...super.save(),graphInterfaceId:this.graphInterfaceId}}load(e){super.load(e),this.graphInterfaceId=e.graphInterfaceId}}class VI extends zI{constructor(){super(...arguments),this.type=ka,this.inputs={name:new tn("Name","Input")},this.outputs={placeholder:new tn("Value",void 0)}}static isGraphInputNode(e){return e.type===ka}}class HI extends zI{constructor(){super(...arguments),this.type=La,this.inputs={name:new tn("Name","Output"),placeholder:new tn("Value",void 0)},this.outputs={output:new tn("Output",void 0).setHidden(!0)},this.calculate=({placeholder:e})=>({output:e})}static isGraphOutputNode(e){return e.type===La}}class Cc{get nodes(){return this._nodes}get connections(){return this._connections}get loading(){return this._loading}get destroying(){return this._destroying}get inputs(){return this.nodes.filter(t=>t.type===ka).map(t=>({id:t.graphInterfaceId,name:t.inputs.name.value,nodeId:t.id,nodeInterfaceId:t.outputs.placeholder.id}))}get outputs(){return this.nodes.filter(t=>t.type===La).map(t=>({id:t.graphInterfaceId,name:t.inputs.name.value,nodeId:t.id,nodeInterfaceId:t.outputs.output.id}))}constructor(e,t){this.id=Fs(),this.activeTransactions=0,this._nodes=[],this._connections=[],this._loading=!1,this._destroying=!1,this.events={beforeAddNode:new Pn(this),addNode:new qt(this),beforeRemoveNode:new Pn(this),removeNode:new qt(this),beforeAddConnection:new Pn(this),addConnection:new qt(this),checkConnection:new Pn(this),beforeRemoveConnection:new Pn(this),removeConnection:new qt(this)},this.hooks={save:new li(this),load:new li(this),checkConnection:new GIt(this)},this.nodeEvents=ji(),this.nodeHooks=ji(),this.connectionEvents=ji(),this.editor=e,this.template=t,e.registerGraph(this)}addNode(e){if(!this.events.beforeAddNode.emit(e).prevented)return this.nodeEvents.addTarget(e.events),this.nodeHooks.addTarget(e.hooks),e.registerGraph(this),this._nodes.push(e),e=this.nodes.find(t=>t.id===e.id),e.onPlaced(),this.events.addNode.emit(e),e}removeNode(e){if(this.nodes.includes(e)){if(this.events.beforeRemoveNode.emit(e).prevented)return;const t=[...Object.values(e.inputs),...Object.values(e.outputs)];this.connections.filter(i=>t.includes(i.from)||t.includes(i.to)).forEach(i=>this.removeConnection(i)),this._nodes.splice(this.nodes.indexOf(e),1),this.events.removeNode.emit(e),e.onDestroy(),this.nodeEvents.removeTarget(e.events),this.nodeHooks.removeTarget(e.hooks)}}addConnection(e,t){const i=this.checkConnection(e,t);if(!i.connectionAllowed||this.events.beforeAddConnection.emit({from:e,to:t}).prevented)return;for(const r of i.connectionsInDanger){const o=this.connections.find(a=>a.id===r.id);o&&this.removeConnection(o)}const s=new UR(i.dummyConnection.from,i.dummyConnection.to);return this.internalAddConnection(s),s}removeConnection(e){if(this.connections.includes(e)){if(this.events.beforeRemoveConnection.emit(e).prevented)return;e.destruct(),this._connections.splice(this.connections.indexOf(e),1),this.events.removeConnection.emit(e),this.connectionEvents.removeTarget(e.events)}}checkConnection(e,t){if(!e||!t)return{connectionAllowed:!1};const i=this.findNodeById(e.nodeId),s=this.findNodeById(t.nodeId);if(i&&s&&i===s)return{connectionAllowed:!1};if(e.isInput&&!t.isInput){const a=e;e=t,t=a}if(e.isInput||!t.isInput)return{connectionAllowed:!1};if(this.connections.some(a=>a.from===e&&a.to===t))return{connectionAllowed:!1};if(this.events.checkConnection.emit({from:e,to:t}).prevented)return{connectionAllowed:!1};const r=this.hooks.checkConnection.execute({from:e,to:t});if(r.some(a=>!a.connectionAllowed))return{connectionAllowed:!1};const o=Array.from(new Set(r.flatMap(a=>a.connectionsInDanger)));return{connectionAllowed:!0,dummyConnection:new FI(e,t),connectionsInDanger:o}}findNodeInterface(e){for(const t of this.nodes){for(const i in t.inputs){const s=t.inputs[i];if(s.id===e)return s}for(const i in t.outputs){const s=t.outputs[i];if(s.id===e)return s}}}findNodeById(e){return this.nodes.find(t=>t.id===e)}load(e){try{this._loading=!0;const t=[];for(let i=this.connections.length-1;i>=0;i--)this.removeConnection(this.connections[i]);for(let i=this.nodes.length-1;i>=0;i--)this.removeNode(this.nodes[i]);this.id=e.id;for(const i of e.nodes){const s=this.editor.nodeTypes.get(i.type);if(!s){t.push(`Node type ${i.type} is not registered`);continue}const r=new s.type;this.addNode(r),r.load(i)}for(const i of e.connections){const s=this.findNodeInterface(i.from),r=this.findNodeInterface(i.to);if(s)if(r){const o=new UR(s,r);o.id=i.id,this.internalAddConnection(o)}else{t.push(`Could not find interface with id ${i.to}`);continue}else{t.push(`Could not find interface with id ${i.from}`);continue}}return this.hooks.load.execute(e),t}finally{this._loading=!1}}save(){const e={id:this.id,nodes:this.nodes.map(t=>t.save()),connections:this.connections.map(t=>({id:t.id,from:t.from.id,to:t.to.id})),inputs:this.inputs,outputs:this.outputs};return this.hooks.save.execute(e)}destroy(){this._destroying=!0;for(const e of this.nodes)this.removeNode(e);this.editor.unregisterGraph(this)}internalAddConnection(e){this.connectionEvents.addTarget(e.events),this._connections.push(e),this.events.addConnection.emit(e)}}const cc="__baklava_GraphNode-";function Pa(n){return cc+n.id}function zIt(n){return class extends BI{constructor(){super(...arguments),this.type=Pa(n),this.inputs={},this.outputs={},this.template=n,this.calculate=async(t,i)=>{var s;if(!this.subgraph)throw new Error(`GraphNode ${this.id}: calculate called without subgraph being initialized`);if(!i.engine||typeof i.engine!="object")throw new Error(`GraphNode ${this.id}: calculate called but no engine provided in context`);const r=i.engine.getInputValues(this.subgraph);for(const l of this.subgraph.inputs)r.set(l.nodeInterfaceId,t[l.id]);const o=await i.engine.runGraph(this.subgraph,r,i.globalValues),a={};for(const l of this.subgraph.outputs)a[l.id]=(s=o.get(l.nodeId))===null||s===void 0?void 0:s.get("output");return a._calculationResults=o,a}}get title(){return this._title}set title(t){this.template.name=t}load(t){if(!this.subgraph)throw new Error("Cannot load a graph node without a graph");if(!this.template)throw new Error("Unable to load graph node without graph template");this.subgraph.load(t.graphState),super.load(t)}save(){if(!this.subgraph)throw new Error("Cannot save a graph node without a graph");return{...super.save(),graphState:this.subgraph.save()}}onPlaced(){this.template.events.updated.subscribe(this,()=>this.initialize()),this.template.events.nameChanged.subscribe(this,t=>{this._title=t}),this.initialize()}onDestroy(){var t;this.template.events.updated.unsubscribe(this),this.template.events.nameChanged.unsubscribe(this),(t=this.subgraph)===null||t===void 0||t.destroy()}initialize(){this.subgraph&&this.subgraph.destroy(),this.subgraph=this.template.createGraph(),this._title=this.template.name,this.updateInterfaces(),this.events.update.emit(null)}updateInterfaces(){if(!this.subgraph)throw new Error("Trying to update interfaces without graph instance");for(const t of this.subgraph.inputs)t.id in this.inputs?this.inputs[t.id].name=t.name:this.addInput(t.id,new tn(t.name,void 0));for(const t of Object.keys(this.inputs))this.subgraph.inputs.some(i=>i.id===t)||this.removeInput(t);for(const t of this.subgraph.outputs)t.id in this.outputs?this.outputs[t.id].name=t.name:this.addOutput(t.id,new tn(t.name,void 0));for(const t of Object.keys(this.outputs))this.subgraph.outputs.some(i=>i.id===t)||this.removeOutput(t);this.addOutput("_calculationResults",new tn("_calculationResults",void 0).setHidden(!0))}}}class gp{static fromGraph(e,t){return new gp(e.save(),t)}get name(){return this._name}set name(e){this._name=e,this.events.nameChanged.emit(e);const t=this.editor.nodeTypes.get(Pa(this));t&&(t.title=e)}get inputs(){return this.nodes.filter(t=>t.type===ka).map(t=>({id:t.graphInterfaceId,name:t.inputs.name.value,nodeId:t.id,nodeInterfaceId:t.outputs.placeholder.id}))}get outputs(){return this.nodes.filter(t=>t.type===La).map(t=>({id:t.graphInterfaceId,name:t.inputs.name.value,nodeId:t.id,nodeInterfaceId:t.outputs.output.id}))}constructor(e,t){this.id=Fs(),this._name="Subgraph",this.events={nameChanged:new qt(this),updated:new qt(this)},this.hooks={beforeLoad:new li(this),afterSave:new li(this)},this.editor=t,e.id&&(this.id=e.id),e.name&&(this._name=e.name),this.update(e)}update(e){this.nodes=e.nodes,this.connections=e.connections,this.events.updated.emit()}save(){return{id:this.id,name:this.name,nodes:this.nodes,connections:this.connections,inputs:this.inputs,outputs:this.outputs}}createGraph(e){const t=new Map,i=f=>{const m=Fs();return t.set(f,m),m},s=f=>{const m=t.get(f);if(!m)throw new Error(`Unable to create graph from template: Could not map old id ${f} to new id`);return m},r=f=>yb(f,m=>({id:i(m.id),templateId:m.id,value:m.value})),o=this.nodes.map(f=>({...f,id:i(f.id),inputs:r(f.inputs),outputs:r(f.outputs)})),a=this.connections.map(f=>({id:i(f.id),from:s(f.from),to:s(f.to)})),l=this.inputs.map(f=>({id:f.id,name:f.name,nodeId:s(f.nodeId),nodeInterfaceId:s(f.nodeInterfaceId)})),d=this.outputs.map(f=>({id:f.id,name:f.name,nodeId:s(f.nodeId),nodeInterfaceId:s(f.nodeInterfaceId)})),c={id:Fs(),nodes:o,connections:a,inputs:l,outputs:d};return e||(e=new Cc(this.editor)),e.load(c).forEach(f=>console.warn(f)),e.template=this,e}}class VIt{get nodeTypes(){return this._nodeTypes}get graph(){return this._graph}get graphTemplates(){return this._graphTemplates}get graphs(){return this._graphs}get loading(){return this._loading}constructor(){this.events={loaded:new qt(this),beforeRegisterNodeType:new Pn(this),registerNodeType:new qt(this),beforeUnregisterNodeType:new Pn(this),unregisterNodeType:new qt(this),beforeAddGraphTemplate:new Pn(this),addGraphTemplate:new qt(this),beforeRemoveGraphTemplate:new Pn(this),removeGraphTemplate:new qt(this),registerGraph:new qt(this),unregisterGraph:new qt(this)},this.hooks={save:new li(this),load:new li(this)},this.graphTemplateEvents=ji(),this.graphTemplateHooks=ji(),this.graphEvents=ji(),this.graphHooks=ji(),this.nodeEvents=ji(),this.nodeHooks=ji(),this.connectionEvents=ji(),this._graphs=new Set,this._nodeTypes=new Map,this._graph=new Cc(this),this._graphTemplates=[],this._loading=!1,this.registerNodeType(VI),this.registerNodeType(HI)}registerNodeType(e,t){var i,s;if(this.events.beforeRegisterNodeType.emit({type:e,options:t}).prevented)return;const r=new e;this._nodeTypes.set(r.type,{type:e,category:(i=t==null?void 0:t.category)!==null&&i!==void 0?i:"default",title:(s=t==null?void 0:t.title)!==null&&s!==void 0?s:r.title}),this.events.registerNodeType.emit({type:e,options:t})}unregisterNodeType(e){const t=typeof e=="string"?e:new e().type;if(this.nodeTypes.has(t)){if(this.events.beforeUnregisterNodeType.emit(t).prevented)return;this._nodeTypes.delete(t),this.events.unregisterNodeType.emit(t)}}addGraphTemplate(e){if(this.events.beforeAddGraphTemplate.emit(e).prevented)return;this._graphTemplates.push(e),this.graphTemplateEvents.addTarget(e.events),this.graphTemplateHooks.addTarget(e.hooks);const t=zIt(e);this.registerNodeType(t,{category:"Subgraphs",title:e.name}),this.events.addGraphTemplate.emit(e)}removeGraphTemplate(e){if(this.graphTemplates.includes(e)){if(this.events.beforeRemoveGraphTemplate.emit(e).prevented)return;const t=Pa(e);for(const i of[this.graph,...this.graphs.values()]){const s=i.nodes.filter(r=>r.type===t);for(const r of s)i.removeNode(r)}this.unregisterNodeType(t),this._graphTemplates.splice(this._graphTemplates.indexOf(e),1),this.graphTemplateEvents.removeTarget(e.events),this.graphTemplateHooks.removeTarget(e.hooks),this.events.removeGraphTemplate.emit(e)}}registerGraph(e){this.graphEvents.addTarget(e.events),this.graphHooks.addTarget(e.hooks),this.nodeEvents.addTarget(e.nodeEvents),this.nodeHooks.addTarget(e.nodeHooks),this.connectionEvents.addTarget(e.connectionEvents),this.events.registerGraph.emit(e),this._graphs.add(e)}unregisterGraph(e){this.graphEvents.removeTarget(e.events),this.graphHooks.removeTarget(e.hooks),this.nodeEvents.removeTarget(e.nodeEvents),this.nodeHooks.removeTarget(e.nodeHooks),this.connectionEvents.removeTarget(e.connectionEvents),this.events.unregisterGraph.emit(e),this._graphs.delete(e)}load(e){try{this._loading=!0,e=this.hooks.load.execute(e),e.graphTemplates.forEach(i=>{const s=new gp(i,this);this.addGraphTemplate(s)});const t=this._graph.load(e.graph);return this.events.loaded.emit(),t.forEach(i=>console.warn(i)),t}finally{this._loading=!1}}save(){const e={graph:this.graph.save(),graphTemplates:this.graphTemplates.map(t=>t.save())};return this.hooks.save.execute(e)}}function HIt(n,e){const t=new Map;e.graphs.forEach(i=>{i.nodes.forEach(s=>t.set(s.id,s))}),n.forEach((i,s)=>{const r=t.get(s);r&&i.forEach((o,a)=>{const l=r.outputs[a];l&&(l.value=o)})})}class qI extends Error{constructor(){super("Cycle detected")}}function qIt(n){return typeof n=="string"}function YI(n,e){const t=new Map,i=new Map,s=new Map;let r,o;if(n instanceof Cc)r=n.nodes,o=n.connections;else{if(!e)throw new Error("Invalid argument value: expected array of connections");r=n,o=e}r.forEach(d=>{Object.values(d.inputs).forEach(c=>t.set(c.id,d.id)),Object.values(d.outputs).forEach(c=>t.set(c.id,d.id))}),r.forEach(d=>{const c=o.filter(f=>f.from&&t.get(f.from.id)===d.id),_=new Set(c.map(f=>t.get(f.to.id)).filter(qIt));i.set(d.id,_),s.set(d,c)});const a=r.slice();o.forEach(d=>{const c=a.findIndex(_=>t.get(d.to.id)===_.id);c>=0&&a.splice(c,1)});const l=[];for(;a.length>0;){const d=a.pop();l.push(d);const c=i.get(d.id);for(;c.size>0;){const _=c.values().next().value;if(c.delete(_),Array.from(i.values()).every(f=>!f.has(_))){const f=r.find(m=>m.id===_);a.push(f)}}}if(Array.from(i.values()).some(d=>d.size>0))throw new qI;return{calculationOrder:l,connectionsFromNode:s,interfaceIdToNodeId:t}}function YIt(n,e){try{return YI(n,e),!1}catch(t){if(t instanceof qI)return!0;throw t}}var Kn;(function(n){n.Running="Running",n.Idle="Idle",n.Paused="Paused",n.Stopped="Stopped"})(Kn||(Kn={}));class $It{get status(){return this.isRunning?Kn.Running:this.internalStatus}constructor(e){this.editor=e,this.events={beforeRun:new Pn(this),afterRun:new qt(this),statusChange:new qt(this),beforeNodeCalculation:new qt(this),afterNodeCalculation:new qt(this)},this.hooks={gatherCalculationData:new li(this),transferData:new UI},this.recalculateOrder=!0,this.internalStatus=Kn.Stopped,this.isRunning=!1,this.editor.nodeEvents.update.subscribe(this,(t,i)=>{i.graph&&!i.graph.loading&&i.graph.activeTransactions===0&&this.internalOnChange(i,t??void 0)}),this.editor.graphEvents.addNode.subscribe(this,(t,i)=>{this.recalculateOrder=!0,!i.loading&&i.activeTransactions===0&&this.internalOnChange()}),this.editor.graphEvents.removeNode.subscribe(this,(t,i)=>{this.recalculateOrder=!0,!i.loading&&i.activeTransactions===0&&this.internalOnChange()}),this.editor.graphEvents.addConnection.subscribe(this,(t,i)=>{this.recalculateOrder=!0,!i.loading&&i.activeTransactions===0&&this.internalOnChange()}),this.editor.graphEvents.removeConnection.subscribe(this,(t,i)=>{this.recalculateOrder=!0,!i.loading&&i.activeTransactions===0&&this.internalOnChange()}),this.editor.graphHooks.checkConnection.subscribe(this,t=>this.checkConnection(t.from,t.to))}start(){this.internalStatus===Kn.Stopped&&(this.internalStatus=Kn.Idle,this.events.statusChange.emit(this.status))}pause(){this.internalStatus===Kn.Idle&&(this.internalStatus=Kn.Paused,this.events.statusChange.emit(this.status))}resume(){this.internalStatus===Kn.Paused&&(this.internalStatus=Kn.Idle,this.events.statusChange.emit(this.status))}stop(){(this.internalStatus===Kn.Idle||this.internalStatus===Kn.Paused)&&(this.internalStatus=Kn.Stopped,this.events.statusChange.emit(this.status))}async runOnce(e,...t){if(this.events.beforeRun.emit(e).prevented)return null;try{this.isRunning=!0,this.events.statusChange.emit(this.status),this.recalculateOrder&&this.calculateOrder();const i=await this.execute(e,...t);return this.events.afterRun.emit(i),i}finally{this.isRunning=!1,this.events.statusChange.emit(this.status)}}checkConnection(e,t){if(e.templateId){const r=this.findInterfaceByTemplateId(this.editor.graph.nodes,e.templateId);if(!r)return{connectionAllowed:!0,connectionsInDanger:[]};e=r}if(t.templateId){const r=this.findInterfaceByTemplateId(this.editor.graph.nodes,t.templateId);if(!r)return{connectionAllowed:!0,connectionsInDanger:[]};t=r}const i=new FI(e,t);let s=this.editor.graph.connections.slice();return t.allowMultipleConnections||(s=s.filter(r=>r.to!==t)),s.push(i),YIt(this.editor.graph.nodes,s)?{connectionAllowed:!1,connectionsInDanger:[]}:{connectionAllowed:!0,connectionsInDanger:t.allowMultipleConnections?[]:this.editor.graph.connections.filter(r=>r.to===t)}}calculateOrder(){this.recalculateOrder=!0}async calculateWithoutData(...e){const t=this.hooks.gatherCalculationData.execute(void 0);return await this.runOnce(t,...e)}validateNodeCalculationOutput(e,t){if(typeof t!="object")throw new Error(`Invalid calculation return value from node ${e.id} (type ${e.type})`);Object.keys(e.outputs).forEach(i=>{if(!(i in t))throw new Error(`Calculation return value from node ${e.id} (type ${e.type}) is missing key "${i}"`)})}internalOnChange(e,t){this.internalStatus===Kn.Idle&&this.onChange(this.recalculateOrder,e,t)}findInterfaceByTemplateId(e,t){for(const i of e)for(const s of[...Object.values(i.inputs),...Object.values(i.outputs)])if(s.templateId===t)return s;return null}}class WIt extends $It{constructor(e){super(e),this.order=new Map}start(){super.start(),this.recalculateOrder=!0,this.calculateWithoutData()}async runGraph(e,t,i){this.order.has(e.id)||this.order.set(e.id,YI(e));const{calculationOrder:s,connectionsFromNode:r}=this.order.get(e.id),o=new Map;for(const a of s){const l={};Object.entries(a.inputs).forEach(([c,_])=>{l[c]=this.getInterfaceValue(t,_.id)}),this.events.beforeNodeCalculation.emit({inputValues:l,node:a});let d;if(a.calculate)d=await a.calculate(l,{globalValues:i,engine:this});else{d={};for(const[c,_]of Object.entries(a.outputs))d[c]=this.getInterfaceValue(t,_.id)}this.validateNodeCalculationOutput(a,d),this.events.afterNodeCalculation.emit({outputValues:d,node:a}),o.set(a.id,new Map(Object.entries(d))),r.has(a)&&r.get(a).forEach(c=>{var _;const f=(_=Object.entries(a.outputs).find(([,h])=>h.id===c.from.id))===null||_===void 0?void 0:_[0];if(!f)throw new Error(`Could not find key for interface ${c.from.id} +Please check that you don't accidentally use the same token twice to register two different proxies for the same event/hook.`),this.unregisterProxy(e)),this.proxyMap.set(e,t),this.proxies.push(t)}unregisterProxy(e){if(!this.proxyMap.has(e))return;const t=this.proxyMap.get(e);this.proxyMap.delete(e);const i=this.proxies.indexOf(t);i>=0&&this.proxies.splice(i,1)}}class qt extends po{constructor(e){super(),this.entity=e}emit(e){this.listeners.forEach(t=>t(e,this.entity))}}class Pn extends po{constructor(e){super(),this.entity=e}emit(e){let t=!1;const i=()=>[t=!0];for(const s of Array.from(this.listeners.values()))if(s(e,i,this.entity),t)return{prevented:!0};return{prevented:!1}}}class UI extends po{execute(e,t){let i=e;for(const s of this.listeners)i=s(i,t);return i}}class li extends UI{constructor(e){super(),this.entity=e}execute(e){return super.execute(e,this.entity)}}class VIt extends po{constructor(e){super(),this.entity=e}execute(e){const t=[];for(const i of this.listeners)t.push(i(e,this.entity));return t}}function ji(){const n=Symbol(),e=new Map,t=new Set,i=(l,d)=>{d instanceof po&&d.registerProxy(n,()=>{var c,_;return(_=(c=e.get(l))===null||c===void 0?void 0:c.listeners)!==null&&_!==void 0?_:[]})},s=l=>{const d=new po;e.set(l,d),t.forEach(c=>i(l,c[l]))},r=l=>{t.add(l);for(const d of e.keys())i(d,l[d])},o=l=>{for(const d of e.keys())l[d]instanceof po&&l[d].unregisterProxy(n);t.delete(l)},a=()=>{t.forEach(l=>o(l)),e.clear()};return new Proxy({},{get(l,d){return d==="addTarget"?r:d==="removeTarget"?o:d==="destroy"?a:typeof d!="string"||d.startsWith("_")?l[d]:(e.has(d)||s(d),e.get(d))}})}class UR{constructor(e,t){if(this.destructed=!1,this.events={destruct:new qt(this)},!e||!t)throw new Error("Cannot initialize connection with null/undefined for 'from' or 'to' values");this.id=Fs(),this.from=e,this.to=t,this.from.connectionCount++,this.to.connectionCount++}destruct(){this.events.destruct.emit(),this.from.connectionCount--,this.to.connectionCount--,this.destructed=!0}}class FI{constructor(e,t){if(!e||!t)throw new Error("Cannot initialize connection with null/undefined for 'from' or 'to' values");this.id=Fs(),this.from=e,this.to=t}}function yb(n,e){return Object.fromEntries(Object.entries(n).map(([t,i])=>[t,e(i)]))}class BI{constructor(){this._title="",this.id=Fs(),this.events={loaded:new qt(this),beforeAddInput:new Pn(this),addInput:new qt(this),beforeRemoveInput:new Pn(this),removeInput:new qt(this),beforeAddOutput:new Pn(this),addOutput:new qt(this),beforeRemoveOutput:new Pn(this),removeOutput:new qt(this),beforeTitleChanged:new Pn(this),titleChanged:new qt(this),update:new qt(this)},this.hooks={beforeLoad:new li(this),afterSave:new li(this)}}get graph(){return this.graphInstance}get title(){return this._title}set title(e){this.events.beforeTitleChanged.emit(e).prevented||(this._title=e,this.events.titleChanged.emit(e))}addInput(e,t){return this.addInterface("input",e,t)}addOutput(e,t){return this.addInterface("output",e,t)}removeInput(e){return this.removeInterface("input",e)}removeOutput(e){return this.removeInterface("output",e)}registerGraph(e){this.graphInstance=e}load(e){this.hooks.beforeLoad.execute(e),this.id=e.id,this._title=e.title,Object.entries(e.inputs).forEach(([t,i])=>{this.inputs[t]&&(this.inputs[t].load(i),this.inputs[t].nodeId=this.id)}),Object.entries(e.outputs).forEach(([t,i])=>{this.outputs[t]&&(this.outputs[t].load(i),this.outputs[t].nodeId=this.id)}),this.events.loaded.emit(this)}save(){const e=yb(this.inputs,s=>s.save()),t=yb(this.outputs,s=>s.save()),i={type:this.type,id:this.id,title:this.title,inputs:e,outputs:t};return this.hooks.afterSave.execute(i)}onPlaced(){}onDestroy(){}initializeIo(){Object.entries(this.inputs).forEach(([e,t])=>this.initializeIntf("input",e,t)),Object.entries(this.outputs).forEach(([e,t])=>this.initializeIntf("output",e,t))}initializeIntf(e,t,i){i.isInput=e==="input",i.nodeId=this.id,i.events.setValue.subscribe(this,()=>this.events.update.emit({type:e,name:t,intf:i}))}addInterface(e,t,i){const s=e==="input"?this.events.beforeAddInput:this.events.beforeAddOutput,r=e==="input"?this.events.addInput:this.events.addOutput,o=e==="input"?this.inputs:this.outputs;return s.emit(i).prevented?!1:(o[t]=i,this.initializeIntf(e,t,i),r.emit(i),!0)}removeInterface(e,t){const i=e==="input"?this.events.beforeRemoveInput:this.events.beforeRemoveOutput,s=e==="input"?this.events.removeInput:this.events.removeOutput,r=e==="input"?this.inputs[t]:this.outputs[t];if(!r||i.emit(r).prevented)return!1;if(r.connectionCount>0)if(this.graphInstance)this.graphInstance.connections.filter(a=>a.from===r||a.to===r).forEach(a=>{this.graphInstance.removeConnection(a)});else throw new Error("Interface is connected, but no graph instance is specified. Unable to delete interface");return r.events.setValue.unsubscribe(this),e==="input"?delete this.inputs[t]:delete this.outputs[t],s.emit(r),!0}}let GI=class extends BI{load(e){super.load(e)}save(){return super.save()}};function el(n){return class extends GI{constructor(){var e,t;super(),this.type=n.type,this.inputs={},this.outputs={},this.calculate=n.calculate?(i,s)=>n.calculate.call(this,i,s):void 0,this._title=(e=n.title)!==null&&e!==void 0?e:n.type,this.executeFactory("input",n.inputs),this.executeFactory("output",n.outputs),(t=n.onCreate)===null||t===void 0||t.call(this)}onPlaced(){var e;(e=n.onPlaced)===null||e===void 0||e.call(this)}onDestroy(){var e;(e=n.onDestroy)===null||e===void 0||e.call(this)}executeFactory(e,t){Object.keys(t||{}).forEach(i=>{const s=t[i]();e==="input"?this.addInput(i,s):this.addOutput(i,s)})}}}class tn{set connectionCount(e){this._connectionCount=e,this.events.setConnectionCount.emit(e)}get connectionCount(){return this._connectionCount}set value(e){this.events.beforeSetValue.emit(e).prevented||(this._value=e,this.events.setValue.emit(e))}get value(){return this._value}constructor(e,t){this.id=Fs(),this.nodeId="",this.port=!0,this.hidden=!1,this.events={setConnectionCount:new qt(this),beforeSetValue:new Pn(this),setValue:new qt(this),updated:new qt(this)},this.hooks={load:new li(this),save:new li(this)},this._connectionCount=0,this.name=e,this._value=t}load(e){this.id=e.id,this.templateId=e.templateId,this.value=e.value,this.hooks.load.execute(e)}save(){const e={id:this.id,templateId:this.templateId,value:this.value};return this.hooks.save.execute(e)}setComponent(e){return this.component=e,this}setPort(e){return this.port=e,this}setHidden(e){return this.hidden=e,this}use(e,...t){return e(this,...t),this}}const ka="__baklava_SubgraphInputNode",La="__baklava_SubgraphOutputNode";class zI extends GI{constructor(){super(),this.graphInterfaceId=Fs()}onPlaced(){super.onPlaced(),this.initializeIo()}save(){return{...super.save(),graphInterfaceId:this.graphInterfaceId}}load(e){super.load(e),this.graphInterfaceId=e.graphInterfaceId}}class VI extends zI{constructor(){super(...arguments),this.type=ka,this.inputs={name:new tn("Name","Input")},this.outputs={placeholder:new tn("Value",void 0)}}static isGraphInputNode(e){return e.type===ka}}class HI extends zI{constructor(){super(...arguments),this.type=La,this.inputs={name:new tn("Name","Output"),placeholder:new tn("Value",void 0)},this.outputs={output:new tn("Output",void 0).setHidden(!0)},this.calculate=({placeholder:e})=>({output:e})}static isGraphOutputNode(e){return e.type===La}}class Cc{get nodes(){return this._nodes}get connections(){return this._connections}get loading(){return this._loading}get destroying(){return this._destroying}get inputs(){return this.nodes.filter(t=>t.type===ka).map(t=>({id:t.graphInterfaceId,name:t.inputs.name.value,nodeId:t.id,nodeInterfaceId:t.outputs.placeholder.id}))}get outputs(){return this.nodes.filter(t=>t.type===La).map(t=>({id:t.graphInterfaceId,name:t.inputs.name.value,nodeId:t.id,nodeInterfaceId:t.outputs.output.id}))}constructor(e,t){this.id=Fs(),this.activeTransactions=0,this._nodes=[],this._connections=[],this._loading=!1,this._destroying=!1,this.events={beforeAddNode:new Pn(this),addNode:new qt(this),beforeRemoveNode:new Pn(this),removeNode:new qt(this),beforeAddConnection:new Pn(this),addConnection:new qt(this),checkConnection:new Pn(this),beforeRemoveConnection:new Pn(this),removeConnection:new qt(this)},this.hooks={save:new li(this),load:new li(this),checkConnection:new VIt(this)},this.nodeEvents=ji(),this.nodeHooks=ji(),this.connectionEvents=ji(),this.editor=e,this.template=t,e.registerGraph(this)}addNode(e){if(!this.events.beforeAddNode.emit(e).prevented)return this.nodeEvents.addTarget(e.events),this.nodeHooks.addTarget(e.hooks),e.registerGraph(this),this._nodes.push(e),e=this.nodes.find(t=>t.id===e.id),e.onPlaced(),this.events.addNode.emit(e),e}removeNode(e){if(this.nodes.includes(e)){if(this.events.beforeRemoveNode.emit(e).prevented)return;const t=[...Object.values(e.inputs),...Object.values(e.outputs)];this.connections.filter(i=>t.includes(i.from)||t.includes(i.to)).forEach(i=>this.removeConnection(i)),this._nodes.splice(this.nodes.indexOf(e),1),this.events.removeNode.emit(e),e.onDestroy(),this.nodeEvents.removeTarget(e.events),this.nodeHooks.removeTarget(e.hooks)}}addConnection(e,t){const i=this.checkConnection(e,t);if(!i.connectionAllowed||this.events.beforeAddConnection.emit({from:e,to:t}).prevented)return;for(const r of i.connectionsInDanger){const o=this.connections.find(a=>a.id===r.id);o&&this.removeConnection(o)}const s=new UR(i.dummyConnection.from,i.dummyConnection.to);return this.internalAddConnection(s),s}removeConnection(e){if(this.connections.includes(e)){if(this.events.beforeRemoveConnection.emit(e).prevented)return;e.destruct(),this._connections.splice(this.connections.indexOf(e),1),this.events.removeConnection.emit(e),this.connectionEvents.removeTarget(e.events)}}checkConnection(e,t){if(!e||!t)return{connectionAllowed:!1};const i=this.findNodeById(e.nodeId),s=this.findNodeById(t.nodeId);if(i&&s&&i===s)return{connectionAllowed:!1};if(e.isInput&&!t.isInput){const a=e;e=t,t=a}if(e.isInput||!t.isInput)return{connectionAllowed:!1};if(this.connections.some(a=>a.from===e&&a.to===t))return{connectionAllowed:!1};if(this.events.checkConnection.emit({from:e,to:t}).prevented)return{connectionAllowed:!1};const r=this.hooks.checkConnection.execute({from:e,to:t});if(r.some(a=>!a.connectionAllowed))return{connectionAllowed:!1};const o=Array.from(new Set(r.flatMap(a=>a.connectionsInDanger)));return{connectionAllowed:!0,dummyConnection:new FI(e,t),connectionsInDanger:o}}findNodeInterface(e){for(const t of this.nodes){for(const i in t.inputs){const s=t.inputs[i];if(s.id===e)return s}for(const i in t.outputs){const s=t.outputs[i];if(s.id===e)return s}}}findNodeById(e){return this.nodes.find(t=>t.id===e)}load(e){try{this._loading=!0;const t=[];for(let i=this.connections.length-1;i>=0;i--)this.removeConnection(this.connections[i]);for(let i=this.nodes.length-1;i>=0;i--)this.removeNode(this.nodes[i]);this.id=e.id;for(const i of e.nodes){const s=this.editor.nodeTypes.get(i.type);if(!s){t.push(`Node type ${i.type} is not registered`);continue}const r=new s.type;this.addNode(r),r.load(i)}for(const i of e.connections){const s=this.findNodeInterface(i.from),r=this.findNodeInterface(i.to);if(s)if(r){const o=new UR(s,r);o.id=i.id,this.internalAddConnection(o)}else{t.push(`Could not find interface with id ${i.to}`);continue}else{t.push(`Could not find interface with id ${i.from}`);continue}}return this.hooks.load.execute(e),t}finally{this._loading=!1}}save(){const e={id:this.id,nodes:this.nodes.map(t=>t.save()),connections:this.connections.map(t=>({id:t.id,from:t.from.id,to:t.to.id})),inputs:this.inputs,outputs:this.outputs};return this.hooks.save.execute(e)}destroy(){this._destroying=!0;for(const e of this.nodes)this.removeNode(e);this.editor.unregisterGraph(this)}internalAddConnection(e){this.connectionEvents.addTarget(e.events),this._connections.push(e),this.events.addConnection.emit(e)}}const cc="__baklava_GraphNode-";function Pa(n){return cc+n.id}function HIt(n){return class extends BI{constructor(){super(...arguments),this.type=Pa(n),this.inputs={},this.outputs={},this.template=n,this.calculate=async(t,i)=>{var s;if(!this.subgraph)throw new Error(`GraphNode ${this.id}: calculate called without subgraph being initialized`);if(!i.engine||typeof i.engine!="object")throw new Error(`GraphNode ${this.id}: calculate called but no engine provided in context`);const r=i.engine.getInputValues(this.subgraph);for(const l of this.subgraph.inputs)r.set(l.nodeInterfaceId,t[l.id]);const o=await i.engine.runGraph(this.subgraph,r,i.globalValues),a={};for(const l of this.subgraph.outputs)a[l.id]=(s=o.get(l.nodeId))===null||s===void 0?void 0:s.get("output");return a._calculationResults=o,a}}get title(){return this._title}set title(t){this.template.name=t}load(t){if(!this.subgraph)throw new Error("Cannot load a graph node without a graph");if(!this.template)throw new Error("Unable to load graph node without graph template");this.subgraph.load(t.graphState),super.load(t)}save(){if(!this.subgraph)throw new Error("Cannot save a graph node without a graph");return{...super.save(),graphState:this.subgraph.save()}}onPlaced(){this.template.events.updated.subscribe(this,()=>this.initialize()),this.template.events.nameChanged.subscribe(this,t=>{this._title=t}),this.initialize()}onDestroy(){var t;this.template.events.updated.unsubscribe(this),this.template.events.nameChanged.unsubscribe(this),(t=this.subgraph)===null||t===void 0||t.destroy()}initialize(){this.subgraph&&this.subgraph.destroy(),this.subgraph=this.template.createGraph(),this._title=this.template.name,this.updateInterfaces(),this.events.update.emit(null)}updateInterfaces(){if(!this.subgraph)throw new Error("Trying to update interfaces without graph instance");for(const t of this.subgraph.inputs)t.id in this.inputs?this.inputs[t.id].name=t.name:this.addInput(t.id,new tn(t.name,void 0));for(const t of Object.keys(this.inputs))this.subgraph.inputs.some(i=>i.id===t)||this.removeInput(t);for(const t of this.subgraph.outputs)t.id in this.outputs?this.outputs[t.id].name=t.name:this.addOutput(t.id,new tn(t.name,void 0));for(const t of Object.keys(this.outputs))this.subgraph.outputs.some(i=>i.id===t)||this.removeOutput(t);this.addOutput("_calculationResults",new tn("_calculationResults",void 0).setHidden(!0))}}}class gp{static fromGraph(e,t){return new gp(e.save(),t)}get name(){return this._name}set name(e){this._name=e,this.events.nameChanged.emit(e);const t=this.editor.nodeTypes.get(Pa(this));t&&(t.title=e)}get inputs(){return this.nodes.filter(t=>t.type===ka).map(t=>({id:t.graphInterfaceId,name:t.inputs.name.value,nodeId:t.id,nodeInterfaceId:t.outputs.placeholder.id}))}get outputs(){return this.nodes.filter(t=>t.type===La).map(t=>({id:t.graphInterfaceId,name:t.inputs.name.value,nodeId:t.id,nodeInterfaceId:t.outputs.output.id}))}constructor(e,t){this.id=Fs(),this._name="Subgraph",this.events={nameChanged:new qt(this),updated:new qt(this)},this.hooks={beforeLoad:new li(this),afterSave:new li(this)},this.editor=t,e.id&&(this.id=e.id),e.name&&(this._name=e.name),this.update(e)}update(e){this.nodes=e.nodes,this.connections=e.connections,this.events.updated.emit()}save(){return{id:this.id,name:this.name,nodes:this.nodes,connections:this.connections,inputs:this.inputs,outputs:this.outputs}}createGraph(e){const t=new Map,i=f=>{const m=Fs();return t.set(f,m),m},s=f=>{const m=t.get(f);if(!m)throw new Error(`Unable to create graph from template: Could not map old id ${f} to new id`);return m},r=f=>yb(f,m=>({id:i(m.id),templateId:m.id,value:m.value})),o=this.nodes.map(f=>({...f,id:i(f.id),inputs:r(f.inputs),outputs:r(f.outputs)})),a=this.connections.map(f=>({id:i(f.id),from:s(f.from),to:s(f.to)})),l=this.inputs.map(f=>({id:f.id,name:f.name,nodeId:s(f.nodeId),nodeInterfaceId:s(f.nodeInterfaceId)})),d=this.outputs.map(f=>({id:f.id,name:f.name,nodeId:s(f.nodeId),nodeInterfaceId:s(f.nodeInterfaceId)})),c={id:Fs(),nodes:o,connections:a,inputs:l,outputs:d};return e||(e=new Cc(this.editor)),e.load(c).forEach(f=>console.warn(f)),e.template=this,e}}class qIt{get nodeTypes(){return this._nodeTypes}get graph(){return this._graph}get graphTemplates(){return this._graphTemplates}get graphs(){return this._graphs}get loading(){return this._loading}constructor(){this.events={loaded:new qt(this),beforeRegisterNodeType:new Pn(this),registerNodeType:new qt(this),beforeUnregisterNodeType:new Pn(this),unregisterNodeType:new qt(this),beforeAddGraphTemplate:new Pn(this),addGraphTemplate:new qt(this),beforeRemoveGraphTemplate:new Pn(this),removeGraphTemplate:new qt(this),registerGraph:new qt(this),unregisterGraph:new qt(this)},this.hooks={save:new li(this),load:new li(this)},this.graphTemplateEvents=ji(),this.graphTemplateHooks=ji(),this.graphEvents=ji(),this.graphHooks=ji(),this.nodeEvents=ji(),this.nodeHooks=ji(),this.connectionEvents=ji(),this._graphs=new Set,this._nodeTypes=new Map,this._graph=new Cc(this),this._graphTemplates=[],this._loading=!1,this.registerNodeType(VI),this.registerNodeType(HI)}registerNodeType(e,t){var i,s;if(this.events.beforeRegisterNodeType.emit({type:e,options:t}).prevented)return;const r=new e;this._nodeTypes.set(r.type,{type:e,category:(i=t==null?void 0:t.category)!==null&&i!==void 0?i:"default",title:(s=t==null?void 0:t.title)!==null&&s!==void 0?s:r.title}),this.events.registerNodeType.emit({type:e,options:t})}unregisterNodeType(e){const t=typeof e=="string"?e:new e().type;if(this.nodeTypes.has(t)){if(this.events.beforeUnregisterNodeType.emit(t).prevented)return;this._nodeTypes.delete(t),this.events.unregisterNodeType.emit(t)}}addGraphTemplate(e){if(this.events.beforeAddGraphTemplate.emit(e).prevented)return;this._graphTemplates.push(e),this.graphTemplateEvents.addTarget(e.events),this.graphTemplateHooks.addTarget(e.hooks);const t=HIt(e);this.registerNodeType(t,{category:"Subgraphs",title:e.name}),this.events.addGraphTemplate.emit(e)}removeGraphTemplate(e){if(this.graphTemplates.includes(e)){if(this.events.beforeRemoveGraphTemplate.emit(e).prevented)return;const t=Pa(e);for(const i of[this.graph,...this.graphs.values()]){const s=i.nodes.filter(r=>r.type===t);for(const r of s)i.removeNode(r)}this.unregisterNodeType(t),this._graphTemplates.splice(this._graphTemplates.indexOf(e),1),this.graphTemplateEvents.removeTarget(e.events),this.graphTemplateHooks.removeTarget(e.hooks),this.events.removeGraphTemplate.emit(e)}}registerGraph(e){this.graphEvents.addTarget(e.events),this.graphHooks.addTarget(e.hooks),this.nodeEvents.addTarget(e.nodeEvents),this.nodeHooks.addTarget(e.nodeHooks),this.connectionEvents.addTarget(e.connectionEvents),this.events.registerGraph.emit(e),this._graphs.add(e)}unregisterGraph(e){this.graphEvents.removeTarget(e.events),this.graphHooks.removeTarget(e.hooks),this.nodeEvents.removeTarget(e.nodeEvents),this.nodeHooks.removeTarget(e.nodeHooks),this.connectionEvents.removeTarget(e.connectionEvents),this.events.unregisterGraph.emit(e),this._graphs.delete(e)}load(e){try{this._loading=!0,e=this.hooks.load.execute(e),e.graphTemplates.forEach(i=>{const s=new gp(i,this);this.addGraphTemplate(s)});const t=this._graph.load(e.graph);return this.events.loaded.emit(),t.forEach(i=>console.warn(i)),t}finally{this._loading=!1}}save(){const e={graph:this.graph.save(),graphTemplates:this.graphTemplates.map(t=>t.save())};return this.hooks.save.execute(e)}}function YIt(n,e){const t=new Map;e.graphs.forEach(i=>{i.nodes.forEach(s=>t.set(s.id,s))}),n.forEach((i,s)=>{const r=t.get(s);r&&i.forEach((o,a)=>{const l=r.outputs[a];l&&(l.value=o)})})}class qI extends Error{constructor(){super("Cycle detected")}}function $It(n){return typeof n=="string"}function YI(n,e){const t=new Map,i=new Map,s=new Map;let r,o;if(n instanceof Cc)r=n.nodes,o=n.connections;else{if(!e)throw new Error("Invalid argument value: expected array of connections");r=n,o=e}r.forEach(d=>{Object.values(d.inputs).forEach(c=>t.set(c.id,d.id)),Object.values(d.outputs).forEach(c=>t.set(c.id,d.id))}),r.forEach(d=>{const c=o.filter(f=>f.from&&t.get(f.from.id)===d.id),_=new Set(c.map(f=>t.get(f.to.id)).filter($It));i.set(d.id,_),s.set(d,c)});const a=r.slice();o.forEach(d=>{const c=a.findIndex(_=>t.get(d.to.id)===_.id);c>=0&&a.splice(c,1)});const l=[];for(;a.length>0;){const d=a.pop();l.push(d);const c=i.get(d.id);for(;c.size>0;){const _=c.values().next().value;if(c.delete(_),Array.from(i.values()).every(f=>!f.has(_))){const f=r.find(m=>m.id===_);a.push(f)}}}if(Array.from(i.values()).some(d=>d.size>0))throw new qI;return{calculationOrder:l,connectionsFromNode:s,interfaceIdToNodeId:t}}function WIt(n,e){try{return YI(n,e),!1}catch(t){if(t instanceof qI)return!0;throw t}}var Kn;(function(n){n.Running="Running",n.Idle="Idle",n.Paused="Paused",n.Stopped="Stopped"})(Kn||(Kn={}));class KIt{get status(){return this.isRunning?Kn.Running:this.internalStatus}constructor(e){this.editor=e,this.events={beforeRun:new Pn(this),afterRun:new qt(this),statusChange:new qt(this),beforeNodeCalculation:new qt(this),afterNodeCalculation:new qt(this)},this.hooks={gatherCalculationData:new li(this),transferData:new UI},this.recalculateOrder=!0,this.internalStatus=Kn.Stopped,this.isRunning=!1,this.editor.nodeEvents.update.subscribe(this,(t,i)=>{i.graph&&!i.graph.loading&&i.graph.activeTransactions===0&&this.internalOnChange(i,t??void 0)}),this.editor.graphEvents.addNode.subscribe(this,(t,i)=>{this.recalculateOrder=!0,!i.loading&&i.activeTransactions===0&&this.internalOnChange()}),this.editor.graphEvents.removeNode.subscribe(this,(t,i)=>{this.recalculateOrder=!0,!i.loading&&i.activeTransactions===0&&this.internalOnChange()}),this.editor.graphEvents.addConnection.subscribe(this,(t,i)=>{this.recalculateOrder=!0,!i.loading&&i.activeTransactions===0&&this.internalOnChange()}),this.editor.graphEvents.removeConnection.subscribe(this,(t,i)=>{this.recalculateOrder=!0,!i.loading&&i.activeTransactions===0&&this.internalOnChange()}),this.editor.graphHooks.checkConnection.subscribe(this,t=>this.checkConnection(t.from,t.to))}start(){this.internalStatus===Kn.Stopped&&(this.internalStatus=Kn.Idle,this.events.statusChange.emit(this.status))}pause(){this.internalStatus===Kn.Idle&&(this.internalStatus=Kn.Paused,this.events.statusChange.emit(this.status))}resume(){this.internalStatus===Kn.Paused&&(this.internalStatus=Kn.Idle,this.events.statusChange.emit(this.status))}stop(){(this.internalStatus===Kn.Idle||this.internalStatus===Kn.Paused)&&(this.internalStatus=Kn.Stopped,this.events.statusChange.emit(this.status))}async runOnce(e,...t){if(this.events.beforeRun.emit(e).prevented)return null;try{this.isRunning=!0,this.events.statusChange.emit(this.status),this.recalculateOrder&&this.calculateOrder();const i=await this.execute(e,...t);return this.events.afterRun.emit(i),i}finally{this.isRunning=!1,this.events.statusChange.emit(this.status)}}checkConnection(e,t){if(e.templateId){const r=this.findInterfaceByTemplateId(this.editor.graph.nodes,e.templateId);if(!r)return{connectionAllowed:!0,connectionsInDanger:[]};e=r}if(t.templateId){const r=this.findInterfaceByTemplateId(this.editor.graph.nodes,t.templateId);if(!r)return{connectionAllowed:!0,connectionsInDanger:[]};t=r}const i=new FI(e,t);let s=this.editor.graph.connections.slice();return t.allowMultipleConnections||(s=s.filter(r=>r.to!==t)),s.push(i),WIt(this.editor.graph.nodes,s)?{connectionAllowed:!1,connectionsInDanger:[]}:{connectionAllowed:!0,connectionsInDanger:t.allowMultipleConnections?[]:this.editor.graph.connections.filter(r=>r.to===t)}}calculateOrder(){this.recalculateOrder=!0}async calculateWithoutData(...e){const t=this.hooks.gatherCalculationData.execute(void 0);return await this.runOnce(t,...e)}validateNodeCalculationOutput(e,t){if(typeof t!="object")throw new Error(`Invalid calculation return value from node ${e.id} (type ${e.type})`);Object.keys(e.outputs).forEach(i=>{if(!(i in t))throw new Error(`Calculation return value from node ${e.id} (type ${e.type}) is missing key "${i}"`)})}internalOnChange(e,t){this.internalStatus===Kn.Idle&&this.onChange(this.recalculateOrder,e,t)}findInterfaceByTemplateId(e,t){for(const i of e)for(const s of[...Object.values(i.inputs),...Object.values(i.outputs)])if(s.templateId===t)return s;return null}}class jIt extends KIt{constructor(e){super(e),this.order=new Map}start(){super.start(),this.recalculateOrder=!0,this.calculateWithoutData()}async runGraph(e,t,i){this.order.has(e.id)||this.order.set(e.id,YI(e));const{calculationOrder:s,connectionsFromNode:r}=this.order.get(e.id),o=new Map;for(const a of s){const l={};Object.entries(a.inputs).forEach(([c,_])=>{l[c]=this.getInterfaceValue(t,_.id)}),this.events.beforeNodeCalculation.emit({inputValues:l,node:a});let d;if(a.calculate)d=await a.calculate(l,{globalValues:i,engine:this});else{d={};for(const[c,_]of Object.entries(a.outputs))d[c]=this.getInterfaceValue(t,_.id)}this.validateNodeCalculationOutput(a,d),this.events.afterNodeCalculation.emit({outputValues:d,node:a}),o.set(a.id,new Map(Object.entries(d))),r.has(a)&&r.get(a).forEach(c=>{var _;const f=(_=Object.entries(a.outputs).find(([,h])=>h.id===c.from.id))===null||_===void 0?void 0:_[0];if(!f)throw new Error(`Could not find key for interface ${c.from.id} This is likely a Baklava internal issue. Please report it on GitHub.`);const m=this.hooks.transferData.execute(d[f],c);c.to.allowMultipleConnections?t.has(c.to.id)?t.get(c.to.id).push(m):t.set(c.to.id,[m]):t.set(c.to.id,m)})}return o}async execute(e){this.recalculateOrder&&(this.order.clear(),this.recalculateOrder=!1);const t=this.getInputValues(this.editor.graph);return await this.runGraph(this.editor.graph,t,e)}getInputValues(e){const t=new Map;for(const i of e.nodes)Object.values(i.inputs).forEach(s=>{s.connectionCount===0&&t.set(s.id,s.value)}),i.calculate||Object.values(i.outputs).forEach(s=>{t.set(s.id,s.value)});return t}onChange(e){this.recalculateOrder=e||this.recalculateOrder,this.calculateWithoutData()}getInterfaceValue(e,t){if(!e.has(t))throw new Error(`Could not find value for interface ${t} -This is likely a Baklava internal issue. Please report it on GitHub.`);return e.get(t)}}let Sb=null;function KIt(n){Sb=n}function Oi(){if(!Sb)throw new Error("providePlugin() must be called before usePlugin()");return{viewModel:Sb}}function Wi(){const{viewModel:n}=Oi();return{graph:jd(n.value,"displayedGraph"),switchGraph:n.value.switchGraph}}function $I(n){const{graph:e}=Wi(),t=mt(null),i=mt(null);return{dragging:it(()=>!!t.value),onPointerDown:l=>{t.value={x:l.pageX,y:l.pageY},i.value={x:n.value.x,y:n.value.y}},onPointerMove:l=>{if(t.value){const d=l.pageX-t.value.x,c=l.pageY-t.value.y;n.value.x=i.value.x+d/e.value.scaling,n.value.y=i.value.y+c/e.value.scaling}},onPointerUp:()=>{t.value=null,i.value=null}}}function WI(n,e,t){if(!e.template)return!1;if(Pa(e.template)===t)return!0;const i=n.graphTemplates.find(r=>Pa(r)===t);return i?i.nodes.filter(r=>r.type.startsWith(cc)).some(r=>WI(n,e,r.type)):!1}function KI(n){return it(()=>{const e=Array.from(n.value.editor.nodeTypes.entries()),t=new Set(e.map(([,s])=>s.category)),i=[];for(const s of t.values()){let r=e.filter(([,o])=>o.category===s);n.value.displayedGraph.template?r=r.filter(([o])=>!WI(n.value.editor,n.value.displayedGraph,o)):r=r.filter(([o])=>![ka,La].includes(o)),r.length>0&&i.push({name:s,nodeTypes:Object.fromEntries(r)})}return i.sort((s,r)=>s.name==="default"?-1:r.name==="default"||s.name>r.name?1:-1),i})}function jI(){const{graph:n}=Wi();return{transform:(t,i)=>{const s=t/n.value.scaling-n.value.panning.x,r=i/n.value.scaling-n.value.panning.y;return[s,r]}}}function jIt(){const{graph:n}=Wi();let e=[],t=-1,i={x:0,y:0};const s=it(()=>n.value.panning),r=$I(s),o=it(()=>({"transform-origin":"0 0",transform:`scale(${n.value.scaling}) translate(${n.value.panning.x}px, ${n.value.panning.y}px)`})),a=(m,h,E)=>{const b=[m/n.value.scaling-n.value.panning.x,h/n.value.scaling-n.value.panning.y],g=[m/E-n.value.panning.x,h/E-n.value.panning.y],v=[g[0]-b[0],g[1]-b[1]];n.value.panning.x+=v[0],n.value.panning.y+=v[1],n.value.scaling=E},l=m=>{m.preventDefault();let h=m.deltaY;m.deltaMode===1&&(h*=32);const E=n.value.scaling*(1-h/3e3);a(m.offsetX,m.offsetY,E)},d=()=>({ax:e[0].clientX,ay:e[0].clientY,bx:e[1].clientX,by:e[1].clientY});return{styles:o,...r,onPointerDown:m=>{if(e.push(m),r.onPointerDown(m),e.length===2){const{ax:h,ay:E,bx:b,by:g}=d();i={x:h+(b-h)/2,y:E+(g-E)/2}}},onPointerMove:m=>{for(let h=0;h0){const C=n.value.scaling*(1+(T-t)/500);a(i.x,i.y,C)}t=T}else r.onPointerMove(m)},onPointerUp:m=>{e=e.filter(h=>h.pointerId!==m.pointerId),t=-1,r.onPointerUp()},onMouseWheel:l}}var vi=(n=>(n[n.NONE=0]="NONE",n[n.ALLOWED=1]="ALLOWED",n[n.FORBIDDEN=2]="FORBIDDEN",n))(vi||{});const QI=Symbol();function QIt(){const{graph:n}=Wi(),e=mt(null),t=mt(null),i=a=>{e.value&&(e.value.mx=a.offsetX/n.value.scaling-n.value.panning.x,e.value.my=a.offsetY/n.value.scaling-n.value.panning.y)},s=()=>{if(t.value){if(e.value)return;const a=n.value.connections.find(l=>l.to===t.value);t.value.isInput&&a?(e.value={status:vi.NONE,from:a.from},n.value.removeConnection(a)):e.value={status:vi.NONE,from:t.value},e.value.mx=void 0,e.value.my=void 0}},r=()=>{if(e.value&&t.value){if(e.value.from===t.value)return;n.value.addConnection(e.value.from,e.value.to)}e.value=null},o=a=>{if(t.value=a??null,a&&e.value){e.value.to=a;const l=n.value.checkConnection(e.value.from,e.value.to);if(e.value.status=l.connectionAllowed?vi.ALLOWED:vi.FORBIDDEN,l.connectionAllowed){const d=l.connectionsInDanger.map(c=>c.id);n.value.connections.forEach(c=>{d.includes(c.id)&&(c.isInDanger=!0)})}}else!a&&e.value&&(e.value.to=void 0,e.value.status=vi.NONE,n.value.connections.forEach(l=>{l.isInDanger=!1}))};return sa(QI,{temporaryConnection:e,hoveredOver:o}),{temporaryConnection:e,onMouseMove:i,onMouseDown:s,onMouseUp:r,hoveredOver:o}}function XIt(n){const e=mt(!1),t=mt(0),i=mt(0),s=KI(n),{transform:r}=jI(),o=it(()=>{let c=[];const _={};for(const m of s.value){const h=Object.entries(m.nodeTypes).map(([E,b])=>({label:b.title,value:"addNode:"+E}));m.name==="default"?c=h:_[m.name]=h}const f=[...Object.entries(_).map(([m,h])=>({label:m,submenu:h}))];return f.length>0&&c.length>0&&f.push({isDivider:!0}),f.push(...c),f}),a=it(()=>n.value.settings.contextMenu.additionalItems.length===0?o.value:[{label:"Add node",submenu:o.value},...n.value.settings.contextMenu.additionalItems.map(c=>"isDivider"in c||"submenu"in c?c:{label:c.label,value:"command:"+c.command,disabled:!n.value.commandHandler.canExecuteCommand(c.command)})]);function l(c){e.value=!0,t.value=c.offsetX,i.value=c.offsetY}function d(c){if(c.startsWith("addNode:")){const _=c.substring(8),f=n.value.editor.nodeTypes.get(_);if(!f)return;const m=ei(new f.type);n.value.displayedGraph.addNode(m);const[h,E]=r(t.value,i.value);m.position.x=h,m.position.y=E}else if(c.startsWith("command:")){const _=c.substring(8);n.value.commandHandler.canExecuteCommand(_)&&n.value.commandHandler.executeCommand(_)}}return{show:e,x:t,y:i,items:a,open:l,onClick:d}}const ZIt=pn({setup(){const{viewModel:n}=Oi(),{graph:e}=Wi();return{styles:it(()=>{const i=n.value.settings.background,s=e.value.panning.x*e.value.scaling,r=e.value.panning.y*e.value.scaling,o=e.value.scaling*i.gridSize,a=o/i.gridDivision,l=`${o}px ${o}px, ${o}px ${o}px`,d=e.value.scaling>i.subGridVisibleThreshold?`, ${a}px ${a}px, ${a}px ${a}px`:"";return{backgroundPosition:`left ${s}px top ${r}px`,backgroundSize:`${l} ${d}`}})}}}),_n=(n,e)=>{const t=n.__vccOpts||n;for(const[i,s]of e)t[i]=s;return t};function JIt(n,e,t,i,s,r){return w(),M("div",{class:"background",style:en(n.styles)},null,4)}const eMt=_n(ZIt,[["render",JIt]]);function tMt(n){return iA()?(LM(n),!0):!1}function pv(n){return typeof n=="function"?n():vt(n)}const XI=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const nMt=Object.prototype.toString,iMt=n=>nMt.call(n)==="[object Object]",qd=()=>{},sMt=rMt();function rMt(){var n,e;return XI&&((n=window==null?void 0:window.navigator)==null?void 0:n.userAgent)&&(/iP(ad|hone|od)/.test(window.navigator.userAgent)||((e=window==null?void 0:window.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function oMt(n,e,t=!1){return e.reduce((i,s)=>(s in n&&(!t||n[s]!==void 0)&&(i[s]=n[s]),i),{})}function aMt(n,e={}){if(!hn(n))return m2(n);const t=Array.isArray(n.value)?Array.from({length:n.value.length}):{};for(const i in n.value)t[i]=f2(()=>({get(){return n.value[i]},set(s){var r;if((r=pv(e.replaceRef))!=null?r:!0)if(Array.isArray(n.value)){const a=[...n.value];a[i]=s,n.value=a}else{const a={...n.value,[i]:s};Object.setPrototypeOf(a,Object.getPrototypeOf(n.value)),n.value=a}else n.value[i]=s}}));return t}function Nl(n){var e;const t=pv(n);return(e=t==null?void 0:t.$el)!=null?e:t}const _v=XI?window:void 0;function Vl(...n){let e,t,i,s;if(typeof n[0]=="string"||Array.isArray(n[0])?([t,i,s]=n,e=_v):[e,t,i,s]=n,!e)return qd;Array.isArray(t)||(t=[t]),Array.isArray(i)||(i=[i]);const r=[],o=()=>{r.forEach(c=>c()),r.length=0},a=(c,_,f,m)=>(c.addEventListener(_,f,m),()=>c.removeEventListener(_,f,m)),l=qn(()=>[Nl(e),pv(s)],([c,_])=>{if(o(),!c)return;const f=iMt(_)?{..._}:_;r.push(...t.flatMap(m=>i.map(h=>a(c,m,h,f))))},{immediate:!0,flush:"post"}),d=()=>{l(),o()};return tMt(d),d}let FR=!1;function ZI(n,e,t={}){const{window:i=_v,ignore:s=[],capture:r=!0,detectIframe:o=!1}=t;if(!i)return qd;sMt&&!FR&&(FR=!0,Array.from(i.document.body.children).forEach(f=>f.addEventListener("click",qd)),i.document.documentElement.addEventListener("click",qd));let a=!0;const l=f=>s.some(m=>{if(typeof m=="string")return Array.from(i.document.querySelectorAll(m)).some(h=>h===f.target||f.composedPath().includes(h));{const h=Nl(m);return h&&(f.target===h||f.composedPath().includes(h))}}),c=[Vl(i,"click",f=>{const m=Nl(n);if(!(!m||m===f.target||f.composedPath().includes(m))){if(f.detail===0&&(a=!l(f)),!a){a=!0;return}e(f)}},{passive:!0,capture:r}),Vl(i,"pointerdown",f=>{const m=Nl(n);a=!l(f)&&!!(m&&!f.composedPath().includes(m))},{passive:!0}),o&&Vl(i,"blur",f=>{setTimeout(()=>{var m;const h=Nl(n);((m=i.document.activeElement)==null?void 0:m.tagName)==="IFRAME"&&!(h!=null&&h.contains(i.document.activeElement))&&e(f)},0)})].filter(Boolean);return()=>c.forEach(f=>f())}const JI={x:0,y:0,pointerId:0,pressure:0,tiltX:0,tiltY:0,width:0,height:0,twist:0,pointerType:null},lMt=Object.keys(JI);function cMt(n={}){const{target:e=_v}=n,t=mt(!1),i=mt(n.initialValue||{});Object.assign(i.value,JI,i.value);const s=r=>{t.value=!0,!(n.pointerTypes&&!n.pointerTypes.includes(r.pointerType))&&(i.value=oMt(r,lMt,!1))};if(e){const r={passive:!0};Vl(e,["pointerdown","pointermove","pointerup"],s,r),Vl(e,"pointerleave",()=>t.value=!1,r)}return{...aMt(i),isInside:t}}const dMt=["onMouseenter","onMouseleave","onClick"],uMt={class:"flex-fill"},pMt={key:0,class:"__submenu-icon",style:{"line-height":"1em"}},_Mt=u("svg",{width:"13",height:"13",viewBox:"-60 120 250 250"},[u("path",{d:"M160.875 279.5625 L70.875 369.5625 L70.875 189.5625 L160.875 279.5625 Z",stroke:"none",fill:"white"})],-1),hMt=[_Mt],hv=pn({__name:"ContextMenu",props:{modelValue:{type:Boolean},items:{},x:{default:0},y:{default:0},isNested:{type:Boolean,default:!1},isFlipped:{default:()=>({x:!1,y:!1})},flippable:{type:Boolean,default:!1}},emits:["update:modelValue","click"],setup(n,{emit:e}){const t=n,i=e;let s=null;const r=mt(null),o=mt(-1),a=mt(0),l=mt({x:!1,y:!1}),d=it(()=>t.flippable&&(l.value.x||t.isFlipped.x)),c=it(()=>t.flippable&&(l.value.y||t.isFlipped.y)),_=it(()=>{const v={};return t.isNested||(v.top=(c.value?t.y-a.value:t.y)+"px",v.left=t.x+"px"),v}),f=it(()=>({"--flipped-x":d.value,"--flipped-y":c.value,"--nested":t.isNested})),m=it(()=>t.items.map(v=>({...v,hover:!1})));qn([()=>t.y,()=>t.items],()=>{var v,y,T,C;a.value=t.items.length*30;const x=((y=(v=r.value)==null?void 0:v.parentElement)==null?void 0:y.offsetWidth)??0,O=((C=(T=r.value)==null?void 0:T.parentElement)==null?void 0:C.offsetHeight)??0;l.value.x=!t.isNested&&t.x>x*.75,l.value.y=!t.isNested&&t.y+a.value>O-20}),ZI(r,()=>{t.modelValue&&i("update:modelValue",!1)});const h=v=>{!v.submenu&&v.value&&(i("click",v.value),i("update:modelValue",!1))},E=v=>{i("click",v),o.value=-1,t.isNested||i("update:modelValue",!1)},b=(v,y)=>{t.items[y].submenu&&(o.value=y,s!==null&&(clearTimeout(s),s=null))},g=(v,y)=>{t.items[y].submenu&&(s=window.setTimeout(()=>{o.value=-1,s=null},200))};return(v,y)=>{const T=ht("ContextMenu",!0);return w(),xt(ls,{name:"slide-fade"},{default:Je(()=>[ne(u("div",{ref_key:"el",ref:r,class:Ye(["baklava-context-menu",f.value]),style:en(_.value)},[(w(!0),M($e,null,ct(m.value,(C,x)=>(w(),M($e,null,[C.isDivider?(w(),M("div",{key:`d-${x}`,class:"divider"})):(w(),M("div",{key:`i-${x}`,class:Ye(["item",{submenu:!!C.submenu,"--disabled":!!C.disabled}]),onMouseenter:O=>b(O,x),onMouseleave:O=>g(O,x),onClick:Te(O=>h(C),["stop","prevent"])},[u("div",uMt,fe(C.label),1),C.submenu?(w(),M("div",pMt,hMt)):q("",!0),C.submenu?(w(),xt(T,{key:1,"model-value":o.value===x,items:C.submenu,"is-nested":!0,"is-flipped":{x:d.value,y:c.value},flippable:v.flippable,onClick:E},null,8,["model-value","items","is-flipped","flippable"])):q("",!0)],42,dMt))],64))),256))],6),[[Ot,v.modelValue]])]),_:1})}}}),fMt={},mMt={xmlns:"http://www.w3.org/2000/svg",class:"baklava-icon",width:"16",height:"16",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},gMt=u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),bMt=u("circle",{cx:"12",cy:"12",r:"1"},null,-1),EMt=u("circle",{cx:"12",cy:"19",r:"1"},null,-1),vMt=u("circle",{cx:"12",cy:"5",r:"1"},null,-1),yMt=[gMt,bMt,EMt,vMt];function SMt(n,e){return w(),M("svg",mMt,yMt)}const eM=_n(fMt,[["render",SMt]]),TMt=["id"],xMt={key:0,class:"__tooltip"},CMt={key:2,class:"align-middle"},BR=pn({__name:"NodeInterface",props:{node:{},intf:{}},setup(n){const e=(b,g=100)=>{const v=b!=null&&b.toString?b.toString():"";return v.length>g?v.slice(0,g)+"...":v},t=n,{viewModel:i}=Oi(),{hoveredOver:s,temporaryConnection:r}=Gi(QI),o=mt(null),a=it(()=>t.intf.connectionCount>0),l=mt(!1),d=it(()=>i.value.settings.displayValueOnHover&&l.value),c=it(()=>({"--input":t.intf.isInput,"--output":!t.intf.isInput,"--connected":a.value})),_=it(()=>t.intf.component&&(!t.intf.isInput||!t.intf.port||t.intf.connectionCount===0)),f=()=>{l.value=!0,s(t.intf)},m=()=>{l.value=!1,s(void 0)},h=()=>{o.value&&i.value.hooks.renderInterface.execute({intf:t.intf,el:o.value})},E=()=>{const b=i.value.displayedGraph.sidebar;b.nodeId=t.node.id,b.optionName=t.intf.name,b.visible=!0};return qs(h),pc(h),(b,g)=>{var v;return w(),M("div",{id:b.intf.id,ref_key:"el",ref:o,class:Ye(["baklava-node-interface",c.value])},[b.intf.port?(w(),M("div",{key:0,class:Ye(["__port",{"--selected":((v=vt(r))==null?void 0:v.from)===b.intf}]),onPointerover:f,onPointerout:m},[Dn(b.$slots,"portTooltip",{showTooltip:d.value},()=>[d.value===!0?(w(),M("span",xMt,fe(e(b.intf.value)),1)):q("",!0)])],34)):q("",!0),_.value?(w(),xt(Fu(b.intf.component),{key:1,modelValue:b.intf.value,"onUpdate:modelValue":g[0]||(g[0]=y=>b.intf.value=y),node:b.node,intf:b.intf,onOpenSidebar:E},null,40,["modelValue","node","intf"])):(w(),M("span",CMt,fe(b.intf.name),1))],10,TMt)}}}),RMt=["id","data-node-type"],AMt={class:"__title-label"},wMt={class:"__menu"},NMt={class:"__outputs"},OMt={class:"__inputs"},IMt=pn({__name:"Node",props:{node:{},selected:{type:Boolean,default:!1},dragging:{type:Boolean}},emits:["select","start-drag"],setup(n,{emit:e}){const t=n,i=e,{viewModel:s}=Oi(),{graph:r,switchGraph:o}=Wi(),a=mt(null),l=mt(!1),d=mt(""),c=mt(null),_=mt(!1),f=mt(!1),m=it(()=>{const U=[{value:"rename",label:"Rename"},{value:"delete",label:"Delete"}];return t.node.type.startsWith(cc)&&U.push({value:"editSubgraph",label:"Edit Subgraph"}),U}),h=it(()=>({"--selected":t.selected,"--dragging":t.dragging,"--two-column":!!t.node.twoColumn})),E=it(()=>{var U,F;return{top:`${((U=t.node.position)==null?void 0:U.y)??0}px`,left:`${((F=t.node.position)==null?void 0:F.x)??0}px`,"--width":`${t.node.width??s.value.settings.nodes.defaultWidth}px`}}),b=it(()=>Object.values(t.node.inputs).filter(U=>!U.hidden)),g=it(()=>Object.values(t.node.outputs).filter(U=>!U.hidden)),v=()=>{i("select")},y=U=>{t.selected||v(),i("start-drag",U)},T=()=>{f.value=!0},C=async U=>{var F;switch(U){case"delete":r.value.removeNode(t.node);break;case"rename":d.value=t.node.title,l.value=!0,await Ve(),(F=c.value)==null||F.focus();break;case"editSubgraph":o(t.node.template);break}},x=()=>{t.node.title=d.value,l.value=!1},O=()=>{a.value&&s.value.hooks.renderNode.execute({node:t.node,el:a.value})},R=U=>{_.value=!0,U.preventDefault()},S=U=>{if(!_.value)return;const F=t.node.width+U.movementX/r.value.scaling,K=s.value.settings.nodes.minWidth,L=s.value.settings.nodes.maxWidth;t.node.width=Math.max(K,Math.min(L,F))},A=()=>{_.value=!1};return qs(()=>{O(),window.addEventListener("mousemove",S),window.addEventListener("mouseup",A)}),pc(O),Va(()=>{window.removeEventListener("mousemove",S),window.removeEventListener("mouseup",A)}),(U,F)=>(w(),M("div",{id:U.node.id,ref_key:"el",ref:a,class:Ye(["baklava-node",h.value]),style:en(E.value),"data-node-type":U.node.type,onPointerdown:v},[vt(s).settings.nodes.resizable?(w(),M("div",{key:0,class:"__resize-handle",onMousedown:R},null,32)):q("",!0),Dn(U.$slots,"title",{},()=>[u("div",{class:"__title",onPointerdown:Te(y,["self","stop"])},[l.value?ne((w(),M("input",{key:1,ref_key:"renameInputEl",ref:c,"onUpdate:modelValue":F[1]||(F[1]=K=>d.value=K),type:"text",class:"baklava-input",placeholder:"Node Name",onBlur:x,onKeydown:wr(x,["enter"])},null,544)),[[Pe,d.value]]):(w(),M($e,{key:0},[u("div",AMt,fe(U.node.title),1),u("div",wMt,[Oe(eM,{class:"--clickable",onClick:T}),Oe(hv,{modelValue:f.value,"onUpdate:modelValue":F[0]||(F[0]=K=>f.value=K),x:0,y:0,items:m.value,onClick:C},null,8,["modelValue","items"])])],64))],32)]),Dn(U.$slots,"content",{},()=>[u("div",{class:"__content",onKeydown:F[2]||(F[2]=wr(Te(()=>{},["stop"]),["delete"]))},[u("div",NMt,[(w(!0),M($e,null,ct(g.value,K=>Dn(U.$slots,"nodeInterface",{key:K.id,type:"output",node:U.node,intf:K},()=>[Oe(BR,{node:U.node,intf:K},null,8,["node","intf"])])),128))]),u("div",OMt,[(w(!0),M($e,null,ct(b.value,K=>Dn(U.$slots,"nodeInterface",{key:K.id,type:"input",node:U.node,intf:K},()=>[Oe(BR,{node:U.node,intf:K},null,8,["node","intf"])])),128))])],32)])],46,RMt))}}),MMt=pn({props:{x1:{type:Number,required:!0},y1:{type:Number,required:!0},x2:{type:Number,required:!0},y2:{type:Number,required:!0},state:{type:Number,default:vi.NONE},isTemporary:{type:Boolean,default:!1}},setup(n){const{viewModel:e}=Oi(),{graph:t}=Wi(),i=(o,a)=>{const l=(o+t.value.panning.x)*t.value.scaling,d=(a+t.value.panning.y)*t.value.scaling;return[l,d]},s=it(()=>{const[o,a]=i(n.x1,n.y1),[l,d]=i(n.x2,n.y2);if(e.value.settings.useStraightConnections)return`M ${o} ${a} L ${l} ${d}`;{const c=.3*Math.abs(o-l);return`M ${o} ${a} C ${o+c} ${a}, ${l-c} ${d}, ${l} ${d}`}}),r=it(()=>({"--temporary":n.isTemporary,"--allowed":n.state===vi.ALLOWED,"--forbidden":n.state===vi.FORBIDDEN}));return{d:s,classes:r}}}),DMt=["d"];function kMt(n,e,t,i,s,r){return w(),M("path",{class:Ye(["baklava-connection",n.classes]),d:n.d},null,10,DMt)}const tM=_n(MMt,[["render",kMt]]);function LMt(n){return document.getElementById(n.id)}function Ua(n){const e=document.getElementById(n.id),t=e==null?void 0:e.getElementsByClassName("__port");return{node:(e==null?void 0:e.closest(".baklava-node"))??null,interface:e,port:t&&t.length>0?t[0]:null}}const PMt=pn({components:{"connection-view":tM},props:{connection:{type:Object,required:!0}},setup(n){const{graph:e}=Wi();let t;const i=mt({x1:0,y1:0,x2:0,y2:0}),s=it(()=>n.connection.isInDanger?vi.FORBIDDEN:vi.NONE),r=it(()=>{var d;return(d=e.value.findNodeById(n.connection.from.nodeId))==null?void 0:d.position}),o=it(()=>{var d;return(d=e.value.findNodeById(n.connection.to.nodeId))==null?void 0:d.position}),a=d=>d.node&&d.interface&&d.port?[d.node.offsetLeft+d.interface.offsetLeft+d.port.offsetLeft+d.port.clientWidth/2,d.node.offsetTop+d.interface.offsetTop+d.port.offsetTop+d.port.clientHeight/2]:[0,0],l=()=>{const d=Ua(n.connection.from),c=Ua(n.connection.to);d.node&&c.node&&(t||(t=new ResizeObserver(()=>{l()}),t.observe(d.node),t.observe(c.node)));const[_,f]=a(d),[m,h]=a(c);i.value={x1:_,y1:f,x2:m,y2:h}};return qs(async()=>{await Ve(),l()}),Va(()=>{t&&t.disconnect()}),qn([r,o],()=>l(),{deep:!0}),{d:i,state:s}}});function UMt(n,e,t,i,s,r){const o=ht("connection-view");return w(),xt(o,{x1:n.d.x1,y1:n.d.y1,x2:n.d.x2,y2:n.d.y2,state:n.state},null,8,["x1","y1","x2","y2","state"])}const FMt=_n(PMt,[["render",UMt]]);function Tu(n){return n.node&&n.interface&&n.port?[n.node.offsetLeft+n.interface.offsetLeft+n.port.offsetLeft+n.port.clientWidth/2,n.node.offsetTop+n.interface.offsetTop+n.port.offsetTop+n.port.clientHeight/2]:[0,0]}const BMt=pn({components:{"connection-view":tM},props:{connection:{type:Object,required:!0}},setup(n){const e=it(()=>n.connection?n.connection.status:vi.NONE);return{d:it(()=>{if(!n.connection)return{input:[0,0],output:[0,0]};const i=Tu(Ua(n.connection.from)),s=n.connection.to?Tu(Ua(n.connection.to)):[n.connection.mx||i[0],n.connection.my||i[1]];return n.connection.from.isInput?{input:s,output:i}:{input:i,output:s}}),status:e}}});function GMt(n,e,t,i,s,r){const o=ht("connection-view");return w(),xt(o,{x1:n.d.input[0],y1:n.d.input[1],x2:n.d.output[0],y2:n.d.output[1],state:n.status,"is-temporary":""},null,8,["x1","y1","x2","y2","state"])}const zMt=_n(BMt,[["render",GMt]]),VMt=pn({setup(){const{viewModel:n}=Oi(),{graph:e}=Wi(),t=mt(null),i=jd(n.value.settings.sidebar,"width"),s=it(()=>n.value.settings.sidebar.resizable),r=it(()=>{const _=e.value.sidebar.nodeId;return e.value.nodes.find(f=>f.id===_)}),o=it(()=>({width:`${i.value}px`})),a=it(()=>r.value?[...Object.values(r.value.inputs),...Object.values(r.value.outputs)].filter(f=>f.displayInSidebar&&f.component):[]),l=()=>{e.value.sidebar.visible=!1},d=()=>{window.addEventListener("mousemove",c),window.addEventListener("mouseup",()=>{window.removeEventListener("mousemove",c)},{once:!0})},c=_=>{var f,m;const h=((m=(f=t.value)==null?void 0:f.parentElement)==null?void 0:m.getBoundingClientRect().width)??500;let E=i.value-_.movementX;E<300?E=300:E>.9*h&&(E=.9*h),i.value=E};return{el:t,graph:e,resizable:s,node:r,styles:o,displayedInterfaces:a,startResize:d,close:l}}}),HMt={class:"__header"},qMt={class:"__node-name"};function YMt(n,e,t,i,s,r){return w(),M("div",{ref:"el",class:Ye(["baklava-sidebar",{"--open":n.graph.sidebar.visible}]),style:en(n.styles)},[n.resizable?(w(),M("div",{key:0,class:"__resizer",onMousedown:e[0]||(e[0]=(...o)=>n.startResize&&n.startResize(...o))},null,32)):q("",!0),u("div",HMt,[u("button",{tabindex:"-1",class:"__close",onClick:e[1]||(e[1]=(...o)=>n.close&&n.close(...o))},"×"),u("div",qMt,[u("b",null,fe(n.node?n.node.title:""),1)])]),(w(!0),M($e,null,ct(n.displayedInterfaces,o=>(w(),M("div",{key:o.id,class:"__interface"},[(w(),xt(Fu(o.component),{modelValue:o.value,"onUpdate:modelValue":a=>o.value=a,node:n.node,intf:o},null,8,["modelValue","onUpdate:modelValue","node","intf"]))]))),128))],6)}const $Mt=_n(VMt,[["render",YMt]]),WMt=pn({__name:"Minimap",setup(n){const{viewModel:e}=Oi(),{graph:t}=Wi(),i=mt(null),s=mt(!1);let r,o=!1,a={x1:0,y1:0,x2:0,y2:0},l;const d=()=>{var x,O;if(!r)return;r.canvas.width=i.value.offsetWidth,r.canvas.height=i.value.offsetHeight;const R=new Map,S=new Map;for(const L of t.value.nodes){const H=LMt(L),G=(H==null?void 0:H.offsetWidth)??0,P=(H==null?void 0:H.offsetHeight)??0,j=((x=L.position)==null?void 0:x.x)??0,Y=((O=L.position)==null?void 0:O.y)??0;R.set(L,{x1:j,y1:Y,x2:j+G,y2:Y+P}),S.set(L,H)}const A={x1:Number.MAX_SAFE_INTEGER,y1:Number.MAX_SAFE_INTEGER,x2:Number.MIN_SAFE_INTEGER,y2:Number.MIN_SAFE_INTEGER};for(const L of R.values())L.x1A.x2&&(A.x2=L.x2),L.y2>A.y2&&(A.y2=L.y2);const U=50;A.x1-=U,A.y1-=U,A.x2+=U,A.y2+=U,a=A;const F=r.canvas.width/r.canvas.height,K=(a.x2-a.x1)/(a.y2-a.y1);if(F>K){const L=(F-K)*(a.y2-a.y1)*.5;a.x1-=L,a.x2+=L}else{const L=a.x2-a.x1,H=a.y2-a.y1,G=(L-F*H)/F*.5;a.y1-=G,a.y2+=G}r.clearRect(0,0,r.canvas.width,r.canvas.height),r.strokeStyle="white";for(const L of t.value.connections){const[H,G]=Tu(Ua(L.from)),[P,j]=Tu(Ua(L.to)),[Y,Q]=c(H,G),[ae,te]=c(P,j);if(r.beginPath(),r.moveTo(Y,Q),e.value.settings.useStraightConnections)r.lineTo(ae,te);else{const Z=.3*Math.abs(Y-ae);r.bezierCurveTo(Y+Z,Q,ae-Z,te,ae,te)}r.stroke()}r.strokeStyle="lightgray";for(const[L,H]of R.entries()){const[G,P]=c(H.x1,H.y1),[j,Y]=c(H.x2,H.y2);r.fillStyle=f(S.get(L)),r.beginPath(),r.rect(G,P,j-G,Y-P),r.fill(),r.stroke()}if(s.value){const L=h(),[H,G]=c(L.x1,L.y1),[P,j]=c(L.x2,L.y2);r.fillStyle="rgba(255, 255, 255, 0.2)",r.fillRect(H,G,P-H,j-G)}},c=(x,O)=>[(x-a.x1)/(a.x2-a.x1)*r.canvas.width,(O-a.y1)/(a.y2-a.y1)*r.canvas.height],_=(x,O)=>[x*(a.x2-a.x1)/r.canvas.width+a.x1,O*(a.y2-a.y1)/r.canvas.height+a.y1],f=x=>{if(x){const O=x.querySelector(".__content");if(O){const S=m(O);if(S)return S}const R=m(x);if(R)return R}return"gray"},m=x=>{const O=getComputedStyle(x).backgroundColor;if(O&&O!=="rgba(0, 0, 0, 0)")return O},h=()=>{const x=i.value.parentElement.offsetWidth,O=i.value.parentElement.offsetHeight,R=x/t.value.scaling-t.value.panning.x,S=O/t.value.scaling-t.value.panning.y;return{x1:-t.value.panning.x,y1:-t.value.panning.y,x2:R,y2:S}},E=x=>{x.button===0&&(o=!0,b(x))},b=x=>{if(o){const[O,R]=_(x.offsetX,x.offsetY),S=h(),A=(S.x2-S.x1)/2,U=(S.y2-S.y1)/2;t.value.panning.x=-(O-A),t.value.panning.y=-(R-U)}},g=()=>{o=!1},v=()=>{s.value=!0},y=()=>{s.value=!1,g()};qn([s,t.value.panning,()=>t.value.scaling,()=>t.value.connections.length],()=>{d()});const T=it(()=>t.value.nodes.map(x=>x.position)),C=it(()=>t.value.nodes.map(x=>x.width));return qn([T,C],()=>{d()},{deep:!0}),qs(()=>{r=i.value.getContext("2d"),r.imageSmoothingQuality="high",d(),l=setInterval(d,500)}),Va(()=>{clearInterval(l)}),(x,O)=>(w(),M("canvas",{ref_key:"canvas",ref:i,class:"baklava-minimap",onMouseenter:v,onMouseleave:y,onMousedown:Te(E,["self"]),onMousemove:Te(b,["self"]),onMouseup:g},null,544))}}),KMt=pn({components:{ContextMenu:hv,VerticalDots:eM},props:{type:{type:String,required:!0},title:{type:String,required:!0}},setup(n){const{viewModel:e}=Oi(),{switchGraph:t}=Wi(),i=mt(!1),s=it(()=>n.type.startsWith(cc));return{showContextMenu:i,hasContextMenu:s,contextMenuItems:[{label:"Edit Subgraph",value:"editSubgraph"},{label:"Delete Subgraph",value:"deleteSubgraph"}],openContextMenu:()=>{i.value=!0},onContextMenuClick:l=>{const d=n.type.substring(cc.length),c=e.value.editor.graphTemplates.find(_=>_.id===d);if(c)switch(l){case"editSubgraph":t(c);break;case"deleteSubgraph":e.value.editor.removeGraphTemplate(c);break}}}}}),jMt=["data-node-type"],QMt={class:"__title"},XMt={class:"__title-label"},ZMt={key:0,class:"__menu"};function JMt(n,e,t,i,s,r){const o=ht("vertical-dots"),a=ht("context-menu");return w(),M("div",{class:"baklava-node --palette","data-node-type":n.type},[u("div",QMt,[u("div",XMt,fe(n.title),1),n.hasContextMenu?(w(),M("div",ZMt,[Oe(o,{class:"--clickable",onPointerdown:e[0]||(e[0]=Te(()=>{},["stop","prevent"])),onClick:Te(n.openContextMenu,["stop","prevent"])},null,8,["onClick"]),Oe(a,{modelValue:n.showContextMenu,"onUpdate:modelValue":e[1]||(e[1]=l=>n.showContextMenu=l),x:-100,y:0,items:n.contextMenuItems,onClick:n.onContextMenuClick,onPointerdown:e[2]||(e[2]=Te(()=>{},["stop","prevent"]))},null,8,["modelValue","items","onClick"])])):q("",!0)])],8,jMt)}const GR=_n(KMt,[["render",JMt]]),e2t={class:"baklava-node-palette"},t2t={key:0},n2t=pn({__name:"NodePalette",setup(n){const{viewModel:e}=Oi(),{x:t,y:i}=cMt(),{transform:s}=jI(),r=KI(e),o=Gi("editorEl"),a=mt(null),l=it(()=>{if(!a.value||!(o!=null&&o.value))return{};const{left:c,top:_}=o.value.getBoundingClientRect();return{top:`${i.value-_}px`,left:`${t.value-c}px`}}),d=(c,_)=>{a.value={type:c,nodeInformation:_};const f=()=>{const m=ei(new _.type);e.value.displayedGraph.addNode(m);const h=o.value.getBoundingClientRect(),[E,b]=s(t.value-h.left,i.value-h.top);m.position.x=E,m.position.y=b,a.value=null,document.removeEventListener("pointerup",f)};document.addEventListener("pointerup",f)};return(c,_)=>(w(),M($e,null,[u("div",e2t,[(w(!0),M($e,null,ct(vt(r),f=>(w(),M("section",{key:f.name},[f.name!=="default"?(w(),M("h1",t2t,fe(f.name),1)):q("",!0),(w(!0),M($e,null,ct(f.nodeTypes,(m,h)=>(w(),xt(GR,{key:h,type:h,title:m.title,onPointerdown:E=>d(h,m)},null,8,["type","title","onPointerdown"]))),128))]))),128))]),Oe(ls,{name:"fade"},{default:Je(()=>[a.value?(w(),M("div",{key:0,class:"baklava-dragged-node",style:en(l.value)},[Oe(GR,{type:a.value.type,title:a.value.nodeInformation.title},null,8,["type","title"])],4)):q("",!0)]),_:1})],64))}});let wd;const i2t=new Uint8Array(16);function s2t(){if(!wd&&(wd=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!wd))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return wd(i2t)}const Cn=[];for(let n=0;n<256;++n)Cn.push((n+256).toString(16).slice(1));function r2t(n,e=0){return Cn[n[e+0]]+Cn[n[e+1]]+Cn[n[e+2]]+Cn[n[e+3]]+"-"+Cn[n[e+4]]+Cn[n[e+5]]+"-"+Cn[n[e+6]]+Cn[n[e+7]]+"-"+Cn[n[e+8]]+Cn[n[e+9]]+"-"+Cn[n[e+10]]+Cn[n[e+11]]+Cn[n[e+12]]+Cn[n[e+13]]+Cn[n[e+14]]+Cn[n[e+15]]}const o2t=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),zR={randomUUID:o2t};function xu(n,e,t){if(zR.randomUUID&&!e&&!n)return zR.randomUUID();n=n||{};const i=n.random||(n.rng||s2t)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let s=0;s<16;++s)e[t+s]=i[s];return e}return r2t(i)}const dc="SAVE_SUBGRAPH";function a2t(n,e){const t=()=>{const i=n.value;if(!i.template)throw new Error("Graph template property not set");i.template.update(i.save()),i.template.panning=i.panning,i.template.scaling=i.scaling};e.registerCommand(dc,{canExecute:()=>{var i;return n.value!==((i=n.value.editor)==null?void 0:i.graph)},execute:t})}const l2t={},c2t={xmlns:"http://www.w3.org/2000/svg",class:"baklava-icon",width:"24",height:"24",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},d2t=u("polyline",{points:"6 9 12 15 18 9"},null,-1),u2t=[d2t];function p2t(n,e){return w(),M("svg",c2t,u2t)}const _2t=_n(l2t,[["render",p2t]]),h2t=pn({components:{"i-arrow":_2t},props:{intf:{type:Object,required:!0}},setup(n){const e=mt(null),t=mt(!1),i=it(()=>n.intf.items.find(o=>typeof o=="string"?o===n.intf.value:o.value===n.intf.value)),s=it(()=>i.value?typeof i.value=="string"?i.value:i.value.text:""),r=o=>{n.intf.value=typeof o=="string"?o:o.value};return ZI(e,()=>{t.value=!1}),{el:e,open:t,selectedItem:i,selectedText:s,setSelected:r}}}),f2t=["title"],m2t={class:"__selected"},g2t={class:"__text"},b2t={class:"__icon"},E2t={class:"__dropdown"},v2t={class:"item --header"},y2t=["onClick"];function S2t(n,e,t,i,s,r){const o=ht("i-arrow");return w(),M("div",{ref:"el",class:Ye(["baklava-select",{"--open":n.open}]),title:n.intf.name,onClick:e[0]||(e[0]=a=>n.open=!n.open)},[u("div",m2t,[u("div",g2t,fe(n.selectedText),1),u("div",b2t,[Oe(o)])]),Oe(ls,{name:"slide-fade"},{default:Je(()=>[ne(u("div",E2t,[u("div",v2t,fe(n.intf.name),1),(w(!0),M($e,null,ct(n.intf.items,(a,l)=>(w(),M("div",{key:l,class:Ye(["item",{"--active":a===n.selectedItem}]),onClick:d=>n.setSelected(a)},fe(typeof a=="string"?a:a.text),11,y2t))),128))],512),[[Ot,n.open]])]),_:1})],10,f2t)}const T2t=_n(h2t,[["render",S2t]]);class x2t extends tn{constructor(e,t,i){super(e,t),this.component=uc(T2t),this.items=i}}const C2t=pn({props:{intf:{type:Object,required:!0}}});function R2t(n,e,t,i,s,r){return w(),M("div",null,fe(n.intf.value),1)}const A2t=_n(C2t,[["render",R2t]]);class w2t extends tn{constructor(e,t){super(e,t),this.component=uc(A2t),this.setPort(!1)}}const N2t=pn({props:{intf:{type:Object,required:!0},modelValue:{type:String,required:!0}},emits:["update:modelValue"],setup(n,{emit:e}){return{v:it({get:()=>n.modelValue,set:i=>{e("update:modelValue",i)}})}}}),O2t=["placeholder","title"];function I2t(n,e,t,i,s,r){return w(),M("div",null,[ne(u("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>n.v=o),type:"text",class:"baklava-input",placeholder:n.intf.name,title:n.intf.name},null,8,O2t),[[Pe,n.v]])])}const M2t=_n(N2t,[["render",I2t]]);class Rc extends tn{constructor(){super(...arguments),this.component=uc(M2t)}}class nM extends VI{constructor(){super(...arguments),this._title="Subgraph Input",this.inputs={name:new Rc("Name","Input").setPort(!1)},this.outputs={placeholder:new tn("Connection",void 0)}}}class iM extends HI{constructor(){super(...arguments),this._title="Subgraph Output",this.inputs={name:new Rc("Name","Output").setPort(!1),placeholder:new tn("Connection",void 0)},this.outputs={output:new tn("Output",void 0).setHidden(!0)}}}const sM="CREATE_SUBGRAPH",VR=[ka,La];function D2t(n,e,t){const i=()=>n.value.selectedNodes.filter(r=>!VR.includes(r.type)).length>0,s=()=>{const{viewModel:r}=Oi(),o=n.value,a=n.value.editor;if(o.selectedNodes.length===0)return;const l=o.selectedNodes.filter(S=>!VR.includes(S.type)),d=l.flatMap(S=>Object.values(S.inputs)),c=l.flatMap(S=>Object.values(S.outputs)),_=o.connections.filter(S=>!c.includes(S.from)&&d.includes(S.to)),f=o.connections.filter(S=>c.includes(S.from)&&!d.includes(S.to)),m=o.connections.filter(S=>c.includes(S.from)&&d.includes(S.to)),h=l.map(S=>S.save()),E=m.map(S=>({id:S.id,from:S.from.id,to:S.to.id})),b=new Map,{xLeft:g,xRight:v,yTop:y}=k2t(l);console.log(g,v,y);for(const[S,A]of _.entries()){const U=new nM;U.inputs.name.value=A.to.name,h.push({...U.save(),position:{x:v-r.value.settings.nodes.defaultWidth-100,y:y+S*200}}),E.push({id:xu(),from:U.outputs.placeholder.id,to:A.to.id}),b.set(A.to.id,U.graphInterfaceId)}for(const[S,A]of f.entries()){const U=new iM;U.inputs.name.value=A.from.name,h.push({...U.save(),position:{x:g+100,y:y+S*200}}),E.push({id:xu(),from:A.from.id,to:U.inputs.placeholder.id}),b.set(A.from.id,U.graphInterfaceId)}const T=ei(new gp({connections:E,nodes:h,inputs:[],outputs:[]},a));a.addGraphTemplate(T);const C=a.nodeTypes.get(Pa(T));if(!C)throw new Error("Unable to create subgraph: Could not find corresponding graph node type");const x=ei(new C.type);o.addNode(x);const O=Math.round(l.map(S=>S.position.x).reduce((S,A)=>S+A,0)/l.length),R=Math.round(l.map(S=>S.position.y).reduce((S,A)=>S+A,0)/l.length);x.position.x=O,x.position.y=R,_.forEach(S=>{o.removeConnection(S),o.addConnection(S.from,x.inputs[b.get(S.to.id)])}),f.forEach(S=>{o.removeConnection(S),o.addConnection(x.outputs[b.get(S.from.id)],S.to)}),l.forEach(S=>o.removeNode(S)),e.canExecuteCommand(dc)&&e.executeCommand(dc),t(T),n.value.panning={...o.panning},n.value.scaling=o.scaling};e.registerCommand(sM,{canExecute:i,execute:s})}function k2t(n){const e=n.reduce((s,r)=>{const o=r.position.x;return o{const o=r.position.y;return o{const o=r.position.x+r.width;return o>s?o:s},-1/0),xRight:e,yTop:t}}const HR="DELETE_NODES";function L2t(n,e){e.registerCommand(HR,{canExecute:()=>n.value.selectedNodes.length>0,execute(){n.value.selectedNodes.forEach(t=>n.value.removeNode(t))}}),e.registerHotkey(["Delete"],HR)}const rM="SWITCH_TO_MAIN_GRAPH";function P2t(n,e,t){e.registerCommand(rM,{canExecute:()=>n.value!==n.value.editor.graph,execute:()=>{e.executeCommand(dc),t(n.value.editor.graph)}})}function U2t(n,e,t){L2t(n,e),D2t(n,e,t),a2t(n,e),P2t(n,e,t)}class qR{constructor(e,t){this.type=e,e==="addNode"?this.nodeId=t:this.nodeState=t}undo(e){this.type==="addNode"?this.removeNode(e):this.addNode(e)}redo(e){this.type==="addNode"&&this.nodeState?this.addNode(e):this.type==="removeNode"&&this.nodeId&&this.removeNode(e)}addNode(e){const t=e.editor.nodeTypes.get(this.nodeState.type);if(!t)return;const i=new t.type;e.addNode(i),i.load(this.nodeState),this.nodeId=i.id}removeNode(e){const t=e.nodes.find(i=>i.id===this.nodeId);t&&(this.nodeState=t.save(),e.removeNode(t))}}class YR{constructor(e,t){if(this.type=e,e==="addConnection")this.connectionId=t;else{const i=t;this.connectionState={id:i.id,from:i.from.id,to:i.to.id}}}undo(e){this.type==="addConnection"?this.removeConnection(e):this.addConnection(e)}redo(e){this.type==="addConnection"&&this.connectionState?this.addConnection(e):this.type==="removeConnection"&&this.connectionId&&this.removeConnection(e)}addConnection(e){const t=e.findNodeInterface(this.connectionState.from),i=e.findNodeInterface(this.connectionState.to);!t||!i||e.addConnection(t,i)}removeConnection(e){const t=e.connections.find(i=>i.id===this.connectionId);t&&(this.connectionState={id:t.id,from:t.from.id,to:t.to.id},e.removeConnection(t))}}class F2t{constructor(e){if(this.type="transaction",e.length===0)throw new Error("Can't create a transaction with no steps");this.steps=e}undo(e){for(let t=this.steps.length-1;t>=0;t--)this.steps[t].undo(e)}redo(e){for(let t=0;t{if(!r.value)if(a.value)l.value.push(b);else for(o.value!==s.value.length-1&&(s.value=s.value.slice(0,o.value+1)),s.value.push(b),o.value++;s.value.length>i.value;)s.value.shift()},c=()=>{a.value=!0},_=()=>{a.value=!1,l.value.length>0&&(d(new F2t(l.value)),l.value=[])},f=()=>s.value.length!==0&&o.value!==-1,m=()=>{f()&&(r.value=!0,s.value[o.value--].undo(n.value),r.value=!1)},h=()=>s.value.length!==0&&o.value{h()&&(r.value=!0,s.value[++o.value].redo(n.value),r.value=!1)};return qn(n,(b,g)=>{g&&(g.events.addNode.unsubscribe(t),g.events.removeNode.unsubscribe(t),g.events.addConnection.unsubscribe(t),g.events.removeConnection.unsubscribe(t)),b&&(b.events.addNode.subscribe(t,v=>{d(new qR("addNode",v.id))}),b.events.removeNode.subscribe(t,v=>{d(new qR("removeNode",v.save()))}),b.events.addConnection.subscribe(t,v=>{d(new YR("addConnection",v.id))}),b.events.removeConnection.subscribe(t,v=>{d(new YR("removeConnection",v))}))},{immediate:!0}),e.registerCommand(Tb,{canExecute:f,execute:m}),e.registerCommand(xb,{canExecute:h,execute:E}),e.registerCommand(oM,{canExecute:()=>!a.value,execute:c}),e.registerCommand(aM,{canExecute:()=>a.value,execute:_}),e.registerHotkey(["Control","z"],Tb),e.registerHotkey(["Control","y"],xb),ei({maxSteps:i})}const Cb="COPY",Rb="PASTE",G2t="CLEAR_CLIPBOARD";function z2t(n,e,t){const i=Symbol("ClipboardToken"),s=mt(""),r=mt(""),o=it(()=>!s.value),a=()=>{s.value="",r.value=""},l=()=>{const _=n.value.selectedNodes.flatMap(m=>[...Object.values(m.inputs),...Object.values(m.outputs)]),f=n.value.connections.filter(m=>_.includes(m.from)||_.includes(m.to)).map(m=>({from:m.from.id,to:m.to.id}));r.value=JSON.stringify(f),s.value=JSON.stringify(n.value.selectedNodes.map(m=>m.save()))},d=(_,f,m)=>{for(const h of _){let E;if((!m||m==="input")&&(E=Object.values(h.inputs).find(b=>b.id===f)),!E&&(!m||m==="output")&&(E=Object.values(h.outputs).find(b=>b.id===f)),E)return E}},c=()=>{if(o.value)return;const _=new Map,f=JSON.parse(s.value),m=JSON.parse(r.value),h=[],E=[],b=n.value;t.executeCommand(oM);for(const g of f){const v=e.value.nodeTypes.get(g.type);if(!v){console.warn(`Node type ${g.type} not registered`);return}const y=new v.type,T=y.id;h.push(y),y.hooks.beforeLoad.subscribe(i,C=>{const x=C;return x.position&&(x.position.x+=100,x.position.y+=100),y.hooks.beforeLoad.unsubscribe(i),x}),b.addNode(y),y.load({...g,id:T}),y.id=T,_.set(g.id,T);for(const C of Object.values(y.inputs)){const x=xu();_.set(C.id,x),C.id=x}for(const C of Object.values(y.outputs)){const x=xu();_.set(C.id,x),C.id=x}}for(const g of m){const v=d(h,_.get(g.from),"output"),y=d(h,_.get(g.to),"input");if(!v||!y)continue;const T=b.addConnection(v,y);T&&E.push(T)}return n.value.selectedNodes=h,t.executeCommand(aM),{newNodes:h,newConnections:E}};return t.registerCommand(Cb,{canExecute:()=>n.value.selectedNodes.length>0,execute:l}),t.registerHotkey(["Control","c"],Cb),t.registerCommand(Rb,{canExecute:()=>!o.value,execute:c}),t.registerHotkey(["Control","v"],Rb),t.registerCommand(G2t,{canExecute:()=>!0,execute:a}),ei({isEmpty:o})}const V2t="OPEN_SIDEBAR";function H2t(n,e){e.registerCommand(V2t,{execute:t=>{n.value.sidebar.nodeId=t,n.value.sidebar.visible=!0},canExecute:()=>!0})}function q2t(n,e){H2t(n,e)}const Y2t={},$2t={xmlns:"http://www.w3.org/2000/svg",class:"baklava-icon",width:"24",height:"24",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},W2t=u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),K2t=u("path",{d:"M9 13l-4 -4l4 -4m-4 4h11a4 4 0 0 1 0 8h-1"},null,-1),j2t=[W2t,K2t];function Q2t(n,e){return w(),M("svg",$2t,j2t)}const X2t=_n(Y2t,[["render",Q2t]]),Z2t={},J2t={xmlns:"http://www.w3.org/2000/svg",class:"baklava-icon",width:"24",height:"24",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},eDt=u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),tDt=u("path",{d:"M15 13l4 -4l-4 -4m4 4h-11a4 4 0 0 0 0 8h1"},null,-1),nDt=[eDt,tDt];function iDt(n,e){return w(),M("svg",J2t,nDt)}const sDt=_n(Z2t,[["render",iDt]]),rDt={},oDt={xmlns:"http://www.w3.org/2000/svg",class:"baklava-icon",width:"24",height:"24",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},aDt=u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),lDt=u("line",{x1:"5",y1:"12",x2:"19",y2:"12"},null,-1),cDt=u("line",{x1:"5",y1:"12",x2:"11",y2:"18"},null,-1),dDt=u("line",{x1:"5",y1:"12",x2:"11",y2:"6"},null,-1),uDt=[aDt,lDt,cDt,dDt];function pDt(n,e){return w(),M("svg",oDt,uDt)}const _Dt=_n(rDt,[["render",pDt]]),hDt={},fDt={xmlns:"http://www.w3.org/2000/svg",class:"baklava-icon",width:"24",height:"24",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},mDt=u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),gDt=u("path",{d:"M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2"},null,-1),bDt=u("rect",{x:"9",y:"3",width:"6",height:"4",rx:"2"},null,-1),EDt=[mDt,gDt,bDt];function vDt(n,e){return w(),M("svg",fDt,EDt)}const yDt=_n(hDt,[["render",vDt]]),SDt={},TDt={xmlns:"http://www.w3.org/2000/svg",class:"baklava-icon",width:"24",height:"24",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},xDt=u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),CDt=u("rect",{x:"8",y:"8",width:"12",height:"12",rx:"2"},null,-1),RDt=u("path",{d:"M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"},null,-1),ADt=[xDt,CDt,RDt];function wDt(n,e){return w(),M("svg",TDt,ADt)}const NDt=_n(SDt,[["render",wDt]]),ODt={},IDt={xmlns:"http://www.w3.org/2000/svg",class:"baklava-icon",width:"24",height:"24",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},MDt=u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),DDt=u("path",{d:"M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2"},null,-1),kDt=u("circle",{cx:"12",cy:"14",r:"2"},null,-1),LDt=u("polyline",{points:"14 4 14 8 8 8 8 4"},null,-1),PDt=[MDt,DDt,kDt,LDt];function UDt(n,e){return w(),M("svg",IDt,PDt)}const FDt=_n(ODt,[["render",UDt]]),BDt={},GDt={xmlns:"http://www.w3.org/2000/svg",class:"baklava-icon",width:"24",height:"24",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},zDt=zu('',6),VDt=[zDt];function HDt(n,e){return w(),M("svg",GDt,VDt)}const qDt=_n(BDt,[["render",HDt]]),YDt=pn({props:{command:{type:String,required:!0},title:{type:String,required:!0},icon:{type:Object,required:!1,default:void 0}},setup(){const{viewModel:n}=Oi();return{viewModel:n}}}),$Dt=["disabled","title"];function WDt(n,e,t,i,s,r){return w(),M("button",{class:"baklava-toolbar-entry baklava-toolbar-button",disabled:!n.viewModel.commandHandler.canExecuteCommand(n.command),title:n.title,onClick:e[0]||(e[0]=o=>n.viewModel.commandHandler.executeCommand(n.command))},[n.icon?(w(),xt(Fu(n.icon),{key:0})):(w(),M($e,{key:1},[je(fe(n.title),1)],64))],8,$Dt)}const KDt=_n(YDt,[["render",WDt]]),jDt=pn({components:{ToolbarButton:KDt},setup(){const{viewModel:n}=Oi();return{isSubgraph:it(()=>n.value.displayedGraph!==n.value.editor.graph),commands:[{command:Cb,title:"Copy",icon:NDt},{command:Rb,title:"Paste",icon:yDt},{command:Tb,title:"Undo",icon:X2t},{command:xb,title:"Redo",icon:sDt},{command:sM,title:"Create Subgraph",icon:qDt}],subgraphCommands:[{command:dc,title:"Save Subgraph",icon:FDt},{command:rM,title:"Back to Main Graph",icon:_Dt}]}}}),QDt={class:"baklava-toolbar"};function XDt(n,e,t,i,s,r){const o=ht("toolbar-button");return w(),M("div",QDt,[(w(!0),M($e,null,ct(n.commands,a=>(w(),xt(o,{key:a.command,command:a.command,title:a.title,icon:a.icon},null,8,["command","title","icon"]))),128)),n.isSubgraph?(w(!0),M($e,{key:0},ct(n.subgraphCommands,a=>(w(),xt(o,{key:a.command,command:a.command,title:a.title,icon:a.icon},null,8,["command","title","icon"]))),128)):q("",!0)])}const ZDt=_n(jDt,[["render",XDt]]),JDt={class:"connections-container"},ekt=pn({__name:"Editor",props:{viewModel:{}},setup(n){const e=n,t=Symbol("EditorToken"),i=jd(e,"viewModel");KIt(i);const s=mt(null);sa("editorEl",s);const r=it(()=>e.viewModel.displayedGraph.nodes),o=it(()=>e.viewModel.displayedGraph.nodes.map(O=>$I(jd(O,"position")))),a=it(()=>e.viewModel.displayedGraph.connections),l=it(()=>e.viewModel.displayedGraph.selectedNodes),d=jIt(),c=QIt(),_=XIt(i),f=it(()=>({...d.styles.value})),m=mt(0);e.viewModel.editor.hooks.load.subscribe(t,O=>(m.value++,O));const h=O=>{d.onPointerMove(O),c.onMouseMove(O)},E=O=>{O.button===0&&(O.target===s.value&&(T(),d.onPointerDown(O)),c.onMouseDown())},b=O=>{d.onPointerUp(O),c.onMouseUp()},g=O=>{O.key==="Tab"&&O.preventDefault(),e.viewModel.commandHandler.handleKeyDown(O)},v=O=>{e.viewModel.commandHandler.handleKeyUp(O)},y=O=>{["Control","Shift"].some(R=>e.viewModel.commandHandler.pressedKeys.includes(R))||T(),e.viewModel.displayedGraph.selectedNodes.push(O)},T=()=>{e.viewModel.displayedGraph.selectedNodes=[]},C=O=>{for(const R of e.viewModel.displayedGraph.selectedNodes){const S=r.value.indexOf(R),A=o.value[S];A.onPointerDown(O),document.addEventListener("pointermove",A.onPointerMove)}document.addEventListener("pointerup",x)},x=()=>{for(const O of e.viewModel.displayedGraph.selectedNodes){const R=r.value.indexOf(O),S=o.value[R];S.onPointerUp(),document.removeEventListener("pointermove",S.onPointerMove)}document.removeEventListener("pointerup",x)};return(O,R)=>(w(),M("div",{ref_key:"el",ref:s,tabindex:"-1",class:Ye(["baklava-editor",{"baklava-ignore-mouse":!!vt(c).temporaryConnection.value||vt(d).dragging.value,"--temporary-connection":!!vt(c).temporaryConnection.value}]),onPointermove:Te(h,["self"]),onPointerdown:E,onPointerup:b,onWheel:R[1]||(R[1]=Te((...S)=>vt(d).onMouseWheel&&vt(d).onMouseWheel(...S),["self"])),onKeydown:g,onKeyup:v,onContextmenu:R[2]||(R[2]=Te((...S)=>vt(_).open&&vt(_).open(...S),["self","prevent"]))},[Dn(O.$slots,"background",{},()=>[Oe(eMt)]),Dn(O.$slots,"toolbar",{},()=>[Oe(ZDt)]),Dn(O.$slots,"palette",{},()=>[Oe(n2t)]),(w(),M("svg",JDt,[(w(!0),M($e,null,ct(a.value,S=>(w(),M("g",{key:S.id+m.value.toString()},[Dn(O.$slots,"connection",{connection:S},()=>[Oe(FMt,{connection:S},null,8,["connection"])])]))),128)),Dn(O.$slots,"temporaryConnection",{temporaryConnection:vt(c).temporaryConnection.value},()=>[vt(c).temporaryConnection.value?(w(),xt(zMt,{key:0,connection:vt(c).temporaryConnection.value},null,8,["connection"])):q("",!0)])])),u("div",{class:"node-container",style:en(f.value)},[Oe(rs,{name:"fade"},{default:Je(()=>[(w(!0),M($e,null,ct(r.value,(S,A)=>Dn(O.$slots,"node",{key:S.id+m.value.toString(),node:S,selected:l.value.includes(S),dragging:o.value[A].dragging.value,onSelect:U=>y(S),onStartDrag:C},()=>[Oe(IMt,{node:S,selected:l.value.includes(S),dragging:o.value[A].dragging.value,onSelect:U=>y(S),onStartDrag:C},null,8,["node","selected","dragging","onSelect"])])),128))]),_:3})],4),Dn(O.$slots,"sidebar",{},()=>[Oe($Mt)]),Dn(O.$slots,"minimap",{},()=>[O.viewModel.settings.enableMinimap?(w(),xt(WMt,{key:0})):q("",!0)]),Dn(O.$slots,"contextMenu",{contextMenu:vt(_)},()=>[O.viewModel.settings.contextMenu.enabled?(w(),xt(hv,{key:0,modelValue:vt(_).show.value,"onUpdate:modelValue":R[0]||(R[0]=S=>vt(_).show.value=S),items:vt(_).items.value,x:vt(_).x.value,y:vt(_).y.value,onClick:vt(_).onClick},null,8,["modelValue","items","x","y","onClick"])):q("",!0)])],34))}}),tkt=["INPUT","TEXTAREA","SELECT"];function nkt(n){const e=mt([]),t=mt([]);return{pressedKeys:e,handleKeyDown:o=>{var a;e.value.includes(o.key)||e.value.push(o.key),!tkt.includes(((a=document.activeElement)==null?void 0:a.tagName)??"")&&t.value.forEach(l=>{l.keys.every(d=>e.value.includes(d))&&n(l.commandName)})},handleKeyUp:o=>{const a=e.value.indexOf(o.key);a>=0&&e.value.splice(a,1)},registerHotkey:(o,a)=>{t.value.push({keys:o,commandName:a})}}}const ikt=()=>{const n=mt(new Map),e=(r,o)=>{if(n.value.has(r))throw new Error(`Command "${r}" already exists`);n.value.set(r,o)},t=(r,o=!1,...a)=>{if(!n.value.has(r)){if(o)throw new Error(`[CommandHandler] Command ${r} not registered`);return}return n.value.get(r).execute(...a)},i=(r,o=!1,...a)=>{if(!n.value.has(r)){if(o)throw new Error(`[CommandHandler] Command ${r} not registered`);return!1}return n.value.get(r).canExecute(a)},s=nkt(t);return ei({registerCommand:e,executeCommand:t,canExecuteCommand:i,...s})},skt=n=>!(n instanceof Cc);function rkt(n,e){return{switchGraph:i=>{let s;if(skt(i))s=new Cc(n.value),i.createGraph(s);else{if(i!==n.value.graph)throw new Error("Can only switch using 'Graph' instance when it is the root graph. Otherwise a 'GraphTemplate' must be used.");s=i}e.value&&e.value!==n.value.graph&&e.value.destroy(),s.panning=s.panning??i.panning??{x:0,y:0},s.scaling=s.scaling??i.scaling??1,s.selectedNodes=s.selectedNodes??[],s.sidebar=s.sidebar??{visible:!1,nodeId:"",optionName:""},e.value=s}}}function okt(n,e){n.position=n.position??{x:0,y:0},n.disablePointerEvents=!1,n.twoColumn=n.twoColumn??!1,n.width=n.width??e.defaultWidth}const akt=()=>({useStraightConnections:!1,enableMinimap:!1,background:{gridSize:100,gridDivision:5,subGridVisibleThreshold:.6},sidebar:{width:300,resizable:!0},displayValueOnHover:!1,nodes:{defaultWidth:200,maxWidth:320,minWidth:150,resizable:!1},contextMenu:{enabled:!0,additionalItems:[]}});function lkt(n){const e=mt(n??new VIt),t=Symbol("ViewModelToken"),i=mt(null),s=d2(i),{switchGraph:r}=rkt(e,i),o=it(()=>s.value&&s.value!==e.value.graph),a=ei(akt()),l=ikt(),d=B2t(s,l),c=z2t(s,e,l),_={renderNode:new li(null),renderInterface:new li(null)};return U2t(s,l,r),q2t(s,l),qn(e,(f,m)=>{m&&(m.events.registerGraph.unsubscribe(t),m.graphEvents.beforeAddNode.unsubscribe(t),f.nodeHooks.beforeLoad.unsubscribe(t),f.nodeHooks.afterSave.unsubscribe(t),f.graphTemplateHooks.beforeLoad.unsubscribe(t),f.graphTemplateHooks.afterSave.unsubscribe(t),f.graph.hooks.load.unsubscribe(t),f.graph.hooks.save.unsubscribe(t)),f&&(f.nodeHooks.beforeLoad.subscribe(t,(h,E)=>(E.position=h.position??{x:0,y:0},E.width=h.width??a.nodes.defaultWidth,E.twoColumn=h.twoColumn??!1,h)),f.nodeHooks.afterSave.subscribe(t,(h,E)=>(h.position=E.position,h.width=E.width,h.twoColumn=E.twoColumn,h)),f.graphTemplateHooks.beforeLoad.subscribe(t,(h,E)=>(E.panning=h.panning,E.scaling=h.scaling,h)),f.graphTemplateHooks.afterSave.subscribe(t,(h,E)=>(h.panning=E.panning,h.scaling=E.scaling,h)),f.graph.hooks.load.subscribe(t,(h,E)=>(E.panning=h.panning,E.scaling=h.scaling,h)),f.graph.hooks.save.subscribe(t,(h,E)=>(h.panning=E.panning,h.scaling=E.scaling,h)),f.graphEvents.beforeAddNode.subscribe(t,h=>okt(h,{defaultWidth:a.nodes.defaultWidth})),e.value.registerNodeType(nM,{category:"Subgraphs"}),e.value.registerNodeType(iM,{category:"Subgraphs"}),r(f.graph))},{immediate:!0}),ei({editor:e,displayedGraph:s,isSubgraph:o,settings:a,commandHandler:l,history:d,clipboard:c,hooks:_,switchGraph:r})}const ckt=el({type:"PersonalityNode",title:"Personality",inputs:{request:()=>new tn("Request",""),agent_name:()=>new x2t("Personality","",Cu.state.config.personalities).setPort(!1)},outputs:{response:()=>new tn("Response","")},async calculate({request:n}){console.log(Cu.state.config.personalities);let e="";try{e=(await Me.post("/generate",{params:{text:n}})).data}catch(t){console.error(t)}return{display:e,response:e}}}),dkt=el({type:"RAGNode",title:"RAG",inputs:{request:()=>new tn("Prompt",""),document_path:()=>new Rc("Document path","").setPort(!1)},outputs:{prompt:()=>new tn("Prompt with Data","")},async calculate({request:n,document_path:e}){let t="";try{t=(await Me.get("/rag",{params:{text:n,doc_path:e}})).data}catch(i){console.error(i)}return{response:t}}}),$R=el({type:"Task",title:"Task",inputs:{description:()=>new Rc("Task description","").setPort(!1)},outputs:{prompt:()=>new tn("Prompt")},calculate({description:n}){return{prompt:n}}}),WR=el({type:"TextDisplayNode",title:"TextDisplay",inputs:{text2display:()=>new tn("Input","")},outputs:{response:()=>new w2t("Text","")},async calculate({request:n}){}}),KR=el({type:"LLMNode",title:"LLM",inputs:{request:()=>new tn("Request","")},outputs:{response:()=>new tn("Response","")},async calculate({request:n}){console.log(Cu.state.config.personalities);let e="";try{e=(await Me.post("/generate",{params:{text:n}})).data}catch(t){console.error(t)}return{display:e,response:e}}}),ukt=el({type:"MultichoiceNode",title:"Multichoice",inputs:{question:()=>new tn("Question",""),outputs:()=>new Rc("choices, one per line","","").setPort(!1)},outputs:{response:()=>new tn("Response","")}}),pkt=pn({components:{"baklava-editor":ekt},setup(){const n=lkt(),e=new WIt(n.editor);n.editor.registerNodeType(ckt),n.editor.registerNodeType($R),n.editor.registerNodeType(dkt),n.editor.registerNodeType(WR),n.editor.registerNodeType(KR),n.editor.registerNodeType(ukt);const t=Symbol();e.events.afterRun.subscribe(t,a=>{e.pause(),HIt(a,n.editor),e.resume()}),e.start();function i(a,l,d){const c=new a;return n.displayedGraph.addNode(c),c.position.x=l,c.position.y=d,c}const s=i($R,300,140),r=i(KR,550,140),o=i(WR,850,140);return n.displayedGraph.addConnection(s.outputs.prompt,r.inputs.request),n.displayedGraph.addConnection(r.outputs.response,o.inputs.text2display),{baklava:n,saveGraph:()=>{const a=e.export();localStorage.setItem("myGraph",JSON.stringify(a))},loadGraph:()=>{const a=JSON.parse(localStorage.getItem("myGraph"));e.import(a)}}}}),_kt={style:{width:"100vw",height:"100vh"}};function hkt(n,e,t,i,s,r){const o=ht("baklava-editor");return w(),M("div",_kt,[Oe(o,{"view-model":n.baklava},null,8,["view-model"]),u("button",{onClick:e[0]||(e[0]=(...a)=>n.saveGraph&&n.saveGraph(...a))},"Save Graph"),u("button",{onClick:e[1]||(e[1]=(...a)=>n.loadGraph&&n.loadGraph(...a))},"Load Graph")])}const fkt=bt(pkt,[["render",hkt]]),mkt={},gkt={style:{width:"100vw",height:"100vh"}},bkt=["src"];function Ekt(n,e,t,i,s,r){return w(),M("div",gkt,[u("iframe",{src:n.$store.state.config.comfyui_base_url,class:"m-0 p-0 w-full h-full"},null,8,bkt)])}const vkt=bt(mkt,[["render",Ekt]]),ykt=jP({history:_P("/"),routes:[{path:"/comfyui_view/",name:"ComfyUI",component:vkt},{path:"/playground/",name:"playground",component:ytt},{path:"/extensions/",name:"extensions",component:Mtt},{path:"/help/",name:"help",component:Ztt},{path:"/settings/",name:"settings",component:Amt},{path:"/training/",name:"training",component:Kmt},{path:"/quantizing/",name:"quantizing",component:igt},{path:"/",name:"discussions",component:Ext},{path:"/",name:"interactive",component:LIt},{path:"/",name:"nodes",component:fkt}]});const bp=tk(yZe);console.log("Loaded main.js");function jR(n){const e={};for(const t in n)n.hasOwnProperty(t)&&(e[t]=n[t]);return e}const Cu=Ak({state(){return{currentTheme:"",personality_editor:null,showPersonalityEditor:!1,selectedPersonality:null,currentPersonConfig:{ai_name:"",ai_author:"",ai_category:"",ai_language:"",ai_description:"",ai_conditionning:"",ai_disclaimer:"",ai_icon:null},client_id:"",yesNoDialog:null,universalForm:null,toast:null,news:null,messageBox:null,api_get_req:null,startSpeechRecognition:null,ready:!1,loading_infos:"",loading_progress:0,version:"unknown",settingsChanged:!1,isConnected:!1,isModelOk:!1,isGenerating:!1,config:null,mountedPers:null,mountedPersArr:[],mountedExtensions:[],bindingsZoo:[],modelsArr:[],selectedModel:null,personalities:[],diskUsage:null,ramUsage:null,vramUsage:null,modelsZoo:[],installedModels:[],installedBindings:[],currentModel:null,currentBinding:null,extensionsZoo:[],databases:[]}},mutations:{setIsReady(n,e){n.ready=e},setIsConnected(n,e){n.isConnected=e},setIsModelOk(n,e){n.isModelOk=e},setIsGenerating(n,e){n.isGenerating=e},setConfig(n,e){n.config=e},setPersonalities(n,e){n.personalities=e},setMountedPers(n,e){n.mountedPers=e},setMountedPersArr(n,e){n.mountedPersArr=e},setMountedExtensions(n,e){n.mountedExtensions=e},setbindingsZoo(n,e){n.bindingsZoo=e},setModelsArr(n,e){n.modelsArr=e},setselectedModel(n,e){n.selectedModel=e},setDiskUsage(n,e){n.diskUsage=e},setRamUsage(n,e){n.ramUsage=e},setVramUsage(n,e){n.vramUsage=e},setModelsZoo(n,e){n.modelsZoo=e},setCurrentBinding(n,e){n.currentBinding=e},setCurrentModel(n,e){n.currentModel=e},setExtensionsZoo(n,e){n.extensionsZoo=e},setDatabases(n,e){n.databases=e},setTheme(n){this.currentTheme=n}},getters:{getIsConnected(n){return n.isConnected},getIsModelOk(n){return n.isModelOk},getIsGenerating(n){return n.isGenerating},getConfig(n){return n.config},getPersonalities(n){return n.personalities},getMountedPersArr(n){return n.mountedPersArr},getmmountedExtensions(n){return n.mountedExtensions},getMountedPers(n){return n.mountedPers},getbindingsZoo(n){return n.bindingsZoo},getModelsArr(n){return n.modelsArr},getDiskUsage(n){return n.diskUsage},getRamUsage(n){return n.ramUsage},getVramUsage(n){return n.vramUsage},getDatabasesList(n){return n.databases},getModelsZoo(n){return n.modelsZoo},getCyrrentBinding(n){return n.currentBinding},getCurrentModel(n){return n.currentModel},getExtensionsZoo(n){return n.extensionsZoo}},actions:{async getVersion(){try{let n=await Me.get("/get_lollms_webui_version",{});n&&(this.state.version=n.data,console.log("version res:",n),console.log("version :",this.state.version))}catch{console.log("Coudln't get version")}},async refreshConfig({commit:n}){console.log("Fetching configuration");try{const e=await _i("get_config");e.active_personality_id<0&&(e.active_personality_id=0);let t=e.personalities[e.active_personality_id].split("/");e.personality_category=t[0],e.personality_folder=t[1],e.extensions.length>0?e.extension_category=e.extensions[-1]:e.extension_category="ai_sensors",console.log("Recovered config"),console.log(e),console.log("Committing config"),console.log(e),console.log(this.state.config),n("setConfig",e)}catch(e){console.log(e.message,"refreshConfig")}},async refreshDatabase({commit:n}){let e=await _i("list_databases");console.log("databases:",e),n("setDatabases",e)},async refreshPersonalitiesZoo({commit:n}){let e=[];const t=await _i("get_all_personalities"),i=Object.keys(t);console.log("Personalities recovered:"+this.state.config.personalities);for(let s=0;s{let d=!1;for(const _ of this.state.config.personalities)if(_.includes(r+"/"+l.folder))if(d=!0,_.includes(":")){const f=_.split(":");l.language=f[1]}else l.language=null;let c={};return c=l,c.category=r,c.full_path=r+"/"+l.folder,c.isMounted=d,c});e.length==0?e=a:e=e.concat(a)}e.sort((s,r)=>s.name.localeCompare(r.name)),n("setPersonalities",e),console.log("Done loading personalities")},refreshMountedPersonalities({commit:n}){this.state.config.active_personality_id<0&&(this.state.config.active_personality_id=0);let e=[];const t=[];for(let i=0;ia.full_path==s||a.full_path==r[0]);if(o>=0){let a=jR(this.state.personalities[o]);r.length>1&&(a.language=r[1]),a?e.push(a):e.push(this.state.personalities[this.state.personalities.findIndex(l=>l.full_path=="generic/lollms")])}else t.push(i),console.log("Couldn't load personality : ",s)}for(let i=t.length-1;i>=0;i--)console.log("Removing personality : ",this.state.config.personalities[t[i]]),this.state.config.personalities.splice(t[i],1),this.state.config.active_personality_id>t[i]&&(this.state.config.active_personality_id-=1);n("setMountedPersArr",e),this.state.mountedPers=this.state.personalities[this.state.personalities.findIndex(i=>i.full_path==this.state.config.personalities[this.state.config.active_personality_id]||i.full_path+":"+i.language==this.state.config.personalities[this.state.config.active_personality_id])]},async refreshBindings({commit:n}){let e=await _i("list_bindings");console.log("Loaded bindings zoo :",e),this.state.installedBindings=e.filter(i=>i.installed),console.log("Loaded bindings zoo ",this.state.installedBindings),n("setbindingsZoo",e);const t=e.findIndex(i=>i.name==this.state.config.binding_name);t!=-1&&n("setCurrentBinding",e[t])},async refreshModelsZoo({commit:n}){console.log("Fetching models");const t=(await Me.get("/get_available_models")).data.filter(i=>i.variants&&i.variants.length>0);console.log(`get_available_models: ${t}`),n("setModelsZoo",t)},async refreshModelStatus({commit:n}){let e=await _i("get_model_status");n("setIsModelOk",e.status)},async refreshModels({commit:n}){console.log("Fetching models");let e=await _i("list_models");console.log(`Found ${e}`);let t=await _i("get_active_model");console.log("Selected model ",t),t!=null&&n("setselectedModel",t.model),n("setModelsArr",e),console.log("setModelsArr",e),console.log("this.state.modelsZoo",this.state.modelsZoo),this.state.modelsZoo.map(s=>{s.isInstalled=e.includes(s.name)}),this.state.installedModels=this.state.modelsZoo.filter(s=>s.isInstalled);const i=this.state.modelsZoo.findIndex(s=>s.name==this.state.config.model_name);i!=-1&&n("setCurrentModel",this.state.modelsZoo[i])},async refreshExtensionsZoo({commit:n}){let e=[],t=await _i("list_extensions");const i=Object.keys(t);console.log("Extensions recovered:"+t);for(let s=0;s{let d=!1;for(const _ of this.state.config.extensions)_.includes(r+"/"+l.folder)&&(d=!0);let c={};return c=l,c.category=r,c.full_path=r+"/"+l.folder,c.isMounted=d,c});e.length==0?e=a:e=e.concat(a)}e.sort((s,r)=>s.name.localeCompare(r.name)),console.log("Done loading extensions"),n("setExtensionsZoo",e)},refreshmountedExtensions({commit:n}){console.log("Mounting extensions");let e=[];const t=[];for(let i=0;io.full_path==s);if(r>=0){let o=jR(this.state.config.extensions[r]);o&&e.push(o)}else t.push(i),console.log("Couldn't load extension : ",s)}for(let i=t.length-1;i>=0;i--)console.log("Removing extensions : ",this.state.config.extensions[t[i]]),this.state.config.extensions.splice(t[i],1);n("setMountedExtensions",e)},async refreshDiskUsage({commit:n}){this.state.diskUsage=await _i("disk_usage")},async refreshRamUsage({commit:n}){this.state.ramUsage=await _i("ram_usage")},async refreshVramUsage({commit:n}){const e=await _i("vram_usage"),t=[];if(e.nb_gpus>0){for(let s=0;s!!t.value),onPointerDown:l=>{t.value={x:l.pageX,y:l.pageY},i.value={x:n.value.x,y:n.value.y}},onPointerMove:l=>{if(t.value){const d=l.pageX-t.value.x,c=l.pageY-t.value.y;n.value.x=i.value.x+d/e.value.scaling,n.value.y=i.value.y+c/e.value.scaling}},onPointerUp:()=>{t.value=null,i.value=null}}}function WI(n,e,t){if(!e.template)return!1;if(Pa(e.template)===t)return!0;const i=n.graphTemplates.find(r=>Pa(r)===t);return i?i.nodes.filter(r=>r.type.startsWith(cc)).some(r=>WI(n,e,r.type)):!1}function KI(n){return it(()=>{const e=Array.from(n.value.editor.nodeTypes.entries()),t=new Set(e.map(([,s])=>s.category)),i=[];for(const s of t.values()){let r=e.filter(([,o])=>o.category===s);n.value.displayedGraph.template?r=r.filter(([o])=>!WI(n.value.editor,n.value.displayedGraph,o)):r=r.filter(([o])=>![ka,La].includes(o)),r.length>0&&i.push({name:s,nodeTypes:Object.fromEntries(r)})}return i.sort((s,r)=>s.name==="default"?-1:r.name==="default"||s.name>r.name?1:-1),i})}function jI(){const{graph:n}=Wi();return{transform:(t,i)=>{const s=t/n.value.scaling-n.value.panning.x,r=i/n.value.scaling-n.value.panning.y;return[s,r]}}}function XIt(){const{graph:n}=Wi();let e=[],t=-1,i={x:0,y:0};const s=it(()=>n.value.panning),r=$I(s),o=it(()=>({"transform-origin":"0 0",transform:`scale(${n.value.scaling}) translate(${n.value.panning.x}px, ${n.value.panning.y}px)`})),a=(m,h,E)=>{const b=[m/n.value.scaling-n.value.panning.x,h/n.value.scaling-n.value.panning.y],g=[m/E-n.value.panning.x,h/E-n.value.panning.y],v=[g[0]-b[0],g[1]-b[1]];n.value.panning.x+=v[0],n.value.panning.y+=v[1],n.value.scaling=E},l=m=>{m.preventDefault();let h=m.deltaY;m.deltaMode===1&&(h*=32);const E=n.value.scaling*(1-h/3e3);a(m.offsetX,m.offsetY,E)},d=()=>({ax:e[0].clientX,ay:e[0].clientY,bx:e[1].clientX,by:e[1].clientY});return{styles:o,...r,onPointerDown:m=>{if(e.push(m),r.onPointerDown(m),e.length===2){const{ax:h,ay:E,bx:b,by:g}=d();i={x:h+(b-h)/2,y:E+(g-E)/2}}},onPointerMove:m=>{for(let h=0;h0){const C=n.value.scaling*(1+(T-t)/500);a(i.x,i.y,C)}t=T}else r.onPointerMove(m)},onPointerUp:m=>{e=e.filter(h=>h.pointerId!==m.pointerId),t=-1,r.onPointerUp()},onMouseWheel:l}}var vi=(n=>(n[n.NONE=0]="NONE",n[n.ALLOWED=1]="ALLOWED",n[n.FORBIDDEN=2]="FORBIDDEN",n))(vi||{});const QI=Symbol();function ZIt(){const{graph:n}=Wi(),e=mt(null),t=mt(null),i=a=>{e.value&&(e.value.mx=a.offsetX/n.value.scaling-n.value.panning.x,e.value.my=a.offsetY/n.value.scaling-n.value.panning.y)},s=()=>{if(t.value){if(e.value)return;const a=n.value.connections.find(l=>l.to===t.value);t.value.isInput&&a?(e.value={status:vi.NONE,from:a.from},n.value.removeConnection(a)):e.value={status:vi.NONE,from:t.value},e.value.mx=void 0,e.value.my=void 0}},r=()=>{if(e.value&&t.value){if(e.value.from===t.value)return;n.value.addConnection(e.value.from,e.value.to)}e.value=null},o=a=>{if(t.value=a??null,a&&e.value){e.value.to=a;const l=n.value.checkConnection(e.value.from,e.value.to);if(e.value.status=l.connectionAllowed?vi.ALLOWED:vi.FORBIDDEN,l.connectionAllowed){const d=l.connectionsInDanger.map(c=>c.id);n.value.connections.forEach(c=>{d.includes(c.id)&&(c.isInDanger=!0)})}}else!a&&e.value&&(e.value.to=void 0,e.value.status=vi.NONE,n.value.connections.forEach(l=>{l.isInDanger=!1}))};return sa(QI,{temporaryConnection:e,hoveredOver:o}),{temporaryConnection:e,onMouseMove:i,onMouseDown:s,onMouseUp:r,hoveredOver:o}}function JIt(n){const e=mt(!1),t=mt(0),i=mt(0),s=KI(n),{transform:r}=jI(),o=it(()=>{let c=[];const _={};for(const m of s.value){const h=Object.entries(m.nodeTypes).map(([E,b])=>({label:b.title,value:"addNode:"+E}));m.name==="default"?c=h:_[m.name]=h}const f=[...Object.entries(_).map(([m,h])=>({label:m,submenu:h}))];return f.length>0&&c.length>0&&f.push({isDivider:!0}),f.push(...c),f}),a=it(()=>n.value.settings.contextMenu.additionalItems.length===0?o.value:[{label:"Add node",submenu:o.value},...n.value.settings.contextMenu.additionalItems.map(c=>"isDivider"in c||"submenu"in c?c:{label:c.label,value:"command:"+c.command,disabled:!n.value.commandHandler.canExecuteCommand(c.command)})]);function l(c){e.value=!0,t.value=c.offsetX,i.value=c.offsetY}function d(c){if(c.startsWith("addNode:")){const _=c.substring(8),f=n.value.editor.nodeTypes.get(_);if(!f)return;const m=ei(new f.type);n.value.displayedGraph.addNode(m);const[h,E]=r(t.value,i.value);m.position.x=h,m.position.y=E}else if(c.startsWith("command:")){const _=c.substring(8);n.value.commandHandler.canExecuteCommand(_)&&n.value.commandHandler.executeCommand(_)}}return{show:e,x:t,y:i,items:a,open:l,onClick:d}}const eMt=pn({setup(){const{viewModel:n}=Oi(),{graph:e}=Wi();return{styles:it(()=>{const i=n.value.settings.background,s=e.value.panning.x*e.value.scaling,r=e.value.panning.y*e.value.scaling,o=e.value.scaling*i.gridSize,a=o/i.gridDivision,l=`${o}px ${o}px, ${o}px ${o}px`,d=e.value.scaling>i.subGridVisibleThreshold?`, ${a}px ${a}px, ${a}px ${a}px`:"";return{backgroundPosition:`left ${s}px top ${r}px`,backgroundSize:`${l} ${d}`}})}}}),_n=(n,e)=>{const t=n.__vccOpts||n;for(const[i,s]of e)t[i]=s;return t};function tMt(n,e,t,i,s,r){return w(),M("div",{class:"background",style:en(n.styles)},null,4)}const nMt=_n(eMt,[["render",tMt]]);function iMt(n){return iA()?(LM(n),!0):!1}function pv(n){return typeof n=="function"?n():vt(n)}const XI=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const sMt=Object.prototype.toString,rMt=n=>sMt.call(n)==="[object Object]",qd=()=>{},oMt=aMt();function aMt(){var n,e;return XI&&((n=window==null?void 0:window.navigator)==null?void 0:n.userAgent)&&(/iP(ad|hone|od)/.test(window.navigator.userAgent)||((e=window==null?void 0:window.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function lMt(n,e,t=!1){return e.reduce((i,s)=>(s in n&&(!t||n[s]!==void 0)&&(i[s]=n[s]),i),{})}function cMt(n,e={}){if(!hn(n))return m2(n);const t=Array.isArray(n.value)?Array.from({length:n.value.length}):{};for(const i in n.value)t[i]=f2(()=>({get(){return n.value[i]},set(s){var r;if((r=pv(e.replaceRef))!=null?r:!0)if(Array.isArray(n.value)){const a=[...n.value];a[i]=s,n.value=a}else{const a={...n.value,[i]:s};Object.setPrototypeOf(a,Object.getPrototypeOf(n.value)),n.value=a}else n.value[i]=s}}));return t}function Nl(n){var e;const t=pv(n);return(e=t==null?void 0:t.$el)!=null?e:t}const _v=XI?window:void 0;function Vl(...n){let e,t,i,s;if(typeof n[0]=="string"||Array.isArray(n[0])?([t,i,s]=n,e=_v):[e,t,i,s]=n,!e)return qd;Array.isArray(t)||(t=[t]),Array.isArray(i)||(i=[i]);const r=[],o=()=>{r.forEach(c=>c()),r.length=0},a=(c,_,f,m)=>(c.addEventListener(_,f,m),()=>c.removeEventListener(_,f,m)),l=qn(()=>[Nl(e),pv(s)],([c,_])=>{if(o(),!c)return;const f=rMt(_)?{..._}:_;r.push(...t.flatMap(m=>i.map(h=>a(c,m,h,f))))},{immediate:!0,flush:"post"}),d=()=>{l(),o()};return iMt(d),d}let FR=!1;function ZI(n,e,t={}){const{window:i=_v,ignore:s=[],capture:r=!0,detectIframe:o=!1}=t;if(!i)return qd;oMt&&!FR&&(FR=!0,Array.from(i.document.body.children).forEach(f=>f.addEventListener("click",qd)),i.document.documentElement.addEventListener("click",qd));let a=!0;const l=f=>s.some(m=>{if(typeof m=="string")return Array.from(i.document.querySelectorAll(m)).some(h=>h===f.target||f.composedPath().includes(h));{const h=Nl(m);return h&&(f.target===h||f.composedPath().includes(h))}}),c=[Vl(i,"click",f=>{const m=Nl(n);if(!(!m||m===f.target||f.composedPath().includes(m))){if(f.detail===0&&(a=!l(f)),!a){a=!0;return}e(f)}},{passive:!0,capture:r}),Vl(i,"pointerdown",f=>{const m=Nl(n);a=!l(f)&&!!(m&&!f.composedPath().includes(m))},{passive:!0}),o&&Vl(i,"blur",f=>{setTimeout(()=>{var m;const h=Nl(n);((m=i.document.activeElement)==null?void 0:m.tagName)==="IFRAME"&&!(h!=null&&h.contains(i.document.activeElement))&&e(f)},0)})].filter(Boolean);return()=>c.forEach(f=>f())}const JI={x:0,y:0,pointerId:0,pressure:0,tiltX:0,tiltY:0,width:0,height:0,twist:0,pointerType:null},dMt=Object.keys(JI);function uMt(n={}){const{target:e=_v}=n,t=mt(!1),i=mt(n.initialValue||{});Object.assign(i.value,JI,i.value);const s=r=>{t.value=!0,!(n.pointerTypes&&!n.pointerTypes.includes(r.pointerType))&&(i.value=lMt(r,dMt,!1))};if(e){const r={passive:!0};Vl(e,["pointerdown","pointermove","pointerup"],s,r),Vl(e,"pointerleave",()=>t.value=!1,r)}return{...cMt(i),isInside:t}}const pMt=["onMouseenter","onMouseleave","onClick"],_Mt={class:"flex-fill"},hMt={key:0,class:"__submenu-icon",style:{"line-height":"1em"}},fMt=u("svg",{width:"13",height:"13",viewBox:"-60 120 250 250"},[u("path",{d:"M160.875 279.5625 L70.875 369.5625 L70.875 189.5625 L160.875 279.5625 Z",stroke:"none",fill:"white"})],-1),mMt=[fMt],hv=pn({__name:"ContextMenu",props:{modelValue:{type:Boolean},items:{},x:{default:0},y:{default:0},isNested:{type:Boolean,default:!1},isFlipped:{default:()=>({x:!1,y:!1})},flippable:{type:Boolean,default:!1}},emits:["update:modelValue","click"],setup(n,{emit:e}){const t=n,i=e;let s=null;const r=mt(null),o=mt(-1),a=mt(0),l=mt({x:!1,y:!1}),d=it(()=>t.flippable&&(l.value.x||t.isFlipped.x)),c=it(()=>t.flippable&&(l.value.y||t.isFlipped.y)),_=it(()=>{const v={};return t.isNested||(v.top=(c.value?t.y-a.value:t.y)+"px",v.left=t.x+"px"),v}),f=it(()=>({"--flipped-x":d.value,"--flipped-y":c.value,"--nested":t.isNested})),m=it(()=>t.items.map(v=>({...v,hover:!1})));qn([()=>t.y,()=>t.items],()=>{var v,y,T,C;a.value=t.items.length*30;const x=((y=(v=r.value)==null?void 0:v.parentElement)==null?void 0:y.offsetWidth)??0,O=((C=(T=r.value)==null?void 0:T.parentElement)==null?void 0:C.offsetHeight)??0;l.value.x=!t.isNested&&t.x>x*.75,l.value.y=!t.isNested&&t.y+a.value>O-20}),ZI(r,()=>{t.modelValue&&i("update:modelValue",!1)});const h=v=>{!v.submenu&&v.value&&(i("click",v.value),i("update:modelValue",!1))},E=v=>{i("click",v),o.value=-1,t.isNested||i("update:modelValue",!1)},b=(v,y)=>{t.items[y].submenu&&(o.value=y,s!==null&&(clearTimeout(s),s=null))},g=(v,y)=>{t.items[y].submenu&&(s=window.setTimeout(()=>{o.value=-1,s=null},200))};return(v,y)=>{const T=ht("ContextMenu",!0);return w(),xt(ls,{name:"slide-fade"},{default:Je(()=>[ne(u("div",{ref_key:"el",ref:r,class:Ye(["baklava-context-menu",f.value]),style:en(_.value)},[(w(!0),M($e,null,ct(m.value,(C,x)=>(w(),M($e,null,[C.isDivider?(w(),M("div",{key:`d-${x}`,class:"divider"})):(w(),M("div",{key:`i-${x}`,class:Ye(["item",{submenu:!!C.submenu,"--disabled":!!C.disabled}]),onMouseenter:O=>b(O,x),onMouseleave:O=>g(O,x),onClick:Te(O=>h(C),["stop","prevent"])},[u("div",_Mt,fe(C.label),1),C.submenu?(w(),M("div",hMt,mMt)):q("",!0),C.submenu?(w(),xt(T,{key:1,"model-value":o.value===x,items:C.submenu,"is-nested":!0,"is-flipped":{x:d.value,y:c.value},flippable:v.flippable,onClick:E},null,8,["model-value","items","is-flipped","flippable"])):q("",!0)],42,pMt))],64))),256))],6),[[Ot,v.modelValue]])]),_:1})}}}),gMt={},bMt={xmlns:"http://www.w3.org/2000/svg",class:"baklava-icon",width:"16",height:"16",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},EMt=u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vMt=u("circle",{cx:"12",cy:"12",r:"1"},null,-1),yMt=u("circle",{cx:"12",cy:"19",r:"1"},null,-1),SMt=u("circle",{cx:"12",cy:"5",r:"1"},null,-1),TMt=[EMt,vMt,yMt,SMt];function xMt(n,e){return w(),M("svg",bMt,TMt)}const eM=_n(gMt,[["render",xMt]]),CMt=["id"],RMt={key:0,class:"__tooltip"},AMt={key:2,class:"align-middle"},BR=pn({__name:"NodeInterface",props:{node:{},intf:{}},setup(n){const e=(b,g=100)=>{const v=b!=null&&b.toString?b.toString():"";return v.length>g?v.slice(0,g)+"...":v},t=n,{viewModel:i}=Oi(),{hoveredOver:s,temporaryConnection:r}=Gi(QI),o=mt(null),a=it(()=>t.intf.connectionCount>0),l=mt(!1),d=it(()=>i.value.settings.displayValueOnHover&&l.value),c=it(()=>({"--input":t.intf.isInput,"--output":!t.intf.isInput,"--connected":a.value})),_=it(()=>t.intf.component&&(!t.intf.isInput||!t.intf.port||t.intf.connectionCount===0)),f=()=>{l.value=!0,s(t.intf)},m=()=>{l.value=!1,s(void 0)},h=()=>{o.value&&i.value.hooks.renderInterface.execute({intf:t.intf,el:o.value})},E=()=>{const b=i.value.displayedGraph.sidebar;b.nodeId=t.node.id,b.optionName=t.intf.name,b.visible=!0};return qs(h),pc(h),(b,g)=>{var v;return w(),M("div",{id:b.intf.id,ref_key:"el",ref:o,class:Ye(["baklava-node-interface",c.value])},[b.intf.port?(w(),M("div",{key:0,class:Ye(["__port",{"--selected":((v=vt(r))==null?void 0:v.from)===b.intf}]),onPointerover:f,onPointerout:m},[Dn(b.$slots,"portTooltip",{showTooltip:d.value},()=>[d.value===!0?(w(),M("span",RMt,fe(e(b.intf.value)),1)):q("",!0)])],34)):q("",!0),_.value?(w(),xt(Fu(b.intf.component),{key:1,modelValue:b.intf.value,"onUpdate:modelValue":g[0]||(g[0]=y=>b.intf.value=y),node:b.node,intf:b.intf,onOpenSidebar:E},null,40,["modelValue","node","intf"])):(w(),M("span",AMt,fe(b.intf.name),1))],10,CMt)}}}),wMt=["id","data-node-type"],NMt={class:"__title-label"},OMt={class:"__menu"},IMt={class:"__outputs"},MMt={class:"__inputs"},DMt=pn({__name:"Node",props:{node:{},selected:{type:Boolean,default:!1},dragging:{type:Boolean}},emits:["select","start-drag"],setup(n,{emit:e}){const t=n,i=e,{viewModel:s}=Oi(),{graph:r,switchGraph:o}=Wi(),a=mt(null),l=mt(!1),d=mt(""),c=mt(null),_=mt(!1),f=mt(!1),m=it(()=>{const U=[{value:"rename",label:"Rename"},{value:"delete",label:"Delete"}];return t.node.type.startsWith(cc)&&U.push({value:"editSubgraph",label:"Edit Subgraph"}),U}),h=it(()=>({"--selected":t.selected,"--dragging":t.dragging,"--two-column":!!t.node.twoColumn})),E=it(()=>{var U,F;return{top:`${((U=t.node.position)==null?void 0:U.y)??0}px`,left:`${((F=t.node.position)==null?void 0:F.x)??0}px`,"--width":`${t.node.width??s.value.settings.nodes.defaultWidth}px`}}),b=it(()=>Object.values(t.node.inputs).filter(U=>!U.hidden)),g=it(()=>Object.values(t.node.outputs).filter(U=>!U.hidden)),v=()=>{i("select")},y=U=>{t.selected||v(),i("start-drag",U)},T=()=>{f.value=!0},C=async U=>{var F;switch(U){case"delete":r.value.removeNode(t.node);break;case"rename":d.value=t.node.title,l.value=!0,await Ve(),(F=c.value)==null||F.focus();break;case"editSubgraph":o(t.node.template);break}},x=()=>{t.node.title=d.value,l.value=!1},O=()=>{a.value&&s.value.hooks.renderNode.execute({node:t.node,el:a.value})},R=U=>{_.value=!0,U.preventDefault()},S=U=>{if(!_.value)return;const F=t.node.width+U.movementX/r.value.scaling,K=s.value.settings.nodes.minWidth,L=s.value.settings.nodes.maxWidth;t.node.width=Math.max(K,Math.min(L,F))},A=()=>{_.value=!1};return qs(()=>{O(),window.addEventListener("mousemove",S),window.addEventListener("mouseup",A)}),pc(O),Va(()=>{window.removeEventListener("mousemove",S),window.removeEventListener("mouseup",A)}),(U,F)=>(w(),M("div",{id:U.node.id,ref_key:"el",ref:a,class:Ye(["baklava-node",h.value]),style:en(E.value),"data-node-type":U.node.type,onPointerdown:v},[vt(s).settings.nodes.resizable?(w(),M("div",{key:0,class:"__resize-handle",onMousedown:R},null,32)):q("",!0),Dn(U.$slots,"title",{},()=>[u("div",{class:"__title",onPointerdown:Te(y,["self","stop"])},[l.value?ne((w(),M("input",{key:1,ref_key:"renameInputEl",ref:c,"onUpdate:modelValue":F[1]||(F[1]=K=>d.value=K),type:"text",class:"baklava-input",placeholder:"Node Name",onBlur:x,onKeydown:wr(x,["enter"])},null,544)),[[Pe,d.value]]):(w(),M($e,{key:0},[u("div",NMt,fe(U.node.title),1),u("div",OMt,[Oe(eM,{class:"--clickable",onClick:T}),Oe(hv,{modelValue:f.value,"onUpdate:modelValue":F[0]||(F[0]=K=>f.value=K),x:0,y:0,items:m.value,onClick:C},null,8,["modelValue","items"])])],64))],32)]),Dn(U.$slots,"content",{},()=>[u("div",{class:"__content",onKeydown:F[2]||(F[2]=wr(Te(()=>{},["stop"]),["delete"]))},[u("div",IMt,[(w(!0),M($e,null,ct(g.value,K=>Dn(U.$slots,"nodeInterface",{key:K.id,type:"output",node:U.node,intf:K},()=>[Oe(BR,{node:U.node,intf:K},null,8,["node","intf"])])),128))]),u("div",MMt,[(w(!0),M($e,null,ct(b.value,K=>Dn(U.$slots,"nodeInterface",{key:K.id,type:"input",node:U.node,intf:K},()=>[Oe(BR,{node:U.node,intf:K},null,8,["node","intf"])])),128))])],32)])],46,wMt))}}),kMt=pn({props:{x1:{type:Number,required:!0},y1:{type:Number,required:!0},x2:{type:Number,required:!0},y2:{type:Number,required:!0},state:{type:Number,default:vi.NONE},isTemporary:{type:Boolean,default:!1}},setup(n){const{viewModel:e}=Oi(),{graph:t}=Wi(),i=(o,a)=>{const l=(o+t.value.panning.x)*t.value.scaling,d=(a+t.value.panning.y)*t.value.scaling;return[l,d]},s=it(()=>{const[o,a]=i(n.x1,n.y1),[l,d]=i(n.x2,n.y2);if(e.value.settings.useStraightConnections)return`M ${o} ${a} L ${l} ${d}`;{const c=.3*Math.abs(o-l);return`M ${o} ${a} C ${o+c} ${a}, ${l-c} ${d}, ${l} ${d}`}}),r=it(()=>({"--temporary":n.isTemporary,"--allowed":n.state===vi.ALLOWED,"--forbidden":n.state===vi.FORBIDDEN}));return{d:s,classes:r}}}),LMt=["d"];function PMt(n,e,t,i,s,r){return w(),M("path",{class:Ye(["baklava-connection",n.classes]),d:n.d},null,10,LMt)}const tM=_n(kMt,[["render",PMt]]);function UMt(n){return document.getElementById(n.id)}function Ua(n){const e=document.getElementById(n.id),t=e==null?void 0:e.getElementsByClassName("__port");return{node:(e==null?void 0:e.closest(".baklava-node"))??null,interface:e,port:t&&t.length>0?t[0]:null}}const FMt=pn({components:{"connection-view":tM},props:{connection:{type:Object,required:!0}},setup(n){const{graph:e}=Wi();let t;const i=mt({x1:0,y1:0,x2:0,y2:0}),s=it(()=>n.connection.isInDanger?vi.FORBIDDEN:vi.NONE),r=it(()=>{var d;return(d=e.value.findNodeById(n.connection.from.nodeId))==null?void 0:d.position}),o=it(()=>{var d;return(d=e.value.findNodeById(n.connection.to.nodeId))==null?void 0:d.position}),a=d=>d.node&&d.interface&&d.port?[d.node.offsetLeft+d.interface.offsetLeft+d.port.offsetLeft+d.port.clientWidth/2,d.node.offsetTop+d.interface.offsetTop+d.port.offsetTop+d.port.clientHeight/2]:[0,0],l=()=>{const d=Ua(n.connection.from),c=Ua(n.connection.to);d.node&&c.node&&(t||(t=new ResizeObserver(()=>{l()}),t.observe(d.node),t.observe(c.node)));const[_,f]=a(d),[m,h]=a(c);i.value={x1:_,y1:f,x2:m,y2:h}};return qs(async()=>{await Ve(),l()}),Va(()=>{t&&t.disconnect()}),qn([r,o],()=>l(),{deep:!0}),{d:i,state:s}}});function BMt(n,e,t,i,s,r){const o=ht("connection-view");return w(),xt(o,{x1:n.d.x1,y1:n.d.y1,x2:n.d.x2,y2:n.d.y2,state:n.state},null,8,["x1","y1","x2","y2","state"])}const GMt=_n(FMt,[["render",BMt]]);function Tu(n){return n.node&&n.interface&&n.port?[n.node.offsetLeft+n.interface.offsetLeft+n.port.offsetLeft+n.port.clientWidth/2,n.node.offsetTop+n.interface.offsetTop+n.port.offsetTop+n.port.clientHeight/2]:[0,0]}const zMt=pn({components:{"connection-view":tM},props:{connection:{type:Object,required:!0}},setup(n){const e=it(()=>n.connection?n.connection.status:vi.NONE);return{d:it(()=>{if(!n.connection)return{input:[0,0],output:[0,0]};const i=Tu(Ua(n.connection.from)),s=n.connection.to?Tu(Ua(n.connection.to)):[n.connection.mx||i[0],n.connection.my||i[1]];return n.connection.from.isInput?{input:s,output:i}:{input:i,output:s}}),status:e}}});function VMt(n,e,t,i,s,r){const o=ht("connection-view");return w(),xt(o,{x1:n.d.input[0],y1:n.d.input[1],x2:n.d.output[0],y2:n.d.output[1],state:n.status,"is-temporary":""},null,8,["x1","y1","x2","y2","state"])}const HMt=_n(zMt,[["render",VMt]]),qMt=pn({setup(){const{viewModel:n}=Oi(),{graph:e}=Wi(),t=mt(null),i=jd(n.value.settings.sidebar,"width"),s=it(()=>n.value.settings.sidebar.resizable),r=it(()=>{const _=e.value.sidebar.nodeId;return e.value.nodes.find(f=>f.id===_)}),o=it(()=>({width:`${i.value}px`})),a=it(()=>r.value?[...Object.values(r.value.inputs),...Object.values(r.value.outputs)].filter(f=>f.displayInSidebar&&f.component):[]),l=()=>{e.value.sidebar.visible=!1},d=()=>{window.addEventListener("mousemove",c),window.addEventListener("mouseup",()=>{window.removeEventListener("mousemove",c)},{once:!0})},c=_=>{var f,m;const h=((m=(f=t.value)==null?void 0:f.parentElement)==null?void 0:m.getBoundingClientRect().width)??500;let E=i.value-_.movementX;E<300?E=300:E>.9*h&&(E=.9*h),i.value=E};return{el:t,graph:e,resizable:s,node:r,styles:o,displayedInterfaces:a,startResize:d,close:l}}}),YMt={class:"__header"},$Mt={class:"__node-name"};function WMt(n,e,t,i,s,r){return w(),M("div",{ref:"el",class:Ye(["baklava-sidebar",{"--open":n.graph.sidebar.visible}]),style:en(n.styles)},[n.resizable?(w(),M("div",{key:0,class:"__resizer",onMousedown:e[0]||(e[0]=(...o)=>n.startResize&&n.startResize(...o))},null,32)):q("",!0),u("div",YMt,[u("button",{tabindex:"-1",class:"__close",onClick:e[1]||(e[1]=(...o)=>n.close&&n.close(...o))},"×"),u("div",$Mt,[u("b",null,fe(n.node?n.node.title:""),1)])]),(w(!0),M($e,null,ct(n.displayedInterfaces,o=>(w(),M("div",{key:o.id,class:"__interface"},[(w(),xt(Fu(o.component),{modelValue:o.value,"onUpdate:modelValue":a=>o.value=a,node:n.node,intf:o},null,8,["modelValue","onUpdate:modelValue","node","intf"]))]))),128))],6)}const KMt=_n(qMt,[["render",WMt]]),jMt=pn({__name:"Minimap",setup(n){const{viewModel:e}=Oi(),{graph:t}=Wi(),i=mt(null),s=mt(!1);let r,o=!1,a={x1:0,y1:0,x2:0,y2:0},l;const d=()=>{var x,O;if(!r)return;r.canvas.width=i.value.offsetWidth,r.canvas.height=i.value.offsetHeight;const R=new Map,S=new Map;for(const L of t.value.nodes){const H=UMt(L),G=(H==null?void 0:H.offsetWidth)??0,P=(H==null?void 0:H.offsetHeight)??0,j=((x=L.position)==null?void 0:x.x)??0,Y=((O=L.position)==null?void 0:O.y)??0;R.set(L,{x1:j,y1:Y,x2:j+G,y2:Y+P}),S.set(L,H)}const A={x1:Number.MAX_SAFE_INTEGER,y1:Number.MAX_SAFE_INTEGER,x2:Number.MIN_SAFE_INTEGER,y2:Number.MIN_SAFE_INTEGER};for(const L of R.values())L.x1A.x2&&(A.x2=L.x2),L.y2>A.y2&&(A.y2=L.y2);const U=50;A.x1-=U,A.y1-=U,A.x2+=U,A.y2+=U,a=A;const F=r.canvas.width/r.canvas.height,K=(a.x2-a.x1)/(a.y2-a.y1);if(F>K){const L=(F-K)*(a.y2-a.y1)*.5;a.x1-=L,a.x2+=L}else{const L=a.x2-a.x1,H=a.y2-a.y1,G=(L-F*H)/F*.5;a.y1-=G,a.y2+=G}r.clearRect(0,0,r.canvas.width,r.canvas.height),r.strokeStyle="white";for(const L of t.value.connections){const[H,G]=Tu(Ua(L.from)),[P,j]=Tu(Ua(L.to)),[Y,Q]=c(H,G),[ae,te]=c(P,j);if(r.beginPath(),r.moveTo(Y,Q),e.value.settings.useStraightConnections)r.lineTo(ae,te);else{const Z=.3*Math.abs(Y-ae);r.bezierCurveTo(Y+Z,Q,ae-Z,te,ae,te)}r.stroke()}r.strokeStyle="lightgray";for(const[L,H]of R.entries()){const[G,P]=c(H.x1,H.y1),[j,Y]=c(H.x2,H.y2);r.fillStyle=f(S.get(L)),r.beginPath(),r.rect(G,P,j-G,Y-P),r.fill(),r.stroke()}if(s.value){const L=h(),[H,G]=c(L.x1,L.y1),[P,j]=c(L.x2,L.y2);r.fillStyle="rgba(255, 255, 255, 0.2)",r.fillRect(H,G,P-H,j-G)}},c=(x,O)=>[(x-a.x1)/(a.x2-a.x1)*r.canvas.width,(O-a.y1)/(a.y2-a.y1)*r.canvas.height],_=(x,O)=>[x*(a.x2-a.x1)/r.canvas.width+a.x1,O*(a.y2-a.y1)/r.canvas.height+a.y1],f=x=>{if(x){const O=x.querySelector(".__content");if(O){const S=m(O);if(S)return S}const R=m(x);if(R)return R}return"gray"},m=x=>{const O=getComputedStyle(x).backgroundColor;if(O&&O!=="rgba(0, 0, 0, 0)")return O},h=()=>{const x=i.value.parentElement.offsetWidth,O=i.value.parentElement.offsetHeight,R=x/t.value.scaling-t.value.panning.x,S=O/t.value.scaling-t.value.panning.y;return{x1:-t.value.panning.x,y1:-t.value.panning.y,x2:R,y2:S}},E=x=>{x.button===0&&(o=!0,b(x))},b=x=>{if(o){const[O,R]=_(x.offsetX,x.offsetY),S=h(),A=(S.x2-S.x1)/2,U=(S.y2-S.y1)/2;t.value.panning.x=-(O-A),t.value.panning.y=-(R-U)}},g=()=>{o=!1},v=()=>{s.value=!0},y=()=>{s.value=!1,g()};qn([s,t.value.panning,()=>t.value.scaling,()=>t.value.connections.length],()=>{d()});const T=it(()=>t.value.nodes.map(x=>x.position)),C=it(()=>t.value.nodes.map(x=>x.width));return qn([T,C],()=>{d()},{deep:!0}),qs(()=>{r=i.value.getContext("2d"),r.imageSmoothingQuality="high",d(),l=setInterval(d,500)}),Va(()=>{clearInterval(l)}),(x,O)=>(w(),M("canvas",{ref_key:"canvas",ref:i,class:"baklava-minimap",onMouseenter:v,onMouseleave:y,onMousedown:Te(E,["self"]),onMousemove:Te(b,["self"]),onMouseup:g},null,544))}}),QMt=pn({components:{ContextMenu:hv,VerticalDots:eM},props:{type:{type:String,required:!0},title:{type:String,required:!0}},setup(n){const{viewModel:e}=Oi(),{switchGraph:t}=Wi(),i=mt(!1),s=it(()=>n.type.startsWith(cc));return{showContextMenu:i,hasContextMenu:s,contextMenuItems:[{label:"Edit Subgraph",value:"editSubgraph"},{label:"Delete Subgraph",value:"deleteSubgraph"}],openContextMenu:()=>{i.value=!0},onContextMenuClick:l=>{const d=n.type.substring(cc.length),c=e.value.editor.graphTemplates.find(_=>_.id===d);if(c)switch(l){case"editSubgraph":t(c);break;case"deleteSubgraph":e.value.editor.removeGraphTemplate(c);break}}}}}),XMt=["data-node-type"],ZMt={class:"__title"},JMt={class:"__title-label"},e2t={key:0,class:"__menu"};function t2t(n,e,t,i,s,r){const o=ht("vertical-dots"),a=ht("context-menu");return w(),M("div",{class:"baklava-node --palette","data-node-type":n.type},[u("div",ZMt,[u("div",JMt,fe(n.title),1),n.hasContextMenu?(w(),M("div",e2t,[Oe(o,{class:"--clickable",onPointerdown:e[0]||(e[0]=Te(()=>{},["stop","prevent"])),onClick:Te(n.openContextMenu,["stop","prevent"])},null,8,["onClick"]),Oe(a,{modelValue:n.showContextMenu,"onUpdate:modelValue":e[1]||(e[1]=l=>n.showContextMenu=l),x:-100,y:0,items:n.contextMenuItems,onClick:n.onContextMenuClick,onPointerdown:e[2]||(e[2]=Te(()=>{},["stop","prevent"]))},null,8,["modelValue","items","onClick"])])):q("",!0)])],8,XMt)}const GR=_n(QMt,[["render",t2t]]),n2t={class:"baklava-node-palette"},i2t={key:0},s2t=pn({__name:"NodePalette",setup(n){const{viewModel:e}=Oi(),{x:t,y:i}=uMt(),{transform:s}=jI(),r=KI(e),o=Gi("editorEl"),a=mt(null),l=it(()=>{if(!a.value||!(o!=null&&o.value))return{};const{left:c,top:_}=o.value.getBoundingClientRect();return{top:`${i.value-_}px`,left:`${t.value-c}px`}}),d=(c,_)=>{a.value={type:c,nodeInformation:_};const f=()=>{const m=ei(new _.type);e.value.displayedGraph.addNode(m);const h=o.value.getBoundingClientRect(),[E,b]=s(t.value-h.left,i.value-h.top);m.position.x=E,m.position.y=b,a.value=null,document.removeEventListener("pointerup",f)};document.addEventListener("pointerup",f)};return(c,_)=>(w(),M($e,null,[u("div",n2t,[(w(!0),M($e,null,ct(vt(r),f=>(w(),M("section",{key:f.name},[f.name!=="default"?(w(),M("h1",i2t,fe(f.name),1)):q("",!0),(w(!0),M($e,null,ct(f.nodeTypes,(m,h)=>(w(),xt(GR,{key:h,type:h,title:m.title,onPointerdown:E=>d(h,m)},null,8,["type","title","onPointerdown"]))),128))]))),128))]),Oe(ls,{name:"fade"},{default:Je(()=>[a.value?(w(),M("div",{key:0,class:"baklava-dragged-node",style:en(l.value)},[Oe(GR,{type:a.value.type,title:a.value.nodeInformation.title},null,8,["type","title"])],4)):q("",!0)]),_:1})],64))}});let wd;const r2t=new Uint8Array(16);function o2t(){if(!wd&&(wd=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!wd))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return wd(r2t)}const Cn=[];for(let n=0;n<256;++n)Cn.push((n+256).toString(16).slice(1));function a2t(n,e=0){return Cn[n[e+0]]+Cn[n[e+1]]+Cn[n[e+2]]+Cn[n[e+3]]+"-"+Cn[n[e+4]]+Cn[n[e+5]]+"-"+Cn[n[e+6]]+Cn[n[e+7]]+"-"+Cn[n[e+8]]+Cn[n[e+9]]+"-"+Cn[n[e+10]]+Cn[n[e+11]]+Cn[n[e+12]]+Cn[n[e+13]]+Cn[n[e+14]]+Cn[n[e+15]]}const l2t=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),zR={randomUUID:l2t};function xu(n,e,t){if(zR.randomUUID&&!e&&!n)return zR.randomUUID();n=n||{};const i=n.random||(n.rng||o2t)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let s=0;s<16;++s)e[t+s]=i[s];return e}return a2t(i)}const dc="SAVE_SUBGRAPH";function c2t(n,e){const t=()=>{const i=n.value;if(!i.template)throw new Error("Graph template property not set");i.template.update(i.save()),i.template.panning=i.panning,i.template.scaling=i.scaling};e.registerCommand(dc,{canExecute:()=>{var i;return n.value!==((i=n.value.editor)==null?void 0:i.graph)},execute:t})}const d2t={},u2t={xmlns:"http://www.w3.org/2000/svg",class:"baklava-icon",width:"24",height:"24",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},p2t=u("polyline",{points:"6 9 12 15 18 9"},null,-1),_2t=[p2t];function h2t(n,e){return w(),M("svg",u2t,_2t)}const f2t=_n(d2t,[["render",h2t]]),m2t=pn({components:{"i-arrow":f2t},props:{intf:{type:Object,required:!0}},setup(n){const e=mt(null),t=mt(!1),i=it(()=>n.intf.items.find(o=>typeof o=="string"?o===n.intf.value:o.value===n.intf.value)),s=it(()=>i.value?typeof i.value=="string"?i.value:i.value.text:""),r=o=>{n.intf.value=typeof o=="string"?o:o.value};return ZI(e,()=>{t.value=!1}),{el:e,open:t,selectedItem:i,selectedText:s,setSelected:r}}}),g2t=["title"],b2t={class:"__selected"},E2t={class:"__text"},v2t={class:"__icon"},y2t={class:"__dropdown"},S2t={class:"item --header"},T2t=["onClick"];function x2t(n,e,t,i,s,r){const o=ht("i-arrow");return w(),M("div",{ref:"el",class:Ye(["baklava-select",{"--open":n.open}]),title:n.intf.name,onClick:e[0]||(e[0]=a=>n.open=!n.open)},[u("div",b2t,[u("div",E2t,fe(n.selectedText),1),u("div",v2t,[Oe(o)])]),Oe(ls,{name:"slide-fade"},{default:Je(()=>[ne(u("div",y2t,[u("div",S2t,fe(n.intf.name),1),(w(!0),M($e,null,ct(n.intf.items,(a,l)=>(w(),M("div",{key:l,class:Ye(["item",{"--active":a===n.selectedItem}]),onClick:d=>n.setSelected(a)},fe(typeof a=="string"?a:a.text),11,T2t))),128))],512),[[Ot,n.open]])]),_:1})],10,g2t)}const C2t=_n(m2t,[["render",x2t]]);class R2t extends tn{constructor(e,t,i){super(e,t),this.component=uc(C2t),this.items=i}}const A2t=pn({props:{intf:{type:Object,required:!0}}});function w2t(n,e,t,i,s,r){return w(),M("div",null,fe(n.intf.value),1)}const N2t=_n(A2t,[["render",w2t]]);class O2t extends tn{constructor(e,t){super(e,t),this.component=uc(N2t),this.setPort(!1)}}const I2t=pn({props:{intf:{type:Object,required:!0},modelValue:{type:String,required:!0}},emits:["update:modelValue"],setup(n,{emit:e}){return{v:it({get:()=>n.modelValue,set:i=>{e("update:modelValue",i)}})}}}),M2t=["placeholder","title"];function D2t(n,e,t,i,s,r){return w(),M("div",null,[ne(u("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>n.v=o),type:"text",class:"baklava-input",placeholder:n.intf.name,title:n.intf.name},null,8,M2t),[[Pe,n.v]])])}const k2t=_n(I2t,[["render",D2t]]);class Rc extends tn{constructor(){super(...arguments),this.component=uc(k2t)}}class nM extends VI{constructor(){super(...arguments),this._title="Subgraph Input",this.inputs={name:new Rc("Name","Input").setPort(!1)},this.outputs={placeholder:new tn("Connection",void 0)}}}class iM extends HI{constructor(){super(...arguments),this._title="Subgraph Output",this.inputs={name:new Rc("Name","Output").setPort(!1),placeholder:new tn("Connection",void 0)},this.outputs={output:new tn("Output",void 0).setHidden(!0)}}}const sM="CREATE_SUBGRAPH",VR=[ka,La];function L2t(n,e,t){const i=()=>n.value.selectedNodes.filter(r=>!VR.includes(r.type)).length>0,s=()=>{const{viewModel:r}=Oi(),o=n.value,a=n.value.editor;if(o.selectedNodes.length===0)return;const l=o.selectedNodes.filter(S=>!VR.includes(S.type)),d=l.flatMap(S=>Object.values(S.inputs)),c=l.flatMap(S=>Object.values(S.outputs)),_=o.connections.filter(S=>!c.includes(S.from)&&d.includes(S.to)),f=o.connections.filter(S=>c.includes(S.from)&&!d.includes(S.to)),m=o.connections.filter(S=>c.includes(S.from)&&d.includes(S.to)),h=l.map(S=>S.save()),E=m.map(S=>({id:S.id,from:S.from.id,to:S.to.id})),b=new Map,{xLeft:g,xRight:v,yTop:y}=P2t(l);console.log(g,v,y);for(const[S,A]of _.entries()){const U=new nM;U.inputs.name.value=A.to.name,h.push({...U.save(),position:{x:v-r.value.settings.nodes.defaultWidth-100,y:y+S*200}}),E.push({id:xu(),from:U.outputs.placeholder.id,to:A.to.id}),b.set(A.to.id,U.graphInterfaceId)}for(const[S,A]of f.entries()){const U=new iM;U.inputs.name.value=A.from.name,h.push({...U.save(),position:{x:g+100,y:y+S*200}}),E.push({id:xu(),from:A.from.id,to:U.inputs.placeholder.id}),b.set(A.from.id,U.graphInterfaceId)}const T=ei(new gp({connections:E,nodes:h,inputs:[],outputs:[]},a));a.addGraphTemplate(T);const C=a.nodeTypes.get(Pa(T));if(!C)throw new Error("Unable to create subgraph: Could not find corresponding graph node type");const x=ei(new C.type);o.addNode(x);const O=Math.round(l.map(S=>S.position.x).reduce((S,A)=>S+A,0)/l.length),R=Math.round(l.map(S=>S.position.y).reduce((S,A)=>S+A,0)/l.length);x.position.x=O,x.position.y=R,_.forEach(S=>{o.removeConnection(S),o.addConnection(S.from,x.inputs[b.get(S.to.id)])}),f.forEach(S=>{o.removeConnection(S),o.addConnection(x.outputs[b.get(S.from.id)],S.to)}),l.forEach(S=>o.removeNode(S)),e.canExecuteCommand(dc)&&e.executeCommand(dc),t(T),n.value.panning={...o.panning},n.value.scaling=o.scaling};e.registerCommand(sM,{canExecute:i,execute:s})}function P2t(n){const e=n.reduce((s,r)=>{const o=r.position.x;return o{const o=r.position.y;return o{const o=r.position.x+r.width;return o>s?o:s},-1/0),xRight:e,yTop:t}}const HR="DELETE_NODES";function U2t(n,e){e.registerCommand(HR,{canExecute:()=>n.value.selectedNodes.length>0,execute(){n.value.selectedNodes.forEach(t=>n.value.removeNode(t))}}),e.registerHotkey(["Delete"],HR)}const rM="SWITCH_TO_MAIN_GRAPH";function F2t(n,e,t){e.registerCommand(rM,{canExecute:()=>n.value!==n.value.editor.graph,execute:()=>{e.executeCommand(dc),t(n.value.editor.graph)}})}function B2t(n,e,t){U2t(n,e),L2t(n,e,t),c2t(n,e),F2t(n,e,t)}class qR{constructor(e,t){this.type=e,e==="addNode"?this.nodeId=t:this.nodeState=t}undo(e){this.type==="addNode"?this.removeNode(e):this.addNode(e)}redo(e){this.type==="addNode"&&this.nodeState?this.addNode(e):this.type==="removeNode"&&this.nodeId&&this.removeNode(e)}addNode(e){const t=e.editor.nodeTypes.get(this.nodeState.type);if(!t)return;const i=new t.type;e.addNode(i),i.load(this.nodeState),this.nodeId=i.id}removeNode(e){const t=e.nodes.find(i=>i.id===this.nodeId);t&&(this.nodeState=t.save(),e.removeNode(t))}}class YR{constructor(e,t){if(this.type=e,e==="addConnection")this.connectionId=t;else{const i=t;this.connectionState={id:i.id,from:i.from.id,to:i.to.id}}}undo(e){this.type==="addConnection"?this.removeConnection(e):this.addConnection(e)}redo(e){this.type==="addConnection"&&this.connectionState?this.addConnection(e):this.type==="removeConnection"&&this.connectionId&&this.removeConnection(e)}addConnection(e){const t=e.findNodeInterface(this.connectionState.from),i=e.findNodeInterface(this.connectionState.to);!t||!i||e.addConnection(t,i)}removeConnection(e){const t=e.connections.find(i=>i.id===this.connectionId);t&&(this.connectionState={id:t.id,from:t.from.id,to:t.to.id},e.removeConnection(t))}}class G2t{constructor(e){if(this.type="transaction",e.length===0)throw new Error("Can't create a transaction with no steps");this.steps=e}undo(e){for(let t=this.steps.length-1;t>=0;t--)this.steps[t].undo(e)}redo(e){for(let t=0;t{if(!r.value)if(a.value)l.value.push(b);else for(o.value!==s.value.length-1&&(s.value=s.value.slice(0,o.value+1)),s.value.push(b),o.value++;s.value.length>i.value;)s.value.shift()},c=()=>{a.value=!0},_=()=>{a.value=!1,l.value.length>0&&(d(new G2t(l.value)),l.value=[])},f=()=>s.value.length!==0&&o.value!==-1,m=()=>{f()&&(r.value=!0,s.value[o.value--].undo(n.value),r.value=!1)},h=()=>s.value.length!==0&&o.value{h()&&(r.value=!0,s.value[++o.value].redo(n.value),r.value=!1)};return qn(n,(b,g)=>{g&&(g.events.addNode.unsubscribe(t),g.events.removeNode.unsubscribe(t),g.events.addConnection.unsubscribe(t),g.events.removeConnection.unsubscribe(t)),b&&(b.events.addNode.subscribe(t,v=>{d(new qR("addNode",v.id))}),b.events.removeNode.subscribe(t,v=>{d(new qR("removeNode",v.save()))}),b.events.addConnection.subscribe(t,v=>{d(new YR("addConnection",v.id))}),b.events.removeConnection.subscribe(t,v=>{d(new YR("removeConnection",v))}))},{immediate:!0}),e.registerCommand(Tb,{canExecute:f,execute:m}),e.registerCommand(xb,{canExecute:h,execute:E}),e.registerCommand(oM,{canExecute:()=>!a.value,execute:c}),e.registerCommand(aM,{canExecute:()=>a.value,execute:_}),e.registerHotkey(["Control","z"],Tb),e.registerHotkey(["Control","y"],xb),ei({maxSteps:i})}const Cb="COPY",Rb="PASTE",V2t="CLEAR_CLIPBOARD";function H2t(n,e,t){const i=Symbol("ClipboardToken"),s=mt(""),r=mt(""),o=it(()=>!s.value),a=()=>{s.value="",r.value=""},l=()=>{const _=n.value.selectedNodes.flatMap(m=>[...Object.values(m.inputs),...Object.values(m.outputs)]),f=n.value.connections.filter(m=>_.includes(m.from)||_.includes(m.to)).map(m=>({from:m.from.id,to:m.to.id}));r.value=JSON.stringify(f),s.value=JSON.stringify(n.value.selectedNodes.map(m=>m.save()))},d=(_,f,m)=>{for(const h of _){let E;if((!m||m==="input")&&(E=Object.values(h.inputs).find(b=>b.id===f)),!E&&(!m||m==="output")&&(E=Object.values(h.outputs).find(b=>b.id===f)),E)return E}},c=()=>{if(o.value)return;const _=new Map,f=JSON.parse(s.value),m=JSON.parse(r.value),h=[],E=[],b=n.value;t.executeCommand(oM);for(const g of f){const v=e.value.nodeTypes.get(g.type);if(!v){console.warn(`Node type ${g.type} not registered`);return}const y=new v.type,T=y.id;h.push(y),y.hooks.beforeLoad.subscribe(i,C=>{const x=C;return x.position&&(x.position.x+=100,x.position.y+=100),y.hooks.beforeLoad.unsubscribe(i),x}),b.addNode(y),y.load({...g,id:T}),y.id=T,_.set(g.id,T);for(const C of Object.values(y.inputs)){const x=xu();_.set(C.id,x),C.id=x}for(const C of Object.values(y.outputs)){const x=xu();_.set(C.id,x),C.id=x}}for(const g of m){const v=d(h,_.get(g.from),"output"),y=d(h,_.get(g.to),"input");if(!v||!y)continue;const T=b.addConnection(v,y);T&&E.push(T)}return n.value.selectedNodes=h,t.executeCommand(aM),{newNodes:h,newConnections:E}};return t.registerCommand(Cb,{canExecute:()=>n.value.selectedNodes.length>0,execute:l}),t.registerHotkey(["Control","c"],Cb),t.registerCommand(Rb,{canExecute:()=>!o.value,execute:c}),t.registerHotkey(["Control","v"],Rb),t.registerCommand(V2t,{canExecute:()=>!0,execute:a}),ei({isEmpty:o})}const q2t="OPEN_SIDEBAR";function Y2t(n,e){e.registerCommand(q2t,{execute:t=>{n.value.sidebar.nodeId=t,n.value.sidebar.visible=!0},canExecute:()=>!0})}function $2t(n,e){Y2t(n,e)}const W2t={},K2t={xmlns:"http://www.w3.org/2000/svg",class:"baklava-icon",width:"24",height:"24",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},j2t=u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),Q2t=u("path",{d:"M9 13l-4 -4l4 -4m-4 4h11a4 4 0 0 1 0 8h-1"},null,-1),X2t=[j2t,Q2t];function Z2t(n,e){return w(),M("svg",K2t,X2t)}const J2t=_n(W2t,[["render",Z2t]]),eDt={},tDt={xmlns:"http://www.w3.org/2000/svg",class:"baklava-icon",width:"24",height:"24",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},nDt=u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),iDt=u("path",{d:"M15 13l4 -4l-4 -4m4 4h-11a4 4 0 0 0 0 8h1"},null,-1),sDt=[nDt,iDt];function rDt(n,e){return w(),M("svg",tDt,sDt)}const oDt=_n(eDt,[["render",rDt]]),aDt={},lDt={xmlns:"http://www.w3.org/2000/svg",class:"baklava-icon",width:"24",height:"24",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},cDt=u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),dDt=u("line",{x1:"5",y1:"12",x2:"19",y2:"12"},null,-1),uDt=u("line",{x1:"5",y1:"12",x2:"11",y2:"18"},null,-1),pDt=u("line",{x1:"5",y1:"12",x2:"11",y2:"6"},null,-1),_Dt=[cDt,dDt,uDt,pDt];function hDt(n,e){return w(),M("svg",lDt,_Dt)}const fDt=_n(aDt,[["render",hDt]]),mDt={},gDt={xmlns:"http://www.w3.org/2000/svg",class:"baklava-icon",width:"24",height:"24",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},bDt=u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),EDt=u("path",{d:"M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2"},null,-1),vDt=u("rect",{x:"9",y:"3",width:"6",height:"4",rx:"2"},null,-1),yDt=[bDt,EDt,vDt];function SDt(n,e){return w(),M("svg",gDt,yDt)}const TDt=_n(mDt,[["render",SDt]]),xDt={},CDt={xmlns:"http://www.w3.org/2000/svg",class:"baklava-icon",width:"24",height:"24",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},RDt=u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),ADt=u("rect",{x:"8",y:"8",width:"12",height:"12",rx:"2"},null,-1),wDt=u("path",{d:"M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"},null,-1),NDt=[RDt,ADt,wDt];function ODt(n,e){return w(),M("svg",CDt,NDt)}const IDt=_n(xDt,[["render",ODt]]),MDt={},DDt={xmlns:"http://www.w3.org/2000/svg",class:"baklava-icon",width:"24",height:"24",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},kDt=u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),LDt=u("path",{d:"M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2"},null,-1),PDt=u("circle",{cx:"12",cy:"14",r:"2"},null,-1),UDt=u("polyline",{points:"14 4 14 8 8 8 8 4"},null,-1),FDt=[kDt,LDt,PDt,UDt];function BDt(n,e){return w(),M("svg",DDt,FDt)}const GDt=_n(MDt,[["render",BDt]]),zDt={},VDt={xmlns:"http://www.w3.org/2000/svg",class:"baklava-icon",width:"24",height:"24",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},HDt=zu('',6),qDt=[HDt];function YDt(n,e){return w(),M("svg",VDt,qDt)}const $Dt=_n(zDt,[["render",YDt]]),WDt=pn({props:{command:{type:String,required:!0},title:{type:String,required:!0},icon:{type:Object,required:!1,default:void 0}},setup(){const{viewModel:n}=Oi();return{viewModel:n}}}),KDt=["disabled","title"];function jDt(n,e,t,i,s,r){return w(),M("button",{class:"baklava-toolbar-entry baklava-toolbar-button",disabled:!n.viewModel.commandHandler.canExecuteCommand(n.command),title:n.title,onClick:e[0]||(e[0]=o=>n.viewModel.commandHandler.executeCommand(n.command))},[n.icon?(w(),xt(Fu(n.icon),{key:0})):(w(),M($e,{key:1},[je(fe(n.title),1)],64))],8,KDt)}const QDt=_n(WDt,[["render",jDt]]),XDt=pn({components:{ToolbarButton:QDt},setup(){const{viewModel:n}=Oi();return{isSubgraph:it(()=>n.value.displayedGraph!==n.value.editor.graph),commands:[{command:Cb,title:"Copy",icon:IDt},{command:Rb,title:"Paste",icon:TDt},{command:Tb,title:"Undo",icon:J2t},{command:xb,title:"Redo",icon:oDt},{command:sM,title:"Create Subgraph",icon:$Dt}],subgraphCommands:[{command:dc,title:"Save Subgraph",icon:GDt},{command:rM,title:"Back to Main Graph",icon:fDt}]}}}),ZDt={class:"baklava-toolbar"};function JDt(n,e,t,i,s,r){const o=ht("toolbar-button");return w(),M("div",ZDt,[(w(!0),M($e,null,ct(n.commands,a=>(w(),xt(o,{key:a.command,command:a.command,title:a.title,icon:a.icon},null,8,["command","title","icon"]))),128)),n.isSubgraph?(w(!0),M($e,{key:0},ct(n.subgraphCommands,a=>(w(),xt(o,{key:a.command,command:a.command,title:a.title,icon:a.icon},null,8,["command","title","icon"]))),128)):q("",!0)])}const ekt=_n(XDt,[["render",JDt]]),tkt={class:"connections-container"},nkt=pn({__name:"Editor",props:{viewModel:{}},setup(n){const e=n,t=Symbol("EditorToken"),i=jd(e,"viewModel");QIt(i);const s=mt(null);sa("editorEl",s);const r=it(()=>e.viewModel.displayedGraph.nodes),o=it(()=>e.viewModel.displayedGraph.nodes.map(O=>$I(jd(O,"position")))),a=it(()=>e.viewModel.displayedGraph.connections),l=it(()=>e.viewModel.displayedGraph.selectedNodes),d=XIt(),c=ZIt(),_=JIt(i),f=it(()=>({...d.styles.value})),m=mt(0);e.viewModel.editor.hooks.load.subscribe(t,O=>(m.value++,O));const h=O=>{d.onPointerMove(O),c.onMouseMove(O)},E=O=>{O.button===0&&(O.target===s.value&&(T(),d.onPointerDown(O)),c.onMouseDown())},b=O=>{d.onPointerUp(O),c.onMouseUp()},g=O=>{O.key==="Tab"&&O.preventDefault(),e.viewModel.commandHandler.handleKeyDown(O)},v=O=>{e.viewModel.commandHandler.handleKeyUp(O)},y=O=>{["Control","Shift"].some(R=>e.viewModel.commandHandler.pressedKeys.includes(R))||T(),e.viewModel.displayedGraph.selectedNodes.push(O)},T=()=>{e.viewModel.displayedGraph.selectedNodes=[]},C=O=>{for(const R of e.viewModel.displayedGraph.selectedNodes){const S=r.value.indexOf(R),A=o.value[S];A.onPointerDown(O),document.addEventListener("pointermove",A.onPointerMove)}document.addEventListener("pointerup",x)},x=()=>{for(const O of e.viewModel.displayedGraph.selectedNodes){const R=r.value.indexOf(O),S=o.value[R];S.onPointerUp(),document.removeEventListener("pointermove",S.onPointerMove)}document.removeEventListener("pointerup",x)};return(O,R)=>(w(),M("div",{ref_key:"el",ref:s,tabindex:"-1",class:Ye(["baklava-editor",{"baklava-ignore-mouse":!!vt(c).temporaryConnection.value||vt(d).dragging.value,"--temporary-connection":!!vt(c).temporaryConnection.value}]),onPointermove:Te(h,["self"]),onPointerdown:E,onPointerup:b,onWheel:R[1]||(R[1]=Te((...S)=>vt(d).onMouseWheel&&vt(d).onMouseWheel(...S),["self"])),onKeydown:g,onKeyup:v,onContextmenu:R[2]||(R[2]=Te((...S)=>vt(_).open&&vt(_).open(...S),["self","prevent"]))},[Dn(O.$slots,"background",{},()=>[Oe(nMt)]),Dn(O.$slots,"toolbar",{},()=>[Oe(ekt)]),Dn(O.$slots,"palette",{},()=>[Oe(s2t)]),(w(),M("svg",tkt,[(w(!0),M($e,null,ct(a.value,S=>(w(),M("g",{key:S.id+m.value.toString()},[Dn(O.$slots,"connection",{connection:S},()=>[Oe(GMt,{connection:S},null,8,["connection"])])]))),128)),Dn(O.$slots,"temporaryConnection",{temporaryConnection:vt(c).temporaryConnection.value},()=>[vt(c).temporaryConnection.value?(w(),xt(HMt,{key:0,connection:vt(c).temporaryConnection.value},null,8,["connection"])):q("",!0)])])),u("div",{class:"node-container",style:en(f.value)},[Oe(rs,{name:"fade"},{default:Je(()=>[(w(!0),M($e,null,ct(r.value,(S,A)=>Dn(O.$slots,"node",{key:S.id+m.value.toString(),node:S,selected:l.value.includes(S),dragging:o.value[A].dragging.value,onSelect:U=>y(S),onStartDrag:C},()=>[Oe(DMt,{node:S,selected:l.value.includes(S),dragging:o.value[A].dragging.value,onSelect:U=>y(S),onStartDrag:C},null,8,["node","selected","dragging","onSelect"])])),128))]),_:3})],4),Dn(O.$slots,"sidebar",{},()=>[Oe(KMt)]),Dn(O.$slots,"minimap",{},()=>[O.viewModel.settings.enableMinimap?(w(),xt(jMt,{key:0})):q("",!0)]),Dn(O.$slots,"contextMenu",{contextMenu:vt(_)},()=>[O.viewModel.settings.contextMenu.enabled?(w(),xt(hv,{key:0,modelValue:vt(_).show.value,"onUpdate:modelValue":R[0]||(R[0]=S=>vt(_).show.value=S),items:vt(_).items.value,x:vt(_).x.value,y:vt(_).y.value,onClick:vt(_).onClick},null,8,["modelValue","items","x","y","onClick"])):q("",!0)])],34))}}),ikt=["INPUT","TEXTAREA","SELECT"];function skt(n){const e=mt([]),t=mt([]);return{pressedKeys:e,handleKeyDown:o=>{var a;e.value.includes(o.key)||e.value.push(o.key),!ikt.includes(((a=document.activeElement)==null?void 0:a.tagName)??"")&&t.value.forEach(l=>{l.keys.every(d=>e.value.includes(d))&&n(l.commandName)})},handleKeyUp:o=>{const a=e.value.indexOf(o.key);a>=0&&e.value.splice(a,1)},registerHotkey:(o,a)=>{t.value.push({keys:o,commandName:a})}}}const rkt=()=>{const n=mt(new Map),e=(r,o)=>{if(n.value.has(r))throw new Error(`Command "${r}" already exists`);n.value.set(r,o)},t=(r,o=!1,...a)=>{if(!n.value.has(r)){if(o)throw new Error(`[CommandHandler] Command ${r} not registered`);return}return n.value.get(r).execute(...a)},i=(r,o=!1,...a)=>{if(!n.value.has(r)){if(o)throw new Error(`[CommandHandler] Command ${r} not registered`);return!1}return n.value.get(r).canExecute(a)},s=skt(t);return ei({registerCommand:e,executeCommand:t,canExecuteCommand:i,...s})},okt=n=>!(n instanceof Cc);function akt(n,e){return{switchGraph:i=>{let s;if(okt(i))s=new Cc(n.value),i.createGraph(s);else{if(i!==n.value.graph)throw new Error("Can only switch using 'Graph' instance when it is the root graph. Otherwise a 'GraphTemplate' must be used.");s=i}e.value&&e.value!==n.value.graph&&e.value.destroy(),s.panning=s.panning??i.panning??{x:0,y:0},s.scaling=s.scaling??i.scaling??1,s.selectedNodes=s.selectedNodes??[],s.sidebar=s.sidebar??{visible:!1,nodeId:"",optionName:""},e.value=s}}}function lkt(n,e){n.position=n.position??{x:0,y:0},n.disablePointerEvents=!1,n.twoColumn=n.twoColumn??!1,n.width=n.width??e.defaultWidth}const ckt=()=>({useStraightConnections:!1,enableMinimap:!1,background:{gridSize:100,gridDivision:5,subGridVisibleThreshold:.6},sidebar:{width:300,resizable:!0},displayValueOnHover:!1,nodes:{defaultWidth:200,maxWidth:320,minWidth:150,resizable:!1},contextMenu:{enabled:!0,additionalItems:[]}});function dkt(n){const e=mt(n??new qIt),t=Symbol("ViewModelToken"),i=mt(null),s=d2(i),{switchGraph:r}=akt(e,i),o=it(()=>s.value&&s.value!==e.value.graph),a=ei(ckt()),l=rkt(),d=z2t(s,l),c=H2t(s,e,l),_={renderNode:new li(null),renderInterface:new li(null)};return B2t(s,l,r),$2t(s,l),qn(e,(f,m)=>{m&&(m.events.registerGraph.unsubscribe(t),m.graphEvents.beforeAddNode.unsubscribe(t),f.nodeHooks.beforeLoad.unsubscribe(t),f.nodeHooks.afterSave.unsubscribe(t),f.graphTemplateHooks.beforeLoad.unsubscribe(t),f.graphTemplateHooks.afterSave.unsubscribe(t),f.graph.hooks.load.unsubscribe(t),f.graph.hooks.save.unsubscribe(t)),f&&(f.nodeHooks.beforeLoad.subscribe(t,(h,E)=>(E.position=h.position??{x:0,y:0},E.width=h.width??a.nodes.defaultWidth,E.twoColumn=h.twoColumn??!1,h)),f.nodeHooks.afterSave.subscribe(t,(h,E)=>(h.position=E.position,h.width=E.width,h.twoColumn=E.twoColumn,h)),f.graphTemplateHooks.beforeLoad.subscribe(t,(h,E)=>(E.panning=h.panning,E.scaling=h.scaling,h)),f.graphTemplateHooks.afterSave.subscribe(t,(h,E)=>(h.panning=E.panning,h.scaling=E.scaling,h)),f.graph.hooks.load.subscribe(t,(h,E)=>(E.panning=h.panning,E.scaling=h.scaling,h)),f.graph.hooks.save.subscribe(t,(h,E)=>(h.panning=E.panning,h.scaling=E.scaling,h)),f.graphEvents.beforeAddNode.subscribe(t,h=>lkt(h,{defaultWidth:a.nodes.defaultWidth})),e.value.registerNodeType(nM,{category:"Subgraphs"}),e.value.registerNodeType(iM,{category:"Subgraphs"}),r(f.graph))},{immediate:!0}),ei({editor:e,displayedGraph:s,isSubgraph:o,settings:a,commandHandler:l,history:d,clipboard:c,hooks:_,switchGraph:r})}const ukt=el({type:"PersonalityNode",title:"Personality",inputs:{request:()=>new tn("Request",""),agent_name:()=>new R2t("Personality","",Cu.state.config.personalities).setPort(!1)},outputs:{response:()=>new tn("Response","")},async calculate({request:n}){console.log(Cu.state.config.personalities);let e="";try{e=(await Me.post("/generate",{params:{text:n}})).data}catch(t){console.error(t)}return{display:e,response:e}}}),pkt=el({type:"RAGNode",title:"RAG",inputs:{request:()=>new tn("Prompt",""),document_path:()=>new Rc("Document path","").setPort(!1)},outputs:{prompt:()=>new tn("Prompt with Data","")},async calculate({request:n,document_path:e}){let t="";try{t=(await Me.get("/rag",{params:{text:n,doc_path:e}})).data}catch(i){console.error(i)}return{response:t}}}),$R=el({type:"Task",title:"Task",inputs:{description:()=>new Rc("Task description","").setPort(!1)},outputs:{prompt:()=>new tn("Prompt")},calculate({description:n}){return{prompt:n}}}),WR=el({type:"TextDisplayNode",title:"TextDisplay",inputs:{text2display:()=>new tn("Input","")},outputs:{response:()=>new O2t("Text","")},async calculate({request:n}){}}),KR=el({type:"LLMNode",title:"LLM",inputs:{request:()=>new tn("Request","")},outputs:{response:()=>new tn("Response","")},async calculate({request:n}){console.log(Cu.state.config.personalities);let e="";try{e=(await Me.post("/generate",{params:{text:n}})).data}catch(t){console.error(t)}return{display:e,response:e}}}),_kt=el({type:"MultichoiceNode",title:"Multichoice",inputs:{question:()=>new tn("Question",""),outputs:()=>new Rc("choices, one per line","","").setPort(!1)},outputs:{response:()=>new tn("Response","")}}),hkt=pn({components:{"baklava-editor":nkt},setup(){const n=dkt(),e=new jIt(n.editor);n.editor.registerNodeType(ukt),n.editor.registerNodeType($R),n.editor.registerNodeType(pkt),n.editor.registerNodeType(WR),n.editor.registerNodeType(KR),n.editor.registerNodeType(_kt);const t=Symbol();e.events.afterRun.subscribe(t,a=>{e.pause(),YIt(a,n.editor),e.resume()}),e.start();function i(a,l,d){const c=new a;return n.displayedGraph.addNode(c),c.position.x=l,c.position.y=d,c}const s=i($R,300,140),r=i(KR,550,140),o=i(WR,850,140);return n.displayedGraph.addConnection(s.outputs.prompt,r.inputs.request),n.displayedGraph.addConnection(r.outputs.response,o.inputs.text2display),{baklava:n,saveGraph:()=>{const a=e.export();localStorage.setItem("myGraph",JSON.stringify(a))},loadGraph:()=>{const a=JSON.parse(localStorage.getItem("myGraph"));e.import(a)}}}}),fkt={style:{width:"100vw",height:"100vh"}};function mkt(n,e,t,i,s,r){const o=ht("baklava-editor");return w(),M("div",fkt,[Oe(o,{"view-model":n.baklava},null,8,["view-model"]),u("button",{onClick:e[0]||(e[0]=(...a)=>n.saveGraph&&n.saveGraph(...a))},"Save Graph"),u("button",{onClick:e[1]||(e[1]=(...a)=>n.loadGraph&&n.loadGraph(...a))},"Load Graph")])}const gkt=bt(hkt,[["render",mkt]]),bkt={},Ekt={style:{width:"100vw",height:"100vh"}},vkt=["src"];function ykt(n,e,t,i,s,r){return w(),M("div",Ekt,[u("iframe",{src:n.$store.state.config.comfyui_base_url,class:"m-0 p-0 w-full h-full"},null,8,vkt)])}const Skt=bt(bkt,[["render",ykt]]),Tkt=jP({history:_P("/"),routes:[{path:"/comfyui_view/",name:"ComfyUI",component:Skt},{path:"/playground/",name:"playground",component:Ttt},{path:"/extensions/",name:"extensions",component:ktt},{path:"/help/",name:"help",component:ent},{path:"/settings/",name:"settings",component:Nmt},{path:"/training/",name:"training",component:Qmt},{path:"/quantizing/",name:"quantizing",component:rgt},{path:"/",name:"discussions",component:yxt},{path:"/",name:"interactive",component:UIt},{path:"/",name:"nodes",component:gkt}]});const bp=tk(TZe);console.log("Loaded main.js");function jR(n){const e={};for(const t in n)n.hasOwnProperty(t)&&(e[t]=n[t]);return e}const Cu=Ak({state(){return{currentTheme:"",personality_editor:null,showPersonalityEditor:!1,selectedPersonality:null,currentPersonConfig:{ai_name:"",ai_author:"",ai_category:"",ai_language:"",ai_description:"",ai_conditionning:"",ai_disclaimer:"",ai_icon:null},client_id:"",yesNoDialog:null,universalForm:null,toast:null,news:null,messageBox:null,api_get_req:null,startSpeechRecognition:null,ready:!1,loading_infos:"",loading_progress:0,version:"unknown",settingsChanged:!1,isConnected:!1,isModelOk:!1,isGenerating:!1,config:null,mountedPers:null,mountedPersArr:[],mountedExtensions:[],bindingsZoo:[],modelsArr:[],selectedModel:null,personalities:[],diskUsage:null,ramUsage:null,vramUsage:null,modelsZoo:[],installedModels:[],installedBindings:[],currentModel:null,currentBinding:null,extensionsZoo:[],databases:[]}},mutations:{setIsReady(n,e){n.ready=e},setIsConnected(n,e){n.isConnected=e},setIsModelOk(n,e){n.isModelOk=e},setIsGenerating(n,e){n.isGenerating=e},setConfig(n,e){n.config=e},setPersonalities(n,e){n.personalities=e},setMountedPers(n,e){n.mountedPers=e},setMountedPersArr(n,e){n.mountedPersArr=e},setMountedExtensions(n,e){n.mountedExtensions=e},setbindingsZoo(n,e){n.bindingsZoo=e},setModelsArr(n,e){n.modelsArr=e},setselectedModel(n,e){n.selectedModel=e},setDiskUsage(n,e){n.diskUsage=e},setRamUsage(n,e){n.ramUsage=e},setVramUsage(n,e){n.vramUsage=e},setModelsZoo(n,e){n.modelsZoo=e},setCurrentBinding(n,e){n.currentBinding=e},setCurrentModel(n,e){n.currentModel=e},setExtensionsZoo(n,e){n.extensionsZoo=e},setDatabases(n,e){n.databases=e},setTheme(n){this.currentTheme=n}},getters:{getIsConnected(n){return n.isConnected},getIsModelOk(n){return n.isModelOk},getIsGenerating(n){return n.isGenerating},getConfig(n){return n.config},getPersonalities(n){return n.personalities},getMountedPersArr(n){return n.mountedPersArr},getmmountedExtensions(n){return n.mountedExtensions},getMountedPers(n){return n.mountedPers},getbindingsZoo(n){return n.bindingsZoo},getModelsArr(n){return n.modelsArr},getDiskUsage(n){return n.diskUsage},getRamUsage(n){return n.ramUsage},getVramUsage(n){return n.vramUsage},getDatabasesList(n){return n.databases},getModelsZoo(n){return n.modelsZoo},getCyrrentBinding(n){return n.currentBinding},getCurrentModel(n){return n.currentModel},getExtensionsZoo(n){return n.extensionsZoo}},actions:{async getVersion(){try{let n=await Me.get("/get_lollms_webui_version",{});n&&(this.state.version=n.data,console.log("version res:",n),console.log("version :",this.state.version))}catch{console.log("Coudln't get version")}},async refreshConfig({commit:n}){console.log("Fetching configuration");try{const e=await _i("get_config");e.active_personality_id<0&&(e.active_personality_id=0);let t=e.personalities[e.active_personality_id].split("/");e.personality_category=t[0],e.personality_folder=t[1],e.extensions.length>0?e.extension_category=e.extensions[-1]:e.extension_category="ai_sensors",console.log("Recovered config"),console.log(e),console.log("Committing config"),console.log(e),console.log(this.state.config),n("setConfig",e)}catch(e){console.log(e.message,"refreshConfig")}},async refreshDatabase({commit:n}){let e=await _i("list_databases");console.log("databases:",e),n("setDatabases",e)},async refreshPersonalitiesZoo({commit:n}){let e=[];const t=await _i("get_all_personalities"),i=Object.keys(t);console.log("Personalities recovered:"+this.state.config.personalities);for(let s=0;s{let d=!1;for(const _ of this.state.config.personalities)if(_.includes(r+"/"+l.folder))if(d=!0,_.includes(":")){const f=_.split(":");l.language=f[1]}else l.language=null;let c={};return c=l,c.category=r,c.full_path=r+"/"+l.folder,c.isMounted=d,c});e.length==0?e=a:e=e.concat(a)}e.sort((s,r)=>s.name.localeCompare(r.name)),n("setPersonalities",e),console.log("Done loading personalities")},refreshMountedPersonalities({commit:n}){this.state.config.active_personality_id<0&&(this.state.config.active_personality_id=0);let e=[];const t=[];for(let i=0;ia.full_path==s||a.full_path==r[0]);if(o>=0){let a=jR(this.state.personalities[o]);r.length>1&&(a.language=r[1]),a?e.push(a):e.push(this.state.personalities[this.state.personalities.findIndex(l=>l.full_path=="generic/lollms")])}else t.push(i),console.log("Couldn't load personality : ",s)}for(let i=t.length-1;i>=0;i--)console.log("Removing personality : ",this.state.config.personalities[t[i]]),this.state.config.personalities.splice(t[i],1),this.state.config.active_personality_id>t[i]&&(this.state.config.active_personality_id-=1);n("setMountedPersArr",e),this.state.mountedPers=this.state.personalities[this.state.personalities.findIndex(i=>i.full_path==this.state.config.personalities[this.state.config.active_personality_id]||i.full_path+":"+i.language==this.state.config.personalities[this.state.config.active_personality_id])]},async refreshBindings({commit:n}){let e=await _i("list_bindings");console.log("Loaded bindings zoo :",e),this.state.installedBindings=e.filter(i=>i.installed),console.log("Loaded bindings zoo ",this.state.installedBindings),n("setbindingsZoo",e);const t=e.findIndex(i=>i.name==this.state.config.binding_name);t!=-1&&n("setCurrentBinding",e[t])},async refreshModelsZoo({commit:n}){console.log("Fetching models");const t=(await Me.get("/get_available_models")).data.filter(i=>i.variants&&i.variants.length>0);console.log(`get_available_models: ${t}`),n("setModelsZoo",t)},async refreshModelStatus({commit:n}){let e=await _i("get_model_status");n("setIsModelOk",e.status)},async refreshModels({commit:n}){console.log("Fetching models");let e=await _i("list_models");console.log(`Found ${e}`);let t=await _i("get_active_model");console.log("Selected model ",t),t!=null&&n("setselectedModel",t.model),n("setModelsArr",e),console.log("setModelsArr",e),console.log("this.state.modelsZoo",this.state.modelsZoo),this.state.modelsZoo.map(s=>{s.isInstalled=e.includes(s.name)}),this.state.installedModels=this.state.modelsZoo.filter(s=>s.isInstalled);const i=this.state.modelsZoo.findIndex(s=>s.name==this.state.config.model_name);i!=-1&&n("setCurrentModel",this.state.modelsZoo[i])},async refreshExtensionsZoo({commit:n}){let e=[],t=await _i("list_extensions");const i=Object.keys(t);console.log("Extensions recovered:"+t);for(let s=0;s{let d=!1;for(const _ of this.state.config.extensions)_.includes(r+"/"+l.folder)&&(d=!0);let c={};return c=l,c.category=r,c.full_path=r+"/"+l.folder,c.isMounted=d,c});e.length==0?e=a:e=e.concat(a)}e.sort((s,r)=>s.name.localeCompare(r.name)),console.log("Done loading extensions"),n("setExtensionsZoo",e)},refreshmountedExtensions({commit:n}){console.log("Mounting extensions");let e=[];const t=[];for(let i=0;io.full_path==s);if(r>=0){let o=jR(this.state.config.extensions[r]);o&&e.push(o)}else t.push(i),console.log("Couldn't load extension : ",s)}for(let i=t.length-1;i>=0;i--)console.log("Removing extensions : ",this.state.config.extensions[t[i]]),this.state.config.extensions.splice(t[i],1);n("setMountedExtensions",e)},async refreshDiskUsage({commit:n}){this.state.diskUsage=await _i("disk_usage")},async refreshRamUsage({commit:n}){this.state.ramUsage=await _i("ram_usage")},async refreshVramUsage({commit:n}){const e=await _i("vram_usage"),t=[];if(e.nb_gpus>0){for(let s=0;s LoLLMS WebUI - Welcome - + diff --git a/web/src/components/CodeBlock.vue b/web/src/components/CodeBlock.vue index d20e22c8..a133ea8c 100644 --- a/web/src/components/CodeBlock.vue +++ b/web/src/components/CodeBlock.vue @@ -12,15 +12,20 @@ :class="isExecuting?'bg-green-500':''"> - + - - @@ -167,6 +172,36 @@ export default { console.error('Fetch error:', error); }); }, + executeCode_in_new_tab(){ + this.isExecuting=true; + const json = JSON.stringify({ + 'client_id': this.client_id, + 'code': this.code, + 'discussion_id': this.discussion_id, + 'message_id': this.message_id, + 'language': this.language + }) + console.log(json) + fetch(`${this.host}/execute_code_in_new_tab`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: json + }).then(response=>{ + this.isExecuting=false; + // Parse the JSON data from the response body + return response.json(); + }) + .then(jsonData => { + // Now you can work with the JSON data + console.log(jsonData); + this.executionOutput = jsonData.output; + }) + .catch(error => { + this.isExecuting=false; + // Handle any errors that occurred during the fetch process + console.error('Fetch error:', error); + }); + }, openFolderVsCode(){ const json = JSON.stringify({ 'client_id': this.client_id,