/*
This file is part of Natural Docs, which is Copyright © 2003-2022 Code Clear LLC.
Natural Docs is licensed under version 3 of the GNU Affero General Public
License (AGPL).  Refer to License.txt or www.naturaldocs.org for the
complete details.

This file may be distributed with documentation files generated by Natural Docs.
Such documentation is not covered by Natural Docs' copyright and licensing,
and may have its own copyright and distribution terms as decided by its author.
*/

"use strict";var NDSummary=new function(){this.Start=function(){this.toolTipHolder=document.createElement("div");this.toolTipHolder.style.display="none";this.toolTipHolder.style.position="fixed";this.toolTipHolder.style.zIndex=21;document.body.appendChild(this.toolTipHolder);};this.OnLocationChange=function(oldLocation,newLocation){this.ResetToolTip();if(oldLocation==undefined||oldLocation.type!=newLocation.type||oldLocation.path!=newLocation.path){this.summaryLanguages=undefined;this.summaryCommentTypes=undefined;this.summaryEntries=undefined;this.summaryToolTips=undefined;if(oldLocation==undefined){this.Build();}else if(this.delayedLoadingTimeout==undefined){this.delayedLoadingTimeout=setTimeout(function(){if(NDSummary.summaryLanguages==undefined){NDSummary.Build();}clearTimeout(NDSummary.delayedLoadingTimout);NDSummary.delayedLoadingTimeout=undefined;},250);}var head=document.getElementsByTagName("head")[0];var loader=document.getElementById("NDSummaryLoader");if(loader){head.removeChild(loader);}loader=document.getElementById("NDSummaryToolTipsLoader");if(loader){head.removeChild(loader);}if(newLocation.summaryFile){NDCore.LoadJavaScript(newLocation.summaryFile,"NDSummaryLoader");}}this.FinishNavigation();};this.OnSummaryLoaded=function(hashPath,summaryLanguages,summaryCommentTypes,summaryEntries){if(hashPath==NDFramePage.currentLocation.path){this.summaryLanguages=summaryLanguages;this.summaryCommentTypes=summaryCommentTypes;this.summaryEntries=summaryEntries;this.Build();this.FinishNavigation();NDCore.LoadJavaScript(NDFramePage.currentLocation.summaryTTFile,"NDSummaryToolTipsLoader");}};this.OnToolTipsLoaded=function(hashPath,summaryToolTips){if(hashPath==NDFramePage.currentLocation.path){this.summaryToolTips=summaryToolTips;if(this.showingToolTip!=undefined&&summaryToolTips[this.showingToolTip]!=undefined){this.ShowToolTip();}}};this.Build=function(){var newContent=document.createElement("div");newContent.id="SuContent";if(this.summaryEntries==undefined){var loadingNotice=document.createElement("div");loadingNotice.className="SuLoadingNotice";newContent.appendChild(loadingNotice);}else{var mouseOverHandler=function(e){NDSummary.OnEntryMouseOver(e);};var mouseOutHandler=function(e){NDSummary.OnEntryMouseOut(e);};for(var i=0;i<this.summaryEntries.length;i++){var entry=this.summaryEntries[i];if(entry[3]!=undefined){var entryHTML=document.createElement("a");var classString="SuEntry"+" L"+this.summaryLanguages[entry[1]][1]+" T"+this.summaryCommentTypes[entry[2]][1]+(i==0?" first":"")+(i==this.summaryEntries.length-1?" last":"");var href="#"+NDFramePage.currentLocation.path+(entry[4]!=undefined?":"+entry[4]:"");entryHTML.id="SuEntry"+entry[0];entryHTML.className=classString;entryHTML.setAttribute("href",href);entryHTML.innerHTML="<div class=\"SuEntryIcon\"></div>"+entry[3];entryHTML.onmouseover=mouseOverHandler;entryHTML.onmouseout=mouseOutHandler;var entryHTMLChild=entryHTML.firstChild;if(entryHTMLChild!=undefined&&NDCore.HasClass(entryHTMLChild,"Qualifier")){entryHTMLChild.onmouseover=mouseOverHandler;entryHTMLChild.onmouseout=mouseOutHandler;}newContent.appendChild(entryHTML);}}}var summaryContainer=document.getElementById("NDSummary");var oldContent=document.getElementById("SuContent");if(oldContent!=undefined){summaryContainer.replaceChild(newContent,oldContent);}else{summaryContainer.appendChild(newContent);}newContent.scrollIntoView(true);if(this.summaryEntries!=undefined){NDFramePage.SizeSummaryToContent();}};this.FinishNavigation=function(){if(NDCore.CaseInsensitiveAnchors()&&this.summaryEntries!=undefined&&NDFramePage.currentLocation!=undefined&&NDFramePage.currentLocation.member!=undefined){var topicID=-1;for(var i=0;i<this.summaryEntries.length;i++){if(this.summaryEntries[i][4]==NDFramePage.currentLocation.member){topicID=this.summaryEntries[i][0];break;}}var frame=document.getElementById("CFrame");var targetLocation=NDFramePage.currentLocation.contentPage;var hashIndex=targetLocation.indexOf('#');if(hashIndex!=-1){targetLocation=targetLocation.substr(0,hashIndex);}if(topicID!=-1){targetLocation+="#Topic"+topicID;}frame.contentWindow.location=targetLocation;frame.contentWindow.focus();}};this.OnEntryMouseOver=function(event){if(event==undefined){event=window.event;}var entry=event.target||event.srcElement;if(NDCore.HasClass(entry,"Qualifier")){entry=entry.parentNode;}var id=this.GetTopicIDFromDOMID(entry.id);if(this.showingToolTip!=id){this.ResetToolTip();this.showingToolTip=id;if(this.summaryToolTips==undefined){}else if(this.summaryToolTips[id]!=undefined){if(id==this.lastToolTip){this.ShowToolTip();}else{this.toolTipTimeout=setTimeout(function(){clearTimeout(this.toolTipTimeout);this.toolTipTimeout=undefined;NDSummary.ShowToolTip();},350);}}}};this.OnEntryMouseOut=function(event){if(event==undefined){event=window.event;}var entry=event.target||event.srcElement;if(NDCore.HasClass(entry,"Qualifier")){entry=entry.parentNode;}var id=this.GetTopicIDFromDOMID(entry.id);if(this.showingToolTip==id){this.ResetToolTip();}};this.GetTopicIDFromDOMID=function(domID){var id=parseInt(domID.substr(7),10);if(id!=NaN&&id>0){return id;}else{return-1;}};this.ShowToolTip=function(){var entry=document.getElementById("SuEntry"+this.showingToolTip);this.toolTipHolder.innerHTML=this.summaryToolTips[this.showingToolTip];this.toolTipHolder.style.visibility="hidden";this.toolTipHolder.style.display="block";var summaryBlock=document.getElementById("NDSummary");var x=summaryBlock.offsetLeft+entry.offsetLeft+entry.offsetWidth;var y=summaryBlock.offsetTop+entry.offsetTop-summaryBlock.scrollTop;var newWidth=undefined;var maxWidth=window.innerWidth-x-5;if(this.toolTipHolder.offsetWidth>maxWidth){newWidth=maxWidth;}this.toolTipHolder.style.left=x+"px";this.toolTipHolder.style.top=y+"px";if(newWidth!=undefined){this.toolTipHolder.style.width=newWidth+"px";}var prototypes=this.toolTipHolder.getElementsByClassName("NDPrototype");if(prototypes.length>0&&NDCore.HasClass(prototypes[0],"WideForm")&&prototypes[0].scrollWidth>prototypes[0].offsetWidth){NDCore.ChangePrototypeToNarrowForm(prototypes[0]);}if(y+this.toolTipHolder.offsetHeight+25>window.innerHeight){var newY=window.innerHeight-this.toolTipHolder.offsetHeight-25;if(newY<0){newY=0;}this.toolTipHolder.style.top=newY+"px";}this.toolTipHolder.style.visibility="visible";};this.ResetToolTip=function(){if(this.showingToolTip!=undefined){this.toolTipHolder.style.display="none";this.toolTipHolder.style.width=null;this.lastToolTip=this.showingToolTip;this.showingToolTip=undefined;}if(this.toolTipTimeout!=undefined){clearTimeout(this.toolTipTimeout);this.toolTipTimeout=undefined;}};};