import{r as o,c as r,h as t}from"./p-BntG-4Sv.js";import{D as a}from"./p-WQYHXM0G.js";import{D as e}from"./p-DghTf3pJ.js";import{L as p,T as n}from"./p-FB05Sh97.js";import{O as i}from"./p-D_J2-9CG.js";import{StartMode as s}from"@ontotext/workbench-api";var l;!function(o){o.DEFAULT="default",o.SELECT="select",o.CREATE="create"}(l||(l={}));const g={[s.NODE]:"assets/images/node-icon_32X21.png",[s.QUERY]:"assets/images/query-icon_32x21.png",[s.SEARCH]:"assets/images/search-icon_32x21.png"},u=class{constructor(e){o(this,e),this.graphExplore=r(this,"graphExplore"),this.logger=p.logger,this.items=[],this.isDropdownOpen=!1,this.handleDefaultClick=()=>{this.emitGraphExplore()},this.handleToggle=o=>{this.dropdownToggledHandler(o)},this.handleValueChanged=o=>{this.emitGraphExplore(l.SELECT,o.detail)},this.handleCreateClick=()=>{this.emitGraphExplore(l.CREATE)}}componentWillLoad(){this.loadGraphConfigItems()}dropdownToggledHandler(o){this.isDropdownOpen=o.detail,this.isDropdownOpen&&this.loadGraphConfigItems()}emitGraphExplore(o=l.DEFAULT,e){this.graphExplore.emit({action:o,graphConfig:e})}loadGraphConfigItems(){"function"==typeof this.fetchGraphConfigs&&this.fetchGraphConfigs().then(o=>{this.items=[...o].sort((o,e)=>o.name.localeCompare(e.name)).map(o=>(new a).setTooltip(o.name).setName(o.name).setIconImage(g[o.startMode]).setValue(o))}).catch(o=>{this.items=[],this.logger.error("Failed to load graph configurations ",o)})}render(){return t("div",{key:"5543384583a43321346bcd132d364a14f173954e",class:"explore-visual-graph-button-group"},t("button",{key:"5a53e979fed2808d9e0dd46d8c7b465d2ecae8c8",class:"explore-visual-graph-button icon-data",onClick:this.handleDefaultClick,"guide-selector":"explore-visual","tooltip-content":n.translate("graph_explore_split_button.buttons.explore_visual_graph.tooltip"),"tooltip-placement":i.TOP},this.label),t("div",{key:"15444dadd120d4a42d149f87c5377d3d084898ce",class:"dropdown-wrapper"},t("onto-dropdown",{key:"9d304a272d1e4aaf7c810b0f8dcf2eb8c8d73071",class:"explore-visual-graph-dropdown",autoClose:!0,items:this.items,onToggle:this.handleToggle,onValueChanged:this.handleValueChanged,dropdownAlignment:e.RIGHT,tooltipPlacement:i.TOP,dropdownButtonTooltip:n.translate("graph_explore_split_button.buttons.explore_visual_graph_dropdown.tooltip")}),this.isDropdownOpen&&0===this.items.length?t("div",{class:"no-configurations-message"},t("i",{class:"icon-info"}),t("div",{class:"message-text"},t("div",null,t("translate-label",{labelKey:"graph_explore_split_button.messages.missing_graph_configuration"})),t("div",null,t("translate-label",{labelKey:"graph_explore_split_button.messages.create_graph_configuration"})," ",t("button",{class:"btn btn-link graph-create-link",onClick:this.handleCreateClick},t("translate-label",{labelKey:"graph_explore_split_button.messages.create_graph_configuration_link"}))))):""))}};u.style=".explore-visual-graph-button-group{display:flex;gap:1px;height:100%}.explore-visual-graph-button-group .explore-visual-graph-button{display:flex;align-items:center;gap:5px;background-color:var(--gw-button-primary-background);color:var(--gw-button-primary-color);border:none;outline:none;padding-left:1em;padding-right:1em}.explore-visual-graph-button-group .explore-visual-graph-button:hover{background-color:var(--gw-button-primary-hover-background);color:var(--gw-button-primary-hover-color);cursor:pointer}.explore-visual-graph-button-group .dropdown-wrapper{position:relative}.explore-visual-graph-button-group .explore-visual-graph-dropdown .onto-dropdown,.explore-visual-graph-button-group .explore-visual-graph-dropdown .onto-dropdown-button{background-color:var(--gw-button-primary-background);color:var(--gw-button-primary-color);height:100%}.explore-visual-graph-button-group .explore-visual-graph-dropdown .onto-dropdown-button{background-color:var(--gw-button-primary-background);color:var(--gw-button-primary-color);gap:0;padding:0 0.3em}.explore-visual-graph-button-group .explore-visual-graph-dropdown .onto-dropdown-button:hover{background-color:var(--gw-button-primary-hover-background);color:var(--gw-button-primary-hover-color)}.explore-visual-graph-button-group .explore-visual-graph-dropdown .onto-dropdown-menu-item{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:22.5rem}.explore-visual-graph-button-group .no-configurations-message{background-color:var(--gw-message-info-background);border:1px solid var(--gw-message-info-border-color);box-shadow:0 3px 6px rgba(0, 0, 0, 0.1);color:var(--gw-message-info-color);display:flex;gap:8px;justify-content:center;margin-top:1px;padding:0.5em 0.8em;position:absolute;right:0;z-index:1001}.explore-visual-graph-button-group .no-configurations-message .graph-create-link{padding:0}";export{u as onto_graph_explore_split_button};