diff --git a/JavaScript-API.md b/JavaScript-API.md
new file mode 100644
index 0000000..5caf91b
--- /dev/null
+++ b/JavaScript-API.md
@@ -0,0 +1,202 @@
+# JavaScript API
+
+Annotorious provides a JavaScript API you can use to get, add or remove annotations, and hook into the Annotorious event lifecycle. All functionality is exposed via the global _anno_ object. The _anno_ object has the following methods
+
+* _anno.activateSelector(opt_item_url_or_callback, opt_callback)_
+* _anno.addAnnotation(annotation, opt_replace)_
+* _anno.addHandler(type, handler)_
+* _anno.addPlugin(pluginName, opt_config_options)_
+* _anno.destroy(opt_item_url)_
+* _anno.getAnnotations(opt_item_url)_
+* _anno.hideAnnotations(opt_item_url)_
+* _anno.hideSelectionWidget(opt_item_url)_
+* _anno.highlightAnnotation(annotation)_
+* _anno.makeAnnotatable(item)_
+* _anno.removeAll(opt_item_url)_
+* _anno.removeAnnotation(annotation)_
+* _anno.reset()_
+* _anno.showAnnotations(opt_item_url)_
+* _anno.showSelectionWidget(opt_item_url)_
+
+## anno.activateSelector(opt_item_url_or_callback, opt_callback)
+
+__NOTE: this method is currently only relevant for the OpenLayers module. Feel free to ignore in
+case you are only using the standard image annotation features of Annotorious.__
+
+Manually actives the selector. The selector can be activated on a specific item or globally, on all items (which serves mainly as a shortcut for pages where there is only one annotatable item). The function can take a callback function as parameter, which will be called when the selector is deactivated again.
+
+## anno.addAnnotation(annotation, opt_replace)
+
+Adds a new annotation, or replaces an existing annotation with a new annotation. (In the latter case, the parameter _opt\_replace_ must be the existing annotation.)
+
+Create the new annotation as an object literal, according to the following example:
+
+ var myAnnotation = {
+ /** The URL of the image where the annotation should go **/
+ src : 'http://www.example.com/myimage.jpg',
+
+ /** The annotation text **/
+ text : 'My annotation',
+
+ /** The annotation shape **/
+ shapes : [{
+ /** The shape type **/
+ type : 'rect',
+
+ /** The shape geometry (relative coordinates) **/
+ geometry : { x : 0.1, y: 0.1, width : 0.4, height: 0.3 }
+ }]
+ }
+
+__Some notes on annotation shapes:__
+
+* Although the ``shapes`` field requires an array of shapes, Annotorious currently uses
+ the first shape in the array __only__. All other shapes are disregarded. (The array is there for future use,
+ and for reasons of compatibility with other annotation systems.)
+* Currently, ``rect`` (rectangle) is the only supported shape type.
+* Per default, Annotorious uses a normalized coordinate system. The example above represents
+ a rectangle that starts at a horizontal (vertical) distance of 10% of the image's width (height);
+ has a width of 40% of the image's width; and a height of 30% of the image's height.
+
+__Using pixel coordinates:__ optionally, you can also express geometry coordinates in pixel units. See below for an example:
+
+ var myAnnotation = {
+ /** The URL of the image where the annotation should go **/
+ src : 'http://www.example.com/myimage.jpg',
+
+ /** The annotation text **/
+ text : 'My annotation',
+
+ /** The annotation shape **/
+ shapes : [{
+ /** The shape type **/
+ type : 'rect',
+
+ /** 'units' is required unless you want to use relative coordinates! **/
+ units: 'pixel',
+
+ /** The shape geometry (pixel coordinates) **/
+ geometry : { x : 10, y: 10, width : 40, height: 60 }
+ }]
+ }
+
+__Making annotations 'read-only'__: in most cases, you probably don't want users to be able to delete or edit the
+annotations you have added via the API. You can easily make them 'read-only' by adding an additional field to the object literal:
+
+ editable : false
+
+If this field is set to false, there will be no _delete_ icon in the annotation popup.
+
+## anno.addHandler(type, handler)
+
+Adds an event handler function. Code example:
+
+ // Logs newly-created annotations to the console
+ anno.addHandler('onAnnotationCreated', function(annotation) {
+ console.log(annotation.text);
+ });
+
+Annotorious issues the following events:
+
+* _onMouseOverItem(event)_ - fired when the mouse enters an annotatable item
+* _onMouseOutOfItem(event)_ - fired when the mouse leaves an annotatable item
+* _onMouseOverAnnotation(event)_ - fired when the mouse enters an annotation
+* _onMouseOutOfAnnotation(event)_ - fired when the mouse leaves an annotation
+* _onSelectionStarted(event)_ - fired when the user starts a selection
+* _onSelectionCanceled(event)_ - fired when the user cancels a selection (not available on all selection tools)
+* _onSelectionCompleted(event)_ - fired when the user completes a selection
+* _onSelectionChanged(event)_ - fired when the user changed a selection
+* _beforePopupHide(popup)_ - fired just before the annotation info popup window hides
+* _beforeAnnotationRemoved(annotation)_ - fired before an annotation is removed (Note: it is possible
+ to prevent annotation removal by returning _false_ from the handler method!)
+* _onAnnotationRemoved(annotation)_ - fired when an annotation is removed from an imgae
+* _onAnnotationCreated(annotation)_ - fired when an annotation was created
+* _onAnnotationUpdated(annotation)_ - fired when an existing annotation was edited/updated
+
+
+## anno.addPlugin(pluginName, opt_config_options)
+
+Registers a plugin. For more information, see the [Plugins Wiki page](/annotorious/annotorious/wiki/Plugins).
+
+## anno.destroy(opt_item_url)
+
+Destroys annotation functionality on a specific item, or on all items on the page. Note that this
+method differs from ``anno.reset()`` (see below) insofar as ``destroy`` does not re-evaluate the
+``annotatable`` CSS attributes. What is destroyed, stays destroyed. (Until re-enabled through
+``anno.makeAnnotatable()``).
+
+## anno.getAnnotations(opt_item_url)
+
+Returns the current annotations. ``opt_item_url`` is optional. If omitted, the method call will return all annotations, on all annotatable items on the page. If set to a specific item URL, only the annotations on that item will be returned.
+
+## anno.hideAnnotations(opt_item_url)
+
+Hides existing annotations on all, or a specific item.
+
+## anno.hideSelectionWidget(opt_item_url)
+
+Disables the selection widget (the small tooltip in the upper left corner which says "Click and Drag to
+Annotate"), thus preventing users from creating new annotations alltogether. The typical use case for this
+is 'read-only' annotated images. I.e. if you want to add some pre-defined annotations using
+anno.addAnnotation without the user being able to add or change anything.
+
+The selection widget can be hidden on a specific item or globally, on all annotatable items on the page.
+
+## anno.highlightAnnotation(annotation)
+
+Highlights the specified annotation, just as if the mouse pointer was hovering over it. The annotation
+will remain highlighted until one of these conditions is met:
+
+* The user moves the mouse into, and out of the annotation
+* The user moves the mouse over another annotation
+* The highlight is removed by calling this method with an empty parameter, e.g.
+ _anno.highlightAnnotation()_ or _anno.highlightAnnotation(undefined)_
+* Another annotation is highlighted via _anno.highlightAnnotation_
+
+## anno.makeAnnotatable(item)
+
+Makes an item on the screen annotatable (if there is a module available supporting the item format). You can
+use this method as an alternative to CSS-based activation. It works just the same way, and is simply there for convenience, and to prepare for (future) item formats that technically don't support CSS-based activation (such as Web maps).
+
+Example:
+```
+
+
+
+
+
+
+
+
+
+
+```
+
+## anno.removeAll(opt_item_url)
+
+Removes all annotations. If the optional parameter ``opt_item_url`` is set, only the annotations on the
+specified item will be removed. Otherwise all annotations on all items on the page will be removed.
+
+## anno.removeAnnotation(annotation)
+
+Removes an annotation from the page.
+
+## anno.reset()
+
+Performs a 'hard reset' on Annotorious. This means all annotation features will be removed, and the page
+will be re-scanned for items with the 'annotatable' CSS class. (Note: this method could be handy in case you
+are working with JavaScript image carousels. Just make sure the images have 'annotatable' set, then
+reset Annotorious after each page flip.)
+
+## anno.showAnnotations(opt_item_url)
+
+Shows existing annotations on all, or a specific item (if they were hidden using _anno.hideAnnotations_).
+
+## anno.showSelectionWidget(opt_item_url)
+
+Enables the selection widget (the small tooltip in the upper left corner which says "Click and Drag to Annotate"), thus enabling users to creating new annotations. (Per default, the selection widget is
+enabled.)
\ No newline at end of file
diff --git a/annotorious.min.js b/annotorious.min.js
new file mode 100644
index 0000000..721b60d
--- /dev/null
+++ b/annotorious.min.js
@@ -0,0 +1,306 @@
+function f(){return function(){}}function m(a){return function(){return this[a]}}function aa(a){return function(){return a}}var n,p=this;function ba(a,b){var c=a.split("."),d=p;c[0]in d||!d.execScript||d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)c.length||void 0===b?d=d[e]?d[e]:d[e]={}:d[e]=b}function ca(){}function da(a){a.ec=function(){return a.le?a.le:a.le=new a}}
+function fa(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
+else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function ga(a){return"array"==fa(a)}function ha(a){var b=fa(a);return"array"==b||"object"==b&&"number"==typeof a.length}function q(a){return"string"==typeof a}function ia(a){return"number"==typeof a}function r(a){return"function"==fa(a)}function ja(a){var b=typeof a;return"object"==b&&null!=a||"function"==b}function ka(a){return a[ma]||(a[ma]=++na)}var ma="closure_uid_"+(1E9*Math.random()>>>0),na=0;
+function oa(a,b,c){return a.call.apply(a.bind,arguments)}function pa(a,b,c){if(!a)throw Error();if(2/g,za=/\"/g,va=/[&<>\"]/;function Aa(a){return String(a).replace(/\-([a-z])/g,function(a,c){return c.toUpperCase()})}
+function Ba(a){var b=q(void 0)?"undefined".replace(/([-()\[\]{}+?*.$\^|,:#c?Math.max(0,a.length+c):c;if(q(a))return q(b)&&1==b.length?a.indexOf(b,c):-1;for(;cc?null:q(a)?a.charAt(c):a[c]}function Ha(a,b){return 0<=Ca(a,b)}function z(a,b){var c=Ca(a,b),d;(d=0<=c)&&x.splice.call(a,c,1);return d}function Ia(a){var b=a.length;if(0=arguments.length?x.slice.call(a,b):x.slice.call(a,b,c)}function La(a,b){x.sort.call(a,b||Ma)}function Ma(a,b){return a>b?1:aparseFloat(bb)){ab=String(fb);break a}}ab=bb}var gb={};
+function F(a){var b;if(!(b=gb[a])){b=0;for(var c=ta(String(ab)).split("."),d=ta(String(a)).split("."),e=Math.max(c.length,d.length),g=0;0==b&&g(0==u[1].length?0:parseInt(u[1],10))?1:0)||((0==w[2].length)<
+(0==u[2].length)?-1:(0==w[2].length)>(0==u[2].length)?1:0)||(w[2]u[2]?1:0)}while(0==b)}b=gb[a]=0<=b}return b}var hb=p.document,ib=hb&&C?$a()||("CSS1Compat"==hb.compatMode?parseInt(ab,10):5):void 0;var jb,nb=!C||C&&9<=ib;!D&&!C||C&&C&&9<=ib||D&&F("1.9.1");C&&F("9");var ob=C||B||E;function pb(a){a=a.className;return q(a)&&a.match(/\S+/g)||[]}function qb(a,b){var c=pb(a),d=Ka(arguments,1),e=c.length+d.length;rb(c,d);a.className=c.join(" ");return c.length==e}function sb(a,b){var c=pb(a),d=Ka(arguments,1),e=tb(c,d);a.className=e.join(" ");return e.length==c.length-d.length}function rb(a,b){for(var c=0;ca):!1}function Ab(a){this.da=a||p.document||document}n=Ab.prototype;n.ae=zb;n.j=function(a){return q(a)?this.da.getElementById(a):a};n.G=Db;
+n.createElement=function(a){return this.da.createElement(a)};n.createTextNode=function(a){return this.da.createTextNode(String(a))};function Qb(a){var b=a.da;a=E?b.body:b.documentElement;b=b.parentWindow||b.defaultView;return C&&F("10")&&b.pageYOffset!=a.scrollTop?new G(a.scrollLeft,a.scrollTop):new G(b.pageXOffset||a.scrollLeft,b.pageYOffset||a.scrollTop)}n.appendChild=function(a,b){a.appendChild(b)};n.append=function(a,b){Gb(H(a),a,arguments,1)};n.contains=Nb;function Rb(){return!0};/*
+ Portions of this code are from the Dojo Toolkit, received by
+ The Closure Library Authors under the BSD license. All other code is
+ Copyright 2005-2009 The Closure Library Authors. All Rights Reserved.
+
+The "New" BSD License:
+
+Copyright (c) 2005-2009, The Dojo Foundation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ Neither the name of the Dojo Foundation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+var I=function(){function a(a,c){if(!a)return[];if(a.constructor==Array)return a;if(!q(a))return[a];if(q(c)&&(c=q(c)?document.getElementById(c):c,!c))return[];c=c||document;var e=c.ownerDocument||c.documentElement;Qa=c.contentType&&"application/xml"==c.contentType||B&&(c.doctype||"[object XMLDocument]"==e.toString())||!!e&&(C?e.xml:c.xmlVersion||e.xmlVersion);return(e=d(a)(c))&&e.Ic?e:b(e)}function b(a){if(a&&a.Ic)return a;var b=[];if(!a||!a.length)return b;a[0]&&b.push(a[0]);if(2>a.length)return b;
+ea++;if(C&&Qa){var c=ea+"";a[0].setAttribute("_zipIdx",c);for(var d=1,e;e=a[d];d++)a[d].getAttribute("_zipIdx")!=c&&b.push(e),e.setAttribute("_zipIdx",c)}else if(C&&a.Ge)try{for(d=1;e=a[d];d++)Sb(e)&&b.push(e)}catch(g){}else for(a[0]&&(a[0]._zipIdx=ea),d=1;e=a[d];d++)a[d]._zipIdx!=ea&&b.push(e),e._zipIdx=ea;return b}function c(a,b){if(!b)return 1;var c=lf(a);return b[c]?0:b[c]=1}function d(a,b){if(Bd){var c=Cd[a];if(c&&!b)return c}if(c=Dd[a])return c;var c=a.charAt(0),g=-1==a.indexOf(" ");0<=a.indexOf("#")&&
+g&&(b=!0);if(!Bd||b||-1!="\x3e~+".indexOf(c)||C&&-1!=a.indexOf(":")||Ed&&0<=a.indexOf(".")||-1!=a.indexOf(":contains")||-1!=a.indexOf("|\x3d")){var h=a.split(/\s*,\s*/);return Dd[a]=2>h.length?e(a):function(a){for(var b=0,c=[],d;d=h[b++];)c=c.concat(e(d)(a));return c}}var k=0<="\x3e~+".indexOf(a.charAt(a.length-1))?a+" *":a;return Cd[a]=function(b){try{if(9!=b.nodeType&&!g)throw"";var c=b.querySelectorAll(k);C?c.Ge=!0:c.Ic=!0;return c}catch(e){return d(a,!0)(b)}}}function e(a){var b=Fd(ta(a));if(1==
+b.length){var c=g(b[0]);return function(a){if(a=c(a,[]))a.Ic=!0;return a}}return function(a){a=kb(a);for(var c,d,e=b.length,h,k,uc=0;uc"\x3e~+".indexOf(a)?v.aa=a:v.Jc=a;u=-1}0<=l&&(v.Ba.push(c(l+1,A).replace(/\\/g,"")),l=-1)}function c(b,d){return ta(a.slice(b,d))}a=0<="\x3e~+".indexOf(a.slice(-1))?a+" * ":a+" ";for(var d=
+[],e=-1,g=-1,h=-1,k=-1,l=-1,s=-1,u=-1,w="",P="",la,A=0,ea=a.length,v=null,Q=null;w=P,P=a.charAt(A),Ae?e=e%d&&d+e%d:0=d&&(g=e-e%d),e%=d):0>d&&(d*=-1,0=g&&(0>h||a<=h)&&a%d==e};b=e}var k=parseInt(b,10);return function(a){return Ub(a)==k}}},mf=C?function(a){var b=a.toLowerCase();"class"==b&&(a="className");return function(c){return Qa?c.getAttribute(a):c[a]||c[b]}}:function(a){return function(b){return b&&b.getAttribute&&b.hasAttribute(a)}},Gd={},Dd={},Cd={},Bd=!!document.querySelectorAll&&
+(!E||F("526")),ea=0,lf=C?function(a){return Qa?a.getAttribute("_uid")||a.setAttribute("_uid",++ea)||ea:a.uniqueID}:function(a){return a._uid||(a._uid=++ea)};a.kb=vc;return a}();ba("goog.dom.query",I);ba("goog.dom.query.pseudos",I.kb);var Vb=!C||C&&9<=ib,Wb=!C||C&&9<=ib,Xb=C&&!F("9");!E||F("528");D&&F("1.9b")||C&&F("8")||B&&F("9.5")||E&&F("528");D&&!F("8")||C&&F("9");function Yb(){0!=Zb&&(this.kf=Error().stack,$b[ka(this)]=this)}var Zb=0,$b={};Yb.prototype.xc=!1;Yb.prototype.ub=function(){if(!this.xc&&(this.xc=!0,this.S(),0!=Zb)){var a=ka(this);delete $b[a]}};Yb.prototype.S=function(){if(this.jc)for(;this.jc.length;)this.jc.shift()()};function ac(a){a&&"function"==typeof a.ub&&a.ub()};function bc(a,b){this.type=a;this.currentTarget=this.target=b}n=bc.prototype;n.S=f();n.ub=f();n.Ra=!1;n.defaultPrevented=!1;n.re=!0;n.stopPropagation=function(){this.Ra=!0};n.preventDefault=function(){this.defaultPrevented=!0;this.re=!1};function cc(a){a.preventDefault()};function dc(a){dc[" "](a);return a}dc[" "]=ca;function ec(a,b){a&&this.init(a,b)}t(ec,bc);var fc=[1,4,2];n=ec.prototype;n.target=null;n.relatedTarget=null;n.offsetX=0;n.offsetY=0;n.clientX=0;n.clientY=0;n.screenX=0;n.screenY=0;n.button=0;n.keyCode=0;n.charCode=0;n.ctrlKey=!1;n.altKey=!1;n.shiftKey=!1;n.metaKey=!1;n.yd=!1;n.D=null;
+n.init=function(a,b){var c=this.type=a.type;bc.call(this,c);this.target=a.target||a.srcElement;this.currentTarget=b;var d=a.relatedTarget;if(d){if(D){var e;a:{try{dc(d.nodeName);e=!0;break a}catch(g){}e=!1}e||(d=null)}}else"mouseover"==c?d=a.fromElement:"mouseout"==c&&(d=a.toElement);this.relatedTarget=d;this.offsetX=E||void 0!==a.offsetX?a.offsetX:a.layerX;this.offsetY=E||void 0!==a.offsetY?a.offsetY:a.layerY;this.clientX=void 0!==a.clientX?a.clientX:a.pageX;this.clientY=void 0!==a.clientY?a.clientY:
+a.pageY;this.screenX=a.screenX||0;this.screenY=a.screenY||0;this.button=a.button;this.keyCode=a.keyCode||0;this.charCode=a.charCode||("keypress"==c?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.yd=Ta?a.metaKey:a.ctrlKey;this.state=a.state;this.D=a;a.defaultPrevented&&this.preventDefault();delete this.Ra};function gc(a){return(Vb?0==a.D.button:"click"==a.type?!0:!!(a.D.button&fc[0]))&&!(E&&Ta&&a.ctrlKey)}
+n.stopPropagation=function(){ec.H.stopPropagation.call(this);this.D.stopPropagation?this.D.stopPropagation():this.D.cancelBubble=!0};n.preventDefault=function(){ec.H.preventDefault.call(this);var a=this.D;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,Xb)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};n.He=m("D");n.S=f();var hc="closure_listenable_"+(1E6*Math.random()|0),ic=0;function jc(a,b,c,d,e,g){this.wa=a;this.pe=b;this.src=c;this.type=d;this.capture=!!e;this.ua=g;this.key=++ic;this.Fa=this.qb=!1}function kc(a){a.Fa=!0;a.wa=null;a.pe=null;a.src=null;a.ua=null};var lc={},mc={},nc={},oc={};
+function J(a,b,c,d,e){if(ga(b)){for(var g=0;ge.keyCode||void 0!=e.returnValue)return!0;a:{var k=!1;if(0==e.keyCode)try{e.keyCode=-1;break a}catch(l){k=!0}if(k||void 0==e.returnValue)e.returnValue=!0}}k=new ec;k.init(e,this);e=!0;try{if(c){for(var s=[],w=k.currentTarget;w;w=w.parentNode)s.push(w);g=d[!0];for(var u=
+s.length-1;!k.Ra&&0<=u;u--)k.currentTarget=s[u],e&=xc(g,s[u],k);if(h)for(g=d[!1],u=0;!k.Ra&&u>>0);function pc(a){return r(a)?a:a[zc]||(a[zc]=function(b){return a.handleEvent(b)})};function Ac(a){Yb.call(this);this.he=a;this.w={}}t(Ac,Yb);var Bc=[];n=Ac.prototype;n.A=function(a,b,c,d,e){ga(b)||(Bc[0]=b,b=Bc);for(var g=0;g=this.left&&a.right<=this.right&&a.top>=this.top&&a.bottom<=this.bottom:a.x>=this.left&&a.x<=this.right&&a.y>=this.top&&a.y<=this.bottom:!1};Gc.prototype.round=function(){this.top=Math.round(this.top);this.right=Math.round(this.right);this.bottom=Math.round(this.bottom);this.left=Math.round(this.left);return this};
+Gc.prototype.translate=function(a,b){a instanceof G?(this.left+=a.x,this.right+=a.x,this.top+=a.y,this.bottom+=a.y):(this.left+=a,this.right+=a,ia(b)&&(this.top+=b,this.bottom+=b));return this};function Hc(a,b,c,d){this.left=a;this.top=b;this.width=c;this.height=d}Hc.prototype.contains=function(a){return a instanceof Hc?this.left<=a.left&&this.left+this.width>=a.left+a.width&&this.top<=a.top&&this.top+this.height>=a.top+a.height:a.x>=this.left&&a.x<=this.left+this.width&&a.y>=this.top&&a.y<=this.top+this.height};Hc.prototype.round=function(){this.left=Math.round(this.left);this.top=Math.round(this.top);this.width=Math.round(this.width);this.height=Math.round(this.height);return this};
+Hc.prototype.translate=function(a,b){a instanceof G?(this.left+=a.x,this.top+=a.y):(this.left+=a,ia(b)&&(this.top+=b));return this};function L(a,b,c){q(b)?Ic(a,c,b):wb(b,ra(Ic,a))}function Ic(a,b,c){(c=Jc(a,c))&&(a.style[c]=b)}function Jc(a,b){var c=Aa(b);if(void 0===a.style[c]){var d=(E?"Webkit":D?"Moz":C?"ms":B?"O":null)+Ba(b);if(void 0!==a.style[d])return d}return c}function Kc(a,b){var c=a.style[Aa(b)];return"undefined"!==typeof c?c:a.style[Jc(a,b)]||""}function M(a,b){var c=H(a);return c.defaultView&&c.defaultView.getComputedStyle&&(c=c.defaultView.getComputedStyle(a,null))?c[b]||c.getPropertyValue(b)||"":""}
+function Lc(a,b){return M(a,b)||(a.currentStyle?a.currentStyle[b]:null)||a.style&&a.style[b]}function Mc(a,b,c){var d,e=D&&(Ta||Za)&&F("1.9");b instanceof G?(d=b.x,b=b.y):(d=b,b=c);a.style.left=Nc(d,e);a.style.top=Nc(b,e)}function Oc(a){var b;try{b=a.getBoundingClientRect()}catch(c){return{left:0,top:0,right:0,bottom:0}}C&&(a=a.ownerDocument,b.left-=a.documentElement.clientLeft+a.body.clientLeft,b.top-=a.documentElement.clientTop+a.body.clientTop);return b}
+function Pc(a){if(C&&!(C&&8<=ib))return a.offsetParent;var b=H(a),c=Lc(a,"position"),d="fixed"==c||"absolute"==c;for(a=a.parentNode;a&&a!=b;a=a.parentNode)if(c=Lc(a,"position"),d=d&&"static"==c&&a!=b.documentElement&&a!=b.body,!d&&(a.scrollWidth>a.clientWidth||a.scrollHeight>a.clientHeight||"fixed"==c||"absolute"==c||"relative"==c))return a;return null}
+function Qc(a){var b,c=H(a),d=Lc(a,"position"),e=D&&c.getBoxObjectFor&&!a.getBoundingClientRect&&"absolute"==d&&(b=c.getBoxObjectFor(a))&&(0>b.screenX||0>b.screenY),g=new G(0,0),h;b=c?H(c):document;(h=!C)||(h=C&&9<=ib)||(zb(b),h=!0);h=h?b.documentElement:b.body;if(a==h)return g;if(a.getBoundingClientRect)b=Oc(a),a=Qb(zb(c)),g.x=b.left+a.x,g.y=b.top+a.y;else if(c.getBoxObjectFor&&!e)b=c.getBoxObjectFor(a),a=c.getBoxObjectFor(h),g.x=b.screenX-a.screenX,g.y=b.screenY-a.screenY;else{e=a;do{g.x+=e.offsetLeft;
+g.y+=e.offsetTop;e!=a&&(g.x+=e.clientLeft||0,g.y+=e.clientTop||0);if(E&&"fixed"==Lc(e,"position")){g.x+=c.body.scrollLeft;g.y+=c.body.scrollTop;break}e=e.offsetParent}while(e&&e!=a);if(B||E&&"absolute"==d)g.y-=c.body.offsetTop;for(e=a;(e=Pc(e))&&e!=c.body&&e!=h;)g.x-=e.scrollLeft,B&&"TR"==e.tagName||(g.y-=e.scrollTop)}return g}function Rc(a,b){var c=Sc(a),d=Sc(b);return new G(c.x-d.x,c.y-d.y)}
+function Sc(a){if(1==a.nodeType){var b;if(a.getBoundingClientRect)b=Oc(a),b=new G(b.left,b.top);else{b=Qb(zb(a));var c=Qc(a);b=new G(c.x-b.x,c.y-b.y)}if(D&&!F(12)){var d;C?d="-ms-transform":E?d="-webkit-transform":B?d="-o-transform":D&&(d="-moz-transform");var e;d&&(e=Lc(a,d));e||(e=Lc(a,"transform"));a=e?(a=e.match(Tc))?new G(parseFloat(a[1]),parseFloat(a[2])):new G(0,0):new G(0,0);a=new G(b.x+a.x,b.y+a.y)}else a=b;return a}d=r(a.He);e=a;a.targetTouches?e=a.targetTouches[0]:d&&a.D.targetTouches&&
+(e=a.D.targetTouches[0]);return new G(e.clientX,e.clientY)}function Uc(a,b,c){if(b instanceof vb)c=b.height,b=b.width;else if(void 0==c)throw Error("missing height argument");a.style.width=Nc(b,!0);a.style.height=Nc(c,!0)}function Nc(a,b){"number"==typeof a&&(a=(b?Math.round(a):a)+"px");return a}
+function Vc(a){var b=Wc;if("none"!=Lc(a,"display"))return b(a);var c=a.style,d=c.display,e=c.visibility,g=c.position;c.visibility="hidden";c.position="absolute";c.display="inline";a=b(a);c.display=d;c.position=g;c.visibility=e;return a}function Wc(a){var b=a.offsetWidth,c=a.offsetHeight,d=E&&!b&&!c;return(void 0===b||d)&&a.getBoundingClientRect?(a=Oc(a),new vb(a.right-a.left,a.bottom-a.top)):new vb(b,c)}function Xc(a){var b=Qc(a);a=Vc(a);return new Hc(b.x,b.y,a.width,a.height)}
+function N(a,b){var c=a.style;"opacity"in c?c.opacity=b:"MozOpacity"in c?c.MozOpacity=b:"filter"in c&&(c.filter=""===b?"":"alpha(opacity\x3d"+100*b+")")}function O(a,b){a.style.display=b?"":"none"}function Yc(a){return"rtl"==Lc(a,"direction")}var Zc=D?"MozUserSelect":E?"WebkitUserSelect":null;
+function $c(a,b){if(/^\d+px?$/.test(b))return parseInt(b,10);var c=a.style.left,d=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;a.style.left=b;var e=a.style.pixelLeft;a.style.left=c;a.runtimeStyle.left=d;return e}function ad(a,b){var c=a.currentStyle?a.currentStyle[b]:null;return c?$c(a,c):0}
+function bd(a,b){if(C){var c=ad(a,b+"Left"),d=ad(a,b+"Right"),e=ad(a,b+"Top"),g=ad(a,b+"Bottom");return new Gc(e,d,g,c)}c=M(a,b+"Left");d=M(a,b+"Right");e=M(a,b+"Top");g=M(a,b+"Bottom");return new Gc(parseFloat(e),parseFloat(d),parseFloat(g),parseFloat(c))}var cd={thin:2,medium:4,thick:6};function dd(a,b){if("none"==(a.currentStyle?a.currentStyle[b+"Style"]:null))return 0;var c=a.currentStyle?a.currentStyle[b+"Width"]:null;return c in cd?cd[c]:$c(a,c)}
+function ed(a){if(C){var b=dd(a,"borderLeft"),c=dd(a,"borderRight"),d=dd(a,"borderTop");a=dd(a,"borderBottom");return new Gc(d,c,a,b)}b=M(a,"borderLeftWidth");c=M(a,"borderRightWidth");d=M(a,"borderTopWidth");a=M(a,"borderBottomWidth");return new Gc(parseFloat(d),parseFloat(c),parseFloat(a),parseFloat(b))}var Tc=/matrix\([0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, ([0-9\.\-]+)p?x?, ([0-9\.\-]+)p?x?\)/;function fd(a,b,c){Ec.call(this);this.target=a;this.handle=b||a;this.qd=c||new Hc(NaN,NaN,NaN,NaN);this.da=H(a);this.sa=new Ac(this);a=ra(ac,this.sa);this.jc||(this.jc=[]);this.jc.push(qa(a,void 0));J(this.handle,["touchstart","mousedown"],this.ue,!1,this)}t(fd,Ec);var gd=C||D&&F("1.9.3");n=fd.prototype;n.clientX=0;n.clientY=0;n.screenX=0;n.screenY=0;n.we=0;n.xe=0;n.sb=0;n.tb=0;n.Yd=!0;n.jb=!1;n.je=0;n.Se=0;n.Oe=!1;n.Hd=!1;n.zc=m("sa");function hd(a,b){a.qd=b||new Hc(NaN,NaN,NaN,NaN)}
+n.S=function(){fd.H.S.call(this);sc(this.handle,["touchstart","mousedown"],this.ue,!1,this);this.sa.Sa();gd&&this.da.releaseCapture();this.handle=this.target=null};function id(a){void 0===a.Ta&&(a.Ta=Yc(a.target));return a.Ta}
+n.ue=function(a){var b="mousedown"==a.type;if(!this.Yd||this.jb||b&&!gc(a))this.dispatchEvent("earlycancel");else{jd(a);if(0==this.je)if(this.dispatchEvent(new kd("start",this,a.clientX,a.clientY,a)))this.jb=!0,a.preventDefault();else return;else a.preventDefault();var b=this.da,c=b.documentElement,d=!gd;this.sa.A(b,["touchmove","mousemove"],this.Me,d);this.sa.A(b,["touchend","mouseup"],this.yc,d);gd?(c.setCapture(!1),this.sa.A(c,"losecapture",this.yc)):this.sa.A(b?b.parentWindow||b.defaultView:window,
+"blur",this.yc);C&&this.Oe&&this.sa.A(b,"dragstart",cc);this.Ye&&this.sa.A(this.Ye,"scroll",this.Ve,d);this.clientX=this.we=a.clientX;this.clientY=this.xe=a.clientY;this.screenX=a.screenX;this.screenY=a.screenY;this.Hd?(a=this.target,b=a.offsetLeft,c=a.offsetParent,c||"fixed"!=Lc(a,"position")||(c=H(a).documentElement),c?(D?(d=ed(c),b+=d.left):C&&8<=ib&&(d=ed(c),b-=d.left),a=Yc(c)?c.clientWidth-(b+a.offsetWidth):b):a=b):a=this.target.offsetLeft;this.sb=a;this.tb=this.target.offsetTop;this.xd=Qb(zb(this.da));
+this.Se=sa()}};n.yc=function(a,b){this.sa.Sa();gd&&this.da.releaseCapture();if(this.jb){jd(a);this.jb=!1;var c=ld(this,this.sb),d=md(this,this.tb);this.dispatchEvent(new kd("end",this,a.clientX,a.clientY,a,c,d,b||"touchcancel"==a.type))}else this.dispatchEvent("earlycancel")};function jd(a){var b=a.type;"touchstart"==b||"touchmove"==b?a.init(a.D.targetTouches[0],a.currentTarget):"touchend"!=b&&"touchcancel"!=b||a.init(a.D.changedTouches[0],a.currentTarget)}
+n.Me=function(a){if(this.Yd){jd(a);var b=(this.Hd&&id(this)?-1:1)*(a.clientX-this.clientX),c=a.clientY-this.clientY;this.clientX=a.clientX;this.clientY=a.clientY;this.screenX=a.screenX;this.screenY=a.screenY;if(!this.jb){var d=this.we-this.clientX,e=this.xe-this.clientY;if(d*d+e*e>this.je)if(this.dispatchEvent(new kd("start",this,a.clientX,a.clientY,a)))this.jb=!0;else{this.xc||this.yc(a);return}}c=nd(this,b,c);b=c.x;c=c.y;this.jb&&this.dispatchEvent(new kd("beforedrag",this,a.clientX,a.clientY,a,
+b,c))&&(od(this,a,b,c),a.preventDefault())}};function nd(a,b,c){var d=Qb(zb(a.da));b+=d.x-a.xd.x;c+=d.y-a.xd.y;a.xd=d;a.sb+=b;a.tb+=c;b=ld(a,a.sb);a=md(a,a.tb);return new G(b,a)}n.Ve=function(a){var b=nd(this,0,0);a.clientX=this.clientX;a.clientY=this.clientY;od(this,a,b.x,b.y)};function od(a,b,c,d){a.Xd(c,d);a.dispatchEvent(new kd("drag",a,b.clientX,b.clientY,b,c,d))}
+function ld(a,b){var c=a.qd,d=isNaN(c.left)?null:c.left,c=isNaN(c.width)?0:c.width;return Math.min(null!=d?d+c:Infinity,Math.max(null!=d?d:-Infinity,b))}function md(a,b){var c=a.qd,d=isNaN(c.top)?null:c.top,c=isNaN(c.height)?0:c.height;return Math.min(null!=d?d+c:Infinity,Math.max(null!=d?d:-Infinity,b))}n.Xd=function(a,b){this.Hd&&id(this)?this.target.style.right=a+"px":this.target.style.left=a+"px";this.target.style.top=b+"px"};
+function kd(a,b,c,d,e,g,h,k){bc.call(this,a);this.clientX=c;this.clientY=d;this.jf=e;this.left=void 0!==g?g:b.sb;this.top=void 0!==h?h:b.tb;this.mf=b;this.lf=!!k}t(kd,bc);function pd(a){for(var b=0,c=0;a&&!isNaN(a.offsetLeft)&&!isNaN(a.offsetTop);)b+=a.offsetLeft-a.scrollLeft,c+=a.offsetTop-a.scrollTop,a=a.offsetParent;return{top:c,left:b}}function qd(a){window.addEventListener?window.addEventListener("load",a,!1):window.attachEvent&&window.attachEvent("onload",a)}
+function rd(a,b){var c=document.createElement("div");L(c,"position","absolute");L(c,"top","0px");L(c,"right","0px");L(c,"width","5px");L(c,"height","100%");L(c,"cursor","e-resize");a.appendChild(c);var d=ed(a),d=Xc(a).width-d.right-d.left,c=new fd(c);hd(c,new Hc(d,0,800,0));c.Xd=function(c){L(a,"width",c+"px");b&&b()}}function sd(a){if(02*this.X&&vd(this),!0):!1};function vd(a){if(a.X!=a.w.length){for(var b=0,c=0;byd(a)?-1:1)*b,k=g.x-c.x,l=g.y-c.y,s=0h?-1:0,h=Math.sqrt(Math.pow(h,2)/(1+Math.pow(k/l,2)));d.push({x:g.x+Math.abs(k/l*h)*(0k?-1:0)*s,y:g.y+Math.abs(h)*(0l?-1:0)*s})}return d};function Ld(a,b,c,d){0a.x+a.width||c>a.y+a.height?!1:!0;if("polygon"==a.type){a=a.geometry.points;for(var d=!1,e=a.length-1,g=0;gc!=a[e].y>c&&b<(a[e].x-a[g].x)*(c-a[g].y)/(a[e].y-a[g].y)+a[g].x&&(d=!d),e=g;return d}return!1}
+function Pd(a){return a.type==T||"arrow"==a.type?(a="arrow"==a.type?Od(a.geometry):a.geometry,a.width*a.height):"polygon"==a.type?Math.abs(yd(a.geometry.points)):0}function Qd(a){if(a.type==T)return a;if("polygon"==a.type){for(var b=a.geometry.points,c=b[0].x,d=b[0].x,e=b[0].y,g=b[0].y,h=1;hd&&(d=b[h].x),b[h].xg&&(g=b[h].y),b[h].yyd(c)?-1:1;if(4>c.length)c=Ad(c,d*b);else{for(var e=c.length-1,g=1,h=[],k=0;kc.length-1&&(g=0);c=h}return new Md("polygon",new xd(c),!1,a.style)}
+function U(a,b){if(a.type==T){var c=a.geometry,d=b(c);d.rotation=c.rotation;return new Md(T,d,!1,a.style,a.mask)}if("polygon"==a.type){var e=[];y(a.geometry.points,function(a){e.push(b(a))});return new Md("polygon",new xd(e),!1,a.style)}if("arrow"==a.type)return new Md("arrow",new Td(b(a.geometry.arrowTail),b(a.geometry.arrowHead)),!1,a.style)}function V(a){return JSON.stringify(a.geometry)};function Ud(a,b,c,d,e,g){this.id=g;this.src=a;this.text=b;this.textId=e;this.shapes=[c];this.created_at=d||Date.now();this.context=document.URL;this.setMask=this.setMask}Ud.prototype.setMask=function(a,b,c,d){if(!b||this.shapes.length>=b)b=0;this.shapes[b].type!=T?console.log("WARNING: impossible to set mask in shape "+this.shapes[b].type):this.shapes[b].mask=a;c&&(this.shapes[b].style.maskTransparency=c);void 0!=d&&(this.shapes[b].style.maskBorder=d)};function Vd(){}function Wd(a,b){a.l=new ud;a.Xc=[];a.Sb=[];a.pb=[];a.lb=[];a.Sc=[];a.pc={Ab:!1,zb:!1};a.mb=new ud;a.Jb={};a.Sd=b}function Xd(a,b){var c=a.mb.get(b);c||(c={Ab:!1,zb:!1},a.mb.set(b,c));return c}
+function Yd(a,b){var c=a.Ac(b);if(!a.l.get(c)){var d=a.vd(b),e=[],g=[];y(a.Xc,function(a){d.addHandler(a.type,a.ua)});y(a.Sb,function(a){if(a.onInitAnnotator)a.onInitAnnotator(d)});y(a.lb,function(a){a.src==c&&(d.P(a),e.push(a))});y(a.Sc,function(a){a.src==c&&(d.T(a),g.push(a))});y(e,function(b){z(a.lb,b)});y(g,function(b){z(a.Sc,b)});var h=a.mb.get(c);h?(h.Ab&&d.Z(),h.zb&&d.Ea(),a.mb.remove(c)):(a.pc.Ab&&d.Z(),a.pc.zb&&d.Ea());a.Jb&&0!==Object.keys(a.Jb).length&&d.G(a.Jb);a.l.set(c,d);z(a.pb,b)}}
+function Zd(a){var b,c;for(c=a.pb.length;0window.pageYOffset&&g+h>window.pageXOffset)&&Yd(a,b)}}function $d(a,b,c){if(b){var d=a.l.get(b);d?c?d.Va():d.Ea():Xd(a,b).zb=c}else y(R(a.l),function(a){c?a.Va():a.Ea()}),a.pc.zb=!c,y(R(a.mb),function(a){a.zb=!c})}
+function ae(a,b,c){if(b){var d=a.l.get(b);d?c?d.fa():d.Z():Xd(a,b).Ab=c}else y(R(a.l),function(a){c?a.fa():a.Z()}),a.pc.Ab=!c,y(R(a.mb),function(a){a.Ab=!c})}n=Vd.prototype;n.Aa=function(a,b){var c=void 0,d=void 0;q(a)?(c=a,d=b):r(a)&&(d=a);c?(c=this.l.get(c))&&c.Aa(d):y(R(this.l),function(a){a.Aa(d)})};n.stopSelection=function(a){a?(a=this.l.get(a))&&a.stopSelection():y(R(this.l),function(a){a.stopSelection()})};
+n.P=function(a,b){if(be(this,a.src)){var c=this.l.get(a.src);c?c.P(a,b):(this.lb.push(a),b&&z(this.lb,b))}};n.addHandler=function(a,b){y(R(this.l),function(c){c.addHandler(a,b)});this.Xc.push({type:a,ua:b})};n.ya=function(a,b){y(R(this.l),function(c){c.ya(a,b)});y(this.Xc,function(c,d,e){c.type!==a||b&&c.ua!==b||x.splice.call(e,d,1)})};n.sc=function(a){this.Sb.push(a);y(R(this.l),function(b){if(a.onInitAnnotator)a.onInitAnnotator(b)})};
+function be(a,b){return wd(a.l.xa,b)?!0:null!=Ga(a.pb,function(c){return a.Ac(c)==b})}n.destroy=function(a){if(a){var b=this.l.get(a);b&&(b.destroy(),this.l.remove(a))}else y(R(this.l),function(a){a.destroy()}),this.l.clear()};n.Ma=function(a){if(be(this,a)&&(a=this.l.get(a)))return a.Ma().getName()};n.M=function(a){if(a){var b=this.l.get(a);return b?b.M():Da(this.lb,function(b){return b.src==a})}var c=[];y(R(this.l),function(a){Ja(c,a.M())});Ja(c,this.lb);return c};
+n.Da=function(a){if(be(this,a)&&(a=this.l.get(a)))return Ea(a.Da(),function(a){return a.getName()})};n.Ea=function(a){$d(this,a,!1)};n.Z=function(a){ae(this,a,!1)};n.J=function(a){if(a){if(be(this,a.src)){var b=this.l.get(a.src);b&&b.J(a)}}else y(R(this.l),function(a){a.J()})};n.init=function(){this.Sd&&Ja(this.pb,this.Sd());Zd(this);var a=this,b=J(window,"scroll",function(){0/g,re=/\"/g,se=/=/g,te=/\0/g,ue=/&(#\d+|#x[0-9A-Fa-f]+|\w+);/g,ve=/^#(\d+)$/,we=/^#x([0-9A-Fa-f]+)$/,xe=RegExp("^\\s*(?:(?:([a-z][a-z-]*)(\\s*\x3d\\s*(\"[^\"]*\"|'[^']*'|(?\x3d[a-z][a-z-]*\\s*\x3d)|[^\x3e\"'\\s]*))?)|(/?\x3e)|[^a-z\\s\x3e]+)",
+"i"),ye=RegExp("^(?:\x26(\\#[0-9]+|\\#[x][0-9a-f]+|\\w+);|\x3c[!]--[\\s\\S]*?--\x3e|\x3c!\\w[^\x3e]*\x3e|\x3c\\?[^\x3e*]*\x3e|\x3c(/)?([a-z][a-z0-9]*)|([^\x3c\x26\x3e]+)|([\x3c\x26\x3e]))","i");
+ke.prototype.parse=function(a,b){var c=null,d=!1,e=[],g,h,k;a.ka=[];for(a.Oa=!1;b;){var l=b.match(d?xe:ye);b=b.substring(l[0].length);if(d)if(l[1]){var s=l[1].toLowerCase();if(l[2]){l=l[3];switch(l.charCodeAt(0)){case 34:case 39:l=l.substring(1,l.length-1)}l=l.replace(te,"").replace(ue,qa(this.Pe,this))}else l=s;e.push(s,l)}else l[4]&&(void 0!==h&&(k?a.ve&&a.ve(g,e):a.Zd&&a.Zd(g)),k&&h&12&&(c=null===c?b.toLowerCase():c.substring(c.length-b.length),d=c.indexOf("\x3c/"+g),0>d&&(d=b.length),h&4?a.Vd&&
+a.Vd(b.substring(0,d)):a.qe&&a.qe(b.substring(0,d).replace(oe,"\x26amp;$1").replace(pe,"\x26lt;").replace(qe,"\x26gt;")),b=b.substring(d)),g=h=k=void 0,e.length=0,d=!1);else if(l[1])ze(a,l[0]);else if(l[3])k=!l[2],d=!0,g=l[3].toLowerCase(),h=me.hasOwnProperty(g)?me[g]:void 0;else if(l[4])ze(a,l[4]);else if(l[5])switch(l[5]){case "\x3c":ze(a,"\x26lt;");break;case "\x3e":ze(a,"\x26gt;");break;default:ze(a,"\x26amp;")}}for(c=a.ka.length;0<=--c;)a.Ga.append("\x3c/",a.ka[c],"\x3e");a.ka.length=0};
+ke.prototype.Pe=function(a){a=a.toLowerCase();if(le.hasOwnProperty(a))return le[a];var b=a.match(ve);return b?String.fromCharCode(parseInt(b[1],10)):(b=a.match(we))?String.fromCharCode(parseInt(b[1],16)):""};function Ae(){};/*
+ Portions of this code are from the google-caja project, received by
+ Google under the Apache license (http://code.google.com/p/google-caja/).
+ All other code is Copyright 2009 Google, Inc. All Rights Reserved.
+
+// Copyright (C) 2006 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+*/
+function Be(a,b){var c=new je;(new ke).parse(new Ce(c,b,void 0),a);return c.toString()}function Ce(a,b,c){this.Ga=a;this.ka=[];this.Oa=!1;this.ze=b;this.Hc=c}t(Ce,Ae);
+var De={"*::class":9,"*::dir":0,"*::id":4,"*::lang":0,"*::onclick":2,"*::ondblclick":2,"*::onkeydown":2,"*::onkeypress":2,"*::onkeyup":2,"*::onload":2,"*::onmousedown":2,"*::onmousemove":2,"*::onmouseout":2,"*::onmouseover":2,"*::onmouseup":2,"*::style":3,"*::title":0,"*::accesskey":0,"*::tabindex":0,"*::onfocus":2,"*::onblur":2,"a::coords":0,"a::href":1,"a::hreflang":0,"a::name":7,"a::onblur":2,"a::rel":0,"a::rev":0,"a::shape":0,"a::target":10,"a::type":0,"area::accesskey":0,"area::alt":0,"area::coords":0,
+"area::href":1,"area::nohref":0,"area::onfocus":2,"area::shape":0,"area::tabindex":0,"area::target":10,"bdo::dir":0,"blockquote::cite":1,"br::clear":0,"button::accesskey":0,"button::disabled":0,"button::name":8,"button::onblur":2,"button::onfocus":2,"button::tabindex":0,"button::type":0,"button::value":0,"caption::align":0,"col::align":0,"col::char":0,"col::charoff":0,"col::span":0,"col::valign":0,"col::width":0,"colgroup::align":0,"colgroup::char":0,"colgroup::charoff":0,"colgroup::span":0,"colgroup::valign":0,
+"colgroup::width":0,"del::cite":1,"del::datetime":0,"dir::compact":0,"div::align":0,"dl::compact":0,"font::color":0,"font::face":0,"font::size":0,"form::accept":0,"form::action":1,"form::autocomplete":0,"form::enctype":0,"form::method":0,"form::name":7,"form::onreset":2,"form::onsubmit":2,"form::target":10,"h1::align":0,"h2::align":0,"h3::align":0,"h4::align":0,"h5::align":0,"h6::align":0,"hr::align":0,"hr::noshade":0,"hr::size":0,"hr::width":0,"img::align":0,"img::alt":0,"img::border":0,"img::height":0,
+"img::hspace":0,"img::ismap":0,"img::longdesc":1,"img::name":7,"img::src":1,"img::usemap":11,"img::vspace":0,"img::width":0,"input::accept":0,"input::accesskey":0,"input::autocomplete":0,"input::align":0,"input::alt":0,"input::checked":0,"input::disabled":0,"input::ismap":0,"input::maxlength":0,"input::name":8,"input::onblur":2,"input::onchange":2,"input::onfocus":2,"input::onselect":2,"input::readonly":0,"input::size":0,"input::src":1,"input::tabindex":0,"input::type":0,"input::usemap":11,"input::value":0,
+"ins::cite":1,"ins::datetime":0,"label::accesskey":0,"label::for":5,"label::onblur":2,"label::onfocus":2,"legend::accesskey":0,"legend::align":0,"li::type":0,"li::value":0,"map::name":7,"menu::compact":0,"ol::compact":0,"ol::start":0,"ol::type":0,"optgroup::disabled":0,"optgroup::label":0,"option::disabled":0,"option::label":0,"option::selected":0,"option::value":0,"p::align":0,"pre::width":0,"q::cite":1,"select::disabled":0,"select::multiple":0,"select::name":8,"select::onblur":2,"select::onchange":2,
+"select::onfocus":2,"select::size":0,"select::tabindex":0,"table::align":0,"table::bgcolor":0,"table::border":0,"table::cellpadding":0,"table::cellspacing":0,"table::frame":0,"table::rules":0,"table::summary":0,"table::width":0,"tbody::align":0,"tbody::char":0,"tbody::charoff":0,"tbody::valign":0,"td::abbr":0,"td::align":0,"td::axis":0,"td::bgcolor":0,"td::char":0,"td::charoff":0,"td::colspan":0,"td::headers":6,"td::height":0,"td::nowrap":0,"td::rowspan":0,"td::scope":0,"td::valign":0,"td::width":0,
+"textarea::accesskey":0,"textarea::cols":0,"textarea::disabled":0,"textarea::name":8,"textarea::onblur":2,"textarea::onchange":2,"textarea::onfocus":2,"textarea::onselect":2,"textarea::readonly":0,"textarea::rows":0,"textarea::tabindex":0,"tfoot::align":0,"tfoot::char":0,"tfoot::charoff":0,"tfoot::valign":0,"th::abbr":0,"th::align":0,"th::axis":0,"th::bgcolor":0,"th::char":0,"th::charoff":0,"th::colspan":0,"th::headers":6,"th::height":0,"th::nowrap":0,"th::rowspan":0,"th::scope":0,"th::valign":0,
+"th::width":0,"thead::align":0,"thead::char":0,"thead::charoff":0,"thead::valign":0,"tr::align":0,"tr::bgcolor":0,"tr::char":0,"tr::charoff":0,"tr::valign":0,"ul::compact":0,"ul::type":0};
+Ce.prototype.ve=function(a,b){if(!this.Oa&&me.hasOwnProperty(a)){var c=me[a];if(!(c&32))if(c&16)this.Oa=!(c&2);else{for(var d=b,e=0;eb)){for(var d=this.ka.length;--d>b;)c=this.ka[d],me[c]&1||this.Ga.append("\x3c/",c,"\x3e");this.ka.length=b;this.Ga.append("\x3c/",a,"\x3e")}}}};function ze(a,b){a.Oa||a.Ga.append(b)}Ce.prototype.qe=function(a){this.Oa||this.Ga.append(a)};
+Ce.prototype.Vd=function(a){this.Oa||this.Ga.append(a)};function Ee(a,b,c,d,e){if(!(C||E&&F("525")))return!0;if(Ta&&e)return Fe(a);if(e&&!d||!c&&(17==b||18==b||Ta&&91==b))return!1;if(E&&d&&c)switch(a){case 220:case 219:case 221:case 192:case 186:case 189:case 187:case 188:case 190:case 191:case 192:case 222:return!1}if(C&&d&&b==a)return!1;switch(a){case 13:return!(C&&C&&9<=ib);case 27:return!E}return Fe(a)}
+function Fe(a){if(48<=a&&57>=a||96<=a&&106>=a||65<=a&&90>=a||E&&0==a)return!0;switch(a){case 32:case 63:case 107:case 109:case 110:case 111:case 186:case 59:case 189:case 187:case 61:case 188:case 190:case 191:case 192:case 222:case 219:case 220:case 221:return!0;default:return!1}}function Ge(a){switch(a){case 61:return 187;case 59:return 186;case 224:return 91;case 0:return 224;default:return a}};function He(a,b){Ec.call(this);a&&Ie(this,a,b)}t(He,Ec);n=He.prototype;n.L=null;n.Dc=null;n.pd=null;n.Ec=null;n.ea=-1;n.Pa=-1;n.cd=!1;
+var Je={3:13,12:144,63232:38,63233:40,63234:37,63235:39,63236:112,63237:113,63238:114,63239:115,63240:116,63241:117,63242:118,63243:119,63244:120,63245:121,63246:122,63247:123,63248:44,63272:46,63273:36,63275:35,63276:33,63277:34,63289:144,63302:45},Ke={Up:38,Down:40,Left:37,Right:39,Enter:13,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,"U+007F":46,Home:36,End:35,PageUp:33,PageDown:34,Insert:45},Le=C||E&&F("525"),Me=Ta&&D;n=He.prototype;
+n.Je=function(a){E&&(17==this.ea&&!a.ctrlKey||18==this.ea&&!a.altKey||Ta&&91==this.ea&&!a.metaKey)&&(this.Pa=this.ea=-1);-1==this.ea&&(a.ctrlKey&&17!=a.keyCode?this.ea=17:a.altKey&&18!=a.keyCode?this.ea=18:a.metaKey&&91!=a.keyCode&&(this.ea=91));Le&&!Ee(a.keyCode,this.ea,a.shiftKey,a.ctrlKey,a.altKey)?this.handleEvent(a):(this.Pa=D?Ge(a.keyCode):a.keyCode,Me&&(this.cd=a.altKey))};n.Le=function(a){this.Pa=this.ea=-1;this.cd=a.altKey};
+n.handleEvent=function(a){var b=a.D,c,d,e=b.altKey;C&&"keypress"==a.type?(c=this.Pa,d=13!=c&&27!=c?b.keyCode:0):E&&"keypress"==a.type?(c=this.Pa,d=0<=b.charCode&&63232>b.charCode&&Fe(c)?b.charCode:0):B?(c=this.Pa,d=Fe(c)?b.keyCode:0):(c=b.keyCode||this.Pa,d=b.charCode||0,Me&&(e=this.cd),Ta&&(63==d&&224==c)&&(c=191));var g=c,h=b.keyIdentifier;c?63232<=c&&c in Je?g=Je[c]:25==c&&a.shiftKey&&(g=9):h&&h in Ke&&(g=Ke[h]);a=g==this.ea;this.ea=g;b=new Ne(g,d,a,b);b.altKey=e;this.dispatchEvent(b)};n.j=m("L");
+function Ie(a,b,c){a.Ec&&a.detach();a.L=b;a.Dc=J(a.L,"keypress",a,c);a.pd=J(a.L,"keydown",a.Je,c,a);a.Ec=J(a.L,"keyup",a.Le,c,a)}n.detach=function(){this.Dc&&(K(this.Dc),K(this.pd),K(this.Ec),this.Ec=this.pd=this.Dc=null);this.L=null;this.Pa=this.ea=-1};n.S=function(){He.H.S.call(this);this.detach()};function Ne(a,b,c,d){d&&this.init(d,void 0);this.type="key";this.keyCode=a;this.charCode=b;this.repeat=c}t(Ne,ec);function Oe(){}da(Oe);Oe.prototype.Ue=0;Oe.ec();function Pe(a){Ec.call(this);this.Zb=a||zb();this.Ta=Qe}t(Pe,Ec);Pe.prototype.Ne=Oe.ec();var Qe=null;function Re(a,b){switch(a){case 1:return b?"disable":"enable";case 2:return b?"highlight":"unhighlight";case 4:return b?"activate":"deactivate";case 8:return b?"select":"unselect";case 16:return b?"check":"uncheck";case 32:return b?"focus":"blur";case 64:return b?"open":"close"}throw Error("Invalid component state");}n=Pe.prototype;n.Cc=null;n.va=!1;n.L=null;n.Ta=null;n.Re=null;n.Qa=null;n.vc=null;
+n.ib=null;n.Ae=!1;function Se(a,b){if(a.Qa&&a.Qa.ib){var c=a.Qa.ib,d=a.Cc;d in c&&delete c[d];c=a.Qa.ib;if(b in c)throw Error('The object already contains the key "'+b+'"');c[b]=a}a.Cc=b}n.j=m("L");n.zc=function(){return this.xb||(this.xb=new Ac(this))};n.Fd=function(a){if(this.Qa&&this.Qa!=a)throw Error("Method not supported");Pe.H.Fd.call(this,a)};n.ae=m("Zb");
+n.Yb=function(a){if(this.va)throw Error("Component already rendered");if(a&&this.Xb(a)){this.Ae=!0;var b=H(a);this.Zb&&this.Zb.da==b||(this.Zb=zb(a));this.Wd(a);this.vb()}else throw Error("Invalid element to decorate");};n.Xb=aa(!0);n.Wd=function(a){this.L=a};n.vb=function(){this.va=!0;Te(this,function(a){!a.va&&a.j()&&a.vb()})};n.bc=function(){Te(this,function(a){a.va&&a.bc()});this.xb&&this.xb.Sa();this.va=!1};
+n.S=function(){this.va&&this.bc();this.xb&&(this.xb.ub(),delete this.xb);Te(this,function(a){a.ub()});!this.Ae&&this.L&&Jb(this.L);this.Qa=this.Re=this.L=this.ib=this.vc=null;Pe.H.S.call(this)};n.cc=m("L");n.Eb=function(a){if(this.va)throw Error("Component already rendered");this.Ta=a};function Te(a,b){a.vc&&y(a.vc,b,void 0)}
+n.removeChild=function(a,b){if(a){var c=q(a)?a:a.Cc||(a.Cc=":"+(a.Ne.Ue++).toString(36)),d;this.ib&&c?(d=this.ib,d=(c in d?d[c]:void 0)||null):d=null;a=d;if(c&&a){d=this.ib;c in d&&delete d[c];z(this.vc,a);b&&(a.bc(),a.L&&Jb(a.L));c=a;if(null==c)throw Error("Unable to set parent component");c.Qa=null;Pe.H.Fd.call(c,null)}}if(!a)throw Error("Child is not in parent component");return a};var Ue;function Ve(a,b,c){ha(c)&&(c=c.join(" "));var d="aria-"+b;""===c||void 0==c?(Ue||(Ue={atomic:!1,autocomplete:"none",dropeffect:"none",haspopup:!1,live:"off",multiline:!1,multiselectable:!1,orientation:"vertical",readonly:!1,relevant:"additions text",required:!1,sort:"none",busy:!1,disabled:!1,hidden:!1,invalid:"false"}),c=Ue,b in c?a.setAttribute(d,c[b]):a.removeAttribute(d)):a.setAttribute(d,c)};function We(){}var Xe;da(We);n=We.prototype;n.cc=function(a){return a};n.$b=function(a,b,c){if(a=a.j?a.j():a)if(C&&!F("7")){var d=Ye(pb(a),b);d.push(b);ra(c?qb:sb,a).apply(null,d)}else c?qb(a,b):sb(a,b)};n.Xb=aa(!0);
+n.Yb=function(a,b){b.id&&Se(a,b.id);var c=this.cc(b);c&&c.firstChild?Ze(a,c.firstChild.nextSibling?Ia(c.childNodes):c.firstChild):a.rb=null;var d=0,e=this.dc(),g=this.dc(),h=!1,k=!1,c=!1,l=pb(b);y(l,function(a){if(h||a!=e)if(k||a!=g){var b=d;if(!this.ye){this.wc||$e(this);var c=this.wc,l={},s;for(s in c)l[c[s]]=s;this.ye=l}a=parseInt(this.ye[a],10);d=b|(isNaN(a)?0:a)}else k=!0;else h=!0,g==e&&(k=!0)},this);a.N=d;h||(l.push(e),g==e&&(k=!0));k||l.push(g);var s=a.ta;s&&l.push.apply(l,s);if(C&&!F("7")){var w=
+Ye(l);0c;b.style.borderWidth="10px";a.Bd=b.scrollHeight>d;b.style.height="100px";100!=b.offsetHeight&&(a.Gc=!0);Jb(b);a.ie=!0}var b=a.j(),c=a.j().scrollHeight,e=a.j(),d=e.offsetHeight-e.clientHeight;if(!a.Cd)var g=a.kc,d=d-(g.top+g.bottom);
+a.Bd||(e=ed(e),d-=e.top+e.bottom);c+=0l?(wf(this,l),b.style.overflowY="",e=!0):h!=g?wf(this,g):this.Na||(this.Na=g);d||(e||!rf)||(a=!0)}else xf(this);this.Bb=!1;a&&(a=this.j(),this.Bb||(this.Bb=!0,(d=a.scrollHeight)?(e=vf(this),b=tf(this),g=uf(this),b&&e<=b||g&&e>=g||(g=this.kc,a.style.paddingBottom=g.bottom+1+"px",vf(this)==e&&(a.style.paddingBottom=
+g.bottom+d+"px",a.scrollTop=0,d=vf(this)-d,d>=b?wf(this,d):wf(this,b)),a.style.paddingBottom=g.bottom+"px")):xf(this),this.Bb=!1));c!=this.Na&&this.dispatchEvent("resize")}};n.Te=function(){var a=this.j(),b=a.offsetHeight;a.filters&&a.filters.length&&(a=a.filters.item("DXImageTransform.Microsoft.DropShadow"))&&(b-=a.offX);b!=this.Na&&(this.Na=this.oe=b)};C&&F(8);function yf(a){return a&&a.gd&&a.gd===ee?a.content:String(a).replace(zf,Af)}var Bf={"\x00":"\x26#0;",'"':"\x26quot;","\x26":"\x26amp;","'":"\x26#39;","\x3c":"\x26lt;","\x3e":"\x26gt;","\t":"\x26#9;","\n":"\x26#10;","\x0B":"\x26#11;","\f":"\x26#12;","\r":"\x26#13;"," ":"\x26#32;","-":"\x26#45;","/":"\x26#47;","\x3d":"\x26#61;","`":"\x26#96;","\u0085":"\x26#133;","\u00a0":"\x26#160;","\u2028":"\x26#8232;","\u2029":"\x26#8233;"};function Af(a){return Bf[a]}var zf=/[\x00\x22\x26\x27\x3c\x3e]/g;function Cf(){return'\x3cdiv class\x3d"annotorious-popup top-left" style\x3d"position:absolute;z-index:1"\x3e\x3cdiv class\x3d"annotorious-popup-buttons"\x3e\x3cdiv\x3e\x3ca role\x3d"button" class\x3d"annotorious-popup-button annotorious-popup-button-edit" title\x3d"Edit"\x3eEDIT\x3c/a\x3e\x3ca role\x3d"button" class\x3d"annotorious-popup-button annotorious-popup-button-delete" title\x3d"Delete"\x3eDELETE\x3c/a\x3e\x3c/div\x3e\x3cdiv\x3e\x3ca role\x3d"button" class\x3d"annotorious-popup-button annotorious-popup-button-move" title\x3d"Move"\x3eMOVE\x3c/a\x3e\x3ca role\x3d"button" class\x3d"annotorious-popup-button annotorious-popup-button-rotate" title\x3d"Rotate"\x3eROTATE\x3c/a\x3e\x3c/div\x3e\x3c/div\x3e\x3cspan class\x3d"annotorious-popup-text"\x3e\x3c/span\x3e\x3c/div\x3e'}
+function Df(){return'\x3cdiv class\x3d"annotorious-editor" style\x3d"position:absolute;z-index:1"\x3e\x3cform\x3e\x3ctextarea class\x3d"annotorious-editor-text" placeholder\x3d"Add a Comment..." tabindex\x3d"1"\x3e\x3c/textarea\x3e\x3cdiv class\x3d"annotorious-editor-button-container"\x3e\x3ca role\x3d"button" class\x3d"annotorious-editor-button annotorious-editor-button-cancel" tabindex\x3d"3"\x3eCancel\x3c/a\x3e\x3ca role\x3d"button" class\x3d"annotorious-editor-button annotorious-editor-button-save" tabindex\x3d"2"\x3eSave\x3c/a\x3e\x3c/div\x3e\x3c/form\x3e\x3c/div\x3e'}
+;function Ef(a){this.element=ge(Df);this.d=a;this.Be=a.getItem();this.ha=new qf("");this.Rc=I(".annotorious-editor-button-cancel",this.element)[0];this.oc=I(".annotorious-editor-button-save",this.element)[0];this.Jd=Mb(this.oc);this.Nb=[];this.gb=!1;this.c={ac:!0,Ad:!1,Wa:{placeholder:"Add a Comment...",className:"annotorious-editor-text"},buttons:{save:{text:"Save",className:"annotorious-editor-button annotorious-editor-button-save"},abort:{text:"Cancel",className:"annotorious-editor-button annotorious-editor-button-cancel"}},
+Ca:void 0};this.g=JSON.parse(JSON.stringify(this.c));var b=this;J(this.Rc,"click",function(c){c.preventDefault();a.stopSelection(b.Qb);b.close()});J(this.oc,"click",function(c){c.preventDefault();if(!b.gb||!b.r.options[0].disabled||0!=b.r.selectedIndex&&b.r.value){c=b.Qb?{text:b.Qb.text,textId:b.Qb.textId}:void 0;var d=b.$d();a.P(d);a.stopSelection();b.Qb?a.fireEvent("onAnnotationUpdated",d,c):a.fireEvent("onAnnotationCreated",d,a.getItem());b.close()}});O(this.element,!1);a.element.appendChild(this.element);
+this.ha.Yb(I(".annotorious-editor-text",this.element)[0]);rd(this.element,function(){var a=b.ha;a.j()&&a.yb()})}n=Ef.prototype;n.Wb=function(a){var b=Fb("div","annotorious-editor-field");q(a)?b.innerHTML=a:r(a)?this.Nb.push({Y:b,kd:a}):Lb(a)&&b.appendChild(a);Ib(b,this.Jd)};
+n.open=function(a){this.d.fireEvent("beforeEditorShown",a);this.nb=this.Qb=a;O(this.element,!0);this.gb?this.c.ac?(this.r.classList.remove("d-none"),a&&-1Kc(d.ba,"opacity")&&N(d.ba,0.9);d.clearHideTimer()}),J(this.element,"mouseout",function(){N(d.ba,0);d.startHideTimer()}),a.addHandler("onMouseOutOfItem",function(){d.startHideTimer()}));N(this.ba,0);N(this.element,0);L(this.element,"pointer-events","none");a.element.appendChild(this.element)}n=Jf.prototype;n.Wb=function(a){var b=Fb("div","annotorious-popup-field");q(a)?b.innerHTML=a:r(a)?this.Nb.push({Y:b,kd:a}):Lb(a)&&b.appendChild(a);this.element.appendChild(b)};
+n.startHideTimer=function(){this.Uc=!1;if(!this.Tb){var a=this;this.Tb=window.setTimeout(function(){a.d.fireEvent("beforePopupHide",a);a.Uc||(N(a.element,0),L(a.element,"pointer-events","none"),N(a.ba,0.9),delete a.Tb)},150)}};n.clearHideTimer=function(){this.Uc=!0;this.Tb&&(window.clearTimeout(this.Tb),delete this.Tb)};
+n.show=function(a,b){this.clearHideTimer();b&&this.setPosition(b);a&&this.setAnnotation(a);this.Tc&&window.clearTimeout(this.Tc);N(this.ba,0.9);if(Kf){var c=this;this.Tc=window.setTimeout(function(){N(c.ba,0)},1E3)}N(this.element,0.9);L(this.element,"pointer-events","auto");this.d.fireEvent("onPopupShown",this.h)};n.setPosition=function(a){Mc(this.element,new G(a.x,a.y))};
+n.setAnnotation=function(a){this.h=a;this.De.innerHTML=a.text?a.text.replace(/\n/g,"\x3cbr/\x3e"):'\x3cspan class\x3d"annotorious-popup-empty"\x3eNo comment\x3c/span\x3e';"editable"in a&&!1==a.editable?O(this.ba,!1):O(this.ba,!0);!this.c.se||a.shapes[0].type!=T||"movable"in a&&!1==a.movable?O(this.Ya,!1):O(this.Ya,!0);!this.c.te||a.shapes[0].type!=T||"rotable"in a&&!1==a.rotable?O(this.Za,!1):O(this.Za,!0);y(this.Nb,function(b){var c=b.kd(a);q(c)?b.Y.innerHTML=c:Lb(c)&&(Hb(b.Y),b.Y.appendChild(c))})};
+n.G=function(a){a instanceof Object&&0!==Object.keys(a).length?(a.hasOwnProperty("extraFields")&&(this.c.Ca=a.extraFields),a.hasOwnProperty("showMoveButton")&&(this.c.se=a.showMoveButton),a.hasOwnProperty("showRotateButton")&&(this.c.te=a.showRotateButton)):this.c=JSON.parse(JSON.stringify(this.g));(a=I(".annotorious-popup-field",this.element)[0])&&a.remove();if(this.c.Ca&&Array.isArray(this.c.Ca)){var b=this;y(this.c.Ca,function(a){b.Wb(a)})}};Jf.prototype.addField=Jf.prototype.Wb;function Lf(){}n=Lf.prototype;n.P=function(a,b){this.k.P(a,b)};n.fc=function(a,b){var c=this,d="pixel"==a.shapes[0].units?U(a.shapes[0],function(a){return Mf(c,a)}):U(a.shapes[0],function(a){return c.La(a)}),d=Rd(d);return this.ia(d.x,d.y).filter(function(c){return V(c.shapes[0])!=V(a.shapes[0])&&(!b||c.shapes[0].type==b)})};n.addHandler=function(a,b){this.O.addHandler(a,b)};n.ya=function(a){this.O.ya(a)};n.fireEvent=function(a,b,c){return this.O.fireEvent(a,b,c)};n.Ma=m("Q");n.J=function(a){this.k.J(a)};
+n.T=function(a){this.k.T(a)};n.ya=function(a,b){this.O.ya(a,b)};n.stopSelection=function(a){Kf&&O(this.f,!1);this.Vb&&(this.Vb(),delete this.Vb);this.Q.stopSelection();a&&this.k.P(a)};
+function Nf(a,b){J(b,Of,function(c){c=Pf(c,b);a.k.J(!1);var d=void 0;if(a.Ub){if(a.Ld){d=a.k.ia(c.x,c.y);if(!d.length)return;d=d.filter(function(a){return a.shapes[0].type==T});if(!d.length)return}O(a.f,!0);a.Q.startSelection(c.x,c.y,d?a.k.C[V(d[0].shapes[0])]:void 0)}else d=a.k.ia(c.x,c.y),0this.V.x?(a=this.W.x,b=this.V.x):(a=this.V.x,b=this.W.x);var c,d;this.W.y>this.V.y?(c=this.V.y,d=this.W.y):(c=this.W.y,d=this.V.y);return{top:c,right:a,bottom:d,left:b}};
+n.drawShape=function(a,b,c){var d=b.geometry,e,g,h,k,l;b.style||(b.style={});if(b.type==T){c?(g=b.style.hiFill||this.c.hiFill,e=b.style.hiStroke||this.c.hiStroke,h=b.style.hiOutline||this.c.hiOutline,k=b.style.hiOutlineWidth||this.c.hiOutlineWidth,l=b.style.hiStrokeWidth||this.c.hiStrokeWidth):(g=b.style.fill||this.c.fill,e=b.style.stroke||this.c.stroke,h=b.style.outline||this.c.outline,k=b.style.outlineWidth||this.c.outlineWidth,l=b.style.strokeWidth||this.c.strokeWidth);var s=Object.assign({},d);
+void 0!=d.rotation&&(!b.mask||b.mask&&b.hasOwnProperty("_loadedMask"))&&(a.save(),a.beginPath(),a.translate(d.x+d.width/2,d.y+d.height/2),a.rotate(d.rotation*Math.PI/180));if(b.mask){if(!b.hasOwnProperty("_loadedMask")||b._loadedMask.url!=b.mask){Object.defineProperty(b,"_loadedMask",{enumerable:!1,writable:!0});var w=this;b._loadedMask={gc:new Image,url:b.mask};b._loadedMask.gc.onload=function(){w.drawShape(a,b,c)};b._loadedMask.gc.src=b.mask}if(b._loadedMask.gc){a.globalAlpha=b.style.maskTransparency||
+this.c.maskTransparency;void 0!=d.rotation?a.drawImage(b._loadedMask.gc,-(d.width/2),-(d.height/2),d.width,d.height):a.drawImage(b._loadedMask.gc,d.x,d.y,d.width,d.height);a.globalAlpha=1;if(void 0!=b.style.maskBorder&&!b.style.maskBorder||void 0==b.style.maskBorder&&!this.c.maskBorder)return;d=void 0!=d.rotation?{x:d.width/2+l+k,y:d.height/2+l+k,width:d.width+l+k,height:d.height+l+k,rotation:d.rotation}:{x:d.x-l-k,y:d.y-l-k,width:d.width+l+k,height:d.height+l+k,rotation:d.rotation}}}void 0!=d.rotation&&
+(!b.mask||b.mask&&b.hasOwnProperty("_loadedMask"))&&(s=Object.assign({},d),d.x*=-1,d.y*=-1);a.lineJoin="round";a.lineWidth=k;a.strokeStyle=h;a.strokeRect(d.x+k/2,d.y+k/2,d.width-k,d.height-k);a.lineJoin="miter";a.lineWidth=l;a.strokeStyle=e;a.strokeRect(d.x+k+l/2,d.y+k+l/2,d.width-2*k-l,d.height-2*k-l);g&&(a.lineJoin="miter",a.lineWidth=l,a.fillStyle=g,a.fillRect(d.x+k+l/2,d.y+k+l/2,d.width-2*k-l,d.height-2*k-l));void 0!=d.rotation&&(a.restore(),d.x=s.x,d.y=s.y)}else"point"==b.type&&(g=b.style.fill||
+this.c.fill,l=b.style.strokeWidth||this.c.strokeWidth,a.beginPath(),a.fillStyle=g,a.arc(d.x,d.y,l,0,l*Math.PI,!1),a.fill())};function Wf(a,b,c,d,e){if(c.type==T)return d=new S(d,e),e=c.geometry,e.x=d.x-e.width/2,e.y=d.y-e.height/2,a.drawShape(b,c),c}function Xf(a,b,c,d,e){if(c.type==T){d=new S(d,e);e=c.geometry;var g=new S(e.x+e.width/2,e.y+e.height/2);e.rotation=180*Math.atan2(d.y-g.y,d.x-g.x)/Math.PI;a.drawShape(b,c);return c}};function Td(a,b){this.arrowTail=a;this.arrowHead=b}function Od(a){var b,c;a.arrowHead.x>a.arrowTail.x?(b=a.arrowHead.x,c=a.arrowTail.x):(b=a.arrowTail.x,c=a.arrowHead.x);var d;a.arrowHead.y>a.arrowTail.y?(d=a.arrowTail.y,a=a.arrowHead.y):(d=a.arrowHead.y,a=a.arrowTail.y);return new Ld(c,d,b-c,a+5-d)};function dg(){}n=dg.prototype;n.init=function(a,b){this.n=b;this.d=a;this.o=b.getContext("2d");this.ab=!1;this.c={arrowStroke:"#ffffff",arrowStrokeWidth:2,hiArrowStroke:"#fff000",hiArrowStrokeWidth:2.2,highlightTail:void 0,hiTailRadius:5,highlightHead:void 0,hiHeadRadius:5};this.g=Object.assign({},this.c)};
+n.Hb=function(a,b){var c=this,d=this.n;this.cb=J(this.n,Rf,function(a){var g=Pf(a,d);!c.ab||b&&!Nd(b,g.x,g.y)||(c.ga=new S(g.x,g.y),c.o.clearRect(0,0,d.width,d.height),g=Sf(c.d,g),c.d.fireEvent("onMouseMoveOverItem",{cursor:g},a),c.drawShape(c.o,{type:"arrow",geometry:new Td(c.pa,c.ga),style:{}}))});this.eb=J(d,Yf,function(a){var b=Pf(a,d),h=c.getShape();a=a.D?a.D:a;c.ab=!1;h?(c.$a(),c.d.fireEvent("onSelectionCompleted",{mouseEvent:a,shape:h,viewportBounds:c.getViewportBounds()})):(c.d.fireEvent("onSelectionCanceled"),
+a=c.d.ia(b.x,b.y),0this.pa.x?(a=this.ga.x,b=this.pa.x):(a=this.pa.x,b=this.ga.x);var c,d;this.ga.y>this.pa.y?(c=this.pa.y,d=this.ga.y):(c=this.ga.y,d=this.pa.y);return{top:c,right:a,bottom:d+5,left:b}};
+n.drawShape=function(a,b,c){b.style||(b.style={});if("arrow"==b.type){var d=b.geometry;c?(a.strokeStyle=a.fillStyle=b.style.hiArrowStroke||this.c.hiArrowStroke,a.lineWidth=b.style.hiArrowStrokeWidth||this.c.hiArrowStrokeWidth):(a.strokeStyle=a.fillStyle=b.style.arrowStroke||this.c.arrowStroke,a.lineWidth=b.style.arrowStrokeWidth||this.c.arrowStrokeWidth);c=Math.PI/5;var e=3*a.lineWidth,g=Math.sqrt((d.arrowHead.x-d.arrowTail.x)*(d.arrowHead.x-d.arrowTail.x)+(d.arrowHead.y-d.arrowTail.y)*(d.arrowHead.y-
+d.arrowTail.y)),h=(g-e/3)/g,g=Math.round(d.arrowTail.x+(d.arrowHead.x-d.arrowTail.x)*h),h=Math.round(d.arrowTail.y+(d.arrowHead.y-d.arrowTail.y)*h);a.beginPath();a.moveTo(d.arrowTail.x,d.arrowTail.y);a.lineTo(g,h);a.stroke();var k=Math.atan2(d.arrowHead.y-d.arrowTail.y,d.arrowHead.x-d.arrowTail.x),g=Math.abs(e/Math.cos(c)),h=k+Math.PI+c,e=d.arrowHead.x+Math.cos(h)*g,h=d.arrowHead.y+Math.sin(h)*g,k=k+Math.PI-c;c=d.arrowHead.x+Math.cos(k)*g;g=d.arrowHead.y+Math.sin(k)*g;a.save();a.beginPath();a.moveTo(e,
+h);a.lineTo(d.arrowHead.x,d.arrowHead.y);a.lineTo(c,g);a.beginPath();a.moveTo(e,h);a.lineTo(d.arrowHead.x,d.arrowHead.y);a.lineTo(c,g);a.lineTo(e,h);a.fill();if(b.style.highlightTail||this.c.highlightTail)a.beginPath(),a.arc(d.arrowTail.x,d.arrowTail.y,b.style.hiTailRadius||this.c.hiTailRadius,0,2*Math.PI,!1),a.fillStyle=b.style.highlightTail||this.c.highlightTail,a.fill();if(b.style.highlightHead||this.c.highlightHead)a.beginPath(),a.arc(d.arrowHead.x,d.arrowHead.y,b.style.hiHeadRadius||this.c.hiHeadRadius,
+0,2*Math.PI,!1),a.fillStyle=b.style.highlightHead||this.c.highlightHead,a.fill();a.restore()}};function eg(a){return'\x3ccanvas class\x3d"annotorious-item annotorious-opacity-fade" style\x3d"position:absolute; top:0px; left:0px; width:'+yf(a.width)+"px; height:"+yf(a.height)+'px; z-index:0" width\x3d"'+yf(a.width)+'" height\x3d"'+yf(a.height)+'"\x3e\x3c/canvas\x3e'}
+function Hf(a){return'\x3cdiv class\x3d"annotorious-hint" style\x3d"white-space:nowrap; position:absolute; top:0px; left:0px; pointer-events:none;"\x3e\x3cdiv class\x3d"annotorious-hint-msg annotorious-opacity-fade"\x3e'+yf(a.Fc)+'\x3c/div\x3e\x3cdiv class\x3d"annotorious-hint-icon" style\x3d"pointer-events:auto"\x3e\x3c/div\x3e\x3c/div\x3e'};function fg(a,b){this.F=a;this.Rd={padding:a.style.padding,margin:a.style.margin};this.Kd=void 0;this.Lc="fraction";this.O=new td;this.Ja=[];this.Ub=!0;this.Ld=!1;this.I={enabled:!1,hd:!1,color:"#ffffff",strokeWidth:2};this.Lb=Object.assign({},this.I);this.element=Fb("div","annotorious-annotationlayer");L(this.element,"position","relative");L(this.element,"display","inline-block");gg(a,this.element);Kb(this.element,a);this.element.appendChild(a);var c=Xc(a);this.Vc=ge(eg,{width:c.width,height:c.height});
+this.element.appendChild(this.Vc);this.za=ge(eg,{width:c.width,height:c.height});Kf&&qb(this.za,"annotorious-item-unfocus");this.element.appendChild(this.za);this.f=ge(eg,{width:c.width,height:c.height});Kf&&O(this.f,!1);this.element.appendChild(this.f);this.popup=b?b:new Jf(this);c=new bg;this.tc(c);this.tc(new dg);this.Q=c;this.editor=new Ef(this);this.k=new Qf(this.za,this);this.Pb=new Gf(this,this.element);var d=this;Kf&&(J(this.element,$f,function(a){a=a.relatedTarget;a&&Nb(d.element,a)||(d.O.fireEvent("onMouseOverItem"),
+ub(d.za,"annotorious-item-unfocus","annotorious-item-focus"))}),J(this.element,ag,function(a){a=a.relatedTarget;a&&Nb(d.element,a)||(d.O.fireEvent("onMouseOutOfItem"),ub(d.za,"annotorious-item-focus","annotorious-item-unfocus"))}));Nf(this,Zf?this.f:this.za);this.O.addHandler("onSelectionCompleted",function(a){var b=a.viewportBounds;d.editor.setPosition(new S(b.left+d.F.offsetLeft,b.bottom+4+d.F.offsetTop));d.editor.open(!1,a)});this.O.addHandler("onSelectionCanceled",function(){Kf&&O(d.f,!1);d.Q.stopSelection()})}
+t(fg,Lf);function gg(a,b){function c(c,d){L(b,"margin-"+c,d+"px");L(a,"margin-"+c,0);L(a,"padding-"+c,0)}var d=bd(a,"margin"),e=bd(a,"padding");0==d.top&&0==e.top||c("top",d.top+e.top);0==d.right&&0==e.right||c("right",d.right+e.right);0==d.bottom&&0==e.bottom||c("bottom",d.bottom+e.bottom);0==d.left&&0==e.left||c("left",d.left+e.left)}n=fg.prototype;n.Aa=f();n.tc=function(a){a.init(this,this.f);this.Ja.push(a)};
+n.destroy=function(){var a=this.F;a.style.margin=this.Rd.margin;a.style.padding=this.Rd.padding;Kb(a,this.element)};
+n.jd=function(a){this.k.T(a);var b=Ga(this.Ja,function(b){b=b.getSupportedShapeType();return Array.isArray(b)?-1!=Ca(b,a.shapes[0].type):b==a.shapes[0].type}),c=a.shapes[0],d=this,c="pixel"==c.units?U(c,function(a){return Mf(d,a)}):U(c,function(a){return d.La(a)});if(b){O(this.f,!0);this.k.J(!1);var e=this.f.getContext("2d");b.drawShape(e,c)}b=Qd(c).geometry;b=new S(b.x,b.y+b.height);this.editor.setPosition(new S(b.x+this.F.offsetLeft,b.y+4+this.F.offsetTop));this.editor.open(a)};n.ud=function(a){this.k.ud(a)};
+n.zd=function(a){this.k.zd(a)};n.Ma=m("Q");n.M=function(){return this.k.M()};n.ia=function(a,b){return Ia(this.k.ia(a,b))};n.Da=m("Ja");n.getItem=function(){return{src:hg(this.F),element:this.F}};function hg(a){var b=a.getAttribute("data-original");return b?b:a.src}n.Ea=function(){O(this.za,!1)};n.Z=function(){this.Ub=!1;this.Pb&&(this.Pb.destroy(),delete this.Pb)};
+n.Oc=function(a){this.Q=Ga(this.Ja,function(b){return b.getName()==a});return this.Q?!0:(console.log('WARNING: selector "'+a+'" not available'),!1)};
+n.G=function(a){a.hasOwnProperty("displayMessage")&&(this.Kd=a.displayMessage,this.Ub&&(this.Z(),this.fa()));a.hasOwnProperty("outputUnits")&&(this.Lc="pixel"==a.outputUnits?"pixel":"fraction");a.hasOwnProperty("drawInsideRectAnno")&&(this.Ld=a.drawInsideRectAnno);a.hasOwnProperty("colorMode")&&this.k.Dd(a.colorMode);a.hasOwnProperty("selectEditor")&&Ff(this.editor,a.selectEditor);a.hasOwnProperty("cursorAxes")&&ig(this,a.cursorAxes);a.hasOwnProperty("arrowMode")&&(a.arrowMode?this.Oc("arrow_drag"):
+this.Oc("rect_drag"));a.hasOwnProperty("editor")&&this.editor.G(a.editor);a.hasOwnProperty("popup")&&this.popup.G(a.popup);a.hasOwnProperty("fancyBox")&&cg(Ga(this.Ja,function(a){return"rect_drag"==a.getName()}),a.fancyBox);a.hasOwnProperty("shapeStyle")&&(y(this.Ja,function(b){b.G(a.shapeStyle)}),Uf(this.k))};n.Va=function(){O(this.za,!0)};n.fa=function(){this.Ub=!0;this.Pb||(this.Pb=new Gf(this,this.element,this.Kd))};n.stopSelection=function(a){Kf&&O(this.f,!1);this.Q.stopSelection();a&&this.k.P(a)};
+n.La=function(a){var b=Vc(this.F),c={x:a.x*b.width,y:a.y*b.height};a.width&&(c.width=a.width*b.width,c.height=a.height*b.height);return c};function Mf(a,b){var c=Vc(a.F),d={x:parseInt(b.x/a.F.naturalWidth*c.width),y:parseInt(b.y/a.F.naturalHeight*c.height)};b.width&&(d.width=parseInt(b.width/a.F.naturalWidth*c.width),d.height=parseInt(b.height/a.F.naturalHeight*c.height));return d}
+n.Ha=function(a){var b=Vc(this.F),c={x:a.x/b.width,y:a.y/b.height};a.width&&(c.width=a.width/b.width,c.height=a.height/b.height);return c};function Sf(a,b){var c=Vc(a.F),d={x:parseInt(b.x*a.F.naturalWidth/c.width),y:parseInt(b.y*a.F.naturalHeight/c.height)};b.width&&(d.width=parseInt(b.width*a.F.naturalWidth/c.width),d.height=parseInt(b.height*a.F.naturalHeight/c.height));return d}
+function ig(a,b){b instanceof Object&&0!==Object.keys(b).length?(b.hasOwnProperty("enabled")&&(a.I.enabled=b.enabled||a.Lb.enabled),b.hasOwnProperty("dash")&&(a.I.hd=b.dash||a.Lb.hd),b.hasOwnProperty("color")&&(a.I.color=b.color||a.Lb.color),b.hasOwnProperty("strokeWidth")&&(a.I.strokeWidth=b.strokeWidth||a.Lb.strokeWidth)):a.I=Object.assign({R:a.I.R},a.Lb);if(a.I.enabled){if(!a.I.R){var c=a.Vc.getContext("2d"),d=function(b){b=Pf(b,a.ff);c.clearRect(0,0,c.canvas.width,c.canvas.height);a.I.hd?c.setLineDash([5,
+3]):(c.setLineDash([]),c.lineCap="square");c.strokeStyle=a.I.color;c.lineWidth=a.I.strokeWidth;c.beginPath();c.moveTo(0,b.y);c.lineTo(c.canvas.width,b.y);c.moveTo(b.x,0);c.lineTo(b.x,c.canvas.height);c.stroke()};a.I.R=[];a.I.R[0]=J(a.za,Rf,d);a.I.R[1]=J(a.f,Rf,d)}}else a.I.R&&(y(a.I.R,function(a){K(a)}),c=a.Vc.getContext("2d"),c.clearRect(0,0,c.canvas.width,c.canvas.height),delete a.I.R)}fg.prototype.addSelector=fg.prototype.tc;fg.prototype.fireEvent=fg.prototype.fireEvent;
+fg.prototype.setCurrentSelector=fg.prototype.Oc;fg.prototype.toItemCoordinates=fg.prototype.Ha;function jg(){Wd(this,function(){return I("img.annotatable",document)})}t(jg,Vd);jg.prototype.Ac=function(a){return hg(a)};jg.prototype.vd=function(a){return new fg(a)};jg.prototype.Pc=function(a){return Lb(a)?"IMG"==a.tagName:!1};function kg(a){return'\x3cdiv class\x3d"annotorious-opacity-fade" style\x3d"white-space:nowrap; position:absolute; pointer-events:none; top:80px; width:100%; text-align:center;"\x3e\x3cdiv class\x3d"annotorious-ol-hint" style\x3d"width: 400px; margin:0px auto;"\x3e'+yf(a.Fc)+"\x3c/div\x3e\x3c/div\x3e"};function lg(a,b){this.qa=a;this.d=b;this.ma=Xc(b.element);this.v=b.popup;L(this.v.element,"z-index",99E3);this.K=[];this.C=[];this.nc=new OpenLayers.Layer.Boxes("Annotorious");this.qa.addLayer(this.nc);var c=this;this.qa.events.register("move",this.qa,function(){c.B&&c.Rb()});b.addHandler("beforePopupHide",function(){c.bb==c.B?c.v.clearHideTimer():c.fb(c.bb,c.B)})}n=lg.prototype;n.destroy=function(){this.nc.destroy()};
+n.Rb=function(){var a=this.B.ic.div,b=Xc(a),c=Rc(a,this.qa.div),a=c.y,c=c.x,d=b.width,e=b.height,b=Xc(this.v.element),a={y:a+e+5};c+b.width>this.ma.width?(ub(this.v.element,"top-left","top-right"),a.x=c+d-b.width):(ub(this.v.element,"top-right","top-left"),a.x=c);0>a.x&&(a.x=0);a.x+b.width>this.ma.width&&(a.x=this.ma.width-b.width);a.y+b.height>this.ma.height&&(a.y=this.ma.height-b.height);this.v.setPosition(a)};n.ad=function(a){this.v.setAnnotation(a);this.Rb();this.v.show()};
+n.fb=function(a,b){a?(Rc(a.ic.div,this.qa.div),Kc(a.ic.div,"height"),L(a.hc,"border-color","#fff000"),this.B=a,this.ad(a.m)):delete this.B;b&&L(b.hc,"border-color","#fff")};
+n.P=function(a){var b=a.shapes[0].geometry,b=new OpenLayers.Marker.Box(new OpenLayers.Bounds(b.x,b.y,b.x+b.width,b.y+b.height));qb(b.div,"annotorious-ol-boxmarker-outer");L(b.div,"border",null);var c=Fb("div","annotorious-ol-boxmarker-inner");Uc(c,"100%","100%");b.div.appendChild(c);var d={m:a,ic:b,hc:c},e=this;J(c,"mouseover",function(){e.B||e.fb(d);e.bb=d});J(c,"mouseout",function(){delete e.bb;e.v.startHideTimer()});this.K.push(d);c=a.shapes[0];"pixel"!=c.units&&(c=U(c,function(a){return e.d.La(a)}));
+this.C[V(a.shapes[0])]=c;La(this.K,function(a,b){return Pd(b.m.shapes[0])-Pd(a.m.shapes[0])});var g=1E4;y(this.K,function(a){L(a.ic.div,"z-index",g);g++});this.nc.addMarker(b)};n.T=function(a){var b=Ga(this.K,function(b){return b.m==a});b&&(z(this.K,b),this.nc.removeMarker(b.ic))};n.M=function(){return Ea(this.K,function(a){return a.m})};n.J=function(a){a||this.v.startHideTimer()};n.Gd=function(a,b){var c=this.ia(a,b);if(0this.ma.width&&(ub(this.v.element,"top-left","top-right"),a.x=b+d-c.width),0>a.x&&(a.x=0),a.x+c.width>this.ma.width&&(a.x=this.ma.width-c.width),a.y+c.height>this.ma.height&&(a.y=this.ma.height-c.height));this.v.setPosition(a)};n.ad=function(a){this.v.setAnnotation(a);this.Rb();this.v.show()};
+n.fb=function(a,b){a?(L(a.hc,"border-color","#fff000"),this.B=a,this.ad(a.m)):delete this.B;b&&L(b.hc,"border-color","#fff")};
+n.P=function(a){var b=a.shapes[0].geometry,c=Fb("div","annotorious-ol-boxmarker-outer"),d=Fb("div","annotorious-ol-boxmarker-inner");Uc(d,"100%","100%");c.appendChild(d);var b=new OpenSeadragon.Rect(b.x,b.y,b.width,b.height),e={m:a,Kc:c,hc:d},g=this;J(d,"mouseover",function(){g.B||g.fb(e);g.bb=e});J(d,"mouseout",function(){delete g.bb;g.v.startHideTimer()});this.K.push(e);La(this.K,function(a,b){return Pd(b.m.shapes[0])-Pd(a.m.shapes[0])});var h=1;y(this.K,function(a){L(a.Kc,"z-index",h);h++});this.na.addOverlay(c,
+b)};n.T=function(a){var b=Ga(this.K,function(b){return b.m==a});b&&(z(this.K,b),this.na.removeOverlay(b.Kc))};n.M=function(){return Ea(this.K,function(a){console.log(a);return a.m})};n.J=function(a){var b=this;a?y(this.K,function(c){c.m==a&&(b.B&&b.B!=c?b.fb(c,b.B):b.fb(c))}):this.v.startHideTimer()};n.destroy=function(){var a=this;y(this.K,function(b){a.na.removeOverlay(b.Kc)});this.K=[]};function pg(a){this.element=a.element;L(Bb(),"z-index",0);this.na=a;this.O=new td;this.Ja=[];this.Ub=!0;this.oa=ge(kg,{Fc:"Click and Drag"});N(this.oa,0);this.element.appendChild(this.oa);this.popup=new Jf(this);this.k=new og(a,this);this.f=ge(eg,{width:"0",height:"0"});O(this.f,!1);this.element.appendChild(this.f);var b=this;(function(){var a=parseInt(M(b.element,"width"),10),d=parseInt(M(b.element,"height"),10);Uc(b.f,a,d);b.f.width=a;b.f.height=d})();a=new bg;a.init(this,this.f);this.Ja.push(a);
+this.Q=a;this.editor=new Ef(this);Nf(this,this.f);this.O.addHandler("onSelectionCompleted",function(a){a=a.viewportBounds;b.editor.setPosition(new S(a.left,a.bottom+4));b.editor.open()});this.O.addHandler("onSelectionCanceled",function(){b.stopSelection()})}t(pg,Lf);n=pg.prototype;n.fa=f();n.Z=f();n.destroy=function(){this.k.destroy();delete this.k};n.Aa=function(a){L(this.f,"pointer-events","auto");var b=this;O(this.f,!0);N(this.oa,0.8);window.setTimeout(function(){N(b.oa,0)},2E3);a&&(this.Vb=a)};
+n.jd=function(a){this.k.T(a);var b=this.Q,c=this;if(b){O(this.f,!0);this.k.J(void 0);var d=this.f.getContext("2d"),e=U(a.shapes[0],function(a){return c.La(a)});b.drawShape(d,e);b=Qd(e).geometry;this.editor.setPosition(new S(b.x,b.y+b.height+4));this.editor.open(a)}};
+n.La=function(a){var b=pd(this.element);b.top+=window.pageYOffset;b.left+=window.pageXOffset;var c=new OpenSeadragon.Point(a.x,a.y);a=a.width?new OpenSeadragon.Point(a.x+a.width,a.y+a.height):!1;c=this.na.viewport.viewportToWindowCoordinates(c);return a?(a=this.na.viewport.viewportToWindowCoordinates(a),{x:c.x-b.left,y:c.y-b.top,width:a.x-c.x+2,height:a.y-c.y+2}):c};n.M=function(){return this.k.M()};n.Da=f();n.getItem=function(){return{src:"dzi://openseadragon/something"}};n.lc=f();n.Ma=m("Q");
+n.Ha=function(a){var b=pd(this.element);b.top+=window.pageYOffset;b.left+=window.pageXOffset;var c=new OpenSeadragon.Point(a.x+b.left,a.y+b.top);a=a.width?new OpenSeadragon.Point(a.x+b.left+a.width-2,a.y+b.top+a.height-2):!1;c=this.na.viewport.windowToViewportCoordinates(c);return a?(a=this.na.viewport.windowToViewportCoordinates(a),{x:c.x,y:c.y,width:a.x-c.x,height:a.y-c.y}):c};function qg(){Wd(this)}t(qg,Vd);qg.prototype.Ac=aa("dzi://openseadragon/something");qg.prototype.vd=function(a){return new pg(a)};qg.prototype.Pc=function(a){return a instanceof OpenSeadragon.ef};function Y(){this.Nd=!1;this.t=[new jg];window.OpenLayers&&this.t.push(new ng);window.OpenSeadragon&&this.t.push(new qg);this.Sb=[];var a=this;qd(function(){rg(a)})}function rg(a){a.Nd||(y(a.t,function(a){a.init()}),y(a.Sb,function(b){b.initPlugin&&b.initPlugin(a);y(a.t,function(a){a.sc(b)})}),J(window,"resize",function(){a.reload()}),a.Nd=!0)}function Z(a,b){return Ga(a.t,function(a){return be(a,b)})}n=Y.prototype;
+n.Aa=function(a,b){var c=void 0,d=void 0;q(a)?(c=a,d=b):r(a)&&(d=a);if(c){var e=Z(this,c);e&&e.Aa(c,d)}else y(this.t,function(a){a.Aa(d)})};
+n.P=function(a,b){if(a.src)if(a.shapes){var c=new Ud(sd(a.src),a.text,a.shapes[0],a.created_at,a.textId,a.id);c.editable=a.editable;c.movable=a.movable;c.rotable=a.rotable;var d=Z(this,c.src);d&&d.P(c,b)}else console.error("Error: The shapes attribute is required and must necessarily include the type and geometry field. See the documentation for more details.",a);else console.error("Error: The src attribute is required for identification the image associated to annotation. See the documentation for more details.",
+a)};n.Fe=function(a){if(Array.isArray(a)&&a.length){var b=this;a.forEach(function(a){b.P(a)})}};n.addHandler=function(a,b){y(this.t,function(c){c.addHandler(a,b)})};n.ya=function(a,b){y(this.t,function(c){c.ya(a,b)})};n.sc=function(a,b){try{var c=new window.annotorious.plugin[a](b);"complete"==document.readyState?(c.initPlugin&&c.initPlugin(this),y(this.t,function(a){a.sc(c)})):this.Sb.push(c)}catch(d){console.log("Could not load plugin: "+a)}};
+n.destroy=function(a){if(a){var b=Z(this,a);b&&b.destroy(a)}else y(this.t,function(a){a.destroy()})};n.Ma=function(a){var b=Z(this,a);if(b)return b.Ma(a)};n.M=function(a){if(a){var b=Z(this,a);return b?b.M(a):[]}var c=[];y(this.t,function(a){Ja(c,a.M())});return c};n.Da=function(a){var b=Z(this,a);return b?b.Da(a):[]};n.Ea=function(a){if(a){var b=Z(this,a);b&&b.Ea(a)}else y(this.t,function(a){a.Ea()})};n.Z=function(a){if(a){var b=Z(this,a);b&&b.Z(a)}else y(this.t,function(a){a.Z()})};
+n.stopSelection=function(a){if(a){var b=Z(this,a);b&&b.stopSelection(a)}else y(this.t,function(a){a.stopSelection()})};n.J=function(a){if(a){var b=Z(this,a.src);b&&b.J(a)}else y(this.t,function(a){a.J()})};n.rd=function(a){rg(this);var b=Ga(this.t,function(b){return b.Pc(a)});if(b)b.rd(a);else throw"Error: Annotorious does not support this media type in the current version or build configuration.";};n.Sa=function(a){var b=this;y(this.M(a),function(a){b.T(a)})};
+n.T=function(a){var b=Z(this,a.src);b&&b.T(a)};n.reload=function(a){y(this.t,function(b){var c=b.M();a&&de(b);b.destroy();b.init();y(c,function(a){b.P(a)})})};n.reset=function(){y(this.t,function(a){de(a);a.destroy();a.init()})};n.lc=function(a,b){var c=Z(this,a);c&&c.lc(a,b)};n.G=function(a){y(this.t,function(b){b.G(a)})};n.Dd=function(a,b,c,d,e){this.G({colorMode:{enabled:a,insideAnno:b,mode:c,color:d,strokeWidth:e}})};
+n.df=function(a,b,c,d){this.G({selectEditor:{enabled:a,options:b,emptyOption:c,customLabel:d}})};n.af=function(a,b,c,d){this.G({cursorAxes:{enabled:a,dash:b,color:c,strokeWidth:d}})};n.Ze=function(a){this.G({arrowMode:a})};n.cf=function(a){this.G({fancyBox:a})};n.fc=function(a,b){var c=Z(this,sd(a.src));return c?c.fc(a,b):[]};n.$e=function(a){a?this.fa(void 0):this.Z(void 0)};n.Va=function(a){if(a){var b=Z(this,a);b&&b.Va(a)}else y(this.t,function(a){a.Va()})};
+n.fa=function(a){if(a){var b=Z(this,a);b&&b.fa(a)}else y(this.t,function(a){a.fa()})};window.anno=new Y;Y.prototype.activateSelector=Y.prototype.Aa;Y.prototype.addAnnotation=Y.prototype.P;Y.prototype.addHandler=Y.prototype.addHandler;Y.prototype.addPlugin=Y.prototype.sc;Y.prototype.destroy=Y.prototype.destroy;Y.prototype.getActiveSelector=Y.prototype.Ma;Y.prototype.getAnnotations=Y.prototype.M;Y.prototype.getAvailableSelectors=Y.prototype.Da;Y.prototype.hideAnnotations=Y.prototype.Ea;Y.prototype.hideSelectionWidget=Y.prototype.Z;Y.prototype.highlightAnnotation=Y.prototype.J;
+Y.prototype.makeAnnotatable=Y.prototype.rd;Y.prototype.removeAll=Y.prototype.Sa;Y.prototype.removeAnnotation=Y.prototype.T;Y.prototype.reset=Y.prototype.reset;Y.prototype.setActiveSelector=Y.prototype.lc;Y.prototype.setProperties=Y.prototype.G;Y.prototype.showAnnotations=Y.prototype.Va;Y.prototype.showSelectionWidget=Y.prototype.fa;window.annotorious||(window.annotorious={});window.annotorious.plugin||(window.annotorious.plugin={});
+window.annotorious.geometry||(window.annotorious.geometry={},window.annotorious.geometry.expand=Sd,window.annotorious.geometry.getBoundingRect=Qd);Y.prototype.setSelectionEnabled=Y.prototype.$e;Y.prototype.reload=Y.prototype.reload;Y.prototype.addAnnotations=Y.prototype.Fe;Y.prototype.setColorMode=Y.prototype.Dd;Y.prototype.useSelectEditor=Y.prototype.df;Y.prototype.showCursorAxes=Y.prototype.af;Y.prototype.setArrowMode=Y.prototype.Ze;Y.prototype.useFancyBox=Y.prototype.cf;
+Y.prototype.getIntersectedAnnotations=Y.prototype.fc;
diff --git a/css/annotorious.css b/css/annotorious.css
index d4eba46..46fd310 100644
--- a/css/annotorious.css
+++ b/css/annotorious.css
@@ -92,7 +92,7 @@
.annotorious-popup-buttons {
float:right;
margin:0px 0px 1px 10px;
- height:16px;
+ height:auto;
-moz-transition-property: opacity;
-moz-transition-duration: 1s;
@@ -132,13 +132,30 @@
}
.annotorious-popup-button:hover {
- background-color:transparent;
+ background-color:transparent;
+ cursor: pointer;
}
.annotorious-popup-button-active {
opacity:0.9;
}
+.annotorious-popup-button-move {
+ background:url(move.png);
+ width:16px;
+ height:16px;
+ text-indent:100px;
+ overflow:hidden;
+}
+
+.annotorious-popup-button-rotate {
+ background:url(rotate.png);
+ width:16px;
+ height:16px;
+ text-indent:100px;
+ overflow:hidden;
+}
+
.annotorious-popup-button-edit {
background:url(pencil.png);
width:16px;
@@ -187,10 +204,8 @@
line-height: normal;
background-color:#fff;
width:240px;
- height:50px;
+ height:auto;
outline:none;
- font-family:Verdana, Arial;
- font-size:11px;
padding:4px;
margin:0px;
color:#000;
@@ -282,4 +297,8 @@ canvas.hidden {
html.hasTouch .annotator-viewer li .annotator-controls,
html.hasTouch .annotator-viewer li .annotator-controls {
opacity: 1;
+}
+
+.d-none{
+ display: none !important;
}
\ No newline at end of file
diff --git a/css/move.png b/css/move.png
new file mode 100644
index 0000000..614df4a
Binary files /dev/null and b/css/move.png differ
diff --git a/css/rotate.png b/css/rotate.png
new file mode 100644
index 0000000..aad4dad
Binary files /dev/null and b/css/rotate.png differ
diff --git a/css/theme-dark/annotorious-dark.css b/css/theme-dark/annotorious-dark.css
index 66c0fb1..7704470 100644
--- a/css/theme-dark/annotorious-dark.css
+++ b/css/theme-dark/annotorious-dark.css
@@ -169,6 +169,10 @@
transition-delay:0;
}
+.annotorious-popup-button:hover{
+ cursor: pointer;
+}
+
.annotorious-popup-button-delete:hover {
background-color:transparent;
background:url(DarkSprite.png) no-repeat;
@@ -193,6 +197,22 @@
background-position:0 -99px;
}
+.annotorious-popup-button-move {
+ background:url(move.png);
+ width:16px;
+ height:16px;
+ text-indent:100px;
+ overflow:hidden;
+}
+
+.annotorious-popup-button-rotate {
+ background:url(rotate.png);
+ width:16px;
+ height:16px;
+ text-indent:100px;
+ overflow:hidden;
+}
+
.annotorious-popup-field {
margin:0px;
padding:6px;
@@ -236,7 +256,7 @@
line-height:150%;
margin:10px 0px 4px 0px;
padding:0px 10px;
- min-height:50px;
+ height:auto;
width:100%;
min-width:200px;
outline:none;
@@ -343,3 +363,7 @@
-webkit-border-radius: 5px;
-khtml-border-radius: 5px;
}
+
+.d-none{
+ display: none !important;
+}
\ No newline at end of file
diff --git a/css/theme-dark/move.png b/css/theme-dark/move.png
new file mode 100644
index 0000000..614df4a
Binary files /dev/null and b/css/theme-dark/move.png differ
diff --git a/css/theme-dark/rotate.png b/css/theme-dark/rotate.png
new file mode 100644
index 0000000..aad4dad
Binary files /dev/null and b/css/theme-dark/rotate.png differ
diff --git a/externs/api.externs.js b/externs/api.externs.js
index aa2df86..d014257 100644
--- a/externs/api.externs.js
+++ b/externs/api.externs.js
@@ -3,69 +3,117 @@
/**
* Annotorious annotation interface.
*/
-var Annotation = {
+var Annotation = {
+
+ /** @type {integer} annotation id **/
+ id: {},
/** @type {string} source URL of the annotated object (e.g. image) **/
- src : {},
-
+ src: {},
+
/** @type {string} source URL of the HTML document containing the annotated object **/
- context : {},
-
+ context: {},
+
/** @type {string} annotation text **/
- text : {},
+ text: {},
+
+ /** @type {integer} annotation text id **/
+ textId: {},
/** @type {boolean} flag indicating whether the anntotation is edit-/deletable **/
- editable : {},
-
+ editable: {},
+
+ /** @type {boolean} flag indicating whether the anntotation is movable **/
+ movable: {},
+
+ /** @type {boolean} flag indicating whether the anntotation is rotable **/
+ rotable: {},
+
+ /** @type {Date} the timestamp of creation **/
+ created_at: {},
+
/** @type {Object} the annotation shape **/
- shapes : [{
-
+ shapes: [{
+
/** @type {string} the annotation shape type (e.g. rect, point, polygon) **/
- type : {},
+ type: {},
/** @type {string} measurement units used for the geometry (e.g. 'pixel', 'fraction') **/
- units : {},
-
+ units: {},
+
/** @type {Object} the shape geometry **/
- geometry : {},
-
+ geometry: {},
+
+ /** @type {string} the annotation mask url - only if type is 'rect' **/
+ mask: {},
+
/** @type {Object} the shape style **/
style: {
-
+
/** @type {string} outline color **/
outline: {},
/** @type {number} outline width **/
- outline_width: {},
-
+ outlineWidth: {},
+
/** @type {string} outline color when highlighted **/
- hi_outline: {},
+ hiOutline: {},
/** @type {number} outline width when hightlighted **/
- hi_outline_width: {},
-
+ hiOutlineWidth: {},
+
/** @type {string} stroke color **/
stroke: {},
/** @type {number} stroke width **/
- stroke_width: {},
+ strokeWidth: {},
/** @type {string} stroke color when highlighted **/
- hi_stroke: {},
+ hiStroke: {},
/** @type {number} stroke width when highlighted **/
- hi_stroke_width: {},
-
+ hiStrokeWidth: {},
+
/** @type {string} fill color **/
fill: {},
-
+
/** @type {string} fill color when highlighted **/
- hi_fill: {}
-
+ hiFill: {},
+
+ /** @type {number} transparency for annotation mask [0-1] **/
+ maskTransparency: {},
+
+ /** @type {boolean} flag indicating whether the mask border is shown **/
+ maskBorder: {},
+
+ /** @type {string} stroke color for arrow shape **/
+ arrowStroke: {},
+
+ /** @type {number} stroke width for arrow shape [1-12] **/
+ arrowStrokeWidth: {},
+
+ /** @type {string} stroke color when highlighted for arrow shape **/
+ hiArrowStroke: {},
+
+ /** @type {number} stroke width when highlighted for arrow shape [1-12] **/
+ hiArrowStrokeWidth: {},
+
+ /** @type {string} color to highlight the tail of the arrow shape **/
+ highlightTail: {},
+
+ /** @type {number} arrow tail highlight radius **/
+ hiTailRadius: {},
+
+ /** @type {string} color to highlight the head of the arrow shape **/
+ highlightHead: {},
+
+ /** @type {number} arrow head highlight radius **/
+ hiHeadRadius: {}
}
-
- }]
+ }],
+ /** @type {Function} called for set mask on the shape **/
+ setMask: function (mask, shapeIdx, transparency, border) { }
};
/**
@@ -73,13 +121,16 @@ var Annotation = {
*/
var Rectangle = {
- x : {},
+ x: {},
+
+ y: {},
- y : {},
+ width: {},
- width : {},
+ height: {},
- height : {}
+ /** @type {number} Rotation of the annotation with respect to the x-axis (degrees). [OPTIONAL - default is 0] **/
+ rotation: {}
}
@@ -88,7 +139,18 @@ var Rectangle = {
*/
var Polygon = {
- points : {}
+ points: {}
+
+}
+
+/**
+ * Annotation shape type: Arrow
+ */
+var Arrow = {
+
+ arrowTail: {},
+
+ arrowHead: {}
}
@@ -98,11 +160,11 @@ var Polygon = {
var AnnotoriousPlugin = {
/** @type {Function} called on plugin initialization **/
- initPlugin : function(anno) {},
+ initPlugin: function (anno) { },
/** @type {Function} called on initialization of a Popup element **/
- onInitAnnotator : function(annotator) {}
-
+ onInitAnnotator: function (annotator) { }
+
};
/**
@@ -111,13 +173,13 @@ var AnnotoriousPlugin = {
var Annotator = {
/** @type {Element} the annotator DOM element **/
- element : {},
+ element: {},
/** @type {Object} the popup used by this annotator **/
- popup : {},
+ popup: {},
/** @type {Object} the editor used by this annotator **/
- editor : {}
+ editor: {}
};
@@ -126,21 +188,21 @@ var Annotator = {
*/
var Selector = {
- init : function() {},
+ init: function () { },
- getName : function() {},
+ getName: function () { },
- getSupportedShapeType : function() {},
+ getSupportedShapeType: function () { },
- startSelection : function() {},
+ startSelection: function () { },
- stopSelection : function() {},
+ stopSelection: function () { },
- getShape : function() {},
+ getShape: function () { },
- getViewportBounds : function() {},
+ getViewportBounds: function () { },
- drawShape : function() {}
+ drawShape: function () { }
}
@@ -149,11 +211,11 @@ var Selector = {
*/
var SelectionEvent = {
- mouseEvent : {},
+ mouseEvent: {},
- shape : {},
+ shape: {},
- viewportBounds : {}
+ viewportBounds: {}
}
@@ -162,14 +224,14 @@ var SelectionEvent = {
*/
var Popup = {
- startHideTimer : function() {},
+ startHideTimer: function () { },
+
+ clearHideTimer: function () { },
- clearHideTimer : function() {},
+ show: function () { },
- show : function() {},
+ setPosition: function () { },
- setPosition : function() {},
+ setAnnotation: function () { }
- setAnnotation : function() {}
-
}
\ No newline at end of file
diff --git a/plovr/plovr.jar b/plovr/plovr.jar
index b8c0a2c..90426c1 100644
Binary files a/plovr/plovr.jar and b/plovr/plovr.jar differ
diff --git a/readme.md b/readme.md
index 191c9e1..7e5d280 100644
--- a/readme.md
+++ b/readme.md
@@ -1,26 +1,618 @@
-# Annotorious - Image Annotation for the Web
+# Annotorious - Image Annotation for the Web (custom)
-**CURRENTLY UNSUPPORTED**
+This library is a custom version of the [Annotorious library](https://github.com/annotorious/annotorious) (currently deprecated / dead). Show the new [Annotorious library](https://github.com/recogito/annotorious).
-Annotorious is an Open Source image annotation toolkit written in JavaScript. Online demos are available
-[on our project Website](https://annotorious.github.io).
+Annotorious is an Open Source image annotation toolkit written in JavaScript. It allows you to add drawing, commenting and labeling capabilities to your web page images with a few lines of code.
+
+Are you looking for toolkit written in jQuery to annotate an image by dragging and dropping annotations? Check out [this project](https://github.com/AntoninoBonanno/DragDropAnnotate).
## Getting Started
-Instructions on getting started using Annotorious on your own Web pages are [on the project Website](https://annotorious.github.io/getting-started.html) or
-[on the Wiki](https://github.com/annotorious/annotorious/wiki/Getting-Started). Instructions on using it as a plugin to the
-[Annotator](http://okfnlabs.org/projects/annotator/) Web annotation system are [here](http://annotorious.github.io/plug-outs/okfn-annotator.html).
-If you require support, get in touch [via our mailing list](https://groups.google.com/forum/#!forum/annotorious).
+Instructions on getting started using Original Annotorious library [on the Wiki](https://github.com/annotorious/annotorious/wiki/Getting-Started).
+Instructions on using it as a plugin to the [Annotator](http://okfnlabs.org/projects/annotator/) Web annotation system are [here](http://annotorious.github.io/plug-outs/okfn-annotator.html).
+
+## How Do I Add Annotorious to My Web Page?
+
+* Unzip the contents of the package on your server
+* Link the __Annotorious CSS file__ into the <head> of your Web pages
+* Link the __Annotorious JavaScript__ file into the <head> of your Web pages
+
+Example:
+
+```
+
+
+
+
+```
+
+## How Do I Enable Annotation for an Image on My Page?
+
+Once you have linked Annotorious into your Web page, you need to tell it which images should be annotatable.
+There are two ways you can do this:
+
+__Option 1.__ Add a CSS class called ``annotatable`` to the image. This is the easiest way to add annotation functionality, and I'd always recommend using this approach unless your page loads images dynamically via JavaScript, after the page has loaded.
+
+Example:
+
+```
+
+
+
+
+
+
+
+
+
+
+```
+
+__Option 2:__ Annotation-enable your images via JavaScript API, using ``anno.makeAnnotatable(img);`` You can use
+this approach if your page loads images dynamically via JavaScript.
+
+# JavaScript API
+
+Annotorious provides a JavaScript API you can use to get, add or remove annotations, and hook into the Annotorious event lifecycle. All functionality is exposed via the global _anno_ object. The _anno_ object has the following methods
+
+**Show [JavaScript-API.md](https://github.com/AntoninoBonanno/annotorious/blob/master/JavaScript-API.md) for more details**
+
+## My Contribution (Extended JavaScript API)
+
+### Functionality
+* [Mask](#mask): Added the ability to insert an image inside a annotation with shapes rect.
+* [ColorMode](#colormode): Added the ability to draw custom shape without make an annotation. The drawn pixels coordinate are returned when the mouse is released.
+* [SelectEditor](#selecteditor): Added the ability to use a select inside the editor. (Dropdown menu)
+* [CursorAxes](#cursoraxes): Added the ability to show cursor axes inside the image.
+* [ArrowMode](#arrowmode): Added the ability to annotate with draw arrow shape. (Arrow selector)
+* [Fancy Box](#fancy-box): Added ['Fancy Box Selector'](https://annotorious.github.io/demos/fancybox-preview.html) plugin integration.
+* [ExtraFields](#extrafields): Added the ability to add many fields to the annotation GUI widget from properties.
+* [IntersectedAnnotations](#intersectedAnnotations): Added the ability to retrieves all annotations that intersect the centroid of an annotation.
+
+### Changes
+* Added the ability to [reload the annotations](#reload-the-annotations).
+* Added the `onMouseMoveOverItem` [event](#events) - fired when the mouse enters an annotatable item.
+* Added an old annotation text inside the [event](#events) `onAnnotationUpdated`, when editing the annotation.
+* Added the ability to insert [more new annotation](#add-multiple-annotations) to an item on the page.
+* Added attributes in to the ["annotation" variable](#annotation-variable).
+* Added more [properties](#properties) for editing style and functionality on runtime.
+* Added the ability to set the measurement units used for the output geometry ['pixel', 'fraction'].
+* Added the ability to custom the editor.
+* Added the ability to move the annotations. The `onAnnotationMoved` [event](#events) - fired when the annotation was moved.
+* Added the ability to rotate the annotations. The `onAnnotationRotated` [event](#events) - fired when the annotation was rotated.
+* Fixed bug:
+ - resizing the image: now the annotations are resized with the image. (The image must have the `annotatable` class).
+ - add new annotation: if the new annotation forms are exactly the same as the other annotation forms, the new annotation is not inserted.
+ - measurement units 'pixel': now the measurement units 'pixel' are relative to the original image size. This because the image is responsive and the annotation has need of reference measurement units.
+
+## Usage
+
+### Mask
+
+Ability to insert an image inside a annotation with shapes rect.
+
+- set *Mask* on annotation variable
+
+ ```
+ shapes: [{
+ type: 'rect',
+ geometry: { x: 0.2, y: 0.2, width: 0.50, height: 0.5 },
+ mask: "http://www.example.com/mymask.jpg",
+
+ style: { //style [OPTIONAL]
+ maskTransparency: 0.8, //transparency for annotation mask [0-1] [OPTIONAL]
+ maskBorder: true //if false, not show the mask border [OPTIONAL]
+ }
+ }]
+ ```
+
+- set *Mask* dynamically - setMask(***mask***, ***shapeIdx***, ***transparency***, ***border***);
+
+ - **mask**: the URL of the mask
+ - **shapeIdx**: index of shapes (default: 0)
+ - **transparency** transparency of mask [0-1](default: 0.8)
+ - **border** flag indicating whether the mask border is shown (default: true)
+
+
+ ```
+ anno.addHandler('onAnnotationCreated', function (annotation) {
+ annotation.setMask("http://www.example.com/mymask.jpg");
+ anno.reload();
+ });
+ ```
+
+### ColorMode
+
+Ability to draw custom shape without make an annotation. The last drawn pixels coordinate are returned when the mouse is released on `onDrawnPixels` event.
+
+**`anno.setColorMode(*enabled*, *insideAnno*, *mode*, *color*, *strokeWidth*);`**
+
+Modalities of save the drawn pixels:
+- **permanent**: pixels are saved until `anno.reset()` or `anno.reload()`.
+- **active**: pixels are saved as long as *ColorMode* is enabled.
+- **release**: the pixels are not saved, they are deleted when the mouse is released.
+
+- set *ColorMode* in the properties
+
+ ```
+ anno.setProperties({
+ colorMode: {
+ /* DEFAULT VALUES */
+ enabled: false, //if true, enable the colorMode
+ insideAnno: false, //if true, is possible draw only inside the annotations [OPTIONAL]
+ mode: "active", // mode of save the drawn pixels ["permanent", "active", "release"] [OPTIONAL]
+ color: "#2ECC71", //color of pixels [OPTIONAL]
+ strokeWidth: 2, //stroke width of pixels [1-12] [OPTIONAL]
+ }
+ });
+ ```
+
+- set *ColorMode* using the function
+
+ ```
+ // ENABLE - insideAnno, mode, color and strokeWidth are OPTIONAL
+ anno.setColorMode(true, true, 'release', '#E74C3C', 1);
+
+ // DISABLE
+ anno.setColorMode(false);
+ ```
+
+- Get drawn pixels
+
+ ```
+ anno.addHandler('onDrawnPixels', function (event) {
+ console.log(event);
+ event.drawnPixels; //array of last drawn pixels {x, y}
+ event.annotation; //the annotation on which it was drawn inside (only if the 'insideAnno' property is enabled)
+ });
+ ```
+
+### SelectEditor
+
+Ability to use a select, with custom options, inside the editor. (Dropdown menu)
+
+**`anno.useSelectEditor(*enabled*, *options*, *emptyOption*, *customLabel*);`**
+
+- define custom options
+
+ ```
+ var selectOptions = [
+ {
+ id: 1, //the annotation text id [OPTIONAL]
+ value: 'My annotation' //the annotation text
+ },
+ ];
+ ```
+
+- set *SelectEditor* in the properties
+
+ ```
+ anno.setProperties({
+ selectEditor: {
+ /* DEFAULT VALUES */
+ enabled: false, //if true, enable the select editor
+ options: undefined, //the options of select, use format of 'selectOptions' variable
+ emptyOption: false, //if true, enable the empty select option [OPTIONAL]
+ customLabel: "<--- Select one option --->" //the custom first label if not use empty options [OPTIONAL]
+ }
+ });
+ ```
+
+- set *SelectEditor* using the function
+
+ ```
+ // ENABLE - emptyOption and customLabel are OPTIONAL
+ anno.useSelectEditor(true, selectOptions, false, "Select one");
+
+ // DISABLE
+ anno.useSelectEditor(false);
+ ```
+
+### CursorAxes
+
+Ability to show cursor axes inside the image.
+
+**`anno.showCursorAxes(*enabled*, *dash*, *color*, *strokeWidth*);`**
+
+- set *CursorAxes* in the properties
+
+ ```
+ anno.setProperties({
+ cursorAxes: {
+ /* DEFAULT VALUES */
+ enabled: false, //if true, enable the cursor axes
+ dash: false, //if true, draw dashed stroke [OPTIONAL]
+ color: "#ffffff", //color of cursor axes [OPTIONAL]
+ strokeWidth: 2 //stroke width of axes [1-12] [OPTIONAL]
+ }
+ });
+ ```
+
+- set *CursorAxes* using the function
+
+ ```
+ // ENABLE - dash, color and strokeWidth are OPTIONAL
+ anno.showCursorAxes(true, true, '#E74C3C', 2);
+
+ // DISABLE
+ anno.showCursorAxes(false);
+ ```
+
+### ArrowMode
+
+Ability to annotate with draw arrow shape. (Arrow selector)
+
+**` anno.setArrowMode(*enabled*); `**
+
+- set *ArrowMode* in the properties
+
+ ```
+ anno.setProperties({
+ /* DEFAULT VALUES */
+ arrowMode: false, //if true, enable the arrowMode
+ shapeStyle: { // set style
+ arrowStroke: '#ffffff', // stroke color for arrow shape
+ arrowStrokeWidth: 2, // stroke width for arrow shape [1-12]
+ hiArrowStroke: '#fff000', // stroke color for arrow shape
+ hiArrowStrokeWidth: 2.2 //stroke width for arrow shape [1-12]
+
+ highlightTail: undefined, //color to highlight the tail of the arrow shape (draw a circle on the tail) [es "rgba(0, 0, 255, 0.7)"]
+ hiTailRadius: 5, // arrow tail highlight radius
+ highlightHead: undefined, //color to highlight the head of the arrow shape (draw a circle on the head) [es "rgba(0, 0, 255, 0.7)"]
+ hiHeadRadius: 5 // arrow head highlight radius
+ }
+ });
+ ```
+
+- set *ArrowMode* using the function
+
+ ```
+ // ENABLE
+ anno.setArrowMode(true);
+
+ // DISABLE
+ anno.setArrowMode(false);
+ ```
+
+- set *arrow* shape on annotation variable
+
+ ```
+ shapes: [{
+ type: 'arrow',
+ geometry: { //the shape geometry (relative coordinates) [you can also use the coordinates in pixels]
+ arrowTail: { x: 0.20 y: 0.74 }, // coordinate of arrow tail
+ arrowHead: { x: 0.77 y: 0.66 } // coordinate of arrowhead
+ },
+
+ style: { //style [OPTIONAL]
+ arrowStroke: '#ffffff', // stroke color for arrow shape
+ arrowStrokeWidth: 2, // stroke width for arrow shape [1-12]
+ hiArrowStroke: '#fff000', // stroke color for arrow shape
+ hiArrowStrokeWidth: 2.2 //stroke width for arrow shape [1-12]
+
+ highlightTail: undefined, //color to highlight the tail of the arrow shape (draw a circle on the tail) [es "rgba(0, 0, 255, 0.7)"]
+ hiTailRadius: 5, // arrow tail highlight radius
+ highlightHead: undefined, //color to highlight the head of the arrow shape (draw a circle on the head) [es "rgba(0, 0, 255, 0.7)"]
+ hiHeadRadius: 5 // arrow head highlight radius
+ }
+ }]
+ ```
+
+### Fancy Box
+
+Added ['Fancy Box Selector'](https://annotorious.github.io/demos/fancybox-preview.html) plugin integration.
+
+**` anno.useFancyBox(*enabled*); `**
+
+- set *Fancy Box* in the properties
+
+ ```
+ anno.setProperties({
+ /* DEFAULT VALUES */
+ fancyBox: false, //if true, enable the Fancy Box Selector
+ });
+ ```
+
+- set *Fancy Box* using the function
+
+ ```
+ // ENABLE
+ anno.useFancyBox(true);
+
+ // DISABLE
+ anno.useFancyBox(false);
+ ```
+
+### ExtraFields
+
+Ability to add many fields to the annotation GUI widget from properties. A field can be either an (HTML) string, or a function that takes an Annotation as argument and returns an (HTML) string or a DOM element.
+
+- set *ExtraFields* for editor GUI widget
+
+ ```
+ anno.setProperties({
+ editor: {
+ extraFields: [
+ "
- This page serves as a development environment for the Annotorious JavaScript
- image annotation library. Hover over one of the annotatable images to get started.
- NOTE: make sure the plovr build tool is running! Use
-
- Hallstatt, Austria. By Nick Csakany, 2007. Public Domain. Source:
- Wikimedia
- Commons
-
-
-
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut varius
- diam posuere quam molestie vestibulum. Vestibulum non volutpat elit. Integer
- vitae felis eget magna rutrum sagittis. Nulla facilisi. Praesent a consectetur
- velit. Cras eget nibh est, eu imperdiet mauris. Nulla quis justo urna. Sed eu
- rutrum mauris. Integer aliquet nulla sit amet ante mollis pellentesque.
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut varius
- diam posuere quam molestie vestibulum. Vestibulum non volutpat elit. Integer
- vitae felis eget magna rutrum sagittis. Nulla facilisi. Praesent a consectetur
- velit. Cras eget nibh est, eu imperdiet mauris. Nulla quis justo urna. Sed eu
- rutrum mauris. Integer aliquet nulla sit amet ante mollis pellentesque.
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut varius
- diam posuere quam molestie vestibulum. Vestibulum non volutpat elit. Integer
- vitae felis eget magna rutrum sagittis. Nulla facilisi. Praesent a consectetur
- velit. Cras eget nibh est, eu imperdiet mauris. Nulla quis justo urna. Sed eu
- rutrum mauris. Integer aliquet nulla sit amet ante mollis pellentesque.
+ anno.addHandler('onAnnotationCreated', function (annotation, item) {
+ console.log("<--- Annotation create --->");
+ //annotation.setMask("./image-human-brain_99433-298.jpg", 0, 0.5, false);
+ //anno.reload();
+ console.log(annotation);
+ //console.log("IntersectedAnnotations", anno.getIntersectedAnnotations(annotation));
+ console.log("<--- Annotation create --->");
+ });
+ anno.addHandler('onAnnotationRemoved', function (annotation) {
+ console.log("<--- Annotation removed --->");
+ console.log(annotation);
+ console.log("<--- Annotation removed --->");
+ });
+ anno.addHandler('onAnnotationUpdated', function (annotation, old) {
+ console.log("<--- Annotation updated --->");
+ console.log(annotation);
+ console.log(old);
+ console.log("<--- Annotation updated --->");
+ });
+ anno.addHandler('onMouseMoveOverItem', function (pixels, event) {
+ $("#showPixel").html("cursor: [x=" + pixels.cursor.x + ", y=" + pixels.cursor.y + "]" + ((pixels.box) ? " box: [x=" + pixels.box.x + ", y=" + pixels.box.y + ", width=" + pixels.box.width + ", height=" + pixels.box.height + "]" : ""))
+ });
+ });
+
+ anno.addHandler('onAnnotationMoved', function (annotation) {
+ console.log("<--- Annotation moved --->");
+ console.log(annotation);
+ console.log("<--- Annotation moved --->");
+ });
+
+ anno.addHandler('onAnnotationRotated', function (annotation) {
+ console.log("<--- Annotation rotated --->");
+ console.log(annotation);
+ console.log("<--- Annotation rotated --->");
+ });
+
+ var properties = {
+ displayMessage: "Annotate", //the message to display as hint [OPTIONAL]
+ outputUnits: "pixel", // measurement units used for the output geometry ['pixel', 'fraction'] [pixels are relative to the original image size] [OPTIONAL]
+ shapeStyle: { //global style [OPTIONAL]
+
+ outline: '#ff0000', //outline color for annotation and selection shapes [OPTIONAL]
+ outlineWidth: 2, //outline width for annotation and selection shapes [1-12] [OPTIONAL]
+
+ hiOutline: '#ffff00', // outline color for highlighted annotation shapes [OPTIONAL]
+ hiOutlineWidth: 3, // outline width for highlighted annotation shapes [1-12] [OPTIONAL]
+
+ stroke: '#ff3399', // stroke color for annotation and selection shapes [OPTIONAL]
+ strokeWidth: 4, // stroke width for annotation and selection shapes [1-12] [OPTIONAL]
+
+ hiStroke: '#006600', // stroke color for highlighted annotation shapes [OPTIONAL]
+ hiStrokeWidth: 6.2, //stroke width for highlighted annotation shapes [1-12] [OPTIONAL]
+
+ maskTransparency: 1, //transparency for annotation mask [0-1] [OPTIONAL]
+ maskBorder: true, //if false, not show the mask border [OPTIONAL]
+
+ highlightTail: "rgba(0, 0,255,0.7)", //color to highlight the tail of the arrow shape [OPTIONAL]
+ hiTailRadius: 5, // arrow tail highlight radius [OPTIONAL]
+ highlightHead: "rgba(0, 0,255,0.7)", //color to highlight the head of the arrow shape [OPTIONAL]
+ hiHeadRadius: 5 // arrow head highlight radius [OPTIONAL]
+ },
+ popup: { //properties for popup GUI widget
+ showMoveButton: false, //if false, not show the move button
+ showRotateButton: true //if false, not show the rotate button
+ },
+ };
+
+
+
+
+
+
+
Annotation Test Page
+
+ This page serves as a development environment for the Annotorious JavaScript
+ image annotation library. Hover over one of the annotatable images to get started.
+ NOTE: make sure the plovr build tool is running! Use
+
+ Hallstatt, Austria. By Nick Csakany, 2007. Public Domain. Source:
+ Wikimedia
+ Commons
-
-
-
- Medival Ideal Portrait of Ptolemy. Public Domain. Source:
- Wikimedia
+
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut varius
+ diam posuere quam molestie vestibulum. Vestibulum non volutpat elit. Integer
+ vitae felis eget magna rutrum sagittis. Nulla facilisi. Praesent a consectetur
+ velit. Cras eget nibh est, eu imperdiet mauris. Nulla quis justo urna. Sed eu
+ rutrum mauris. Integer aliquet nulla sit amet ante mollis pellentesque.
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut varius
+ diam posuere quam molestie vestibulum. Vestibulum non volutpat elit. Integer
+ vitae felis eget magna rutrum sagittis. Nulla facilisi. Praesent a consectetur
+ velit. Cras eget nibh est, eu imperdiet mauris. Nulla quis justo urna. Sed eu
+ rutrum mauris. Integer aliquet nulla sit amet ante mollis pellentesque.
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut varius
+ diam posuere quam molestie vestibulum. Vestibulum non volutpat elit. Integer
+ vitae felis eget magna rutrum sagittis. Nulla facilisi. Praesent a consectetur
+ velit. Cras eget nibh est, eu imperdiet mauris. Nulla quis justo urna. Sed eu
+ rutrum mauris. Integer aliquet nulla sit amet ante mollis pellentesque.
+
+
+
+
+ Medival Ideal Portrait of Ptolemy. Public Domain. Source:
+ Wikimedia
Commons
-
-
-
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut varius
- diam posuere quam molestie vestibulum. Vestibulum non volutpat elit. Integer
- vitae felis eget magna rutrum sagittis. Nulla facilisi. Praesent a consectetur
- velit. Cras eget nibh est, eu imperdiet mauris. Nulla quis justo urna. Sed eu
- rutrum mauris. Integer aliquet nulla sit amet ante mollis pellentesque.
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut varius
- diam posuere quam molestie vestibulum. Vestibulum non volutpat elit. Integer
- vitae felis eget magna rutrum sagittis. Nulla facilisi. Praesent a consectetur
- velit. Cras eget nibh est, eu imperdiet mauris. Nulla quis justo urna. Sed eu
- rutrum mauris. Integer aliquet nulla sit amet ante mollis pellentesque.
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut varius
- diam posuere quam molestie vestibulum. Vestibulum non volutpat elit. Integer
- vitae felis eget magna rutrum sagittis. Nulla facilisi. Praesent a consectetur
- velit. Cras eget nibh est, eu imperdiet mauris. Nulla quis justo urna. Sed eu
- rutrum mauris. Integer aliquet nulla sit amet ante mollis pellentesque.
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut varius
- diam posuere quam molestie vestibulum. Vestibulum non volutpat elit. Integer
- vitae felis eget magna rutrum sagittis. Nulla facilisi. Praesent a consectetur
- velit. Cras eget nibh est, eu imperdiet mauris. Nulla quis justo urna. Sed eu
- rutrum mauris. Integer aliquet nulla sit amet ante mollis pellentesque.
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut varius
+ diam posuere quam molestie vestibulum. Vestibulum non volutpat elit. Integer
+ vitae felis eget magna rutrum sagittis. Nulla facilisi. Praesent a consectetur
+ velit. Cras eget nibh est, eu imperdiet mauris. Nulla quis justo urna. Sed eu
+ rutrum mauris. Integer aliquet nulla sit amet ante mollis pellentesque.
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut varius
+ diam posuere quam molestie vestibulum. Vestibulum non volutpat elit. Integer
+ vitae felis eget magna rutrum sagittis. Nulla facilisi. Praesent a consectetur
+ velit. Cras eget nibh est, eu imperdiet mauris. Nulla quis justo urna. Sed eu
+ rutrum mauris. Integer aliquet nulla sit amet ante mollis pellentesque.
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut varius
+ diam posuere quam molestie vestibulum. Vestibulum non volutpat elit. Integer
+ vitae felis eget magna rutrum sagittis. Nulla facilisi. Praesent a consectetur
+ velit. Cras eget nibh est, eu imperdiet mauris. Nulla quis justo urna. Sed eu
+ rutrum mauris. Integer aliquet nulla sit amet ante mollis pellentesque.
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut varius
+ diam posuere quam molestie vestibulum. Vestibulum non volutpat elit. Integer
+ vitae felis eget magna rutrum sagittis. Nulla facilisi. Praesent a consectetur
+ velit. Cras eget nibh est, eu imperdiet mauris. Nulla quis justo urna. Sed eu
+ rutrum mauris. Integer aliquet nulla sit amet ante mollis pellentesque.
+