text: var saveAs=saveAs||function(e){"use strict";if(!(void 0===e||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var t=function(){return e.URL||e.webkitURL||e},n=e.document.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in n,a=/constructor/i.test(e.HTMLElement)||e.safari,r=/CriOS\/[\d]+/.test(navigator.userAgent),i=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},s=function(e){setTimeout(function(){"string"==typeof e?t().revokeObjectURL(e):e.remove()},4e4)},d=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e},l=function(l,c,p){p||(l=d(l));var h,f=this,u="application/octet-stream"===l.type,g=function(){!function(e,t,n){for(var o=(t=[].concat(t)).length;o--;){var a=e["on"+t[o]];if("function"==typeof a)try{a.call(e,n||e)}catch(e){i(e)}}}(f,"writestart progress write writeend".split(" "))};if(f.readyState=f.INIT,o)return h=t().createObjectURL(l),void setTimeout(function(){var e,t;n.href=h,n.download=c,e=n,t=new MouseEvent("click"),e.dispatchEvent(t),g(),s(h),f.readyState=f.DONE});!function(){if((r||u&&a)&&e.FileReader){var n=new FileReader;return n.onloadend=function(){var t=r?n.result:n.result.replace(/^data:[^;]*;/,"data:attachment/file;");e.open(t,"_blank")||(e.location.href=t),t=void 0,f.readyState=f.DONE,g()},n.readAsDataURL(l),void(f.readyState=f.INIT)}h||(h=t().createObjectURL(l)),u?e.location.href=h:e.open(h,"_blank")||(e.location.href=h);f.readyState=f.DONE,g(),s(h)}()},c=l.prototype;return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t,n){return t=t||e.name||"download",n||(e=d(e)),navigator.msSaveOrOpenBlob(e,t)}:(c.abort=function(){},c.readyState=c.INIT=0,c.WRITING=1,c.DONE=2,c.error=c.onwritestart=c.onprogress=c.onwrite=c.onabort=c.onerror=c.onwriteend=null,function(e,t,n){return new l(e,t||e.name||"download",n)})}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content);"undefined"!=typeof module&&module.exports?module.exports.saveAs=saveAs:"undefined"!=typeof define&&null!==define&&null!==define.amd&&define("FileSaver.js",function(){return saveAs}),function(e,t){"object"==typeof module&&module.exports?module.exports=t():"function"==typeof define&&define.amd?define(t):e.findAndReplaceDOMText=t()}(this,function(){var e="retain",t="first",n=document,o={}.hasOwnProperty;function a(){return function(e,t,n,o,i){if(t&&!t.nodeType&&arguments.length<=2)return!1;var s="function"==typeof n;s&&(d=n,n=function(e,t){return d(e.text,t.startIndex)});var d;var l=r(t,{find:e,wrap:s?null:n,replace:s?n:"$"+(o||"&"),prepMatch:function(e,t){if(!e[0])throw"findAndReplaceDOMText cannot handle zero-length matches";if(o>0){var n=e[o];e.index+=e[0].indexOf(n),e[0]=n}return e.endIndex=e.index+e[0].length,e.startIndex=e.index,e.index=t,e},filterElements:i});return a.revert=function(){return l.revert()},!0}.apply(null,arguments)||r.apply(null,arguments)}function r(e,t){return new i(e,t)}function i(t,n){var r=n.preset&&a.PRESETS[n.preset];if(n.portionMode=n.portionMode||e,r)for(var i in r)o.call(r,i)&&!o.call(n,i)&&(n[i]=r[i]);this.node=t,this.options=n,this.prepMatch=n.prepMatch||this.prepMatch,this.reverts=[],this.matches=this.search(),this.matches.length&&this.processMatches()}return a.NON_PROSE_ELEMENTS={br:1,hr:1,script:1,style:1,img:1,video:1,audio:1,canvas:1,svg:1,map:1,object:1,input:1,textarea:1,select:1,option:1,optgroup:1,button:1},a.NON_CONTIGUOUS_PROSE_ELEMENTS={address:1,article:1,aside:1,blockquote:1,dd:1,div:1,dl:1,fieldset:1,figcaption:1,figure:1,footer:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,header:1,hgroup:1,hr:1,main:1,nav:1,noscript:1,ol:1,output:1,p:1,pre:1,section:1,ul:1,br:1,li:1,summary:1,dt:1,details:1,rp:1,rt:1,rtc:1,script:1,style:1,img:1,video:1,audio:1,canvas:1,svg:1,map:1,object:1,input:1,textarea:1,select:1,option:1,optgroup:1,button:1,table:1,tbody:1,thead:1,th:1,tr:1,td:1,caption:1,col:1,tfoot:1,colgroup:1},a.NON_INLINE_PROSE=function(e){return o.call(a.NON_CONTIGUOUS_PROSE_ELEMENTS,e.nodeName.toLowerCase())},a.PRESETS={prose:{forceContext:a.NON_INLINE_PROSE,filterElements:function(e){return!o.call(a.NON_PROSE_ELEMENTS,e.nodeName.toLowerCase())}}},a.Finder=i,i.prototype={search:function(){var e,t=0,n=0,o=this.options.find,a=this.getAggregateText(),r=[],i=this;return o="string"==typeof o?RegExp(String(o).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1"),"g"):o,function a(s){for(var d=0,l=s.length;d<l;++d){var c=s[d];if("string"==typeof c){if(o.global)for(;e=o.exec(c);)r.push(i.prepMatch(e,t++,n));else(e=c.match(o))&&r.push(i.prepMatch(e,0,n));n+=c.length}else a(c)}}(a),r},prepMatch:function(e,t,n){if(!e[0])throw new Error("findAndReplaceDOMText cannot handle zero-length matches");return e.endIndex=n+e.index+e[0].length,e.startIndex=n+e.index,e.index=t,e},getAggregateText:function(){var e=this.options.filterElements,t=this.options.forceContext;return function n(o){if(o.nodeType===Node.TEXT_NODE)return[o.data];if(e&&!e(o))return[];var a=[""];var r=0;if(o=o.firstChild)do{if(o.nodeType!==Node.TEXT_NODE){var i=n(o);t&&o.nodeType===Node.ELEMENT_NODE&&(!0===t||t(o))?(a[++r]=i,a[++r]=""):("string"==typeof i[0]&&(a[r]+=i.shift()),i.length&&(a[++r]=i,a[++r]=""))}else a[r]+=o.data}while(o=o.nextSibling);return a}(this.node)},processMatches:function(){var e,t,n,o=this.matches,a=this.node,r=this.options.filterElements,i=[],s=a,d=o.shift(),l=0,c=0,p=[a];e:for(;;){if(s.nodeType===Node.TEXT_NODE&&(!t&&s.length+l>=d.endIndex?t={node:s,index:c++,text:s.data.substring(d.startIndex-l,d.endIndex-l),indexInMatch:l-d.startIndex,indexInNode:d.startIndex-l,endIndexInNode:d.endIndex-l,isEnd:!0}:e&&i.push({node:s,index:c++,text:s.data,indexInMatch:l-d.startIndex,indexInNode:0}),!e&&s.length+l>d.startIndex&&(e={node:s,index:c++,indexInMatch:0,indexInNode:d.startIndex-l,endIndexInNode:d.endIndex-l,text:s.data.substring(d.startIndex-l,d.endIndex-l)}),l+=s.data.length),n=s.nodeType===Node.ELEMENT_NODE&&r&&!r(s),e&&t){if(s=this.replaceMatch(d,e,i,t),l-=t.node.data.length-t.endIndexInNode,e=null,t=null,i=[],c=0,0,!(d=o.shift()))break}else if(!n&&(s.firstChild||s.nextSibling)){s.firstChild?(p.push(s),s=s.firstChild):s=s.nextSibling;continue}for(;;){if(s.nextSibling){s=s.nextSibling;break}if((s=p.pop())===a)break e}}},revert:function(){for(var e=this.reverts.length;e--;)this.reverts[e]();this.reverts=[]},prepareReplacementString:function(e,n,o){var a=this.options.portionMode;return a===t&&n.indexInMatch>0?"":(e=e.replace(/\$(\d+|&|`|')/g,function(e,t){var n;switch(t){case"&":n=o[0];break;case"`":n=o.input.substring(0,o.startIndex);break;case"'":n=o.input.substring(o.endIndex);break;default:n=o[+t]}return n}),a===t?e:n.isEnd?e.substring(n.indexInMatch):e.substring(n.indexInMatch,n.indexInMatch+n.text.length))},getPortionReplacementNode:function(e,t){var o=this.options.replace||"$&",a=this.options.wrap,r=this.options.wrapClass;if(a&&a.nodeType){var i=n.createElement("div");i.innerHTML=a.outerHTML||(new XMLSerializer).serializeToString(a),a=i.firstChild}if("function"==typeof o)return(o=o(e,t))&&o.nodeType?o:n.createTextNode(String(o));var s="string"==typeof a?n.createElement(a):a;return s&&r&&(s.className=r),(o=n.createTextNode(this.prepareReplacementString(o,e,t))).data&&s?(s.appendChild(o),s):o},replaceMatch:function(e,t,o,a){var r,i,s=t.node,d=a.node;if(s===d){var l=s;t.indexInNode>0&&(r=n.createTextNode(l.data.substring(0,t.indexInNode)),l.parentNode.insertBefore(r,l));var c=this.getPortionReplacementNode(a,e);return l.parentNode.insertBefore(c,l),a.endIndexInNode<l.length&&(i=n.createTextNode(l.data.substring(a.endIndexInNode)),l.parentNode.insertBefore(i,l)),l.parentNode.removeChild(l),this.reverts.push(function(){r===c.previousSibling&&r.parentNode.removeChild(r),i===c.nextSibling&&i.parentNode.removeChild(i),c.parentNode.replaceChild(l,c)}),c}r=n.createTextNode(s.data.substring(0,t.indexInNode)),i=n.createTextNode(d.data.substring(a.endIndexInNode));for(var p=this.getPortionReplacementNode(t,e),h=[],f=0,u=o.length;f<u;++f){var g=o[f],m=this.getPortionReplacementNode(g,e);g.node.parentNode.replaceChild(m,g.node),this.reverts.push(function(e,t){return function(){t.parentNode.replaceChild(e.node,t)}}(g,m)),h.push(m)}var v=this.getPortionReplacementNode(a,e);return s.parentNode.insertBefore(r,s),s.parentNode.insertBefore(p,s),s.parentNode.removeChild(s),d.parentNode.insertBefore(v,d),d.parentNode.insertBefore(i,d),d.parentNode.removeChild(d),this.reverts.push(function(){r.parentNode.removeChild(r),p.parentNode.replaceChild(s,p),i.parentNode.removeChild(i),v.parentNode.replaceChild(d,v)}),v}},a});var Graph=function(){var e,t,n,o,a,r,i,s,d,l;function c(){e=[],t=[],l=1}function p(e,n){for(var o=!1,a={data:{source:e,target:n}},r=0;r<t.length;r++)if(t[r].data.source===a.data.source&&t[r].data.target===a.data.target){o=!0;break}o||t.push(a)}function h(){r.batch(function(){r.$().removeClass("selected")}),i.style.display="none",s.innerHTML=""}function f(e){if(e.target){e.target.addClass("selected"),i.style.display="block";var t=e.target.id()-1;if(t){for(var r="",d=0;d<o.length;d++){var l=o[d].dataset.parentId;if(l>t)break;l==t&&(r+=o[d].innerHTML+"<span class='u-pull-right'>"+a[d].innerHTML+"</span><br/>")}s.innerHTML+="<span class='node-selected'>"+n[t].dataset.objectId+'</span>."'+n[t].dataset.objectDescription+'"<br/>Parent: '+n[t].dataset.objectParent+"<br/>Child: "+n[t].dataset.objectChild+"<br/><div class='accordion-header'>Properties</div>"+r+"<br/>"}}}return c.prototype.fill_nodes_and_edges=function(r,i,s){n=r,o=i,a=s;for(var d,l,c=-1,h={},f=0;f<n.length;f++)d=n[f].dataset.objectId,l=n[f].dataset.objectDescription,e.push({data:{id:d,name:l},classes:"multiline-auto"}),"0"!=n[f].dataset.objectParent&&p(n[f].dataset.objectId,n[f].dataset.objectParent),"0"!=n[f].dataset.objectChild&&p(n[f].dataset.objectChild,n[f].dataset.objectId),"compass"==n[f].dataset.objectDescription&&(c=n[f].dataset.objectId),n[f].dataset.objectParent==c&&(h[n[f].dataset.objectId]=n[f].dataset.objectDescription.replace(" wall",""));for(f=0;f<o.length;f++)for(var u in h)if(o[f].innerHTML==u){var g=o[f].dataset.parentId,m=parseInt(a[f].innerHTML,16);if(m>0&&m<n.length){var v={data:{source:g,target:m,label:h[u]},classes:"autorotate edge-direction"};t.push(v)}}},c.prototype.create_cy_graph=function(n,o,a){i=o,s=a,fetch("static/style/graph.json",{mode:"no-cors"}).then(function(e){return e.json()}).then(function(o){(r=cytoscape({container:document.querySelector("#cy"),boxSelectionEnabled:!0,style:o,elements:{nodes:e,edges:t},minZoom:.1,maxZoom:2,layout:{name:"cose",nodeDimensionsIncludeLabels:!0,idealEdgeLength:200,edgeElasticity:4e3,nodeRepulsion:7e3,componentSpacing:200}})).ready(function(e){n.style.display="none",r.on("select","node",function(e){f(e)}),r.on("tap",function(e){h()})})})},c.prototype.clear_highlights=function(e){r.batch(function(){d&&(d.removeClass("hidden-transparent"),e.checked&&r.animate({fit:{eles:r.$(),padding:20}},{duration:500}))})},c.prototype.highlight_neighbors=function(e,t){r.batch(function(){var n=r.$(e);h(),f({target:n});var o=n.closedNeighborhood();(d=r.elements().not(o)).addClass("hidden-transparent"),t.checked&&r.animate({fit:{eles:o,padding:20}},{duration:500})})},c.prototype.toggle_labelled_edges=function(e){r.batch(function(){var t=r.edges("edge[?label]");e?t.removeClass("hidden"):t.addClass("hidden")})},c.prototype.hide_objects=function(e){r.batch(function(){r.nodes(e).addClass("hidden")})},c.prototype.hide_objects_to_floor=function(e){r.batch(function(){l>parseInt(e)&&r.nodes("node[id<"+l+"]").removeClass("hidden");c.prototype.hide_objects("node[id<"+parseInt(e)+"]")}),l=parseInt(e)},c.prototype.reset=function(){r.batch(function(){r.$().removeClass("hidden"),r.$().removeClass("hidden-transparent"),r.$().removeClass("selected"),r.animate({fit:{eles:r.$(),padding:20}},{duration:500})})},c.prototype.get_png_blob=function(){return r.png({output:"blob"})},c}();!function(e,t,n){var o,a=e.getElementsByClassName("object-info"),r=e.getElementsByClassName("object-property-number"),i=e.getElementsByClassName("object-property-value"),s=e.getElementById("loading"),d=e.getElementById("node-info-container"),l=e.getElementById("node-info-box"),c=e.getElementsByClassName("accordion"),p=e.getElementById("search-box"),h=e.getElementsByClassName("clear-icon")[0],f=e.getElementById("download-png"),u=e.getElementById("compass-routing"),g=e.getElementById("inform-object-floor"),m=e.getElementById("reset-graph"),v=e.getElementsByClassName("highlight-icon")[0],b=e.getElementsByClassName("unhighlight-icon")[0],y=e.getElementsByClassName("hide-icon")[0],N=e.getElementById("zoom-pan"),E=e.getElementById("menu"),x=e.getElementById("info-box"),I=e.getElementById("cy"),T=!1,C=new Graph;C.fill_nodes_and_edges(a,r,i),C.create_cy_graph(s,d,l);for(var L=0;L<c.length;L++)c[L].addEventListener("click",function(e){this.classList.toggle("active");var t=this.nextElementSibling;t.style.maxHeight?t.style.maxHeight=null:t.style.maxHeight=t.scrollHeight+"px"});function _(){if(o&&o.revert(),C.clear_highlights(N),p.value.replace(new RegExp(" ","g"),"").length>0&&(C.highlight_neighbors('node[name @*="'+p.value+'"]',N),o=findAndReplaceDOMText(x,{find:new RegExp(p.value,"gi"),wrap:"span",wrapClass:"highlight"}),e.getElementById("scroll-to-text").checked)){for(var t=0;t<c.length;t++)c[t].classList.contains("active")&&c[t].click();var n=!1,a=!1,r=e.getElementsByClassName("highlight");for(t=0;t<r.length;t++){for(var i=r[t];i&&i.classList&&!i.classList.contains("panel")&&!i.classList.contains("accordion");)!n&&i.classList.contains("word-panel")&&(i.scrollTop=r[t].offsetTop-i.offsetTop,n=!0),!a&&i.classList.contains("object-panel")&&(i.scrollTop=r[t].offsetTop-i.offsetTop,a=!0),i=i.parentNode;i&&i.parentNode&&!i.parentNode.getElementsByClassName("accordion")[0].classList.contains("active")&&i.parentNode.getElementsByClassName("accordion")[0].click()}}}function M(){for(var t=e.getElementsByClassName("node-selected"),n="",o=0;o<t.length;o++)n+='node[id="'+t[o].innerHTML+'"],';return n=n.substring(0,n.length-1)}c[c.length-1].click(),p.addEventListener("keypress",function(e){13==e.which&&(p.select(),_())}),p.addEventListener("keyup",function(e){p.value.replace(" ","").length>0?h.style.display="block":h.style.display="none"}),h.addEventListener("click",function(e){p.value="",h.style.display="none",_()}),f.addEventListener("click",function(t){var n=C.get_png_blob(),o=e.getElementById("filename").innerHTML;o=o.substr(0,o.lastIndexOf("."))+".png",saveAs(n,o)}),u.addEventListener("click",function(e){C.toggle_labelled_edges(u.checked)}),g.addEventListener("click",function(e){e.stopPropagation()}),g.addEventListener("change",function(e){C.hide_objects_to_floor(g.value)}),m.addEventListener("click",function(e){C.reset(),g.value="1",u.checked=!0,N.checked=!0,d.style.display="none"}),v.addEventListener("click",function(e){C.clear_highlights(N),C.highlight_neighbors(M(),N)}),b.addEventListener("click",function(e){C.clear_highlights(N)}),y.addEventListener("click",function(e){C.hide_objects(M()),d.style.display="none"}),E.addEventListener("click",function(e){x.classList.toggle("slide-in"),I.classList.toggle("slide-out"),"M"==E.innerHTML.trim()[0]?("none"!=d.style.display&&(T=!0,d.style.display="none"),E.innerHTML="G<br>R<br>A<br>P<br>H"):(T&&(T=!1,d.style.display="block"),E.innerHTML="M<br>E<br>N<br>U")})}(document,window);