Error displaying help content.
",this.showHelpPopup=!0,this.updateFeatherIcons()}}},closeHelp(){this.showHelpPopup=!1,this.updateFeatherIcons()}},mounted(){this.selectedLanguage=this.personality.language||"",this.updateFeatherIcons()}},qTr=["title"],UTr={key:0,class:"absolute inset-0 bg-blue-400 dark:bg-blue-700 bg-opacity-50 dark:bg-opacity-50 flex items-center justify-center rounded-lg z-20"},BTr=["title"],zTr={key:0,"data-feather":"star",class:"w-5 h-5 fill-current"},XTr={key:1,"data-feather":"star",class:"w-5 h-5 stroke-current"},FTr={class:"flex-grow flex flex-col"},jTr={class:"flex items-start mb-3"},YTr=["src"],GTr={class:"flex-grow overflow-hidden min-w-0"},WTr=["title"],ZTr=["title"],KTr=["title"],JTr=["title"],eOr={class:"text-xs text-blue-400 dark:text-blue-500 mb-3 space-y-1"},tOr={key:0},nOr={key:1},rOr={class:"mb-4 flex-grow"},iOr=["innerHTML"],sOr={key:0,class:"mb-3 mt-auto"},oOr=["for"],aOr=["id"],lOr=["value"],cOr={class:"mt-auto pt-3 border-t border-blue-200 dark:border-blue-700"},uOr={class:"flex justify-between items-center"},dOr={class:"flex space-x-1"},fOr={class:"card w-full max-w-2xl max-h-[80vh] flex flex-col"},hOr={class:"flex justify-between items-center mb-4 border-b pb-2 border-blue-200 dark:border-blue-600"},pOr={class:"text-xl font-bold text-blue-800 dark:text-blue-100"},TOr={class:"flex-grow overflow-y-auto scrollbar prose-blue max-w-none pr-2"},OOr=["innerHTML"],mOr={class:"mt-4 pt-4 border-t border-blue-200 dark:border-blue-600 text-right"};function gOr(t,e,n,r,i,s){const o=Xe("InteractiveMenu");return k(),D("div",{class:be(["app-card relative flex flex-col",{"border-2 border-blue-500 dark:border-blue-400 shadow-lg":n.isActive,"border-blue-200 dark:border-blue-700":!n.isActive,"opacity-50 pointer-events-none":n.isProcessing}]),title:n.personality.tool_description||n.personality.description||n.personality.name,onClick:e[12]||(e[12]=(...a)=>s.handleSelect&&s.handleSelect(...a))},[n.isProcessing?(k(),D("div",UTr,e[13]||(e[13]=[b("svg",{"aria-hidden":"true",class:"w-8 h-8 text-blue-200 animate-spin dark:text-blue-600 fill-blue-600 dark:fill-blue-300",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[b("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"}),Se(),b("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)]))):ne("",!0),b("button",{onClick:e[0]||(e[0]=oe((...a)=>s.toggleStar&&s.toggleStar(...a),["stop"])),class:"absolute top-2 right-2 svg-button text-yellow-400 hover:text-yellow-500 dark:text-yellow-500 dark:hover:text-yellow-400 z-10",title:n.isStarred?"Unstar":"Star"},[n.isStarred?(k(),D("i",zTr)):(k(),D("i",XTr))],8,BTr),b("div",FTr,[b("div",jTr,[b("img",{src:s.getPersonalityIconUrl(n.personality.avatar),onError:e[1]||(e[1]=(...a)=>s.handleImgError&&s.handleImgError(...a)),alt:"Personality Icon",class:"w-16 h-16 rounded-lg object-cover mr-4 flex-shrink-0 border border-blue-200 dark:border-blue-600 shadow-sm"},null,40,YTr),b("div",GTr,[b("h3",{class:"font-bold text-lg text-blue-800 dark:text-blue-100 truncate",title:n.personality.name},le(n.personality.name),9,WTr),n.personality.author?(k(),D("p",{key:0,class:"text-xs text-blue-500 dark:text-blue-400 truncate",title:`By ${n.personality.author}`}," By "+le(n.personality.author),9,ZTr)):ne("",!0),n.personality.version?(k(),D("p",{key:1,class:"text-xs text-blue-500 dark:text-blue-400",title:`Version: ${n.personality.version}`}," v"+le(n.personality.version),9,KTr)):ne("",!0),n.personality.category?(k(),D("p",{key:2,class:"text-xs text-blue-500 dark:text-blue-400 truncate",title:`Category: ${n.personality.category}`},le(n.personality.category),9,JTr)):ne("",!0)]),n.personality.help?(k(),D("button",{key:0,onClick:e[2]||(e[2]=oe((...a)=>s.showHelp&&s.showHelp(...a),["stop"])),class:"ml-2 svg-button text-blue-500 hover:text-blue-600 dark:text-blue-400 dark:hover:text-blue-300 flex-shrink-0 -mr-1",title:"Help"},e[14]||(e[14]=[b("i",{"data-feather":"help-circle",class:"h-5 w-5"},null,-1)]))):ne("",!0)]),b("div",eOr,[n.personality.creation_date?(k(),D("p",tOr,"Created: "+le(s.formatDate(n.personality.creation_date)),1)):ne("",!0),n.personality.last_update_date?(k(),D("p",nOr,"Updated: "+le(s.formatDate(n.personality.last_update_date)),1)):ne("",!0)]),b("div",rOr,[b("p",{class:"text-sm text-blue-700 dark:text-blue-300 h-20 overflow-y-auto scrollbar",innerHTML:s.renderedDescription},null,8,iOr)]),n.select_language&&n.personality.languages&&n.personality.languages.length>0&&!n.isMounted?(k(),D("div",sOr,[b("label",{for:"lang-select-"+s.personalityId,class:"label mb-1"},"Language:",8,oOr),Ve(b("select",{id:"lang-select-"+s.personalityId,"onUpdate:modelValue":e[3]||(e[3]=a=>i.selectedLanguage=a),onClick:e[4]||(e[4]=oe(()=>{},["stop"])),onChange:e[5]||(e[5]=(...a)=>s.handleLanguageChange&&s.handleLanguageChange(...a)),class:"input w-full text-sm"},[e[15]||(e[15]=b("option",{value:""},"Default",-1)),(k(!0),D(He,null,dt(n.personality.languages,a=>(k(),D("option",{key:a,value:a},le(a),9,lOr))),128))],40,aOr),[[As,i.selectedLanguage]])])):ne("",!0),b("div",cOr,[b("div",uOr,[b("div",dOr,[n.isMounted?(k(),D("button",{key:1,onClick:e[7]||(e[7]=oe(a=>s.emitAction("unmount"),["stop"])),class:"btn btn-sm bg-red-600 hover:bg-red-700 text-white focus:ring-red-500 dark:bg-red-700 dark:hover:bg-red-600 dark:focus:ring-red-600",title:"Unmount personality"},e[17]||(e[17]=[b("div",{class:"flex items-center"},[b("i",{"data-feather":"stop-circle",class:"w-3 h-3 mr-1 stroke-current"}),Se("Unmount")],-1)]))):(k(),D("button",{key:0,onClick:e[6]||(e[6]=oe(a=>s.emitAction("mount"),["stop"])),class:"btn btn-sm btn-success",title:"Mount personality"},e[16]||(e[16]=[b("div",{class:"flex items-center"},[b("i",{"data-feather":"play",class:"w-3 h-3 mr-1 stroke-current"}),Se("Mount")],-1)]))),n.isMounted?(k(),D("button",{key:2,onClick:e[8]||(e[8]=oe(a=>s.emitAction("remount"),["stop"])),class:"svg-button p-1",title:"Remount personality"},e[18]||(e[18]=[b("i",{"data-feather":"refresh-cw",class:"w-4 h-4"},null,-1)]))):ne("",!0)]),te(o,{commands:s.commandsList,force_position:2,title:"More actions",class:"p-1"},{trigger:Ie(()=>e[19]||(e[19]=[b("button",{class:"svg-button p-1"},[b("i",{"data-feather":"more-vertical",class:"w-5 h-5"})],-1)])),_:1},8,["commands"])])])]),i.showHelpPopup?(k(),D("div",{key:1,onClick:e[11]||(e[11]=oe(()=>{},["stop"])),class:"fixed inset-0 bg-black bg-opacity-70 flex justify-center items-center z-50 p-4"},[b("div",fOr,[b("div",hOr,[b("h2",pOr,"Help: "+le(n.personality.name),1),b("button",{onClick:e[9]||(e[9]=(...a)=>s.closeHelp&&s.closeHelp(...a)),class:"svg-button hover:text-red-600 dark:hover:text-red-500 p-1"},e[20]||(e[20]=[b("i",{"data-feather":"x",class:"w-5 h-5"},null,-1)]))]),b("div",TOr,[b("div",{innerHTML:i.renderedHelp},null,8,OOr)]),b("div",mOr,[b("button",{onClick:e[10]||(e[10]=(...a)=>s.closeHelp&&s.closeHelp(...a)),class:"btn btn-primary"},"Close")])])])):ne("",!0)],10,qTr)}const QOr=at(VTr,[["render",gOr],["__scopeId","data-v-f2a4e010"]]),_Or="/",vOr={name:"PersonalitiesZoo",components:{PersonalityEntry:QOr},props:{config:Object,api_get_req:Function,api_post_req:Function,show_toast:Function,show_yes_no_dialog:Function,show_message_box:Function,client_id:String,show_universal_form:Function},emits:["setting-updated"],data(){return{allPersonalities:[],persCatgArr:[],selectedCategory:"",searchTermInput:"",activeSearchTerm:"",isLoading:!1,bUrl:_Or,defaultPersonalityIcon_:Eo,maxDisplayedMounted:5}},computed:{allStorePersonalities(){return this.$store.getters.getPersonalities||[]},starredPersonalitiesPaths(){return this.$store.getters.getStarredPersonalities||[]},mountedPersArr(){var e;if(!((e=this.$store.state.config)!=null&&e.personalities)||this.allStorePersonalities.length===0)return[];const t=new Set(this.$store.state.config.personalities);return this.allStorePersonalities.filter(n=>{const r=n.full_path,i=Array.isArray(n.languages)?n.languages.map(s=>`${r}:${s}`):[];return t.has(r)||i.some(s=>t.has(s))}).sort((n,r)=>(n.name||"").localeCompare(r.name||""))},active_personality_name(){const t=this.$store.state.config;if(!t||t.active_personality_id<0||!t.personalities||t.active_personality_id>=t.personalities.length)return null;const e=t.personalities[t.active_personality_id],n=e?e.split(":")[0]:null,r=this.allStorePersonalities.find(i=>i.full_path===n);return r?r.name:null},displayedMountedPersonalities(){return this.mountedPersArr.slice(0,this.maxDisplayedMounted)},filteredPersonalities(){let t=[...this.allStorePersonalities];const e=new Set(this.starredPersonalitiesPaths);if(this.selectedCategory==="Mounted"?t=t.filter(n=>n.isMounted):this.selectedCategory==="Starred"?t=t.filter(n=>e.has(n.full_path)):this.selectedCategory&&(t=t.filter(n=>n.category===this.selectedCategory)),this.activeSearchTerm){const n=this.activeSearchTerm.toLowerCase().trim();n&&(t=t.filter(r=>r.name&&r.name.toLowerCase().includes(n)||r.author&&r.author.toLowerCase().includes(n)||r.description&&r.description.toLowerCase().includes(n)||r.full_path&&r.full_path.toLowerCase().includes(n)))}return t.sort((n,r)=>{const i=e.has(n.full_path),s=e.has(r.full_path);if(i&&!s)return-1;if(!i&&s)return 1;if(n.isMounted&&!r.isMounted)return-1;if(!n.isMounted&&r.isMounted)return 1;const o=n.name||"",a=r.name||"";return o.localeCompare(a)}),t}},watch:{"config.personality_category":{handler(t){const e=t||"",n=["","Mounted","Starred",...this.persCatgArr];this.selectedCategory!==e&&n.includes(e)&&(this.selectedCategory=e)},immediate:!0},selectedCategory(t){this.activeSearchTerm="",this.searchTermInput="",Ye(()=>this.resetScroll())},"$store.state.personalities":{handler(t){this.syncLocalMountedFlags()},deep:!0,immediate:!1}},methods:{async fetchCategories(){try{const t=await this.api_get_req("list_personalities_categories");this.persCatgArr=t?t.sort():[]}catch(t){console.error("Error fetching categories:",t)}},async fetchInitialData(){this.isLoading=!0;try{await this.fetchCategories(),this.syncLocalMountedFlags()}catch(t){console.error("Error fetching initial data:",t),this.show_toast(`Error loading data: ${t.message}`,4,!1)}finally{this.isLoading=!1,Ye(()=>{Re.replace(),this.resetScroll()})}},handleCategoryChange(){Ye(()=>this.resetScroll())},applySearch(){this.activeSearchTerm=this.searchTermInput,Ye(()=>this.resetScroll())},clearSearch(){this.searchTermInput="",this.activeSearchTerm="",Ye(()=>this.resetScroll())},toggleStar(t){this.$store.dispatch("toggleStarPersonality",t.personality)},resetScroll(){const t=this.$refs.gridContainer;t&&(t.scrollTop=0)},syncLocalMountedFlags(){var e;const t=new Set(((e=this.$store.state.config)==null?void 0:e.personalities)||[]);this.allStorePersonalities.forEach(n=>{const r=n.full_path,i=Array.isArray(n.languages)?n.languages.map(o=>`${r}:${o}`):[],s=t.has(r)||i.some(o=>t.has(o));n.isMounted!==s&&this.$store.commit("updatePersonality",{...n,isMounted:s})})},personalityImgPlaceholder(t){t.target.src=this.defaultPersonalityIcon_},getPersonalityIconUrl(t){if(!t)return this.defaultPersonalityIcon_;const e=t.startsWith("/")?t.substring(1):t,n=this.bUrl.endsWith("/")||e.startsWith("/")?"":"/";let r=e==="/"?"":e;return`${this.bUrl}${n}${r}`},isActivePersonality(t){const e=this.$store.state.config;if(!e||e.active_personality_id<0||!e.personalities)return!1;const n=e.personalities[e.active_personality_id],r=n?n.split(":")[0]:null;return t.full_path===r},setPersonalityProcessing(t,e){const n=t.personality.id||t.personality.full_path,r=this.allStorePersonalities.find(i=>(i.id||i.full_path)===n);r?this.$store.commit("updatePersonality",{...r,isProcessing:e}):console.warn("Cannot find personality in store to set processing state:",n)},getCategoryCount(t){return this.allStorePersonalities.filter(e=>e.category===t).length},getStarredCount(){const t=new Set(this.starredPersonalitiesPaths);return this.allStorePersonalities.filter(e=>t.has(e.full_path)).length},getResultLabel(){return this.selectedCategory==="Mounted"?"Mounted Personalities":this.selectedCategory==="Starred"?"Starred Personalities":this.selectedCategory?`Personalities in "${this.selectedCategory}"`:"All Personalities"},getResultMessageQualifier(){return this.selectedCategory==="Mounted"?" in Mounted":this.selectedCategory==="Starred"?" in Starred":this.selectedCategory?` in category "${this.selectedCategory}"`:""},async onPersonalitySelected(t){const e=t.personality;if(this.isLoading||e.isProcessing){this.show_toast("Loading...",4,!1);return}if(!e.isMounted){this.show_toast(`Mount "${e.name}" first.`,3,!1);return}if(this.isActivePersonality(e)){this.show_toast(`"${e.name}" is already active.`,3,!1);return}this.setPersonalityProcessing(t,!0),this.show_toast(`Selecting ${e.name}...`,2,!0);const n=await this.select_personality(e);n&&n.status?(this.show_toast(`Selected personality: ${e.name}`,4,!0),await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshMountedPersonalities")):this.show_toast(`Failed to select ${e.name}: ${(n==null?void 0:n.error)||"Unknown error"}`,4,!1),this.setPersonalityProcessing(t,!1)},async select_personality(t){var o;if(!t)return{status:!1,error:"no personality provided"};const e=((o=this.$store.state.config)==null?void 0:o.personalities)||[],n=t.language?`${t.full_path}:${t.language}`:null;let r=null;if(n&&e.includes(n)?r=n:e.includes(t.full_path)&&(r=t.full_path),!r)return{status:!1,error:"Personality variant not found in mounted list"};const i=e.findIndex(a=>a===r);if(i===-1)return{status:!1,error:"Internal error finding personality ID"};const s={id:i};try{return await this.api_post_req("select_personality",s)}catch(a){return{status:!1,error:a.message}}},async mountPersonality(t){const e=t.personality;if(e.isMounted||e.isProcessing||e.disclaimer&&e.disclaimer.trim()!==""&&!await this.show_yes_no_dialog(`Disclaimer for ${e.name}: +Proceed?`,"Proceed","Cancel")),!!e){this.setBindingProcessing(t.folder,!0),this.isLoadingAction=!0;try{const n=await this.api_post_req("install_binding",{name:t.folder});n!=null&&n.status?(this.show_toast(`"${t.name}" installed! Reload recommended.`,5,!0),await this.fetchBindings()):this.show_toast(`Install failed: ${(n==null?void 0:n.error)||"Error"}`,4,!1)}catch{}finally{this.setBindingProcessing(t.folder,!1),this.isLoadingAction=!1,this.replaceFeatherIcons()}}},async handleUninstall(t){if(await this.show_yes_no_dialog(`Uninstall "${t.name}"?`,"Uninstall","Cancel")){this.setBindingProcessing(t.folder,!0),this.isLoadingAction=!0;try{const n=await this.api_post_req("uninstall_binding",{name:t.folder});n!=null&&n.status?(this.show_toast(`"${t.name}" uninstalled.`,4,!0),await this.fetchBindings(),this.config.binding_name===t.folder&&(this.$emit("setting-updated",{key:"binding_name",value:null}),this.$emit("setting-updated",{key:"model_name",value:null}))):this.show_toast(`Uninstall failed: ${(n==null?void 0:n.error)||"Error"}`,4,!1)}catch{}finally{this.setBindingProcessing(t.folder,!1),this.isLoadingAction=!1,this.replaceFeatherIcons()}}},async handleReinstall(t){if(await this.show_yes_no_dialog(`Reinstall "${t.name}"?`,"Reinstall","Cancel")){this.setBindingProcessing(t.folder,!0),this.isLoadingAction=!0;try{const n=await this.api_post_req("reinstall_binding",{name:t.folder});n!=null&&n.status?(this.show_toast(`"${t.name}" reinstalled! Reload recommended.`,5,!0),await this.fetchBindings()):this.show_toast(`Reinstall failed: ${(n==null?void 0:n.error)||"Error"}`,4,!1)}catch{}finally{this.setBindingProcessing(t.folder,!1),this.isLoadingAction=!1,this.replaceFeatherIcons()}}},handleSettingsFromEntry(t){this.handleSettings(t.folder)},handleReloadFromEntry(t){this.handleReload(t.folder)},async handleSettings(t){if(!t){this.show_toast("No binding specified.",3,!1);return}if(this.hasPendingChanges){this.show_toast("Apply settings changes first.",3,!1);return}const e=this.bindings.find(n=>n.folder===t);if(!(e!=null&&e.installed)){this.show_toast(`Binding "${(e==null?void 0:e.name)||t}" not installed.`,3,!1);return}if(t!==this.effectiveConfig.binding_name){this.show_toast(`Select and Apply "${e.name}" first.`,4,!1);return}this.isLoadingAction=!0;try{const n=await this.api_post_req("get_active_binding_settings");if(n&&Object.keys(n).length>0){const r=await this.show_universal_form(n,`Settings - ${e.name}`,"Save","Cancel");if(r!=null){const i=await this.api_post_req("set_active_binding_settings",{settings:r});i!=null&&i.status?(this.show_toast(`Settings updated for "${e.name}". Reloading...`,4,!0),await this.api_post_req("update_binding_settings"),this.show_toast(`Binding "${e.name}" reloaded.`,4,!0)):this.show_toast(`Update failed: ${(i==null?void 0:i.error)||"Error"}`,4,!1)}else this.show_toast("Settings update cancelled.",3,!1)}else n?this.show_toast(`"${e.name}" has no settings.`,3,!1):this.show_toast("Could not get settings.",4,!1)}catch{}finally{this.isLoadingAction=!1,this.replaceFeatherIcons()}},async handleReload(t){if(!t){this.show_toast("No binding specified.",3,!1);return}if(this.hasPendingChanges){this.show_toast("Apply settings changes first.",3,!1);return}const e=this.bindings.find(n=>n.folder===t);if(!(e!=null&&e.installed)){this.show_toast(`Binding "${(e==null?void 0:e.name)||t}" not installed.`,3,!1);return}if(t!==this.effectiveConfig.binding_name){this.show_toast(`"${e.name}" is not the active binding.`,3,!1);return}this.isLoadingAction=!0,this.show_toast(`Reloading "${e.name}"...`,3,!0);try{const n=await this.api_post_req("reload_binding",{name:t});n!=null&&n.status?this.show_toast(`"${e.name}" reloaded.`,4,!0):this.show_toast(`Reload failed: ${(n==null?void 0:n.error)||"Error"}`,4,!1)}catch{}finally{this.isLoadingAction=!1,this.replaceFeatherIcons()}},replaceFeatherIcons(){Ye(()=>{try{Re.replace()}catch{}})}},mounted(){this.fetchBindings(),this.replaceFeatherIcons()},updated(){this.replaceFeatherIcons()}},Q9r={class:"user-settings-panel space-y-6 p-4 md:p-6"},_9r={class:"flex flex-col sm:flex-row justify-between items-start sm:items-center border-b border-blue-300 dark:border-blue-600 pb-3 mb-4"},v9r={key:0,class:"flex items-center gap-2 text-sm font-medium p-2 bg-blue-100 dark:bg-blue-900/50 rounded-md border border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-200"},y9r=["src"],b9r={class:"font-semibold"},S9r=["disabled"],x9r=["disabled"],E9r={key:1,class:"text-sm font-medium text-red-600 dark:text-red-400 p-2 bg-red-100 dark:bg-red-900/30 rounded-md border border-red-300 dark:border-red-600"},w9r={key:0,class:"p-3 bg-yellow-100 dark:bg-yellow-900/30 border border-yellow-300 dark:border-yellow-700 rounded-lg text-center text-sm text-yellow-700 dark:text-yellow-300"},C9r={class:"flex flex-col sm:flex-row gap-4 mb-4"},L9r={class:"relative flex-grow"},A9r=["disabled"],$9r={class:"flex-shrink-0"},k9r=["disabled"],P9r={key:1,class:"flex justify-center items-center p-10"},R9r={key:2,class:"text-center text-blue-500 dark:text-blue-400 py-10"},M9r={key:3,class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 scrollbar"};function D9r(t,e,n,r,i,s){const o=Xe("BindingEntry");return k(),D("div",Q9r,[b("div",_9r,[e[8]||(e[8]=b("h2",{class:"text-xl font-semibold text-blue-800 dark:text-blue-200 mb-2 sm:mb-0"}," Binding Zoo ",-1)),s.currentBindingInfo?(k(),D("div",v9r,[b("img",{src:s.getIconPath(s.currentBindingInfo.icon),onError:e[0]||(e[0]=(...a)=>s.imgPlaceholder&&s.imgPlaceholder(...a)),class:"w-6 h-6 rounded-full object-cover flex-shrink-0",alt:"Current Binding Icon"},null,40,y9r),b("span",null,[e[5]||(e[5]=Se("Active: ")),b("span",b9r,le(s.currentBindingInfo.name),1)]),b("button",{onClick:e[1]||(e[1]=a=>s.handleSettings(s.effectiveConfig.binding_name)),disabled:i.isLoadingAction||n.loading||s.hasPendingChanges,class:"svg-button ml-2 disabled:opacity-50 disabled:cursor-not-allowed",title:"Configure Active Binding"},e[6]||(e[6]=[b("i",{"data-feather":"settings",class:"w-4 h-4"},null,-1)]),8,S9r),b("button",{onClick:e[2]||(e[2]=a=>s.handleReload(s.effectiveConfig.binding_name)),disabled:i.isLoadingAction||n.loading||s.hasPendingChanges,class:"svg-button ml-1 disabled:opacity-50 disabled:cursor-not-allowed",title:"Reload Active Binding"},e[7]||(e[7]=[b("i",{"data-feather":"refresh-cw",class:"w-4 h-4"},null,-1)]),8,x9r)])):(k(),D("div",E9r," No binding selected! "))]),e[14]||(e[14]=b("p",{class:"text-sm text-blue-600 dark:text-blue-400"}," Bindings are the engines that run the AI models. Select an installed binding to enable model selection and generation. ",-1)),s.hasPendingChanges?(k(),D("div",w9r,e[9]||(e[9]=[b("i",{"data-feather":"alert-circle",class:"inline-block w-4 h-4 mr-1 align-middle"},null,-1),Se(" Apply main settings changes to use binding actions (settings, reload). ")]))):ne("",!0),b("div",C9r,[b("div",L9r,[e[10]||(e[10]=b("div",{class:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"},[b("i",{"data-feather":"search",class:"w-5 h-5 text-blue-400 dark:text-blue-500"})],-1)),Ve(b("input",{type:"search","onUpdate:modelValue":e[3]||(e[3]=a=>i.searchTerm=a),placeholder:"Search bindings...",class:"input search-input pl-10 w-full","aria-label":"Search bindings",disabled:i.isLoadingBindings||n.loading},null,8,A9r),[[yt,i.searchTerm]])]),b("div",$9r,[e[12]||(e[12]=b("label",{for:"binding-sort",class:"sr-only"},"Sort bindings by",-1)),Ve(b("select",{id:"binding-sort","onUpdate:modelValue":e[4]||(e[4]=a=>i.sortOption=a),class:"input w-full sm:w-auto","aria-label":"Sort bindings by",disabled:i.isLoadingBindings||n.loading},e[11]||(e[11]=[b("option",{value:"name"},"Sort by Name",-1),b("option",{value:"author"},"Sort by Author",-1),b("option",{value:"status"},"Sort by Status",-1)]),8,k9r),[[As,i.sortOption]])])]),i.isLoadingBindings?(k(),D("div",P9r,e[13]||(e[13]=[b("svg",{"aria-hidden":"true",role:"status",class:"w-8 h-8 text-blue-300 animate-spin dark:text-blue-600 fill-blue-600 dark:fill-blue-400",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[b("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"}),b("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),b("span",{class:"ml-2 text-loading"},"Loading bindings...",-1)]))):s.sortedBindings.length===0?(k(),D("div",R9r," No bindings found"+le(i.searchTerm?' matching "'+i.searchTerm+'"':"")+". ",1)):(k(),D("div",M9r,[(k(!0),D(He,null,dt(s.sortedBindings,a=>(k(),Qt(o,{key:a.folder,binding:a,selected:s.isBindingSelected(a),"is-processing":a.isProcessing,onSelect:s.handleSelect,onInstall:s.handleInstall,onUninstall:s.handleUninstall,onReinstall:s.handleReinstall,onSettings:s.handleSettingsFromEntry,onReloadBinding:s.handleReloadFromEntry},null,8,["binding","selected","is-processing","onSelect","onInstall","onUninstall","onReinstall","onSettings","onReloadBinding"]))),128))]))])}const N9r=at(g9r,[["render",D9r],["__scopeId","data-v-8b87b723"]]),U9="/assets/logo-6TyToX4A.png",I9r={name:"InteractiveMenu",props:{title:{type:String,required:!1,default:"Menu"},icon:{type:String,required:!1,default:"feather:more-vertical"},commands:{type:Array,required:!0,default:()=>[]},force_position:{type:Number,required:!1,default:0},execute_cmd:{type:Function,required:!1},menuIconClass:{type:String,required:!1,default:""},selected_entry:{type:String,required:!1,default:null}},data(){return{isMenuOpen:!1,menuStyle:{top:"auto",bottom:"auto",left:"auto",right:"auto",transformOrigin:"top left"}}},methods:{updateFeatherIcons(){Ye(()=>{Re.replace({width:"1em",height:"1em","stroke-width":2})})},handleClickOutside(t){this.$refs.menuContainerRef&&!this.$refs.menuContainerRef.contains(t.target)&&this.closeMenu()},toggleMenu(){this.isMenuOpen?this.closeMenu():this.openMenu()},openMenu(){this.isMenuOpen=!0,Ye(()=>{this.positionMenu(),this.updateFeatherIcons(),document.addEventListener("click",this.handleClickOutside,!0)})},closeMenu(){this.isMenuOpen=!1,document.removeEventListener("click",this.handleClickOutside,!0)},executeCommand(t){this.closeMenu(),typeof t.value=="function"?t.value():this.execute_cmd?this.execute_cmd(t):console.warn("InteractiveMenu: No action defined for command:",t.name)},positionMenu(){if(!this.isMenuOpen||!this.$refs.menuButtonRef||!this.$refs.menuRef)return;const t=this.$refs.menuButtonRef.getBoundingClientRect(),e=this.$refs.menuRef,n=e.style.visibility,r=e.style.display,i=e.style.position,s=e.style.top,o=e.style.left;e.style.visibility="hidden",e.style.position="fixed",e.style.top="-9999px",e.style.left="-9999px",e.style.display="block";const a=e.getBoundingClientRect();e.style.visibility=n,e.style.position=i,e.style.top=s,e.style.left=o,e.style.display=r;const l=window.innerWidth,c=window.innerHeight,u=8;let d={top:"auto",bottom:"auto",left:"auto",right:"auto",transformOrigin:""};const f=c-t.bottom-u,h=t.top-u,p=a.height;let T="below";this.force_position===1?T="above":this.force_position===2||f>=p?T="below":h>=p?T="above":T=h>f?"above":"below",T==="above"?(d.bottom="calc(100% + 4px)",d.top="auto",d.transformOrigin="bottom "):(d.top="calc(100% + 4px)",d.bottom="auto",d.transformOrigin="top "),l-t.left-u,t.right-u;const m=a.width;let O="left-align";this.force_position===3?O="right-align":this.force_position===4?O="left-align":t.left+m>l-u&&t.right-m>u&&(O="right-align"),O==="right-align"?(d.right="0px",d.left="auto",d.transformOrigin+="right"):(d.left="0px",d.right="auto",d.transformOrigin+="left"),this.menuStyle=d}},mounted(){window.addEventListener("resize",this.positionMenu),this.updateFeatherIcons()},beforeUnmount(){window.removeEventListener("resize",this.positionMenu),document.removeEventListener("click",this.handleClickOutside,!0)}},H9r={class:"interactive-menu-container",ref:"menuContainerRef"},V9r=["title"],q9r=["src"],U9r=["data-feather"],B9r={key:2,class:"interactive-menu-trigger-text"},z9r={key:3,"data-feather":"menu",class:"interactive-menu-trigger-icon"},X9r=["aria-labelledby"],F9r={class:"interactive-menu-list",role:"none"},j9r=["onClick","id"],Y9r={class:"interactive-menu-item-checkmark-placeholder"},G9r={key:0,"data-feather":"check",class:"interactive-menu-item-checkmark-icon"},W9r={class:"interactive-menu-item-icon-container"},Z9r=["src","alt"],K9r=["data-feather"],J9r={key:2,class:"interactive-menu-item-icon-text"},epr={key:3,class:"interactive-menu-item-icon-placeholder"},tpr={class:"interactive-menu-item-name"};function npr(t,e,n,r,i,s){return k(),D("div",H9r,[b("button",{onClick:e[0]||(e[0]=oe((...o)=>s.toggleMenu&&s.toggleMenu(...o),["prevent"])),title:n.title||"Open Menu",class:be(["interactive-menu-trigger",n.menuIconClass]),ref:"menuButtonRef",type:"button"},[Jn(t.$slots,"trigger",{},()=>[n.icon&&!n.icon.includes("#")&&!n.icon.includes("feather:")?(k(),D("img",{key:0,src:n.icon,class:"interactive-menu-trigger-icon",alt:"Menu Icon"},null,8,q9r)):n.icon&&n.icon.includes("feather:")?(k(),D("i",{key:1,"data-feather":n.icon.split(":")[1],class:"interactive-menu-trigger-icon"},null,8,U9r)):n.icon&&n.icon.includes("#")?(k(),D("span",B9r,le(n.icon.split("#")[1]),1)):(k(),D("i",z9r))],!0)],10,V9r),te(cr,{name:"interactive-menu-transition"},{default:Ie(()=>[i.isMenuOpen?(k(),D("div",{key:0,class:"interactive-menu-dropdown",style:qn(i.menuStyle),ref:"menuRef",role:"menu","aria-orientation":"vertical","aria-labelledby":`menu-button-${t._uid}`},[b("ul",F9r,[(k(!0),D(He,null,dt(n.commands,(o,a)=>(k(),D("li",{key:a,onClick:oe(l=>s.executeCommand(o),["prevent"]),class:"interactive-menu-item group",role:"menuitem",tabindex:-1,id:`menu-item-${t._uid}-${a}`},[b("span",Y9r,[n.selected_entry===o.name?(k(),D("i",G9r)):ne("",!0)]),b("span",W9r,[o.icon&&!o.icon.includes("#")&&!o.icon.includes("feather:")?(k(),D("img",{key:0,src:o.icon,alt:o.name,class:"interactive-menu-item-icon"},null,8,Z9r)):o.icon&&o.icon.includes("feather:")?(k(),D("i",{key:1,"data-feather":o.icon.split(":")[1],class:"interactive-menu-item-icon"},null,8,K9r)):o.icon&&o.icon.includes("#")?(k(),D("span",J9r,le(o.icon.split("#")[1]),1)):(k(),D("span",epr))]),b("span",tpr,le(o.name),1)],8,j9r))),128))])],12,X9r)):ne("",!0)]),_:1})],512)}const YC=at(I9r,[["render",npr],["__scopeId","data-v-e42afcb4"]]),rpr={name:"ModelEntry",components:{InteractiveMenu:YC},props:{model:{type:Object,required:!0},isSelected:{type:Boolean,default:!1},isInstalled:{type:Boolean,default:!1},isProcessing:{type:Boolean,default:!1},progress:{type:Number,default:0},speed:{type:Number,default:0},total_size:{type:Number,default:0},downloaded_size:{type:Number,default:0},progressName:{type:String,default:"Processing..."}},emits:["select","install","uninstall","cancel-install","copy","copy-link"],data(){return{failedToLoad:!1,linkNotValid:!!this.model.error}},mounted(){Ye(()=>{Re.replace()})},updated(){Ye(()=>{Re.replace()})},methods:{formatDate(t){if(!t)return"N/A";try{const e=new Date(t);return isNaN(e.getTime())?"Invalid Date":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch(e){return console.error("Error formatting date:",e),"Invalid Date"}},formatFileSize(t){return T4(t)},getImgUrl(){return this.model.icon||U9},defaultImg(t){this.failedToLoad=!0,t.target.src=U9},handleClick(){if(this.isProcessing||!this.isInstalled||this.isSelected){console.log(`Click ignored: processing=${this.isProcessing}, installed=${this.isInstalled}, selected=${this.isSelected}`);return}console.log("Emitting select event for:",this.model.name),this.$emit("select",this.model)},handleInstallClick(){this.isProcessing||(console.log("Emitting install event for:",this.model.name),this.$emit("install",{model:this.model}))},handleUninstallClick(){this.isProcessing||!this.isInstalled||(console.log("Emitting uninstall event for:",this.model.name),this.$emit("uninstall",{model:this.model}))},handleCancelClick(){console.log("Emitting cancel-install event for:",this.model.name),this.$emit("cancel-install",{model:this.model})},handleCopyClick(){this.$emit("copy",{model:this.model})},handleCopyLinkClick(){this.$emit("copy-link",{model:this.model})},checkLinkValidity(){this.linkNotValid=!!this.model.error}},computed:{computedClasses(){const t=[];return this.isProcessing?t.push("opacity-70 pointer-events-none"):this.isSelected&&this.isInstalled?(t.push("border-[3px] border-blue-500 dark:border-blue-400 ring-2 ring-blue-300 dark:ring-blue-600 ring-offset-1 dark:ring-offset-gray-800"),t.push("bg-blue-50 dark:bg-blue-900/50"),t.push("cursor-default")):this.isInstalled&&!this.isSelected?(t.push("border-gray-200 dark:border-gray-700"),t.push("hover:border-blue-400 dark:hover:border-blue-600"),t.push("hover:bg-blue-50/50 dark:hover:bg-blue-900/20"),t.push("cursor-pointer")):this.isInstalled||(t.push("border-dashed border-gray-300 dark:border-gray-600"),t.push("opacity-80")),this.linkNotValid&&!this.isProcessing&&t.push("border-l-4 border-l-red-500"),t.join(" ")},isDisabled(){return this.isProcessing||!this.isInstalled},commandsList(){let t=[];return this.isInstalled?(t.push({name:"Uninstall",icon:"feather:trash-2",value:this.handleUninstallClick,disabled:this.isProcessing}),this.isSelected&&t.push({name:"Reload",icon:"feather:refresh-cw",value:this.handleClick,disabled:this.isProcessing})):t.push({name:"Install",icon:"feather:download",value:this.handleInstallClick,disabled:this.isProcessing||this.linkNotValid}),t.push({name:"Copy Info",icon:"feather:copy",value:this.handleCopyClick}),this.model.isCustomModel||t.push({name:"Copy Link",icon:"feather:clipboard",value:this.handleCopyLinkClick}),t},fileSize(){var n,r,i;const t=(r=(n=this.model)==null?void 0:n.variants)==null?void 0:r[0],e=(t==null?void 0:t.size)??((i=this.model)==null?void 0:i.size);return e?this.formatFileSize(e):"N/A"},speed_computed(){return this.formatFileSize(this.speed)+"/s"},total_size_computed(){return this.formatFileSize(this.total_size)},downloaded_size_computed(){return this.formatFileSize(this.downloaded_size)}},watch:{isProcessing(t,e){console.log(`Model ${this.model.name} processing state changed to: ${t}`),Ye(()=>{Re.replace()})},"model.error":function(t){this.linkNotValid=!!t}}},ipr=["title","aria-pressed","aria-disabled"],spr={key:0},opr={class:"flex flex-row"},apr={class:"max-w-[300px] overflow-x-auto"},lpr={class:"flex gap-3 items-center grow"},cpr=["src"],upr={class:"flex-1 overflow-hidden"},dpr={class:"font-bold font-large text-lg truncate"},fpr={class:"flex items-center flex-row gap-2 my-1 mt-3"},hpr=["disabled"],ppr={key:1},Tpr={class:"flex flex-row items-center gap-3 mb-2"},Opr=["src"],mpr={class:"font-bold font-large text-lg truncate flex-grow"},gpr={class:"flex items-center",title:"Hugging Face Model Card"},Qpr=["href"],_pr={class:"flex items-center",title:"Approximate File Size"},vpr={class:"flex items-center",title:"Model License"},ypr={key:0,class:"flex items-center",title:"Quantizer Profile"},bpr=["href"],Spr={key:1,class:"flex items-center",title:"Original Model Creator Profile"},xpr=["href"],Epr={key:2,class:"flex items-center",title:"Last Update Date"},wpr={key:3,class:"flex items-center",title:"Model Category"},Cpr={key:4,class:"flex items-center",title:"Hugging Face Rank (May be outdated)"},Lpr={key:2,class:"absolute z-10 inset-0 -m-px p-4 shadow-md text-center rounded-lg bg-white/80 dark:bg-gray-800/80 flex justify-center items-center backdrop-blur-sm"},Apr={class:"relative flex flex-col items-center justify-center w-full h-full"},$pr={class:"absolute bottom-2 left-2 right-2 w-auto bg-white/70 dark:bg-gray-800/70 rounded-lg p-2 backdrop-blur-sm"},kpr={class:"flex justify-between mb-1 text-xs"},Ppr={class:"font-medium text-blue-700 dark:text-blue-300"},Rpr={key:0,class:"font-medium text-blue-700 dark:text-blue-300"},Mpr={key:0,class:"w-full bg-gray-200 rounded-full h-1.5 dark:bg-gray-700 mb-1"},Dpr={key:1,class:"flex justify-between text-xs text-blue-600 dark:text-blue-400"};function Npr(t,e,n,r,i,s){const o=Xe("InteractiveMenu");return k(),D("div",{class:be(["relative items-start p-4 hover:bg-blue-100 dark:hover:bg-blue-900/30 rounded-lg mb-2 shadow-lg border-2 select-none transition-colors duration-150",s.computedClasses]),title:n.model.name,role:"button",tabindex:"0","aria-pressed":n.isSelected,"aria-disabled":s.isDisabled,onClick:e[9]||(e[9]=oe((...a)=>s.handleClick&&s.handleClick(...a),["prevent"])),onKeydown:[e[10]||(e[10]=Dr((...a)=>s.handleClick&&s.handleClick(...a),["enter"])),e[11]||(e[11]=Dr(oe((...a)=>s.handleClick&&s.handleClick(...a),["prevent"]),["space"]))]},[n.model.isCustomModel?(k(),D("div",spr,[b("div",opr,[b("div",apr,[b("div",lpr,[b("img",{src:s.getImgUrl(),onError:e[0]||(e[0]=a=>s.defaultImg(a)),class:"w-10 h-10 rounded-lg object-cover flex-shrink-0"},null,40,cpr),b("div",upr,[b("h3",dpr,le(n.model.name),1)])])])]),b("div",fpr,[e[13]||(e[13]=b("div",{class:"flex grow items-center text-sm text-gray-600 dark:text-gray-400"},[b("i",{"data-feather":"hard-drive",class:"w-4 h-4 mr-1"}),Se(" Local Reference ")],-1)),b("div",null,[n.isInstalled?(k(),D("button",{key:0,title:"Remove Reference (Doesn't delete file)",type:"button",onClick:e[1]||(e[1]=oe((...a)=>s.handleUninstallClick&&s.handleUninstallClick(...a),["stop"])),disabled:n.isProcessing,class:"button-danger-sm"},e[12]||(e[12]=[b("i",{"data-feather":"trash-2",class:"w-4 h-4 mr-1"},null,-1),Se(" Remove ")]),8,hpr)):ne("",!0)])])])):ne("",!0),n.model.isCustomModel?ne("",!0):(k(),D("div",ppr,[b("div",Tpr,[b("img",{ref:"imgElement",src:s.getImgUrl(),onError:e[2]||(e[2]=a=>s.defaultImg(a)),class:be(["w-10 h-10 rounded-lg object-cover flex-shrink-0",{grayscale:i.linkNotValid}])},null,42,Opr),b("h3",mpr,le(n.model.name),1),te(o,{commands:s.commandsList,force_position:2,title:"Menu",onClick:e[3]||(e[3]=oe(()=>{},["stop"]))},null,8,["commands"])]),b("div",{class:be(["space-y-1 text-sm text-gray-700 dark:text-gray-300",{"opacity-60":i.linkNotValid}])},[b("div",gpr,[e[14]||(e[14]=b("i",{"data-feather":"link",class:"w-4 h-4 mr-2 flex-shrink-0"},null,-1)),e[15]||(e[15]=b("b",{class:"mr-1 flex-shrink-0"},"Card:",-1)),b("a",{href:"https://huggingface.co/"+n.model.quantizer+"/"+n.model.name,target:"_blank",onClick:e[4]||(e[4]=oe(()=>{},["stop"])),class:be(["truncate hover:text-blue-600 dark:hover:text-blue-400 duration-150 underline",{"text-red-500 pointer-events-none":i.linkNotValid}])},le(i.linkNotValid?"Link Invalid":`${n.model.quantizer}/${n.model.name}`),11,Qpr)]),b("div",_pr,[e[16]||(e[16]=b("i",{"data-feather":"file",class:"w-4 h-4 mr-2 flex-shrink-0"},null,-1)),e[17]||(e[17]=b("b",{class:"mr-1"},"Size:",-1)),b("span",null,le(s.fileSize||"N/A"),1)]),b("div",vpr,[e[18]||(e[18]=b("i",{"data-feather":"key",class:"w-4 h-4 mr-2 flex-shrink-0"},null,-1)),e[19]||(e[19]=b("b",{class:"mr-1"},"License:",-1)),b("span",null,le(n.model.license||"N/A"),1)]),n.model.quantizer&&n.model.quantizer!=="None"&&n.model.type!=="transformers"?(k(),D("div",ypr,[e[20]||(e[20]=b("i",{"data-feather":"user",class:"w-4 h-4 mr-2 flex-shrink-0"},null,-1)),e[21]||(e[21]=b("b",{class:"mr-1"},"Quantizer:",-1)),b("a",{href:"https://huggingface.co/"+n.model.quantizer,target:"_blank",rel:"noopener noreferrer",onClick:e[5]||(e[5]=oe(()=>{},["stop"])),class:"truncate hover:text-blue-600 dark:hover:text-blue-400 duration-150 underline"},le(n.model.quantizer),9,bpr)])):ne("",!0),n.model.model_creator?(k(),D("div",Spr,[e[22]||(e[22]=b("i",{"data-feather":"users",class:"w-4 h-4 mr-2 flex-shrink-0"},null,-1)),e[23]||(e[23]=b("b",{class:"mr-1"},"Creator:",-1)),b("a",{href:n.model.model_creator_link,target:"_blank",rel:"noopener noreferrer",onClick:e[6]||(e[6]=oe(()=>{},["stop"])),class:"truncate hover:text-blue-600 dark:hover:text-blue-400 duration-150 underline"},le(n.model.model_creator),9,xpr)])):ne("",!0),n.model.last_commit_time?(k(),D("div",Epr,[e[24]||(e[24]=b("i",{"data-feather":"clock",class:"w-4 h-4 mr-2 flex-shrink-0"},null,-1)),e[25]||(e[25]=b("b",{class:"mr-1"},"Updated:",-1)),b("span",null,le(s.formatDate(n.model.last_commit_time)),1)])):ne("",!0),n.model.category?(k(),D("div",wpr,[e[26]||(e[26]=b("i",{"data-feather":"grid",class:"w-4 h-4 mr-2 flex-shrink-0"},null,-1)),e[27]||(e[27]=b("b",{class:"mr-1"},"Category:",-1)),b("span",null,le(n.model.category),1)])):ne("",!0),n.model.rank?(k(),D("div",Cpr,[e[28]||(e[28]=b("i",{"data-feather":"bar-chart-2",class:"w-4 h-4 mr-2 flex-shrink-0"},null,-1)),e[29]||(e[29]=b("b",{class:"mr-1"},"Rank:",-1)),b("a",{href:"https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard",target:"_blank",rel:"noopener noreferrer",onClick:e[7]||(e[7]=oe(()=>{},["stop"])),class:"hover:text-blue-600 dark:hover:text-blue-400 duration-150 underline"},le(n.model.rank),1)])):ne("",!0)],2)])),n.isProcessing?(k(),D("div",Lpr,[b("div",Apr,[e[30]||(e[30]=b("div",{role:"status",class:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"},[b("svg",{"aria-hidden":"true",class:"w-16 h-16 text-gray-300 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[b("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"}),b("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"})]),b("span",{class:"sr-only"},"Processing...")],-1)),b("div",$pr,[b("div",kpr,[b("span",Ppr,le(n.progressName),1),n.progress>0?(k(),D("span",Rpr,le(Math.floor(n.progress))+"%",1)):ne("",!0)]),n.progress>0?(k(),D("div",Mpr,[b("div",{class:"bg-blue-600 h-1.5 rounded-full",style:qn({width:n.progress+"%"})},null,4)])):ne("",!0),n.progress>0&&n.total_size>0?(k(),D("div",Dpr,[b("span",null,le(s.downloaded_size_computed)+"/"+le(s.total_size_computed),1),b("span",null,le(s.speed_computed)+"/s",1)])):ne("",!0),b("button",{onClick:e[8]||(e[8]=oe((...a)=>s.handleCancelClick&&s.handleCancelClick(...a),["stop"])),type:"button",title:"Cancel Operation",class:"button-danger-sm w-full mt-2 text-xs"}," Cancel ")])])])):ne("",!0)],42,ipr)}const Ipr=at(rpr,[["render",Npr],["__scopeId","data-v-f3f315d6"]]),Hpr={props:{show:{type:Boolean,default:!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(t){return typeof t=="string"?t:t&&t.name?t.name:""},selectChoice(t){this.selectedChoice=t,this.$emit("choice-selected",t)},closeDialog(){this.$emit("close-dialog")},validateChoice(){this.$emit("choice-validated",this.selectedChoice)},formatSize(t){const e=["bytes","KB","MB","GB"];let n=0;for(;t>=1024&&nError displaying help content.
",this.showHelpPopup=!0,this.updateFeatherIcons()}}},closeHelp(){this.showHelpPopup=!1,this.updateFeatherIcons()}},mounted(){this.selectedLanguage=this.personality.language||"",this.updateFeatherIcons()}},qTr=["title"],UTr={key:0,class:"absolute inset-0 bg-blue-400 dark:bg-blue-700 bg-opacity-50 dark:bg-opacity-50 flex items-center justify-center rounded-lg z-20"},BTr=["title"],zTr={key:0,"data-feather":"star",class:"w-5 h-5 fill-current"},XTr={key:1,"data-feather":"star",class:"w-5 h-5 stroke-current"},FTr={class:"flex-grow flex flex-col"},jTr={class:"flex items-start mb-3"},YTr=["src"],GTr={class:"flex-grow overflow-hidden min-w-0"},WTr=["title"],ZTr=["title"],KTr=["title"],JTr=["title"],eOr={class:"text-xs text-blue-400 dark:text-blue-500 mb-3 space-y-1"},tOr={key:0},nOr={key:1},rOr={class:"mb-4 flex-grow"},iOr=["innerHTML"],sOr={key:0,class:"mb-3 mt-auto"},oOr=["for"],aOr=["id"],lOr=["value"],cOr={class:"mt-auto pt-3 border-t border-blue-200 dark:border-blue-700"},uOr={class:"flex justify-between items-center"},dOr={class:"flex space-x-1"},fOr={class:"card w-full max-w-2xl max-h-[80vh] flex flex-col"},hOr={class:"flex justify-between items-center mb-4 border-b pb-2 border-blue-200 dark:border-blue-600"},pOr={class:"text-xl font-bold text-blue-800 dark:text-blue-100"},TOr={class:"flex-grow overflow-y-auto scrollbar prose-blue max-w-none pr-2"},OOr=["innerHTML"],mOr={class:"mt-4 pt-4 border-t border-blue-200 dark:border-blue-600 text-right"};function gOr(t,e,n,r,i,s){const o=Xe("InteractiveMenu");return k(),D("div",{class:be(["app-card relative flex flex-col",{"border-2 border-blue-500 dark:border-blue-400 shadow-lg":n.isActive,"border-blue-200 dark:border-blue-700":!n.isActive,"opacity-50 pointer-events-none":n.isProcessing}]),title:n.personality.tool_description||n.personality.description||n.personality.name,onClick:e[12]||(e[12]=(...a)=>s.handleSelect&&s.handleSelect(...a))},[n.isProcessing?(k(),D("div",UTr,e[13]||(e[13]=[b("svg",{"aria-hidden":"true",class:"w-8 h-8 text-blue-200 animate-spin dark:text-blue-600 fill-blue-600 dark:fill-blue-300",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[b("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"}),Se(),b("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)]))):ne("",!0),b("button",{onClick:e[0]||(e[0]=oe((...a)=>s.toggleStar&&s.toggleStar(...a),["stop"])),class:"absolute top-2 right-2 svg-button text-yellow-400 hover:text-yellow-500 dark:text-yellow-500 dark:hover:text-yellow-400 z-10",title:n.isStarred?"Unstar":"Star"},[n.isStarred?(k(),D("i",zTr)):(k(),D("i",XTr))],8,BTr),b("div",FTr,[b("div",jTr,[b("img",{src:s.getPersonalityIconUrl(n.personality.avatar),onError:e[1]||(e[1]=(...a)=>s.handleImgError&&s.handleImgError(...a)),alt:"Personality Icon",class:"w-16 h-16 rounded-lg object-cover mr-4 flex-shrink-0 border border-blue-200 dark:border-blue-600 shadow-sm"},null,40,YTr),b("div",GTr,[b("h3",{class:"font-bold text-lg text-blue-800 dark:text-blue-100 truncate",title:n.personality.name},le(n.personality.name),9,WTr),n.personality.author?(k(),D("p",{key:0,class:"text-xs text-blue-500 dark:text-blue-400 truncate",title:`By ${n.personality.author}`}," By "+le(n.personality.author),9,ZTr)):ne("",!0),n.personality.version?(k(),D("p",{key:1,class:"text-xs text-blue-500 dark:text-blue-400",title:`Version: ${n.personality.version}`}," v"+le(n.personality.version),9,KTr)):ne("",!0),n.personality.category?(k(),D("p",{key:2,class:"text-xs text-blue-500 dark:text-blue-400 truncate",title:`Category: ${n.personality.category}`},le(n.personality.category),9,JTr)):ne("",!0)]),n.personality.help?(k(),D("button",{key:0,onClick:e[2]||(e[2]=oe((...a)=>s.showHelp&&s.showHelp(...a),["stop"])),class:"ml-2 svg-button text-blue-500 hover:text-blue-600 dark:text-blue-400 dark:hover:text-blue-300 flex-shrink-0 -mr-1",title:"Help"},e[14]||(e[14]=[b("i",{"data-feather":"help-circle",class:"h-5 w-5"},null,-1)]))):ne("",!0)]),b("div",eOr,[n.personality.creation_date?(k(),D("p",tOr,"Created: "+le(s.formatDate(n.personality.creation_date)),1)):ne("",!0),n.personality.last_update_date?(k(),D("p",nOr,"Updated: "+le(s.formatDate(n.personality.last_update_date)),1)):ne("",!0)]),b("div",rOr,[b("p",{class:"text-sm text-blue-700 dark:text-blue-300 h-20 overflow-y-auto scrollbar",innerHTML:s.renderedDescription},null,8,iOr)]),n.select_language&&n.personality.languages&&n.personality.languages.length>0&&!n.isMounted?(k(),D("div",sOr,[b("label",{for:"lang-select-"+s.personalityId,class:"label mb-1"},"Language:",8,oOr),Ve(b("select",{id:"lang-select-"+s.personalityId,"onUpdate:modelValue":e[3]||(e[3]=a=>i.selectedLanguage=a),onClick:e[4]||(e[4]=oe(()=>{},["stop"])),onChange:e[5]||(e[5]=(...a)=>s.handleLanguageChange&&s.handleLanguageChange(...a)),class:"input w-full text-sm"},[e[15]||(e[15]=b("option",{value:""},"Default",-1)),(k(!0),D(He,null,dt(n.personality.languages,a=>(k(),D("option",{key:a,value:a},le(a),9,lOr))),128))],40,aOr),[[As,i.selectedLanguage]])])):ne("",!0),b("div",cOr,[b("div",uOr,[b("div",dOr,[n.isMounted?(k(),D("button",{key:1,onClick:e[7]||(e[7]=oe(a=>s.emitAction("unmount"),["stop"])),class:"btn btn-sm bg-red-600 hover:bg-red-700 text-white focus:ring-red-500 dark:bg-red-700 dark:hover:bg-red-600 dark:focus:ring-red-600",title:"Unmount personality"},e[17]||(e[17]=[b("div",{class:"flex items-center"},[b("i",{"data-feather":"stop-circle",class:"w-3 h-3 mr-1 stroke-current"}),Se("Unmount")],-1)]))):(k(),D("button",{key:0,onClick:e[6]||(e[6]=oe(a=>s.emitAction("mount"),["stop"])),class:"btn btn-sm btn-success",title:"Mount personality"},e[16]||(e[16]=[b("div",{class:"flex items-center"},[b("i",{"data-feather":"play",class:"w-3 h-3 mr-1 stroke-current"}),Se("Mount")],-1)]))),n.isMounted?(k(),D("button",{key:2,onClick:e[8]||(e[8]=oe(a=>s.emitAction("remount"),["stop"])),class:"svg-button p-1",title:"Remount personality"},e[18]||(e[18]=[b("i",{"data-feather":"refresh-cw",class:"w-4 h-4"},null,-1)]))):ne("",!0)]),te(o,{commands:s.commandsList,force_position:2,title:"More actions",class:"p-1"},{trigger:Ie(()=>e[19]||(e[19]=[b("button",{class:"svg-button p-1"},[b("i",{"data-feather":"more-vertical",class:"w-5 h-5"})],-1)])),_:1},8,["commands"])])])]),i.showHelpPopup?(k(),D("div",{key:1,onClick:e[11]||(e[11]=oe(()=>{},["stop"])),class:"fixed inset-0 bg-black bg-opacity-70 flex justify-center items-center z-50 p-4"},[b("div",fOr,[b("div",hOr,[b("h2",pOr,"Help: "+le(n.personality.name),1),b("button",{onClick:e[9]||(e[9]=(...a)=>s.closeHelp&&s.closeHelp(...a)),class:"svg-button hover:text-red-600 dark:hover:text-red-500 p-1"},e[20]||(e[20]=[b("i",{"data-feather":"x",class:"w-5 h-5"},null,-1)]))]),b("div",TOr,[b("div",{innerHTML:i.renderedHelp},null,8,OOr)]),b("div",mOr,[b("button",{onClick:e[10]||(e[10]=(...a)=>s.closeHelp&&s.closeHelp(...a)),class:"btn btn-primary"},"Close")])])])):ne("",!0)],10,qTr)}const QOr=at(VTr,[["render",gOr],["__scopeId","data-v-f2a4e010"]]),_Or="/",vOr={name:"PersonalitiesZoo",components:{PersonalityEntry:QOr},props:{config:Object,api_get_req:Function,api_post_req:Function,show_toast:Function,show_yes_no_dialog:Function,show_message_box:Function,client_id:String,show_universal_form:Function},emits:["setting-updated"],data(){return{allPersonalities:[],persCatgArr:[],selectedCategory:"",searchTermInput:"",activeSearchTerm:"",isLoading:!1,bUrl:_Or,defaultPersonalityIcon_:Eo,maxDisplayedMounted:5}},computed:{allStorePersonalities(){return this.$store.getters.getPersonalities||[]},starredPersonalitiesPaths(){return this.$store.getters.getStarredPersonalities||[]},mountedPersArr(){var e;if(!((e=this.$store.state.config)!=null&&e.personalities)||this.allStorePersonalities.length===0)return[];const t=new Set(this.$store.state.config.personalities);return this.allStorePersonalities.filter(n=>{const r=n.full_path,i=Array.isArray(n.languages)?n.languages.map(s=>`${r}:${s}`):[];return t.has(r)||i.some(s=>t.has(s))}).sort((n,r)=>(n.name||"").localeCompare(r.name||""))},active_personality_name(){const t=this.$store.state.config;if(!t||t.active_personality_id<0||!t.personalities||t.active_personality_id>=t.personalities.length)return null;const e=t.personalities[t.active_personality_id],n=e?e.split(":")[0]:null,r=this.allStorePersonalities.find(i=>i.full_path===n);return r?r.name:null},displayedMountedPersonalities(){return this.mountedPersArr.slice(0,this.maxDisplayedMounted)},filteredPersonalities(){let t=[...this.allStorePersonalities];const e=new Set(this.starredPersonalitiesPaths);if(this.selectedCategory==="Mounted"?t=t.filter(n=>n.isMounted):this.selectedCategory==="Starred"?t=t.filter(n=>e.has(n.full_path)):this.selectedCategory&&(t=t.filter(n=>n.category===this.selectedCategory)),this.activeSearchTerm){const n=this.activeSearchTerm.toLowerCase().trim();n&&(t=t.filter(r=>r.name&&r.name.toLowerCase().includes(n)||r.author&&r.author.toLowerCase().includes(n)||r.description&&r.description.toLowerCase().includes(n)||r.full_path&&r.full_path.toLowerCase().includes(n)))}return t.sort((n,r)=>{const i=e.has(n.full_path),s=e.has(r.full_path);if(i&&!s)return-1;if(!i&&s)return 1;if(n.isMounted&&!r.isMounted)return-1;if(!n.isMounted&&r.isMounted)return 1;const o=n.name||"",a=r.name||"";return o.localeCompare(a)}),t}},watch:{"config.personality_category":{handler(t){const e=t||"",n=["","Mounted","Starred",...this.persCatgArr];this.selectedCategory!==e&&n.includes(e)&&(this.selectedCategory=e)},immediate:!0},selectedCategory(t){this.activeSearchTerm="",this.searchTermInput="",Ye(()=>this.resetScroll())},"$store.state.personalities":{handler(t){this.syncLocalMountedFlags()},deep:!0,immediate:!1}},methods:{async fetchCategories(){try{const t=await this.api_get_req("list_personalities_categories");this.persCatgArr=t?t.sort():[]}catch(t){console.error("Error fetching categories:",t)}},async fetchInitialData(){this.isLoading=!0;try{await this.fetchCategories(),this.syncLocalMountedFlags()}catch(t){console.error("Error fetching initial data:",t),this.show_toast(`Error loading data: ${t.message}`,4,!1)}finally{this.isLoading=!1,Ye(()=>{Re.replace(),this.resetScroll()})}},handleCategoryChange(){Ye(()=>this.resetScroll())},applySearch(){this.activeSearchTerm=this.searchTermInput,Ye(()=>this.resetScroll())},clearSearch(){this.searchTermInput="",this.activeSearchTerm="",Ye(()=>this.resetScroll())},toggleStar(t){this.$store.dispatch("toggleStarPersonality",t.personality)},resetScroll(){const t=this.$refs.gridContainer;t&&(t.scrollTop=0)},syncLocalMountedFlags(){var e;const t=new Set(((e=this.$store.state.config)==null?void 0:e.personalities)||[]);this.allStorePersonalities.forEach(n=>{const r=n.full_path,i=Array.isArray(n.languages)?n.languages.map(o=>`${r}:${o}`):[],s=t.has(r)||i.some(o=>t.has(o));n.isMounted!==s&&this.$store.commit("updatePersonality",{...n,isMounted:s})})},personalityImgPlaceholder(t){t.target.src=this.defaultPersonalityIcon_},getPersonalityIconUrl(t){if(!t)return this.defaultPersonalityIcon_;const e=t.startsWith("/")?t.substring(1):t,n=this.bUrl.endsWith("/")||e.startsWith("/")?"":"/";let r=e==="/"?"":e;return`${this.bUrl}${n}${r}`},isActivePersonality(t){const e=this.$store.state.config;if(!e||e.active_personality_id<0||!e.personalities)return!1;const n=e.personalities[e.active_personality_id],r=n?n.split(":")[0]:null;return t.full_path===r},setPersonalityProcessing(t,e){const n=t.personality.id||t.personality.full_path,r=this.allStorePersonalities.find(i=>(i.id||i.full_path)===n);r?this.$store.commit("updatePersonality",{...r,isProcessing:e}):console.warn("Cannot find personality in store to set processing state:",n)},getCategoryCount(t){return this.allStorePersonalities.filter(e=>e.category===t).length},getStarredCount(){const t=new Set(this.starredPersonalitiesPaths);return this.allStorePersonalities.filter(e=>t.has(e.full_path)).length},getResultLabel(){return this.selectedCategory==="Mounted"?"Mounted Personalities":this.selectedCategory==="Starred"?"Starred Personalities":this.selectedCategory?`Personalities in "${this.selectedCategory}"`:"All Personalities"},getResultMessageQualifier(){return this.selectedCategory==="Mounted"?" in Mounted":this.selectedCategory==="Starred"?" in Starred":this.selectedCategory?` in category "${this.selectedCategory}"`:""},async onPersonalitySelected(t){const e=t.personality;if(this.isLoading||e.isProcessing){this.show_toast("Loading...",4,!1);return}if(!e.isMounted){this.show_toast(`Mount "${e.name}" first.`,3,!1);return}if(this.isActivePersonality(e)){this.show_toast(`"${e.name}" is already active.`,3,!1);return}this.setPersonalityProcessing(t,!0),this.show_toast(`Selecting ${e.name}...`,2,!0);const n=await this.select_personality(e);n&&n.status?(this.show_toast(`Selected personality: ${e.name}`,4,!0),await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshMountedPersonalities")):this.show_toast(`Failed to select ${e.name}: ${(n==null?void 0:n.error)||"Unknown error"}`,4,!1),this.setPersonalityProcessing(t,!1)},async select_personality(t){var o;if(!t)return{status:!1,error:"no personality provided"};const e=((o=this.$store.state.config)==null?void 0:o.personalities)||[],n=t.language?`${t.full_path}:${t.language}`:null;let r=null;if(n&&e.includes(n)?r=n:e.includes(t.full_path)&&(r=t.full_path),!r)return{status:!1,error:"Personality variant not found in mounted list"};const i=e.findIndex(a=>a===r);if(i===-1)return{status:!1,error:"Internal error finding personality ID"};const s={id:i};try{return await this.api_post_req("select_personality",s)}catch(a){return{status:!1,error:a.message}}},async mountPersonality(t){const e=t.personality;if(e.isMounted||e.isProcessing||e.disclaimer&&e.disclaimer.trim()!==""&&!await this.show_yes_no_dialog(`Disclaimer for ${e.name}: ${e.disclaimer} Mount this personality?`,"Mount","Cancel"))return;this.setPersonalityProcessing(t,!0),this.show_toast(`Mounting ${e.name}...`,3,!0);const n=await this.mount_personality(e);if(n&&n.status){await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshMountedPersonalities"),this.show_toast(`Personality "${e.name}" mounted`,4,!0);const r=this.$store.state.config;if((r==null?void 0:r.active_personality_id)>-1){const i=e.language?`${e.full_path}:${e.language}`:e.full_path,s=r.personalities[r.active_personality_id];i===s&&this.show_toast(`${e.name} mounted and selected`,4,!0)}}else this.show_toast(`Could not mount personality Error: ${(n==null?void 0:n.error)||"Unknown error"}`,4,!1);this.setPersonalityProcessing(t,!1)},async mount_personality(t){if(!t)return{status:!1,error:"no personality provided"};try{const e={language:t.language||"",category:t.category||"",folder:t.folder||""};return await this.api_post_req("mount_personality",e)}catch(e){return{status:!1,error:e.message}}},async unmountPersonality(t){const e=t.personality;if(!e.isMounted||e.isProcessing||!await this.show_yes_no_dialog(`Unmount personality "${e.name}"?`,"Unmount","Cancel"))return;this.setPersonalityProcessing(t,!0),this.show_toast(`Unmounting ${e.name}...`,3,!0);const r=await this.unmount_personality(e);r&&r.status?(await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshMountedPersonalities"),this.show_toast("Personality unmounted",4,!0)):this.show_toast(`Could not unmount personality -Error: ${(r==null?void 0:r.error)||"Unknown error"}`,4,!1),this.setPersonalityProcessing(t,!1)},async unmount_personality(t){var s;if(!t)return{status:!1,error:"no personality provided"};const e=((s=this.$store.state.config)==null?void 0:s.personalities)||[];let n=null;const r=t.language?`${t.full_path}:${t.language}`:null;r&&e.includes(r)?n=r:(e.includes(t.full_path),n=t.full_path);const i={path:n};try{return await this.api_post_req("unmount_personality",i)}catch(o){return{status:!1,error:o.message}}},async unmountAll(){if(!await this.show_yes_no_dialog(`Unmount all ${this.mountedPersArr.length} personalities?`,"Unmount All","Cancel"))return;this.show_toast("Unmounting all...",3,!0),this.isLoading=!0;const e=await this.api_post_req("unmount_all_personalities");e&&e.status?(await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshMountedPersonalities"),this.show_toast("All personalities unmounted.",4,!0)):this.show_toast(`Failed to unmount all: ${(e==null?void 0:e.error)||"Unknown error"}`,4,!1),this.isLoading=!1},async remountPersonality(t){const e=t.personality;if(!(!e.isMounted||e.isProcessing)){this.setPersonalityProcessing(t,!0),this.show_toast(`Remounting ${e.name}...`,3,!0);try{const n=await this.unmount_personality(e);if(!n||!n.status)throw new Error(`Unmount failed: ${(n==null?void 0:n.error)||"Unknown error"}`);await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshMountedPersonalities"),await new Promise(i=>setTimeout(i,200));const r=await this.mount_personality(e);if(!r||!r.status)throw new Error(`Mount failed: ${(r==null?void 0:r.error)||"Unknown error"}`);await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshMountedPersonalities"),this.show_toast(`${e.name} remounted successfully.`,4,!0)}catch(n){this.show_toast(`Error remounting ${e.name}: ${n.message}`,4,!1),await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshMountedPersonalities")}finally{this.setPersonalityProcessing(t,!1)}}},async editPersonality(t){var n;const e=t.personality;if(!e.isProcessing){this.setPersonalityProcessing(t,!0);try{const r=await this.api_post_req("get_personality_config",{category:e.category,name:e.folder});r.status&&r.config?(this.$store.commit("setCurrentPersonConfig",r.config),this.$store.commit("setShowPersonalityEditor",!0),this.$store.commit("setSelectedPersonality",e),(n=this.$store.state.personality_editor)!=null&&n.showPanel&&this.$store.state.personality_editor.showPanel()):this.show_toast(`Failed to load config for ${e.name}: ${r.error||"Not found/error"}`,4,!1)}catch(r){this.show_toast(`Error loading config for ${e.name}: ${r.message}`,4,!1)}finally{this.setPersonalityProcessing(t,!1)}}},async onCopyToCustom(t){const e=t.personality;if(e.isProcessing||!await this.show_yes_no_dialog(`Copy "${e.name}" to 'custom_personalities'?`,"Copy","Cancel"))return;this.setPersonalityProcessing(t,!0);const r=await this.api_post_req("copy_to_custom_personas",{category:e.category,name:e.folder});r&&r.status?(this.show_message_box(`"${e.name}" copied. Refreshing list...`),await new Promise(i=>setTimeout(i,500)),await this.$store.dispatch("refreshPersonalitiesZoo"),await this.$store.dispatch("refreshMountedPersonalities")):this.show_toast(`Failed to copy ${e.name}: ${(r==null?void 0:r.error)||"Error"}`,4,!1),this.setPersonalityProcessing(t,!1)},async onPersonalityReinstall(t){const e=t.personality;if(e.isProcessing||!await this.show_yes_no_dialog(`Reinstall "${e.name}"? This overwrites local changes.`,"Reinstall","Cancel"))return;this.setPersonalityProcessing(t,!0),this.show_toast(`Reinstalling ${e.name}...`,3,!0);const r=await this.api_post_req("reinstall_personality",{name:e.full_path});r&&r.status?this.show_toast(`${e.name} reinstalled. Remount if active.`,4,!0):this.show_toast(`Failed to reinstall ${e.name}: ${(r==null?void 0:r.error)||"Error"}`,4,!1),this.setPersonalityProcessing(t,!1)},async onSettingsPersonality(t){const e=t.personality;if(!(!this.isActivePersonality(e)||e.isProcessing)){if(!this.isActivePersonality(e)){this.show_toast(`Activate "${e.name}" first to configure settings.`,4,!1);return}this.setPersonalityProcessing(t,!0);try{const n=await this.api_get_req("/get_active_personality_settings");if(n&&typeof n=="object"&&Object.keys(n).length>0){const r=await this.show_universal_form(n,`Settings - ${e.name}`,"Save","Cancel");if(r!=null){this.setPersonalityProcessing(t,!0);const i=await this.api_post_req("set_active_personality_settings",r);i!=null&&i.status?this.show_toast(`Settings for ${e.name} updated.`,4,!0):this.show_toast(`Failed to update settings: ${(i==null?void 0:i.error)||"Error"}`,4,!1)}}else n&&typeof n=="object"?this.show_toast(`"${e.name}" has no configurable settings.`,3,!0):this.show_toast("Could not retrieve settings structure.",4,!1)}catch(n){this.show_toast(`Error accessing settings: ${n.message}`,4,!1)}finally{this.setPersonalityProcessing(t,!1)}}},onCopyPersonalityName(t){const e=t.personality;navigator.clipboard.writeText(e.name).then(()=>this.show_toast(`Copied name: ${e.name}`,3,!0)).catch(n=>this.show_toast("Failed to copy name.",3,!1))},async handleOpenFolder(t){const e=t.personality,n=await this.api_post_req("open_personality_folder",{category:e.category,name:e.folder});(!n||!n.status)&&this.show_toast(`Could not open folder: ${(n==null?void 0:n.error)||"Error"}`,4,!1)}},async mounted(){var t;await this.fetchInitialData(),this.selectedCategory=((t=this.config)==null?void 0:t.personality_category)||""},updated(){Ye(()=>{Re.replace()})}},yOr={class:"user-settings-panel flex flex-col mb-2 rounded-lg shadow-lg p-4 bg-white dark:bg-gray-800"},bOr={class:"flex flex-row justify-between items-center mb-4 flex-wrap gap-y-2"},SOr={class:"flex items-center flex-wrap"},xOr={key:0,class:"flex items-center mr-2 text-lg text-blue-600 dark:text-blue-300"},EOr=["title"],wOr={class:"flex items-center space-x-3 shrink-0"},COr={key:0,class:"text-base font-semibold cursor-default select-none items-center flex flex-row"},LOr={class:"flex -space-x-4 items-center"},AOr={class:"group/mounted items-center flex flex-row"},$Or=["onClick","title"],kOr=["src"],POr=["onClick"],ROr=["title"],MOr={class:"flex flex-col sm:flex-row gap-4 mb-4"},DOr={class:"flex-grow"},NOr={class:"relative"},IOr={class:"absolute right-1.5 bottom-1.5 flex space-x-1"},HOr={class:"flex-shrink-0 sm:w-64"},VOr={value:""},qOr={value:"Mounted"},UOr={key:0,value:"Starred"},BOr={key:1,disabled:"",class:"text-blue-400 dark:text-blue-600"},zOr=["value"],XOr={key:0,class:"flex justify-center items-center p-10 text-loading text-blue-600 dark:text-blue-300"},FOr={key:1,class:"text-center text-blue-500 dark:text-blue-400 py-10"},jOr={key:2,class:"overflow-y-auto flex-grow personalities-grid-container scrollbar",style:{"max-height":"calc(100vh - 300px)"},ref:"gridContainer"},YOr={class:"label block ml-2 mb-2 text-blue-700 dark:text-blue-300"};function GOr(t,e,n,r,i,s){const o=Xe("PersonalityEntry");return k(),D("div",yOr,[b("div",bOr,[b("div",SOr,[e[9]||(e[9]=b("p",{class:"text-xl font-semibold cursor-default select-none mr-3 text-blue-800 dark:text-blue-100"}," Personalities Zoo ",-1)),s.active_personality_name?(k(),D("div",xOr,[e[8]||(e[8]=b("span",{class:"mx-2 text-blue-400 dark:text-blue-500"},"|",-1)),b("span",{class:"font-bold line-clamp-1",title:`Active: ${s.active_personality_name}`},le(s.active_personality_name),9,EOr)])):ne("",!0)]),b("div",wOr,[s.mountedPersArr.length>0?(k(),D("div",COr,[b("div",LOr,[(k(!0),D(He,null,dt(s.displayedMountedPersonalities,(a,l)=>(k(),D("div",{class:"relative hover:-translate-y-1 duration-300 hover:z-10 shrink-0",key:a.id||a.full_path+"-"+l,ref_for:!0,ref:"mountedPersonalitiesRefs"},[b("div",AOr,[b("button",{onClick:oe(c=>s.onPersonalitySelected({personality:a,isMounted:!0}),["stop"]),title:`Select: ${a.name}`,class:"transition-transform duration-150 ease-in-out active:scale-90"},[b("img",{src:s.getPersonalityIconUrl(a.avatar),onError:e[0]||(e[0]=(...c)=>s.personalityImgPlaceholder&&s.personalityImgPlaceholder(...c)),class:be(["w-8 h-8 rounded-full object-cover border-2 transition-colors duration-200 group-hover/mounted:border-blue-500 dark:group-hover/mounted:border-blue-400",s.isActivePersonality(a)?"border-blue-500 dark:border-blue-400":"border-blue-300 dark:border-blue-600"])},null,42,kOr)],8,$Or),b("button",{onClick:oe(c=>s.unmountPersonality({personality:a}),["stop"]),class:"absolute -top-1 -right-1 opacity-0 group-hover/mounted:opacity-100 transition-all duration-150 ease-in-out hover:scale-110",title:"Unmount personality"},e[10]||(e[10]=[b("span",{class:"bg-red-500 hover:bg-red-600 text-white rounded-full p-0.5 flex items-center justify-center shadow-md transition-colors duration-150"},[b("i",{"data-feather":"x",class:"w-3 h-3 stroke-current"})],-1)]),8,POr)])]))),128)),s.mountedPersArr.length>i.maxDisplayedMounted?(k(),D("div",{key:0,class:"w-8 h-8 rounded-full bg-blue-200 dark:bg-blue-700 border-2 border-blue-300 dark:border-blue-600 flex items-center justify-center text-xs font-semibold text-blue-600 dark:text-blue-300 cursor-default",title:`${s.mountedPersArr.length-i.maxDisplayedMounted} more mounted`}," +"+le(s.mountedPersArr.length-i.maxDisplayedMounted),9,ROr)):ne("",!0)])])):ne("",!0),s.mountedPersArr.length>0?(k(),D("button",{key:1,onClick:e[1]||(e[1]=oe(a=>s.unmountAll(),["stop"])),class:"p-1 bg-red-100 hover:bg-red-200 dark:bg-red-900 dark:hover:bg-red-800 rounded-full border border-red-300 dark:border-red-700 active:scale-90 transition-all duration-150",title:"Unmount All Personalities"},e[11]||(e[11]=[b("i",{"data-feather":"x-octagon",class:"w-4 h-4 text-red-600 dark:text-red-400 stroke-current"},null,-1)]))):ne("",!0)])]),b("div",MOr,[b("div",DOr,[e[13]||(e[13]=b("label",{for:"personality-search",class:"sr-only"},"Search",-1)),b("div",NOr,[e[12]||(e[12]=b("div",{class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},[b("i",{"data-feather":"search",class:"w-5 h-5 text-blue-400 dark:text-blue-500"})],-1)),Ve(b("input",{type:"search",id:"personality-search",class:"input search-input block w-full p-3 pl-10 text-sm text-blue-900 dark:text-blue-100 placeholder-blue-500 dark:placeholder-blue-400 pr-24",placeholder:"Search name, author, description...","onUpdate:modelValue":e[2]||(e[2]=a=>i.searchTermInput=a),onKeyup:e[3]||(e[3]=Dr((...a)=>s.applySearch&&s.applySearch(...a),["enter"]))},null,544),[[yt,i.searchTermInput]]),b("div",IOr,[i.searchTermInput?(k(),D("button",{key:0,onClick:e[4]||(e[4]=oe((...a)=>s.clearSearch&&s.clearSearch(...a),["stop"])),type:"button",class:"btn btn-secondary btn-sm text-xs px-3 py-1.5"}," Clear ")):ne("",!0),b("button",{onClick:e[5]||(e[5]=oe((...a)=>s.applySearch&&s.applySearch(...a),["stop"])),type:"button",class:"btn btn-primary btn-sm text-xs px-3 py-1.5"}," Search ")])])]),b("div",HOr,[e[14]||(e[14]=b("label",{for:"persCat",class:"sr-only"},"Category",-1)),Ve(b("select",{id:"persCat","onUpdate:modelValue":e[6]||(e[6]=a=>i.selectedCategory=a),onChange:e[7]||(e[7]=(...a)=>s.handleCategoryChange&&s.handleCategoryChange(...a)),class:"input block w-full p-3 text-sm text-blue-900 dark:text-blue-100"},[b("option",VOr,"All Categories ("+le(i.allPersonalities.length)+")",1),b("option",qOr,"⬆️ Mounted ("+le(s.mountedPersArr.length)+")",1),s.starredPersonalitiesPaths.length>0?(k(),D("option",UOr,"⭐ Starred ("+le(s.getStarredCount())+")",1)):ne("",!0),(s.starredPersonalitiesPaths.length>0||s.mountedPersArr.length>0)&&i.persCatgArr.length>0?(k(),D("option",BOr,"──────────")):ne("",!0),(k(!0),D(He,null,dt(i.persCatgArr,(a,l)=>(k(),D("option",{key:l,value:a},le(a)+" ("+le(s.getCategoryCount(a))+") ",9,zOr))),128))],544),[[As,i.selectedCategory]])])]),i.isLoading&&i.allPersonalities.length===0?(k(),D("div",XOr,e[15]||(e[15]=[b("svg",{"aria-hidden":"true",class:"w-8 h-8 mr-2 text-blue-400 animate-spin dark:text-blue-500 fill-blue-600 dark:fill-blue-300",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[b("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"}),Se(),b("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),b("span",null,"Loading personalities...",-1)]))):!i.isLoading&&s.filteredPersonalities.length===0?(k(),D("div",FOr," No personalities found"+le(i.activeSearchTerm?' matching "'+i.activeSearchTerm+'"':"")+le(s.getResultMessageQualifier())+". ",1)):(k(),D("div",jOr,[b("label",YOr,le(s.getResultLabel())+": ("+le(s.filteredPersonalities.length)+") ",1),(k(),D("div",{key:i.selectedCategory+"-"+i.activeSearchTerm,class:"p-2 pb-0 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 bg-blue-100/50 dark:bg-blue-800/30 rounded-md"},[te(I4,{name:"list"},{default:Ie(()=>[(k(!0),D(He,null,dt(s.filteredPersonalities,a=>(k(),Qt(o,{key:a.id||a.full_path,personality:a,select_language:!0,full_path:a.full_path,"is-mounted":a.isMounted,"is-active":s.isActivePersonality(a),"is-processing":a.isProcessing,"is-starred":a.isStarred,"base-url":i.bUrl,onSelect:s.onPersonalitySelected,onMount:s.mountPersonality,onUnmount:s.unmountPersonality,onRemount:s.remountPersonality,onEdit:s.editPersonality,onToggleStar:s.toggleStar,onCopyToCustom:s.onCopyToCustom,onReinstall:s.onPersonalityReinstall,onSettings:s.onSettingsPersonality,onCopyPersonalityName:s.onCopyPersonalityName,onOpenFolder:s.handleOpenFolder,onError:s.personalityImgPlaceholder},null,8,["personality","full_path","is-mounted","is-active","is-processing","is-starred","base-url","onSelect","onMount","onUnmount","onRemount","onEdit","onToggleStar","onCopyToCustom","onReinstall","onSettings","onCopyPersonalityName","onOpenFolder","onError"]))),128))]),_:1})]))],512))])}const WOr=at(vOr,[["render",GOr],["__scopeId","data-v-57acb6cf"]]),ZOr="/assets/functioncall-Cm2fTSgb.png",KOr="/",JOr={props:{function_call:{},select_language:Boolean,full_path:String,onOpenFolder:Function,onMount:Function,onUnMount:Function,onRemount:Function,onCopyToCustom:Function,onEdit:Function,onShowSettings:Function,onCopyfunction_callName:Function,onToggleFavorite:Function},components:{InteractiveMenu:YC},data(){return{mounted:!1,name:this.function_call.name,thumbnailVisible:!1,thumbnailPosition:{x:0,y:0},showHelpPopup:!1,renderedHelp:""}},computed:{commandsList(){let t=[{name:this.mounted?"unmount":"mount",icon:"feather:settings",is_file:!1,value:this.mounted?this.unmount:this.mount}];return console.log("this.category",this.function_call.category),this.function_call.category=="custom_personalities"?t.push({name:"edit",icon:"feather:settings",is_file:!1,value:this.edit}):t.push({name:"Copy to custom personas folder for editing",icon:"feather:copy",is_file:!1,value:this.copyToCustom}),this.mounted&&t.push({name:"remount",icon:"feather:refresh-ccw",is_file:!1,value:this.reMount}),t}},mounted(){this.mounted=this.function_call.mounted,console.log(this.function_call),Ye(()=>{Re.replace()})},methods:{show_settings(){this.onShowSettings(this)},formatDate(t){const e={year:"numeric",month:"short",day:"numeric"};return new Date(t).toLocaleDateString(void 0,e)},showThumbnail(){this.thumbnailVisible=!0},hideThumbnail(){this.thumbnailVisible=!1},updateThumbnailPosition(t){this.thumbnailPosition={x:t.clientX+10,y:t.clientY+10}},getImgUrl(){return KOr+this.function_call.avatar},defaultImg(t){t.target.src=ZOr},toggleFavorite(){this.onToggleFavorite(this)},showFolder(){this.onOpenFolder(this)},toggleCopyLink(){this.onCopyfunction_callName(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.mounted=!1},showHelp(){this.renderedHelp=Kt(this.function_call.help),this.showHelpPopup=!0},closeHelp(){this.showHelpPopup=!1}},watch:{}},emr=["title"],tmr={class:"flex-grow"},nmr={class:"flex items-center mb-4"},rmr=["src"],imr={class:"font-bold text-xl text-gray-800 cursor-pointer"},smr={class:"text-sm text-gray-600"},omr={class:"text-sm text-gray-600"},amr={class:"text-sm text-gray-600"},lmr={key:0,class:"text-sm text-gray-600"},cmr={key:1,class:"text-sm text-gray-600"},umr={class:"mb-4"},dmr=["innerHTML"],fmr={class:"mt-auto pt-4 border-t"},hmr={class:"flex justify-between items-center flex-wrap"},pmr=["title"],Tmr=["fill"],Omr=["src"],mmr={key:1,class:"fixed inset-0 bg-black bg-opacity-50 flex justify-center items-center"},gmr={class:"bg-white p-4 rounded-lg shadow-lg w-[500px] h-[400px] flex flex-col"},Qmr={class:"flex justify-between items-center mb-2"},_mr={class:"flex-grow overflow-auto"},vmr=["innerHTML"];function ymr(t,e,n,r,i,s){const o=Xe("InteractiveMenu");return k(),D("div",{class:be(["app-card flex flex-col h-full",i.mounted?"border-primary-light":"border-transparent"]),title:n.function_call.installed?"":"Not installed"},[b("div",tmr,[b("div",nmr,[b("img",{src:s.getImgUrl(),onError:e[0]||(e[0]=a=>s.defaultImg(a)),alt:"function_call Icon",class:"w-16 h-16 rounded-full border border-gray-300 mr-4 cursor-pointer",onMouseover:e[1]||(e[1]=(...a)=>s.showThumbnail&&s.showThumbnail(...a)),onMousemove:e[2]||(e[2]=(...a)=>s.updateThumbnailPosition&&s.updateThumbnailPosition(...a)),onMouseleave:e[3]||(e[3]=(...a)=>s.hideThumbnail&&s.hideThumbnail(...a))},null,40,rmr),b("div",null,[b("h3",imr,le(n.function_call.name),1),b("p",smr,"Author: "+le(n.function_call.author),1),b("p",omr,"Version: "+le(n.function_call.version),1),b("p",amr,"Category: "+le(n.function_call.category),1),n.function_call.creation_date?(k(),D("p",lmr,"Creation Date: "+le(s.formatDate(n.function_call.creation_date)),1)):ne("",!0),n.function_call.last_update_date?(k(),D("p",cmr,"Last update Date: "+le(s.formatDate(n.function_call.last_update_date)),1)):ne("",!0)]),n.function_call.help?(k(),D("button",{key:0,onClick:e[4]||(e[4]=(...a)=>s.showHelp&&s.showHelp(...a)),class:"ml-2 text-blue-500 hover:text-blue-600 transition duration-300 ease-in-out",title:"Help"},e[9]||(e[9]=[b("i",{"data-feather":"help-circle",class:"h-6 w-6"},null,-1)]))):ne("",!0)]),b("div",umr,[e[10]||(e[10]=b("h4",{class:"font-semibold mb-1 text-gray-700"},"Description:",-1)),b("p",{class:"text-sm text-gray-600 h-20 overflow-y-auto",innerHTML:n.function_call.description},null,8,dmr)])]),b("div",fmr,[b("div",hmr,[b("button",{onClick:e[5]||(e[5]=(...a)=>s.toggleFavorite&&s.toggleFavorite(...a)),class:"text-yellow-500 hover:text-yellow-600 transition duration-300 ease-in-out",title:t.isFavorite?"Remove from favorites":"Add to favorites"},[(k(),D("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-6 w-6",fill:t.isFavorite?"currentColor":"none",viewBox:"0 0 24 24",stroke:"currentColor"},e[11]||(e[11]=[b("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"},null,-1)]),8,Tmr))],8,pmr),b("button",{onClick:e[6]||(e[6]=(...a)=>s.showFolder&&s.showFolder(...a)),class:"text-purple-500 hover:text-purple-600 transition duration-300 ease-in-out",title:"Show Folder"},e[12]||(e[12]=[b("i",{"data-feather":"folder",class:"h-6 w-6"},null,-1)])),i.mounted?(k(),D("button",{key:0,onClick:e[7]||(e[7]=(...a)=>s.show_settings&&s.show_settings(...a)),class:"text-green-500 hover:text-green-600 transition duration-300 ease-in-out",title:"Settings"},e[13]||(e[13]=[b("i",{"data-feather":"settings",class:"h-6 w-6"},null,-1)]))):ne("",!0),te(o,{commands:s.commandsList,force_position:2,title:"Menu",class:"text-gray-500 hover:text-gray-600 transition duration-300 ease-in-out"},null,8,["commands"])])]),i.thumbnailVisible?(k(),D("div",{key:0,style:qn({top:i.thumbnailPosition.y+"px",left:i.thumbnailPosition.x+"px"}),class:"fixed z-50 w-20 h-20 rounded-full overflow-hidden"},[b("img",{src:s.getImgUrl(),class:"w-full h-full object-fill"},null,8,Omr)],4)):ne("",!0),i.showHelpPopup?(k(),D("div",mmr,[b("div",gmr,[b("div",Qmr,[e[14]||(e[14]=b("h2",{class:"text-lg font-bold"},"Help",-1)),b("button",{onClick:e[8]||(e[8]=(...a)=>s.closeHelp&&s.closeHelp(...a)),class:"text-red-500 hover:text-red-600"},"Close")]),b("div",_mr,[b("div",{innerHTML:i.renderedHelp},null,8,vmr)])])])):ne("",!0)],10,emr)}const bmr=at(JOr,[["render",ymr]]),Smr="/assets/default_function-CyfcuNmo.png";function xmr(t,e){let n;return function(...i){const s=()=>{clearTimeout(n),t.apply(this,i)};clearTimeout(n),n=setTimeout(s,e)}}const Emr={name:"FunctionCallsZoo",components:{FunctionEntry:bmr},props:{config:{type:Object,required:!0},api_post_req:{type:Function,required:!0},api_get_req:{type:Function,required:!0},show_toast:{type:Function,required:!0},show_yes_no_dialog:{type:Function,required:!0},show_universal_form:{type:Function,required:!0},show_message_box:{type:Function,required:!0},client_id:{type:String,required:!0}},emits:["update:setting"],data(){return{allFunctions:[],categoriesFunc:[],filteredFunctions:[],pagedFunctions:[],isLoadingFunctions:!1,isSearchingFunc:!1,searchTermFunc:"",selectedCategoryFunc:"",sortOptionFunc:"mounted",itemsPerPageFunc:15,currentPageFunc:1,maxDisplayedMountedFunc:7,functionEntryRefs:{},observerFunc:null,defaultIcon:Smr,axiosBaseUrl:$e.defaults.baseURL||""}},computed:{mountedFunctionPathsSet(){var t;return new Set(((t=this.config)==null?void 0:t.mounted_functions)||[])},mountedFunctions(){return this.allFunctions.filter(t=>this.mountedFunctionPathsSet.has(t.full_path))},displayedMountedFunctions(){return[...this.mountedFunctions].sort((e,n)=>(e.name||"").localeCompare(n.name||"")).slice(0,this.maxDisplayedMountedFunc)},hasMoreFunctionsToLoad(){return this.pagedFunctions.length