copy to server the last changes
authorrougeronj
Fri, 24 Apr 2015 13:05:09 +0200
changeset 427 f51908ffe6d4
parent 426 05ed0d95a511
child 428 fec21256c1ca
copy to server the last changes
server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.js
server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.min.js
server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.min.map
--- a/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.js	Fri Apr 24 11:13:16 2015 +0200
+++ b/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.js	Fri Apr 24 13:05:09 2015 +0200
@@ -24,6 +24,694 @@
  */
 /*! renkan - v0.8.7 - Copyright © IRI 2015 */
 
+this["renkanJST"] = this["renkanJST"] || {};
+
+this["renkanJST"]["templates/edgeeditor.html"] = function(obj) {
+obj || (obj = {});
+var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
+function print() { __p += __j.call(arguments, '') }
+with (obj) {
+__p += '<h2>\n\t<span class="Rk-CloseX">&times;</span>' +
+__e(renkan.translate("Edit Edge")) +
+'</span>\n</h2>\n<p>\n\t<label>' +
+__e(renkan.translate("Title:")) +
+'</label>\n\t<input class="Rk-Edit-Title" type="text" value="' +
+__e(edge.title) +
+'" />\n</p>\n';
+ if (options.show_edge_editor_uri) { ;
+__p += '\n\t<p>\n\t\t<label>' +
+__e(renkan.translate("URI:")) +
+'</label>\n\t\t<input class="Rk-Edit-URI" type="text" value="' +
+__e(edge.uri) +
+'" />\n\t\t<a class="Rk-Edit-Goto" href="' +
+__e(edge.uri) +
+'" target="_blank"></a>\n\t</p>\n\t';
+ if (options.properties.length) { ;
+__p += '\n\t\t<p>\n\t\t\t<label>' +
+__e(renkan.translate("Choose from vocabulary:")) +
+'</label>\n\t\t\t<select class="Rk-Edit-Vocabulary">\n\t\t\t\t';
+ _(options.properties).each(function(ontology) { ;
+__p += '\n\t\t\t\t\t<option class="Rk-Edit-Vocabulary-Class" value="">\n\t\t\t\t\t\t' +
+__e( renkan.translate(ontology.label) ) +
+'\n\t\t\t\t\t</option>\n\t\t\t\t\t';
+ _(ontology.properties).each(function(property) { var uri = ontology["base-uri"] + property.uri; ;
+__p += '\n\t\t\t\t\t\t<option class="Rk-Edit-Vocabulary-Property" value="' +
+__e( uri ) +
+'"\n\t\t\t\t\t\t\t';
+ if (uri === edge.uri) { ;
+__p += ' selected';
+ } ;
+__p += '>\n\t\t\t\t\t\t\t' +
+__e( renkan.translate(property.label) ) +
+'\n\t\t\t\t\t\t</option>\n\t\t\t\t\t';
+ }) ;
+__p += '\n\t\t\t\t';
+ }) ;
+__p += '\n\t\t\t</select>\n\t\t</p>\n';
+ } } ;
+__p += '\n';
+ if (options.show_edge_editor_color) { ;
+__p += '\n\t<div class="Rk-Editor-p">\n\t\t<span class="Rk-Editor-Label">' +
+__e(renkan.translate("Edge color:")) +
+'</span>\n\t\t<div class="Rk-Edit-ColorPicker-Wrapper">\n\t\t\t<span class="Rk-Edit-Color" style="background: &lt;%-edge.color%>;">\n\t\t\t\t<span class="Rk-Edit-ColorTip"></span>\n\t\t\t</span>\n\t\t\t' +
+((__t = ( renkan.colorPicker )) == null ? '' : __t) +
+'\n\t\t\t<span class="Rk-Edit-ColorPicker-Text">' +
+__e( renkan.translate("Choose color") ) +
+'</span>\n\t\t</div>\n\t</div>\n';
+ } ;
+__p += '\n';
+ if (options.show_edge_editor_direction) { ;
+__p += '\n\t<p>\n\t\t<span class="Rk-Edit-Direction">' +
+__e( renkan.translate("Change edge direction") ) +
+'</span>\n\t</p>\n';
+ } ;
+__p += '\n';
+ if (options.show_edge_editor_nodes) { ;
+__p += '\n\t<p>\n\t\t<span class="Rk-Editor-Label">' +
+__e(renkan.translate("From:")) +
+'</span>\n\t\t<span class="Rk-UserColor" style="background: ' +
+__e(edge.from_color) +
+';"></span>\n\t\t' +
+__e( shortenText(edge.from_title, 25) ) +
+'\n\t</p>\n\t<p>\n\t\t<span class="Rk-Editor-Label">' +
+__e(renkan.translate("To:")) +
+'</span>\n\t\t<span class="Rk-UserColor" style="background: >%-edge.to_color%>;"></span>\n\t\t' +
+__e( shortenText(edge.to_title, 25) ) +
+'\n\t</p>\n';
+ } ;
+__p += '\n';
+ if (options.show_edge_editor_creator && edge.has_creator) { ;
+__p += '\n\t<p>\n\t\t<span class="Rk-Editor-Label">' +
+__e(renkan.translate("Created by:")) +
+'</span>\n\t\t<span class="Rk-UserColor" style="background: &lt;%-edge.created_by_color%>;"></span>\n\t\t' +
+__e( shortenText(edge.created_by_title, 25) ) +
+'\n\t</p>\n';
+ } ;
+__p += '\n';
+
+}
+return __p
+};
+
+this["renkanJST"]["templates/edgeeditor_readonly.html"] = function(obj) {
+obj || (obj = {});
+var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
+function print() { __p += __j.call(arguments, '') }
+with (obj) {
+__p += '<h2>\n\t<span class="Rk-CloseX">&times;</span>\n\t';
+ if (options.show_edge_tooltip_color) { ;
+__p += '\n\t\t<span class="Rk-UserColor" style="background: ' +
+__e( edge.color ) +
+';"></span>\n\t';
+ } ;
+__p += '\n\t<span class="Rk-Display-Title">\n\t\t';
+ if (edge.uri) { ;
+__p += '\n\t\t\t<a href="' +
+__e(edge.uri) +
+'" target="_blank">\n\t\t';
+ } ;
+__p += '\n\t\t' +
+__e(edge.title) +
+'\n\t\t';
+ if (edge.uri) { ;
+__p += ' </a> ';
+ } ;
+__p += '\n\t</span>\n</h2>\n';
+ if (options.show_edge_tooltip_uri && edge.uri) { ;
+__p += '\n\t<p class="Rk-Display-URI">\n\t\t<a href="' +
+__e(edge.uri) +
+'" target="_blank">' +
+__e( edge.short_uri ) +
+'</a>\n\t</p>\n';
+ } ;
+__p += '\n<p>' +
+__e(edge.description) +
+'</p>\n';
+ if (options.show_edge_tooltip_nodes) { ;
+__p += '\n\t<p>\n\t\t<span class="Rk-Editor-Label">' +
+__e(renkan.translate("From:")) +
+'</span>\n\t\t<span class="Rk-UserColor" style="background: ' +
+__e( edge.from_color ) +
+';"></span>\n\t\t' +
+__e( shortenText(edge.from_title, 25) ) +
+'\n\t</p>\n\t<p>\n\t\t<span class="Rk-Editor-Label">' +
+__e(renkan.translate("To:")) +
+'</span>\n\t\t<span class="Rk-UserColor" style="background: ' +
+__e( edge.to_color ) +
+';"></span>\n\t\t' +
+__e( shortenText(edge.to_title, 25) ) +
+'\n\t</p>\n';
+ } ;
+__p += '\n';
+ if (options.show_edge_tooltip_creator && edge.has_creator) { ;
+__p += '\n\t<p>\n\t\t<span class="Rk-Editor-Label">' +
+__e(renkan.translate("Created by:")) +
+'</span>\n\t\t<span class="Rk-UserColor" style="background: ' +
+__e( edge.created_by_color ) +
+';"></span>\n\t\t' +
+__e( shortenText(edge.created_by_title, 25) ) +
+'\n\t</p>\n';
+ } ;
+__p += '\n';
+
+}
+return __p
+};
+
+this["renkanJST"]["templates/ldtjson-bin/annotationtemplate.html"] = function(obj) {
+obj || (obj = {});
+var __t, __p = '', __e = _.escape;
+with (obj) {
+__p += '<li class="Rk-Bin-Item" draggable="true"\n\tdata-image="' +
+__e( Rkns.Utils.getFullURL(image) ) +
+'"\n\tdata-uri="' +
+((__t = (ldt_platform)) == null ? '' : __t) +
+'ldtplatform/ldt/front/player/' +
+((__t = (mediaid)) == null ? '' : __t) +
+'/#id=' +
+((__t = (annotationid)) == null ? '' : __t) +
+'"\n\tdata-title="' +
+__e(title) +
+'" data-description="' +
+__e(description) +
+'">\n\t\n\t<img class="Rk-Ldt-Annotation-Icon" src="' +
+((__t = (image)) == null ? '' : __t) +
+'" />\n\t<h4>' +
+((__t = (htitle)) == null ? '' : __t) +
+'</h4>\n\t<p>' +
+((__t = (hdescription)) == null ? '' : __t) +
+'</p>\n\t<p>Start: ' +
+((__t = (start)) == null ? '' : __t) +
+', End: ' +
+((__t = (end)) == null ? '' : __t) +
+', Duration: ' +
+((__t = (duration)) == null ? '' : __t) +
+'</p>\n\t<div class="Rk-Clear"></div>\n</li>';
+
+}
+return __p
+};
+
+this["renkanJST"]["templates/ldtjson-bin/segmenttemplate.html"] = function(obj) {
+obj || (obj = {});
+var __t, __p = '', __e = _.escape;
+with (obj) {
+__p += '<li class="Rk-Bin-Item" draggable="true"\n\tdata-image="' +
+__e( Rkns.Utils.getFullURL(image) ) +
+'"\n\tdata-uri="' +
+((__t = (ldt_platform)) == null ? '' : __t) +
+'ldtplatform/ldt/front/player/' +
+((__t = (mediaid)) == null ? '' : __t) +
+'/#id=' +
+((__t = (annotationid)) == null ? '' : __t) +
+'"\n\tdata-title="' +
+__e(title) +
+'" data-description="' +
+__e(description) +
+'">\n\t\n\t<img class="Rk-Ldt-Annotation-Icon" src="' +
+((__t = (image)) == null ? '' : __t) +
+'" />\n\t<h4>' +
+((__t = (htitle)) == null ? '' : __t) +
+'</h4>\n\t<p>' +
+((__t = (hdescription)) == null ? '' : __t) +
+'</p>\n\t<p>Start: ' +
+((__t = (start)) == null ? '' : __t) +
+', End: ' +
+((__t = (end)) == null ? '' : __t) +
+', Duration: ' +
+((__t = (duration)) == null ? '' : __t) +
+'</p>\n\t<div class="Rk-Clear"></div>\n</li>';
+
+}
+return __p
+};
+
+this["renkanJST"]["templates/ldtjson-bin/tagtemplate.html"] = function(obj) {
+obj || (obj = {});
+var __t, __p = '', __e = _.escape;
+with (obj) {
+__p += '<li class="Rk-Bin-Item" draggable="true"\n\tdata-image="' +
+__e( Rkns.Utils.getFullURL(static_url+'img/ldt-tag.png') ) +
+'"\n\tdata-uri="' +
+((__t = (ldt_platform)) == null ? '' : __t) +
+'ldtplatform/ldt/front/search/?search=' +
+((__t = (encodedtitle)) == null ? '' : __t) +
+'&field=all"\n\tdata-title="' +
+__e(title) +
+'" data-description="Tag \'' +
+__e(title) +
+'\'">\n\n\t<img class="Rk-Ldt-Tag-Icon" src="' +
+__e(static_url) +
+'img/ldt-tag.png" />\n\t<h4>' +
+((__t = (htitle)) == null ? '' : __t) +
+'</h4>\n\t<div class="Rk-Clear"></div>\n</li>';
+
+}
+return __p
+};
+
+this["renkanJST"]["templates/list-bin.html"] = function(obj) {
+obj || (obj = {});
+var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
+function print() { __p += __j.call(arguments, '') }
+with (obj) {
+__p += '<li class="Rk-Bin-Item Rk-ResourceList-Item" draggable="true"\n\tdata-uri="' +
+__e(url) +
+'" data-title="' +
+__e(title) +
+'"\n\tdata-description="' +
+__e(description) +
+'"\n\t';
+ if (image) { ;
+__p += '\n\t\tdata-image="' +
+__e( Rkns.Utils.getFullURL(image) ) +
+'"\n\t';
+ } else { ;
+__p += '\n\t\tdata-image=""\n\t';
+ } ;
+__p += '\n>';
+ if (image) { ;
+__p += '\n\t<img class="Rk-ResourceList-Image" src="' +
+__e(image) +
+'" />\n';
+ } ;
+__p += '\n<h4 class="Rk-ResourceList-Title">\n\t';
+ if (url) { ;
+__p += '\n\t\t<a href="' +
+__e(url) +
+'" target="_blank">\n\t';
+ } ;
+__p += '\n\t' +
+((__t = (htitle)) == null ? '' : __t) +
+'\n\t';
+ if (url) { ;
+__p += '</a>';
+ } ;
+__p += '\n\t</h4> \n\t';
+ if (description) { ;
+__p += '\n\t\t<p class="Rk-ResourceList-Description">' +
+((__t = (hdescription)) == null ? '' : __t) +
+'</p>\n\t';
+ } ;
+__p += '\n\t';
+ if (image) { ;
+__p += '\n\t\t<div style="clear: both;"></div>\n\t';
+ } ;
+__p += '\n</li>';
+
+}
+return __p
+};
+
+this["renkanJST"]["templates/main.html"] = function(obj) {
+obj || (obj = {});
+var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
+function print() { __p += __j.call(arguments, '') }
+with (obj) {
+
+ if (options.show_bins) { ;
+__p += '\n\t<div class="Rk-Bins">\n\t\t<div class="Rk-Bins-Head">\n\t\t\t<h2 class="Rk-Bins-Title">' +
+__e( translate("Select contents:")) +
+'</h2>\n\t\t\t<form class="Rk-Web-Search-Form Rk-Search-Form">\n\t\t\t\t<input class="Rk-Web-Search-Input Rk-Search-Input" type="search"\n\t\t\t\t\tplaceholder="' +
+__e( translate('Search theWeb') ) +
+'" />\n\t\t\t\t<div class="Rk-Search-Select">\n\t\t\t\t\t<div class="Rk-Search-Current"></div>\n\t\t\t\t\t<ul class="Rk-Search-List"></ul>\n\t\t\t\t</div>\n\t\t\t\t<input type="submit" value=""\n\t\t\t\t\tclass="Rk-Web-Search-Submit Rk-Search-Submit" title="' +
+__e( translate('Search theWeb') ) +
+'" />\n\t\t\t</form>\n\t\t\t<form class="Rk-Bins-Search-Form Rk-Search-Form">\n\t\t\t\t<input class="Rk-Bins-Search-Input Rk-Search-Input" type="search"\n\t\t\t\t\tplaceholder="' +
+__e( translate('Search inBins') ) +
+'" /> <input\n\t\t\t\t\ttype="submit" value=""\n\t\t\t\t\tclass="Rk-Bins-Search-Submit Rk-Search-Submit"\n\t\t\t\t\ttitle="' +
+__e( translate('Search inBins') ) +
+'" />\n\t\t\t</form>\n\t\t</div>\n\t\t<ul class="Rk-Bin-List"></ul>\n\t</div>\n';
+ } ;
+__p += ' ';
+ if (options.show_editor) { ;
+__p += '\n\t<div class="Rk-Render Rk-Render-';
+ if (options.show_bins) { ;
+__p += 'Panel';
+ } else { ;
+__p += 'Full';
+ } ;
+__p += '"></div>\n';
+ } ;
+__p += '\n';
+
+}
+return __p
+};
+
+this["renkanJST"]["templates/nodeeditor.html"] = function(obj) {
+obj || (obj = {});
+var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
+function print() { __p += __j.call(arguments, '') }
+with (obj) {
+__p += '<h2>\n\t<span class="Rk-CloseX">&times;</span>' +
+__e(renkan.translate("Edit Node")) +
+'</span>\n</h2>\n<p>\n\t<label>' +
+__e(renkan.translate("Title:")) +
+'</label>\n\t<input class="Rk-Edit-Title" type="text" value="' +
+__e(node.title) +
+'" />\n</p>\n';
+ if (options.show_node_editor_uri) { ;
+__p += '\n\t<p>\n\t\t<label>' +
+__e(renkan.translate("URI:")) +
+'</label>\n\t\t<input class="Rk-Edit-URI" type="text" value="' +
+__e(node.uri) +
+'" />\n\t\t<a class="Rk-Edit-Goto" href="' +
+__e(node.uri) +
+'" target="_blank"></a>\n\t</p>\n';
+ } ;
+__p += ' ';
+ if (options.show_node_editor_description) { ;
+__p += '\n\t<p>\n\t\t<label>' +
+__e(renkan.translate("Description:")) +
+'</label>\n\t\t<textarea class="Rk-Edit-Description">' +
+__e(node.description) +
+'</textarea>\n\t</p>\n';
+ } ;
+__p += ' ';
+ if (options.show_node_editor_size) { ;
+__p += '\n\t<p>\n\t\t<span class="Rk-Editor-Label">' +
+__e(renkan.translate("Size:")) +
+'</span>\n\t\t<a href="#" class="Rk-Edit-Size-Down">-</a>\n\t\t<span class="Rk-Edit-Size-Value">' +
+__e(node.size) +
+'</span>\n\t\t<a href="#" class="Rk-Edit-Size-Up">+</a>\n\t</p>\n';
+ } ;
+__p += ' ';
+ if (options.show_node_editor_color) { ;
+__p += '\n\t<div class="Rk-Editor-p">\n\t\t<span class="Rk-Editor-Label">\n\t\t' +
+__e(renkan.translate("Node color:")) +
+'</span>\n\t\t<div class="Rk-Edit-ColorPicker-Wrapper">\n\t\t\t<span class="Rk-Edit-Color" style="background: ' +
+__e(node.color) +
+';">\n\t\t\t\t<span class="Rk-Edit-ColorTip"></span>\n\t\t\t</span>\n\t\t\t' +
+((__t = ( renkan.colorPicker )) == null ? '' : __t) +
+'\n\t\t\t<span class="Rk-Edit-ColorPicker-Text">' +
+__e( renkan.translate("Choose color") ) +
+'</span>\n\t\t</div>\n\t</div>\n';
+ } ;
+__p += ' ';
+ if (options.show_node_editor_image) { ;
+__p += '\n\t<div class="Rk-Edit-ImgWrap">\n\t\t<div class="Rk-Edit-ImgPreview">\n\t\t\t<img src="' +
+__e(node.image || node.image_placeholder) +
+'" />\n\t\t\t';
+ if (node.clip_path) { ;
+__p += '\n\t\t\t\t<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 1 1" preserveAspectRatio="none">\n\t\t\t\t\t<path style="stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;" d="' +
+__e( node.clip_path ) +
+'" />\n\t\t\t\t</svg>\n\t\t\t';
+ };
+__p += '\n\t\t</div>\n\t</div>\n\t<p>\n\t\t<label>' +
+__e(renkan.translate("Image URL:")) +
+'</label>\n\t\t<div>\n\t\t\t<a class="Rk-Edit-Image-Del" href="#"></a>\n\t\t\t<input class="Rk-Edit-Image" type="text" value=\'' +
+__e(node.image) +
+'\' />\n\t\t</div>\n\t</p>\n';
+ if (options.allow_image_upload) { ;
+__p += '\n\t<p>\n\t\t<label>' +
+__e(renkan.translate("Choose Image File:")) +
+'</label>\n\t\t<input class="Rk-Edit-Image-File" type="file" accept="image/*" />\n\t</p>\n';
+ };
+
+ } ;
+__p += ' ';
+ if (options.show_node_editor_creator && node.has_creator) { ;
+__p += '\n\t<p>\n\t\t<span class="Rk-Editor-Label">' +
+__e(renkan.translate("Created by:")) +
+'</span>\n\t\t<span class="Rk-UserColor" style="background: ' +
+__e(node.created_by_color) +
+';"></span>\n\t\t' +
+__e( shortenText(node.created_by_title, 25) ) +
+'\n\t</p>\n';
+ } ;
+__p += ' ';
+ if (options.change_shapes) { ;
+__p += '\n\t<p>\n\t\t<label>' +
+__e(renkan.translate("Shapes available")) +
+':</label>\n\t\t<select class="Rk-Edit-Shape">\n\t\t\t<option class="Rk-Edit-Vocabulary-Property" value="circle"';
+ if (node.shape === "circle") { ;
+__p += ' selected';
+ } ;
+__p += '>\n\t\t\t\t' +
+__e( renkan.translate("Circle") ) +
+'\n\t\t\t</option>\n\t\t\t<option class="Rk-Edit-Vocabulary-Property" value="rectangle"';
+ if (node.shape === "rectangle") { ;
+__p += ' selected';
+ } ;
+__p += '>\n\t\t\t\t' +
+__e( renkan.translate("Square") ) +
+'\n\t\t\t</option>\n\t\t\t<option class="Rk-Edit-Vocabulary-Property" value="diamond"';
+ if (node.shape === "diamond") { ;
+__p += ' selected';
+ } ;
+__p += '>\n\t\t\t\t' +
+__e( renkan.translate("Diamond") ) +
+'\n\t\t\t</option>\n\t\t\t<option class="Rk-Edit-Vocabulary-Property" value="polygon"';
+ if (node.shape === "polygon") { ;
+__p += ' selected';
+ } ;
+__p += '>\n\t\t\t\t' +
+__e( renkan.translate("Hexagone") ) +
+'\n\t\t\t</option>\n\t\t\t<option class="Rk-Edit-Vocabulary-Property" value="ellipse"';
+ if (node.shape === "ellipse") { ;
+__p += ' selected';
+ } ;
+__p += '>\n\t\t\t\t' +
+__e( renkan.translate("Ellipse") ) +
+'\n\t\t\t</option>\n\t\t\t<option class="Rk-Edit-Vocabulary-Property" value="star"';
+ if (node.shape === "star") { ;
+__p += ' selected';
+ } ;
+__p += '>\n\t\t\t\t' +
+__e( renkan.translate("Star") ) +
+'\n\t\t\t</option>\n\t\t</select>\n\t</p>\n';
+ } ;
+__p += '\n';
+
+}
+return __p
+};
+
+this["renkanJST"]["templates/nodeeditor_readonly.html"] = function(obj) {
+obj || (obj = {});
+var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
+function print() { __p += __j.call(arguments, '') }
+with (obj) {
+__p += '<h2>\n\t<span class="Rk-CloseX">&times;</span>\n\t';
+ if (options.show_node_tooltip_color) { ;
+__p += '\n\t\t<span class="Rk-UserColor" style="background: ' +
+__e(node.color) +
+';"></span>\n\t';
+ } ;
+__p += '\n\t<span class="Rk-Display-Title">\n\t\t';
+ if (node.uri) { ;
+__p += '\n\t\t\t<a href="' +
+__e(node.uri) +
+'" target="_blank">\n\t\t';
+ } ;
+__p += '\n\t\t' +
+__e(node.title) +
+'\n\t\t';
+ if (node.uri) { ;
+__p += '</a>';
+ } ;
+__p += '\n\t</span>\n</h2>\n';
+ if (node.uri && options.show_node_tooltip_uri) { ;
+__p += '\n\t<p class="Rk-Display-URI">\n\t\t<a href="' +
+__e(node.uri) +
+'" target="_blank">' +
+__e(node.short_uri) +
+'</a>\n\t</p>\n';
+ } ;
+__p += ' ';
+ if (options.show_node_tooltip_description) { ;
+__p += '\n\t<p class="Rk-Display-Description">' +
+__e(node.description) +
+'</p>\n';
+ } ;
+__p += ' ';
+ if (node.image && options.show_node_tooltip_image) { ;
+__p += '\n\t<img class="Rk-Display-ImgPreview" src="' +
+__e(node.image) +
+'" />\n';
+ } ;
+__p += ' ';
+ if (node.has_creator && options.show_node_tooltip_creator) { ;
+__p += '\n\t<p>\n\t\t<span class="Rk-Editor-Label">' +
+__e(renkan.translate("Created by:")) +
+'</span>\n\t\t<span class="Rk-UserColor" style="background: ' +
+__e(node.created_by_color) +
+';"></span>\n\t\t' +
+__e( shortenText(node.created_by_title, 25) ) +
+'\n\t</p>\n';
+ } ;
+__p += '\n';
+
+}
+return __p
+};
+
+this["renkanJST"]["templates/scene.html"] = function(obj) {
+obj || (obj = {});
+var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
+function print() { __p += __j.call(arguments, '') }
+with (obj) {
+
+ if (options.show_top_bar) { ;
+__p += '\n\t<div class="Rk-TopBar">\n\t\t<div class="loader"></div>\n\t\t';
+ if (!options.editor_mode) { ;
+__p += '\n\t\t\t<h2 class="Rk-PadTitle">\n\t\t\t\t' +
+__e( project.get("title") || translate("Untitled project")) +
+'\n\t\t\t</h2>\n\t\t';
+ } else { ;
+__p += '\n\t\t\t<input type="text" class="Rk-PadTitle" value="' +
+__e( project.get('title') || '' ) +
+'" placeholder="' +
+__e(translate('Untitled project')) +
+'" />\n\t\t';
+ } ;
+__p += '\n\t\t';
+ if (options.show_user_list) { ;
+__p += '\n\t\t\t<div class="Rk-Users">\n\t\t\t\t<div class="Rk-CurrentUser">\n\t\t\t\t\t';
+ if (options.show_user_color) { ;
+__p += '\n\t\t\t\t\t\t<div class="Rk-Edit-ColorPicker-Wrapper">\n\t\t\t\t\t\t\t<span class="Rk-CurrentUser-Color">\n\t\t\t\t\t\t\t';
+ if (options.user_color_editable) { ;
+__p += '\n\t\t\t\t\t\t\t\t<span class="Rk-Edit-ColorTip"></span>\n\t\t\t\t\t\t\t';
+ } ;
+__p += '\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t';
+ if (options.user_color_editable) { print(colorPicker) } ;
+__p += '\n\t\t\t\t\t\t</div>\n\t\t\t\t\t';
+ } ;
+__p += '\n\t\t\t\t\t<span class="Rk-CurrentUser-Name">&lt;unknown user&gt;</span>\n\t\t\t\t</div>\n\t\t\t\t<ul class="Rk-UserList"></ul>\n\t\t\t</div>\n\t\t';
+ } ;
+__p += '\n\t\t';
+ if (options.home_button_url) {;
+__p += '\n\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t<a class="Rk-TopBar-Button Rk-Home-Button" href="' +
+__e( options.home_button_url ) +
+'">\n\t\t\t\t<div class="Rk-TopBar-Tooltip">\n\t\t\t\t\t<div class="Rk-TopBar-Tooltip-Contents">\n\t\t\t\t\t\t' +
+__e( translate(options.home_button_title) ) +
+'\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</a>\n\t\t';
+ } ;
+__p += '\n\t\t';
+ if (options.show_fullscreen_button) { ;
+__p += '\n\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t<div class="Rk-TopBar-Button Rk-FullScreen-Button">\n\t\t\t\t<div class="Rk-TopBar-Tooltip">\n\t\t\t\t\t<div class="Rk-TopBar-Tooltip-Contents">\n\t\t\t\t\t\t' +
+__e(translate("Full Screen")) +
+'\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t';
+ } ;
+__p += '\n\t\t';
+ if (options.editor_mode) { ;
+__p += '\n\t\t\t';
+ if (options.show_addnode_button) { ;
+__p += '\n\t\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t\t<div class="Rk-TopBar-Button Rk-AddNode-Button">\n\t\t\t\t\t<div class="Rk-TopBar-Tooltip">\n\t\t\t\t\t\t<div class="Rk-TopBar-Tooltip-Contents">\n\t\t\t\t\t\t\t' +
+__e(translate("Add Node")) +
+'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t';
+ } ;
+__p += '\n\t\t\t';
+ if (options.show_addedge_button) { ;
+__p += '\n\t\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t\t<div class="Rk-TopBar-Button Rk-AddEdge-Button">\n\t\t\t\t\t<div class="Rk-TopBar-Tooltip">\n\t\t\t\t\t\t<div class="Rk-TopBar-Tooltip-Contents">\n\t\t\t\t\t\t\t' +
+__e(translate("Add Edge")) +
+'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t';
+ } ;
+__p += '\n\t\t\t';
+ if (options.show_export_button) { ;
+__p += '\n\t\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t\t<div class="Rk-TopBar-Button Rk-Export-Button">\n\t\t\t\t\t<div class="Rk-TopBar-Tooltip">\n\t\t\t\t\t\t<div class="Rk-TopBar-Tooltip-Contents">\n\t\t\t\t\t\t\t' +
+__e(translate("Download Project")) +
+'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t';
+ } ;
+__p += '\n\t\t\t';
+ if (options.show_save_button) { ;
+__p += '\n\t\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t\t<div class="Rk-TopBar-Button Rk-Save-Button">\n\t\t\t\t\t<div class="Rk-TopBar-Tooltip">\n\t\t\t\t\t\t<div class="Rk-TopBar-Tooltip-Contents"></div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t';
+ } ;
+__p += '\n\t\t\t';
+ if (options.show_open_button) { ;
+__p += '\n\t\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t\t<div class="Rk-TopBar-Button Rk-Open-Button">\n\t\t\t\t\t<div class="Rk-TopBar-Tooltip">\n\t\t\t\t\t\t<div class="Rk-TopBar-Tooltip-Contents">\n\t\t\t\t\t\t\t' +
+__e(translate("Open Project")) +
+'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t';
+ } ;
+__p += '\n\t\t\t';
+ if (options.show_bookmarklet) { ;
+__p += '\n\t\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t\t<a class="Rk-TopBar-Button Rk-Bookmarklet-Button" href="#">\n\t\t\t\t\t<div class="Rk-TopBar-Tooltip">\n\t\t\t\t\t\t<div class="Rk-TopBar-Tooltip-Contents">\n\t\t\t\t\t\t\t' +
+__e(translate("Renkan \'Drag-to-Add\' bookmarklet")) +
+'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</a>\n\t\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t';
+ } ;
+__p += '\n\t\t';
+ } else { ;
+__p += '\n\t\t\t';
+ if (options.show_export_button) { ;
+__p += '\n\t\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t\t<div class="Rk-TopBar-Button Rk-Export-Button">\n\t\t\t\t\t<div class="Rk-TopBar-Tooltip">\n\t\t\t\t\t\t<div class="Rk-TopBar-Tooltip-Contents">\n\t\t\t\t\t\t\t' +
+__e(translate("Download Project")) +
+'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t';
+ } ;
+__p += '\n\t\t';
+ }; ;
+__p += '\n\t\t';
+ if (options.show_search_field) { ;
+__p += '\n\t\t\t<form action="#" class="Rk-GraphSearch-Form">\n\t\t\t\t<input type="search" class="Rk-GraphSearch-Field" placeholder="' +
+__e( translate('Search in graph') ) +
+'" />\n\t\t\t</form>\n\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t';
+ } ;
+__p += '\n\t</div>\n';
+ } ;
+__p += '\n<div class="Rk-Editing-Space';
+ if (!options.show_top_bar) { ;
+__p += ' Rk-Editing-Space-Full';
+ } ;
+__p += '">\n\t<div class="Rk-Labels"></div>\n\t<canvas class="Rk-Canvas" ';
+ if (options.resize) { ;
+__p += ' resize="" ';
+ } ;
+__p += '></canvas>\n\t<div class="Rk-Notifications"></div>\n\t<div class="Rk-Editor">\n\t\t';
+ if (options.show_bins) { ;
+__p += '\n\t\t\t<div class="Rk-Fold-Bins">&laquo;</div>\n\t\t';
+ } ;
+__p += '\n\t\t';
+ if (options.show_zoom) { ;
+__p += '\n\t\t\t<div class="Rk-ZoomButtons">\n\t\t\t\t<div class="Rk-ZoomIn" title="' +
+__e(translate('Zoom In')) +
+'"></div>\n\t\t\t\t<div class="Rk-ZoomFit" title="' +
+__e(translate('Zoom Fit')) +
+'"></div>\n\t\t\t\t<div class="Rk-ZoomOut" title="' +
+__e(translate('Zoom Out')) +
+'"></div>\n\t\t\t\t';
+ if (options.editor_mode && options.save_view) { ;
+__p += '\n\t\t\t\t\t<div class="Rk-ZoomSave" title="' +
+__e(translate('Zoom Save')) +
+'"></div>\n\t\t\t\t';
+ } ;
+__p += '\n\t\t\t\t';
+ if (options.save_view) { ;
+__p += '\n\t\t\t\t\t<div class="Rk-ZoomSetSaved" title="' +
+__e(translate('View saved zoom')) +
+'"></div>\n\t\t\t\t';
+ } ;
+__p += '\n\t\t\t</div>\n\t\t';
+ } ;
+__p += '\n\t</div>\n</div>';
+
+}
+return __p
+};
+
+this["renkanJST"]["templates/wikipedia-bin/resulttemplate.html"] = function(obj) {
+obj || (obj = {});
+var __t, __p = '', __e = _.escape;
+with (obj) {
+__p += '<li class="Rk-Wikipedia-Result Rk-Bin-Item" draggable="true"\n\tdata-uri="' +
+__e(url) +
+'" data-title="Wikipedia: ' +
+__e(title) +
+'"\n\tdata-description="' +
+__e(description) +
+'"\n\tdata-image="' +
+__e( Rkns.Utils.getFullURL( static_url + 'img/wikipedia.png' ) ) +
+'">\n\t\n\t<img class="Rk-Wikipedia-Icon" src="' +
+__e(static_url) +
+'img/wikipedia.png">\n\t<h4 class="Rk-Wikipedia-Title">\n\t\t<a href="' +
+__e(url) +
+'" target="_blank">' +
+((__t = (htitle)) == null ? '' : __t) +
+'</a>\n\t</h4>\n\t<p class="Rk-Wikipedia-Snippet">' +
+((__t = (hdescription)) == null ? '' : __t) +
+'</p>\n</li>';
+
+}
+return __p
+};
 
 /* Declaring the Renkan Namespace Rkns and Default values */
 
@@ -124,6 +812,7 @@
     Rkns.__renkans.push(this);
 
     this.options = _.defaults(_opts, Rkns.defaults, {templates: renkanJST});
+    this.template = renkanJST['templates/main.html'];
 
     _(this.options.property_files).each(function(f) {
         Rkns.$.getJSON(f, function(data) {
@@ -313,17 +1002,6 @@
 
 };
 
-Renkan.prototype.template = _.template(
-    '<% if (options.show_bins) { %><div class="Rk-Bins"><div class="Rk-Bins-Head"><h2 class="Rk-Bins-Title"><%- translate("Select contents:")%></h2>' +
-    '<form class="Rk-Web-Search-Form Rk-Search-Form"><input class="Rk-Web-Search-Input Rk-Search-Input" type="search" placeholder="<%- translate("Search the Web") %>" />' +
-    '<div class="Rk-Search-Select"><div class="Rk-Search-Current"></div><ul class="Rk-Search-List"></ul></div>' +
-    '<input type="submit" value="" class="Rk-Web-Search-Submit Rk-Search-Submit" title="<%- translate("Search the Web") %>" /></form>' +
-    '<form class="Rk-Bins-Search-Form Rk-Search-Form"><input class="Rk-Bins-Search-Input Rk-Search-Input" type="search" placeholder="<%- translate("Search in Bins") %>" />' +
-    '<input type="submit" value="" class="Rk-Bins-Search-Submit Rk-Search-Submit" title="<%- translate("Search in Bins") %>" /></form></div>' +
-    '<ul class="Rk-Bin-List"></ul></div><% } %>' +
-    '<% if (options.show_editor) { %><div class="Rk-Render Rk-Render-<% if (options.show_bins) { %>Panel<% } else { %>Full<% } %>"></div><% } %>'
-);
-
 Renkan.prototype.translate = function(_text) {
     if (Rkns.i18n[this.options.language] && Rkns.i18n[this.options.language][_text]) {
         return Rkns.i18n[this.options.language][_text];
@@ -1625,14 +2303,7 @@
 
 Rkns.ResourceList.Bin = Rkns.Utils.inherit(Rkns._BaseBin);
 
-Rkns.ResourceList.Bin.prototype.resultTemplate = Rkns._.template(
-    '<li class="Rk-Bin-Item Rk-ResourceList-Item" draggable="true" data-uri="<%-url%>" ' +
-    'data-title="<%-title%>" data-description="<%-description%>" ' +
-    '<% if (image) { %>data-image="<%- Rkns.Utils.getFullURL(image) %>"<% } else { %>data-image=""<% } %> >' +
-    '<% if (image) { %><img class="Rk-ResourceList-Image" src="<%-image%>"/><% } %><h4 class="Rk-ResourceList-Title">' +
-    '<% if (url) { %><a href="<%-url%>" target="_blank"><% } %><%=htitle%><% if (url) { %></a><% } %></h4>' +
-    '<% if (description) { %><p class="Rk-ResourceList-Description"><%=hdescription%></p><% } %><% if (image) { %><div style="clear: both;"></div><% } %></li>'
-);
+Rkns.ResourceList.Bin.prototype.resultTemplate = renkanJST['templates/list-bin.html'];
 
 Rkns.ResourceList.Bin.prototype._init = function(_renkan, _opts) {
     this.renkan = _renkan;
@@ -1748,12 +2419,7 @@
 
 Rkns.Wikipedia.Bin = Rkns.Utils.inherit(Rkns._BaseBin);
 
-Rkns.Wikipedia.Bin.prototype.resultTemplate = Rkns._.template(
-    '<li class="Rk-Wikipedia-Result Rk-Bin-Item" draggable="true" data-uri="<%-url%>" ' +
-    'data-title="Wikipedia: <%-title%>" data-description="<%-description%>" data-image="<%- Rkns.Utils.getFullURL( static_url + \'img/wikipedia.png\' ) %>">' +
-    '<img class="Rk-Wikipedia-Icon" src="<%-static_url%>img/wikipedia.png"></div><h4 class="Rk-Wikipedia-Title"><a href="<%-url%>" target="_blank"><%=htitle%></a></h4>' +
-    '<p class="Rk-Wikipedia-Snippet"><%=hdescription%></p></li>'
-);
+Rkns.Wikipedia.Bin.prototype.resultTemplate = renkanJST['templates/wikipedia-bin/resulttemplate.html'];
 
 Rkns.Wikipedia.Bin.prototype._init = function(_renkan, _opts) {
     this.renkan = _renkan;
@@ -4996,578 +5662,3 @@
 
 define("main-renderer", function(){});
 
-
-this["renkanJST"] = this["renkanJST"] || {};
-
-this["renkanJST"]["templates/edgeeditor.html"] = function(obj) {
-obj || (obj = {});
-var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
-function print() { __p += __j.call(arguments, '') }
-with (obj) {
-__p += '<h2>\n\t<span class="Rk-CloseX">&times;</span>' +
-__e(renkan.translate("Edit Edge")) +
-'</span>\n</h2>\n<p>\n\t<label>' +
-__e(renkan.translate("Title:")) +
-'</label>\n\t<input class="Rk-Edit-Title" type="text" value="' +
-__e(edge.title) +
-'" />\n</p>\n';
- if (options.show_edge_editor_uri) { ;
-__p += '\n\t<p>\n\t\t<label>' +
-__e(renkan.translate("URI:")) +
-'</label>\n\t\t<input class="Rk-Edit-URI" type="text" value="' +
-__e(edge.uri) +
-'" />\n\t\t<a class="Rk-Edit-Goto" href="' +
-__e(edge.uri) +
-'" target="_blank"></a>\n\t</p>\n\t';
- if (options.properties.length) { ;
-__p += '\n\t\t<p>\n\t\t\t<label>' +
-__e(renkan.translate("Choose from vocabulary:")) +
-'</label>\n\t\t\t<select class="Rk-Edit-Vocabulary">\n\t\t\t\t';
- _(options.properties).each(function(ontology) { ;
-__p += '\n\t\t\t\t\t<option class="Rk-Edit-Vocabulary-Class" value="">\n\t\t\t\t\t\t' +
-__e( renkan.translate(ontology.label) ) +
-'\n\t\t\t\t\t</option>\n\t\t\t\t\t';
- _(ontology.properties).each(function(property) { var uri = ontology["base-uri"] + property.uri; ;
-__p += '\n\t\t\t\t\t\t<option class="Rk-Edit-Vocabulary-Property" value="' +
-__e( uri ) +
-'"\n\t\t\t\t\t\t\t';
- if (uri === edge.uri) { ;
-__p += ' selected';
- } ;
-__p += '>\n\t\t\t\t\t\t\t' +
-__e( renkan.translate(property.label) ) +
-'\n\t\t\t\t\t\t</option>\n\t\t\t\t\t';
- }) ;
-__p += '\n\t\t\t\t';
- }) ;
-__p += '\n\t\t\t</select>\n\t\t</p>\n';
- } } ;
-__p += '\n';
- if (options.show_edge_editor_color) { ;
-__p += '\n\t<div class="Rk-Editor-p">\n\t\t<span class="Rk-Editor-Label">' +
-__e(renkan.translate("Edge color:")) +
-'</span>\n\t\t<div class="Rk-Edit-ColorPicker-Wrapper">\n\t\t\t<span class="Rk-Edit-Color" style="background: &lt;%-edge.color%>;">\n\t\t\t\t<span class="Rk-Edit-ColorTip"></span>\n\t\t\t</span>\n\t\t\t' +
-((__t = ( renkan.colorPicker )) == null ? '' : __t) +
-'\n\t\t\t<span class="Rk-Edit-ColorPicker-Text">' +
-__e( renkan.translate("Choose color") ) +
-'</span>\n\t\t</div>\n\t</div>\n';
- } ;
-__p += '\n';
- if (options.show_edge_editor_direction) { ;
-__p += '\n\t<p>\n\t\t<span class="Rk-Edit-Direction">' +
-__e( renkan.translate("Change edge direction") ) +
-'</span>\n\t</p>\n';
- } ;
-__p += '\n';
- if (options.show_edge_editor_nodes) { ;
-__p += '\n\t<p>\n\t\t<span class="Rk-Editor-Label">' +
-__e(renkan.translate("From:")) +
-'</span>\n\t\t<span class="Rk-UserColor" style="background: ' +
-__e(edge.from_color) +
-';"></span>\n\t\t' +
-__e( shortenText(edge.from_title, 25) ) +
-'\n\t</p>\n\t<p>\n\t\t<span class="Rk-Editor-Label">' +
-__e(renkan.translate("To:")) +
-'</span>\n\t\t<span class="Rk-UserColor" style="background: >%-edge.to_color%>;"></span>\n\t\t' +
-__e( shortenText(edge.to_title, 25) ) +
-'\n\t</p>\n';
- } ;
-__p += '\n';
- if (options.show_edge_editor_creator && edge.has_creator) { ;
-__p += '\n\t<p>\n\t\t<span class="Rk-Editor-Label">' +
-__e(renkan.translate("Created by:")) +
-'</span>\n\t\t<span class="Rk-UserColor" style="background: &lt;%-edge.created_by_color%>;"></span>\n\t\t' +
-__e( shortenText(edge.created_by_title, 25) ) +
-'\n\t</p>\n';
- } ;
-__p += '\n';
-
-}
-return __p
-};
-
-this["renkanJST"]["templates/edgeeditor_readonly.html"] = function(obj) {
-obj || (obj = {});
-var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
-function print() { __p += __j.call(arguments, '') }
-with (obj) {
-__p += '<h2>\n\t<span class="Rk-CloseX">&times;</span>\n\t';
- if (options.show_edge_tooltip_color) { ;
-__p += '\n\t\t<span class="Rk-UserColor" style="background: ' +
-__e( edge.color ) +
-';"></span>\n\t';
- } ;
-__p += '\n\t<span class="Rk-Display-Title">\n\t\t';
- if (edge.uri) { ;
-__p += '\n\t\t\t<a href="' +
-__e(edge.uri) +
-'" target="_blank">\n\t\t';
- } ;
-__p += '\n\t\t' +
-__e(edge.title) +
-'\n\t\t';
- if (edge.uri) { ;
-__p += ' </a> ';
- } ;
-__p += '\n\t</span>\n</h2>\n';
- if (options.show_edge_tooltip_uri && edge.uri) { ;
-__p += '\n\t<p class="Rk-Display-URI">\n\t\t<a href="' +
-__e(edge.uri) +
-'" target="_blank">' +
-__e( edge.short_uri ) +
-'</a>\n\t</p>\n';
- } ;
-__p += '\n<p>' +
-__e(edge.description) +
-'</p>\n';
- if (options.show_edge_tooltip_nodes) { ;
-__p += '\n\t<p>\n\t\t<span class="Rk-Editor-Label">' +
-__e(renkan.translate("From:")) +
-'</span>\n\t\t<span class="Rk-UserColor" style="background: ' +
-__e( edge.from_color ) +
-';"></span>\n\t\t' +
-__e( shortenText(edge.from_title, 25) ) +
-'\n\t</p>\n\t<p>\n\t\t<span class="Rk-Editor-Label">' +
-__e(renkan.translate("To:")) +
-'</span>\n\t\t<span class="Rk-UserColor" style="background: ' +
-__e( edge.to_color ) +
-';"></span>\n\t\t' +
-__e( shortenText(edge.to_title, 25) ) +
-'\n\t</p>\n';
- } ;
-__p += '\n';
- if (options.show_edge_tooltip_creator && edge.has_creator) { ;
-__p += '\n\t<p>\n\t\t<span class="Rk-Editor-Label">' +
-__e(renkan.translate("Created by:")) +
-'</span>\n\t\t<span class="Rk-UserColor" style="background: ' +
-__e( edge.created_by_color ) +
-';"></span>\n\t\t' +
-__e( shortenText(edge.created_by_title, 25) ) +
-'\n\t</p>\n';
- } ;
-__p += '\n';
-
-}
-return __p
-};
-
-this["renkanJST"]["templates/ldtjson-bin/annotationtemplate.html"] = function(obj) {
-obj || (obj = {});
-var __t, __p = '', __e = _.escape;
-with (obj) {
-__p += '<li class="Rk-Bin-Item" draggable="true"\n\tdata-image="' +
-__e( Rkns.Utils.getFullURL(image) ) +
-'"\n\tdata-uri="' +
-((__t = (ldt_platform)) == null ? '' : __t) +
-'ldtplatform/ldt/front/player/' +
-((__t = (mediaid)) == null ? '' : __t) +
-'/#id=' +
-((__t = (annotationid)) == null ? '' : __t) +
-'"\n\tdata-title="' +
-__e(title) +
-'" data-description="' +
-__e(description) +
-'">\n\t\n\t<img class="Rk-Ldt-Annotation-Icon" src="' +
-((__t = (image)) == null ? '' : __t) +
-'" />\n\t<h4>' +
-((__t = (htitle)) == null ? '' : __t) +
-'</h4>\n\t<p>' +
-((__t = (hdescription)) == null ? '' : __t) +
-'</p>\n\t<p>Start: ' +
-((__t = (start)) == null ? '' : __t) +
-', End: ' +
-((__t = (end)) == null ? '' : __t) +
-', Duration: ' +
-((__t = (duration)) == null ? '' : __t) +
-'</p>\n\t<div class="Rk-Clear"></div>\n</li>';
-
-}
-return __p
-};
-
-this["renkanJST"]["templates/ldtjson-bin/segmenttemplate.html"] = function(obj) {
-obj || (obj = {});
-var __t, __p = '', __e = _.escape;
-with (obj) {
-__p += '<li class="Rk-Bin-Item" draggable="true"\n\tdata-image="' +
-__e( Rkns.Utils.getFullURL(image) ) +
-'"\n\tdata-uri="' +
-((__t = (ldt_platform)) == null ? '' : __t) +
-'ldtplatform/ldt/front/player/' +
-((__t = (mediaid)) == null ? '' : __t) +
-'/#id=' +
-((__t = (annotationid)) == null ? '' : __t) +
-'"\n\tdata-title="' +
-__e(title) +
-'" data-description="' +
-__e(description) +
-'">\n\t\n\t<img class="Rk-Ldt-Annotation-Icon" src="' +
-((__t = (image)) == null ? '' : __t) +
-'" />\n\t<h4>' +
-((__t = (htitle)) == null ? '' : __t) +
-'</h4>\n\t<p>' +
-((__t = (hdescription)) == null ? '' : __t) +
-'</p>\n\t<p>Start: ' +
-((__t = (start)) == null ? '' : __t) +
-', End: ' +
-((__t = (end)) == null ? '' : __t) +
-', Duration: ' +
-((__t = (duration)) == null ? '' : __t) +
-'</p>\n\t<div class="Rk-Clear"></div>\n</li>';
-
-}
-return __p
-};
-
-this["renkanJST"]["templates/ldtjson-bin/tagtemplate.html"] = function(obj) {
-obj || (obj = {});
-var __t, __p = '', __e = _.escape;
-with (obj) {
-__p += '<li class="Rk-Bin-Item" draggable="true"\n\tdata-image="' +
-__e( Rkns.Utils.getFullURL(static_url+'img/ldt-tag.png') ) +
-'"\n\tdata-uri="' +
-((__t = (ldt_platform)) == null ? '' : __t) +
-'ldtplatform/ldt/front/search/?search=' +
-((__t = (encodedtitle)) == null ? '' : __t) +
-'&field=all"\n\tdata-title="' +
-__e(title) +
-'" data-description="Tag \'' +
-__e(title) +
-'\'">\n\n\t<img class="Rk-Ldt-Tag-Icon" src="' +
-__e(static_url) +
-'img/ldt-tag.png" />\n\t<h4>' +
-((__t = (htitle)) == null ? '' : __t) +
-'</h4>\n\t<div class="Rk-Clear"></div>\n</li>';
-
-}
-return __p
-};
-
-this["renkanJST"]["templates/nodeeditor.html"] = function(obj) {
-obj || (obj = {});
-var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
-function print() { __p += __j.call(arguments, '') }
-with (obj) {
-__p += '<h2>\n\t<span class="Rk-CloseX">&times;</span>' +
-__e(renkan.translate("Edit Node")) +
-'</span>\n</h2>\n<p>\n\t<label>' +
-__e(renkan.translate("Title:")) +
-'</label>\n\t<input class="Rk-Edit-Title" type="text" value="' +
-__e(node.title) +
-'" />\n</p>\n';
- if (options.show_node_editor_uri) { ;
-__p += '\n\t<p>\n\t\t<label>' +
-__e(renkan.translate("URI:")) +
-'</label>\n\t\t<input class="Rk-Edit-URI" type="text" value="' +
-__e(node.uri) +
-'" />\n\t\t<a class="Rk-Edit-Goto" href="' +
-__e(node.uri) +
-'" target="_blank"></a>\n\t</p>\n';
- } ;
-__p += ' ';
- if (options.show_node_editor_description) { ;
-__p += '\n\t<p>\n\t\t<label>' +
-__e(renkan.translate("Description:")) +
-'</label>\n\t\t<textarea class="Rk-Edit-Description">' +
-__e(node.description) +
-'</textarea>\n\t</p>\n';
- } ;
-__p += ' ';
- if (options.show_node_editor_size) { ;
-__p += '\n\t<p>\n\t\t<span class="Rk-Editor-Label">' +
-__e(renkan.translate("Size:")) +
-'</span>\n\t\t<a href="#" class="Rk-Edit-Size-Down">-</a>\n\t\t<span class="Rk-Edit-Size-Value">' +
-__e(node.size) +
-'</span>\n\t\t<a href="#" class="Rk-Edit-Size-Up">+</a>\n\t</p>\n';
- } ;
-__p += ' ';
- if (options.show_node_editor_color) { ;
-__p += '\n\t<div class="Rk-Editor-p">\n\t\t<span class="Rk-Editor-Label">\n\t\t' +
-__e(renkan.translate("Node color:")) +
-'</span>\n\t\t<div class="Rk-Edit-ColorPicker-Wrapper">\n\t\t\t<span class="Rk-Edit-Color" style="background: ' +
-__e(node.color) +
-';">\n\t\t\t\t<span class="Rk-Edit-ColorTip"></span>\n\t\t\t</span>\n\t\t\t' +
-((__t = ( renkan.colorPicker )) == null ? '' : __t) +
-'\n\t\t\t<span class="Rk-Edit-ColorPicker-Text">' +
-__e( renkan.translate("Choose color") ) +
-'</span>\n\t\t</div>\n\t</div>\n';
- } ;
-__p += ' ';
- if (options.show_node_editor_image) { ;
-__p += '\n\t<div class="Rk-Edit-ImgWrap">\n\t\t<div class="Rk-Edit-ImgPreview">\n\t\t\t<img src="' +
-__e(node.image || node.image_placeholder) +
-'" />\n\t\t\t';
- if (node.clip_path) { ;
-__p += '\n\t\t\t\t<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 1 1" preserveAspectRatio="none">\n\t\t\t\t\t<path style="stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;" d="' +
-__e( node.clip_path ) +
-'" />\n\t\t\t\t</svg>\n\t\t\t';
- };
-__p += '\n\t\t</div>\n\t</div>\n\t<p>\n\t\t<label>' +
-__e(renkan.translate("Image URL:")) +
-'</label>\n\t\t<div>\n\t\t\t<a class="Rk-Edit-Image-Del" href="#"></a>\n\t\t\t<input class="Rk-Edit-Image" type="text" value=\'' +
-__e(node.image) +
-'\' />\n\t\t</div>\n\t</p>\n';
- if (options.allow_image_upload) { ;
-__p += '\n\t<p>\n\t\t<label>' +
-__e(renkan.translate("Choose Image File:")) +
-'</label>\n\t\t<input class="Rk-Edit-Image-File" type="file" accept="image/*" />\n\t</p>\n';
- };
-
- } ;
-__p += ' ';
- if (options.show_node_editor_creator && node.has_creator) { ;
-__p += '\n\t<p>\n\t\t<span class="Rk-Editor-Label">' +
-__e(renkan.translate("Created by:")) +
-'</span>\n\t\t<span class="Rk-UserColor" style="background: ' +
-__e(node.created_by_color) +
-';"></span>\n\t\t' +
-__e( shortenText(node.created_by_title, 25) ) +
-'\n\t</p>\n';
- } ;
-__p += ' ';
- if (options.change_shapes) { ;
-__p += '\n\t<p>\n\t\t<label>' +
-__e(renkan.translate("Shapes available")) +
-':</label>\n\t\t<select class="Rk-Edit-Shape">\n\t\t\t<option class="Rk-Edit-Vocabulary-Property" value="circle"';
- if (node.shape === "circle") { ;
-__p += ' selected';
- } ;
-__p += '>\n\t\t\t\t' +
-__e( renkan.translate("Circle") ) +
-'\n\t\t\t</option>\n\t\t\t<option class="Rk-Edit-Vocabulary-Property" value="rectangle"';
- if (node.shape === "rectangle") { ;
-__p += ' selected';
- } ;
-__p += '>\n\t\t\t\t' +
-__e( renkan.translate("Square") ) +
-'\n\t\t\t</option>\n\t\t\t<option class="Rk-Edit-Vocabulary-Property" value="diamond"';
- if (node.shape === "diamond") { ;
-__p += ' selected';
- } ;
-__p += '>\n\t\t\t\t' +
-__e( renkan.translate("Diamond") ) +
-'\n\t\t\t</option>\n\t\t\t<option class="Rk-Edit-Vocabulary-Property" value="polygon"';
- if (node.shape === "polygon") { ;
-__p += ' selected';
- } ;
-__p += '>\n\t\t\t\t' +
-__e( renkan.translate("Hexagone") ) +
-'\n\t\t\t</option>\n\t\t\t<option class="Rk-Edit-Vocabulary-Property" value="ellipse"';
- if (node.shape === "ellipse") { ;
-__p += ' selected';
- } ;
-__p += '>\n\t\t\t\t' +
-__e( renkan.translate("Ellipse") ) +
-'\n\t\t\t</option>\n\t\t\t<option class="Rk-Edit-Vocabulary-Property" value="star"';
- if (node.shape === "star") { ;
-__p += ' selected';
- } ;
-__p += '>\n\t\t\t\t' +
-__e( renkan.translate("Star") ) +
-'\n\t\t\t</option>\n\t\t</select>\n\t</p>\n';
- } ;
-__p += '\n';
-
-}
-return __p
-};
-
-this["renkanJST"]["templates/nodeeditor_readonly.html"] = function(obj) {
-obj || (obj = {});
-var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
-function print() { __p += __j.call(arguments, '') }
-with (obj) {
-__p += '<h2>\n\t<span class="Rk-CloseX">&times;</span>\n\t';
- if (options.show_node_tooltip_color) { ;
-__p += '\n\t\t<span class="Rk-UserColor" style="background: ' +
-__e(node.color) +
-';"></span>\n\t';
- } ;
-__p += '\n\t<span class="Rk-Display-Title">\n\t\t';
- if (node.uri) { ;
-__p += '\n\t\t\t<a href="' +
-__e(node.uri) +
-'" target="_blank">\n\t\t';
- } ;
-__p += '\n\t\t' +
-__e(node.title) +
-'\n\t\t';
- if (node.uri) { ;
-__p += '</a>';
- } ;
-__p += '\n\t</span>\n</h2>\n';
- if (node.uri && options.show_node_tooltip_uri) { ;
-__p += '\n\t<p class="Rk-Display-URI">\n\t\t<a href="' +
-__e(node.uri) +
-'" target="_blank">' +
-__e(node.short_uri) +
-'</a>\n\t</p>\n';
- } ;
-__p += ' ';
- if (options.show_node_tooltip_description) { ;
-__p += '\n\t<p class="Rk-Display-Description">' +
-__e(node.description) +
-'</p>\n';
- } ;
-__p += ' ';
- if (node.image && options.show_node_tooltip_image) { ;
-__p += '\n\t<img class="Rk-Display-ImgPreview" src="' +
-__e(node.image) +
-'" />\n';
- } ;
-__p += ' ';
- if (node.has_creator && options.show_node_tooltip_creator) { ;
-__p += '\n\t<p>\n\t\t<span class="Rk-Editor-Label">' +
-__e(renkan.translate("Created by:")) +
-'</span>\n\t\t<span class="Rk-UserColor" style="background: ' +
-__e(node.created_by_color) +
-';"></span>\n\t\t' +
-__e( shortenText(node.created_by_title, 25) ) +
-'\n\t</p>\n';
- } ;
-__p += '\n';
-
-}
-return __p
-};
-
-this["renkanJST"]["templates/scene.html"] = function(obj) {
-obj || (obj = {});
-var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
-function print() { __p += __j.call(arguments, '') }
-with (obj) {
-
- if (options.show_top_bar) { ;
-__p += '\n\t<div class="Rk-TopBar">\n\t\t<div class="loader"></div>\n\t\t';
- if (!options.editor_mode) { ;
-__p += '\n\t\t\t<h2 class="Rk-PadTitle">\n\t\t\t\t' +
-__e( project.get("title") || translate("Untitled project")) +
-'\n\t\t\t</h2>\n\t\t';
- } else { ;
-__p += '\n\t\t\t<input type="text" class="Rk-PadTitle" value="' +
-__e( project.get('title') || '' ) +
-'" placeholder="' +
-__e(translate('Untitled project')) +
-'" />\n\t\t';
- } ;
-__p += '\n\t\t';
- if (options.show_user_list) { ;
-__p += '\n\t\t\t<div class="Rk-Users">\n\t\t\t\t<div class="Rk-CurrentUser">\n\t\t\t\t\t';
- if (options.show_user_color) { ;
-__p += '\n\t\t\t\t\t\t<div class="Rk-Edit-ColorPicker-Wrapper">\n\t\t\t\t\t\t\t<span class="Rk-CurrentUser-Color">\n\t\t\t\t\t\t\t';
- if (options.user_color_editable) { ;
-__p += '\n\t\t\t\t\t\t\t\t<span class="Rk-Edit-ColorTip"></span>\n\t\t\t\t\t\t\t';
- } ;
-__p += '\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t';
- if (options.user_color_editable) { print(colorPicker) } ;
-__p += '\n\t\t\t\t\t\t</div>\n\t\t\t\t\t';
- } ;
-__p += '\n\t\t\t\t\t<span class="Rk-CurrentUser-Name">&lt;unknown user&gt;</span>\n\t\t\t\t</div>\n\t\t\t\t<ul class="Rk-UserList"></ul>\n\t\t\t</div>\n\t\t';
- } ;
-__p += '\n\t\t';
- if (options.home_button_url) {;
-__p += '\n\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t<a class="Rk-TopBar-Button Rk-Home-Button" href="' +
-__e( options.home_button_url ) +
-'">\n\t\t\t\t<div class="Rk-TopBar-Tooltip">\n\t\t\t\t\t<div class="Rk-TopBar-Tooltip-Contents">\n\t\t\t\t\t\t' +
-__e( translate(options.home_button_title) ) +
-'\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</a>\n\t\t';
- } ;
-__p += '\n\t\t';
- if (options.show_fullscreen_button) { ;
-__p += '\n\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t<div class="Rk-TopBar-Button Rk-FullScreen-Button">\n\t\t\t\t<div class="Rk-TopBar-Tooltip">\n\t\t\t\t\t<div class="Rk-TopBar-Tooltip-Contents">\n\t\t\t\t\t\t' +
-__e(translate("Full Screen")) +
-'\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t';
- } ;
-__p += '\n\t\t';
- if (options.editor_mode) { ;
-__p += '\n\t\t\t';
- if (options.show_addnode_button) { ;
-__p += '\n\t\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t\t<div class="Rk-TopBar-Button Rk-AddNode-Button">\n\t\t\t\t\t<div class="Rk-TopBar-Tooltip">\n\t\t\t\t\t\t<div class="Rk-TopBar-Tooltip-Contents">\n\t\t\t\t\t\t\t' +
-__e(translate("Add Node")) +
-'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t';
- } ;
-__p += '\n\t\t\t';
- if (options.show_addedge_button) { ;
-__p += '\n\t\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t\t<div class="Rk-TopBar-Button Rk-AddEdge-Button">\n\t\t\t\t\t<div class="Rk-TopBar-Tooltip">\n\t\t\t\t\t\t<div class="Rk-TopBar-Tooltip-Contents">\n\t\t\t\t\t\t\t' +
-__e(translate("Add Edge")) +
-'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t';
- } ;
-__p += '\n\t\t\t';
- if (options.show_export_button) { ;
-__p += '\n\t\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t\t<div class="Rk-TopBar-Button Rk-Export-Button">\n\t\t\t\t\t<div class="Rk-TopBar-Tooltip">\n\t\t\t\t\t\t<div class="Rk-TopBar-Tooltip-Contents">\n\t\t\t\t\t\t\t' +
-__e(translate("Download Project")) +
-'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t';
- } ;
-__p += '\n\t\t\t';
- if (options.show_save_button) { ;
-__p += '\n\t\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t\t<div class="Rk-TopBar-Button Rk-Save-Button">\n\t\t\t\t\t<div class="Rk-TopBar-Tooltip">\n\t\t\t\t\t\t<div class="Rk-TopBar-Tooltip-Contents"></div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t';
- } ;
-__p += '\n\t\t\t';
- if (options.show_open_button) { ;
-__p += '\n\t\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t\t<div class="Rk-TopBar-Button Rk-Open-Button">\n\t\t\t\t\t<div class="Rk-TopBar-Tooltip">\n\t\t\t\t\t\t<div class="Rk-TopBar-Tooltip-Contents">\n\t\t\t\t\t\t\t' +
-__e(translate("Open Project")) +
-'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t';
- } ;
-__p += '\n\t\t\t';
- if (options.show_bookmarklet) { ;
-__p += '\n\t\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t\t<a class="Rk-TopBar-Button Rk-Bookmarklet-Button" href="#">\n\t\t\t\t\t<div class="Rk-TopBar-Tooltip">\n\t\t\t\t\t\t<div class="Rk-TopBar-Tooltip-Contents">\n\t\t\t\t\t\t\t' +
-__e(translate("Renkan \'Drag-to-Add\' bookmarklet")) +
-'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</a>\n\t\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t';
- } ;
-__p += '\n\t\t';
- } else { ;
-__p += '\n\t\t\t';
- if (options.show_export_button) { ;
-__p += '\n\t\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t\t<div class="Rk-TopBar-Button Rk-Export-Button">\n\t\t\t\t\t<div class="Rk-TopBar-Tooltip">\n\t\t\t\t\t\t<div class="Rk-TopBar-Tooltip-Contents">\n\t\t\t\t\t\t\t' +
-__e(translate("Download Project")) +
-'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t\t';
- } ;
-__p += '\n\t\t';
- }; ;
-__p += '\n\t\t';
- if (options.show_search_field) { ;
-__p += '\n\t\t\t<form action="#" class="Rk-GraphSearch-Form">\n\t\t\t\t<input type="search" class="Rk-GraphSearch-Field" placeholder="' +
-__e( translate('Search in graph') ) +
-'" />\n\t\t\t</form>\n\t\t\t<div class="Rk-TopBar-Separator"></div>\n\t\t';
- } ;
-__p += '\n\t</div>\n';
- } ;
-__p += '\n<div class="Rk-Editing-Space';
- if (!options.show_top_bar) { ;
-__p += ' Rk-Editing-Space-Full';
- } ;
-__p += '">\n\t<div class="Rk-Labels"></div>\n\t<canvas class="Rk-Canvas" ';
- if (options.resize) { ;
-__p += ' resize="" ';
- } ;
-__p += '></canvas>\n\t<div class="Rk-Notifications"></div>\n\t<div class="Rk-Editor">\n\t\t';
- if (options.show_bins) { ;
-__p += '\n\t\t\t<div class="Rk-Fold-Bins">&laquo;</div>\n\t\t';
- } ;
-__p += '\n\t\t';
- if (options.show_zoom) { ;
-__p += '\n\t\t\t<div class="Rk-ZoomButtons">\n\t\t\t\t<div class="Rk-ZoomIn" title="' +
-__e(translate('Zoom In')) +
-'"></div>\n\t\t\t\t<div class="Rk-ZoomFit" title="' +
-__e(translate('Zoom Fit')) +
-'"></div>\n\t\t\t\t<div class="Rk-ZoomOut" title="' +
-__e(translate('Zoom Out')) +
-'"></div>\n\t\t\t\t';
- if (options.editor_mode && options.save_view) { ;
-__p += '\n\t\t\t\t\t<div class="Rk-ZoomSave" title="' +
-__e(translate('Zoom Save')) +
-'"></div>\n\t\t\t\t';
- } ;
-__p += '\n\t\t\t\t';
- if (options.save_view) { ;
-__p += '\n\t\t\t\t\t<div class="Rk-ZoomSetSaved" title="' +
-__e(translate('View saved zoom')) +
-'"></div>\n\t\t\t\t';
- } ;
-__p += '\n\t\t\t</div>\n\t\t';
- } ;
-__p += '\n\t</div>\n</div>';
-
-}
-return __p
-};
\ No newline at end of file
--- a/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.min.js	Fri Apr 24 11:13:16 2015 +0200
+++ b/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.min.js	Fri Apr 24 13:05:09 2015 +0200
@@ -25,8 +25,8 @@
 /*! renkan - v0.8.7 - Copyright © IRI 2015 */
 
 
-!function(a){"use strict";"object"!=typeof a.Rkns&&(a.Rkns={});var b=a.Rkns,c=b.$=a.jQuery,d=b._=a._;b.pickerColors=["#8f1919","#a80000","#d82626","#ff0000","#e87c7c","#ff6565","#f7d3d3","#fecccc","#8f5419","#a85400","#d87f26","#ff7f00","#e8b27c","#ffb265","#f7e5d3","#fee5cc","#8f8f19","#a8a800","#d8d826","#feff00","#e8e87c","#feff65","#f7f7d3","#fefecc","#198f19","#00a800","#26d826","#00ff00","#7ce87c","#65ff65","#d3f7d3","#ccfecc","#198f8f","#00a8a8","#26d8d8","#00feff","#7ce8e8","#65feff","#d3f7f7","#ccfefe","#19198f","#0000a8","#2626d8","#0000ff","#7c7ce8","#6565ff","#d3d3f7","#ccccfe","#8f198f","#a800a8","#d826d8","#ff00fe","#e87ce8","#ff65fe","#f7d3f7","#feccfe","#000000","#242424","#484848","#6d6d6d","#919191","#b6b6b6","#dadada","#ffffff"],b.__renkans=[];var e=b._BaseBin=function(a,c){if("undefined"!=typeof a){this.renkan=a,this.renkan.$.find(".Rk-Bin-Main").hide(),this.$=b.$("<li>").addClass("Rk-Bin").appendTo(a.$.find(".Rk-Bin-List")),this.title_icon_$=b.$("<span>").addClass("Rk-Bin-Title-Icon").appendTo(this.$);var d=this;b.$("<a>").attr({href:"#",title:a.translate("Close bin")}).addClass("Rk-Bin-Close").html("&times;").appendTo(this.$).click(function(){return d.destroy(),a.$.find(".Rk-Bin-Main:visible").length||a.$.find(".Rk-Bin-Main:last").slideDown(),a.resizeBins(),!1}),b.$("<a>").attr({href:"#",title:a.translate("Refresh bin")}).addClass("Rk-Bin-Refresh").appendTo(this.$).click(function(){return d.refresh(),!1}),this.count_$=b.$("<div>").addClass("Rk-Bin-Count").appendTo(this.$),this.title_$=b.$("<h2>").addClass("Rk-Bin-Title").appendTo(this.$),this.main_$=b.$("<div>").addClass("Rk-Bin-Main").appendTo(this.$).html('<h4 class="Rk-Bin-Loading">'+a.translate("Loading, please wait")+"</h4>"),this.title_$.html(c.title||"(new bin)"),this.renkan.resizeBins(),c.auto_refresh&&window.setInterval(function(){d.refresh()},c.auto_refresh)}};e.prototype.destroy=function(){this.$.detach(),this.renkan.resizeBins()};var f=b.Renkan=function(a){var e=this;if(b.__renkans.push(this),this.options=d.defaults(a,b.defaults,{templates:renkanJST}),d(this.options.property_files).each(function(a){b.$.getJSON(a,function(a){e.options.properties=e.options.properties.concat(a)})}),this.read_only=this.options.read_only||!this.options.editor_mode,this.project=new b.Models.Project,this.setCurrentUser=function(a,b){this.project.addUser({_id:a,title:b}),this.current_user=a,this.renderer.redrawUsers()},"undefined"!=typeof this.options.user_id&&(this.current_user=this.options.user_id),this.$=b.$("#"+this.options.container),this.$.addClass("Rk-Main").html(this.template(this)),this.tabs=[],this.search_engines=[],this.current_user_list=new b.Models.UsersList,this.current_user_list.on("add remove",function(){this.renderer&&this.renderer.redrawUsers()}),this.colorPicker=function(){var a=d.template('<li data-color="<%=c%>" style="background: <%=c%>"></li>');return'<ul class="Rk-Edit-ColorPicker">'+b.pickerColors.map(function(b){return a({c:b})}).join("")+"</ul>"}(),this.options.show_editor&&(this.renderer=new b.Renderer.Scene(this)),this.options.search.length){var f=d.template('<li class="<%= className %>" data-key="<%= key %>"><%= title %></li>'),g=this.$.find(".Rk-Search-List"),h=this.$.find(".Rk-Web-Search-Input"),i=this.$.find(".Rk-Web-Search-Form");d(this.options.search).each(function(a){b[a.type]&&b[a.type].Search&&e.search_engines.push(new b[a.type].Search(e,a))}),g.html(d(this.search_engines).map(function(a,b){return f({key:b,title:a.getSearchTitle(),className:a.getBgClass()})}).join("")),g.find("li").click(function(){var a=b.$(this);e.setSearchEngine(a.attr("data-key")),i.submit()}),i.submit(function(){if(h.val()){var a=e.search_engine;a.search(h.val())}return!1}),this.$.find(".Rk-Search-Current").mouseenter(function(){g.slideDown()}),this.$.find(".Rk-Search-Select").mouseleave(function(){g.hide()}),this.setSearchEngine(0)}else this.$.find(".Rk-Web-Search-Form").detach();d(this.options.bins).each(function(a){b[a.type]&&b[a.type].Bin&&e.tabs.push(new b[a.type].Bin(e,a))});var j=!1;this.$.find(".Rk-Bins").on("click",".Rk-Bin-Title,.Rk-Bin-Title-Icon",function(){var a=b.$(this).siblings(".Rk-Bin-Main");a.is(":hidden")&&(e.$.find(".Rk-Bin-Main").slideUp(),a.slideDown())}),this.options.show_editor&&this.$.find(".Rk-Bins").on("mouseover",".Rk-Bin-Item",function(){var a=b.$(this);if(a&&c(a).attr("data-uri")){var f=e.project.get("nodes").where({uri:c(a).attr("data-uri")});d(f).each(function(a){e.renderer.highlightModel(a)})}}).mouseout(function(){e.renderer.unhighlightAll()}).on("mousemove",".Rk-Bin-Item",function(){try{this.dragDrop()}catch(a){}}).on("touchstart",".Rk-Bin-Item",function(){j=!1}).on("touchmove",".Rk-Bin-Item",function(a){a.preventDefault();var b=a.originalEvent.changedTouches[0],c=e.renderer.canvas_$.offset(),d=e.renderer.canvas_$.width(),f=e.renderer.canvas_$.height();if(b.pageX>=c.left&&b.pageX<c.left+d&&b.pageY>=c.top&&b.pageY<c.top+f)if(j)e.renderer.onMouseMove(b,!0);else{j=!0;var g=document.createElement("div");g.appendChild(this.cloneNode(!0)),e.renderer.dropData({"text/html":g.innerHTML},b),e.renderer.onMouseDown(b,!0)}}).on("touchend",".Rk-Bin-Item",function(a){j&&e.renderer.onMouseUp(a.originalEvent.changedTouches[0],!0),j=!1}).on("dragstart",".Rk-Bin-Item",function(a){var b=document.createElement("div");b.appendChild(this.cloneNode(!0));try{a.originalEvent.dataTransfer.setData("text/html",b.innerHTML)}catch(c){a.originalEvent.dataTransfer.setData("text",b.innerHTML)}}),b.$(window).resize(function(){e.resizeBins()});var k=!1,l="";this.$.find(".Rk-Bins-Search-Input").on("change keyup paste input",function(){var a=b.$(this).val();if(a!==l){var c=b.Utils.regexpFromTextOrArray(a.length>1?a:null);c.source!==k&&(k=c.source,d(e.tabs).each(function(a){a.render(c)}))}}),this.$.find(".Rk-Bins-Search-Form").submit(function(){return!1})};f.prototype.template=d.template('<% if (options.show_bins) { %><div class="Rk-Bins"><div class="Rk-Bins-Head"><h2 class="Rk-Bins-Title"><%- translate("Select contents:")%></h2><form class="Rk-Web-Search-Form Rk-Search-Form"><input class="Rk-Web-Search-Input Rk-Search-Input" type="search" placeholder="<%- translate("Search the Web") %>" /><div class="Rk-Search-Select"><div class="Rk-Search-Current"></div><ul class="Rk-Search-List"></ul></div><input type="submit" value="" class="Rk-Web-Search-Submit Rk-Search-Submit" title="<%- translate("Search the Web") %>" /></form><form class="Rk-Bins-Search-Form Rk-Search-Form"><input class="Rk-Bins-Search-Input Rk-Search-Input" type="search" placeholder="<%- translate("Search in Bins") %>" /><input type="submit" value="" class="Rk-Bins-Search-Submit Rk-Search-Submit" title="<%- translate("Search in Bins") %>" /></form></div><ul class="Rk-Bin-List"></ul></div><% } %><% if (options.show_editor) { %><div class="Rk-Render Rk-Render-<% if (options.show_bins) { %>Panel<% } else { %>Full<% } %>"></div><% } %>'),f.prototype.translate=function(a){return b.i18n[this.options.language]&&b.i18n[this.options.language][a]?b.i18n[this.options.language][a]:this.options.language.length>2&&b.i18n[this.options.language.substr(0,2)]&&b.i18n[this.options.language.substr(0,2)][a]?b.i18n[this.options.language.substr(0,2)][a]:a},f.prototype.onStatusChange=function(){this.renderer.onStatusChange()},f.prototype.setSearchEngine=function(a){this.search_engine=this.search_engines[a],this.$.find(".Rk-Search-Current").attr("class","Rk-Search-Current "+this.search_engine.getBgClass());for(var b=this.search_engine.getBgClass().split(" "),c="",d=0;d<b.length;d++)c+="."+b[d];this.$.find(".Rk-Web-Search-Input.Rk-Search-Input").attr("placeholder",this.translate("Search in ")+this.$.find(".Rk-Search-List "+c).html())},f.prototype.resizeBins=function(){var a=+this.$.find(".Rk-Bins-Head").outerHeight();this.$.find(".Rk-Bin-Title:visible").each(function(){a+=b.$(this).outerHeight()}),this.$.find(".Rk-Bin-Main").css({height:this.$.find(".Rk-Bins").height()-a})};var g=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)})};b.Utils={getUUID4:g,getUID:function(){function a(a){return 10>a?"0"+a:a}var b=new Date,c=0,d=b.getUTCFullYear()+"-"+a(b.getUTCMonth()+1)+"-"+a(b.getUTCDate())+"-"+g();return function(a){for(var b=(++c).toString(16),e="undefined"==typeof a?"":a+"-";b.length<4;)b="0"+b;return e+d+"-"+b}}(),getFullURL:function(a){if("undefined"==typeof a||null==a)return"";if(/https?:\/\//.test(a))return a;var b=new Image;b.src=a;var c=b.src;return b.src=null,c},inherit:function(a,b){var c=function(){"function"==typeof b&&b.apply(this,Array.prototype.slice.call(arguments,0)),a.apply(this,Array.prototype.slice.call(arguments,0)),"function"!=typeof this._init||this._initialized||(this._init.apply(this,Array.prototype.slice.call(arguments,0)),this._initialized=!0)};return d(c.prototype).extend(a.prototype),c},regexpFromTextOrArray:function(){function a(a){function b(a){return function(b,c){a=a.replace(h[b],c)}}for(var e=a.toLowerCase().replace(g,""),i="",j=0;j<e.length;j++){j&&(i+=f+"*");var k=e[j];d(c).each(b(k)),i+=k}return i}function b(c){switch(typeof c){case"string":return a(c);case"object":var e="";return d(c).each(function(a){var c=b(a);c&&(e&&(e+="|"),e+=c)}),e}return""}var c=["[aáàâä]","[cç]","[eéèêë]","[iíìîï]","[oóòôö]","[uùûü]"],e=[String.fromCharCode(768),String.fromCharCode(769),String.fromCharCode(770),String.fromCharCode(771),String.fromCharCode(807),"{","}","(",")","[","]","【","】","、","・","‥","。","「","」","『","』","〜",":","!","?"," ",","," ",";","(",")",".","*","+","\\","?","|","{","}","[","]","^","#","/"],f="[\\"+e.join("\\")+"]",g=new RegExp(f,"gm"),h=d(c).map(function(a){return new RegExp(a)});return function(a){var c=b(a);if(c){var d=new RegExp(c,"im"),e=new RegExp("("+c+")","igm");return{isempty:!1,source:c,test:function(a){return d.test(a)},replace:function(a,b){return a.replace(e,b)}}}return{isempty:!0,source:"",test:function(){return!0},replace:function(){return text}}}}(),_MIN_DRAG_DISTANCE:2,_NODE_BUTTON_WIDTH:40,_EDGE_BUTTON_INNER:2,_EDGE_BUTTON_OUTER:40,_CLICKMODE_ADDNODE:1,_CLICKMODE_STARTEDGE:2,_CLICKMODE_ENDEDGE:3,_NODE_SIZE_STEP:Math.LN2/4,_MIN_SCALE:.05,_MAX_SCALE:20,_MOUSEMOVE_RATE:80,_DOUBLETAP_DELAY:800,_DOUBLETAP_DISTANCE:400,_USER_PLACEHOLDER:function(a){return{color:a.options.default_user_color,title:a.translate("(unknown user)"),get:function(a){return this[a]||!1}}},_BOOKMARKLET_CODE:function(a){return"(function(a,b,c,d,e,f,h,i,j,k,l,m,n,o,p,q,r){a=document;b=a.body;c=a.location.href;j='draggable';m='text/x-iri-';d=a.createElement('div');d.innerHTML='<p_style=\"position:fixed;top:0;right:0;font:bold_18px_sans-serif;color:#fff;background:#909;padding:10px;z-index:100000;\">"+a.translate("Drag items from this website, drop them in Renkan").replace(/ /g,"_")+"</p>'.replace(/_/g,String.fromCharCode(32));b.appendChild(d);e=[{r:/https?:\\/\\/[^\\/]*twitter\\.com\\//,s:'.tweet',n:'twitter'},{r:/https?:\\/\\/[^\\/]*google\\.[^\\/]+\\//,s:'.g',n:'google'},{r:/https?:\\/\\/[^\\/]*lemonde\\.fr\\//,s:'[data-vr-contentbox]',n:'lemonde'}];f=false;e.forEach(function(g){if(g.r.test(c)){f=g;}});if(f){h=function(){Array.prototype.forEach.call(a.querySelectorAll(f.s),function(i){i[j]=true;k=i.style;k.borderWidth='2px';k.borderColor='#909';k.borderStyle='solid';k.backgroundColor='rgba(200,0,180,.1)';})};window.setInterval(h,500);h();};a.addEventListener('dragstart',function(k){l=k.dataTransfer;l.setData(m+'source-uri',c);l.setData(m+'source-title',a.title);n=k.target;if(f){o=n;while(!o.attributes[j]){o=o.parentNode;if(o==b){break;}}}if(f&&o.attributes[j]){p=o.cloneNode(true);l.setData(m+'specific-site',f.n)}else{q=a.getSelection();if(q.type==='Range'||!q.type){p=q.getRangeAt(0).cloneContents();}else{p=n.cloneNode();}}r=a.createElement('div');r.appendChild(p);l.setData('text/x-iri-selected-text',r.textContent.trim());l.setData('text/x-iri-selected-html',r.innerHTML);},false);})();"},shortenText:function(a,b){return a.length>b?a.substr(0,b)+"…":a},drawEditBox:function(a,b,c,d,e){e.css({width:a.tooltip_width-2*a.tooltip_padding});var f=e.outerHeight()+2*a.tooltip_padding,g=b.x<paper.view.center.x?1:-1,h=b.x+g*(d+a.tooltip_arrow_length),i=b.x+g*(d+a.tooltip_arrow_length+a.tooltip_width),j=b.y-f/2;j+f>paper.view.size.height-a.tooltip_margin&&(j=Math.max(paper.view.size.height-a.tooltip_margin,b.y+a.tooltip_arrow_width/2)-f),j<a.tooltip_margin&&(j=Math.min(a.tooltip_margin,b.y-a.tooltip_arrow_width/2));var k=j+f;return c.segments[0].point=c.segments[7].point=b.add([g*d,0]),c.segments[1].point.x=c.segments[2].point.x=c.segments[5].point.x=c.segments[6].point.x=h,c.segments[3].point.x=c.segments[4].point.x=i,c.segments[2].point.y=c.segments[3].point.y=j,c.segments[4].point.y=c.segments[5].point.y=k,c.segments[1].point.y=b.y-a.tooltip_arrow_width/2,c.segments[6].point.y=b.y+a.tooltip_arrow_width/2,c.closed=!0,c.fillColor=new paper.GradientColor(new paper.Gradient([a.tooltip_top_color,a.tooltip_bottom_color]),[0,j],[0,k]),e.css({left:a.tooltip_padding+Math.min(h,i),top:a.tooltip_padding+j}),c}}}(window),function(){"use strict";var a=this,b=a.Backbone,c=a.Rkns.Models={};c.getUID=function(a){var b="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)});return"undefined"!=typeof a?a.type+"-"+b:b};{var d=b.RelationalModel.extend({idAttribute:"_id",constructor:function(a){"undefined"!=typeof a&&(a._id=a._id||a.id||c.getUID(this),a.title=a.title||"",a.description=a.description||"",a.uri=a.uri||"","function"==typeof this.prepare&&(a=this.prepare(a))),b.RelationalModel.prototype.constructor.call(this,a)},validate:function(){return this.type?void 0:"object has no type"},addReference:function(a,b,c,d,e){var f=c.get(d);a[b]="undefined"==typeof f&&"undefined"!=typeof e?e:f}}),e=c.User=d.extend({type:"user",prepare:function(a){return a.color=a.color||"#666666",a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),color:this.get("color")}}}),f=c.Node=d.extend({type:"node",relations:[{type:b.HasOne,key:"created_by",relatedModel:e}],prepare:function(a){var b=a.project;return this.addReference(a,"created_by",b.get("users"),a.created_by,b.current_user),a.description=a.description||"",a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),position:this.get("position"),image:this.get("image"),color:this.get("color"),created_by:this.get("created_by")?this.get("created_by").get("_id"):null,size:this.get("size"),clip_path:this.get("clip_path"),shape:this.get("shape")}}}),g=c.Edge=d.extend({type:"edge",relations:[{type:b.HasOne,key:"created_by",relatedModel:e},{type:b.HasOne,key:"from",relatedModel:f},{type:b.HasOne,key:"to",relatedModel:f}],prepare:function(a){var b=a.project;return this.addReference(a,"created_by",b.get("users"),a.created_by,b.current_user),this.addReference(a,"from",b.get("nodes"),a.from),this.addReference(a,"to",b.get("nodes"),a.to),a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),from:this.get("from")?this.get("from").get("_id"):null,to:this.get("to")?this.get("to").get("_id"):null,color:this.get("color"),created_by:this.get("created_by")?this.get("created_by").get("_id"):null}}}),h=c.View=d.extend({type:"view",relations:[{type:b.HasOne,key:"created_by",relatedModel:e}],prepare:function(a){var b=a.project;if(this.addReference(a,"created_by",b.get("users"),a.created_by,b.current_user),a.description=a.description||"","undefined"!=typeof a.offset){var c={};Array.isArray(a.offset)?(c.x=a.offset[0],c.y=a.offset.length>1?a.offset[1]:a.offset[0]):null!=a.offset.x&&(c.x=a.offset.x,c.y=a.offset.y),a.offset=c}return a},toJSON:function(){return{_id:this.get("_id"),zoom_level:this.get("zoom_level"),offset:this.get("offset"),title:this.get("title"),description:this.get("description"),created_by:this.get("created_by")?this.get("created_by").get("_id"):null}}}),i=(c.Project=d.extend({type:"project",blacklist:["save_status"],relations:[{type:b.HasMany,key:"users",relatedModel:e,reverseRelation:{key:"project",includeInJSON:"_id"}},{type:b.HasMany,key:"nodes",relatedModel:f,reverseRelation:{key:"project",includeInJSON:"_id"}},{type:b.HasMany,key:"edges",relatedModel:g,reverseRelation:{key:"project",includeInJSON:"_id"}},{type:b.HasMany,key:"views",relatedModel:h,reverseRelation:{key:"project",includeInJSON:"_id"}}],addUser:function(a,b){a.project=this;var c=e.findOrCreate(a);return this.get("users").push(c,b),c},addNode:function(a,b){a.project=this;var c=f.findOrCreate(a);return this.get("nodes").push(c,b),c},addEdge:function(a,b){a.project=this;var c=g.findOrCreate(a);return this.get("edges").push(c,b),c},addView:function(a,b){a.project=this;var c=h.findOrCreate(a);return this.get("views").push(c,b),c},removeNode:function(a){this.get("nodes").remove(a)},removeEdge:function(a){this.get("edges").remove(a)},validate:function(a){var b=this;_([].concat(a.users,a.nodes,a.edges,a.views)).each(function(a){a&&(a.project=b)})},initialize:function(){var a=this;this.on("remove:nodes",function(b){a.get("edges").remove(a.get("edges").filter(function(a){return a.get("from")===b||a.get("to")===b}))})},toJSON:function(){var a=_.clone(this.attributes);for(var c in a)(a[c]instanceof b.Model||a[c]instanceof b.Collection||a[c]instanceof d)&&(a[c]=a[c].toJSON());return _.omit(a,this.blacklist)}}),c.RosterUser=b.Model.extend({type:"roster_user",idAttribute:"_id",constructor:function(a){"undefined"!=typeof a&&(a._id=a._id||a.id||c.getUID(this),a.title=a.title||"(untitled "+this.type+")",a.description=a.description||"",a.uri=a.uri||"",a.project=a.project||null,a.site_id=a.site_id||0,"function"==typeof this.prepare&&(a=this.prepare(a))),b.Model.prototype.constructor.call(this,a)},validate:function(){return this.type?void 0:"object has no type"},prepare:function(a){return a.color=a.color||"#666666",a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),color:this.get("color"),project:null!=this.get("project")?this.get("project").get("id"):null,site_id:this.get("site_id")}}}));c.UsersList=b.Collection.extend({model:i})}}.call(window),Rkns.defaults={language:navigator.language||navigator.userLanguage||"en",container:"renkan",search:[],bins:[],static_url:"",show_bins:!0,properties:[],show_editor:!0,read_only:!1,editor_mode:!0,manual_save:!1,show_top_bar:!0,default_user_color:"#303030",size_bug_fix:!0,force_resize:!1,allow_double_click:!0,zoom_on_scroll:!0,element_delete_delay:0,autoscale_padding:50,resize:!0,show_zoom:!0,save_view:!0,default_view:!1,show_search_field:!0,show_user_list:!0,user_name_editable:!0,user_color_editable:!0,show_user_color:!0,show_save_button:!0,show_export_button:!0,show_open_button:!1,show_addnode_button:!0,show_addedge_button:!0,show_bookmarklet:!0,show_fullscreen_button:!0,home_button_url:!1,home_button_title:"Home",show_minimap:!0,minimap_width:160,minimap_height:120,minimap_padding:20,minimap_background_color:"#ffffff",minimap_border_color:"#cccccc",minimap_highlight_color:"#ffff00",minimap_highlight_weight:5,buttons_background:"#202020",buttons_label_color:"#c000c0",buttons_label_font_size:9,show_node_circles:!0,clip_node_images:!0,node_images_fill_mode:!1,node_size_base:25,node_stroke_width:2,selected_node_stroke_width:4,node_fill_color:"#ffffff",highlighted_node_fill_color:"#ffff00",node_label_distance:5,node_label_max_length:60,label_untitled_nodes:"(untitled)",change_shapes:!0,edge_stroke_width:2,selected_edge_stroke_width:4,edge_label_distance:0,edge_label_max_length:20,edge_arrow_length:18,edge_arrow_width:12,edge_gap_in_bundles:12,label_untitled_edges:"",tooltip_width:275,tooltip_padding:10,tooltip_margin:15,tooltip_arrow_length:20,tooltip_arrow_width:40,tooltip_top_color:"#f0f0f0",tooltip_bottom_color:"#d0d0d0",tooltip_border_color:"#808080",tooltip_border_width:1,show_node_editor_uri:!0,show_node_editor_description:!0,show_node_editor_size:!0,show_node_editor_color:!0,show_node_editor_image:!0,show_node_editor_creator:!0,allow_image_upload:!0,uploaded_image_max_kb:500,show_node_tooltip_uri:!0,show_node_tooltip_description:!0,show_node_tooltip_color:!0,show_node_tooltip_image:!0,show_node_tooltip_creator:!0,show_edge_editor_uri:!0,show_edge_editor_color:!0,show_edge_editor_direction:!0,show_edge_editor_nodes:!0,show_edge_editor_creator:!0,show_edge_tooltip_uri:!0,show_edge_tooltip_color:!0,show_edge_tooltip_nodes:!0,show_edge_tooltip_creator:!0},Rkns.i18n={fr:{"Edit Node":"Édition d’un nœud","Edit Edge":"Édition d’un lien","Title:":"Titre :","URI:":"URI :","Description:":"Description :","From:":"De :","To:":"Vers :",Image:"Image","Image URL:":"URL d'Image","Choose Image File:":"Choisir un fichier image","Full Screen":"Mode plein écran","Add Node":"Ajouter un nœud","Add Edge":"Ajouter un lien","Save Project":"Enregistrer le projet","Open Project":"Ouvrir un projet","Auto-save enabled":"Enregistrement automatique activé","Connection lost":"Connexion perdue","Created by:":"Créé par :","Zoom In":"Agrandir l’échelle","Zoom Out":"Rapetisser l’échelle",Edit:"Éditer",Remove:"Supprimer","Cancel deletion":"Annuler la suppression","Link to another node":"Créer un lien",Enlarge:"Agrandir",Shrink:"Rétrécir","Click on the background canvas to add a node":"Cliquer sur le fond du graphe pour rajouter un nœud","Click on a first node to start the edge":"Cliquer sur un premier nœud pour commencer le lien","Click on a second node to complete the edge":"Cliquer sur un second nœud pour terminer le lien",Wikipedia:"Wikipédia","Wikipedia in ":"Wikipédia en ",French:"Français",English:"Anglais",Japanese:"Japonais","Untitled project":"Projet sans titre","Lignes de Temps":"Lignes de Temps","Loading, please wait":"Chargement en cours, merci de patienter","Edge color:":"Couleur :","Node color:":"Couleur :","Choose color":"Choisir une couleur","Change edge direction":"Changer le sens du lien","Do you really wish to remove node ":"Voulez-vous réellement supprimer le nœud ","Do you really wish to remove edge ":"Voulez-vous réellement supprimer le lien ","This file is not an image":"Ce fichier n'est pas une image","Image size must be under ":"L'image doit peser moins de ","Size:":"Taille :",KB:"ko","Choose from vocabulary:":"Choisir dans un vocabulaire :","SKOS Documentation properties":"SKOS: Propriétés documentaires","has note":"a pour note","has example":"a pour exemple","has definition":"a pour définition","SKOS Semantic relations":"SKOS: Relations sémantiques","has broader":"a pour concept plus large","has narrower":"a pour concept plus étroit","has related":"a pour concept apparenté","Dublin Core Metadata":"Métadonnées Dublin Core","has contributor":"a pour contributeur",covers:"couvre","created by":"créé par","has date":"a pour date","published by":"édité par","has source":"a pour source","has subject":"a pour sujet","Dragged resource":"Ressource glisée-déposée","Search the Web":"Rechercher en ligne","Search in Bins":"Rechercher dans les chutiers","Close bin":"Fermer le chutier","Refresh bin":"Rafraîchir le chutier","(untitled)":"(sans titre)","Select contents:":"Sélectionner des contenus :","Drag items from this website, drop them in Renkan":"Glissez des éléments de ce site web vers Renkan","Drag this button to your bookmark bar. When on a third-party website, click it to enable drag-and-drop from the website to Renkan.":"Glissez ce bouton vers votre barre de favoris. Ensuite, depuis un site tiers, cliquez dessus pour activer 'Drag-to-Add' puis glissez des éléments de ce site vers Renkan","Shapes available":"Formes disponibles",Circle:"Cercle",Square:"Carré",Diamond:"Losange",Hexagone:"Hexagone",Ellipse:"Ellipse",Star:"Étoile","Zoom Fit":"Ajuster le Zoom","Download Project":"Télécharger le projet","Zoom Save":"Sauver le Zoom","View saved zoom":"Restaurer le Zoom","Renkan 'Drag-to-Add' bookmarklet":"Renkan 'Deplacer-Pour-Ajouter' Signet","(unknown user)":"(non authentifié)","<unknown user>":"<non authentifié>","Search in graph":"Rechercher dans carte","Search in ":"Chercher dans "}},Rkns.jsonIO=function(a,b){var c=a.project;"undefined"==typeof b.http_method&&(b.http_method="PUT");var d=function(){a.renderer.redrawActive=!1,c.set({loading_status:!0}),Rkns.$.getJSON(b.url,function(b){c.set(b,{validate:!0}),c.set({loading_status:!1}),c.set({save_status:0}),a.renderer.redrawActive=!0,a.renderer.fixSize()})},e=function(){c.set({save_status:2});var d=c.toJSON();a.read_only||Rkns.$.ajax({type:b.http_method,url:b.url,contentType:"application/json",data:JSON.stringify(d),success:function(){c.set({save_status:0})}})},f=Rkns._.throttle(function(){setTimeout(e,100)},1e3);c.on("add:nodes add:edges add:users add:views",function(a){a.on("change remove",function(){f()}),f()}),c.on("change",function(){1===c.changedAttributes.length&&c.hasChanged("save_status")||f()}),d()},Rkns.jsonIOSaveOnClick=function(a,b){var c=a.project,d=!1,e=function(){return"Project not saved"};"undefined"==typeof b.http_method&&(b.http_method="POST");var f=function(){var d={},e=/id=([^&#?=]+)/,f=document.location.hash.match(e);f&&(d.id=f[1]),Rkns.$.ajax({url:b.url,data:d,beforeSend:function(){c.set({loading_status:!0})},success:function(b){c.set(b,{validate:!0}),c.set({loading_status:!1}),c.set({save_status:0}),a.renderer.autoScale()}})},g=function(){c.set("saved_at",new Date);var a=c.toJSON();Rkns.$.ajax({type:b.http_method,url:b.url,contentType:"application/json",data:JSON.stringify(a),beforeSend:function(){c.set({save_status:2})},success:function(){$(window).off("beforeunload",e),d=!1,c.set({save_status:0})}})},h=function(){c.set({save_status:1});var a=c.get("title");a&&c.get("nodes").length?$(".Rk-Save-Button").removeClass("disabled"):$(".Rk-Save-Button").addClass("disabled"),a&&$(".Rk-PadTitle").css("border-color","#333333"),d||(d=!0,$(window).on("beforeunload",e))};f(),c.on("add:nodes add:edges add:users change",function(a){a.on("change remove",function(a){1===a.changedAttributes.length&&a.hasChanged("save_status")||h()}),1===c.changedAttributes.length&&c.hasChanged("save_status")||h()}),a.renderer.save=function(){$(".Rk-Save-Button").hasClass("disabled")?c.get("title")||$(".Rk-PadTitle").css("border-color","#ff0000"):g()}},function(a){"use strict";var b=a._,c=a.Ldt={},d=(c.Bin=function(a,b){if(b.ldt_type){var d=c[b.ldt_type+"Bin"];if(d)return new d(a,b)}console.error("No such LDT Bin Type")},c.ProjectBin=a.Utils.inherit(a._BaseBin));d.prototype.tagTemplate=renkanJST["templates/ldtjson-bin/tagtemplate.html"],d.prototype.annotationTemplate=renkanJST["templates/ldtjson-bin/annotationtemplate.html"],d.prototype._init=function(a,b){this.renkan=a,this.proj_id=b.project_id,this.ldt_platform=b.ldt_platform||"http://ldt.iri.centrepompidou.fr/",this.title_$.html(b.title),this.title_icon_$.addClass("Rk-Ldt-Title-Icon"),this.refresh()},d.prototype.render=function(c){function d(a){var c=b(a).escape();return f.isempty?c:f.replace(c,"<span class='searchmatch'>$1</span>")}function e(a){function b(a){for(var b=a.toString();b.length<2;)b="0"+b;return b}var c=Math.abs(Math.floor(a/1e3)),d=Math.floor(c/3600),e=Math.floor(c/60)%60,f=c%60,g="";return d&&(g+=b(d)+":"),g+=b(e)+":"+b(f)}var f=c||a.Utils.regexpFromTextOrArray(),g="<li><h3>Tags</h3></li>",h=this.data.meta["dc:title"],i=this,j=0;i.title_$.text('LDT Project: "'+h+'"'),b(i.data.tags).map(function(a){var b=a.meta["dc:title"];(f.isempty||f.test(b))&&(j++,g+=i.tagTemplate({ldt_platform:i.ldt_platform,title:b,htitle:d(b),encodedtitle:encodeURIComponent(b),static_url:i.renkan.options.static_url}))}),g+="<li><h3>Annotations</h3></li>",b(i.data.annotations).map(function(a){var b=a.content.description,c=a.content.title.replace(b,"");if(f.isempty||f.test(c)||f.test(b)){j++;var h=a.end-a.begin,k=a.content&&a.content.img&&a.content.img.src?a.content.img.src:h?i.renkan.options.static_url+"img/ldt-segment.png":i.renkan.options.static_url+"img/ldt-point.png";g+=i.annotationTemplate({ldt_platform:i.ldt_platform,title:c,htitle:d(c),description:b,hdescription:d(b),start:e(a.begin),end:e(a.end),duration:e(h),mediaid:a.media,annotationid:a.id,image:k,static_url:i.renkan.options.static_url})}}),this.main_$.html(g),!f.isempty&&j?this.count_$.text(j).show():this.count_$.hide(),f.isempty||j?this.$.show():this.$.hide(),this.renkan.resizeBins()},d.prototype.refresh=function(){var b=this;a.$.ajax({url:this.ldt_platform+"ldtplatform/ldt/cljson/id/"+this.proj_id,dataType:"jsonp",success:function(a){b.data=a,b.render()}})};var e=c.Search=function(a,b){this.renkan=a,this.lang=b.lang||"en"};e.prototype.getBgClass=function(){return"Rk-Ldt-Icon"},e.prototype.getSearchTitle=function(){return this.renkan.translate("Lignes de Temps")},e.prototype.search=function(a){this.renkan.tabs.push(new f(this.renkan,{search:a}))};var f=c.ResultsBin=a.Utils.inherit(a._BaseBin);f.prototype.segmentTemplate=renkanJST["templates/ldtjson-bin/segmenttemplate.html"],f.prototype._init=function(a,b){this.renkan=a,this.ldt_platform=b.ldt_platform||"http://ldt.iri.centrepompidou.fr/",this.max_results=b.max_results||50,this.search=b.search,this.title_$.html('Lignes de Temps: "'+b.search+'"'),this.title_icon_$.addClass("Rk-Ldt-Title-Icon"),this.refresh()},f.prototype.render=function(c){function d(a){return g.replace(b(a).escape(),"<span class='searchmatch'>$1</span>")}function e(a){function b(a){for(var b=a.toString();b.length<2;)b="0"+b;return b}var c=Math.abs(Math.floor(a/1e3)),d=Math.floor(c/3600),e=Math.floor(c/60)%60,f=c%60,g="";return d&&(g+=b(d)+":"),g+=b(e)+":"+b(f)}if(this.data){var f=c||a.Utils.regexpFromTextOrArray(),g=f.isempty?a.Utils.regexpFromTextOrArray(this.search):f,h="",i=this,j=0;b(this.data.objects).each(function(a){var b=a["abstract"],c=a.title;if(f.isempty||f.test(c)||f.test(b)){j++;var g=a.duration,k=a.start_ts,l=+a.duration+k,m=g?i.renkan.options.static_url+"img/ldt-segment.png":i.renkan.options.static_url+"img/ldt-point.png";h+=i.segmentTemplate({ldt_platform:i.ldt_platform,title:c,htitle:d(c),description:b,hdescription:d(b),start:e(k),end:e(l),duration:e(g),mediaid:a.iri_id,annotationid:a.element_id,image:m})}}),this.main_$.html(h),!f.isempty&&j?this.count_$.text(j).show():this.count_$.hide(),f.isempty||j?this.$.show():this.$.hide(),this.renkan.resizeBins()}},f.prototype.refresh=function(){var b=this;a.$.ajax({url:this.ldt_platform+"ldtplatform/api/ldt/1.0/segments/search/",data:{format:"jsonp",q:this.search,limit:this.max_results},dataType:"jsonp",success:function(a){b.data=a,b.render()}})}}(window.Rkns),Rkns.ResourceList={},Rkns.ResourceList.Bin=Rkns.Utils.inherit(Rkns._BaseBin),Rkns.ResourceList.Bin.prototype.resultTemplate=Rkns._.template('<li class="Rk-Bin-Item Rk-ResourceList-Item" draggable="true" data-uri="<%-url%>" data-title="<%-title%>" data-description="<%-description%>" <% if (image) { %>data-image="<%- Rkns.Utils.getFullURL(image) %>"<% } else { %>data-image=""<% } %> ><% if (image) { %><img class="Rk-ResourceList-Image" src="<%-image%>"/><% } %><h4 class="Rk-ResourceList-Title"><% if (url) { %><a href="<%-url%>" target="_blank"><% } %><%=htitle%><% if (url) { %></a><% } %></h4><% if (description) { %><p class="Rk-ResourceList-Description"><%=hdescription%></p><% } %><% if (image) { %><div style="clear: both;"></div><% } %></li>'),Rkns.ResourceList.Bin.prototype._init=function(a,b){this.renkan=a,this.title_$.html(b.title),b.list&&(this.data=b.list),this.refresh()},Rkns.ResourceList.Bin.prototype.render=function(a){function b(a){var b=_(a).escape();return c.isempty?b:c.replace(b,"<span class='searchmatch'>$1</span>")}var c=a||Rkns.Utils.regexpFromTextOrArray(),d="",e=this,f=0;Rkns._(this.data).each(function(a){var g;if("string"==typeof a)if(/^(https?:\/\/|www)/.test(a))g={url:a};else{g={title:a.replace(/[:,]?\s?(https?:\/\/|www)[\d\w\/.&?=#%-_]+\s?/,"").trim()};var h=a.match(/(https?:\/\/|www)[\d\w\/.&?=#%-_]+/);h&&(g.url=h[0]),g.title.length>80&&(g.description=g.title,g.title=g.title.replace(/^(.{30,60})\s.+$/,"$1…"))
-}else g=a;var i=g.title||(g.url||"").replace(/^https?:\/\/(www\.)?/,"").replace(/^(.{40}).+$/,"$1…"),j=g.url||"",k=g.description||"",l=g.image||"";j&&!/^https?:\/\//.test(j)&&(j="http://"+j),(c.isempty||c.test(i)||c.test(k))&&(f++,d+=e.resultTemplate({url:j,title:i,htitle:b(i),image:l,description:k,hdescription:b(k),static_url:e.renkan.options.static_url}))}),e.main_$.html(d),!c.isempty&&f?this.count_$.text(f).show():this.count_$.hide(),c.isempty||f?this.$.show():this.$.hide(),this.renkan.resizeBins()},Rkns.ResourceList.Bin.prototype.refresh=function(){this.data&&this.render()},Rkns.Wikipedia={},Rkns.Wikipedia.Search=function(a,b){this.renkan=a,this.lang=b.lang||"en"},Rkns.Wikipedia.Search.prototype.getBgClass=function(){return"Rk-Wikipedia-Search-Icon Rk-Wikipedia-Lang-"+this.lang},Rkns.Wikipedia.Search.prototype.getSearchTitle=function(){var a={fr:"French",en:"English",ja:"Japanese"};return a[this.lang]?this.renkan.translate("Wikipedia in ")+this.renkan.translate(a[this.lang]):this.renkan.translate("Wikipedia")+" ["+this.lang+"]"},Rkns.Wikipedia.Search.prototype.search=function(a){this.renkan.tabs.push(new Rkns.Wikipedia.Bin(this.renkan,{lang:this.lang,search:a}))},Rkns.Wikipedia.Bin=Rkns.Utils.inherit(Rkns._BaseBin),Rkns.Wikipedia.Bin.prototype.resultTemplate=Rkns._.template('<li class="Rk-Wikipedia-Result Rk-Bin-Item" draggable="true" data-uri="<%-url%>" data-title="Wikipedia: <%-title%>" data-description="<%-description%>" data-image="<%- Rkns.Utils.getFullURL( static_url + \'img/wikipedia.png\' ) %>"><img class="Rk-Wikipedia-Icon" src="<%-static_url%>img/wikipedia.png"></div><h4 class="Rk-Wikipedia-Title"><a href="<%-url%>" target="_blank"><%=htitle%></a></h4><p class="Rk-Wikipedia-Snippet"><%=hdescription%></p></li>'),Rkns.Wikipedia.Bin.prototype._init=function(a,b){this.renkan=a,this.search=b.search,this.lang=b.lang||"en",this.title_icon_$.addClass("Rk-Wikipedia-Title-Icon Rk-Wikipedia-Lang-"+this.lang),this.title_$.html(this.search).addClass("Rk-Wikipedia-Title"),this.refresh()},Rkns.Wikipedia.Bin.prototype.render=function(a){function b(a){return d.replace(_(a).escape(),"<span class='searchmatch'>$1</span>")}var c=a||Rkns.Utils.regexpFromTextOrArray(),d=c.isempty?Rkns.Utils.regexpFromTextOrArray(this.search):c,e="",f=this,g=0;Rkns._(this.data.query.search).each(function(a){var d=a.title,h="http://"+f.lang+".wikipedia.org/wiki/"+encodeURI(d.replace(/ /g,"_")),i=Rkns.$("<div>").html(a.snippet).text();(c.isempty||c.test(d)||c.test(i))&&(g++,e+=f.resultTemplate({url:h,title:d,htitle:b(d),description:i,hdescription:b(i),static_url:f.renkan.options.static_url}))}),f.main_$.html(e),!c.isempty&&g?this.count_$.text(g).show():this.count_$.hide(),c.isempty||g?this.$.show():this.$.hide(),this.renkan.resizeBins()},Rkns.Wikipedia.Bin.prototype.refresh=function(){var a=this;Rkns.$.ajax({url:"http://"+a.lang+".wikipedia.org/w/api.php?action=query&list=search&srsearch="+encodeURIComponent(this.search)+"&format=json",dataType:"jsonp",success:function(b){a.data=b,a.render()}})},define("renderer/baserepresentation",["jquery","underscore"],function(a,b){var c=function(a,c){if("undefined"!=typeof a&&(this.renderer=a,this.renkan=a.renkan,this.project=a.renkan.project,this.options=a.renkan.options,this.model=c,this.model)){var d=this;this._changeBinding=function(){d.redraw()},this._removeBinding=function(){a.removeRepresentation(d),b(function(){a.redraw()}).defer()},this._selectBinding=function(){d.select()},this._unselectBinding=function(){d.unselect()},this.model.on("change",this._changeBinding),this.model.on("remove",this._removeBinding),this.model.on("select",this._selectBinding),this.model.on("unselect",this._unselectBinding)}};return b(c.prototype).extend({_super:function(a){return c.prototype[a].apply(this,Array.prototype.slice.call(arguments,1))},redraw:function(){},moveTo:function(){},show:function(){return"BaseRepresentation.show"},hide:function(){},select:function(){this.model&&this.model.trigger("selected")},unselect:function(){this.model&&this.model.trigger("unselected")},highlight:function(){},unhighlight:function(){},mousedown:function(){},mouseup:function(){this.model&&this.model.trigger("clicked")},destroy:function(){this.model&&(this.model.off("change",this._changeBinding),this.model.off("remove",this._removeBinding),this.model.off("select",this._selectBinding),this.model.off("unselect",this._unselectBinding))}}),c}),define("requtils",[],function(){return{getUtils:function(){return window.Rkns.Utils},getRenderer:function(){return window.Rkns.Renderer}}}),define("renderer/basebutton",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({moveTo:function(a){this.sector.moveTo(a)},show:function(){this.sector.show()},hide:function(){this.sector.hide()},select:function(){this.sector.select()},unselect:function(a){this.sector.unselect(),(!a||a!==this.source_representation&&a.source_representation!==this.source_representation)&&this.source_representation.unselect()},destroy:function(){this.sector.destroy()}}),f}),define("renderer/shapebuilder",[],function(){var a={circle:{getShape:function(){return new paper.Path.Circle([0,0],1)},getImageShape:function(a,b){return new paper.Path.Circle(a,b)}},rectangle:{getShape:function(){return new paper.Path.Rectangle([-2,-2],[2,2])},getImageShape:function(a,b){return new paper.Path.Rectangle([-b,-b],[2*b,2*b])}},ellipse:{getShape:function(){return new paper.Path.Ellipse(new paper.Rectangle([-2,-1],[2,1]))},getImageShape:function(a,b){return new paper.Path.Ellipse(new paper.Rectangle([-b,-b/2],[2*b,b]))}},polygon:{getShape:function(){return new paper.Path.RegularPolygon([0,0],6,1)},getImageShape:function(a,b){return new paper.Path.RegularPolygon([0,0],6,b)}},diamond:{getShape:function(){var a=new paper.Path.Rectangle([-2,-2],[2,2]);return a.rotate(45),a},getImageShape:function(a,b){var c=new paper.Path.Rectangle([-b,-b],[2*b,2*b]);return c.rotate(45),c}},star:{getShape:function(){return new paper.Path.Star([0,0],8,1,.7)},getImageShape:function(a,b){return new paper.Path.Star([0,0],8,1*b,.7*b)}},svg:function(a){return{getShape:function(){return new paper.Path(a)},getImageShape:function(){return new paper.Path}}}},b=function(b){return"undefined"==typeof b&&(b="circle"),"svg:"===b.substr(0,4)?a.svg(b.substr(4)):(b in a||(b="circle"),a[b])};return b}),define("renderer/noderepr",["jquery","underscore","requtils","renderer/baserepresentation","renderer/shapebuilder"],function(a,b,c,d,e){var f=c.getUtils(),g=f.inherit(d);return b(g.prototype).extend({_init:function(){if(this.renderer.node_layer.activate(),this.type="Node",this.buildShape(),this.options.show_node_circles?(this.circle.strokeWidth=this.options.node_stroke_width,this.h_ratio=1):this.h_ratio=0,this.title=a('<div class="Rk-Label">').appendTo(this.renderer.labels_$),this.options.editor_mode){var b=c.getRenderer();this.normal_buttons=[new b.NodeEditButton(this.renderer,null),new b.NodeRemoveButton(this.renderer,null),new b.NodeLinkButton(this.renderer,null),new b.NodeEnlargeButton(this.renderer,null),new b.NodeShrinkButton(this.renderer,null)],this.pending_delete_buttons=[new b.NodeRevertButton(this.renderer,null)],this.all_buttons=this.normal_buttons.concat(this.pending_delete_buttons);for(var d=0;d<this.all_buttons.length;d++)this.all_buttons[d].source_representation=this;this.active_buttons=[]}else this.active_buttons=this.all_buttons=[];this.last_circle_radius=1,this.renderer.minimap&&(this.renderer.minimap.node_layer.activate(),this.minimap_circle=new paper.Path.Circle([0,0],1),this.minimap_circle.__representation=this.renderer.minimap.miniframe.__representation,this.renderer.minimap.node_group.addChild(this.minimap_circle))},buildShape:function(){"undefined"!=typeof this.model.get("shape_changed")&&this.model.get("shape_changed")===!0&&(this.model.set("shape_changed",!1),delete this.img),this.circle&&(this.circle.remove(),delete this.circle),this.shapeBuilder=new e(this.model.get("shape")),this.circle=this.shapeBuilder.getShape(),this.circle.__representation=this,this.last_circle_radius=1},redraw:function(a){"undefined"!=typeof this.model.get("shape_changed")&&this.model.get("shape_changed")===!0&&this.buildShape();var c=new paper.Point(this.model.get("position")),d=this.options.node_size_base*Math.exp((this.model.get("size")||0)*f._NODE_SIZE_STEP);this.is_dragging&&this.paper_coords||(this.paper_coords=this.renderer.toPaperCoords(c)),this.circle_radius=d*this.renderer.scale,this.last_circle_radius!==this.circle_radius&&(this.all_buttons.forEach(function(a){a.setSectorSize()}),this.circle.scale(this.circle_radius/this.last_circle_radius),this.node_image&&this.node_image.scale(this.circle_radius/this.last_circle_radius)),this.circle.position=this.paper_coords,this.node_image&&(this.node_image.position=this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius))),this.last_circle_radius=this.circle_radius;var e=this.active_buttons,g=1;this.model.get("delete_scheduled")?(g=.5,this.active_buttons=this.pending_delete_buttons,this.circle.dashArray=[2,2]):(g=1,this.active_buttons=this.normal_buttons,this.circle.dashArray=null),this.selected&&this.renderer.isEditable()&&(e!==this.active_buttons&&e.forEach(function(a){a.hide()}),this.active_buttons.forEach(function(a){a.show()})),this.node_image&&(this.node_image.opacity=this.highlighted?.5*g:g-.01),this.circle.fillColor=this.highlighted?this.options.highlighted_node_fill_color:this.options.node_fill_color,this.circle.opacity=this.options.show_node_circles?g:.01;var h=this.model.get("title")||this.renkan.translate(this.options.label_untitled_nodes)||"";h=f.shortenText(h,this.options.node_label_max_length),"object"==typeof this.highlighted?this.title.html(this.highlighted.replace(b(h).escape(),'<span class="Rk-Highlighted">$1</span>')):this.title.text(h),this.title.css({left:this.paper_coords.x,top:this.paper_coords.y+this.circle_radius*this.h_ratio+this.options.node_label_distance,opacity:g});var i=this.model.get("color")||(this.model.get("created_by")||f._USER_PLACEHOLDER(this.renkan)).get("color");this.circle.strokeColor=i;var j=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(j)});var k=this.img;if(this.img=this.model.get("image"),this.img&&this.img!==k&&this.showImage(),this.node_image&&!this.img&&(this.node_image.remove(),delete this.node_image),this.renderer.minimap){this.minimap_circle.fillColor=i;var l=this.renderer.toMinimapCoords(c),m=this.renderer.minimap.scale*d,n=new paper.Size([m,m]);this.minimap_circle.fitBounds(l.subtract(n),n.multiply(2))}if(!a){var o=this;b.each(this.project.get("edges").filter(function(a){return a.get("to")===o.model||a.get("from")===o.model}),function(a){var b=o.renderer.getRepresentationByModel(a);b&&"undefined"!=typeof b.from_representation&&"undefined"!=typeof b.from_representation.paper_coords&&"undefined"!=typeof b.to_representation&&"undefined"!=typeof b.to_representation.paper_coords&&b.redraw()})}},showImage:function(){var b=null;if("undefined"==typeof this.renderer.image_cache[this.img]?(b=new Image,this.renderer.image_cache[this.img]=b,b.src=this.img):b=this.renderer.image_cache[this.img],b.width){this.node_image&&this.node_image.remove(),this.renderer.node_layer.activate();var c=b.width,d=b.height,e=this.model.get("clip_path"),f="undefined"!=typeof e&&e,g=null,h=null,i=null;if(f){g=new paper.Path;var j=e.match(/[a-z][^a-z]+/gi)||[],k=[0,0],l=1/0,m=1/0,n=-1/0,o=-1/0,p=function(a,b){var e=a.slice(1).map(function(a,e){var f=parseFloat(a),g=e%2;return f=g?(f-.5)*d:(f-.5)*c,b&&(f+=k[g]),g?(m=Math.min(m,f),o=Math.max(o,f)):(l=Math.min(l,f),n=Math.max(n,f)),f});return k=e.slice(-2),e};j.forEach(function(a){var b=a.match(/([a-z]|[0-9.-]+)/gi)||[""];switch(b[0]){case"M":g.moveTo(p(b));break;case"m":g.moveTo(p(b,!0));break;case"L":g.lineTo(p(b));break;case"l":g.lineTo(p(b,!0));break;case"C":g.cubicCurveTo(p(b));break;case"c":g.cubicCurveTo(p(b,!0));break;case"Q":g.quadraticCurveTo(p(b));break;case"q":g.quadraticCurveTo(p(b,!0))}}),h=Math[this.options.node_images_fill_mode?"min":"max"](n-l,o-m)/2,i=new paper.Point((n+l)/2,(o+m)/2),this.options.show_node_circles||(this.h_ratio=(o-m)/(2*h))}else h=Math[this.options.node_images_fill_mode?"min":"max"](c,d)/2,i=new paper.Point(0,0),this.options.show_node_circles||(this.h_ratio=d/(2*h));var q=new paper.Raster(b);if(q.locked=!0,f&&(q=new paper.Group(g,q),q.opacity=.99,q.clipped=!0,g.__representation=this),this.options.clip_node_images){var r=this.shapeBuilder.getImageShape(i,h);q=new paper.Group(r,q),q.opacity=.99,q.clipped=!0,r.__representation=this}this.image_delta=i.divide(h),this.node_image=q,this.node_image.__representation=s,this.node_image.scale(this.circle_radius/h),this.node_image.position=this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius)),this.redraw(),this.renderer.throttledPaperDraw()}else{var s=this;a(b).on("load",function(){s.showImage()})}},paperShift:function(a){this.options.editor_mode?this.renkan.read_only||(this.is_dragging=!0,this.paper_coords=this.paper_coords.add(a),this.redraw()):this.renderer.paperShift(a)},openEditor:function(){this.renderer.removeRepresentationsOfType("editor");var a=this.renderer.addRepresentation("NodeEditor",null);a.source_representation=this,a.draw()},select:function(){this.selected=!0,this.circle.strokeWidth=this.options.selected_node_stroke_width,this.renderer.isEditable()&&this.active_buttons.forEach(function(a){a.show()});var b=this.model.get("uri");b&&a(".Rk-Bin-Item").each(function(){var c=a(this);c.attr("data-uri")===b&&c.addClass("selected")}),this.options.editor_mode||this.openEditor(),this.renderer.minimap&&(this.minimap_circle.strokeWidth=this.options.minimap_highlight_weight,this.minimap_circle.strokeColor=this.options.minimap_highlight_color),this._super("select")},hideButtons:function(){this.all_buttons.forEach(function(a){a.hide()}),delete this.buttonTimeout},unselect:function(b){if(!b||b.source_representation!==this){this.selected=!1;var c=this;this.buttons_timeout=setTimeout(function(){c.hideButtons()},200),this.circle.strokeWidth=this.options.node_stroke_width,a(".Rk-Bin-Item").removeClass("selected"),this.renderer.minimap&&(this.minimap_circle.strokeColor=void 0),this._super("unselect")}},highlight:function(a){var b=a||!0;this.highlighted!==b&&(this.highlighted=b,this.redraw(),this.renderer.throttledPaperDraw())},unhighlight:function(){this.highlighted&&(this.highlighted=!1,this.redraw(),this.renderer.throttledPaperDraw())},saveCoords:function(){var a=this.renderer.toModelCoords(this.paper_coords),b={position:{x:a.x,y:a.y}};this.renderer.isEditable()&&this.model.set(b)},mousedown:function(a,b){b&&(this.renderer.unselectAll(),this.select())},mouseup:function(a,b){this.renderer.is_dragging&&this.renderer.isEditable()?this.saveCoords():(b||this.model.get("delete_scheduled")||this.openEditor(),this.model.trigger("clicked")),this.renderer.click_target=null,this.renderer.is_dragging=!1,this.is_dragging=!1},destroy:function(){this._super("destroy"),this.all_buttons.forEach(function(a){a.destroy()}),this.circle.remove(),this.title.remove(),this.renderer.minimap&&this.minimap_circle.remove(),this.node_image&&this.node_image.remove()}}),g}),define("renderer/edge",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){if(this.renderer.edge_layer.activate(),this.type="Edge",this.from_representation=this.renderer.getRepresentationByModel(this.model.get("from")),this.to_representation=this.renderer.getRepresentationByModel(this.model.get("to")),this.bundle=this.renderer.addToBundles(this),this.line=new paper.Path,this.line.add([0,0],[0,0],[0,0]),this.line.__representation=this,this.line.strokeWidth=this.options.edge_stroke_width,this.arrow=new paper.Path,this.arrow.add([0,0],[this.options.edge_arrow_length,this.options.edge_arrow_width/2],[0,this.options.edge_arrow_width]),this.arrow.__representation=this,this.text=a('<div class="Rk-Label Rk-Edge-Label">').appendTo(this.renderer.labels_$),this.arrow_angle=0,this.options.editor_mode){var b=c.getRenderer();this.normal_buttons=[new b.EdgeEditButton(this.renderer,null),new b.EdgeRemoveButton(this.renderer,null)],this.pending_delete_buttons=[new b.EdgeRevertButton(this.renderer,null)],this.all_buttons=this.normal_buttons.concat(this.pending_delete_buttons);for(var d=0;d<this.all_buttons.length;d++)this.all_buttons[d].source_representation=this;this.active_buttons=[]}else this.active_buttons=this.all_buttons=[];this.renderer.minimap&&(this.renderer.minimap.edge_layer.activate(),this.minimap_line=new paper.Path,this.minimap_line.add([0,0],[0,0]),this.minimap_line.__representation=this.renderer.minimap.miniframe.__representation,this.minimap_line.strokeWidth=1)},redraw:function(){var a=this.model.get("from"),b=this.model.get("to");if(a&&b&&(this.from_representation=this.renderer.getRepresentationByModel(a),this.to_representation=this.renderer.getRepresentationByModel(b),"undefined"!=typeof this.from_representation&&"undefined"!=typeof this.to_representation)){var c=this.from_representation.paper_coords,d=this.to_representation.paper_coords,f=d.subtract(c),g=f.length,h=f.divide(g),i=new paper.Point([-h.y,h.x]),j=this.bundle.getPosition(this),k=i.multiply(this.options.edge_gap_in_bundles*j),l=c.add(k),m=d.add(k),n=f.angle,o=i.multiply(this.options.edge_label_distance),p=f.divide(3),q=this.model.get("color")||this.model.get("color")||(this.model.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),r=1;this.model.get("delete_scheduled")||this.from_representation.model.get("delete_scheduled")||this.to_representation.model.get("delete_scheduled")?(r=.5,this.line.dashArray=[2,2]):(r=1,this.line.dashArray=null);var s=this.active_buttons;this.active_buttons=this.model.get("delete_scheduled")?this.pending_delete_buttons:this.normal_buttons,this.selected&&this.renderer.isEditable()&&s!==this.active_buttons&&(s.forEach(function(a){a.hide()}),this.active_buttons.forEach(function(a){a.show()})),this.paper_coords=l.add(m).divide(2),this.line.strokeColor=q,this.line.opacity=r,this.line.segments[0].point=c,this.line.segments[1].point=this.paper_coords,this.line.segments[1].handleIn=p.multiply(-1),this.line.segments[1].handleOut=p,this.line.segments[2].point=d,this.arrow.rotate(n-this.arrow_angle),this.arrow.fillColor=q,this.arrow.opacity=r,this.arrow.position=this.paper_coords,this.arrow_angle=n,n>90&&(n-=180,o=o.multiply(-1)),-90>n&&(n+=180,o=o.multiply(-1));var t=this.model.get("title")||this.renkan.translate(this.options.label_untitled_edges)||"";t=e.shortenText(t,this.options.node_label_max_length),this.text.text(t);var u=this.paper_coords.add(o);this.text.css({left:u.x,top:u.y,transform:"rotate("+n+"deg)","-moz-transform":"rotate("+n+"deg)","-webkit-transform":"rotate("+n+"deg)",opacity:r}),this.text_angle=n;var v=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(v)}),this.renderer.minimap&&(this.minimap_line.strokeColor=q,this.minimap_line.segments[0].point=this.renderer.toMinimapCoords(new paper.Point(this.from_representation.model.get("position"))),this.minimap_line.segments[1].point=this.renderer.toMinimapCoords(new paper.Point(this.to_representation.model.get("position"))))}},openEditor:function(){this.renderer.removeRepresentationsOfType("editor");var a=this.renderer.addRepresentation("EdgeEditor",null);a.source_representation=this,a.draw()},select:function(){this.selected=!0,this.line.strokeWidth=this.options.selected_edge_stroke_width,this.renderer.isEditable()&&this.active_buttons.forEach(function(a){a.show()}),this.options.editor_mode||this.openEditor(),this._super("select")},unselect:function(a){a&&a.source_representation===this||(this.selected=!1,this.options.editor_mode&&this.all_buttons.forEach(function(a){a.hide()}),this.line.strokeWidth=this.options.edge_stroke_width,this._super("unselect"))},mousedown:function(a,b){b&&(this.renderer.unselectAll(),this.select())},mouseup:function(a,b){!this.renkan.read_only&&this.renderer.is_dragging?(this.from_representation.saveCoords(),this.to_representation.saveCoords(),this.from_representation.is_dragging=!1,this.to_representation.is_dragging=!1):(b||this.openEditor(),this.model.trigger("clicked")),this.renderer.click_target=null,this.renderer.is_dragging=!1},paperShift:function(a){this.options.editor_mode?this.options.read_only||(this.from_representation.paperShift(a),this.to_representation.paperShift(a)):this.renderer.paperShift(a)},destroy:function(){this._super("destroy"),this.line.remove(),this.arrow.remove(),this.text.remove(),this.renderer.minimap&&this.minimap_line.remove(),this.all_buttons.forEach(function(a){a.destroy()});var a=this;this.bundle.edges=b(this.bundle.edges).reject(function(b){return a===b})}}),f}),define("renderer/tempedge",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.renderer.edge_layer.activate(),this.type="Temp-edge";var a=(this.project.get("users").get(this.renkan.current_user)||e._USER_PLACEHOLDER(this.renkan)).get("color");this.line=new paper.Path,this.line.strokeColor=a,this.line.dashArray=[4,2],this.line.strokeWidth=this.options.selected_edge_stroke_width,this.line.add([0,0],[0,0]),this.line.__representation=this,this.arrow=new paper.Path,this.arrow.fillColor=a,this.arrow.add([0,0],[this.options.edge_arrow_length,this.options.edge_arrow_width/2],[0,this.options.edge_arrow_width]),this.arrow.__representation=this,this.arrow_angle=0},redraw:function(){var a=this.from_representation.paper_coords,b=this.end_pos,c=b.subtract(a).angle,d=a.add(b).divide(2);this.line.segments[0].point=a,this.line.segments[1].point=b,this.arrow.rotate(c-this.arrow_angle),this.arrow.position=d,this.arrow_angle=c},paperShift:function(a){if(!this.renderer.isEditable())return this.renderer.removeRepresentation(_this),void paper.view.draw();this.end_pos=this.end_pos.add(a);var b=paper.project.hitTest(this.end_pos);this.renderer.findTarget(b),this.redraw()},mouseup:function(a){var b=paper.project.hitTest(a.point),c=this.from_representation.model,d=!0;if(b&&"undefined"!=typeof b.item.__representation){var f=b.item.__representation;if("Node"===f.type.substr(0,4)){var g=f.model||f.source_representation.model;if(c!==g){var h={id:e.getUID("edge"),created_by:this.renkan.current_user,from:c,to:g};this.renderer.isEditable()&&this.project.addEdge(h)}}(c===f.model||f.source_representation&&f.source_representation.model===c)&&(d=!1,this.renderer.is_dragging=!0)}d&&(this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentation(this),paper.view.draw())},destroy:function(){this.arrow.remove(),this.line.remove()}}),f}),define("renderer/baseeditor",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.renderer.buttons_layer.activate(),this.type="editor",this.editor_block=new paper.Path;var c=b(b.range(8)).map(function(){return[0,0]});this.editor_block.add.apply(this.editor_block,c),this.editor_block.strokeWidth=this.options.tooltip_border_width,this.editor_block.strokeColor=this.options.tooltip_border_color,this.editor_block.opacity=.8,this.editor_$=a("<div>").appendTo(this.renderer.editor_$).css({position:"absolute",opacity:.8}).hide()},destroy:function(){this.editor_block.remove(),this.editor_$.remove()}}),f}),define("renderer/nodeeditor",["jquery","underscore","requtils","renderer/baseeditor"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){d.prototype._init.apply(this),this.template=this.options.templates["templates/nodeeditor.html"],this.readOnlyTemplate=this.options.templates["templates/nodeeditor_readonly.html"]},draw:function(){var c=this.source_representation.model,d=c.get("created_by")||e._USER_PLACEHOLDER(this.renkan),f=this.renderer.isEditable()?this.template:this.readOnlyTemplate,g=this.options.static_url+"img/image-placeholder.png",h=c.get("size")||0;this.editor_$.html(f({node:{has_creator:!!c.get("created_by"),title:c.get("title"),uri:c.get("uri"),short_uri:e.shortenText((c.get("uri")||"").replace(/^(https?:\/\/)?(www\.)?/,"").replace(/\/$/,""),40),description:c.get("description"),image:c.get("image")||"",image_placeholder:g,color:c.get("color")||d.get("color"),clip_path:c.get("clip_path")||!1,created_by_color:d.get("color"),created_by_title:d.get("title"),size:(h>0?"+":"")+h,shape:c.get("shape")||"circle"},renkan:this.renkan,options:this.options,shortenText:e.shortenText})),this.redraw();var i=this,j=function(){i.renderer.removeRepresentation(i),paper.view.draw()};if(this.editor_$.find(".Rk-CloseX").click(j),this.editor_$.find(".Rk-Edit-Goto").click(function(){return c.get("uri")?void 0:!1}),this.renderer.isEditable()){var k=b(function(){b(function(){if(i.renderer.isEditable()){var a={title:i.editor_$.find(".Rk-Edit-Title").val()};i.options.show_node_editor_uri&&(a.uri=i.editor_$.find(".Rk-Edit-URI").val(),i.editor_$.find(".Rk-Edit-Goto").attr("href",a.uri||"#")),i.options.show_node_editor_image&&(a.image=i.editor_$.find(".Rk-Edit-Image").val(),i.editor_$.find(".Rk-Edit-ImgPreview").attr("src",a.image||g)),i.options.show_node_editor_description&&(a.description=i.editor_$.find(".Rk-Edit-Description").val()),i.options.change_shapes&&c.get("shape")!==i.editor_$.find(".Rk-Edit-Shape").val()&&(a.shape=i.editor_$.find(".Rk-Edit-Shape").val(),a.shape_changed=!0),c.set(a),i.redraw(),a.shape_changed===!0&&c.set(a)}else j()}).defer()}).throttle(500);this.editor_$.on("keyup",function(a){27===a.keyCode&&j()}),this.editor_$.find("input, textarea, select").on("change keyup paste",k),i.options.allow_image_upload&&this.editor_$.find(".Rk-Edit-Image-File").change(function(){if(this.files.length){var a=this.files[0],b=new FileReader;if("image"!==a.type.substr(0,5))return void alert(i.renkan.translate("This file is not an image"));if(a.size>1024*i.options.uploaded_image_max_kb)return void alert(i.renkan.translate("Image size must be under ")+i.options.uploaded_image_max_kb+i.renkan.translate("KB"));b.onload=function(a){i.editor_$.find(".Rk-Edit-Image").val(a.target.result),k()},b.readAsDataURL(a)}}),this.editor_$.find(".Rk-Edit-Title")[0].focus();var l=i.editor_$.find(".Rk-Edit-ColorPicker");this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(function(a){a.preventDefault(),l.show()},function(a){a.preventDefault(),l.hide()}),l.find("li").hover(function(b){b.preventDefault(),i.editor_$.find(".Rk-Edit-Color").css("background",a(this).attr("data-color"))},function(a){a.preventDefault(),i.editor_$.find(".Rk-Edit-Color").css("background",c.get("color")||(c.get("created_by")||e._USER_PLACEHOLDER(i.renkan)).get("color"))}).click(function(b){b.preventDefault(),i.renderer.isEditable()?(c.set("color",a(this).attr("data-color")),l.hide(),paper.view.draw()):j()});var m=function(a){if(i.renderer.isEditable()){var b=a+(c.get("size")||0);i.editor_$.find(".Rk-Edit-Size-Value").text((b>0?"+":"")+b),c.set("size",b),paper.view.draw()}else j()};this.editor_$.find(".Rk-Edit-Size-Down").click(function(){return m(-1),!1}),this.editor_$.find(".Rk-Edit-Size-Up").click(function(){return m(1),!1}),this.editor_$.find(".Rk-Edit-Image-Del").click(function(){return i.editor_$.find(".Rk-Edit-Image").val(""),k(),!1})}else if("object"==typeof this.source_representation.highlighted){var n=this.source_representation.highlighted.replace(b(c.get("title")).escape(),'<span class="Rk-Highlighted">$1</span>');this.editor_$.find(".Rk-Display-Title"+(c.get("uri")?" a":"")).html(n),this.options.show_node_tooltip_description&&this.editor_$.find(".Rk-Display-Description").html(this.source_representation.highlighted.replace(b(c.get("description")).escape(),'<span class="Rk-Highlighted">$1</span>'))}this.editor_$.find("img").load(function(){i.redraw()})},redraw:function(){var a=this.source_representation.paper_coords;e.drawEditBox(this.options,a,this.editor_block,.75*this.source_representation.circle_radius,this.editor_$),this.editor_$.show(),paper.view.draw()}}),f}),define("renderer/edgeeditor",["jquery","underscore","requtils","renderer/baseeditor"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){d.prototype._init.apply(this),this.template=this.options.templates["templates/edgeeditor.html"],this.readOnlyTemplate=this.options.templates["templates/edgeeditor_readonly.html"]},draw:function(){var c=this.source_representation.model,d=c.get("from"),f=c.get("to"),g=c.get("created_by")||e._USER_PLACEHOLDER(this.renkan),h=this.renderer.isEditable()?this.template:this.readOnlyTemplate;this.editor_$.html(h({edge:{has_creator:!!c.get("created_by"),title:c.get("title"),uri:c.get("uri"),short_uri:e.shortenText((c.get("uri")||"").replace(/^(https?:\/\/)?(www\.)?/,"").replace(/\/$/,""),40),description:c.get("description"),color:c.get("color")||g.get("color"),from_title:d.get("title"),to_title:f.get("title"),from_color:d.get("color")||(d.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),to_color:f.get("color")||(f.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),created_by_color:g.get("color"),created_by_title:g.get("title")},renkan:this.renkan,shortenText:e.shortenText,options:this.options})),this.redraw();var i=this,j=function(){i.renderer.removeRepresentation(i),paper.view.draw()};if(this.editor_$.find(".Rk-CloseX").click(j),this.editor_$.find(".Rk-Edit-Goto").click(function(){return c.get("uri")?void 0:!1}),this.renderer.isEditable()){var k=b(function(){b(function(){if(i.renderer.isEditable()){var a={title:i.editor_$.find(".Rk-Edit-Title").val()};i.options.show_edge_editor_uri&&(a.uri=i.editor_$.find(".Rk-Edit-URI").val()),i.editor_$.find(".Rk-Edit-Goto").attr("href",a.uri||"#"),c.set(a),paper.view.draw()}else j()}).defer()}).throttle(500);this.editor_$.on("keyup",function(a){27===a.keyCode&&j()}),this.editor_$.find("input").on("keyup change paste",k),this.editor_$.find(".Rk-Edit-Vocabulary").change(function(){var b=a(this),c=b.val();c&&(i.editor_$.find(".Rk-Edit-Title").val(b.find(":selected").text()),i.editor_$.find(".Rk-Edit-URI").val(c),k())}),this.editor_$.find(".Rk-Edit-Direction").click(function(){i.renderer.isEditable()?(c.set({from:c.get("to"),to:c.get("from")}),i.draw()):j()});var l=i.editor_$.find(".Rk-Edit-ColorPicker");this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(function(a){a.preventDefault(),l.show()},function(a){a.preventDefault(),l.hide()}),l.find("li").hover(function(b){b.preventDefault(),i.editor_$.find(".Rk-Edit-Color").css("background",a(this).attr("data-color"))},function(a){a.preventDefault(),i.editor_$.find(".Rk-Edit-Color").css("background",c.get("color")||(c.get("created_by")||e._USER_PLACEHOLDER(i.renkan)).get("color"))}).click(function(b){b.preventDefault(),i.renderer.isEditable()?(c.set("color",a(this).attr("data-color")),l.hide(),paper.view.draw()):j()})}},redraw:function(){var a=this.source_representation.paper_coords;e.drawEditBox(this.options,a,this.editor_block,5,this.editor_$),this.editor_$.show(),paper.view.draw()}}),f}),define("renderer/nodebutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({setSectorSize:function(){var a=this.source_representation.circle_radius;a!==this.lastSectorInner&&(this.sector&&this.sector.destroy(),this.sector=this.renderer.drawSector(this,1+a,e._NODE_BUTTON_WIDTH+a,this.startAngle,this.endAngle,1,this.imageName,this.renkan.translate(this.text)),this.lastSectorInner=a)},unselect:function(){d.prototype.unselect.apply(this,Array.prototype.slice.call(arguments,1)),this.source_representation&&this.source_representation.buttons_timeout&&(clearTimeout(this.source_representation.buttons_timeout),this.source_representation.hideButtons())},select:function(){this.source_representation&&this.source_representation.buttons_timeout&&clearTimeout(this.source_representation.buttons_timeout),this.sector.select()
-}}),f}),define("renderer/nodeeditbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-edit-button",this.lastSectorInner=0,this.startAngle=-135,this.endAngle=-45,this.imageName="edit",this.text="Edit"},mouseup:function(){this.renderer.is_dragging||this.source_representation.openEditor()}}),f}),define("renderer/noderemovebutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-remove-button",this.lastSectorInner=0,this.startAngle=0,this.endAngle=90,this.imageName="remove",this.text="Remove"},mouseup:function(){if(this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentationsOfType("editor"),this.renderer.isEditable())if(this.options.element_delete_delay){var a=e.getUID("delete");this.renderer.delete_list.push({id:a,time:(new Date).valueOf()+this.options.element_delete_delay}),this.source_representation.model.set("delete_scheduled",a)}else confirm(this.renkan.translate("Do you really wish to remove node ")+'"'+this.source_representation.model.get("title")+'"?')&&this.project.removeNode(this.source_representation.model)}}),f}),define("renderer/noderevertbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-revert-button",this.lastSectorInner=0,this.startAngle=-135,this.endAngle=135,this.imageName="revert",this.text="Cancel deletion"},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.isEditable()&&this.source_representation.model.unset("delete_scheduled")}}),f}),define("renderer/nodelinkbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-link-button",this.lastSectorInner=0,this.startAngle=90,this.endAngle=180,this.imageName="link",this.text="Link to another node"},mousedown:function(a){if(this.renderer.isEditable()){var b=this.renderer.canvas_$.offset(),c=new paper.Point([a.pageX-b.left,a.pageY-b.top]);this.renderer.click_target=null,this.renderer.removeRepresentationsOfType("editor"),this.renderer.addTempEdge(this.source_representation,c)}}}),f}),define("renderer/nodeenlargebutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-enlarge-button",this.lastSectorInner=0,this.startAngle=-45,this.endAngle=0,this.imageName="enlarge",this.text="Enlarge"},mouseup:function(){var a=1+(this.source_representation.model.get("size")||0);this.source_representation.model.set("size",a),this.source_representation.select(),this.select(),paper.view.draw()}}),f}),define("renderer/nodeshrinkbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-shrink-button",this.lastSectorInner=0,this.startAngle=-180,this.endAngle=-135,this.imageName="shrink",this.text="Shrink"},mouseup:function(){var a=-1+(this.source_representation.model.get("size")||0);this.source_representation.model.set("size",a),this.source_representation.select(),this.select(),paper.view.draw()}}),f}),define("renderer/edgeeditbutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Edge-edit-button",this.sector=this.renderer.drawSector(this,e._EDGE_BUTTON_INNER,e._EDGE_BUTTON_OUTER,-270,-90,1,"edit",this.renkan.translate("Edit"))},mouseup:function(){this.renderer.is_dragging||this.source_representation.openEditor()}}),f}),define("renderer/edgeremovebutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Edge-remove-button",this.sector=this.renderer.drawSector(this,e._EDGE_BUTTON_INNER,e._EDGE_BUTTON_OUTER,-90,90,1,"remove",this.renkan.translate("Remove"))},mouseup:function(){if(this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentationsOfType("editor"),this.renderer.isEditable())if(this.options.element_delete_delay){var a=e.getUID("delete");this.renderer.delete_list.push({id:a,time:(new Date).valueOf()+this.options.element_delete_delay}),this.source_representation.model.set("delete_scheduled",a)}else confirm(this.renkan.translate("Do you really wish to remove edge ")+'"'+this.source_representation.model.get("title")+'"?')&&this.project.removeEdge(this.source_representation.model)}}),f}),define("renderer/edgerevertbutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Edge-revert-button",this.sector=this.renderer.drawSector(this,e._EDGE_BUTTON_INNER,e._EDGE_BUTTON_OUTER,-135,135,1,"revert",this.renkan.translate("Cancel deletion"))},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.isEditable()&&this.source_representation.model.unset("delete_scheduled")}}),f}),define("renderer/miniframe",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({paperShift:function(a){this.renderer.offset=this.renderer.offset.subtract(a.divide(this.renderer.minimap.scale).multiply(this.renderer.scale)),this.renderer.redraw()},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1}}),f}),define("renderer/scene",["jquery","underscore","filesaver","requtils","renderer/miniframe"],function(a,b,c,d,e){var f=d.getUtils(),g=function(c){this.renkan=c,this.$=a(".Rk-Render"),this.representations=[],this.$.html(c.options.templates["templates/scene.html"](c)),this.onStatusChange(),this.canvas_$=this.$.find(".Rk-Canvas"),this.labels_$=this.$.find(".Rk-Labels"),this.editor_$=this.$.find(".Rk-Editor"),this.notif_$=this.$.find(".Rk-Notifications"),paper.setup(this.canvas_$[0]),this.scale=1,this.initialScale=1,this.offset=paper.view.center,this.totalScroll=0,this.mouse_down=!1,this.click_target=null,this.selected_target=null,this.edge_layer=new paper.Layer,this.node_layer=new paper.Layer,this.buttons_layer=new paper.Layer,this.delete_list=[],this.redrawActive=!0,c.options.show_minimap&&(this.minimap={background_layer:new paper.Layer,edge_layer:new paper.Layer,node_layer:new paper.Layer,node_group:new paper.Group,size:new paper.Size(c.options.minimap_width,c.options.minimap_height)},this.minimap.background_layer.activate(),this.minimap.topleft=paper.view.bounds.bottomRight.subtract(this.minimap.size),this.minimap.rectangle=new paper.Path.Rectangle(this.minimap.topleft.subtract([2,2]),this.minimap.size.add([4,4])),this.minimap.rectangle.fillColor=c.options.minimap_background_color,this.minimap.rectangle.strokeColor=c.options.minimap_border_color,this.minimap.rectangle.strokeWidth=4,this.minimap.offset=new paper.Point(this.minimap.size.divide(2)),this.minimap.scale=.1,this.minimap.node_layer.activate(),this.minimap.cliprectangle=new paper.Path.Rectangle(this.minimap.topleft,this.minimap.size),this.minimap.node_group.addChild(this.minimap.cliprectangle),this.minimap.node_group.clipped=!0,this.minimap.miniframe=new paper.Path.Rectangle(this.minimap.topleft,this.minimap.size),this.minimap.node_group.addChild(this.minimap.miniframe),this.minimap.miniframe.fillColor="#c0c0ff",this.minimap.miniframe.opacity=.3,this.minimap.miniframe.strokeColor="#000080",this.minimap.miniframe.strokeWidth=2,this.minimap.miniframe.__representation=new e(this,null)),this.throttledPaperDraw=b(function(){paper.view.draw()}).throttle(100),this.bundles=[],this.click_mode=!1;var d=this,g=!0,h=1,i=!1,j=0,k=0;this.image_cache={},this.icon_cache={},["edit","remove","link","enlarge","shrink","revert"].forEach(function(a){var b=new Image;b.src=c.options.static_url+"img/"+a+".png",d.icon_cache[a]=b});var l=b.throttle(function(a,b){d.onMouseMove(a,b)},f._MOUSEMOVE_RATE);this.canvas_$.on({mousedown:function(a){a.preventDefault(),d.onMouseDown(a,!1)},mousemove:function(a){a.preventDefault(),l(a,!1)},mouseup:function(a){a.preventDefault(),d.onMouseUp(a,!1)},mousewheel:function(a,b){c.options.zoom_on_scroll&&(a.preventDefault(),g&&d.onScroll(a,b))},touchstart:function(a){a.preventDefault();var b=a.originalEvent.touches[0];c.options.allow_double_click&&new Date-_lastTap<f._DOUBLETAP_DELAY&&Math.pow(j-b.pageX,2)+Math.pow(k-b.pageY,2)<f._DOUBLETAP_DISTANCE?(_lastTap=0,d.onDoubleClick(b)):(_lastTap=new Date,j=b.pageX,k=b.pageY,h=d.scale,i=!1,d.onMouseDown(b,!0))},touchmove:function(a){if(a.preventDefault(),_lastTap=0,1===a.originalEvent.touches.length)d.onMouseMove(a.originalEvent.touches[0],!0);else{if(i||(d.onMouseUp(a.originalEvent.touches[0],!0),d.click_target=null,d.is_dragging=!1,i=!0),"undefined"===a.originalEvent.scale)return;var b=a.originalEvent.scale*h,c=b/d.scale,e=new paper.Point([d.canvas_$.width(),d.canvas_$.height()]).multiply(.5*(1-c)).add(d.offset.multiply(c));d.setScale(b,e)}},touchend:function(a){a.preventDefault(),d.onMouseUp(a.originalEvent.changedTouches[0],!0)},dblclick:function(a){a.preventDefault(),c.options.allow_double_click&&d.onDoubleClick(a)},mouseleave:function(a){a.preventDefault(),d.onMouseUp(a,!1),d.click_target=null,d.is_dragging=!1},dragover:function(a){a.preventDefault()},dragenter:function(a){a.preventDefault(),g=!1},dragleave:function(a){a.preventDefault(),g=!0},drop:function(a){a.preventDefault(),g=!0;var c={};b(a.originalEvent.dataTransfer.types).each(function(b){try{c[b]=a.originalEvent.dataTransfer.getData(b)}catch(d){}});var e=a.originalEvent.dataTransfer.getData("Text");if("string"==typeof e)switch(e[0]){case"{":case"[":try{var f=JSON.parse(e);b(c).extend(f)}catch(h){c["text/plain"]||(c["text/plain"]=e)}break;case"<":c["text/html"]||(c["text/html"]=e);break;default:c["text/plain"]||(c["text/plain"]=e)}var i=a.originalEvent.dataTransfer.getData("URL");i&&!c["text/uri-list"]&&(c["text/uri-list"]=i),d.dropData(c,a.originalEvent)}});var m=function(a,b){d.$.find(a).click(function(a){return d[b](a),!1})};m(".Rk-ZoomOut","zoomOut"),m(".Rk-ZoomIn","zoomIn"),m(".Rk-ZoomFit","autoScale"),this.$.find(".Rk-ZoomSave").click(function(){d.renkan.project.addView({zoom_level:d.scale,offset:d.offset})}),this.$.find(".Rk-ZoomSetSaved").click(function(){var a=d.renkan.project.get("views").last();a&&d.setScale(a.get("zoom_level"),new paper.Point(a.get("offset")))}),this.renkan.project.get("views").length>0&&this.renkan.options.save_view&&this.$.find(".Rk-ZoomSetSaved").show(),this.$.find(".Rk-CurrentUser").mouseenter(function(){d.$.find(".Rk-UserList").slideDown()}),this.$.find(".Rk-Users").mouseleave(function(){d.$.find(".Rk-UserList").slideUp()}),m(".Rk-FullScreen-Button","fullScreen"),m(".Rk-AddNode-Button","addNodeBtn"),m(".Rk-AddEdge-Button","addEdgeBtn"),m(".Rk-Save-Button","save"),m(".Rk-Open-Button","open"),m(".Rk-Export-Button","exportProject"),this.$.find(".Rk-Bookmarklet-Button").attr("href","javascript:"+f._BOOKMARKLET_CODE(c)).click(function(){return d.notif_$.text(c.translate("Drag this button to your bookmark bar. When on a third-party website, click it to enable drag-and-drop from the website to Renkan.")).fadeIn().delay(5e3).fadeOut(),!1}),this.$.find(".Rk-TopBar-Button").mouseover(function(){a(this).find(".Rk-TopBar-Tooltip").show()}).mouseout(function(){a(this).find(".Rk-TopBar-Tooltip").hide()}),m(".Rk-Fold-Bins","foldBins"),paper.view.onResize=function(a){var b,c=a.width,e=a.height;d.minimap&&(d.minimap.topleft=paper.view.bounds.bottomRight.subtract(d.minimap.size),d.minimap.rectangle.fitBounds(d.minimap.topleft.subtract([2,2]),d.minimap.size.add([4,4])),d.minimap.cliprectangle.fitBounds(d.minimap.topleft,d.minimap.size));var f=e/(e-a.delta.height),g=c/(c-a.delta.width);b=c>e?f:g,d.resizeZoom(g,f,b),d.redraw()};var n=b.throttle(function(){d.redraw()},50);this.addRepresentations("Node",this.renkan.project.get("nodes")),this.addRepresentations("Edge",this.renkan.project.get("edges")),this.renkan.project.on("change:title",function(){d.$.find(".Rk-PadTitle").val(c.project.get("title"))}),this.$.find(".Rk-PadTitle").on("keyup input paste",function(){c.project.set({title:a(this).val()})});var o=b.throttle(function(){d.redrawUsers()},100);if(o(),this.renkan.project.on("change:save_status",function(){switch(d.renkan.project.get("save_status")){case 0:d.$.find(".Rk-Save-Button").removeClass("to-save"),d.$.find(".Rk-Save-Button").removeClass("saving"),d.$.find(".Rk-Save-Button").addClass("saved");break;case 1:d.$.find(".Rk-Save-Button").removeClass("saved"),d.$.find(".Rk-Save-Button").removeClass("saving"),d.$.find(".Rk-Save-Button").addClass("to-save");break;case 2:d.$.find(".Rk-Save-Button").removeClass("saved"),d.$.find(".Rk-Save-Button").removeClass("to-save"),d.$.find(".Rk-Save-Button").addClass("saving")}}),this.renkan.project.on("change:loading_status",function(){if(d.renkan.project.get("loading_status")){d.$.find(".loader").addClass("run"),setTimeout(function(){d.$.find(".loader").hide(250)},3e3)}}),this.renkan.project.on("add:users remove:users",o),this.renkan.project.on("add:views remove:views",function(){d.renkan.project.get("views").length>0?d.$.find(".Rk-ZoomSetSaved").show():d.$.find(".Rk-ZoomSetSaved").hide()}),this.renkan.project.on("add:nodes",function(a){d.addRepresentation("Node",a),d.renkan.project.get("loading_status")||n()}),this.renkan.project.on("add:edges",function(a){d.addRepresentation("Edge",a),d.renkan.project.get("loading_status")||n()}),this.renkan.project.on("change:title",function(a,b){var c=d.$.find(".Rk-PadTitle");c.is("input")?c.val()!==b&&c.val(b):c.text(b)}),c.options.size_bug_fix){var p="number"==typeof c.options.size_bug_fix?c.options.size_bug_fix:500;window.setTimeout(function(){d.fixSize()},p)}if(c.options.force_resize&&a(window).resize(function(){d.autoScale()}),c.options.show_user_list&&c.options.user_color_editable){var q=this.$.find(".Rk-Users .Rk-Edit-ColorPicker-Wrapper"),r=this.$.find(".Rk-Users .Rk-Edit-ColorPicker");q.hover(function(a){d.isEditable()&&(a.preventDefault(),r.show())},function(a){a.preventDefault(),r.hide()}),r.find("li").mouseenter(function(b){d.isEditable()&&(b.preventDefault(),d.$.find(".Rk-CurrentUser-Color").css("background",a(this).attr("data-color")))})}if(c.options.show_search_field){var s="";this.$.find(".Rk-GraphSearch-Field").on("keyup change paste input",function(){var b=a(this),e=b.val();if(e!==s)if(s=e,e.length<2)c.project.get("nodes").each(function(a){d.getRepresentationByModel(a).unhighlight()});else{var g=f.regexpFromTextOrArray(e);c.project.get("nodes").each(function(a){g.test(a.get("title"))||g.test(a.get("description"))?d.getRepresentationByModel(a).highlight(g):d.getRepresentationByModel(a).unhighlight()})}})}this.redraw(),window.setInterval(function(){var a=(new Date).valueOf();d.delete_list.forEach(function(b){if(a>=b.time){var d=c.project.get("nodes").findWhere({delete_scheduled:b.id});d&&project.removeNode(d),d=c.project.get("edges").findWhere({delete_scheduled:b.id}),d&&project.removeEdge(d)}}),d.delete_list=d.delete_list.filter(function(a){return c.project.get("nodes").findWhere({delete_scheduled:a.id})||c.project.get("edges").findWhere({delete_scheduled:a.id})})},500),this.minimap&&window.setInterval(function(){d.rescaleMinimap()},2e3)};return b(g.prototype).extend({fixSize:function(){if(this.renkan.options.default_view&&this.renkan.project.get("views").length>0){var a=this.renkan.project.get("views").last();this.setScale(a.get("zoom_level"),new paper.Point(a.get("offset")))}else this.autoScale()},drawSector:function(b,c,d,e,f,g,h,i){var j=this.renkan.options,k=e*Math.PI/180,l=f*Math.PI/180,m=this.icon_cache[h],n=-Math.sin(k),o=Math.cos(k),p=Math.cos(k)*c+g*n,q=Math.sin(k)*c+g*o,r=Math.cos(k)*d+g*n,s=Math.sin(k)*d+g*o,t=-Math.sin(l),u=Math.cos(l),v=Math.cos(l)*c-g*t,w=Math.sin(l)*c-g*u,x=Math.cos(l)*d-g*t,y=Math.sin(l)*d-g*u,z=(c+d)/2,A=(k+l)/2,B=Math.cos(A)*z,C=Math.sin(A)*z,D=Math.cos(A)*c,E=Math.cos(A)*d,F=Math.sin(A)*c,G=Math.sin(A)*d,H=Math.cos(A)*(d+3),I=Math.sin(A)*(d+j.buttons_label_font_size)+j.buttons_label_font_size/2;this.buttons_layer.activate();var J=new paper.Path;J.add([p,q]),J.arcTo([D,F],[v,w]),J.lineTo([x,y]),J.arcTo([E,G],[r,s]),J.fillColor=j.buttons_background,J.opacity=.5,J.closed=!0,J.__representation=b;var K=new paper.PointText(H,I);K.characterStyle={fontSize:j.buttons_label_font_size,fillColor:j.buttons_label_color},K.paragraphStyle.justification=H>2?"left":-2>H?"right":"center",K.visible=!1;var L=!1,M=new paper.Point(-200,-200),N=new paper.Group([J,K]),O=N.position,P=new paper.Point([B,C]),Q=new paper.Point(0,0);K.content=i,N.pivot=N.bounds.center,N.visible=!1,N.position=M;var R={show:function(){L=!0,N.position=Q.add(O),N.visible=!0},moveTo:function(a){Q=a,L&&(N.position=a.add(O))},hide:function(){L=!1,N.visible=!1,N.position=M},select:function(){J.opacity=.8,K.visible=!0},unselect:function(){J.opacity=.5,K.visible=!1},destroy:function(){N.remove()}},S=function(){var a=new paper.Raster(m);a.position=P.add(N.position).subtract(O),a.locked=!0,N.addChild(a)};return m.width?S():a(m).on("load",S),R},addToBundles:function(a){var c=b(this.bundles).find(function(b){return b.from===a.from_representation&&b.to===a.to_representation||b.from===a.to_representation&&b.to===a.from_representation});return"undefined"!=typeof c?c.edges.push(a):(c={from:a.from_representation,to:a.to_representation,edges:[a],getPosition:function(a){var c=a.from_representation===this.from?1:-1;return c*(b(this.edges).indexOf(a)-(this.edges.length-1)/2)}},this.bundles.push(c)),c},isEditable:function(){return this.renkan.options.editor_mode&&!this.renkan.read_only},onStatusChange:function(){var a=this.$.find(".Rk-Save-Button"),b=a.find(".Rk-TopBar-Tooltip-Contents");this.renkan.read_only?(a.removeClass("disabled Rk-Save-Online").addClass("Rk-Save-ReadOnly"),b.text(this.renkan.translate("Connection lost"))):this.renkan.options.manual_save?(a.removeClass("Rk-Save-ReadOnly Rk-Save-Online"),b.text(this.renkan.translate("Save Project"))):(a.removeClass("disabled Rk-Save-ReadOnly").addClass("Rk-Save-Online"),b.text(this.renkan.translate("Auto-save enabled"))),this.redrawUsers()},setScale:function(a,b){a/this.initialScale>f._MIN_SCALE&&a/this.initialScale<f._MAX_SCALE&&(this.scale=a,b&&(this.offset=b),this.redraw())},autoScale:function(a){var b=this.renkan.project.get("nodes");if(b.length>1){var c=b.map(function(a){return a.get("position").x}),d=b.map(function(a){return a.get("position").y}),e=Math.min.apply(Math,c),f=Math.min.apply(Math,d),g=Math.max.apply(Math,c),h=Math.max.apply(Math,d),i=Math.min((paper.view.size.width-2*this.renkan.options.autoscale_padding)/(g-e),(paper.view.size.height-2*this.renkan.options.autoscale_padding)/(h-f));this.initialScale=i,"undefined"!=typeof a&&parseFloat(a.zoom_level)>0&&parseFloat(a.offset.x)>0&&parseFloat(a.offset.y)>0?this.setScale(parseFloat(a.zoom_level),new paper.Point(parseFloat(a.offset.x),parseFloat(a.offset.y))):this.setScale(i,paper.view.center.subtract(new paper.Point([(g+e)/2,(h+f)/2]).multiply(i)))}1===b.length&&this.setScale(1,paper.view.center.subtract(new paper.Point([b.at(0).get("position").x,b.at(0).get("position").y])))},redrawMiniframe:function(){var a=this.toMinimapCoords(this.toModelCoords(new paper.Point([0,0]))),b=this.toMinimapCoords(this.toModelCoords(paper.view.bounds.bottomRight));this.minimap.miniframe.fitBounds(a,b)},rescaleMinimap:function(){var a=this.renkan.project.get("nodes");if(a.length>1){var b=a.map(function(a){return a.get("position").x}),c=a.map(function(a){return a.get("position").y}),d=Math.min.apply(Math,b),e=Math.min.apply(Math,c),f=Math.max.apply(Math,b),g=Math.max.apply(Math,c),h=Math.min(.8*this.scale*this.renkan.options.minimap_width/paper.view.bounds.width,.8*this.scale*this.renkan.options.minimap_height/paper.view.bounds.height,(this.renkan.options.minimap_width-2*this.renkan.options.minimap_padding)/(f-d),(this.renkan.options.minimap_height-2*this.renkan.options.minimap_padding)/(g-e));this.minimap.offset=this.minimap.size.divide(2).subtract(new paper.Point([(f+d)/2,(g+e)/2]).multiply(h)),this.minimap.scale=h}1===a.length&&(this.minimap.scale=.1,this.minimap.offset=this.minimap.size.divide(2).subtract(new paper.Point([a.at(0).get("position").x,a.at(0).get("position").y]).multiply(this.minimap.scale))),this.redraw()},toPaperCoords:function(a){return a.multiply(this.scale).add(this.offset)},toMinimapCoords:function(a){return a.multiply(this.minimap.scale).add(this.minimap.offset).add(this.minimap.topleft)},toModelCoords:function(a){return a.subtract(this.offset).divide(this.scale)},addRepresentation:function(a,b){var c=d.getRenderer()[a],e=new c(this,b);return this.representations.push(e),e},addRepresentations:function(a,b){var c=this;b.forEach(function(b){c.addRepresentation(a,b)})},userTemplate:b.template('<li class="Rk-User"><span class="Rk-UserColor" style="background:<%=background%>;"></span><%=name%></li>'),redrawUsers:function(){if(this.renkan.options.show_user_list){var b=[].concat((this.renkan.project.current_user_list||{}).models||[],(this.renkan.project.get("users")||{}).models||[]),c="",d=this.$.find(".Rk-Users"),e=d.find(".Rk-CurrentUser-Name"),f=d.find(".Rk-Edit-ColorPicker li"),g=d.find(".Rk-CurrentUser-Color"),h=this;e.off("click").text(this.renkan.translate("<unknown user>")),f.off("mouseleave click"),b.forEach(function(b){b.get("_id")===h.renkan.current_user?(e.text(b.get("title")),g.css("background",b.get("color")),h.isEditable()&&(h.renkan.options.user_name_editable&&e.click(function(){var c=a(this),d=a("<input>").val(b.get("title")).blur(function(){b.set("title",a(this).val()),h.redrawUsers(),h.redraw()});c.empty().html(d),d.select()}),h.renkan.options.user_color_editable&&f.click(function(c){c.preventDefault(),h.isEditable()&&b.set("color",a(this).attr("data-color")),a(this).parent().hide()}).mouseleave(function(){g.css("background",b.get("color"))}))):c+=h.userTemplate({name:b.get("title"),background:b.get("color")})}),d.find(".Rk-UserList").html(c)}},removeRepresentation:function(a){a.destroy(),this.representations=b(this.representations).reject(function(b){return b===a})},getRepresentationByModel:function(a){return a?b(this.representations).find(function(b){return b.model===a}):void 0},removeRepresentationsOfType:function(a){var c=b(this.representations).filter(function(b){return b.type===a}),d=this;b(c).each(function(a){d.removeRepresentation(a)})},highlightModel:function(a){var b=this.getRepresentationByModel(a);b&&b.highlight()},unhighlightAll:function(){b(this.representations).each(function(a){a.unhighlight()})},unselectAll:function(){b(this.representations).each(function(a){a.unselect()})},redraw:function(){this.redrawActive&&(b(this.representations).each(function(a){a.redraw(!0)}),this.minimap&&this.redrawMiniframe(),paper.view.draw())},addTempEdge:function(a,b){var c=this.addRepresentation("TempEdge",null);c.end_pos=b,c.from_representation=a,c.redraw(),this.click_target=c},findTarget:function(a){if(a&&"undefined"!=typeof a.item.__representation){var b=a.item.__representation;this.selected_target!==a.item.__representation&&(this.selected_target&&this.selected_target.unselect(b),b.select(this.selected_target),this.selected_target=b)}else this.selected_target&&this.selected_target.unselect(),this.selected_target=null},paperShift:function(a){this.offset=this.offset.add(a),this.redraw()},onMouseMove:function(a){var b=this.canvas_$.offset(),c=new paper.Point([a.pageX-b.left,a.pageY-b.top]),d=c.subtract(this.last_point);this.last_point=c,!this.is_dragging&&this.mouse_down&&d.length>f._MIN_DRAG_DISTANCE&&(this.is_dragging=!0);var e=paper.project.hitTest(c);this.is_dragging?this.click_target&&"function"==typeof this.click_target.paperShift?this.click_target.paperShift(d):this.paperShift(d):this.findTarget(e),paper.view.draw()},onMouseDown:function(b,c){var d=this.canvas_$.offset(),e=new paper.Point([b.pageX-d.left,b.pageY-d.top]);if(this.last_point=e,this.mouse_down=!0,!this.click_target||"Temp-edge"!==this.click_target.type){this.removeRepresentationsOfType("editor"),this.is_dragging=!1;var g=paper.project.hitTest(e);if(g&&"undefined"!=typeof g.item.__representation)this.click_target=g.item.__representation,this.click_target.mousedown(b,c);else if(this.click_target=null,this.isEditable()&&this.click_mode===f._CLICKMODE_ADDNODE){var h=this.toModelCoords(e),i={id:f.getUID("node"),created_by:this.renkan.current_user,position:{x:h.x,y:h.y}};_node=this.renkan.project.addNode(i),this.getRepresentationByModel(_node).openEditor()}}this.click_mode&&(this.isEditable()&&this.click_mode===f._CLICKMODE_STARTEDGE&&this.click_target&&"Node"===this.click_target.type?(this.removeRepresentationsOfType("editor"),this.addTempEdge(this.click_target,e),this.click_mode=f._CLICKMODE_ENDEDGE,this.notif_$.fadeOut(function(){a(this).html(this.renkan.translate("Click on a second node to complete the edge")).fadeIn()})):(this.notif_$.hide(),this.click_mode=!1)),paper.view.draw()},onMouseUp:function(a,b){if(this.mouse_down=!1,this.click_target){var c=this.canvas_$.offset();this.click_target.mouseup({point:new paper.Point([a.pageX-c.left,a.pageY-c.top])},b)}else this.click_target=null,this.is_dragging=!1,b&&this.unselectAll();paper.view.draw()},onScroll:function(a,b){if(this.totalScroll+=b,Math.abs(this.totalScroll)>=1){var c=this.canvas_$.offset(),d=new paper.Point([a.pageX-c.left,a.pageY-c.top]).subtract(this.offset).multiply(Math.SQRT2-1);this.totalScroll>0?this.setScale(this.scale*Math.SQRT2,this.offset.subtract(d)):this.setScale(this.scale*Math.SQRT1_2,this.offset.add(d.divide(Math.SQRT2))),this.totalScroll=0}},onDoubleClick:function(a){if(this.isEditable()){var b=this.canvas_$.offset(),c=new paper.Point([a.pageX-b.left,a.pageY-b.top]),d=paper.project.hitTest(c);if(this.isEditable()&&(!d||"undefined"==typeof d.item.__representation)){var e=this.toModelCoords(c),g={id:f.getUID("node"),created_by:this.renkan.current_user,position:{x:e.x,y:e.y}},h=this.renkan.project.addNode(g);this.getRepresentationByModel(h).openEditor()}paper.view.draw()}},defaultDropHandler:function(b){var c={},d="";switch(b["text/x-iri-specific-site"]){case"twitter":d=a("<div>").html(b["text/x-iri-selected-html"]);var e=d.find(".tweet");c.title=this.renkan.translate("Tweet by ")+e.attr("data-name"),c.uri="http://twitter.com/"+e.attr("data-screen-name")+"/status/"+e.attr("data-tweet-id"),c.image=e.find(".avatar").attr("src"),c.description=e.find(".js-tweet-text:first").text();break;case"google":d=a("<div>").html(b["text/x-iri-selected-html"]),c.title=d.find("h3:first").text().trim(),c.uri=d.find("h3 a").attr("href"),c.description=d.find(".st:first").text().trim();break;default:b["text/x-iri-source-uri"]&&(c.uri=b["text/x-iri-source-uri"])}if((b["text/plain"]||b["text/x-iri-selected-text"])&&(c.description=(b["text/plain"]||b["text/x-iri-selected-text"]).replace(/[\s\n]+/gm," ").trim()),b["text/html"]||b["text/x-iri-selected-html"]){d=a("<div>").html(b["text/html"]||b["text/x-iri-selected-html"]);var f=d.find("image");f.length&&(c.image=f.attr("xlink:href"));var g=d.find("path");g.length&&(c.clipPath=g.attr("d"));var h=d.find("img");h.length&&(c.image=h[0].src);var i=d.find("a");i.length&&(c.uri=i[0].href),c.title=d.find("[title]").attr("title")||c.title,c.description=d.text().replace(/[\s\n]+/gm," ").trim()}b["text/uri-list"]&&(c.uri=b["text/uri-list"]),b["text/x-moz-url"]&&!c.title&&(c.title=(b["text/x-moz-url"].split("\n")[1]||"").trim(),c.title===c.uri&&(c.title=!1)),b["text/x-iri-source-title"]&&!c.title&&(c.title=b["text/x-iri-source-title"]),(b["text/html"]||b["text/x-iri-selected-html"])&&(d=a("<div>").html(b["text/html"]||b["text/x-iri-selected-html"]),c.image=d.find("[data-image]").attr("data-image")||c.image,c.uri=d.find("[data-uri]").attr("data-uri")||c.uri,c.title=d.find("[data-title]").attr("data-title")||c.title,c.description=d.find("[data-description]").attr("data-description")||c.description,c.clipPath=d.find("[data-clip-path]").attr("data-clip-path")||c.clipPath),c.title||(c.title=this.renkan.translate("Dragged resource"));for(var j=["title","description","uri","image"],k=0;k<j.length;k++){var l=j[k];(b["text/x-iri-"+l]||b[l])&&(c[l]=b["text/x-iri-"+l]||b[l]),("none"===c[l]||"null"===c[l])&&(c[l]=void 0)}return"function"==typeof this.renkan.options.drop_enhancer&&(c=this.renkan.options.drop_enhancer(c,b)),c},dropData:function(a,c){if(this.isEditable()){if(a["text/json"]||a["application/json"])try{var d=JSON.parse(a["text/json"]||a["application/json"]);b(a).extend(d)}catch(e){}var g="undefined"==typeof this.renkan.options.drop_handler?this.defaultDropHandler(a):this.renkan.options.drop_handler(a),h=this.canvas_$.offset(),i=new paper.Point([c.pageX-h.left,c.pageY-h.top]),j=this.toModelCoords(i),k={id:f.getUID("node"),created_by:this.renkan.current_user,uri:g.uri||"",title:g.title||"",description:g.description||"",image:g.image||"",color:g.color||void 0,clip_path:g.clipPath||void 0,position:{x:j.x,y:j.y}},l=this.renkan.project.addNode(k),m=this.getRepresentationByModel(l);"drop"===c.type&&m.openEditor()}},fullScreen:function(){var a,b=document.fullScreen||document.mozFullScreen||document.webkitIsFullScreen,c=this.renkan.$[0],d=["requestFullScreen","mozRequestFullScreen","webkitRequestFullScreen"],e=["cancelFullScreen","mozCancelFullScreen","webkitCancelFullScreen"];if(b){for(a=0;a<e.length;a++)if("function"==typeof document[e[a]]){document[e[a]]();break}var f=this.$.width(),g=this.$.height();this.renkan.options.show_top_bar&&(g-=this.$.find(".Rk-TopBar").height()),this.renkan.options.show_bins&&this.renkan.$.find(".Rk-Bins").position().left>0&&(f-=this.renkan.$.find(".Rk-Bins").width()),paper.view.viewSize=new paper.Size([f,g])}else{for(a=0;a<d.length;a++)if("function"==typeof c[d[a]]){c[d[a]]();break}this.redraw()}},zoomOut:function(){var a=this.scale*Math.SQRT1_2,b=new paper.Point([this.canvas_$.width(),this.canvas_$.height()]).multiply(.5*(1-Math.SQRT1_2)).add(this.offset.multiply(Math.SQRT1_2));this.setScale(a,b)},zoomIn:function(){var a=this.scale*Math.SQRT2,b=new paper.Point([this.canvas_$.width(),this.canvas_$.height()]).multiply(.5*(1-Math.SQRT2)).add(this.offset.multiply(Math.SQRT2));this.setScale(a,b)},resizeZoom:function(a,b,c){var d=this.scale*c,e=new paper.Point([this.offset.x*a,this.offset.y*b]);this.setScale(d,e)},addNodeBtn:function(){return this.click_mode===f._CLICKMODE_ADDNODE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=f._CLICKMODE_ADDNODE,this.notif_$.text(this.renkan.translate("Click on the background canvas to add a node")).fadeIn()),!1},addEdgeBtn:function(){return this.click_mode===f._CLICKMODE_STARTEDGE||this.click_mode===f._CLICKMODE_ENDEDGE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=f._CLICKMODE_STARTEDGE,this.notif_$.text(this.renkan.translate("Click on a first node to start the edge")).fadeIn()),!1},exportProject:function(){var a=this.renkan.project.toJSON(),d=(document.createElement("a"),a.id),e=d+".json";delete a.id,delete a._id,delete a.space_id;var g,h={};b.each(a.nodes,function(a){g=a.id||a._id,delete a._id,delete a.id,h[g]=a["@id"]=f.getUUID4()}),b.each(a.edges,function(a){delete a._id,delete a.id,a.to=h[a.to],a.from=h[a.from]}),b.each(a.views,function(a){g=a.id||a._id,delete a._id,delete a.id}),a.users=[];var i=JSON.stringify(a,null,2),j=new Blob([i],{type:"application/json;charset=utf-8"});c(j,e)},foldBins:function(){var a,b=this.$.find(".Rk-Fold-Bins"),c=this.renkan.$.find(".Rk-Bins"),d=this,e=d.canvas_$.width();c.position().left<0?(c.animate({left:0},250),this.$.animate({left:300},250,function(){var a=d.$.width();paper.view.viewSize=new paper.Size([a,d.canvas_$.height()])
-}),a=e-c.width()<c.height()?e:e-c.width(),b.html("&laquo;")):(c.animate({left:-300},250),this.$.animate({left:0},250,function(){var a=d.$.width();paper.view.viewSize=new paper.Size([a,d.canvas_$.height()])}),a=e+300,b.html("&raquo;")),d.resizeZoom(1,1,a/e)},save:function(){},open:function(){}}),g}),"function"==typeof require.config&&require.config({paths:{jquery:"../lib/jquery/jquery",underscore:"../lib/underscore/underscore",filesaver:"../lib/FileSaver/FileSaver",requtils:"require-utils"}}),require(["renderer/baserepresentation","renderer/basebutton","renderer/noderepr","renderer/edge","renderer/tempedge","renderer/baseeditor","renderer/nodeeditor","renderer/edgeeditor","renderer/nodebutton","renderer/nodeeditbutton","renderer/noderemovebutton","renderer/noderevertbutton","renderer/nodelinkbutton","renderer/nodeenlargebutton","renderer/nodeshrinkbutton","renderer/edgeeditbutton","renderer/edgeremovebutton","renderer/edgerevertbutton","renderer/miniframe","renderer/scene"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t){var u=window.Rkns;"undefined"==typeof u.Renderer&&(u.Renderer={});var v=u.Renderer;v._BaseRepresentation=a,v._BaseButton=b,v.Node=c,v.Edge=d,v.TempEdge=e,v._BaseEditor=f,v.NodeEditor=g,v.EdgeEditor=h,v._NodeButton=i,v.NodeEditButton=j,v.NodeRemoveButton=k,v.NodeRevertButton=l,v.NodeLinkButton=m,v.NodeEnlargeButton=n,v.NodeShrinkButton=o,v.EdgeEditButton=p,v.EdgeRemoveButton=q,v.EdgeRevertButton=r,v.MiniFrame=s,v.Scene=t,startRenkan()}),define("main-renderer",function(){}),this.renkanJST=this.renkanJST||{},this.renkanJST["templates/edgeeditor.html"]=function(obj){obj||(obj={});{var __t,__p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n	<span class="Rk-CloseX">&times;</span>'+__e(renkan.translate("Edit Edge"))+"</span>\n</h2>\n<p>\n	<label>"+__e(renkan.translate("Title:"))+'</label>\n	<input class="Rk-Edit-Title" type="text" value="'+__e(edge.title)+'" />\n</p>\n',options.show_edge_editor_uri&&(__p+="\n	<p>\n		<label>"+__e(renkan.translate("URI:"))+'</label>\n		<input class="Rk-Edit-URI" type="text" value="'+__e(edge.uri)+'" />\n		<a class="Rk-Edit-Goto" href="'+__e(edge.uri)+'" target="_blank"></a>\n	</p>\n	',options.properties.length&&(__p+="\n		<p>\n			<label>"+__e(renkan.translate("Choose from vocabulary:"))+'</label>\n			<select class="Rk-Edit-Vocabulary">\n				',_(options.properties).each(function(a){__p+='\n					<option class="Rk-Edit-Vocabulary-Class" value="">\n						'+__e(renkan.translate(a.label))+"\n					</option>\n					",_(a.properties).each(function(b){var c=a["base-uri"]+b.uri;__p+='\n						<option class="Rk-Edit-Vocabulary-Property" value="'+__e(c)+'"\n							',c===edge.uri&&(__p+=" selected"),__p+=">\n							"+__e(renkan.translate(b.label))+"\n						</option>\n					"}),__p+="\n				"}),__p+="\n			</select>\n		</p>\n")),__p+="\n",options.show_edge_editor_color&&(__p+='\n	<div class="Rk-Editor-p">\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("Edge color:"))+'</span>\n		<div class="Rk-Edit-ColorPicker-Wrapper">\n			<span class="Rk-Edit-Color" style="background: &lt;%-edge.color%>;">\n				<span class="Rk-Edit-ColorTip"></span>\n			</span>\n			'+(null==(__t=renkan.colorPicker)?"":__t)+'\n			<span class="Rk-Edit-ColorPicker-Text">'+__e(renkan.translate("Choose color"))+"</span>\n		</div>\n	</div>\n"),__p+="\n",options.show_edge_editor_direction&&(__p+='\n	<p>\n		<span class="Rk-Edit-Direction">'+__e(renkan.translate("Change edge direction"))+"</span>\n	</p>\n"),__p+="\n",options.show_edge_editor_nodes&&(__p+='\n	<p>\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("From:"))+'</span>\n		<span class="Rk-UserColor" style="background: '+__e(edge.from_color)+';"></span>\n		'+__e(shortenText(edge.from_title,25))+'\n	</p>\n	<p>\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("To:"))+'</span>\n		<span class="Rk-UserColor" style="background: >%-edge.to_color%>;"></span>\n		'+__e(shortenText(edge.to_title,25))+"\n	</p>\n"),__p+="\n",options.show_edge_editor_creator&&edge.has_creator&&(__p+='\n	<p>\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n		<span class="Rk-UserColor" style="background: &lt;%-edge.created_by_color%>;"></span>\n		'+__e(shortenText(edge.created_by_title,25))+"\n	</p>\n"),__p+="\n";return __p},this.renkanJST["templates/edgeeditor_readonly.html"]=function(obj){obj||(obj={});{var __p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n	<span class="Rk-CloseX">&times;</span>\n	',options.show_edge_tooltip_color&&(__p+='\n		<span class="Rk-UserColor" style="background: '+__e(edge.color)+';"></span>\n	'),__p+='\n	<span class="Rk-Display-Title">\n		',edge.uri&&(__p+='\n			<a href="'+__e(edge.uri)+'" target="_blank">\n		'),__p+="\n		"+__e(edge.title)+"\n		",edge.uri&&(__p+=" </a> "),__p+="\n	</span>\n</h2>\n",options.show_edge_tooltip_uri&&edge.uri&&(__p+='\n	<p class="Rk-Display-URI">\n		<a href="'+__e(edge.uri)+'" target="_blank">'+__e(edge.short_uri)+"</a>\n	</p>\n"),__p+="\n<p>"+__e(edge.description)+"</p>\n",options.show_edge_tooltip_nodes&&(__p+='\n	<p>\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("From:"))+'</span>\n		<span class="Rk-UserColor" style="background: '+__e(edge.from_color)+';"></span>\n		'+__e(shortenText(edge.from_title,25))+'\n	</p>\n	<p>\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("To:"))+'</span>\n		<span class="Rk-UserColor" style="background: '+__e(edge.to_color)+';"></span>\n		'+__e(shortenText(edge.to_title,25))+"\n	</p>\n"),__p+="\n",options.show_edge_tooltip_creator&&edge.has_creator&&(__p+='\n	<p>\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n		<span class="Rk-UserColor" style="background: '+__e(edge.created_by_color)+';"></span>\n		'+__e(shortenText(edge.created_by_title,25))+"\n	</p>\n"),__p+="\n";return __p},this.renkanJST["templates/ldtjson-bin/annotationtemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Bin-Item" draggable="true"\n	data-image="'+__e(Rkns.Utils.getFullURL(image))+'"\n	data-uri="'+(null==(__t=ldt_platform)?"":__t)+"ldtplatform/ldt/front/player/"+(null==(__t=mediaid)?"":__t)+"/#id="+(null==(__t=annotationid)?"":__t)+'"\n	data-title="'+__e(title)+'" data-description="'+__e(description)+'">\n	\n	<img class="Rk-Ldt-Annotation-Icon" src="'+(null==(__t=image)?"":__t)+'" />\n	<h4>'+(null==(__t=htitle)?"":__t)+"</h4>\n	<p>"+(null==(__t=hdescription)?"":__t)+"</p>\n	<p>Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+'</p>\n	<div class="Rk-Clear"></div>\n</li>';return __p},this.renkanJST["templates/ldtjson-bin/segmenttemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Bin-Item" draggable="true"\n	data-image="'+__e(Rkns.Utils.getFullURL(image))+'"\n	data-uri="'+(null==(__t=ldt_platform)?"":__t)+"ldtplatform/ldt/front/player/"+(null==(__t=mediaid)?"":__t)+"/#id="+(null==(__t=annotationid)?"":__t)+'"\n	data-title="'+__e(title)+'" data-description="'+__e(description)+'">\n	\n	<img class="Rk-Ldt-Annotation-Icon" src="'+(null==(__t=image)?"":__t)+'" />\n	<h4>'+(null==(__t=htitle)?"":__t)+"</h4>\n	<p>"+(null==(__t=hdescription)?"":__t)+"</p>\n	<p>Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+'</p>\n	<div class="Rk-Clear"></div>\n</li>';return __p},this.renkanJST["templates/ldtjson-bin/tagtemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Bin-Item" draggable="true"\n	data-image="'+__e(Rkns.Utils.getFullURL(static_url+"img/ldt-tag.png"))+'"\n	data-uri="'+(null==(__t=ldt_platform)?"":__t)+"ldtplatform/ldt/front/search/?search="+(null==(__t=encodedtitle)?"":__t)+'&field=all"\n	data-title="'+__e(title)+'" data-description="Tag \''+__e(title)+'\'">\n\n	<img class="Rk-Ldt-Tag-Icon" src="'+__e(static_url)+'img/ldt-tag.png" />\n	<h4>'+(null==(__t=htitle)?"":__t)+'</h4>\n	<div class="Rk-Clear"></div>\n</li>';return __p},this.renkanJST["templates/nodeeditor.html"]=function(obj){obj||(obj={});{var __t,__p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n	<span class="Rk-CloseX">&times;</span>'+__e(renkan.translate("Edit Node"))+"</span>\n</h2>\n<p>\n	<label>"+__e(renkan.translate("Title:"))+'</label>\n	<input class="Rk-Edit-Title" type="text" value="'+__e(node.title)+'" />\n</p>\n',options.show_node_editor_uri&&(__p+="\n	<p>\n		<label>"+__e(renkan.translate("URI:"))+'</label>\n		<input class="Rk-Edit-URI" type="text" value="'+__e(node.uri)+'" />\n		<a class="Rk-Edit-Goto" href="'+__e(node.uri)+'" target="_blank"></a>\n	</p>\n'),__p+=" ",options.show_node_editor_description&&(__p+="\n	<p>\n		<label>"+__e(renkan.translate("Description:"))+'</label>\n		<textarea class="Rk-Edit-Description">'+__e(node.description)+"</textarea>\n	</p>\n"),__p+=" ",options.show_node_editor_size&&(__p+='\n	<p>\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("Size:"))+'</span>\n		<a href="#" class="Rk-Edit-Size-Down">-</a>\n		<span class="Rk-Edit-Size-Value">'+__e(node.size)+'</span>\n		<a href="#" class="Rk-Edit-Size-Up">+</a>\n	</p>\n'),__p+=" ",options.show_node_editor_color&&(__p+='\n	<div class="Rk-Editor-p">\n		<span class="Rk-Editor-Label">\n		'+__e(renkan.translate("Node color:"))+'</span>\n		<div class="Rk-Edit-ColorPicker-Wrapper">\n			<span class="Rk-Edit-Color" style="background: '+__e(node.color)+';">\n				<span class="Rk-Edit-ColorTip"></span>\n			</span>\n			'+(null==(__t=renkan.colorPicker)?"":__t)+'\n			<span class="Rk-Edit-ColorPicker-Text">'+__e(renkan.translate("Choose color"))+"</span>\n		</div>\n	</div>\n"),__p+=" ",options.show_node_editor_image&&(__p+='\n	<div class="Rk-Edit-ImgWrap">\n		<div class="Rk-Edit-ImgPreview">\n			<img src="'+__e(node.image||node.image_placeholder)+'" />\n			',node.clip_path&&(__p+='\n				<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 1 1" preserveAspectRatio="none">\n					<path style="stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;" d="'+__e(node.clip_path)+'" />\n				</svg>\n			'),__p+="\n		</div>\n	</div>\n	<p>\n		<label>"+__e(renkan.translate("Image URL:"))+'</label>\n		<div>\n			<a class="Rk-Edit-Image-Del" href="#"></a>\n			<input class="Rk-Edit-Image" type="text" value=\''+__e(node.image)+"' />\n		</div>\n	</p>\n",options.allow_image_upload&&(__p+="\n	<p>\n		<label>"+__e(renkan.translate("Choose Image File:"))+'</label>\n		<input class="Rk-Edit-Image-File" type="file" accept="image/*" />\n	</p>\n')),__p+=" ",options.show_node_editor_creator&&node.has_creator&&(__p+='\n	<p>\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n		<span class="Rk-UserColor" style="background: '+__e(node.created_by_color)+';"></span>\n		'+__e(shortenText(node.created_by_title,25))+"\n	</p>\n"),__p+=" ",options.change_shapes&&(__p+="\n	<p>\n		<label>"+__e(renkan.translate("Shapes available"))+':</label>\n		<select class="Rk-Edit-Shape">\n			<option class="Rk-Edit-Vocabulary-Property" value="circle"',"circle"===node.shape&&(__p+=" selected"),__p+=">\n				"+__e(renkan.translate("Circle"))+'\n			</option>\n			<option class="Rk-Edit-Vocabulary-Property" value="rectangle"',"rectangle"===node.shape&&(__p+=" selected"),__p+=">\n				"+__e(renkan.translate("Square"))+'\n			</option>\n			<option class="Rk-Edit-Vocabulary-Property" value="diamond"',"diamond"===node.shape&&(__p+=" selected"),__p+=">\n				"+__e(renkan.translate("Diamond"))+'\n			</option>\n			<option class="Rk-Edit-Vocabulary-Property" value="polygon"',"polygon"===node.shape&&(__p+=" selected"),__p+=">\n				"+__e(renkan.translate("Hexagone"))+'\n			</option>\n			<option class="Rk-Edit-Vocabulary-Property" value="ellipse"',"ellipse"===node.shape&&(__p+=" selected"),__p+=">\n				"+__e(renkan.translate("Ellipse"))+'\n			</option>\n			<option class="Rk-Edit-Vocabulary-Property" value="star"',"star"===node.shape&&(__p+=" selected"),__p+=">\n				"+__e(renkan.translate("Star"))+"\n			</option>\n		</select>\n	</p>\n"),__p+="\n";return __p},this.renkanJST["templates/nodeeditor_readonly.html"]=function(obj){obj||(obj={});{var __p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n	<span class="Rk-CloseX">&times;</span>\n	',options.show_node_tooltip_color&&(__p+='\n		<span class="Rk-UserColor" style="background: '+__e(node.color)+';"></span>\n	'),__p+='\n	<span class="Rk-Display-Title">\n		',node.uri&&(__p+='\n			<a href="'+__e(node.uri)+'" target="_blank">\n		'),__p+="\n		"+__e(node.title)+"\n		",node.uri&&(__p+="</a>"),__p+="\n	</span>\n</h2>\n",node.uri&&options.show_node_tooltip_uri&&(__p+='\n	<p class="Rk-Display-URI">\n		<a href="'+__e(node.uri)+'" target="_blank">'+__e(node.short_uri)+"</a>\n	</p>\n"),__p+=" ",options.show_node_tooltip_description&&(__p+='\n	<p class="Rk-Display-Description">'+__e(node.description)+"</p>\n"),__p+=" ",node.image&&options.show_node_tooltip_image&&(__p+='\n	<img class="Rk-Display-ImgPreview" src="'+__e(node.image)+'" />\n'),__p+=" ",node.has_creator&&options.show_node_tooltip_creator&&(__p+='\n	<p>\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n		<span class="Rk-UserColor" style="background: '+__e(node.created_by_color)+';"></span>\n		'+__e(shortenText(node.created_by_title,25))+"\n	</p>\n"),__p+="\n";return __p},this.renkanJST["templates/scene.html"]=function(obj){function print(){__p+=__j.call(arguments,"")}obj||(obj={});var __p="",__e=_.escape,__j=Array.prototype.join;with(obj)options.show_top_bar&&(__p+='\n	<div class="Rk-TopBar">\n		<div class="loader"></div>\n		',__p+=options.editor_mode?'\n			<input type="text" class="Rk-PadTitle" value="'+__e(project.get("title")||"")+'" placeholder="'+__e(translate("Untitled project"))+'" />\n		':'\n			<h2 class="Rk-PadTitle">\n				'+__e(project.get("title")||translate("Untitled project"))+"\n			</h2>\n		",__p+="\n		",options.show_user_list&&(__p+='\n			<div class="Rk-Users">\n				<div class="Rk-CurrentUser">\n					',options.show_user_color&&(__p+='\n						<div class="Rk-Edit-ColorPicker-Wrapper">\n							<span class="Rk-CurrentUser-Color">\n							',options.user_color_editable&&(__p+='\n								<span class="Rk-Edit-ColorTip"></span>\n							'),__p+="\n							</span>\n							",options.user_color_editable&&print(colorPicker),__p+="\n						</div>\n					"),__p+='\n					<span class="Rk-CurrentUser-Name">&lt;unknown user&gt;</span>\n				</div>\n				<ul class="Rk-UserList"></ul>\n			</div>\n		'),__p+="\n		",options.home_button_url&&(__p+='\n			<div class="Rk-TopBar-Separator"></div>\n			<a class="Rk-TopBar-Button Rk-Home-Button" href="'+__e(options.home_button_url)+'">\n				<div class="Rk-TopBar-Tooltip">\n					<div class="Rk-TopBar-Tooltip-Contents">\n						'+__e(translate(options.home_button_title))+"\n					</div>\n				</div>\n			</a>\n		"),__p+="\n		",options.show_fullscreen_button&&(__p+='\n			<div class="Rk-TopBar-Separator"></div>\n			<div class="Rk-TopBar-Button Rk-FullScreen-Button">\n				<div class="Rk-TopBar-Tooltip">\n					<div class="Rk-TopBar-Tooltip-Contents">\n						'+__e(translate("Full Screen"))+"\n					</div>\n				</div>\n			</div>\n		"),__p+="\n		",options.editor_mode?(__p+="\n			",options.show_addnode_button&&(__p+='\n				<div class="Rk-TopBar-Separator"></div>\n				<div class="Rk-TopBar-Button Rk-AddNode-Button">\n					<div class="Rk-TopBar-Tooltip">\n						<div class="Rk-TopBar-Tooltip-Contents">\n							'+__e(translate("Add Node"))+"\n						</div>\n					</div>\n				</div>\n			"),__p+="\n			",options.show_addedge_button&&(__p+='\n				<div class="Rk-TopBar-Separator"></div>\n				<div class="Rk-TopBar-Button Rk-AddEdge-Button">\n					<div class="Rk-TopBar-Tooltip">\n						<div class="Rk-TopBar-Tooltip-Contents">\n							'+__e(translate("Add Edge"))+"\n						</div>\n					</div>\n				</div>\n			"),__p+="\n			",options.show_export_button&&(__p+='\n				<div class="Rk-TopBar-Separator"></div>\n				<div class="Rk-TopBar-Button Rk-Export-Button">\n					<div class="Rk-TopBar-Tooltip">\n						<div class="Rk-TopBar-Tooltip-Contents">\n							'+__e(translate("Download Project"))+"\n						</div>\n					</div>\n				</div>\n			"),__p+="\n			",options.show_save_button&&(__p+='\n				<div class="Rk-TopBar-Separator"></div>\n				<div class="Rk-TopBar-Button Rk-Save-Button">\n					<div class="Rk-TopBar-Tooltip">\n						<div class="Rk-TopBar-Tooltip-Contents"></div>\n					</div>\n				</div>\n			'),__p+="\n			",options.show_open_button&&(__p+='\n				<div class="Rk-TopBar-Separator"></div>\n				<div class="Rk-TopBar-Button Rk-Open-Button">\n					<div class="Rk-TopBar-Tooltip">\n						<div class="Rk-TopBar-Tooltip-Contents">\n							'+__e(translate("Open Project"))+"\n						</div>\n					</div>\n				</div>\n			"),__p+="\n			",options.show_bookmarklet&&(__p+='\n				<div class="Rk-TopBar-Separator"></div>\n				<a class="Rk-TopBar-Button Rk-Bookmarklet-Button" href="#">\n					<div class="Rk-TopBar-Tooltip">\n						<div class="Rk-TopBar-Tooltip-Contents">\n							'+__e(translate("Renkan 'Drag-to-Add' bookmarklet"))+'\n						</div>\n					</div>\n				</a>\n				<div class="Rk-TopBar-Separator"></div>\n			'),__p+="\n		"):(__p+="\n			",options.show_export_button&&(__p+='\n				<div class="Rk-TopBar-Separator"></div>\n				<div class="Rk-TopBar-Button Rk-Export-Button">\n					<div class="Rk-TopBar-Tooltip">\n						<div class="Rk-TopBar-Tooltip-Contents">\n							'+__e(translate("Download Project"))+'\n						</div>\n					</div>\n				</div>\n				<div class="Rk-TopBar-Separator"></div>\n			'),__p+="\n		"),__p+="\n		",options.show_search_field&&(__p+='\n			<form action="#" class="Rk-GraphSearch-Form">\n				<input type="search" class="Rk-GraphSearch-Field" placeholder="'+__e(translate("Search in graph"))+'" />\n			</form>\n			<div class="Rk-TopBar-Separator"></div>\n		'),__p+="\n	</div>\n"),__p+='\n<div class="Rk-Editing-Space',options.show_top_bar||(__p+=" Rk-Editing-Space-Full"),__p+='">\n	<div class="Rk-Labels"></div>\n	<canvas class="Rk-Canvas" ',options.resize&&(__p+=' resize="" '),__p+='></canvas>\n	<div class="Rk-Notifications"></div>\n	<div class="Rk-Editor">\n		',options.show_bins&&(__p+='\n			<div class="Rk-Fold-Bins">&laquo;</div>\n		'),__p+="\n		",options.show_zoom&&(__p+='\n			<div class="Rk-ZoomButtons">\n				<div class="Rk-ZoomIn" title="'+__e(translate("Zoom In"))+'"></div>\n				<div class="Rk-ZoomFit" title="'+__e(translate("Zoom Fit"))+'"></div>\n				<div class="Rk-ZoomOut" title="'+__e(translate("Zoom Out"))+'"></div>\n				',options.editor_mode&&options.save_view&&(__p+='\n					<div class="Rk-ZoomSave" title="'+__e(translate("Zoom Save"))+'"></div>\n				'),__p+="\n				",options.save_view&&(__p+='\n					<div class="Rk-ZoomSetSaved" title="'+__e(translate("View saved zoom"))+'"></div>\n				'),__p+="\n			</div>\n		"),__p+="\n	</div>\n</div>";return __p};
+this.renkanJST=this.renkanJST||{},this.renkanJST["templates/edgeeditor.html"]=function(obj){obj||(obj={});{var __t,__p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n	<span class="Rk-CloseX">&times;</span>'+__e(renkan.translate("Edit Edge"))+"</span>\n</h2>\n<p>\n	<label>"+__e(renkan.translate("Title:"))+'</label>\n	<input class="Rk-Edit-Title" type="text" value="'+__e(edge.title)+'" />\n</p>\n',options.show_edge_editor_uri&&(__p+="\n	<p>\n		<label>"+__e(renkan.translate("URI:"))+'</label>\n		<input class="Rk-Edit-URI" type="text" value="'+__e(edge.uri)+'" />\n		<a class="Rk-Edit-Goto" href="'+__e(edge.uri)+'" target="_blank"></a>\n	</p>\n	',options.properties.length&&(__p+="\n		<p>\n			<label>"+__e(renkan.translate("Choose from vocabulary:"))+'</label>\n			<select class="Rk-Edit-Vocabulary">\n				',_(options.properties).each(function(a){__p+='\n					<option class="Rk-Edit-Vocabulary-Class" value="">\n						'+__e(renkan.translate(a.label))+"\n					</option>\n					",_(a.properties).each(function(b){var c=a["base-uri"]+b.uri;__p+='\n						<option class="Rk-Edit-Vocabulary-Property" value="'+__e(c)+'"\n							',c===edge.uri&&(__p+=" selected"),__p+=">\n							"+__e(renkan.translate(b.label))+"\n						</option>\n					"}),__p+="\n				"}),__p+="\n			</select>\n		</p>\n")),__p+="\n",options.show_edge_editor_color&&(__p+='\n	<div class="Rk-Editor-p">\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("Edge color:"))+'</span>\n		<div class="Rk-Edit-ColorPicker-Wrapper">\n			<span class="Rk-Edit-Color" style="background: &lt;%-edge.color%>;">\n				<span class="Rk-Edit-ColorTip"></span>\n			</span>\n			'+(null==(__t=renkan.colorPicker)?"":__t)+'\n			<span class="Rk-Edit-ColorPicker-Text">'+__e(renkan.translate("Choose color"))+"</span>\n		</div>\n	</div>\n"),__p+="\n",options.show_edge_editor_direction&&(__p+='\n	<p>\n		<span class="Rk-Edit-Direction">'+__e(renkan.translate("Change edge direction"))+"</span>\n	</p>\n"),__p+="\n",options.show_edge_editor_nodes&&(__p+='\n	<p>\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("From:"))+'</span>\n		<span class="Rk-UserColor" style="background: '+__e(edge.from_color)+';"></span>\n		'+__e(shortenText(edge.from_title,25))+'\n	</p>\n	<p>\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("To:"))+'</span>\n		<span class="Rk-UserColor" style="background: >%-edge.to_color%>;"></span>\n		'+__e(shortenText(edge.to_title,25))+"\n	</p>\n"),__p+="\n",options.show_edge_editor_creator&&edge.has_creator&&(__p+='\n	<p>\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n		<span class="Rk-UserColor" style="background: &lt;%-edge.created_by_color%>;"></span>\n		'+__e(shortenText(edge.created_by_title,25))+"\n	</p>\n"),__p+="\n";return __p},this.renkanJST["templates/edgeeditor_readonly.html"]=function(obj){obj||(obj={});{var __p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n	<span class="Rk-CloseX">&times;</span>\n	',options.show_edge_tooltip_color&&(__p+='\n		<span class="Rk-UserColor" style="background: '+__e(edge.color)+';"></span>\n	'),__p+='\n	<span class="Rk-Display-Title">\n		',edge.uri&&(__p+='\n			<a href="'+__e(edge.uri)+'" target="_blank">\n		'),__p+="\n		"+__e(edge.title)+"\n		",edge.uri&&(__p+=" </a> "),__p+="\n	</span>\n</h2>\n",options.show_edge_tooltip_uri&&edge.uri&&(__p+='\n	<p class="Rk-Display-URI">\n		<a href="'+__e(edge.uri)+'" target="_blank">'+__e(edge.short_uri)+"</a>\n	</p>\n"),__p+="\n<p>"+__e(edge.description)+"</p>\n",options.show_edge_tooltip_nodes&&(__p+='\n	<p>\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("From:"))+'</span>\n		<span class="Rk-UserColor" style="background: '+__e(edge.from_color)+';"></span>\n		'+__e(shortenText(edge.from_title,25))+'\n	</p>\n	<p>\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("To:"))+'</span>\n		<span class="Rk-UserColor" style="background: '+__e(edge.to_color)+';"></span>\n		'+__e(shortenText(edge.to_title,25))+"\n	</p>\n"),__p+="\n",options.show_edge_tooltip_creator&&edge.has_creator&&(__p+='\n	<p>\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n		<span class="Rk-UserColor" style="background: '+__e(edge.created_by_color)+';"></span>\n		'+__e(shortenText(edge.created_by_title,25))+"\n	</p>\n"),__p+="\n";return __p},this.renkanJST["templates/ldtjson-bin/annotationtemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Bin-Item" draggable="true"\n	data-image="'+__e(Rkns.Utils.getFullURL(image))+'"\n	data-uri="'+(null==(__t=ldt_platform)?"":__t)+"ldtplatform/ldt/front/player/"+(null==(__t=mediaid)?"":__t)+"/#id="+(null==(__t=annotationid)?"":__t)+'"\n	data-title="'+__e(title)+'" data-description="'+__e(description)+'">\n	\n	<img class="Rk-Ldt-Annotation-Icon" src="'+(null==(__t=image)?"":__t)+'" />\n	<h4>'+(null==(__t=htitle)?"":__t)+"</h4>\n	<p>"+(null==(__t=hdescription)?"":__t)+"</p>\n	<p>Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+'</p>\n	<div class="Rk-Clear"></div>\n</li>';return __p},this.renkanJST["templates/ldtjson-bin/segmenttemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Bin-Item" draggable="true"\n	data-image="'+__e(Rkns.Utils.getFullURL(image))+'"\n	data-uri="'+(null==(__t=ldt_platform)?"":__t)+"ldtplatform/ldt/front/player/"+(null==(__t=mediaid)?"":__t)+"/#id="+(null==(__t=annotationid)?"":__t)+'"\n	data-title="'+__e(title)+'" data-description="'+__e(description)+'">\n	\n	<img class="Rk-Ldt-Annotation-Icon" src="'+(null==(__t=image)?"":__t)+'" />\n	<h4>'+(null==(__t=htitle)?"":__t)+"</h4>\n	<p>"+(null==(__t=hdescription)?"":__t)+"</p>\n	<p>Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+'</p>\n	<div class="Rk-Clear"></div>\n</li>';return __p},this.renkanJST["templates/ldtjson-bin/tagtemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Bin-Item" draggable="true"\n	data-image="'+__e(Rkns.Utils.getFullURL(static_url+"img/ldt-tag.png"))+'"\n	data-uri="'+(null==(__t=ldt_platform)?"":__t)+"ldtplatform/ldt/front/search/?search="+(null==(__t=encodedtitle)?"":__t)+'&field=all"\n	data-title="'+__e(title)+'" data-description="Tag \''+__e(title)+'\'">\n\n	<img class="Rk-Ldt-Tag-Icon" src="'+__e(static_url)+'img/ldt-tag.png" />\n	<h4>'+(null==(__t=htitle)?"":__t)+'</h4>\n	<div class="Rk-Clear"></div>\n</li>';return __p},this.renkanJST["templates/list-bin.html"]=function(obj){obj||(obj={});{var __t,__p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<li class="Rk-Bin-Item Rk-ResourceList-Item" draggable="true"\n	data-uri="'+__e(url)+'" data-title="'+__e(title)+'"\n	data-description="'+__e(description)+'"\n	',__p+=image?'\n		data-image="'+__e(Rkns.Utils.getFullURL(image))+'"\n	':'\n		data-image=""\n	',__p+="\n>",image&&(__p+='\n	<img class="Rk-ResourceList-Image" src="'+__e(image)+'" />\n'),__p+='\n<h4 class="Rk-ResourceList-Title">\n	',url&&(__p+='\n		<a href="'+__e(url)+'" target="_blank">\n	'),__p+="\n	"+(null==(__t=htitle)?"":__t)+"\n	",url&&(__p+="</a>"),__p+="\n	</h4> \n	",description&&(__p+='\n		<p class="Rk-ResourceList-Description">'+(null==(__t=hdescription)?"":__t)+"</p>\n	"),__p+="\n	",image&&(__p+='\n		<div style="clear: both;"></div>\n	'),__p+="\n</li>";return __p},this.renkanJST["templates/main.html"]=function(obj){obj||(obj={});{var __p="",__e=_.escape;Array.prototype.join}with(obj)options.show_bins&&(__p+='\n	<div class="Rk-Bins">\n		<div class="Rk-Bins-Head">\n			<h2 class="Rk-Bins-Title">'+__e(translate("Select contents:"))+'</h2>\n			<form class="Rk-Web-Search-Form Rk-Search-Form">\n				<input class="Rk-Web-Search-Input Rk-Search-Input" type="search"\n					placeholder="'+__e(translate("Search theWeb"))+'" />\n				<div class="Rk-Search-Select">\n					<div class="Rk-Search-Current"></div>\n					<ul class="Rk-Search-List"></ul>\n				</div>\n				<input type="submit" value=""\n					class="Rk-Web-Search-Submit Rk-Search-Submit" title="'+__e(translate("Search theWeb"))+'" />\n			</form>\n			<form class="Rk-Bins-Search-Form Rk-Search-Form">\n				<input class="Rk-Bins-Search-Input Rk-Search-Input" type="search"\n					placeholder="'+__e(translate("Search inBins"))+'" /> <input\n					type="submit" value=""\n					class="Rk-Bins-Search-Submit Rk-Search-Submit"\n					title="'+__e(translate("Search inBins"))+'" />\n			</form>\n		</div>\n		<ul class="Rk-Bin-List"></ul>\n	</div>\n'),__p+=" ",options.show_editor&&(__p+='\n	<div class="Rk-Render Rk-Render-',__p+=options.show_bins?"Panel":"Full",__p+='"></div>\n'),__p+="\n";return __p},this.renkanJST["templates/nodeeditor.html"]=function(obj){obj||(obj={});{var __t,__p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n	<span class="Rk-CloseX">&times;</span>'+__e(renkan.translate("Edit Node"))+"</span>\n</h2>\n<p>\n	<label>"+__e(renkan.translate("Title:"))+'</label>\n	<input class="Rk-Edit-Title" type="text" value="'+__e(node.title)+'" />\n</p>\n',options.show_node_editor_uri&&(__p+="\n	<p>\n		<label>"+__e(renkan.translate("URI:"))+'</label>\n		<input class="Rk-Edit-URI" type="text" value="'+__e(node.uri)+'" />\n		<a class="Rk-Edit-Goto" href="'+__e(node.uri)+'" target="_blank"></a>\n	</p>\n'),__p+=" ",options.show_node_editor_description&&(__p+="\n	<p>\n		<label>"+__e(renkan.translate("Description:"))+'</label>\n		<textarea class="Rk-Edit-Description">'+__e(node.description)+"</textarea>\n	</p>\n"),__p+=" ",options.show_node_editor_size&&(__p+='\n	<p>\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("Size:"))+'</span>\n		<a href="#" class="Rk-Edit-Size-Down">-</a>\n		<span class="Rk-Edit-Size-Value">'+__e(node.size)+'</span>\n		<a href="#" class="Rk-Edit-Size-Up">+</a>\n	</p>\n'),__p+=" ",options.show_node_editor_color&&(__p+='\n	<div class="Rk-Editor-p">\n		<span class="Rk-Editor-Label">\n		'+__e(renkan.translate("Node color:"))+'</span>\n		<div class="Rk-Edit-ColorPicker-Wrapper">\n			<span class="Rk-Edit-Color" style="background: '+__e(node.color)+';">\n				<span class="Rk-Edit-ColorTip"></span>\n			</span>\n			'+(null==(__t=renkan.colorPicker)?"":__t)+'\n			<span class="Rk-Edit-ColorPicker-Text">'+__e(renkan.translate("Choose color"))+"</span>\n		</div>\n	</div>\n"),__p+=" ",options.show_node_editor_image&&(__p+='\n	<div class="Rk-Edit-ImgWrap">\n		<div class="Rk-Edit-ImgPreview">\n			<img src="'+__e(node.image||node.image_placeholder)+'" />\n			',node.clip_path&&(__p+='\n				<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 1 1" preserveAspectRatio="none">\n					<path style="stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;" d="'+__e(node.clip_path)+'" />\n				</svg>\n			'),__p+="\n		</div>\n	</div>\n	<p>\n		<label>"+__e(renkan.translate("Image URL:"))+'</label>\n		<div>\n			<a class="Rk-Edit-Image-Del" href="#"></a>\n			<input class="Rk-Edit-Image" type="text" value=\''+__e(node.image)+"' />\n		</div>\n	</p>\n",options.allow_image_upload&&(__p+="\n	<p>\n		<label>"+__e(renkan.translate("Choose Image File:"))+'</label>\n		<input class="Rk-Edit-Image-File" type="file" accept="image/*" />\n	</p>\n')),__p+=" ",options.show_node_editor_creator&&node.has_creator&&(__p+='\n	<p>\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n		<span class="Rk-UserColor" style="background: '+__e(node.created_by_color)+';"></span>\n		'+__e(shortenText(node.created_by_title,25))+"\n	</p>\n"),__p+=" ",options.change_shapes&&(__p+="\n	<p>\n		<label>"+__e(renkan.translate("Shapes available"))+':</label>\n		<select class="Rk-Edit-Shape">\n			<option class="Rk-Edit-Vocabulary-Property" value="circle"',"circle"===node.shape&&(__p+=" selected"),__p+=">\n				"+__e(renkan.translate("Circle"))+'\n			</option>\n			<option class="Rk-Edit-Vocabulary-Property" value="rectangle"',"rectangle"===node.shape&&(__p+=" selected"),__p+=">\n				"+__e(renkan.translate("Square"))+'\n			</option>\n			<option class="Rk-Edit-Vocabulary-Property" value="diamond"',"diamond"===node.shape&&(__p+=" selected"),__p+=">\n				"+__e(renkan.translate("Diamond"))+'\n			</option>\n			<option class="Rk-Edit-Vocabulary-Property" value="polygon"',"polygon"===node.shape&&(__p+=" selected"),__p+=">\n				"+__e(renkan.translate("Hexagone"))+'\n			</option>\n			<option class="Rk-Edit-Vocabulary-Property" value="ellipse"',"ellipse"===node.shape&&(__p+=" selected"),__p+=">\n				"+__e(renkan.translate("Ellipse"))+'\n			</option>\n			<option class="Rk-Edit-Vocabulary-Property" value="star"',"star"===node.shape&&(__p+=" selected"),__p+=">\n				"+__e(renkan.translate("Star"))+"\n			</option>\n		</select>\n	</p>\n"),__p+="\n";return __p},this.renkanJST["templates/nodeeditor_readonly.html"]=function(obj){obj||(obj={});{var __p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n	<span class="Rk-CloseX">&times;</span>\n	',options.show_node_tooltip_color&&(__p+='\n		<span class="Rk-UserColor" style="background: '+__e(node.color)+';"></span>\n	'),__p+='\n	<span class="Rk-Display-Title">\n		',node.uri&&(__p+='\n			<a href="'+__e(node.uri)+'" target="_blank">\n		'),__p+="\n		"+__e(node.title)+"\n		",node.uri&&(__p+="</a>"),__p+="\n	</span>\n</h2>\n",node.uri&&options.show_node_tooltip_uri&&(__p+='\n	<p class="Rk-Display-URI">\n		<a href="'+__e(node.uri)+'" target="_blank">'+__e(node.short_uri)+"</a>\n	</p>\n"),__p+=" ",options.show_node_tooltip_description&&(__p+='\n	<p class="Rk-Display-Description">'+__e(node.description)+"</p>\n"),__p+=" ",node.image&&options.show_node_tooltip_image&&(__p+='\n	<img class="Rk-Display-ImgPreview" src="'+__e(node.image)+'" />\n'),__p+=" ",node.has_creator&&options.show_node_tooltip_creator&&(__p+='\n	<p>\n		<span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n		<span class="Rk-UserColor" style="background: '+__e(node.created_by_color)+';"></span>\n		'+__e(shortenText(node.created_by_title,25))+"\n	</p>\n"),__p+="\n";return __p},this.renkanJST["templates/scene.html"]=function(obj){function print(){__p+=__j.call(arguments,"")}obj||(obj={});var __p="",__e=_.escape,__j=Array.prototype.join;with(obj)options.show_top_bar&&(__p+='\n	<div class="Rk-TopBar">\n		<div class="loader"></div>\n		',__p+=options.editor_mode?'\n			<input type="text" class="Rk-PadTitle" value="'+__e(project.get("title")||"")+'" placeholder="'+__e(translate("Untitled project"))+'" />\n		':'\n			<h2 class="Rk-PadTitle">\n				'+__e(project.get("title")||translate("Untitled project"))+"\n			</h2>\n		",__p+="\n		",options.show_user_list&&(__p+='\n			<div class="Rk-Users">\n				<div class="Rk-CurrentUser">\n					',options.show_user_color&&(__p+='\n						<div class="Rk-Edit-ColorPicker-Wrapper">\n							<span class="Rk-CurrentUser-Color">\n							',options.user_color_editable&&(__p+='\n								<span class="Rk-Edit-ColorTip"></span>\n							'),__p+="\n							</span>\n							",options.user_color_editable&&print(colorPicker),__p+="\n						</div>\n					"),__p+='\n					<span class="Rk-CurrentUser-Name">&lt;unknown user&gt;</span>\n				</div>\n				<ul class="Rk-UserList"></ul>\n			</div>\n		'),__p+="\n		",options.home_button_url&&(__p+='\n			<div class="Rk-TopBar-Separator"></div>\n			<a class="Rk-TopBar-Button Rk-Home-Button" href="'+__e(options.home_button_url)+'">\n				<div class="Rk-TopBar-Tooltip">\n					<div class="Rk-TopBar-Tooltip-Contents">\n						'+__e(translate(options.home_button_title))+"\n					</div>\n				</div>\n			</a>\n		"),__p+="\n		",options.show_fullscreen_button&&(__p+='\n			<div class="Rk-TopBar-Separator"></div>\n			<div class="Rk-TopBar-Button Rk-FullScreen-Button">\n				<div class="Rk-TopBar-Tooltip">\n					<div class="Rk-TopBar-Tooltip-Contents">\n						'+__e(translate("Full Screen"))+"\n					</div>\n				</div>\n			</div>\n		"),__p+="\n		",options.editor_mode?(__p+="\n			",options.show_addnode_button&&(__p+='\n				<div class="Rk-TopBar-Separator"></div>\n				<div class="Rk-TopBar-Button Rk-AddNode-Button">\n					<div class="Rk-TopBar-Tooltip">\n						<div class="Rk-TopBar-Tooltip-Contents">\n							'+__e(translate("Add Node"))+"\n						</div>\n					</div>\n				</div>\n			"),__p+="\n			",options.show_addedge_button&&(__p+='\n				<div class="Rk-TopBar-Separator"></div>\n				<div class="Rk-TopBar-Button Rk-AddEdge-Button">\n					<div class="Rk-TopBar-Tooltip">\n						<div class="Rk-TopBar-Tooltip-Contents">\n							'+__e(translate("Add Edge"))+"\n						</div>\n					</div>\n				</div>\n			"),__p+="\n			",options.show_export_button&&(__p+='\n				<div class="Rk-TopBar-Separator"></div>\n				<div class="Rk-TopBar-Button Rk-Export-Button">\n					<div class="Rk-TopBar-Tooltip">\n						<div class="Rk-TopBar-Tooltip-Contents">\n							'+__e(translate("Download Project"))+"\n						</div>\n					</div>\n				</div>\n			"),__p+="\n			",options.show_save_button&&(__p+='\n				<div class="Rk-TopBar-Separator"></div>\n				<div class="Rk-TopBar-Button Rk-Save-Button">\n					<div class="Rk-TopBar-Tooltip">\n						<div class="Rk-TopBar-Tooltip-Contents"></div>\n					</div>\n				</div>\n			'),__p+="\n			",options.show_open_button&&(__p+='\n				<div class="Rk-TopBar-Separator"></div>\n				<div class="Rk-TopBar-Button Rk-Open-Button">\n					<div class="Rk-TopBar-Tooltip">\n						<div class="Rk-TopBar-Tooltip-Contents">\n							'+__e(translate("Open Project"))+"\n						</div>\n					</div>\n				</div>\n			"),__p+="\n			",options.show_bookmarklet&&(__p+='\n				<div class="Rk-TopBar-Separator"></div>\n				<a class="Rk-TopBar-Button Rk-Bookmarklet-Button" href="#">\n					<div class="Rk-TopBar-Tooltip">\n						<div class="Rk-TopBar-Tooltip-Contents">\n							'+__e(translate("Renkan 'Drag-to-Add' bookmarklet"))+'\n						</div>\n					</div>\n				</a>\n				<div class="Rk-TopBar-Separator"></div>\n			'),__p+="\n		"):(__p+="\n			",options.show_export_button&&(__p+='\n				<div class="Rk-TopBar-Separator"></div>\n				<div class="Rk-TopBar-Button Rk-Export-Button">\n					<div class="Rk-TopBar-Tooltip">\n						<div class="Rk-TopBar-Tooltip-Contents">\n							'+__e(translate("Download Project"))+'\n						</div>\n					</div>\n				</div>\n				<div class="Rk-TopBar-Separator"></div>\n			'),__p+="\n		"),__p+="\n		",options.show_search_field&&(__p+='\n			<form action="#" class="Rk-GraphSearch-Form">\n				<input type="search" class="Rk-GraphSearch-Field" placeholder="'+__e(translate("Search in graph"))+'" />\n			</form>\n			<div class="Rk-TopBar-Separator"></div>\n		'),__p+="\n	</div>\n"),__p+='\n<div class="Rk-Editing-Space',options.show_top_bar||(__p+=" Rk-Editing-Space-Full"),__p+='">\n	<div class="Rk-Labels"></div>\n	<canvas class="Rk-Canvas" ',options.resize&&(__p+=' resize="" '),__p+='></canvas>\n	<div class="Rk-Notifications"></div>\n	<div class="Rk-Editor">\n		',options.show_bins&&(__p+='\n			<div class="Rk-Fold-Bins">&laquo;</div>\n		'),__p+="\n		",options.show_zoom&&(__p+='\n			<div class="Rk-ZoomButtons">\n				<div class="Rk-ZoomIn" title="'+__e(translate("Zoom In"))+'"></div>\n				<div class="Rk-ZoomFit" title="'+__e(translate("Zoom Fit"))+'"></div>\n				<div class="Rk-ZoomOut" title="'+__e(translate("Zoom Out"))+'"></div>\n				',options.editor_mode&&options.save_view&&(__p+='\n					<div class="Rk-ZoomSave" title="'+__e(translate("Zoom Save"))+'"></div>\n				'),__p+="\n				",options.save_view&&(__p+='\n					<div class="Rk-ZoomSetSaved" title="'+__e(translate("View saved zoom"))+'"></div>\n				'),__p+="\n			</div>\n		"),__p+="\n	</div>\n</div>";return __p},this.renkanJST["templates/wikipedia-bin/resulttemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Wikipedia-Result Rk-Bin-Item" draggable="true"\n	data-uri="'+__e(url)+'" data-title="Wikipedia: '+__e(title)+'"\n	data-description="'+__e(description)+'"\n	data-image="'+__e(Rkns.Utils.getFullURL(static_url+"img/wikipedia.png"))+'">\n	\n	<img class="Rk-Wikipedia-Icon" src="'+__e(static_url)+'img/wikipedia.png">\n	<h4 class="Rk-Wikipedia-Title">\n		<a href="'+__e(url)+'" target="_blank">'+(null==(__t=htitle)?"":__t)+'</a>\n	</h4>\n	<p class="Rk-Wikipedia-Snippet">'+(null==(__t=hdescription)?"":__t)+"</p>\n</li>";return __p},function(a){"use strict";"object"!=typeof a.Rkns&&(a.Rkns={});var b=a.Rkns,c=b.$=a.jQuery,d=b._=a._;b.pickerColors=["#8f1919","#a80000","#d82626","#ff0000","#e87c7c","#ff6565","#f7d3d3","#fecccc","#8f5419","#a85400","#d87f26","#ff7f00","#e8b27c","#ffb265","#f7e5d3","#fee5cc","#8f8f19","#a8a800","#d8d826","#feff00","#e8e87c","#feff65","#f7f7d3","#fefecc","#198f19","#00a800","#26d826","#00ff00","#7ce87c","#65ff65","#d3f7d3","#ccfecc","#198f8f","#00a8a8","#26d8d8","#00feff","#7ce8e8","#65feff","#d3f7f7","#ccfefe","#19198f","#0000a8","#2626d8","#0000ff","#7c7ce8","#6565ff","#d3d3f7","#ccccfe","#8f198f","#a800a8","#d826d8","#ff00fe","#e87ce8","#ff65fe","#f7d3f7","#feccfe","#000000","#242424","#484848","#6d6d6d","#919191","#b6b6b6","#dadada","#ffffff"],b.__renkans=[];var e=b._BaseBin=function(a,c){if("undefined"!=typeof a){this.renkan=a,this.renkan.$.find(".Rk-Bin-Main").hide(),this.$=b.$("<li>").addClass("Rk-Bin").appendTo(a.$.find(".Rk-Bin-List")),this.title_icon_$=b.$("<span>").addClass("Rk-Bin-Title-Icon").appendTo(this.$);var d=this;b.$("<a>").attr({href:"#",title:a.translate("Close bin")}).addClass("Rk-Bin-Close").html("&times;").appendTo(this.$).click(function(){return d.destroy(),a.$.find(".Rk-Bin-Main:visible").length||a.$.find(".Rk-Bin-Main:last").slideDown(),a.resizeBins(),!1}),b.$("<a>").attr({href:"#",title:a.translate("Refresh bin")}).addClass("Rk-Bin-Refresh").appendTo(this.$).click(function(){return d.refresh(),!1}),this.count_$=b.$("<div>").addClass("Rk-Bin-Count").appendTo(this.$),this.title_$=b.$("<h2>").addClass("Rk-Bin-Title").appendTo(this.$),this.main_$=b.$("<div>").addClass("Rk-Bin-Main").appendTo(this.$).html('<h4 class="Rk-Bin-Loading">'+a.translate("Loading, please wait")+"</h4>"),this.title_$.html(c.title||"(new bin)"),this.renkan.resizeBins(),c.auto_refresh&&window.setInterval(function(){d.refresh()},c.auto_refresh)}};e.prototype.destroy=function(){this.$.detach(),this.renkan.resizeBins()};var f=b.Renkan=function(a){var e=this;if(b.__renkans.push(this),this.options=d.defaults(a,b.defaults,{templates:renkanJST}),this.template=renkanJST["templates/main.html"],d(this.options.property_files).each(function(a){b.$.getJSON(a,function(a){e.options.properties=e.options.properties.concat(a)})}),this.read_only=this.options.read_only||!this.options.editor_mode,this.project=new b.Models.Project,this.setCurrentUser=function(a,b){this.project.addUser({_id:a,title:b}),this.current_user=a,this.renderer.redrawUsers()},"undefined"!=typeof this.options.user_id&&(this.current_user=this.options.user_id),this.$=b.$("#"+this.options.container),this.$.addClass("Rk-Main").html(this.template(this)),this.tabs=[],this.search_engines=[],this.current_user_list=new b.Models.UsersList,this.current_user_list.on("add remove",function(){this.renderer&&this.renderer.redrawUsers()}),this.colorPicker=function(){var a=d.template('<li data-color="<%=c%>" style="background: <%=c%>"></li>');return'<ul class="Rk-Edit-ColorPicker">'+b.pickerColors.map(function(b){return a({c:b})}).join("")+"</ul>"}(),this.options.show_editor&&(this.renderer=new b.Renderer.Scene(this)),this.options.search.length){var f=d.template('<li class="<%= className %>" data-key="<%= key %>"><%= title %></li>'),g=this.$.find(".Rk-Search-List"),h=this.$.find(".Rk-Web-Search-Input"),i=this.$.find(".Rk-Web-Search-Form");d(this.options.search).each(function(a){b[a.type]&&b[a.type].Search&&e.search_engines.push(new b[a.type].Search(e,a))}),g.html(d(this.search_engines).map(function(a,b){return f({key:b,title:a.getSearchTitle(),className:a.getBgClass()})}).join("")),g.find("li").click(function(){var a=b.$(this);e.setSearchEngine(a.attr("data-key")),i.submit()}),i.submit(function(){if(h.val()){var a=e.search_engine;a.search(h.val())}return!1}),this.$.find(".Rk-Search-Current").mouseenter(function(){g.slideDown()}),this.$.find(".Rk-Search-Select").mouseleave(function(){g.hide()}),this.setSearchEngine(0)}else this.$.find(".Rk-Web-Search-Form").detach();d(this.options.bins).each(function(a){b[a.type]&&b[a.type].Bin&&e.tabs.push(new b[a.type].Bin(e,a))});var j=!1;this.$.find(".Rk-Bins").on("click",".Rk-Bin-Title,.Rk-Bin-Title-Icon",function(){var a=b.$(this).siblings(".Rk-Bin-Main");a.is(":hidden")&&(e.$.find(".Rk-Bin-Main").slideUp(),a.slideDown())}),this.options.show_editor&&this.$.find(".Rk-Bins").on("mouseover",".Rk-Bin-Item",function(){var a=b.$(this);if(a&&c(a).attr("data-uri")){var f=e.project.get("nodes").where({uri:c(a).attr("data-uri")});d(f).each(function(a){e.renderer.highlightModel(a)})}}).mouseout(function(){e.renderer.unhighlightAll()}).on("mousemove",".Rk-Bin-Item",function(){try{this.dragDrop()}catch(a){}}).on("touchstart",".Rk-Bin-Item",function(){j=!1}).on("touchmove",".Rk-Bin-Item",function(a){a.preventDefault();var b=a.originalEvent.changedTouches[0],c=e.renderer.canvas_$.offset(),d=e.renderer.canvas_$.width(),f=e.renderer.canvas_$.height();if(b.pageX>=c.left&&b.pageX<c.left+d&&b.pageY>=c.top&&b.pageY<c.top+f)if(j)e.renderer.onMouseMove(b,!0);else{j=!0;var g=document.createElement("div");g.appendChild(this.cloneNode(!0)),e.renderer.dropData({"text/html":g.innerHTML},b),e.renderer.onMouseDown(b,!0)}}).on("touchend",".Rk-Bin-Item",function(a){j&&e.renderer.onMouseUp(a.originalEvent.changedTouches[0],!0),j=!1}).on("dragstart",".Rk-Bin-Item",function(a){var b=document.createElement("div");b.appendChild(this.cloneNode(!0));try{a.originalEvent.dataTransfer.setData("text/html",b.innerHTML)}catch(c){a.originalEvent.dataTransfer.setData("text",b.innerHTML)}}),b.$(window).resize(function(){e.resizeBins()});var k=!1,l="";this.$.find(".Rk-Bins-Search-Input").on("change keyup paste input",function(){var a=b.$(this).val();if(a!==l){var c=b.Utils.regexpFromTextOrArray(a.length>1?a:null);c.source!==k&&(k=c.source,d(e.tabs).each(function(a){a.render(c)}))}}),this.$.find(".Rk-Bins-Search-Form").submit(function(){return!1})};f.prototype.translate=function(a){return b.i18n[this.options.language]&&b.i18n[this.options.language][a]?b.i18n[this.options.language][a]:this.options.language.length>2&&b.i18n[this.options.language.substr(0,2)]&&b.i18n[this.options.language.substr(0,2)][a]?b.i18n[this.options.language.substr(0,2)][a]:a},f.prototype.onStatusChange=function(){this.renderer.onStatusChange()},f.prototype.setSearchEngine=function(a){this.search_engine=this.search_engines[a],this.$.find(".Rk-Search-Current").attr("class","Rk-Search-Current "+this.search_engine.getBgClass());for(var b=this.search_engine.getBgClass().split(" "),c="",d=0;d<b.length;d++)c+="."+b[d];this.$.find(".Rk-Web-Search-Input.Rk-Search-Input").attr("placeholder",this.translate("Search in ")+this.$.find(".Rk-Search-List "+c).html())},f.prototype.resizeBins=function(){var a=+this.$.find(".Rk-Bins-Head").outerHeight();this.$.find(".Rk-Bin-Title:visible").each(function(){a+=b.$(this).outerHeight()}),this.$.find(".Rk-Bin-Main").css({height:this.$.find(".Rk-Bins").height()-a})};var g=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)})};b.Utils={getUUID4:g,getUID:function(){function a(a){return 10>a?"0"+a:a}var b=new Date,c=0,d=b.getUTCFullYear()+"-"+a(b.getUTCMonth()+1)+"-"+a(b.getUTCDate())+"-"+g();return function(a){for(var b=(++c).toString(16),e="undefined"==typeof a?"":a+"-";b.length<4;)b="0"+b;return e+d+"-"+b}}(),getFullURL:function(a){if("undefined"==typeof a||null==a)return"";if(/https?:\/\//.test(a))return a;var b=new Image;b.src=a;var c=b.src;return b.src=null,c},inherit:function(a,b){var c=function(){"function"==typeof b&&b.apply(this,Array.prototype.slice.call(arguments,0)),a.apply(this,Array.prototype.slice.call(arguments,0)),"function"!=typeof this._init||this._initialized||(this._init.apply(this,Array.prototype.slice.call(arguments,0)),this._initialized=!0)};return d(c.prototype).extend(a.prototype),c},regexpFromTextOrArray:function(){function a(a){function b(a){return function(b,c){a=a.replace(h[b],c)}}for(var e=a.toLowerCase().replace(g,""),i="",j=0;j<e.length;j++){j&&(i+=f+"*");var k=e[j];d(c).each(b(k)),i+=k}return i}function b(c){switch(typeof c){case"string":return a(c);case"object":var e="";return d(c).each(function(a){var c=b(a);c&&(e&&(e+="|"),e+=c)}),e}return""}var c=["[aáàâä]","[cç]","[eéèêë]","[iíìîï]","[oóòôö]","[uùûü]"],e=[String.fromCharCode(768),String.fromCharCode(769),String.fromCharCode(770),String.fromCharCode(771),String.fromCharCode(807),"{","}","(",")","[","]","【","】","、","・","‥","。","「","」","『","』","〜",":","!","?"," ",","," ",";","(",")",".","*","+","\\","?","|","{","}","[","]","^","#","/"],f="[\\"+e.join("\\")+"]",g=new RegExp(f,"gm"),h=d(c).map(function(a){return new RegExp(a)});return function(a){var c=b(a);if(c){var d=new RegExp(c,"im"),e=new RegExp("("+c+")","igm");return{isempty:!1,source:c,test:function(a){return d.test(a)},replace:function(a,b){return a.replace(e,b)}}}return{isempty:!0,source:"",test:function(){return!0},replace:function(){return text}}}}(),_MIN_DRAG_DISTANCE:2,_NODE_BUTTON_WIDTH:40,_EDGE_BUTTON_INNER:2,_EDGE_BUTTON_OUTER:40,_CLICKMODE_ADDNODE:1,_CLICKMODE_STARTEDGE:2,_CLICKMODE_ENDEDGE:3,_NODE_SIZE_STEP:Math.LN2/4,_MIN_SCALE:.05,_MAX_SCALE:20,_MOUSEMOVE_RATE:80,_DOUBLETAP_DELAY:800,_DOUBLETAP_DISTANCE:400,_USER_PLACEHOLDER:function(a){return{color:a.options.default_user_color,title:a.translate("(unknown user)"),get:function(a){return this[a]||!1}}},_BOOKMARKLET_CODE:function(a){return"(function(a,b,c,d,e,f,h,i,j,k,l,m,n,o,p,q,r){a=document;b=a.body;c=a.location.href;j='draggable';m='text/x-iri-';d=a.createElement('div');d.innerHTML='<p_style=\"position:fixed;top:0;right:0;font:bold_18px_sans-serif;color:#fff;background:#909;padding:10px;z-index:100000;\">"+a.translate("Drag items from this website, drop them in Renkan").replace(/ /g,"_")+"</p>'.replace(/_/g,String.fromCharCode(32));b.appendChild(d);e=[{r:/https?:\\/\\/[^\\/]*twitter\\.com\\//,s:'.tweet',n:'twitter'},{r:/https?:\\/\\/[^\\/]*google\\.[^\\/]+\\//,s:'.g',n:'google'},{r:/https?:\\/\\/[^\\/]*lemonde\\.fr\\//,s:'[data-vr-contentbox]',n:'lemonde'}];f=false;e.forEach(function(g){if(g.r.test(c)){f=g;}});if(f){h=function(){Array.prototype.forEach.call(a.querySelectorAll(f.s),function(i){i[j]=true;k=i.style;k.borderWidth='2px';k.borderColor='#909';k.borderStyle='solid';k.backgroundColor='rgba(200,0,180,.1)';})};window.setInterval(h,500);h();};a.addEventListener('dragstart',function(k){l=k.dataTransfer;l.setData(m+'source-uri',c);l.setData(m+'source-title',a.title);n=k.target;if(f){o=n;while(!o.attributes[j]){o=o.parentNode;if(o==b){break;}}}if(f&&o.attributes[j]){p=o.cloneNode(true);l.setData(m+'specific-site',f.n)}else{q=a.getSelection();if(q.type==='Range'||!q.type){p=q.getRangeAt(0).cloneContents();}else{p=n.cloneNode();}}r=a.createElement('div');r.appendChild(p);l.setData('text/x-iri-selected-text',r.textContent.trim());l.setData('text/x-iri-selected-html',r.innerHTML);},false);})();"},shortenText:function(a,b){return a.length>b?a.substr(0,b)+"…":a},drawEditBox:function(a,b,c,d,e){e.css({width:a.tooltip_width-2*a.tooltip_padding});var f=e.outerHeight()+2*a.tooltip_padding,g=b.x<paper.view.center.x?1:-1,h=b.x+g*(d+a.tooltip_arrow_length),i=b.x+g*(d+a.tooltip_arrow_length+a.tooltip_width),j=b.y-f/2;j+f>paper.view.size.height-a.tooltip_margin&&(j=Math.max(paper.view.size.height-a.tooltip_margin,b.y+a.tooltip_arrow_width/2)-f),j<a.tooltip_margin&&(j=Math.min(a.tooltip_margin,b.y-a.tooltip_arrow_width/2));var k=j+f;return c.segments[0].point=c.segments[7].point=b.add([g*d,0]),c.segments[1].point.x=c.segments[2].point.x=c.segments[5].point.x=c.segments[6].point.x=h,c.segments[3].point.x=c.segments[4].point.x=i,c.segments[2].point.y=c.segments[3].point.y=j,c.segments[4].point.y=c.segments[5].point.y=k,c.segments[1].point.y=b.y-a.tooltip_arrow_width/2,c.segments[6].point.y=b.y+a.tooltip_arrow_width/2,c.closed=!0,c.fillColor=new paper.GradientColor(new paper.Gradient([a.tooltip_top_color,a.tooltip_bottom_color]),[0,j],[0,k]),e.css({left:a.tooltip_padding+Math.min(h,i),top:a.tooltip_padding+j}),c
+}}}(window),function(){"use strict";var a=this,b=a.Backbone,c=a.Rkns.Models={};c.getUID=function(a){var b="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)});return"undefined"!=typeof a?a.type+"-"+b:b};{var d=b.RelationalModel.extend({idAttribute:"_id",constructor:function(a){"undefined"!=typeof a&&(a._id=a._id||a.id||c.getUID(this),a.title=a.title||"",a.description=a.description||"",a.uri=a.uri||"","function"==typeof this.prepare&&(a=this.prepare(a))),b.RelationalModel.prototype.constructor.call(this,a)},validate:function(){return this.type?void 0:"object has no type"},addReference:function(a,b,c,d,e){var f=c.get(d);a[b]="undefined"==typeof f&&"undefined"!=typeof e?e:f}}),e=c.User=d.extend({type:"user",prepare:function(a){return a.color=a.color||"#666666",a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),color:this.get("color")}}}),f=c.Node=d.extend({type:"node",relations:[{type:b.HasOne,key:"created_by",relatedModel:e}],prepare:function(a){var b=a.project;return this.addReference(a,"created_by",b.get("users"),a.created_by,b.current_user),a.description=a.description||"",a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),position:this.get("position"),image:this.get("image"),color:this.get("color"),created_by:this.get("created_by")?this.get("created_by").get("_id"):null,size:this.get("size"),clip_path:this.get("clip_path"),shape:this.get("shape")}}}),g=c.Edge=d.extend({type:"edge",relations:[{type:b.HasOne,key:"created_by",relatedModel:e},{type:b.HasOne,key:"from",relatedModel:f},{type:b.HasOne,key:"to",relatedModel:f}],prepare:function(a){var b=a.project;return this.addReference(a,"created_by",b.get("users"),a.created_by,b.current_user),this.addReference(a,"from",b.get("nodes"),a.from),this.addReference(a,"to",b.get("nodes"),a.to),a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),from:this.get("from")?this.get("from").get("_id"):null,to:this.get("to")?this.get("to").get("_id"):null,color:this.get("color"),created_by:this.get("created_by")?this.get("created_by").get("_id"):null}}}),h=c.View=d.extend({type:"view",relations:[{type:b.HasOne,key:"created_by",relatedModel:e}],prepare:function(a){var b=a.project;if(this.addReference(a,"created_by",b.get("users"),a.created_by,b.current_user),a.description=a.description||"","undefined"!=typeof a.offset){var c={};Array.isArray(a.offset)?(c.x=a.offset[0],c.y=a.offset.length>1?a.offset[1]:a.offset[0]):null!=a.offset.x&&(c.x=a.offset.x,c.y=a.offset.y),a.offset=c}return a},toJSON:function(){return{_id:this.get("_id"),zoom_level:this.get("zoom_level"),offset:this.get("offset"),title:this.get("title"),description:this.get("description"),created_by:this.get("created_by")?this.get("created_by").get("_id"):null}}}),i=(c.Project=d.extend({type:"project",blacklist:["save_status"],relations:[{type:b.HasMany,key:"users",relatedModel:e,reverseRelation:{key:"project",includeInJSON:"_id"}},{type:b.HasMany,key:"nodes",relatedModel:f,reverseRelation:{key:"project",includeInJSON:"_id"}},{type:b.HasMany,key:"edges",relatedModel:g,reverseRelation:{key:"project",includeInJSON:"_id"}},{type:b.HasMany,key:"views",relatedModel:h,reverseRelation:{key:"project",includeInJSON:"_id"}}],addUser:function(a,b){a.project=this;var c=e.findOrCreate(a);return this.get("users").push(c,b),c},addNode:function(a,b){a.project=this;var c=f.findOrCreate(a);return this.get("nodes").push(c,b),c},addEdge:function(a,b){a.project=this;var c=g.findOrCreate(a);return this.get("edges").push(c,b),c},addView:function(a,b){a.project=this;var c=h.findOrCreate(a);return this.get("views").push(c,b),c},removeNode:function(a){this.get("nodes").remove(a)},removeEdge:function(a){this.get("edges").remove(a)},validate:function(a){var b=this;_([].concat(a.users,a.nodes,a.edges,a.views)).each(function(a){a&&(a.project=b)})},initialize:function(){var a=this;this.on("remove:nodes",function(b){a.get("edges").remove(a.get("edges").filter(function(a){return a.get("from")===b||a.get("to")===b}))})},toJSON:function(){var a=_.clone(this.attributes);for(var c in a)(a[c]instanceof b.Model||a[c]instanceof b.Collection||a[c]instanceof d)&&(a[c]=a[c].toJSON());return _.omit(a,this.blacklist)}}),c.RosterUser=b.Model.extend({type:"roster_user",idAttribute:"_id",constructor:function(a){"undefined"!=typeof a&&(a._id=a._id||a.id||c.getUID(this),a.title=a.title||"(untitled "+this.type+")",a.description=a.description||"",a.uri=a.uri||"",a.project=a.project||null,a.site_id=a.site_id||0,"function"==typeof this.prepare&&(a=this.prepare(a))),b.Model.prototype.constructor.call(this,a)},validate:function(){return this.type?void 0:"object has no type"},prepare:function(a){return a.color=a.color||"#666666",a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),color:this.get("color"),project:null!=this.get("project")?this.get("project").get("id"):null,site_id:this.get("site_id")}}}));c.UsersList=b.Collection.extend({model:i})}}.call(window),Rkns.defaults={language:navigator.language||navigator.userLanguage||"en",container:"renkan",search:[],bins:[],static_url:"",show_bins:!0,properties:[],show_editor:!0,read_only:!1,editor_mode:!0,manual_save:!1,show_top_bar:!0,default_user_color:"#303030",size_bug_fix:!0,force_resize:!1,allow_double_click:!0,zoom_on_scroll:!0,element_delete_delay:0,autoscale_padding:50,resize:!0,show_zoom:!0,save_view:!0,default_view:!1,show_search_field:!0,show_user_list:!0,user_name_editable:!0,user_color_editable:!0,show_user_color:!0,show_save_button:!0,show_export_button:!0,show_open_button:!1,show_addnode_button:!0,show_addedge_button:!0,show_bookmarklet:!0,show_fullscreen_button:!0,home_button_url:!1,home_button_title:"Home",show_minimap:!0,minimap_width:160,minimap_height:120,minimap_padding:20,minimap_background_color:"#ffffff",minimap_border_color:"#cccccc",minimap_highlight_color:"#ffff00",minimap_highlight_weight:5,buttons_background:"#202020",buttons_label_color:"#c000c0",buttons_label_font_size:9,show_node_circles:!0,clip_node_images:!0,node_images_fill_mode:!1,node_size_base:25,node_stroke_width:2,selected_node_stroke_width:4,node_fill_color:"#ffffff",highlighted_node_fill_color:"#ffff00",node_label_distance:5,node_label_max_length:60,label_untitled_nodes:"(untitled)",change_shapes:!0,edge_stroke_width:2,selected_edge_stroke_width:4,edge_label_distance:0,edge_label_max_length:20,edge_arrow_length:18,edge_arrow_width:12,edge_gap_in_bundles:12,label_untitled_edges:"",tooltip_width:275,tooltip_padding:10,tooltip_margin:15,tooltip_arrow_length:20,tooltip_arrow_width:40,tooltip_top_color:"#f0f0f0",tooltip_bottom_color:"#d0d0d0",tooltip_border_color:"#808080",tooltip_border_width:1,show_node_editor_uri:!0,show_node_editor_description:!0,show_node_editor_size:!0,show_node_editor_color:!0,show_node_editor_image:!0,show_node_editor_creator:!0,allow_image_upload:!0,uploaded_image_max_kb:500,show_node_tooltip_uri:!0,show_node_tooltip_description:!0,show_node_tooltip_color:!0,show_node_tooltip_image:!0,show_node_tooltip_creator:!0,show_edge_editor_uri:!0,show_edge_editor_color:!0,show_edge_editor_direction:!0,show_edge_editor_nodes:!0,show_edge_editor_creator:!0,show_edge_tooltip_uri:!0,show_edge_tooltip_color:!0,show_edge_tooltip_nodes:!0,show_edge_tooltip_creator:!0},Rkns.i18n={fr:{"Edit Node":"Édition d’un nœud","Edit Edge":"Édition d’un lien","Title:":"Titre :","URI:":"URI :","Description:":"Description :","From:":"De :","To:":"Vers :",Image:"Image","Image URL:":"URL d'Image","Choose Image File:":"Choisir un fichier image","Full Screen":"Mode plein écran","Add Node":"Ajouter un nœud","Add Edge":"Ajouter un lien","Save Project":"Enregistrer le projet","Open Project":"Ouvrir un projet","Auto-save enabled":"Enregistrement automatique activé","Connection lost":"Connexion perdue","Created by:":"Créé par :","Zoom In":"Agrandir l’échelle","Zoom Out":"Rapetisser l’échelle",Edit:"Éditer",Remove:"Supprimer","Cancel deletion":"Annuler la suppression","Link to another node":"Créer un lien",Enlarge:"Agrandir",Shrink:"Rétrécir","Click on the background canvas to add a node":"Cliquer sur le fond du graphe pour rajouter un nœud","Click on a first node to start the edge":"Cliquer sur un premier nœud pour commencer le lien","Click on a second node to complete the edge":"Cliquer sur un second nœud pour terminer le lien",Wikipedia:"Wikipédia","Wikipedia in ":"Wikipédia en ",French:"Français",English:"Anglais",Japanese:"Japonais","Untitled project":"Projet sans titre","Lignes de Temps":"Lignes de Temps","Loading, please wait":"Chargement en cours, merci de patienter","Edge color:":"Couleur :","Node color:":"Couleur :","Choose color":"Choisir une couleur","Change edge direction":"Changer le sens du lien","Do you really wish to remove node ":"Voulez-vous réellement supprimer le nœud ","Do you really wish to remove edge ":"Voulez-vous réellement supprimer le lien ","This file is not an image":"Ce fichier n'est pas une image","Image size must be under ":"L'image doit peser moins de ","Size:":"Taille :",KB:"ko","Choose from vocabulary:":"Choisir dans un vocabulaire :","SKOS Documentation properties":"SKOS: Propriétés documentaires","has note":"a pour note","has example":"a pour exemple","has definition":"a pour définition","SKOS Semantic relations":"SKOS: Relations sémantiques","has broader":"a pour concept plus large","has narrower":"a pour concept plus étroit","has related":"a pour concept apparenté","Dublin Core Metadata":"Métadonnées Dublin Core","has contributor":"a pour contributeur",covers:"couvre","created by":"créé par","has date":"a pour date","published by":"édité par","has source":"a pour source","has subject":"a pour sujet","Dragged resource":"Ressource glisée-déposée","Search the Web":"Rechercher en ligne","Search in Bins":"Rechercher dans les chutiers","Close bin":"Fermer le chutier","Refresh bin":"Rafraîchir le chutier","(untitled)":"(sans titre)","Select contents:":"Sélectionner des contenus :","Drag items from this website, drop them in Renkan":"Glissez des éléments de ce site web vers Renkan","Drag this button to your bookmark bar. When on a third-party website, click it to enable drag-and-drop from the website to Renkan.":"Glissez ce bouton vers votre barre de favoris. Ensuite, depuis un site tiers, cliquez dessus pour activer 'Drag-to-Add' puis glissez des éléments de ce site vers Renkan","Shapes available":"Formes disponibles",Circle:"Cercle",Square:"Carré",Diamond:"Losange",Hexagone:"Hexagone",Ellipse:"Ellipse",Star:"Étoile","Zoom Fit":"Ajuster le Zoom","Download Project":"Télécharger le projet","Zoom Save":"Sauver le Zoom","View saved zoom":"Restaurer le Zoom","Renkan 'Drag-to-Add' bookmarklet":"Renkan 'Deplacer-Pour-Ajouter' Signet","(unknown user)":"(non authentifié)","<unknown user>":"<non authentifié>","Search in graph":"Rechercher dans carte","Search in ":"Chercher dans "}},Rkns.jsonIO=function(a,b){var c=a.project;"undefined"==typeof b.http_method&&(b.http_method="PUT");var d=function(){a.renderer.redrawActive=!1,c.set({loading_status:!0}),Rkns.$.getJSON(b.url,function(b){c.set(b,{validate:!0}),c.set({loading_status:!1}),c.set({save_status:0}),a.renderer.redrawActive=!0,a.renderer.fixSize()})},e=function(){c.set({save_status:2});var d=c.toJSON();a.read_only||Rkns.$.ajax({type:b.http_method,url:b.url,contentType:"application/json",data:JSON.stringify(d),success:function(){c.set({save_status:0})}})},f=Rkns._.throttle(function(){setTimeout(e,100)},1e3);c.on("add:nodes add:edges add:users add:views",function(a){a.on("change remove",function(){f()}),f()}),c.on("change",function(){1===c.changedAttributes.length&&c.hasChanged("save_status")||f()}),d()},Rkns.jsonIOSaveOnClick=function(a,b){var c=a.project,d=!1,e=function(){return"Project not saved"};"undefined"==typeof b.http_method&&(b.http_method="POST");var f=function(){var d={},e=/id=([^&#?=]+)/,f=document.location.hash.match(e);f&&(d.id=f[1]),Rkns.$.ajax({url:b.url,data:d,beforeSend:function(){c.set({loading_status:!0})},success:function(b){c.set(b,{validate:!0}),c.set({loading_status:!1}),c.set({save_status:0}),a.renderer.autoScale()}})},g=function(){c.set("saved_at",new Date);var a=c.toJSON();Rkns.$.ajax({type:b.http_method,url:b.url,contentType:"application/json",data:JSON.stringify(a),beforeSend:function(){c.set({save_status:2})},success:function(){$(window).off("beforeunload",e),d=!1,c.set({save_status:0})}})},h=function(){c.set({save_status:1});var a=c.get("title");a&&c.get("nodes").length?$(".Rk-Save-Button").removeClass("disabled"):$(".Rk-Save-Button").addClass("disabled"),a&&$(".Rk-PadTitle").css("border-color","#333333"),d||(d=!0,$(window).on("beforeunload",e))};f(),c.on("add:nodes add:edges add:users change",function(a){a.on("change remove",function(a){1===a.changedAttributes.length&&a.hasChanged("save_status")||h()}),1===c.changedAttributes.length&&c.hasChanged("save_status")||h()}),a.renderer.save=function(){$(".Rk-Save-Button").hasClass("disabled")?c.get("title")||$(".Rk-PadTitle").css("border-color","#ff0000"):g()}},function(a){"use strict";var b=a._,c=a.Ldt={},d=(c.Bin=function(a,b){if(b.ldt_type){var d=c[b.ldt_type+"Bin"];if(d)return new d(a,b)}console.error("No such LDT Bin Type")},c.ProjectBin=a.Utils.inherit(a._BaseBin));d.prototype.tagTemplate=renkanJST["templates/ldtjson-bin/tagtemplate.html"],d.prototype.annotationTemplate=renkanJST["templates/ldtjson-bin/annotationtemplate.html"],d.prototype._init=function(a,b){this.renkan=a,this.proj_id=b.project_id,this.ldt_platform=b.ldt_platform||"http://ldt.iri.centrepompidou.fr/",this.title_$.html(b.title),this.title_icon_$.addClass("Rk-Ldt-Title-Icon"),this.refresh()},d.prototype.render=function(c){function d(a){var c=b(a).escape();return f.isempty?c:f.replace(c,"<span class='searchmatch'>$1</span>")}function e(a){function b(a){for(var b=a.toString();b.length<2;)b="0"+b;return b}var c=Math.abs(Math.floor(a/1e3)),d=Math.floor(c/3600),e=Math.floor(c/60)%60,f=c%60,g="";return d&&(g+=b(d)+":"),g+=b(e)+":"+b(f)}var f=c||a.Utils.regexpFromTextOrArray(),g="<li><h3>Tags</h3></li>",h=this.data.meta["dc:title"],i=this,j=0;i.title_$.text('LDT Project: "'+h+'"'),b(i.data.tags).map(function(a){var b=a.meta["dc:title"];(f.isempty||f.test(b))&&(j++,g+=i.tagTemplate({ldt_platform:i.ldt_platform,title:b,htitle:d(b),encodedtitle:encodeURIComponent(b),static_url:i.renkan.options.static_url}))}),g+="<li><h3>Annotations</h3></li>",b(i.data.annotations).map(function(a){var b=a.content.description,c=a.content.title.replace(b,"");if(f.isempty||f.test(c)||f.test(b)){j++;var h=a.end-a.begin,k=a.content&&a.content.img&&a.content.img.src?a.content.img.src:h?i.renkan.options.static_url+"img/ldt-segment.png":i.renkan.options.static_url+"img/ldt-point.png";g+=i.annotationTemplate({ldt_platform:i.ldt_platform,title:c,htitle:d(c),description:b,hdescription:d(b),start:e(a.begin),end:e(a.end),duration:e(h),mediaid:a.media,annotationid:a.id,image:k,static_url:i.renkan.options.static_url})}}),this.main_$.html(g),!f.isempty&&j?this.count_$.text(j).show():this.count_$.hide(),f.isempty||j?this.$.show():this.$.hide(),this.renkan.resizeBins()},d.prototype.refresh=function(){var b=this;a.$.ajax({url:this.ldt_platform+"ldtplatform/ldt/cljson/id/"+this.proj_id,dataType:"jsonp",success:function(a){b.data=a,b.render()}})};var e=c.Search=function(a,b){this.renkan=a,this.lang=b.lang||"en"};e.prototype.getBgClass=function(){return"Rk-Ldt-Icon"},e.prototype.getSearchTitle=function(){return this.renkan.translate("Lignes de Temps")},e.prototype.search=function(a){this.renkan.tabs.push(new f(this.renkan,{search:a}))};var f=c.ResultsBin=a.Utils.inherit(a._BaseBin);f.prototype.segmentTemplate=renkanJST["templates/ldtjson-bin/segmenttemplate.html"],f.prototype._init=function(a,b){this.renkan=a,this.ldt_platform=b.ldt_platform||"http://ldt.iri.centrepompidou.fr/",this.max_results=b.max_results||50,this.search=b.search,this.title_$.html('Lignes de Temps: "'+b.search+'"'),this.title_icon_$.addClass("Rk-Ldt-Title-Icon"),this.refresh()},f.prototype.render=function(c){function d(a){return g.replace(b(a).escape(),"<span class='searchmatch'>$1</span>")}function e(a){function b(a){for(var b=a.toString();b.length<2;)b="0"+b;return b}var c=Math.abs(Math.floor(a/1e3)),d=Math.floor(c/3600),e=Math.floor(c/60)%60,f=c%60,g="";return d&&(g+=b(d)+":"),g+=b(e)+":"+b(f)}if(this.data){var f=c||a.Utils.regexpFromTextOrArray(),g=f.isempty?a.Utils.regexpFromTextOrArray(this.search):f,h="",i=this,j=0;b(this.data.objects).each(function(a){var b=a["abstract"],c=a.title;if(f.isempty||f.test(c)||f.test(b)){j++;var g=a.duration,k=a.start_ts,l=+a.duration+k,m=g?i.renkan.options.static_url+"img/ldt-segment.png":i.renkan.options.static_url+"img/ldt-point.png";h+=i.segmentTemplate({ldt_platform:i.ldt_platform,title:c,htitle:d(c),description:b,hdescription:d(b),start:e(k),end:e(l),duration:e(g),mediaid:a.iri_id,annotationid:a.element_id,image:m})}}),this.main_$.html(h),!f.isempty&&j?this.count_$.text(j).show():this.count_$.hide(),f.isempty||j?this.$.show():this.$.hide(),this.renkan.resizeBins()}},f.prototype.refresh=function(){var b=this;a.$.ajax({url:this.ldt_platform+"ldtplatform/api/ldt/1.0/segments/search/",data:{format:"jsonp",q:this.search,limit:this.max_results},dataType:"jsonp",success:function(a){b.data=a,b.render()}})}}(window.Rkns),Rkns.ResourceList={},Rkns.ResourceList.Bin=Rkns.Utils.inherit(Rkns._BaseBin),Rkns.ResourceList.Bin.prototype.resultTemplate=renkanJST["templates/list-bin.html"],Rkns.ResourceList.Bin.prototype._init=function(a,b){this.renkan=a,this.title_$.html(b.title),b.list&&(this.data=b.list),this.refresh()},Rkns.ResourceList.Bin.prototype.render=function(a){function b(a){var b=_(a).escape();return c.isempty?b:c.replace(b,"<span class='searchmatch'>$1</span>")}var c=a||Rkns.Utils.regexpFromTextOrArray(),d="",e=this,f=0;Rkns._(this.data).each(function(a){var g;if("string"==typeof a)if(/^(https?:\/\/|www)/.test(a))g={url:a};else{g={title:a.replace(/[:,]?\s?(https?:\/\/|www)[\d\w\/.&?=#%-_]+\s?/,"").trim()};var h=a.match(/(https?:\/\/|www)[\d\w\/.&?=#%-_]+/);h&&(g.url=h[0]),g.title.length>80&&(g.description=g.title,g.title=g.title.replace(/^(.{30,60})\s.+$/,"$1…"))}else g=a;var i=g.title||(g.url||"").replace(/^https?:\/\/(www\.)?/,"").replace(/^(.{40}).+$/,"$1…"),j=g.url||"",k=g.description||"",l=g.image||"";j&&!/^https?:\/\//.test(j)&&(j="http://"+j),(c.isempty||c.test(i)||c.test(k))&&(f++,d+=e.resultTemplate({url:j,title:i,htitle:b(i),image:l,description:k,hdescription:b(k),static_url:e.renkan.options.static_url}))}),e.main_$.html(d),!c.isempty&&f?this.count_$.text(f).show():this.count_$.hide(),c.isempty||f?this.$.show():this.$.hide(),this.renkan.resizeBins()},Rkns.ResourceList.Bin.prototype.refresh=function(){this.data&&this.render()},Rkns.Wikipedia={},Rkns.Wikipedia.Search=function(a,b){this.renkan=a,this.lang=b.lang||"en"},Rkns.Wikipedia.Search.prototype.getBgClass=function(){return"Rk-Wikipedia-Search-Icon Rk-Wikipedia-Lang-"+this.lang},Rkns.Wikipedia.Search.prototype.getSearchTitle=function(){var a={fr:"French",en:"English",ja:"Japanese"};return a[this.lang]?this.renkan.translate("Wikipedia in ")+this.renkan.translate(a[this.lang]):this.renkan.translate("Wikipedia")+" ["+this.lang+"]"},Rkns.Wikipedia.Search.prototype.search=function(a){this.renkan.tabs.push(new Rkns.Wikipedia.Bin(this.renkan,{lang:this.lang,search:a}))},Rkns.Wikipedia.Bin=Rkns.Utils.inherit(Rkns._BaseBin),Rkns.Wikipedia.Bin.prototype.resultTemplate=renkanJST["templates/wikipedia-bin/resulttemplate.html"],Rkns.Wikipedia.Bin.prototype._init=function(a,b){this.renkan=a,this.search=b.search,this.lang=b.lang||"en",this.title_icon_$.addClass("Rk-Wikipedia-Title-Icon Rk-Wikipedia-Lang-"+this.lang),this.title_$.html(this.search).addClass("Rk-Wikipedia-Title"),this.refresh()},Rkns.Wikipedia.Bin.prototype.render=function(a){function b(a){return d.replace(_(a).escape(),"<span class='searchmatch'>$1</span>")}var c=a||Rkns.Utils.regexpFromTextOrArray(),d=c.isempty?Rkns.Utils.regexpFromTextOrArray(this.search):c,e="",f=this,g=0;Rkns._(this.data.query.search).each(function(a){var d=a.title,h="http://"+f.lang+".wikipedia.org/wiki/"+encodeURI(d.replace(/ /g,"_")),i=Rkns.$("<div>").html(a.snippet).text();(c.isempty||c.test(d)||c.test(i))&&(g++,e+=f.resultTemplate({url:h,title:d,htitle:b(d),description:i,hdescription:b(i),static_url:f.renkan.options.static_url}))}),f.main_$.html(e),!c.isempty&&g?this.count_$.text(g).show():this.count_$.hide(),c.isempty||g?this.$.show():this.$.hide(),this.renkan.resizeBins()},Rkns.Wikipedia.Bin.prototype.refresh=function(){var a=this;Rkns.$.ajax({url:"http://"+a.lang+".wikipedia.org/w/api.php?action=query&list=search&srsearch="+encodeURIComponent(this.search)+"&format=json",dataType:"jsonp",success:function(b){a.data=b,a.render()}})},define("renderer/baserepresentation",["jquery","underscore"],function(a,b){var c=function(a,c){if("undefined"!=typeof a&&(this.renderer=a,this.renkan=a.renkan,this.project=a.renkan.project,this.options=a.renkan.options,this.model=c,this.model)){var d=this;this._changeBinding=function(){d.redraw()},this._removeBinding=function(){a.removeRepresentation(d),b(function(){a.redraw()}).defer()},this._selectBinding=function(){d.select()},this._unselectBinding=function(){d.unselect()},this.model.on("change",this._changeBinding),this.model.on("remove",this._removeBinding),this.model.on("select",this._selectBinding),this.model.on("unselect",this._unselectBinding)}};return b(c.prototype).extend({_super:function(a){return c.prototype[a].apply(this,Array.prototype.slice.call(arguments,1))},redraw:function(){},moveTo:function(){},show:function(){return"BaseRepresentation.show"},hide:function(){},select:function(){this.model&&this.model.trigger("selected")},unselect:function(){this.model&&this.model.trigger("unselected")},highlight:function(){},unhighlight:function(){},mousedown:function(){},mouseup:function(){this.model&&this.model.trigger("clicked")},destroy:function(){this.model&&(this.model.off("change",this._changeBinding),this.model.off("remove",this._removeBinding),this.model.off("select",this._selectBinding),this.model.off("unselect",this._unselectBinding))}}),c}),define("requtils",[],function(){return{getUtils:function(){return window.Rkns.Utils},getRenderer:function(){return window.Rkns.Renderer}}}),define("renderer/basebutton",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({moveTo:function(a){this.sector.moveTo(a)},show:function(){this.sector.show()},hide:function(){this.sector.hide()},select:function(){this.sector.select()},unselect:function(a){this.sector.unselect(),(!a||a!==this.source_representation&&a.source_representation!==this.source_representation)&&this.source_representation.unselect()},destroy:function(){this.sector.destroy()}}),f}),define("renderer/shapebuilder",[],function(){var a={circle:{getShape:function(){return new paper.Path.Circle([0,0],1)},getImageShape:function(a,b){return new paper.Path.Circle(a,b)}},rectangle:{getShape:function(){return new paper.Path.Rectangle([-2,-2],[2,2])},getImageShape:function(a,b){return new paper.Path.Rectangle([-b,-b],[2*b,2*b])}},ellipse:{getShape:function(){return new paper.Path.Ellipse(new paper.Rectangle([-2,-1],[2,1]))},getImageShape:function(a,b){return new paper.Path.Ellipse(new paper.Rectangle([-b,-b/2],[2*b,b]))}},polygon:{getShape:function(){return new paper.Path.RegularPolygon([0,0],6,1)},getImageShape:function(a,b){return new paper.Path.RegularPolygon([0,0],6,b)}},diamond:{getShape:function(){var a=new paper.Path.Rectangle([-2,-2],[2,2]);return a.rotate(45),a},getImageShape:function(a,b){var c=new paper.Path.Rectangle([-b,-b],[2*b,2*b]);return c.rotate(45),c}},star:{getShape:function(){return new paper.Path.Star([0,0],8,1,.7)},getImageShape:function(a,b){return new paper.Path.Star([0,0],8,1*b,.7*b)}},svg:function(a){return{getShape:function(){return new paper.Path(a)},getImageShape:function(){return new paper.Path}}}},b=function(b){return"undefined"==typeof b&&(b="circle"),"svg:"===b.substr(0,4)?a.svg(b.substr(4)):(b in a||(b="circle"),a[b])};return b}),define("renderer/noderepr",["jquery","underscore","requtils","renderer/baserepresentation","renderer/shapebuilder"],function(a,b,c,d,e){var f=c.getUtils(),g=f.inherit(d);return b(g.prototype).extend({_init:function(){if(this.renderer.node_layer.activate(),this.type="Node",this.buildShape(),this.options.show_node_circles?(this.circle.strokeWidth=this.options.node_stroke_width,this.h_ratio=1):this.h_ratio=0,this.title=a('<div class="Rk-Label">').appendTo(this.renderer.labels_$),this.options.editor_mode){var b=c.getRenderer();this.normal_buttons=[new b.NodeEditButton(this.renderer,null),new b.NodeRemoveButton(this.renderer,null),new b.NodeLinkButton(this.renderer,null),new b.NodeEnlargeButton(this.renderer,null),new b.NodeShrinkButton(this.renderer,null)],this.pending_delete_buttons=[new b.NodeRevertButton(this.renderer,null)],this.all_buttons=this.normal_buttons.concat(this.pending_delete_buttons);for(var d=0;d<this.all_buttons.length;d++)this.all_buttons[d].source_representation=this;this.active_buttons=[]}else this.active_buttons=this.all_buttons=[];this.last_circle_radius=1,this.renderer.minimap&&(this.renderer.minimap.node_layer.activate(),this.minimap_circle=new paper.Path.Circle([0,0],1),this.minimap_circle.__representation=this.renderer.minimap.miniframe.__representation,this.renderer.minimap.node_group.addChild(this.minimap_circle))},buildShape:function(){"undefined"!=typeof this.model.get("shape_changed")&&this.model.get("shape_changed")===!0&&(this.model.set("shape_changed",!1),delete this.img),this.circle&&(this.circle.remove(),delete this.circle),this.shapeBuilder=new e(this.model.get("shape")),this.circle=this.shapeBuilder.getShape(),this.circle.__representation=this,this.last_circle_radius=1},redraw:function(a){"undefined"!=typeof this.model.get("shape_changed")&&this.model.get("shape_changed")===!0&&this.buildShape();var c=new paper.Point(this.model.get("position")),d=this.options.node_size_base*Math.exp((this.model.get("size")||0)*f._NODE_SIZE_STEP);this.is_dragging&&this.paper_coords||(this.paper_coords=this.renderer.toPaperCoords(c)),this.circle_radius=d*this.renderer.scale,this.last_circle_radius!==this.circle_radius&&(this.all_buttons.forEach(function(a){a.setSectorSize()}),this.circle.scale(this.circle_radius/this.last_circle_radius),this.node_image&&this.node_image.scale(this.circle_radius/this.last_circle_radius)),this.circle.position=this.paper_coords,this.node_image&&(this.node_image.position=this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius))),this.last_circle_radius=this.circle_radius;var e=this.active_buttons,g=1;this.model.get("delete_scheduled")?(g=.5,this.active_buttons=this.pending_delete_buttons,this.circle.dashArray=[2,2]):(g=1,this.active_buttons=this.normal_buttons,this.circle.dashArray=null),this.selected&&this.renderer.isEditable()&&(e!==this.active_buttons&&e.forEach(function(a){a.hide()}),this.active_buttons.forEach(function(a){a.show()})),this.node_image&&(this.node_image.opacity=this.highlighted?.5*g:g-.01),this.circle.fillColor=this.highlighted?this.options.highlighted_node_fill_color:this.options.node_fill_color,this.circle.opacity=this.options.show_node_circles?g:.01;var h=this.model.get("title")||this.renkan.translate(this.options.label_untitled_nodes)||"";h=f.shortenText(h,this.options.node_label_max_length),"object"==typeof this.highlighted?this.title.html(this.highlighted.replace(b(h).escape(),'<span class="Rk-Highlighted">$1</span>')):this.title.text(h),this.title.css({left:this.paper_coords.x,top:this.paper_coords.y+this.circle_radius*this.h_ratio+this.options.node_label_distance,opacity:g});var i=this.model.get("color")||(this.model.get("created_by")||f._USER_PLACEHOLDER(this.renkan)).get("color");this.circle.strokeColor=i;var j=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(j)});var k=this.img;if(this.img=this.model.get("image"),this.img&&this.img!==k&&this.showImage(),this.node_image&&!this.img&&(this.node_image.remove(),delete this.node_image),this.renderer.minimap){this.minimap_circle.fillColor=i;var l=this.renderer.toMinimapCoords(c),m=this.renderer.minimap.scale*d,n=new paper.Size([m,m]);this.minimap_circle.fitBounds(l.subtract(n),n.multiply(2))}if(!a){var o=this;b.each(this.project.get("edges").filter(function(a){return a.get("to")===o.model||a.get("from")===o.model}),function(a){var b=o.renderer.getRepresentationByModel(a);b&&"undefined"!=typeof b.from_representation&&"undefined"!=typeof b.from_representation.paper_coords&&"undefined"!=typeof b.to_representation&&"undefined"!=typeof b.to_representation.paper_coords&&b.redraw()})}},showImage:function(){var b=null;if("undefined"==typeof this.renderer.image_cache[this.img]?(b=new Image,this.renderer.image_cache[this.img]=b,b.src=this.img):b=this.renderer.image_cache[this.img],b.width){this.node_image&&this.node_image.remove(),this.renderer.node_layer.activate();var c=b.width,d=b.height,e=this.model.get("clip_path"),f="undefined"!=typeof e&&e,g=null,h=null,i=null;if(f){g=new paper.Path;var j=e.match(/[a-z][^a-z]+/gi)||[],k=[0,0],l=1/0,m=1/0,n=-1/0,o=-1/0,p=function(a,b){var e=a.slice(1).map(function(a,e){var f=parseFloat(a),g=e%2;return f=g?(f-.5)*d:(f-.5)*c,b&&(f+=k[g]),g?(m=Math.min(m,f),o=Math.max(o,f)):(l=Math.min(l,f),n=Math.max(n,f)),f});return k=e.slice(-2),e};j.forEach(function(a){var b=a.match(/([a-z]|[0-9.-]+)/gi)||[""];switch(b[0]){case"M":g.moveTo(p(b));break;case"m":g.moveTo(p(b,!0));break;case"L":g.lineTo(p(b));break;case"l":g.lineTo(p(b,!0));break;case"C":g.cubicCurveTo(p(b));break;case"c":g.cubicCurveTo(p(b,!0));break;case"Q":g.quadraticCurveTo(p(b));break;case"q":g.quadraticCurveTo(p(b,!0))}}),h=Math[this.options.node_images_fill_mode?"min":"max"](n-l,o-m)/2,i=new paper.Point((n+l)/2,(o+m)/2),this.options.show_node_circles||(this.h_ratio=(o-m)/(2*h))}else h=Math[this.options.node_images_fill_mode?"min":"max"](c,d)/2,i=new paper.Point(0,0),this.options.show_node_circles||(this.h_ratio=d/(2*h));var q=new paper.Raster(b);if(q.locked=!0,f&&(q=new paper.Group(g,q),q.opacity=.99,q.clipped=!0,g.__representation=this),this.options.clip_node_images){var r=this.shapeBuilder.getImageShape(i,h);q=new paper.Group(r,q),q.opacity=.99,q.clipped=!0,r.__representation=this}this.image_delta=i.divide(h),this.node_image=q,this.node_image.__representation=s,this.node_image.scale(this.circle_radius/h),this.node_image.position=this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius)),this.redraw(),this.renderer.throttledPaperDraw()}else{var s=this;a(b).on("load",function(){s.showImage()})}},paperShift:function(a){this.options.editor_mode?this.renkan.read_only||(this.is_dragging=!0,this.paper_coords=this.paper_coords.add(a),this.redraw()):this.renderer.paperShift(a)},openEditor:function(){this.renderer.removeRepresentationsOfType("editor");var a=this.renderer.addRepresentation("NodeEditor",null);a.source_representation=this,a.draw()},select:function(){this.selected=!0,this.circle.strokeWidth=this.options.selected_node_stroke_width,this.renderer.isEditable()&&this.active_buttons.forEach(function(a){a.show()});var b=this.model.get("uri");b&&a(".Rk-Bin-Item").each(function(){var c=a(this);c.attr("data-uri")===b&&c.addClass("selected")}),this.options.editor_mode||this.openEditor(),this.renderer.minimap&&(this.minimap_circle.strokeWidth=this.options.minimap_highlight_weight,this.minimap_circle.strokeColor=this.options.minimap_highlight_color),this._super("select")},hideButtons:function(){this.all_buttons.forEach(function(a){a.hide()}),delete this.buttonTimeout},unselect:function(b){if(!b||b.source_representation!==this){this.selected=!1;
+var c=this;this.buttons_timeout=setTimeout(function(){c.hideButtons()},200),this.circle.strokeWidth=this.options.node_stroke_width,a(".Rk-Bin-Item").removeClass("selected"),this.renderer.minimap&&(this.minimap_circle.strokeColor=void 0),this._super("unselect")}},highlight:function(a){var b=a||!0;this.highlighted!==b&&(this.highlighted=b,this.redraw(),this.renderer.throttledPaperDraw())},unhighlight:function(){this.highlighted&&(this.highlighted=!1,this.redraw(),this.renderer.throttledPaperDraw())},saveCoords:function(){var a=this.renderer.toModelCoords(this.paper_coords),b={position:{x:a.x,y:a.y}};this.renderer.isEditable()&&this.model.set(b)},mousedown:function(a,b){b&&(this.renderer.unselectAll(),this.select())},mouseup:function(a,b){this.renderer.is_dragging&&this.renderer.isEditable()?this.saveCoords():(b||this.model.get("delete_scheduled")||this.openEditor(),this.model.trigger("clicked")),this.renderer.click_target=null,this.renderer.is_dragging=!1,this.is_dragging=!1},destroy:function(){this._super("destroy"),this.all_buttons.forEach(function(a){a.destroy()}),this.circle.remove(),this.title.remove(),this.renderer.minimap&&this.minimap_circle.remove(),this.node_image&&this.node_image.remove()}}),g}),define("renderer/edge",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){if(this.renderer.edge_layer.activate(),this.type="Edge",this.from_representation=this.renderer.getRepresentationByModel(this.model.get("from")),this.to_representation=this.renderer.getRepresentationByModel(this.model.get("to")),this.bundle=this.renderer.addToBundles(this),this.line=new paper.Path,this.line.add([0,0],[0,0],[0,0]),this.line.__representation=this,this.line.strokeWidth=this.options.edge_stroke_width,this.arrow=new paper.Path,this.arrow.add([0,0],[this.options.edge_arrow_length,this.options.edge_arrow_width/2],[0,this.options.edge_arrow_width]),this.arrow.__representation=this,this.text=a('<div class="Rk-Label Rk-Edge-Label">').appendTo(this.renderer.labels_$),this.arrow_angle=0,this.options.editor_mode){var b=c.getRenderer();this.normal_buttons=[new b.EdgeEditButton(this.renderer,null),new b.EdgeRemoveButton(this.renderer,null)],this.pending_delete_buttons=[new b.EdgeRevertButton(this.renderer,null)],this.all_buttons=this.normal_buttons.concat(this.pending_delete_buttons);for(var d=0;d<this.all_buttons.length;d++)this.all_buttons[d].source_representation=this;this.active_buttons=[]}else this.active_buttons=this.all_buttons=[];this.renderer.minimap&&(this.renderer.minimap.edge_layer.activate(),this.minimap_line=new paper.Path,this.minimap_line.add([0,0],[0,0]),this.minimap_line.__representation=this.renderer.minimap.miniframe.__representation,this.minimap_line.strokeWidth=1)},redraw:function(){var a=this.model.get("from"),b=this.model.get("to");if(a&&b&&(this.from_representation=this.renderer.getRepresentationByModel(a),this.to_representation=this.renderer.getRepresentationByModel(b),"undefined"!=typeof this.from_representation&&"undefined"!=typeof this.to_representation)){var c=this.from_representation.paper_coords,d=this.to_representation.paper_coords,f=d.subtract(c),g=f.length,h=f.divide(g),i=new paper.Point([-h.y,h.x]),j=this.bundle.getPosition(this),k=i.multiply(this.options.edge_gap_in_bundles*j),l=c.add(k),m=d.add(k),n=f.angle,o=i.multiply(this.options.edge_label_distance),p=f.divide(3),q=this.model.get("color")||this.model.get("color")||(this.model.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),r=1;this.model.get("delete_scheduled")||this.from_representation.model.get("delete_scheduled")||this.to_representation.model.get("delete_scheduled")?(r=.5,this.line.dashArray=[2,2]):(r=1,this.line.dashArray=null);var s=this.active_buttons;this.active_buttons=this.model.get("delete_scheduled")?this.pending_delete_buttons:this.normal_buttons,this.selected&&this.renderer.isEditable()&&s!==this.active_buttons&&(s.forEach(function(a){a.hide()}),this.active_buttons.forEach(function(a){a.show()})),this.paper_coords=l.add(m).divide(2),this.line.strokeColor=q,this.line.opacity=r,this.line.segments[0].point=c,this.line.segments[1].point=this.paper_coords,this.line.segments[1].handleIn=p.multiply(-1),this.line.segments[1].handleOut=p,this.line.segments[2].point=d,this.arrow.rotate(n-this.arrow_angle),this.arrow.fillColor=q,this.arrow.opacity=r,this.arrow.position=this.paper_coords,this.arrow_angle=n,n>90&&(n-=180,o=o.multiply(-1)),-90>n&&(n+=180,o=o.multiply(-1));var t=this.model.get("title")||this.renkan.translate(this.options.label_untitled_edges)||"";t=e.shortenText(t,this.options.node_label_max_length),this.text.text(t);var u=this.paper_coords.add(o);this.text.css({left:u.x,top:u.y,transform:"rotate("+n+"deg)","-moz-transform":"rotate("+n+"deg)","-webkit-transform":"rotate("+n+"deg)",opacity:r}),this.text_angle=n;var v=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(v)}),this.renderer.minimap&&(this.minimap_line.strokeColor=q,this.minimap_line.segments[0].point=this.renderer.toMinimapCoords(new paper.Point(this.from_representation.model.get("position"))),this.minimap_line.segments[1].point=this.renderer.toMinimapCoords(new paper.Point(this.to_representation.model.get("position"))))}},openEditor:function(){this.renderer.removeRepresentationsOfType("editor");var a=this.renderer.addRepresentation("EdgeEditor",null);a.source_representation=this,a.draw()},select:function(){this.selected=!0,this.line.strokeWidth=this.options.selected_edge_stroke_width,this.renderer.isEditable()&&this.active_buttons.forEach(function(a){a.show()}),this.options.editor_mode||this.openEditor(),this._super("select")},unselect:function(a){a&&a.source_representation===this||(this.selected=!1,this.options.editor_mode&&this.all_buttons.forEach(function(a){a.hide()}),this.line.strokeWidth=this.options.edge_stroke_width,this._super("unselect"))},mousedown:function(a,b){b&&(this.renderer.unselectAll(),this.select())},mouseup:function(a,b){!this.renkan.read_only&&this.renderer.is_dragging?(this.from_representation.saveCoords(),this.to_representation.saveCoords(),this.from_representation.is_dragging=!1,this.to_representation.is_dragging=!1):(b||this.openEditor(),this.model.trigger("clicked")),this.renderer.click_target=null,this.renderer.is_dragging=!1},paperShift:function(a){this.options.editor_mode?this.options.read_only||(this.from_representation.paperShift(a),this.to_representation.paperShift(a)):this.renderer.paperShift(a)},destroy:function(){this._super("destroy"),this.line.remove(),this.arrow.remove(),this.text.remove(),this.renderer.minimap&&this.minimap_line.remove(),this.all_buttons.forEach(function(a){a.destroy()});var a=this;this.bundle.edges=b(this.bundle.edges).reject(function(b){return a===b})}}),f}),define("renderer/tempedge",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.renderer.edge_layer.activate(),this.type="Temp-edge";var a=(this.project.get("users").get(this.renkan.current_user)||e._USER_PLACEHOLDER(this.renkan)).get("color");this.line=new paper.Path,this.line.strokeColor=a,this.line.dashArray=[4,2],this.line.strokeWidth=this.options.selected_edge_stroke_width,this.line.add([0,0],[0,0]),this.line.__representation=this,this.arrow=new paper.Path,this.arrow.fillColor=a,this.arrow.add([0,0],[this.options.edge_arrow_length,this.options.edge_arrow_width/2],[0,this.options.edge_arrow_width]),this.arrow.__representation=this,this.arrow_angle=0},redraw:function(){var a=this.from_representation.paper_coords,b=this.end_pos,c=b.subtract(a).angle,d=a.add(b).divide(2);this.line.segments[0].point=a,this.line.segments[1].point=b,this.arrow.rotate(c-this.arrow_angle),this.arrow.position=d,this.arrow_angle=c},paperShift:function(a){if(!this.renderer.isEditable())return this.renderer.removeRepresentation(_this),void paper.view.draw();this.end_pos=this.end_pos.add(a);var b=paper.project.hitTest(this.end_pos);this.renderer.findTarget(b),this.redraw()},mouseup:function(a){var b=paper.project.hitTest(a.point),c=this.from_representation.model,d=!0;if(b&&"undefined"!=typeof b.item.__representation){var f=b.item.__representation;if("Node"===f.type.substr(0,4)){var g=f.model||f.source_representation.model;if(c!==g){var h={id:e.getUID("edge"),created_by:this.renkan.current_user,from:c,to:g};this.renderer.isEditable()&&this.project.addEdge(h)}}(c===f.model||f.source_representation&&f.source_representation.model===c)&&(d=!1,this.renderer.is_dragging=!0)}d&&(this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentation(this),paper.view.draw())},destroy:function(){this.arrow.remove(),this.line.remove()}}),f}),define("renderer/baseeditor",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.renderer.buttons_layer.activate(),this.type="editor",this.editor_block=new paper.Path;var c=b(b.range(8)).map(function(){return[0,0]});this.editor_block.add.apply(this.editor_block,c),this.editor_block.strokeWidth=this.options.tooltip_border_width,this.editor_block.strokeColor=this.options.tooltip_border_color,this.editor_block.opacity=.8,this.editor_$=a("<div>").appendTo(this.renderer.editor_$).css({position:"absolute",opacity:.8}).hide()},destroy:function(){this.editor_block.remove(),this.editor_$.remove()}}),f}),define("renderer/nodeeditor",["jquery","underscore","requtils","renderer/baseeditor"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){d.prototype._init.apply(this),this.template=this.options.templates["templates/nodeeditor.html"],this.readOnlyTemplate=this.options.templates["templates/nodeeditor_readonly.html"]},draw:function(){var c=this.source_representation.model,d=c.get("created_by")||e._USER_PLACEHOLDER(this.renkan),f=this.renderer.isEditable()?this.template:this.readOnlyTemplate,g=this.options.static_url+"img/image-placeholder.png",h=c.get("size")||0;this.editor_$.html(f({node:{has_creator:!!c.get("created_by"),title:c.get("title"),uri:c.get("uri"),short_uri:e.shortenText((c.get("uri")||"").replace(/^(https?:\/\/)?(www\.)?/,"").replace(/\/$/,""),40),description:c.get("description"),image:c.get("image")||"",image_placeholder:g,color:c.get("color")||d.get("color"),clip_path:c.get("clip_path")||!1,created_by_color:d.get("color"),created_by_title:d.get("title"),size:(h>0?"+":"")+h,shape:c.get("shape")||"circle"},renkan:this.renkan,options:this.options,shortenText:e.shortenText})),this.redraw();var i=this,j=function(){i.renderer.removeRepresentation(i),paper.view.draw()};if(this.editor_$.find(".Rk-CloseX").click(j),this.editor_$.find(".Rk-Edit-Goto").click(function(){return c.get("uri")?void 0:!1}),this.renderer.isEditable()){var k=b(function(){b(function(){if(i.renderer.isEditable()){var a={title:i.editor_$.find(".Rk-Edit-Title").val()};i.options.show_node_editor_uri&&(a.uri=i.editor_$.find(".Rk-Edit-URI").val(),i.editor_$.find(".Rk-Edit-Goto").attr("href",a.uri||"#")),i.options.show_node_editor_image&&(a.image=i.editor_$.find(".Rk-Edit-Image").val(),i.editor_$.find(".Rk-Edit-ImgPreview").attr("src",a.image||g)),i.options.show_node_editor_description&&(a.description=i.editor_$.find(".Rk-Edit-Description").val()),i.options.change_shapes&&c.get("shape")!==i.editor_$.find(".Rk-Edit-Shape").val()&&(a.shape=i.editor_$.find(".Rk-Edit-Shape").val(),a.shape_changed=!0),c.set(a),i.redraw(),a.shape_changed===!0&&c.set(a)}else j()}).defer()}).throttle(500);this.editor_$.on("keyup",function(a){27===a.keyCode&&j()}),this.editor_$.find("input, textarea, select").on("change keyup paste",k),i.options.allow_image_upload&&this.editor_$.find(".Rk-Edit-Image-File").change(function(){if(this.files.length){var a=this.files[0],b=new FileReader;if("image"!==a.type.substr(0,5))return void alert(i.renkan.translate("This file is not an image"));if(a.size>1024*i.options.uploaded_image_max_kb)return void alert(i.renkan.translate("Image size must be under ")+i.options.uploaded_image_max_kb+i.renkan.translate("KB"));b.onload=function(a){i.editor_$.find(".Rk-Edit-Image").val(a.target.result),k()},b.readAsDataURL(a)}}),this.editor_$.find(".Rk-Edit-Title")[0].focus();var l=i.editor_$.find(".Rk-Edit-ColorPicker");this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(function(a){a.preventDefault(),l.show()},function(a){a.preventDefault(),l.hide()}),l.find("li").hover(function(b){b.preventDefault(),i.editor_$.find(".Rk-Edit-Color").css("background",a(this).attr("data-color"))},function(a){a.preventDefault(),i.editor_$.find(".Rk-Edit-Color").css("background",c.get("color")||(c.get("created_by")||e._USER_PLACEHOLDER(i.renkan)).get("color"))}).click(function(b){b.preventDefault(),i.renderer.isEditable()?(c.set("color",a(this).attr("data-color")),l.hide(),paper.view.draw()):j()});var m=function(a){if(i.renderer.isEditable()){var b=a+(c.get("size")||0);i.editor_$.find(".Rk-Edit-Size-Value").text((b>0?"+":"")+b),c.set("size",b),paper.view.draw()}else j()};this.editor_$.find(".Rk-Edit-Size-Down").click(function(){return m(-1),!1}),this.editor_$.find(".Rk-Edit-Size-Up").click(function(){return m(1),!1}),this.editor_$.find(".Rk-Edit-Image-Del").click(function(){return i.editor_$.find(".Rk-Edit-Image").val(""),k(),!1})}else if("object"==typeof this.source_representation.highlighted){var n=this.source_representation.highlighted.replace(b(c.get("title")).escape(),'<span class="Rk-Highlighted">$1</span>');this.editor_$.find(".Rk-Display-Title"+(c.get("uri")?" a":"")).html(n),this.options.show_node_tooltip_description&&this.editor_$.find(".Rk-Display-Description").html(this.source_representation.highlighted.replace(b(c.get("description")).escape(),'<span class="Rk-Highlighted">$1</span>'))}this.editor_$.find("img").load(function(){i.redraw()})},redraw:function(){var a=this.source_representation.paper_coords;e.drawEditBox(this.options,a,this.editor_block,.75*this.source_representation.circle_radius,this.editor_$),this.editor_$.show(),paper.view.draw()}}),f}),define("renderer/edgeeditor",["jquery","underscore","requtils","renderer/baseeditor"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){d.prototype._init.apply(this),this.template=this.options.templates["templates/edgeeditor.html"],this.readOnlyTemplate=this.options.templates["templates/edgeeditor_readonly.html"]},draw:function(){var c=this.source_representation.model,d=c.get("from"),f=c.get("to"),g=c.get("created_by")||e._USER_PLACEHOLDER(this.renkan),h=this.renderer.isEditable()?this.template:this.readOnlyTemplate;this.editor_$.html(h({edge:{has_creator:!!c.get("created_by"),title:c.get("title"),uri:c.get("uri"),short_uri:e.shortenText((c.get("uri")||"").replace(/^(https?:\/\/)?(www\.)?/,"").replace(/\/$/,""),40),description:c.get("description"),color:c.get("color")||g.get("color"),from_title:d.get("title"),to_title:f.get("title"),from_color:d.get("color")||(d.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),to_color:f.get("color")||(f.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),created_by_color:g.get("color"),created_by_title:g.get("title")},renkan:this.renkan,shortenText:e.shortenText,options:this.options})),this.redraw();var i=this,j=function(){i.renderer.removeRepresentation(i),paper.view.draw()};if(this.editor_$.find(".Rk-CloseX").click(j),this.editor_$.find(".Rk-Edit-Goto").click(function(){return c.get("uri")?void 0:!1}),this.renderer.isEditable()){var k=b(function(){b(function(){if(i.renderer.isEditable()){var a={title:i.editor_$.find(".Rk-Edit-Title").val()};i.options.show_edge_editor_uri&&(a.uri=i.editor_$.find(".Rk-Edit-URI").val()),i.editor_$.find(".Rk-Edit-Goto").attr("href",a.uri||"#"),c.set(a),paper.view.draw()}else j()}).defer()}).throttle(500);this.editor_$.on("keyup",function(a){27===a.keyCode&&j()}),this.editor_$.find("input").on("keyup change paste",k),this.editor_$.find(".Rk-Edit-Vocabulary").change(function(){var b=a(this),c=b.val();c&&(i.editor_$.find(".Rk-Edit-Title").val(b.find(":selected").text()),i.editor_$.find(".Rk-Edit-URI").val(c),k())}),this.editor_$.find(".Rk-Edit-Direction").click(function(){i.renderer.isEditable()?(c.set({from:c.get("to"),to:c.get("from")}),i.draw()):j()});var l=i.editor_$.find(".Rk-Edit-ColorPicker");this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(function(a){a.preventDefault(),l.show()},function(a){a.preventDefault(),l.hide()}),l.find("li").hover(function(b){b.preventDefault(),i.editor_$.find(".Rk-Edit-Color").css("background",a(this).attr("data-color"))},function(a){a.preventDefault(),i.editor_$.find(".Rk-Edit-Color").css("background",c.get("color")||(c.get("created_by")||e._USER_PLACEHOLDER(i.renkan)).get("color"))}).click(function(b){b.preventDefault(),i.renderer.isEditable()?(c.set("color",a(this).attr("data-color")),l.hide(),paper.view.draw()):j()})}},redraw:function(){var a=this.source_representation.paper_coords;e.drawEditBox(this.options,a,this.editor_block,5,this.editor_$),this.editor_$.show(),paper.view.draw()}}),f}),define("renderer/nodebutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({setSectorSize:function(){var a=this.source_representation.circle_radius;a!==this.lastSectorInner&&(this.sector&&this.sector.destroy(),this.sector=this.renderer.drawSector(this,1+a,e._NODE_BUTTON_WIDTH+a,this.startAngle,this.endAngle,1,this.imageName,this.renkan.translate(this.text)),this.lastSectorInner=a)},unselect:function(){d.prototype.unselect.apply(this,Array.prototype.slice.call(arguments,1)),this.source_representation&&this.source_representation.buttons_timeout&&(clearTimeout(this.source_representation.buttons_timeout),this.source_representation.hideButtons())},select:function(){this.source_representation&&this.source_representation.buttons_timeout&&clearTimeout(this.source_representation.buttons_timeout),this.sector.select()}}),f}),define("renderer/nodeeditbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-edit-button",this.lastSectorInner=0,this.startAngle=-135,this.endAngle=-45,this.imageName="edit",this.text="Edit"},mouseup:function(){this.renderer.is_dragging||this.source_representation.openEditor()}}),f}),define("renderer/noderemovebutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-remove-button",this.lastSectorInner=0,this.startAngle=0,this.endAngle=90,this.imageName="remove",this.text="Remove"},mouseup:function(){if(this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentationsOfType("editor"),this.renderer.isEditable())if(this.options.element_delete_delay){var a=e.getUID("delete");this.renderer.delete_list.push({id:a,time:(new Date).valueOf()+this.options.element_delete_delay}),this.source_representation.model.set("delete_scheduled",a)}else confirm(this.renkan.translate("Do you really wish to remove node ")+'"'+this.source_representation.model.get("title")+'"?')&&this.project.removeNode(this.source_representation.model)}}),f}),define("renderer/noderevertbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-revert-button",this.lastSectorInner=0,this.startAngle=-135,this.endAngle=135,this.imageName="revert",this.text="Cancel deletion"},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.isEditable()&&this.source_representation.model.unset("delete_scheduled")}}),f}),define("renderer/nodelinkbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-link-button",this.lastSectorInner=0,this.startAngle=90,this.endAngle=180,this.imageName="link",this.text="Link to another node"},mousedown:function(a){if(this.renderer.isEditable()){var b=this.renderer.canvas_$.offset(),c=new paper.Point([a.pageX-b.left,a.pageY-b.top]);this.renderer.click_target=null,this.renderer.removeRepresentationsOfType("editor"),this.renderer.addTempEdge(this.source_representation,c)}}}),f}),define("renderer/nodeenlargebutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-enlarge-button",this.lastSectorInner=0,this.startAngle=-45,this.endAngle=0,this.imageName="enlarge",this.text="Enlarge"},mouseup:function(){var a=1+(this.source_representation.model.get("size")||0);this.source_representation.model.set("size",a),this.source_representation.select(),this.select(),paper.view.draw()}}),f}),define("renderer/nodeshrinkbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-shrink-button",this.lastSectorInner=0,this.startAngle=-180,this.endAngle=-135,this.imageName="shrink",this.text="Shrink"},mouseup:function(){var a=-1+(this.source_representation.model.get("size")||0);this.source_representation.model.set("size",a),this.source_representation.select(),this.select(),paper.view.draw()}}),f}),define("renderer/edgeeditbutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Edge-edit-button",this.sector=this.renderer.drawSector(this,e._EDGE_BUTTON_INNER,e._EDGE_BUTTON_OUTER,-270,-90,1,"edit",this.renkan.translate("Edit"))},mouseup:function(){this.renderer.is_dragging||this.source_representation.openEditor()}}),f}),define("renderer/edgeremovebutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Edge-remove-button",this.sector=this.renderer.drawSector(this,e._EDGE_BUTTON_INNER,e._EDGE_BUTTON_OUTER,-90,90,1,"remove",this.renkan.translate("Remove"))},mouseup:function(){if(this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentationsOfType("editor"),this.renderer.isEditable())if(this.options.element_delete_delay){var a=e.getUID("delete");this.renderer.delete_list.push({id:a,time:(new Date).valueOf()+this.options.element_delete_delay}),this.source_representation.model.set("delete_scheduled",a)}else confirm(this.renkan.translate("Do you really wish to remove edge ")+'"'+this.source_representation.model.get("title")+'"?')&&this.project.removeEdge(this.source_representation.model)}}),f}),define("renderer/edgerevertbutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Edge-revert-button",this.sector=this.renderer.drawSector(this,e._EDGE_BUTTON_INNER,e._EDGE_BUTTON_OUTER,-135,135,1,"revert",this.renkan.translate("Cancel deletion"))},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.isEditable()&&this.source_representation.model.unset("delete_scheduled")}}),f}),define("renderer/miniframe",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({paperShift:function(a){this.renderer.offset=this.renderer.offset.subtract(a.divide(this.renderer.minimap.scale).multiply(this.renderer.scale)),this.renderer.redraw()},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1}}),f}),define("renderer/scene",["jquery","underscore","filesaver","requtils","renderer/miniframe"],function(a,b,c,d,e){var f=d.getUtils(),g=function(c){this.renkan=c,this.$=a(".Rk-Render"),this.representations=[],this.$.html(c.options.templates["templates/scene.html"](c)),this.onStatusChange(),this.canvas_$=this.$.find(".Rk-Canvas"),this.labels_$=this.$.find(".Rk-Labels"),this.editor_$=this.$.find(".Rk-Editor"),this.notif_$=this.$.find(".Rk-Notifications"),paper.setup(this.canvas_$[0]),this.scale=1,this.initialScale=1,this.offset=paper.view.center,this.totalScroll=0,this.mouse_down=!1,this.click_target=null,this.selected_target=null,this.edge_layer=new paper.Layer,this.node_layer=new paper.Layer,this.buttons_layer=new paper.Layer,this.delete_list=[],this.redrawActive=!0,c.options.show_minimap&&(this.minimap={background_layer:new paper.Layer,edge_layer:new paper.Layer,node_layer:new paper.Layer,node_group:new paper.Group,size:new paper.Size(c.options.minimap_width,c.options.minimap_height)},this.minimap.background_layer.activate(),this.minimap.topleft=paper.view.bounds.bottomRight.subtract(this.minimap.size),this.minimap.rectangle=new paper.Path.Rectangle(this.minimap.topleft.subtract([2,2]),this.minimap.size.add([4,4])),this.minimap.rectangle.fillColor=c.options.minimap_background_color,this.minimap.rectangle.strokeColor=c.options.minimap_border_color,this.minimap.rectangle.strokeWidth=4,this.minimap.offset=new paper.Point(this.minimap.size.divide(2)),this.minimap.scale=.1,this.minimap.node_layer.activate(),this.minimap.cliprectangle=new paper.Path.Rectangle(this.minimap.topleft,this.minimap.size),this.minimap.node_group.addChild(this.minimap.cliprectangle),this.minimap.node_group.clipped=!0,this.minimap.miniframe=new paper.Path.Rectangle(this.minimap.topleft,this.minimap.size),this.minimap.node_group.addChild(this.minimap.miniframe),this.minimap.miniframe.fillColor="#c0c0ff",this.minimap.miniframe.opacity=.3,this.minimap.miniframe.strokeColor="#000080",this.minimap.miniframe.strokeWidth=2,this.minimap.miniframe.__representation=new e(this,null)),this.throttledPaperDraw=b(function(){paper.view.draw()}).throttle(100),this.bundles=[],this.click_mode=!1;var d=this,g=!0,h=1,i=!1,j=0,k=0;this.image_cache={},this.icon_cache={},["edit","remove","link","enlarge","shrink","revert"].forEach(function(a){var b=new Image;b.src=c.options.static_url+"img/"+a+".png",d.icon_cache[a]=b});var l=b.throttle(function(a,b){d.onMouseMove(a,b)},f._MOUSEMOVE_RATE);this.canvas_$.on({mousedown:function(a){a.preventDefault(),d.onMouseDown(a,!1)},mousemove:function(a){a.preventDefault(),l(a,!1)},mouseup:function(a){a.preventDefault(),d.onMouseUp(a,!1)},mousewheel:function(a,b){c.options.zoom_on_scroll&&(a.preventDefault(),g&&d.onScroll(a,b))},touchstart:function(a){a.preventDefault();var b=a.originalEvent.touches[0];c.options.allow_double_click&&new Date-_lastTap<f._DOUBLETAP_DELAY&&Math.pow(j-b.pageX,2)+Math.pow(k-b.pageY,2)<f._DOUBLETAP_DISTANCE?(_lastTap=0,d.onDoubleClick(b)):(_lastTap=new Date,j=b.pageX,k=b.pageY,h=d.scale,i=!1,d.onMouseDown(b,!0))},touchmove:function(a){if(a.preventDefault(),_lastTap=0,1===a.originalEvent.touches.length)d.onMouseMove(a.originalEvent.touches[0],!0);else{if(i||(d.onMouseUp(a.originalEvent.touches[0],!0),d.click_target=null,d.is_dragging=!1,i=!0),"undefined"===a.originalEvent.scale)return;var b=a.originalEvent.scale*h,c=b/d.scale,e=new paper.Point([d.canvas_$.width(),d.canvas_$.height()]).multiply(.5*(1-c)).add(d.offset.multiply(c));d.setScale(b,e)}},touchend:function(a){a.preventDefault(),d.onMouseUp(a.originalEvent.changedTouches[0],!0)},dblclick:function(a){a.preventDefault(),c.options.allow_double_click&&d.onDoubleClick(a)},mouseleave:function(a){a.preventDefault(),d.onMouseUp(a,!1),d.click_target=null,d.is_dragging=!1},dragover:function(a){a.preventDefault()},dragenter:function(a){a.preventDefault(),g=!1},dragleave:function(a){a.preventDefault(),g=!0},drop:function(a){a.preventDefault(),g=!0;var c={};b(a.originalEvent.dataTransfer.types).each(function(b){try{c[b]=a.originalEvent.dataTransfer.getData(b)}catch(d){}});var e=a.originalEvent.dataTransfer.getData("Text");if("string"==typeof e)switch(e[0]){case"{":case"[":try{var f=JSON.parse(e);b(c).extend(f)}catch(h){c["text/plain"]||(c["text/plain"]=e)}break;case"<":c["text/html"]||(c["text/html"]=e);break;default:c["text/plain"]||(c["text/plain"]=e)}var i=a.originalEvent.dataTransfer.getData("URL");i&&!c["text/uri-list"]&&(c["text/uri-list"]=i),d.dropData(c,a.originalEvent)}});var m=function(a,b){d.$.find(a).click(function(a){return d[b](a),!1})};m(".Rk-ZoomOut","zoomOut"),m(".Rk-ZoomIn","zoomIn"),m(".Rk-ZoomFit","autoScale"),this.$.find(".Rk-ZoomSave").click(function(){d.renkan.project.addView({zoom_level:d.scale,offset:d.offset})}),this.$.find(".Rk-ZoomSetSaved").click(function(){var a=d.renkan.project.get("views").last();a&&d.setScale(a.get("zoom_level"),new paper.Point(a.get("offset")))}),this.renkan.project.get("views").length>0&&this.renkan.options.save_view&&this.$.find(".Rk-ZoomSetSaved").show(),this.$.find(".Rk-CurrentUser").mouseenter(function(){d.$.find(".Rk-UserList").slideDown()}),this.$.find(".Rk-Users").mouseleave(function(){d.$.find(".Rk-UserList").slideUp()}),m(".Rk-FullScreen-Button","fullScreen"),m(".Rk-AddNode-Button","addNodeBtn"),m(".Rk-AddEdge-Button","addEdgeBtn"),m(".Rk-Save-Button","save"),m(".Rk-Open-Button","open"),m(".Rk-Export-Button","exportProject"),this.$.find(".Rk-Bookmarklet-Button").attr("href","javascript:"+f._BOOKMARKLET_CODE(c)).click(function(){return d.notif_$.text(c.translate("Drag this button to your bookmark bar. When on a third-party website, click it to enable drag-and-drop from the website to Renkan.")).fadeIn().delay(5e3).fadeOut(),!1}),this.$.find(".Rk-TopBar-Button").mouseover(function(){a(this).find(".Rk-TopBar-Tooltip").show()}).mouseout(function(){a(this).find(".Rk-TopBar-Tooltip").hide()}),m(".Rk-Fold-Bins","foldBins"),paper.view.onResize=function(a){var b,c=a.width,e=a.height;d.minimap&&(d.minimap.topleft=paper.view.bounds.bottomRight.subtract(d.minimap.size),d.minimap.rectangle.fitBounds(d.minimap.topleft.subtract([2,2]),d.minimap.size.add([4,4])),d.minimap.cliprectangle.fitBounds(d.minimap.topleft,d.minimap.size));var f=e/(e-a.delta.height),g=c/(c-a.delta.width);b=c>e?f:g,d.resizeZoom(g,f,b),d.redraw()};var n=b.throttle(function(){d.redraw()},50);this.addRepresentations("Node",this.renkan.project.get("nodes")),this.addRepresentations("Edge",this.renkan.project.get("edges")),this.renkan.project.on("change:title",function(){d.$.find(".Rk-PadTitle").val(c.project.get("title"))}),this.$.find(".Rk-PadTitle").on("keyup input paste",function(){c.project.set({title:a(this).val()})});var o=b.throttle(function(){d.redrawUsers()},100);if(o(),this.renkan.project.on("change:save_status",function(){switch(d.renkan.project.get("save_status")){case 0:d.$.find(".Rk-Save-Button").removeClass("to-save"),d.$.find(".Rk-Save-Button").removeClass("saving"),d.$.find(".Rk-Save-Button").addClass("saved");break;case 1:d.$.find(".Rk-Save-Button").removeClass("saved"),d.$.find(".Rk-Save-Button").removeClass("saving"),d.$.find(".Rk-Save-Button").addClass("to-save");break;case 2:d.$.find(".Rk-Save-Button").removeClass("saved"),d.$.find(".Rk-Save-Button").removeClass("to-save"),d.$.find(".Rk-Save-Button").addClass("saving")}}),this.renkan.project.on("change:loading_status",function(){if(d.renkan.project.get("loading_status")){d.$.find(".loader").addClass("run"),setTimeout(function(){d.$.find(".loader").hide(250)},3e3)}}),this.renkan.project.on("add:users remove:users",o),this.renkan.project.on("add:views remove:views",function(){d.renkan.project.get("views").length>0?d.$.find(".Rk-ZoomSetSaved").show():d.$.find(".Rk-ZoomSetSaved").hide()}),this.renkan.project.on("add:nodes",function(a){d.addRepresentation("Node",a),d.renkan.project.get("loading_status")||n()}),this.renkan.project.on("add:edges",function(a){d.addRepresentation("Edge",a),d.renkan.project.get("loading_status")||n()}),this.renkan.project.on("change:title",function(a,b){var c=d.$.find(".Rk-PadTitle");
+c.is("input")?c.val()!==b&&c.val(b):c.text(b)}),c.options.size_bug_fix){var p="number"==typeof c.options.size_bug_fix?c.options.size_bug_fix:500;window.setTimeout(function(){d.fixSize()},p)}if(c.options.force_resize&&a(window).resize(function(){d.autoScale()}),c.options.show_user_list&&c.options.user_color_editable){var q=this.$.find(".Rk-Users .Rk-Edit-ColorPicker-Wrapper"),r=this.$.find(".Rk-Users .Rk-Edit-ColorPicker");q.hover(function(a){d.isEditable()&&(a.preventDefault(),r.show())},function(a){a.preventDefault(),r.hide()}),r.find("li").mouseenter(function(b){d.isEditable()&&(b.preventDefault(),d.$.find(".Rk-CurrentUser-Color").css("background",a(this).attr("data-color")))})}if(c.options.show_search_field){var s="";this.$.find(".Rk-GraphSearch-Field").on("keyup change paste input",function(){var b=a(this),e=b.val();if(e!==s)if(s=e,e.length<2)c.project.get("nodes").each(function(a){d.getRepresentationByModel(a).unhighlight()});else{var g=f.regexpFromTextOrArray(e);c.project.get("nodes").each(function(a){g.test(a.get("title"))||g.test(a.get("description"))?d.getRepresentationByModel(a).highlight(g):d.getRepresentationByModel(a).unhighlight()})}})}this.redraw(),window.setInterval(function(){var a=(new Date).valueOf();d.delete_list.forEach(function(b){if(a>=b.time){var d=c.project.get("nodes").findWhere({delete_scheduled:b.id});d&&project.removeNode(d),d=c.project.get("edges").findWhere({delete_scheduled:b.id}),d&&project.removeEdge(d)}}),d.delete_list=d.delete_list.filter(function(a){return c.project.get("nodes").findWhere({delete_scheduled:a.id})||c.project.get("edges").findWhere({delete_scheduled:a.id})})},500),this.minimap&&window.setInterval(function(){d.rescaleMinimap()},2e3)};return b(g.prototype).extend({fixSize:function(){if(this.renkan.options.default_view&&this.renkan.project.get("views").length>0){var a=this.renkan.project.get("views").last();this.setScale(a.get("zoom_level"),new paper.Point(a.get("offset")))}else this.autoScale()},drawSector:function(b,c,d,e,f,g,h,i){var j=this.renkan.options,k=e*Math.PI/180,l=f*Math.PI/180,m=this.icon_cache[h],n=-Math.sin(k),o=Math.cos(k),p=Math.cos(k)*c+g*n,q=Math.sin(k)*c+g*o,r=Math.cos(k)*d+g*n,s=Math.sin(k)*d+g*o,t=-Math.sin(l),u=Math.cos(l),v=Math.cos(l)*c-g*t,w=Math.sin(l)*c-g*u,x=Math.cos(l)*d-g*t,y=Math.sin(l)*d-g*u,z=(c+d)/2,A=(k+l)/2,B=Math.cos(A)*z,C=Math.sin(A)*z,D=Math.cos(A)*c,E=Math.cos(A)*d,F=Math.sin(A)*c,G=Math.sin(A)*d,H=Math.cos(A)*(d+3),I=Math.sin(A)*(d+j.buttons_label_font_size)+j.buttons_label_font_size/2;this.buttons_layer.activate();var J=new paper.Path;J.add([p,q]),J.arcTo([D,F],[v,w]),J.lineTo([x,y]),J.arcTo([E,G],[r,s]),J.fillColor=j.buttons_background,J.opacity=.5,J.closed=!0,J.__representation=b;var K=new paper.PointText(H,I);K.characterStyle={fontSize:j.buttons_label_font_size,fillColor:j.buttons_label_color},K.paragraphStyle.justification=H>2?"left":-2>H?"right":"center",K.visible=!1;var L=!1,M=new paper.Point(-200,-200),N=new paper.Group([J,K]),O=N.position,P=new paper.Point([B,C]),Q=new paper.Point(0,0);K.content=i,N.pivot=N.bounds.center,N.visible=!1,N.position=M;var R={show:function(){L=!0,N.position=Q.add(O),N.visible=!0},moveTo:function(a){Q=a,L&&(N.position=a.add(O))},hide:function(){L=!1,N.visible=!1,N.position=M},select:function(){J.opacity=.8,K.visible=!0},unselect:function(){J.opacity=.5,K.visible=!1},destroy:function(){N.remove()}},S=function(){var a=new paper.Raster(m);a.position=P.add(N.position).subtract(O),a.locked=!0,N.addChild(a)};return m.width?S():a(m).on("load",S),R},addToBundles:function(a){var c=b(this.bundles).find(function(b){return b.from===a.from_representation&&b.to===a.to_representation||b.from===a.to_representation&&b.to===a.from_representation});return"undefined"!=typeof c?c.edges.push(a):(c={from:a.from_representation,to:a.to_representation,edges:[a],getPosition:function(a){var c=a.from_representation===this.from?1:-1;return c*(b(this.edges).indexOf(a)-(this.edges.length-1)/2)}},this.bundles.push(c)),c},isEditable:function(){return this.renkan.options.editor_mode&&!this.renkan.read_only},onStatusChange:function(){var a=this.$.find(".Rk-Save-Button"),b=a.find(".Rk-TopBar-Tooltip-Contents");this.renkan.read_only?(a.removeClass("disabled Rk-Save-Online").addClass("Rk-Save-ReadOnly"),b.text(this.renkan.translate("Connection lost"))):this.renkan.options.manual_save?(a.removeClass("Rk-Save-ReadOnly Rk-Save-Online"),b.text(this.renkan.translate("Save Project"))):(a.removeClass("disabled Rk-Save-ReadOnly").addClass("Rk-Save-Online"),b.text(this.renkan.translate("Auto-save enabled"))),this.redrawUsers()},setScale:function(a,b){a/this.initialScale>f._MIN_SCALE&&a/this.initialScale<f._MAX_SCALE&&(this.scale=a,b&&(this.offset=b),this.redraw())},autoScale:function(a){var b=this.renkan.project.get("nodes");if(b.length>1){var c=b.map(function(a){return a.get("position").x}),d=b.map(function(a){return a.get("position").y}),e=Math.min.apply(Math,c),f=Math.min.apply(Math,d),g=Math.max.apply(Math,c),h=Math.max.apply(Math,d),i=Math.min((paper.view.size.width-2*this.renkan.options.autoscale_padding)/(g-e),(paper.view.size.height-2*this.renkan.options.autoscale_padding)/(h-f));this.initialScale=i,"undefined"!=typeof a&&parseFloat(a.zoom_level)>0&&parseFloat(a.offset.x)>0&&parseFloat(a.offset.y)>0?this.setScale(parseFloat(a.zoom_level),new paper.Point(parseFloat(a.offset.x),parseFloat(a.offset.y))):this.setScale(i,paper.view.center.subtract(new paper.Point([(g+e)/2,(h+f)/2]).multiply(i)))}1===b.length&&this.setScale(1,paper.view.center.subtract(new paper.Point([b.at(0).get("position").x,b.at(0).get("position").y])))},redrawMiniframe:function(){var a=this.toMinimapCoords(this.toModelCoords(new paper.Point([0,0]))),b=this.toMinimapCoords(this.toModelCoords(paper.view.bounds.bottomRight));this.minimap.miniframe.fitBounds(a,b)},rescaleMinimap:function(){var a=this.renkan.project.get("nodes");if(a.length>1){var b=a.map(function(a){return a.get("position").x}),c=a.map(function(a){return a.get("position").y}),d=Math.min.apply(Math,b),e=Math.min.apply(Math,c),f=Math.max.apply(Math,b),g=Math.max.apply(Math,c),h=Math.min(.8*this.scale*this.renkan.options.minimap_width/paper.view.bounds.width,.8*this.scale*this.renkan.options.minimap_height/paper.view.bounds.height,(this.renkan.options.minimap_width-2*this.renkan.options.minimap_padding)/(f-d),(this.renkan.options.minimap_height-2*this.renkan.options.minimap_padding)/(g-e));this.minimap.offset=this.minimap.size.divide(2).subtract(new paper.Point([(f+d)/2,(g+e)/2]).multiply(h)),this.minimap.scale=h}1===a.length&&(this.minimap.scale=.1,this.minimap.offset=this.minimap.size.divide(2).subtract(new paper.Point([a.at(0).get("position").x,a.at(0).get("position").y]).multiply(this.minimap.scale))),this.redraw()},toPaperCoords:function(a){return a.multiply(this.scale).add(this.offset)},toMinimapCoords:function(a){return a.multiply(this.minimap.scale).add(this.minimap.offset).add(this.minimap.topleft)},toModelCoords:function(a){return a.subtract(this.offset).divide(this.scale)},addRepresentation:function(a,b){var c=d.getRenderer()[a],e=new c(this,b);return this.representations.push(e),e},addRepresentations:function(a,b){var c=this;b.forEach(function(b){c.addRepresentation(a,b)})},userTemplate:b.template('<li class="Rk-User"><span class="Rk-UserColor" style="background:<%=background%>;"></span><%=name%></li>'),redrawUsers:function(){if(this.renkan.options.show_user_list){var b=[].concat((this.renkan.project.current_user_list||{}).models||[],(this.renkan.project.get("users")||{}).models||[]),c="",d=this.$.find(".Rk-Users"),e=d.find(".Rk-CurrentUser-Name"),f=d.find(".Rk-Edit-ColorPicker li"),g=d.find(".Rk-CurrentUser-Color"),h=this;e.off("click").text(this.renkan.translate("<unknown user>")),f.off("mouseleave click"),b.forEach(function(b){b.get("_id")===h.renkan.current_user?(e.text(b.get("title")),g.css("background",b.get("color")),h.isEditable()&&(h.renkan.options.user_name_editable&&e.click(function(){var c=a(this),d=a("<input>").val(b.get("title")).blur(function(){b.set("title",a(this).val()),h.redrawUsers(),h.redraw()});c.empty().html(d),d.select()}),h.renkan.options.user_color_editable&&f.click(function(c){c.preventDefault(),h.isEditable()&&b.set("color",a(this).attr("data-color")),a(this).parent().hide()}).mouseleave(function(){g.css("background",b.get("color"))}))):c+=h.userTemplate({name:b.get("title"),background:b.get("color")})}),d.find(".Rk-UserList").html(c)}},removeRepresentation:function(a){a.destroy(),this.representations=b(this.representations).reject(function(b){return b===a})},getRepresentationByModel:function(a){return a?b(this.representations).find(function(b){return b.model===a}):void 0},removeRepresentationsOfType:function(a){var c=b(this.representations).filter(function(b){return b.type===a}),d=this;b(c).each(function(a){d.removeRepresentation(a)})},highlightModel:function(a){var b=this.getRepresentationByModel(a);b&&b.highlight()},unhighlightAll:function(){b(this.representations).each(function(a){a.unhighlight()})},unselectAll:function(){b(this.representations).each(function(a){a.unselect()})},redraw:function(){this.redrawActive&&(b(this.representations).each(function(a){a.redraw(!0)}),this.minimap&&this.redrawMiniframe(),paper.view.draw())},addTempEdge:function(a,b){var c=this.addRepresentation("TempEdge",null);c.end_pos=b,c.from_representation=a,c.redraw(),this.click_target=c},findTarget:function(a){if(a&&"undefined"!=typeof a.item.__representation){var b=a.item.__representation;this.selected_target!==a.item.__representation&&(this.selected_target&&this.selected_target.unselect(b),b.select(this.selected_target),this.selected_target=b)}else this.selected_target&&this.selected_target.unselect(),this.selected_target=null},paperShift:function(a){this.offset=this.offset.add(a),this.redraw()},onMouseMove:function(a){var b=this.canvas_$.offset(),c=new paper.Point([a.pageX-b.left,a.pageY-b.top]),d=c.subtract(this.last_point);this.last_point=c,!this.is_dragging&&this.mouse_down&&d.length>f._MIN_DRAG_DISTANCE&&(this.is_dragging=!0);var e=paper.project.hitTest(c);this.is_dragging?this.click_target&&"function"==typeof this.click_target.paperShift?this.click_target.paperShift(d):this.paperShift(d):this.findTarget(e),paper.view.draw()},onMouseDown:function(b,c){var d=this.canvas_$.offset(),e=new paper.Point([b.pageX-d.left,b.pageY-d.top]);if(this.last_point=e,this.mouse_down=!0,!this.click_target||"Temp-edge"!==this.click_target.type){this.removeRepresentationsOfType("editor"),this.is_dragging=!1;var g=paper.project.hitTest(e);if(g&&"undefined"!=typeof g.item.__representation)this.click_target=g.item.__representation,this.click_target.mousedown(b,c);else if(this.click_target=null,this.isEditable()&&this.click_mode===f._CLICKMODE_ADDNODE){var h=this.toModelCoords(e),i={id:f.getUID("node"),created_by:this.renkan.current_user,position:{x:h.x,y:h.y}};_node=this.renkan.project.addNode(i),this.getRepresentationByModel(_node).openEditor()}}this.click_mode&&(this.isEditable()&&this.click_mode===f._CLICKMODE_STARTEDGE&&this.click_target&&"Node"===this.click_target.type?(this.removeRepresentationsOfType("editor"),this.addTempEdge(this.click_target,e),this.click_mode=f._CLICKMODE_ENDEDGE,this.notif_$.fadeOut(function(){a(this).html(this.renkan.translate("Click on a second node to complete the edge")).fadeIn()})):(this.notif_$.hide(),this.click_mode=!1)),paper.view.draw()},onMouseUp:function(a,b){if(this.mouse_down=!1,this.click_target){var c=this.canvas_$.offset();this.click_target.mouseup({point:new paper.Point([a.pageX-c.left,a.pageY-c.top])},b)}else this.click_target=null,this.is_dragging=!1,b&&this.unselectAll();paper.view.draw()},onScroll:function(a,b){if(this.totalScroll+=b,Math.abs(this.totalScroll)>=1){var c=this.canvas_$.offset(),d=new paper.Point([a.pageX-c.left,a.pageY-c.top]).subtract(this.offset).multiply(Math.SQRT2-1);this.totalScroll>0?this.setScale(this.scale*Math.SQRT2,this.offset.subtract(d)):this.setScale(this.scale*Math.SQRT1_2,this.offset.add(d.divide(Math.SQRT2))),this.totalScroll=0}},onDoubleClick:function(a){if(this.isEditable()){var b=this.canvas_$.offset(),c=new paper.Point([a.pageX-b.left,a.pageY-b.top]),d=paper.project.hitTest(c);if(this.isEditable()&&(!d||"undefined"==typeof d.item.__representation)){var e=this.toModelCoords(c),g={id:f.getUID("node"),created_by:this.renkan.current_user,position:{x:e.x,y:e.y}},h=this.renkan.project.addNode(g);this.getRepresentationByModel(h).openEditor()}paper.view.draw()}},defaultDropHandler:function(b){var c={},d="";switch(b["text/x-iri-specific-site"]){case"twitter":d=a("<div>").html(b["text/x-iri-selected-html"]);var e=d.find(".tweet");c.title=this.renkan.translate("Tweet by ")+e.attr("data-name"),c.uri="http://twitter.com/"+e.attr("data-screen-name")+"/status/"+e.attr("data-tweet-id"),c.image=e.find(".avatar").attr("src"),c.description=e.find(".js-tweet-text:first").text();break;case"google":d=a("<div>").html(b["text/x-iri-selected-html"]),c.title=d.find("h3:first").text().trim(),c.uri=d.find("h3 a").attr("href"),c.description=d.find(".st:first").text().trim();break;default:b["text/x-iri-source-uri"]&&(c.uri=b["text/x-iri-source-uri"])}if((b["text/plain"]||b["text/x-iri-selected-text"])&&(c.description=(b["text/plain"]||b["text/x-iri-selected-text"]).replace(/[\s\n]+/gm," ").trim()),b["text/html"]||b["text/x-iri-selected-html"]){d=a("<div>").html(b["text/html"]||b["text/x-iri-selected-html"]);var f=d.find("image");f.length&&(c.image=f.attr("xlink:href"));var g=d.find("path");g.length&&(c.clipPath=g.attr("d"));var h=d.find("img");h.length&&(c.image=h[0].src);var i=d.find("a");i.length&&(c.uri=i[0].href),c.title=d.find("[title]").attr("title")||c.title,c.description=d.text().replace(/[\s\n]+/gm," ").trim()}b["text/uri-list"]&&(c.uri=b["text/uri-list"]),b["text/x-moz-url"]&&!c.title&&(c.title=(b["text/x-moz-url"].split("\n")[1]||"").trim(),c.title===c.uri&&(c.title=!1)),b["text/x-iri-source-title"]&&!c.title&&(c.title=b["text/x-iri-source-title"]),(b["text/html"]||b["text/x-iri-selected-html"])&&(d=a("<div>").html(b["text/html"]||b["text/x-iri-selected-html"]),c.image=d.find("[data-image]").attr("data-image")||c.image,c.uri=d.find("[data-uri]").attr("data-uri")||c.uri,c.title=d.find("[data-title]").attr("data-title")||c.title,c.description=d.find("[data-description]").attr("data-description")||c.description,c.clipPath=d.find("[data-clip-path]").attr("data-clip-path")||c.clipPath),c.title||(c.title=this.renkan.translate("Dragged resource"));for(var j=["title","description","uri","image"],k=0;k<j.length;k++){var l=j[k];(b["text/x-iri-"+l]||b[l])&&(c[l]=b["text/x-iri-"+l]||b[l]),("none"===c[l]||"null"===c[l])&&(c[l]=void 0)}return"function"==typeof this.renkan.options.drop_enhancer&&(c=this.renkan.options.drop_enhancer(c,b)),c},dropData:function(a,c){if(this.isEditable()){if(a["text/json"]||a["application/json"])try{var d=JSON.parse(a["text/json"]||a["application/json"]);b(a).extend(d)}catch(e){}var g="undefined"==typeof this.renkan.options.drop_handler?this.defaultDropHandler(a):this.renkan.options.drop_handler(a),h=this.canvas_$.offset(),i=new paper.Point([c.pageX-h.left,c.pageY-h.top]),j=this.toModelCoords(i),k={id:f.getUID("node"),created_by:this.renkan.current_user,uri:g.uri||"",title:g.title||"",description:g.description||"",image:g.image||"",color:g.color||void 0,clip_path:g.clipPath||void 0,position:{x:j.x,y:j.y}},l=this.renkan.project.addNode(k),m=this.getRepresentationByModel(l);"drop"===c.type&&m.openEditor()}},fullScreen:function(){var a,b=document.fullScreen||document.mozFullScreen||document.webkitIsFullScreen,c=this.renkan.$[0],d=["requestFullScreen","mozRequestFullScreen","webkitRequestFullScreen"],e=["cancelFullScreen","mozCancelFullScreen","webkitCancelFullScreen"];if(b){for(a=0;a<e.length;a++)if("function"==typeof document[e[a]]){document[e[a]]();break}var f=this.$.width(),g=this.$.height();this.renkan.options.show_top_bar&&(g-=this.$.find(".Rk-TopBar").height()),this.renkan.options.show_bins&&this.renkan.$.find(".Rk-Bins").position().left>0&&(f-=this.renkan.$.find(".Rk-Bins").width()),paper.view.viewSize=new paper.Size([f,g])}else{for(a=0;a<d.length;a++)if("function"==typeof c[d[a]]){c[d[a]]();break}this.redraw()}},zoomOut:function(){var a=this.scale*Math.SQRT1_2,b=new paper.Point([this.canvas_$.width(),this.canvas_$.height()]).multiply(.5*(1-Math.SQRT1_2)).add(this.offset.multiply(Math.SQRT1_2));this.setScale(a,b)},zoomIn:function(){var a=this.scale*Math.SQRT2,b=new paper.Point([this.canvas_$.width(),this.canvas_$.height()]).multiply(.5*(1-Math.SQRT2)).add(this.offset.multiply(Math.SQRT2));this.setScale(a,b)},resizeZoom:function(a,b,c){var d=this.scale*c,e=new paper.Point([this.offset.x*a,this.offset.y*b]);this.setScale(d,e)},addNodeBtn:function(){return this.click_mode===f._CLICKMODE_ADDNODE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=f._CLICKMODE_ADDNODE,this.notif_$.text(this.renkan.translate("Click on the background canvas to add a node")).fadeIn()),!1},addEdgeBtn:function(){return this.click_mode===f._CLICKMODE_STARTEDGE||this.click_mode===f._CLICKMODE_ENDEDGE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=f._CLICKMODE_STARTEDGE,this.notif_$.text(this.renkan.translate("Click on a first node to start the edge")).fadeIn()),!1},exportProject:function(){var a=this.renkan.project.toJSON(),d=(document.createElement("a"),a.id),e=d+".json";delete a.id,delete a._id,delete a.space_id;var g,h={};b.each(a.nodes,function(a){g=a.id||a._id,delete a._id,delete a.id,h[g]=a["@id"]=f.getUUID4()}),b.each(a.edges,function(a){delete a._id,delete a.id,a.to=h[a.to],a.from=h[a.from]}),b.each(a.views,function(a){g=a.id||a._id,delete a._id,delete a.id}),a.users=[];var i=JSON.stringify(a,null,2),j=new Blob([i],{type:"application/json;charset=utf-8"});c(j,e)},foldBins:function(){var a,b=this.$.find(".Rk-Fold-Bins"),c=this.renkan.$.find(".Rk-Bins"),d=this,e=d.canvas_$.width();c.position().left<0?(c.animate({left:0},250),this.$.animate({left:300},250,function(){var a=d.$.width();paper.view.viewSize=new paper.Size([a,d.canvas_$.height()])}),a=e-c.width()<c.height()?e:e-c.width(),b.html("&laquo;")):(c.animate({left:-300},250),this.$.animate({left:0},250,function(){var a=d.$.width();paper.view.viewSize=new paper.Size([a,d.canvas_$.height()])}),a=e+300,b.html("&raquo;")),d.resizeZoom(1,1,a/e)},save:function(){},open:function(){}}),g}),"function"==typeof require.config&&require.config({paths:{jquery:"../lib/jquery/jquery",underscore:"../lib/underscore/underscore",filesaver:"../lib/FileSaver/FileSaver",requtils:"require-utils"}}),require(["renderer/baserepresentation","renderer/basebutton","renderer/noderepr","renderer/edge","renderer/tempedge","renderer/baseeditor","renderer/nodeeditor","renderer/edgeeditor","renderer/nodebutton","renderer/nodeeditbutton","renderer/noderemovebutton","renderer/noderevertbutton","renderer/nodelinkbutton","renderer/nodeenlargebutton","renderer/nodeshrinkbutton","renderer/edgeeditbutton","renderer/edgeremovebutton","renderer/edgerevertbutton","renderer/miniframe","renderer/scene"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t){var u=window.Rkns;"undefined"==typeof u.Renderer&&(u.Renderer={});var v=u.Renderer;v._BaseRepresentation=a,v._BaseButton=b,v.Node=c,v.Edge=d,v.TempEdge=e,v._BaseEditor=f,v.NodeEditor=g,v.EdgeEditor=h,v._NodeButton=i,v.NodeEditButton=j,v.NodeRemoveButton=k,v.NodeRevertButton=l,v.NodeLinkButton=m,v.NodeEnlargeButton=n,v.NodeShrinkButton=o,v.EdgeEditButton=p,v.EdgeRemoveButton=q,v.EdgeRevertButton=r,v.MiniFrame=s,v.Scene=t,startRenkan()}),define("main-renderer",function(){});
 //# sourceMappingURL=renkan.min.map
\ No newline at end of file
--- a/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.min.map	Fri Apr 24 11:13:16 2015 +0200
+++ b/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.min.map	Fri Apr 24 13:05:09 2015 +0200
@@ -1,1 +1,1 @@
-{"version":3,"file":"renkan.min.js","sources":["../../js/main.js","../../js/models.js","../../js/defaults.js","../../js/i18n.js","../../js/full-json.js","../../js/save-once.js","../../js/ldtjson-bin.js","../../js/list-bin.js","../../js/wikipedia-bin.js","paper-renderer.js","templates.js"],"names":["root","Rkns","$","jQuery","_","pickerColors","__renkans","_BaseBin","_renkan","_opts","this","renkan","find","hide","addClass","appendTo","title_icon_$","_this","attr","href","title","translate","html","click","destroy","length","slideDown","resizeBins","refresh","count_$","title_$","main_$","auto_refresh","window","setInterval","prototype","detach","Renkan","push","options","defaults","templates","renkanJST","property_files","each","f","getJSON","data","properties","concat","read_only","editor_mode","project","Models","Project","setCurrentUser","user_id","user_name","addUser","_id","current_user","renderer","redrawUsers","container","template","tabs","search_engines","current_user_list","UsersList","on","colorPicker","_tmpl","map","c","join","show_editor","Renderer","Scene","search","_select","_input","_form","_search","type","Search","_key","key","getSearchTitle","className","getBgClass","_el","setSearchEngine","submit","val","search_engine","mouseenter","mouseleave","bins","_bin","Bin","elementDropped","_mainDiv","siblings","is","slideUp","_t","_models","get","where","uri","_model","highlightModel","mouseout","unhighlightAll","dragDrop","err","e","preventDefault","touch","originalEvent","changedTouches","off","canvas_$","offset","w","width","h","height","pageX","left","pageY","top","onMouseMove","div","document","createElement","appendChild","cloneNode","dropData","text/html","innerHTML","onMouseDown","onMouseUp","dataTransfer","setData","resize","lastsearch","lastval","Utils","regexpFromTextOrArray","source","tab","render","_text","i18n","language","substr","onStatusChange","listClasses","split","classes","i","_d","outerHeight","css","getUUID4","replace","r","Math","random","v","toString","getUID","pad","n","Date","ID_AUTO_INCREMENT","ID_BASE","getUTCFullYear","getUTCMonth","getUTCDate","_base","_n","_uidbase","getFullURL","url","test","img","Image","src","res","inherit","_baseClass","_callbefore","_class","apply","Array","slice","call","arguments","_init","_initialized","extend","replaceText","makeReplaceFunc","l","k","charsrx","txt","toLowerCase","remrx","j","remsrc","charsub","getSource","inp","removeChars","String","fromCharCode","RegExp","_textOrArray","testrx","replacerx","isempty","_replace","text","_MIN_DRAG_DISTANCE","_NODE_BUTTON_WIDTH","_EDGE_BUTTON_INNER","_EDGE_BUTTON_OUTER","_CLICKMODE_ADDNODE","_CLICKMODE_STARTEDGE","_CLICKMODE_ENDEDGE","_NODE_SIZE_STEP","LN2","_MIN_SCALE","_MAX_SCALE","_MOUSEMOVE_RATE","_DOUBLETAP_DELAY","_DOUBLETAP_DISTANCE","_USER_PLACEHOLDER","color","default_user_color","_BOOKMARKLET_CODE","shortenText","_maxlength","drawEditBox","_options","_coords","_path","_xmargin","_selector","tooltip_width","tooltip_padding","_height","_isLeft","x","paper","view","center","_left","tooltip_arrow_length","_right","_top","y","size","tooltip_margin","max","tooltip_arrow_width","min","_bottom","segments","point","add","closed","fillColor","GradientColor","Gradient","tooltip_top_color","tooltip_bottom_color","Backbone","obj","guid","RenkanModel","RelationalModel","idAttribute","constructor","id","description","prepare","validate","addReference","_propName","_list","_default","_element","User","toJSON","Node","relations","HasOne","relatedModel","created_by","position","image","clip_path","shape","Edge","from","to","View","isArray","zoom_level","RosterUser","blacklist","HasMany","reverseRelation","includeInJSON","_props","_user","findOrCreate","addNode","_node","addEdge","_edge","addView","_view","removeNode","remove","removeEdge","_project","users","nodes","edges","views","_item","initialize","filter","json","clone","attributes","Model","Collection","omit","site_id","model","navigator","userLanguage","static_url","show_bins","manual_save","show_top_bar","size_bug_fix","force_resize","allow_double_click","zoom_on_scroll","element_delete_delay","autoscale_padding","show_zoom","save_view","default_view","show_search_field","show_user_list","user_name_editable","user_color_editable","show_user_color","show_save_button","show_export_button","show_open_button","show_addnode_button","show_addedge_button","show_bookmarklet","show_fullscreen_button","home_button_url","home_button_title","show_minimap","minimap_width","minimap_height","minimap_padding","minimap_background_color","minimap_border_color","minimap_highlight_color","minimap_highlight_weight","buttons_background","buttons_label_color","buttons_label_font_size","show_node_circles","clip_node_images","node_images_fill_mode","node_size_base","node_stroke_width","selected_node_stroke_width","node_fill_color","highlighted_node_fill_color","node_label_distance","node_label_max_length","label_untitled_nodes","change_shapes","edge_stroke_width","selected_edge_stroke_width","edge_label_distance","edge_label_max_length","edge_arrow_length","edge_arrow_width","edge_gap_in_bundles","label_untitled_edges","tooltip_border_color","tooltip_border_width","show_node_editor_uri","show_node_editor_description","show_node_editor_size","show_node_editor_color","show_node_editor_image","show_node_editor_creator","allow_image_upload","uploaded_image_max_kb","show_node_tooltip_uri","show_node_tooltip_description","show_node_tooltip_color","show_node_tooltip_image","show_node_tooltip_creator","show_edge_editor_uri","show_edge_editor_color","show_edge_editor_direction","show_edge_editor_nodes","show_edge_editor_creator","show_edge_tooltip_uri","show_edge_tooltip_color","show_edge_tooltip_nodes","show_edge_tooltip_creator","fr","Edit Node","Edit Edge","Title:","URI:","Description:","From:","To:","Image URL:","Choose Image File:","Full Screen","Add Node","Add Edge","Save Project","Open Project","Auto-save enabled","Connection lost","Created by:","Zoom In","Zoom Out","Edit","Remove","Cancel deletion","Link to another node","Enlarge","Shrink","Click on the background canvas to add a node","Click on a first node to start the edge","Click on a second node to complete the edge","Wikipedia","Wikipedia in ","French","English","Japanese","Untitled project","Lignes de Temps","Loading, please wait","Edge color:","Node color:","Choose color","Change edge direction","Do you really wish to remove node ","Do you really wish to remove edge ","This file is not an image","Image size must be under ","Size:","KB","Choose from vocabulary:","SKOS Documentation properties","has note","has example","has definition","SKOS Semantic relations","has broader","has narrower","has related","Dublin Core Metadata","has contributor","covers","created by","has date","published by","has source","has subject","Dragged resource","Search the Web","Search in Bins","Close bin","Refresh bin","(untitled)","Select contents:","Drag items from this website, drop them in Renkan","Drag this button to your bookmark bar. When on a third-party website, click it to enable drag-and-drop from the website to Renkan.","Shapes available","Circle","Square","Diamond","Hexagone","Ellipse","Star","Zoom Fit","Download Project","Zoom Save","View saved zoom","Renkan 'Drag-to-Add' bookmarklet","(unknown user)","<unknown user>","Search in graph","Search in ","jsonIO","_proj","http_method","_load","redrawActive","set","loading_status","_data","save_status","fixSize","_save","ajax","contentType","JSON","stringify","success","_thrSave","throttle","setTimeout","changedAttributes","hasChanged","jsonIOSaveOnClick","_saveWarn","_onLeave","getdata","rx","matches","location","hash","match","beforeSend","autoScale","_checkLeave","removeClass","save","hasClass","Ldt","ProjectBin","ldt_type","Resclass","console","error","tagTemplate","annotationTemplate","proj_id","project_id","ldt_platform","searchbase","highlight","_e","escape","convertTC","_ms","_res","_totalSeconds","abs","floor","_hours","_minutes","_seconds","_html","_projtitle","meta","count","tags","_tag","_title","htitle","encodedtitle","encodeURIComponent","annotations","_annotation","_description","content","_duration","end","begin","_img","hdescription","start","duration","mediaid","media","annotationid","show","dataType","lang","_q","ResultsBin","segmentTemplate","max_results","highlightrx","objects","_segment","_begin","start_ts","_end","iri_id","element_id","format","q","limit","ResourceList","resultTemplate","list","trim","_match","langs","en","ja","query","_result","encodeURI","snippet","define","_BaseRepresentation","_renderer","_changeBinding","redraw","_removeBinding","removeRepresentation","defer","_selectBinding","select","_unselectBinding","unselect","_super","_func","moveTo","trigger","unhighlight","mousedown","mouseup","getUtils","getRenderer","requtils","BaseRepresentation","_BaseButton","_pos","sector","_newTarget","source_representation","builders","circle","getShape","Path","getImageShape","radius","rectangle","Rectangle","ellipse","polygon","RegularPolygon","diamond","d","rotate","star","svg","path","ShapeBuilder","NodeRepr","node_layer","activate","buildShape","strokeWidth","h_ratio","labels_$","normal_buttons","NodeEditButton","NodeRemoveButton","NodeLinkButton","NodeEnlargeButton","NodeShrinkButton","pending_delete_buttons","NodeRevertButton","all_buttons","active_buttons","last_circle_radius","minimap","minimap_circle","__representation","miniframe","node_group","addChild","shapeBuilder","_dontRedrawEdges","_model_coords","Point","_baseRadius","exp","is_dragging","paper_coords","toPaperCoords","circle_radius","scale","forEach","b","setSectorSize","node_image","subtract","image_delta","multiply","old_act_btn","opacity","dashArray","selected","isEditable","highlighted","_color","strokeColor","_pc","lastImage","showImage","minipos","toMinimapCoords","miniradius","minisize","Size","fitBounds","ed","edge","repr","getRepresentationByModel","from_representation","to_representation","_image","image_cache","clipPath","hasClipPath","_clip","baseRadius","centerPoint","instructions","lastCoords","minX","Infinity","minY","maxX","maxY","transformCoords","tabc","relative","newCoords","parseFloat","isY","instr","coords","lineTo","cubicCurveTo","quadraticCurveTo","_raster","Raster","locked","Group","clipped","_circleClip","divide","throttledPaperDraw","paperShift","_delta","openEditor","removeRepresentationsOfType","_editor","addRepresentation","draw","_uri","hideButtons","buttons_timeout","undefined","textToReplace","hlvalue","saveCoords","toModelCoords","_event","_isTouch","unselectAll","click_target","edge_layer","bundle","addToBundles","line","arrow","arrow_angle","EdgeEditButton","EdgeRemoveButton","EdgeRevertButton","minimap_line","_p0a","_p1a","_v","_r","_u","_ortho","_group_pos","getPosition","_p0b","_p1b","_a","angle","_textdelta","_handle","handleIn","handleOut","_textpos","transform","-moz-transform","-webkit-transform","text_angle","reject","TempEdge","_p0","_p1","end_pos","_c","_hitResult","hitTest","findTarget","_endDrag","item","_target","_destmodel","_BaseEditor","buttons_layer","editor_block","_pts","range","editor_$","BaseEditor","NodeEditor","readOnlyTemplate","_created_by","_template","_image_placeholder","_size","node","has_creator","short_uri","image_placeholder","created_by_color","created_by_title","closeEditor","onFieldChange","shape_changed","keyCode","change","files","FileReader","alert","onload","target","result","readAsDataURL","focus","_picker","hover","shiftSize","_newsize","titlehtml","load","EdgeEditor","_from_model","_to_model","from_title","to_title","from_color","to_color","BaseButton","_NodeButton","sectorInner","lastSectorInner","drawSector","startAngle","endAngle","imageName","clearTimeout","NodeButton","delid","delete_list","time","valueOf","confirm","unset","_off","_point","addTempEdge","MiniFrame","filesaver","representations","notif_$","setup","initialScale","totalScroll","mouse_down","selected_target","Layer","background_layer","topleft","bounds","bottomRight","cliprectangle","bundles","click_mode","_allowScroll","_originalScale","_zooming","_lastTapX","_lastTapY","icon_cache","imgname","throttledMouseMove","mousemove","mousewheel","onScroll","touchstart","_touches","touches","_lastTap","pow","onDoubleClick","touchmove","_newScale","_scaleRatio","_newOffset","setScale","touchend","dblclick","dragover","dragenter","dragleave","drop","types","t","getData","parse","bindClick","selector","fname","evt","last","fadeIn","delay","fadeOut","mouseover","onResize","_ratio","newWidth","newHeight","ratioH","delta","ratioW","resizeZoom","_thRedraw","addRepresentations","_thRedrawUsers","el","_delay","$cpwrapper","$cplist","$this","rxs","_now","findWhere","delete_scheduled","rescaleMinimap","_repr","_inR","_outR","_startAngle","_endAngle","_padding","_imgname","_caption","_startRads","PI","_endRads","_startdx","sin","_startdy","cos","_startXIn","_startYIn","_startXOut","_startYOut","_enddx","_enddy","_endXIn","_endYIn","_endXOut","_endYOut","_centerR","_centerRads","_centerX","_centerY","_centerXIn","_centerXOut","_centerYIn","_centerYOut","_textX","_textY","arcTo","PointText","characterStyle","fontSize","paragraphStyle","justification","visible","_visible","_restPos","_grp","_imgdelta","_currentPos","pivot","_edgeRepr","_bundle","_er","_dir","indexOf","savebtn","tip","_offset","force_view","_xx","_yy","_minx","_miny","_maxx","_maxy","_scale","at","redrawMiniframe","bottomright","_type","RendererType","_collection","userTemplate","allUsers","models","ulistHtml","$userpanel","$name","$cpitems","$colorsquare","$input","blur","empty","parent","name","background","_representation","_representations","_from","_tmpEdge","last_point","_scrolldelta","SQRT2","SQRT1_2","defaultDropHandler","newNode","tweetdiv","_svgimgs","_svgpaths","_imgs","_as","fields","drop_enhancer","jsondata","drop_handler","_nodedata","fullScreen","_isFull","mozFullScreen","webkitIsFullScreen","_requestMethods","_cancelMethods","widthAft","heightAft","viewSize","zoomOut","zoomIn","_scaleWidth","_scaleHeight","addNodeBtn","addEdgeBtn","exportProject","projectJSON","projectId","fileNameToSaveAs","space_id","objId","idsMap","projectJSONStr","blob","Blob","foldBins","sizeAft","foldBinsButton","sizeBef","animate","open","require","config","paths","jquery","underscore","startRenkan","__t","__p","__e","ontology","label","property","print","__j"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;CAGA,SAAUA,GAEV,YAEyB,iBAAdA,GAAKC,OACZD,EAAKC,QAGT,IAAIA,GAAOD,EAAKC,KACZC,EAAID,EAAKC,EAAIF,EAAKG,OAClBC,EAAIH,EAAKG,EAAIJ,EAAKI,CAEtBH,GAAKI,cAAgB,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAC9F,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAC7E,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAC7E,U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AAO,oDAEPA,KAAO,OACF9jC,QAAQ+T,YACb+vB,KAAO,wEACPC,IAAIjlC,UAAU,YACd,gDACAilC,IAAIjlC,UAAU,aACd,gDACAilC,IAAIjlC,UAAU,aACd,iBACKkB,QAAQY,aAAeZ,QAAQgU,YACpC8vB,KAAO,0CACPC,IAAIjlC,UAAU,cACd,kBAEAglC,KAAO,SACF9jC,QAAQgU,YACb8vB,KAAO,8CACPC,IAAIjlC,UAAU,oBACd,kBAEAglC,KAAO,mBAEPA,KAAO,mBAGP,OAAOA","sourcesContent":["\n/* Declaring the Renkan Namespace Rkns and Default values */\n\n(function(root) {\n\n\"use strict\";\n\nif (typeof root.Rkns !== \"object\") {\n    root.Rkns = {};\n}\n\nvar Rkns = root.Rkns;\nvar $ = Rkns.$ = root.jQuery;\nvar _ = Rkns._ = root._;\n\nRkns.pickerColors = [\"#8f1919\", \"#a80000\", \"#d82626\", \"#ff0000\", \"#e87c7c\", \"#ff6565\", \"#f7d3d3\", \"#fecccc\",\n    \"#8f5419\", \"#a85400\", \"#d87f26\", \"#ff7f00\", \"#e8b27c\", \"#ffb265\", \"#f7e5d3\", \"#fee5cc\",\n    \"#8f8f19\", \"#a8a800\", \"#d8d826\", \"#feff00\", \"#e8e87c\", \"#feff65\", \"#f7f7d3\", \"#fefecc\",\n    \"#198f19\", \"#00a800\", \"#26d826\", \"#00ff00\", \"#7ce87c\", \"#65ff65\", \"#d3f7d3\", \"#ccfecc\",\n    \"#198f8f\", \"#00a8a8\", \"#26d8d8\", \"#00feff\", \"#7ce8e8\", \"#65feff\", \"#d3f7f7\", \"#ccfefe\",\n    \"#19198f\", \"#0000a8\", \"#2626d8\", \"#0000ff\", \"#7c7ce8\", \"#6565ff\", \"#d3d3f7\", \"#ccccfe\",\n    \"#8f198f\", \"#a800a8\", \"#d826d8\", \"#ff00fe\", \"#e87ce8\", \"#ff65fe\", \"#f7d3f7\", \"#feccfe\",\n    \"#000000\", \"#242424\", \"#484848\", \"#6d6d6d\", \"#919191\", \"#b6b6b6\", \"#dadada\", \"#ffffff\"];\n\nRkns.__renkans = [];\n\nvar _BaseBin = Rkns._BaseBin = function(_renkan, _opts) {\n    if (typeof _renkan !== \"undefined\") {\n        this.renkan = _renkan;\n        this.renkan.$.find(\".Rk-Bin-Main\").hide();\n        this.$ = Rkns.$('<li>')\n            .addClass(\"Rk-Bin\")\n            .appendTo(_renkan.$.find(\".Rk-Bin-List\"));\n        this.title_icon_$ = Rkns.$('<span>')\n            .addClass(\"Rk-Bin-Title-Icon\")\n            .appendTo(this.$);\n\n        var _this = this;\n\n        Rkns.$('<a>')\n            .attr({\n                href: \"#\",\n                title: _renkan.translate(\"Close bin\")\n            })\n            .addClass(\"Rk-Bin-Close\")\n            .html('&times;')\n            .appendTo(this.$)\n            .click(function() {\n                _this.destroy();\n                if (!_renkan.$.find(\".Rk-Bin-Main:visible\").length) {\n                    _renkan.$.find(\".Rk-Bin-Main:last\").slideDown();\n                }\n                _renkan.resizeBins();\n                return false;\n            });\n        Rkns.$('<a>')\n            .attr({\n                href: \"#\",\n                title: _renkan.translate(\"Refresh bin\")\n            })\n            .addClass(\"Rk-Bin-Refresh\")\n            .appendTo(this.$)\n            .click(function() {\n                _this.refresh();\n                return false;\n            });\n        this.count_$ = Rkns.$('<div>')\n            .addClass(\"Rk-Bin-Count\")\n            .appendTo(this.$);\n        this.title_$ = Rkns.$('<h2>')\n            .addClass(\"Rk-Bin-Title\")\n            .appendTo(this.$);\n        this.main_$ = Rkns.$('<div>')\n            .addClass(\"Rk-Bin-Main\")\n            .appendTo(this.$)\n            .html('<h4 class=\"Rk-Bin-Loading\">' + _renkan.translate(\"Loading, please wait\") + '</h4>');\n        this.title_$.html(_opts.title || '(new bin)');\n        this.renkan.resizeBins();\n\n        if (_opts.auto_refresh) {\n            window.setInterval(function() {\n                _this.refresh();\n            },_opts.auto_refresh);\n        }\n    }\n};\n\n_BaseBin.prototype.destroy = function() {\n    this.$.detach();\n    this.renkan.resizeBins();\n};\n\n/* Point of entry */\n\nvar Renkan = Rkns.Renkan = function(_opts) {\n    var _this = this;\n\n    Rkns.__renkans.push(this);\n\n    this.options = _.defaults(_opts, Rkns.defaults, {templates: renkanJST});\n\n    _(this.options.property_files).each(function(f) {\n        Rkns.$.getJSON(f, function(data) {\n            _this.options.properties = _this.options.properties.concat(data);\n        });\n    });\n\n    this.read_only = this.options.read_only || !this.options.editor_mode;\n\n    this.project = new Rkns.Models.Project();\n\n    this.setCurrentUser = function (user_id, user_name) {\n    \tthis.project.addUser({\n    \t\t_id:user_id,\n    \t\ttitle: user_name\n    \t});\n    \tthis.current_user = user_id;\n    \tthis.renderer.redrawUsers();\n    };\n    \n    if (typeof this.options.user_id !== \"undefined\") {\n        this.current_user = this.options.user_id;\n    }\n    this.$ = Rkns.$(\"#\" + this.options.container);\n    this.$\n        .addClass(\"Rk-Main\")\n        .html(this.template(this));\n\n    this.tabs = [];\n    this.search_engines = [];\n\n    this.current_user_list = new Rkns.Models.UsersList();\n\n    this.current_user_list.on(\"add remove\", function() {\n        if (this.renderer) {\n            this.renderer.redrawUsers();\n        }\n    });\n\n    this.colorPicker = (function() {\n        var _tmpl = _.template('<li data-color=\"<%=c%>\" style=\"background: <%=c%>\"></li>');\n        return '<ul class=\"Rk-Edit-ColorPicker\">' + Rkns.pickerColors.map(function(c) { return _tmpl({c:c});}).join(\"\") + '</ul>';\n    })();\n\n    if (this.options.show_editor) {\n        this.renderer = new Rkns.Renderer.Scene(this);\n    }\n\n    if (!this.options.search.length) {\n        this.$.find(\".Rk-Web-Search-Form\").detach();\n    } else {\n        var _tmpl = _.template('<li class=\"<%= className %>\" data-key=\"<%= key %>\"><%= title %></li>'),\n            _select = this.$.find(\".Rk-Search-List\"),\n            _input = this.$.find(\".Rk-Web-Search-Input\"),\n            _form = this.$.find(\".Rk-Web-Search-Form\");\n        _(this.options.search).each(function(_search, _key) {\n            if (Rkns[_search.type] && Rkns[_search.type].Search) {\n                _this.search_engines.push(new Rkns[_search.type].Search(_this, _search));\n            }\n        });\n        _select.html(\n            _(this.search_engines).map(function(_search, _key) {\n                return _tmpl({\n                    key: _key,\n                    title: _search.getSearchTitle(),\n                    className: _search.getBgClass()\n                });\n            }).join(\"\")\n        );\n        _select.find(\"li\").click(function() {\n            var _el = Rkns.$(this);\n            _this.setSearchEngine(_el.attr(\"data-key\"));\n            _form.submit();\n        });\n        _form.submit(function() {\n            if (_input.val()) {\n                var _search = _this.search_engine;\n                _search.search(_input.val());\n            }\n            return false;\n        });\n        this.$.find(\".Rk-Search-Current\").mouseenter(\n            function() { _select.slideDown(); }\n        );\n        this.$.find(\".Rk-Search-Select\").mouseleave(\n            function() { _select.hide(); }\n        );\n        this.setSearchEngine(0);\n    }\n    _(this.options.bins).each(function(_bin) {\n        if (Rkns[_bin.type] && Rkns[_bin.type].Bin) {\n            _this.tabs.push(new Rkns[_bin.type].Bin(_this, _bin));\n        }\n    });\n\n    var elementDropped = false;\n\n    this.$.find(\".Rk-Bins\")\n        .on(\"click\",\".Rk-Bin-Title,.Rk-Bin-Title-Icon\", function() {\n            var _mainDiv = Rkns.$(this).siblings(\".Rk-Bin-Main\");\n            if (_mainDiv.is(\":hidden\")) {\n                _this.$.find(\".Rk-Bin-Main\").slideUp();\n                _mainDiv.slideDown();\n            }\n        });\n\n    if (this.options.show_editor) {\n\n        this.$.find(\".Rk-Bins\").on(\"mouseover\", \".Rk-Bin-Item\", function(_e) {\n            var _t = Rkns.$(this);\n            if (_t && $(_t).attr(\"data-uri\")) {\n                var _models = _this.project.get(\"nodes\").where({\n                    uri: $(_t).attr(\"data-uri\")\n                });\n                _(_models).each(function(_model) {\n                    _this.renderer.highlightModel(_model);\n                });\n            }\n        }).mouseout(function() {\n            _this.renderer.unhighlightAll();\n        }).on(\"mousemove\", \".Rk-Bin-Item\", function(e) {\n            try {\n                this.dragDrop();\n            }\n            catch(err) {}\n        }).on(\"touchstart\", \".Rk-Bin-Item\", function(e) {\n            elementDropped = false;\n        }).on(\"touchmove\", \".Rk-Bin-Item\", function(e) {\n            e.preventDefault();\n            var touch = e.originalEvent.changedTouches[0],\n                off = _this.renderer.canvas_$.offset(),\n                w = _this.renderer.canvas_$.width(),\n                h = _this.renderer.canvas_$.height();\n            if (touch.pageX >= off.left && touch.pageX < (off.left + w) && touch.pageY >= off.top && touch.pageY < (off.top + h)) {\n                if (elementDropped) {\n                    _this.renderer.onMouseMove(touch, true);\n                } else {\n                    elementDropped = true;\n                    var div = document.createElement('div');\n                    div.appendChild(this.cloneNode(true));\n                    _this.renderer.dropData({\"text/html\": div.innerHTML}, touch);\n                    _this.renderer.onMouseDown(touch, true);\n                }\n            }\n        }).on(\"touchend\", \".Rk-Bin-Item\", function(e) {\n            if (elementDropped) {\n                _this.renderer.onMouseUp(e.originalEvent.changedTouches[0], true);\n            }\n            elementDropped = false;\n        }).on(\"dragstart\", \".Rk-Bin-Item\", function(e) {\n            var div = document.createElement('div');\n            div.appendChild(this.cloneNode(true));\n            try {\n                e.originalEvent.dataTransfer.setData(\"text/html\",div.innerHTML);\n            }\n            catch(err) {\n                e.originalEvent.dataTransfer.setData(\"text\",div.innerHTML);\n            }\n        });\n\n    }\n\n    Rkns.$(window).resize(function() {\n        _this.resizeBins();\n    });\n\n    var lastsearch = false, lastval = '';\n\n    this.$.find(\".Rk-Bins-Search-Input\").on(\"change keyup paste input\", function() {\n        var val = Rkns.$(this).val();\n        if (val === lastval) {\n            return;\n        }\n        var search = Rkns.Utils.regexpFromTextOrArray(val.length > 1 ? val: null);\n        if (search.source === lastsearch) {\n            return;\n        }\n        lastsearch = search.source;\n        _(_this.tabs).each(function(tab) {\n            tab.render(search);\n        });\n\n    });\n    this.$.find(\".Rk-Bins-Search-Form\").submit(function() {\n        return false;\n    });\n\n};\n\nRenkan.prototype.template = _.template(\n    '<% if (options.show_bins) { %><div class=\"Rk-Bins\"><div class=\"Rk-Bins-Head\"><h2 class=\"Rk-Bins-Title\"><%- translate(\"Select contents:\")%></h2>' +\n    '<form class=\"Rk-Web-Search-Form Rk-Search-Form\"><input class=\"Rk-Web-Search-Input Rk-Search-Input\" type=\"search\" placeholder=\"<%- translate(\"Search the Web\") %>\" />' +\n    '<div class=\"Rk-Search-Select\"><div class=\"Rk-Search-Current\"></div><ul class=\"Rk-Search-List\"></ul></div>' +\n    '<input type=\"submit\" value=\"\" class=\"Rk-Web-Search-Submit Rk-Search-Submit\" title=\"<%- translate(\"Search the Web\") %>\" /></form>' +\n    '<form class=\"Rk-Bins-Search-Form Rk-Search-Form\"><input class=\"Rk-Bins-Search-Input Rk-Search-Input\" type=\"search\" placeholder=\"<%- translate(\"Search in Bins\") %>\" />' +\n    '<input type=\"submit\" value=\"\" class=\"Rk-Bins-Search-Submit Rk-Search-Submit\" title=\"<%- translate(\"Search in Bins\") %>\" /></form></div>' +\n    '<ul class=\"Rk-Bin-List\"></ul></div><% } %>' +\n    '<% if (options.show_editor) { %><div class=\"Rk-Render Rk-Render-<% if (options.show_bins) { %>Panel<% } else { %>Full<% } %>\"></div><% } %>'\n);\n\nRenkan.prototype.translate = function(_text) {\n    if (Rkns.i18n[this.options.language] && Rkns.i18n[this.options.language][_text]) {\n        return Rkns.i18n[this.options.language][_text];\n    }\n    if (this.options.language.length > 2 && Rkns.i18n[this.options.language.substr(0,2)] && Rkns.i18n[this.options.language.substr(0,2)][_text]) {\n        return Rkns.i18n[this.options.language.substr(0,2)][_text];\n    }\n    return _text;\n};\n\nRenkan.prototype.onStatusChange = function() {\n    this.renderer.onStatusChange();\n};\n\nRenkan.prototype.setSearchEngine = function(_key) {\n    this.search_engine = this.search_engines[_key];\n    this.$.find(\".Rk-Search-Current\").attr(\"class\",\"Rk-Search-Current \" + this.search_engine.getBgClass());\n    var listClasses = this.search_engine.getBgClass().split(\" \");\n    var classes = \"\";\n    for\t(var i= 0; i < listClasses.length; i++) {\n        classes += \".\" + listClasses[i];\n    }\n    this.$.find(\".Rk-Web-Search-Input.Rk-Search-Input\").attr(\"placeholder\", this.translate(\"Search in \") + this.$.find(\".Rk-Search-List \"+ classes).html());\n};\n\nRenkan.prototype.resizeBins = function() {\n    var _d = + this.$.find(\".Rk-Bins-Head\").outerHeight();\n    this.$.find(\".Rk-Bin-Title:visible\").each(function() {\n        _d += Rkns.$(this).outerHeight();\n    });\n    this.$.find(\".Rk-Bin-Main\").css({\n        height: this.$.find(\".Rk-Bins\").height() - _d\n    });\n};\n\n/* Utility functions */\nvar getUUID4 = function() {\n    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n        var r = Math.random()*16|0, v = c === 'x' ? r : (r&0x3|0x8);\n        return v.toString(16);\n    });\n};\n\nRkns.Utils = {\n    getUUID4 : getUUID4,\n    getUID : (function() {\n        function pad(n){\n            return n<10 ? '0'+n : n;\n        }\n        var _d = new Date(),\n            ID_AUTO_INCREMENT = 0,\n            ID_BASE = _d.getUTCFullYear() + '-' +\n              pad(_d.getUTCMonth()+1) + '-' +\n              pad(_d.getUTCDate()) + '-' +\n              getUUID4();\n        return function(_base) {\n            var _n = (++ID_AUTO_INCREMENT).toString(16),\n                _uidbase = (typeof _base === \"undefined\" ? \"\" : _base + \"-\" );\n            while (_n.length < 4) { _n = '0' + _n; }\n            return _uidbase + ID_BASE + '-' + _n;\n        };\n    })(),\n    getFullURL : function(url) {\n\n        if(typeof(url) === 'undefined' || url == null ) {\n            return \"\";\n        }\n        if(/https?:\\/\\//.test(url)) {\n            return url;\n        }\n        var img = new Image();\n        img.src = url;\n        var res = img.src;\n        img.src = null;\n        return res;\n\n    },\n    inherit : function(_baseClass, _callbefore) {\n\n        var _class = function(_arg) {\n            if (typeof _callbefore === \"function\") {\n                _callbefore.apply(this, Array.prototype.slice.call(arguments, 0));\n            }\n            _baseClass.apply(this, Array.prototype.slice.call(arguments, 0));\n            if (typeof this._init === \"function\" && !this._initialized) {\n                this._init.apply(this, Array.prototype.slice.call(arguments, 0));\n                this._initialized = true;\n            }\n        };\n        _(_class.prototype).extend(_baseClass.prototype);\n\n        return _class;\n\n    },\n    regexpFromTextOrArray: (function() {\n        var charsub = [\n                '[aáàâä]',\n                '[cç]',\n                '[eéèêë]',\n                '[iíìîï]',\n                '[oóòôö]',\n                '[uùûü]'\n            ],\n            removeChars = [\n                String.fromCharCode(768), String.fromCharCode(769), String.fromCharCode(770), String.fromCharCode(771), String.fromCharCode(807),\n                \"{\", \"}\", \"(\", \")\", \"[\", \"]\", \"【\", \"】\", \"、\", \"・\", \"‥\", \"。\", \"「\", \"」\", \"『\", \"』\", \"〜\", \":\", \"!\", \"?\", \" \",\n                \",\", \" \", \";\", \"(\", \")\", \".\", \"*\", \"+\", \"\\\\\", \"?\", \"|\", \"{\", \"}\", \"[\", \"]\", \"^\", \"#\", \"/\"\n            ],\n            remsrc = \"[\\\\\" + removeChars.join(\"\\\\\") + \"]\",\n            remrx = new RegExp(remsrc, \"gm\"),\n            charsrx = _(charsub).map(function(c) {\n                return new RegExp(c);\n            });\n\n        function replaceText(_text) {\n            var txt = _text.toLowerCase().replace(remrx,\"\"), src = \"\";\n            function makeReplaceFunc(l) {\n              return function(k,v) {\n                l = l.replace(charsrx[k], v);\n              };\n            }\n            for (var j = 0; j < txt.length; j++) {\n                if (j) {\n                    src += remsrc + \"*\";\n                }\n                var l = txt[j];\n                _(charsub).each(makeReplaceFunc(l));\n                src += l;\n            }\n            return src;\n        }\n\n        function getSource(inp) {\n            switch (typeof inp) {\n                case \"string\":\n                    return replaceText(inp);\n                case \"object\":\n                    var src = '';\n                    _(inp).each(function(v) {\n                        var res = getSource(v);\n                        if (res) {\n                            if (src) {\n                                src += '|';\n                            }\n                            src += res;\n                        }\n                    });\n                    return src;\n            }\n            return '';\n        }\n\n        return function(_textOrArray) {\n            var source = getSource(_textOrArray);\n            if (source) {\n                var testrx = new RegExp( source, \"im\"),\n                    replacerx = new RegExp( '(' + source + ')', \"igm\");\n                return {\n                    isempty: false,\n                    source: source,\n                    test: function(_t) { return testrx.test(_t); },\n                    replace: function(_text, _replace) { return _text.replace(replacerx, _replace); }\n                };\n            } else {\n                return {\n                    isempty: true,\n                    source: '',\n                    test: function() { return true; },\n                    replace: function(_text) { return text; }\n                };\n            }\n        };\n    })(),\n    /* The minimum distance (in pixels) the mouse has to move to consider an element was dragged */\n    _MIN_DRAG_DISTANCE: 2,\n    /* Distance between the inner and outer radius of buttons that appear when hovering on a node */\n    _NODE_BUTTON_WIDTH: 40,\n\n    _EDGE_BUTTON_INNER: 2,\n    _EDGE_BUTTON_OUTER: 40,\n    /* Constants used to know if a specific action is to be performed when clicking on the canvas */\n    _CLICKMODE_ADDNODE: 1,\n    _CLICKMODE_STARTEDGE: 2,\n    _CLICKMODE_ENDEDGE: 3,\n    /* Node size step: Used to calculate the size change when clicking the +/- buttons */\n    _NODE_SIZE_STEP: Math.LN2/4,\n    _MIN_SCALE: 1/20,\n    _MAX_SCALE: 20,\n    _MOUSEMOVE_RATE: 80,\n    _DOUBLETAP_DELAY: 800,\n    /* Maximum distance in pixels (squared, to reduce calculations)\n     * between two taps when double-tapping on a touch terminal */\n    _DOUBLETAP_DISTANCE: 20*20,\n    /* A placeholder so a default colour is displayed when a node has a null value for its user property */\n    _USER_PLACEHOLDER: function(_renkan) {\n        return {\n            color: _renkan.options.default_user_color,\n            title: _renkan.translate(\"(unknown user)\"),\n            get: function(attr) {\n                return this[attr] || false;\n            }\n        };\n    },\n    /* The code for the \"Drag and Add Bookmarklet\", slightly minified and with whitespaces removed, though\n     * it doesn't seem that it's still a requirement in newer browsers (i.e. the ones compatibles with canvas drawing)\n     */\n    _BOOKMARKLET_CODE: function(_renkan) {\n        return \"(function(a,b,c,d,e,f,h,i,j,k,l,m,n,o,p,q,r){a=document;b=a.body;c=a.location.href;j='draggable';m='text/x-iri-';d=a.createElement('div');d.innerHTML='<p_style=\\\"position:fixed;top:0;right:0;font:bold_18px_sans-serif;color:#fff;background:#909;padding:10px;z-index:100000;\\\">\" +\n        _renkan.translate(\"Drag items from this website, drop them in Renkan\").replace(/ /g,\"_\") +\n        \"</p>'.replace(/_/g,String.fromCharCode(32));b.appendChild(d);e=[{r:/https?:\\\\/\\\\/[^\\\\/]*twitter\\\\.com\\\\//,s:'.tweet',n:'twitter'},{r:/https?:\\\\/\\\\/[^\\\\/]*google\\\\.[^\\\\/]+\\\\//,s:'.g',n:'google'},{r:/https?:\\\\/\\\\/[^\\\\/]*lemonde\\\\.fr\\\\//,s:'[data-vr-contentbox]',n:'lemonde'}];f=false;e.forEach(function(g){if(g.r.test(c)){f=g;}});if(f){h=function(){Array.prototype.forEach.call(a.querySelectorAll(f.s),function(i){i[j]=true;k=i.style;k.borderWidth='2px';k.borderColor='#909';k.borderStyle='solid';k.backgroundColor='rgba(200,0,180,.1)';})};window.setInterval(h,500);h();};a.addEventListener('dragstart',function(k){l=k.dataTransfer;l.setData(m+'source-uri',c);l.setData(m+'source-title',a.title);n=k.target;if(f){o=n;while(!o.attributes[j]){o=o.parentNode;if(o==b){break;}}}if(f&&o.attributes[j]){p=o.cloneNode(true);l.setData(m+'specific-site',f.n)}else{q=a.getSelection();if(q.type==='Range'||!q.type){p=q.getRangeAt(0).cloneContents();}else{p=n.cloneNode();}}r=a.createElement('div');r.appendChild(p);l.setData('text/x-iri-selected-text',r.textContent.trim());l.setData('text/x-iri-selected-html',r.innerHTML);},false);})();\";\n    },\n    /* Shortens text to the required length then adds ellipsis */\n    shortenText: function(_text, _maxlength) {\n        return (_text.length > _maxlength ? (_text.substr(0,_maxlength) + '…') : _text);\n    },\n    /* Drawing an edit box with an arrow and positioning the edit box according to the position of the node/edge being edited\n     * Called by Rkns.Renderer.NodeEditor and Rkns.Renderer.EdgeEditor */\n    drawEditBox: function(_options, _coords, _path, _xmargin, _selector) {\n        _selector.css({\n            width: ( _options.tooltip_width - 2* _options.tooltip_padding )\n        });\n        var _height = _selector.outerHeight() + 2* _options.tooltip_padding,\n        _isLeft = (_coords.x < paper.view.center.x ? 1 : -1),\n        _left = _coords.x + _isLeft * ( _xmargin + _options.tooltip_arrow_length ),\n        _right = _coords.x + _isLeft * ( _xmargin + _options.tooltip_arrow_length + _options.tooltip_width ),\n        _top = _coords.y - _height / 2;\n        if (_top + _height > (paper.view.size.height - _options.tooltip_margin)) {\n            _top = Math.max( paper.view.size.height - _options.tooltip_margin, _coords.y + _options.tooltip_arrow_width / 2 ) - _height;\n        }\n        if (_top < _options.tooltip_margin) {\n            _top = Math.min( _options.tooltip_margin, _coords.y - _options.tooltip_arrow_width / 2 );\n        }\n        var _bottom = _top + _height;\n        /* jshint laxbreak:true */\n        _path.segments[0].point\n          = _path.segments[7].point\n          = _coords.add([_isLeft * _xmargin, 0]);\n        _path.segments[1].point.x\n          = _path.segments[2].point.x\n          = _path.segments[5].point.x\n          = _path.segments[6].point.x\n          = _left;\n        _path.segments[3].point.x\n          = _path.segments[4].point.x\n          = _right;\n        _path.segments[2].point.y\n          = _path.segments[3].point.y\n          = _top;\n        _path.segments[4].point.y\n          = _path.segments[5].point.y\n          = _bottom;\n        _path.segments[1].point.y = _coords.y - _options.tooltip_arrow_width / 2;\n        _path.segments[6].point.y = _coords.y + _options.tooltip_arrow_width / 2;\n        _path.closed = true;\n        _path.fillColor = new paper.GradientColor(new paper.Gradient([_options.tooltip_top_color, _options.tooltip_bottom_color]), [0,_top], [0, _bottom]);\n        _selector.css({\n            left: (_options.tooltip_padding + Math.min(_left, _right)),\n            top: (_options.tooltip_padding + _top)\n        });\n        return _path;\n    }\n};\n})(window);\n\n/* END main.js */\n","(function() {\n    \"use strict\";\n    var root = this;\n\n    var Backbone = root.Backbone;\n\n    var Models = root.Rkns.Models = {};\n\n    Models.getUID = function(obj) {\n        var guid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,\n                function(c) {\n                    var r = Math.random() * 16 | 0, v = c === 'x' ? r\n                            : (r & 0x3 | 0x8);\n                    return v.toString(16);\n                });\n        if (typeof obj !== 'undefined') {\n            return obj.type + \"-\" + guid;\n        }\n        else {\n            return guid;\n        }\n    };\n\n    var RenkanModel = Backbone.RelationalModel.extend({\n        idAttribute : \"_id\",\n        constructor : function(options) {\n\n            if (typeof options !== \"undefined\") {\n                options._id = options._id || options.id || Models.getUID(this);\n                options.title = options.title || \"\";\n                options.description = options.description || \"\";\n                options.uri = options.uri || \"\";\n\n                if (typeof this.prepare === \"function\") {\n                    options = this.prepare(options);\n                }\n            }\n            Backbone.RelationalModel.prototype.constructor.call(this, options);\n        },\n        validate : function() {\n            if (!this.type) {\n                return \"object has no type\";\n            }\n        },\n        addReference : function(_options, _propName, _list, _id, _default) {\n            var _element = _list.get(_id);\n            if (typeof _element === \"undefined\" &&\n                typeof _default !== \"undefined\") {\n                _options[_propName] = _default;\n            }\n            else {\n                _options[_propName] = _element;\n            }\n        }\n    });\n\n    // USER\n    var User = Models.User = RenkanModel.extend({\n        type : \"user\",\n        prepare : function(options) {\n            options.color = options.color || \"#666666\";\n            return options;\n        },\n        toJSON : function() {\n            return {\n                _id : this.get(\"_id\"),\n                title : this.get(\"title\"),\n                uri : this.get(\"uri\"),\n                description : this.get(\"description\"),\n                color : this.get(\"color\")\n            };\n        }\n    });\n\n    // NODE\n    var Node = Models.Node = RenkanModel.extend({\n        type : \"node\",\n        relations : [ {\n            type : Backbone.HasOne,\n            key : \"created_by\",\n            relatedModel : User\n        } ],\n        prepare : function(options) {\n            var project = options.project;\n            this.addReference(options, \"created_by\", project.get(\"users\"),\n                    options.created_by, project.current_user);\n            options.description = options.description || \"\";\n            return options;\n        },\n        toJSON : function() {\n            return {\n                _id : this.get(\"_id\"),\n                title : this.get(\"title\"),\n                uri : this.get(\"uri\"),\n                description : this.get(\"description\"),\n                position : this.get(\"position\"),\n                image : this.get(\"image\"),\n                color : this.get(\"color\"),\n                created_by : this.get(\"created_by\") ? this.get(\"created_by\")\n                        .get(\"_id\") : null,\n                size : this.get(\"size\"),\n                clip_path : this.get(\"clip_path\"),\n                shape : this.get(\"shape\")\n            };\n        }\n    });\n\n    // EDGE\n    var Edge = Models.Edge = RenkanModel.extend({\n        type : \"edge\",\n        relations : [ {\n            type : Backbone.HasOne,\n            key : \"created_by\",\n            relatedModel : User\n        }, {\n            type : Backbone.HasOne,\n            key : \"from\",\n            relatedModel : Node\n        }, {\n            type : Backbone.HasOne,\n            key : \"to\",\n            relatedModel : Node\n        } ],\n        prepare : function(options) {\n            var project = options.project;\n            this.addReference(options, \"created_by\", project.get(\"users\"),\n                    options.created_by, project.current_user);\n            this.addReference(options, \"from\", project.get(\"nodes\"),\n                    options.from);\n            this.addReference(options, \"to\", project.get(\"nodes\"), options.to);\n            return options;\n        },\n        toJSON : function() {\n            return {\n                _id : this.get(\"_id\"),\n                title : this.get(\"title\"),\n                uri : this.get(\"uri\"),\n                description : this.get(\"description\"),\n                from : this.get(\"from\") ? this.get(\"from\").get(\"_id\") : null,\n                to : this.get(\"to\") ? this.get(\"to\").get(\"_id\") : null,\n                color : this.get(\"color\"),\n                created_by : this.get(\"created_by\") ? this.get(\"created_by\")\n                        .get(\"_id\") : null\n            };\n        }\n    });\n\n    // View\n    var View = Models.View = RenkanModel.extend({\n        type : \"view\",\n        relations : [ {\n            type : Backbone.HasOne,\n            key : \"created_by\",\n            relatedModel : User\n        } ],\n        prepare : function(options) {\n            var project = options.project;\n            this.addReference(options, \"created_by\", project.get(\"users\"),\n                    options.created_by, project.current_user);\n            options.description = options.description || \"\";\n            if (typeof options.offset !== \"undefined\") {\n                var offset = {};\n                if (Array.isArray(options.offset)) {\n                    offset.x = options.offset[0];\n                    offset.y = options.offset.length > 1 ? options.offset[1]\n                            : options.offset[0];\n                }\n                else if (options.offset.x != null) {\n                    offset.x = options.offset.x;\n                    offset.y = options.offset.y;\n                }\n                options.offset = offset;\n            }\n            return options;\n        },\n        toJSON : function() {\n            return {\n                _id : this.get(\"_id\"),\n                zoom_level : this.get(\"zoom_level\"),\n                offset : this.get(\"offset\"),\n                title : this.get(\"title\"),\n                description : this.get(\"description\"),\n                created_by : this.get(\"created_by\") ? this.get(\"created_by\")\n                        .get(\"_id\") : null\n            // Don't need project id\n            };\n        }\n    });\n\n    // PROJECT\n    var Project = Models.Project = RenkanModel.extend({\n        type : \"project\",\n        blacklist : [ 'save_status', ],\n        relations : [ {\n            type : Backbone.HasMany,\n            key : \"users\",\n            relatedModel : User,\n            reverseRelation : {\n                key : 'project',\n                includeInJSON : '_id'\n            }\n        }, {\n            type : Backbone.HasMany,\n            key : \"nodes\",\n            relatedModel : Node,\n            reverseRelation : {\n                key : 'project',\n                includeInJSON : '_id'\n            }\n        }, {\n            type : Backbone.HasMany,\n            key : \"edges\",\n            relatedModel : Edge,\n            reverseRelation : {\n                key : 'project',\n                includeInJSON : '_id'\n            }\n        }, {\n            type : Backbone.HasMany,\n            key : \"views\",\n            relatedModel : View,\n            reverseRelation : {\n                key : 'project',\n                includeInJSON : '_id'\n            }\n        } ],\n        addUser : function(_props, _options) {\n            _props.project = this;\n            var _user = User.findOrCreate(_props);\n            this.get(\"users\").push(_user, _options);\n            return _user;\n        },\n        addNode : function(_props, _options) {\n            _props.project = this;\n            var _node = Node.findOrCreate(_props);\n            this.get(\"nodes\").push(_node, _options);\n            return _node;\n        },\n        addEdge : function(_props, _options) {\n            _props.project = this;\n            var _edge = Edge.findOrCreate(_props);\n            this.get(\"edges\").push(_edge, _options);\n            return _edge;\n        },\n        addView : function(_props, _options) {\n            _props.project = this;\n            // TODO: check if need to replace with create only\n            var _view = View.findOrCreate(_props);\n            // TODO: Should we remember only one view?\n            this.get(\"views\").push(_view, _options);\n            return _view;\n        },\n        removeNode : function(_model) {\n            this.get(\"nodes\").remove(_model);\n        },\n        removeEdge : function(_model) {\n            this.get(\"edges\").remove(_model);\n        },\n        validate : function(options) {\n            var _project = this;\n            _(\n                    [].concat(options.users, options.nodes, options.edges,\n                            options.views)).each(function(_item) {\n                if (_item) {\n                    _item.project = _project;\n                }\n            });\n        },\n        // Add event handler to remove edges when a node is removed\n        initialize : function() {\n            var _this = this;\n            this.on(\"remove:nodes\", function(_node) {\n                _this.get(\"edges\").remove(\n                        _this.get(\"edges\").filter(\n                                function(_edge) {\n                                    return _edge.get(\"from\") === _node ||\n                                           _edge.get(\"to\") === _node;\n                                }));\n            });\n        },\n        toJSON : function() {\n            var json = _.clone(this.attributes);\n            for ( var attr in json) {\n                if ((json[attr] instanceof Backbone.Model) ||\n                        (json[attr] instanceof Backbone.Collection) ||\n                        (json[attr] instanceof RenkanModel)) {\n                    json[attr] = json[attr].toJSON();\n                }\n            }\n            return _.omit(json, this.blacklist);\n        }\n    });\n\n    var RosterUser = Models.RosterUser = Backbone.Model\n            .extend({\n                type : \"roster_user\",\n                idAttribute : \"_id\",\n\n                constructor : function(options) {\n\n                    if (typeof options !== \"undefined\") {\n                        options._id = options._id ||\n                            options.id ||\n                            Models.getUID(this);\n                        options.title = options.title || \"(untitled \" + this.type + \")\";\n                        options.description = options.description || \"\";\n                        options.uri = options.uri || \"\";\n                        options.project = options.project || null;\n                        options.site_id = options.site_id || 0;\n\n                        if (typeof this.prepare === \"function\") {\n                            options = this.prepare(options);\n                        }\n                    }\n                    Backbone.Model.prototype.constructor.call(this, options);\n                },\n\n                validate : function() {\n                    if (!this.type) {\n                        return \"object has no type\";\n                    }\n                },\n\n                prepare : function(options) {\n                    options.color = options.color || \"#666666\";\n                    return options;\n                },\n\n                toJSON : function() {\n                    return {\n                        _id : this.get(\"_id\"),\n                        title : this.get(\"title\"),\n                        uri : this.get(\"uri\"),\n                        description : this.get(\"description\"),\n                        color : this.get(\"color\"),\n                        project : (this.get(\"project\") != null) ? this.get(\n                                \"project\").get(\"id\") : null,\n                        site_id : this.get(\"site_id\")\n                    };\n                }\n            });\n\n    var UsersList = Models.UsersList = Backbone.Collection.extend({\n        model : RosterUser\n    });\n\n}).call(window);\n","Rkns.defaults = {\n\n    language: (navigator.language || navigator.userLanguage || \"en\"),\n        /* GUI Language */\n    container: \"renkan\",\n        /* GUI Container DOM element ID */\n    search: [],\n        /* List of Search Engines */\n    bins: [],\n           /* List of Bins */\n    static_url: \"\",\n        /* URL for static resources */\n    show_bins: true,\n        /* Show bins in left column */\n    properties: [],\n        /* Semantic properties for edges */\n    show_editor: true,\n        /* Show the graph editor... Setting this to \"false\" only shows the bins part ! */\n    read_only: false,\n        /* Allows editing of renkan without changing the rest of the GUI. Can be switched on/off on the fly to block/enable editing */\n    editor_mode: true,\n        /* Switch for Publish/Edit GUI. If editor_mode is false, read_only will be true.  */\n    manual_save: false,\n        /* In snapshot mode, clicking on the floppy will save a snapshot. Otherwise, it will show the connection status */\n    show_top_bar: true,\n        /* Show the top bar, (title, buttons, users) */\n    default_user_color: \"#303030\",\n    size_bug_fix: true,\n        /* Resize the canvas after load (fixes a bug on iPad and FF Mac) */\n    force_resize: false,\n    allow_double_click: true,\n        /* Allows Double Click to create a node on an empty background */\n    zoom_on_scroll: true,\n        /* Allows to use the scrollwheel to zoom */\n    element_delete_delay: 0,\n        /* Delay between clicking on the bin on an element and really deleting it\n           Set to 0 for delete confirm */\n    autoscale_padding: 50,\n    resize: true,\n    \n    /* zoom options */\n    show_zoom: true,\n        /* show zoom buttons */\n    save_view: true,\n        /* show buttons to save view */\n    default_view: false,\n        /* Allows to load default view (zoom+offset) at start on read_only mode, instead of autoScale. the default_view will be the last */\n    \n    \n    /* TOP BAR BUTTONS */\n    show_search_field: true,\n    show_user_list: true,\n    user_name_editable: true,\n    user_color_editable: true,\n    show_user_color: true,\n    show_save_button: true,\n    show_export_button: true,\n    show_open_button: false,\n    show_addnode_button: true,\n    show_addedge_button: true,\n    show_bookmarklet: true,\n    show_fullscreen_button: true,\n    home_button_url: false,\n    home_button_title: \"Home\",\n\n    /* MINI-MAP OPTIONS */\n\n    show_minimap: true,\n        /* Show a small map at the bottom right */\n    minimap_width: 160,\n    minimap_height: 120,\n    minimap_padding: 20,\n    minimap_background_color: \"#ffffff\",\n    minimap_border_color: \"#cccccc\",\n    minimap_highlight_color: \"#ffff00\",\n    minimap_highlight_weight: 5,\n    \n\n    /* EDGE/NODE COMMON OPTIONS */\n\n    buttons_background: \"#202020\",\n    buttons_label_color: \"#c000c0\",\n    buttons_label_font_size: 9,\n\n    /* NODE DISPLAY OPTIONS */\n\n    show_node_circles: true,\n        /* Show circles for nodes */\n    clip_node_images: true,\n        /* Constraint node images to circles */\n    node_images_fill_mode: false,\n        /* Set to false for \"letterboxing\" (height/width of node adapted to show full image)\n           Set to true for \"crop\" (adapted to fill circle) */\n    node_size_base: 25,\n    node_stroke_width: 2,\n    selected_node_stroke_width: 4,\n    node_fill_color: \"#ffffff\",\n    highlighted_node_fill_color: \"#ffff00\",\n    node_label_distance: 5,\n        /* Vertical distance between node and label */\n    node_label_max_length: 60,\n        /* Maximum displayed text length */\n    label_untitled_nodes: \"(untitled)\",\n        /* Label to display on untitled nodes */\n    change_shapes: true,\n        /* Change shapes enabled */\n\n    /* EDGE DISPLAY OPTIONS */\n\n    edge_stroke_width: 2,\n    selected_edge_stroke_width: 4,\n    edge_label_distance: 0,\n    edge_label_max_length: 20,\n    edge_arrow_length: 18,\n    edge_arrow_width: 12,\n    edge_gap_in_bundles: 12,\n    label_untitled_edges: \"\",\n\n    /* CONTEXTUAL DISPLAY (TOOLTIP OR EDITOR) OPTIONS */\n\n    tooltip_width: 275,\n    tooltip_padding: 10,\n    tooltip_margin: 15,\n    tooltip_arrow_length : 20,\n    tooltip_arrow_width : 40,\n    tooltip_top_color: \"#f0f0f0\",\n    tooltip_bottom_color: \"#d0d0d0\",\n    tooltip_border_color: \"#808080\",\n    tooltip_border_width: 1,\n\n    /* NODE EDITOR OPTIONS */\n\n    show_node_editor_uri: true,\n    show_node_editor_description: true,\n    show_node_editor_size: true,\n    show_node_editor_color: true,\n    show_node_editor_image: true,\n    show_node_editor_creator: true,\n    allow_image_upload: true,\n    uploaded_image_max_kb: 500,\n\n    /* NODE TOOLTIP OPTIONS */\n\n    show_node_tooltip_uri: true,\n    show_node_tooltip_description: true,\n    show_node_tooltip_color: true,\n    show_node_tooltip_image: true,\n    show_node_tooltip_creator: true,\n\n    /* EDGE EDITOR OPTIONS */\n\n    show_edge_editor_uri: true,\n    show_edge_editor_color: true,\n    show_edge_editor_direction: true,\n    show_edge_editor_nodes: true,\n    show_edge_editor_creator: true,\n\n    /* EDGE TOOLTIP OPTIONS */\n\n    show_edge_tooltip_uri: true,\n    show_edge_tooltip_color: true,\n    show_edge_tooltip_nodes: true,\n    show_edge_tooltip_creator: true\n\n    /* */\n\n};\n","Rkns.i18n = {\n    fr: {\n        \"Edit Node\": \"Édition d’un nœud\",\n        \"Edit Edge\": \"Édition d’un lien\",\n        \"Title:\": \"Titre :\",\n        \"URI:\": \"URI :\",\n        \"Description:\": \"Description :\",\n        \"From:\": \"De :\",\n        \"To:\": \"Vers :\",\n        \"Image\": \"Image\",\n        \"Image URL:\": \"URL d'Image\",\n        \"Choose Image File:\": \"Choisir un fichier image\",\n        \"Full Screen\": \"Mode plein écran\",\n        \"Add Node\": \"Ajouter un nœud\",\n        \"Add Edge\": \"Ajouter un lien\",\n        \"Save Project\": \"Enregistrer le projet\",\n        \"Open Project\": \"Ouvrir un projet\",\n        \"Auto-save enabled\": \"Enregistrement automatique activé\",\n        \"Connection lost\": \"Connexion perdue\",\n        \"Created by:\": \"Créé par :\",\n        \"Zoom In\": \"Agrandir l’échelle\",\n        \"Zoom Out\": \"Rapetisser l’échelle\",\n        \"Edit\": \"Éditer\",\n        \"Remove\": \"Supprimer\",\n        \"Cancel deletion\": \"Annuler la suppression\",\n        \"Link to another node\": \"Créer un lien\",\n        \"Enlarge\": \"Agrandir\",\n        \"Shrink\": \"Rétrécir\",\n        \"Click on the background canvas to add a node\": \"Cliquer sur le fond du graphe pour rajouter un nœud\",\n        \"Click on a first node to start the edge\": \"Cliquer sur un premier nœud pour commencer le lien\",\n        \"Click on a second node to complete the edge\": \"Cliquer sur un second nœud pour terminer le lien\",\n        \"Wikipedia\": \"Wikipédia\",\n        \"Wikipedia in \": \"Wikipédia en \",\n        \"French\": \"Français\",\n        \"English\": \"Anglais\",\n        \"Japanese\": \"Japonais\",\n        \"Untitled project\": \"Projet sans titre\",\n        \"Lignes de Temps\": \"Lignes de Temps\",\n        \"Loading, please wait\": \"Chargement en cours, merci de patienter\",\n        \"Edge color:\": \"Couleur :\",\n        \"Node color:\": \"Couleur :\",\n        \"Choose color\": \"Choisir une couleur\",\n        \"Change edge direction\": \"Changer le sens du lien\",\n        \"Do you really wish to remove node \": \"Voulez-vous réellement supprimer le nœud \",\n        \"Do you really wish to remove edge \": \"Voulez-vous réellement supprimer le lien \",\n        \"This file is not an image\": \"Ce fichier n'est pas une image\",\n        \"Image size must be under \": \"L'image doit peser moins de \",\n        \"Size:\": \"Taille :\",\n        \"KB\": \"ko\",\n        \"Choose from vocabulary:\": \"Choisir dans un vocabulaire :\",\n        \"SKOS Documentation properties\": \"SKOS: Propriétés documentaires\",\n        \"has note\": \"a pour note\",\n        \"has example\": \"a pour exemple\",\n        \"has definition\": \"a pour définition\",\n        \"SKOS Semantic relations\": \"SKOS: Relations sémantiques\",\n        \"has broader\": \"a pour concept plus large\",\n        \"has narrower\": \"a pour concept plus étroit\",\n        \"has related\": \"a pour concept apparenté\",\n        \"Dublin Core Metadata\": \"Métadonnées Dublin Core\",\n        \"has contributor\": \"a pour contributeur\",\n        \"covers\": \"couvre\",\n        \"created by\": \"créé par\",\n        \"has date\": \"a pour date\",\n        \"published by\": \"édité par\",\n        \"has source\": \"a pour source\",\n        \"has subject\": \"a pour sujet\",\n        \"Dragged resource\": \"Ressource glisée-déposée\",\n        \"Search the Web\": \"Rechercher en ligne\",\n        \"Search in Bins\": \"Rechercher dans les chutiers\",\n        \"Close bin\": \"Fermer le chutier\",\n        \"Refresh bin\": \"Rafraîchir le chutier\",\n        \"(untitled)\": \"(sans titre)\",\n        \"Select contents:\": \"Sélectionner des contenus :\",\n        \"Drag items from this website, drop them in Renkan\": \"Glissez des éléments de ce site web vers Renkan\",\n        \"Drag this button to your bookmark bar. When on a third-party website, click it to enable drag-and-drop from the website to Renkan.\": \"Glissez ce bouton vers votre barre de favoris. Ensuite, depuis un site tiers, cliquez dessus pour activer 'Drag-to-Add' puis glissez des éléments de ce site vers Renkan\",\n        \"Shapes available\": \"Formes disponibles\",\n        \"Circle\": \"Cercle\",\n        \"Square\": \"Carré\",\n        \"Diamond\": \"Losange\",\n        \"Hexagone\": \"Hexagone\",\n        \"Ellipse\": \"Ellipse\",\n        \"Star\": \"Étoile\",\n        \"Zoom Fit\": \"Ajuster le Zoom\",\n        \"Download Project\": \"Télécharger le projet\",\n        \"Zoom Save\": \"Sauver le Zoom\",\n        \"View saved zoom\": \"Restaurer le Zoom\",\n        \"Renkan \\'Drag-to-Add\\' bookmarklet\": \"Renkan \\'Deplacer-Pour-Ajouter\\' Signet\",\n        \"(unknown user)\":\"(non authentifié)\",\n        \"<unknown user>\":\"<non authentifié>\",\n        \"Search in graph\":\"Rechercher dans carte\",\n        \"Search in \" : \"Chercher dans \"\n    }\n};\n","/* Saves the Full JSON at each modification */\n\nRkns.jsonIO = function(_renkan, _opts) {\n    var _proj = _renkan.project;\n    if (typeof _opts.http_method === \"undefined\") {\n        _opts.http_method = 'PUT';\n    }\n    var _load = function() {\n        _renkan.renderer.redrawActive = false;\n        _proj.set({\n            loading_status : true\n        });\n        Rkns.$.getJSON(_opts.url, function(_data) {\n            _proj.set(_data, {\n                validate : true\n            });\n            _proj.set({\n                loading_status : false\n            });\n            _proj.set({\n                save_status : 0\n            });\n            _renkan.renderer.redrawActive = true;\n            _renkan.renderer.fixSize();\n        });\n    };\n    var _save = function() {\n        _proj.set({\n            save_status : 2\n        });\n        var _data = _proj.toJSON();\n        if (!_renkan.read_only) {\n            Rkns.$.ajax({\n                type : _opts.http_method,\n                url : _opts.url,\n                contentType : \"application/json\",\n                data : JSON.stringify(_data),\n                success : function(data, textStatus, jqXHR) {\n                    _proj.set({\n                        save_status : 0\n                    });\n                }\n            });\n        }\n\n    };\n    var _thrSave = Rkns._.throttle(function() {\n        setTimeout(_save, 100);\n    }, 1000);\n    _proj.on(\"add:nodes add:edges add:users add:views\", function(_model) {\n        _model.on(\"change remove\", function(_model) {\n            _thrSave();\n        });\n        _thrSave();\n    });\n    _proj.on(\"change\", function() {\n        if (!(_proj.changedAttributes.length === 1 && _proj\n                .hasChanged('save_status'))) {\n            _thrSave();\n        }\n    });\n\n    _load();\n};\n","/* Saves the Full JSON once */\n\nRkns.jsonIOSaveOnClick = function(_renkan, _opts) {\n    var _proj = _renkan.project,\n        _saveWarn = false,\n        _onLeave = function() {\n            return \"Project not saved\";\n        };\n    if (typeof _opts.http_method === \"undefined\") {\n        _opts.http_method = 'POST';\n    }\n    var _load = function() {\n        var getdata = {},\n            rx = /id=([^&#?=]+)/,\n            matches = document.location.hash.match(rx);\n        if (matches) {\n            getdata.id = matches[1];\n        }\n        Rkns.$.ajax({\n            url: _opts.url,\n            data: getdata,\n            beforeSend: function(){\n            \t_proj.set({loading_status:true});\n            },\n            success: function(_data) {\n                _proj.set(_data, {validate: true});\n            \t_proj.set({loading_status:false});\n                _proj.set({save_status:0});\n            \t_renkan.renderer.autoScale();\n            }\n        });\n    };\n    var _save = function() {\n        _proj.set(\"saved_at\", new Date());\n        var _data = _proj.toJSON();\n        Rkns.$.ajax({\n            type: _opts.http_method,\n            url: _opts.url,\n            contentType: \"application/json\",\n            data: JSON.stringify(_data),\n            beforeSend: function(){\n            \t_proj.set({save_status:2});\n            },\n            success: function(data, textStatus, jqXHR) {\n                $(window).off(\"beforeunload\", _onLeave);\n                _saveWarn = false;\n                _proj.set({save_status:0});\n                //document.location.hash = \"#id=\" + data.id;\n                //$(\".Rk-Notifications\").text(\"Saved as \"+document.location.href).fadeIn().delay(2000).fadeOut();\n            }\n        });\n    };\n    var _checkLeave = function() {\n    \t_proj.set({save_status:1});\n    \t\n        var title = _proj.get(\"title\");\n        if (title && _proj.get(\"nodes\").length) {\n            $(\".Rk-Save-Button\").removeClass(\"disabled\");\n        } else {\n            $(\".Rk-Save-Button\").addClass(\"disabled\");\n        }\n        if (title) {\n            $(\".Rk-PadTitle\").css(\"border-color\",\"#333333\");\n        }\n        if (!_saveWarn) {\n            _saveWarn = true;\n            $(window).on(\"beforeunload\", _onLeave);\n        }\n    };\n    _load();\n    _proj.on(\"add:nodes add:edges add:users change\", function(_model) {\n\t    _model.on(\"change remove\", function(_model) {\n\t    \tif(!(_model.changedAttributes.length === 1 && _model.hasChanged('save_status'))) {\n\t    \t\t_checkLeave();\n\t    \t}\n\t    });\n\t\tif(!(_proj.changedAttributes.length === 1 && _proj.hasChanged('save_status'))) {\n\t\t    _checkLeave();\n    \t}\n    });\n    _renkan.renderer.save = function() {\n        if ($(\".Rk-Save-Button\").hasClass(\"disabled\")) {\n            if (!_proj.get(\"title\")) {\n                $(\".Rk-PadTitle\").css(\"border-color\",\"#ff0000\");\n            }\n        } else {\n            _save();\n        }\n    };\n};\n","(function(Rkns) {\n\"use strict\";\n\nvar _ = Rkns._;\n\nvar Ldt = Rkns.Ldt = {};\n\nvar Bin = Ldt.Bin = function(_renkan, _opts) {\n    if (_opts.ldt_type) {\n        var Resclass = Ldt[_opts.ldt_type+\"Bin\"];\n        if (Resclass) {\n            return new Resclass(_renkan, _opts);\n        }\n    }\n    console.error(\"No such LDT Bin Type\");\n};\n\nvar ProjectBin = Ldt.ProjectBin = Rkns.Utils.inherit(Rkns._BaseBin);\n\nProjectBin.prototype.tagTemplate = renkanJST['templates/ldtjson-bin/tagtemplate.html'];\n\nProjectBin.prototype.annotationTemplate = renkanJST['templates/ldtjson-bin/annotationtemplate.html'];\n\nProjectBin.prototype._init = function(_renkan, _opts) {\n    this.renkan = _renkan;\n    this.proj_id = _opts.project_id;\n    this.ldt_platform = _opts.ldt_platform || \"http://ldt.iri.centrepompidou.fr/\";\n    this.title_$.html(_opts.title);\n    this.title_icon_$.addClass('Rk-Ldt-Title-Icon');\n    this.refresh();\n};\n\nProjectBin.prototype.render = function(searchbase) {\n    var search = searchbase || Rkns.Utils.regexpFromTextOrArray();\n    function highlight(_text) {\n        var _e = _(_text).escape();\n        return search.isempty ? _e : search.replace(_e, \"<span class='searchmatch'>$1</span>\");\n    }\n    function convertTC(_ms) {\n        function pad(_n) {\n            var _res = _n.toString();\n            while (_res.length < 2) {\n                _res = '0' + _res;\n            }\n            return _res;\n        }\n        var _totalSeconds = Math.abs(Math.floor(_ms/1000)),\n            _hours = Math.floor(_totalSeconds / 3600),\n            _minutes = (Math.floor(_totalSeconds / 60) % 60),\n            _seconds = _totalSeconds % 60,\n            _res = '';\n        if (_hours) {\n            _res += pad(_hours) + ':';\n        }\n        _res += pad(_minutes) + ':' + pad(_seconds);\n        return _res;\n    }\n\n    var _html = '<li><h3>Tags</h3></li>',\n        _projtitle = this.data.meta[\"dc:title\"],\n        _this = this,\n        count = 0;\n    _this.title_$.text('LDT Project: \"' + _projtitle + '\"');\n    _(_this.data.tags).map(function(_tag) {\n        var _title = _tag.meta[\"dc:title\"];\n        if (!search.isempty && !search.test(_title)) {\n            return;\n        }\n        count++;\n        _html += _this.tagTemplate({\n            ldt_platform: _this.ldt_platform,\n            title: _title,\n            htitle: highlight(_title),\n            encodedtitle : encodeURIComponent(_title),\n            static_url: _this.renkan.options.static_url\n        });\n    });\n    _html += '<li><h3>Annotations</h3></li>';\n    _(_this.data.annotations).map(function(_annotation) {\n        var _description = _annotation.content.description,\n            _title = _annotation.content.title.replace(_description,\"\");\n        if (!search.isempty && !search.test(_title) && !search.test(_description)) {\n            return;\n        }\n        count++;\n        var _duration = _annotation.end - _annotation.begin,\n            _img = (\n                (_annotation.content && _annotation.content.img && _annotation.content.img.src) ?\n                  _annotation.content.img.src :\n                  ( _duration ? _this.renkan.options.static_url+\"img/ldt-segment.png\" : _this.renkan.options.static_url+\"img/ldt-point.png\" )\n            );\n        _html += _this.annotationTemplate({\n            ldt_platform: _this.ldt_platform,\n            title: _title,\n            htitle: highlight(_title),\n            description: _description,\n            hdescription: highlight(_description),\n            start: convertTC(_annotation.begin),\n            end: convertTC(_annotation.end),\n            duration: convertTC(_duration),\n            mediaid: _annotation.media,\n            annotationid: _annotation.id,\n            image: _img,\n            static_url: _this.renkan.options.static_url\n        });\n    });\n\n    this.main_$.html(_html);\n    if (!search.isempty && count) {\n        this.count_$.text(count).show();\n    } else {\n        this.count_$.hide();\n    }\n    if (!search.isempty && !count) {\n        this.$.hide();\n    } else {\n        this.$.show();\n    }\n    this.renkan.resizeBins();\n};\n\nProjectBin.prototype.refresh = function() {\n    var _this = this;\n    Rkns.$.ajax({\n        url: this.ldt_platform + 'ldtplatform/ldt/cljson/id/' + this.proj_id,\n        dataType: \"jsonp\",\n        success: function(_data) {\n            _this.data = _data;\n            _this.render();\n        }\n    });\n};\n\nvar Search = Ldt.Search = function(_renkan, _opts) {\n    this.renkan = _renkan;\n    this.lang = _opts.lang || \"en\";\n};\n\nSearch.prototype.getBgClass = function() {\n    return \"Rk-Ldt-Icon\";\n};\n\nSearch.prototype.getSearchTitle = function() {\n    return this.renkan.translate(\"Lignes de Temps\");\n};\n\nSearch.prototype.search = function(_q) {\n    this.renkan.tabs.push(\n        new ResultsBin(this.renkan, {\n            search: _q\n        })\n    );\n};\n\nvar ResultsBin = Ldt.ResultsBin = Rkns.Utils.inherit(Rkns._BaseBin);\n\nResultsBin.prototype.segmentTemplate = renkanJST['templates/ldtjson-bin/segmenttemplate.html'];\n\nResultsBin.prototype._init = function(_renkan, _opts) {\n    this.renkan = _renkan;\n    this.ldt_platform = _opts.ldt_platform || \"http://ldt.iri.centrepompidou.fr/\";\n    this.max_results = _opts.max_results || 50;\n    this.search = _opts.search;\n    this.title_$.html('Lignes de Temps: \"' + _opts.search + '\"');\n    this.title_icon_$.addClass('Rk-Ldt-Title-Icon');\n    this.refresh();\n};\n\nResultsBin.prototype.render = function(searchbase) {\n    if (!this.data) {\n        return;\n    }\n    var search = searchbase || Rkns.Utils.regexpFromTextOrArray();\n    var highlightrx = (search.isempty ? Rkns.Utils.regexpFromTextOrArray(this.search) : search);\n    function highlight(_text) {\n        return highlightrx.replace(_(_text).escape(), \"<span class='searchmatch'>$1</span>\");\n    }\n    function convertTC(_ms) {\n        function pad(_n) {\n            var _res = _n.toString();\n            while (_res.length < 2) {\n                _res = '0' + _res;\n            }\n            return _res;\n        }\n        var _totalSeconds = Math.abs(Math.floor(_ms/1000)),\n            _hours = Math.floor(_totalSeconds / 3600),\n            _minutes = (Math.floor(_totalSeconds / 60) % 60),\n            _seconds = _totalSeconds % 60,\n            _res = '';\n        if (_hours) {\n            _res += pad(_hours) + ':';\n        }\n        _res += pad(_minutes) + ':' + pad(_seconds);\n        return _res;\n    }\n\n    var _html = '',\n        _this = this,\n        count = 0;\n    _(this.data.objects).each(function(_segment) {\n        var _description = _segment.abstract,\n            _title = _segment.title;\n        if (!search.isempty && !search.test(_title) && !search.test(_description)) {\n            return;\n        }\n        count++;\n        var _duration = _segment.duration,\n            _begin = _segment.start_ts,\n            _end = + _segment.duration + _begin,\n            _img = (\n                _duration ?\n                  _this.renkan.options.static_url + \"img/ldt-segment.png\" :\n                  _this.renkan.options.static_url + \"img/ldt-point.png\"\n            );\n        _html += _this.segmentTemplate({\n            ldt_platform: _this.ldt_platform,\n            title: _title,\n            htitle: highlight(_title),\n            description: _description,\n            hdescription: highlight(_description),\n            start: convertTC(_begin),\n            end: convertTC(_end),\n            duration: convertTC(_duration),\n            mediaid: _segment.iri_id,\n            //projectid: _segment.project_id,\n            //cuttingid: _segment.cutting_id,\n            annotationid: _segment.element_id,\n            image: _img\n        });\n    });\n\n    this.main_$.html(_html);\n    if (!search.isempty && count) {\n        this.count_$.text(count).show();\n    } else {\n        this.count_$.hide();\n    }\n    if (!search.isempty && !count) {\n        this.$.hide();\n    } else {\n        this.$.show();\n    }\n    this.renkan.resizeBins();\n};\n\nResultsBin.prototype.refresh = function() {\n    var _this = this;\n    Rkns.$.ajax({\n        url: this.ldt_platform + 'ldtplatform/api/ldt/1.0/segments/search/',\n        data: {\n            format: \"jsonp\",\n            q: this.search,\n            limit: this.max_results\n        },\n        dataType: \"jsonp\",\n        success: function(_data) {\n            _this.data = _data;\n            _this.render();\n        }\n    });\n};\n\n})(window.Rkns);\n","Rkns.ResourceList = {};\n\nRkns.ResourceList.Bin = Rkns.Utils.inherit(Rkns._BaseBin);\n\nRkns.ResourceList.Bin.prototype.resultTemplate = Rkns._.template(\n    '<li class=\"Rk-Bin-Item Rk-ResourceList-Item\" draggable=\"true\" data-uri=\"<%-url%>\" ' +\n    'data-title=\"<%-title%>\" data-description=\"<%-description%>\" ' +\n    '<% if (image) { %>data-image=\"<%- Rkns.Utils.getFullURL(image) %>\"<% } else { %>data-image=\"\"<% } %> >' +\n    '<% if (image) { %><img class=\"Rk-ResourceList-Image\" src=\"<%-image%>\"/><% } %><h4 class=\"Rk-ResourceList-Title\">' +\n    '<% if (url) { %><a href=\"<%-url%>\" target=\"_blank\"><% } %><%=htitle%><% if (url) { %></a><% } %></h4>' +\n    '<% if (description) { %><p class=\"Rk-ResourceList-Description\"><%=hdescription%></p><% } %><% if (image) { %><div style=\"clear: both;\"></div><% } %></li>'\n);\n\nRkns.ResourceList.Bin.prototype._init = function(_renkan, _opts) {\n    this.renkan = _renkan;\n    this.title_$.html(_opts.title);\n    if (_opts.list) {\n        this.data = _opts.list;\n    }\n    this.refresh();\n};\n\nRkns.ResourceList.Bin.prototype.render = function(searchbase) {\n    var search = searchbase || Rkns.Utils.regexpFromTextOrArray();\n    function highlight(_text) {\n        var _e = _(_text).escape();\n        return search.isempty ? _e : search.replace(_e, \"<span class='searchmatch'>$1</span>\");\n    }\n    var _html = \"\",\n        _this = this,\n        count = 0;\n    Rkns._(this.data).each(function(_item) {\n        var _element;\n        if (typeof _item === \"string\") {\n            if (/^(https?:\\/\\/|www)/.test(_item)) {\n                _element = { url: _item };\n            } else {\n                _element = { title: _item.replace(/[:,]?\\s?(https?:\\/\\/|www)[\\d\\w\\/.&?=#%-_]+\\s?/,'').trim() };\n                var _match = _item.match(/(https?:\\/\\/|www)[\\d\\w\\/.&?=#%-_]+/);\n                if (_match) {\n                    _element.url = _match[0];\n                }\n                if (_element.title.length > 80) {\n                    _element.description = _element.title;\n                    _element.title = _element.title.replace(/^(.{30,60})\\s.+$/,'$1…');\n                }\n            }\n        } else {\n            _element = _item;\n        }\n        var title = _element.title || (_element.url || \"\").replace(/^https?:\\/\\/(www\\.)?/,'').replace(/^(.{40}).+$/,'$1…'),\n            url = _element.url || \"\",\n            description = _element.description || \"\",\n            image = _element.image || \"\";\n        if (url && !/^https?:\\/\\//.test(url)) {\n            url = 'http://' + url;\n        }\n        if (!search.isempty && !search.test(title) && !search.test(description)) {\n            return;\n        }\n        count++;\n        _html += _this.resultTemplate({\n            url: url,\n            title: title,\n            htitle: highlight(title),\n            image: image,\n            description: description,\n            hdescription: highlight(description),\n            static_url: _this.renkan.options.static_url\n        });\n    });\n    _this.main_$.html(_html);\n    if (!search.isempty && count) {\n        this.count_$.text(count).show();\n    } else {\n        this.count_$.hide();\n    }\n    if (!search.isempty && !count) {\n        this.$.hide();\n    } else {\n        this.$.show();\n    }\n    this.renkan.resizeBins();\n};\n\nRkns.ResourceList.Bin.prototype.refresh = function() {\n    if (this.data) {\n        this.render();\n    }\n};\n","Rkns.Wikipedia = {\n};\n\nRkns.Wikipedia.Search = function(_renkan, _opts) {\n    this.renkan = _renkan;\n    this.lang = _opts.lang || \"en\";\n};\n\nRkns.Wikipedia.Search.prototype.getBgClass = function() {\n    return \"Rk-Wikipedia-Search-Icon Rk-Wikipedia-Lang-\" + this.lang;\n};\n\nRkns.Wikipedia.Search.prototype.getSearchTitle = function() {\n    var langs = {\n        \"fr\": \"French\",\n        \"en\": \"English\",\n        \"ja\": \"Japanese\"\n    };\n    if (langs[this.lang]) {\n        return this.renkan.translate(\"Wikipedia in \") + this.renkan.translate(langs[this.lang]);\n    } else {\n        return this.renkan.translate(\"Wikipedia\") + \" [\" + this.lang + \"]\";\n    }\n};\n\nRkns.Wikipedia.Search.prototype.search = function(_q) {\n    this.renkan.tabs.push(\n        new Rkns.Wikipedia.Bin(this.renkan, {\n            lang: this.lang,\n            search: _q\n        })\n    );\n};\n\nRkns.Wikipedia.Bin = Rkns.Utils.inherit(Rkns._BaseBin);\n\nRkns.Wikipedia.Bin.prototype.resultTemplate = Rkns._.template(\n    '<li class=\"Rk-Wikipedia-Result Rk-Bin-Item\" draggable=\"true\" data-uri=\"<%-url%>\" ' +\n    'data-title=\"Wikipedia: <%-title%>\" data-description=\"<%-description%>\" data-image=\"<%- Rkns.Utils.getFullURL( static_url + \\'img/wikipedia.png\\' ) %>\">' +\n    '<img class=\"Rk-Wikipedia-Icon\" src=\"<%-static_url%>img/wikipedia.png\"></div><h4 class=\"Rk-Wikipedia-Title\"><a href=\"<%-url%>\" target=\"_blank\"><%=htitle%></a></h4>' +\n    '<p class=\"Rk-Wikipedia-Snippet\"><%=hdescription%></p></li>'\n);\n\nRkns.Wikipedia.Bin.prototype._init = function(_renkan, _opts) {\n    this.renkan = _renkan;\n    this.search = _opts.search;\n    this.lang = _opts.lang || \"en\";\n    this.title_icon_$.addClass('Rk-Wikipedia-Title-Icon Rk-Wikipedia-Lang-' + this.lang);\n    this.title_$.html(this.search).addClass(\"Rk-Wikipedia-Title\");\n    this.refresh();\n};\n\nRkns.Wikipedia.Bin.prototype.render = function(searchbase) {\n    var search = searchbase || Rkns.Utils.regexpFromTextOrArray();\n    var highlightrx = (search.isempty ? Rkns.Utils.regexpFromTextOrArray(this.search) : search);\n    function highlight(_text) {\n        return highlightrx.replace(_(_text).escape(), \"<span class='searchmatch'>$1</span>\");\n    }\n    var _html = \"\",\n        _this = this,\n        count = 0;\n    Rkns._(this.data.query.search).each(function(_result) {\n        var title = _result.title,\n            url = \"http://\" + _this.lang + \".wikipedia.org/wiki/\" + encodeURI(title.replace(/ /g,\"_\")),\n            description = Rkns.$('<div>').html(_result.snippet).text();\n        if (!search.isempty && !search.test(title) && !search.test(description)) {\n            return;\n        }\n        count++;\n        _html += _this.resultTemplate({\n            url: url,\n            title: title,\n            htitle: highlight(title),\n            description: description,\n            hdescription: highlight(description),\n            static_url: _this.renkan.options.static_url\n        });\n    });\n    _this.main_$.html(_html);\n    if (!search.isempty && count) {\n        this.count_$.text(count).show();\n    } else {\n        this.count_$.hide();\n    }\n    if (!search.isempty && !count) {\n        this.$.hide();\n    } else {\n        this.$.show();\n    }\n    this.renkan.resizeBins();\n};\n\nRkns.Wikipedia.Bin.prototype.refresh = function() {\n    var _this = this;\n    Rkns.$.ajax({\n        url: \"http://\" + _this.lang + \".wikipedia.org/w/api.php?action=query&list=search&srsearch=\" + encodeURIComponent(this.search) + \"&format=json\",\n        dataType: \"jsonp\",\n        success: function(_data) {\n            _this.data = _data;\n            _this.render();\n        }\n    });\n};\n","\ndefine('renderer/baserepresentation',['jquery', 'underscore'], function ($, _) {\n    \n\n    /* Rkns.Renderer._BaseRepresentation Class */\n\n    /* In Renkan, a \"Representation\" is a sort of ViewModel (in the MVVM paradigm) and bridges the gap between\n     * models (written with Backbone.js) and the view (written with Paper.js)\n     * Renkan's representations all inherit from Rkns.Renderer._BaseRepresentation '*/\n\n    var _BaseRepresentation = function(_renderer, _model) {\n        if (typeof _renderer !== \"undefined\") {\n            this.renderer = _renderer;\n            this.renkan = _renderer.renkan;\n            this.project = _renderer.renkan.project;\n            this.options = _renderer.renkan.options;\n            this.model = _model;\n            if (this.model) {\n                var _this = this;\n                this._changeBinding = function() {\n                    _this.redraw();\n                };\n                this._removeBinding = function() {\n                    _renderer.removeRepresentation(_this);\n                    _(function() {\n                        _renderer.redraw();\n                    }).defer();\n                };\n                this._selectBinding = function() {\n                    _this.select();\n                };\n                this._unselectBinding = function() {\n                    _this.unselect();\n                };\n                this.model.on(\"change\", this._changeBinding );\n                this.model.on(\"remove\", this._removeBinding );\n                this.model.on(\"select\", this._selectBinding );\n                this.model.on(\"unselect\", this._unselectBinding );\n            }\n        }\n    };\n\n    /* Rkns.Renderer._BaseRepresentation Methods */\n\n    _(_BaseRepresentation.prototype).extend({\n        _super: function(_func) {\n            return _BaseRepresentation.prototype[_func].apply(this, Array.prototype.slice.call(arguments, 1));\n        },\n        redraw: function() {},\n        moveTo: function() {},\n        show: function() { return \"BaseRepresentation.show\"; },\n        hide: function() {},\n        select: function() {\n            if (this.model) {\n                this.model.trigger(\"selected\");\n            }\n        },\n        unselect: function() {\n            if (this.model) {\n                this.model.trigger(\"unselected\");\n            }\n        },\n        highlight: function() {},\n        unhighlight: function() {},\n        mousedown: function() {},\n        mouseup: function() {\n            if (this.model) {\n                this.model.trigger(\"clicked\");\n            }\n        },\n        destroy: function() {\n            if (this.model) {\n                this.model.off(\"change\", this._changeBinding );\n                this.model.off(\"remove\", this._removeBinding );\n                this.model.off(\"select\", this._selectBinding );\n                this.model.off(\"unselect\", this._unselectBinding );\n            }\n        }\n    });\n\n    /* End of Rkns.Renderer._BaseRepresentation Class */\n\n    return _BaseRepresentation;\n\n});\n\ndefine('requtils',[], function ($, _) {\n    \n    return {\n        getUtils: function(){\n            return window.Rkns.Utils;\n        },\n        getRenderer: function(){\n            return window.Rkns.Renderer;\n        }\n    };\n\n});\n\n\ndefine('renderer/basebutton',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* Rkns.Renderer._BaseButton Class */\n\n    /* BaseButton is extended by contextual buttons that appear when hovering on nodes and edges */\n\n    var _BaseButton = Utils.inherit(BaseRepresentation);\n\n    _(_BaseButton.prototype).extend({\n        moveTo: function(_pos) {\n            this.sector.moveTo(_pos);\n        },\n        show: function() {\n            this.sector.show();\n        },\n        hide: function() {\n            this.sector.hide();\n        },\n        select: function() {\n            this.sector.select();\n        },\n        unselect: function(_newTarget) {\n            this.sector.unselect();\n            if (!_newTarget || (_newTarget !== this.source_representation && _newTarget.source_representation !== this.source_representation)) {\n                this.source_representation.unselect();\n            }\n        },\n        destroy: function() {\n            this.sector.destroy();\n        }\n    });\n\n    return _BaseButton;\n\n});\n\n\ndefine('renderer/shapebuilder',[], function () {\n    \n\n    /* ShapeBuilder Begin */\n\n    var builders = {\n        \"circle\":{\n            getShape: function() {\n                return new paper.Path.Circle([0, 0], 1);\n            },\n            getImageShape: function(center, radius) {\n                return new paper.Path.Circle(center, radius);\n            }\n        },\n        \"rectangle\":{\n            getShape: function() {\n                return new paper.Path.Rectangle([-2, -2], [2, 2]);\n            },\n            getImageShape: function(center, radius) {\n                return new paper.Path.Rectangle([-radius, -radius], [radius*2, radius*2]);\n            }\n        },\n        \"ellipse\":{\n            getShape: function() {\n                return new paper.Path.Ellipse(new paper.Rectangle([-2, -1], [2, 1]));\n            },\n            getImageShape: function(center, radius) {\n                return new paper.Path.Ellipse(new paper.Rectangle([-radius, -radius/2], [radius*2, radius]));\n            }\n        },\n        \"polygon\":{\n            getShape: function() {\n                return new paper.Path.RegularPolygon([0, 0], 6, 1);\n            },\n            getImageShape: function(center, radius) {\n                return new paper.Path.RegularPolygon([0, 0], 6, radius);\n            }\n        },\n        \"diamond\":{\n            getShape: function() {\n                var d = new paper.Path.Rectangle([-2, -2], [2, 2]);\n                d.rotate(45);\n                return d;\n            },\n            getImageShape: function(center, radius) {\n                var d = new paper.Path.Rectangle([-radius, -radius], [radius*2, radius*2]);\n                d.rotate(45);\n                return d;\n            }\n        },\n        \"star\":{\n            getShape: function() {\n                return new paper.Path.Star([0, 0], 8, 1, 0.7);\n            },\n            getImageShape: function(center, radius) {\n                return new paper.Path.Star([0, 0], 8, radius*1, radius*0.7);\n            }\n        },\n        \"svg\": function(path){\n            return {\n                getShape: function() {\n                    return new paper.Path(path);\n                },\n                getImageShape: function(center, radius) {\n                    // No calcul for the moment \n                    return new paper.Path();\n                }\n            };\n        }\n    };\n    \n    var ShapeBuilder = function (shape){\n        if(typeof shape===\"undefined\"){\n            shape = \"circle\";\n        }\n        if(shape.substr(0,4)===\"svg:\"){\n            return builders.svg(shape.substr(4));\n        }\n        if(!(shape in builders)){\n            shape = \"circle\";\n        }\n        return builders[shape];\n    };\n    \n    return ShapeBuilder;\n\n});\n\ndefine('renderer/noderepr',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation', 'renderer/shapebuilder'], function ($, _, requtils, BaseRepresentation, ShapeBuilder) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* Rkns.Renderer.Node Class */\n\n    /* The representation for the node : A circle, with an image inside and a text label underneath.\n     * The circle and the image are drawn on canvas and managed by Paper.js.\n     * The text label is an HTML node, managed by jQuery. */\n\n    //var NodeRepr = Renderer.Node = Utils.inherit(Renderer._BaseRepresentation);\n    var NodeRepr = Utils.inherit(BaseRepresentation);\n\n    _(NodeRepr.prototype).extend({\n        _init: function() {\n            this.renderer.node_layer.activate();\n            this.type = \"Node\";\n            this.buildShape();\n            if (this.options.show_node_circles) {\n                this.circle.strokeWidth = this.options.node_stroke_width;\n                this.h_ratio = 1;\n            } else {\n                this.h_ratio = 0;\n            }\n            this.title = $('<div class=\"Rk-Label\">').appendTo(this.renderer.labels_$);\n\n            if (this.options.editor_mode) {\n                var Renderer = requtils.getRenderer();\n                this.normal_buttons = [\n                                       new Renderer.NodeEditButton(this.renderer, null),\n                                       new Renderer.NodeRemoveButton(this.renderer, null),\n                                       new Renderer.NodeLinkButton(this.renderer, null),\n                                       new Renderer.NodeEnlargeButton(this.renderer, null),\n                                       new Renderer.NodeShrinkButton(this.renderer, null)\n                                       ];\n                this.pending_delete_buttons = [\n                                               new Renderer.NodeRevertButton(this.renderer, null)\n                                               ];\n                this.all_buttons = this.normal_buttons.concat(this.pending_delete_buttons);\n\n                for (var i = 0; i < this.all_buttons.length; i++) {\n                    this.all_buttons[i].source_representation = this;\n                }\n                this.active_buttons = [];\n            } else {\n                this.active_buttons = this.all_buttons = [];\n            }\n            this.last_circle_radius = 1;\n\n            if (this.renderer.minimap) {\n                this.renderer.minimap.node_layer.activate();\n                this.minimap_circle = new paper.Path.Circle([0, 0], 1);\n                this.minimap_circle.__representation = this.renderer.minimap.miniframe.__representation;\n                this.renderer.minimap.node_group.addChild(this.minimap_circle);\n            }\n        },\n        buildShape: function(){\n            if(typeof this.model.get(\"shape_changed\")!==\"undefined\" && this.model.get(\"shape_changed\")===true){\n                this.model.set(\"shape_changed\", false);\n                delete this.img;\n            }\n            if(this.circle){\n                this.circle.remove();\n                delete this.circle;\n            }\n            // \"circle\" \"rectangle\" \"ellipse\" \"polygon\" \"star\" \"diamond\"\n            this.shapeBuilder = new ShapeBuilder(this.model.get(\"shape\"));\n            this.circle = this.shapeBuilder.getShape();\n            this.circle.__representation = this;\n            this.last_circle_radius = 1;\n        },\n        redraw: function(_dontRedrawEdges) {\n            if(typeof this.model.get(\"shape_changed\")!==\"undefined\" && this.model.get(\"shape_changed\")===true){\n                this.buildShape();\n            }\n            var _model_coords = new paper.Point(this.model.get(\"position\")),\n            _baseRadius = this.options.node_size_base * Math.exp((this.model.get(\"size\") || 0) * Utils._NODE_SIZE_STEP);\n            if (!this.is_dragging || !this.paper_coords) {\n                this.paper_coords = this.renderer.toPaperCoords(_model_coords);\n            }\n            this.circle_radius = _baseRadius * this.renderer.scale;\n            if (this.last_circle_radius !== this.circle_radius) {\n                this.all_buttons.forEach(function(b) {\n                    b.setSectorSize();\n                });\n                this.circle.scale(this.circle_radius / this.last_circle_radius);\n                if (this.node_image) {\n                    this.node_image.scale(this.circle_radius / this.last_circle_radius);\n                }\n            }\n            this.circle.position = this.paper_coords;\n            if (this.node_image) {\n                this.node_image.position = this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius));\n            }\n            this.last_circle_radius = this.circle_radius;\n\n            var old_act_btn = this.active_buttons;\n\n            var opacity = 1;\n            if (this.model.get(\"delete_scheduled\")) {\n                opacity = 0.5;\n                this.active_buttons = this.pending_delete_buttons;\n                this.circle.dashArray = [2,2];\n            } else {\n                opacity = 1;\n                this.active_buttons = this.normal_buttons;\n                this.circle.dashArray = null;\n            }\n\n            if (this.selected && this.renderer.isEditable()) {\n                if (old_act_btn !== this.active_buttons) {\n                    old_act_btn.forEach(function(b) {\n                        b.hide();\n                    });\n                }\n                this.active_buttons.forEach(function(b) {\n                    b.show();\n                });\n            }\n\n            if (this.node_image) {\n                this.node_image.opacity = this.highlighted ? opacity * 0.5 : (opacity - 0.01);\n            }\n\n            this.circle.fillColor = this.highlighted ? this.options.highlighted_node_fill_color : this.options.node_fill_color;\n\n            this.circle.opacity = this.options.show_node_circles ? opacity : 0.01;\n\n            var _text = this.model.get(\"title\") || this.renkan.translate(this.options.label_untitled_nodes) || \"\";\n            _text = Utils.shortenText(_text, this.options.node_label_max_length);\n\n            if (typeof this.highlighted === \"object\") {\n                this.title.html(this.highlighted.replace(_(_text).escape(),'<span class=\"Rk-Highlighted\">$1</span>'));\n            } else {\n                this.title.text(_text);\n            }\n\n            this.title.css({\n                left: this.paper_coords.x,\n                top: this.paper_coords.y + this.circle_radius * this.h_ratio + this.options.node_label_distance,\n                opacity: opacity\n            });\n            var _color = this.model.get(\"color\") || (this.model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\");\n            this.circle.strokeColor = _color;\n            var _pc = this.paper_coords;\n            this.all_buttons.forEach(function(b) {\n                b.moveTo(_pc);\n            });\n            var lastImage = this.img;\n            this.img = this.model.get(\"image\");\n            if (this.img && this.img !== lastImage) {\n                this.showImage();\n            }\n            if (this.node_image && !this.img) {\n                this.node_image.remove();\n                delete this.node_image;\n            }\n\n            if (this.renderer.minimap) {\n                this.minimap_circle.fillColor = _color;\n                var minipos = this.renderer.toMinimapCoords(_model_coords),\n                miniradius = this.renderer.minimap.scale * _baseRadius,\n                minisize = new paper.Size([miniradius, miniradius]);\n                this.minimap_circle.fitBounds(minipos.subtract(minisize), minisize.multiply(2));\n            }\n\n            if (!_dontRedrawEdges) {\n                var _this = this;\n                _.each(\n                        this.project.get(\"edges\").filter(\n                                function (ed) {\n                                    return ((ed.get(\"to\") === _this.model) || (ed.get(\"from\") === _this.model));\n                                }\n                        ),\n                        function(edge, index, list) {\n                            var repr = _this.renderer.getRepresentationByModel(edge);\n                            if (repr && typeof repr.from_representation !== \"undefined\" && typeof repr.from_representation.paper_coords !== \"undefined\" && typeof repr.to_representation !== \"undefined\" && typeof repr.to_representation.paper_coords !== \"undefined\") {\n                                repr.redraw();\n                            }\n                        }\n                );\n            }\n\n        },\n        showImage: function() {\n            var _image = null;\n            if (typeof this.renderer.image_cache[this.img] === \"undefined\") {\n                _image = new Image();\n                this.renderer.image_cache[this.img] = _image;\n                _image.src = this.img;\n            } else {\n                _image = this.renderer.image_cache[this.img];\n            }\n            if (_image.width) {\n                if (this.node_image) {\n                    this.node_image.remove();\n                }\n                this.renderer.node_layer.activate();\n                var width = _image.width,\n                    height = _image.height,\n                    clipPath = this.model.get(\"clip_path\"),\n                    hasClipPath = (typeof clipPath !== \"undefined\" && clipPath),\n                    _clip = null,\n                    baseRadius = null,\n                    centerPoint = null;\n\n                if (hasClipPath) {\n                    _clip = new paper.Path();\n                    var instructions = clipPath.match(/[a-z][^a-z]+/gi) || [],\n                    lastCoords = [0,0],\n                    minX = Infinity,\n                    minY = Infinity,\n                    maxX = -Infinity,\n                    maxY = -Infinity;\n\n                    var transformCoords = function(tabc, relative) {\n                        var newCoords = tabc.slice(1).map(function(v, k) {\n                            var res = parseFloat(v),\n                            isY = k % 2;\n                            if (isY) {\n                                res = ( res - 0.5 ) * height;\n                            } else {\n                                res = ( res - 0.5 ) * width;\n                            }\n                            if (relative) {\n                                res += lastCoords[isY];\n                            }\n                            if (isY) {\n                                minY = Math.min(minY, res);\n                                maxY = Math.max(maxY, res);\n                            } else {\n                                minX = Math.min(minX, res);\n                                maxX = Math.max(maxX, res);\n                            }\n                            return res;\n                        });\n                        lastCoords = newCoords.slice(-2);\n                        return newCoords;\n                    };\n\n                    instructions.forEach(function(instr) {\n                        var coords = instr.match(/([a-z]|[0-9.-]+)/ig) || [\"\"];\n                        switch(coords[0]) {\n                        case \"M\":\n                            _clip.moveTo(transformCoords(coords));\n                            break;\n                        case \"m\":\n                            _clip.moveTo(transformCoords(coords, true));\n                            break;\n                        case \"L\":\n                            _clip.lineTo(transformCoords(coords));\n                            break;\n                        case \"l\":\n                            _clip.lineTo(transformCoords(coords, true));\n                            break;\n                        case \"C\":\n                            _clip.cubicCurveTo(transformCoords(coords));\n                            break;\n                        case \"c\":\n                            _clip.cubicCurveTo(transformCoords(coords, true));\n                            break;\n                        case \"Q\":\n                            _clip.quadraticCurveTo(transformCoords(coords));\n                            break;\n                        case \"q\":\n                            _clip.quadraticCurveTo(transformCoords(coords, true));\n                            break;\n                        }\n                    });\n\n                    baseRadius = Math[this.options.node_images_fill_mode ? \"min\" : \"max\"](maxX - minX, maxY - minY) / 2;\n                    centerPoint = new paper.Point((maxX + minX) / 2, (maxY + minY) / 2);\n                    if (!this.options.show_node_circles) {\n                        this.h_ratio = (maxY - minY) / (2 * baseRadius);\n                    }\n                } else {\n                    baseRadius = Math[this.options.node_images_fill_mode ? \"min\" : \"max\"](width, height) / 2;\n                    centerPoint = new paper.Point(0,0);\n                    if (!this.options.show_node_circles) {\n                        this.h_ratio = height / (2 * baseRadius);\n                    }\n                }\n                var _raster = new paper.Raster(_image);\n                _raster.locked = true; // Disable mouse events on icon\n                if (hasClipPath) {\n                    _raster = new paper.Group(_clip, _raster);\n                    _raster.opacity = 0.99;\n                    /* This is a workaround to allow clipping at group level\n                     * If opacity was set to 1, paper.js would merge all clipping groups in one (known bug).\n                     */\n                    _raster.clipped = true;\n                    _clip.__representation = this;\n                }\n                if (this.options.clip_node_images) {\n                    var _circleClip = this.shapeBuilder.getImageShape(centerPoint, baseRadius);\n                    _raster = new paper.Group(_circleClip, _raster);\n                    _raster.opacity = 0.99;\n                    _raster.clipped = true;\n                    _circleClip.__representation = this;\n                }\n                this.image_delta = centerPoint.divide(baseRadius);\n                this.node_image = _raster;\n                this.node_image.__representation = _this;\n                this.node_image.scale(this.circle_radius / baseRadius);\n                this.node_image.position = this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius));\n                this.redraw();\n                this.renderer.throttledPaperDraw();\n            } else {\n                var _this = this;\n                $(_image).on(\"load\", function() {\n                    _this.showImage();\n                });\n            }\n        },\n        paperShift: function(_delta) {\n            if (this.options.editor_mode) {\n                if (!this.renkan.read_only) {\n                    this.is_dragging = true;\n                    this.paper_coords = this.paper_coords.add(_delta);\n                    this.redraw();\n                }\n            } else {\n                this.renderer.paperShift(_delta);\n            }\n        },\n        openEditor: function() {\n            this.renderer.removeRepresentationsOfType(\"editor\");\n            var _editor = this.renderer.addRepresentation(\"NodeEditor\",null);\n            _editor.source_representation = this;\n            _editor.draw();\n        },\n        select: function() {\n            this.selected = true;\n            this.circle.strokeWidth = this.options.selected_node_stroke_width;\n            if (this.renderer.isEditable()) {\n                this.active_buttons.forEach(function(b) {\n                    b.show();\n                });\n            }\n            var _uri = this.model.get(\"uri\");\n            if (_uri) {\n                $('.Rk-Bin-Item').each(function() {\n                    var _el = $(this);\n                    if (_el.attr(\"data-uri\") === _uri) {\n                        _el.addClass(\"selected\");\n                    }\n                });\n            }\n            if (!this.options.editor_mode) {\n                this.openEditor();\n            }\n\n            if (this.renderer.minimap) {\n                this.minimap_circle.strokeWidth = this.options.minimap_highlight_weight;\n                this.minimap_circle.strokeColor = this.options.minimap_highlight_color;\n            }\n            this._super(\"select\");\n        },\n        hideButtons: function() {\n            this.all_buttons.forEach(function(b) {\n                b.hide();\n            });\n            delete(this.buttonTimeout);\n        },\n        unselect: function(_newTarget) {\n            if (!_newTarget || _newTarget.source_representation !== this) {\n                this.selected = false;\n                var _this = this;\n                this.buttons_timeout = setTimeout(function() { _this.hideButtons(); }, 200);\n                this.circle.strokeWidth = this.options.node_stroke_width;\n                $('.Rk-Bin-Item').removeClass(\"selected\");\n                if (this.renderer.minimap) {\n                    this.minimap_circle.strokeColor = undefined;\n                }\n                this._super(\"unselect\");\n            }\n        },\n        highlight: function(textToReplace) {\n            var hlvalue = textToReplace || true;\n            if (this.highlighted === hlvalue) {\n                return;\n            }\n            this.highlighted = hlvalue;\n            this.redraw();\n            this.renderer.throttledPaperDraw();\n        },\n        unhighlight: function() {\n            if (!this.highlighted) {\n                return;\n            }\n            this.highlighted = false;\n            this.redraw();\n            this.renderer.throttledPaperDraw();\n        },\n        saveCoords: function() {\n            var _coords = this.renderer.toModelCoords(this.paper_coords),\n            _data = {\n                position: {\n                    x: _coords.x,\n                    y: _coords.y\n                }\n            };\n            if (this.renderer.isEditable()) {\n                this.model.set(_data);\n            }\n        },\n        mousedown: function(_event, _isTouch) {\n            if (_isTouch) {\n                this.renderer.unselectAll();\n                this.select();\n            }\n        },\n        mouseup: function(_event, _isTouch) {\n            if (this.renderer.is_dragging && this.renderer.isEditable()) {\n                this.saveCoords();\n            } else {\n                if (!_isTouch && !this.model.get(\"delete_scheduled\")) {\n                    this.openEditor();\n                }\n                this.model.trigger(\"clicked\");\n            }\n            this.renderer.click_target = null;\n            this.renderer.is_dragging = false;\n            this.is_dragging = false;\n        },\n        destroy: function(_event) {\n            this._super(\"destroy\");\n            this.all_buttons.forEach(function(b) {\n                b.destroy();\n            });\n            this.circle.remove();\n            this.title.remove();\n            if (this.renderer.minimap) {\n                this.minimap_circle.remove();\n            }\n            if (this.node_image) {\n                this.node_image.remove();\n            }\n        }\n    });\n\n    return NodeRepr;\n\n});\n\n\ndefine('renderer/edge',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* Edge Class Begin */\n\n    //var Edge = Renderer.Edge = Utils.inherit(Renderer._BaseRepresentation);\n    var Edge = Utils.inherit(BaseRepresentation);\n\n    _(Edge.prototype).extend({\n        _init: function() {\n            this.renderer.edge_layer.activate();\n            this.type = \"Edge\";\n            this.from_representation = this.renderer.getRepresentationByModel(this.model.get(\"from\"));\n            this.to_representation = this.renderer.getRepresentationByModel(this.model.get(\"to\"));\n            this.bundle = this.renderer.addToBundles(this);\n            this.line = new paper.Path();\n            this.line.add([0,0],[0,0],[0,0]);\n            this.line.__representation = this;\n            this.line.strokeWidth = this.options.edge_stroke_width;\n            this.arrow = new paper.Path();\n            this.arrow.add(\n                    [ 0, 0 ],\n                    [ this.options.edge_arrow_length, this.options.edge_arrow_width / 2 ],\n                    [ 0, this.options.edge_arrow_width ]\n            );\n            this.arrow.__representation = this;\n            this.text = $('<div class=\"Rk-Label Rk-Edge-Label\">').appendTo(this.renderer.labels_$);\n            this.arrow_angle = 0;\n            if (this.options.editor_mode) {\n                var Renderer = requtils.getRenderer();\n                this.normal_buttons = [\n                                       new Renderer.EdgeEditButton(this.renderer, null),\n                                       new Renderer.EdgeRemoveButton(this.renderer, null)\n                                       ];\n                this.pending_delete_buttons = [\n                                               new Renderer.EdgeRevertButton(this.renderer, null)\n                                               ];\n                this.all_buttons = this.normal_buttons.concat(this.pending_delete_buttons);\n                for (var i = 0; i < this.all_buttons.length; i++) {\n                    this.all_buttons[i].source_representation = this;\n                }\n                this.active_buttons = [];\n            } else {\n                this.active_buttons = this.all_buttons = [];\n            }\n\n            if (this.renderer.minimap) {\n                this.renderer.minimap.edge_layer.activate();\n                this.minimap_line = new paper.Path();\n                this.minimap_line.add([0,0],[0,0]);\n                this.minimap_line.__representation = this.renderer.minimap.miniframe.__representation;\n                this.minimap_line.strokeWidth = 1;\n            }\n        },\n        redraw: function() {\n            var from = this.model.get(\"from\"),\n            to = this.model.get(\"to\");\n            if (!from || !to) {\n                return;\n            }\n            this.from_representation = this.renderer.getRepresentationByModel(from);\n            this.to_representation = this.renderer.getRepresentationByModel(to);\n            if (typeof this.from_representation === \"undefined\" || typeof this.to_representation === \"undefined\") {\n                return;\n            }\n            var _p0a = this.from_representation.paper_coords,\n            _p1a = this.to_representation.paper_coords,\n            _v = _p1a.subtract(_p0a),\n            _r = _v.length,\n            _u = _v.divide(_r),\n            _ortho = new paper.Point([- _u.y, _u.x]),\n            _group_pos = this.bundle.getPosition(this),\n            _delta = _ortho.multiply( this.options.edge_gap_in_bundles * _group_pos ),\n            _p0b = _p0a.add(_delta), /* Adding a 4 px difference */\n            _p1b = _p1a.add(_delta), /* to differentiate bundled links */\n            _a = _v.angle,\n            _textdelta = _ortho.multiply(this.options.edge_label_distance),\n            _handle = _v.divide(3),\n            _color = this.model.get(\"color\") || this.model.get(\"color\") || (this.model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n            opacity = 1;\n\n            if (this.model.get(\"delete_scheduled\") || this.from_representation.model.get(\"delete_scheduled\") || this.to_representation.model.get(\"delete_scheduled\")) {\n                opacity = 0.5;\n                this.line.dashArray = [2, 2];\n            } else {\n                opacity = 1;\n                this.line.dashArray = null;\n            }\n\n            var old_act_btn = this.active_buttons;\n\n            this.active_buttons = this.model.get(\"delete_scheduled\") ? this.pending_delete_buttons : this.normal_buttons;\n\n            if (this.selected && this.renderer.isEditable() && old_act_btn !== this.active_buttons) {\n                old_act_btn.forEach(function(b) {\n                    b.hide();\n                });\n                this.active_buttons.forEach(function(b) {\n                    b.show();\n                });\n            }\n\n            this.paper_coords = _p0b.add(_p1b).divide(2);\n            this.line.strokeColor = _color;\n            this.line.opacity = opacity;\n            this.line.segments[0].point = _p0a;\n            this.line.segments[1].point = this.paper_coords;\n            this.line.segments[1].handleIn = _handle.multiply(-1);\n            this.line.segments[1].handleOut = _handle;\n            this.line.segments[2].point = _p1a;\n            this.arrow.rotate(_a - this.arrow_angle);\n            this.arrow.fillColor = _color;\n            this.arrow.opacity = opacity;\n            this.arrow.position = this.paper_coords;\n            this.arrow_angle = _a;\n            if (_a > 90) {\n                _a -= 180;\n                _textdelta = _textdelta.multiply(-1);\n            }\n            if (_a < -90) {\n                _a += 180;\n                _textdelta = _textdelta.multiply(-1);\n            }\n            var _text = this.model.get(\"title\") || this.renkan.translate(this.options.label_untitled_edges) || \"\";\n            _text = Utils.shortenText(_text, this.options.node_label_max_length);\n            this.text.text(_text);\n            var _textpos = this.paper_coords.add(_textdelta);\n            this.text.css({\n                left: _textpos.x,\n                top: _textpos.y,\n                transform: \"rotate(\" + _a + \"deg)\",\n                \"-moz-transform\": \"rotate(\" + _a + \"deg)\",\n                \"-webkit-transform\": \"rotate(\" + _a + \"deg)\",\n                opacity: opacity\n            });\n            this.text_angle = _a;\n\n            var _pc = this.paper_coords;\n            this.all_buttons.forEach(function(b) {\n                b.moveTo(_pc);\n            });\n\n            if (this.renderer.minimap) {\n                this.minimap_line.strokeColor = _color;\n                this.minimap_line.segments[0].point = this.renderer.toMinimapCoords(new paper.Point(this.from_representation.model.get(\"position\")));\n                this.minimap_line.segments[1].point = this.renderer.toMinimapCoords(new paper.Point(this.to_representation.model.get(\"position\")));\n            }\n        },\n        openEditor: function() {\n            this.renderer.removeRepresentationsOfType(\"editor\");\n            var _editor = this.renderer.addRepresentation(\"EdgeEditor\",null);\n            _editor.source_representation = this;\n            _editor.draw();\n        },\n        select: function() {\n            this.selected = true;\n            this.line.strokeWidth = this.options.selected_edge_stroke_width;\n            if (this.renderer.isEditable()) {\n                this.active_buttons.forEach(function(b) {\n                    b.show();\n                });\n            }\n            if (!this.options.editor_mode) {\n                this.openEditor();\n            }\n            this._super(\"select\");\n        },\n        unselect: function(_newTarget) {\n            if (!_newTarget || _newTarget.source_representation !== this) {\n                this.selected = false;\n                if (this.options.editor_mode) {\n                    this.all_buttons.forEach(function(b) {\n                        b.hide();\n                    });\n                }\n                this.line.strokeWidth = this.options.edge_stroke_width;\n                this._super(\"unselect\");\n            }\n        },\n        mousedown: function(_event, _isTouch) {\n            if (_isTouch) {\n                this.renderer.unselectAll();\n                this.select();\n            }\n        },\n        mouseup: function(_event, _isTouch) {\n            if (!this.renkan.read_only && this.renderer.is_dragging) {\n                this.from_representation.saveCoords();\n                this.to_representation.saveCoords();\n                this.from_representation.is_dragging = false;\n                this.to_representation.is_dragging = false;\n            } else {\n                if (!_isTouch) {\n                    this.openEditor();\n                }\n                this.model.trigger(\"clicked\");\n            }\n            this.renderer.click_target = null;\n            this.renderer.is_dragging = false;\n        },\n        paperShift: function(_delta) {\n            if (this.options.editor_mode) {\n                if (!this.options.read_only) {\n                    this.from_representation.paperShift(_delta);\n                    this.to_representation.paperShift(_delta);\n                }\n            } else {\n                this.renderer.paperShift(_delta);\n            }\n        },\n        destroy: function() {\n            this._super(\"destroy\");\n            this.line.remove();\n            this.arrow.remove();\n            this.text.remove();\n            if (this.renderer.minimap) {\n                this.minimap_line.remove();\n            }\n            this.all_buttons.forEach(function(b) {\n                b.destroy();\n            });\n            var _this = this;\n            this.bundle.edges = _(this.bundle.edges).reject(function(_edge) {\n                return _this === _edge;\n            });\n        }\n    });\n\n    return Edge;\n\n});\n\n\n\ndefine('renderer/tempedge',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* TempEdge Class Begin */\n\n    //var TempEdge = Renderer.TempEdge = Utils.inherit(Renderer._BaseRepresentation);\n    var TempEdge = Utils.inherit(BaseRepresentation);\n\n    _(TempEdge.prototype).extend({\n        _init: function() {\n            this.renderer.edge_layer.activate();\n            this.type = \"Temp-edge\";\n\n            var _color = (this.project.get(\"users\").get(this.renkan.current_user) || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\");\n            this.line = new paper.Path();\n            this.line.strokeColor = _color;\n            this.line.dashArray = [4, 2];\n            this.line.strokeWidth = this.options.selected_edge_stroke_width;\n            this.line.add([0,0],[0,0]);\n            this.line.__representation = this;\n            this.arrow = new paper.Path();\n            this.arrow.fillColor = _color;\n            this.arrow.add(\n                    [ 0, 0 ],\n                    [ this.options.edge_arrow_length, this.options.edge_arrow_width / 2 ],\n                    [ 0, this.options.edge_arrow_width ]\n            );\n            this.arrow.__representation = this;\n            this.arrow_angle = 0;\n        },\n        redraw: function() {\n            var _p0 = this.from_representation.paper_coords,\n            _p1 = this.end_pos,\n            _a = _p1.subtract(_p0).angle,\n            _c = _p0.add(_p1).divide(2);\n            this.line.segments[0].point = _p0;\n            this.line.segments[1].point = _p1;\n            this.arrow.rotate(_a - this.arrow_angle);\n            this.arrow.position = _c;\n            this.arrow_angle = _a;\n        },\n        paperShift: function(_delta) {\n            if (!this.renderer.isEditable()) {\n                this.renderer.removeRepresentation(_this);\n                paper.view.draw();\n                return;\n            }\n            this.end_pos = this.end_pos.add(_delta);\n            var _hitResult = paper.project.hitTest(this.end_pos);\n            this.renderer.findTarget(_hitResult);\n            this.redraw();\n        },\n        mouseup: function(_event, _isTouch) {\n            var _hitResult = paper.project.hitTest(_event.point),\n            _model = this.from_representation.model,\n            _endDrag = true;\n            if (_hitResult && typeof _hitResult.item.__representation !== \"undefined\") {\n                var _target = _hitResult.item.__representation;\n                if (_target.type.substr(0,4) === \"Node\") {\n                    var _destmodel = _target.model || _target.source_representation.model;\n                    if (_model !== _destmodel) {\n                        var _data = {\n                                id: Utils.getUID('edge'),\n                                created_by: this.renkan.current_user,\n                                from: _model,\n                                to: _destmodel\n                        };\n                        if (this.renderer.isEditable()) {\n                            this.project.addEdge(_data);\n                        }\n                    }\n                }\n\n                if (_model === _target.model || (_target.source_representation && _target.source_representation.model === _model)) {\n                    _endDrag = false;\n                    this.renderer.is_dragging = true;\n                }\n            }\n            if (_endDrag) {\n                this.renderer.click_target = null;\n                this.renderer.is_dragging = false;\n                this.renderer.removeRepresentation(this);\n                paper.view.draw();\n            }\n        },\n        destroy: function() {\n            this.arrow.remove();\n            this.line.remove();\n        }\n    });\n\n    /* TempEdge Class End */\n\n    return TempEdge;\n\n});\n\n\ndefine('renderer/baseeditor',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* _BaseEditor Begin */\n    //var _BaseEditor = Renderer._BaseEditor = Utils.inherit(Renderer._BaseRepresentation);\n    var _BaseEditor = Utils.inherit(BaseRepresentation);\n\n    _(_BaseEditor.prototype).extend({\n        _init: function() {\n            this.renderer.buttons_layer.activate();\n            this.type = \"editor\";\n            this.editor_block = new paper.Path();\n            var _pts = _(_.range(8)).map(function() {return [0,0];});\n            this.editor_block.add.apply(this.editor_block, _pts);\n            this.editor_block.strokeWidth = this.options.tooltip_border_width;\n            this.editor_block.strokeColor = this.options.tooltip_border_color;\n            this.editor_block.opacity = 0.8;\n            this.editor_$ = $('<div>')\n            .appendTo(this.renderer.editor_$)\n            .css({\n                position: \"absolute\",\n                opacity: 0.8\n            })\n            .hide();\n        },\n        destroy: function() {\n            this.editor_block.remove();\n            this.editor_$.remove();\n        }\n    });\n\n    /* _BaseEditor End */\n\n    return _BaseEditor;\n\n});\n\n\ndefine('renderer/nodeeditor',['jquery', 'underscore', 'requtils', 'renderer/baseeditor'], function ($, _, requtils, BaseEditor) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* NodeEditor Begin */\n    //var NodeEditor = Renderer.NodeEditor = Utils.inherit(Renderer._BaseEditor);\n    var NodeEditor = Utils.inherit(BaseEditor);\n\n    _(NodeEditor.prototype).extend({\n    \t_init: function() {\n    \t\tBaseEditor.prototype._init.apply(this);\n    \t\tthis.template = this.options.templates['templates/nodeeditor.html'];\n    \t\tthis.readOnlyTemplate = this.options.templates['templates/nodeeditor_readonly.html'];\n    \t},\n        draw: function() {\n            var _model = this.source_representation.model,\n            _created_by = _model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan),\n            _template = (this.renderer.isEditable() ? this.template : this.readOnlyTemplate ),\n            _image_placeholder = this.options.static_url + \"img/image-placeholder.png\",\n            _size = (_model.get(\"size\") || 0);\n            this.editor_$\n            .html(_template({\n                node: {\n                    has_creator: !!_model.get(\"created_by\"),\n                    title: _model.get(\"title\"),\n                    uri: _model.get(\"uri\"),\n                    short_uri:  Utils.shortenText((_model.get(\"uri\") || \"\").replace(/^(https?:\\/\\/)?(www\\.)?/,'').replace(/\\/$/,''),40),\n                    description: _model.get(\"description\"),\n                    image: _model.get(\"image\") || \"\",\n                    image_placeholder: _image_placeholder,\n                    color: _model.get(\"color\") || _created_by.get(\"color\"),\n                    clip_path: _model.get(\"clip_path\") || false,\n                    created_by_color: _created_by.get(\"color\"),\n                    created_by_title: _created_by.get(\"title\"),\n                    size: (_size > 0 ? \"+\" : \"\") + _size,\n                    shape: _model.get(\"shape\") || \"circle\"\n                },\n                renkan: this.renkan,\n                options: this.options,\n                shortenText: Utils.shortenText\n            }));\n            this.redraw();\n            var _this = this,\n            closeEditor = function() {\n                _this.renderer.removeRepresentation(_this);\n                paper.view.draw();\n            };\n\n            this.editor_$.find(\".Rk-CloseX\").click(closeEditor);\n\n            this.editor_$.find(\".Rk-Edit-Goto\").click(function() {\n                if (!_model.get(\"uri\")) {\n                    return false;\n                }\n            });\n\n            if (this.renderer.isEditable()) {\n\n                var onFieldChange = _(function() {\n                    _(function() {\n                        if (_this.renderer.isEditable()) {\n                            var _data = {\n                                title: _this.editor_$.find(\".Rk-Edit-Title\").val()\n                            };\n                            if (_this.options.show_node_editor_uri) {\n                                _data.uri = _this.editor_$.find(\".Rk-Edit-URI\").val();\n                                _this.editor_$.find(\".Rk-Edit-Goto\").attr(\"href\",_data.uri || \"#\");\n                            }\n                            if (_this.options.show_node_editor_image) {\n                                _data.image = _this.editor_$.find(\".Rk-Edit-Image\").val();\n                                _this.editor_$.find(\".Rk-Edit-ImgPreview\").attr(\"src\", _data.image || _image_placeholder);\n                            }\n                            if (_this.options.show_node_editor_description) {\n                                _data.description = _this.editor_$.find(\".Rk-Edit-Description\").val();\n                            }\n                            if (_this.options.change_shapes) {\n                                if(_model.get(\"shape\")!==_this.editor_$.find(\".Rk-Edit-Shape\").val()){\n                                    _data.shape = _this.editor_$.find(\".Rk-Edit-Shape\").val();\n                                    _data.shape_changed = true;\n                                }\n                            }\n                            _model.set(_data);\n                            _this.redraw();\n                            // For an unknown reason, we have to set data twice when we change shape, otherwise the image disappears.\n                            if(_data.shape_changed===true){\n                                _model.set(_data);\n                            }\n                        } else {\n                            closeEditor();\n                        }\n                    }).defer();\n                }).throttle(500);\n                \n                this.editor_$.on(\"keyup\", function(_e) {\n                    if (_e.keyCode === 27) {\n                        closeEditor();\n                    }\n                });\n\n                this.editor_$.find(\"input, textarea, select\").on(\"change keyup paste\", onFieldChange);\n\n                if(_this.options.allow_image_upload) {\n                    this.editor_$.find(\".Rk-Edit-Image-File\").change(function() {\n                        if (this.files.length) {\n                            var f = this.files[0],\n                            fr = new FileReader();\n                            if (f.type.substr(0,5) !== \"image\") {\n                                alert(_this.renkan.translate(\"This file is not an image\"));\n                                return;\n                            }\n                            if (f.size > (_this.options.uploaded_image_max_kb * 1024)) {\n                                alert(_this.renkan.translate(\"Image size must be under \") + _this.options.uploaded_image_max_kb + _this.renkan.translate(\"KB\"));\n                                return;\n                            }\n                            fr.onload = function(e) {\n                                _this.editor_$.find(\".Rk-Edit-Image\").val(e.target.result);\n                                onFieldChange();\n                            };\n                            fr.readAsDataURL(f);\n                        }\n                    });\n                }\n                this.editor_$.find(\".Rk-Edit-Title\")[0].focus();\n\n                var _picker = _this.editor_$.find(\".Rk-Edit-ColorPicker\");\n\n                this.editor_$.find(\".Rk-Edit-ColorPicker-Wrapper\").hover(\n                        function(_e) {\n                            _e.preventDefault();\n                            _picker.show();\n                        },\n                        function(_e) {\n                            _e.preventDefault();\n                            _picker.hide();\n                        }\n                );\n\n                _picker.find(\"li\").hover(\n                        function(_e) {\n                            _e.preventDefault();\n                            _this.editor_$.find(\".Rk-Edit-Color\").css(\"background\", $(this).attr(\"data-color\"));\n                        },\n                        function(_e) {\n                            _e.preventDefault();\n                            _this.editor_$.find(\".Rk-Edit-Color\").css(\"background\", _model.get(\"color\") || (_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(_this.renkan)).get(\"color\"));\n                        }\n                ).click(function(_e) {\n                    _e.preventDefault();\n                    if (_this.renderer.isEditable()) {\n                        _model.set(\"color\", $(this).attr(\"data-color\"));\n                        _picker.hide();\n                        paper.view.draw();\n                    } else {\n                        closeEditor();\n                    }\n                });\n\n                var shiftSize = function(n) {\n                    if (_this.renderer.isEditable()) {\n                        var _newsize = n+(_model.get(\"size\") || 0);\n                        _this.editor_$.find(\".Rk-Edit-Size-Value\").text((_newsize > 0 ? \"+\" : \"\") + _newsize);\n                        _model.set(\"size\", _newsize);\n                        paper.view.draw();\n                    } else {\n                        closeEditor();\n                    }\n                };\n\n                this.editor_$.find(\".Rk-Edit-Size-Down\").click(function() {\n                    shiftSize(-1);\n                    return false;\n                });\n                this.editor_$.find(\".Rk-Edit-Size-Up\").click(function() {\n                    shiftSize(1);\n                    return false;\n                });\n                \n                this.editor_$.find(\".Rk-Edit-Image-Del\").click(function() {\n                \t_this.editor_$.find(\".Rk-Edit-Image\").val('');\n                \tonFieldChange();\n                    return false;\n                });\n            } else {\n                if (typeof this.source_representation.highlighted === \"object\") {\n                    var titlehtml = this.source_representation.highlighted.replace(_(_model.get(\"title\")).escape(),'<span class=\"Rk-Highlighted\">$1</span>');\n                    this.editor_$.find(\".Rk-Display-Title\" + (_model.get(\"uri\") ? \" a\" : \"\")).html(titlehtml);\n                    if (this.options.show_node_tooltip_description) {\n                        this.editor_$.find(\".Rk-Display-Description\").html(this.source_representation.highlighted.replace(_(_model.get(\"description\")).escape(),'<span class=\"Rk-Highlighted\">$1</span>'));\n                    }\n                }\n            }\n            this.editor_$.find(\"img\").load(function() {\n                _this.redraw();\n            });\n        },\n        redraw: function() {\n            var _coords = this.source_representation.paper_coords;\n            Utils.drawEditBox(this.options, _coords, this.editor_block, this.source_representation.circle_radius * 0.75, this.editor_$);\n            this.editor_$.show();\n            paper.view.draw();\n        }\n    });\n\n    /* NodeEditor End */\n\n    return NodeEditor;\n\n});\n\n\ndefine('renderer/edgeeditor',['jquery', 'underscore', 'requtils', 'renderer/baseeditor'], function ($, _, requtils, BaseEditor) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* EdgeEditor Begin */\n\n    //var EdgeEditor = Renderer.EdgeEditor = Utils.inherit(Renderer._BaseEditor);\n    var EdgeEditor = Utils.inherit(BaseEditor);\n\n    _(EdgeEditor.prototype).extend({\n    \t_init: function() {\n    \t\tBaseEditor.prototype._init.apply(this);\n    \t\tthis.template = this.options.templates['templates/edgeeditor.html'];\n    \t\tthis.readOnlyTemplate = this.options.templates['templates/edgeeditor_readonly.html'];\n    \t},\n        draw: function() {\n            var _model = this.source_representation.model,\n            _from_model = _model.get(\"from\"),\n            _to_model = _model.get(\"to\"),\n            _created_by = _model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan),\n            _template = (this.renderer.isEditable() ? this.template : this.readOnlyTemplate);\n            this.editor_$\n            .html(_template({\n                edge: {\n                    has_creator: !!_model.get(\"created_by\"),\n                    title: _model.get(\"title\"),\n                    uri: _model.get(\"uri\"),\n                    short_uri:  Utils.shortenText((_model.get(\"uri\") || \"\").replace(/^(https?:\\/\\/)?(www\\.)?/,'').replace(/\\/$/,''),40),\n                    description: _model.get(\"description\"),\n                    color: _model.get(\"color\") || _created_by.get(\"color\"),\n                    from_title: _from_model.get(\"title\"),\n                    to_title: _to_model.get(\"title\"),\n                    from_color: _from_model.get(\"color\") || (_from_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n                    to_color: _to_model.get(\"color\") || (_to_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n                    created_by_color: _created_by.get(\"color\"),\n                    created_by_title: _created_by.get(\"title\")\n                },\n                renkan: this.renkan,\n                shortenText: Utils.shortenText,\n                options: this.options\n            }));\n            this.redraw();\n            var _this = this,\n            closeEditor = function() {\n                _this.renderer.removeRepresentation(_this);\n                paper.view.draw();\n            };\n            this.editor_$.find(\".Rk-CloseX\").click(closeEditor);\n            this.editor_$.find(\".Rk-Edit-Goto\").click(function() {\n                if (!_model.get(\"uri\")) {\n                    return false;\n                }\n            });\n\n            if (this.renderer.isEditable()) {\n\n                var onFieldChange = _(function() {\n                    _(function() {\n                        if (_this.renderer.isEditable()) {\n                            var _data = {\n                                    title: _this.editor_$.find(\".Rk-Edit-Title\").val()\n                            };\n                            if (_this.options.show_edge_editor_uri) {\n                                _data.uri = _this.editor_$.find(\".Rk-Edit-URI\").val();\n                            }\n                            _this.editor_$.find(\".Rk-Edit-Goto\").attr(\"href\",_data.uri || \"#\");\n                            _model.set(_data);\n                            paper.view.draw();\n                        } else {\n                            closeEditor();\n                        }\n                    }).defer();\n                }).throttle(500);\n\n                this.editor_$.on(\"keyup\", function(_e) {\n                    if (_e.keyCode === 27) {\n                        closeEditor();\n                    }\n                });\n\n                this.editor_$.find(\"input\").on(\"keyup change paste\", onFieldChange);\n\n                this.editor_$.find(\".Rk-Edit-Vocabulary\").change(function() {\n                    var e = $(this),\n                    v = e.val();\n                    if (v) {\n                        _this.editor_$.find(\".Rk-Edit-Title\").val(e.find(\":selected\").text());\n                        _this.editor_$.find(\".Rk-Edit-URI\").val(v);\n                        onFieldChange();\n                    }\n                });\n                this.editor_$.find(\".Rk-Edit-Direction\").click(function() {\n                    if (_this.renderer.isEditable()) {\n                        _model.set({\n                            from: _model.get(\"to\"),\n                            to: _model.get(\"from\")\n                        });\n                        _this.draw();\n                    } else {\n                        closeEditor();\n                    }\n                });\n\n                var _picker = _this.editor_$.find(\".Rk-Edit-ColorPicker\");\n\n                this.editor_$.find(\".Rk-Edit-ColorPicker-Wrapper\").hover(\n                        function(_e) {\n                            _e.preventDefault();\n                            _picker.show();\n                        },\n                        function(_e) {\n                            _e.preventDefault();\n                            _picker.hide();\n                        }\n                );\n\n                _picker.find(\"li\").hover(\n                        function(_e) {\n                            _e.preventDefault();\n                            _this.editor_$.find(\".Rk-Edit-Color\").css(\"background\", $(this).attr(\"data-color\"));\n                        },\n                        function(_e) {\n                            _e.preventDefault();\n                            _this.editor_$.find(\".Rk-Edit-Color\").css(\"background\", _model.get(\"color\") || (_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(_this.renkan)).get(\"color\"));\n                        }\n                ).click(function(_e) {\n                    _e.preventDefault();\n                    if (_this.renderer.isEditable()) {\n                        _model.set(\"color\", $(this).attr(\"data-color\"));\n                        _picker.hide();\n                        paper.view.draw();\n                    } else {\n                        closeEditor();\n                    }\n                });\n            }\n        },\n        redraw: function() {\n            var _coords = this.source_representation.paper_coords;\n            Utils.drawEditBox(this.options, _coords, this.editor_block, 5, this.editor_$);\n            this.editor_$.show();\n            paper.view.draw();\n        }\n    });\n\n    /* EdgeEditor End */\n\n    return EdgeEditor;\n\n});\n\n\ndefine('renderer/nodebutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* _NodeButton Begin */\n\n    //var _NodeButton = Renderer._NodeButton = Utils.inherit(Renderer._BaseButton);\n    var _NodeButton = Utils.inherit(BaseButton);\n\n    _(_NodeButton.prototype).extend({\n        setSectorSize: function() {\n            var sectorInner = this.source_representation.circle_radius;\n            if (sectorInner !== this.lastSectorInner) {\n                if (this.sector) {\n                    this.sector.destroy();\n                }\n                this.sector = this.renderer.drawSector(\n                        this, 1 + sectorInner,\n                        Utils._NODE_BUTTON_WIDTH + sectorInner,\n                        this.startAngle,\n                        this.endAngle,\n                        1,\n                        this.imageName,\n                        this.renkan.translate(this.text)\n                );\n                this.lastSectorInner = sectorInner;\n            }\n        },\n        unselect: function() {\n            BaseButton.prototype.unselect.apply(this, Array.prototype.slice.call(arguments, 1));\n            if(this.source_representation && this.source_representation.buttons_timeout) {\n                clearTimeout(this.source_representation.buttons_timeout);\n                this.source_representation.hideButtons();\n            }\n        },\n        select: function() {\n            if(this.source_representation && this.source_representation.buttons_timeout) {\n                clearTimeout(this.source_representation.buttons_timeout);\n            }\n            this.sector.select();\n        },\n    });\n\n    /* _NodeButton End */\n\n    return _NodeButton;\n\n});\n\n\ndefine('renderer/nodeeditbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* NodeEditButton Begin */\n\n    //var NodeEditButton = Renderer.NodeEditButton = Utils.inherit(Renderer._NodeButton);\n    var NodeEditButton = Utils.inherit(NodeButton);\n\n    _(NodeEditButton.prototype).extend({\n        _init: function() {\n            this.type = \"Node-edit-button\";\n            this.lastSectorInner = 0;\n            this.startAngle = -135;\n            this.endAngle = -45;\n            this.imageName = \"edit\";\n            this.text = \"Edit\";\n        },\n        mouseup: function() {\n            if (!this.renderer.is_dragging) {\n                this.source_representation.openEditor();\n            }\n        }\n    });\n\n    /* NodeEditButton End */\n\n    return NodeEditButton;\n\n});\n\n\ndefine('renderer/noderemovebutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n    \n    \n    var Utils = requtils.getUtils();\n\n    /* NodeRemoveButton Begin */\n\n    //var NodeRemoveButton = Renderer.NodeRemoveButton = Utils.inherit(Renderer._NodeButton);\n    var NodeRemoveButton = Utils.inherit(NodeButton);\n\n    _(NodeRemoveButton.prototype).extend({\n        _init: function() {\n            this.type = \"Node-remove-button\";\n            this.lastSectorInner = 0;\n            this.startAngle = 0;\n            this.endAngle = 90;\n            this.imageName = \"remove\";\n            this.text = \"Remove\";\n        },\n        mouseup: function() {\n            this.renderer.click_target = null;\n            this.renderer.is_dragging = false;\n            this.renderer.removeRepresentationsOfType(\"editor\");\n            if (this.renderer.isEditable()) {\n                if (this.options.element_delete_delay) {\n                    var delid = Utils.getUID(\"delete\");\n                    this.renderer.delete_list.push({\n                        id: delid,\n                        time: new Date().valueOf() + this.options.element_delete_delay\n                    });\n                    this.source_representation.model.set(\"delete_scheduled\", delid);\n                } else {\n                    if (confirm(this.renkan.translate('Do you really wish to remove node ') + '\"' + this.source_representation.model.get(\"title\") + '\"?')) {\n                        this.project.removeNode(this.source_representation.model);\n                    }\n                }\n            }\n        }\n    });\n\n    /* NodeRemoveButton End */\n\n    return NodeRemoveButton;\n\n});\n\n\ndefine('renderer/noderevertbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* NodeRevertButton Begin */\n\n    //var NodeRevertButton = Renderer.NodeRevertButton = Utils.inherit(Renderer._NodeButton);\n    var NodeRevertButton = Utils.inherit(NodeButton);\n\n    _(NodeRevertButton.prototype).extend({\n        _init: function() {\n            this.type = \"Node-revert-button\";\n            this.lastSectorInner = 0;\n            this.startAngle = -135;\n            this.endAngle = 135;\n            this.imageName = \"revert\";\n            this.text = \"Cancel deletion\";\n        },\n        mouseup: function() {\n            this.renderer.click_target = null;\n            this.renderer.is_dragging = false;\n            if (this.renderer.isEditable()) {\n                this.source_representation.model.unset(\"delete_scheduled\");\n            }\n        }\n    });\n\n    /* NodeRevertButton End */\n\n    return NodeRevertButton;\n\n});\n\n\ndefine('renderer/nodelinkbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* NodeLinkButton Begin */\n\n    //var NodeLinkButton = Renderer.NodeLinkButton = Utils.inherit(Renderer._NodeButton);\n    var NodeLinkButton = Utils.inherit(NodeButton);\n\n    _(NodeLinkButton.prototype).extend({\n        _init: function() {\n            this.type = \"Node-link-button\";\n            this.lastSectorInner = 0;\n            this.startAngle = 90;\n            this.endAngle = 180;\n            this.imageName = \"link\";\n            this.text = \"Link to another node\";\n        },\n        mousedown: function(_event, _isTouch) {\n            if (this.renderer.isEditable()) {\n                var _off = this.renderer.canvas_$.offset(),\n                _point = new paper.Point([\n                                          _event.pageX - _off.left,\n                                          _event.pageY - _off.top\n                                          ]);\n                this.renderer.click_target = null;\n                this.renderer.removeRepresentationsOfType(\"editor\");\n                this.renderer.addTempEdge(this.source_representation, _point);\n            }\n        }\n    });\n\n    /* NodeLinkButton End */\n\n    return NodeLinkButton;\n\n});\n\n\n\ndefine('renderer/nodeenlargebutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n    \n    \n    var Utils = requtils.getUtils();\n\n    /* NodeEnlargeButton Begin */\n\n    //var NodeEnlargeButton = Renderer.NodeEnlargeButton = Utils.inherit(Renderer._NodeButton);\n    var NodeEnlargeButton = Utils.inherit(NodeButton);\n\n    _(NodeEnlargeButton.prototype).extend({\n        _init: function() {\n            this.type = \"Node-enlarge-button\";\n            this.lastSectorInner = 0;\n            this.startAngle = -45;\n            this.endAngle = 0;\n            this.imageName = \"enlarge\";\n            this.text = \"Enlarge\";\n        },\n        mouseup: function() {\n            var _newsize = 1 + (this.source_representation.model.get(\"size\") || 0);\n            this.source_representation.model.set(\"size\", _newsize);\n            this.source_representation.select();\n            this.select();\n            paper.view.draw();\n        }\n    });\n\n    /* NodeEnlargeButton End */\n\n    return NodeEnlargeButton;\n\n});\n\n\ndefine('renderer/nodeshrinkbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* NodeShrinkButton Begin */\n\n    //var NodeShrinkButton = Renderer.NodeShrinkButton = Utils.inherit(Renderer._NodeButton);\n    var NodeShrinkButton = Utils.inherit(NodeButton);\n\n    _(NodeShrinkButton.prototype).extend({\n        _init: function() {\n            this.type = \"Node-shrink-button\";\n            this.lastSectorInner = 0;\n            this.startAngle = -180;\n            this.endAngle = -135;\n            this.imageName = \"shrink\";\n            this.text = \"Shrink\";\n        },\n        mouseup: function() {\n            var _newsize = -1 + (this.source_representation.model.get(\"size\") || 0);\n            this.source_representation.model.set(\"size\", _newsize);\n            this.source_representation.select();\n            this.select();\n            paper.view.draw();\n        }\n    });\n\n    /* NodeShrinkButton End */\n\n    return NodeShrinkButton;\n\n});\n\n\ndefine('renderer/edgeeditbutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* EdgeEditButton Begin */\n\n    //var EdgeEditButton = Renderer.EdgeEditButton = Utils.inherit(Renderer._BaseButton);\n    var EdgeEditButton = Utils.inherit(BaseButton);\n\n    _(EdgeEditButton.prototype).extend({\n        _init: function() {\n            this.type = \"Edge-edit-button\";\n            this.sector = this.renderer.drawSector(this, Utils._EDGE_BUTTON_INNER, Utils._EDGE_BUTTON_OUTER, -270, -90, 1, \"edit\", this.renkan.translate(\"Edit\"));\n        },\n        mouseup: function() {\n            if (!this.renderer.is_dragging) {\n                this.source_representation.openEditor();\n            }\n        }\n    });\n\n    /* EdgeEditButton End */\n\n    return EdgeEditButton;\n\n});\n\n\ndefine('renderer/edgeremovebutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* EdgeRemoveButton Begin */\n\n    //var EdgeRemoveButton = Renderer.EdgeRemoveButton = Utils.inherit(Renderer._BaseButton);\n    var EdgeRemoveButton = Utils.inherit(BaseButton);\n\n    _(EdgeRemoveButton.prototype).extend({\n        _init: function() {\n            this.type = \"Edge-remove-button\";\n            this.sector = this.renderer.drawSector(this, Utils._EDGE_BUTTON_INNER, Utils._EDGE_BUTTON_OUTER, -90, 90, 1, \"remove\", this.renkan.translate(\"Remove\"));\n        },\n        mouseup: function() {\n            this.renderer.click_target = null;\n            this.renderer.is_dragging = false;\n            this.renderer.removeRepresentationsOfType(\"editor\");\n            if (this.renderer.isEditable()) {\n                if (this.options.element_delete_delay) {\n                    var delid = Utils.getUID(\"delete\");\n                    this.renderer.delete_list.push({\n                        id: delid,\n                        time: new Date().valueOf() + this.options.element_delete_delay\n                    });\n                    this.source_representation.model.set(\"delete_scheduled\", delid);\n                } else {\n                    if (confirm(this.renkan.translate('Do you really wish to remove edge ') + '\"' + this.source_representation.model.get(\"title\") + '\"?')) {\n                        this.project.removeEdge(this.source_representation.model);\n                    }\n                }\n            }\n        }\n    });\n\n    /* EdgeRemoveButton End */\n\n    return EdgeRemoveButton;\n\n});\n\n\ndefine('renderer/edgerevertbutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* EdgeRevertButton Begin */\n\n    //var EdgeRevertButton = Renderer.EdgeRevertButton = Utils.inherit(Renderer._BaseButton);\n    var EdgeRevertButton = Utils.inherit(BaseButton);\n\n    _(EdgeRevertButton.prototype).extend({\n        _init: function() {\n            this.type = \"Edge-revert-button\";\n            this.sector = this.renderer.drawSector(this, Utils._EDGE_BUTTON_INNER, Utils._EDGE_BUTTON_OUTER, -135, 135, 1, \"revert\", this.renkan.translate(\"Cancel deletion\"));\n        },\n        mouseup: function() {\n            this.renderer.click_target = null;\n            this.renderer.is_dragging = false;\n            if (this.renderer.isEditable()) {\n                this.source_representation.model.unset(\"delete_scheduled\");\n            }\n        }\n    });\n\n    /* EdgeRevertButton End */\n\n    return EdgeRevertButton;\n\n});\n\n\ndefine('renderer/miniframe',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* MiniFrame Begin */\n\n    //var MiniFrame = Renderer.MiniFrame = Utils.inherit(Renderer._BaseRepresentation);\n    var MiniFrame = Utils.inherit(BaseRepresentation);\n\n    _(MiniFrame.prototype).extend({\n        paperShift: function(_delta) {\n            this.renderer.offset = this.renderer.offset.subtract(_delta.divide(this.renderer.minimap.scale).multiply(this.renderer.scale));\n            this.renderer.redraw();\n        },\n        mouseup: function(_delta) {\n            this.renderer.click_target = null;\n            this.renderer.is_dragging = false;\n        }\n    });\n\n    /* MiniFrame End */\n\n    return MiniFrame;\n\n});\n\n\ndefine('renderer/scene',['jquery', 'underscore', 'filesaver', 'requtils', 'renderer/miniframe'], function ($, _, filesaver, requtils, MiniFrame) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* Scene Begin */\n\n    var Scene = function(_renkan) {\n        this.renkan = _renkan;\n        this.$ = $(\".Rk-Render\");\n        this.representations = [];\n        this.$.html(_renkan.options.templates['templates/scene.html'](_renkan));\n        this.onStatusChange();\n        this.canvas_$ = this.$.find(\".Rk-Canvas\");\n        this.labels_$ = this.$.find(\".Rk-Labels\");\n        this.editor_$ = this.$.find(\".Rk-Editor\");\n        this.notif_$ = this.$.find(\".Rk-Notifications\");\n        paper.setup(this.canvas_$[0]);\n        this.scale = 1;\n        this.initialScale = 1;\n        this.offset = paper.view.center;\n        this.totalScroll = 0;\n        this.mouse_down = false;\n        this.click_target = null;\n        this.selected_target = null;\n        this.edge_layer = new paper.Layer();\n        this.node_layer = new paper.Layer();\n        this.buttons_layer = new paper.Layer();\n        this.delete_list = [];\n        this.redrawActive = true;\n        \n        if (_renkan.options.show_minimap) {\n            this.minimap = {\n                    background_layer: new paper.Layer(),\n                    edge_layer: new paper.Layer(),\n                    node_layer: new paper.Layer(),\n                    node_group: new paper.Group(),\n                    size: new paper.Size( _renkan.options.minimap_width, _renkan.options.minimap_height )\n            };\n\n            this.minimap.background_layer.activate();\n            this.minimap.topleft = paper.view.bounds.bottomRight.subtract(this.minimap.size);\n            this.minimap.rectangle = new paper.Path.Rectangle(this.minimap.topleft.subtract([2,2]), this.minimap.size.add([4,4]));\n            this.minimap.rectangle.fillColor = _renkan.options.minimap_background_color;\n            this.minimap.rectangle.strokeColor = _renkan.options.minimap_border_color;\n            this.minimap.rectangle.strokeWidth = 4;\n            this.minimap.offset = new paper.Point(this.minimap.size.divide(2));\n            this.minimap.scale = 0.1;\n\n            this.minimap.node_layer.activate();\n            this.minimap.cliprectangle = new paper.Path.Rectangle(this.minimap.topleft, this.minimap.size);\n            this.minimap.node_group.addChild(this.minimap.cliprectangle);\n            this.minimap.node_group.clipped = true;\n            this.minimap.miniframe = new paper.Path.Rectangle(this.minimap.topleft, this.minimap.size);\n            this.minimap.node_group.addChild(this.minimap.miniframe);\n            this.minimap.miniframe.fillColor = '#c0c0ff';\n            this.minimap.miniframe.opacity = 0.3;\n            this.minimap.miniframe.strokeColor = '#000080';\n            this.minimap.miniframe.strokeWidth = 2;\n            this.minimap.miniframe.__representation = new MiniFrame(this, null);\n        }\n\n        this.throttledPaperDraw = _(function() {\n            paper.view.draw();\n        }).throttle(100);\n\n        this.bundles = [];\n        this.click_mode = false;\n\n        var _this = this,\n        _allowScroll = true,\n        _originalScale = 1,\n        _zooming = false,\n        _lastTapX = 0,\n        _lastTapY = 0;\n\n        this.image_cache = {};\n        this.icon_cache = {};\n\n        ['edit', 'remove', 'link', 'enlarge', 'shrink', 'revert' ].forEach(function(imgname) {\n            var img = new Image();\n            img.src = _renkan.options.static_url + 'img/' + imgname + '.png';\n            _this.icon_cache[imgname] = img;\n        });\n\n        var throttledMouseMove = _.throttle(function(_event, _isTouch) {\n            _this.onMouseMove(_event, _isTouch);\n        }, Utils._MOUSEMOVE_RATE);\n\n        this.canvas_$.on({\n            mousedown: function(_event) {\n                _event.preventDefault();\n                _this.onMouseDown(_event, false);\n            },\n            mousemove: function(_event) {\n                _event.preventDefault();\n                throttledMouseMove(_event, false);\n            },\n            mouseup: function(_event) {\n                _event.preventDefault();\n                _this.onMouseUp(_event, false);\n            },\n            mousewheel: function(_event, _delta) {\n                if(_renkan.options.zoom_on_scroll) {\n                    _event.preventDefault();\n                    if (_allowScroll) {\n                        _this.onScroll(_event, _delta);\n                    }\n                }\n            },\n            touchstart: function(_event) {\n                _event.preventDefault();\n                var _touches = _event.originalEvent.touches[0];\n                if (\n                        _renkan.options.allow_double_click &&\n                        new Date() - _lastTap < Utils._DOUBLETAP_DELAY &&\n                        ( Math.pow(_lastTapX - _touches.pageX, 2) + Math.pow(_lastTapY - _touches.pageY, 2) < Utils._DOUBLETAP_DISTANCE )\n                ) {\n                    _lastTap = 0;\n                    _this.onDoubleClick(_touches);\n                } else {\n                    _lastTap = new Date();\n                    _lastTapX = _touches.pageX;\n                    _lastTapY = _touches.pageY;\n                    _originalScale = _this.scale;\n                    _zooming = false;\n                    _this.onMouseDown(_touches, true);\n                }\n            },\n            touchmove: function(_event) {\n                _event.preventDefault();\n                _lastTap = 0;\n                if (_event.originalEvent.touches.length === 1) {\n                    _this.onMouseMove(_event.originalEvent.touches[0], true);\n                } else {\n                    if (!_zooming) {\n                        _this.onMouseUp(_event.originalEvent.touches[0], true);\n                        _this.click_target = null;\n                        _this.is_dragging = false;\n                        _zooming = true;\n                    }\n                    if (_event.originalEvent.scale === \"undefined\") {\n                        return;\n                    }\n                    var _newScale = _event.originalEvent.scale * _originalScale,\n                    _scaleRatio = _newScale / _this.scale,\n                    _newOffset = new paper.Point([\n                                                  _this.canvas_$.width(),\n                                                  _this.canvas_$.height()\n                                                  ]).multiply( 0.5 * ( 1 - _scaleRatio ) ).add(_this.offset.multiply( _scaleRatio ));\n                    _this.setScale(_newScale, _newOffset);\n                }\n            },\n            touchend: function(_event) {\n                _event.preventDefault();\n                _this.onMouseUp(_event.originalEvent.changedTouches[0], true);\n            },\n            dblclick: function(_event) {\n                _event.preventDefault();\n                if (_renkan.options.allow_double_click) {\n                    _this.onDoubleClick(_event);\n                }\n            },\n            mouseleave: function(_event) {\n                _event.preventDefault();\n                _this.onMouseUp(_event, false);\n                _this.click_target = null;\n                _this.is_dragging = false;\n            },\n            dragover: function(_event) {\n                _event.preventDefault();\n            },\n            dragenter: function(_event) {\n                _event.preventDefault();\n                _allowScroll = false;\n            },\n            dragleave: function(_event) {\n                _event.preventDefault();\n                _allowScroll = true;\n            },\n            drop: function(_event) {\n                _event.preventDefault();\n                _allowScroll = true;\n                var res = {};\n                _(_event.originalEvent.dataTransfer.types).each(function(t) {\n                    try {\n                        res[t] = _event.originalEvent.dataTransfer.getData(t);\n                    } catch(e) {}\n                });\n                var text = _event.originalEvent.dataTransfer.getData(\"Text\");\n                if (typeof text === \"string\") {\n                    switch(text[0]) {\n                    case \"{\":\n                    case \"[\":\n                        try {\n                            var data = JSON.parse(text);\n                            _(res).extend(data);\n                        }\n                        catch(e) {\n                            if (!res[\"text/plain\"]) {\n                                res[\"text/plain\"] = text;\n                            }\n                        }\n                        break;\n                    case \"<\":\n                        if (!res[\"text/html\"]) {\n                            res[\"text/html\"] = text;\n                        }\n                        break;\n                    default:\n                        if (!res[\"text/plain\"]) {\n                            res[\"text/plain\"] = text;\n                        }\n                    }\n                }\n                var url = _event.originalEvent.dataTransfer.getData(\"URL\");\n                if (url && !res[\"text/uri-list\"]) {\n                    res[\"text/uri-list\"] = url;\n                }\n                _this.dropData(res, _event.originalEvent);\n            }\n        });\n\n        var bindClick = function(selector, fname) {\n            _this.$.find(selector).click(function(evt) {\n                _this[fname](evt);\n                return false;\n            });\n        };\n\n        bindClick(\".Rk-ZoomOut\", \"zoomOut\");\n        bindClick(\".Rk-ZoomIn\", \"zoomIn\");\n        bindClick(\".Rk-ZoomFit\", \"autoScale\");\n        this.$.find(\".Rk-ZoomSave\").click( function() {\n            // Save scale and offset point\n            _this.renkan.project.addView( { zoom_level:_this.scale, offset:_this.offset } );\n        });\n        this.$.find(\".Rk-ZoomSetSaved\").click( function() {\n            var view = _this.renkan.project.get(\"views\").last();\n            if(view){\n                _this.setScale(view.get(\"zoom_level\"), new paper.Point(view.get(\"offset\")));\n            }\n        });\n        if(this.renkan.project.get(\"views\").length > 0 && this.renkan.options.save_view){\n            this.$.find(\".Rk-ZoomSetSaved\").show();\n        }\n        this.$.find(\".Rk-CurrentUser\").mouseenter(\n                function() { _this.$.find(\".Rk-UserList\").slideDown(); }\n        );\n        this.$.find(\".Rk-Users\").mouseleave(\n                function() { _this.$.find(\".Rk-UserList\").slideUp(); }\n        );\n        bindClick(\".Rk-FullScreen-Button\", \"fullScreen\");\n        bindClick(\".Rk-AddNode-Button\", \"addNodeBtn\");\n        bindClick(\".Rk-AddEdge-Button\", \"addEdgeBtn\");\n        bindClick(\".Rk-Save-Button\", \"save\");\n        bindClick(\".Rk-Open-Button\", \"open\");\n        bindClick(\".Rk-Export-Button\", \"exportProject\");\n        this.$.find(\".Rk-Bookmarklet-Button\")\n          /*jshint scripturl:true */\n          .attr(\"href\",\"javascript:\" + Utils._BOOKMARKLET_CODE(_renkan))\n          .click(function(){\n              _this.notif_$\n              .text(_renkan.translate(\"Drag this button to your bookmark bar. When on a third-party website, click it to enable drag-and-drop from the website to Renkan.\"))\n              .fadeIn()\n              .delay(5000)\n              .fadeOut();\n              return false;\n          });\n        this.$.find(\".Rk-TopBar-Button\").mouseover(function() {\n            $(this).find(\".Rk-TopBar-Tooltip\").show();\n        }).mouseout(function() {\n            $(this).find(\".Rk-TopBar-Tooltip\").hide();\n        });\n        bindClick(\".Rk-Fold-Bins\", \"foldBins\");\n\n        paper.view.onResize = function(_event) {\n            var _ratio,\n                newWidth = _event.width,\n                newHeight = _event.height;\n\n            if (_this.minimap) {\n                _this.minimap.topleft = paper.view.bounds.bottomRight.subtract(_this.minimap.size);\n                _this.minimap.rectangle.fitBounds(_this.minimap.topleft.subtract([2,2]), _this.minimap.size.add([4,4]));\n                _this.minimap.cliprectangle.fitBounds(_this.minimap.topleft, _this.minimap.size);\n            }\n\n            var ratioH = newHeight/(newHeight-_event.delta.height),\n                ratioW = newWidth/(newWidth-_event.delta.width);\n            if (newHeight < newWidth) {\n                    _ratio = ratioH;\n            } else {\n                _ratio = ratioW;\n            }\n\n            _this.resizeZoom(ratioW, ratioH, _ratio);\n\n            _this.redraw();\n\n        };\n\n        var _thRedraw = _.throttle(function() {\n            _this.redraw();\n        },50);\n\n        this.addRepresentations(\"Node\", this.renkan.project.get(\"nodes\"));\n        this.addRepresentations(\"Edge\", this.renkan.project.get(\"edges\"));\n        this.renkan.project.on(\"change:title\", function() {\n            _this.$.find(\".Rk-PadTitle\").val(_renkan.project.get(\"title\"));\n        });\n\n        this.$.find(\".Rk-PadTitle\").on(\"keyup input paste\", function() {\n            _renkan.project.set({\"title\": $(this).val()});\n        });\n\n        var _thRedrawUsers = _.throttle(function() {\n            _this.redrawUsers();\n        }, 100);\n\n        _thRedrawUsers();\n\n        // register model events\n        this.renkan.project.on(\"change:save_status\", function(){\n            switch (_this.renkan.project.get(\"save_status\")) {\n                case 0: //clean\n                    _this.$.find(\".Rk-Save-Button\").removeClass(\"to-save\");\n                    _this.$.find(\".Rk-Save-Button\").removeClass(\"saving\");\n                    _this.$.find(\".Rk-Save-Button\").addClass(\"saved\");\n                    break;\n                case 1: //dirty\n                    _this.$.find(\".Rk-Save-Button\").removeClass(\"saved\");\n                    _this.$.find(\".Rk-Save-Button\").removeClass(\"saving\");\n                    _this.$.find(\".Rk-Save-Button\").addClass(\"to-save\");\n                    break;\n                case 2: //saving\n                    _this.$.find(\".Rk-Save-Button\").removeClass(\"saved\");\n                    _this.$.find(\".Rk-Save-Button\").removeClass(\"to-save\");\n                    _this.$.find(\".Rk-Save-Button\").addClass(\"saving\");\n                    break;\n            }\n        });\n\n        this.renkan.project.on(\"change:loading_status\", function(){\n            if (_this.renkan.project.get(\"loading_status\")){\n                var animate = _this.$.find(\".loader\").addClass(\"run\");\n                var timer = setTimeout(function(){\n                    _this.$.find(\".loader\").hide(250);\n                }, 3000);\n            }\n        });\n\n        this.renkan.project.on(\"add:users remove:users\", _thRedrawUsers);\n\n        this.renkan.project.on(\"add:views remove:views\", function(_node) {\n            if(_this.renkan.project.get('views').length > 0) {\n                _this.$.find(\".Rk-ZoomSetSaved\").show();\n            }\n            else {\n                _this.$.find(\".Rk-ZoomSetSaved\").hide();\n            }\n        });\n\n        this.renkan.project.on(\"add:nodes\", function(_node) {\n            _this.addRepresentation(\"Node\", _node);\n            if (!_this.renkan.project.get(\"loading_status\")){\n                _thRedraw();\n            }\n        });\n        this.renkan.project.on(\"add:edges\", function(_edge) {\n            _this.addRepresentation(\"Edge\", _edge);\n            if (!_this.renkan.project.get(\"loading_status\")){\n                _thRedraw();\n            }\n        });\n        this.renkan.project.on(\"change:title\", function(_model, _title) {\n            var el = _this.$.find(\".Rk-PadTitle\");\n            if (el.is(\"input\")) {\n                if (el.val() !== _title) {\n                    el.val(_title);\n                }\n            } else {\n                el.text(_title);\n            }\n        });\n\n        if (_renkan.options.size_bug_fix) {\n            var _delay = (\n                    typeof _renkan.options.size_bug_fix === \"number\" ?\n                        _renkan.options.size_bug_fix\n                                : 500\n            );\n            window.setTimeout(\n                    function() {\n                        _this.fixSize();\n                    },\n                    _delay\n            );\n        }\n\n        if (_renkan.options.force_resize) {\n            $(window).resize(function() {\n                _this.autoScale();\n            });\n        }\n\n        if (_renkan.options.show_user_list && _renkan.options.user_color_editable) {\n            var $cpwrapper = this.$.find(\".Rk-Users .Rk-Edit-ColorPicker-Wrapper\"),\n            $cplist = this.$.find(\".Rk-Users .Rk-Edit-ColorPicker\");\n\n            $cpwrapper.hover(\n                    function(_e) {\n                        if (_this.isEditable()) {\n                            _e.preventDefault();\n                            $cplist.show();\n                        }\n                    },\n                    function(_e) {\n                        _e.preventDefault();\n                        $cplist.hide();\n                    }\n            );\n\n            $cplist.find(\"li\").mouseenter(\n                    function(_e) {\n                        if (_this.isEditable()) {\n                            _e.preventDefault();\n                            _this.$.find(\".Rk-CurrentUser-Color\").css(\"background\", $(this).attr(\"data-color\"));\n                        }\n                    }\n            );\n        }\n\n        if (_renkan.options.show_search_field) {\n\n            var lastval = '';\n\n            this.$.find(\".Rk-GraphSearch-Field\").on(\"keyup change paste input\", function() {\n                var $this = $(this),\n                val = $this.val();\n                if (val === lastval) {\n                    return;\n                }\n                lastval = val;\n                if (val.length < 2) {\n                    _renkan.project.get(\"nodes\").each(function(n) {\n                        _this.getRepresentationByModel(n).unhighlight();\n                    });\n                } else {\n                    var rxs = Utils.regexpFromTextOrArray(val);\n                    _renkan.project.get(\"nodes\").each(function(n) {\n                        if (rxs.test(n.get(\"title\")) || rxs.test(n.get(\"description\"))) {\n                            _this.getRepresentationByModel(n).highlight(rxs);\n                        } else {\n                            _this.getRepresentationByModel(n).unhighlight();\n                        }\n                    });\n                }\n            });\n        }\n\n        this.redraw();\n\n        window.setInterval(function() {\n            var _now = new Date().valueOf();\n            _this.delete_list.forEach(function(d) {\n                if (_now >= d.time) {\n                    var el = _renkan.project.get(\"nodes\").findWhere({\"delete_scheduled\":d.id});\n                    if (el) {\n                        project.removeNode(el);\n                    }\n                    el = _renkan.project.get(\"edges\").findWhere({\"delete_scheduled\":d.id});\n                    if (el) {\n                        project.removeEdge(el);\n                    }\n                }\n            });\n            _this.delete_list = _this.delete_list.filter(function(d) {\n                return _renkan.project.get(\"nodes\").findWhere({\"delete_scheduled\":d.id}) || _renkan.project.get(\"edges\").findWhere({\"delete_scheduled\":d.id});\n            });\n        }, 500);\n\n        if (this.minimap) {\n            window.setInterval(function() {\n                _this.rescaleMinimap();\n            }, 2000);\n        }\n\n    };\n\n    _(Scene.prototype).extend({\n        fixSize: function() {\n            if( this.renkan.options.default_view && this.renkan.project.get(\"views\").length > 0) {\n                var view = this.renkan.project.get(\"views\").last();\n                this.setScale(view.get(\"zoom_level\"), new paper.Point(view.get(\"offset\")));\n            }\n            else{\n                this.autoScale();\n            }\n        },\n        drawSector: function(_repr, _inR, _outR, _startAngle, _endAngle, _padding, _imgname, _caption) {\n            var _options = this.renkan.options,\n                _startRads = _startAngle * Math.PI / 180,\n                _endRads = _endAngle * Math.PI / 180,\n                _img = this.icon_cache[_imgname],\n                _startdx = - Math.sin(_startRads),\n                _startdy = Math.cos(_startRads),\n                _startXIn = Math.cos(_startRads) * _inR + _padding * _startdx,\n                _startYIn = Math.sin(_startRads) * _inR + _padding * _startdy,\n                _startXOut = Math.cos(_startRads) * _outR + _padding * _startdx,\n                _startYOut = Math.sin(_startRads) * _outR + _padding * _startdy,\n                _enddx = - Math.sin(_endRads),\n                _enddy = Math.cos(_endRads),\n                _endXIn = Math.cos(_endRads) * _inR - _padding * _enddx,\n                _endYIn = Math.sin(_endRads) * _inR - _padding * _enddy,\n                _endXOut = Math.cos(_endRads) * _outR - _padding * _enddx,\n                _endYOut = Math.sin(_endRads) * _outR - _padding * _enddy,\n                _centerR = (_inR + _outR) / 2,\n                _centerRads = (_startRads + _endRads) / 2,\n                _centerX = Math.cos(_centerRads) * _centerR,\n                _centerY = Math.sin(_centerRads) * _centerR,\n                _centerXIn = Math.cos(_centerRads) * _inR,\n                _centerXOut = Math.cos(_centerRads) * _outR,\n                _centerYIn = Math.sin(_centerRads) * _inR,\n                _centerYOut = Math.sin(_centerRads) * _outR,\n                _textX = Math.cos(_centerRads) * (_outR + 3),\n                _textY = Math.sin(_centerRads) * (_outR + _options.buttons_label_font_size) + _options.buttons_label_font_size / 2;\n            this.buttons_layer.activate();\n            var _path = new paper.Path();\n            _path.add([_startXIn, _startYIn]);\n            _path.arcTo([_centerXIn, _centerYIn], [_endXIn, _endYIn]);\n            _path.lineTo([_endXOut,  _endYOut]);\n            _path.arcTo([_centerXOut, _centerYOut], [_startXOut, _startYOut]);\n            _path.fillColor = _options.buttons_background;\n            _path.opacity = 0.5;\n            _path.closed = true;\n            _path.__representation = _repr;\n            var _text = new paper.PointText(_textX,_textY);\n            _text.characterStyle = {\n                    fontSize: _options.buttons_label_font_size,\n                    fillColor: _options.buttons_label_color\n            };\n            if (_textX > 2) {\n                _text.paragraphStyle.justification = 'left';\n            } else if (_textX < -2) {\n                _text.paragraphStyle.justification = 'right';\n            } else {\n                _text.paragraphStyle.justification = 'center';\n            }\n            _text.visible = false;\n            var _visible = false,\n                _restPos = new paper.Point(-200, -200),\n                _grp = new paper.Group([_path, _text]),\n                //_grp = new paper.Group([_path]),\n                _delta = _grp.position,\n                _imgdelta = new paper.Point([_centerX, _centerY]),\n                _currentPos = new paper.Point(0,0);\n            _text.content = _caption;\n            // set group pivot to not depend on text visibility that changes the group bounding box.\n            _grp.pivot = _grp.bounds.center;\n            _grp.visible = false;\n            _grp.position = _restPos;\n            var _res = {\n                    show: function() {\n                        _visible = true;\n                        _grp.position = _currentPos.add(_delta);\n                        _grp.visible = true;\n                    },\n                    moveTo: function(_point) {\n                        _currentPos = _point;\n                        if (_visible) {\n                            _grp.position = _point.add(_delta);\n                        }\n                    },\n                    hide: function() {\n                        _visible = false;\n                        _grp.visible = false;\n                        _grp.position = _restPos;\n                    },\n                    select: function() {\n                        _path.opacity = 0.8;\n                        _text.visible = true;\n                    },\n                    unselect: function() {\n                        _path.opacity = 0.5;\n                        _text.visible = false;\n                    },\n                    destroy: function() {\n                        _grp.remove();\n                    }\n            };\n            var showImage = function() {\n                var _raster = new paper.Raster(_img);\n                _raster.position = _imgdelta.add(_grp.position).subtract(_delta);\n                _raster.locked = true; // Disable mouse events on icon\n                _grp.addChild(_raster);\n            };\n            if (_img.width) {\n                showImage();\n            } else {\n                $(_img).on(\"load\",showImage);\n            }\n\n            return _res;\n        },\n        addToBundles: function(_edgeRepr) {\n            var _bundle = _(this.bundles).find(function(_bundle) {\n                return (\n                        ( _bundle.from === _edgeRepr.from_representation && _bundle.to === _edgeRepr.to_representation ) ||\n                        ( _bundle.from === _edgeRepr.to_representation && _bundle.to === _edgeRepr.from_representation )\n                );\n            });\n            if (typeof _bundle !== \"undefined\") {\n                _bundle.edges.push(_edgeRepr);\n            } else {\n                _bundle = {\n                        from: _edgeRepr.from_representation,\n                        to: _edgeRepr.to_representation,\n                        edges: [ _edgeRepr ],\n                        getPosition: function(_er) {\n                            var _dir = (_er.from_representation === this.from) ? 1 : -1;\n                            return _dir * ( _(this.edges).indexOf(_er) - (this.edges.length - 1) / 2 );\n                        }\n                };\n                this.bundles.push(_bundle);\n            }\n            return _bundle;\n        },\n        isEditable: function() {\n            return (this.renkan.options.editor_mode && !this.renkan.read_only);\n        },\n        onStatusChange: function() {\n            var savebtn = this.$.find(\".Rk-Save-Button\"),\n            tip = savebtn.find(\".Rk-TopBar-Tooltip-Contents\");\n            if (this.renkan.read_only) {\n                savebtn.removeClass(\"disabled Rk-Save-Online\").addClass(\"Rk-Save-ReadOnly\");\n                tip.text(this.renkan.translate(\"Connection lost\"));\n            } else {\n                if (this.renkan.options.manual_save) {\n                    savebtn.removeClass(\"Rk-Save-ReadOnly Rk-Save-Online\");\n                    tip.text(this.renkan.translate(\"Save Project\"));\n                } else {\n                    savebtn.removeClass(\"disabled Rk-Save-ReadOnly\").addClass(\"Rk-Save-Online\");\n                    tip.text(this.renkan.translate(\"Auto-save enabled\"));\n                }\n            }\n            this.redrawUsers();\n        },\n        setScale: function(_newScale, _offset) {\n            if ((_newScale/this.initialScale) > Utils._MIN_SCALE && (_newScale/this.initialScale) < Utils._MAX_SCALE) {\n                this.scale = _newScale;\n                if (_offset) {\n                    this.offset = _offset;\n                }\n                this.redraw();\n            }\n        },\n        autoScale: function(force_view) {\n            var nodes = this.renkan.project.get(\"nodes\");\n            if (nodes.length > 1) {\n                var _xx = nodes.map(function(_node) { return _node.get(\"position\").x; }),\n                _yy = nodes.map(function(_node) { return _node.get(\"position\").y; }),\n                _minx = Math.min.apply(Math, _xx),\n                _miny = Math.min.apply(Math, _yy),\n                _maxx = Math.max.apply(Math, _xx),\n                _maxy = Math.max.apply(Math, _yy);\n                var _scale = Math.min( (paper.view.size.width - 2 * this.renkan.options.autoscale_padding) / (_maxx - _minx), (paper.view.size.height - 2 * this.renkan.options.autoscale_padding) / (_maxy - _miny));\n                this.initialScale = _scale;\n                // Override calculated scale if asked\n                if((typeof force_view !== \"undefined\") && parseFloat(force_view.zoom_level)>0 && parseFloat(force_view.offset.x)>0 && parseFloat(force_view.offset.y)>0){\n                    this.setScale(parseFloat(force_view.zoom_level), new paper.Point(parseFloat(force_view.offset.x), parseFloat(force_view.offset.y)));\n                }\n                else{\n                    this.setScale(_scale, paper.view.center.subtract(new paper.Point([(_maxx + _minx) / 2, (_maxy + _miny) / 2]).multiply(_scale)));\n                }\n            }\n            if (nodes.length === 1) {\n                this.setScale(1, paper.view.center.subtract(new paper.Point([nodes.at(0).get(\"position\").x, nodes.at(0).get(\"position\").y])));\n            }\n        },\n        redrawMiniframe: function() {\n            var topleft = this.toMinimapCoords(this.toModelCoords(new paper.Point([0,0]))),\n                bottomright = this.toMinimapCoords(this.toModelCoords(paper.view.bounds.bottomRight));\n            this.minimap.miniframe.fitBounds(topleft, bottomright);\n        },\n        rescaleMinimap: function() {\n            var nodes = this.renkan.project.get(\"nodes\");\n            if (nodes.length > 1) {\n                var _xx = nodes.map(function(_node) { return _node.get(\"position\").x; }),\n                    _yy = nodes.map(function(_node) { return _node.get(\"position\").y; }),\n                    _minx = Math.min.apply(Math, _xx),\n                    _miny = Math.min.apply(Math, _yy),\n                    _maxx = Math.max.apply(Math, _xx),\n                    _maxy = Math.max.apply(Math, _yy);\n                var _scale = Math.min(\n                        this.scale * 0.8 * this.renkan.options.minimap_width / paper.view.bounds.width,\n                        this.scale * 0.8 * this.renkan.options.minimap_height / paper.view.bounds.height,\n                        ( this.renkan.options.minimap_width - 2 * this.renkan.options.minimap_padding ) / (_maxx - _minx),\n                        ( this.renkan.options.minimap_height - 2 * this.renkan.options.minimap_padding ) / (_maxy - _miny)\n                );\n                this.minimap.offset = this.minimap.size.divide(2).subtract(new paper.Point([(_maxx + _minx) / 2, (_maxy + _miny) / 2]).multiply(_scale));\n                this.minimap.scale = _scale;\n            }\n            if (nodes.length === 1) {\n                this.minimap.scale = 0.1;\n                this.minimap.offset = this.minimap.size.divide(2).subtract(new paper.Point([nodes.at(0).get(\"position\").x, nodes.at(0).get(\"position\").y]).multiply(this.minimap.scale));\n            }\n            this.redraw();\n        },\n        toPaperCoords: function(_point) {\n            return _point.multiply(this.scale).add(this.offset);\n        },\n        toMinimapCoords: function(_point) {\n            return _point.multiply(this.minimap.scale).add(this.minimap.offset).add(this.minimap.topleft);\n        },\n        toModelCoords: function(_point) {\n            return _point.subtract(this.offset).divide(this.scale);\n        },\n        addRepresentation: function(_type, _model) {\n            var RendererType = requtils.getRenderer()[_type];\n            var _repr = new RendererType(this, _model);\n            this.representations.push(_repr);\n            return _repr;\n        },\n        addRepresentations: function(_type, _collection) {\n            var _this = this;\n            _collection.forEach(function(_model) {\n                _this.addRepresentation(_type, _model);\n            });\n        },\n        userTemplate: _.template(\n                '<li class=\"Rk-User\"><span class=\"Rk-UserColor\" style=\"background:<%=background%>;\"></span><%=name%></li>'\n        ),\n        redrawUsers: function() {\n            if (!this.renkan.options.show_user_list) {\n                return;\n            }\n            var allUsers = [].concat((this.renkan.project.current_user_list || {}).models || [], (this.renkan.project.get(\"users\") || {}).models || []),\n            ulistHtml = '',\n            $userpanel = this.$.find(\".Rk-Users\"),\n            $name = $userpanel.find(\".Rk-CurrentUser-Name\"),\n            $cpitems = $userpanel.find(\".Rk-Edit-ColorPicker li\"),\n            $colorsquare = $userpanel.find(\".Rk-CurrentUser-Color\"),\n            _this = this;\n            $name.off(\"click\").text(this.renkan.translate(\"<unknown user>\"));\n            $cpitems.off(\"mouseleave click\");\n            allUsers.forEach(function(_user) {\n                if (_user.get(\"_id\") === _this.renkan.current_user) {\n                    $name.text(_user.get(\"title\"));\n                    $colorsquare.css(\"background\", _user.get(\"color\"));\n                    if (_this.isEditable()) {\n\n                        if (_this.renkan.options.user_name_editable) {\n                            $name.click(function() {\n                                var $this = $(this),\n                                $input = $('<input>').val(_user.get(\"title\")).blur(function() {\n                                    _user.set(\"title\", $(this).val());\n                                    _this.redrawUsers();\n                                    _this.redraw();\n                                });\n                                $this.empty().html($input);\n                                $input.select();\n                            });\n                        }\n\n                        if (_this.renkan.options.user_color_editable) {\n                            $cpitems.click(\n                                    function(_e) {\n                                        _e.preventDefault();\n                                        if (_this.isEditable()) {\n                                            _user.set(\"color\", $(this).attr(\"data-color\"));\n                                        }\n                                        $(this).parent().hide();\n                                    }\n                            ).mouseleave(function() {\n                                $colorsquare.css(\"background\", _user.get(\"color\"));\n                            });\n                        }\n                    }\n\n                } else {\n                    ulistHtml += _this.userTemplate({\n                        name: _user.get(\"title\"),\n                        background: _user.get(\"color\")\n                    });\n                }\n            });\n            $userpanel.find(\".Rk-UserList\").html(ulistHtml);\n        },\n        removeRepresentation: function(_representation) {\n            _representation.destroy();\n            this.representations = _(this.representations).reject(\n                    function(_repr) {\n                        return _repr === _representation;\n                    }\n            );\n        },\n        getRepresentationByModel: function(_model) {\n            if (!_model) {\n                return undefined;\n            }\n            return _(this.representations).find(function(_repr) {\n                return _repr.model === _model;\n            });\n        },\n        removeRepresentationsOfType: function(_type) {\n            var _representations = _(this.representations).filter(function(_repr) {\n                return _repr.type === _type;\n            }),\n            _this = this;\n            _(_representations).each(function(_repr) {\n                _this.removeRepresentation(_repr);\n            });\n        },\n        highlightModel: function(_model) {\n            var _repr = this.getRepresentationByModel(_model);\n            if (_repr) {\n                _repr.highlight();\n            }\n        },\n        unhighlightAll: function(_model) {\n            _(this.representations).each(function(_repr) {\n                _repr.unhighlight();\n            });\n        },\n        unselectAll: function(_model) {\n            _(this.representations).each(function(_repr) {\n                _repr.unselect();\n            });\n        },\n        redraw: function() {\n            if(! this.redrawActive ) {\n                return;\n            }\n            _(this.representations).each(function(_representation) {\n                _representation.redraw(true);\n            });\n            if (this.minimap) {\n                this.redrawMiniframe();\n            }\n            paper.view.draw();\n        },\n        addTempEdge: function(_from, _point) {\n            var _tmpEdge = this.addRepresentation(\"TempEdge\",null);\n            _tmpEdge.end_pos = _point;\n            _tmpEdge.from_representation = _from;\n            _tmpEdge.redraw();\n            this.click_target = _tmpEdge;\n        },\n        findTarget: function(_hitResult) {\n            if (_hitResult && typeof _hitResult.item.__representation !== \"undefined\") {\n                var _newTarget = _hitResult.item.__representation;\n                if (this.selected_target !== _hitResult.item.__representation) {\n                    if (this.selected_target) {\n                        this.selected_target.unselect(_newTarget);\n                    }\n                    _newTarget.select(this.selected_target);\n                    this.selected_target = _newTarget;\n                }\n            } else {\n                if (this.selected_target) {\n                    this.selected_target.unselect();\n                }\n                this.selected_target = null;\n            }\n        },\n        paperShift: function(_delta) {\n            this.offset = this.offset.add(_delta);\n            this.redraw();\n        },\n        onMouseMove: function(_event) {\n            var _off = this.canvas_$.offset(),\n            _point = new paper.Point([\n                                      _event.pageX - _off.left,\n                                      _event.pageY - _off.top\n                                      ]),\n                                      _delta = _point.subtract(this.last_point);\n            this.last_point = _point;\n            if (!this.is_dragging && this.mouse_down && _delta.length > Utils._MIN_DRAG_DISTANCE) {\n                this.is_dragging = true;\n            }\n            var _hitResult = paper.project.hitTest(_point);\n            if (this.is_dragging) {\n                if (this.click_target && typeof this.click_target.paperShift === \"function\") {\n                    this.click_target.paperShift(_delta);\n                } else {\n                    this.paperShift(_delta);\n                }\n            } else {\n                this.findTarget(_hitResult);\n            }\n            paper.view.draw();\n        },\n        onMouseDown: function(_event, _isTouch) {\n            var _off = this.canvas_$.offset(),\n            _point = new paper.Point([\n                                      _event.pageX - _off.left,\n                                      _event.pageY - _off.top\n                                      ]);\n            this.last_point = _point;\n            this.mouse_down = true;\n            if (!this.click_target || this.click_target.type !== \"Temp-edge\") {\n                this.removeRepresentationsOfType(\"editor\");\n                this.is_dragging = false;\n                var _hitResult = paper.project.hitTest(_point);\n                if (_hitResult && typeof _hitResult.item.__representation !== \"undefined\") {\n                    this.click_target = _hitResult.item.__representation;\n                    this.click_target.mousedown(_event, _isTouch);\n                } else {\n                    this.click_target = null;\n                    if (this.isEditable() && this.click_mode === Utils._CLICKMODE_ADDNODE) {\n                        var _coords = this.toModelCoords(_point),\n                        _data = {\n                            id: Utils.getUID('node'),\n                            created_by: this.renkan.current_user,\n                            position: {\n                                x: _coords.x,\n                                y: _coords.y\n                            }\n                        };\n                        _node = this.renkan.project.addNode(_data);\n                        this.getRepresentationByModel(_node).openEditor();\n                    }\n                }\n            }\n            if (this.click_mode) {\n                if (this.isEditable() && this.click_mode === Utils._CLICKMODE_STARTEDGE && this.click_target && this.click_target.type === \"Node\") {\n                    this.removeRepresentationsOfType(\"editor\");\n                    this.addTempEdge(this.click_target, _point);\n                    this.click_mode = Utils._CLICKMODE_ENDEDGE;\n                    this.notif_$.fadeOut(function() {\n                        $(this).html(this.renkan.translate(\"Click on a second node to complete the edge\")).fadeIn();\n                    });\n                } else {\n                    this.notif_$.hide();\n                    this.click_mode = false;\n                }\n            }\n            paper.view.draw();\n        },\n        onMouseUp: function(_event, _isTouch) {\n            this.mouse_down = false;\n            if (this.click_target) {\n                var _off = this.canvas_$.offset();\n                this.click_target.mouseup(\n                        {\n                            point: new paper.Point([\n                                                    _event.pageX - _off.left,\n                                                    _event.pageY - _off.top\n                                                    ])\n                        },\n                        _isTouch\n                );\n            } else {\n                this.click_target = null;\n                this.is_dragging = false;\n                if (_isTouch) {\n                    this.unselectAll();\n                }\n            }\n            paper.view.draw();\n        },\n        onScroll: function(_event, _scrolldelta) {\n            this.totalScroll += _scrolldelta;\n            if (Math.abs(this.totalScroll) >= 1) {\n                var _off = this.canvas_$.offset(),\n                _delta = new paper.Point([\n                                          _event.pageX - _off.left,\n                                          _event.pageY - _off.top\n                                          ]).subtract(this.offset).multiply( Math.SQRT2 - 1 );\n                if (this.totalScroll > 0) {\n                    this.setScale( this.scale * Math.SQRT2, this.offset.subtract(_delta) );\n                } else {\n                    this.setScale( this.scale * Math.SQRT1_2, this.offset.add(_delta.divide(Math.SQRT2)));\n                }\n                this.totalScroll = 0;\n            }\n        },\n        onDoubleClick: function(_event) {\n            if (!this.isEditable()) {\n                return;\n            }\n            var _off = this.canvas_$.offset(),\n            _point = new paper.Point([\n                                      _event.pageX - _off.left,\n                                      _event.pageY - _off.top\n                                      ]);\n            var _hitResult = paper.project.hitTest(_point);\n            if (this.isEditable() && (!_hitResult || typeof _hitResult.item.__representation === \"undefined\")) {\n                var _coords = this.toModelCoords(_point),\n                _data = {\n                    id: Utils.getUID('node'),\n                    created_by: this.renkan.current_user,\n                    position: {\n                        x: _coords.x,\n                        y: _coords.y\n                    }\n                },\n                _node = this.renkan.project.addNode(_data);\n                this.getRepresentationByModel(_node).openEditor();\n            }\n            paper.view.draw();\n        },\n        defaultDropHandler: function(_data) {\n            var newNode = {};\n            var snippet = \"\";\n            switch(_data[\"text/x-iri-specific-site\"]) {\n                case \"twitter\":\n                    snippet = $('<div>').html(_data[\"text/x-iri-selected-html\"]);\n                    var tweetdiv = snippet.find(\".tweet\");\n                    newNode.title = this.renkan.translate(\"Tweet by \") + tweetdiv.attr(\"data-name\");\n                    newNode.uri = \"http://twitter.com/\" + tweetdiv.attr(\"data-screen-name\") + \"/status/\" + tweetdiv.attr(\"data-tweet-id\");\n                    newNode.image = tweetdiv.find(\".avatar\").attr(\"src\");\n                    newNode.description = tweetdiv.find(\".js-tweet-text:first\").text();\n                    break;\n                case \"google\":\n                    snippet = $('<div>').html(_data[\"text/x-iri-selected-html\"]);\n                    newNode.title = snippet.find(\"h3:first\").text().trim();\n                    newNode.uri = snippet.find(\"h3 a\").attr(\"href\");\n                    newNode.description = snippet.find(\".st:first\").text().trim();\n                    break;\n                default:\n                    if (_data[\"text/x-iri-source-uri\"]) {\n                        newNode.uri = _data[\"text/x-iri-source-uri\"];\n                    }\n            }\n            if (_data[\"text/plain\"] || _data[\"text/x-iri-selected-text\"]) {\n                newNode.description = (_data[\"text/plain\"] || _data[\"text/x-iri-selected-text\"]).replace(/[\\s\\n]+/gm,' ').trim();\n            }\n            if (_data[\"text/html\"] || _data[\"text/x-iri-selected-html\"]) {\n                snippet = $('<div>').html(_data[\"text/html\"] || _data[\"text/x-iri-selected-html\"]);\n                var _svgimgs = snippet.find(\"image\");\n                if (_svgimgs.length) {\n                    newNode.image = _svgimgs.attr(\"xlink:href\");\n                }\n                var _svgpaths = snippet.find(\"path\");\n                if (_svgpaths.length) {\n                    newNode.clipPath = _svgpaths.attr(\"d\");\n                }\n                var _imgs = snippet.find(\"img\");\n                if (_imgs.length) {\n                    newNode.image = _imgs[0].src;\n                }\n                var _as = snippet.find(\"a\");\n                if (_as.length) {\n                    newNode.uri = _as[0].href;\n                }\n                newNode.title = snippet.find(\"[title]\").attr(\"title\") || newNode.title;\n                newNode.description = snippet.text().replace(/[\\s\\n]+/gm,' ').trim();\n            }\n            if (_data[\"text/uri-list\"]) {\n                newNode.uri = _data[\"text/uri-list\"];\n            }\n            if (_data[\"text/x-moz-url\"] && !newNode.title) {\n                newNode.title = (_data[\"text/x-moz-url\"].split(\"\\n\")[1] || \"\").trim();\n                if (newNode.title === newNode.uri) {\n                    newNode.title = false;\n                }\n            }\n            if (_data[\"text/x-iri-source-title\"] && !newNode.title) {\n                newNode.title = _data[\"text/x-iri-source-title\"];\n            }\n            if (_data[\"text/html\"] || _data[\"text/x-iri-selected-html\"]) {\n                snippet = $('<div>').html(_data[\"text/html\"] || _data[\"text/x-iri-selected-html\"]);\n                newNode.image = snippet.find(\"[data-image]\").attr(\"data-image\") || newNode.image;\n                newNode.uri = snippet.find(\"[data-uri]\").attr(\"data-uri\") || newNode.uri;\n                newNode.title = snippet.find(\"[data-title]\").attr(\"data-title\") || newNode.title;\n                newNode.description = snippet.find(\"[data-description]\").attr(\"data-description\") || newNode.description;\n                newNode.clipPath = snippet.find(\"[data-clip-path]\").attr(\"data-clip-path\") || newNode.clipPath;\n            }\n\n            if (!newNode.title) {\n                newNode.title = this.renkan.translate(\"Dragged resource\");\n            }\n            var fields = [\"title\", \"description\", \"uri\", \"image\"];\n            for (var i = 0; i < fields.length; i++) {\n                var f = fields[i];\n                if (_data[\"text/x-iri-\" + f] || _data[f]) {\n                    newNode[f] = _data[\"text/x-iri-\" + f] || _data[f];\n                }\n                if (newNode[f] === \"none\" || newNode[f] === \"null\") {\n                    newNode[f] = undefined;\n                }\n            }\n\n            if(typeof this.renkan.options.drop_enhancer === \"function\"){\n                newNode = this.renkan.options.drop_enhancer(newNode, _data);\n            }\n\n            return newNode;\n\n        },\n        dropData: function(_data, _event) {\n            if (!this.isEditable()) {\n                return;\n            }\n            if (_data[\"text/json\"] || _data[\"application/json\"]) {\n                try {\n                    var jsondata = JSON.parse(_data[\"text/json\"] || _data[\"application/json\"]);\n                    _(_data).extend(jsondata);\n                }\n                catch(e) {}\n            }\n\n            var newNode = (typeof this.renkan.options.drop_handler === \"undefined\")?this.defaultDropHandler(_data):this.renkan.options.drop_handler(_data);\n\n            var _off = this.canvas_$.offset(),\n            _point = new paper.Point([\n                                      _event.pageX - _off.left,\n                                      _event.pageY - _off.top\n                                      ]),\n                                      _coords = this.toModelCoords(_point),\n                                      _nodedata = {\n                id: Utils.getUID('node'),\n                created_by: this.renkan.current_user,\n                uri: newNode.uri || \"\",\n                title: newNode.title || \"\",\n                description: newNode.description || \"\",\n                image: newNode.image || \"\",\n                color: newNode.color || undefined,\n                clip_path: newNode.clipPath || undefined,\n                position: {\n                    x: _coords.x,\n                    y: _coords.y\n                }\n            };\n            var _node = this.renkan.project.addNode(_nodedata),\n            _repr = this.getRepresentationByModel(_node);\n            if (_event.type === \"drop\") {\n                _repr.openEditor();\n            }\n        },\n        fullScreen: function() {\n            var _isFull = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen,\n                _el = this.renkan.$[0],\n                _requestMethods = [\"requestFullScreen\",\"mozRequestFullScreen\",\"webkitRequestFullScreen\"],\n                _cancelMethods = [\"cancelFullScreen\",\"mozCancelFullScreen\",\"webkitCancelFullScreen\"],\n                i;\n            if (_isFull) {\n                for (i = 0; i < _cancelMethods.length; i++) {\n                    if (typeof document[_cancelMethods[i]] === \"function\") {\n                        document[_cancelMethods[i]]();\n                        break;\n                    }\n                }\n                var widthAft = this.$.width();\n                var heightAft = this.$.height();\n\n                if (this.renkan.options.show_top_bar) {\n                    heightAft -= this.$.find(\".Rk-TopBar\").height();\n                }\n                if (this.renkan.options.show_bins && (this.renkan.$.find(\".Rk-Bins\").position().left > 0)) {\n                    widthAft -= this.renkan.$.find(\".Rk-Bins\").width();\n                }\n\n                paper.view.viewSize = new paper.Size([widthAft, heightAft]);\n\n            } else {\n                for (i = 0; i < _requestMethods.length; i++) {\n                    if (typeof _el[_requestMethods[i]] === \"function\") {\n                        _el[_requestMethods[i]]();\n                        break;\n                    }\n                }\n                this.redraw();\n            }\n        },\n        zoomOut: function() {\n            var _newScale = this.scale * Math.SQRT1_2,\n            _offset = new paper.Point([\n                                       this.canvas_$.width(),\n                                       this.canvas_$.height()\n                                       ]).multiply( 0.5 * ( 1 - Math.SQRT1_2 ) ).add(this.offset.multiply( Math.SQRT1_2 ));\n            this.setScale( _newScale, _offset );\n        },\n        zoomIn: function() {\n            var _newScale = this.scale * Math.SQRT2,\n            _offset = new paper.Point([\n                                       this.canvas_$.width(),\n                                       this.canvas_$.height()\n                                       ]).multiply( 0.5 * ( 1 - Math.SQRT2 ) ).add(this.offset.multiply( Math.SQRT2 ));\n            this.setScale( _newScale, _offset );\n        },\n        resizeZoom: function(_scaleWidth, _scaleHeight, _ratio) {\n            var _newScale = this.scale * _ratio,\n                _offset = new paper.Point([\n                                       (this.offset.x * _scaleWidth),\n                                       (this.offset.y * _scaleHeight)\n                                       ]);\n            this.setScale( _newScale, _offset );\n        },\n        addNodeBtn: function() {\n            if (this.click_mode === Utils._CLICKMODE_ADDNODE) {\n                this.click_mode = false;\n                this.notif_$.hide();\n            } else {\n                this.click_mode = Utils._CLICKMODE_ADDNODE;\n                this.notif_$.text(this.renkan.translate(\"Click on the background canvas to add a node\")).fadeIn();\n            }\n            return false;\n        },\n        addEdgeBtn: function() {\n            if (this.click_mode === Utils._CLICKMODE_STARTEDGE || this.click_mode === Utils._CLICKMODE_ENDEDGE) {\n                this.click_mode = false;\n                this.notif_$.hide();\n            } else {\n                this.click_mode = Utils._CLICKMODE_STARTEDGE;\n                this.notif_$.text(this.renkan.translate(\"Click on a first node to start the edge\")).fadeIn();\n            }\n            return false;\n        },\n        exportProject: function() {\n          var projectJSON = this.renkan.project.toJSON(),\n              downloadLink = document.createElement(\"a\"),\n              projectId = projectJSON.id,\n              fileNameToSaveAs = projectId + \".json\";\n\n          // clean ids\n          delete projectJSON.id;\n          delete projectJSON._id;\n          delete projectJSON.space_id;\n\n          var objId;\n          var idsMap = {};\n\n          _.each(projectJSON.nodes, function(e,i,l) {\n            objId = e.id || e._id;\n            delete e._id;\n            delete e.id;\n            idsMap[objId] = e['@id'] = Utils.getUUID4();\n          });\n          _.each(projectJSON.edges, function(e,i,l) {\n            delete e._id;\n            delete e.id;\n            e.to = idsMap[e.to];\n            e.from = idsMap[e.from];\n          });\n          _.each(projectJSON.views, function(e,i,l) {\n            objId = e.id || e._id;\n            delete e._id;\n            delete e.id;\n          });\n          projectJSON.users = [];\n\n          var projectJSONStr = JSON.stringify(projectJSON, null, 2);\n          var blob = new Blob([projectJSONStr], {type: \"application/json;charset=utf-8\"});\n          filesaver(blob,fileNameToSaveAs);\n\n        },\n        foldBins: function() {\n            var foldBinsButton = this.$.find(\".Rk-Fold-Bins\"),\n                bins = this.renkan.$.find(\".Rk-Bins\");\n            var _this = this,\n                sizeBef = _this.canvas_$.width(),\n                sizeAft;\n            if (bins.position().left < 0) {\n                bins.animate({left: 0},250);\n                this.$.animate({left: 300},250,function() {\n                    var w = _this.$.width();\n                    paper.view.viewSize = new paper.Size([w, _this.canvas_$.height()]);\n                });\n                if ((sizeBef -  bins.width()) < bins.height()){\n                    sizeAft = sizeBef;\n                } else {\n                    sizeAft = sizeBef - bins.width();\n                }\n                foldBinsButton.html(\"&laquo;\");\n            } else {\n                bins.animate({left: -300},250);\n                this.$.animate({left: 0},250,function() {\n                    var w = _this.$.width();\n                    paper.view.viewSize = new paper.Size([w, _this.canvas_$.height()]);\n                });\n                sizeAft = sizeBef+300;\n                foldBinsButton.html(\"&raquo;\");\n            }\n            _this.resizeZoom(1, 1, (sizeAft/sizeBef));\n        },\n        save: function() { },\n        open: function() { }\n    });\n\n    /* Scene End */\n\n    return Scene;\n\n});\n\n\n//Load modules and use them\nif( typeof require.config === \"function\" ) {\n    require.config({\n        paths: {\n            'jquery':'../lib/jquery/jquery',\n            'underscore':'../lib/underscore/underscore',\n            'filesaver' :'../lib/FileSaver/FileSaver',\n            'requtils':'require-utils'\n        }\n    });\n}\n\nrequire(['renderer/baserepresentation',\n         'renderer/basebutton',\n         'renderer/noderepr',\n         'renderer/edge',\n         'renderer/tempedge',\n         'renderer/baseeditor',\n         'renderer/nodeeditor',\n         'renderer/edgeeditor',\n         'renderer/nodebutton',\n         'renderer/nodeeditbutton',\n         'renderer/noderemovebutton',\n         'renderer/noderevertbutton',\n         'renderer/nodelinkbutton',\n         'renderer/nodeenlargebutton',\n         'renderer/nodeshrinkbutton',\n         'renderer/edgeeditbutton',\n         'renderer/edgeremovebutton',\n         'renderer/edgerevertbutton',\n         'renderer/miniframe',\n         'renderer/scene'\n         ], function(BaseRepresentation, BaseButton, NodeRepr, Edge, TempEdge, BaseEditor, NodeEditor, EdgeEditor, NodeButton, NodeEditButton, NodeRemoveButton, NodeRevertButton, NodeLinkButton, NodeEnlargeButton, NodeShrinkButton, EdgeEditButton, EdgeRemoveButton, EdgeRevertButton, MiniFrame, Scene){\n\n    \n\n    var Rkns = window.Rkns;\n\n    if(typeof Rkns.Renderer === \"undefined\"){\n        Rkns.Renderer = {};\n    }\n    var Renderer = Rkns.Renderer;\n\n    Renderer._BaseRepresentation = BaseRepresentation;\n    Renderer._BaseButton = BaseButton;\n    Renderer.Node = NodeRepr;\n    Renderer.Edge = Edge;\n    Renderer.TempEdge = TempEdge;\n    Renderer._BaseEditor = BaseEditor;\n    Renderer.NodeEditor = NodeEditor;\n    Renderer.EdgeEditor = EdgeEditor;\n    Renderer._NodeButton = NodeButton;\n    Renderer.NodeEditButton = NodeEditButton;\n    Renderer.NodeRemoveButton = NodeRemoveButton;\n    Renderer.NodeRevertButton = NodeRevertButton;\n    Renderer.NodeLinkButton = NodeLinkButton;\n    Renderer.NodeEnlargeButton = NodeEnlargeButton;\n    Renderer.NodeShrinkButton = NodeShrinkButton;\n    Renderer.EdgeEditButton = EdgeEditButton;\n    Renderer.EdgeRemoveButton = EdgeRemoveButton;\n    Renderer.EdgeRevertButton = EdgeRevertButton;\n    Renderer.MiniFrame = MiniFrame;\n    Renderer.Scene = Scene;\n\n    startRenkan();\n});\n\ndefine(\"main-renderer\", function(){});\n\n","this[\"renkanJST\"] = this[\"renkanJST\"] || {};\n\nthis[\"renkanJST\"][\"templates/edgeeditor.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n__p += '<h2>\\n\\t<span class=\"Rk-CloseX\">&times;</span>' +\n__e(renkan.translate(\"Edit Edge\")) +\n'</span>\\n</h2>\\n<p>\\n\\t<label>' +\n__e(renkan.translate(\"Title:\")) +\n'</label>\\n\\t<input class=\"Rk-Edit-Title\" type=\"text\" value=\"' +\n__e(edge.title) +\n'\" />\\n</p>\\n';\n if (options.show_edge_editor_uri) { ;\n__p += '\\n\\t<p>\\n\\t\\t<label>' +\n__e(renkan.translate(\"URI:\")) +\n'</label>\\n\\t\\t<input class=\"Rk-Edit-URI\" type=\"text\" value=\"' +\n__e(edge.uri) +\n'\" />\\n\\t\\t<a class=\"Rk-Edit-Goto\" href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\"></a>\\n\\t</p>\\n\\t';\n if (options.properties.length) { ;\n__p += '\\n\\t\\t<p>\\n\\t\\t\\t<label>' +\n__e(renkan.translate(\"Choose from vocabulary:\")) +\n'</label>\\n\\t\\t\\t<select class=\"Rk-Edit-Vocabulary\">\\n\\t\\t\\t\\t';\n _(options.properties).each(function(ontology) { ;\n__p += '\\n\\t\\t\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Class\" value=\"\">\\n\\t\\t\\t\\t\\t\\t' +\n__e( renkan.translate(ontology.label) ) +\n'\\n\\t\\t\\t\\t\\t</option>\\n\\t\\t\\t\\t\\t';\n _(ontology.properties).each(function(property) { var uri = ontology[\"base-uri\"] + property.uri; ;\n__p += '\\n\\t\\t\\t\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"' +\n__e( uri ) +\n'\"\\n\\t\\t\\t\\t\\t\\t\\t';\n if (uri === edge.uri) { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e( renkan.translate(property.label) ) +\n'\\n\\t\\t\\t\\t\\t\\t</option>\\n\\t\\t\\t\\t\\t';\n }) ;\n__p += '\\n\\t\\t\\t\\t';\n }) ;\n__p += '\\n\\t\\t\\t</select>\\n\\t\\t</p>\\n';\n } } ;\n__p += '\\n';\n if (options.show_edge_editor_color) { ;\n__p += '\\n\\t<div class=\"Rk-Editor-p\">\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Edge color:\")) +\n'</span>\\n\\t\\t<div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n\\t\\t\\t<span class=\"Rk-Edit-Color\" style=\"background: &lt;%-edge.color%>;\">\\n\\t\\t\\t\\t<span class=\"Rk-Edit-ColorTip\"></span>\\n\\t\\t\\t</span>\\n\\t\\t\\t' +\n((__t = ( renkan.colorPicker )) == null ? '' : __t) +\n'\\n\\t\\t\\t<span class=\"Rk-Edit-ColorPicker-Text\">' +\n__e( renkan.translate(\"Choose color\") ) +\n'</span>\\n\\t\\t</div>\\n\\t</div>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_direction) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Edit-Direction\">' +\n__e( renkan.translate(\"Change edge direction\") ) +\n'</span>\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_nodes) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"From:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e(edge.from_color) +\n';\"></span>\\n\\t\\t' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n\\t</p>\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"To:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: >%-edge.to_color%>;\"></span>\\n\\t\\t' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_creator && edge.has_creator) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: &lt;%-edge.created_by_color%>;\"></span>\\n\\t\\t' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/edgeeditor_readonly.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n__p += '<h2>\\n\\t<span class=\"Rk-CloseX\">&times;</span>\\n\\t';\n if (options.show_edge_tooltip_color) { ;\n__p += '\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.color ) +\n';\"></span>\\n\\t';\n } ;\n__p += '\\n\\t<span class=\"Rk-Display-Title\">\\n\\t\\t';\n if (edge.uri) { ;\n__p += '\\n\\t\\t\\t<a href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\">\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t' +\n__e(edge.title) +\n'\\n\\t\\t';\n if (edge.uri) { ;\n__p += ' </a> ';\n } ;\n__p += '\\n\\t</span>\\n</h2>\\n';\n if (options.show_edge_tooltip_uri && edge.uri) { ;\n__p += '\\n\\t<p class=\"Rk-Display-URI\">\\n\\t\\t<a href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\">' +\n__e( edge.short_uri ) +\n'</a>\\n\\t</p>\\n';\n } ;\n__p += '\\n<p>' +\n__e(edge.description) +\n'</p>\\n';\n if (options.show_edge_tooltip_nodes) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"From:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.from_color ) +\n';\"></span>\\n\\t\\t' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n\\t</p>\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"To:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.to_color ) +\n';\"></span>\\n\\t\\t' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_tooltip_creator && edge.has_creator) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.created_by_color ) +\n';\"></span>\\n\\t\\t' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/ldtjson-bin/annotationtemplate.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li class=\"Rk-Bin-Item\" draggable=\"true\"\\n\\tdata-image=\"' +\n__e( Rkns.Utils.getFullURL(image) ) +\n'\"\\n\\tdata-uri=\"' +\n((__t = (ldt_platform)) == null ? '' : __t) +\n'ldtplatform/ldt/front/player/' +\n((__t = (mediaid)) == null ? '' : __t) +\n'/#id=' +\n((__t = (annotationid)) == null ? '' : __t) +\n'\"\\n\\tdata-title=\"' +\n__e(title) +\n'\" data-description=\"' +\n__e(description) +\n'\">\\n\\t\\n\\t<img class=\"Rk-Ldt-Annotation-Icon\" src=\"' +\n((__t = (image)) == null ? '' : __t) +\n'\" />\\n\\t<h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n\\t<p>' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n\\t<p>Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n'</p>\\n\\t<div class=\"Rk-Clear\"></div>\\n</li>';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/ldtjson-bin/segmenttemplate.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li class=\"Rk-Bin-Item\" draggable=\"true\"\\n\\tdata-image=\"' +\n__e( Rkns.Utils.getFullURL(image) ) +\n'\"\\n\\tdata-uri=\"' +\n((__t = (ldt_platform)) == null ? '' : __t) +\n'ldtplatform/ldt/front/player/' +\n((__t = (mediaid)) == null ? '' : __t) +\n'/#id=' +\n((__t = (annotationid)) == null ? '' : __t) +\n'\"\\n\\tdata-title=\"' +\n__e(title) +\n'\" data-description=\"' +\n__e(description) +\n'\">\\n\\t\\n\\t<img class=\"Rk-Ldt-Annotation-Icon\" src=\"' +\n((__t = (image)) == null ? '' : __t) +\n'\" />\\n\\t<h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n\\t<p>' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n\\t<p>Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n'</p>\\n\\t<div class=\"Rk-Clear\"></div>\\n</li>';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/ldtjson-bin/tagtemplate.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li class=\"Rk-Bin-Item\" draggable=\"true\"\\n\\tdata-image=\"' +\n__e( Rkns.Utils.getFullURL(static_url+'img/ldt-tag.png') ) +\n'\"\\n\\tdata-uri=\"' +\n((__t = (ldt_platform)) == null ? '' : __t) +\n'ldtplatform/ldt/front/search/?search=' +\n((__t = (encodedtitle)) == null ? '' : __t) +\n'&field=all\"\\n\\tdata-title=\"' +\n__e(title) +\n'\" data-description=\"Tag \\'' +\n__e(title) +\n'\\'\">\\n\\n\\t<img class=\"Rk-Ldt-Tag-Icon\" src=\"' +\n__e(static_url) +\n'img/ldt-tag.png\" />\\n\\t<h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n\\t<div class=\"Rk-Clear\"></div>\\n</li>';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/nodeeditor.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n__p += '<h2>\\n\\t<span class=\"Rk-CloseX\">&times;</span>' +\n__e(renkan.translate(\"Edit Node\")) +\n'</span>\\n</h2>\\n<p>\\n\\t<label>' +\n__e(renkan.translate(\"Title:\")) +\n'</label>\\n\\t<input class=\"Rk-Edit-Title\" type=\"text\" value=\"' +\n__e(node.title) +\n'\" />\\n</p>\\n';\n if (options.show_node_editor_uri) { ;\n__p += '\\n\\t<p>\\n\\t\\t<label>' +\n__e(renkan.translate(\"URI:\")) +\n'</label>\\n\\t\\t<input class=\"Rk-Edit-URI\" type=\"text\" value=\"' +\n__e(node.uri) +\n'\" />\\n\\t\\t<a class=\"Rk-Edit-Goto\" href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\"></a>\\n\\t</p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_description) { ;\n__p += '\\n\\t<p>\\n\\t\\t<label>' +\n__e(renkan.translate(\"Description:\")) +\n'</label>\\n\\t\\t<textarea class=\"Rk-Edit-Description\">' +\n__e(node.description) +\n'</textarea>\\n\\t</p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_size) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Size:\")) +\n'</span>\\n\\t\\t<a href=\"#\" class=\"Rk-Edit-Size-Down\">-</a>\\n\\t\\t<span class=\"Rk-Edit-Size-Value\">' +\n__e(node.size) +\n'</span>\\n\\t\\t<a href=\"#\" class=\"Rk-Edit-Size-Up\">+</a>\\n\\t</p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_color) { ;\n__p += '\\n\\t<div class=\"Rk-Editor-p\">\\n\\t\\t<span class=\"Rk-Editor-Label\">\\n\\t\\t' +\n__e(renkan.translate(\"Node color:\")) +\n'</span>\\n\\t\\t<div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n\\t\\t\\t<span class=\"Rk-Edit-Color\" style=\"background: ' +\n__e(node.color) +\n';\">\\n\\t\\t\\t\\t<span class=\"Rk-Edit-ColorTip\"></span>\\n\\t\\t\\t</span>\\n\\t\\t\\t' +\n((__t = ( renkan.colorPicker )) == null ? '' : __t) +\n'\\n\\t\\t\\t<span class=\"Rk-Edit-ColorPicker-Text\">' +\n__e( renkan.translate(\"Choose color\") ) +\n'</span>\\n\\t\\t</div>\\n\\t</div>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_image) { ;\n__p += '\\n\\t<div class=\"Rk-Edit-ImgWrap\">\\n\\t\\t<div class=\"Rk-Edit-ImgPreview\">\\n\\t\\t\\t<img src=\"' +\n__e(node.image || node.image_placeholder) +\n'\" />\\n\\t\\t\\t';\n if (node.clip_path) { ;\n__p += '\\n\\t\\t\\t\\t<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewbox=\"0 0 1 1\" preserveAspectRatio=\"none\">\\n\\t\\t\\t\\t\\t<path style=\"stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;\" d=\"' +\n__e( node.clip_path ) +\n'\" />\\n\\t\\t\\t\\t</svg>\\n\\t\\t\\t';\n };\n__p += '\\n\\t\\t</div>\\n\\t</div>\\n\\t<p>\\n\\t\\t<label>' +\n__e(renkan.translate(\"Image URL:\")) +\n'</label>\\n\\t\\t<div>\\n\\t\\t\\t<a class=\"Rk-Edit-Image-Del\" href=\"#\"></a>\\n\\t\\t\\t<input class=\"Rk-Edit-Image\" type=\"text\" value=\\'' +\n__e(node.image) +\n'\\' />\\n\\t\\t</div>\\n\\t</p>\\n';\n if (options.allow_image_upload) { ;\n__p += '\\n\\t<p>\\n\\t\\t<label>' +\n__e(renkan.translate(\"Choose Image File:\")) +\n'</label>\\n\\t\\t<input class=\"Rk-Edit-Image-File\" type=\"file\" accept=\"image/*\" />\\n\\t</p>\\n';\n };\n\n } ;\n__p += ' ';\n if (options.show_node_editor_creator && node.has_creator) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.created_by_color) +\n';\"></span>\\n\\t\\t' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n\\t</p>\\n';\n } ;\n__p += ' ';\n if (options.change_shapes) { ;\n__p += '\\n\\t<p>\\n\\t\\t<label>' +\n__e(renkan.translate(\"Shapes available\")) +\n':</label>\\n\\t\\t<select class=\"Rk-Edit-Shape\">\\n\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"circle\"';\n if (node.shape === \"circle\") { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t' +\n__e( renkan.translate(\"Circle\") ) +\n'\\n\\t\\t\\t</option>\\n\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"rectangle\"';\n if (node.shape === \"rectangle\") { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t' +\n__e( renkan.translate(\"Square\") ) +\n'\\n\\t\\t\\t</option>\\n\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"diamond\"';\n if (node.shape === \"diamond\") { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t' +\n__e( renkan.translate(\"Diamond\") ) +\n'\\n\\t\\t\\t</option>\\n\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"polygon\"';\n if (node.shape === \"polygon\") { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t' +\n__e( renkan.translate(\"Hexagone\") ) +\n'\\n\\t\\t\\t</option>\\n\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"ellipse\"';\n if (node.shape === \"ellipse\") { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t' +\n__e( renkan.translate(\"Ellipse\") ) +\n'\\n\\t\\t\\t</option>\\n\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"star\"';\n if (node.shape === \"star\") { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t' +\n__e( renkan.translate(\"Star\") ) +\n'\\n\\t\\t\\t</option>\\n\\t\\t</select>\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/nodeeditor_readonly.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n__p += '<h2>\\n\\t<span class=\"Rk-CloseX\">&times;</span>\\n\\t';\n if (options.show_node_tooltip_color) { ;\n__p += '\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.color) +\n';\"></span>\\n\\t';\n } ;\n__p += '\\n\\t<span class=\"Rk-Display-Title\">\\n\\t\\t';\n if (node.uri) { ;\n__p += '\\n\\t\\t\\t<a href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\">\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t' +\n__e(node.title) +\n'\\n\\t\\t';\n if (node.uri) { ;\n__p += '</a>';\n } ;\n__p += '\\n\\t</span>\\n</h2>\\n';\n if (node.uri && options.show_node_tooltip_uri) { ;\n__p += '\\n\\t<p class=\"Rk-Display-URI\">\\n\\t\\t<a href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\">' +\n__e(node.short_uri) +\n'</a>\\n\\t</p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_tooltip_description) { ;\n__p += '\\n\\t<p class=\"Rk-Display-Description\">' +\n__e(node.description) +\n'</p>\\n';\n } ;\n__p += ' ';\n if (node.image && options.show_node_tooltip_image) { ;\n__p += '\\n\\t<img class=\"Rk-Display-ImgPreview\" src=\"' +\n__e(node.image) +\n'\" />\\n';\n } ;\n__p += ' ';\n if (node.has_creator && options.show_node_tooltip_creator) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.created_by_color) +\n';\"></span>\\n\\t\\t' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/scene.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n\n if (options.show_top_bar) { ;\n__p += '\\n\\t<div class=\"Rk-TopBar\">\\n\\t\\t<div class=\"loader\"></div>\\n\\t\\t';\n if (!options.editor_mode) { ;\n__p += '\\n\\t\\t\\t<h2 class=\"Rk-PadTitle\">\\n\\t\\t\\t\\t' +\n__e( project.get(\"title\") || translate(\"Untitled project\")) +\n'\\n\\t\\t\\t</h2>\\n\\t\\t';\n } else { ;\n__p += '\\n\\t\\t\\t<input type=\"text\" class=\"Rk-PadTitle\" value=\"' +\n__e( project.get('title') || '' ) +\n'\" placeholder=\"' +\n__e(translate('Untitled project')) +\n'\" />\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n if (options.show_user_list) { ;\n__p += '\\n\\t\\t\\t<div class=\"Rk-Users\">\\n\\t\\t\\t\\t<div class=\"Rk-CurrentUser\">\\n\\t\\t\\t\\t\\t';\n if (options.show_user_color) { ;\n__p += '\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n\\t\\t\\t\\t\\t\\t\\t<span class=\"Rk-CurrentUser-Color\">\\n\\t\\t\\t\\t\\t\\t\\t';\n if (options.user_color_editable) { ;\n__p += '\\n\\t\\t\\t\\t\\t\\t\\t\\t<span class=\"Rk-Edit-ColorTip\"></span>\\n\\t\\t\\t\\t\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t\\t\\t\\t\\t</span>\\n\\t\\t\\t\\t\\t\\t\\t';\n if (options.user_color_editable) { print(colorPicker) } ;\n__p += '\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t\\t\\t<span class=\"Rk-CurrentUser-Name\">&lt;unknown user&gt;</span>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t<ul class=\"Rk-UserList\"></ul>\\n\\t\\t\\t</div>\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n if (options.home_button_url) {;\n__p += '\\n\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t<a class=\"Rk-TopBar-Button Rk-Home-Button\" href=\"' +\n__e( options.home_button_url ) +\n'\">\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t' +\n__e( translate(options.home_button_title) ) +\n'\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t</a>\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n if (options.show_fullscreen_button) { ;\n__p += '\\n\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-FullScreen-Button\">\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Full Screen\")) +\n'\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t</div>\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n if (options.editor_mode) { ;\n__p += '\\n\\t\\t\\t';\n if (options.show_addnode_button) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-AddNode-Button\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Add Node\")) +\n'\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t';\n if (options.show_addedge_button) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-AddEdge-Button\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Add Edge\")) +\n'\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t';\n if (options.show_export_button) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-Export-Button\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Download Project\")) +\n'\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t';\n if (options.show_save_button) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-Save-Button\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\"></div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t';\n if (options.show_open_button) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-Open-Button\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Open Project\")) +\n'\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t';\n if (options.show_bookmarklet) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<a class=\"Rk-TopBar-Button Rk-Bookmarklet-Button\" href=\"#\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Renkan \\'Drag-to-Add\\' bookmarklet\")) +\n'\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</a>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n } else { ;\n__p += '\\n\\t\\t\\t';\n if (options.show_export_button) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-Export-Button\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Download Project\")) +\n'\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n }; ;\n__p += '\\n\\t\\t';\n if (options.show_search_field) { ;\n__p += '\\n\\t\\t\\t<form action=\"#\" class=\"Rk-GraphSearch-Form\">\\n\\t\\t\\t\\t<input type=\"search\" class=\"Rk-GraphSearch-Field\" placeholder=\"' +\n__e( translate('Search in graph') ) +\n'\" />\\n\\t\\t\\t</form>\\n\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t';\n } ;\n__p += '\\n\\t</div>\\n';\n } ;\n__p += '\\n<div class=\"Rk-Editing-Space';\n if (!options.show_top_bar) { ;\n__p += ' Rk-Editing-Space-Full';\n } ;\n__p += '\">\\n\\t<div class=\"Rk-Labels\"></div>\\n\\t<canvas class=\"Rk-Canvas\" ';\n if (options.resize) { ;\n__p += ' resize=\"\" ';\n } ;\n__p += '></canvas>\\n\\t<div class=\"Rk-Notifications\"></div>\\n\\t<div class=\"Rk-Editor\">\\n\\t\\t';\n if (options.show_bins) { ;\n__p += '\\n\\t\\t\\t<div class=\"Rk-Fold-Bins\">&laquo;</div>\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n if (options.show_zoom) { ;\n__p += '\\n\\t\\t\\t<div class=\"Rk-ZoomButtons\">\\n\\t\\t\\t\\t<div class=\"Rk-ZoomIn\" title=\"' +\n__e(translate('Zoom In')) +\n'\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-ZoomFit\" title=\"' +\n__e(translate('Zoom Fit')) +\n'\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-ZoomOut\" title=\"' +\n__e(translate('Zoom Out')) +\n'\"></div>\\n\\t\\t\\t\\t';\n if (options.editor_mode && options.save_view) { ;\n__p += '\\n\\t\\t\\t\\t\\t<div class=\"Rk-ZoomSave\" title=\"' +\n__e(translate('Zoom Save')) +\n'\"></div>\\n\\t\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t\\t';\n if (options.save_view) { ;\n__p += '\\n\\t\\t\\t\\t\\t<div class=\"Rk-ZoomSetSaved\" title=\"' +\n__e(translate('View saved zoom')) +\n'\"></div>\\n\\t\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t</div>\\n\\t\\t';\n } ;\n__p += '\\n\\t</div>\\n</div>';\n\n}\nreturn __p\n};"]}
\ No newline at end of file
+{"version":3,"file":"renkan.min.js","sources":["templates.js","../../js/main.js","../../js/models.js","../../js/defaults.js","../../js/i18n.js","../../js/full-json.js","../../js/save-once.js","../../js/ldtjson-bin.js","../../js/list-bin.js","../../js/wikipedia-bin.js","paper-renderer.js"],"names":["this","obj","__t","__p","__e","_","escape","Array","prototype","join","renkan","translate","edge","title","options","show_edge_editor_uri","uri","properties","length","each","ontology","label","property","show_edge_editor_color","show_edge_editor_direction","show_edge_editor_nodes","from_color","shortenText","from_title","to_title","show_edge_editor_creator","has_creator","created_by_title","show_edge_tooltip_color","color","show_edge_tooltip_uri","short_uri","description","show_edge_tooltip_nodes","to_color","show_edge_tooltip_creator","created_by_color","Rkns","Utils","getFullURL","image","static_url","url","show_bins","show_editor","node","show_node_editor_uri","show_node_editor_description","show_node_editor_size","size","show_node_editor_color","show_node_editor_image","image_placeholder","clip_path","allow_image_upload","show_node_editor_creator","change_shapes","shape","show_node_tooltip_color","show_node_tooltip_uri","show_node_tooltip_description","show_node_tooltip_image","show_node_tooltip_creator","print","__j","call","arguments","show_top_bar","editor_mode","project","get","show_user_list","show_user_color","user_color_editable","colorPicker","home_button_url","home_button_title","show_fullscreen_button","show_addnode_button","show_addedge_button","show_export_button","show_save_button","show_open_button","show_bookmarklet","show_search_field","resize","show_zoom","save_view","root","$","jQuery","pickerColors","__renkans","_BaseBin","_renkan","_opts","find","hide","addClass","appendTo","title_icon_$","_this","attr","href","html","click","destroy","slideDown","resizeBins","refresh","count_$","title_$","main_$","auto_refresh","window","setInterval","detach","Renkan","push","defaults","templates","renkanJST","template","property_files","f","getJSON","data","concat","read_only","Models","Project","setCurrentUser","user_id","user_name","addUser","_id","current_user","renderer","redrawUsers","container","tabs","search_engines","current_user_list","UsersList","on","_tmpl","map","c","Renderer","Scene","search","_select","_input","_form","_search","type","Search","_key","key","getSearchTitle","className","getBgClass","_el","setSearchEngine","submit","val","search_engine","mouseenter","mouseleave","bins","_bin","Bin","elementDropped","_mainDiv","siblings","is","slideUp","_t","_models","where","_model","highlightModel","mouseout","unhighlightAll","dragDrop","err","e","preventDefault","touch","originalEvent","changedTouches","off","canvas_$","offset","w","width","h","height","pageX","left","pageY","top","onMouseMove","div","document","createElement","appendChild","cloneNode","dropData","text/html","innerHTML","onMouseDown","onMouseUp","dataTransfer","setData","lastsearch","lastval","regexpFromTextOrArray","source","tab","render","_text","i18n","language","substr","onStatusChange","listClasses","split","classes","i","_d","outerHeight","css","getUUID4","replace","r","Math","random","v","toString","getUID","pad","n","Date","ID_AUTO_INCREMENT","ID_BASE","getUTCFullYear","getUTCMonth","getUTCDate","_base","_n","_uidbase","test","img","Image","src","res","inherit","_baseClass","_callbefore","_class","apply","slice","_init","_initialized","extend","replaceText","makeReplaceFunc","l","k","charsrx","txt","toLowerCase","remrx","j","remsrc","charsub","getSource","inp","removeChars","String","fromCharCode","RegExp","_textOrArray","testrx","replacerx","isempty","_replace","text","_MIN_DRAG_DISTANCE","_NODE_BUTTON_WIDTH","_EDGE_BUTTON_INNER","_EDGE_BUTTON_OUTER","_CLICKMODE_ADDNODE","_CLICKMODE_STARTEDGE","_CLICKMODE_ENDEDGE","_NODE_SIZE_STEP","LN2","_MIN_SCALE","_MAX_SCALE","_MOUSEMOVE_RATE","_DOUBLETAP_DELAY","_DOUBLETAP_DISTANCE","_USER_PLACEHOLDER","default_user_color","_BOOKMARKLET_CODE","_maxlength","drawEditBox","_options","_coords","_path","_xmargin","_selector","tooltip_width","tooltip_padding","_height","_isLeft","x","paper","view","center","_left","tooltip_arrow_length","_right","_top","y","tooltip_margin","max","tooltip_arrow_width","min","_bottom","segments","point","add","closed","fillColor","GradientColor","Gradient","tooltip_top_color","tooltip_bottom_color","Backbone","guid","RenkanModel","RelationalModel","idAttribute","constructor","id","prepare","validate","addReference","_propName","_list","_default","_element","User","toJSON","Node","relations","HasOne","relatedModel","created_by","position","Edge","from","to","View","isArray","zoom_level","RosterUser","blacklist","HasMany","reverseRelation","includeInJSON","_props","_user","findOrCreate","addNode","_node","addEdge","_edge","addView","_view","removeNode","remove","removeEdge","_project","users","nodes","edges","views","_item","initialize","filter","json","clone","attributes","Model","Collection","omit","site_id","model","navigator","userLanguage","manual_save","size_bug_fix","force_resize","allow_double_click","zoom_on_scroll","element_delete_delay","autoscale_padding","default_view","user_name_editable","show_minimap","minimap_width","minimap_height","minimap_padding","minimap_background_color","minimap_border_color","minimap_highlight_color","minimap_highlight_weight","buttons_background","buttons_label_color","buttons_label_font_size","show_node_circles","clip_node_images","node_images_fill_mode","node_size_base","node_stroke_width","selected_node_stroke_width","node_fill_color","highlighted_node_fill_color","node_label_distance","node_label_max_length","label_untitled_nodes","edge_stroke_width","selected_edge_stroke_width","edge_label_distance","edge_label_max_length","edge_arrow_length","edge_arrow_width","edge_gap_in_bundles","label_untitled_edges","tooltip_border_color","tooltip_border_width","uploaded_image_max_kb","fr","Edit Node","Edit Edge","Title:","URI:","Description:","From:","To:","Image URL:","Choose Image File:","Full Screen","Add Node","Add Edge","Save Project","Open Project","Auto-save enabled","Connection lost","Created by:","Zoom In","Zoom Out","Edit","Remove","Cancel deletion","Link to another node","Enlarge","Shrink","Click on the background canvas to add a node","Click on a first node to start the edge","Click on a second node to complete the edge","Wikipedia","Wikipedia in ","French","English","Japanese","Untitled project","Lignes de Temps","Loading, please wait","Edge color:","Node color:","Choose color","Change edge direction","Do you really wish to remove node ","Do you really wish to remove edge ","This file is not an image","Image size must be under ","Size:","KB","Choose from vocabulary:","SKOS Documentation properties","has note","has example","has definition","SKOS Semantic relations","has broader","has narrower","has related","Dublin Core Metadata","has contributor","covers","created by","has date","published by","has source","has subject","Dragged resource","Search the Web","Search in Bins","Close bin","Refresh bin","(untitled)","Select contents:","Drag items from this website, drop them in Renkan","Drag this button to your bookmark bar. When on a third-party website, click it to enable drag-and-drop from the website to Renkan.","Shapes available","Circle","Square","Diamond","Hexagone","Ellipse","Star","Zoom Fit","Download Project","Zoom Save","View saved zoom","Renkan 'Drag-to-Add' bookmarklet","(unknown user)","<unknown user>","Search in graph","Search in ","jsonIO","_proj","http_method","_load","redrawActive","set","loading_status","_data","save_status","fixSize","_save","ajax","contentType","JSON","stringify","success","_thrSave","throttle","setTimeout","changedAttributes","hasChanged","jsonIOSaveOnClick","_saveWarn","_onLeave","getdata","rx","matches","location","hash","match","beforeSend","autoScale","_checkLeave","removeClass","save","hasClass","Ldt","ProjectBin","ldt_type","Resclass","console","error","tagTemplate","annotationTemplate","proj_id","project_id","ldt_platform","searchbase","highlight","_e","convertTC","_ms","_res","_totalSeconds","abs","floor","_hours","_minutes","_seconds","_html","_projtitle","meta","count","tags","_tag","_title","htitle","encodedtitle","encodeURIComponent","annotations","_annotation","_description","content","_duration","end","begin","_img","hdescription","start","duration","mediaid","media","annotationid","show","dataType","lang","_q","ResultsBin","segmentTemplate","max_results","highlightrx","objects","_segment","_begin","start_ts","_end","iri_id","element_id","format","q","limit","ResourceList","resultTemplate","list","trim","_match","langs","en","ja","query","_result","encodeURI","snippet","define","_BaseRepresentation","_renderer","_changeBinding","redraw","_removeBinding","removeRepresentation","defer","_selectBinding","select","_unselectBinding","unselect","_super","_func","moveTo","trigger","unhighlight","mousedown","mouseup","getUtils","getRenderer","requtils","BaseRepresentation","_BaseButton","_pos","sector","_newTarget","source_representation","builders","circle","getShape","Path","getImageShape","radius","rectangle","Rectangle","ellipse","polygon","RegularPolygon","diamond","d","rotate","star","svg","path","ShapeBuilder","NodeRepr","node_layer","activate","buildShape","strokeWidth","h_ratio","labels_$","normal_buttons","NodeEditButton","NodeRemoveButton","NodeLinkButton","NodeEnlargeButton","NodeShrinkButton","pending_delete_buttons","NodeRevertButton","all_buttons","active_buttons","last_circle_radius","minimap","minimap_circle","__representation","miniframe","node_group","addChild","shapeBuilder","_dontRedrawEdges","_model_coords","Point","_baseRadius","exp","is_dragging","paper_coords","toPaperCoords","circle_radius","scale","forEach","b","setSectorSize","node_image","subtract","image_delta","multiply","old_act_btn","opacity","dashArray","selected","isEditable","highlighted","_color","strokeColor","_pc","lastImage","showImage","minipos","toMinimapCoords","miniradius","minisize","Size","fitBounds","ed","repr","getRepresentationByModel","from_representation","to_representation","_image","image_cache","clipPath","hasClipPath","_clip","baseRadius","centerPoint","instructions","lastCoords","minX","Infinity","minY","maxX","maxY","transformCoords","tabc","relative","newCoords","parseFloat","isY","instr","coords","lineTo","cubicCurveTo","quadraticCurveTo","_raster","Raster","locked","Group","clipped","_circleClip","divide","throttledPaperDraw","paperShift","_delta","openEditor","removeRepresentationsOfType","_editor","addRepresentation","draw","_uri","hideButtons","buttons_timeout","undefined","textToReplace","hlvalue","saveCoords","toModelCoords","_event","_isTouch","unselectAll","click_target","edge_layer","bundle","addToBundles","line","arrow","arrow_angle","EdgeEditButton","EdgeRemoveButton","EdgeRevertButton","minimap_line","_p0a","_p1a","_v","_r","_u","_ortho","_group_pos","getPosition","_p0b","_p1b","_a","angle","_textdelta","_handle","handleIn","handleOut","_textpos","transform","-moz-transform","-webkit-transform","text_angle","reject","TempEdge","_p0","_p1","end_pos","_c","_hitResult","hitTest","findTarget","_endDrag","item","_target","_destmodel","_BaseEditor","buttons_layer","editor_block","_pts","range","editor_$","BaseEditor","NodeEditor","readOnlyTemplate","_created_by","_template","_image_placeholder","_size","closeEditor","onFieldChange","shape_changed","keyCode","change","files","FileReader","alert","onload","target","result","readAsDataURL","focus","_picker","hover","shiftSize","_newsize","titlehtml","load","EdgeEditor","_from_model","_to_model","BaseButton","_NodeButton","sectorInner","lastSectorInner","drawSector","startAngle","endAngle","imageName","clearTimeout","NodeButton","delid","delete_list","time","valueOf","confirm","unset","_off","_point","addTempEdge","MiniFrame","filesaver","representations","notif_$","setup","initialScale","totalScroll","mouse_down","selected_target","Layer","background_layer","topleft","bounds","bottomRight","cliprectangle","bundles","click_mode","_allowScroll","_originalScale","_zooming","_lastTapX","_lastTapY","icon_cache","imgname","throttledMouseMove","mousemove","mousewheel","onScroll","touchstart","_touches","touches","_lastTap","pow","onDoubleClick","touchmove","_newScale","_scaleRatio","_newOffset","setScale","touchend","dblclick","dragover","dragenter","dragleave","drop","types","t","getData","parse","bindClick","selector","fname","evt","last","fadeIn","delay","fadeOut","mouseover","onResize","_ratio","newWidth","newHeight","ratioH","delta","ratioW","resizeZoom","_thRedraw","addRepresentations","_thRedrawUsers","el","_delay","$cpwrapper","$cplist","$this","rxs","_now","findWhere","delete_scheduled","rescaleMinimap","_repr","_inR","_outR","_startAngle","_endAngle","_padding","_imgname","_caption","_startRads","PI","_endRads","_startdx","sin","_startdy","cos","_startXIn","_startYIn","_startXOut","_startYOut","_enddx","_enddy","_endXIn","_endYIn","_endXOut","_endYOut","_centerR","_centerRads","_centerX","_centerY","_centerXIn","_centerXOut","_centerYIn","_centerYOut","_textX","_textY","arcTo","PointText","characterStyle","fontSize","paragraphStyle","justification","visible","_visible","_restPos","_grp","_imgdelta","_currentPos","pivot","_edgeRepr","_bundle","_er","_dir","indexOf","savebtn","tip","_offset","force_view","_xx","_yy","_minx","_miny","_maxx","_maxy","_scale","at","redrawMiniframe","bottomright","_type","RendererType","_collection","userTemplate","allUsers","models","ulistHtml","$userpanel","$name","$cpitems","$colorsquare","$input","blur","empty","parent","name","background","_representation","_representations","_from","_tmpEdge","last_point","_scrolldelta","SQRT2","SQRT1_2","defaultDropHandler","newNode","tweetdiv","_svgimgs","_svgpaths","_imgs","_as","fields","drop_enhancer","jsondata","drop_handler","_nodedata","fullScreen","_isFull","mozFullScreen","webkitIsFullScreen","_requestMethods","_cancelMethods","widthAft","heightAft","viewSize","zoomOut","zoomIn","_scaleWidth","_scaleHeight","addNodeBtn","addEdgeBtn","exportProject","projectJSON","projectId","fileNameToSaveAs","space_id","objId","idsMap","projectJSONStr","blob","Blob","foldBins","sizeAft","foldBinsButton","sizeBef","animate","open","require","config","paths","jquery","underscore","startRenkan"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,KAAgB,UAAIA,KAAgB,cAEpCA,KAAgB,UAAE,6BAA+B,SAASC,KAC1DA,MAAQA,OACR,EAAA,GAAIC,KAAKC,IAAM,GAAIC,IAAMC,EAAEC,MAAcC,OAAMC,UAAUC,KAEzD,KAAMR,IACNE,KAAO,gDACPC,IAAIM,OAAOC,UAAU,cACrB,gCACAP,IAAIM,OAAOC,UAAU,WACrB,8DACAP,IAAIQ,KAAKC,OACT,eACKC,QAAQC,uBACbZ,KAAO,oBACPC,IAAIM,OAAOC,UAAU,SACrB,6DACAP,IAAIQ,KAAKI,KACT,yCACAZ,IAAIQ,KAAKI,KACT,mCACKF,QAAQG,WAAWC,SACxBf,KAAO,sBACPC,IAAIM,OAAOC,UAAU,4BACrB,yDACCN,EAAES,QAAQG,YAAYE,KAAK,SAASC,GACrCjB,KAAO,oEACPC,IAAKM,OAAOC,UAAUS,EAASC,QAC/B,0BACChB,EAAEe,EAASH,YAAYE,KAAK,SAASG,GAAY,GAAIN,GAAMI,EAAS,YAAcE,EAASN,GAC5Fb,MAAO,8DACPC,IAAKY,GACL,aACKA,IAAQJ,KAAKI,MAClBb,KAAO,aAEPA,KAAO,aACPC,IAAKM,OAAOC,UAAUW,EAASD,QAC/B,6BAEAlB,KAAO,WAEPA,KAAO,6BAEPA,KAAO,KACFW,QAAQS,yBACbpB,KAAO,iEACPC,IAAIM,OAAOC,UAAU,gBACrB,8LACmC,OAAjCT,IAAQQ,OAAmB,aAAa,GAAKR,KAC/C,+CACAE,IAAKM,OAAOC,UAAU,iBACtB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gBC,EAAkBC,EAAkB0F,EAAWtvB,GAInS,GAAIhH,GAAO6E,OAAO7E,IAEU,oBAAlBA,GAAK+G,WACX/G,EAAK+G,YAET,IAAIA,GAAW/G,EAAK+G,QAEpBA,GAASof,oBAAsBqB,EAC/BzgB,EAAS0gB,YAAc0N,EACvBpuB,EAASgN,KAAOiV,EAChBjiB,EAASsN,KAAOA,EAChBtN,EAASqrB,SAAWA,EACpBrrB,EAASisB,YAAcM,EACvBvsB,EAASwsB,WAAaA,EACtBxsB,EAASiuB,WAAaA,EACtBjuB,EAASquB,YAAcQ,EACvB7uB,EAASyiB,eAAiBA,EAC1BziB,EAAS0iB,iBAAmBA,EAC5B1iB,EAAS+iB,iBAAmBA,EAC5B/iB,EAAS2iB,eAAiBA,EAC1B3iB,EAAS4iB,kBAAoBA,EAC7B5iB,EAAS6iB,iBAAmBA,EAC5B7iB,EAAS2pB,eAAiBA,EAC1B3pB,EAAS4pB,iBAAmBA,EAC5B5pB,EAAS6pB,iBAAmBA,EAC5B7pB,EAASuvB,UAAYA,EACrBvvB,EAASC,MAAQA,EAEjBi9B,gBAGJ/d,OAAO,gBAAiB","sourcesContent":["this[\"renkanJST\"] = this[\"renkanJST\"] || {};\n\nthis[\"renkanJST\"][\"templates/edgeeditor.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n__p += '<h2>\\n\\t<span class=\"Rk-CloseX\">&times;</span>' +\n__e(renkan.translate(\"Edit Edge\")) +\n'</span>\\n</h2>\\n<p>\\n\\t<label>' +\n__e(renkan.translate(\"Title:\")) +\n'</label>\\n\\t<input class=\"Rk-Edit-Title\" type=\"text\" value=\"' +\n__e(edge.title) +\n'\" />\\n</p>\\n';\n if (options.show_edge_editor_uri) { ;\n__p += '\\n\\t<p>\\n\\t\\t<label>' +\n__e(renkan.translate(\"URI:\")) +\n'</label>\\n\\t\\t<input class=\"Rk-Edit-URI\" type=\"text\" value=\"' +\n__e(edge.uri) +\n'\" />\\n\\t\\t<a class=\"Rk-Edit-Goto\" href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\"></a>\\n\\t</p>\\n\\t';\n if (options.properties.length) { ;\n__p += '\\n\\t\\t<p>\\n\\t\\t\\t<label>' +\n__e(renkan.translate(\"Choose from vocabulary:\")) +\n'</label>\\n\\t\\t\\t<select class=\"Rk-Edit-Vocabulary\">\\n\\t\\t\\t\\t';\n _(options.properties).each(function(ontology) { ;\n__p += '\\n\\t\\t\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Class\" value=\"\">\\n\\t\\t\\t\\t\\t\\t' +\n__e( renkan.translate(ontology.label) ) +\n'\\n\\t\\t\\t\\t\\t</option>\\n\\t\\t\\t\\t\\t';\n _(ontology.properties).each(function(property) { var uri = ontology[\"base-uri\"] + property.uri; ;\n__p += '\\n\\t\\t\\t\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"' +\n__e( uri ) +\n'\"\\n\\t\\t\\t\\t\\t\\t\\t';\n if (uri === edge.uri) { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e( renkan.translate(property.label) ) +\n'\\n\\t\\t\\t\\t\\t\\t</option>\\n\\t\\t\\t\\t\\t';\n }) ;\n__p += '\\n\\t\\t\\t\\t';\n }) ;\n__p += '\\n\\t\\t\\t</select>\\n\\t\\t</p>\\n';\n } } ;\n__p += '\\n';\n if (options.show_edge_editor_color) { ;\n__p += '\\n\\t<div class=\"Rk-Editor-p\">\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Edge color:\")) +\n'</span>\\n\\t\\t<div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n\\t\\t\\t<span class=\"Rk-Edit-Color\" style=\"background: &lt;%-edge.color%>;\">\\n\\t\\t\\t\\t<span class=\"Rk-Edit-ColorTip\"></span>\\n\\t\\t\\t</span>\\n\\t\\t\\t' +\n((__t = ( renkan.colorPicker )) == null ? '' : __t) +\n'\\n\\t\\t\\t<span class=\"Rk-Edit-ColorPicker-Text\">' +\n__e( renkan.translate(\"Choose color\") ) +\n'</span>\\n\\t\\t</div>\\n\\t</div>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_direction) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Edit-Direction\">' +\n__e( renkan.translate(\"Change edge direction\") ) +\n'</span>\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_nodes) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"From:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e(edge.from_color) +\n';\"></span>\\n\\t\\t' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n\\t</p>\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"To:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: >%-edge.to_color%>;\"></span>\\n\\t\\t' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_creator && edge.has_creator) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: &lt;%-edge.created_by_color%>;\"></span>\\n\\t\\t' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/edgeeditor_readonly.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n__p += '<h2>\\n\\t<span class=\"Rk-CloseX\">&times;</span>\\n\\t';\n if (options.show_edge_tooltip_color) { ;\n__p += '\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.color ) +\n';\"></span>\\n\\t';\n } ;\n__p += '\\n\\t<span class=\"Rk-Display-Title\">\\n\\t\\t';\n if (edge.uri) { ;\n__p += '\\n\\t\\t\\t<a href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\">\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t' +\n__e(edge.title) +\n'\\n\\t\\t';\n if (edge.uri) { ;\n__p += ' </a> ';\n } ;\n__p += '\\n\\t</span>\\n</h2>\\n';\n if (options.show_edge_tooltip_uri && edge.uri) { ;\n__p += '\\n\\t<p class=\"Rk-Display-URI\">\\n\\t\\t<a href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\">' +\n__e( edge.short_uri ) +\n'</a>\\n\\t</p>\\n';\n } ;\n__p += '\\n<p>' +\n__e(edge.description) +\n'</p>\\n';\n if (options.show_edge_tooltip_nodes) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"From:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.from_color ) +\n';\"></span>\\n\\t\\t' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n\\t</p>\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"To:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.to_color ) +\n';\"></span>\\n\\t\\t' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_tooltip_creator && edge.has_creator) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.created_by_color ) +\n';\"></span>\\n\\t\\t' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/ldtjson-bin/annotationtemplate.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li class=\"Rk-Bin-Item\" draggable=\"true\"\\n\\tdata-image=\"' +\n__e( Rkns.Utils.getFullURL(image) ) +\n'\"\\n\\tdata-uri=\"' +\n((__t = (ldt_platform)) == null ? '' : __t) +\n'ldtplatform/ldt/front/player/' +\n((__t = (mediaid)) == null ? '' : __t) +\n'/#id=' +\n((__t = (annotationid)) == null ? '' : __t) +\n'\"\\n\\tdata-title=\"' +\n__e(title) +\n'\" data-description=\"' +\n__e(description) +\n'\">\\n\\t\\n\\t<img class=\"Rk-Ldt-Annotation-Icon\" src=\"' +\n((__t = (image)) == null ? '' : __t) +\n'\" />\\n\\t<h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n\\t<p>' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n\\t<p>Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n'</p>\\n\\t<div class=\"Rk-Clear\"></div>\\n</li>';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/ldtjson-bin/segmenttemplate.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li class=\"Rk-Bin-Item\" draggable=\"true\"\\n\\tdata-image=\"' +\n__e( Rkns.Utils.getFullURL(image) ) +\n'\"\\n\\tdata-uri=\"' +\n((__t = (ldt_platform)) == null ? '' : __t) +\n'ldtplatform/ldt/front/player/' +\n((__t = (mediaid)) == null ? '' : __t) +\n'/#id=' +\n((__t = (annotationid)) == null ? '' : __t) +\n'\"\\n\\tdata-title=\"' +\n__e(title) +\n'\" data-description=\"' +\n__e(description) +\n'\">\\n\\t\\n\\t<img class=\"Rk-Ldt-Annotation-Icon\" src=\"' +\n((__t = (image)) == null ? '' : __t) +\n'\" />\\n\\t<h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n\\t<p>' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n\\t<p>Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n'</p>\\n\\t<div class=\"Rk-Clear\"></div>\\n</li>';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/ldtjson-bin/tagtemplate.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li class=\"Rk-Bin-Item\" draggable=\"true\"\\n\\tdata-image=\"' +\n__e( Rkns.Utils.getFullURL(static_url+'img/ldt-tag.png') ) +\n'\"\\n\\tdata-uri=\"' +\n((__t = (ldt_platform)) == null ? '' : __t) +\n'ldtplatform/ldt/front/search/?search=' +\n((__t = (encodedtitle)) == null ? '' : __t) +\n'&field=all\"\\n\\tdata-title=\"' +\n__e(title) +\n'\" data-description=\"Tag \\'' +\n__e(title) +\n'\\'\">\\n\\n\\t<img class=\"Rk-Ldt-Tag-Icon\" src=\"' +\n__e(static_url) +\n'img/ldt-tag.png\" />\\n\\t<h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n\\t<div class=\"Rk-Clear\"></div>\\n</li>';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/list-bin.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n__p += '<li class=\"Rk-Bin-Item Rk-ResourceList-Item\" draggable=\"true\"\\n\\tdata-uri=\"' +\n__e(url) +\n'\" data-title=\"' +\n__e(title) +\n'\"\\n\\tdata-description=\"' +\n__e(description) +\n'\"\\n\\t';\n if (image) { ;\n__p += '\\n\\t\\tdata-image=\"' +\n__e( Rkns.Utils.getFullURL(image) ) +\n'\"\\n\\t';\n } else { ;\n__p += '\\n\\t\\tdata-image=\"\"\\n\\t';\n } ;\n__p += '\\n>';\n if (image) { ;\n__p += '\\n\\t<img class=\"Rk-ResourceList-Image\" src=\"' +\n__e(image) +\n'\" />\\n';\n } ;\n__p += '\\n<h4 class=\"Rk-ResourceList-Title\">\\n\\t';\n if (url) { ;\n__p += '\\n\\t\\t<a href=\"' +\n__e(url) +\n'\" target=\"_blank\">\\n\\t';\n } ;\n__p += '\\n\\t' +\n((__t = (htitle)) == null ? '' : __t) +\n'\\n\\t';\n if (url) { ;\n__p += '</a>';\n } ;\n__p += '\\n\\t</h4> \\n\\t';\n if (description) { ;\n__p += '\\n\\t\\t<p class=\"Rk-ResourceList-Description\">' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n\\t';\n } ;\n__p += '\\n\\t';\n if (image) { ;\n__p += '\\n\\t\\t<div style=\"clear: both;\"></div>\\n\\t';\n } ;\n__p += '\\n</li>';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/main.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n\n if (options.show_bins) { ;\n__p += '\\n\\t<div class=\"Rk-Bins\">\\n\\t\\t<div class=\"Rk-Bins-Head\">\\n\\t\\t\\t<h2 class=\"Rk-Bins-Title\">' +\n__e( translate(\"Select contents:\")) +\n'</h2>\\n\\t\\t\\t<form class=\"Rk-Web-Search-Form Rk-Search-Form\">\\n\\t\\t\\t\\t<input class=\"Rk-Web-Search-Input Rk-Search-Input\" type=\"search\"\\n\\t\\t\\t\\t\\tplaceholder=\"' +\n__e( translate('Search theWeb') ) +\n'\" />\\n\\t\\t\\t\\t<div class=\"Rk-Search-Select\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-Search-Current\"></div>\\n\\t\\t\\t\\t\\t<ul class=\"Rk-Search-List\"></ul>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t<input type=\"submit\" value=\"\"\\n\\t\\t\\t\\t\\tclass=\"Rk-Web-Search-Submit Rk-Search-Submit\" title=\"' +\n__e( translate('Search theWeb') ) +\n'\" />\\n\\t\\t\\t</form>\\n\\t\\t\\t<form class=\"Rk-Bins-Search-Form Rk-Search-Form\">\\n\\t\\t\\t\\t<input class=\"Rk-Bins-Search-Input Rk-Search-Input\" type=\"search\"\\n\\t\\t\\t\\t\\tplaceholder=\"' +\n__e( translate('Search inBins') ) +\n'\" /> <input\\n\\t\\t\\t\\t\\ttype=\"submit\" value=\"\"\\n\\t\\t\\t\\t\\tclass=\"Rk-Bins-Search-Submit Rk-Search-Submit\"\\n\\t\\t\\t\\t\\ttitle=\"' +\n__e( translate('Search inBins') ) +\n'\" />\\n\\t\\t\\t</form>\\n\\t\\t</div>\\n\\t\\t<ul class=\"Rk-Bin-List\"></ul>\\n\\t</div>\\n';\n } ;\n__p += ' ';\n if (options.show_editor) { ;\n__p += '\\n\\t<div class=\"Rk-Render Rk-Render-';\n if (options.show_bins) { ;\n__p += 'Panel';\n } else { ;\n__p += 'Full';\n } ;\n__p += '\"></div>\\n';\n } ;\n__p += '\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/nodeeditor.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n__p += '<h2>\\n\\t<span class=\"Rk-CloseX\">&times;</span>' +\n__e(renkan.translate(\"Edit Node\")) +\n'</span>\\n</h2>\\n<p>\\n\\t<label>' +\n__e(renkan.translate(\"Title:\")) +\n'</label>\\n\\t<input class=\"Rk-Edit-Title\" type=\"text\" value=\"' +\n__e(node.title) +\n'\" />\\n</p>\\n';\n if (options.show_node_editor_uri) { ;\n__p += '\\n\\t<p>\\n\\t\\t<label>' +\n__e(renkan.translate(\"URI:\")) +\n'</label>\\n\\t\\t<input class=\"Rk-Edit-URI\" type=\"text\" value=\"' +\n__e(node.uri) +\n'\" />\\n\\t\\t<a class=\"Rk-Edit-Goto\" href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\"></a>\\n\\t</p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_description) { ;\n__p += '\\n\\t<p>\\n\\t\\t<label>' +\n__e(renkan.translate(\"Description:\")) +\n'</label>\\n\\t\\t<textarea class=\"Rk-Edit-Description\">' +\n__e(node.description) +\n'</textarea>\\n\\t</p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_size) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Size:\")) +\n'</span>\\n\\t\\t<a href=\"#\" class=\"Rk-Edit-Size-Down\">-</a>\\n\\t\\t<span class=\"Rk-Edit-Size-Value\">' +\n__e(node.size) +\n'</span>\\n\\t\\t<a href=\"#\" class=\"Rk-Edit-Size-Up\">+</a>\\n\\t</p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_color) { ;\n__p += '\\n\\t<div class=\"Rk-Editor-p\">\\n\\t\\t<span class=\"Rk-Editor-Label\">\\n\\t\\t' +\n__e(renkan.translate(\"Node color:\")) +\n'</span>\\n\\t\\t<div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n\\t\\t\\t<span class=\"Rk-Edit-Color\" style=\"background: ' +\n__e(node.color) +\n';\">\\n\\t\\t\\t\\t<span class=\"Rk-Edit-ColorTip\"></span>\\n\\t\\t\\t</span>\\n\\t\\t\\t' +\n((__t = ( renkan.colorPicker )) == null ? '' : __t) +\n'\\n\\t\\t\\t<span class=\"Rk-Edit-ColorPicker-Text\">' +\n__e( renkan.translate(\"Choose color\") ) +\n'</span>\\n\\t\\t</div>\\n\\t</div>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_image) { ;\n__p += '\\n\\t<div class=\"Rk-Edit-ImgWrap\">\\n\\t\\t<div class=\"Rk-Edit-ImgPreview\">\\n\\t\\t\\t<img src=\"' +\n__e(node.image || node.image_placeholder) +\n'\" />\\n\\t\\t\\t';\n if (node.clip_path) { ;\n__p += '\\n\\t\\t\\t\\t<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewbox=\"0 0 1 1\" preserveAspectRatio=\"none\">\\n\\t\\t\\t\\t\\t<path style=\"stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;\" d=\"' +\n__e( node.clip_path ) +\n'\" />\\n\\t\\t\\t\\t</svg>\\n\\t\\t\\t';\n };\n__p += '\\n\\t\\t</div>\\n\\t</div>\\n\\t<p>\\n\\t\\t<label>' +\n__e(renkan.translate(\"Image URL:\")) +\n'</label>\\n\\t\\t<div>\\n\\t\\t\\t<a class=\"Rk-Edit-Image-Del\" href=\"#\"></a>\\n\\t\\t\\t<input class=\"Rk-Edit-Image\" type=\"text\" value=\\'' +\n__e(node.image) +\n'\\' />\\n\\t\\t</div>\\n\\t</p>\\n';\n if (options.allow_image_upload) { ;\n__p += '\\n\\t<p>\\n\\t\\t<label>' +\n__e(renkan.translate(\"Choose Image File:\")) +\n'</label>\\n\\t\\t<input class=\"Rk-Edit-Image-File\" type=\"file\" accept=\"image/*\" />\\n\\t</p>\\n';\n };\n\n } ;\n__p += ' ';\n if (options.show_node_editor_creator && node.has_creator) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.created_by_color) +\n';\"></span>\\n\\t\\t' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n\\t</p>\\n';\n } ;\n__p += ' ';\n if (options.change_shapes) { ;\n__p += '\\n\\t<p>\\n\\t\\t<label>' +\n__e(renkan.translate(\"Shapes available\")) +\n':</label>\\n\\t\\t<select class=\"Rk-Edit-Shape\">\\n\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"circle\"';\n if (node.shape === \"circle\") { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t' +\n__e( renkan.translate(\"Circle\") ) +\n'\\n\\t\\t\\t</option>\\n\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"rectangle\"';\n if (node.shape === \"rectangle\") { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t' +\n__e( renkan.translate(\"Square\") ) +\n'\\n\\t\\t\\t</option>\\n\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"diamond\"';\n if (node.shape === \"diamond\") { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t' +\n__e( renkan.translate(\"Diamond\") ) +\n'\\n\\t\\t\\t</option>\\n\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"polygon\"';\n if (node.shape === \"polygon\") { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t' +\n__e( renkan.translate(\"Hexagone\") ) +\n'\\n\\t\\t\\t</option>\\n\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"ellipse\"';\n if (node.shape === \"ellipse\") { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t' +\n__e( renkan.translate(\"Ellipse\") ) +\n'\\n\\t\\t\\t</option>\\n\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"star\"';\n if (node.shape === \"star\") { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t' +\n__e( renkan.translate(\"Star\") ) +\n'\\n\\t\\t\\t</option>\\n\\t\\t</select>\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/nodeeditor_readonly.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n__p += '<h2>\\n\\t<span class=\"Rk-CloseX\">&times;</span>\\n\\t';\n if (options.show_node_tooltip_color) { ;\n__p += '\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.color) +\n';\"></span>\\n\\t';\n } ;\n__p += '\\n\\t<span class=\"Rk-Display-Title\">\\n\\t\\t';\n if (node.uri) { ;\n__p += '\\n\\t\\t\\t<a href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\">\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t' +\n__e(node.title) +\n'\\n\\t\\t';\n if (node.uri) { ;\n__p += '</a>';\n } ;\n__p += '\\n\\t</span>\\n</h2>\\n';\n if (node.uri && options.show_node_tooltip_uri) { ;\n__p += '\\n\\t<p class=\"Rk-Display-URI\">\\n\\t\\t<a href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\">' +\n__e(node.short_uri) +\n'</a>\\n\\t</p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_tooltip_description) { ;\n__p += '\\n\\t<p class=\"Rk-Display-Description\">' +\n__e(node.description) +\n'</p>\\n';\n } ;\n__p += ' ';\n if (node.image && options.show_node_tooltip_image) { ;\n__p += '\\n\\t<img class=\"Rk-Display-ImgPreview\" src=\"' +\n__e(node.image) +\n'\" />\\n';\n } ;\n__p += ' ';\n if (node.has_creator && options.show_node_tooltip_creator) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.created_by_color) +\n';\"></span>\\n\\t\\t' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/scene.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n\n if (options.show_top_bar) { ;\n__p += '\\n\\t<div class=\"Rk-TopBar\">\\n\\t\\t<div class=\"loader\"></div>\\n\\t\\t';\n if (!options.editor_mode) { ;\n__p += '\\n\\t\\t\\t<h2 class=\"Rk-PadTitle\">\\n\\t\\t\\t\\t' +\n__e( project.get(\"title\") || translate(\"Untitled project\")) +\n'\\n\\t\\t\\t</h2>\\n\\t\\t';\n } else { ;\n__p += '\\n\\t\\t\\t<input type=\"text\" class=\"Rk-PadTitle\" value=\"' +\n__e( project.get('title') || '' ) +\n'\" placeholder=\"' +\n__e(translate('Untitled project')) +\n'\" />\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n if (options.show_user_list) { ;\n__p += '\\n\\t\\t\\t<div class=\"Rk-Users\">\\n\\t\\t\\t\\t<div class=\"Rk-CurrentUser\">\\n\\t\\t\\t\\t\\t';\n if (options.show_user_color) { ;\n__p += '\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n\\t\\t\\t\\t\\t\\t\\t<span class=\"Rk-CurrentUser-Color\">\\n\\t\\t\\t\\t\\t\\t\\t';\n if (options.user_color_editable) { ;\n__p += '\\n\\t\\t\\t\\t\\t\\t\\t\\t<span class=\"Rk-Edit-ColorTip\"></span>\\n\\t\\t\\t\\t\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t\\t\\t\\t\\t</span>\\n\\t\\t\\t\\t\\t\\t\\t';\n if (options.user_color_editable) { print(colorPicker) } ;\n__p += '\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t\\t\\t<span class=\"Rk-CurrentUser-Name\">&lt;unknown user&gt;</span>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t<ul class=\"Rk-UserList\"></ul>\\n\\t\\t\\t</div>\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n if (options.home_button_url) {;\n__p += '\\n\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t<a class=\"Rk-TopBar-Button Rk-Home-Button\" href=\"' +\n__e( options.home_button_url ) +\n'\">\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t' +\n__e( translate(options.home_button_title) ) +\n'\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t</a>\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n if (options.show_fullscreen_button) { ;\n__p += '\\n\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-FullScreen-Button\">\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Full Screen\")) +\n'\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t</div>\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n if (options.editor_mode) { ;\n__p += '\\n\\t\\t\\t';\n if (options.show_addnode_button) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-AddNode-Button\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Add Node\")) +\n'\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t';\n if (options.show_addedge_button) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-AddEdge-Button\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Add Edge\")) +\n'\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t';\n if (options.show_export_button) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-Export-Button\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Download Project\")) +\n'\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t';\n if (options.show_save_button) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-Save-Button\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\"></div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t';\n if (options.show_open_button) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-Open-Button\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Open Project\")) +\n'\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t';\n if (options.show_bookmarklet) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<a class=\"Rk-TopBar-Button Rk-Bookmarklet-Button\" href=\"#\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Renkan \\'Drag-to-Add\\' bookmarklet\")) +\n'\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</a>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n } else { ;\n__p += '\\n\\t\\t\\t';\n if (options.show_export_button) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-Export-Button\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Download Project\")) +\n'\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n }; ;\n__p += '\\n\\t\\t';\n if (options.show_search_field) { ;\n__p += '\\n\\t\\t\\t<form action=\"#\" class=\"Rk-GraphSearch-Form\">\\n\\t\\t\\t\\t<input type=\"search\" class=\"Rk-GraphSearch-Field\" placeholder=\"' +\n__e( translate('Search in graph') ) +\n'\" />\\n\\t\\t\\t</form>\\n\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t';\n } ;\n__p += '\\n\\t</div>\\n';\n } ;\n__p += '\\n<div class=\"Rk-Editing-Space';\n if (!options.show_top_bar) { ;\n__p += ' Rk-Editing-Space-Full';\n } ;\n__p += '\">\\n\\t<div class=\"Rk-Labels\"></div>\\n\\t<canvas class=\"Rk-Canvas\" ';\n if (options.resize) { ;\n__p += ' resize=\"\" ';\n } ;\n__p += '></canvas>\\n\\t<div class=\"Rk-Notifications\"></div>\\n\\t<div class=\"Rk-Editor\">\\n\\t\\t';\n if (options.show_bins) { ;\n__p += '\\n\\t\\t\\t<div class=\"Rk-Fold-Bins\">&laquo;</div>\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n if (options.show_zoom) { ;\n__p += '\\n\\t\\t\\t<div class=\"Rk-ZoomButtons\">\\n\\t\\t\\t\\t<div class=\"Rk-ZoomIn\" title=\"' +\n__e(translate('Zoom In')) +\n'\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-ZoomFit\" title=\"' +\n__e(translate('Zoom Fit')) +\n'\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-ZoomOut\" title=\"' +\n__e(translate('Zoom Out')) +\n'\"></div>\\n\\t\\t\\t\\t';\n if (options.editor_mode && options.save_view) { ;\n__p += '\\n\\t\\t\\t\\t\\t<div class=\"Rk-ZoomSave\" title=\"' +\n__e(translate('Zoom Save')) +\n'\"></div>\\n\\t\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t\\t';\n if (options.save_view) { ;\n__p += '\\n\\t\\t\\t\\t\\t<div class=\"Rk-ZoomSetSaved\" title=\"' +\n__e(translate('View saved zoom')) +\n'\"></div>\\n\\t\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t</div>\\n\\t\\t';\n } ;\n__p += '\\n\\t</div>\\n</div>';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/wikipedia-bin/resulttemplate.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li class=\"Rk-Wikipedia-Result Rk-Bin-Item\" draggable=\"true\"\\n\\tdata-uri=\"' +\n__e(url) +\n'\" data-title=\"Wikipedia: ' +\n__e(title) +\n'\"\\n\\tdata-description=\"' +\n__e(description) +\n'\"\\n\\tdata-image=\"' +\n__e( Rkns.Utils.getFullURL( static_url + 'img/wikipedia.png' ) ) +\n'\">\\n\\t\\n\\t<img class=\"Rk-Wikipedia-Icon\" src=\"' +\n__e(static_url) +\n'img/wikipedia.png\">\\n\\t<h4 class=\"Rk-Wikipedia-Title\">\\n\\t\\t<a href=\"' +\n__e(url) +\n'\" target=\"_blank\">' +\n((__t = (htitle)) == null ? '' : __t) +\n'</a>\\n\\t</h4>\\n\\t<p class=\"Rk-Wikipedia-Snippet\">' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n</li>';\n\n}\nreturn __p\n};","\n/* Declaring the Renkan Namespace Rkns and Default values */\n\n(function(root) {\n\n\"use strict\";\n\nif (typeof root.Rkns !== \"object\") {\n    root.Rkns = {};\n}\n\nvar Rkns = root.Rkns;\nvar $ = Rkns.$ = root.jQuery;\nvar _ = Rkns._ = root._;\n\nRkns.pickerColors = [\"#8f1919\", \"#a80000\", \"#d82626\", \"#ff0000\", \"#e87c7c\", \"#ff6565\", \"#f7d3d3\", \"#fecccc\",\n    \"#8f5419\", \"#a85400\", \"#d87f26\", \"#ff7f00\", \"#e8b27c\", \"#ffb265\", \"#f7e5d3\", \"#fee5cc\",\n    \"#8f8f19\", \"#a8a800\", \"#d8d826\", \"#feff00\", \"#e8e87c\", \"#feff65\", \"#f7f7d3\", \"#fefecc\",\n    \"#198f19\", \"#00a800\", \"#26d826\", \"#00ff00\", \"#7ce87c\", \"#65ff65\", \"#d3f7d3\", \"#ccfecc\",\n    \"#198f8f\", \"#00a8a8\", \"#26d8d8\", \"#00feff\", \"#7ce8e8\", \"#65feff\", \"#d3f7f7\", \"#ccfefe\",\n    \"#19198f\", \"#0000a8\", \"#2626d8\", \"#0000ff\", \"#7c7ce8\", \"#6565ff\", \"#d3d3f7\", \"#ccccfe\",\n    \"#8f198f\", \"#a800a8\", \"#d826d8\", \"#ff00fe\", \"#e87ce8\", \"#ff65fe\", \"#f7d3f7\", \"#feccfe\",\n    \"#000000\", \"#242424\", \"#484848\", \"#6d6d6d\", \"#919191\", \"#b6b6b6\", \"#dadada\", \"#ffffff\"];\n\nRkns.__renkans = [];\n\nvar _BaseBin = Rkns._BaseBin = function(_renkan, _opts) {\n    if (typeof _renkan !== \"undefined\") {\n        this.renkan = _renkan;\n        this.renkan.$.find(\".Rk-Bin-Main\").hide();\n        this.$ = Rkns.$('<li>')\n            .addClass(\"Rk-Bin\")\n            .appendTo(_renkan.$.find(\".Rk-Bin-List\"));\n        this.title_icon_$ = Rkns.$('<span>')\n            .addClass(\"Rk-Bin-Title-Icon\")\n            .appendTo(this.$);\n\n        var _this = this;\n\n        Rkns.$('<a>')\n            .attr({\n                href: \"#\",\n                title: _renkan.translate(\"Close bin\")\n            })\n            .addClass(\"Rk-Bin-Close\")\n            .html('&times;')\n            .appendTo(this.$)\n            .click(function() {\n                _this.destroy();\n                if (!_renkan.$.find(\".Rk-Bin-Main:visible\").length) {\n                    _renkan.$.find(\".Rk-Bin-Main:last\").slideDown();\n                }\n                _renkan.resizeBins();\n                return false;\n            });\n        Rkns.$('<a>')\n            .attr({\n                href: \"#\",\n                title: _renkan.translate(\"Refresh bin\")\n            })\n            .addClass(\"Rk-Bin-Refresh\")\n            .appendTo(this.$)\n            .click(function() {\n                _this.refresh();\n                return false;\n            });\n        this.count_$ = Rkns.$('<div>')\n            .addClass(\"Rk-Bin-Count\")\n            .appendTo(this.$);\n        this.title_$ = Rkns.$('<h2>')\n            .addClass(\"Rk-Bin-Title\")\n            .appendTo(this.$);\n        this.main_$ = Rkns.$('<div>')\n            .addClass(\"Rk-Bin-Main\")\n            .appendTo(this.$)\n            .html('<h4 class=\"Rk-Bin-Loading\">' + _renkan.translate(\"Loading, please wait\") + '</h4>');\n        this.title_$.html(_opts.title || '(new bin)');\n        this.renkan.resizeBins();\n\n        if (_opts.auto_refresh) {\n            window.setInterval(function() {\n                _this.refresh();\n            },_opts.auto_refresh);\n        }\n    }\n};\n\n_BaseBin.prototype.destroy = function() {\n    this.$.detach();\n    this.renkan.resizeBins();\n};\n\n/* Point of entry */\n\nvar Renkan = Rkns.Renkan = function(_opts) {\n    var _this = this;\n\n    Rkns.__renkans.push(this);\n\n    this.options = _.defaults(_opts, Rkns.defaults, {templates: renkanJST});\n    this.template = renkanJST['templates/main.html'];\n\n    _(this.options.property_files).each(function(f) {\n        Rkns.$.getJSON(f, function(data) {\n            _this.options.properties = _this.options.properties.concat(data);\n        });\n    });\n\n    this.read_only = this.options.read_only || !this.options.editor_mode;\n\n    this.project = new Rkns.Models.Project();\n\n    this.setCurrentUser = function (user_id, user_name) {\n    \tthis.project.addUser({\n    \t\t_id:user_id,\n    \t\ttitle: user_name\n    \t});\n    \tthis.current_user = user_id;\n    \tthis.renderer.redrawUsers();\n    };\n    \n    if (typeof this.options.user_id !== \"undefined\") {\n        this.current_user = this.options.user_id;\n    }\n    this.$ = Rkns.$(\"#\" + this.options.container);\n    this.$\n        .addClass(\"Rk-Main\")\n        .html(this.template(this));\n\n    this.tabs = [];\n    this.search_engines = [];\n\n    this.current_user_list = new Rkns.Models.UsersList();\n\n    this.current_user_list.on(\"add remove\", function() {\n        if (this.renderer) {\n            this.renderer.redrawUsers();\n        }\n    });\n\n    this.colorPicker = (function() {\n        var _tmpl = _.template('<li data-color=\"<%=c%>\" style=\"background: <%=c%>\"></li>');\n        return '<ul class=\"Rk-Edit-ColorPicker\">' + Rkns.pickerColors.map(function(c) { return _tmpl({c:c});}).join(\"\") + '</ul>';\n    })();\n\n    if (this.options.show_editor) {\n        this.renderer = new Rkns.Renderer.Scene(this);\n    }\n\n    if (!this.options.search.length) {\n        this.$.find(\".Rk-Web-Search-Form\").detach();\n    } else {\n        var _tmpl = _.template('<li class=\"<%= className %>\" data-key=\"<%= key %>\"><%= title %></li>'),\n            _select = this.$.find(\".Rk-Search-List\"),\n            _input = this.$.find(\".Rk-Web-Search-Input\"),\n            _form = this.$.find(\".Rk-Web-Search-Form\");\n        _(this.options.search).each(function(_search, _key) {\n            if (Rkns[_search.type] && Rkns[_search.type].Search) {\n                _this.search_engines.push(new Rkns[_search.type].Search(_this, _search));\n            }\n        });\n        _select.html(\n            _(this.search_engines).map(function(_search, _key) {\n                return _tmpl({\n                    key: _key,\n                    title: _search.getSearchTitle(),\n                    className: _search.getBgClass()\n                });\n            }).join(\"\")\n        );\n        _select.find(\"li\").click(function() {\n            var _el = Rkns.$(this);\n            _this.setSearchEngine(_el.attr(\"data-key\"));\n            _form.submit();\n        });\n        _form.submit(function() {\n            if (_input.val()) {\n                var _search = _this.search_engine;\n                _search.search(_input.val());\n            }\n            return false;\n        });\n        this.$.find(\".Rk-Search-Current\").mouseenter(\n            function() { _select.slideDown(); }\n        );\n        this.$.find(\".Rk-Search-Select\").mouseleave(\n            function() { _select.hide(); }\n        );\n        this.setSearchEngine(0);\n    }\n    _(this.options.bins).each(function(_bin) {\n        if (Rkns[_bin.type] && Rkns[_bin.type].Bin) {\n            _this.tabs.push(new Rkns[_bin.type].Bin(_this, _bin));\n        }\n    });\n\n    var elementDropped = false;\n\n    this.$.find(\".Rk-Bins\")\n        .on(\"click\",\".Rk-Bin-Title,.Rk-Bin-Title-Icon\", function() {\n            var _mainDiv = Rkns.$(this).siblings(\".Rk-Bin-Main\");\n            if (_mainDiv.is(\":hidden\")) {\n                _this.$.find(\".Rk-Bin-Main\").slideUp();\n                _mainDiv.slideDown();\n            }\n        });\n\n    if (this.options.show_editor) {\n\n        this.$.find(\".Rk-Bins\").on(\"mouseover\", \".Rk-Bin-Item\", function(_e) {\n            var _t = Rkns.$(this);\n            if (_t && $(_t).attr(\"data-uri\")) {\n                var _models = _this.project.get(\"nodes\").where({\n                    uri: $(_t).attr(\"data-uri\")\n                });\n                _(_models).each(function(_model) {\n                    _this.renderer.highlightModel(_model);\n                });\n            }\n        }).mouseout(function() {\n            _this.renderer.unhighlightAll();\n        }).on(\"mousemove\", \".Rk-Bin-Item\", function(e) {\n            try {\n                this.dragDrop();\n            }\n            catch(err) {}\n        }).on(\"touchstart\", \".Rk-Bin-Item\", function(e) {\n            elementDropped = false;\n        }).on(\"touchmove\", \".Rk-Bin-Item\", function(e) {\n            e.preventDefault();\n            var touch = e.originalEvent.changedTouches[0],\n                off = _this.renderer.canvas_$.offset(),\n                w = _this.renderer.canvas_$.width(),\n                h = _this.renderer.canvas_$.height();\n            if (touch.pageX >= off.left && touch.pageX < (off.left + w) && touch.pageY >= off.top && touch.pageY < (off.top + h)) {\n                if (elementDropped) {\n                    _this.renderer.onMouseMove(touch, true);\n                } else {\n                    elementDropped = true;\n                    var div = document.createElement('div');\n                    div.appendChild(this.cloneNode(true));\n                    _this.renderer.dropData({\"text/html\": div.innerHTML}, touch);\n                    _this.renderer.onMouseDown(touch, true);\n                }\n            }\n        }).on(\"touchend\", \".Rk-Bin-Item\", function(e) {\n            if (elementDropped) {\n                _this.renderer.onMouseUp(e.originalEvent.changedTouches[0], true);\n            }\n            elementDropped = false;\n        }).on(\"dragstart\", \".Rk-Bin-Item\", function(e) {\n            var div = document.createElement('div');\n            div.appendChild(this.cloneNode(true));\n            try {\n                e.originalEvent.dataTransfer.setData(\"text/html\",div.innerHTML);\n            }\n            catch(err) {\n                e.originalEvent.dataTransfer.setData(\"text\",div.innerHTML);\n            }\n        });\n\n    }\n\n    Rkns.$(window).resize(function() {\n        _this.resizeBins();\n    });\n\n    var lastsearch = false, lastval = '';\n\n    this.$.find(\".Rk-Bins-Search-Input\").on(\"change keyup paste input\", function() {\n        var val = Rkns.$(this).val();\n        if (val === lastval) {\n            return;\n        }\n        var search = Rkns.Utils.regexpFromTextOrArray(val.length > 1 ? val: null);\n        if (search.source === lastsearch) {\n            return;\n        }\n        lastsearch = search.source;\n        _(_this.tabs).each(function(tab) {\n            tab.render(search);\n        });\n\n    });\n    this.$.find(\".Rk-Bins-Search-Form\").submit(function() {\n        return false;\n    });\n\n};\n\nRenkan.prototype.translate = function(_text) {\n    if (Rkns.i18n[this.options.language] && Rkns.i18n[this.options.language][_text]) {\n        return Rkns.i18n[this.options.language][_text];\n    }\n    if (this.options.language.length > 2 && Rkns.i18n[this.options.language.substr(0,2)] && Rkns.i18n[this.options.language.substr(0,2)][_text]) {\n        return Rkns.i18n[this.options.language.substr(0,2)][_text];\n    }\n    return _text;\n};\n\nRenkan.prototype.onStatusChange = function() {\n    this.renderer.onStatusChange();\n};\n\nRenkan.prototype.setSearchEngine = function(_key) {\n    this.search_engine = this.search_engines[_key];\n    this.$.find(\".Rk-Search-Current\").attr(\"class\",\"Rk-Search-Current \" + this.search_engine.getBgClass());\n    var listClasses = this.search_engine.getBgClass().split(\" \");\n    var classes = \"\";\n    for\t(var i= 0; i < listClasses.length; i++) {\n        classes += \".\" + listClasses[i];\n    }\n    this.$.find(\".Rk-Web-Search-Input.Rk-Search-Input\").attr(\"placeholder\", this.translate(\"Search in \") + this.$.find(\".Rk-Search-List \"+ classes).html());\n};\n\nRenkan.prototype.resizeBins = function() {\n    var _d = + this.$.find(\".Rk-Bins-Head\").outerHeight();\n    this.$.find(\".Rk-Bin-Title:visible\").each(function() {\n        _d += Rkns.$(this).outerHeight();\n    });\n    this.$.find(\".Rk-Bin-Main\").css({\n        height: this.$.find(\".Rk-Bins\").height() - _d\n    });\n};\n\n/* Utility functions */\nvar getUUID4 = function() {\n    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n        var r = Math.random()*16|0, v = c === 'x' ? r : (r&0x3|0x8);\n        return v.toString(16);\n    });\n};\n\nRkns.Utils = {\n    getUUID4 : getUUID4,\n    getUID : (function() {\n        function pad(n){\n            return n<10 ? '0'+n : n;\n        }\n        var _d = new Date(),\n            ID_AUTO_INCREMENT = 0,\n            ID_BASE = _d.getUTCFullYear() + '-' +\n              pad(_d.getUTCMonth()+1) + '-' +\n              pad(_d.getUTCDate()) + '-' +\n              getUUID4();\n        return function(_base) {\n            var _n = (++ID_AUTO_INCREMENT).toString(16),\n                _uidbase = (typeof _base === \"undefined\" ? \"\" : _base + \"-\" );\n            while (_n.length < 4) { _n = '0' + _n; }\n            return _uidbase + ID_BASE + '-' + _n;\n        };\n    })(),\n    getFullURL : function(url) {\n\n        if(typeof(url) === 'undefined' || url == null ) {\n            return \"\";\n        }\n        if(/https?:\\/\\//.test(url)) {\n            return url;\n        }\n        var img = new Image();\n        img.src = url;\n        var res = img.src;\n        img.src = null;\n        return res;\n\n    },\n    inherit : function(_baseClass, _callbefore) {\n\n        var _class = function(_arg) {\n            if (typeof _callbefore === \"function\") {\n                _callbefore.apply(this, Array.prototype.slice.call(arguments, 0));\n            }\n            _baseClass.apply(this, Array.prototype.slice.call(arguments, 0));\n            if (typeof this._init === \"function\" && !this._initialized) {\n                this._init.apply(this, Array.prototype.slice.call(arguments, 0));\n                this._initialized = true;\n            }\n        };\n        _(_class.prototype).extend(_baseClass.prototype);\n\n        return _class;\n\n    },\n    regexpFromTextOrArray: (function() {\n        var charsub = [\n                '[aáàâä]',\n                '[cç]',\n                '[eéèêë]',\n                '[iíìîï]',\n                '[oóòôö]',\n                '[uùûü]'\n            ],\n            removeChars = [\n                String.fromCharCode(768), String.fromCharCode(769), String.fromCharCode(770), String.fromCharCode(771), String.fromCharCode(807),\n                \"{\", \"}\", \"(\", \")\", \"[\", \"]\", \"【\", \"】\", \"、\", \"・\", \"‥\", \"。\", \"「\", \"」\", \"『\", \"』\", \"〜\", \":\", \"!\", \"?\", \" \",\n                \",\", \" \", \";\", \"(\", \")\", \".\", \"*\", \"+\", \"\\\\\", \"?\", \"|\", \"{\", \"}\", \"[\", \"]\", \"^\", \"#\", \"/\"\n            ],\n            remsrc = \"[\\\\\" + removeChars.join(\"\\\\\") + \"]\",\n            remrx = new RegExp(remsrc, \"gm\"),\n            charsrx = _(charsub).map(function(c) {\n                return new RegExp(c);\n            });\n\n        function replaceText(_text) {\n            var txt = _text.toLowerCase().replace(remrx,\"\"), src = \"\";\n            function makeReplaceFunc(l) {\n              return function(k,v) {\n                l = l.replace(charsrx[k], v);\n              };\n            }\n            for (var j = 0; j < txt.length; j++) {\n                if (j) {\n                    src += remsrc + \"*\";\n                }\n                var l = txt[j];\n                _(charsub).each(makeReplaceFunc(l));\n                src += l;\n            }\n            return src;\n        }\n\n        function getSource(inp) {\n            switch (typeof inp) {\n                case \"string\":\n                    return replaceText(inp);\n                case \"object\":\n                    var src = '';\n                    _(inp).each(function(v) {\n                        var res = getSource(v);\n                        if (res) {\n                            if (src) {\n                                src += '|';\n                            }\n                            src += res;\n                        }\n                    });\n                    return src;\n            }\n            return '';\n        }\n\n        return function(_textOrArray) {\n            var source = getSource(_textOrArray);\n            if (source) {\n                var testrx = new RegExp( source, \"im\"),\n                    replacerx = new RegExp( '(' + source + ')', \"igm\");\n                return {\n                    isempty: false,\n                    source: source,\n                    test: function(_t) { return testrx.test(_t); },\n                    replace: function(_text, _replace) { return _text.replace(replacerx, _replace); }\n                };\n            } else {\n                return {\n                    isempty: true,\n                    source: '',\n                    test: function() { return true; },\n                    replace: function(_text) { return text; }\n                };\n            }\n        };\n    })(),\n    /* The minimum distance (in pixels) the mouse has to move to consider an element was dragged */\n    _MIN_DRAG_DISTANCE: 2,\n    /* Distance between the inner and outer radius of buttons that appear when hovering on a node */\n    _NODE_BUTTON_WIDTH: 40,\n\n    _EDGE_BUTTON_INNER: 2,\n    _EDGE_BUTTON_OUTER: 40,\n    /* Constants used to know if a specific action is to be performed when clicking on the canvas */\n    _CLICKMODE_ADDNODE: 1,\n    _CLICKMODE_STARTEDGE: 2,\n    _CLICKMODE_ENDEDGE: 3,\n    /* Node size step: Used to calculate the size change when clicking the +/- buttons */\n    _NODE_SIZE_STEP: Math.LN2/4,\n    _MIN_SCALE: 1/20,\n    _MAX_SCALE: 20,\n    _MOUSEMOVE_RATE: 80,\n    _DOUBLETAP_DELAY: 800,\n    /* Maximum distance in pixels (squared, to reduce calculations)\n     * between two taps when double-tapping on a touch terminal */\n    _DOUBLETAP_DISTANCE: 20*20,\n    /* A placeholder so a default colour is displayed when a node has a null value for its user property */\n    _USER_PLACEHOLDER: function(_renkan) {\n        return {\n            color: _renkan.options.default_user_color,\n            title: _renkan.translate(\"(unknown user)\"),\n            get: function(attr) {\n                return this[attr] || false;\n            }\n        };\n    },\n    /* The code for the \"Drag and Add Bookmarklet\", slightly minified and with whitespaces removed, though\n     * it doesn't seem that it's still a requirement in newer browsers (i.e. the ones compatibles with canvas drawing)\n     */\n    _BOOKMARKLET_CODE: function(_renkan) {\n        return \"(function(a,b,c,d,e,f,h,i,j,k,l,m,n,o,p,q,r){a=document;b=a.body;c=a.location.href;j='draggable';m='text/x-iri-';d=a.createElement('div');d.innerHTML='<p_style=\\\"position:fixed;top:0;right:0;font:bold_18px_sans-serif;color:#fff;background:#909;padding:10px;z-index:100000;\\\">\" +\n        _renkan.translate(\"Drag items from this website, drop them in Renkan\").replace(/ /g,\"_\") +\n        \"</p>'.replace(/_/g,String.fromCharCode(32));b.appendChild(d);e=[{r:/https?:\\\\/\\\\/[^\\\\/]*twitter\\\\.com\\\\//,s:'.tweet',n:'twitter'},{r:/https?:\\\\/\\\\/[^\\\\/]*google\\\\.[^\\\\/]+\\\\//,s:'.g',n:'google'},{r:/https?:\\\\/\\\\/[^\\\\/]*lemonde\\\\.fr\\\\//,s:'[data-vr-contentbox]',n:'lemonde'}];f=false;e.forEach(function(g){if(g.r.test(c)){f=g;}});if(f){h=function(){Array.prototype.forEach.call(a.querySelectorAll(f.s),function(i){i[j]=true;k=i.style;k.borderWidth='2px';k.borderColor='#909';k.borderStyle='solid';k.backgroundColor='rgba(200,0,180,.1)';})};window.setInterval(h,500);h();};a.addEventListener('dragstart',function(k){l=k.dataTransfer;l.setData(m+'source-uri',c);l.setData(m+'source-title',a.title);n=k.target;if(f){o=n;while(!o.attributes[j]){o=o.parentNode;if(o==b){break;}}}if(f&&o.attributes[j]){p=o.cloneNode(true);l.setData(m+'specific-site',f.n)}else{q=a.getSelection();if(q.type==='Range'||!q.type){p=q.getRangeAt(0).cloneContents();}else{p=n.cloneNode();}}r=a.createElement('div');r.appendChild(p);l.setData('text/x-iri-selected-text',r.textContent.trim());l.setData('text/x-iri-selected-html',r.innerHTML);},false);})();\";\n    },\n    /* Shortens text to the required length then adds ellipsis */\n    shortenText: function(_text, _maxlength) {\n        return (_text.length > _maxlength ? (_text.substr(0,_maxlength) + '…') : _text);\n    },\n    /* Drawing an edit box with an arrow and positioning the edit box according to the position of the node/edge being edited\n     * Called by Rkns.Renderer.NodeEditor and Rkns.Renderer.EdgeEditor */\n    drawEditBox: function(_options, _coords, _path, _xmargin, _selector) {\n        _selector.css({\n            width: ( _options.tooltip_width - 2* _options.tooltip_padding )\n        });\n        var _height = _selector.outerHeight() + 2* _options.tooltip_padding,\n        _isLeft = (_coords.x < paper.view.center.x ? 1 : -1),\n        _left = _coords.x + _isLeft * ( _xmargin + _options.tooltip_arrow_length ),\n        _right = _coords.x + _isLeft * ( _xmargin + _options.tooltip_arrow_length + _options.tooltip_width ),\n        _top = _coords.y - _height / 2;\n        if (_top + _height > (paper.view.size.height - _options.tooltip_margin)) {\n            _top = Math.max( paper.view.size.height - _options.tooltip_margin, _coords.y + _options.tooltip_arrow_width / 2 ) - _height;\n        }\n        if (_top < _options.tooltip_margin) {\n            _top = Math.min( _options.tooltip_margin, _coords.y - _options.tooltip_arrow_width / 2 );\n        }\n        var _bottom = _top + _height;\n        /* jshint laxbreak:true */\n        _path.segments[0].point\n          = _path.segments[7].point\n          = _coords.add([_isLeft * _xmargin, 0]);\n        _path.segments[1].point.x\n          = _path.segments[2].point.x\n          = _path.segments[5].point.x\n          = _path.segments[6].point.x\n          = _left;\n        _path.segments[3].point.x\n          = _path.segments[4].point.x\n          = _right;\n        _path.segments[2].point.y\n          = _path.segments[3].point.y\n          = _top;\n        _path.segments[4].point.y\n          = _path.segments[5].point.y\n          = _bottom;\n        _path.segments[1].point.y = _coords.y - _options.tooltip_arrow_width / 2;\n        _path.segments[6].point.y = _coords.y + _options.tooltip_arrow_width / 2;\n        _path.closed = true;\n        _path.fillColor = new paper.GradientColor(new paper.Gradient([_options.tooltip_top_color, _options.tooltip_bottom_color]), [0,_top], [0, _bottom]);\n        _selector.css({\n            left: (_options.tooltip_padding + Math.min(_left, _right)),\n            top: (_options.tooltip_padding + _top)\n        });\n        return _path;\n    }\n};\n})(window);\n\n/* END main.js */\n","(function() {\n    \"use strict\";\n    var root = this;\n\n    var Backbone = root.Backbone;\n\n    var Models = root.Rkns.Models = {};\n\n    Models.getUID = function(obj) {\n        var guid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,\n                function(c) {\n                    var r = Math.random() * 16 | 0, v = c === 'x' ? r\n                            : (r & 0x3 | 0x8);\n                    return v.toString(16);\n                });\n        if (typeof obj !== 'undefined') {\n            return obj.type + \"-\" + guid;\n        }\n        else {\n            return guid;\n        }\n    };\n\n    var RenkanModel = Backbone.RelationalModel.extend({\n        idAttribute : \"_id\",\n        constructor : function(options) {\n\n            if (typeof options !== \"undefined\") {\n                options._id = options._id || options.id || Models.getUID(this);\n                options.title = options.title || \"\";\n                options.description = options.description || \"\";\n                options.uri = options.uri || \"\";\n\n                if (typeof this.prepare === \"function\") {\n                    options = this.prepare(options);\n                }\n            }\n            Backbone.RelationalModel.prototype.constructor.call(this, options);\n        },\n        validate : function() {\n            if (!this.type) {\n                return \"object has no type\";\n            }\n        },\n        addReference : function(_options, _propName, _list, _id, _default) {\n            var _element = _list.get(_id);\n            if (typeof _element === \"undefined\" &&\n                typeof _default !== \"undefined\") {\n                _options[_propName] = _default;\n            }\n            else {\n                _options[_propName] = _element;\n            }\n        }\n    });\n\n    // USER\n    var User = Models.User = RenkanModel.extend({\n        type : \"user\",\n        prepare : function(options) {\n            options.color = options.color || \"#666666\";\n            return options;\n        },\n        toJSON : function() {\n            return {\n                _id : this.get(\"_id\"),\n                title : this.get(\"title\"),\n                uri : this.get(\"uri\"),\n                description : this.get(\"description\"),\n                color : this.get(\"color\")\n            };\n        }\n    });\n\n    // NODE\n    var Node = Models.Node = RenkanModel.extend({\n        type : \"node\",\n        relations : [ {\n            type : Backbone.HasOne,\n            key : \"created_by\",\n            relatedModel : User\n        } ],\n        prepare : function(options) {\n            var project = options.project;\n            this.addReference(options, \"created_by\", project.get(\"users\"),\n                    options.created_by, project.current_user);\n            options.description = options.description || \"\";\n            return options;\n        },\n        toJSON : function() {\n            return {\n                _id : this.get(\"_id\"),\n                title : this.get(\"title\"),\n                uri : this.get(\"uri\"),\n                description : this.get(\"description\"),\n                position : this.get(\"position\"),\n                image : this.get(\"image\"),\n                color : this.get(\"color\"),\n                created_by : this.get(\"created_by\") ? this.get(\"created_by\")\n                        .get(\"_id\") : null,\n                size : this.get(\"size\"),\n                clip_path : this.get(\"clip_path\"),\n                shape : this.get(\"shape\")\n            };\n        }\n    });\n\n    // EDGE\n    var Edge = Models.Edge = RenkanModel.extend({\n        type : \"edge\",\n        relations : [ {\n            type : Backbone.HasOne,\n            key : \"created_by\",\n            relatedModel : User\n        }, {\n            type : Backbone.HasOne,\n            key : \"from\",\n            relatedModel : Node\n        }, {\n            type : Backbone.HasOne,\n            key : \"to\",\n            relatedModel : Node\n        } ],\n        prepare : function(options) {\n            var project = options.project;\n            this.addReference(options, \"created_by\", project.get(\"users\"),\n                    options.created_by, project.current_user);\n            this.addReference(options, \"from\", project.get(\"nodes\"),\n                    options.from);\n            this.addReference(options, \"to\", project.get(\"nodes\"), options.to);\n            return options;\n        },\n        toJSON : function() {\n            return {\n                _id : this.get(\"_id\"),\n                title : this.get(\"title\"),\n                uri : this.get(\"uri\"),\n                description : this.get(\"description\"),\n                from : this.get(\"from\") ? this.get(\"from\").get(\"_id\") : null,\n                to : this.get(\"to\") ? this.get(\"to\").get(\"_id\") : null,\n                color : this.get(\"color\"),\n                created_by : this.get(\"created_by\") ? this.get(\"created_by\")\n                        .get(\"_id\") : null\n            };\n        }\n    });\n\n    // View\n    var View = Models.View = RenkanModel.extend({\n        type : \"view\",\n        relations : [ {\n            type : Backbone.HasOne,\n            key : \"created_by\",\n            relatedModel : User\n        } ],\n        prepare : function(options) {\n            var project = options.project;\n            this.addReference(options, \"created_by\", project.get(\"users\"),\n                    options.created_by, project.current_user);\n            options.description = options.description || \"\";\n            if (typeof options.offset !== \"undefined\") {\n                var offset = {};\n                if (Array.isArray(options.offset)) {\n                    offset.x = options.offset[0];\n                    offset.y = options.offset.length > 1 ? options.offset[1]\n                            : options.offset[0];\n                }\n                else if (options.offset.x != null) {\n                    offset.x = options.offset.x;\n                    offset.y = options.offset.y;\n                }\n                options.offset = offset;\n            }\n            return options;\n        },\n        toJSON : function() {\n            return {\n                _id : this.get(\"_id\"),\n                zoom_level : this.get(\"zoom_level\"),\n                offset : this.get(\"offset\"),\n                title : this.get(\"title\"),\n                description : this.get(\"description\"),\n                created_by : this.get(\"created_by\") ? this.get(\"created_by\")\n                        .get(\"_id\") : null\n            // Don't need project id\n            };\n        }\n    });\n\n    // PROJECT\n    var Project = Models.Project = RenkanModel.extend({\n        type : \"project\",\n        blacklist : [ 'save_status', ],\n        relations : [ {\n            type : Backbone.HasMany,\n            key : \"users\",\n            relatedModel : User,\n            reverseRelation : {\n                key : 'project',\n                includeInJSON : '_id'\n            }\n        }, {\n            type : Backbone.HasMany,\n            key : \"nodes\",\n            relatedModel : Node,\n            reverseRelation : {\n                key : 'project',\n                includeInJSON : '_id'\n            }\n        }, {\n            type : Backbone.HasMany,\n            key : \"edges\",\n            relatedModel : Edge,\n            reverseRelation : {\n                key : 'project',\n                includeInJSON : '_id'\n            }\n        }, {\n            type : Backbone.HasMany,\n            key : \"views\",\n            relatedModel : View,\n            reverseRelation : {\n                key : 'project',\n                includeInJSON : '_id'\n            }\n        } ],\n        addUser : function(_props, _options) {\n            _props.project = this;\n            var _user = User.findOrCreate(_props);\n            this.get(\"users\").push(_user, _options);\n            return _user;\n        },\n        addNode : function(_props, _options) {\n            _props.project = this;\n            var _node = Node.findOrCreate(_props);\n            this.get(\"nodes\").push(_node, _options);\n            return _node;\n        },\n        addEdge : function(_props, _options) {\n            _props.project = this;\n            var _edge = Edge.findOrCreate(_props);\n            this.get(\"edges\").push(_edge, _options);\n            return _edge;\n        },\n        addView : function(_props, _options) {\n            _props.project = this;\n            // TODO: check if need to replace with create only\n            var _view = View.findOrCreate(_props);\n            // TODO: Should we remember only one view?\n            this.get(\"views\").push(_view, _options);\n            return _view;\n        },\n        removeNode : function(_model) {\n            this.get(\"nodes\").remove(_model);\n        },\n        removeEdge : function(_model) {\n            this.get(\"edges\").remove(_model);\n        },\n        validate : function(options) {\n            var _project = this;\n            _(\n                    [].concat(options.users, options.nodes, options.edges,\n                            options.views)).each(function(_item) {\n                if (_item) {\n                    _item.project = _project;\n                }\n            });\n        },\n        // Add event handler to remove edges when a node is removed\n        initialize : function() {\n            var _this = this;\n            this.on(\"remove:nodes\", function(_node) {\n                _this.get(\"edges\").remove(\n                        _this.get(\"edges\").filter(\n                                function(_edge) {\n                                    return _edge.get(\"from\") === _node ||\n                                           _edge.get(\"to\") === _node;\n                                }));\n            });\n        },\n        toJSON : function() {\n            var json = _.clone(this.attributes);\n            for ( var attr in json) {\n                if ((json[attr] instanceof Backbone.Model) ||\n                        (json[attr] instanceof Backbone.Collection) ||\n                        (json[attr] instanceof RenkanModel)) {\n                    json[attr] = json[attr].toJSON();\n                }\n            }\n            return _.omit(json, this.blacklist);\n        }\n    });\n\n    var RosterUser = Models.RosterUser = Backbone.Model\n            .extend({\n                type : \"roster_user\",\n                idAttribute : \"_id\",\n\n                constructor : function(options) {\n\n                    if (typeof options !== \"undefined\") {\n                        options._id = options._id ||\n                            options.id ||\n                            Models.getUID(this);\n                        options.title = options.title || \"(untitled \" + this.type + \")\";\n                        options.description = options.description || \"\";\n                        options.uri = options.uri || \"\";\n                        options.project = options.project || null;\n                        options.site_id = options.site_id || 0;\n\n                        if (typeof this.prepare === \"function\") {\n                            options = this.prepare(options);\n                        }\n                    }\n                    Backbone.Model.prototype.constructor.call(this, options);\n                },\n\n                validate : function() {\n                    if (!this.type) {\n                        return \"object has no type\";\n                    }\n                },\n\n                prepare : function(options) {\n                    options.color = options.color || \"#666666\";\n                    return options;\n                },\n\n                toJSON : function() {\n                    return {\n                        _id : this.get(\"_id\"),\n                        title : this.get(\"title\"),\n                        uri : this.get(\"uri\"),\n                        description : this.get(\"description\"),\n                        color : this.get(\"color\"),\n                        project : (this.get(\"project\") != null) ? this.get(\n                                \"project\").get(\"id\") : null,\n                        site_id : this.get(\"site_id\")\n                    };\n                }\n            });\n\n    var UsersList = Models.UsersList = Backbone.Collection.extend({\n        model : RosterUser\n    });\n\n}).call(window);\n","Rkns.defaults = {\n\n    language: (navigator.language || navigator.userLanguage || \"en\"),\n        /* GUI Language */\n    container: \"renkan\",\n        /* GUI Container DOM element ID */\n    search: [],\n        /* List of Search Engines */\n    bins: [],\n           /* List of Bins */\n    static_url: \"\",\n        /* URL for static resources */\n    show_bins: true,\n        /* Show bins in left column */\n    properties: [],\n        /* Semantic properties for edges */\n    show_editor: true,\n        /* Show the graph editor... Setting this to \"false\" only shows the bins part ! */\n    read_only: false,\n        /* Allows editing of renkan without changing the rest of the GUI. Can be switched on/off on the fly to block/enable editing */\n    editor_mode: true,\n        /* Switch for Publish/Edit GUI. If editor_mode is false, read_only will be true.  */\n    manual_save: false,\n        /* In snapshot mode, clicking on the floppy will save a snapshot. Otherwise, it will show the connection status */\n    show_top_bar: true,\n        /* Show the top bar, (title, buttons, users) */\n    default_user_color: \"#303030\",\n    size_bug_fix: true,\n        /* Resize the canvas after load (fixes a bug on iPad and FF Mac) */\n    force_resize: false,\n    allow_double_click: true,\n        /* Allows Double Click to create a node on an empty background */\n    zoom_on_scroll: true,\n        /* Allows to use the scrollwheel to zoom */\n    element_delete_delay: 0,\n        /* Delay between clicking on the bin on an element and really deleting it\n           Set to 0 for delete confirm */\n    autoscale_padding: 50,\n    resize: true,\n    \n    /* zoom options */\n    show_zoom: true,\n        /* show zoom buttons */\n    save_view: true,\n        /* show buttons to save view */\n    default_view: false,\n        /* Allows to load default view (zoom+offset) at start on read_only mode, instead of autoScale. the default_view will be the last */\n    \n    \n    /* TOP BAR BUTTONS */\n    show_search_field: true,\n    show_user_list: true,\n    user_name_editable: true,\n    user_color_editable: true,\n    show_user_color: true,\n    show_save_button: true,\n    show_export_button: true,\n    show_open_button: false,\n    show_addnode_button: true,\n    show_addedge_button: true,\n    show_bookmarklet: true,\n    show_fullscreen_button: true,\n    home_button_url: false,\n    home_button_title: \"Home\",\n\n    /* MINI-MAP OPTIONS */\n\n    show_minimap: true,\n        /* Show a small map at the bottom right */\n    minimap_width: 160,\n    minimap_height: 120,\n    minimap_padding: 20,\n    minimap_background_color: \"#ffffff\",\n    minimap_border_color: \"#cccccc\",\n    minimap_highlight_color: \"#ffff00\",\n    minimap_highlight_weight: 5,\n    \n\n    /* EDGE/NODE COMMON OPTIONS */\n\n    buttons_background: \"#202020\",\n    buttons_label_color: \"#c000c0\",\n    buttons_label_font_size: 9,\n\n    /* NODE DISPLAY OPTIONS */\n\n    show_node_circles: true,\n        /* Show circles for nodes */\n    clip_node_images: true,\n        /* Constraint node images to circles */\n    node_images_fill_mode: false,\n        /* Set to false for \"letterboxing\" (height/width of node adapted to show full image)\n           Set to true for \"crop\" (adapted to fill circle) */\n    node_size_base: 25,\n    node_stroke_width: 2,\n    selected_node_stroke_width: 4,\n    node_fill_color: \"#ffffff\",\n    highlighted_node_fill_color: \"#ffff00\",\n    node_label_distance: 5,\n        /* Vertical distance between node and label */\n    node_label_max_length: 60,\n        /* Maximum displayed text length */\n    label_untitled_nodes: \"(untitled)\",\n        /* Label to display on untitled nodes */\n    change_shapes: true,\n        /* Change shapes enabled */\n\n    /* EDGE DISPLAY OPTIONS */\n\n    edge_stroke_width: 2,\n    selected_edge_stroke_width: 4,\n    edge_label_distance: 0,\n    edge_label_max_length: 20,\n    edge_arrow_length: 18,\n    edge_arrow_width: 12,\n    edge_gap_in_bundles: 12,\n    label_untitled_edges: \"\",\n\n    /* CONTEXTUAL DISPLAY (TOOLTIP OR EDITOR) OPTIONS */\n\n    tooltip_width: 275,\n    tooltip_padding: 10,\n    tooltip_margin: 15,\n    tooltip_arrow_length : 20,\n    tooltip_arrow_width : 40,\n    tooltip_top_color: \"#f0f0f0\",\n    tooltip_bottom_color: \"#d0d0d0\",\n    tooltip_border_color: \"#808080\",\n    tooltip_border_width: 1,\n\n    /* NODE EDITOR OPTIONS */\n\n    show_node_editor_uri: true,\n    show_node_editor_description: true,\n    show_node_editor_size: true,\n    show_node_editor_color: true,\n    show_node_editor_image: true,\n    show_node_editor_creator: true,\n    allow_image_upload: true,\n    uploaded_image_max_kb: 500,\n\n    /* NODE TOOLTIP OPTIONS */\n\n    show_node_tooltip_uri: true,\n    show_node_tooltip_description: true,\n    show_node_tooltip_color: true,\n    show_node_tooltip_image: true,\n    show_node_tooltip_creator: true,\n\n    /* EDGE EDITOR OPTIONS */\n\n    show_edge_editor_uri: true,\n    show_edge_editor_color: true,\n    show_edge_editor_direction: true,\n    show_edge_editor_nodes: true,\n    show_edge_editor_creator: true,\n\n    /* EDGE TOOLTIP OPTIONS */\n\n    show_edge_tooltip_uri: true,\n    show_edge_tooltip_color: true,\n    show_edge_tooltip_nodes: true,\n    show_edge_tooltip_creator: true\n\n    /* */\n\n};\n","Rkns.i18n = {\n    fr: {\n        \"Edit Node\": \"Édition d’un nœud\",\n        \"Edit Edge\": \"Édition d’un lien\",\n        \"Title:\": \"Titre :\",\n        \"URI:\": \"URI :\",\n        \"Description:\": \"Description :\",\n        \"From:\": \"De :\",\n        \"To:\": \"Vers :\",\n        \"Image\": \"Image\",\n        \"Image URL:\": \"URL d'Image\",\n        \"Choose Image File:\": \"Choisir un fichier image\",\n        \"Full Screen\": \"Mode plein écran\",\n        \"Add Node\": \"Ajouter un nœud\",\n        \"Add Edge\": \"Ajouter un lien\",\n        \"Save Project\": \"Enregistrer le projet\",\n        \"Open Project\": \"Ouvrir un projet\",\n        \"Auto-save enabled\": \"Enregistrement automatique activé\",\n        \"Connection lost\": \"Connexion perdue\",\n        \"Created by:\": \"Créé par :\",\n        \"Zoom In\": \"Agrandir l’échelle\",\n        \"Zoom Out\": \"Rapetisser l’échelle\",\n        \"Edit\": \"Éditer\",\n        \"Remove\": \"Supprimer\",\n        \"Cancel deletion\": \"Annuler la suppression\",\n        \"Link to another node\": \"Créer un lien\",\n        \"Enlarge\": \"Agrandir\",\n        \"Shrink\": \"Rétrécir\",\n        \"Click on the background canvas to add a node\": \"Cliquer sur le fond du graphe pour rajouter un nœud\",\n        \"Click on a first node to start the edge\": \"Cliquer sur un premier nœud pour commencer le lien\",\n        \"Click on a second node to complete the edge\": \"Cliquer sur un second nœud pour terminer le lien\",\n        \"Wikipedia\": \"Wikipédia\",\n        \"Wikipedia in \": \"Wikipédia en \",\n        \"French\": \"Français\",\n        \"English\": \"Anglais\",\n        \"Japanese\": \"Japonais\",\n        \"Untitled project\": \"Projet sans titre\",\n        \"Lignes de Temps\": \"Lignes de Temps\",\n        \"Loading, please wait\": \"Chargement en cours, merci de patienter\",\n        \"Edge color:\": \"Couleur :\",\n        \"Node color:\": \"Couleur :\",\n        \"Choose color\": \"Choisir une couleur\",\n        \"Change edge direction\": \"Changer le sens du lien\",\n        \"Do you really wish to remove node \": \"Voulez-vous réellement supprimer le nœud \",\n        \"Do you really wish to remove edge \": \"Voulez-vous réellement supprimer le lien \",\n        \"This file is not an image\": \"Ce fichier n'est pas une image\",\n        \"Image size must be under \": \"L'image doit peser moins de \",\n        \"Size:\": \"Taille :\",\n        \"KB\": \"ko\",\n        \"Choose from vocabulary:\": \"Choisir dans un vocabulaire :\",\n        \"SKOS Documentation properties\": \"SKOS: Propriétés documentaires\",\n        \"has note\": \"a pour note\",\n        \"has example\": \"a pour exemple\",\n        \"has definition\": \"a pour définition\",\n        \"SKOS Semantic relations\": \"SKOS: Relations sémantiques\",\n        \"has broader\": \"a pour concept plus large\",\n        \"has narrower\": \"a pour concept plus étroit\",\n        \"has related\": \"a pour concept apparenté\",\n        \"Dublin Core Metadata\": \"Métadonnées Dublin Core\",\n        \"has contributor\": \"a pour contributeur\",\n        \"covers\": \"couvre\",\n        \"created by\": \"créé par\",\n        \"has date\": \"a pour date\",\n        \"published by\": \"édité par\",\n        \"has source\": \"a pour source\",\n        \"has subject\": \"a pour sujet\",\n        \"Dragged resource\": \"Ressource glisée-déposée\",\n        \"Search the Web\": \"Rechercher en ligne\",\n        \"Search in Bins\": \"Rechercher dans les chutiers\",\n        \"Close bin\": \"Fermer le chutier\",\n        \"Refresh bin\": \"Rafraîchir le chutier\",\n        \"(untitled)\": \"(sans titre)\",\n        \"Select contents:\": \"Sélectionner des contenus :\",\n        \"Drag items from this website, drop them in Renkan\": \"Glissez des éléments de ce site web vers Renkan\",\n        \"Drag this button to your bookmark bar. When on a third-party website, click it to enable drag-and-drop from the website to Renkan.\": \"Glissez ce bouton vers votre barre de favoris. Ensuite, depuis un site tiers, cliquez dessus pour activer 'Drag-to-Add' puis glissez des éléments de ce site vers Renkan\",\n        \"Shapes available\": \"Formes disponibles\",\n        \"Circle\": \"Cercle\",\n        \"Square\": \"Carré\",\n        \"Diamond\": \"Losange\",\n        \"Hexagone\": \"Hexagone\",\n        \"Ellipse\": \"Ellipse\",\n        \"Star\": \"Étoile\",\n        \"Zoom Fit\": \"Ajuster le Zoom\",\n        \"Download Project\": \"Télécharger le projet\",\n        \"Zoom Save\": \"Sauver le Zoom\",\n        \"View saved zoom\": \"Restaurer le Zoom\",\n        \"Renkan \\'Drag-to-Add\\' bookmarklet\": \"Renkan \\'Deplacer-Pour-Ajouter\\' Signet\",\n        \"(unknown user)\":\"(non authentifié)\",\n        \"<unknown user>\":\"<non authentifié>\",\n        \"Search in graph\":\"Rechercher dans carte\",\n        \"Search in \" : \"Chercher dans \"\n    }\n};\n","/* Saves the Full JSON at each modification */\n\nRkns.jsonIO = function(_renkan, _opts) {\n    var _proj = _renkan.project;\n    if (typeof _opts.http_method === \"undefined\") {\n        _opts.http_method = 'PUT';\n    }\n    var _load = function() {\n        _renkan.renderer.redrawActive = false;\n        _proj.set({\n            loading_status : true\n        });\n        Rkns.$.getJSON(_opts.url, function(_data) {\n            _proj.set(_data, {\n                validate : true\n            });\n            _proj.set({\n                loading_status : false\n            });\n            _proj.set({\n                save_status : 0\n            });\n            _renkan.renderer.redrawActive = true;\n            _renkan.renderer.fixSize();\n        });\n    };\n    var _save = function() {\n        _proj.set({\n            save_status : 2\n        });\n        var _data = _proj.toJSON();\n        if (!_renkan.read_only) {\n            Rkns.$.ajax({\n                type : _opts.http_method,\n                url : _opts.url,\n                contentType : \"application/json\",\n                data : JSON.stringify(_data),\n                success : function(data, textStatus, jqXHR) {\n                    _proj.set({\n                        save_status : 0\n                    });\n                }\n            });\n        }\n\n    };\n    var _thrSave = Rkns._.throttle(function() {\n        setTimeout(_save, 100);\n    }, 1000);\n    _proj.on(\"add:nodes add:edges add:users add:views\", function(_model) {\n        _model.on(\"change remove\", function(_model) {\n            _thrSave();\n        });\n        _thrSave();\n    });\n    _proj.on(\"change\", function() {\n        if (!(_proj.changedAttributes.length === 1 && _proj\n                .hasChanged('save_status'))) {\n            _thrSave();\n        }\n    });\n\n    _load();\n};\n","/* Saves the Full JSON once */\n\nRkns.jsonIOSaveOnClick = function(_renkan, _opts) {\n    var _proj = _renkan.project,\n        _saveWarn = false,\n        _onLeave = function() {\n            return \"Project not saved\";\n        };\n    if (typeof _opts.http_method === \"undefined\") {\n        _opts.http_method = 'POST';\n    }\n    var _load = function() {\n        var getdata = {},\n            rx = /id=([^&#?=]+)/,\n            matches = document.location.hash.match(rx);\n        if (matches) {\n            getdata.id = matches[1];\n        }\n        Rkns.$.ajax({\n            url: _opts.url,\n            data: getdata,\n            beforeSend: function(){\n            \t_proj.set({loading_status:true});\n            },\n            success: function(_data) {\n                _proj.set(_data, {validate: true});\n            \t_proj.set({loading_status:false});\n                _proj.set({save_status:0});\n            \t_renkan.renderer.autoScale();\n            }\n        });\n    };\n    var _save = function() {\n        _proj.set(\"saved_at\", new Date());\n        var _data = _proj.toJSON();\n        Rkns.$.ajax({\n            type: _opts.http_method,\n            url: _opts.url,\n            contentType: \"application/json\",\n            data: JSON.stringify(_data),\n            beforeSend: function(){\n            \t_proj.set({save_status:2});\n            },\n            success: function(data, textStatus, jqXHR) {\n                $(window).off(\"beforeunload\", _onLeave);\n                _saveWarn = false;\n                _proj.set({save_status:0});\n                //document.location.hash = \"#id=\" + data.id;\n                //$(\".Rk-Notifications\").text(\"Saved as \"+document.location.href).fadeIn().delay(2000).fadeOut();\n            }\n        });\n    };\n    var _checkLeave = function() {\n    \t_proj.set({save_status:1});\n    \t\n        var title = _proj.get(\"title\");\n        if (title && _proj.get(\"nodes\").length) {\n            $(\".Rk-Save-Button\").removeClass(\"disabled\");\n        } else {\n            $(\".Rk-Save-Button\").addClass(\"disabled\");\n        }\n        if (title) {\n            $(\".Rk-PadTitle\").css(\"border-color\",\"#333333\");\n        }\n        if (!_saveWarn) {\n            _saveWarn = true;\n            $(window).on(\"beforeunload\", _onLeave);\n        }\n    };\n    _load();\n    _proj.on(\"add:nodes add:edges add:users change\", function(_model) {\n\t    _model.on(\"change remove\", function(_model) {\n\t    \tif(!(_model.changedAttributes.length === 1 && _model.hasChanged('save_status'))) {\n\t    \t\t_checkLeave();\n\t    \t}\n\t    });\n\t\tif(!(_proj.changedAttributes.length === 1 && _proj.hasChanged('save_status'))) {\n\t\t    _checkLeave();\n    \t}\n    });\n    _renkan.renderer.save = function() {\n        if ($(\".Rk-Save-Button\").hasClass(\"disabled\")) {\n            if (!_proj.get(\"title\")) {\n                $(\".Rk-PadTitle\").css(\"border-color\",\"#ff0000\");\n            }\n        } else {\n            _save();\n        }\n    };\n};\n","(function(Rkns) {\n\"use strict\";\n\nvar _ = Rkns._;\n\nvar Ldt = Rkns.Ldt = {};\n\nvar Bin = Ldt.Bin = function(_renkan, _opts) {\n    if (_opts.ldt_type) {\n        var Resclass = Ldt[_opts.ldt_type+\"Bin\"];\n        if (Resclass) {\n            return new Resclass(_renkan, _opts);\n        }\n    }\n    console.error(\"No such LDT Bin Type\");\n};\n\nvar ProjectBin = Ldt.ProjectBin = Rkns.Utils.inherit(Rkns._BaseBin);\n\nProjectBin.prototype.tagTemplate = renkanJST['templates/ldtjson-bin/tagtemplate.html'];\n\nProjectBin.prototype.annotationTemplate = renkanJST['templates/ldtjson-bin/annotationtemplate.html'];\n\nProjectBin.prototype._init = function(_renkan, _opts) {\n    this.renkan = _renkan;\n    this.proj_id = _opts.project_id;\n    this.ldt_platform = _opts.ldt_platform || \"http://ldt.iri.centrepompidou.fr/\";\n    this.title_$.html(_opts.title);\n    this.title_icon_$.addClass('Rk-Ldt-Title-Icon');\n    this.refresh();\n};\n\nProjectBin.prototype.render = function(searchbase) {\n    var search = searchbase || Rkns.Utils.regexpFromTextOrArray();\n    function highlight(_text) {\n        var _e = _(_text).escape();\n        return search.isempty ? _e : search.replace(_e, \"<span class='searchmatch'>$1</span>\");\n    }\n    function convertTC(_ms) {\n        function pad(_n) {\n            var _res = _n.toString();\n            while (_res.length < 2) {\n                _res = '0' + _res;\n            }\n            return _res;\n        }\n        var _totalSeconds = Math.abs(Math.floor(_ms/1000)),\n            _hours = Math.floor(_totalSeconds / 3600),\n            _minutes = (Math.floor(_totalSeconds / 60) % 60),\n            _seconds = _totalSeconds % 60,\n            _res = '';\n        if (_hours) {\n            _res += pad(_hours) + ':';\n        }\n        _res += pad(_minutes) + ':' + pad(_seconds);\n        return _res;\n    }\n\n    var _html = '<li><h3>Tags</h3></li>',\n        _projtitle = this.data.meta[\"dc:title\"],\n        _this = this,\n        count = 0;\n    _this.title_$.text('LDT Project: \"' + _projtitle + '\"');\n    _(_this.data.tags).map(function(_tag) {\n        var _title = _tag.meta[\"dc:title\"];\n        if (!search.isempty && !search.test(_title)) {\n            return;\n        }\n        count++;\n        _html += _this.tagTemplate({\n            ldt_platform: _this.ldt_platform,\n            title: _title,\n            htitle: highlight(_title),\n            encodedtitle : encodeURIComponent(_title),\n            static_url: _this.renkan.options.static_url\n        });\n    });\n    _html += '<li><h3>Annotations</h3></li>';\n    _(_this.data.annotations).map(function(_annotation) {\n        var _description = _annotation.content.description,\n            _title = _annotation.content.title.replace(_description,\"\");\n        if (!search.isempty && !search.test(_title) && !search.test(_description)) {\n            return;\n        }\n        count++;\n        var _duration = _annotation.end - _annotation.begin,\n            _img = (\n                (_annotation.content && _annotation.content.img && _annotation.content.img.src) ?\n                  _annotation.content.img.src :\n                  ( _duration ? _this.renkan.options.static_url+\"img/ldt-segment.png\" : _this.renkan.options.static_url+\"img/ldt-point.png\" )\n            );\n        _html += _this.annotationTemplate({\n            ldt_platform: _this.ldt_platform,\n            title: _title,\n            htitle: highlight(_title),\n            description: _description,\n            hdescription: highlight(_description),\n            start: convertTC(_annotation.begin),\n            end: convertTC(_annotation.end),\n            duration: convertTC(_duration),\n            mediaid: _annotation.media,\n            annotationid: _annotation.id,\n            image: _img,\n            static_url: _this.renkan.options.static_url\n        });\n    });\n\n    this.main_$.html(_html);\n    if (!search.isempty && count) {\n        this.count_$.text(count).show();\n    } else {\n        this.count_$.hide();\n    }\n    if (!search.isempty && !count) {\n        this.$.hide();\n    } else {\n        this.$.show();\n    }\n    this.renkan.resizeBins();\n};\n\nProjectBin.prototype.refresh = function() {\n    var _this = this;\n    Rkns.$.ajax({\n        url: this.ldt_platform + 'ldtplatform/ldt/cljson/id/' + this.proj_id,\n        dataType: \"jsonp\",\n        success: function(_data) {\n            _this.data = _data;\n            _this.render();\n        }\n    });\n};\n\nvar Search = Ldt.Search = function(_renkan, _opts) {\n    this.renkan = _renkan;\n    this.lang = _opts.lang || \"en\";\n};\n\nSearch.prototype.getBgClass = function() {\n    return \"Rk-Ldt-Icon\";\n};\n\nSearch.prototype.getSearchTitle = function() {\n    return this.renkan.translate(\"Lignes de Temps\");\n};\n\nSearch.prototype.search = function(_q) {\n    this.renkan.tabs.push(\n        new ResultsBin(this.renkan, {\n            search: _q\n        })\n    );\n};\n\nvar ResultsBin = Ldt.ResultsBin = Rkns.Utils.inherit(Rkns._BaseBin);\n\nResultsBin.prototype.segmentTemplate = renkanJST['templates/ldtjson-bin/segmenttemplate.html'];\n\nResultsBin.prototype._init = function(_renkan, _opts) {\n    this.renkan = _renkan;\n    this.ldt_platform = _opts.ldt_platform || \"http://ldt.iri.centrepompidou.fr/\";\n    this.max_results = _opts.max_results || 50;\n    this.search = _opts.search;\n    this.title_$.html('Lignes de Temps: \"' + _opts.search + '\"');\n    this.title_icon_$.addClass('Rk-Ldt-Title-Icon');\n    this.refresh();\n};\n\nResultsBin.prototype.render = function(searchbase) {\n    if (!this.data) {\n        return;\n    }\n    var search = searchbase || Rkns.Utils.regexpFromTextOrArray();\n    var highlightrx = (search.isempty ? Rkns.Utils.regexpFromTextOrArray(this.search) : search);\n    function highlight(_text) {\n        return highlightrx.replace(_(_text).escape(), \"<span class='searchmatch'>$1</span>\");\n    }\n    function convertTC(_ms) {\n        function pad(_n) {\n            var _res = _n.toString();\n            while (_res.length < 2) {\n                _res = '0' + _res;\n            }\n            return _res;\n        }\n        var _totalSeconds = Math.abs(Math.floor(_ms/1000)),\n            _hours = Math.floor(_totalSeconds / 3600),\n            _minutes = (Math.floor(_totalSeconds / 60) % 60),\n            _seconds = _totalSeconds % 60,\n            _res = '';\n        if (_hours) {\n            _res += pad(_hours) + ':';\n        }\n        _res += pad(_minutes) + ':' + pad(_seconds);\n        return _res;\n    }\n\n    var _html = '',\n        _this = this,\n        count = 0;\n    _(this.data.objects).each(function(_segment) {\n        var _description = _segment.abstract,\n            _title = _segment.title;\n        if (!search.isempty && !search.test(_title) && !search.test(_description)) {\n            return;\n        }\n        count++;\n        var _duration = _segment.duration,\n            _begin = _segment.start_ts,\n            _end = + _segment.duration + _begin,\n            _img = (\n                _duration ?\n                  _this.renkan.options.static_url + \"img/ldt-segment.png\" :\n                  _this.renkan.options.static_url + \"img/ldt-point.png\"\n            );\n        _html += _this.segmentTemplate({\n            ldt_platform: _this.ldt_platform,\n            title: _title,\n            htitle: highlight(_title),\n            description: _description,\n            hdescription: highlight(_description),\n            start: convertTC(_begin),\n            end: convertTC(_end),\n            duration: convertTC(_duration),\n            mediaid: _segment.iri_id,\n            //projectid: _segment.project_id,\n            //cuttingid: _segment.cutting_id,\n            annotationid: _segment.element_id,\n            image: _img\n        });\n    });\n\n    this.main_$.html(_html);\n    if (!search.isempty && count) {\n        this.count_$.text(count).show();\n    } else {\n        this.count_$.hide();\n    }\n    if (!search.isempty && !count) {\n        this.$.hide();\n    } else {\n        this.$.show();\n    }\n    this.renkan.resizeBins();\n};\n\nResultsBin.prototype.refresh = function() {\n    var _this = this;\n    Rkns.$.ajax({\n        url: this.ldt_platform + 'ldtplatform/api/ldt/1.0/segments/search/',\n        data: {\n            format: \"jsonp\",\n            q: this.search,\n            limit: this.max_results\n        },\n        dataType: \"jsonp\",\n        success: function(_data) {\n            _this.data = _data;\n            _this.render();\n        }\n    });\n};\n\n})(window.Rkns);\n","Rkns.ResourceList = {};\n\nRkns.ResourceList.Bin = Rkns.Utils.inherit(Rkns._BaseBin);\n\nRkns.ResourceList.Bin.prototype.resultTemplate = renkanJST['templates/list-bin.html'];\n\nRkns.ResourceList.Bin.prototype._init = function(_renkan, _opts) {\n    this.renkan = _renkan;\n    this.title_$.html(_opts.title);\n    if (_opts.list) {\n        this.data = _opts.list;\n    }\n    this.refresh();\n};\n\nRkns.ResourceList.Bin.prototype.render = function(searchbase) {\n    var search = searchbase || Rkns.Utils.regexpFromTextOrArray();\n    function highlight(_text) {\n        var _e = _(_text).escape();\n        return search.isempty ? _e : search.replace(_e, \"<span class='searchmatch'>$1</span>\");\n    }\n    var _html = \"\",\n        _this = this,\n        count = 0;\n    Rkns._(this.data).each(function(_item) {\n        var _element;\n        if (typeof _item === \"string\") {\n            if (/^(https?:\\/\\/|www)/.test(_item)) {\n                _element = { url: _item };\n            } else {\n                _element = { title: _item.replace(/[:,]?\\s?(https?:\\/\\/|www)[\\d\\w\\/.&?=#%-_]+\\s?/,'').trim() };\n                var _match = _item.match(/(https?:\\/\\/|www)[\\d\\w\\/.&?=#%-_]+/);\n                if (_match) {\n                    _element.url = _match[0];\n                }\n                if (_element.title.length > 80) {\n                    _element.description = _element.title;\n                    _element.title = _element.title.replace(/^(.{30,60})\\s.+$/,'$1…');\n                }\n            }\n        } else {\n            _element = _item;\n        }\n        var title = _element.title || (_element.url || \"\").replace(/^https?:\\/\\/(www\\.)?/,'').replace(/^(.{40}).+$/,'$1…'),\n            url = _element.url || \"\",\n            description = _element.description || \"\",\n            image = _element.image || \"\";\n        if (url && !/^https?:\\/\\//.test(url)) {\n            url = 'http://' + url;\n        }\n        if (!search.isempty && !search.test(title) && !search.test(description)) {\n            return;\n        }\n        count++;\n        _html += _this.resultTemplate({\n            url: url,\n            title: title,\n            htitle: highlight(title),\n            image: image,\n            description: description,\n            hdescription: highlight(description),\n            static_url: _this.renkan.options.static_url\n        });\n    });\n    _this.main_$.html(_html);\n    if (!search.isempty && count) {\n        this.count_$.text(count).show();\n    } else {\n        this.count_$.hide();\n    }\n    if (!search.isempty && !count) {\n        this.$.hide();\n    } else {\n        this.$.show();\n    }\n    this.renkan.resizeBins();\n};\n\nRkns.ResourceList.Bin.prototype.refresh = function() {\n    if (this.data) {\n        this.render();\n    }\n};\n","Rkns.Wikipedia = {\n};\n\nRkns.Wikipedia.Search = function(_renkan, _opts) {\n    this.renkan = _renkan;\n    this.lang = _opts.lang || \"en\";\n};\n\nRkns.Wikipedia.Search.prototype.getBgClass = function() {\n    return \"Rk-Wikipedia-Search-Icon Rk-Wikipedia-Lang-\" + this.lang;\n};\n\nRkns.Wikipedia.Search.prototype.getSearchTitle = function() {\n    var langs = {\n        \"fr\": \"French\",\n        \"en\": \"English\",\n        \"ja\": \"Japanese\"\n    };\n    if (langs[this.lang]) {\n        return this.renkan.translate(\"Wikipedia in \") + this.renkan.translate(langs[this.lang]);\n    } else {\n        return this.renkan.translate(\"Wikipedia\") + \" [\" + this.lang + \"]\";\n    }\n};\n\nRkns.Wikipedia.Search.prototype.search = function(_q) {\n    this.renkan.tabs.push(\n        new Rkns.Wikipedia.Bin(this.renkan, {\n            lang: this.lang,\n            search: _q\n        })\n    );\n};\n\nRkns.Wikipedia.Bin = Rkns.Utils.inherit(Rkns._BaseBin);\n\nRkns.Wikipedia.Bin.prototype.resultTemplate = renkanJST['templates/wikipedia-bin/resulttemplate.html'];\n\nRkns.Wikipedia.Bin.prototype._init = function(_renkan, _opts) {\n    this.renkan = _renkan;\n    this.search = _opts.search;\n    this.lang = _opts.lang || \"en\";\n    this.title_icon_$.addClass('Rk-Wikipedia-Title-Icon Rk-Wikipedia-Lang-' + this.lang);\n    this.title_$.html(this.search).addClass(\"Rk-Wikipedia-Title\");\n    this.refresh();\n};\n\nRkns.Wikipedia.Bin.prototype.render = function(searchbase) {\n    var search = searchbase || Rkns.Utils.regexpFromTextOrArray();\n    var highlightrx = (search.isempty ? Rkns.Utils.regexpFromTextOrArray(this.search) : search);\n    function highlight(_text) {\n        return highlightrx.replace(_(_text).escape(), \"<span class='searchmatch'>$1</span>\");\n    }\n    var _html = \"\",\n        _this = this,\n        count = 0;\n    Rkns._(this.data.query.search).each(function(_result) {\n        var title = _result.title,\n            url = \"http://\" + _this.lang + \".wikipedia.org/wiki/\" + encodeURI(title.replace(/ /g,\"_\")),\n            description = Rkns.$('<div>').html(_result.snippet).text();\n        if (!search.isempty && !search.test(title) && !search.test(description)) {\n            return;\n        }\n        count++;\n        _html += _this.resultTemplate({\n            url: url,\n            title: title,\n            htitle: highlight(title),\n            description: description,\n            hdescription: highlight(description),\n            static_url: _this.renkan.options.static_url\n        });\n    });\n    _this.main_$.html(_html);\n    if (!search.isempty && count) {\n        this.count_$.text(count).show();\n    } else {\n        this.count_$.hide();\n    }\n    if (!search.isempty && !count) {\n        this.$.hide();\n    } else {\n        this.$.show();\n    }\n    this.renkan.resizeBins();\n};\n\nRkns.Wikipedia.Bin.prototype.refresh = function() {\n    var _this = this;\n    Rkns.$.ajax({\n        url: \"http://\" + _this.lang + \".wikipedia.org/w/api.php?action=query&list=search&srsearch=\" + encodeURIComponent(this.search) + \"&format=json\",\n        dataType: \"jsonp\",\n        success: function(_data) {\n            _this.data = _data;\n            _this.render();\n        }\n    });\n};\n","\ndefine('renderer/baserepresentation',['jquery', 'underscore'], function ($, _) {\n    \n\n    /* Rkns.Renderer._BaseRepresentation Class */\n\n    /* In Renkan, a \"Representation\" is a sort of ViewModel (in the MVVM paradigm) and bridges the gap between\n     * models (written with Backbone.js) and the view (written with Paper.js)\n     * Renkan's representations all inherit from Rkns.Renderer._BaseRepresentation '*/\n\n    var _BaseRepresentation = function(_renderer, _model) {\n        if (typeof _renderer !== \"undefined\") {\n            this.renderer = _renderer;\n            this.renkan = _renderer.renkan;\n            this.project = _renderer.renkan.project;\n            this.options = _renderer.renkan.options;\n            this.model = _model;\n            if (this.model) {\n                var _this = this;\n                this._changeBinding = function() {\n                    _this.redraw();\n                };\n                this._removeBinding = function() {\n                    _renderer.removeRepresentation(_this);\n                    _(function() {\n                        _renderer.redraw();\n                    }).defer();\n                };\n                this._selectBinding = function() {\n                    _this.select();\n                };\n                this._unselectBinding = function() {\n                    _this.unselect();\n                };\n                this.model.on(\"change\", this._changeBinding );\n                this.model.on(\"remove\", this._removeBinding );\n                this.model.on(\"select\", this._selectBinding );\n                this.model.on(\"unselect\", this._unselectBinding );\n            }\n        }\n    };\n\n    /* Rkns.Renderer._BaseRepresentation Methods */\n\n    _(_BaseRepresentation.prototype).extend({\n        _super: function(_func) {\n            return _BaseRepresentation.prototype[_func].apply(this, Array.prototype.slice.call(arguments, 1));\n        },\n        redraw: function() {},\n        moveTo: function() {},\n        show: function() { return \"BaseRepresentation.show\"; },\n        hide: function() {},\n        select: function() {\n            if (this.model) {\n                this.model.trigger(\"selected\");\n            }\n        },\n        unselect: function() {\n            if (this.model) {\n                this.model.trigger(\"unselected\");\n            }\n        },\n        highlight: function() {},\n        unhighlight: function() {},\n        mousedown: function() {},\n        mouseup: function() {\n            if (this.model) {\n                this.model.trigger(\"clicked\");\n            }\n        },\n        destroy: function() {\n            if (this.model) {\n                this.model.off(\"change\", this._changeBinding );\n                this.model.off(\"remove\", this._removeBinding );\n                this.model.off(\"select\", this._selectBinding );\n                this.model.off(\"unselect\", this._unselectBinding );\n            }\n        }\n    });\n\n    /* End of Rkns.Renderer._BaseRepresentation Class */\n\n    return _BaseRepresentation;\n\n});\n\ndefine('requtils',[], function ($, _) {\n    \n    return {\n        getUtils: function(){\n            return window.Rkns.Utils;\n        },\n        getRenderer: function(){\n            return window.Rkns.Renderer;\n        }\n    };\n\n});\n\n\ndefine('renderer/basebutton',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* Rkns.Renderer._BaseButton Class */\n\n    /* BaseButton is extended by contextual buttons that appear when hovering on nodes and edges */\n\n    var _BaseButton = Utils.inherit(BaseRepresentation);\n\n    _(_BaseButton.prototype).extend({\n        moveTo: function(_pos) {\n            this.sector.moveTo(_pos);\n        },\n        show: function() {\n            this.sector.show();\n        },\n        hide: function() {\n            this.sector.hide();\n        },\n        select: function() {\n            this.sector.select();\n        },\n        unselect: function(_newTarget) {\n            this.sector.unselect();\n            if (!_newTarget || (_newTarget !== this.source_representation && _newTarget.source_representation !== this.source_representation)) {\n                this.source_representation.unselect();\n            }\n        },\n        destroy: function() {\n            this.sector.destroy();\n        }\n    });\n\n    return _BaseButton;\n\n});\n\n\ndefine('renderer/shapebuilder',[], function () {\n    \n\n    /* ShapeBuilder Begin */\n\n    var builders = {\n        \"circle\":{\n            getShape: function() {\n                return new paper.Path.Circle([0, 0], 1);\n            },\n            getImageShape: function(center, radius) {\n                return new paper.Path.Circle(center, radius);\n            }\n        },\n        \"rectangle\":{\n            getShape: function() {\n                return new paper.Path.Rectangle([-2, -2], [2, 2]);\n            },\n            getImageShape: function(center, radius) {\n                return new paper.Path.Rectangle([-radius, -radius], [radius*2, radius*2]);\n            }\n        },\n        \"ellipse\":{\n            getShape: function() {\n                return new paper.Path.Ellipse(new paper.Rectangle([-2, -1], [2, 1]));\n            },\n            getImageShape: function(center, radius) {\n                return new paper.Path.Ellipse(new paper.Rectangle([-radius, -radius/2], [radius*2, radius]));\n            }\n        },\n        \"polygon\":{\n            getShape: function() {\n                return new paper.Path.RegularPolygon([0, 0], 6, 1);\n            },\n            getImageShape: function(center, radius) {\n                return new paper.Path.RegularPolygon([0, 0], 6, radius);\n            }\n        },\n        \"diamond\":{\n            getShape: function() {\n                var d = new paper.Path.Rectangle([-2, -2], [2, 2]);\n                d.rotate(45);\n                return d;\n            },\n            getImageShape: function(center, radius) {\n                var d = new paper.Path.Rectangle([-radius, -radius], [radius*2, radius*2]);\n                d.rotate(45);\n                return d;\n            }\n        },\n        \"star\":{\n            getShape: function() {\n                return new paper.Path.Star([0, 0], 8, 1, 0.7);\n            },\n            getImageShape: function(center, radius) {\n                return new paper.Path.Star([0, 0], 8, radius*1, radius*0.7);\n            }\n        },\n        \"svg\": function(path){\n            return {\n                getShape: function() {\n                    return new paper.Path(path);\n                },\n                getImageShape: function(center, radius) {\n                    // No calcul for the moment \n                    return new paper.Path();\n                }\n            };\n        }\n    };\n    \n    var ShapeBuilder = function (shape){\n        if(typeof shape===\"undefined\"){\n            shape = \"circle\";\n        }\n        if(shape.substr(0,4)===\"svg:\"){\n            return builders.svg(shape.substr(4));\n        }\n        if(!(shape in builders)){\n            shape = \"circle\";\n        }\n        return builders[shape];\n    };\n    \n    return ShapeBuilder;\n\n});\n\ndefine('renderer/noderepr',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation', 'renderer/shapebuilder'], function ($, _, requtils, BaseRepresentation, ShapeBuilder) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* Rkns.Renderer.Node Class */\n\n    /* The representation for the node : A circle, with an image inside and a text label underneath.\n     * The circle and the image are drawn on canvas and managed by Paper.js.\n     * The text label is an HTML node, managed by jQuery. */\n\n    //var NodeRepr = Renderer.Node = Utils.inherit(Renderer._BaseRepresentation);\n    var NodeRepr = Utils.inherit(BaseRepresentation);\n\n    _(NodeRepr.prototype).extend({\n        _init: function() {\n            this.renderer.node_layer.activate();\n            this.type = \"Node\";\n            this.buildShape();\n            if (this.options.show_node_circles) {\n                this.circle.strokeWidth = this.options.node_stroke_width;\n                this.h_ratio = 1;\n            } else {\n                this.h_ratio = 0;\n            }\n            this.title = $('<div class=\"Rk-Label\">').appendTo(this.renderer.labels_$);\n\n            if (this.options.editor_mode) {\n                var Renderer = requtils.getRenderer();\n                this.normal_buttons = [\n                                       new Renderer.NodeEditButton(this.renderer, null),\n                                       new Renderer.NodeRemoveButton(this.renderer, null),\n                                       new Renderer.NodeLinkButton(this.renderer, null),\n                                       new Renderer.NodeEnlargeButton(this.renderer, null),\n                                       new Renderer.NodeShrinkButton(this.renderer, null)\n                                       ];\n                this.pending_delete_buttons = [\n                                               new Renderer.NodeRevertButton(this.renderer, null)\n                                               ];\n                this.all_buttons = this.normal_buttons.concat(this.pending_delete_buttons);\n\n                for (var i = 0; i < this.all_buttons.length; i++) {\n                    this.all_buttons[i].source_representation = this;\n                }\n                this.active_buttons = [];\n            } else {\n                this.active_buttons = this.all_buttons = [];\n            }\n            this.last_circle_radius = 1;\n\n            if (this.renderer.minimap) {\n                this.renderer.minimap.node_layer.activate();\n                this.minimap_circle = new paper.Path.Circle([0, 0], 1);\n                this.minimap_circle.__representation = this.renderer.minimap.miniframe.__representation;\n                this.renderer.minimap.node_group.addChild(this.minimap_circle);\n            }\n        },\n        buildShape: function(){\n            if(typeof this.model.get(\"shape_changed\")!==\"undefined\" && this.model.get(\"shape_changed\")===true){\n                this.model.set(\"shape_changed\", false);\n                delete this.img;\n            }\n            if(this.circle){\n                this.circle.remove();\n                delete this.circle;\n            }\n            // \"circle\" \"rectangle\" \"ellipse\" \"polygon\" \"star\" \"diamond\"\n            this.shapeBuilder = new ShapeBuilder(this.model.get(\"shape\"));\n            this.circle = this.shapeBuilder.getShape();\n            this.circle.__representation = this;\n            this.last_circle_radius = 1;\n        },\n        redraw: function(_dontRedrawEdges) {\n            if(typeof this.model.get(\"shape_changed\")!==\"undefined\" && this.model.get(\"shape_changed\")===true){\n                this.buildShape();\n            }\n            var _model_coords = new paper.Point(this.model.get(\"position\")),\n            _baseRadius = this.options.node_size_base * Math.exp((this.model.get(\"size\") || 0) * Utils._NODE_SIZE_STEP);\n            if (!this.is_dragging || !this.paper_coords) {\n                this.paper_coords = this.renderer.toPaperCoords(_model_coords);\n            }\n            this.circle_radius = _baseRadius * this.renderer.scale;\n            if (this.last_circle_radius !== this.circle_radius) {\n                this.all_buttons.forEach(function(b) {\n                    b.setSectorSize();\n                });\n                this.circle.scale(this.circle_radius / this.last_circle_radius);\n                if (this.node_image) {\n                    this.node_image.scale(this.circle_radius / this.last_circle_radius);\n                }\n            }\n            this.circle.position = this.paper_coords;\n            if (this.node_image) {\n                this.node_image.position = this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius));\n            }\n            this.last_circle_radius = this.circle_radius;\n\n            var old_act_btn = this.active_buttons;\n\n            var opacity = 1;\n            if (this.model.get(\"delete_scheduled\")) {\n                opacity = 0.5;\n                this.active_buttons = this.pending_delete_buttons;\n                this.circle.dashArray = [2,2];\n            } else {\n                opacity = 1;\n                this.active_buttons = this.normal_buttons;\n                this.circle.dashArray = null;\n            }\n\n            if (this.selected && this.renderer.isEditable()) {\n                if (old_act_btn !== this.active_buttons) {\n                    old_act_btn.forEach(function(b) {\n                        b.hide();\n                    });\n                }\n                this.active_buttons.forEach(function(b) {\n                    b.show();\n                });\n            }\n\n            if (this.node_image) {\n                this.node_image.opacity = this.highlighted ? opacity * 0.5 : (opacity - 0.01);\n            }\n\n            this.circle.fillColor = this.highlighted ? this.options.highlighted_node_fill_color : this.options.node_fill_color;\n\n            this.circle.opacity = this.options.show_node_circles ? opacity : 0.01;\n\n            var _text = this.model.get(\"title\") || this.renkan.translate(this.options.label_untitled_nodes) || \"\";\n            _text = Utils.shortenText(_text, this.options.node_label_max_length);\n\n            if (typeof this.highlighted === \"object\") {\n                this.title.html(this.highlighted.replace(_(_text).escape(),'<span class=\"Rk-Highlighted\">$1</span>'));\n            } else {\n                this.title.text(_text);\n            }\n\n            this.title.css({\n                left: this.paper_coords.x,\n                top: this.paper_coords.y + this.circle_radius * this.h_ratio + this.options.node_label_distance,\n                opacity: opacity\n            });\n            var _color = this.model.get(\"color\") || (this.model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\");\n            this.circle.strokeColor = _color;\n            var _pc = this.paper_coords;\n            this.all_buttons.forEach(function(b) {\n                b.moveTo(_pc);\n            });\n            var lastImage = this.img;\n            this.img = this.model.get(\"image\");\n            if (this.img && this.img !== lastImage) {\n                this.showImage();\n            }\n            if (this.node_image && !this.img) {\n                this.node_image.remove();\n                delete this.node_image;\n            }\n\n            if (this.renderer.minimap) {\n                this.minimap_circle.fillColor = _color;\n                var minipos = this.renderer.toMinimapCoords(_model_coords),\n                miniradius = this.renderer.minimap.scale * _baseRadius,\n                minisize = new paper.Size([miniradius, miniradius]);\n                this.minimap_circle.fitBounds(minipos.subtract(minisize), minisize.multiply(2));\n            }\n\n            if (!_dontRedrawEdges) {\n                var _this = this;\n                _.each(\n                        this.project.get(\"edges\").filter(\n                                function (ed) {\n                                    return ((ed.get(\"to\") === _this.model) || (ed.get(\"from\") === _this.model));\n                                }\n                        ),\n                        function(edge, index, list) {\n                            var repr = _this.renderer.getRepresentationByModel(edge);\n                            if (repr && typeof repr.from_representation !== \"undefined\" && typeof repr.from_representation.paper_coords !== \"undefined\" && typeof repr.to_representation !== \"undefined\" && typeof repr.to_representation.paper_coords !== \"undefined\") {\n                                repr.redraw();\n                            }\n                        }\n                );\n            }\n\n        },\n        showImage: function() {\n            var _image = null;\n            if (typeof this.renderer.image_cache[this.img] === \"undefined\") {\n                _image = new Image();\n                this.renderer.image_cache[this.img] = _image;\n                _image.src = this.img;\n            } else {\n                _image = this.renderer.image_cache[this.img];\n            }\n            if (_image.width) {\n                if (this.node_image) {\n                    this.node_image.remove();\n                }\n                this.renderer.node_layer.activate();\n                var width = _image.width,\n                    height = _image.height,\n                    clipPath = this.model.get(\"clip_path\"),\n                    hasClipPath = (typeof clipPath !== \"undefined\" && clipPath),\n                    _clip = null,\n                    baseRadius = null,\n                    centerPoint = null;\n\n                if (hasClipPath) {\n                    _clip = new paper.Path();\n                    var instructions = clipPath.match(/[a-z][^a-z]+/gi) || [],\n                    lastCoords = [0,0],\n                    minX = Infinity,\n                    minY = Infinity,\n                    maxX = -Infinity,\n                    maxY = -Infinity;\n\n                    var transformCoords = function(tabc, relative) {\n                        var newCoords = tabc.slice(1).map(function(v, k) {\n                            var res = parseFloat(v),\n                            isY = k % 2;\n                            if (isY) {\n                                res = ( res - 0.5 ) * height;\n                            } else {\n                                res = ( res - 0.5 ) * width;\n                            }\n                            if (relative) {\n                                res += lastCoords[isY];\n                            }\n                            if (isY) {\n                                minY = Math.min(minY, res);\n                                maxY = Math.max(maxY, res);\n                            } else {\n                                minX = Math.min(minX, res);\n                                maxX = Math.max(maxX, res);\n                            }\n                            return res;\n                        });\n                        lastCoords = newCoords.slice(-2);\n                        return newCoords;\n                    };\n\n                    instructions.forEach(function(instr) {\n                        var coords = instr.match(/([a-z]|[0-9.-]+)/ig) || [\"\"];\n                        switch(coords[0]) {\n                        case \"M\":\n                            _clip.moveTo(transformCoords(coords));\n                            break;\n                        case \"m\":\n                            _clip.moveTo(transformCoords(coords, true));\n                            break;\n                        case \"L\":\n                            _clip.lineTo(transformCoords(coords));\n                            break;\n                        case \"l\":\n                            _clip.lineTo(transformCoords(coords, true));\n                            break;\n                        case \"C\":\n                            _clip.cubicCurveTo(transformCoords(coords));\n                            break;\n                        case \"c\":\n                            _clip.cubicCurveTo(transformCoords(coords, true));\n                            break;\n                        case \"Q\":\n                            _clip.quadraticCurveTo(transformCoords(coords));\n                            break;\n                        case \"q\":\n                            _clip.quadraticCurveTo(transformCoords(coords, true));\n                            break;\n                        }\n                    });\n\n                    baseRadius = Math[this.options.node_images_fill_mode ? \"min\" : \"max\"](maxX - minX, maxY - minY) / 2;\n                    centerPoint = new paper.Point((maxX + minX) / 2, (maxY + minY) / 2);\n                    if (!this.options.show_node_circles) {\n                        this.h_ratio = (maxY - minY) / (2 * baseRadius);\n                    }\n                } else {\n                    baseRadius = Math[this.options.node_images_fill_mode ? \"min\" : \"max\"](width, height) / 2;\n                    centerPoint = new paper.Point(0,0);\n                    if (!this.options.show_node_circles) {\n                        this.h_ratio = height / (2 * baseRadius);\n                    }\n                }\n                var _raster = new paper.Raster(_image);\n                _raster.locked = true; // Disable mouse events on icon\n                if (hasClipPath) {\n                    _raster = new paper.Group(_clip, _raster);\n                    _raster.opacity = 0.99;\n                    /* This is a workaround to allow clipping at group level\n                     * If opacity was set to 1, paper.js would merge all clipping groups in one (known bug).\n                     */\n                    _raster.clipped = true;\n                    _clip.__representation = this;\n                }\n                if (this.options.clip_node_images) {\n                    var _circleClip = this.shapeBuilder.getImageShape(centerPoint, baseRadius);\n                    _raster = new paper.Group(_circleClip, _raster);\n                    _raster.opacity = 0.99;\n                    _raster.clipped = true;\n                    _circleClip.__representation = this;\n                }\n                this.image_delta = centerPoint.divide(baseRadius);\n                this.node_image = _raster;\n                this.node_image.__representation = _this;\n                this.node_image.scale(this.circle_radius / baseRadius);\n                this.node_image.position = this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius));\n                this.redraw();\n                this.renderer.throttledPaperDraw();\n            } else {\n                var _this = this;\n                $(_image).on(\"load\", function() {\n                    _this.showImage();\n                });\n            }\n        },\n        paperShift: function(_delta) {\n            if (this.options.editor_mode) {\n                if (!this.renkan.read_only) {\n                    this.is_dragging = true;\n                    this.paper_coords = this.paper_coords.add(_delta);\n                    this.redraw();\n                }\n            } else {\n                this.renderer.paperShift(_delta);\n            }\n        },\n        openEditor: function() {\n            this.renderer.removeRepresentationsOfType(\"editor\");\n            var _editor = this.renderer.addRepresentation(\"NodeEditor\",null);\n            _editor.source_representation = this;\n            _editor.draw();\n        },\n        select: function() {\n            this.selected = true;\n            this.circle.strokeWidth = this.options.selected_node_stroke_width;\n            if (this.renderer.isEditable()) {\n                this.active_buttons.forEach(function(b) {\n                    b.show();\n                });\n            }\n            var _uri = this.model.get(\"uri\");\n            if (_uri) {\n                $('.Rk-Bin-Item').each(function() {\n                    var _el = $(this);\n                    if (_el.attr(\"data-uri\") === _uri) {\n                        _el.addClass(\"selected\");\n                    }\n                });\n            }\n            if (!this.options.editor_mode) {\n                this.openEditor();\n            }\n\n            if (this.renderer.minimap) {\n                this.minimap_circle.strokeWidth = this.options.minimap_highlight_weight;\n                this.minimap_circle.strokeColor = this.options.minimap_highlight_color;\n            }\n            this._super(\"select\");\n        },\n        hideButtons: function() {\n            this.all_buttons.forEach(function(b) {\n                b.hide();\n            });\n            delete(this.buttonTimeout);\n        },\n        unselect: function(_newTarget) {\n            if (!_newTarget || _newTarget.source_representation !== this) {\n                this.selected = false;\n                var _this = this;\n                this.buttons_timeout = setTimeout(function() { _this.hideButtons(); }, 200);\n                this.circle.strokeWidth = this.options.node_stroke_width;\n                $('.Rk-Bin-Item').removeClass(\"selected\");\n                if (this.renderer.minimap) {\n                    this.minimap_circle.strokeColor = undefined;\n                }\n                this._super(\"unselect\");\n            }\n        },\n        highlight: function(textToReplace) {\n            var hlvalue = textToReplace || true;\n            if (this.highlighted === hlvalue) {\n                return;\n            }\n            this.highlighted = hlvalue;\n            this.redraw();\n            this.renderer.throttledPaperDraw();\n        },\n        unhighlight: function() {\n            if (!this.highlighted) {\n                return;\n            }\n            this.highlighted = false;\n            this.redraw();\n            this.renderer.throttledPaperDraw();\n        },\n        saveCoords: function() {\n            var _coords = this.renderer.toModelCoords(this.paper_coords),\n            _data = {\n                position: {\n                    x: _coords.x,\n                    y: _coords.y\n                }\n            };\n            if (this.renderer.isEditable()) {\n                this.model.set(_data);\n            }\n        },\n        mousedown: function(_event, _isTouch) {\n            if (_isTouch) {\n                this.renderer.unselectAll();\n                this.select();\n            }\n        },\n        mouseup: function(_event, _isTouch) {\n            if (this.renderer.is_dragging && this.renderer.isEditable()) {\n                this.saveCoords();\n            } else {\n                if (!_isTouch && !this.model.get(\"delete_scheduled\")) {\n                    this.openEditor();\n                }\n                this.model.trigger(\"clicked\");\n            }\n            this.renderer.click_target = null;\n            this.renderer.is_dragging = false;\n            this.is_dragging = false;\n        },\n        destroy: function(_event) {\n            this._super(\"destroy\");\n            this.all_buttons.forEach(function(b) {\n                b.destroy();\n            });\n            this.circle.remove();\n            this.title.remove();\n            if (this.renderer.minimap) {\n                this.minimap_circle.remove();\n            }\n            if (this.node_image) {\n                this.node_image.remove();\n            }\n        }\n    });\n\n    return NodeRepr;\n\n});\n\n\ndefine('renderer/edge',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* Edge Class Begin */\n\n    //var Edge = Renderer.Edge = Utils.inherit(Renderer._BaseRepresentation);\n    var Edge = Utils.inherit(BaseRepresentation);\n\n    _(Edge.prototype).extend({\n        _init: function() {\n            this.renderer.edge_layer.activate();\n            this.type = \"Edge\";\n            this.from_representation = this.renderer.getRepresentationByModel(this.model.get(\"from\"));\n            this.to_representation = this.renderer.getRepresentationByModel(this.model.get(\"to\"));\n            this.bundle = this.renderer.addToBundles(this);\n            this.line = new paper.Path();\n            this.line.add([0,0],[0,0],[0,0]);\n            this.line.__representation = this;\n            this.line.strokeWidth = this.options.edge_stroke_width;\n            this.arrow = new paper.Path();\n            this.arrow.add(\n                    [ 0, 0 ],\n                    [ this.options.edge_arrow_length, this.options.edge_arrow_width / 2 ],\n                    [ 0, this.options.edge_arrow_width ]\n            );\n            this.arrow.__representation = this;\n            this.text = $('<div class=\"Rk-Label Rk-Edge-Label\">').appendTo(this.renderer.labels_$);\n            this.arrow_angle = 0;\n            if (this.options.editor_mode) {\n                var Renderer = requtils.getRenderer();\n                this.normal_buttons = [\n                                       new Renderer.EdgeEditButton(this.renderer, null),\n                                       new Renderer.EdgeRemoveButton(this.renderer, null)\n                                       ];\n                this.pending_delete_buttons = [\n                                               new Renderer.EdgeRevertButton(this.renderer, null)\n                                               ];\n                this.all_buttons = this.normal_buttons.concat(this.pending_delete_buttons);\n                for (var i = 0; i < this.all_buttons.length; i++) {\n                    this.all_buttons[i].source_representation = this;\n                }\n                this.active_buttons = [];\n            } else {\n                this.active_buttons = this.all_buttons = [];\n            }\n\n            if (this.renderer.minimap) {\n                this.renderer.minimap.edge_layer.activate();\n                this.minimap_line = new paper.Path();\n                this.minimap_line.add([0,0],[0,0]);\n                this.minimap_line.__representation = this.renderer.minimap.miniframe.__representation;\n                this.minimap_line.strokeWidth = 1;\n            }\n        },\n        redraw: function() {\n            var from = this.model.get(\"from\"),\n            to = this.model.get(\"to\");\n            if (!from || !to) {\n                return;\n            }\n            this.from_representation = this.renderer.getRepresentationByModel(from);\n            this.to_representation = this.renderer.getRepresentationByModel(to);\n            if (typeof this.from_representation === \"undefined\" || typeof this.to_representation === \"undefined\") {\n                return;\n            }\n            var _p0a = this.from_representation.paper_coords,\n            _p1a = this.to_representation.paper_coords,\n            _v = _p1a.subtract(_p0a),\n            _r = _v.length,\n            _u = _v.divide(_r),\n            _ortho = new paper.Point([- _u.y, _u.x]),\n            _group_pos = this.bundle.getPosition(this),\n            _delta = _ortho.multiply( this.options.edge_gap_in_bundles * _group_pos ),\n            _p0b = _p0a.add(_delta), /* Adding a 4 px difference */\n            _p1b = _p1a.add(_delta), /* to differentiate bundled links */\n            _a = _v.angle,\n            _textdelta = _ortho.multiply(this.options.edge_label_distance),\n            _handle = _v.divide(3),\n            _color = this.model.get(\"color\") || this.model.get(\"color\") || (this.model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n            opacity = 1;\n\n            if (this.model.get(\"delete_scheduled\") || this.from_representation.model.get(\"delete_scheduled\") || this.to_representation.model.get(\"delete_scheduled\")) {\n                opacity = 0.5;\n                this.line.dashArray = [2, 2];\n            } else {\n                opacity = 1;\n                this.line.dashArray = null;\n            }\n\n            var old_act_btn = this.active_buttons;\n\n            this.active_buttons = this.model.get(\"delete_scheduled\") ? this.pending_delete_buttons : this.normal_buttons;\n\n            if (this.selected && this.renderer.isEditable() && old_act_btn !== this.active_buttons) {\n                old_act_btn.forEach(function(b) {\n                    b.hide();\n                });\n                this.active_buttons.forEach(function(b) {\n                    b.show();\n                });\n            }\n\n            this.paper_coords = _p0b.add(_p1b).divide(2);\n            this.line.strokeColor = _color;\n            this.line.opacity = opacity;\n            this.line.segments[0].point = _p0a;\n            this.line.segments[1].point = this.paper_coords;\n            this.line.segments[1].handleIn = _handle.multiply(-1);\n            this.line.segments[1].handleOut = _handle;\n            this.line.segments[2].point = _p1a;\n            this.arrow.rotate(_a - this.arrow_angle);\n            this.arrow.fillColor = _color;\n            this.arrow.opacity = opacity;\n            this.arrow.position = this.paper_coords;\n            this.arrow_angle = _a;\n            if (_a > 90) {\n                _a -= 180;\n                _textdelta = _textdelta.multiply(-1);\n            }\n            if (_a < -90) {\n                _a += 180;\n                _textdelta = _textdelta.multiply(-1);\n            }\n            var _text = this.model.get(\"title\") || this.renkan.translate(this.options.label_untitled_edges) || \"\";\n            _text = Utils.shortenText(_text, this.options.node_label_max_length);\n            this.text.text(_text);\n            var _textpos = this.paper_coords.add(_textdelta);\n            this.text.css({\n                left: _textpos.x,\n                top: _textpos.y,\n                transform: \"rotate(\" + _a + \"deg)\",\n                \"-moz-transform\": \"rotate(\" + _a + \"deg)\",\n                \"-webkit-transform\": \"rotate(\" + _a + \"deg)\",\n                opacity: opacity\n            });\n            this.text_angle = _a;\n\n            var _pc = this.paper_coords;\n            this.all_buttons.forEach(function(b) {\n                b.moveTo(_pc);\n            });\n\n            if (this.renderer.minimap) {\n                this.minimap_line.strokeColor = _color;\n                this.minimap_line.segments[0].point = this.renderer.toMinimapCoords(new paper.Point(this.from_representation.model.get(\"position\")));\n                this.minimap_line.segments[1].point = this.renderer.toMinimapCoords(new paper.Point(this.to_representation.model.get(\"position\")));\n            }\n        },\n        openEditor: function() {\n            this.renderer.removeRepresentationsOfType(\"editor\");\n            var _editor = this.renderer.addRepresentation(\"EdgeEditor\",null);\n            _editor.source_representation = this;\n            _editor.draw();\n        },\n        select: function() {\n            this.selected = true;\n            this.line.strokeWidth = this.options.selected_edge_stroke_width;\n            if (this.renderer.isEditable()) {\n                this.active_buttons.forEach(function(b) {\n                    b.show();\n                });\n            }\n            if (!this.options.editor_mode) {\n                this.openEditor();\n            }\n            this._super(\"select\");\n        },\n        unselect: function(_newTarget) {\n            if (!_newTarget || _newTarget.source_representation !== this) {\n                this.selected = false;\n                if (this.options.editor_mode) {\n                    this.all_buttons.forEach(function(b) {\n                        b.hide();\n                    });\n                }\n                this.line.strokeWidth = this.options.edge_stroke_width;\n                this._super(\"unselect\");\n            }\n        },\n        mousedown: function(_event, _isTouch) {\n            if (_isTouch) {\n                this.renderer.unselectAll();\n                this.select();\n            }\n        },\n        mouseup: function(_event, _isTouch) {\n            if (!this.renkan.read_only && this.renderer.is_dragging) {\n                this.from_representation.saveCoords();\n                this.to_representation.saveCoords();\n                this.from_representation.is_dragging = false;\n                this.to_representation.is_dragging = false;\n            } else {\n                if (!_isTouch) {\n                    this.openEditor();\n                }\n                this.model.trigger(\"clicked\");\n            }\n            this.renderer.click_target = null;\n            this.renderer.is_dragging = false;\n        },\n        paperShift: function(_delta) {\n            if (this.options.editor_mode) {\n                if (!this.options.read_only) {\n                    this.from_representation.paperShift(_delta);\n                    this.to_representation.paperShift(_delta);\n                }\n            } else {\n                this.renderer.paperShift(_delta);\n            }\n        },\n        destroy: function() {\n            this._super(\"destroy\");\n            this.line.remove();\n            this.arrow.remove();\n            this.text.remove();\n            if (this.renderer.minimap) {\n                this.minimap_line.remove();\n            }\n            this.all_buttons.forEach(function(b) {\n                b.destroy();\n            });\n            var _this = this;\n            this.bundle.edges = _(this.bundle.edges).reject(function(_edge) {\n                return _this === _edge;\n            });\n        }\n    });\n\n    return Edge;\n\n});\n\n\n\ndefine('renderer/tempedge',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* TempEdge Class Begin */\n\n    //var TempEdge = Renderer.TempEdge = Utils.inherit(Renderer._BaseRepresentation);\n    var TempEdge = Utils.inherit(BaseRepresentation);\n\n    _(TempEdge.prototype).extend({\n        _init: function() {\n            this.renderer.edge_layer.activate();\n            this.type = \"Temp-edge\";\n\n            var _color = (this.project.get(\"users\").get(this.renkan.current_user) || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\");\n            this.line = new paper.Path();\n            this.line.strokeColor = _color;\n            this.line.dashArray = [4, 2];\n            this.line.strokeWidth = this.options.selected_edge_stroke_width;\n            this.line.add([0,0],[0,0]);\n            this.line.__representation = this;\n            this.arrow = new paper.Path();\n            this.arrow.fillColor = _color;\n            this.arrow.add(\n                    [ 0, 0 ],\n                    [ this.options.edge_arrow_length, this.options.edge_arrow_width / 2 ],\n                    [ 0, this.options.edge_arrow_width ]\n            );\n            this.arrow.__representation = this;\n            this.arrow_angle = 0;\n        },\n        redraw: function() {\n            var _p0 = this.from_representation.paper_coords,\n            _p1 = this.end_pos,\n            _a = _p1.subtract(_p0).angle,\n            _c = _p0.add(_p1).divide(2);\n            this.line.segments[0].point = _p0;\n            this.line.segments[1].point = _p1;\n            this.arrow.rotate(_a - this.arrow_angle);\n            this.arrow.position = _c;\n            this.arrow_angle = _a;\n        },\n        paperShift: function(_delta) {\n            if (!this.renderer.isEditable()) {\n                this.renderer.removeRepresentation(_this);\n                paper.view.draw();\n                return;\n            }\n            this.end_pos = this.end_pos.add(_delta);\n            var _hitResult = paper.project.hitTest(this.end_pos);\n            this.renderer.findTarget(_hitResult);\n            this.redraw();\n        },\n        mouseup: function(_event, _isTouch) {\n            var _hitResult = paper.project.hitTest(_event.point),\n            _model = this.from_representation.model,\n            _endDrag = true;\n            if (_hitResult && typeof _hitResult.item.__representation !== \"undefined\") {\n                var _target = _hitResult.item.__representation;\n                if (_target.type.substr(0,4) === \"Node\") {\n                    var _destmodel = _target.model || _target.source_representation.model;\n                    if (_model !== _destmodel) {\n                        var _data = {\n                                id: Utils.getUID('edge'),\n                                created_by: this.renkan.current_user,\n                                from: _model,\n                                to: _destmodel\n                        };\n                        if (this.renderer.isEditable()) {\n                            this.project.addEdge(_data);\n                        }\n                    }\n                }\n\n                if (_model === _target.model || (_target.source_representation && _target.source_representation.model === _model)) {\n                    _endDrag = false;\n                    this.renderer.is_dragging = true;\n                }\n            }\n            if (_endDrag) {\n                this.renderer.click_target = null;\n                this.renderer.is_dragging = false;\n                this.renderer.removeRepresentation(this);\n                paper.view.draw();\n            }\n        },\n        destroy: function() {\n            this.arrow.remove();\n            this.line.remove();\n        }\n    });\n\n    /* TempEdge Class End */\n\n    return TempEdge;\n\n});\n\n\ndefine('renderer/baseeditor',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* _BaseEditor Begin */\n    //var _BaseEditor = Renderer._BaseEditor = Utils.inherit(Renderer._BaseRepresentation);\n    var _BaseEditor = Utils.inherit(BaseRepresentation);\n\n    _(_BaseEditor.prototype).extend({\n        _init: function() {\n            this.renderer.buttons_layer.activate();\n            this.type = \"editor\";\n            this.editor_block = new paper.Path();\n            var _pts = _(_.range(8)).map(function() {return [0,0];});\n            this.editor_block.add.apply(this.editor_block, _pts);\n            this.editor_block.strokeWidth = this.options.tooltip_border_width;\n            this.editor_block.strokeColor = this.options.tooltip_border_color;\n            this.editor_block.opacity = 0.8;\n            this.editor_$ = $('<div>')\n            .appendTo(this.renderer.editor_$)\n            .css({\n                position: \"absolute\",\n                opacity: 0.8\n            })\n            .hide();\n        },\n        destroy: function() {\n            this.editor_block.remove();\n            this.editor_$.remove();\n        }\n    });\n\n    /* _BaseEditor End */\n\n    return _BaseEditor;\n\n});\n\n\ndefine('renderer/nodeeditor',['jquery', 'underscore', 'requtils', 'renderer/baseeditor'], function ($, _, requtils, BaseEditor) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* NodeEditor Begin */\n    //var NodeEditor = Renderer.NodeEditor = Utils.inherit(Renderer._BaseEditor);\n    var NodeEditor = Utils.inherit(BaseEditor);\n\n    _(NodeEditor.prototype).extend({\n    \t_init: function() {\n    \t\tBaseEditor.prototype._init.apply(this);\n    \t\tthis.template = this.options.templates['templates/nodeeditor.html'];\n    \t\tthis.readOnlyTemplate = this.options.templates['templates/nodeeditor_readonly.html'];\n    \t},\n        draw: function() {\n            var _model = this.source_representation.model,\n            _created_by = _model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan),\n            _template = (this.renderer.isEditable() ? this.template : this.readOnlyTemplate ),\n            _image_placeholder = this.options.static_url + \"img/image-placeholder.png\",\n            _size = (_model.get(\"size\") || 0);\n            this.editor_$\n            .html(_template({\n                node: {\n                    has_creator: !!_model.get(\"created_by\"),\n                    title: _model.get(\"title\"),\n                    uri: _model.get(\"uri\"),\n                    short_uri:  Utils.shortenText((_model.get(\"uri\") || \"\").replace(/^(https?:\\/\\/)?(www\\.)?/,'').replace(/\\/$/,''),40),\n                    description: _model.get(\"description\"),\n                    image: _model.get(\"image\") || \"\",\n                    image_placeholder: _image_placeholder,\n                    color: _model.get(\"color\") || _created_by.get(\"color\"),\n                    clip_path: _model.get(\"clip_path\") || false,\n                    created_by_color: _created_by.get(\"color\"),\n                    created_by_title: _created_by.get(\"title\"),\n                    size: (_size > 0 ? \"+\" : \"\") + _size,\n                    shape: _model.get(\"shape\") || \"circle\"\n                },\n                renkan: this.renkan,\n                options: this.options,\n                shortenText: Utils.shortenText\n            }));\n            this.redraw();\n            var _this = this,\n            closeEditor = function() {\n                _this.renderer.removeRepresentation(_this);\n                paper.view.draw();\n            };\n\n            this.editor_$.find(\".Rk-CloseX\").click(closeEditor);\n\n            this.editor_$.find(\".Rk-Edit-Goto\").click(function() {\n                if (!_model.get(\"uri\")) {\n                    return false;\n                }\n            });\n\n            if (this.renderer.isEditable()) {\n\n                var onFieldChange = _(function() {\n                    _(function() {\n                        if (_this.renderer.isEditable()) {\n                            var _data = {\n                                title: _this.editor_$.find(\".Rk-Edit-Title\").val()\n                            };\n                            if (_this.options.show_node_editor_uri) {\n                                _data.uri = _this.editor_$.find(\".Rk-Edit-URI\").val();\n                                _this.editor_$.find(\".Rk-Edit-Goto\").attr(\"href\",_data.uri || \"#\");\n                            }\n                            if (_this.options.show_node_editor_image) {\n                                _data.image = _this.editor_$.find(\".Rk-Edit-Image\").val();\n                                _this.editor_$.find(\".Rk-Edit-ImgPreview\").attr(\"src\", _data.image || _image_placeholder);\n                            }\n                            if (_this.options.show_node_editor_description) {\n                                _data.description = _this.editor_$.find(\".Rk-Edit-Description\").val();\n                            }\n                            if (_this.options.change_shapes) {\n                                if(_model.get(\"shape\")!==_this.editor_$.find(\".Rk-Edit-Shape\").val()){\n                                    _data.shape = _this.editor_$.find(\".Rk-Edit-Shape\").val();\n                                    _data.shape_changed = true;\n                                }\n                            }\n                            _model.set(_data);\n                            _this.redraw();\n                            // For an unknown reason, we have to set data twice when we change shape, otherwise the image disappears.\n                            if(_data.shape_changed===true){\n                                _model.set(_data);\n                            }\n                        } else {\n                            closeEditor();\n                        }\n                    }).defer();\n                }).throttle(500);\n                \n                this.editor_$.on(\"keyup\", function(_e) {\n                    if (_e.keyCode === 27) {\n                        closeEditor();\n                    }\n                });\n\n                this.editor_$.find(\"input, textarea, select\").on(\"change keyup paste\", onFieldChange);\n\n                if(_this.options.allow_image_upload) {\n                    this.editor_$.find(\".Rk-Edit-Image-File\").change(function() {\n                        if (this.files.length) {\n                            var f = this.files[0],\n                            fr = new FileReader();\n                            if (f.type.substr(0,5) !== \"image\") {\n                                alert(_this.renkan.translate(\"This file is not an image\"));\n                                return;\n                            }\n                            if (f.size > (_this.options.uploaded_image_max_kb * 1024)) {\n                                alert(_this.renkan.translate(\"Image size must be under \") + _this.options.uploaded_image_max_kb + _this.renkan.translate(\"KB\"));\n                                return;\n                            }\n                            fr.onload = function(e) {\n                                _this.editor_$.find(\".Rk-Edit-Image\").val(e.target.result);\n                                onFieldChange();\n                            };\n                            fr.readAsDataURL(f);\n                        }\n                    });\n                }\n                this.editor_$.find(\".Rk-Edit-Title\")[0].focus();\n\n                var _picker = _this.editor_$.find(\".Rk-Edit-ColorPicker\");\n\n                this.editor_$.find(\".Rk-Edit-ColorPicker-Wrapper\").hover(\n                        function(_e) {\n                            _e.preventDefault();\n                            _picker.show();\n                        },\n                        function(_e) {\n                            _e.preventDefault();\n                            _picker.hide();\n                        }\n                );\n\n                _picker.find(\"li\").hover(\n                        function(_e) {\n                            _e.preventDefault();\n                            _this.editor_$.find(\".Rk-Edit-Color\").css(\"background\", $(this).attr(\"data-color\"));\n                        },\n                        function(_e) {\n                            _e.preventDefault();\n                            _this.editor_$.find(\".Rk-Edit-Color\").css(\"background\", _model.get(\"color\") || (_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(_this.renkan)).get(\"color\"));\n                        }\n                ).click(function(_e) {\n                    _e.preventDefault();\n                    if (_this.renderer.isEditable()) {\n                        _model.set(\"color\", $(this).attr(\"data-color\"));\n                        _picker.hide();\n                        paper.view.draw();\n                    } else {\n                        closeEditor();\n                    }\n                });\n\n                var shiftSize = function(n) {\n                    if (_this.renderer.isEditable()) {\n                        var _newsize = n+(_model.get(\"size\") || 0);\n                        _this.editor_$.find(\".Rk-Edit-Size-Value\").text((_newsize > 0 ? \"+\" : \"\") + _newsize);\n                        _model.set(\"size\", _newsize);\n                        paper.view.draw();\n                    } else {\n                        closeEditor();\n                    }\n                };\n\n                this.editor_$.find(\".Rk-Edit-Size-Down\").click(function() {\n                    shiftSize(-1);\n                    return false;\n                });\n                this.editor_$.find(\".Rk-Edit-Size-Up\").click(function() {\n                    shiftSize(1);\n                    return false;\n                });\n                \n                this.editor_$.find(\".Rk-Edit-Image-Del\").click(function() {\n                \t_this.editor_$.find(\".Rk-Edit-Image\").val('');\n                \tonFieldChange();\n                    return false;\n                });\n            } else {\n                if (typeof this.source_representation.highlighted === \"object\") {\n                    var titlehtml = this.source_representation.highlighted.replace(_(_model.get(\"title\")).escape(),'<span class=\"Rk-Highlighted\">$1</span>');\n                    this.editor_$.find(\".Rk-Display-Title\" + (_model.get(\"uri\") ? \" a\" : \"\")).html(titlehtml);\n                    if (this.options.show_node_tooltip_description) {\n                        this.editor_$.find(\".Rk-Display-Description\").html(this.source_representation.highlighted.replace(_(_model.get(\"description\")).escape(),'<span class=\"Rk-Highlighted\">$1</span>'));\n                    }\n                }\n            }\n            this.editor_$.find(\"img\").load(function() {\n                _this.redraw();\n            });\n        },\n        redraw: function() {\n            var _coords = this.source_representation.paper_coords;\n            Utils.drawEditBox(this.options, _coords, this.editor_block, this.source_representation.circle_radius * 0.75, this.editor_$);\n            this.editor_$.show();\n            paper.view.draw();\n        }\n    });\n\n    /* NodeEditor End */\n\n    return NodeEditor;\n\n});\n\n\ndefine('renderer/edgeeditor',['jquery', 'underscore', 'requtils', 'renderer/baseeditor'], function ($, _, requtils, BaseEditor) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* EdgeEditor Begin */\n\n    //var EdgeEditor = Renderer.EdgeEditor = Utils.inherit(Renderer._BaseEditor);\n    var EdgeEditor = Utils.inherit(BaseEditor);\n\n    _(EdgeEditor.prototype).extend({\n    \t_init: function() {\n    \t\tBaseEditor.prototype._init.apply(this);\n    \t\tthis.template = this.options.templates['templates/edgeeditor.html'];\n    \t\tthis.readOnlyTemplate = this.options.templates['templates/edgeeditor_readonly.html'];\n    \t},\n        draw: function() {\n            var _model = this.source_representation.model,\n            _from_model = _model.get(\"from\"),\n            _to_model = _model.get(\"to\"),\n            _created_by = _model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan),\n            _template = (this.renderer.isEditable() ? this.template : this.readOnlyTemplate);\n            this.editor_$\n            .html(_template({\n                edge: {\n                    has_creator: !!_model.get(\"created_by\"),\n                    title: _model.get(\"title\"),\n                    uri: _model.get(\"uri\"),\n                    short_uri:  Utils.shortenText((_model.get(\"uri\") || \"\").replace(/^(https?:\\/\\/)?(www\\.)?/,'').replace(/\\/$/,''),40),\n                    description: _model.get(\"description\"),\n                    color: _model.get(\"color\") || _created_by.get(\"color\"),\n                    from_title: _from_model.get(\"title\"),\n                    to_title: _to_model.get(\"title\"),\n                    from_color: _from_model.get(\"color\") || (_from_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n                    to_color: _to_model.get(\"color\") || (_to_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n                    created_by_color: _created_by.get(\"color\"),\n                    created_by_title: _created_by.get(\"title\")\n                },\n                renkan: this.renkan,\n                shortenText: Utils.shortenText,\n                options: this.options\n            }));\n            this.redraw();\n            var _this = this,\n            closeEditor = function() {\n                _this.renderer.removeRepresentation(_this);\n                paper.view.draw();\n            };\n            this.editor_$.find(\".Rk-CloseX\").click(closeEditor);\n            this.editor_$.find(\".Rk-Edit-Goto\").click(function() {\n                if (!_model.get(\"uri\")) {\n                    return false;\n                }\n            });\n\n            if (this.renderer.isEditable()) {\n\n                var onFieldChange = _(function() {\n                    _(function() {\n                        if (_this.renderer.isEditable()) {\n                            var _data = {\n                                    title: _this.editor_$.find(\".Rk-Edit-Title\").val()\n                            };\n                            if (_this.options.show_edge_editor_uri) {\n                                _data.uri = _this.editor_$.find(\".Rk-Edit-URI\").val();\n                            }\n                            _this.editor_$.find(\".Rk-Edit-Goto\").attr(\"href\",_data.uri || \"#\");\n                            _model.set(_data);\n                            paper.view.draw();\n                        } else {\n                            closeEditor();\n                        }\n                    }).defer();\n                }).throttle(500);\n\n                this.editor_$.on(\"keyup\", function(_e) {\n                    if (_e.keyCode === 27) {\n                        closeEditor();\n                    }\n                });\n\n                this.editor_$.find(\"input\").on(\"keyup change paste\", onFieldChange);\n\n                this.editor_$.find(\".Rk-Edit-Vocabulary\").change(function() {\n                    var e = $(this),\n                    v = e.val();\n                    if (v) {\n                        _this.editor_$.find(\".Rk-Edit-Title\").val(e.find(\":selected\").text());\n                        _this.editor_$.find(\".Rk-Edit-URI\").val(v);\n                        onFieldChange();\n                    }\n                });\n                this.editor_$.find(\".Rk-Edit-Direction\").click(function() {\n                    if (_this.renderer.isEditable()) {\n                        _model.set({\n                            from: _model.get(\"to\"),\n                            to: _model.get(\"from\")\n                        });\n                        _this.draw();\n                    } else {\n                        closeEditor();\n                    }\n                });\n\n                var _picker = _this.editor_$.find(\".Rk-Edit-ColorPicker\");\n\n                this.editor_$.find(\".Rk-Edit-ColorPicker-Wrapper\").hover(\n                        function(_e) {\n                            _e.preventDefault();\n                            _picker.show();\n                        },\n                        function(_e) {\n                            _e.preventDefault();\n                            _picker.hide();\n                        }\n                );\n\n                _picker.find(\"li\").hover(\n                        function(_e) {\n                            _e.preventDefault();\n                            _this.editor_$.find(\".Rk-Edit-Color\").css(\"background\", $(this).attr(\"data-color\"));\n                        },\n                        function(_e) {\n                            _e.preventDefault();\n                            _this.editor_$.find(\".Rk-Edit-Color\").css(\"background\", _model.get(\"color\") || (_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(_this.renkan)).get(\"color\"));\n                        }\n                ).click(function(_e) {\n                    _e.preventDefault();\n                    if (_this.renderer.isEditable()) {\n                        _model.set(\"color\", $(this).attr(\"data-color\"));\n                        _picker.hide();\n                        paper.view.draw();\n                    } else {\n                        closeEditor();\n                    }\n                });\n            }\n        },\n        redraw: function() {\n            var _coords = this.source_representation.paper_coords;\n            Utils.drawEditBox(this.options, _coords, this.editor_block, 5, this.editor_$);\n            this.editor_$.show();\n            paper.view.draw();\n        }\n    });\n\n    /* EdgeEditor End */\n\n    return EdgeEditor;\n\n});\n\n\ndefine('renderer/nodebutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* _NodeButton Begin */\n\n    //var _NodeButton = Renderer._NodeButton = Utils.inherit(Renderer._BaseButton);\n    var _NodeButton = Utils.inherit(BaseButton);\n\n    _(_NodeButton.prototype).extend({\n        setSectorSize: function() {\n            var sectorInner = this.source_representation.circle_radius;\n            if (sectorInner !== this.lastSectorInner) {\n                if (this.sector) {\n                    this.sector.destroy();\n                }\n                this.sector = this.renderer.drawSector(\n                        this, 1 + sectorInner,\n                        Utils._NODE_BUTTON_WIDTH + sectorInner,\n                        this.startAngle,\n                        this.endAngle,\n                        1,\n                        this.imageName,\n                        this.renkan.translate(this.text)\n                );\n                this.lastSectorInner = sectorInner;\n            }\n        },\n        unselect: function() {\n            BaseButton.prototype.unselect.apply(this, Array.prototype.slice.call(arguments, 1));\n            if(this.source_representation && this.source_representation.buttons_timeout) {\n                clearTimeout(this.source_representation.buttons_timeout);\n                this.source_representation.hideButtons();\n            }\n        },\n        select: function() {\n            if(this.source_representation && this.source_representation.buttons_timeout) {\n                clearTimeout(this.source_representation.buttons_timeout);\n            }\n            this.sector.select();\n        },\n    });\n\n    /* _NodeButton End */\n\n    return _NodeButton;\n\n});\n\n\ndefine('renderer/nodeeditbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* NodeEditButton Begin */\n\n    //var NodeEditButton = Renderer.NodeEditButton = Utils.inherit(Renderer._NodeButton);\n    var NodeEditButton = Utils.inherit(NodeButton);\n\n    _(NodeEditButton.prototype).extend({\n        _init: function() {\n            this.type = \"Node-edit-button\";\n            this.lastSectorInner = 0;\n            this.startAngle = -135;\n            this.endAngle = -45;\n            this.imageName = \"edit\";\n            this.text = \"Edit\";\n        },\n        mouseup: function() {\n            if (!this.renderer.is_dragging) {\n                this.source_representation.openEditor();\n            }\n        }\n    });\n\n    /* NodeEditButton End */\n\n    return NodeEditButton;\n\n});\n\n\ndefine('renderer/noderemovebutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n    \n    \n    var Utils = requtils.getUtils();\n\n    /* NodeRemoveButton Begin */\n\n    //var NodeRemoveButton = Renderer.NodeRemoveButton = Utils.inherit(Renderer._NodeButton);\n    var NodeRemoveButton = Utils.inherit(NodeButton);\n\n    _(NodeRemoveButton.prototype).extend({\n        _init: function() {\n            this.type = \"Node-remove-button\";\n            this.lastSectorInner = 0;\n            this.startAngle = 0;\n            this.endAngle = 90;\n            this.imageName = \"remove\";\n            this.text = \"Remove\";\n        },\n        mouseup: function() {\n            this.renderer.click_target = null;\n            this.renderer.is_dragging = false;\n            this.renderer.removeRepresentationsOfType(\"editor\");\n            if (this.renderer.isEditable()) {\n                if (this.options.element_delete_delay) {\n                    var delid = Utils.getUID(\"delete\");\n                    this.renderer.delete_list.push({\n                        id: delid,\n                        time: new Date().valueOf() + this.options.element_delete_delay\n                    });\n                    this.source_representation.model.set(\"delete_scheduled\", delid);\n                } else {\n                    if (confirm(this.renkan.translate('Do you really wish to remove node ') + '\"' + this.source_representation.model.get(\"title\") + '\"?')) {\n                        this.project.removeNode(this.source_representation.model);\n                    }\n                }\n            }\n        }\n    });\n\n    /* NodeRemoveButton End */\n\n    return NodeRemoveButton;\n\n});\n\n\ndefine('renderer/noderevertbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* NodeRevertButton Begin */\n\n    //var NodeRevertButton = Renderer.NodeRevertButton = Utils.inherit(Renderer._NodeButton);\n    var NodeRevertButton = Utils.inherit(NodeButton);\n\n    _(NodeRevertButton.prototype).extend({\n        _init: function() {\n            this.type = \"Node-revert-button\";\n            this.lastSectorInner = 0;\n            this.startAngle = -135;\n            this.endAngle = 135;\n            this.imageName = \"revert\";\n            this.text = \"Cancel deletion\";\n        },\n        mouseup: function() {\n            this.renderer.click_target = null;\n            this.renderer.is_dragging = false;\n            if (this.renderer.isEditable()) {\n                this.source_representation.model.unset(\"delete_scheduled\");\n            }\n        }\n    });\n\n    /* NodeRevertButton End */\n\n    return NodeRevertButton;\n\n});\n\n\ndefine('renderer/nodelinkbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* NodeLinkButton Begin */\n\n    //var NodeLinkButton = Renderer.NodeLinkButton = Utils.inherit(Renderer._NodeButton);\n    var NodeLinkButton = Utils.inherit(NodeButton);\n\n    _(NodeLinkButton.prototype).extend({\n        _init: function() {\n            this.type = \"Node-link-button\";\n            this.lastSectorInner = 0;\n            this.startAngle = 90;\n            this.endAngle = 180;\n            this.imageName = \"link\";\n            this.text = \"Link to another node\";\n        },\n        mousedown: function(_event, _isTouch) {\n            if (this.renderer.isEditable()) {\n                var _off = this.renderer.canvas_$.offset(),\n                _point = new paper.Point([\n                                          _event.pageX - _off.left,\n                                          _event.pageY - _off.top\n                                          ]);\n                this.renderer.click_target = null;\n                this.renderer.removeRepresentationsOfType(\"editor\");\n                this.renderer.addTempEdge(this.source_representation, _point);\n            }\n        }\n    });\n\n    /* NodeLinkButton End */\n\n    return NodeLinkButton;\n\n});\n\n\n\ndefine('renderer/nodeenlargebutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n    \n    \n    var Utils = requtils.getUtils();\n\n    /* NodeEnlargeButton Begin */\n\n    //var NodeEnlargeButton = Renderer.NodeEnlargeButton = Utils.inherit(Renderer._NodeButton);\n    var NodeEnlargeButton = Utils.inherit(NodeButton);\n\n    _(NodeEnlargeButton.prototype).extend({\n        _init: function() {\n            this.type = \"Node-enlarge-button\";\n            this.lastSectorInner = 0;\n            this.startAngle = -45;\n            this.endAngle = 0;\n            this.imageName = \"enlarge\";\n            this.text = \"Enlarge\";\n        },\n        mouseup: function() {\n            var _newsize = 1 + (this.source_representation.model.get(\"size\") || 0);\n            this.source_representation.model.set(\"size\", _newsize);\n            this.source_representation.select();\n            this.select();\n            paper.view.draw();\n        }\n    });\n\n    /* NodeEnlargeButton End */\n\n    return NodeEnlargeButton;\n\n});\n\n\ndefine('renderer/nodeshrinkbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* NodeShrinkButton Begin */\n\n    //var NodeShrinkButton = Renderer.NodeShrinkButton = Utils.inherit(Renderer._NodeButton);\n    var NodeShrinkButton = Utils.inherit(NodeButton);\n\n    _(NodeShrinkButton.prototype).extend({\n        _init: function() {\n            this.type = \"Node-shrink-button\";\n            this.lastSectorInner = 0;\n            this.startAngle = -180;\n            this.endAngle = -135;\n            this.imageName = \"shrink\";\n            this.text = \"Shrink\";\n        },\n        mouseup: function() {\n            var _newsize = -1 + (this.source_representation.model.get(\"size\") || 0);\n            this.source_representation.model.set(\"size\", _newsize);\n            this.source_representation.select();\n            this.select();\n            paper.view.draw();\n        }\n    });\n\n    /* NodeShrinkButton End */\n\n    return NodeShrinkButton;\n\n});\n\n\ndefine('renderer/edgeeditbutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* EdgeEditButton Begin */\n\n    //var EdgeEditButton = Renderer.EdgeEditButton = Utils.inherit(Renderer._BaseButton);\n    var EdgeEditButton = Utils.inherit(BaseButton);\n\n    _(EdgeEditButton.prototype).extend({\n        _init: function() {\n            this.type = \"Edge-edit-button\";\n            this.sector = this.renderer.drawSector(this, Utils._EDGE_BUTTON_INNER, Utils._EDGE_BUTTON_OUTER, -270, -90, 1, \"edit\", this.renkan.translate(\"Edit\"));\n        },\n        mouseup: function() {\n            if (!this.renderer.is_dragging) {\n                this.source_representation.openEditor();\n            }\n        }\n    });\n\n    /* EdgeEditButton End */\n\n    return EdgeEditButton;\n\n});\n\n\ndefine('renderer/edgeremovebutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* EdgeRemoveButton Begin */\n\n    //var EdgeRemoveButton = Renderer.EdgeRemoveButton = Utils.inherit(Renderer._BaseButton);\n    var EdgeRemoveButton = Utils.inherit(BaseButton);\n\n    _(EdgeRemoveButton.prototype).extend({\n        _init: function() {\n            this.type = \"Edge-remove-button\";\n            this.sector = this.renderer.drawSector(this, Utils._EDGE_BUTTON_INNER, Utils._EDGE_BUTTON_OUTER, -90, 90, 1, \"remove\", this.renkan.translate(\"Remove\"));\n        },\n        mouseup: function() {\n            this.renderer.click_target = null;\n            this.renderer.is_dragging = false;\n            this.renderer.removeRepresentationsOfType(\"editor\");\n            if (this.renderer.isEditable()) {\n                if (this.options.element_delete_delay) {\n                    var delid = Utils.getUID(\"delete\");\n                    this.renderer.delete_list.push({\n                        id: delid,\n                        time: new Date().valueOf() + this.options.element_delete_delay\n                    });\n                    this.source_representation.model.set(\"delete_scheduled\", delid);\n                } else {\n                    if (confirm(this.renkan.translate('Do you really wish to remove edge ') + '\"' + this.source_representation.model.get(\"title\") + '\"?')) {\n                        this.project.removeEdge(this.source_representation.model);\n                    }\n                }\n            }\n        }\n    });\n\n    /* EdgeRemoveButton End */\n\n    return EdgeRemoveButton;\n\n});\n\n\ndefine('renderer/edgerevertbutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* EdgeRevertButton Begin */\n\n    //var EdgeRevertButton = Renderer.EdgeRevertButton = Utils.inherit(Renderer._BaseButton);\n    var EdgeRevertButton = Utils.inherit(BaseButton);\n\n    _(EdgeRevertButton.prototype).extend({\n        _init: function() {\n            this.type = \"Edge-revert-button\";\n            this.sector = this.renderer.drawSector(this, Utils._EDGE_BUTTON_INNER, Utils._EDGE_BUTTON_OUTER, -135, 135, 1, \"revert\", this.renkan.translate(\"Cancel deletion\"));\n        },\n        mouseup: function() {\n            this.renderer.click_target = null;\n            this.renderer.is_dragging = false;\n            if (this.renderer.isEditable()) {\n                this.source_representation.model.unset(\"delete_scheduled\");\n            }\n        }\n    });\n\n    /* EdgeRevertButton End */\n\n    return EdgeRevertButton;\n\n});\n\n\ndefine('renderer/miniframe',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* MiniFrame Begin */\n\n    //var MiniFrame = Renderer.MiniFrame = Utils.inherit(Renderer._BaseRepresentation);\n    var MiniFrame = Utils.inherit(BaseRepresentation);\n\n    _(MiniFrame.prototype).extend({\n        paperShift: function(_delta) {\n            this.renderer.offset = this.renderer.offset.subtract(_delta.divide(this.renderer.minimap.scale).multiply(this.renderer.scale));\n            this.renderer.redraw();\n        },\n        mouseup: function(_delta) {\n            this.renderer.click_target = null;\n            this.renderer.is_dragging = false;\n        }\n    });\n\n    /* MiniFrame End */\n\n    return MiniFrame;\n\n});\n\n\ndefine('renderer/scene',['jquery', 'underscore', 'filesaver', 'requtils', 'renderer/miniframe'], function ($, _, filesaver, requtils, MiniFrame) {\n    \n\n    var Utils = requtils.getUtils();\n\n    /* Scene Begin */\n\n    var Scene = function(_renkan) {\n        this.renkan = _renkan;\n        this.$ = $(\".Rk-Render\");\n        this.representations = [];\n        this.$.html(_renkan.options.templates['templates/scene.html'](_renkan));\n        this.onStatusChange();\n        this.canvas_$ = this.$.find(\".Rk-Canvas\");\n        this.labels_$ = this.$.find(\".Rk-Labels\");\n        this.editor_$ = this.$.find(\".Rk-Editor\");\n        this.notif_$ = this.$.find(\".Rk-Notifications\");\n        paper.setup(this.canvas_$[0]);\n        this.scale = 1;\n        this.initialScale = 1;\n        this.offset = paper.view.center;\n        this.totalScroll = 0;\n        this.mouse_down = false;\n        this.click_target = null;\n        this.selected_target = null;\n        this.edge_layer = new paper.Layer();\n        this.node_layer = new paper.Layer();\n        this.buttons_layer = new paper.Layer();\n        this.delete_list = [];\n        this.redrawActive = true;\n        \n        if (_renkan.options.show_minimap) {\n            this.minimap = {\n                    background_layer: new paper.Layer(),\n                    edge_layer: new paper.Layer(),\n                    node_layer: new paper.Layer(),\n                    node_group: new paper.Group(),\n                    size: new paper.Size( _renkan.options.minimap_width, _renkan.options.minimap_height )\n            };\n\n            this.minimap.background_layer.activate();\n            this.minimap.topleft = paper.view.bounds.bottomRight.subtract(this.minimap.size);\n            this.minimap.rectangle = new paper.Path.Rectangle(this.minimap.topleft.subtract([2,2]), this.minimap.size.add([4,4]));\n            this.minimap.rectangle.fillColor = _renkan.options.minimap_background_color;\n            this.minimap.rectangle.strokeColor = _renkan.options.minimap_border_color;\n            this.minimap.rectangle.strokeWidth = 4;\n            this.minimap.offset = new paper.Point(this.minimap.size.divide(2));\n            this.minimap.scale = 0.1;\n\n            this.minimap.node_layer.activate();\n            this.minimap.cliprectangle = new paper.Path.Rectangle(this.minimap.topleft, this.minimap.size);\n            this.minimap.node_group.addChild(this.minimap.cliprectangle);\n            this.minimap.node_group.clipped = true;\n            this.minimap.miniframe = new paper.Path.Rectangle(this.minimap.topleft, this.minimap.size);\n            this.minimap.node_group.addChild(this.minimap.miniframe);\n            this.minimap.miniframe.fillColor = '#c0c0ff';\n            this.minimap.miniframe.opacity = 0.3;\n            this.minimap.miniframe.strokeColor = '#000080';\n            this.minimap.miniframe.strokeWidth = 2;\n            this.minimap.miniframe.__representation = new MiniFrame(this, null);\n        }\n\n        this.throttledPaperDraw = _(function() {\n            paper.view.draw();\n        }).throttle(100);\n\n        this.bundles = [];\n        this.click_mode = false;\n\n        var _this = this,\n        _allowScroll = true,\n        _originalScale = 1,\n        _zooming = false,\n        _lastTapX = 0,\n        _lastTapY = 0;\n\n        this.image_cache = {};\n        this.icon_cache = {};\n\n        ['edit', 'remove', 'link', 'enlarge', 'shrink', 'revert' ].forEach(function(imgname) {\n            var img = new Image();\n            img.src = _renkan.options.static_url + 'img/' + imgname + '.png';\n            _this.icon_cache[imgname] = img;\n        });\n\n        var throttledMouseMove = _.throttle(function(_event, _isTouch) {\n            _this.onMouseMove(_event, _isTouch);\n        }, Utils._MOUSEMOVE_RATE);\n\n        this.canvas_$.on({\n            mousedown: function(_event) {\n                _event.preventDefault();\n                _this.onMouseDown(_event, false);\n            },\n            mousemove: function(_event) {\n                _event.preventDefault();\n                throttledMouseMove(_event, false);\n            },\n            mouseup: function(_event) {\n                _event.preventDefault();\n                _this.onMouseUp(_event, false);\n            },\n            mousewheel: function(_event, _delta) {\n                if(_renkan.options.zoom_on_scroll) {\n                    _event.preventDefault();\n                    if (_allowScroll) {\n                        _this.onScroll(_event, _delta);\n                    }\n                }\n            },\n            touchstart: function(_event) {\n                _event.preventDefault();\n                var _touches = _event.originalEvent.touches[0];\n                if (\n                        _renkan.options.allow_double_click &&\n                        new Date() - _lastTap < Utils._DOUBLETAP_DELAY &&\n                        ( Math.pow(_lastTapX - _touches.pageX, 2) + Math.pow(_lastTapY - _touches.pageY, 2) < Utils._DOUBLETAP_DISTANCE )\n                ) {\n                    _lastTap = 0;\n                    _this.onDoubleClick(_touches);\n                } else {\n                    _lastTap = new Date();\n                    _lastTapX = _touches.pageX;\n                    _lastTapY = _touches.pageY;\n                    _originalScale = _this.scale;\n                    _zooming = false;\n                    _this.onMouseDown(_touches, true);\n                }\n            },\n            touchmove: function(_event) {\n                _event.preventDefault();\n                _lastTap = 0;\n                if (_event.originalEvent.touches.length === 1) {\n                    _this.onMouseMove(_event.originalEvent.touches[0], true);\n                } else {\n                    if (!_zooming) {\n                        _this.onMouseUp(_event.originalEvent.touches[0], true);\n                        _this.click_target = null;\n                        _this.is_dragging = false;\n                        _zooming = true;\n                    }\n                    if (_event.originalEvent.scale === \"undefined\") {\n                        return;\n                    }\n                    var _newScale = _event.originalEvent.scale * _originalScale,\n                    _scaleRatio = _newScale / _this.scale,\n                    _newOffset = new paper.Point([\n                                                  _this.canvas_$.width(),\n                                                  _this.canvas_$.height()\n                                                  ]).multiply( 0.5 * ( 1 - _scaleRatio ) ).add(_this.offset.multiply( _scaleRatio ));\n                    _this.setScale(_newScale, _newOffset);\n                }\n            },\n            touchend: function(_event) {\n                _event.preventDefault();\n                _this.onMouseUp(_event.originalEvent.changedTouches[0], true);\n            },\n            dblclick: function(_event) {\n                _event.preventDefault();\n                if (_renkan.options.allow_double_click) {\n                    _this.onDoubleClick(_event);\n                }\n            },\n            mouseleave: function(_event) {\n                _event.preventDefault();\n                _this.onMouseUp(_event, false);\n                _this.click_target = null;\n                _this.is_dragging = false;\n            },\n            dragover: function(_event) {\n                _event.preventDefault();\n            },\n            dragenter: function(_event) {\n                _event.preventDefault();\n                _allowScroll = false;\n            },\n            dragleave: function(_event) {\n                _event.preventDefault();\n                _allowScroll = true;\n            },\n            drop: function(_event) {\n                _event.preventDefault();\n                _allowScroll = true;\n                var res = {};\n                _(_event.originalEvent.dataTransfer.types).each(function(t) {\n                    try {\n                        res[t] = _event.originalEvent.dataTransfer.getData(t);\n                    } catch(e) {}\n                });\n                var text = _event.originalEvent.dataTransfer.getData(\"Text\");\n                if (typeof text === \"string\") {\n                    switch(text[0]) {\n                    case \"{\":\n                    case \"[\":\n                        try {\n                            var data = JSON.parse(text);\n                            _(res).extend(data);\n                        }\n                        catch(e) {\n                            if (!res[\"text/plain\"]) {\n                                res[\"text/plain\"] = text;\n                            }\n                        }\n                        break;\n                    case \"<\":\n                        if (!res[\"text/html\"]) {\n                            res[\"text/html\"] = text;\n                        }\n                        break;\n                    default:\n                        if (!res[\"text/plain\"]) {\n                            res[\"text/plain\"] = text;\n                        }\n                    }\n                }\n                var url = _event.originalEvent.dataTransfer.getData(\"URL\");\n                if (url && !res[\"text/uri-list\"]) {\n                    res[\"text/uri-list\"] = url;\n                }\n                _this.dropData(res, _event.originalEvent);\n            }\n        });\n\n        var bindClick = function(selector, fname) {\n            _this.$.find(selector).click(function(evt) {\n                _this[fname](evt);\n                return false;\n            });\n        };\n\n        bindClick(\".Rk-ZoomOut\", \"zoomOut\");\n        bindClick(\".Rk-ZoomIn\", \"zoomIn\");\n        bindClick(\".Rk-ZoomFit\", \"autoScale\");\n        this.$.find(\".Rk-ZoomSave\").click( function() {\n            // Save scale and offset point\n            _this.renkan.project.addView( { zoom_level:_this.scale, offset:_this.offset } );\n        });\n        this.$.find(\".Rk-ZoomSetSaved\").click( function() {\n            var view = _this.renkan.project.get(\"views\").last();\n            if(view){\n                _this.setScale(view.get(\"zoom_level\"), new paper.Point(view.get(\"offset\")));\n            }\n        });\n        if(this.renkan.project.get(\"views\").length > 0 && this.renkan.options.save_view){\n            this.$.find(\".Rk-ZoomSetSaved\").show();\n        }\n        this.$.find(\".Rk-CurrentUser\").mouseenter(\n                function() { _this.$.find(\".Rk-UserList\").slideDown(); }\n        );\n        this.$.find(\".Rk-Users\").mouseleave(\n                function() { _this.$.find(\".Rk-UserList\").slideUp(); }\n        );\n        bindClick(\".Rk-FullScreen-Button\", \"fullScreen\");\n        bindClick(\".Rk-AddNode-Button\", \"addNodeBtn\");\n        bindClick(\".Rk-AddEdge-Button\", \"addEdgeBtn\");\n        bindClick(\".Rk-Save-Button\", \"save\");\n        bindClick(\".Rk-Open-Button\", \"open\");\n        bindClick(\".Rk-Export-Button\", \"exportProject\");\n        this.$.find(\".Rk-Bookmarklet-Button\")\n          /*jshint scripturl:true */\n          .attr(\"href\",\"javascript:\" + Utils._BOOKMARKLET_CODE(_renkan))\n          .click(function(){\n              _this.notif_$\n              .text(_renkan.translate(\"Drag this button to your bookmark bar. When on a third-party website, click it to enable drag-and-drop from the website to Renkan.\"))\n              .fadeIn()\n              .delay(5000)\n              .fadeOut();\n              return false;\n          });\n        this.$.find(\".Rk-TopBar-Button\").mouseover(function() {\n            $(this).find(\".Rk-TopBar-Tooltip\").show();\n        }).mouseout(function() {\n            $(this).find(\".Rk-TopBar-Tooltip\").hide();\n        });\n        bindClick(\".Rk-Fold-Bins\", \"foldBins\");\n\n        paper.view.onResize = function(_event) {\n            var _ratio,\n                newWidth = _event.width,\n                newHeight = _event.height;\n\n            if (_this.minimap) {\n                _this.minimap.topleft = paper.view.bounds.bottomRight.subtract(_this.minimap.size);\n                _this.minimap.rectangle.fitBounds(_this.minimap.topleft.subtract([2,2]), _this.minimap.size.add([4,4]));\n                _this.minimap.cliprectangle.fitBounds(_this.minimap.topleft, _this.minimap.size);\n            }\n\n            var ratioH = newHeight/(newHeight-_event.delta.height),\n                ratioW = newWidth/(newWidth-_event.delta.width);\n            if (newHeight < newWidth) {\n                    _ratio = ratioH;\n            } else {\n                _ratio = ratioW;\n            }\n\n            _this.resizeZoom(ratioW, ratioH, _ratio);\n\n            _this.redraw();\n\n        };\n\n        var _thRedraw = _.throttle(function() {\n            _this.redraw();\n        },50);\n\n        this.addRepresentations(\"Node\", this.renkan.project.get(\"nodes\"));\n        this.addRepresentations(\"Edge\", this.renkan.project.get(\"edges\"));\n        this.renkan.project.on(\"change:title\", function() {\n            _this.$.find(\".Rk-PadTitle\").val(_renkan.project.get(\"title\"));\n        });\n\n        this.$.find(\".Rk-PadTitle\").on(\"keyup input paste\", function() {\n            _renkan.project.set({\"title\": $(this).val()});\n        });\n\n        var _thRedrawUsers = _.throttle(function() {\n            _this.redrawUsers();\n        }, 100);\n\n        _thRedrawUsers();\n\n        // register model events\n        this.renkan.project.on(\"change:save_status\", function(){\n            switch (_this.renkan.project.get(\"save_status\")) {\n                case 0: //clean\n                    _this.$.find(\".Rk-Save-Button\").removeClass(\"to-save\");\n                    _this.$.find(\".Rk-Save-Button\").removeClass(\"saving\");\n                    _this.$.find(\".Rk-Save-Button\").addClass(\"saved\");\n                    break;\n                case 1: //dirty\n                    _this.$.find(\".Rk-Save-Button\").removeClass(\"saved\");\n                    _this.$.find(\".Rk-Save-Button\").removeClass(\"saving\");\n                    _this.$.find(\".Rk-Save-Button\").addClass(\"to-save\");\n                    break;\n                case 2: //saving\n                    _this.$.find(\".Rk-Save-Button\").removeClass(\"saved\");\n                    _this.$.find(\".Rk-Save-Button\").removeClass(\"to-save\");\n                    _this.$.find(\".Rk-Save-Button\").addClass(\"saving\");\n                    break;\n            }\n        });\n\n        this.renkan.project.on(\"change:loading_status\", function(){\n            if (_this.renkan.project.get(\"loading_status\")){\n                var animate = _this.$.find(\".loader\").addClass(\"run\");\n                var timer = setTimeout(function(){\n                    _this.$.find(\".loader\").hide(250);\n                }, 3000);\n            }\n        });\n\n        this.renkan.project.on(\"add:users remove:users\", _thRedrawUsers);\n\n        this.renkan.project.on(\"add:views remove:views\", function(_node) {\n            if(_this.renkan.project.get('views').length > 0) {\n                _this.$.find(\".Rk-ZoomSetSaved\").show();\n            }\n            else {\n                _this.$.find(\".Rk-ZoomSetSaved\").hide();\n            }\n        });\n\n        this.renkan.project.on(\"add:nodes\", function(_node) {\n            _this.addRepresentation(\"Node\", _node);\n            if (!_this.renkan.project.get(\"loading_status\")){\n                _thRedraw();\n            }\n        });\n        this.renkan.project.on(\"add:edges\", function(_edge) {\n            _this.addRepresentation(\"Edge\", _edge);\n            if (!_this.renkan.project.get(\"loading_status\")){\n                _thRedraw();\n            }\n        });\n        this.renkan.project.on(\"change:title\", function(_model, _title) {\n            var el = _this.$.find(\".Rk-PadTitle\");\n            if (el.is(\"input\")) {\n                if (el.val() !== _title) {\n                    el.val(_title);\n                }\n            } else {\n                el.text(_title);\n            }\n        });\n\n        if (_renkan.options.size_bug_fix) {\n            var _delay = (\n                    typeof _renkan.options.size_bug_fix === \"number\" ?\n                        _renkan.options.size_bug_fix\n                                : 500\n            );\n            window.setTimeout(\n                    function() {\n                        _this.fixSize();\n                    },\n                    _delay\n            );\n        }\n\n        if (_renkan.options.force_resize) {\n            $(window).resize(function() {\n                _this.autoScale();\n            });\n        }\n\n        if (_renkan.options.show_user_list && _renkan.options.user_color_editable) {\n            var $cpwrapper = this.$.find(\".Rk-Users .Rk-Edit-ColorPicker-Wrapper\"),\n            $cplist = this.$.find(\".Rk-Users .Rk-Edit-ColorPicker\");\n\n            $cpwrapper.hover(\n                    function(_e) {\n                        if (_this.isEditable()) {\n                            _e.preventDefault();\n                            $cplist.show();\n                        }\n                    },\n                    function(_e) {\n                        _e.preventDefault();\n                        $cplist.hide();\n                    }\n            );\n\n            $cplist.find(\"li\").mouseenter(\n                    function(_e) {\n                        if (_this.isEditable()) {\n                            _e.preventDefault();\n                            _this.$.find(\".Rk-CurrentUser-Color\").css(\"background\", $(this).attr(\"data-color\"));\n                        }\n                    }\n            );\n        }\n\n        if (_renkan.options.show_search_field) {\n\n            var lastval = '';\n\n            this.$.find(\".Rk-GraphSearch-Field\").on(\"keyup change paste input\", function() {\n                var $this = $(this),\n                val = $this.val();\n                if (val === lastval) {\n                    return;\n                }\n                lastval = val;\n                if (val.length < 2) {\n                    _renkan.project.get(\"nodes\").each(function(n) {\n                        _this.getRepresentationByModel(n).unhighlight();\n                    });\n                } else {\n                    var rxs = Utils.regexpFromTextOrArray(val);\n                    _renkan.project.get(\"nodes\").each(function(n) {\n                        if (rxs.test(n.get(\"title\")) || rxs.test(n.get(\"description\"))) {\n                            _this.getRepresentationByModel(n).highlight(rxs);\n                        } else {\n                            _this.getRepresentationByModel(n).unhighlight();\n                        }\n                    });\n                }\n            });\n        }\n\n        this.redraw();\n\n        window.setInterval(function() {\n            var _now = new Date().valueOf();\n            _this.delete_list.forEach(function(d) {\n                if (_now >= d.time) {\n                    var el = _renkan.project.get(\"nodes\").findWhere({\"delete_scheduled\":d.id});\n                    if (el) {\n                        project.removeNode(el);\n                    }\n                    el = _renkan.project.get(\"edges\").findWhere({\"delete_scheduled\":d.id});\n                    if (el) {\n                        project.removeEdge(el);\n                    }\n                }\n            });\n            _this.delete_list = _this.delete_list.filter(function(d) {\n                return _renkan.project.get(\"nodes\").findWhere({\"delete_scheduled\":d.id}) || _renkan.project.get(\"edges\").findWhere({\"delete_scheduled\":d.id});\n            });\n        }, 500);\n\n        if (this.minimap) {\n            window.setInterval(function() {\n                _this.rescaleMinimap();\n            }, 2000);\n        }\n\n    };\n\n    _(Scene.prototype).extend({\n        fixSize: function() {\n            if( this.renkan.options.default_view && this.renkan.project.get(\"views\").length > 0) {\n                var view = this.renkan.project.get(\"views\").last();\n                this.setScale(view.get(\"zoom_level\"), new paper.Point(view.get(\"offset\")));\n            }\n            else{\n                this.autoScale();\n            }\n        },\n        drawSector: function(_repr, _inR, _outR, _startAngle, _endAngle, _padding, _imgname, _caption) {\n            var _options = this.renkan.options,\n                _startRads = _startAngle * Math.PI / 180,\n                _endRads = _endAngle * Math.PI / 180,\n                _img = this.icon_cache[_imgname],\n                _startdx = - Math.sin(_startRads),\n                _startdy = Math.cos(_startRads),\n                _startXIn = Math.cos(_startRads) * _inR + _padding * _startdx,\n                _startYIn = Math.sin(_startRads) * _inR + _padding * _startdy,\n                _startXOut = Math.cos(_startRads) * _outR + _padding * _startdx,\n                _startYOut = Math.sin(_startRads) * _outR + _padding * _startdy,\n                _enddx = - Math.sin(_endRads),\n                _enddy = Math.cos(_endRads),\n                _endXIn = Math.cos(_endRads) * _inR - _padding * _enddx,\n                _endYIn = Math.sin(_endRads) * _inR - _padding * _enddy,\n                _endXOut = Math.cos(_endRads) * _outR - _padding * _enddx,\n                _endYOut = Math.sin(_endRads) * _outR - _padding * _enddy,\n                _centerR = (_inR + _outR) / 2,\n                _centerRads = (_startRads + _endRads) / 2,\n                _centerX = Math.cos(_centerRads) * _centerR,\n                _centerY = Math.sin(_centerRads) * _centerR,\n                _centerXIn = Math.cos(_centerRads) * _inR,\n                _centerXOut = Math.cos(_centerRads) * _outR,\n                _centerYIn = Math.sin(_centerRads) * _inR,\n                _centerYOut = Math.sin(_centerRads) * _outR,\n                _textX = Math.cos(_centerRads) * (_outR + 3),\n                _textY = Math.sin(_centerRads) * (_outR + _options.buttons_label_font_size) + _options.buttons_label_font_size / 2;\n            this.buttons_layer.activate();\n            var _path = new paper.Path();\n            _path.add([_startXIn, _startYIn]);\n            _path.arcTo([_centerXIn, _centerYIn], [_endXIn, _endYIn]);\n            _path.lineTo([_endXOut,  _endYOut]);\n            _path.arcTo([_centerXOut, _centerYOut], [_startXOut, _startYOut]);\n            _path.fillColor = _options.buttons_background;\n            _path.opacity = 0.5;\n            _path.closed = true;\n            _path.__representation = _repr;\n            var _text = new paper.PointText(_textX,_textY);\n            _text.characterStyle = {\n                    fontSize: _options.buttons_label_font_size,\n                    fillColor: _options.buttons_label_color\n            };\n            if (_textX > 2) {\n                _text.paragraphStyle.justification = 'left';\n            } else if (_textX < -2) {\n                _text.paragraphStyle.justification = 'right';\n            } else {\n                _text.paragraphStyle.justification = 'center';\n            }\n            _text.visible = false;\n            var _visible = false,\n                _restPos = new paper.Point(-200, -200),\n                _grp = new paper.Group([_path, _text]),\n                //_grp = new paper.Group([_path]),\n                _delta = _grp.position,\n                _imgdelta = new paper.Point([_centerX, _centerY]),\n                _currentPos = new paper.Point(0,0);\n            _text.content = _caption;\n            // set group pivot to not depend on text visibility that changes the group bounding box.\n            _grp.pivot = _grp.bounds.center;\n            _grp.visible = false;\n            _grp.position = _restPos;\n            var _res = {\n                    show: function() {\n                        _visible = true;\n                        _grp.position = _currentPos.add(_delta);\n                        _grp.visible = true;\n                    },\n                    moveTo: function(_point) {\n                        _currentPos = _point;\n                        if (_visible) {\n                            _grp.position = _point.add(_delta);\n                        }\n                    },\n                    hide: function() {\n                        _visible = false;\n                        _grp.visible = false;\n                        _grp.position = _restPos;\n                    },\n                    select: function() {\n                        _path.opacity = 0.8;\n                        _text.visible = true;\n                    },\n                    unselect: function() {\n                        _path.opacity = 0.5;\n                        _text.visible = false;\n                    },\n                    destroy: function() {\n                        _grp.remove();\n                    }\n            };\n            var showImage = function() {\n                var _raster = new paper.Raster(_img);\n                _raster.position = _imgdelta.add(_grp.position).subtract(_delta);\n                _raster.locked = true; // Disable mouse events on icon\n                _grp.addChild(_raster);\n            };\n            if (_img.width) {\n                showImage();\n            } else {\n                $(_img).on(\"load\",showImage);\n            }\n\n            return _res;\n        },\n        addToBundles: function(_edgeRepr) {\n            var _bundle = _(this.bundles).find(function(_bundle) {\n                return (\n                        ( _bundle.from === _edgeRepr.from_representation && _bundle.to === _edgeRepr.to_representation ) ||\n                        ( _bundle.from === _edgeRepr.to_representation && _bundle.to === _edgeRepr.from_representation )\n                );\n            });\n            if (typeof _bundle !== \"undefined\") {\n                _bundle.edges.push(_edgeRepr);\n            } else {\n                _bundle = {\n                        from: _edgeRepr.from_representation,\n                        to: _edgeRepr.to_representation,\n                        edges: [ _edgeRepr ],\n                        getPosition: function(_er) {\n                            var _dir = (_er.from_representation === this.from) ? 1 : -1;\n                            return _dir * ( _(this.edges).indexOf(_er) - (this.edges.length - 1) / 2 );\n                        }\n                };\n                this.bundles.push(_bundle);\n            }\n            return _bundle;\n        },\n        isEditable: function() {\n            return (this.renkan.options.editor_mode && !this.renkan.read_only);\n        },\n        onStatusChange: function() {\n            var savebtn = this.$.find(\".Rk-Save-Button\"),\n            tip = savebtn.find(\".Rk-TopBar-Tooltip-Contents\");\n            if (this.renkan.read_only) {\n                savebtn.removeClass(\"disabled Rk-Save-Online\").addClass(\"Rk-Save-ReadOnly\");\n                tip.text(this.renkan.translate(\"Connection lost\"));\n            } else {\n                if (this.renkan.options.manual_save) {\n                    savebtn.removeClass(\"Rk-Save-ReadOnly Rk-Save-Online\");\n                    tip.text(this.renkan.translate(\"Save Project\"));\n                } else {\n                    savebtn.removeClass(\"disabled Rk-Save-ReadOnly\").addClass(\"Rk-Save-Online\");\n                    tip.text(this.renkan.translate(\"Auto-save enabled\"));\n                }\n            }\n            this.redrawUsers();\n        },\n        setScale: function(_newScale, _offset) {\n            if ((_newScale/this.initialScale) > Utils._MIN_SCALE && (_newScale/this.initialScale) < Utils._MAX_SCALE) {\n                this.scale = _newScale;\n                if (_offset) {\n                    this.offset = _offset;\n                }\n                this.redraw();\n            }\n        },\n        autoScale: function(force_view) {\n            var nodes = this.renkan.project.get(\"nodes\");\n            if (nodes.length > 1) {\n                var _xx = nodes.map(function(_node) { return _node.get(\"position\").x; }),\n                _yy = nodes.map(function(_node) { return _node.get(\"position\").y; }),\n                _minx = Math.min.apply(Math, _xx),\n                _miny = Math.min.apply(Math, _yy),\n                _maxx = Math.max.apply(Math, _xx),\n                _maxy = Math.max.apply(Math, _yy);\n                var _scale = Math.min( (paper.view.size.width - 2 * this.renkan.options.autoscale_padding) / (_maxx - _minx), (paper.view.size.height - 2 * this.renkan.options.autoscale_padding) / (_maxy - _miny));\n                this.initialScale = _scale;\n                // Override calculated scale if asked\n                if((typeof force_view !== \"undefined\") && parseFloat(force_view.zoom_level)>0 && parseFloat(force_view.offset.x)>0 && parseFloat(force_view.offset.y)>0){\n                    this.setScale(parseFloat(force_view.zoom_level), new paper.Point(parseFloat(force_view.offset.x), parseFloat(force_view.offset.y)));\n                }\n                else{\n                    this.setScale(_scale, paper.view.center.subtract(new paper.Point([(_maxx + _minx) / 2, (_maxy + _miny) / 2]).multiply(_scale)));\n                }\n            }\n            if (nodes.length === 1) {\n                this.setScale(1, paper.view.center.subtract(new paper.Point([nodes.at(0).get(\"position\").x, nodes.at(0).get(\"position\").y])));\n            }\n        },\n        redrawMiniframe: function() {\n            var topleft = this.toMinimapCoords(this.toModelCoords(new paper.Point([0,0]))),\n                bottomright = this.toMinimapCoords(this.toModelCoords(paper.view.bounds.bottomRight));\n            this.minimap.miniframe.fitBounds(topleft, bottomright);\n        },\n        rescaleMinimap: function() {\n            var nodes = this.renkan.project.get(\"nodes\");\n            if (nodes.length > 1) {\n                var _xx = nodes.map(function(_node) { return _node.get(\"position\").x; }),\n                    _yy = nodes.map(function(_node) { return _node.get(\"position\").y; }),\n                    _minx = Math.min.apply(Math, _xx),\n                    _miny = Math.min.apply(Math, _yy),\n                    _maxx = Math.max.apply(Math, _xx),\n                    _maxy = Math.max.apply(Math, _yy);\n                var _scale = Math.min(\n                        this.scale * 0.8 * this.renkan.options.minimap_width / paper.view.bounds.width,\n                        this.scale * 0.8 * this.renkan.options.minimap_height / paper.view.bounds.height,\n                        ( this.renkan.options.minimap_width - 2 * this.renkan.options.minimap_padding ) / (_maxx - _minx),\n                        ( this.renkan.options.minimap_height - 2 * this.renkan.options.minimap_padding ) / (_maxy - _miny)\n                );\n                this.minimap.offset = this.minimap.size.divide(2).subtract(new paper.Point([(_maxx + _minx) / 2, (_maxy + _miny) / 2]).multiply(_scale));\n                this.minimap.scale = _scale;\n            }\n            if (nodes.length === 1) {\n                this.minimap.scale = 0.1;\n                this.minimap.offset = this.minimap.size.divide(2).subtract(new paper.Point([nodes.at(0).get(\"position\").x, nodes.at(0).get(\"position\").y]).multiply(this.minimap.scale));\n            }\n            this.redraw();\n        },\n        toPaperCoords: function(_point) {\n            return _point.multiply(this.scale).add(this.offset);\n        },\n        toMinimapCoords: function(_point) {\n            return _point.multiply(this.minimap.scale).add(this.minimap.offset).add(this.minimap.topleft);\n        },\n        toModelCoords: function(_point) {\n            return _point.subtract(this.offset).divide(this.scale);\n        },\n        addRepresentation: function(_type, _model) {\n            var RendererType = requtils.getRenderer()[_type];\n            var _repr = new RendererType(this, _model);\n            this.representations.push(_repr);\n            return _repr;\n        },\n        addRepresentations: function(_type, _collection) {\n            var _this = this;\n            _collection.forEach(function(_model) {\n                _this.addRepresentation(_type, _model);\n            });\n        },\n        userTemplate: _.template(\n                '<li class=\"Rk-User\"><span class=\"Rk-UserColor\" style=\"background:<%=background%>;\"></span><%=name%></li>'\n        ),\n        redrawUsers: function() {\n            if (!this.renkan.options.show_user_list) {\n                return;\n            }\n            var allUsers = [].concat((this.renkan.project.current_user_list || {}).models || [], (this.renkan.project.get(\"users\") || {}).models || []),\n            ulistHtml = '',\n            $userpanel = this.$.find(\".Rk-Users\"),\n            $name = $userpanel.find(\".Rk-CurrentUser-Name\"),\n            $cpitems = $userpanel.find(\".Rk-Edit-ColorPicker li\"),\n            $colorsquare = $userpanel.find(\".Rk-CurrentUser-Color\"),\n            _this = this;\n            $name.off(\"click\").text(this.renkan.translate(\"<unknown user>\"));\n            $cpitems.off(\"mouseleave click\");\n            allUsers.forEach(function(_user) {\n                if (_user.get(\"_id\") === _this.renkan.current_user) {\n                    $name.text(_user.get(\"title\"));\n                    $colorsquare.css(\"background\", _user.get(\"color\"));\n                    if (_this.isEditable()) {\n\n                        if (_this.renkan.options.user_name_editable) {\n                            $name.click(function() {\n                                var $this = $(this),\n                                $input = $('<input>').val(_user.get(\"title\")).blur(function() {\n                                    _user.set(\"title\", $(this).val());\n                                    _this.redrawUsers();\n                                    _this.redraw();\n                                });\n                                $this.empty().html($input);\n                                $input.select();\n                            });\n                        }\n\n                        if (_this.renkan.options.user_color_editable) {\n                            $cpitems.click(\n                                    function(_e) {\n                                        _e.preventDefault();\n                                        if (_this.isEditable()) {\n                                            _user.set(\"color\", $(this).attr(\"data-color\"));\n                                        }\n                                        $(this).parent().hide();\n                                    }\n                            ).mouseleave(function() {\n                                $colorsquare.css(\"background\", _user.get(\"color\"));\n                            });\n                        }\n                    }\n\n                } else {\n                    ulistHtml += _this.userTemplate({\n                        name: _user.get(\"title\"),\n                        background: _user.get(\"color\")\n                    });\n                }\n            });\n            $userpanel.find(\".Rk-UserList\").html(ulistHtml);\n        },\n        removeRepresentation: function(_representation) {\n            _representation.destroy();\n            this.representations = _(this.representations).reject(\n                    function(_repr) {\n                        return _repr === _representation;\n                    }\n            );\n        },\n        getRepresentationByModel: function(_model) {\n            if (!_model) {\n                return undefined;\n            }\n            return _(this.representations).find(function(_repr) {\n                return _repr.model === _model;\n            });\n        },\n        removeRepresentationsOfType: function(_type) {\n            var _representations = _(this.representations).filter(function(_repr) {\n                return _repr.type === _type;\n            }),\n            _this = this;\n            _(_representations).each(function(_repr) {\n                _this.removeRepresentation(_repr);\n            });\n        },\n        highlightModel: function(_model) {\n            var _repr = this.getRepresentationByModel(_model);\n            if (_repr) {\n                _repr.highlight();\n            }\n        },\n        unhighlightAll: function(_model) {\n            _(this.representations).each(function(_repr) {\n                _repr.unhighlight();\n            });\n        },\n        unselectAll: function(_model) {\n            _(this.representations).each(function(_repr) {\n                _repr.unselect();\n            });\n        },\n        redraw: function() {\n            if(! this.redrawActive ) {\n                return;\n            }\n            _(this.representations).each(function(_representation) {\n                _representation.redraw(true);\n            });\n            if (this.minimap) {\n                this.redrawMiniframe();\n            }\n            paper.view.draw();\n        },\n        addTempEdge: function(_from, _point) {\n            var _tmpEdge = this.addRepresentation(\"TempEdge\",null);\n            _tmpEdge.end_pos = _point;\n            _tmpEdge.from_representation = _from;\n            _tmpEdge.redraw();\n            this.click_target = _tmpEdge;\n        },\n        findTarget: function(_hitResult) {\n            if (_hitResult && typeof _hitResult.item.__representation !== \"undefined\") {\n                var _newTarget = _hitResult.item.__representation;\n                if (this.selected_target !== _hitResult.item.__representation) {\n                    if (this.selected_target) {\n                        this.selected_target.unselect(_newTarget);\n                    }\n                    _newTarget.select(this.selected_target);\n                    this.selected_target = _newTarget;\n                }\n            } else {\n                if (this.selected_target) {\n                    this.selected_target.unselect();\n                }\n                this.selected_target = null;\n            }\n        },\n        paperShift: function(_delta) {\n            this.offset = this.offset.add(_delta);\n            this.redraw();\n        },\n        onMouseMove: function(_event) {\n            var _off = this.canvas_$.offset(),\n            _point = new paper.Point([\n                                      _event.pageX - _off.left,\n                                      _event.pageY - _off.top\n                                      ]),\n                                      _delta = _point.subtract(this.last_point);\n            this.last_point = _point;\n            if (!this.is_dragging && this.mouse_down && _delta.length > Utils._MIN_DRAG_DISTANCE) {\n                this.is_dragging = true;\n            }\n            var _hitResult = paper.project.hitTest(_point);\n            if (this.is_dragging) {\n                if (this.click_target && typeof this.click_target.paperShift === \"function\") {\n                    this.click_target.paperShift(_delta);\n                } else {\n                    this.paperShift(_delta);\n                }\n            } else {\n                this.findTarget(_hitResult);\n            }\n            paper.view.draw();\n        },\n        onMouseDown: function(_event, _isTouch) {\n            var _off = this.canvas_$.offset(),\n            _point = new paper.Point([\n                                      _event.pageX - _off.left,\n                                      _event.pageY - _off.top\n                                      ]);\n            this.last_point = _point;\n            this.mouse_down = true;\n            if (!this.click_target || this.click_target.type !== \"Temp-edge\") {\n                this.removeRepresentationsOfType(\"editor\");\n                this.is_dragging = false;\n                var _hitResult = paper.project.hitTest(_point);\n                if (_hitResult && typeof _hitResult.item.__representation !== \"undefined\") {\n                    this.click_target = _hitResult.item.__representation;\n                    this.click_target.mousedown(_event, _isTouch);\n                } else {\n                    this.click_target = null;\n                    if (this.isEditable() && this.click_mode === Utils._CLICKMODE_ADDNODE) {\n                        var _coords = this.toModelCoords(_point),\n                        _data = {\n                            id: Utils.getUID('node'),\n                            created_by: this.renkan.current_user,\n                            position: {\n                                x: _coords.x,\n                                y: _coords.y\n                            }\n                        };\n                        _node = this.renkan.project.addNode(_data);\n                        this.getRepresentationByModel(_node).openEditor();\n                    }\n                }\n            }\n            if (this.click_mode) {\n                if (this.isEditable() && this.click_mode === Utils._CLICKMODE_STARTEDGE && this.click_target && this.click_target.type === \"Node\") {\n                    this.removeRepresentationsOfType(\"editor\");\n                    this.addTempEdge(this.click_target, _point);\n                    this.click_mode = Utils._CLICKMODE_ENDEDGE;\n                    this.notif_$.fadeOut(function() {\n                        $(this).html(this.renkan.translate(\"Click on a second node to complete the edge\")).fadeIn();\n                    });\n                } else {\n                    this.notif_$.hide();\n                    this.click_mode = false;\n                }\n            }\n            paper.view.draw();\n        },\n        onMouseUp: function(_event, _isTouch) {\n            this.mouse_down = false;\n            if (this.click_target) {\n                var _off = this.canvas_$.offset();\n                this.click_target.mouseup(\n                        {\n                            point: new paper.Point([\n                                                    _event.pageX - _off.left,\n                                                    _event.pageY - _off.top\n                                                    ])\n                        },\n                        _isTouch\n                );\n            } else {\n                this.click_target = null;\n                this.is_dragging = false;\n                if (_isTouch) {\n                    this.unselectAll();\n                }\n            }\n            paper.view.draw();\n        },\n        onScroll: function(_event, _scrolldelta) {\n            this.totalScroll += _scrolldelta;\n            if (Math.abs(this.totalScroll) >= 1) {\n                var _off = this.canvas_$.offset(),\n                _delta = new paper.Point([\n                                          _event.pageX - _off.left,\n                                          _event.pageY - _off.top\n                                          ]).subtract(this.offset).multiply( Math.SQRT2 - 1 );\n                if (this.totalScroll > 0) {\n                    this.setScale( this.scale * Math.SQRT2, this.offset.subtract(_delta) );\n                } else {\n                    this.setScale( this.scale * Math.SQRT1_2, this.offset.add(_delta.divide(Math.SQRT2)));\n                }\n                this.totalScroll = 0;\n            }\n        },\n        onDoubleClick: function(_event) {\n            if (!this.isEditable()) {\n                return;\n            }\n            var _off = this.canvas_$.offset(),\n            _point = new paper.Point([\n                                      _event.pageX - _off.left,\n                                      _event.pageY - _off.top\n                                      ]);\n            var _hitResult = paper.project.hitTest(_point);\n            if (this.isEditable() && (!_hitResult || typeof _hitResult.item.__representation === \"undefined\")) {\n                var _coords = this.toModelCoords(_point),\n                _data = {\n                    id: Utils.getUID('node'),\n                    created_by: this.renkan.current_user,\n                    position: {\n                        x: _coords.x,\n                        y: _coords.y\n                    }\n                },\n                _node = this.renkan.project.addNode(_data);\n                this.getRepresentationByModel(_node).openEditor();\n            }\n            paper.view.draw();\n        },\n        defaultDropHandler: function(_data) {\n            var newNode = {};\n            var snippet = \"\";\n            switch(_data[\"text/x-iri-specific-site\"]) {\n                case \"twitter\":\n                    snippet = $('<div>').html(_data[\"text/x-iri-selected-html\"]);\n                    var tweetdiv = snippet.find(\".tweet\");\n                    newNode.title = this.renkan.translate(\"Tweet by \") + tweetdiv.attr(\"data-name\");\n                    newNode.uri = \"http://twitter.com/\" + tweetdiv.attr(\"data-screen-name\") + \"/status/\" + tweetdiv.attr(\"data-tweet-id\");\n                    newNode.image = tweetdiv.find(\".avatar\").attr(\"src\");\n                    newNode.description = tweetdiv.find(\".js-tweet-text:first\").text();\n                    break;\n                case \"google\":\n                    snippet = $('<div>').html(_data[\"text/x-iri-selected-html\"]);\n                    newNode.title = snippet.find(\"h3:first\").text().trim();\n                    newNode.uri = snippet.find(\"h3 a\").attr(\"href\");\n                    newNode.description = snippet.find(\".st:first\").text().trim();\n                    break;\n                default:\n                    if (_data[\"text/x-iri-source-uri\"]) {\n                        newNode.uri = _data[\"text/x-iri-source-uri\"];\n                    }\n            }\n            if (_data[\"text/plain\"] || _data[\"text/x-iri-selected-text\"]) {\n                newNode.description = (_data[\"text/plain\"] || _data[\"text/x-iri-selected-text\"]).replace(/[\\s\\n]+/gm,' ').trim();\n            }\n            if (_data[\"text/html\"] || _data[\"text/x-iri-selected-html\"]) {\n                snippet = $('<div>').html(_data[\"text/html\"] || _data[\"text/x-iri-selected-html\"]);\n                var _svgimgs = snippet.find(\"image\");\n                if (_svgimgs.length) {\n                    newNode.image = _svgimgs.attr(\"xlink:href\");\n                }\n                var _svgpaths = snippet.find(\"path\");\n                if (_svgpaths.length) {\n                    newNode.clipPath = _svgpaths.attr(\"d\");\n                }\n                var _imgs = snippet.find(\"img\");\n                if (_imgs.length) {\n                    newNode.image = _imgs[0].src;\n                }\n                var _as = snippet.find(\"a\");\n                if (_as.length) {\n                    newNode.uri = _as[0].href;\n                }\n                newNode.title = snippet.find(\"[title]\").attr(\"title\") || newNode.title;\n                newNode.description = snippet.text().replace(/[\\s\\n]+/gm,' ').trim();\n            }\n            if (_data[\"text/uri-list\"]) {\n                newNode.uri = _data[\"text/uri-list\"];\n            }\n            if (_data[\"text/x-moz-url\"] && !newNode.title) {\n                newNode.title = (_data[\"text/x-moz-url\"].split(\"\\n\")[1] || \"\").trim();\n                if (newNode.title === newNode.uri) {\n                    newNode.title = false;\n                }\n            }\n            if (_data[\"text/x-iri-source-title\"] && !newNode.title) {\n                newNode.title = _data[\"text/x-iri-source-title\"];\n            }\n            if (_data[\"text/html\"] || _data[\"text/x-iri-selected-html\"]) {\n                snippet = $('<div>').html(_data[\"text/html\"] || _data[\"text/x-iri-selected-html\"]);\n                newNode.image = snippet.find(\"[data-image]\").attr(\"data-image\") || newNode.image;\n                newNode.uri = snippet.find(\"[data-uri]\").attr(\"data-uri\") || newNode.uri;\n                newNode.title = snippet.find(\"[data-title]\").attr(\"data-title\") || newNode.title;\n                newNode.description = snippet.find(\"[data-description]\").attr(\"data-description\") || newNode.description;\n                newNode.clipPath = snippet.find(\"[data-clip-path]\").attr(\"data-clip-path\") || newNode.clipPath;\n            }\n\n            if (!newNode.title) {\n                newNode.title = this.renkan.translate(\"Dragged resource\");\n            }\n            var fields = [\"title\", \"description\", \"uri\", \"image\"];\n            for (var i = 0; i < fields.length; i++) {\n                var f = fields[i];\n                if (_data[\"text/x-iri-\" + f] || _data[f]) {\n                    newNode[f] = _data[\"text/x-iri-\" + f] || _data[f];\n                }\n                if (newNode[f] === \"none\" || newNode[f] === \"null\") {\n                    newNode[f] = undefined;\n                }\n            }\n\n            if(typeof this.renkan.options.drop_enhancer === \"function\"){\n                newNode = this.renkan.options.drop_enhancer(newNode, _data);\n            }\n\n            return newNode;\n\n        },\n        dropData: function(_data, _event) {\n            if (!this.isEditable()) {\n                return;\n            }\n            if (_data[\"text/json\"] || _data[\"application/json\"]) {\n                try {\n                    var jsondata = JSON.parse(_data[\"text/json\"] || _data[\"application/json\"]);\n                    _(_data).extend(jsondata);\n                }\n                catch(e) {}\n            }\n\n            var newNode = (typeof this.renkan.options.drop_handler === \"undefined\")?this.defaultDropHandler(_data):this.renkan.options.drop_handler(_data);\n\n            var _off = this.canvas_$.offset(),\n            _point = new paper.Point([\n                                      _event.pageX - _off.left,\n                                      _event.pageY - _off.top\n                                      ]),\n                                      _coords = this.toModelCoords(_point),\n                                      _nodedata = {\n                id: Utils.getUID('node'),\n                created_by: this.renkan.current_user,\n                uri: newNode.uri || \"\",\n                title: newNode.title || \"\",\n                description: newNode.description || \"\",\n                image: newNode.image || \"\",\n                color: newNode.color || undefined,\n                clip_path: newNode.clipPath || undefined,\n                position: {\n                    x: _coords.x,\n                    y: _coords.y\n                }\n            };\n            var _node = this.renkan.project.addNode(_nodedata),\n            _repr = this.getRepresentationByModel(_node);\n            if (_event.type === \"drop\") {\n                _repr.openEditor();\n            }\n        },\n        fullScreen: function() {\n            var _isFull = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen,\n                _el = this.renkan.$[0],\n                _requestMethods = [\"requestFullScreen\",\"mozRequestFullScreen\",\"webkitRequestFullScreen\"],\n                _cancelMethods = [\"cancelFullScreen\",\"mozCancelFullScreen\",\"webkitCancelFullScreen\"],\n                i;\n            if (_isFull) {\n                for (i = 0; i < _cancelMethods.length; i++) {\n                    if (typeof document[_cancelMethods[i]] === \"function\") {\n                        document[_cancelMethods[i]]();\n                        break;\n                    }\n                }\n                var widthAft = this.$.width();\n                var heightAft = this.$.height();\n\n                if (this.renkan.options.show_top_bar) {\n                    heightAft -= this.$.find(\".Rk-TopBar\").height();\n                }\n                if (this.renkan.options.show_bins && (this.renkan.$.find(\".Rk-Bins\").position().left > 0)) {\n                    widthAft -= this.renkan.$.find(\".Rk-Bins\").width();\n                }\n\n                paper.view.viewSize = new paper.Size([widthAft, heightAft]);\n\n            } else {\n                for (i = 0; i < _requestMethods.length; i++) {\n                    if (typeof _el[_requestMethods[i]] === \"function\") {\n                        _el[_requestMethods[i]]();\n                        break;\n                    }\n                }\n                this.redraw();\n            }\n        },\n        zoomOut: function() {\n            var _newScale = this.scale * Math.SQRT1_2,\n            _offset = new paper.Point([\n                                       this.canvas_$.width(),\n                                       this.canvas_$.height()\n                                       ]).multiply( 0.5 * ( 1 - Math.SQRT1_2 ) ).add(this.offset.multiply( Math.SQRT1_2 ));\n            this.setScale( _newScale, _offset );\n        },\n        zoomIn: function() {\n            var _newScale = this.scale * Math.SQRT2,\n            _offset = new paper.Point([\n                                       this.canvas_$.width(),\n                                       this.canvas_$.height()\n                                       ]).multiply( 0.5 * ( 1 - Math.SQRT2 ) ).add(this.offset.multiply( Math.SQRT2 ));\n            this.setScale( _newScale, _offset );\n        },\n        resizeZoom: function(_scaleWidth, _scaleHeight, _ratio) {\n            var _newScale = this.scale * _ratio,\n                _offset = new paper.Point([\n                                       (this.offset.x * _scaleWidth),\n                                       (this.offset.y * _scaleHeight)\n                                       ]);\n            this.setScale( _newScale, _offset );\n        },\n        addNodeBtn: function() {\n            if (this.click_mode === Utils._CLICKMODE_ADDNODE) {\n                this.click_mode = false;\n                this.notif_$.hide();\n            } else {\n                this.click_mode = Utils._CLICKMODE_ADDNODE;\n                this.notif_$.text(this.renkan.translate(\"Click on the background canvas to add a node\")).fadeIn();\n            }\n            return false;\n        },\n        addEdgeBtn: function() {\n            if (this.click_mode === Utils._CLICKMODE_STARTEDGE || this.click_mode === Utils._CLICKMODE_ENDEDGE) {\n                this.click_mode = false;\n                this.notif_$.hide();\n            } else {\n                this.click_mode = Utils._CLICKMODE_STARTEDGE;\n                this.notif_$.text(this.renkan.translate(\"Click on a first node to start the edge\")).fadeIn();\n            }\n            return false;\n        },\n        exportProject: function() {\n          var projectJSON = this.renkan.project.toJSON(),\n              downloadLink = document.createElement(\"a\"),\n              projectId = projectJSON.id,\n              fileNameToSaveAs = projectId + \".json\";\n\n          // clean ids\n          delete projectJSON.id;\n          delete projectJSON._id;\n          delete projectJSON.space_id;\n\n          var objId;\n          var idsMap = {};\n\n          _.each(projectJSON.nodes, function(e,i,l) {\n            objId = e.id || e._id;\n            delete e._id;\n            delete e.id;\n            idsMap[objId] = e['@id'] = Utils.getUUID4();\n          });\n          _.each(projectJSON.edges, function(e,i,l) {\n            delete e._id;\n            delete e.id;\n            e.to = idsMap[e.to];\n            e.from = idsMap[e.from];\n          });\n          _.each(projectJSON.views, function(e,i,l) {\n            objId = e.id || e._id;\n            delete e._id;\n            delete e.id;\n          });\n          projectJSON.users = [];\n\n          var projectJSONStr = JSON.stringify(projectJSON, null, 2);\n          var blob = new Blob([projectJSONStr], {type: \"application/json;charset=utf-8\"});\n          filesaver(blob,fileNameToSaveAs);\n\n        },\n        foldBins: function() {\n            var foldBinsButton = this.$.find(\".Rk-Fold-Bins\"),\n                bins = this.renkan.$.find(\".Rk-Bins\");\n            var _this = this,\n                sizeBef = _this.canvas_$.width(),\n                sizeAft;\n            if (bins.position().left < 0) {\n                bins.animate({left: 0},250);\n                this.$.animate({left: 300},250,function() {\n                    var w = _this.$.width();\n                    paper.view.viewSize = new paper.Size([w, _this.canvas_$.height()]);\n                });\n                if ((sizeBef -  bins.width()) < bins.height()){\n                    sizeAft = sizeBef;\n                } else {\n                    sizeAft = sizeBef - bins.width();\n                }\n                foldBinsButton.html(\"&laquo;\");\n            } else {\n                bins.animate({left: -300},250);\n                this.$.animate({left: 0},250,function() {\n                    var w = _this.$.width();\n                    paper.view.viewSize = new paper.Size([w, _this.canvas_$.height()]);\n                });\n                sizeAft = sizeBef+300;\n                foldBinsButton.html(\"&raquo;\");\n            }\n            _this.resizeZoom(1, 1, (sizeAft/sizeBef));\n        },\n        save: function() { },\n        open: function() { }\n    });\n\n    /* Scene End */\n\n    return Scene;\n\n});\n\n\n//Load modules and use them\nif( typeof require.config === \"function\" ) {\n    require.config({\n        paths: {\n            'jquery':'../lib/jquery/jquery',\n            'underscore':'../lib/underscore/underscore',\n            'filesaver' :'../lib/FileSaver/FileSaver',\n            'requtils':'require-utils'\n        }\n    });\n}\n\nrequire(['renderer/baserepresentation',\n         'renderer/basebutton',\n         'renderer/noderepr',\n         'renderer/edge',\n         'renderer/tempedge',\n         'renderer/baseeditor',\n         'renderer/nodeeditor',\n         'renderer/edgeeditor',\n         'renderer/nodebutton',\n         'renderer/nodeeditbutton',\n         'renderer/noderemovebutton',\n         'renderer/noderevertbutton',\n         'renderer/nodelinkbutton',\n         'renderer/nodeenlargebutton',\n         'renderer/nodeshrinkbutton',\n         'renderer/edgeeditbutton',\n         'renderer/edgeremovebutton',\n         'renderer/edgerevertbutton',\n         'renderer/miniframe',\n         'renderer/scene'\n         ], function(BaseRepresentation, BaseButton, NodeRepr, Edge, TempEdge, BaseEditor, NodeEditor, EdgeEditor, NodeButton, NodeEditButton, NodeRemoveButton, NodeRevertButton, NodeLinkButton, NodeEnlargeButton, NodeShrinkButton, EdgeEditButton, EdgeRemoveButton, EdgeRevertButton, MiniFrame, Scene){\n\n    \n\n    var Rkns = window.Rkns;\n\n    if(typeof Rkns.Renderer === \"undefined\"){\n        Rkns.Renderer = {};\n    }\n    var Renderer = Rkns.Renderer;\n\n    Renderer._BaseRepresentation = BaseRepresentation;\n    Renderer._BaseButton = BaseButton;\n    Renderer.Node = NodeRepr;\n    Renderer.Edge = Edge;\n    Renderer.TempEdge = TempEdge;\n    Renderer._BaseEditor = BaseEditor;\n    Renderer.NodeEditor = NodeEditor;\n    Renderer.EdgeEditor = EdgeEditor;\n    Renderer._NodeButton = NodeButton;\n    Renderer.NodeEditButton = NodeEditButton;\n    Renderer.NodeRemoveButton = NodeRemoveButton;\n    Renderer.NodeRevertButton = NodeRevertButton;\n    Renderer.NodeLinkButton = NodeLinkButton;\n    Renderer.NodeEnlargeButton = NodeEnlargeButton;\n    Renderer.NodeShrinkButton = NodeShrinkButton;\n    Renderer.EdgeEditButton = EdgeEditButton;\n    Renderer.EdgeRemoveButton = EdgeRemoveButton;\n    Renderer.EdgeRevertButton = EdgeRevertButton;\n    Renderer.MiniFrame = MiniFrame;\n    Renderer.Scene = Scene;\n\n    startRenkan();\n});\n\ndefine(\"main-renderer\", function(){});\n\n"]}
\ No newline at end of file