From 3a27dada37e9ec357928c21a403e4543051ed11d Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Tue, 16 Jul 2024 00:59:56 +0200 Subject: [PATCH] upgraded --- endpoints/lollms_playground.py | 10 +- presets/build_latex_book.yaml | 3 +- .../{index-53ee2d5d.js => index-e244d07f.js} | 354 +++++++++--------- web/dist/index.html | 2 +- web/src/views/PlayGroundView.vue | 2 +- 5 files changed, 188 insertions(+), 183 deletions(-) rename web/dist/assets/{index-53ee2d5d.js => index-e244d07f.js} (93%) diff --git a/endpoints/lollms_playground.py b/endpoints/lollms_playground.py index cf3e71a0..c5663f4d 100644 --- a/endpoints/lollms_playground.py +++ b/endpoints/lollms_playground.py @@ -34,9 +34,13 @@ def get_presets(): presets_folder = Path("__file__").parent/"presets" for filename in presets_folder.glob('*.yaml'): with open(filename, 'r', encoding='utf-8') as file: - preset = yaml.safe_load(file) - if preset is not None: - presets.append(preset) + try: + print(filename) + preset = yaml.safe_load(file) + if preset is not None: + presets.append(preset) + except Exception as ex: + trace_exception(ex) presets_folder = lollmsElfServer.lollms_paths.personal_discussions_path/"lollms_playground_presets" presets_folder.mkdir(exist_ok=True, parents=True) for filename in presets_folder.glob('*.yaml'): diff --git a/presets/build_latex_book.yaml b/presets/build_latex_book.yaml index 63d1785d..c2619c1c 100644 --- a/presets/build_latex_book.yaml +++ b/presets/build_latex_book.yaml @@ -17,7 +17,8 @@ content: | snippets: - Import graphics(required to add graphics to the page) : \usepackage[demo]{graphic} - - Add graph: | \includegraphics[width=4in]{@@}% Replace with your own image path + - Add graph: | + \includegraphics[width=4in]{@@}% Replace with your own image path help: | Builds a latex code for a book \ No newline at end of file diff --git a/web/dist/assets/index-53ee2d5d.js b/web/dist/assets/index-e244d07f.js similarity index 93% rename from web/dist/assets/index-53ee2d5d.js rename to web/dist/assets/index-e244d07f.js index 9f3e263e..985b4d5a 100644 --- a/web/dist/assets/index-53ee2d5d.js +++ b/web/dist/assets/index-e244d07f.js @@ -57,7 +57,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),ae=U,j=Q),J===void 0&& `)])):V("",!0)])}const cKe=bt(BWe,[["render",lKe]]);/*! @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:NN,setPrototypeOf:pC,isFrozen:dKe,getPrototypeOf:uKe,getOwnPropertyDescriptor:gE}=Object;let{freeze:$n,seal:Yi,create:ON}=Object,{apply:Wg,construct:Kg}=typeof Reflect<"u"&&Reflect;$n||($n=function(e){return e});Yi||(Yi=function(e){return e});Wg||(Wg=function(e,t,i){return e.apply(t,i)});Kg||(Kg=function(e,t){return new e(...t)});const Uc=wi(Array.prototype.forEach),_C=wi(Array.prototype.pop),dl=wi(Array.prototype.push),Md=wi(String.prototype.toLowerCase),Om=wi(String.prototype.toString),pKe=wi(String.prototype.match),ul=wi(String.prototype.replace),_Ke=wi(String.prototype.indexOf),hKe=wi(String.prototype.trim),ni=wi(RegExp.prototype.test),pl=fKe(TypeError);function wi(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]:Md;pC&&pC(n,null);let i=e.length;for(;i--;){let s=e[i];if(typeof s=="string"){const r=t(s);r!==s&&(dKe(e)||(e[i]=r),s=r)}n[s]=!0}return n}function mKe(n){for(let e=0;e/gm),vKe=Yi(/\${[\w\W]*}/gm),SKe=Yi(/^data-[\-\w.\u00B7-\uFFFF]/),TKe=Yi(/^aria-[\-\w]+$/),IN=Yi(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),xKe=Yi(/^(?:\w+script|data):/i),CKe=Yi(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),MN=Yi(/^html$/i);var bC=Object.freeze({__proto__:null,MUSTACHE_EXPR:EKe,ERB_EXPR:yKe,TMPLIT_EXPR:vKe,DATA_ATTR:SKe,ARIA_ATTR:TKe,IS_ALLOWED_URI:IN,IS_SCRIPT_OR_DATA:xKe,ATTR_WHITESPACE:CKe,DOCTYPE_NAME:MN});const wKe=function(){return typeof window>"u"?null:window},RKe=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 DN(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:wKe();const e=nt=>DN(nt);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:u,NamedNodeMap:d=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:h,DOMParser:f,trustedTypes:_}=n,m=l.prototype,E=Fc(m,"cloneNode"),b=Fc(m,"nextSibling"),g=Fc(m,"childNodes"),y=Fc(m,"parentNode");if(typeof o=="function"){const nt=t.createElement("template");nt.content&&nt.content.ownerDocument&&(t=nt.content.ownerDocument)}let v,S="";const{implementation:C,createNodeIterator:T,createDocumentFragment:O,getElementsByTagName:k}=t,{importNode:x}=i;let I={};e.isSupported=typeof NN=="function"&&typeof y=="function"&&C&&C.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:F,ERB_EXPR:B,TMPLIT_EXPR:ne,DATA_ATTR:L,ARIA_ATTR:$,IS_SCRIPT_OR_DATA:H,ATTR_WHITESPACE:U}=bC;let{IS_ALLOWED_URI:Q}=bC,J=null;const j=Nt({},[...hC,...Im,...Mm,...Dm,...fC]);let ae=null;const ve=Nt({},[...mC,...km,...gC,...Bc]);let ee=Object.seal(ON(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}})),Ee=null,xe=null,Me=!0,Z=!0,ye=!1,fe=!0,Ne=!1,Le=!1,D=!1,q=!1,K=!1,de=!1,le=!1,Re=!0,Ie=!1;const z="user-content-";let pe=!0,re=!1,ce={},M=null;const N=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 W=null;const ue=Nt({},["audio","video","img","source","image","track"]);let X=null;const ie=Nt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ae="http://www.w3.org/1998/Math/MathML",Ce="http://www.w3.org/2000/svg",ke="http://www.w3.org/1999/xhtml";let Qe=ke,ct=!1,Pe=null;const ut=Nt({},[Ae,Ce,ke],Om);let Ze=null;const qe=["application/xhtml+xml","text/html"],tt="text/html";let Fe=null,pt=null;const oe=t.createElement("form"),Ke=function(R){return R instanceof RegExp||R instanceof Function},Ue=function(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(pt&&pt===R)){if((!R||typeof R!="object")&&(R={}),R=qr(R),Ze=qe.indexOf(R.PARSER_MEDIA_TYPE)===-1?tt:R.PARSER_MEDIA_TYPE,Fe=Ze==="application/xhtml+xml"?Om:Md,J="ALLOWED_TAGS"in R?Nt({},R.ALLOWED_TAGS,Fe):j,ae="ALLOWED_ATTR"in R?Nt({},R.ALLOWED_ATTR,Fe):ve,Pe="ALLOWED_NAMESPACES"in R?Nt({},R.ALLOWED_NAMESPACES,Om):ut,X="ADD_URI_SAFE_ATTR"in R?Nt(qr(ie),R.ADD_URI_SAFE_ATTR,Fe):ie,W="ADD_DATA_URI_TAGS"in R?Nt(qr(ue),R.ADD_DATA_URI_TAGS,Fe):ue,M="FORBID_CONTENTS"in R?Nt({},R.FORBID_CONTENTS,Fe):N,Ee="FORBID_TAGS"in R?Nt({},R.FORBID_TAGS,Fe):{},xe="FORBID_ATTR"in R?Nt({},R.FORBID_ATTR,Fe):{},ce="USE_PROFILES"in R?R.USE_PROFILES:!1,Me=R.ALLOW_ARIA_ATTR!==!1,Z=R.ALLOW_DATA_ATTR!==!1,ye=R.ALLOW_UNKNOWN_PROTOCOLS||!1,fe=R.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ne=R.SAFE_FOR_TEMPLATES||!1,Le=R.WHOLE_DOCUMENT||!1,K=R.RETURN_DOM||!1,de=R.RETURN_DOM_FRAGMENT||!1,le=R.RETURN_TRUSTED_TYPE||!1,q=R.FORCE_BODY||!1,Re=R.SANITIZE_DOM!==!1,Ie=R.SANITIZE_NAMED_PROPS||!1,pe=R.KEEP_CONTENT!==!1,re=R.IN_PLACE||!1,Q=R.ALLOWED_URI_REGEXP||IN,Qe=R.NAMESPACE||ke,ee=R.CUSTOM_ELEMENT_HANDLING||{},R.CUSTOM_ELEMENT_HANDLING&&Ke(R.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ee.tagNameCheck=R.CUSTOM_ELEMENT_HANDLING.tagNameCheck),R.CUSTOM_ELEMENT_HANDLING&&Ke(R.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ee.attributeNameCheck=R.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),R.CUSTOM_ELEMENT_HANDLING&&typeof R.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ee.allowCustomizedBuiltInElements=R.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ne&&(Z=!1),de&&(K=!0),ce&&(J=Nt({},fC),ae=[],ce.html===!0&&(Nt(J,hC),Nt(ae,mC)),ce.svg===!0&&(Nt(J,Im),Nt(ae,km),Nt(ae,Bc)),ce.svgFilters===!0&&(Nt(J,Mm),Nt(ae,km),Nt(ae,Bc)),ce.mathMl===!0&&(Nt(J,Dm),Nt(ae,gC),Nt(ae,Bc))),R.ADD_TAGS&&(J===j&&(J=qr(J)),Nt(J,R.ADD_TAGS,Fe)),R.ADD_ATTR&&(ae===ve&&(ae=qr(ae)),Nt(ae,R.ADD_ATTR,Fe)),R.ADD_URI_SAFE_ATTR&&Nt(X,R.ADD_URI_SAFE_ATTR,Fe),R.FORBID_CONTENTS&&(M===N&&(M=qr(M)),Nt(M,R.FORBID_CONTENTS,Fe)),pe&&(J["#text"]=!0),Le&&Nt(J,["html","head","body"]),J.table&&(Nt(J,["tbody"]),delete Ee.tbody),R.TRUSTED_TYPES_POLICY){if(typeof R.TRUSTED_TYPES_POLICY.createHTML!="function")throw pl('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof R.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw pl('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=R.TRUSTED_TYPES_POLICY,S=v.createHTML("")}else v===void 0&&(v=RKe(_,s)),v!==null&&typeof S=="string"&&(S=v.createHTML(""));$n&&$n(R),pt=R}},Oe=Nt({},["mi","mo","mn","ms","mtext"]),Be=Nt({},["foreignobject","desc","title","annotation-xml"]),dt=Nt({},["title","style","font","a","script"]),Et=Nt({},[...Im,...Mm,...gKe]),Qt=Nt({},[...Dm,...bKe]),cn=function(R){let Y=y(R);(!Y||!Y.tagName)&&(Y={namespaceURI:Qe,tagName:"template"});const te=Md(R.tagName),be=Md(Y.tagName);return Pe[R.namespaceURI]?R.namespaceURI===Ce?Y.namespaceURI===ke?te==="svg":Y.namespaceURI===Ae?te==="svg"&&(be==="annotation-xml"||Oe[be]):!!Et[te]:R.namespaceURI===Ae?Y.namespaceURI===ke?te==="math":Y.namespaceURI===Ce?te==="math"&&Be[be]:!!Qt[te]:R.namespaceURI===ke?Y.namespaceURI===Ce&&!Be[be]||Y.namespaceURI===Ae&&!Oe[be]?!1:!Qt[te]&&(dt[te]||!Et[te]):!!(Ze==="application/xhtml+xml"&&Pe[R.namespaceURI]):!1},Ct=function(R){dl(e.removed,{element:R});try{R.parentNode.removeChild(R)}catch{R.remove()}},$t=function(R,Y){try{dl(e.removed,{attribute:Y.getAttributeNode(R),from:Y})}catch{dl(e.removed,{attribute:null,from:Y})}if(Y.removeAttribute(R),R==="is"&&!ae[R])if(K||de)try{Ct(Y)}catch{}else try{Y.setAttribute(R,"")}catch{}},Sn=function(R){let Y=null,te=null;if(q)R=""+R;else{const Ve=pKe(R,/^[\r\n\t ]+/);te=Ve&&Ve[0]}Ze==="application/xhtml+xml"&&Qe===ke&&(R=''+R+"");const be=v?v.createHTML(R):R;if(Qe===ke)try{Y=new f().parseFromString(be,Ze)}catch{}if(!Y||!Y.documentElement){Y=C.createDocument(Qe,"template",null);try{Y.documentElement.innerHTML=ct?S:be}catch{}}const me=Y.body||Y.documentElement;return R&&te&&me.insertBefore(t.createTextNode(te),me.childNodes[0]||null),Qe===ke?k.call(Y,Le?"html":"body")[0]:Le?Y.documentElement:me},bs=function(R){return T.call(R.ownerDocument||R,R,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT,null)},Mr=function(R){return R instanceof h&&(typeof R.nodeName!="string"||typeof R.textContent!="string"||typeof R.removeChild!="function"||!(R.attributes instanceof d)||typeof R.removeAttribute!="function"||typeof R.setAttribute!="function"||typeof R.namespaceURI!="string"||typeof R.insertBefore!="function"||typeof R.hasChildNodes!="function")},ci=function(R){return typeof a=="function"&&R instanceof a},Tn=function(R,Y,te){I[R]&&Uc(I[R],be=>{be.call(e,Y,te,pt)})},di=function(R){let Y=null;if(Tn("beforeSanitizeElements",R,null),Mr(R))return Ct(R),!0;const te=Fe(R.nodeName);if(Tn("uponSanitizeElement",R,{tagName:te,allowedTags:J}),R.hasChildNodes()&&!ci(R.firstElementChild)&&ni(/<[/\w]/g,R.innerHTML)&&ni(/<[/\w]/g,R.textContent))return Ct(R),!0;if(!J[te]||Ee[te]){if(!Ee[te]&&Es(te)&&(ee.tagNameCheck instanceof RegExp&&ni(ee.tagNameCheck,te)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(te)))return!1;if(pe&&!M[te]){const be=y(R)||R.parentNode,me=g(R)||R.childNodes;if(me&&be){const Ve=me.length;for(let Xe=Ve-1;Xe>=0;--Xe)be.insertBefore(E(me[Xe],!0),b(R))}}return Ct(R),!0}return R instanceof l&&!cn(R)||(te==="noscript"||te==="noembed"||te==="noframes")&&ni(/<\/no(script|embed|frames)/i,R.innerHTML)?(Ct(R),!0):(Ne&&R.nodeType===3&&(Y=R.textContent,Uc([F,B,ne],be=>{Y=ul(Y,be," ")}),R.textContent!==Y&&(dl(e.removed,{element:R.cloneNode()}),R.textContent=Y)),Tn("afterSanitizeElements",R,null),!1)},ji=function(R,Y,te){if(Re&&(Y==="id"||Y==="name")&&(te in t||te in oe))return!1;if(!(Z&&!xe[Y]&&ni(L,Y))){if(!(Me&&ni($,Y))){if(!ae[Y]||xe[Y]){if(!(Es(R)&&(ee.tagNameCheck instanceof RegExp&&ni(ee.tagNameCheck,R)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(R))&&(ee.attributeNameCheck instanceof RegExp&&ni(ee.attributeNameCheck,Y)||ee.attributeNameCheck instanceof Function&&ee.attributeNameCheck(Y))||Y==="is"&&ee.allowCustomizedBuiltInElements&&(ee.tagNameCheck instanceof RegExp&&ni(ee.tagNameCheck,te)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(te))))return!1}else if(!X[Y]){if(!ni(Q,ul(te,U,""))){if(!((Y==="src"||Y==="xlink:href"||Y==="href")&&R!=="script"&&_Ke(te,"data:")===0&&W[R])){if(!(ye&&!ni(H,ul(te,U,"")))){if(te)return!1}}}}}}return!0},Es=function(R){return R.indexOf("-")>0},ys=function(R){Tn("beforeSanitizeAttributes",R,null);const{attributes:Y}=R;if(!Y)return;const te={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ae};let be=Y.length;for(;be--;){const me=Y[be],{name:Ve,namespaceURI:Xe,value:it}=me,at=Fe(Ve);let rt=Ve==="value"?it:hKe(it);if(te.attrName=at,te.attrValue=rt,te.keepAttr=!0,te.forceKeepAttr=void 0,Tn("uponSanitizeAttribute",R,te),rt=te.attrValue,te.forceKeepAttr||($t(Ve,R),!te.keepAttr))continue;if(!fe&&ni(/\/>/i,rt)){$t(Ve,R);continue}Ne&&Uc([F,B,ne],ht=>{rt=ul(rt,ht," ")});const _t=Fe(R.nodeName);if(ji(_t,at,rt)){if(Ie&&(at==="id"||at==="name")&&($t(Ve,R),rt=z+rt),v&&typeof _=="object"&&typeof _.getAttributeType=="function"&&!Xe)switch(_.getAttributeType(_t,at)){case"TrustedHTML":{rt=v.createHTML(rt);break}case"TrustedScriptURL":{rt=v.createScriptURL(rt);break}}try{Xe?R.setAttributeNS(Xe,Ve,rt):R.setAttribute(Ve,rt),_C(e.removed)}catch{}}}Tn("afterSanitizeAttributes",R,null)},vs=function nt(R){let Y=null;const te=bs(R);for(Tn("beforeSanitizeShadowDOM",R,null);Y=te.nextNode();)Tn("uponSanitizeShadowNode",Y,null),!di(Y)&&(Y.content instanceof r&&nt(Y.content),ys(Y));Tn("afterSanitizeShadowDOM",R,null)};return e.sanitize=function(nt){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Y=null,te=null,be=null,me=null;if(ct=!nt,ct&&(nt=""),typeof nt!="string"&&!ci(nt))if(typeof nt.toString=="function"){if(nt=nt.toString(),typeof nt!="string")throw pl("dirty is not a string, aborting")}else throw pl("toString is not a function");if(!e.isSupported)return nt;if(D||Ue(R),e.removed=[],typeof nt=="string"&&(re=!1),re){if(nt.nodeName){const it=Fe(nt.nodeName);if(!J[it]||Ee[it])throw pl("root node is forbidden and cannot be sanitized in-place")}}else if(nt instanceof a)Y=Sn(""),te=Y.ownerDocument.importNode(nt,!0),te.nodeType===1&&te.nodeName==="BODY"||te.nodeName==="HTML"?Y=te:Y.appendChild(te);else{if(!K&&!Ne&&!Le&&nt.indexOf("<")===-1)return v&&le?v.createHTML(nt):nt;if(Y=Sn(nt),!Y)return K?null:le?S:""}Y&&q&&Ct(Y.firstChild);const Ve=bs(re?nt:Y);for(;be=Ve.nextNode();)di(be)||(be.content instanceof r&&vs(be.content),ys(be));if(re)return nt;if(K){if(de)for(me=O.call(Y.ownerDocument);Y.firstChild;)me.appendChild(Y.firstChild);else me=Y;return(ae.shadowroot||ae.shadowrootmode)&&(me=x.call(i,me,!0)),me}let Xe=Le?Y.outerHTML:Y.innerHTML;return Le&&J["!doctype"]&&Y.ownerDocument&&Y.ownerDocument.doctype&&Y.ownerDocument.doctype.name&&ni(MN,Y.ownerDocument.doctype.name)&&(Xe=" `+Xe),Ne&&Uc([F,B,ne],it=>{Xe=ul(Xe,it," ")}),v&&le?v.createHTML(Xe):Xe},e.setConfig=function(){let nt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ue(nt),D=!0},e.clearConfig=function(){pt=null,D=!1},e.isValidAttribute=function(nt,R,Y){pt||Ue({});const te=Fe(nt),be=Fe(R);return ji(te,be,Y)},e.addHook=function(nt,R){typeof R=="function"&&(I[nt]=I[nt]||[],dl(I[nt],R))},e.removeHook=function(nt){if(I[nt])return _C(I[nt])},e.removeHooks=function(nt){I[nt]&&(I[nt]=[])},e.removeAllHooks=function(){I={}},e}DN();function AKe(n){return n.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}const NKe={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:cKe},setup(n){const e=new Lbe({html:!0,highlight:(s,r)=>{const o=r&&_o.getLanguage(r)?r:"plaintext";return _o.highlight(o,s).value},renderInline:!0,breaks:!0}).use(BHe).use(jo).use(JHe,{figcaption:!0}).use(p7e).use(WHe,{inlineOpen:"$",inlineClose:"$",blockOpen:"$$",blockClose:"$$"}).use(XHe,{enableRowspan:!0,enableColspan:!0,enableGridTables:!0,enableGridTablesExtra:!0,enableTableIndentation:!0,tableCellPadding:" ",tableCellJoiner:"|",multilineCellStartMarker:"|>",multilineCellEndMarker:"<|",multilineCellPadding:" ",multilineCellJoiner:` `}),t=ft([]),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:AKe(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=[];Ge(()=>{He.replace()})};return qn(()=>n.markdownText,i),Ws(i),{markdownItems:t}}},OKe={class:"break-all container w-full"},IKe={ref:"mdRender",class:"markdown-content"},MKe=["innerHTML"];function DKe(n,e,t,i,s,r){const o=mt("code-block");return w(),A("div",OKe,[c("div",IKe,[(w(!0),A($e,null,lt(i.markdownItems,(a,l)=>(w(),A("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(),A("div",{key:1,innerHTML:a.html},null,8,MKe))]))),128))],512)])}const sp=bt(NKe,[["render",DKe]]),kKe={data(){return{show:!1,has_button:!0,message:""}},components:{MarkdownRenderer:sp},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}}},LKe={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50 z-50"},PKe={class:"pl-10 pr-10 bg-bg-light dark:bg-bg-dark p-8 rounded-lg shadow-lg"},UKe={class:"container max-h-500 overflow-y-auto"},FKe={class:"text-lg font-medium"},BKe={class:"mt-4 flex justify-center"},GKe={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"},VKe=c("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),zKe=c("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),HKe=[VKe,zKe];function qKe(n,e,t,i,s,r){const o=mt("MarkdownRenderer");return s.show?(w(),A("div",LKe,[c("div",PKe,[c("div",UKe,[c("div",FKe,[Te(o,{ref:"mdRender",host:"","markdown-text":s.message,message_id:0,discussion_id:0},null,8,["markdown-text"])])]),c("div",BKe,[s.has_button?(w(),A("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 ")):V("",!0),s.has_button?V("",!0):(w(),A("svg",GKe,HKe))])])])):V("",!0)}const kN=bt(kKe,[["render",qKe]]);const YKe={props:{progress:{type:Number,required:!0}}},$Ke={class:"progress-bar-container"};function WKe(n,e,t,i,s,r){return w(),A("div",$Ke,[c("div",{class:"progress-bar",style:en({width:`${t.progress}%`})},null,4)])}const nc=bt(YKe,[["render",WKe]]),KKe={setup(){return{}},name:"UniversalForm",data(){return{show:!1,resolve:null,controls_array:[],title:"Universal form",ConfirmButtonText:"Submit",DenyButtonText:"Cancel"}},mounted(){Ge(()=>{He.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(){Ge(()=>{He.replace()})}}},jKe={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50 p-4"},QKe={class:"relative w-full max-w-md"},XKe={class:"flex flex-col rounded-lg bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel duration-150 shadow-lg max-h-screen"},ZKe={class:"flex flex-row flex-grow items-center m-2 p-1"},JKe={class:"grow flex items-center"},eje=c("i",{"data-feather":"sliders",class:"mr-2 flex-shrink-0"},null,-1),tje={class:"text-lg font-semibold select-none mr-2"},nje={class:"items-end"},ije=c("svg",{"aria-hidden":"true",class:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[c("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),sje=c("span",{class:"sr-only"},"Close form modal",-1),rje=[ije,sje],oje={class:"flex flex-col relative no-scrollbar overflow-y-scroll p-2"},aje={class:"px-2"},lje={key:0},cje={key:0},dje={class:"text-base font-semibold"},uje={key:0,class:"relative inline-flex"},pje=["onUpdate:modelValue"],_je=c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[c("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),hje={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},fje=["onUpdate:modelValue"],mje={key:1},gje={class:"text-base font-semibold"},bje={key:0,class:"relative inline-flex"},Eje=["onUpdate:modelValue"],yje=c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[c("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"},Sje=["onUpdate:modelValue"],Tje=["value","selected"],xje={key:1},Cje={class:"",onclick:"btn_clicked(item)"},wje={key:2},Rje={key:0},Aje={class:"text-base font-semibold"},Nje={key:0,class:"relative inline-flex"},Oje=["onUpdate:modelValue"],Ije=c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[c("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),Mje={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},Dje=["onUpdate:modelValue"],kje={key:1},Lje={class:"text-base font-semibold"},Pje={key:0,class:"relative inline-flex"},Uje=["onUpdate:modelValue"],Fje=c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[c("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),Bje={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},Gje=["onUpdate:modelValue"],Vje=["value","selected"],zje={key:3},Hje={class:"text-base font-semibold"},qje={key:0,class:"relative inline-flex"},Yje=["onUpdate:modelValue"],$je=c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[c("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),Wje={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},Kje=["onUpdate:modelValue"],jje=["onUpdate:modelValue","min","max"],Qje={key:4},Xje={class:"text-base font-semibold"},Zje={key:0,class:"relative inline-flex"},Jje=["onUpdate:modelValue"],eQe=c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[c("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),tQe={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},nQe=["onUpdate:modelValue"],iQe=["onUpdate:modelValue","min","max"],sQe={key:5},rQe={class:"mb-2 relative flex items-center gap-2"},oQe={for:"default-checkbox",class:"text-base font-semibold"},aQe=["onUpdate:modelValue"],lQe={key:0,class:"relative inline-flex"},cQe=["onUpdate:modelValue"],dQe=c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[c("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),uQe={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},pQe={key:6},_Qe={class:"text-base font-semibold"},hQe={key:0,class:"relative inline-flex"},fQe=["onUpdate:modelValue"],mQe=c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary"},[c("i",{"data-feather":"help-circle",class:"w-5 h-5"})],-1),gQe={key:0,class:"text-sm font-normal text-gray-700 dark:text-gray-400 mb-2"},bQe=["onUpdate:modelValue"],EQe=c("hr",{class:"h-px my-4 bg-gray-200 border-0 dark:bg-gray-700"},null,-1),yQe={class:"flex flex-row flex-grow gap-3"},vQe={class:"p-2 text-center grow"};function SQe(n,e,t,i,s,r){return s.show?(w(),A("div",jKe,[c("div",QKe,[c("div",XKe,[c("div",ZKe,[c("div",JKe,[eje,c("h3",tje,he(s.title),1)]),c("div",nje,[c("button",{type:"button",onClick:e[0]||(e[0]=ge(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"},rje)])]),c("div",oje,[(w(!0),A($e,null,lt(s.controls_array,(o,a)=>(w(),A("div",aje,[o.type=="str"||o.type=="string"?(w(),A("div",lje,[o.options?V("",!0):(w(),A("div",cje,[c("label",{class:ze(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[c("div",dje,he(o.name)+": ",1),o.help?(w(),A("label",uje,[G(c("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,pje),[[Je,o.isHelp]]),_je])):V("",!0)],2),o.isHelp?(w(),A("p",hje,he(o.help),1)):V("",!0),G(c("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,fje),[[we,o.value]])])),o.options?(w(),A("div",mje,[c("label",{class:ze(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[c("div",gje,he(o.name)+": ",1),o.help?(w(),A("label",bje,[G(c("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,Eje),[[Je,o.isHelp]]),yje])):V("",!0)],2),o.isHelp?(w(),A("p",vje,he(o.help),1)):V("",!0),G(c("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),A($e,null,lt(o.options,l=>(w(),A("option",{value:l,selected:o.value===l},he(l),9,Tje))),256))],8,Sje),[[Wt,o.value]])])):V("",!0)])):V("",!0),o.type=="btn"?(w(),A("div",xje,[c("button",Cje,he(o.name),1)])):V("",!0),o.type=="text"?(w(),A("div",wje,[o.options?V("",!0):(w(),A("div",Rje,[c("label",{class:ze(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[c("div",Aje,he(o.name)+": ",1),o.help?(w(),A("label",Nje,[G(c("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,Oje),[[Je,o.isHelp]]),Ije])):V("",!0)],2),o.isHelp?(w(),A("p",Mje,he(o.help),1)):V("",!0),G(c("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,Dje),[[we,o.value]])])),o.options?(w(),A("div",kje,[c("label",{class:ze(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[c("div",Lje,he(o.name)+": ",1),o.help?(w(),A("label",Pje,[G(c("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,Uje),[[Je,o.isHelp]]),Fje])):V("",!0)],2),o.isHelp?(w(),A("p",Bje,he(o.help),1)):V("",!0),G(c("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),A($e,null,lt(o.options,l=>(w(),A("option",{value:l,selected:o.value===l},he(l),9,Vje))),256))],8,Gje),[[Wt,o.value]])])):V("",!0)])):V("",!0),o.type=="int"?(w(),A("div",zje,[c("label",{class:ze(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[c("div",Hje,he(o.name)+": ",1),o.help?(w(),A("label",qje,[G(c("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,Yje),[[Je,o.isHelp]]),$je])):V("",!0)],2),o.isHelp?(w(),A("p",Wje,he(o.help),1)):V("",!0),G(c("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,Kje),[[we,o.value]]),o.min!=null&&o.max!=null?G((w(),A("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,jje)),[[we,o.value]]):V("",!0)])):V("",!0),o.type=="float"?(w(),A("div",Qje,[c("label",{class:ze(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[c("div",Xje,he(o.name)+": ",1),o.help?(w(),A("label",Zje,[G(c("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,Jje),[[Je,o.isHelp]]),eQe])):V("",!0)],2),o.isHelp?(w(),A("p",tQe,he(o.help),1)):V("",!0),G(c("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,nQe),[[we,o.value]]),o.min!=null&&o.max!=null?G((w(),A("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,iQe)),[[we,o.value]]):V("",!0)])):V("",!0),o.type=="bool"?(w(),A("div",sQe,[c("div",rQe,[c("label",oQe,he(o.name)+": ",1),G(c("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,aQe),[[Je,o.value]]),o.help?(w(),A("label",lQe,[G(c("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,cQe),[[Je,o.isHelp]]),dQe])):V("",!0)]),o.isHelp?(w(),A("p",uQe,he(o.help),1)):V("",!0)])):V("",!0),o.type=="list"?(w(),A("div",pQe,[c("label",{class:ze(["mb-2 relative flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white select-none",o.help?"cursor-pointer ":""])},[c("div",_Qe,he(o.name)+": ",1),o.help?(w(),A("label",hQe,[G(c("input",{type:"checkbox","onUpdate:modelValue":l=>o.isHelp=l,class:"sr-only peer"},null,8,fQe),[[Je,o.isHelp]]),mQe])):V("",!0)],2),o.isHelp?(w(),A("p",gQe,he(o.help),1)):V("",!0),G(c("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,bQe),[[we,o.value]])])):V("",!0),EQe]))),256)),c("div",yQe,[c("div",vQe,[c("button",{onClick:e[1]||(e[1]=ge(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"},he(s.ConfirmButtonText),1),c("button",{onClick:e[2]||(e[2]=ge(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"},he(s.DenyButtonText),1)])])])])])])):V("",!0)}const bc=bt(KKe,[["render",SQe]]),TQe={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})}}},xQe={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50"},CQe={class:"relative w-full max-w-md max-h-full"},wQe={class:"relative bg-white rounded-lg shadow dark:bg-gray-700"},RQe=c("svg",{"aria-hidden":"true",class:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[c("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),AQe=c("span",{class:"sr-only"},"Close modal",-1),NQe=[RQe,AQe],OQe={class:"p-4 text-center"},IQe=c("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"},[c("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),MQe={class:"mb-5 text-lg font-normal text-gray-500 dark:text-gray-400 select-none break-all"};function DQe(n,e,t,i,s,r){return s.show?(w(),A("div",xQe,[c("div",CQe,[c("div",wQe,[c("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"},NQe),c("div",OQe,[IQe,c("h3",MQe,he(s.message),1),c("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"},he(s.ConfirmButtonText),1),c("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"},he(s.DenyButtonText),1)])])])])):V("",!0)}const LN=bt(TQe,[["render",DQe]]),kQe={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(){Se.post("/set_personality_config",{client_id:this.$store.state.client_id,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)})}}},LQe={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50 z-20"},PQe={class:"relative w-full max-h-full bg-bg-light dark:bg-bg-dark"},UQe={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"},FQe=c("svg",{"aria-hidden":"true",class:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[c("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),BQe=c("span",{class:"sr-only"},"Close modal",-1),GQe=[FQe,BQe],VQe={class:"justify-center text-center items-center w-full bg-bg-light dark:bg-bg-dark"},zQe={class:"w-full flex flex-row mt-4 text-center justify-center"},HQe={class:"w-full max-h-full container bg-bg-light dark:bg-bg-dark"},qQe={class:"mb-4 w-full"},YQe={class:"w-full bg-bg-light dark:bg-bg-dark"},$Qe=c("td",null,[c("label",{for:"personalityConditioning"},"Personality Conditioning:")],-1),WQe=c("td",null,[c("label",{for:"userMessagePrefix"},"User Message Prefix:")],-1),KQe=c("td",null,[c("label",{for:"aiMessagePrefix"},"AI Message Prefix:")],-1),jQe=c("td",null,[c("label",{for:"linkText"},"Link Text:")],-1),QQe=c("td",null,[c("label",{for:"welcomeMessage"},"Welcome Message:")],-1),XQe=c("td",null,[c("label",{for:"modelTemperature"},"Model Temperature:")],-1),ZQe=c("td",null,[c("label",{for:"modelTopK"},"Model Top K:")],-1),JQe=c("td",null,[c("label",{for:"modelTopP"},"Model Top P:")],-1),eXe=c("td",null,[c("label",{for:"modelRepeatPenalty"},"Model Repeat Penalty:")],-1),tXe=c("td",null,[c("label",{for:"modelRepeatLastN"},"Model Repeat Last N:")],-1),nXe=c("td",null,[c("label",{for:"recommendedBinding"},"Recommended Binding:")],-1),iXe=c("td",null,[c("label",{for:"recommendedModel"},"Recommended Model:")],-1),sXe=c("td",null,[c("label",{class:"dark:bg-black dark:text-primary w-full",for:"dependencies"},"Dependencies:")],-1),rXe=c("td",null,[c("label",{for:"antiPrompts"},"Anti Prompts:")],-1);function oXe(n,e,t,i,s,r){return s.show?(w(),A("div",LQe,[c("div",PQe,[c("div",UQe,[c("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"},GQe),c("div",VQe,[c("div",zQe,[c("button",{type:"submit",onClick:e[1]||(e[1]=ge((...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 "),c("button",{onClick:e[2]||(e[2]=ge(o=>r.hide(),["prevent"])),class:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"}," Close ")]),c("div",HQe,[c("form",qQe,[c("table",YQe,[c("tr",null,[$Qe,c("td",null,[G(c("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),[[we,t.config.personality_conditioning]])])]),c("tr",null,[WQe,c("td",null,[G(c("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),[[we,t.config.user_message_prefix]])])]),c("tr",null,[KQe,c("td",null,[G(c("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),[[we,t.config.ai_message_prefix]])])]),c("tr",null,[jQe,c("td",null,[G(c("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),[[we,t.config.link_text]])])]),c("tr",null,[QQe,c("td",null,[G(c("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),[[we,t.config.welcome_message]])])]),c("tr",null,[XQe,c("td",null,[G(c("input",{type:"number",id:"modelTemperature","onUpdate:modelValue":e[8]||(e[8]=o=>t.config.model_temperature=o)},null,512),[[we,t.config.model_temperature]])])]),c("tr",null,[ZQe,c("td",null,[G(c("input",{class:"dark:bg-black dark:text-primary w-full",type:"number",id:"modelTopK","onUpdate:modelValue":e[9]||(e[9]=o=>t.config.model_top_k=o)},null,512),[[we,t.config.model_top_k]])])]),c("tr",null,[JQe,c("td",null,[G(c("input",{class:"dark:bg-black dark:text-primary w-full",type:"number",id:"modelTopP","onUpdate:modelValue":e[10]||(e[10]=o=>t.config.model_top_p=o)},null,512),[[we,t.config.model_top_p]])])]),c("tr",null,[eXe,c("td",null,[G(c("input",{class:"dark:bg-black dark:text-primary w-full",type:"number",id:"modelRepeatPenalty","onUpdate:modelValue":e[11]||(e[11]=o=>t.config.model_repeat_penalty=o)},null,512),[[we,t.config.model_repeat_penalty]])])]),c("tr",null,[tXe,c("td",null,[G(c("input",{class:"dark:bg-black dark:text-primary w-full",type:"number",id:"modelRepeatLastN","onUpdate:modelValue":e[12]||(e[12]=o=>t.config.model_repeat_last_n=o)},null,512),[[we,t.config.model_repeat_last_n]])])]),c("tr",null,[nXe,c("td",null,[G(c("input",{class:"dark:bg-black dark:text-primary w-full",type:"text",id:"recommendedBinding","onUpdate:modelValue":e[13]||(e[13]=o=>t.config.recommended_binding=o)},null,512),[[we,t.config.recommended_binding]])])]),c("tr",null,[iXe,c("td",null,[G(c("input",{class:"dark:bg-black dark:text-primary w-full",type:"text",id:"recommendedModel","onUpdate:modelValue":e[14]||(e[14]=o=>t.config.recommended_model=o)},null,512),[[we,t.config.recommended_model]])])]),c("tr",null,[sXe,c("td",null,[G(c("textarea",{class:"dark:bg-black dark:text-primary w-full",id:"dependencies","onUpdate:modelValue":e[15]||(e[15]=o=>t.config.dependencies=o)},null,512),[[we,t.config.dependencies]])])]),c("tr",null,[rXe,c("td",null,[G(c("textarea",{class:"dark:bg-black dark:text-primary w-full",id:"antiPrompts","onUpdate:modelValue":e[16]||(e[16]=o=>t.config.anti_prompts=o)},null,512),[[we,t.config.anti_prompts]])])])])])])])])])])):V("",!0)}const PN=bt(kQe,[["render",oXe]]);const aXe={data(){return{showPopup:!1,webpageUrl:"https://lollms.com/"}},methods:{show(){this.showPopup=!0},hide(){this.showPopup=!1},save_configuration(){Se.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)})}}},lXe=n=>(yo("data-v-d504dfc9"),n=n(),vo(),n),cXe={key:0,class:"fixed inset-0 flex items-center justify-center z-50"},dXe={class:"popup-container"},uXe=["src"],pXe={class:"checkbox-container"},_Xe=lXe(()=>c("label",{for:"startup",class:"checkbox-label"},"Show at startup",-1));function hXe(n,e,t,i,s,r){return w(),xt(Vi,{name:"fade"},{default:We(()=>[s.showPopup?(w(),A("div",cXe,[c("div",dXe,[c("button",{onClick:e[0]||(e[0]=(...o)=>r.hide&&r.hide(...o)),class:"close-button"}," X "),c("iframe",{src:s.webpageUrl,class:"iframe-content"},null,8,uXe),c("div",pXe,[G(c("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),[[Je,this.$store.state.config.show_news_panel]]),_Xe])])])):V("",!0)]),_:1})}const UN=bt(aXe,[["render",hXe],["__scopeId","data-v-d504dfc9"]]),FN="/assets/fastapi-4a6542d0.png",BN="/assets/discord-6817c341.svg";const fXe={key:0,class:"container z-60 flex flex-col sm:flex-row items-center"},mXe={class:"w-full text-center"},gXe={class:"m-0 flex border-b w-full items-center justify-center flex flex-row font-medium nav-ul text-center"},bXe={name:"Navigation",data(){return{}},methods:{isRouteActive(n){try{return this.$route.name===n}catch{return console.log("routeName not found"),False}}}},GN=Object.assign(bXe,{setup(n){return(e,t)=>e.$store.state.ready?(w(),A("div",fXe,[c("div",mXe,[c("div",gXe,[Te(yt(ks),{to:{name:"discussions"},class:ze(["inline-block border-l border-t border-r rounded-t py-2 px-4 text-blue-700 font-semibold",{"text-green-600 hover:text-green-500 dark:text-green-100 font-bold bg-bg-secondary shadow-no-bottom":e.isRouteActive("discussions"),"bounce-in":e.isRouteActive("discussions")}])},{default:We(()=>[et(" Discussions ")]),_:1},8,["class"]),Te(yt(ks),{to:{name:"playground"},class:ze(["inline-block border-l border-t border-r rounded-t py-2 px-4 text-blue-700 font-semibold",{"text-green-600 hover:text-green-500 dark:text-green-100 font-bold bg-bg-secondary shadow-no-bottom":e.isRouteActive("playground"),"bounce-in":e.isRouteActive("playground")}])},{default:We(()=>[et(" Playground ")]),_:1},8,["class"]),e.$store.state.config.enable_sd_service|e.$store.state.config.active_tti_service=="autosd"?(w(),xt(yt(ks),{key:0,to:{name:"AutoSD"},class:ze(["inline-block border-l border-t border-r rounded-t py-2 px-4 text-blue-700 font-semibold",{"text-green-600 hover:text-green-500 dark:text-green-100 font-bold bg-bg-secondary shadow-no-bottom":e.isRouteActive("AutoSD"),"bounce-in":e.isRouteActive("AutoSD")}])},{default:We(()=>[et(" Auto111-SD ")]),_:1},8,["class"])):V("",!0),e.$store.state.config.enable_comfyui_service|e.$store.state.config.active_tti_service=="comfyui"?(w(),xt(yt(ks),{key:1,to:{name:"ComfyUI"},class:ze(["inline-block border-l border-t border-r rounded-t py-2 px-4 text-blue-700 font-semibold",{"text-green-600 hover:text-green-500 dark:text-green-100 font-bold bg-bg-secondary shadow-no-bottom":e.isRouteActive("ComfyUI"),"bounce-in":e.isRouteActive("ComfyUI")}])},{default:We(()=>[et(" ComfyUI ")]),_:1},8,["class"])):V("",!0),e.$store.state.config.active_tts_service!="None"&e.$store.state.config.active_stt_service!="None"?(w(),xt(yt(ks),{key:2,to:{name:"interactive"},class:ze(["inline-block border-l border-t border-r rounded-t py-2 px-4 text-blue-700 font-semibold",{"text-green-600 hover:text-green-500 dark:text-green-100 font-bold bg-bg-secondary shadow-no-bottom":e.isRouteActive("interactive"),"bounce-in":e.isRouteActive("interactive")}])},{default:We(()=>[et(" interactive ")]),_:1},8,["class"])):V("",!0),Te(yt(ks),{to:{name:"settings"},class:ze(["inline-block border-l border-t border-r rounded-t py-2 px-4 text-blue-700 font-semibold",{"text-green-600 hover:text-green-500 dark:text-green-100 font-bold bg-bg-secondary shadow-no-bottom":e.isRouteActive("settings"),"bounce-in":e.isRouteActive("settings")}])},{default:We(()=>[et(" Settings ")]),_:1},8,["class"]),Te(yt(ks),{to:{name:"help_view"},class:ze(["inline-block border-l border-t border-r rounded-t py-2 px-4 text-blue-700 font-semibold",{"text-green-600 hover:text-green-500 dark:text-green-100 font-bold bg-bg-secondary shadow-no-bottom":e.isRouteActive("help_view"),"bounce-in":e.isRouteActive("help_view")}])},{default:We(()=>[et(" Help ")]),_:1},8,["class"])])])])):V("",!0)}}),VN="/assets/static_info-b284ded1.svg",EXe="/assets/animated_info-7edcb0f9.svg",Ti="/assets/logo-f63ca8ad.png",zN="/assets/fun_mode-14669a57.svg",HN="/assets/normal_mode-f539f08d.svg";const yXe={class:"top-0 shadow-lg"},vXe={class:"container flex flex-col lg:flex-row item-center gap-2 pb-0"},SXe={class:"flex items-center gap-3 flex-1"},TXe=["src"],xXe=c("div",{class:"flex flex-col"},[c("p",{class:"text-2xl font-bold text-2xl drop-shadow-md align-middle"},"LoLLMS"),c("p",{class:"text-gray-400"},"One tool to rule them all")],-1),CXe={class:"flex gap-3 flex-1 items-center justify-end"},wXe={key:0,title:"Model is ok",class:"text-green-500 cursor-pointer"},RXe=c("b",{class:"text-2xl"},"M",-1),AXe=[RXe],NXe={key:1,title:"Model is not ok",class:"text-red-500 cursor-pointer"},OXe=c("b",{class:"text-2xl"},"M",-1),IXe=[OXe],MXe={key:2,title:"Text is not being generated. Ready to generate",class:"text-green-500 cursor-pointer"},DXe=c("i",{"data-feather":"flag"},null,-1),kXe=[DXe],LXe={key:3,title:"Generation in progress...",class:"text-red-500 cursor-pointer"},PXe=c("i",{"data-feather":"flag"},null,-1),UXe=[PXe],FXe={key:4,title:"Connection status: Connected",class:"text-green-500 cursor-pointer"},BXe=c("i",{"data-feather":"zap"},null,-1),GXe=[BXe],VXe={key:5,title:"Connection status: Not connected",class:"text-red-500 cursor-pointer"},zXe=c("i",{"data-feather":"zap-off"},null,-1),HXe=[zXe],qXe=c("div",{class:"text-2xl hover:text-primary duration-150",title:"restart program"},[c("i",{"data-feather":"power"})],-1),YXe=[qXe],$Xe=c("div",{class:"text-2xl hover:text-primary duration-150",title:"refresh page"},[c("i",{"data-feather":"refresh-ccw"})],-1),WXe=[$Xe],KXe={href:"https://github.com/ParisNeo/lollms-webui",target:"_blank"},jXe={class:"text-2xl hover:text-primary duration-150",title:"Fast API doc"},QXe={href:"/docs",target:"_blank"},XXe=["src"],ZXe=Fu('
',2),JXe={href:"https://x.com/ParisNeo_AI",target:"_blank"},eZe={class:"text-2xl hover:fill-primary dark:fill-white dark:hover:fill-primary duration-150",title:"Follow me on my twitter acount"},tZe={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"},nZe=c("g",{id:"layer1",transform:"translate(52.390088,-25.058597)"},[c("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),iZe=[nZe],sZe={href:"https://discord.com/channels/1092918764925882418",target:"_blank"},rZe={class:"text-2xl hover:text-primary duration-150",title:"Visit my discord channel"},oZe=["src"],aZe=c("i",{"data-feather":"sun"},null,-1),lZe=[aZe],cZe=c("i",{"data-feather":"moon"},null,-1),dZe=[cZe],uZe=["src"],pZe=["src"],_Ze=["src"],hZe={class:"language-selector relative",style:{position:"relative"}},fZe={key:0,ref:"languageMenu",class:"container language-menu absolute left-0 mt-1 bg-white dark:bg-bg-dark-tone rounded shadow-lg z-10 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",style:{position:"absolute",top:"100%",width:"200px","max-height":"300px","overflow-y":"auto"}},mZe={style:{"list-style-type":"none","padding-left":"0","margin-left":"0"}},gZe=["onClick"],bZe=["onClick"],EZe={class:"cursor-pointer hover:text-white py-0 px-0 block whitespace-no-wrap"},yZe={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"},vZe={class:"text-2xl animate-pulse mt-2 text-white"},SZe={id:"app"},TZe=c("body",null,null,-1),xZe={name:"TopBar",computed:{storeLogo(){return this.$store.state.config?Ti:this.$store.state.config.app_custom_logo!=""?"/user_infos/"+this.$store.state.config.app_custom_logo:Ti},languages:{get(){return console.log("searching languages",this.$store.state.languages),this.$store.state.languages}},language:{get(){return console.log("searching language",this.$store.state.language),this.$store.state.language}},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},is_fun_mode(){try{return this.$store.state.config?this.$store.state.config.fun_mode:!1}catch(n){return console.error("Oopsie! Looks like we hit a snag: ",n),!1}},isModelOK(){return this.$store.state.isModelOk},isGenerating(){return this.$store.state.isGenerating},isConnected(){return this.$store.state.isConnected}},components:{Toast:hc,MessageBox:kN,ProgressBar:nc,UniversalForm:bc,YesNoDialog:LN,Navigation:GN,PersonalityEditor:PN,PopupViewer:UN},watch:{"$store.state.config.fun_mode":function(n,e){console.log(`Fun mode changed from ${e} to ${n}! 🎉`)},"$store.state.isConnected":function(n,e){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()),Ge(()=>{He.replace()})}},data(){return{customLanguage:"",selectedLanguage:"",isLanguageMenuVisible:!1,static_info:VN,animated_info:EXe,normal_mode:HN,fun_mode:zN,is_first_connection:!0,discord:BN,FastAPI:FN,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,posts_headers:{accept:"application/json","Content-Type":"application/json"}}},async 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(),Ge(()=>{He.replace()}),window.addEventListener("resize",this.adjustMenuPosition)},beforeUnmount(){window.removeEventListener("resize",this.adjustMenuPosition)},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:{adjustMenuPosition(){const n=this.$refs.languageMenu;if(n){const e=n.getBoundingClientRect(),t=window.innerWidth;e.right>t?(n.style.left="auto",n.style.right="0"):(n.style.left="0",n.style.right="auto")}},addCustomLanguage(){this.customLanguage.trim()!==""&&(this.selectLanguage(this.customLanguage),this.customLanguage="")},async selectLanguage(n){await this.$store.dispatch("changeLanguage",n),this.toggleLanguageMenu(),this.language=n},async deleteLanguage(n){await this.$store.dispatch("deleteLanguage",n),this.toggleLanguageMenu(),this.language=n},toggleLanguageMenu(){console.log("Toggling language ",this.isLanguageMenuVisible),this.isLanguageMenuVisible=!this.isLanguageMenuVisible},restartProgram(n){n.preventDefault(),this.$store.state.api_post_req("restart_program",this.$store.state.client_id),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)},applyConfiguration(){this.isLoading=!0,console.log(this.$store.state.config),Se.post("/apply_settings",{client_id:this.$store.state.client_id,config:this.$store.state.config},{headers:this.posts_headers}).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),Ge(()=>{He.replace()})})},fun_mode_on(){console.log("Turning on fun mode"),this.$store.state.config.fun_mode=!0,this.applyConfiguration()},fun_mode_off(){console.log("Turning off fun mode"),this.$store.state.config.fun_mode=!1,this.applyConfiguration()},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"),Ge(()=>{Pp(()=>Promise.resolve({}),["assets/stackoverflow-dark-57af98f5.css"])});return}Ge(()=>{Pp(()=>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}Pp(()=>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")}}},CZe=Object.assign(xZe,{setup(n){return(e,t)=>(w(),A($e,null,[c("header",yXe,[c("nav",vXe,[Te(yt(ks),{to:{name:"discussions"}},{default:We(()=>[c("div",SXe,[c("img",{class:"w-12 hover:scale-95 duration-150",title:"LoLLMS WebUI",src:e.$store.state.config==null?yt(Ti):e.$store.state.config.app_custom_logo!=""?"/user_infos/"+e.$store.state.config.app_custom_logo:yt(Ti),alt:"Logo"},null,8,TXe),xXe])]),_:1}),c("div",CXe,[e.isModelOK?(w(),A("div",wXe,AXe)):V("",!0),e.isModelOK?V("",!0):(w(),A("div",NXe,IXe)),e.isGenerating?V("",!0):(w(),A("div",MXe,kXe)),e.isGenerating?(w(),A("div",LXe,UXe)):V("",!0),e.isConnected?(w(),A("div",FXe,GXe)):V("",!0),e.isConnected?V("",!0):(w(),A("div",VXe,HXe)),c("a",{href:"#",onClick:t[0]||(t[0]=(...i)=>e.restartProgram&&e.restartProgram(...i))},YXe),c("a",{href:"#",onClick:t[1]||(t[1]=(...i)=>e.refreshPage&&e.refreshPage(...i))},WXe),c("a",KXe,[c("div",jXe,[c("a",QXe,[c("img",{src:yt(FN),width:"75",height:"25"},null,8,XXe)])])]),ZXe,c("a",JXe,[c("div",eZe,[(w(),A("svg",tZe,iZe))])]),c("a",sZe,[c("div",rZe,[c("img",{src:yt(BN),width:"25",height:"25"},null,8,oZe)])]),c("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())},lZe),c("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())},dZe),c("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())},[c("img",{src:yt(VN)},null,8,uZe)]),e.is_fun_mode?(w(),A("div",{key:6,title:"fun mode is on press to turn off",class:"text-green-500 cursor-pointer",onClick:t[5]||(t[5]=i=>e.fun_mode_off())},[c("img",{class:"w-5 h-5",src:yt(zN)},null,8,pZe)])):(w(),A("div",{key:7,title:"fun mode is off press to turn on",class:"text-red-500 cursor-pointer",onClick:t[6]||(t[6]=i=>e.fun_mode_on())},[c("img",{class:"w-5 h-5",src:yt(HN)},null,8,_Ze)])),c("div",hZe,[c("button",{onClick:t[7]||(t[7]=(...i)=>e.toggleLanguageMenu&&e.toggleLanguageMenu(...i)),class:"bg-transparent text-black dark:text-white py-1 px-1 rounded font-bold uppercase transition-colors duration-300 hover:bg-blue-500"},he(e.$store.state.language.slice(0,2)),1),e.isLanguageMenuVisible?(w(),A("div",fZe,[c("ul",mZe,[(w(!0),A($e,null,lt(e.languages,i=>(w(),A("li",{key:i,class:"relative flex items-center",style:{"padding-left":"0","margin-left":"0"}},[c("button",{onClick:s=>e.deleteLanguage(i),class:"mr-2 text-red-500 hover:text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-opacity-50 rounded-full"},"✕",8,gZe),c("div",{onClick:s=>e.selectLanguage(i),class:ze({"cursor-pointer hover:bg-blue-500 hover:text-white py-2 px-4 block whitespace-no-wrap":!0,"bg-blue-500 text-white":i===e.$store.state.language,"flex-grow":!0})},he(i),11,bZe)]))),128)),c("li",EZe,[G(c("input",{type:"text","onUpdate:modelValue":t[8]||(t[8]=i=>e.customLanguage=i),onKeyup:t[9]||(t[9]=Hs(ge((...i)=>e.addCustomLanguage&&e.addCustomLanguage(...i),["prevent"]),["enter"])),placeholder:"Enter language...",class:"bg-transparent border border-gray-300 rounded py-0 px-0 mx-0 my-1 w-full"},null,544),[[we,e.customLanguage]])])])],512)):V("",!0)])])]),Te(GN),Te(hc,{ref:"toast"},null,512),Te(kN,{ref:"messageBox"},null,512),G(c("div",yZe,[Te(nc,{ref:"progress",progress:e.progress_value,class:"w-full h-4"},null,8,["progress"]),c("p",vZe,he(e.loading_infos)+" ...",1)],512),[[Mt,e.progress_visibility]]),Te(bc,{ref:"universalForm",class:"z-20"},null,512),Te(LN,{ref:"yesNoDialog",class:"z-20"},null,512),Te(PN,{ref:"personality_editor",config:e.currentPersonConfig,personality:e.selectedPersonality},null,8,["config","personality"]),c("div",SZe,[Te(UN,{ref:"news"},null,512)])]),TZe],64))}}),wZe={class:"flex overflow-hidden flex-grow w-full"},RZe={__name:"App",setup(n){return(e,t)=>(w(),A("div",{class:ze([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"])},[Te(CZe),c("div",wZe,[Te(yt(qA),null,{default:We(({Component:i})=>[(w(),xt(O2,null,[(w(),xt(Lu(i)))],1024))]),_:1})])],2))}},ds=Object.create(null);ds.open="0";ds.close="1";ds.ping="2";ds.pong="3";ds.message="4";ds.upgrade="5";ds.noop="6";const Dd=Object.create(null);Object.keys(ds).forEach(n=>{Dd[ds[n]]=n});const jg={type:"error",data:"parser error"},qN=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",YN=typeof ArrayBuffer=="function",$N=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,bE=({type:n,data:e},t,i)=>qN&&e instanceof Blob?t?i(e):EC(e,i):YN&&(e instanceof ArrayBuffer||$N(e))?t?i(e):EC(new Blob([e]),i):i(ds[n]+(e||"")),EC=(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 Lm;function AZe(n,e){if(qN&&n.data instanceof Blob)return n.data.arrayBuffer().then(yC).then(e);if(YN&&(n.data instanceof ArrayBuffer||$N(n.data)))return e(yC(n.data));bE(n,!1,t=>{Lm||(Lm=new TextEncoder),e(Lm.encode(t))})}const vC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",wl=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 u=new ArrayBuffer(e),d=new Uint8Array(u);for(i=0;i>4,d[s++]=(o&15)<<4|a>>2,d[s++]=(a&3)<<6|l&63;return u},OZe=typeof ArrayBuffer=="function",EE=(n,e)=>{if(typeof n!="string")return{type:"message",data:WN(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:IZe(n.substring(1),e)}:Dd[t]?n.length>1?{type:Dd[t],data:n.substring(1)}:{type:Dd[t]}:jg},IZe=(n,e)=>{if(OZe){const t=NZe(n);return WN(t,e)}else return{base64:!0,data:n}},WN=(n,e)=>{switch(e){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},KN=String.fromCharCode(30),MZe=(n,e)=>{const t=n.length,i=new Array(t);let s=0;n.forEach((r,o)=>{bE(r,!1,a=>{i[o]=a,++s===t&&e(i.join(KN))})})},DZe=(n,e)=>{const t=n.split(KN),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 Pm;function Gc(n){return n.reduce((e,t)=>e+t.length,0)}function Vc(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(jg);break}s=d*Math.pow(2,32)+u.getUint32(4),i=3}else{if(Gc(t)n){a.enqueue(jg);break}}}})}const jN=4;function un(n){if(n)return PZe(n)}function PZe(n){for(var e in un.prototype)n[e]=un.prototype[e];return n}un.prototype.on=un.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this};un.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this};un.prototype.off=un.prototype.removeListener=un.prototype.removeAllListeners=un.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 QN(n,...e){return e.reduce((t,i)=>(n.hasOwnProperty(i)&&(t[i]=n[i]),t),{})}const UZe=fi.setTimeout,FZe=fi.clearTimeout;function rp(n,e){e.useNativeTimers?(n.setTimeoutFn=UZe.bind(fi),n.clearTimeoutFn=FZe.bind(fi)):(n.setTimeoutFn=fi.setTimeout.bind(fi),n.clearTimeoutFn=fi.clearTimeout.bind(fi))}const BZe=1.33;function GZe(n){return typeof n=="string"?VZe(n):Math.ceil((n.byteLength||n.size)*BZe)}function VZe(n){let e=0,t=0;for(let i=0,s=n.length;i=57344?t+=3:(i++,t+=4);return t}function zZe(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function HZe(n){let e={},t=n.split("&");for(let i=0,s=t.length;i0);return e}function ZN(){const n=xC(+new Date);return n!==TC?(SC=0,TC=n):n+"."+xC(SC++)}for(;zc{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)};DZe(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,MZe(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]=ZN()),!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 kd extends un{constructor(e,t){super(),rp(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=QN(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;const i=this.xhr=new eO(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=kd.requestsCount++,kd.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=WZe,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete kd.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",CC);else if(typeof addEventListener=="function"){const n="onpagehide"in fi?"pagehide":"unload";addEventListener(n,CC,!1)}}function CC(){for(let n in oa.requests)oa.requests.hasOwnProperty(n)&&oa.requests[n].abort()}const vE=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0))(),Hc=fi.WebSocket||fi.MozWebSocket,wC=!0,QZe="arraybuffer",RC=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class XZe extends yE{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=RC?{}:QN(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=wC&&!RC?t?new Hc(e,t):new Hc(e):new Hc(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{wC&&this.ws.send(r)}catch{}s&&vE(()=>{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]=ZN()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!Hc}}class ZZe extends yE{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=LZe(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(t).getReader(),s=kZe();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&&vE(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}}const JZe={websocket:XZe,webtransport:ZZe,polling:jZe},eJe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,tJe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Xg(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=eJe.exec(n||""),r={},o=14;for(;o--;)r[tJe[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=nJe(r,r.path),r.queryKey=iJe(r,r.query),r}function nJe(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 iJe(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,s,r){s&&(t[s]=r)}),t}let tO=class Ko extends un{constructor(e,t={}){super(),this.binaryType=QZe,this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=Xg(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=Xg(t.host).host),rp(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=HZe(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=jN,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",h=>{if(!i)if(h.type==="pong"&&h.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Ko.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(d(),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,d(),t.close(),t=null)}const o=h=>{const f=new Error("probe error: "+h);f.transport=t.name,r(),this.emitReserved("upgradeError",f)};function a(){o("transport closed")}function l(){o("socket closed")}function u(h){t&&h.name!==t.name&&r()}const d=()=>{t.removeListener("open",s),t.removeListener("error",o),t.removeListener("close",a),this.off("close",l),this.off("upgrading",u)};t.once("open",s),t.once("error",o),t.once("close",a),this.once("close",l),this.once("upgrading",u),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,nO=Object.prototype.toString,aJe=typeof Blob=="function"||typeof Blob<"u"&&nO.call(Blob)==="[object BlobConstructor]",lJe=typeof File=="function"||typeof File<"u"&&nO.call(File)==="[object FileConstructor]";function SE(n){return rJe&&(n instanceof ArrayBuffer||oJe(n))||aJe&&n instanceof Blob||lJe&&n instanceof File}function Ld(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}Wa.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};Wa.prototype.reset=function(){this.attempts=0};Wa.prototype.setMin=function(n){this.ms=n};Wa.prototype.setMax=function(n){this.max=n};Wa.prototype.setJitter=function(n){this.jitter=n};class eb extends un{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,rp(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 Wa({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||fJe;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 tO(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){vE(()=>{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 iO(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 _l={};function Pd(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=sJe(n,e.path||"/socket.io"),i=t.source,s=t.id,r=t.path,o=_l[s]&&r in _l[s].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let l;return a?l=new eb(i,e):(_l[s]||(_l[s]=new eb(i,e)),l=_l[s]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(Pd,{Manager:eb,Socket:iO,io:Pd,connect:Pd});const sO="/";console.log(sO);const Ye=new Pd(sO,{reconnection:!0,reconnectionAttempts:10,reconnectionDelay:1e3});const gJe={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(){Ge(()=>{He.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)}}},bJe={class:"flex items-center space-x-2"},EJe=["value","type","placeholder"],yJe=["value","min","max"],vJe=c("i",{"data-feather":"clipboard"},null,-1),SJe=[vJe],TJe=c("i",{"data-feather":"upload"},null,-1),xJe=[TJe],CJe=["accept"];function wJe(n,e,t,i,s,r){return w(),A("div",bJe,[n.useSlider?(w(),A("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,yJe)):(w(),A("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,EJe)),c("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"},SJe),t.inputType==="file"?(w(),A("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"},xJe)):V("",!0),t.inputType==="file"?(w(),A("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,CJe)):V("",!0)])}const xE=bt(gJe,[["render",wJe]]),RJe={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"]}}},AJe={class:"w-full"},NJe={class:"break-words"},OJe={class:"break-words mt-2"},IJe={class:"mt-4"};function MJe(n,e,t,i,s,r){return w(),A("div",AJe,[c("div",NJe,[(w(!0),A($e,null,lt(t.namedTokens,(o,a)=>(w(),A("span",{key:a},[c("span",{class:"inline-block whitespace-pre-wrap",style:en({backgroundColor:s.colors[a%s.colors.length]})},he(o[0]),5)]))),128))]),c("div",OJe,[(w(!0),A($e,null,lt(t.namedTokens,(o,a)=>(w(),A("span",{key:a},[c("span",{class:"inline-block px-1 whitespace-pre-wrap",style:en({backgroundColor:s.colors[a%s.colors.length]})},he(o[1]),5)]))),128))]),c("div",IJe,[c("strong",null,"Total Tokens: "+he(t.namedTokens.length),1)])])}const DJe=bt(RJe,[["render",MJe]]);const kJe={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)}}},LJe={key:1,class:"flex flex-wrap"},PJe={key:2,class:"mb-2"};function UJe(n,e,t,i,s,r){return w(),A($e,null,[s.isActive?(w(),A("div",{key:0,class:"overlay",onClick:e[0]||(e[0]=(...o)=>r.toggleCard&&r.toggleCard(...o))})):V("",!0),G(c("div",{class:ze(["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]=ge((...o)=>r.toggleCard&&r.toggleCard(...o),["self"])),style:en({cursor:this.disableFocus?"":"pointer"})},[t.title?(w(),A("div",{key:0,onClick:e[1]||(e[1]=o=>s.shrink=!0),class:ze([{"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"])},he(t.title),3)):V("",!0),t.isHorizontal?(w(),A("div",LJe,[kn(n.$slots,"default")])):(w(),A("div",PJe,[kn(n.$slots,"default")]))],38),[[Mt,s.shrink===!1]]),t.is_subcard?G((w(),A("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"},he(t.title),513)),[[Mt,s.shrink===!0]]):G((w(),A("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)),[[Mt,s.shrink===!0]])],64)}const op=bt(kJe,[["render",UJe]]),rO="/assets/code_block-e2753d3f.svg",oO="/assets/python_block-4008a934.png",aO="/assets/javascript_block-5e59df30.svg",lO="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==",cO="/assets/cpp_block-109b2fbe.png",dO="/assets/html5_block-205d2852.png",uO="/assets/LaTeX_block-06b165c0.png",pO="/assets/bash_block-7ca80e4e.png",FJe="/assets/tokenize_icon-0553c60f.svg",BJe="/assets/deaf_on-7481cb29.svg",GJe="/assets/deaf_off-c2c46908.svg",VJe="/assets/rec_on-3b37b566.svg",zJe="/assets/rec_off-2c08e836.svg",_O="/assets/loading-c3bdfb0a.svg";const HJe="/";async function NC(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=` + 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),iZe=[nZe],sZe={href:"https://discord.com/channels/1092918764925882418",target:"_blank"},rZe={class:"text-2xl hover:text-primary duration-150",title:"Visit my discord channel"},oZe=["src"],aZe=c("i",{"data-feather":"sun"},null,-1),lZe=[aZe],cZe=c("i",{"data-feather":"moon"},null,-1),dZe=[cZe],uZe=["src"],pZe=["src"],_Ze=["src"],hZe={class:"language-selector relative",style:{position:"relative"}},fZe={key:0,ref:"languageMenu",class:"container language-menu absolute left-0 mt-1 bg-white dark:bg-bg-dark-tone rounded shadow-lg z-10 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",style:{position:"absolute",top:"100%",width:"200px","max-height":"300px","overflow-y":"auto"}},mZe={style:{"list-style-type":"none","padding-left":"0","margin-left":"0"}},gZe=["onClick"],bZe=["onClick"],EZe={class:"cursor-pointer hover:text-white py-0 px-0 block whitespace-no-wrap"},yZe={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"},vZe={class:"text-2xl animate-pulse mt-2 text-white"},SZe={id:"app"},TZe=c("body",null,null,-1),xZe={name:"TopBar",computed:{storeLogo(){return this.$store.state.config?Ti:this.$store.state.config.app_custom_logo!=""?"/user_infos/"+this.$store.state.config.app_custom_logo:Ti},languages:{get(){return console.log("searching languages",this.$store.state.languages),this.$store.state.languages}},language:{get(){return console.log("searching language",this.$store.state.language),this.$store.state.language}},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},is_fun_mode(){try{return this.$store.state.config?this.$store.state.config.fun_mode:!1}catch(n){return console.error("Oopsie! Looks like we hit a snag: ",n),!1}},isModelOK(){return this.$store.state.isModelOk},isGenerating(){return this.$store.state.isGenerating},isConnected(){return this.$store.state.isConnected}},components:{Toast:hc,MessageBox:kN,ProgressBar:nc,UniversalForm:bc,YesNoDialog:LN,Navigation:GN,PersonalityEditor:PN,PopupViewer:UN},watch:{"$store.state.config.fun_mode":function(n,e){console.log(`Fun mode changed from ${e} to ${n}! 🎉`)},"$store.state.isConnected":function(n,e){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()),Ge(()=>{He.replace()})}},data(){return{customLanguage:"",selectedLanguage:"",isLanguageMenuVisible:!1,static_info:VN,animated_info:EXe,normal_mode:HN,fun_mode:zN,is_first_connection:!0,discord:BN,FastAPI:FN,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,posts_headers:{accept:"application/json","Content-Type":"application/json"}}},async 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(),Ge(()=>{He.replace()}),window.addEventListener("resize",this.adjustMenuPosition)},beforeUnmount(){window.removeEventListener("resize",this.adjustMenuPosition)},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:{adjustMenuPosition(){const n=this.$refs.languageMenu;if(n){const e=n.getBoundingClientRect(),t=window.innerWidth;e.right>t?(n.style.left="auto",n.style.right="0"):(n.style.left="0",n.style.right="auto")}},addCustomLanguage(){this.customLanguage.trim()!==""&&(this.selectLanguage(this.customLanguage),this.customLanguage="")},async selectLanguage(n){await this.$store.dispatch("changeLanguage",n),this.toggleLanguageMenu(),this.language=n},async deleteLanguage(n){await this.$store.dispatch("deleteLanguage",n),this.toggleLanguageMenu(),this.language=n},toggleLanguageMenu(){console.log("Toggling language ",this.isLanguageMenuVisible),this.isLanguageMenuVisible=!this.isLanguageMenuVisible},restartProgram(n){n.preventDefault(),this.$store.state.api_post_req("restart_program",this.$store.state.client_id),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)},applyConfiguration(){this.isLoading=!0,console.log(this.$store.state.config),Se.post("/apply_settings",{client_id:this.$store.state.client_id,config:this.$store.state.config},{headers:this.posts_headers}).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),Ge(()=>{He.replace()})})},fun_mode_on(){console.log("Turning on fun mode"),this.$store.state.config.fun_mode=!0,this.applyConfiguration()},fun_mode_off(){console.log("Turning off fun mode"),this.$store.state.config.fun_mode=!1,this.applyConfiguration()},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"),Ge(()=>{Pp(()=>Promise.resolve({}),["assets/stackoverflow-dark-57af98f5.css"])});return}Ge(()=>{Pp(()=>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}Pp(()=>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")}}},CZe=Object.assign(xZe,{setup(n){return(e,t)=>(w(),A($e,null,[c("header",yXe,[c("nav",vXe,[Te(yt(ks),{to:{name:"discussions"}},{default:We(()=>[c("div",SXe,[c("img",{class:"w-12 hover:scale-95 duration-150",title:"LoLLMS WebUI",src:e.$store.state.config==null?yt(Ti):e.$store.state.config.app_custom_logo!=""?"/user_infos/"+e.$store.state.config.app_custom_logo:yt(Ti),alt:"Logo"},null,8,TXe),xXe])]),_:1}),c("div",CXe,[e.isModelOK?(w(),A("div",wXe,AXe)):V("",!0),e.isModelOK?V("",!0):(w(),A("div",NXe,IXe)),e.isGenerating?V("",!0):(w(),A("div",MXe,kXe)),e.isGenerating?(w(),A("div",LXe,UXe)):V("",!0),e.isConnected?(w(),A("div",FXe,GXe)):V("",!0),e.isConnected?V("",!0):(w(),A("div",VXe,HXe)),c("a",{href:"#",onClick:t[0]||(t[0]=(...i)=>e.restartProgram&&e.restartProgram(...i))},YXe),c("a",{href:"#",onClick:t[1]||(t[1]=(...i)=>e.refreshPage&&e.refreshPage(...i))},WXe),c("a",KXe,[c("div",jXe,[c("a",QXe,[c("img",{src:yt(FN),width:"75",height:"25"},null,8,XXe)])])]),ZXe,c("a",JXe,[c("div",eZe,[(w(),A("svg",tZe,iZe))])]),c("a",sZe,[c("div",rZe,[c("img",{src:yt(BN),width:"25",height:"25"},null,8,oZe)])]),c("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())},lZe),c("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())},dZe),c("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())},[c("img",{src:yt(VN)},null,8,uZe)]),e.is_fun_mode?(w(),A("div",{key:6,title:"fun mode is on press to turn off",class:"text-green-500 cursor-pointer",onClick:t[5]||(t[5]=i=>e.fun_mode_off())},[c("img",{class:"w-5 h-5",src:yt(zN)},null,8,pZe)])):(w(),A("div",{key:7,title:"fun mode is off press to turn on",class:"text-red-500 cursor-pointer",onClick:t[6]||(t[6]=i=>e.fun_mode_on())},[c("img",{class:"w-5 h-5",src:yt(HN)},null,8,_Ze)])),c("div",hZe,[c("button",{onClick:t[7]||(t[7]=(...i)=>e.toggleLanguageMenu&&e.toggleLanguageMenu(...i)),class:"bg-transparent text-black dark:text-white py-1 px-1 rounded font-bold uppercase transition-colors duration-300 hover:bg-blue-500"},he(e.$store.state.language.slice(0,2)),1),e.isLanguageMenuVisible?(w(),A("div",fZe,[c("ul",mZe,[(w(!0),A($e,null,lt(e.languages,i=>(w(),A("li",{key:i,class:"relative flex items-center",style:{"padding-left":"0","margin-left":"0"}},[c("button",{onClick:s=>e.deleteLanguage(i),class:"mr-2 text-red-500 hover:text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-opacity-50 rounded-full"},"✕",8,gZe),c("div",{onClick:s=>e.selectLanguage(i),class:ze({"cursor-pointer hover:bg-blue-500 hover:text-white py-2 px-4 block whitespace-no-wrap":!0,"bg-blue-500 text-white":i===e.$store.state.language,"flex-grow":!0})},he(i),11,bZe)]))),128)),c("li",EZe,[G(c("input",{type:"text","onUpdate:modelValue":t[8]||(t[8]=i=>e.customLanguage=i),onKeyup:t[9]||(t[9]=Hs(ge((...i)=>e.addCustomLanguage&&e.addCustomLanguage(...i),["prevent"]),["enter"])),placeholder:"Enter language...",class:"bg-transparent border border-gray-300 rounded py-0 px-0 mx-0 my-1 w-full"},null,544),[[we,e.customLanguage]])])])],512)):V("",!0)])])]),Te(GN),Te(hc,{ref:"toast"},null,512),Te(kN,{ref:"messageBox"},null,512),G(c("div",yZe,[Te(nc,{ref:"progress",progress:e.progress_value,class:"w-full h-4"},null,8,["progress"]),c("p",vZe,he(e.loading_infos)+" ...",1)],512),[[Mt,e.progress_visibility]]),Te(bc,{ref:"universalForm",class:"z-20"},null,512),Te(LN,{ref:"yesNoDialog",class:"z-20"},null,512),Te(PN,{ref:"personality_editor",config:e.currentPersonConfig,personality:e.selectedPersonality},null,8,["config","personality"]),c("div",SZe,[Te(UN,{ref:"news"},null,512)])]),TZe],64))}}),wZe={class:"flex overflow-hidden flex-grow w-full"},RZe={__name:"App",setup(n){return(e,t)=>(w(),A("div",{class:ze([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"])},[Te(CZe),c("div",wZe,[Te(yt(qA),null,{default:We(({Component:i})=>[(w(),xt(O2,null,[(w(),xt(Lu(i)))],1024))]),_:1})])],2))}},ds=Object.create(null);ds.open="0";ds.close="1";ds.ping="2";ds.pong="3";ds.message="4";ds.upgrade="5";ds.noop="6";const Dd=Object.create(null);Object.keys(ds).forEach(n=>{Dd[ds[n]]=n});const jg={type:"error",data:"parser error"},qN=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",YN=typeof ArrayBuffer=="function",$N=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,bE=({type:n,data:e},t,i)=>qN&&e instanceof Blob?t?i(e):EC(e,i):YN&&(e instanceof ArrayBuffer||$N(e))?t?i(e):EC(new Blob([e]),i):i(ds[n]+(e||"")),EC=(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 Lm;function AZe(n,e){if(qN&&n.data instanceof Blob)return n.data.arrayBuffer().then(yC).then(e);if(YN&&(n.data instanceof ArrayBuffer||$N(n.data)))return e(yC(n.data));bE(n,!1,t=>{Lm||(Lm=new TextEncoder),e(Lm.encode(t))})}const vC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",wl=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 u=new ArrayBuffer(e),d=new Uint8Array(u);for(i=0;i>4,d[s++]=(o&15)<<4|a>>2,d[s++]=(a&3)<<6|l&63;return u},OZe=typeof ArrayBuffer=="function",EE=(n,e)=>{if(typeof n!="string")return{type:"message",data:WN(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:IZe(n.substring(1),e)}:Dd[t]?n.length>1?{type:Dd[t],data:n.substring(1)}:{type:Dd[t]}:jg},IZe=(n,e)=>{if(OZe){const t=NZe(n);return WN(t,e)}else return{base64:!0,data:n}},WN=(n,e)=>{switch(e){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},KN=String.fromCharCode(30),MZe=(n,e)=>{const t=n.length,i=new Array(t);let s=0;n.forEach((r,o)=>{bE(r,!1,a=>{i[o]=a,++s===t&&e(i.join(KN))})})},DZe=(n,e)=>{const t=n.split(KN),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 Pm;function Gc(n){return n.reduce((e,t)=>e+t.length,0)}function Vc(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(jg);break}s=d*Math.pow(2,32)+u.getUint32(4),i=3}else{if(Gc(t)n){a.enqueue(jg);break}}}})}const jN=4;function un(n){if(n)return PZe(n)}function PZe(n){for(var e in un.prototype)n[e]=un.prototype[e];return n}un.prototype.on=un.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this};un.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this};un.prototype.off=un.prototype.removeListener=un.prototype.removeAllListeners=un.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 QN(n,...e){return e.reduce((t,i)=>(n.hasOwnProperty(i)&&(t[i]=n[i]),t),{})}const UZe=fi.setTimeout,FZe=fi.clearTimeout;function rp(n,e){e.useNativeTimers?(n.setTimeoutFn=UZe.bind(fi),n.clearTimeoutFn=FZe.bind(fi)):(n.setTimeoutFn=fi.setTimeout.bind(fi),n.clearTimeoutFn=fi.clearTimeout.bind(fi))}const BZe=1.33;function GZe(n){return typeof n=="string"?VZe(n):Math.ceil((n.byteLength||n.size)*BZe)}function VZe(n){let e=0,t=0;for(let i=0,s=n.length;i=57344?t+=3:(i++,t+=4);return t}function zZe(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function HZe(n){let e={},t=n.split("&");for(let i=0,s=t.length;i0);return e}function ZN(){const n=xC(+new Date);return n!==TC?(SC=0,TC=n):n+"."+xC(SC++)}for(;zc{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)};DZe(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,MZe(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]=ZN()),!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 kd extends un{constructor(e,t){super(),rp(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=QN(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;const i=this.xhr=new eO(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=kd.requestsCount++,kd.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=WZe,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete kd.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",CC);else if(typeof addEventListener=="function"){const n="onpagehide"in fi?"pagehide":"unload";addEventListener(n,CC,!1)}}function CC(){for(let n in oa.requests)oa.requests.hasOwnProperty(n)&&oa.requests[n].abort()}const vE=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0))(),Hc=fi.WebSocket||fi.MozWebSocket,wC=!0,QZe="arraybuffer",RC=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class XZe extends yE{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=RC?{}:QN(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=wC&&!RC?t?new Hc(e,t):new Hc(e):new Hc(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{wC&&this.ws.send(r)}catch{}s&&vE(()=>{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]=ZN()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!Hc}}class ZZe extends yE{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=LZe(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(t).getReader(),s=kZe();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&&vE(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}}const JZe={websocket:XZe,webtransport:ZZe,polling:jZe},eJe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,tJe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Xg(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=eJe.exec(n||""),r={},o=14;for(;o--;)r[tJe[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=nJe(r,r.path),r.queryKey=iJe(r,r.query),r}function nJe(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 iJe(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,s,r){s&&(t[s]=r)}),t}let tO=class Ko extends un{constructor(e,t={}){super(),this.binaryType=QZe,this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=Xg(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=Xg(t.host).host),rp(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=HZe(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=jN,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",h=>{if(!i)if(h.type==="pong"&&h.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Ko.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(d(),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,d(),t.close(),t=null)}const o=h=>{const f=new Error("probe error: "+h);f.transport=t.name,r(),this.emitReserved("upgradeError",f)};function a(){o("transport closed")}function l(){o("socket closed")}function u(h){t&&h.name!==t.name&&r()}const d=()=>{t.removeListener("open",s),t.removeListener("error",o),t.removeListener("close",a),this.off("close",l),this.off("upgrading",u)};t.once("open",s),t.once("error",o),t.once("close",a),this.once("close",l),this.once("upgrading",u),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,nO=Object.prototype.toString,aJe=typeof Blob=="function"||typeof Blob<"u"&&nO.call(Blob)==="[object BlobConstructor]",lJe=typeof File=="function"||typeof File<"u"&&nO.call(File)==="[object FileConstructor]";function SE(n){return rJe&&(n instanceof ArrayBuffer||oJe(n))||aJe&&n instanceof Blob||lJe&&n instanceof File}function Ld(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}Wa.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};Wa.prototype.reset=function(){this.attempts=0};Wa.prototype.setMin=function(n){this.ms=n};Wa.prototype.setMax=function(n){this.max=n};Wa.prototype.setJitter=function(n){this.jitter=n};class eb extends un{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,rp(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 Wa({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||fJe;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 tO(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){vE(()=>{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 iO(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 _l={};function Pd(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=sJe(n,e.path||"/socket.io"),i=t.source,s=t.id,r=t.path,o=_l[s]&&r in _l[s].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let l;return a?l=new eb(i,e):(_l[s]||(_l[s]=new eb(i,e)),l=_l[s]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(Pd,{Manager:eb,Socket:iO,io:Pd,connect:Pd});const sO="/";console.log(sO);const Ye=new Pd(sO,{reconnection:!0,reconnectionAttempts:10,reconnectionDelay:1e3});const gJe={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(){Ge(()=>{He.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)}}},bJe={class:"flex items-center space-x-2"},EJe=["value","type","placeholder"],yJe=["value","min","max"],vJe=c("i",{"data-feather":"clipboard"},null,-1),SJe=[vJe],TJe=c("i",{"data-feather":"upload"},null,-1),xJe=[TJe],CJe=["accept"];function wJe(n,e,t,i,s,r){return w(),A("div",bJe,[n.useSlider?(w(),A("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,yJe)):(w(),A("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,EJe)),c("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"},SJe),t.inputType==="file"?(w(),A("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"},xJe)):V("",!0),t.inputType==="file"?(w(),A("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,CJe)):V("",!0)])}const xE=bt(gJe,[["render",wJe]]),RJe={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"]}}},AJe={class:"w-full"},NJe={class:"break-words"},OJe={class:"break-words mt-2"},IJe={class:"mt-4"};function MJe(n,e,t,i,s,r){return w(),A("div",AJe,[c("div",NJe,[(w(!0),A($e,null,lt(t.namedTokens,(o,a)=>(w(),A("span",{key:a},[c("span",{class:"inline-block whitespace-pre-wrap",style:en({backgroundColor:s.colors[a%s.colors.length]})},he(o[0]),5)]))),128))]),c("div",OJe,[(w(!0),A($e,null,lt(t.namedTokens,(o,a)=>(w(),A("span",{key:a},[c("span",{class:"inline-block px-1 whitespace-pre-wrap",style:en({backgroundColor:s.colors[a%s.colors.length]})},he(o[1]),5)]))),128))]),c("div",IJe,[c("strong",null,"Total Tokens: "+he(t.namedTokens.length),1)])])}const DJe=bt(RJe,[["render",MJe]]);const kJe={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)}}},LJe={key:1,class:"flex flex-wrap"},PJe={key:2,class:"mb-2"};function UJe(n,e,t,i,s,r){return w(),A($e,null,[s.isActive?(w(),A("div",{key:0,class:"overlay",onClick:e[0]||(e[0]=(...o)=>r.toggleCard&&r.toggleCard(...o))})):V("",!0),G(c("div",{class:ze(["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]=ge((...o)=>r.toggleCard&&r.toggleCard(...o),["self"])),style:en({cursor:this.disableFocus?"":"pointer"})},[t.title?(w(),A("div",{key:0,onClick:e[1]||(e[1]=o=>s.shrink=!0),class:ze([{"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"])},he(t.title),3)):V("",!0),t.isHorizontal?(w(),A("div",LJe,[kn(n.$slots,"default")])):(w(),A("div",PJe,[kn(n.$slots,"default")]))],38),[[Mt,s.shrink===!1]]),t.is_subcard?G((w(),A("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"},he(t.title),513)),[[Mt,s.shrink===!0]]):G((w(),A("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)),[[Mt,s.shrink===!0]])],64)}const op=bt(kJe,[["render",UJe]]),rO="/assets/code_block-e2753d3f.svg",oO="/assets/python_block-4008a934.png",aO="/assets/javascript_block-5e59df30.svg",lO="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==",cO="/assets/cpp_block-109b2fbe.png",dO="/assets/html5_block-205d2852.png",uO="/assets/LaTeX_block-06b165c0.png",pO="/assets/bash_block-7ca80e4e.png",FJe="/assets/tokenize_icon-0553c60f.svg",BJe="/assets/deaf_on-7481cb29.svg",GJe="/assets/deaf_off-c2c46908.svg",VJe="/assets/rec_on-3b37b566.svg",zJe="/assets/rec_off-2c08e836.svg",_O="/assets/loading-c3bdfb0a.svg";async function NC(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=U,j=Q),J===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 u=r.querySelector("#replacementInput").value.trim();document.body.removeChild(r),i(u)}else{const u=r.querySelector("#options_selector").value.trim();document.body.removeChild(r),i(u)}})})}function qJe(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 u=l.toLowerCase().substring(2,l.length-2);if(u!=="generation_placeholder")if(u.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 y(C){return C.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const v=y(b),S=new RegExp(v,"g");u=u.replace(S,g)});let h=u.split(":"),f=h[0],_=h[1]||"",m=[];h.length>2&&(m=h.slice(1));let E=await NC(f,_,m);E!==null&&(t[l]=E)}else{let d=await NC(u);d!==null&&(t[l]=d)}}let a=Promise.resolve();s.forEach(l=>{a=a.then(()=>o(l)).then(u=>{console.log(u)})}),a.then(()=>{Object.entries(t).forEach(([l,u])=>{console.log(`Key: ${l}, Value: ${u}`);function d(_){return _.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const h=d(l),f=new RegExp(h,"g");n=n.replace(f,u)}),e(n)})}const YJe={name:"PlayGroundView",data(){return{posts_headers:{accept:"application/json","Content-Type":"application/json"},pending:!1,is_recording:!1,is_deaf_transcribing:!1,cpp_block:cO,html5_block:dO,LaTeX_block:uO,javascript_block:aO,json_block:lO,code_block:rO,python_block:oO,bash_block:pO,tokenize_icon:FJe,deaf_off:GJe,deaf_on:BJe,rec_off:zJe,rec_on:VJe,loading_icon:_O,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:hc,MarkdownRenderer:sp,ClipBoardTextInput:xE,TokensHilighter:DJe,Card:op},mounted(){Se.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)}),Ye.on("text_chunk",n=>{this.appendToOutput(n.chunk)}),Ye.on("text_generated",n=>{this.generating=!1}),Ye.on("generation_error",n=>{console.log("generation_error:",n),this.$refs.toast.showToast(`Error: ${n}`,4,!1),this.generating=!1}),Ye.on("connect",()=>{console.log("Connected to LoLLMs server"),this.$store.state.isConnected=!0,this.generating=!1}),Ye.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}),Ye.on("generation_canceled",n=>{this.generating=!1,console.log("Generation canceled OK")}),this.$nextTick(()=>{He.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),Se.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 u=r.querySelector("#replacementInput").value.trim();document.body.removeChild(r),i(u)}else{const u=r.querySelector("#options_selector").value.trim();document.body.removeChild(r),i(u)}})})}function HJe(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 u=l.toLowerCase().substring(2,l.length-2);if(u!=="generation_placeholder")if(u.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 y(C){return C.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const v=y(b),S=new RegExp(v,"g");u=u.replace(S,g)});let h=u.split(":"),f=h[0],_=h[1]||"",m=[];h.length>2&&(m=h.slice(1));let E=await NC(f,_,m);E!==null&&(t[l]=E)}else{let d=await NC(u);d!==null&&(t[l]=d)}}let a=Promise.resolve();s.forEach(l=>{a=a.then(()=>o(l)).then(u=>{console.log(u)})}),a.then(()=>{Object.entries(t).forEach(([l,u])=>{console.log(`Key: ${l}, Value: ${u}`);function d(_){return _.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const h=d(l),f=new RegExp(h,"g");n=n.replace(f,u)}),e(n)})}const qJe={name:"PlayGroundView",data(){return{posts_headers:{accept:"application/json","Content-Type":"application/json"},pending:!1,is_recording:!1,is_deaf_transcribing:!1,cpp_block:cO,html5_block:dO,LaTeX_block:uO,javascript_block:aO,json_block:lO,code_block:rO,python_block:oO,bash_block:pO,tokenize_icon:FJe,deaf_off:GJe,deaf_on:BJe,rec_off:zJe,rec_on:VJe,loading_icon:_O,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:hc,MarkdownRenderer:sp,ClipBoardTextInput:xE,TokensHilighter:DJe,Card:op},mounted(){Se.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)}),Ye.on("text_chunk",n=>{this.appendToOutput(n.chunk)}),Ye.on("text_generated",n=>{this.generating=!1}),Ye.on("generation_error",n=>{console.log("generation_error:",n),this.$refs.toast.showToast(`Error: ${n}`,4,!1),this.generating=!1}),Ye.on("connect",()=>{console.log("Connected to LoLLMs server"),this.$store.state.isConnected=!0,this.generating=!1}),Ye.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}),Ye.on("generation_canceled",n=>{this.generating=!1,console.log("Generation canceled OK")}),this.$nextTick(()=>{He.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),Se.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,Se.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)),Se.post("./text2Wave",{text:t}).then(i=>{console.log(i.data.url);let s=i.data.url;this.audio_url=HJe+s,this.isSynthesizingVoice=!1,Ge(()=>{He.replace()})}).catch(i=>{this.$refs.toast.showToast(`Error: ${i}`,4,!1),this.isSynthesizingVoice=!1,Ge(()=>{He.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 u=r.lastIndexOf(l);u>a&&(a=u)}),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),Ye.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 Se.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}`),Ye.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(){Ye.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=qJe(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]={client_id:this.$store.state.client_id,name:n,content:this.text},Se.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(){Se.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?Se.post("/stop_recording",{client_id:this.$store.state.client_id}).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)}):Se.post("/start_recording",{client_id:this.$store.state.client_id}).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?Se.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)}):Se.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.")}}},$Je={class:"container w-full 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"},WJe={class:"container flex flex-row m-2 w-full"},KJe={class:"flex-grow max-w-[900px] m-2"},jJe={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=c("i",{"data-feather":"pen-tool"},null,-1),XJe=[QJe],ZJe=c("i",{"data-feather":"archive"},null,-1),JJe=[ZJe],eet=["src"],tet=c("span",{class:"w-80"},null,-1),net=c("i",{"data-feather":"x"},null,-1),iet=[net],set=c("i",{"data-feather":"mic"},null,-1),ret=[set],oet=c("i",{"data-feather":"volume-2"},null,-1),aet=[oet],cet=c("i",{"data-feather":"speaker"},null,-1),det=[cet],uet=["src"],pet=["src"],_et=["src"],het=["src"],fet=c("i",{"data-feather":"voicemail"},null,-1),met=[fet],get={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"},bet=c("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),Eet=c("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),yet=[bet,Eet],vet=c("i",{"data-feather":"upload"},null,-1),Tet=[vet],xet=c("i",{"data-feather":"download"},null,-1),Cet=[xet],wet={class:"flex gap-3 flex-1 items-center flex-grow justify-end"},Ret=c("input",{type:"file",id:"import-input",class:"hidden"},null,-1),Aet={key:0},Net={class:"flex flex-row justify-end mx-2"},Oet=["src"],Iet=["src"],Met=["src"],Det=["src"],ket=["src"],Let=["src"],Pet=["src"],Uet=["src"],Fet=c("i",{"data-feather":"copy"},null,-1),Bet=[Fet],Get=["src"],Vet={key:2},zet=["value"],Het={key:0,title:"Selecting model",class:"flex flex-row flex-grow justify-end"},qet=c("div",{role:"status"},[c("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"},[c("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"}),c("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"})]),c("span",{class:"sr-only"},"Selecting model...")],-1),Yet=[qet],$et=["value"],Wet=c("br",null,null,-1),Ket=c("i",{"data-feather":"check"},null,-1),jet=[Ket],Qet=c("i",{"data-feather":"plus"},null,-1),Xet=[Qet],Zet=c("i",{"data-feather":"x"},null,-1),Jet=[Zet],ett=c("i",{"data-feather":"refresh-ccw"},null,-1),ttt=[ett],ntt={class:"slider-container ml-2 mr-2"},itt=c("h3",{class:"text-gray-600"},"Temperature",-1),stt={class:"slider-value text-gray-500"},rtt={class:"slider-container ml-2 mr-2"},ott=c("h3",{class:"text-gray-600"},"Top K",-1),att={class:"slider-value text-gray-500"},ltt={class:"slider-container ml-2 mr-2"},ctt=c("h3",{class:"text-gray-600"},"Top P",-1),dtt={class:"slider-value text-gray-500"},utt={class:"slider-container ml-2 mr-2"},ptt=c("h3",{class:"text-gray-600"},"Repeat Penalty",-1),_tt={class:"slider-value text-gray-500"},htt={class:"slider-container ml-2 mr-2"},ftt=c("h3",{class:"text-gray-600"},"Repeat Last N",-1),mtt={class:"slider-value text-gray-500"},gtt={class:"slider-container ml-2 mr-2"},btt=c("h3",{class:"text-gray-600"},"Number of tokens to crop the text to",-1),Ett={class:"slider-value text-gray-500"},ytt={class:"slider-container ml-2 mr-2"},vtt=c("h3",{class:"text-gray-600"},"Number of tokens to generate",-1),Stt={class:"slider-value text-gray-500"},Ttt={class:"slider-container ml-2 mr-2"},xtt=c("h3",{class:"text-gray-600"},"Seed",-1),Ctt={class:"slider-value text-gray-500"};function wtt(n,e,t,i,s,r){const o=mt("tokens-hilighter"),a=mt("MarkdownRenderer"),l=mt("Card"),u=mt("Toast");return w(),A($e,null,[c("div",$Je,[c("div",WJe,[c("div",KJe,[c("div",jJe,[G(c("button",{id:"generate-button",title:"Generate from current cursor position",onClick:e[0]||(e[0]=(...d)=>r.generate&&r.generate(...d)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},XJe,512),[[Mt,!s.generating]]),G(c("button",{id:"generate-next-button",title:"Generate from next place holder",onClick:e[1]||(e[1]=(...d)=>r.generate_in_placeholder&&r.generate_in_placeholder(...d)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},JJe,512),[[Mt,!s.generating]]),G(c("button",{id:"tokenize",title:"Tokenize text",onClick:e[2]||(e[2]=(...d)=>r.tokenize_text&&r.tokenize_text(...d)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},[c("img",{width:"25",height:"25",src:s.tokenize_icon},null,8,eet)],512),[[Mt,!s.generating]]),tet,G(c("button",{id:"stop-button",onClick:e[3]||(e[3]=(...d)=>r.stopGeneration&&r.stopGeneration(...d)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},iet,512),[[Mt,s.generating]]),c("button",{type:"button",title:"Dictate (using your browser for transcription)",onClick:e[4]||(e[4]=(...d)=>r.startSpeechRecognition&&r.startSpeechRecognition(...d)),class:ze([{"text-red-500":s.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer"])},ret,2),c("button",{title:"convert text to audio (not saved and uses your browser tts service)",onClick:e[5]||(e[5]=ge(d=>r.speak(),["stop"])),class:ze([{"text-red-500":r.isTalking},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer"])},aet,2),c("input",{type:"file",ref:"fileInput",onChange:e[6]||(e[6]=(...d)=>r.handleFileUpload&&r.handleFileUpload(...d)),style:{display:"none"},accept:".wav"},null,544),c("button",{title:"Upload a voice",onClick:e[7]||(e[7]=(...d)=>r.triggerFileUpload&&r.triggerFileUpload(...d))},det),c("button",{type:"button",title:"Start audio to audio",onClick:e[8]||(e[8]=(...d)=>r.startRecordingAndTranscribing&&r.startRecordingAndTranscribing(...d)),class:ze([{"text-green-500":s.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer text-red-500"])},[s.pending?V("",!0):(w(),A("img",{key:0,src:s.is_deaf_transcribing?s.deaf_on:s.deaf_off,height:"25"},null,8,uet)),s.pending?(w(),A("img",{key:1,src:s.loading_icon,height:"25"},null,8,pet)):V("",!0)],2),c("button",{type:"button",title:"Start recording audio",onClick:e[9]||(e[9]=(...d)=>r.startRecording&&r.startRecording(...d)),class:ze([{"text-green-500":s.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer text-red-500"])},[s.pending?V("",!0):(w(),A("img",{key:0,src:s.is_recording?s.rec_on:s.rec_off,height:"25"},null,8,_et)),s.pending?(w(),A("img",{key:1,src:s.loading_icon,height:"25"},null,8,het)):V("",!0)],2),s.isSynthesizingVoice?(w(),A("svg",get,yet)):(w(),A("button",{key:0,title:"generate audio from the text",onClick:e[10]||(e[10]=ge(d=>r.read(),["stop"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},met)),G(c("button",{id:"export-button",onClick:e[11]||(e[11]=(...d)=>r.exportText&&r.exportText(...d)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},Tet,512),[[Mt,!s.generating]]),G(c("button",{id:"import-button",onClick:e[12]||(e[12]=(...d)=>r.importText&&r.importText(...d)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},Cet,512),[[Mt,!s.generating]]),c("div",wet,[c("button",{class:ze(["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]=d=>s.tab_id="source")}," Source ",2),c("button",{class:ze(["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]=d=>s.tab_id="render")}," Render ",2)]),Ret]),c("div",{class:ze(["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(),A("div",Aet,[c("div",Net,[c("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]=ge(d=>r.addBlock(""),["stop"]))},[c("img",{src:s.code_block,width:"25",height:"25"},null,8,Oet)]),c("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]=ge(d=>r.addBlock("python"),["stop"]))},[c("img",{src:s.python_block,width:"25",height:"25"},null,8,Iet)]),c("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]=ge(d=>r.addBlock("javascript"),["stop"]))},[c("img",{src:s.javascript_block,width:"25",height:"25"},null,8,Met)]),c("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]=ge(d=>r.addBlock("json"),["stop"]))},[c("img",{src:s.json_block,width:"25",height:"25"},null,8,Det)]),c("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]=ge(d=>r.addBlock("c++"),["stop"]))},[c("img",{src:s.cpp_block,width:"25",height:"25"},null,8,ket)]),c("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]=ge(d=>r.addBlock("html"),["stop"]))},[c("img",{src:s.html5_block,width:"25",height:"25"},null,8,Let)]),c("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]=ge(d=>r.addBlock("latex"),["stop"]))},[c("img",{src:s.LaTeX_block,width:"25",height:"25"},null,8,Pet)]),c("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]=ge(d=>r.addBlock("bash"),["stop"]))},[c("img",{src:s.bash_block,width:"25",height:"25"},null,8,Uet)]),c("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]=ge(d=>n.copyContentToClipboard(),["stop"]))},Bet)]),G(c("textarea",{ref:"mdTextarea",onKeydown:e[24]||(e[24]=Hs(ge((...d)=>r.insertTab&&r.insertTab(...d),["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]=d=>s.text=d),onClick:e[26]||(e[26]=ge((...d)=>r.mdTextarea_clicked&&r.mdTextarea_clicked(...d),["prevent"])),onChange:e[27]||(e[27]=ge((...d)=>r.mdTextarea_changed&&r.mdTextarea_changed(...d),["prevent"]))},`\r - `,36),[[we,s.text]]),c("span",null,"Cursor position "+he(s.cursorPosition),1)])):V("",!0),s.audio_url!=null?(w(),A("audio",{controls:"",key:s.audio_url},[c("source",{src:s.audio_url,type:"audio/wav",ref:"audio_player"},null,8,Get),et(" Your browser does not support the audio element. ")])):V("",!0),Te(o,{namedTokens:s.namedTokens},null,8,["namedTokens"]),s.tab_id==="render"?(w(),A("div",Vet,[Te(a,{ref:"mdRender",client_id:this.$store.state.client_id,message_id:0,discussion_id:0,"markdown-text":s.text,class:"mt-4 p-2 rounded shadow-lg dark:bg-bg-dark"},null,8,["client_id","markdown-text"])])):V("",!0)],2)]),Te(l,{title:"settings",class:"slider-container ml-0 mr-0",isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:We(()=>[Te(l,{title:"Model",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:We(()=>[G(c("select",{"onUpdate:modelValue":e[28]||(e[28]=d=>this.$store.state.selectedModel=d),onChange:e[29]||(e[29]=(...d)=>r.setModel&&r.setModel(...d)),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},[(w(!0),A($e,null,lt(r.models,d=>(w(),A("option",{key:d,value:d},he(d),9,zet))),128))],544),[[Wt,this.$store.state.selectedModel]]),s.selecting_model?(w(),A("div",Het,Yet)):V("",!0)]),_:1}),Te(l,{title:"Presets",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:We(()=>[G(c("select",{"onUpdate:modelValue":e[30]||(e[30]=d=>s.selectedPreset=d),class:"bg-white dark:bg-black mb-2 border-2 rounded-md shadow-sm w-full"},[(w(!0),A($e,null,lt(s.presets,d=>(w(),A("option",{key:d,value:d},he(d.name),9,$et))),128))],512),[[Wt,s.selectedPreset]]),Wet,c("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[31]||(e[31]=(...d)=>r.setPreset&&r.setPreset(...d)),title:"Use preset"},jet),c("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[32]||(e[32]=(...d)=>r.addPreset&&r.addPreset(...d)),title:"Add this text as a preset"},Xet),c("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[33]||(e[33]=(...d)=>r.removePreset&&r.removePreset(...d)),title:"Remove preset"},Jet),c("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[34]||(e[34]=(...d)=>r.reloadPresets&&r.reloadPresets(...d)),title:"Reload presets list"},ttt)]),_:1}),Te(l,{title:"Generation params",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:We(()=>[c("div",ntt,[itt,G(c("input",{type:"range","onUpdate:modelValue":e[35]||(e[35]=d=>s.temperature=d),min:"0",max:"5",step:"0.1",class:"w-full"},null,512),[[we,s.temperature]]),c("span",stt,"Current value: "+he(s.temperature),1)]),c("div",rtt,[ott,G(c("input",{type:"range","onUpdate:modelValue":e[36]||(e[36]=d=>s.top_k=d),min:"1",max:"100",step:"1",class:"w-full"},null,512),[[we,s.top_k]]),c("span",att,"Current value: "+he(s.top_k),1)]),c("div",ltt,[ctt,G(c("input",{type:"range","onUpdate:modelValue":e[37]||(e[37]=d=>s.top_p=d),min:"0",max:"1",step:"0.1",class:"w-full"},null,512),[[we,s.top_p]]),c("span",dtt,"Current value: "+he(s.top_p),1)]),c("div",utt,[ptt,G(c("input",{type:"range","onUpdate:modelValue":e[38]||(e[38]=d=>s.repeat_penalty=d),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),[[we,s.repeat_penalty]]),c("span",_tt,"Current value: "+he(s.repeat_penalty),1)]),c("div",htt,[ftt,G(c("input",{type:"range","onUpdate:modelValue":e[39]||(e[39]=d=>s.repeat_last_n=d),min:"0",max:"100",step:"1",class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[we,s.repeat_last_n]]),c("span",mtt,"Current value: "+he(s.repeat_last_n),1)]),c("div",gtt,[btt,G(c("input",{type:"number","onUpdate:modelValue":e[40]||(e[40]=d=>s.n_crop=d),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[we,s.n_crop]]),c("span",Ett,"Current value: "+he(s.n_crop),1)]),c("div",ytt,[vtt,G(c("input",{type:"number","onUpdate:modelValue":e[41]||(e[41]=d=>s.n_predicts=d),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[we,s.n_predicts]]),c("span",Stt,"Current value: "+he(s.n_predicts),1)]),c("div",Ttt,[xtt,G(c("input",{type:"number","onUpdate:modelValue":e[42]||(e[42]=d=>s.seed=d),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[we,s.seed]]),c("span",Ctt,"Current value: "+he(s.seed),1)])]),_:1})]),_:1})])]),Te(u,{ref:"toast"},null,512)],64)}const Rtt=bt(YJe,[["render",wtt]]);const Att={data(){return{activeExtension:null}},computed:{activeExtensions(){return console.log(this.$store.state.extensionsZoo),console.log(nM(this.$store.state.extensionsZoo)),this.$store.state.extensionsZoo}},methods:{showExtensionPage(n){this.activeExtension=n}}},Ntt={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"},Ott={key:0},Itt=["onClick"],Mtt={key:0},Dtt=["src"],ktt={key:1},Ltt=c("p",null,"No extension is active. Please install and activate an extension.",-1),Ptt=[Ltt];function Utt(n,e,t,i,s,r){return w(),A("div",Ntt,[r.activeExtensions.length>0?(w(),A("div",Ott,[(w(!0),A($e,null,lt(r.activeExtensions,o=>(w(),A("div",{key:o.name,onClick:a=>r.showExtensionPage(o)},[c("div",{class:ze({"active-tab":o===s.activeExtension})},he(o.name),3)],8,Itt))),128)),s.activeExtension?(w(),A("div",Mtt,[c("iframe",{src:s.activeExtension.page,width:"100%",height:"500px",frameborder:"0"},null,8,Dtt)])):V("",!0)])):(w(),A("div",ktt,Ptt))])}const Ftt=bt(Att,[["render",Utt]]),Btt={},Gtt={style:{width:"100vw",height:"100vh"}},Vtt=c("iframe",{src:"/help/index.html",class:"m-0 p-0 w-full h-full"},null,-1),ztt=[Vtt];function Htt(n,e,t,i,s,r){return w(),A("div",Gtt,ztt)}const qtt=bt(Btt,[["render",Htt]]);function os(n,e=!0,t=1){const i=e?1e3:1024;if(Math.abs(n)=i&&r{He.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(),Ge(()=>{He.replace()})},beforeDestroy(){window.removeEventListener("resize",this.positionMenu)},watch:{isMenuOpen:"positionMenu"}},$tt={class:"menu-container"},Wtt=["title"],Ktt=["src"],jtt=["data-feather"],Qtt={key:2,class:"w-5 h-5"},Xtt={key:3,"data-feather":"menu"},Ztt={class:"flex-grow menu-ul"},Jtt=["onClick"],ent={key:0,"data-feather":"check"},tnt=["src","alt"],nnt=["data-feather"],int={key:3,class:"menu-icon"};function snt(n,e,t,i,s,r){return w(),A("div",$tt,[c("button",{onClick:e[0]||(e[0]=ge((...o)=>r.toggleMenu&&r.toggleMenu(...o),["prevent"])),title:t.title,class:ze([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(),A("img",{key:0,src:t.icon,class:"w-5 h-5 p-0 m-0 shadow-lg bold"},null,8,Ktt)):t.icon&&t.icon.includes("feather")?(w(),A("i",{key:1,"data-feather":t.icon.split(":")[1],class:"w-5 h-5"},null,8,jtt)):t.icon&&t.icon.includes("#")?(w(),A("p",Qtt,he(t.icon.split("#")[1]),1)):(w(),A("i",Xtt))],10,Wtt),Te(Vi,{name:"slide"},{default:We(()=>[s.isMenuOpen?(w(),A("div",{key:0,class:"menu-list flex-grow",style:en(s.menuPosition),ref:"menu"},[c("ul",Ztt,[(w(!0),A($e,null,lt(t.commands,(o,a)=>(w(),A("li",{key:a,onClick:ge(l=>r.executeCommand(o),["prevent"]),class:"menu-command menu-li flex-grow hover:bg-blue-400"},[t.selected_entry==o.name?(w(),A("i",ent)):o.icon&&!o.icon.includes("feather")&&!o.is_file?(w(),A("img",{key:1,src:o.icon,alt:o.name,class:"menu-icon"},null,8,tnt)):V("",!0),o.icon&&o.icon.includes("feather")&&!o.is_file?(w(),A("i",{key:2,"data-feather":o.icon.split(":")[1],class:"mr-2"},null,8,nnt)):(w(),A("span",int)),c("span",null,he(o.name),1)],8,Jtt))),128))])],4)):V("",!0)]),_:1})])}const CE=bt(Ytt,[["render",snt]]),rnt={components:{InteractiveMenu:CE},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(){Ge(()=>{He.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 os(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,Ge(()=>{He.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 os(this.speed)},total_size_computed(){return os(this.total_size)},downloaded_size_computed(){return os(this.downloaded_size)}},watch:{linkNotValid(){Ge(()=>{He.replace()})}}},ont=["title"],ant={key:0,class:"flex flex-row"},lnt={class:"max-w-[300px] overflow-x-auto"},cnt={class:"flex gap-3 items-center grow"},dnt=["href"],unt=["src"],pnt={class:"flex-1 overflow-hidden"},_nt={class:"font-bold font-large text-lg truncate"},hnt={key:1,class:"flex items-center flex-row gap-2 my-1"},fnt={class:"flex grow items-center"},mnt=c("i",{"data-feather":"box",class:"w-5"},null,-1),gnt=c("span",{class:"sr-only"},"Custom model / local model",-1),bnt=[mnt,gnt],Ent=c("span",{class:"sr-only"},"Remove",-1),ynt={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"},vnt={class:"relative flex flex-col items-center justify-center flex-grow h-full"},Snt=c("div",{role:"status",class:"justify-center"},[c("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"},[c("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"}),c("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"})]),c("span",{class:"sr-only"},"Loading...")],-1),Tnt={class:"relative flex flex-row flex-grow items-center w-full h-full bottom-0"},xnt={class:"w-full bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel rounded-lg p-2"},Cnt={class:"flex justify-between mb-1"},wnt=c("span",{class:"text-base font-medium text-blue-700 dark:text-white"},"Downloading",-1),Rnt={class:"text-sm font-medium text-blue-700 dark:text-white"},Ant={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},Nnt={class:"flex justify-between mb-1"},Ont={class:"text-base font-medium text-blue-700 dark:text-white"},Int={class:"text-sm font-medium text-blue-700 dark:text-white"},Mnt={class:"flex flex-grow"},Dnt={class:"flex flex-row flex-grow gap-3"},knt={class:"p-2 text-center grow"},Lnt={key:3},Pnt={class:"flex flex-row items-center gap-3"},Unt=["src"],Fnt={class:"font-bold font-large text-lg truncate"},Bnt=c("div",{class:"grow"},null,-1),Gnt={class:"flex items-center flex-row-reverse gap-2 my-1"},Vnt={class:"flex flex-row items-center"},znt={key:0,class:"text-base text-red-600 flex items-center mt-1"},Hnt=c("i",{"data-feather":"alert-triangle",class:"flex-shrink-0 mx-1"},null,-1),qnt=["title"],Ynt={class:""},$nt={class:"flex flex-row items-center"},Wnt=c("i",{"data-feather":"download",class:"w-5 m-1 flex-shrink-0"},null,-1),Knt=c("b",null,"Card: ",-1),jnt=["href","title"],Qnt=c("div",{class:"grow"},null,-1),Xnt=c("i",{"data-feather":"clipboard",class:"w-5"},null,-1),Znt=[Xnt],Jnt={class:"flex items-center"},eit=c("i",{"data-feather":"file",class:"w-5 m-1"},null,-1),tit=c("b",null,"File size: ",-1),nit={class:"flex items-center"},iit=c("i",{"data-feather":"key",class:"w-5 m-1"},null,-1),sit=c("b",null,"License: ",-1),rit={key:0,class:"flex items-center"},oit=c("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),ait=c("b",null,"quantizer: ",-1),lit=["href"],cit={class:"flex items-center"},dit=c("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),uit=c("b",null,"Model creator: ",-1),pit=["href"],_it={class:"flex items-center"},hit=c("i",{"data-feather":"clock",class:"w-5 m-1"},null,-1),fit=c("b",null,"Release date: ",-1),mit={class:"flex items-center"},git=c("i",{"data-feather":"grid",class:"w-5 m-1"},null,-1),bit=c("b",null,"Category: ",-1),Eit=["href"];function yit(n,e,t,i,s,r){const o=mt("InteractiveMenu");return w(),A("div",{class:ze(["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]=ge(a=>r.toggleSelected(a),["prevent"]))},[t.model.isCustomModel?(w(),A("div",ant,[c("div",lnt,[c("div",cnt,[c("a",{href:t.model.model_creator_link,target:"_blank"},[c("img",{src:r.getImgUrl(),onError:e[0]||(e[0]=a=>r.defaultImg(a)),class:"w-10 h-10 rounded-lg object-fill"},null,40,unt)],8,dnt),c("div",pnt,[c("h3",_nt,he(t.model.name),1)])])])])):V("",!0),t.model.isCustomModel?(w(),A("div",hnt,[c("div",fnt,[c("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]=ge(()=>{},["stop"]))},bnt),et(" Custom model ")]),c("div",null,[t.model.isInstalled?(w(),A("button",{key:0,title:"Delete file from disk",type:"button",onClick:e[2]||(e[2]=ge((...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"},[et(" Uninstall "),Ent])):V("",!0)])])):V("",!0),s.installing?(w(),A("div",ynt,[c("div",vnt,[Snt,c("div",Tnt,[c("div",xnt,[c("div",Cnt,[wnt,c("span",Rnt,he(Math.floor(s.progress))+"%",1)]),c("div",Ant,[c("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en({width:s.progress+"%"})},null,4)]),c("div",Nnt,[c("span",Ont,"Download speed: "+he(r.speed_computed)+"/s",1),c("span",Int,he(r.downloaded_size_computed)+"/"+he(r.total_size_computed),1)])])]),c("div",Mnt,[c("div",Dnt,[c("div",knt,[c("button",{onClick:e[3]||(e[3]=ge((...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 ")])])])])])):V("",!0),t.model.isCustomModel?V("",!0):(w(),A("div",Lnt,[c("div",Pnt,[c("img",{ref:"imgElement",src:r.getImgUrl(),onError:e[4]||(e[4]=a=>r.defaultImg(a)),class:ze(["w-10 h-10 rounded-lg object-fill",s.linkNotValid?"grayscale":""])},null,42,Unt),c("h3",Fnt,he(t.model.name),1),Bnt,Te(o,{commands:r.commandsList,force_position:2,title:"Menu"},null,8,["commands"])]),c("div",Gnt,[c("div",Vnt,[s.linkNotValid?(w(),A("div",znt,[Hnt,et(" Link is not valid ")])):V("",!0)])]),c("div",{class:"",title:t.model.isInstalled?t.model.name:"Not installed"},[c("div",Ynt,[c("div",$nt,[Wnt,Knt,c("a",{href:"https://huggingface.co/"+t.model.quantizer+"/"+t.model.name,target:"_blank",onClick:e[5]||(e[5]=ge(()=>{},["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,jnt),Qnt,c("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]=ge(a=>r.toggleCopyLink(),["stop"]))},Znt)]),c("div",Jnt,[c("div",{class:ze(["flex flex-shrink-0 items-center",s.linkNotValid?"text-red-600":""])},[eit,tit,et(" "+he(r.fileSize),1)],2)]),c("div",nit,[iit,sit,et(" "+he(t.model.license),1)]),t.model.quantizer!="None"&&t.model.type!="transformers"?(w(),A("div",rit,[oit,ait,c("a",{href:"https://huggingface.co/"+t.model.quantizer,target:"_blank",rel:"noopener noreferrer",onClick:e[7]||(e[7]=ge(()=>{},["stop"])),class:"flex hover:text-secondary duration-75 active:scale-90",title:"quantizer's profile"},he(t.model.quantizer),9,lit)])):V("",!0),c("div",cit,[dit,uit,c("a",{href:t.model.model_creator_link,target:"_blank",rel:"noopener noreferrer",onClick:e[8]||(e[8]=ge(()=>{},["stop"])),class:"flex hover:text-secondary duration-75 active:scale-90",title:"quantizer's profile"},he(t.model.model_creator),9,pit)]),c("div",_it,[hit,fit,et(" "+he(t.model.last_commit_time),1)]),c("div",mit,[git,bit,c("a",{href:"https://huggingface.co/"+t.model.model_creator,target:"_blank",rel:"noopener noreferrer",onClick:e[9]||(e[9]=ge(()=>{},["stop"])),class:"flex hover:text-secondary duration-75 active:scale-90",title:"quantizer's profile"},he(t.model.category),9,Eit)])])],8,qnt)]))],10,ont)}const vit=bt(rnt,[["render",yit]]),Sit={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}}},Tit={class:"p-4"},xit={class:"flex items-center mb-4"},Cit=["src"],wit={class:"text-lg font-semibold"},Rit=c("strong",null,"Author:",-1),Ait=c("strong",null,"Description:",-1),Nit=c("strong",null,"Category:",-1),Oit={key:0},Iit=c("strong",null,"Disclaimer:",-1),Mit=c("strong",null,"Conditioning Text:",-1),Dit=c("strong",null,"AI Prefix:",-1),kit=c("strong",null,"User Prefix:",-1),Lit=c("strong",null,"Antiprompts:",-1);function Pit(n,e,t,i,s,r){return w(),A("div",Tit,[c("div",xit,[c("img",{src:s.avatar,class:"w-12 h-12 rounded-full mr-2",alt:"Avatar"},null,8,Cit),c("h2",wit,he(s.personalityName),1)]),c("p",null,[Rit,et(" "+he(s.personalityAuthor),1)]),c("p",null,[Ait,et(" "+he(s.personalityDescription),1)]),c("p",null,[Nit,et(" "+he(s.personalityCategory),1)]),s.disclaimer?(w(),A("p",Oit,[Iit,et(" "+he(s.disclaimer),1)])):V("",!0),c("p",null,[Mit,et(" "+he(s.conditioningText),1)]),c("p",null,[Dit,et(" "+he(s.aiPrefix),1)]),c("p",null,[kit,et(" "+he(s.userPrefix),1)]),c("div",null,[Lit,c("ul",null,[(w(!0),A($e,null,lt(s.antipromptsList,o=>(w(),A("li",{key:o.id},he(o.text),1))),128))])]),c("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(),A("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 ")):V("",!0)])}const Uit=bt(Sit,[["render",Pit]]),ap="/assets/logo-9d653710.svg",Fit="/",Bit={props:{personality:{},select_language:Boolean,selected:Boolean,full_path:String,onTalk:Function,onOpenFolder:Function,onSelected:Function,onMount:Function,onUnMount:Function,onRemount:Function,onCopyToCustom:Function,onEdit:Function,onReinstall:Function,onSettings:Function,onCopyPersonalityName:Function},components:{InteractiveMenu:CE},data(){return{isMounted:!1,name:this.personality.name,thumbnailVisible:!1,thumbnailPosition:{x:0,y:0}}},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,Ge(()=>{He.replace()})},methods:{showThumbnail(){this.thumbnailVisible=!0},hideThumbnail(){this.thumbnailVisible=!1},updateThumbnailPosition(n){this.thumbnailPosition={x:n.clientX+10,y:n.clientY+10}},getImgUrl(){return Fit+this.personality.avatar},defaultImg(n){n.target.src=ap},showFolder(){this.onOpenFolder(this)},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(){Ge(()=>{He.replace()})}}},Git=["title"],Vit={class:"flex flex-row items-center flex-shrink-0 gap-3"},zit=["src"],Hit=c("i",{"data-feather":"clipboard",class:"w-5"},null,-1),qit=[Hit],Yit=["src"],$it={class:""},Wit={class:""},Kit={class:"flex items-center"},jit=c("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),Qit=c("b",null,"Author: ",-1),Xit={class:"flex items-center"},Zit=c("i",{"data-feather":"git-commit",class:"w-5 m-1"},null,-1),Jit=c("b",null,"Version: ",-1),est={key:0,class:"flex items-center"},tst=c("i",{"data-feather":"globe",class:"w-5 m-1"},null,-1),nst=c("b",null,"Languages: ",-1),ist=["selected"],sst={key:1,class:"flex items-center"},rst=c("i",{"data-feather":"globe",class:"w-5 m-1"},null,-1),ost=c("b",null,"Language: ",-1),ast={class:"flex items-center"},lst=c("i",{"data-feather":"bookmark",class:"w-5 m-1"},null,-1),cst=c("b",null,"Category: ",-1),dst=c("div",{class:"flex items-center"},[c("i",{"data-feather":"info",class:"w-5 m-1"}),c("b",null,"Description: "),c("br")],-1),ust=["title","innerHTML"],pst={class:"rounded bg-blue-300"},_st=c("i",{"data-feather":"check"},null,-1),hst=c("span",{class:"sr-only"},"Select",-1),fst=[_st,hst],mst=c("i",{"data-feather":"send",class:"w-5"},null,-1),gst=c("span",{class:"sr-only"},"Talk",-1),bst=[mst,gst],Est=c("i",{"data-feather":"folder",class:"w-5"},null,-1),yst=c("span",{class:"sr-only"},"Show Folder",-1),vst=[Est,yst];function Sst(n,e,t,i,s,r){const o=mt("InteractiveMenu");return w(),A("div",{class:ze(["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"},[c("div",{class:ze(t.personality.installed?"":"border-red-500")},[c("div",Vit,[c("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",onMouseover:e[2]||(e[2]=(...a)=>r.showThumbnail&&r.showThumbnail(...a)),onMousemove:e[3]||(e[3]=(...a)=>r.updateThumbnailPosition&&r.updateThumbnailPosition(...a)),onMouseleave:e[4]||(e[4]=(...a)=>r.hideThumbnail&&r.hideThumbnail(...a))},null,40,zit),c("h3",{onClick:e[5]||(e[5]=(...a)=>r.toggleSelected&&r.toggleSelected(...a)),class:"font-bold font-large text-lg line-clamp-3 cursor-pointer",onMouseover:e[6]||(e[6]=(...a)=>r.showThumbnail&&r.showThumbnail(...a)),onMousemove:e[7]||(e[7]=(...a)=>r.updateThumbnailPosition&&r.updateThumbnailPosition(...a)),onMouseleave:e[8]||(e[8]=(...a)=>r.hideThumbnail&&r.hideThumbnail(...a))},he(t.personality.name),33),c("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[9]||(e[9]=ge(a=>r.toggleCopyLink(),["stop"]))},qit),s.thumbnailVisible?(w(),A("div",{key:0,style:en({top:s.thumbnailPosition.y+"px",left:s.thumbnailPosition.x+"px"}),class:"fixed z-50 w-20 h-20 rounded-full overflow-hidden"},[c("img",{src:r.getImgUrl(),class:"w-full h-full object-fill"},null,8,Yit)],4)):V("",!0)]),c("div",$it,[c("div",Wit,[c("div",Kit,[jit,Qit,et(" "+he(t.personality.author),1)]),c("div",Xit,[Zit,Jit,et(" "+he(t.personality.version),1)]),t.personality.languages&&t.select_language?(w(),A("div",est,[tst,nst,s.isMounted?V("",!0):G((w(),A("select",{key:0,id:"languages","onUpdate:modelValue":e[10]||(e[10]=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),A($e,null,lt(t.personality.languages,(a,l)=>(w(),A("option",{key:l,selected:a==t.personality.languages[0]},he(a),9,ist))),128))],512)),[[Wt,t.personality.language]])])):V("",!0),t.personality.language?(w(),A("div",sst,[rst,ost,et(" "+he(t.personality.language),1)])):V("",!0),c("div",ast,[lst,cst,et(" "+he(t.personality.category),1)])]),dst,c("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,ust)]),c("div",pst,[s.isMounted?(w(),A("button",{key:0,type:"button",title:"Select",onClick:[e[11]||(e[11]=(...a)=>r.toggleSelected&&r.toggleSelected(...a)),e[12]||(e[12]=ge(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},fst)):V("",!0),s.isMounted?(w(),A("button",{key:1,type:"button",title:"Talk",onClick:[e[13]||(e[13]=(...a)=>r.toggleTalk&&r.toggleTalk(...a)),e[14]||(e[14]=ge(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},bst)):V("",!0),c("button",{type:"button",title:"Show_folder",onClick:[e[15]||(e[15]=(...a)=>r.showFolder&&r.showFolder(...a)),e[16]||(e[16]=ge(()=>{},["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),Te(o,{commands:r.commandsList,force_position:2,title:"Menu"},null,8,["commands"])])],2)],10,Git)}const hO=bt(Bit,[["render",Sst]]);const Tst={props:{ui:{type:String,required:!0,default:""}},watch:{ui(n,e){console.log(`ui changed from ${e} to ${n}`),this.$nextTick(()=>{this.evaluateScriptTags()})}},data(){return{}},mounted(){this.$nextTick(()=>{this.evaluateScriptTags()})},methods:{evaluateScriptTags(){console.log("evaluateScriptTags");const n=document.createElement("div");n.innerHTML=this.ui,n.querySelectorAll("script").forEach(t=>{const i=document.createElement("script");i.textContent=t.textContent,document.body.appendChild(i),document.body.removeChild(i)}),this.$refs.ui.innerHTML=n.innerHTML,console.log("this.$refs.ui.innerHTML"),console.log(this.$refs.ui.innerHTML)}}},xst={class:"w-full h-auto 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",ref:"ui"};function Cst(n,e,t,i,s,r){return w(),A("div",xst,null,512)}const fO=bt(Tst,[["render",Cst]]),wst="/",Rst={components:{DynamicUIRenderer:fO},props:{binding:{},onSelected:Function,onReinstall:Function,onInstall:Function,onUnInstall:Function,onSettings:Function,onReloadBinding:Function,selected:Boolean},data(){return{isTemplate:!1}},mounted(){Ge(()=>{He.replace()})},methods:{copyToClipBoard(n){console.log("Copying to clipboard :",n),navigator.clipboard.writeText(n)},getImgUrl(){return wst+this.binding.icon},defaultImg(n){n.target.src=ap},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(){Ge(()=>{He.replace()})}}},Ast=["title"],Nst={class:"flex flex-row items-center gap-3"},Ost=["src"],Ist={class:"font-bold font-large text-lg truncate"},Mst=c("div",{class:"grow"},null,-1),Dst={class:"flex-none gap-1"},kst=c("i",{"data-feather":"refresh-cw",class:"w-5"},null,-1),Lst=c("span",{class:"sr-only"},"Help",-1),Pst=[kst,Lst],Ust={class:"flex items-center flex-row-reverse gap-2 my-1"},Fst=c("span",{class:"sr-only"},"Click to install",-1),Bst=c("span",{class:"sr-only"},"Reinstall",-1),Gst=c("span",{class:"sr-only"},"UnInstall",-1),Vst=c("span",{class:"sr-only"},"Settings",-1),zst={class:""},Hst={class:""},qst={class:"flex items-center"},Yst=c("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),$st=c("b",null,"Author: ",-1),Wst={class:"flex items-center"},Kst=c("i",{"data-feather":"folder",class:"w-5 m-1"},null,-1),jst=c("b",null,"Folder: ",-1),Qst=c("div",{class:"grow"},null,-1),Xst=c("i",{"data-feather":"clipboard",class:"w-5"},null,-1),Zst=[Xst],Jst={class:"flex items-center"},ert=c("i",{"data-feather":"git-merge",class:"w-5 m-1"},null,-1),trt=c("b",null,"Version: ",-1),nrt={class:"flex items-center"},irt=c("i",{"data-feather":"github",class:"w-5 m-1"},null,-1),srt=c("b",null,"Link: ",-1),rrt=["href"],ort=c("div",{class:"flex items-center"},[c("i",{"data-feather":"info",class:"w-5 m-1"}),c("b",null,"Description: "),c("br")],-1),art=["title","innerHTML"];function lrt(n,e,t,i,s,r){const o=mt("DynamicUIRenderer");return w(),A("div",{class:ze(["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]=ge((...a)=>r.toggleSelected&&r.toggleSelected(...a),["stop"])),title:t.binding.installed?t.binding.name:"Not installed"},[c("div",null,[c("div",Nst,[c("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,Ost),c("h3",Ist,he(t.binding.name),1),Mst,c("div",Dst,[t.selected?(w(),A("button",{key:0,type:"button",title:"Reload binding",onClick:[e[1]||(e[1]=(...a)=>r.toggleReloadBinding&&r.toggleReloadBinding(...a)),e[2]||(e[2]=ge(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},Pst)):V("",!0)])]),c("div",Ust,[t.binding.installed?V("",!0):(w(),A("button",{key:0,title:"Click to install",type:"button",onClick:e[3]||(e[3]=ge((...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"},[et(" Install "),Fst])),t.binding.installed?(w(),A("button",{key:1,title:"Click to Reinstall binding",type:"button",onClick:e[4]||(e[4]=ge((...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"},[et(" Reinstall "),Bst])):V("",!0),t.binding.installed?(w(),A("button",{key:2,title:"Click to Reinstall binding",type:"button",onClick:e[5]||(e[5]=ge((...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"},[et(" Uninstall "),Gst])):V("",!0),t.selected?(w(),A("button",{key:3,title:"Click to open Settings",type:"button",onClick:e[6]||(e[6]=ge((...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"},[et(" Settings "),Vst])):V("",!0)]),t.binding.ui?(w(),xt(o,{key:0,class:"w-full h-full",code:t.binding.ui},null,8,["code"])):V("",!0),c("div",zst,[c("div",Hst,[c("div",qst,[Yst,$st,et(" "+he(t.binding.author),1)]),c("div",Wst,[Kst,jst,et(" "+he(t.binding.folder)+" ",1),Qst,c("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]=ge(a=>r.copyToClipBoard(this.binding.folder),["stop"]))},Zst)]),c("div",Jst,[ert,trt,et(" "+he(t.binding.version),1)]),c("div",nrt,[irt,srt,c("a",{href:t.binding.link,target:"_blank",class:"flex items-center hover:text-secondary duration-75 active:scale-90"},he(t.binding.link),9,rrt)])]),ort,c("p",{class:"mx-1 opacity-80 line-clamp-3",title:t.binding.description,innerHTML:t.binding.description},null,8,art)])])],10,Ast)}const crt=bt(Rst,[["render",lrt]]),drt={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})}}},urt={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50"},prt={class:"relative w-full max-w-md max-h-full"},_rt={class:"relative bg-white rounded-lg shadow dark:bg-gray-700"},hrt=c("svg",{"aria-hidden":"true",class:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[c("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),frt=c("span",{class:"sr-only"},"Close modal",-1),mrt=[hrt,frt],grt={class:"p-4 text-center"},brt=c("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"},[c("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),Ert={class:"p-4 text-center mx-auto mb-4"},yrt=c("label",{class:"mr-2"},"Model path",-1);function vrt(n,e,t,i,s,r){return s.show?(w(),A("div",urt,[c("div",prt,[c("div",_rt,[c("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"},mrt),c("div",grt,[brt,c("div",Ert,[yrt,G(c("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),[[we,s.model_path]])]),c("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 "),c("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")])])])])):V("",!0)}const Srt=bt(drt,[["render",vrt]]);const Trt={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)}}},xrt={key:0,class:"fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 z-20"},Crt={class:"bg-bg-light dark:bg-bg-dark rounded-lg p-6 w-96"},wrt={class:"text-xl font-bold text-5xl drop-shadow-md align-middle"},Rrt={class:"h-48 text-light-text-panel dark:text-dark-text-panel bg-bg-light-tone-panel dark:bg-dark-tone-panel overflow-y-auto rounded drop-shadow-md 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"},Art=["onClick"],Nrt={class:"font-bold text-dark-text-panel dark:text-light-text-panel"},Ort=c("br",null,null,-1),Irt={key:0,class:"text-xs text-gray-500"},Mrt=["onClick"],Drt={key:0,class:"flex flex-row mt-4 bg-light-tone-panel dark:bg-dark-tone-panel"},krt={class:"flex justify-end mt-4"},Lrt=["disabled"];function Prt(n,e,t,i,s,r){return w(),xt(Vi,{name:"fade"},{default:We(()=>[t.show?(w(),A("div",xrt,[c("div",Crt,[c("h2",wrt,he(t.title),1),c("div",Rrt,[c("ul",null,[(w(!0),A($e,null,lt(t.choices,(o,a)=>(w(),A("li",{key:a,onClick:l=>r.selectChoice(o),class:ze([{"selected-choice":o===s.selectedChoice},"py-2 px-4 cursor-pointer hover:bg-accent dark:hover:bg-secondary"])},[c("span",Nrt,he(r.displayName(o)),1),Ort,o.size?(w(),A("span",Irt,he(r.formatSize(o.size)),1)):V("",!0),t.can_remove?(w(),A("button",{key:1,onClick:ge(l=>r.removeChoice(o,a),["stop"]),class:"ml-2 text-red-500 hover:text-red-600"}," X ",8,Mrt)):V("",!0)],10,Art))),128))])]),s.showInput?(w(),A("div",Drt,[G(c("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),[[we,s.newFilename]]),c("button",{onClick:e[1]||(e[1]=(...o)=>r.addNewFilename&&r.addNewFilename(...o)),class:"ml-2 grow pl-2 pr-2 bg-primary hover:bg-primary-light text-white rounded-lg transition duration-300"}," Add ")])):V("",!0),c("div",krt,[c("button",{onClick:e[2]||(e[2]=(...o)=>r.closeDialog&&r.closeDialog(...o)),class:"py-2 px-4 mr-2 bg-secondary hover:bg-accent text-white rounded-lg transition duration-300"}," Cancel "),c("button",{onClick:e[3]||(e[3]=(...o)=>r.validateChoice&&r.validateChoice(...o)),class:ze([{"bg-gray-400 cursor-not-allowed":!s.selectedChoice,"bg-primary hover:bg-primary-light":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,Lrt),c("button",{onClick:e[4]||(e[4]=(...o)=>r.toggleInput&&r.toggleInput(...o)),class:"py-2 px-4 ml-2 bg-accent hover:bg-secondary text-white rounded-lg transition duration-300"}," Add New ")])])])):V("",!0)]),_:1})}const wE=bt(Trt,[["render",Prt]]),Urt={props:{radioOptions:{type:Array,required:!0},defaultValue:{type:String,default:"0"}},data(){return{selectedValue:this.defaultValue}},computed:{selectedLabel(){const n=this.radioOptions.find(e=>e.value===this.selectedValue);return n?n.label:""}},watch:{selectedValue(n,e){this.$emit("radio-selected",n)}},methods:{handleRadioChange(){}}},Frt={class:"flex space-x-4"},Brt=["value","aria-checked"],Grt={class:"text-gray-700"};function Vrt(n,e,t,i,s,r){return w(),A("div",Frt,[(w(!0),A($e,null,lt(t.radioOptions,(o,a)=>(w(),A("label",{key:o.value,class:"flex items-center space-x-2"},[G(c("input",{type:"radio",value:o.value,"onUpdate:modelValue":e[0]||(e[0]=l=>s.selectedValue=l),onChange:e[1]||(e[1]=(...l)=>r.handleRadioChange&&r.handleRadioChange(...l)),class:"text-blue-500 focus:ring-2 focus:ring-blue-200","aria-checked":s.selectedValue===o.value.toString(),role:"radio"},null,40,Brt),[[HD,s.selectedValue]]),c("span",Grt,he(o.label),1)]))),128))])}const zrt=bt(Urt,[["render",Vrt]]),Hrt="/assets/gpu-df72bf63.svg";const qrt="/";Se.defaults.baseURL="/";const Yrt={components:{AddModelDialog:Srt,ModelEntry:vit,PersonalityViewer:Uit,PersonalityEntry:hO,BindingEntry:crt,ChoiceDialog:wE,Card:op,RadioOptions:zrt},data(){return{posts_headers:{accept:"application/json","Content-Type":"application/json"},defaultModelImgPlaceholder:Li,snd_input_devices:[],snd_input_devices_indexes:[],snd_output_devices:[],snd_output_devices_indexes:[],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"},storeLogo:Ti,binding_changed:!1,SVGGPU:Hrt,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}],comfyui_models:[],show_only_installed_models:!1,reference_path:"",audioVoices:[],has_updates:!1,variant_choices:[],variantSelectionDialogVisible:!1,currenModelToInstall:null,loading_text:"",personality_category:null,addModelDialogVisibility:!1,modelPath:"",personalitiesFiltered:[],modelsFiltered:[],collapsedArr:[],all_collapsed:!0,data_conf_collapsed:!0,internet_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,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:qrt,searchPersonality:"",searchModel:"",searchPersonalityTimer:{},searchPersonalityTimerInterval:1500,searchModelTimerInterval:1500,searchPersonalityInProgress:!1,searchModelInProgress:!1,addModel:{},modelDownlaodInProgress:!1,uploadData:[]}},async created(){try{this.$store.state.loading_infos="Getting Hardware usage",await this.refreshHardwareUsage(this.$store)}catch(n){console.log("Error cought:",n)}Ye.on("loading_text",this.on_loading_text),this.updateHasUpdates()},methods:{async refreshHardwareUsage(n){await n.dispatch("refreshDiskUsage"),await n.dispatch("refreshRamUsage"),await n.dispatch("refreshVramUsage")},addDataSource(){this.$store.state.config.rag_databases.push(""),this.settingsChanged=!0},removeDataSource(n){this.$store.state.config.rag_databases.splice(n,1),this.settingsChanged=!0},async vectorize_folder(n){await Se.post("/vectorize_folder",{client_id:this.$store.state.client_id,db_path:this.$store.state.config.rag_databases[n]},this.posts_headers)},async select_folder(n){try{Ye.on("rag_db_added",e=>{console.log(e),e?(this.$store.state.config.rag_databases[n]=`${e.database_name}::${e.database_path}`,this.settingsChanged=!0):this.$store.state.toast.showToast("Failed to select a folder",4,!1)}),await Se.post("/add_rag_database",{client_id:this.$store.state.client_id},this.posts_headers)}catch{this.$store.state.toast.showToast("Failed to select a folder",4,!1)}},handleTemplateSelection(n){console.log("handleTemplateSelection");const e=n.target.value;console.log("handleTemplateSelection: ",e),e==="lollms"?(console.log("Using lollms template"),this.configFile.start_header_id_template="!@>",this.configFile.system_message_template="system",this.configFile.end_header_id_template=": ",this.configFile.separator_template=` +`+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,Se.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)),Se.post("./text2Wave",{text:t}).then(i=>{console.log(i.data.url);let s=i.data.url;this.audio_url=s,this.isSynthesizingVoice=!1,Ge(()=>{He.replace()})}).catch(i=>{this.$refs.toast.showToast(`Error: ${i}`,4,!1),this.isSynthesizingVoice=!1,Ge(()=>{He.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 u=r.lastIndexOf(l);u>a&&(a=u)}),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),Ye.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 Se.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}`),Ye.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(){Ye.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=HJe(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]={client_id:this.$store.state.client_id,name:n,content:this.text},Se.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(){Se.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?Se.post("/stop_recording",{client_id:this.$store.state.client_id}).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)}):Se.post("/start_recording",{client_id:this.$store.state.client_id}).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?Se.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)}):Se.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.")}}},YJe={class:"container w-full 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"},$Je={class:"container flex flex-row m-2 w-full"},WJe={class:"flex-grow max-w-[900px] m-2"},KJe={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"},jJe=c("i",{"data-feather":"pen-tool"},null,-1),QJe=[jJe],XJe=c("i",{"data-feather":"archive"},null,-1),ZJe=[XJe],JJe=["src"],eet=c("span",{class:"w-80"},null,-1),tet=c("i",{"data-feather":"x"},null,-1),net=[tet],iet=c("i",{"data-feather":"mic"},null,-1),set=[iet],ret=c("i",{"data-feather":"volume-2"},null,-1),oet=[ret],aet=c("i",{"data-feather":"speaker"},null,-1),cet=[aet],det=["src"],uet=["src"],pet=["src"],_et=["src"],het=c("i",{"data-feather":"voicemail"},null,-1),fet=[het],met={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"},get=c("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),bet=c("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),Eet=[get,bet],yet=c("i",{"data-feather":"upload"},null,-1),vet=[yet],Tet=c("i",{"data-feather":"download"},null,-1),xet=[Tet],Cet={class:"flex gap-3 flex-1 items-center flex-grow justify-end"},wet=c("input",{type:"file",id:"import-input",class:"hidden"},null,-1),Ret={key:0},Aet={class:"flex flex-row justify-end mx-2"},Net=["src"],Oet=["src"],Iet=["src"],Met=["src"],Det=["src"],ket=["src"],Let=["src"],Pet=["src"],Uet=c("i",{"data-feather":"copy"},null,-1),Fet=[Uet],Bet=["src"],Get={key:2},Vet=["value"],zet={key:0,title:"Selecting model",class:"flex flex-row flex-grow justify-end"},Het=c("div",{role:"status"},[c("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"},[c("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"}),c("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"})]),c("span",{class:"sr-only"},"Selecting model...")],-1),qet=[Het],Yet=["value"],$et=c("br",null,null,-1),Wet=c("i",{"data-feather":"check"},null,-1),Ket=[Wet],jet=c("i",{"data-feather":"plus"},null,-1),Qet=[jet],Xet=c("i",{"data-feather":"x"},null,-1),Zet=[Xet],Jet=c("i",{"data-feather":"refresh-ccw"},null,-1),ett=[Jet],ttt={class:"slider-container ml-2 mr-2"},ntt=c("h3",{class:"text-gray-600"},"Temperature",-1),itt={class:"slider-value text-gray-500"},stt={class:"slider-container ml-2 mr-2"},rtt=c("h3",{class:"text-gray-600"},"Top K",-1),ott={class:"slider-value text-gray-500"},att={class:"slider-container ml-2 mr-2"},ltt=c("h3",{class:"text-gray-600"},"Top P",-1),ctt={class:"slider-value text-gray-500"},dtt={class:"slider-container ml-2 mr-2"},utt=c("h3",{class:"text-gray-600"},"Repeat Penalty",-1),ptt={class:"slider-value text-gray-500"},_tt={class:"slider-container ml-2 mr-2"},htt=c("h3",{class:"text-gray-600"},"Repeat Last N",-1),ftt={class:"slider-value text-gray-500"},mtt={class:"slider-container ml-2 mr-2"},gtt=c("h3",{class:"text-gray-600"},"Number of tokens to crop the text to",-1),btt={class:"slider-value text-gray-500"},Ett={class:"slider-container ml-2 mr-2"},ytt=c("h3",{class:"text-gray-600"},"Number of tokens to generate",-1),vtt={class:"slider-value text-gray-500"},Stt={class:"slider-container ml-2 mr-2"},Ttt=c("h3",{class:"text-gray-600"},"Seed",-1),xtt={class:"slider-value text-gray-500"};function Ctt(n,e,t,i,s,r){const o=mt("tokens-hilighter"),a=mt("MarkdownRenderer"),l=mt("Card"),u=mt("Toast");return w(),A($e,null,[c("div",YJe,[c("div",$Je,[c("div",WJe,[c("div",KJe,[G(c("button",{id:"generate-button",title:"Generate from current cursor position",onClick:e[0]||(e[0]=(...d)=>r.generate&&r.generate(...d)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},QJe,512),[[Mt,!s.generating]]),G(c("button",{id:"generate-next-button",title:"Generate from next place holder",onClick:e[1]||(e[1]=(...d)=>r.generate_in_placeholder&&r.generate_in_placeholder(...d)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},ZJe,512),[[Mt,!s.generating]]),G(c("button",{id:"tokenize",title:"Tokenize text",onClick:e[2]||(e[2]=(...d)=>r.tokenize_text&&r.tokenize_text(...d)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},[c("img",{width:"25",height:"25",src:s.tokenize_icon},null,8,JJe)],512),[[Mt,!s.generating]]),eet,G(c("button",{id:"stop-button",onClick:e[3]||(e[3]=(...d)=>r.stopGeneration&&r.stopGeneration(...d)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},net,512),[[Mt,s.generating]]),c("button",{type:"button",title:"Dictate (using your browser for transcription)",onClick:e[4]||(e[4]=(...d)=>r.startSpeechRecognition&&r.startSpeechRecognition(...d)),class:ze([{"text-red-500":s.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer"])},set,2),c("button",{title:"convert text to audio (not saved and uses your browser tts service)",onClick:e[5]||(e[5]=ge(d=>r.speak(),["stop"])),class:ze([{"text-red-500":r.isTalking},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer"])},oet,2),c("input",{type:"file",ref:"fileInput",onChange:e[6]||(e[6]=(...d)=>r.handleFileUpload&&r.handleFileUpload(...d)),style:{display:"none"},accept:".wav"},null,544),c("button",{title:"Upload a voice",onClick:e[7]||(e[7]=(...d)=>r.triggerFileUpload&&r.triggerFileUpload(...d))},cet),c("button",{type:"button",title:"Start audio to audio",onClick:e[8]||(e[8]=(...d)=>r.startRecordingAndTranscribing&&r.startRecordingAndTranscribing(...d)),class:ze([{"text-green-500":s.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer text-red-500"])},[s.pending?V("",!0):(w(),A("img",{key:0,src:s.is_deaf_transcribing?s.deaf_on:s.deaf_off,height:"25"},null,8,det)),s.pending?(w(),A("img",{key:1,src:s.loading_icon,height:"25"},null,8,uet)):V("",!0)],2),c("button",{type:"button",title:"Start recording audio",onClick:e[9]||(e[9]=(...d)=>r.startRecording&&r.startRecording(...d)),class:ze([{"text-green-500":s.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer text-red-500"])},[s.pending?V("",!0):(w(),A("img",{key:0,src:s.is_recording?s.rec_on:s.rec_off,height:"25"},null,8,pet)),s.pending?(w(),A("img",{key:1,src:s.loading_icon,height:"25"},null,8,_et)):V("",!0)],2),s.isSynthesizingVoice?(w(),A("svg",met,Eet)):(w(),A("button",{key:0,title:"generate audio from the text",onClick:e[10]||(e[10]=ge(d=>r.read(),["stop"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},fet)),G(c("button",{id:"export-button",onClick:e[11]||(e[11]=(...d)=>r.exportText&&r.exportText(...d)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},vet,512),[[Mt,!s.generating]]),G(c("button",{id:"import-button",onClick:e[12]||(e[12]=(...d)=>r.importText&&r.importText(...d)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},xet,512),[[Mt,!s.generating]]),c("div",Cet,[c("button",{class:ze(["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]=d=>s.tab_id="source")}," Source ",2),c("button",{class:ze(["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]=d=>s.tab_id="render")}," Render ",2)]),wet]),c("div",{class:ze(["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(),A("div",Ret,[c("div",Aet,[c("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]=ge(d=>r.addBlock(""),["stop"]))},[c("img",{src:s.code_block,width:"25",height:"25"},null,8,Net)]),c("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]=ge(d=>r.addBlock("python"),["stop"]))},[c("img",{src:s.python_block,width:"25",height:"25"},null,8,Oet)]),c("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]=ge(d=>r.addBlock("javascript"),["stop"]))},[c("img",{src:s.javascript_block,width:"25",height:"25"},null,8,Iet)]),c("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]=ge(d=>r.addBlock("json"),["stop"]))},[c("img",{src:s.json_block,width:"25",height:"25"},null,8,Met)]),c("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]=ge(d=>r.addBlock("c++"),["stop"]))},[c("img",{src:s.cpp_block,width:"25",height:"25"},null,8,Det)]),c("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]=ge(d=>r.addBlock("html"),["stop"]))},[c("img",{src:s.html5_block,width:"25",height:"25"},null,8,ket)]),c("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]=ge(d=>r.addBlock("latex"),["stop"]))},[c("img",{src:s.LaTeX_block,width:"25",height:"25"},null,8,Let)]),c("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]=ge(d=>r.addBlock("bash"),["stop"]))},[c("img",{src:s.bash_block,width:"25",height:"25"},null,8,Pet)]),c("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]=ge(d=>n.copyContentToClipboard(),["stop"]))},Fet)]),G(c("textarea",{ref:"mdTextarea",onKeydown:e[24]||(e[24]=Hs(ge((...d)=>r.insertTab&&r.insertTab(...d),["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]=d=>s.text=d),onClick:e[26]||(e[26]=ge((...d)=>r.mdTextarea_clicked&&r.mdTextarea_clicked(...d),["prevent"])),onChange:e[27]||(e[27]=ge((...d)=>r.mdTextarea_changed&&r.mdTextarea_changed(...d),["prevent"]))},`\r + `,36),[[we,s.text]]),c("span",null,"Cursor position "+he(s.cursorPosition),1)])):V("",!0),s.audio_url!=null?(w(),A("audio",{controls:"",key:s.audio_url},[c("source",{src:s.audio_url,type:"audio/wav",ref:"audio_player"},null,8,Bet),et(" Your browser does not support the audio element. ")])):V("",!0),Te(o,{namedTokens:s.namedTokens},null,8,["namedTokens"]),s.tab_id==="render"?(w(),A("div",Get,[Te(a,{ref:"mdRender",client_id:this.$store.state.client_id,message_id:0,discussion_id:0,"markdown-text":s.text,class:"mt-4 p-2 rounded shadow-lg dark:bg-bg-dark"},null,8,["client_id","markdown-text"])])):V("",!0)],2)]),Te(l,{title:"settings",class:"slider-container ml-0 mr-0",isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:We(()=>[Te(l,{title:"Model",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:We(()=>[G(c("select",{"onUpdate:modelValue":e[28]||(e[28]=d=>this.$store.state.selectedModel=d),onChange:e[29]||(e[29]=(...d)=>r.setModel&&r.setModel(...d)),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},[(w(!0),A($e,null,lt(r.models,d=>(w(),A("option",{key:d,value:d},he(d),9,Vet))),128))],544),[[Wt,this.$store.state.selectedModel]]),s.selecting_model?(w(),A("div",zet,qet)):V("",!0)]),_:1}),Te(l,{title:"Presets",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:We(()=>[G(c("select",{"onUpdate:modelValue":e[30]||(e[30]=d=>s.selectedPreset=d),class:"bg-white dark:bg-black mb-2 border-2 rounded-md shadow-sm w-full"},[(w(!0),A($e,null,lt(s.presets,d=>(w(),A("option",{key:d,value:d},he(d.name),9,Yet))),128))],512),[[Wt,s.selectedPreset]]),$et,c("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[31]||(e[31]=(...d)=>r.setPreset&&r.setPreset(...d)),title:"Use preset"},Ket),c("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[32]||(e[32]=(...d)=>r.addPreset&&r.addPreset(...d)),title:"Add this text as a preset"},Qet),c("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[33]||(e[33]=(...d)=>r.removePreset&&r.removePreset(...d)),title:"Remove preset"},Zet),c("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[34]||(e[34]=(...d)=>r.reloadPresets&&r.reloadPresets(...d)),title:"Reload presets list"},ett)]),_:1}),Te(l,{title:"Generation params",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:We(()=>[c("div",ttt,[ntt,G(c("input",{type:"range","onUpdate:modelValue":e[35]||(e[35]=d=>s.temperature=d),min:"0",max:"5",step:"0.1",class:"w-full"},null,512),[[we,s.temperature]]),c("span",itt,"Current value: "+he(s.temperature),1)]),c("div",stt,[rtt,G(c("input",{type:"range","onUpdate:modelValue":e[36]||(e[36]=d=>s.top_k=d),min:"1",max:"100",step:"1",class:"w-full"},null,512),[[we,s.top_k]]),c("span",ott,"Current value: "+he(s.top_k),1)]),c("div",att,[ltt,G(c("input",{type:"range","onUpdate:modelValue":e[37]||(e[37]=d=>s.top_p=d),min:"0",max:"1",step:"0.1",class:"w-full"},null,512),[[we,s.top_p]]),c("span",ctt,"Current value: "+he(s.top_p),1)]),c("div",dtt,[utt,G(c("input",{type:"range","onUpdate:modelValue":e[38]||(e[38]=d=>s.repeat_penalty=d),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),[[we,s.repeat_penalty]]),c("span",ptt,"Current value: "+he(s.repeat_penalty),1)]),c("div",_tt,[htt,G(c("input",{type:"range","onUpdate:modelValue":e[39]||(e[39]=d=>s.repeat_last_n=d),min:"0",max:"100",step:"1",class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[we,s.repeat_last_n]]),c("span",ftt,"Current value: "+he(s.repeat_last_n),1)]),c("div",mtt,[gtt,G(c("input",{type:"number","onUpdate:modelValue":e[40]||(e[40]=d=>s.n_crop=d),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[we,s.n_crop]]),c("span",btt,"Current value: "+he(s.n_crop),1)]),c("div",Ett,[ytt,G(c("input",{type:"number","onUpdate:modelValue":e[41]||(e[41]=d=>s.n_predicts=d),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[we,s.n_predicts]]),c("span",vtt,"Current value: "+he(s.n_predicts),1)]),c("div",Stt,[Ttt,G(c("input",{type:"number","onUpdate:modelValue":e[42]||(e[42]=d=>s.seed=d),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[we,s.seed]]),c("span",xtt,"Current value: "+he(s.seed),1)])]),_:1})]),_:1})])]),Te(u,{ref:"toast"},null,512)],64)}const wtt=bt(qJe,[["render",Ctt]]);const Rtt={data(){return{activeExtension:null}},computed:{activeExtensions(){return console.log(this.$store.state.extensionsZoo),console.log(nM(this.$store.state.extensionsZoo)),this.$store.state.extensionsZoo}},methods:{showExtensionPage(n){this.activeExtension=n}}},Att={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"},Ntt={key:0},Ott=["onClick"],Itt={key:0},Mtt=["src"],Dtt={key:1},ktt=c("p",null,"No extension is active. Please install and activate an extension.",-1),Ltt=[ktt];function Ptt(n,e,t,i,s,r){return w(),A("div",Att,[r.activeExtensions.length>0?(w(),A("div",Ntt,[(w(!0),A($e,null,lt(r.activeExtensions,o=>(w(),A("div",{key:o.name,onClick:a=>r.showExtensionPage(o)},[c("div",{class:ze({"active-tab":o===s.activeExtension})},he(o.name),3)],8,Ott))),128)),s.activeExtension?(w(),A("div",Itt,[c("iframe",{src:s.activeExtension.page,width:"100%",height:"500px",frameborder:"0"},null,8,Mtt)])):V("",!0)])):(w(),A("div",Dtt,Ltt))])}const Utt=bt(Rtt,[["render",Ptt]]),Ftt={},Btt={style:{width:"100vw",height:"100vh"}},Gtt=c("iframe",{src:"/help/index.html",class:"m-0 p-0 w-full h-full"},null,-1),Vtt=[Gtt];function ztt(n,e,t,i,s,r){return w(),A("div",Btt,Vtt)}const Htt=bt(Ftt,[["render",ztt]]);function os(n,e=!0,t=1){const i=e?1e3:1024;if(Math.abs(n)=i&&r{He.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(),Ge(()=>{He.replace()})},beforeDestroy(){window.removeEventListener("resize",this.positionMenu)},watch:{isMenuOpen:"positionMenu"}},Ytt={class:"menu-container"},$tt=["title"],Wtt=["src"],Ktt=["data-feather"],jtt={key:2,class:"w-5 h-5"},Qtt={key:3,"data-feather":"menu"},Xtt={class:"flex-grow menu-ul"},Ztt=["onClick"],Jtt={key:0,"data-feather":"check"},ent=["src","alt"],tnt=["data-feather"],nnt={key:3,class:"menu-icon"};function int(n,e,t,i,s,r){return w(),A("div",Ytt,[c("button",{onClick:e[0]||(e[0]=ge((...o)=>r.toggleMenu&&r.toggleMenu(...o),["prevent"])),title:t.title,class:ze([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(),A("img",{key:0,src:t.icon,class:"w-5 h-5 p-0 m-0 shadow-lg bold"},null,8,Wtt)):t.icon&&t.icon.includes("feather")?(w(),A("i",{key:1,"data-feather":t.icon.split(":")[1],class:"w-5 h-5"},null,8,Ktt)):t.icon&&t.icon.includes("#")?(w(),A("p",jtt,he(t.icon.split("#")[1]),1)):(w(),A("i",Qtt))],10,$tt),Te(Vi,{name:"slide"},{default:We(()=>[s.isMenuOpen?(w(),A("div",{key:0,class:"menu-list flex-grow",style:en(s.menuPosition),ref:"menu"},[c("ul",Xtt,[(w(!0),A($e,null,lt(t.commands,(o,a)=>(w(),A("li",{key:a,onClick:ge(l=>r.executeCommand(o),["prevent"]),class:"menu-command menu-li flex-grow hover:bg-blue-400"},[t.selected_entry==o.name?(w(),A("i",Jtt)):o.icon&&!o.icon.includes("feather")&&!o.is_file?(w(),A("img",{key:1,src:o.icon,alt:o.name,class:"menu-icon"},null,8,ent)):V("",!0),o.icon&&o.icon.includes("feather")&&!o.is_file?(w(),A("i",{key:2,"data-feather":o.icon.split(":")[1],class:"mr-2"},null,8,tnt)):(w(),A("span",nnt)),c("span",null,he(o.name),1)],8,Ztt))),128))])],4)):V("",!0)]),_:1})])}const CE=bt(qtt,[["render",int]]),snt={components:{InteractiveMenu:CE},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(){Ge(()=>{He.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 os(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,Ge(()=>{He.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 os(this.speed)},total_size_computed(){return os(this.total_size)},downloaded_size_computed(){return os(this.downloaded_size)}},watch:{linkNotValid(){Ge(()=>{He.replace()})}}},rnt=["title"],ont={key:0,class:"flex flex-row"},ant={class:"max-w-[300px] overflow-x-auto"},lnt={class:"flex gap-3 items-center grow"},cnt=["href"],dnt=["src"],unt={class:"flex-1 overflow-hidden"},pnt={class:"font-bold font-large text-lg truncate"},_nt={key:1,class:"flex items-center flex-row gap-2 my-1"},hnt={class:"flex grow items-center"},fnt=c("i",{"data-feather":"box",class:"w-5"},null,-1),mnt=c("span",{class:"sr-only"},"Custom model / local model",-1),gnt=[fnt,mnt],bnt=c("span",{class:"sr-only"},"Remove",-1),Ent={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"},ynt={class:"relative flex flex-col items-center justify-center flex-grow h-full"},vnt=c("div",{role:"status",class:"justify-center"},[c("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"},[c("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"}),c("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"})]),c("span",{class:"sr-only"},"Loading...")],-1),Snt={class:"relative flex flex-row flex-grow items-center w-full h-full bottom-0"},Tnt={class:"w-full bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel rounded-lg p-2"},xnt={class:"flex justify-between mb-1"},Cnt=c("span",{class:"text-base font-medium text-blue-700 dark:text-white"},"Downloading",-1),wnt={class:"text-sm font-medium text-blue-700 dark:text-white"},Rnt={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},Ant={class:"flex justify-between mb-1"},Nnt={class:"text-base font-medium text-blue-700 dark:text-white"},Ont={class:"text-sm font-medium text-blue-700 dark:text-white"},Int={class:"flex flex-grow"},Mnt={class:"flex flex-row flex-grow gap-3"},Dnt={class:"p-2 text-center grow"},knt={key:3},Lnt={class:"flex flex-row items-center gap-3"},Pnt=["src"],Unt={class:"font-bold font-large text-lg truncate"},Fnt=c("div",{class:"grow"},null,-1),Bnt={class:"flex items-center flex-row-reverse gap-2 my-1"},Gnt={class:"flex flex-row items-center"},Vnt={key:0,class:"text-base text-red-600 flex items-center mt-1"},znt=c("i",{"data-feather":"alert-triangle",class:"flex-shrink-0 mx-1"},null,-1),Hnt=["title"],qnt={class:""},Ynt={class:"flex flex-row items-center"},$nt=c("i",{"data-feather":"download",class:"w-5 m-1 flex-shrink-0"},null,-1),Wnt=c("b",null,"Card: ",-1),Knt=["href","title"],jnt=c("div",{class:"grow"},null,-1),Qnt=c("i",{"data-feather":"clipboard",class:"w-5"},null,-1),Xnt=[Qnt],Znt={class:"flex items-center"},Jnt=c("i",{"data-feather":"file",class:"w-5 m-1"},null,-1),eit=c("b",null,"File size: ",-1),tit={class:"flex items-center"},nit=c("i",{"data-feather":"key",class:"w-5 m-1"},null,-1),iit=c("b",null,"License: ",-1),sit={key:0,class:"flex items-center"},rit=c("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),oit=c("b",null,"quantizer: ",-1),ait=["href"],lit={class:"flex items-center"},cit=c("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),dit=c("b",null,"Model creator: ",-1),uit=["href"],pit={class:"flex items-center"},_it=c("i",{"data-feather":"clock",class:"w-5 m-1"},null,-1),hit=c("b",null,"Release date: ",-1),fit={class:"flex items-center"},mit=c("i",{"data-feather":"grid",class:"w-5 m-1"},null,-1),git=c("b",null,"Category: ",-1),bit=["href"];function Eit(n,e,t,i,s,r){const o=mt("InteractiveMenu");return w(),A("div",{class:ze(["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]=ge(a=>r.toggleSelected(a),["prevent"]))},[t.model.isCustomModel?(w(),A("div",ont,[c("div",ant,[c("div",lnt,[c("a",{href:t.model.model_creator_link,target:"_blank"},[c("img",{src:r.getImgUrl(),onError:e[0]||(e[0]=a=>r.defaultImg(a)),class:"w-10 h-10 rounded-lg object-fill"},null,40,dnt)],8,cnt),c("div",unt,[c("h3",pnt,he(t.model.name),1)])])])])):V("",!0),t.model.isCustomModel?(w(),A("div",_nt,[c("div",hnt,[c("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]=ge(()=>{},["stop"]))},gnt),et(" Custom model ")]),c("div",null,[t.model.isInstalled?(w(),A("button",{key:0,title:"Delete file from disk",type:"button",onClick:e[2]||(e[2]=ge((...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"},[et(" Uninstall "),bnt])):V("",!0)])])):V("",!0),s.installing?(w(),A("div",Ent,[c("div",ynt,[vnt,c("div",Snt,[c("div",Tnt,[c("div",xnt,[Cnt,c("span",wnt,he(Math.floor(s.progress))+"%",1)]),c("div",Rnt,[c("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en({width:s.progress+"%"})},null,4)]),c("div",Ant,[c("span",Nnt,"Download speed: "+he(r.speed_computed)+"/s",1),c("span",Ont,he(r.downloaded_size_computed)+"/"+he(r.total_size_computed),1)])])]),c("div",Int,[c("div",Mnt,[c("div",Dnt,[c("button",{onClick:e[3]||(e[3]=ge((...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 ")])])])])])):V("",!0),t.model.isCustomModel?V("",!0):(w(),A("div",knt,[c("div",Lnt,[c("img",{ref:"imgElement",src:r.getImgUrl(),onError:e[4]||(e[4]=a=>r.defaultImg(a)),class:ze(["w-10 h-10 rounded-lg object-fill",s.linkNotValid?"grayscale":""])},null,42,Pnt),c("h3",Unt,he(t.model.name),1),Fnt,Te(o,{commands:r.commandsList,force_position:2,title:"Menu"},null,8,["commands"])]),c("div",Bnt,[c("div",Gnt,[s.linkNotValid?(w(),A("div",Vnt,[znt,et(" Link is not valid ")])):V("",!0)])]),c("div",{class:"",title:t.model.isInstalled?t.model.name:"Not installed"},[c("div",qnt,[c("div",Ynt,[$nt,Wnt,c("a",{href:"https://huggingface.co/"+t.model.quantizer+"/"+t.model.name,target:"_blank",onClick:e[5]||(e[5]=ge(()=>{},["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,Knt),jnt,c("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]=ge(a=>r.toggleCopyLink(),["stop"]))},Xnt)]),c("div",Znt,[c("div",{class:ze(["flex flex-shrink-0 items-center",s.linkNotValid?"text-red-600":""])},[Jnt,eit,et(" "+he(r.fileSize),1)],2)]),c("div",tit,[nit,iit,et(" "+he(t.model.license),1)]),t.model.quantizer!="None"&&t.model.type!="transformers"?(w(),A("div",sit,[rit,oit,c("a",{href:"https://huggingface.co/"+t.model.quantizer,target:"_blank",rel:"noopener noreferrer",onClick:e[7]||(e[7]=ge(()=>{},["stop"])),class:"flex hover:text-secondary duration-75 active:scale-90",title:"quantizer's profile"},he(t.model.quantizer),9,ait)])):V("",!0),c("div",lit,[cit,dit,c("a",{href:t.model.model_creator_link,target:"_blank",rel:"noopener noreferrer",onClick:e[8]||(e[8]=ge(()=>{},["stop"])),class:"flex hover:text-secondary duration-75 active:scale-90",title:"quantizer's profile"},he(t.model.model_creator),9,uit)]),c("div",pit,[_it,hit,et(" "+he(t.model.last_commit_time),1)]),c("div",fit,[mit,git,c("a",{href:"https://huggingface.co/"+t.model.model_creator,target:"_blank",rel:"noopener noreferrer",onClick:e[9]||(e[9]=ge(()=>{},["stop"])),class:"flex hover:text-secondary duration-75 active:scale-90",title:"quantizer's profile"},he(t.model.category),9,bit)])])],8,Hnt)]))],10,rnt)}const yit=bt(snt,[["render",Eit]]),vit={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}}},Sit={class:"p-4"},Tit={class:"flex items-center mb-4"},xit=["src"],Cit={class:"text-lg font-semibold"},wit=c("strong",null,"Author:",-1),Rit=c("strong",null,"Description:",-1),Ait=c("strong",null,"Category:",-1),Nit={key:0},Oit=c("strong",null,"Disclaimer:",-1),Iit=c("strong",null,"Conditioning Text:",-1),Mit=c("strong",null,"AI Prefix:",-1),Dit=c("strong",null,"User Prefix:",-1),kit=c("strong",null,"Antiprompts:",-1);function Lit(n,e,t,i,s,r){return w(),A("div",Sit,[c("div",Tit,[c("img",{src:s.avatar,class:"w-12 h-12 rounded-full mr-2",alt:"Avatar"},null,8,xit),c("h2",Cit,he(s.personalityName),1)]),c("p",null,[wit,et(" "+he(s.personalityAuthor),1)]),c("p",null,[Rit,et(" "+he(s.personalityDescription),1)]),c("p",null,[Ait,et(" "+he(s.personalityCategory),1)]),s.disclaimer?(w(),A("p",Nit,[Oit,et(" "+he(s.disclaimer),1)])):V("",!0),c("p",null,[Iit,et(" "+he(s.conditioningText),1)]),c("p",null,[Mit,et(" "+he(s.aiPrefix),1)]),c("p",null,[Dit,et(" "+he(s.userPrefix),1)]),c("div",null,[kit,c("ul",null,[(w(!0),A($e,null,lt(s.antipromptsList,o=>(w(),A("li",{key:o.id},he(o.text),1))),128))])]),c("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(),A("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 ")):V("",!0)])}const Pit=bt(vit,[["render",Lit]]),ap="/assets/logo-9d653710.svg",Uit="/",Fit={props:{personality:{},select_language:Boolean,selected:Boolean,full_path:String,onTalk:Function,onOpenFolder:Function,onSelected:Function,onMount:Function,onUnMount:Function,onRemount:Function,onCopyToCustom:Function,onEdit:Function,onReinstall:Function,onSettings:Function,onCopyPersonalityName:Function},components:{InteractiveMenu:CE},data(){return{isMounted:!1,name:this.personality.name,thumbnailVisible:!1,thumbnailPosition:{x:0,y:0}}},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,Ge(()=>{He.replace()})},methods:{showThumbnail(){this.thumbnailVisible=!0},hideThumbnail(){this.thumbnailVisible=!1},updateThumbnailPosition(n){this.thumbnailPosition={x:n.clientX+10,y:n.clientY+10}},getImgUrl(){return Uit+this.personality.avatar},defaultImg(n){n.target.src=ap},showFolder(){this.onOpenFolder(this)},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(){Ge(()=>{He.replace()})}}},Bit=["title"],Git={class:"flex flex-row items-center flex-shrink-0 gap-3"},Vit=["src"],zit=c("i",{"data-feather":"clipboard",class:"w-5"},null,-1),Hit=[zit],qit=["src"],Yit={class:""},$it={class:""},Wit={class:"flex items-center"},Kit=c("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),jit=c("b",null,"Author: ",-1),Qit={class:"flex items-center"},Xit=c("i",{"data-feather":"git-commit",class:"w-5 m-1"},null,-1),Zit=c("b",null,"Version: ",-1),Jit={key:0,class:"flex items-center"},est=c("i",{"data-feather":"globe",class:"w-5 m-1"},null,-1),tst=c("b",null,"Languages: ",-1),nst=["selected"],ist={key:1,class:"flex items-center"},sst=c("i",{"data-feather":"globe",class:"w-5 m-1"},null,-1),rst=c("b",null,"Language: ",-1),ost={class:"flex items-center"},ast=c("i",{"data-feather":"bookmark",class:"w-5 m-1"},null,-1),lst=c("b",null,"Category: ",-1),cst=c("div",{class:"flex items-center"},[c("i",{"data-feather":"info",class:"w-5 m-1"}),c("b",null,"Description: "),c("br")],-1),dst=["title","innerHTML"],ust={class:"rounded bg-blue-300"},pst=c("i",{"data-feather":"check"},null,-1),_st=c("span",{class:"sr-only"},"Select",-1),hst=[pst,_st],fst=c("i",{"data-feather":"send",class:"w-5"},null,-1),mst=c("span",{class:"sr-only"},"Talk",-1),gst=[fst,mst],bst=c("i",{"data-feather":"folder",class:"w-5"},null,-1),Est=c("span",{class:"sr-only"},"Show Folder",-1),yst=[bst,Est];function vst(n,e,t,i,s,r){const o=mt("InteractiveMenu");return w(),A("div",{class:ze(["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"},[c("div",{class:ze(t.personality.installed?"":"border-red-500")},[c("div",Git,[c("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",onMouseover:e[2]||(e[2]=(...a)=>r.showThumbnail&&r.showThumbnail(...a)),onMousemove:e[3]||(e[3]=(...a)=>r.updateThumbnailPosition&&r.updateThumbnailPosition(...a)),onMouseleave:e[4]||(e[4]=(...a)=>r.hideThumbnail&&r.hideThumbnail(...a))},null,40,Vit),c("h3",{onClick:e[5]||(e[5]=(...a)=>r.toggleSelected&&r.toggleSelected(...a)),class:"font-bold font-large text-lg line-clamp-3 cursor-pointer",onMouseover:e[6]||(e[6]=(...a)=>r.showThumbnail&&r.showThumbnail(...a)),onMousemove:e[7]||(e[7]=(...a)=>r.updateThumbnailPosition&&r.updateThumbnailPosition(...a)),onMouseleave:e[8]||(e[8]=(...a)=>r.hideThumbnail&&r.hideThumbnail(...a))},he(t.personality.name),33),c("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[9]||(e[9]=ge(a=>r.toggleCopyLink(),["stop"]))},Hit),s.thumbnailVisible?(w(),A("div",{key:0,style:en({top:s.thumbnailPosition.y+"px",left:s.thumbnailPosition.x+"px"}),class:"fixed z-50 w-20 h-20 rounded-full overflow-hidden"},[c("img",{src:r.getImgUrl(),class:"w-full h-full object-fill"},null,8,qit)],4)):V("",!0)]),c("div",Yit,[c("div",$it,[c("div",Wit,[Kit,jit,et(" "+he(t.personality.author),1)]),c("div",Qit,[Xit,Zit,et(" "+he(t.personality.version),1)]),t.personality.languages&&t.select_language?(w(),A("div",Jit,[est,tst,s.isMounted?V("",!0):G((w(),A("select",{key:0,id:"languages","onUpdate:modelValue":e[10]||(e[10]=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),A($e,null,lt(t.personality.languages,(a,l)=>(w(),A("option",{key:l,selected:a==t.personality.languages[0]},he(a),9,nst))),128))],512)),[[Wt,t.personality.language]])])):V("",!0),t.personality.language?(w(),A("div",ist,[sst,rst,et(" "+he(t.personality.language),1)])):V("",!0),c("div",ost,[ast,lst,et(" "+he(t.personality.category),1)])]),cst,c("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,dst)]),c("div",ust,[s.isMounted?(w(),A("button",{key:0,type:"button",title:"Select",onClick:[e[11]||(e[11]=(...a)=>r.toggleSelected&&r.toggleSelected(...a)),e[12]||(e[12]=ge(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},hst)):V("",!0),s.isMounted?(w(),A("button",{key:1,type:"button",title:"Talk",onClick:[e[13]||(e[13]=(...a)=>r.toggleTalk&&r.toggleTalk(...a)),e[14]||(e[14]=ge(()=>{},["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)):V("",!0),c("button",{type:"button",title:"Show_folder",onClick:[e[15]||(e[15]=(...a)=>r.showFolder&&r.showFolder(...a)),e[16]||(e[16]=ge(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},yst),Te(o,{commands:r.commandsList,force_position:2,title:"Menu"},null,8,["commands"])])],2)],10,Bit)}const hO=bt(Fit,[["render",vst]]);const Sst={props:{ui:{type:String,required:!0,default:""}},watch:{ui(n,e){console.log(`ui changed from ${e} to ${n}`),this.$nextTick(()=>{this.evaluateScriptTags()})}},data(){return{}},mounted(){this.$nextTick(()=>{this.evaluateScriptTags()})},methods:{evaluateScriptTags(){console.log("evaluateScriptTags");const n=document.createElement("div");n.innerHTML=this.ui,n.querySelectorAll("script").forEach(t=>{const i=document.createElement("script");i.textContent=t.textContent,document.body.appendChild(i),document.body.removeChild(i)}),this.$refs.ui.innerHTML=n.innerHTML,console.log("this.$refs.ui.innerHTML"),console.log(this.$refs.ui.innerHTML)}}},Tst={class:"w-full h-auto 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",ref:"ui"};function xst(n,e,t,i,s,r){return w(),A("div",Tst,null,512)}const fO=bt(Sst,[["render",xst]]),Cst="/",wst={components:{DynamicUIRenderer:fO},props:{binding:{},onSelected:Function,onReinstall:Function,onInstall:Function,onUnInstall:Function,onSettings:Function,onReloadBinding:Function,selected:Boolean},data(){return{isTemplate:!1}},mounted(){Ge(()=>{He.replace()})},methods:{copyToClipBoard(n){console.log("Copying to clipboard :",n),navigator.clipboard.writeText(n)},getImgUrl(){return Cst+this.binding.icon},defaultImg(n){n.target.src=ap},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(){Ge(()=>{He.replace()})}}},Rst=["title"],Ast={class:"flex flex-row items-center gap-3"},Nst=["src"],Ost={class:"font-bold font-large text-lg truncate"},Ist=c("div",{class:"grow"},null,-1),Mst={class:"flex-none gap-1"},Dst=c("i",{"data-feather":"refresh-cw",class:"w-5"},null,-1),kst=c("span",{class:"sr-only"},"Help",-1),Lst=[Dst,kst],Pst={class:"flex items-center flex-row-reverse gap-2 my-1"},Ust=c("span",{class:"sr-only"},"Click to install",-1),Fst=c("span",{class:"sr-only"},"Reinstall",-1),Bst=c("span",{class:"sr-only"},"UnInstall",-1),Gst=c("span",{class:"sr-only"},"Settings",-1),Vst={class:""},zst={class:""},Hst={class:"flex items-center"},qst=c("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),Yst=c("b",null,"Author: ",-1),$st={class:"flex items-center"},Wst=c("i",{"data-feather":"folder",class:"w-5 m-1"},null,-1),Kst=c("b",null,"Folder: ",-1),jst=c("div",{class:"grow"},null,-1),Qst=c("i",{"data-feather":"clipboard",class:"w-5"},null,-1),Xst=[Qst],Zst={class:"flex items-center"},Jst=c("i",{"data-feather":"git-merge",class:"w-5 m-1"},null,-1),ert=c("b",null,"Version: ",-1),trt={class:"flex items-center"},nrt=c("i",{"data-feather":"github",class:"w-5 m-1"},null,-1),irt=c("b",null,"Link: ",-1),srt=["href"],rrt=c("div",{class:"flex items-center"},[c("i",{"data-feather":"info",class:"w-5 m-1"}),c("b",null,"Description: "),c("br")],-1),ort=["title","innerHTML"];function art(n,e,t,i,s,r){const o=mt("DynamicUIRenderer");return w(),A("div",{class:ze(["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]=ge((...a)=>r.toggleSelected&&r.toggleSelected(...a),["stop"])),title:t.binding.installed?t.binding.name:"Not installed"},[c("div",null,[c("div",Ast,[c("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,Nst),c("h3",Ost,he(t.binding.name),1),Ist,c("div",Mst,[t.selected?(w(),A("button",{key:0,type:"button",title:"Reload binding",onClick:[e[1]||(e[1]=(...a)=>r.toggleReloadBinding&&r.toggleReloadBinding(...a)),e[2]||(e[2]=ge(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},Lst)):V("",!0)])]),c("div",Pst,[t.binding.installed?V("",!0):(w(),A("button",{key:0,title:"Click to install",type:"button",onClick:e[3]||(e[3]=ge((...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"},[et(" Install "),Ust])),t.binding.installed?(w(),A("button",{key:1,title:"Click to Reinstall binding",type:"button",onClick:e[4]||(e[4]=ge((...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"},[et(" Reinstall "),Fst])):V("",!0),t.binding.installed?(w(),A("button",{key:2,title:"Click to Reinstall binding",type:"button",onClick:e[5]||(e[5]=ge((...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"},[et(" Uninstall "),Bst])):V("",!0),t.selected?(w(),A("button",{key:3,title:"Click to open Settings",type:"button",onClick:e[6]||(e[6]=ge((...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"},[et(" Settings "),Gst])):V("",!0)]),t.binding.ui?(w(),xt(o,{key:0,class:"w-full h-full",code:t.binding.ui},null,8,["code"])):V("",!0),c("div",Vst,[c("div",zst,[c("div",Hst,[qst,Yst,et(" "+he(t.binding.author),1)]),c("div",$st,[Wst,Kst,et(" "+he(t.binding.folder)+" ",1),jst,c("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]=ge(a=>r.copyToClipBoard(this.binding.folder),["stop"]))},Xst)]),c("div",Zst,[Jst,ert,et(" "+he(t.binding.version),1)]),c("div",trt,[nrt,irt,c("a",{href:t.binding.link,target:"_blank",class:"flex items-center hover:text-secondary duration-75 active:scale-90"},he(t.binding.link),9,srt)])]),rrt,c("p",{class:"mx-1 opacity-80 line-clamp-3",title:t.binding.description,innerHTML:t.binding.description},null,8,ort)])])],10,Rst)}const lrt=bt(wst,[["render",art]]),crt={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})}}},drt={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50"},urt={class:"relative w-full max-w-md max-h-full"},prt={class:"relative bg-white rounded-lg shadow dark:bg-gray-700"},_rt=c("svg",{"aria-hidden":"true",class:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[c("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),hrt=c("span",{class:"sr-only"},"Close modal",-1),frt=[_rt,hrt],mrt={class:"p-4 text-center"},grt=c("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"},[c("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),brt={class:"p-4 text-center mx-auto mb-4"},Ert=c("label",{class:"mr-2"},"Model path",-1);function yrt(n,e,t,i,s,r){return s.show?(w(),A("div",drt,[c("div",urt,[c("div",prt,[c("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"},frt),c("div",mrt,[grt,c("div",brt,[Ert,G(c("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),[[we,s.model_path]])]),c("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 "),c("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")])])])])):V("",!0)}const vrt=bt(crt,[["render",yrt]]);const Srt={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)}}},Trt={key:0,class:"fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 z-20"},xrt={class:"bg-bg-light dark:bg-bg-dark rounded-lg p-6 w-96"},Crt={class:"text-xl font-bold text-5xl drop-shadow-md align-middle"},wrt={class:"h-48 text-light-text-panel dark:text-dark-text-panel bg-bg-light-tone-panel dark:bg-dark-tone-panel overflow-y-auto rounded drop-shadow-md 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"},Rrt=["onClick"],Art={class:"font-bold text-dark-text-panel dark:text-light-text-panel"},Nrt=c("br",null,null,-1),Ort={key:0,class:"text-xs text-gray-500"},Irt=["onClick"],Mrt={key:0,class:"flex flex-row mt-4 bg-light-tone-panel dark:bg-dark-tone-panel"},Drt={class:"flex justify-end mt-4"},krt=["disabled"];function Lrt(n,e,t,i,s,r){return w(),xt(Vi,{name:"fade"},{default:We(()=>[t.show?(w(),A("div",Trt,[c("div",xrt,[c("h2",Crt,he(t.title),1),c("div",wrt,[c("ul",null,[(w(!0),A($e,null,lt(t.choices,(o,a)=>(w(),A("li",{key:a,onClick:l=>r.selectChoice(o),class:ze([{"selected-choice":o===s.selectedChoice},"py-2 px-4 cursor-pointer hover:bg-accent dark:hover:bg-secondary"])},[c("span",Art,he(r.displayName(o)),1),Nrt,o.size?(w(),A("span",Ort,he(r.formatSize(o.size)),1)):V("",!0),t.can_remove?(w(),A("button",{key:1,onClick:ge(l=>r.removeChoice(o,a),["stop"]),class:"ml-2 text-red-500 hover:text-red-600"}," X ",8,Irt)):V("",!0)],10,Rrt))),128))])]),s.showInput?(w(),A("div",Mrt,[G(c("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),[[we,s.newFilename]]),c("button",{onClick:e[1]||(e[1]=(...o)=>r.addNewFilename&&r.addNewFilename(...o)),class:"ml-2 grow pl-2 pr-2 bg-primary hover:bg-primary-light text-white rounded-lg transition duration-300"}," Add ")])):V("",!0),c("div",Drt,[c("button",{onClick:e[2]||(e[2]=(...o)=>r.closeDialog&&r.closeDialog(...o)),class:"py-2 px-4 mr-2 bg-secondary hover:bg-accent text-white rounded-lg transition duration-300"}," Cancel "),c("button",{onClick:e[3]||(e[3]=(...o)=>r.validateChoice&&r.validateChoice(...o)),class:ze([{"bg-gray-400 cursor-not-allowed":!s.selectedChoice,"bg-primary hover:bg-primary-light":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,krt),c("button",{onClick:e[4]||(e[4]=(...o)=>r.toggleInput&&r.toggleInput(...o)),class:"py-2 px-4 ml-2 bg-accent hover:bg-secondary text-white rounded-lg transition duration-300"}," Add New ")])])])):V("",!0)]),_:1})}const wE=bt(Srt,[["render",Lrt]]),Prt={props:{radioOptions:{type:Array,required:!0},defaultValue:{type:String,default:"0"}},data(){return{selectedValue:this.defaultValue}},computed:{selectedLabel(){const n=this.radioOptions.find(e=>e.value===this.selectedValue);return n?n.label:""}},watch:{selectedValue(n,e){this.$emit("radio-selected",n)}},methods:{handleRadioChange(){}}},Urt={class:"flex space-x-4"},Frt=["value","aria-checked"],Brt={class:"text-gray-700"};function Grt(n,e,t,i,s,r){return w(),A("div",Urt,[(w(!0),A($e,null,lt(t.radioOptions,(o,a)=>(w(),A("label",{key:o.value,class:"flex items-center space-x-2"},[G(c("input",{type:"radio",value:o.value,"onUpdate:modelValue":e[0]||(e[0]=l=>s.selectedValue=l),onChange:e[1]||(e[1]=(...l)=>r.handleRadioChange&&r.handleRadioChange(...l)),class:"text-blue-500 focus:ring-2 focus:ring-blue-200","aria-checked":s.selectedValue===o.value.toString(),role:"radio"},null,40,Frt),[[HD,s.selectedValue]]),c("span",Brt,he(o.label),1)]))),128))])}const Vrt=bt(Prt,[["render",Grt]]),zrt="/assets/gpu-df72bf63.svg";const Hrt="/";Se.defaults.baseURL="/";const qrt={components:{AddModelDialog:vrt,ModelEntry:yit,PersonalityViewer:Pit,PersonalityEntry:hO,BindingEntry:lrt,ChoiceDialog:wE,Card:op,RadioOptions:Vrt},data(){return{posts_headers:{accept:"application/json","Content-Type":"application/json"},defaultModelImgPlaceholder:Li,snd_input_devices:[],snd_input_devices_indexes:[],snd_output_devices:[],snd_output_devices_indexes:[],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"},storeLogo:Ti,binding_changed:!1,SVGGPU:zrt,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}],comfyui_models:[],show_only_installed_models:!1,reference_path:"",audioVoices:[],has_updates:!1,variant_choices:[],variantSelectionDialogVisible:!1,currenModelToInstall:null,loading_text:"",personality_category:null,addModelDialogVisibility:!1,modelPath:"",personalitiesFiltered:[],modelsFiltered:[],collapsedArr:[],all_collapsed:!0,data_conf_collapsed:!0,internet_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,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:Hrt,searchPersonality:"",searchModel:"",searchPersonalityTimer:{},searchPersonalityTimerInterval:1500,searchModelTimerInterval:1500,searchPersonalityInProgress:!1,searchModelInProgress:!1,addModel:{},modelDownlaodInProgress:!1,uploadData:[]}},async created(){try{this.$store.state.loading_infos="Getting Hardware usage",await this.refreshHardwareUsage(this.$store)}catch(n){console.log("Error cought:",n)}Ye.on("loading_text",this.on_loading_text),this.updateHasUpdates()},methods:{async refreshHardwareUsage(n){await n.dispatch("refreshDiskUsage"),await n.dispatch("refreshRamUsage"),await n.dispatch("refreshVramUsage")},addDataSource(){this.$store.state.config.rag_databases.push(""),this.settingsChanged=!0},removeDataSource(n){this.$store.state.config.rag_databases.splice(n,1),this.settingsChanged=!0},async vectorize_folder(n){await Se.post("/vectorize_folder",{client_id:this.$store.state.client_id,db_path:this.$store.state.config.rag_databases[n]},this.posts_headers)},async select_folder(n){try{Ye.on("rag_db_added",e=>{console.log(e),e?(this.$store.state.config.rag_databases[n]=`${e.database_name}::${e.database_path}`,this.settingsChanged=!0):this.$store.state.toast.showToast("Failed to select a folder",4,!1)}),await Se.post("/add_rag_database",{client_id:this.$store.state.client_id},this.posts_headers)}catch{this.$store.state.toast.showToast("Failed to select a folder",4,!1)}},handleTemplateSelection(n){console.log("handleTemplateSelection");const e=n.target.value;console.log("handleTemplateSelection: ",e),e==="lollms"?(console.log("Using lollms template"),this.configFile.start_header_id_template="!@>",this.configFile.system_message_template="system",this.configFile.end_header_id_template=": ",this.configFile.separator_template=` `,this.configFile.start_user_header_id_template="!@>",this.configFile.end_user_header_id_template=": ",this.configFile.end_user_message_id_template="",this.configFile.start_ai_header_id_template="!@>",this.configFile.end_ai_header_id_template=": ",this.configFile.end_ai_message_id_template="",this.settingsChanged=!0):e==="lollms_simplified"?(console.log("Using lollms template"),this.configFile.start_header_id_template="@>",this.configFile.system_message_template="system",this.configFile.end_header_id_template=": ",this.configFile.separator_template=` `,this.configFile.start_user_header_id_template="@>",this.configFile.end_user_header_id_template=": ",this.configFile.end_user_message_id_template="",this.configFile.start_ai_header_id_template="@>",this.configFile.end_ai_header_id_template=": ",this.configFile.end_ai_message_id_template="",this.settingsChanged=!0):e==="llama3"?(console.log("Using llama3 template"),this.configFile.start_header_id_template="<|start_header_id|>",this.configFile.system_message_template="system",this.configFile.end_header_id_template="<|end_header_id|>",this.configFile.separator_template="<|eot_id|>",this.configFile.start_user_header_id_template="<|start_header_id|>",this.configFile.end_user_header_id_template="<|end_header_id|>",this.configFile.end_user_message_id_template="",this.configFile.start_ai_header_id_template="<|start_header_id|>",this.configFile.end_ai_header_id_template="<|end_header_id|>",this.configFile.end_ai_message_id_template="",this.settingsChanged=!0):e==="mistral"&&(console.log("Using mistral template"),this.configFile.start_header_id_template="[INST]",this.configFile.system_message_template=" Using this information",this.configFile.end_header_id_template=": ",this.configFile.separator_template=` `,this.configFile.start_user_header_id_template="[INST]",this.configFile.end_user_header_id_template=": ",this.configFile.end_user_message_id_template="[/INST]",this.configFile.start_ai_header_id_template="[INST]",this.configFile.end_ai_header_id_template=": ",this.configFile.end_ai_message_id_template="[/INST]",this.settingsChanged=!0)},install_model(){},reinstallDiffusersService(){Se.post("/install_diffusers",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},upgradeDiffusersService(){Se.post("upgrade_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},reinstallSDService(){Se.post("/install_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},upgradeSDService(){Se.post("upgrade_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},startSDService(){Se.post("start_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},showSD(){Se.post("show_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},reinstallComfyUIService(){Se.post("install_comfyui",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},upgradeComfyUIService(){Se.post("upgrade_comfyui",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},startComfyUIService(){Se.post("start_comfyui",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},showComfyui(){Se.post("show_comfyui",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},reinstallMotionCtrlService(){Se.post("install_motion_ctrl",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},reinstallvLLMService(){Se.post("install_vllm",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},startvLLMService(){Se.post("start_vllm",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},startollamaService(){Se.post("start_ollama",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},reinstallPetalsService(){Se.post("install_petals",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},reinstallOLLAMAService(){Se.post("install_ollama",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},reinstallElasticSearchService(){Se.post("install_vllm",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},getSeviceVoices(){Se.get("list_voices").then(n=>{this.voices=n.data.voices}).catch(n=>{console.error(n)})},load_more_models(){this.models_zoo_initialLoadCount+10{He.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&&(console.log("voice synthesis"),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"),Ye.off("install_progress",i),console.log("Installed successfully"),this.$store.state.toast.showToast(`Model: @@ -150,25 +150,25 @@ Verify that the personality is not already copied there.`,4,!1)}).catch(e=>{this `,4,!1),console.error(e)})},async remountPersonality(n){await this.unmountPersonality(n),await this.mountPersonality(n)},onPersonalityReinstall(n){console.log("on reinstall ",n),this.isLoading=!0,console.log("Personality path:",n.personality.path),Se.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=Ti},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();try{console.log("Loading input devices list");const n=await Se.get("/get_snd_input_devices");this.snd_input_devices=n.data.device_names,this.snd_input_devices_indexes=n.data.device_indexes}catch{console.log("Couldin't list input devices")}try{console.log("Loading output devices list");const n=await Se.get("/get_snd_output_devices");this.snd_output_devices=n.data.device_names,this.snd_output_devices_indexes=n.data.device_indexes}catch{console.log("Couldin't list output devices")}try{console.log("Getting comfyui models");const n=await Se.get("/list_comfyui_models");console.log("res is ",n),n.data.status&&(this.comfyui_models=n.data.models)}catch{console.log("Couldin't list output devices")}},activated(){},computed:{full_template:{get(){return(this.configFile.start_header_id_template+this.configFile.system_message_template+this.configFile.end_header_id_template+" system message"+this.configFile.separator_template+this.configFile.start_user_header_id_template+"user name"+this.configFile.end_user_header_id_template+" User prompt"+this.configFile.separator_template+this.configFile.end_user_message_id_template+this.configFile.separator_template+this.configFile.start_ai_header_id_template+"ai personality"+this.configFile.end_ai_header_id_template+"ai response"+this.configFile.end_ai_message_id_template).replace(` `,"
")}},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}},openaiWhisperModels(){return["whisper-1"]},whisperModels(){return["tiny.en","tiny","base.en","base","small.en","small","medium.en","medium","large-v1","large-v2","large-v3","large"]},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 this.$store.state.config.user_avatar!=""?"/user_infos/"+this.$store.state.config.user_avatar:Ti},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}},xtts_current_language:{get(){return this.$store.state.config.xtts_current_language},set(n){console.log("Current xtts voice set to ",n),this.$store.state.config.xtts_current_language=n}},xtts_current_voice:{get(){return this.$store.state.config.xtts_current_voice===null||this.$store.state.config.xtts_current_voice===void 0?(console.log("current voice",this.$store.state.config.xtts_current_voice),"main_voice"):this.$store.state.config.xtts_current_voice},set(n){n=="main_voice"||n===void 0?(console.log("Current voice set to None"),this.$store.state.config.xtts_current_voice=null):(console.log("Current voice set to ",n),this.$store.state.config.xtts_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)}},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 null;const n=this.bindingsZoo.findIndex(e=>e.folder===this.configFile.binding_name);return n>-1?this.bindingsZoo[n].name:null},active_pesonality(){if(!this.isMounted)return null;const n=this.personalities.findIndex(e=>e.full_path===this.configFile.personalities[this.configFile.active_personality_id]);return n>-1?this.personalities[n].name:null},speed_computed(){return os(this.addModel.speed)},total_size_computed(){return os(this.addModel.total_size)},downloaded_size_computed(){return os(this.addModel.downloaded_size)}},watch:{bec_collapsed(){Ge(()=>{He.replace()})},pc_collapsed(){Ge(()=>{He.replace()})},mc_collapsed(){Ge(()=>{He.replace()})},sc_collapsed(){Ge(()=>{He.replace()})},showConfirmation(){Ge(()=>{He.replace()})},mzl_collapsed(){Ge(()=>{He.replace()})},pzl_collapsed(){Ge(()=>{He.replace()})},ezl_collapsed(){Ge(()=>{He.replace()})},bzl_collapsed(){Ge(()=>{He.replace()})},all_collapsed(n){this.collapseAll(n),Ge(()=>{He.replace()})},settingsChanged(n){this.$store.state.settingsChanged=n,Ge(()=>{He.replace()})},isLoading(){Ge(()=>{He.replace()})},searchPersonality(n){n==""&&this.filterPersonalities()},mzdc_collapsed(){Ge(()=>{He.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}},P=n=>(yo("data-v-5e34a141"),n=n(),vo(),n),$rt={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"},Wrt={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"},Krt={key:0,class:"flex gap-3 flex-1 items-center duration-75"},jrt=P(()=>c("i",{"data-feather":"x"},null,-1)),Qrt=[jrt],Xrt=P(()=>c("i",{"data-feather":"check"},null,-1)),Zrt=[Xrt],Jrt={key:1,class:"flex gap-3 flex-1 items-center"},eot=P(()=>c("i",{"data-feather":"refresh-ccw"},null,-1)),tot=[eot],not=P(()=>c("i",{"data-feather":"list"},null,-1)),iot=[not],sot={class:"flex gap-3 flex-1 items-center justify-end"},rot=P(()=>c("i",{"data-feather":"trash-2"},null,-1)),oot=[rot],aot=P(()=>c("i",{"data-feather":"refresh-ccw"},null,-1)),lot=[aot],cot=P(()=>c("i",{"data-feather":"arrow-up-circle"},null,-1)),dot=P(()=>c("i",{"data-feather":"alert-circle"},null,-1)),uot={class:"flex gap-3 items-center"},pot={key:0,class:"flex gap-3 items-center"},_ot=P(()=>c("div",{class:"flex flex-row"},[c("p",{class:"text-green-600 font-bold hover:text-green-300 ml-4 pl-4 mr-4 pr-4"},"Apply changes:"),c("i",{"data-feather":"check"})],-1)),hot=[_ot],fot=P(()=>c("div",{class:"flex flex-row"},[c("p",{class:"text-red-600 font-bold hover:text-red-300 ml-4 pl-4 mr-4 pr-4"},"Cancel changes:"),c("i",{"data-feather":"x"})],-1)),mot=[fot],got={key:1,role:"status"},bot=P(()=>c("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"},[c("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"}),c("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)),Eot=P(()=>c("span",{class:"sr-only"},"Loading...",-1)),yot={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"},vot={class:"flex flex-row p-3"},Sot=P(()=>c("i",{"data-feather":"chevron-right"},null,-1)),Tot=[Sot],xot=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),Cot=[xot],wot=P(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," System status",-1)),Rot=P(()=>c("div",{class:"mr-2"},"|",-1)),Aot={class:"text-base font-semibold cursor-pointer select-none items-center"},Not={class:"flex gap-2 items-center"},Oot={key:0},Iot=["src"],Mot={class:"font-bold font-large text-lg"},Dot={key:1},kot={class:"flex gap-2 items-center"},Lot=["src"],Pot={class:"font-bold font-large text-lg"},Uot=P(()=>c("i",{"data-feather":"cpu",title:"CPU Ram",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),Fot={class:"font-bold font-large text-lg"},Bot=P(()=>c("i",{"data-feather":"hard-drive",title:"Hard drive",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),Got={class:"font-bold font-large text-lg"},Vot={class:"mb-2"},zot=P(()=>c("label",{class:"flex items-center gap-1 ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},[c("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[c("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"})]),et(" CPU Ram usage: ")],-1)),Hot={class:"flex flex-col mx-2"},qot=P(()=>c("b",null,"Avaliable ram: ",-1)),Yot=P(()=>c("b",null,"Ram usage: ",-1)),$ot={class:"p-2"},Wot={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},Kot={class:"mb-2"},jot=P(()=>c("label",{class:"flex items-center gap-1 ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},[c("i",{"data-feather":"hard-drive",class:"w-5 h-5"}),et(" Disk usage: ")],-1)),Qot={class:"flex flex-col mx-2"},Xot=P(()=>c("b",null,"Avaliable disk space: ",-1)),Zot=P(()=>c("b",null,"Disk usage: ",-1)),Jot={class:"p-2"},eat={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},tat={class:"flex items-center gap-1 ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},nat=["src"],iat={class:"flex flex-col mx-2"},sat=P(()=>c("b",null,"Model: ",-1)),rat=P(()=>c("b",null,"Avaliable vram: ",-1)),oat=P(()=>c("b",null,"GPU usage: ",-1)),aat={class:"p-2"},lat={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},cat={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"},dat={class:"flex flex-row p-3"},uat=P(()=>c("i",{"data-feather":"chevron-right"},null,-1)),pat=[uat],_at=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),hat=[_at],fat=P(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Main configurations",-1)),mat={class:"flex flex-col mb-2 px-3 pb-2"},gat={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"},bat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"app_custom_logo",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Application logo:")],-1)),Eat={for:"logo-upload"},yat=["src"],vat={style:{width:"10%"}},Sat=P(()=>c("i",{"data-feather":"x"},null,-1)),Tat=[Sat],xat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"hardware_mode",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Hardware mode:")],-1)),Cat={class:"text-center items-center"},wat={class:"flex flex-row"},Rat=P(()=>c("option",{value:"cpu"},"CPU",-1)),Aat=P(()=>c("option",{value:"cpu-noavx"},"CPU (No AVX)",-1)),Nat=P(()=>c("option",{value:"nvidia-tensorcores"},"NVIDIA (Tensor Cores)",-1)),Oat=P(()=>c("option",{value:"nvidia"},"NVIDIA",-1)),Iat=P(()=>c("option",{value:"amd-noavx"},"AMD (No AVX)",-1)),Mat=P(()=>c("option",{value:"amd"},"AMD",-1)),Dat=P(()=>c("option",{value:"apple-intel"},"Apple Intel",-1)),kat=P(()=>c("option",{value:"apple-silicon"},"Apple Silicon",-1)),Lat=[Rat,Aat,Nat,Oat,Iat,Mat,Dat,kat],Pat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"discussion_db_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Database path:")],-1)),Uat={style:{width:"100%"}},Fat=P(()=>c("td",{style:{"min-width":"200px"}},[c("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)),Bat={class:"flex flex-row"},Gat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"auto_show_browser",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto show browser:")],-1)),Vat={class:"flex flex-row"},zat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"activate_debug",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate debug mode:")],-1)),Hat={class:"flex flex-row"},qat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"debug_show_final_full_prompt",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Show final full prompt in console:")],-1)),Yat={class:"flex flex-row"},$at=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"debug_show_chunks",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Show chunks in console:")],-1)),Wat={class:"flex flex-row"},Kat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"debug_log_file_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Debug file path:")],-1)),jat={class:"flex flex-row"},Qat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"show_news_panel",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Show news panel:")],-1)),Xat={class:"flex flex-row"},Zat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"auto_save",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto save:")],-1)),Jat={class:"flex flex-row"},elt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"auto_update",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto update:")],-1)),tlt={class:"flex flex-row"},nlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"auto_update",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto title:")],-1)),ilt={class:"flex flex-row"},slt={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"},rlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"start_header_id_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Start header id template:")],-1)),olt=P(()=>c("option",{value:"lollms"},"Lollms communication template",-1)),alt=P(()=>c("option",{value:"lollms_simplified"},"Lollms simplified communication template",-1)),llt=P(()=>c("option",{value:"llama3"},"LLama3 communication template",-1)),clt=P(()=>c("option",{value:"mistral"},"Mistral communication template",-1)),dlt=[olt,alt,llt,clt],ult=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"start_header_id_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Start header id template:")],-1)),plt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"end_header_id_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"End header id template:")],-1)),_lt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"start_user_header_id_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Start user header id template:")],-1)),hlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"end_user_header_id_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"End user header id template:")],-1)),flt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"end_user_message_id_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"End user message id template:")],-1)),mlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"start_ai_header_id_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Start ai header id template:")],-1)),glt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"end_ai_header_id_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"End ai header id template:")],-1)),blt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"end_ai_message_id_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"End ai message id template:")],-1)),Elt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"separator_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Separator template:")],-1)),ylt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"system_message_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"System template:")],-1)),vlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"full_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Full template:")],-1)),Slt=["innerHTML"],Tlt={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"},xlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"user_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"User name:")],-1)),Clt={style:{width:"100%"}},wlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"user_description",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"User description:")],-1)),Rlt={style:{width:"100%"}},Alt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"use_user_informations_in_discussion",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use user description in discussion:")],-1)),Nlt={style:{width:"100%"}},Olt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"use_model_name_in_discussions",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use model name in discussion:")],-1)),Ilt={style:{width:"100%"}},Mlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"user_avatar",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"User avatar:")],-1)),Dlt={for:"avatar-upload"},klt=["src"],Llt={style:{width:"10%"}},Plt=P(()=>c("i",{"data-feather":"x"},null,-1)),Ult=[Plt],Flt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"use_user_name_in_discussions",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use User Name in discussions:")],-1)),Blt={class:"flex flex-row"},Glt=P(()=>c("td",{style:{"min-width":"200px"}},[c("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)),Vlt={style:{width:"100%"}},zlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"max_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)),Hlt={style:{width:"100%"}},qlt={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"},Ylt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"turn_on_code_execution",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"turn on code execution:")],-1)),$lt={style:{width:"100%"}},Wlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("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)),Klt={style:{width:"100%"}},jlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("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)),Qlt={style:{width:"100%"}},Xlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"turn_on_open_file_validation",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"turn on open file/folder validation:")],-1)),Zlt={style:{width:"100%"}},Jlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"turn_on_send_file_validation",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"turn on send file validation:")],-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=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"activate_skills_lib",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate Skills library:")],-1)),ict={class:"flex flex-row"},sct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"discussion_db_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Skills library database name:")],-1)),rct={style:{width:"100%"}},oct={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"},act=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"pdf_latex_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"PDF LaTeX path:")],-1)),lct={class:"flex flex-row"},cct={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=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"positive_boost",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Positive Boost:")],-1)),uct={class:"flex flex-row"},pct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"negative_boost",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Negative Boost:")],-1)),_ct={class:"flex flex-row"},hct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"fun_mode",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Fun mode:")],-1)),fct={class:"flex flex-row"},mct={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"},gct={class:"flex flex-row p-3"},bct=P(()=>c("i",{"data-feather":"chevron-right"},null,-1)),Ect=[bct],yct=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),vct=[yct],Sct=P(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Data management settings",-1)),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"},xct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_databases",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data Sources:")],-1)),Cct={style:{width:"100%"}},wct=["onUpdate:modelValue"],Rct=["onClick"],Act=["onClick"],Nct=["onClick"],Oct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_vectorization_save_db",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"RAG Vectorizer:")],-1)),Ict=P(()=>c("option",{value:"bert"},"Bert Vectorizer",-1)),Mct=P(()=>c("option",{value:"tfidf"},"TFIDF Vectorizer",-1)),Dct=P(()=>c("option",{value:"word2vec"},"Word2Vec Vectorizer",-1)),kct=[Ict,Mct,Dct],Lct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_vectorizer_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"RAG Vectorizer model:")],-1)),Pct=P(()=>c("option",{value:"bert-base-nli-mean-tokens"},"bert-base-nli-mean-tokens",-1)),Uct=[Pct],Fct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_chunk_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"RAG chunk size:")],-1)),Bct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_overlap",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"RAG overlap size:")],-1)),Gct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_n_chunks",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"RAG number of chunks:")],-1)),Vct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_clean_chunks",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Clean chunks:")],-1)),zct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_follow_subfolders",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Follow subfolders:")],-1)),Hct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_check_new_files_at_startup",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Check for new files at startup:")],-1)),qct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_preprocess_chunks",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Preprocess chunks:")],-1)),Yct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_activate_multi_hops",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate multi hops RAG:")],-1)),$ct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"contextual_summary",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use contextual summary instead of rag (consumes alot of tokens and may be very slow but efficient, useful for summary and global questions that RAG can't do):")],-1)),Wct={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"},Kct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_vectorization_save_db",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Save vectorized database:")],-1)),jct={class:"flex flex-row"},Qct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_vectorization_visualize_on_vectorization",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"show vectorized data:")],-1)),Xct={class:"flex flex-row"},Zct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_vectorization_build_keys_words",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Reformulate prompt before querying database (advised):")],-1)),Jct={class:"flex flex-row"},edt=P(()=>c("td",{style:{"min-width":"200px"}},[c("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)),tdt={class:"flex flex-row"},ndt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_vectorization_put_chunk_informations_into_context",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Put Chunk Information Into Context:")],-1)),idt={class:"flex flex-row"},sdt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_vectorization_method",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization method:")],-1)),rdt=P(()=>c("option",{value:"tfidf_vectorizer"},"tfidf Vectorizer",-1)),odt=P(()=>c("option",{value:"bm25_vectorizer"},"bm25 Vectorizer",-1)),adt=P(()=>c("option",{value:"model_embedding"},"Model Embedding",-1)),ldt=P(()=>c("option",{value:"sentense_transformer"},"Sentense Transformer",-1)),cdt=[rdt,odt,adt,ldt],ddt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_vectorization_sentense_transformer_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization model (for Sentense Transformer):")],-1)),udt={style:{width:"100%"}},pdt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_visualization_method",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data visualization method:")],-1)),_dt=P(()=>c("option",{value:"PCA"},"PCA",-1)),hdt=P(()=>c("option",{value:"TSNE"},"TSNE",-1)),fdt=[_dt,hdt],mdt=P(()=>c("td",{style:{"min-width":"200px"}},[c("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"},bdt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_vectorization_chunk_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization chunk size(tokens):")],-1)),Edt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_vectorization_overlap_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization overlap size(tokens):")],-1)),ydt=P(()=>c("td",{style:{"min-width":"200px"}},[c("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"},Sdt={class:"flex flex-row p-3"},Tdt=P(()=>c("i",{"data-feather":"chevron-right"},null,-1)),xdt=[Tdt],Cdt=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),wdt=[Cdt],Rdt=P(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Internet",-1)),Adt={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"},Ndt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"activate_internet_search",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate internet search:")],-1)),Odt={class:"flex flex-row"},Idt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"activate_internet_pages_judgement",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate internet pages judgement:")],-1)),Mdt={class:"flex flex-row"},Ddt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"internet_quick_search",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate quick search:")],-1)),kdt={class:"flex flex-row"},Ldt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"internet_activate_search_decision",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate search decision:")],-1)),Pdt={class:"flex flex-row"},Udt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"internet_vectorization_chunk_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Internet vectorization chunk size:")],-1)),Fdt={class:"flex flex-col"},Bdt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"internet_vectorization_overlap_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Internet vectorization overlap size:")],-1)),Gdt={class:"flex flex-col"},Vdt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"internet_vectorization_nb_chunks",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Internet vectorization number of chunks:")],-1)),zdt={class:"flex flex-col"},Hdt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"internet_nb_search_pages",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Internet number of search pages:")],-1)),qdt={class:"flex flex-col"},Ydt={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"},$dt={class:"flex flex-row p-3"},Wdt=P(()=>c("i",{"data-feather":"chevron-right"},null,-1)),Kdt=[Wdt],jdt=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),Qdt=[jdt],Xdt=P(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Services Zoo",-1)),Zdt={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"},Jdt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"active_tts_service",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Default Text to speach engine"},"Active TTS Service:")],-1)),eut={style:{width:"100%"}},tut=P(()=>c("option",{value:"None"},"None",-1)),nut=P(()=>c("option",{value:"browser"},"Use Browser TTS (doesn't work in realtime mode)",-1)),iut=P(()=>c("option",{value:"xtts"},"XTTS",-1)),sut=P(()=>c("option",{value:"openai_tts"},"Open AI TTS",-1)),rut=[tut,nut,iut,sut],out=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"active_stt_service",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Default Speach to Text engine"},"Active STT Service:")],-1)),aut={style:{width:"100%"}},lut=P(()=>c("option",{value:"None"},"None",-1)),cut=P(()=>c("option",{value:"whisper"},"Whisper",-1)),dut=P(()=>c("option",{value:"openai_whisper"},"Open AI Whisper",-1)),uut=[lut,cut,dut],put=P(()=>c("tr",null,null,-1)),_ut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"active_tti_service",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Default Text to image engine"},"Active TTI Service:")],-1)),hut={style:{width:"100%"}},fut=P(()=>c("option",{value:"None"},"None",-1)),mut=P(()=>c("option",{value:"diffusers"},"Diffusers",-1)),gut=P(()=>c("option",{value:"autosd"},"AUTO1111's SD",-1)),but=P(()=>c("option",{value:"dall-e"},"Open AI DALL-E",-1)),Eut=P(()=>c("option",{value:"midjourney"},"Midjourney",-1)),yut=P(()=>c("option",{value:"comfyui"},"Comfyui",-1)),vut=P(()=>c("option",{value:"fooocus"},"Fooocus",-1)),Sut=[fut,mut,gut,but,Eut,yut,vut],Tut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"active_ttm_service",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Default Text to Music engine"},"Active TTM Service:")],-1)),xut={style:{width:"100%"}},Cut=P(()=>c("option",{value:"None"},"None",-1)),wut=P(()=>c("option",{value:"musicgen"},"Music Gen",-1)),Rut=[Cut,wut],Aut={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"},Nut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"use_negative_prompt",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use negative prompt:")],-1)),Out={class:"flex flex-row"},Iut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"use_ai_generated_negative_prompt",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use AI generated negative prompt:")],-1)),Mut={class:"flex flex-row"},Dut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"negative_prompt_generation_prompt",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Negative prompt generation prompt:")],-1)),kut={class:"flex flex-row"},Lut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"default_negative_prompt",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Default negative prompt:")],-1)),Put={class:"flex flex-row"},Uut={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=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_listening_threshold",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Listening threshold"},"Listening threshold:")],-1)),But={style:{width:"100%"}},Gut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_silence_duration",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Scilence duration"},"Silence duration (s):")],-1)),Vut={style:{width:"100%"}},zut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_sound_threshold_percentage",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"stt_sound_threshold_percentage"},"Minimum sound percentage in recorded segment:")],-1)),Hut={style:{width:"100%"}},qut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_gain",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"STT Gain"},"Volume amplification:")],-1)),Yut={style:{width:"100%"}},$ut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_rate",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Audio Rate"},"audio rate:")],-1)),Wut={style:{width:"100%"}},Kut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_channels",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"number of channels"},"number of channels:")],-1)),jut={style:{width:"100%"}},Qut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_buffer_size",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Buffer size"},"Buffer size:")],-1)),Xut={style:{width:"100%"}},Zut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_activate_word_detection",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate word detection:")],-1)),Jut={class:"flex flex-row"},ept=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_word_detection_file",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Word detection wav file:")],-1)),tpt={class:"flex flex-row"},npt={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"},ipt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_input_device",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Input device"},"Audio Input device:")],-1)),spt={style:{width:"100%"}},rpt=["value"],opt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"tts_output_device",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Input device"},"Audio Output device:")],-1)),apt={style:{width:"100%"}},lpt=["value"],cpt={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"},dpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"host",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Host:")],-1)),upt={style:{width:"100%"}},ppt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"lollms_access_keys",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Access keys (coma separated, if empty, anyone can use the server without authentication):")],-1)),_pt={style:{width:"100%"}},hpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"discussion_db_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Port:")],-1)),fpt={style:{width:"100%"}},mpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("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)),gpt={style:{width:"100%"}},bpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"activate_lollms_server",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate lollms server:")],-1)),Ept={style:{width:"100%"}},ypt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"activate_ollama_emulator",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate ollama server emulator:")],-1)),vpt={style:{width:"100%"}},Spt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"activate_openai_emulator",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate openai server emulator:")],-1)),Tpt={style:{width:"100%"}},xpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"activate_mistralai_emulator",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate mistral ai server emulator:")],-1)),Cpt={style:{width:"100%"}},wpt={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"},Rpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"activate_audio_infos",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate audio infos:")],-1)),Apt={class:"flex flex-row"},Npt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"audio_auto_send_input",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Send audio input automatically:")],-1)),Opt={class:"flex flex-row"},Ipt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"audio_silenceTimer",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"audio in silence timer (ms):")],-1)),Mpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"audio_in_language",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Input Audio Language:")],-1)),Dpt=["value"],kpt={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"},Lpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"whisper_activate",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate Whisper at startup:")],-1)),Ppt={class:"flex flex-row"},Upt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"whisper_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Whisper model:")],-1)),Fpt={class:"flex flex-row"},Bpt=["value"],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"},Vpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"openai_whisper_key",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"openai whisper key:")],-1)),zpt={class:"flex flex-row"},Hpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"openai_whisper_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Open Ai Whisper model:")],-1)),qpt={class:"flex flex-row"},Ypt=["value"],$pt={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"},Wpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"auto_speak",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable auto speak:")],-1)),Kpt={class:"flex flex-row"},jpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"audio_pitch",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"audio pitch:")],-1)),Qpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"audio_out_voice",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Output Audio Voice:")],-1)),Xpt=["value"],Zpt={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"},Jpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"xtts_current_language",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Current language:")],-1)),e_t={class:"flex flex-row"},t_t=["value"],n_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"xtts_current_voice",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Current voice:")],-1)),i_t={class:"flex flex-row"},s_t=["value"],r_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"auto_read",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable auto read:")],-1)),o_t={class:"flex flex-row"},a_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"xtts_stream_chunk_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"xtts stream chunk size:")],-1)),l_t={class:"flex flex-row"},c_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"xtts_temperature",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Temperature:")],-1)),d_t={class:"flex flex-row"},u_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"xtts_length_penalty",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Length Penalty:")],-1)),p_t={class:"flex flex-row"},__t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"xtts_repetition_penalty",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Repetition Penalty:")],-1)),h_t={class:"flex flex-row"},f_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"xtts_top_k",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Top K:")],-1)),m_t={class:"flex flex-row"},g_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"xtts_top_p",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Top P:")],-1)),b_t={class:"flex flex-row"},E_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"xtts_speed",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Speed:")],-1)),y_t={class:"flex flex-row"},v_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"enable_text_splitting",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable Text Splitting:")],-1)),S_t={class:"flex flex-row"},T_t={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"},x_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"openai_tts_key",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Open AI key:")],-1)),C_t={class:"flex flex-row"},w_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"openai_tts_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"openai tts model:")],-1)),R_t={class:"flex flex-row"},A_t=P(()=>c("option",null," tts-1 ",-1)),N_t=P(()=>c("option",null," tts-2 ",-1)),O_t=[A_t,N_t],I_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"openai_tts_voice",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"openai tts voice:")],-1)),M_t={class:"flex flex-row"},D_t=P(()=>c("option",null," alloy ",-1)),k_t=P(()=>c("option",null," echo ",-1)),L_t=P(()=>c("option",null," fable ",-1)),P_t=P(()=>c("option",null," nova ",-1)),U_t=P(()=>c("option",null," shimmer ",-1)),F_t=[D_t,k_t,L_t,P_t,U_t],B_t={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"},G_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"enable_sd_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable sd service:")],-1)),V_t={class:"flex flex-row"},z_t=P(()=>c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),H_t=[z_t],q_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"install_sd_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install SD service:")],-1)),Y_t={class:"flex flex-row"},$_t=P(()=>c("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)),W_t={class:"flex flex-row"},K_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"sd_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"sd base url:")],-1)),j_t={class:"flex flex-row"},Q_t={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"},X_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"install_diffusers_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install Diffusers service:")],-1)),Z_t={class:"flex flex-row"},J_t=P(()=>c("a",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",href:"https://github.com/huggingface/diffusers?tab=Apache-2.0-1-ov-file#readme",target:"_blank"},"Diffusers licence",-1)),eht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"diffusers_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Diffusers model:")],-1)),tht={class:"flex flex-row"},nht=P(()=>c("td",null,null,-1)),iht={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"},sht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"midjourney_key",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"midjourney key:")],-1)),rht={class:"flex flex-row"},oht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"midjourney_timeout",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"request timeout(s):")],-1)),aht={class:"flex flex-row"},lht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"midjourney_retries",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"number of retries:")],-1)),cht={class:"flex flex-row"},dht={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"},uht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"dall_e_key",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"dall e key:")],-1)),pht={class:"flex flex-row"},_ht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"dall_e_generation_engine",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"dall e generation engine:")],-1)),hht={class:"flex flex-row"},fht=P(()=>c("option",null," dall-e-2 ",-1)),mht=P(()=>c("option",null," dall-e-3 ",-1)),ght=[fht,mht],bht={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"},Eht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"enable_comfyui_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable comfyui service:")],-1)),yht={class:"flex flex-row"},vht=P(()=>c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),Sht=[vht],Tht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"comfyui_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Available models (only if local):")],-1)),xht={class:"flex flex-row"},Cht=["value"],wht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"comfyui_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable comfyui model:")],-1)),Rht={class:"flex flex-row"},Aht=P(()=>c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),Nht=[Aht],Oht=P(()=>c("td",{style:{"min-width":"200px"}},null,-1)),Iht={class:"flex flex-row"},Mht=P(()=>c("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)),Dht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"comfyui_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"comfyui base url:")],-1)),kht={class:"flex flex-row"},Lht={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"},Pht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"enable_ollama_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable ollama service:")],-1)),Uht={class:"flex flex-row"},Fht=P(()=>c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),Bht=[Fht],Ght=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"ollama_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install Ollama service:")],-1)),Vht={class:"flex flex-row"},zht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"ollama_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"ollama base url:")],-1)),Hht={class:"flex flex-row"},qht={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"},Yht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"enable_vllm_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable vLLM service:")],-1)),$ht={class:"flex flex-row"},Wht=P(()=>c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),Kht=[Wht],jht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"vllm_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install vLLM service:")],-1)),Qht={class:"flex flex-row"},Xht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"vllm_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"vllm base url:")],-1)),Zht={class:"flex flex-row"},Jht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"vllm_gpu_memory_utilization",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"gpu memory utilization:")],-1)),eft={class:"flex flex-col align-bottom"},tft={class:"relative"},nft=P(()=>c("p",{class:"absolute left-0 mt-6"},[c("label",{for:"vllm_gpu_memory_utilization",class:"text-sm font-medium"}," vllm gpu memory utilization: ")],-1)),ift={class:"absolute right-0"},sft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"vllm_max_num_seqs",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"vllm max num seqs:")],-1)),rft={class:"flex flex-row"},oft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"vllm_max_model_len",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"max model len:")],-1)),aft={class:"flex flex-row"},lft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"vllm_model_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"vllm model path:")],-1)),cft={class:"flex flex-row"},dft={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"},uft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"enable_petals_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable petals service:")],-1)),pft={class:"flex flex-row"},_ft=P(()=>c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),hft=[_ft],fft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"petals_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install Petals service:")],-1)),mft={class:"flex flex-row"},gft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"petals_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"petals base url:")],-1)),bft={class:"flex flex-row"},Eft={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"},yft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"enable_sd_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable Motion Ctrl service:")],-1)),vft={class:"flex flex-row"},Sft=P(()=>c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),Tft=[Sft],xft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"install_sd_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install Motion Ctrl service:")],-1)),Cft={class:"flex flex-row"},wft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"sd_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"sd base url:")],-1)),Rft={class:"flex flex-row"},Aft={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"},Nft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"elastic_search_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable elastic search service:")],-1)),Oft={class:"flex flex-row"},Ift=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"install_elastic_search_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Reinstall Elastic Search service:")],-1)),Mft={class:"flex flex-row"},Dft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"elastic_search_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"elastic search base url:")],-1)),kft={class:"flex flex-row"},Lft={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"},Pft={class:"flex flex-row p-3"},Uft=P(()=>c("i",{"data-feather":"chevron-right"},null,-1)),Fft=[Uft],Bft=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),Gft=[Bft],Vft=P(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Binding zoo",-1)),zft={key:0,class:"text-base text-red-600 flex gap-3 items-center mr-2"},Hft=P(()=>c("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),qft={key:1,class:"mr-2"},Yft={key:2,class:"text-base font-semibold cursor-pointer select-none items-center"},$ft={class:"flex gap-1 items-center"},Wft=["src"],Kft={class:"font-bold font-large text-lg line-clamp-1"},jft={key:0,class:"mb-2"},Qft={for:"binding",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},Xft=P(()=>c("i",{"data-feather":"chevron-up"},null,-1)),Zft=[Xft],Jft=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),emt=[Jft],tmt={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"},nmt={class:"flex flex-row p-3"},imt=P(()=>c("i",{"data-feather":"chevron-right"},null,-1)),smt=[imt],rmt=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),omt=[rmt],amt=P(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Models zoo",-1)),lmt={class:"flex flex-row items-center"},cmt={key:0,class:"text-base text-red-600 flex gap-3 items-center mr-2"},dmt=P(()=>c("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),umt={key:1,class:"text-base text-red-600 flex gap-3 items-center mr-2"},pmt=P(()=>c("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),_mt={key:2,class:"mr-2"},hmt={key:3,class:"text-base font-semibold cursor-pointer select-none items-center"},fmt={class:"flex gap-1 items-center"},mmt=["src"],gmt={class:"font-bold font-large text-lg line-clamp-1"},bmt={class:"mx-2 mb-4"},Emt={class:"relative"},ymt={class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},vmt={key:0},Smt=P(()=>c("div",{role:"status"},[c("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"},[c("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"}),c("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"})]),c("span",{class:"sr-only"},"Loading...")],-1)),Tmt=[Smt],xmt={key:1},Cmt=P(()=>c("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"},[c("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)),wmt=[Cmt],Rmt=P(()=>c("label",{for:"only_installed"},"Show only installed models",-1)),Amt=P(()=>c("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)),Nmt={key:0,role:"status",class:"text-center w-full display: flex;align-items: center;"},Omt=P(()=>c("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"},[c("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"}),c("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)),Imt=P(()=>c("p",{class:"heartbeat-text"},"Loading models Zoo",-1)),Mmt=[Omt,Imt],Dmt={key:1,class:"mb-2"},kmt={for:"model",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},Lmt=P(()=>c("i",{"data-feather":"chevron-up"},null,-1)),Pmt=[Lmt],Umt=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),Fmt=[Umt],Bmt={class:"mb-2"},Gmt={class:"p-2"},Vmt={class:"mb-3"},zmt=P(()=>c("label",{class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},"Create a reference from local file path:",-1)),Hmt={key:0},qmt={class:"mb-3"},Ymt=P(()=>c("label",{class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},"Download from web:",-1)),$mt={key:1,class:"relative flex flex-col items-center justify-center flex-grow h-full"},Wmt=P(()=>c("div",{role:"status",class:"justify-center"},null,-1)),Kmt={class:"relative flex flex-row flex-grow items-center w-full h-full bottom-0"},jmt={class:"w-full p-2"},Qmt={class:"flex justify-between mb-1"},Xmt=Fu(' Downloading Loading...',1),Zmt={class:"text-sm font-medium text-blue-700 dark:text-white"},Jmt=["title"],egt={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},tgt={class:"flex justify-between mb-1"},ngt={class:"text-base font-medium text-blue-700 dark:text-white"},igt={class:"text-sm font-medium text-blue-700 dark:text-white"},sgt={class:"flex flex-grow"},rgt={class:"flex flex-row flex-grow gap-3"},ogt={class:"p-2 text-center grow"},agt={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"},lgt={class:"flex flex-row p-3 items-center"},cgt=P(()=>c("i",{"data-feather":"chevron-right"},null,-1)),dgt=[cgt],ugt=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),pgt=[ugt],_gt=P(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Personalities zoo",-1)),hgt={key:0,class:"mr-2"},fgt={class:"mr-2 font-bold font-large text-lg line-clamp-1"},mgt={key:1,class:"mr-2"},ggt={key:2,class:"text-base font-semibold cursor-pointer select-none items-center flex flex-row"},bgt={key:0,class:"flex -space-x-4 items-center"},Egt={class:"group items-center flex flex-row"},ygt=["onClick"],vgt=["src","title"],Sgt=["onClick"],Tgt=P(()=>c("span",{class:"hidden group-hover:block -top-2 -right-1 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2 border-transparent",title:"Unmount personality"},[c("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"},[c("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)),xgt=[Tgt],Cgt=P(()=>c("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"},[c("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)),wgt=[Cgt],Rgt={class:"mx-2 mb-4"},Agt=P(()=>c("label",{for:"personality-search",class:"mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white"},"Search",-1)),Ngt={class:"relative"},Ogt={class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},Igt={key:0},Mgt=P(()=>c("div",{role:"status"},[c("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"},[c("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"}),c("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"})]),c("span",{class:"sr-only"},"Loading...")],-1)),Dgt=[Mgt],kgt={key:1},Lgt=P(()=>c("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"},[c("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)),Pgt=[Lgt],Ugt={key:0,class:"mx-2 mb-4"},Fgt={for:"persCat",class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},Bgt=["selected"],Ggt={key:0,class:"mb-2"},Vgt={for:"model",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},zgt=P(()=>c("i",{"data-feather":"chevron-up"},null,-1)),Hgt=[zgt],qgt=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),Ygt=[qgt],$gt={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"},Wgt={class:"flex flex-row"},Kgt=P(()=>c("i",{"data-feather":"chevron-right"},null,-1)),jgt=[Kgt],Qgt=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),Xgt=[Qgt],Zgt=P(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none"}," Model Configuration",-1)),Jgt={class:"m-2"},ebt={class:"flex flex-row gap-2 items-center"},tbt=P(()=>c("label",{for:"override-model-parameters",class:"block text-sm font-medium"}," Override personality model parameters ",-1)),nbt={class:"m-2"},ibt=P(()=>c("label",{for:"seed",class:"block mb-2 text-sm font-medium"}," Seed: ",-1)),sbt={class:"m-2"},rbt={class:"flex flex-col align-bottom"},obt={class:"relative"},abt=P(()=>c("p",{class:"absolute left-0 mt-6"},[c("label",{for:"temperature",class:"text-sm font-medium"}," Temperature: ")],-1)),lbt={class:"absolute right-0"},cbt={class:"m-2"},dbt={class:"flex flex-col align-bottom"},ubt={class:"relative"},pbt=P(()=>c("p",{class:"absolute left-0 mt-6"},[c("label",{for:"predict",class:"text-sm font-medium"}," N Predict: ")],-1)),_bt={class:"absolute right-0"},hbt={class:"m-2"},fbt={class:"flex flex-col align-bottom"},mbt={class:"relative"},gbt=P(()=>c("p",{class:"absolute left-0 mt-6"},[c("label",{for:"top_k",class:"text-sm font-medium"}," Top-K: ")],-1)),bbt={class:"absolute right-0"},Ebt={class:"m-2"},ybt={class:"flex flex-col align-bottom"},vbt={class:"relative"},Sbt=P(()=>c("p",{class:"absolute left-0 mt-6"},[c("label",{for:"top_p",class:"text-sm font-medium"}," Top-P: ")],-1)),Tbt={class:"absolute right-0"},xbt={class:"m-2"},Cbt={class:"flex flex-col align-bottom"},wbt={class:"relative"},Rbt=P(()=>c("p",{class:"absolute left-0 mt-6"},[c("label",{for:"repeat_penalty",class:"text-sm font-medium"}," Repeat penalty: ")],-1)),Abt={class:"absolute right-0"},Nbt={class:"m-2"},Obt={class:"flex flex-col align-bottom"},Ibt={class:"relative"},Mbt=P(()=>c("p",{class:"absolute left-0 mt-6"},[c("label",{for:"repeat_last_n",class:"text-sm font-medium"}," Repeat last N: ")],-1)),Dbt={class:"absolute right-0"};function kbt(n,e,t,i,s,r){const o=mt("Card"),a=mt("BindingEntry"),l=mt("RadioOptions"),u=mt("model-entry"),d=mt("personality-entry"),h=mt("AddModelDialog"),f=mt("ChoiceDialog");return w(),A($e,null,[c("div",$rt,[c("div",Wrt,[s.showConfirmation?(w(),A("div",Krt,[c("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel",type:"button",onClick:e[0]||(e[0]=ge(_=>s.showConfirmation=!1,["stop"]))},Qrt),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm save changes",type:"button",onClick:e[1]||(e[1]=ge(_=>r.save_configuration(),["stop"]))},Zrt)])):V("",!0),s.showConfirmation?V("",!0):(w(),A("div",Jrt,[c("button",{title:"Reset configuration",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[2]||(e[2]=_=>r.reset_configuration())},tot),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Collapse / Expand all panels",type:"button",onClick:e[3]||(e[3]=ge(_=>s.all_collapsed=!s.all_collapsed,["stop"]))},iot)])),c("div",sot,[c("button",{title:"Clear uploads",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[4]||(e[4]=_=>r.api_get_req("clear_uploads").then(m=>{m.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast(["failed!"],4,!1)}))},oot),c("button",{title:"Restart program",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[5]||(e[5]=_=>r.api_post_req("restart_program").then(m=>{m.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast(["failed!"],4,!1)}))},lot),s.has_updates?(w(),A("button",{key:0,title:"Upgrade program ",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[6]||(e[6]=_=>r.api_post_req("update_software").then(m=>{m.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast("Success!",4,!0)}))},[cot,dot,et(" = ")])):V("",!0),c("div",uot,[s.settingsChanged?(w(),A("div",pot,[s.isLoading?V("",!0):(w(),A("button",{key:0,class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Apply changes",type:"button",onClick:e[7]||(e[7]=ge(_=>r.applyConfiguration(),["stop"]))},hot)),s.isLoading?V("",!0):(w(),A("button",{key:1,class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Cancel changes",type:"button",onClick:e[8]||(e[8]=ge(_=>r.cancelConfiguration(),["stop"]))},mot))])):V("",!0),s.isLoading?(w(),A("div",got,[c("p",null,he(s.loading_text),1),bot,Eot])):V("",!0)])])]),c("div",{class:ze(s.isLoading?"pointer-events-none opacity-30 w-full":"w-full")},[c("div",yot,[c("div",vot,[c("button",{onClick:e[9]||(e[9]=ge(_=>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"},[G(c("div",null,Tot,512),[[Mt,s.sc_collapsed]]),G(c("div",null,Cot,512),[[Mt,!s.sc_collapsed]]),wot,Rot,c("div",Aot,[c("div",Not,[c("div",null,[r.vramUsage&&r.vramUsage.gpus&&r.vramUsage.gpus.length==1?(w(),A("div",Oot,[(w(!0),A($e,null,lt(r.vramUsage.gpus,_=>(w(),A("div",{class:"flex gap-2 items-center",key:_},[c("img",{src:s.SVGGPU,width:"25",height:"25"},null,8,Iot),c("h3",Mot,[c("div",null,he(r.computedFileSize(_.used_vram))+" / "+he(r.computedFileSize(_.total_vram))+" ("+he(_.percentage)+"%) ",1)])]))),128))])):V("",!0),r.vramUsage&&r.vramUsage.gpus&&r.vramUsage.gpus.length>1?(w(),A("div",Dot,[c("div",kot,[c("img",{src:s.SVGGPU,width:"25",height:"25"},null,8,Lot),c("h3",Pot,[c("div",null,he(r.vramUsage.gpus.length)+"x ",1)])])])):V("",!0)]),Uot,c("h3",Fot,[c("div",null,he(r.ram_usage)+" / "+he(r.ram_total_space)+" ("+he(r.ram_percent_usage)+"%)",1)]),Bot,c("h3",Got,[c("div",null,he(r.disk_binding_models_usage)+" / "+he(r.disk_total_space)+" ("+he(r.disk_percent_usage)+"%)",1)])])])])]),c("div",{class:ze([{hidden:s.sc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[c("div",Vot,[zot,c("div",Hot,[c("div",null,[qot,et(he(r.ram_available_space),1)]),c("div",null,[Yot,et(" "+he(r.ram_usage)+" / "+he(r.ram_total_space)+" ("+he(r.ram_percent_usage)+")% ",1)])]),c("div",$ot,[c("div",Wot,[c("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en("width: "+r.ram_percent_usage+"%;")},null,4)])])]),c("div",Kot,[jot,c("div",Qot,[c("div",null,[Xot,et(he(r.disk_available_space),1)]),c("div",null,[Zot,et(" "+he(r.disk_binding_models_usage)+" / "+he(r.disk_total_space)+" ("+he(r.disk_percent_usage)+"%)",1)])]),c("div",Jot,[c("div",eat,[c("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en("width: "+r.disk_percent_usage+"%;")},null,4)])])]),(w(!0),A($e,null,lt(r.vramUsage.gpus,_=>(w(),A("div",{class:"mb-2",key:_},[c("label",tat,[c("img",{src:s.SVGGPU,width:"25",height:"25"},null,8,nat),et(" GPU usage: ")]),c("div",iat,[c("div",null,[sat,et(he(_.gpu_model),1)]),c("div",null,[rat,et(he(this.computedFileSize(_.available_space)),1)]),c("div",null,[oat,et(" "+he(this.computedFileSize(_.used_vram))+" / "+he(this.computedFileSize(_.total_vram))+" ("+he(_.percentage)+"%)",1)])]),c("div",aat,[c("div",lat,[c("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en("width: "+_.percentage+"%;")},null,4)])])]))),128))],2)]),c("div",cat,[c("div",dat,[c("button",{onClick:e[10]||(e[10]=ge(_=>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"},[G(c("div",null,pat,512),[[Mt,s.minconf_collapsed]]),G(c("div",null,hat,512),[[Mt,!s.minconf_collapsed]]),fat])]),c("div",{class:ze([{hidden:s.minconf_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[c("div",mat,[Te(o,{title:"General",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",gat,[c("tr",null,[bat,c("td",null,[c("label",Eat,[c("img",{src:r.configFile.app_custom_logo!=null&&r.configFile.app_custom_logo!=""?"/user_infos/"+r.configFile.app_custom_logo:s.storeLogo,class:"w-50 h-50 rounded-full",style:{"max-width":"50px","max-height":"50px",cursor:"pointer"}},null,8,yat)]),c("input",{type:"file",id:"logo-upload",style:{display:"none"},onChange:e[11]||(e[11]=(..._)=>r.uploadLogo&&r.uploadLogo(..._))},null,32)]),c("td",vat,[c("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Discard title changes",type:"button",onClick:e[12]||(e[12]=ge(_=>r.resetLogo(),["stop"]))},Tat)])]),c("tr",null,[xat,c("td",Cat,[c("div",wat,[G(c("select",{id:"hardware_mode",required:"","onUpdate:modelValue":e[13]||(e[13]=_=>r.configFile.hardware_mode=_),onChange:e[14]||(e[14]=_=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},Lat,544),[[Wt,r.configFile.hardware_mode]])])])]),c("tr",null,[Pat,c("td",Uat,[G(c("input",{type:"text",id:"discussion_db_name",required:"","onUpdate:modelValue":e[15]||(e[15]=_=>r.configFile.discussion_db_name=_),onChange:e[16]||(e[16]=_=>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),[[we,r.configFile.discussion_db_name]])])]),c("tr",null,[Fat,c("td",null,[c("div",Bat,[G(c("input",{type:"checkbox",id:"copy_to_clipboard_add_all_details",required:"","onUpdate:modelValue":e[17]||(e[17]=_=>r.configFile.copy_to_clipboard_add_all_details=_),onChange:e[18]||(e[18]=_=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.copy_to_clipboard_add_all_details]])])])]),c("tr",null,[Gat,c("td",null,[c("div",Vat,[G(c("input",{type:"checkbox",id:"auto_show_browser",required:"","onUpdate:modelValue":e[19]||(e[19]=_=>r.configFile.auto_show_browser=_),onChange:e[20]||(e[20]=_=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.auto_show_browser]])])])]),c("tr",null,[zat,c("td",null,[c("div",Hat,[G(c("input",{type:"checkbox",id:"activate_debug",required:"","onUpdate:modelValue":e[21]||(e[21]=_=>r.configFile.debug=_),onChange:e[22]||(e[22]=_=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.debug]])])])]),c("tr",null,[qat,c("td",null,[c("div",Yat,[G(c("input",{type:"checkbox",id:"debug_show_final_full_prompt",required:"","onUpdate:modelValue":e[23]||(e[23]=_=>r.configFile.debug_show_final_full_prompt=_),onChange:e[24]||(e[24]=_=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.debug_show_final_full_prompt]])])])]),c("tr",null,[$at,c("td",null,[c("div",Wat,[G(c("input",{type:"checkbox",id:"debug_show_chunks",required:"","onUpdate:modelValue":e[25]||(e[25]=_=>r.configFile.debug_show_chunks=_),onChange:e[26]||(e[26]=_=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.debug_show_chunks]])])])]),c("tr",null,[Kat,c("td",null,[c("div",jat,[G(c("input",{type:"text",id:"debug_log_file_path",required:"","onUpdate:modelValue":e[27]||(e[27]=_=>r.configFile.debug_log_file_path=_),onChange:e[28]||(e[28]=_=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.debug_log_file_path]])])])]),c("tr",null,[Qat,c("td",null,[c("div",Xat,[G(c("input",{type:"checkbox",id:"show_news_panel",required:"","onUpdate:modelValue":e[29]||(e[29]=_=>r.configFile.show_news_panel=_),onChange:e[30]||(e[30]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.show_news_panel]])])])]),c("tr",null,[Zat,c("td",null,[c("div",Jat,[G(c("input",{type:"checkbox",id:"auto_save",required:"","onUpdate:modelValue":e[31]||(e[31]=_=>r.configFile.auto_save=_),onChange:e[32]||(e[32]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.auto_save]])])])]),c("tr",null,[elt,c("td",null,[c("div",tlt,[G(c("input",{type:"checkbox",id:"auto_update",required:"","onUpdate:modelValue":e[33]||(e[33]=_=>r.configFile.auto_update=_),onChange:e[34]||(e[34]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.auto_update]])])])]),c("tr",null,[nlt,c("td",null,[c("div",ilt,[G(c("input",{type:"checkbox",id:"auto_title",required:"","onUpdate:modelValue":e[35]||(e[35]=_=>r.configFile.auto_title=_),onChange:e[36]||(e[36]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.auto_title]])])])])])]),_:1}),Te(o,{title:"Model template",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",slt,[c("tr",null,[rlt,c("td",null,[c("select",{onChange:e[37]||(e[37]=(..._)=>r.handleTemplateSelection&&r.handleTemplateSelection(..._))},dlt,32)])]),c("tr",null,[ult,c("td",null,[G(c("input",{type:"text",id:"start_header_id_template",required:"","onUpdate:modelValue":e[38]||(e[38]=_=>r.configFile.start_header_id_template=_),onChange:e[39]||(e[39]=_=>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),[[we,r.configFile.start_header_id_template]])])]),c("tr",null,[plt,c("td",null,[G(c("input",{type:"text",id:"end_header_id_template",required:"","onUpdate:modelValue":e[40]||(e[40]=_=>r.configFile.end_header_id_template=_),onChange:e[41]||(e[41]=_=>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),[[we,r.configFile.end_header_id_template]])])]),c("tr",null,[_lt,c("td",null,[G(c("input",{type:"text",id:"start_user_header_id_template",required:"","onUpdate:modelValue":e[42]||(e[42]=_=>r.configFile.start_user_header_id_template=_),onChange:e[43]||(e[43]=_=>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),[[we,r.configFile.start_user_header_id_template]])])]),c("tr",null,[hlt,c("td",null,[G(c("input",{type:"text",id:"end_user_header_id_template",required:"","onUpdate:modelValue":e[44]||(e[44]=_=>r.configFile.end_user_header_id_template=_),onChange:e[45]||(e[45]=_=>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),[[we,r.configFile.end_user_header_id_template]])])]),c("tr",null,[flt,c("td",null,[G(c("input",{type:"text",id:"end_user_message_id_template",required:"","onUpdate:modelValue":e[46]||(e[46]=_=>r.configFile.end_user_message_id_template=_),onChange:e[47]||(e[47]=_=>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),[[we,r.configFile.end_user_message_id_template]])])]),c("tr",null,[mlt,c("td",null,[G(c("input",{type:"text",id:"start_ai_header_id_template",required:"","onUpdate:modelValue":e[48]||(e[48]=_=>r.configFile.start_ai_header_id_template=_),onChange:e[49]||(e[49]=_=>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),[[we,r.configFile.start_ai_header_id_template]])])]),c("tr",null,[glt,c("td",null,[G(c("input",{type:"text",id:"end_ai_header_id_template",required:"","onUpdate:modelValue":e[50]||(e[50]=_=>r.configFile.end_ai_header_id_template=_),onChange:e[51]||(e[51]=_=>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),[[we,r.configFile.end_ai_header_id_template]])])]),c("tr",null,[blt,c("td",null,[G(c("input",{type:"text",id:"end_ai_message_id_template",required:"","onUpdate:modelValue":e[52]||(e[52]=_=>r.configFile.end_ai_message_id_template=_),onChange:e[53]||(e[53]=_=>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),[[we,r.configFile.end_ai_message_id_template]])])]),c("tr",null,[Elt,c("td",null,[G(c("textarea",{id:"separator_template",required:"","onUpdate:modelValue":e[54]||(e[54]=_=>r.configFile.separator_template=_),onChange:e[55]||(e[55]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.separator_template]])])]),c("tr",null,[ylt,c("td",null,[G(c("input",{type:"text",id:"system_message_template",required:"","onUpdate:modelValue":e[56]||(e[56]=_=>r.configFile.system_message_template=_),onChange:e[57]||(e[57]=_=>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),[[we,r.configFile.system_message_template]])])]),c("tr",null,[vlt,c("td",null,[c("div",{innerHTML:r.full_template},null,8,Slt)])])])]),_:1}),Te(o,{title:"User",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Tlt,[c("tr",null,[xlt,c("td",Clt,[G(c("input",{type:"text",id:"user_name",required:"","onUpdate:modelValue":e[58]||(e[58]=_=>r.configFile.user_name=_),onChange:e[59]||(e[59]=_=>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),[[we,r.configFile.user_name]])])]),c("tr",null,[wlt,c("td",Rlt,[G(c("textarea",{id:"user_description",required:"","onUpdate:modelValue":e[60]||(e[60]=_=>r.configFile.user_description=_),onChange:e[61]||(e[61]=_=>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),[[we,r.configFile.user_description]])])]),c("tr",null,[Alt,c("td",Nlt,[G(c("input",{type:"checkbox",id:"use_user_informations_in_discussion",required:"","onUpdate:modelValue":e[62]||(e[62]=_=>r.configFile.use_user_informations_in_discussion=_),onChange:e[63]||(e[63]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.use_user_informations_in_discussion]])])]),c("tr",null,[Olt,c("td",Ilt,[G(c("input",{type:"checkbox",id:"use_model_name_in_discussions",required:"","onUpdate:modelValue":e[64]||(e[64]=_=>r.configFile.use_model_name_in_discussions=_),onChange:e[65]||(e[65]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.use_model_name_in_discussions]])])]),c("tr",null,[Mlt,c("td",null,[c("label",Dlt,[c("img",{src:r.configFile.user_avatar!=null&&r.configFile.user_avatar!=""?"/user_infos/"+r.configFile.user_avatar:s.storeLogo,class:"w-50 h-50 rounded-full",style:{"max-width":"50px","max-height":"50px",cursor:"pointer"}},null,8,klt)]),c("input",{type:"file",id:"avatar-upload",style:{display:"none"},onChange:e[66]||(e[66]=(..._)=>r.uploadAvatar&&r.uploadAvatar(..._))},null,32)]),c("td",Llt,[c("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Discard title changes",type:"button",onClick:e[67]||(e[67]=ge(_=>r.resetAvatar(),["stop"]))},Ult)])]),c("tr",null,[Flt,c("td",null,[c("div",Blt,[G(c("input",{type:"checkbox",id:"use_user_name_in_discussions",required:"","onUpdate:modelValue":e[68]||(e[68]=_=>r.configFile.use_user_name_in_discussions=_),onChange:e[69]||(e[69]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.use_user_name_in_discussions]])])])]),c("tr",null,[Glt,c("td",Vlt,[G(c("input",{type:"number",id:"max_n_predict",required:"","onUpdate:modelValue":e[70]||(e[70]=_=>r.configFile.max_n_predict=_),onChange:e[71]||(e[71]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.max_n_predict]])])]),c("tr",null,[zlt,c("td",Hlt,[G(c("input",{type:"number",id:"max_n_predict",required:"","onUpdate:modelValue":e[72]||(e[72]=_=>r.configFile.max_n_predict=_),onChange:e[73]||(e[73]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.max_n_predict]])])])])]),_:1}),Te(o,{title:"Security settings",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",qlt,[c("tr",null,[Ylt,c("td",$lt,[G(c("input",{type:"checkbox",id:"turn_on_code_execution",required:"","onUpdate:modelValue":e[74]||(e[74]=_=>r.configFile.turn_on_code_execution=_),onChange:e[75]||(e[75]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.turn_on_code_execution]])])]),c("tr",null,[Wlt,c("td",Klt,[G(c("input",{type:"checkbox",id:"turn_on_code_validation",required:"","onUpdate:modelValue":e[76]||(e[76]=_=>r.configFile.turn_on_code_validation=_),onChange:e[77]||(e[77]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.turn_on_code_validation]])])]),c("tr",null,[jlt,c("td",Qlt,[G(c("input",{type:"checkbox",id:"turn_on_setting_update_validation",required:"","onUpdate:modelValue":e[78]||(e[78]=_=>r.configFile.turn_on_setting_update_validation=_),onChange:e[79]||(e[79]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.turn_on_setting_update_validation]])])]),c("tr",null,[Xlt,c("td",Zlt,[G(c("input",{type:"checkbox",id:"turn_on_open_file_validation",required:"","onUpdate:modelValue":e[80]||(e[80]=_=>r.configFile.turn_on_open_file_validation=_),onChange:e[81]||(e[81]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.turn_on_open_file_validation]])])]),c("tr",null,[Jlt,c("td",ect,[G(c("input",{type:"checkbox",id:"turn_on_send_file_validation",required:"","onUpdate:modelValue":e[82]||(e[82]=_=>r.configFile.turn_on_send_file_validation=_),onChange:e[83]||(e[83]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.turn_on_send_file_validation]])])])])]),_:1}),Te(o,{title:"Knowledge database",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",tct,[c("tr",null,[nct,c("td",null,[c("div",ict,[G(c("input",{type:"checkbox",id:"activate_skills_lib",required:"","onUpdate:modelValue":e[84]||(e[84]=_=>r.configFile.activate_skills_lib=_),onChange:e[85]||(e[85]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.activate_skills_lib]])])])]),c("tr",null,[sct,c("td",rct,[G(c("input",{type:"text",id:"skills_lib_database_name",required:"","onUpdate:modelValue":e[86]||(e[86]=_=>r.configFile.skills_lib_database_name=_),onChange:e[87]||(e[87]=_=>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),[[we,r.configFile.skills_lib_database_name]])])])])]),_:1}),Te(o,{title:"Latex",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",oct,[c("tr",null,[act,c("td",null,[c("div",lct,[G(c("input",{type:"text",id:"pdf_latex_path",required:"","onUpdate:modelValue":e[88]||(e[88]=_=>r.configFile.pdf_latex_path=_),onChange:e[89]||(e[89]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.pdf_latex_path]])])])])])]),_:1}),Te(o,{title:"Boost",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",cct,[c("tr",null,[dct,c("td",null,[c("div",uct,[G(c("input",{type:"text",id:"positive_boost",required:"","onUpdate:modelValue":e[90]||(e[90]=_=>r.configFile.positive_boost=_),onChange:e[91]||(e[91]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.positive_boost]])])])]),c("tr",null,[pct,c("td",null,[c("div",_ct,[G(c("input",{type:"text",id:"negative_boost",required:"","onUpdate:modelValue":e[92]||(e[92]=_=>r.configFile.negative_boost=_),onChange:e[93]||(e[93]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.negative_boost]])])])]),c("tr",null,[hct,c("td",null,[c("div",fct,[G(c("input",{type:"checkbox",id:"fun_mode",required:"","onUpdate:modelValue":e[94]||(e[94]=_=>r.configFile.fun_mode=_),onChange:e[95]||(e[95]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.fun_mode]])])])])])]),_:1})])],2)]),c("div",mct,[c("div",gct,[c("button",{onClick:e[96]||(e[96]=ge(_=>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"},[G(c("div",null,Ect,512),[[Mt,s.data_conf_collapsed]]),G(c("div",null,vct,512),[[Mt,!s.data_conf_collapsed]]),Sct])]),c("div",{class:ze([{hidden:s.data_conf_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[Te(o,{title:"Data Sources",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Tct,[c("tr",null,[xct,c("td",Cct,[(w(!0),A($e,null,lt(r.configFile.rag_databases,(_,m)=>(w(),A("div",{key:m,class:"flex items-center mb-2"},[G(c("input",{type:"text","onUpdate:modelValue":E=>r.configFile.rag_databases[m]=E,onChange:e[97]||(e[97]=E=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,40,wct),[[we,r.configFile.rag_databases[m]]]),c("button",{onClick:E=>r.vectorize_folder(m),class:"w-500 ml-2 px-2 py-1 bg-green-500 text-white hover:bg-green-300 rounded"},"(Re)Vectorize",8,Rct),c("button",{onClick:E=>r.select_folder(m),class:"w-500 ml-2 px-2 py-1 bg-blue-500 text-white hover:bg-green-300 rounded"},"Select Folder",8,Act),c("button",{onClick:E=>r.removeDataSource(m),class:"ml-2 px-2 py-1 bg-red-500 text-white hover:bg-green-300 rounded"},"Remove",8,Nct)]))),128)),c("button",{onClick:e[98]||(e[98]=(..._)=>r.addDataSource&&r.addDataSource(..._)),class:"mt-2 px-2 py-1 bg-blue-500 text-white rounded"},"Add Data Source")])]),c("tr",null,[Oct,c("td",null,[G(c("select",{id:"rag_vectorizer",required:"","onUpdate:modelValue":e[99]||(e[99]=_=>r.configFile.rag_vectorizer=_),onChange:e[100]||(e[100]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},kct,544),[[Wt,r.configFile.rag_vectorizer]])])]),c("tr",null,[Lct,c("td",null,[G(c("select",{id:"rag_vectorizer_model",required:"","onUpdate:modelValue":e[101]||(e[101]=_=>r.configFile.rag_vectorizer_model=_),onChange:e[102]||(e[102]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},Uct,544),[[Wt,r.configFile.rag_vectorizer_model]])])]),c("tr",null,[Fct,c("td",null,[G(c("input",{id:"rag_chunk_size","onUpdate:modelValue":e[103]||(e[103]=_=>r.configFile.rag_chunk_size=_),onChange:e[104]||(e[104]=_=>s.settingsChanged=!0),type:"range",min:"2",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),[[we,r.configFile.rag_chunk_size]]),G(c("input",{"onUpdate:modelValue":e[105]||(e[105]=_=>r.configFile.rag_chunk_size=_),type:"number",onChange:e[106]||(e[106]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.rag_chunk_size]])])]),c("tr",null,[Bct,c("td",null,[G(c("input",{id:"rag_overlap","onUpdate:modelValue":e[107]||(e[107]=_=>r.configFile.rag_overlap=_),onChange:e[108]||(e[108]=_=>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),[[we,r.configFile.rag_overlap]]),G(c("input",{"onUpdate:modelValue":e[109]||(e[109]=_=>r.configFile.rag_overlap=_),type:"number",onChange:e[110]||(e[110]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.rag_overlap]])])]),c("tr",null,[Gct,c("td",null,[G(c("input",{id:"rag_n_chunks","onUpdate:modelValue":e[111]||(e[111]=_=>r.configFile.rag_n_chunks=_),onChange:e[112]||(e[112]=_=>s.settingsChanged=!0),type:"range",min:"2",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),[[we,r.configFile.rag_n_chunks]]),G(c("input",{"onUpdate:modelValue":e[113]||(e[113]=_=>r.configFile.rag_n_chunks=_),type:"number",onChange:e[114]||(e[114]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.rag_n_chunks]])])]),c("tr",null,[Vct,c("td",null,[G(c("input",{"onUpdate:modelValue":e[115]||(e[115]=_=>r.configFile.rag_clean_chunks=_),type:"checkbox",onChange:e[116]||(e[116]=_=>s.settingsChanged=!0),class:"w-5 mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.rag_clean_chunks]])])]),c("tr",null,[zct,c("td",null,[G(c("input",{"onUpdate:modelValue":e[117]||(e[117]=_=>r.configFile.rag_follow_subfolders=_),type:"checkbox",onChange:e[118]||(e[118]=_=>s.settingsChanged=!0),class:"w-5 mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.rag_follow_subfolders]])])]),c("tr",null,[Hct,c("td",null,[G(c("input",{"onUpdate:modelValue":e[119]||(e[119]=_=>r.configFile.rag_check_new_files_at_startup=_),type:"checkbox",onChange:e[120]||(e[120]=_=>s.settingsChanged=!0),class:"w-5 mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.rag_check_new_files_at_startup]])])]),c("tr",null,[qct,c("td",null,[G(c("input",{"onUpdate:modelValue":e[121]||(e[121]=_=>r.configFile.rag_preprocess_chunks=_),type:"checkbox",onChange:e[122]||(e[122]=_=>s.settingsChanged=!0),class:"w-5 mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.rag_preprocess_chunks]])])]),c("tr",null,[Yct,c("td",null,[G(c("input",{"onUpdate:modelValue":e[123]||(e[123]=_=>r.configFile.rag_activate_multi_hops=_),type:"checkbox",onChange:e[124]||(e[124]=_=>s.settingsChanged=!0),class:"w-5 mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.rag_activate_multi_hops]])])]),c("tr",null,[$ct,c("td",null,[G(c("input",{"onUpdate:modelValue":e[125]||(e[125]=_=>r.configFile.contextual_summary=_),type:"checkbox",onChange:e[126]||(e[126]=_=>s.settingsChanged=!0),class:"w-5 mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.contextual_summary]])])])])]),_:1}),Te(o,{title:"Data Vectorization",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Wct,[c("tr",null,[Kct,c("td",null,[c("div",jct,[G(c("input",{type:"checkbox",id:"data_vectorization_save_db",required:"","onUpdate:modelValue":e[127]||(e[127]=_=>r.configFile.data_vectorization_save_db=_),onChange:e[128]||(e[128]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.data_vectorization_save_db]])])])]),c("tr",null,[Qct,c("td",null,[c("div",Xct,[G(c("input",{type:"checkbox",id:"data_vectorization_visualize_on_vectorization",required:"","onUpdate:modelValue":e[129]||(e[129]=_=>r.configFile.data_vectorization_visualize_on_vectorization=_),onChange:e[130]||(e[130]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.data_vectorization_visualize_on_vectorization]])])])]),c("tr",null,[Zct,c("td",null,[c("div",Jct,[G(c("input",{type:"checkbox",id:"data_vectorization_build_keys_words",required:"","onUpdate:modelValue":e[131]||(e[131]=_=>r.configFile.data_vectorization_build_keys_words=_),onChange:e[132]||(e[132]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.data_vectorization_build_keys_words]])])])]),c("tr",null,[edt,c("td",null,[c("div",tdt,[G(c("input",{type:"checkbox",id:"data_vectorization_force_first_chunk",required:"","onUpdate:modelValue":e[133]||(e[133]=_=>r.configFile.data_vectorization_force_first_chunk=_),onChange:e[134]||(e[134]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.data_vectorization_force_first_chunk]])])])]),c("tr",null,[ndt,c("td",null,[c("div",idt,[G(c("input",{type:"checkbox",id:"data_vectorization_put_chunk_informations_into_context",required:"","onUpdate:modelValue":e[135]||(e[135]=_=>r.configFile.data_vectorization_put_chunk_informations_into_context=_),onChange:e[136]||(e[136]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.data_vectorization_put_chunk_informations_into_context]])])])]),c("tr",null,[sdt,c("td",null,[G(c("select",{id:"data_vectorization_method",required:"","onUpdate:modelValue":e[137]||(e[137]=_=>r.configFile.data_vectorization_method=_),onChange:e[138]||(e[138]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},cdt,544),[[Wt,r.configFile.data_vectorization_method]])])]),c("tr",null,[ddt,c("td",udt,[G(c("input",{type:"text",id:"data_vectorization_sentense_transformer_model",required:"","onUpdate:modelValue":e[139]||(e[139]=_=>r.configFile.data_vectorization_sentense_transformer_model=_),onChange:e[140]||(e[140]=_=>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),[[we,r.configFile.data_vectorization_sentense_transformer_model]])])]),c("tr",null,[pdt,c("td",null,[G(c("select",{id:"data_visualization_method",required:"","onUpdate:modelValue":e[141]||(e[141]=_=>r.configFile.data_visualization_method=_),onChange:e[142]||(e[142]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},fdt,544),[[Wt,r.configFile.data_visualization_method]])])]),c("tr",null,[mdt,c("td",null,[c("div",gdt,[G(c("input",{type:"checkbox",id:"data_vectorization_save_db",required:"","onUpdate:modelValue":e[143]||(e[143]=_=>r.configFile.data_vectorization_save_db=_),onChange:e[144]||(e[144]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.data_vectorization_save_db]])])])]),c("tr",null,[bdt,c("td",null,[G(c("input",{id:"data_vectorization_chunk_size","onUpdate:modelValue":e[145]||(e[145]=_=>r.configFile.data_vectorization_chunk_size=_),onChange:e[146]||(e[146]=_=>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),[[we,r.configFile.data_vectorization_chunk_size]]),G(c("input",{"onUpdate:modelValue":e[147]||(e[147]=_=>r.configFile.data_vectorization_chunk_size=_),type:"number",onChange:e[148]||(e[148]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.data_vectorization_chunk_size]])])]),c("tr",null,[Edt,c("td",null,[G(c("input",{id:"data_vectorization_overlap_size","onUpdate:modelValue":e[149]||(e[149]=_=>r.configFile.data_vectorization_overlap_size=_),onChange:e[150]||(e[150]=_=>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),[[we,r.configFile.data_vectorization_overlap_size]]),G(c("input",{"onUpdate:modelValue":e[151]||(e[151]=_=>r.configFile.data_vectorization_overlap_size=_),type:"number",onChange:e[152]||(e[152]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.data_vectorization_overlap_size]])])]),c("tr",null,[ydt,c("td",null,[G(c("input",{id:"data_vectorization_nb_chunks","onUpdate:modelValue":e[153]||(e[153]=_=>r.configFile.data_vectorization_nb_chunks=_),onChange:e[154]||(e[154]=_=>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),[[we,r.configFile.data_vectorization_nb_chunks]]),G(c("input",{"onUpdate:modelValue":e[155]||(e[155]=_=>r.configFile.data_vectorization_nb_chunks=_),type:"number",onChange:e[156]||(e[156]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.data_vectorization_nb_chunks]])])])])]),_:1})],2)]),c("div",vdt,[c("div",Sdt,[c("button",{onClick:e[157]||(e[157]=ge(_=>s.internet_conf_collapsed=!s.internet_conf_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[G(c("div",null,xdt,512),[[Mt,s.internet_conf_collapsed]]),G(c("div",null,wdt,512),[[Mt,!s.internet_conf_collapsed]]),Rdt])]),c("div",{class:ze([{hidden:s.internet_conf_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[Te(o,{title:"Internet search",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Adt,[c("tr",null,[Ndt,c("td",null,[c("div",Odt,[G(c("input",{type:"checkbox",id:"fun_mode",required:"","onUpdate:modelValue":e[158]||(e[158]=_=>r.configFile.activate_internet_search=_),onChange:e[159]||(e[159]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.activate_internet_search]])])])]),c("tr",null,[Idt,c("td",null,[c("div",Mdt,[G(c("input",{type:"checkbox",id:"activate_internet_pages_judgement",required:"","onUpdate:modelValue":e[160]||(e[160]=_=>r.configFile.activate_internet_pages_judgement=_),onChange:e[161]||(e[161]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.activate_internet_pages_judgement]])])])]),c("tr",null,[Ddt,c("td",null,[c("div",kdt,[G(c("input",{type:"checkbox",id:"internet_quick_search",required:"","onUpdate:modelValue":e[162]||(e[162]=_=>r.configFile.internet_quick_search=_),onChange:e[163]||(e[163]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.internet_quick_search]])])])]),c("tr",null,[Ldt,c("td",null,[c("div",Pdt,[G(c("input",{type:"checkbox",id:"internet_activate_search_decision",required:"","onUpdate:modelValue":e[164]||(e[164]=_=>r.configFile.internet_activate_search_decision=_),onChange:e[165]||(e[165]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.internet_activate_search_decision]])])])]),c("tr",null,[Udt,c("td",null,[c("div",Fdt,[G(c("input",{id:"internet_vectorization_chunk_size","onUpdate:modelValue":e[166]||(e[166]=_=>r.configFile.internet_vectorization_chunk_size=_),onChange:e[167]||(e[167]=_=>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),[[we,r.configFile.internet_vectorization_chunk_size]]),G(c("input",{"onUpdate:modelValue":e[168]||(e[168]=_=>r.configFile.internet_vectorization_chunk_size=_),type:"number",onChange:e[169]||(e[169]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.internet_vectorization_chunk_size]])])])]),c("tr",null,[Bdt,c("td",null,[c("div",Gdt,[G(c("input",{id:"internet_vectorization_overlap_size","onUpdate:modelValue":e[170]||(e[170]=_=>r.configFile.internet_vectorization_overlap_size=_),onChange:e[171]||(e[171]=_=>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),[[we,r.configFile.internet_vectorization_overlap_size]]),G(c("input",{"onUpdate:modelValue":e[172]||(e[172]=_=>r.configFile.internet_vectorization_overlap_size=_),type:"number",onChange:e[173]||(e[173]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.internet_vectorization_overlap_size]])])])]),c("tr",null,[Vdt,c("td",null,[c("div",zdt,[G(c("input",{id:"internet_vectorization_nb_chunks","onUpdate:modelValue":e[174]||(e[174]=_=>r.configFile.internet_vectorization_nb_chunks=_),onChange:e[175]||(e[175]=_=>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),[[we,r.configFile.internet_vectorization_nb_chunks]]),G(c("input",{"onUpdate:modelValue":e[176]||(e[176]=_=>r.configFile.internet_vectorization_nb_chunks=_),type:"number",onChange:e[177]||(e[177]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.internet_vectorization_nb_chunks]])])])]),c("tr",null,[Hdt,c("td",null,[c("div",qdt,[G(c("input",{id:"internet_nb_search_pages","onUpdate:modelValue":e[178]||(e[178]=_=>r.configFile.internet_nb_search_pages=_),onChange:e[179]||(e[179]=_=>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),[[we,r.configFile.internet_nb_search_pages]]),G(c("input",{"onUpdate:modelValue":e[180]||(e[180]=_=>r.configFile.internet_nb_search_pages=_),type:"number",onChange:e[181]||(e[181]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.internet_nb_search_pages]])])])])])]),_:1})],2)]),c("div",Ydt,[c("div",$dt,[c("button",{onClick:e[182]||(e[182]=ge(_=>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"},[G(c("div",null,Kdt,512),[[Mt,s.servers_conf_collapsed]]),G(c("div",null,Qdt,512),[[Mt,!s.servers_conf_collapsed]]),Xdt])]),c("div",{class:ze([{hidden:s.servers_conf_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[Te(o,{title:"Default services selection",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Zdt,[c("tr",null,[Jdt,c("td",eut,[G(c("select",{id:"active_tts_service",required:"","onUpdate:modelValue":e[183]||(e[183]=_=>r.configFile.active_tts_service=_),onChange:e[184]||(e[184]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},rut,544),[[Wt,r.configFile.active_tts_service]])])]),c("tr",null,[out,c("td",aut,[G(c("select",{id:"active_stt_service",required:"","onUpdate:modelValue":e[185]||(e[185]=_=>r.configFile.active_stt_service=_),onChange:e[186]||(e[186]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},uut,544),[[Wt,r.configFile.active_stt_service]])])]),put,c("tr",null,[_ut,c("td",hut,[G(c("select",{id:"active_tti_service",required:"","onUpdate:modelValue":e[187]||(e[187]=_=>r.configFile.active_tti_service=_),onChange:e[188]||(e[188]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},Sut,544),[[Wt,r.configFile.active_tti_service]])])]),c("tr",null,[Tut,c("td",xut,[G(c("select",{id:"active_ttm_service",required:"","onUpdate:modelValue":e[189]||(e[189]=_=>r.configFile.active_ttm_service=_),onChange:e[190]||(e[190]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},Rut,544),[[Wt,r.configFile.active_ttm_service]])])])])]),_:1}),Te(o,{title:"TTI settings",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Aut,[c("tr",null,[Nut,c("td",null,[c("div",Out,[G(c("input",{type:"checkbox",id:"use_negative_prompt",required:"","onUpdate:modelValue":e[191]||(e[191]=_=>r.configFile.use_negative_prompt=_),onChange:e[192]||(e[192]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.use_negative_prompt]])])])]),c("tr",null,[Iut,c("td",null,[c("div",Mut,[G(c("input",{type:"checkbox",id:"use_ai_generated_negative_prompt",required:"","onUpdate:modelValue":e[193]||(e[193]=_=>r.configFile.use_ai_generated_negative_prompt=_),onChange:e[194]||(e[194]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.use_ai_generated_negative_prompt]])])])]),c("tr",null,[Dut,c("td",null,[c("div",kut,[G(c("input",{type:"text",id:"negative_prompt_generation_prompt",required:"","onUpdate:modelValue":e[195]||(e[195]=_=>r.configFile.negative_prompt_generation_prompt=_),onChange:e[196]||(e[196]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.negative_prompt_generation_prompt]])])])]),c("tr",null,[Lut,c("td",null,[c("div",Put,[G(c("input",{type:"text",id:"default_negative_prompt",required:"","onUpdate:modelValue":e[197]||(e[197]=_=>r.configFile.default_negative_prompt=_),onChange:e[198]||(e[198]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.default_negative_prompt]])])])])])]),_:1}),Te(o,{title:"Full Audio settings",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Uut,[c("tr",null,[Fut,c("td",But,[G(c("input",{type:"number",step:"1",id:"stt_listening_threshold",required:"","onUpdate:modelValue":e[199]||(e[199]=_=>r.configFile.stt_listening_threshold=_),onChange:e[200]||(e[200]=_=>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),[[we,r.configFile.stt_listening_threshold]])])]),c("tr",null,[Gut,c("td",Vut,[G(c("input",{type:"number",step:"1",id:"stt_silence_duration",required:"","onUpdate:modelValue":e[201]||(e[201]=_=>r.configFile.stt_silence_duration=_),onChange:e[202]||(e[202]=_=>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),[[we,r.configFile.stt_silence_duration]])])]),c("tr",null,[zut,c("td",Hut,[G(c("input",{type:"number",step:"1",id:"stt_sound_threshold_percentage",required:"","onUpdate:modelValue":e[203]||(e[203]=_=>r.configFile.stt_sound_threshold_percentage=_),onChange:e[204]||(e[204]=_=>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),[[we,r.configFile.stt_sound_threshold_percentage]])])]),c("tr",null,[qut,c("td",Yut,[G(c("input",{type:"number",step:"1",id:"stt_gain",required:"","onUpdate:modelValue":e[205]||(e[205]=_=>r.configFile.stt_gain=_),onChange:e[206]||(e[206]=_=>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),[[we,r.configFile.stt_gain]])])]),c("tr",null,[$ut,c("td",Wut,[G(c("input",{type:"number",step:"1",id:"stt_rate",required:"","onUpdate:modelValue":e[207]||(e[207]=_=>r.configFile.stt_rate=_),onChange:e[208]||(e[208]=_=>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),[[we,r.configFile.stt_rate]])])]),c("tr",null,[Kut,c("td",jut,[G(c("input",{type:"number",step:"1",id:"stt_channels",required:"","onUpdate:modelValue":e[209]||(e[209]=_=>r.configFile.stt_channels=_),onChange:e[210]||(e[210]=_=>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),[[we,r.configFile.stt_channels]])])]),c("tr",null,[Qut,c("td",Xut,[G(c("input",{type:"number",step:"1",id:"stt_buffer_size",required:"","onUpdate:modelValue":e[211]||(e[211]=_=>r.configFile.stt_buffer_size=_),onChange:e[212]||(e[212]=_=>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),[[we,r.configFile.stt_buffer_size]])])]),c("tr",null,[Zut,c("td",null,[c("div",Jut,[G(c("input",{type:"checkbox",id:"stt_activate_word_detection",required:"","onUpdate:modelValue":e[213]||(e[213]=_=>r.configFile.stt_activate_word_detection=_),onChange:e[214]||(e[214]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.stt_activate_word_detection]])])])]),c("tr",null,[ept,c("td",null,[c("div",tpt,[G(c("input",{type:"text",id:"stt_word_detection_file",required:"","onUpdate:modelValue":e[215]||(e[215]=_=>r.configFile.stt_word_detection_file=_),onChange:e[216]||(e[216]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.stt_word_detection_file]])])])])])]),_:1}),Te(o,{title:"Audio devices settings",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",npt,[c("tr",null,[ipt,c("td",spt,[G(c("select",{id:"stt_input_device",required:"","onUpdate:modelValue":e[217]||(e[217]=_=>r.configFile.stt_input_device=_),onChange:e[218]||(e[218]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),A($e,null,lt(s.snd_input_devices,(_,m)=>(w(),A("option",{key:_,value:s.snd_input_devices_indexes[m]},he(_),9,rpt))),128))],544),[[Wt,r.configFile.stt_input_device]])])]),c("tr",null,[opt,c("td",apt,[G(c("select",{id:"tts_output_device",required:"","onUpdate:modelValue":e[219]||(e[219]=_=>r.configFile.tts_output_device=_),onChange:e[220]||(e[220]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),A($e,null,lt(s.snd_output_devices,(_,m)=>(w(),A("option",{key:_,value:s.snd_output_devices_indexes[m]},he(_),9,lpt))),128))],544),[[Wt,r.configFile.tts_output_device]])])])])]),_:1}),Te(o,{title:"Lollms service",is_shrunk:!0,is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",cpt,[c("tr",null,[dpt,c("td",upt,[G(c("input",{type:"text",id:"host",required:"","onUpdate:modelValue":e[221]||(e[221]=_=>r.configFile.host=_),onChange:e[222]||(e[222]=_=>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),[[we,r.configFile.host]])])]),c("tr",null,[ppt,c("td",_pt,[G(c("input",{type:"text",id:"lollms_access_keys",required:"","onUpdate:modelValue":e[223]||(e[223]=_=>r.configFile.lollms_access_keys=_),onChange:e[224]||(e[224]=_=>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),[[we,r.configFile.lollms_access_keys]])])]),c("tr",null,[hpt,c("td",fpt,[G(c("input",{type:"number",step:"1",id:"port",required:"","onUpdate:modelValue":e[225]||(e[225]=_=>r.configFile.port=_),onChange:e[226]||(e[226]=_=>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),[[we,r.configFile.port]])])]),c("tr",null,[mpt,c("td",gpt,[G(c("input",{type:"checkbox",id:"headless_server_mode",required:"","onUpdate:modelValue":e[227]||(e[227]=_=>r.configFile.headless_server_mode=_),onChange:e[228]||(e[228]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Je,r.configFile.headless_server_mode]])])]),c("tr",null,[bpt,c("td",Ept,[G(c("input",{type:"checkbox",id:"activate_lollms_server",required:"","onUpdate:modelValue":e[229]||(e[229]=_=>r.configFile.activate_lollms_server=_),onChange:e[230]||(e[230]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Je,r.configFile.activate_lollms_server]])])]),c("tr",null,[ypt,c("td",vpt,[G(c("input",{type:"checkbox",id:"activate_ollama_emulator",required:"","onUpdate:modelValue":e[231]||(e[231]=_=>r.configFile.activate_ollama_emulator=_),onChange:e[232]||(e[232]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Je,r.configFile.activate_ollama_emulator]])])]),c("tr",null,[Spt,c("td",Tpt,[G(c("input",{type:"checkbox",id:"activate_openai_emulator",required:"","onUpdate:modelValue":e[233]||(e[233]=_=>r.configFile.activate_openai_emulator=_),onChange:e[234]||(e[234]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Je,r.configFile.activate_openai_emulator]])])]),c("tr",null,[xpt,c("td",Cpt,[G(c("input",{type:"checkbox",id:"activate_mistralai_emulator",required:"","onUpdate:modelValue":e[235]||(e[235]=_=>r.configFile.activate_mistralai_emulator=_),onChange:e[236]||(e[236]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Je,r.configFile.activate_mistralai_emulator]])])])])]),_:1}),Te(o,{title:"STT services",is_shrunk:!0,is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[Te(o,{title:"Browser Audio STT",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",wpt,[c("tr",null,[Rpt,c("td",null,[c("div",Apt,[G(c("input",{type:"checkbox",id:"activate_audio_infos",required:"","onUpdate:modelValue":e[237]||(e[237]=_=>r.configFile.activate_audio_infos=_),onChange:e[238]||(e[238]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.activate_audio_infos]])])])]),c("tr",null,[Npt,c("td",null,[c("div",Opt,[G(c("input",{type:"checkbox",id:"audio_auto_send_input",required:"","onUpdate:modelValue":e[239]||(e[239]=_=>r.configFile.audio_auto_send_input=_),onChange:e[240]||(e[240]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.audio_auto_send_input]])])])]),c("tr",null,[Ipt,c("td",null,[G(c("input",{id:"audio_silenceTimer","onUpdate:modelValue":e[241]||(e[241]=_=>r.configFile.audio_silenceTimer=_),onChange:e[242]||(e[242]=_=>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),[[we,r.configFile.audio_silenceTimer]]),G(c("input",{"onUpdate:modelValue":e[243]||(e[243]=_=>r.configFile.audio_silenceTimer=_),onChange:e[244]||(e[244]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.audio_silenceTimer]])])]),c("tr",null,[Mpt,c("td",null,[G(c("select",{id:"audio_in_language","onUpdate:modelValue":e[245]||(e[245]=_=>r.configFile.audio_in_language=_),onChange:e[246]||(e[246]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),A($e,null,lt(r.audioLanguages,_=>(w(),A("option",{key:_.code,value:_.code},he(_.name),9,Dpt))),128))],544),[[Wt,r.configFile.audio_in_language]])])])])]),_:1}),Te(o,{title:"Whisper audio transcription",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",kpt,[c("tr",null,[Lpt,c("td",null,[c("div",Ppt,[G(c("input",{type:"checkbox",id:"whisper_activate",required:"","onUpdate:modelValue":e[247]||(e[247]=_=>r.configFile.whisper_activate=_),onChange:e[248]||(e[248]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.whisper_activate]])])])]),c("tr",null,[Upt,c("td",null,[c("div",Fpt,[G(c("select",{id:"whisper_model","onUpdate:modelValue":e[249]||(e[249]=_=>r.configFile.whisper_model=_),onChange:e[250]||(e[250]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),A($e,null,lt(r.whisperModels,_=>(w(),A("option",{key:_,value:_},he(_),9,Bpt))),128))],544),[[Wt,r.configFile.whisper_model]])])])])])]),_:1}),Te(o,{title:"Open AI Whisper audio transcription",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Gpt,[c("tr",null,[Vpt,c("td",null,[c("div",zpt,[G(c("input",{type:"text",id:"openai_whisper_key",required:"","onUpdate:modelValue":e[251]||(e[251]=_=>r.configFile.openai_whisper_key=_),onChange:e[252]||(e[252]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.openai_whisper_key]])])])]),c("tr",null,[Hpt,c("td",null,[c("div",qpt,[G(c("select",{id:"openai_whisper_model","onUpdate:modelValue":e[253]||(e[253]=_=>r.configFile.openai_whisper_model=_),onChange:e[254]||(e[254]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),A($e,null,lt(r.openaiWhisperModels,_=>(w(),A("option",{key:_,value:_},he(_),9,Ypt))),128))],544),[[Wt,r.configFile.openai_whisper_model]])])])])])]),_:1})]),_:1}),Te(o,{title:"TTS services",is_shrunk:!0,is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[Te(o,{title:"Browser Audio TTS",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",$pt,[c("tr",null,[Wpt,c("td",null,[c("div",Kpt,[G(c("input",{type:"checkbox",id:"auto_speak",required:"","onUpdate:modelValue":e[255]||(e[255]=_=>r.configFile.auto_speak=_),onChange:e[256]||(e[256]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.auto_speak]])])])]),c("tr",null,[jpt,c("td",null,[G(c("input",{id:"audio_pitch","onUpdate:modelValue":e[257]||(e[257]=_=>r.configFile.audio_pitch=_),onChange:e[258]||(e[258]=_=>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),[[we,r.configFile.audio_pitch]]),G(c("input",{"onUpdate:modelValue":e[259]||(e[259]=_=>r.configFile.audio_pitch=_),onChange:e[260]||(e[260]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.audio_pitch]])])]),c("tr",null,[Qpt,c("td",null,[G(c("select",{id:"audio_out_voice","onUpdate:modelValue":e[261]||(e[261]=_=>r.configFile.audio_out_voice=_),onChange:e[262]||(e[262]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),A($e,null,lt(s.audioVoices,_=>(w(),A("option",{key:_.name,value:_.name},he(_.name),9,Xpt))),128))],544),[[Wt,r.configFile.audio_out_voice]])])])])]),_:1}),Te(o,{title:"XTTS service",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Zpt,[c("tr",null,[Jpt,c("td",null,[c("div",e_t,[G(c("select",{"onUpdate:modelValue":e[263]||(e[263]=_=>r.xtts_current_language=_),onChange:e[264]||(e[264]=_=>s.settingsChanged=!0)},[(w(!0),A($e,null,lt(s.voice_languages,(_,m)=>(w(),A("option",{key:m,value:_},he(m),9,t_t))),128))],544),[[Wt,r.xtts_current_language]])])])]),c("tr",null,[n_t,c("td",null,[c("div",i_t,[G(c("select",{"onUpdate:modelValue":e[265]||(e[265]=_=>r.xtts_current_voice=_),onChange:e[266]||(e[266]=_=>s.settingsChanged=!0)},[(w(!0),A($e,null,lt(s.voices,_=>(w(),A("option",{key:_,value:_},he(_),9,s_t))),128))],544),[[Wt,r.xtts_current_voice]])])])]),c("tr",null,[r_t,c("td",null,[c("div",o_t,[G(c("input",{type:"checkbox",id:"auto_read",required:"","onUpdate:modelValue":e[267]||(e[267]=_=>r.configFile.auto_read=_),onChange:e[268]||(e[268]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.auto_read]])])])]),c("tr",null,[a_t,c("td",null,[c("div",l_t,[G(c("input",{type:"text",id:"xtts_stream_chunk_size",required:"","onUpdate:modelValue":e[269]||(e[269]=_=>r.configFile.xtts_stream_chunk_size=_),onChange:e[270]||(e[270]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.xtts_stream_chunk_size]])])])]),c("tr",null,[c_t,c("td",null,[c("div",d_t,[G(c("input",{type:"number",id:"xtts_temperature",required:"","onUpdate:modelValue":e[271]||(e[271]=_=>r.configFile.xtts_temperature=_),onChange:e[272]||(e[272]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600",step:"0.01"},null,544),[[we,r.configFile.xtts_temperature,void 0,{number:!0}]])])])]),c("tr",null,[u_t,c("td",null,[c("div",p_t,[G(c("input",{type:"number",id:"xtts_length_penalty",required:"","onUpdate:modelValue":e[273]||(e[273]=_=>r.configFile.xtts_length_penalty=_),onChange:e[274]||(e[274]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600",step:"0.1"},null,544),[[we,r.configFile.xtts_length_penalty,void 0,{number:!0}]])])])]),c("tr",null,[__t,c("td",null,[c("div",h_t,[G(c("input",{type:"number",id:"xtts_repetition_penalty",required:"","onUpdate:modelValue":e[275]||(e[275]=_=>r.configFile.xtts_repetition_penalty=_),onChange:e[276]||(e[276]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600",step:"0.1"},null,544),[[we,r.configFile.xtts_repetition_penalty,void 0,{number:!0}]])])])]),c("tr",null,[f_t,c("td",null,[c("div",m_t,[G(c("input",{type:"number",id:"xtts_top_k",required:"","onUpdate:modelValue":e[277]||(e[277]=_=>r.configFile.xtts_top_k=_),onChange:e[278]||(e[278]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.xtts_top_k,void 0,{number:!0}]])])])]),c("tr",null,[g_t,c("td",null,[c("div",b_t,[G(c("input",{type:"number",id:"xtts_top_p",required:"","onUpdate:modelValue":e[279]||(e[279]=_=>r.configFile.xtts_top_p=_),onChange:e[280]||(e[280]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.xtts_top_p,void 0,{number:!0}]])])])]),c("tr",null,[E_t,c("td",null,[c("div",y_t,[G(c("input",{type:"number",id:"xtts_speed",required:"","onUpdate:modelValue":e[281]||(e[281]=_=>r.configFile.xtts_speed=_),onChange:e[282]||(e[282]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600",step:"0.1"},null,544),[[we,r.configFile.xtts_speed,void 0,{number:!0}]])])])]),c("tr",null,[v_t,c("td",null,[c("div",S_t,[G(c("input",{type:"checkbox",id:"enable_text_splitting","onUpdate:modelValue":e[283]||(e[283]=_=>r.configFile.enable_text_splitting=_),onChange:e[284]||(e[284]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.enable_text_splitting]])])])])])]),_:1}),Te(o,{title:"Open AI TTS service",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",T_t,[c("tr",null,[x_t,c("td",null,[c("div",C_t,[G(c("input",{type:"text",id:"openai_tts_key",required:"","onUpdate:modelValue":e[285]||(e[285]=_=>r.configFile.openai_tts_key=_),onChange:e[286]||(e[286]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.openai_tts_key]])])])]),c("tr",null,[w_t,c("td",null,[c("div",R_t,[G(c("select",{"onUpdate:modelValue":e[287]||(e[287]=_=>r.configFile.openai_tts_model=_),onChange:e[288]||(e[288]=_=>s.settingsChanged=!0)},O_t,544),[[Wt,r.configFile.openai_tts_model]])])])]),c("tr",null,[I_t,c("td",null,[c("div",M_t,[G(c("select",{"onUpdate:modelValue":e[289]||(e[289]=_=>r.configFile.openai_tts_voice=_),onChange:e[290]||(e[290]=_=>s.settingsChanged=!0)},F_t,544),[[Wt,r.configFile.openai_tts_voice]])])])])])]),_:1})]),_:1}),Te(o,{title:"TTI services",is_shrunk:!0,is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[Te(o,{title:"Stable diffusion service",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",B_t,[c("tr",null,[G_t,c("td",null,[c("div",V_t,[G(c("input",{type:"checkbox",id:"enable_sd_service",required:"","onUpdate:modelValue":e[291]||(e[291]=_=>r.configFile.enable_sd_service=_),onChange:e[292]||(e[292]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.enable_sd_service]])])]),c("td",null,[c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[293]||(e[293]=_=>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"))},H_t)])]),c("tr",null,[q_t,c("td",null,[c("div",Y_t,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[294]||(e[294]=(..._)=>r.reinstallSDService&&r.reinstallSDService(..._))},"install sd service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[295]||(e[295]=(..._)=>r.upgradeSDService&&r.upgradeSDService(..._))},"upgrade sd service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[296]||(e[296]=(..._)=>r.startSDService&&r.startSDService(..._))},"start sd service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[297]||(e[297]=(..._)=>r.showSD&&r.showSD(..._))},"show sd ui"),$_t])]),c("td",null,[c("div",W_t,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[298]||(e[298]=(..._)=>r.reinstallSDService&&r.reinstallSDService(..._))},"install sd service")])])]),c("tr",null,[K_t,c("td",null,[c("div",j_t,[G(c("input",{type:"text",id:"sd_base_url",required:"","onUpdate:modelValue":e[299]||(e[299]=_=>r.configFile.sd_base_url=_),onChange:e[300]||(e[300]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.sd_base_url]])])])])])]),_:1}),Te(o,{title:"Diffusers service",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Q_t,[c("tr",null,[X_t,c("td",null,[c("div",Z_t,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[301]||(e[301]=(..._)=>r.reinstallDiffusersService&&r.reinstallDiffusersService(..._))},"install diffusers service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[302]||(e[302]=(..._)=>r.upgradeDiffusersService&&r.upgradeDiffusersService(..._))},"upgrade diffusers service"),J_t])])]),c("tr",null,[eht,c("td",null,[c("div",tht,[G(c("input",{type:"text",id:"diffusers_model",required:"","onUpdate:modelValue":e[303]||(e[303]=_=>r.configFile.diffusers_model=_),onChange:e[304]||(e[304]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.diffusers_model]])])]),nht])])]),_:1}),Te(o,{title:"Midjourney",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",iht,[c("tr",null,[sht,c("td",null,[c("div",rht,[G(c("input",{type:"text",id:"midjourney_key",required:"","onUpdate:modelValue":e[305]||(e[305]=_=>r.configFile.midjourney_key=_),onChange:e[306]||(e[306]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.midjourney_key]])])])]),c("tr",null,[oht,c("td",null,[c("div",aht,[G(c("input",{type:"number",min:"10",max:"2048",id:"midjourney_timeout",required:"","onUpdate:modelValue":e[307]||(e[307]=_=>r.configFile.midjourney_timeout=_),onChange:e[308]||(e[308]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.midjourney_timeout]])])])]),c("tr",null,[lht,c("td",null,[c("div",cht,[G(c("input",{type:"number",min:"0",max:"2048",id:"midjourney_retries",required:"","onUpdate:modelValue":e[309]||(e[309]=_=>r.configFile.midjourney_retries=_),onChange:e[310]||(e[310]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.midjourney_retries]])])])])])]),_:1}),Te(o,{title:"Dall-E",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",dht,[c("tr",null,[uht,c("td",null,[c("div",pht,[G(c("input",{type:"text",id:"dall_e_key",required:"","onUpdate:modelValue":e[311]||(e[311]=_=>r.configFile.dall_e_key=_),onChange:e[312]||(e[312]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.dall_e_key]])])])]),c("tr",null,[_ht,c("td",null,[c("div",hht,[G(c("select",{"onUpdate:modelValue":e[313]||(e[313]=_=>r.configFile.dall_e_generation_engine=_),onChange:e[314]||(e[314]=_=>s.settingsChanged=!0)},ght,544),[[Wt,r.configFile.dall_e_generation_engine]])])])])])]),_:1}),Te(o,{title:"ComfyUI service",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",bht,[c("tr",null,[Eht,c("td",null,[c("div",yht,[G(c("input",{type:"checkbox",id:"enable_comfyui_service",required:"","onUpdate:modelValue":e[315]||(e[315]=_=>r.configFile.enable_comfyui_service=_),onChange:e[316]||(e[316]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.enable_comfyui_service]])])]),c("td",null,[c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[317]||(e[317]=_=>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"))},Sht)])]),c("tr",null,[Tht,c("td",null,[c("div",xht,[G(c("select",{id:"comfyui_model",required:"","onUpdate:modelValue":e[318]||(e[318]=_=>r.configFile.comfyui_model=_),onChange:e[319]||(e[319]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),A($e,null,lt(s.comfyui_models,(_,m)=>(w(),A("option",{key:_,value:_},he(_),9,Cht))),128))],544),[[Wt,r.configFile.comfyui_model]])])])]),c("tr",null,[wht,c("td",null,[c("div",Rht,[G(c("input",{type:"text",id:"comfyui_model",required:"","onUpdate:modelValue":e[320]||(e[320]=_=>r.configFile.comfyui_model=_),onChange:e[321]||(e[321]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.comfyui_model]])])]),c("td",null,[c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[322]||(e[322]=_=>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"))},Nht)])]),c("tr",null,[Oht,c("td",null,[c("div",Iht,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[323]||(e[323]=(..._)=>r.reinstallComfyUIService&&r.reinstallComfyUIService(..._))},"install comfyui service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[324]||(e[324]=(..._)=>r.upgradeComfyUIService&&r.upgradeComfyUIService(..._))},"upgrade comfyui service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[325]||(e[325]=(..._)=>r.startComfyUIService&&r.startComfyUIService(..._))},"start comfyui service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[326]||(e[326]=(..._)=>r.showComfyui&&r.showComfyui(..._))},"show comfyui"),Mht])])]),c("tr",null,[Dht,c("td",null,[c("div",kht,[G(c("input",{type:"text",id:"comfyui_base_url",required:"","onUpdate:modelValue":e[327]||(e[327]=_=>r.configFile.comfyui_base_url=_),onChange:e[328]||(e[328]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.comfyui_base_url]])])])])])]),_:1})]),_:1}),Te(o,{title:"TTT services",is_shrunk:!0,is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[Te(o,{title:"Ollama service",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Lht,[c("tr",null,[Pht,c("td",null,[c("div",Uht,[G(c("input",{type:"checkbox",id:"enable_ollama_service",required:"","onUpdate:modelValue":e[329]||(e[329]=_=>r.configFile.enable_ollama_service=_),onChange:e[330]||(e[330]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.enable_ollama_service]])])]),c("td",null,[c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[331]||(e[331]=_=>this.$store.state.messageBox.showMessage(`Activates ollama service. The service will be automatically loaded at startup alowing you to use the ollama binding. +You need to apply changes before you leave, or else.`,"Apply configuration","Cancel")&&this.applyConfiguration(),!1}},P=n=>(yo("data-v-5e34a141"),n=n(),vo(),n),Yrt={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"},$rt={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"},Wrt={key:0,class:"flex gap-3 flex-1 items-center duration-75"},Krt=P(()=>c("i",{"data-feather":"x"},null,-1)),jrt=[Krt],Qrt=P(()=>c("i",{"data-feather":"check"},null,-1)),Xrt=[Qrt],Zrt={key:1,class:"flex gap-3 flex-1 items-center"},Jrt=P(()=>c("i",{"data-feather":"refresh-ccw"},null,-1)),eot=[Jrt],tot=P(()=>c("i",{"data-feather":"list"},null,-1)),not=[tot],iot={class:"flex gap-3 flex-1 items-center justify-end"},sot=P(()=>c("i",{"data-feather":"trash-2"},null,-1)),rot=[sot],oot=P(()=>c("i",{"data-feather":"refresh-ccw"},null,-1)),aot=[oot],lot=P(()=>c("i",{"data-feather":"arrow-up-circle"},null,-1)),cot=P(()=>c("i",{"data-feather":"alert-circle"},null,-1)),dot={class:"flex gap-3 items-center"},uot={key:0,class:"flex gap-3 items-center"},pot=P(()=>c("div",{class:"flex flex-row"},[c("p",{class:"text-green-600 font-bold hover:text-green-300 ml-4 pl-4 mr-4 pr-4"},"Apply changes:"),c("i",{"data-feather":"check"})],-1)),_ot=[pot],hot=P(()=>c("div",{class:"flex flex-row"},[c("p",{class:"text-red-600 font-bold hover:text-red-300 ml-4 pl-4 mr-4 pr-4"},"Cancel changes:"),c("i",{"data-feather":"x"})],-1)),fot=[hot],mot={key:1,role:"status"},got=P(()=>c("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"},[c("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"}),c("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)),bot=P(()=>c("span",{class:"sr-only"},"Loading...",-1)),Eot={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"},yot={class:"flex flex-row p-3"},vot=P(()=>c("i",{"data-feather":"chevron-right"},null,-1)),Sot=[vot],Tot=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),xot=[Tot],Cot=P(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," System status",-1)),wot=P(()=>c("div",{class:"mr-2"},"|",-1)),Rot={class:"text-base font-semibold cursor-pointer select-none items-center"},Aot={class:"flex gap-2 items-center"},Not={key:0},Oot=["src"],Iot={class:"font-bold font-large text-lg"},Mot={key:1},Dot={class:"flex gap-2 items-center"},kot=["src"],Lot={class:"font-bold font-large text-lg"},Pot=P(()=>c("i",{"data-feather":"cpu",title:"CPU Ram",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),Uot={class:"font-bold font-large text-lg"},Fot=P(()=>c("i",{"data-feather":"hard-drive",title:"Hard drive",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),Bot={class:"font-bold font-large text-lg"},Got={class:"mb-2"},Vot=P(()=>c("label",{class:"flex items-center gap-1 ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},[c("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[c("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"})]),et(" CPU Ram usage: ")],-1)),zot={class:"flex flex-col mx-2"},Hot=P(()=>c("b",null,"Avaliable ram: ",-1)),qot=P(()=>c("b",null,"Ram usage: ",-1)),Yot={class:"p-2"},$ot={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},Wot={class:"mb-2"},Kot=P(()=>c("label",{class:"flex items-center gap-1 ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},[c("i",{"data-feather":"hard-drive",class:"w-5 h-5"}),et(" Disk usage: ")],-1)),jot={class:"flex flex-col mx-2"},Qot=P(()=>c("b",null,"Avaliable disk space: ",-1)),Xot=P(()=>c("b",null,"Disk usage: ",-1)),Zot={class:"p-2"},Jot={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},eat={class:"flex items-center gap-1 ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},tat=["src"],nat={class:"flex flex-col mx-2"},iat=P(()=>c("b",null,"Model: ",-1)),sat=P(()=>c("b",null,"Avaliable vram: ",-1)),rat=P(()=>c("b",null,"GPU usage: ",-1)),oat={class:"p-2"},aat={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},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=P(()=>c("i",{"data-feather":"chevron-right"},null,-1)),uat=[dat],pat=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),_at=[pat],hat=P(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Main configurations",-1)),fat={class:"flex flex-col mb-2 px-3 pb-2"},mat={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"},gat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"app_custom_logo",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Application logo:")],-1)),bat={for:"logo-upload"},Eat=["src"],yat={style:{width:"10%"}},vat=P(()=>c("i",{"data-feather":"x"},null,-1)),Sat=[vat],Tat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"hardware_mode",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Hardware mode:")],-1)),xat={class:"text-center items-center"},Cat={class:"flex flex-row"},wat=P(()=>c("option",{value:"cpu"},"CPU",-1)),Rat=P(()=>c("option",{value:"cpu-noavx"},"CPU (No AVX)",-1)),Aat=P(()=>c("option",{value:"nvidia-tensorcores"},"NVIDIA (Tensor Cores)",-1)),Nat=P(()=>c("option",{value:"nvidia"},"NVIDIA",-1)),Oat=P(()=>c("option",{value:"amd-noavx"},"AMD (No AVX)",-1)),Iat=P(()=>c("option",{value:"amd"},"AMD",-1)),Mat=P(()=>c("option",{value:"apple-intel"},"Apple Intel",-1)),Dat=P(()=>c("option",{value:"apple-silicon"},"Apple Silicon",-1)),kat=[wat,Rat,Aat,Nat,Oat,Iat,Mat,Dat],Lat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"discussion_db_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Database path:")],-1)),Pat={style:{width:"100%"}},Uat=P(()=>c("td",{style:{"min-width":"200px"}},[c("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)),Fat={class:"flex flex-row"},Bat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"auto_show_browser",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto show browser:")],-1)),Gat={class:"flex flex-row"},Vat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"activate_debug",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate debug mode:")],-1)),zat={class:"flex flex-row"},Hat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"debug_show_final_full_prompt",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Show final full prompt in console:")],-1)),qat={class:"flex flex-row"},Yat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"debug_show_chunks",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Show chunks in console:")],-1)),$at={class:"flex flex-row"},Wat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"debug_log_file_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Debug file path:")],-1)),Kat={class:"flex flex-row"},jat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"show_news_panel",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Show news panel:")],-1)),Qat={class:"flex flex-row"},Xat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"auto_save",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto save:")],-1)),Zat={class:"flex flex-row"},Jat=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"auto_update",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto update:")],-1)),elt={class:"flex flex-row"},tlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"auto_update",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto title:")],-1)),nlt={class:"flex flex-row"},ilt={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"},slt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"start_header_id_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Start header id template:")],-1)),rlt=P(()=>c("option",{value:"lollms"},"Lollms communication template",-1)),olt=P(()=>c("option",{value:"lollms_simplified"},"Lollms simplified communication template",-1)),alt=P(()=>c("option",{value:"llama3"},"LLama3 communication template",-1)),llt=P(()=>c("option",{value:"mistral"},"Mistral communication template",-1)),clt=[rlt,olt,alt,llt],dlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"start_header_id_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Start header id template:")],-1)),ult=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"end_header_id_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"End header id template:")],-1)),plt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"start_user_header_id_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Start user header id template:")],-1)),_lt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"end_user_header_id_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"End user header id template:")],-1)),hlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"end_user_message_id_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"End user message id template:")],-1)),flt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"start_ai_header_id_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Start ai header id template:")],-1)),mlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"end_ai_header_id_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"End ai header id template:")],-1)),glt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"end_ai_message_id_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"End ai message id template:")],-1)),blt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"separator_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Separator template:")],-1)),Elt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"system_message_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"System template:")],-1)),ylt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"full_template",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Full template:")],-1)),vlt=["innerHTML"],Slt={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"},Tlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"user_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"User name:")],-1)),xlt={style:{width:"100%"}},Clt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"user_description",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"User description:")],-1)),wlt={style:{width:"100%"}},Rlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"use_user_informations_in_discussion",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use user description in discussion:")],-1)),Alt={style:{width:"100%"}},Nlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"use_model_name_in_discussions",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use model name in discussion:")],-1)),Olt={style:{width:"100%"}},Ilt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"user_avatar",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"User avatar:")],-1)),Mlt={for:"avatar-upload"},Dlt=["src"],klt={style:{width:"10%"}},Llt=P(()=>c("i",{"data-feather":"x"},null,-1)),Plt=[Llt],Ult=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"use_user_name_in_discussions",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use User Name in discussions:")],-1)),Flt={class:"flex flex-row"},Blt=P(()=>c("td",{style:{"min-width":"200px"}},[c("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)),Glt={style:{width:"100%"}},Vlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"max_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)),zlt={style:{width:"100%"}},Hlt={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"},qlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"turn_on_code_execution",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"turn on code execution:")],-1)),Ylt={style:{width:"100%"}},$lt=P(()=>c("td",{style:{"min-width":"200px"}},[c("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)),Wlt={style:{width:"100%"}},Klt=P(()=>c("td",{style:{"min-width":"200px"}},[c("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)),jlt={style:{width:"100%"}},Qlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"turn_on_open_file_validation",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"turn on open file/folder validation:")],-1)),Xlt={style:{width:"100%"}},Zlt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"turn_on_send_file_validation",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"turn on send file validation:")],-1)),Jlt={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"},tct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"activate_skills_lib",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate Skills library:")],-1)),nct={class:"flex flex-row"},ict=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"discussion_db_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Skills library database name:")],-1)),sct={style:{width:"100%"}},rct={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"},oct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"pdf_latex_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"PDF LaTeX path:")],-1)),act={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"},cct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"positive_boost",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Positive Boost:")],-1)),dct={class:"flex flex-row"},uct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"negative_boost",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Negative Boost:")],-1)),pct={class:"flex flex-row"},_ct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"fun_mode",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Fun mode:")],-1)),hct={class:"flex flex-row"},fct={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"},mct={class:"flex flex-row p-3"},gct=P(()=>c("i",{"data-feather":"chevron-right"},null,-1)),bct=[gct],Ect=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),yct=[Ect],vct=P(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Data management settings",-1)),Sct={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"},Tct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_databases",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data Sources:")],-1)),xct={style:{width:"100%"}},Cct=["onUpdate:modelValue"],wct=["onClick"],Rct=["onClick"],Act=["onClick"],Nct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_vectorization_save_db",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"RAG Vectorizer:")],-1)),Oct=P(()=>c("option",{value:"bert"},"Bert Vectorizer",-1)),Ict=P(()=>c("option",{value:"tfidf"},"TFIDF Vectorizer",-1)),Mct=P(()=>c("option",{value:"word2vec"},"Word2Vec Vectorizer",-1)),Dct=[Oct,Ict,Mct],kct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_vectorizer_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"RAG Vectorizer model:")],-1)),Lct=P(()=>c("option",{value:"bert-base-nli-mean-tokens"},"bert-base-nli-mean-tokens",-1)),Pct=[Lct],Uct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_chunk_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"RAG chunk size:")],-1)),Fct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_overlap",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"RAG overlap size:")],-1)),Bct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_n_chunks",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"RAG number of chunks:")],-1)),Gct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_clean_chunks",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Clean chunks:")],-1)),Vct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_follow_subfolders",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Follow subfolders:")],-1)),zct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_check_new_files_at_startup",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Check for new files at startup:")],-1)),Hct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_preprocess_chunks",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Preprocess chunks:")],-1)),qct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"rag_activate_multi_hops",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate multi hops RAG:")],-1)),Yct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"contextual_summary",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use contextual summary instead of rag (consumes alot of tokens and may be very slow but efficient, useful for summary and global questions that RAG can't do):")],-1)),$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=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_vectorization_save_db",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Save vectorized database:")],-1)),Kct={class:"flex flex-row"},jct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_vectorization_visualize_on_vectorization",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"show vectorized data:")],-1)),Qct={class:"flex flex-row"},Xct=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_vectorization_build_keys_words",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Reformulate prompt before querying database (advised):")],-1)),Zct={class:"flex flex-row"},Jct=P(()=>c("td",{style:{"min-width":"200px"}},[c("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)),edt={class:"flex flex-row"},tdt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_vectorization_put_chunk_informations_into_context",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Put Chunk Information Into Context:")],-1)),ndt={class:"flex flex-row"},idt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_vectorization_method",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization method:")],-1)),sdt=P(()=>c("option",{value:"tfidf_vectorizer"},"tfidf Vectorizer",-1)),rdt=P(()=>c("option",{value:"bm25_vectorizer"},"bm25 Vectorizer",-1)),odt=P(()=>c("option",{value:"model_embedding"},"Model Embedding",-1)),adt=P(()=>c("option",{value:"sentense_transformer"},"Sentense Transformer",-1)),ldt=[sdt,rdt,odt,adt],cdt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_vectorization_sentense_transformer_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization model (for Sentense Transformer):")],-1)),ddt={style:{width:"100%"}},udt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_visualization_method",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data visualization method:")],-1)),pdt=P(()=>c("option",{value:"PCA"},"PCA",-1)),_dt=P(()=>c("option",{value:"TSNE"},"TSNE",-1)),hdt=[pdt,_dt],fdt=P(()=>c("td",{style:{"min-width":"200px"}},[c("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)),mdt={class:"flex flex-row"},gdt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_vectorization_chunk_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization chunk size(tokens):")],-1)),bdt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_vectorization_overlap_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization overlap size(tokens):")],-1)),Edt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"data_vectorization_overlap_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Number of chunks to use for each message:")],-1)),ydt={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"},vdt={class:"flex flex-row p-3"},Sdt=P(()=>c("i",{"data-feather":"chevron-right"},null,-1)),Tdt=[Sdt],xdt=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),Cdt=[xdt],wdt=P(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Internet",-1)),Rdt={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"},Adt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"activate_internet_search",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate internet search:")],-1)),Ndt={class:"flex flex-row"},Odt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"activate_internet_pages_judgement",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate internet pages judgement:")],-1)),Idt={class:"flex flex-row"},Mdt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"internet_quick_search",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate quick search:")],-1)),Ddt={class:"flex flex-row"},kdt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"internet_activate_search_decision",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate search decision:")],-1)),Ldt={class:"flex flex-row"},Pdt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"internet_vectorization_chunk_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Internet vectorization chunk size:")],-1)),Udt={class:"flex flex-col"},Fdt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"internet_vectorization_overlap_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Internet vectorization overlap size:")],-1)),Bdt={class:"flex flex-col"},Gdt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"internet_vectorization_nb_chunks",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Internet vectorization number of chunks:")],-1)),Vdt={class:"flex flex-col"},zdt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"internet_nb_search_pages",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Internet number of search pages:")],-1)),Hdt={class:"flex flex-col"},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=P(()=>c("i",{"data-feather":"chevron-right"},null,-1)),Wdt=[$dt],Kdt=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),jdt=[Kdt],Qdt=P(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Services Zoo",-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=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"active_tts_service",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Default Text to speach engine"},"Active TTS Service:")],-1)),Jdt={style:{width:"100%"}},eut=P(()=>c("option",{value:"None"},"None",-1)),tut=P(()=>c("option",{value:"browser"},"Use Browser TTS (doesn't work in realtime mode)",-1)),nut=P(()=>c("option",{value:"xtts"},"XTTS",-1)),iut=P(()=>c("option",{value:"openai_tts"},"Open AI TTS",-1)),sut=[eut,tut,nut,iut],rut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"active_stt_service",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Default Speach to Text engine"},"Active STT Service:")],-1)),out={style:{width:"100%"}},aut=P(()=>c("option",{value:"None"},"None",-1)),lut=P(()=>c("option",{value:"whisper"},"Whisper",-1)),cut=P(()=>c("option",{value:"openai_whisper"},"Open AI Whisper",-1)),dut=[aut,lut,cut],uut=P(()=>c("tr",null,null,-1)),put=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"active_tti_service",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Default Text to image engine"},"Active TTI Service:")],-1)),_ut={style:{width:"100%"}},hut=P(()=>c("option",{value:"None"},"None",-1)),fut=P(()=>c("option",{value:"diffusers"},"Diffusers",-1)),mut=P(()=>c("option",{value:"autosd"},"AUTO1111's SD",-1)),gut=P(()=>c("option",{value:"dall-e"},"Open AI DALL-E",-1)),but=P(()=>c("option",{value:"midjourney"},"Midjourney",-1)),Eut=P(()=>c("option",{value:"comfyui"},"Comfyui",-1)),yut=P(()=>c("option",{value:"fooocus"},"Fooocus",-1)),vut=[hut,fut,mut,gut,but,Eut,yut],Sut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"active_ttm_service",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Default Text to Music engine"},"Active TTM Service:")],-1)),Tut={style:{width:"100%"}},xut=P(()=>c("option",{value:"None"},"None",-1)),Cut=P(()=>c("option",{value:"musicgen"},"Music Gen",-1)),wut=[xut,Cut],Rut={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"},Aut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"use_negative_prompt",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use negative prompt:")],-1)),Nut={class:"flex flex-row"},Out=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"use_ai_generated_negative_prompt",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use AI generated negative prompt:")],-1)),Iut={class:"flex flex-row"},Mut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"negative_prompt_generation_prompt",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Negative prompt generation prompt:")],-1)),Dut={class:"flex flex-row"},kut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"default_negative_prompt",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Default negative prompt:")],-1)),Lut={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"},Uut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_listening_threshold",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Listening threshold"},"Listening threshold:")],-1)),Fut={style:{width:"100%"}},But=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_silence_duration",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Scilence duration"},"Silence duration (s):")],-1)),Gut={style:{width:"100%"}},Vut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_sound_threshold_percentage",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"stt_sound_threshold_percentage"},"Minimum sound percentage in recorded segment:")],-1)),zut={style:{width:"100%"}},Hut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_gain",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"STT Gain"},"Volume amplification:")],-1)),qut={style:{width:"100%"}},Yut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_rate",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Audio Rate"},"audio rate:")],-1)),$ut={style:{width:"100%"}},Wut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_channels",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"number of channels"},"number of channels:")],-1)),Kut={style:{width:"100%"}},jut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_buffer_size",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Buffer size"},"Buffer size:")],-1)),Qut={style:{width:"100%"}},Xut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_activate_word_detection",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate word detection:")],-1)),Zut={class:"flex flex-row"},Jut=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_word_detection_file",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Word detection wav file:")],-1)),ept={class:"flex flex-row"},tpt={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"},npt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"stt_input_device",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Input device"},"Audio Input device:")],-1)),ipt={style:{width:"100%"}},spt=["value"],rpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"tts_output_device",class:"text-sm font-bold",style:{"margin-right":"1rem"},title:"Input device"},"Audio Output device:")],-1)),opt={style:{width:"100%"}},apt=["value"],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=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"host",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Host:")],-1)),dpt={style:{width:"100%"}},upt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"lollms_access_keys",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Access keys (coma separated, if empty, anyone can use the server without authentication):")],-1)),ppt={style:{width:"100%"}},_pt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"discussion_db_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Port:")],-1)),hpt={style:{width:"100%"}},fpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("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)),mpt={style:{width:"100%"}},gpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"activate_lollms_server",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate lollms server:")],-1)),bpt={style:{width:"100%"}},Ept=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"activate_ollama_emulator",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate ollama server emulator:")],-1)),ypt={style:{width:"100%"}},vpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"activate_openai_emulator",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate openai server emulator:")],-1)),Spt={style:{width:"100%"}},Tpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"activate_mistralai_emulator",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate mistral ai server emulator:")],-1)),xpt={style:{width:"100%"}},Cpt={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"},wpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"activate_audio_infos",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate audio infos:")],-1)),Rpt={class:"flex flex-row"},Apt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"audio_auto_send_input",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Send audio input automatically:")],-1)),Npt={class:"flex flex-row"},Opt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"audio_silenceTimer",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"audio in silence timer (ms):")],-1)),Ipt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"audio_in_language",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Input Audio Language:")],-1)),Mpt=["value"],Dpt={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"},kpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"whisper_activate",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate Whisper at startup:")],-1)),Lpt={class:"flex flex-row"},Ppt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"whisper_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Whisper model:")],-1)),Upt={class:"flex flex-row"},Fpt=["value"],Bpt={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"},Gpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"openai_whisper_key",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"openai whisper key:")],-1)),Vpt={class:"flex flex-row"},zpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"openai_whisper_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Open Ai Whisper model:")],-1)),Hpt={class:"flex flex-row"},qpt=["value"],Ypt={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"},$pt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"auto_speak",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable auto speak:")],-1)),Wpt={class:"flex flex-row"},Kpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"audio_pitch",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"audio pitch:")],-1)),jpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"audio_out_voice",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Output Audio Voice:")],-1)),Qpt=["value"],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"},Zpt=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"xtts_current_language",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Current language:")],-1)),Jpt={class:"flex flex-row"},e_t=["value"],t_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"xtts_current_voice",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Current voice:")],-1)),n_t={class:"flex flex-row"},i_t=["value"],s_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"auto_read",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable auto read:")],-1)),r_t={class:"flex flex-row"},o_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"xtts_stream_chunk_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"xtts stream chunk size:")],-1)),a_t={class:"flex flex-row"},l_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"xtts_temperature",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Temperature:")],-1)),c_t={class:"flex flex-row"},d_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"xtts_length_penalty",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Length Penalty:")],-1)),u_t={class:"flex flex-row"},p_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"xtts_repetition_penalty",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Repetition Penalty:")],-1)),__t={class:"flex flex-row"},h_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"xtts_top_k",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Top K:")],-1)),f_t={class:"flex flex-row"},m_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"xtts_top_p",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Top P:")],-1)),g_t={class:"flex flex-row"},b_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"xtts_speed",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Speed:")],-1)),E_t={class:"flex flex-row"},y_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"enable_text_splitting",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable Text Splitting:")],-1)),v_t={class:"flex flex-row"},S_t={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"},T_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"openai_tts_key",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Open AI key:")],-1)),x_t={class:"flex flex-row"},C_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"openai_tts_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"openai tts model:")],-1)),w_t={class:"flex flex-row"},R_t=P(()=>c("option",null," tts-1 ",-1)),A_t=P(()=>c("option",null," tts-2 ",-1)),N_t=[R_t,A_t],O_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"openai_tts_voice",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"openai tts voice:")],-1)),I_t={class:"flex flex-row"},M_t=P(()=>c("option",null," alloy ",-1)),D_t=P(()=>c("option",null," echo ",-1)),k_t=P(()=>c("option",null," fable ",-1)),L_t=P(()=>c("option",null," nova ",-1)),P_t=P(()=>c("option",null," shimmer ",-1)),U_t=[M_t,D_t,k_t,L_t,P_t],F_t={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"},B_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"enable_sd_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable sd service:")],-1)),G_t={class:"flex flex-row"},V_t=P(()=>c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),z_t=[V_t],H_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"install_sd_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install SD service:")],-1)),q_t={class:"flex flex-row"},Y_t=P(()=>c("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)),$_t={class:"flex flex-row"},W_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"sd_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"sd base url:")],-1)),K_t={class:"flex flex-row"},j_t={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"},Q_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"install_diffusers_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install Diffusers service:")],-1)),X_t={class:"flex flex-row"},Z_t=P(()=>c("a",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",href:"https://github.com/huggingface/diffusers?tab=Apache-2.0-1-ov-file#readme",target:"_blank"},"Diffusers licence",-1)),J_t=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"diffusers_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Diffusers model:")],-1)),eht={class:"flex flex-row"},tht=P(()=>c("td",null,null,-1)),nht={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"},iht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"midjourney_key",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"midjourney key:")],-1)),sht={class:"flex flex-row"},rht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"midjourney_timeout",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"request timeout(s):")],-1)),oht={class:"flex flex-row"},aht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"midjourney_retries",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"number of retries:")],-1)),lht={class:"flex flex-row"},cht={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"},dht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"dall_e_key",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"dall e key:")],-1)),uht={class:"flex flex-row"},pht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"dall_e_generation_engine",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"dall e generation engine:")],-1)),_ht={class:"flex flex-row"},hht=P(()=>c("option",null," dall-e-2 ",-1)),fht=P(()=>c("option",null," dall-e-3 ",-1)),mht=[hht,fht],ght={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"},bht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"enable_comfyui_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable comfyui service:")],-1)),Eht={class:"flex flex-row"},yht=P(()=>c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),vht=[yht],Sht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"comfyui_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Available models (only if local):")],-1)),Tht={class:"flex flex-row"},xht=["value"],Cht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"comfyui_model",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable comfyui model:")],-1)),wht={class:"flex flex-row"},Rht=P(()=>c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),Aht=[Rht],Nht=P(()=>c("td",{style:{"min-width":"200px"}},null,-1)),Oht={class:"flex flex-row"},Iht=P(()=>c("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)),Mht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"comfyui_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"comfyui base url:")],-1)),Dht={class:"flex flex-row"},kht={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"},Lht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"enable_ollama_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable ollama service:")],-1)),Pht={class:"flex flex-row"},Uht=P(()=>c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),Fht=[Uht],Bht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"ollama_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install Ollama service:")],-1)),Ght={class:"flex flex-row"},Vht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"ollama_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"ollama base url:")],-1)),zht={class:"flex flex-row"},Hht={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"},qht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"enable_vllm_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable vLLM service:")],-1)),Yht={class:"flex flex-row"},$ht=P(()=>c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),Wht=[$ht],Kht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"vllm_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install vLLM service:")],-1)),jht={class:"flex flex-row"},Qht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"vllm_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"vllm base url:")],-1)),Xht={class:"flex flex-row"},Zht=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"vllm_gpu_memory_utilization",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"gpu memory utilization:")],-1)),Jht={class:"flex flex-col align-bottom"},eft={class:"relative"},tft=P(()=>c("p",{class:"absolute left-0 mt-6"},[c("label",{for:"vllm_gpu_memory_utilization",class:"text-sm font-medium"}," vllm gpu memory utilization: ")],-1)),nft={class:"absolute right-0"},ift=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"vllm_max_num_seqs",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"vllm max num seqs:")],-1)),sft={class:"flex flex-row"},rft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"vllm_max_model_len",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"max model len:")],-1)),oft={class:"flex flex-row"},aft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"vllm_model_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"vllm model path:")],-1)),lft={class:"flex flex-row"},cft={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"},dft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"enable_petals_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable petals service:")],-1)),uft={class:"flex flex-row"},pft=P(()=>c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),_ft=[pft],hft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"petals_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install Petals service:")],-1)),fft={class:"flex flex-row"},mft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"petals_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"petals base url:")],-1)),gft={class:"flex flex-row"},bft={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"},Eft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"enable_sd_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable Motion Ctrl service:")],-1)),yft={class:"flex flex-row"},vft=P(()=>c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)),Sft=[vft],Tft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"install_sd_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install Motion Ctrl service:")],-1)),xft={class:"flex flex-row"},Cft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"sd_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"sd base url:")],-1)),wft={class:"flex flex-row"},Rft={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"},Aft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"elastic_search_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable elastic search service:")],-1)),Nft={class:"flex flex-row"},Oft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"install_elastic_search_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Reinstall Elastic Search service:")],-1)),Ift={class:"flex flex-row"},Mft=P(()=>c("td",{style:{"min-width":"200px"}},[c("label",{for:"elastic_search_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"elastic search base url:")],-1)),Dft={class:"flex flex-row"},kft={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"},Lft={class:"flex flex-row p-3"},Pft=P(()=>c("i",{"data-feather":"chevron-right"},null,-1)),Uft=[Pft],Fft=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),Bft=[Fft],Gft=P(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Binding zoo",-1)),Vft={key:0,class:"text-base text-red-600 flex gap-3 items-center mr-2"},zft=P(()=>c("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),Hft={key:1,class:"mr-2"},qft={key:2,class:"text-base font-semibold cursor-pointer select-none items-center"},Yft={class:"flex gap-1 items-center"},$ft=["src"],Wft={class:"font-bold font-large text-lg line-clamp-1"},Kft={key:0,class:"mb-2"},jft={for:"binding",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},Qft=P(()=>c("i",{"data-feather":"chevron-up"},null,-1)),Xft=[Qft],Zft=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),Jft=[Zft],emt={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"},tmt={class:"flex flex-row p-3"},nmt=P(()=>c("i",{"data-feather":"chevron-right"},null,-1)),imt=[nmt],smt=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),rmt=[smt],omt=P(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Models zoo",-1)),amt={class:"flex flex-row items-center"},lmt={key:0,class:"text-base text-red-600 flex gap-3 items-center mr-2"},cmt=P(()=>c("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),dmt={key:1,class:"text-base text-red-600 flex gap-3 items-center mr-2"},umt=P(()=>c("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),pmt={key:2,class:"mr-2"},_mt={key:3,class:"text-base font-semibold cursor-pointer select-none items-center"},hmt={class:"flex gap-1 items-center"},fmt=["src"],mmt={class:"font-bold font-large text-lg line-clamp-1"},gmt={class:"mx-2 mb-4"},bmt={class:"relative"},Emt={class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},ymt={key:0},vmt=P(()=>c("div",{role:"status"},[c("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"},[c("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"}),c("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"})]),c("span",{class:"sr-only"},"Loading...")],-1)),Smt=[vmt],Tmt={key:1},xmt=P(()=>c("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"},[c("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)),Cmt=[xmt],wmt=P(()=>c("label",{for:"only_installed"},"Show only installed models",-1)),Rmt=P(()=>c("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)),Amt={key:0,role:"status",class:"text-center w-full display: flex;align-items: center;"},Nmt=P(()=>c("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"},[c("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"}),c("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)),Omt=P(()=>c("p",{class:"heartbeat-text"},"Loading models Zoo",-1)),Imt=[Nmt,Omt],Mmt={key:1,class:"mb-2"},Dmt={for:"model",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},kmt=P(()=>c("i",{"data-feather":"chevron-up"},null,-1)),Lmt=[kmt],Pmt=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),Umt=[Pmt],Fmt={class:"mb-2"},Bmt={class:"p-2"},Gmt={class:"mb-3"},Vmt=P(()=>c("label",{class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},"Create a reference from local file path:",-1)),zmt={key:0},Hmt={class:"mb-3"},qmt=P(()=>c("label",{class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},"Download from web:",-1)),Ymt={key:1,class:"relative flex flex-col items-center justify-center flex-grow h-full"},$mt=P(()=>c("div",{role:"status",class:"justify-center"},null,-1)),Wmt={class:"relative flex flex-row flex-grow items-center w-full h-full bottom-0"},Kmt={class:"w-full p-2"},jmt={class:"flex justify-between mb-1"},Qmt=Fu(' Downloading Loading...',1),Xmt={class:"text-sm font-medium text-blue-700 dark:text-white"},Zmt=["title"],Jmt={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},egt={class:"flex justify-between mb-1"},tgt={class:"text-base font-medium text-blue-700 dark:text-white"},ngt={class:"text-sm font-medium text-blue-700 dark:text-white"},igt={class:"flex flex-grow"},sgt={class:"flex flex-row flex-grow gap-3"},rgt={class:"p-2 text-center grow"},ogt={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"},agt={class:"flex flex-row p-3 items-center"},lgt=P(()=>c("i",{"data-feather":"chevron-right"},null,-1)),cgt=[lgt],dgt=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),ugt=[dgt],pgt=P(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Personalities zoo",-1)),_gt={key:0,class:"mr-2"},hgt={class:"mr-2 font-bold font-large text-lg line-clamp-1"},fgt={key:1,class:"mr-2"},mgt={key:2,class:"text-base font-semibold cursor-pointer select-none items-center flex flex-row"},ggt={key:0,class:"flex -space-x-4 items-center"},bgt={class:"group items-center flex flex-row"},Egt=["onClick"],ygt=["src","title"],vgt=["onClick"],Sgt=P(()=>c("span",{class:"hidden group-hover:block -top-2 -right-1 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2 border-transparent",title:"Unmount personality"},[c("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"},[c("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)),Tgt=[Sgt],xgt=P(()=>c("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"},[c("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)),Cgt=[xgt],wgt={class:"mx-2 mb-4"},Rgt=P(()=>c("label",{for:"personality-search",class:"mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white"},"Search",-1)),Agt={class:"relative"},Ngt={class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},Ogt={key:0},Igt=P(()=>c("div",{role:"status"},[c("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"},[c("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"}),c("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"})]),c("span",{class:"sr-only"},"Loading...")],-1)),Mgt=[Igt],Dgt={key:1},kgt=P(()=>c("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"},[c("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)),Lgt=[kgt],Pgt={key:0,class:"mx-2 mb-4"},Ugt={for:"persCat",class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},Fgt=["selected"],Bgt={key:0,class:"mb-2"},Ggt={for:"model",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},Vgt=P(()=>c("i",{"data-feather":"chevron-up"},null,-1)),zgt=[Vgt],Hgt=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),qgt=[Hgt],Ygt={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"},$gt={class:"flex flex-row"},Wgt=P(()=>c("i",{"data-feather":"chevron-right"},null,-1)),Kgt=[Wgt],jgt=P(()=>c("i",{"data-feather":"chevron-down"},null,-1)),Qgt=[jgt],Xgt=P(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none"}," Model Configuration",-1)),Zgt={class:"m-2"},Jgt={class:"flex flex-row gap-2 items-center"},ebt=P(()=>c("label",{for:"override-model-parameters",class:"block text-sm font-medium"}," Override personality model parameters ",-1)),tbt={class:"m-2"},nbt=P(()=>c("label",{for:"seed",class:"block mb-2 text-sm font-medium"}," Seed: ",-1)),ibt={class:"m-2"},sbt={class:"flex flex-col align-bottom"},rbt={class:"relative"},obt=P(()=>c("p",{class:"absolute left-0 mt-6"},[c("label",{for:"temperature",class:"text-sm font-medium"}," Temperature: ")],-1)),abt={class:"absolute right-0"},lbt={class:"m-2"},cbt={class:"flex flex-col align-bottom"},dbt={class:"relative"},ubt=P(()=>c("p",{class:"absolute left-0 mt-6"},[c("label",{for:"predict",class:"text-sm font-medium"}," N Predict: ")],-1)),pbt={class:"absolute right-0"},_bt={class:"m-2"},hbt={class:"flex flex-col align-bottom"},fbt={class:"relative"},mbt=P(()=>c("p",{class:"absolute left-0 mt-6"},[c("label",{for:"top_k",class:"text-sm font-medium"}," Top-K: ")],-1)),gbt={class:"absolute right-0"},bbt={class:"m-2"},Ebt={class:"flex flex-col align-bottom"},ybt={class:"relative"},vbt=P(()=>c("p",{class:"absolute left-0 mt-6"},[c("label",{for:"top_p",class:"text-sm font-medium"}," Top-P: ")],-1)),Sbt={class:"absolute right-0"},Tbt={class:"m-2"},xbt={class:"flex flex-col align-bottom"},Cbt={class:"relative"},wbt=P(()=>c("p",{class:"absolute left-0 mt-6"},[c("label",{for:"repeat_penalty",class:"text-sm font-medium"}," Repeat penalty: ")],-1)),Rbt={class:"absolute right-0"},Abt={class:"m-2"},Nbt={class:"flex flex-col align-bottom"},Obt={class:"relative"},Ibt=P(()=>c("p",{class:"absolute left-0 mt-6"},[c("label",{for:"repeat_last_n",class:"text-sm font-medium"}," Repeat last N: ")],-1)),Mbt={class:"absolute right-0"};function Dbt(n,e,t,i,s,r){const o=mt("Card"),a=mt("BindingEntry"),l=mt("RadioOptions"),u=mt("model-entry"),d=mt("personality-entry"),h=mt("AddModelDialog"),f=mt("ChoiceDialog");return w(),A($e,null,[c("div",Yrt,[c("div",$rt,[s.showConfirmation?(w(),A("div",Wrt,[c("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel",type:"button",onClick:e[0]||(e[0]=ge(_=>s.showConfirmation=!1,["stop"]))},jrt),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm save changes",type:"button",onClick:e[1]||(e[1]=ge(_=>r.save_configuration(),["stop"]))},Xrt)])):V("",!0),s.showConfirmation?V("",!0):(w(),A("div",Zrt,[c("button",{title:"Reset configuration",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[2]||(e[2]=_=>r.reset_configuration())},eot),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Collapse / Expand all panels",type:"button",onClick:e[3]||(e[3]=ge(_=>s.all_collapsed=!s.all_collapsed,["stop"]))},not)])),c("div",iot,[c("button",{title:"Clear uploads",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[4]||(e[4]=_=>r.api_get_req("clear_uploads").then(m=>{m.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast(["failed!"],4,!1)}))},rot),c("button",{title:"Restart program",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[5]||(e[5]=_=>r.api_post_req("restart_program").then(m=>{m.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast(["failed!"],4,!1)}))},aot),s.has_updates?(w(),A("button",{key:0,title:"Upgrade program ",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[6]||(e[6]=_=>r.api_post_req("update_software").then(m=>{m.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast("Success!",4,!0)}))},[lot,cot,et(" = ")])):V("",!0),c("div",dot,[s.settingsChanged?(w(),A("div",uot,[s.isLoading?V("",!0):(w(),A("button",{key:0,class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Apply changes",type:"button",onClick:e[7]||(e[7]=ge(_=>r.applyConfiguration(),["stop"]))},_ot)),s.isLoading?V("",!0):(w(),A("button",{key:1,class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Cancel changes",type:"button",onClick:e[8]||(e[8]=ge(_=>r.cancelConfiguration(),["stop"]))},fot))])):V("",!0),s.isLoading?(w(),A("div",mot,[c("p",null,he(s.loading_text),1),got,bot])):V("",!0)])])]),c("div",{class:ze(s.isLoading?"pointer-events-none opacity-30 w-full":"w-full")},[c("div",Eot,[c("div",yot,[c("button",{onClick:e[9]||(e[9]=ge(_=>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"},[G(c("div",null,Sot,512),[[Mt,s.sc_collapsed]]),G(c("div",null,xot,512),[[Mt,!s.sc_collapsed]]),Cot,wot,c("div",Rot,[c("div",Aot,[c("div",null,[r.vramUsage&&r.vramUsage.gpus&&r.vramUsage.gpus.length==1?(w(),A("div",Not,[(w(!0),A($e,null,lt(r.vramUsage.gpus,_=>(w(),A("div",{class:"flex gap-2 items-center",key:_},[c("img",{src:s.SVGGPU,width:"25",height:"25"},null,8,Oot),c("h3",Iot,[c("div",null,he(r.computedFileSize(_.used_vram))+" / "+he(r.computedFileSize(_.total_vram))+" ("+he(_.percentage)+"%) ",1)])]))),128))])):V("",!0),r.vramUsage&&r.vramUsage.gpus&&r.vramUsage.gpus.length>1?(w(),A("div",Mot,[c("div",Dot,[c("img",{src:s.SVGGPU,width:"25",height:"25"},null,8,kot),c("h3",Lot,[c("div",null,he(r.vramUsage.gpus.length)+"x ",1)])])])):V("",!0)]),Pot,c("h3",Uot,[c("div",null,he(r.ram_usage)+" / "+he(r.ram_total_space)+" ("+he(r.ram_percent_usage)+"%)",1)]),Fot,c("h3",Bot,[c("div",null,he(r.disk_binding_models_usage)+" / "+he(r.disk_total_space)+" ("+he(r.disk_percent_usage)+"%)",1)])])])])]),c("div",{class:ze([{hidden:s.sc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[c("div",Got,[Vot,c("div",zot,[c("div",null,[Hot,et(he(r.ram_available_space),1)]),c("div",null,[qot,et(" "+he(r.ram_usage)+" / "+he(r.ram_total_space)+" ("+he(r.ram_percent_usage)+")% ",1)])]),c("div",Yot,[c("div",$ot,[c("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en("width: "+r.ram_percent_usage+"%;")},null,4)])])]),c("div",Wot,[Kot,c("div",jot,[c("div",null,[Qot,et(he(r.disk_available_space),1)]),c("div",null,[Xot,et(" "+he(r.disk_binding_models_usage)+" / "+he(r.disk_total_space)+" ("+he(r.disk_percent_usage)+"%)",1)])]),c("div",Zot,[c("div",Jot,[c("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en("width: "+r.disk_percent_usage+"%;")},null,4)])])]),(w(!0),A($e,null,lt(r.vramUsage.gpus,_=>(w(),A("div",{class:"mb-2",key:_},[c("label",eat,[c("img",{src:s.SVGGPU,width:"25",height:"25"},null,8,tat),et(" GPU usage: ")]),c("div",nat,[c("div",null,[iat,et(he(_.gpu_model),1)]),c("div",null,[sat,et(he(this.computedFileSize(_.available_space)),1)]),c("div",null,[rat,et(" "+he(this.computedFileSize(_.used_vram))+" / "+he(this.computedFileSize(_.total_vram))+" ("+he(_.percentage)+"%)",1)])]),c("div",oat,[c("div",aat,[c("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en("width: "+_.percentage+"%;")},null,4)])])]))),128))],2)]),c("div",lat,[c("div",cat,[c("button",{onClick:e[10]||(e[10]=ge(_=>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"},[G(c("div",null,uat,512),[[Mt,s.minconf_collapsed]]),G(c("div",null,_at,512),[[Mt,!s.minconf_collapsed]]),hat])]),c("div",{class:ze([{hidden:s.minconf_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[c("div",fat,[Te(o,{title:"General",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",mat,[c("tr",null,[gat,c("td",null,[c("label",bat,[c("img",{src:r.configFile.app_custom_logo!=null&&r.configFile.app_custom_logo!=""?"/user_infos/"+r.configFile.app_custom_logo:s.storeLogo,class:"w-50 h-50 rounded-full",style:{"max-width":"50px","max-height":"50px",cursor:"pointer"}},null,8,Eat)]),c("input",{type:"file",id:"logo-upload",style:{display:"none"},onChange:e[11]||(e[11]=(..._)=>r.uploadLogo&&r.uploadLogo(..._))},null,32)]),c("td",yat,[c("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Discard title changes",type:"button",onClick:e[12]||(e[12]=ge(_=>r.resetLogo(),["stop"]))},Sat)])]),c("tr",null,[Tat,c("td",xat,[c("div",Cat,[G(c("select",{id:"hardware_mode",required:"","onUpdate:modelValue":e[13]||(e[13]=_=>r.configFile.hardware_mode=_),onChange:e[14]||(e[14]=_=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},kat,544),[[Wt,r.configFile.hardware_mode]])])])]),c("tr",null,[Lat,c("td",Pat,[G(c("input",{type:"text",id:"discussion_db_name",required:"","onUpdate:modelValue":e[15]||(e[15]=_=>r.configFile.discussion_db_name=_),onChange:e[16]||(e[16]=_=>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),[[we,r.configFile.discussion_db_name]])])]),c("tr",null,[Uat,c("td",null,[c("div",Fat,[G(c("input",{type:"checkbox",id:"copy_to_clipboard_add_all_details",required:"","onUpdate:modelValue":e[17]||(e[17]=_=>r.configFile.copy_to_clipboard_add_all_details=_),onChange:e[18]||(e[18]=_=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.copy_to_clipboard_add_all_details]])])])]),c("tr",null,[Bat,c("td",null,[c("div",Gat,[G(c("input",{type:"checkbox",id:"auto_show_browser",required:"","onUpdate:modelValue":e[19]||(e[19]=_=>r.configFile.auto_show_browser=_),onChange:e[20]||(e[20]=_=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.auto_show_browser]])])])]),c("tr",null,[Vat,c("td",null,[c("div",zat,[G(c("input",{type:"checkbox",id:"activate_debug",required:"","onUpdate:modelValue":e[21]||(e[21]=_=>r.configFile.debug=_),onChange:e[22]||(e[22]=_=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.debug]])])])]),c("tr",null,[Hat,c("td",null,[c("div",qat,[G(c("input",{type:"checkbox",id:"debug_show_final_full_prompt",required:"","onUpdate:modelValue":e[23]||(e[23]=_=>r.configFile.debug_show_final_full_prompt=_),onChange:e[24]||(e[24]=_=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.debug_show_final_full_prompt]])])])]),c("tr",null,[Yat,c("td",null,[c("div",$at,[G(c("input",{type:"checkbox",id:"debug_show_chunks",required:"","onUpdate:modelValue":e[25]||(e[25]=_=>r.configFile.debug_show_chunks=_),onChange:e[26]||(e[26]=_=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.debug_show_chunks]])])])]),c("tr",null,[Wat,c("td",null,[c("div",Kat,[G(c("input",{type:"text",id:"debug_log_file_path",required:"","onUpdate:modelValue":e[27]||(e[27]=_=>r.configFile.debug_log_file_path=_),onChange:e[28]||(e[28]=_=>s.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.debug_log_file_path]])])])]),c("tr",null,[jat,c("td",null,[c("div",Qat,[G(c("input",{type:"checkbox",id:"show_news_panel",required:"","onUpdate:modelValue":e[29]||(e[29]=_=>r.configFile.show_news_panel=_),onChange:e[30]||(e[30]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.show_news_panel]])])])]),c("tr",null,[Xat,c("td",null,[c("div",Zat,[G(c("input",{type:"checkbox",id:"auto_save",required:"","onUpdate:modelValue":e[31]||(e[31]=_=>r.configFile.auto_save=_),onChange:e[32]||(e[32]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.auto_save]])])])]),c("tr",null,[Jat,c("td",null,[c("div",elt,[G(c("input",{type:"checkbox",id:"auto_update",required:"","onUpdate:modelValue":e[33]||(e[33]=_=>r.configFile.auto_update=_),onChange:e[34]||(e[34]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.auto_update]])])])]),c("tr",null,[tlt,c("td",null,[c("div",nlt,[G(c("input",{type:"checkbox",id:"auto_title",required:"","onUpdate:modelValue":e[35]||(e[35]=_=>r.configFile.auto_title=_),onChange:e[36]||(e[36]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.auto_title]])])])])])]),_:1}),Te(o,{title:"Model template",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",ilt,[c("tr",null,[slt,c("td",null,[c("select",{onChange:e[37]||(e[37]=(..._)=>r.handleTemplateSelection&&r.handleTemplateSelection(..._))},clt,32)])]),c("tr",null,[dlt,c("td",null,[G(c("input",{type:"text",id:"start_header_id_template",required:"","onUpdate:modelValue":e[38]||(e[38]=_=>r.configFile.start_header_id_template=_),onChange:e[39]||(e[39]=_=>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),[[we,r.configFile.start_header_id_template]])])]),c("tr",null,[ult,c("td",null,[G(c("input",{type:"text",id:"end_header_id_template",required:"","onUpdate:modelValue":e[40]||(e[40]=_=>r.configFile.end_header_id_template=_),onChange:e[41]||(e[41]=_=>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),[[we,r.configFile.end_header_id_template]])])]),c("tr",null,[plt,c("td",null,[G(c("input",{type:"text",id:"start_user_header_id_template",required:"","onUpdate:modelValue":e[42]||(e[42]=_=>r.configFile.start_user_header_id_template=_),onChange:e[43]||(e[43]=_=>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),[[we,r.configFile.start_user_header_id_template]])])]),c("tr",null,[_lt,c("td",null,[G(c("input",{type:"text",id:"end_user_header_id_template",required:"","onUpdate:modelValue":e[44]||(e[44]=_=>r.configFile.end_user_header_id_template=_),onChange:e[45]||(e[45]=_=>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),[[we,r.configFile.end_user_header_id_template]])])]),c("tr",null,[hlt,c("td",null,[G(c("input",{type:"text",id:"end_user_message_id_template",required:"","onUpdate:modelValue":e[46]||(e[46]=_=>r.configFile.end_user_message_id_template=_),onChange:e[47]||(e[47]=_=>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),[[we,r.configFile.end_user_message_id_template]])])]),c("tr",null,[flt,c("td",null,[G(c("input",{type:"text",id:"start_ai_header_id_template",required:"","onUpdate:modelValue":e[48]||(e[48]=_=>r.configFile.start_ai_header_id_template=_),onChange:e[49]||(e[49]=_=>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),[[we,r.configFile.start_ai_header_id_template]])])]),c("tr",null,[mlt,c("td",null,[G(c("input",{type:"text",id:"end_ai_header_id_template",required:"","onUpdate:modelValue":e[50]||(e[50]=_=>r.configFile.end_ai_header_id_template=_),onChange:e[51]||(e[51]=_=>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),[[we,r.configFile.end_ai_header_id_template]])])]),c("tr",null,[glt,c("td",null,[G(c("input",{type:"text",id:"end_ai_message_id_template",required:"","onUpdate:modelValue":e[52]||(e[52]=_=>r.configFile.end_ai_message_id_template=_),onChange:e[53]||(e[53]=_=>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),[[we,r.configFile.end_ai_message_id_template]])])]),c("tr",null,[blt,c("td",null,[G(c("textarea",{id:"separator_template",required:"","onUpdate:modelValue":e[54]||(e[54]=_=>r.configFile.separator_template=_),onChange:e[55]||(e[55]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.separator_template]])])]),c("tr",null,[Elt,c("td",null,[G(c("input",{type:"text",id:"system_message_template",required:"","onUpdate:modelValue":e[56]||(e[56]=_=>r.configFile.system_message_template=_),onChange:e[57]||(e[57]=_=>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),[[we,r.configFile.system_message_template]])])]),c("tr",null,[ylt,c("td",null,[c("div",{innerHTML:r.full_template},null,8,vlt)])])])]),_:1}),Te(o,{title:"User",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Slt,[c("tr",null,[Tlt,c("td",xlt,[G(c("input",{type:"text",id:"user_name",required:"","onUpdate:modelValue":e[58]||(e[58]=_=>r.configFile.user_name=_),onChange:e[59]||(e[59]=_=>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),[[we,r.configFile.user_name]])])]),c("tr",null,[Clt,c("td",wlt,[G(c("textarea",{id:"user_description",required:"","onUpdate:modelValue":e[60]||(e[60]=_=>r.configFile.user_description=_),onChange:e[61]||(e[61]=_=>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),[[we,r.configFile.user_description]])])]),c("tr",null,[Rlt,c("td",Alt,[G(c("input",{type:"checkbox",id:"use_user_informations_in_discussion",required:"","onUpdate:modelValue":e[62]||(e[62]=_=>r.configFile.use_user_informations_in_discussion=_),onChange:e[63]||(e[63]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.use_user_informations_in_discussion]])])]),c("tr",null,[Nlt,c("td",Olt,[G(c("input",{type:"checkbox",id:"use_model_name_in_discussions",required:"","onUpdate:modelValue":e[64]||(e[64]=_=>r.configFile.use_model_name_in_discussions=_),onChange:e[65]||(e[65]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.use_model_name_in_discussions]])])]),c("tr",null,[Ilt,c("td",null,[c("label",Mlt,[c("img",{src:r.configFile.user_avatar!=null&&r.configFile.user_avatar!=""?"/user_infos/"+r.configFile.user_avatar:s.storeLogo,class:"w-50 h-50 rounded-full",style:{"max-width":"50px","max-height":"50px",cursor:"pointer"}},null,8,Dlt)]),c("input",{type:"file",id:"avatar-upload",style:{display:"none"},onChange:e[66]||(e[66]=(..._)=>r.uploadAvatar&&r.uploadAvatar(..._))},null,32)]),c("td",klt,[c("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Discard title changes",type:"button",onClick:e[67]||(e[67]=ge(_=>r.resetAvatar(),["stop"]))},Plt)])]),c("tr",null,[Ult,c("td",null,[c("div",Flt,[G(c("input",{type:"checkbox",id:"use_user_name_in_discussions",required:"","onUpdate:modelValue":e[68]||(e[68]=_=>r.configFile.use_user_name_in_discussions=_),onChange:e[69]||(e[69]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.use_user_name_in_discussions]])])])]),c("tr",null,[Blt,c("td",Glt,[G(c("input",{type:"number",id:"max_n_predict",required:"","onUpdate:modelValue":e[70]||(e[70]=_=>r.configFile.max_n_predict=_),onChange:e[71]||(e[71]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.max_n_predict]])])]),c("tr",null,[Vlt,c("td",zlt,[G(c("input",{type:"number",id:"max_n_predict",required:"","onUpdate:modelValue":e[72]||(e[72]=_=>r.configFile.max_n_predict=_),onChange:e[73]||(e[73]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.max_n_predict]])])])])]),_:1}),Te(o,{title:"Security settings",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Hlt,[c("tr",null,[qlt,c("td",Ylt,[G(c("input",{type:"checkbox",id:"turn_on_code_execution",required:"","onUpdate:modelValue":e[74]||(e[74]=_=>r.configFile.turn_on_code_execution=_),onChange:e[75]||(e[75]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.turn_on_code_execution]])])]),c("tr",null,[$lt,c("td",Wlt,[G(c("input",{type:"checkbox",id:"turn_on_code_validation",required:"","onUpdate:modelValue":e[76]||(e[76]=_=>r.configFile.turn_on_code_validation=_),onChange:e[77]||(e[77]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.turn_on_code_validation]])])]),c("tr",null,[Klt,c("td",jlt,[G(c("input",{type:"checkbox",id:"turn_on_setting_update_validation",required:"","onUpdate:modelValue":e[78]||(e[78]=_=>r.configFile.turn_on_setting_update_validation=_),onChange:e[79]||(e[79]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.turn_on_setting_update_validation]])])]),c("tr",null,[Qlt,c("td",Xlt,[G(c("input",{type:"checkbox",id:"turn_on_open_file_validation",required:"","onUpdate:modelValue":e[80]||(e[80]=_=>r.configFile.turn_on_open_file_validation=_),onChange:e[81]||(e[81]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.turn_on_open_file_validation]])])]),c("tr",null,[Zlt,c("td",Jlt,[G(c("input",{type:"checkbox",id:"turn_on_send_file_validation",required:"","onUpdate:modelValue":e[82]||(e[82]=_=>r.configFile.turn_on_send_file_validation=_),onChange:e[83]||(e[83]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.turn_on_send_file_validation]])])])])]),_:1}),Te(o,{title:"Knowledge database",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",ect,[c("tr",null,[tct,c("td",null,[c("div",nct,[G(c("input",{type:"checkbox",id:"activate_skills_lib",required:"","onUpdate:modelValue":e[84]||(e[84]=_=>r.configFile.activate_skills_lib=_),onChange:e[85]||(e[85]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.activate_skills_lib]])])])]),c("tr",null,[ict,c("td",sct,[G(c("input",{type:"text",id:"skills_lib_database_name",required:"","onUpdate:modelValue":e[86]||(e[86]=_=>r.configFile.skills_lib_database_name=_),onChange:e[87]||(e[87]=_=>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),[[we,r.configFile.skills_lib_database_name]])])])])]),_:1}),Te(o,{title:"Latex",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",rct,[c("tr",null,[oct,c("td",null,[c("div",act,[G(c("input",{type:"text",id:"pdf_latex_path",required:"","onUpdate:modelValue":e[88]||(e[88]=_=>r.configFile.pdf_latex_path=_),onChange:e[89]||(e[89]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.pdf_latex_path]])])])])])]),_:1}),Te(o,{title:"Boost",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",lct,[c("tr",null,[cct,c("td",null,[c("div",dct,[G(c("input",{type:"text",id:"positive_boost",required:"","onUpdate:modelValue":e[90]||(e[90]=_=>r.configFile.positive_boost=_),onChange:e[91]||(e[91]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.positive_boost]])])])]),c("tr",null,[uct,c("td",null,[c("div",pct,[G(c("input",{type:"text",id:"negative_boost",required:"","onUpdate:modelValue":e[92]||(e[92]=_=>r.configFile.negative_boost=_),onChange:e[93]||(e[93]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.negative_boost]])])])]),c("tr",null,[_ct,c("td",null,[c("div",hct,[G(c("input",{type:"checkbox",id:"fun_mode",required:"","onUpdate:modelValue":e[94]||(e[94]=_=>r.configFile.fun_mode=_),onChange:e[95]||(e[95]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.fun_mode]])])])])])]),_:1})])],2)]),c("div",fct,[c("div",mct,[c("button",{onClick:e[96]||(e[96]=ge(_=>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"},[G(c("div",null,bct,512),[[Mt,s.data_conf_collapsed]]),G(c("div",null,yct,512),[[Mt,!s.data_conf_collapsed]]),vct])]),c("div",{class:ze([{hidden:s.data_conf_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[Te(o,{title:"Data Sources",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Sct,[c("tr",null,[Tct,c("td",xct,[(w(!0),A($e,null,lt(r.configFile.rag_databases,(_,m)=>(w(),A("div",{key:m,class:"flex items-center mb-2"},[G(c("input",{type:"text","onUpdate:modelValue":E=>r.configFile.rag_databases[m]=E,onChange:e[97]||(e[97]=E=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,40,Cct),[[we,r.configFile.rag_databases[m]]]),c("button",{onClick:E=>r.vectorize_folder(m),class:"w-500 ml-2 px-2 py-1 bg-green-500 text-white hover:bg-green-300 rounded"},"(Re)Vectorize",8,wct),c("button",{onClick:E=>r.select_folder(m),class:"w-500 ml-2 px-2 py-1 bg-blue-500 text-white hover:bg-green-300 rounded"},"Select Folder",8,Rct),c("button",{onClick:E=>r.removeDataSource(m),class:"ml-2 px-2 py-1 bg-red-500 text-white hover:bg-green-300 rounded"},"Remove",8,Act)]))),128)),c("button",{onClick:e[98]||(e[98]=(..._)=>r.addDataSource&&r.addDataSource(..._)),class:"mt-2 px-2 py-1 bg-blue-500 text-white rounded"},"Add Data Source")])]),c("tr",null,[Nct,c("td",null,[G(c("select",{id:"rag_vectorizer",required:"","onUpdate:modelValue":e[99]||(e[99]=_=>r.configFile.rag_vectorizer=_),onChange:e[100]||(e[100]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},Dct,544),[[Wt,r.configFile.rag_vectorizer]])])]),c("tr",null,[kct,c("td",null,[G(c("select",{id:"rag_vectorizer_model",required:"","onUpdate:modelValue":e[101]||(e[101]=_=>r.configFile.rag_vectorizer_model=_),onChange:e[102]||(e[102]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},Pct,544),[[Wt,r.configFile.rag_vectorizer_model]])])]),c("tr",null,[Uct,c("td",null,[G(c("input",{id:"rag_chunk_size","onUpdate:modelValue":e[103]||(e[103]=_=>r.configFile.rag_chunk_size=_),onChange:e[104]||(e[104]=_=>s.settingsChanged=!0),type:"range",min:"2",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),[[we,r.configFile.rag_chunk_size]]),G(c("input",{"onUpdate:modelValue":e[105]||(e[105]=_=>r.configFile.rag_chunk_size=_),type:"number",onChange:e[106]||(e[106]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.rag_chunk_size]])])]),c("tr",null,[Fct,c("td",null,[G(c("input",{id:"rag_overlap","onUpdate:modelValue":e[107]||(e[107]=_=>r.configFile.rag_overlap=_),onChange:e[108]||(e[108]=_=>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),[[we,r.configFile.rag_overlap]]),G(c("input",{"onUpdate:modelValue":e[109]||(e[109]=_=>r.configFile.rag_overlap=_),type:"number",onChange:e[110]||(e[110]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.rag_overlap]])])]),c("tr",null,[Bct,c("td",null,[G(c("input",{id:"rag_n_chunks","onUpdate:modelValue":e[111]||(e[111]=_=>r.configFile.rag_n_chunks=_),onChange:e[112]||(e[112]=_=>s.settingsChanged=!0),type:"range",min:"2",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),[[we,r.configFile.rag_n_chunks]]),G(c("input",{"onUpdate:modelValue":e[113]||(e[113]=_=>r.configFile.rag_n_chunks=_),type:"number",onChange:e[114]||(e[114]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.rag_n_chunks]])])]),c("tr",null,[Gct,c("td",null,[G(c("input",{"onUpdate:modelValue":e[115]||(e[115]=_=>r.configFile.rag_clean_chunks=_),type:"checkbox",onChange:e[116]||(e[116]=_=>s.settingsChanged=!0),class:"w-5 mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.rag_clean_chunks]])])]),c("tr",null,[Vct,c("td",null,[G(c("input",{"onUpdate:modelValue":e[117]||(e[117]=_=>r.configFile.rag_follow_subfolders=_),type:"checkbox",onChange:e[118]||(e[118]=_=>s.settingsChanged=!0),class:"w-5 mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.rag_follow_subfolders]])])]),c("tr",null,[zct,c("td",null,[G(c("input",{"onUpdate:modelValue":e[119]||(e[119]=_=>r.configFile.rag_check_new_files_at_startup=_),type:"checkbox",onChange:e[120]||(e[120]=_=>s.settingsChanged=!0),class:"w-5 mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.rag_check_new_files_at_startup]])])]),c("tr",null,[Hct,c("td",null,[G(c("input",{"onUpdate:modelValue":e[121]||(e[121]=_=>r.configFile.rag_preprocess_chunks=_),type:"checkbox",onChange:e[122]||(e[122]=_=>s.settingsChanged=!0),class:"w-5 mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.rag_preprocess_chunks]])])]),c("tr",null,[qct,c("td",null,[G(c("input",{"onUpdate:modelValue":e[123]||(e[123]=_=>r.configFile.rag_activate_multi_hops=_),type:"checkbox",onChange:e[124]||(e[124]=_=>s.settingsChanged=!0),class:"w-5 mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.rag_activate_multi_hops]])])]),c("tr",null,[Yct,c("td",null,[G(c("input",{"onUpdate:modelValue":e[125]||(e[125]=_=>r.configFile.contextual_summary=_),type:"checkbox",onChange:e[126]||(e[126]=_=>s.settingsChanged=!0),class:"w-5 mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.contextual_summary]])])])])]),_:1}),Te(o,{title:"Data Vectorization",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",$ct,[c("tr",null,[Wct,c("td",null,[c("div",Kct,[G(c("input",{type:"checkbox",id:"data_vectorization_save_db",required:"","onUpdate:modelValue":e[127]||(e[127]=_=>r.configFile.data_vectorization_save_db=_),onChange:e[128]||(e[128]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.data_vectorization_save_db]])])])]),c("tr",null,[jct,c("td",null,[c("div",Qct,[G(c("input",{type:"checkbox",id:"data_vectorization_visualize_on_vectorization",required:"","onUpdate:modelValue":e[129]||(e[129]=_=>r.configFile.data_vectorization_visualize_on_vectorization=_),onChange:e[130]||(e[130]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.data_vectorization_visualize_on_vectorization]])])])]),c("tr",null,[Xct,c("td",null,[c("div",Zct,[G(c("input",{type:"checkbox",id:"data_vectorization_build_keys_words",required:"","onUpdate:modelValue":e[131]||(e[131]=_=>r.configFile.data_vectorization_build_keys_words=_),onChange:e[132]||(e[132]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.data_vectorization_build_keys_words]])])])]),c("tr",null,[Jct,c("td",null,[c("div",edt,[G(c("input",{type:"checkbox",id:"data_vectorization_force_first_chunk",required:"","onUpdate:modelValue":e[133]||(e[133]=_=>r.configFile.data_vectorization_force_first_chunk=_),onChange:e[134]||(e[134]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.data_vectorization_force_first_chunk]])])])]),c("tr",null,[tdt,c("td",null,[c("div",ndt,[G(c("input",{type:"checkbox",id:"data_vectorization_put_chunk_informations_into_context",required:"","onUpdate:modelValue":e[135]||(e[135]=_=>r.configFile.data_vectorization_put_chunk_informations_into_context=_),onChange:e[136]||(e[136]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.data_vectorization_put_chunk_informations_into_context]])])])]),c("tr",null,[idt,c("td",null,[G(c("select",{id:"data_vectorization_method",required:"","onUpdate:modelValue":e[137]||(e[137]=_=>r.configFile.data_vectorization_method=_),onChange:e[138]||(e[138]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},ldt,544),[[Wt,r.configFile.data_vectorization_method]])])]),c("tr",null,[cdt,c("td",ddt,[G(c("input",{type:"text",id:"data_vectorization_sentense_transformer_model",required:"","onUpdate:modelValue":e[139]||(e[139]=_=>r.configFile.data_vectorization_sentense_transformer_model=_),onChange:e[140]||(e[140]=_=>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),[[we,r.configFile.data_vectorization_sentense_transformer_model]])])]),c("tr",null,[udt,c("td",null,[G(c("select",{id:"data_visualization_method",required:"","onUpdate:modelValue":e[141]||(e[141]=_=>r.configFile.data_visualization_method=_),onChange:e[142]||(e[142]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},hdt,544),[[Wt,r.configFile.data_visualization_method]])])]),c("tr",null,[fdt,c("td",null,[c("div",mdt,[G(c("input",{type:"checkbox",id:"data_vectorization_save_db",required:"","onUpdate:modelValue":e[143]||(e[143]=_=>r.configFile.data_vectorization_save_db=_),onChange:e[144]||(e[144]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.data_vectorization_save_db]])])])]),c("tr",null,[gdt,c("td",null,[G(c("input",{id:"data_vectorization_chunk_size","onUpdate:modelValue":e[145]||(e[145]=_=>r.configFile.data_vectorization_chunk_size=_),onChange:e[146]||(e[146]=_=>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),[[we,r.configFile.data_vectorization_chunk_size]]),G(c("input",{"onUpdate:modelValue":e[147]||(e[147]=_=>r.configFile.data_vectorization_chunk_size=_),type:"number",onChange:e[148]||(e[148]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.data_vectorization_chunk_size]])])]),c("tr",null,[bdt,c("td",null,[G(c("input",{id:"data_vectorization_overlap_size","onUpdate:modelValue":e[149]||(e[149]=_=>r.configFile.data_vectorization_overlap_size=_),onChange:e[150]||(e[150]=_=>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),[[we,r.configFile.data_vectorization_overlap_size]]),G(c("input",{"onUpdate:modelValue":e[151]||(e[151]=_=>r.configFile.data_vectorization_overlap_size=_),type:"number",onChange:e[152]||(e[152]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.data_vectorization_overlap_size]])])]),c("tr",null,[Edt,c("td",null,[G(c("input",{id:"data_vectorization_nb_chunks","onUpdate:modelValue":e[153]||(e[153]=_=>r.configFile.data_vectorization_nb_chunks=_),onChange:e[154]||(e[154]=_=>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),[[we,r.configFile.data_vectorization_nb_chunks]]),G(c("input",{"onUpdate:modelValue":e[155]||(e[155]=_=>r.configFile.data_vectorization_nb_chunks=_),type:"number",onChange:e[156]||(e[156]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.data_vectorization_nb_chunks]])])])])]),_:1})],2)]),c("div",ydt,[c("div",vdt,[c("button",{onClick:e[157]||(e[157]=ge(_=>s.internet_conf_collapsed=!s.internet_conf_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[G(c("div",null,Tdt,512),[[Mt,s.internet_conf_collapsed]]),G(c("div",null,Cdt,512),[[Mt,!s.internet_conf_collapsed]]),wdt])]),c("div",{class:ze([{hidden:s.internet_conf_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[Te(o,{title:"Internet search",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Rdt,[c("tr",null,[Adt,c("td",null,[c("div",Ndt,[G(c("input",{type:"checkbox",id:"fun_mode",required:"","onUpdate:modelValue":e[158]||(e[158]=_=>r.configFile.activate_internet_search=_),onChange:e[159]||(e[159]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.activate_internet_search]])])])]),c("tr",null,[Odt,c("td",null,[c("div",Idt,[G(c("input",{type:"checkbox",id:"activate_internet_pages_judgement",required:"","onUpdate:modelValue":e[160]||(e[160]=_=>r.configFile.activate_internet_pages_judgement=_),onChange:e[161]||(e[161]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.activate_internet_pages_judgement]])])])]),c("tr",null,[Mdt,c("td",null,[c("div",Ddt,[G(c("input",{type:"checkbox",id:"internet_quick_search",required:"","onUpdate:modelValue":e[162]||(e[162]=_=>r.configFile.internet_quick_search=_),onChange:e[163]||(e[163]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.internet_quick_search]])])])]),c("tr",null,[kdt,c("td",null,[c("div",Ldt,[G(c("input",{type:"checkbox",id:"internet_activate_search_decision",required:"","onUpdate:modelValue":e[164]||(e[164]=_=>r.configFile.internet_activate_search_decision=_),onChange:e[165]||(e[165]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.internet_activate_search_decision]])])])]),c("tr",null,[Pdt,c("td",null,[c("div",Udt,[G(c("input",{id:"internet_vectorization_chunk_size","onUpdate:modelValue":e[166]||(e[166]=_=>r.configFile.internet_vectorization_chunk_size=_),onChange:e[167]||(e[167]=_=>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),[[we,r.configFile.internet_vectorization_chunk_size]]),G(c("input",{"onUpdate:modelValue":e[168]||(e[168]=_=>r.configFile.internet_vectorization_chunk_size=_),type:"number",onChange:e[169]||(e[169]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.internet_vectorization_chunk_size]])])])]),c("tr",null,[Fdt,c("td",null,[c("div",Bdt,[G(c("input",{id:"internet_vectorization_overlap_size","onUpdate:modelValue":e[170]||(e[170]=_=>r.configFile.internet_vectorization_overlap_size=_),onChange:e[171]||(e[171]=_=>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),[[we,r.configFile.internet_vectorization_overlap_size]]),G(c("input",{"onUpdate:modelValue":e[172]||(e[172]=_=>r.configFile.internet_vectorization_overlap_size=_),type:"number",onChange:e[173]||(e[173]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.internet_vectorization_overlap_size]])])])]),c("tr",null,[Gdt,c("td",null,[c("div",Vdt,[G(c("input",{id:"internet_vectorization_nb_chunks","onUpdate:modelValue":e[174]||(e[174]=_=>r.configFile.internet_vectorization_nb_chunks=_),onChange:e[175]||(e[175]=_=>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),[[we,r.configFile.internet_vectorization_nb_chunks]]),G(c("input",{"onUpdate:modelValue":e[176]||(e[176]=_=>r.configFile.internet_vectorization_nb_chunks=_),type:"number",onChange:e[177]||(e[177]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.internet_vectorization_nb_chunks]])])])]),c("tr",null,[zdt,c("td",null,[c("div",Hdt,[G(c("input",{id:"internet_nb_search_pages","onUpdate:modelValue":e[178]||(e[178]=_=>r.configFile.internet_nb_search_pages=_),onChange:e[179]||(e[179]=_=>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),[[we,r.configFile.internet_nb_search_pages]]),G(c("input",{"onUpdate:modelValue":e[180]||(e[180]=_=>r.configFile.internet_nb_search_pages=_),type:"number",onChange:e[181]||(e[181]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.internet_nb_search_pages]])])])])])]),_:1})],2)]),c("div",qdt,[c("div",Ydt,[c("button",{onClick:e[182]||(e[182]=ge(_=>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"},[G(c("div",null,Wdt,512),[[Mt,s.servers_conf_collapsed]]),G(c("div",null,jdt,512),[[Mt,!s.servers_conf_collapsed]]),Qdt])]),c("div",{class:ze([{hidden:s.servers_conf_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[Te(o,{title:"Default services selection",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Xdt,[c("tr",null,[Zdt,c("td",Jdt,[G(c("select",{id:"active_tts_service",required:"","onUpdate:modelValue":e[183]||(e[183]=_=>r.configFile.active_tts_service=_),onChange:e[184]||(e[184]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},sut,544),[[Wt,r.configFile.active_tts_service]])])]),c("tr",null,[rut,c("td",out,[G(c("select",{id:"active_stt_service",required:"","onUpdate:modelValue":e[185]||(e[185]=_=>r.configFile.active_stt_service=_),onChange:e[186]||(e[186]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},dut,544),[[Wt,r.configFile.active_stt_service]])])]),uut,c("tr",null,[put,c("td",_ut,[G(c("select",{id:"active_tti_service",required:"","onUpdate:modelValue":e[187]||(e[187]=_=>r.configFile.active_tti_service=_),onChange:e[188]||(e[188]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},vut,544),[[Wt,r.configFile.active_tti_service]])])]),c("tr",null,[Sut,c("td",Tut,[G(c("select",{id:"active_ttm_service",required:"","onUpdate:modelValue":e[189]||(e[189]=_=>r.configFile.active_ttm_service=_),onChange:e[190]||(e[190]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},wut,544),[[Wt,r.configFile.active_ttm_service]])])])])]),_:1}),Te(o,{title:"TTI settings",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Rut,[c("tr",null,[Aut,c("td",null,[c("div",Nut,[G(c("input",{type:"checkbox",id:"use_negative_prompt",required:"","onUpdate:modelValue":e[191]||(e[191]=_=>r.configFile.use_negative_prompt=_),onChange:e[192]||(e[192]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.use_negative_prompt]])])])]),c("tr",null,[Out,c("td",null,[c("div",Iut,[G(c("input",{type:"checkbox",id:"use_ai_generated_negative_prompt",required:"","onUpdate:modelValue":e[193]||(e[193]=_=>r.configFile.use_ai_generated_negative_prompt=_),onChange:e[194]||(e[194]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.use_ai_generated_negative_prompt]])])])]),c("tr",null,[Mut,c("td",null,[c("div",Dut,[G(c("input",{type:"text",id:"negative_prompt_generation_prompt",required:"","onUpdate:modelValue":e[195]||(e[195]=_=>r.configFile.negative_prompt_generation_prompt=_),onChange:e[196]||(e[196]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.negative_prompt_generation_prompt]])])])]),c("tr",null,[kut,c("td",null,[c("div",Lut,[G(c("input",{type:"text",id:"default_negative_prompt",required:"","onUpdate:modelValue":e[197]||(e[197]=_=>r.configFile.default_negative_prompt=_),onChange:e[198]||(e[198]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.default_negative_prompt]])])])])])]),_:1}),Te(o,{title:"Full Audio settings",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Put,[c("tr",null,[Uut,c("td",Fut,[G(c("input",{type:"number",step:"1",id:"stt_listening_threshold",required:"","onUpdate:modelValue":e[199]||(e[199]=_=>r.configFile.stt_listening_threshold=_),onChange:e[200]||(e[200]=_=>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),[[we,r.configFile.stt_listening_threshold]])])]),c("tr",null,[But,c("td",Gut,[G(c("input",{type:"number",step:"1",id:"stt_silence_duration",required:"","onUpdate:modelValue":e[201]||(e[201]=_=>r.configFile.stt_silence_duration=_),onChange:e[202]||(e[202]=_=>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),[[we,r.configFile.stt_silence_duration]])])]),c("tr",null,[Vut,c("td",zut,[G(c("input",{type:"number",step:"1",id:"stt_sound_threshold_percentage",required:"","onUpdate:modelValue":e[203]||(e[203]=_=>r.configFile.stt_sound_threshold_percentage=_),onChange:e[204]||(e[204]=_=>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),[[we,r.configFile.stt_sound_threshold_percentage]])])]),c("tr",null,[Hut,c("td",qut,[G(c("input",{type:"number",step:"1",id:"stt_gain",required:"","onUpdate:modelValue":e[205]||(e[205]=_=>r.configFile.stt_gain=_),onChange:e[206]||(e[206]=_=>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),[[we,r.configFile.stt_gain]])])]),c("tr",null,[Yut,c("td",$ut,[G(c("input",{type:"number",step:"1",id:"stt_rate",required:"","onUpdate:modelValue":e[207]||(e[207]=_=>r.configFile.stt_rate=_),onChange:e[208]||(e[208]=_=>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),[[we,r.configFile.stt_rate]])])]),c("tr",null,[Wut,c("td",Kut,[G(c("input",{type:"number",step:"1",id:"stt_channels",required:"","onUpdate:modelValue":e[209]||(e[209]=_=>r.configFile.stt_channels=_),onChange:e[210]||(e[210]=_=>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),[[we,r.configFile.stt_channels]])])]),c("tr",null,[jut,c("td",Qut,[G(c("input",{type:"number",step:"1",id:"stt_buffer_size",required:"","onUpdate:modelValue":e[211]||(e[211]=_=>r.configFile.stt_buffer_size=_),onChange:e[212]||(e[212]=_=>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),[[we,r.configFile.stt_buffer_size]])])]),c("tr",null,[Xut,c("td",null,[c("div",Zut,[G(c("input",{type:"checkbox",id:"stt_activate_word_detection",required:"","onUpdate:modelValue":e[213]||(e[213]=_=>r.configFile.stt_activate_word_detection=_),onChange:e[214]||(e[214]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.stt_activate_word_detection]])])])]),c("tr",null,[Jut,c("td",null,[c("div",ept,[G(c("input",{type:"text",id:"stt_word_detection_file",required:"","onUpdate:modelValue":e[215]||(e[215]=_=>r.configFile.stt_word_detection_file=_),onChange:e[216]||(e[216]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.stt_word_detection_file]])])])])])]),_:1}),Te(o,{title:"Audio devices settings",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",tpt,[c("tr",null,[npt,c("td",ipt,[G(c("select",{id:"stt_input_device",required:"","onUpdate:modelValue":e[217]||(e[217]=_=>r.configFile.stt_input_device=_),onChange:e[218]||(e[218]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),A($e,null,lt(s.snd_input_devices,(_,m)=>(w(),A("option",{key:_,value:s.snd_input_devices_indexes[m]},he(_),9,spt))),128))],544),[[Wt,r.configFile.stt_input_device]])])]),c("tr",null,[rpt,c("td",opt,[G(c("select",{id:"tts_output_device",required:"","onUpdate:modelValue":e[219]||(e[219]=_=>r.configFile.tts_output_device=_),onChange:e[220]||(e[220]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),A($e,null,lt(s.snd_output_devices,(_,m)=>(w(),A("option",{key:_,value:s.snd_output_devices_indexes[m]},he(_),9,apt))),128))],544),[[Wt,r.configFile.tts_output_device]])])])])]),_:1}),Te(o,{title:"Lollms service",is_shrunk:!0,is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",lpt,[c("tr",null,[cpt,c("td",dpt,[G(c("input",{type:"text",id:"host",required:"","onUpdate:modelValue":e[221]||(e[221]=_=>r.configFile.host=_),onChange:e[222]||(e[222]=_=>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),[[we,r.configFile.host]])])]),c("tr",null,[upt,c("td",ppt,[G(c("input",{type:"text",id:"lollms_access_keys",required:"","onUpdate:modelValue":e[223]||(e[223]=_=>r.configFile.lollms_access_keys=_),onChange:e[224]||(e[224]=_=>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),[[we,r.configFile.lollms_access_keys]])])]),c("tr",null,[_pt,c("td",hpt,[G(c("input",{type:"number",step:"1",id:"port",required:"","onUpdate:modelValue":e[225]||(e[225]=_=>r.configFile.port=_),onChange:e[226]||(e[226]=_=>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),[[we,r.configFile.port]])])]),c("tr",null,[fpt,c("td",mpt,[G(c("input",{type:"checkbox",id:"headless_server_mode",required:"","onUpdate:modelValue":e[227]||(e[227]=_=>r.configFile.headless_server_mode=_),onChange:e[228]||(e[228]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Je,r.configFile.headless_server_mode]])])]),c("tr",null,[gpt,c("td",bpt,[G(c("input",{type:"checkbox",id:"activate_lollms_server",required:"","onUpdate:modelValue":e[229]||(e[229]=_=>r.configFile.activate_lollms_server=_),onChange:e[230]||(e[230]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Je,r.configFile.activate_lollms_server]])])]),c("tr",null,[Ept,c("td",ypt,[G(c("input",{type:"checkbox",id:"activate_ollama_emulator",required:"","onUpdate:modelValue":e[231]||(e[231]=_=>r.configFile.activate_ollama_emulator=_),onChange:e[232]||(e[232]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Je,r.configFile.activate_ollama_emulator]])])]),c("tr",null,[vpt,c("td",Spt,[G(c("input",{type:"checkbox",id:"activate_openai_emulator",required:"","onUpdate:modelValue":e[233]||(e[233]=_=>r.configFile.activate_openai_emulator=_),onChange:e[234]||(e[234]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Je,r.configFile.activate_openai_emulator]])])]),c("tr",null,[Tpt,c("td",xpt,[G(c("input",{type:"checkbox",id:"activate_mistralai_emulator",required:"","onUpdate:modelValue":e[235]||(e[235]=_=>r.configFile.activate_mistralai_emulator=_),onChange:e[236]||(e[236]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Je,r.configFile.activate_mistralai_emulator]])])])])]),_:1}),Te(o,{title:"STT services",is_shrunk:!0,is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[Te(o,{title:"Browser Audio STT",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Cpt,[c("tr",null,[wpt,c("td",null,[c("div",Rpt,[G(c("input",{type:"checkbox",id:"activate_audio_infos",required:"","onUpdate:modelValue":e[237]||(e[237]=_=>r.configFile.activate_audio_infos=_),onChange:e[238]||(e[238]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.activate_audio_infos]])])])]),c("tr",null,[Apt,c("td",null,[c("div",Npt,[G(c("input",{type:"checkbox",id:"audio_auto_send_input",required:"","onUpdate:modelValue":e[239]||(e[239]=_=>r.configFile.audio_auto_send_input=_),onChange:e[240]||(e[240]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.audio_auto_send_input]])])])]),c("tr",null,[Opt,c("td",null,[G(c("input",{id:"audio_silenceTimer","onUpdate:modelValue":e[241]||(e[241]=_=>r.configFile.audio_silenceTimer=_),onChange:e[242]||(e[242]=_=>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),[[we,r.configFile.audio_silenceTimer]]),G(c("input",{"onUpdate:modelValue":e[243]||(e[243]=_=>r.configFile.audio_silenceTimer=_),onChange:e[244]||(e[244]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.audio_silenceTimer]])])]),c("tr",null,[Ipt,c("td",null,[G(c("select",{id:"audio_in_language","onUpdate:modelValue":e[245]||(e[245]=_=>r.configFile.audio_in_language=_),onChange:e[246]||(e[246]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),A($e,null,lt(r.audioLanguages,_=>(w(),A("option",{key:_.code,value:_.code},he(_.name),9,Mpt))),128))],544),[[Wt,r.configFile.audio_in_language]])])])])]),_:1}),Te(o,{title:"Whisper audio transcription",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Dpt,[c("tr",null,[kpt,c("td",null,[c("div",Lpt,[G(c("input",{type:"checkbox",id:"whisper_activate",required:"","onUpdate:modelValue":e[247]||(e[247]=_=>r.configFile.whisper_activate=_),onChange:e[248]||(e[248]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.whisper_activate]])])])]),c("tr",null,[Ppt,c("td",null,[c("div",Upt,[G(c("select",{id:"whisper_model","onUpdate:modelValue":e[249]||(e[249]=_=>r.configFile.whisper_model=_),onChange:e[250]||(e[250]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),A($e,null,lt(r.whisperModels,_=>(w(),A("option",{key:_,value:_},he(_),9,Fpt))),128))],544),[[Wt,r.configFile.whisper_model]])])])])])]),_:1}),Te(o,{title:"Open AI Whisper audio transcription",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Bpt,[c("tr",null,[Gpt,c("td",null,[c("div",Vpt,[G(c("input",{type:"text",id:"openai_whisper_key",required:"","onUpdate:modelValue":e[251]||(e[251]=_=>r.configFile.openai_whisper_key=_),onChange:e[252]||(e[252]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.openai_whisper_key]])])])]),c("tr",null,[zpt,c("td",null,[c("div",Hpt,[G(c("select",{id:"openai_whisper_model","onUpdate:modelValue":e[253]||(e[253]=_=>r.configFile.openai_whisper_model=_),onChange:e[254]||(e[254]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),A($e,null,lt(r.openaiWhisperModels,_=>(w(),A("option",{key:_,value:_},he(_),9,qpt))),128))],544),[[Wt,r.configFile.openai_whisper_model]])])])])])]),_:1})]),_:1}),Te(o,{title:"TTS services",is_shrunk:!0,is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[Te(o,{title:"Browser Audio TTS",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Ypt,[c("tr",null,[$pt,c("td",null,[c("div",Wpt,[G(c("input",{type:"checkbox",id:"auto_speak",required:"","onUpdate:modelValue":e[255]||(e[255]=_=>r.configFile.auto_speak=_),onChange:e[256]||(e[256]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.auto_speak]])])])]),c("tr",null,[Kpt,c("td",null,[G(c("input",{id:"audio_pitch","onUpdate:modelValue":e[257]||(e[257]=_=>r.configFile.audio_pitch=_),onChange:e[258]||(e[258]=_=>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),[[we,r.configFile.audio_pitch]]),G(c("input",{"onUpdate:modelValue":e[259]||(e[259]=_=>r.configFile.audio_pitch=_),onChange:e[260]||(e[260]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.audio_pitch]])])]),c("tr",null,[jpt,c("td",null,[G(c("select",{id:"audio_out_voice","onUpdate:modelValue":e[261]||(e[261]=_=>r.configFile.audio_out_voice=_),onChange:e[262]||(e[262]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),A($e,null,lt(s.audioVoices,_=>(w(),A("option",{key:_.name,value:_.name},he(_.name),9,Qpt))),128))],544),[[Wt,r.configFile.audio_out_voice]])])])])]),_:1}),Te(o,{title:"XTTS service",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Xpt,[c("tr",null,[Zpt,c("td",null,[c("div",Jpt,[G(c("select",{"onUpdate:modelValue":e[263]||(e[263]=_=>r.xtts_current_language=_),onChange:e[264]||(e[264]=_=>s.settingsChanged=!0)},[(w(!0),A($e,null,lt(s.voice_languages,(_,m)=>(w(),A("option",{key:m,value:_},he(m),9,e_t))),128))],544),[[Wt,r.xtts_current_language]])])])]),c("tr",null,[t_t,c("td",null,[c("div",n_t,[G(c("select",{"onUpdate:modelValue":e[265]||(e[265]=_=>r.xtts_current_voice=_),onChange:e[266]||(e[266]=_=>s.settingsChanged=!0)},[(w(!0),A($e,null,lt(s.voices,_=>(w(),A("option",{key:_,value:_},he(_),9,i_t))),128))],544),[[Wt,r.xtts_current_voice]])])])]),c("tr",null,[s_t,c("td",null,[c("div",r_t,[G(c("input",{type:"checkbox",id:"auto_read",required:"","onUpdate:modelValue":e[267]||(e[267]=_=>r.configFile.auto_read=_),onChange:e[268]||(e[268]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.auto_read]])])])]),c("tr",null,[o_t,c("td",null,[c("div",a_t,[G(c("input",{type:"text",id:"xtts_stream_chunk_size",required:"","onUpdate:modelValue":e[269]||(e[269]=_=>r.configFile.xtts_stream_chunk_size=_),onChange:e[270]||(e[270]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.xtts_stream_chunk_size]])])])]),c("tr",null,[l_t,c("td",null,[c("div",c_t,[G(c("input",{type:"number",id:"xtts_temperature",required:"","onUpdate:modelValue":e[271]||(e[271]=_=>r.configFile.xtts_temperature=_),onChange:e[272]||(e[272]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600",step:"0.01"},null,544),[[we,r.configFile.xtts_temperature,void 0,{number:!0}]])])])]),c("tr",null,[d_t,c("td",null,[c("div",u_t,[G(c("input",{type:"number",id:"xtts_length_penalty",required:"","onUpdate:modelValue":e[273]||(e[273]=_=>r.configFile.xtts_length_penalty=_),onChange:e[274]||(e[274]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600",step:"0.1"},null,544),[[we,r.configFile.xtts_length_penalty,void 0,{number:!0}]])])])]),c("tr",null,[p_t,c("td",null,[c("div",__t,[G(c("input",{type:"number",id:"xtts_repetition_penalty",required:"","onUpdate:modelValue":e[275]||(e[275]=_=>r.configFile.xtts_repetition_penalty=_),onChange:e[276]||(e[276]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600",step:"0.1"},null,544),[[we,r.configFile.xtts_repetition_penalty,void 0,{number:!0}]])])])]),c("tr",null,[h_t,c("td",null,[c("div",f_t,[G(c("input",{type:"number",id:"xtts_top_k",required:"","onUpdate:modelValue":e[277]||(e[277]=_=>r.configFile.xtts_top_k=_),onChange:e[278]||(e[278]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.xtts_top_k,void 0,{number:!0}]])])])]),c("tr",null,[m_t,c("td",null,[c("div",g_t,[G(c("input",{type:"number",id:"xtts_top_p",required:"","onUpdate:modelValue":e[279]||(e[279]=_=>r.configFile.xtts_top_p=_),onChange:e[280]||(e[280]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.xtts_top_p,void 0,{number:!0}]])])])]),c("tr",null,[b_t,c("td",null,[c("div",E_t,[G(c("input",{type:"number",id:"xtts_speed",required:"","onUpdate:modelValue":e[281]||(e[281]=_=>r.configFile.xtts_speed=_),onChange:e[282]||(e[282]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600",step:"0.1"},null,544),[[we,r.configFile.xtts_speed,void 0,{number:!0}]])])])]),c("tr",null,[y_t,c("td",null,[c("div",v_t,[G(c("input",{type:"checkbox",id:"enable_text_splitting","onUpdate:modelValue":e[283]||(e[283]=_=>r.configFile.enable_text_splitting=_),onChange:e[284]||(e[284]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.enable_text_splitting]])])])])])]),_:1}),Te(o,{title:"Open AI TTS service",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",S_t,[c("tr",null,[T_t,c("td",null,[c("div",x_t,[G(c("input",{type:"text",id:"openai_tts_key",required:"","onUpdate:modelValue":e[285]||(e[285]=_=>r.configFile.openai_tts_key=_),onChange:e[286]||(e[286]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.openai_tts_key]])])])]),c("tr",null,[C_t,c("td",null,[c("div",w_t,[G(c("select",{"onUpdate:modelValue":e[287]||(e[287]=_=>r.configFile.openai_tts_model=_),onChange:e[288]||(e[288]=_=>s.settingsChanged=!0)},N_t,544),[[Wt,r.configFile.openai_tts_model]])])])]),c("tr",null,[O_t,c("td",null,[c("div",I_t,[G(c("select",{"onUpdate:modelValue":e[289]||(e[289]=_=>r.configFile.openai_tts_voice=_),onChange:e[290]||(e[290]=_=>s.settingsChanged=!0)},U_t,544),[[Wt,r.configFile.openai_tts_voice]])])])])])]),_:1})]),_:1}),Te(o,{title:"TTI services",is_shrunk:!0,is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[Te(o,{title:"Stable diffusion service",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",F_t,[c("tr",null,[B_t,c("td",null,[c("div",G_t,[G(c("input",{type:"checkbox",id:"enable_sd_service",required:"","onUpdate:modelValue":e[291]||(e[291]=_=>r.configFile.enable_sd_service=_),onChange:e[292]||(e[292]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.enable_sd_service]])])]),c("td",null,[c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[293]||(e[293]=_=>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"))},z_t)])]),c("tr",null,[H_t,c("td",null,[c("div",q_t,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[294]||(e[294]=(..._)=>r.reinstallSDService&&r.reinstallSDService(..._))},"install sd service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[295]||(e[295]=(..._)=>r.upgradeSDService&&r.upgradeSDService(..._))},"upgrade sd service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[296]||(e[296]=(..._)=>r.startSDService&&r.startSDService(..._))},"start sd service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[297]||(e[297]=(..._)=>r.showSD&&r.showSD(..._))},"show sd ui"),Y_t])]),c("td",null,[c("div",$_t,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[298]||(e[298]=(..._)=>r.reinstallSDService&&r.reinstallSDService(..._))},"install sd service")])])]),c("tr",null,[W_t,c("td",null,[c("div",K_t,[G(c("input",{type:"text",id:"sd_base_url",required:"","onUpdate:modelValue":e[299]||(e[299]=_=>r.configFile.sd_base_url=_),onChange:e[300]||(e[300]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.sd_base_url]])])])])])]),_:1}),Te(o,{title:"Diffusers service",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",j_t,[c("tr",null,[Q_t,c("td",null,[c("div",X_t,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[301]||(e[301]=(..._)=>r.reinstallDiffusersService&&r.reinstallDiffusersService(..._))},"install diffusers service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[302]||(e[302]=(..._)=>r.upgradeDiffusersService&&r.upgradeDiffusersService(..._))},"upgrade diffusers service"),Z_t])])]),c("tr",null,[J_t,c("td",null,[c("div",eht,[G(c("input",{type:"text",id:"diffusers_model",required:"","onUpdate:modelValue":e[303]||(e[303]=_=>r.configFile.diffusers_model=_),onChange:e[304]||(e[304]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.diffusers_model]])])]),tht])])]),_:1}),Te(o,{title:"Midjourney",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",nht,[c("tr",null,[iht,c("td",null,[c("div",sht,[G(c("input",{type:"text",id:"midjourney_key",required:"","onUpdate:modelValue":e[305]||(e[305]=_=>r.configFile.midjourney_key=_),onChange:e[306]||(e[306]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.midjourney_key]])])])]),c("tr",null,[rht,c("td",null,[c("div",oht,[G(c("input",{type:"number",min:"10",max:"2048",id:"midjourney_timeout",required:"","onUpdate:modelValue":e[307]||(e[307]=_=>r.configFile.midjourney_timeout=_),onChange:e[308]||(e[308]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.midjourney_timeout]])])])]),c("tr",null,[aht,c("td",null,[c("div",lht,[G(c("input",{type:"number",min:"0",max:"2048",id:"midjourney_retries",required:"","onUpdate:modelValue":e[309]||(e[309]=_=>r.configFile.midjourney_retries=_),onChange:e[310]||(e[310]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.midjourney_retries]])])])])])]),_:1}),Te(o,{title:"Dall-E",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",cht,[c("tr",null,[dht,c("td",null,[c("div",uht,[G(c("input",{type:"text",id:"dall_e_key",required:"","onUpdate:modelValue":e[311]||(e[311]=_=>r.configFile.dall_e_key=_),onChange:e[312]||(e[312]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.dall_e_key]])])])]),c("tr",null,[pht,c("td",null,[c("div",_ht,[G(c("select",{"onUpdate:modelValue":e[313]||(e[313]=_=>r.configFile.dall_e_generation_engine=_),onChange:e[314]||(e[314]=_=>s.settingsChanged=!0)},mht,544),[[Wt,r.configFile.dall_e_generation_engine]])])])])])]),_:1}),Te(o,{title:"ComfyUI service",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",ght,[c("tr",null,[bht,c("td",null,[c("div",Eht,[G(c("input",{type:"checkbox",id:"enable_comfyui_service",required:"","onUpdate:modelValue":e[315]||(e[315]=_=>r.configFile.enable_comfyui_service=_),onChange:e[316]||(e[316]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.enable_comfyui_service]])])]),c("td",null,[c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[317]||(e[317]=_=>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"))},vht)])]),c("tr",null,[Sht,c("td",null,[c("div",Tht,[G(c("select",{id:"comfyui_model",required:"","onUpdate:modelValue":e[318]||(e[318]=_=>r.configFile.comfyui_model=_),onChange:e[319]||(e[319]=_=>s.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(w(!0),A($e,null,lt(s.comfyui_models,(_,m)=>(w(),A("option",{key:_,value:_},he(_),9,xht))),128))],544),[[Wt,r.configFile.comfyui_model]])])])]),c("tr",null,[Cht,c("td",null,[c("div",wht,[G(c("input",{type:"text",id:"comfyui_model",required:"","onUpdate:modelValue":e[320]||(e[320]=_=>r.configFile.comfyui_model=_),onChange:e[321]||(e[321]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.comfyui_model]])])]),c("td",null,[c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[322]||(e[322]=_=>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"))},Aht)])]),c("tr",null,[Nht,c("td",null,[c("div",Oht,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[323]||(e[323]=(..._)=>r.reinstallComfyUIService&&r.reinstallComfyUIService(..._))},"install comfyui service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[324]||(e[324]=(..._)=>r.upgradeComfyUIService&&r.upgradeComfyUIService(..._))},"upgrade comfyui service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[325]||(e[325]=(..._)=>r.startComfyUIService&&r.startComfyUIService(..._))},"start comfyui service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[326]||(e[326]=(..._)=>r.showComfyui&&r.showComfyui(..._))},"show comfyui"),Iht])])]),c("tr",null,[Mht,c("td",null,[c("div",Dht,[G(c("input",{type:"text",id:"comfyui_base_url",required:"","onUpdate:modelValue":e[327]||(e[327]=_=>r.configFile.comfyui_base_url=_),onChange:e[328]||(e[328]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.comfyui_base_url]])])])])])]),_:1})]),_:1}),Te(o,{title:"TTT services",is_shrunk:!0,is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[Te(o,{title:"Ollama service",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",kht,[c("tr",null,[Lht,c("td",null,[c("div",Pht,[G(c("input",{type:"checkbox",id:"enable_ollama_service",required:"","onUpdate:modelValue":e[329]||(e[329]=_=>r.configFile.enable_ollama_service=_),onChange:e[330]||(e[330]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.enable_ollama_service]])])]),c("td",null,[c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[331]||(e[331]=_=>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`))},Bht)])]),c("tr",null,[Ght,c("td",null,[c("div",Vht,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[332]||(e[332]=(..._)=>r.reinstallOLLAMAService&&r.reinstallOLLAMAService(..._))},"install ollama service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[333]||(e[333]=(..._)=>r.startollamaService&&r.startollamaService(..._))},"start ollama service")])])]),c("tr",null,[zht,c("td",null,[c("div",Hht,[G(c("input",{type:"text",id:"ollama_base_url",required:"","onUpdate:modelValue":e[334]||(e[334]=_=>r.configFile.ollama_base_url=_),onChange:e[335]||(e[335]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.ollama_base_url]])])])])])]),_:1}),Te(o,{title:"vLLM service",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",qht,[c("tr",null,[Yht,c("td",null,[c("div",$ht,[G(c("input",{type:"checkbox",id:"enable_vllm_service",required:"","onUpdate:modelValue":e[336]||(e[336]=_=>r.configFile.enable_vllm_service=_),onChange:e[337]||(e[337]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.enable_vllm_service]])])]),c("td",null,[c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[338]||(e[338]=_=>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`))},Fht)])]),c("tr",null,[Bht,c("td",null,[c("div",Ght,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[332]||(e[332]=(..._)=>r.reinstallOLLAMAService&&r.reinstallOLLAMAService(..._))},"install ollama service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[333]||(e[333]=(..._)=>r.startollamaService&&r.startollamaService(..._))},"start ollama service")])])]),c("tr",null,[Vht,c("td",null,[c("div",zht,[G(c("input",{type:"text",id:"ollama_base_url",required:"","onUpdate:modelValue":e[334]||(e[334]=_=>r.configFile.ollama_base_url=_),onChange:e[335]||(e[335]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.ollama_base_url]])])])])])]),_:1}),Te(o,{title:"vLLM service",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Hht,[c("tr",null,[qht,c("td",null,[c("div",Yht,[G(c("input",{type:"checkbox",id:"enable_vllm_service",required:"","onUpdate:modelValue":e[336]||(e[336]=_=>r.configFile.enable_vllm_service=_),onChange:e[337]||(e[337]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.enable_vllm_service]])])]),c("td",null,[c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[338]||(e[338]=_=>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`))},Kht)])]),c("tr",null,[jht,c("td",null,[c("div",Qht,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[339]||(e[339]=(..._)=>r.reinstallvLLMService&&r.reinstallvLLMService(..._))},"install vLLM service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[340]||(e[340]=(..._)=>r.startvLLMService&&r.startvLLMService(..._))},"start vllm service")])])]),c("tr",null,[Xht,c("td",null,[c("div",Zht,[G(c("input",{type:"text",id:"vllm_url",required:"","onUpdate:modelValue":e[341]||(e[341]=_=>r.configFile.vllm_url=_),onChange:e[342]||(e[342]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.vllm_url]])])])]),c("tr",null,[Jht,c("td",null,[c("div",eft,[c("div",tft,[nft,c("p",ift,[G(c("input",{type:"text",id:"temp-val","onUpdate:modelValue":e[343]||(e[343]=_=>r.configFile.vllm_gpu_memory_utilization=_),onChange:e[344]||(e[344]=_=>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),[[we,r.configFile.vllm_gpu_memory_utilization]])])]),G(c("input",{id:"vllm_gpu_memory_utilization",onChange:e[345]||(e[345]=_=>s.settingsChanged=!0),type:"range","onUpdate:modelValue":e[346]||(e[346]=_=>r.configFile.vllm_gpu_memory_utilization=_),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),[[we,r.configFile.vllm_gpu_memory_utilization]])])])]),c("tr",null,[sft,c("td",null,[c("div",rft,[G(c("input",{type:"number",id:"vllm_max_num_seqs",min:"64",max:"2048",required:"","onUpdate:modelValue":e[347]||(e[347]=_=>r.configFile.vllm_max_num_seqs=_),onChange:e[348]||(e[348]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.vllm_max_num_seqs]])])])]),c("tr",null,[oft,c("td",null,[c("div",aft,[G(c("input",{type:"number",id:"vllm_max_model_len",min:"2048",max:"1000000",required:"","onUpdate:modelValue":e[349]||(e[349]=_=>r.configFile.vllm_max_model_len=_),onChange:e[350]||(e[350]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.vllm_max_model_len]])])])]),c("tr",null,[lft,c("td",null,[c("div",cft,[G(c("input",{type:"text",id:"vllm_model_path",required:"","onUpdate:modelValue":e[351]||(e[351]=_=>r.configFile.vllm_model_path=_),onChange:e[352]||(e[352]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.vllm_model_path]])])])])])]),_:1}),Te(o,{title:"Petals service",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",dft,[c("tr",null,[uft,c("td",null,[c("div",pft,[G(c("input",{type:"checkbox",id:"enable_petals_service",required:"","onUpdate:modelValue":e[353]||(e[353]=_=>r.configFile.enable_petals_service=_),onChange:e[354]||(e[354]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.enable_petals_service]])])]),c("td",null,[c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[355]||(e[355]=_=>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`))},Wht)])]),c("tr",null,[Kht,c("td",null,[c("div",jht,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[339]||(e[339]=(..._)=>r.reinstallvLLMService&&r.reinstallvLLMService(..._))},"install vLLM service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[340]||(e[340]=(..._)=>r.startvLLMService&&r.startvLLMService(..._))},"start vllm service")])])]),c("tr",null,[Qht,c("td",null,[c("div",Xht,[G(c("input",{type:"text",id:"vllm_url",required:"","onUpdate:modelValue":e[341]||(e[341]=_=>r.configFile.vllm_url=_),onChange:e[342]||(e[342]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.vllm_url]])])])]),c("tr",null,[Zht,c("td",null,[c("div",Jht,[c("div",eft,[tft,c("p",nft,[G(c("input",{type:"text",id:"temp-val","onUpdate:modelValue":e[343]||(e[343]=_=>r.configFile.vllm_gpu_memory_utilization=_),onChange:e[344]||(e[344]=_=>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),[[we,r.configFile.vllm_gpu_memory_utilization]])])]),G(c("input",{id:"vllm_gpu_memory_utilization",onChange:e[345]||(e[345]=_=>s.settingsChanged=!0),type:"range","onUpdate:modelValue":e[346]||(e[346]=_=>r.configFile.vllm_gpu_memory_utilization=_),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),[[we,r.configFile.vllm_gpu_memory_utilization]])])])]),c("tr",null,[ift,c("td",null,[c("div",sft,[G(c("input",{type:"number",id:"vllm_max_num_seqs",min:"64",max:"2048",required:"","onUpdate:modelValue":e[347]||(e[347]=_=>r.configFile.vllm_max_num_seqs=_),onChange:e[348]||(e[348]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.vllm_max_num_seqs]])])])]),c("tr",null,[rft,c("td",null,[c("div",oft,[G(c("input",{type:"number",id:"vllm_max_model_len",min:"2048",max:"1000000",required:"","onUpdate:modelValue":e[349]||(e[349]=_=>r.configFile.vllm_max_model_len=_),onChange:e[350]||(e[350]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.vllm_max_model_len]])])])]),c("tr",null,[aft,c("td",null,[c("div",lft,[G(c("input",{type:"text",id:"vllm_model_path",required:"","onUpdate:modelValue":e[351]||(e[351]=_=>r.configFile.vllm_model_path=_),onChange:e[352]||(e[352]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.vllm_model_path]])])])])])]),_:1}),Te(o,{title:"Petals service",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",cft,[c("tr",null,[dft,c("td",null,[c("div",uft,[G(c("input",{type:"checkbox",id:"enable_petals_service",required:"","onUpdate:modelValue":e[353]||(e[353]=_=>r.configFile.enable_petals_service=_),onChange:e[354]||(e[354]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.enable_petals_service]])])]),c("td",null,[c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[355]||(e[355]=_=>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`))},hft)])]),c("tr",null,[fft,c("td",null,[c("div",mft,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[356]||(e[356]=(..._)=>r.reinstallPetalsService&&r.reinstallPetalsService(..._))},"install petals service")])])]),c("tr",null,[gft,c("td",null,[c("div",bft,[G(c("input",{type:"text",id:"petals_base_url",required:"","onUpdate:modelValue":e[357]||(e[357]=_=>r.configFile.petals_base_url=_),onChange:e[358]||(e[358]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.petals_base_url]])])])])])]),_:1})]),_:1}),Te(o,{title:"Misc",is_shrunk:!0,is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[Te(o,{title:"Motion Ctrl service",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Eft,[c("tr",null,[yft,c("td",null,[c("div",vft,[G(c("input",{type:"checkbox",id:"enable_motion_ctrl_service",required:"","onUpdate:modelValue":e[359]||(e[359]=_=>r.configFile.enable_motion_ctrl_service=_),onChange:e[360]||(e[360]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.enable_motion_ctrl_service]])])]),c("td",null,[c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[361]||(e[361]=_=>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"))},Tft)])]),c("tr",null,[xft,c("td",null,[c("div",Cft,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[362]||(e[362]=(..._)=>r.reinstallMotionCtrlService&&r.reinstallMotionCtrlService(..._))},"install Motion Ctrl service")])])]),c("tr",null,[wft,c("td",null,[c("div",Rft,[G(c("input",{type:"text",id:"sd_base_url",required:"","onUpdate:modelValue":e[363]||(e[363]=_=>r.configFile.sd_base_url=_),onChange:e[364]||(e[364]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.sd_base_url]])])])])])]),_:1}),Te(o,{title:"Elastic search Service (under construction)",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Aft,[c("tr",null,[Nft,c("td",null,[c("div",Oft,[G(c("input",{type:"checkbox",id:"elastic_search_service",required:"","onUpdate:modelValue":e[365]||(e[365]=_=>r.configFile.elastic_search_service=_),onChange:e[366]||(e[366]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.elastic_search_service]])])])]),c("tr",null,[Ift,c("td",null,[c("div",Mft,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[367]||(e[367]=(..._)=>r.reinstallElasticSearchService&&r.reinstallElasticSearchService(..._))},"install ElasticSearch service")])])]),c("tr",null,[Dft,c("td",null,[c("div",kft,[G(c("input",{type:"text",id:"elastic_search_url",required:"","onUpdate:modelValue":e[368]||(e[368]=_=>r.configFile.elastic_search_url=_),onChange:e[369]||(e[369]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.elastic_search_url]])])])])])]),_:1})]),_:1})],2)]),c("div",Lft,[c("div",Pft,[c("button",{onClick:e[370]||(e[370]=ge(_=>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"},[G(c("div",null,Fft,512),[[Mt,s.bzc_collapsed]]),G(c("div",null,Gft,512),[[Mt,!s.bzc_collapsed]]),Vft,r.configFile.binding_name?V("",!0):(w(),A("div",zft,[Hft,et(" No binding selected! ")])),r.configFile.binding_name?(w(),A("div",qft,"|")):V("",!0),r.configFile.binding_name?(w(),A("div",Yft,[c("div",$ft,[c("img",{src:r.imgBinding,class:"w-8 h-8 rounded-full object-fill text-blue-700"},null,8,Wft),c("h3",Kft,he(r.binding_name),1)])])):V("",!0)])]),c("div",{class:ze([{hidden:s.bzc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[r.bindingsZoo&&r.bindingsZoo.length>0?(w(),A("div",jft,[c("label",Qft," Bindings: ("+he(r.bindingsZoo.length)+") ",1),c("div",{class:ze(["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"])},[Te(as,{name:"list"},{default:We(()=>[(w(!0),A($e,null,lt(r.bindingsZoo,(_,m)=>(w(),xt(a,{ref_for:!0,ref:"bindingZoo",key:"index-"+m+"-"+_.folder,binding:_,"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:_.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)])):V("",!0),s.bzl_collapsed?(w(),A("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[371]||(e[371]=_=>s.bzl_collapsed=!s.bzl_collapsed)},Zft)):(w(),A("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[372]||(e[372]=_=>s.bzl_collapsed=!s.bzl_collapsed)},emt))],2)]),c("div",tmt,[c("div",nmt,[c("button",{onClick:e[373]||(e[373]=ge(_=>r.modelsZooToggleCollapse(),["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex items-center"},[G(c("div",null,smt,512),[[Mt,s.mzc_collapsed]]),G(c("div",null,omt,512),[[Mt,!s.mzc_collapsed]]),amt,c("div",lmt,[r.configFile.binding_name?V("",!0):(w(),A("div",cmt,[dmt,et(" Select binding first! ")])),!r.configFile.model_name&&r.configFile.binding_name?(w(),A("div",umt,[pmt,et(" No model selected! ")])):V("",!0),r.configFile.model_name?(w(),A("div",_mt,"|")):V("",!0),r.configFile.model_name?(w(),A("div",hmt,[c("div",fmt,[c("img",{src:r.imgModel,class:"w-8 h-8 rounded-lg object-fill"},null,8,mmt),c("h3",gmt,he(r.configFile.model_name),1)])])):V("",!0)])])]),c("div",{class:ze([{hidden:s.mzc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[c("div",bmt,[c("div",Emt,[c("div",ymt,[s.searchModelInProgress?(w(),A("div",vmt,Tmt)):V("",!0),s.searchModelInProgress?V("",!0):(w(),A("div",xmt,wmt))]),G(c("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[374]||(e[374]=_=>s.searchModel=_),onKeyup:e[375]||(e[375]=Hs((..._)=>r.searchModel_func&&r.searchModel_func(..._),["enter"]))},null,544),[[we,s.searchModel]]),s.searchModel?(w(),A("button",{key:0,onClick:e[376]||(e[376]=ge(_=>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")):V("",!0)])]),c("div",null,[G(c("input",{"onUpdate:modelValue":e[377]||(e[377]=_=>s.show_only_installed_models=_),class:"m-2 p-2",type:"checkbox",ref:"only_installed"},null,512),[[Je,s.show_only_installed_models]]),Rmt]),c("div",null,[Te(l,{radioOptions:s.sortOptions,onRadioSelected:r.handleRadioSelected},null,8,["radioOptions","onRadioSelected"])]),Amt,s.is_loading_zoo?(w(),A("div",Nmt,Mmt)):V("",!0),s.models_zoo&&s.models_zoo.length>0?(w(),A("div",Dmt,[c("label",kmt," Models: ("+he(s.models_zoo.length)+") ",1),c("div",{class:ze(["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"])},[Te(as,{name:"list"},{default:We(()=>[(w(!0),A($e,null,lt(r.rendered_models_zoo,(_,m)=>(w(),xt(u,{ref_for:!0,ref:"modelZoo",key:"index-"+m+"-"+_.name,model:_,"is-installed":_.isInstalled,"on-install":r.onInstall,"on-uninstall":r.onUninstall,"on-selected":r.onModelSelected,selected:_.name===r.configFile.model_name,model_type:_.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)),c("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[378]||(e[378]=(..._)=>r.load_more_models&&r.load_more_models(..._))},"Load more models",512)]),_:1})],2)])):V("",!0),s.mzl_collapsed?(w(),A("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[379]||(e[379]=(..._)=>r.open_mzl&&r.open_mzl(..._))},Pmt)):(w(),A("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[380]||(e[380]=(..._)=>r.open_mzl&&r.open_mzl(..._))},Fmt)),c("div",Bmt,[c("div",Gmt,[c("div",null,[c("div",Vmt,[zmt,G(c("input",{type:"text","onUpdate:modelValue":e[381]||(e[381]=_=>s.reference_path=_),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),[[we,s.reference_path]])]),c("button",{type:"button",onClick:e[382]||(e[382]=ge(_=>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?V("",!0):(w(),A("div",Hmt,[c("div",qmt,[Ymt,G(c("input",{type:"text","onUpdate:modelValue":e[383]||(e[383]=_=>s.addModel.url=_),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),[[we,s.addModel.url]])]),c("button",{type:"button",onClick:e[384]||(e[384]=ge(_=>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(),A("div",$mt,[Wmt,c("div",Kmt,[c("div",jmt,[c("div",Qmt,[Xmt,c("span",Zmt,he(Math.floor(s.addModel.progress))+"%",1)]),c("div",{class:"mx-1 opacity-80 line-clamp-1",title:s.addModel.url},he(s.addModel.url),9,Jmt),c("div",egt,[c("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en({width:s.addModel.progress+"%"})},null,4)]),c("div",tgt,[c("span",ngt,"Download speed: "+he(r.speed_computed)+"/s",1),c("span",igt,he(r.downloaded_size_computed)+"/"+he(r.total_size_computed),1)])])]),c("div",sgt,[c("div",rgt,[c("div",ogt,[c("button",{onClick:e[385]||(e[385]=ge((..._)=>r.onCancelInstall&&r.onCancelInstall(..._),["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 ")])])])])):V("",!0)])])],2)]),c("div",agt,[c("div",lgt,[c("button",{onClick:e[388]||(e[388]=ge(_=>s.pzc_collapsed=!s.pzc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 text-left w-full flex items-center"},[G(c("div",null,dgt,512),[[Mt,s.pzc_collapsed]]),G(c("div",null,pgt,512),[[Mt,!s.pzc_collapsed]]),_gt,r.configFile.personalities?(w(),A("div",hgt,"|")):V("",!0),c("div",fgt,he(r.active_pesonality),1),r.configFile.personalities?(w(),A("div",mgt,"|")):V("",!0),r.configFile.personalities?(w(),A("div",ggt,[r.mountedPersArr.length>0?(w(),A("div",bgt,[(w(!0),A($e,null,lt(r.mountedPersArr,(_,m)=>(w(),A("div",{class:"relative hover:-translate-y-2 duration-300 hover:z-10 shrink-0",key:m+"-"+_.name,ref_for:!0,ref:"mountedPersonalities"},[c("div",Egt,[c("button",{onClick:ge(E=>r.onPersonalitySelected(_),["stop"])},[c("img",{src:s.bUrl+_.avatar,onError:e[386]||(e[386]=(...E)=>r.personalityImgPlacehodler&&r.personalityImgPlacehodler(...E)),class:ze(["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(_.full_path)?"border-secondary":"border-transparent z-0"]),title:_.name},null,42,vgt)],8,ygt),c("button",{onClick:ge(E=>r.unmountPersonality(_),["stop"])},xgt,8,Sgt)])]))),128))])):V("",!0)])):V("",!0),c("button",{onClick:e[387]||(e[387]=ge(_=>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"},wgt)])]),c("div",{class:ze([{hidden:s.pzc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[c("div",Rgt,[Agt,c("div",Ngt,[c("div",Ogt,[s.searchPersonalityInProgress?(w(),A("div",Igt,Dgt)):V("",!0),s.searchPersonalityInProgress?V("",!0):(w(),A("div",kgt,Pgt))]),G(c("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[389]||(e[389]=_=>s.searchPersonality=_),onKeyup:e[390]||(e[390]=ge((..._)=>r.searchPersonality_func&&r.searchPersonality_func(..._),["stop"]))},null,544),[[we,s.searchPersonality]]),s.searchPersonality?(w(),A("button",{key:0,onClick:e[391]||(e[391]=ge(_=>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")):V("",!0)])]),s.searchPersonality?V("",!0):(w(),A("div",Ugt,[c("label",Fgt," Personalities Category: ("+he(s.persCatgArr.length)+") ",1),c("select",{id:"persCat",onChange:e[392]||(e[392]=_=>r.update_personality_category(_.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),A($e,null,lt(s.persCatgArr,(_,m)=>(w(),A("option",{key:m,selected:_==this.configFile.personality_category},he(_),9,Bgt))),128))],32)])),c("div",null,[s.personalitiesFiltered.length>0?(w(),A("div",Ggt,[c("label",Vgt,he(s.searchPersonality?"Search results":"Personalities")+": ("+he(s.personalitiesFiltered.length)+") ",1),c("div",{class:ze(["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"])},[Te(as,{name:"bounce"},{default:We(()=>[(w(!0),A($e,null,lt(s.personalitiesFiltered,(_,m)=>(w(),xt(d,{ref_for:!0,ref:"personalitiesZoo",key:"index-"+m+"-"+_.name,personality:_,select_language:!0,full_path:_.full_path,selected:r.configFile.active_personality_id==r.configFile.personalities.findIndex(E=>E===_.full_path||E===_.full_path+":"+_.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,"on-copy-to_custom":r.onCopyToCustom,"on-open-folder":r.handleOpenFolder},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","on-copy-to_custom","on-open-folder"]))),128))]),_:1})],2)])):V("",!0)]),s.pzl_collapsed?(w(),A("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[393]||(e[393]=_=>s.pzl_collapsed=!s.pzl_collapsed)},Hgt)):(w(),A("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[394]||(e[394]=_=>s.pzl_collapsed=!s.pzl_collapsed)},Ygt))],2)]),c("div",$gt,[c("div",Wgt,[c("button",{onClick:e[395]||(e[395]=ge(_=>s.mc_collapsed=!s.mc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex items-center"},[G(c("div",null,jgt,512),[[Mt,s.mc_collapsed]]),G(c("div",null,Xgt,512),[[Mt,!s.mc_collapsed]]),Zgt])]),c("div",{class:ze([{hidden:s.mc_collapsed},"flex flex-col mb-2 p-2"])},[c("div",Jgt,[c("div",ebt,[G(c("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[396]||(e[396]=ge(()=>{},["stop"])),"onUpdate:modelValue":e[397]||(e[397]=_=>r.configFile.override_personality_model_parameters=_),onChange:e[398]||(e[398]=_=>r.update_setting("override_personality_model_parameters",r.configFile.override_personality_model_parameters))},null,544),[[Je,r.configFile.override_personality_model_parameters]]),tbt])]),c("div",{class:ze(r.configFile.override_personality_model_parameters?"":"pointer-events-none opacity-30")},[c("div",nbt,[ibt,G(c("input",{type:"text",id:"seed","onUpdate:modelValue":e[399]||(e[399]=_=>r.configFile.seed=_),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),[[we,r.configFile.seed]])]),c("div",sbt,[c("div",rbt,[c("div",obt,[abt,c("p",lbt,[G(c("input",{type:"text",id:"temp-val","onUpdate:modelValue":e[400]||(e[400]=_=>r.configFile.temperature=_),onChange:e[401]||(e[401]=_=>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),[[we,r.configFile.temperature]])])]),G(c("input",{id:"temperature",onChange:e[402]||(e[402]=_=>s.settingsChanged=!0),type:"range","onUpdate:modelValue":e[403]||(e[403]=_=>r.configFile.temperature=_),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),[[we,r.configFile.temperature]])])]),c("div",cbt,[c("div",dbt,[c("div",ubt,[pbt,c("p",_bt,[G(c("input",{type:"text",id:"predict-val","onUpdate:modelValue":e[404]||(e[404]=_=>r.configFile.n_predict=_),onChange:e[405]||(e[405]=_=>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),[[we,r.configFile.n_predict]])])]),G(c("input",{id:"predict",type:"range",onChange:e[406]||(e[406]=_=>s.settingsChanged=!0),"onUpdate:modelValue":e[407]||(e[407]=_=>r.configFile.n_predict=_),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),[[we,r.configFile.n_predict]])])]),c("div",hbt,[c("div",fbt,[c("div",mbt,[gbt,c("p",bbt,[G(c("input",{type:"text",id:"top_k-val","onUpdate:modelValue":e[408]||(e[408]=_=>r.configFile.top_k=_),onChange:e[409]||(e[409]=_=>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),[[we,r.configFile.top_k]])])]),G(c("input",{id:"top_k",type:"range",onChange:e[410]||(e[410]=_=>s.settingsChanged=!0),"onUpdate:modelValue":e[411]||(e[411]=_=>r.configFile.top_k=_),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),[[we,r.configFile.top_k]])])]),c("div",Ebt,[c("div",ybt,[c("div",vbt,[Sbt,c("p",Tbt,[G(c("input",{type:"text",id:"top_p-val","onUpdate:modelValue":e[412]||(e[412]=_=>r.configFile.top_p=_),onChange:e[413]||(e[413]=_=>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),[[we,r.configFile.top_p]])])]),G(c("input",{id:"top_p",type:"range","onUpdate:modelValue":e[414]||(e[414]=_=>r.configFile.top_p=_),min:"0",max:"1",step:"0.01",onChange:e[415]||(e[415]=_=>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),[[we,r.configFile.top_p]])])]),c("div",xbt,[c("div",Cbt,[c("div",wbt,[Rbt,c("p",Abt,[G(c("input",{type:"text",id:"repeat_penalty-val","onUpdate:modelValue":e[416]||(e[416]=_=>r.configFile.repeat_penalty=_),onChange:e[417]||(e[417]=_=>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),[[we,r.configFile.repeat_penalty]])])]),G(c("input",{id:"repeat_penalty",onChange:e[418]||(e[418]=_=>s.settingsChanged=!0),type:"range","onUpdate:modelValue":e[419]||(e[419]=_=>r.configFile.repeat_penalty=_),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),[[we,r.configFile.repeat_penalty]])])]),c("div",Nbt,[c("div",Obt,[c("div",Ibt,[Mbt,c("p",Dbt,[G(c("input",{type:"text",id:"repeat_last_n-val","onUpdate:modelValue":e[420]||(e[420]=_=>r.configFile.repeat_last_n=_),onChange:e[421]||(e[421]=_=>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),[[we,r.configFile.repeat_last_n]])])]),G(c("input",{id:"repeat_last_n",type:"range","onUpdate:modelValue":e[422]||(e[422]=_=>r.configFile.repeat_last_n=_),min:"0",max:"100",step:"1",onChange:e[423]||(e[423]=_=>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),[[we,r.configFile.repeat_last_n]])])])],2)],2)])],2)]),Te(h,{ref:"addmodeldialog"},null,512),Te(f,{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 Lbt=bt(Yrt,[["render",kbt],["__scopeId","data-v-5e34a141"]]),Pbt={components:{ClipBoardTextInput:xE,Card:op},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};Se.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}}},Ubt={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"},Fbt={class:"mb-4"},Bbt=c("label",{for:"model_name",class:"text-sm"},"Model Name:",-1),Gbt=["value"],Vbt={class:"mb-4"},zbt=c("label",{for:"dataset_path",class:"text-sm"},"Dataset:",-1),Hbt={class:"mb-4"},qbt=c("label",{for:"lr",class:"text-sm"},"Learning Rate:",-1),Ybt={class:"mb-4"},$bt=c("label",{for:"num_epochs",class:"text-sm"},"Number of Epochs:",-1),Wbt={class:"mb-4"},Kbt=c("label",{for:"max_length",class:"text-sm"},"Max Length:",-1),jbt={class:"mb-4"},Qbt=c("label",{for:"batch_size",class:"text-sm"},"Batch Size:",-1),Xbt={class:"mb-4"},Zbt=c("label",{for:"output_dir",class:"text-sm"},"Output Directory:",-1),Jbt=c("button",{class:"bg-blue-500 text-white px-4 py-2 rounded"},"Start training",-1),eEt={key:1};function tEt(n,e,t,i,s,r){const o=mt("Card"),a=mt("ClipBoardTextInput");return r.selectedModel!==null&&r.selectedModel.toLowerCase().includes("gptq")?(w(),A("div",Ubt,[c("form",{onSubmit:e[2]||(e[2]=ge((...l)=>r.submitForm&&r.submitForm(...l),["prevent"])),class:""},[Te(o,{title:"Training configuration",isHorizontal:!0,disableHoverAnimation:!0,disableFocus:!0},{default:We(()=>[Te(o,{title:"Model",class:"",isHorizontal:!1},{default:We(()=>[c("div",Fbt,[Bbt,G(c("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),A($e,null,lt(r.models,l=>(w(),A("option",{key:l,value:l},he(l),9,Gbt))),128))],544),[[Wt,r.selectedModel]])])]),_:1}),Te(o,{title:"Data",isHorizontal:!1},{default:We(()=>[c("div",Vbt,[zbt,Te(a,{id:"model_path",inputType:"file",value:s.dataset_path,onchange:"selectDataset()"},null,8,["value"])])]),_:1}),Te(o,{title:"Training",isHorizontal:!1},{default:We(()=>[c("div",Hbt,[qbt,Te(a,{id:"model_path",inputType:"integer",value:s.lr},null,8,["value"])]),c("div",Ybt,[$bt,Te(a,{id:"model_path",inputType:"integer",value:s.num_epochs},null,8,["value"])]),c("div",Wbt,[Kbt,Te(a,{id:"model_path",inputType:"integer",value:s.max_length},null,8,["value"])]),c("div",jbt,[Qbt,Te(a,{id:"model_path",inputType:"integer",value:s.batch_size},null,8,["value"])])]),_:1}),Te(o,{title:"Output",isHorizontal:!1},{default:We(()=>[c("div",Xbt,[Zbt,Te(a,{id:"model_path",inputType:"text",value:n.output_dir},null,8,["value"])])]),_:1})]),_:1}),Te(o,{disableHoverAnimation:!0,disableFocus:!0},{default:We(()=>[Jbt]),_:1})],32)])):(w(),A("div",eEt,[Te(o,{title:"Info",class:"",isHorizontal:!1},{default:We(()=>[et(" Only GPTQ models are supported for QLora fine tuning. Please select a GPTQ compatible binding. ")]),_:1})]))}const nEt=bt(Pbt,[["render",tEt]]),iEt={components:{ClipBoardTextInput:xE,Card:op},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)}}},sEt={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"},rEt={class:"mb-4"},oEt=c("label",{for:"model_name",class:"text-sm"},"Model Name:",-1),aEt={class:"mb-4"},lEt=c("label",{for:"tokenizer_name",class:"text-sm"},"Tokenizer Name:",-1),cEt=c("button",{type:"submit",class:"bg-blue-500 text-white px-4 py-2 rounded"},"Quantize LLM",-1);function dEt(n,e,t,i,s,r){const o=mt("ClipBoardTextInput"),a=mt("Card");return w(),A("div",sEt,[c("form",{onSubmit:e[0]||(e[0]=ge((...l)=>r.submitForm&&r.submitForm(...l),["prevent"])),class:"max-w-md mx-auto"},[Te(a,{title:"Quantizing configuration",isHorizontal:!0,disableHoverAnimation:!0,disableFocus:!0},{default:We(()=>[Te(a,{title:"Model",class:"",isHorizontal:!1},{default:We(()=>[c("div",rEt,[oEt,Te(o,{id:"model_path",inputType:"text",value:s.model_name},null,8,["value"])]),c("div",aEt,[lEt,Te(o,{id:"model_path",inputType:"text",value:s.tokenizer_name},null,8,["value"])])]),_:1})]),_:1}),Te(a,{disableHoverAnimation:!0,disableFocus:!0},{default:We(()=>[cEt]),_:1})],32)])}const uEt=bt(iEt,[["render",dEt]]),pEt={name:"Discussion",emits:["delete","select","openFolder","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,openFolder:!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")},openFolderEvent(){this.$emit("openFolder",{id:this.id})},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,Ge(()=>{He.replace()})},watch:{showConfirmation(){Ge(()=>{He.replace()})},editTitleMode(n){this.showConfirmation=n,this.editTitle=n,n&&Ge(()=>{try{this.$refs.titleBox.focus()}catch{}})},deleteMode(n){this.showConfirmation=n,n&&Ge(()=>{this.$refs.titleBox.focus()})},makeTitleMode(n){this.showConfirmation=n},checkBoxValue(n,e){this.checkBoxValue_local=n}}},_Et=["id"],hEt={class:"flex flex-row items-center gap-2"},fEt={key:0},mEt={class:"flex flex-row items-center w-full"},gEt=["title"],bEt=["value"],EEt={class:"flex items-center flex-1 max-h-6"},yEt={key:0,class:"flex gap-3 flex-1 items-center justify-end duration-75"},vEt=c("i",{"data-feather":"x"},null,-1),SEt=[vEt],TEt=c("i",{"data-feather":"check"},null,-1),xEt=[TEt],CEt={key:1,class:"flex gap-3 flex-1 items-center justify-end invisible group-hover:visible duration-75"},wEt=c("i",{"data-feather":"folder"},null,-1),REt=[wEt],AEt=c("i",{"data-feather":"type"},null,-1),NEt=[AEt],OEt=c("i",{"data-feather":"edit-2"},null,-1),IEt=[OEt],MEt=c("i",{"data-feather":"trash"},null,-1),DEt=[MEt];function kEt(n,e,t,i,s,r){return w(),A("div",{class:ze([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[13]||(e[13]=ge(o=>r.selectEvent(),["stop"]))},[c("div",hEt,[t.isCheckbox?(w(),A("div",fEt,[G(c("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]=ge(()=>{},["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),[[Je,s.checkBoxValue_local]])])):V("",!0),t.selected?(w(),A("div",{key:1,class:ze(["min-h-full w-2 rounded-xl self-stretch",t.loading?"animate-bounce bg-accent ":" bg-secondary "])},null,2)):V("",!0),t.selected?V("",!0):(w(),A("div",{key:2,class:ze(["w-2",t.loading?"min-h-full w-2 rounded-xl self-stretch animate-bounce bg-accent ":" "])},null,2))]),c("div",mEt,[s.editTitle?V("",!0):(w(),A("p",{key:0,title:t.title,class:"line-clamp-1 w-4/6 ml-1 -mx-5"},he(t.title?t.title==="untitled"?"New discussion":t.title:"New discussion"),9,gEt)),s.editTitle?(w(),A("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]=Hs(ge(o=>r.editTitleEvent(),["exact"]),["enter"])),e[4]||(e[4]=Hs(ge(o=>s.editTitleMode=!1,["exact"]),["esc"]))],onInput:e[5]||(e[5]=o=>r.chnageTitle(o.target.value)),onClick:e[6]||(e[6]=ge(()=>{},["stop"]))},null,40,bEt)):V("",!0),c("div",EEt,[s.showConfirmation?(w(),A("div",yEt,[c("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Discard title changes",type:"button",onClick:e[7]||(e[7]=ge(o=>r.cancel(),["stop"]))},SEt),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm title changes",type:"button",onClick:e[8]||(e[8]=ge(o=>s.editTitleMode?r.editTitleEvent():s.deleteMode?r.deleteEvent():r.makeTitleEvent(),["stop"]))},xEt)])):V("",!0),s.showConfirmation?V("",!0):(w(),A("div",CEt,[c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Open folder",type:"button",onClick:e[9]||(e[9]=ge(o=>r.openFolderEvent(),["stop"]))},REt),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Make a title",type:"button",onClick:e[10]||(e[10]=ge(o=>s.makeTitleMode=!0,["stop"]))},NEt),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Edit title",type:"button",onClick:e[11]||(e[11]=ge(o=>s.editTitleMode=!0,["stop"]))},IEt),c("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Remove discussion",type:"button",onClick:e[12]||(e[12]=ge(o=>s.deleteMode=!0,["stop"]))},DEt)]))])])],10,_Et)}const RE=bt(pEt,[["render",kEt]]),LEt={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}}},PEt={key:0,class:"fixed top-0 left-0 w-full h-full flex justify-center items-center bg-black bg-opacity-50"},UEt={class:"bg-white p-8 rounded"},FEt={class:"text-xl font-bold mb-4"};function BEt(n,e,t,i,s,r){return w(),A("div",null,[s.show?(w(),A("div",PEt,[c("div",UEt,[c("h2",FEt,he(t.promptText),1),G(c("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),[[we,s.inputText]]),c("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"),c("button",{onClick:e[2]||(e[2]=(...o)=>r.cancel&&r.cancel(...o)),class:"bg-gray-500 text-white px-4 py-2 rounded"},"Cancel")])])):V("",!0)])}const mO=bt(LEt,[["render",BEt]]),GEt={data(){return{id:0,loading:!1,isCheckbox:!1,isVisible:!1,categories:[],titles:[],content:"",searchQuery:""}},components:{Discussion:RE,MarkdownRenderer:sp},props:{host:{type:String,required:!1,default:"http://localhost:9600"}},methods:{showSkillsLibrary(){this.isVisible=!0,this.fetchTitles()},closeComponent(){this.isVisible=!1},fetchCategories(){Se.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"),Se.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){Se.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),Se.post("/delete_skill",{client_id:this.$store.state.client_id,skill_id:n}).then(()=>{this.fetchTitles()})},editTitle(n){Se.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(){}}},VEt={id:"leftPanel",class:"flex flex-row h-full flex-grow shadow-lg rounded"},zEt={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"},HEt={class:"search p-4"},qEt={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"},YEt=c("h2",{class:"text-xl font-bold m-4"},"Titles",-1),$Et={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"},WEt=c("h2",{class:"text-xl font-bold m-4"},"Content",-1);function KEt(n,e,t,i,s,r){const o=mt("Discussion"),a=mt("MarkdownRenderer");return w(),A("div",{class:ze([{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"])},[c("div",VEt,[c("div",zEt,[c("div",HEt,[G(c("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),[[we,s.searchQuery]]),c("button",{onClick:e[1]||(e[1]=(...l)=>r.searchSkills&&r.searchSkills(...l)),class:"bg-blue-500 text-white rounded px-4 py-1"},"Search")]),c("div",qEt,[YEt,s.titles.length>0?(w(),xt(as,{key:0,name:"list"},{default:We(()=>[(w(!0),A($e,null,lt(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:u=>r.fetchContent(l.id),onDelete:u=>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})):V("",!0)])]),c("div",$Et,[WEt,Te(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"])])]),c("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 gO=bt(GEt,[["render",KEt]]),jEt={props:{htmlContent:{type:String,required:!0}}},QEt=["innerHTML"];function XEt(n,e,t,i,s,r){return w(),A("div",{class:"w-full h-full 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",innerHTML:t.htmlContent},null,8,QEt)}const ZEt=bt(jEt,[["render",XEt]]);const JEt={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}}},eyt={key:0},tyt={class:"toggle-icon mr-1"},nyt={key:0,class:"fas fa-plus-circle text-gray-600"},iyt={key:1,class:"fas fa-minus-circle text-gray-600"},syt={class:"json-viewer max-h-64 overflow-auto p-4 bg-gray-100 border border-gray-300 rounded dark:bg-gray-600"},ryt={key:0,class:"fas fa-plus-circle text-gray-600"},oyt={key:1,class:"fas fa-minus-circle text-gray-600"},ayt=["innerHTML"];function lyt(n,e,t,i,s,r){return r.isContentPresent?(w(),A("div",eyt,[c("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))},[c("span",tyt,[s.collapsed?(w(),A("i",nyt)):(w(),A("i",iyt))]),et(" "+he(t.jsonFormText),1)]),G(c("div",null,[c("div",syt,[r.isObject?(w(),A("span",{key:0,onClick:e[1]||(e[1]=(...o)=>r.toggleCollapsed&&r.toggleCollapsed(...o)),class:"toggle-icon cursor-pointer mr-1"},[s.collapsed?(w(),A("i",ryt)):(w(),A("i",oyt))])):V("",!0),c("pre",{innerHTML:r.formattedJson},null,8,ayt)])],512),[[Mt,!s.collapsed]])])):V("",!0)}const cyt=bt(JEt,[["render",lyt]]),dyt={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"}}},uyt={class:"flex items-start"},pyt={class:"step flex items-center mb-4"},_yt={key:0,class:"flex items-center justify-center w-6 h-6 mr-2"},hyt={key:0},fyt=c("i",{"data-feather":"square",class:"text-gray-400 w-4 h-4"},null,-1),myt=[fyt],gyt={key:1},byt=c("i",{"data-feather":"check-square",class:"text-green-500 w-4 h-4"},null,-1),Eyt=[byt],yyt={key:2},vyt=c("i",{"data-feather":"x-square",class:"text-red-500 w-4 h-4"},null,-1),Syt=[vyt],Tyt={key:1,role:"status",class:"m-15"},xyt=c("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"},[c("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"}),c("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),Cyt=[xyt],wyt={class:"text-sm ml-6"};function Ryt(n,e,t,i,s,r){return w(),A("div",uyt,[c("div",pyt,[t.step_type=="start_end"?(w(),A("div",_yt,[t.done?V("",!0):(w(),A("div",hyt,myt)),t.done&&t.status?(w(),A("div",gyt,Eyt)):V("",!0),t.done&&!t.status?(w(),A("div",yyt,Syt)):V("",!0)])):V("",!0),t.done?V("",!0):(w(),A("div",Tyt,Cyt)),c("h3",wyt,he(t.message),1)])])}const Ayt=bt(dyt,[["render",Ryt]]),Nyt="/assets/process-61f7a21b.svg",Oyt="/assets/ok-a0b56451.svg",Iyt="/assets/failed-183609e7.svg",bO="/assets/send_globe-305330b9.svg";const Myt="/",Dyt={name:"Message",emits:["copy","delete","rankUp","rankDown","updateMessage","resendMessage","continueMessage"],components:{MarkdownRenderer:sp,Step:Ayt,RenderHTMLJS:ZEt,JsonViewer:cyt,DynamicUIRenderer:fO},props:{host:{type:String,required:!1,default:"http://localhost:9600"},message:Object,avatar:{default:""}},data(){return{ui_componentKey:0,isSynthesizingVoice:!1,cpp_block:cO,html5_block:dO,LaTeX_block:uO,json_block:lO,javascript_block:aO,process_svg:Nyt,ok_svg:Oyt,failed_svg:Iyt,loading_svg:_O,sendGlobe:bO,code_block:rO,python_block:oO,bash_block:pO,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."),Ge(()=>{He.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`))},_ft)])]),c("tr",null,[hft,c("td",null,[c("div",fft,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[356]||(e[356]=(..._)=>r.reinstallPetalsService&&r.reinstallPetalsService(..._))},"install petals service")])])]),c("tr",null,[mft,c("td",null,[c("div",gft,[G(c("input",{type:"text",id:"petals_base_url",required:"","onUpdate:modelValue":e[357]||(e[357]=_=>r.configFile.petals_base_url=_),onChange:e[358]||(e[358]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.petals_base_url]])])])])])]),_:1})]),_:1}),Te(o,{title:"Misc",is_shrunk:!0,is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[Te(o,{title:"Motion Ctrl service",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",bft,[c("tr",null,[Eft,c("td",null,[c("div",yft,[G(c("input",{type:"checkbox",id:"enable_motion_ctrl_service",required:"","onUpdate:modelValue":e[359]||(e[359]=_=>r.configFile.enable_motion_ctrl_service=_),onChange:e[360]||(e[360]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.enable_motion_ctrl_service]])])]),c("td",null,[c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[361]||(e[361]=_=>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"))},Sft)])]),c("tr",null,[Tft,c("td",null,[c("div",xft,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[362]||(e[362]=(..._)=>r.reinstallMotionCtrlService&&r.reinstallMotionCtrlService(..._))},"install Motion Ctrl service")])])]),c("tr",null,[Cft,c("td",null,[c("div",wft,[G(c("input",{type:"text",id:"sd_base_url",required:"","onUpdate:modelValue":e[363]||(e[363]=_=>r.configFile.sd_base_url=_),onChange:e[364]||(e[364]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.sd_base_url]])])])])])]),_:1}),Te(o,{title:"Elastic search Service (under construction)",is_subcard:!0,class:"pb-2 m-2"},{default:We(()=>[c("table",Rft,[c("tr",null,[Aft,c("td",null,[c("div",Nft,[G(c("input",{type:"checkbox",id:"elastic_search_service",required:"","onUpdate:modelValue":e[365]||(e[365]=_=>r.configFile.elastic_search_service=_),onChange:e[366]||(e[366]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,r.configFile.elastic_search_service]])])])]),c("tr",null,[Oft,c("td",null,[c("div",Ift,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[367]||(e[367]=(..._)=>r.reinstallElasticSearchService&&r.reinstallElasticSearchService(..._))},"install ElasticSearch service")])])]),c("tr",null,[Mft,c("td",null,[c("div",Dft,[G(c("input",{type:"text",id:"elastic_search_url",required:"","onUpdate:modelValue":e[368]||(e[368]=_=>r.configFile.elastic_search_url=_),onChange:e[369]||(e[369]=_=>s.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[we,r.configFile.elastic_search_url]])])])])])]),_:1})]),_:1})],2)]),c("div",kft,[c("div",Lft,[c("button",{onClick:e[370]||(e[370]=ge(_=>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"},[G(c("div",null,Uft,512),[[Mt,s.bzc_collapsed]]),G(c("div",null,Bft,512),[[Mt,!s.bzc_collapsed]]),Gft,r.configFile.binding_name?V("",!0):(w(),A("div",Vft,[zft,et(" No binding selected! ")])),r.configFile.binding_name?(w(),A("div",Hft,"|")):V("",!0),r.configFile.binding_name?(w(),A("div",qft,[c("div",Yft,[c("img",{src:r.imgBinding,class:"w-8 h-8 rounded-full object-fill text-blue-700"},null,8,$ft),c("h3",Wft,he(r.binding_name),1)])])):V("",!0)])]),c("div",{class:ze([{hidden:s.bzc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[r.bindingsZoo&&r.bindingsZoo.length>0?(w(),A("div",Kft,[c("label",jft," Bindings: ("+he(r.bindingsZoo.length)+") ",1),c("div",{class:ze(["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"])},[Te(as,{name:"list"},{default:We(()=>[(w(!0),A($e,null,lt(r.bindingsZoo,(_,m)=>(w(),xt(a,{ref_for:!0,ref:"bindingZoo",key:"index-"+m+"-"+_.folder,binding:_,"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:_.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)])):V("",!0),s.bzl_collapsed?(w(),A("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[371]||(e[371]=_=>s.bzl_collapsed=!s.bzl_collapsed)},Xft)):(w(),A("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[372]||(e[372]=_=>s.bzl_collapsed=!s.bzl_collapsed)},Jft))],2)]),c("div",emt,[c("div",tmt,[c("button",{onClick:e[373]||(e[373]=ge(_=>r.modelsZooToggleCollapse(),["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex items-center"},[G(c("div",null,imt,512),[[Mt,s.mzc_collapsed]]),G(c("div",null,rmt,512),[[Mt,!s.mzc_collapsed]]),omt,c("div",amt,[r.configFile.binding_name?V("",!0):(w(),A("div",lmt,[cmt,et(" Select binding first! ")])),!r.configFile.model_name&&r.configFile.binding_name?(w(),A("div",dmt,[umt,et(" No model selected! ")])):V("",!0),r.configFile.model_name?(w(),A("div",pmt,"|")):V("",!0),r.configFile.model_name?(w(),A("div",_mt,[c("div",hmt,[c("img",{src:r.imgModel,class:"w-8 h-8 rounded-lg object-fill"},null,8,fmt),c("h3",mmt,he(r.configFile.model_name),1)])])):V("",!0)])])]),c("div",{class:ze([{hidden:s.mzc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[c("div",gmt,[c("div",bmt,[c("div",Emt,[s.searchModelInProgress?(w(),A("div",ymt,Smt)):V("",!0),s.searchModelInProgress?V("",!0):(w(),A("div",Tmt,Cmt))]),G(c("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[374]||(e[374]=_=>s.searchModel=_),onKeyup:e[375]||(e[375]=Hs((..._)=>r.searchModel_func&&r.searchModel_func(..._),["enter"]))},null,544),[[we,s.searchModel]]),s.searchModel?(w(),A("button",{key:0,onClick:e[376]||(e[376]=ge(_=>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")):V("",!0)])]),c("div",null,[G(c("input",{"onUpdate:modelValue":e[377]||(e[377]=_=>s.show_only_installed_models=_),class:"m-2 p-2",type:"checkbox",ref:"only_installed"},null,512),[[Je,s.show_only_installed_models]]),wmt]),c("div",null,[Te(l,{radioOptions:s.sortOptions,onRadioSelected:r.handleRadioSelected},null,8,["radioOptions","onRadioSelected"])]),Rmt,s.is_loading_zoo?(w(),A("div",Amt,Imt)):V("",!0),s.models_zoo&&s.models_zoo.length>0?(w(),A("div",Mmt,[c("label",Dmt," Models: ("+he(s.models_zoo.length)+") ",1),c("div",{class:ze(["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"])},[Te(as,{name:"list"},{default:We(()=>[(w(!0),A($e,null,lt(r.rendered_models_zoo,(_,m)=>(w(),xt(u,{ref_for:!0,ref:"modelZoo",key:"index-"+m+"-"+_.name,model:_,"is-installed":_.isInstalled,"on-install":r.onInstall,"on-uninstall":r.onUninstall,"on-selected":r.onModelSelected,selected:_.name===r.configFile.model_name,model_type:_.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)),c("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[378]||(e[378]=(..._)=>r.load_more_models&&r.load_more_models(..._))},"Load more models",512)]),_:1})],2)])):V("",!0),s.mzl_collapsed?(w(),A("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[379]||(e[379]=(..._)=>r.open_mzl&&r.open_mzl(..._))},Lmt)):(w(),A("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[380]||(e[380]=(..._)=>r.open_mzl&&r.open_mzl(..._))},Umt)),c("div",Fmt,[c("div",Bmt,[c("div",null,[c("div",Gmt,[Vmt,G(c("input",{type:"text","onUpdate:modelValue":e[381]||(e[381]=_=>s.reference_path=_),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),[[we,s.reference_path]])]),c("button",{type:"button",onClick:e[382]||(e[382]=ge(_=>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?V("",!0):(w(),A("div",zmt,[c("div",Hmt,[qmt,G(c("input",{type:"text","onUpdate:modelValue":e[383]||(e[383]=_=>s.addModel.url=_),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),[[we,s.addModel.url]])]),c("button",{type:"button",onClick:e[384]||(e[384]=ge(_=>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(),A("div",Ymt,[$mt,c("div",Wmt,[c("div",Kmt,[c("div",jmt,[Qmt,c("span",Xmt,he(Math.floor(s.addModel.progress))+"%",1)]),c("div",{class:"mx-1 opacity-80 line-clamp-1",title:s.addModel.url},he(s.addModel.url),9,Zmt),c("div",Jmt,[c("div",{class:"bg-blue-600 h-2.5 rounded-full",style:en({width:s.addModel.progress+"%"})},null,4)]),c("div",egt,[c("span",tgt,"Download speed: "+he(r.speed_computed)+"/s",1),c("span",ngt,he(r.downloaded_size_computed)+"/"+he(r.total_size_computed),1)])])]),c("div",igt,[c("div",sgt,[c("div",rgt,[c("button",{onClick:e[385]||(e[385]=ge((..._)=>r.onCancelInstall&&r.onCancelInstall(..._),["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 ")])])])])):V("",!0)])])],2)]),c("div",ogt,[c("div",agt,[c("button",{onClick:e[388]||(e[388]=ge(_=>s.pzc_collapsed=!s.pzc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 text-left w-full flex items-center"},[G(c("div",null,cgt,512),[[Mt,s.pzc_collapsed]]),G(c("div",null,ugt,512),[[Mt,!s.pzc_collapsed]]),pgt,r.configFile.personalities?(w(),A("div",_gt,"|")):V("",!0),c("div",hgt,he(r.active_pesonality),1),r.configFile.personalities?(w(),A("div",fgt,"|")):V("",!0),r.configFile.personalities?(w(),A("div",mgt,[r.mountedPersArr.length>0?(w(),A("div",ggt,[(w(!0),A($e,null,lt(r.mountedPersArr,(_,m)=>(w(),A("div",{class:"relative hover:-translate-y-2 duration-300 hover:z-10 shrink-0",key:m+"-"+_.name,ref_for:!0,ref:"mountedPersonalities"},[c("div",bgt,[c("button",{onClick:ge(E=>r.onPersonalitySelected(_),["stop"])},[c("img",{src:s.bUrl+_.avatar,onError:e[386]||(e[386]=(...E)=>r.personalityImgPlacehodler&&r.personalityImgPlacehodler(...E)),class:ze(["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(_.full_path)?"border-secondary":"border-transparent z-0"]),title:_.name},null,42,ygt)],8,Egt),c("button",{onClick:ge(E=>r.unmountPersonality(_),["stop"])},Tgt,8,vgt)])]))),128))])):V("",!0)])):V("",!0),c("button",{onClick:e[387]||(e[387]=ge(_=>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"},Cgt)])]),c("div",{class:ze([{hidden:s.pzc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[c("div",wgt,[Rgt,c("div",Agt,[c("div",Ngt,[s.searchPersonalityInProgress?(w(),A("div",Ogt,Mgt)):V("",!0),s.searchPersonalityInProgress?V("",!0):(w(),A("div",Dgt,Lgt))]),G(c("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[389]||(e[389]=_=>s.searchPersonality=_),onKeyup:e[390]||(e[390]=ge((..._)=>r.searchPersonality_func&&r.searchPersonality_func(..._),["stop"]))},null,544),[[we,s.searchPersonality]]),s.searchPersonality?(w(),A("button",{key:0,onClick:e[391]||(e[391]=ge(_=>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")):V("",!0)])]),s.searchPersonality?V("",!0):(w(),A("div",Pgt,[c("label",Ugt," Personalities Category: ("+he(s.persCatgArr.length)+") ",1),c("select",{id:"persCat",onChange:e[392]||(e[392]=_=>r.update_personality_category(_.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),A($e,null,lt(s.persCatgArr,(_,m)=>(w(),A("option",{key:m,selected:_==this.configFile.personality_category},he(_),9,Fgt))),128))],32)])),c("div",null,[s.personalitiesFiltered.length>0?(w(),A("div",Bgt,[c("label",Ggt,he(s.searchPersonality?"Search results":"Personalities")+": ("+he(s.personalitiesFiltered.length)+") ",1),c("div",{class:ze(["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"])},[Te(as,{name:"bounce"},{default:We(()=>[(w(!0),A($e,null,lt(s.personalitiesFiltered,(_,m)=>(w(),xt(d,{ref_for:!0,ref:"personalitiesZoo",key:"index-"+m+"-"+_.name,personality:_,select_language:!0,full_path:_.full_path,selected:r.configFile.active_personality_id==r.configFile.personalities.findIndex(E=>E===_.full_path||E===_.full_path+":"+_.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,"on-copy-to_custom":r.onCopyToCustom,"on-open-folder":r.handleOpenFolder},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","on-copy-to_custom","on-open-folder"]))),128))]),_:1})],2)])):V("",!0)]),s.pzl_collapsed?(w(),A("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[393]||(e[393]=_=>s.pzl_collapsed=!s.pzl_collapsed)},zgt)):(w(),A("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[394]||(e[394]=_=>s.pzl_collapsed=!s.pzl_collapsed)},qgt))],2)]),c("div",Ygt,[c("div",$gt,[c("button",{onClick:e[395]||(e[395]=ge(_=>s.mc_collapsed=!s.mc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex items-center"},[G(c("div",null,Kgt,512),[[Mt,s.mc_collapsed]]),G(c("div",null,Qgt,512),[[Mt,!s.mc_collapsed]]),Xgt])]),c("div",{class:ze([{hidden:s.mc_collapsed},"flex flex-col mb-2 p-2"])},[c("div",Zgt,[c("div",Jgt,[G(c("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[396]||(e[396]=ge(()=>{},["stop"])),"onUpdate:modelValue":e[397]||(e[397]=_=>r.configFile.override_personality_model_parameters=_),onChange:e[398]||(e[398]=_=>r.update_setting("override_personality_model_parameters",r.configFile.override_personality_model_parameters))},null,544),[[Je,r.configFile.override_personality_model_parameters]]),ebt])]),c("div",{class:ze(r.configFile.override_personality_model_parameters?"":"pointer-events-none opacity-30")},[c("div",tbt,[nbt,G(c("input",{type:"text",id:"seed","onUpdate:modelValue":e[399]||(e[399]=_=>r.configFile.seed=_),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),[[we,r.configFile.seed]])]),c("div",ibt,[c("div",sbt,[c("div",rbt,[obt,c("p",abt,[G(c("input",{type:"text",id:"temp-val","onUpdate:modelValue":e[400]||(e[400]=_=>r.configFile.temperature=_),onChange:e[401]||(e[401]=_=>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),[[we,r.configFile.temperature]])])]),G(c("input",{id:"temperature",onChange:e[402]||(e[402]=_=>s.settingsChanged=!0),type:"range","onUpdate:modelValue":e[403]||(e[403]=_=>r.configFile.temperature=_),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),[[we,r.configFile.temperature]])])]),c("div",lbt,[c("div",cbt,[c("div",dbt,[ubt,c("p",pbt,[G(c("input",{type:"text",id:"predict-val","onUpdate:modelValue":e[404]||(e[404]=_=>r.configFile.n_predict=_),onChange:e[405]||(e[405]=_=>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),[[we,r.configFile.n_predict]])])]),G(c("input",{id:"predict",type:"range",onChange:e[406]||(e[406]=_=>s.settingsChanged=!0),"onUpdate:modelValue":e[407]||(e[407]=_=>r.configFile.n_predict=_),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),[[we,r.configFile.n_predict]])])]),c("div",_bt,[c("div",hbt,[c("div",fbt,[mbt,c("p",gbt,[G(c("input",{type:"text",id:"top_k-val","onUpdate:modelValue":e[408]||(e[408]=_=>r.configFile.top_k=_),onChange:e[409]||(e[409]=_=>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),[[we,r.configFile.top_k]])])]),G(c("input",{id:"top_k",type:"range",onChange:e[410]||(e[410]=_=>s.settingsChanged=!0),"onUpdate:modelValue":e[411]||(e[411]=_=>r.configFile.top_k=_),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),[[we,r.configFile.top_k]])])]),c("div",bbt,[c("div",Ebt,[c("div",ybt,[vbt,c("p",Sbt,[G(c("input",{type:"text",id:"top_p-val","onUpdate:modelValue":e[412]||(e[412]=_=>r.configFile.top_p=_),onChange:e[413]||(e[413]=_=>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),[[we,r.configFile.top_p]])])]),G(c("input",{id:"top_p",type:"range","onUpdate:modelValue":e[414]||(e[414]=_=>r.configFile.top_p=_),min:"0",max:"1",step:"0.01",onChange:e[415]||(e[415]=_=>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),[[we,r.configFile.top_p]])])]),c("div",Tbt,[c("div",xbt,[c("div",Cbt,[wbt,c("p",Rbt,[G(c("input",{type:"text",id:"repeat_penalty-val","onUpdate:modelValue":e[416]||(e[416]=_=>r.configFile.repeat_penalty=_),onChange:e[417]||(e[417]=_=>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),[[we,r.configFile.repeat_penalty]])])]),G(c("input",{id:"repeat_penalty",onChange:e[418]||(e[418]=_=>s.settingsChanged=!0),type:"range","onUpdate:modelValue":e[419]||(e[419]=_=>r.configFile.repeat_penalty=_),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),[[we,r.configFile.repeat_penalty]])])]),c("div",Abt,[c("div",Nbt,[c("div",Obt,[Ibt,c("p",Mbt,[G(c("input",{type:"text",id:"repeat_last_n-val","onUpdate:modelValue":e[420]||(e[420]=_=>r.configFile.repeat_last_n=_),onChange:e[421]||(e[421]=_=>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),[[we,r.configFile.repeat_last_n]])])]),G(c("input",{id:"repeat_last_n",type:"range","onUpdate:modelValue":e[422]||(e[422]=_=>r.configFile.repeat_last_n=_),min:"0",max:"100",step:"1",onChange:e[423]||(e[423]=_=>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),[[we,r.configFile.repeat_last_n]])])])],2)],2)])],2)]),Te(h,{ref:"addmodeldialog"},null,512),Te(f,{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 kbt=bt(qrt,[["render",Dbt],["__scopeId","data-v-5e34a141"]]),Lbt={components:{ClipBoardTextInput:xE,Card:op},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};Se.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}}},Pbt={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"},Ubt={class:"mb-4"},Fbt=c("label",{for:"model_name",class:"text-sm"},"Model Name:",-1),Bbt=["value"],Gbt={class:"mb-4"},Vbt=c("label",{for:"dataset_path",class:"text-sm"},"Dataset:",-1),zbt={class:"mb-4"},Hbt=c("label",{for:"lr",class:"text-sm"},"Learning Rate:",-1),qbt={class:"mb-4"},Ybt=c("label",{for:"num_epochs",class:"text-sm"},"Number of Epochs:",-1),$bt={class:"mb-4"},Wbt=c("label",{for:"max_length",class:"text-sm"},"Max Length:",-1),Kbt={class:"mb-4"},jbt=c("label",{for:"batch_size",class:"text-sm"},"Batch Size:",-1),Qbt={class:"mb-4"},Xbt=c("label",{for:"output_dir",class:"text-sm"},"Output Directory:",-1),Zbt=c("button",{class:"bg-blue-500 text-white px-4 py-2 rounded"},"Start training",-1),Jbt={key:1};function eEt(n,e,t,i,s,r){const o=mt("Card"),a=mt("ClipBoardTextInput");return r.selectedModel!==null&&r.selectedModel.toLowerCase().includes("gptq")?(w(),A("div",Pbt,[c("form",{onSubmit:e[2]||(e[2]=ge((...l)=>r.submitForm&&r.submitForm(...l),["prevent"])),class:""},[Te(o,{title:"Training configuration",isHorizontal:!0,disableHoverAnimation:!0,disableFocus:!0},{default:We(()=>[Te(o,{title:"Model",class:"",isHorizontal:!1},{default:We(()=>[c("div",Ubt,[Fbt,G(c("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),A($e,null,lt(r.models,l=>(w(),A("option",{key:l,value:l},he(l),9,Bbt))),128))],544),[[Wt,r.selectedModel]])])]),_:1}),Te(o,{title:"Data",isHorizontal:!1},{default:We(()=>[c("div",Gbt,[Vbt,Te(a,{id:"model_path",inputType:"file",value:s.dataset_path,onchange:"selectDataset()"},null,8,["value"])])]),_:1}),Te(o,{title:"Training",isHorizontal:!1},{default:We(()=>[c("div",zbt,[Hbt,Te(a,{id:"model_path",inputType:"integer",value:s.lr},null,8,["value"])]),c("div",qbt,[Ybt,Te(a,{id:"model_path",inputType:"integer",value:s.num_epochs},null,8,["value"])]),c("div",$bt,[Wbt,Te(a,{id:"model_path",inputType:"integer",value:s.max_length},null,8,["value"])]),c("div",Kbt,[jbt,Te(a,{id:"model_path",inputType:"integer",value:s.batch_size},null,8,["value"])])]),_:1}),Te(o,{title:"Output",isHorizontal:!1},{default:We(()=>[c("div",Qbt,[Xbt,Te(a,{id:"model_path",inputType:"text",value:n.output_dir},null,8,["value"])])]),_:1})]),_:1}),Te(o,{disableHoverAnimation:!0,disableFocus:!0},{default:We(()=>[Zbt]),_:1})],32)])):(w(),A("div",Jbt,[Te(o,{title:"Info",class:"",isHorizontal:!1},{default:We(()=>[et(" Only GPTQ models are supported for QLora fine tuning. Please select a GPTQ compatible binding. ")]),_:1})]))}const tEt=bt(Lbt,[["render",eEt]]),nEt={components:{ClipBoardTextInput:xE,Card:op},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)}}},iEt={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"},sEt={class:"mb-4"},rEt=c("label",{for:"model_name",class:"text-sm"},"Model Name:",-1),oEt={class:"mb-4"},aEt=c("label",{for:"tokenizer_name",class:"text-sm"},"Tokenizer Name:",-1),lEt=c("button",{type:"submit",class:"bg-blue-500 text-white px-4 py-2 rounded"},"Quantize LLM",-1);function cEt(n,e,t,i,s,r){const o=mt("ClipBoardTextInput"),a=mt("Card");return w(),A("div",iEt,[c("form",{onSubmit:e[0]||(e[0]=ge((...l)=>r.submitForm&&r.submitForm(...l),["prevent"])),class:"max-w-md mx-auto"},[Te(a,{title:"Quantizing configuration",isHorizontal:!0,disableHoverAnimation:!0,disableFocus:!0},{default:We(()=>[Te(a,{title:"Model",class:"",isHorizontal:!1},{default:We(()=>[c("div",sEt,[rEt,Te(o,{id:"model_path",inputType:"text",value:s.model_name},null,8,["value"])]),c("div",oEt,[aEt,Te(o,{id:"model_path",inputType:"text",value:s.tokenizer_name},null,8,["value"])])]),_:1})]),_:1}),Te(a,{disableHoverAnimation:!0,disableFocus:!0},{default:We(()=>[lEt]),_:1})],32)])}const dEt=bt(nEt,[["render",cEt]]),uEt={name:"Discussion",emits:["delete","select","openFolder","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,openFolder:!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")},openFolderEvent(){this.$emit("openFolder",{id:this.id})},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,Ge(()=>{He.replace()})},watch:{showConfirmation(){Ge(()=>{He.replace()})},editTitleMode(n){this.showConfirmation=n,this.editTitle=n,n&&Ge(()=>{try{this.$refs.titleBox.focus()}catch{}})},deleteMode(n){this.showConfirmation=n,n&&Ge(()=>{this.$refs.titleBox.focus()})},makeTitleMode(n){this.showConfirmation=n},checkBoxValue(n,e){this.checkBoxValue_local=n}}},pEt=["id"],_Et={class:"flex flex-row items-center gap-2"},hEt={key:0},fEt={class:"flex flex-row items-center w-full"},mEt=["title"],gEt=["value"],bEt={class:"flex items-center flex-1 max-h-6"},EEt={key:0,class:"flex gap-3 flex-1 items-center justify-end duration-75"},yEt=c("i",{"data-feather":"x"},null,-1),vEt=[yEt],SEt=c("i",{"data-feather":"check"},null,-1),TEt=[SEt],xEt={key:1,class:"flex gap-3 flex-1 items-center justify-end invisible group-hover:visible duration-75"},CEt=c("i",{"data-feather":"folder"},null,-1),wEt=[CEt],REt=c("i",{"data-feather":"type"},null,-1),AEt=[REt],NEt=c("i",{"data-feather":"edit-2"},null,-1),OEt=[NEt],IEt=c("i",{"data-feather":"trash"},null,-1),MEt=[IEt];function DEt(n,e,t,i,s,r){return w(),A("div",{class:ze([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[13]||(e[13]=ge(o=>r.selectEvent(),["stop"]))},[c("div",_Et,[t.isCheckbox?(w(),A("div",hEt,[G(c("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]=ge(()=>{},["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),[[Je,s.checkBoxValue_local]])])):V("",!0),t.selected?(w(),A("div",{key:1,class:ze(["min-h-full w-2 rounded-xl self-stretch",t.loading?"animate-bounce bg-accent ":" bg-secondary "])},null,2)):V("",!0),t.selected?V("",!0):(w(),A("div",{key:2,class:ze(["w-2",t.loading?"min-h-full w-2 rounded-xl self-stretch animate-bounce bg-accent ":" "])},null,2))]),c("div",fEt,[s.editTitle?V("",!0):(w(),A("p",{key:0,title:t.title,class:"line-clamp-1 w-4/6 ml-1 -mx-5"},he(t.title?t.title==="untitled"?"New discussion":t.title:"New discussion"),9,mEt)),s.editTitle?(w(),A("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]=Hs(ge(o=>r.editTitleEvent(),["exact"]),["enter"])),e[4]||(e[4]=Hs(ge(o=>s.editTitleMode=!1,["exact"]),["esc"]))],onInput:e[5]||(e[5]=o=>r.chnageTitle(o.target.value)),onClick:e[6]||(e[6]=ge(()=>{},["stop"]))},null,40,gEt)):V("",!0),c("div",bEt,[s.showConfirmation?(w(),A("div",EEt,[c("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Discard title changes",type:"button",onClick:e[7]||(e[7]=ge(o=>r.cancel(),["stop"]))},vEt),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm title changes",type:"button",onClick:e[8]||(e[8]=ge(o=>s.editTitleMode?r.editTitleEvent():s.deleteMode?r.deleteEvent():r.makeTitleEvent(),["stop"]))},TEt)])):V("",!0),s.showConfirmation?V("",!0):(w(),A("div",xEt,[c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Open folder",type:"button",onClick:e[9]||(e[9]=ge(o=>r.openFolderEvent(),["stop"]))},wEt),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Make a title",type:"button",onClick:e[10]||(e[10]=ge(o=>s.makeTitleMode=!0,["stop"]))},AEt),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Edit title",type:"button",onClick:e[11]||(e[11]=ge(o=>s.editTitleMode=!0,["stop"]))},OEt),c("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Remove discussion",type:"button",onClick:e[12]||(e[12]=ge(o=>s.deleteMode=!0,["stop"]))},MEt)]))])])],10,pEt)}const RE=bt(uEt,[["render",DEt]]),kEt={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}}},LEt={key:0,class:"fixed top-0 left-0 w-full h-full flex justify-center items-center bg-black bg-opacity-50"},PEt={class:"bg-white p-8 rounded"},UEt={class:"text-xl font-bold mb-4"};function FEt(n,e,t,i,s,r){return w(),A("div",null,[s.show?(w(),A("div",LEt,[c("div",PEt,[c("h2",UEt,he(t.promptText),1),G(c("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),[[we,s.inputText]]),c("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"),c("button",{onClick:e[2]||(e[2]=(...o)=>r.cancel&&r.cancel(...o)),class:"bg-gray-500 text-white px-4 py-2 rounded"},"Cancel")])])):V("",!0)])}const mO=bt(kEt,[["render",FEt]]),BEt={data(){return{id:0,loading:!1,isCheckbox:!1,isVisible:!1,categories:[],titles:[],content:"",searchQuery:""}},components:{Discussion:RE,MarkdownRenderer:sp},props:{host:{type:String,required:!1,default:"http://localhost:9600"}},methods:{showSkillsLibrary(){this.isVisible=!0,this.fetchTitles()},closeComponent(){this.isVisible=!1},fetchCategories(){Se.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"),Se.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){Se.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),Se.post("/delete_skill",{client_id:this.$store.state.client_id,skill_id:n}).then(()=>{this.fetchTitles()})},editTitle(n){Se.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(){}}},GEt={id:"leftPanel",class:"flex flex-row h-full flex-grow shadow-lg rounded"},VEt={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"},zEt={class:"search p-4"},HEt={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"},qEt=c("h2",{class:"text-xl font-bold m-4"},"Titles",-1),YEt={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"},$Et=c("h2",{class:"text-xl font-bold m-4"},"Content",-1);function WEt(n,e,t,i,s,r){const o=mt("Discussion"),a=mt("MarkdownRenderer");return w(),A("div",{class:ze([{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"])},[c("div",GEt,[c("div",VEt,[c("div",zEt,[G(c("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),[[we,s.searchQuery]]),c("button",{onClick:e[1]||(e[1]=(...l)=>r.searchSkills&&r.searchSkills(...l)),class:"bg-blue-500 text-white rounded px-4 py-1"},"Search")]),c("div",HEt,[qEt,s.titles.length>0?(w(),xt(as,{key:0,name:"list"},{default:We(()=>[(w(!0),A($e,null,lt(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:u=>r.fetchContent(l.id),onDelete:u=>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})):V("",!0)])]),c("div",YEt,[$Et,Te(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"])])]),c("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 gO=bt(BEt,[["render",WEt]]),KEt={props:{htmlContent:{type:String,required:!0}}},jEt=["innerHTML"];function QEt(n,e,t,i,s,r){return w(),A("div",{class:"w-full h-full 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",innerHTML:t.htmlContent},null,8,jEt)}const XEt=bt(KEt,[["render",QEt]]);const ZEt={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}}},JEt={key:0},eyt={class:"toggle-icon mr-1"},tyt={key:0,class:"fas fa-plus-circle text-gray-600"},nyt={key:1,class:"fas fa-minus-circle text-gray-600"},iyt={class:"json-viewer max-h-64 overflow-auto p-4 bg-gray-100 border border-gray-300 rounded dark:bg-gray-600"},syt={key:0,class:"fas fa-plus-circle text-gray-600"},ryt={key:1,class:"fas fa-minus-circle text-gray-600"},oyt=["innerHTML"];function ayt(n,e,t,i,s,r){return r.isContentPresent?(w(),A("div",JEt,[c("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))},[c("span",eyt,[s.collapsed?(w(),A("i",tyt)):(w(),A("i",nyt))]),et(" "+he(t.jsonFormText),1)]),G(c("div",null,[c("div",iyt,[r.isObject?(w(),A("span",{key:0,onClick:e[1]||(e[1]=(...o)=>r.toggleCollapsed&&r.toggleCollapsed(...o)),class:"toggle-icon cursor-pointer mr-1"},[s.collapsed?(w(),A("i",syt)):(w(),A("i",ryt))])):V("",!0),c("pre",{innerHTML:r.formattedJson},null,8,oyt)])],512),[[Mt,!s.collapsed]])])):V("",!0)}const lyt=bt(ZEt,[["render",ayt]]),cyt={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"}}},dyt={class:"flex items-start"},uyt={class:"step flex items-center mb-4"},pyt={key:0,class:"flex items-center justify-center w-6 h-6 mr-2"},_yt={key:0},hyt=c("i",{"data-feather":"square",class:"text-gray-400 w-4 h-4"},null,-1),fyt=[hyt],myt={key:1},gyt=c("i",{"data-feather":"check-square",class:"text-green-500 w-4 h-4"},null,-1),byt=[gyt],Eyt={key:2},yyt=c("i",{"data-feather":"x-square",class:"text-red-500 w-4 h-4"},null,-1),vyt=[yyt],Syt={key:1,role:"status",class:"m-15"},Tyt=c("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"},[c("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"}),c("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),xyt=[Tyt],Cyt={class:"text-sm ml-6"};function wyt(n,e,t,i,s,r){return w(),A("div",dyt,[c("div",uyt,[t.step_type=="start_end"?(w(),A("div",pyt,[t.done?V("",!0):(w(),A("div",_yt,fyt)),t.done&&t.status?(w(),A("div",myt,byt)):V("",!0),t.done&&!t.status?(w(),A("div",Eyt,vyt)):V("",!0)])):V("",!0),t.done?V("",!0):(w(),A("div",Syt,xyt)),c("h3",Cyt,he(t.message),1)])])}const Ryt=bt(cyt,[["render",wyt]]),Ayt="/assets/process-61f7a21b.svg",Nyt="/assets/ok-a0b56451.svg",Oyt="/assets/failed-183609e7.svg",bO="/assets/send_globe-305330b9.svg";const Iyt="/",Myt={name:"Message",emits:["copy","delete","rankUp","rankDown","updateMessage","resendMessage","continueMessage"],components:{MarkdownRenderer:sp,Step:Ryt,RenderHTMLJS:XEt,JsonViewer:lyt,DynamicUIRenderer:fO},props:{host:{type:String,required:!1,default:"http://localhost:9600"},message:Object,avatar:{default:""}},data(){return{ui_componentKey:0,isSynthesizingVoice:!1,cpp_block:cO,html5_block:dO,LaTeX_block:uO,json_block:lO,javascript_block:aO,process_svg:Ayt,ok_svg:Nyt,failed_svg:Oyt,loading_svg:_O,sendGlobe:bO,code_block:rO,python_block:oO,bash_block:pO,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."),Ge(()=>{He.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(d=>d.trim()===""?d:s?d.startsWith(" ")?d.substring(4):d:" "+d),a=e.value.substring(0,t),l=e.value.substring(i),u=a+o.join(` `)+l;this.message.content=u,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,Se.post("./text2wav",{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.$store.state.config.active_tts_service!="browser"&&this.$store.state.config.active_tts_service!="None")this.isSpeaking=!0,Se.post("./text2Audio",{text:this.message.content}).then(n=>{this.isSpeaking=!1}).catch(n=>{this.$store.state.toast.showToast(`Error: ${n}`,4,!1),this.isSpeaking=!1});else{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 u=r.lastIndexOf(l);u>a&&(a=u)}),a==-1&&(a=r.length),console.log(a),a+s+1},i=()=>{if(this.status_message=="Done"||this.message.content.includes(".")||this.message.content.includes("?")||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)};console.log("Speaking chunk"),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?Myt+this.avatar:(console.log("No avatar found"),Ti)},defaultImg(n){n.target.src=Ti},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.$store.state.config.xtts_enable&&this.$store.state.config.xtts_use_streaming_mode||this.isSpeaking||this.checkForFullSentence())},"message.ui":function(n){console.log("ui changed"),this.ui_componentKey++},showConfirmation(){Ge(()=>{He.replace()})},deleteMsgMode(){Ge(()=>{He.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,Ge(()=>{He.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(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(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"}}},kyt={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"},Lyt={class:"flex flex-row gap-2"},Pyt={class:"flex-shrink-0"},Uyt={class:"group/avatar"},Fyt=["src","data-popover-target"],Byt={class:"flex flex-col w-full flex-grow-0"},Gyt={class:"flex flex-row flex-grow items-start"},Vyt={class:"flex flex-col mb-2"},zyt={class:"drop-shadow-sm text-lg text-opacity-95 font-bold grow"},Hyt=["title"],qyt=c("div",{class:"flex-grow"},null,-1),Yyt={class:"flex-row justify-end mx-2"},$yt={class:"invisible group-hover:visible flex flex-row"},Wyt={key:0,class:"flex items-center duration-75"},Kyt=c("i",{"data-feather":"x"},null,-1),jyt=[Kyt],Qyt=c("i",{"data-feather":"check"},null,-1),Xyt=[Qyt],Zyt=c("i",{"data-feather":"edit"},null,-1),Jyt=[Zyt],evt=["src"],tvt=["src"],nvt=["src"],ivt=["src"],svt=["src"],rvt=["src"],ovt=["src"],avt=["src"],lvt=c("i",{"data-feather":"copy"},null,-1),cvt=[lvt],dvt=c("i",{"data-feather":"send"},null,-1),uvt=[dvt],pvt=["src"],_vt=c("i",{"data-feather":"send"},null,-1),hvt=[_vt],fvt=c("i",{"data-feather":"fast-forward"},null,-1),mvt=[fvt],gvt={key:14,class:"flex items-center duration-75"},bvt=c("i",{"data-feather":"x"},null,-1),Evt=[bvt],yvt=c("i",{"data-feather":"check"},null,-1),vvt=[yvt],Svt=c("i",{"data-feather":"trash"},null,-1),Tvt=[Svt],xvt=c("i",{"data-feather":"thumbs-up"},null,-1),Cvt=[xvt],wvt={class:"flex flex-row items-center"},Rvt=c("i",{"data-feather":"thumbs-down"},null,-1),Avt=[Rvt],Nvt={class:"flex flex-row items-center"},Ovt=c("i",{"data-feather":"volume-2"},null,-1),Ivt=[Ovt],Mvt={key:16,class:"flex flex-row items-center"},Dvt=c("i",{"data-feather":"voicemail"},null,-1),kvt=[Dvt],Lvt=["src"],Pvt={class:"overflow-x-auto w-full 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"},Uvt={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"},Fvt={class:"grid min-w-72 select-none grid-cols-[40px,1fr] items-center gap-2.5 p-2"},Bvt={class:"relative grid aspect-square place-content-center overflow-hidden rounded-lg bg-gray-300 dark:bg-gray-200"},Gvt=["src"],Vvt=["src"],zvt=["src"],Hvt={class:"leading-4"},qvt=c("dd",{class:"text-sm"},"Processing infos",-1),Yvt={class:"flex items-center gap-1 truncate whitespace-nowrap text-[.82rem] text-gray-400"},$vt={class:"content px-5 pb-5 pt-4"},Wvt={class:"list-none"},Kvt=c("div",{class:"flex flex-col items-start w-full"},null,-1),jvt={class:"flex flex-col items-start w-full 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"},Qvt={key:1},Xvt={key:2},Zvt=["src"],Jvt={class:"text-sm text-gray-400 mt-2"},eSt={class:"flex flex-row items-center gap-2"},tSt={key:0},nSt={class:"font-thin"},iSt={key:1},sSt={class:"font-thin"},rSt={key:2},oSt={class:"font-thin"},aSt={key:3},lSt=["title"],cSt={key:4},dSt=["title"],uSt={key:5},pSt=["title"],_St={key:6},hSt=["title"];function fSt(n,e,t,i,s,r){var h;const o=mt("Step"),a=mt("RenderHTMLJS"),l=mt("MarkdownRenderer"),u=mt("JsonViewer"),d=mt("DynamicUIRenderer");return w(),A("div",kyt,[c("div",Lyt,[c("div",Pyt,[c("div",Uyt,[c("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,Fyt)])]),c("div",Byt,[c("div",Gyt,[c("div",Vyt,[c("div",zyt,he(t.message.sender)+" ",1),t.message.created_at?(w(),A("div",{key:0,class:"text-sm text-gray-400 font-thin",title:"Created at: "+r.created_at_parsed},he(r.created_at),9,Hyt)):V("",!0)]),qyt,c("div",Yyt,[c("div",$yt,[r.editMsgMode?(w(),A("div",Wyt,[c("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]=ge(f=>r.editMsgMode=!1,["stop"]))},jyt),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 p-2",title:"Update message",type:"button",onClick:e[2]||(e[2]=ge((...f)=>r.updateMessage&&r.updateMessage(...f),["stop"]))},Xyt)])):V("",!0),r.editMsgMode?V("",!0):(w(),A("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]=ge(f=>r.editMsgMode=!0,["stop"]))},Jyt)),r.editMsgMode?(w(),A("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]=ge(f=>r.addBlock(""),["stop"]))},[c("img",{src:s.code_block,width:"25",height:"25"},null,8,evt)])):V("",!0),r.editMsgMode?(w(),A("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]=ge(f=>r.addBlock("python"),["stop"]))},[c("img",{src:s.python_block,width:"25",height:"25"},null,8,tvt)])):V("",!0),r.editMsgMode?(w(),A("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]=ge(f=>r.addBlock("javascript"),["stop"]))},[c("img",{src:s.javascript_block,width:"25",height:"25"},null,8,nvt)])):V("",!0),r.editMsgMode?(w(),A("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]=ge(f=>r.addBlock("json"),["stop"]))},[c("img",{src:s.json_block,width:"25",height:"25"},null,8,ivt)])):V("",!0),r.editMsgMode?(w(),A("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]=ge(f=>r.addBlock("c++"),["stop"]))},[c("img",{src:s.cpp_block,width:"25",height:"25"},null,8,svt)])):V("",!0),r.editMsgMode?(w(),A("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]=ge(f=>r.addBlock("html"),["stop"]))},[c("img",{src:s.html5_block,width:"25",height:"25"},null,8,rvt)])):V("",!0),r.editMsgMode?(w(),A("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]=ge(f=>r.addBlock("latex"),["stop"]))},[c("img",{src:s.LaTeX_block,width:"25",height:"25"},null,8,ovt)])):V("",!0),r.editMsgMode?(w(),A("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]=ge(f=>r.addBlock("bash"),["stop"]))},[c("img",{src:s.bash_block,width:"25",height:"25"},null,8,avt)])):V("",!0),c("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]=ge(f=>r.copyContentToClipboard(),["stop"]))},cvt),!r.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(w(),A("div",{key:10,class:ze(["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]=ge(f=>r.resendMessage("full_context"),["stop"]))},uvt,2)):V("",!0),!r.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(w(),A("div",{key:11,class:ze(["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]=ge(f=>r.resendMessage("full_context_with_internet"),["stop"]))},[c("img",{src:s.sendGlobe,width:"25",height:"25"},null,8,pvt)],2)):V("",!0),!r.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(w(),A("div",{key:12,class:ze(["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]=ge(f=>r.resendMessage("simple_question"),["stop"]))},hvt,2)):V("",!0),!r.editMsgMode&&t.message.sender==this.$store.state.mountedPers.name?(w(),A("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]=ge(f=>r.continueMessage(),["stop"]))},mvt)):V("",!0),s.deleteMsgMode?(w(),A("div",gvt,[c("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]=ge(f=>s.deleteMsgMode=!1,["stop"]))},Evt),c("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]=ge(f=>r.deleteMsg(),["stop"]))},vvt)])):V("",!0),!r.editMsgMode&&!s.deleteMsgMode?(w(),A("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)},Tvt)):V("",!0),c("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Upvote",onClick:e[20]||(e[20]=ge(f=>r.rankUp(),["stop"]))},Cvt),c("div",wvt,[c("div",{class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"Downvote",onClick:e[21]||(e[21]=ge(f=>r.rankDown(),["stop"]))},Avt),t.message.rank!=0?(w(),A("div",{key:0,class:ze(["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"},he(t.message.rank),3)):V("",!0)]),c("div",Nvt,[this.$store.state.config.active_tts_service!="None"?(w(),A("div",{key:0,class:ze(["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]=ge(f=>r.speak(),["stop"]))},Ivt,2)):V("",!0)]),this.$store.state.config.xtts_enable&&!this.$store.state.config.xtts_use_streaming_mode?(w(),A("div",Mvt,[s.isSynthesizingVoice?(w(),A("img",{key:1,src:s.loading_svg},null,8,Lvt)):(w(),A("div",{key:0,class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"generate_audio",onClick:e[23]||(e[23]=ge(f=>r.read(),["stop"]))},kvt))])):V("",!0)])])]),c("div",Pvt,[G(c("details",Uvt,[c("summary",Fvt,[c("div",Bvt,[t.message.status_message!="Done"&t.message.status_message!="Generation canceled"?(w(),A("img",{key:0,src:s.loading_svg,class:"w-50 h-50 absolute inset-0 text-gray-100 transition-opacity dark:text-gray-800 opacity-100"},null,8,Gvt)):V("",!0),t.message.status_message=="Generation canceled"?(w(),A("img",{key:1,src:s.failed_svg,class:"w-50 h-50 absolute inset-0 text-gray-100 transition-opacity dark:text-gray-800 opacity-100"},null,8,Vvt)):V("",!0),t.message.status_message=="Done"?(w(),A("img",{key:2,src:s.ok_svg,class:"w-50 h-50 absolute m-2 w-6 inset-0 text-geen-100 transition-opacity dark:text-gray-800 opacity-100"},null,8,zvt)):V("",!0)]),c("dl",Hvt,[qvt,c("dt",Yvt,he(t.message==null?"":t.message.status_message),1)])]),c("div",$vt,[c("ol",Wvt,[(w(!0),A($e,null,lt(t.message.steps,(f,_)=>(w(),A("div",{key:"step-"+t.message.id+"-"+_,class:"group border-l pb-6 last:!border-transparent last:pb-0 dark:border-gray-800",style:en({backgroundColor:f.done?"transparent":"inherit"})},[Te(o,{done:f.done,message:f.message,status:f.status,step_type:f.type},null,8,["done","message","status","step_type"])],4))),128))])])],512),[[Mt,t.message!=null&&t.message.steps!=null&&t.message.steps.length>0]]),Kvt,c("div",jvt,[(w(!0),A($e,null,lt(t.message.html_js_s,(f,_)=>(w(),A("div",{key:"htmljs-"+t.message.id+"-"+_,class:"htmljs font-bold",style:en({backgroundColor:n.step.done?"transparent":"inherit"})},[Te(a,{htmlContent:f},null,8,["htmlContent"])],4))),128))]),r.editMsgMode?V("",!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"])),c("div",null,[t.message.open?G((w(),A("textarea",{key:0,ref:"mdTextarea",onKeydown:e[24]||(e[24]=Hs(ge((...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)),[[we,t.message.content]]):V("",!0)]),t.message.metadata!==null?(w(),A("div",Qvt,[(w(!0),A($e,null,lt(((h=t.message.metadata)==null?void 0:h.filter(f=>f!=null&&f.hasOwnProperty("title")&&f.hasOwnProperty("content")))||[],(f,_)=>(w(),A("div",{key:"json-"+t.message.id+"-"+_,class:"json font-bold"},[Te(u,{jsonFormText:f.title,jsonData:f.content},null,8,["jsonFormText","jsonData"])]))),128))])):V("",!0),t.message.ui!==null?(w(),A("div",Xvt,[Te(d,{ref:"ui",class:"w-full",ui:t.message.ui},null,8,["ui"])])):V("",!0),s.audio_url!=null?(w(),A("audio",{controls:"",key:s.audio_url},[c("source",{src:s.audio_url,type:"audio/wav",ref:"audio_player"},null,8,Zvt),et(" Your browser does not support the audio element. ")])):V("",!0)]),c("div",Jvt,[c("div",eSt,[t.message.binding?(w(),A("p",tSt,[et("Binding: "),c("span",nSt,he(t.message.binding),1)])):V("",!0),t.message.model?(w(),A("p",iSt,[et("Model: "),c("span",sSt,he(t.message.model),1)])):V("",!0),t.message.seed?(w(),A("p",rSt,[et("Seed: "),c("span",oSt,he(t.message.seed),1)])):V("",!0),t.message.nb_tokens?(w(),A("p",aSt,[et("Number of tokens: "),c("span",{class:"font-thin",title:"Number of Tokens: "+t.message.nb_tokens},he(t.message.nb_tokens),9,lSt)])):V("",!0),r.warmup_duration?(w(),A("p",cSt,[et("Warmup duration: "),c("span",{class:"font-thin",title:"Warmup duration: "+r.warmup_duration},he(r.warmup_duration),9,dSt)])):V("",!0),r.time_spent?(w(),A("p",uSt,[et("Generation duration: "),c("span",{class:"font-thin",title:"Finished generating: "+r.time_spent},he(r.time_spent),9,pSt)])):V("",!0),r.generation_rate?(w(),A("p",_St,[et("Rate: "),c("span",{class:"font-thin",title:"Generation rate: "+r.generation_rate},he(r.generation_rate),9,hSt)])):V("",!0)])])])])])}const EO=bt(Dyt,[["render",fSt]]),mSt="/";Se.defaults.baseURL="/";const gSt={name:"MountedPersonalities",props:{onShowPersList:Function,onReady:Function},components:{Toast:hc,UniversalForm:bc},data(){return{bUrl:mSt,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:{async handleOnTalk(){const n=this.mountedPers;console.log("pers:",n),this.isGenerating=!0,this.setDiscussionLoading(this.currentDiscussion.id,this.isGenerating);let e=await Se.get("/get_generation_status",{});if(e)if(e.data.status)console.log("Already generating");else{const t=this.$store.state.config.personalities.findIndex(s=>s===n.full_path),i={client_id:this.$store.state.client_id,id:t};e=await Se.post("/select_personality",i),console.log("Generating message from ",e.data.status),Ye.emit("generate_msg_from",{id:-1})}},async remount_personality(){const n=this.mountedPers;if(console.log("Remounting personality ",n),!n)return{status:!1,error:"no personality - mount_personality"};try{console.log("before");const e={client_id:this.$store.state.client_id,category:n.category,folder:n.folder,language:n.language};console.log("after");const t=await Se.post("/remount_personality",e);if(console.log("Remounting personality executed:",t),t)return console.log("Remounting personality res"),this.$store.state.toast.showToast("Personality remounted",4,!0),t.data;console.log("failed remount_personality")}catch(e){console.log(e.message,"remount_personality - settings");return}},onSettingsPersonality(n){try{Se.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{Se.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?Iyt+this.avatar:(console.log("No avatar found"),Ti)},defaultImg(n){n.target.src=Ti},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.$store.state.config.xtts_enable&&this.$store.state.config.xtts_use_streaming_mode||this.isSpeaking||this.checkForFullSentence())},"message.ui":function(n){console.log("ui changed"),this.ui_componentKey++},showConfirmation(){Ge(()=>{He.replace()})},deleteMsgMode(){Ge(()=>{He.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,Ge(()=>{He.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(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(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"}}},Dyt={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"},kyt={class:"flex flex-row gap-2"},Lyt={class:"flex-shrink-0"},Pyt={class:"group/avatar"},Uyt=["src","data-popover-target"],Fyt={class:"flex flex-col w-full flex-grow-0"},Byt={class:"flex flex-row flex-grow items-start"},Gyt={class:"flex flex-col mb-2"},Vyt={class:"drop-shadow-sm text-lg text-opacity-95 font-bold grow"},zyt=["title"],Hyt=c("div",{class:"flex-grow"},null,-1),qyt={class:"flex-row justify-end mx-2"},Yyt={class:"invisible group-hover:visible flex flex-row"},$yt={key:0,class:"flex items-center duration-75"},Wyt=c("i",{"data-feather":"x"},null,-1),Kyt=[Wyt],jyt=c("i",{"data-feather":"check"},null,-1),Qyt=[jyt],Xyt=c("i",{"data-feather":"edit"},null,-1),Zyt=[Xyt],Jyt=["src"],evt=["src"],tvt=["src"],nvt=["src"],ivt=["src"],svt=["src"],rvt=["src"],ovt=["src"],avt=c("i",{"data-feather":"copy"},null,-1),lvt=[avt],cvt=c("i",{"data-feather":"send"},null,-1),dvt=[cvt],uvt=["src"],pvt=c("i",{"data-feather":"send"},null,-1),_vt=[pvt],hvt=c("i",{"data-feather":"fast-forward"},null,-1),fvt=[hvt],mvt={key:14,class:"flex items-center duration-75"},gvt=c("i",{"data-feather":"x"},null,-1),bvt=[gvt],Evt=c("i",{"data-feather":"check"},null,-1),yvt=[Evt],vvt=c("i",{"data-feather":"trash"},null,-1),Svt=[vvt],Tvt=c("i",{"data-feather":"thumbs-up"},null,-1),xvt=[Tvt],Cvt={class:"flex flex-row items-center"},wvt=c("i",{"data-feather":"thumbs-down"},null,-1),Rvt=[wvt],Avt={class:"flex flex-row items-center"},Nvt=c("i",{"data-feather":"volume-2"},null,-1),Ovt=[Nvt],Ivt={key:16,class:"flex flex-row items-center"},Mvt=c("i",{"data-feather":"voicemail"},null,-1),Dvt=[Mvt],kvt=["src"],Lvt={class:"overflow-x-auto w-full 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"},Pvt={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"},Uvt={class:"grid min-w-72 select-none grid-cols-[40px,1fr] items-center gap-2.5 p-2"},Fvt={class:"relative grid aspect-square place-content-center overflow-hidden rounded-lg bg-gray-300 dark:bg-gray-200"},Bvt=["src"],Gvt=["src"],Vvt=["src"],zvt={class:"leading-4"},Hvt=c("dd",{class:"text-sm"},"Processing infos",-1),qvt={class:"flex items-center gap-1 truncate whitespace-nowrap text-[.82rem] text-gray-400"},Yvt={class:"content px-5 pb-5 pt-4"},$vt={class:"list-none"},Wvt=c("div",{class:"flex flex-col items-start w-full"},null,-1),Kvt={class:"flex flex-col items-start w-full 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"},jvt={key:1},Qvt={key:2},Xvt=["src"],Zvt={class:"text-sm text-gray-400 mt-2"},Jvt={class:"flex flex-row items-center gap-2"},eSt={key:0},tSt={class:"font-thin"},nSt={key:1},iSt={class:"font-thin"},sSt={key:2},rSt={class:"font-thin"},oSt={key:3},aSt=["title"],lSt={key:4},cSt=["title"],dSt={key:5},uSt=["title"],pSt={key:6},_St=["title"];function hSt(n,e,t,i,s,r){var h;const o=mt("Step"),a=mt("RenderHTMLJS"),l=mt("MarkdownRenderer"),u=mt("JsonViewer"),d=mt("DynamicUIRenderer");return w(),A("div",Dyt,[c("div",kyt,[c("div",Lyt,[c("div",Pyt,[c("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,Uyt)])]),c("div",Fyt,[c("div",Byt,[c("div",Gyt,[c("div",Vyt,he(t.message.sender)+" ",1),t.message.created_at?(w(),A("div",{key:0,class:"text-sm text-gray-400 font-thin",title:"Created at: "+r.created_at_parsed},he(r.created_at),9,zyt)):V("",!0)]),Hyt,c("div",qyt,[c("div",Yyt,[r.editMsgMode?(w(),A("div",$yt,[c("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]=ge(f=>r.editMsgMode=!1,["stop"]))},Kyt),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 p-2",title:"Update message",type:"button",onClick:e[2]||(e[2]=ge((...f)=>r.updateMessage&&r.updateMessage(...f),["stop"]))},Qyt)])):V("",!0),r.editMsgMode?V("",!0):(w(),A("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]=ge(f=>r.editMsgMode=!0,["stop"]))},Zyt)),r.editMsgMode?(w(),A("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]=ge(f=>r.addBlock(""),["stop"]))},[c("img",{src:s.code_block,width:"25",height:"25"},null,8,Jyt)])):V("",!0),r.editMsgMode?(w(),A("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]=ge(f=>r.addBlock("python"),["stop"]))},[c("img",{src:s.python_block,width:"25",height:"25"},null,8,evt)])):V("",!0),r.editMsgMode?(w(),A("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]=ge(f=>r.addBlock("javascript"),["stop"]))},[c("img",{src:s.javascript_block,width:"25",height:"25"},null,8,tvt)])):V("",!0),r.editMsgMode?(w(),A("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]=ge(f=>r.addBlock("json"),["stop"]))},[c("img",{src:s.json_block,width:"25",height:"25"},null,8,nvt)])):V("",!0),r.editMsgMode?(w(),A("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]=ge(f=>r.addBlock("c++"),["stop"]))},[c("img",{src:s.cpp_block,width:"25",height:"25"},null,8,ivt)])):V("",!0),r.editMsgMode?(w(),A("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]=ge(f=>r.addBlock("html"),["stop"]))},[c("img",{src:s.html5_block,width:"25",height:"25"},null,8,svt)])):V("",!0),r.editMsgMode?(w(),A("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]=ge(f=>r.addBlock("latex"),["stop"]))},[c("img",{src:s.LaTeX_block,width:"25",height:"25"},null,8,rvt)])):V("",!0),r.editMsgMode?(w(),A("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]=ge(f=>r.addBlock("bash"),["stop"]))},[c("img",{src:s.bash_block,width:"25",height:"25"},null,8,ovt)])):V("",!0),c("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]=ge(f=>r.copyContentToClipboard(),["stop"]))},lvt),!r.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(w(),A("div",{key:10,class:ze(["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]=ge(f=>r.resendMessage("full_context"),["stop"]))},dvt,2)):V("",!0),!r.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(w(),A("div",{key:11,class:ze(["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]=ge(f=>r.resendMessage("full_context_with_internet"),["stop"]))},[c("img",{src:s.sendGlobe,width:"25",height:"25"},null,8,uvt)],2)):V("",!0),!r.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(w(),A("div",{key:12,class:ze(["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]=ge(f=>r.resendMessage("simple_question"),["stop"]))},_vt,2)):V("",!0),!r.editMsgMode&&t.message.sender==this.$store.state.mountedPers.name?(w(),A("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]=ge(f=>r.continueMessage(),["stop"]))},fvt)):V("",!0),s.deleteMsgMode?(w(),A("div",mvt,[c("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]=ge(f=>s.deleteMsgMode=!1,["stop"]))},bvt),c("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]=ge(f=>r.deleteMsg(),["stop"]))},yvt)])):V("",!0),!r.editMsgMode&&!s.deleteMsgMode?(w(),A("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)},Svt)):V("",!0),c("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Upvote",onClick:e[20]||(e[20]=ge(f=>r.rankUp(),["stop"]))},xvt),c("div",Cvt,[c("div",{class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"Downvote",onClick:e[21]||(e[21]=ge(f=>r.rankDown(),["stop"]))},Rvt),t.message.rank!=0?(w(),A("div",{key:0,class:ze(["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"},he(t.message.rank),3)):V("",!0)]),c("div",Avt,[this.$store.state.config.active_tts_service!="None"?(w(),A("div",{key:0,class:ze(["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]=ge(f=>r.speak(),["stop"]))},Ovt,2)):V("",!0)]),this.$store.state.config.xtts_enable&&!this.$store.state.config.xtts_use_streaming_mode?(w(),A("div",Ivt,[s.isSynthesizingVoice?(w(),A("img",{key:1,src:s.loading_svg},null,8,kvt)):(w(),A("div",{key:0,class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"generate_audio",onClick:e[23]||(e[23]=ge(f=>r.read(),["stop"]))},Dvt))])):V("",!0)])])]),c("div",Lvt,[G(c("details",Pvt,[c("summary",Uvt,[c("div",Fvt,[t.message.status_message!="Done"&t.message.status_message!="Generation canceled"?(w(),A("img",{key:0,src:s.loading_svg,class:"w-50 h-50 absolute inset-0 text-gray-100 transition-opacity dark:text-gray-800 opacity-100"},null,8,Bvt)):V("",!0),t.message.status_message=="Generation canceled"?(w(),A("img",{key:1,src:s.failed_svg,class:"w-50 h-50 absolute inset-0 text-gray-100 transition-opacity dark:text-gray-800 opacity-100"},null,8,Gvt)):V("",!0),t.message.status_message=="Done"?(w(),A("img",{key:2,src:s.ok_svg,class:"w-50 h-50 absolute m-2 w-6 inset-0 text-geen-100 transition-opacity dark:text-gray-800 opacity-100"},null,8,Vvt)):V("",!0)]),c("dl",zvt,[Hvt,c("dt",qvt,he(t.message==null?"":t.message.status_message),1)])]),c("div",Yvt,[c("ol",$vt,[(w(!0),A($e,null,lt(t.message.steps,(f,_)=>(w(),A("div",{key:"step-"+t.message.id+"-"+_,class:"group border-l pb-6 last:!border-transparent last:pb-0 dark:border-gray-800",style:en({backgroundColor:f.done?"transparent":"inherit"})},[Te(o,{done:f.done,message:f.message,status:f.status,step_type:f.type},null,8,["done","message","status","step_type"])],4))),128))])])],512),[[Mt,t.message!=null&&t.message.steps!=null&&t.message.steps.length>0]]),Wvt,c("div",Kvt,[(w(!0),A($e,null,lt(t.message.html_js_s,(f,_)=>(w(),A("div",{key:"htmljs-"+t.message.id+"-"+_,class:"htmljs font-bold",style:en({backgroundColor:n.step.done?"transparent":"inherit"})},[Te(a,{htmlContent:f},null,8,["htmlContent"])],4))),128))]),r.editMsgMode?V("",!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"])),c("div",null,[t.message.open?G((w(),A("textarea",{key:0,ref:"mdTextarea",onKeydown:e[24]||(e[24]=Hs(ge((...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)),[[we,t.message.content]]):V("",!0)]),t.message.metadata!==null?(w(),A("div",jvt,[(w(!0),A($e,null,lt(((h=t.message.metadata)==null?void 0:h.filter(f=>f!=null&&f.hasOwnProperty("title")&&f.hasOwnProperty("content")))||[],(f,_)=>(w(),A("div",{key:"json-"+t.message.id+"-"+_,class:"json font-bold"},[Te(u,{jsonFormText:f.title,jsonData:f.content},null,8,["jsonFormText","jsonData"])]))),128))])):V("",!0),t.message.ui!==null?(w(),A("div",Qvt,[Te(d,{ref:"ui",class:"w-full",ui:t.message.ui},null,8,["ui"])])):V("",!0),s.audio_url!=null?(w(),A("audio",{controls:"",key:s.audio_url},[c("source",{src:s.audio_url,type:"audio/wav",ref:"audio_player"},null,8,Xvt),et(" Your browser does not support the audio element. ")])):V("",!0)]),c("div",Zvt,[c("div",Jvt,[t.message.binding?(w(),A("p",eSt,[et("Binding: "),c("span",tSt,he(t.message.binding),1)])):V("",!0),t.message.model?(w(),A("p",nSt,[et("Model: "),c("span",iSt,he(t.message.model),1)])):V("",!0),t.message.seed?(w(),A("p",sSt,[et("Seed: "),c("span",rSt,he(t.message.seed),1)])):V("",!0),t.message.nb_tokens?(w(),A("p",oSt,[et("Number of tokens: "),c("span",{class:"font-thin",title:"Number of Tokens: "+t.message.nb_tokens},he(t.message.nb_tokens),9,aSt)])):V("",!0),r.warmup_duration?(w(),A("p",lSt,[et("Warmup duration: "),c("span",{class:"font-thin",title:"Warmup duration: "+r.warmup_duration},he(r.warmup_duration),9,cSt)])):V("",!0),r.time_spent?(w(),A("p",dSt,[et("Generation duration: "),c("span",{class:"font-thin",title:"Finished generating: "+r.time_spent},he(r.time_spent),9,uSt)])):V("",!0),r.generation_rate?(w(),A("p",pSt,[et("Rate: "),c("span",{class:"font-thin",title:"Generation rate: "+r.generation_rate},he(r.generation_rate),9,_St)])):V("",!0)])])])])])}const EO=bt(Myt,[["render",hSt]]),fSt="/";Se.defaults.baseURL="/";const mSt={name:"MountedPersonalities",props:{onShowPersList:Function,onReady:Function},components:{Toast:hc,UniversalForm:bc},data(){return{bUrl:fSt,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:{async handleOnTalk(){const n=this.mountedPers;console.log("pers:",n),this.isGenerating=!0,this.setDiscussionLoading(this.currentDiscussion.id,this.isGenerating);let e=await Se.get("/get_generation_status",{});if(e)if(e.data.status)console.log("Already generating");else{const t=this.$store.state.config.personalities.findIndex(s=>s===n.full_path),i={client_id:this.$store.state.client_id,id:t};e=await Se.post("/select_personality",i),console.log("Generating message from ",e.data.status),Ye.emit("generate_msg_from",{id:-1})}},async remount_personality(){const n=this.mountedPers;if(console.log("Remounting personality ",n),!n)return{status:!1,error:"no personality - mount_personality"};try{console.log("before");const e={client_id:this.$store.state.client_id,category:n.category,folder:n.folder,language:n.language};console.log("after");const t=await Se.post("/remount_personality",e);if(console.log("Remounting personality executed:",t),t)return console.log("Remounting personality res"),this.$store.state.toast.showToast("Personality remounted",4,!0),t.data;console.log("failed remount_personality")}catch(e){console.log(e.message,"remount_personality - settings");return}},onSettingsPersonality(n){try{Se.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{Se.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(Ge(()=>{He.replace()});this.$store.state.ready===!1;)await new Promise(n=>setTimeout(n,100));this.onReady()},async api_get_req(n){try{const e=await Se.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(n){n.target.src=ap}}},bSt={class:"w-fit flex select-none"},ESt={class:"w-fit flex select-none"},ySt={class:"w-8 h-8 group relative"},vSt=["src","title"],SSt={class:"opacity-0 group-hover:opacity-100"},TSt=c("span",{title:"Remount"},[c("svg",{xmlns:"http://www.w3.org/2000/svg",class:"top-0 left-1 relative w-4 h-4 text-red-600 hover:text-red-500",viewBox:"0 0 30 30",width:"2",height:"2",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"},[c("g",{id:"surface1"},[c("path",{style:{},d:"M 16 4 C 10.886719 4 6.617188 7.160156 4.875 11.625 L 6.71875 12.375 C 8.175781 8.640625 11.710938 6 16 6 C 19.242188 6 22.132813 7.589844 23.9375 10 L 20 10 L 20 12 L 27 12 L 27 5 L 25 5 L 25 8.09375 C 22.808594 5.582031 19.570313 4 16 4 Z M 25.28125 19.625 C 23.824219 23.359375 20.289063 26 16 26 C 12.722656 26 9.84375 24.386719 8.03125 22 L 12 22 L 12 20 L 5 20 L 5 27 L 7 27 L 7 23.90625 C 9.1875 26.386719 12.394531 28 16 28 C 21.113281 28 25.382813 24.839844 27.125 20.375 Z "})])])],-1),xSt=[TSt],CSt=c("span",{title:"Talk"},[c("svg",{xmlns:"http://www.w3.org/2000/svg",class:"left-1 relative w-4 h-4 text-red-600 hover:text-red-500",viewBox:"0 0 24 24",width:"2",height:"2",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"},[c("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),c("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})])],-1),wSt=[CSt];function RSt(n,e,t,i,s,r){const o=mt("UniversalForm");return w(),A($e,null,[c("div",bSt,[c("div",ESt,[c("div",ySt,[c("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 hover:scale-150 active:scale-90 hover:z-50 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,vSt),c("div",SSt,[n.personalityHoveredIndex===n.index?(w(),A("button",{key:0,class:"z-50 -top-1 group-hover:translate-x-5 border-gray-500 absolute active:scale-90 w-7 h-7 hover:scale-150 transition bg-bg-light dark:bg-bg-dark rounded-full border-2",onClick:e[2]||(e[2]=ge(a=>r.remount_personality(),["prevent"]))},xSt)):V("",!0),n.personalityHoveredIndex===n.index?(w(),A("button",{key:1,class:"-top-1 group-hover:-translate-x-12 border-gray-500 active:scale-90 absolute items-center w-7 h-7 hover:scale-150 transition text-red-200 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2",onClick:e[3]||(e[3]=ge(a=>r.handleOnTalk(),["prevent"]))},wSt)):V("",!0),c("div",{class:"top-0 group-hover:-translate-x-8 group-hover:-translate-y-8 left-0 border-gray-500 active:scale-90 absolute items-center w-7 h-7 hover:scale-150 transition text-red-500 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2",onClick:e[4]||(e[4]=ge((...a)=>r.toggleShowPersList&&r.toggleShowPersList(...a),["stop"])),title:"Click to show more"},"+"+he(r.mountedPersArr.length-1),1)])])])]),Te(o,{ref:"universalForm",class:"z-50"},null,512)],64)}const ASt=bt(gSt,[["render",RSt]]);const NSt="/";Se.defaults.baseURL="/";const OSt={props:{onTalk:Function,onMounted:Function,onUnmounted:Function,onRemounted:Function,discussionPersonalities:Array,onShowPersList:Function},components:{PersonalityEntry:hO,Toast:hc,UniversalForm:bc},name:"MountedPersonalitiesList",data(){return{posts_headers:{accept:"application/json","Content-Type":"application/json"},bUrl:NSt,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:{async onCopyToCustom(n){await Se.post("/copy_to_custom_personas",{client_id:this.$store.state.client_id,category:n.personality.category,name:n.personality.name})},onCopyPersonalityName(n){this.$store.state.toast.showToast("Copied name to clipboard!",4,!0),navigator.clipboard.writeText(n.name)},toggleShowPersList(){this.onShowPersList()},async constructor(){},async api_get_req(n){try{const e=await Se.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(n){n.target.src=ap},onPersonalityReinstall(n){console.log("on reinstall ",n),this.isLoading=!0,Se.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(Ge(()=>{He.replace()});this.$store.state.ready===!1;)await new Promise(n=>setTimeout(n,100));this.onReady()},async api_get_req(n){try{const e=await Se.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(n){n.target.src=ap}}},gSt={class:"w-fit flex select-none"},bSt={class:"w-fit flex select-none"},ESt={class:"w-8 h-8 group relative"},ySt=["src","title"],vSt={class:"opacity-0 group-hover:opacity-100"},SSt=c("span",{title:"Remount"},[c("svg",{xmlns:"http://www.w3.org/2000/svg",class:"top-0 left-1 relative w-4 h-4 text-red-600 hover:text-red-500",viewBox:"0 0 30 30",width:"2",height:"2",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"},[c("g",{id:"surface1"},[c("path",{style:{},d:"M 16 4 C 10.886719 4 6.617188 7.160156 4.875 11.625 L 6.71875 12.375 C 8.175781 8.640625 11.710938 6 16 6 C 19.242188 6 22.132813 7.589844 23.9375 10 L 20 10 L 20 12 L 27 12 L 27 5 L 25 5 L 25 8.09375 C 22.808594 5.582031 19.570313 4 16 4 Z M 25.28125 19.625 C 23.824219 23.359375 20.289063 26 16 26 C 12.722656 26 9.84375 24.386719 8.03125 22 L 12 22 L 12 20 L 5 20 L 5 27 L 7 27 L 7 23.90625 C 9.1875 26.386719 12.394531 28 16 28 C 21.113281 28 25.382813 24.839844 27.125 20.375 Z "})])])],-1),TSt=[SSt],xSt=c("span",{title:"Talk"},[c("svg",{xmlns:"http://www.w3.org/2000/svg",class:"left-1 relative w-4 h-4 text-red-600 hover:text-red-500",viewBox:"0 0 24 24",width:"2",height:"2",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"},[c("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),c("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})])],-1),CSt=[xSt];function wSt(n,e,t,i,s,r){const o=mt("UniversalForm");return w(),A($e,null,[c("div",gSt,[c("div",bSt,[c("div",ESt,[c("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 hover:scale-150 active:scale-90 hover:z-50 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,ySt),c("div",vSt,[n.personalityHoveredIndex===n.index?(w(),A("button",{key:0,class:"z-50 -top-1 group-hover:translate-x-5 border-gray-500 absolute active:scale-90 w-7 h-7 hover:scale-150 transition bg-bg-light dark:bg-bg-dark rounded-full border-2",onClick:e[2]||(e[2]=ge(a=>r.remount_personality(),["prevent"]))},TSt)):V("",!0),n.personalityHoveredIndex===n.index?(w(),A("button",{key:1,class:"-top-1 group-hover:-translate-x-12 border-gray-500 active:scale-90 absolute items-center w-7 h-7 hover:scale-150 transition text-red-200 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2",onClick:e[3]||(e[3]=ge(a=>r.handleOnTalk(),["prevent"]))},CSt)):V("",!0),c("div",{class:"top-0 group-hover:-translate-x-8 group-hover:-translate-y-8 left-0 border-gray-500 active:scale-90 absolute items-center w-7 h-7 hover:scale-150 transition text-red-500 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2",onClick:e[4]||(e[4]=ge((...a)=>r.toggleShowPersList&&r.toggleShowPersList(...a),["stop"])),title:"Click to show more"},"+"+he(r.mountedPersArr.length-1),1)])])])]),Te(o,{ref:"universalForm",class:"z-50"},null,512)],64)}const RSt=bt(mSt,[["render",wSt]]);const ASt="/";Se.defaults.baseURL="/";const NSt={props:{onTalk:Function,onMounted:Function,onUnmounted:Function,onRemounted:Function,discussionPersonalities:Array,onShowPersList:Function},components:{PersonalityEntry:hO,Toast:hc,UniversalForm:bc},name:"MountedPersonalitiesList",data(){return{posts_headers:{accept:"application/json","Content-Type":"application/json"},bUrl:ASt,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:{async onCopyToCustom(n){await Se.post("/copy_to_custom_personas",{client_id:this.$store.state.client_id,category:n.personality.category,name:n.personality.name})},onCopyPersonalityName(n){this.$store.state.toast.showToast("Copied name to clipboard!",4,!0),navigator.clipboard.writeText(n.name)},toggleShowPersList(){this.onShowPersList()},async constructor(){},async api_get_req(n){try{const e=await Se.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(n){n.target.src=ap},onPersonalityReinstall(n){console.log("on reinstall ",n),this.isLoading=!0,Se.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,Se.post("/get_personality_config",{client_id:this.$store.state.client_id,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 handleOpenFolder(n){const e={client_id:this.$store.state.client_id,personality_folder:n.personality.folder};console.log(e),await Se.post("/open_personality_folder",e)},async handleOnTalk(n){if(He.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(He.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{Se.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{Se.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. @@ -178,15 +178,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&&He.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)}}},AE=n=>(yo("data-v-de7bc8fe"),n=n(),vo(),n),ISt={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"},MSt={key:0,role:"status",class:"flex justify-center overflow-y-hidden"},DSt=AE(()=>c("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"},[c("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"}),c("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)),kSt=AE(()=>c("span",{class:"sr-only"},"Loading...",-1)),LSt=[DSt,kSt],PSt=AE(()=>c("i",{"data-feather":"chevron-down"},null,-1)),USt=[PSt],FSt={class:"block my-2 text-sm font-medium text-gray-900 dark:text-white"},BSt={class:"overflow-y-auto no-scrollbar pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4 max-h-96"};function GSt(n,e,t,i,s,r){const o=mt("personality-entry"),a=mt("Toast"),l=mt("UniversalForm");return w(),A("div",ISt,[s.isLoading?(w(),A("div",MSt,LSt)):V("",!0),c("div",null,[r.mountedPersArr.length>0?(w(),A("div",{key:0,class:ze(s.isLoading?"pointer-events-none opacity-30 cursor-default":"")},[c("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]=ge((...u)=>r.toggleShowPersList&&r.toggleShowPersList(...u),["stop"]))},USt),c("label",FSt," Mounted Personalities: ("+he(r.mountedPersArr.length)+") ",1),c("div",BSt,[Te(as,{name:"bounce"},{default:We(()=>[(w(!0),A($e,null,lt(this.$store.state.mountedPersArr,(u,d)=>(w(),xt(o,{ref_for:!0,ref:"personalitiesZoo",key:"index-"+d+"-"+u.name,personality:u,full_path:u.full_path,select_language:!1,selected:r.configFile.personalities[r.configFile.active_personality_id]===u.full_path||r.configFile.personalities[r.configFile.active_personality_id]===u.full_path+":"+u.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,"on-copy-personality-name":r.onCopyPersonalityName,"on-copy-to_custom":r.onCopyToCustom,"on-open-folder":r.handleOpenFolder},null,8,["personality","full_path","selected","on-selected","on-mount","on-edit","on-un-mount","on-remount","on-settings","on-reinstall","on-talk","on-copy-personality-name","on-copy-to_custom","on-open-folder"]))),128))]),_:1})])],2)):V("",!0)]),Te(a,{ref:"toast"},null,512),Te(l,{ref:"universalForm",class:"z-20"},null,512)])}const VSt=bt(OSt,[["render",GSt],["__scopeId","data-v-de7bc8fe"]]);const zSt={components:{InteractiveMenu:CE},props:{commandsList:{type:Array,required:!0},sendCommand:Function,onShowToastMessage:Function},data(){return{loading:!1,selectedFile:null,showMenu:!1,showHelpText:!1,helpText:"",commands:[]}},async mounted(){this.commands=this.commandsList,console.log("Commands",this.commands),document.addEventListener("click",this.handleClickOutside),Ge(()=>{He.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};Ye.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,Ye.off("file_received")}),Ye.emit("send_file",t)},e.readAsDataURL(this.selectedFile)},async constructor(){Ge(()=>{He.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)}},beforeUnmount(){document.removeEventListener("click",this.handleClickOutside)}},HSt=n=>(yo("data-v-1a32c141"),n=n(),vo(),n),qSt={key:0,title:"Loading..",class:"flex flex-row flex-grow justify-end"},YSt=HSt(()=>c("div",{role:"status"},[c("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"},[c("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"}),c("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"})]),c("span",{class:"sr-only"},"Loading...")],-1)),$St=[YSt];function WSt(n,e,t,i,s,r){const o=mt("InteractiveMenu");return s.loading?(w(),A("div",qSt,$St)):(w(),xt(o,{key:1,commands:t.commandsList,execute_cmd:r.execute_cmd},null,8,["commands","execute_cmd"]))}const KSt=bt(zSt,[["render",WSt],["__scopeId","data-v-1a32c141"]]),jSt="/assets/loader_v0-16906488.svg";console.log("modelImgPlaceholder:",Li);const QSt="/",XSt={name:"ChatBox",emits:["messageSentEvent","sendCMDEvent","stopGenerating","loaded","createEmptyUserMessage","createEmptyAIMessage","personalitySelected","addWebLink"],props:{onTalk:Function,discussionList:Array,loading:{default:!1},onShowToastMessage:Function},components:{UniversalForm:bc,MountedPersonalities:ASt,MountedPersonalitiesList:VSt,PersonalitiesCommands:KSt},setup(){},data(){return{is_rt:!1,bindingHoveredIndex:null,modelHoveredIndex:null,personalityHoveredIndex:null,loader_v0:jSt,sendGlobe:bO,modelImgPlaceholder:Li,bUrl:QSt,message:"",selecting_binding:!1,selecting_model:!1,selectedModel:"",isListeningToVoice:!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:{isDataSourceNamesValid(){return console.log("dataSourceNames:",this.dataSourceNames),console.log("Type of dataSourceNames:",typeof this.dataSourceNames),Array.isArray(this.dataSourceNames)&&this.dataSourceNames.length>0},dataSourceNames(){console.log("dataSourceNames",this.$store.state.config.rag_databases);const n=this.$store.state.config.rag_databases.map(e=>{console.log("entry",e);const t=e.split("::");console.log("extracted",t[0]);const s=e.endsWith("mounted")?"feather:check":"";return console.log("icon decision",s),{name:t[0],value:t[0]||"default_value",icon:s,help:"mounts the database"}});return console.log("formatted data sources",n),n},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;e0&&this.addFiles(t)},toggleSwitch(){this.$store.state.config.activate_internet_search=!this.$store.state.config.activate_internet_search,this.isLoading=!0,Se.post("/apply_settings",{config:this.$store.state.config}).then(n=>{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),Ge(()=>{He.replace()})})},copyModelName(){navigator.clipboard.writeText(this.binding_name+"::"+this.model_name),this.$store.state.toast.showToast("Model name copyed to clipboard: "+this.binding_name+"::"+this.model_name,4,!0)},showModelConfig(){try{this.isLoading=!0,Se.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{Se.post("/set_active_binding_settings",{client_id:this.$store.state.client_id,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)}}},AE=n=>(yo("data-v-de7bc8fe"),n=n(),vo(),n),OSt={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"},ISt={key:0,role:"status",class:"flex justify-center overflow-y-hidden"},MSt=AE(()=>c("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"},[c("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"}),c("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)),DSt=AE(()=>c("span",{class:"sr-only"},"Loading...",-1)),kSt=[MSt,DSt],LSt=AE(()=>c("i",{"data-feather":"chevron-down"},null,-1)),PSt=[LSt],USt={class:"block my-2 text-sm font-medium text-gray-900 dark:text-white"},FSt={class:"overflow-y-auto no-scrollbar pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4 max-h-96"};function BSt(n,e,t,i,s,r){const o=mt("personality-entry"),a=mt("Toast"),l=mt("UniversalForm");return w(),A("div",OSt,[s.isLoading?(w(),A("div",ISt,kSt)):V("",!0),c("div",null,[r.mountedPersArr.length>0?(w(),A("div",{key:0,class:ze(s.isLoading?"pointer-events-none opacity-30 cursor-default":"")},[c("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]=ge((...u)=>r.toggleShowPersList&&r.toggleShowPersList(...u),["stop"]))},PSt),c("label",USt," Mounted Personalities: ("+he(r.mountedPersArr.length)+") ",1),c("div",FSt,[Te(as,{name:"bounce"},{default:We(()=>[(w(!0),A($e,null,lt(this.$store.state.mountedPersArr,(u,d)=>(w(),xt(o,{ref_for:!0,ref:"personalitiesZoo",key:"index-"+d+"-"+u.name,personality:u,full_path:u.full_path,select_language:!1,selected:r.configFile.personalities[r.configFile.active_personality_id]===u.full_path||r.configFile.personalities[r.configFile.active_personality_id]===u.full_path+":"+u.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,"on-copy-personality-name":r.onCopyPersonalityName,"on-copy-to_custom":r.onCopyToCustom,"on-open-folder":r.handleOpenFolder},null,8,["personality","full_path","selected","on-selected","on-mount","on-edit","on-un-mount","on-remount","on-settings","on-reinstall","on-talk","on-copy-personality-name","on-copy-to_custom","on-open-folder"]))),128))]),_:1})])],2)):V("",!0)]),Te(a,{ref:"toast"},null,512),Te(l,{ref:"universalForm",class:"z-20"},null,512)])}const GSt=bt(NSt,[["render",BSt],["__scopeId","data-v-de7bc8fe"]]);const VSt={components:{InteractiveMenu:CE},props:{commandsList:{type:Array,required:!0},sendCommand:Function,onShowToastMessage:Function},data(){return{loading:!1,selectedFile:null,showMenu:!1,showHelpText:!1,helpText:"",commands:[]}},async mounted(){this.commands=this.commandsList,console.log("Commands",this.commands),document.addEventListener("click",this.handleClickOutside),Ge(()=>{He.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};Ye.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,Ye.off("file_received")}),Ye.emit("send_file",t)},e.readAsDataURL(this.selectedFile)},async constructor(){Ge(()=>{He.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)}},beforeUnmount(){document.removeEventListener("click",this.handleClickOutside)}},zSt=n=>(yo("data-v-1a32c141"),n=n(),vo(),n),HSt={key:0,title:"Loading..",class:"flex flex-row flex-grow justify-end"},qSt=zSt(()=>c("div",{role:"status"},[c("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"},[c("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"}),c("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"})]),c("span",{class:"sr-only"},"Loading...")],-1)),YSt=[qSt];function $St(n,e,t,i,s,r){const o=mt("InteractiveMenu");return s.loading?(w(),A("div",HSt,YSt)):(w(),xt(o,{key:1,commands:t.commandsList,execute_cmd:r.execute_cmd},null,8,["commands","execute_cmd"]))}const WSt=bt(VSt,[["render",$St],["__scopeId","data-v-1a32c141"]]),KSt="/assets/loader_v0-16906488.svg";console.log("modelImgPlaceholder:",Li);const jSt="/",QSt={name:"ChatBox",emits:["messageSentEvent","sendCMDEvent","stopGenerating","loaded","createEmptyUserMessage","createEmptyAIMessage","personalitySelected","addWebLink"],props:{onTalk:Function,discussionList:Array,loading:{default:!1},onShowToastMessage:Function},components:{UniversalForm:bc,MountedPersonalities:RSt,MountedPersonalitiesList:GSt,PersonalitiesCommands:WSt},setup(){},data(){return{is_rt:!1,bindingHoveredIndex:null,modelHoveredIndex:null,personalityHoveredIndex:null,loader_v0:KSt,sendGlobe:bO,modelImgPlaceholder:Li,bUrl:jSt,message:"",selecting_binding:!1,selecting_model:!1,selectedModel:"",isListeningToVoice:!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:{isDataSourceNamesValid(){return console.log("dataSourceNames:",this.dataSourceNames),console.log("Type of dataSourceNames:",typeof this.dataSourceNames),Array.isArray(this.dataSourceNames)&&this.dataSourceNames.length>0},dataSourceNames(){console.log("dataSourceNames",this.$store.state.config.rag_databases);const n=this.$store.state.config.rag_databases.map(e=>{console.log("entry",e);const t=e.split("::");console.log("extracted",t[0]);const s=e.endsWith("mounted")?"feather:check":"";return console.log("icon decision",s),{name:t[0],value:t[0]||"default_value",icon:s,help:"mounts the database"}});return console.log("formatted data sources",n),n},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;e0&&this.addFiles(t)},toggleSwitch(){this.$store.state.config.activate_internet_search=!this.$store.state.config.activate_internet_search,this.isLoading=!0,Se.post("/apply_settings",{config:this.$store.state.config}).then(n=>{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),Ge(()=>{He.replace()})})},copyModelName(){navigator.clipboard.writeText(this.binding_name+"::"+this.model_name),this.$store.state.toast.showToast("Model name copyed to clipboard: "+this.binding_name+"::"+this.model_name,4,!0)},showModelConfig(){try{this.isLoading=!0,Se.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{Se.post("/set_active_binding_settings",{client_id:this.$store.state.client_id,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 remount_personality(n){if(console.log("Remounting personality ",n),!n)return{status:!1,error:"no personality - mount_personality"};try{console.log("before");const e={client_id:this.$store.state.client_id,category:n.category,folder:n.folder,language:n.language};console.log("after");const t=await Se.post("/remount_personality",e);if(console.log("Remounting personality executed:",t),t)return console.log("Remounting personality res"),this.$store.state.toast.showToast("Personality remounted",4,!0),t.data;console.log("failed remount_personality")}catch(e){console.log(e.message,"remount_personality - settings");return}},async unmountPersonality(n){if(console.log("Unmounting personality:",n),!n)return;const e=await this.unmount_personality(n.personality||n);if(console.log(e),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)},async unmount_personality(n){if(!n)return{status:!1,error:"no personality - unmount_personality"};const e={client_id:this.$store.state.client_id,language:n.language,category:n.category,folder:n.folder};try{const t=await Se.post("/unmount_personality",e);if(t)return t.data}catch(t){console.log(t.message,"unmount_personality - settings");return}},async showBindingHoveredIn(n){this.bindingHoveredIndex=n},async showBindingHoveredOut(){this.bindingHoveredIndex=null},async showModelHoveredIn(n){this.modelHoveredIndex=n},async showModelHoveredOut(){this.modelHoveredIndex=null},async showPersonalityHoveredIn(n){this.personalityHoveredIndex=n},async showPersonalityHoveredOut(){this.personalityHoveredIndex=null},async onPersonalitySelected(n){if(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"),await this.$store.dispatch("fetchLanguages"),await this.$store.dispatch("fetchLanguage"),await this.$store.dispatch("fetchisRTOn"),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"),Ge(()=>{He.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 Se.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"),Se.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"),Se.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(){Se.get("/download_files")},remove_file(n){Se.get("/remove_discussion_file",{client_id:this.$store.state.client_id,name:n}).then(e=>{console.log(e)})},clear_files(){Se.post("/clear_discussion_files_list",{client_id:this.$store.state.client_id}).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;Ye.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")},startRTCom(){this.is_rt=!0,console.log("is_rt:",this.is_rt),Ye.emit("start_bidirectional_audio_stream"),Ge(()=>{He.replace()})},stopRTCom(){this.is_rt=!1,console.log("is_rt:",this.is_rt),Ye.emit("stop_bidirectional_audio_stream"),Ge(()=>{He.replace()})},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.isListeningToVoice=!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.isListeningToVoice=!1,clearTimeout(this.silenceTimer)},this.recognition.onend=()=>{console.log("Speech recognition ended."),this.isListeningToVoice=!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){console.log("talking"),this.showPersonalities=!1,this.$store.state.toast.showToast(`Personality ${n.name} is Talking`,4,!0),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 Ge(()=>{He.replace()}),os(n)},removeItem(n){console.log("Removing ",n.name),Se.post("/remove_discussion_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)},async mountDB(n){await Se.post("/toggle_mount_rag_database",{client_id:this.$store.state.client_id,database_name:n}),await this.$store.dispatch("refreshConfig"),console.log("Refreshed")},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(){Ye.emit("take_picture"),Ye.on("picture_taken",()=>{Se.post("/get_discussion_files_list",{client_id:this.$store.state.client_id}).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(){Ge(()=>{He.replace()})},loading(n,e){Ge(()=>{He.replace()})},filesList:{handler(n,e){let t=0;if(n.length>0)for(let i=0;i{He.replace()}),console.log("Chatbar mounted"),Ye.on("rtcom_status_changed",n=>{this.$store.dispatch("fetchisRTOn"),console.log("rtcom_status_changed: ",n.status),console.log("active_tts_service: ",this.$store.state.config.active_tts_service),console.log("is_rt_on: ",this.$store.state.is_rt_on)}),this.$store.dispatch("fetchisRTOn")},activated(){Ge(()=>{He.replace()})}},Pt=n=>(yo("data-v-64fb461b"),n=n(),vo(),n),ZSt={class:"absolute bottom-0 left-0 w-fit min-w-96 w-full justify-center text-center"},JSt={key:0,class:"items-center gap-2 bg-bg-light-panel dark:bg-bg-dark-tone shadow-sm hover:shadow-none dark:border-gray-800 w-fit"},e0t={class:"flex"},t0t=["title"],n0t=Pt(()=>c("i",{"data-feather":"list"},null,-1)),i0t=[n0t],s0t={key:0},r0t={class:"flex flex-col max-h-64"},o0t=["title"],a0t={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"},l0t={key:0,filesList:"",role:"status"},c0t=Pt(()=>c("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"},[c("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"}),c("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)),d0t=Pt(()=>c("span",{class:"sr-only"},"Loading...",-1)),u0t=[c0t,d0t],p0t=Pt(()=>c("div",null,[c("i",{"data-feather":"file",class:"w-5 h-5"})],-1)),_0t=Pt(()=>c("div",{class:"grow"},null,-1)),h0t={class:"flex flex-row items-center"},f0t={class:"whitespace-nowrap"},m0t=["onClick"],g0t=Pt(()=>c("i",{"data-feather":"x",class:"w-5 h-5"},null,-1)),b0t=[g0t],E0t={key:1,class:"flex mx-1 w-500"},y0t={class:"whitespace-nowrap flex flex-row gap-2"},v0t=Pt(()=>c("p",{class:"font-bold"}," Total size: ",-1)),S0t=Pt(()=>c("div",{class:"grow"},null,-1)),T0t=Pt(()=>c("i",{"data-feather":"trash",class:"w-5 h-5"},null,-1)),x0t=[T0t],C0t=Pt(()=>c("i",{"data-feather":"download-cloud",class:"w-5 h-5"},null,-1)),w0t=[C0t],R0t={key:2,class:"mx-1"},A0t={key:1,title:"Selecting model",class:"flex flex-row flex-grow justify-end bg-primary"},N0t={role:"status"},O0t=["src"],I0t=Pt(()=>c("span",{class:"sr-only"},"Selecting model...",-1)),M0t={class:"flex w-fit relative grow w-full"},D0t={class:"relative text-light-text-panel dark:text-dark-text-panel grow flex h-12.5 cursor-pointer select-none items-center gap-2 bg-bg-light-panel dark:bg-bg-dark-tone p-1 shadow-sm hover:shadow-none dark:border-gray-800",tabindex:"0"},k0t={key:0,title:"Waiting for reply"},L0t=["src"],P0t=Pt(()=>c("div",{role:"status"},[c("span",{class:"sr-only"},"Loading...")],-1)),U0t={key:1,class:"w-fit group relative"},F0t={class:"hide top-50 hide opacity-0 group-hover:bottom-0 opacity-0 .group-hover:block fixed w-[1000px] group absolute group-hover:opacity-100 transform group-hover:translate-y-[-50px] group-hover:translate-x-[0px] transition-all duration-300"},B0t={class:"w-fit flex-wrap flex bg-white bg-opacity-50 backdrop-blur-md rounded p-4"},G0t=["onMouseover"],V0t={class:"relative"},z0t=["onClick"],H0t=["src","title"],q0t={class:"group items-center flex flex-row"},Y0t=["src","title"],$0t={key:2,class:"w-fit group relative"},W0t={class:"hide top-50 hide opacity-0 group-hover:bottom-0 opacity-0 .group-hover:block fixed w-[1000px] group absolute group-hover:opacity-100 transform group-hover:translate-y-[-50px] group-hover:translate-x-[0px] transition-all duration-300"},K0t={class:"w-fit flex-wrap flex bg-white bg-opacity-50 backdrop-blur-md rounded p-4"},j0t=["onMouseover"],Q0t={class:"relative"},X0t=["onClick"],Z0t=["src","title"],J0t={class:"group items-center flex flex-row"},eTt=["src","title"],tTt={key:3,class:"w-fit group relative"},nTt={class:"top-50 hide opacity-0 group-hover:bottom-0 .group-hover:block fixed w-[1000px] group absolute group-hover:opacity-100 transform group-hover:translate-y-[-50px] group-hover:translate-x-[0px] transition-all duration-300"},iTt={class:"w-fit flex-wrap flex bg-white bg-opacity-50 backdrop-blur-md rounded p-4"},sTt=["onMouseover"],rTt={class:"relative"},oTt=["onClick"],aTt=["src","title"],lTt=["onClick"],cTt=Pt(()=>c("span",{class:"-top-6 -right-6 border-gray-500 absolute active:scale-90 w-7 h-7 hover:scale-150 transition bg-bg-light dark:bg-bg-dark rounded-full border-2",title:"Unmount personality"},[c("svg",{"aria-hidden":"true",class:"top-1 left-1 relative w-5 h-5 text-red-600 hover:text-red-500",fill:"currentColor",viewBox:"0 0 20 20","stroke-width":"1",xmlns:"http://www.w3.org/2000/svg"},[c("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)),dTt=[cTt],uTt=["onClick"],pTt=Pt(()=>c("span",{class:"-top-9 left-2 border-gray-500 active:scale-90 absolute items-center w-7 h-7 hover:scale-150 transition text-red-200 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2",title:"Remount"},[c("svg",{xmlns:"http://www.w3.org/2000/svg",class:"top-1 left-1 relative w-4 h-4 text-red-600 hover:text-red-500",viewBox:"0 0 30 30",width:"2",height:"2",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"},[c("g",{id:"surface1"},[c("path",{style:{},d:"M 16 4 C 10.886719 4 6.617188 7.160156 4.875 11.625 L 6.71875 12.375 C 8.175781 8.640625 11.710938 6 16 6 C 19.242188 6 22.132813 7.589844 23.9375 10 L 20 10 L 20 12 L 27 12 L 27 5 L 25 5 L 25 8.09375 C 22.808594 5.582031 19.570313 4 16 4 Z M 25.28125 19.625 C 23.824219 23.359375 20.289063 26 16 26 C 12.722656 26 9.84375 24.386719 8.03125 22 L 12 22 L 12 20 L 5 20 L 5 27 L 7 27 L 7 23.90625 C 9.1875 26.386719 12.394531 28 16 28 C 21.113281 28 25.382813 24.839844 27.125 20.375 Z "})])])],-1)),_Tt=[pTt],hTt=["onClick"],fTt=Pt(()=>c("span",{class:"-top-6 -left-6 border-gray-500 active:scale-90 absolute items-center w-7 h-7 hover:scale-150 transition text-red-200 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2",title:"Talk"},[c("svg",{xmlns:"http://www.w3.org/2000/svg",class:"top-1 left-1 relative w-4 h-4 text-red-600 hover:text-red-500",viewBox:"0 0 24 24",width:"2",height:"2",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"},[c("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),c("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})])],-1)),mTt=[fTt],gTt={class:"w-fit"},bTt={class:"w-fit"},ETt={class:"relative grow"},yTt={class:"group relative w-max"},vTt=Pt(()=>c("i",{"data-feather":"send"},null,-1)),STt=[vTt],TTt=Pt(()=>c("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"},[c("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Sends your message to the AI.")],-1)),xTt={class:"group relative w-max"},CTt=["src"],wTt=Pt(()=>c("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"},[c("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Sends your message to the AI with internet search.")],-1)),RTt={class:"group relative w-max"},ATt=Pt(()=>c("i",{"data-feather":"mic"},null,-1)),NTt=[ATt],OTt=Pt(()=>c("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"},[c("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Press and talk.")],-1)),ITt={key:5,class:"group relative w-max"},MTt=Pt(()=>c("i",{"data-feather":"mic"},null,-1)),DTt=[MTt],kTt=Pt(()=>c("i",{"data-feather":"mic"},null,-1)),LTt=[kTt],PTt=Pt(()=>c("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"},[c("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Real time bidirectional audio mode.")],-1)),UTt={key:6,class:"group relative w-max"},FTt=Pt(()=>c("i",{"data-feather":"file-plus"},null,-1)),BTt=[FTt],GTt=Pt(()=>c("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"},[c("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Send File to the AI.")],-1)),VTt={class:"group relative w-max"},zTt=Pt(()=>c("i",{"data-feather":"camera"},null,-1)),HTt=[zTt],qTt=Pt(()=>c("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"},[c("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Take a shot from webcam.")],-1)),YTt={class:"group relative w-max"},$Tt=Pt(()=>c("i",{"data-feather":"globe"},null,-1)),WTt=[$Tt],KTt=Pt(()=>c("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"},[c("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Add a weblink to the discussion.")],-1)),jTt={class:"group relative w-max"},QTt=Pt(()=>c("i",{"data-feather":"message-square"},null,-1)),XTt=[QTt],ZTt=Pt(()=>c("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"},[c("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"New empty User message.")],-1)),JTt={class:"group relative w-max"},ext=Pt(()=>c("i",{"data-feather":"message-square"},null,-1)),txt=[ext],nxt=Pt(()=>c("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"},[c("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"New empty ai message.")],-1)),ixt=Pt(()=>c("div",{class:"ml-auto gap-2"},null,-1));function sxt(n,e,t,i,s,r){const o=mt("MountedPersonalitiesList"),a=mt("MountedPersonalities"),l=mt("PersonalitiesCommands"),u=mt("UniversalForm");return w(),A($e,null,[c("form",null,[c("div",ZSt,[s.filesList.length>0||s.showPersonalities?(w(),A("div",JSt,[c("div",e0t,[c("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]=ge(d=>s.showfilesList=!s.showfilesList,["stop"]))},i0t,8,t0t)]),s.filesList.length>0&&s.showfilesList==!0?(w(),A("div",s0t,[c("div",r0t,[Te(as,{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:We(()=>[(w(!0),A($e,null,lt(s.filesList,(d,h)=>(w(),A("div",{key:h+"-"+d.name},[c("div",{class:"m-1",title:d.name},[c("div",a0t,[s.isFileSentList[h]?V("",!0):(w(),A("div",l0t,u0t)),p0t,c("div",{class:ze(["line-clamp-1 w-3/5",s.isFileSentList[h]?"text-green-500":"text-red-200"])},he(d.name),3),_0t,c("div",h0t,[c("p",f0t,he(r.computedFileSize(d.size)),1),c("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(d)},b0t,8,m0t)])])],8,o0t)]))),128))]),_:1})])])):V("",!0),s.filesList.length>0?(w(),A("div",E0t,[c("div",y0t,[v0t,et(" "+he(s.totalSize)+" ("+he(s.filesList.length)+") ",1)]),S0t,c("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]=(...d)=>r.clear_files&&r.clear_files(...d))},x0t),c("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]=(...d)=>r.download_files&&r.download_files(...d))},w0t)])):V("",!0),s.showPersonalities?(w(),A("div",R0t,[Te(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"])])):V("",!0)])):V("",!0),s.selecting_model||s.selecting_binding?(w(),A("div",A0t,[c("div",N0t,[c("img",{src:s.loader_v0,class:"w-50 h-50"},null,8,O0t),I0t])])):V("",!0),c("div",M0t,[c("div",D0t,[t.loading?(w(),A("div",k0t,[c("img",{src:s.loader_v0},null,8,L0t),P0t])):V("",!0),t.loading?V("",!0):(w(),A("div",U0t,[c("div",F0t,[c("div",B0t,[(w(!0),A($e,null,lt(r.installedBindings,(d,h)=>(w(),A("div",{class:"w-fit h-fit inset-0 opacity-100",key:h+"-"+d.name,ref_for:!0,ref:"installedBindings",onMouseover:f=>r.showBindingHoveredIn(h),onMouseleave:e[4]||(e[4]=f=>r.showBindingHoveredOut())},[h!=r.binding_name?(w(),A("div",{key:0,class:ze(["items-center flex flex-row relative z-20 hover:-translate-y-8 duration-300",s.bindingHoveredIndex===h?"scale-150":""])},[c("div",V0t,[c("button",{onClick:ge(f=>r.setBinding(d),["prevent"]),class:"w-10 h-10 relative"},[c("img",{src:d.icon?d.icon:s.modelImgPlaceholder,onError:e[3]||(e[3]=(...f)=>s.modelImgPlaceholder&&s.modelImgPlaceholder(...f)),class:ze(["z-50 w-10 h-10 rounded-full object-fill text-red-700 border-2 border-gray-500 active:scale-90",s.bindingHoveredIndex===h?"scale-150 ":""+d.name==r.binding_name?"border-secondary":"border-transparent z-0"]),title:d.name},null,42,H0t)],8,z0t)])],2)):V("",!0)],40,G0t))),128))])]),c("div",q0t,[c("button",{onClick:e[5]||(e[5]=ge(d=>r.showModelConfig(),["prevent"])),class:"w-8 h-8"},[c("img",{src:r.currentBindingIcon,class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary hover:scale-110 hover:-translate-y-1 duration-200",title:r.currentBinding?r.currentBinding.name:"unknown"},null,8,Y0t)])])])),t.loading?V("",!0):(w(),A("div",$0t,[c("div",W0t,[c("div",K0t,[(w(!0),A($e,null,lt(r.installedModels,(d,h)=>(w(),A("div",{class:"w-fit h-fit",key:h+"-"+d.name,ref_for:!0,ref:"installedModels",onMouseover:f=>r.showModelHoveredIn(h),onMouseleave:e[7]||(e[7]=f=>r.showModelHoveredOut())},[h!=r.model_name?(w(),A("div",{key:0,class:ze(["items-center flex flex-row relative z-20 hover:-translate-y-8 duration-300",s.modelHoveredIndex===h?"scale-150":""])},[c("div",Q0t,[c("button",{onClick:ge(f=>r.setModel(d),["prevent"]),class:"w-10 h-10 relative"},[c("img",{src:d.icon?d.icon:s.modelImgPlaceholder,onError:e[6]||(e[6]=(...f)=>n.personalityImgPlacehodler&&n.personalityImgPlacehodler(...f)),class:ze(["z-50 w-10 h-10 rounded-full object-fill text-red-700 border-2 border-gray-500 active:scale-90",s.modelHoveredIndex===h?"scale-150 ":""+d.name==r.model_name?"border-secondary":"border-transparent z-0"]),title:d.name},null,42,Z0t)],8,X0t)])],2)):V("",!0)],40,j0t))),128))])]),c("div",J0t,[c("button",{onClick:e[8]||(e[8]=ge(d=>r.copyModelName(),["prevent"])),class:"w-8 h-8"},[c("img",{src:r.currentModelIcon,class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary hover:scale-110 hover:-translate-y-1 duration-400",title:r.currentModel?r.currentModel.name:"unknown"},null,8,eTt)])])])),t.loading?V("",!0):(w(),A("div",tTt,[c("div",nTt,[c("div",iTt,[(w(!0),A($e,null,lt(r.mountedPersonalities,(d,h)=>(w(),A("div",{class:"w-fit h-fit inset-0 opacity-100",key:h+"-"+d.name,ref_for:!0,ref:"mountedPersonalities",onMouseover:f=>r.showPersonalityHoveredIn(h),onMouseleave:e[10]||(e[10]=f=>r.showPersonalityHoveredOut())},[h!=r.personality_name?(w(),A("div",{key:0,class:ze(["items-center flex flex-row relative z-20 hover:-translate-y-8 duration-300",s.personalityHoveredIndex===h?"scale-150":""])},[c("div",rTt,[c("button",{onClick:ge(f=>r.onPersonalitySelected(d),["prevent"]),class:"w-10 h-10 relative"},[c("img",{src:s.bUrl+d.avatar,onError:e[9]||(e[9]=(...f)=>n.personalityImgPlacehodler&&n.personalityImgPlacehodler(...f)),class:ze(["z-50 w-10 h-10 rounded-full object-fill text-red-700 border-2 border-gray-500 active:scale-90",s.personalityHoveredIndex===h?"scale-150 ":""+this.$store.state.active_personality_id==this.$store.state.personalities.indexOf(d.full_path)?"border-secondary":"border-transparent z-0"]),title:d.name},null,42,aTt)],8,oTt),s.personalityHoveredIndex===h?(w(),A("button",{key:0,onClick:ge(f=>r.unmountPersonality(d),["prevent"])},dTt,8,lTt)):V("",!0),s.personalityHoveredIndex===h?(w(),A("button",{key:1,onClick:ge(f=>r.remount_personality(d),["prevent"])},_Tt,8,uTt)):V("",!0),s.personalityHoveredIndex===h?(w(),A("button",{key:2,onClick:ge(f=>r.handleOnTalk(d),["prevent"])},mTt,8,hTt)):V("",!0)])],2)):V("",!0)],40,sTt))),128))])]),Te(a,{ref:"mountedPers",onShowPersList:r.onShowPersListFun,onReady:r.onPersonalitiesReadyFun},null,8,["onShowPersList","onReady"])])),c("div",gTt,[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"])):V("",!0)]),c("div",bTt,[r.isDataSourceNamesValid?(w(),xt(l,{key:0,icon:"feather:book",commandsList:r.dataSourceNames,sendCommand:r.mountDB,"on-show-toast-message":t.onShowToastMessage,ref:"databasesList"},null,8,["commandsList","sendCommand","on-show-toast-message"])):V("",!0)]),c("div",ETt,[G(c("textarea",{id:"chat",rows:"1","onUpdate:modelValue":e[11]||(e[11]=d=>s.message=d),title:"Hold SHIFT + ENTER to add new line",onPaste:e[12]||(e[12]=(...d)=>r.handlePaste&&r.handlePaste(...d)),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[13]||(e[13]=Hs(ge(d=>r.submitOnEnter(d),["exact"]),["enter"]))},`\r - `,544),[[we,s.message]])]),t.loading?(w(),A("button",{key:4,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[14]||(e[14]=ge((...d)=>r.stopGenerating&&r.stopGenerating(...d),["stop"]))}," Stop generating ")):V("",!0),c("div",yTt,[t.loading?V("",!0):(w(),A("button",{key:0,type:"button",onClick:e[15]||(e[15]=(...d)=>r.submit&&r.submit(...d)),title:"Send",class:"w-6 text-panel hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},STt)),TTt]),c("div",xTt,[t.loading?V("",!0):(w(),A("button",{key:0,type:"button",onClick:e[16]||(e[16]=(...d)=>r.submitWithInternetSearch&&r.submitWithInternetSearch(...d)),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"},[c("img",{src:s.sendGlobe,width:"50",height:"50",style:{stroke:"currentColor",fill:"currentColor"}},null,8,CTt)])),wTt]),c("div",RTt,[t.loading?V("",!0):(w(),A("button",{key:0,type:"button",onClick:e[17]||(e[17]=(...d)=>r.startSpeechRecognition&&r.startSpeechRecognition(...d)),class:ze([{"text-red-500":s.isListeningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"])},NTt,2)),OTt]),n.$store.state.config.active_tts_service!="None"?(w(),A("div",ITt,[s.is_rt?(w(),A("button",{key:0,type:"button",onClick:e[18]||(e[18]=(...d)=>r.stopRTCom&&r.stopRTCom(...d)),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90 bg-red-500 border borderred700 rounded-md"},DTt)):(w(),A("button",{key:1,type:"button",onClick:e[19]||(e[19]=(...d)=>r.startRTCom&&r.startRTCom(...d)),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90 bg-green-500 border border-green-700 rounded-md"},LTt)),PTt])):V("",!0),t.loading?V("",!0):(w(),A("div",UTt,[c("input",{type:"file",ref:"fileDialog",style:{display:"none"},onChange:e[20]||(e[20]=(...d)=>r.addFiles&&r.addFiles(...d)),multiple:""},null,544),c("button",{type:"button",onClick:e[21]||(e[21]=ge((...d)=>r.add_file&&r.add_file(...d),["prevent"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},BTt),GTt])),c("div",VTt,[t.loading?V("",!0):(w(),A("button",{key:0,type:"button",onClick:e[22]||(e[22]=ge((...d)=>r.takePicture&&r.takePicture(...d),["stop"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},HTt)),qTt]),c("div",YTt,[t.loading?V("",!0):(w(),A("button",{key:0,type:"button",onClick:e[23]||(e[23]=ge((...d)=>r.addWebLink&&r.addWebLink(...d),["stop"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},WTt)),KTt]),c("div",jTt,[t.loading?V("",!0):(w(),A("button",{key:0,type:"button",onClick:e[24]||(e[24]=ge((...d)=>r.makeAnEmptyUserMessage&&r.makeAnEmptyUserMessage(...d),["stop"])),class:"w-6 text-gray-800 hover:text-secondary duration-75 active:scale-90 hover:translate-y-[-5px]"},XTt)),ZTt]),c("div",JTt,[t.loading?V("",!0):(w(),A("button",{key:0,type:"button",onClick:e[25]||(e[25]=ge((...d)=>r.makeAnEmptyAIMessage&&r.makeAnEmptyAIMessage(...d),["stop"])),class:"w-6 text-red-400 hover:text-secondary duration-75 active:scale-90 hover:translate-y-[-5px]"},txt)),nxt])]),ixt])])]),Te(u,{ref:"universalForm",class:"z-20"},null,512)],64)}const yO=bt(XSt,[["render",sxt],["__scopeId","data-v-64fb461b"]]),rxt={name:"WelcomeComponent",computed:{storeLogo(){return this.$store.state.config?Ti:this.$store.state.config.app_custom_logo!=""?"/user_infos/"+this.$store.state.config.app_custom_logo:Ti}},data(){},setup(){return{}}},oxt={class:"flex flex-col text-center w-full h-full"},axt={class:"flex flex-col text-center items-center"},lxt={class:"flex items-center gap-3 text-5xl drop-shadow-md align-middle pt-24"},cxt=["src"],dxt=c("div",{class:"flex flex-col items-start"},[c("p",{class:"text-2xl"},"LoLLMS"),c("p",{class:"text-gray-400 text-base"},"One tool to rule them all")],-1),uxt=c("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),pxt=c("p",{class:"text-2xl"},"Welcome",-1),_xt=c("p",{class:"text-lg"},"Please create a new discussion or select existing one to start",-1);function hxt(n,e,t,i,s,r){return w(),A("div",oxt,[c("div",axt,[c("div",lxt,[c("img",{class:"w-12 hover:scale-95 duration-150",title:"LoLLMS WebUI",src:n.$store.state.config==null?r.storeLogo:n.$store.state.config.app_custom_logo!=""?"/user_infos/"+n.$store.state.config.app_custom_logo:r.storeLogo,alt:"Logo"},null,8,cxt),dxt]),uxt,pxt,_xt])])}const vO=bt(rxt,[["render",hxt]]);var fxt=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}(),iu=globalThis&&globalThis.__assign||function(){return iu=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 Axt(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)||!us(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 Nxt(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,u){return l[u]="",l},{});!xi(s)||!us(s)||(Object.assign(s.style,a),Object.keys(r).forEach(function(l){s.removeAttribute(l)}))})}}const Oxt={name:"applyStyles",enabled:!0,phase:"write",fn:Axt,effect:Nxt,requires:["computeStyles"]};function ls(n){return n.split("-")[0]}var ro=Math.max,au=Math.min,ya=Math.round;function tb(){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 AO(){return!/^((?!chrome|android).)*safari/i.test(tb())}function va(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=ho(n)?ai(n):window,a=o.visualViewport,l=!AO()&&t,u=(i.left+(l&&a?a.offsetLeft:0))/s,d=(i.top+(l&&a?a.offsetTop:0))/r,h=i.width/s,f=i.height/r;return{width:h,height:f,top:d,right:u+h,bottom:d+f,left:u,x:u,y:d}}function LE(n){var e=va(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 NO(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&kE(t)){var i=e;do{if(i&&n.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function qs(n){return ai(n).getComputedStyle(n)}function Ixt(n){return["table","td","th"].indexOf(us(n))>=0}function Or(n){return((ho(n)?n.ownerDocument:n.document)||window.document).documentElement}function lp(n){return us(n)==="html"?n:n.assignedSlot||n.parentNode||(kE(n)?n.host:null)||Or(n)}function DC(n){return!xi(n)||qs(n).position==="fixed"?null:n.offsetParent}function Mxt(n){var e=/firefox/i.test(tb()),t=/Trident/i.test(tb());if(t&&xi(n)){var i=qs(n);if(i.position==="fixed")return null}var s=lp(n);for(kE(s)&&(s=s.host);xi(s)&&["html","body"].indexOf(us(s))<0;){var r=qs(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 yc(n){for(var e=ai(n),t=DC(n);t&&Ixt(t)&&qs(t).position==="static";)t=DC(t);return t&&(us(t)==="html"||us(t)==="body"&&qs(t).position==="static")?e:t||Mxt(n)||e}function PE(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function kl(n,e,t){return ro(n,au(e,t))}function Dxt(n,e,t){var i=kl(n,e,t);return i>t?t:i}function OO(){return{top:0,right:0,bottom:0,left:0}}function IO(n){return Object.assign({},OO(),n)}function MO(n,e){return e.reduce(function(t,i){return t[i]=n,t},{})}var kxt=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,IO(typeof e!="number"?e:MO(e,Ec))};function Lxt(n){var e,t=n.state,i=n.name,s=n.options,r=t.elements.arrow,o=t.modifiersData.popperOffsets,a=ls(t.placement),l=PE(a),u=[Xn,Ai].indexOf(a)>=0,d=u?"height":"width";if(!(!r||!o)){var h=kxt(s.padding,t),f=LE(r),_=l==="y"?Qn:Xn,m=l==="y"?Ri:Ai,E=t.rects.reference[d]+t.rects.reference[l]-o[l]-t.rects.popper[d],b=o[l]-t.rects.reference[l],g=yc(r),y=g?l==="y"?g.clientHeight||0:g.clientWidth||0:0,v=E/2-b/2,S=h[_],C=y-f[d]-h[m],T=y/2-f[d]/2+v,O=kl(S,T,C),k=l;t.modifiersData[i]=(e={},e[k]=O,e.centerOffset=O-T,e)}}function Pxt(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)||NO(e.elements.popper,s)&&(e.elements.arrow=s))}const Uxt={name:"arrow",enabled:!0,phase:"main",fn:Lxt,effect:Pxt,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Sa(n){return n.split("-")[1]}var Fxt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Bxt(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 kC(n){var e,t=n.popper,i=n.popperRect,s=n.placement,r=n.variation,o=n.offsets,a=n.position,l=n.gpuAcceleration,u=n.adaptive,d=n.roundOffsets,h=n.isFixed,f=o.x,_=f===void 0?0:f,m=o.y,E=m===void 0?0:m,b=typeof d=="function"?d({x:_,y:E}):{x:_,y:E};_=b.x,E=b.y;var g=o.hasOwnProperty("x"),y=o.hasOwnProperty("y"),v=Xn,S=Qn,C=window;if(u){var T=yc(t),O="clientHeight",k="clientWidth";if(T===ai(t)&&(T=Or(t),qs(T).position!=="static"&&a==="absolute"&&(O="scrollHeight",k="scrollWidth")),T=T,s===Qn||(s===Xn||s===Ai)&&r===ic){S=Ri;var x=h&&T===C&&C.visualViewport?C.visualViewport.height:T[O];E-=x-i.height,E*=l?1:-1}if(s===Xn||(s===Qn||s===Ri)&&r===ic){v=Ai;var I=h&&T===C&&C.visualViewport?C.visualViewport.width:T[k];_-=I-i.width,_*=l?1:-1}}var F=Object.assign({position:a},u&&Fxt),B=d===!0?Bxt({x:_,y:E},ai(t)):{x:_,y:E};if(_=B.x,E=B.y,l){var ne;return Object.assign({},F,(ne={},ne[S]=y?"0":"",ne[v]=g?"0":"",ne.transform=(C.devicePixelRatio||1)<=1?"translate("+_+"px, "+E+"px)":"translate3d("+_+"px, "+E+"px, 0)",ne))}return Object.assign({},F,(e={},e[S]=y?E+"px":"",e[v]=g?_+"px":"",e.transform="",e))}function Gxt(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,u={placement:ls(e.placement),variation:Sa(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,kC(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,kC(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const Vxt={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Gxt,data:{}};var qc={passive:!0};function zxt(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),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return r&&u.forEach(function(d){d.addEventListener("scroll",t.update,qc)}),a&&l.addEventListener("resize",t.update,qc),function(){r&&u.forEach(function(d){d.removeEventListener("scroll",t.update,qc)}),a&&l.removeEventListener("resize",t.update,qc)}}const Hxt={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:zxt,data:{}};var qxt={left:"right",right:"left",bottom:"top",top:"bottom"};function Fd(n){return n.replace(/left|right|bottom|top/g,function(e){return qxt[e]})}var Yxt={start:"end",end:"start"};function LC(n){return n.replace(/start|end/g,function(e){return Yxt[e]})}function UE(n){var e=ai(n),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function FE(n){return va(Or(n)).left+UE(n).scrollLeft}function $xt(n,e){var t=ai(n),i=Or(n),s=t.visualViewport,r=i.clientWidth,o=i.clientHeight,a=0,l=0;if(s){r=s.width,o=s.height;var u=AO();(u||!u&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:r,height:o,x:a+FE(n),y:l}}function Wxt(n){var e,t=Or(n),i=UE(n),s=(e=n.ownerDocument)==null?void 0:e.body,r=ro(t.scrollWidth,t.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=ro(t.scrollHeight,t.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-i.scrollLeft+FE(n),l=-i.scrollTop;return qs(s||t).direction==="rtl"&&(a+=ro(t.clientWidth,s?s.clientWidth:0)-r),{width:r,height:o,x:a,y:l}}function BE(n){var e=qs(n),t=e.overflow,i=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+s+i)}function DO(n){return["html","body","#document"].indexOf(us(n))>=0?n.ownerDocument.body:xi(n)&&BE(n)?n:DO(lp(n))}function Ll(n,e){var t;e===void 0&&(e=[]);var i=DO(n),s=i===((t=n.ownerDocument)==null?void 0:t.body),r=ai(i),o=s?[r].concat(r.visualViewport||[],BE(i)?i:[]):i,a=e.concat(o);return s?a:a.concat(Ll(lp(o)))}function nb(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function Kxt(n,e){var t=va(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 PC(n,e,t){return e===wO?nb($xt(n,t)):ho(e)?Kxt(e,t):nb(Wxt(Or(n)))}function jxt(n){var e=Ll(lp(n)),t=["absolute","fixed"].indexOf(qs(n).position)>=0,i=t&&xi(n)?yc(n):n;return ho(i)?e.filter(function(s){return ho(s)&&NO(s,i)&&us(s)!=="body"}):[]}function Qxt(n,e,t,i){var s=e==="clippingParents"?jxt(n):[].concat(e),r=[].concat(s,[t]),o=r[0],a=r.reduce(function(l,u){var d=PC(n,u,i);return l.top=ro(d.top,l.top),l.right=au(d.right,l.right),l.bottom=au(d.bottom,l.bottom),l.left=ro(d.left,l.left),l},PC(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 kO(n){var e=n.reference,t=n.element,i=n.placement,s=i?ls(i):null,r=i?Sa(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 Ri:l={x:o,y:e.y+e.height};break;case Ai: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 u=s?PE(s):null;if(u!=null){var d=u==="y"?"height":"width";switch(r){case Ea:l[u]=l[u]-(e[d]/2-t[d]/2);break;case ic:l[u]=l[u]+(e[d]/2-t[d]/2);break}}return l}function sc(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?mxt:a,u=t.rootBoundary,d=u===void 0?wO:u,h=t.elementContext,f=h===void 0?hl:h,_=t.altBoundary,m=_===void 0?!1:_,E=t.padding,b=E===void 0?0:E,g=IO(typeof b!="number"?b:MO(b,Ec)),y=f===hl?gxt:hl,v=n.rects.popper,S=n.elements[m?y:f],C=Qxt(ho(S)?S:S.contextElement||Or(n.elements.popper),l,d,o),T=va(n.elements.reference),O=kO({reference:T,element:v,strategy:"absolute",placement:s}),k=nb(Object.assign({},v,O)),x=f===hl?k:T,I={top:C.top-x.top+g.top,bottom:x.bottom-C.bottom+g.bottom,left:C.left-x.left+g.left,right:x.right-C.right+g.right},F=n.modifiersData.offset;if(f===hl&&F){var B=F[s];Object.keys(I).forEach(function(ne){var L=[Ai,Ri].indexOf(ne)>=0?1:-1,$=[Qn,Ri].indexOf(ne)>=0?"y":"x";I[ne]+=B[$]*L})}return I}function Xxt(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,u=l===void 0?RO:l,d=Sa(i),h=d?a?MC:MC.filter(function(m){return Sa(m)===d}):Ec,f=h.filter(function(m){return u.indexOf(m)>=0});f.length===0&&(f=h);var _=f.reduce(function(m,E){return m[E]=sc(n,{placement:E,boundary:s,rootBoundary:r,padding:o})[ls(E)],m},{});return Object.keys(_).sort(function(m,E){return _[m]-_[E]})}function Zxt(n){if(ls(n)===DE)return[];var e=Fd(n);return[LC(n),e,LC(e)]}function Jxt(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,u=t.padding,d=t.boundary,h=t.rootBoundary,f=t.altBoundary,_=t.flipVariations,m=_===void 0?!0:_,E=t.allowedAutoPlacements,b=e.options.placement,g=ls(b),y=g===b,v=l||(y||!m?[Fd(b)]:Zxt(b)),S=[b].concat(v).reduce(function(Ee,xe){return Ee.concat(ls(xe)===DE?Xxt(e,{placement:xe,boundary:d,rootBoundary:h,padding:u,flipVariations:m,allowedAutoPlacements:E}):xe)},[]),C=e.rects.reference,T=e.rects.popper,O=new Map,k=!0,x=S[0],I=0;I=0,$=L?"width":"height",H=sc(e,{placement:F,boundary:d,rootBoundary:h,altBoundary:f,padding:u}),U=L?ne?Ai:Xn:ne?Ri:Qn;C[$]>T[$]&&(U=Fd(U));var Q=Fd(U),J=[];if(r&&J.push(H[B]<=0),a&&J.push(H[U]<=0,H[Q]<=0),J.every(function(Ee){return Ee})){x=F,k=!1;break}O.set(F,J)}if(k)for(var j=m?3:1,ae=function(xe){var Me=S.find(function(Z){var ye=O.get(Z);if(ye)return ye.slice(0,xe).every(function(fe){return fe})});if(Me)return x=Me,"break"},ve=j;ve>0;ve--){var ee=ae(ve);if(ee==="break")break}e.placement!==x&&(e.modifiersData[i]._skip=!0,e.placement=x,e.reset=!0)}}const eCt={name:"flip",enabled:!0,phase:"main",fn:Jxt,requiresIfExists:["offset"],data:{_skip:!1}};function UC(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 FC(n){return[Qn,Ai,Ri,Xn].some(function(e){return n[e]>=0})}function tCt(n){var e=n.state,t=n.name,i=e.rects.reference,s=e.rects.popper,r=e.modifiersData.preventOverflow,o=sc(e,{elementContext:"reference"}),a=sc(e,{altBoundary:!0}),l=UC(o,i),u=UC(a,s,r),d=FC(l),h=FC(u);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:d,hasPopperEscaped:h},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":h})}const nCt={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:tCt};function iCt(n,e,t){var i=ls(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,Ai].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function sCt(n){var e=n.state,t=n.options,i=n.name,s=t.offset,r=s===void 0?[0,0]:s,o=RO.reduce(function(d,h){return d[h]=iCt(h,e.rects,r),d},{}),a=o[e.placement],l=a.x,u=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=u),e.modifiersData[i]=o}const rCt={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:sCt};function oCt(n){var e=n.state,t=n.name;e.modifiersData[t]=kO({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const aCt={name:"popperOffsets",enabled:!0,phase:"read",fn:oCt,data:{}};function lCt(n){return n==="x"?"y":"x"}function cCt(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,u=t.rootBoundary,d=t.altBoundary,h=t.padding,f=t.tether,_=f===void 0?!0:f,m=t.tetherOffset,E=m===void 0?0:m,b=sc(e,{boundary:l,rootBoundary:u,padding:h,altBoundary:d}),g=ls(e.placement),y=Sa(e.placement),v=!y,S=PE(g),C=lCt(S),T=e.modifiersData.popperOffsets,O=e.rects.reference,k=e.rects.popper,x=typeof E=="function"?E(Object.assign({},e.rects,{placement:e.placement})):E,I=typeof x=="number"?{mainAxis:x,altAxis:x}:Object.assign({mainAxis:0,altAxis:0},x),F=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,B={x:0,y:0};if(T){if(r){var ne,L=S==="y"?Qn:Xn,$=S==="y"?Ri:Ai,H=S==="y"?"height":"width",U=T[S],Q=U+b[L],J=U-b[$],j=_?-k[H]/2:0,ae=y===Ea?O[H]:k[H],ve=y===Ea?-k[H]:-O[H],ee=e.elements.arrow,Ee=_&&ee?LE(ee):{width:0,height:0},xe=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:OO(),Me=xe[L],Z=xe[$],ye=kl(0,O[H],Ee[H]),fe=v?O[H]/2-j-ye-Me-I.mainAxis:ae-ye-Me-I.mainAxis,Ne=v?-O[H]/2+j+ye+Z+I.mainAxis:ve+ye+Z+I.mainAxis,Le=e.elements.arrow&&yc(e.elements.arrow),D=Le?S==="y"?Le.clientTop||0:Le.clientLeft||0:0,q=(ne=F==null?void 0:F[S])!=null?ne:0,K=U+fe-q-D,de=U+Ne-q,le=kl(_?au(Q,K):Q,U,_?ro(J,de):J);T[S]=le,B[S]=le-U}if(a){var Re,Ie=S==="x"?Qn:Xn,z=S==="x"?Ri:Ai,pe=T[C],re=C==="y"?"height":"width",ce=pe+b[Ie],M=pe-b[z],N=[Qn,Xn].indexOf(g)!==-1,W=(Re=F==null?void 0:F[C])!=null?Re:0,ue=N?ce:pe-O[re]-k[re]-W+I.altAxis,X=N?pe+O[re]+k[re]-W-I.altAxis:M,ie=_&&N?Dxt(ue,pe,X):kl(_?ue:ce,pe,_?X:M);T[C]=ie,B[C]=ie-pe}e.modifiersData[i]=B}}const dCt={name:"preventOverflow",enabled:!0,phase:"main",fn:cCt,requiresIfExists:["offset"]};function uCt(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function pCt(n){return n===ai(n)||!xi(n)?UE(n):uCt(n)}function _Ct(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 hCt(n,e,t){t===void 0&&(t=!1);var i=xi(e),s=xi(e)&&_Ct(e),r=Or(e),o=va(n,s,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(i||!i&&!t)&&((us(e)!=="body"||BE(r))&&(a=pCt(e)),xi(e)?(l=va(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):r&&(l.x=FE(r))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function fCt(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 mCt(n){var e=fCt(n);return Rxt.reduce(function(t,i){return t.concat(e.filter(function(s){return s.phase===i}))},[])}function gCt(n){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(n())})})),e}}function bCt(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 BC={placement:"bottom",modifiers:[],strategy:"absolute"};function GC(){for(var n=arguments.length,e=new Array(n),t=0;t(yo("data-v-54bb4ed3"),n=n(),vo(),n),RCt={key:0,class:"fixed top-0 left-0 w-screen h-screen flex items-center justify-center"},ACt={class:"flex flex-col text-center"},NCt={class:"flex flex-col text-center items-center"},OCt={class:"flex items-center gap-3 text-5xl drop-shadow-md align-middle pt-24"},ICt=Ft(()=>c("img",{class:"w-24 animate-bounce",title:"LoLLMS WebUI",src:Ti,alt:"Logo"},null,-1)),MCt={class:"flex flex-col items-start"},DCt={class:"text-2xl font-bold text-5xl drop-shadow-md align-middle"},kCt=Ft(()=>c("p",{class:"text-gray-400 text-base"},"One tool to rule them all",-1)),LCt=Ft(()=>c("p",{class:"text-gray-400 text-base"},"by ParisNeo",-1)),PCt=Ft(()=>c("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)),UCt=Ft(()=>c("p",{class:"text-2xl mb-10 font-bold drop-shadow-md"},"Welcome",-1)),FCt={role:"status",class:"text-center w-full display: flex; flex-row align-items: center;"},BCt={class:"text-2xl animate-pulse mt-2"},GCt=Ft(()=>c("i",{"data-feather":"chevron-right"},null,-1)),VCt=[GCt],zCt=Ft(()=>c("i",{"data-feather":"chevron-left"},null,-1)),HCt=[zCt],qCt=Fu('',1),YCt=[qCt],$Ct={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"},WCt={class:"text-light-text-panel dark:text-dark-text-panel bg-bg-light-panel sticky z-10 top-0 dark:bg-bg-dark-tone shadow-md"},KCt={class:"flex-row p-4 flex items-center gap-3 flex-0"},jCt=Ft(()=>c("i",{"data-feather":"plus"},null,-1)),QCt=[jCt],XCt=Ft(()=>c("i",{"data-feather":"check-square"},null,-1)),ZCt=[XCt],JCt={class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Reset database, remove all discussions"},e1t=Ft(()=>c("i",{"data-feather":"database"},null,-1)),t1t=[e1t],n1t=Ft(()=>c("i",{"data-feather":"log-in"},null,-1)),i1t=[n1t],s1t=Ft(()=>c("i",{"data-feather":"folder"},null,-1)),r1t=[s1t],o1t={key:1,class:"dropdown"},a1t=Ft(()=>c("i",{"data-feather":"search"},null,-1)),l1t=[a1t],c1t={key:2,class:"flex gap-3 flex-1 items-center duration-75"},d1t=Ft(()=>c("i",{"data-feather":"x"},null,-1)),u1t=[d1t],p1t=Ft(()=>c("i",{"data-feather":"check"},null,-1)),_1t=[p1t],h1t=Ft(()=>c("i",{"data-feather":"hard-drive"},null,-1)),f1t=[h1t],m1t=Ft(()=>c("i",{"data-feather":"check-circle"},null,-1)),g1t=[m1t],b1t=Ft(()=>c("i",{"data-feather":"x-octagon"},null,-1)),E1t=[b1t],y1t=Ft(()=>c("i",{"data-feather":"book"},null,-1)),v1t=[y1t],S1t={key:7,title:"Loading..",class:"flex flex-row flex-grow justify-end"},T1t=Ft(()=>c("div",{role:"status"},[c("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"},[c("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"}),c("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"})]),c("span",{class:"sr-only"},"Loading...")],-1)),x1t=[T1t],C1t={key:0,class:"flex-row items-center gap-3 flex-0 w-full"},w1t={class:"p-4 pt-2"},R1t={class:"relative"},A1t=Ft(()=>c("div",{class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},[c("div",{class:"scale-75"},[c("i",{"data-feather":"search"})])],-1)),N1t={class:"absolute inset-y-0 right-0 flex items-center pr-3"},O1t=Ft(()=>c("i",{"data-feather":"x"},null,-1)),I1t=[O1t],M1t={key:1,class:"h-px bg-bg-light p-0 mb-4 px-4 mx-4 border-0 dark:bg-bg-dark"},D1t={key:2,class:"flex flex-row flex-grow p-4 pt-0 items-center"},k1t={class:"flex flex-row flex-grow"},L1t={key:0},P1t={class:"flex flex-row"},U1t={key:0,class:"flex gap-3"},F1t=Ft(()=>c("i",{"data-feather":"trash"},null,-1)),B1t=[F1t],G1t={key:1,class:"flex gap-3 mx-3 flex-1 items-center justify-end group-hover:visible duration-75"},V1t=Ft(()=>c("i",{"data-feather":"check"},null,-1)),z1t=[V1t],H1t=Ft(()=>c("i",{"data-feather":"x"},null,-1)),q1t=[H1t],Y1t={class:"flex gap-3"},$1t=Ft(()=>c("i",{"data-feather":"codepen"},null,-1)),W1t=[$1t],K1t=Ft(()=>c("i",{"data-feather":"folder"},null,-1)),j1t=[K1t],Q1t=Ft(()=>c("i",{"data-feather":"bookmark"},null,-1)),X1t=[Q1t],Z1t=Ft(()=>c("i",{"data-feather":"list"},null,-1)),J1t=[Z1t],ewt={class:"relative flex flex-row flex-grow mb-10 z-0 w-full"},twt={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"},nwt=Ft(()=>c("p",{class:"px-3"},"No discussions are found",-1)),iwt=[nwt],swt=Ft(()=>c("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)),rwt={class:"text-center font-large font-bold text-l drop-shadow-md align-middle"},owt={key:2,class:"relative flex flex-col flex-grow"},awt={class:"container pt-4 pb-50 mb-50 w-full"},lwt=Ft(()=>c("div",null,[c("br"),c("br"),c("br"),c("br"),c("br"),c("br"),c("br")],-1)),cwt=Ft(()=>c("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)),dwt={key:0,class:"flex flex-row items-center justify-center h-10"},uwt={key:0,class:"relative flex flex-col no-scrollbar shadow-lg w-1/2 bg-bg-light-tone dark:bg-bg-dark-tone h-full"},pwt={ref:"isolatedContent",class:"h-full"},_wt={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"},hwt={class:"text-2xl animate-pulse mt-2 text-light-text-panel dark:text-dark-text-panel"},fwt={setup(){},data(){return{lastMessageHtml:"",defaultMessageHtml:` +`+n.name,4,!1)}else console.log("mounting pers");this.$emit("personalitySelected"),Ge(()=>{He.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 Se.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"),Se.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"),Se.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(){Se.get("/download_files")},remove_file(n){Se.get("/remove_discussion_file",{client_id:this.$store.state.client_id,name:n}).then(e=>{console.log(e)})},clear_files(){Se.post("/clear_discussion_files_list",{client_id:this.$store.state.client_id}).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;Ye.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")},startRTCom(){this.is_rt=!0,console.log("is_rt:",this.is_rt),Ye.emit("start_bidirectional_audio_stream"),Ge(()=>{He.replace()})},stopRTCom(){this.is_rt=!1,console.log("is_rt:",this.is_rt),Ye.emit("stop_bidirectional_audio_stream"),Ge(()=>{He.replace()})},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.isListeningToVoice=!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.isListeningToVoice=!1,clearTimeout(this.silenceTimer)},this.recognition.onend=()=>{console.log("Speech recognition ended."),this.isListeningToVoice=!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){console.log("talking"),this.showPersonalities=!1,this.$store.state.toast.showToast(`Personality ${n.name} is Talking`,4,!0),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 Ge(()=>{He.replace()}),os(n)},removeItem(n){console.log("Removing ",n.name),Se.post("/remove_discussion_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)},async mountDB(n){await Se.post("/toggle_mount_rag_database",{client_id:this.$store.state.client_id,database_name:n}),await this.$store.dispatch("refreshConfig"),console.log("Refreshed")},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(){Ye.emit("take_picture"),Ye.on("picture_taken",()=>{Se.post("/get_discussion_files_list",{client_id:this.$store.state.client_id}).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(){Ge(()=>{He.replace()})},loading(n,e){Ge(()=>{He.replace()})},filesList:{handler(n,e){let t=0;if(n.length>0)for(let i=0;i{He.replace()}),console.log("Chatbar mounted"),Ye.on("rtcom_status_changed",n=>{this.$store.dispatch("fetchisRTOn"),console.log("rtcom_status_changed: ",n.status),console.log("active_tts_service: ",this.$store.state.config.active_tts_service),console.log("is_rt_on: ",this.$store.state.is_rt_on)}),this.$store.dispatch("fetchisRTOn")},activated(){Ge(()=>{He.replace()})}},Pt=n=>(yo("data-v-64fb461b"),n=n(),vo(),n),XSt={class:"absolute bottom-0 left-0 w-fit min-w-96 w-full justify-center text-center"},ZSt={key:0,class:"items-center gap-2 bg-bg-light-panel dark:bg-bg-dark-tone shadow-sm hover:shadow-none dark:border-gray-800 w-fit"},JSt={class:"flex"},e0t=["title"],t0t=Pt(()=>c("i",{"data-feather":"list"},null,-1)),n0t=[t0t],i0t={key:0},s0t={class:"flex flex-col max-h-64"},r0t=["title"],o0t={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"},a0t={key:0,filesList:"",role:"status"},l0t=Pt(()=>c("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"},[c("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"}),c("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)),c0t=Pt(()=>c("span",{class:"sr-only"},"Loading...",-1)),d0t=[l0t,c0t],u0t=Pt(()=>c("div",null,[c("i",{"data-feather":"file",class:"w-5 h-5"})],-1)),p0t=Pt(()=>c("div",{class:"grow"},null,-1)),_0t={class:"flex flex-row items-center"},h0t={class:"whitespace-nowrap"},f0t=["onClick"],m0t=Pt(()=>c("i",{"data-feather":"x",class:"w-5 h-5"},null,-1)),g0t=[m0t],b0t={key:1,class:"flex mx-1 w-500"},E0t={class:"whitespace-nowrap flex flex-row gap-2"},y0t=Pt(()=>c("p",{class:"font-bold"}," Total size: ",-1)),v0t=Pt(()=>c("div",{class:"grow"},null,-1)),S0t=Pt(()=>c("i",{"data-feather":"trash",class:"w-5 h-5"},null,-1)),T0t=[S0t],x0t=Pt(()=>c("i",{"data-feather":"download-cloud",class:"w-5 h-5"},null,-1)),C0t=[x0t],w0t={key:2,class:"mx-1"},R0t={key:1,title:"Selecting model",class:"flex flex-row flex-grow justify-end bg-primary"},A0t={role:"status"},N0t=["src"],O0t=Pt(()=>c("span",{class:"sr-only"},"Selecting model...",-1)),I0t={class:"flex w-fit relative grow w-full"},M0t={class:"relative text-light-text-panel dark:text-dark-text-panel grow flex h-12.5 cursor-pointer select-none items-center gap-2 bg-bg-light-panel dark:bg-bg-dark-tone p-1 shadow-sm hover:shadow-none dark:border-gray-800",tabindex:"0"},D0t={key:0,title:"Waiting for reply"},k0t=["src"],L0t=Pt(()=>c("div",{role:"status"},[c("span",{class:"sr-only"},"Loading...")],-1)),P0t={key:1,class:"w-fit group relative"},U0t={class:"hide top-50 hide opacity-0 group-hover:bottom-0 opacity-0 .group-hover:block fixed w-[1000px] group absolute group-hover:opacity-100 transform group-hover:translate-y-[-50px] group-hover:translate-x-[0px] transition-all duration-300"},F0t={class:"w-fit flex-wrap flex bg-white bg-opacity-50 backdrop-blur-md rounded p-4"},B0t=["onMouseover"],G0t={class:"relative"},V0t=["onClick"],z0t=["src","title"],H0t={class:"group items-center flex flex-row"},q0t=["src","title"],Y0t={key:2,class:"w-fit group relative"},$0t={class:"hide top-50 hide opacity-0 group-hover:bottom-0 opacity-0 .group-hover:block fixed w-[1000px] group absolute group-hover:opacity-100 transform group-hover:translate-y-[-50px] group-hover:translate-x-[0px] transition-all duration-300"},W0t={class:"w-fit flex-wrap flex bg-white bg-opacity-50 backdrop-blur-md rounded p-4"},K0t=["onMouseover"],j0t={class:"relative"},Q0t=["onClick"],X0t=["src","title"],Z0t={class:"group items-center flex flex-row"},J0t=["src","title"],eTt={key:3,class:"w-fit group relative"},tTt={class:"top-50 hide opacity-0 group-hover:bottom-0 .group-hover:block fixed w-[1000px] group absolute group-hover:opacity-100 transform group-hover:translate-y-[-50px] group-hover:translate-x-[0px] transition-all duration-300"},nTt={class:"w-fit flex-wrap flex bg-white bg-opacity-50 backdrop-blur-md rounded p-4"},iTt=["onMouseover"],sTt={class:"relative"},rTt=["onClick"],oTt=["src","title"],aTt=["onClick"],lTt=Pt(()=>c("span",{class:"-top-6 -right-6 border-gray-500 absolute active:scale-90 w-7 h-7 hover:scale-150 transition bg-bg-light dark:bg-bg-dark rounded-full border-2",title:"Unmount personality"},[c("svg",{"aria-hidden":"true",class:"top-1 left-1 relative w-5 h-5 text-red-600 hover:text-red-500",fill:"currentColor",viewBox:"0 0 20 20","stroke-width":"1",xmlns:"http://www.w3.org/2000/svg"},[c("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)),cTt=[lTt],dTt=["onClick"],uTt=Pt(()=>c("span",{class:"-top-9 left-2 border-gray-500 active:scale-90 absolute items-center w-7 h-7 hover:scale-150 transition text-red-200 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2",title:"Remount"},[c("svg",{xmlns:"http://www.w3.org/2000/svg",class:"top-1 left-1 relative w-4 h-4 text-red-600 hover:text-red-500",viewBox:"0 0 30 30",width:"2",height:"2",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"},[c("g",{id:"surface1"},[c("path",{style:{},d:"M 16 4 C 10.886719 4 6.617188 7.160156 4.875 11.625 L 6.71875 12.375 C 8.175781 8.640625 11.710938 6 16 6 C 19.242188 6 22.132813 7.589844 23.9375 10 L 20 10 L 20 12 L 27 12 L 27 5 L 25 5 L 25 8.09375 C 22.808594 5.582031 19.570313 4 16 4 Z M 25.28125 19.625 C 23.824219 23.359375 20.289063 26 16 26 C 12.722656 26 9.84375 24.386719 8.03125 22 L 12 22 L 12 20 L 5 20 L 5 27 L 7 27 L 7 23.90625 C 9.1875 26.386719 12.394531 28 16 28 C 21.113281 28 25.382813 24.839844 27.125 20.375 Z "})])])],-1)),pTt=[uTt],_Tt=["onClick"],hTt=Pt(()=>c("span",{class:"-top-6 -left-6 border-gray-500 active:scale-90 absolute items-center w-7 h-7 hover:scale-150 transition text-red-200 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2",title:"Talk"},[c("svg",{xmlns:"http://www.w3.org/2000/svg",class:"top-1 left-1 relative w-4 h-4 text-red-600 hover:text-red-500",viewBox:"0 0 24 24",width:"2",height:"2",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"},[c("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),c("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})])],-1)),fTt=[hTt],mTt={class:"w-fit"},gTt={class:"w-fit"},bTt={class:"relative grow"},ETt={class:"group relative w-max"},yTt=Pt(()=>c("i",{"data-feather":"send"},null,-1)),vTt=[yTt],STt=Pt(()=>c("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"},[c("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Sends your message to the AI.")],-1)),TTt={class:"group relative w-max"},xTt=["src"],CTt=Pt(()=>c("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"},[c("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Sends your message to the AI with internet search.")],-1)),wTt={class:"group relative w-max"},RTt=Pt(()=>c("i",{"data-feather":"mic"},null,-1)),ATt=[RTt],NTt=Pt(()=>c("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"},[c("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Press and talk.")],-1)),OTt={key:5,class:"group relative w-max"},ITt=Pt(()=>c("i",{"data-feather":"mic"},null,-1)),MTt=[ITt],DTt=Pt(()=>c("i",{"data-feather":"mic"},null,-1)),kTt=[DTt],LTt=Pt(()=>c("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"},[c("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Real time bidirectional audio mode.")],-1)),PTt={key:6,class:"group relative w-max"},UTt=Pt(()=>c("i",{"data-feather":"file-plus"},null,-1)),FTt=[UTt],BTt=Pt(()=>c("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"},[c("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Send File to the AI.")],-1)),GTt={class:"group relative w-max"},VTt=Pt(()=>c("i",{"data-feather":"camera"},null,-1)),zTt=[VTt],HTt=Pt(()=>c("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"},[c("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Take a shot from webcam.")],-1)),qTt={class:"group relative w-max"},YTt=Pt(()=>c("i",{"data-feather":"globe"},null,-1)),$Tt=[YTt],WTt=Pt(()=>c("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"},[c("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"Add a weblink to the discussion.")],-1)),KTt={class:"group relative w-max"},jTt=Pt(()=>c("i",{"data-feather":"message-square"},null,-1)),QTt=[jTt],XTt=Pt(()=>c("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"},[c("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"New empty User message.")],-1)),ZTt={class:"group relative w-max"},JTt=Pt(()=>c("i",{"data-feather":"message-square"},null,-1)),ext=[JTt],txt=Pt(()=>c("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"},[c("p",{class:"max-w-sm text-sm text-gray-800 dark:text-gray-200"},"New empty ai message.")],-1)),nxt=Pt(()=>c("div",{class:"ml-auto gap-2"},null,-1));function ixt(n,e,t,i,s,r){const o=mt("MountedPersonalitiesList"),a=mt("MountedPersonalities"),l=mt("PersonalitiesCommands"),u=mt("UniversalForm");return w(),A($e,null,[c("form",null,[c("div",XSt,[s.filesList.length>0||s.showPersonalities?(w(),A("div",ZSt,[c("div",JSt,[c("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]=ge(d=>s.showfilesList=!s.showfilesList,["stop"]))},n0t,8,e0t)]),s.filesList.length>0&&s.showfilesList==!0?(w(),A("div",i0t,[c("div",s0t,[Te(as,{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:We(()=>[(w(!0),A($e,null,lt(s.filesList,(d,h)=>(w(),A("div",{key:h+"-"+d.name},[c("div",{class:"m-1",title:d.name},[c("div",o0t,[s.isFileSentList[h]?V("",!0):(w(),A("div",a0t,d0t)),u0t,c("div",{class:ze(["line-clamp-1 w-3/5",s.isFileSentList[h]?"text-green-500":"text-red-200"])},he(d.name),3),p0t,c("div",_0t,[c("p",h0t,he(r.computedFileSize(d.size)),1),c("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(d)},g0t,8,f0t)])])],8,r0t)]))),128))]),_:1})])])):V("",!0),s.filesList.length>0?(w(),A("div",b0t,[c("div",E0t,[y0t,et(" "+he(s.totalSize)+" ("+he(s.filesList.length)+") ",1)]),v0t,c("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]=(...d)=>r.clear_files&&r.clear_files(...d))},T0t),c("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]=(...d)=>r.download_files&&r.download_files(...d))},C0t)])):V("",!0),s.showPersonalities?(w(),A("div",w0t,[Te(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"])])):V("",!0)])):V("",!0),s.selecting_model||s.selecting_binding?(w(),A("div",R0t,[c("div",A0t,[c("img",{src:s.loader_v0,class:"w-50 h-50"},null,8,N0t),O0t])])):V("",!0),c("div",I0t,[c("div",M0t,[t.loading?(w(),A("div",D0t,[c("img",{src:s.loader_v0},null,8,k0t),L0t])):V("",!0),t.loading?V("",!0):(w(),A("div",P0t,[c("div",U0t,[c("div",F0t,[(w(!0),A($e,null,lt(r.installedBindings,(d,h)=>(w(),A("div",{class:"w-fit h-fit inset-0 opacity-100",key:h+"-"+d.name,ref_for:!0,ref:"installedBindings",onMouseover:f=>r.showBindingHoveredIn(h),onMouseleave:e[4]||(e[4]=f=>r.showBindingHoveredOut())},[h!=r.binding_name?(w(),A("div",{key:0,class:ze(["items-center flex flex-row relative z-20 hover:-translate-y-8 duration-300",s.bindingHoveredIndex===h?"scale-150":""])},[c("div",G0t,[c("button",{onClick:ge(f=>r.setBinding(d),["prevent"]),class:"w-10 h-10 relative"},[c("img",{src:d.icon?d.icon:s.modelImgPlaceholder,onError:e[3]||(e[3]=(...f)=>s.modelImgPlaceholder&&s.modelImgPlaceholder(...f)),class:ze(["z-50 w-10 h-10 rounded-full object-fill text-red-700 border-2 border-gray-500 active:scale-90",s.bindingHoveredIndex===h?"scale-150 ":""+d.name==r.binding_name?"border-secondary":"border-transparent z-0"]),title:d.name},null,42,z0t)],8,V0t)])],2)):V("",!0)],40,B0t))),128))])]),c("div",H0t,[c("button",{onClick:e[5]||(e[5]=ge(d=>r.showModelConfig(),["prevent"])),class:"w-8 h-8"},[c("img",{src:r.currentBindingIcon,class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary hover:scale-110 hover:-translate-y-1 duration-200",title:r.currentBinding?r.currentBinding.name:"unknown"},null,8,q0t)])])])),t.loading?V("",!0):(w(),A("div",Y0t,[c("div",$0t,[c("div",W0t,[(w(!0),A($e,null,lt(r.installedModels,(d,h)=>(w(),A("div",{class:"w-fit h-fit",key:h+"-"+d.name,ref_for:!0,ref:"installedModels",onMouseover:f=>r.showModelHoveredIn(h),onMouseleave:e[7]||(e[7]=f=>r.showModelHoveredOut())},[h!=r.model_name?(w(),A("div",{key:0,class:ze(["items-center flex flex-row relative z-20 hover:-translate-y-8 duration-300",s.modelHoveredIndex===h?"scale-150":""])},[c("div",j0t,[c("button",{onClick:ge(f=>r.setModel(d),["prevent"]),class:"w-10 h-10 relative"},[c("img",{src:d.icon?d.icon:s.modelImgPlaceholder,onError:e[6]||(e[6]=(...f)=>n.personalityImgPlacehodler&&n.personalityImgPlacehodler(...f)),class:ze(["z-50 w-10 h-10 rounded-full object-fill text-red-700 border-2 border-gray-500 active:scale-90",s.modelHoveredIndex===h?"scale-150 ":""+d.name==r.model_name?"border-secondary":"border-transparent z-0"]),title:d.name},null,42,X0t)],8,Q0t)])],2)):V("",!0)],40,K0t))),128))])]),c("div",Z0t,[c("button",{onClick:e[8]||(e[8]=ge(d=>r.copyModelName(),["prevent"])),class:"w-8 h-8"},[c("img",{src:r.currentModelIcon,class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary hover:scale-110 hover:-translate-y-1 duration-400",title:r.currentModel?r.currentModel.name:"unknown"},null,8,J0t)])])])),t.loading?V("",!0):(w(),A("div",eTt,[c("div",tTt,[c("div",nTt,[(w(!0),A($e,null,lt(r.mountedPersonalities,(d,h)=>(w(),A("div",{class:"w-fit h-fit inset-0 opacity-100",key:h+"-"+d.name,ref_for:!0,ref:"mountedPersonalities",onMouseover:f=>r.showPersonalityHoveredIn(h),onMouseleave:e[10]||(e[10]=f=>r.showPersonalityHoveredOut())},[h!=r.personality_name?(w(),A("div",{key:0,class:ze(["items-center flex flex-row relative z-20 hover:-translate-y-8 duration-300",s.personalityHoveredIndex===h?"scale-150":""])},[c("div",sTt,[c("button",{onClick:ge(f=>r.onPersonalitySelected(d),["prevent"]),class:"w-10 h-10 relative"},[c("img",{src:s.bUrl+d.avatar,onError:e[9]||(e[9]=(...f)=>n.personalityImgPlacehodler&&n.personalityImgPlacehodler(...f)),class:ze(["z-50 w-10 h-10 rounded-full object-fill text-red-700 border-2 border-gray-500 active:scale-90",s.personalityHoveredIndex===h?"scale-150 ":""+this.$store.state.active_personality_id==this.$store.state.personalities.indexOf(d.full_path)?"border-secondary":"border-transparent z-0"]),title:d.name},null,42,oTt)],8,rTt),s.personalityHoveredIndex===h?(w(),A("button",{key:0,onClick:ge(f=>r.unmountPersonality(d),["prevent"])},cTt,8,aTt)):V("",!0),s.personalityHoveredIndex===h?(w(),A("button",{key:1,onClick:ge(f=>r.remount_personality(d),["prevent"])},pTt,8,dTt)):V("",!0),s.personalityHoveredIndex===h?(w(),A("button",{key:2,onClick:ge(f=>r.handleOnTalk(d),["prevent"])},fTt,8,_Tt)):V("",!0)])],2)):V("",!0)],40,iTt))),128))])]),Te(a,{ref:"mountedPers",onShowPersList:r.onShowPersListFun,onReady:r.onPersonalitiesReadyFun},null,8,["onShowPersList","onReady"])])),c("div",mTt,[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"])):V("",!0)]),c("div",gTt,[r.isDataSourceNamesValid?(w(),xt(l,{key:0,icon:"feather:book",commandsList:r.dataSourceNames,sendCommand:r.mountDB,"on-show-toast-message":t.onShowToastMessage,ref:"databasesList"},null,8,["commandsList","sendCommand","on-show-toast-message"])):V("",!0)]),c("div",bTt,[G(c("textarea",{id:"chat",rows:"1","onUpdate:modelValue":e[11]||(e[11]=d=>s.message=d),title:"Hold SHIFT + ENTER to add new line",onPaste:e[12]||(e[12]=(...d)=>r.handlePaste&&r.handlePaste(...d)),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[13]||(e[13]=Hs(ge(d=>r.submitOnEnter(d),["exact"]),["enter"]))},`\r + `,544),[[we,s.message]])]),t.loading?(w(),A("button",{key:4,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[14]||(e[14]=ge((...d)=>r.stopGenerating&&r.stopGenerating(...d),["stop"]))}," Stop generating ")):V("",!0),c("div",ETt,[t.loading?V("",!0):(w(),A("button",{key:0,type:"button",onClick:e[15]||(e[15]=(...d)=>r.submit&&r.submit(...d)),title:"Send",class:"w-6 text-panel hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},vTt)),STt]),c("div",TTt,[t.loading?V("",!0):(w(),A("button",{key:0,type:"button",onClick:e[16]||(e[16]=(...d)=>r.submitWithInternetSearch&&r.submitWithInternetSearch(...d)),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"},[c("img",{src:s.sendGlobe,width:"50",height:"50",style:{stroke:"currentColor",fill:"currentColor"}},null,8,xTt)])),CTt]),c("div",wTt,[t.loading?V("",!0):(w(),A("button",{key:0,type:"button",onClick:e[17]||(e[17]=(...d)=>r.startSpeechRecognition&&r.startSpeechRecognition(...d)),class:ze([{"text-red-500":s.isListeningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"])},ATt,2)),NTt]),n.$store.state.config.active_tts_service!="None"?(w(),A("div",OTt,[s.is_rt?(w(),A("button",{key:0,type:"button",onClick:e[18]||(e[18]=(...d)=>r.stopRTCom&&r.stopRTCom(...d)),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90 bg-red-500 border borderred700 rounded-md"},MTt)):(w(),A("button",{key:1,type:"button",onClick:e[19]||(e[19]=(...d)=>r.startRTCom&&r.startRTCom(...d)),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90 bg-green-500 border border-green-700 rounded-md"},kTt)),LTt])):V("",!0),t.loading?V("",!0):(w(),A("div",PTt,[c("input",{type:"file",ref:"fileDialog",style:{display:"none"},onChange:e[20]||(e[20]=(...d)=>r.addFiles&&r.addFiles(...d)),multiple:""},null,544),c("button",{type:"button",onClick:e[21]||(e[21]=ge((...d)=>r.add_file&&r.add_file(...d),["prevent"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},FTt),BTt])),c("div",GTt,[t.loading?V("",!0):(w(),A("button",{key:0,type:"button",onClick:e[22]||(e[22]=ge((...d)=>r.takePicture&&r.takePicture(...d),["stop"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},zTt)),HTt]),c("div",qTt,[t.loading?V("",!0):(w(),A("button",{key:0,type:"button",onClick:e[23]||(e[23]=ge((...d)=>r.addWebLink&&r.addWebLink(...d),["stop"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},$Tt)),WTt]),c("div",KTt,[t.loading?V("",!0):(w(),A("button",{key:0,type:"button",onClick:e[24]||(e[24]=ge((...d)=>r.makeAnEmptyUserMessage&&r.makeAnEmptyUserMessage(...d),["stop"])),class:"w-6 text-gray-800 hover:text-secondary duration-75 active:scale-90 hover:translate-y-[-5px]"},QTt)),XTt]),c("div",ZTt,[t.loading?V("",!0):(w(),A("button",{key:0,type:"button",onClick:e[25]||(e[25]=ge((...d)=>r.makeAnEmptyAIMessage&&r.makeAnEmptyAIMessage(...d),["stop"])),class:"w-6 text-red-400 hover:text-secondary duration-75 active:scale-90 hover:translate-y-[-5px]"},ext)),txt])]),nxt])])]),Te(u,{ref:"universalForm",class:"z-20"},null,512)],64)}const yO=bt(QSt,[["render",ixt],["__scopeId","data-v-64fb461b"]]),sxt={name:"WelcomeComponent",computed:{storeLogo(){return this.$store.state.config?Ti:this.$store.state.config.app_custom_logo!=""?"/user_infos/"+this.$store.state.config.app_custom_logo:Ti}},data(){},setup(){return{}}},rxt={class:"flex flex-col text-center w-full h-full"},oxt={class:"flex flex-col text-center items-center"},axt={class:"flex items-center gap-3 text-5xl drop-shadow-md align-middle pt-24"},lxt=["src"],cxt=c("div",{class:"flex flex-col items-start"},[c("p",{class:"text-2xl"},"LoLLMS"),c("p",{class:"text-gray-400 text-base"},"One tool to rule them all")],-1),dxt=c("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),uxt=c("p",{class:"text-2xl"},"Welcome",-1),pxt=c("p",{class:"text-lg"},"Please create a new discussion or select existing one to start",-1);function _xt(n,e,t,i,s,r){return w(),A("div",rxt,[c("div",oxt,[c("div",axt,[c("img",{class:"w-12 hover:scale-95 duration-150",title:"LoLLMS WebUI",src:n.$store.state.config==null?r.storeLogo:n.$store.state.config.app_custom_logo!=""?"/user_infos/"+n.$store.state.config.app_custom_logo:r.storeLogo,alt:"Logo"},null,8,lxt),cxt]),dxt,uxt,pxt])])}const vO=bt(sxt,[["render",_xt]]);var hxt=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}(),iu=globalThis&&globalThis.__assign||function(){return iu=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 Rxt(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)||!us(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 Axt(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,u){return l[u]="",l},{});!xi(s)||!us(s)||(Object.assign(s.style,a),Object.keys(r).forEach(function(l){s.removeAttribute(l)}))})}}const Nxt={name:"applyStyles",enabled:!0,phase:"write",fn:Rxt,effect:Axt,requires:["computeStyles"]};function ls(n){return n.split("-")[0]}var ro=Math.max,au=Math.min,ya=Math.round;function tb(){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 AO(){return!/^((?!chrome|android).)*safari/i.test(tb())}function va(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=ho(n)?ai(n):window,a=o.visualViewport,l=!AO()&&t,u=(i.left+(l&&a?a.offsetLeft:0))/s,d=(i.top+(l&&a?a.offsetTop:0))/r,h=i.width/s,f=i.height/r;return{width:h,height:f,top:d,right:u+h,bottom:d+f,left:u,x:u,y:d}}function LE(n){var e=va(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 NO(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&kE(t)){var i=e;do{if(i&&n.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function qs(n){return ai(n).getComputedStyle(n)}function Oxt(n){return["table","td","th"].indexOf(us(n))>=0}function Or(n){return((ho(n)?n.ownerDocument:n.document)||window.document).documentElement}function lp(n){return us(n)==="html"?n:n.assignedSlot||n.parentNode||(kE(n)?n.host:null)||Or(n)}function DC(n){return!xi(n)||qs(n).position==="fixed"?null:n.offsetParent}function Ixt(n){var e=/firefox/i.test(tb()),t=/Trident/i.test(tb());if(t&&xi(n)){var i=qs(n);if(i.position==="fixed")return null}var s=lp(n);for(kE(s)&&(s=s.host);xi(s)&&["html","body"].indexOf(us(s))<0;){var r=qs(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 yc(n){for(var e=ai(n),t=DC(n);t&&Oxt(t)&&qs(t).position==="static";)t=DC(t);return t&&(us(t)==="html"||us(t)==="body"&&qs(t).position==="static")?e:t||Ixt(n)||e}function PE(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function kl(n,e,t){return ro(n,au(e,t))}function Mxt(n,e,t){var i=kl(n,e,t);return i>t?t:i}function OO(){return{top:0,right:0,bottom:0,left:0}}function IO(n){return Object.assign({},OO(),n)}function MO(n,e){return e.reduce(function(t,i){return t[i]=n,t},{})}var Dxt=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,IO(typeof e!="number"?e:MO(e,Ec))};function kxt(n){var e,t=n.state,i=n.name,s=n.options,r=t.elements.arrow,o=t.modifiersData.popperOffsets,a=ls(t.placement),l=PE(a),u=[Xn,Ai].indexOf(a)>=0,d=u?"height":"width";if(!(!r||!o)){var h=Dxt(s.padding,t),f=LE(r),_=l==="y"?Qn:Xn,m=l==="y"?Ri:Ai,E=t.rects.reference[d]+t.rects.reference[l]-o[l]-t.rects.popper[d],b=o[l]-t.rects.reference[l],g=yc(r),y=g?l==="y"?g.clientHeight||0:g.clientWidth||0:0,v=E/2-b/2,S=h[_],C=y-f[d]-h[m],T=y/2-f[d]/2+v,O=kl(S,T,C),k=l;t.modifiersData[i]=(e={},e[k]=O,e.centerOffset=O-T,e)}}function Lxt(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)||NO(e.elements.popper,s)&&(e.elements.arrow=s))}const Pxt={name:"arrow",enabled:!0,phase:"main",fn:kxt,effect:Lxt,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Sa(n){return n.split("-")[1]}var Uxt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Fxt(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 kC(n){var e,t=n.popper,i=n.popperRect,s=n.placement,r=n.variation,o=n.offsets,a=n.position,l=n.gpuAcceleration,u=n.adaptive,d=n.roundOffsets,h=n.isFixed,f=o.x,_=f===void 0?0:f,m=o.y,E=m===void 0?0:m,b=typeof d=="function"?d({x:_,y:E}):{x:_,y:E};_=b.x,E=b.y;var g=o.hasOwnProperty("x"),y=o.hasOwnProperty("y"),v=Xn,S=Qn,C=window;if(u){var T=yc(t),O="clientHeight",k="clientWidth";if(T===ai(t)&&(T=Or(t),qs(T).position!=="static"&&a==="absolute"&&(O="scrollHeight",k="scrollWidth")),T=T,s===Qn||(s===Xn||s===Ai)&&r===ic){S=Ri;var x=h&&T===C&&C.visualViewport?C.visualViewport.height:T[O];E-=x-i.height,E*=l?1:-1}if(s===Xn||(s===Qn||s===Ri)&&r===ic){v=Ai;var I=h&&T===C&&C.visualViewport?C.visualViewport.width:T[k];_-=I-i.width,_*=l?1:-1}}var F=Object.assign({position:a},u&&Uxt),B=d===!0?Fxt({x:_,y:E},ai(t)):{x:_,y:E};if(_=B.x,E=B.y,l){var ne;return Object.assign({},F,(ne={},ne[S]=y?"0":"",ne[v]=g?"0":"",ne.transform=(C.devicePixelRatio||1)<=1?"translate("+_+"px, "+E+"px)":"translate3d("+_+"px, "+E+"px, 0)",ne))}return Object.assign({},F,(e={},e[S]=y?E+"px":"",e[v]=g?_+"px":"",e.transform="",e))}function Bxt(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,u={placement:ls(e.placement),variation:Sa(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,kC(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,kC(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const Gxt={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Bxt,data:{}};var qc={passive:!0};function Vxt(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),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return r&&u.forEach(function(d){d.addEventListener("scroll",t.update,qc)}),a&&l.addEventListener("resize",t.update,qc),function(){r&&u.forEach(function(d){d.removeEventListener("scroll",t.update,qc)}),a&&l.removeEventListener("resize",t.update,qc)}}const zxt={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Vxt,data:{}};var Hxt={left:"right",right:"left",bottom:"top",top:"bottom"};function Fd(n){return n.replace(/left|right|bottom|top/g,function(e){return Hxt[e]})}var qxt={start:"end",end:"start"};function LC(n){return n.replace(/start|end/g,function(e){return qxt[e]})}function UE(n){var e=ai(n),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function FE(n){return va(Or(n)).left+UE(n).scrollLeft}function Yxt(n,e){var t=ai(n),i=Or(n),s=t.visualViewport,r=i.clientWidth,o=i.clientHeight,a=0,l=0;if(s){r=s.width,o=s.height;var u=AO();(u||!u&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:r,height:o,x:a+FE(n),y:l}}function $xt(n){var e,t=Or(n),i=UE(n),s=(e=n.ownerDocument)==null?void 0:e.body,r=ro(t.scrollWidth,t.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=ro(t.scrollHeight,t.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-i.scrollLeft+FE(n),l=-i.scrollTop;return qs(s||t).direction==="rtl"&&(a+=ro(t.clientWidth,s?s.clientWidth:0)-r),{width:r,height:o,x:a,y:l}}function BE(n){var e=qs(n),t=e.overflow,i=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+s+i)}function DO(n){return["html","body","#document"].indexOf(us(n))>=0?n.ownerDocument.body:xi(n)&&BE(n)?n:DO(lp(n))}function Ll(n,e){var t;e===void 0&&(e=[]);var i=DO(n),s=i===((t=n.ownerDocument)==null?void 0:t.body),r=ai(i),o=s?[r].concat(r.visualViewport||[],BE(i)?i:[]):i,a=e.concat(o);return s?a:a.concat(Ll(lp(o)))}function nb(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function Wxt(n,e){var t=va(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 PC(n,e,t){return e===wO?nb(Yxt(n,t)):ho(e)?Wxt(e,t):nb($xt(Or(n)))}function Kxt(n){var e=Ll(lp(n)),t=["absolute","fixed"].indexOf(qs(n).position)>=0,i=t&&xi(n)?yc(n):n;return ho(i)?e.filter(function(s){return ho(s)&&NO(s,i)&&us(s)!=="body"}):[]}function jxt(n,e,t,i){var s=e==="clippingParents"?Kxt(n):[].concat(e),r=[].concat(s,[t]),o=r[0],a=r.reduce(function(l,u){var d=PC(n,u,i);return l.top=ro(d.top,l.top),l.right=au(d.right,l.right),l.bottom=au(d.bottom,l.bottom),l.left=ro(d.left,l.left),l},PC(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 kO(n){var e=n.reference,t=n.element,i=n.placement,s=i?ls(i):null,r=i?Sa(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 Ri:l={x:o,y:e.y+e.height};break;case Ai: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 u=s?PE(s):null;if(u!=null){var d=u==="y"?"height":"width";switch(r){case Ea:l[u]=l[u]-(e[d]/2-t[d]/2);break;case ic:l[u]=l[u]+(e[d]/2-t[d]/2);break}}return l}function sc(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?fxt:a,u=t.rootBoundary,d=u===void 0?wO:u,h=t.elementContext,f=h===void 0?hl:h,_=t.altBoundary,m=_===void 0?!1:_,E=t.padding,b=E===void 0?0:E,g=IO(typeof b!="number"?b:MO(b,Ec)),y=f===hl?mxt:hl,v=n.rects.popper,S=n.elements[m?y:f],C=jxt(ho(S)?S:S.contextElement||Or(n.elements.popper),l,d,o),T=va(n.elements.reference),O=kO({reference:T,element:v,strategy:"absolute",placement:s}),k=nb(Object.assign({},v,O)),x=f===hl?k:T,I={top:C.top-x.top+g.top,bottom:x.bottom-C.bottom+g.bottom,left:C.left-x.left+g.left,right:x.right-C.right+g.right},F=n.modifiersData.offset;if(f===hl&&F){var B=F[s];Object.keys(I).forEach(function(ne){var L=[Ai,Ri].indexOf(ne)>=0?1:-1,$=[Qn,Ri].indexOf(ne)>=0?"y":"x";I[ne]+=B[$]*L})}return I}function Qxt(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,u=l===void 0?RO:l,d=Sa(i),h=d?a?MC:MC.filter(function(m){return Sa(m)===d}):Ec,f=h.filter(function(m){return u.indexOf(m)>=0});f.length===0&&(f=h);var _=f.reduce(function(m,E){return m[E]=sc(n,{placement:E,boundary:s,rootBoundary:r,padding:o})[ls(E)],m},{});return Object.keys(_).sort(function(m,E){return _[m]-_[E]})}function Xxt(n){if(ls(n)===DE)return[];var e=Fd(n);return[LC(n),e,LC(e)]}function Zxt(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,u=t.padding,d=t.boundary,h=t.rootBoundary,f=t.altBoundary,_=t.flipVariations,m=_===void 0?!0:_,E=t.allowedAutoPlacements,b=e.options.placement,g=ls(b),y=g===b,v=l||(y||!m?[Fd(b)]:Xxt(b)),S=[b].concat(v).reduce(function(Ee,xe){return Ee.concat(ls(xe)===DE?Qxt(e,{placement:xe,boundary:d,rootBoundary:h,padding:u,flipVariations:m,allowedAutoPlacements:E}):xe)},[]),C=e.rects.reference,T=e.rects.popper,O=new Map,k=!0,x=S[0],I=0;I=0,$=L?"width":"height",H=sc(e,{placement:F,boundary:d,rootBoundary:h,altBoundary:f,padding:u}),U=L?ne?Ai:Xn:ne?Ri:Qn;C[$]>T[$]&&(U=Fd(U));var Q=Fd(U),J=[];if(r&&J.push(H[B]<=0),a&&J.push(H[U]<=0,H[Q]<=0),J.every(function(Ee){return Ee})){x=F,k=!1;break}O.set(F,J)}if(k)for(var j=m?3:1,ae=function(xe){var Me=S.find(function(Z){var ye=O.get(Z);if(ye)return ye.slice(0,xe).every(function(fe){return fe})});if(Me)return x=Me,"break"},ve=j;ve>0;ve--){var ee=ae(ve);if(ee==="break")break}e.placement!==x&&(e.modifiersData[i]._skip=!0,e.placement=x,e.reset=!0)}}const Jxt={name:"flip",enabled:!0,phase:"main",fn:Zxt,requiresIfExists:["offset"],data:{_skip:!1}};function UC(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 FC(n){return[Qn,Ai,Ri,Xn].some(function(e){return n[e]>=0})}function eCt(n){var e=n.state,t=n.name,i=e.rects.reference,s=e.rects.popper,r=e.modifiersData.preventOverflow,o=sc(e,{elementContext:"reference"}),a=sc(e,{altBoundary:!0}),l=UC(o,i),u=UC(a,s,r),d=FC(l),h=FC(u);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:d,hasPopperEscaped:h},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":h})}const tCt={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:eCt};function nCt(n,e,t){var i=ls(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,Ai].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function iCt(n){var e=n.state,t=n.options,i=n.name,s=t.offset,r=s===void 0?[0,0]:s,o=RO.reduce(function(d,h){return d[h]=nCt(h,e.rects,r),d},{}),a=o[e.placement],l=a.x,u=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=u),e.modifiersData[i]=o}const sCt={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:iCt};function rCt(n){var e=n.state,t=n.name;e.modifiersData[t]=kO({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const oCt={name:"popperOffsets",enabled:!0,phase:"read",fn:rCt,data:{}};function aCt(n){return n==="x"?"y":"x"}function lCt(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,u=t.rootBoundary,d=t.altBoundary,h=t.padding,f=t.tether,_=f===void 0?!0:f,m=t.tetherOffset,E=m===void 0?0:m,b=sc(e,{boundary:l,rootBoundary:u,padding:h,altBoundary:d}),g=ls(e.placement),y=Sa(e.placement),v=!y,S=PE(g),C=aCt(S),T=e.modifiersData.popperOffsets,O=e.rects.reference,k=e.rects.popper,x=typeof E=="function"?E(Object.assign({},e.rects,{placement:e.placement})):E,I=typeof x=="number"?{mainAxis:x,altAxis:x}:Object.assign({mainAxis:0,altAxis:0},x),F=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,B={x:0,y:0};if(T){if(r){var ne,L=S==="y"?Qn:Xn,$=S==="y"?Ri:Ai,H=S==="y"?"height":"width",U=T[S],Q=U+b[L],J=U-b[$],j=_?-k[H]/2:0,ae=y===Ea?O[H]:k[H],ve=y===Ea?-k[H]:-O[H],ee=e.elements.arrow,Ee=_&&ee?LE(ee):{width:0,height:0},xe=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:OO(),Me=xe[L],Z=xe[$],ye=kl(0,O[H],Ee[H]),fe=v?O[H]/2-j-ye-Me-I.mainAxis:ae-ye-Me-I.mainAxis,Ne=v?-O[H]/2+j+ye+Z+I.mainAxis:ve+ye+Z+I.mainAxis,Le=e.elements.arrow&&yc(e.elements.arrow),D=Le?S==="y"?Le.clientTop||0:Le.clientLeft||0:0,q=(ne=F==null?void 0:F[S])!=null?ne:0,K=U+fe-q-D,de=U+Ne-q,le=kl(_?au(Q,K):Q,U,_?ro(J,de):J);T[S]=le,B[S]=le-U}if(a){var Re,Ie=S==="x"?Qn:Xn,z=S==="x"?Ri:Ai,pe=T[C],re=C==="y"?"height":"width",ce=pe+b[Ie],M=pe-b[z],N=[Qn,Xn].indexOf(g)!==-1,W=(Re=F==null?void 0:F[C])!=null?Re:0,ue=N?ce:pe-O[re]-k[re]-W+I.altAxis,X=N?pe+O[re]+k[re]-W-I.altAxis:M,ie=_&&N?Mxt(ue,pe,X):kl(_?ue:ce,pe,_?X:M);T[C]=ie,B[C]=ie-pe}e.modifiersData[i]=B}}const cCt={name:"preventOverflow",enabled:!0,phase:"main",fn:lCt,requiresIfExists:["offset"]};function dCt(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function uCt(n){return n===ai(n)||!xi(n)?UE(n):dCt(n)}function pCt(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 _Ct(n,e,t){t===void 0&&(t=!1);var i=xi(e),s=xi(e)&&pCt(e),r=Or(e),o=va(n,s,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(i||!i&&!t)&&((us(e)!=="body"||BE(r))&&(a=uCt(e)),xi(e)?(l=va(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):r&&(l.x=FE(r))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function hCt(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 fCt(n){var e=hCt(n);return wxt.reduce(function(t,i){return t.concat(e.filter(function(s){return s.phase===i}))},[])}function mCt(n){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(n())})})),e}}function gCt(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 BC={placement:"bottom",modifiers:[],strategy:"absolute"};function GC(){for(var n=arguments.length,e=new Array(n),t=0;t(yo("data-v-54bb4ed3"),n=n(),vo(),n),wCt={key:0,class:"fixed top-0 left-0 w-screen h-screen flex items-center justify-center"},RCt={class:"flex flex-col text-center"},ACt={class:"flex flex-col text-center items-center"},NCt={class:"flex items-center gap-3 text-5xl drop-shadow-md align-middle pt-24"},OCt=Ft(()=>c("img",{class:"w-24 animate-bounce",title:"LoLLMS WebUI",src:Ti,alt:"Logo"},null,-1)),ICt={class:"flex flex-col items-start"},MCt={class:"text-2xl font-bold text-5xl drop-shadow-md align-middle"},DCt=Ft(()=>c("p",{class:"text-gray-400 text-base"},"One tool to rule them all",-1)),kCt=Ft(()=>c("p",{class:"text-gray-400 text-base"},"by ParisNeo",-1)),LCt=Ft(()=>c("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)),PCt=Ft(()=>c("p",{class:"text-2xl mb-10 font-bold drop-shadow-md"},"Welcome",-1)),UCt={role:"status",class:"text-center w-full display: flex; flex-row align-items: center;"},FCt={class:"text-2xl animate-pulse mt-2"},BCt=Ft(()=>c("i",{"data-feather":"chevron-right"},null,-1)),GCt=[BCt],VCt=Ft(()=>c("i",{"data-feather":"chevron-left"},null,-1)),zCt=[VCt],HCt=Fu('',1),qCt=[HCt],YCt={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"},$Ct={class:"text-light-text-panel dark:text-dark-text-panel bg-bg-light-panel sticky z-10 top-0 dark:bg-bg-dark-tone shadow-md"},WCt={class:"flex-row p-4 flex items-center gap-3 flex-0"},KCt=Ft(()=>c("i",{"data-feather":"plus"},null,-1)),jCt=[KCt],QCt=Ft(()=>c("i",{"data-feather":"check-square"},null,-1)),XCt=[QCt],ZCt={class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Reset database, remove all discussions"},JCt=Ft(()=>c("i",{"data-feather":"database"},null,-1)),e1t=[JCt],t1t=Ft(()=>c("i",{"data-feather":"log-in"},null,-1)),n1t=[t1t],i1t=Ft(()=>c("i",{"data-feather":"folder"},null,-1)),s1t=[i1t],r1t={key:1,class:"dropdown"},o1t=Ft(()=>c("i",{"data-feather":"search"},null,-1)),a1t=[o1t],l1t={key:2,class:"flex gap-3 flex-1 items-center duration-75"},c1t=Ft(()=>c("i",{"data-feather":"x"},null,-1)),d1t=[c1t],u1t=Ft(()=>c("i",{"data-feather":"check"},null,-1)),p1t=[u1t],_1t=Ft(()=>c("i",{"data-feather":"hard-drive"},null,-1)),h1t=[_1t],f1t=Ft(()=>c("i",{"data-feather":"check-circle"},null,-1)),m1t=[f1t],g1t=Ft(()=>c("i",{"data-feather":"x-octagon"},null,-1)),b1t=[g1t],E1t=Ft(()=>c("i",{"data-feather":"book"},null,-1)),y1t=[E1t],v1t={key:7,title:"Loading..",class:"flex flex-row flex-grow justify-end"},S1t=Ft(()=>c("div",{role:"status"},[c("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"},[c("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"}),c("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"})]),c("span",{class:"sr-only"},"Loading...")],-1)),T1t=[S1t],x1t={key:0,class:"flex-row items-center gap-3 flex-0 w-full"},C1t={class:"p-4 pt-2"},w1t={class:"relative"},R1t=Ft(()=>c("div",{class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},[c("div",{class:"scale-75"},[c("i",{"data-feather":"search"})])],-1)),A1t={class:"absolute inset-y-0 right-0 flex items-center pr-3"},N1t=Ft(()=>c("i",{"data-feather":"x"},null,-1)),O1t=[N1t],I1t={key:1,class:"h-px bg-bg-light p-0 mb-4 px-4 mx-4 border-0 dark:bg-bg-dark"},M1t={key:2,class:"flex flex-row flex-grow p-4 pt-0 items-center"},D1t={class:"flex flex-row flex-grow"},k1t={key:0},L1t={class:"flex flex-row"},P1t={key:0,class:"flex gap-3"},U1t=Ft(()=>c("i",{"data-feather":"trash"},null,-1)),F1t=[U1t],B1t={key:1,class:"flex gap-3 mx-3 flex-1 items-center justify-end group-hover:visible duration-75"},G1t=Ft(()=>c("i",{"data-feather":"check"},null,-1)),V1t=[G1t],z1t=Ft(()=>c("i",{"data-feather":"x"},null,-1)),H1t=[z1t],q1t={class:"flex gap-3"},Y1t=Ft(()=>c("i",{"data-feather":"codepen"},null,-1)),$1t=[Y1t],W1t=Ft(()=>c("i",{"data-feather":"folder"},null,-1)),K1t=[W1t],j1t=Ft(()=>c("i",{"data-feather":"bookmark"},null,-1)),Q1t=[j1t],X1t=Ft(()=>c("i",{"data-feather":"list"},null,-1)),Z1t=[X1t],J1t={class:"relative flex flex-row flex-grow mb-10 z-0 w-full"},ewt={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"},twt=Ft(()=>c("p",{class:"px-3"},"No discussions are found",-1)),nwt=[twt],iwt=Ft(()=>c("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)),swt={class:"text-center font-large font-bold text-l drop-shadow-md align-middle"},rwt={key:2,class:"relative flex flex-col flex-grow"},owt={class:"container pt-4 pb-50 mb-50 w-full"},awt=Ft(()=>c("div",null,[c("br"),c("br"),c("br"),c("br"),c("br"),c("br"),c("br")],-1)),lwt=Ft(()=>c("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)),cwt={key:0,class:"flex flex-row items-center justify-center h-10"},dwt={key:0,class:"relative flex flex-col no-scrollbar shadow-lg w-1/2 bg-bg-light-tone dark:bg-bg-dark-tone h-full"},uwt={ref:"isolatedContent",class:"h-full"},pwt={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"},_wt={class:"text-2xl animate-pulse mt-2 text-light-text-panel dark:text-dark-text-panel"},hwt={setup(){},data(){return{lastMessageHtml:"",defaultMessageHtml:` @@ -247,7 +247,7 @@ Error: `+e.error,4,!1)},async unmount_personality(n){if(!n)return{status:!1,erro - `,memory_icon:SCt,active_skills:TCt,inactive_skills:xCt,skillsRegistry:CCt,robot:wCt,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,leftPanelCollapsed:!1,rightPanelCollapsed:!0,isOpen:!1,discussion_id:0}},methods:{extractHtml(){if(this.discussionArr.length>0){const n=this.discussionArr[this.discussionArr.length-1].content,e="```html",t="```";let i=n.indexOf(e);if(i===-1)return this.lastMessageHtml=this.defaultMessageHtml,this.renderIsolatedContent(),this.defaultMessageHtml;i+=e.length;let s=n.indexOf(t,i);s===-1?this.lastMessageHtml=n.slice(i).trim():this.lastMessageHtml=n.slice(i,s).trim()}else this.lastMessageHtml=this.defaultMessageHtml;this.renderIsolatedContent()},renderIsolatedContent(){const n=document.createElement("iframe");if(n.style.border="none",n.style.width="100%",n.style.height="100%",this.$refs.isolatedContent){this.$refs.isolatedContent.innerHTML="",this.$refs.isolatedContent.appendChild(n);const e=n.contentDocument||n.contentWindow.document;e.open(),e.write(` + `,memory_icon:vCt,active_skills:SCt,inactive_skills:TCt,skillsRegistry:xCt,robot:CCt,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,leftPanelCollapsed:!1,rightPanelCollapsed:!0,isOpen:!1,discussion_id:0}},methods:{extractHtml(){if(this.discussionArr.length>0){const n=this.discussionArr[this.discussionArr.length-1].content,e="```html",t="```";let i=n.indexOf(e);if(i===-1)return this.lastMessageHtml=this.defaultMessageHtml,this.renderIsolatedContent(),this.defaultMessageHtml;i+=e.length;let s=n.indexOf(t,i);s===-1?this.lastMessageHtml=n.slice(i).trim():this.lastMessageHtml=n.slice(i,s).trim()}else this.lastMessageHtml=this.defaultMessageHtml;this.renderIsolatedContent()},renderIsolatedContent(){const n=document.createElement("iframe");if(n.style.border="none",n.style.width="100%",n.style.height="100%",this.$refs.isolatedContent){this.$refs.isolatedContent.innerHTML="",this.$refs.isolatedContent.appendChild(n);const e=n.contentDocument||n.contentWindow.document;e.open(),e.write(` ${this.lastMessageHtml} `),e.close()}},async triggerRobotAction(){this.rightPanelCollapsed=!this.rightPanelCollapsed,this.rightPanelCollapsed||(this.leftPanelCollapsed=!0,this.$nextTick(()=>{this.extractHtml()})),console.log(this.rightPanelCollapsed)},add_webpage(){console.log("addWebLink received"),this.$refs.web_url_input_box.showPanel()},addWebpage(){Se.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,Se.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{Se.post("/set_active_binding_settings",{client_id:this.$store.state.client_id,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. @@ -260,15 +260,15 @@ ${e} ${l}`;navigator.clipboard.writeText(u)}else navigator.clipboard.writeText(e);this.$store.state.toast.showToast("Copied to clipboard successfully",4,!0),Ge(()=>{He.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"),u="discussions_export_"+(t+"."+i+"."+s+"."+r+o+a)+".md";this.loading=!0;const d=await this.export_multiple_discussions(n,"markdown");d?(this.saveMarkdowntoFile(d,u),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 exportDiscussions(){},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"),u="discussions_export_"+(t+"."+i+"."+s+"."+r+o+a)+".json";this.loading=!0;const d=await this.export_multiple_discussions(n,"json");d?(this.saveJSONtoFile(d,u),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 importDiscussionsBundle(n){},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(){console.log("Created discussions view");const e=(await Se.get("/get_versionID")).data.versionId;Ye.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.versionId!==e&&(this.$store.commit("updateVersionId",e),window.location.reload(!0)),this.$nextTick(()=>{He.replace()}),console.log("Connected to socket io");try{this.$store.state.loading_infos="Getting version",this.$store.state.loading_progress=30,await this.$store.dispatch("getVersion")}catch(t){console.log("Error cought:",t)}try{for(this.$store.state.loading_infos="Loading Configuration";Ye.id===void 0;)await new Promise(t=>setTimeout(t,100));this.$store.state.client_id=Ye.id,console.log(this.$store.state.client_id),await this.$store.dispatch("refreshConfig"),console.log("Config ready")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Loading Database",this.$store.state.loading_progress=20,await this.$store.dispatch("refreshDatabase")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting Bindings list",this.$store.state.loading_progress=40,await this.$store.dispatch("refreshBindings")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting personalities zoo",this.$store.state.loading_progress=70,await this.$store.dispatch("refreshPersonalitiesZoo")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting mounted personalities",this.$store.state.loading_progress=80,await this.$store.dispatch("refreshMountedPersonalities")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting models zoo",this.$store.state.loading_progress=90,await this.$store.dispatch("refreshModelsZoo")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting active models",this.$store.state.loading_progress=100,await this.$store.dispatch("refreshModels"),await this.$store.dispatch("refreshModelStatus")}catch(t){console.log("Error cought:",t)}try{await this.$store.dispatch("fetchLanguages"),await this.$store.dispatch("fetchLanguage")}catch(t){console.log("Error cought:",t)}try{await this.$store.dispatch("fetchisRTOn")}catch(t){console.log("Error cought:",t)}this.$store.state.isConnected=!0,this.$store.state.client_id=Ye.id,console.log("Ready"),this.setPageTitle(),await this.list_discussions(),this.loadLastUsedDiscussion(),this.isCreated=!0,this.$store.state.ready=!0,Ye.on("connected",this.socketIOConnected),Ye.on("disconnected",this.socketIODisconnected),console.log("Added events"),Ye.on("show_progress",this.show_progress),Ye.on("hide_progress",this.hide_progress),Ye.on("update_progress",this.update_progress),Ye.on("notification",this.notify),Ye.on("new_message",this.new_message),Ye.on("update_message",this.streamMessageContent),Ye.on("close_message",this.finalMsgEvent),Ye.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}),Ye.onclose=t=>{console.log("WebSocket connection closed:",t.code,t.reason),this.socketIODisconnected()},Ye.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}),Ye.onerror=t=>{console.log("WebSocket connection error:",t.code,t.reason),this.socketIODisconnected(),Ye.disconnect()}},async mounted(){Ye.on("refresh_files",()=>{this.recoverFiles()}),this.$nextTick(()=>{He.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&&Ge(()=>{const n=document.getElementById("messages-list");this.scrollBottom(n)}),this.$store.state.config.show_news_panel&&this.$store.state.news.show()},components:{Discussion:RE,Message:EO,ChatBox:yO,WelcomeComponent:vO,ChoiceDialog:wE,ProgressBar:nc,InputBox:mO,SkillsLibraryViewer:gO},watch:{messages:{handler:"extractHtml",deep:!0},progress_visibility_val(n){console.log("progress_visibility changed to "+n)},filterTitle(n){n==""&&(this.filterInProgress=!0,this.list=this.tempList,this.filterInProgress=!1)},isCheckbox(n){Ge(()=>{He.replace()}),n||(this.isSelectAll=!1)},socketConnected(n){console.log("Websocket connected (watch)",n)},showConfirmation(){Ge(()=>{He.replace()})},isSearch(){Ge(()=>{He.replace()})}},computed:{...Sk({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(){return this.$store.state.ready},databases(){return this.$store.state.databases},client_id(){return Ye.id},showLeftPanel(){return this.$store.state.ready&&!this.leftPanelCollapsed},showRightPanel(){return this.$store.state.ready&&!this.rightPanelCollapsed},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 Ge(()=>{He.replace()}),this.list.filter(n=>n.checkBoxValue==!0)}}},mwt=Object.assign(fwt,{__name:"DiscussionsView",setup(n){return Ws(()=>{VO()}),Se.defaults.baseURL="/",(e,t)=>(w(),A($e,null,[Te(Vi,{name:"fade-and-fly"},{default:We(()=>[e.isReady?V("",!0):(w(),A("div",RCt,[c("div",ACt,[c("div",NCt,[c("div",OCt,[ICt,c("div",MCt,[c("p",DCt,"LoLLMS "+he(e.version_info),1),kCt,LCt])]),PCt,UCt,c("div",FCt,[Te(nc,{ref:"loading_progress",progress:e.loading_progress},null,8,["progress"]),c("p",BCt,he(e.loading_infos)+" ...",1)])])])]))]),_:1}),e.isReady?(w(),A("button",{key:0,onClick:t[0]||(t[0]=(...i)=>e.togglePanel&&e.togglePanel(...i)),class:"absolute top-2 left-2 p-3 bg-white bg-opacity-0 cursor-pointer transition-all duration-300 hover:scale-110 hover:bg-opacity-20 hover:shadow-xl group"},[G(c("div",null,VCt,512),[[Mt,e.leftPanelCollapsed]]),G(c("div",null,HCt,512),[[Mt,!e.leftPanelCollapsed]])])):V("",!0),e.isReady?(w(),A("button",{key:1,onClick:t[1]||(t[1]=ge(i=>e.triggerRobotAction(),["stop"])),class:"absolute top-2 right-2 p-3 bg-white bg-opacity-10 rounded-full cursor-pointer transition-all duration-300 hover:scale-110 hover:bg-opacity-20 animate-pulse shadow-lg hover:shadow-xl group"},YCt)):V("",!0),Te(Vi,{name:"slide-right"},{default:We(()=>[e.showLeftPanel?(w(),A("div",$Ct,[c("div",{id:"leftPanel",class:"flex flex-col flex-grow overflow-y-scroll no-scrollbar",onDragover:t[29]||(t[29]=ge(i=>e.setDropZoneDiscussion(),["stop","prevent"]))},[c("div",WCt,[c("div",KCt,[c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Create new discussion",type:"button",onClick:t[2]||(t[2]=i=>e.createNewDiscussion())},QCt),c("button",{class:ze(["text-2xl hover:text-secondary duration-75 active:scale-90",e.isCheckbox?"text-secondary":""]),title:"Edit discussion list",type:"button",onClick:t[3]||(t[3]=i=>e.isCheckbox=!e.isCheckbox)},ZCt,2),c("button",JCt,[c("i",{"data-feather":"trash-2",onClick:t[4]||(t[4]=ge(()=>{},["stop"]))})]),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Export database",type:"button",onClick:t[5]||(t[5]=ge(i=>e.database_selectorDialogVisible=!0,["stop"]))},t1t),c("input",{type:"file",ref:"fileDialog",style:{display:"none"},onChange:t[6]||(t[6]=(...i)=>e.importDiscussions&&e.importDiscussions(...i))},null,544),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 rotate-90",title:"Import discussions",type:"button",onClick:t[7]||(t[7]=ge(i=>e.$refs.fileDialog.click(),["stop"]))},i1t),c("input",{type:"file",ref:"bundleLoadingDialog",style:{display:"none"},onChange:t[8]||(t[8]=(...i)=>e.importDiscussionsBundle&&e.importDiscussionsBundle(...i))},null,544),e.showSaveConfirmation?V("",!0):(w(),A("button",{key:0,title:"Import discussion bundle",onClick:t[9]||(t[9]=ge(i=>e.$refs.bundleLoadingDialog.click(),["stop"])),class:"text-2xl hover:text-secondary duration-75 active:scale-90"},r1t)),e.isOpen?(w(),A("div",o1t,[c("button",{onClick:t[10]||(t[10]=(...i)=>e.importDiscussions&&e.importDiscussions(...i))},"LOLLMS"),c("button",{onClick:t[11]||(t[11]=(...i)=>e.importChatGPT&&e.importChatGPT(...i))},"ChatGPT")])):V("",!0),c("button",{class:ze(["text-2xl hover:text-secondary duration-75 active:scale-90",e.isSearch?"text-secondary":""]),title:"Filter discussions",type:"button",onClick:t[12]||(t[12]=i=>e.isSearch=!e.isSearch)},l1t,2),e.showSaveConfirmation?(w(),A("div",c1t,[c("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel",type:"button",onClick:t[13]||(t[13]=ge(i=>e.showSaveConfirmation=!1,["stop"]))},u1t),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm save changes",type:"button",onClick:t[14]||(t[14]=ge(i=>e.save_configuration(),["stop"]))},_1t)])):V("",!0),e.loading?V("",!0):(w(),A("button",{key:3,type:"button",onClick:t[15]||(t[15]=ge((...i)=>e.addDiscussion2SkillsLibrary&&e.addDiscussion2SkillsLibrary(...i),["stop"])),title:"Add this discussion content to skills database",class:"w-6 hover:text-secondary duration-75 active:scale-90"},f1t)),!e.loading&&e.$store.state.config.activate_skills_lib?(w(),A("button",{key:4,type:"button",onClick:t[16]||(t[16]=ge((...i)=>e.toggleSkillsLib&&e.toggleSkillsLib(...i),["stop"])),title:"Skills database is activated",class:"w-6 hover:text-secondary duration-75 active:scale-90"},g1t)):V("",!0),!e.loading&&!e.$store.state.config.activate_skills_lib?(w(),A("button",{key:5,type:"button",onClick:t[17]||(t[17]=ge((...i)=>e.toggleSkillsLib&&e.toggleSkillsLib(...i),["stop"])),title:"Skills database is deactivated",class:"w-6 hover:text-secondary duration-75 active:scale-90"},E1t)):V("",!0),e.loading?V("",!0):(w(),A("button",{key:6,type:"button",onClick:t[18]||(t[18]=ge((...i)=>e.showSkillsLib&&e.showSkillsLib(...i),["stop"])),title:"Show Skills database",class:"w-6 hover:text-secondary duration-75 active:scale-90"},v1t)),e.loading?(w(),A("div",S1t,x1t)):V("",!0)]),e.isSearch?(w(),A("div",C1t,[c("div",w1t,[c("div",R1t,[A1t,c("div",N1t,[c("div",{class:ze(["hover:text-secondary duration-75 active:scale-90",e.filterTitle?"visible":"invisible"]),title:"Clear",onClick:t[19]||(t[19]=i=>e.filterTitle="")},I1t,2)]),G(c("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[20]||(t[20]=i=>e.filterTitle=i),onInput:t[21]||(t[21]=i=>e.filterDiscussions())},null,544),[[we,e.filterTitle]])])])])):V("",!0),e.isCheckbox?(w(),A("hr",M1t)):V("",!0),e.isCheckbox?(w(),A("div",D1t,[c("div",k1t,[e.selectedDiscussions.length>0?(w(),A("p",L1t,"Selected: "+he(e.selectedDiscussions.length),1)):V("",!0)]),c("div",P1t,[e.selectedDiscussions.length>0?(w(),A("div",U1t,[e.showConfirmation?V("",!0):(w(),A("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[22]||(t[22]=ge(i=>e.showConfirmation=!0,["stop"]))},B1t)),e.showConfirmation?(w(),A("div",G1t,[c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm removal",type:"button",onClick:t[23]||(t[23]=ge((...i)=>e.deleteDiscussionMulti&&e.deleteDiscussionMulti(...i),["stop"]))},z1t),c("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel removal",type:"button",onClick:t[24]||(t[24]=ge(i=>e.showConfirmation=!1,["stop"]))},q1t)])):V("",!0)])):V("",!0),c("div",Y1t,[c("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[25]||(t[25]=ge((...i)=>e.exportDiscussionsAsJson&&e.exportDiscussionsAsJson(...i),["stop"]))},W1t),c("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[26]||(t[26]=ge((...i)=>e.exportDiscussions&&e.exportDiscussions(...i),["stop"]))},j1t),c("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[27]||(t[27]=ge((...i)=>e.exportDiscussionsAsMarkdown&&e.exportDiscussionsAsMarkdown(...i),["stop"]))},X1t),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Select All",type:"button",onClick:t[28]||(t[28]=ge((...i)=>e.selectAllDiscussions&&e.selectAllDiscussions(...i),["stop"]))},J1t)])])])):V("",!0)]),c("div",ewt,[c("div",{class:ze(["mx-4 flex flex-col flex-grow w-full",e.isDragOverDiscussion?"pointer-events-none":""])},[c("div",{id:"dis-list",class:ze([e.filterInProgress?"opacity-20 pointer-events-none":"","flex flex-col flex-grow w-full"])},[e.list.length>0?(w(),xt(as,{key:0,name:"list"},{default:We(()=>[(w(!0),A($e,null,lt(e.list,(i,s)=>(w(),xt(RE,{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),onOpenFolder:e.openFolder,onEditTitle:e.editTitle,onMakeTitle:e.makeTitle,onChecked:e.checkUncheckDiscussion},null,8,["id","title","selected","loading","isCheckbox","checkBoxValue","onSelect","onDelete","onOpenFolder","onEditTitle","onMakeTitle","onChecked"]))),128))]),_:1})):V("",!0),e.list.length<1?(w(),A("div",twt,iwt)):V("",!0),swt],2)],2)])],32),c("div",{class:"absolute h-15 bottom-0 left-0 w-full bg-bg-light-panel dark:bg-bg-dark-tone light-text-panel py-4 cursor-pointer text-light-text-panel dark:text-dark-text-panel hover:text-secondary",onClick:t[30]||(t[30]=(...i)=>e.showDatabaseSelector&&e.showDatabaseSelector(...i))},[c("p",rwt,he(e.formatted_database_name.replace("_"," ")),1)])])):V("",!0)]),_:1}),e.isReady?(w(),A("div",owt,[c("div",{id:"messages-list",class:ze(["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":""])},[c("div",awt,[e.discussionArr.length>0?(w(),xt(as,{key:0,name:"list"},{default:We(()=>[(w(!0),A($e,null,lt(e.discussionArr,(i,s)=>(w(),xt(EO,{key:i.id,message:i,id:"msg-"+i.id,ref_for:!0,ref:"msg-"+i.id,host:e.host,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})):V("",!0),e.currentDiscussion.id?V("",!0):(w(),xt(vO,{key:1})),lwt]),cwt],2),e.currentDiscussion.id?(w(),A("div",dwt,[Te(yO,{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"])])):V("",!0)])):V("",!0),Te(Vi,{name:"slide-left"},{default:We(()=>[e.showRightPanel?(w(),A("div",uwt,[c("div",pwt,null,512)])):V("",!0)]),_:1}),Te(wE,{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"]),G(c("div",_wt,[Te(nc,{ref:"progress",progress:e.progress_value,class:"w-full h-4"},null,8,["progress"]),c("p",hwt,he(e.loading_infos)+" ...",1)],512),[[Mt,e.progress_visibility]]),Te(mO,{"prompt-text":"Enter the url to the page to use as discussion support",onOk:e.addWebpage,ref:"web_url_input_box"},null,8,["onOk"]),Te(gO,{ref:"skills_lib"},null,512)],64))}}),gwt=bt(mwt,[["__scopeId","data-v-54bb4ed3"]]);/** +`+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(){console.log("Created discussions view");const e=(await Se.get("/get_versionID")).data.versionId;Ye.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.versionId!==e&&(this.$store.commit("updateVersionId",e),window.location.reload(!0)),this.$nextTick(()=>{He.replace()}),console.log("Connected to socket io");try{this.$store.state.loading_infos="Getting version",this.$store.state.loading_progress=30,await this.$store.dispatch("getVersion")}catch(t){console.log("Error cought:",t)}try{for(this.$store.state.loading_infos="Loading Configuration";Ye.id===void 0;)await new Promise(t=>setTimeout(t,100));this.$store.state.client_id=Ye.id,console.log(this.$store.state.client_id),await this.$store.dispatch("refreshConfig"),console.log("Config ready")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Loading Database",this.$store.state.loading_progress=20,await this.$store.dispatch("refreshDatabase")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting Bindings list",this.$store.state.loading_progress=40,await this.$store.dispatch("refreshBindings")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting personalities zoo",this.$store.state.loading_progress=70,await this.$store.dispatch("refreshPersonalitiesZoo")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting mounted personalities",this.$store.state.loading_progress=80,await this.$store.dispatch("refreshMountedPersonalities")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting models zoo",this.$store.state.loading_progress=90,await this.$store.dispatch("refreshModelsZoo")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting active models",this.$store.state.loading_progress=100,await this.$store.dispatch("refreshModels"),await this.$store.dispatch("refreshModelStatus")}catch(t){console.log("Error cought:",t)}try{await this.$store.dispatch("fetchLanguages"),await this.$store.dispatch("fetchLanguage")}catch(t){console.log("Error cought:",t)}try{await this.$store.dispatch("fetchisRTOn")}catch(t){console.log("Error cought:",t)}this.$store.state.isConnected=!0,this.$store.state.client_id=Ye.id,console.log("Ready"),this.setPageTitle(),await this.list_discussions(),this.loadLastUsedDiscussion(),this.isCreated=!0,this.$store.state.ready=!0,Ye.on("connected",this.socketIOConnected),Ye.on("disconnected",this.socketIODisconnected),console.log("Added events"),Ye.on("show_progress",this.show_progress),Ye.on("hide_progress",this.hide_progress),Ye.on("update_progress",this.update_progress),Ye.on("notification",this.notify),Ye.on("new_message",this.new_message),Ye.on("update_message",this.streamMessageContent),Ye.on("close_message",this.finalMsgEvent),Ye.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}),Ye.onclose=t=>{console.log("WebSocket connection closed:",t.code,t.reason),this.socketIODisconnected()},Ye.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}),Ye.onerror=t=>{console.log("WebSocket connection error:",t.code,t.reason),this.socketIODisconnected(),Ye.disconnect()}},async mounted(){Ye.on("refresh_files",()=>{this.recoverFiles()}),this.$nextTick(()=>{He.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&&Ge(()=>{const n=document.getElementById("messages-list");this.scrollBottom(n)}),this.$store.state.config.show_news_panel&&this.$store.state.news.show()},components:{Discussion:RE,Message:EO,ChatBox:yO,WelcomeComponent:vO,ChoiceDialog:wE,ProgressBar:nc,InputBox:mO,SkillsLibraryViewer:gO},watch:{messages:{handler:"extractHtml",deep:!0},progress_visibility_val(n){console.log("progress_visibility changed to "+n)},filterTitle(n){n==""&&(this.filterInProgress=!0,this.list=this.tempList,this.filterInProgress=!1)},isCheckbox(n){Ge(()=>{He.replace()}),n||(this.isSelectAll=!1)},socketConnected(n){console.log("Websocket connected (watch)",n)},showConfirmation(){Ge(()=>{He.replace()})},isSearch(){Ge(()=>{He.replace()})}},computed:{...Sk({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(){return this.$store.state.ready},databases(){return this.$store.state.databases},client_id(){return Ye.id},showLeftPanel(){return this.$store.state.ready&&!this.leftPanelCollapsed},showRightPanel(){return this.$store.state.ready&&!this.rightPanelCollapsed},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 Ge(()=>{He.replace()}),this.list.filter(n=>n.checkBoxValue==!0)}}},fwt=Object.assign(hwt,{__name:"DiscussionsView",setup(n){return Ws(()=>{VO()}),Se.defaults.baseURL="/",(e,t)=>(w(),A($e,null,[Te(Vi,{name:"fade-and-fly"},{default:We(()=>[e.isReady?V("",!0):(w(),A("div",wCt,[c("div",RCt,[c("div",ACt,[c("div",NCt,[OCt,c("div",ICt,[c("p",MCt,"LoLLMS "+he(e.version_info),1),DCt,kCt])]),LCt,PCt,c("div",UCt,[Te(nc,{ref:"loading_progress",progress:e.loading_progress},null,8,["progress"]),c("p",FCt,he(e.loading_infos)+" ...",1)])])])]))]),_:1}),e.isReady?(w(),A("button",{key:0,onClick:t[0]||(t[0]=(...i)=>e.togglePanel&&e.togglePanel(...i)),class:"absolute top-2 left-2 p-3 bg-white bg-opacity-0 cursor-pointer transition-all duration-300 hover:scale-110 hover:bg-opacity-20 hover:shadow-xl group"},[G(c("div",null,GCt,512),[[Mt,e.leftPanelCollapsed]]),G(c("div",null,zCt,512),[[Mt,!e.leftPanelCollapsed]])])):V("",!0),e.isReady?(w(),A("button",{key:1,onClick:t[1]||(t[1]=ge(i=>e.triggerRobotAction(),["stop"])),class:"absolute top-2 right-2 p-3 bg-white bg-opacity-10 rounded-full cursor-pointer transition-all duration-300 hover:scale-110 hover:bg-opacity-20 animate-pulse shadow-lg hover:shadow-xl group"},qCt)):V("",!0),Te(Vi,{name:"slide-right"},{default:We(()=>[e.showLeftPanel?(w(),A("div",YCt,[c("div",{id:"leftPanel",class:"flex flex-col flex-grow overflow-y-scroll no-scrollbar",onDragover:t[29]||(t[29]=ge(i=>e.setDropZoneDiscussion(),["stop","prevent"]))},[c("div",$Ct,[c("div",WCt,[c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Create new discussion",type:"button",onClick:t[2]||(t[2]=i=>e.createNewDiscussion())},jCt),c("button",{class:ze(["text-2xl hover:text-secondary duration-75 active:scale-90",e.isCheckbox?"text-secondary":""]),title:"Edit discussion list",type:"button",onClick:t[3]||(t[3]=i=>e.isCheckbox=!e.isCheckbox)},XCt,2),c("button",ZCt,[c("i",{"data-feather":"trash-2",onClick:t[4]||(t[4]=ge(()=>{},["stop"]))})]),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Export database",type:"button",onClick:t[5]||(t[5]=ge(i=>e.database_selectorDialogVisible=!0,["stop"]))},e1t),c("input",{type:"file",ref:"fileDialog",style:{display:"none"},onChange:t[6]||(t[6]=(...i)=>e.importDiscussions&&e.importDiscussions(...i))},null,544),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 rotate-90",title:"Import discussions",type:"button",onClick:t[7]||(t[7]=ge(i=>e.$refs.fileDialog.click(),["stop"]))},n1t),c("input",{type:"file",ref:"bundleLoadingDialog",style:{display:"none"},onChange:t[8]||(t[8]=(...i)=>e.importDiscussionsBundle&&e.importDiscussionsBundle(...i))},null,544),e.showSaveConfirmation?V("",!0):(w(),A("button",{key:0,title:"Import discussion bundle",onClick:t[9]||(t[9]=ge(i=>e.$refs.bundleLoadingDialog.click(),["stop"])),class:"text-2xl hover:text-secondary duration-75 active:scale-90"},s1t)),e.isOpen?(w(),A("div",r1t,[c("button",{onClick:t[10]||(t[10]=(...i)=>e.importDiscussions&&e.importDiscussions(...i))},"LOLLMS"),c("button",{onClick:t[11]||(t[11]=(...i)=>e.importChatGPT&&e.importChatGPT(...i))},"ChatGPT")])):V("",!0),c("button",{class:ze(["text-2xl hover:text-secondary duration-75 active:scale-90",e.isSearch?"text-secondary":""]),title:"Filter discussions",type:"button",onClick:t[12]||(t[12]=i=>e.isSearch=!e.isSearch)},a1t,2),e.showSaveConfirmation?(w(),A("div",l1t,[c("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel",type:"button",onClick:t[13]||(t[13]=ge(i=>e.showSaveConfirmation=!1,["stop"]))},d1t),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm save changes",type:"button",onClick:t[14]||(t[14]=ge(i=>e.save_configuration(),["stop"]))},p1t)])):V("",!0),e.loading?V("",!0):(w(),A("button",{key:3,type:"button",onClick:t[15]||(t[15]=ge((...i)=>e.addDiscussion2SkillsLibrary&&e.addDiscussion2SkillsLibrary(...i),["stop"])),title:"Add this discussion content to skills database",class:"w-6 hover:text-secondary duration-75 active:scale-90"},h1t)),!e.loading&&e.$store.state.config.activate_skills_lib?(w(),A("button",{key:4,type:"button",onClick:t[16]||(t[16]=ge((...i)=>e.toggleSkillsLib&&e.toggleSkillsLib(...i),["stop"])),title:"Skills database is activated",class:"w-6 hover:text-secondary duration-75 active:scale-90"},m1t)):V("",!0),!e.loading&&!e.$store.state.config.activate_skills_lib?(w(),A("button",{key:5,type:"button",onClick:t[17]||(t[17]=ge((...i)=>e.toggleSkillsLib&&e.toggleSkillsLib(...i),["stop"])),title:"Skills database is deactivated",class:"w-6 hover:text-secondary duration-75 active:scale-90"},b1t)):V("",!0),e.loading?V("",!0):(w(),A("button",{key:6,type:"button",onClick:t[18]||(t[18]=ge((...i)=>e.showSkillsLib&&e.showSkillsLib(...i),["stop"])),title:"Show Skills database",class:"w-6 hover:text-secondary duration-75 active:scale-90"},y1t)),e.loading?(w(),A("div",v1t,T1t)):V("",!0)]),e.isSearch?(w(),A("div",x1t,[c("div",C1t,[c("div",w1t,[R1t,c("div",A1t,[c("div",{class:ze(["hover:text-secondary duration-75 active:scale-90",e.filterTitle?"visible":"invisible"]),title:"Clear",onClick:t[19]||(t[19]=i=>e.filterTitle="")},O1t,2)]),G(c("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[20]||(t[20]=i=>e.filterTitle=i),onInput:t[21]||(t[21]=i=>e.filterDiscussions())},null,544),[[we,e.filterTitle]])])])])):V("",!0),e.isCheckbox?(w(),A("hr",I1t)):V("",!0),e.isCheckbox?(w(),A("div",M1t,[c("div",D1t,[e.selectedDiscussions.length>0?(w(),A("p",k1t,"Selected: "+he(e.selectedDiscussions.length),1)):V("",!0)]),c("div",L1t,[e.selectedDiscussions.length>0?(w(),A("div",P1t,[e.showConfirmation?V("",!0):(w(),A("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[22]||(t[22]=ge(i=>e.showConfirmation=!0,["stop"]))},F1t)),e.showConfirmation?(w(),A("div",B1t,[c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm removal",type:"button",onClick:t[23]||(t[23]=ge((...i)=>e.deleteDiscussionMulti&&e.deleteDiscussionMulti(...i),["stop"]))},V1t),c("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel removal",type:"button",onClick:t[24]||(t[24]=ge(i=>e.showConfirmation=!1,["stop"]))},H1t)])):V("",!0)])):V("",!0),c("div",q1t,[c("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[25]||(t[25]=ge((...i)=>e.exportDiscussionsAsJson&&e.exportDiscussionsAsJson(...i),["stop"]))},$1t),c("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[26]||(t[26]=ge((...i)=>e.exportDiscussions&&e.exportDiscussions(...i),["stop"]))},K1t),c("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[27]||(t[27]=ge((...i)=>e.exportDiscussionsAsMarkdown&&e.exportDiscussionsAsMarkdown(...i),["stop"]))},Q1t),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Select All",type:"button",onClick:t[28]||(t[28]=ge((...i)=>e.selectAllDiscussions&&e.selectAllDiscussions(...i),["stop"]))},Z1t)])])])):V("",!0)]),c("div",J1t,[c("div",{class:ze(["mx-4 flex flex-col flex-grow w-full",e.isDragOverDiscussion?"pointer-events-none":""])},[c("div",{id:"dis-list",class:ze([e.filterInProgress?"opacity-20 pointer-events-none":"","flex flex-col flex-grow w-full"])},[e.list.length>0?(w(),xt(as,{key:0,name:"list"},{default:We(()=>[(w(!0),A($e,null,lt(e.list,(i,s)=>(w(),xt(RE,{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),onOpenFolder:e.openFolder,onEditTitle:e.editTitle,onMakeTitle:e.makeTitle,onChecked:e.checkUncheckDiscussion},null,8,["id","title","selected","loading","isCheckbox","checkBoxValue","onSelect","onDelete","onOpenFolder","onEditTitle","onMakeTitle","onChecked"]))),128))]),_:1})):V("",!0),e.list.length<1?(w(),A("div",ewt,nwt)):V("",!0),iwt],2)],2)])],32),c("div",{class:"absolute h-15 bottom-0 left-0 w-full bg-bg-light-panel dark:bg-bg-dark-tone light-text-panel py-4 cursor-pointer text-light-text-panel dark:text-dark-text-panel hover:text-secondary",onClick:t[30]||(t[30]=(...i)=>e.showDatabaseSelector&&e.showDatabaseSelector(...i))},[c("p",swt,he(e.formatted_database_name.replace("_"," ")),1)])])):V("",!0)]),_:1}),e.isReady?(w(),A("div",rwt,[c("div",{id:"messages-list",class:ze(["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":""])},[c("div",owt,[e.discussionArr.length>0?(w(),xt(as,{key:0,name:"list"},{default:We(()=>[(w(!0),A($e,null,lt(e.discussionArr,(i,s)=>(w(),xt(EO,{key:i.id,message:i,id:"msg-"+i.id,ref_for:!0,ref:"msg-"+i.id,host:e.host,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})):V("",!0),e.currentDiscussion.id?V("",!0):(w(),xt(vO,{key:1})),awt]),lwt],2),e.currentDiscussion.id?(w(),A("div",cwt,[Te(yO,{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"])])):V("",!0)])):V("",!0),Te(Vi,{name:"slide-left"},{default:We(()=>[e.showRightPanel?(w(),A("div",dwt,[c("div",uwt,null,512)])):V("",!0)]),_:1}),Te(wE,{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"]),G(c("div",pwt,[Te(nc,{ref:"progress",progress:e.progress_value,class:"w-full h-4"},null,8,["progress"]),c("p",_wt,he(e.loading_infos)+" ...",1)],512),[[Mt,e.progress_visibility]]),Te(mO,{"prompt-text":"Enter the url to the page to use as discussion support",onOk:e.addWebpage,ref:"web_url_input_box"},null,8,["onOk"]),Te(gO,{ref:"skills_lib"},null,512)],64))}}),mwt=bt(fwt,[["__scopeId","data-v-54bb4ed3"]]);/** * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT - */const KE="159",bwt=0,zC=1,Ewt=2,zO=1,ywt=2,Ms=3,Ys=0,Zn=1,ts=2,Sr=0,aa=1,HC=2,qC=3,YC=4,vwt=5,Xr=100,Swt=101,Twt=102,$C=103,WC=104,xwt=200,Cwt=201,wwt=202,Rwt=203,rb=204,ob=205,Awt=206,Nwt=207,Owt=208,Iwt=209,Mwt=210,Dwt=211,kwt=212,Lwt=213,Pwt=214,Uwt=0,Fwt=1,Bwt=2,_u=3,Gwt=4,Vwt=5,zwt=6,Hwt=7,jE=0,qwt=1,Ywt=2,Tr=0,$wt=1,Wwt=2,Kwt=3,jwt=4,Qwt=5,KC="attached",Xwt="detached",HO=300,Ta=301,xa=302,ab=303,lb=304,cp=306,Ca=1e3,mi=1001,hu=1002,yn=1003,cb=1004,Bd=1005,jn=1006,qO=1007,fo=1008,xr=1009,Zwt=1010,Jwt=1011,QE=1012,YO=1013,br=1014,Ps=1015,rc=1016,$O=1017,WO=1018,oo=1020,eRt=1021,gi=1023,tRt=1024,nRt=1025,ao=1026,wa=1027,iRt=1028,KO=1029,sRt=1030,jO=1031,QO=1033,Um=33776,Fm=33777,Bm=33778,Gm=33779,jC=35840,QC=35841,XC=35842,ZC=35843,XO=36196,JC=37492,e1=37496,t1=37808,n1=37809,i1=37810,s1=37811,r1=37812,o1=37813,a1=37814,l1=37815,c1=37816,d1=37817,u1=37818,p1=37819,_1=37820,h1=37821,Vm=36492,f1=36494,m1=36495,rRt=36283,g1=36284,b1=36285,E1=36286,oc=2300,Ra=2301,zm=2302,y1=2400,v1=2401,S1=2402,oRt=2500,aRt=0,ZO=1,db=2,JO=3e3,lo=3001,lRt=3200,cRt=3201,XE=0,dRt=1,bi="",on="srgb",On="srgb-linear",ZE="display-p3",dp="display-p3-linear",fu="linear",Zt="srgb",mu="rec709",gu="p3",Oo=7680,T1=519,uRt=512,pRt=513,_Rt=514,eI=515,hRt=516,fRt=517,mRt=518,gRt=519,ub=35044,x1="300 es",pb=1035,Us=2e3,bu=2001;class Ka{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]+Mn[n>>16&255]+Mn[n>>24&255]+"-"+Mn[e&255]+Mn[e>>8&255]+"-"+Mn[e>>16&15|64]+Mn[e>>24&255]+"-"+Mn[t&63|128]+Mn[t>>8&255]+"-"+Mn[t>>16&255]+Mn[t>>24&255]+Mn[i&255]+Mn[i>>8&255]+Mn[i>>16&255]+Mn[i>>24&255]).toLowerCase()}function Ln(n,e,t){return Math.max(e,Math.min(t,n))}function JE(n,e){return(n%e+e)%e}function bRt(n,e,t,i,s){return i+(n-e)*(s-i)/(t-e)}function ERt(n,e,t){return n!==e?(t-n)/(e-n):0}function Fl(n,e,t){return(1-t)*n+t*e}function yRt(n,e,t,i){return Fl(n,e,1-Math.exp(-t*i))}function vRt(n,e=1){return e-Math.abs(JE(n,e*2)-e)}function SRt(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function TRt(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function xRt(n,e){return n+Math.floor(Math.random()*(e-n+1))}function CRt(n,e){return n+Math.random()*(e-n)}function wRt(n){return n*(.5-Math.random())}function RRt(n){n!==void 0&&(C1=n);let e=C1+=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 ARt(n){return n*Ul}function NRt(n){return n*Aa}function _b(n){return(n&n-1)===0&&n!==0}function ORt(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Eu(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function IRt(n,e,t,i,s){const r=Math.cos,o=Math.sin,a=r(t/2),l=o(t/2),u=r((e+i)/2),d=o((e+i)/2),h=r((e-i)/2),f=o((e-i)/2),_=r((i-e)/2),m=o((i-e)/2);switch(s){case"XYX":n.set(a*d,l*h,l*f,a*u);break;case"YZY":n.set(l*f,a*d,l*h,a*u);break;case"ZXZ":n.set(l*h,l*f,a*d,a*u);break;case"XZX":n.set(a*d,l*m,l*_,a*u);break;case"YXY":n.set(l*_,a*d,l*m,a*u);break;case"ZYZ":n.set(l*m,l*_,a*d,a*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function ns(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 MRt={DEG2RAD:Ul,RAD2DEG:Aa,generateUUID:zi,clamp:Ln,euclideanModulo:JE,mapLinear:bRt,inverseLerp:ERt,lerp:Fl,damp:yRt,pingpong:vRt,smoothstep:SRt,smootherstep:TRt,randInt:xRt,randFloat:CRt,randFloatSpread:wRt,seededRandom:RRt,degToRad:ARt,radToDeg:NRt,isPowerOfTwo:_b,ceilPowerOfTwo:ORt,floorPowerOfTwo:Eu,setQuaternionFromProperEuler:IRt,normalize:Ht,denormalize:ns};class It{constructor(e=0,t=0){It.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(Ln(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 wt{constructor(e,t,i,s,r,o,a,l,u){wt.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,u)}set(e,t,i,s,r,o,a,l,u){const d=this.elements;return d[0]=e,d[1]=s,d[2]=a,d[3]=t,d[4]=r,d[5]=l,d[6]=i,d[7]=o,d[8]=u,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],u=i[1],d=i[4],h=i[7],f=i[2],_=i[5],m=i[8],E=s[0],b=s[3],g=s[6],y=s[1],v=s[4],S=s[7],C=s[2],T=s[5],O=s[8];return r[0]=o*E+a*y+l*C,r[3]=o*b+a*v+l*T,r[6]=o*g+a*S+l*O,r[1]=u*E+d*y+h*C,r[4]=u*b+d*v+h*T,r[7]=u*g+d*S+h*O,r[2]=f*E+_*y+m*C,r[5]=f*b+_*v+m*T,r[8]=f*g+_*S+m*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],u=e[7],d=e[8];return t*o*d-t*a*u-i*r*d+i*a*l+s*r*u-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],u=e[7],d=e[8],h=d*o-a*u,f=a*l-d*r,_=u*r-o*l,m=t*h+i*f+s*_;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/m;return e[0]=h*E,e[1]=(s*u-d*i)*E,e[2]=(a*i-s*o)*E,e[3]=f*E,e[4]=(d*t-s*l)*E,e[5]=(s*r-a*t)*E,e[6]=_*E,e[7]=(i*l-u*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),u=Math.sin(r);return this.set(i*l,i*u,-i*(l*o+u*a)+o+e,-s*u,s*l,-s*(-u*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Hm.makeScale(e,t)),this}rotate(e){return this.premultiply(Hm.makeRotation(-e)),this}translate(e,t){return this.premultiply(Hm.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 Hm=new wt;function tI(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function ac(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function DRt(){const n=ac("canvas");return n.style.display="block",n}const w1={};function Bl(n){n in w1||(w1[n]=!0,console.warn(n))}const R1=new wt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),A1=new wt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Qc={[On]:{transfer:fu,primaries:mu,toReference:n=>n,fromReference:n=>n},[on]:{transfer:Zt,primaries:mu,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[dp]:{transfer:fu,primaries:gu,toReference:n=>n.applyMatrix3(A1),fromReference:n=>n.applyMatrix3(R1)},[ZE]:{transfer:Zt,primaries:gu,toReference:n=>n.convertSRGBToLinear().applyMatrix3(A1),fromReference:n=>n.applyMatrix3(R1).convertLinearToSRGB()}},kRt=new Set([On,dp]),Gt={enabled:!0,_workingColorSpace:On,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(!kRt.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=Qc[e].toReference,s=Qc[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 Qc[n].primaries},getTransfer:function(n){return n===bi?fu:Qc[n].transfer}};function la(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function qm(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Io;class nI{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=ac("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=ac("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!==HO)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ca:e.x=e.x-Math.floor(e.x);break;case mi:e.x=e.x<0?0:1;break;case hu: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 Ca:e.y=e.y-Math.floor(e.y);break;case mi:e.y=e.y<0?0:1;break;case hu: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 Bl("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===on?lo:JO}set encoding(e){Bl("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===lo?on:bi}}Nn.DEFAULT_IMAGE=null;Nn.DEFAULT_MAPPING=HO;Nn.DEFAULT_ANISOTROPY=1;class Kt{constructor(e=0,t=0,i=0,s=1){Kt.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,u=l[0],d=l[4],h=l[8],f=l[1],_=l[5],m=l[9],E=l[2],b=l[6],g=l[10];if(Math.abs(d-f)<.01&&Math.abs(h-E)<.01&&Math.abs(m-b)<.01){if(Math.abs(d+f)<.1&&Math.abs(h+E)<.1&&Math.abs(m+b)<.1&&Math.abs(u+_+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const v=(u+1)/2,S=(_+1)/2,C=(g+1)/2,T=(d+f)/4,O=(h+E)/4,k=(m+b)/4;return v>S&&v>C?v<.01?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(v),s=T/i,r=O/i):S>C?S<.01?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(S),i=T/s,r=k/s):C<.01?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(C),i=O/r,s=k/r),this.set(i,s,r,t),this}let y=Math.sqrt((b-m)*(b-m)+(h-E)*(h-E)+(f-d)*(f-d));return Math.abs(y)<.001&&(y=1),this.x=(b-m)/y,this.y=(h-E)/y,this.z=(f-d)/y,this.w=Math.acos((u+_+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 URt extends Ka{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Kt(0,0,e,t),this.scissorTest=!1,this.viewport=new Kt(0,0,e,t);const s={width:e,height:t,depth:1};i.encoding!==void 0&&(Bl("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===lo?on:bi),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:jn,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},i),this.texture=new Nn(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 iI(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 mo extends URt{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class sI extends Nn{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=yn,this.minFilter=yn,this.wrapR=mi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class FRt extends Nn{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=yn,this.minFilter=yn,this.wrapR=mi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Ir{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],u=i[s+1],d=i[s+2],h=i[s+3];const f=r[o+0],_=r[o+1],m=r[o+2],E=r[o+3];if(a===0){e[t+0]=l,e[t+1]=u,e[t+2]=d,e[t+3]=h;return}if(a===1){e[t+0]=f,e[t+1]=_,e[t+2]=m,e[t+3]=E;return}if(h!==E||l!==f||u!==_||d!==m){let b=1-a;const g=l*f+u*_+d*m+h*E,y=g>=0?1:-1,v=1-g*g;if(v>Number.EPSILON){const C=Math.sqrt(v),T=Math.atan2(C,g*y);b=Math.sin(b*T)/C,a=Math.sin(a*T)/C}const S=a*y;if(l=l*b+f*S,u=u*b+_*S,d=d*b+m*S,h=h*b+E*S,b===1-a){const C=1/Math.sqrt(l*l+u*u+d*d+h*h);l*=C,u*=C,d*=C,h*=C}}e[t]=l,e[t+1]=u,e[t+2]=d,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,s,r,o){const a=i[s],l=i[s+1],u=i[s+2],d=i[s+3],h=r[o],f=r[o+1],_=r[o+2],m=r[o+3];return e[t]=a*m+d*h+l*_-u*f,e[t+1]=l*m+d*f+u*h-a*_,e[t+2]=u*m+d*_+a*f-l*h,e[t+3]=d*m-a*h-l*f-u*_,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,u=a(i/2),d=a(s/2),h=a(r/2),f=l(i/2),_=l(s/2),m=l(r/2);switch(o){case"XYZ":this._x=f*d*h+u*_*m,this._y=u*_*h-f*d*m,this._z=u*d*m+f*_*h,this._w=u*d*h-f*_*m;break;case"YXZ":this._x=f*d*h+u*_*m,this._y=u*_*h-f*d*m,this._z=u*d*m-f*_*h,this._w=u*d*h+f*_*m;break;case"ZXY":this._x=f*d*h-u*_*m,this._y=u*_*h+f*d*m,this._z=u*d*m+f*_*h,this._w=u*d*h-f*_*m;break;case"ZYX":this._x=f*d*h-u*_*m,this._y=u*_*h+f*d*m,this._z=u*d*m-f*_*h,this._w=u*d*h+f*_*m;break;case"YZX":this._x=f*d*h+u*_*m,this._y=u*_*h+f*d*m,this._z=u*d*m-f*_*h,this._w=u*d*h-f*_*m;break;case"XZY":this._x=f*d*h-u*_*m,this._y=u*_*h-f*d*m,this._z=u*d*m+f*_*h,this._w=u*d*h+f*_*m;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],u=t[2],d=t[6],h=t[10],f=i+a+h;if(f>0){const _=.5/Math.sqrt(f+1);this._w=.25/_,this._x=(d-l)*_,this._y=(r-u)*_,this._z=(o-s)*_}else if(i>a&&i>h){const _=2*Math.sqrt(1+i-a-h);this._w=(d-l)/_,this._x=.25*_,this._y=(s+o)/_,this._z=(r+u)/_}else if(a>h){const _=2*Math.sqrt(1+a-i-h);this._w=(r-u)/_,this._x=(s+o)/_,this._y=.25*_,this._z=(l+d)/_}else{const _=2*Math.sqrt(1+h-i-a);this._w=(o-s)/_,this._x=(r+u)/_,this._y=(l+d)/_,this._z=.25*_}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(Ln(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,u=t._z,d=t._w;return this._x=i*d+o*a+s*u-r*l,this._y=s*d+o*l+r*a-i*u,this._z=r*d+o*u+i*l-s*a,this._w=o*d-i*a-s*l-r*u,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 _=1-t;return this._w=_*o+t*this._w,this._x=_*i+t*this._x,this._y=_*s+t*this._y,this._z=_*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const u=Math.sqrt(l),d=Math.atan2(u,a),h=Math.sin((1-t)*d)/u,f=Math.sin(t*d)/u;return this._w=o*h+this._w*f,this._x=i*h+this._x*f,this._y=s*h+this._y*f,this._z=r*h+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 _e{constructor(e=0,t=0,i=0){_e.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(N1.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(N1.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,u=2*(o*s-a*i),d=2*(a*t-r*s),h=2*(r*i-o*t);return this.x=t+l*u+o*h-a*d,this.y=i+l*d+a*u-r*h,this.z=s+l*h+r*d-o*u,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 $m.copy(this).projectOnVector(e),this.sub($m)}reflect(e){return this.sub($m.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(Ln(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 $m=new _e,N1=new Ir;class js{constructor(e=new _e(1/0,1/0,1/0),t=new _e(-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(fl),Zc.subVectors(this.max,fl),Mo.subVectors(e.a,fl),Do.subVectors(e.b,fl),ko.subVectors(e.c,fl),tr.subVectors(Do,Mo),nr.subVectors(ko,Do),Fr.subVectors(Mo,ko);let t=[0,-tr.z,tr.y,0,-nr.z,nr.y,0,-Fr.z,Fr.y,tr.z,0,-tr.x,nr.z,0,-nr.x,Fr.z,0,-Fr.x,-tr.y,tr.x,0,-nr.y,nr.x,0,-Fr.y,Fr.x,0];return!Wm(t,Mo,Do,ko,Zc)||(t=[1,0,0,0,1,0,0,0,1],!Wm(t,Mo,Do,ko,Zc))?!1:(Jc.crossVectors(tr,nr),t=[Jc.x,Jc.y,Jc.z],Wm(t,Mo,Do,ko,Zc))}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:(Cs[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Cs[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Cs[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Cs[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Cs[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Cs[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Cs[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Cs[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Cs),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 Cs=[new _e,new _e,new _e,new _e,new _e,new _e,new _e,new _e],Ii=new _e,Xc=new js,Mo=new _e,Do=new _e,ko=new _e,tr=new _e,nr=new _e,Fr=new _e,fl=new _e,Zc=new _e,Jc=new _e,Br=new _e;function Wm(n,e,t,i,s){for(let r=0,o=n.length-3;r<=o;r+=3){Br.fromArray(n,r);const a=s.x*Math.abs(Br.x)+s.y*Math.abs(Br.y)+s.z*Math.abs(Br.z),l=e.dot(Br),u=t.dot(Br),d=i.dot(Br);if(Math.max(-Math.max(l,u,d),Math.min(l,u,d))>a)return!1}return!0}const BRt=new js,ml=new _e,Km=new _e;class fs{constructor(e=new _e,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):BRt.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;ml.subVectors(e,this.center);const t=ml.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),s=(i-this.radius)*.5;this.center.addScaledVector(ml,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):(Km.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ml.copy(e.center).add(Km)),this.expandByPoint(ml.copy(e.center).sub(Km))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const ws=new _e,jm=new _e,ed=new _e,ir=new _e,Qm=new _e,td=new _e,Xm=new _e;class up{constructor(e=new _e,t=new _e(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,ws)),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=ws.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ws.copy(this.origin).addScaledVector(this.direction,t),ws.distanceToSquared(e))}distanceSqToSegment(e,t,i,s){jm.copy(e).add(t).multiplyScalar(.5),ed.copy(t).sub(e).normalize(),ir.copy(this.origin).sub(jm);const r=e.distanceTo(t)*.5,o=-this.direction.dot(ed),a=ir.dot(this.direction),l=-ir.dot(ed),u=ir.lengthSq(),d=Math.abs(1-o*o);let h,f,_,m;if(d>0)if(h=o*l-a,f=o*a-l,m=r*d,h>=0)if(f>=-m)if(f<=m){const E=1/d;h*=E,f*=E,_=h*(h+o*f+2*a)+f*(o*h+f+2*l)+u}else f=r,h=Math.max(0,-(o*f+a)),_=-h*h+f*(f+2*l)+u;else f=-r,h=Math.max(0,-(o*f+a)),_=-h*h+f*(f+2*l)+u;else f<=-m?(h=Math.max(0,-(-o*r+a)),f=h>0?-r:Math.min(Math.max(-r,-l),r),_=-h*h+f*(f+2*l)+u):f<=m?(h=0,f=Math.min(Math.max(-r,-l),r),_=f*(f+2*l)+u):(h=Math.max(0,-(o*r+a)),f=h>0?r:Math.min(Math.max(-r,-l),r),_=-h*h+f*(f+2*l)+u);else f=o>0?-r:r,h=Math.max(0,-(o*f+a)),_=-h*h+f*(f+2*l)+u;return i&&i.copy(this.origin).addScaledVector(this.direction,h),s&&s.copy(jm).addScaledVector(ed,f),_}intersectSphere(e,t){ws.subVectors(e.center,this.origin);const i=ws.dot(this.direction),s=ws.dot(ws)-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 u=1/this.direction.x,d=1/this.direction.y,h=1/this.direction.z,f=this.origin;return u>=0?(i=(e.min.x-f.x)*u,s=(e.max.x-f.x)*u):(i=(e.max.x-f.x)*u,s=(e.min.x-f.x)*u),d>=0?(r=(e.min.y-f.y)*d,o=(e.max.y-f.y)*d):(r=(e.max.y-f.y)*d,o=(e.min.y-f.y)*d),i>o||r>s||((r>i||isNaN(i))&&(i=r),(o=0?(a=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(a=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),i>l||a>s)||((a>i||i!==i)&&(i=a),(l=0?i:s,t)}intersectsBox(e){return this.intersectBox(e,ws)!==null}intersectTriangle(e,t,i,s,r){Qm.subVectors(t,e),td.subVectors(i,e),Xm.crossVectors(Qm,td);let o=this.direction.dot(Xm),a;if(o>0){if(s)return null;a=1}else if(o<0)a=-1,o=-o;else return null;ir.subVectors(this.origin,e);const l=a*this.direction.dot(td.crossVectors(ir,td));if(l<0)return null;const u=a*this.direction.dot(Qm.cross(ir));if(u<0||l+u>o)return null;const d=-a*ir.dot(Xm);return d<0?null:this.at(d/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 Rt{constructor(e,t,i,s,r,o,a,l,u,d,h,f,_,m,E,b){Rt.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,u,d,h,f,_,m,E,b)}set(e,t,i,s,r,o,a,l,u,d,h,f,_,m,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]=u,g[6]=d,g[10]=h,g[14]=f,g[3]=_,g[7]=m,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 Rt().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),u=Math.sin(s),d=Math.cos(r),h=Math.sin(r);if(e.order==="XYZ"){const f=o*d,_=o*h,m=a*d,E=a*h;t[0]=l*d,t[4]=-l*h,t[8]=u,t[1]=_+m*u,t[5]=f-E*u,t[9]=-a*l,t[2]=E-f*u,t[6]=m+_*u,t[10]=o*l}else if(e.order==="YXZ"){const f=l*d,_=l*h,m=u*d,E=u*h;t[0]=f+E*a,t[4]=m*a-_,t[8]=o*u,t[1]=o*h,t[5]=o*d,t[9]=-a,t[2]=_*a-m,t[6]=E+f*a,t[10]=o*l}else if(e.order==="ZXY"){const f=l*d,_=l*h,m=u*d,E=u*h;t[0]=f-E*a,t[4]=-o*h,t[8]=m+_*a,t[1]=_+m*a,t[5]=o*d,t[9]=E-f*a,t[2]=-o*u,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const f=o*d,_=o*h,m=a*d,E=a*h;t[0]=l*d,t[4]=m*u-_,t[8]=f*u+E,t[1]=l*h,t[5]=E*u+f,t[9]=_*u-m,t[2]=-u,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const f=o*l,_=o*u,m=a*l,E=a*u;t[0]=l*d,t[4]=E-f*h,t[8]=m*h+_,t[1]=h,t[5]=o*d,t[9]=-a*d,t[2]=-u*d,t[6]=_*h+m,t[10]=f-E*h}else if(e.order==="XZY"){const f=o*l,_=o*u,m=a*l,E=a*u;t[0]=l*d,t[4]=-h,t[8]=u*d,t[1]=f*h+E,t[5]=o*d,t[9]=_*h-m,t[2]=m*h-_,t[6]=a*d,t[10]=E*h+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(GRt,e,VRt)}lookAt(e,t,i){const s=this.elements;return ii.subVectors(e,t),ii.lengthSq()===0&&(ii.z=1),ii.normalize(),sr.crossVectors(i,ii),sr.lengthSq()===0&&(Math.abs(i.z)===1?ii.x+=1e-4:ii.z+=1e-4,ii.normalize(),sr.crossVectors(i,ii)),sr.normalize(),nd.crossVectors(ii,sr),s[0]=sr.x,s[4]=nd.x,s[8]=ii.x,s[1]=sr.y,s[5]=nd.y,s[9]=ii.y,s[2]=sr.z,s[6]=nd.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],u=i[12],d=i[1],h=i[5],f=i[9],_=i[13],m=i[2],E=i[6],b=i[10],g=i[14],y=i[3],v=i[7],S=i[11],C=i[15],T=s[0],O=s[4],k=s[8],x=s[12],I=s[1],F=s[5],B=s[9],ne=s[13],L=s[2],$=s[6],H=s[10],U=s[14],Q=s[3],J=s[7],j=s[11],ae=s[15];return r[0]=o*T+a*I+l*L+u*Q,r[4]=o*O+a*F+l*$+u*J,r[8]=o*k+a*B+l*H+u*j,r[12]=o*x+a*ne+l*U+u*ae,r[1]=d*T+h*I+f*L+_*Q,r[5]=d*O+h*F+f*$+_*J,r[9]=d*k+h*B+f*H+_*j,r[13]=d*x+h*ne+f*U+_*ae,r[2]=m*T+E*I+b*L+g*Q,r[6]=m*O+E*F+b*$+g*J,r[10]=m*k+E*B+b*H+g*j,r[14]=m*x+E*ne+b*U+g*ae,r[3]=y*T+v*I+S*L+C*Q,r[7]=y*O+v*F+S*$+C*J,r[11]=y*k+v*B+S*H+C*j,r[15]=y*x+v*ne+S*U+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],u=e[13],d=e[2],h=e[6],f=e[10],_=e[14],m=e[3],E=e[7],b=e[11],g=e[15];return m*(+r*l*h-s*u*h-r*a*f+i*u*f+s*a*_-i*l*_)+E*(+t*l*_-t*u*f+r*o*f-s*o*_+s*u*d-r*l*d)+b*(+t*u*h-t*a*_-r*o*h+i*o*_+r*a*d-i*u*d)+g*(-s*a*d-t*l*h+t*a*f+s*o*h-i*o*f+i*l*d)}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],u=e[7],d=e[8],h=e[9],f=e[10],_=e[11],m=e[12],E=e[13],b=e[14],g=e[15],y=h*b*u-E*f*u+E*l*_-a*b*_-h*l*g+a*f*g,v=m*f*u-d*b*u-m*l*_+o*b*_+d*l*g-o*f*g,S=d*E*u-m*h*u+m*a*_-o*E*_-d*a*g+o*h*g,C=m*h*l-d*E*l-m*a*f+o*E*f+d*a*b-o*h*b,T=t*y+i*v+s*S+r*C;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const O=1/T;return e[0]=y*O,e[1]=(E*f*r-h*b*r-E*s*_+i*b*_+h*s*g-i*f*g)*O,e[2]=(a*b*r-E*l*r+E*s*u-i*b*u-a*s*g+i*l*g)*O,e[3]=(h*l*r-a*f*r-h*s*u+i*f*u+a*s*_-i*l*_)*O,e[4]=v*O,e[5]=(d*b*r-m*f*r+m*s*_-t*b*_-d*s*g+t*f*g)*O,e[6]=(m*l*r-o*b*r-m*s*u+t*b*u+o*s*g-t*l*g)*O,e[7]=(o*f*r-d*l*r+d*s*u-t*f*u-o*s*_+t*l*_)*O,e[8]=S*O,e[9]=(m*h*r-d*E*r-m*i*_+t*E*_+d*i*g-t*h*g)*O,e[10]=(o*E*r-m*a*r+m*i*u-t*E*u-o*i*g+t*a*g)*O,e[11]=(d*a*r-o*h*r-d*i*u+t*h*u+o*i*_-t*a*_)*O,e[12]=C*O,e[13]=(d*E*s-m*h*s+m*i*f-t*E*f-d*i*b+t*h*b)*O,e[14]=(m*a*s-o*E*s-m*i*l+t*E*l+o*i*b-t*a*b)*O,e[15]=(o*h*s-d*a*s+d*i*l-t*h*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,u=r*o,d=r*a;return this.set(u*o+i,u*a-s*l,u*l+s*a,0,u*a+s*l,d*a+i,d*l-s*o,0,u*l-s*a,d*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,u=r+r,d=o+o,h=a+a,f=r*u,_=r*d,m=r*h,E=o*d,b=o*h,g=a*h,y=l*u,v=l*d,S=l*h,C=i.x,T=i.y,O=i.z;return s[0]=(1-(E+g))*C,s[1]=(_+S)*C,s[2]=(m-v)*C,s[3]=0,s[4]=(_-S)*T,s[5]=(1-(f+g))*T,s[6]=(b+y)*T,s[7]=0,s[8]=(m+v)*O,s[9]=(b-y)*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 u=1/r,d=1/o,h=1/a;return Mi.elements[0]*=u,Mi.elements[1]*=u,Mi.elements[2]*=u,Mi.elements[4]*=d,Mi.elements[5]*=d,Mi.elements[6]*=d,Mi.elements[8]*=h,Mi.elements[9]*=h,Mi.elements[10]*=h,t.setFromRotationMatrix(Mi),i.x=r,i.y=o,i.z=a,this}makePerspective(e,t,i,s,r,o,a=Us){const l=this.elements,u=2*r/(t-e),d=2*r/(i-s),h=(t+e)/(t-e),f=(i+s)/(i-s);let _,m;if(a===Us)_=-(o+r)/(o-r),m=-2*o*r/(o-r);else if(a===bu)_=-o/(o-r),m=-o*r/(o-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=u,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=d,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=_,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,s,r,o,a=Us){const l=this.elements,u=1/(t-e),d=1/(i-s),h=1/(o-r),f=(t+e)*u,_=(i+s)*d;let m,E;if(a===Us)m=(o+r)*h,E=-2*h;else if(a===bu)m=r*h,E=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*u,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-_,l[2]=0,l[6]=0,l[10]=E,l[14]=-m,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 _e,Mi=new Rt,GRt=new _e(0,0,0),VRt=new _e(1,1,1),sr=new _e,nd=new _e,ii=new _e,O1=new Rt,I1=new Ir;class pp{constructor(e=0,t=0,i=0,s=pp.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],u=s[5],d=s[9],h=s[2],f=s[6],_=s[10];switch(t){case"XYZ":this._y=Math.asin(Ln(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-d,_),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(f,u),this._z=0);break;case"YXZ":this._x=Math.asin(-Ln(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(a,_),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Ln(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,_),this._z=Math.atan2(-o,u)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-Ln(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,_),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-o,u));break;case"YZX":this._z=Math.asin(Ln(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,u),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,_));break;case"XZY":this._z=Math.asin(-Ln(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,u),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-d,_),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 O1.makeRotationFromQuaternion(e),this.setFromRotationMatrix(O1,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return I1.setFromEuler(this),this.setFromQuaternion(I1,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}}pp.DEFAULT_ORDER="XYZ";class rI{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 u=0,d=l.length;u0){s.children=[];for(let a=0;a0){s.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),u.length>0&&(i.textures=u),d.length>0&&(i.images=d),h.length>0&&(i.shapes=h),f.length>0&&(i.skeletons=f),_.length>0&&(i.animations=_),m.length>0&&(i.nodes=m)}return i.object=s,i;function o(a){const l=[];for(const u in a){const d=a[u];delete d.metadata,l.push(d)}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),Zm.subVectors(e,t);const o=Di.dot(Di),a=Di.dot(As),l=Di.dot(Zm),u=As.dot(As),d=As.dot(Zm),h=o*u-a*a;if(h===0)return r.set(-2,-1,-1);const f=1/h,_=(u*l-a*d)*f,m=(o*d-a*l)*f;return r.set(1-_-m,m,_)}static containsPoint(e,t,i,s){return this.getBarycoord(e,t,i,s,Ns),Ns.x>=0&&Ns.y>=0&&Ns.x+Ns.y<=1}static getUV(e,t,i,s,r,o,a,l){return sd===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),sd=!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,Ns),l.setScalar(0),l.addScaledVector(r,Ns.x),l.addScaledVector(o,Ns.y),l.addScaledVector(a,Ns.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 sd===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),sd=!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),Jm.subVectors(e,i);const l=Uo.dot(Jm),u=Fo.dot(Jm);if(l<=0&&u<=0)return t.copy(i);eg.subVectors(e,s);const d=Uo.dot(eg),h=Fo.dot(eg);if(d>=0&&h<=d)return t.copy(s);const f=l*h-d*u;if(f<=0&&l>=0&&d<=0)return o=l/(l-d),t.copy(i).addScaledVector(Uo,o);tg.subVectors(e,r);const _=Uo.dot(tg),m=Fo.dot(tg);if(m>=0&&_<=m)return t.copy(r);const E=_*u-l*m;if(E<=0&&u>=0&&m<=0)return a=u/(u-m),t.copy(i).addScaledVector(Fo,a);const b=d*m-_*h;if(b<=0&&h-d>=0&&_-m>=0)return P1.subVectors(r,s),a=(h-d)/(h-d+(_-m)),t.copy(s).addScaledVector(P1,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 oI={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},rr={h:0,s:0,l:0},rd={h:0,s:0,l:0};function ng(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=on){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Gt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,s=Gt.workingColorSpace){return this.r=e,this.g=t,this.b=i,Gt.toWorkingColorSpace(this,s),this}setHSL(e,t,i,s=Gt.workingColorSpace){if(e=JE(e,1),t=Ln(t,0,1),i=Ln(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=ng(o,r,e+1/3),this.g=ng(o,r,e),this.b=ng(o,r,e-1/3)}return Gt.toWorkingColorSpace(this,s),this}setStyle(e,t=on){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=on){const i=oI[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=qm(e.r),this.g=qm(e.g),this.b=qm(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=on){return Gt.fromWorkingColorSpace(Dn.copy(this),e),Math.round(Ln(Dn.r*255,0,255))*65536+Math.round(Ln(Dn.g*255,0,255))*256+Math.round(Ln(Dn.b*255,0,255))}getHexString(e=on){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Gt.workingColorSpace){Gt.fromWorkingColorSpace(Dn.copy(this),t);const i=Dn.r,s=Dn.g,r=Dn.b,o=Math.max(i,s,r),a=Math.min(i,s,r);let l,u;const d=(a+o)/2;if(a===o)l=0,u=0;else{const h=o-a;switch(u=d<=.5?h/(o+a):h/(2-o-a),o){case i:l=(s-r)/h+(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!==Ys&&(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!==rb&&(i.blendSrc=this.blendSrc),this.blendDst!==ob&&(i.blendDst=this.blendDst),this.blendEquation!==Xr&&(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!==_u&&(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!==T1&&(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 Hi{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=jE,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 dn=new _e,od=new It;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=ub,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Ps,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 u in l)l[u]!==void 0&&(e[u]=l[u]);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 u=i[l];e.data.attributes[l]=u.toJSON(e.data)}const s={};let r=!1;for(const l in this.morphAttributes){const u=this.morphAttributes[l],d=[];for(let h=0,f=u.length;h0&&(s[l]=d,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 u in s){const d=s[u];this.setAttribute(u,d.clone(t))}const r=e.morphAttributes;for(const u in r){const d=[],h=r[u];for(let f=0,_=h.length;f<_;f++)d.push(h[f].clone(t));this.morphAttributes[u]=d}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let u=0,d=o.length;u0){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))&&(U1.copy(r).invert(),Gr.copy(e.ray).applyMatrix4(U1),!(i.boundingBox!==null&&Gr.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Gr)))}_computeIntersections(e,t,i){let s;const r=this.geometry,o=this.material,a=r.index,l=r.attributes.position,u=r.attributes.uv,d=r.attributes.uv1,h=r.attributes.normal,f=r.groups,_=r.drawRange;if(a!==null)if(Array.isArray(o))for(let m=0,E=f.length;mt.far?null:{distance:u,point:_d.clone(),object:n}}function hd(n,e,t,i,s,r,o,a,l,u){n.getVertexPosition(a,Go),n.getVertexPosition(l,Vo),n.getVertexPosition(u,zo);const d=jRt(n,e,t,i,Go,Vo,zo,pd);if(d){s&&(cd.fromBufferAttribute(s,a),dd.fromBufferAttribute(s,l),ud.fromBufferAttribute(s,u),d.uv=Pi.getInterpolation(pd,Go,Vo,zo,cd,dd,ud,new It)),r&&(cd.fromBufferAttribute(r,a),dd.fromBufferAttribute(r,l),ud.fromBufferAttribute(r,u),d.uv1=Pi.getInterpolation(pd,Go,Vo,zo,cd,dd,ud,new It),d.uv2=d.uv1),o&&(B1.fromBufferAttribute(o,a),G1.fromBufferAttribute(o,l),V1.fromBufferAttribute(o,u),d.normal=Pi.getInterpolation(pd,Go,Vo,zo,B1,G1,V1,new _e),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));const h={a,b:l,c:u,normal:new _e,materialIndex:0};Pi.getNormal(Go,Vo,zo,h.normal),d.face=h}return d}class Cr extends ms{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=[],u=[],d=[],h=[];let f=0,_=0;m("z","y","x",-1,-1,i,t,e,o,r,0),m("z","y","x",1,-1,i,t,-e,o,r,1),m("x","z","y",1,1,e,i,t,s,o,2),m("x","z","y",1,-1,e,i,-t,s,o,3),m("x","y","z",1,-1,e,t,i,s,r,4),m("x","y","z",-1,-1,e,t,-i,s,r,5),this.setIndex(l),this.setAttribute("position",new Bs(u,3)),this.setAttribute("normal",new Bs(d,3)),this.setAttribute("uv",new Bs(h,2));function m(E,b,g,y,v,S,C,T,O,k,x){const I=S/O,F=C/k,B=S/2,ne=C/2,L=T/2,$=O+1,H=k+1;let U=0,Q=0;const J=new _e;for(let j=0;j0?1:-1,d.push(J.x,J.y,J.z),h.push(ve/O),h.push(1-j/k),U+=1}}for(let j=0;j>8&255]+Mn[n>>16&255]+Mn[n>>24&255]+"-"+Mn[e&255]+Mn[e>>8&255]+"-"+Mn[e>>16&15|64]+Mn[e>>24&255]+"-"+Mn[t&63|128]+Mn[t>>8&255]+"-"+Mn[t>>16&255]+Mn[t>>24&255]+Mn[i&255]+Mn[i>>8&255]+Mn[i>>16&255]+Mn[i>>24&255]).toLowerCase()}function Ln(n,e,t){return Math.max(e,Math.min(t,n))}function JE(n,e){return(n%e+e)%e}function gRt(n,e,t,i,s){return i+(n-e)*(s-i)/(t-e)}function bRt(n,e,t){return n!==e?(t-n)/(e-n):0}function Fl(n,e,t){return(1-t)*n+t*e}function ERt(n,e,t,i){return Fl(n,e,1-Math.exp(-t*i))}function yRt(n,e=1){return e-Math.abs(JE(n,e*2)-e)}function vRt(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function SRt(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function TRt(n,e){return n+Math.floor(Math.random()*(e-n+1))}function xRt(n,e){return n+Math.random()*(e-n)}function CRt(n){return n*(.5-Math.random())}function wRt(n){n!==void 0&&(C1=n);let e=C1+=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 RRt(n){return n*Ul}function ARt(n){return n*Aa}function _b(n){return(n&n-1)===0&&n!==0}function NRt(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Eu(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function ORt(n,e,t,i,s){const r=Math.cos,o=Math.sin,a=r(t/2),l=o(t/2),u=r((e+i)/2),d=o((e+i)/2),h=r((e-i)/2),f=o((e-i)/2),_=r((i-e)/2),m=o((i-e)/2);switch(s){case"XYX":n.set(a*d,l*h,l*f,a*u);break;case"YZY":n.set(l*f,a*d,l*h,a*u);break;case"ZXZ":n.set(l*h,l*f,a*d,a*u);break;case"XZX":n.set(a*d,l*m,l*_,a*u);break;case"YXY":n.set(l*_,a*d,l*m,a*u);break;case"ZYZ":n.set(l*m,l*_,a*d,a*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function ns(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 IRt={DEG2RAD:Ul,RAD2DEG:Aa,generateUUID:zi,clamp:Ln,euclideanModulo:JE,mapLinear:gRt,inverseLerp:bRt,lerp:Fl,damp:ERt,pingpong:yRt,smoothstep:vRt,smootherstep:SRt,randInt:TRt,randFloat:xRt,randFloatSpread:CRt,seededRandom:wRt,degToRad:RRt,radToDeg:ARt,isPowerOfTwo:_b,ceilPowerOfTwo:NRt,floorPowerOfTwo:Eu,setQuaternionFromProperEuler:ORt,normalize:Ht,denormalize:ns};class It{constructor(e=0,t=0){It.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(Ln(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 wt{constructor(e,t,i,s,r,o,a,l,u){wt.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,u)}set(e,t,i,s,r,o,a,l,u){const d=this.elements;return d[0]=e,d[1]=s,d[2]=a,d[3]=t,d[4]=r,d[5]=l,d[6]=i,d[7]=o,d[8]=u,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],u=i[1],d=i[4],h=i[7],f=i[2],_=i[5],m=i[8],E=s[0],b=s[3],g=s[6],y=s[1],v=s[4],S=s[7],C=s[2],T=s[5],O=s[8];return r[0]=o*E+a*y+l*C,r[3]=o*b+a*v+l*T,r[6]=o*g+a*S+l*O,r[1]=u*E+d*y+h*C,r[4]=u*b+d*v+h*T,r[7]=u*g+d*S+h*O,r[2]=f*E+_*y+m*C,r[5]=f*b+_*v+m*T,r[8]=f*g+_*S+m*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],u=e[7],d=e[8];return t*o*d-t*a*u-i*r*d+i*a*l+s*r*u-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],u=e[7],d=e[8],h=d*o-a*u,f=a*l-d*r,_=u*r-o*l,m=t*h+i*f+s*_;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/m;return e[0]=h*E,e[1]=(s*u-d*i)*E,e[2]=(a*i-s*o)*E,e[3]=f*E,e[4]=(d*t-s*l)*E,e[5]=(s*r-a*t)*E,e[6]=_*E,e[7]=(i*l-u*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),u=Math.sin(r);return this.set(i*l,i*u,-i*(l*o+u*a)+o+e,-s*u,s*l,-s*(-u*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Hm.makeScale(e,t)),this}rotate(e){return this.premultiply(Hm.makeRotation(-e)),this}translate(e,t){return this.premultiply(Hm.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 Hm=new wt;function tI(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function ac(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function MRt(){const n=ac("canvas");return n.style.display="block",n}const w1={};function Bl(n){n in w1||(w1[n]=!0,console.warn(n))}const R1=new wt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),A1=new wt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Qc={[On]:{transfer:fu,primaries:mu,toReference:n=>n,fromReference:n=>n},[on]:{transfer:Zt,primaries:mu,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[dp]:{transfer:fu,primaries:gu,toReference:n=>n.applyMatrix3(A1),fromReference:n=>n.applyMatrix3(R1)},[ZE]:{transfer:Zt,primaries:gu,toReference:n=>n.convertSRGBToLinear().applyMatrix3(A1),fromReference:n=>n.applyMatrix3(R1).convertLinearToSRGB()}},DRt=new Set([On,dp]),Gt={enabled:!0,_workingColorSpace:On,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(!DRt.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=Qc[e].toReference,s=Qc[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 Qc[n].primaries},getTransfer:function(n){return n===bi?fu:Qc[n].transfer}};function la(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function qm(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Io;class nI{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=ac("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=ac("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!==HO)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ca:e.x=e.x-Math.floor(e.x);break;case mi:e.x=e.x<0?0:1;break;case hu: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 Ca:e.y=e.y-Math.floor(e.y);break;case mi:e.y=e.y<0?0:1;break;case hu: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 Bl("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===on?lo:JO}set encoding(e){Bl("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===lo?on:bi}}Nn.DEFAULT_IMAGE=null;Nn.DEFAULT_MAPPING=HO;Nn.DEFAULT_ANISOTROPY=1;class Kt{constructor(e=0,t=0,i=0,s=1){Kt.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,u=l[0],d=l[4],h=l[8],f=l[1],_=l[5],m=l[9],E=l[2],b=l[6],g=l[10];if(Math.abs(d-f)<.01&&Math.abs(h-E)<.01&&Math.abs(m-b)<.01){if(Math.abs(d+f)<.1&&Math.abs(h+E)<.1&&Math.abs(m+b)<.1&&Math.abs(u+_+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const v=(u+1)/2,S=(_+1)/2,C=(g+1)/2,T=(d+f)/4,O=(h+E)/4,k=(m+b)/4;return v>S&&v>C?v<.01?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(v),s=T/i,r=O/i):S>C?S<.01?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(S),i=T/s,r=k/s):C<.01?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(C),i=O/r,s=k/r),this.set(i,s,r,t),this}let y=Math.sqrt((b-m)*(b-m)+(h-E)*(h-E)+(f-d)*(f-d));return Math.abs(y)<.001&&(y=1),this.x=(b-m)/y,this.y=(h-E)/y,this.z=(f-d)/y,this.w=Math.acos((u+_+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 PRt extends Ka{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Kt(0,0,e,t),this.scissorTest=!1,this.viewport=new Kt(0,0,e,t);const s={width:e,height:t,depth:1};i.encoding!==void 0&&(Bl("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===lo?on:bi),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:jn,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},i),this.texture=new Nn(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 iI(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 mo extends PRt{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class sI extends Nn{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=yn,this.minFilter=yn,this.wrapR=mi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class URt extends Nn{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=yn,this.minFilter=yn,this.wrapR=mi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Ir{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],u=i[s+1],d=i[s+2],h=i[s+3];const f=r[o+0],_=r[o+1],m=r[o+2],E=r[o+3];if(a===0){e[t+0]=l,e[t+1]=u,e[t+2]=d,e[t+3]=h;return}if(a===1){e[t+0]=f,e[t+1]=_,e[t+2]=m,e[t+3]=E;return}if(h!==E||l!==f||u!==_||d!==m){let b=1-a;const g=l*f+u*_+d*m+h*E,y=g>=0?1:-1,v=1-g*g;if(v>Number.EPSILON){const C=Math.sqrt(v),T=Math.atan2(C,g*y);b=Math.sin(b*T)/C,a=Math.sin(a*T)/C}const S=a*y;if(l=l*b+f*S,u=u*b+_*S,d=d*b+m*S,h=h*b+E*S,b===1-a){const C=1/Math.sqrt(l*l+u*u+d*d+h*h);l*=C,u*=C,d*=C,h*=C}}e[t]=l,e[t+1]=u,e[t+2]=d,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,s,r,o){const a=i[s],l=i[s+1],u=i[s+2],d=i[s+3],h=r[o],f=r[o+1],_=r[o+2],m=r[o+3];return e[t]=a*m+d*h+l*_-u*f,e[t+1]=l*m+d*f+u*h-a*_,e[t+2]=u*m+d*_+a*f-l*h,e[t+3]=d*m-a*h-l*f-u*_,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,u=a(i/2),d=a(s/2),h=a(r/2),f=l(i/2),_=l(s/2),m=l(r/2);switch(o){case"XYZ":this._x=f*d*h+u*_*m,this._y=u*_*h-f*d*m,this._z=u*d*m+f*_*h,this._w=u*d*h-f*_*m;break;case"YXZ":this._x=f*d*h+u*_*m,this._y=u*_*h-f*d*m,this._z=u*d*m-f*_*h,this._w=u*d*h+f*_*m;break;case"ZXY":this._x=f*d*h-u*_*m,this._y=u*_*h+f*d*m,this._z=u*d*m+f*_*h,this._w=u*d*h-f*_*m;break;case"ZYX":this._x=f*d*h-u*_*m,this._y=u*_*h+f*d*m,this._z=u*d*m-f*_*h,this._w=u*d*h+f*_*m;break;case"YZX":this._x=f*d*h+u*_*m,this._y=u*_*h+f*d*m,this._z=u*d*m-f*_*h,this._w=u*d*h-f*_*m;break;case"XZY":this._x=f*d*h-u*_*m,this._y=u*_*h-f*d*m,this._z=u*d*m+f*_*h,this._w=u*d*h+f*_*m;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],u=t[2],d=t[6],h=t[10],f=i+a+h;if(f>0){const _=.5/Math.sqrt(f+1);this._w=.25/_,this._x=(d-l)*_,this._y=(r-u)*_,this._z=(o-s)*_}else if(i>a&&i>h){const _=2*Math.sqrt(1+i-a-h);this._w=(d-l)/_,this._x=.25*_,this._y=(s+o)/_,this._z=(r+u)/_}else if(a>h){const _=2*Math.sqrt(1+a-i-h);this._w=(r-u)/_,this._x=(s+o)/_,this._y=.25*_,this._z=(l+d)/_}else{const _=2*Math.sqrt(1+h-i-a);this._w=(o-s)/_,this._x=(r+u)/_,this._y=(l+d)/_,this._z=.25*_}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(Ln(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,u=t._z,d=t._w;return this._x=i*d+o*a+s*u-r*l,this._y=s*d+o*l+r*a-i*u,this._z=r*d+o*u+i*l-s*a,this._w=o*d-i*a-s*l-r*u,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 _=1-t;return this._w=_*o+t*this._w,this._x=_*i+t*this._x,this._y=_*s+t*this._y,this._z=_*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const u=Math.sqrt(l),d=Math.atan2(u,a),h=Math.sin((1-t)*d)/u,f=Math.sin(t*d)/u;return this._w=o*h+this._w*f,this._x=i*h+this._x*f,this._y=s*h+this._y*f,this._z=r*h+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 _e{constructor(e=0,t=0,i=0){_e.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(N1.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(N1.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,u=2*(o*s-a*i),d=2*(a*t-r*s),h=2*(r*i-o*t);return this.x=t+l*u+o*h-a*d,this.y=i+l*d+a*u-r*h,this.z=s+l*h+r*d-o*u,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 $m.copy(this).projectOnVector(e),this.sub($m)}reflect(e){return this.sub($m.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(Ln(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 $m=new _e,N1=new Ir;class js{constructor(e=new _e(1/0,1/0,1/0),t=new _e(-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(fl),Zc.subVectors(this.max,fl),Mo.subVectors(e.a,fl),Do.subVectors(e.b,fl),ko.subVectors(e.c,fl),tr.subVectors(Do,Mo),nr.subVectors(ko,Do),Fr.subVectors(Mo,ko);let t=[0,-tr.z,tr.y,0,-nr.z,nr.y,0,-Fr.z,Fr.y,tr.z,0,-tr.x,nr.z,0,-nr.x,Fr.z,0,-Fr.x,-tr.y,tr.x,0,-nr.y,nr.x,0,-Fr.y,Fr.x,0];return!Wm(t,Mo,Do,ko,Zc)||(t=[1,0,0,0,1,0,0,0,1],!Wm(t,Mo,Do,ko,Zc))?!1:(Jc.crossVectors(tr,nr),t=[Jc.x,Jc.y,Jc.z],Wm(t,Mo,Do,ko,Zc))}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:(Cs[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Cs[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Cs[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Cs[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Cs[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Cs[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Cs[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Cs[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Cs),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 Cs=[new _e,new _e,new _e,new _e,new _e,new _e,new _e,new _e],Ii=new _e,Xc=new js,Mo=new _e,Do=new _e,ko=new _e,tr=new _e,nr=new _e,Fr=new _e,fl=new _e,Zc=new _e,Jc=new _e,Br=new _e;function Wm(n,e,t,i,s){for(let r=0,o=n.length-3;r<=o;r+=3){Br.fromArray(n,r);const a=s.x*Math.abs(Br.x)+s.y*Math.abs(Br.y)+s.z*Math.abs(Br.z),l=e.dot(Br),u=t.dot(Br),d=i.dot(Br);if(Math.max(-Math.max(l,u,d),Math.min(l,u,d))>a)return!1}return!0}const FRt=new js,ml=new _e,Km=new _e;class fs{constructor(e=new _e,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):FRt.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;ml.subVectors(e,this.center);const t=ml.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),s=(i-this.radius)*.5;this.center.addScaledVector(ml,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):(Km.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ml.copy(e.center).add(Km)),this.expandByPoint(ml.copy(e.center).sub(Km))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const ws=new _e,jm=new _e,ed=new _e,ir=new _e,Qm=new _e,td=new _e,Xm=new _e;class up{constructor(e=new _e,t=new _e(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,ws)),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=ws.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ws.copy(this.origin).addScaledVector(this.direction,t),ws.distanceToSquared(e))}distanceSqToSegment(e,t,i,s){jm.copy(e).add(t).multiplyScalar(.5),ed.copy(t).sub(e).normalize(),ir.copy(this.origin).sub(jm);const r=e.distanceTo(t)*.5,o=-this.direction.dot(ed),a=ir.dot(this.direction),l=-ir.dot(ed),u=ir.lengthSq(),d=Math.abs(1-o*o);let h,f,_,m;if(d>0)if(h=o*l-a,f=o*a-l,m=r*d,h>=0)if(f>=-m)if(f<=m){const E=1/d;h*=E,f*=E,_=h*(h+o*f+2*a)+f*(o*h+f+2*l)+u}else f=r,h=Math.max(0,-(o*f+a)),_=-h*h+f*(f+2*l)+u;else f=-r,h=Math.max(0,-(o*f+a)),_=-h*h+f*(f+2*l)+u;else f<=-m?(h=Math.max(0,-(-o*r+a)),f=h>0?-r:Math.min(Math.max(-r,-l),r),_=-h*h+f*(f+2*l)+u):f<=m?(h=0,f=Math.min(Math.max(-r,-l),r),_=f*(f+2*l)+u):(h=Math.max(0,-(o*r+a)),f=h>0?r:Math.min(Math.max(-r,-l),r),_=-h*h+f*(f+2*l)+u);else f=o>0?-r:r,h=Math.max(0,-(o*f+a)),_=-h*h+f*(f+2*l)+u;return i&&i.copy(this.origin).addScaledVector(this.direction,h),s&&s.copy(jm).addScaledVector(ed,f),_}intersectSphere(e,t){ws.subVectors(e.center,this.origin);const i=ws.dot(this.direction),s=ws.dot(ws)-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 u=1/this.direction.x,d=1/this.direction.y,h=1/this.direction.z,f=this.origin;return u>=0?(i=(e.min.x-f.x)*u,s=(e.max.x-f.x)*u):(i=(e.max.x-f.x)*u,s=(e.min.x-f.x)*u),d>=0?(r=(e.min.y-f.y)*d,o=(e.max.y-f.y)*d):(r=(e.max.y-f.y)*d,o=(e.min.y-f.y)*d),i>o||r>s||((r>i||isNaN(i))&&(i=r),(o=0?(a=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(a=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),i>l||a>s)||((a>i||i!==i)&&(i=a),(l=0?i:s,t)}intersectsBox(e){return this.intersectBox(e,ws)!==null}intersectTriangle(e,t,i,s,r){Qm.subVectors(t,e),td.subVectors(i,e),Xm.crossVectors(Qm,td);let o=this.direction.dot(Xm),a;if(o>0){if(s)return null;a=1}else if(o<0)a=-1,o=-o;else return null;ir.subVectors(this.origin,e);const l=a*this.direction.dot(td.crossVectors(ir,td));if(l<0)return null;const u=a*this.direction.dot(Qm.cross(ir));if(u<0||l+u>o)return null;const d=-a*ir.dot(Xm);return d<0?null:this.at(d/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 Rt{constructor(e,t,i,s,r,o,a,l,u,d,h,f,_,m,E,b){Rt.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,u,d,h,f,_,m,E,b)}set(e,t,i,s,r,o,a,l,u,d,h,f,_,m,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]=u,g[6]=d,g[10]=h,g[14]=f,g[3]=_,g[7]=m,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 Rt().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),u=Math.sin(s),d=Math.cos(r),h=Math.sin(r);if(e.order==="XYZ"){const f=o*d,_=o*h,m=a*d,E=a*h;t[0]=l*d,t[4]=-l*h,t[8]=u,t[1]=_+m*u,t[5]=f-E*u,t[9]=-a*l,t[2]=E-f*u,t[6]=m+_*u,t[10]=o*l}else if(e.order==="YXZ"){const f=l*d,_=l*h,m=u*d,E=u*h;t[0]=f+E*a,t[4]=m*a-_,t[8]=o*u,t[1]=o*h,t[5]=o*d,t[9]=-a,t[2]=_*a-m,t[6]=E+f*a,t[10]=o*l}else if(e.order==="ZXY"){const f=l*d,_=l*h,m=u*d,E=u*h;t[0]=f-E*a,t[4]=-o*h,t[8]=m+_*a,t[1]=_+m*a,t[5]=o*d,t[9]=E-f*a,t[2]=-o*u,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const f=o*d,_=o*h,m=a*d,E=a*h;t[0]=l*d,t[4]=m*u-_,t[8]=f*u+E,t[1]=l*h,t[5]=E*u+f,t[9]=_*u-m,t[2]=-u,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const f=o*l,_=o*u,m=a*l,E=a*u;t[0]=l*d,t[4]=E-f*h,t[8]=m*h+_,t[1]=h,t[5]=o*d,t[9]=-a*d,t[2]=-u*d,t[6]=_*h+m,t[10]=f-E*h}else if(e.order==="XZY"){const f=o*l,_=o*u,m=a*l,E=a*u;t[0]=l*d,t[4]=-h,t[8]=u*d,t[1]=f*h+E,t[5]=o*d,t[9]=_*h-m,t[2]=m*h-_,t[6]=a*d,t[10]=E*h+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(BRt,e,GRt)}lookAt(e,t,i){const s=this.elements;return ii.subVectors(e,t),ii.lengthSq()===0&&(ii.z=1),ii.normalize(),sr.crossVectors(i,ii),sr.lengthSq()===0&&(Math.abs(i.z)===1?ii.x+=1e-4:ii.z+=1e-4,ii.normalize(),sr.crossVectors(i,ii)),sr.normalize(),nd.crossVectors(ii,sr),s[0]=sr.x,s[4]=nd.x,s[8]=ii.x,s[1]=sr.y,s[5]=nd.y,s[9]=ii.y,s[2]=sr.z,s[6]=nd.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],u=i[12],d=i[1],h=i[5],f=i[9],_=i[13],m=i[2],E=i[6],b=i[10],g=i[14],y=i[3],v=i[7],S=i[11],C=i[15],T=s[0],O=s[4],k=s[8],x=s[12],I=s[1],F=s[5],B=s[9],ne=s[13],L=s[2],$=s[6],H=s[10],U=s[14],Q=s[3],J=s[7],j=s[11],ae=s[15];return r[0]=o*T+a*I+l*L+u*Q,r[4]=o*O+a*F+l*$+u*J,r[8]=o*k+a*B+l*H+u*j,r[12]=o*x+a*ne+l*U+u*ae,r[1]=d*T+h*I+f*L+_*Q,r[5]=d*O+h*F+f*$+_*J,r[9]=d*k+h*B+f*H+_*j,r[13]=d*x+h*ne+f*U+_*ae,r[2]=m*T+E*I+b*L+g*Q,r[6]=m*O+E*F+b*$+g*J,r[10]=m*k+E*B+b*H+g*j,r[14]=m*x+E*ne+b*U+g*ae,r[3]=y*T+v*I+S*L+C*Q,r[7]=y*O+v*F+S*$+C*J,r[11]=y*k+v*B+S*H+C*j,r[15]=y*x+v*ne+S*U+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],u=e[13],d=e[2],h=e[6],f=e[10],_=e[14],m=e[3],E=e[7],b=e[11],g=e[15];return m*(+r*l*h-s*u*h-r*a*f+i*u*f+s*a*_-i*l*_)+E*(+t*l*_-t*u*f+r*o*f-s*o*_+s*u*d-r*l*d)+b*(+t*u*h-t*a*_-r*o*h+i*o*_+r*a*d-i*u*d)+g*(-s*a*d-t*l*h+t*a*f+s*o*h-i*o*f+i*l*d)}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],u=e[7],d=e[8],h=e[9],f=e[10],_=e[11],m=e[12],E=e[13],b=e[14],g=e[15],y=h*b*u-E*f*u+E*l*_-a*b*_-h*l*g+a*f*g,v=m*f*u-d*b*u-m*l*_+o*b*_+d*l*g-o*f*g,S=d*E*u-m*h*u+m*a*_-o*E*_-d*a*g+o*h*g,C=m*h*l-d*E*l-m*a*f+o*E*f+d*a*b-o*h*b,T=t*y+i*v+s*S+r*C;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const O=1/T;return e[0]=y*O,e[1]=(E*f*r-h*b*r-E*s*_+i*b*_+h*s*g-i*f*g)*O,e[2]=(a*b*r-E*l*r+E*s*u-i*b*u-a*s*g+i*l*g)*O,e[3]=(h*l*r-a*f*r-h*s*u+i*f*u+a*s*_-i*l*_)*O,e[4]=v*O,e[5]=(d*b*r-m*f*r+m*s*_-t*b*_-d*s*g+t*f*g)*O,e[6]=(m*l*r-o*b*r-m*s*u+t*b*u+o*s*g-t*l*g)*O,e[7]=(o*f*r-d*l*r+d*s*u-t*f*u-o*s*_+t*l*_)*O,e[8]=S*O,e[9]=(m*h*r-d*E*r-m*i*_+t*E*_+d*i*g-t*h*g)*O,e[10]=(o*E*r-m*a*r+m*i*u-t*E*u-o*i*g+t*a*g)*O,e[11]=(d*a*r-o*h*r-d*i*u+t*h*u+o*i*_-t*a*_)*O,e[12]=C*O,e[13]=(d*E*s-m*h*s+m*i*f-t*E*f-d*i*b+t*h*b)*O,e[14]=(m*a*s-o*E*s-m*i*l+t*E*l+o*i*b-t*a*b)*O,e[15]=(o*h*s-d*a*s+d*i*l-t*h*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,u=r*o,d=r*a;return this.set(u*o+i,u*a-s*l,u*l+s*a,0,u*a+s*l,d*a+i,d*l-s*o,0,u*l-s*a,d*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,u=r+r,d=o+o,h=a+a,f=r*u,_=r*d,m=r*h,E=o*d,b=o*h,g=a*h,y=l*u,v=l*d,S=l*h,C=i.x,T=i.y,O=i.z;return s[0]=(1-(E+g))*C,s[1]=(_+S)*C,s[2]=(m-v)*C,s[3]=0,s[4]=(_-S)*T,s[5]=(1-(f+g))*T,s[6]=(b+y)*T,s[7]=0,s[8]=(m+v)*O,s[9]=(b-y)*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 u=1/r,d=1/o,h=1/a;return Mi.elements[0]*=u,Mi.elements[1]*=u,Mi.elements[2]*=u,Mi.elements[4]*=d,Mi.elements[5]*=d,Mi.elements[6]*=d,Mi.elements[8]*=h,Mi.elements[9]*=h,Mi.elements[10]*=h,t.setFromRotationMatrix(Mi),i.x=r,i.y=o,i.z=a,this}makePerspective(e,t,i,s,r,o,a=Us){const l=this.elements,u=2*r/(t-e),d=2*r/(i-s),h=(t+e)/(t-e),f=(i+s)/(i-s);let _,m;if(a===Us)_=-(o+r)/(o-r),m=-2*o*r/(o-r);else if(a===bu)_=-o/(o-r),m=-o*r/(o-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=u,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=d,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=_,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,s,r,o,a=Us){const l=this.elements,u=1/(t-e),d=1/(i-s),h=1/(o-r),f=(t+e)*u,_=(i+s)*d;let m,E;if(a===Us)m=(o+r)*h,E=-2*h;else if(a===bu)m=r*h,E=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*u,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-_,l[2]=0,l[6]=0,l[10]=E,l[14]=-m,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 _e,Mi=new Rt,BRt=new _e(0,0,0),GRt=new _e(1,1,1),sr=new _e,nd=new _e,ii=new _e,O1=new Rt,I1=new Ir;class pp{constructor(e=0,t=0,i=0,s=pp.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],u=s[5],d=s[9],h=s[2],f=s[6],_=s[10];switch(t){case"XYZ":this._y=Math.asin(Ln(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-d,_),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(f,u),this._z=0);break;case"YXZ":this._x=Math.asin(-Ln(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(a,_),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Ln(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,_),this._z=Math.atan2(-o,u)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-Ln(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,_),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-o,u));break;case"YZX":this._z=Math.asin(Ln(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,u),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,_));break;case"XZY":this._z=Math.asin(-Ln(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,u),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-d,_),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 O1.makeRotationFromQuaternion(e),this.setFromRotationMatrix(O1,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return I1.setFromEuler(this),this.setFromQuaternion(I1,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}}pp.DEFAULT_ORDER="XYZ";class rI{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 u=0,d=l.length;u0){s.children=[];for(let a=0;a0){s.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),u.length>0&&(i.textures=u),d.length>0&&(i.images=d),h.length>0&&(i.shapes=h),f.length>0&&(i.skeletons=f),_.length>0&&(i.animations=_),m.length>0&&(i.nodes=m)}return i.object=s,i;function o(a){const l=[];for(const u in a){const d=a[u];delete d.metadata,l.push(d)}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),Zm.subVectors(e,t);const o=Di.dot(Di),a=Di.dot(As),l=Di.dot(Zm),u=As.dot(As),d=As.dot(Zm),h=o*u-a*a;if(h===0)return r.set(-2,-1,-1);const f=1/h,_=(u*l-a*d)*f,m=(o*d-a*l)*f;return r.set(1-_-m,m,_)}static containsPoint(e,t,i,s){return this.getBarycoord(e,t,i,s,Ns),Ns.x>=0&&Ns.y>=0&&Ns.x+Ns.y<=1}static getUV(e,t,i,s,r,o,a,l){return sd===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),sd=!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,Ns),l.setScalar(0),l.addScaledVector(r,Ns.x),l.addScaledVector(o,Ns.y),l.addScaledVector(a,Ns.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 sd===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),sd=!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),Jm.subVectors(e,i);const l=Uo.dot(Jm),u=Fo.dot(Jm);if(l<=0&&u<=0)return t.copy(i);eg.subVectors(e,s);const d=Uo.dot(eg),h=Fo.dot(eg);if(d>=0&&h<=d)return t.copy(s);const f=l*h-d*u;if(f<=0&&l>=0&&d<=0)return o=l/(l-d),t.copy(i).addScaledVector(Uo,o);tg.subVectors(e,r);const _=Uo.dot(tg),m=Fo.dot(tg);if(m>=0&&_<=m)return t.copy(r);const E=_*u-l*m;if(E<=0&&u>=0&&m<=0)return a=u/(u-m),t.copy(i).addScaledVector(Fo,a);const b=d*m-_*h;if(b<=0&&h-d>=0&&_-m>=0)return P1.subVectors(r,s),a=(h-d)/(h-d+(_-m)),t.copy(s).addScaledVector(P1,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 oI={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},rr={h:0,s:0,l:0},rd={h:0,s:0,l:0};function ng(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=on){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Gt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,s=Gt.workingColorSpace){return this.r=e,this.g=t,this.b=i,Gt.toWorkingColorSpace(this,s),this}setHSL(e,t,i,s=Gt.workingColorSpace){if(e=JE(e,1),t=Ln(t,0,1),i=Ln(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=ng(o,r,e+1/3),this.g=ng(o,r,e),this.b=ng(o,r,e-1/3)}return Gt.toWorkingColorSpace(this,s),this}setStyle(e,t=on){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=on){const i=oI[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=qm(e.r),this.g=qm(e.g),this.b=qm(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=on){return Gt.fromWorkingColorSpace(Dn.copy(this),e),Math.round(Ln(Dn.r*255,0,255))*65536+Math.round(Ln(Dn.g*255,0,255))*256+Math.round(Ln(Dn.b*255,0,255))}getHexString(e=on){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Gt.workingColorSpace){Gt.fromWorkingColorSpace(Dn.copy(this),t);const i=Dn.r,s=Dn.g,r=Dn.b,o=Math.max(i,s,r),a=Math.min(i,s,r);let l,u;const d=(a+o)/2;if(a===o)l=0,u=0;else{const h=o-a;switch(u=d<=.5?h/(o+a):h/(2-o-a),o){case i:l=(s-r)/h+(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!==Ys&&(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!==rb&&(i.blendSrc=this.blendSrc),this.blendDst!==ob&&(i.blendDst=this.blendDst),this.blendEquation!==Xr&&(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!==_u&&(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!==T1&&(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 Hi{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=jE,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 dn=new _e,od=new It;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=ub,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Ps,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 u in l)l[u]!==void 0&&(e[u]=l[u]);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 u=i[l];e.data.attributes[l]=u.toJSON(e.data)}const s={};let r=!1;for(const l in this.morphAttributes){const u=this.morphAttributes[l],d=[];for(let h=0,f=u.length;h0&&(s[l]=d,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 u in s){const d=s[u];this.setAttribute(u,d.clone(t))}const r=e.morphAttributes;for(const u in r){const d=[],h=r[u];for(let f=0,_=h.length;f<_;f++)d.push(h[f].clone(t));this.morphAttributes[u]=d}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let u=0,d=o.length;u0){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))&&(U1.copy(r).invert(),Gr.copy(e.ray).applyMatrix4(U1),!(i.boundingBox!==null&&Gr.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Gr)))}_computeIntersections(e,t,i){let s;const r=this.geometry,o=this.material,a=r.index,l=r.attributes.position,u=r.attributes.uv,d=r.attributes.uv1,h=r.attributes.normal,f=r.groups,_=r.drawRange;if(a!==null)if(Array.isArray(o))for(let m=0,E=f.length;mt.far?null:{distance:u,point:_d.clone(),object:n}}function hd(n,e,t,i,s,r,o,a,l,u){n.getVertexPosition(a,Go),n.getVertexPosition(l,Vo),n.getVertexPosition(u,zo);const d=KRt(n,e,t,i,Go,Vo,zo,pd);if(d){s&&(cd.fromBufferAttribute(s,a),dd.fromBufferAttribute(s,l),ud.fromBufferAttribute(s,u),d.uv=Pi.getInterpolation(pd,Go,Vo,zo,cd,dd,ud,new It)),r&&(cd.fromBufferAttribute(r,a),dd.fromBufferAttribute(r,l),ud.fromBufferAttribute(r,u),d.uv1=Pi.getInterpolation(pd,Go,Vo,zo,cd,dd,ud,new It),d.uv2=d.uv1),o&&(B1.fromBufferAttribute(o,a),G1.fromBufferAttribute(o,l),V1.fromBufferAttribute(o,u),d.normal=Pi.getInterpolation(pd,Go,Vo,zo,B1,G1,V1,new _e),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));const h={a,b:l,c:u,normal:new _e,materialIndex:0};Pi.getNormal(Go,Vo,zo,h.normal),d.face=h}return d}class Cr extends ms{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=[],u=[],d=[],h=[];let f=0,_=0;m("z","y","x",-1,-1,i,t,e,o,r,0),m("z","y","x",1,-1,i,t,-e,o,r,1),m("x","z","y",1,1,e,i,t,s,o,2),m("x","z","y",1,-1,e,i,-t,s,o,3),m("x","y","z",1,-1,e,t,i,s,r,4),m("x","y","z",-1,-1,e,t,-i,s,r,5),this.setIndex(l),this.setAttribute("position",new Bs(u,3)),this.setAttribute("normal",new Bs(d,3)),this.setAttribute("uv",new Bs(h,2));function m(E,b,g,y,v,S,C,T,O,k,x){const I=S/O,F=C/k,B=S/2,ne=C/2,L=T/2,$=O+1,H=k+1;let U=0,Q=0;const J=new _e;for(let j=0;j0?1:-1,d.push(J.x,J.y,J.z),h.push(ve/O),h.push(1-j/k),U+=1}}for(let j=0;j0&&(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 dI extends rn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Rt,this.projectionMatrix=new Rt,this.projectionMatrixInverse=new Rt,this.coordinateSystem=Us}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 zn extends dI{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=Aa*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ul*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Aa*2*Math.atan(Math.tan(Ul*.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(Ul*.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,u=o.fullHeight;r+=o.offsetX*s/l,t-=o.offsetY*i/u,s*=o.width/l,i*=o.height/u}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 eAt extends rn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new zn(Ho,qo,e,t);s.layers=this.layers,this.add(s);const r=new zn(Ho,qo,e,t);r.layers=this.layers,this.add(r);const o=new zn(Ho,qo,e,t);o.layers=this.layers,this.add(o);const a=new zn(Ho,qo,e,t);a.layers=this.layers,this.add(a);const l=new zn(Ho,qo,e,t);l.layers=this.layers,this.add(l);const u=new zn(Ho,qo,e,t);u.layers=this.layers,this.add(u)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,s,r,o,a,l]=t;for(const u of t)this.remove(u);if(e===Us)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===bu)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 u of t)this.add(u),u.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,u,d]=this.children,h=e.getRenderTarget(),f=e.getActiveCubeFace(),_=e.getActiveMipmapLevel(),m=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,u),i.texture.generateMipmaps=E,e.setRenderTarget(i,5,s),e.render(t,d),e.setRenderTarget(h,f,_),e.xr.enabled=m,i.texture.needsPMREMUpdate=!0}}class uI extends Nn{constructor(e,t,i,s,r,o,a,l,u,d){e=e!==void 0?e:[],t=t!==void 0?t:Ta,super(e,t,i,s,r,o,a,l,u,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class tAt extends mo{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&&(Bl("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===lo?on:bi),this.texture=new uI(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 go extends Hi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=XRt,this.fragmentShader=ZRt,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=Na(e.uniforms),this.uniformsGroups=jRt(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 dI extends rn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Rt,this.projectionMatrix=new Rt,this.projectionMatrixInverse=new Rt,this.coordinateSystem=Us}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 zn extends dI{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=Aa*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ul*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Aa*2*Math.atan(Math.tan(Ul*.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(Ul*.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,u=o.fullHeight;r+=o.offsetX*s/l,t-=o.offsetY*i/u,s*=o.width/l,i*=o.height/u}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 JRt extends rn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new zn(Ho,qo,e,t);s.layers=this.layers,this.add(s);const r=new zn(Ho,qo,e,t);r.layers=this.layers,this.add(r);const o=new zn(Ho,qo,e,t);o.layers=this.layers,this.add(o);const a=new zn(Ho,qo,e,t);a.layers=this.layers,this.add(a);const l=new zn(Ho,qo,e,t);l.layers=this.layers,this.add(l);const u=new zn(Ho,qo,e,t);u.layers=this.layers,this.add(u)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,s,r,o,a,l]=t;for(const u of t)this.remove(u);if(e===Us)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===bu)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 u of t)this.add(u),u.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,u,d]=this.children,h=e.getRenderTarget(),f=e.getActiveCubeFace(),_=e.getActiveMipmapLevel(),m=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,u),i.texture.generateMipmaps=E,e.setRenderTarget(i,5,s),e.render(t,d),e.setRenderTarget(h,f,_),e.xr.enabled=m,i.texture.needsPMREMUpdate=!0}}class uI extends Nn{constructor(e,t,i,s,r,o,a,l,u,d){e=e!==void 0?e:[],t=t!==void 0?t:Ta,super(e,t,i,s,r,o,a,l,u,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class eAt extends mo{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&&(Bl("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===lo?on:bi),this.texture=new uI(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; @@ -303,9 +303,9 @@ ${l}`;navigator.clipboard.writeText(u)}else navigator.clipboard.writeText(e);thi gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},s=new Cr(5,5,5),r=new go({name:"CubemapFromEquirect",uniforms:Na(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===fo&&(t.minFilter=jn),new eAt(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 rg=new _e,nAt=new _e,iAt=new wt;class Yr{constructor(e=new _e(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=rg.subVectors(i,t).cross(nAt.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(rg),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||iAt.getNormalMatrix(e),s=this.coplanarPoint(rg).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 Vr=new fs,fd=new _e;class ey{constructor(e=new Yr,t=new Yr,i=new Yr,s=new Yr,r=new Yr,o=new Yr){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=Us){const i=this.planes,s=e.elements,r=s[0],o=s[1],a=s[2],l=s[3],u=s[4],d=s[5],h=s[6],f=s[7],_=s[8],m=s[9],E=s[10],b=s[11],g=s[12],y=s[13],v=s[14],S=s[15];if(i[0].setComponents(l-r,f-u,b-_,S-g).normalize(),i[1].setComponents(l+r,f+u,b+_,S+g).normalize(),i[2].setComponents(l+o,f+d,b+m,S+y).normalize(),i[3].setComponents(l-o,f-d,b-m,S-y).normalize(),i[4].setComponents(l-a,f-h,b-E,S-v).normalize(),t===Us)i[5].setComponents(l+a,f+h,b+E,S+v).normalize();else if(t===bu)i[5].setComponents(a,h,E,v).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(),Vr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Vr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Vr)}intersectsSprite(e){return Vr.center.set(0,0,0),Vr.radius=.7071067811865476,Vr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Vr)}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,fd.y=s.normal.y>0?e.max.y:e.min.y,fd.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(fd)<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 pI(){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 sAt(n,e){const t=e.isWebGL2,i=new WeakMap;function s(u,d){const h=u.array,f=u.usage,_=h.byteLength,m=n.createBuffer();n.bindBuffer(d,m),n.bufferData(d,h,f),u.onUploadCallback();let E;if(h instanceof Float32Array)E=n.FLOAT;else if(h instanceof Uint16Array)if(u.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(h instanceof Int16Array)E=n.SHORT;else if(h instanceof Uint32Array)E=n.UNSIGNED_INT;else if(h instanceof Int32Array)E=n.INT;else if(h instanceof Int8Array)E=n.BYTE;else if(h instanceof Uint8Array)E=n.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)E=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:m,type:E,bytesPerElement:h.BYTES_PER_ELEMENT,version:u.version,size:_}}function r(u,d,h){const f=d.array,_=d._updateRange,m=d.updateRanges;if(n.bindBuffer(h,u),_.count===-1&&m.length===0&&n.bufferSubData(h,0,f),m.length!==0){for(let E=0,b=m.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||nAt.getNormalMatrix(e),s=this.coplanarPoint(rg).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 Vr=new fs,fd=new _e;class ey{constructor(e=new Yr,t=new Yr,i=new Yr,s=new Yr,r=new Yr,o=new Yr){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=Us){const i=this.planes,s=e.elements,r=s[0],o=s[1],a=s[2],l=s[3],u=s[4],d=s[5],h=s[6],f=s[7],_=s[8],m=s[9],E=s[10],b=s[11],g=s[12],y=s[13],v=s[14],S=s[15];if(i[0].setComponents(l-r,f-u,b-_,S-g).normalize(),i[1].setComponents(l+r,f+u,b+_,S+g).normalize(),i[2].setComponents(l+o,f+d,b+m,S+y).normalize(),i[3].setComponents(l-o,f-d,b-m,S-y).normalize(),i[4].setComponents(l-a,f-h,b-E,S-v).normalize(),t===Us)i[5].setComponents(l+a,f+h,b+E,S+v).normalize();else if(t===bu)i[5].setComponents(a,h,E,v).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(),Vr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Vr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Vr)}intersectsSprite(e){return Vr.center.set(0,0,0),Vr.radius=.7071067811865476,Vr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Vr)}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,fd.y=s.normal.y>0?e.max.y:e.min.y,fd.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(fd)<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 pI(){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 iAt(n,e){const t=e.isWebGL2,i=new WeakMap;function s(u,d){const h=u.array,f=u.usage,_=h.byteLength,m=n.createBuffer();n.bindBuffer(d,m),n.bufferData(d,h,f),u.onUploadCallback();let E;if(h instanceof Float32Array)E=n.FLOAT;else if(h instanceof Uint16Array)if(u.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(h instanceof Int16Array)E=n.SHORT;else if(h instanceof Uint32Array)E=n.UNSIGNED_INT;else if(h instanceof Int32Array)E=n.INT;else if(h instanceof Int8Array)E=n.BYTE;else if(h instanceof Uint8Array)E=n.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)E=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:m,type:E,bytesPerElement:h.BYTES_PER_ELEMENT,version:u.version,size:_}}function r(u,d,h){const f=d.array,_=d._updateRange,m=d.updateRanges;if(n.bindBuffer(h,u),_.count===-1&&m.length===0&&n.bufferSubData(h,0,f),m.length!==0){for(let E=0,b=m.length;E 0 +#endif`,EAt=`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { @@ -502,26 +502,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve #pragma unroll_loop_end if ( clipped ) discard; #endif -#endif`,vAt=`#if NUM_CLIPPING_PLANES > 0 +#endif`,yAt=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,SAt=`#if NUM_CLIPPING_PLANES > 0 +#endif`,vAt=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; -#endif`,TAt=`#if NUM_CLIPPING_PLANES > 0 +#endif`,SAt=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; -#endif`,xAt=`#if defined( USE_COLOR_ALPHA ) +#endif`,TAt=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; -#endif`,CAt=`#if defined( USE_COLOR_ALPHA ) +#endif`,xAt=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; -#endif`,wAt=`#if defined( USE_COLOR_ALPHA ) +#endif`,CAt=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; -#endif`,RAt=`#if defined( USE_COLOR_ALPHA ) +#endif`,wAt=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) vColor = vec3( 1.0 ); @@ -531,7 +531,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`,AAt=`#define PI 3.141592653589793 +#endif`,RAt=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 @@ -609,7 +609,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`,NAt=`#ifdef ENVMAP_TYPE_CUBE_UV +} // validated`,AAt=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { @@ -707,7 +707,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`,OAt=`vec3 transformedNormal = objectNormal; +#endif`,NAt=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif @@ -736,18 +736,18 @@ transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif -#endif`,IAt=`#ifdef USE_DISPLACEMENTMAP +#endif`,OAt=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; -#endif`,MAt=`#ifdef USE_DISPLACEMENTMAP +#endif`,IAt=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,DAt=`#ifdef USE_EMISSIVEMAP +#endif`,MAt=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,kAt=`#ifdef USE_EMISSIVEMAP +#endif`,DAt=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; -#endif`,LAt="gl_FragColor = linearToOutputTexel( gl_FragColor );",PAt=` +#endif`,kAt="gl_FragColor = linearToOutputTexel( gl_FragColor );",LAt=` const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( vec3( 0.8224621, 0.177538, 0.0 ), vec3( 0.0331941, 0.9668058, 0.0 ), @@ -775,7 +775,7 @@ vec4 LinearToLinear( in vec4 value ) { } vec4 LinearTosRGB( in vec4 value ) { return sRGBTransferOETF( value ); -}`,UAt=`#ifdef USE_ENVMAP +}`,PAt=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { @@ -804,7 +804,7 @@ vec4 LinearTosRGB( in vec4 value ) { #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif -#endif`,FAt=`#ifdef USE_ENVMAP +#endif`,UAt=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; #ifdef ENVMAP_TYPE_CUBE @@ -813,7 +813,7 @@ vec4 LinearTosRGB( in vec4 value ) { uniform sampler2D envMap; #endif -#endif`,BAt=`#ifdef USE_ENVMAP +#endif`,FAt=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS @@ -824,7 +824,7 @@ vec4 LinearTosRGB( in vec4 value ) { #else varying vec3 vReflect; #endif -#endif`,GAt=`#ifdef USE_ENVMAP +#endif`,BAt=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif @@ -835,7 +835,7 @@ vec4 LinearTosRGB( in vec4 value ) { varying vec3 vReflect; uniform float refractionRatio; #endif -#endif`,VAt=`#ifdef USE_ENVMAP +#endif`,GAt=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else @@ -852,18 +852,18 @@ vec4 LinearTosRGB( in vec4 value ) { vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif -#endif`,zAt=`#ifdef USE_FOG +#endif`,VAt=`#ifdef USE_FOG vFogDepth = - mvPosition.z; -#endif`,HAt=`#ifdef USE_FOG +#endif`,zAt=`#ifdef USE_FOG varying float vFogDepth; -#endif`,qAt=`#ifdef USE_FOG +#endif`,HAt=`#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`,YAt=`#ifdef USE_FOG +#endif`,qAt=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 @@ -872,7 +872,7 @@ vec4 LinearTosRGB( in vec4 value ) { uniform float fogNear; uniform float fogFar; #endif -#endif`,$At=`#ifdef USE_GRADIENTMAP +#endif`,YAt=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { @@ -884,16 +884,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 -}`,WAt=`#ifdef USE_LIGHTMAP +}`,$At=`#ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; reflectedLight.indirectDiffuse += lightMapIrradiance; -#endif`,KAt=`#ifdef USE_LIGHTMAP +#endif`,WAt=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; -#endif`,jAt=`LambertMaterial material; +#endif`,KAt=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,QAt=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,jAt=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; @@ -907,7 +907,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`,XAt=`uniform bool receiveShadow; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,QAt=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; @@ -1030,7 +1030,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } -#endif`,ZAt=`#ifdef USE_ENVMAP +#endif`,XAt=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); @@ -1063,8 +1063,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi #endif } #endif -#endif`,JAt=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,eNt=`varying vec3 vViewPosition; +#endif`,ZAt=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,JAt=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; @@ -1076,11 +1076,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`,tNt=`BlinnPhongMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,eNt=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; -material.specularStrength = specularStrength;`,nNt=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,tNt=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; @@ -1097,7 +1097,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`,iNt=`PhysicalMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,nNt=`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 ); @@ -1180,7 +1180,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`,sNt=`struct PhysicalMaterial { +#endif`,iNt=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; @@ -1480,7 +1480,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 ); -}`,rNt=` +}`,sNt=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); @@ -1595,7 +1595,7 @@ IncidentLight directLight; #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,oNt=`#if defined( RE_IndirectDiffuse ) +#endif`,rNt=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; @@ -1614,25 +1614,25 @@ IncidentLight directLight; #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif -#endif`,aNt=`#if defined( RE_IndirectDiffuse ) +#endif`,oNt=`#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`,lNt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) +#endif`,aNt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,cNt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) +#endif`,lNt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; -#endif`,dNt=`#ifdef USE_LOGDEPTHBUF +#endif`,cNt=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif -#endif`,uNt=`#ifdef USE_LOGDEPTHBUF +#endif`,dNt=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); @@ -1642,16 +1642,16 @@ IncidentLight directLight; gl_Position.z *= gl_Position.w; } #endif -#endif`,pNt=`#ifdef USE_MAP +#endif`,uNt=`#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`,_Nt=`#ifdef USE_MAP +#endif`,pNt=`#ifdef USE_MAP uniform sampler2D map; -#endif`,hNt=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,_Nt=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else @@ -1663,7 +1663,7 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,fNt=`#if defined( USE_POINTS_UV ) +#endif`,hNt=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) @@ -1675,13 +1675,13 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,mNt=`float metalnessFactor = metalness; +#endif`,fNt=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; -#endif`,gNt=`#ifdef USE_METALNESSMAP +#endif`,mNt=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; -#endif`,bNt=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) +#endif`,gNt=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) @@ -1690,7 +1690,7 @@ IncidentLight directLight; if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } -#endif`,ENt=`#ifdef USE_MORPHNORMALS +#endif`,bNt=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { @@ -1702,7 +1702,7 @@ IncidentLight directLight; objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; #endif -#endif`,yNt=`#ifdef USE_MORPHTARGETS +#endif`,ENt=`#ifdef USE_MORPHTARGETS uniform float morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; @@ -1722,7 +1722,7 @@ IncidentLight directLight; uniform float morphTargetInfluences[ 4 ]; #endif #endif -#endif`,vNt=`#ifdef USE_MORPHTARGETS +#endif`,yNt=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { @@ -1740,7 +1740,7 @@ IncidentLight directLight; transformed += morphTarget7 * morphTargetInfluences[ 7 ]; #endif #endif -#endif`,SNt=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#endif`,vNt=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); @@ -1781,7 +1781,7 @@ IncidentLight directLight; tbn2[1] *= faceDirection; #endif #endif -vec3 nonPerturbedNormal = normal;`,TNt=`#ifdef USE_NORMALMAP_OBJECTSPACE +vec3 nonPerturbedNormal = normal;`,SNt=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; @@ -1796,6 +1796,12 @@ vec3 nonPerturbedNormal = normal;`,TNt=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,TNt=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif #endif`,xNt=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT @@ -1803,18 +1809,12 @@ vec3 nonPerturbedNormal = normal;`,TNt=`#ifdef USE_NORMALMAP_OBJECTSPACE varying vec3 vBitangent; #endif #endif`,CNt=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,wNt=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif -#endif`,RNt=`#ifdef USE_NORMALMAP +#endif`,wNt=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif @@ -1836,13 +1836,13 @@ vec3 nonPerturbedNormal = normal;`,TNt=`#ifdef USE_NORMALMAP_OBJECTSPACE float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } -#endif`,ANt=`#ifdef USE_CLEARCOAT +#endif`,RNt=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,NNt=`#ifdef USE_CLEARCOAT_NORMALMAP +#endif`,ANt=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,ONt=`#ifdef USE_CLEARCOATMAP +#endif`,NNt=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP @@ -1851,18 +1851,18 @@ vec3 nonPerturbedNormal = normal;`,TNt=`#ifdef USE_NORMALMAP_OBJECTSPACE #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; -#endif`,INt=`#ifdef USE_IRIDESCENCEMAP +#endif`,ONt=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; -#endif`,MNt=`#ifdef OPAQUE +#endif`,INt=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,DNt=`vec3 packNormalToRGB( const in vec3 normal ) { +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,MNt=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { @@ -1903,9 +1903,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 ); -}`,kNt=`#ifdef PREMULTIPLIED_ALPHA +}`,DNt=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; -#endif`,LNt=`vec4 mvPosition = vec4( transformed, 1.0 ); +#endif`,kNt=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif @@ -1913,22 +1913,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,PNt=`#ifdef DITHERING +gl_Position = projectionMatrix * mvPosition;`,LNt=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,UNt=`#ifdef DITHERING +#endif`,PNt=`#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`,FNt=`float roughnessFactor = roughness; +#endif`,UNt=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; -#endif`,BNt=`#ifdef USE_ROUGHNESSMAP +#endif`,FNt=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; -#endif`,GNt=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,BNt=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 @@ -2105,7 +2105,7 @@ gl_Position = projectionMatrix * mvPosition;`,PNt=`#ifdef DITHERING return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } -#endif`,VNt=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,GNt=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif @@ -2143,7 +2143,7 @@ gl_Position = projectionMatrix * mvPosition;`,PNt=`#ifdef DITHERING }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif -#endif`,zNt=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) +#endif`,VNt=`#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 @@ -2175,7 +2175,7 @@ gl_Position = projectionMatrix * mvPosition;`,PNt=`#ifdef DITHERING vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end -#endif`,HNt=`float getShadowMask() { +#endif`,zNt=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 @@ -2207,12 +2207,12 @@ gl_Position = projectionMatrix * mvPosition;`,PNt=`#ifdef DITHERING #endif #endif return shadow; -}`,qNt=`#ifdef USE_SKINNING +}`,HNt=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,YNt=`#ifdef USE_SKINNING +#endif`,qNt=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; @@ -2227,7 +2227,7 @@ gl_Position = projectionMatrix * mvPosition;`,PNt=`#ifdef DITHERING vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } -#endif`,$Nt=`#ifdef USE_SKINNING +#endif`,YNt=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; @@ -2235,7 +2235,7 @@ gl_Position = projectionMatrix * mvPosition;`,PNt=`#ifdef DITHERING skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,WNt=`#ifdef USE_SKINNING +#endif`,$Nt=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; @@ -2246,17 +2246,17 @@ gl_Position = projectionMatrix * mvPosition;`,PNt=`#ifdef DITHERING #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif -#endif`,KNt=`float specularStrength; +#endif`,WNt=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; -#endif`,jNt=`#ifdef USE_SPECULARMAP +#endif`,KNt=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; -#endif`,QNt=`#if defined( TONE_MAPPING ) +#endif`,jNt=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,XNt=`#ifndef saturate +#endif`,QNt=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; @@ -2292,7 +2292,7 @@ vec3 ACESFilmicToneMapping( vec3 color ) { color = ACESOutputMat * color; return saturate( color ); } -vec3 CustomToneMapping( vec3 color ) { return color; }`,ZNt=`#ifdef USE_TRANSMISSION +vec3 CustomToneMapping( vec3 color ) { return color; }`,XNt=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; @@ -2313,7 +2313,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ZNt=`#ifdef USE_TRANSMIS material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,JNt=`#ifdef USE_TRANSMISSION +#endif`,ZNt=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; @@ -2419,7 +2419,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ZNt=`#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`,eOt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,JNt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2489,7 +2489,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ZNt=`#ifdef USE_TRANSMIS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,tOt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,eOt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2583,7 +2583,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ZNt=`#ifdef USE_TRANSMIS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,nOt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,tOt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP @@ -2654,7 +2654,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ZNt=`#ifdef USE_TRANSMIS #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,iOt=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 +#endif`,nOt=`#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; @@ -2663,12 +2663,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,ZNt=`#ifdef USE_TRANSMIS worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; -#endif`;const sOt=`varying vec2 vUv; +#endif`;const iOt=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,rOt=`uniform sampler2D t2D; +}`,sOt=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { @@ -2680,14 +2680,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,oOt=`varying vec3 vWorldDirection; +}`,rOt=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,aOt=`#ifdef ENVMAP_TYPE_CUBE +}`,oOt=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; @@ -2709,14 +2709,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,lOt=`varying vec3 vWorldDirection; +}`,aOt=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,cOt=`uniform samplerCube tCube; +}`,lOt=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; @@ -2726,7 +2726,7 @@ void main() { gl_FragColor.a *= opacity; #include #include -}`,dOt=`#include +}`,cOt=`#include #include #include #include @@ -2752,7 +2752,7 @@ void main() { #include #include vHighPrecisionZW = gl_Position.zw; -}`,uOt=`#if DEPTH_PACKING == 3200 +}`,dOt=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include @@ -2782,7 +2782,7 @@ void main() { #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #endif -}`,pOt=`#define DISTANCE +}`,uOt=`#define DISTANCE varying vec3 vWorldPosition; #include #include @@ -2808,7 +2808,7 @@ void main() { #include #include vWorldPosition = worldPosition.xyz; -}`,_Ot=`#define DISTANCE +}`,pOt=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; @@ -2832,13 +2832,13 @@ void main () { dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); -}`,hOt=`varying vec3 vWorldDirection; +}`,_Ot=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include -}`,fOt=`uniform sampler2D tEquirect; +}`,hOt=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { @@ -2847,7 +2847,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include -}`,mOt=`uniform float scale; +}`,fOt=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include @@ -2868,7 +2868,7 @@ void main() { #include #include #include -}`,gOt=`uniform vec3 diffuse; +}`,mOt=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; @@ -2896,7 +2896,7 @@ void main() { #include #include #include -}`,bOt=`#include +}`,gOt=`#include #include #include #include @@ -2927,7 +2927,7 @@ void main() { #include #include #include -}`,EOt=`uniform vec3 diffuse; +}`,bOt=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; @@ -2975,7 +2975,7 @@ void main() { #include #include #include -}`,yOt=`#define LAMBERT +}`,EOt=`#define LAMBERT varying vec3 vViewPosition; #include #include @@ -3013,7 +3013,7 @@ void main() { #include #include #include -}`,vOt=`#define LAMBERT +}`,yOt=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3070,7 +3070,7 @@ void main() { #include #include #include -}`,SOt=`#define MATCAP +}`,vOt=`#define MATCAP varying vec3 vViewPosition; #include #include @@ -3103,7 +3103,7 @@ void main() { #include #include vViewPosition = - mvPosition.xyz; -}`,TOt=`#define MATCAP +}`,SOt=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; @@ -3149,7 +3149,7 @@ void main() { #include #include #include -}`,xOt=`#define NORMAL +}`,TOt=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif @@ -3181,7 +3181,7 @@ void main() { #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif -}`,COt=`#define NORMAL +}`,xOt=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; @@ -3202,7 +3202,7 @@ void main() { #ifdef OPAQUE gl_FragColor.a = 1.0; #endif -}`,wOt=`#define PHONG +}`,COt=`#define PHONG varying vec3 vViewPosition; #include #include @@ -3240,7 +3240,7 @@ void main() { #include #include #include -}`,ROt=`#define PHONG +}`,wOt=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; @@ -3299,7 +3299,7 @@ void main() { #include #include #include -}`,AOt=`#define STANDARD +}`,ROt=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; @@ -3341,7 +3341,7 @@ void main() { #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif -}`,NOt=`#define STANDARD +}`,AOt=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR @@ -3463,7 +3463,7 @@ void main() { #include #include #include -}`,OOt=`#define TOON +}`,NOt=`#define TOON varying vec3 vViewPosition; #include #include @@ -3499,7 +3499,7 @@ void main() { #include #include #include -}`,IOt=`#define TOON +}`,OOt=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3552,7 +3552,7 @@ void main() { #include #include #include -}`,MOt=`uniform float size; +}`,IOt=`uniform float size; uniform float scale; #include #include @@ -3582,7 +3582,7 @@ void main() { #include #include #include -}`,DOt=`uniform vec3 diffuse; +}`,MOt=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3607,7 +3607,7 @@ void main() { #include #include #include -}`,kOt=`#include +}`,DOt=`#include #include #include #include @@ -3629,7 +3629,7 @@ void main() { #include #include #include -}`,LOt=`uniform vec3 color; +}`,kOt=`uniform vec3 color; uniform float opacity; #include #include @@ -3645,7 +3645,7 @@ void main() { #include #include #include -}`,POt=`uniform float rotation; +}`,LOt=`uniform float rotation; uniform vec2 center; #include #include @@ -3671,7 +3671,7 @@ void main() { #include #include #include -}`,UOt=`uniform vec3 diffuse; +}`,POt=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3696,7 +3696,7 @@ void main() { #include #include #include -}`,Tt={alphahash_fragment:rAt,alphahash_pars_fragment:oAt,alphamap_fragment:aAt,alphamap_pars_fragment:lAt,alphatest_fragment:cAt,alphatest_pars_fragment:dAt,aomap_fragment:uAt,aomap_pars_fragment:pAt,batching_pars_vertex:_At,batching_vertex:hAt,begin_vertex:fAt,beginnormal_vertex:mAt,bsdfs:gAt,iridescence_fragment:bAt,bumpmap_pars_fragment:EAt,clipping_planes_fragment:yAt,clipping_planes_pars_fragment:vAt,clipping_planes_pars_vertex:SAt,clipping_planes_vertex:TAt,color_fragment:xAt,color_pars_fragment:CAt,color_pars_vertex:wAt,color_vertex:RAt,common:AAt,cube_uv_reflection_fragment:NAt,defaultnormal_vertex:OAt,displacementmap_pars_vertex:IAt,displacementmap_vertex:MAt,emissivemap_fragment:DAt,emissivemap_pars_fragment:kAt,colorspace_fragment:LAt,colorspace_pars_fragment:PAt,envmap_fragment:UAt,envmap_common_pars_fragment:FAt,envmap_pars_fragment:BAt,envmap_pars_vertex:GAt,envmap_physical_pars_fragment:ZAt,envmap_vertex:VAt,fog_vertex:zAt,fog_pars_vertex:HAt,fog_fragment:qAt,fog_pars_fragment:YAt,gradientmap_pars_fragment:$At,lightmap_fragment:WAt,lightmap_pars_fragment:KAt,lights_lambert_fragment:jAt,lights_lambert_pars_fragment:QAt,lights_pars_begin:XAt,lights_toon_fragment:JAt,lights_toon_pars_fragment:eNt,lights_phong_fragment:tNt,lights_phong_pars_fragment:nNt,lights_physical_fragment:iNt,lights_physical_pars_fragment:sNt,lights_fragment_begin:rNt,lights_fragment_maps:oNt,lights_fragment_end:aNt,logdepthbuf_fragment:lNt,logdepthbuf_pars_fragment:cNt,logdepthbuf_pars_vertex:dNt,logdepthbuf_vertex:uNt,map_fragment:pNt,map_pars_fragment:_Nt,map_particle_fragment:hNt,map_particle_pars_fragment:fNt,metalnessmap_fragment:mNt,metalnessmap_pars_fragment:gNt,morphcolor_vertex:bNt,morphnormal_vertex:ENt,morphtarget_pars_vertex:yNt,morphtarget_vertex:vNt,normal_fragment_begin:SNt,normal_fragment_maps:TNt,normal_pars_fragment:xNt,normal_pars_vertex:CNt,normal_vertex:wNt,normalmap_pars_fragment:RNt,clearcoat_normal_fragment_begin:ANt,clearcoat_normal_fragment_maps:NNt,clearcoat_pars_fragment:ONt,iridescence_pars_fragment:INt,opaque_fragment:MNt,packing:DNt,premultiplied_alpha_fragment:kNt,project_vertex:LNt,dithering_fragment:PNt,dithering_pars_fragment:UNt,roughnessmap_fragment:FNt,roughnessmap_pars_fragment:BNt,shadowmap_pars_fragment:GNt,shadowmap_pars_vertex:VNt,shadowmap_vertex:zNt,shadowmask_pars_fragment:HNt,skinbase_vertex:qNt,skinning_pars_vertex:YNt,skinning_vertex:$Nt,skinnormal_vertex:WNt,specularmap_fragment:KNt,specularmap_pars_fragment:jNt,tonemapping_fragment:QNt,tonemapping_pars_fragment:XNt,transmission_fragment:ZNt,transmission_pars_fragment:JNt,uv_pars_fragment:eOt,uv_pars_vertex:tOt,uv_vertex:nOt,worldpos_vertex:iOt,background_vert:sOt,background_frag:rOt,backgroundCube_vert:oOt,backgroundCube_frag:aOt,cube_vert:lOt,cube_frag:cOt,depth_vert:dOt,depth_frag:uOt,distanceRGBA_vert:pOt,distanceRGBA_frag:_Ot,equirect_vert:hOt,equirect_frag:fOt,linedashed_vert:mOt,linedashed_frag:gOt,meshbasic_vert:bOt,meshbasic_frag:EOt,meshlambert_vert:yOt,meshlambert_frag:vOt,meshmatcap_vert:SOt,meshmatcap_frag:TOt,meshnormal_vert:xOt,meshnormal_frag:COt,meshphong_vert:wOt,meshphong_frag:ROt,meshphysical_vert:AOt,meshphysical_frag:NOt,meshtoon_vert:OOt,meshtoon_frag:IOt,points_vert:MOt,points_frag:DOt,shadow_vert:kOt,shadow_frag:LOt,sprite_vert:POt,sprite_frag:UOt},je={common:{diffuse:{value:new gt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new wt},alphaMap:{value:null},alphaMapTransform:{value:new wt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new wt}},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 wt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new wt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new wt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new wt},normalScale:{value:new It(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new wt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new wt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new wt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new wt}},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 wt},alphaTest:{value:0},uvTransform:{value:new wt}},sprite:{diffuse:{value:new gt(16777215)},opacity:{value:1},center:{value:new It(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new wt},alphaMap:{value:null},alphaMapTransform:{value:new wt},alphaTest:{value:0}}},Ji={basic:{uniforms:Vn([je.common,je.specularmap,je.envmap,je.aomap,je.lightmap,je.fog]),vertexShader:Tt.meshbasic_vert,fragmentShader:Tt.meshbasic_frag},lambert:{uniforms:Vn([je.common,je.specularmap,je.envmap,je.aomap,je.lightmap,je.emissivemap,je.bumpmap,je.normalmap,je.displacementmap,je.fog,je.lights,{emissive:{value:new gt(0)}}]),vertexShader:Tt.meshlambert_vert,fragmentShader:Tt.meshlambert_frag},phong:{uniforms:Vn([je.common,je.specularmap,je.envmap,je.aomap,je.lightmap,je.emissivemap,je.bumpmap,je.normalmap,je.displacementmap,je.fog,je.lights,{emissive:{value:new gt(0)},specular:{value:new gt(1118481)},shininess:{value:30}}]),vertexShader:Tt.meshphong_vert,fragmentShader:Tt.meshphong_frag},standard:{uniforms:Vn([je.common,je.envmap,je.aomap,je.lightmap,je.emissivemap,je.bumpmap,je.normalmap,je.displacementmap,je.roughnessmap,je.metalnessmap,je.fog,je.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:Vn([je.common,je.aomap,je.lightmap,je.emissivemap,je.bumpmap,je.normalmap,je.displacementmap,je.gradientmap,je.fog,je.lights,{emissive:{value:new gt(0)}}]),vertexShader:Tt.meshtoon_vert,fragmentShader:Tt.meshtoon_frag},matcap:{uniforms:Vn([je.common,je.bumpmap,je.normalmap,je.displacementmap,je.fog,{matcap:{value:null}}]),vertexShader:Tt.meshmatcap_vert,fragmentShader:Tt.meshmatcap_frag},points:{uniforms:Vn([je.points,je.fog]),vertexShader:Tt.points_vert,fragmentShader:Tt.points_frag},dashed:{uniforms:Vn([je.common,je.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Tt.linedashed_vert,fragmentShader:Tt.linedashed_frag},depth:{uniforms:Vn([je.common,je.displacementmap]),vertexShader:Tt.depth_vert,fragmentShader:Tt.depth_frag},normal:{uniforms:Vn([je.common,je.bumpmap,je.normalmap,je.displacementmap,{opacity:{value:1}}]),vertexShader:Tt.meshnormal_vert,fragmentShader:Tt.meshnormal_frag},sprite:{uniforms:Vn([je.sprite,je.fog]),vertexShader:Tt.sprite_vert,fragmentShader:Tt.sprite_frag},background:{uniforms:{uvTransform:{value:new wt},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:Vn([je.common,je.displacementmap,{referencePosition:{value:new _e},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Tt.distanceRGBA_vert,fragmentShader:Tt.distanceRGBA_frag},shadow:{uniforms:Vn([je.lights,je.fog,{color:{value:new gt(0)},opacity:{value:1}}]),vertexShader:Tt.shadow_vert,fragmentShader:Tt.shadow_frag}};Ji.physical={uniforms:Vn([Ji.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new wt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new wt},clearcoatNormalScale:{value:new It(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new wt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new wt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new wt},sheen:{value:0},sheenColor:{value:new gt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new wt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new wt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new wt},transmissionSamplerSize:{value:new It},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new wt},attenuationDistance:{value:0},attenuationColor:{value:new gt(0)},specularColor:{value:new gt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new wt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new wt},anisotropyVector:{value:new It},anisotropyMap:{value:null},anisotropyMapTransform:{value:new wt}}]),vertexShader:Tt.meshphysical_vert,fragmentShader:Tt.meshphysical_frag};const md={r:0,b:0,g:0};function FOt(n,e,t,i,s,r,o){const a=new gt(0);let l=r===!0?0:1,u,d,h=null,f=0,_=null;function m(b,g){let y=!1,v=g.isScene===!0?g.background:null;v&&v.isTexture&&(v=(g.backgroundBlurriness>0?t:e).get(v)),v===null?E(a,l):v&&v.isColor&&(E(v,1),y=!0);const S=n.xr.getEnvironmentBlendMode();S==="additive"?i.buffers.color.setClear(0,0,0,1,o):S==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||y)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),v&&(v.isCubeTexture||v.mapping===cp)?(d===void 0&&(d=new Hn(new Cr(1,1,1),new go({name:"BackgroundCubeMaterial",uniforms:Na(Ji.backgroundCube.uniforms),vertexShader:Ji.backgroundCube.vertexShader,fragmentShader:Ji.backgroundCube.fragmentShader,side:Zn,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(C,T,O){this.matrixWorld.copyPosition(O.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(d)),d.material.uniforms.envMap.value=v,d.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,d.material.toneMapped=Gt.getTransfer(v.colorSpace)!==Zt,(h!==v||f!==v.version||_!==n.toneMapping)&&(d.material.needsUpdate=!0,h=v,f=v.version,_=n.toneMapping),d.layers.enableAll(),b.unshift(d,d.geometry,d.material,0,0,null)):v&&v.isTexture&&(u===void 0&&(u=new Hn(new ty(2,2),new go({name:"BackgroundMaterial",uniforms:Na(Ji.background.uniforms),vertexShader:Ji.background.vertexShader,fragmentShader:Ji.background.fragmentShader,side:Ys,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(u)),u.material.uniforms.t2D.value=v,u.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,u.material.toneMapped=Gt.getTransfer(v.colorSpace)!==Zt,v.matrixAutoUpdate===!0&&v.updateMatrix(),u.material.uniforms.uvTransform.value.copy(v.matrix),(h!==v||f!==v.version||_!==n.toneMapping)&&(u.material.needsUpdate=!0,h=v,f=v.version,_=n.toneMapping),u.layers.enableAll(),b.unshift(u,u.geometry,u.material,0,0,null))}function E(b,g){b.getRGB(md,cI(n)),i.buffers.color.setClear(md.r,md.g,md.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:m}}function BOt(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 u=l,d=!1;function h(L,$,H,U,Q){let J=!1;if(o){const j=E(U,H,$);u!==j&&(u=j,_(u.object)),J=g(L,U,H,Q),J&&y(L,U,H,Q)}else{const j=$.wireframe===!0;(u.geometry!==U.id||u.program!==H.id||u.wireframe!==j)&&(u.geometry=U.id,u.program=H.id,u.wireframe=j,J=!0)}Q!==null&&t.update(Q,n.ELEMENT_ARRAY_BUFFER),(J||d)&&(d=!1,k(L,$,H,U),Q!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(Q).buffer))}function f(){return i.isWebGL2?n.createVertexArray():r.createVertexArrayOES()}function _(L){return i.isWebGL2?n.bindVertexArray(L):r.bindVertexArrayOES(L)}function m(L){return i.isWebGL2?n.deleteVertexArray(L):r.deleteVertexArrayOES(L)}function E(L,$,H){const U=H.wireframe===!0;let Q=a[L.id];Q===void 0&&(Q={},a[L.id]=Q);let J=Q[$.id];J===void 0&&(J={},Q[$.id]=J);let j=J[U];return j===void 0&&(j=b(f()),J[U]=j),j}function b(L){const $=[],H=[],U=[];for(let Q=0;Q=0){const Ee=Q[ve];let xe=J[ve];if(xe===void 0&&(ve==="instanceMatrix"&&L.instanceMatrix&&(xe=L.instanceMatrix),ve==="instanceColor"&&L.instanceColor&&(xe=L.instanceColor)),Ee===void 0||Ee.attribute!==xe||xe&&Ee.data!==xe.data)return!0;j++}return u.attributesNum!==j||u.index!==U}function y(L,$,H,U){const Q={},J=$.attributes;let j=0;const ae=H.getAttributes();for(const ve in ae)if(ae[ve].location>=0){let Ee=J[ve];Ee===void 0&&(ve==="instanceMatrix"&&L.instanceMatrix&&(Ee=L.instanceMatrix),ve==="instanceColor"&&L.instanceColor&&(Ee=L.instanceColor));const xe={};xe.attribute=Ee,Ee&&Ee.data&&(xe.data=Ee.data),Q[ve]=xe,j++}u.attributes=Q,u.attributesNum=j,u.index=U}function v(){const L=u.newAttributes;for(let $=0,H=L.length;$=0){let ee=Q[ae];if(ee===void 0&&(ae==="instanceMatrix"&&L.instanceMatrix&&(ee=L.instanceMatrix),ae==="instanceColor"&&L.instanceColor&&(ee=L.instanceColor)),ee!==void 0){const Ee=ee.normalized,xe=ee.itemSize,Me=t.get(ee);if(Me===void 0)continue;const Z=Me.buffer,ye=Me.type,fe=Me.bytesPerElement,Ne=i.isWebGL2===!0&&(ye===n.INT||ye===n.UNSIGNED_INT||ee.gpuType===YO);if(ee.isInterleavedBufferAttribute){const Le=ee.data,D=Le.stride,q=ee.offset;if(Le.isInstancedInterleavedBuffer){for(let K=0;K0&&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 u=o||e.has("WEBGL_draw_buffers"),d=t.logarithmicDepthBuffer===!0,h=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),f=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=n.getParameter(n.MAX_TEXTURE_SIZE),m=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),y=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),v=f>0,S=o||e.has("OES_texture_float"),C=v&&S,T=o?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:u,getMaxAnisotropy:s,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:d,maxTextures:h,maxVertexTextures:f,maxTextureSize:_,maxCubemapSize:m,maxAttributes:E,maxVertexUniforms:b,maxVaryings:g,maxFragmentUniforms:y,vertexTextures:v,floatFragmentTextures:S,floatVertexTextures:C,maxSamples:T}}function zOt(n){const e=this;let t=null,i=0,s=!1,r=!1;const o=new Yr,a=new wt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){const _=h.length!==0||f||i!==0||s;return s=f,i=h.length,_},this.beginShadows=function(){r=!0,d(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(h,f){t=d(h,f,0)},this.setState=function(h,f,_){const m=h.clippingPlanes,E=h.clipIntersection,b=h.clipShadows,g=n.get(h);if(!s||m===null||m.length===0||r&&!b)r?d(null):u();else{const y=r?0:i,v=y*4;let S=g.clippingState||null;l.value=S,S=d(m,f,v,_);for(let C=0;C!==v;++C)S[C]=t[C];g.clippingState=S,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=y}};function u(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function d(h,f,_,m){const E=h!==null?h.length:0;let b=null;if(E!==0){if(b=l.value,m!==!0||b===null){const g=_+E*4,y=f.matrixWorldInverse;a.getNormalMatrix(y),(b===null||b.length0){const u=new tAt(l.height/2);return u.fromEquirectangularTexture(n,o),e.set(o,u),o.addEventListener("dispose",s),t(u.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 ny extends dI{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 u=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=u*this.view.offsetX,o=r+u*this.view.width,a-=d*this.view.offsetY,l=a-d*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,z1=[.125,.215,.35,.446,.526,.582],Zr=20,og=new ny,H1=new gt;let ag=null,lg=0,cg=0;const $r=(1+Math.sqrt(5))/2,Yo=1/$r,q1=[new _e(1,1,1),new _e(-1,1,1),new _e(1,1,-1),new _e(-1,1,-1),new _e(0,$r,Yo),new _e(0,$r,-Yo),new _e(Yo,0,$r),new _e(-Yo,0,$r),new _e($r,Yo,0),new _e(-$r,Yo,0)];class Y1{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){ag=this._renderer.getRenderTarget(),lg=this._renderer.getActiveCubeFace(),cg=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=K1(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=W1(),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?v:0,v,v),d.setRenderTarget(s),E&&d.render(m,a),d.render(e,a)}m.geometry.dispose(),m.material.dispose(),d.toneMapping=f,d.autoClear=h,e.background=b}_textureToCubeUV(e,t){const i=this._renderer,s=e.mapping===Ta||e.mapping===xa;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=K1()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=W1());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;gd(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,og)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let s=1;sZr&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${Zr}`);const g=[];let y=0;for(let O=0;Ov-Xo?s-v+Xo:0),T=4*(this._cubeSize-S);gd(t,C,T,3*S,2*S),l.setRenderTarget(t),l.render(h,og)}}function qOt(n){const e=[],t=[],i=[];let s=n;const r=n-Xo+1+z1.length;for(let o=0;on-Xo?l=z1[o-n+Xo-1]:o===0&&(l=0),i.push(l);const u=1/(a-2),d=-u,h=1+u,f=[d,d,h,d,h,h,d,d,h,h,d,h],_=6,m=6,E=3,b=2,g=1,y=new Float32Array(E*m*_),v=new Float32Array(b*m*_),S=new Float32Array(g*m*_);for(let T=0;T<_;T++){const O=T%3*2/3-1,k=T>2?0:-1,x=[O,k,0,O+2/3,k,0,O+2/3,k+1,0,O,k,0,O+2/3,k+1,0,O,k+1,0];y.set(x,E*m*T),v.set(f,b*m*T);const I=[T,T,T,T,T,T];S.set(I,g*m*T)}const C=new ms;C.setAttribute("position",new Yn(y,E)),C.setAttribute("uv",new Yn(v,b)),C.setAttribute("faceIndex",new Yn(S,g)),e.push(C),s>Xo&&s--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function $1(n,e,t){const i=new mo(n,e,t);return i.texture.mapping=cp,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function gd(n,e,t,i,s){n.viewport.set(e,t,i,s),n.scissor.set(e,t,i,s)}function YOt(n,e,t){const i=new Float32Array(Zr),s=new _e(0,1,0);return new go({name:"SphericalGaussianBlur",defines:{n:Zr,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:iy(),fragmentShader:` +}`,Tt={alphahash_fragment:sAt,alphahash_pars_fragment:rAt,alphamap_fragment:oAt,alphamap_pars_fragment:aAt,alphatest_fragment:lAt,alphatest_pars_fragment:cAt,aomap_fragment:dAt,aomap_pars_fragment:uAt,batching_pars_vertex:pAt,batching_vertex:_At,begin_vertex:hAt,beginnormal_vertex:fAt,bsdfs:mAt,iridescence_fragment:gAt,bumpmap_pars_fragment:bAt,clipping_planes_fragment:EAt,clipping_planes_pars_fragment:yAt,clipping_planes_pars_vertex:vAt,clipping_planes_vertex:SAt,color_fragment:TAt,color_pars_fragment:xAt,color_pars_vertex:CAt,color_vertex:wAt,common:RAt,cube_uv_reflection_fragment:AAt,defaultnormal_vertex:NAt,displacementmap_pars_vertex:OAt,displacementmap_vertex:IAt,emissivemap_fragment:MAt,emissivemap_pars_fragment:DAt,colorspace_fragment:kAt,colorspace_pars_fragment:LAt,envmap_fragment:PAt,envmap_common_pars_fragment:UAt,envmap_pars_fragment:FAt,envmap_pars_vertex:BAt,envmap_physical_pars_fragment:XAt,envmap_vertex:GAt,fog_vertex:VAt,fog_pars_vertex:zAt,fog_fragment:HAt,fog_pars_fragment:qAt,gradientmap_pars_fragment:YAt,lightmap_fragment:$At,lightmap_pars_fragment:WAt,lights_lambert_fragment:KAt,lights_lambert_pars_fragment:jAt,lights_pars_begin:QAt,lights_toon_fragment:ZAt,lights_toon_pars_fragment:JAt,lights_phong_fragment:eNt,lights_phong_pars_fragment:tNt,lights_physical_fragment:nNt,lights_physical_pars_fragment:iNt,lights_fragment_begin:sNt,lights_fragment_maps:rNt,lights_fragment_end:oNt,logdepthbuf_fragment:aNt,logdepthbuf_pars_fragment:lNt,logdepthbuf_pars_vertex:cNt,logdepthbuf_vertex:dNt,map_fragment:uNt,map_pars_fragment:pNt,map_particle_fragment:_Nt,map_particle_pars_fragment:hNt,metalnessmap_fragment:fNt,metalnessmap_pars_fragment:mNt,morphcolor_vertex:gNt,morphnormal_vertex:bNt,morphtarget_pars_vertex:ENt,morphtarget_vertex:yNt,normal_fragment_begin:vNt,normal_fragment_maps:SNt,normal_pars_fragment:TNt,normal_pars_vertex:xNt,normal_vertex:CNt,normalmap_pars_fragment:wNt,clearcoat_normal_fragment_begin:RNt,clearcoat_normal_fragment_maps:ANt,clearcoat_pars_fragment:NNt,iridescence_pars_fragment:ONt,opaque_fragment:INt,packing:MNt,premultiplied_alpha_fragment:DNt,project_vertex:kNt,dithering_fragment:LNt,dithering_pars_fragment:PNt,roughnessmap_fragment:UNt,roughnessmap_pars_fragment:FNt,shadowmap_pars_fragment:BNt,shadowmap_pars_vertex:GNt,shadowmap_vertex:VNt,shadowmask_pars_fragment:zNt,skinbase_vertex:HNt,skinning_pars_vertex:qNt,skinning_vertex:YNt,skinnormal_vertex:$Nt,specularmap_fragment:WNt,specularmap_pars_fragment:KNt,tonemapping_fragment:jNt,tonemapping_pars_fragment:QNt,transmission_fragment:XNt,transmission_pars_fragment:ZNt,uv_pars_fragment:JNt,uv_pars_vertex:eOt,uv_vertex:tOt,worldpos_vertex:nOt,background_vert:iOt,background_frag:sOt,backgroundCube_vert:rOt,backgroundCube_frag:oOt,cube_vert:aOt,cube_frag:lOt,depth_vert:cOt,depth_frag:dOt,distanceRGBA_vert:uOt,distanceRGBA_frag:pOt,equirect_vert:_Ot,equirect_frag:hOt,linedashed_vert:fOt,linedashed_frag:mOt,meshbasic_vert:gOt,meshbasic_frag:bOt,meshlambert_vert:EOt,meshlambert_frag:yOt,meshmatcap_vert:vOt,meshmatcap_frag:SOt,meshnormal_vert:TOt,meshnormal_frag:xOt,meshphong_vert:COt,meshphong_frag:wOt,meshphysical_vert:ROt,meshphysical_frag:AOt,meshtoon_vert:NOt,meshtoon_frag:OOt,points_vert:IOt,points_frag:MOt,shadow_vert:DOt,shadow_frag:kOt,sprite_vert:LOt,sprite_frag:POt},je={common:{diffuse:{value:new gt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new wt},alphaMap:{value:null},alphaMapTransform:{value:new wt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new wt}},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 wt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new wt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new wt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new wt},normalScale:{value:new It(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new wt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new wt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new wt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new wt}},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 wt},alphaTest:{value:0},uvTransform:{value:new wt}},sprite:{diffuse:{value:new gt(16777215)},opacity:{value:1},center:{value:new It(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new wt},alphaMap:{value:null},alphaMapTransform:{value:new wt},alphaTest:{value:0}}},Ji={basic:{uniforms:Vn([je.common,je.specularmap,je.envmap,je.aomap,je.lightmap,je.fog]),vertexShader:Tt.meshbasic_vert,fragmentShader:Tt.meshbasic_frag},lambert:{uniforms:Vn([je.common,je.specularmap,je.envmap,je.aomap,je.lightmap,je.emissivemap,je.bumpmap,je.normalmap,je.displacementmap,je.fog,je.lights,{emissive:{value:new gt(0)}}]),vertexShader:Tt.meshlambert_vert,fragmentShader:Tt.meshlambert_frag},phong:{uniforms:Vn([je.common,je.specularmap,je.envmap,je.aomap,je.lightmap,je.emissivemap,je.bumpmap,je.normalmap,je.displacementmap,je.fog,je.lights,{emissive:{value:new gt(0)},specular:{value:new gt(1118481)},shininess:{value:30}}]),vertexShader:Tt.meshphong_vert,fragmentShader:Tt.meshphong_frag},standard:{uniforms:Vn([je.common,je.envmap,je.aomap,je.lightmap,je.emissivemap,je.bumpmap,je.normalmap,je.displacementmap,je.roughnessmap,je.metalnessmap,je.fog,je.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:Vn([je.common,je.aomap,je.lightmap,je.emissivemap,je.bumpmap,je.normalmap,je.displacementmap,je.gradientmap,je.fog,je.lights,{emissive:{value:new gt(0)}}]),vertexShader:Tt.meshtoon_vert,fragmentShader:Tt.meshtoon_frag},matcap:{uniforms:Vn([je.common,je.bumpmap,je.normalmap,je.displacementmap,je.fog,{matcap:{value:null}}]),vertexShader:Tt.meshmatcap_vert,fragmentShader:Tt.meshmatcap_frag},points:{uniforms:Vn([je.points,je.fog]),vertexShader:Tt.points_vert,fragmentShader:Tt.points_frag},dashed:{uniforms:Vn([je.common,je.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Tt.linedashed_vert,fragmentShader:Tt.linedashed_frag},depth:{uniforms:Vn([je.common,je.displacementmap]),vertexShader:Tt.depth_vert,fragmentShader:Tt.depth_frag},normal:{uniforms:Vn([je.common,je.bumpmap,je.normalmap,je.displacementmap,{opacity:{value:1}}]),vertexShader:Tt.meshnormal_vert,fragmentShader:Tt.meshnormal_frag},sprite:{uniforms:Vn([je.sprite,je.fog]),vertexShader:Tt.sprite_vert,fragmentShader:Tt.sprite_frag},background:{uniforms:{uvTransform:{value:new wt},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:Vn([je.common,je.displacementmap,{referencePosition:{value:new _e},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Tt.distanceRGBA_vert,fragmentShader:Tt.distanceRGBA_frag},shadow:{uniforms:Vn([je.lights,je.fog,{color:{value:new gt(0)},opacity:{value:1}}]),vertexShader:Tt.shadow_vert,fragmentShader:Tt.shadow_frag}};Ji.physical={uniforms:Vn([Ji.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new wt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new wt},clearcoatNormalScale:{value:new It(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new wt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new wt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new wt},sheen:{value:0},sheenColor:{value:new gt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new wt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new wt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new wt},transmissionSamplerSize:{value:new It},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new wt},attenuationDistance:{value:0},attenuationColor:{value:new gt(0)},specularColor:{value:new gt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new wt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new wt},anisotropyVector:{value:new It},anisotropyMap:{value:null},anisotropyMapTransform:{value:new wt}}]),vertexShader:Tt.meshphysical_vert,fragmentShader:Tt.meshphysical_frag};const md={r:0,b:0,g:0};function UOt(n,e,t,i,s,r,o){const a=new gt(0);let l=r===!0?0:1,u,d,h=null,f=0,_=null;function m(b,g){let y=!1,v=g.isScene===!0?g.background:null;v&&v.isTexture&&(v=(g.backgroundBlurriness>0?t:e).get(v)),v===null?E(a,l):v&&v.isColor&&(E(v,1),y=!0);const S=n.xr.getEnvironmentBlendMode();S==="additive"?i.buffers.color.setClear(0,0,0,1,o):S==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||y)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),v&&(v.isCubeTexture||v.mapping===cp)?(d===void 0&&(d=new Hn(new Cr(1,1,1),new go({name:"BackgroundCubeMaterial",uniforms:Na(Ji.backgroundCube.uniforms),vertexShader:Ji.backgroundCube.vertexShader,fragmentShader:Ji.backgroundCube.fragmentShader,side:Zn,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(C,T,O){this.matrixWorld.copyPosition(O.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(d)),d.material.uniforms.envMap.value=v,d.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,d.material.toneMapped=Gt.getTransfer(v.colorSpace)!==Zt,(h!==v||f!==v.version||_!==n.toneMapping)&&(d.material.needsUpdate=!0,h=v,f=v.version,_=n.toneMapping),d.layers.enableAll(),b.unshift(d,d.geometry,d.material,0,0,null)):v&&v.isTexture&&(u===void 0&&(u=new Hn(new ty(2,2),new go({name:"BackgroundMaterial",uniforms:Na(Ji.background.uniforms),vertexShader:Ji.background.vertexShader,fragmentShader:Ji.background.fragmentShader,side:Ys,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(u)),u.material.uniforms.t2D.value=v,u.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,u.material.toneMapped=Gt.getTransfer(v.colorSpace)!==Zt,v.matrixAutoUpdate===!0&&v.updateMatrix(),u.material.uniforms.uvTransform.value.copy(v.matrix),(h!==v||f!==v.version||_!==n.toneMapping)&&(u.material.needsUpdate=!0,h=v,f=v.version,_=n.toneMapping),u.layers.enableAll(),b.unshift(u,u.geometry,u.material,0,0,null))}function E(b,g){b.getRGB(md,cI(n)),i.buffers.color.setClear(md.r,md.g,md.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:m}}function FOt(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 u=l,d=!1;function h(L,$,H,U,Q){let J=!1;if(o){const j=E(U,H,$);u!==j&&(u=j,_(u.object)),J=g(L,U,H,Q),J&&y(L,U,H,Q)}else{const j=$.wireframe===!0;(u.geometry!==U.id||u.program!==H.id||u.wireframe!==j)&&(u.geometry=U.id,u.program=H.id,u.wireframe=j,J=!0)}Q!==null&&t.update(Q,n.ELEMENT_ARRAY_BUFFER),(J||d)&&(d=!1,k(L,$,H,U),Q!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(Q).buffer))}function f(){return i.isWebGL2?n.createVertexArray():r.createVertexArrayOES()}function _(L){return i.isWebGL2?n.bindVertexArray(L):r.bindVertexArrayOES(L)}function m(L){return i.isWebGL2?n.deleteVertexArray(L):r.deleteVertexArrayOES(L)}function E(L,$,H){const U=H.wireframe===!0;let Q=a[L.id];Q===void 0&&(Q={},a[L.id]=Q);let J=Q[$.id];J===void 0&&(J={},Q[$.id]=J);let j=J[U];return j===void 0&&(j=b(f()),J[U]=j),j}function b(L){const $=[],H=[],U=[];for(let Q=0;Q=0){const Ee=Q[ve];let xe=J[ve];if(xe===void 0&&(ve==="instanceMatrix"&&L.instanceMatrix&&(xe=L.instanceMatrix),ve==="instanceColor"&&L.instanceColor&&(xe=L.instanceColor)),Ee===void 0||Ee.attribute!==xe||xe&&Ee.data!==xe.data)return!0;j++}return u.attributesNum!==j||u.index!==U}function y(L,$,H,U){const Q={},J=$.attributes;let j=0;const ae=H.getAttributes();for(const ve in ae)if(ae[ve].location>=0){let Ee=J[ve];Ee===void 0&&(ve==="instanceMatrix"&&L.instanceMatrix&&(Ee=L.instanceMatrix),ve==="instanceColor"&&L.instanceColor&&(Ee=L.instanceColor));const xe={};xe.attribute=Ee,Ee&&Ee.data&&(xe.data=Ee.data),Q[ve]=xe,j++}u.attributes=Q,u.attributesNum=j,u.index=U}function v(){const L=u.newAttributes;for(let $=0,H=L.length;$=0){let ee=Q[ae];if(ee===void 0&&(ae==="instanceMatrix"&&L.instanceMatrix&&(ee=L.instanceMatrix),ae==="instanceColor"&&L.instanceColor&&(ee=L.instanceColor)),ee!==void 0){const Ee=ee.normalized,xe=ee.itemSize,Me=t.get(ee);if(Me===void 0)continue;const Z=Me.buffer,ye=Me.type,fe=Me.bytesPerElement,Ne=i.isWebGL2===!0&&(ye===n.INT||ye===n.UNSIGNED_INT||ee.gpuType===YO);if(ee.isInterleavedBufferAttribute){const Le=ee.data,D=Le.stride,q=ee.offset;if(Le.isInstancedInterleavedBuffer){for(let K=0;K0&&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 u=o||e.has("WEBGL_draw_buffers"),d=t.logarithmicDepthBuffer===!0,h=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),f=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=n.getParameter(n.MAX_TEXTURE_SIZE),m=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),y=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),v=f>0,S=o||e.has("OES_texture_float"),C=v&&S,T=o?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:u,getMaxAnisotropy:s,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:d,maxTextures:h,maxVertexTextures:f,maxTextureSize:_,maxCubemapSize:m,maxAttributes:E,maxVertexUniforms:b,maxVaryings:g,maxFragmentUniforms:y,vertexTextures:v,floatFragmentTextures:S,floatVertexTextures:C,maxSamples:T}}function VOt(n){const e=this;let t=null,i=0,s=!1,r=!1;const o=new Yr,a=new wt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){const _=h.length!==0||f||i!==0||s;return s=f,i=h.length,_},this.beginShadows=function(){r=!0,d(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(h,f){t=d(h,f,0)},this.setState=function(h,f,_){const m=h.clippingPlanes,E=h.clipIntersection,b=h.clipShadows,g=n.get(h);if(!s||m===null||m.length===0||r&&!b)r?d(null):u();else{const y=r?0:i,v=y*4;let S=g.clippingState||null;l.value=S,S=d(m,f,v,_);for(let C=0;C!==v;++C)S[C]=t[C];g.clippingState=S,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=y}};function u(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function d(h,f,_,m){const E=h!==null?h.length:0;let b=null;if(E!==0){if(b=l.value,m!==!0||b===null){const g=_+E*4,y=f.matrixWorldInverse;a.getNormalMatrix(y),(b===null||b.length0){const u=new eAt(l.height/2);return u.fromEquirectangularTexture(n,o),e.set(o,u),o.addEventListener("dispose",s),t(u.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 ny extends dI{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 u=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=u*this.view.offsetX,o=r+u*this.view.width,a-=d*this.view.offsetY,l=a-d*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,z1=[.125,.215,.35,.446,.526,.582],Zr=20,og=new ny,H1=new gt;let ag=null,lg=0,cg=0;const $r=(1+Math.sqrt(5))/2,Yo=1/$r,q1=[new _e(1,1,1),new _e(-1,1,1),new _e(1,1,-1),new _e(-1,1,-1),new _e(0,$r,Yo),new _e(0,$r,-Yo),new _e(Yo,0,$r),new _e(-Yo,0,$r),new _e($r,Yo,0),new _e(-$r,Yo,0)];class Y1{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){ag=this._renderer.getRenderTarget(),lg=this._renderer.getActiveCubeFace(),cg=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=K1(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=W1(),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?v:0,v,v),d.setRenderTarget(s),E&&d.render(m,a),d.render(e,a)}m.geometry.dispose(),m.material.dispose(),d.toneMapping=f,d.autoClear=h,e.background=b}_textureToCubeUV(e,t){const i=this._renderer,s=e.mapping===Ta||e.mapping===xa;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=K1()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=W1());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;gd(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,og)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let s=1;sZr&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${Zr}`);const g=[];let y=0;for(let O=0;Ov-Xo?s-v+Xo:0),T=4*(this._cubeSize-S);gd(t,C,T,3*S,2*S),l.setRenderTarget(t),l.render(h,og)}}function HOt(n){const e=[],t=[],i=[];let s=n;const r=n-Xo+1+z1.length;for(let o=0;on-Xo?l=z1[o-n+Xo-1]:o===0&&(l=0),i.push(l);const u=1/(a-2),d=-u,h=1+u,f=[d,d,h,d,h,h,d,d,h,h,d,h],_=6,m=6,E=3,b=2,g=1,y=new Float32Array(E*m*_),v=new Float32Array(b*m*_),S=new Float32Array(g*m*_);for(let T=0;T<_;T++){const O=T%3*2/3-1,k=T>2?0:-1,x=[O,k,0,O+2/3,k,0,O+2/3,k+1,0,O,k,0,O+2/3,k+1,0,O,k+1,0];y.set(x,E*m*T),v.set(f,b*m*T);const I=[T,T,T,T,T,T];S.set(I,g*m*T)}const C=new ms;C.setAttribute("position",new Yn(y,E)),C.setAttribute("uv",new Yn(v,b)),C.setAttribute("faceIndex",new Yn(S,g)),e.push(C),s>Xo&&s--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function $1(n,e,t){const i=new mo(n,e,t);return i.texture.mapping=cp,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function gd(n,e,t,i,s){n.viewport.set(e,t,i,s),n.scissor.set(e,t,i,s)}function qOt(n,e,t){const i=new Float32Array(Zr),s=new _e(0,1,0);return new go({name:"SphericalGaussianBlur",defines:{n:Zr,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:iy(),fragmentShader:` precision mediump float; precision mediump int; @@ -3846,26 +3846,26 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function $Ot(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,u=l===ab||l===lb,d=l===Ta||l===xa;if(u||d)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return t===null&&(t=new Y1(n)),h=u?t.fromEquirectangular(a,h):t.fromCubemap(a,h),e.set(a,h),h.texture}else{if(e.has(a))return e.get(a).texture;{const h=a.image;if(u&&h&&h.height>0||d&&h&&s(h)){t===null&&(t=new Y1(n));const f=u?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 u=6;for(let d=0;de.maxTextureSize&&(F=Math.ceil(I/e.maxTextureSize),I=e.maxTextureSize);const B=new Float32Array(I*F*4*E),ne=new sI(B,I,F,E);ne.type=Ps,ne.needsUpdate=!0;const L=x*4;for(let H=0;H0)return n;const s=e*t;let r=j1[s];if(r===void 0&&(r=new Float32Array(s),j1[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 mn(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t0||d&&h&&s(h)){t===null&&(t=new Y1(n));const f=u?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 u=6;for(let d=0;de.maxTextureSize&&(F=Math.ceil(I/e.maxTextureSize),I=e.maxTextureSize);const B=new Float32Array(I*F*4*E),ne=new sI(B,I,F,E);ne.type=Ps,ne.needsUpdate=!0;const L=x*4;for(let H=0;H0)return n;const s=e*t;let r=j1[s];if(r===void 0&&(r=new Float32Array(s),j1[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 mn(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${a}: ${t[o]}`)}return i.join(` -`)}function KIt(n){const e=Gt.getPrimaries(Gt.workingColorSpace),t=Gt.getPrimaries(n);let i;switch(e===t?i="":e===gu&&t===mu?i="LinearDisplayP3ToLinearSRGB":e===mu&&t===gu&&(i="LinearSRGBToLinearDisplayP3"),n){case On:case dp:return[i,"LinearTransferOETF"];case on:case ZE:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function nw(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 WIt(n){const e=Gt.getPrimaries(Gt.workingColorSpace),t=Gt.getPrimaries(n);let i;switch(e===t?i="":e===gu&&t===mu?i="LinearDisplayP3ToLinearSRGB":e===mu&&t===gu&&(i="LinearSRGBToLinearDisplayP3"),n){case On:case dp:return[i,"LinearTransferOETF"];case on:case ZE:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function nw(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+` -`+WIt(n.getShaderSource(e),o)}else return s}function jIt(n,e){const t=KIt(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function QIt(n,e){let t;switch(e){case $wt:t="Linear";break;case Wwt:t="Reinhard";break;case Kwt:t="OptimizedCineon";break;case jwt:t="ACESFilmic";break;case Qwt:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function XIt(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(Rl).join(` -`)}function ZIt(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` -`)}function JIt(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let s=0;s/gm;function hb(n){return n.replace(eMt,nMt)}const tMt=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function nMt(n,e){let t=Tt[e];if(t===void 0){const i=tMt.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 hb(t)}const iMt=/#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 rw(n){return n.replace(iMt,sMt)}function sMt(n,e,t,i){let s="";for(let r=parseInt(e);r/gm;function hb(n){return n.replace(JIt,tMt)}const eMt=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function tMt(n,e){let t=Tt[e];if(t===void 0){const i=eMt.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 hb(t)}const nMt=/#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 rw(n){return n.replace(nMt,iMt)}function iMt(n,e,t,i){let s="";for(let r=parseInt(e);r0&&(b+=` `),g=[_,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(Rl).join(` `),g.length>0&&(g+=` `)):(b=[ow(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,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 "+d:"",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(Rl).join(` -`),g=[_,ow(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,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 "+u:"",t.envMap?"#define "+d:"",t.envMap?"#define "+h:"",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?QIt("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Tt.colorspace_pars_fragment,jIt("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`),g=[_,ow(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,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 "+u:"",t.envMap?"#define "+d:"",t.envMap?"#define "+h:"",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?jIt("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Tt.colorspace_pars_fragment,KIt("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `].filter(Rl).join(` `)),o=hb(o),o=iw(o,t),o=sw(o,t),a=hb(a),a=iw(a,t),a=sw(a,t),o=rw(o),a=rw(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(y=`#version 300 es `,b=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` @@ -3876,9 +3876,9 @@ precision `+n.precision+" int;";return n.precision==="highp"?e+=` Program Info Log: `+B+` `+U+` -`+Q)}else B!==""?console.warn("THREE.WebGLProgram: Program Info Log:",B):(ne===""||L==="")&&(H=!1);H&&(F.diagnostics={runnable:$,programLog:B,vertexShader:{log:ne,prefix:b},fragmentShader:{log:L,prefix:g}})}s.deleteShader(C),s.deleteShader(T),k=new Gd(s,E),x=JIt(s,E)}let k;this.getUniforms=function(){return k===void 0&&O(this),k};let x;this.getAttributes=function(){return x===void 0&&O(this),x};let I=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return I===!1&&(I=s.getProgramParameter(E,YIt)),I},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=$It++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=C,this.fragmentShader=T,this}let uMt=0;class pMt{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 _Mt(e),t.set(e,i)),i}}class _Mt{constructor(e){this.id=uMt++,this.code=e,this.usedTimes=0}}function hMt(n,e,t,i,s,r,o){const a=new rI,l=new pMt,u=[],d=s.isWebGL2,h=s.logarithmicDepthBuffer,f=s.vertexTextures;let _=s.precision;const m={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(x){return x===0?"uv":`uv${x}`}function b(x,I,F,B,ne){const L=B.fog,$=ne.geometry,H=x.isMeshStandardMaterial?B.environment:null,U=(x.isMeshStandardMaterial?t:e).get(x.envMap||H),Q=U&&U.mapping===cp?U.image.height:null,J=m[x.type];x.precision!==null&&(_=s.getMaxPrecision(x.precision),_!==x.precision&&console.warn("THREE.WebGLProgram.getParameters:",x.precision,"not supported, using",_,"instead."));const j=$.morphAttributes.position||$.morphAttributes.normal||$.morphAttributes.color,ae=j!==void 0?j.length:0;let ve=0;$.morphAttributes.position!==void 0&&(ve=1),$.morphAttributes.normal!==void 0&&(ve=2),$.morphAttributes.color!==void 0&&(ve=3);let ee,Ee,xe,Me;if(J){const cn=Ji[J];ee=cn.vertexShader,Ee=cn.fragmentShader}else ee=x.vertexShader,Ee=x.fragmentShader,l.update(x),xe=l.getVertexShaderID(x),Me=l.getFragmentShaderID(x);const Z=n.getRenderTarget(),ye=ne.isInstancedMesh===!0,fe=ne.isBatchedMesh===!0,Ne=!!x.map,Le=!!x.matcap,D=!!U,q=!!x.aoMap,K=!!x.lightMap,de=!!x.bumpMap,le=!!x.normalMap,Re=!!x.displacementMap,Ie=!!x.emissiveMap,z=!!x.metalnessMap,pe=!!x.roughnessMap,re=x.anisotropy>0,ce=x.clearcoat>0,M=x.iridescence>0,N=x.sheen>0,W=x.transmission>0,ue=re&&!!x.anisotropyMap,X=ce&&!!x.clearcoatMap,ie=ce&&!!x.clearcoatNormalMap,Ae=ce&&!!x.clearcoatRoughnessMap,Ce=M&&!!x.iridescenceMap,ke=M&&!!x.iridescenceThicknessMap,Qe=N&&!!x.sheenColorMap,ct=N&&!!x.sheenRoughnessMap,Pe=!!x.specularMap,ut=!!x.specularColorMap,Ze=!!x.specularIntensityMap,qe=W&&!!x.transmissionMap,tt=W&&!!x.thicknessMap,Fe=!!x.gradientMap,pt=!!x.alphaMap,oe=x.alphaTest>0,Ke=!!x.alphaHash,Ue=!!x.extensions,Oe=!!$.attributes.uv1,Be=!!$.attributes.uv2,dt=!!$.attributes.uv3;let Et=Tr;return x.toneMapped&&(Z===null||Z.isXRRenderTarget===!0)&&(Et=n.toneMapping),{isWebGL2:d,shaderID:J,shaderType:x.type,shaderName:x.name,vertexShader:ee,fragmentShader:Ee,defines:x.defines,customVertexShaderID:xe,customFragmentShaderID:Me,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:_,batching:fe,instancing:ye,instancingColor:ye&&ne.instanceColor!==null,supportsVertexTextures:f,outputColorSpace:Z===null?n.outputColorSpace:Z.isXRRenderTarget===!0?Z.texture.colorSpace:On,map:Ne,matcap:Le,envMap:D,envMapMode:D&&U.mapping,envMapCubeUVHeight:Q,aoMap:q,lightMap:K,bumpMap:de,normalMap:le,displacementMap:f&&Re,emissiveMap:Ie,normalMapObjectSpace:le&&x.normalMapType===dRt,normalMapTangentSpace:le&&x.normalMapType===XE,metalnessMap:z,roughnessMap:pe,anisotropy:re,anisotropyMap:ue,clearcoat:ce,clearcoatMap:X,clearcoatNormalMap:ie,clearcoatRoughnessMap:Ae,iridescence:M,iridescenceMap:Ce,iridescenceThicknessMap:ke,sheen:N,sheenColorMap:Qe,sheenRoughnessMap:ct,specularMap:Pe,specularColorMap:ut,specularIntensityMap:Ze,transmission:W,transmissionMap:qe,thicknessMap:tt,gradientMap:Fe,opaque:x.transparent===!1&&x.blending===aa,alphaMap:pt,alphaTest:oe,alphaHash:Ke,combine:x.combine,mapUv:Ne&&E(x.map.channel),aoMapUv:q&&E(x.aoMap.channel),lightMapUv:K&&E(x.lightMap.channel),bumpMapUv:de&&E(x.bumpMap.channel),normalMapUv:le&&E(x.normalMap.channel),displacementMapUv:Re&&E(x.displacementMap.channel),emissiveMapUv:Ie&&E(x.emissiveMap.channel),metalnessMapUv:z&&E(x.metalnessMap.channel),roughnessMapUv:pe&&E(x.roughnessMap.channel),anisotropyMapUv:ue&&E(x.anisotropyMap.channel),clearcoatMapUv:X&&E(x.clearcoatMap.channel),clearcoatNormalMapUv:ie&&E(x.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ae&&E(x.clearcoatRoughnessMap.channel),iridescenceMapUv:Ce&&E(x.iridescenceMap.channel),iridescenceThicknessMapUv:ke&&E(x.iridescenceThicknessMap.channel),sheenColorMapUv:Qe&&E(x.sheenColorMap.channel),sheenRoughnessMapUv:ct&&E(x.sheenRoughnessMap.channel),specularMapUv:Pe&&E(x.specularMap.channel),specularColorMapUv:ut&&E(x.specularColorMap.channel),specularIntensityMapUv:Ze&&E(x.specularIntensityMap.channel),transmissionMapUv:qe&&E(x.transmissionMap.channel),thicknessMapUv:tt&&E(x.thicknessMap.channel),alphaMapUv:pt&&E(x.alphaMap.channel),vertexTangents:!!$.attributes.tangent&&(le||re),vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!$.attributes.color&&$.attributes.color.itemSize===4,vertexUv1s:Oe,vertexUv2s:Be,vertexUv3s:dt,pointsUvs:ne.isPoints===!0&&!!$.attributes.uv&&(Ne||pt),fog:!!L,useFog:x.fog===!0,fogExp2:L&&L.isFogExp2,flatShading:x.flatShading===!0,sizeAttenuation:x.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:ne.isSkinnedMesh===!0,morphTargets:$.morphAttributes.position!==void 0,morphNormals:$.morphAttributes.normal!==void 0,morphColors:$.morphAttributes.color!==void 0,morphTargetsCount:ae,morphTextureStride:ve,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numLightProbes:I.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:x.dithering,shadowMapEnabled:n.shadowMap.enabled&&F.length>0,shadowMapType:n.shadowMap.type,toneMapping:Et,useLegacyLights:n._useLegacyLights,decodeVideoTexture:Ne&&x.map.isVideoTexture===!0&&Gt.getTransfer(x.map.colorSpace)===Zt,premultipliedAlpha:x.premultipliedAlpha,doubleSided:x.side===ts,flipSided:x.side===Zn,useDepthPacking:x.depthPacking>=0,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionDerivatives:Ue&&x.extensions.derivatives===!0,extensionFragDepth:Ue&&x.extensions.fragDepth===!0,extensionDrawBuffers:Ue&&x.extensions.drawBuffers===!0,extensionShaderTextureLOD:Ue&&x.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:d||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:d||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:d||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:x.customProgramCacheKey()}}function g(x){const I=[];if(x.shaderID?I.push(x.shaderID):(I.push(x.customVertexShaderID),I.push(x.customFragmentShaderID)),x.defines!==void 0)for(const F in x.defines)I.push(F),I.push(x.defines[F]);return x.isRawShaderMaterial===!1&&(y(I,x),v(I,x),I.push(n.outputColorSpace)),I.push(x.customProgramCacheKey),I.join()}function y(x,I){x.push(I.precision),x.push(I.outputColorSpace),x.push(I.envMapMode),x.push(I.envMapCubeUVHeight),x.push(I.mapUv),x.push(I.alphaMapUv),x.push(I.lightMapUv),x.push(I.aoMapUv),x.push(I.bumpMapUv),x.push(I.normalMapUv),x.push(I.displacementMapUv),x.push(I.emissiveMapUv),x.push(I.metalnessMapUv),x.push(I.roughnessMapUv),x.push(I.anisotropyMapUv),x.push(I.clearcoatMapUv),x.push(I.clearcoatNormalMapUv),x.push(I.clearcoatRoughnessMapUv),x.push(I.iridescenceMapUv),x.push(I.iridescenceThicknessMapUv),x.push(I.sheenColorMapUv),x.push(I.sheenRoughnessMapUv),x.push(I.specularMapUv),x.push(I.specularColorMapUv),x.push(I.specularIntensityMapUv),x.push(I.transmissionMapUv),x.push(I.thicknessMapUv),x.push(I.combine),x.push(I.fogExp2),x.push(I.sizeAttenuation),x.push(I.morphTargetsCount),x.push(I.morphAttributeCount),x.push(I.numDirLights),x.push(I.numPointLights),x.push(I.numSpotLights),x.push(I.numSpotLightMaps),x.push(I.numHemiLights),x.push(I.numRectAreaLights),x.push(I.numDirLightShadows),x.push(I.numPointLightShadows),x.push(I.numSpotLightShadows),x.push(I.numSpotLightShadowsWithMaps),x.push(I.numLightProbes),x.push(I.shadowMapType),x.push(I.toneMapping),x.push(I.numClippingPlanes),x.push(I.numClipIntersection),x.push(I.depthPacking)}function v(x,I){a.disableAll(),I.isWebGL2&&a.enable(0),I.supportsVertexTextures&&a.enable(1),I.instancing&&a.enable(2),I.instancingColor&&a.enable(3),I.matcap&&a.enable(4),I.envMap&&a.enable(5),I.normalMapObjectSpace&&a.enable(6),I.normalMapTangentSpace&&a.enable(7),I.clearcoat&&a.enable(8),I.iridescence&&a.enable(9),I.alphaTest&&a.enable(10),I.vertexColors&&a.enable(11),I.vertexAlphas&&a.enable(12),I.vertexUv1s&&a.enable(13),I.vertexUv2s&&a.enable(14),I.vertexUv3s&&a.enable(15),I.vertexTangents&&a.enable(16),I.anisotropy&&a.enable(17),I.alphaHash&&a.enable(18),I.batching&&a.enable(19),x.push(a.mask),a.disableAll(),I.fog&&a.enable(0),I.useFog&&a.enable(1),I.flatShading&&a.enable(2),I.logarithmicDepthBuffer&&a.enable(3),I.skinning&&a.enable(4),I.morphTargets&&a.enable(5),I.morphNormals&&a.enable(6),I.morphColors&&a.enable(7),I.premultipliedAlpha&&a.enable(8),I.shadowMapEnabled&&a.enable(9),I.useLegacyLights&&a.enable(10),I.doubleSided&&a.enable(11),I.flipSided&&a.enable(12),I.useDepthPacking&&a.enable(13),I.dithering&&a.enable(14),I.transmission&&a.enable(15),I.sheen&&a.enable(16),I.opaque&&a.enable(17),I.pointsUvs&&a.enable(18),I.decodeVideoTexture&&a.enable(19),x.push(a.mask)}function S(x){const I=m[x.type];let F;if(I){const B=Ji[I];F=XRt.clone(B.uniforms)}else F=x.uniforms;return F}function C(x,I){let F;for(let B=0,ne=u.length;B0?i.push(g):_.transparent===!0?s.push(g):t.push(g)}function l(h,f,_,m,E,b){const g=o(h,f,_,m,E,b);_.transmission>0?i.unshift(g):_.transparent===!0?s.unshift(g):t.unshift(g)}function u(h,f){t.length>1&&t.sort(h||mMt),i.length>1&&i.sort(f||aw),s.length>1&&s.sort(f||aw)}function d(){for(let h=e,f=n.length;h=r.length?(o=new lw,r.push(o)):o=r[s],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function bMt(){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 _e,color:new gt};break;case"SpotLight":t={position:new _e,direction:new _e,color:new gt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new _e,color:new gt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new _e,skyColor:new gt,groundColor:new gt};break;case"RectAreaLight":t={color:new gt,position:new _e,halfWidth:new _e,halfHeight:new _e};break}return n[e.id]=t,t}}}function EMt(){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 It};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new It};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new It,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let yMt=0;function vMt(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function SMt(n,e){const t=new bMt,i=EMt(),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 d=0;d<9;d++)s.probe.push(new _e);const r=new _e,o=new Rt,a=new Rt;function l(d,h){let f=0,_=0,m=0;for(let B=0;B<9;B++)s.probe[B].set(0,0,0);let E=0,b=0,g=0,y=0,v=0,S=0,C=0,T=0,O=0,k=0,x=0;d.sort(vMt);const I=h===!0?Math.PI:1;for(let B=0,ne=d.length;B0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=je.LTC_FLOAT_1,s.rectAreaLTC2=je.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(s.rectAreaLTC1=je.LTC_HALF_1,s.rectAreaLTC2=je.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),s.ambient[0]=f,s.ambient[1]=_,s.ambient[2]=m;const F=s.hash;(F.directionalLength!==E||F.pointLength!==b||F.spotLength!==g||F.rectAreaLength!==y||F.hemiLength!==v||F.numDirectionalShadows!==S||F.numPointShadows!==C||F.numSpotShadows!==T||F.numSpotMaps!==O||F.numLightProbes!==x)&&(s.directional.length=E,s.spot.length=g,s.rectArea.length=y,s.point.length=b,s.hemi.length=v,s.directionalShadow.length=S,s.directionalShadowMap.length=S,s.pointShadow.length=C,s.pointShadowMap.length=C,s.spotShadow.length=T,s.spotShadowMap.length=T,s.directionalShadowMatrix.length=S,s.pointShadowMatrix.length=C,s.spotLightMatrix.length=T+O-k,s.spotLightMap.length=O,s.numSpotLightShadowsWithMaps=k,s.numLightProbes=x,F.directionalLength=E,F.pointLength=b,F.spotLength=g,F.rectAreaLength=y,F.hemiLength=v,F.numDirectionalShadows=S,F.numPointShadows=C,F.numSpotShadows=T,F.numSpotMaps=O,F.numLightProbes=x,s.version=yMt++)}function u(d,h){let f=0,_=0,m=0,E=0,b=0;const g=h.matrixWorldInverse;for(let y=0,v=d.length;y=a.length?(l=new cw(n,e),a.push(l)):l=a[o],l}function s(){t=new WeakMap}return{get:i,dispose:s}}class xMt extends Hi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=lRt,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 CMt extends Hi{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 wMt=`void main() { +`+Q)}else B!==""?console.warn("THREE.WebGLProgram: Program Info Log:",B):(ne===""||L==="")&&(H=!1);H&&(F.diagnostics={runnable:$,programLog:B,vertexShader:{log:ne,prefix:b},fragmentShader:{log:L,prefix:g}})}s.deleteShader(C),s.deleteShader(T),k=new Gd(s,E),x=ZIt(s,E)}let k;this.getUniforms=function(){return k===void 0&&O(this),k};let x;this.getAttributes=function(){return x===void 0&&O(this),x};let I=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return I===!1&&(I=s.getProgramParameter(E,qIt)),I},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=YIt++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=C,this.fragmentShader=T,this}let dMt=0;class uMt{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 pMt(e),t.set(e,i)),i}}class pMt{constructor(e){this.id=dMt++,this.code=e,this.usedTimes=0}}function _Mt(n,e,t,i,s,r,o){const a=new rI,l=new uMt,u=[],d=s.isWebGL2,h=s.logarithmicDepthBuffer,f=s.vertexTextures;let _=s.precision;const m={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(x){return x===0?"uv":`uv${x}`}function b(x,I,F,B,ne){const L=B.fog,$=ne.geometry,H=x.isMeshStandardMaterial?B.environment:null,U=(x.isMeshStandardMaterial?t:e).get(x.envMap||H),Q=U&&U.mapping===cp?U.image.height:null,J=m[x.type];x.precision!==null&&(_=s.getMaxPrecision(x.precision),_!==x.precision&&console.warn("THREE.WebGLProgram.getParameters:",x.precision,"not supported, using",_,"instead."));const j=$.morphAttributes.position||$.morphAttributes.normal||$.morphAttributes.color,ae=j!==void 0?j.length:0;let ve=0;$.morphAttributes.position!==void 0&&(ve=1),$.morphAttributes.normal!==void 0&&(ve=2),$.morphAttributes.color!==void 0&&(ve=3);let ee,Ee,xe,Me;if(J){const cn=Ji[J];ee=cn.vertexShader,Ee=cn.fragmentShader}else ee=x.vertexShader,Ee=x.fragmentShader,l.update(x),xe=l.getVertexShaderID(x),Me=l.getFragmentShaderID(x);const Z=n.getRenderTarget(),ye=ne.isInstancedMesh===!0,fe=ne.isBatchedMesh===!0,Ne=!!x.map,Le=!!x.matcap,D=!!U,q=!!x.aoMap,K=!!x.lightMap,de=!!x.bumpMap,le=!!x.normalMap,Re=!!x.displacementMap,Ie=!!x.emissiveMap,z=!!x.metalnessMap,pe=!!x.roughnessMap,re=x.anisotropy>0,ce=x.clearcoat>0,M=x.iridescence>0,N=x.sheen>0,W=x.transmission>0,ue=re&&!!x.anisotropyMap,X=ce&&!!x.clearcoatMap,ie=ce&&!!x.clearcoatNormalMap,Ae=ce&&!!x.clearcoatRoughnessMap,Ce=M&&!!x.iridescenceMap,ke=M&&!!x.iridescenceThicknessMap,Qe=N&&!!x.sheenColorMap,ct=N&&!!x.sheenRoughnessMap,Pe=!!x.specularMap,ut=!!x.specularColorMap,Ze=!!x.specularIntensityMap,qe=W&&!!x.transmissionMap,tt=W&&!!x.thicknessMap,Fe=!!x.gradientMap,pt=!!x.alphaMap,oe=x.alphaTest>0,Ke=!!x.alphaHash,Ue=!!x.extensions,Oe=!!$.attributes.uv1,Be=!!$.attributes.uv2,dt=!!$.attributes.uv3;let Et=Tr;return x.toneMapped&&(Z===null||Z.isXRRenderTarget===!0)&&(Et=n.toneMapping),{isWebGL2:d,shaderID:J,shaderType:x.type,shaderName:x.name,vertexShader:ee,fragmentShader:Ee,defines:x.defines,customVertexShaderID:xe,customFragmentShaderID:Me,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:_,batching:fe,instancing:ye,instancingColor:ye&&ne.instanceColor!==null,supportsVertexTextures:f,outputColorSpace:Z===null?n.outputColorSpace:Z.isXRRenderTarget===!0?Z.texture.colorSpace:On,map:Ne,matcap:Le,envMap:D,envMapMode:D&&U.mapping,envMapCubeUVHeight:Q,aoMap:q,lightMap:K,bumpMap:de,normalMap:le,displacementMap:f&&Re,emissiveMap:Ie,normalMapObjectSpace:le&&x.normalMapType===cRt,normalMapTangentSpace:le&&x.normalMapType===XE,metalnessMap:z,roughnessMap:pe,anisotropy:re,anisotropyMap:ue,clearcoat:ce,clearcoatMap:X,clearcoatNormalMap:ie,clearcoatRoughnessMap:Ae,iridescence:M,iridescenceMap:Ce,iridescenceThicknessMap:ke,sheen:N,sheenColorMap:Qe,sheenRoughnessMap:ct,specularMap:Pe,specularColorMap:ut,specularIntensityMap:Ze,transmission:W,transmissionMap:qe,thicknessMap:tt,gradientMap:Fe,opaque:x.transparent===!1&&x.blending===aa,alphaMap:pt,alphaTest:oe,alphaHash:Ke,combine:x.combine,mapUv:Ne&&E(x.map.channel),aoMapUv:q&&E(x.aoMap.channel),lightMapUv:K&&E(x.lightMap.channel),bumpMapUv:de&&E(x.bumpMap.channel),normalMapUv:le&&E(x.normalMap.channel),displacementMapUv:Re&&E(x.displacementMap.channel),emissiveMapUv:Ie&&E(x.emissiveMap.channel),metalnessMapUv:z&&E(x.metalnessMap.channel),roughnessMapUv:pe&&E(x.roughnessMap.channel),anisotropyMapUv:ue&&E(x.anisotropyMap.channel),clearcoatMapUv:X&&E(x.clearcoatMap.channel),clearcoatNormalMapUv:ie&&E(x.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ae&&E(x.clearcoatRoughnessMap.channel),iridescenceMapUv:Ce&&E(x.iridescenceMap.channel),iridescenceThicknessMapUv:ke&&E(x.iridescenceThicknessMap.channel),sheenColorMapUv:Qe&&E(x.sheenColorMap.channel),sheenRoughnessMapUv:ct&&E(x.sheenRoughnessMap.channel),specularMapUv:Pe&&E(x.specularMap.channel),specularColorMapUv:ut&&E(x.specularColorMap.channel),specularIntensityMapUv:Ze&&E(x.specularIntensityMap.channel),transmissionMapUv:qe&&E(x.transmissionMap.channel),thicknessMapUv:tt&&E(x.thicknessMap.channel),alphaMapUv:pt&&E(x.alphaMap.channel),vertexTangents:!!$.attributes.tangent&&(le||re),vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!$.attributes.color&&$.attributes.color.itemSize===4,vertexUv1s:Oe,vertexUv2s:Be,vertexUv3s:dt,pointsUvs:ne.isPoints===!0&&!!$.attributes.uv&&(Ne||pt),fog:!!L,useFog:x.fog===!0,fogExp2:L&&L.isFogExp2,flatShading:x.flatShading===!0,sizeAttenuation:x.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:ne.isSkinnedMesh===!0,morphTargets:$.morphAttributes.position!==void 0,morphNormals:$.morphAttributes.normal!==void 0,morphColors:$.morphAttributes.color!==void 0,morphTargetsCount:ae,morphTextureStride:ve,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numLightProbes:I.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:x.dithering,shadowMapEnabled:n.shadowMap.enabled&&F.length>0,shadowMapType:n.shadowMap.type,toneMapping:Et,useLegacyLights:n._useLegacyLights,decodeVideoTexture:Ne&&x.map.isVideoTexture===!0&&Gt.getTransfer(x.map.colorSpace)===Zt,premultipliedAlpha:x.premultipliedAlpha,doubleSided:x.side===ts,flipSided:x.side===Zn,useDepthPacking:x.depthPacking>=0,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionDerivatives:Ue&&x.extensions.derivatives===!0,extensionFragDepth:Ue&&x.extensions.fragDepth===!0,extensionDrawBuffers:Ue&&x.extensions.drawBuffers===!0,extensionShaderTextureLOD:Ue&&x.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:d||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:d||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:d||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:x.customProgramCacheKey()}}function g(x){const I=[];if(x.shaderID?I.push(x.shaderID):(I.push(x.customVertexShaderID),I.push(x.customFragmentShaderID)),x.defines!==void 0)for(const F in x.defines)I.push(F),I.push(x.defines[F]);return x.isRawShaderMaterial===!1&&(y(I,x),v(I,x),I.push(n.outputColorSpace)),I.push(x.customProgramCacheKey),I.join()}function y(x,I){x.push(I.precision),x.push(I.outputColorSpace),x.push(I.envMapMode),x.push(I.envMapCubeUVHeight),x.push(I.mapUv),x.push(I.alphaMapUv),x.push(I.lightMapUv),x.push(I.aoMapUv),x.push(I.bumpMapUv),x.push(I.normalMapUv),x.push(I.displacementMapUv),x.push(I.emissiveMapUv),x.push(I.metalnessMapUv),x.push(I.roughnessMapUv),x.push(I.anisotropyMapUv),x.push(I.clearcoatMapUv),x.push(I.clearcoatNormalMapUv),x.push(I.clearcoatRoughnessMapUv),x.push(I.iridescenceMapUv),x.push(I.iridescenceThicknessMapUv),x.push(I.sheenColorMapUv),x.push(I.sheenRoughnessMapUv),x.push(I.specularMapUv),x.push(I.specularColorMapUv),x.push(I.specularIntensityMapUv),x.push(I.transmissionMapUv),x.push(I.thicknessMapUv),x.push(I.combine),x.push(I.fogExp2),x.push(I.sizeAttenuation),x.push(I.morphTargetsCount),x.push(I.morphAttributeCount),x.push(I.numDirLights),x.push(I.numPointLights),x.push(I.numSpotLights),x.push(I.numSpotLightMaps),x.push(I.numHemiLights),x.push(I.numRectAreaLights),x.push(I.numDirLightShadows),x.push(I.numPointLightShadows),x.push(I.numSpotLightShadows),x.push(I.numSpotLightShadowsWithMaps),x.push(I.numLightProbes),x.push(I.shadowMapType),x.push(I.toneMapping),x.push(I.numClippingPlanes),x.push(I.numClipIntersection),x.push(I.depthPacking)}function v(x,I){a.disableAll(),I.isWebGL2&&a.enable(0),I.supportsVertexTextures&&a.enable(1),I.instancing&&a.enable(2),I.instancingColor&&a.enable(3),I.matcap&&a.enable(4),I.envMap&&a.enable(5),I.normalMapObjectSpace&&a.enable(6),I.normalMapTangentSpace&&a.enable(7),I.clearcoat&&a.enable(8),I.iridescence&&a.enable(9),I.alphaTest&&a.enable(10),I.vertexColors&&a.enable(11),I.vertexAlphas&&a.enable(12),I.vertexUv1s&&a.enable(13),I.vertexUv2s&&a.enable(14),I.vertexUv3s&&a.enable(15),I.vertexTangents&&a.enable(16),I.anisotropy&&a.enable(17),I.alphaHash&&a.enable(18),I.batching&&a.enable(19),x.push(a.mask),a.disableAll(),I.fog&&a.enable(0),I.useFog&&a.enable(1),I.flatShading&&a.enable(2),I.logarithmicDepthBuffer&&a.enable(3),I.skinning&&a.enable(4),I.morphTargets&&a.enable(5),I.morphNormals&&a.enable(6),I.morphColors&&a.enable(7),I.premultipliedAlpha&&a.enable(8),I.shadowMapEnabled&&a.enable(9),I.useLegacyLights&&a.enable(10),I.doubleSided&&a.enable(11),I.flipSided&&a.enable(12),I.useDepthPacking&&a.enable(13),I.dithering&&a.enable(14),I.transmission&&a.enable(15),I.sheen&&a.enable(16),I.opaque&&a.enable(17),I.pointsUvs&&a.enable(18),I.decodeVideoTexture&&a.enable(19),x.push(a.mask)}function S(x){const I=m[x.type];let F;if(I){const B=Ji[I];F=QRt.clone(B.uniforms)}else F=x.uniforms;return F}function C(x,I){let F;for(let B=0,ne=u.length;B0?i.push(g):_.transparent===!0?s.push(g):t.push(g)}function l(h,f,_,m,E,b){const g=o(h,f,_,m,E,b);_.transmission>0?i.unshift(g):_.transparent===!0?s.unshift(g):t.unshift(g)}function u(h,f){t.length>1&&t.sort(h||fMt),i.length>1&&i.sort(f||aw),s.length>1&&s.sort(f||aw)}function d(){for(let h=e,f=n.length;h=r.length?(o=new lw,r.push(o)):o=r[s],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function gMt(){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 _e,color:new gt};break;case"SpotLight":t={position:new _e,direction:new _e,color:new gt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new _e,color:new gt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new _e,skyColor:new gt,groundColor:new gt};break;case"RectAreaLight":t={color:new gt,position:new _e,halfWidth:new _e,halfHeight:new _e};break}return n[e.id]=t,t}}}function bMt(){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 It};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new It};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new It,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let EMt=0;function yMt(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function vMt(n,e){const t=new gMt,i=bMt(),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 d=0;d<9;d++)s.probe.push(new _e);const r=new _e,o=new Rt,a=new Rt;function l(d,h){let f=0,_=0,m=0;for(let B=0;B<9;B++)s.probe[B].set(0,0,0);let E=0,b=0,g=0,y=0,v=0,S=0,C=0,T=0,O=0,k=0,x=0;d.sort(yMt);const I=h===!0?Math.PI:1;for(let B=0,ne=d.length;B0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=je.LTC_FLOAT_1,s.rectAreaLTC2=je.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(s.rectAreaLTC1=je.LTC_HALF_1,s.rectAreaLTC2=je.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),s.ambient[0]=f,s.ambient[1]=_,s.ambient[2]=m;const F=s.hash;(F.directionalLength!==E||F.pointLength!==b||F.spotLength!==g||F.rectAreaLength!==y||F.hemiLength!==v||F.numDirectionalShadows!==S||F.numPointShadows!==C||F.numSpotShadows!==T||F.numSpotMaps!==O||F.numLightProbes!==x)&&(s.directional.length=E,s.spot.length=g,s.rectArea.length=y,s.point.length=b,s.hemi.length=v,s.directionalShadow.length=S,s.directionalShadowMap.length=S,s.pointShadow.length=C,s.pointShadowMap.length=C,s.spotShadow.length=T,s.spotShadowMap.length=T,s.directionalShadowMatrix.length=S,s.pointShadowMatrix.length=C,s.spotLightMatrix.length=T+O-k,s.spotLightMap.length=O,s.numSpotLightShadowsWithMaps=k,s.numLightProbes=x,F.directionalLength=E,F.pointLength=b,F.spotLength=g,F.rectAreaLength=y,F.hemiLength=v,F.numDirectionalShadows=S,F.numPointShadows=C,F.numSpotShadows=T,F.numSpotMaps=O,F.numLightProbes=x,s.version=EMt++)}function u(d,h){let f=0,_=0,m=0,E=0,b=0;const g=h.matrixWorldInverse;for(let y=0,v=d.length;y=a.length?(l=new cw(n,e),a.push(l)):l=a[o],l}function s(){t=new WeakMap}return{get:i,dispose:s}}class TMt extends Hi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=aRt,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 xMt extends Hi{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 CMt=`void main() { gl_Position = vec4( position, 1.0 ); -}`,RMt=`uniform sampler2D shadow_pass; +}`,wMt=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include @@ -3904,8 +3904,8 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function AMt(n,e,t){let i=new ey;const s=new It,r=new It,o=new Kt,a=new xMt({depthPacking:cRt}),l=new CMt,u={},d=t.maxTextureSize,h={[Ys]:Zn,[Zn]:Ys,[ts]:ts},f=new go({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new It},radius:{value:4}},vertexShader:wMt,fragmentShader:RMt}),_=f.clone();_.defines.HORIZONTAL_PASS=1;const m=new ms;m.setAttribute("position",new Yn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new Hn(m,f),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=zO;let g=this.type;this.render=function(C,T,O){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||C.length===0)return;const k=n.getRenderTarget(),x=n.getActiveCubeFace(),I=n.getActiveMipmapLevel(),F=n.state;F.setBlending(Sr),F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);const B=g!==Ms&&this.type===Ms,ne=g===Ms&&this.type!==Ms;for(let L=0,$=C.length;L<$;L++){const H=C[L],U=H.shadow;if(U===void 0){console.warn("THREE.WebGLShadowMap:",H,"has no shadow.");continue}if(U.autoUpdate===!1&&U.needsUpdate===!1)continue;s.copy(U.mapSize);const Q=U.getFrameExtents();if(s.multiply(Q),r.copy(U.mapSize),(s.x>d||s.y>d)&&(s.x>d&&(r.x=Math.floor(d/Q.x),s.x=r.x*Q.x,U.mapSize.x=r.x),s.y>d&&(r.y=Math.floor(d/Q.y),s.y=r.y*Q.y,U.mapSize.y=r.y)),U.map===null||B===!0||ne===!0){const j=this.type!==Ms?{minFilter:yn,magFilter:yn}:{};U.map!==null&&U.map.dispose(),U.map=new mo(s.x,s.y,j),U.map.texture.name=H.name+".shadowMap",U.camera.updateProjectionMatrix()}n.setRenderTarget(U.map),n.clear();const J=U.getViewportCount();for(let j=0;j0||T.map&&T.alphaTest>0){const F=x.uuid,B=T.uuid;let ne=u[F];ne===void 0&&(ne={},u[F]=ne);let L=ne[B];L===void 0&&(L=x.clone(),ne[B]=L),x=L}if(x.visible=T.visible,x.wireframe=T.wireframe,k===Ms?x.side=T.shadowSide!==null?T.shadowSide:T.side:x.side=T.shadowSide!==null?T.shadowSide:h[T.side],x.alphaMap=T.alphaMap,x.alphaTest=T.alphaTest,x.map=T.map,x.clipShadows=T.clipShadows,x.clippingPlanes=T.clippingPlanes,x.clipIntersection=T.clipIntersection,x.displacementMap=T.displacementMap,x.displacementScale=T.displacementScale,x.displacementBias=T.displacementBias,x.wireframeLinewidth=T.wireframeLinewidth,x.linewidth=T.linewidth,O.isPointLight===!0&&x.isMeshDistanceMaterial===!0){const F=n.properties.get(x);F.light=O}return x}function S(C,T,O,k,x){if(C.visible===!1)return;if(C.layers.test(T.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&x===Ms)&&(!C.frustumCulled||i.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(O.matrixWorldInverse,C.matrixWorld);const B=e.update(C),ne=C.material;if(Array.isArray(ne)){const L=B.groups;for(let $=0,H=L.length;$=1):j.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(j)[1]),Q=J>=2);let ae=null,ve={};const ee=n.getParameter(n.SCISSOR_BOX),Ee=n.getParameter(n.VIEWPORT),xe=new Kt().fromArray(ee),Me=new Kt().fromArray(Ee);function Z(oe,Ke,Ue,Oe){const Be=new Uint8Array(4),dt=n.createTexture();n.bindTexture(oe,dt),n.texParameteri(oe,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(oe,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Et=0;Et"u"?!1:/OculusBrowser/g.test(navigator.userAgent),m=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 y(M,N){return g?new OffscreenCanvas(M,N):ac("canvas")}function v(M,N,W,ue){let X=1;if((M.width>ue||M.height>ue)&&(X=ue/Math.max(M.width,M.height)),X<1||N===!0)if(typeof HTMLImageElement<"u"&&M instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&M instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&M instanceof ImageBitmap){const ie=N?Eu:Math.floor,Ae=ie(X*M.width),Ce=ie(X*M.height);E===void 0&&(E=y(Ae,Ce));const ke=W?y(Ae,Ce):E;return ke.width=Ae,ke.height=Ce,ke.getContext("2d").drawImage(M,0,0,Ae,Ce),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+M.width+"x"+M.height+") to ("+Ae+"x"+Ce+")."),ke}else return"data"in M&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+M.width+"x"+M.height+")."),M;return M}function S(M){return _b(M.width)&&_b(M.height)}function C(M){return a?!1:M.wrapS!==mi||M.wrapT!==mi||M.minFilter!==yn&&M.minFilter!==jn}function T(M,N){return M.generateMipmaps&&N&&M.minFilter!==yn&&M.minFilter!==jn}function O(M){n.generateMipmap(M)}function k(M,N,W,ue,X=!1){if(a===!1)return N;if(M!==null){if(n[M]!==void 0)return n[M];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+M+"'")}let ie=N;if(N===n.RED&&(W===n.FLOAT&&(ie=n.R32F),W===n.HALF_FLOAT&&(ie=n.R16F),W===n.UNSIGNED_BYTE&&(ie=n.R8)),N===n.RED_INTEGER&&(W===n.UNSIGNED_BYTE&&(ie=n.R8UI),W===n.UNSIGNED_SHORT&&(ie=n.R16UI),W===n.UNSIGNED_INT&&(ie=n.R32UI),W===n.BYTE&&(ie=n.R8I),W===n.SHORT&&(ie=n.R16I),W===n.INT&&(ie=n.R32I)),N===n.RG&&(W===n.FLOAT&&(ie=n.RG32F),W===n.HALF_FLOAT&&(ie=n.RG16F),W===n.UNSIGNED_BYTE&&(ie=n.RG8)),N===n.RGBA){const Ae=X?fu:Gt.getTransfer(ue);W===n.FLOAT&&(ie=n.RGBA32F),W===n.HALF_FLOAT&&(ie=n.RGBA16F),W===n.UNSIGNED_BYTE&&(ie=Ae===Zt?n.SRGB8_ALPHA8:n.RGBA8),W===n.UNSIGNED_SHORT_4_4_4_4&&(ie=n.RGBA4),W===n.UNSIGNED_SHORT_5_5_5_1&&(ie=n.RGB5_A1)}return(ie===n.R16F||ie===n.R32F||ie===n.RG16F||ie===n.RG32F||ie===n.RGBA16F||ie===n.RGBA32F)&&e.get("EXT_color_buffer_float"),ie}function x(M,N,W){return T(M,W)===!0||M.isFramebufferTexture&&M.minFilter!==yn&&M.minFilter!==jn?Math.log2(Math.max(N.width,N.height))+1:M.mipmaps!==void 0&&M.mipmaps.length>0?M.mipmaps.length:M.isCompressedTexture&&Array.isArray(M.image)?N.mipmaps.length:1}function I(M){return M===yn||M===cb||M===Bd?n.NEAREST:n.LINEAR}function F(M){const N=M.target;N.removeEventListener("dispose",F),ne(N),N.isVideoTexture&&m.delete(N)}function B(M){const N=M.target;N.removeEventListener("dispose",B),$(N)}function ne(M){const N=i.get(M);if(N.__webglInit===void 0)return;const W=M.source,ue=b.get(W);if(ue){const X=ue[N.__cacheKey];X.usedTimes--,X.usedTimes===0&&L(M),Object.keys(ue).length===0&&b.delete(W)}i.remove(M)}function L(M){const N=i.get(M);n.deleteTexture(N.__webglTexture);const W=M.source,ue=b.get(W);delete ue[N.__cacheKey],o.memory.textures--}function $(M){const N=M.texture,W=i.get(M),ue=i.get(N);if(ue.__webglTexture!==void 0&&(n.deleteTexture(ue.__webglTexture),o.memory.textures--),M.depthTexture&&M.depthTexture.dispose(),M.isWebGLCubeRenderTarget)for(let X=0;X<6;X++){if(Array.isArray(W.__webglFramebuffer[X]))for(let ie=0;ie=l&&console.warn("THREE.WebGLTextures: Trying to use "+M+" texture units while this GPU supports only "+l),H+=1,M}function J(M){const N=[];return N.push(M.wrapS),N.push(M.wrapT),N.push(M.wrapR||0),N.push(M.magFilter),N.push(M.minFilter),N.push(M.anisotropy),N.push(M.internalFormat),N.push(M.format),N.push(M.type),N.push(M.generateMipmaps),N.push(M.premultiplyAlpha),N.push(M.flipY),N.push(M.unpackAlignment),N.push(M.colorSpace),N.join()}function j(M,N){const W=i.get(M);if(M.isVideoTexture&&re(M),M.isRenderTargetTexture===!1&&M.version>0&&W.__version!==M.version){const ue=M.image;if(ue===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ue.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{fe(W,M,N);return}}t.bindTexture(n.TEXTURE_2D,W.__webglTexture,n.TEXTURE0+N)}function ae(M,N){const W=i.get(M);if(M.version>0&&W.__version!==M.version){fe(W,M,N);return}t.bindTexture(n.TEXTURE_2D_ARRAY,W.__webglTexture,n.TEXTURE0+N)}function ve(M,N){const W=i.get(M);if(M.version>0&&W.__version!==M.version){fe(W,M,N);return}t.bindTexture(n.TEXTURE_3D,W.__webglTexture,n.TEXTURE0+N)}function ee(M,N){const W=i.get(M);if(M.version>0&&W.__version!==M.version){Ne(W,M,N);return}t.bindTexture(n.TEXTURE_CUBE_MAP,W.__webglTexture,n.TEXTURE0+N)}const Ee={[Ca]:n.REPEAT,[mi]:n.CLAMP_TO_EDGE,[hu]:n.MIRRORED_REPEAT},xe={[yn]:n.NEAREST,[cb]:n.NEAREST_MIPMAP_NEAREST,[Bd]:n.NEAREST_MIPMAP_LINEAR,[jn]:n.LINEAR,[qO]:n.LINEAR_MIPMAP_NEAREST,[fo]:n.LINEAR_MIPMAP_LINEAR},Me={[uRt]:n.NEVER,[gRt]:n.ALWAYS,[pRt]:n.LESS,[eI]:n.LEQUAL,[_Rt]:n.EQUAL,[mRt]:n.GEQUAL,[hRt]:n.GREATER,[fRt]:n.NOTEQUAL};function Z(M,N,W){if(W?(n.texParameteri(M,n.TEXTURE_WRAP_S,Ee[N.wrapS]),n.texParameteri(M,n.TEXTURE_WRAP_T,Ee[N.wrapT]),(M===n.TEXTURE_3D||M===n.TEXTURE_2D_ARRAY)&&n.texParameteri(M,n.TEXTURE_WRAP_R,Ee[N.wrapR]),n.texParameteri(M,n.TEXTURE_MAG_FILTER,xe[N.magFilter]),n.texParameteri(M,n.TEXTURE_MIN_FILTER,xe[N.minFilter])):(n.texParameteri(M,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(M,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(M===n.TEXTURE_3D||M===n.TEXTURE_2D_ARRAY)&&n.texParameteri(M,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(N.wrapS!==mi||N.wrapT!==mi)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(M,n.TEXTURE_MAG_FILTER,I(N.magFilter)),n.texParameteri(M,n.TEXTURE_MIN_FILTER,I(N.minFilter)),N.minFilter!==yn&&N.minFilter!==jn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),N.compareFunction&&(n.texParameteri(M,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(M,n.TEXTURE_COMPARE_FUNC,Me[N.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const ue=e.get("EXT_texture_filter_anisotropic");if(N.magFilter===yn||N.minFilter!==Bd&&N.minFilter!==fo||N.type===Ps&&e.has("OES_texture_float_linear")===!1||a===!1&&N.type===rc&&e.has("OES_texture_half_float_linear")===!1)return;(N.anisotropy>1||i.get(N).__currentAnisotropy)&&(n.texParameterf(M,ue.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(N.anisotropy,s.getMaxAnisotropy())),i.get(N).__currentAnisotropy=N.anisotropy)}}function ye(M,N){let W=!1;M.__webglInit===void 0&&(M.__webglInit=!0,N.addEventListener("dispose",F));const ue=N.source;let X=b.get(ue);X===void 0&&(X={},b.set(ue,X));const ie=J(N);if(ie!==M.__cacheKey){X[ie]===void 0&&(X[ie]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,W=!0),X[ie].usedTimes++;const Ae=X[M.__cacheKey];Ae!==void 0&&(X[M.__cacheKey].usedTimes--,Ae.usedTimes===0&&L(N)),M.__cacheKey=ie,M.__webglTexture=X[ie].texture}return W}function fe(M,N,W){let ue=n.TEXTURE_2D;(N.isDataArrayTexture||N.isCompressedArrayTexture)&&(ue=n.TEXTURE_2D_ARRAY),N.isData3DTexture&&(ue=n.TEXTURE_3D);const X=ye(M,N),ie=N.source;t.bindTexture(ue,M.__webglTexture,n.TEXTURE0+W);const Ae=i.get(ie);if(ie.version!==Ae.__version||X===!0){t.activeTexture(n.TEXTURE0+W);const Ce=Gt.getPrimaries(Gt.workingColorSpace),ke=N.colorSpace===bi?null:Gt.getPrimaries(N.colorSpace),Qe=N.colorSpace===bi||Ce===ke?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,N.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,N.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Qe);const ct=C(N)&&S(N.image)===!1;let Pe=v(N.image,ct,!1,d);Pe=ce(N,Pe);const ut=S(Pe)||a,Ze=r.convert(N.format,N.colorSpace);let qe=r.convert(N.type),tt=k(N.internalFormat,Ze,qe,N.colorSpace,N.isVideoTexture);Z(ue,N,ut);let Fe;const pt=N.mipmaps,oe=a&&N.isVideoTexture!==!0&&tt!==XO,Ke=Ae.__version===void 0||X===!0,Ue=x(N,Pe,ut);if(N.isDepthTexture)tt=n.DEPTH_COMPONENT,a?N.type===Ps?tt=n.DEPTH_COMPONENT32F:N.type===br?tt=n.DEPTH_COMPONENT24:N.type===oo?tt=n.DEPTH24_STENCIL8:tt=n.DEPTH_COMPONENT16:N.type===Ps&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),N.format===ao&&tt===n.DEPTH_COMPONENT&&N.type!==QE&&N.type!==br&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),N.type=br,qe=r.convert(N.type)),N.format===wa&&tt===n.DEPTH_COMPONENT&&(tt=n.DEPTH_STENCIL,N.type!==oo&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),N.type=oo,qe=r.convert(N.type))),Ke&&(oe?t.texStorage2D(n.TEXTURE_2D,1,tt,Pe.width,Pe.height):t.texImage2D(n.TEXTURE_2D,0,tt,Pe.width,Pe.height,0,Ze,qe,null));else if(N.isDataTexture)if(pt.length>0&&ut){oe&&Ke&&t.texStorage2D(n.TEXTURE_2D,Ue,tt,pt[0].width,pt[0].height);for(let Oe=0,Be=pt.length;Oe>=1,Be>>=1}}else if(pt.length>0&&ut){oe&&Ke&&t.texStorage2D(n.TEXTURE_2D,Ue,tt,pt[0].width,pt[0].height);for(let Oe=0,Be=pt.length;Oe0&&Ke++,t.texStorage2D(n.TEXTURE_CUBE_MAP,Ke,Fe,Pe[0].width,Pe[0].height));for(let Oe=0;Oe<6;Oe++)if(ct){pt?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Oe,0,0,0,Pe[Oe].width,Pe[Oe].height,qe,tt,Pe[Oe].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Oe,0,Fe,Pe[Oe].width,Pe[Oe].height,0,qe,tt,Pe[Oe].data);for(let Be=0;Be>ie),Pe=Math.max(1,N.height>>ie);X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY?t.texImage3D(X,ie,ke,ct,Pe,N.depth,0,Ae,Ce,null):t.texImage2D(X,ie,ke,ct,Pe,0,Ae,Ce,null)}t.bindFramebuffer(n.FRAMEBUFFER,M),pe(N)?f.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,ue,X,i.get(W).__webglTexture,0,z(N)):(X===n.TEXTURE_2D||X>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&X<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,ue,X,i.get(W).__webglTexture,ie),t.bindFramebuffer(n.FRAMEBUFFER,null)}function D(M,N,W){if(n.bindRenderbuffer(n.RENDERBUFFER,M),N.depthBuffer&&!N.stencilBuffer){let ue=a===!0?n.DEPTH_COMPONENT24:n.DEPTH_COMPONENT16;if(W||pe(N)){const X=N.depthTexture;X&&X.isDepthTexture&&(X.type===Ps?ue=n.DEPTH_COMPONENT32F:X.type===br&&(ue=n.DEPTH_COMPONENT24));const ie=z(N);pe(N)?f.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ie,ue,N.width,N.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,ie,ue,N.width,N.height)}else n.renderbufferStorage(n.RENDERBUFFER,ue,N.width,N.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,M)}else if(N.depthBuffer&&N.stencilBuffer){const ue=z(N);W&&pe(N)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,ue,n.DEPTH24_STENCIL8,N.width,N.height):pe(N)?f.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ue,n.DEPTH24_STENCIL8,N.width,N.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,N.width,N.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,M)}else{const ue=N.isWebGLMultipleRenderTargets===!0?N.texture:[N.texture];for(let X=0;X0){W.__webglFramebuffer[Ce]=[];for(let ke=0;ke0){W.__webglFramebuffer=[];for(let Ce=0;Ce0&&pe(M)===!1){const Ce=ie?N:[N];W.__webglMultisampledFramebuffer=n.createFramebuffer(),W.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,W.__webglMultisampledFramebuffer);for(let ke=0;ke0)for(let ke=0;ke0)for(let ke=0;ke0&&pe(M)===!1){const N=M.isWebGLMultipleRenderTargets?M.texture:[M.texture],W=M.width,ue=M.height;let X=n.COLOR_BUFFER_BIT;const ie=[],Ae=M.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Ce=i.get(M),ke=M.isWebGLMultipleRenderTargets===!0;if(ke)for(let Qe=0;Qe0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&N.__useRenderToTexture!==!1}function re(M){const N=o.render.frame;m.get(M)!==N&&(m.set(M,N),M.update())}function ce(M,N){const W=M.colorSpace,ue=M.format,X=M.type;return M.isCompressedTexture===!0||M.isVideoTexture===!0||M.format===pb||W!==On&&W!==bi&&(Gt.getTransfer(W)===Zt?a===!1?e.has("EXT_sRGB")===!0&&ue===gi?(M.format=pb,M.minFilter=jn,M.generateMipmaps=!1):N=nI.sRGBToLinear(N):(ue!==gi||X!==xr)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",W)),N}this.allocateTextureUnit=Q,this.resetTextureUnits=U,this.setTexture2D=j,this.setTexture2DArray=ae,this.setTexture3D=ve,this.setTextureCube=ee,this.rebindTextures=de,this.setupRenderTarget=le,this.updateRenderTargetMipmap=Re,this.updateMultisampleRenderTarget=Ie,this.setupDepthRenderbuffer=K,this.setupFrameBufferTexture=Le,this.useMultisampledRTT=pe}function IMt(n,e,t){const i=t.isWebGL2;function s(r,o=bi){let a;const l=Gt.getTransfer(o);if(r===xr)return n.UNSIGNED_BYTE;if(r===$O)return n.UNSIGNED_SHORT_4_4_4_4;if(r===WO)return n.UNSIGNED_SHORT_5_5_5_1;if(r===Zwt)return n.BYTE;if(r===Jwt)return n.SHORT;if(r===QE)return n.UNSIGNED_SHORT;if(r===YO)return n.INT;if(r===br)return n.UNSIGNED_INT;if(r===Ps)return n.FLOAT;if(r===rc)return i?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(r===eRt)return n.ALPHA;if(r===gi)return n.RGBA;if(r===tRt)return n.LUMINANCE;if(r===nRt)return n.LUMINANCE_ALPHA;if(r===ao)return n.DEPTH_COMPONENT;if(r===wa)return n.DEPTH_STENCIL;if(r===pb)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(r===iRt)return n.RED;if(r===KO)return n.RED_INTEGER;if(r===sRt)return n.RG;if(r===jO)return n.RG_INTEGER;if(r===QO)return n.RGBA_INTEGER;if(r===Um||r===Fm||r===Bm||r===Gm)if(l===Zt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(r===Um)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Fm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Bm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Gm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(r===Um)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Fm)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Bm)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Gm)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===jC||r===QC||r===XC||r===ZC)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(r===jC)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===QC)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===XC)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===ZC)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===XO)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===JC||r===e1)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(r===JC)return l===Zt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(r===e1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===t1||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)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(r===t1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===n1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===i1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===s1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===r1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===o1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===a1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===l1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===c1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===d1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===u1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===p1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===_1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===h1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===Vm||r===f1||r===m1)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(r===Vm)return l===Zt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===f1)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===m1)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===rRt||r===g1||r===b1||r===E1)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(r===Vm)return a.COMPRESSED_RED_RGTC1_EXT;if(r===g1)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===b1)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===E1)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===oo?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 MMt extends zn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class to extends rn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const DMt={type:"move"};class ug{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new to,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 to,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new _e,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new _e),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new to,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new _e,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new _e),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,u=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(u&&e.hand){o=!0;for(const E of e.hand.values()){const b=t.getJointPose(E,i),g=this._getHandJoint(u,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 d=u.joints["index-finger-tip"],h=u.joints["thumb-tip"],f=d.position.distanceTo(h.position),_=.02,m=.005;u.inputState.pinching&&f>_+m?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&f<=_-m&&(u.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(DMt)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=r!==null),u!==null&&(u.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new to;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class kMt extends Ka{constructor(e,t){super();const i=this;let s=null,r=1,o=null,a="local-floor",l=1,u=null,d=null,h=null,f=null,_=null,m=null;const E=t.getContextAttributes();let b=null,g=null;const y=[],v=[],S=new It;let C=null;const T=new zn;T.layers.enable(1),T.viewport=new Kt;const O=new zn;O.layers.enable(2),O.viewport=new Kt;const k=[T,O],x=new MMt;x.layers.enable(1),x.layers.enable(2);let I=null,F=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ee){let Ee=y[ee];return Ee===void 0&&(Ee=new ug,y[ee]=Ee),Ee.getTargetRaySpace()},this.getControllerGrip=function(ee){let Ee=y[ee];return Ee===void 0&&(Ee=new ug,y[ee]=Ee),Ee.getGripSpace()},this.getHand=function(ee){let Ee=y[ee];return Ee===void 0&&(Ee=new ug,y[ee]=Ee),Ee.getHandSpace()};function B(ee){const Ee=v.indexOf(ee.inputSource);if(Ee===-1)return;const xe=y[Ee];xe!==void 0&&(xe.update(ee.inputSource,ee.frame,u||o),xe.dispatchEvent({type:ee.type,data:ee.inputSource}))}function ne(){s.removeEventListener("select",B),s.removeEventListener("selectstart",B),s.removeEventListener("selectend",B),s.removeEventListener("squeeze",B),s.removeEventListener("squeezestart",B),s.removeEventListener("squeezeend",B),s.removeEventListener("end",ne),s.removeEventListener("inputsourceschange",L);for(let ee=0;ee=0&&(v[Me]=null,y[Me].disconnect(xe))}for(let Ee=0;Ee=v.length){v.push(xe),Me=ye;break}else if(v[ye]===null){v[ye]=xe,Me=ye;break}if(Me===-1)break}const Z=y[Me];Z&&Z.connect(xe)}}const $=new _e,H=new _e;function U(ee,Ee,xe){$.setFromMatrixPosition(Ee.matrixWorld),H.setFromMatrixPosition(xe.matrixWorld);const Me=$.distanceTo(H),Z=Ee.projectionMatrix.elements,ye=xe.projectionMatrix.elements,fe=Z[14]/(Z[10]-1),Ne=Z[14]/(Z[10]+1),Le=(Z[9]+1)/Z[5],D=(Z[9]-1)/Z[5],q=(Z[8]-1)/Z[0],K=(ye[8]+1)/ye[0],de=fe*q,le=fe*K,Re=Me/(-q+K),Ie=Re*-q;Ee.matrixWorld.decompose(ee.position,ee.quaternion,ee.scale),ee.translateX(Ie),ee.translateZ(Re),ee.matrixWorld.compose(ee.position,ee.quaternion,ee.scale),ee.matrixWorldInverse.copy(ee.matrixWorld).invert();const z=fe+Re,pe=Ne+Re,re=de-Ie,ce=le+(Me-Ie),M=Le*Ne/pe*z,N=D*Ne/pe*z;ee.projectionMatrix.makePerspective(re,ce,M,N,z,pe),ee.projectionMatrixInverse.copy(ee.projectionMatrix).invert()}function Q(ee,Ee){Ee===null?ee.matrixWorld.copy(ee.matrix):ee.matrixWorld.multiplyMatrices(Ee.matrixWorld,ee.matrix),ee.matrixWorldInverse.copy(ee.matrixWorld).invert()}this.updateCamera=function(ee){if(s===null)return;x.near=O.near=T.near=ee.near,x.far=O.far=T.far=ee.far,(I!==x.near||F!==x.far)&&(s.updateRenderState({depthNear:x.near,depthFar:x.far}),I=x.near,F=x.far);const Ee=ee.parent,xe=x.cameras;Q(x,Ee);for(let Me=0;Me0&&(b.alphaTest.value=g.alphaTest);const y=e.get(g).envMap;if(y&&(b.envMap.value=y,b.flipEnvMap.value=y.isCubeTexture&&y.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 v=n._useLegacyLights===!0?Math.PI:1;b.lightMapIntensity.value=g.lightMapIntensity*v,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,y,v){b.diffuse.value.copy(g.color),b.opacity.value=g.opacity,b.size.value=g.size*y,b.scale.value=v*.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 u(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 d(b,g){b.specular.value.copy(g.specular),b.shininess.value=Math.max(g.shininess,1e-4)}function h(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 _(b,g,y){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=y.texture,b.transmissionSamplerSize.value.set(y.width,y.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 m(b,g){g.matcap&&(b.matcap.value=g.matcap)}function E(b,g){const y=e.get(g).light;b.referencePosition.value.setFromMatrixPosition(y.matrixWorld),b.nearDistance.value=y.shadow.camera.near,b.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function PMt(n,e,t,i){let s={},r={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(y,v){const S=v.program;i.uniformBlockBinding(y,S)}function u(y,v){let S=s[y.id];S===void 0&&(m(y),S=d(y),s[y.id]=S,y.addEventListener("dispose",b));const C=v.program;i.updateUBOMapping(y,C);const T=e.render.frame;r[y.id]!==T&&(f(y),r[y.id]=T)}function d(y){const v=h();y.__bindingPointIndex=v;const S=n.createBuffer(),C=y.__size,T=y.usage;return n.bindBuffer(n.UNIFORM_BUFFER,S),n.bufferData(n.UNIFORM_BUFFER,C,T),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,v,S),S}function h(){for(let y=0;y0){T=S%C;const B=C-T;T!==0&&B-I.boundary<0&&(S+=C-T,x.__offset=S)}S+=I.storage}return T=S%C,T>0&&(S+=C-T),y.__size=S,y.__cache={},this}function E(y){const v={boundary:0,storage:0};return typeof y=="number"?(v.boundary=4,v.storage=4):y.isVector2?(v.boundary=8,v.storage=8):y.isVector3||y.isColor?(v.boundary=16,v.storage=12):y.isVector4?(v.boundary=16,v.storage=16):y.isMatrix3?(v.boundary=48,v.storage=48):y.isMatrix4?(v.boundary=64,v.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),v}function b(y){const v=y.target;v.removeEventListener("dispose",b);const S=o.indexOf(v.__bindingPointIndex);o.splice(S,1),n.deleteBuffer(s[v.id]),delete s[v.id],delete r[v.id]}function g(){for(const y in s)n.deleteBuffer(s[y]);o=[],s={},r={}}return{bind:l,update:u,dispose:g}}class EI{constructor(e={}){const{canvas:t=DRt(),context:i=null,depth:s=!0,stencil:r=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:u=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let f;i!==null?f=i.getContextAttributes().alpha:f=o;const _=new Uint32Array(4),m=new Int32Array(4);let E=null,b=null;const g=[],y=[];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=on,this._useLegacyLights=!1,this.toneMapping=Tr,this.toneMappingExposure=1;const v=this;let S=!1,C=0,T=0,O=null,k=-1,x=null;const I=new Kt,F=new Kt;let B=null;const ne=new gt(0);let L=0,$=t.width,H=t.height,U=1,Q=null,J=null;const j=new Kt(0,0,$,H),ae=new Kt(0,0,$,H);let ve=!1;const ee=new ey;let Ee=!1,xe=!1,Me=null;const Z=new Rt,ye=new It,fe=new _e,Ne={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Le(){return O===null?U:1}let D=i;function q(R,Y){for(let te=0;te{function Ve(){if(be.forEach(function(Xe){Ie.get(Xe).currentProgram.isReady()&&be.delete(Xe)}),be.size===0){me(R);return}setTimeout(Ve,10)}K.get("KHR_parallel_shader_compile")!==null?Ve():setTimeout(Ve,10)})};let Et=null;function Qt(R){Et&&Et(R)}function cn(){$t.stop()}function Ct(){$t.start()}const $t=new pI;$t.setAnimationLoop(Qt),typeof self<"u"&&$t.setContext(self),this.setAnimationLoop=function(R){Et=R,Fe.setAnimationLoop(R),R===null?$t.stop():$t.start()},Fe.addEventListener("sessionstart",cn),Fe.addEventListener("sessionend",Ct),this.render=function(R,Y){if(Y!==void 0&&Y.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(S===!0)return;R.matrixWorldAutoUpdate===!0&&R.updateMatrixWorld(),Y.parent===null&&Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),Fe.enabled===!0&&Fe.isPresenting===!0&&(Fe.cameraAutoUpdate===!0&&Fe.updateCamera(Y),Y=Fe.getCamera()),R.isScene===!0&&R.onBeforeRender(v,R,Y,O),b=ie.get(R,y.length),b.init(),y.push(b),Z.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),ee.setFromProjectionMatrix(Z),xe=this.localClippingEnabled,Ee=Ae.init(this.clippingPlanes,xe),E=X.get(R,g.length),E.init(),g.push(E),Sn(R,Y,0,v.sortObjects),E.finish(),v.sortObjects===!0&&E.sort(Q,J),this.info.render.frame++,Ee===!0&&Ae.beginShadows();const te=b.state.shadowsArray;if(Ce.render(te,R,Y),Ee===!0&&Ae.endShadows(),this.info.autoReset===!0&&this.info.reset(),ke.render(E,R),b.setupLights(v._useLegacyLights),Y.isArrayCamera){const be=Y.cameras;for(let me=0,Ve=be.length;me0?b=y[y.length-1]:b=null,g.pop(),g.length>0?E=g[g.length-1]:E=null};function Sn(R,Y,te,be){if(R.visible===!1)return;if(R.layers.test(Y.layers)){if(R.isGroup)te=R.renderOrder;else if(R.isLOD)R.autoUpdate===!0&&R.update(Y);else if(R.isLight)b.pushLight(R),R.castShadow&&b.pushShadow(R);else if(R.isSprite){if(!R.frustumCulled||ee.intersectsSprite(R)){be&&fe.setFromMatrixPosition(R.matrixWorld).applyMatrix4(Z);const Xe=N.update(R),it=R.material;it.visible&&E.push(R,Xe,it,te,fe.z,null)}}else if((R.isMesh||R.isLine||R.isPoints)&&(!R.frustumCulled||ee.intersectsObject(R))){const Xe=N.update(R),it=R.material;if(be&&(R.boundingSphere!==void 0?(R.boundingSphere===null&&R.computeBoundingSphere(),fe.copy(R.boundingSphere.center)):(Xe.boundingSphere===null&&Xe.computeBoundingSphere(),fe.copy(Xe.boundingSphere.center)),fe.applyMatrix4(R.matrixWorld).applyMatrix4(Z)),Array.isArray(it)){const at=Xe.groups;for(let rt=0,_t=at.length;rt<_t;rt++){const ht=at[rt],jt=it[ht.materialIndex];jt&&jt.visible&&E.push(R,Xe,jt,te,fe.z,ht)}}else it.visible&&E.push(R,Xe,it,te,fe.z,null)}}const Ve=R.children;for(let Xe=0,it=Ve.length;Xe0&&Mr(me,Ve,Y,te),be&&le.viewport(I.copy(be)),me.length>0&&ci(me,Y,te),Ve.length>0&&ci(Ve,Y,te),Xe.length>0&&ci(Xe,Y,te),le.buffers.depth.setTest(!0),le.buffers.depth.setMask(!0),le.buffers.color.setMask(!0),le.setPolygonOffset(!1)}function Mr(R,Y,te,be){if((te.isScene===!0?te.overrideMaterial:null)!==null)return;const Ve=de.isWebGL2;Me===null&&(Me=new mo(1,1,{generateMipmaps:!0,type:K.has("EXT_color_buffer_half_float")?rc:xr,minFilter:fo,samples:Ve?4:0})),v.getDrawingBufferSize(ye),Ve?Me.setSize(ye.x,ye.y):Me.setSize(Eu(ye.x),Eu(ye.y));const Xe=v.getRenderTarget();v.setRenderTarget(Me),v.getClearColor(ne),L=v.getClearAlpha(),L<1&&v.setClearColor(16777215,.5),v.clear();const it=v.toneMapping;v.toneMapping=Tr,ci(R,te,be),z.updateMultisampleRenderTarget(Me),z.updateRenderTargetMipmap(Me);let at=!1;for(let rt=0,_t=Y.length;rt<_t;rt++){const ht=Y[rt],jt=ht.object,xn=ht.geometry,sn=ht.material,In=ht.group;if(sn.side===ts&&jt.layers.test(be.layers)){const Xt=sn.side;sn.side=Zn,sn.needsUpdate=!0,Tn(jt,te,be,xn,sn,In),sn.side=Xt,sn.needsUpdate=!0,at=!0}}at===!0&&(z.updateMultisampleRenderTarget(Me),z.updateRenderTargetMipmap(Me)),v.setRenderTarget(Xe),v.setClearColor(ne,L),v.toneMapping=it}function ci(R,Y,te){const be=Y.isScene===!0?Y.overrideMaterial:null;for(let me=0,Ve=R.length;me0),ht=!!te.morphAttributes.position,jt=!!te.morphAttributes.normal,xn=!!te.morphAttributes.color;let sn=Tr;be.toneMapped&&(O===null||O.isXRRenderTarget===!0)&&(sn=v.toneMapping);const In=te.morphAttributes.position||te.morphAttributes.normal||te.morphAttributes.color,Xt=In!==void 0?In.length:0,St=Ie.get(be),el=b.state.lights;if(Ee===!0&&(xe===!0||R!==x)){const Wn=R===x&&be.id===k;Ae.setState(be,R,Wn)}let tn=!1;be.version===St.__version?(St.needsLights&&St.lightsStateVersion!==el.state.version||St.outputColorSpace!==it||me.isBatchedMesh&&St.batching===!1||!me.isBatchedMesh&&St.batching===!0||me.isInstancedMesh&&St.instancing===!1||!me.isInstancedMesh&&St.instancing===!0||me.isSkinnedMesh&&St.skinning===!1||!me.isSkinnedMesh&&St.skinning===!0||me.isInstancedMesh&&St.instancingColor===!0&&me.instanceColor===null||me.isInstancedMesh&&St.instancingColor===!1&&me.instanceColor!==null||St.envMap!==at||be.fog===!0&&St.fog!==Ve||St.numClippingPlanes!==void 0&&(St.numClippingPlanes!==Ae.numPlanes||St.numIntersection!==Ae.numIntersection)||St.vertexAlphas!==rt||St.vertexTangents!==_t||St.morphTargets!==ht||St.morphNormals!==jt||St.morphColors!==xn||St.toneMapping!==sn||de.isWebGL2===!0&&St.morphTargetsCount!==Xt)&&(tn=!0):(tn=!0,St.__version=be.version);let Ss=St.currentProgram;tn===!0&&(Ss=di(be,Y,me));let xc=!1,Dr=!1,tl=!1;const bn=Ss.getUniforms(),Ts=St.uniforms;if(le.useProgram(Ss.program)&&(xc=!0,Dr=!0,tl=!0),be.id!==k&&(k=be.id,Dr=!0),xc||x!==R){bn.setValue(D,"projectionMatrix",R.projectionMatrix),bn.setValue(D,"viewMatrix",R.matrixWorldInverse);const Wn=bn.map.cameraPosition;Wn!==void 0&&Wn.setValue(D,fe.setFromMatrixPosition(R.matrixWorld)),de.logarithmicDepthBuffer&&bn.setValue(D,"logDepthBufFC",2/(Math.log(R.far+1)/Math.LN2)),(be.isMeshPhongMaterial||be.isMeshToonMaterial||be.isMeshLambertMaterial||be.isMeshBasicMaterial||be.isMeshStandardMaterial||be.isShaderMaterial)&&bn.setValue(D,"isOrthographic",R.isOrthographicCamera===!0),x!==R&&(x=R,Dr=!0,tl=!0)}if(me.isSkinnedMesh){bn.setOptional(D,me,"bindMatrix"),bn.setOptional(D,me,"bindMatrixInverse");const Wn=me.skeleton;Wn&&(de.floatVertexTextures?(Wn.boneTexture===null&&Wn.computeBoneTexture(),bn.setValue(D,"boneTexture",Wn.boneTexture,z)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}me.isBatchedMesh&&(bn.setOptional(D,me,"batchingTexture"),bn.setValue(D,"batchingTexture",me._matricesTexture,z));const nl=te.morphAttributes;if((nl.position!==void 0||nl.normal!==void 0||nl.color!==void 0&&de.isWebGL2===!0)&&Qe.update(me,te,Ss),(Dr||St.receiveShadow!==me.receiveShadow)&&(St.receiveShadow=me.receiveShadow,bn.setValue(D,"receiveShadow",me.receiveShadow)),be.isMeshGouraudMaterial&&be.envMap!==null&&(Ts.envMap.value=at,Ts.flipEnvMap.value=at.isCubeTexture&&at.isRenderTargetTexture===!1?-1:1),Dr&&(bn.setValue(D,"toneMappingExposure",v.toneMappingExposure),St.needsLights&&vs(Ts,tl),Ve&&be.fog===!0&&ue.refreshFogUniforms(Ts,Ve),ue.refreshMaterialUniforms(Ts,be,U,H,Me),Gd.upload(D,ji(St),Ts,z)),be.isShaderMaterial&&be.uniformsNeedUpdate===!0&&(Gd.upload(D,ji(St),Ts,z),be.uniformsNeedUpdate=!1),be.isSpriteMaterial&&bn.setValue(D,"center",me.center),bn.setValue(D,"modelViewMatrix",me.modelViewMatrix),bn.setValue(D,"normalMatrix",me.normalMatrix),bn.setValue(D,"modelMatrix",me.matrixWorld),be.isShaderMaterial||be.isRawShaderMaterial){const Wn=be.uniformsGroups;for(let il=0,gp=Wn.length;il0&&z.useMultisampledRTT(R)===!1?me=Ie.get(R).__webglMultisampledFramebuffer:Array.isArray(_t)?me=_t[te]:me=_t,I.copy(R.viewport),F.copy(R.scissor),B=R.scissorTest}else I.copy(j).multiplyScalar(U).floor(),F.copy(ae).multiplyScalar(U).floor(),B=ve;if(le.bindFramebuffer(D.FRAMEBUFFER,me)&&de.drawBuffers&&be&&le.drawBuffers(R,me),le.viewport(I),le.scissor(F),le.setScissorTest(B),Ve){const at=Ie.get(R.texture);D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_CUBE_MAP_POSITIVE_X+Y,at.__webglTexture,te)}else if(Xe){const at=Ie.get(R.texture),rt=Y||0;D.framebufferTextureLayer(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,at.__webglTexture,te||0,rt)}k=-1},this.readRenderTargetPixels=function(R,Y,te,be,me,Ve,Xe){if(!(R&&R.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let it=Ie.get(R).__webglFramebuffer;if(R.isWebGLCubeRenderTarget&&Xe!==void 0&&(it=it[Xe]),it){le.bindFramebuffer(D.FRAMEBUFFER,it);try{const at=R.texture,rt=at.format,_t=at.type;if(rt!==gi&&ut.convert(rt)!==D.getParameter(D.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ht=_t===rc&&(K.has("EXT_color_buffer_half_float")||de.isWebGL2&&K.has("EXT_color_buffer_float"));if(_t!==xr&&ut.convert(_t)!==D.getParameter(D.IMPLEMENTATION_COLOR_READ_TYPE)&&!(_t===Ps&&(de.isWebGL2||K.has("OES_texture_float")||K.has("WEBGL_color_buffer_float")))&&!ht){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y>=0&&Y<=R.width-be&&te>=0&&te<=R.height-me&&D.readPixels(Y,te,be,me,ut.convert(rt),ut.convert(_t),Ve)}finally{const at=O!==null?Ie.get(O).__webglFramebuffer:null;le.bindFramebuffer(D.FRAMEBUFFER,at)}}},this.copyFramebufferToTexture=function(R,Y,te=0){const be=Math.pow(2,-te),me=Math.floor(Y.image.width*be),Ve=Math.floor(Y.image.height*be);z.setTexture2D(Y,0),D.copyTexSubImage2D(D.TEXTURE_2D,te,0,0,R.x,R.y,me,Ve),le.unbindTexture()},this.copyTextureToTexture=function(R,Y,te,be=0){const me=Y.image.width,Ve=Y.image.height,Xe=ut.convert(te.format),it=ut.convert(te.type);z.setTexture2D(te,0),D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,te.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,te.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,te.unpackAlignment),Y.isDataTexture?D.texSubImage2D(D.TEXTURE_2D,be,R.x,R.y,me,Ve,Xe,it,Y.image.data):Y.isCompressedTexture?D.compressedTexSubImage2D(D.TEXTURE_2D,be,R.x,R.y,Y.mipmaps[0].width,Y.mipmaps[0].height,Xe,Y.mipmaps[0].data):D.texSubImage2D(D.TEXTURE_2D,be,R.x,R.y,Xe,it,Y.image),be===0&&te.generateMipmaps&&D.generateMipmap(D.TEXTURE_2D),le.unbindTexture()},this.copyTextureToTexture3D=function(R,Y,te,be,me=0){if(v.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Ve=R.max.x-R.min.x+1,Xe=R.max.y-R.min.y+1,it=R.max.z-R.min.z+1,at=ut.convert(be.format),rt=ut.convert(be.type);let _t;if(be.isData3DTexture)z.setTexture3D(be,0),_t=D.TEXTURE_3D;else if(be.isDataArrayTexture)z.setTexture2DArray(be,0),_t=D.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,be.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,be.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,be.unpackAlignment);const ht=D.getParameter(D.UNPACK_ROW_LENGTH),jt=D.getParameter(D.UNPACK_IMAGE_HEIGHT),xn=D.getParameter(D.UNPACK_SKIP_PIXELS),sn=D.getParameter(D.UNPACK_SKIP_ROWS),In=D.getParameter(D.UNPACK_SKIP_IMAGES),Xt=te.isCompressedTexture?te.mipmaps[0]:te.image;D.pixelStorei(D.UNPACK_ROW_LENGTH,Xt.width),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,Xt.height),D.pixelStorei(D.UNPACK_SKIP_PIXELS,R.min.x),D.pixelStorei(D.UNPACK_SKIP_ROWS,R.min.y),D.pixelStorei(D.UNPACK_SKIP_IMAGES,R.min.z),te.isDataTexture||te.isData3DTexture?D.texSubImage3D(_t,me,Y.x,Y.y,Y.z,Ve,Xe,it,at,rt,Xt.data):te.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),D.compressedTexSubImage3D(_t,me,Y.x,Y.y,Y.z,Ve,Xe,it,at,Xt.data)):D.texSubImage3D(_t,me,Y.x,Y.y,Y.z,Ve,Xe,it,at,rt,Xt),D.pixelStorei(D.UNPACK_ROW_LENGTH,ht),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,jt),D.pixelStorei(D.UNPACK_SKIP_PIXELS,xn),D.pixelStorei(D.UNPACK_SKIP_ROWS,sn),D.pixelStorei(D.UNPACK_SKIP_IMAGES,In),me===0&&be.generateMipmaps&&D.generateMipmap(_t),le.unbindTexture()},this.initTexture=function(R){R.isCubeTexture?z.setTextureCube(R,0):R.isData3DTexture?z.setTexture3D(R,0):R.isDataArrayTexture||R.isCompressedArrayTexture?z.setTexture2DArray(R,0):z.setTexture2D(R,0),le.unbindTexture()},this.resetState=function(){C=0,T=0,O=null,le.reset(),Ze.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Us}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===ZE?"display-p3":"srgb",t.unpackColorSpace=Gt.workingColorSpace===dp?"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===on?lo:JO}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===lo?on:On}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 UMt extends EI{}UMt.prototype.isWebGL1Renderer=!0;class FMt extends rn{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 BMt{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ub,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 k=e.ray.origin.distanceTo(f);ke.far||t.push({distance:k,point:h.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,o.start),y=Math.min(b.count,o.start+o.count);for(let v=g,S=y-1;vl)continue;f.applyMatrix4(this.matrixWorld);const T=e.ray.origin.distanceTo(f);Te.far||t.push({distance:T,point:h.clone().applyMatrix4(this.matrixWorld),index:v,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:u,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class ay extends Hi{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=XE,this.normalScale=new It(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 Qs extends ay{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 It(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ln(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 Cw extends Hi{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=XE,this.normalScale=new It(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=jE,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 Td(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 jMt(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function QMt(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 ww(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 TI(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 vc{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&&jMt(s))for(let a=0,l=s.length;a!==l;++a){const u=s[a];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,u),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),s=this.getInterpolation()===zm,r=e.length-1;let o=1;for(let a=1;a0){e[o]=e[r];for(let a=r*i,l=o*i,u=0;u!==i;++u)t[l+u]=t[a+u];++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}}gs.prototype.TimeBufferType=Float32Array;gs.prototype.ValueBufferType=Float32Array;gs.prototype.DefaultInterpolation=Ra;class Qa extends gs{}Qa.prototype.ValueTypeName="bool";Qa.prototype.ValueBufferType=Array;Qa.prototype.DefaultInterpolation=oc;Qa.prototype.InterpolantFactoryMethodLinear=void 0;Qa.prototype.InterpolantFactoryMethodSmooth=void 0;class xI extends gs{}xI.prototype.ValueTypeName="color";class Oa extends gs{}Oa.prototype.ValueTypeName="number";class e2t extends vc{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 u=e*a;for(let d=u+a;u!==d;u+=4)Ir.slerpFlat(r,0,o,u-a,o,u,l);return r}}class bo extends gs{InterpolantFactoryMethodLinear(e){return new e2t(this.times,this.values,this.getValueSize(),e)}}bo.prototype.ValueTypeName="quaternion";bo.prototype.DefaultInterpolation=Ra;bo.prototype.InterpolantFactoryMethodSmooth=void 0;class Xa extends gs{}Xa.prototype.ValueTypeName="string";Xa.prototype.ValueBufferType=Array;Xa.prototype.DefaultInterpolation=oc;Xa.prototype.InterpolantFactoryMethodLinear=void 0;Xa.prototype.InterpolantFactoryMethodSmooth=void 0;class Ia extends gs{}Ia.prototype.ValueTypeName="vector";class t2t{constructor(e,t=-1,i,s=oRt){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(i2t(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(gs.toJSON(i[r]));return s}static CreateFromMorphTargetSequence(e,t,i,s){const r=t.length,o=[];for(let a=0;a1){const h=d[1];let f=s[h];f||(s[h]=f=[]),f.push(u)}}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(h,f,_,m,E){if(_.length!==0){const b=[],g=[];TI(_,b,g,m),b.length!==0&&E.push(new h(f,b,g))}},s=[],r=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const u=e.hierarchy||[];for(let h=0;h{t&&t(r),this.manager.itemEnd(e)},0),r;if(Os[e]!==void 0){Os[e].push({onLoad:t,onProgress:i,onError:s});return}Os[e]=[],Os[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(u=>{if(u.status===200||u.status===0){if(u.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||u.body===void 0||u.body.getReader===void 0)return u;const d=Os[e],h=u.body.getReader(),f=u.headers.get("Content-Length")||u.headers.get("X-File-Size"),_=f?parseInt(f):0,m=_!==0;let E=0;const b=new ReadableStream({start(g){y();function y(){h.read().then(({done:v,value:S})=>{if(v)g.close();else{E+=S.byteLength;const C=new ProgressEvent("progress",{lengthComputable:m,loaded:E,total:_});for(let T=0,O=d.length;T{switch(l){case"arraybuffer":return u.arrayBuffer();case"blob":return u.blob();case"document":return u.text().then(d=>new DOMParser().parseFromString(d,a));case"json":return u.json();default:if(a===void 0)return u.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),f=h&&h[1]?h[1].toLowerCase():void 0,_=new TextDecoder(f);return u.arrayBuffer().then(m=>_.decode(m))}}}).then(u=>{Ma.add(e,u);const d=Os[e];delete Os[e];for(let h=0,f=d.length;h{const d=Os[e];if(d===void 0)throw this.manager.itemError(e),u;delete Os[e];for(let h=0,f=d.length;h{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class a2t extends Za{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=Ma.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;const a=ac("img");function l(){d(),Ma.add(e,this),t&&t(this),r.manager.itemEnd(e)}function u(h){d(),s&&s(h),r.manager.itemError(e),r.manager.itemEnd(e)}function d(){a.removeEventListener("load",l,!1),a.removeEventListener("error",u,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",u,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}class wI extends Za{constructor(e){super(e)}load(e,t,i,s){const r=new Nn,o=new a2t(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 hp extends rn{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 fg=new Rt,Rw=new _e,Aw=new _e;class ly{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new It(512,512),this.map=null,this.mapPass=null,this.matrix=new Rt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ey,this._frameExtents=new It(1,1),this._viewportCount=1,this._viewports=[new Kt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;Rw.setFromMatrixPosition(e.matrixWorld),t.position.copy(Rw),Aw.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Aw),t.updateMatrixWorld(),fg.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(fg),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(fg)}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 l2t extends ly{constructor(){super(new zn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=Aa*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 c2t extends hp{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(rn.DEFAULT_UP),this.updateMatrix(),this.target=new rn,this.distance=i,this.angle=s,this.penumbra=r,this.decay=o,this.map=null,this.shadow=new l2t}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 Nw=new Rt,vl=new _e,mg=new _e;class d2t extends ly{constructor(){super(new zn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new It(4,2),this._viewportCount=6,this._viewports=[new Kt(2,1,1,1),new Kt(0,1,1,1),new Kt(3,1,1,1),new Kt(1,1,1,1),new Kt(3,0,1,1),new Kt(1,0,1,1)],this._cubeDirections=[new _e(1,0,0),new _e(-1,0,0),new _e(0,0,1),new _e(0,0,-1),new _e(0,1,0),new _e(0,-1,0)],this._cubeUps=[new _e(0,1,0),new _e(0,1,0),new _e(0,1,0),new _e(0,1,0),new _e(0,0,1),new _e(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()),vl.setFromMatrixPosition(e.matrixWorld),i.position.copy(vl),mg.copy(i.position),mg.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(mg),i.updateMatrixWorld(),s.makeTranslation(-vl.x,-vl.y,-vl.z),Nw.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Nw)}}class u2t extends hp{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 d2t}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 p2t extends ly{constructor(){super(new ny(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class RI extends hp{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(rn.DEFAULT_UP),this.updateMatrix(),this.target=new rn,this.shadow=new p2t}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class _2t extends hp{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Gl{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=Ma.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){Ma.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 cy="\\[\\]\\.:\\/",f2t=new RegExp("["+cy+"]","g"),dy="[^"+cy+"]",m2t="[^"+cy.replace("\\.","")+"]",g2t=/((?:WC+[\/:])*)/.source.replace("WC",dy),b2t=/(WCOD+)?/.source.replace("WCOD",m2t),E2t=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",dy),y2t=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",dy),v2t=new RegExp("^"+g2t+b2t+E2t+y2t+"$"),S2t=["material","materials","bones","map"];class T2t{constructor(e,t,i){const s=i||zt.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 zt{constructor(e,t,i){this.path=t,this.parsedPath=i||zt.parseTrackName(t),this.node=zt.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 zt.Composite(e,t,i):new zt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(f2t,"")}static parseTrackName(e){const t=v2t.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);S2t.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 u=new nDt(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d=0&&a[h]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}u.setExtensions(o),u.setPlugins(a),u.parse(i,s)}parseAsync(e,t){const i=this;return new Promise(function(s,r){i.parse(e,t,s,r)})}}function C2t(){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 Ot={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 w2t{constructor(e){this.parser=e,this.name=Ot.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 B2t{constructor(e){this.parser=e,this.name=Ot.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 u=i.options.manager.getHandler(a.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)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 G2t{constructor(e){this.parser=e,this.name=Ot.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 u=i.options.manager.getHandler(a.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)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 V2t{constructor(e){this.name=Ot.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,u=s.byteLength||0,d=s.count,h=s.byteStride,f=new Uint8Array(a,l,u);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(d,h,f,s.mode,s.filter).then(function(_){return _.buffer}):o.ready.then(function(){const _=new ArrayBuffer(d*h);return o.decodeGltfBuffer(new Uint8Array(_),d,h,f,s.mode,s.filter),_})})}else return null}}class z2t{constructor(e){this.name=Ot.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 u of s.primitives)if(u.mode!==hi.TRIANGLES&&u.mode!==hi.TRIANGLE_STRIP&&u.mode!==hi.TRIANGLE_FAN&&u.mode!==void 0)return null;const o=i.extensions[this.name].attributes,a=[],l={};for(const u in o)a.push(this.parser.getDependency("accessor",o[u]).then(d=>(l[u]=d,l[u])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(u=>{const d=u.pop(),h=d.isGroup?d.children:[d],f=u[0].count,_=[];for(const m of h){const E=new Rt,b=new _e,g=new Ir,y=new _e(1,1,1),v=new YMt(m.geometry,m.material,f);for(let S=0;S0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const tDt=new Rt;class nDt{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new C2t,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 wI(this.options.manager):this.textureLoader=new h2t(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new CI(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 zr(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[u,d]of o.children.entries())r(d,a.children[u])};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(x,T[O*l+1]),l>=3&&b.setZ(x,T[O*l+2]),l>=4&&b.setW(x,T[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 u=this.loadImageSource(t,i).then(function(d){d.flipY=!1,d.name=o.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const f=(r.samplers||{})[o.sampler]||{};return d.magFilter=Mw[f.magFilter]||jn,d.minFilter=Mw[f.minFilter]||fo,d.wrapS=Dw[f.wrapS]||Ca,d.wrapT=Dw[f.wrapT]||Ca,s.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[l]=u,u}loadImageSource(e,t){const i=this,s=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());const o=s.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",u=!1;if(o.bufferView!==void 0)l=i.getDependency("bufferView",o.bufferView).then(function(h){u=!0;const f=new Blob([h],{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 d=Promise.resolve(l).then(function(h){return new Promise(function(f,_){let m=f;t.isImageBitmapLoader===!0&&(m=function(E){const b=new Nn(E);b.needsUpdate=!0,f(b)}),t.load(Gl.resolveURL(h,r.path),m,void 0,_)})}).then(function(h){return u===!0&&a.revokeObjectURL(l),h.userData.mimeType=o.mimeType||eDt(o.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),h});return this.sourceCache[e]=d,d}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[Ot.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[Ot.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=r.associations.get(o);o=r.extensions[Ot.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 SI,Hi.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 vI,Hi.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 ay}loadMaterial(e){const t=this,i=this.json,s=this.extensions,r=i.materials[e];let o;const a={},l=r.extensions||{},u=[];if(l[Ot.KHR_MATERIALS_UNLIT]){const h=s[Ot.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),u.push(h.extendParams(a,r,t))}else{const h=r.pbrMetallicRoughness||{};if(a.color=new gt(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){const f=h.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],On),a.opacity=f[3]}h.baseColorTexture!==void 0&&u.push(t.assignTexture(a,"map",h.baseColorTexture,on)),a.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,a.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(u.push(t.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),u.push(t.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),u.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}r.doubleSided===!0&&(a.side=ts);const d=r.alphaMode||bg.OPAQUE;if(d===bg.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===bg.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&o!==Er&&(u.push(t.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new It(1,1),r.normalTexture.scale!==void 0)){const h=r.normalTexture.scale;a.normalScale.set(h,h)}if(r.occlusionTexture!==void 0&&o!==Er&&(u.push(t.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&o!==Er){const h=r.emissiveFactor;a.emissive=new gt().setRGB(h[0],h[1],h[2],On)}return r.emissiveTexture!==void 0&&o!==Er&&u.push(t.assignTexture(a,"emissiveMap",r.emissiveTexture,on)),Promise.all(u).then(function(){const h=new o(a);return r.name&&(h.name=r.name),fr(h,r),t.associations.set(h,{materials:e}),r.extensions&&zr(s,h,r),h})}createUniqueName(e){const t=zt.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[Ot.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return kw(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&Z2t(g,r),g.name=t.createUniqueName(r.name||"mesh_"+e),fr(g,r),b.extensions&&zr(s,g,b),t.assignFinalMaterial(g),h.push(g)}for(let _=0,m=h.length;_1?d=new to:u.length===1?d=u[0]:d=new rn,d!==u[0])for(let h=0,f=u.length;h{const h=new Map;for(const[f,_]of s.associations)(f instanceof Hi||f instanceof Nn)&&h.set(f,_);return d.traverse(f=>{const _=s.associations.get(f);_!=null&&h.set(f,_)}),h};return s.associations=u(r),r})}_createAnimationTracks(e,t,i,s,r){const o=[],a=e.name?e.name:e.uuid,l=[];or[r.path]===or.weights?e.traverse(function(f){f.morphTargetInfluences&&l.push(f.name?f.name:f.uuid)}):l.push(a);let u;switch(or[r.path]){case or.weights:u=Oa;break;case or.rotation:u=bo;break;case or.position:case or.scale:u=Ia;break;default:switch(i.itemSize){case 1:u=Oa;break;case 2:case 3:default:u=Ia;break}break}const d=s.interpolation!==void 0?j2t[s.interpolation]:Ra,h=this._getArrayFromAccessor(i);for(let f=0,_=l.length;f<_;f++){const m=new u(l[f]+"."+or[r.path],t.array,h,d);s.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(m),o.push(m)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const i=bb(t.constructor),s=new Float32Array(t.length);for(let r=0,o=t.length;r{He.replace()})},stopVideoStream(){this.isVideoActive=!1,this.imageData=null,Ye.emit("stop_webcam_video_stream"),Ge(()=>{He.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(){He.replace(),Ye.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)}})}},rDt=["src"],oDt=["src"],aDt={class:"controls"},lDt=c("i",{"data-feather":"video"},null,-1),cDt=[lDt],dDt=c("i",{"data-feather":"video"},null,-1),uDt=[dDt],pDt={key:2};function _Dt(n,e,t,i,s,r){return w(),A("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]=ge((...o)=>r.startDrag&&r.startDrag(...o),["stop"])),onMouseup:e[5]||(e[5]=ge((...o)=>r.stopDrag&&r.stopDrag(...o),["stop"]))},[c("div",{class:"handle",onMousedown:e[0]||(e[0]=ge((...o)=>r.startDrag&&r.startDrag(...o),["stop"])),onMouseup:e[1]||(e[1]=ge((...o)=>r.stopDrag&&r.stopDrag(...o),["stop"]))},"Drag Me",32),s.isVideoActive&&s.imageDataUrl!=null?(w(),A("img",{key:0,src:s.imageDataUrl,alt:"Webcam Frame",width:"300",height:"300"},null,8,rDt)):V("",!0),s.isVideoActive&&s.imageDataUrl==null?(w(),A("p",{key:1,src:s.imageDataUrl,alt:"Webcam Frame",width:"300",height:"300"},"Loading. Please wait...",8,oDt)):V("",!0),c("div",aDt,[s.isVideoActive?V("",!0):(w(),A("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))},cDt)),s.isVideoActive?(w(),A("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))},uDt)):V("",!0),s.isVideoActive?(w(),A("span",pDt,"FPS: "+he(s.frameRate),1)):V("",!0)])],36)}const hDt=bt(sDt,[["render",_Dt]]);const fDt={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(){Ye.emit("start_audio_stream",()=>{this.isAudioActive=!0}),Ge(()=>{He.replace()})},stopAudioStream(){Ye.emit("stop_audio_stream",()=>{this.isAudioActive=!1,this.imageDataUrl=null}),Ge(()=>{He.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(){He.replace(),Ye.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)}})}},mDt=["src"],gDt={class:"controls"},bDt=c("i",{"data-feather":"mic"},null,-1),EDt=[bDt],yDt=c("i",{"data-feather":"mic"},null,-1),vDt=[yDt];function SDt(n,e,t,i,s,r){return w(),A("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]=ge((...o)=>r.startDrag&&r.startDrag(...o),["stop"])),onMouseup:e[5]||(e[5]=ge((...o)=>r.stopDrag&&r.stopDrag(...o),["stop"]))},[c("div",{class:"handle",onMousedown:e[0]||(e[0]=ge((...o)=>r.startDrag&&r.startDrag(...o),["stop"])),onMouseup:e[1]||(e[1]=ge((...o)=>r.stopDrag&&r.stopDrag(...o),["stop"]))},"Drag Me",32),s.isAudioActive&&s.imageDataUrl!=null?(w(),A("img",{key:0,src:s.imageDataUrl,alt:"Spectrogram",width:"300",height:"300"},null,8,mDt)):V("",!0),c("div",gDt,[s.isAudioActive?V("",!0):(w(),A("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))},EDt)),s.isAudioActive?(w(),A("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))},vDt)):V("",!0)])],36)}const TDt=bt(fDt,[["render",SDt]]);const xDt={data(){return{activePersonality:null}},props:{personality:{type:Object,default:()=>({})}},components:{VideoFrame:hDt,AudioFrame:TDt},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(),Ge(()=>{He.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 FMt,this.camera=new zn(75,window.innerWidth/window.innerHeight,.1,1e3),this.renderer=new EI,this.renderer.setSize(window.innerWidth,window.innerHeight),this.$refs.webglContainer.appendChild(this.renderer.domElement);const n=new Cr,e=new Cw({color:65280});this.cube=new Hn(n,e),this.scene.add(this.cube);const t=new _2t(4210752),i=new RI(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 x2t().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 wI().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 Cw({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)}}},CDt={ref:"webglContainer"},wDt={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"},RDt={key:0,class:"text-center"},ADt={key:1,class:"text-center"},NDt={class:"floating-frame2"},ODt=["innerHTML"];function IDt(n,e,t,i,s,r){const o=mt("VideoFrame"),a=mt("AudioFrame");return w(),A($e,null,[c("div",CDt,null,512),c("div",wDt,[!s.activePersonality||!s.activePersonality.scene_path?(w(),A("div",RDt," Personality does not have a 3d avatar. ")):V("",!0),!s.activePersonality||!s.activePersonality.avatar||s.activePersonality.avatar===""?(w(),A("div",ADt," Personality does not have an avatar. ")):V("",!0),c("div",NDt,[c("div",{innerHTML:n.htmlContent},null,8,ODt)])]),Te(o,{ref:"video_frame"},null,512),Te(a,{ref:"audio_frame"},null,512)],64)}const MDt=bt(xDt,[["render",IDt]]);let xd;const DDt=new Uint8Array(16);function kDt(){if(!xd&&(xd=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!xd))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return xd(DDt)}const Cn=[];for(let n=0;n<256;++n)Cn.push((n+256).toString(16).slice(1));function LDt(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 PDt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Lw={randomUUID:PDt};function Gs(n,e,t){if(Lw.randomUUID&&!e&&!n)return Lw.randomUUID();n=n||{};const i=n.random||(n.rng||kDt)();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 LDt(i)}class co{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 RMt(n,e,t){let i=new ey;const s=new It,r=new It,o=new Kt,a=new TMt({depthPacking:lRt}),l=new xMt,u={},d=t.maxTextureSize,h={[Ys]:Zn,[Zn]:Ys,[ts]:ts},f=new go({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new It},radius:{value:4}},vertexShader:CMt,fragmentShader:wMt}),_=f.clone();_.defines.HORIZONTAL_PASS=1;const m=new ms;m.setAttribute("position",new Yn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new Hn(m,f),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=zO;let g=this.type;this.render=function(C,T,O){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||C.length===0)return;const k=n.getRenderTarget(),x=n.getActiveCubeFace(),I=n.getActiveMipmapLevel(),F=n.state;F.setBlending(Sr),F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);const B=g!==Ms&&this.type===Ms,ne=g===Ms&&this.type!==Ms;for(let L=0,$=C.length;L<$;L++){const H=C[L],U=H.shadow;if(U===void 0){console.warn("THREE.WebGLShadowMap:",H,"has no shadow.");continue}if(U.autoUpdate===!1&&U.needsUpdate===!1)continue;s.copy(U.mapSize);const Q=U.getFrameExtents();if(s.multiply(Q),r.copy(U.mapSize),(s.x>d||s.y>d)&&(s.x>d&&(r.x=Math.floor(d/Q.x),s.x=r.x*Q.x,U.mapSize.x=r.x),s.y>d&&(r.y=Math.floor(d/Q.y),s.y=r.y*Q.y,U.mapSize.y=r.y)),U.map===null||B===!0||ne===!0){const j=this.type!==Ms?{minFilter:yn,magFilter:yn}:{};U.map!==null&&U.map.dispose(),U.map=new mo(s.x,s.y,j),U.map.texture.name=H.name+".shadowMap",U.camera.updateProjectionMatrix()}n.setRenderTarget(U.map),n.clear();const J=U.getViewportCount();for(let j=0;j0||T.map&&T.alphaTest>0){const F=x.uuid,B=T.uuid;let ne=u[F];ne===void 0&&(ne={},u[F]=ne);let L=ne[B];L===void 0&&(L=x.clone(),ne[B]=L),x=L}if(x.visible=T.visible,x.wireframe=T.wireframe,k===Ms?x.side=T.shadowSide!==null?T.shadowSide:T.side:x.side=T.shadowSide!==null?T.shadowSide:h[T.side],x.alphaMap=T.alphaMap,x.alphaTest=T.alphaTest,x.map=T.map,x.clipShadows=T.clipShadows,x.clippingPlanes=T.clippingPlanes,x.clipIntersection=T.clipIntersection,x.displacementMap=T.displacementMap,x.displacementScale=T.displacementScale,x.displacementBias=T.displacementBias,x.wireframeLinewidth=T.wireframeLinewidth,x.linewidth=T.linewidth,O.isPointLight===!0&&x.isMeshDistanceMaterial===!0){const F=n.properties.get(x);F.light=O}return x}function S(C,T,O,k,x){if(C.visible===!1)return;if(C.layers.test(T.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&x===Ms)&&(!C.frustumCulled||i.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(O.matrixWorldInverse,C.matrixWorld);const B=e.update(C),ne=C.material;if(Array.isArray(ne)){const L=B.groups;for(let $=0,H=L.length;$=1):j.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(j)[1]),Q=J>=2);let ae=null,ve={};const ee=n.getParameter(n.SCISSOR_BOX),Ee=n.getParameter(n.VIEWPORT),xe=new Kt().fromArray(ee),Me=new Kt().fromArray(Ee);function Z(oe,Ke,Ue,Oe){const Be=new Uint8Array(4),dt=n.createTexture();n.bindTexture(oe,dt),n.texParameteri(oe,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(oe,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Et=0;Et"u"?!1:/OculusBrowser/g.test(navigator.userAgent),m=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 y(M,N){return g?new OffscreenCanvas(M,N):ac("canvas")}function v(M,N,W,ue){let X=1;if((M.width>ue||M.height>ue)&&(X=ue/Math.max(M.width,M.height)),X<1||N===!0)if(typeof HTMLImageElement<"u"&&M instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&M instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&M instanceof ImageBitmap){const ie=N?Eu:Math.floor,Ae=ie(X*M.width),Ce=ie(X*M.height);E===void 0&&(E=y(Ae,Ce));const ke=W?y(Ae,Ce):E;return ke.width=Ae,ke.height=Ce,ke.getContext("2d").drawImage(M,0,0,Ae,Ce),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+M.width+"x"+M.height+") to ("+Ae+"x"+Ce+")."),ke}else return"data"in M&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+M.width+"x"+M.height+")."),M;return M}function S(M){return _b(M.width)&&_b(M.height)}function C(M){return a?!1:M.wrapS!==mi||M.wrapT!==mi||M.minFilter!==yn&&M.minFilter!==jn}function T(M,N){return M.generateMipmaps&&N&&M.minFilter!==yn&&M.minFilter!==jn}function O(M){n.generateMipmap(M)}function k(M,N,W,ue,X=!1){if(a===!1)return N;if(M!==null){if(n[M]!==void 0)return n[M];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+M+"'")}let ie=N;if(N===n.RED&&(W===n.FLOAT&&(ie=n.R32F),W===n.HALF_FLOAT&&(ie=n.R16F),W===n.UNSIGNED_BYTE&&(ie=n.R8)),N===n.RED_INTEGER&&(W===n.UNSIGNED_BYTE&&(ie=n.R8UI),W===n.UNSIGNED_SHORT&&(ie=n.R16UI),W===n.UNSIGNED_INT&&(ie=n.R32UI),W===n.BYTE&&(ie=n.R8I),W===n.SHORT&&(ie=n.R16I),W===n.INT&&(ie=n.R32I)),N===n.RG&&(W===n.FLOAT&&(ie=n.RG32F),W===n.HALF_FLOAT&&(ie=n.RG16F),W===n.UNSIGNED_BYTE&&(ie=n.RG8)),N===n.RGBA){const Ae=X?fu:Gt.getTransfer(ue);W===n.FLOAT&&(ie=n.RGBA32F),W===n.HALF_FLOAT&&(ie=n.RGBA16F),W===n.UNSIGNED_BYTE&&(ie=Ae===Zt?n.SRGB8_ALPHA8:n.RGBA8),W===n.UNSIGNED_SHORT_4_4_4_4&&(ie=n.RGBA4),W===n.UNSIGNED_SHORT_5_5_5_1&&(ie=n.RGB5_A1)}return(ie===n.R16F||ie===n.R32F||ie===n.RG16F||ie===n.RG32F||ie===n.RGBA16F||ie===n.RGBA32F)&&e.get("EXT_color_buffer_float"),ie}function x(M,N,W){return T(M,W)===!0||M.isFramebufferTexture&&M.minFilter!==yn&&M.minFilter!==jn?Math.log2(Math.max(N.width,N.height))+1:M.mipmaps!==void 0&&M.mipmaps.length>0?M.mipmaps.length:M.isCompressedTexture&&Array.isArray(M.image)?N.mipmaps.length:1}function I(M){return M===yn||M===cb||M===Bd?n.NEAREST:n.LINEAR}function F(M){const N=M.target;N.removeEventListener("dispose",F),ne(N),N.isVideoTexture&&m.delete(N)}function B(M){const N=M.target;N.removeEventListener("dispose",B),$(N)}function ne(M){const N=i.get(M);if(N.__webglInit===void 0)return;const W=M.source,ue=b.get(W);if(ue){const X=ue[N.__cacheKey];X.usedTimes--,X.usedTimes===0&&L(M),Object.keys(ue).length===0&&b.delete(W)}i.remove(M)}function L(M){const N=i.get(M);n.deleteTexture(N.__webglTexture);const W=M.source,ue=b.get(W);delete ue[N.__cacheKey],o.memory.textures--}function $(M){const N=M.texture,W=i.get(M),ue=i.get(N);if(ue.__webglTexture!==void 0&&(n.deleteTexture(ue.__webglTexture),o.memory.textures--),M.depthTexture&&M.depthTexture.dispose(),M.isWebGLCubeRenderTarget)for(let X=0;X<6;X++){if(Array.isArray(W.__webglFramebuffer[X]))for(let ie=0;ie=l&&console.warn("THREE.WebGLTextures: Trying to use "+M+" texture units while this GPU supports only "+l),H+=1,M}function J(M){const N=[];return N.push(M.wrapS),N.push(M.wrapT),N.push(M.wrapR||0),N.push(M.magFilter),N.push(M.minFilter),N.push(M.anisotropy),N.push(M.internalFormat),N.push(M.format),N.push(M.type),N.push(M.generateMipmaps),N.push(M.premultiplyAlpha),N.push(M.flipY),N.push(M.unpackAlignment),N.push(M.colorSpace),N.join()}function j(M,N){const W=i.get(M);if(M.isVideoTexture&&re(M),M.isRenderTargetTexture===!1&&M.version>0&&W.__version!==M.version){const ue=M.image;if(ue===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ue.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{fe(W,M,N);return}}t.bindTexture(n.TEXTURE_2D,W.__webglTexture,n.TEXTURE0+N)}function ae(M,N){const W=i.get(M);if(M.version>0&&W.__version!==M.version){fe(W,M,N);return}t.bindTexture(n.TEXTURE_2D_ARRAY,W.__webglTexture,n.TEXTURE0+N)}function ve(M,N){const W=i.get(M);if(M.version>0&&W.__version!==M.version){fe(W,M,N);return}t.bindTexture(n.TEXTURE_3D,W.__webglTexture,n.TEXTURE0+N)}function ee(M,N){const W=i.get(M);if(M.version>0&&W.__version!==M.version){Ne(W,M,N);return}t.bindTexture(n.TEXTURE_CUBE_MAP,W.__webglTexture,n.TEXTURE0+N)}const Ee={[Ca]:n.REPEAT,[mi]:n.CLAMP_TO_EDGE,[hu]:n.MIRRORED_REPEAT},xe={[yn]:n.NEAREST,[cb]:n.NEAREST_MIPMAP_NEAREST,[Bd]:n.NEAREST_MIPMAP_LINEAR,[jn]:n.LINEAR,[qO]:n.LINEAR_MIPMAP_NEAREST,[fo]:n.LINEAR_MIPMAP_LINEAR},Me={[dRt]:n.NEVER,[mRt]:n.ALWAYS,[uRt]:n.LESS,[eI]:n.LEQUAL,[pRt]:n.EQUAL,[fRt]:n.GEQUAL,[_Rt]:n.GREATER,[hRt]:n.NOTEQUAL};function Z(M,N,W){if(W?(n.texParameteri(M,n.TEXTURE_WRAP_S,Ee[N.wrapS]),n.texParameteri(M,n.TEXTURE_WRAP_T,Ee[N.wrapT]),(M===n.TEXTURE_3D||M===n.TEXTURE_2D_ARRAY)&&n.texParameteri(M,n.TEXTURE_WRAP_R,Ee[N.wrapR]),n.texParameteri(M,n.TEXTURE_MAG_FILTER,xe[N.magFilter]),n.texParameteri(M,n.TEXTURE_MIN_FILTER,xe[N.minFilter])):(n.texParameteri(M,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(M,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(M===n.TEXTURE_3D||M===n.TEXTURE_2D_ARRAY)&&n.texParameteri(M,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(N.wrapS!==mi||N.wrapT!==mi)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(M,n.TEXTURE_MAG_FILTER,I(N.magFilter)),n.texParameteri(M,n.TEXTURE_MIN_FILTER,I(N.minFilter)),N.minFilter!==yn&&N.minFilter!==jn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),N.compareFunction&&(n.texParameteri(M,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(M,n.TEXTURE_COMPARE_FUNC,Me[N.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const ue=e.get("EXT_texture_filter_anisotropic");if(N.magFilter===yn||N.minFilter!==Bd&&N.minFilter!==fo||N.type===Ps&&e.has("OES_texture_float_linear")===!1||a===!1&&N.type===rc&&e.has("OES_texture_half_float_linear")===!1)return;(N.anisotropy>1||i.get(N).__currentAnisotropy)&&(n.texParameterf(M,ue.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(N.anisotropy,s.getMaxAnisotropy())),i.get(N).__currentAnisotropy=N.anisotropy)}}function ye(M,N){let W=!1;M.__webglInit===void 0&&(M.__webglInit=!0,N.addEventListener("dispose",F));const ue=N.source;let X=b.get(ue);X===void 0&&(X={},b.set(ue,X));const ie=J(N);if(ie!==M.__cacheKey){X[ie]===void 0&&(X[ie]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,W=!0),X[ie].usedTimes++;const Ae=X[M.__cacheKey];Ae!==void 0&&(X[M.__cacheKey].usedTimes--,Ae.usedTimes===0&&L(N)),M.__cacheKey=ie,M.__webglTexture=X[ie].texture}return W}function fe(M,N,W){let ue=n.TEXTURE_2D;(N.isDataArrayTexture||N.isCompressedArrayTexture)&&(ue=n.TEXTURE_2D_ARRAY),N.isData3DTexture&&(ue=n.TEXTURE_3D);const X=ye(M,N),ie=N.source;t.bindTexture(ue,M.__webglTexture,n.TEXTURE0+W);const Ae=i.get(ie);if(ie.version!==Ae.__version||X===!0){t.activeTexture(n.TEXTURE0+W);const Ce=Gt.getPrimaries(Gt.workingColorSpace),ke=N.colorSpace===bi?null:Gt.getPrimaries(N.colorSpace),Qe=N.colorSpace===bi||Ce===ke?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,N.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,N.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Qe);const ct=C(N)&&S(N.image)===!1;let Pe=v(N.image,ct,!1,d);Pe=ce(N,Pe);const ut=S(Pe)||a,Ze=r.convert(N.format,N.colorSpace);let qe=r.convert(N.type),tt=k(N.internalFormat,Ze,qe,N.colorSpace,N.isVideoTexture);Z(ue,N,ut);let Fe;const pt=N.mipmaps,oe=a&&N.isVideoTexture!==!0&&tt!==XO,Ke=Ae.__version===void 0||X===!0,Ue=x(N,Pe,ut);if(N.isDepthTexture)tt=n.DEPTH_COMPONENT,a?N.type===Ps?tt=n.DEPTH_COMPONENT32F:N.type===br?tt=n.DEPTH_COMPONENT24:N.type===oo?tt=n.DEPTH24_STENCIL8:tt=n.DEPTH_COMPONENT16:N.type===Ps&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),N.format===ao&&tt===n.DEPTH_COMPONENT&&N.type!==QE&&N.type!==br&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),N.type=br,qe=r.convert(N.type)),N.format===wa&&tt===n.DEPTH_COMPONENT&&(tt=n.DEPTH_STENCIL,N.type!==oo&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),N.type=oo,qe=r.convert(N.type))),Ke&&(oe?t.texStorage2D(n.TEXTURE_2D,1,tt,Pe.width,Pe.height):t.texImage2D(n.TEXTURE_2D,0,tt,Pe.width,Pe.height,0,Ze,qe,null));else if(N.isDataTexture)if(pt.length>0&&ut){oe&&Ke&&t.texStorage2D(n.TEXTURE_2D,Ue,tt,pt[0].width,pt[0].height);for(let Oe=0,Be=pt.length;Oe>=1,Be>>=1}}else if(pt.length>0&&ut){oe&&Ke&&t.texStorage2D(n.TEXTURE_2D,Ue,tt,pt[0].width,pt[0].height);for(let Oe=0,Be=pt.length;Oe0&&Ke++,t.texStorage2D(n.TEXTURE_CUBE_MAP,Ke,Fe,Pe[0].width,Pe[0].height));for(let Oe=0;Oe<6;Oe++)if(ct){pt?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Oe,0,0,0,Pe[Oe].width,Pe[Oe].height,qe,tt,Pe[Oe].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Oe,0,Fe,Pe[Oe].width,Pe[Oe].height,0,qe,tt,Pe[Oe].data);for(let Be=0;Be>ie),Pe=Math.max(1,N.height>>ie);X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY?t.texImage3D(X,ie,ke,ct,Pe,N.depth,0,Ae,Ce,null):t.texImage2D(X,ie,ke,ct,Pe,0,Ae,Ce,null)}t.bindFramebuffer(n.FRAMEBUFFER,M),pe(N)?f.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,ue,X,i.get(W).__webglTexture,0,z(N)):(X===n.TEXTURE_2D||X>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&X<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,ue,X,i.get(W).__webglTexture,ie),t.bindFramebuffer(n.FRAMEBUFFER,null)}function D(M,N,W){if(n.bindRenderbuffer(n.RENDERBUFFER,M),N.depthBuffer&&!N.stencilBuffer){let ue=a===!0?n.DEPTH_COMPONENT24:n.DEPTH_COMPONENT16;if(W||pe(N)){const X=N.depthTexture;X&&X.isDepthTexture&&(X.type===Ps?ue=n.DEPTH_COMPONENT32F:X.type===br&&(ue=n.DEPTH_COMPONENT24));const ie=z(N);pe(N)?f.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ie,ue,N.width,N.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,ie,ue,N.width,N.height)}else n.renderbufferStorage(n.RENDERBUFFER,ue,N.width,N.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,M)}else if(N.depthBuffer&&N.stencilBuffer){const ue=z(N);W&&pe(N)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,ue,n.DEPTH24_STENCIL8,N.width,N.height):pe(N)?f.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ue,n.DEPTH24_STENCIL8,N.width,N.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,N.width,N.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,M)}else{const ue=N.isWebGLMultipleRenderTargets===!0?N.texture:[N.texture];for(let X=0;X0){W.__webglFramebuffer[Ce]=[];for(let ke=0;ke0){W.__webglFramebuffer=[];for(let Ce=0;Ce0&&pe(M)===!1){const Ce=ie?N:[N];W.__webglMultisampledFramebuffer=n.createFramebuffer(),W.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,W.__webglMultisampledFramebuffer);for(let ke=0;ke0)for(let ke=0;ke0)for(let ke=0;ke0&&pe(M)===!1){const N=M.isWebGLMultipleRenderTargets?M.texture:[M.texture],W=M.width,ue=M.height;let X=n.COLOR_BUFFER_BIT;const ie=[],Ae=M.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Ce=i.get(M),ke=M.isWebGLMultipleRenderTargets===!0;if(ke)for(let Qe=0;Qe0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&N.__useRenderToTexture!==!1}function re(M){const N=o.render.frame;m.get(M)!==N&&(m.set(M,N),M.update())}function ce(M,N){const W=M.colorSpace,ue=M.format,X=M.type;return M.isCompressedTexture===!0||M.isVideoTexture===!0||M.format===pb||W!==On&&W!==bi&&(Gt.getTransfer(W)===Zt?a===!1?e.has("EXT_sRGB")===!0&&ue===gi?(M.format=pb,M.minFilter=jn,M.generateMipmaps=!1):N=nI.sRGBToLinear(N):(ue!==gi||X!==xr)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",W)),N}this.allocateTextureUnit=Q,this.resetTextureUnits=U,this.setTexture2D=j,this.setTexture2DArray=ae,this.setTexture3D=ve,this.setTextureCube=ee,this.rebindTextures=de,this.setupRenderTarget=le,this.updateRenderTargetMipmap=Re,this.updateMultisampleRenderTarget=Ie,this.setupDepthRenderbuffer=K,this.setupFrameBufferTexture=Le,this.useMultisampledRTT=pe}function OMt(n,e,t){const i=t.isWebGL2;function s(r,o=bi){let a;const l=Gt.getTransfer(o);if(r===xr)return n.UNSIGNED_BYTE;if(r===$O)return n.UNSIGNED_SHORT_4_4_4_4;if(r===WO)return n.UNSIGNED_SHORT_5_5_5_1;if(r===Xwt)return n.BYTE;if(r===Zwt)return n.SHORT;if(r===QE)return n.UNSIGNED_SHORT;if(r===YO)return n.INT;if(r===br)return n.UNSIGNED_INT;if(r===Ps)return n.FLOAT;if(r===rc)return i?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(r===Jwt)return n.ALPHA;if(r===gi)return n.RGBA;if(r===eRt)return n.LUMINANCE;if(r===tRt)return n.LUMINANCE_ALPHA;if(r===ao)return n.DEPTH_COMPONENT;if(r===wa)return n.DEPTH_STENCIL;if(r===pb)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(r===nRt)return n.RED;if(r===KO)return n.RED_INTEGER;if(r===iRt)return n.RG;if(r===jO)return n.RG_INTEGER;if(r===QO)return n.RGBA_INTEGER;if(r===Um||r===Fm||r===Bm||r===Gm)if(l===Zt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(r===Um)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Fm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Bm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Gm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(r===Um)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Fm)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Bm)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Gm)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===jC||r===QC||r===XC||r===ZC)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(r===jC)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===QC)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===XC)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===ZC)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===XO)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===JC||r===e1)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(r===JC)return l===Zt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(r===e1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===t1||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)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(r===t1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===n1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===i1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===s1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===r1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===o1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===a1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===l1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===c1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===d1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===u1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===p1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===_1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===h1)return l===Zt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===Vm||r===f1||r===m1)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(r===Vm)return l===Zt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===f1)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===m1)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===sRt||r===g1||r===b1||r===E1)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(r===Vm)return a.COMPRESSED_RED_RGTC1_EXT;if(r===g1)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===b1)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===E1)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===oo?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 IMt extends zn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class to extends rn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const MMt={type:"move"};class ug{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new to,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 to,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new _e,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new _e),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new to,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new _e,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new _e),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,u=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(u&&e.hand){o=!0;for(const E of e.hand.values()){const b=t.getJointPose(E,i),g=this._getHandJoint(u,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 d=u.joints["index-finger-tip"],h=u.joints["thumb-tip"],f=d.position.distanceTo(h.position),_=.02,m=.005;u.inputState.pinching&&f>_+m?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&f<=_-m&&(u.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(MMt)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=r!==null),u!==null&&(u.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new to;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class DMt extends Ka{constructor(e,t){super();const i=this;let s=null,r=1,o=null,a="local-floor",l=1,u=null,d=null,h=null,f=null,_=null,m=null;const E=t.getContextAttributes();let b=null,g=null;const y=[],v=[],S=new It;let C=null;const T=new zn;T.layers.enable(1),T.viewport=new Kt;const O=new zn;O.layers.enable(2),O.viewport=new Kt;const k=[T,O],x=new IMt;x.layers.enable(1),x.layers.enable(2);let I=null,F=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ee){let Ee=y[ee];return Ee===void 0&&(Ee=new ug,y[ee]=Ee),Ee.getTargetRaySpace()},this.getControllerGrip=function(ee){let Ee=y[ee];return Ee===void 0&&(Ee=new ug,y[ee]=Ee),Ee.getGripSpace()},this.getHand=function(ee){let Ee=y[ee];return Ee===void 0&&(Ee=new ug,y[ee]=Ee),Ee.getHandSpace()};function B(ee){const Ee=v.indexOf(ee.inputSource);if(Ee===-1)return;const xe=y[Ee];xe!==void 0&&(xe.update(ee.inputSource,ee.frame,u||o),xe.dispatchEvent({type:ee.type,data:ee.inputSource}))}function ne(){s.removeEventListener("select",B),s.removeEventListener("selectstart",B),s.removeEventListener("selectend",B),s.removeEventListener("squeeze",B),s.removeEventListener("squeezestart",B),s.removeEventListener("squeezeend",B),s.removeEventListener("end",ne),s.removeEventListener("inputsourceschange",L);for(let ee=0;ee=0&&(v[Me]=null,y[Me].disconnect(xe))}for(let Ee=0;Ee=v.length){v.push(xe),Me=ye;break}else if(v[ye]===null){v[ye]=xe,Me=ye;break}if(Me===-1)break}const Z=y[Me];Z&&Z.connect(xe)}}const $=new _e,H=new _e;function U(ee,Ee,xe){$.setFromMatrixPosition(Ee.matrixWorld),H.setFromMatrixPosition(xe.matrixWorld);const Me=$.distanceTo(H),Z=Ee.projectionMatrix.elements,ye=xe.projectionMatrix.elements,fe=Z[14]/(Z[10]-1),Ne=Z[14]/(Z[10]+1),Le=(Z[9]+1)/Z[5],D=(Z[9]-1)/Z[5],q=(Z[8]-1)/Z[0],K=(ye[8]+1)/ye[0],de=fe*q,le=fe*K,Re=Me/(-q+K),Ie=Re*-q;Ee.matrixWorld.decompose(ee.position,ee.quaternion,ee.scale),ee.translateX(Ie),ee.translateZ(Re),ee.matrixWorld.compose(ee.position,ee.quaternion,ee.scale),ee.matrixWorldInverse.copy(ee.matrixWorld).invert();const z=fe+Re,pe=Ne+Re,re=de-Ie,ce=le+(Me-Ie),M=Le*Ne/pe*z,N=D*Ne/pe*z;ee.projectionMatrix.makePerspective(re,ce,M,N,z,pe),ee.projectionMatrixInverse.copy(ee.projectionMatrix).invert()}function Q(ee,Ee){Ee===null?ee.matrixWorld.copy(ee.matrix):ee.matrixWorld.multiplyMatrices(Ee.matrixWorld,ee.matrix),ee.matrixWorldInverse.copy(ee.matrixWorld).invert()}this.updateCamera=function(ee){if(s===null)return;x.near=O.near=T.near=ee.near,x.far=O.far=T.far=ee.far,(I!==x.near||F!==x.far)&&(s.updateRenderState({depthNear:x.near,depthFar:x.far}),I=x.near,F=x.far);const Ee=ee.parent,xe=x.cameras;Q(x,Ee);for(let Me=0;Me0&&(b.alphaTest.value=g.alphaTest);const y=e.get(g).envMap;if(y&&(b.envMap.value=y,b.flipEnvMap.value=y.isCubeTexture&&y.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 v=n._useLegacyLights===!0?Math.PI:1;b.lightMapIntensity.value=g.lightMapIntensity*v,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,y,v){b.diffuse.value.copy(g.color),b.opacity.value=g.opacity,b.size.value=g.size*y,b.scale.value=v*.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 u(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 d(b,g){b.specular.value.copy(g.specular),b.shininess.value=Math.max(g.shininess,1e-4)}function h(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 _(b,g,y){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=y.texture,b.transmissionSamplerSize.value.set(y.width,y.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 m(b,g){g.matcap&&(b.matcap.value=g.matcap)}function E(b,g){const y=e.get(g).light;b.referencePosition.value.setFromMatrixPosition(y.matrixWorld),b.nearDistance.value=y.shadow.camera.near,b.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function LMt(n,e,t,i){let s={},r={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(y,v){const S=v.program;i.uniformBlockBinding(y,S)}function u(y,v){let S=s[y.id];S===void 0&&(m(y),S=d(y),s[y.id]=S,y.addEventListener("dispose",b));const C=v.program;i.updateUBOMapping(y,C);const T=e.render.frame;r[y.id]!==T&&(f(y),r[y.id]=T)}function d(y){const v=h();y.__bindingPointIndex=v;const S=n.createBuffer(),C=y.__size,T=y.usage;return n.bindBuffer(n.UNIFORM_BUFFER,S),n.bufferData(n.UNIFORM_BUFFER,C,T),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,v,S),S}function h(){for(let y=0;y0){T=S%C;const B=C-T;T!==0&&B-I.boundary<0&&(S+=C-T,x.__offset=S)}S+=I.storage}return T=S%C,T>0&&(S+=C-T),y.__size=S,y.__cache={},this}function E(y){const v={boundary:0,storage:0};return typeof y=="number"?(v.boundary=4,v.storage=4):y.isVector2?(v.boundary=8,v.storage=8):y.isVector3||y.isColor?(v.boundary=16,v.storage=12):y.isVector4?(v.boundary=16,v.storage=16):y.isMatrix3?(v.boundary=48,v.storage=48):y.isMatrix4?(v.boundary=64,v.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),v}function b(y){const v=y.target;v.removeEventListener("dispose",b);const S=o.indexOf(v.__bindingPointIndex);o.splice(S,1),n.deleteBuffer(s[v.id]),delete s[v.id],delete r[v.id]}function g(){for(const y in s)n.deleteBuffer(s[y]);o=[],s={},r={}}return{bind:l,update:u,dispose:g}}class EI{constructor(e={}){const{canvas:t=MRt(),context:i=null,depth:s=!0,stencil:r=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:u=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let f;i!==null?f=i.getContextAttributes().alpha:f=o;const _=new Uint32Array(4),m=new Int32Array(4);let E=null,b=null;const g=[],y=[];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=on,this._useLegacyLights=!1,this.toneMapping=Tr,this.toneMappingExposure=1;const v=this;let S=!1,C=0,T=0,O=null,k=-1,x=null;const I=new Kt,F=new Kt;let B=null;const ne=new gt(0);let L=0,$=t.width,H=t.height,U=1,Q=null,J=null;const j=new Kt(0,0,$,H),ae=new Kt(0,0,$,H);let ve=!1;const ee=new ey;let Ee=!1,xe=!1,Me=null;const Z=new Rt,ye=new It,fe=new _e,Ne={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Le(){return O===null?U:1}let D=i;function q(R,Y){for(let te=0;te{function Ve(){if(be.forEach(function(Xe){Ie.get(Xe).currentProgram.isReady()&&be.delete(Xe)}),be.size===0){me(R);return}setTimeout(Ve,10)}K.get("KHR_parallel_shader_compile")!==null?Ve():setTimeout(Ve,10)})};let Et=null;function Qt(R){Et&&Et(R)}function cn(){$t.stop()}function Ct(){$t.start()}const $t=new pI;$t.setAnimationLoop(Qt),typeof self<"u"&&$t.setContext(self),this.setAnimationLoop=function(R){Et=R,Fe.setAnimationLoop(R),R===null?$t.stop():$t.start()},Fe.addEventListener("sessionstart",cn),Fe.addEventListener("sessionend",Ct),this.render=function(R,Y){if(Y!==void 0&&Y.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(S===!0)return;R.matrixWorldAutoUpdate===!0&&R.updateMatrixWorld(),Y.parent===null&&Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),Fe.enabled===!0&&Fe.isPresenting===!0&&(Fe.cameraAutoUpdate===!0&&Fe.updateCamera(Y),Y=Fe.getCamera()),R.isScene===!0&&R.onBeforeRender(v,R,Y,O),b=ie.get(R,y.length),b.init(),y.push(b),Z.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),ee.setFromProjectionMatrix(Z),xe=this.localClippingEnabled,Ee=Ae.init(this.clippingPlanes,xe),E=X.get(R,g.length),E.init(),g.push(E),Sn(R,Y,0,v.sortObjects),E.finish(),v.sortObjects===!0&&E.sort(Q,J),this.info.render.frame++,Ee===!0&&Ae.beginShadows();const te=b.state.shadowsArray;if(Ce.render(te,R,Y),Ee===!0&&Ae.endShadows(),this.info.autoReset===!0&&this.info.reset(),ke.render(E,R),b.setupLights(v._useLegacyLights),Y.isArrayCamera){const be=Y.cameras;for(let me=0,Ve=be.length;me0?b=y[y.length-1]:b=null,g.pop(),g.length>0?E=g[g.length-1]:E=null};function Sn(R,Y,te,be){if(R.visible===!1)return;if(R.layers.test(Y.layers)){if(R.isGroup)te=R.renderOrder;else if(R.isLOD)R.autoUpdate===!0&&R.update(Y);else if(R.isLight)b.pushLight(R),R.castShadow&&b.pushShadow(R);else if(R.isSprite){if(!R.frustumCulled||ee.intersectsSprite(R)){be&&fe.setFromMatrixPosition(R.matrixWorld).applyMatrix4(Z);const Xe=N.update(R),it=R.material;it.visible&&E.push(R,Xe,it,te,fe.z,null)}}else if((R.isMesh||R.isLine||R.isPoints)&&(!R.frustumCulled||ee.intersectsObject(R))){const Xe=N.update(R),it=R.material;if(be&&(R.boundingSphere!==void 0?(R.boundingSphere===null&&R.computeBoundingSphere(),fe.copy(R.boundingSphere.center)):(Xe.boundingSphere===null&&Xe.computeBoundingSphere(),fe.copy(Xe.boundingSphere.center)),fe.applyMatrix4(R.matrixWorld).applyMatrix4(Z)),Array.isArray(it)){const at=Xe.groups;for(let rt=0,_t=at.length;rt<_t;rt++){const ht=at[rt],jt=it[ht.materialIndex];jt&&jt.visible&&E.push(R,Xe,jt,te,fe.z,ht)}}else it.visible&&E.push(R,Xe,it,te,fe.z,null)}}const Ve=R.children;for(let Xe=0,it=Ve.length;Xe0&&Mr(me,Ve,Y,te),be&&le.viewport(I.copy(be)),me.length>0&&ci(me,Y,te),Ve.length>0&&ci(Ve,Y,te),Xe.length>0&&ci(Xe,Y,te),le.buffers.depth.setTest(!0),le.buffers.depth.setMask(!0),le.buffers.color.setMask(!0),le.setPolygonOffset(!1)}function Mr(R,Y,te,be){if((te.isScene===!0?te.overrideMaterial:null)!==null)return;const Ve=de.isWebGL2;Me===null&&(Me=new mo(1,1,{generateMipmaps:!0,type:K.has("EXT_color_buffer_half_float")?rc:xr,minFilter:fo,samples:Ve?4:0})),v.getDrawingBufferSize(ye),Ve?Me.setSize(ye.x,ye.y):Me.setSize(Eu(ye.x),Eu(ye.y));const Xe=v.getRenderTarget();v.setRenderTarget(Me),v.getClearColor(ne),L=v.getClearAlpha(),L<1&&v.setClearColor(16777215,.5),v.clear();const it=v.toneMapping;v.toneMapping=Tr,ci(R,te,be),z.updateMultisampleRenderTarget(Me),z.updateRenderTargetMipmap(Me);let at=!1;for(let rt=0,_t=Y.length;rt<_t;rt++){const ht=Y[rt],jt=ht.object,xn=ht.geometry,sn=ht.material,In=ht.group;if(sn.side===ts&&jt.layers.test(be.layers)){const Xt=sn.side;sn.side=Zn,sn.needsUpdate=!0,Tn(jt,te,be,xn,sn,In),sn.side=Xt,sn.needsUpdate=!0,at=!0}}at===!0&&(z.updateMultisampleRenderTarget(Me),z.updateRenderTargetMipmap(Me)),v.setRenderTarget(Xe),v.setClearColor(ne,L),v.toneMapping=it}function ci(R,Y,te){const be=Y.isScene===!0?Y.overrideMaterial:null;for(let me=0,Ve=R.length;me0),ht=!!te.morphAttributes.position,jt=!!te.morphAttributes.normal,xn=!!te.morphAttributes.color;let sn=Tr;be.toneMapped&&(O===null||O.isXRRenderTarget===!0)&&(sn=v.toneMapping);const In=te.morphAttributes.position||te.morphAttributes.normal||te.morphAttributes.color,Xt=In!==void 0?In.length:0,St=Ie.get(be),el=b.state.lights;if(Ee===!0&&(xe===!0||R!==x)){const Wn=R===x&&be.id===k;Ae.setState(be,R,Wn)}let tn=!1;be.version===St.__version?(St.needsLights&&St.lightsStateVersion!==el.state.version||St.outputColorSpace!==it||me.isBatchedMesh&&St.batching===!1||!me.isBatchedMesh&&St.batching===!0||me.isInstancedMesh&&St.instancing===!1||!me.isInstancedMesh&&St.instancing===!0||me.isSkinnedMesh&&St.skinning===!1||!me.isSkinnedMesh&&St.skinning===!0||me.isInstancedMesh&&St.instancingColor===!0&&me.instanceColor===null||me.isInstancedMesh&&St.instancingColor===!1&&me.instanceColor!==null||St.envMap!==at||be.fog===!0&&St.fog!==Ve||St.numClippingPlanes!==void 0&&(St.numClippingPlanes!==Ae.numPlanes||St.numIntersection!==Ae.numIntersection)||St.vertexAlphas!==rt||St.vertexTangents!==_t||St.morphTargets!==ht||St.morphNormals!==jt||St.morphColors!==xn||St.toneMapping!==sn||de.isWebGL2===!0&&St.morphTargetsCount!==Xt)&&(tn=!0):(tn=!0,St.__version=be.version);let Ss=St.currentProgram;tn===!0&&(Ss=di(be,Y,me));let xc=!1,Dr=!1,tl=!1;const bn=Ss.getUniforms(),Ts=St.uniforms;if(le.useProgram(Ss.program)&&(xc=!0,Dr=!0,tl=!0),be.id!==k&&(k=be.id,Dr=!0),xc||x!==R){bn.setValue(D,"projectionMatrix",R.projectionMatrix),bn.setValue(D,"viewMatrix",R.matrixWorldInverse);const Wn=bn.map.cameraPosition;Wn!==void 0&&Wn.setValue(D,fe.setFromMatrixPosition(R.matrixWorld)),de.logarithmicDepthBuffer&&bn.setValue(D,"logDepthBufFC",2/(Math.log(R.far+1)/Math.LN2)),(be.isMeshPhongMaterial||be.isMeshToonMaterial||be.isMeshLambertMaterial||be.isMeshBasicMaterial||be.isMeshStandardMaterial||be.isShaderMaterial)&&bn.setValue(D,"isOrthographic",R.isOrthographicCamera===!0),x!==R&&(x=R,Dr=!0,tl=!0)}if(me.isSkinnedMesh){bn.setOptional(D,me,"bindMatrix"),bn.setOptional(D,me,"bindMatrixInverse");const Wn=me.skeleton;Wn&&(de.floatVertexTextures?(Wn.boneTexture===null&&Wn.computeBoneTexture(),bn.setValue(D,"boneTexture",Wn.boneTexture,z)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}me.isBatchedMesh&&(bn.setOptional(D,me,"batchingTexture"),bn.setValue(D,"batchingTexture",me._matricesTexture,z));const nl=te.morphAttributes;if((nl.position!==void 0||nl.normal!==void 0||nl.color!==void 0&&de.isWebGL2===!0)&&Qe.update(me,te,Ss),(Dr||St.receiveShadow!==me.receiveShadow)&&(St.receiveShadow=me.receiveShadow,bn.setValue(D,"receiveShadow",me.receiveShadow)),be.isMeshGouraudMaterial&&be.envMap!==null&&(Ts.envMap.value=at,Ts.flipEnvMap.value=at.isCubeTexture&&at.isRenderTargetTexture===!1?-1:1),Dr&&(bn.setValue(D,"toneMappingExposure",v.toneMappingExposure),St.needsLights&&vs(Ts,tl),Ve&&be.fog===!0&&ue.refreshFogUniforms(Ts,Ve),ue.refreshMaterialUniforms(Ts,be,U,H,Me),Gd.upload(D,ji(St),Ts,z)),be.isShaderMaterial&&be.uniformsNeedUpdate===!0&&(Gd.upload(D,ji(St),Ts,z),be.uniformsNeedUpdate=!1),be.isSpriteMaterial&&bn.setValue(D,"center",me.center),bn.setValue(D,"modelViewMatrix",me.modelViewMatrix),bn.setValue(D,"normalMatrix",me.normalMatrix),bn.setValue(D,"modelMatrix",me.matrixWorld),be.isShaderMaterial||be.isRawShaderMaterial){const Wn=be.uniformsGroups;for(let il=0,gp=Wn.length;il0&&z.useMultisampledRTT(R)===!1?me=Ie.get(R).__webglMultisampledFramebuffer:Array.isArray(_t)?me=_t[te]:me=_t,I.copy(R.viewport),F.copy(R.scissor),B=R.scissorTest}else I.copy(j).multiplyScalar(U).floor(),F.copy(ae).multiplyScalar(U).floor(),B=ve;if(le.bindFramebuffer(D.FRAMEBUFFER,me)&&de.drawBuffers&&be&&le.drawBuffers(R,me),le.viewport(I),le.scissor(F),le.setScissorTest(B),Ve){const at=Ie.get(R.texture);D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_CUBE_MAP_POSITIVE_X+Y,at.__webglTexture,te)}else if(Xe){const at=Ie.get(R.texture),rt=Y||0;D.framebufferTextureLayer(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,at.__webglTexture,te||0,rt)}k=-1},this.readRenderTargetPixels=function(R,Y,te,be,me,Ve,Xe){if(!(R&&R.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let it=Ie.get(R).__webglFramebuffer;if(R.isWebGLCubeRenderTarget&&Xe!==void 0&&(it=it[Xe]),it){le.bindFramebuffer(D.FRAMEBUFFER,it);try{const at=R.texture,rt=at.format,_t=at.type;if(rt!==gi&&ut.convert(rt)!==D.getParameter(D.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ht=_t===rc&&(K.has("EXT_color_buffer_half_float")||de.isWebGL2&&K.has("EXT_color_buffer_float"));if(_t!==xr&&ut.convert(_t)!==D.getParameter(D.IMPLEMENTATION_COLOR_READ_TYPE)&&!(_t===Ps&&(de.isWebGL2||K.has("OES_texture_float")||K.has("WEBGL_color_buffer_float")))&&!ht){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y>=0&&Y<=R.width-be&&te>=0&&te<=R.height-me&&D.readPixels(Y,te,be,me,ut.convert(rt),ut.convert(_t),Ve)}finally{const at=O!==null?Ie.get(O).__webglFramebuffer:null;le.bindFramebuffer(D.FRAMEBUFFER,at)}}},this.copyFramebufferToTexture=function(R,Y,te=0){const be=Math.pow(2,-te),me=Math.floor(Y.image.width*be),Ve=Math.floor(Y.image.height*be);z.setTexture2D(Y,0),D.copyTexSubImage2D(D.TEXTURE_2D,te,0,0,R.x,R.y,me,Ve),le.unbindTexture()},this.copyTextureToTexture=function(R,Y,te,be=0){const me=Y.image.width,Ve=Y.image.height,Xe=ut.convert(te.format),it=ut.convert(te.type);z.setTexture2D(te,0),D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,te.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,te.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,te.unpackAlignment),Y.isDataTexture?D.texSubImage2D(D.TEXTURE_2D,be,R.x,R.y,me,Ve,Xe,it,Y.image.data):Y.isCompressedTexture?D.compressedTexSubImage2D(D.TEXTURE_2D,be,R.x,R.y,Y.mipmaps[0].width,Y.mipmaps[0].height,Xe,Y.mipmaps[0].data):D.texSubImage2D(D.TEXTURE_2D,be,R.x,R.y,Xe,it,Y.image),be===0&&te.generateMipmaps&&D.generateMipmap(D.TEXTURE_2D),le.unbindTexture()},this.copyTextureToTexture3D=function(R,Y,te,be,me=0){if(v.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Ve=R.max.x-R.min.x+1,Xe=R.max.y-R.min.y+1,it=R.max.z-R.min.z+1,at=ut.convert(be.format),rt=ut.convert(be.type);let _t;if(be.isData3DTexture)z.setTexture3D(be,0),_t=D.TEXTURE_3D;else if(be.isDataArrayTexture)z.setTexture2DArray(be,0),_t=D.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,be.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,be.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,be.unpackAlignment);const ht=D.getParameter(D.UNPACK_ROW_LENGTH),jt=D.getParameter(D.UNPACK_IMAGE_HEIGHT),xn=D.getParameter(D.UNPACK_SKIP_PIXELS),sn=D.getParameter(D.UNPACK_SKIP_ROWS),In=D.getParameter(D.UNPACK_SKIP_IMAGES),Xt=te.isCompressedTexture?te.mipmaps[0]:te.image;D.pixelStorei(D.UNPACK_ROW_LENGTH,Xt.width),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,Xt.height),D.pixelStorei(D.UNPACK_SKIP_PIXELS,R.min.x),D.pixelStorei(D.UNPACK_SKIP_ROWS,R.min.y),D.pixelStorei(D.UNPACK_SKIP_IMAGES,R.min.z),te.isDataTexture||te.isData3DTexture?D.texSubImage3D(_t,me,Y.x,Y.y,Y.z,Ve,Xe,it,at,rt,Xt.data):te.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),D.compressedTexSubImage3D(_t,me,Y.x,Y.y,Y.z,Ve,Xe,it,at,Xt.data)):D.texSubImage3D(_t,me,Y.x,Y.y,Y.z,Ve,Xe,it,at,rt,Xt),D.pixelStorei(D.UNPACK_ROW_LENGTH,ht),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,jt),D.pixelStorei(D.UNPACK_SKIP_PIXELS,xn),D.pixelStorei(D.UNPACK_SKIP_ROWS,sn),D.pixelStorei(D.UNPACK_SKIP_IMAGES,In),me===0&&be.generateMipmaps&&D.generateMipmap(_t),le.unbindTexture()},this.initTexture=function(R){R.isCubeTexture?z.setTextureCube(R,0):R.isData3DTexture?z.setTexture3D(R,0):R.isDataArrayTexture||R.isCompressedArrayTexture?z.setTexture2DArray(R,0):z.setTexture2D(R,0),le.unbindTexture()},this.resetState=function(){C=0,T=0,O=null,le.reset(),Ze.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Us}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===ZE?"display-p3":"srgb",t.unpackColorSpace=Gt.workingColorSpace===dp?"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===on?lo:JO}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===lo?on:On}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 PMt extends EI{}PMt.prototype.isWebGL1Renderer=!0;class UMt extends rn{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 FMt{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ub,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 k=e.ray.origin.distanceTo(f);ke.far||t.push({distance:k,point:h.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,o.start),y=Math.min(b.count,o.start+o.count);for(let v=g,S=y-1;vl)continue;f.applyMatrix4(this.matrixWorld);const T=e.ray.origin.distanceTo(f);Te.far||t.push({distance:T,point:h.clone().applyMatrix4(this.matrixWorld),index:v,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:u,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class ay extends Hi{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=XE,this.normalScale=new It(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 Qs extends ay{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 It(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ln(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 Cw extends Hi{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=XE,this.normalScale=new It(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=jE,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 Td(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 KMt(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function jMt(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 ww(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 TI(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 vc{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&&KMt(s))for(let a=0,l=s.length;a!==l;++a){const u=s[a];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,u),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),s=this.getInterpolation()===zm,r=e.length-1;let o=1;for(let a=1;a0){e[o]=e[r];for(let a=r*i,l=o*i,u=0;u!==i;++u)t[l+u]=t[a+u];++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}}gs.prototype.TimeBufferType=Float32Array;gs.prototype.ValueBufferType=Float32Array;gs.prototype.DefaultInterpolation=Ra;class Qa extends gs{}Qa.prototype.ValueTypeName="bool";Qa.prototype.ValueBufferType=Array;Qa.prototype.DefaultInterpolation=oc;Qa.prototype.InterpolantFactoryMethodLinear=void 0;Qa.prototype.InterpolantFactoryMethodSmooth=void 0;class xI extends gs{}xI.prototype.ValueTypeName="color";class Oa extends gs{}Oa.prototype.ValueTypeName="number";class JMt extends vc{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 u=e*a;for(let d=u+a;u!==d;u+=4)Ir.slerpFlat(r,0,o,u-a,o,u,l);return r}}class bo extends gs{InterpolantFactoryMethodLinear(e){return new JMt(this.times,this.values,this.getValueSize(),e)}}bo.prototype.ValueTypeName="quaternion";bo.prototype.DefaultInterpolation=Ra;bo.prototype.InterpolantFactoryMethodSmooth=void 0;class Xa extends gs{}Xa.prototype.ValueTypeName="string";Xa.prototype.ValueBufferType=Array;Xa.prototype.DefaultInterpolation=oc;Xa.prototype.InterpolantFactoryMethodLinear=void 0;Xa.prototype.InterpolantFactoryMethodSmooth=void 0;class Ia extends gs{}Ia.prototype.ValueTypeName="vector";class e2t{constructor(e,t=-1,i,s=rRt){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(n2t(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(gs.toJSON(i[r]));return s}static CreateFromMorphTargetSequence(e,t,i,s){const r=t.length,o=[];for(let a=0;a1){const h=d[1];let f=s[h];f||(s[h]=f=[]),f.push(u)}}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(h,f,_,m,E){if(_.length!==0){const b=[],g=[];TI(_,b,g,m),b.length!==0&&E.push(new h(f,b,g))}},s=[],r=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const u=e.hierarchy||[];for(let h=0;h{t&&t(r),this.manager.itemEnd(e)},0),r;if(Os[e]!==void 0){Os[e].push({onLoad:t,onProgress:i,onError:s});return}Os[e]=[],Os[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(u=>{if(u.status===200||u.status===0){if(u.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||u.body===void 0||u.body.getReader===void 0)return u;const d=Os[e],h=u.body.getReader(),f=u.headers.get("Content-Length")||u.headers.get("X-File-Size"),_=f?parseInt(f):0,m=_!==0;let E=0;const b=new ReadableStream({start(g){y();function y(){h.read().then(({done:v,value:S})=>{if(v)g.close();else{E+=S.byteLength;const C=new ProgressEvent("progress",{lengthComputable:m,loaded:E,total:_});for(let T=0,O=d.length;T{switch(l){case"arraybuffer":return u.arrayBuffer();case"blob":return u.blob();case"document":return u.text().then(d=>new DOMParser().parseFromString(d,a));case"json":return u.json();default:if(a===void 0)return u.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),f=h&&h[1]?h[1].toLowerCase():void 0,_=new TextDecoder(f);return u.arrayBuffer().then(m=>_.decode(m))}}}).then(u=>{Ma.add(e,u);const d=Os[e];delete Os[e];for(let h=0,f=d.length;h{const d=Os[e];if(d===void 0)throw this.manager.itemError(e),u;delete Os[e];for(let h=0,f=d.length;h{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class o2t extends Za{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=Ma.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;const a=ac("img");function l(){d(),Ma.add(e,this),t&&t(this),r.manager.itemEnd(e)}function u(h){d(),s&&s(h),r.manager.itemError(e),r.manager.itemEnd(e)}function d(){a.removeEventListener("load",l,!1),a.removeEventListener("error",u,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",u,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}class wI extends Za{constructor(e){super(e)}load(e,t,i,s){const r=new Nn,o=new o2t(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 hp extends rn{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 fg=new Rt,Rw=new _e,Aw=new _e;class ly{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new It(512,512),this.map=null,this.mapPass=null,this.matrix=new Rt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ey,this._frameExtents=new It(1,1),this._viewportCount=1,this._viewports=[new Kt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;Rw.setFromMatrixPosition(e.matrixWorld),t.position.copy(Rw),Aw.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Aw),t.updateMatrixWorld(),fg.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(fg),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(fg)}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 a2t extends ly{constructor(){super(new zn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=Aa*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 l2t extends hp{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(rn.DEFAULT_UP),this.updateMatrix(),this.target=new rn,this.distance=i,this.angle=s,this.penumbra=r,this.decay=o,this.map=null,this.shadow=new a2t}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 Nw=new Rt,vl=new _e,mg=new _e;class c2t extends ly{constructor(){super(new zn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new It(4,2),this._viewportCount=6,this._viewports=[new Kt(2,1,1,1),new Kt(0,1,1,1),new Kt(3,1,1,1),new Kt(1,1,1,1),new Kt(3,0,1,1),new Kt(1,0,1,1)],this._cubeDirections=[new _e(1,0,0),new _e(-1,0,0),new _e(0,0,1),new _e(0,0,-1),new _e(0,1,0),new _e(0,-1,0)],this._cubeUps=[new _e(0,1,0),new _e(0,1,0),new _e(0,1,0),new _e(0,1,0),new _e(0,0,1),new _e(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()),vl.setFromMatrixPosition(e.matrixWorld),i.position.copy(vl),mg.copy(i.position),mg.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(mg),i.updateMatrixWorld(),s.makeTranslation(-vl.x,-vl.y,-vl.z),Nw.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Nw)}}class d2t extends hp{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 c2t}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 u2t extends ly{constructor(){super(new ny(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class RI extends hp{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(rn.DEFAULT_UP),this.updateMatrix(),this.target=new rn,this.shadow=new u2t}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class p2t extends hp{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Gl{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=Ma.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){Ma.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 cy="\\[\\]\\.:\\/",h2t=new RegExp("["+cy+"]","g"),dy="[^"+cy+"]",f2t="[^"+cy.replace("\\.","")+"]",m2t=/((?:WC+[\/:])*)/.source.replace("WC",dy),g2t=/(WCOD+)?/.source.replace("WCOD",f2t),b2t=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",dy),E2t=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",dy),y2t=new RegExp("^"+m2t+g2t+b2t+E2t+"$"),v2t=["material","materials","bones","map"];class S2t{constructor(e,t,i){const s=i||zt.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 zt{constructor(e,t,i){this.path=t,this.parsedPath=i||zt.parseTrackName(t),this.node=zt.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 zt.Composite(e,t,i):new zt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(h2t,"")}static parseTrackName(e){const t=y2t.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);v2t.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 u=new tDt(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d=0&&a[h]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}u.setExtensions(o),u.setPlugins(a),u.parse(i,s)}parseAsync(e,t){const i=this;return new Promise(function(s,r){i.parse(e,t,s,r)})}}function x2t(){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 Ot={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 C2t{constructor(e){this.parser=e,this.name=Ot.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 F2t{constructor(e){this.parser=e,this.name=Ot.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 u=i.options.manager.getHandler(a.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)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 B2t{constructor(e){this.parser=e,this.name=Ot.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 u=i.options.manager.getHandler(a.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)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 G2t{constructor(e){this.name=Ot.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,u=s.byteLength||0,d=s.count,h=s.byteStride,f=new Uint8Array(a,l,u);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(d,h,f,s.mode,s.filter).then(function(_){return _.buffer}):o.ready.then(function(){const _=new ArrayBuffer(d*h);return o.decodeGltfBuffer(new Uint8Array(_),d,h,f,s.mode,s.filter),_})})}else return null}}class V2t{constructor(e){this.name=Ot.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 u of s.primitives)if(u.mode!==hi.TRIANGLES&&u.mode!==hi.TRIANGLE_STRIP&&u.mode!==hi.TRIANGLE_FAN&&u.mode!==void 0)return null;const o=i.extensions[this.name].attributes,a=[],l={};for(const u in o)a.push(this.parser.getDependency("accessor",o[u]).then(d=>(l[u]=d,l[u])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(u=>{const d=u.pop(),h=d.isGroup?d.children:[d],f=u[0].count,_=[];for(const m of h){const E=new Rt,b=new _e,g=new Ir,y=new _e(1,1,1),v=new qMt(m.geometry,m.material,f);for(let S=0;S0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const eDt=new Rt;class tDt{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new x2t,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 wI(this.options.manager):this.textureLoader=new _2t(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new CI(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 zr(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[u,d]of o.children.entries())r(d,a.children[u])};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(x,T[O*l+1]),l>=3&&b.setZ(x,T[O*l+2]),l>=4&&b.setW(x,T[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 u=this.loadImageSource(t,i).then(function(d){d.flipY=!1,d.name=o.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const f=(r.samplers||{})[o.sampler]||{};return d.magFilter=Mw[f.magFilter]||jn,d.minFilter=Mw[f.minFilter]||fo,d.wrapS=Dw[f.wrapS]||Ca,d.wrapT=Dw[f.wrapT]||Ca,s.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[l]=u,u}loadImageSource(e,t){const i=this,s=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());const o=s.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",u=!1;if(o.bufferView!==void 0)l=i.getDependency("bufferView",o.bufferView).then(function(h){u=!0;const f=new Blob([h],{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 d=Promise.resolve(l).then(function(h){return new Promise(function(f,_){let m=f;t.isImageBitmapLoader===!0&&(m=function(E){const b=new Nn(E);b.needsUpdate=!0,f(b)}),t.load(Gl.resolveURL(h,r.path),m,void 0,_)})}).then(function(h){return u===!0&&a.revokeObjectURL(l),h.userData.mimeType=o.mimeType||J2t(o.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),h});return this.sourceCache[e]=d,d}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[Ot.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[Ot.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=r.associations.get(o);o=r.extensions[Ot.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 SI,Hi.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 vI,Hi.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 ay}loadMaterial(e){const t=this,i=this.json,s=this.extensions,r=i.materials[e];let o;const a={},l=r.extensions||{},u=[];if(l[Ot.KHR_MATERIALS_UNLIT]){const h=s[Ot.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),u.push(h.extendParams(a,r,t))}else{const h=r.pbrMetallicRoughness||{};if(a.color=new gt(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){const f=h.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],On),a.opacity=f[3]}h.baseColorTexture!==void 0&&u.push(t.assignTexture(a,"map",h.baseColorTexture,on)),a.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,a.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(u.push(t.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),u.push(t.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),u.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}r.doubleSided===!0&&(a.side=ts);const d=r.alphaMode||bg.OPAQUE;if(d===bg.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===bg.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&o!==Er&&(u.push(t.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new It(1,1),r.normalTexture.scale!==void 0)){const h=r.normalTexture.scale;a.normalScale.set(h,h)}if(r.occlusionTexture!==void 0&&o!==Er&&(u.push(t.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&o!==Er){const h=r.emissiveFactor;a.emissive=new gt().setRGB(h[0],h[1],h[2],On)}return r.emissiveTexture!==void 0&&o!==Er&&u.push(t.assignTexture(a,"emissiveMap",r.emissiveTexture,on)),Promise.all(u).then(function(){const h=new o(a);return r.name&&(h.name=r.name),fr(h,r),t.associations.set(h,{materials:e}),r.extensions&&zr(s,h,r),h})}createUniqueName(e){const t=zt.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[Ot.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return kw(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&X2t(g,r),g.name=t.createUniqueName(r.name||"mesh_"+e),fr(g,r),b.extensions&&zr(s,g,b),t.assignFinalMaterial(g),h.push(g)}for(let _=0,m=h.length;_1?d=new to:u.length===1?d=u[0]:d=new rn,d!==u[0])for(let h=0,f=u.length;h{const h=new Map;for(const[f,_]of s.associations)(f instanceof Hi||f instanceof Nn)&&h.set(f,_);return d.traverse(f=>{const _=s.associations.get(f);_!=null&&h.set(f,_)}),h};return s.associations=u(r),r})}_createAnimationTracks(e,t,i,s,r){const o=[],a=e.name?e.name:e.uuid,l=[];or[r.path]===or.weights?e.traverse(function(f){f.morphTargetInfluences&&l.push(f.name?f.name:f.uuid)}):l.push(a);let u;switch(or[r.path]){case or.weights:u=Oa;break;case or.rotation:u=bo;break;case or.position:case or.scale:u=Ia;break;default:switch(i.itemSize){case 1:u=Oa;break;case 2:case 3:default:u=Ia;break}break}const d=s.interpolation!==void 0?K2t[s.interpolation]:Ra,h=this._getArrayFromAccessor(i);for(let f=0,_=l.length;f<_;f++){const m=new u(l[f]+"."+or[r.path],t.array,h,d);s.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(m),o.push(m)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const i=bb(t.constructor),s=new Float32Array(t.length);for(let r=0,o=t.length;r{He.replace()})},stopVideoStream(){this.isVideoActive=!1,this.imageData=null,Ye.emit("stop_webcam_video_stream"),Ge(()=>{He.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(){He.replace(),Ye.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)}})}},sDt=["src"],rDt=["src"],oDt={class:"controls"},aDt=c("i",{"data-feather":"video"},null,-1),lDt=[aDt],cDt=c("i",{"data-feather":"video"},null,-1),dDt=[cDt],uDt={key:2};function pDt(n,e,t,i,s,r){return w(),A("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]=ge((...o)=>r.startDrag&&r.startDrag(...o),["stop"])),onMouseup:e[5]||(e[5]=ge((...o)=>r.stopDrag&&r.stopDrag(...o),["stop"]))},[c("div",{class:"handle",onMousedown:e[0]||(e[0]=ge((...o)=>r.startDrag&&r.startDrag(...o),["stop"])),onMouseup:e[1]||(e[1]=ge((...o)=>r.stopDrag&&r.stopDrag(...o),["stop"]))},"Drag Me",32),s.isVideoActive&&s.imageDataUrl!=null?(w(),A("img",{key:0,src:s.imageDataUrl,alt:"Webcam Frame",width:"300",height:"300"},null,8,sDt)):V("",!0),s.isVideoActive&&s.imageDataUrl==null?(w(),A("p",{key:1,src:s.imageDataUrl,alt:"Webcam Frame",width:"300",height:"300"},"Loading. Please wait...",8,rDt)):V("",!0),c("div",oDt,[s.isVideoActive?V("",!0):(w(),A("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))},lDt)),s.isVideoActive?(w(),A("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))},dDt)):V("",!0),s.isVideoActive?(w(),A("span",uDt,"FPS: "+he(s.frameRate),1)):V("",!0)])],36)}const _Dt=bt(iDt,[["render",pDt]]);const hDt={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(){Ye.emit("start_audio_stream",()=>{this.isAudioActive=!0}),Ge(()=>{He.replace()})},stopAudioStream(){Ye.emit("stop_audio_stream",()=>{this.isAudioActive=!1,this.imageDataUrl=null}),Ge(()=>{He.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(){He.replace(),Ye.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)}})}},fDt=["src"],mDt={class:"controls"},gDt=c("i",{"data-feather":"mic"},null,-1),bDt=[gDt],EDt=c("i",{"data-feather":"mic"},null,-1),yDt=[EDt];function vDt(n,e,t,i,s,r){return w(),A("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]=ge((...o)=>r.startDrag&&r.startDrag(...o),["stop"])),onMouseup:e[5]||(e[5]=ge((...o)=>r.stopDrag&&r.stopDrag(...o),["stop"]))},[c("div",{class:"handle",onMousedown:e[0]||(e[0]=ge((...o)=>r.startDrag&&r.startDrag(...o),["stop"])),onMouseup:e[1]||(e[1]=ge((...o)=>r.stopDrag&&r.stopDrag(...o),["stop"]))},"Drag Me",32),s.isAudioActive&&s.imageDataUrl!=null?(w(),A("img",{key:0,src:s.imageDataUrl,alt:"Spectrogram",width:"300",height:"300"},null,8,fDt)):V("",!0),c("div",mDt,[s.isAudioActive?V("",!0):(w(),A("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))},bDt)),s.isAudioActive?(w(),A("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))},yDt)):V("",!0)])],36)}const SDt=bt(hDt,[["render",vDt]]);const TDt={data(){return{activePersonality:null}},props:{personality:{type:Object,default:()=>({})}},components:{VideoFrame:_Dt,AudioFrame:SDt},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(),Ge(()=>{He.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 UMt,this.camera=new zn(75,window.innerWidth/window.innerHeight,.1,1e3),this.renderer=new EI,this.renderer.setSize(window.innerWidth,window.innerHeight),this.$refs.webglContainer.appendChild(this.renderer.domElement);const n=new Cr,e=new Cw({color:65280});this.cube=new Hn(n,e),this.scene.add(this.cube);const t=new p2t(4210752),i=new RI(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 T2t().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 wI().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 Cw({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)}}},xDt={ref:"webglContainer"},CDt={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"},wDt={key:0,class:"text-center"},RDt={key:1,class:"text-center"},ADt={class:"floating-frame2"},NDt=["innerHTML"];function ODt(n,e,t,i,s,r){const o=mt("VideoFrame"),a=mt("AudioFrame");return w(),A($e,null,[c("div",xDt,null,512),c("div",CDt,[!s.activePersonality||!s.activePersonality.scene_path?(w(),A("div",wDt," Personality does not have a 3d avatar. ")):V("",!0),!s.activePersonality||!s.activePersonality.avatar||s.activePersonality.avatar===""?(w(),A("div",RDt," Personality does not have an avatar. ")):V("",!0),c("div",ADt,[c("div",{innerHTML:n.htmlContent},null,8,NDt)])]),Te(o,{ref:"video_frame"},null,512),Te(a,{ref:"audio_frame"},null,512)],64)}const IDt=bt(TDt,[["render",ODt]]);let xd;const MDt=new Uint8Array(16);function DDt(){if(!xd&&(xd=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!xd))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return xd(MDt)}const Cn=[];for(let n=0;n<256;++n)Cn.push((n+256).toString(16).slice(1));function kDt(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 LDt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Lw={randomUUID:LDt};function Gs(n,e,t){if(Lw.randomUUID&&!e&&!n)return Lw.randomUUID();n=n||{};const i=n.random||(n.rng||DDt)();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 kDt(i)}class co{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 co{constructor(e){super(),this.entity=e}emit(e){this.listeners.forEach(t=>t(e,this.entity))}}class Un extends co{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 OI extends co{execute(e,t){let i=e;for(const s of this.listeners)i=s(i,t);return i}}class li extends OI{constructor(e){super(),this.entity=e}execute(e){return super.execute(e,this.entity)}}class UDt extends co{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 Xi(){const n=Symbol(),e=new Map,t=new Set,i=(l,u)=>{u instanceof co&&u.registerProxy(n,()=>{var d,h;return(h=(d=e.get(l))===null||d===void 0?void 0:d.listeners)!==null&&h!==void 0?h:[]})},s=l=>{const u=new co;e.set(l,u),t.forEach(d=>i(l,d[l]))},r=l=>{t.add(l);for(const u of e.keys())i(u,l[u])},o=l=>{for(const u of e.keys())l[u]instanceof co&&l[u].unregisterProxy(n);t.delete(l)},a=()=>{t.forEach(l=>o(l)),e.clear()};return new Proxy({},{get(l,u){return u==="addTarget"?r:u==="removeTarget"?o:u==="destroy"?a:typeof u!="string"||u.startsWith("_")?l[u]:(e.has(u)||s(u),e.get(u))}})}class Pw{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=Gs(),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 II{constructor(e,t){if(!e||!t)throw new Error("Cannot initialize connection with null/undefined for 'from' or 'to' values");this.id=Gs(),this.from=e,this.to=t}}function Eb(n,e){return Object.fromEntries(Object.entries(n).map(([t,i])=>[t,e(i)]))}class MI{constructor(){this._title="",this.id=Gs(),this.events={loaded:new qt(this),beforeAddInput:new Un(this),addInput:new qt(this),beforeRemoveInput:new Un(this),removeInput:new qt(this),beforeAddOutput:new Un(this),addOutput:new qt(this),beforeRemoveOutput:new Un(this),removeOutput:new qt(this),beforeTitleChanged:new Un(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=Eb(this.inputs,s=>s.save()),t=Eb(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 DI=class extends MI{load(e){super.load(e)}save(){return super.save()}};function Ja(n){return class extends DI{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 nn{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=Gs(),this.nodeId="",this.port=!0,this.hidden=!1,this.events={setConnectionCount:new qt(this),beforeSetValue:new Un(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 Da="__baklava_SubgraphInputNode",ka="__baklava_SubgraphOutputNode";class kI extends DI{constructor(){super(),this.graphInterfaceId=Gs()}onPlaced(){super.onPlaced(),this.initializeIo()}save(){return{...super.save(),graphInterfaceId:this.graphInterfaceId}}load(e){super.load(e),this.graphInterfaceId=e.graphInterfaceId}}class LI extends kI{constructor(){super(...arguments),this.type=Da,this.inputs={name:new nn("Name","Input")},this.outputs={placeholder:new nn("Value",void 0)}}static isGraphInputNode(e){return e.type===Da}}class PI extends kI{constructor(){super(...arguments),this.type=ka,this.inputs={name:new nn("Name","Output"),placeholder:new nn("Value",void 0)},this.outputs={output:new nn("Output",void 0).setHidden(!0)},this.calculate=({placeholder:e})=>({output:e})}static isGraphOutputNode(e){return e.type===ka}}class Sc{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===Da).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===ka).map(t=>({id:t.graphInterfaceId,name:t.inputs.name.value,nodeId:t.id,nodeInterfaceId:t.outputs.output.id}))}constructor(e,t){this.id=Gs(),this.activeTransactions=0,this._nodes=[],this._connections=[],this._loading=!1,this._destroying=!1,this.events={beforeAddNode:new Un(this),addNode:new qt(this),beforeRemoveNode:new Un(this),removeNode:new qt(this),beforeAddConnection:new Un(this),addConnection:new qt(this),checkConnection:new Un(this),beforeRemoveConnection:new Un(this),removeConnection:new qt(this)},this.hooks={save:new li(this),load:new li(this),checkConnection:new UDt(this)},this.nodeEvents=Xi(),this.nodeHooks=Xi(),this.connectionEvents=Xi(),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 Pw(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 II(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 Pw(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 lc="__baklava_GraphNode-";function La(n){return lc+n.id}function FDt(n){return class extends MI{constructor(){super(...arguments),this.type=La(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 nn(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 nn(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 nn("_calculationResults",void 0).setHidden(!0))}}}class fp{static fromGraph(e,t){return new fp(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(La(this));t&&(t.title=e)}get inputs(){return this.nodes.filter(t=>t.type===Da).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===ka).map(t=>({id:t.graphInterfaceId,name:t.inputs.name.value,nodeId:t.id,nodeInterfaceId:t.outputs.output.id}))}constructor(e,t){this.id=Gs(),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 _=Gs();return t.set(f,_),_},s=f=>{const _=t.get(f);if(!_)throw new Error(`Unable to create graph from template: Could not map old id ${f} to new id`);return _},r=f=>Eb(f,_=>({id:i(_.id),templateId:_.id,value:_.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)})),u=this.outputs.map(f=>({id:f.id,name:f.name,nodeId:s(f.nodeId),nodeInterfaceId:s(f.nodeInterfaceId)})),d={id:Gs(),nodes:o,connections:a,inputs:l,outputs:u};return e||(e=new Sc(this.editor)),e.load(d).forEach(f=>console.warn(f)),e.template=this,e}}class BDt{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 Un(this),registerNodeType:new qt(this),beforeUnregisterNodeType:new Un(this),unregisterNodeType:new qt(this),beforeAddGraphTemplate:new Un(this),addGraphTemplate:new qt(this),beforeRemoveGraphTemplate:new Un(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=Xi(),this.graphTemplateHooks=Xi(),this.graphEvents=Xi(),this.graphHooks=Xi(),this.nodeEvents=Xi(),this.nodeHooks=Xi(),this.connectionEvents=Xi(),this._graphs=new Set,this._nodeTypes=new Map,this._graph=new Sc(this),this._graphTemplates=[],this._loading=!1,this.registerNodeType(LI),this.registerNodeType(PI)}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=FDt(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=La(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 fp(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 GDt(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 UI extends Error{constructor(){super("Cycle detected")}}function VDt(n){return typeof n=="string"}function FI(n,e){const t=new Map,i=new Map,s=new Map;let r,o;if(n instanceof Sc)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(u=>{Object.values(u.inputs).forEach(d=>t.set(d.id,u.id)),Object.values(u.outputs).forEach(d=>t.set(d.id,u.id))}),r.forEach(u=>{const d=o.filter(f=>f.from&&t.get(f.from.id)===u.id),h=new Set(d.map(f=>t.get(f.to.id)).filter(VDt));i.set(u.id,h),s.set(u,d)});const a=r.slice();o.forEach(u=>{const d=a.findIndex(h=>t.get(u.to.id)===h.id);d>=0&&a.splice(d,1)});const l=[];for(;a.length>0;){const u=a.pop();l.push(u);const d=i.get(u.id);for(;d.size>0;){const h=d.values().next().value;if(d.delete(h),Array.from(i.values()).every(f=>!f.has(h))){const f=r.find(_=>_.id===h);a.push(f)}}}if(Array.from(i.values()).some(u=>u.size>0))throw new UI;return{calculationOrder:l,connectionsFromNode:s,interfaceIdToNodeId:t}}function zDt(n,e){try{return FI(n,e),!1}catch(t){if(t instanceof UI)return!0;throw t}}var Kn;(function(n){n.Running="Running",n.Idle="Idle",n.Paused="Paused",n.Stopped="Stopped"})(Kn||(Kn={}));class HDt{get status(){return this.isRunning?Kn.Running:this.internalStatus}constructor(e){this.editor=e,this.events={beforeRun:new Un(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 OI},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 II(e,t);let s=this.editor.graph.connections.slice();return t.allowMultipleConnections||(s=s.filter(r=>r.to!==t)),s.push(i),zDt(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 qDt extends HDt{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,FI(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(([d,h])=>{l[d]=this.getInterfaceValue(t,h.id)}),this.events.beforeNodeCalculation.emit({inputValues:l,node:a});let u;if(a.calculate)u=await a.calculate(l,{globalValues:i,engine:this});else{u={};for(const[d,h]of Object.entries(a.outputs))u[d]=this.getInterfaceValue(t,h.id)}this.validateNodeCalculationOutput(a,u),this.events.afterNodeCalculation.emit({outputValues:u,node:a}),o.set(a.id,new Map(Object.entries(u))),r.has(a)&&r.get(a).forEach(d=>{var h;const f=(h=Object.entries(a.outputs).find(([,m])=>m.id===d.from.id))===null||h===void 0?void 0:h[0];if(!f)throw new Error(`Could not find key for interface ${d.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 co{constructor(e){super(),this.entity=e}emit(e){this.listeners.forEach(t=>t(e,this.entity))}}class Un extends co{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 OI extends co{execute(e,t){let i=e;for(const s of this.listeners)i=s(i,t);return i}}class li extends OI{constructor(e){super(),this.entity=e}execute(e){return super.execute(e,this.entity)}}class PDt extends co{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 Xi(){const n=Symbol(),e=new Map,t=new Set,i=(l,u)=>{u instanceof co&&u.registerProxy(n,()=>{var d,h;return(h=(d=e.get(l))===null||d===void 0?void 0:d.listeners)!==null&&h!==void 0?h:[]})},s=l=>{const u=new co;e.set(l,u),t.forEach(d=>i(l,d[l]))},r=l=>{t.add(l);for(const u of e.keys())i(u,l[u])},o=l=>{for(const u of e.keys())l[u]instanceof co&&l[u].unregisterProxy(n);t.delete(l)},a=()=>{t.forEach(l=>o(l)),e.clear()};return new Proxy({},{get(l,u){return u==="addTarget"?r:u==="removeTarget"?o:u==="destroy"?a:typeof u!="string"||u.startsWith("_")?l[u]:(e.has(u)||s(u),e.get(u))}})}class Pw{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=Gs(),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 II{constructor(e,t){if(!e||!t)throw new Error("Cannot initialize connection with null/undefined for 'from' or 'to' values");this.id=Gs(),this.from=e,this.to=t}}function Eb(n,e){return Object.fromEntries(Object.entries(n).map(([t,i])=>[t,e(i)]))}class MI{constructor(){this._title="",this.id=Gs(),this.events={loaded:new qt(this),beforeAddInput:new Un(this),addInput:new qt(this),beforeRemoveInput:new Un(this),removeInput:new qt(this),beforeAddOutput:new Un(this),addOutput:new qt(this),beforeRemoveOutput:new Un(this),removeOutput:new qt(this),beforeTitleChanged:new Un(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=Eb(this.inputs,s=>s.save()),t=Eb(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 DI=class extends MI{load(e){super.load(e)}save(){return super.save()}};function Ja(n){return class extends DI{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 nn{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=Gs(),this.nodeId="",this.port=!0,this.hidden=!1,this.events={setConnectionCount:new qt(this),beforeSetValue:new Un(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 Da="__baklava_SubgraphInputNode",ka="__baklava_SubgraphOutputNode";class kI extends DI{constructor(){super(),this.graphInterfaceId=Gs()}onPlaced(){super.onPlaced(),this.initializeIo()}save(){return{...super.save(),graphInterfaceId:this.graphInterfaceId}}load(e){super.load(e),this.graphInterfaceId=e.graphInterfaceId}}class LI extends kI{constructor(){super(...arguments),this.type=Da,this.inputs={name:new nn("Name","Input")},this.outputs={placeholder:new nn("Value",void 0)}}static isGraphInputNode(e){return e.type===Da}}class PI extends kI{constructor(){super(...arguments),this.type=ka,this.inputs={name:new nn("Name","Output"),placeholder:new nn("Value",void 0)},this.outputs={output:new nn("Output",void 0).setHidden(!0)},this.calculate=({placeholder:e})=>({output:e})}static isGraphOutputNode(e){return e.type===ka}}class Sc{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===Da).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===ka).map(t=>({id:t.graphInterfaceId,name:t.inputs.name.value,nodeId:t.id,nodeInterfaceId:t.outputs.output.id}))}constructor(e,t){this.id=Gs(),this.activeTransactions=0,this._nodes=[],this._connections=[],this._loading=!1,this._destroying=!1,this.events={beforeAddNode:new Un(this),addNode:new qt(this),beforeRemoveNode:new Un(this),removeNode:new qt(this),beforeAddConnection:new Un(this),addConnection:new qt(this),checkConnection:new Un(this),beforeRemoveConnection:new Un(this),removeConnection:new qt(this)},this.hooks={save:new li(this),load:new li(this),checkConnection:new PDt(this)},this.nodeEvents=Xi(),this.nodeHooks=Xi(),this.connectionEvents=Xi(),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 Pw(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 II(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 Pw(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 lc="__baklava_GraphNode-";function La(n){return lc+n.id}function UDt(n){return class extends MI{constructor(){super(...arguments),this.type=La(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 nn(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 nn(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 nn("_calculationResults",void 0).setHidden(!0))}}}class fp{static fromGraph(e,t){return new fp(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(La(this));t&&(t.title=e)}get inputs(){return this.nodes.filter(t=>t.type===Da).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===ka).map(t=>({id:t.graphInterfaceId,name:t.inputs.name.value,nodeId:t.id,nodeInterfaceId:t.outputs.output.id}))}constructor(e,t){this.id=Gs(),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 _=Gs();return t.set(f,_),_},s=f=>{const _=t.get(f);if(!_)throw new Error(`Unable to create graph from template: Could not map old id ${f} to new id`);return _},r=f=>Eb(f,_=>({id:i(_.id),templateId:_.id,value:_.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)})),u=this.outputs.map(f=>({id:f.id,name:f.name,nodeId:s(f.nodeId),nodeInterfaceId:s(f.nodeInterfaceId)})),d={id:Gs(),nodes:o,connections:a,inputs:l,outputs:u};return e||(e=new Sc(this.editor)),e.load(d).forEach(f=>console.warn(f)),e.template=this,e}}class FDt{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 Un(this),registerNodeType:new qt(this),beforeUnregisterNodeType:new Un(this),unregisterNodeType:new qt(this),beforeAddGraphTemplate:new Un(this),addGraphTemplate:new qt(this),beforeRemoveGraphTemplate:new Un(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=Xi(),this.graphTemplateHooks=Xi(),this.graphEvents=Xi(),this.graphHooks=Xi(),this.nodeEvents=Xi(),this.nodeHooks=Xi(),this.connectionEvents=Xi(),this._graphs=new Set,this._nodeTypes=new Map,this._graph=new Sc(this),this._graphTemplates=[],this._loading=!1,this.registerNodeType(LI),this.registerNodeType(PI)}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=UDt(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=La(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 fp(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 BDt(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 UI extends Error{constructor(){super("Cycle detected")}}function GDt(n){return typeof n=="string"}function FI(n,e){const t=new Map,i=new Map,s=new Map;let r,o;if(n instanceof Sc)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(u=>{Object.values(u.inputs).forEach(d=>t.set(d.id,u.id)),Object.values(u.outputs).forEach(d=>t.set(d.id,u.id))}),r.forEach(u=>{const d=o.filter(f=>f.from&&t.get(f.from.id)===u.id),h=new Set(d.map(f=>t.get(f.to.id)).filter(GDt));i.set(u.id,h),s.set(u,d)});const a=r.slice();o.forEach(u=>{const d=a.findIndex(h=>t.get(u.to.id)===h.id);d>=0&&a.splice(d,1)});const l=[];for(;a.length>0;){const u=a.pop();l.push(u);const d=i.get(u.id);for(;d.size>0;){const h=d.values().next().value;if(d.delete(h),Array.from(i.values()).every(f=>!f.has(h))){const f=r.find(_=>_.id===h);a.push(f)}}}if(Array.from(i.values()).some(u=>u.size>0))throw new UI;return{calculationOrder:l,connectionsFromNode:s,interfaceIdToNodeId:t}}function VDt(n,e){try{return FI(n,e),!1}catch(t){if(t instanceof UI)return!0;throw t}}var Kn;(function(n){n.Running="Running",n.Idle="Idle",n.Paused="Paused",n.Stopped="Stopped"})(Kn||(Kn={}));class zDt{get status(){return this.isRunning?Kn.Running:this.internalStatus}constructor(e){this.editor=e,this.events={beforeRun:new Un(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 OI},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 II(e,t);let s=this.editor.graph.connections.slice();return t.allowMultipleConnections||(s=s.filter(r=>r.to!==t)),s.push(i),VDt(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 HDt extends zDt{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,FI(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(([d,h])=>{l[d]=this.getInterfaceValue(t,h.id)}),this.events.beforeNodeCalculation.emit({inputValues:l,node:a});let u;if(a.calculate)u=await a.calculate(l,{globalValues:i,engine:this});else{u={};for(const[d,h]of Object.entries(a.outputs))u[d]=this.getInterfaceValue(t,h.id)}this.validateNodeCalculationOutput(a,u),this.events.afterNodeCalculation.emit({outputValues:u,node:a}),o.set(a.id,new Map(Object.entries(u))),r.has(a)&&r.get(a).forEach(d=>{var h;const f=(h=Object.entries(a.outputs).find(([,m])=>m.id===d.from.id))===null||h===void 0?void 0:h[0];if(!f)throw new Error(`Could not find key for interface ${d.from.id} This is likely a Baklava internal issue. Please report it on GitHub.`);const _=this.hooks.transferData.execute(u[f],d);d.to.allowMultipleConnections?t.has(d.to.id)?t.get(d.to.id).push(_):t.set(d.to.id,[_]):t.set(d.to.id,_)})}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 yb=null;function YDt(n){yb=n}function Oi(){if(!yb)throw new Error("providePlugin() must be called before usePlugin()");return{viewModel:yb}}function Ki(){const{viewModel:n}=Oi();return{graph:$d(n.value,"displayedGraph"),switchGraph:n.value.switchGraph}}function BI(n){const{graph:e}=Ki(),t=ft(null),i=ft(null);return{dragging:st(()=>!!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 u=l.pageX-t.value.x,d=l.pageY-t.value.y;n.value.x=i.value.x+u/e.value.scaling,n.value.y=i.value.y+d/e.value.scaling}},onPointerUp:()=>{t.value=null,i.value=null}}}function GI(n,e,t){if(!e.template)return!1;if(La(e.template)===t)return!0;const i=n.graphTemplates.find(r=>La(r)===t);return i?i.nodes.filter(r=>r.type.startsWith(lc)).some(r=>GI(n,e,r.type)):!1}function VI(n){return st(()=>{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])=>!GI(n.value.editor,n.value.displayedGraph,o)):r=r.filter(([o])=>![Da,ka].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 zI(){const{graph:n}=Ki();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 $Dt(){const{graph:n}=Ki();let e=[],t=-1,i={x:0,y:0};const s=st(()=>n.value.panning),r=BI(s),o=st(()=>({"transform-origin":"0 0",transform:`scale(${n.value.scaling}) translate(${n.value.panning.x}px, ${n.value.panning.y}px)`})),a=(_,m,E)=>{const b=[_/n.value.scaling-n.value.panning.x,m/n.value.scaling-n.value.panning.y],g=[_/E-n.value.panning.x,m/E-n.value.panning.y],y=[g[0]-b[0],g[1]-b[1]];n.value.panning.x+=y[0],n.value.panning.y+=y[1],n.value.scaling=E},l=_=>{_.preventDefault();let m=_.deltaY;_.deltaMode===1&&(m*=32);const E=n.value.scaling*(1-m/3e3);a(_.offsetX,_.offsetY,E)},u=()=>({ax:e[0].clientX,ay:e[0].clientY,bx:e[1].clientX,by:e[1].clientY});return{styles:o,...r,onPointerDown:_=>{if(e.push(_),r.onPointerDown(_),e.length===2){const{ax:m,ay:E,bx:b,by:g}=u();i={x:m+(b-m)/2,y:E+(g-E)/2}}},onPointerMove:_=>{for(let m=0;m0){const C=n.value.scaling*(1+(S-t)/500);a(i.x,i.y,C)}t=S}else r.onPointerMove(_)},onPointerUp:_=>{e=e.filter(m=>m.pointerId!==_.pointerId),t=-1,r.onPointerUp()},onMouseWheel:l}}var Ei=(n=>(n[n.NONE=0]="NONE",n[n.ALLOWED=1]="ALLOWED",n[n.FORBIDDEN=2]="FORBIDDEN",n))(Ei||{});const HI=Symbol();function WDt(){const{graph:n}=Ki(),e=ft(null),t=ft(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:Ei.NONE,from:a.from},n.value.removeConnection(a)):e.value={status:Ei.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?Ei.ALLOWED:Ei.FORBIDDEN,l.connectionAllowed){const u=l.connectionsInDanger.map(d=>d.id);n.value.connections.forEach(d=>{u.includes(d.id)&&(d.isInDanger=!0)})}}else!a&&e.value&&(e.value.to=void 0,e.value.status=Ei.NONE,n.value.connections.forEach(l=>{l.isInDanger=!1}))};return sa(HI,{temporaryConnection:e,hoveredOver:o}),{temporaryConnection:e,onMouseMove:i,onMouseDown:s,onMouseUp:r,hoveredOver:o}}function KDt(n){const e=ft(!1),t=ft(0),i=ft(0),s=VI(n),{transform:r}=zI(),o=st(()=>{let d=[];const h={};for(const _ of s.value){const m=Object.entries(_.nodeTypes).map(([E,b])=>({label:b.title,value:"addNode:"+E}));_.name==="default"?d=m:h[_.name]=m}const f=[...Object.entries(h).map(([_,m])=>({label:_,submenu:m}))];return f.length>0&&d.length>0&&f.push({isDivider:!0}),f.push(...d),f}),a=st(()=>n.value.settings.contextMenu.additionalItems.length===0?o.value:[{label:"Add node",submenu:o.value},...n.value.settings.contextMenu.additionalItems.map(d=>"isDivider"in d||"submenu"in d?d:{label:d.label,value:"command:"+d.command,disabled:!n.value.commandHandler.canExecuteCommand(d.command)})]);function l(d){e.value=!0,t.value=d.offsetX,i.value=d.offsetY}function u(d){if(d.startsWith("addNode:")){const h=d.substring(8),f=n.value.editor.nodeTypes.get(h);if(!f)return;const _=ei(new f.type);n.value.displayedGraph.addNode(_);const[m,E]=r(t.value,i.value);_.position.x=m,_.position.y=E}else if(d.startsWith("command:")){const h=d.substring(8);n.value.commandHandler.canExecuteCommand(h)&&n.value.commandHandler.executeCommand(h)}}return{show:e,x:t,y:i,items:a,open:l,onClick:u}}const jDt=_n({setup(){const{viewModel:n}=Oi(),{graph:e}=Ki();return{styles:st(()=>{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`,u=e.value.scaling>i.subGridVisibleThreshold?`, ${a}px ${a}px, ${a}px ${a}px`:"";return{backgroundPosition:`left ${s}px top ${r}px`,backgroundSize:`${l} ${u}`}})}}}),hn=(n,e)=>{const t=n.__vccOpts||n;for(const[i,s]of e)t[i]=s;return t};function QDt(n,e,t,i,s,r){return w(),A("div",{class:"background",style:en(n.styles)},null,4)}const XDt=hn(jDt,[["render",QDt]]);function ZDt(n){return eR()?(NM(n),!0):!1}function uy(n){return typeof n=="function"?n():yt(n)}const qI=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const JDt=Object.prototype.toString,ekt=n=>JDt.call(n)==="[object Object]",Vd=()=>{},tkt=nkt();function nkt(){var n,e;return qI&&((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 ikt(n,e,t=!1){return e.reduce((i,s)=>(s in n&&(!t||n[s]!==void 0)&&(i[s]=n[s]),i),{})}function skt(n,e={}){if(!fn(n))return d2(n);const t=Array.isArray(n.value)?Array.from({length:n.value.length}):{};for(const i in n.value)t[i]=c2(()=>({get(){return n.value[i]},set(s){var r;if((r=uy(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 Al(n){var e;const t=uy(n);return(e=t==null?void 0:t.$el)!=null?e:t}const py=qI?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=py):[e,t,i,s]=n,!e)return Vd;Array.isArray(t)||(t=[t]),Array.isArray(i)||(i=[i]);const r=[],o=()=>{r.forEach(d=>d()),r.length=0},a=(d,h,f,_)=>(d.addEventListener(h,f,_),()=>d.removeEventListener(h,f,_)),l=qn(()=>[Al(e),uy(s)],([d,h])=>{if(o(),!d)return;const f=ekt(h)?{...h}:h;r.push(...t.flatMap(_=>i.map(m=>a(d,_,m,f))))},{immediate:!0,flush:"post"}),u=()=>{l(),o()};return ZDt(u),u}let Uw=!1;function YI(n,e,t={}){const{window:i=py,ignore:s=[],capture:r=!0,detectIframe:o=!1}=t;if(!i)return Vd;tkt&&!Uw&&(Uw=!0,Array.from(i.document.body.children).forEach(f=>f.addEventListener("click",Vd)),i.document.documentElement.addEventListener("click",Vd));let a=!0;const l=f=>s.some(_=>{if(typeof _=="string")return Array.from(i.document.querySelectorAll(_)).some(m=>m===f.target||f.composedPath().includes(m));{const m=Al(_);return m&&(f.target===m||f.composedPath().includes(m))}}),d=[Vl(i,"click",f=>{const _=Al(n);if(!(!_||_===f.target||f.composedPath().includes(_))){if(f.detail===0&&(a=!l(f)),!a){a=!0;return}e(f)}},{passive:!0,capture:r}),Vl(i,"pointerdown",f=>{const _=Al(n);a=!l(f)&&!!(_&&!f.composedPath().includes(_))},{passive:!0}),o&&Vl(i,"blur",f=>{setTimeout(()=>{var _;const m=Al(n);((_=i.document.activeElement)==null?void 0:_.tagName)==="IFRAME"&&!(m!=null&&m.contains(i.document.activeElement))&&e(f)},0)})].filter(Boolean);return()=>d.forEach(f=>f())}const $I={x:0,y:0,pointerId:0,pressure:0,tiltX:0,tiltY:0,width:0,height:0,twist:0,pointerType:null},rkt=Object.keys($I);function okt(n={}){const{target:e=py}=n,t=ft(!1),i=ft(n.initialValue||{});Object.assign(i.value,$I,i.value);const s=r=>{t.value=!0,!(n.pointerTypes&&!n.pointerTypes.includes(r.pointerType))&&(i.value=ikt(r,rkt,!1))};if(e){const r={passive:!0};Vl(e,["pointerdown","pointermove","pointerup"],s,r),Vl(e,"pointerleave",()=>t.value=!1,r)}return{...skt(i),isInside:t}}const akt=["onMouseenter","onMouseleave","onClick"],lkt={class:"flex-fill"},ckt={key:0,class:"__submenu-icon",style:{"line-height":"1em"}},dkt=c("svg",{width:"13",height:"13",viewBox:"-60 120 250 250"},[c("path",{d:"M160.875 279.5625 L70.875 369.5625 L70.875 189.5625 L160.875 279.5625 Z",stroke:"none",fill:"white"})],-1),ukt=[dkt],_y=_n({__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=ft(null),o=ft(-1),a=ft(0),l=ft({x:!1,y:!1}),u=st(()=>t.flippable&&(l.value.x||t.isFlipped.x)),d=st(()=>t.flippable&&(l.value.y||t.isFlipped.y)),h=st(()=>{const y={};return t.isNested||(y.top=(d.value?t.y-a.value:t.y)+"px",y.left=t.x+"px"),y}),f=st(()=>({"--flipped-x":u.value,"--flipped-y":d.value,"--nested":t.isNested})),_=st(()=>t.items.map(y=>({...y,hover:!1})));qn([()=>t.y,()=>t.items],()=>{var y,v,S,C;a.value=t.items.length*30;const T=((v=(y=r.value)==null?void 0:y.parentElement)==null?void 0:v.offsetWidth)??0,O=((C=(S=r.value)==null?void 0:S.parentElement)==null?void 0:C.offsetHeight)??0;l.value.x=!t.isNested&&t.x>T*.75,l.value.y=!t.isNested&&t.y+a.value>O-20}),YI(r,()=>{t.modelValue&&i("update:modelValue",!1)});const m=y=>{!y.submenu&&y.value&&(i("click",y.value),i("update:modelValue",!1))},E=y=>{i("click",y),o.value=-1,t.isNested||i("update:modelValue",!1)},b=(y,v)=>{t.items[v].submenu&&(o.value=v,s!==null&&(clearTimeout(s),s=null))},g=(y,v)=>{t.items[v].submenu&&(s=window.setTimeout(()=>{o.value=-1,s=null},200))};return(y,v)=>{const S=mt("ContextMenu",!0);return w(),xt(Vi,{name:"slide-fade"},{default:We(()=>[G(c("div",{ref_key:"el",ref:r,class:ze(["baklava-context-menu",f.value]),style:en(h.value)},[(w(!0),A($e,null,lt(_.value,(C,T)=>(w(),A($e,null,[C.isDivider?(w(),A("div",{key:`d-${T}`,class:"divider"})):(w(),A("div",{key:`i-${T}`,class:ze(["item",{submenu:!!C.submenu,"--disabled":!!C.disabled}]),onMouseenter:O=>b(O,T),onMouseleave:O=>g(O,T),onClick:ge(O=>m(C),["stop","prevent"])},[c("div",lkt,he(C.label),1),C.submenu?(w(),A("div",ckt,ukt)):V("",!0),C.submenu?(w(),xt(S,{key:1,"model-value":o.value===T,items:C.submenu,"is-nested":!0,"is-flipped":{x:u.value,y:d.value},flippable:y.flippable,onClick:E},null,8,["model-value","items","is-flipped","flippable"])):V("",!0)],42,akt))],64))),256))],6),[[Mt,y.modelValue]])]),_:1})}}}),pkt={},_kt={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"},hkt=c("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),fkt=c("circle",{cx:"12",cy:"12",r:"1"},null,-1),mkt=c("circle",{cx:"12",cy:"19",r:"1"},null,-1),gkt=c("circle",{cx:"12",cy:"5",r:"1"},null,-1),bkt=[hkt,fkt,mkt,gkt];function Ekt(n,e){return w(),A("svg",_kt,bkt)}const WI=hn(pkt,[["render",Ekt]]),ykt=["id"],vkt={key:0,class:"__tooltip"},Skt={key:2,class:"align-middle"},Fw=_n({__name:"NodeInterface",props:{node:{},intf:{}},setup(n){const e=(b,g=100)=>{const y=b!=null&&b.toString?b.toString():"";return y.length>g?y.slice(0,g)+"...":y},t=n,{viewModel:i}=Oi(),{hoveredOver:s,temporaryConnection:r}=Gi(HI),o=ft(null),a=st(()=>t.intf.connectionCount>0),l=ft(!1),u=st(()=>i.value.settings.displayValueOnHover&&l.value),d=st(()=>({"--input":t.intf.isInput,"--output":!t.intf.isInput,"--connected":a.value})),h=st(()=>t.intf.component&&(!t.intf.isInput||!t.intf.port||t.intf.connectionCount===0)),f=()=>{l.value=!0,s(t.intf)},_=()=>{l.value=!1,s(void 0)},m=()=>{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 Ws(m),uc(m),(b,g)=>{var y;return w(),A("div",{id:b.intf.id,ref_key:"el",ref:o,class:ze(["baklava-node-interface",d.value])},[b.intf.port?(w(),A("div",{key:0,class:ze(["__port",{"--selected":((y=yt(r))==null?void 0:y.from)===b.intf}]),onPointerover:f,onPointerout:_},[kn(b.$slots,"portTooltip",{showTooltip:u.value},()=>[u.value===!0?(w(),A("span",vkt,he(e(b.intf.value)),1)):V("",!0)])],34)):V("",!0),h.value?(w(),xt(Lu(b.intf.component),{key:1,modelValue:b.intf.value,"onUpdate:modelValue":g[0]||(g[0]=v=>b.intf.value=v),node:b.node,intf:b.intf,onOpenSidebar:E},null,40,["modelValue","node","intf"])):(w(),A("span",Skt,he(b.intf.name),1))],10,ykt)}}}),Tkt=["id","data-node-type"],xkt={class:"__title-label"},Ckt={class:"__menu"},wkt={class:"__outputs"},Rkt={class:"__inputs"},Akt=_n({__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}=Ki(),a=ft(null),l=ft(!1),u=ft(""),d=ft(null),h=ft(!1),f=ft(!1),_=st(()=>{const F=[{value:"rename",label:"Rename"},{value:"delete",label:"Delete"}];return t.node.type.startsWith(lc)&&F.push({value:"editSubgraph",label:"Edit Subgraph"}),F}),m=st(()=>({"--selected":t.selected,"--dragging":t.dragging,"--two-column":!!t.node.twoColumn})),E=st(()=>{var F,B;return{top:`${((F=t.node.position)==null?void 0:F.y)??0}px`,left:`${((B=t.node.position)==null?void 0:B.x)??0}px`,"--width":`${t.node.width??s.value.settings.nodes.defaultWidth}px`}}),b=st(()=>Object.values(t.node.inputs).filter(F=>!F.hidden)),g=st(()=>Object.values(t.node.outputs).filter(F=>!F.hidden)),y=()=>{i("select")},v=F=>{t.selected||y(),i("start-drag",F)},S=()=>{f.value=!0},C=async F=>{var B;switch(F){case"delete":r.value.removeNode(t.node);break;case"rename":u.value=t.node.title,l.value=!0,await Ge(),(B=d.value)==null||B.focus();break;case"editSubgraph":o(t.node.template);break}},T=()=>{t.node.title=u.value,l.value=!1},O=()=>{a.value&&s.value.hooks.renderNode.execute({node:t.node,el:a.value})},k=F=>{h.value=!0,F.preventDefault()},x=F=>{if(!h.value)return;const B=t.node.width+F.movementX/r.value.scaling,ne=s.value.settings.nodes.minWidth,L=s.value.settings.nodes.maxWidth;t.node.width=Math.max(ne,Math.min(L,B))},I=()=>{h.value=!1};return Ws(()=>{O(),window.addEventListener("mousemove",x),window.addEventListener("mouseup",I)}),uc(O),Va(()=>{window.removeEventListener("mousemove",x),window.removeEventListener("mouseup",I)}),(F,B)=>(w(),A("div",{id:F.node.id,ref_key:"el",ref:a,class:ze(["baklava-node",m.value]),style:en(E.value),"data-node-type":F.node.type,onPointerdown:y},[yt(s).settings.nodes.resizable?(w(),A("div",{key:0,class:"__resize-handle",onMousedown:k},null,32)):V("",!0),kn(F.$slots,"title",{},()=>[c("div",{class:"__title",onPointerdown:ge(v,["self","stop"])},[l.value?G((w(),A("input",{key:1,ref_key:"renameInputEl",ref:d,"onUpdate:modelValue":B[1]||(B[1]=ne=>u.value=ne),type:"text",class:"baklava-input",placeholder:"Node Name",onBlur:T,onKeydown:Hs(T,["enter"])},null,544)),[[we,u.value]]):(w(),A($e,{key:0},[c("div",xkt,he(F.node.title),1),c("div",Ckt,[Te(WI,{class:"--clickable",onClick:S}),Te(_y,{modelValue:f.value,"onUpdate:modelValue":B[0]||(B[0]=ne=>f.value=ne),x:0,y:0,items:_.value,onClick:C},null,8,["modelValue","items"])])],64))],32)]),kn(F.$slots,"content",{},()=>[c("div",{class:"__content",onKeydown:B[2]||(B[2]=Hs(ge(()=>{},["stop"]),["delete"]))},[c("div",wkt,[(w(!0),A($e,null,lt(g.value,ne=>kn(F.$slots,"nodeInterface",{key:ne.id,type:"output",node:F.node,intf:ne},()=>[Te(Fw,{node:F.node,intf:ne},null,8,["node","intf"])])),128))]),c("div",Rkt,[(w(!0),A($e,null,lt(b.value,ne=>kn(F.$slots,"nodeInterface",{key:ne.id,type:"input",node:F.node,intf:ne},()=>[Te(Fw,{node:F.node,intf:ne},null,8,["node","intf"])])),128))])],32)])],46,Tkt))}}),Nkt=_n({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:Ei.NONE},isTemporary:{type:Boolean,default:!1}},setup(n){const{viewModel:e}=Oi(),{graph:t}=Ki(),i=(o,a)=>{const l=(o+t.value.panning.x)*t.value.scaling,u=(a+t.value.panning.y)*t.value.scaling;return[l,u]},s=st(()=>{const[o,a]=i(n.x1,n.y1),[l,u]=i(n.x2,n.y2);if(e.value.settings.useStraightConnections)return`M ${o} ${a} L ${l} ${u}`;{const d=.3*Math.abs(o-l);return`M ${o} ${a} C ${o+d} ${a}, ${l-d} ${u}, ${l} ${u}`}}),r=st(()=>({"--temporary":n.isTemporary,"--allowed":n.state===Ei.ALLOWED,"--forbidden":n.state===Ei.FORBIDDEN}));return{d:s,classes:r}}}),Okt=["d"];function Ikt(n,e,t,i,s,r){return w(),A("path",{class:ze(["baklava-connection",n.classes]),d:n.d},null,10,Okt)}const KI=hn(Nkt,[["render",Ikt]]);function Mkt(n){return document.getElementById(n.id)}function Pa(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 Dkt=_n({components:{"connection-view":KI},props:{connection:{type:Object,required:!0}},setup(n){const{graph:e}=Ki();let t;const i=ft({x1:0,y1:0,x2:0,y2:0}),s=st(()=>n.connection.isInDanger?Ei.FORBIDDEN:Ei.NONE),r=st(()=>{var u;return(u=e.value.findNodeById(n.connection.from.nodeId))==null?void 0:u.position}),o=st(()=>{var u;return(u=e.value.findNodeById(n.connection.to.nodeId))==null?void 0:u.position}),a=u=>u.node&&u.interface&&u.port?[u.node.offsetLeft+u.interface.offsetLeft+u.port.offsetLeft+u.port.clientWidth/2,u.node.offsetTop+u.interface.offsetTop+u.port.offsetTop+u.port.clientHeight/2]:[0,0],l=()=>{const u=Pa(n.connection.from),d=Pa(n.connection.to);u.node&&d.node&&(t||(t=new ResizeObserver(()=>{l()}),t.observe(u.node),t.observe(d.node)));const[h,f]=a(u),[_,m]=a(d);i.value={x1:h,y1:f,x2:_,y2:m}};return Ws(async()=>{await Ge(),l()}),Va(()=>{t&&t.disconnect()}),qn([r,o],()=>l(),{deep:!0}),{d:i,state:s}}});function kkt(n,e,t,i,s,r){const o=mt("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 Lkt=hn(Dkt,[["render",kkt]]);function yu(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 Pkt=_n({components:{"connection-view":KI},props:{connection:{type:Object,required:!0}},setup(n){const e=st(()=>n.connection?n.connection.status:Ei.NONE);return{d:st(()=>{if(!n.connection)return{input:[0,0],output:[0,0]};const i=yu(Pa(n.connection.from)),s=n.connection.to?yu(Pa(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 Ukt(n,e,t,i,s,r){const o=mt("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 Fkt=hn(Pkt,[["render",Ukt]]),Bkt=_n({setup(){const{viewModel:n}=Oi(),{graph:e}=Ki(),t=ft(null),i=$d(n.value.settings.sidebar,"width"),s=st(()=>n.value.settings.sidebar.resizable),r=st(()=>{const h=e.value.sidebar.nodeId;return e.value.nodes.find(f=>f.id===h)}),o=st(()=>({width:`${i.value}px`})),a=st(()=>r.value?[...Object.values(r.value.inputs),...Object.values(r.value.outputs)].filter(f=>f.displayInSidebar&&f.component):[]),l=()=>{e.value.sidebar.visible=!1},u=()=>{window.addEventListener("mousemove",d),window.addEventListener("mouseup",()=>{window.removeEventListener("mousemove",d)},{once:!0})},d=h=>{var f,_;const m=((_=(f=t.value)==null?void 0:f.parentElement)==null?void 0:_.getBoundingClientRect().width)??500;let E=i.value-h.movementX;E<300?E=300:E>.9*m&&(E=.9*m),i.value=E};return{el:t,graph:e,resizable:s,node:r,styles:o,displayedInterfaces:a,startResize:u,close:l}}}),Gkt={class:"__header"},Vkt={class:"__node-name"};function zkt(n,e,t,i,s,r){return w(),A("div",{ref:"el",class:ze(["baklava-sidebar",{"--open":n.graph.sidebar.visible}]),style:en(n.styles)},[n.resizable?(w(),A("div",{key:0,class:"__resizer",onMousedown:e[0]||(e[0]=(...o)=>n.startResize&&n.startResize(...o))},null,32)):V("",!0),c("div",Gkt,[c("button",{tabindex:"-1",class:"__close",onClick:e[1]||(e[1]=(...o)=>n.close&&n.close(...o))},"×"),c("div",Vkt,[c("b",null,he(n.node?n.node.title:""),1)])]),(w(!0),A($e,null,lt(n.displayedInterfaces,o=>(w(),A("div",{key:o.id,class:"__interface"},[(w(),xt(Lu(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 Hkt=hn(Bkt,[["render",zkt]]),qkt=_n({__name:"Minimap",setup(n){const{viewModel:e}=Oi(),{graph:t}=Ki(),i=ft(null),s=ft(!1);let r,o=!1,a={x1:0,y1:0,x2:0,y2:0},l;const u=()=>{var T,O;if(!r)return;r.canvas.width=i.value.offsetWidth,r.canvas.height=i.value.offsetHeight;const k=new Map,x=new Map;for(const L of t.value.nodes){const $=Mkt(L),H=($==null?void 0:$.offsetWidth)??0,U=($==null?void 0:$.offsetHeight)??0,Q=((T=L.position)==null?void 0:T.x)??0,J=((O=L.position)==null?void 0:O.y)??0;k.set(L,{x1:Q,y1:J,x2:Q+H,y2:J+U}),x.set(L,$)}const I={x1:Number.MAX_SAFE_INTEGER,y1:Number.MAX_SAFE_INTEGER,x2:Number.MIN_SAFE_INTEGER,y2:Number.MIN_SAFE_INTEGER};for(const L of k.values())L.x1I.x2&&(I.x2=L.x2),L.y2>I.y2&&(I.y2=L.y2);const F=50;I.x1-=F,I.y1-=F,I.x2+=F,I.y2+=F,a=I;const B=r.canvas.width/r.canvas.height,ne=(a.x2-a.x1)/(a.y2-a.y1);if(B>ne){const L=(B-ne)*(a.y2-a.y1)*.5;a.x1-=L,a.x2+=L}else{const L=a.x2-a.x1,$=a.y2-a.y1,H=(L-B*$)/B*.5;a.y1-=H,a.y2+=H}r.clearRect(0,0,r.canvas.width,r.canvas.height),r.strokeStyle="white";for(const L of t.value.connections){const[$,H]=yu(Pa(L.from)),[U,Q]=yu(Pa(L.to)),[J,j]=d($,H),[ae,ve]=d(U,Q);if(r.beginPath(),r.moveTo(J,j),e.value.settings.useStraightConnections)r.lineTo(ae,ve);else{const ee=.3*Math.abs(J-ae);r.bezierCurveTo(J+ee,j,ae-ee,ve,ae,ve)}r.stroke()}r.strokeStyle="lightgray";for(const[L,$]of k.entries()){const[H,U]=d($.x1,$.y1),[Q,J]=d($.x2,$.y2);r.fillStyle=f(x.get(L)),r.beginPath(),r.rect(H,U,Q-H,J-U),r.fill(),r.stroke()}if(s.value){const L=m(),[$,H]=d(L.x1,L.y1),[U,Q]=d(L.x2,L.y2);r.fillStyle="rgba(255, 255, 255, 0.2)",r.fillRect($,H,U-$,Q-H)}},d=(T,O)=>[(T-a.x1)/(a.x2-a.x1)*r.canvas.width,(O-a.y1)/(a.y2-a.y1)*r.canvas.height],h=(T,O)=>[T*(a.x2-a.x1)/r.canvas.width+a.x1,O*(a.y2-a.y1)/r.canvas.height+a.y1],f=T=>{if(T){const O=T.querySelector(".__content");if(O){const x=_(O);if(x)return x}const k=_(T);if(k)return k}return"gray"},_=T=>{const O=getComputedStyle(T).backgroundColor;if(O&&O!=="rgba(0, 0, 0, 0)")return O},m=()=>{const T=i.value.parentElement.offsetWidth,O=i.value.parentElement.offsetHeight,k=T/t.value.scaling-t.value.panning.x,x=O/t.value.scaling-t.value.panning.y;return{x1:-t.value.panning.x,y1:-t.value.panning.y,x2:k,y2:x}},E=T=>{T.button===0&&(o=!0,b(T))},b=T=>{if(o){const[O,k]=h(T.offsetX,T.offsetY),x=m(),I=(x.x2-x.x1)/2,F=(x.y2-x.y1)/2;t.value.panning.x=-(O-I),t.value.panning.y=-(k-F)}},g=()=>{o=!1},y=()=>{s.value=!0},v=()=>{s.value=!1,g()};qn([s,t.value.panning,()=>t.value.scaling,()=>t.value.connections.length],()=>{u()});const S=st(()=>t.value.nodes.map(T=>T.position)),C=st(()=>t.value.nodes.map(T=>T.width));return qn([S,C],()=>{u()},{deep:!0}),Ws(()=>{r=i.value.getContext("2d"),r.imageSmoothingQuality="high",u(),l=setInterval(u,500)}),Va(()=>{clearInterval(l)}),(T,O)=>(w(),A("canvas",{ref_key:"canvas",ref:i,class:"baklava-minimap",onMouseenter:y,onMouseleave:v,onMousedown:ge(E,["self"]),onMousemove:ge(b,["self"]),onMouseup:g},null,544))}}),Ykt=_n({components:{ContextMenu:_y,VerticalDots:WI},props:{type:{type:String,required:!0},title:{type:String,required:!0}},setup(n){const{viewModel:e}=Oi(),{switchGraph:t}=Ki(),i=ft(!1),s=st(()=>n.type.startsWith(lc));return{showContextMenu:i,hasContextMenu:s,contextMenuItems:[{label:"Edit Subgraph",value:"editSubgraph"},{label:"Delete Subgraph",value:"deleteSubgraph"}],openContextMenu:()=>{i.value=!0},onContextMenuClick:l=>{const u=n.type.substring(lc.length),d=e.value.editor.graphTemplates.find(h=>h.id===u);if(d)switch(l){case"editSubgraph":t(d);break;case"deleteSubgraph":e.value.editor.removeGraphTemplate(d);break}}}}}),$kt=["data-node-type"],Wkt={class:"__title"},Kkt={class:"__title-label"},jkt={key:0,class:"__menu"};function Qkt(n,e,t,i,s,r){const o=mt("vertical-dots"),a=mt("context-menu");return w(),A("div",{class:"baklava-node --palette","data-node-type":n.type},[c("div",Wkt,[c("div",Kkt,he(n.title),1),n.hasContextMenu?(w(),A("div",jkt,[Te(o,{class:"--clickable",onPointerdown:e[0]||(e[0]=ge(()=>{},["stop","prevent"])),onClick:ge(n.openContextMenu,["stop","prevent"])},null,8,["onClick"]),Te(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]=ge(()=>{},["stop","prevent"]))},null,8,["modelValue","items","onClick"])])):V("",!0)])],8,$kt)}const Bw=hn(Ykt,[["render",Qkt]]),Xkt={class:"baklava-node-palette"},Zkt={key:0},Jkt=_n({__name:"NodePalette",setup(n){const{viewModel:e}=Oi(),{x:t,y:i}=okt(),{transform:s}=zI(),r=VI(e),o=Gi("editorEl"),a=ft(null),l=st(()=>{if(!a.value||!(o!=null&&o.value))return{};const{left:d,top:h}=o.value.getBoundingClientRect();return{top:`${i.value-h}px`,left:`${t.value-d}px`}}),u=(d,h)=>{a.value={type:d,nodeInformation:h};const f=()=>{const _=ei(new h.type);e.value.displayedGraph.addNode(_);const m=o.value.getBoundingClientRect(),[E,b]=s(t.value-m.left,i.value-m.top);_.position.x=E,_.position.y=b,a.value=null,document.removeEventListener("pointerup",f)};document.addEventListener("pointerup",f)};return(d,h)=>(w(),A($e,null,[c("div",Xkt,[(w(!0),A($e,null,lt(yt(r),f=>(w(),A("section",{key:f.name},[f.name!=="default"?(w(),A("h1",Zkt,he(f.name),1)):V("",!0),(w(!0),A($e,null,lt(f.nodeTypes,(_,m)=>(w(),xt(Bw,{key:m,type:m,title:_.title,onPointerdown:E=>u(m,_)},null,8,["type","title","onPointerdown"]))),128))]))),128))]),Te(Vi,{name:"fade"},{default:We(()=>[a.value?(w(),A("div",{key:0,class:"baklava-dragged-node",style:en(l.value)},[Te(Bw,{type:a.value.type,title:a.value.nodeInformation.title},null,8,["type","title"])],4)):V("",!0)]),_:1})],64))}});let Cd;const eLt=new Uint8Array(16);function tLt(){if(!Cd&&(Cd=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Cd))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Cd(eLt)}const wn=[];for(let n=0;n<256;++n)wn.push((n+256).toString(16).slice(1));function nLt(n,e=0){return wn[n[e+0]]+wn[n[e+1]]+wn[n[e+2]]+wn[n[e+3]]+"-"+wn[n[e+4]]+wn[n[e+5]]+"-"+wn[n[e+6]]+wn[n[e+7]]+"-"+wn[n[e+8]]+wn[n[e+9]]+"-"+wn[n[e+10]]+wn[n[e+11]]+wn[n[e+12]]+wn[n[e+13]]+wn[n[e+14]]+wn[n[e+15]]}const iLt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Gw={randomUUID:iLt};function vu(n,e,t){if(Gw.randomUUID&&!e&&!n)return Gw.randomUUID();n=n||{};const i=n.random||(n.rng||tLt)();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 nLt(i)}const cc="SAVE_SUBGRAPH";function sLt(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(cc,{canExecute:()=>{var i;return n.value!==((i=n.value.editor)==null?void 0:i.graph)},execute:t})}const rLt={},oLt={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"},aLt=c("polyline",{points:"6 9 12 15 18 9"},null,-1),lLt=[aLt];function cLt(n,e){return w(),A("svg",oLt,lLt)}const dLt=hn(rLt,[["render",cLt]]),uLt=_n({components:{"i-arrow":dLt},props:{intf:{type:Object,required:!0}},setup(n){const e=ft(null),t=ft(!1),i=st(()=>n.intf.items.find(o=>typeof o=="string"?o===n.intf.value:o.value===n.intf.value)),s=st(()=>i.value?typeof i.value=="string"?i.value:i.value.text:""),r=o=>{n.intf.value=typeof o=="string"?o:o.value};return YI(e,()=>{t.value=!1}),{el:e,open:t,selectedItem:i,selectedText:s,setSelected:r}}}),pLt=["title"],_Lt={class:"__selected"},hLt={class:"__text"},fLt={class:"__icon"},mLt={class:"__dropdown"},gLt={class:"item --header"},bLt=["onClick"];function ELt(n,e,t,i,s,r){const o=mt("i-arrow");return w(),A("div",{ref:"el",class:ze(["baklava-select",{"--open":n.open}]),title:n.intf.name,onClick:e[0]||(e[0]=a=>n.open=!n.open)},[c("div",_Lt,[c("div",hLt,he(n.selectedText),1),c("div",fLt,[Te(o)])]),Te(Vi,{name:"slide-fade"},{default:We(()=>[G(c("div",mLt,[c("div",gLt,he(n.intf.name),1),(w(!0),A($e,null,lt(n.intf.items,(a,l)=>(w(),A("div",{key:l,class:ze(["item",{"--active":a===n.selectedItem}]),onClick:u=>n.setSelected(a)},he(typeof a=="string"?a:a.text),11,bLt))),128))],512),[[Mt,n.open]])]),_:1})],10,pLt)}const yLt=hn(uLt,[["render",ELt]]);class vLt extends nn{constructor(e,t,i){super(e,t),this.component=dc(yLt),this.items=i}}const SLt=_n({props:{intf:{type:Object,required:!0}}});function TLt(n,e,t,i,s,r){return w(),A("div",null,he(n.intf.value),1)}const xLt=hn(SLt,[["render",TLt]]);class CLt extends nn{constructor(e,t){super(e,t),this.component=dc(xLt),this.setPort(!1)}}const wLt=_n({props:{intf:{type:Object,required:!0},modelValue:{type:String,required:!0}},emits:["update:modelValue"],setup(n,{emit:e}){return{v:st({get:()=>n.modelValue,set:i=>{e("update:modelValue",i)}})}}}),RLt=["placeholder","title"];function ALt(n,e,t,i,s,r){return w(),A("div",null,[G(c("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,RLt),[[we,n.v]])])}const NLt=hn(wLt,[["render",ALt]]);class Tc extends nn{constructor(){super(...arguments),this.component=dc(NLt)}}class jI extends LI{constructor(){super(...arguments),this._title="Subgraph Input",this.inputs={name:new Tc("Name","Input").setPort(!1)},this.outputs={placeholder:new nn("Connection",void 0)}}}class QI extends PI{constructor(){super(...arguments),this._title="Subgraph Output",this.inputs={name:new Tc("Name","Output").setPort(!1),placeholder:new nn("Connection",void 0)},this.outputs={output:new nn("Output",void 0).setHidden(!0)}}}const XI="CREATE_SUBGRAPH",Vw=[Da,ka];function OLt(n,e,t){const i=()=>n.value.selectedNodes.filter(r=>!Vw.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(x=>!Vw.includes(x.type)),u=l.flatMap(x=>Object.values(x.inputs)),d=l.flatMap(x=>Object.values(x.outputs)),h=o.connections.filter(x=>!d.includes(x.from)&&u.includes(x.to)),f=o.connections.filter(x=>d.includes(x.from)&&!u.includes(x.to)),_=o.connections.filter(x=>d.includes(x.from)&&u.includes(x.to)),m=l.map(x=>x.save()),E=_.map(x=>({id:x.id,from:x.from.id,to:x.to.id})),b=new Map,{xLeft:g,xRight:y,yTop:v}=ILt(l);console.log(g,y,v);for(const[x,I]of h.entries()){const F=new jI;F.inputs.name.value=I.to.name,m.push({...F.save(),position:{x:y-r.value.settings.nodes.defaultWidth-100,y:v+x*200}}),E.push({id:vu(),from:F.outputs.placeholder.id,to:I.to.id}),b.set(I.to.id,F.graphInterfaceId)}for(const[x,I]of f.entries()){const F=new QI;F.inputs.name.value=I.from.name,m.push({...F.save(),position:{x:g+100,y:v+x*200}}),E.push({id:vu(),from:I.from.id,to:F.inputs.placeholder.id}),b.set(I.from.id,F.graphInterfaceId)}const S=ei(new fp({connections:E,nodes:m,inputs:[],outputs:[]},a));a.addGraphTemplate(S);const C=a.nodeTypes.get(La(S));if(!C)throw new Error("Unable to create subgraph: Could not find corresponding graph node type");const T=ei(new C.type);o.addNode(T);const O=Math.round(l.map(x=>x.position.x).reduce((x,I)=>x+I,0)/l.length),k=Math.round(l.map(x=>x.position.y).reduce((x,I)=>x+I,0)/l.length);T.position.x=O,T.position.y=k,h.forEach(x=>{o.removeConnection(x),o.addConnection(x.from,T.inputs[b.get(x.to.id)])}),f.forEach(x=>{o.removeConnection(x),o.addConnection(T.outputs[b.get(x.from.id)],x.to)}),l.forEach(x=>o.removeNode(x)),e.canExecuteCommand(cc)&&e.executeCommand(cc),t(S),n.value.panning={...o.panning},n.value.scaling=o.scaling};e.registerCommand(XI,{canExecute:i,execute:s})}function ILt(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 zw="DELETE_NODES";function MLt(n,e){e.registerCommand(zw,{canExecute:()=>n.value.selectedNodes.length>0,execute(){n.value.selectedNodes.forEach(t=>n.value.removeNode(t))}}),e.registerHotkey(["Delete"],zw)}const ZI="SWITCH_TO_MAIN_GRAPH";function DLt(n,e,t){e.registerCommand(ZI,{canExecute:()=>n.value!==n.value.editor.graph,execute:()=>{e.executeCommand(cc),t(n.value.editor.graph)}})}function kLt(n,e,t){MLt(n,e),OLt(n,e,t),sLt(n,e),DLt(n,e,t)}class Hw{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 qw{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 LLt{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()},d=()=>{a.value=!0},h=()=>{a.value=!1,l.value.length>0&&(u(new LLt(l.value)),l.value=[])},f=()=>s.value.length!==0&&o.value!==-1,_=()=>{f()&&(r.value=!0,s.value[o.value--].undo(n.value),r.value=!1)},m=()=>s.value.length!==0&&o.value{m()&&(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,y=>{u(new Hw("addNode",y.id))}),b.events.removeNode.subscribe(t,y=>{u(new Hw("removeNode",y.save()))}),b.events.addConnection.subscribe(t,y=>{u(new qw("addConnection",y.id))}),b.events.removeConnection.subscribe(t,y=>{u(new qw("removeConnection",y))}))},{immediate:!0}),e.registerCommand(vb,{canExecute:f,execute:_}),e.registerCommand(Sb,{canExecute:m,execute:E}),e.registerCommand(JI,{canExecute:()=>!a.value,execute:d}),e.registerCommand(eM,{canExecute:()=>a.value,execute:h}),e.registerHotkey(["Control","z"],vb),e.registerHotkey(["Control","y"],Sb),ei({maxSteps:i})}const Tb="COPY",xb="PASTE",ULt="CLEAR_CLIPBOARD";function FLt(n,e,t){const i=Symbol("ClipboardToken"),s=ft(""),r=ft(""),o=st(()=>!s.value),a=()=>{s.value="",r.value=""},l=()=>{const h=n.value.selectedNodes.flatMap(_=>[...Object.values(_.inputs),...Object.values(_.outputs)]),f=n.value.connections.filter(_=>h.includes(_.from)||h.includes(_.to)).map(_=>({from:_.from.id,to:_.to.id}));r.value=JSON.stringify(f),s.value=JSON.stringify(n.value.selectedNodes.map(_=>_.save()))},u=(h,f,_)=>{for(const m of h){let E;if((!_||_==="input")&&(E=Object.values(m.inputs).find(b=>b.id===f)),!E&&(!_||_==="output")&&(E=Object.values(m.outputs).find(b=>b.id===f)),E)return E}},d=()=>{if(o.value)return;const h=new Map,f=JSON.parse(s.value),_=JSON.parse(r.value),m=[],E=[],b=n.value;t.executeCommand(JI);for(const g of f){const y=e.value.nodeTypes.get(g.type);if(!y){console.warn(`Node type ${g.type} not registered`);return}const v=new y.type,S=v.id;m.push(v),v.hooks.beforeLoad.subscribe(i,C=>{const T=C;return T.position&&(T.position.x+=100,T.position.y+=100),v.hooks.beforeLoad.unsubscribe(i),T}),b.addNode(v),v.load({...g,id:S}),v.id=S,h.set(g.id,S);for(const C of Object.values(v.inputs)){const T=vu();h.set(C.id,T),C.id=T}for(const C of Object.values(v.outputs)){const T=vu();h.set(C.id,T),C.id=T}}for(const g of _){const y=u(m,h.get(g.from),"output"),v=u(m,h.get(g.to),"input");if(!y||!v)continue;const S=b.addConnection(y,v);S&&E.push(S)}return n.value.selectedNodes=m,t.executeCommand(eM),{newNodes:m,newConnections:E}};return t.registerCommand(Tb,{canExecute:()=>n.value.selectedNodes.length>0,execute:l}),t.registerHotkey(["Control","c"],Tb),t.registerCommand(xb,{canExecute:()=>!o.value,execute:d}),t.registerHotkey(["Control","v"],xb),t.registerCommand(ULt,{canExecute:()=>!0,execute:a}),ei({isEmpty:o})}const BLt="OPEN_SIDEBAR";function GLt(n,e){e.registerCommand(BLt,{execute:t=>{n.value.sidebar.nodeId=t,n.value.sidebar.visible=!0},canExecute:()=>!0})}function VLt(n,e){GLt(n,e)}const zLt={},HLt={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"},qLt=c("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),YLt=c("path",{d:"M9 13l-4 -4l4 -4m-4 4h11a4 4 0 0 1 0 8h-1"},null,-1),$Lt=[qLt,YLt];function WLt(n,e){return w(),A("svg",HLt,$Lt)}const KLt=hn(zLt,[["render",WLt]]),jLt={},QLt={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"},XLt=c("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),ZLt=c("path",{d:"M15 13l4 -4l-4 -4m4 4h-11a4 4 0 0 0 0 8h1"},null,-1),JLt=[XLt,ZLt];function ePt(n,e){return w(),A("svg",QLt,JLt)}const tPt=hn(jLt,[["render",ePt]]),nPt={},iPt={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"},sPt=c("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),rPt=c("line",{x1:"5",y1:"12",x2:"19",y2:"12"},null,-1),oPt=c("line",{x1:"5",y1:"12",x2:"11",y2:"18"},null,-1),aPt=c("line",{x1:"5",y1:"12",x2:"11",y2:"6"},null,-1),lPt=[sPt,rPt,oPt,aPt];function cPt(n,e){return w(),A("svg",iPt,lPt)}const dPt=hn(nPt,[["render",cPt]]),uPt={},pPt={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"},_Pt=c("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),hPt=c("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),fPt=c("rect",{x:"9",y:"3",width:"6",height:"4",rx:"2"},null,-1),mPt=[_Pt,hPt,fPt];function gPt(n,e){return w(),A("svg",pPt,mPt)}const bPt=hn(uPt,[["render",gPt]]),EPt={},yPt={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"},vPt=c("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),SPt=c("rect",{x:"8",y:"8",width:"12",height:"12",rx:"2"},null,-1),TPt=c("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),xPt=[vPt,SPt,TPt];function CPt(n,e){return w(),A("svg",yPt,xPt)}const wPt=hn(EPt,[["render",CPt]]),RPt={},APt={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"},NPt=c("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),OPt=c("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),IPt=c("circle",{cx:"12",cy:"14",r:"2"},null,-1),MPt=c("polyline",{points:"14 4 14 8 8 8 8 4"},null,-1),DPt=[NPt,OPt,IPt,MPt];function kPt(n,e){return w(),A("svg",APt,DPt)}const LPt=hn(RPt,[["render",kPt]]),PPt={},UPt={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"},FPt=Fu('',6),BPt=[FPt];function GPt(n,e){return w(),A("svg",UPt,BPt)}const VPt=hn(PPt,[["render",GPt]]),zPt=_n({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}}}),HPt=["disabled","title"];function qPt(n,e,t,i,s,r){return w(),A("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(Lu(n.icon),{key:0})):(w(),A($e,{key:1},[et(he(n.title),1)],64))],8,HPt)}const YPt=hn(zPt,[["render",qPt]]),$Pt=_n({components:{ToolbarButton:YPt},setup(){const{viewModel:n}=Oi();return{isSubgraph:st(()=>n.value.displayedGraph!==n.value.editor.graph),commands:[{command:Tb,title:"Copy",icon:wPt},{command:xb,title:"Paste",icon:bPt},{command:vb,title:"Undo",icon:KLt},{command:Sb,title:"Redo",icon:tPt},{command:XI,title:"Create Subgraph",icon:VPt}],subgraphCommands:[{command:cc,title:"Save Subgraph",icon:LPt},{command:ZI,title:"Back to Main Graph",icon:dPt}]}}}),WPt={class:"baklava-toolbar"};function KPt(n,e,t,i,s,r){const o=mt("toolbar-button");return w(),A("div",WPt,[(w(!0),A($e,null,lt(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),A($e,{key:0},lt(n.subgraphCommands,a=>(w(),xt(o,{key:a.command,command:a.command,title:a.title,icon:a.icon},null,8,["command","title","icon"]))),128)):V("",!0)])}const jPt=hn($Pt,[["render",KPt]]),QPt={class:"connections-container"},XPt=_n({__name:"Editor",props:{viewModel:{}},setup(n){const e=n,t=Symbol("EditorToken"),i=$d(e,"viewModel");YDt(i);const s=ft(null);sa("editorEl",s);const r=st(()=>e.viewModel.displayedGraph.nodes),o=st(()=>e.viewModel.displayedGraph.nodes.map(O=>BI($d(O,"position")))),a=st(()=>e.viewModel.displayedGraph.connections),l=st(()=>e.viewModel.displayedGraph.selectedNodes),u=$Dt(),d=WDt(),h=KDt(i),f=st(()=>({...u.styles.value})),_=ft(0);e.viewModel.editor.hooks.load.subscribe(t,O=>(_.value++,O));const m=O=>{u.onPointerMove(O),d.onMouseMove(O)},E=O=>{O.button===0&&(O.target===s.value&&(S(),u.onPointerDown(O)),d.onMouseDown())},b=O=>{u.onPointerUp(O),d.onMouseUp()},g=O=>{O.key==="Tab"&&O.preventDefault(),e.viewModel.commandHandler.handleKeyDown(O)},y=O=>{e.viewModel.commandHandler.handleKeyUp(O)},v=O=>{["Control","Shift"].some(k=>e.viewModel.commandHandler.pressedKeys.includes(k))||S(),e.viewModel.displayedGraph.selectedNodes.push(O)},S=()=>{e.viewModel.displayedGraph.selectedNodes=[]},C=O=>{for(const k of e.viewModel.displayedGraph.selectedNodes){const x=r.value.indexOf(k),I=o.value[x];I.onPointerDown(O),document.addEventListener("pointermove",I.onPointerMove)}document.addEventListener("pointerup",T)},T=()=>{for(const O of e.viewModel.displayedGraph.selectedNodes){const k=r.value.indexOf(O),x=o.value[k];x.onPointerUp(),document.removeEventListener("pointermove",x.onPointerMove)}document.removeEventListener("pointerup",T)};return(O,k)=>(w(),A("div",{ref_key:"el",ref:s,tabindex:"-1",class:ze(["baklava-editor",{"baklava-ignore-mouse":!!yt(d).temporaryConnection.value||yt(u).dragging.value,"--temporary-connection":!!yt(d).temporaryConnection.value}]),onPointermove:ge(m,["self"]),onPointerdown:E,onPointerup:b,onWheel:k[1]||(k[1]=ge((...x)=>yt(u).onMouseWheel&&yt(u).onMouseWheel(...x),["self"])),onKeydown:g,onKeyup:y,onContextmenu:k[2]||(k[2]=ge((...x)=>yt(h).open&&yt(h).open(...x),["self","prevent"]))},[kn(O.$slots,"background",{},()=>[Te(XDt)]),kn(O.$slots,"toolbar",{},()=>[Te(jPt)]),kn(O.$slots,"palette",{},()=>[Te(Jkt)]),(w(),A("svg",QPt,[(w(!0),A($e,null,lt(a.value,x=>(w(),A("g",{key:x.id+_.value.toString()},[kn(O.$slots,"connection",{connection:x},()=>[Te(Lkt,{connection:x},null,8,["connection"])])]))),128)),kn(O.$slots,"temporaryConnection",{temporaryConnection:yt(d).temporaryConnection.value},()=>[yt(d).temporaryConnection.value?(w(),xt(Fkt,{key:0,connection:yt(d).temporaryConnection.value},null,8,["connection"])):V("",!0)])])),c("div",{class:"node-container",style:en(f.value)},[Te(as,{name:"fade"},{default:We(()=>[(w(!0),A($e,null,lt(r.value,(x,I)=>kn(O.$slots,"node",{key:x.id+_.value.toString(),node:x,selected:l.value.includes(x),dragging:o.value[I].dragging.value,onSelect:F=>v(x),onStartDrag:C},()=>[Te(Akt,{node:x,selected:l.value.includes(x),dragging:o.value[I].dragging.value,onSelect:F=>v(x),onStartDrag:C},null,8,["node","selected","dragging","onSelect"])])),128))]),_:3})],4),kn(O.$slots,"sidebar",{},()=>[Te(Hkt)]),kn(O.$slots,"minimap",{},()=>[O.viewModel.settings.enableMinimap?(w(),xt(qkt,{key:0})):V("",!0)]),kn(O.$slots,"contextMenu",{contextMenu:yt(h)},()=>[O.viewModel.settings.contextMenu.enabled?(w(),xt(_y,{key:0,modelValue:yt(h).show.value,"onUpdate:modelValue":k[0]||(k[0]=x=>yt(h).show.value=x),items:yt(h).items.value,x:yt(h).x.value,y:yt(h).y.value,onClick:yt(h).onClick},null,8,["modelValue","items","x","y","onClick"])):V("",!0)])],34))}}),ZPt=["INPUT","TEXTAREA","SELECT"];function JPt(n){const e=ft([]),t=ft([]);return{pressedKeys:e,handleKeyDown:o=>{var a;e.value.includes(o.key)||e.value.push(o.key),!ZPt.includes(((a=document.activeElement)==null?void 0:a.tagName)??"")&&t.value.forEach(l=>{l.keys.every(u=>e.value.includes(u))&&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 eUt=()=>{const n=ft(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=JPt(t);return ei({registerCommand:e,executeCommand:t,canExecuteCommand:i,...s})},tUt=n=>!(n instanceof Sc);function nUt(n,e){return{switchGraph:i=>{let s;if(tUt(i))s=new Sc(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 iUt(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 sUt=()=>({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 rUt(n){const e=ft(n??new BDt),t=Symbol("ViewModelToken"),i=ft(null),s=s2(i),{switchGraph:r}=nUt(e,i),o=st(()=>s.value&&s.value!==e.value.graph),a=ei(sUt()),l=eUt(),u=PLt(s,l),d=FLt(s,e,l),h={renderNode:new li(null),renderInterface:new li(null)};return kLt(s,l,r),VLt(s,l),qn(e,(f,_)=>{_&&(_.events.registerGraph.unsubscribe(t),_.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,(m,E)=>(E.position=m.position??{x:0,y:0},E.width=m.width??a.nodes.defaultWidth,E.twoColumn=m.twoColumn??!1,m)),f.nodeHooks.afterSave.subscribe(t,(m,E)=>(m.position=E.position,m.width=E.width,m.twoColumn=E.twoColumn,m)),f.graphTemplateHooks.beforeLoad.subscribe(t,(m,E)=>(E.panning=m.panning,E.scaling=m.scaling,m)),f.graphTemplateHooks.afterSave.subscribe(t,(m,E)=>(m.panning=E.panning,m.scaling=E.scaling,m)),f.graph.hooks.load.subscribe(t,(m,E)=>(E.panning=m.panning,E.scaling=m.scaling,m)),f.graph.hooks.save.subscribe(t,(m,E)=>(m.panning=E.panning,m.scaling=E.scaling,m)),f.graphEvents.beforeAddNode.subscribe(t,m=>iUt(m,{defaultWidth:a.nodes.defaultWidth})),e.value.registerNodeType(jI,{category:"Subgraphs"}),e.value.registerNodeType(QI,{category:"Subgraphs"}),r(f.graph))},{immediate:!0}),ei({editor:e,displayedGraph:s,isSubgraph:o,settings:a,commandHandler:l,history:u,clipboard:d,hooks:h,switchGraph:r})}const oUt=Ja({type:"PersonalityNode",title:"Personality",inputs:{request:()=>new nn("Request",""),agent_name:()=>new vLt("Personality","",Su.state.config.personalities).setPort(!1)},outputs:{response:()=>new nn("Response","")},async calculate({request:n}){console.log(Su.state.config.personalities);let e="";try{e=(await Se.post("/generate",{params:{text:n}})).data}catch(t){console.error(t)}return{display:e,response:e}}}),aUt=Ja({type:"RAGNode",title:"RAG",inputs:{request:()=>new nn("Prompt",""),document_path:()=>new Tc("Document path","").setPort(!1)},outputs:{prompt:()=>new nn("Prompt with Data","")},async calculate({request:n,document_path:e}){let t="";try{t=(await Se.get("/rag",{params:{text:n,doc_path:e}})).data}catch(i){console.error(i)}return{response:t}}}),Yw=Ja({type:"Task",title:"Task",inputs:{description:()=>new Tc("Task description","").setPort(!1)},outputs:{prompt:()=>new nn("Prompt")},calculate({description:n}){return{prompt:n}}}),$w=Ja({type:"TextDisplayNode",title:"TextDisplay",inputs:{text2display:()=>new nn("Input","")},outputs:{response:()=>new CLt("Text","")},async calculate({request:n}){}}),Ww=Ja({type:"LLMNode",title:"LLM",inputs:{request:()=>new nn("Request","")},outputs:{response:()=>new nn("Response","")},async calculate({request:n}){console.log(Su.state.config.personalities);let e="";try{e=(await Se.post("/generate",{params:{text:n}})).data}catch(t){console.error(t)}return{display:e,response:e}}}),lUt=Ja({type:"MultichoiceNode",title:"Multichoice",inputs:{question:()=>new nn("Question",""),outputs:()=>new Tc("choices, one per line","","").setPort(!1)},outputs:{response:()=>new nn("Response","")}}),cUt=_n({components:{"baklava-editor":XPt},setup(){const n=rUt(),e=new qDt(n.editor);n.editor.registerNodeType(oUt),n.editor.registerNodeType(Yw),n.editor.registerNodeType(aUt),n.editor.registerNodeType($w),n.editor.registerNodeType(Ww),n.editor.registerNodeType(lUt);const t=Symbol();e.events.afterRun.subscribe(t,a=>{e.pause(),GDt(a,n.editor),e.resume()}),e.start();function i(a,l,u){const d=new a;return n.displayedGraph.addNode(d),d.position.x=l,d.position.y=u,d}const s=i(Yw,300,140),r=i(Ww,550,140),o=i($w,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)}}}}),dUt={style:{width:"100vw",height:"100vh"}};function uUt(n,e,t,i,s,r){const o=mt("baklava-editor");return w(),A("div",dUt,[Te(o,{"view-model":n.baklava},null,8,["view-model"]),c("button",{onClick:e[0]||(e[0]=(...a)=>n.saveGraph&&n.saveGraph(...a))},"Save Graph"),c("button",{onClick:e[1]||(e[1]=(...a)=>n.loadGraph&&n.loadGraph(...a))},"Load Graph")])}const pUt=bt(cUt,[["render",uUt]]),_Ut={},hUt={style:{width:"100vw",height:"100vh"}},fUt=["src"];function mUt(n,e,t,i,s,r){return w(),A("div",hUt,[c("iframe",{src:n.$store.state.config.comfyui_base_url,class:"m-0 p-0 w-full h-full"},null,8,fUt)])}const gUt=bt(_Ut,[["render",mUt]]),bUt={},EUt={style:{width:"100vw",height:"100vh"}},yUt=["src"];function vUt(n,e,t,i,s,r){return w(),A("div",EUt,[c("iframe",{src:n.$store.state.config.sd_base_url,class:"m-0 p-0 w-full h-full"},null,8,yUt)])}const SUt=bt(bUt,[["render",vUt]]),TUt=HP({history:aP("/"),routes:[{path:"/auto_sd_view/",name:"AutoSD",component:SUt},{path:"/autosd_view/",name:"ComfyUI",component:gUt},{path:"/playground/",name:"playground",component:Rtt},{path:"/extensions/",name:"extensions",component:Ftt},{path:"/help_view/",name:"help_view",component:qtt},{path:"/settings/",name:"settings",component:Lbt},{path:"/training/",name:"training",component:nEt},{path:"/quantizing/",name:"quantizing",component:uEt},{path:"/",name:"discussions",component:gwt},{path:"/",name:"interactive",component:MDt},{path:"/",name:"nodes",component:pUt}]});const mp=jD(RZe);console.log("Loaded main.js");function xUt(n){const e={};for(const t in n)n.hasOwnProperty(t)&&(e[t]=n[t]);return e}const Su=vk({state(){return{is_rt_on:!1,language:"english",languages:[],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},posts_headers:{accept:"application/json","Content-Type":"application/json"},client_id:"",yesNoDialog:null,universalForm:null,toast:null,news:null,messageBox:null,api_get_req:null,api_post_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:[],bindingsZoo:[],modelsArr:[],selectedModel:null,personalities:[],diskUsage:null,ramUsage:null,vramUsage:null,modelsZoo:[],installedModels:[],installedBindings:[],currentModel:null,currentBinding:null,databases:[]}},mutations:{setisRTOn(n,e){n.is_rt_on=e},setLanguages(n,e){n.languages=e},setLanguage(n,e){n.language=e},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},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},setDatabases(n,e){n.databases=e},setTheme(n){this.currentTheme=n}},getters:{getisRTOn(n){return n.is_rt_on},getLanguages(n){return n.languages},getLanguage(n){return n.language},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},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}},actions:{async getVersion(){try{let n=await Se.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{console.log("Fetching configuration with client id: ",this.state.client_id);const e=await tM("get_config",this.state.client_id);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],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 Qi("list_databases");console.log("databases:",e),n("setDatabases",e)},async fetchisRTOn({commit:n}){const t=(await Se.get("/is_rt_on")).data.status;n("setisRTOn",t)},async fetchLanguages({commit:n}){console.log("get_personality_languages_list",this.state.client_id);const e=await Se.post("/get_personality_languages_list",{client_id:this.state.client_id});console.log("response",e);const t=e.data;console.log("languages",t),n("setLanguages",t)},async fetchLanguage({commit:n}){console.log("get_personality_language",this.state.client_id);const e=await Se.post("/get_personality_language",{client_id:this.state.client_id});console.log("response",e);const t=e.data;console.log("language",t),n("setLanguage",t)},async changeLanguage({commit:n},e){console.log("Changing language to ",e);let t=await Se.post("/set_personality_language",{client_id:this.state.client_id,language:e});console.log("get_personality_languages_list",this.state.client_id),t=await Se.post("/get_personality_languages_list",{client_id:this.state.client_id}),console.log("response",t);const i=t.data;console.log("languages",i),n("setLanguages",i),t=await Se.post("/get_personality_language",{client_id:this.state.client_id}),console.log("response",t);const s=t.data;console.log("language",s),n("setLanguage",s),console.log("Language changed successfully:",t.data.message)},async deleteLanguage({commit:n},e){console.log("Deleting ",e);let t=await Se.post("/del_personality_language",{client_id:this.state.client_id,language:e});console.log("get_personality_languages_list",this.state.client_id),t=await Se.post("/get_personality_languages_list",{client_id:this.state.client_id}),console.log("response",t);const i=t.data;console.log("languages",i),n("setLanguages",i),t=await Se.post("/get_personality_language",{client_id:this.state.client_id}),console.log("response",t);const s=t.data;console.log("language",s),n("setLanguage",s),console.log("Language changed successfully:",t.data.message)},async refreshPersonalitiesZoo({commit:n}){let e=[];const t=await Qi("get_all_personalities"),i=Object.keys(t);console.log("Personalities recovered:"+this.state.config.personalities);for(let s=0;s{let u=!1;for(const h of this.state.config.personalities)if(h.includes(r+"/"+l.folder))if(u=!0,h.includes(":")){const f=h.split(":");l.language=f[1]}else l.language=null;let d={};return d=l,d.category=r,d.full_path=r+"/"+l.folder,d.isMounted=u,d});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=xUt(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 Qi("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 Se.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 Qi("get_model_status");n("setIsModelOk",e.status)},async refreshModels({commit:n}){console.log("Fetching models");let e=await Qi("list_models");console.log(`Found ${e}`);let t=await Qi("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 refreshDiskUsage({commit:n}){this.state.diskUsage=await Qi("disk_usage")},async refreshRamUsage({commit:n}){this.state.ramUsage=await Qi("ram_usage")},async refreshVramUsage({commit:n}){const e=await Qi("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 u=l.pageX-t.value.x,d=l.pageY-t.value.y;n.value.x=i.value.x+u/e.value.scaling,n.value.y=i.value.y+d/e.value.scaling}},onPointerUp:()=>{t.value=null,i.value=null}}}function GI(n,e,t){if(!e.template)return!1;if(La(e.template)===t)return!0;const i=n.graphTemplates.find(r=>La(r)===t);return i?i.nodes.filter(r=>r.type.startsWith(lc)).some(r=>GI(n,e,r.type)):!1}function VI(n){return st(()=>{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])=>!GI(n.value.editor,n.value.displayedGraph,o)):r=r.filter(([o])=>![Da,ka].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 zI(){const{graph:n}=Ki();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 YDt(){const{graph:n}=Ki();let e=[],t=-1,i={x:0,y:0};const s=st(()=>n.value.panning),r=BI(s),o=st(()=>({"transform-origin":"0 0",transform:`scale(${n.value.scaling}) translate(${n.value.panning.x}px, ${n.value.panning.y}px)`})),a=(_,m,E)=>{const b=[_/n.value.scaling-n.value.panning.x,m/n.value.scaling-n.value.panning.y],g=[_/E-n.value.panning.x,m/E-n.value.panning.y],y=[g[0]-b[0],g[1]-b[1]];n.value.panning.x+=y[0],n.value.panning.y+=y[1],n.value.scaling=E},l=_=>{_.preventDefault();let m=_.deltaY;_.deltaMode===1&&(m*=32);const E=n.value.scaling*(1-m/3e3);a(_.offsetX,_.offsetY,E)},u=()=>({ax:e[0].clientX,ay:e[0].clientY,bx:e[1].clientX,by:e[1].clientY});return{styles:o,...r,onPointerDown:_=>{if(e.push(_),r.onPointerDown(_),e.length===2){const{ax:m,ay:E,bx:b,by:g}=u();i={x:m+(b-m)/2,y:E+(g-E)/2}}},onPointerMove:_=>{for(let m=0;m0){const C=n.value.scaling*(1+(S-t)/500);a(i.x,i.y,C)}t=S}else r.onPointerMove(_)},onPointerUp:_=>{e=e.filter(m=>m.pointerId!==_.pointerId),t=-1,r.onPointerUp()},onMouseWheel:l}}var Ei=(n=>(n[n.NONE=0]="NONE",n[n.ALLOWED=1]="ALLOWED",n[n.FORBIDDEN=2]="FORBIDDEN",n))(Ei||{});const HI=Symbol();function $Dt(){const{graph:n}=Ki(),e=ft(null),t=ft(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:Ei.NONE,from:a.from},n.value.removeConnection(a)):e.value={status:Ei.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?Ei.ALLOWED:Ei.FORBIDDEN,l.connectionAllowed){const u=l.connectionsInDanger.map(d=>d.id);n.value.connections.forEach(d=>{u.includes(d.id)&&(d.isInDanger=!0)})}}else!a&&e.value&&(e.value.to=void 0,e.value.status=Ei.NONE,n.value.connections.forEach(l=>{l.isInDanger=!1}))};return sa(HI,{temporaryConnection:e,hoveredOver:o}),{temporaryConnection:e,onMouseMove:i,onMouseDown:s,onMouseUp:r,hoveredOver:o}}function WDt(n){const e=ft(!1),t=ft(0),i=ft(0),s=VI(n),{transform:r}=zI(),o=st(()=>{let d=[];const h={};for(const _ of s.value){const m=Object.entries(_.nodeTypes).map(([E,b])=>({label:b.title,value:"addNode:"+E}));_.name==="default"?d=m:h[_.name]=m}const f=[...Object.entries(h).map(([_,m])=>({label:_,submenu:m}))];return f.length>0&&d.length>0&&f.push({isDivider:!0}),f.push(...d),f}),a=st(()=>n.value.settings.contextMenu.additionalItems.length===0?o.value:[{label:"Add node",submenu:o.value},...n.value.settings.contextMenu.additionalItems.map(d=>"isDivider"in d||"submenu"in d?d:{label:d.label,value:"command:"+d.command,disabled:!n.value.commandHandler.canExecuteCommand(d.command)})]);function l(d){e.value=!0,t.value=d.offsetX,i.value=d.offsetY}function u(d){if(d.startsWith("addNode:")){const h=d.substring(8),f=n.value.editor.nodeTypes.get(h);if(!f)return;const _=ei(new f.type);n.value.displayedGraph.addNode(_);const[m,E]=r(t.value,i.value);_.position.x=m,_.position.y=E}else if(d.startsWith("command:")){const h=d.substring(8);n.value.commandHandler.canExecuteCommand(h)&&n.value.commandHandler.executeCommand(h)}}return{show:e,x:t,y:i,items:a,open:l,onClick:u}}const KDt=_n({setup(){const{viewModel:n}=Oi(),{graph:e}=Ki();return{styles:st(()=>{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`,u=e.value.scaling>i.subGridVisibleThreshold?`, ${a}px ${a}px, ${a}px ${a}px`:"";return{backgroundPosition:`left ${s}px top ${r}px`,backgroundSize:`${l} ${u}`}})}}}),hn=(n,e)=>{const t=n.__vccOpts||n;for(const[i,s]of e)t[i]=s;return t};function jDt(n,e,t,i,s,r){return w(),A("div",{class:"background",style:en(n.styles)},null,4)}const QDt=hn(KDt,[["render",jDt]]);function XDt(n){return eR()?(NM(n),!0):!1}function uy(n){return typeof n=="function"?n():yt(n)}const qI=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const ZDt=Object.prototype.toString,JDt=n=>ZDt.call(n)==="[object Object]",Vd=()=>{},ekt=tkt();function tkt(){var n,e;return qI&&((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 nkt(n,e,t=!1){return e.reduce((i,s)=>(s in n&&(!t||n[s]!==void 0)&&(i[s]=n[s]),i),{})}function ikt(n,e={}){if(!fn(n))return d2(n);const t=Array.isArray(n.value)?Array.from({length:n.value.length}):{};for(const i in n.value)t[i]=c2(()=>({get(){return n.value[i]},set(s){var r;if((r=uy(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 Al(n){var e;const t=uy(n);return(e=t==null?void 0:t.$el)!=null?e:t}const py=qI?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=py):[e,t,i,s]=n,!e)return Vd;Array.isArray(t)||(t=[t]),Array.isArray(i)||(i=[i]);const r=[],o=()=>{r.forEach(d=>d()),r.length=0},a=(d,h,f,_)=>(d.addEventListener(h,f,_),()=>d.removeEventListener(h,f,_)),l=qn(()=>[Al(e),uy(s)],([d,h])=>{if(o(),!d)return;const f=JDt(h)?{...h}:h;r.push(...t.flatMap(_=>i.map(m=>a(d,_,m,f))))},{immediate:!0,flush:"post"}),u=()=>{l(),o()};return XDt(u),u}let Uw=!1;function YI(n,e,t={}){const{window:i=py,ignore:s=[],capture:r=!0,detectIframe:o=!1}=t;if(!i)return Vd;ekt&&!Uw&&(Uw=!0,Array.from(i.document.body.children).forEach(f=>f.addEventListener("click",Vd)),i.document.documentElement.addEventListener("click",Vd));let a=!0;const l=f=>s.some(_=>{if(typeof _=="string")return Array.from(i.document.querySelectorAll(_)).some(m=>m===f.target||f.composedPath().includes(m));{const m=Al(_);return m&&(f.target===m||f.composedPath().includes(m))}}),d=[Vl(i,"click",f=>{const _=Al(n);if(!(!_||_===f.target||f.composedPath().includes(_))){if(f.detail===0&&(a=!l(f)),!a){a=!0;return}e(f)}},{passive:!0,capture:r}),Vl(i,"pointerdown",f=>{const _=Al(n);a=!l(f)&&!!(_&&!f.composedPath().includes(_))},{passive:!0}),o&&Vl(i,"blur",f=>{setTimeout(()=>{var _;const m=Al(n);((_=i.document.activeElement)==null?void 0:_.tagName)==="IFRAME"&&!(m!=null&&m.contains(i.document.activeElement))&&e(f)},0)})].filter(Boolean);return()=>d.forEach(f=>f())}const $I={x:0,y:0,pointerId:0,pressure:0,tiltX:0,tiltY:0,width:0,height:0,twist:0,pointerType:null},skt=Object.keys($I);function rkt(n={}){const{target:e=py}=n,t=ft(!1),i=ft(n.initialValue||{});Object.assign(i.value,$I,i.value);const s=r=>{t.value=!0,!(n.pointerTypes&&!n.pointerTypes.includes(r.pointerType))&&(i.value=nkt(r,skt,!1))};if(e){const r={passive:!0};Vl(e,["pointerdown","pointermove","pointerup"],s,r),Vl(e,"pointerleave",()=>t.value=!1,r)}return{...ikt(i),isInside:t}}const okt=["onMouseenter","onMouseleave","onClick"],akt={class:"flex-fill"},lkt={key:0,class:"__submenu-icon",style:{"line-height":"1em"}},ckt=c("svg",{width:"13",height:"13",viewBox:"-60 120 250 250"},[c("path",{d:"M160.875 279.5625 L70.875 369.5625 L70.875 189.5625 L160.875 279.5625 Z",stroke:"none",fill:"white"})],-1),dkt=[ckt],_y=_n({__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=ft(null),o=ft(-1),a=ft(0),l=ft({x:!1,y:!1}),u=st(()=>t.flippable&&(l.value.x||t.isFlipped.x)),d=st(()=>t.flippable&&(l.value.y||t.isFlipped.y)),h=st(()=>{const y={};return t.isNested||(y.top=(d.value?t.y-a.value:t.y)+"px",y.left=t.x+"px"),y}),f=st(()=>({"--flipped-x":u.value,"--flipped-y":d.value,"--nested":t.isNested})),_=st(()=>t.items.map(y=>({...y,hover:!1})));qn([()=>t.y,()=>t.items],()=>{var y,v,S,C;a.value=t.items.length*30;const T=((v=(y=r.value)==null?void 0:y.parentElement)==null?void 0:v.offsetWidth)??0,O=((C=(S=r.value)==null?void 0:S.parentElement)==null?void 0:C.offsetHeight)??0;l.value.x=!t.isNested&&t.x>T*.75,l.value.y=!t.isNested&&t.y+a.value>O-20}),YI(r,()=>{t.modelValue&&i("update:modelValue",!1)});const m=y=>{!y.submenu&&y.value&&(i("click",y.value),i("update:modelValue",!1))},E=y=>{i("click",y),o.value=-1,t.isNested||i("update:modelValue",!1)},b=(y,v)=>{t.items[v].submenu&&(o.value=v,s!==null&&(clearTimeout(s),s=null))},g=(y,v)=>{t.items[v].submenu&&(s=window.setTimeout(()=>{o.value=-1,s=null},200))};return(y,v)=>{const S=mt("ContextMenu",!0);return w(),xt(Vi,{name:"slide-fade"},{default:We(()=>[G(c("div",{ref_key:"el",ref:r,class:ze(["baklava-context-menu",f.value]),style:en(h.value)},[(w(!0),A($e,null,lt(_.value,(C,T)=>(w(),A($e,null,[C.isDivider?(w(),A("div",{key:`d-${T}`,class:"divider"})):(w(),A("div",{key:`i-${T}`,class:ze(["item",{submenu:!!C.submenu,"--disabled":!!C.disabled}]),onMouseenter:O=>b(O,T),onMouseleave:O=>g(O,T),onClick:ge(O=>m(C),["stop","prevent"])},[c("div",akt,he(C.label),1),C.submenu?(w(),A("div",lkt,dkt)):V("",!0),C.submenu?(w(),xt(S,{key:1,"model-value":o.value===T,items:C.submenu,"is-nested":!0,"is-flipped":{x:u.value,y:d.value},flippable:y.flippable,onClick:E},null,8,["model-value","items","is-flipped","flippable"])):V("",!0)],42,okt))],64))),256))],6),[[Mt,y.modelValue]])]),_:1})}}}),ukt={},pkt={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"},_kt=c("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),hkt=c("circle",{cx:"12",cy:"12",r:"1"},null,-1),fkt=c("circle",{cx:"12",cy:"19",r:"1"},null,-1),mkt=c("circle",{cx:"12",cy:"5",r:"1"},null,-1),gkt=[_kt,hkt,fkt,mkt];function bkt(n,e){return w(),A("svg",pkt,gkt)}const WI=hn(ukt,[["render",bkt]]),Ekt=["id"],ykt={key:0,class:"__tooltip"},vkt={key:2,class:"align-middle"},Fw=_n({__name:"NodeInterface",props:{node:{},intf:{}},setup(n){const e=(b,g=100)=>{const y=b!=null&&b.toString?b.toString():"";return y.length>g?y.slice(0,g)+"...":y},t=n,{viewModel:i}=Oi(),{hoveredOver:s,temporaryConnection:r}=Gi(HI),o=ft(null),a=st(()=>t.intf.connectionCount>0),l=ft(!1),u=st(()=>i.value.settings.displayValueOnHover&&l.value),d=st(()=>({"--input":t.intf.isInput,"--output":!t.intf.isInput,"--connected":a.value})),h=st(()=>t.intf.component&&(!t.intf.isInput||!t.intf.port||t.intf.connectionCount===0)),f=()=>{l.value=!0,s(t.intf)},_=()=>{l.value=!1,s(void 0)},m=()=>{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 Ws(m),uc(m),(b,g)=>{var y;return w(),A("div",{id:b.intf.id,ref_key:"el",ref:o,class:ze(["baklava-node-interface",d.value])},[b.intf.port?(w(),A("div",{key:0,class:ze(["__port",{"--selected":((y=yt(r))==null?void 0:y.from)===b.intf}]),onPointerover:f,onPointerout:_},[kn(b.$slots,"portTooltip",{showTooltip:u.value},()=>[u.value===!0?(w(),A("span",ykt,he(e(b.intf.value)),1)):V("",!0)])],34)):V("",!0),h.value?(w(),xt(Lu(b.intf.component),{key:1,modelValue:b.intf.value,"onUpdate:modelValue":g[0]||(g[0]=v=>b.intf.value=v),node:b.node,intf:b.intf,onOpenSidebar:E},null,40,["modelValue","node","intf"])):(w(),A("span",vkt,he(b.intf.name),1))],10,Ekt)}}}),Skt=["id","data-node-type"],Tkt={class:"__title-label"},xkt={class:"__menu"},Ckt={class:"__outputs"},wkt={class:"__inputs"},Rkt=_n({__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}=Ki(),a=ft(null),l=ft(!1),u=ft(""),d=ft(null),h=ft(!1),f=ft(!1),_=st(()=>{const F=[{value:"rename",label:"Rename"},{value:"delete",label:"Delete"}];return t.node.type.startsWith(lc)&&F.push({value:"editSubgraph",label:"Edit Subgraph"}),F}),m=st(()=>({"--selected":t.selected,"--dragging":t.dragging,"--two-column":!!t.node.twoColumn})),E=st(()=>{var F,B;return{top:`${((F=t.node.position)==null?void 0:F.y)??0}px`,left:`${((B=t.node.position)==null?void 0:B.x)??0}px`,"--width":`${t.node.width??s.value.settings.nodes.defaultWidth}px`}}),b=st(()=>Object.values(t.node.inputs).filter(F=>!F.hidden)),g=st(()=>Object.values(t.node.outputs).filter(F=>!F.hidden)),y=()=>{i("select")},v=F=>{t.selected||y(),i("start-drag",F)},S=()=>{f.value=!0},C=async F=>{var B;switch(F){case"delete":r.value.removeNode(t.node);break;case"rename":u.value=t.node.title,l.value=!0,await Ge(),(B=d.value)==null||B.focus();break;case"editSubgraph":o(t.node.template);break}},T=()=>{t.node.title=u.value,l.value=!1},O=()=>{a.value&&s.value.hooks.renderNode.execute({node:t.node,el:a.value})},k=F=>{h.value=!0,F.preventDefault()},x=F=>{if(!h.value)return;const B=t.node.width+F.movementX/r.value.scaling,ne=s.value.settings.nodes.minWidth,L=s.value.settings.nodes.maxWidth;t.node.width=Math.max(ne,Math.min(L,B))},I=()=>{h.value=!1};return Ws(()=>{O(),window.addEventListener("mousemove",x),window.addEventListener("mouseup",I)}),uc(O),Va(()=>{window.removeEventListener("mousemove",x),window.removeEventListener("mouseup",I)}),(F,B)=>(w(),A("div",{id:F.node.id,ref_key:"el",ref:a,class:ze(["baklava-node",m.value]),style:en(E.value),"data-node-type":F.node.type,onPointerdown:y},[yt(s).settings.nodes.resizable?(w(),A("div",{key:0,class:"__resize-handle",onMousedown:k},null,32)):V("",!0),kn(F.$slots,"title",{},()=>[c("div",{class:"__title",onPointerdown:ge(v,["self","stop"])},[l.value?G((w(),A("input",{key:1,ref_key:"renameInputEl",ref:d,"onUpdate:modelValue":B[1]||(B[1]=ne=>u.value=ne),type:"text",class:"baklava-input",placeholder:"Node Name",onBlur:T,onKeydown:Hs(T,["enter"])},null,544)),[[we,u.value]]):(w(),A($e,{key:0},[c("div",Tkt,he(F.node.title),1),c("div",xkt,[Te(WI,{class:"--clickable",onClick:S}),Te(_y,{modelValue:f.value,"onUpdate:modelValue":B[0]||(B[0]=ne=>f.value=ne),x:0,y:0,items:_.value,onClick:C},null,8,["modelValue","items"])])],64))],32)]),kn(F.$slots,"content",{},()=>[c("div",{class:"__content",onKeydown:B[2]||(B[2]=Hs(ge(()=>{},["stop"]),["delete"]))},[c("div",Ckt,[(w(!0),A($e,null,lt(g.value,ne=>kn(F.$slots,"nodeInterface",{key:ne.id,type:"output",node:F.node,intf:ne},()=>[Te(Fw,{node:F.node,intf:ne},null,8,["node","intf"])])),128))]),c("div",wkt,[(w(!0),A($e,null,lt(b.value,ne=>kn(F.$slots,"nodeInterface",{key:ne.id,type:"input",node:F.node,intf:ne},()=>[Te(Fw,{node:F.node,intf:ne},null,8,["node","intf"])])),128))])],32)])],46,Skt))}}),Akt=_n({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:Ei.NONE},isTemporary:{type:Boolean,default:!1}},setup(n){const{viewModel:e}=Oi(),{graph:t}=Ki(),i=(o,a)=>{const l=(o+t.value.panning.x)*t.value.scaling,u=(a+t.value.panning.y)*t.value.scaling;return[l,u]},s=st(()=>{const[o,a]=i(n.x1,n.y1),[l,u]=i(n.x2,n.y2);if(e.value.settings.useStraightConnections)return`M ${o} ${a} L ${l} ${u}`;{const d=.3*Math.abs(o-l);return`M ${o} ${a} C ${o+d} ${a}, ${l-d} ${u}, ${l} ${u}`}}),r=st(()=>({"--temporary":n.isTemporary,"--allowed":n.state===Ei.ALLOWED,"--forbidden":n.state===Ei.FORBIDDEN}));return{d:s,classes:r}}}),Nkt=["d"];function Okt(n,e,t,i,s,r){return w(),A("path",{class:ze(["baklava-connection",n.classes]),d:n.d},null,10,Nkt)}const KI=hn(Akt,[["render",Okt]]);function Ikt(n){return document.getElementById(n.id)}function Pa(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 Mkt=_n({components:{"connection-view":KI},props:{connection:{type:Object,required:!0}},setup(n){const{graph:e}=Ki();let t;const i=ft({x1:0,y1:0,x2:0,y2:0}),s=st(()=>n.connection.isInDanger?Ei.FORBIDDEN:Ei.NONE),r=st(()=>{var u;return(u=e.value.findNodeById(n.connection.from.nodeId))==null?void 0:u.position}),o=st(()=>{var u;return(u=e.value.findNodeById(n.connection.to.nodeId))==null?void 0:u.position}),a=u=>u.node&&u.interface&&u.port?[u.node.offsetLeft+u.interface.offsetLeft+u.port.offsetLeft+u.port.clientWidth/2,u.node.offsetTop+u.interface.offsetTop+u.port.offsetTop+u.port.clientHeight/2]:[0,0],l=()=>{const u=Pa(n.connection.from),d=Pa(n.connection.to);u.node&&d.node&&(t||(t=new ResizeObserver(()=>{l()}),t.observe(u.node),t.observe(d.node)));const[h,f]=a(u),[_,m]=a(d);i.value={x1:h,y1:f,x2:_,y2:m}};return Ws(async()=>{await Ge(),l()}),Va(()=>{t&&t.disconnect()}),qn([r,o],()=>l(),{deep:!0}),{d:i,state:s}}});function Dkt(n,e,t,i,s,r){const o=mt("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 kkt=hn(Mkt,[["render",Dkt]]);function yu(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 Lkt=_n({components:{"connection-view":KI},props:{connection:{type:Object,required:!0}},setup(n){const e=st(()=>n.connection?n.connection.status:Ei.NONE);return{d:st(()=>{if(!n.connection)return{input:[0,0],output:[0,0]};const i=yu(Pa(n.connection.from)),s=n.connection.to?yu(Pa(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 Pkt(n,e,t,i,s,r){const o=mt("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 Ukt=hn(Lkt,[["render",Pkt]]),Fkt=_n({setup(){const{viewModel:n}=Oi(),{graph:e}=Ki(),t=ft(null),i=$d(n.value.settings.sidebar,"width"),s=st(()=>n.value.settings.sidebar.resizable),r=st(()=>{const h=e.value.sidebar.nodeId;return e.value.nodes.find(f=>f.id===h)}),o=st(()=>({width:`${i.value}px`})),a=st(()=>r.value?[...Object.values(r.value.inputs),...Object.values(r.value.outputs)].filter(f=>f.displayInSidebar&&f.component):[]),l=()=>{e.value.sidebar.visible=!1},u=()=>{window.addEventListener("mousemove",d),window.addEventListener("mouseup",()=>{window.removeEventListener("mousemove",d)},{once:!0})},d=h=>{var f,_;const m=((_=(f=t.value)==null?void 0:f.parentElement)==null?void 0:_.getBoundingClientRect().width)??500;let E=i.value-h.movementX;E<300?E=300:E>.9*m&&(E=.9*m),i.value=E};return{el:t,graph:e,resizable:s,node:r,styles:o,displayedInterfaces:a,startResize:u,close:l}}}),Bkt={class:"__header"},Gkt={class:"__node-name"};function Vkt(n,e,t,i,s,r){return w(),A("div",{ref:"el",class:ze(["baklava-sidebar",{"--open":n.graph.sidebar.visible}]),style:en(n.styles)},[n.resizable?(w(),A("div",{key:0,class:"__resizer",onMousedown:e[0]||(e[0]=(...o)=>n.startResize&&n.startResize(...o))},null,32)):V("",!0),c("div",Bkt,[c("button",{tabindex:"-1",class:"__close",onClick:e[1]||(e[1]=(...o)=>n.close&&n.close(...o))},"×"),c("div",Gkt,[c("b",null,he(n.node?n.node.title:""),1)])]),(w(!0),A($e,null,lt(n.displayedInterfaces,o=>(w(),A("div",{key:o.id,class:"__interface"},[(w(),xt(Lu(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 zkt=hn(Fkt,[["render",Vkt]]),Hkt=_n({__name:"Minimap",setup(n){const{viewModel:e}=Oi(),{graph:t}=Ki(),i=ft(null),s=ft(!1);let r,o=!1,a={x1:0,y1:0,x2:0,y2:0},l;const u=()=>{var T,O;if(!r)return;r.canvas.width=i.value.offsetWidth,r.canvas.height=i.value.offsetHeight;const k=new Map,x=new Map;for(const L of t.value.nodes){const $=Ikt(L),H=($==null?void 0:$.offsetWidth)??0,U=($==null?void 0:$.offsetHeight)??0,Q=((T=L.position)==null?void 0:T.x)??0,J=((O=L.position)==null?void 0:O.y)??0;k.set(L,{x1:Q,y1:J,x2:Q+H,y2:J+U}),x.set(L,$)}const I={x1:Number.MAX_SAFE_INTEGER,y1:Number.MAX_SAFE_INTEGER,x2:Number.MIN_SAFE_INTEGER,y2:Number.MIN_SAFE_INTEGER};for(const L of k.values())L.x1I.x2&&(I.x2=L.x2),L.y2>I.y2&&(I.y2=L.y2);const F=50;I.x1-=F,I.y1-=F,I.x2+=F,I.y2+=F,a=I;const B=r.canvas.width/r.canvas.height,ne=(a.x2-a.x1)/(a.y2-a.y1);if(B>ne){const L=(B-ne)*(a.y2-a.y1)*.5;a.x1-=L,a.x2+=L}else{const L=a.x2-a.x1,$=a.y2-a.y1,H=(L-B*$)/B*.5;a.y1-=H,a.y2+=H}r.clearRect(0,0,r.canvas.width,r.canvas.height),r.strokeStyle="white";for(const L of t.value.connections){const[$,H]=yu(Pa(L.from)),[U,Q]=yu(Pa(L.to)),[J,j]=d($,H),[ae,ve]=d(U,Q);if(r.beginPath(),r.moveTo(J,j),e.value.settings.useStraightConnections)r.lineTo(ae,ve);else{const ee=.3*Math.abs(J-ae);r.bezierCurveTo(J+ee,j,ae-ee,ve,ae,ve)}r.stroke()}r.strokeStyle="lightgray";for(const[L,$]of k.entries()){const[H,U]=d($.x1,$.y1),[Q,J]=d($.x2,$.y2);r.fillStyle=f(x.get(L)),r.beginPath(),r.rect(H,U,Q-H,J-U),r.fill(),r.stroke()}if(s.value){const L=m(),[$,H]=d(L.x1,L.y1),[U,Q]=d(L.x2,L.y2);r.fillStyle="rgba(255, 255, 255, 0.2)",r.fillRect($,H,U-$,Q-H)}},d=(T,O)=>[(T-a.x1)/(a.x2-a.x1)*r.canvas.width,(O-a.y1)/(a.y2-a.y1)*r.canvas.height],h=(T,O)=>[T*(a.x2-a.x1)/r.canvas.width+a.x1,O*(a.y2-a.y1)/r.canvas.height+a.y1],f=T=>{if(T){const O=T.querySelector(".__content");if(O){const x=_(O);if(x)return x}const k=_(T);if(k)return k}return"gray"},_=T=>{const O=getComputedStyle(T).backgroundColor;if(O&&O!=="rgba(0, 0, 0, 0)")return O},m=()=>{const T=i.value.parentElement.offsetWidth,O=i.value.parentElement.offsetHeight,k=T/t.value.scaling-t.value.panning.x,x=O/t.value.scaling-t.value.panning.y;return{x1:-t.value.panning.x,y1:-t.value.panning.y,x2:k,y2:x}},E=T=>{T.button===0&&(o=!0,b(T))},b=T=>{if(o){const[O,k]=h(T.offsetX,T.offsetY),x=m(),I=(x.x2-x.x1)/2,F=(x.y2-x.y1)/2;t.value.panning.x=-(O-I),t.value.panning.y=-(k-F)}},g=()=>{o=!1},y=()=>{s.value=!0},v=()=>{s.value=!1,g()};qn([s,t.value.panning,()=>t.value.scaling,()=>t.value.connections.length],()=>{u()});const S=st(()=>t.value.nodes.map(T=>T.position)),C=st(()=>t.value.nodes.map(T=>T.width));return qn([S,C],()=>{u()},{deep:!0}),Ws(()=>{r=i.value.getContext("2d"),r.imageSmoothingQuality="high",u(),l=setInterval(u,500)}),Va(()=>{clearInterval(l)}),(T,O)=>(w(),A("canvas",{ref_key:"canvas",ref:i,class:"baklava-minimap",onMouseenter:y,onMouseleave:v,onMousedown:ge(E,["self"]),onMousemove:ge(b,["self"]),onMouseup:g},null,544))}}),qkt=_n({components:{ContextMenu:_y,VerticalDots:WI},props:{type:{type:String,required:!0},title:{type:String,required:!0}},setup(n){const{viewModel:e}=Oi(),{switchGraph:t}=Ki(),i=ft(!1),s=st(()=>n.type.startsWith(lc));return{showContextMenu:i,hasContextMenu:s,contextMenuItems:[{label:"Edit Subgraph",value:"editSubgraph"},{label:"Delete Subgraph",value:"deleteSubgraph"}],openContextMenu:()=>{i.value=!0},onContextMenuClick:l=>{const u=n.type.substring(lc.length),d=e.value.editor.graphTemplates.find(h=>h.id===u);if(d)switch(l){case"editSubgraph":t(d);break;case"deleteSubgraph":e.value.editor.removeGraphTemplate(d);break}}}}}),Ykt=["data-node-type"],$kt={class:"__title"},Wkt={class:"__title-label"},Kkt={key:0,class:"__menu"};function jkt(n,e,t,i,s,r){const o=mt("vertical-dots"),a=mt("context-menu");return w(),A("div",{class:"baklava-node --palette","data-node-type":n.type},[c("div",$kt,[c("div",Wkt,he(n.title),1),n.hasContextMenu?(w(),A("div",Kkt,[Te(o,{class:"--clickable",onPointerdown:e[0]||(e[0]=ge(()=>{},["stop","prevent"])),onClick:ge(n.openContextMenu,["stop","prevent"])},null,8,["onClick"]),Te(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]=ge(()=>{},["stop","prevent"]))},null,8,["modelValue","items","onClick"])])):V("",!0)])],8,Ykt)}const Bw=hn(qkt,[["render",jkt]]),Qkt={class:"baklava-node-palette"},Xkt={key:0},Zkt=_n({__name:"NodePalette",setup(n){const{viewModel:e}=Oi(),{x:t,y:i}=rkt(),{transform:s}=zI(),r=VI(e),o=Gi("editorEl"),a=ft(null),l=st(()=>{if(!a.value||!(o!=null&&o.value))return{};const{left:d,top:h}=o.value.getBoundingClientRect();return{top:`${i.value-h}px`,left:`${t.value-d}px`}}),u=(d,h)=>{a.value={type:d,nodeInformation:h};const f=()=>{const _=ei(new h.type);e.value.displayedGraph.addNode(_);const m=o.value.getBoundingClientRect(),[E,b]=s(t.value-m.left,i.value-m.top);_.position.x=E,_.position.y=b,a.value=null,document.removeEventListener("pointerup",f)};document.addEventListener("pointerup",f)};return(d,h)=>(w(),A($e,null,[c("div",Qkt,[(w(!0),A($e,null,lt(yt(r),f=>(w(),A("section",{key:f.name},[f.name!=="default"?(w(),A("h1",Xkt,he(f.name),1)):V("",!0),(w(!0),A($e,null,lt(f.nodeTypes,(_,m)=>(w(),xt(Bw,{key:m,type:m,title:_.title,onPointerdown:E=>u(m,_)},null,8,["type","title","onPointerdown"]))),128))]))),128))]),Te(Vi,{name:"fade"},{default:We(()=>[a.value?(w(),A("div",{key:0,class:"baklava-dragged-node",style:en(l.value)},[Te(Bw,{type:a.value.type,title:a.value.nodeInformation.title},null,8,["type","title"])],4)):V("",!0)]),_:1})],64))}});let Cd;const Jkt=new Uint8Array(16);function eLt(){if(!Cd&&(Cd=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Cd))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Cd(Jkt)}const wn=[];for(let n=0;n<256;++n)wn.push((n+256).toString(16).slice(1));function tLt(n,e=0){return wn[n[e+0]]+wn[n[e+1]]+wn[n[e+2]]+wn[n[e+3]]+"-"+wn[n[e+4]]+wn[n[e+5]]+"-"+wn[n[e+6]]+wn[n[e+7]]+"-"+wn[n[e+8]]+wn[n[e+9]]+"-"+wn[n[e+10]]+wn[n[e+11]]+wn[n[e+12]]+wn[n[e+13]]+wn[n[e+14]]+wn[n[e+15]]}const nLt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Gw={randomUUID:nLt};function vu(n,e,t){if(Gw.randomUUID&&!e&&!n)return Gw.randomUUID();n=n||{};const i=n.random||(n.rng||eLt)();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 tLt(i)}const cc="SAVE_SUBGRAPH";function iLt(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(cc,{canExecute:()=>{var i;return n.value!==((i=n.value.editor)==null?void 0:i.graph)},execute:t})}const sLt={},rLt={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"},oLt=c("polyline",{points:"6 9 12 15 18 9"},null,-1),aLt=[oLt];function lLt(n,e){return w(),A("svg",rLt,aLt)}const cLt=hn(sLt,[["render",lLt]]),dLt=_n({components:{"i-arrow":cLt},props:{intf:{type:Object,required:!0}},setup(n){const e=ft(null),t=ft(!1),i=st(()=>n.intf.items.find(o=>typeof o=="string"?o===n.intf.value:o.value===n.intf.value)),s=st(()=>i.value?typeof i.value=="string"?i.value:i.value.text:""),r=o=>{n.intf.value=typeof o=="string"?o:o.value};return YI(e,()=>{t.value=!1}),{el:e,open:t,selectedItem:i,selectedText:s,setSelected:r}}}),uLt=["title"],pLt={class:"__selected"},_Lt={class:"__text"},hLt={class:"__icon"},fLt={class:"__dropdown"},mLt={class:"item --header"},gLt=["onClick"];function bLt(n,e,t,i,s,r){const o=mt("i-arrow");return w(),A("div",{ref:"el",class:ze(["baklava-select",{"--open":n.open}]),title:n.intf.name,onClick:e[0]||(e[0]=a=>n.open=!n.open)},[c("div",pLt,[c("div",_Lt,he(n.selectedText),1),c("div",hLt,[Te(o)])]),Te(Vi,{name:"slide-fade"},{default:We(()=>[G(c("div",fLt,[c("div",mLt,he(n.intf.name),1),(w(!0),A($e,null,lt(n.intf.items,(a,l)=>(w(),A("div",{key:l,class:ze(["item",{"--active":a===n.selectedItem}]),onClick:u=>n.setSelected(a)},he(typeof a=="string"?a:a.text),11,gLt))),128))],512),[[Mt,n.open]])]),_:1})],10,uLt)}const ELt=hn(dLt,[["render",bLt]]);class yLt extends nn{constructor(e,t,i){super(e,t),this.component=dc(ELt),this.items=i}}const vLt=_n({props:{intf:{type:Object,required:!0}}});function SLt(n,e,t,i,s,r){return w(),A("div",null,he(n.intf.value),1)}const TLt=hn(vLt,[["render",SLt]]);class xLt extends nn{constructor(e,t){super(e,t),this.component=dc(TLt),this.setPort(!1)}}const CLt=_n({props:{intf:{type:Object,required:!0},modelValue:{type:String,required:!0}},emits:["update:modelValue"],setup(n,{emit:e}){return{v:st({get:()=>n.modelValue,set:i=>{e("update:modelValue",i)}})}}}),wLt=["placeholder","title"];function RLt(n,e,t,i,s,r){return w(),A("div",null,[G(c("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,wLt),[[we,n.v]])])}const ALt=hn(CLt,[["render",RLt]]);class Tc extends nn{constructor(){super(...arguments),this.component=dc(ALt)}}class jI extends LI{constructor(){super(...arguments),this._title="Subgraph Input",this.inputs={name:new Tc("Name","Input").setPort(!1)},this.outputs={placeholder:new nn("Connection",void 0)}}}class QI extends PI{constructor(){super(...arguments),this._title="Subgraph Output",this.inputs={name:new Tc("Name","Output").setPort(!1),placeholder:new nn("Connection",void 0)},this.outputs={output:new nn("Output",void 0).setHidden(!0)}}}const XI="CREATE_SUBGRAPH",Vw=[Da,ka];function NLt(n,e,t){const i=()=>n.value.selectedNodes.filter(r=>!Vw.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(x=>!Vw.includes(x.type)),u=l.flatMap(x=>Object.values(x.inputs)),d=l.flatMap(x=>Object.values(x.outputs)),h=o.connections.filter(x=>!d.includes(x.from)&&u.includes(x.to)),f=o.connections.filter(x=>d.includes(x.from)&&!u.includes(x.to)),_=o.connections.filter(x=>d.includes(x.from)&&u.includes(x.to)),m=l.map(x=>x.save()),E=_.map(x=>({id:x.id,from:x.from.id,to:x.to.id})),b=new Map,{xLeft:g,xRight:y,yTop:v}=OLt(l);console.log(g,y,v);for(const[x,I]of h.entries()){const F=new jI;F.inputs.name.value=I.to.name,m.push({...F.save(),position:{x:y-r.value.settings.nodes.defaultWidth-100,y:v+x*200}}),E.push({id:vu(),from:F.outputs.placeholder.id,to:I.to.id}),b.set(I.to.id,F.graphInterfaceId)}for(const[x,I]of f.entries()){const F=new QI;F.inputs.name.value=I.from.name,m.push({...F.save(),position:{x:g+100,y:v+x*200}}),E.push({id:vu(),from:I.from.id,to:F.inputs.placeholder.id}),b.set(I.from.id,F.graphInterfaceId)}const S=ei(new fp({connections:E,nodes:m,inputs:[],outputs:[]},a));a.addGraphTemplate(S);const C=a.nodeTypes.get(La(S));if(!C)throw new Error("Unable to create subgraph: Could not find corresponding graph node type");const T=ei(new C.type);o.addNode(T);const O=Math.round(l.map(x=>x.position.x).reduce((x,I)=>x+I,0)/l.length),k=Math.round(l.map(x=>x.position.y).reduce((x,I)=>x+I,0)/l.length);T.position.x=O,T.position.y=k,h.forEach(x=>{o.removeConnection(x),o.addConnection(x.from,T.inputs[b.get(x.to.id)])}),f.forEach(x=>{o.removeConnection(x),o.addConnection(T.outputs[b.get(x.from.id)],x.to)}),l.forEach(x=>o.removeNode(x)),e.canExecuteCommand(cc)&&e.executeCommand(cc),t(S),n.value.panning={...o.panning},n.value.scaling=o.scaling};e.registerCommand(XI,{canExecute:i,execute:s})}function OLt(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 zw="DELETE_NODES";function ILt(n,e){e.registerCommand(zw,{canExecute:()=>n.value.selectedNodes.length>0,execute(){n.value.selectedNodes.forEach(t=>n.value.removeNode(t))}}),e.registerHotkey(["Delete"],zw)}const ZI="SWITCH_TO_MAIN_GRAPH";function MLt(n,e,t){e.registerCommand(ZI,{canExecute:()=>n.value!==n.value.editor.graph,execute:()=>{e.executeCommand(cc),t(n.value.editor.graph)}})}function DLt(n,e,t){ILt(n,e),NLt(n,e,t),iLt(n,e),MLt(n,e,t)}class Hw{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 qw{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 kLt{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()},d=()=>{a.value=!0},h=()=>{a.value=!1,l.value.length>0&&(u(new kLt(l.value)),l.value=[])},f=()=>s.value.length!==0&&o.value!==-1,_=()=>{f()&&(r.value=!0,s.value[o.value--].undo(n.value),r.value=!1)},m=()=>s.value.length!==0&&o.value{m()&&(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,y=>{u(new Hw("addNode",y.id))}),b.events.removeNode.subscribe(t,y=>{u(new Hw("removeNode",y.save()))}),b.events.addConnection.subscribe(t,y=>{u(new qw("addConnection",y.id))}),b.events.removeConnection.subscribe(t,y=>{u(new qw("removeConnection",y))}))},{immediate:!0}),e.registerCommand(vb,{canExecute:f,execute:_}),e.registerCommand(Sb,{canExecute:m,execute:E}),e.registerCommand(JI,{canExecute:()=>!a.value,execute:d}),e.registerCommand(eM,{canExecute:()=>a.value,execute:h}),e.registerHotkey(["Control","z"],vb),e.registerHotkey(["Control","y"],Sb),ei({maxSteps:i})}const Tb="COPY",xb="PASTE",PLt="CLEAR_CLIPBOARD";function ULt(n,e,t){const i=Symbol("ClipboardToken"),s=ft(""),r=ft(""),o=st(()=>!s.value),a=()=>{s.value="",r.value=""},l=()=>{const h=n.value.selectedNodes.flatMap(_=>[...Object.values(_.inputs),...Object.values(_.outputs)]),f=n.value.connections.filter(_=>h.includes(_.from)||h.includes(_.to)).map(_=>({from:_.from.id,to:_.to.id}));r.value=JSON.stringify(f),s.value=JSON.stringify(n.value.selectedNodes.map(_=>_.save()))},u=(h,f,_)=>{for(const m of h){let E;if((!_||_==="input")&&(E=Object.values(m.inputs).find(b=>b.id===f)),!E&&(!_||_==="output")&&(E=Object.values(m.outputs).find(b=>b.id===f)),E)return E}},d=()=>{if(o.value)return;const h=new Map,f=JSON.parse(s.value),_=JSON.parse(r.value),m=[],E=[],b=n.value;t.executeCommand(JI);for(const g of f){const y=e.value.nodeTypes.get(g.type);if(!y){console.warn(`Node type ${g.type} not registered`);return}const v=new y.type,S=v.id;m.push(v),v.hooks.beforeLoad.subscribe(i,C=>{const T=C;return T.position&&(T.position.x+=100,T.position.y+=100),v.hooks.beforeLoad.unsubscribe(i),T}),b.addNode(v),v.load({...g,id:S}),v.id=S,h.set(g.id,S);for(const C of Object.values(v.inputs)){const T=vu();h.set(C.id,T),C.id=T}for(const C of Object.values(v.outputs)){const T=vu();h.set(C.id,T),C.id=T}}for(const g of _){const y=u(m,h.get(g.from),"output"),v=u(m,h.get(g.to),"input");if(!y||!v)continue;const S=b.addConnection(y,v);S&&E.push(S)}return n.value.selectedNodes=m,t.executeCommand(eM),{newNodes:m,newConnections:E}};return t.registerCommand(Tb,{canExecute:()=>n.value.selectedNodes.length>0,execute:l}),t.registerHotkey(["Control","c"],Tb),t.registerCommand(xb,{canExecute:()=>!o.value,execute:d}),t.registerHotkey(["Control","v"],xb),t.registerCommand(PLt,{canExecute:()=>!0,execute:a}),ei({isEmpty:o})}const FLt="OPEN_SIDEBAR";function BLt(n,e){e.registerCommand(FLt,{execute:t=>{n.value.sidebar.nodeId=t,n.value.sidebar.visible=!0},canExecute:()=>!0})}function GLt(n,e){BLt(n,e)}const VLt={},zLt={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"},HLt=c("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),qLt=c("path",{d:"M9 13l-4 -4l4 -4m-4 4h11a4 4 0 0 1 0 8h-1"},null,-1),YLt=[HLt,qLt];function $Lt(n,e){return w(),A("svg",zLt,YLt)}const WLt=hn(VLt,[["render",$Lt]]),KLt={},jLt={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"},QLt=c("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),XLt=c("path",{d:"M15 13l4 -4l-4 -4m4 4h-11a4 4 0 0 0 0 8h1"},null,-1),ZLt=[QLt,XLt];function JLt(n,e){return w(),A("svg",jLt,ZLt)}const ePt=hn(KLt,[["render",JLt]]),tPt={},nPt={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"},iPt=c("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),sPt=c("line",{x1:"5",y1:"12",x2:"19",y2:"12"},null,-1),rPt=c("line",{x1:"5",y1:"12",x2:"11",y2:"18"},null,-1),oPt=c("line",{x1:"5",y1:"12",x2:"11",y2:"6"},null,-1),aPt=[iPt,sPt,rPt,oPt];function lPt(n,e){return w(),A("svg",nPt,aPt)}const cPt=hn(tPt,[["render",lPt]]),dPt={},uPt={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"},pPt=c("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),_Pt=c("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),hPt=c("rect",{x:"9",y:"3",width:"6",height:"4",rx:"2"},null,-1),fPt=[pPt,_Pt,hPt];function mPt(n,e){return w(),A("svg",uPt,fPt)}const gPt=hn(dPt,[["render",mPt]]),bPt={},EPt={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"},yPt=c("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vPt=c("rect",{x:"8",y:"8",width:"12",height:"12",rx:"2"},null,-1),SPt=c("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),TPt=[yPt,vPt,SPt];function xPt(n,e){return w(),A("svg",EPt,TPt)}const CPt=hn(bPt,[["render",xPt]]),wPt={},RPt={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"},APt=c("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),NPt=c("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),OPt=c("circle",{cx:"12",cy:"14",r:"2"},null,-1),IPt=c("polyline",{points:"14 4 14 8 8 8 8 4"},null,-1),MPt=[APt,NPt,OPt,IPt];function DPt(n,e){return w(),A("svg",RPt,MPt)}const kPt=hn(wPt,[["render",DPt]]),LPt={},PPt={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"},UPt=Fu('',6),FPt=[UPt];function BPt(n,e){return w(),A("svg",PPt,FPt)}const GPt=hn(LPt,[["render",BPt]]),VPt=_n({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}}}),zPt=["disabled","title"];function HPt(n,e,t,i,s,r){return w(),A("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(Lu(n.icon),{key:0})):(w(),A($e,{key:1},[et(he(n.title),1)],64))],8,zPt)}const qPt=hn(VPt,[["render",HPt]]),YPt=_n({components:{ToolbarButton:qPt},setup(){const{viewModel:n}=Oi();return{isSubgraph:st(()=>n.value.displayedGraph!==n.value.editor.graph),commands:[{command:Tb,title:"Copy",icon:CPt},{command:xb,title:"Paste",icon:gPt},{command:vb,title:"Undo",icon:WLt},{command:Sb,title:"Redo",icon:ePt},{command:XI,title:"Create Subgraph",icon:GPt}],subgraphCommands:[{command:cc,title:"Save Subgraph",icon:kPt},{command:ZI,title:"Back to Main Graph",icon:cPt}]}}}),$Pt={class:"baklava-toolbar"};function WPt(n,e,t,i,s,r){const o=mt("toolbar-button");return w(),A("div",$Pt,[(w(!0),A($e,null,lt(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),A($e,{key:0},lt(n.subgraphCommands,a=>(w(),xt(o,{key:a.command,command:a.command,title:a.title,icon:a.icon},null,8,["command","title","icon"]))),128)):V("",!0)])}const KPt=hn(YPt,[["render",WPt]]),jPt={class:"connections-container"},QPt=_n({__name:"Editor",props:{viewModel:{}},setup(n){const e=n,t=Symbol("EditorToken"),i=$d(e,"viewModel");qDt(i);const s=ft(null);sa("editorEl",s);const r=st(()=>e.viewModel.displayedGraph.nodes),o=st(()=>e.viewModel.displayedGraph.nodes.map(O=>BI($d(O,"position")))),a=st(()=>e.viewModel.displayedGraph.connections),l=st(()=>e.viewModel.displayedGraph.selectedNodes),u=YDt(),d=$Dt(),h=WDt(i),f=st(()=>({...u.styles.value})),_=ft(0);e.viewModel.editor.hooks.load.subscribe(t,O=>(_.value++,O));const m=O=>{u.onPointerMove(O),d.onMouseMove(O)},E=O=>{O.button===0&&(O.target===s.value&&(S(),u.onPointerDown(O)),d.onMouseDown())},b=O=>{u.onPointerUp(O),d.onMouseUp()},g=O=>{O.key==="Tab"&&O.preventDefault(),e.viewModel.commandHandler.handleKeyDown(O)},y=O=>{e.viewModel.commandHandler.handleKeyUp(O)},v=O=>{["Control","Shift"].some(k=>e.viewModel.commandHandler.pressedKeys.includes(k))||S(),e.viewModel.displayedGraph.selectedNodes.push(O)},S=()=>{e.viewModel.displayedGraph.selectedNodes=[]},C=O=>{for(const k of e.viewModel.displayedGraph.selectedNodes){const x=r.value.indexOf(k),I=o.value[x];I.onPointerDown(O),document.addEventListener("pointermove",I.onPointerMove)}document.addEventListener("pointerup",T)},T=()=>{for(const O of e.viewModel.displayedGraph.selectedNodes){const k=r.value.indexOf(O),x=o.value[k];x.onPointerUp(),document.removeEventListener("pointermove",x.onPointerMove)}document.removeEventListener("pointerup",T)};return(O,k)=>(w(),A("div",{ref_key:"el",ref:s,tabindex:"-1",class:ze(["baklava-editor",{"baklava-ignore-mouse":!!yt(d).temporaryConnection.value||yt(u).dragging.value,"--temporary-connection":!!yt(d).temporaryConnection.value}]),onPointermove:ge(m,["self"]),onPointerdown:E,onPointerup:b,onWheel:k[1]||(k[1]=ge((...x)=>yt(u).onMouseWheel&&yt(u).onMouseWheel(...x),["self"])),onKeydown:g,onKeyup:y,onContextmenu:k[2]||(k[2]=ge((...x)=>yt(h).open&&yt(h).open(...x),["self","prevent"]))},[kn(O.$slots,"background",{},()=>[Te(QDt)]),kn(O.$slots,"toolbar",{},()=>[Te(KPt)]),kn(O.$slots,"palette",{},()=>[Te(Zkt)]),(w(),A("svg",jPt,[(w(!0),A($e,null,lt(a.value,x=>(w(),A("g",{key:x.id+_.value.toString()},[kn(O.$slots,"connection",{connection:x},()=>[Te(kkt,{connection:x},null,8,["connection"])])]))),128)),kn(O.$slots,"temporaryConnection",{temporaryConnection:yt(d).temporaryConnection.value},()=>[yt(d).temporaryConnection.value?(w(),xt(Ukt,{key:0,connection:yt(d).temporaryConnection.value},null,8,["connection"])):V("",!0)])])),c("div",{class:"node-container",style:en(f.value)},[Te(as,{name:"fade"},{default:We(()=>[(w(!0),A($e,null,lt(r.value,(x,I)=>kn(O.$slots,"node",{key:x.id+_.value.toString(),node:x,selected:l.value.includes(x),dragging:o.value[I].dragging.value,onSelect:F=>v(x),onStartDrag:C},()=>[Te(Rkt,{node:x,selected:l.value.includes(x),dragging:o.value[I].dragging.value,onSelect:F=>v(x),onStartDrag:C},null,8,["node","selected","dragging","onSelect"])])),128))]),_:3})],4),kn(O.$slots,"sidebar",{},()=>[Te(zkt)]),kn(O.$slots,"minimap",{},()=>[O.viewModel.settings.enableMinimap?(w(),xt(Hkt,{key:0})):V("",!0)]),kn(O.$slots,"contextMenu",{contextMenu:yt(h)},()=>[O.viewModel.settings.contextMenu.enabled?(w(),xt(_y,{key:0,modelValue:yt(h).show.value,"onUpdate:modelValue":k[0]||(k[0]=x=>yt(h).show.value=x),items:yt(h).items.value,x:yt(h).x.value,y:yt(h).y.value,onClick:yt(h).onClick},null,8,["modelValue","items","x","y","onClick"])):V("",!0)])],34))}}),XPt=["INPUT","TEXTAREA","SELECT"];function ZPt(n){const e=ft([]),t=ft([]);return{pressedKeys:e,handleKeyDown:o=>{var a;e.value.includes(o.key)||e.value.push(o.key),!XPt.includes(((a=document.activeElement)==null?void 0:a.tagName)??"")&&t.value.forEach(l=>{l.keys.every(u=>e.value.includes(u))&&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 JPt=()=>{const n=ft(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=ZPt(t);return ei({registerCommand:e,executeCommand:t,canExecuteCommand:i,...s})},eUt=n=>!(n instanceof Sc);function tUt(n,e){return{switchGraph:i=>{let s;if(eUt(i))s=new Sc(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 nUt(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 iUt=()=>({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 sUt(n){const e=ft(n??new FDt),t=Symbol("ViewModelToken"),i=ft(null),s=s2(i),{switchGraph:r}=tUt(e,i),o=st(()=>s.value&&s.value!==e.value.graph),a=ei(iUt()),l=JPt(),u=LLt(s,l),d=ULt(s,e,l),h={renderNode:new li(null),renderInterface:new li(null)};return DLt(s,l,r),GLt(s,l),qn(e,(f,_)=>{_&&(_.events.registerGraph.unsubscribe(t),_.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,(m,E)=>(E.position=m.position??{x:0,y:0},E.width=m.width??a.nodes.defaultWidth,E.twoColumn=m.twoColumn??!1,m)),f.nodeHooks.afterSave.subscribe(t,(m,E)=>(m.position=E.position,m.width=E.width,m.twoColumn=E.twoColumn,m)),f.graphTemplateHooks.beforeLoad.subscribe(t,(m,E)=>(E.panning=m.panning,E.scaling=m.scaling,m)),f.graphTemplateHooks.afterSave.subscribe(t,(m,E)=>(m.panning=E.panning,m.scaling=E.scaling,m)),f.graph.hooks.load.subscribe(t,(m,E)=>(E.panning=m.panning,E.scaling=m.scaling,m)),f.graph.hooks.save.subscribe(t,(m,E)=>(m.panning=E.panning,m.scaling=E.scaling,m)),f.graphEvents.beforeAddNode.subscribe(t,m=>nUt(m,{defaultWidth:a.nodes.defaultWidth})),e.value.registerNodeType(jI,{category:"Subgraphs"}),e.value.registerNodeType(QI,{category:"Subgraphs"}),r(f.graph))},{immediate:!0}),ei({editor:e,displayedGraph:s,isSubgraph:o,settings:a,commandHandler:l,history:u,clipboard:d,hooks:h,switchGraph:r})}const rUt=Ja({type:"PersonalityNode",title:"Personality",inputs:{request:()=>new nn("Request",""),agent_name:()=>new yLt("Personality","",Su.state.config.personalities).setPort(!1)},outputs:{response:()=>new nn("Response","")},async calculate({request:n}){console.log(Su.state.config.personalities);let e="";try{e=(await Se.post("/generate",{params:{text:n}})).data}catch(t){console.error(t)}return{display:e,response:e}}}),oUt=Ja({type:"RAGNode",title:"RAG",inputs:{request:()=>new nn("Prompt",""),document_path:()=>new Tc("Document path","").setPort(!1)},outputs:{prompt:()=>new nn("Prompt with Data","")},async calculate({request:n,document_path:e}){let t="";try{t=(await Se.get("/rag",{params:{text:n,doc_path:e}})).data}catch(i){console.error(i)}return{response:t}}}),Yw=Ja({type:"Task",title:"Task",inputs:{description:()=>new Tc("Task description","").setPort(!1)},outputs:{prompt:()=>new nn("Prompt")},calculate({description:n}){return{prompt:n}}}),$w=Ja({type:"TextDisplayNode",title:"TextDisplay",inputs:{text2display:()=>new nn("Input","")},outputs:{response:()=>new xLt("Text","")},async calculate({request:n}){}}),Ww=Ja({type:"LLMNode",title:"LLM",inputs:{request:()=>new nn("Request","")},outputs:{response:()=>new nn("Response","")},async calculate({request:n}){console.log(Su.state.config.personalities);let e="";try{e=(await Se.post("/generate",{params:{text:n}})).data}catch(t){console.error(t)}return{display:e,response:e}}}),aUt=Ja({type:"MultichoiceNode",title:"Multichoice",inputs:{question:()=>new nn("Question",""),outputs:()=>new Tc("choices, one per line","","").setPort(!1)},outputs:{response:()=>new nn("Response","")}}),lUt=_n({components:{"baklava-editor":QPt},setup(){const n=sUt(),e=new HDt(n.editor);n.editor.registerNodeType(rUt),n.editor.registerNodeType(Yw),n.editor.registerNodeType(oUt),n.editor.registerNodeType($w),n.editor.registerNodeType(Ww),n.editor.registerNodeType(aUt);const t=Symbol();e.events.afterRun.subscribe(t,a=>{e.pause(),BDt(a,n.editor),e.resume()}),e.start();function i(a,l,u){const d=new a;return n.displayedGraph.addNode(d),d.position.x=l,d.position.y=u,d}const s=i(Yw,300,140),r=i(Ww,550,140),o=i($w,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)}}}}),cUt={style:{width:"100vw",height:"100vh"}};function dUt(n,e,t,i,s,r){const o=mt("baklava-editor");return w(),A("div",cUt,[Te(o,{"view-model":n.baklava},null,8,["view-model"]),c("button",{onClick:e[0]||(e[0]=(...a)=>n.saveGraph&&n.saveGraph(...a))},"Save Graph"),c("button",{onClick:e[1]||(e[1]=(...a)=>n.loadGraph&&n.loadGraph(...a))},"Load Graph")])}const uUt=bt(lUt,[["render",dUt]]),pUt={},_Ut={style:{width:"100vw",height:"100vh"}},hUt=["src"];function fUt(n,e,t,i,s,r){return w(),A("div",_Ut,[c("iframe",{src:n.$store.state.config.comfyui_base_url,class:"m-0 p-0 w-full h-full"},null,8,hUt)])}const mUt=bt(pUt,[["render",fUt]]),gUt={},bUt={style:{width:"100vw",height:"100vh"}},EUt=["src"];function yUt(n,e,t,i,s,r){return w(),A("div",bUt,[c("iframe",{src:n.$store.state.config.sd_base_url,class:"m-0 p-0 w-full h-full"},null,8,EUt)])}const vUt=bt(gUt,[["render",yUt]]),SUt=HP({history:aP("/"),routes:[{path:"/auto_sd_view/",name:"AutoSD",component:vUt},{path:"/autosd_view/",name:"ComfyUI",component:mUt},{path:"/playground/",name:"playground",component:wtt},{path:"/extensions/",name:"extensions",component:Utt},{path:"/help_view/",name:"help_view",component:Htt},{path:"/settings/",name:"settings",component:kbt},{path:"/training/",name:"training",component:tEt},{path:"/quantizing/",name:"quantizing",component:dEt},{path:"/",name:"discussions",component:mwt},{path:"/",name:"interactive",component:IDt},{path:"/",name:"nodes",component:uUt}]});const mp=jD(RZe);console.log("Loaded main.js");function TUt(n){const e={};for(const t in n)n.hasOwnProperty(t)&&(e[t]=n[t]);return e}const Su=vk({state(){return{is_rt_on:!1,language:"english",languages:[],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},posts_headers:{accept:"application/json","Content-Type":"application/json"},client_id:"",yesNoDialog:null,universalForm:null,toast:null,news:null,messageBox:null,api_get_req:null,api_post_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:[],bindingsZoo:[],modelsArr:[],selectedModel:null,personalities:[],diskUsage:null,ramUsage:null,vramUsage:null,modelsZoo:[],installedModels:[],installedBindings:[],currentModel:null,currentBinding:null,databases:[]}},mutations:{setisRTOn(n,e){n.is_rt_on=e},setLanguages(n,e){n.languages=e},setLanguage(n,e){n.language=e},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},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},setDatabases(n,e){n.databases=e},setTheme(n){this.currentTheme=n}},getters:{getisRTOn(n){return n.is_rt_on},getLanguages(n){return n.languages},getLanguage(n){return n.language},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},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}},actions:{async getVersion(){try{let n=await Se.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{console.log("Fetching configuration with client id: ",this.state.client_id);const e=await tM("get_config",this.state.client_id);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],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 Qi("list_databases");console.log("databases:",e),n("setDatabases",e)},async fetchisRTOn({commit:n}){const t=(await Se.get("/is_rt_on")).data.status;n("setisRTOn",t)},async fetchLanguages({commit:n}){console.log("get_personality_languages_list",this.state.client_id);const e=await Se.post("/get_personality_languages_list",{client_id:this.state.client_id});console.log("response",e);const t=e.data;console.log("languages",t),n("setLanguages",t)},async fetchLanguage({commit:n}){console.log("get_personality_language",this.state.client_id);const e=await Se.post("/get_personality_language",{client_id:this.state.client_id});console.log("response",e);const t=e.data;console.log("language",t),n("setLanguage",t)},async changeLanguage({commit:n},e){console.log("Changing language to ",e);let t=await Se.post("/set_personality_language",{client_id:this.state.client_id,language:e});console.log("get_personality_languages_list",this.state.client_id),t=await Se.post("/get_personality_languages_list",{client_id:this.state.client_id}),console.log("response",t);const i=t.data;console.log("languages",i),n("setLanguages",i),t=await Se.post("/get_personality_language",{client_id:this.state.client_id}),console.log("response",t);const s=t.data;console.log("language",s),n("setLanguage",s),console.log("Language changed successfully:",t.data.message)},async deleteLanguage({commit:n},e){console.log("Deleting ",e);let t=await Se.post("/del_personality_language",{client_id:this.state.client_id,language:e});console.log("get_personality_languages_list",this.state.client_id),t=await Se.post("/get_personality_languages_list",{client_id:this.state.client_id}),console.log("response",t);const i=t.data;console.log("languages",i),n("setLanguages",i),t=await Se.post("/get_personality_language",{client_id:this.state.client_id}),console.log("response",t);const s=t.data;console.log("language",s),n("setLanguage",s),console.log("Language changed successfully:",t.data.message)},async refreshPersonalitiesZoo({commit:n}){let e=[];const t=await Qi("get_all_personalities"),i=Object.keys(t);console.log("Personalities recovered:"+this.state.config.personalities);for(let s=0;s{let u=!1;for(const h of this.state.config.personalities)if(h.includes(r+"/"+l.folder))if(u=!0,h.includes(":")){const f=h.split(":");l.language=f[1]}else l.language=null;let d={};return d=l,d.category=r,d.full_path=r+"/"+l.folder,d.isMounted=u,d});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=TUt(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 Qi("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 Se.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 Qi("get_model_status");n("setIsModelOk",e.status)},async refreshModels({commit:n}){console.log("Fetching models");let e=await Qi("list_models");console.log(`Found ${e}`);let t=await Qi("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 refreshDiskUsage({commit:n}){this.state.diskUsage=await Qi("disk_usage")},async refreshRamUsage({commit:n}){this.state.ramUsage=await Qi("ram_usage")},async refreshVramUsage({commit:n}){const e=await Qi("vram_usage"),t=[];if(e.nb_gpus>0){for(let s=0;s LoLLMS WebUI - + diff --git a/web/src/views/PlayGroundView.vue b/web/src/views/PlayGroundView.vue index ecb4828c..40be1eb7 100644 --- a/web/src/views/PlayGroundView.vue +++ b/web/src/views/PlayGroundView.vue @@ -699,7 +699,7 @@ export default { axios.post("./text2Wave",{text:text}).then(response => { console.log(response.data.url) let url = response.data.url - this.audio_url = bUrl+url + this.audio_url = url this.isSynthesizingVoice=false nextTick(() => { feather.replace()