graphdb-workbench
Version:
The web application for GraphDB APIs
3 lines • 26.1 kB
JavaScript
/*! For license information please see 12358.3cd325f3aae07c9162eb.bundle.js.LICENSE.txt */
export const __webpack_id__=12358;export const __webpack_ids__=[3909,12358,42618,43319,62062,78508,81801,87054];export const __webpack_modules__={3909:()=>{function e(){return{restrict:"E",require:"ngModel",scope:{ngModel:"=",ngDisabled:"=",placeholder:"@"},templateUrl:"js/angular/core/templates/editable-content/editable-content.html",link:function(e,t,n,a){const o=t.find("div"),i=()=>{e.ngDisabled||e.$apply(()=>{o.html().length&&!o.text().trim().length&&o.empty(),a.$setViewValue(o[0].innerText)})};a.$render=()=>{o.html(a.$viewValue||"")};const r=e=>{e.preventDefault();const t=(e.originalEvent||e).clipboardData.getData("text/plain"),n=window.getSelection();if(!n.rangeCount)return;n.deleteFromDocument();const a=n.getRangeAt(0),o=document.createDocumentFragment(),i=t.split("\n");i.forEach((e,t)=>{o.appendChild(document.createTextNode(e)),t<i.length-1&&o.appendChild(document.createElement("br"))}),a.insertNode(o),n.collapseToEnd()};e.$on("$destroy",()=>{o.off("blur keyup change input",i),o.off("paste",r)}),o.on("blur keyup change input",i),o.on("paste",r)}}}angular.module("graphdb.framework.core.directives.editable-content",[]).directive("editableContent",e),e.$inject=[]},7928:(e,t,n)=>{n.r(t);var a=n(71920),o=n(76076);function i(e,t){return{restrict:"E",templateUrl:"js/angular/ttyg/templates/no-agents-view.html",scope:{},link:n=>{n.canModifyAgent=!1,n.talkToGraphDocumentationLink=o.DocumentationUrlResolver.getDocumentationUrl(t.productShortVersion,"talk-to-graph.html"),n.onCreateAgent=()=>{e.emit(a.TTYGEventName.OPEN_AGENT_SETTINGS)};const i=[];i.push(e.onCanUpdateAgentUpdated(e=>{n.canModifyAgent=e})),n.$on("$destroy",()=>{i.forEach(e=>e())})}}}angular.module("graphdb.framework.ttyg.directives.no-agents-view",[]).directive("noAgentsView",i),i.$inject=["TTYGContextService","productInfo"]},12358:(e,t,n)=>{n.r(t),n(60039),n(13815),n(29350),n(44874),n(7928),n(62062),n(78508),n(95953),n(36665);var a=n(71920),o=(n(87054),n(70826)),i=n(28319),r=n(19402),s=n(51490),c=n(38940),l=n(11695),d=n(76752),g=n(43319),h=n(27030),m=n(81801),T=n(45458),p=n(36633),u=n(57154);function E(e,t,n,E,v,C,A,f,_,N,y,b,S,G,I){const R=[],w={filter_all:A.instant("ttyg.agent.btn.filter.all")};let O;E.helpTemplateUrl="js/angular/ttyg/templates/chatInfo.html",E.isHelpVisible=!1,E.showChats=!0,E.showAgents=!1,E.chats=void 0,E.loadingChats=!1,E.loadingChat=!1,E.initialized=!1,E.agents=void 0,E.selectedAgent=void 0,E.loadingAgents=!1,E.reloadingAgents=!1,E.connectorID=void 0,E.canModifyAgent=!1,E.agentListFilterModel=[],E.activeRepositoryList=[],E.onopen=E.onclose=()=>angular.noop(),E.startNewChat=()=>{G.getChats().containsNewChats()||G.deselectChat()},E.toggleChatsListSidebar=()=>{E.showChats=!E.showChats},E.toggleAgentsListSidebar=()=>{E.showAgents=!E.showAgents},E.onToggleHelp=()=>{E.isHelpVisible=!E.isHelpVisible},E.onExportSelectedChat=()=>{$(G.getSelectedChat())};const L=()=>{const e=G.getDefaultAgent();return e?Promise.resolve(e):S.getDefaultAgent().then(e=>(G.setDefaultAgent(e),e))};E.onOpenNewAgentSettings=()=>{L().then(e=>{const t=(0,l.repositoryInfoMapper)(_.getActiveRepositoryObject());e.repositoryId=t.id;const n=(0,s.agentFormModelMapper)(new i.AgentModel({}),e,o.AGENT_OPERATION.CREATE);return{templateUrl:"js/angular/ttyg/templates/modal/agent-settings-modal.html",controller:"AgentSettingsModalController",windowClass:"agent-settings-modal",backdrop:"static",resolve:{dialogModel:function(){return new g.AgentSettingsModal(t,E.activeRepositoryList,n,o.AGENT_OPERATION.CREATE)}},size:"lg"}}).then(e=>{f.open(e).result.then(Y)}).catch(e=>{N.error(getError(e,0,o.TTYG_ERROR_MSG_LENGTH))})},E.onOpenAgentSettings=e=>{let t=e;t||(t=G.getSelectedAgent()),L().then(e=>{const n=(0,s.agentFormModelMapper)(t,e,o.AGENT_OPERATION.EDIT),a=(0,l.repositoryInfoMapper)(_.getActiveRepositoryObject());return{templateUrl:"js/angular/ttyg/templates/modal/agent-settings-modal.html",controller:"AgentSettingsModalController",windowClass:"agent-settings-modal",backdrop:"static",resolve:{dialogModel:function(){return new g.AgentSettingsModal(a,E.activeRepositoryList,n,o.AGENT_OPERATION.EDIT)}},size:"lg"}}).then(e=>{f.open(e).result.then(e=>{const t=G.getSelectedAgent();t&&e.id===t.id&&G.selectAgent(e),Y()})}).catch(e=>{N.error(getError(e,0,o.TTYG_ERROR_MSG_LENGTH))})},E.onOpenCloneAgentSettings=e=>{L().then(t=>{const n=(0,s.agentFormModelMapper)(e,t,o.AGENT_OPERATION.CLONE);n.name=`clone-${n.name}`;const a=(0,l.repositoryInfoMapper)(_.getActiveRepositoryObject());return{templateUrl:"js/angular/ttyg/templates/modal/agent-settings-modal.html",controller:"AgentSettingsModalController",windowClass:"agent-settings-modal",backdrop:"static",resolve:{dialogModel:function(){return new g.AgentSettingsModal(a,E.activeRepositoryList,n,o.AGENT_OPERATION.CLONE)}},size:"lg"}}).then(e=>{f.open(e).result.then(e=>{const t=G.getSelectedAgent();t&&e.id===t.id&&G.selectAgent(e),Y()})}).catch(e=>{N.error(getError(e,0,o.TTYG_ERROR_MSG_LENGTH))})};const M=()=>(E.loadingChats=!0,S.getConversations().then(e=>G.updateChats(e)).catch(e=>{N.error(getError(e,0,o.TTYG_ERROR_MSG_LENGTH)),U(new r.ChatsListModel)}).finally(()=>{E.loadingChats=!1})),Y=()=>(E.reloadingAgents=!0,S.getAgents().then(e=>G.updateAgents(e)).catch(e=>{N.error(getError(e,0,o.TTYG_ERROR_MSG_LENGTH))}).finally(()=>{E.reloadingAgents=!1})),D=()=>{G.setCanModifyAgent(e.isRepoManager())},k=(e,t,n)=>{if(e.timestamp=n.timestamp,t.answers=t.answers||[],t.answers.push(...n.messages),G.updateSelectedChat(e),n.continueRunId)G.emit(a.TTYGEventName.CONTINUE_CHAT_RUN,new T.ContinueChatRun(t,n.continueRunId));else{const t=G.getChats();t.updateChatTimestamp(e.id,n.timestamp),t.updateChatName(e.id,n.chatName),e.name=n.name,G.updateChats(t),G.emit(a.TTYGEventName.LAST_MESSAGE_RECEIVED,e)}},U=e=>{e.isEmpty()?E.showChats=!1:(E.showChats=!0,G.getSelectedChat()||I.getChatId()||G.selectChat(E.chats.getFirstChat()))},$=e=>{S.exportConversation(e.id).then(function({data:t,filename:n}){(0,d.saveAs)(t,n),G.emit(a.TTYGEventName.CHAT_EXPORT_SUCCESSFUL,e)}).catch(()=>{G.emit(a.TTYGEventName.CHAT_EXPORT_FAILURE),N.error(A.instant("ttyg.chat.messages.export_failure"))})},F=()=>{const e=_.getActiveRepository(),t=_.getLocalReadableGraphdbRepositories().map(t=>new i.AgentListFilterModel(t.id,t.id,t.id===e));E.agentListFilterModel=[new i.AgentListFilterModel(o.AGENTS_FILTER_ALL_KEY,w.filter_all),...t]},H=(e,t,n)=>{if(e!==_.getActiveRepository()){const a=_.getRepository(e);a&&y.openConfirmationModal({title:A.instant("common.confirm"),message:(0,h.Gz)(A.instant(t,{repositoryId:a.id})),confirmButtonKey:"ttyg.chat_panel.btn.proceed.label"},()=>{_.setRepository(a),x(n)})}else x(n)},x=e=>{t.open(e,"_blank")},P=e=>{t.open(`/sparql?query=${encodeURIComponent(e)}&execute=true`,"_blank")},j=()=>{const e=I.getChatId(),t=G.getChats();e&&t?.getChat(e)&&G.selectChat(G.getChats().getChat(e))};R.push(E.$watch(E.getActiveRepositoryObject,e=>{const t=(0,u.service)(u.AuthenticationService);e&&!t.hasGqlRights(e)&&(E.activeRepositoryList=_.getLocalReadableGraphdbRepositories().map(e=>new c.SelectMenuOptionsModel({value:e.id,label:e.id,data:{repository:e}})),((e=!0)=>(E.loadingAgents=e,S.getAgents().then(e=>G.updateAgents(e)).catch(e=>{N.error(getError(e,0,o.TTYG_ERROR_MSG_LENGTH))}).finally(()=>{E.loadingAgents=!1})))().then(()=>(E.initialized=!0,F(),M())).then(j),D())}),G.onSelectedChatChanged(e=>{O=void 0,e&&!e.isNew()?S.getConversation(e.id).then(t=>{G.updateSelectedChat(t),I.saveChat(e)}).catch(t=>{t.status===m.status.NOT_FOUND&&((e=>{y.openModalAlert({title:A.instant("ttyg.chat.dialog.chat_is_missing.title"),message:A.instant("ttyg.chat.dialog.chat_is_missing.body")}).result.then(function(){G.deleteChat(e)})})(e),G.emit(a.TTYGEventName.LOAD_CHAT_FAILURE,e))}):e&&G.updateSelectedChat(e)}),G.onChatsListChanged(e=>{E.chats=e,U(e)}),G.onCanUpdateAgentUpdated(e=>{E.canModifyAgent=e}),G.subscribe(G.onAgentsListChanged(e=>{E.agents=e})),G.subscribe(a.TTYGEventName.CREATE_CHAT,e=>{S.createChat(e).then(t=>{const n=r.ChatModel.getNewChat();n.name="New chat",n.id=t,G.createChat(n),I.saveChat(n),e.chatId=t,G.emit(a.TTYGEventName.ASK_QUESTION,e)}).catch(e=>{G.emit(a.TTYGEventName.CREATE_CHAT_FAILURE),N.error(getError(e,0,o.TTYG_ERROR_MSG_LENGTH))})}),G.subscribe(a.TTYGEventName.RENAME_CHAT,e=>{S.renameConversation(e).then(()=>{G.emit(a.TTYGEventName.RENAME_CHAT_SUCCESSFUL),G.emit(a.TTYGEventName.LOAD_CHATS)}).catch(()=>{G.emit(a.TTYGEventName.RENAME_CHAT_FAILURE),N.error(A.instant("ttyg.chat.messages.rename_failure"))})}),G.subscribe(a.TTYGEventName.DELETE_CHAT,e=>{G.emit(a.TTYGEventName.DELETING_CHAT,{chatId:e.id,inProgress:!0}),S.deleteConversation(e.id).then(()=>{G.emit(a.TTYGEventName.DELETE_CHAT_SUCCESSFUL,e);const t=G.getChats();t.deleteChat(e),G.updateChats(t)}).catch(()=>{G.emit(a.TTYGEventName.DELETE_CHAT_FAILURE),N.error(A.instant("ttyg.chat.messages.delete_failure"))}).finally(()=>G.emit(a.TTYGEventName.DELETING_CHAT,{chatId:e.id,inProgress:!1}))}),G.subscribe(a.TTYGEventName.CANCEL_PENDING_QUESTION,e=>{const t=e.chatId||G.getSelectedChat().id;O=S.cancelPendingQuestion(t).then(e=>(G.emit(a.TTYGEventName.PENDING_QUESTION_CANCELED_SUCCESSFUL),e)).catch(e=>(G.emit(a.TTYGEventName.CANCEL_PENDING_QUESTION_FAILURE),e))}),G.subscribe(a.TTYGEventName.CHAT_EXPORT,$),G.subscribe(a.TTYGEventName.ASK_QUESTION,e=>{G.emit(a.TTYGEventName.ASK_QUESTION_STARTING),O=void 0,S.askQuestion(e).then(t=>{const n=G.getSelectedChat();if(n&&n.id===e.chatId){if(n.isNew()){n.new=!1;const e=G.getChats();e.setChatAsOld(n.id),G.updateChats(e)}((e,t,n)=>{O?O.then(a=>{const o=G.getSelectedChat();o&&o.id!==t.chatId||(new p.ChatMessageModel({message:a.data.message,status:a.data.runStatus,isTerminalState:!0,tokenUsageInfo:n.tokenUsageInfo}).addToChatAnswer(n),e.chatHistory.appendItem(t),k(e,t,n))}):(e.chatHistory.appendItem(t),k(e,t,n))})(n,e,t)}}).catch(e=>{G.emit(a.TTYGEventName.ASK_QUESTION_FAILURE),N.error(getError(e,0,o.TTYG_ERROR_MSG_LENGTH))})}),G.subscribe(a.TTYGEventName.CONTINUE_CHAT_RUN,e=>{S.continueChatRun(e).then(t=>{const n=e.chatId,a=G.getSelectedChat();if(a&&a.id===n){const e=a.chatHistory.items,n=e[e.length-1];k(a,n,t)}}).catch(e=>{G.emit(a.TTYGEventName.ASK_QUESTION_FAILURE),N.error(getError(e,0,o.TTYG_ERROR_MSG_LENGTH))})}),G.subscribe(a.TTYGEventName.LOAD_CHATS,M),G.subscribe(a.TTYGEventName.OPEN_AGENT_SETTINGS,E.onOpenNewAgentSettings),G.subscribe(a.TTYGEventName.EDIT_AGENT,E.onOpenAgentSettings),G.subscribe(a.TTYGEventName.CLONE_AGENT,E.onOpenCloneAgentSettings),G.subscribe(a.TTYGEventName.DELETE_AGENT,e=>{G.emit(a.TTYGEventName.DELETING_AGENT,{agentId:e.id,inProgress:!0}),S.deleteAgent(e.id).then(()=>Y()).then(()=>{G.emit(a.TTYGEventName.AGENT_DELETED,e),E.selectedAgent&&E.selectedAgent.id===e.id&&(E.selectedAgent=void 0)}).catch(e=>{N.error(getError(e,0,o.TTYG_ERROR_MSG_LENGTH))}).finally(()=>{G.emit(a.TTYGEventName.DELETING_AGENT,{agentId:e.id,inProgress:!1})})}),G.subscribe(a.TTYGEventName.AGENT_SELECTED,e=>{E.selectedAgent=e}),G.subscribe(a.TTYGEventName.GO_TO_CREATE_SIMILARITY_VIEW,e=>{H(e.repositoryId,"ttyg.agent.create_agent_modal.dialog.confirm_repository_change_before_open_similarity.body","similarity/index/create")}),G.subscribe(a.TTYGEventName.GO_TO_AUTOCOMPLETE_INDEX_VIEW,e=>{H(e.repositoryId,"ttyg.agent.create_agent_modal.dialog.confirm_repository_change_before_open_autocomplete_index.body","autocomplete")}),G.subscribe(a.TTYGEventName.GO_TO_CONNECTORS_VIEW,e=>{H(e.repositoryId,"ttyg.agent.create_agent_modal.dialog.confirm_repository_change_before_open_connectors.body","connectors")}),G.subscribe(a.TTYGEventName.GO_TO_SPARQL_EDITOR,e=>{if(e.repositoryId!==_.getActiveRepository()){const t=_.getRepository(e.repositoryId);t&&y.openConfirmation(A.instant("common.confirm"),(0,h.Gz)(A.instant("ttyg.chat_panel.dialog.confirm_repository_change.body",{repositoryId:e.repositoryId})),()=>{_.setRepository(t),P(e.query)})}else P(e.query)}),n.$on("$translateChangeSuccess",()=>{w.filter_all=A.instant("ttyg.agent.btn.filter.all"),F()}),n.$on("securityInit",D)),E.$on("$destroy",function(){R.forEach(e=>e()),G.resetContext()})}angular.module("graphdb.framework.ttyg.controllers.ttyg-view",["toastr","graphdb.framework.utils.localstorageadapter","graphdb.framework.core.services.ttyg-service","graphdb.framework.ttyg.services.ttygcontext","graphdb.framework.ttyg.services.ttygstorage","graphdb.framework.ttyg.directives.chat-list","graphdb.framework.ttyg.directives.chat-panel","graphdb.framework.ttyg.directives.agent-list","graphdb.framework.ttyg.directives.agent-select-menu","graphdb.framework.ttyg.directives.no-agents-view","graphdb.framework.ttyg.directives.show-tooltip-on-overflow","graphdb.framework.ttyg.controllers.agent-settings-modal","graphdb.framework.core.directives.help-info-popover"]).controller("TTYGViewCtrl",E),E.$inject=["$jwtAuth","$window","$rootScope","$scope","$http","$timeout","$translate","$uibModal","$repositories","toastr","ModalService","LocalStorageAdapter","TTYGService","TTYGContextService","TTYGStorageService"]},13815:(e,t,n)=>{n.r(t),n(64118),n(3909);var a=n(71920),o=n(36633),i=n(63415),r=n(98980),s=n(27030);function c(e,t,n){return{restrict:"E",templateUrl:"js/angular/ttyg/templates/chat-panel.html",link:(e,c,l)=>{e.chat=void 0,e.selectedAgent=void 0,e.chatItem=void 0,e.askingChatItem=void 0,e.waitingForLastMessage=!1,e.loadingChat=!0,e.showCancelButton=!1,e.ask=()=>{e.chatItem.question.timestamp=Date.now(),e.askingChatItem=(0,r.cloneDeep)(e.chatItem),e.chatItem.chatId?g(e.chatItem):d(),e.chatItem=T(),u(),p()},e.cancelPendingQuestion=()=>{e.showCancelButton=!1,n.emit(a.TTYGEventName.CANCEL_PENDING_QUESTION,e.chatItem)},e.regenerateQuestion=t=>{const n=T();n.setQuestionMessage(t.getQuestionMessage()),n.question.timestamp=Date.now(),e.askingChatItem=n,g(n),u()},e.onKeypressOnInput=t=>{e.askingChatItem||"Enter"!==t.key||t.shiftKey||t.ctrlKey||e.ask()},e.onAskHowDeliveredAnswer=()=>{const n=T();n.setQuestionMessage(t.instant("ttyg.chat_panel.btn.derive_answer.label")),n.question.timestamp=Date.now(),e.askingChatItem=(0,r.cloneDeep)(n),g(n),u()},e.getAgentName=e=>{const a=n.getAgent(e);return a?a.name:(0,s.Gz)(t.instant("ttyg.chat_panel.deleted_agent"))};const d=()=>{n.emit(a.TTYGEventName.CREATE_CHAT,e.chatItem)},g=e=>{n.emit(a.TTYGEventName.ASK_QUESTION,e)},h=t=>{e.waitingForLastMessage=t,e.showCancelButton=t},m=()=>{e.chatItem=(0,r.cloneDeep)(e.askingChatItem),e.askingChatItem=void 0,h(!1)},T=()=>{const t=new i.ChatItemModel;return t.question=new o.ChatMessageModel({role:o.CHAT_MESSAGE_ROLE.USER}),e.chat&&(t.chatId=e.chat.id),e.selectedAgent&&(t.agentId=e.selectedAgent.id),t},p=()=>{setTimeout(()=>{const e=document.querySelector(".question-input");e&&e.focus()})},u=()=>{setTimeout(()=>{const e=c.find(".chat-details")[0];e&&(e.scrollTop=e.scrollHeight)})},E=()=>{e.chat=void 0,e.loadingChat=!1,e.chatItem=T(),e.askingChatItem=void 0,h(!1),p()},v=[e.$watchCollection("chat.chatHistory.items",u),n.onSelectedChatUpdated(t=>{if(e.chat=t,!e.chat||e.chat.isNew())return;e.loadingChat=!1;const a=e.chatItem.question.message;if(e.chatItem=T(),e.chatItem.question.message=a,e.askingChatItem=void 0,e.chat){const t=e.chat.chatHistory.getLast();t&&t.agentId&&n.selectAgent(n.getAgent(t.agentId))}p()}),n.onLastMessageReceived(()=>{h(!1)}),n.onSelectedAgentChanged(t=>{e.selectedAgent=t,e.selectedAgent&&e.chatItem&&(e.chatItem.agentId=e.selectedAgent.id),p()}),n.onSelectedChatChanged(t=>{t?(e.loadingChat=!t.isNew(),e.chatItem=T(),h(!1),p()):E()}),n.subscribe(a.TTYGEventName.LOAD_CHAT_FAILURE,()=>{e.loadingChat=!1,e.chatItem=T(),p()}),n.subscribe(a.TTYGEventName.ASK_QUESTION_FAILURE,m),n.subscribe(a.TTYGEventName.CREATE_CHAT_FAILURE,m),n.subscribe(a.TTYGEventName.DELETE_CHAT_SUCCESSFUL,t=>{e.chat&&t.id===e.chat.id&&E()}),n.subscribe(a.TTYGEventName.ASK_QUESTION_STARTING,()=>{h(!0)})];e.$on("$destroy",()=>{v.forEach(e=>e())}),e.chatItem=T(),p()}}}angular.module("graphdb.framework.ttyg.directives.chat-panel",["graphdb.framework.ttyg.directives.chat-item-detail","graphdb.framework.core.directives.editable-content"]).directive("chatPanel",c),c.$inject=["toastr","$translate","TTYGContextService"]},29350:(e,t,n)=>{n.r(t);var a=n(27030),o=n(71920);function i(e,t,n,i,r){return{restrict:"E",templateUrl:"js/angular/ttyg/templates/agent-list.html",scope:{agentList:"=",agentListFilterModel:"="},link:(i,s,c)=>{i.selectedAgent=void 0,i.selectedAgentsFilter=void 0,i.deletingAgent=void 0,i.onEditAgent=t=>{e.emit(o.TTYGEventName.EDIT_AGENT,t)},i.onExternalIntegration=e=>{r.open(e)},i.onCloneAgent=t=>{e.emit(o.TTYGEventName.CLONE_AGENT,t)},i.onDeleteAgent=i=>{const r=n.instant("ttyg.agent.delete_agent_modal.title"),s=(0,a.Gz)(n.instant("ttyg.agent.delete_agent_modal.body",{agentName:i.name}));t.openConfirmation(r,s,()=>e.emit(o.TTYGEventName.DELETE_AGENT,i))},i.onAgentsFilterChange=e=>{i.selectedAgentsFilter=e,i.selectedAgentsFilter&&i.agentList.filterByRepository(i.selectedAgentsFilter.key)};const l=()=>{const e=i.agentListFilterModel.find(e=>e.selected);i.selectedAgentsFilter=e||i.agentListFilterModel[0],i.onAgentsFilterChange(i.selectedAgentsFilter)},d=[];d.push(i.$watch("agentListFilterModel",l)),d.push(e.subscribe(o.TTYGEventName.DELETING_AGENT,e=>{i.deletingAgent=e})),d.push(e.onSelectedAgentChanged(e=>{i.selectedAgent=e})),i.$on("$destroy",()=>{d.forEach(e=>e())}),l()}}}n(84430),angular.module("graphdb.framework.ttyg.directives.agent-list",["graphdb.framework.ttyg.services.externalIntegrationModal"]).directive("agentList",i),i.$inject=["TTYGContextService","ModalService","$translate","$uibModal","ExternalIntegrationModalService"]},42618:()=>{function e(e){return{restrict:"E",scope:{fieldName:"@",source:"=",onSave:"&",onCancel:"&",onClick:"&",onDblclick:"&",isEditing:"="},templateUrl:"js/angular/core/directives/inline-editable-text/templates/inline-editable-text.template.html",link:function(t,n){t.editableModel={};const a=[];let o;t.onKeydown=e=>{"Enter"===e.key?(r(),t.editableModel.text!==t.text&&t.onSave({newText:t.editableModel.text,source:t.source})):"Escape"===e.key&&i()},t.onCancelEditing=()=>{i()},t.onSelect=()=>{o?(r(),t.onDblclick({source:t.source})):o=e(function(){t.onClick({source:t.source}),r()},250)};const i=()=>{r(),t.onCancel()},r=()=>{e.cancel(o),o=void 0};a.push(t.$watch("isEditing",a=>{a&&(t.editableModel.text=t.source[t.fieldName],e(()=>{const e=n.find("input")[0];e.focus(),e.select()},0))})),t.$on("$destroy",()=>{a.forEach(e=>e()),r()})}}}angular.module("graphdb.framework.core.directives.inline-editable-text",[]).directive("inlineEditableText",e),e.$inject=["$timeout"]},43319:(e,t,n)=>{n.r(t),n.d(t,{AgentSettingsModal:()=>a});class a{constructor(e,t,n,a){this.activeRepositoryInfo=e,this.activeRepositoryList=t,this.agentFormModel=n,this.operation=a}}},44874:(e,t,n)=>{n.r(t);var a=n(38940),o=n(71920);function i(e,t,n,i,r){return{restrict:"E",templateUrl:"js/angular/ttyg/templates/agent-select-menu.html",scope:{},link:n=>{n.agentOptionsList=[],n.selectedAgent=void 0,n.onAgentSelected=(a,c)=>{if(!c.isCompatible)return a.stopPropagation(),void a.preventDefault();if(s(c),r.saveAgent(c),n.selectedAgent=c,e.selectAgent(c),c.isRepositoryDeleted){const n=t.instant("ttyg.agent.agent_select_menu.configure_agent_modal.title"),a=t.instant("ttyg.agent.agent_select_menu.configure_agent_modal.body");i.openConfirmation(n,a,()=>e.emit(o.TTYGEventName.EDIT_AGENT,c))}};const s=e=>{n.agentOptionsList.forEach(t=>{t.selected=t.data.agent===e})},c=e=>{s(e),n.selectedAgent=e},l=[];l.push(e.onAgentsListChanged(t=>{var o;o=t,n.agentOptionsList=o.agents.map(e=>new a.SelectMenuOptionsModel({value:e.id,label:e.name,data:{agent:e}})),(()=>{let t;const a=r.getAgentId();a&&n.agentOptionsList.forEach(e=>{e.data.agent.id===a&&(t=e.data.agent)}),!t&&n.agentOptionsList[0]&&(t=n.agentOptionsList[0].data.agent),c(t),e.selectAgent(t)})()})),l.push(e.subscribe(o.TTYGEventName.AGENT_DELETED,t=>{n.selectedAgent&&n.selectedAgent.id===t.id&&(n.selectedAgent.isDeleted=!0,e.selectAgent(n.selectedAgent))})),l.push(e.onSelectedAgentChanged(c)),n.$on("$destroy",()=>{l.forEach(e=>e())})}}}angular.module("graphdb.framework.ttyg.directives.agent-select-menu",[]).directive("agentSelectMenu",i),i.$inject=["TTYGContextService","$translate","$sce","ModalService","TTYGStorageService"]},60039:(e,t,n)=>{n.r(t),n(42618);var a=n(71920),o=n(65820),i=n(27030);function r(e,t,n,r){return{restrict:"E",templateUrl:"js/angular/ttyg/templates/chat-list.html",link:s=>{s.selectedChat=void 0,s.renamedChat=void 0,s.deletingChat=void 0,s.onSelectChatForRenaming=e=>{s.renamedChat=e},s.onSelectChat=t=>{if(!s.selectedChat||s.selectedChat.id!==t.id){const n=e.getChats().getNonPersistedChat();n&&e.deleteChat(n),e.selectChat(t),s.renamedChat=void 0}},s.onDeleteChat=o=>{const r=n.instant("ttyg.dialog.delete.title"),s=(0,i.Gz)(n.instant("ttyg.dialog.delete.body",{chatName:o.name}));t.openConfirmation(r,s,()=>e.emit(a.TTYGEventName.DELETE_CHAT,o))},s.onRenameChat=(t,n)=>{n.name=t,s.renamedChat=void 0,e.emit(a.TTYGEventName.RENAME_CHAT,n)},s.onExportChat=t=>{e.emit(a.TTYGEventName.CHAT_EXPORT,t)},s.onCancelChatRenaming=()=>{s.renamedChat=void 0},s.getHumanReadableChatGroupTimestamp=e=>(0,o.getHumanReadableTimestamp)(n,r,e);const c=e=>{s.selectedChat=e},l=[];l.push(e.onSelectedChatChanged(c)),l.push(e.onSelectedChatUpdated(c)),l.push(e.onChatsListChanged(e=>{s.chatList=e})),l.push(e.subscribe(a.TTYGEventName.DELETING_CHAT,e=>{s.deletingChat=e})),s.$on("$destroy",()=>{l.forEach(e=>e())})}}}angular.module("graphdb.framework.ttyg.directives.chat-list",["graphdb.framework.core.directives.inline-editable-text"]).directive("chatList",r),r.$inject=["TTYGContextService","ModalService","$translate","$filter"]},62062:()=>{angular.module("graphdb.framework.ttyg.directives.show-tooltip-on-overflow",[]).directive("showTooltipOnOverflow",function(){return{link:function(e,t){setTimeout(function(){const n=t[0].querySelector(".editable-text-element");n&&(n.scrollWidth>n.clientWidth?t.attr("title",e.chat.name):t.removeAttr("title"))},0)}}})},76752:function(e,t,n){var a,o=o||function(e){if("undefined"==typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var t=e.document,n=function(){return e.URL||e.webkitURL||e},a=t.createElementNS("http://www.w3.org/1999/xhtml","a"),o=e.webkitRequestFileSystem,i=e.requestFileSystem||o||e.mozRequestFileSystem,r=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},s="application/octet-stream",c=0,l=function(t){var a=function(){"string"==typeof t?n().revokeObjectURL(t):t.remove()};e.chrome?a():setTimeout(a,500)},d=function(e,t,n){for(var a=(t=[].concat(t)).length;a--;){var o=e["on"+t[a]];if("function"==typeof o)try{o.call(e,n||e)}catch(e){r(e)}}},g=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e},h=function(t,r){t=g(t);var h,m,T,p=this,u=t.type,E=!1,v=function(){d(p,"writestart progress write writeend".split(" "))},C=function(){!E&&h||(h=n().createObjectURL(t)),m?m.location.href=h:null==e.open(h,"_blank")&&"undefined"!=typeof safari&&(e.location.href=h),p.readyState=p.DONE,v(),l(h)},A=function(e){return function(){if(p.readyState!==p.DONE)return e.apply(this,arguments)}},f={create:!0,exclusive:!1};if(p.readyState=p.INIT,r||(r="download"),a)return h=n().createObjectURL(t),a.href=h,a.download=r,void setTimeout(function(){var e,t;e=a,t=new MouseEvent("click"),e.dispatchEvent(t),v(),l(h),p.readyState=p.DONE});e.chrome&&u&&u!==s&&(T=t.slice||t.webkitSlice,t=T.call(t,0,t.size,s),E=!0),o&&"download"!==r&&(r+=".download"),(u===s||o)&&(m=e),i?(c+=t.size,i(e.TEMPORARY,c,A(function(e){e.root.getDirectory("saved",f,A(function(e){var n=function(){e.getFile(r,f,A(function(e){e.createWriter(A(function(n){n.onwriteend=function(t){m.location.href=e.toURL(),p.readyState=p.DONE,d(p,"writeend",t),l(e)},n.onerror=function(){var e=n.error;e.code!==e.ABORT_ERR&&C()},"writestart progress write abort".split(" ").forEach(function(e){n["on"+e]=p["on"+e]}),n.write(t),p.abort=function(){n.abort(),p.readyState=p.DONE},p.readyState=p.WRITING}),C)}),C)};e.getFile(r,{create:!1},A(function(e){e.remove(),n()}),A(function(e){e.code===e.NOT_FOUND_ERR?n():C()}))}),C)}),C)):C()},m=h.prototype;return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t){return navigator.msSaveOrOpenBlob(g(e),t)}:(m.abort=function(){var e=this;e.readyState=e.DONE,d(e,"abort")},m.readyState=m.INIT=0,m.WRITING=1,m.DONE=2,m.error=m.onwritestart=m.onprogress=m.onwrite=m.onabort=m.onerror=m.onwriteend=null,function(e,t){return new h(e,t)})}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content);e.exports?e.exports.saveAs=o:null!==n.amdD&&null!=n.amdO&&(void 0===(a=function(){return o}.apply(t,[]))||(e.exports=a))},78508:()=>{angular.module("graphdb.framework.core.directives.help-info-popover",[]).directive("helpInfoPopover",function(){return{restrict:"E",scope:{helpInfo:"="},templateUrl:"js/angular/ttyg/templates/modal/helpInfoPopoverTemplate.html",link:function(e,t){e.isPopoverOpen=!1;const n=()=>{e.$apply(()=>{e.isPopoverOpen=!0})},a=()=>{e.$apply(()=>{e.isPopoverOpen=!1})};t.on("mouseenter",n),t.on("mouseleave",a),e.$on("$destroy",function(){t.off("mouseenter",n),t.off("mouseleave",a)})}}})},81801:(e,t,n)=>{n.r(t),n.d(t,{status:()=>a});const a={BAD_REQUEST:400,UNAUTHORIZED:401,FORBIDDEN:403,NOT_FOUND:404,CONFLICT:409,INTERNAL_SERVER_ERROR:500,SERVICE_UNAVAILABLE:503}},87054:()=>{function e(e,t){const n={agent:{id:void 0},chat:{id:void 0}},a=()=>{let a=e.get(t.TTYG);return a||(a=n),a.agent||(a.agent={}),a.chat||(a.chat={}),a};return{saveAgent:function(n){const o=a();o.agent.id=n?n.id:void 0,e.set(t.TTYG,o)},getAgentId:function(){const e=a();if(e.agent)return e.agent.id},saveChat:function(n){const o=a();o.chat.id=n?n.id:void 0,e.set(t.TTYG,o)},getChatId:function(){const e=a();if(e.chat)return e.chat.id}}}angular.module("graphdb.framework.ttyg.services.ttygstorage",[]).factory("TTYGStorageService",e),e.$inject=["LocalStorageAdapter","LSKeys"]}};
//# sourceMappingURL=12358.3cd325f3aae07c9162eb.bundle.js.map