Gitlab CSE Unil

Commit 881e95d6 authored by M. Chardon's avatar M. Chardon
Browse files

Merge branch 'origin/django' into 'javascript'

Origin/django

See merge request !2
parents a2d3307a 4e2987a6
...@@ -88,7 +88,7 @@ define([ ...@@ -88,7 +88,7 @@ define([
} }
}); });
console.log(labelItem);
if (!_ro) { if (!_ro) {
labelItem.find("textarea") labelItem.find("textarea")
.on("change", function () { .on("change", function () {
...@@ -104,8 +104,10 @@ define([ ...@@ -104,8 +104,10 @@ define([
} }
}) })
.on("focus", function () { .on("focus", function () {
var $me = $(this), var $me = $(this);
console.log($me);
labelItem = $me.closest(".adim-tool-marker-label-item"); labelItem = $me.closest(".adim-tool-marker-label-item");
console.log(labelItem);
if (!labelItem.hasClass("active")) { if (!labelItem.hasClass("active")) {
selectLabelAnnotation(labelItem); selectLabelAnnotation(labelItem);
selectLabelItem(labelItem, true); selectLabelItem(labelItem, true);
...@@ -195,9 +197,12 @@ define([ ...@@ -195,9 +197,12 @@ define([
if (focusTextArea) { if (focusTextArea) {
labelItem.find("textarea").focus(); labelItem.find("textarea").focus();
} }
// Scroll to visible area console.log(labelItem);
var scrollY = labelItem.offset().top + _labelScrollPane.scrollTop() - _labelScrollOffsetTop; if (labelItem) {
_labelScrollPane.animate({scrollTop : scrollY }, 300, 'swing'); // Scroll to visible area
var scrollY = labelItem.offset().top + _labelScrollPane.scrollTop() - _labelScrollOffsetTop;
_labelScrollPane.animate({scrollTop: scrollY}, 300, 'swing');
}
} }
/** /**
......
...@@ -1587,6 +1587,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export ...@@ -1587,6 +1587,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
* @param event * @param event
*/ */
function onPropertyChange(event) { function onPropertyChange(event) {
$(this).addClass("focus");
updateSelectedItemProp(event.data.pName); updateSelectedItemProp(event.data.pName);
} }
...@@ -1621,7 +1622,12 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export ...@@ -1621,7 +1622,12 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
if (_.isFunction(pDef.onChange)) { if (_.isFunction(pDef.onChange)) {
elem.on('change', pDef.onChange); elem.on('change', pDef.onChange);
} else { } else {
elem.on('change', null, {pName: pName}, onPropertyChange); var elemBtn = elem.find(".btn-cat");
if (elemBtn) {
elem.find(".btn-cat").on('change', null, {pName: pName}, onPropertyChange);
}else{
elem.on('change', null, {pName: pName}, onPropertyChange);
}
} }
if (_.isFunction(pDef['onBlur'])) { if (_.isFunction(pDef['onBlur'])) {
......
...@@ -31060,6 +31060,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export ...@@ -31060,6 +31060,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
* @param event * @param event
*/ */
function onPropertyChange(event) { function onPropertyChange(event) {
$(this).addClass("focus");
updateSelectedItemProp(event.data.pName); updateSelectedItemProp(event.data.pName);
} }
   
...@@ -31094,7 +31095,12 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export ...@@ -31094,7 +31095,12 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
if (_.isFunction(pDef.onChange)) { if (_.isFunction(pDef.onChange)) {
elem.on('change', pDef.onChange); elem.on('change', pDef.onChange);
} else { } else {
elem.on('change', null, {pName: pName}, onPropertyChange); var elemBtn = elem.find(".btn-cat");
if (elemBtn) {
elem.find(".btn-cat").on('change', null, {pName: pName}, onPropertyChange);
}else{
elem.on('change', null, {pName: pName}, onPropertyChange);
}
} }
   
if (_.isFunction(pDef['onBlur'])) { if (_.isFunction(pDef['onBlur'])) {
...@@ -34169,7 +34175,7 @@ function($){ ...@@ -34169,7 +34175,7 @@ function($){
!function(a){function b(b){if("string"==typeof b.data&&(b.data={keys:b.data}),b.data&&b.data.keys&&"string"==typeof b.data.keys){var c=b.handler,d=b.data.keys.toLowerCase().split(" ");b.handler=function(b){if(this===b.target||!(/textarea|select/i.test(b.target.nodeName)||a.hotkeys.options.filterTextInputs&&a.inArray(b.target.type,a.hotkeys.textAcceptingInputTypes)>-1)){var e="keypress"!==b.type&&a.hotkeys.specialKeys[b.which],f=String.fromCharCode(b.which).toLowerCase(),g="",h={};a.each(["alt","ctrl","shift"],function(a,c){b[c+"Key"]&&e!==c&&(g+=c+"+")}),b.metaKey&&!b.ctrlKey&&"meta"!==e&&(g+="meta+"),b.metaKey&&"meta"!==e&&g.indexOf("alt+ctrl+shift+")>-1&&(g=g.replace("alt+ctrl+shift+","hyper+")),e?h[g+e]=!0:(h[g+f]=!0,h[g+a.hotkeys.shiftNums[f]]=!0,"shift+"===g&&(h[a.hotkeys.shiftNums[f]]=!0));for(var i=0,j=d.length;i<j;i++)if(h[d[i]])return c.apply(this,arguments)}}}}a.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",10:"return",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"},textAcceptingInputTypes:["text","password","number","email","url","range","date","month","week","time","datetime","datetime-local","search","color","tel"],options:{filterTextInputs:!0}},a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:b}})}(jQuery||this.jQuery||window.jQuery); !function(a){function b(b){if("string"==typeof b.data&&(b.data={keys:b.data}),b.data&&b.data.keys&&"string"==typeof b.data.keys){var c=b.handler,d=b.data.keys.toLowerCase().split(" ");b.handler=function(b){if(this===b.target||!(/textarea|select/i.test(b.target.nodeName)||a.hotkeys.options.filterTextInputs&&a.inArray(b.target.type,a.hotkeys.textAcceptingInputTypes)>-1)){var e="keypress"!==b.type&&a.hotkeys.specialKeys[b.which],f=String.fromCharCode(b.which).toLowerCase(),g="",h={};a.each(["alt","ctrl","shift"],function(a,c){b[c+"Key"]&&e!==c&&(g+=c+"+")}),b.metaKey&&!b.ctrlKey&&"meta"!==e&&(g+="meta+"),b.metaKey&&"meta"!==e&&g.indexOf("alt+ctrl+shift+")>-1&&(g=g.replace("alt+ctrl+shift+","hyper+")),e?h[g+e]=!0:(h[g+f]=!0,h[g+a.hotkeys.shiftNums[f]]=!0,"shift+"===g&&(h[a.hotkeys.shiftNums[f]]=!0));for(var i=0,j=d.length;i<j;i++)if(h[d[i]])return c.apply(this,arguments)}}}}a.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",10:"return",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"},textAcceptingInputTypes:["text","password","number","email","url","range","date","month","week","time","datetime","datetime-local","search","color","tel"],options:{filterTextInputs:!0}},a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:b}})}(jQuery||this.jQuery||window.jQuery);
define("jquery.hotkeys", ["jquery"], function(){}); define("jquery.hotkeys", ["jquery"], function(){});
   
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('env/shortcuts',["jquery","paper","signals","adim/config","adim/view","adim/tools","adim/ui","jquery.hotkeys"],function(a,b,c,d,e,f,g){var h=function(){return function(){return!1}};return{"backspace del":[{event:"keydown",ctxt:"edit",fn:function(){return e.removeSelectedItems(),!1}},{event:"keydown",ctxt:"review",fn:h()}],space:[{event:"keydown",fn:function(){return a("#tool-pan").click(),!1}},{event:"keyup",fn:function(){return a("#tool-pan").click(),!1}}],a:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-select").click(),!1}}],"ctrl+a meta+a":[{event:"keydown",ctxt:"edit",fn:function(){return b.project.activeLayer.children.map(function(a){a.selected=!0}),!1}},{event:"keydown",ctxt:"review",fn:h()}],d:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-drawing").click(),!1}}],f:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-arrow").click(),!1}}],l:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-lines").click(),!1}}],c:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-ellipse").click(),!1}}],r:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-rectangle").click(),!1}}],t:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-text").click(),!1}}]}}); define('env/shortcuts',["jquery","paper","signals","adim/config","adim/view","adim/tools","adim/ui","jquery.hotkeys"],function(a,b,c,d,e,f,g){var h=function(){return function(){return!1}};return{"backspace del":[{event:"keydown",ctxt:"edit",fn:function(){return e.removeSelectedItems(),!1}},{event:"keydown",ctxt:"review",fn:h()}],space:[{event:"keydown",fn:function(){return a("#tool-pan").click(),!1}},{event:"keyup",fn:function(){return a("#tool-pan").click(),!1}}],a:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-select").click(),!1}}],"ctrl+a meta+a":[{event:"keydown",ctxt:"edit",fn:function(){return b.project.activeLayer.children.map(function(a){a.selected=!0}),!1}},{event:"keydown",ctxt:"review",fn:h()}],d:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-drawing").click(),!1}}],f:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-arrow").click(),!1}}],l:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-lines").click(),!1}}],c:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-ellipse").click(),!1}}],r:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-rectangle").click(),!1}}],t:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-text").click(),!1}}]}});
/*! Sortable 1.6.0 - MIT | git://github.com/rubaxa/Sortable.git */ /*! Sortable 1.6.0 - MIT | git://github.com/rubaxa/Sortable.git */
!function(a){"use strict";"function"==typeof define&&define.amd?define('sortable',a):"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=a():window.Sortable=a()}(function(){"use strict";function a(a,b){if(!a||!a.nodeType||1!==a.nodeType)throw"Sortable: `el` must be HTMLElement, and not "+{}.toString.call(a);this.el=a,this.options=b=t({},b),a[T]=this;var c={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(a.nodeName)?"li":">*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,setData:function(a,b){a.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0}};for(var d in c)!(d in b)&&(b[d]=c[d]);ga(b);for(var e in this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this));this.nativeDraggable=!b.forceFallback&&$,f(a,"mousedown",this._onTapStart),f(a,"touchstart",this._onTapStart),f(a,"pointerdown",this._onTapStart),this.nativeDraggable&&(f(a,"dragover",this),f(a,"dragenter",this)),ea.push(this._onDragOver),b.store&&this.sort(b.store.get(this))}function b(a,b){"clone"!==a.lastPullMode&&(b=!0),z&&z.state!==b&&(i(z,"display",b?"none":""),b||z.state&&(a.options.group.revertClone?(A.insertBefore(z,B),a._animate(w,z)):A.insertBefore(z,w)),z.state=b)}function c(a,b,c){if(a){c=c||V;do if(">*"===b&&a.parentNode===c||r(a,b))return a;while(a=d(a))}return null}function d(a){var b=a.host;return b&&b.nodeType?b:a.parentNode}function e(a){a.dataTransfer&&(a.dataTransfer.dropEffect="move"),a.preventDefault()}function f(a,b,c){a.addEventListener(b,c,Z)}function g(a,b,c){a.removeEventListener(b,c,Z)}function h(a,b,c){if(a)if(a.classList)a.classList[c?"add":"remove"](b);else{var d=(" "+a.className+" ").replace(R," ").replace(" "+b+" "," ");a.className=(d+(c?" "+b:"")).replace(R," ")}}function i(a,b,c){var d=a&&a.style;if(d){if(void 0===c)return V.defaultView&&V.defaultView.getComputedStyle?c=V.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];b in d||(b="-webkit-"+b),d[b]=c+("string"==typeof c?"":"px")}}function j(a,b,c){if(a){var d=a.getElementsByTagName(b),e=0,f=d.length;if(c)for(;e<f;e++)c(d[e],e);return d}return[]}function k(a,b,c,d,e,f,g){a=a||b[T];var h=V.createEvent("Event"),i=a.options,j="on"+c.charAt(0).toUpperCase()+c.substr(1);h.initEvent(c,!0,!0),h.to=b,h.from=e||b,h.item=d||b,h.clone=z,h.oldIndex=f,h.newIndex=g,b.dispatchEvent(h),i[j]&&i[j].call(a,h)}function l(a,b,c,d,e,f,g,h){var i,j,k=a[T],l=k.options.onMove;return i=V.createEvent("Event"),i.initEvent("move",!0,!0),i.to=b,i.from=a,i.dragged=c,i.draggedRect=d,i.related=e||b,i.relatedRect=f||b.getBoundingClientRect(),i.willInsertAfter=h,a.dispatchEvent(i),l&&(j=l.call(k,i,g)),j}function m(a){a.draggable=!1}function n(){aa=!1}function o(a,b){var c=a.lastElementChild,d=c.getBoundingClientRect();return b.clientY-(d.top+d.height)>5||b.clientX-(d.left+d.width)>5}function p(a){for(var b=a.tagName+a.className+a.src+a.href+a.textContent,c=b.length,d=0;c--;)d+=b.charCodeAt(c);return d.toString(36)}function q(a,b){var c=0;if(!a||!a.parentNode)return-1;for(;a&&(a=a.previousElementSibling);)"TEMPLATE"===a.nodeName.toUpperCase()||">*"!==b&&!r(a,b)||c++;return c}function r(a,b){if(a){b=b.split(".");var c=b.shift().toUpperCase(),d=new RegExp("\\s("+b.join("|")+")(?=\\s)","g");return!(""!==c&&a.nodeName.toUpperCase()!=c||b.length&&((" "+a.className+" ").match(d)||[]).length!=b.length)}return!1}function s(a,b){var c,d;return function(){void 0===c&&(c=arguments,d=this,setTimeout(function(){1===c.length?a.call(d,c[0]):a.apply(d,c),c=void 0},b))}}function t(a,b){if(a&&b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function u(a){return X?X(a).clone(!0)[0]:Y&&Y.dom?Y.dom(a).cloneNode(!0):a.cloneNode(!0)}function v(a){for(var b=a.getElementsByTagName("input"),c=b.length;c--;){var d=b[c];d.checked&&da.push(d)}}if("undefined"==typeof window||!window.document)return function(){throw new Error("Sortable.js requires a window with a document")};var w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q={},R=/\s+/g,S=/left|right|inline/,T="Sortable"+(new Date).getTime(),U=window,V=U.document,W=U.parseInt,X=U.jQuery||U.Zepto,Y=U.Polymer,Z=!1,$=!!("draggable"in V.createElement("div")),_=function(a){return!navigator.userAgent.match(/Trident.*rv[ :]?11\./)&&(a=V.createElement("x"),a.style.cssText="pointer-events:auto","auto"===a.style.pointerEvents)}(),aa=!1,ba=Math.abs,ca=Math.min,da=[],ea=[],fa=s(function(a,b,c){if(c&&b.scroll){var d,e,f,g,h,i,j=c[T],k=b.scrollSensitivity,l=b.scrollSpeed,m=a.clientX,n=a.clientY,o=window.innerWidth,p=window.innerHeight;if(E!==c&&(D=b.scroll,E=c,F=b.scrollFn,D===!0)){D=c;do if(D.offsetWidth<D.scrollWidth||D.offsetHeight<D.scrollHeight)break;while(D=D.parentNode)}D&&(d=D,e=D.getBoundingClientRect(),f=(ba(e.right-m)<=k)-(ba(e.left-m)<=k),g=(ba(e.bottom-n)<=k)-(ba(e.top-n)<=k)),f||g||(f=(o-m<=k)-(m<=k),g=(p-n<=k)-(n<=k),(f||g)&&(d=U)),Q.vx===f&&Q.vy===g&&Q.el===d||(Q.el=d,Q.vx=f,Q.vy=g,clearInterval(Q.pid),d&&(Q.pid=setInterval(function(){return i=g?g*l:0,h=f?f*l:0,"function"==typeof F?F.call(j,h,i,a):void(d===U?U.scrollTo(U.pageXOffset+h,U.pageYOffset+i):(d.scrollTop+=i,d.scrollLeft+=h))},24)))}},30),ga=function(a){function b(a,b){return void 0!==a&&a!==!0||(a=c.name),"function"==typeof a?a:function(c,d){var e=d.options.group.name;return b?a:a&&(a.join?a.indexOf(e)>-1:e==a)}}var c={},d=a.group;d&&"object"==typeof d||(d={name:d}),c.name=d.name,c.checkPull=b(d.pull,!0),c.checkPut=b(d.put),c.revertClone=d.revertClone,a.group=c};a.prototype={constructor:a,_onTapStart:function(a){var b,d=this,e=this.el,f=this.options,g=f.preventOnFilter,h=a.type,i=a.touches&&a.touches[0],j=(i||a).target,l=a.target.shadowRoot&&a.path[0]||j,m=f.filter;if(v(e),!w&&!("mousedown"===h&&0!==a.button||f.disabled)&&(j=c(j,f.draggable,e),j&&C!==j)){if(b=q(j,f.draggable),"function"==typeof m){if(m.call(this,a,j,this))return k(d,l,"filter",j,e,b),void(g&&a.preventDefault())}else if(m&&(m=m.split(",").some(function(a){if(a=c(l,a.trim(),e))return k(d,a,"filter",j,e,b),!0})))return void(g&&a.preventDefault());f.handle&&!c(l,f.handle,e)||this._prepareDragStart(a,i,j,b)}},_prepareDragStart:function(a,b,c,d){var e,g=this,i=g.el,l=g.options,n=i.ownerDocument;c&&!w&&c.parentNode===i&&(N=a,A=i,w=c,x=w.parentNode,B=w.nextSibling,C=c,L=l.group,J=d,this._lastX=(b||a).clientX,this._lastY=(b||a).clientY,w.style["will-change"]="transform",e=function(){g._disableDelayedDrag(),w.draggable=g.nativeDraggable,h(w,l.chosenClass,!0),g._triggerDragStart(a,b),k(g,A,"choose",w,A,J)},l.ignore.split(",").forEach(function(a){j(w,a.trim(),m)}),f(n,"mouseup",g._onDrop),f(n,"touchend",g._onDrop),f(n,"touchcancel",g._onDrop),f(n,"pointercancel",g._onDrop),f(n,"selectstart",g),l.delay?(f(n,"mouseup",g._disableDelayedDrag),f(n,"touchend",g._disableDelayedDrag),f(n,"touchcancel",g._disableDelayedDrag),f(n,"mousemove",g._disableDelayedDrag),f(n,"touchmove",g._disableDelayedDrag),f(n,"pointermove",g._disableDelayedDrag),g._dragStartTimer=setTimeout(e,l.delay)):e())},_disableDelayedDrag:function(){var a=this.el.ownerDocument;clearTimeout(this._dragStartTimer),g(a,"mouseup",this._disableDelayedDrag),g(a,"touchend",this._disableDelayedDrag),g(a,"touchcancel",this._disableDelayedDrag),g(a,"mousemove",this._disableDelayedDrag),g(a,"touchmove",this._disableDelayedDrag),g(a,"pointermove",this._disableDelayedDrag)},_triggerDragStart:function(a,b){b=b||("touch"==a.pointerType?a:null),b?(N={target:w,clientX:b.clientX,clientY:b.clientY},this._onDragStart(N,"touch")):this.nativeDraggable?(f(w,"dragend",this),f(A,"dragstart",this._onDragStart)):this._onDragStart(N,!0);try{V.selection?setTimeout(function(){V.selection.empty()}):window.getSelection().removeAllRanges()}catch(a){}},_dragStarted:function(){if(A&&w){var b=this.options;h(w,b.ghostClass,!0),h(w,b.dragClass,!1),a.active=this,k(this,A,"start",w,A,J)}else this._nulling()},_emulateDragOver:function(){if(O){if(this._lastX===O.clientX&&this._lastY===O.clientY)return;this._lastX=O.clientX,this._lastY=O.clientY,_||i(y,"display","none");var a=V.elementFromPoint(O.clientX,O.clientY),b=a,c=ea.length;if(b)do{if(b[T]){for(;c--;)ea[c]({clientX:O.clientX,clientY:O.clientY,target:a,rootEl:b});break}a=b}while(b=b.parentNode);_||i(y,"display","")}},_onTouchMove:function(b){if(N){var c=this.options,d=c.fallbackTolerance,e=c.fallbackOffset,f=b.touches?b.touches[0]:b,g=f.clientX-N.clientX+e.x,h=f.clientY-N.clientY+e.y,j=b.touches?"translate3d("+g+"px,"+h+"px,0)":"translate("+g+"px,"+h+"px)";if(!a.active){if(d&&ca(ba(f.clientX-this._lastX),ba(f.clientY-this._lastY))<d)return;this._dragStarted()}this._appendGhost(),P=!0,O=f,i(y,"webkitTransform",j),i(y,"mozTransform",j),i(y,"msTransform",j),i(y,"transform",j),b.preventDefault()}},_appendGhost:function(){if(!y){var a,b=w.getBoundingClientRect(),c=i(w),d=this.options;y=w.cloneNode(!0),h(y,d.ghostClass,!1),h(y,d.fallbackClass,!0),h(y,d.dragClass,!0),i(y,"top",b.top-W(c.marginTop,10)),i(y,"left",b.left-W(c.marginLeft,10)),i(y,"width",b.width),i(y,"height",b.height),i(y,"opacity","0.8"),i(y,"position","fixed"),i(y,"zIndex","100000"),i(y,"pointerEvents","none"),d.fallbackOnBody&&V.body.appendChild(y)||A.appendChild(y),a=y.getBoundingClientRect(),i(y,"width",2*b.width-a.width),i(y,"height",2*b.height-a.height)}},_onDragStart:function(a,b){var c=a.dataTransfer,d=this.options;this._offUpEvents(),L.checkPull(this,this,w,a)&&(z=u(w),z.draggable=!1,z.style["will-change"]="",i(z,"display","none"),h(z,this.options.chosenClass,!1),A.insertBefore(z,w),k(this,A,"clone",w)),h(w,d.dragClass,!0),b?("touch"===b?(f(V,"touchmove",this._onTouchMove),f(V,"touchend",this._onDrop),f(V,"touchcancel",this._onDrop),f(V,"pointermove",this._onTouchMove),f(V,"pointerup",this._onDrop)):(f(V,"mousemove",this._onTouchMove),f(V,"mouseup",this._onDrop)),this._loopId=setInterval(this._emulateDragOver,50)):(c&&(c.effectAllowed="move",d.setData&&d.setData.call(this,c,w)),f(V,"drop",this),setTimeout(this._dragStarted,0))},_onDragOver:function(d){var e,f,g,h,j=this.el,k=this.options,m=k.group,p=a.active,q=L===m,r=!1,s=k.sort;if(void 0!==d.preventDefault&&(d.preventDefault(),!k.dragoverBubble&&d.stopPropagation()),!w.animated&&(P=!0,p&&!k.disabled&&(q?s||(h=!A.contains(w)):M===this||(p.lastPullMode=L.checkPull(this,p,w,d))&&m.checkPut(this,p,w,d))&&(void 0===d.rootEl||d.rootEl===this.el))){if(fa(d,k,this.el),aa)return;if(e=c(d.target,k.draggable,j),f=w.getBoundingClientRect(),M!==this&&(M=this,r=!0),h)return b(p,!0),x=A,void(z||B?A.insertBefore(w,z||B):s||A.appendChild(w));if(0===j.children.length||j.children[0]===y||j===d.target&&o(j,d)){if(0!==j.children.length&&j.children[0]!==y&&j===d.target&&(e=j.lastElementChild),e){if(e.animated)return;g=e.getBoundingClientRect()}b(p,q),l(A,j,w,f,e,g,d)!==!1&&(w.contains(j)||(j.appendChild(w),x=j),this._animate(f,w),e&&this._animate(g,e))}else if(e&&!e.animated&&e!==w&&void 0!==e.parentNode[T]){G!==e&&(G=e,H=i(e),I=i(e.parentNode)),g=e.getBoundingClientRect();var t=g.right-g.left,u=g.bottom-g.top,v=S.test(H.cssFloat+H.display)||"flex"==I.display&&0===I["flex-direction"].indexOf("row"),C=e.offsetWidth>w.offsetWidth,D=e.offsetHeight>w.offsetHeight,E=(v?(d.clientX-g.left)/t:(d.clientY-g.top)/u)>.5,F=e.nextElementSibling,J=!1;if(v){var K=w.offsetTop,N=e.offsetTop;J=K===N?e.previousElementSibling===w&&!C||E&&C:e.previousElementSibling===w||w.previousElementSibling===e?(d.clientY-g.top)/u>.5:N>K}else r||(J=F!==w&&!D||E&&D);var O=l(A,j,w,f,e,g,d,J);O!==!1&&(1!==O&&O!==-1||(J=1===O),aa=!0,setTimeout(n,30),b(p,q),w.contains(j)||(J&&!F?j.appendChild(w):e.parentNode.insertBefore(w,J?F:e)),x=w.parentNode,this._animate(f,w),this._animate(g,e))}}},_animate:function(a,b){var c=this.options.animation;if(c){var d=b.getBoundingClientRect();1===a.nodeType&&(a=a.getBoundingClientRect()),i(b,"transition","none"),i(b,"transform","translate3d("+(a.left-d.left)+"px,"+(a.top-d.top)+"px,0)"),b.offsetWidth,i(b,"transition","all "+c+"ms"),i(b,"transform","translate3d(0,0,0)"),clearTimeout(b.animated),b.animated=setTimeout(function(){i(b,"transition",""),i(b,"transform",""),b.animated=!1},c)}},_offUpEvents:function(){var a=this.el.ownerDocument;g(V,"touchmove",this._onTouchMove),g(V,"pointermove",this._onTouchMove),g(a,"mouseup",this._onDrop),g(a,"touchend",this._onDrop),g(a,"pointerup",this._onDrop),g(a,"touchcancel",this._onDrop),g(a,"pointercancel",this._onDrop),g(a,"selectstart",this)},_onDrop:function(b){var c=this.el,d=this.options;clearInterval(this._loopId),clearInterval(Q.pid),clearTimeout(this._dragStartTimer),g(V,"mousemove",this._onTouchMove),this.nativeDraggable&&(g(V,"drop",this),g(c,"dragstart",this._onDragStart)),this._offUpEvents(),b&&(P&&(b.preventDefault(),!d.dropBubble&&b.stopPropagation()),y&&y.parentNode&&y.parentNode.removeChild(y),A!==x&&"clone"===a.active.lastPullMode||z&&z.parentNode&&z.parentNode.removeChild(z),w&&(this.nativeDraggable&&g(w,"dragend",this),m(w),w.style["will-change"]="",h(w,this.options.ghostClass,!1),h(w,this.options.chosenClass,!1),k(this,A,"unchoose",w,A,J),A!==x?(K=q(w,d.draggable),K>=0&&(k(null,x,"add",w,A,J,K),k(this,A,"remove",w,A,J,K),k(null,x,"sort",w,A,J,K),k(this,A,"sort",w,A,J,K))):w.nextSibling!==B&&(K=q(w,d.draggable),K>=0&&(k(this,A,"update",w,A,J,K),k(this,A,"sort",w,A,J,K))),a.active&&(null!=K&&K!==-1||(K=J),k(this,A,"end",w,A,J,K),this.save()))),this._nulling()},_nulling:function(){A=w=x=y=B=z=C=D=E=N=O=P=K=G=H=M=L=a.active=null,da.forEach(function(a){a.checked=!0}),da.length=0},handleEvent:function(a){switch(a.type){case"drop":case"dragend":this._onDrop(a);break;case"dragover":case"dragenter":w&&(this._onDragOver(a),e(a));break;case"selectstart":a.preventDefault()}},toArray:function(){for(var a,b=[],d=this.el.children,e=0,f=d.length,g=this.options;e<f;e++)a=d[e],c(a,g.draggable,this.el)&&b.push(a.getAttribute(g.dataIdAttr)||p(a));return b},sort:function(a){var b={},d=this.el;this.toArray().forEach(function(a,e){var f=d.children[e];c(f,this.options.draggable,d)&&(b[a]=f)},this),a.forEach(function(a){b[a]&&(d.removeChild(b[a]),d.appendChild(b[a]))})},save:function(){var a=this.options.store;a&&a.set(this)},closest:function(a,b){return c(a,b||this.options.draggable,this.el)},option:function(a,b){var c=this.options;return void 0===b?c[a]:(c[a]=b,void("group"===a&&ga(c)))},destroy:function(){var a=this.el;a[T]=null,g(a,"mousedown",this._onTapStart),g(a,"touchstart",this._onTapStart),g(a,"pointerdown",this._onTapStart),this.nativeDraggable&&(g(a,"dragover",this),g(a,"dragenter",this)),Array.prototype.forEach.call(a.querySelectorAll("[draggable]"),function(a){a.removeAttribute("draggable")}),ea.splice(ea.indexOf(this._onDragOver),1),this._onDrop(),this.el=a=null}},f(V,"touchmove",function(b){a.active&&b.preventDefault()});try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){Z={capture:!1,passive:!1}}}))}catch(a){}return a.utils={on:f,off:g,css:i,find:j,is:function(a,b){return!!c(a,b,a)},extend:t,throttle:s,closest:c,toggleClass:h,clone:u,index:q},a.create=function(b,c){return new a(b,c)},a.version="1.6.0",a}); !function(a){"use strict";"function"==typeof define&&define.amd?define('sortable',a):"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=a():window.Sortable=a()}(function(){"use strict";function a(a,b){if(!a||!a.nodeType||1!==a.nodeType)throw"Sortable: `el` must be HTMLElement, and not "+{}.toString.call(a);this.el=a,this.options=b=t({},b),a[T]=this;var c={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(a.nodeName)?"li":">*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,setData:function(a,b){a.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0}};for(var d in c)!(d in b)&&(b[d]=c[d]);ga(b);for(var e in this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this));this.nativeDraggable=!b.forceFallback&&$,f(a,"mousedown",this._onTapStart),f(a,"touchstart",this._onTapStart),f(a,"pointerdown",this._onTapStart),this.nativeDraggable&&(f(a,"dragover",this),f(a,"dragenter",this)),ea.push(this._onDragOver),b.store&&this.sort(b.store.get(this))}function b(a,b){"clone"!==a.lastPullMode&&(b=!0),z&&z.state!==b&&(i(z,"display",b?"none":""),b||z.state&&(a.options.group.revertClone?(A.insertBefore(z,B),a._animate(w,z)):A.insertBefore(z,w)),z.state=b)}function c(a,b,c){if(a){c=c||V;do if(">*"===b&&a.parentNode===c||r(a,b))return a;while(a=d(a))}return null}function d(a){var b=a.host;return b&&b.nodeType?b:a.parentNode}function e(a){a.dataTransfer&&(a.dataTransfer.dropEffect="move"),a.preventDefault()}function f(a,b,c){a.addEventListener(b,c,Z)}function g(a,b,c){a.removeEventListener(b,c,Z)}function h(a,b,c){if(a)if(a.classList)a.classList[c?"add":"remove"](b);else{var d=(" "+a.className+" ").replace(R," ").replace(" "+b+" "," ");a.className=(d+(c?" "+b:"")).replace(R," ")}}function i(a,b,c){var d=a&&a.style;if(d){if(void 0===c)return V.defaultView&&V.defaultView.getComputedStyle?c=V.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];b in d||(b="-webkit-"+b),d[b]=c+("string"==typeof c?"":"px")}}function j(a,b,c){if(a){var d=a.getElementsByTagName(b),e=0,f=d.length;if(c)for(;e<f;e++)c(d[e],e);return d}return[]}function k(a,b,c,d,e,f,g){a=a||b[T];var h=V.createEvent("Event"),i=a.options,j="on"+c.charAt(0).toUpperCase()+c.substr(1);h.initEvent(c,!0,!0),h.to=b,h.from=e||b,h.item=d||b,h.clone=z,h.oldIndex=f,h.newIndex=g,b.dispatchEvent(h),i[j]&&i[j].call(a,h)}function l(a,b,c,d,e,f,g,h){var i,j,k=a[T],l=k.options.onMove;return i=V.createEvent("Event"),i.initEvent("move",!0,!0),i.to=b,i.from=a,i.dragged=c,i.draggedRect=d,i.related=e||b,i.relatedRect=f||b.getBoundingClientRect(),i.willInsertAfter=h,a.dispatchEvent(i),l&&(j=l.call(k,i,g)),j}function m(a){a.draggable=!1}function n(){aa=!1}function o(a,b){var c=a.lastElementChild,d=c.getBoundingClientRect();return b.clientY-(d.top+d.height)>5||b.clientX-(d.left+d.width)>5}function p(a){for(var b=a.tagName+a.className+a.src+a.href+a.textContent,c=b.length,d=0;c--;)d+=b.charCodeAt(c);return d.toString(36)}function q(a,b){var c=0;if(!a||!a.parentNode)return-1;for(;a&&(a=a.previousElementSibling);)"TEMPLATE"===a.nodeName.toUpperCase()||">*"!==b&&!r(a,b)||c++;return c}function r(a,b){if(a){b=b.split(".");var c=b.shift().toUpperCase(),d=new RegExp("\\s("+b.join("|")+")(?=\\s)","g");return!(""!==c&&a.nodeName.toUpperCase()!=c||b.length&&((" "+a.className+" ").match(d)||[]).length!=b.length)}return!1}function s(a,b){var c,d;return function(){void 0===c&&(c=arguments,d=this,setTimeout(function(){1===c.length?a.call(d,c[0]):a.apply(d,c),c=void 0},b))}}function t(a,b){if(a&&b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function u(a){return X?X(a).clone(!0)[0]:Y&&Y.dom?Y.dom(a).cloneNode(!0):a.cloneNode(!0)}function v(a){for(var b=a.getElementsByTagName("input"),c=b.length;c--;){var d=b[c];d.checked&&da.push(d)}}if("undefined"==typeof window||!window.document)return function(){throw new Error("Sortable.js requires a window with a document")};var w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q={},R=/\s+/g,S=/left|right|inline/,T="Sortable"+(new Date).getTime(),U=window,V=U.document,W=U.parseInt,X=U.jQuery||U.Zepto,Y=U.Polymer,Z=!1,$=!!("draggable"in V.createElement("div")),_=function(a){return!navigator.userAgent.match(/Trident.*rv[ :]?11\./)&&(a=V.createElement("x"),a.style.cssText="pointer-events:auto","auto"===a.style.pointerEvents)}(),aa=!1,ba=Math.abs,ca=Math.min,da=[],ea=[],fa=s(function(a,b,c){if(c&&b.scroll){var d,e,f,g,h,i,j=c[T],k=b.scrollSensitivity,l=b.scrollSpeed,m=a.clientX,n=a.clientY,o=window.innerWidth,p=window.innerHeight;if(E!==c&&(D=b.scroll,E=c,F=b.scrollFn,D===!0)){D=c;do if(D.offsetWidth<D.scrollWidth||D.offsetHeight<D.scrollHeight)break;while(D=D.parentNode)}D&&(d=D,e=D.getBoundingClientRect(),f=(ba(e.right-m)<=k)-(ba(e.left-m)<=k),g=(ba(e.bottom-n)<=k)-(ba(e.top-n)<=k)),f||g||(f=(o-m<=k)-(m<=k),g=(p-n<=k)-(n<=k),(f||g)&&(d=U)),Q.vx===f&&Q.vy===g&&Q.el===d||(Q.el=d,Q.vx=f,Q.vy=g,clearInterval(Q.pid),d&&(Q.pid=setInterval(function(){return i=g?g*l:0,h=f?f*l:0,"function"==typeof F?F.call(j,h,i,a):void(d===U?U.scrollTo(U.pageXOffset+h,U.pageYOffset+i):(d.scrollTop+=i,d.scrollLeft+=h))},24)))}},30),ga=function(a){function b(a,b){return void 0!==a&&a!==!0||(a=c.name),"function"==typeof a?a:function(c,d){var e=d.options.group.name;return b?a:a&&(a.join?a.indexOf(e)>-1:e==a)}}var c={},d=a.group;d&&"object"==typeof d||(d={name:d}),c.name=d.name,c.checkPull=b(d.pull,!0),c.checkPut=b(d.put),c.revertClone=d.revertClone,a.group=c};a.prototype={constructor:a,_onTapStart:function(a){var b,d=this,e=this.el,f=this.options,g=f.preventOnFilter,h=a.type,i=a.touches&&a.touches[0],j=(i||a).target,l=a.target.shadowRoot&&a.path[0]||j,m=f.filter;if(v(e),!w&&!("mousedown"===h&&0!==a.button||f.disabled)&&(j=c(j,f.draggable,e),j&&C!==j)){if(b=q(j,f.draggable),"function"==typeof m){if(m.call(this,a,j,this))return k(d,l,"filter",j,e,b),void(g&&a.preventDefault())}else if(m&&(m=m.split(",").some(function(a){if(a=c(l,a.trim(),e))return k(d,a,"filter",j,e,b),!0})))return void(g&&a.preventDefault());f.handle&&!c(l,f.handle,e)||this._prepareDragStart(a,i,j,b)}},_prepareDragStart:function(a,b,c,d){var e,g=this,i=g.el,l=g.options,n=i.ownerDocument;c&&!w&&c.parentNode===i&&(N=a,A=i,w=c,x=w.parentNode,B=w.nextSibling,C=c,L=l.group,J=d,this._lastX=(b||a).clientX,this._lastY=(b||a).clientY,w.style["will-change"]="transform",e=function(){g._disableDelayedDrag(),w.draggable=g.nativeDraggable,h(w,l.chosenClass,!0),g._triggerDragStart(a,b),k(g,A,"choose",w,A,J)},l.ignore.split(",").forEach(function(a){j(w,a.trim(),m)}),f(n,"mouseup",g._onDrop),f(n,"touchend",g._onDrop),f(n,"touchcancel",g._onDrop),f(n,"pointercancel",g._onDrop),f(n,"selectstart",g),l.delay?(f(n,"mouseup",g._disableDelayedDrag),f(n,"touchend",g._disableDelayedDrag),f(n,"touchcancel",g._disableDelayedDrag),f(n,"mousemove",g._disableDelayedDrag),f(n,"touchmove",g._disableDelayedDrag),f(n,"pointermove",g._disableDelayedDrag),g._dragStartTimer=setTimeout(e,l.delay)):e())},_disableDelayedDrag:function(){var a=this.el.ownerDocument;clearTimeout(this._dragStartTimer),g(a,"mouseup",this._disableDelayedDrag),g(a,"touchend",this._disableDelayedDrag),g(a,"touchcancel",this._disableDelayedDrag),g(a,"mousemove",this._disableDelayedDrag),g(a,"touchmove",this._disableDelayedDrag),g(a,"pointermove",this._disableDelayedDrag)},_triggerDragStart:function(a,b){b=b||("touch"==a.pointerType?a:null),b?(N={target:w,clientX:b.clientX,clientY:b.clientY},this._onDragStart(N,"touch")):this.nativeDraggable?(f(w,"dragend",this),f(A,"dragstart",this._onDragStart)):this._onDragStart(N,!0);try{V.selection?setTimeout(function(){V.selection.empty()}):window.getSelection().removeAllRanges()}catch(a){}},_dragStarted:function(){if(A&&w){var b=this.options;h(w,b.ghostClass,!0),h(w,b.dragClass,!1),a.active=this,k(this,A,"start",w,A,J)}else this._nulling()},_emulateDragOver:function(){if(O){if(this._lastX===O.clientX&&this._lastY===O.clientY)return;this._lastX=O.clientX,this._lastY=O.clientY,_||i(y,"display","none");var a=V.elementFromPoint(O.clientX,O.clientY),b=a,c=ea.length;if(b)do{if(b[T]){for(;c--;)ea[c]({clientX:O.clientX,clientY:O.clientY,target:a,rootEl:b});break}a=b}while(b=b.parentNode);_||i(y,"display","")}},_onTouchMove:function(b){if(N){var c=this.options,d=c.fallbackTolerance,e=c.fallbackOffset,f=b.touches?b.touches[0]:b,g=f.clientX-N.clientX+e.x,h=f.clientY-N.clientY+e.y,j=b.touches?"translate3d("+g+"px,"+h+"px,0)":"translate("+g+"px,"+h+"px)";if(!a.active){if(d&&ca(ba(f.clientX-this._lastX),ba(f.clientY-this._lastY))<d)return;this._dragStarted()}this._appendGhost(),P=!0,O=f,i(y,"webkitTransform",j),i(y,"mozTransform",j),i(y,"msTransform",j),i(y,"transform",j),b.preventDefault()}},_appendGhost:function(){if(!y){var a,b=w.getBoundingClientRect(),c=i(w),d=this.options;y=w.cloneNode(!0),h(y,d.ghostClass,!1),h(y,d.fallbackClass,!0),h(y,d.dragClass,!0),i(y,"top",b.top-W(c.marginTop,10)),i(y,"left",b.left-W(c.marginLeft,10)),i(y,"width",b.width),i(y,"height",b.height),i(y,"opacity","0.8"),i(y,"position","fixed"),i(y,"zIndex","100000"),i(y,"pointerEvents","none"),d.fallbackOnBody&&V.body.appendChild(y)||A.appendChild(y),a=y.getBoundingClientRect(),i(y,"width",2*b.width-a.width),i(y,"height",2*b.height-a.height)}},_onDragStart:function(a,b){var c=a.dataTransfer,d=this.options;this._offUpEvents(),L.checkPull(this,this,w,a)&&(z=u(w),z.draggable=!1,z.style["will-change"]="",i(z,"display","none"),h(z,this.options.chosenClass,!1),A.insertBefore(z,w),k(this,A,"clone",w)),h(w,d.dragClass,!0),b?("touch"===b?(f(V,"touchmove",this._onTouchMove),f(V,"touchend",this._onDrop),f(V,"touchcancel",this._onDrop),f(V,"pointermove",this._onTouchMove),f(V,"pointerup",this._onDrop)):(f(V,"mousemove",this._onTouchMove),f(V,"mouseup",this._onDrop)),this._loopId=setInterval(this._emulateDragOver,50)):(c&&(c.effectAllowed="move",d.setData&&d.setData.call(this,c,w)),f(V,"drop",this),setTimeout(this._dragStarted,0))},_onDragOver:function(d){var e,f,g,h,j=this.el,k=this.options,m=k.group,p=a.active,q=L===m,r=!1,s=k.sort;if(void 0!==d.preventDefault&&(d.preventDefault(),!k.dragoverBubble&&d.stopPropagation()),!w.animated&&(P=!0,p&&!k.disabled&&(q?s||(h=!A.contains(w)):M===this||(p.lastPullMode=L.checkPull(this,p,w,d))&&m.checkPut(this,p,w,d))&&(void 0===d.rootEl||d.rootEl===this.el))){if(fa(d,k,this.el),aa)return;if(e=c(d.target,k.draggable,j),f=w.getBoundingClientRect(),M!==this&&(M=this,r=!0),h)return b(p,!0),x=A,void(z||B?A.insertBefore(w,z||B):s||A.appendChild(w));if(0===j.children.length||j.children[0]===y||j===d.target&&o(j,d)){if(0!==j.children.length&&j.children[0]!==y&&j===d.target&&(e=j.lastElementChild),e){if(e.animated)return;g=e.getBoundingClientRect()}b(p,q),l(A,j,w,f,e,g,d)!==!1&&(w.contains(j)||(j.appendChild(w),x=j),this._animate(f,w),e&&this._animate(g,e))}else if(e&&!e.animated&&e!==w&&void 0!==e.parentNode[T]){G!==e&&(G=e,H=i(e),I=i(e.parentNode)),g=e.getBoundingClientRect();var t=g.right-g.left,u=g.bottom-g.top,v=S.test(H.cssFloat+H.display)||"flex"==I.display&&0===I["flex-direction"].indexOf("row"),C=e.offsetWidth>w.offsetWidth,D=e.offsetHeight>w.offsetHeight,E=(v?(d.clientX-g.left)/t:(d.clientY-g.top)/u)>.5,F=e.nextElementSibling,J=!1;if(v){var K=w.offsetTop,N=e.offsetTop;J=K===N?e.previousElementSibling===w&&!C||E&&C:e.previousElementSibling===w||w.previousElementSibling===e?(d.clientY-g.top)/u>.5:N>K}else r||(J=F!==w&&!D||E&&D);var O=l(A,j,w,f,e,g,d,J);O!==!1&&(1!==O&&O!==-1||(J=1===O),aa=!0,setTimeout(n,30),b(p,q),w.contains(j)||(J&&!F?j.appendChild(w):e.parentNode.insertBefore(w,J?F:e)),x=w.parentNode,this._animate(f,w),this._animate(g,e))}}},_animate:function(a,b){var c=this.options.animation;if(c){var d=b.getBoundingClientRect();1===a.nodeType&&(a=a.getBoundingClientRect()),i(b,"transition","none"),i(b,"transform","translate3d("+(a.left-d.left)+"px,"+(a.top-d.top)+"px,0)"),b.offsetWidth,i(b,"transition","all "+c+"ms"),i(b,"transform","translate3d(0,0,0)"),clearTimeout(b.animated),b.animated=setTimeout(function(){i(b,"transition",""),i(b,"transform",""),b.animated=!1},c)}},_offUpEvents:function(){var a=this.el.ownerDocument;g(V,"touchmove",this._onTouchMove),g(V,"pointermove",this._onTouchMove),g(a,"mouseup",this._onDrop),g(a,"touchend",this._onDrop),g(a,"pointerup",this._onDrop),g(a,"touchcancel",this._onDrop),g(a,"pointercancel",this._onDrop),g(a,"selectstart",this)},_onDrop:function(b){var c=this.el,d=this.options;clearInterval(this._loopId),clearInterval(Q.pid),clearTimeout(this._dragStartTimer),g(V,"mousemove",this._onTouchMove),this.nativeDraggable&&(g(V,"drop",this),g(c,"dragstart",this._onDragStart)),this._offUpEvents(),b&&(P&&(b.preventDefault(),!d.dropBubble&&b.stopPropagation()),y&&y.parentNode&&y.parentNode.removeChild(y),A!==x&&"clone"===a.active.lastPullMode||z&&z.parentNode&&z.parentNode.removeChild(z),w&&(this.nativeDraggable&&g(w,"dragend",this),m(w),w.style["will-change"]="",h(w,this.options.ghostClass,!1),h(w,this.options.chosenClass,!1),k(this,A,"unchoose",w,A,J),A!==x?(K=q(w,d.draggable),K>=0&&(k(null,x,"add",w,A,J,K),k(this,A,"remove",w,A,J,K),k(null,x,"sort",w,A,J,K),k(this,A,"sort",w,A,J,K))):w.nextSibling!==B&&(K=q(w,d.draggable),K>=0&&(k(this,A,"update",w,A,J,K),k(this,A,"sort",w,A,J,K))),a.active&&(null!=K&&K!==-1||(K=J),k(this,A,"end",w,A,J,K),this.save()))),this._nulling()},_nulling:function(){A=w=x=y=B=z=C=D=E=N=O=P=K=G=H=M=L=a.active=null,da.forEach(function(a){a.checked=!0}),da.length=0},handleEvent:function(a){switch(a.type){case"drop":case"dragend":this._onDrop(a);break;case"dragover":case"dragenter":w&&(this._onDragOver(a),e(a));break;case"selectstart":a.preventDefault()}},toArray:function(){for(var a,b=[],d=this.el.children,e=0,f=d.length,g=this.options;e<f;e++)a=d[e],c(a,g.draggable,this.el)&&b.push(a.getAttribute(g.dataIdAttr)||p(a));return b},sort:function(a){var b={},d=this.el;this.toArray().forEach(function(a,e){var f=d.children[e];c(f,this.options.draggable,d)&&(b[a]=f)},this),a.forEach(function(a){b[a]&&(d.removeChild(b[a]),d.appendChild(b[a]))})},save:function(){var a=this.options.store;a&&a.set(this)},closest:function(a,b){return c(a,b||this.options.draggable,this.el)},option:function(a,b){var c=this.options;return void 0===b?c[a]:(c[a]=b,void("group"===a&&ga(c)))},destroy:function(){var a=this.el;a[T]=null,g(a,"mousedown",this._onTapStart),g(a,"touchstart",this._onTapStart),g(a,"pointerdown",this._onTapStart),this.nativeDraggable&&(g(a,"dragover",this),g(a,"dragenter",this)),Array.prototype.forEach.call(a.querySelectorAll("[draggable]"),function(a){a.removeAttribute("draggable")}),ea.splice(ea.indexOf(this._onDragOver),1),this._onDrop(),this.el=a=null}},f(V,"touchmove",function(b){a.active&&b.preventDefault()});try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){Z={capture:!1,passive:!1}}}))}catch(a){}return a.utils={on:f,off:g,css:i,find:j,is:function(a,b){return!!c(a,b,a)},extend:t,throttle:s,closest:c,toggleClass:h,clone:u,index:q},a.create=function(b,c){return new a(b,c)},a.version="1.6.0",a});
...@@ -34263,7 +34269,7 @@ define('tools/marker-ui',[ ...@@ -34263,7 +34269,7 @@ define('tools/marker-ui',[
} }
}); });
   
console.log(labelItem);
if (!_ro) { if (!_ro) {
labelItem.find("textarea") labelItem.find("textarea")
.on("change", function () { .on("change", function () {
...@@ -34279,8 +34285,10 @@ define('tools/marker-ui',[ ...@@ -34279,8 +34285,10 @@ define('tools/marker-ui',[
} }
}) })
.on("focus", function () { .on("focus", function () {
var $me = $(this), var $me = $(this);
console.log($me);
labelItem = $me.closest(".adim-tool-marker-label-item"); labelItem = $me.closest(".adim-tool-marker-label-item");
console.log(labelItem);
if (!labelItem.hasClass("active")) { if (!labelItem.hasClass("active")) {
selectLabelAnnotation(labelItem); selectLabelAnnotation(labelItem);
selectLabelItem(labelItem, true); selectLabelItem(labelItem, true);
...@@ -34370,9 +34378,12 @@ define('tools/marker-ui',[ ...@@ -34370,9 +34378,12 @@ define('tools/marker-ui',[
if (focusTextArea) { if (focusTextArea) {
labelItem.find("textarea").focus(); labelItem.find("textarea").focus();
} }
// Scroll to visible area console.log(labelItem);
var scrollY = labelItem.offset().top + _labelScrollPane.scrollTop() - _labelScrollOffsetTop; if (labelItem) {
_labelScrollPane.animate({scrollTop : scrollY }, 300, 'swing'); // Scroll to visible area
var scrollY = labelItem.offset().top + _labelScrollPane.scrollTop() - _labelScrollOffsetTop;
_labelScrollPane.animate({scrollTop: scrollY}, 300, 'swing');
}
} }
   
/** /**
...@@ -34508,7 +34519,7 @@ define('tools/marker-ui',[ ...@@ -34508,7 +34519,7 @@ define('tools/marker-ui',[
} }
} }
); );
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('env/env',["jquery","underscore","paper","signals","adim/config","adim/view","adim/attributes","adim/io","adim/tools","adim/ui","adim/category","env/shortcuts","tools/marker-ui"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){function n(){console.info("_initSignalRouting from env/anodate"),h.events.annotableLoaded.add(function(a){f.events.annotationRemoved.add(function(a){"marker"===a.data.type&&i.tools.marker.listeners.updateNumbering()}),f.events.imageLoaded.add(function(a){})},100),f.events.annotationsLoaded.add(function(){i.tools.marker.listeners.updateNumbering()},-100),j.events.modeChanged.add(function(b){var c=b.mode;"edit"===c?(a("#annotation-display-panel").hide(),a("#annotation-property-panel").show()):"review"===c&&(a("#annotation-display-panel").show(),a("#annotation-property-panel").hide())})}function o(b){function c(a){e.toggleClass("w-25",a),e.toggleClass("default",!a),i.toggleClass("w-100",!a),a?n.show():n.hide(),l.toggleClass("w-50",a),l.toggleClass("w-100",!a)}function d(a){c(a&&o.find(".collapse").hasClass("show")),a?o.show():o.hide()}k.init(),m.init(b),a("#tool-colorselect").find(".color-menu").addClass("no-picker"),a(".adim-display-type-selector").find("button").on("click",function(b){var c=a(this),d=!c.hasClass("active"),e=c.data("category");b.metaKey||(c.toggleClass("active",d),"image"===e?g.setImageOpacity(d?100:0,!0):f.toggleItemsByProp({prop:"category",val:e,undef:!0},d))});var e=a("#side-col"),h=a(".canvas-container"),i=a("#canvas-col"),l=a("#side-col-panel-group"),n=a("#alt-side-col-panel-group"),o=a("#shared-annotation-markers-panel");d("review"===b.mode),j.events.modeChanged.add(function(a){var b=a.mode;d("review"===b),j.updateReservedSpace(),j.adjustCanvasToImage()}),o.find(".collapse").on("hidden.bs.collapse",function(){h.css("transition","width 0.2s cubic-bezier(0.25, 0.1, 0.25, 1) 0s"),o.prependTo(l),c(!1),j.updateReservedSpace(),j.adjustCanvasToImage(),h.css("transition","")}).on("show.bs.collapse",function(){c(!0),o.appendTo(n),j.updateReservedSpace(),j.adjustCanvasToImage()})}function p(){var b,d=a("#tool-colorselect").find(".color-menu .c4").css("backgroundColor");if(0===d.indexOf("rgb")){var e=d.split(/[(),]/).map(function(a){return parseFloat(a.trim())}).filter(function(a){return!isNaN(a)});b=new c.Color(e[0]/255,e[1]/255,e[2]/255)}else b=new c.Color(d);return{strokeColor:b}}var q={name:"anodate",shortcuts:l,initSignalRouting:n,initUI:o};return Object.defineProperty(q,"style",{get:p}),q}); define('env/env',["jquery","underscore","paper","signals","adim/config","adim/view","adim/attributes","adim/io","adim/tools","adim/ui","adim/category","env/shortcuts","tools/marker-ui"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){function n(){console.info("_initSignalRouting from env/anodate"),h.events.annotableLoaded.add(function(a){f.events.annotationRemoved.add(function(a){"marker"===a.data.type&&i.tools.marker.listeners.updateNumbering()}),f.events.imageLoaded.add(function(a){})},100),f.events.annotationsLoaded.add(function(){i.tools.marker.listeners.updateNumbering()},-100),j.events.modeChanged.add(function(b){var c=b.mode;"edit"===c?(a("#annotation-display-panel").hide(),a("#annotation-property-panel").show()):"review"===c&&(a("#annotation-display-panel").show(),a("#annotation-property-panel").hide())})}function o(b){function c(a){e.toggleClass("w-25",a),e.toggleClass("default",!a),i.toggleClass("w-100",!a),a?n.show():n.hide(),l.toggleClass("w-50",a),l.toggleClass("w-100",!a)}function d(a){c(a&&o.find(".collapse").hasClass("show")),a?o.show():o.hide()}k.init(),m.init(b),a("#tool-colorselect").find(".color-menu").addClass("no-picker"),a(".adim-display-type-selector").find("button").on("click",function(b){var c=a(this),d=!c.hasClass("active"),e=c.data("category");b.metaKey||(c.toggleClass("active",d),"image"===e?g.setImageOpacity(d?100:0,!0):f.toggleItemsByProp({prop:"category",val:e,undef:!0},d))});var e=a("#side-col"),h=a(".canvas-container"),i=a("#canvas-col"),l=a("#side-col-panel-group"),n=a("#alt-side-col-panel-group"),o=a("#shared-annotation-markers-panel");d("review"===b.mode),j.events.modeChanged.add(function(a){var b=a.mode;d("review"===b),j.updateReservedSpace(),j.adjustCanvasToImage()}),o.find(".collapse").on("hidden.bs.collapse",function(){h.css("transition","width 0.2s cubic-bezier(0.25, 0.1, 0.25, 1) 0s"),o.prependTo(l),c(!1),j.updateReservedSpace(),j.adjustCanvasToImage(),h.css("transition","")}).on("show.bs.collapse",function(){c(!0),o.appendTo(n),j.updateReservedSpace(),j.adjustCanvasToImage()})}function p(){var b,d=a("#tool-colorselect").find(".color-menu .c4").css("backgroundColor");if(0===d.indexOf("rgb")){var e=d.split(/[(),]/).map(function(a){return parseFloat(a.trim())}).filter(function(a){return!isNaN(a)});b=new c.Color(e[0]/255,e[1]/255,e[2]/255)}else b=new c.Color(d);return{strokeColor:b}}var q={name:"anodate",shortcuts:l,initSignalRouting:n,initUI:o};return Object.defineProperty(q,"style",{get:p}),q});
/** /**
* Copyright (C) 2014 Université de Lausanne, RISET, * Copyright (C) 2014 Université de Lausanne, RISET,
...@@ -24426,7 +24426,7 @@ define('popper.js', ['popper.js/popper.min'], function (main) { return main; }); ...@@ -24426,7 +24426,7 @@ define('popper.js', ['popper.js/popper.min'], function (main) { return main; });
========================================================= */ ========================================================= */
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},windowIsDefined="object"===("undefined"==typeof window?"undefined":_typeof(window));!function(a){if("function"==typeof define&&define.amd)define('bootstrap.slider',["jquery"],a);else if("object"===("undefined"==typeof module?"undefined":_typeof(module))&&module.exports){var b;try{b=require("jquery")}catch(c){b=null}module.exports=a(b)}else window&&(window.Slider=a(window.jQuery))}(function(a){var b="slider",c="bootstrapSlider";windowIsDefined&&!window.console&&(window.console={}),windowIsDefined&&!window.console.log&&(window.console.log=function(){}),windowIsDefined&&!window.console.warn&&(window.console.warn=function(){});var d;return function(a){function b(){}function c(a){function c(b){b.prototype.option||(b.prototype.option=function(b){a.isPlainObject(b)&&(this.options=a.extend(!0,this.options,b))})}function e(b,c){a.fn[b]=function(e){if("string"==typeof e){for(var g=d.call(arguments,1),h=0,i=this.length;i>h;h++){var j=this[h],k=a.data(j,b);if(k)if(a.isFunction(k[e])&&"_"!==e.charAt(0)){var l=k[e].apply(k,g);if(void 0!==l&&l!==k)return l}else f("no such method '"+e+"' for "+b+" instance");else f("cannot call methods on "+b+" prior to initialization; attempted to call '"+e+"'")}return this}var m=this.map(function(){var d=a.data(this,b);return d?(d.option(e),d._init()):(d=new c(this,e),a.data(this,b,d)),a(this)});return!m||m.length>1?m:m[0]}}if(a){var f="undefined"==typeof console?b:function(a){console.error(a)};return a.bridget=function(a,b){c(b),e(a,b)},a.bridget}}var d=Array.prototype.slice;c(a)}(a),function(a){function e(b,c){function d(a,b){var c="data-slider-"+b.replace(/_/g,"-"),d=a.getAttribute(c);try{return JSON.parse(d)}catch(e){return d}}this._state={value:null,enabled:null,offset:null,size:null,percentage:null,inDrag:!1,over:!1},this.ticksCallbackMap={},this.handleCallbackMap={},"string"==typeof b?this.element=document.querySelector(b):b instanceof HTMLElement&&(this.element=b),c=c?c:{};for(var e=Object.keys(this.defaultOptions),f=0;f<e.length;f++){var h=e[f],i=c[h];i="undefined"!=typeof i?i:d(this.element,h),i=null!==i?i:this.defaultOptions[h],this.options||(this.options={}),this.options[h]=i}"auto"===this.options.rtl&&(this.options.rtl="rtl"===window.getComputedStyle(this.element).direction),"vertical"!==this.options.orientation||"top"!==this.options.tooltip_position&&"bottom"!==this.options.tooltip_position?"horizontal"!==this.options.orientation||"left"!==this.options.tooltip_position&&"right"!==this.options.tooltip_position||(this.options.tooltip_position="top"):this.options.rtl?this.options.tooltip_position="left":this.options.tooltip_position="right";var j,k,l,m,n,o=this.element.style.width,p=!1,q=this.element.parentNode;if(this.sliderElem)p=!0;else{this.sliderElem=document.createElement("div"),this.sliderElem.className="slider";var r=document.createElement("div");r.className="slider-track",k=document.createElement("div"),k.className="slider-track-low",j=document.createElement("div"),j.className="slider-selection",l=document.createElement("div"),l.className="slider-track-high",m=document.createElement("div"),m.className="slider-handle min-slider-handle",m.setAttribute("role","slider"),m.setAttribute("aria-valuemin",this.options.min),m.setAttribute("aria-valuemax",this.options.max),n=document.createElement("div"),n.className="slider-handle max-slider-handle",n.setAttribute("role","slider"),n.setAttribute("aria-valuemin",this.options.min),n.setAttribute("aria-valuemax",this.options.max),r.appendChild(k),r.appendChild(j),r.appendChild(l),this.rangeHighlightElements=[];var s=this.options.rangeHighlights;if(Array.isArray(s)&&s.length>0)for(var t=0;t<s.length;t++){var u=document.createElement("div"),v=s[t]["class"]||"";u.className="slider-rangeHighlight slider-selection "+v,this.rangeHighlightElements.push(u),r.appendChild(u)}var w=Array.isArray(this.options.labelledby);if(w&&this.options.labelledby[0]&&m.setAttribute("aria-labelledby",this.options.labelledby[0]),w&&this.options.labelledby[1]&&n.setAttribute("aria-labelledby",this.options.labelledby[1]),!w&&this.options.labelledby&&(m.setAttribute("aria-labelledby",this.options.labelledby),n.setAttribute("aria-labelledby",this.options.labelledby)),this.ticks=[],Array.isArray(this.options.ticks)&&this.options.ticks.length>0){for(this.ticksContainer=document.createElement("div"),this.ticksContainer.className="slider-tick-container",f=0;f<this.options.ticks.length;f++){var x=document.createElement("div");if(x.className="slider-tick",this.options.ticks_tooltip){var y=this._addTickListener(),z=y.addMouseEnter(this,x,f),A=y.addMouseLeave(this,x);this.ticksCallbackMap[f]={mouseEnter:z,mouseLeave:A}}this.ticks.push(x),this.ticksContainer.appendChild(x)}j.className+=" tick-slider-selection"}if(this.tickLabels=[],Array.isArray(this.options.ticks_labels)&&this.options.ticks_labels.length>0)for(this.tickLabelContainer=document.createElement("div"),this.tickLabelContainer.className="slider-tick-label-container",f=0;f<this.options.ticks_labels.length;f++){var B=document.createElement("div"),C=0===this.options.ticks_positions.length,D=this.options.reversed&&C?this.options.ticks_labels.length-(f+1):f;B.className="slider-tick-label",B.innerHTML=this.options.ticks_labels[D],this.tickLabels.push(B),this.tickLabelContainer.appendChild(B)}var E=function(a){var b=document.createElement("div");b.className="tooltip-arrow";var c=document.createElement("div");c.className="tooltip-inner",a.appendChild(b),a.appendChild(c)},F=document.createElement("div");F.className="tooltip tooltip-main",F.setAttribute("role","presentation"),E(F);var G=document.createElement("div");G.className="tooltip tooltip-min",G.setAttribute("role","presentation"),E(G);var H=document.createElement("div");H.className="tooltip tooltip-max",H.setAttribute("role","presentation"),E(H),this.sliderElem.appendChild(r),this.sliderElem.appendChild(F),this.sliderElem.appendChild(G),this.sliderElem.appendChild(H),this.tickLabelContainer&&this.sliderElem.appendChild(this.tickLabelContainer),this.ticksContainer&&this.sliderElem.appendChild(this.ticksContainer),this.sliderElem.appendChild(m),this.sliderElem.appendChild(n),q.insertBefore(this.sliderElem,this.element),this.element.style.display="none"}if(a&&(this.$element=a(this.element),this.$sliderElem=a(this.sliderElem)),this.eventToCallbackMap={},this.sliderElem.id=this.options.id,this.touchCapable="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,this.touchX=0,this.touchY=0,this.tooltip=this.sliderElem.querySelector(".tooltip-main"),this.tooltipInner=this.tooltip.querySelector(".tooltip-inner"),this.tooltip_min=this.sliderElem.querySelector(".tooltip-min"),this.tooltipInner_min=this.tooltip_min.querySelector(".tooltip-inner"),this.tooltip_max=this.sliderElem.querySelector(".tooltip-max"),this.tooltipInner_max=this.tooltip_max.querySelector(".tooltip-inner"),g[this.options.scale]&&(this.options.scale=g[this.options.scale]),p===!0&&(this._removeClass(this.sliderElem,"slider-horizontal"),this._removeClass(this.sliderElem,"slider-vertical"),this._removeClass(this.sliderElem,"slider-rtl"),this._removeClass(this.tooltip,"hide"),this._removeClass(this.tooltip_min,"hide"),this._removeClass(this.tooltip_max,"hide"),["left","right","top","width","height"].forEach(function(a){this._removeProperty(this.trackLow,a),this._removeProperty(this.trackSelection,a),this._removeProperty(this.trackHigh,a)},this),[this.handle1,this.handle2].forEach(function(a){this._removeProperty(a,"left"),this._removeProperty(a,"right"),this._removeProperty(a,"top")},this),[this.tooltip,this.tooltip_min,this.tooltip_max].forEach(function(a){this._removeProperty(a,"left"),this._removeProperty(a,"right"),this._removeProperty(a,"top"),this._removeClass(a,"right"),this._removeClass(a,"left"),this._removeClass(a,"top")},this)),"vertical"===this.options.orientation?(this._addClass(this.sliderElem,"slider-vertical"),this.stylePos="top",this.mousePos="pageY",this.sizePos="offsetHeight"):(this._addClass(this.sliderElem,"slider-horizontal"),this.sliderElem.style.width=o,this.options.orientation="horizontal",this.options.rtl?this.stylePos="right":this.stylePos="left",this.mousePos="pageX",this.sizePos="offsetWidth"),this.options.rtl&&this._addClass(this.sliderElem,"slider-rtl"),this._setTooltipPosition(),Array.isArray(this.options.ticks)&&this.options.ticks.length>0&&(this.options.max=Math.max.apply(Math,this.options.ticks),this.options.min=Math.min.apply(Math,this.options.ticks)),Array.isArray(this.options.value)?(this.options.range=!0,this._state.value=this.options.value):this.options.range?this._state.value=[this.options.value,this.options.max]:this._state.value=this.options.value,this.trackLow=k||this.trackLow,this.trackSelection=j||this.trackSelection,this.trackHigh=l||this.trackHigh,"none"===this.options.selection?(this._addClass(this.trackLow,"hide"),this._addClass(this.trackSelection,"hide"),this._addClass(this.trackHigh,"hide")):("after"===this.options.selection||"before"===this.options.selection)&&(this._removeClass(this.trackLow,"hide"),this._removeClass(this.trackSelection,"hide"),this._removeClass(this.trackHigh,"hide")),this.handle1=m||this.handle1,this.handle2=n||this.handle2,p===!0)for(this._removeClass(this.handle1,"round triangle"),this._removeClass(this.handle2,"round triangle hide"),f=0;f<this.ticks.length;f++)this._removeClass(this.ticks[f],"round triangle hide");var I=["round","triangle","custom"],J=-1!==I.indexOf(this.options.handle);if(J)for(this._addClass(this.handle1,this.options.handle),this._addClass(this.handle2,this.options.handle),f=0;f<this.ticks.length;f++)this._addClass(this.ticks[f],this.options.handle);if(this._state.offset=this._offset(this.sliderElem),this._state.size=this.sliderElem[this.sizePos],this.setValue(this._state.value),this.handle1Keydown=this._keydown.bind(this,0),this.handle1.addEventListener("keydown",this.handle1Keydown,!1),this.handle2Keydown=this._keydown.bind(this,1),this.handle2.addEventListener("keydown",this.handle2Keydown,!1),this.mousedown=this._mousedown.bind(this),this.touchstart=this._touchstart.bind(this),this.touchmove=this._touchmove.bind(this),this.touchCapable){var K=!1;try{var L=Object.defineProperty({},"passive",{get:function(){K=!0}});window.addEventListener("test",null,L)}catch(M){}var N=K?{passive:!0}:!1;this.sliderElem.addEventListener("touchstart",this.touchstart,N),this.sliderElem.addEventListener("touchmove",this.touchmove,N)}if(this.sliderElem.addEventListener("mousedown",this.mousedown,!1),this.resize=this._resize.bind(this),window.addEventListener("resize",this.resize,!1),"hide"===this.options.tooltip)this._addClass(this.tooltip,"hide"),this._addClass(this.tooltip_min,"hide"),this._addClass(this.tooltip_max,"hide");else if("always"===this.options.tooltip)this._showTooltip(),this._alwaysShowTooltip=!0;else{if(this.showTooltip=this._showTooltip.bind(this),this.hideTooltip=this._hideTooltip.bind(this),this.options.ticks_tooltip){var O=this._addTickListener(),P=O.addMouseEnter(this,this.handle1),Q=O.addMouseLeave(this,this.handle1);this.handleCallbackMap.handle1={mouseEnter:P,mouseLeave:Q},P=O.addMouseEnter(this,this.handle2),Q=O.addMouseLeave(this,this.handle2),this.handleCallbackMap.handle2={mouseEnter:P,mouseLeave:Q}}else this.sliderElem.addEventListener("mouseenter",this.showTooltip,!1),this.sliderElem.addEventListener("mouseleave",this.hideTooltip,!1);this.handle1.addEventListener("focus",this.showTooltip,!1),this.handle1.addEventListener("blur",this.hideTooltip,!1),this.handle2.addEventListener("focus",this.showTooltip,!1),this.handle2.addEventListener("blur",this.hideTooltip,!1)}this.options.enabled?this.enable():this.disable()}var f={formatInvalidInputErrorMsg:function(a){return"Invalid input value '"+a+"' passed in"},callingContextNotSliderInstance:"Calling context element does not have instance of Slider bound to it. Check your code to make sure the JQuery object returned from the call to the slider() initializer is calling the method"},g={linear:{toValue:function(a){var b=a/100*(this.options.max-this.options.min),c=!0;if(this.options.ticks_positions.length>0){for(var d,e,f,g=0,h=1;h<this.options.ticks_positions.length;h++)if(a<=this.options.ticks_positions[h]){d=this.options.ticks[h-1],f=this.options.ticks_positions[h-1],e=this.options.ticks[h],g=this.options.ticks_positions[h];break}var i=(a-f)/(g-f);b=d+i*(e-d),c=!1}var j=c?this.options.min:0,k=j+Math.round(b/this.options.step)*this.options.step;return k<this.options.min?this.options.min:k>this.options.max?this.options.max:k},toPercentage:function(a){if(this.options.max===this.options.min)return 0;if(this.options.ticks_positions.length>0){for(var b,c,d,e=0,f=0;f<this.options.ticks.length;f++)if(a<=this.options.ticks[f]){b=f>0?this.options.ticks[f-1]:0,d=f>0?this.options.ticks_positions[f-1]:0,c=this.options.ticks[f],e=this.options.ticks_positions[f];break}if(f>0){var g=(a-b)/(c-b);return d+g*(e-d)}}return 100*(a-this.options.min)/(this.options.max-this.options.min)}},logarithmic:{toValue:function(a){var b=0===this.options.min?0:Math.log(this.options.min),c=Math.log(this.options.max),d=Math.exp(b+(c-b)*a/100);return Math.round(d)===this.options.max?this.options.max:(d=this.options.min+Math.round((d-this.options.min)/this.options.step)*this.options.step,d<this.options.min?this.options.min:d>this.options.max?this.options.max:d)},toPercentage:function(a){if(this.options.max===this.options.min)return 0;var b=Math.log(this.options.max),c=0===this.options.min?0:Math.log(this.options.min),d=0===a?0:Math.log(a);return 100*(d-c)/(b-c)}}};if(d=function(a,b){return e.call(this,a,b),this},d.prototype={_init:function(){},constructor:d,defaultOptions:{id:"",min:0,max:10,step:1,precision:0,orientation:"horizontal",value:5,range:!1,selection:"before",tooltip:"show",tooltip_split:!1,handle:"round",reversed:!1,rtl:"auto",enabled:!0,formatter:function(a){return Array.isArray(a)?a[0]+" : "+a[1]:a},natural_arrow_keys:!1,ticks:[],ticks_positions:[],ticks_labels:[],ticks_snap_bounds:0,ticks_tooltip:!1,scale:"linear",focus:!1,tooltip_position:null,labelledby:null,rangeHighlights:[]},getElement:function(){return this.sliderElem},getValue:function(){return this.options.range?this._state.value:this._state.value[0]},setValue:function(a,b,c){a||(a=0);var d=this.getValue();this._state.value=this._validateInputValue(a);var e=this._applyPrecision.bind(this);this.options.range?(this._state.value[0]=e(this._state.value[0]),this._state.value[1]=e(this._state.value[1]),this._state.value[0]=Math.max(this.options.min,Math.min(this.options.max,this._state.value[0])),this._state.value[1]=Math.max(this.options.min,Math.min(this.options.max,this._state.value[1]))):(this._state.value=e(this._state.value),this._state.value=[Math.max(this.options.min,Math.min(this.options.max,this._state.value))],this._addClass(this.handle2,"hide"),"after"===this.options.selection?this._state.value[1]=this.options.max:this._state.value[1]=this.options.min),this.options.max>this.options.min?this._state.percentage=[this._toPercentage(this._state.value[0]),this._toPercentage(this._state.value[1]),100*this.options.step/(this.options.max-this.options.min)]:this._state.percentage=[0,0,100],this._layout();var f=this.options.range?this._state.value:this._state.value[0];return this._setDataVal(f),b===!0&&this._trigger("slide",f),d!==f&&c===!0&&this._trigger("change",{oldValue:d,newValue:f}),this},destroy:function(){this._removeSliderEventHandlers(),this.sliderElem.parentNode.removeChild(this.sliderElem),this.element.style.display="",this._cleanUpEventCallbacksMap(),this.element.removeAttribute("data"),a&&(this._unbindJQueryEventHandlers(),this.$element.removeData("slider"))},disable:function(){return this._state.enabled=!1,this.handle1.removeAttribute("tabindex"),this.handle2.removeAttribute("tabindex"),this._addClass(this.sliderElem,"slider-disabled"),this._trigger("slideDisabled"),this},enable:function(){return this._state.enabled=!0,this.handle1.setAttribute("tabindex",0),this.handle2.setAttribute("tabindex",0),this._removeClass(this.sliderElem,"slider-disabled"),this._trigger("slideEnabled"),this},toggle:function(){return this._state.enabled?this.disable():this.enable(),this},isEnabled:function(){return this._state.enabled},on:function(a,b){return this._bindNonQueryEventHandler(a,b),this},off:function(b,c){a?(this.$element.off(b,c),this.$sliderElem.off(b,c)):this._unbindNonQueryEventHandler(b,c)},getAttribute:function(a){return a?this.options[a]:this.options},setAttribute:function(a,b){return this.options[a]=b,this},refresh:function(){return this._removeSliderEventHandlers(),e.call(this,this.element,this.options),a&&a.data(this.element,"slider",this),this},relayout:function(){return this._resize(),this._layout(),this},_removeSliderEventHandlers:function(){if(this.handle1.removeEventListener("keydown",this.handle1Keydown,!1),this.handle2.removeEventListener("keydown",this.handle2Keydown,!1),this.options.ticks_tooltip){for(var a=this.ticksContainer.getElementsByClassName("slider-tick"),b=0;b<a.length;b++)a[b].removeEventListener("mouseenter",this.ticksCallbackMap[b].mouseEnter,!1),a[b].removeEventListener("mouseleave",this.ticksCallbackMap[b].mouseLeave,!1);this.handle1.removeEventListener("mouseenter",this.handleCallbackMap.handle1.mouseEnter,!1),this.handle2.removeEventListener("mouseenter",this.handleCallbackMap.handle2.mouseEnter,!1),this.handle1.removeEventListener("mouseleave",this.handleCallbackMap.handle1.mouseLeave,!1),this.handle2.removeEventListener("mouseleave",this.handleCallbackMap.handle2.mouseLeave,!1)}this.handleCallbackMap=null,this.ticksCallbackMap=null,this.showTooltip&&(this.handle1.removeEventListener("focus",this.showTooltip,!1),this.handle2.removeEventListener("focus",this.showTooltip,!1)),this.hideTooltip&&(this.handle1.removeEventListener("blur",this.hideTooltip,!1),this.handle2.removeEventListener("blur",this.hideTooltip,!1)),this.showTooltip&&this.sliderElem.removeEventListener("mouseenter",this.showTooltip,!1),this.hideTooltip&&this.sliderElem.removeEventListener("mouseleave",this.hideTooltip,!1),this.sliderElem.removeEventListener("touchstart",this.touchstart,!1),this.sliderElem.removeEventListener("touchmove",this.touchmove,!1),this.sliderElem.removeEventListener("mousedown",this.mousedown,!1),window.removeEventListener("resize",this.resize,!1)},_bindNonQueryEventHandler:function(a,b){void 0===this.eventToCallbackMap[a]&&(this.eventToCallbackMap[a]=[]),this.eventToCallbackMap[a].push(b)},_unbindNonQueryEventHandler:function(a,b){var c=this.eventToCallbackMap[a];if(void 0!==c)for(var d=0;d<c.length;d++)if(c[d]===b){c.splice(d,1);break}},_cleanUpEventCallbacksMap:function(){for(var a=Object.keys(this.eventToCallbackMap),b=0;b<a.length;b++){var c=a[b];delete this.eventToCallbackMap[c]}},_showTooltip:function(){this.options.tooltip_split===!1?(this._addClass(this.tooltip,"in"),this.tooltip_min.style.display="none",this.tooltip_max.style.display="none"):(this._addClass(this.tooltip_min,"in"),this._addClass(this.tooltip_max,"in"),this.tooltip.style.display="none"),this._state.over=!0},_hideTooltip:function(){this._state.inDrag===!1&&this.alwaysShowTooltip!==!0&&(this._removeClass(this.tooltip,"in"),this._removeClass(this.tooltip_min,"in"),this._removeClass(this.tooltip_max,"in")),this._state.over=!1},_setToolTipOnMouseOver:function(a){function b(a,b){return b?[100-a.percentage[0],this.options.range?100-a.percentage[1]:a.percentage[1]]:[a.percentage[0],a.percentage[1]]}var c=this.options.formatter(a?a.value[0]:this._state.value[0]),d=a?b(a,this.options.reversed):b(this._state,this.options.reversed);this._setText(this.tooltipInner,c),this.tooltip.style[this.stylePos]=d[0]+"%"},_addTickListener:function(){return{addMouseEnter:function(a,b,c){var d=function(){var b=a._state,d=c>=0?c:this.attributes["aria-valuenow"].value,e=parseInt(d,10);b.value[0]=e,b.percentage[0]=a.options.ticks_positions[e],a._setToolTipOnMouseOver(b),a._showTooltip()};return b.addEventListener("mouseenter",d,!1),d},addMouseLeave:function(a,b){var c=function(){a._hideTooltip()};return b.addEventListener("mouseleave",c,!1),c}}},_layout:function(){var a;if(a=this.options.reversed?[100-this._state.percentage[0],this.options.range?100-this._state.percentage[1]:this._state.percentage[1]]:[this._state.percentage[0],this._state.percentage[1]],this.handle1.style[this.stylePos]=a[0]+"%",this.handle1.setAttribute("aria-valuenow",this._state.value[0]),isNaN(this.options.formatter(this._state.value[0]))&&this.handle1.setAttribute("aria-valuetext",this.options.formatter(this._state.value[0])),this.handle2.style[this.stylePos]=a[1]+"%",this.handle2.setAttribute("aria-valuenow",this._state.value[1]),isNaN(this.options.formatter(this._state.value[1]))&&this.handle2.setAttribute("aria-valuetext",this.options.formatter(this._state.value[1])),this.rangeHighlightElements.length>0&&Array.isArray(this.options.rangeHighlights)&&this.options.rangeHighlights.length>0)for(var b=0;b<this.options.rangeHighlights.length;b++){var c=this._toPercentage(this.options.rangeHighlights[b].start),d=this._toPercentage(this.options.rangeHighlights[b].end);if(this.options.reversed){var e=100-d;d=100-c,c=e}var f=this._createHighlightRange(c,d);f?"vertical"===this.options.orientation?(this.rangeHighlightElements[b].style.top=f.start+"%",this.rangeHighlightElements[b].style.height=f.size+"%"):(this.options.rtl?this.rangeHighlightElements[b].style.right=f.start+"%":this.rangeHighlightElements[b].style.left=f.start+"%",this.rangeHighlightElements[b].style.width=f.size+"%"):this.rangeHighlightElements[b].style.display="none"}if(Array.isArray(this.options.ticks)&&this.options.ticks.length>0){var g,h="vertical"===this.options.orientation?"height":"width";g="vertical"===this.options.orientation?"marginTop":this.options.rtl?"marginRight":"marginLeft";var i=this._state.size/(this.options.ticks.length-1);if(this.tickLabelContainer){var j=0;if(0===this.options.ticks_positions.length)"vertical"!==this.options.orientation&&(this.tickLabelContainer.style[g]=-i/2+"px"),j=this.tickLabelContainer.offsetHeight;else for(k=0;k<this.tickLabelContainer.childNodes.length;k++)this.tickLabelContainer.childNodes[k].offsetHeight>j&&(j=this.tickLabelContainer.childNodes[k].offsetHeight);"horizontal"===this.options.orientation&&(this.sliderElem.style.marginBottom=j+"px")}for(var k=0;k<this.options.ticks.length;k++){var l=this.options.ticks_positions[k]||this._toPercentage(this.options.ticks[k]);this.options.reversed&&(l=100-l),this.ticks[k].style[this.stylePos]=l+"%",this._removeClass(this.ticks[k],"in-selection"),this.options.range?l>=a[0]&&l<=a[1]&&this._addClass(this.ticks[k],"in-selection"):"after"===this.options.selection&&l>=a[0]?this._addClass(this.ticks[k],"in-selection"):"before"===this.options.selection&&l<=a[0]&&this._addClass(this.ticks[k],"in-selection"),this.tickLabels[k]&&(this.tickLabels[k].style[h]=i+"px","vertical"!==this.options.orientation&&void 0!==this.options.ticks_positions[k]?(this.tickLabels[k].style.position="absolute",this.tickLabels[k].style[this.stylePos]=l+"%",this.tickLabels[k].style[g]=-i/2+"px"):"vertical"===this.options.orientation&&(this.options.rtl?this.tickLabels[k].style.marginRight=this.sliderElem.offsetWidth+"px":this.tickLabels[k].style.marginLeft=this.sliderElem.offsetWidth+"px",this.tickLabelContainer.style[g]=this.sliderElem.offsetWidth/2*-1+"px"))}}var m;if(this.options.range){m=this.options.formatter(this._state.value),this._setText(this.tooltipInner,m),this.tooltip.style[this.stylePos]=(a[1]+a[0])/2+"%";var n=this.options.formatter(this._state.value[0]);this._setText(this.tooltipInner_min,n);var o=this.options.formatter(this._state.value[1]);this._setText(this.tooltipInner_max,o),this.tooltip_min.style[this.stylePos]=a[0]+"%",this.tooltip_max.style[this.stylePos]=a[1]+"%"}else m=this.options.formatter(this._state.value[0]),this._setText(this.tooltipInner,m),this.tooltip.style[this.stylePos]=a[0]+"%";if("vertical"===this.options.orientation)this.trackLow.style.top="0",this.trackLow.style.height=Math.min(a[0],a[1])+"%",this.trackSelection.style.top=Math.min(a[0],a[1])+"%",this.trackSelection.style.height=Math.abs(a[0]-a[1])+"%",this.trackHigh.style.bottom="0",this.trackHigh.style.height=100-Math.min(a[0],a[1])-Math.abs(a[0]-a[1])+"%";else{"right"===this.stylePos?this.trackLow.style.right="0":this.trackLow.style.left="0",this.trackLow.style.width=Math.min(a[0],a[1])+"%","right"===this.stylePos?this.trackSelection.style.right=Math.min(a[0],a[1])+"%":this.trackSelection.style.left=Math.min(a[0],a[1])+"%",this.trackSelection.style.width=Math.abs(a[0]-a[1])+"%","right"===this.stylePos?this.trackHigh.style.left="0":this.trackHigh.style.right="0",this.trackHigh.style.width=100-Math.min(a[0],a[1])-Math.abs(a[0]-a[1])+"%";var p=this.tooltip_min.getBoundingClientRect(),q=this.tooltip_max.getBoundingClientRect();"bottom"===this.options.tooltip_position?p.right>q.left?(this._removeClass(this.tooltip_max,"bottom"),this._addClass(this.tooltip_max,"top"),this.tooltip_max.style.top="",this.tooltip_max.style.bottom="22px"):(this._removeClass(this.tooltip_max,"top"),this._addClass(this.tooltip_max,"bottom"),this.tooltip_max.style.top=this.tooltip_min.style.top,this.tooltip_max.style.bottom=""):p.right>q.left?(this._removeClass(this.tooltip_max,"top"),this._addClass(this.tooltip_max,"bottom"),this.tooltip_max.style.top="18px"):(this._removeClass(this.tooltip_max,"bottom"),this._addClass(this.tooltip_max,"top"),this.tooltip_max.style.top=this.tooltip_min.style.top)}},_createHighlightRange:function(a,b){return this._isHighlightRange(a,b)?a>b?{start:b,size:a-b}:{start:a,size:b-a}:null},_isHighlightRange:function(a,b){return a>=0&&100>=a&&b>=0&&100>=b?!0:!1},_resize:function(a){this._state.offset=this._offset(this.sliderElem),this._state.size=this.sliderElem[this.sizePos],this._layout()},_removeProperty:function(a,b){a.style.removeProperty?a.style.removeProperty(b):a.style.removeAttribute(b)},_mousedown:function(a){if(!this._state.enabled)return!1;this._state.offset=this._offset(this.sliderElem),this._state.size=this.sliderElem[this.sizePos];var b=this._getPercentage(a);if(this.options.range){var c=Math.abs(this._state.percentage[0]-b),d=Math.abs(this._state.percentage[1]-b);this._state.dragged=d>c?0:1,this._adjustPercentageForRangeSliders(b)}else this._state.dragged=0;this._state.percentage[this._state.dragged]=b,this._layout(),this.touchCapable&&(document.removeEventListener("touchmove",this.mousemove,!1),document.removeEventListener("touchend",this.mouseup,!1)),this.mousemove&&document.removeEventListener("mousemove",this.mousemove,!1),this.mouseup&&document.removeEventListener("mouseup",this.mouseup,!1),this.mousemove=this._mousemove.bind(this),this.mouseup=this._mouseup.bind(this),this.touchCapable&&(document.addEventListener("touchmove",this.mousemove,!1),document.addEventListener("touchend",this.mouseup,!1)),document.addEventListener("mousemove",this.mousemove,!1),document.addEventListener("mouseup",this.mouseup,!1),this._state.inDrag=!0;var e=this._calculateValue();return this._trigger("slideStart",e),this._setDataVal(e),this.setValue(e,!1,!0),a.returnValue=!1,this.options.focus&&this._triggerFocusOnHandle(this._state.dragged),!0},_touchstart:function(a){if(void 0===a.changedTouches)return void this._mousedown(a);var b=a.changedTouches[0];this.touchX=b.pageX,this.touchY=b.pageY},_triggerFocusOnHandle:function(a){0===a&&this.handle1.focus(),1===a&&this.handle2.focus()},_keydown:function(a,b){if(!this._state.enabled)return!1;var c;switch(b.keyCode){case 37:case 40:c=-1;break;case 39:case 38:c=1}if(c){if(this.options.natural_arrow_keys){var d="vertical"===this.options.orientation&&!this.options.reversed,e="horizontal"===this.options.orientation&&this.options.reversed;(d||e)&&(c=-c)}var f=this._state.value[a]+c*this.options.step,g=f/this.options.max*100;if(this._state.keyCtrl=a,this.options.range){this._adjustPercentageForRangeSliders(g);var h=this._state.keyCtrl?this._state.value[0]:f,i=this._state.keyCtrl?f:this._state.value[1];f=[h,i]}return this._trigger("slideStart",f),this._setDataVal(f),this.setValue(f,!0,!0),this._setDataVal(f),this._trigger("slideStop",f),this._layout(),this._pauseEvent(b),delete this._state.keyCtrl,!1}},_pauseEvent:function(a){a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(),a.cancelBubble=!0,a.returnValue=!1},_mousemove:function(a){if(!this._state.enabled)return!1;var b=this._getPercentage(a);this._adjustPercentageForRangeSliders(b),this._state.percentage[this._state.dragged]=b,this._layout();var c=this._calculateValue(!0);return this.setValue(c,!0,!0),!1},_touchmove:function(a){if(void 0!==a.changedTouches){var b=a.changedTouches[0],c=b.pageX-this.touchX,d=b.pageY-this.touchY;this._state.inDrag||("vertical"===this.options.orientation&&5>=c&&c>=-5&&(d>=15||-15>=d)?this._mousedown(a):5>=d&&d>=-5&&(c>=15||-15>=c)&&this._mousedown(a))}},_adjustPercentageForRangeSliders:function(a){if(this.options.range){var b=this._getNumDigitsAfterDecimalPlace(a);b=b?b-1:0;var c=this._applyToFixedAndParseFloat(a,b);0===this._state.dragged&&this._applyToFixedAndParseFloat(this._state.percentage[1],b)<c?(this._state.percentage[0]=this._state.percentage[1],this._state.dragged=1):1===this._state.dragged&&this._applyToFixedAndParseFloat(this._state.percentage[0],b)>c?(this._state.percentage[1]=this._state.percentage[0],this._state.dragged=0):0===this._state.keyCtrl&&this._state.value[1]/this.options.max*100<a?(this._state.percentage[0]=this._state.percentage[1],this._state.keyCtrl=1,this.handle2.focus()):1===this._state.keyCtrl&&this._state.value[0]/this.options.max*100>a&&(this._state.percentage[1]=this._state.percentage[0],this._state.keyCtrl=0,this.handle1.focus())}},_mouseup:function(){if(!this._state.enabled)return!1;this.touchCapable&&(document.removeEventListener("touchmove",this.mousemove,!1),document.removeEventListener("touchend",this.mouseup,!1)),document.removeEventListener("mousemove",this.mousemove,!1),document.removeEventListener("mouseup",this.mouseup,!1),this._state.inDrag=!1,this._state.over===!1&&this._hideTooltip();var a=this._calculateValue(!0);return this._layout(),this._setDataVal(a),this._trigger("slideStop",a),!1},_calculateValue:function(a){var b;if(this.options.range?(b=[this.options.min,this.options.max],0!==this._state.percentage[0]&&(b[0]=this._toValue(this._state.percentage[0]),b[0]=this._applyPrecision(b[0])),100!==this._state.percentage[1]&&(b[1]=this._toValue(this._state.percentage[1]),b[1]=this._applyPrecision(b[1]))):(b=this._toValue(this._state.percentage[0]),b=parseFloat(b),b=this._applyPrecision(b)),a){for(var c=[b,1/0],d=0;d<this.options.ticks.length;d++){var e=Math.abs(this.options.ticks[d]-b);e<=c[1]&&(c=[this.options.ticks[d],e])}if(c[1]<=this.options.ticks_snap_bounds)return c[0]}return b},_applyPrecision:function(a){var b=this.options.precision||this._getNumDigitsAfterDecimalPlace(this.options.step);return this._applyToFixedAndParseFloat(a,b)},_getNumDigitsAfterDecimalPlace:function(a){var b=(""+a).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return b?Math.max(0,(b[1]?b[1].length:0)-(b[2]?+b[2]:0)):0},_applyToFixedAndParseFloat:function(a,b){var c=a.toFixed(b);return parseFloat(c)},_getPercentage:function(a){!this.touchCapable||"touchstart"!==a.type&&"touchmove"!==a.type||(a=a.touches[0]);var b=a[this.mousePos],c=this._state.offset[this.stylePos],d=b-c;"right"===this.stylePos&&(d=-d);var e=d/this._state.size*100;return e=Math.round(e/this._state.percentage[2])*this._state.percentage[2],this.options.reversed&&(e=100-e),Math.max(0,Math.min(100,e))},_validateInputValue:function(a){if(isNaN(+a)){if(Array.isArray(a))return this._validateArray(a),a;throw new Error(f.formatInvalidInputErrorMsg(a))}return+a},_validateArray:function(a){for(var b=0;b<a.length;b++){ var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},windowIsDefined="object"===("undefined"==typeof window?"undefined":_typeof(window));!function(a){if("function"==typeof define&&define.amd)define('bootstrap.slider',["jquery"],a);else if("object"===("undefined"==typeof module?"undefined":_typeof(module))&&module.exports){var b;try{b=require("jquery")}catch(c){b=null}module.exports=a(b)}else window&&(window.Slider=a(window.jQuery))}(function(a){var b="slider",c="bootstrapSlider";windowIsDefined&&!window.console&&(window.console={}),windowIsDefined&&!window.console.log&&(window.console.log=function(){}),windowIsDefined&&!window.console.warn&&(window.console.warn=function(){});var d;return function(a){function b(){}function c(a){function c(b){b.prototype.option||(b.prototype.option=function(b){a.isPlainObject(b)&&(this.options=a.extend(!0,this.options,b))})}function e(b,c){a.fn[b]=function(e){if("string"==typeof e){for(var g=d.call(arguments,1),h=0,i=this.length;i>h;h++){var j=this[h],k=a.data(j,b);if(k)if(a.isFunction(k[e])&&"_"!==e.charAt(0)){var l=k[e].apply(k,g);if(void 0!==l&&l!==k)return l}else f("no such method '"+e+"' for "+b+" instance");else f("cannot call methods on "+b+" prior to initialization; attempted to call '"+e+"'")}return this}var m=this.map(function(){var d=a.data(this,b);return d?(d.option(e),d._init()):(d=new c(this,e),a.data(this,b,d)),a(this)});return!m||m.length>1?m:m[0]}}if(a){var f="undefined"==typeof console?b:function(a){console.error(a)};return a.bridget=function(a,b){c(b),e(a,b)},a.bridget}}var d=Array.prototype.slice;c(a)}(a),function(a){function e(b,c){function d(a,b){var c="data-slider-"+b.replace(/_/g,"-"),d=a.getAttribute(c);try{return JSON.parse(d)}catch(e){return d}}this._state={value:null,enabled:null,offset:null,size:null,percentage:null,inDrag:!1,over:!1},this.ticksCallbackMap={},this.handleCallbackMap={},"string"==typeof b?this.element=document.querySelector(b):b instanceof HTMLElement&&(this.element=b),c=c?c:{};for(var e=Object.keys(this.defaultOptions),f=0;f<e.length;f++){var h=e[f],i=c[h];i="undefined"!=typeof i?i:d(this.element,h),i=null!==i?i:this.defaultOptions[h],this.options||(this.options={}),this.options[h]=i}"auto"===this.options.rtl&&(this.options.rtl="rtl"===window.getComputedStyle(this.element).direction),"vertical"!==this.options.orientation||"top"!==this.options.tooltip_position&&"bottom"!==this.options.tooltip_position?"horizontal"!==this.options.orientation||"left"!==this.options.tooltip_position&&"right"!==this.options.tooltip_position||(this.options.tooltip_position="top"):this.options.rtl?this.options.tooltip_position="left":this.options.tooltip_position="right";var j,k,l,m,n,o=this.element.style.width,p=!1,q=this.element.parentNode;if(this.sliderElem)p=!0;else{this.sliderElem=document.createElement("div"),this.sliderElem.className="slider";var r=document.createElement("div");r.className="slider-track",k=document.createElement("div"),k.className="slider-track-low",j=document.createElement("div"),j.className="slider-selection",l=document.createElement("div"),l.className="slider-track-high",m=document.createElement("div"),m.className="slider-handle min-slider-handle",m.setAttribute("role","slider"),m.setAttribute("aria-valuemin",this.options.min),m.setAttribute("aria-valuemax",this.options.max),n=document.createElement("div"),n.className="slider-handle max-slider-handle",n.setAttribute("role","slider"),n.setAttribute("aria-valuemin",this.options.min),n.setAttribute("aria-valuemax",this.options.max),r.appendChild(k),r.appendChild(j),r.appendChild(l),this.rangeHighlightElements=[];var s=this.options.rangeHighlights;if(Array.isArray(s)&&s.length>0)for(var t=0;t<s.length;t++){var u=document.createElement("div"),v=s[t]["class"]||"";u.className="slider-rangeHighlight slider-selection "+v,this.rangeHighlightElements.push(u),r.appendChild(u)}var w=Array.isArray(this.options.labelledby);if(w&&this.options.labelledby[0]&&m.setAttribute("aria-labelledby",this.options.labelledby[0]),w&&this.options.labelledby[1]&&n.setAttribute("aria-labelledby",this.options.labelledby[1]),!w&&this.options.labelledby&&(m.setAttribute("aria-labelledby",this.options.labelledby),n.setAttribute("aria-labelledby",this.options.labelledby)),this.ticks=[],Array.isArray(this.options.ticks)&&this.options.ticks.length>0){for(this.ticksContainer=document.createElement("div"),this.ticksContainer.className="slider-tick-container",f=0;f<this.options.ticks.length;f++){var x=document.createElement("div");if(x.className="slider-tick",this.options.ticks_tooltip){var y=this._addTickListener(),z=y.addMouseEnter(this,x,f),A=y.addMouseLeave(this,x);this.ticksCallbackMap[f]={mouseEnter:z,mouseLeave:A}}this.ticks.push(x),this.ticksContainer.appendChild(x)}j.className+=" tick-slider-selection"}if(this.tickLabels=[],Array.isArray(this.options.ticks_labels)&&this.options.ticks_labels.length>0)for(this.tickLabelContainer=document.createElement("div"),this.tickLabelContainer.className="slider-tick-label-container",f=0;f<this.options.ticks_labels.length;f++){var B=document.createElement("div"),C=0===this.options.ticks_positions.length,D=this.options.reversed&&C?this.options.ticks_labels.length-(f+1):f;B.className="slider-tick-label",B.innerHTML=this.options.ticks_labels[D],this.tickLabels.push(B),this.tickLabelContainer.appendChild(B)}var E=function(a){var b=document.createElement("div");b.className="tooltip-arrow";var c=document.createElement("div");c.className="tooltip-inner",a.appendChild(b),a.appendChild(c)},F=document.createElement("div");F.className="tooltip tooltip-main",F.setAttribute("role","presentation"),E(F);var G=document.createElement("div");G.className="tooltip tooltip-min",G.setAttribute("role","presentation"),E(G);var H=document.createElement("div");H.className="tooltip tooltip-max",H.setAttribute("role","presentation"),E(H),this.sliderElem.appendChild(r),this.sliderElem.appendChild(F),this.sliderElem.appendChild(G),this.sliderElem.appendChild(H),this.tickLabelContainer&&this.sliderElem.appendChild(this.tickLabelContainer),this.ticksContainer&&this.sliderElem.appendChild(this.ticksContainer),this.sliderElem.appendChild(m),this.sliderElem.appendChild(n),q.insertBefore(this.sliderElem,this.element),this.element.style.display="none"}if(a&&(this.$element=a(this.element),this.$sliderElem=a(this.sliderElem)),this.eventToCallbackMap={},this.sliderElem.id=this.options.id,this.touchCapable="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,this.touchX=0,this.touchY=0,this.tooltip=this.sliderElem.querySelector(".tooltip-main"),this.tooltipInner=this.tooltip.querySelector(".tooltip-inner"),this.tooltip_min=this.sliderElem.querySelector(".tooltip-min"),this.tooltipInner_min=this.tooltip_min.querySelector(".tooltip-inner"),this.tooltip_max=this.sliderElem.querySelector(".tooltip-max"),this.tooltipInner_max=this.tooltip_max.querySelector(".tooltip-inner"),g[this.options.scale]&&(this.options.scale=g[this.options.scale]),p===!0&&(this._removeClass(this.sliderElem,"slider-horizontal"),this._removeClass(this.sliderElem,"slider-vertical"),this._removeClass(this.sliderElem,"slider-rtl"),this._removeClass(this.tooltip,"hide"),this._removeClass(this.tooltip_min,"hide"),this._removeClass(this.tooltip_max,"hide"),["left","right","top","width","height"].forEach(function(a){this._removeProperty(this.trackLow,a),this._removeProperty(this.trackSelection,a),this._removeProperty(this.trackHigh,a)},this),[this.handle1,this.handle2].forEach(function(a){this._removeProperty(a,"left"),this._removeProperty(a,"right"),this._removeProperty(a,"top")},this),[this.tooltip,this.tooltip_min,this.tooltip_max].forEach(function(a){this._removeProperty(a,"left"),this._removeProperty(a,"right"),this._removeProperty(a,"top"),this._removeClass(a,"right"),this._removeClass(a,"left"),this._removeClass(a,"top")},this)),"vertical"===this.options.orientation?(this._addClass(this.sliderElem,"slider-vertical"),this.stylePos="top",this.mousePos="pageY",this.sizePos="offsetHeight"):(this._addClass(this.sliderElem,"slider-horizontal"),this.sliderElem.style.width=o,this.options.orientation="horizontal",this.options.rtl?this.stylePos="right":this.stylePos="left",this.mousePos="pageX",this.sizePos="offsetWidth"),this.options.rtl&&this._addClass(this.sliderElem,"slider-rtl"),this._setTooltipPosition(),Array.isArray(this.options.ticks)&&this.options.ticks.length>0&&(this.options.max=Math.max.apply(Math,this.options.ticks),this.options.min=Math.min.apply(Math,this.options.ticks)),Array.isArray(this.options.value)?(this.options.range=!0,this._state.value=this.options.value):this.options.range?this._state.value=[this.options.value,this.options.max]:this._state.value=this.options.value,this.trackLow=k||this.trackLow,this.trackSelection=j||this.trackSelection,this.trackHigh=l||this.trackHigh,"none"===this.options.selection?(this._addClass(this.trackLow,"hide"),this._addClass(this.trackSelection,"hide"),this._addClass(this.trackHigh,"hide")):("after"===this.options.selection||"before"===this.options.selection)&&(this._removeClass(this.trackLow,"hide"),this._removeClass(this.trackSelection,"hide"),this._removeClass(this.trackHigh,"hide")),this.handle1=m||this.handle1,this.handle2=n||this.handle2,p===!0)for(this._removeClass(this.handle1,"round triangle"),this._removeClass(this.handle2,"round triangle hide"),f=0;f<this.ticks.length;f++)this._removeClass(this.ticks[f],"round triangle hide");var I=["round","triangle","custom"],J=-1!==I.indexOf(this.options.handle);if(J)for(this._addClass(this.handle1,this.options.handle),this._addClass(this.handle2,this.options.handle),f=0;f<this.ticks.length;f++)this._addClass(this.ticks[f],this.options.handle);if(this._state.offset=this._offset(this.sliderElem),this._state.size=this.sliderElem[this.sizePos],this.setValue(this._state.value),this.handle1Keydown=this._keydown.bind(this,0),this.handle1.addEventListener("keydown",this.handle1Keydown,!1),this.handle2Keydown=this._keydown.bind(this,1),this.handle2.addEventListener("keydown",this.handle2Keydown,!1),this.mousedown=this._mousedown.bind(this),this.touchstart=this._touchstart.bind(this),this.touchmove=this._touchmove.bind(this),this.touchCapable){var K=!1;try{var L=Object.defineProperty({},"passive",{get:function(){K=!0}});window.addEventListener("test",null,L)}catch(M){}var N=K?{passive:!0}:!1;this.sliderElem.addEventListener("touchstart",this.touchstart,N),this.sliderElem.addEventListener("touchmove",this.touchmove,N)}if(this.sliderElem.addEventListener("mousedown",this.mousedown,!1),this.resize=this._resize.bind(this),window.addEventListener("resize",this.resize,!1),"hide"===this.options.tooltip)this._addClass(this.tooltip,"hide"),this._addClass(this.tooltip_min,"hide"),this._addClass(this.tooltip_max,"hide");else if("always"===this.options.tooltip)this._showTooltip(),this._alwaysShowTooltip=!0;else{if(this.showTooltip=this._showTooltip.bind(this),this.hideTooltip=this._hideTooltip.bind(this),this.options.ticks_tooltip){var O=this._addTickListener(),P=O.addMouseEnter(this,this.handle1),Q=O.addMouseLeave(this,this.handle1);this.handleCallbackMap.handle1={mouseEnter:P,mouseLeave:Q},P=O.addMouseEnter(this,this.handle2),Q=O.addMouseLeave(this,this.handle2),this.handleCallbackMap.handle2={mouseEnter:P,mouseLeave:Q}}else this.sliderElem.addEventListener("mouseenter",this.showTooltip,!1),this.sliderElem.addEventListener("mouseleave",this.hideTooltip,!1);this.handle1.addEventListener("focus",this.showTooltip,!1),this.handle1.addEventListener("blur",this.hideTooltip,!1),this.handle2.addEventListener("focus",this.showTooltip,!1),this.handle2.addEventListener("blur",this.hideTooltip,!1)}this.options.enabled?this.enable():this.disable()}var f={formatInvalidInputErrorMsg:function(a){return"Invalid input value '"+a+"' passed in"},callingContextNotSliderInstance:"Calling context element does not have instance of Slider bound to it. Check your code to make sure the JQuery object returned from the call to the slider() initializer is calling the method"},g={linear:{toValue:function(a){var b=a/100*(this.options.max-this.options.min),c=!0;if(this.options.ticks_positions.length>0){for(var d,e,f,g=0,h=1;h<this.options.ticks_positions.length;h++)if(a<=this.options.ticks_positions[h]){d=this.options.ticks[h-1],f=this.options.ticks_positions[h-1],e=this.options.ticks[h],g=this.options.ticks_positions[h];break}var i=(a-f)/(g-f);b=d+i*(e-d),c=!1}var j=c?this.options.min:0,k=j+Math.round(b/this.options.step)*this.options.step;return k<this.options.min?this.options.min:k>this.options.max?this.options.max:k},toPercentage:function(a){if(this.options.max===this.options.min)return 0;if(this.options.ticks_positions.length>0){for(var b,c,d,e=0,f=0;f<this.options.ticks.length;f++)if(a<=this.options.ticks[f]){b=f>0?this.options.ticks[f-1]:0,d=f>0?this.options.ticks_positions[f-1]:0,c=this.options.ticks[f],e=this.options.ticks_positions[f];break}if(f>0){var g=(a-b)/(c-b);return d+g*(e-d)}}return 100*(a-this.options.min)/(this.options.max-this.options.min)}},logarithmic:{toValue:function(a){var b=0===this.options.min?0:Math.log(this.options.min),c=Math.log(this.options.max),d=Math.exp(b+(c-b)*a/100);return Math.round(d)===this.options.max?this.options.max:(d=this.options.min+Math.round((d-this.options.min)/this.options.step)*this.options.step,d<this.options.min?this.options.min:d>this.options.max?this.options.max:d)},toPercentage:function(a){if(this.options.max===this.options.min)return 0;var b=Math.log(this.options.max),c=0===this.options.min?0:Math.log(this.options.min),d=0===a?0:Math.log(a);return 100*(d-c)/(b-c)}}};if(d=function(a,b){return e.call(this,a,b),this},d.prototype={_init:function(){},constructor:d,defaultOptions:{id:"",min:0,max:10,step:1,precision:0,orientation:"horizontal",value:5,range:!1,selection:"before",tooltip:"show",tooltip_split:!1,handle:"round",reversed:!1,rtl:"auto",enabled:!0,formatter:function(a){return Array.isArray(a)?a[0]+" : "+a[1]:a},natural_arrow_keys:!1,ticks:[],ticks_positions:[],ticks_labels:[],ticks_snap_bounds:0,ticks_tooltip:!1,scale:"linear",focus:!1,tooltip_position:null,labelledby:null,rangeHighlights:[]},getElement:function(){return this.sliderElem},getValue:function(){return this.options.range?this._state.value:this._state.value[0]},setValue:function(a,b,c){a||(a=0);var d=this.getValue();this._state.value=this._validateInputValue(a);var e=this._applyPrecision.bind(this);this.options.range?(this._state.value[0]=e(this._state.value[0]),this._state.value[1]=e(this._state.value[1]),this._state.value[0]=Math.max(this.options.min,Math.min(this.options.max,this._state.value[0])),this._state.value[1]=Math.max(this.options.min,Math.min(this.options.max,this._state.value[1]))):(this._state.value=e(this._state.value),this._state.value=[Math.max(this.options.min,Math.min(this.options.max,this._state.value))],this._addClass(this.handle2,"hide"),"after"===this.options.selection?this._state.value[1]=this.options.max:this._state.value[1]=this.options.min),this.options.max>this.options.min?this._state.percentage=[this._toPercentage(this._state.value[0]),this._toPercentage(this._state.value[1]),100*this.options.step/(this.options.max-this.options.min)]:this._state.percentage=[0,0,100],this._layout();var f=this.options.range?this._state.value:this._state.value[0];return this._setDataVal(f),b===!0&&this._trigger("slide",f),d!==f&&c===!0&&this._trigger("change",{oldValue:d,newValue:f}),this},destroy:function(){this._removeSliderEventHandlers(),this.sliderElem.parentNode.removeChild(this.sliderElem),this.element.style.display="",this._cleanUpEventCallbacksMap(),this.element.removeAttribute("data"),a&&(this._unbindJQueryEventHandlers(),this.$element.removeData("slider"))},disable:function(){return this._state.enabled=!1,this.handle1.removeAttribute("tabindex"),this.handle2.removeAttribute("tabindex"),this._addClass(this.sliderElem,"slider-disabled"),this._trigger("slideDisabled"),this},enable:function(){return this._state.enabled=!0,this.handle1.setAttribute("tabindex",0),this.handle2.setAttribute("tabindex",0),this._removeClass(this.sliderElem,"slider-disabled"),this._trigger("slideEnabled"),this},toggle:function(){return this._state.enabled?this.disable():this.enable(),this},isEnabled:function(){return this._state.enabled},on:function(a,b){return this._bindNonQueryEventHandler(a,b),this},off:function(b,c){a?(this.$element.off(b,c),this.$sliderElem.off(b,c)):this._unbindNonQueryEventHandler(b,c)},getAttribute:function(a){return a?this.options[a]:this.options},setAttribute:function(a,b){return this.options[a]=b,this},refresh:function(){return this._removeSliderEventHandlers(),e.call(this,this.element,this.options),a&&a.data(this.element,"slider",this),this},relayout:function(){return this._resize(),this._layout(),this},_removeSliderEventHandlers:function(){if(this.handle1.removeEventListener("keydown",this.handle1Keydown,!1),this.handle2.removeEventListener("keydown",this.handle2Keydown,!1),this.options.ticks_tooltip){for(var a=this.ticksContainer.getElementsByClassName("slider-tick"),b=0;b<a.length;b++)a[b].removeEventListener("mouseenter",this.ticksCallbackMap[b].mouseEnter,!1),a[b].removeEventListener("mouseleave",this.ticksCallbackMap[b].mouseLeave,!1);this.handle1.removeEventListener("mouseenter",this.handleCallbackMap.handle1.mouseEnter,!1),this.handle2.removeEventListener("mouseenter",this.handleCallbackMap.handle2.mouseEnter,!1),this.handle1.removeEventListener("mouseleave",this.handleCallbackMap.handle1.mouseLeave,!1),this.handle2.removeEventListener("mouseleave",this.handleCallbackMap.handle2.mouseLeave,!1)}this.handleCallbackMap=null,this.ticksCallbackMap=null,this.showTooltip&&(this.handle1.removeEventListener("focus",this.showTooltip,!1),this.handle2.removeEventListener("focus",this.showTooltip,!1)),this.hideTooltip&&(this.handle1.removeEventListener("blur",this.hideTooltip,!1),this.handle2.removeEventListener("blur",this.hideTooltip,!1)),this.showTooltip&&this.sliderElem.removeEventListener("mouseenter",this.showTooltip,!1),this.hideTooltip&&this.sliderElem.removeEventListener("mouseleave",this.hideTooltip,!1),this.sliderElem.removeEventListener("touchstart",this.touchstart,!1),this.sliderElem.removeEventListener("touchmove",this.touchmove,!1),this.sliderElem.removeEventListener("mousedown",this.mousedown,!1),window.removeEventListener("resize",this.resize,!1)},_bindNonQueryEventHandler:function(a,b){void 0===this.eventToCallbackMap[a]&&(this.eventToCallbackMap[a]=[]),this.eventToCallbackMap[a].push(b)},_unbindNonQueryEventHandler:function(a,b){var c=this.eventToCallbackMap[a];if(void 0!==c)for(var d=0;d<c.length;d++)if(c[d]===b){c.splice(d,1);break}},_cleanUpEventCallbacksMap:function(){for(var a=Object.keys(this.eventToCallbackMap),b=0;b<a.length;b++){var c=a[b];delete this.eventToCallbackMap[c]}},_showTooltip:function(){this.options.tooltip_split===!1?(this._addClass(this.tooltip,"in"),this.tooltip_min.style.display="none",this.tooltip_max.style.display="none"):(this._addClass(this.tooltip_min,"in"),this._addClass(this.tooltip_max,"in"),this.tooltip.style.display="none"),this._state.over=!0},_hideTooltip:function(){this._state.inDrag===!1&&this.alwaysShowTooltip!==!0&&(this._removeClass(this.tooltip,"in"),this._removeClass(this.tooltip_min,"in"),this._removeClass(this.tooltip_max,"in")),this._state.over=!1},_setToolTipOnMouseOver:function(a){function b(a,b){return b?[100-a.percentage[0],this.options.range?100-a.percentage[1]:a.percentage[1]]:[a.percentage[0],a.percentage[1]]}var c=this.options.formatter(a?a.value[0]:this._state.value[0]),d=a?b(a,this.options.reversed):b(this._state,this.options.reversed);this._setText(this.tooltipInner,c),this.tooltip.style[this.stylePos]=d[0]+"%"},_addTickListener:function(){return{addMouseEnter:function(a,b,c){var d=function(){var b=a._state,d=c>=0?c:this.attributes["aria-valuenow"].value,e=parseInt(d,10);b.value[0]=e,b.percentage[0]=a.options.ticks_positions[e],a._setToolTipOnMouseOver(b),a._showTooltip()};return b.addEventListener("mouseenter",d,!1),d},addMouseLeave:function(a,b){var c=function(){a._hideTooltip()};return b.addEventListener("mouseleave",c,!1),c}}},_layout:function(){var a;if(a=this.options.reversed?[100-this._state.percentage[0],this.options.range?100-this._state.percentage[1]:this._state.percentage[1]]:[this._state.percentage[0],this._state.percentage[1]],this.handle1.style[this.stylePos]=a[0]+"%",this.handle1.setAttribute("aria-valuenow",this._state.value[0]),isNaN(this.options.formatter(this._state.value[0]))&&this.handle1.setAttribute("aria-valuetext",this.options.formatter(this._state.value[0])),this.handle2.style[this.stylePos]=a[1]+"%",this.handle2.setAttribute("aria-valuenow",this._state.value[1]),isNaN(this.options.formatter(this._state.value[1]))&&this.handle2.setAttribute("aria-valuetext",this.options.formatter(this._state.value[1])),this.rangeHighlightElements.length>0&&Array.isArray(this.options.rangeHighlights)&&this.options.rangeHighlights.length>0)for(var b=0;b<this.options.rangeHighlights.length;b++){var c=this._toPercentage(this.options.rangeHighlights[b].start),d=this._toPercentage(this.options.rangeHighlights[b].end);if(this.options.reversed){var e=100-d;d=100-c,c=e}var f=this._createHighlightRange(c,d);f?"vertical"===this.options.orientation?(this.rangeHighlightElements[b].style.top=f.start+"%",this.rangeHighlightElements[b].style.height=f.size+"%"):(this.options.rtl?this.rangeHighlightElements[b].style.right=f.start+"%":this.rangeHighlightElements[b].style.left=f.start+"%",this.rangeHighlightElements[b].style.width=f.size+"%"):this.rangeHighlightElements[b].style.display="none"}if(Array.isArray(this.options.ticks)&&this.options.ticks.length>0){var g,h="vertical"===this.options.orientation?"height":"width";g="vertical"===this.options.orientation?"marginTop":this.options.rtl?"marginRight":"marginLeft";var i=this._state.size/(this.options.ticks.length-1);if(this.tickLabelContainer){var j=0;if(0===this.options.ticks_positions.length)"vertical"!==this.options.orientation&&(this.tickLabelContainer.style[g]=-i/2+"px"),j=this.tickLabelContainer.offsetHeight;else for(k=0;k<this.tickLabelContainer.childNodes.length;k++)this.tickLabelContainer.childNodes[k].offsetHeight>j&&(j=this.tickLabelContainer.childNodes[k].offsetHeight);"horizontal"===this.options.orientation&&(this.sliderElem.style.marginBottom=j+"px")}for(var k=0;k<this.options.ticks.length;k++){var l=this.options.ticks_positions[k]||this._toPercentage(this.options.ticks[k]);this.options.reversed&&(l=100-l),this.ticks[k].style[this.stylePos]=l+"%",this._removeClass(this.ticks[k],"in-selection"),this.options.range?l>=a[0]&&l<=a[1]&&this._addClass(this.ticks[k],"in-selection"):"after"===this.options.selection&&l>=a[0]?this._addClass(this.ticks[k],"in-selection"):"before"===this.options.selection&&l<=a[0]&&this._addClass(this.ticks[k],"in-selection"),this.tickLabels[k]&&(this.tickLabels[k].style[h]=i+"px","vertical"!==this.options.orientation&&void 0!==this.options.ticks_positions[k]?(this.tickLabels[k].style.position="absolute",this.tickLabels[k].style[this.stylePos]=l+"%",this.tickLabels[k].style[g]=-i/2+"px"):"vertical"===this.options.orientation&&(this.options.rtl?this.tickLabels[k].style.marginRight=this.sliderElem.offsetWidth+"px":this.tickLabels[k].style.marginLeft=this.sliderElem.offsetWidth+"px",this.tickLabelContainer.style[g]=this.sliderElem.offsetWidth/2*-1+"px"))}}var m;if(this.options.range){m=this.options.formatter(this._state.value),this._setText(this.tooltipInner,m),this.tooltip.style[this.stylePos]=(a[1]+a[0])/2+"%";var n=this.options.formatter(this._state.value[0]);this._setText(this.tooltipInner_min,n);var o=this.options.formatter(this._state.value[1]);this._setText(this.tooltipInner_max,o),this.tooltip_min.style[this.stylePos]=a[0]+"%",this.tooltip_max.style[this.stylePos]=a[1]+"%"}else m=this.options.formatter(this._state.value[0]),this._setText(this.tooltipInner,m),this.tooltip.style[this.stylePos]=a[0]+"%";if("vertical"===this.options.orientation)this.trackLow.style.top="0",this.trackLow.style.height=Math.min(a[0],a[1])+"%",this.trackSelection.style.top=Math.min(a[0],a[1])+"%",this.trackSelection.style.height=Math.abs(a[0]-a[1])+"%",this.trackHigh.style.bottom="0",this.trackHigh.style.height=100-Math.min(a[0],a[1])-Math.abs(a[0]-a[1])+"%";else{"right"===this.stylePos?this.trackLow.style.right="0":this.trackLow.style.left="0",this.trackLow.style.width=Math.min(a[0],a[1])+"%","right"===this.stylePos?this.trackSelection.style.right=Math.min(a[0],a[1])+"%":this.trackSelection.style.left=Math.min(a[0],a[1])+"%",this.trackSelection.style.width=Math.abs(a[0]-a[1])+"%","right"===this.stylePos?this.trackHigh.style.left="0":this.trackHigh.style.right="0",this.trackHigh.style.width=100-Math.min(a[0],a[1])-Math.abs(a[0]-a[1])+"%";var p=this.tooltip_min.getBoundingClientRect(),q=this.tooltip_max.getBoundingClientRect();"bottom"===this.options.tooltip_position?p.right>q.left?(this._removeClass(this.tooltip_max,"bottom"),this._addClass(this.tooltip_max,"top"),this.tooltip_max.style.top="",this.tooltip_max.style.bottom="22px"):(this._removeClass(this.tooltip_max,"top"),this._addClass(this.tooltip_max,"bottom"),this.tooltip_max.style.top=this.tooltip_min.style.top,this.tooltip_max.style.bottom=""):p.right>q.left?(this._removeClass(this.tooltip_max,"top"),this._addClass(this.tooltip_max,"bottom"),this.tooltip_max.style.top="18px"):(this._removeClass(this.tooltip_max,"bottom"),this._addClass(this.tooltip_max,"top"),this.tooltip_max.style.top=this.tooltip_min.style.top)}},_createHighlightRange:function(a,b){return this._isHighlightRange(a,b)?a>b?{start:b,size:a-b}:{start:a,size:b-a}:null},_isHighlightRange:function(a,b){return a>=0&&100>=a&&b>=0&&100>=b?!0:!1},_resize:function(a){this._state.offset=this._offset(this.sliderElem),this._state.size=this.sliderElem[this.sizePos],this._layout()},_removeProperty:function(a,b){a.style.removeProperty?a.style.removeProperty(b):a.style.removeAttribute(b)},_mousedown:function(a){if(!this._state.enabled)return!1;this._state.offset=this._offset(this.sliderElem),this._state.size=this.sliderElem[this.sizePos];var b=this._getPercentage(a);if(this.options.range){var c=Math.abs(this._state.percentage[0]-b),d=Math.abs(this._state.percentage[1]-b);this._state.dragged=d>c?0:1,this._adjustPercentageForRangeSliders(b)}else this._state.dragged=0;this._state.percentage[this._state.dragged]=b,this._layout(),this.touchCapable&&(document.removeEventListener("touchmove",this.mousemove,!1),document.removeEventListener("touchend",this.mouseup,!1)),this.mousemove&&document.removeEventListener("mousemove",this.mousemove,!1),this.mouseup&&document.removeEventListener("mouseup",this.mouseup,!1),this.mousemove=this._mousemove.bind(this),this.mouseup=this._mouseup.bind(this),this.touchCapable&&(document.addEventListener("touchmove",this.mousemove,!1),document.addEventListener("touchend",this.mouseup,!1)),document.addEventListener("mousemove",this.mousemove,!1),document.addEventListener("mouseup",this.mouseup,!1),this._state.inDrag=!0;var e=this._calculateValue();return this._trigger("slideStart",e),this._setDataVal(e),this.setValue(e,!1,!0),a.returnValue=!1,this.options.focus&&this._triggerFocusOnHandle(this._state.dragged),!0},_touchstart:function(a){if(void 0===a.changedTouches)return void this._mousedown(a);var b=a.changedTouches[0];this.touchX=b.pageX,this.touchY=b.pageY},_triggerFocusOnHandle:function(a){0===a&&this.handle1.focus(),1===a&&this.handle2.focus()},_keydown:function(a,b){if(!this._state.enabled)return!1;var c;switch(b.keyCode){case 37:case 40:c=-1;break;case 39:case 38:c=1}if(c){if(this.options.natural_arrow_keys){var d="vertical"===this.options.orientation&&!this.options.reversed,e="horizontal"===this.options.orientation&&this.options.reversed;(d||e)&&(c=-c)}var f=this._state.value[a]+c*this.options.step,g=f/this.options.max*100;if(this._state.keyCtrl=a,this.options.range){this._adjustPercentageForRangeSliders(g);var h=this._state.keyCtrl?this._state.value[0]:f,i=this._state.keyCtrl?f:this._state.value[1];f=[h,i]}return this._trigger("slideStart",f),this._setDataVal(f),this.setValue(f,!0,!0),this._setDataVal(f),this._trigger("slideStop",f),this._layout(),this._pauseEvent(b),delete this._state.keyCtrl,!1}},_pauseEvent:function(a){a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(),a.cancelBubble=!0,a.returnValue=!1},_mousemove:function(a){if(!this._state.enabled)return!1;var b=this._getPercentage(a);this._adjustPercentageForRangeSliders(b),this._state.percentage[this._state.dragged]=b,this._layout();var c=this._calculateValue(!0);return this.setValue(c,!0,!0),!1},_touchmove:function(a){if(void 0!==a.changedTouches){var b=a.changedTouches[0],c=b.pageX-this.touchX,d=b.pageY-this.touchY;this._state.inDrag||("vertical"===this.options.orientation&&5>=c&&c>=-5&&(d>=15||-15>=d)?this._mousedown(a):5>=d&&d>=-5&&(c>=15||-15>=c)&&this._mousedown(a))}},_adjustPercentageForRangeSliders:function(a){if(this.options.range){var b=this._getNumDigitsAfterDecimalPlace(a);b=b?b-1:0;var c=this._applyToFixedAndParseFloat(a,b);0===this._state.dragged&&this._applyToFixedAndParseFloat(this._state.percentage[1],b)<c?(this._state.percentage[0]=this._state.percentage[1],this._state.dragged=1):1===this._state.dragged&&this._applyToFixedAndParseFloat(this._state.percentage[0],b)>c?(this._state.percentage[1]=this._state.percentage[0],this._state.dragged=0):0===this._state.keyCtrl&&this._state.value[1]/this.options.max*100<a?(this._state.percentage[0]=this._state.percentage[1],this._state.keyCtrl=1,this.handle2.focus()):1===this._state.keyCtrl&&this._state.value[0]/this.options.max*100>a&&(this._state.percentage[1]=this._state.percentage[0],this._state.keyCtrl=0,this.handle1.focus())}},_mouseup:function(){if(!this._state.enabled)return!1;this.touchCapable&&(document.removeEventListener("touchmove",this.mousemove,!1),document.removeEventListener("touchend",this.mouseup,!1)),document.removeEventListener("mousemove",this.mousemove,!1),document.removeEventListener("mouseup",this.mouseup,!1),this._state.inDrag=!1,this._state.over===!1&&this._hideTooltip();var a=this._calculateValue(!0);return this._layout(),this._setDataVal(a),this._trigger("slideStop",a),!1},_calculateValue:function(a){var b;if(this.options.range?(b=[this.options.min,this.options.max],0!==this._state.percentage[0]&&(b[0]=this._toValue(this._state.percentage[0]),b[0]=this._applyPrecision(b[0])),100!==this._state.percentage[1]&&(b[1]=this._toValue(this._state.percentage[1]),b[1]=this._applyPrecision(b[1]))):(b=this._toValue(this._state.percentage[0]),b=parseFloat(b),b=this._applyPrecision(b)),a){for(var c=[b,1/0],d=0;d<this.options.ticks.length;d++){var e=Math.abs(this.options.ticks[d]-b);e<=c[1]&&(c=[this.options.ticks[d],e])}if(c[1]<=this.options.ticks_snap_bounds)return c[0]}return b},_applyPrecision:function(a){var b=this.options.precision||this._getNumDigitsAfterDecimalPlace(this.options.step);return this._applyToFixedAndParseFloat(a,b)},_getNumDigitsAfterDecimalPlace:function(a){var b=(""+a).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return b?Math.max(0,(b[1]?b[1].length:0)-(b[2]?+b[2]:0)):0},_applyToFixedAndParseFloat:function(a,b){var c=a.toFixed(b);return parseFloat(c)},_getPercentage:function(a){!this.touchCapable||"touchstart"!==a.type&&"touchmove"!==a.type||(a=a.touches[0]);var b=a[this.mousePos],c=this._state.offset[this.stylePos],d=b-c;"right"===this.stylePos&&(d=-d);var e=d/this._state.size*100;return e=Math.round(e/this._state.percentage[2])*this._state.percentage[2],this.options.reversed&&(e=100-e),Math.max(0,Math.min(100,e))},_validateInputValue:function(a){if(isNaN(+a)){if(Array.isArray(a))return this._validateArray(a),a;throw new Error(f.formatInvalidInputErrorMsg(a))}return+a},_validateArray:function(a){for(var b=0;b<a.length;b++){
var c=a[b];if("number"!=typeof c)throw new Error(f.formatInvalidInputErrorMsg(c))}},_setDataVal:function(a){this.element.setAttribute("data-value",a),this.element.setAttribute("value",a),this.element.value=a},_trigger:function(b,c){c=c||0===c?c:void 0;var d=this.eventToCallbackMap[b];if(d&&d.length)for(var e=0;e<d.length;e++){var f=d[e];f(c)}a&&this._triggerJQueryEvent(b,c)},_triggerJQueryEvent:function(a,b){var c={type:a,value:b};this.$element.trigger(c),this.$sliderElem.trigger(c)},_unbindJQueryEventHandlers:function(){this.$element.off(),this.$sliderElem.off()},_setText:function(a,b){"undefined"!=typeof a.textContent?a.textContent=b:"undefined"!=typeof a.innerText&&(a.innerText=b)},_removeClass:function(a,b){for(var c=b.split(" "),d=a.className,e=0;e<c.length;e++){var f=c[e],g=new RegExp("(?:\\s|^)"+f+"(?:\\s|$)");d=d.replace(g," ")}a.className=d.trim()},_addClass:function(a,b){for(var c=b.split(" "),d=a.className,e=0;e<c.length;e++){var f=c[e],g=new RegExp("(?:\\s|^)"+f+"(?:\\s|$)"),h=g.test(d);h||(d+=" "+f)}a.className=d.trim()},_offsetLeft:function(a){return a.getBoundingClientRect().left},_offsetRight:function(a){return a.getBoundingClientRect().right},_offsetTop:function(a){for(var b=a.offsetTop;(a=a.offsetParent)&&!isNaN(a.offsetTop);)b+=a.offsetTop,"BODY"!==a.tagName&&(b-=a.scrollTop);return b},_offset:function(a){return{left:this._offsetLeft(a),right:this._offsetRight(a),top:this._offsetTop(a)}},_css:function(b,c,d){if(a)a.style(b,c,d);else{var e=c.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(a,b){return b.toUpperCase()});b.style[e]=d}},_toValue:function(a){return this.options.scale.toValue.apply(this,[a])},_toPercentage:function(a){return this.options.scale.toPercentage.apply(this,[a])},_setTooltipPosition:function(){var a=[this.tooltip,this.tooltip_min,this.tooltip_max];if("vertical"===this.options.orientation){var b;b=this.options.tooltip_position?this.options.tooltip_position:this.options.rtl?"left":"right";var c="left"===b?"right":"left";a.forEach(function(a){this._addClass(a,b),a.style[c]="100%"}.bind(this))}else"bottom"===this.options.tooltip_position?a.forEach(function(a){this._addClass(a,"bottom"),a.style.top="22px"}.bind(this)):a.forEach(function(a){this._addClass(a,"top"),a.style.top=-this.tooltip.outerHeight-14+"px"}.bind(this))}},a&&a.fn){var h=void 0;a.fn.slider?(windowIsDefined&&window.console.warn("bootstrap-slider.js - WARNING: $.fn.slider namespace is already bound. Use the $.fn.bootstrapSlider namespace instead."),h=c):(a.bridget(b,d),h=b),a.bridget(c,d),a(function(){a("input[data-provide=slider]")[h]()})}}(a),d}); var c=a[b];if("number"!=typeof c)throw new Error(f.formatInvalidInputErrorMsg(c))}},_setDataVal:function(a){this.element.setAttribute("data-value",a),this.element.setAttribute("value",a),this.element.value=a},_trigger:function(b,c){c=c||0===c?c:void 0;var d=this.eventToCallbackMap[b];if(d&&d.length)for(var e=0;e<d.length;e++){var f=d[e];f(c)}a&&this._triggerJQueryEvent(b,c)},_triggerJQueryEvent:function(a,b){var c={type:a,value:b};this.$element.trigger(c),this.$sliderElem.trigger(c)},_unbindJQueryEventHandlers:function(){this.$element.off(),this.$sliderElem.off()},_setText:function(a,b){"undefined"!=typeof a.textContent?a.textContent=b:"undefined"!=typeof a.innerText&&(a.innerText=b)},_removeClass:function(a,b){for(var c=b.split(" "),d=a.className,e=0;e<c.length;e++){var f=c[e],g=new RegExp("(?:\\s|^)"+f+"(?:\\s|$)");d=d.replace(g," ")}a.className=d.trim()},_addClass:function(a,b){for(var c=b.split(" "),d=a.className,e=0;e<c.length;e++){var f=c[e],g=new RegExp("(?:\\s|^)"+f+"(?:\\s|$)"),h=g.test(d);h||(d+=" "+f)}a.className=d.trim()},_offsetLeft:function(a){return a.getBoundingClientRect().left},_offsetRight:function(a){return a.getBoundingClientRect().right},_offsetTop:function(a){for(var b=a.offsetTop;(a=a.offsetParent)&&!isNaN(a.offsetTop);)b+=a.offsetTop,"BODY"!==a.tagName&&(b-=a.scrollTop);return b},_offset:function(a){return{left:this._offsetLeft(a),right:this._offsetRight(a),top:this._offsetTop(a)}},_css:function(b,c,d){if(a)a.style(b,c,d);else{var e=c.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(a,b){return b.toUpperCase()});b.style[e]=d}},_toValue:function(a){return this.options.scale.toValue.apply(this,[a])},_toPercentage:function(a){return this.options.scale.toPercentage.apply(this,[a])},_setTooltipPosition:function(){var a=[this.tooltip,this.tooltip_min,this.tooltip_max];if("vertical"===this.options.orientation){var b;b=this.options.tooltip_position?this.options.tooltip_position:this.options.rtl?"left":"right";var c="left"===b?"right":"left";a.forEach(function(a){this._addClass(a,b),a.style[c]="100%"}.bind(this))}else"bottom"===this.options.tooltip_position?a.forEach(function(a){this._addClass(a,"bottom"),a.style.top="22px"}.bind(this)):a.forEach(function(a){this._addClass(a,"top"),a.style.top=-this.tooltip.outerHeight-14+"px"}.bind(this))}},a&&a.fn){var h=void 0;a.fn.slider?(windowIsDefined&&window.console.warn("bootstrap-slider.js - WARNING: $.fn.slider namespace is already bound. Use the $.fn.bootstrapSlider namespace instead."),h=c):(a.bridget(b,d),h=b),a.bridget(c,d),a(function(){a("input[data-provide=slider]")[h]()})}}(a),d});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('env/ui-analyse',["jquery","signals","adim/config","adim/view","jquery.bootstrap","jquery.mousewheel","bootstrap.slider"],function(a,b,c,d){function e(){f=a(window),a("#mode-selector button[data-href]").click(function(b){b.preventDefault(),document.location.href=a(this).data("href")});var b=a("#analyse-graph-ctrl"),c=a("#graph-col"),e=0;g=0,h=0,f.on("scroll",function(){b.toggleClass("pinned",window.scrollY>50)}).on("resize",function(){var a=c.width();a!==e&&(e=a,d.resize(a),i.graphParamChanged.dispatch({viewWidthChanged:!0}))}).resize(),a("#page-loader").remove();var j=a("#inputGroupSize");j.keydown(function(a){var b=38===a.which?1:40===a.which?-1:0;if(b){a.preventDefault(),a.stopPropagation();var c=parseInt(j.val(),10)+b;c>0&&(j.val(c),i.graphParamChanged.dispatch({groupSize:c}))}}).change(function(){var a=parseInt(j.val(),10);a>0&&i.graphParamChanged.dispatch({groupSize:a})});var k=a("#checkShowConfidence");k.change(function(a){i.graphParamChanged.dispatch({showConfidence:k.is(":checked")})});var l=a("#checkShowDiscordance");l.change(function(){i.graphParamChanged.dispatch({showDiscordance:l.is(":checked")})});var m=a("#checkShowConcordance");m.change(function(){i.graphParamChanged.dispatch({showConcordance:m.is(":checked")})});a("#inputScale").slider({selection:"none",value:100,formater:function(a){return a+"%"}}).on("slide",function(a){var b=(parseFloat(a.value)||100)/100;i.graphParamChanged.dispatch({setScale:b})})}var f=a(window),g=0,h=0,i={graphParamChanged:new b};return{init:e,events:i}}); define('env/ui-analyse',["jquery","signals","adim/config","adim/view","jquery.bootstrap","jquery.mousewheel","bootstrap.slider"],function(a,b,c,d){function e(){f=a(window),a("#mode-selector button[data-href]").click(function(b){b.preventDefault(),document.location.href=a(this).data("href")});var b=a("#analyse-graph-ctrl"),c=a("#graph-col"),e=0;g=0,h=0,f.on("scroll",function(){b.toggleClass("pinned",window.scrollY>50)}).on("resize",function(){var a=c.width();a!==e&&(e=a,d.resize(a),i.graphParamChanged.dispatch({viewWidthChanged:!0}))}).resize(),a("#page-loader").remove();var j=a("#inputGroupSize");j.keydown(function(a){var b=38===a.which?1:40===a.which?-1:0;if(b){a.preventDefault(),a.stopPropagation();var c=parseInt(j.val(),10)+b;c>0&&(j.val(c),i.graphParamChanged.dispatch({groupSize:c}))}}).change(function(){var a=parseInt(j.val(),10);a>0&&i.graphParamChanged.dispatch({groupSize:a})});var k=a("#checkShowConfidence");k.change(function(a){i.graphParamChanged.dispatch({showConfidence:k.is(":checked")})});var l=a("#checkShowDiscordance");l.change(function(){i.graphParamChanged.dispatch({showDiscordance:l.is(":checked")})});var m=a("#checkShowConcordance");m.change(function(){i.graphParamChanged.dispatch({showConcordance:m.is(":checked")})});a("#inputScale").slider({selection:"none",value:100,formater:function(a){return a+"%"}}).on("slide",function(a){var b=(parseFloat(a.value)||100)/100;i.graphParamChanged.dispatch({setScale:b})})}var f=a(window),g=0,h=0,i={graphParamChanged:new b};return{init:e,events:i}});
/** /**
* Copyright (C) 2014 Université de Lausanne, RISET, * Copyright (C) 2014 Université de Lausanne, RISET,
...@@ -31062,6 +31062,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export ...@@ -31062,6 +31062,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
* @param event * @param event
*/ */
function onPropertyChange(event) { function onPropertyChange(event) {
$(this).addClass("focus");
updateSelectedItemProp(event.data.pName); updateSelectedItemProp(event.data.pName);
} }
   
...@@ -31096,7 +31097,12 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export ...@@ -31096,7 +31097,12 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
if (_.isFunction(pDef.onChange)) { if (_.isFunction(pDef.onChange)) {
elem.on('change', pDef.onChange); elem.on('change', pDef.onChange);
} else { } else {
elem.on('change', null, {pName: pName}, onPropertyChange); var elemBtn = elem.find(".btn-cat");
if (elemBtn) {
elem.find(".btn-cat").on('change', null, {pName: pName}, onPropertyChange);
}else{
elem.on('change', null, {pName: pName}, onPropertyChange);
}
} }
   
if (_.isFunction(pDef['onBlur'])) { if (_.isFunction(pDef['onBlur'])) {
...@@ -31322,9 +31328,9 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export ...@@ -31322,9 +31328,9 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
!function(a){function b(b){if("string"==typeof b.data&&(b.data={keys:b.data}),b.data&&b.data.keys&&"string"==typeof b.data.keys){var c=b.handler,d=b.data.keys.toLowerCase().split(" ");b.handler=function(b){if(this===b.target||!(/textarea|select/i.test(b.target.nodeName)||a.hotkeys.options.filterTextInputs&&a.inArray(b.target.type,a.hotkeys.textAcceptingInputTypes)>-1)){var e="keypress"!==b.type&&a.hotkeys.specialKeys[b.which],f=String.fromCharCode(b.which).toLowerCase(),g="",h={};a.each(["alt","ctrl","shift"],function(a,c){b[c+"Key"]&&e!==c&&(g+=c+"+")}),b.metaKey&&!b.ctrlKey&&"meta"!==e&&(g+="meta+"),b.metaKey&&"meta"!==e&&g.indexOf("alt+ctrl+shift+")>-1&&(g=g.replace("alt+ctrl+shift+","hyper+")),e?h[g+e]=!0:(h[g+f]=!0,h[g+a.hotkeys.shiftNums[f]]=!0,"shift+"===g&&(h[a.hotkeys.shiftNums[f]]=!0));for(var i=0,j=d.length;i<j;i++)if(h[d[i]])return c.apply(this,arguments)}}}}a.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",10:"return",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"},textAcceptingInputTypes:["text","password","number","email","url","range","date","month","week","time","datetime","datetime-local","search","color","tel"],options:{filterTextInputs:!0}},a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:b}})}(jQuery||this.jQuery||window.jQuery); !function(a){function b(b){if("string"==typeof b.data&&(b.data={keys:b.data}),b.data&&b.data.keys&&"string"==typeof b.data.keys){var c=b.handler,d=b.data.keys.toLowerCase().split(" ");b.handler=function(b){if(this===b.target||!(/textarea|select/i.test(b.target.nodeName)||a.hotkeys.options.filterTextInputs&&a.inArray(b.target.type,a.hotkeys.textAcceptingInputTypes)>-1)){var e="keypress"!==b.type&&a.hotkeys.specialKeys[b.which],f=String.fromCharCode(b.which).toLowerCase(),g="",h={};a.each(["alt","ctrl","shift"],function(a,c){b[c+"Key"]&&e!==c&&(g+=c+"+")}),b.metaKey&&!b.ctrlKey&&"meta"!==e&&(g+="meta+"),b.metaKey&&"meta"!==e&&g.indexOf("alt+ctrl+shift+")>-1&&(g=g.replace("alt+ctrl+shift+","hyper+")),e?h[g+e]=!0:(h[g+f]=!0,h[g+a.hotkeys.shiftNums[f]]=!0,"shift+"===g&&(h[a.hotkeys.shiftNums[f]]=!0));for(var i=0,j=d.length;i<j;i++)if(h[d[i]])return c.apply(this,arguments)}}}}a.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",10:"return",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"},textAcceptingInputTypes:["text","password","number","email","url","range","date","month","week","time","datetime","datetime-local","search","color","tel"],options:{filterTextInputs:!0}},a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:b}})}(jQuery||this.jQuery||window.jQuery);
define("jquery.hotkeys", ["jquery"], function(){}); define("jquery.hotkeys", ["jquery"], function(){});
   
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('env/shortcuts',["jquery","paper","signals","adim/config","adim/view","adim/tools","adim/ui","jquery.hotkeys"],function(a,b,c,d,e,f,g){function h(b){var c=a("#inputGroupSize");return function(){var a=parseInt(c.val(),10)+b;return a>0&&c.val(a).change(),!1}}var i=function(){return function(){return!1}},j={"backspace del":[{event:"keydown",ctxt:"edit",fn:function(){return e.removeSelectedItems(),!1}},{event:"keydown",ctxt:"review",fn:i()}],space:[{event:"keydown",ctxt:"edit review",fn:function(){return a("#tool-pan").click(),!1}},{event:"keyup",ctxt:"edit review",fn:function(){return a("#tool-pan").click(),!1}}],"1 2 3":{ctxt:"edit",fn:function(c){return b.project.selectedItems.length>0&&a("#confidence-input").val([c.key]).change().siblings("[data-value]").trigger("mouseleave"),!1}},a:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-select").click(),!1}}],"ctrl+a meta+a":[{event:"keydown",ctxt:"edit",fn:function(){return b.project.activeLayer.children.map(function(a){a.selected=!0}),!1}},{event:"keydown",ctxt:"review",fn:i()}],c:[{event:"keydown",ctxt:"edit",fn:function(){return!a("#tool-concordantstr").is(":disabled")&&(a("#tool-concordantstr").click(),!1)}},{event:"keydown",ctxt:"analysis",fn:function(){var b=a("#checkShowConcordance");return b.val([b.is(":checked")?"off":"on"]).change(),!1}}],d:[{event:"keydown",ctxt:"edit",fn:function(){return!a("#tool-discordantstr").is(":disabled")&&(a("#tool-discordantstr").click(),!1)}},{event:"keydown",ctxt:"analysis",fn:function(){var b=a("#checkShowDiscordance");return b.val([b.is(":checked")?"off":"on"]).change(),!1}}],"shift+d shift+c":{ctxt:"edit review",fn:function(){a("#annotation-display-container").find("[data-type-name='concordantstr,discordantstr']").click()}},"e b":[{event:"keydown",ctxt:"edit",fn:function(){return!a("#tool-fieldedges").is(":disabled")&&(a("#tool-fieldedges").click(),!1)}}],"shift+e":{ctxt:"edit review",fn:function(){a("#annotation-display-container").find("[data-type-name='fieldedges']").click()}},f:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-arrow").click(),!1}}],"shift+i":{ctxt:"edit review",fn:function(){a("#annotation-display-container").find("[data-type-name='image']").click()}},n:[{event:"keydown",ctxt:"analysis",fn:function(){var b=a("#checkShowConfidence");return b.val([b.is(":checked")?"off":"on"]).change(),!1}}],z:[{event:"keydown",ctxt:"edit",fn:function(){return!a("#tool-cmsarea").is(":disabled")&&(a("#tool-cmsarea").click(),!1)}}],"shift+z":{ctxt:"edit review",fn:function(){a("#annotation-display-container").find("[data-type-name='cmsarea']").click()}},up:[{event:"keydown",ctxt:"analysis",fn:h(1)}],down:[{event:"keydown",ctxt:"analysis",fn:h(-1)}]};return j}); define('env/shortcuts',["jquery","paper","signals","adim/config","adim/view","adim/tools","adim/ui","jquery.hotkeys"],function(a,b,c,d,e,f,g){function h(b){var c=a("#inputGroupSize");return function(){var a=parseInt(c.val(),10)+b;return a>0&&c.val(a).change(),!1}}var i=function(){return function(){return!1}},j={"backspace del":[{event:"keydown",ctxt:"edit",fn:function(){return e.removeSelectedItems(),!1}},{event:"keydown",ctxt:"review",fn:i()}],space:[{event:"keydown",ctxt:"edit review",fn:function(){return a("#tool-pan").click(),!1}},{event:"keyup",ctxt:"edit review",fn:function(){return a("#tool-pan").click(),!1}}],"1 2 3":{ctxt:"edit",fn:function(c){return b.project.selectedItems.length>0&&a("#confidence-input").val([c.key]).change().siblings("[data-value]").trigger("mouseleave"),!1}},a:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-select").click(),!1}}],"ctrl+a meta+a":[{event:"keydown",ctxt:"edit",fn:function(){return b.project.activeLayer.children.map(function(a){a.selected=!0}),!1}},{event:"keydown",ctxt:"review",fn:i()}],c:[{event:"keydown",ctxt:"edit",fn:function(){return!a("#tool-concordantstr").is(":disabled")&&(a("#tool-concordantstr").click(),!1)}},{event:"keydown",ctxt:"analysis",fn:function(){var b=a("#checkShowConcordance");return b.val([b.is(":checked")?"off":"on"]).change(),!1}}],d:[{event:"keydown",ctxt:"edit",fn:function(){return!a("#tool-discordantstr").is(":disabled")&&(a("#tool-discordantstr").click(),!1)}},{event:"keydown",ctxt:"analysis",fn:function(){var b=a("#checkShowDiscordance");return b.val([b.is(":checked")?"off":"on"]).change(),!1}}],"shift+d shift+c":{ctxt:"edit review",fn:function(){a("#annotation-display-container").find("[data-type-name='concordantstr,discordantstr']").click()}},"e b":[{event:"keydown",ctxt:"edit",fn:function(){return!a("#tool-fieldedges").is(":disabled")&&(a("#tool-fieldedges").click(),!1)}}],"shift+e":{ctxt:"edit review",fn:function(){a("#annotation-display-container").find("[data-type-name='fieldedges']").click()}},f:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-arrow").click(),!1}}],"shift+i":{ctxt:"edit review",fn:function(){a("#annotation-display-container").find("[data-type-name='image']").click()}},n:[{event:"keydown",ctxt:"analysis",fn:function(){var b=a("#checkShowConfidence");return b.val([b.is(":checked")?"off":"on"]).change(),!1}}],z:[{event:"keydown",ctxt:"edit",fn:function(){return!a("#tool-cmsarea").is(":disabled")&&(a("#tool-cmsarea").click(),!1)}}],"shift+z":{ctxt:"edit review",fn:function(){a("#annotation-display-container").find("[data-type-name='cmsarea']").click()}},up:[{event:"keydown",ctxt:"analysis",fn:h(1)}],down:[{event:"keydown",ctxt:"analysis",fn:h(-1)}]};return j});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('env/env',["jquery","underscore","paper","signals","adim/config","adim/view","adim/attributes","adim/io","adim/tools","adim/ui","env/shortcuts"],function(a,b,c,d,e,f,g,h,i,j,k){function l(){function a(a){if(!(a&&["cmsarea","concordantstr"].indexOf(a.data.type)<0)&&(b||(b=f.getOrCreateUserLayer(e.user.id,e.user.full_name)),b)){var d,g,h,i,k=b.children.filter(function(a){return a.data.type&&"cmsarea"===a.data.type}),l=b.children.filter(function(a){return a.data.type&&"concordantstr"===a.data.type}),m=c.project.getSelectedItems(),n=1===m.length&&"cmsarea"===m[0].data.type?m[0]:null,o=n?n.data.prop.nbConcordances:null,p=l.length;for(h=0;d=k[h];h++){for(g=0,i=0;i<p;i++)g+=Math.round(d.getIntersections(l[i]).length/2);d.data.prop.nbConcordances=g}null!==o&&n.data.prop.nbConcordances!==o&&j.displayProperties(n)}}console.info("_initSignalRouting from env/cimaf");var b;i.events.annotationAdded.add(function(b){a(b)},this,100),i.events.annotationChanged.add(function(b){a(1===b.length?b[0]:void 0)},this,100),h.events.annotableLoaded.add(function(a){var b=i.tools.concordantstr,c=i.tools.discordantstr,d=i.tools.cmsarea,e=a.envparam&&a.envparam.cimaf_cut_pos,g=a.envparam&&a.envparam.cimaf_cut_margin;f.events.imageLoaded.add(function(a){e=e||a.raster.scaling.x*a.raster.width/2,g=g||25,b.listeners.onCutPositionChanged(e),b.listeners.onCutMarginChanged(g),c.listeners.onCutPositionChanged(e),d.listeners.onCutPositionChanged(e),d.listeners.onSetAreaWidth(2*g)})},100)}function m(b){a(".adim-display-type-selector").find("button").on("click",function(b){var c=a(this),d=!c.hasClass("active"),e=c.data("typeName");b.metaKey?"image"!==e&&f.selectItemsByType(e):(c.toggleClass("active",d),"image"===e?g.setImageOpacity(d?100:0,!0):(f.toggleItemsByType(c.data("typeName"),d),j.enableTool(e,d)))})}return{name:"cimaf",shortcuts:k,initSignalRouting:l,initUI:m}}); define('env/env',["jquery","underscore","paper","signals","adim/config","adim/view","adim/attributes","adim/io","adim/tools","adim/ui","env/shortcuts"],function(a,b,c,d,e,f,g,h,i,j,k){function l(){function a(a){if(!(a&&["cmsarea","concordantstr"].indexOf(a.data.type)<0)&&(b||(b=f.getOrCreateUserLayer(e.user.id,e.user.full_name)),b)){var d,g,h,i,k=b.children.filter(function(a){return a.data.type&&"cmsarea"===a.data.type}),l=b.children.filter(function(a){return a.data.type&&"concordantstr"===a.data.type}),m=c.project.getSelectedItems(),n=1===m.length&&"cmsarea"===m[0].data.type?m[0]:null,o=n?n.data.prop.nbConcordances:null,p=l.length;for(h=0;d=k[h];h++){for(g=0,i=0;i<p;i++)g+=Math.round(d.getIntersections(l[i]).length/2);d.data.prop.nbConcordances=g}null!==o&&n.data.prop.nbConcordances!==o&&j.displayProperties(n)}}console.info("_initSignalRouting from env/cimaf");var b;i.events.annotationAdded.add(function(b){a(b)},this,100),i.events.annotationChanged.add(function(b){a(1===b.length?b[0]:void 0)},this,100),h.events.annotableLoaded.add(function(a){var b=i.tools.concordantstr,c=i.tools.discordantstr,d=i.tools.cmsarea,e=a.envparam&&a.envparam.cimaf_cut_pos,g=a.envparam&&a.envparam.cimaf_cut_margin;f.events.imageLoaded.add(function(a){e=e||a.raster.scaling.x*a.raster.width/2,g=g||25,b.listeners.onCutPositionChanged(e),b.listeners.onCutMarginChanged(g),c.listeners.onCutPositionChanged(e),d.listeners.onCutPositionChanged(e),d.listeners.onSetAreaWidth(2*g)})},100)}function m(b){a(".adim-display-type-selector").find("button").on("click",function(b){var c=a(this),d=!c.hasClass("active"),e=c.data("typeName");b.metaKey?"image"!==e&&f.selectItemsByType(e):(c.toggleClass("active",d),"image"===e?g.setImageOpacity(d?100:0,!0):(f.toggleItemsByType(c.data("typeName"),d),j.enableTool(e,d)))})}return{name:"cimaf",shortcuts:k,initSignalRouting:l,initUI:m}});
/** /**
* Created by jfurrer on 02.12.13. * Created by jfurrer on 02.12.13.
...@@ -31060,6 +31060,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export ...@@ -31060,6 +31060,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
* @param event * @param event
*/ */
function onPropertyChange(event) { function onPropertyChange(event) {
$(this).addClass("focus");
updateSelectedItemProp(event.data.pName); updateSelectedItemProp(event.data.pName);
} }
   
...@@ -31094,7 +31095,12 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export ...@@ -31094,7 +31095,12 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
if (_.isFunction(pDef.onChange)) { if (_.isFunction(pDef.onChange)) {
elem.on('change', pDef.onChange); elem.on('change', pDef.onChange);
} else { } else {
elem.on('change', null, {pName: pName}, onPropertyChange); var elemBtn = elem.find(".btn-cat");
if (elemBtn) {
elem.find(".btn-cat").on('change', null, {pName: pName}, onPropertyChange);
}else{
elem.on('change', null, {pName: pName}, onPropertyChange);
}
} }
   
if (_.isFunction(pDef['onBlur'])) { if (_.isFunction(pDef['onBlur'])) {
...@@ -34169,9 +34175,9 @@ function($){ ...@@ -34169,9 +34175,9 @@ function($){
!function(a){function b(b){if("string"==typeof b.data&&(b.data={keys:b.data}),b.data&&b.data.keys&&"string"==typeof b.data.keys){var c=b.handler,d=b.data.keys.toLowerCase().split(" ");b.handler=function(b){if(this===b.target||!(/textarea|select/i.test(b.target.nodeName)||a.hotkeys.options.filterTextInputs&&a.inArray(b.target.type,a.hotkeys.textAcceptingInputTypes)>-1)){var e="keypress"!==b.type&&a.hotkeys.specialKeys[b.which],f=String.fromCharCode(b.which).toLowerCase(),g="",h={};a.each(["alt","ctrl","shift"],function(a,c){b[c+"Key"]&&e!==c&&(g+=c+"+")}),b.metaKey&&!b.ctrlKey&&"meta"!==e&&(g+="meta+"),b.metaKey&&"meta"!==e&&g.indexOf("alt+ctrl+shift+")>-1&&(g=g.replace("alt+ctrl+shift+","hyper+")),e?h[g+e]=!0:(h[g+f]=!0,h[g+a.hotkeys.shiftNums[f]]=!0,"shift+"===g&&(h[a.hotkeys.shiftNums[f]]=!0));for(var i=0,j=d.length;i<j;i++)if(h[d[i]])return c.apply(this,arguments)}}}}a.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",10:"return",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"},textAcceptingInputTypes:["text","password","number","email","url","range","date","month","week","time","datetime","datetime-local","search","color","tel"],options:{filterTextInputs:!0}},a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:b}})}(jQuery||this.jQuery||window.jQuery); !function(a){function b(b){if("string"==typeof b.data&&(b.data={keys:b.data}),b.data&&b.data.keys&&"string"==typeof b.data.keys){var c=b.handler,d=b.data.keys.toLowerCase().split(" ");b.handler=function(b){if(this===b.target||!(/textarea|select/i.test(b.target.nodeName)||a.hotkeys.options.filterTextInputs&&a.inArray(b.target.type,a.hotkeys.textAcceptingInputTypes)>-1)){var e="keypress"!==b.type&&a.hotkeys.specialKeys[b.which],f=String.fromCharCode(b.which).toLowerCase(),g="",h={};a.each(["alt","ctrl","shift"],function(a,c){b[c+"Key"]&&e!==c&&(g+=c+"+")}),b.metaKey&&!b.ctrlKey&&"meta"!==e&&(g+="meta+"),b.metaKey&&"meta"!==e&&g.indexOf("alt+ctrl+shift+")>-1&&(g=g.replace("alt+ctrl+shift+","hyper+")),e?h[g+e]=!0:(h[g+f]=!0,h[g+a.hotkeys.shiftNums[f]]=!0,"shift+"===g&&(h[a.hotkeys.shiftNums[f]]=!0));for(var i=0,j=d.length;i<j;i++)if(h[d[i]])return c.apply(this,arguments)}}}}a.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",10:"return",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"},textAcceptingInputTypes:["text","password","number","email","url","range","date","month","week","time","datetime","datetime-local","search","color","tel"],options:{filterTextInputs:!0}},a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:b}})}(jQuery||this.jQuery||window.jQuery);
define("jquery.hotkeys", ["jquery"], function(){}); define("jquery.hotkeys", ["jquery"], function(){});
   
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('env/shortcuts',["jquery","paper","signals","adim/config","adim/view","adim/tools","adim/ui","jquery.hotkeys"],function(a,b,c,d,e,f,g){function h(b){var c=a("#inputGroupSize");return function(){var a=parseInt(c.val(),10)+b;return a>0&&c.val(a).change(),!1}}var i=function(){return function(){return!1}},j={"backspace del":[{event:"keydown",ctxt:"edit",fn:function(){return e.removeSelectedItems(),!1}},{event:"keydown",ctxt:"review",fn:i()}],space:[{event:"keydown",ctxt:"edit review",fn:function(){return a("#tool-pan").click(),!1}},{event:"keyup",ctxt:"edit review",fn:function(){return a("#tool-pan").click(),!1}}],"1 2 3":{ctxt:"edit",fn:function(c){return b.project.selectedItems.length>0&&a("#confidence-input").val([c.key]).change().siblings("[data-value]").trigger("mouseleave"),!1}},a:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-select").click(),!1}}],"ctrl+a meta+a":[{event:"keydown",ctxt:"edit",fn:function(){return b.project.activeLayer.children.map(function(a){a.selected=!0}),!1}},{event:"keydown",ctxt:"review",fn:i()}],c:[{event:"keydown",ctxt:"edit",fn:function(){return!a("#tool-concordantstr").is(":disabled")&&(a("#tool-concordantstr").click(),!1)}},{event:"keydown",ctxt:"analysis",fn:function(){var b=a("#checkShowConcordance");return b.val([b.is(":checked")?"off":"on"]).change(),!1}}],d:[{event:"keydown",ctxt:"edit",fn:function(){return!a("#tool-discordantstr").is(":disabled")&&(a("#tool-discordantstr").click(),!1)}},{event:"keydown",ctxt:"analysis",fn:function(){var b=a("#checkShowDiscordance");return b.val([b.is(":checked")?"off":"on"]).change(),!1}}],"shift+d shift+c":{ctxt:"edit review",fn:function(){a("#annotation-display-container").find("[data-type-name='concordantstr,discordantstr']").click()}},"e b":[{event:"keydown",ctxt:"edit",fn:function(){return!a("#tool-fieldedges").is(":disabled")&&(a("#tool-fieldedges").click(),!1)}}],"shift+e":{ctxt:"edit review",fn:function(){a("#annotation-display-container").find("[data-type-name='fieldedges']").click()}},f:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-arrow").click(),!1}}],"shift+i":{ctxt:"edit review",fn:function(){a("#annotation-display-container").find("[data-type-name='image']").click()}},n:[{event:"keydown",ctxt:"analysis",fn:function(){var b=a("#checkShowConfidence");return b.val([b.is(":checked")?"off":"on"]).change(),!1}}],z:[{event:"keydown",ctxt:"edit",fn:function(){return!a("#tool-cmsarea").is(":disabled")&&(a("#tool-cmsarea").click(),!1)}}],"shift+z":{ctxt:"edit review",fn:function(){a("#annotation-display-container").find("[data-type-name='cmsarea']").click()}},up:[{event:"keydown",ctxt:"analysis",fn:h(1)}],down:[{event:"keydown",ctxt:"analysis",fn:h(-1)}]};return j}); define('env/shortcuts',["jquery","paper","signals","adim/config","adim/view","adim/tools","adim/ui","jquery.hotkeys"],function(a,b,c,d,e,f,g){function h(b){var c=a("#inputGroupSize");return function(){var a=parseInt(c.val(),10)+b;return a>0&&c.val(a).change(),!1}}var i=function(){return function(){return!1}},j={"backspace del":[{event:"keydown",ctxt:"edit",fn:function(){return e.removeSelectedItems(),!1}},{event:"keydown",ctxt:"review",fn:i()}],space:[{event:"keydown",ctxt:"edit review",fn:function(){return a("#tool-pan").click(),!1}},{event:"keyup",ctxt:"edit review",fn:function(){return a("#tool-pan").click(),!1}}],"1 2 3":{ctxt:"edit",fn:function(c){return b.project.selectedItems.length>0&&a("#confidence-input").val([c.key]).change().siblings("[data-value]").trigger("mouseleave"),!1}},a:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-select").click(),!1}}],"ctrl+a meta+a":[{event:"keydown",ctxt:"edit",fn:function(){return b.project.activeLayer.children.map(function(a){a.selected=!0}),!1}},{event:"keydown",ctxt:"review",fn:i()}],c:[{event:"keydown",ctxt:"edit",fn:function(){return!a("#tool-concordantstr").is(":disabled")&&(a("#tool-concordantstr").click(),!1)}},{event:"keydown",ctxt:"analysis",fn:function(){var b=a("#checkShowConcordance");return b.val([b.is(":checked")?"off":"on"]).change(),!1}}],d:[{event:"keydown",ctxt:"edit",fn:function(){return!a("#tool-discordantstr").is(":disabled")&&(a("#tool-discordantstr").click(),!1)}},{event:"keydown",ctxt:"analysis",fn:function(){var b=a("#checkShowDiscordance");return b.val([b.is(":checked")?"off":"on"]).change(),!1}}],"shift+d shift+c":{ctxt:"edit review",fn:function(){a("#annotation-display-container").find("[data-type-name='concordantstr,discordantstr']").click()}},"e b":[{event:"keydown",ctxt:"edit",fn:function(){return!a("#tool-fieldedges").is(":disabled")&&(a("#tool-fieldedges").click(),!1)}}],"shift+e":{ctxt:"edit review",fn:function(){a("#annotation-display-container").find("[data-type-name='fieldedges']").click()}},f:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-arrow").click(),!1}}],"shift+i":{ctxt:"edit review",fn:function(){a("#annotation-display-container").find("[data-type-name='image']").click()}},n:[{event:"keydown",ctxt:"analysis",fn:function(){var b=a("#checkShowConfidence");return b.val([b.is(":checked")?"off":"on"]).change(),!1}}],z:[{event:"keydown",ctxt:"edit",fn:function(){return!a("#tool-cmsarea").is(":disabled")&&(a("#tool-cmsarea").click(),!1)}}],"shift+z":{ctxt:"edit review",fn:function(){a("#annotation-display-container").find("[data-type-name='cmsarea']").click()}},up:[{event:"keydown",ctxt:"analysis",fn:h(1)}],down:[{event:"keydown",ctxt:"analysis",fn:h(-1)}]};return j});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('env/env',["jquery","underscore","paper","signals","adim/config","adim/view","adim/attributes","adim/io","adim/tools","adim/ui","env/shortcuts"],function(a,b,c,d,e,f,g,h,i,j,k){function l(){function a(a){if(!(a&&["cmsarea","concordantstr"].indexOf(a.data.type)<0)&&(b||(b=f.getOrCreateUserLayer(e.user.id,e.user.full_name)),b)){var d,g,h,i,k=b.children.filter(function(a){return a.data.type&&"cmsarea"===a.data.type}),l=b.children.filter(function(a){return a.data.type&&"concordantstr"===a.data.type}),m=c.project.getSelectedItems(),n=1===m.length&&"cmsarea"===m[0].data.type?m[0]:null,o=n?n.data.prop.nbConcordances:null,p=l.length;for(h=0;d=k[h];h++){for(g=0,i=0;i<p;i++)g+=Math.round(d.getIntersections(l[i]).length/2);d.data.prop.nbConcordances=g}null!==o&&n.data.prop.nbConcordances!==o&&j.displayProperties(n)}}console.info("_initSignalRouting from env/cimaf");var b;i.events.annotationAdded.add(function(b){a(b)},this,100),i.events.annotationChanged.add(function(b){a(1===b.length?b[0]:void 0)},this,100),h.events.annotableLoaded.add(function(a){var b=i.tools.concordantstr,c=i.tools.discordantstr,d=i.tools.cmsarea,e=a.envparam&&a.envparam.cimaf_cut_pos,g=a.envparam&&a.envparam.cimaf_cut_margin;f.events.imageLoaded.add(function(a){e=e||a.raster.scaling.x*a.raster.width/2,g=g||25,b.listeners.onCutPositionChanged(e),b.listeners.onCutMarginChanged(g),c.listeners.onCutPositionChanged(e),d.listeners.onCutPositionChanged(e),d.listeners.onSetAreaWidth(2*g)})},100)}function m(b){a(".adim-display-type-selector").find("button").on("click",function(b){var c=a(this),d=!c.hasClass("active"),e=c.data("typeName");b.metaKey?"image"!==e&&f.selectItemsByType(e):(c.toggleClass("active",d),"image"===e?g.setImageOpacity(d?100:0,!0):(f.toggleItemsByType(c.data("typeName"),d),j.enableTool(e,d)))})}return{name:"cimaf",shortcuts:k,initSignalRouting:l,initUI:m}}); define('env/env',["jquery","underscore","paper","signals","adim/config","adim/view","adim/attributes","adim/io","adim/tools","adim/ui","env/shortcuts"],function(a,b,c,d,e,f,g,h,i,j,k){function l(){function a(a){if(!(a&&["cmsarea","concordantstr"].indexOf(a.data.type)<0)&&(b||(b=f.getOrCreateUserLayer(e.user.id,e.user.full_name)),b)){var d,g,h,i,k=b.children.filter(function(a){return a.data.type&&"cmsarea"===a.data.type}),l=b.children.filter(function(a){return a.data.type&&"concordantstr"===a.data.type}),m=c.project.getSelectedItems(),n=1===m.length&&"cmsarea"===m[0].data.type?m[0]:null,o=n?n.data.prop.nbConcordances:null,p=l.length;for(h=0;d=k[h];h++){for(g=0,i=0;i<p;i++)g+=Math.round(d.getIntersections(l[i]).length/2);d.data.prop.nbConcordances=g}null!==o&&n.data.prop.nbConcordances!==o&&j.displayProperties(n)}}console.info("_initSignalRouting from env/cimaf");var b;i.events.annotationAdded.add(function(b){a(b)},this,100),i.events.annotationChanged.add(function(b){a(1===b.length?b[0]:void 0)},this,100),h.events.annotableLoaded.add(function(a){var b=i.tools.concordantstr,c=i.tools.discordantstr,d=i.tools.cmsarea,e=a.envparam&&a.envparam.cimaf_cut_pos,g=a.envparam&&a.envparam.cimaf_cut_margin;f.events.imageLoaded.add(function(a){e=e||a.raster.scaling.x*a.raster.width/2,g=g||25,b.listeners.onCutPositionChanged(e),b.listeners.onCutMarginChanged(g),c.listeners.onCutPositionChanged(e),d.listeners.onCutPositionChanged(e),d.listeners.onSetAreaWidth(2*g)})},100)}function m(b){a(".adim-display-type-selector").find("button").on("click",function(b){var c=a(this),d=!c.hasClass("active"),e=c.data("typeName");b.metaKey?"image"!==e&&f.selectItemsByType(e):(c.toggleClass("active",d),"image"===e?g.setImageOpacity(d?100:0,!0):(f.toggleItemsByType(c.data("typeName"),d),j.enableTool(e,d)))})}return{name:"cimaf",shortcuts:k,initSignalRouting:l,initUI:m}});
/** /**
* Copyright (C) 2014 Université de Lausanne, RISET, * Copyright (C) 2014 Université de Lausanne, RISET,
...@@ -31060,6 +31060,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export ...@@ -31060,6 +31060,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
* @param event * @param event
*/ */
function onPropertyChange(event) { function onPropertyChange(event) {
$(this).addClass("focus");
updateSelectedItemProp(event.data.pName); updateSelectedItemProp(event.data.pName);
} }
   
...@@ -31094,7 +31095,12 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export ...@@ -31094,7 +31095,12 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
if (_.isFunction(pDef.onChange)) { if (_.isFunction(pDef.onChange)) {
elem.on('change', pDef.onChange); elem.on('change', pDef.onChange);
} else { } else {
elem.on('change', null, {pName: pName}, onPropertyChange); var elemBtn = elem.find(".btn-cat");
if (elemBtn) {
elem.find(".btn-cat").on('change', null, {pName: pName}, onPropertyChange);
}else{
elem.on('change', null, {pName: pName}, onPropertyChange);
}
} }
   
if (_.isFunction(pDef['onBlur'])) { if (_.isFunction(pDef['onBlur'])) {
...@@ -34169,9 +34175,9 @@ function($){ ...@@ -34169,9 +34175,9 @@ function($){
!function(a){function b(b){if("string"==typeof b.data&&(b.data={keys:b.data}),b.data&&b.data.keys&&"string"==typeof b.data.keys){var c=b.handler,d=b.data.keys.toLowerCase().split(" ");b.handler=function(b){if(this===b.target||!(/textarea|select/i.test(b.target.nodeName)||a.hotkeys.options.filterTextInputs&&a.inArray(b.target.type,a.hotkeys.textAcceptingInputTypes)>-1)){var e="keypress"!==b.type&&a.hotkeys.specialKeys[b.which],f=String.fromCharCode(b.which).toLowerCase(),g="",h={};a.each(["alt","ctrl","shift"],function(a,c){b[c+"Key"]&&e!==c&&(g+=c+"+")}),b.metaKey&&!b.ctrlKey&&"meta"!==e&&(g+="meta+"),b.metaKey&&"meta"!==e&&g.indexOf("alt+ctrl+shift+")>-1&&(g=g.replace("alt+ctrl+shift+","hyper+")),e?h[g+e]=!0:(h[g+f]=!0,h[g+a.hotkeys.shiftNums[f]]=!0,"shift+"===g&&(h[a.hotkeys.shiftNums[f]]=!0));for(var i=0,j=d.length;i<j;i++)if(h[d[i]])return c.apply(this,arguments)}}}}a.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",10:"return",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"},textAcceptingInputTypes:["text","password","number","email","url","range","date","month","week","time","datetime","datetime-local","search","color","tel"],options:{filterTextInputs:!0}},a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:b}})}(jQuery||this.jQuery||window.jQuery); !function(a){function b(b){if("string"==typeof b.data&&(b.data={keys:b.data}),b.data&&b.data.keys&&"string"==typeof b.data.keys){var c=b.handler,d=b.data.keys.toLowerCase().split(" ");b.handler=function(b){if(this===b.target||!(/textarea|select/i.test(b.target.nodeName)||a.hotkeys.options.filterTextInputs&&a.inArray(b.target.type,a.hotkeys.textAcceptingInputTypes)>-1)){var e="keypress"!==b.type&&a.hotkeys.specialKeys[b.which],f=String.fromCharCode(b.which).toLowerCase(),g="",h={};a.each(["alt","ctrl","shift"],function(a,c){b[c+"Key"]&&e!==c&&(g+=c+"+")}),b.metaKey&&!b.ctrlKey&&"meta"!==e&&(g+="meta+"),b.metaKey&&"meta"!==e&&g.indexOf("alt+ctrl+shift+")>-1&&(g=g.replace("alt+ctrl+shift+","hyper+")),e?h[g+e]=!0:(h[g+f]=!0,h[g+a.hotkeys.shiftNums[f]]=!0,"shift+"===g&&(h[a.hotkeys.shiftNums[f]]=!0));for(var i=0,j=d.length;i<j;i++)if(h[d[i]])return c.apply(this,arguments)}}}}a.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",10:"return",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"},textAcceptingInputTypes:["text","password","number","email","url","range","date","month","week","time","datetime","datetime-local","search","color","tel"],options:{filterTextInputs:!0}},a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:b}})}(jQuery||this.jQuery||window.jQuery);
define("jquery.hotkeys", ["jquery"], function(){}); define("jquery.hotkeys", ["jquery"], function(){});
   
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('env/shortcuts',["jquery","paper","signals","adim/config","adim/view","adim/tools","adim/ui","jquery.hotkeys"],function(a,b,c,d,e,f,g){var h=function(){return function(){return!1}};return{"backspace del":[{event:"keydown",ctxt:"edit",fn:function(){return e.removeSelectedItems(),!1}},{event:"keydown",ctxt:"review",fn:h()}],space:[{event:"keydown",fn:function(){return a("#tool-pan").click(),!1}}],a:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-select").click(),!1}}],"ctrl+a meta+a":[{event:"keydown",ctxt:"edit",fn:function(){return b.project.activeLayer.children.map(function(a){a.selected=!0}),!1}},{event:"keydown",ctxt:"review",fn:h()}],d:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-drawing").click(),!1}}],f:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-arrow").click(),!1}}],l:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-lines").click(),!1}}],c:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-ellipse").click(),!1}}],r:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-rectangle").click(),!1}}],t:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-text").click(),!1}}]}}); define('env/shortcuts',["jquery","paper","signals","adim/config","adim/view","adim/tools","adim/ui","jquery.hotkeys"],function(a,b,c,d,e,f,g){var h=function(){return function(){return!1}};return{"backspace del":[{event:"keydown",ctxt:"edit",fn:function(){return e.removeSelectedItems(),!1}},{event:"keydown",ctxt:"review",fn:h()}],space:[{event:"keydown",fn:function(){return a("#tool-pan").click(),!1}}],a:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-select").click(),!1}}],"ctrl+a meta+a":[{event:"keydown",ctxt:"edit",fn:function(){return b.project.activeLayer.children.map(function(a){a.selected=!0}),!1}},{event:"keydown",ctxt:"review",fn:h()}],d:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-drawing").click(),!1}}],f:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-arrow").click(),!1}}],l:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-lines").click(),!1}}],c:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-ellipse").click(),!1}}],r:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-rectangle").click(),!1}}],t:[{event:"keydown",ctxt:"edit",fn:function(){return a("#tool-text").click(),!1}}]}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('env/env',["jquery","underscore","paper","signals","adim/config","adim/view","adim/attributes","adim/io","adim/tools","adim/ui","adim/category","env/shortcuts"],function(a,b,c,d,e,f,g,h,i,j,k,l){function m(){console.info("_initSignalRouting from env/geomo"),h.events.annotableLoaded.add(function(a){f.events.annotationRemoved.add(function(a){}),f.events.imageLoaded.add(function(a){})},100),f.events.annotationsLoaded.add(function(){},-100),j.events.modeChanged.add(function(b){var c=b.mode;"edit"===c?(a("#annotation-display-panel").hide(),a("#annotation-property-container .property-group").show()):"review"===c&&(a("#annotation-display-panel").show(),a("#annotation-property-container .property-group").hide(),a("#annotation-property-container .comment-prop").show())})}function n(b){function c(a){i.toggleClass("hidden",!a),h.toggleClass("col-xs-12",!a).toggleClass("col-xs-6",a)}function d(a){c(a&&l.find(".panel-collapse").hasClass("in")),l.toggleClass("hidden",!a)}k.init({env:p.name}),a(".adim-display-type-selector").find("button").on("click",function(b){var c=a(this),d=!c.hasClass("active"),e=c.data("category");b.metaKey||(c.toggleClass("active",d),"image"===e?g.setImageOpacity(d?100:0,!0):f.toggleItemsByProp({prop:"category",val:e,undef:!0},d))});var e=(a("#side-col"),a(".canvas-container")),h=a("#side-col-panel-group"),i=a("#alt-side-col-panel-group"),l=a("#shared-annotation-markers-panel");d("review"===b.mode),j.events.modeChanged.add(function(a){var b=a.mode;d("review"===b),j.updateReservedSpace(),j.adjustCanvasToImage()}),l.find(".panel-collapse").on("hidden.bs.collapse",function(){e.css("transition","width 0.2s cubic-bezier(0.25, 0.1, 0.25, 1) 0s"),l.prependTo(h),c(!1),j.updateReservedSpace(),j.adjustCanvasToImage(),e.css("transition","")}).on("show.bs.collapse",function(){c(!0),l.appendTo(i),j.updateReservedSpace(),j.adjustCanvasToImage()})}function o(){}var p={name:"geomo",shortcuts:l,initSignalRouting:m,initUI:n};return Object.defineProperty(p,"style",{get:o}),p}); define('env/env',["jquery","underscore","paper","signals","adim/config","adim/view","adim/attributes","adim/io","adim/tools","adim/ui","adim/category","env/shortcuts"],function(a,b,c,d,e,f,g,h,i,j,k,l){function m(){console.info("_initSignalRouting from env/geomo"),h.events.annotableLoaded.add(function(a){f.events.annotationRemoved.add(function(a){}),f.events.imageLoaded.add(function(a){})},100),f.events.annotationsLoaded.add(function(){},-100),j.events.modeChanged.add(function(b){var c=b.mode;"edit"===c?(a("#annotation-display-panel").hide(),a("#annotation-property-container .property-group").show()):"review"===c&&(a("#annotation-display-panel").show(),a("#annotation-property-container .property-group").hide(),a("#annotation-property-container .comment-prop").show())})}function n(b){function c(a){i.toggleClass("hidden",!a),h.toggleClass("col-xs-12",!a).toggleClass("col-xs-6",a)}function d(a){c(a&&l.find(".panel-collapse").hasClass("in")),l.toggleClass("hidden",!a)}k.init({env:p.name}),a(".adim-display-type-selector").find("button").on("click",function(b){var c=a(this),d=!c.hasClass("active"),e=c.data("category");b.metaKey||(c.toggleClass("active",d),"image"===e?g.setImageOpacity(d?100:0,!0):f.toggleItemsByProp({prop:"category",val:e,undef:!0},d))});var e=(a("#side-col"),a(".canvas-container")),h=a("#side-col-panel-group"),i=a("#alt-side-col-panel-group"),l=a("#shared-annotation-markers-panel");d("review"===b.mode),j.events.modeChanged.add(function(a){var b=a.mode;d("review"===b),j.updateReservedSpace(),j.adjustCanvasToImage()}),l.find(".panel-collapse").on("hidden.bs.collapse",function(){e.css("transition","width 0.2s cubic-bezier(0.25, 0.1, 0.25, 1) 0s"),l.prependTo(h),c(!1),j.updateReservedSpace(),j.adjustCanvasToImage(),e.css("transition","")}).on("show.bs.collapse",function(){c(!0),l.appendTo(i),j.updateReservedSpace(),j.adjustCanvasToImage()})}function o(){}var p={name:"geomo",shortcuts:l,initSignalRouting:m,initUI:n};return Object.defineProperty(p,"style",{get:o}),p});
/** /**
* Copyright (C) 2014 Université de Lausanne, RISET, * Copyright (C) 2014 Université de Lausanne, RISET,
...@@ -14928,7 +14928,7 @@ _addBinding:function(a){var b=this._bindings.length;do--b;while(this._bindings[b ...@@ -14928,7 +14928,7 @@ _addBinding:function(a){var b=this._bindings.length;do--b;while(this._bindings[b
!0,b,c)},remove:function(a,b){g(a,"remove");var c=this._indexOfListener(a,b);c!==-1&&(this._bindings[c]._destroy(),this._bindings.splice(c,1));return a},removeAll:function(){for(var a=this._bindings.length;a--;)this._bindings[a]._destroy();this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(a){if(this.active){var b=Array.prototype.slice.call(arguments),c=this._bindings.length,d;if(this.memorize)this._prevParams= !0,b,c)},remove:function(a,b){g(a,"remove");var c=this._indexOfListener(a,b);c!==-1&&(this._bindings[c]._destroy(),this._bindings.splice(c,1));return a},removeAll:function(){for(var a=this._bindings.length;a--;)this._bindings[a]._destroy();this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(a){if(this.active){var b=Array.prototype.slice.call(arguments),c=this._bindings.length,d;if(this.memorize)this._prevParams=
b;if(c){d=this._bindings.slice();this._shouldPropagate=!0;do c--;while(d[c]&&this._shouldPropagate&&d[c].execute(b)!==!1)}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll();delete this._bindings;delete this._prevParams},toString:function(){return"[Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};var f=e;f.Signal=e;typeof define==="function"&&define.amd?define('signals',[],function(){return f}):typeof module!=="undefined"&&module.exports?module.exports=f:i.signals= b;if(c){d=this._bindings.slice();this._shouldPropagate=!0;do c--;while(d[c]&&this._shouldPropagate&&d[c].execute(b)!==!1)}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll();delete this._bindings;delete this._prevParams},toString:function(){return"[Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};var f=e;f.Signal=e;typeof define==="function"&&define.amd?define('signals',[],function(){return f}):typeof module!=="undefined"&&module.exports?module.exports=f:i.signals=
f})(this); f})(this);
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('adim/config',["jquery"],function(a){var b="ADIM_CONFIG",c=a.extend(!0,{MODE_EDIT:"edit",MODE_REVIEW:"review",MODE_ANALYSIS:"analysis",adim_global_varname:"ADIM",annotable:{image:"image/",thumbnail:"thumb/"},image_url:"",autoSaveThumbnail:!0,io:{},activeTools:[],userEngine:{limit:7,remoteUrl:"http://path/to/suggestion/url/?q=%QUERY",rateLimitWait:300},aai:{slo:!1,urls:{sp_logout:"https://jabba.unil.ch/Shibboleth.sso/Logout",idp_logout:"https://aai.unil.ch/idp/logout.jsp"}},ui:{show_side_col:!0,show_users_results:!1,show_annot_properties:!0},uploadMaxFileSize:2},window[b]||{},!0);if(!c.activeTools||0==c.activeTools.length)try{c.activeTools=a("#draw-tool-tb [data-tool-name]").map(function(){return a(this).attr("data-tool-name")})}catch(a){c.activeTools=null}return c.csrfToken&&a.ajaxSetup({beforeSend:function(a){a.setRequestHeader("X-CSRFToken",c.csrfToken)}}),c}); define('adim/config',["jquery"],function(a){var b="ADIM_CONFIG",c=a.extend(!0,{MODE_EDIT:"edit",MODE_REVIEW:"review",MODE_ANALYSIS:"analysis",adim_global_varname:"ADIM",annotable:{image:"image/",thumbnail:"thumb/"},image_url:"",autoSaveThumbnail:!0,io:{},activeTools:[],userEngine:{limit:7,remoteUrl:"http://path/to/suggestion/url/?q=%QUERY",rateLimitWait:300},aai:{slo:!1,urls:{sp_logout:"https://jabba.unil.ch/Shibboleth.sso/Logout",idp_logout:"https://aai.unil.ch/idp/logout.jsp"}},ui:{show_side_col:!0,show_users_results:!1,show_annot_properties:!0},uploadMaxFileSize:2},window[b]||{},!0);if(!c.activeTools||0==c.activeTools.length)try{c.activeTools=a("#draw-tool-tb [data-tool-name]").map(function(){return a(this).attr("data-tool-name")})}catch(a){c.activeTools=null}return c.csrfToken&&a.ajaxSetup({beforeSend:function(a){a.setRequestHeader("X-CSRFToken",c.csrfToken)}}),c});
// Underscore.js 1.8.3 // Underscore.js 1.8.3
// http://underscorejs.org // http://underscorejs.org
...@@ -15854,59 +15854,59 @@ define('adim/config',["jquery"],function(a){var b="ADIM_CONFIG",c=a.extend(!0,{M ...@@ -15854,59 +15854,59 @@ define('adim/config',["jquery"],function(a){var b="ADIM_CONFIG",c=a.extend(!0,{M
}(); }();
return Bloodhound; return Bloodhound;
}); });
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('adim/users',["jquery","underscore","bloodhound","adim/config"],function(a,b,c,d){function e(){i=new c({datumTokenizer:function(a){return c.tokenizers.nonword(a.username)},queryTokenizer:c.tokenizers.whitespace,limit:d.userEngine.limit,remote:{url:d.userEngine.remoteUrl,rateLimitWait:d.userEngine.rateLimitWait}}),i.initialize()}function f(b){a.isArray(b)&&b.length>=0&&i.add(b)}function g(a){var c=b.find(i.index.datums,function(b){return b.id==a});return c?c.username:""}function h(c){var d=a.Deferred(),e=b.find(i.index.datums,function(a){return a.id==c});return e?d.resolve(e.username):d.reject(),d}var i=null;return e(),{engine:i,addUsers:f,getById:g,searchById:h}}); define('adim/users',["jquery","underscore","bloodhound","adim/config"],function(a,b,c,d){function e(){i=new c({datumTokenizer:function(a){return c.tokenizers.nonword(a.username)},queryTokenizer:c.tokenizers.whitespace,limit:d.userEngine.limit,remote:{url:d.userEngine.remoteUrl,rateLimitWait:d.userEngine.rateLimitWait}}),i.initialize()}function f(b){a.isArray(b)&&b.length>=0&&i.add(b)}function g(a){var c=b.find(i.index.datums,function(b){return b.id==a});return c?c.username:""}function h(c){var d=a.Deferred(),e=b.find(i.index.datums,function(a){return a.id==c});return e?d.resolve(e.username):d.reject(),d}var i=null;return e(),{engine:i,addUsers:f,getById:g,searchById:h}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('helper/utils',["paper"],function(a){function b(a,b){b=b===!0,a&&(a.data&&a.data.selectListeners&&a.attach(a.data.selectListeners),b&&"function"==typeof a.setSelected&&a.setSelected(!0))}function c(b,c){c=c?c:a.project.getSelectedItems(),b=b===!0;for(var d,e=0;d=c[e];e++)d.data&&d.data.selectListeners&&d.detach(d.data.selectListeners),b&&(d.fullySelected=d.selected=!1)}function d(){var b=[];return a.project.getSelectedItems().map(function(a){a.parent&&a.parent.data&&a.parent.data.type&&b.indexOf(a.parent)===-1?b.push(a.parent):a.data&&a.data.type&&b.indexOf(a)===-1&&b.push(a)}),b}function e(a){g=a}function f(a){g&&$.each(g,function(b,c){$.isArray(c)||(c=[c]);for(var d=0,e=c.length;d<e;d++){var f=c[d].fn;if("function"!=typeof f)return;var g=c[d].ctxt&&c[d].ctxt.split(" "),h=c[d].event||"keydown";$(document).off(h,f),(!g||g.indexOf(a)>-1)&&$(document).on(h,{keys:b},f)}})}var g=null;return{addSelectListeners:b,removeSelectListeners:c,getSelectedAnnotations:d,initShortcuts:e,setShortcutsContext:f}}); define('helper/utils',["paper"],function(a){function b(a,b){b=b===!0,a&&(a.data&&a.data.selectListeners&&a.attach(a.data.selectListeners),b&&"function"==typeof a.setSelected&&a.setSelected(!0))}function c(b,c){c=c?c:a.project.getSelectedItems(),b=b===!0;for(var d,e=0;d=c[e];e++)d.data&&d.data.selectListeners&&d.detach(d.data.selectListeners),b&&(d.fullySelected=d.selected=!1)}function d(){var b=[];return a.project.getSelectedItems().map(function(a){a.parent&&a.parent.data&&a.parent.data.type&&b.indexOf(a.parent)===-1?b.push(a.parent):a.data&&a.data.type&&b.indexOf(a)===-1&&b.push(a)}),b}function e(a){g=a}function f(a){g&&$.each(g,function(b,c){$.isArray(c)||(c=[c]);for(var d=0,e=c.length;d<e;d++){var f=c[d].fn;if("function"!=typeof f)return;var g=c[d].ctxt&&c[d].ctxt.split(" "),h=c[d].event||"keydown";$(document).off(h,f),(!g||g.indexOf(a)>-1)&&$(document).on(h,{keys:b},f)}})}var g=null;return{addSelectListeners:b,removeSelectListeners:c,getSelectedAnnotations:d,initShortcuts:e,setShortcutsContext:f}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('tools/select',["paper","adim/config","helper/utils"],function(a,b,c){function d(a,b){var c=a.hitTest(b.point,p);switch(k=l=m=null,x=y=z=A=null,c.type){case"handle-in":case"handle-out":if(a.selected){var d=c.type.split("-");m=d[1],k=c.segment}break;case"segment":k=c.segment;break;case"fill":case"stroke":b.modifiers.shift||(a.data&&"function"==typeof a.data.setDragMode?a.data.setDragMode("FULL_DRAG",{item:c.item}):l=!0);break;case"bounds":var e=c.name.split("-");if(["shape","ellipse","rectangle","circle"].indexOf(c.item.type)>-1)if("center"===e[0]||"center"===e[1])a.data.setDragMode("FULL_DRAG",{item:a});else{var f="bottom"===e[0]?"top":"bottom";f+="left"===e[1]?"Right":"Left";var g=["right"===e[1]?1:-1,"bottom"===e[0]?1:-1];c.item.data.setDragMode.call(c.item,"DRAG_HANDLE",{nameStr:c.name,nameParts:e,item:c.item,fixedPt:c.item.bounds[f],resizeDir:g})}else if("arrow"===c.item.data.type&&"right"===e[1])try{c.item.data.setDragMode.call(c.item,"DRAG_HANDLE",{nameStr:c.name,nameParts:e})}catch(a){}else if("text"===c.item.data.type)if("center"===e[0]||"center"===e[1])a.data.setDragMode("FULL_DRAG",{item:a});else try{c.item.data.setDragMode.call(c.item,"DRAG_HANDLE",{item:c.item,nameStr:c.name,nameParts:e})}catch(a){}else if("lines"===c.item.data.type){for(var h,i,j,n=c.point,o=0,q=a.segments.length;o<q&&(i=n.getDistance(a.segments[o].point),(!j||i<h)&&(j=a.segments[o],h=i),0!=i);o++);j&&(k=j)}else"function"==typeof s.onMouseDown&&s.onMouseDown(b)}}function e(a){var b=a.point.subtract(k.point),c=a.lastPoint.subtract(k.point),d=b.angle-c.angle,e=!a.modifiers.option;"in"===m?(k.handleIn=b,e&&(k.handleOut.angle+=d)):(k.handleOut=b,e&&(k.handleIn.angle+=d))}function f(b){var c,d,e;c=new a.Rectangle({from:y,to:b.point}).size,b.event.shiftKey&&(e=x.bounds.size.width/x.bounds.size.height,c.height=c.width/e),d=c.subtract(x.bounds.size).multiply(z).divide(2),x.size=c,x.translate(d.width,d.height)}function g(a,b){a.data&&"function"==typeof a.data.itemMouseDrag?a.data.itemMouseDrag.call(a,b):x?f(b):m&&k.path.id===a.id?e(b):k&&k.path.id===a.id?k.point=b.point:l&&a.translate(b.delta),t=!0}function h(a,b){}function i(a){return r=a,q=!a,a}var j,k,l,m,n="select",o={segments:!0,stroke:!0,fill:!0,tolerance:5,bounds:!1,handles:!1},p={segments:!0,stroke:!0,fill:!0,tolerance:5,bounds:!0,handles:!0},q=b.mode===b.MODE_EDIT,r=!q,s=null,t=!1,u={annotationAdded:null,annotationChanged:null,annotationSelected:null},v=null,w=[],x=null,y=null,z=[1,1],A=null,B={tolerance:7,fill:!0,stroke:!0,segments:!0,handles:!0,ends:!0,bounds:!0,selected:!0},C={onMouseDown:function(b){k=l=m=x=y=null;var e=r?a.project.hitTest(b.point,o):a.project.activeLayer.hitTest(b.point,B);if(e||(e=r?a.project.hitTest(b.point,o):a.project.activeLayer.hitTest(b.point,o)),!q)return a.project.deselectAll(),u.annotationSelected.dispatch(null),a.view.draw(),void(e&&"pixel"!==e.type&&(s=e&&e.item,s&&s.parent.data.type&&(s=s.parent),s.data.type&&(s.selected=!0),u.annotationSelected.dispatch(s)));var f=c.getSelectedAnnotations();if(1===f.length&&(!e||"pixel"===e.type||e.item.id!==f[0].id)){var g=a.project.activeLayer.hitTest(b.point,p);g&&g.item===f[0]&&(e=g)}var h=b.modifiers.shift&&q;if(s=e&&e.item,s&&s.parent&&s.parent.data&&s.parent.data.type&&(s=s.parent),s&&(s.selected||h)||(a.project.deselectAll(),u.annotationSelected.dispatch(null)),s){if(s.layer&&"image"===s.layer.name)return;s.selected?(t=!1,h&&"bounds"!==e.type?s.fullySelected=!1:s.responds("mousedown")&&"bounds"!==e.type?s.onMouseDown(b):d(s,b)):("group"===s.type?"function"==typeof s.oSetSelected?!s.selected&&s.oSetSelected(!0):s.children.map(function(a){a.selected=!0}):["handle-in","handle-out"].indexOf(e.type)===-1&&(s.selected=!0,s.responds("mousedown")&&s.onMouseDown(b)),q&&s.selected&&"path"===s.type),u.annotationSelected.dispatch(s)}w=c.getSelectedAnnotations()},onMouseDrag:function(a){if(q){var b=w;if(1===b.length)s.responds("mousedrag")||g(s,a);else{t=!0;for(var c,d=0;c=b[d];d++)c.parent&&c.parent.data&&c.parent.data.type&&(c=c.parent),c.data.type&&(c===s&&c.responds("mousedrag")||c.translate(a.delta)),c=null}}},onMouseUp:function(b){v&&(v.remove(),v=null);var c=[];a.project.getSelectedItems().map(function(a){c.indexOf(a)===-1&&(a.data.type?c.push(a):a.parent.data.type&&c.indexOf(a.parent)===-1&&c.push(a.parent))}),q&&(s&&1===c.length&&(s.responds("mouseup")?s.onMouseUp(b):h(s,b)),t&&(u.annotationChanged.dispatch(c),t=!1))},onKeyDown:function(b){var c=a.project.getSelectedItems();if(q)for(var d,e=0;d=c[e];e++)if(d.data.type&&"function"==typeof d.onKeyDown){d.onKeyDown(b);break}},onKeyUp:function(b){var c=a.project.getSelectedItems();if(q)for(var d,e=0;d=c[e];e++)if(d.data.type&&"function"==typeof d.onKeyUp){d.onKeyUp(b);break}}};return j=new a.Tool(C),{name:n,tool:j,setRo:i,registerEvent:function(a,b){u[a]=b},_tools:null}}); define('tools/select',["paper","adim/config","helper/utils"],function(a,b,c){function d(a,b){var c=a.hitTest(b.point,p);switch(k=l=m=null,x=y=z=A=null,c.type){case"handle-in":case"handle-out":if(a.selected){var d=c.type.split("-");m=d[1],k=c.segment}break;case"segment":k=c.segment;break;case"fill":case"stroke":b.modifiers.shift||(a.data&&"function"==typeof a.data.setDragMode?a.data.setDragMode("FULL_DRAG",{item:c.item}):l=!0);break;case"bounds":var e=c.name.split("-");if(["shape","ellipse","rectangle","circle"].indexOf(c.item.type)>-1)if("center"===e[0]||"center"===e[1])a.data.setDragMode("FULL_DRAG",{item:a});else{var f="bottom"===e[0]?"top":"bottom";f+="left"===e[1]?"Right":"Left";var g=["right"===e[1]?1:-1,"bottom"===e[0]?1:-1];c.item.data.setDragMode.call(c.item,"DRAG_HANDLE",{nameStr:c.name,nameParts:e,item:c.item,fixedPt:c.item.bounds[f],resizeDir:g})}else if("arrow"===c.item.data.type&&"right"===e[1])try{c.item.data.setDragMode.call(c.item,"DRAG_HANDLE",{nameStr:c.name,nameParts:e})}catch(a){}else if("text"===c.item.data.type)if("center"===e[0]||"center"===e[1])a.data.setDragMode("FULL_DRAG",{item:a});else try{c.item.data.setDragMode.call(c.item,"DRAG_HANDLE",{item:c.item,nameStr:c.name,nameParts:e})}catch(a){}else if("lines"===c.item.data.type){for(var h,i,j,n=c.point,o=0,q=a.segments.length;o<q&&(i=n.getDistance(a.segments[o].point),(!j||i<h)&&(j=a.segments[o],h=i),0!=i);o++);j&&(k=j)}else"function"==typeof s.onMouseDown&&s.onMouseDown(b)}}function e(a){var b=a.point.subtract(k.point),c=a.lastPoint.subtract(k.point),d=b.angle-c.angle,e=!a.modifiers.option;"in"===m?(k.handleIn=b,e&&(k.handleOut.angle+=d)):(k.handleOut=b,e&&(k.handleIn.angle+=d))}function f(b){var c,d,e;c=new a.Rectangle({from:y,to:b.point}).size,b.event.shiftKey&&(e=x.bounds.size.width/x.bounds.size.height,c.height=c.width/e),d=c.subtract(x.bounds.size).multiply(z).divide(2),x.size=c,x.translate(d.width,d.height)}function g(a,b){a.data&&"function"==typeof a.data.itemMouseDrag?a.data.itemMouseDrag.call(a,b):x?f(b):m&&k.path.id===a.id?e(b):k&&k.path.id===a.id?k.point=b.point:l&&a.translate(b.delta),t=!0}function h(a,b){}function i(a){return r=a,q=!a,a}var j,k,l,m,n="select",o={segments:!0,stroke:!0,fill:!0,tolerance:5,bounds:!1,handles:!1},p={segments:!0,stroke:!0,fill:!0,tolerance:5,bounds:!0,handles:!0},q=b.mode===b.MODE_EDIT,r=!q,s=null,t=!1,u={annotationAdded:null,annotationChanged:null,annotationSelected:null},v=null,w=[],x=null,y=null,z=[1,1],A=null,B={tolerance:7,fill:!0,stroke:!0,segments:!0,handles:!0,ends:!0,bounds:!0,selected:!0},C={onMouseDown:function(b){k=l=m=x=y=null;var e=r?a.project.hitTest(b.point,o):a.project.activeLayer.hitTest(b.point,B);if(e||(e=r?a.project.hitTest(b.point,o):a.project.activeLayer.hitTest(b.point,o)),!q)return a.project.deselectAll(),u.annotationSelected.dispatch(null),a.view.draw(),void(e&&"pixel"!==e.type&&(s=e&&e.item,s&&s.parent.data.type&&(s=s.parent),s.data.type&&(s.selected=!0),u.annotationSelected.dispatch(s)));var f=c.getSelectedAnnotations();if(1===f.length&&(!e||"pixel"===e.type||e.item.id!==f[0].id)){var g=a.project.activeLayer.hitTest(b.point,p);g&&g.item===f[0]&&(e=g)}var h=b.modifiers.shift&&q;if(s=e&&e.item,s&&s.parent&&s.parent.data&&s.parent.data.type&&(s=s.parent),s&&(s.selected||h)||(a.project.deselectAll(),u.annotationSelected.dispatch(null)),s){if(s.layer&&"image"===s.layer.name)return;s.selected?(t=!1,h&&"bounds"!==e.type?s.fullySelected=!1:s.responds("mousedown")&&"bounds"!==e.type?s.onMouseDown(b):d(s,b)):("group"===s.type?"function"==typeof s.oSetSelected?!s.selected&&s.oSetSelected(!0):s.children.map(function(a){a.selected=!0}):["handle-in","handle-out"].indexOf(e.type)===-1&&(s.selected=!0,s.responds("mousedown")&&s.onMouseDown(b)),q&&s.selected&&"path"===s.type),u.annotationSelected.dispatch(s)}w=c.getSelectedAnnotations()},onMouseDrag:function(a){if(q){var b=w;if(1===b.length)s.responds("mousedrag")||g(s,a);else{t=!0;for(var c,d=0;c=b[d];d++)c.parent&&c.parent.data&&c.parent.data.type&&(c=c.parent),c.data.type&&(c===s&&c.responds("mousedrag")||c.translate(a.delta)),c=null}}},onMouseUp:function(b){v&&(v.remove(),v=null);var c=[];a.project.getSelectedItems().map(function(a){c.indexOf(a)===-1&&(a.data.type?c.push(a):a.parent.data.type&&c.indexOf(a.parent)===-1&&c.push(a.parent))}),q&&(s&&1===c.length&&(s.responds("mouseup")?s.onMouseUp(b):h(s,b)),t&&(u.annotationChanged.dispatch(c),t=!1))},onKeyDown:function(b){var c=a.project.getSelectedItems();if(q)for(var d,e=0;d=c[e];e++)if(d.data.type&&"function"==typeof d.onKeyDown){d.onKeyDown(b);break}},onKeyUp:function(b){var c=a.project.getSelectedItems();if(q)for(var d,e=0;d=c[e];e++)if(d.data.type&&"function"==typeof d.onKeyUp){d.onKeyUp(b);break}}};return j=new a.Tool(C),{name:n,tool:j,setRo:i,registerEvent:function(a,b){u[a]=b},_tools:null}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('tools/pan',["paper"],function(a){var b={onMouseDrag:function(b){var c=b.point.subtract(b.downPoint).multiply(-1);a.project.view.scrollBy(c),a.project.view.draw()},onMouseDown:function(){jQuery(a.view.element).addClass("cursor-tool-pan-down")},onMouseUp:function(){jQuery(a.view.element).removeClass("cursor-tool-pan-down")}};return{name:"pan",tool:new a.Tool(b)}}); define('tools/pan',["paper"],function(a){var b={onMouseDrag:function(b){var c=b.point.subtract(b.downPoint).multiply(-1);a.project.view.scrollBy(c),a.project.view.draw()},onMouseDown:function(){jQuery(a.view.element).addClass("cursor-tool-pan-down")},onMouseUp:function(){jQuery(a.view.element).removeClass("cursor-tool-pan-down")}};return{name:"pan",tool:new a.Tool(b)}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('tools/drawing',["paper"],function(a){function b(b){b.data.prop="object"==typeof b.data.prop?b.data.prop:{};for(var d in k)b.data.prop.hasOwnProperty(d)||(b.data.prop[d]=k[d]);b.onPropertyChange=c,b.onDoubleClick=function(b){i||(this.selected=!1,this.fullySelected=!0,a.view.draw())}}function c(b,c){"fill"===b&&(this.closed=c,a.view.draw())}function d(a){var b=this.selected,c=this.fullySelected;this.selected=this.fullySelected=!1;var d=this.exportJSON({asString:!1});return delete d[1].fontFamily,delete d[1].font,delete d[1].fontSize,delete d[1].leading,d=a&&a.asString===!1?d:JSON.stringify(d),this.fullySelected=c,this.selected=b,d}function e(a,c,d){var e=c.importJSON(a);return b(e),e}function f(a){return a!==i&&(i=a),i}var g="drawing",h=null,i=!1,j={annotationAdded:null,annotationSelected:null},k={comment:"",confidence:3,fill:!1},l={onMouseDown:function(b){a.project.deselectAll(),h=new a.Path({fillColor:null,strokeCap:"round"}),h.add(b.point)},minDistance:5,onMouseDrag:function(a){h&&h.add(a.point)},onMouseUp:function(c){if(h){h.simplify(20);var d=h.clone();h.remove(),h=null,d.data.type=g,d.data.tId="a"+d._id,b(d),a.view.draw(),d.fullySelected=!0,"function"==typeof j.annotationSelected.dispatch&&j.annotationSelected.dispatch(d),"function"==typeof j.annotationAdded.dispatch&&j.annotationAdded.dispatch(d)}}};return{name:g,tool:new a.Tool(l),setRo:f,registerEvent:function(a,b){j[a]=b},exportJSON:d,importJSON:e}}); define('tools/drawing',["paper"],function(a){function b(b){b.data.prop="object"==typeof b.data.prop?b.data.prop:{};for(var d in k)b.data.prop.hasOwnProperty(d)||(b.data.prop[d]=k[d]);b.onPropertyChange=c,b.onDoubleClick=function(b){i||(this.selected=!1,this.fullySelected=!0,a.view.draw())}}function c(b,c){"fill"===b&&(this.closed=c,a.view.draw())}function d(a){var b=this.selected,c=this.fullySelected;this.selected=this.fullySelected=!1;var d=this.exportJSON({asString:!1});return delete d[1].fontFamily,delete d[1].font,delete d[1].fontSize,delete d[1].leading,d=a&&a.asString===!1?d:JSON.stringify(d),this.fullySelected=c,this.selected=b,d}function e(a,c,d){var e=c.importJSON(a);return b(e),e}function f(a){return a!==i&&(i=a),i}var g="drawing",h=null,i=!1,j={annotationAdded:null,annotationSelected:null},k={comment:"",confidence:3,fill:!1},l={onMouseDown:function(b){a.project.deselectAll(),h=new a.Path({fillColor:null,strokeCap:"round"}),h.add(b.point)},minDistance:5,onMouseDrag:function(a){h&&h.add(a.point)},onMouseUp:function(c){if(h){h.simplify(20);var d=h.clone();h.remove(),h=null,d.data.type=g,d.data.tId="a"+d._id,b(d),a.view.draw(),d.fullySelected=!0,"function"==typeof j.annotationSelected.dispatch&&j.annotationSelected.dispatch(d),"function"==typeof j.annotationAdded.dispatch&&j.annotationAdded.dispatch(d)}}};return{name:g,tool:new a.Tool(l),setRo:f,registerEvent:function(a,b){j[a]=b},exportJSON:d,importJSON:e}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('tools/lines',["paper"],function(a){function b(a){var b=this.exportJSON({asString:!1});return delete b[1].fontFamily,delete b[1].font,delete b[1].fontSize,delete b[1].leading,a&&a.asString?JSON.stringify(b):b}function c(a,b,c){var e=b.importJSON(a);return d(e),e}function d(a){a.data.prop="object"==typeof a.data.prop?a.data.prop:{};for(var b in p)a.data.prop.hasOwnProperty(b)||(a.data.prop[b]=p[b]);a.onPropertyChange=e}function e(b,c){"confidence"===b?(this.style=q[c],a.view.draw()):"processus"===b||"fill"===b&&(this.closed=c,a.view.draw())}function f(){if(n=null,k&&k.remove(),i=!1,h.length>l){var b=h.clone();b.style=a.project.currentStyle,b.strokeCap="round",b.strokeJoin="round",b.fillColor=null,b.data.type=g,b.data.tId="a"+b._id,d(b),b.selected=!0,"function"==typeof o.annotationSelected.dispatch&&o.annotationSelected.dispatch(b),"function"==typeof o.annotationAdded.dispatch&&o.annotationAdded.dispatch(b)}h.remove()}var g="lines",h=null,i=!1,j=!1,k=null,l=5,m=!1,n=null,o={annotationAdded:null,annotationChanged:null},p={comment:"",confidence:3,fill:!1},q={1:{dashArray:[10,10]},2:{dashArray:[30,10]},3:{dashArray:null}},r={segments:!0,stroke:!0,tolerance:5},s={onMouseDown:function(b){if(i){if(h){if(b.point.subtract(b.lastPoint).length<l)return void f();k&&k.remove(),h.add(b.point)}}else{var c=a.project.activeLayer.hitTest(b.point,r);if(c&&c.item&&c.item.selected&&c.item.data.type===g)if(h=c.item,"stroke"===c.type){var d=c.location;k=h.insert(d.index+1,b.point),j=!0}else"segment"===c.type&&(b.modifiers.option?(c.segment.remove(),o.annotationChanged.dispatch(c.item)):(k=c.segment,j=!0));else a.project.deselectAll(),h=new a.Path({strokeColor:a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor,fillColor:null,strokeCap:"round",strokeJoin:"round"}),i=!0,h.add(b.point)}},onMouseMove:function(b){i?(n=b.point,k&&k.remove(),k=new a.Path(b.downPoint,b.point),k.strokeColor=a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor):j&&k&&(m=!0,k.point=b.point)},onMouseUp:function(a){j&&(j=!1,k&&(m&&(m=!1,o.annotationChanged.dispatch(k.path)),k=null))},onKeyDown:function(a){switch(a.key){case"enter":i&&h&&(n&&h.add(n),f());break;case"escape":i&&h&&f()}}};return{name:g,tool:new a.Tool(s),registerEvent:function(a,b){o[a]=b},exportJSON:b,importJSON:c}}); define('tools/lines',["paper"],function(a){function b(a){var b=this.exportJSON({asString:!1});return delete b[1].fontFamily,delete b[1].font,delete b[1].fontSize,delete b[1].leading,a&&a.asString?JSON.stringify(b):b}function c(a,b,c){var e=b.importJSON(a);return d(e),e}function d(a){a.data.prop="object"==typeof a.data.prop?a.data.prop:{};for(var b in p)a.data.prop.hasOwnProperty(b)||(a.data.prop[b]=p[b]);a.onPropertyChange=e}function e(b,c){"confidence"===b?(this.style=q[c],a.view.draw()):"processus"===b||"fill"===b&&(this.closed=c,a.view.draw())}function f(){if(n=null,k&&k.remove(),i=!1,h.length>l){var b=h.clone();b.style=a.project.currentStyle,b.strokeCap="round",b.strokeJoin="round",b.fillColor=null,b.data.type=g,b.data.tId="a"+b._id,d(b),b.selected=!0,"function"==typeof o.annotationSelected.dispatch&&o.annotationSelected.dispatch(b),"function"==typeof o.annotationAdded.dispatch&&o.annotationAdded.dispatch(b)}h.remove()}var g="lines",h=null,i=!1,j=!1,k=null,l=5,m=!1,n=null,o={annotationAdded:null,annotationChanged:null},p={comment:"",confidence:3,fill:!1},q={1:{dashArray:[10,10]},2:{dashArray:[30,10]},3:{dashArray:null}},r={segments:!0,stroke:!0,tolerance:5},s={onMouseDown:function(b){if(i){if(h){if(b.point.subtract(b.lastPoint).length<l)return void f();k&&k.remove(),h.add(b.point)}}else{var c=a.project.activeLayer.hitTest(b.point,r);if(c&&c.item&&c.item.selected&&c.item.data.type===g)if(h=c.item,"stroke"===c.type){var d=c.location;k=h.insert(d.index+1,b.point),j=!0}else"segment"===c.type&&(b.modifiers.option?(c.segment.remove(),o.annotationChanged.dispatch(c.item)):(k=c.segment,j=!0));else a.project.deselectAll(),h=new a.Path({strokeColor:a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor,fillColor:null,strokeCap:"round",strokeJoin:"round"}),i=!0,h.add(b.point)}},onMouseMove:function(b){i?(n=b.point,k&&k.remove(),k=new a.Path(b.downPoint,b.point),k.strokeColor=a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor):j&&k&&(m=!0,k.point=b.point)},onMouseUp:function(a){j&&(j=!1,k&&(m&&(m=!1,o.annotationChanged.dispatch(k.path)),k=null))},onKeyDown:function(a){switch(a.key){case"enter":i&&h&&(n&&h.add(n),f());break;case"escape":i&&h&&f()}}};return{name:g,tool:new a.Tool(s),registerEvent:function(a,b){o[a]=b},exportJSON:b,importJSON:c}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('tools/Shape.class',["paper"],function(){return function(a,b){function c(a){var b=this.exportJSON({asString:!1});return delete b[1].fontFamily,delete b[1].font,delete b[1].fontSize,delete b[1].leading,a&&a.asString?JSON.stringify(b):b}function d(a,b,c){var d=b.importJSON(a);return h(d),d}function e(a){var b=["ellipse","rectangle"];return!!a&&a.data&&a.data.type&&b.indexOf(a.data.type)>-1}function f(b,c){var d;if(b.modifiers.shift)var e=o.subtract(p).length/1.414213,f=p.subtract(o).quadrant,g=2===f||3===f?-e:e,h=3===f||4===f?-e:e;switch(a){case"circle":d=new paper.Shape.Circle({center:o,radius:o.subtract(p).length});break;case"ellipse":d=b.modifiers.shift?new paper.Shape.Ellipse({point:o,size:[g,h]}):new paper.Shape.Ellipse({from:o,to:p});break;case"rectangle":d=b.modifiers.shift?new paper.Shape.Rectangle({point:o,size:[g,h]}):new paper.Shape.Rectangle({from:o,to:p})}return d.data.type=a,c&&d.set("style",c),d}function g(a){n&&n.remove(),q&&(n=f(a))}function h(a){a.data.prop="object"==typeof a.data.prop?a.data.prop:{};for(var b in v)a.data.prop.hasOwnProperty(b)||(a.data.prop[b]=v[b]);a.onPropertyChange=i,a.data.exportJSON=function(a){return function(b){return c.call(a,b)}}(a),a.data.setDragMode=l,a.data.itemMouseDrag=m}function i(a,b){"confidence"===a&&(this.style=w[b],paper.view.draw())}function j(a){var c,d;if(c=paper.project.activeLayer.hitTest(a,{tolerance:7,fill:!0,stroke:!0,bounds:!0,selected:!0}),c||(c=paper.project.activeLayer.hitTest(a,{fill:!0,stroke:!0})),!c||!e(c.item))return!1;if(d=c.item,d.selected||(paper.project.deselectAll(),d.selected=!0,b.annotationSelected.dispatch(d)),"bounds"===c.type&&"center"!==c.name.split("-")[1]){var f=c.name.split("-"),g="bottom"===f[0]?"top":"bottom";g+="left"===f[1]?"Right":"Left";var h=["right"===f[1]?1:-1,"bottom"===f[0]?1:-1];l("DRAG_HANDLE",{nameStr:c.name,nameParts:f,item:c.item,fixedPt:c.item.bounds[g],resizeDir:h})}else l("FULL_DRAG",{item:d});return!0}function k(a){var b,c,d;b=new paper.Rectangle({from:s.fixedPt,to:a.point}).size,a.event.shiftKey&&(d=s.item.bounds.size.width/s.item.bounds.size.height,b.height=b.width/d),c=b.subtract(s.item.bounds.size).multiply(s.resizeDir).divide(2),s.item.size=b,s.item.translate(c.width,c.height)}function l(a,b){!a in u?(r=null,s={},t=!1):(r=u[a],s=b)}function m(a){switch(t=!0,r){case u.FULL_DRAG:this.translate(a.delta);break;case u.DRAG_HANDLE:k(a)}}var n,o,p,q=!1,r=null,s={},t=!1,u={FULL_DRAG:1,DRAG_HANDLE:4},v={comment:"",confidence:3,fill:!0},w={1:{dashArray:[10,10]},2:{dashArray:[30,10]},3:{dashArray:null}};return{exportJSON:c,importJSON:d,onKeyDown:function(a){n&&g(a)},onKeyUp:function(a){g(a)},onMouseDown:function(a){q=t=!1,j(a.point)||(paper.project.deselectAll(),b.annotationSelected.dispatch(null),paper.project.deselectAll(),q=!0,o=a.point,p=o)},onMouseDrag:function(a){q?(p=a.point,g(a)):r&&s.item&&m.call(s.item,a)},onMouseUp:function(a){if(q){if(p=a.point,g(a),q=!1,n&&n.remove(),n=null,a.delta.length>5){var c=f(a);c.data.tId="a"+c._id,c.selected=!0,h(c),b&&"function"==typeof b.annotationAdded.dispatch&&b.annotationAdded.dispatch(c)}paper.view.draw()}else t&&s.item&&(b.annotationChanged.dispatch(s.item),t=!1)}}}}); define('tools/Shape.class',["paper"],function(){return function(a,b){function c(a){var b=this.exportJSON({asString:!1});return delete b[1].fontFamily,delete b[1].font,delete b[1].fontSize,delete b[1].leading,a&&a.asString?JSON.stringify(b):b}function d(a,b,c){var d=b.importJSON(a);return h(d),d}function e(a){var b=["ellipse","rectangle"];return!!a&&a.data&&a.data.type&&b.indexOf(a.data.type)>-1}function f(b,c){var d;if(b.modifiers.shift)var e=o.subtract(p).length/1.414213,f=p.subtract(o).quadrant,g=2===f||3===f?-e:e,h=3===f||4===f?-e:e;switch(a){case"circle":d=new paper.Shape.Circle({center:o,radius:o.subtract(p).length});break;case"ellipse":d=b.modifiers.shift?new paper.Shape.Ellipse({point:o,size:[g,h]}):new paper.Shape.Ellipse({from:o,to:p});break;case"rectangle":d=b.modifiers.shift?new paper.Shape.Rectangle({point:o,size:[g,h]}):new paper.Shape.Rectangle({from:o,to:p})}return d.data.type=a,c&&d.set("style",c),d}function g(a){n&&n.remove(),q&&(n=f(a))}function h(a){a.data.prop="object"==typeof a.data.prop?a.data.prop:{};for(var b in v)a.data.prop.hasOwnProperty(b)||(a.data.prop[b]=v[b]);a.onPropertyChange=i,a.data.exportJSON=function(a){return function(b){return c.call(a,b)}}(a),a.data.setDragMode=l,a.data.itemMouseDrag=m}function i(a,b){"confidence"===a&&(this.style=w[b],paper.view.draw())}function j(a){var c,d;if(c=paper.project.activeLayer.hitTest(a,{tolerance:7,fill:!0,stroke:!0,bounds:!0,selected:!0}),c||(c=paper.project.activeLayer.hitTest(a,{fill:!0,stroke:!0})),!c||!e(c.item))return!1;if(d=c.item,d.selected||(paper.project.deselectAll(),d.selected=!0,b.annotationSelected.dispatch(d)),"bounds"===c.type&&"center"!==c.name.split("-")[1]){var f=c.name.split("-"),g="bottom"===f[0]?"top":"bottom";g+="left"===f[1]?"Right":"Left";var h=["right"===f[1]?1:-1,"bottom"===f[0]?1:-1];l("DRAG_HANDLE",{nameStr:c.name,nameParts:f,item:c.item,fixedPt:c.item.bounds[g],resizeDir:h})}else l("FULL_DRAG",{item:d});return!0}function k(a){var b,c,d;b=new paper.Rectangle({from:s.fixedPt,to:a.point}).size,a.event.shiftKey&&(d=s.item.bounds.size.width/s.item.bounds.size.height,b.height=b.width/d),c=b.subtract(s.item.bounds.size).multiply(s.resizeDir).divide(2),s.item.size=b,s.item.translate(c.width,c.height)}function l(a,b){!a in u?(r=null,s={},t=!1):(r=u[a],s=b)}function m(a){switch(t=!0,r){case u.FULL_DRAG:this.translate(a.delta);break;case u.DRAG_HANDLE:k(a)}}var n,o,p,q=!1,r=null,s={},t=!1,u={FULL_DRAG:1,DRAG_HANDLE:4},v={comment:"",confidence:3,fill:!0},w={1:{dashArray:[10,10]},2:{dashArray:[30,10]},3:{dashArray:null}};return{exportJSON:c,importJSON:d,onKeyDown:function(a){n&&g(a)},onKeyUp:function(a){g(a)},onMouseDown:function(a){q=t=!1,j(a.point)||(paper.project.deselectAll(),b.annotationSelected.dispatch(null),paper.project.deselectAll(),q=!0,o=a.point,p=o)},onMouseDrag:function(a){q?(p=a.point,g(a)):r&&s.item&&m.call(s.item,a)},onMouseUp:function(a){if(q){if(p=a.point,g(a),q=!1,n&&n.remove(),n=null,a.delta.length>5){var c=f(a);c.data.tId="a"+c._id,c.selected=!0,h(c),b&&"function"==typeof b.annotationAdded.dispatch&&b.annotationAdded.dispatch(c)}paper.view.draw()}else t&&s.item&&(b.annotationChanged.dispatch(s.item),t=!1)}}}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('tools/ellipse',["paper","tools/Shape.class"],function(a,b){var c="ellipse",d={annotationAdded:null},e=new b(c,d),f=e.exportJSON;delete e.exportJSON;var g=e.importJSON;return delete e.importJSON,{name:c,tool:new a.Tool(e),exportJSON:f,importJSON:g,registerEvent:function(a,b){d[a]=b}}}); define('tools/ellipse',["paper","tools/Shape.class"],function(a,b){var c="ellipse",d={annotationAdded:null},e=new b(c,d),f=e.exportJSON;delete e.exportJSON;var g=e.importJSON;return delete e.importJSON,{name:c,tool:new a.Tool(e),exportJSON:f,importJSON:g,registerEvent:function(a,b){d[a]=b}}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('tools/rectangle',["paper","tools/Shape.class"],function(a,b){var c="rectangle",d={annotationAdded:null,annotationSelected:null,annotationChanged:null},e=new b(c,d),f=e.exportJSON;delete e.exportJSON;var g=e.importJSON;return delete e.importJSON,{name:c,tool:new a.Tool(e),exportJSON:f,importJSON:g,registerEvent:function(a,b){d[a]=b}}}); define('tools/rectangle',["paper","tools/Shape.class"],function(a,b){var c="rectangle",d={annotationAdded:null,annotationSelected:null,annotationChanged:null},e=new b(c,d),f=e.exportJSON;delete e.exportJSON;var g=e.importJSON;return delete e.importJSON,{name:c,tool:new a.Tool(e),exportJSON:f,importJSON:g,registerEvent:function(a,b){d[a]=b}}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('tools/text',["paper","jquery"],function(a,b){function c(a,b){!a in w?(x=null,y={},z=!1):(x=w[a],y=b)}function d(a){switch(x){case w.DRAG_HANDLE:if("center"===y.nameParts[1])return;var b=y.item.bounds,c="top"===y.nameParts[0]?b.bottom-a.point.y:a.point.y-b.top,d=c/1.2,e=[0,0];"bottom"===y.nameParts[0]&&(e[1]=c-b.height),d>9&&d<999&&i.call(y.item,d),y.item.translate(e);break;case w.FULL_DRAG:default:this.translate(a.delta)}}function e(a){a.data.prop="object"==typeof a.data.prop?a.data.prop:{};for(var b in u)a.data.prop.hasOwnProperty(b)||(a.data.prop[b]=u[b]);a.oGetSelected=function(){return this.children[1].selected},a.oSetSelected=function(a){this.children[1].selected=a},a.data.setDragMode=c,a.data.itemMouseDrag=d}function f(c){if(o&&g(!1),!s){o=!0,q||(q=b("<input>",{type:"text",class:"text-tool-input",placeholder:"Votre texte",maxlength:128,size:128,style:"display:none;position:absolute;top:0;left:0;padding:10px;border:0;border-radius:5px;background:rgba(255,255,255,0.75);"}).appendTo(a.project.view.element.parentNode).on("blur",function(){o&&g()}).on("keydown",function(a){27!==a.which&&13!=a.which||g()}).autoGrowInput(),r=r||b("<div>").css({zIndex:999,position:"fixed",display:"none",top:"-10px",left:"-10px",width:"5000px",height:"5000px"}).click(function(){g()}),q.before(r)),c.selected=!1,c.visible=!1;var d=c.children[1].point;d=d.subtract(a.view.bounds.point).multiply(a.view.zoom);var e=c.fontSize*a.view.zoom;q.val(c.data.content).css({fontSize:e+"px",fontFamily:c.font,color:c.data.color,top:d.y-e+1-10,left:d.x-1-10,zIndex:1e3}).show(),r.show();var f=q.nextAll("tester");f.css({fontSize:q.css("fontSize"),fontFamily:q.css("fontFamily"),fontWeight:q.css("fontWeight"),letterSpacing:q.css("letterSpacing")}),f.text(""===c.data.content?q.attr("placeholder"):c.data.content),q.width(f.width()+30),p=c,setTimeout(function(){q.focus()},100)}}function g(b){if(b=!(b===!1),o=!1,p){var c=q.val();if(c&&""!==c){var d=""===p.data.content;p.data.content=c,p.children[0].content=c,p.children[1].content=c,p.visible=!0,b&&t.annotationSelected&&"function"==typeof t.annotationSelected.dispatch&&t.annotationSelected.dispatch(p),d?(e(p),t.annotationAdded&&"function"==typeof t.annotationAdded.dispatch&&t.annotationAdded.dispatch(p)):t.annotationChanged&&"function"==typeof t.annotationChanged.dispatch&&t.annotationChanged.dispatch(p),p.oSetSelected(b),a.project.view.draw()}else p.remove(),p=null}r.hide(),q.val("").blur().hide()}function h(a){var b=this,c=b.children[1].fillColor!==a;return b.children[1].fillColor=a,b.data.color=a,c}function i(a){var b=this,c=a/10;c<3&&(c=3),b.children[0].fontSize=a,b.children[0].strokeWidth=c,b.children[1].fontSize=a}function j(){return this.children[0].fontSize}function k(a,c,d){var g=c.importJSON(a);return b.extend(g.data,{setColor:h,setFill:v,setStrokeWidth:v,setFontSize:i,getFontSize:j}),e(g),d&&g.children[1].on("doubleclick",function(){f(this.parent)}),g}function l(a){var c=this.selected;this.selected=!1;var d=this.exportJSON({asString:!1});return b.each(d[1].children,function(a,b){delete b[1].leading}),d=a&&a.asString===!1?d:JSON.stringify(d),c&&(this.selected=c),d}function m(a){return a!==s&&(s=a),s}var n="text",o=!1,p=null,q=null,r=null,s=!1,t={annotationAdded:null,annotationChanged:null,annotationSelected:null},u={type:"point-text",comment:"",tolerance:5,fill:!0},v=function(){},w={FULL_DRAG:1,DRAG_HANDLE:4},x=null,y={},z=!1,A={onMouseDown:function(b){if(!s){var c=a.project.activeLayer.hitTest(b.point,u);if(c){var d=c.item.parent;f(d)}else{var e=a.project.currentStyle.fontSize;if(o)g();else{a.project.deselectAll();var k=b.point,l=new a.PointText({point:k,fillColor:"white",strokeColor:"white",strokeWidth:e/6,strokeJoin:"round",content:""}),m=a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor;m=m.toCSS();var q=new a.PointText({point:k,fillColor:m,strokeColor:m,strokeWidth:0,content:""});q.on("doubleclick",function(){f(this.parent)}),p=new a.Group({children:[l,q],data:{type:n,setColor:h,setFill:v,setStrokeWidth:v,setFontSize:i,getFontSize:j,content:"",color:m}}),p.data.tId="a"+p._id,p.data.content="",f(p)}}}}};return{name:n,tool:new a.Tool(A),setRo:m,exportJSON:l,importJSON:k,registerEvent:function(a,b){t[a]=b}}}); define('tools/text',["paper","jquery"],function(a,b){function c(a,b){!a in w?(x=null,y={},z=!1):(x=w[a],y=b)}function d(a){switch(x){case w.DRAG_HANDLE:if("center"===y.nameParts[1])return;var b=y.item.bounds,c="top"===y.nameParts[0]?b.bottom-a.point.y:a.point.y-b.top,d=c/1.2,e=[0,0];"bottom"===y.nameParts[0]&&(e[1]=c-b.height),d>9&&d<999&&i.call(y.item,d),y.item.translate(e);break;case w.FULL_DRAG:default:this.translate(a.delta)}}function e(a){a.data.prop="object"==typeof a.data.prop?a.data.prop:{};for(var b in u)a.data.prop.hasOwnProperty(b)||(a.data.prop[b]=u[b]);a.oGetSelected=function(){return this.children[1].selected},a.oSetSelected=function(a){this.children[1].selected=a},a.data.setDragMode=c,a.data.itemMouseDrag=d}function f(c){if(o&&g(!1),!s){o=!0,q||(q=b("<input>",{type:"text",class:"text-tool-input",placeholder:"Votre texte",maxlength:128,size:128,style:"display:none;position:absolute;top:0;left:0;padding:10px;border:0;border-radius:5px;background:rgba(255,255,255,0.75);"}).appendTo(a.project.view.element.parentNode).on("blur",function(){o&&g()}).on("keydown",function(a){27!==a.which&&13!=a.which||g()}).autoGrowInput(),r=r||b("<div>").css({zIndex:999,position:"fixed",display:"none",top:"-10px",left:"-10px",width:"5000px",height:"5000px"}).click(function(){g()}),q.before(r)),c.selected=!1,c.visible=!1;var d=c.children[1].point;d=d.subtract(a.view.bounds.point).multiply(a.view.zoom);var e=c.fontSize*a.view.zoom;q.val(c.data.content).css({fontSize:e+"px",fontFamily:c.font,color:c.data.color,top:d.y-e+1-10,left:d.x-1-10,zIndex:1e3}).show(),r.show();var f=q.nextAll("tester");f.css({fontSize:q.css("fontSize"),fontFamily:q.css("fontFamily"),fontWeight:q.css("fontWeight"),letterSpacing:q.css("letterSpacing")}),f.text(""===c.data.content?q.attr("placeholder"):c.data.content),q.width(f.width()+30),p=c,setTimeout(function(){q.focus()},100)}}function g(b){if(b=!(b===!1),o=!1,p){var c=q.val();if(c&&""!==c){var d=""===p.data.content;p.data.content=c,p.children[0].content=c,p.children[1].content=c,p.visible=!0,b&&t.annotationSelected&&"function"==typeof t.annotationSelected.dispatch&&t.annotationSelected.dispatch(p),d?(e(p),t.annotationAdded&&"function"==typeof t.annotationAdded.dispatch&&t.annotationAdded.dispatch(p)):t.annotationChanged&&"function"==typeof t.annotationChanged.dispatch&&t.annotationChanged.dispatch(p),p.oSetSelected(b),a.project.view.draw()}else p.remove(),p=null}r.hide(),q.val("").blur().hide()}function h(a){var b=this,c=b.children[1].fillColor!==a;return b.children[1].fillColor=a,b.data.color=a,c}function i(a){var b=this,c=a/10;c<3&&(c=3),b.children[0].fontSize=a,b.children[0].strokeWidth=c,b.children[1].fontSize=a}function j(){return this.children[0].fontSize}function k(a,c,d){var g=c.importJSON(a);return b.extend(g.data,{setColor:h,setFill:v,setStrokeWidth:v,setFontSize:i,getFontSize:j}),e(g),d&&g.children[1].on("doubleclick",function(){f(this.parent)}),g}function l(a){var c=this.selected;this.selected=!1;var d=this.exportJSON({asString:!1});return b.each(d[1].children,function(a,b){delete b[1].leading}),d=a&&a.asString===!1?d:JSON.stringify(d),c&&(this.selected=c),d}function m(a){return a!==s&&(s=a),s}var n="text",o=!1,p=null,q=null,r=null,s=!1,t={annotationAdded:null,annotationChanged:null,annotationSelected:null},u={type:"point-text",comment:"",tolerance:5,fill:!0},v=function(){},w={FULL_DRAG:1,DRAG_HANDLE:4},x=null,y={},z=!1,A={onMouseDown:function(b){if(!s){var c=a.project.activeLayer.hitTest(b.point,u);if(c){var d=c.item.parent;f(d)}else{var e=a.project.currentStyle.fontSize;if(o)g();else{a.project.deselectAll();var k=b.point,l=new a.PointText({point:k,fillColor:"white",strokeColor:"white",strokeWidth:e/6,strokeJoin:"round",content:""}),m=a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor;m=m.toCSS();var q=new a.PointText({point:k,fillColor:m,strokeColor:m,strokeWidth:0,content:""});q.on("doubleclick",function(){f(this.parent)}),p=new a.Group({children:[l,q],data:{type:n,setColor:h,setFill:v,setStrokeWidth:v,setFontSize:i,getFontSize:j,content:"",color:m}}),p.data.tId="a"+p._id,p.data.content="",f(p)}}}}};return{name:n,tool:new a.Tool(A),setRo:m,exportJSON:l,importJSON:k,registerEvent:function(a,b){t[a]=b}}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('tools/arrow',["paper"],function(a){function b(a){var b=(this.data.from,this.data.to,this.exportJSON({asString:!1}));try{b[1][1].data.from=[this.data.from.x,this.data.from.y],b[1][1].data.to=[this.data.to.x,this.data.to.y]}catch(a){console.error(a)}return a&&a.asString?JSON.stringify(b):b}function c(b,c,d){var e=b[1][1],f=b[0][1][e.symbol][1][1],h=f.fillColor&&(f.fillColor.length<3||0!==f.fillColor[3]),i=parseFloat(e.opacity)||1,k=a.project.activeLayer;c.activate(),e.data.from.length>2&&(e.data.from=e.data.from.splice(1)),e.data.to.length>2&&(e.data.to=e.data.to.splice(1));var m=g({from:new a.Point(e.data.from),prop:e.data.prop,scale:e.data.scale||{h:1,v:1}},d);return m.opacity=i,j.call(m,f.strokeColor),l.call(m,h),n.call(m,f.strokeWidth),u(m,{from:m.data.from,to:new a.Point(e.data.to)}),k.activate(),m}function d(){if(!y){var b=new a.Path({segments:[[0,-5],[0,5],new a.Segment([20,5]),[10,30],new a.Segment([50,0]),[10,-30],new a.Segment([20,-5])],strokeJoin:"round",strokeScaling:!1,closed:!0});z=1,A=3,B=4,C=b.segments[A].point.x-b.segments[z].point.x,y=new a.Symbol(b),b.remove()}}function e(a,b){b=b||this;var c=b.symbol.definition.segments[2].point.x,d=b.symbol.definition.segments[B].point.x,e=b.globalToLocal(a).x;return(e-c)/(d-c)>.1}function f(a,b){b=b||this,a=a||b.symbol.definition.segments[B].point.x-b.symbol.definition.segments[z].point.x;var c=b.symbol.definition.segments[B].point.x-b.symbol.definition.segments[A].point.x;return a-c<C}function g(b,c){var e,f,g,h,v;d(),e=new a.PlacedSymbol(y.clone()),f=e.symbol.definition.bounds.width,g=new a.Point(b.from),h=new a.Point([g.x+f,g.y]),v=b.scale||{h:1,v:1},e.pivot=[-f/2,0],u(e,{from:g,to:h}),i.call(e,v),l.call(e,a.project.currentStyle.fillColor),j.call(e,a.project.currentStyle.strokeColor),n.call(e,a.project.currentStyle.strokeWidth),b.prop="object"==typeof b.prop?b.prop:{};for(var w in G)b.prop.hasOwnProperty(w)||(b.prop[w]=G[w]);return e.data={tId:"a"+e._id,type:D,prop:b.prop,from:g,to:h,scale:v,setColor:j,getColor:k,setFill:l,getFill:m,setStrokeWidth:n,getStrokeWidth:o,setDragMode:p,itemMouseDrag:r},c!==!1&&(e.onMouseDown=q,e.onMouseUp=s,e.onPropertyChange=t),e}function h(){this.data.from=this.position,this.data.to=this.data.from.add(new a.Point({length:this.symbol.definition.bounds.width,angle:this.rotation}))}function i(a){var b=y.definition.bounds.width;this.symbol.definition.scale(a.h,a.v,[-b/2,0]),this.data.scale||(this.data.scale={h:1,v:1}),this.data.scale.h*=a.h,this.data.scale.v*=a.v,h.call(this)}function j(a){this.symbol.definition.strokeColor=a,this.symbol.definition.fillColor.alpha>0&&(this.symbol.definition.fillColor=a)}function k(){return this.symbol.definition.strokeColor}function l(a){a?this.symbol.definition.fillColor=this.symbol.definition.strokeColor:this.symbol.definition.fillColor=H}function m(){return this.symbol.definition.fillColor.alpha>0}function n(a){this.symbol.definition.strokeWidth=a}function o(){return this.symbol.definition.strokeWidth}function p(a,b){!a in I?(J=null,K={},L=!1):(J=I[a],K=b)}function q(a){if(this.selected&&!E){J=I.FULL_DRAG;var b=this.data.to,c=this.data.from;e.call(this,a.point)?p("DRAG_TO",{delta:b.subtract(a.point)}):c.getDistance(a.point)<30&&p("DRAG_FROM",{delta:c.subtract(a.point)}),this.attach("mousedrag",r)}}function r(a){if(!E){L=!0;var b={from:this.data.from,to:this.data.to};switch(J){case I.FULL_DRAG:this.translate(a.delta),h.call(this);break;case I.DRAG_TO:b.to=K.delta?a.point.add(K.delta):a.point,delete b.from,u(this,b);break;case I.DRAG_FROM:b.from=K.delta?a.point.add(K.delta):a.point,delete b.to,u(this,b);break;case I.DRAG_HANDLE:if("right"!==K.nameParts[1])L=!1;else{var c=a.point.subtract(b.from).project(b.to.subtract(b.from)),d=c.length/this.symbol.definition.bounds.width,e=a.event.shiftKey?d:a.point.subtract(c.add(b.from)).length/this.symbol.definition.bounds.height*2;i.call(this,{h:d,v:e})}break;default:L=!1}}}function s(a){this.detach("mousedrag",r),h.call(this),J=null,L&&F.annotationChanged.dispatch(this),L=!1}function t(a,b){}function u(b,c){var d,e,g,h,i="";if(c.from||(c.from=b.data.from,i="to"),c.to||(c.to=b.data.to,i="from"),d=c.to.subtract(c.from),e=d.angle,g=b.symbol.definition.bounds.width,h=d.length-g,f.call(b,g+h)&&(h=0,"from"===i&&(c.from=c.to.subtract(new a.Point({length:g,angle:e})))),b.rotation=e,b.position=c.from,0!==h)for(var j,k=2;j=b.symbol.definition.segments[k];k++)j.point.x+=h;b.data.from=c.from,b.data.to=c.to}function v(a){return a.data&&a.data.type===D?a:a.parent?v(a.parent):null}function w(b){var c,d;if(c=a.project.activeLayer.hitTest(b,{tolerance:7,fill:!0,stroke:!0,segments:!0,handles:!0,ends:!0,bounds:!0,selected:!0}),c||(c=a.project.activeLayer.hitTest(b,{fill:!0,stroke:!0})),!c||!c.item)return!1;if(d=v(c.item),!d)return!1;if(d.selected=!0,"bounds"===c.type){var e=c.name.split("-");"right"===e[1]&&p("DRAG_HANDLE",{nameStr:c.name,nameParts:c.name.split("-"),item:d})}return!0}function x(a){return a!==E&&(E=a),E}var y,z,A,B,C,D="arrow",E=!1,F={annotationAdded:null,annotationSelected:null,annotationChanged:null},G={comment:"",fill:!0},H=new a.Color([0,0,0,0]),I={FULL_DRAG:1,DRAG_TO:2,DRAG_FROM:3,DRAG_HANDLE:4},J=null,K={},L=!1,M=!1,N=null,O=null,P={onMouseDown:function(b){if(!E){M=!1,O=null,w(b.point)||(a.project.deselectAll(),F.annotationSelected.dispatch(null),M=!0,N=b.point,O=g({from:N},!0),O.visible=!1)}},onMouseDrag:function(a){E||(M&&O?(u(O,{from:N,to:a.point}),O.visible=!0):J===I.DRAG_HANDLE&&K.item&&r.call(K.item,a))},onMouseUp:function(a){p(null),M&&O&&(F.annotationAdded.dispatch(O),M=!1,O.selected=!0,O.visible=!0,O=null)}};return{name:D,tool:new a.Tool(P),setRo:x,registerEvent:function(a,b){F[a]=b},exportJSON:b,importJSON:c,listeners:{}}}); define('tools/arrow',["paper"],function(a){function b(a){var b=(this.data.from,this.data.to,this.exportJSON({asString:!1}));try{b[1][1].data.from=[this.data.from.x,this.data.from.y],b[1][1].data.to=[this.data.to.x,this.data.to.y]}catch(a){console.error(a)}return a&&a.asString?JSON.stringify(b):b}function c(b,c,d){var e=b[1][1],f=b[0][1][e.symbol][1][1],h=f.fillColor&&(f.fillColor.length<3||0!==f.fillColor[3]),i=parseFloat(e.opacity)||1,k=a.project.activeLayer;c.activate(),e.data.from.length>2&&(e.data.from=e.data.from.splice(1)),e.data.to.length>2&&(e.data.to=e.data.to.splice(1));var m=g({from:new a.Point(e.data.from),prop:e.data.prop,scale:e.data.scale||{h:1,v:1}},d);return m.opacity=i,j.call(m,f.strokeColor),l.call(m,h),n.call(m,f.strokeWidth),u(m,{from:m.data.from,to:new a.Point(e.data.to)}),k.activate(),m}function d(){if(!y){var b=new a.Path({segments:[[0,-5],[0,5],new a.Segment([20,5]),[10,30],new a.Segment([50,0]),[10,-30],new a.Segment([20,-5])],strokeJoin:"round",strokeScaling:!1,closed:!0});z=1,A=3,B=4,C=b.segments[A].point.x-b.segments[z].point.x,y=new a.Symbol(b),b.remove()}}function e(a,b){b=b||this;var c=b.symbol.definition.segments[2].point.x,d=b.symbol.definition.segments[B].point.x,e=b.globalToLocal(a).x;return(e-c)/(d-c)>.1}function f(a,b){b=b||this,a=a||b.symbol.definition.segments[B].point.x-b.symbol.definition.segments[z].point.x;var c=b.symbol.definition.segments[B].point.x-b.symbol.definition.segments[A].point.x;return a-c<C}function g(b,c){var e,f,g,h,v;d(),e=new a.PlacedSymbol(y.clone()),f=e.symbol.definition.bounds.width,g=new a.Point(b.from),h=new a.Point([g.x+f,g.y]),v=b.scale||{h:1,v:1},e.pivot=[-f/2,0],u(e,{from:g,to:h}),i.call(e,v),l.call(e,a.project.currentStyle.fillColor),j.call(e,a.project.currentStyle.strokeColor),n.call(e,a.project.currentStyle.strokeWidth),b.prop="object"==typeof b.prop?b.prop:{};for(var w in G)b.prop.hasOwnProperty(w)||(b.prop[w]=G[w]);return e.data={tId:"a"+e._id,type:D,prop:b.prop,from:g,to:h,scale:v,setColor:j,getColor:k,setFill:l,getFill:m,setStrokeWidth:n,getStrokeWidth:o,setDragMode:p,itemMouseDrag:r},c!==!1&&(e.onMouseDown=q,e.onMouseUp=s,e.onPropertyChange=t),e}function h(){this.data.from=this.position,this.data.to=this.data.from.add(new a.Point({length:this.symbol.definition.bounds.width,angle:this.rotation}))}function i(a){var b=y.definition.bounds.width;this.symbol.definition.scale(a.h,a.v,[-b/2,0]),this.data.scale||(this.data.scale={h:1,v:1}),this.data.scale.h*=a.h,this.data.scale.v*=a.v,h.call(this)}function j(a){this.symbol.definition.strokeColor=a,this.symbol.definition.fillColor.alpha>0&&(this.symbol.definition.fillColor=a)}function k(){return this.symbol.definition.strokeColor}function l(a){a?this.symbol.definition.fillColor=this.symbol.definition.strokeColor:this.symbol.definition.fillColor=H}function m(){return this.symbol.definition.fillColor.alpha>0}function n(a){this.symbol.definition.strokeWidth=a}function o(){return this.symbol.definition.strokeWidth}function p(a,b){!a in I?(J=null,K={},L=!1):(J=I[a],K=b)}function q(a){if(this.selected&&!E){J=I.FULL_DRAG;var b=this.data.to,c=this.data.from;e.call(this,a.point)?p("DRAG_TO",{delta:b.subtract(a.point)}):c.getDistance(a.point)<30&&p("DRAG_FROM",{delta:c.subtract(a.point)}),this.attach("mousedrag",r)}}function r(a){if(!E){L=!0;var b={from:this.data.from,to:this.data.to};switch(J){case I.FULL_DRAG:this.translate(a.delta),h.call(this);break;case I.DRAG_TO:b.to=K.delta?a.point.add(K.delta):a.point,delete b.from,u(this,b);break;case I.DRAG_FROM:b.from=K.delta?a.point.add(K.delta):a.point,delete b.to,u(this,b);break;case I.DRAG_HANDLE:if("right"!==K.nameParts[1])L=!1;else{var c=a.point.subtract(b.from).project(b.to.subtract(b.from)),d=c.length/this.symbol.definition.bounds.width,e=a.event.shiftKey?d:a.point.subtract(c.add(b.from)).length/this.symbol.definition.bounds.height*2;i.call(this,{h:d,v:e})}break;default:L=!1}}}function s(a){this.detach("mousedrag",r),h.call(this),J=null,L&&F.annotationChanged.dispatch(this),L=!1}function t(a,b){}function u(b,c){var d,e,g,h,i="";if(c.from||(c.from=b.data.from,i="to"),c.to||(c.to=b.data.to,i="from"),d=c.to.subtract(c.from),e=d.angle,g=b.symbol.definition.bounds.width,h=d.length-g,f.call(b,g+h)&&(h=0,"from"===i&&(c.from=c.to.subtract(new a.Point({length:g,angle:e})))),b.rotation=e,b.position=c.from,0!==h)for(var j,k=2;j=b.symbol.definition.segments[k];k++)j.point.x+=h;b.data.from=c.from,b.data.to=c.to}function v(a){return a.data&&a.data.type===D?a:a.parent?v(a.parent):null}function w(b){var c,d;if(c=a.project.activeLayer.hitTest(b,{tolerance:7,fill:!0,stroke:!0,segments:!0,handles:!0,ends:!0,bounds:!0,selected:!0}),c||(c=a.project.activeLayer.hitTest(b,{fill:!0,stroke:!0})),!c||!c.item)return!1;if(d=v(c.item),!d)return!1;if(d.selected=!0,"bounds"===c.type){var e=c.name.split("-");"right"===e[1]&&p("DRAG_HANDLE",{nameStr:c.name,nameParts:c.name.split("-"),item:d})}return!0}function x(a){return a!==E&&(E=a),E}var y,z,A,B,C,D="arrow",E=!1,F={annotationAdded:null,annotationSelected:null,annotationChanged:null},G={comment:"",fill:!0},H=new a.Color([0,0,0,0]),I={FULL_DRAG:1,DRAG_TO:2,DRAG_FROM:3,DRAG_HANDLE:4},J=null,K={},L=!1,M=!1,N=null,O=null,P={onMouseDown:function(b){if(!E){M=!1,O=null,w(b.point)||(a.project.deselectAll(),F.annotationSelected.dispatch(null),M=!0,N=b.point,O=g({from:N},!0),O.visible=!1)}},onMouseDrag:function(a){E||(M&&O?(u(O,{from:N,to:a.point}),O.visible=!0):J===I.DRAG_HANDLE&&K.item&&r.call(K.item,a))},onMouseUp:function(a){p(null),M&&O&&(F.annotationAdded.dispatch(O),M=!1,O.selected=!0,O.visible=!0,O=null)}};return{name:D,tool:new a.Tool(P),setRo:x,registerEvent:function(a,b){F[a]=b},exportJSON:b,importJSON:c,listeners:{}}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('tools/fieldedges',["paper"],function(a){function b(b,f){b.style="object"==typeof b.style?b.style:{};for(var g in L)b.style.hasOwnProperty(g)||(b.style[g]=L[g]);b.firstEdge=new a.Path.Line({from:b.p1s,to:b.p1e}),b.secondEdge=new a.Path.Line({from:b.p2s,to:b.p2e});var h=new a.Group({children:[b.firstEdge,b.secondEdge],style:b.style});b.prop="object"==typeof b.prop?b.prop:{};for(var g in H)b.prop.hasOwnProperty(g)||(b.prop[g]=H[g]);var i=[b.firstEdge.segments[0].point,b.firstEdge.segments[1].point,b.secondEdge.segments[0].point,b.secondEdge.segments[1].point].map(function(a){return[a.x,a.y]});return h.data={tId:"a"+h._id,type:B,prop:b.prop,points:i,itemMouseDrag:d},f||(h.onMouseDown=function(b){this.oGetSelected()?c(b):(a.project.deselectAll(),this.oSetSelected(!0),F.annotationSelected.dispatch(this))},h.oGetSelected=function(){for(var a,b=0;a=this.children[b];b++)if(!a.selected)return!1;return!0},h.oSetSelected=function(a){this.children.map(function(b){b.selected=a})},h.onMouseUp=e),F.annotationAdded.dispatch(h),h}function c(a){J!==I.DONE&&J!==I.CREATED_BOTH||o(a)}function d(a){J===I.EDITING&&k(a)}function e(a){J===I.EDITING&&p(a)}function f(a){var b=this.exportJSON({asString:!1});b[1].data.points=[s,t,u,v].map(function(a){return[a.x,a.y]});var c=["fontFamily","font","fontSize","fontLeading","leading","selected"];return[b[1],b[1].children[0][1],b[1].children[1][1]].forEach(function(a){c.forEach(function(b){a.hasOwnProperty(b)&&delete a[b]})}),b=a&&a.asString===!1?b:JSON.stringify(b)}function g(c,d,e){var f=c[1],g=f.data&&f.data.points;if(!g)return null;var h={};try{h.strokeWidth=f.children[0][1].strokeWidth}catch(a){}var i=a.project.activeLayer;d.activate();var k=b({p1s:g[0],p1e:g[1],p2s:g[2],p2e:g[3],style:h,prop:f.data.prop});return e&&(w=k.children[0],x=k.children[1],j(),J=I.CREATED_BOTH),i.activate(),k}function h(){s=t=u=v=A=null,w&&w.remove(),x&&x.remove(),w=x=null}function i(b){switch(J){case I.READY:break;case I.CREATE_FIRST:w&&w.remove(),w=new a.Path.Line({from:s,to:t}),w.style=K;break;case I.CREATE_SECOND:w&&w.remove(),w=new a.Path.Line({from:s,to:t}),w.style=L,x&&x.remove(),x=new a.Path.Line({from:u,to:v}),x.style=K;break;case I.CREATED_BOTH:}}function j(){s=w.segments[0].point,t=w.segments[1].point,u=x.segments[0].point,v=x.segments[1].point,A=u.subtract(s)}function k(a){if(y)if(isNaN(parseInt(z,2)))y.translate(a.delta);else{var b=y===w,c=b?x:w,d=b?a.point.add(A):a.point.subtract(A);y.insert(z,a.point),y.segments[z+1].remove(),c.insert(z,d),c.segments[z+1].remove()}}function l(a){s=t=a.point,J=I.CREATE_FIRST}function m(a){u=s,v=t,J=I.CREATE_SECOND}function n(a){J=I.CREATED_BOTH,A=u.subtract(s);var c=b({p1s:s,p1e:t,p2s:u,p2e:v});w&&w.remove(),w=c.children[0],x&&x.remove(),x=c.children[1],j()}function o(b){J=I.EDITING,y=z=null;var c=a.project.activeLayer.hitTest(b.point,E);c&&"pixel"!==c.type&&(c.item===w?y=w:c.item===x&&(y=x),a.project.deselectAll(),y.selected=!0,F.annotationSelected.dispatch(y),y&&"segment"===c.type&&(z=y.segments[0]===c.segment?0:1))}function p(a){J=I.DONE;var b=y?y.parent:null;y=z=null,j(),b&&F.annotationChanged.dispatch(b)}function q(a){G&&(w.strokeWidth=a,x.strokeWidth=a,D=a)}function r(a){G=a===B}var s,t,u,v,w,x,y,z,A,B="fieldedges",C=new a.Color("#E100FF"),D=3,E={segments:!0,stroke:!0,fill:!1,tolerance:5,bounds:!1,handles:!0},F={annotationAdded:null,annotationSelected:null,annotationChanged:null},G=!1,H={comment:""},I={READY:1,CREATE_FIRST:2,CREATE_SECOND:3,CREATED_BOTH:4,EDITING:5,DONE:6},J=I.READY,K={strokeWidth:D,strokeColor:C,dashArray:[9,4]},L={strokeWidth:D,strokeColor:C},M={onMouseDown:function(a){switch(J){case I.READY:h(),l(a);break;case I.CREATE_FIRST:m(a);break;case I.CREATE_SECOND:n(a);break;case I.CREATED_BOTH:case I.DONE:o(a)}i(a)},onMouseMove:function(a){switch(J){case I.CREATE_FIRST:t=a.point,i(a);break;case I.CREATE_SECOND:v=a.point,u=s.add(v.subtract(t)),i(a);break;case I.EDITING:k(a)}},onMouseUp:function(a){switch(J){case I.EDITING:p(a)}}};return{name:B,tool:new a.Tool(M),registerEvent:function(a,b){F[a]=b},exportJSON:f,importJSON:g,listeners:{onStrokeWidthChanged:q,onToolActivated:r}}}); define('tools/fieldedges',["paper"],function(a){function b(b,f){b.style="object"==typeof b.style?b.style:{};for(var g in L)b.style.hasOwnProperty(g)||(b.style[g]=L[g]);b.firstEdge=new a.Path.Line({from:b.p1s,to:b.p1e}),b.secondEdge=new a.Path.Line({from:b.p2s,to:b.p2e});var h=new a.Group({children:[b.firstEdge,b.secondEdge],style:b.style});b.prop="object"==typeof b.prop?b.prop:{};for(var g in H)b.prop.hasOwnProperty(g)||(b.prop[g]=H[g]);var i=[b.firstEdge.segments[0].point,b.firstEdge.segments[1].point,b.secondEdge.segments[0].point,b.secondEdge.segments[1].point].map(function(a){return[a.x,a.y]});return h.data={tId:"a"+h._id,type:B,prop:b.prop,points:i,itemMouseDrag:d},f||(h.onMouseDown=function(b){this.oGetSelected()?c(b):(a.project.deselectAll(),this.oSetSelected(!0),F.annotationSelected.dispatch(this))},h.oGetSelected=function(){for(var a,b=0;a=this.children[b];b++)if(!a.selected)return!1;return!0},h.oSetSelected=function(a){this.children.map(function(b){b.selected=a})},h.onMouseUp=e),F.annotationAdded.dispatch(h),h}function c(a){J!==I.DONE&&J!==I.CREATED_BOTH||o(a)}function d(a){J===I.EDITING&&k(a)}function e(a){J===I.EDITING&&p(a)}function f(a){var b=this.exportJSON({asString:!1});b[1].data.points=[s,t,u,v].map(function(a){return[a.x,a.y]});var c=["fontFamily","font","fontSize","fontLeading","leading","selected"];return[b[1],b[1].children[0][1],b[1].children[1][1]].forEach(function(a){c.forEach(function(b){a.hasOwnProperty(b)&&delete a[b]})}),b=a&&a.asString===!1?b:JSON.stringify(b)}function g(c,d,e){var f=c[1],g=f.data&&f.data.points;if(!g)return null;var h={};try{h.strokeWidth=f.children[0][1].strokeWidth}catch(a){}var i=a.project.activeLayer;d.activate();var k=b({p1s:g[0],p1e:g[1],p2s:g[2],p2e:g[3],style:h,prop:f.data.prop});return e&&(w=k.children[0],x=k.children[1],j(),J=I.CREATED_BOTH),i.activate(),k}function h(){s=t=u=v=A=null,w&&w.remove(),x&&x.remove(),w=x=null}function i(b){switch(J){case I.READY:break;case I.CREATE_FIRST:w&&w.remove(),w=new a.Path.Line({from:s,to:t}),w.style=K;break;case I.CREATE_SECOND:w&&w.remove(),w=new a.Path.Line({from:s,to:t}),w.style=L,x&&x.remove(),x=new a.Path.Line({from:u,to:v}),x.style=K;break;case I.CREATED_BOTH:}}function j(){s=w.segments[0].point,t=w.segments[1].point,u=x.segments[0].point,v=x.segments[1].point,A=u.subtract(s)}function k(a){if(y)if(isNaN(parseInt(z,2)))y.translate(a.delta);else{var b=y===w,c=b?x:w,d=b?a.point.add(A):a.point.subtract(A);y.insert(z,a.point),y.segments[z+1].remove(),c.insert(z,d),c.segments[z+1].remove()}}function l(a){s=t=a.point,J=I.CREATE_FIRST}function m(a){u=s,v=t,J=I.CREATE_SECOND}function n(a){J=I.CREATED_BOTH,A=u.subtract(s);var c=b({p1s:s,p1e:t,p2s:u,p2e:v});w&&w.remove(),w=c.children[0],x&&x.remove(),x=c.children[1],j()}function o(b){J=I.EDITING,y=z=null;var c=a.project.activeLayer.hitTest(b.point,E);c&&"pixel"!==c.type&&(c.item===w?y=w:c.item===x&&(y=x),a.project.deselectAll(),y.selected=!0,F.annotationSelected.dispatch(y),y&&"segment"===c.type&&(z=y.segments[0]===c.segment?0:1))}function p(a){J=I.DONE;var b=y?y.parent:null;y=z=null,j(),b&&F.annotationChanged.dispatch(b)}function q(a){G&&(w.strokeWidth=a,x.strokeWidth=a,D=a)}function r(a){G=a===B}var s,t,u,v,w,x,y,z,A,B="fieldedges",C=new a.Color("#E100FF"),D=3,E={segments:!0,stroke:!0,fill:!1,tolerance:5,bounds:!1,handles:!0},F={annotationAdded:null,annotationSelected:null,annotationChanged:null},G=!1,H={comment:""},I={READY:1,CREATE_FIRST:2,CREATE_SECOND:3,CREATED_BOTH:4,EDITING:5,DONE:6},J=I.READY,K={strokeWidth:D,strokeColor:C,dashArray:[9,4]},L={strokeWidth:D,strokeColor:C},M={onMouseDown:function(a){switch(J){case I.READY:h(),l(a);break;case I.CREATE_FIRST:m(a);break;case I.CREATE_SECOND:n(a);break;case I.CREATED_BOTH:case I.DONE:o(a)}i(a)},onMouseMove:function(a){switch(J){case I.CREATE_FIRST:t=a.point,i(a);break;case I.CREATE_SECOND:v=a.point,u=s.add(v.subtract(t)),i(a);break;case I.EDITING:k(a)}},onMouseUp:function(a){switch(J){case I.EDITING:p(a)}}};return{name:B,tool:new a.Tool(M),registerEvent:function(a,b){F[a]=b},exportJSON:f,importJSON:g,listeners:{onStrokeWidthChanged:q,onToolActivated:r}}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('tools/concordantstr',["paper"],function(a){function b(a){var b=this.exportJSON({asString:!1});return b[1].strokeColor||(b[1].strokeWidth=0),delete b[1].fontFamily,delete b[1].font,delete b[1].fontSize,delete b[1].leading,a&&a.asString?JSON.stringify(b):b}function c(b,c,d){var e=b[1],f=a.project.activeLayer;c.activate();var h=g({from:e.segments[0],to:e.segments[1],strokeWidth:e.strokeWidth,prop:e.data.prop},{not_interactive:!0});return f.activate(),h}function d(a){y=a}function e(a){z=Math.floor(1.5*a)}function f(a){x=a===v}function g(b,c){var d=new a.Path.Line({from:b.from,to:b.to});b.prop="object"==typeof b.prop?b.prop:{};for(var e in N)b.prop.hasOwnProperty(e)||(b.prop[e]=N[e]);return d.style=B[b.prop.confidence],parseInt(b.strokeWidth,10)&&(d.strokeWidth=b.strokeWidth),d.data={tId:"a"+d._id,type:v,prop:b.prop,itemMouseDrag:i,itemMouseUp:j},c&&c.not_interactive||(d.selected=!0,w.annotationSelected.dispatch(d)),d.onMouseDown=h,d.onKeyDown=k,d.onKeyUp=l,d.onPropertyChange=m,d}function h(b){var c=this;H=this;var d=c.hitTest(b.point,C);c.layer.activate(),a.project.deselectAll(),c.selected=!0,w.annotationSelected.dispatch(c),I=K=L=J=null,"segment"===d.type?(I=d.segment.index,J=y+(H.segments[1-I].point.x<y?1:-1)*z):(K=H.getFirstSegment().point.x<y?0:1,L=1-K),M=!1,w.annotationSelected.dispatch(c)}function i(a){a.tool&&(null!==I?s(a):H&&H.segments[K].point.x+a.delta.x<=y-z&&H.segments[L].point.x+a.delta.x>=y+z&&(H.translate(a.delta),M=!0))}function j(a){a.tool&&(H&&M&&(w.annotationChanged.dispatch([H]),M=!1),I=K=L=H=J=null)}function k(b){var c;switch(b.key){case"up":c=[0,-1];break;case"down":c=[0,1]}c&&(c=new a.Point(c).multiply(a.view.zoom<4.5?1:.5),H=this,this.translate(c),M=!0,a.view.draw())}function l(a){switch(a.key){case"up":case"down":M&&(w.annotationChanged.dispatch([H]),M=!1)}}function m(b,c){"confidence"===b&&(this.style=B[c],a.view.draw())}function n(a,b){return a.x<=y&&b.x>=y+z||a.x>=y&&b.x<=y-z}function o(){F&&F.remove(),E=null,D=!1}function p(){var a=F?F.segments[1].point.clone():null;if(n(E,a)){F&&(F.remove(),F=null);var b=g({from:E,to:a});w.annotationAdded.dispatch(b),E=null,D=!1}}function q(b,c,d){d?u&&(b.segments[c].point.y=u.y,a.view.draw()):(u=b.segments[c].point.clone(),b.segments[c].point.y=b.segments[1-c].point.y)}function r(b){F?(F.segments[1].point=b.point,b.event.shiftKey&&q(F,1)):(F=new a.Path.Line({from:E,to:b.point}),F.style=A,F.dashArray=[10,5]),F.opacity=n(E,b.point)?1:.5,F.dashArray=n(E,b.point)?null:[10,5]}function s(a){var b=a.point.clone();n(H.segments[1-I].point,b)||(b.x=J),H.segments[I].point=b,a.event.shiftKey&&q(H,I),M=!0}var t,u,v="concordantstr",w={annotationAdded:null,annotationSelected:null},x=!1,y=0,z=10,A={strokeWidth:3,strokeColor:"red"},B={1:{strokeColor:new a.Color("#FF3737"),dashArray:[10,10]},2:{strokeColor:new a.Color("#FF3737"),dashArray:[30,10]},3:{strokeColor:new a.Color("#FF0000"),dashArray:null}},C={segments:!0,stroke:!0,fill:!1,tolerance:5,bounds:!1,handles:!0},D=!0,E=null,F=null,G=!1,H=null,I=null,J=null,K=null,L=null,M=!1,N={confidence:3,comment:""},O={onMouseDown:function(b){if(E)F&&!G&&p();else{var c=a.project.activeLayer.hitTest(b.point,C);c?c.item.onMouseDown(b):(a.project.deselectAll(),w.annotationSelected.dispatch(null),E||(I=H=null,D=!0,F&&F.remove(),F=null,E=b.point,G=!1))}},onMouseDrag:function(a){D&&E&&(G=!0,r(a)),H&&H.data.itemMouseDrag(a)},onMouseMove:function(a){D&&E&&r(a)},onMouseUp:function(a){E?F&&G&&(r(a),p()):H&&H.data.itemMouseUp(a),I=H=null},onKeyDown:function(b){switch(b.key){case"enter":D&&p();break;case"escape":D&&o();break;case"shift":F?q(F,1):H&&null!==I&&q(H,I);break;case"up":case"down":for(var c,d=a.project.getSelectedItems(),e=0;c=d[e];e++)if(c.data.type&&"function"==typeof c.onKeyDown){c.onKeyDown(b);break}}},onKeyUp:function(b){switch(b.key){case"shift":F?q(F,1,!0):H&&I&&q(H,I,!0);break;case"up":case"down":for(var c,d=a.project.getSelectedItems(),e=0;c=d[e];e++)if(c.data.type&&"function"==typeof c.onKeyUp){c.onKeyUp(b);break}}}};return t=new a.Tool(O),{name:v,tool:t,registerEvent:function(a,b){w[a]=b},exportJSON:b,importJSON:c,listeners:{onCutPositionChanged:d,onCutMarginChanged:e,onToolActivated:f}}}); define('tools/concordantstr',["paper"],function(a){function b(a){var b=this.exportJSON({asString:!1});return b[1].strokeColor||(b[1].strokeWidth=0),delete b[1].fontFamily,delete b[1].font,delete b[1].fontSize,delete b[1].leading,a&&a.asString?JSON.stringify(b):b}function c(b,c,d){var e=b[1],f=a.project.activeLayer;c.activate();var h=g({from:e.segments[0],to:e.segments[1],strokeWidth:e.strokeWidth,prop:e.data.prop},{not_interactive:!0});return f.activate(),h}function d(a){y=a}function e(a){z=Math.floor(1.5*a)}function f(a){x=a===v}function g(b,c){var d=new a.Path.Line({from:b.from,to:b.to});b.prop="object"==typeof b.prop?b.prop:{};for(var e in N)b.prop.hasOwnProperty(e)||(b.prop[e]=N[e]);return d.style=B[b.prop.confidence],parseInt(b.strokeWidth,10)&&(d.strokeWidth=b.strokeWidth),d.data={tId:"a"+d._id,type:v,prop:b.prop,itemMouseDrag:i,itemMouseUp:j},c&&c.not_interactive||(d.selected=!0,w.annotationSelected.dispatch(d)),d.onMouseDown=h,d.onKeyDown=k,d.onKeyUp=l,d.onPropertyChange=m,d}function h(b){var c=this;H=this;var d=c.hitTest(b.point,C);c.layer.activate(),a.project.deselectAll(),c.selected=!0,w.annotationSelected.dispatch(c),I=K=L=J=null,"segment"===d.type?(I=d.segment.index,J=y+(H.segments[1-I].point.x<y?1:-1)*z):(K=H.getFirstSegment().point.x<y?0:1,L=1-K),M=!1,w.annotationSelected.dispatch(c)}function i(a){a.tool&&(null!==I?s(a):H&&H.segments[K].point.x+a.delta.x<=y-z&&H.segments[L].point.x+a.delta.x>=y+z&&(H.translate(a.delta),M=!0))}function j(a){a.tool&&(H&&M&&(w.annotationChanged.dispatch([H]),M=!1),I=K=L=H=J=null)}function k(b){var c;switch(b.key){case"up":c=[0,-1];break;case"down":c=[0,1]}c&&(c=new a.Point(c).multiply(a.view.zoom<4.5?1:.5),H=this,this.translate(c),M=!0,a.view.draw())}function l(a){switch(a.key){case"up":case"down":M&&(w.annotationChanged.dispatch([H]),M=!1)}}function m(b,c){"confidence"===b&&(this.style=B[c],a.view.draw())}function n(a,b){return a.x<=y&&b.x>=y+z||a.x>=y&&b.x<=y-z}function o(){F&&F.remove(),E=null,D=!1}function p(){var a=F?F.segments[1].point.clone():null;if(n(E,a)){F&&(F.remove(),F=null);var b=g({from:E,to:a});w.annotationAdded.dispatch(b),E=null,D=!1}}function q(b,c,d){d?u&&(b.segments[c].point.y=u.y,a.view.draw()):(u=b.segments[c].point.clone(),b.segments[c].point.y=b.segments[1-c].point.y)}function r(b){F?(F.segments[1].point=b.point,b.event.shiftKey&&q(F,1)):(F=new a.Path.Line({from:E,to:b.point}),F.style=A,F.dashArray=[10,5]),F.opacity=n(E,b.point)?1:.5,F.dashArray=n(E,b.point)?null:[10,5]}function s(a){var b=a.point.clone();n(H.segments[1-I].point,b)||(b.x=J),H.segments[I].point=b,a.event.shiftKey&&q(H,I),M=!0}var t,u,v="concordantstr",w={annotationAdded:null,annotationSelected:null},x=!1,y=0,z=10,A={strokeWidth:3,strokeColor:"red"},B={1:{strokeColor:new a.Color("#FF3737"),dashArray:[10,10]},2:{strokeColor:new a.Color("#FF3737"),dashArray:[30,10]},3:{strokeColor:new a.Color("#FF0000"),dashArray:null}},C={segments:!0,stroke:!0,fill:!1,tolerance:5,bounds:!1,handles:!0},D=!0,E=null,F=null,G=!1,H=null,I=null,J=null,K=null,L=null,M=!1,N={confidence:3,comment:""},O={onMouseDown:function(b){if(E)F&&!G&&p();else{var c=a.project.activeLayer.hitTest(b.point,C);c?c.item.onMouseDown(b):(a.project.deselectAll(),w.annotationSelected.dispatch(null),E||(I=H=null,D=!0,F&&F.remove(),F=null,E=b.point,G=!1))}},onMouseDrag:function(a){D&&E&&(G=!0,r(a)),H&&H.data.itemMouseDrag(a)},onMouseMove:function(a){D&&E&&r(a)},onMouseUp:function(a){E?F&&G&&(r(a),p()):H&&H.data.itemMouseUp(a),I=H=null},onKeyDown:function(b){switch(b.key){case"enter":D&&p();break;case"escape":D&&o();break;case"shift":F?q(F,1):H&&null!==I&&q(H,I);break;case"up":case"down":for(var c,d=a.project.getSelectedItems(),e=0;c=d[e];e++)if(c.data.type&&"function"==typeof c.onKeyDown){c.onKeyDown(b);break}}},onKeyUp:function(b){switch(b.key){case"shift":F?q(F,1,!0):H&&I&&q(H,I,!0);break;case"up":case"down":for(var c,d=a.project.getSelectedItems(),e=0;c=d[e];e++)if(c.data.type&&"function"==typeof c.onKeyUp){c.onKeyUp(b);break}}}};return t=new a.Tool(O),{name:v,tool:t,registerEvent:function(a,b){w[a]=b},exportJSON:b,importJSON:c,listeners:{onCutPositionChanged:d,onCutMarginChanged:e,onToolActivated:f}}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('tools/discordantstr',["paper"],function(a){function b(a){var b=this.exportJSON({asString:!1});return b[1].strokeColor||(b[1].strokeWidth=0),delete b[1].fontFamily,delete b[1].font,delete b[1].fontSize,delete b[1].leading,a&&a.asString?JSON.stringify(b):b}function c(b,c,d){var e=b[1],g=a.project.activeLayer;c.activate();var h=f({from:e.segments[0],to:e.segments[1],strokeWidth:e.strokeWidth,prop:e.data.prop},{not_interactive:!0});return g.activate(),h}function d(a){w=a}function e(a){v=a===t}function f(b,c){var d=new a.Path.Line({from:b.from,to:b.to});b.prop="object"==typeof b.prop?b.prop:{};for(var e in I)b.prop.hasOwnProperty(e)||(b.prop[e]=I[e]);return d.style=x[b.prop.confidence],parseInt(b.strokeWidth,10)&&(d.strokeWidth=b.strokeWidth),d.data={tId:"a"+d._id,type:t,prop:b.prop,itemMouseDrag:h,itemMouseUp:i},c&&c.not_interactive||(d.selected=!0,u.annotationSelected.dispatch(d)),d.onMouseDown=g,d.onKeyDown=j,d.onKeyUp=k,d.onPropertyChange=l,d}function g(b){var c=this;D=this;var d=c.hitTest(b.point,y);if(c.layer.activate(),a.project.deselectAll(),c.selected=!0,u.annotationSelected.dispatch(c),E=F=G=null,"segment"===d.type)E=d.segment.index;else{var e=D.getFirstSegment(),f=D.getLastSegment();F=e.point.x-f.point.x<0?1:0,G=e.point.x>w||f.point.x>w,G&&(F=1-F)}H=!1,u.annotationSelected.dispatch(c)}function h(a){if(a.tool)if(null!==E)r(a);else if(D){var b=D.segments[F].point.x+a.delta.x-w;(G?b>=0:b<=0)&&D.translate(a.delta),H=!0}}function i(a){a.tool&&(D&&H&&(u.annotationChanged.dispatch([D]),H=!1),E=D=F=G=null)}function j(b){var c;switch(b.key){case"up":c=[0,-1];break;case"down":c=[0,1]}c&&(c=new a.Point(c).multiply(a.view.zoom<4.5?1:.5),D=this,this.translate(c),H=!0,a.view.draw())}function k(a){switch(a.key){case"up":case"down":H&&(u.annotationChanged.dispatch([D]),H=!1)}}function l(b,c){"confidence"===b&&(this.style=x[c],a.view.draw())}function m(a,b){return a.x<=w&&b.x<=w||a.x>=w&&b.x>=w}function n(){B&&B.remove(),A=null,z=!1}function o(){var a=B?B.segments[1].point.clone():null;B&&(m(A,a)||(a.x=w),B.remove(),B=null),B&&B.remove();var b=f({from:A,to:a});u.annotationAdded.dispatch(b),A=null,z=!1}function p(b,c,d){d?s&&(b.segments[c].point.y=s.y,a.view.draw()):(s=b.segments[c].point.clone(),b.segments[c].point.y=b.segments[1-c].point.y)}function q(b){var c=b.point.clone();B?(m(A,b.point)||(c.x=w),B.segments[1].point=c,b.event.shiftKey&&p(B,1)):(B=new a.Path.Line({from:A,to:c}),B.style=x[3],b.event.shiftKey&&p(B,1))}function r(a){var b=a.point.clone();m(D.segments[1-E].point,a.point)||(b.x=w),D.segments[E].point=b,a.event.shiftKey&&p(D,E),H=!0}var s,t="discordantstr",u={annotationAdded:null,annotationSelected:null},v=!1,w=0,x={1:{strokeColor:new a.Color("#2057FF"),dashArray:[10,10]},2:{strokeColor:new a.Color("#2057FF"),dashArray:[30,10]},3:{strokeColor:new a.Color("#2057FF"),dashArray:null}},y={segments:!0,stroke:!0,fill:!1,tolerance:5,bounds:!1,handles:!0},z=!0,A=null,B=null,C=!1,D=null,E=null,F=null,G=null,H=!1,I={confidence:3,comment:""},J={onMouseDown:function(b){if(A)B&&!C&&o();else{var c=a.project.activeLayer.hitTest(b.point,y);c?c.item.onMouseDown(b):(a.project.deselectAll(),u.annotationSelected.dispatch(null),A||(z=!0,A=b.point,C=!1))}},onMouseDrag:function(a){z&&A&&(C=!0,q(a)),D&&D.data.itemMouseDrag(a)},onMouseMove:function(a){z&&A&&q(a)},onMouseUp:function(a){A?B&&C&&(q(a),o()):D&&D.data.itemMouseUp(a),E=D=null},onKeyDown:function(b){switch(b.key){case"enter":z&&o();break;case"escape":z&&n();break;case"shift":B?p(B,1):D&&null!==E&&p(D,E);break;case"up":case"down":for(var c,d=a.project.getSelectedItems(),e=0;c=d[e];e++)if(c.data.type&&"function"==typeof c.onKeyDown){c.onKeyDown(b);break}}},onKeyUp:function(b){switch(b.key){case"shift":B?p(B,1,!0):D&&E&&p(D,E,!0);break;case"up":case"down":for(var c,d=a.project.getSelectedItems(),e=0;c=d[e];e++)if(c.data.type&&"function"==typeof c.onKeyUp){c.onKeyUp(b);break}}}};return{name:t,tool:new a.Tool(J),registerEvent:function(a,b){u[a]=b},exportJSON:b,importJSON:c,listeners:{onCutPositionChanged:d,onToolActivated:e}}}); define('tools/discordantstr',["paper"],function(a){function b(a){var b=this.exportJSON({asString:!1});return b[1].strokeColor||(b[1].strokeWidth=0),delete b[1].fontFamily,delete b[1].font,delete b[1].fontSize,delete b[1].leading,a&&a.asString?JSON.stringify(b):b}function c(b,c,d){var e=b[1],g=a.project.activeLayer;c.activate();var h=f({from:e.segments[0],to:e.segments[1],strokeWidth:e.strokeWidth,prop:e.data.prop},{not_interactive:!0});return g.activate(),h}function d(a){w=a}function e(a){v=a===t}function f(b,c){var d=new a.Path.Line({from:b.from,to:b.to});b.prop="object"==typeof b.prop?b.prop:{};for(var e in I)b.prop.hasOwnProperty(e)||(b.prop[e]=I[e]);return d.style=x[b.prop.confidence],parseInt(b.strokeWidth,10)&&(d.strokeWidth=b.strokeWidth),d.data={tId:"a"+d._id,type:t,prop:b.prop,itemMouseDrag:h,itemMouseUp:i},c&&c.not_interactive||(d.selected=!0,u.annotationSelected.dispatch(d)),d.onMouseDown=g,d.onKeyDown=j,d.onKeyUp=k,d.onPropertyChange=l,d}function g(b){var c=this;D=this;var d=c.hitTest(b.point,y);if(c.layer.activate(),a.project.deselectAll(),c.selected=!0,u.annotationSelected.dispatch(c),E=F=G=null,"segment"===d.type)E=d.segment.index;else{var e=D.getFirstSegment(),f=D.getLastSegment();F=e.point.x-f.point.x<0?1:0,G=e.point.x>w||f.point.x>w,G&&(F=1-F)}H=!1,u.annotationSelected.dispatch(c)}function h(a){if(a.tool)if(null!==E)r(a);else if(D){var b=D.segments[F].point.x+a.delta.x-w;(G?b>=0:b<=0)&&D.translate(a.delta),H=!0}}function i(a){a.tool&&(D&&H&&(u.annotationChanged.dispatch([D]),H=!1),E=D=F=G=null)}function j(b){var c;switch(b.key){case"up":c=[0,-1];break;case"down":c=[0,1]}c&&(c=new a.Point(c).multiply(a.view.zoom<4.5?1:.5),D=this,this.translate(c),H=!0,a.view.draw())}function k(a){switch(a.key){case"up":case"down":H&&(u.annotationChanged.dispatch([D]),H=!1)}}function l(b,c){"confidence"===b&&(this.style=x[c],a.view.draw())}function m(a,b){return a.x<=w&&b.x<=w||a.x>=w&&b.x>=w}function n(){B&&B.remove(),A=null,z=!1}function o(){var a=B?B.segments[1].point.clone():null;B&&(m(A,a)||(a.x=w),B.remove(),B=null),B&&B.remove();var b=f({from:A,to:a});u.annotationAdded.dispatch(b),A=null,z=!1}function p(b,c,d){d?s&&(b.segments[c].point.y=s.y,a.view.draw()):(s=b.segments[c].point.clone(),b.segments[c].point.y=b.segments[1-c].point.y)}function q(b){var c=b.point.clone();B?(m(A,b.point)||(c.x=w),B.segments[1].point=c,b.event.shiftKey&&p(B,1)):(B=new a.Path.Line({from:A,to:c}),B.style=x[3],b.event.shiftKey&&p(B,1))}function r(a){var b=a.point.clone();m(D.segments[1-E].point,a.point)||(b.x=w),D.segments[E].point=b,a.event.shiftKey&&p(D,E),H=!0}var s,t="discordantstr",u={annotationAdded:null,annotationSelected:null},v=!1,w=0,x={1:{strokeColor:new a.Color("#2057FF"),dashArray:[10,10]},2:{strokeColor:new a.Color("#2057FF"),dashArray:[30,10]},3:{strokeColor:new a.Color("#2057FF"),dashArray:null}},y={segments:!0,stroke:!0,fill:!1,tolerance:5,bounds:!1,handles:!0},z=!0,A=null,B=null,C=!1,D=null,E=null,F=null,G=null,H=!1,I={confidence:3,comment:""},J={onMouseDown:function(b){if(A)B&&!C&&o();else{var c=a.project.activeLayer.hitTest(b.point,y);c?c.item.onMouseDown(b):(a.project.deselectAll(),u.annotationSelected.dispatch(null),A||(z=!0,A=b.point,C=!1))}},onMouseDrag:function(a){z&&A&&(C=!0,q(a)),D&&D.data.itemMouseDrag(a)},onMouseMove:function(a){z&&A&&q(a)},onMouseUp:function(a){A?B&&C&&(q(a),o()):D&&D.data.itemMouseUp(a),E=D=null},onKeyDown:function(b){switch(b.key){case"enter":z&&o();break;case"escape":z&&n();break;case"shift":B?p(B,1):D&&null!==E&&p(D,E);break;case"up":case"down":for(var c,d=a.project.getSelectedItems(),e=0;c=d[e];e++)if(c.data.type&&"function"==typeof c.onKeyDown){c.onKeyDown(b);break}}},onKeyUp:function(b){switch(b.key){case"shift":B?p(B,1,!0):D&&E&&p(D,E,!0);break;case"up":case"down":for(var c,d=a.project.getSelectedItems(),e=0;c=d[e];e++)if(c.data.type&&"function"==typeof c.onKeyUp){c.onKeyUp(b);break}}}};return{name:t,tool:new a.Tool(J),registerEvent:function(a,b){u[a]=b},exportJSON:b,importJSON:c,listeners:{onCutPositionChanged:d,onToolActivated:e}}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('tools/cmsarea',["paper"],function(a){function b(a){var b=this.exportJSON({asString:!1});return b[1].strokeColor||(b[1].strokeWidth=0),delete b[1].fontFamily,delete b[1].font,delete b[1].fontSize,delete b[1].leading,a&&a.asString?JSON.stringify(b):b}function c(b,c,d){var e=b[1],f=a.project.activeLayer;c.activate();var h=g({from:e.segments[0][1],to:e.segments[2][1],prop:e.data.prop});return f.activate(),h}function d(a){u=a}function e(a){v=a,w=v/2}function f(a){t=a===r}function g(b,c){var d=new a.Path({segments:[[u-w,b.from],[u+w,b.from],[u+w,b.to],[u-w,b.to]],closed:!0,style:x});b.prop="object"==typeof b.prop?b.prop:{};for(var e in H)b.prop.hasOwnProperty(e)||(b.prop[e]=H[e]);return d.data={tId:"a"+d._id,type:r,prop:b.prop,setStrokeWidth:z,itemMouseDrag:i,itemMouseUp:j},c!==!0&&(d.onMouseDown=h,d.onKeyDown=k,d.onKeyUp=l),d}function h(b){F=null;var c=this;return c.layer.activate(),a.project.deselectAll(),c.selected=!0,s.annotationSelected.dispatch(c),E=c,F=b.point.y-E.segments[0].point.y<=w?"up":E.segments[2].point.y-b.point.y<=w?"down":null,!1}function i(a){null!==F?p(a):E&&q(a)}function j(a){E&&G&&(s.annotationChanged.dispatch([E]),G=!1)}function k(b){var c;switch(b.key){case"up":c=[0,-1];break;case"down":c=[0,1]}c&&(c=new a.Point(c).multiply(a.view.zoom<4.5?1:.5),E=this,this.translate(c),G=!0,a.view.draw())}function l(a){switch(a.key){case"up":case"down":G&&(s.annotationChanged.dispatch([E]),G=!1)}}function m(){C&&C.remove(),B=null,A=!1,G=!1}function n(){var a=C?C.segments[3].point.clone():null;C&&(C.remove(),C=null);var b=g({from:B.y,to:a.y});s.annotationAdded.dispatch(b),G=!1,B=null,A=!1}function o(b){C?(C.segments[2].point.y=b.point.y,C.segments[3].point.y=b.point.y):C=new a.Path({segments:[[u-w,B.y],[u+w,B.y],[u+w,b.point.y],[u-w,b.point.y]],closed:!0,style:x,dashArray:[10,5]})}function p(a){var b="up"===F?0:2;E.segments[b].point.y+=a.delta.y,E.segments[b+1].point.y+=a.delta.y,G=!0}function q(a){var b=a.delta.clone();b.x=0,E.translate(b),G=!0}var r="cmsarea",s={annotationAdded:null,annotationSelected:null,annotationChanged:null},t=!1,u=0,v=50,w=v/2,x={strokeWidth:2,fillColor:new a.Color(1,.91372549,.501960784,.66),strokeColor:"#FFCF40",opacity:.5},y={segments:!0,stroke:!1,fill:!0,tolerance:20,bounds:!1,handles:!1},z=function(){},A=!0,B=null,C=null,D=!1,E=null,F=null,G=!1,H={comment:""},I={onMouseDown:function(b){if(B)C&&!D&&n();else{if(b.point.x<u-w-5||b.point.x>u+w+5)return a.project.deselectAll(),void s.annotationSelected.dispatch(null);var c=b.point.clone();c.x=u;var d=a.project.activeLayer.hitTest(c,y),e=null;if(d&&d.item.data&&d.item.data.type===r&&(e=d.item),e)return!1;F=E=null,a.project.deselectAll(),s.annotationSelected.dispatch(null),B||(A=!0,C&&C.remove(),C=null,B=c,D=!1)}},onMouseDrag:function(a){if(A&&B)D=!0,o(a);else if(null!==F)p(a);else{if(!E)return!1;q(a)}},onMouseMove:function(a){A&&B&&o(a)},onMouseUp:function(a){B?C&&D&&(o(a),n()):E&&E.data.itemMouseUp(a),F=E=null},onKeyDown:function(b){switch(b.key){case"enter":A&&n();break;case"escape":A&&m();break;case"up":case"down":for(var c,d=a.project.getSelectedItems(),e=0;c=d[e];e++)if(c.data.type&&"function"==typeof c.onKeyDown){c.onKeyDown(b);break}}},onKeyUp:function(b){switch(b.key){case"up":case"down":for(var c,d=a.project.getSelectedItems(),e=0;c=d[e];e++)if(c.data.type&&"function"==typeof c.onKeyUp){c.onKeyUp(b);break}}}};return{name:r,tool:new a.Tool(I),registerEvent:function(a,b){s[a]=b},exportJSON:b,importJSON:c,listeners:{onCutPositionChanged:d,onSetAreaWidth:e,onToolActivated:f}}}); define('tools/cmsarea',["paper"],function(a){function b(a){var b=this.exportJSON({asString:!1});return b[1].strokeColor||(b[1].strokeWidth=0),delete b[1].fontFamily,delete b[1].font,delete b[1].fontSize,delete b[1].leading,a&&a.asString?JSON.stringify(b):b}function c(b,c,d){var e=b[1],f=a.project.activeLayer;c.activate();var h=g({from:e.segments[0][1],to:e.segments[2][1],prop:e.data.prop});return f.activate(),h}function d(a){u=a}function e(a){v=a,w=v/2}function f(a){t=a===r}function g(b,c){var d=new a.Path({segments:[[u-w,b.from],[u+w,b.from],[u+w,b.to],[u-w,b.to]],closed:!0,style:x});b.prop="object"==typeof b.prop?b.prop:{};for(var e in H)b.prop.hasOwnProperty(e)||(b.prop[e]=H[e]);return d.data={tId:"a"+d._id,type:r,prop:b.prop,setStrokeWidth:z,itemMouseDrag:i,itemMouseUp:j},c!==!0&&(d.onMouseDown=h,d.onKeyDown=k,d.onKeyUp=l),d}function h(b){F=null;var c=this;return c.layer.activate(),a.project.deselectAll(),c.selected=!0,s.annotationSelected.dispatch(c),E=c,F=b.point.y-E.segments[0].point.y<=w?"up":E.segments[2].point.y-b.point.y<=w?"down":null,!1}function i(a){null!==F?p(a):E&&q(a)}function j(a){E&&G&&(s.annotationChanged.dispatch([E]),G=!1)}function k(b){var c;switch(b.key){case"up":c=[0,-1];break;case"down":c=[0,1]}c&&(c=new a.Point(c).multiply(a.view.zoom<4.5?1:.5),E=this,this.translate(c),G=!0,a.view.draw())}function l(a){switch(a.key){case"up":case"down":G&&(s.annotationChanged.dispatch([E]),G=!1)}}function m(){C&&C.remove(),B=null,A=!1,G=!1}function n(){var a=C?C.segments[3].point.clone():null;C&&(C.remove(),C=null);var b=g({from:B.y,to:a.y});s.annotationAdded.dispatch(b),G=!1,B=null,A=!1}function o(b){C?(C.segments[2].point.y=b.point.y,C.segments[3].point.y=b.point.y):C=new a.Path({segments:[[u-w,B.y],[u+w,B.y],[u+w,b.point.y],[u-w,b.point.y]],closed:!0,style:x,dashArray:[10,5]})}function p(a){var b="up"===F?0:2;E.segments[b].point.y+=a.delta.y,E.segments[b+1].point.y+=a.delta.y,G=!0}function q(a){var b=a.delta.clone();b.x=0,E.translate(b),G=!0}var r="cmsarea",s={annotationAdded:null,annotationSelected:null,annotationChanged:null},t=!1,u=0,v=50,w=v/2,x={strokeWidth:2,fillColor:new a.Color(1,.91372549,.501960784,.66),strokeColor:"#FFCF40",opacity:.5},y={segments:!0,stroke:!1,fill:!0,tolerance:20,bounds:!1,handles:!1},z=function(){},A=!0,B=null,C=null,D=!1,E=null,F=null,G=!1,H={comment:""},I={onMouseDown:function(b){if(B)C&&!D&&n();else{if(b.point.x<u-w-5||b.point.x>u+w+5)return a.project.deselectAll(),void s.annotationSelected.dispatch(null);var c=b.point.clone();c.x=u;var d=a.project.activeLayer.hitTest(c,y),e=null;if(d&&d.item.data&&d.item.data.type===r&&(e=d.item),e)return!1;F=E=null,a.project.deselectAll(),s.annotationSelected.dispatch(null),B||(A=!0,C&&C.remove(),C=null,B=c,D=!1)}},onMouseDrag:function(a){if(A&&B)D=!0,o(a);else if(null!==F)p(a);else{if(!E)return!1;q(a)}},onMouseMove:function(a){A&&B&&o(a)},onMouseUp:function(a){B?C&&D&&(o(a),n()):E&&E.data.itemMouseUp(a),F=E=null},onKeyDown:function(b){switch(b.key){case"enter":A&&n();break;case"escape":A&&m();break;case"up":case"down":for(var c,d=a.project.getSelectedItems(),e=0;c=d[e];e++)if(c.data.type&&"function"==typeof c.onKeyDown){c.onKeyDown(b);break}}},onKeyUp:function(b){switch(b.key){case"up":case"down":for(var c,d=a.project.getSelectedItems(),e=0;c=d[e];e++)if(c.data.type&&"function"==typeof c.onKeyUp){c.onKeyUp(b);break}}}};return{name:r,tool:new a.Tool(I),registerEvent:function(a,b){s[a]=b},exportJSON:b,importJSON:c,listeners:{onCutPositionChanged:d,onSetAreaWidth:e,onToolActivated:f}}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('adim/category',["underscore","paper","signals"],function(a,b,c){function d(b){var c=null;b&&b.env&&(c=b.env),a.isString(f)&&(f=$(f)),a(f.find("[data-category]")).each(function(a,b){var c=$(a),d=c.data("color")||c.css("backgroundColor"),f=c.data("colorBg")||c.css("backgroundColor"),h=c.data("category");g[h]={id:h,color:e(d),colorbg:e(f)},0==b&&(g.default=g[h])}),c&&"geomo"==c?g.default=g.cat_geo_1:g.default=g.cat_2}function e(a,c){var d;if(0===a.indexOf("rgb")){var e=a.split(/[(),]/).map(function(a){return parseFloat(a.trim())}).filter(function(a){return!isNaN(a)});d=new b.Color(e[0]/255,e[1]/255,e[2]/255)}else d=new b.Color(a);return c?d:d.toCSS(!0)}var f="#prop-annot-category",g={};return{init:d,getCategory:function(a){return g[a]}}}); define('adim/category',["underscore","paper","signals"],function(a,b,c){function d(b){var c=null;b&&b.env&&(c=b.env),a.isString(f)&&(f=$(f)),a(f.find("[data-category]")).each(function(a,b){var c=$(a),d=c.data("color")||c.css("backgroundColor"),f=c.data("colorBg")||c.css("backgroundColor"),h=c.data("category");g[h]={id:h,color:e(d),colorbg:e(f)},0==b&&(g.default=g[h])}),c&&"geomo"==c?g.default=g.cat_geo_1:g.default=g.cat_2}function e(a,c){var d;if(0===a.indexOf("rgb")){var e=a.split(/[(),]/).map(function(a){return parseFloat(a.trim())}).filter(function(a){return!isNaN(a)});d=new b.Color(e[0]/255,e[1]/255,e[2]/255)}else d=new b.Color(a);return c?d:d.toCSS(!0)}var f="#prop-annot-category",g={};return{init:d,getCategory:function(a){return g[a]}}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('tools/marker',["underscore","paper","signals","adim/category"],function(a,b,c,d){function e(a){var b=this.exportJSON({asString:!1});return b[1].data.origin.splice(0,1),a&&a.asString?JSON.stringify(b):b}function f(a,c,d){var e=a[1].data;e.origin=new b.Point(e.origin);var f=b.project.activeLayer;c.activate();var h=A.category,i=g(e.origin,e,d);return e.prop.category&&l.call(i,e.prop.category),f.activate(),A.category=h,i}function g(c,d,e){e=e!==!1;var f;d&&d.label?(f=parseInt(d.label,10)||d.label,C=!0):f=B.length+1;var g=!!d&&parseInt(d.radius,10)||D,i=!!d&&parseFloat(d.rotation)||0,m=d&&"object"==typeof d.prop?d.prop:{};for(var r in A)m.hasOwnProperty(r)||(m[r]=A[r]);var s=new b.Group;return s.data={type:w,tId:"a"+s._id,origin:c,radius:g,rotation:i,label:f,prop:m,setColor:y,getColor:y,setFill:y,setStrokeWidth:j,getStrokeWidth:k,setCategory:l,itemMouseDrag:o,itemMouseDown:n,itemMouseUp:p},s._boundsSelected=!0,s._selectChildren=!1,e&&(s.onPropertyChange=q,s.onMouseDown=n),h(s),e&&(a.some(B,function(a,b){return f<a.data.label&&(B.splice(b,0,s),!0)})||B.push(s)),s}function h(a,c){c=c||{};var e=c.radius||a.data.radius,f=c.label||a.data.label,g=c.origin||a.data.origin,h=c.rotation||a.data.rotation,i=c.category||a.data.prop.category||"default",j=c.highlight||!1,k=d.getCategory(i),l=k&&k.color||"black";if(!f||!g)return void console.error("label or origin not defined");var m=1.4*e,n=e/3.75,o=2*e/1.25;f.toString().length>1&&(m*=.9);var p=new b.Path.Circle({center:[0,0],radius:e+e/4,fillColor:j?F:E,strokeColor:null}),q=new b.Path.Circle({center:[0,0],radius:e,strokeColor:l||"black",fillColor:"white",strokeWidth:e/4}),r=new b.Path({segments:[[n-e,o-e],[0,10*e/3-e],[2*e-n-e,o-e]],closed:!0,fillColor:l||"black",strokeJoin:"round",strokeColor:j?F:E,strokeWidth:e/8}),s=new b.PointText({point:[0,0],content:f,fillColor:l||"black",strokeColor:null,fontFamily:"Courier",fontWeight:"bold",fontSize:m});s.translate([-s.bounds.width/2,m/4]),a.removeChildren(),a.addChildren([p,r,q,s]),a.translate(g),r.rotate(h,g)}function i(a){this.children[G.circle].strokeColor=a,this.children[G.pointer].fillColor=a,this.children[G.labelText].fillColor=a}function j(a){this.data.radius=a+10,h(this)}function k(){return this.data.radius-10}function l(a){var b=d.getCategory(a),c=b&&b.color||"#000000";i.call(this,c),A.category=a}function m(a,b){!a in H?(I=null,J={},K=!1):(I=H[a],J=b)}function n(a){if(this.selected&&!x){var b=this.data.origin.subtract(a.point).length;I=b>1.25*this.data.radius?H.DRAG_POINTER:H.FULL_DRAG}}function o(a){if(!x)switch(K=!0,I){case H.FULL_DRAG:this.translate(a.delta),this.data.origin=this.data.origin.add(a.delta);break;case H.DRAG_POINTER:var b=a.point.subtract(this.data.origin).angle-90;this.data.rotation=b,h(this);break;default:K=!1}}function p(a){I=null,K&&z.annotationChanged.dispatch(this),K=!1}function q(a,c){"category"===a&&(l.call(this,c),b.view.draw())}function r(a){return a.data&&a.data.type===w?a:a.parent?r(a.parent):null}function s(a){var c,d;return c=b.project.activeLayer.hitTest(a,{tolerance:7,fill:!0,stroke:!0,segments:!0,ends:!0,bounds:!0,selected:!0}),c||(c=b.project.activeLayer.hitTest(a,{tolerance:1,fill:!0,stroke:!0})),!(!c||!c.item)&&(!!(d=r(c.item))&&d)}function t(){var b=[],c=0;a.each(B,function(a,d){a.parent&&(c++,a.data.label.toString()!==c.toString()&&(a.data.label=c.toString(),h(a),b.push(a),z.markerLabelChanged.dispatch(a)))}),B=a.reject(B,function(a){return!a.parent}),b.length>0&&z.annotationChanged.dispatch(b)}function u(a){var c=B.splice(a.oldIndex,1);B.splice(a.newIndex,0,c[0]),t(),b.view.draw()}function v(a){return x=a}var w="marker",x=!1,y=function(){},z=(new b.Color([0,0,0,0]),{annotationAdded:null,annotationSelected:null,annotationChanged:null,markerLabelChanged:new c}),A={labelComment:"",category:"cat_2"},B=[],C=!1,D=20,E="white",F="red",G={bgCircle:0,pointer:1,circle:2,labelText:3},H={FULL_DRAG:1,DRAG_POINTER:2},I=null,J={},K=!1,L=null,M={onMouseDown:function(a){if(!x&&(I=null,b.project.hitTest(a.point,{class:b.Raster}))){var c=s(a.point);c?(c.selected?a.point.x==a.lastPoint.x&&z.annotationSelected.dispatch(c):(b.project.deselectAll(),c.selected=!0,z.annotationSelected.dispatch(c)),n.call(c,a),L=c):(b.project.deselectAll(),z.annotationSelected.dispatch(null),c=g(a.point),z.annotationAdded.dispatch(c),b.project.deselectAll(),c.selected=!0,n.call(c,a),L=c,z.annotationSelected.dispatch(c))}},onMouseDrag:function(a){x||I&&o.call(L,a)},onMouseUp:function(a){m(null),L=null}};return{name:w,tool:new b.Tool(M),setRo:v,registerEvent:function(a,b){z[a]=b},exportJSON:e,importJSON:f,listeners:{updateNumbering:t,setNumbering:u},events:z}}); define('tools/marker',["underscore","paper","signals","adim/category"],function(a,b,c,d){function e(a){var b=this.exportJSON({asString:!1});return b[1].data.origin.splice(0,1),a&&a.asString?JSON.stringify(b):b}function f(a,c,d){var e=a[1].data;e.origin=new b.Point(e.origin);var f=b.project.activeLayer;c.activate();var h=A.category,i=g(e.origin,e,d);return e.prop.category&&l.call(i,e.prop.category),f.activate(),A.category=h,i}function g(c,d,e){e=e!==!1;var f;d&&d.label?(f=parseInt(d.label,10)||d.label,C=!0):f=B.length+1;var g=!!d&&parseInt(d.radius,10)||D,i=!!d&&parseFloat(d.rotation)||0,m=d&&"object"==typeof d.prop?d.prop:{};for(var r in A)m.hasOwnProperty(r)||(m[r]=A[r]);var s=new b.Group;return s.data={type:w,tId:"a"+s._id,origin:c,radius:g,rotation:i,label:f,prop:m,setColor:y,getColor:y,setFill:y,setStrokeWidth:j,getStrokeWidth:k,setCategory:l,itemMouseDrag:o,itemMouseDown:n,itemMouseUp:p},s._boundsSelected=!0,s._selectChildren=!1,e&&(s.onPropertyChange=q,s.onMouseDown=n),h(s),e&&(a.some(B,function(a,b){return f<a.data.label&&(B.splice(b,0,s),!0)})||B.push(s)),s}function h(a,c){c=c||{};var e=c.radius||a.data.radius,f=c.label||a.data.label,g=c.origin||a.data.origin,h=c.rotation||a.data.rotation,i=c.category||a.data.prop.category||"default",j=c.highlight||!1,k=d.getCategory(i),l=k&&k.color||"black";if(!f||!g)return void console.error("label or origin not defined");var m=1.4*e,n=e/3.75,o=2*e/1.25;f.toString().length>1&&(m*=.9);var p=new b.Path.Circle({center:[0,0],radius:e+e/4,fillColor:j?F:E,strokeColor:null}),q=new b.Path.Circle({center:[0,0],radius:e,strokeColor:l||"black",fillColor:"white",strokeWidth:e/4}),r=new b.Path({segments:[[n-e,o-e],[0,10*e/3-e],[2*e-n-e,o-e]],closed:!0,fillColor:l||"black",strokeJoin:"round",strokeColor:j?F:E,strokeWidth:e/8}),s=new b.PointText({point:[0,0],content:f,fillColor:l||"black",strokeColor:null,fontFamily:"Courier",fontWeight:"bold",fontSize:m});s.translate([-s.bounds.width/2,m/4]),a.removeChildren(),a.addChildren([p,r,q,s]),a.translate(g),r.rotate(h,g)}function i(a){this.children[G.circle].strokeColor=a,this.children[G.pointer].fillColor=a,this.children[G.labelText].fillColor=a}function j(a){this.data.radius=a+10,h(this)}function k(){return this.data.radius-10}function l(a){var b=d.getCategory(a),c=b&&b.color||"#000000";i.call(this,c),A.category=a}function m(a,b){!a in H?(I=null,J={},K=!1):(I=H[a],J=b)}function n(a){if(this.selected&&!x){var b=this.data.origin.subtract(a.point).length;I=b>1.25*this.data.radius?H.DRAG_POINTER:H.FULL_DRAG}}function o(a){if(!x)switch(K=!0,I){case H.FULL_DRAG:this.translate(a.delta),this.data.origin=this.data.origin.add(a.delta);break;case H.DRAG_POINTER:var b=a.point.subtract(this.data.origin).angle-90;this.data.rotation=b,h(this);break;default:K=!1}}function p(a){I=null,K&&z.annotationChanged.dispatch(this),K=!1}function q(a,c){"category"===a&&(l.call(this,c),b.view.draw())}function r(a){return a.data&&a.data.type===w?a:a.parent?r(a.parent):null}function s(a){var c,d;return c=b.project.activeLayer.hitTest(a,{tolerance:7,fill:!0,stroke:!0,segments:!0,ends:!0,bounds:!0,selected:!0}),c||(c=b.project.activeLayer.hitTest(a,{tolerance:1,fill:!0,stroke:!0})),!(!c||!c.item)&&(!!(d=r(c.item))&&d)}function t(){var b=[],c=0;a.each(B,function(a,d){a.parent&&(c++,a.data.label.toString()!==c.toString()&&(a.data.label=c.toString(),h(a),b.push(a),z.markerLabelChanged.dispatch(a)))}),B=a.reject(B,function(a){return!a.parent}),b.length>0&&z.annotationChanged.dispatch(b)}function u(a){var c=B.splice(a.oldIndex,1);B.splice(a.newIndex,0,c[0]),t(),b.view.draw()}function v(a){return x=a}var w="marker",x=!1,y=function(){},z=(new b.Color([0,0,0,0]),{annotationAdded:null,annotationSelected:null,annotationChanged:null,markerLabelChanged:new c}),A={labelComment:"",category:"cat_2"},B=[],C=!1,D=20,E="white",F="red",G={bgCircle:0,pointer:1,circle:2,labelText:3},H={FULL_DRAG:1,DRAG_POINTER:2},I=null,J={},K=!1,L=null,M={onMouseDown:function(a){if(!x&&(I=null,b.project.hitTest(a.point,{class:b.Raster}))){var c=s(a.point);c?(c.selected?a.point.x==a.lastPoint.x&&z.annotationSelected.dispatch(c):(b.project.deselectAll(),c.selected=!0,z.annotationSelected.dispatch(c)),n.call(c,a),L=c):(b.project.deselectAll(),z.annotationSelected.dispatch(null),c=g(a.point),z.annotationAdded.dispatch(c),b.project.deselectAll(),c.selected=!0,n.call(c,a),L=c,z.annotationSelected.dispatch(c))}},onMouseDrag:function(a){x||I&&o.call(L,a)},onMouseUp:function(a){m(null),L=null}};return{name:w,tool:new b.Tool(M),setRo:v,registerEvent:function(a,b){z[a]=b},exportJSON:e,importJSON:f,listeners:{updateNumbering:t,setNumbering:u},events:z}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('tools/drawinggeo',["paper","tools/Shape.class","adim/category"],function(a,b,c){function d(a){var b=this.selected,c=this.fullySelected;this.selected=this.fullySelected=!1;var d=this.exportJSON({asString:!1});return delete d[1].fontFamily,delete d[1].font,delete d[1].fontSize,delete d[1].leading,d=a&&a.asString===!1?d:JSON.stringify(d),this.fullySelected=c,this.selected=b,d}function e(a,b,c){var d=b.importJSON(a),e=f(d,d.data,c),g=p.category;return d.data.prop.category&&h.call(e,d.data.prop.category),p.category=g,e}function f(a,b,c){var d=a,e=b&&"object"==typeof b.prop?b.prop:{};for(var f in p)e.hasOwnProperty(f)||(e[f]=p[f]);return d.data={tId:"a"+d._id,type:m,prop:e,setCategory:h,getColorBgD:k},d.onPropertyChange=g,d.style={strokeColor:i(e.category)},e.fill&&(d.style={fillColor:j(e.category)}),d._boundsSelected=!0,d}function g(b,c){"category"===b&&(h.call(this,c),this.data.prop.fill?this.style={fillColor:j(c),strokeColor:i(c)}:this.style={strokeColor:i(c)},a.view.draw())}function h(a){p.category=a}function i(a){var b=c.getCategory(a),d=b&&b.color||"#000000";return d}function j(a){var b=c.getCategory(a),d=b&&b.colorbg||"#000000";return d}function k(){if(this.prop){var a=c.getCategory(this.prop.category),b=a&&a.colorbg||"#000000";return b}return"#000000"}var l,m="drawinggeo",n=null,o={annotationAdded:null,annotationSelected:null,annotationChanged:null},p={comment:"",category:"cat_geo_1",fill:!1},q={onMouseDown:function(b){a.project.deselectAll(),n=new a.Path({fillColor:null,strokeCap:"round"}),n.add(b.point)},minDistance:5,onMouseDrag:function(a){n&&n.add(a.point)},onMouseUp:function(){if(n){n.simplify(20);var b=f(n.clone());n.remove(),n=null,a.view.draw(),b.fullySelected=!0,o.annotationAdded.dispatch(b),o.annotationSelected.dispatch(b)}}};return l=new a.Tool(q),{name:m,tool:l,exportJSON:d,importJSON:e,registerEvent:function(a,b){o[a]=b}}}); define('tools/drawinggeo',["paper","tools/Shape.class","adim/category"],function(a,b,c){function d(a){var b=this.selected,c=this.fullySelected;this.selected=this.fullySelected=!1;var d=this.exportJSON({asString:!1});return delete d[1].fontFamily,delete d[1].font,delete d[1].fontSize,delete d[1].leading,d=a&&a.asString===!1?d:JSON.stringify(d),this.fullySelected=c,this.selected=b,d}function e(a,b,c){var d=b.importJSON(a),e=f(d,d.data,c),g=p.category;return d.data.prop.category&&h.call(e,d.data.prop.category),p.category=g,e}function f(a,b,c){var d=a,e=b&&"object"==typeof b.prop?b.prop:{};for(var f in p)e.hasOwnProperty(f)||(e[f]=p[f]);return d.data={tId:"a"+d._id,type:m,prop:e,setCategory:h,getColorBgD:k},d.onPropertyChange=g,d.style={strokeColor:i(e.category)},e.fill&&(d.style={fillColor:j(e.category)}),d._boundsSelected=!0,d}function g(b,c){"category"===b&&(h.call(this,c),this.data.prop.fill?this.style={fillColor:j(c),strokeColor:i(c)}:this.style={strokeColor:i(c)},a.view.draw())}function h(a){p.category=a}function i(a){var b=c.getCategory(a),d=b&&b.color||"#000000";return d}function j(a){var b=c.getCategory(a),d=b&&b.colorbg||"#000000";return d}function k(){if(this.prop){var a=c.getCategory(this.prop.category),b=a&&a.colorbg||"#000000";return b}return"#000000"}var l,m="drawinggeo",n=null,o={annotationAdded:null,annotationSelected:null,annotationChanged:null},p={comment:"",category:"cat_geo_1",fill:!1},q={onMouseDown:function(b){a.project.deselectAll(),n=new a.Path({fillColor:null,strokeCap:"round"}),n.add(b.point)},minDistance:5,onMouseDrag:function(a){n&&n.add(a.point)},onMouseUp:function(){if(n){n.simplify(20);var b=f(n.clone());n.remove(),n=null,a.view.draw(),b.fullySelected=!0,o.annotationAdded.dispatch(b),o.annotationSelected.dispatch(b)}}};return l=new a.Tool(q),{name:m,tool:l,exportJSON:d,importJSON:e,registerEvent:function(a,b){o[a]=b}}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('tools/linesgeo',["paper","tools/Shape.class","adim/category"],function(a,b,c){function d(a){var b=this.exportJSON({asString:!1});return delete b[1].fontFamily,delete b[1].font,delete b[1].fontSize,delete b[1].leading,a&&a.asString?JSON.stringify(b):b}function e(a,b,c){var d=b.importJSON(a),e=d.data.prop;for(var g in v)e.hasOwnProperty(g)||(e[g]=v[g]);return d.data.prop=e,d.data.setCategory=i,d.data.getColorBgD=l,f(d),d}function f(a){a.data.prop="object"==typeof a.data.prop?a.data.prop:{};for(var b in v)a.data.prop.hasOwnProperty(b)||(a.data.prop[b]=v[b]);a.onPropertyChange=g}function g(b,c){"fill"===b?(this.closed=c,a.view.draw()):"category"===b&&(i.call(this,c),this.data.prop.fill?this.style={fillColor:k(c),strokeColor:j(c)}:this.style={strokeColor:j(c)},a.view.draw())}function h(){if(t=null,q&&q.remove(),o=!1,n.length>r){var b=n.clone();b.style=a.project.currentStyle,b.strokeCap="round",b.strokeJoin="round",b.fillColor=null,b.data.type=m,b.data.tId="a"+b._id;var c={};for(var d in v)c.hasOwnProperty(d)||(c[d]=v[d]);b.data.prop=c,b.data.setCategory=i,b.data.getColorBgD=l,f(b),b.selected=!0,"function"==typeof u.annotationSelected.dispatch&&u.annotationSelected.dispatch(b),"function"==typeof u.annotationAdded.dispatch&&u.annotationAdded.dispatch(b)}n.remove()}function i(a){v.category=a}function j(a){var b=c.getCategory(a),d=b&&b.color||"#000000";return d}function k(a){var b=c.getCategory(a),d=b&&b.colorbg||"#000000";return d}function l(){if(this.prop){var a=c.getCategory(this.prop.category),b=a&&a.colorbg||"#000000";return b}return"#000000"}var m="linesgeo",n=null,o=!1,p=!1,q=null,r=5,s=!1,t=null,u={annotationAdded:null,annotationChanged:null},v={comment:"",category:"cat_geo_1",fill:!1},w={segments:!0,stroke:!0,tolerance:5},x={onMouseDown:function(b){if(o){if(n){if(b.point.subtract(b.lastPoint).length<r)return void h();q&&q.remove(),n.add(b.point)}}else{var c=a.project.activeLayer.hitTest(b.point,w);if(c&&c.item&&c.item.selected&&c.item.data.type===m)if(n=c.item,"stroke"===c.type){var d=c.location;q=n.insert(d.index+1,b.point),p=!0}else"segment"===c.type&&(b.modifiers.option?(c.segment.remove(),u.annotationChanged.dispatch(c.item)):(q=c.segment,p=!0));else a.project.deselectAll(),n=new a.Path({strokeColor:a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor,fillColor:null,strokeCap:"round",strokeJoin:"round"}),o=!0,n.add(b.point)}},onMouseMove:function(b){o?(t=b.point,q&&q.remove(),q=new a.Path(b.downPoint,b.point),q.strokeColor=a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor):p&&q&&(s=!0,q.point=b.point)},onMouseUp:function(a){p&&(p=!1,q&&(s&&(s=!1,u.annotationChanged.dispatch(q.path),u.annotationSelected.dispatch(q.path)),q=null))},onKeyDown:function(a){switch(a.key){case"enter":o&&n&&(t&&n.add(t),h());break;case"escape":o&&n&&h()}}};return{name:m,tool:new a.Tool(x),registerEvent:function(a,b){u[a]=b},exportJSON:d,importJSON:e}}); define('tools/linesgeo',["paper","tools/Shape.class","adim/category"],function(a,b,c){function d(a){var b=this.exportJSON({asString:!1});return delete b[1].fontFamily,delete b[1].font,delete b[1].fontSize,delete b[1].leading,a&&a.asString?JSON.stringify(b):b}function e(a,b,c){var d=b.importJSON(a),e=d.data.prop;for(var g in v)e.hasOwnProperty(g)||(e[g]=v[g]);return d.data.prop=e,d.data.setCategory=i,d.data.getColorBgD=l,f(d),d}function f(a){a.data.prop="object"==typeof a.data.prop?a.data.prop:{};for(var b in v)a.data.prop.hasOwnProperty(b)||(a.data.prop[b]=v[b]);a.onPropertyChange=g}function g(b,c){"fill"===b?(this.closed=c,a.view.draw()):"category"===b&&(i.call(this,c),this.data.prop.fill?this.style={fillColor:k(c),strokeColor:j(c)}:this.style={strokeColor:j(c)},a.view.draw())}function h(){if(t=null,q&&q.remove(),o=!1,n.length>r){var b=n.clone();b.style=a.project.currentStyle,b.strokeCap="round",b.strokeJoin="round",b.fillColor=null,b.data.type=m,b.data.tId="a"+b._id;var c={};for(var d in v)c.hasOwnProperty(d)||(c[d]=v[d]);b.data.prop=c,b.data.setCategory=i,b.data.getColorBgD=l,f(b),b.selected=!0,"function"==typeof u.annotationSelected.dispatch&&u.annotationSelected.dispatch(b),"function"==typeof u.annotationAdded.dispatch&&u.annotationAdded.dispatch(b)}n.remove()}function i(a){v.category=a}function j(a){var b=c.getCategory(a),d=b&&b.color||"#000000";return d}function k(a){var b=c.getCategory(a),d=b&&b.colorbg||"#000000";return d}function l(){if(this.prop){var a=c.getCategory(this.prop.category),b=a&&a.colorbg||"#000000";return b}return"#000000"}var m="linesgeo",n=null,o=!1,p=!1,q=null,r=5,s=!1,t=null,u={annotationAdded:null,annotationChanged:null},v={comment:"",category:"cat_geo_1",fill:!1},w={segments:!0,stroke:!0,tolerance:5},x={onMouseDown:function(b){if(o){if(n){if(b.point.subtract(b.lastPoint).length<r)return void h();q&&q.remove(),n.add(b.point)}}else{var c=a.project.activeLayer.hitTest(b.point,w);if(c&&c.item&&c.item.selected&&c.item.data.type===m)if(n=c.item,"stroke"===c.type){var d=c.location;q=n.insert(d.index+1,b.point),p=!0}else"segment"===c.type&&(b.modifiers.option?(c.segment.remove(),u.annotationChanged.dispatch(c.item)):(q=c.segment,p=!0));else a.project.deselectAll(),n=new a.Path({strokeColor:a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor,fillColor:null,strokeCap:"round",strokeJoin:"round"}),o=!0,n.add(b.point)}},onMouseMove:function(b){o?(t=b.point,q&&q.remove(),q=new a.Path(b.downPoint,b.point),q.strokeColor=a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor):p&&q&&(s=!0,q.point=b.point)},onMouseUp:function(a){p&&(p=!1,q&&(s&&(s=!1,u.annotationChanged.dispatch(q.path),u.annotationSelected.dispatch(q.path)),q=null))},onKeyDown:function(a){switch(a.key){case"enter":o&&n&&(t&&n.add(t),h());break;case"escape":o&&n&&h()}}};return{name:m,tool:new a.Tool(x),registerEvent:function(a,b){u[a]=b},exportJSON:d,importJSON:e}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */ /*! AdIm - v0.0.0 - 2018-03-07 - Copyright (C) 2018 Université de Lausanne - see licence */
define('tools/ellipsegeo',["paper","tools/Shape.class","adim/category"],function(a,b,c){function d(a){var b=this.exportJSON({asString:!1});return a&&a.asString?JSON.stringify(b):b}function e(b,c,d){var e=b[1],g=e.data,h=a.project.activeLayer;c.activate();var i=C.category,j=new a.Point(g.origin.point[1],g.origin.point[2]),k=new a.Point(g.origin.size[1],g.origin.size[2]),l=f({point:j,size:k},g,d);return g.prop.category&&o.call(l,g.prop.category),h.activate(),C.category=i,l}function f(b,c,d){var e=new a.Shape.Ellipse({point:b.point,size:b.size}),f=c&&"object"==typeof c.prop?c.prop:{};for(var g in C)f.hasOwnProperty(g)||(f[g]=C[g]);return e.data={tId:"a"+e._id,type:t,prop:f,setCategory:o,getColorBgD:r,origin:b,itemMouseDrag:k,itemMouseUp:l,itemMouseDown:i,setDragMode:j},e.itemMouseDown=i,e.onMouseDown=i,e.itemMouseDrag=k,e.setDragMode=k,e.onPropertyChange=m,e.style={strokeColor:p(f.category),strokeWidth:7},f.fill&&(e.style={fillColor:q(f.category)}),e._boundsSelected=!0,e}function g(b,d){if(b.data)var e=b.data.prop.category||"default",f=b.data.prop.fill||"checked";else var e="default",f="checked";var g=c.getCategory(e),h=g&&g.color||"grey",i=g&&g.colorbg||"grey";x?(x.remove(),x=new a.Shape.Ellipse({point:u,size:[d.point.x-u.x,d.point.y-u.y]})):(x=new a.Shape.Ellipse({point:u,size:d.delta}),"checked"==f&&(x.fillColor=i),x.color=h)}function h(a){x&&(x.remove(),x=null);var b=f({point:u,size:a.delta});return B.annotationAdded.dispatch(b),u=null,A=!1,b}function i(b){console.log("MouseDown");var c=this;v=this;var d=c.hitTest(b.point,D);c.layer.activate(),a.project.deselectAll(),c.selected=!0,B.annotationSelected.dispatch(c),w=null,d&&console.log(d.type),d&&"segment"===d.type&&(w=d.segment.index),z=!1,B.annotationSelected.dispatch(c)}function j(a,b){console.log("itemResize"),w=b,z=!1}function k(a){if(console.log("itemMouseDrag"),a.tool){if(null!==w){var b=(a.point.clone(),a.delta);"top"==w.nameParts[0]?"left"==w.nameParts[1]?(this.size.width-=2*b.x,this.size.height-=2*b.y):(this.size.width+=2*b.x,this.size.height-=2*b.y):"left"==w.nameParts[1]?(this.size.width-=2*b.x,this.size.height+=2*b.y):(this.size.width+=2*b.x,this.size.height+=2*b.y),this.data.origin.size.x=this.size.width,this.data.origin.size.y=this.size.height}else this.translate(a.delta),this.data.origin.point.x+=a.delta.x,this.data.origin.point.y+=a.delta.y;z=!0}}function l(a){a.tool&&(z&&B.annotationChanged.dispatch(this),z=!1,w=null)}function m(b,c){"category"===b&&(o.call(this,c),this.style={fillColor:q(c),strokeColor:p(c)},a.view.draw())}function n(){x&&x.remove(),u=null,A=!1}function o(a){C.category=a}function p(a){var b=c.getCategory(a),d=b&&b.color||"#000000";return d}function q(a){var b=c.getCategory(a),d=b&&b.colorbg||"#000000";return d}function r(){if(this.prop){var a=c.getCategory(this.prop.category),b=a&&a.colorbg||"#000000";return b}return"#000000"}var s,t="ellipsegeo",u=null,v=null,w=null,x=null,y=null,z=null,A=!0,B={annotationAdded:null,annotationSelected:null,annotationChanged:null},C={comment:"",category:"cat_geo_1",fill:!0},D={segments:!0,stroke:!0,fill:!1,tolerance:5,bounds:!1,handles:!0},E={onMouseDown:function(b){if(u)x&&!y&&h();else{var c=a.project.activeLayer.hitTest(b.point,D);c?c.item.onMouseDown(b):(a.project.deselectAll(),B.annotationSelected.dispatch(null),u||(w=v=null,A=!0,x&&x.remove(),x=null,u=b.point,y=!1))}},onMouseDrag:function(a){A&&u&&(y=!0,g(this,a))},onMouseMove:function(a){A&&u&&g(this,a)},onMouseUp:function(a){if(u)if(x&&y){g(this,a);var b=h(a);b.selected=!0,B.annotationSelected.dispatch(b)}else n();w=v=null},onKeyDown:function(a){switch(a.key){case"escape":A&&n()}}};return s=new a.Tool(E),{name:t,tool:s,exportJSON:d,importJSON:e,registerEvent:function(a,b){B[a]=b}}}); define('tools/ellipsegeo',["paper","tools/Shape.class","adim/category"],function(a,b,c){function d(a){var b=this.exportJSON({asString:!1});return a&&a.asString?JSON.stringify(b):b}function e(b,c,d){var e=b[1],g=e.data,h=a.project.activeLayer;c.activate();var i=C.category,j=new a.Point(g.origin.point[1],g.origin.point[2]),k=new a.Po