// Don't worry this will be open source soon ... ;o)
'use strict';function aa(a,b,c,d){var e=this,f=a.getContext("2d"),k=new Image;e.Yb=!1;e.uc=d;e.frame=1;e.frames=c;e.ya=f;e.Ra=!0;e.oa=k;k.src=b;k.onload=function(){var a=k.width/c,b=k.height;e.Ra=!1;f.drawImage(k,0,0,a,b,0,0,a,b);e.Yb=!0;e.sb&&(e.start(),e.sb=null)}}
aa.prototype={start:function(){this.Ra||(this.Yb?(this.startTime=window.mozAnimationStartTime,this.Ra=!0,window.requestAnimationFrame(this.step.bind(this))):this.sb=!0)},stop:function(){this.sb=null;this.Ra=!1},step:function(a){if(a-this.startTime>=this.uc){a=this.oa.width/this.frames;var b=this.oa.height;this.ya.drawImage(this.oa,this.frame*a,0,a,b,0,0,a,b);this.frame++;this.frame==this.frames&&(this.frame=0);this.startTime=window.mozAnimationStartTime}this.Ra&&window.requestAnimationFrame(this.step.bind(this))}};var ba=function(){function a(a,k){if(e)k(e.transaction(d,a).objectStore(d));else{var m=indexedDB.open(b,c);m.onerror=function(){console.error("AsyncStorage: can't open database:",m.error.name)};m.onupgradeneeded=function(){m.result.createObjectStore(d)};m.onsuccess=function(){e=m.result;k(e.transaction(d,a).objectStore(d))}}}var b="asyncStorage",c=1,d="keyvaluepairs",e=null;return{getItem:function(b,c){a("readonly",function(a){var d=a.get(b);d.onsuccess=function(){var a=d.result;void 0===a&&(a=null);
c(a)};d.onerror=function(){console.error("Error in AsyncStorage.getItem(): ",d.error.name)}})},setItem:function(b,c,d){a("readwrite",function(a){var e=a.put(c,b);d&&(e.onsuccess=function(){d()});e.onerror=function(){console.error("Error in AsyncStorage.setItem(): ",e.error.name)}})},removeItem:function(b,c){a("readwrite",function(a){var d=a["delete"](b);c&&(d.onsuccess=function(){c()});d.onerror=function(){console.error("Error in AsyncStorage.removeItem(): ",d.error.name)}})},clear:function(b){a("readwrite",
function(a){var c=a.clear();b&&(c.onsuccess=function(){b()});c.onerror=function(){console.error("Error in AsyncStorage.clear(): ",c.error.name)}})},length:function(b){a("readonly",function(a){var c=a.count();c.onsuccess=function(){b(c.result)};c.onerror=function(){console.error("Error in AsyncStorage.length(): ",c.error.name)}})},key:function(b,c){0>b?c(null):a("readonly",function(a){var d=!1,e=a.openCursor();e.onsuccess=function(){var a=e.result;a?0===b?c(a.key):d?c(a.key):(d=!0,a.advance(b)):c(null)};
e.onerror=function(){console.error("Error in AsyncStorage.key(): ",e.error.name)}})}}}();var g=!!("ontouchstart"in window),ca=!!(16<screen.colorDepth),da=/Gecko\/18/.test(navigator.userAgent),ea=/Gecko\/26/.test(navigator.userAgent),fa=/ZTEOPEN/.test(navigator.userAgent),ga=/LG\-D300/.test(navigator.userAgent),ha=/HUAWEIY300\-F1/.test(navigator.userAgent),ia=/ALCATELOneTouch4012X/.test(navigator.userAgent)||fa?256:ga||ha?512:Number.POSITIVE_INFINITY;var h={};var ja=function(){function a(a,b){if(c)b(c.transaction(f,a).objectStore(f));else{var s=indexedDB.open(d,e);s.onerror=function(){throw Error("Settings: can't open database:"+s.error.name);};s.onupgradeneeded=function(){s.result.createObjectStore(f)};s.onsuccess=function(){c=s.result;b(c.transaction(f,a).objectStore(f))}}}var b={},c=null,d="BessaSettings",e=1,f="keyvaluepairs";b.set=function(b,c,d){a("readwrite",function(a){var e=a.put(c,b);d&&(e.onsuccess=function(){d()});e.onerror=function(){throw Error("Error in Settings.setItem(): "+
e.error.name);}})};b.get=function(b,c){a("readonly",function(a){var d=a.get(b);d.onsuccess=function(){var a=d.result;void 0===a&&(a=null);c(a)};d.onerror=function(){throw Error("Error in Settings.getItem(): "+d.error.name);}})};return b}();var y=function(){function a(a,b){if(f)b(f.transaction(s,a).objectStore(s));else{var c=indexedDB.open(k,m);c.onerror=function(){throw Error("AsyncStorage: can't open database:"+c.error.name);};c.onupgradeneeded=function(){c.result.createObjectStore(s,{keyPath:"id",autoIncrement:!0})};c.onsuccess=function(){f=c.result;b(f.transaction(s,a).objectStore(s))}}}function b(b){a("readwrite",function(a){var c=a.clear();b&&(c.onsuccess=function(){b()});c.onerror=function(){throw Error("Error in AsyncStorage.clear(): "+
c.error.name);}})}function c(b){a("readonly",function(a){var c=a.count();c.onsuccess=function(){b(c.result)};c.onerror=function(){throw Error("Error in AsyncStorage.length(): "+c.error.name);}})}function d(a){window.requestAnimationFrame(function(){var c=new XMLHttpRequest;c.onerror=function(){};c.onreadystatechange=function(){console.log(c.readyState);4===c.readyState&&(b(),a&&a(),c=null)};y.Xb(function(b){0<b.length?(c.open("POST","http://bessa-app.com/log/",!0),c.responseType="json",c.setRequestHeader("Content-type",
"application/x-www-form-urlencoded; charset=UTF-8"),c.send("log="+escape(b.join("\n")))):a&&(a(),c=null)})})}var e={},f=null,k="BessaLogger",m=1,s="keyvaluepairs";e.U=function(){};e.Xb=function(b){a("readonly",function(a){var c=a.openCursor(),d=[];c.onsuccess=function(a){(a=a.target.result)?(d.push(a.value.log),a["continue"]()):b(d)};c.onerror=function(){throw Error("Error in AsyncStorage.getItem(): "+c.error.name);}})};e.pc=b;e.Wc=d;var t;e.hd=function(){t=setInterval(function(){c(function(a){19<
a&&d()})},7200)};e.wc=function(){clearInterval(t)};return e}();var ka=document.documentElement.matchesSelector||document.documentElement.mozMatchesSelector||document.documentElement.webkitMatchesSelector||document.documentElement.Zd||document.documentElement.msMatchesSelector,la={Nc:!1,jc:"tappable-active",dc:function(){},gb:function(){},La:function(){},ce:function(){},ae:function(){},fb:function(){},$d:function(){},mc:!1,oc:50,Oc:0,kc:0,Gc:0},ma="ontouchend"in document?"touchstart":"mousedown",na="ontouchend"in document?"touchmove":"mousemove",oa="ontouchend"in
document?"touchend":"mouseup";function pa(a,b){var c=document.elementFromPoint(a,b);3==c.nodeType&&(c=c.parentNode);return c}function qa(a){var b=a.target;if(b)return 3==b.nodeType&&(b=b.parentNode),b;a=a.targetTouches[0];return pa(a.clientX,a.clientY)}function ra(a){return a.replace(/\s+/g," ").replace(/^\s+|\s+$/g,"")}function sa(a,b){b&&(a.classList?a.classList.add(b):-1<ra(a.className).indexOf(b)||(a.className=ra(a.className+" "+b)))}
function A(a,b){b&&(a.classList?a.classList.remove(b):a.className=a.className.replace(RegExp("(^|\\s)"+b+"(?:\\s|$)"),"$1"))}function ta(a,b){if("string"===typeof b){var c=!1;do c=ka.call(a,b);while(!c&&(a=a.parentNode)&&a.ownerDocument);return c?a:!1}return a===b||b.contains(a)?b:!1}
function B(a,b){if("undefined"!==typeof a){"function"===typeof b&&(b={dc:b});var c={},d;for(d in la)c[d]=b[d]||la[d];d=c.Rd||document.body;var e,f,k,m,s,t=!1,x=!1,u=c.jc,l=c.kc,z,w=c.Gc,v,G=c.Nc,n=c.Oc,p,r=c.oc,q=function(b){ta(b.target,a)?b.preventDefault():k&&m&&25>Math.abs(b.clientX-k)&&25>Math.abs(b.clientY-m)&&(b.stopPropagation(),b.preventDefault())};d.addEventListener(ma,function(b){var d=ta(qa(b),a);if(d){l?(clearTimeout(z),z=setTimeout(function(){sa(d,u)},l)):sa(d,u);w&&d==f&&clearTimeout(v);
k=b.clientX;m=b.clientY;if(!k||!m){var q=b.targetTouches[0];k=q.clientX;m=q.clientY}e=d;x=t=!1;s=G?d.getBoundingClientRect():null;n&&(clearTimeout(p),G=!1,p=setTimeout(function(){G=!0},n));c.gb.call(e,b)}},!1);d.addEventListener(na,function(a){if(e){G?a.preventDefault():clearTimeout(z);var b=a.target,d=a.clientX,f=a.clientY;if(!b||!d||!f){var q=a.changedTouches[0];d||(d=q.clientX);f||(f=q.clientY);b||(b=pa(d,f))}G?d>s.left-r&&d<s.right+r&&f>s.top-r&&f<s.bottom+r?(x=!1,sa(e,u)):(x=!0,A(e,u)):!t&&10<
Math.abs(f-m)&&(t=!0,A(e,u));c.La.call(b,a)}},!1);d.addEventListener(oa,function(a){if(e){clearTimeout(z);if(w){l&&!t&&sa(e,u);var b=e;v=setTimeout(function(){A(b,u)},w)}else A(e,u);c.fb.call(e,a);var d=3==a.which||2==a.button;t||x||d||c.dc.call(e,a);f=e;e=null;setTimeout(function(){k=m=null},400)}},!1);d.addEventListener("touchcancel",function(){e&&(A(e,u),e=k=m=null)},!1);c.mc||d.addEventListener("click",q,!1)}};var C,ua,va,wa,D,xa;Object.size=Object.size||function(a){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b};Object.indexOf=Object.indexOf||function(a,b){var c=0,d;for(d in a)if(a.hasOwnProperty(d)){if(d===b)break;c++}return c};Object.Ic=Object.keyOf||function(a,b){b=parseInt(b,10);var c=0,d;for(d in a)if(a.hasOwnProperty(d)){if(c===b)return d;c++}return!1};Object.Cb=Object.merge||function(a,b){var c={},d;for(d in a)c[d]=a[d];for(d in b)c[d]=b[d];return c};
function E(a,b,c){return Math.max(a,Math.min(b,c))}
(function(){var a={a:"precision lowp float;uniform sampler2D image;varying vec2 a;void main(){gl_FragColor=texture2D(image,a);}",b:"attribute vec2 src_pixel,dest_pixel;uniform vec2 canvas_size,image_size;varying vec2 a;uniform float flip_y;void main(){a=src_pixel/image_size;gl_Position=vec4((dest_pixel/canvas_size*2.-1.)*vec2(1,flip_y),0,1);}",c:"precision mediump float;uniform sampler2D image;varying vec2 a;uniform float hue,saturation,brightness,contrast,temperature;const vec3 b=vec3(.93,.54,0);const mat3 c=mat3(.299,.587,.114,.596,-.274,-.322,.212,-.523,.311);const mat3 d=mat3(1,.956,.621,1,-.272,-.647,1,-1.105,1.702);void main(){vec4 e=texture2D(image,a);vec3 f,j;f=vec3(e.r<.5?2.*e.r*b.r:1.-2.*(1.-e.r)*(1.-b.r),e.g<.5?2.*e.g*b.g:1.-2.*(1.-e.g)*(1.-b.g),e.b<.5?2.*e.b*b.b:1.-2.*(1.-e.b)*(1.-b.b));e=vec4(mix(e.rgb,f,temperature),e.a);e.rgb+=brightness;if(contrast>0.)e.rgb=(e.rgb-.5)/(1.-contrast)+.5;else e.rgb=(e.rgb-.5)*(1.+contrast)+.5;float g,h,i,k,l;g=hue*3.14159265;h=sin(g);i=cos(g);j=(vec3(2.*i,-sqrt(3.)*h-i,sqrt(3.)*h-i)+1.)/3.;k=length(e.rgb);e.rgb=vec3(dot(e.rgb,j.xyz),dot(e.rgb,j.zxy),dot(e.rgb,j.yzx));l=(e.r+e.g+e.b)/3.;if(saturation>0.)e.rgb+=(l-e.rgb)*(1.-1./(1.001-saturation));else e.rgb+=(l-e.rgb)*-saturation;gl_FragColor=e;}",d:"precision mediump float;uniform sampler2D image;varying vec2 a;uniform float size,amount;void main(){vec4 b=texture2D(image,a);float c=distance(a,vec2(.5));if(amount>0.)b.rgb+=1.-smoothstep(.8,size*.799,c*(amount+size));else b.rgb*=smoothstep(-.8,size*.799,c*(amount+size));gl_FragColor=b;}",
f:"precision mediump float;uniform sampler2D image;uniform mat4 matrix;uniform float amount;varying vec2 a;void main(){vec4 b,c;b=texture2D(image,a)*matrix;c=texture2D(image,a);gl_FragColor=mix(b,c,1.-amount);}",h:"precision mediump float;\n#define Blend(base, blend, funcf) vec3(funcf(base.r, blend.r), funcf(base.g, blend.g), funcf(base.b, blend.b))\n#define BlendSoftLightf(base, blend) ((blend < 0.5) ? (2.0 * base * blend + base * base * (1.0 - 2.0 * blend)) : (sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend)))\n#define BlendSoftLight(base, blend) Blend(base, blend, BlendSoftLightf)\nuniform sampler2D image,texture;varying vec2 a;uniform float amount;uniform int blend_mode;void main(){vec3 b,c,d;b=texture2D(image,a).xyz;c=texture2D(texture,a).xyz;d=mix(b,BlendSoftLight(b,c),amount);gl_FragColor=vec4(d,1);}",
i:"precision mediump float;\n#define Blend(base, blend, funcf) vec3(funcf(base.r, blend.r), funcf(base.g, blend.g), funcf(base.b, blend.b))\n#define BlendSoftLightf(base, blend) ((blend < 0.5) ? (2.0 * base * blend + base * base * (1.0 - 2.0 * blend)) : (sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend)))\n#define BlendSoftLight(base, blend) Blend(base, blend, BlendSoftLightf)\nuniform sampler2D image,texture;varying vec2 a;uniform float amount;uniform int blend_mode;void main(){vec3 b,c,d;b=texture2D(image,a).xyz;c=texture2D(texture,a).xyz;d=mix(b,BlendSoftLight(b,c),amount);gl_FragColor=vec4(d,1);}"},
b={};C=function(a,c){b[a]||(b[a]=[]);b[a].push(c);if(ua(a))for(;0<b[a].length;)b[a].pop()(va(a));else if(1===b[a].length){var f=new XMLHttpRequest;f.open("GET",a,!0);f.onreadystatechange=function(){if(4===f.readyState&&200===f.status){var c=f.responseText,e=c.match(/#include\s+<([^>]+)/g);if(e&&0<e.length)for(var s=e.length,t=0,x=e.length;t<x;t++){var u=e[t].match(/<([^>]+)/);u[1]&&C(u[1],function(e){c=c.replace(RegExp("#include\\s+<"+u[1]+">"),e);s--;if(0>=s)for(wa(a,c);0<b[a].length;)b[a].pop()(c)})}else for(wa(a,
c);0<b[a].length;)b[a].pop()(c)}};f.send(null)}};ua=function(b){return!!a[b]};wa=function(b,c){a[b]=c};va=function(b){return a[b]};var c=Date.now();D=function(){return(c++).toString(36)};xa=function(a,b,c){c=c||"0";for(a=String(a);a.length<b;)a=c+a;return a}})();var ya=function(){var a={},b=!1,c=null,d={file:1,dir:100},e=null;a.U=function(){ba.getItem("dcf_key",function(f){b=!0;e=f?f:d;c&&(f=c,a.tb(f.kd,f.w),c=null)})};a.tb=function(d,k){if(b){var m="DCIM/"+e.dir+"MZLLA/",s="IMG_"+xa(e.file,4)+".jpg",t=d.get(m+s);t.onsuccess=function(){e.file=1;e.dir+=1;ba.setItem("dcf_key",e,function(){a.tb(d,k)})};t.onerror=function(){9999>e.file?e.file+=1:(e.file=1,e.dir+=1);ba.setItem("dcf_key",e,function(){k(m,s)})}}else c={kd:d,w:k}};return a}();function za(a){this.id=D();this.options=a.options||{};this.eb=a.ma||function(){};this.cc=a.bc||function(){};this.P=0;this.D();this.rb()}
za.prototype={rb:function(){},Hb:function(){},D:function(){function a(){if(0<b.ib.length){var d=b.Pb.shift(),m=b.ib.shift();f=document.createElement("div");f.id="optionMenu-"+b.id+"-"+d.charAt(0).toUpperCase()+d.slice(1);f.className="option-menu-item";f.setAttribute("data-name",d);b["tet"+d]=setTimeout(function(){b["tet"+d]=null},5E3);m.R(function(c){clearTimeout(b["tet"+d]);b["tet"+d]=null;this.style.backgroundImage='url("'+c+'")';a()}.bind(f));e.appendChild(f);B(f,t)}else{b.Pb=null;b.ib=null;k=
document.createElement("div");k.className="option-menu-item-clear";e.appendChild(k);document.body.appendChild(c);var m=b.Lc=e.querySelectorAll(".option-menu-item"),l=m.length;e.style.width=m[l-1].offsetLeft+m[l-1].offsetWidth+27+"px";b.Bb=!1;b.Jb=new window.IScroll("#"+b.id+"-wrapper",{scrollX:!0,scrollY:!1,onScrollMove:function(){b.Bb=!0},onScrollEnd:function(){b.Bb=!1}});b.cc&&b.cc()}}var b=this,c,d,e,f,k,m,s=b.options;c=document.createElement("div");c.className="option-menu";c.style.width=window.innerWidth-
20+"px";d=document.createElement("div");d.id=b.id+"-wrapper";d.className="option-menu-wrapper";c.appendChild(d);e=document.createElement("div");e.className="option-menu-scroller";d.appendChild(e);d=document.createElement("div");d.className="option-menu-fade-out-left";d.innerHTML="&#9666;";c.appendChild(d);d=document.createElement("div");d.className="option-menu-fade-out-right";d.innerHTML="&#9656;";c.appendChild(d);var t=b.Qc.bind(b);b.ib=[];b.Pb=[];for(m in s)s.hasOwnProperty(m)&&(b.Pb.push(m),b.ib.push(s[m]));
a();b.S=c},Qc:function(a){var b=this,c=b.Lc,d,e;clearTimeout(b.rc);b.rc=setTimeout(function(){if(!b.Bb&&a&&a.target&&!a.target.classList.contains("current")){d=0;for(e=c.length;d<e;d++)c[d].classList.contains("current")&&c[d].classList.remove("current");a.target.classList.add("current");b.eb&&b.eb(a.target.getAttribute("data-name"))}},100)},n:function(){this.Hb();this.Jb&&(this.Jb.destroy(),this.Jb=null);this.S&&(this.S.remove(),delete this.S)}};function F(a){this.id=D();this.g=a.g||{};this.eb=a.ma||function(){};this.O=a.O||document.body;this.ac=0;this.Ka=25;this.Ea=null;a=[];for(var b in this.g)this.g.hasOwnProperty(b)&&a.push(b);this.P=a[Math.floor((a.length-1)/2)];1<a.length&&this.D();Aa(this);this.rb()}
F.prototype={rb:function(){var a=this,b=0,c=0,d=!1;a.gb=function(d){g?(d=d.changedTouches,b=d[0].pageX,c=d[0].pageY):(b=d.clientX,c=d.clientY);a.O.addEventListener(g?"touchmove":"mousemove",a.La,!1)};a.La=function(e){var f;g?(e=e.changedTouches,f=e[0].pageX-b,e=e[0].pageY-c):(f=e.clientX-b,e=e.clientY-c);if(1===d||!1===d&&20<Math.abs(f))b=f+b,0!==f&&Ba(a,0>f?-1:1),d=1;a.e&&(2===d||!1===d&&20<Math.abs(e))&&(!1===d&&(d=2,c=e+c,e=0,a.show()),a.move(e))};a.fb=function(){a.O.removeEventListener(g?"touchmove":
"mousemove",a.La,!1);a.B();d=!1};a.O.addEventListener(g?"touchstart":"mousedown",a.gb,!1);a.O.addEventListener(g?"touchend":"mouseup",a.fb,!1)},Hb:function(){this.O.removeEventListener(g?"touchstart":"mousedown",this.gb,!1);this.O.removeEventListener(g?"touchmove":"mousemove",this.La,!1);this.O.removeEventListener(g?"touchend":"mouseup",this.fb,!1)},move:function(a){var b=this.g,c=Object.size(b),d=this.e,e=window.innerHeight/2,f=this.Ka/2;a=this.ac+a;c=e-c*this.Ka+f;f=e-f;a<c?a=c:a>f&&(a=f);d.style.top=
a+"px";f=d=this.P;d=Object.Ic(b,Math.floor((e-a)/this.Ka));!1!==d&&d!==f&&(document.getElementById("propertyMenu-"+this.id+"-"+f.charAt(0).toUpperCase()+f.slice(1)).classList.remove("current"),document.getElementById("propertyMenu-"+this.id+"-"+d.charAt(0).toUpperCase()+d.slice(1)).classList.add("current"),this.P=d,Ca(this))},show:function(){var a=this.e,b=Object.indexOf(this.g,this.P);this.ac=window.innerHeight/2-b*this.Ka-this.Ka/2;a.style.left=(window.innerWidth-a.offsetWidth)/2+"px";document.getElementById("propertyMenu-"+
this.id+"-"+this.P.charAt(0).toUpperCase()+this.P.slice(1)).classList.add("current");this.e.style.visibility="visible"},B:function(){this.e&&(this.e.style.visibility="hidden")},D:function(){var a,b,c,d=this.g;a=document.createElement("div");a.className="select-menu";for(c in d)if(d.hasOwnProperty(c)){var e=d[c];b=document.createElement("div");b.id="propertyMenu-"+this.id+"-"+c.charAt(0).toUpperCase()+c.slice(1);b.className="select-menu-item";b.textContent=navigator.q.get(e.label);a.appendChild(b)}a.style.visibility=
"hidden";document.body.appendChild(a);this.e=a},n:function(){this.Hb();this.e&&(this.e.remove(),delete this.e);this.Ea&&(this.Ea.remove(),delete this.Ea)}};
function Ca(a){var b=a.g,c=Math.round(b[a.P].l),d=a.Ea;d.innerHTML=navigator.q.get(b[a.P].label)+"&#160;"+(0<c?"+":"")+c;0<c?(a=c/b[a.P].max*15,da||ea?d.style.backgroundPosition=a+"rem 0":(d.style.nc=15-a+"rem 1.8rem, "+a+"rem 1.8rem",d.style.backgroundPosition=a+"rem 0, 0 0")):(a=c/b[a.P].min*15,da||ea?d.style.backgroundPosition=-a+"rem 0":(d.style.nc=15-a+"rem 1.8rem, "+a+"rem 1.8rem",d.style.backgroundPosition="0 0, "+(15-a)+"rem 0"))}
function Aa(a){var b;b=document.createElement("div");b.className="top-label";document.body.appendChild(b);a.Ea=b;Ca(a)}function Ba(a,b){var c=a.g[a.P];c.l+=b*c.W;c.l<c.min&&(c.l=c.min);c.l>c.max&&(c.l=c.max);Ca(a);clearTimeout(a.Pc);a.Pc=setTimeout(function(){a.eb()},30)};var H={ob:{}},H=H||{};
(function(){function a(a,b){var c=(a&65535)+(b&65535);return(a>>16)+(b>>16)+(c>>16)<<16|c&65535}function b(b,c,d,e,f,k){return a(a(a(c,b),a(e,k))<<f|a(a(c,b),a(e,k))>>>32-f,d)}function c(a,c,d,e,f,k,m){return b(c&d|~c&e,a,c,f,k,m)}function d(a,c,d,e,f,k,m){return b(c&e|d&~e,a,c,f,k,m)}function e(a,c,d,e,f,k,m){return b(d^(c|~e),a,c,f,k,m)}function f(f,k){f[k>>5]|=128<<k%32;f[(k+64>>>9<<4)+14]=k;var l,m,s,v,t,n=1732584193,p=-271733879,r=-1732584194,q=271733878;for(l=0;l<f.length;l+=16)m=n,s=p,v=r,
t=q,n=c(n,p,r,q,f[l],7,-680876936),q=c(q,n,p,r,f[l+1],12,-389564586),r=c(r,q,n,p,f[l+2],17,606105819),p=c(p,r,q,n,f[l+3],22,-1044525330),n=c(n,p,r,q,f[l+4],7,-176418897),q=c(q,n,p,r,f[l+5],12,1200080426),r=c(r,q,n,p,f[l+6],17,-1473231341),p=c(p,r,q,n,f[l+7],22,-45705983),n=c(n,p,r,q,f[l+8],7,1770035416),q=c(q,n,p,r,f[l+9],12,-1958414417),r=c(r,q,n,p,f[l+10],17,-42063),p=c(p,r,q,n,f[l+11],22,-1990404162),n=c(n,p,r,q,f[l+12],7,1804603682),q=c(q,n,p,r,f[l+13],12,-40341101),r=c(r,q,n,p,f[l+14],17,-1502002290),
p=c(p,r,q,n,f[l+15],22,1236535329),n=d(n,p,r,q,f[l+1],5,-165796510),q=d(q,n,p,r,f[l+6],9,-1069501632),r=d(r,q,n,p,f[l+11],14,643717713),p=d(p,r,q,n,f[l],20,-373897302),n=d(n,p,r,q,f[l+5],5,-701558691),q=d(q,n,p,r,f[l+10],9,38016083),r=d(r,q,n,p,f[l+15],14,-660478335),p=d(p,r,q,n,f[l+4],20,-405537848),n=d(n,p,r,q,f[l+9],5,568446438),q=d(q,n,p,r,f[l+14],9,-1019803690),r=d(r,q,n,p,f[l+3],14,-187363961),p=d(p,r,q,n,f[l+8],20,1163531501),n=d(n,p,r,q,f[l+13],5,-1444681467),q=d(q,n,p,r,f[l+2],9,-51403784),
r=d(r,q,n,p,f[l+7],14,1735328473),p=d(p,r,q,n,f[l+12],20,-1926607734),n=b(p^r^q,n,p,f[l+5],4,-378558),q=b(n^p^r,q,n,f[l+8],11,-2022574463),r=b(q^n^p,r,q,f[l+11],16,1839030562),p=b(r^q^n,p,r,f[l+14],23,-35309556),n=b(p^r^q,n,p,f[l+1],4,-1530992060),q=b(n^p^r,q,n,f[l+4],11,1272893353),r=b(q^n^p,r,q,f[l+7],16,-155497632),p=b(r^q^n,p,r,f[l+10],23,-1094730640),n=b(p^r^q,n,p,f[l+13],4,681279174),q=b(n^p^r,q,n,f[l],11,-358537222),r=b(q^n^p,r,q,f[l+3],16,-722521979),p=b(r^q^n,p,r,f[l+6],23,76029189),n=b(p^
r^q,n,p,f[l+9],4,-640364487),q=b(n^p^r,q,n,f[l+12],11,-421815835),r=b(q^n^p,r,q,f[l+15],16,530742520),p=b(r^q^n,p,r,f[l+2],23,-995338651),n=e(n,p,r,q,f[l],6,-198630844),q=e(q,n,p,r,f[l+7],10,1126891415),r=e(r,q,n,p,f[l+14],15,-1416354905),p=e(p,r,q,n,f[l+5],21,-57434055),n=e(n,p,r,q,f[l+12],6,1700485571),q=e(q,n,p,r,f[l+3],10,-1894986606),r=e(r,q,n,p,f[l+10],15,-1051523),p=e(p,r,q,n,f[l+1],21,-2054922799),n=e(n,p,r,q,f[l+8],6,1873313359),q=e(q,n,p,r,f[l+15],10,-30611744),r=e(r,q,n,p,f[l+6],15,-1560198380),
p=e(p,r,q,n,f[l+13],21,1309151649),n=e(n,p,r,q,f[l+4],6,-145523070),q=e(q,n,p,r,f[l+11],10,-1120210379),r=e(r,q,n,p,f[l+2],15,718787259),p=e(p,r,q,n,f[l+9],21,-343485551),n=a(n,m),p=a(p,s),r=a(r,v),q=a(q,t);return[n,p,r,q]}function k(a){var b,c="";for(b=0;b<32*a.length;b+=8)c+=String.fromCharCode(a[b>>5]>>>b%32&255);return c}function m(a){var b,c=[];c[(a.length>>2)-1]=void 0;for(b=0;b<c.length;b+=1)c[b]=0;for(b=0;b<8*a.length;b+=8)c[b>>5]|=(a.charCodeAt(b/8)&255)<<b%32;return c}function s(a){var b=
"",c,d;for(d=0;d<a.length;d+=1)c=a.charCodeAt(d),b+="0123456789abcdef".charAt(c>>>4&15)+"0123456789abcdef".charAt(c&15);return b}function t(a,b){var c=unescape(encodeURIComponent(a)),d=unescape(encodeURIComponent(b)),e=m(c),s=[],t=[];s[15]=t[15]=void 0;16<e.length&&(e=f(e,8*c.length));for(c=0;16>c;c+=1)s[c]=e[c]^909522486,t[c]=e[c]^1549556828;d=f(s.concat(m(d)),512+8*d.length);return k(f(t.concat(d),640))}H.ob=function(a,b,c){return b?c?t(b,a):s(t(b,a)):c?k(f(m(unescape(encodeURIComponent(a))),8*
unescape(encodeURIComponent(a)).length)):s(k(f(m(unescape(encodeURIComponent(a))),8*unescape(encodeURIComponent(a)).length)))}})();var I={ic:"ip-oit",Y:"ip-wit",hc:"ip-its",sc:null,canvas:null,ya:null,Fb:null,Da:null,ia:null,ea:null,X:{},o:[],Ga:[],aa:1,m:{},Ua:null,Eb:null,U:function(a,b,c){c=c||{};I.Eb=c.fe||function(){};I.canvas=a;I.Fb=b;I.Kc(c);a.addEventListener("webglcontextlost",function(a){a.preventDefault()},!1);a.addEventListener("webglcontextrestored",I.Sc.bind(I),!1);I.t(function(){I.fc()})},t:function(a){a&&(I.t()?a():setTimeout(function(){I.t(a)},100));return null!==I.ia&&null!==I.ea},fc:function(){var a=I.ya=I.canvas.getContext("webgl",
{preserveDrawingBuffer:!0})||I.canvas.getContext("experimental-webgl",{preserveDrawingBuffer:!0});I.sc=a.getExtension("WEBGL_compressed_texture_s3tc")||a.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");var b=document.createElement("canvas");b.setAttribute("moz-opaque","");b.width=I.canvas.width;b.height=I.canvas.height;b.getContext("2d").drawImage(I.Fb,0,0,I.canvas.width,I.canvas.height);I.Da=b;a.bindTexture(a.TEXTURE_2D,null);a.bindRenderbuffer(a.RENDERBUFFER,
null);a.bindFramebuffer(a.FRAMEBUFFER,null);for(var c in I.m)if(I.m.hasOwnProperty(c)){var d=I.m[c],b=I.createProgram(d);a.useProgram(b);var e=a.getUniformLocation(b,"flip_y");a.uniform1f(e,-1);for(var f in d.g)if(d.g.hasOwnProperty(f)){var k=a.getUniformLocation(b,f);null!==k&&(d.ba[f]=k)}var d=a.createBuffer(),k=a.createBuffer(),m=a.getAttribLocation(b,"src_pixel"),s=a.getAttribLocation(b,"dest_pixel"),t=a.getUniformLocation(b,"canvas_size");a.uniform2f(a.getUniformLocation(b,"image_size"),I.canvas.width,
I.canvas.height);a.uniform2f(t,I.canvas.width,I.canvas.height);I.cb(d,0,0,I.canvas.width,I.canvas.height);a.enableVertexAttribArray(m);a.vertexAttribPointer(m,2,a.FLOAT,!1,0,0);I.cb(k,0,0,I.canvas.width,I.canvas.height);a.enableVertexAttribArray(s);a.vertexAttribPointer(s,2,a.FLOAT,!1,0,0);I.m[c].L=b;I.m[c].Q=e}I.Ua=null;null!==I.Eb&&I.Eb()},Kb:function(a){I.Bc(function(b){I.Xc(b,a)})},Bc:function(a){var b=document.createElement("canvas");b.setAttribute("moz-opaque","");b.width=I.canvas.width;b.height=
I.canvas.height;b.getContext("2d").drawImage(I.canvas,0,0,b.width,b.height);a&&window.requestAnimationFrame(function(){a(b)})},Xc:function(a,b){I.Da=a;b&&window.requestAnimationFrame(function(){b()})},ub:function(a){var b=I.getContext();a=a||{};var c=a.g||{};if(b){var d=I.createProgram(a);b.useProgram(d);var e={},f;for(f in c)if(c.hasOwnProperty(f)){var k=b.getUniformLocation(d,f);null!==k&&(e[f]=k)}f=b.getUniformLocation(d,"flip_y");b.uniform1f(f,-1);a={ra:a.ra||null,sa:a.sa||null,C:a.C||null,K:a.K||
null,L:d,ba:e,g:c,Q:f,v:{}};a.v.ua=I.createTexture(0);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,I.Da);b.bindTexture(b.TEXTURE_2D,null);c=b.createBuffer();e=b.createBuffer();f=b.getAttribLocation(d,"src_pixel");var k=b.getAttribLocation(d,"dest_pixel"),m=b.getUniformLocation(d,"canvas_size");b.uniform2f(b.getUniformLocation(d,"image_size"),I.canvas.width,I.canvas.height);b.uniform2f(m,I.canvas.width,I.canvas.height);I.cb(c,0,0,I.canvas.width,I.canvas.height);b.enableVertexAttribArray(f);
b.vertexAttribPointer(f,2,b.FLOAT,!1,0,0);I.cb(e,0,0,I.canvas.width,I.canvas.height);b.enableVertexAttribArray(k);b.vertexAttribPointer(k,2,b.FLOAT,!1,0,0)}else a={ra:a.ra||null,sa:a.sa||null,C:a.C||null,K:a.K||null,g:c,v:{}};return a},zc:function(){null===I.Ua&&(I.Ua=I.ub());return I.Ua},Ma:function(a){var b=I.aa++;I.m[b]=I.ub(a);return b},na:function(a,b){if(a in I.m){var c=I.m[a];I.getContext().deleteProgram(c.L);delete I.m[a];c=document.createElement("canvas");c.setAttribute("moz-opaque","");
c.width=I.canvas.width;c.height=I.canvas.height;c.getContext("2d").drawImage(I.Fb,0,0,I.canvas.width,I.canvas.height);I.Da=c;I.Xa({w:function(){b&&b(!0)}})}b&&b(!1)},xb:function(a){var b=I.getContext(),c=a.g,d=a.ba||{};b.useProgram(a.L);for(var e in c)if(c.hasOwnProperty(e)){var f=c[e],k=d[e];if(void 0===k||null===k)k=a.ba[e]=b.getUniformLocation(a.L,e);if(f===I.ic||f===I.Y)b.activeTexture(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,a.v.ua),b.uniform1i(k,0);else if(f===I.hc)b.uniform2fv(k,I.Ac());else{var m=
Object.prototype.toString.call(f);if("[object Array]"===m||"[object Float32Array]"===m)if(m=f.length,1===m)b.uniform1fv(k,new Float32Array(f));else if(2===m)b.uniform2fv(k,new Float32Array(f));else if(3===m)b.uniform3fv(k,new Float32Array(f));else if(4===m)b.uniform4fv(k,new Float32Array(f));else if(9===m)b.uniform1fv(k,new Float32Array(f));else if(16===m)b.uniformMatrix4fv(k,!1,new Float32Array(f));else throw Error("ImageProcessor: Dont't know how to load uniform \""+e+'" of length '+f.length);else if("[object Number]"===
Object.prototype.toString.call(f))b.uniform1f(k,f);else if(f instanceof Image||f instanceof HTMLCanvasElement)a.v[e]?(b.activeTexture(b.TEXTURE0+1),b.bindTexture(b.TEXTURE_2D,a.v[e])):(a.v[e]=I.createTexture(1),b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,f)),b.uniform1i(k,1);else throw Error('ImageProcessor: Attempted to set uniform "'+e+'" to invalid value '+(f||"undefined").toString());}}b.drawArrays(b.TRIANGLES,0,6)},D:function(a){var b=I.getContext(),c=null,d={};a=a||{};var c=a.aa&&
I.m[a.aa]?I.m[a.aa]:I.zc(),e=I.canvas.width,f=I.canvas.height;a.H&&(e=a.H.width,f=a.H.height);null!==c&&(c.g=I.Db(c.g,a.g),b.useProgram(c.L),c.v.ua?b.bindTexture(b.TEXTURE_2D,c.v.ua):(c.v.ua=I.createTexture(0),b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,I.Da)),null!==c.Q&&-1!==b.getUniform(c.L,c.Q)&&b.uniform1f(c.Q,-1),I.Lb(null,e,f),I.xb(c),b.bindTexture(b.TEXTURE_2D,null),a.H&&(d.H=I.canvas.toDataURL()));a.w&&window.requestAnimationFrame(function(){a.w(d)})},Xa:function(a){var b=I.getContext(),
c={};a=a||{};var d=I.canvas.width,e=I.canvas.height;a.H&&(d=a.H.width,e=a.H.height);var f=Object.keys(I.m);if(0===f.length)I.D(a);else{var k=function(){var m=f.shift(),m=I.m[m];m.g=I.Db(m.g,a.g);b.useProgram(m.L);m.v.ua?b.bindTexture(b.TEXTURE_2D,m.v.ua):(m.v.ua=I.createTexture(0),b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,I.Da));null!==m.Q&&-1!==b.getUniform(m.L,m.Q)&&b.uniform1f(m.Q,-1);I.Lb(null,d,e);I.xb(m);b.bindTexture(b.TEXTURE_2D,null);0<f.length?window.requestAnimationFrame(function(){I.Kb(k)}):
(a.H&&(c.H=I.canvas.toDataURL()),a.w&&window.requestAnimationFrame(function(){I.Kb(function(){a.w(c)})}))};k()}},yb:function(a){var b=I.getContext(),c=null,d={};a=a||{};var c=I.ub(a),e=I.canvas.width,f=I.canvas.height;a.H&&(e=a.H.width,f=a.H.height);null!==c&&(c.g=I.Db(c.g,a.g),-1!==b.getUniform(c.L,c.Q)&&b.uniform1f(c.Q,-1),I.Lb(null,e,f),I.xb(c),b.bindTexture(b.TEXTURE_2D,null),a.H&&(d.H=I.canvas.toDataURL()));a.w&&window.requestAnimationFrame(function(){a.w(d)})},Ud:function(){return[I.oa.width,
I.oa.height]},Ac:function(){return[I.canvas.width,I.canvas.height]},Ab:function(){return I.canvas.width},zb:function(){return I.canvas.height},Vd:function(){return I.ge},R:function(a,b,c){var d=document.createElement("canvas");d.setAttribute("moz-opaque","");d.width=a;d.height=b;var e=I.canvas.width,f=I.canvas.height,k=e,m=f,s=0,t=0,x=a/b;e/f>x?(k=f*x,s=(e-k)/2):(m=e/x,t=(f-m)/2);d.getContext("2d").drawImage(I.canvas,s,t,k,m,0,0,a,b);c&&window.requestAnimationFrame(function(){c(d.toDataURL())})},
getBlob:function(a){I.canvas.toBlob(a,"image/jpeg")},reset:function(){var a=I.getContext(),b;for(b in I.m)if(I.m.hasOwnProperty(b)){var c=I.m[b],d;for(d in c.ba)c.ba.hasOwnProperty(d)&&delete c.ba[d];for(d in c.v)c.v.hasOwnProperty(d)&&delete c.v[d];a.deleteProgram(c.L);delete c.L;delete c.Q}I.Wb();I.Tb();I.Ub();I.ia=null;I.ea=null;I.canvas=null;I.oa=null;I.ya=null},Kc:function(a){a.ia?I.ia=a.ia:C("b",function(a){I.ia=a});a.ea?I.ea=a.ea:C("a",function(a){I.ea=a})},yc:function(a){a.ra||(a.ra=I.ia,
a.sa="v");a.C||(a.C=I.ea,a.K="f");a.sa=a.sa||H.ob(a.ra);a.K=a.K||H.ob(a.C);return a},Db:function(a,b){var c={},d;for(d in a)c[d]=a[d];for(d in b)c[d]=b[d];return c},createShader:function(a,b,c){var d,e=I.getContext();if(I.X[c])d=I.X[c];else{d=e.createShader(a);if(null===d&&!e.isContextLost())throw Error("ImageProcessor: Error creating the shader with shader type: "+a);e.shaderSource(d,b);e.compileShader(d);if(!e.getShaderParameter(d,e.COMPILE_STATUS)&&!e.isContextLost())throw b=e.getShaderInfoLog(d),
e.deleteShader(d),Error("ImageProcessor: Error compiling "+(a===e.VERTEX_SHADER?"vertex":"fragment")+" shader: "+b);I.X[c]=d}return d},createProgram:function(a){var b=I.getContext(),c,d;a=I.yc(a);c=a.sa;d=a.K;c=I.createShader(b.VERTEX_SHADER,a.ra,c);d=I.createShader(b.FRAGMENT_SHADER,a.C,d);a=b.createProgram();b.attachShader(a,c);b.attachShader(a,d);b.linkProgram(a);if(!b.getProgramParameter(a,b.LINK_STATUS)&&!b.isContextLost())throw c=b.getProgramInfoLog(a),b.deleteProgram(a),Error("ImageProcessor: Error linking GLSL program:"+
c);return a},createTexture:function(a){var b=I.getContext(),c=b.createTexture();b.activeTexture(b.TEXTURE0+a);b.bindTexture(b.TEXTURE_2D,c);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);return c},cb:function(a,b,c,d,e){var f=I.getContext();f.bindBuffer(f.ARRAY_BUFFER,a);f.bufferData(f.ARRAY_BUFFER,
new Float32Array([b,c,b+d,c,b,c+e,b,c+e,b+d,c,b+d,c+e]),f.STATIC_DRAW)},Lb:function(a,b,c){var d=I.getContext();d.bindFramebuffer(d.FRAMEBUFFER,a);d.viewport(0,0,b,c)},getContext:function(){return I.ya},Sc:function(){for(var a in I.X)I.X.hasOwnProperty(a)&&delete I.X[a];I.o.length=0;I.Ga.length=0;I.fc();I.Xa()},Ub:function(){var a=I.getContext();if(a)for(var b in I.X)I.X.hasOwnProperty(b)&&(a.deleteShader(I.X[b]),delete I.X[b])},Wb:function(){var a=I.getContext();if(a)for(var b=0,c=I.o.length;b<c;b++)"undefined"!==
typeof I.o[b]&&a.deleteTexture(I.o[b]),I.o[b]=null;I.o.length=0},Tb:function(){var a=I.getContext();if(a)for(var b=0,c=I.Ga.length;b<c;b++)a.deleteFramebuffer(I.Ga[b]),I.Ga[b]=null;I.Ga.length=0},Vb:function(a,b){delete I.m[a].v[b]},n:function(){var a=I.getContext(),b;for(b in I.m)if(I.m.hasOwnProperty(b)){var c=I.m[b],d;for(d in c.ba)c.ba.hasOwnProperty(d)&&delete c.ba[d];for(d in c.v)c.v.hasOwnProperty(d)&&delete c.v[d];a.deleteProgram(I.Xd.L);delete c.L;delete c.Q;delete I.m[b]}I.Wb();I.Tb();I.Ub();
I.ia=null;I.ea=null;I.canvas=null;I.oa=null;I.ya=null;I.Ob&&a.isBuffer(I.Ob)&&a.deleteBuffer(I.Ob);I.wb&&a.isBuffer(I.wb)&&a.deleteBuffer(I.wb);delete I.Ob;delete I.wb}};function J(){var a=this;a.id=D();a.j=null;a.r={I:{l:100,W:2,min:0,max:100,label:"amount"}};a.k=1;a.e=null;a.t=!1;a.xa=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];a.Wa=null;C("f",function(b){a.Wa=b;a.t=null!==a.Wa&&null!==a.G})}
J.prototype={constructor:J,label:"",show:function(){var a=this;clearTimeout(a.Qa);a.t?(a.e=new F({O:document.getElementById("editLayerScreen"),g:a.r,ma:function(){a.k=a.r.I.l/a.r.I.max;a.drawImage()}}),a.j=I.Ma({K:"b",C:a.Wa,g:{image:I.Y,amount:a.k,matrix:a.xa}}),a.drawImage()):a.Qa=setTimeout(function(){a.show(callback)},100)},B:function(a){null!==this.j&&a&&(I.na(this.j),this.j=null);null!==this.e&&(this.e.n(),this.e=null)},drawImage:function(a,b){var c=this;clearTimeout(c.Z);null!==c.j?I.D(Object.Cb(b,
{aa:c.j,g:{amount:c.k},w:a})):c.Z=setTimeout(function(){c.drawImage(a)},100)},R:function(a){var b=this;clearTimeout(b.Ha);b.t?I.yb({K:"b",C:b.Wa,g:{image:I.Y,amount:b.k,matrix:b.xa},w:function(){I.R(36,36,function(c){b.B();a(c)})}}):b.Ha=setTimeout(function(){b.R(a)},100)},n:function(){null!==this.j&&I.na(this.j);null!==this.e&&(this.e.n(),this.e=null)}};function K(){this.k=1;this.xa=[0.65,0.25,0.1,0,0.65,0.25,0.1,0,0.65,0.25,0.1,0,0,0,0,1]}K.prototype=new J;K.prototype.constructor=K;K.prototype.label="effects-bw";function L(){this.k=1;this.xa=[1,0.25,0.65,0,0.1,1,0.65,0,0.1,0.25,1,0.1,0,0,0,1]}L.prototype=new J;L.prototype.constructor=L;L.prototype.label="effects-blue-steel";function M(){this.k=1;this.xa=[1,0.2,0.2,0.03,0.2,0.7,0.2,0.05,0.1,0,0.8,0,0,0,0,1]}M.prototype=new J;M.prototype.constructor=M;M.prototype.label="effects-faded";function N(){this.k=1;this.xa=[0.393,0.769,0.189,0,0.349,0.686,0.168,0,0.272,0.534,0.131,0,0,0,0,1]}N.prototype=new J;N.prototype.constructor=N;N.prototype.label="effects-sepia";h.md={};h.Adjustment=function(){var a=this;a.id=D();a.j=null;var b=a.r={jb:{l:0,W:2,min:-100,max:100,label:"adjustment-brightness"},kb:{l:0,W:2,min:-100,max:100,label:"adjustment-contrast"},pb:{l:0,W:2,min:-100,max:100,label:"adjustment-saturation"},qb:{l:0,W:1,min:-100,max:100,label:"adjustment-white-balance"},mb:{l:0,W:1,min:-100,max:100,label:"adjustment-hue"}};a.Mb=null;C("c",function(c){a.Mb=c;a.j=I.Ma({C:c,Yc:a.id,g:{image:I.Y,brightness:b.jb.l,contrast:b.kb.l,hue:b.mb.l,saturation:b.pb.l,temperature:b.qb.l}})})};
h.Adjustment.label="adjustment";
h.Adjustment.prototype={constructor:h.Adjustment,label:h.Adjustment.label,show:function(){var a=this;a.e=new F({g:a.r,ma:function(){a.drawImage()}})},B:function(){this.e.n()},drawImage:function(a){var b=this,c=b.r;clearTimeout(b.Z);null!==b.j?I.D({aa:b.j,g:{brightness:E(-1,c.jb.l/c.jb.max,1),contrast:E(-1,c.kb.l/c.kb.max,1),hue:E(-1,c.mb.l/c.mb.max,1),saturation:E(-1,c.pb.l/c.pb.max,1),temperature:E(-5E3,c.qb.l/c.qb.max,5E3)},w:a}):b.Z=setTimeout(function(){b.drawImage(a)},100)},n:function(){var a=
this;I.na(a.j,function(b){b&&a.e&&(a.e.n(),a.e=null)})}};h.Ld={};h.Vignette=function(){var a=this;a.id=D();a.j=null;a.r={I:{l:0,W:2,min:-100,max:100,label:"amount"},Sa:{l:0,W:2,min:-100,max:100,label:"center"}};a.Mb=null;C("d",function(b){a.Mb=b;a.j=I.Ma({C:b,Yc:a.id,g:{image:I.Y,amount:a.r.I.l/a.r.I.max,size:a.r.Sa.l/a.r.Sa.max}})})};h.Vignette.label="vignette";
h.Vignette.prototype={label:h.Vignette.label,show:function(){var a=this;a.e=new F({g:a.r,ma:function(){a.drawImage()}})},B:function(){this.e.n()},drawImage:function(a){var b=this,c=b.r;clearTimeout(b.Z);null!==b.j?I.D({aa:b.j,g:{amount:E(-1,c.I.l/c.I.max,1),size:E(-1,c.Sa.l/c.Sa.max,1)},w:a}):b.Z=setTimeout(function(){b.drawImage(a)},100)},n:function(){var a=this;I.na(a.j,function(b){b&&a.e&&(a.e.n(),a.e=null)})}};var Da;
(function(){function a(a,c){var f=document.createElement("canvas");b(a,f,c);return f.toDataURL("image/jpeg",c.quality||0.8)}function b(a,b,c){var k=a.naturalWidth,m=a.naturalHeight,s=c.width,t=c.height,x=b.getContext("2d");x.save();c=c.orientation;switch(c){case 5:case 6:case 7:case 8:b.width=t;b.height=s;break;default:b.width=s,b.height=t}b=b.getContext("2d");switch(c){case 2:b.translate(s,0);b.scale(-1,1);break;case 3:b.translate(s,t);b.rotate(Math.PI);break;case 4:b.translate(0,t);b.scale(1,-1);
break;case 5:b.rotate(0.5*Math.PI);b.scale(1,-1);break;case 6:b.rotate(0.5*Math.PI);b.translate(0,-t);break;case 7:b.rotate(0.5*Math.PI);b.translate(s,-t);b.scale(-1,1);break;case 8:b.rotate(-0.5*Math.PI),b.translate(-s,0)}b=a.naturalWidth;1048576<b*a.naturalHeight?(c=document.createElement("canvas"),c.width=c.height=1,c=c.getContext("2d"),c.drawImage(a,-b+1,0),b=0===c.getImageData(0,0,1,1).data[3]):b=!1;b&&(k/=2,m/=2);b=document.createElement("canvas");b.width=b.height=1024;c=b.getContext("2d");
var u;u=m;var l=document.createElement("canvas");l.width=1;l.height=u;l=l.getContext("2d");l.drawImage(a,0,0);for(var l=l.getImageData(0,0,1,u).data,z=0,w=u,v=u;v>z;)0===l[4*(v-1)+3]?w=v:z=v,v=w+z>>1;u=v/u;for(l=0;l<m;){z=l+1024>m?m-l:1024;for(w=0;w<k;)v=w+1024>k?k-w:1024,c.clearRect(0,0,1024,1024),c.drawImage(a,-w,-l),x.drawImage(b,0,0,v,z,Math.floor(w*s/k),Math.floor(l*t/m/u),Math.ceil(v*s/k),Math.ceil(z*t/m/u)),w+=1024;l+=1024}x.restore()}function c(a){if(a instanceof Blob){var b=new Image,c=window.URL&&
window.URL.createObjectURL?window.URL:window.webkitURL&&window.webkitURL.createObjectURL?window.webkitURL:null;if(!c)throw Error("No createObjectURL function found to create blob url");b.src=c.createObjectURL(a);a=b}if(!a.naturalWidth&&!a.naturalHeight){var k=this;a.onload=function(){var a=k.ab;if(a){k.ab=null;for(var b=0,c=a.length;b<c;b++)a[b]()}};this.ab=[]}this.hb=a}c.prototype.Ib=function(c,e){if(this.ab){var f=this;this.ab.push(function(){f.Ib(c,e)})}else{e=e||{};var k=this.hb.naturalWidth,
m=this.hb.naturalHeight,s=e.width,t=e.height,x=e.maxWidth,u=e.maxHeight;s&&!t?t=Math.floor(m*s/k):t&&!s?s=Math.floor(k*t/m):(s=k,t=m);x&&s>x&&(s=x,t=Math.floor(m*s/k));u&&t>u&&(t=u,s=Math.floor(k*t/m));var k={width:s,height:t},l;for(l in e)k[l]=e[l];l=c.tagName.toLowerCase();"img"===l?c.src=a(this.hb,k):"canvas"===l&&b(this.hb,c,k);"function"===typeof this.Tc&&this.Tc(c)}};Da=c})();function P(){var a=this;a.id=D();a.j=null;a.r={I:{l:100,W:2,min:0,max:100,label:"amount"}};a.k=1;a.s=13;a.G=null;a.e=null;a.t=!1;a.N=null;C("h",function(b){a.N=b;a.t=null!==a.N&&null!==a.G})}
P.prototype={constructor:P,label:"",show:function(){var a=this;clearTimeout(a.Qa);a.t?(a.e=new F({O:document.getElementById("editLayerScreen"),g:a.r,ma:function(){a.k=a.r.I.l/a.r.I.max;a.drawImage()}}),a.j=I.Ma({K:"a",C:a.N,g:{image:I.Y,texture:a.G,amount:a.k,blend_mode:a.s}}),a.drawImage()):a.Qa=setTimeout(function(){a.show(callback)},100)},B:function(a){null!==this.j&&a&&(I.na(this.j),this.j=null);null!==this.e&&(this.e.n(),this.e=null)},u:function(a){var b=this,c=document.createElement("img");
c.onload=function(){b.G=document.createElement("canvas");b.Gb=new Da(c);b.qa(I.Ab(),I.zb());b.t=null!==b.N&&null!==b.G};c.onerror=function(){c.removeAttribute("src");Q.Ca();Ea();throw Error("Effects.BaseBlend: Texture failed to load: "+a);};c.src=a},qa:function(a,b){var c=this.G;c.width=a;c.height=b;this.Gb.Ib(c,{width:c.width,height:c.height});null!==this.j&&I.Vb(this.j,"texture")},drawImage:function(a,b){var c=this;clearTimeout(c.Z);null!==c.j?I.D(Object.Cb(b,{aa:c.j,g:{amount:c.k},w:a})):c.Z=setTimeout(function(){c.drawImage(a)},
100)},R:function(a){var b=this;clearTimeout(b.Ha);b.t?I.yb({K:"a",C:b.N,g:{image:I.Y,texture:b.G,amount:b.k,blend_mode:b.s},w:function(){I.R(36,36,function(c){b.B();a(c)})}}):b.Ha=setTimeout(function(){b.R(a)},100)},n:function(){null!==this.j&&I.na(this.j);null!==this.e&&(this.e.n(),this.e=null)}};function R(){this.k=1;this.s=13;this.u("Bessa/Effects/Blend/Amaro.jpg")}R.prototype=new P;R.prototype.constructor=R;R.prototype.label="effects-amaro";function T(){this.k=1;this.s=13;this.u("Bessa/Effects/Blend/Burn.jpg")}T.prototype=new P;T.prototype.constructor=T;T.prototype.label="effects-burn";function U(){this.k=1;this.s=13;this.u("Bessa/Effects/Blend/ColdLines.jpg")}U.prototype=new P;U.prototype.constructor=U;U.prototype.label="effects-cold-lines";function Fa(){this.k=1;this.s=13;this.u("Bessa/Effects/Blend/ColorCut.jpg")}Fa.prototype=new P;Fa.prototype.constructor=Fa;Fa.prototype.label="effects-color-cut";function Ga(){this.k=1;this.s=13;this.u("Bessa/Effects/Blend/Colors.jpg")}Ga.prototype=new P;Ga.prototype.constructor=Ga;Ga.prototype.label="effects-colors";function Ha(){this.k=1;this.s=13;this.u("Bessa/Effects/Blend/CoolFlowers.jpg")}Ha.prototype=new P;Ha.prototype.constructor=Ha;Ha.prototype.label="effects-cool-flowers";function Ia(){this.k=1;this.s=13;this.u("Bessa/Effects/Blend/Drop.jpg")}Ia.prototype=new P;Ia.prototype.constructor=Ia;Ia.prototype.label="effects-drop";function Ja(){this.k=1;this.u("Bessa/Effects/Blend/Rise.jpg")}Ja.prototype=new P;Ja.prototype.constructor=Ja;Ja.prototype.label="effects-rise";function Ka(){this.k=1;this.s=13;this.u("Bessa/Effects/Blend/ShadesOfGreen.jpg")}Ka.prototype=new P;Ka.prototype.constructor=Ka;Ka.prototype.label="effects-shades-of-green";function La(){this.k=1;this.s=13;this.u("Bessa/Effects/Blend/Water.jpg")}La.prototype=new P;La.prototype.constructor=La;La.prototype.label="effects-water";function Ma(){this.k=1;this.u("Bessa/Effects/Blend/XPro2.jpg")}Ma.prototype=new P;Ma.prototype.constructor=Ma;Ma.prototype.label="effects-x-pro-2";new P;function V(){var a=this;a.id=D();a.j=null;a.r={I:{l:100,W:2,min:0,max:100,label:"amount"}};a.k=1;a.s=13;a.G=null;a.e=null;a.t=!1;a.N=null;C("i",function(b){a.N=b;a.t=null!==a.N&&null!==a.G})}
V.prototype={constructor:V,label:"",show:function(){var a=this;clearTimeout(a.Qa);a.t?(a.e=new F({O:document.getElementById("editLayerScreen"),g:a.r,ma:function(){a.k=a.r.I.l/a.r.I.max;a.drawImage()}}),a.j=I.Ma({K:"a",C:a.N,g:{image:I.Y,texture:a.G,amount:a.k,blend_mode:a.s}}),a.drawImage()):a.Qa=setTimeout(function(){a.show(callback)},100)},B:function(a){null!==this.j&&a&&(I.na(this.j),this.j=null);null!==this.e&&(this.e.n(),this.e=null)},u:function(a){var b=this,c=document.createElement("img");
c.onload=function(){b.G=document.createElement("canvas");b.Gb=new Da(c);b.qa(I.Ab(),I.zb());b.t=null!==b.N&&null!==b.G};c.onerror=function(){c.removeAttribute("src");Q.Ca();Ea();throw Error("Textures.BaseBlend: Texture failed to load: "+a);};c.src=a},qa:function(a,b){var c=this.G;c.width=a;c.height=b;this.Gb.Ib(c,{width:c.width,height:c.height});null!==this.j&&I.Vb(this.j,"texture")},drawImage:function(a,b){var c=this;clearTimeout(c.Z);null!==c.j?I.D(Object.Cb(b,{aa:c.j,g:{amount:c.k},w:a})):c.Z=
setTimeout(function(){c.drawImage(a)},100)},R:function(a){var b=this;clearTimeout(b.Ha);b.t?I.yb({K:"a",C:b.N,g:{image:I.Y,texture:b.G,amount:b.k,blend_mode:b.s},w:function(){I.R(36,36,function(c){b.B();a(c)})}}):b.Ha=setTimeout(function(){b.R(a)},100)},n:function(){null!==this.j&&I.na(this.j);null!==this.e&&(this.e.n(),this.e=null)}};function Na(){this.k=1;this.s=13;this.u("Bessa/Textures/Blend/Dirty.jpg")}Na.prototype=new V;Na.prototype.constructor=Na;Na.prototype.label="textures-dirty";function Oa(){this.k=1;this.s=13;this.u("Bessa/Textures/Blend/GrainyScratches.jpg")}Oa.prototype=new V;Oa.prototype.constructor=Oa;Oa.prototype.label="textures-grainy-scratches";function Pa(){this.k=1;this.s=13;this.u("Bessa/Textures/Blend/Grunge.jpg")}Pa.prototype=new V;Pa.prototype.constructor=Pa;Pa.prototype.label="textures-grunge";function Qa(){this.k=1;this.s=13;this.u("Bessa/Textures/Blend/Rusty.jpg")}Qa.prototype=new V;Qa.prototype.constructor=Qa;Qa.prototype.label="textures-rusty";function Ra(){this.k=1;this.s=13;this.u("Bessa/Textures/Blend/Scratches.jpg")}Ra.prototype=new V;Ra.prototype.constructor=Ra;Ra.prototype.label="textures-scratches";function Sa(){this.k=1;this.s=13;this.u("Bessa/Textures/Blend/Stone.jpg")}Sa.prototype=new V;Sa.prototype.constructor=Sa;Sa.prototype.label="textures-stone";function Ta(){this.k=1;this.s=13;this.u("Bessa/Textures/Blend/WoodenScratches.jpg")}Ta.prototype=new V;Ta.prototype.constructor=Ta;Ta.prototype.label="textures-wooden-scratches";"remove"in Element.prototype||(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)});
(function(){function a(){window.MozActivity=function(a){var b=this;if("pick"===a.name){var e=document.createElement("input");e.type="file";e.style.display="none";a.data&&a.data.type&&(e.accept=a.data.type.join());e.addEventListener("change",function(a){a=a.target.files;if(0!==a.length&&(b.result={blob:a[0]},b.onsuccess))b.onsuccess()},!1);document.body.appendChild(e);e.click()}else"share"===a.name&&(window.open(URL.createObjectURL(a.data.Qd[0])),setTimeout(function(){if(b.onsuccess)b.onsuccess()},
100))};window.MozActivity.prototype={constructor:window.MozActivity}}try{new MozActivity({}),-1<navigator.userAgent.toLowerCase().indexOf("firefox/24")&&a()}catch(b){a()}})();navigator.mozSetMessageHandler||(navigator.mozSetMessageHandler=function(){return!1});
navigator.getDeviceStorage||(navigator.getDeviceStorage=function(){return{freeSpace:function(){var a={};setTimeout(function(){a.onsuccess&&(a.onsuccess.result=Number.POSITIVE_INFINITY,a.onsuccess())},100);return a},get:function(){var a={};setTimeout(function(){a.onsuccess&&(a.onsuccess.result=Number.POSITIVE_INFINITY,a.onsuccess())},100);return a},addNamed:function(){}}});
(function(){var a=0,b=["ms","moz","webkit","o"],c,d,e,f;c=0;for(d=b.length;c<d&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(b){e=(new Date).getTime();f=Math.max(0,16-(e-a));a=e+f;return window.setTimeout(function(){b(e+f)},f)});window.cancelAnimationFrame||(window.cancelAnimationFrame=
function(a){clearTimeout(a)})})();(function(a){function b(a){2<=p&&console.log("[l10n] "+a)}function c(a){p&&console.warn("[l10n] "+a)}function d(){var a=document.querySelector('script[type="application/l10n"]');return a?JSON.parse(a.innerHTML):null}function e(){var b=document.createEvent("Event");b.initEvent("localized",!1,!1);b.language=w;a.dispatchEvent(b)}function f(a,b,d,e){function f(a){function c(a,f){for(var k=a.replace(r,"").split(/[\r\n]+/),s="*",t=b.replace(/-[a-z]+$/i,""),s=!1,v="",z=0;z<k.length;z++){var O=k[z];if(!S.test(O)){if(f){if(l.test(O)){v=
l.exec(O);s=v[1];s="*"!==s&&s!==b&&s!==t;continue}else if(s)continue;n.test(O)&&(v=n.exec(O),d(m+v[1]))}(v=O.match(p))&&3==v.length&&(e[v[1]]=0>v[2].lastIndexOf("\\")?v[2]:v[2].replace(/\\\\/g,"\\").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/\\"/g,'"').replace(/\\'/g,"'"))}}}function d(a){k(a,function(a){c(a,!1)},null,!1)}var e=[],r=/^\s*|\s*$/,S=/^\s*#|^\s*$/,l=/^\s*\[(.*)\]\s*$/,n=/^\s*@import\s+url\((.*)\)\s*$/i,
p=/^([^=\s]*)\s*=\s*(.+)$/;c(a,!0);return e}function k(a,b,d,e){b=b||function(){};d=d||function(){c(a+" not found.")};var f=new XMLHttpRequest;f.open("GET",a,e);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=utf-8");f.onreadystatechange=function(){4==f.readyState&&(200==f.status||0===f.status?b(f.responseText):d())};f.onerror=d;f.ontimeout=d;try{f.send(null)}catch(q){d()}}var m=a.replace(/\/[^\/]*$/,"/");k(a,function(a){a=f(a);for(var b in a){var c,e;e=b.lastIndexOf(".");0<e?(c=b.substring(0,
e),e=b.substr(e+1)):(c=b,e=z);l[c]||(l[c]={});l[c][e]=a[b]}d&&d()},e,n)}function k(a,k){function m(a){var b=a.href;this.load=function(a,d){var e=a;f(b,a,d,function(){c(b+" not found.");e=""});return e}}k=k||function(){};l={};w="";w=a;var n=document.querySelectorAll('link[type="application/l10n"]'),S=n.length;if(0==S)(n=d())&&n.$b&&n.tc?(b("using the embedded JSON directory, early way out"),l=n.$b[a]||n.$b[n.tc],k()):b("no resource to load, early way out"),e(),G="complete";else for(var p=null,s=0,
p=function(){s++;s>=S&&(k(),e(),G="complete")},v=0;v<S;v++)(new m(n[v])).load(a,p)!=a&&(c('"'+a+'" resource not found'),w="")}function m(a){function b(a,c,d){return c<=a&&a<=d}var d={0:function(){return"other"},1:function(a){return b(a%100,3,10)?"few":0===a?"zero":b(a%100,11,99)?"many":2==a?"two":1==a?"one":"other"},2:function(a){return 0!==a&&0===a%10?"many":2==a?"two":1==a?"one":"other"},3:function(a){return 1==a?"one":"other"},4:function(a){return b(a,0,1)?"one":"other"},5:function(a){return b(a,
0,2)&&2!=a?"one":"other"},6:function(a){return 0===a?"zero":1==a%10&&11!=a%100?"one":"other"},7:function(a){return 2==a?"two":1==a?"one":"other"},8:function(a){return b(a,3,6)?"few":b(a,7,10)?"many":2==a?"two":1==a?"one":"other"},9:function(a){return 0===a||1!=a&&b(a%100,1,19)?"few":1==a?"one":"other"},10:function(a){return b(a%10,2,9)&&!b(a%100,11,19)?"few":1!=a%10||b(a%100,11,19)?"other":"one"},11:function(a){return b(a%10,2,4)&&!b(a%100,12,14)?"few":0===a%10||b(a%10,5,9)||b(a%100,11,14)?"many":
1==a%10&&11!=a%100?"one":"other"},12:function(a){return b(a,2,4)?"few":1==a?"one":"other"},13:function(a){return b(a%10,2,4)&&!b(a%100,12,14)?"few":1!=a&&b(a%10,0,1)||b(a%10,5,9)||b(a%100,12,14)?"many":1==a?"one":"other"},14:function(a){return b(a%100,3,4)?"few":2==a%100?"two":1==a%100?"one":"other"},15:function(a){return 0===a||b(a%100,2,10)?"few":b(a%100,11,19)?"many":1==a?"one":"other"},16:function(a){return 1==a%10&&11!=a?"one":"other"},17:function(a){return 3==a?"few":0===a?"zero":6==a?"many":
2==a?"two":1==a?"one":"other"},18:function(a){return 0===a?"zero":b(a,0,2)&&0!==a&&2!=a?"one":"other"},19:function(a){return b(a,2,10)?"few":b(a,0,1)?"one":"other"},20:function(a){return!b(a%10,3,4)&&9!=a%10||b(a%100,10,19)||b(a%100,70,79)||b(a%100,90,99)?0===a%1E6&&0!==a?"many":2!=a%10||-1!==[12,72,92].indexOf(a%100)?1!=a%10||-1!==[11,71,91].indexOf(a%100)?"other":"one":"two":"few"},21:function(a){return 0===a?"zero":1==a?"one":"other"},22:function(a){return b(a,0,1)||b(a,11,99)?"one":"other"},23:function(a){return b(a%
10,1,2)||0===a%20?"one":"other"},24:function(a){return b(a,3,10)||b(a,13,19)?"few":-1!==[2,12].indexOf(a)?"two":-1!==[1,11].indexOf(a)?"one":"other"}},e={af:3,ak:4,am:4,ar:1,asa:3,az:0,be:11,bem:3,bez:3,bg:3,bh:4,bm:0,bn:3,bo:0,br:20,brx:3,bs:11,ca:3,cgg:3,chr:3,cs:12,cy:17,da:3,de:3,dv:3,dz:0,ee:3,el:3,en:3,eo:3,es:3,et:3,eu:3,fa:0,ff:5,fi:3,fil:4,fo:3,fr:5,fur:3,fy:3,ga:8,gd:24,gl:3,gsw:3,gu:3,guw:4,gv:23,ha:3,haw:3,he:2,hi:4,hr:11,hu:0,id:0,ig:0,ii:0,is:3,it:3,iu:7,ja:0,jmc:3,jv:0,ka:0,kab:5,kaj:3,
kcg:3,kde:0,kea:0,kk:3,kl:3,km:0,kn:0,ko:0,ksb:3,ksh:21,ku:3,kw:7,lag:18,lb:3,lg:3,ln:4,lo:0,lt:10,lv:6,mas:3,mg:4,mk:16,ml:3,mn:3,mo:9,mr:3,ms:0,mt:15,my:0,nah:3,naq:7,nb:3,nd:3,ne:3,nl:3,nn:3,no:3,nr:3,nso:4,ny:3,nyn:3,om:3,or:3,pa:3,pap:3,pl:13,ps:3,pt:3,rm:3,ro:9,rof:3,ru:11,rwk:3,sah:0,saq:3,se:7,seh:3,ses:0,sg:0,sh:11,shi:19,sk:12,sl:14,sma:7,smi:7,smj:7,smn:7,sms:7,sn:3,so:3,sq:3,sr:11,ss:3,ssy:3,st:3,sv:3,sw:3,syr:3,ta:3,te:3,teo:3,th:0,ti:4,tig:3,tk:3,tl:4,tn:3,to:0,tr:0,ts:3,tzm:22,uk:11,
ur:3,ve:3,vi:0,vun:3,wa:4,wae:3,wo:0,xh:3,xog:3,yo:0,zh:0,zu:3}[a.replace(/-.*$/,"")];return e in d?d[e]:(c("plural form unknown for ["+a+"]"),function(){return"other"})}function s(a,d){var e=l[a];e||c("#"+a+" is undefined.");var f={},k;for(k in e){var m=e[k];var n=d,p=a,s=k,t=/\{\[\s*([a-zA-Z]+)\(([a-zA-Z]+)\)\s*\]\}/.exec(m);if(t&&t.length){var w=t[1],t=t[2],u=void 0;n&&t in n?u=n[t]:t in l&&(u=l[t]);w in v&&(m=(0,v[w])(m,u,p,s))}n=d;p=a;s=/\{\{\s*(.+?)\s*\}\}/;for(w=s.exec(m);w&&w&&!(2>w.length);){t=
w[1];u="";if(n&&t in n)u=n[t];else if(t in l)u=l[t][z];else{b("argument {{"+t+"}} for #"+p+" is undefined.");break}m=m.substring(0,w.index)+u+m.substr(w.index+w[0].length);w=s.exec(m)}f[k]=m}return f}function t(a){var b,d;if(a){b=a.getAttribute("data-l10n-id");var e=a.getAttribute("data-l10n-args");d={};if(e)try{d=JSON.parse(e)}catch(f){c("could not parse arguments for #"+b)}}else d=b=void 0;if(b)if(d=s(b,d)){if(d[z]){if(0===a.children.length)a[z]=d[z];else{b=a.childNodes;for(var e=!1,k=0,m=b.length;k<
m;k++)3===b[k].nodeType&&/\S/.test(b[k].nodeValue)&&(e?b[k].nodeValue="":(b[k].nodeValue=d[z],e=!0));e||a.insertBefore(document.createTextNode(d[z]),a.firstChild)}delete d[z]}for(var l in d)a[l]=d[l]}else c("#"+b+" is undefined.")}function x(a){for(var b=(a=a||document.documentElement)?a.querySelectorAll("*[data-l10n-id]"):[],c=b.length,d=0;d<c;d++)t(b[d]);t(a)}function u(){G="interactive";b("loading ["+navigator.language+"] resources, "+(n?"asynchronously.":"synchronously."));document.documentElement.lang===
navigator.language?k(navigator.language):k(navigator.language,x)}var l={},z="textContent",w="",v={},G="loading",n=!0,p=2;v.ie=function(a,b,c,d){b=parseFloat(b);if(isNaN(b)||d!=z)return a;v.Rb||(v.Rb=m(w));var e="["+v.Rb(b)+"]";0===b&&c+"[zero]"in l?a=l[c+"[zero]"][d]:1==b&&c+"[one]"in l?a=l[c+"[one]"][d]:2==b&&c+"[two]"in l?a=l[c+"[two]"][d]:c+e in l?a=l[c+e][d]:c+"[other]"in l&&(a=l[c+"[other]"][d]);return a};"undefined"!==typeof document&&("complete"===document.readyState||"interactive"===document.readyState?
a.setTimeout(u):document.addEventListener("DOMContentLoaded",u));"mozSettings"in navigator&&navigator.Mc&&navigator.Mc.Pd("language.current",function(a){k(a.ke,x)});navigator.q={get:function(a,b,c){return(b=s(a,b)||c)?"textContent"in b?b.textContent:"":"{{"+a+"}}"},get language(){return{get code(){return w},set code(a){k(a,x)},get direction(){return 0<=["ar","he","fa","ps","ur"].indexOf(w)?"rtl":"ltr"}}},translate:x,get Sd(){return JSON.parse(JSON.stringify(l))},get readyState(){return G},je:function(b){b&&
("complete"===G?a.setTimeout(b):a.addEventListener("localized",b))}};b("library loaded.")})(this);h.zd={};h.Effect=function(){this.id=D();this.p={od:new R,Ed:new Ja,Od:new Ma,Hd:new N,rd:new L,Ad:new M,pd:new K};256<ia&&(this.p.vd=new Ga,this.p.Md=new La,this.p.yd=new Ia,this.p.td=new U,this.p.Id=new Ka,this.p.sd=new T,this.p.wd=new Ha,this.p.ud=new Fa);this.vb="Amaro"};h.Effect.label="effect";
h.Effect.prototype={label:h.Effect.label,show:function(){var a=this;Q.Oa();a.S=new za({options:a.p,ma:function(b){if(b in a.p){a.vb=b;for(var c in a.p)c!==b&&a.p.hasOwnProperty(c)&&a.p[c].B(!0);a.p[b].show();Q.Qb(navigator.q.get(a.label)+": "+navigator.q.get(a.p[b].label))}},bc:function(){Q.$a();Q.Ba(window.innerHeight-50)}})},B:function(){for(var a in this.p)this.p.hasOwnProperty(a)&&this.p[a].B();this.S.n();Q.Ba("100%")},drawImage:function(a){this.p[this.vb].D(a)},qa:function(a,b){this.p[this.vb].qa(a,
b)},n:function(){for(var a in this.p)this.p.hasOwnProperty(a)&&this.p[a].n();this.S.n();Q.Ba("100%")}};h.Kd={};h.Texture=function(){this.id=D();this.o={Dd:new Pa,xd:new Na,Gd:new Ra};256<ia&&(this.o.Nd=new Ta,this.o.Cd=new Oa,this.o.Jd=new Sa,this.o.Fd=new Qa);this.Sb="Grunge"};h.Texture.label="texture";
h.Texture.prototype={label:h.Texture.label,show:function(){var a=this;Q.Oa();a.S=new za({options:a.o,ma:function(b){if(b in a.o){a.Sb=b;for(var c in a.o)c!==b&&a.o.hasOwnProperty(c)&&a.o[c].B();a.o[b].show();Q.Qb(navigator.q.get(a.label)+": "+navigator.q.get(a.o[b].label))}},bc:function(){Q.$a();Q.Ba(window.innerHeight-50)}})},B:function(){for(var a in this.o)this.o.hasOwnProperty(a)&&this.o[a].B();this.S.n();Q.Ba("100%")},drawImage:function(a){this.o[this.Sb].D(a)},n:function(){for(var a in this.o)this.o.hasOwnProperty(a)&&
this.o[a].n();null!==this.S&&(this.S.n(),this.S=null);Q.Ba("100%")}};var W=navigator.q.get,Q={canvas:null,Fa:null,A:null,$:null,V:null,m:null,bb:null,Aa:null,T:null,J:[],U:function(){"mozLockOrientation"in window.screen?window.screen.mozLockOrientation("portrait"):"lockOrientation"in window.screen&&window.screen.lockOrientation("portrait");document.addEventListener("touchmove",function(a){a.preventDefault()},!1);if(!ca){var a;if(document.getElementById("16bit-color-depth"))return;a=document.createElement("link");a.id="16bit-color-depth";a.rel="stylesheet";a.href="style/16bit-color-depth.css";
document.head.appendChild(a)}Q.Fa=document.getElementById("fileOpenScreen");Q.A=document.getElementById("mainScreen");Q.$=document.getElementById("editLayerScreen");Q.V=document.getElementById("layers-btn");Q.m=document.getElementById("layers");Q.bb=Q.A.querySelector(".top-label");Q.Aa=document.getElementById("add-layer");Q.T=document.getElementById("exportDialog");Q.M=document.getElementById("settingsDialog");Q.F=document.getElementById("settingsDialogLog");Q.la=document.getElementById("infoDialog");
var b=document.body.querySelectorAll('section[role="region"]');a=0;for(var c=b.length;a<c;a++)b[a].classList.remove("hidden");a=Q.va=document.createElement("div");a.className="working-canvas-loading";c=Q.Yd=document.createElement("canvas");c.setAttribute("moz-opaque","");c.className="working-canvas-loading-icon";c.width=32;c.height=32;a.appendChild(c);Q.Zb=new aa(c,"style/working-canvas-loading.png",12,100);if(!g)for(b=document.body.querySelectorAll(".icon, .button"),a=0,c=b.length;a<c;a++){var d=
b[a];d.addEventListener("mouseover",function(){this.classList.add("hover")},!1);d.addEventListener("mouseout",function(){this.classList.remove("hover")},!1)}Q.za(Q.A);Q.za(Q.$);Q.Za();a=Q.Fa.querySelector(".settings");B(a,function(a){a.preventDefault();Q.fd()});a=Q.M.querySelector(".icon-close");B(a,function(a){a.preventDefault();Q.Fc()});a=Q.F.querySelector(".icon-back");B(a,function(a){a.preventDefault();Q.Ec()});Q.M.querySelector('input[name="demo.enabled"]').addEventListener("change",function(){this.checked?
Ua.jd():Ua.xc()},!1);a=Q.F.querySelector(".clear");B(a,function(a){a.preventDefault();y.pc();for(a=Q.F.querySelector("pre");a.hasChildNodes();)a.removeChild(a.lastChild)});var e=Q.F.querySelector('input[name="autoSendLogs.enabled"]');ja.get("autoSendLogs.enabled",function(a){e.checked=a});e.addEventListener("change",function(){ja.set("autoSendLogs.enabled",this.checked);Q.Na("autoSendLogs.enabled",this.checked);this.checked?y.hd():y.wc()},!1);document.getElementById("send-logs").addEventListener(g?
"touchstart":"click",function(){y.Wc();for(var a=Q.F.querySelector("pre");a.hasChildNodes();)a.removeChild(a.lastChild)},!1);a=Q.M.querySelector("#menuItem-logs");B(a,function(a){a.preventDefault();Q.ed()});a=Q.Fa.querySelector(".info");B(a,function(a){a.preventDefault();Q.ad()});a=Q.la.querySelector(".icon-close");B(a,function(a){a.preventDefault();Q.Ca()});a=Q.A.querySelector(".close");B(a,function(a){a.preventDefault();Q.Ca();Ea()});a=Q.A.querySelector(".export");B(a,function(a){a.preventDefault();
Q.$c()});b=Q.T.querySelectorAll("button[data-type]");a=0;for(c=b.length;a<c;a++)B(b[a],function(){var a=this.getAttribute("data-type");this.classList.add("active");setTimeout(function(){"share"===a?Va("share"):"save-original"===a?Va("save-original"):"save-1024"===a?Va("save-1024"):"save-1600"===a?Va("save-1600"):"cancel"===a&&Q.Ja()},300)});Q.T.addEventListener("submit",function(a){a.preventDefault()},!1);Q.Hc();var f=Q.A.querySelector(".icon.add-layer");B(f,function(){f.classList.contains("active")?
Q.Ia():Q.Zc()});a=Q.$.querySelector(".close");B(a,function(){Wa(X.length-1);Q.Pa()});a=Q.$.querySelector(".accept");B(a,function(){Xa();Q.Pa()});Q.Ya();B(Q.V,function(){Q.V.classList.contains("active")?Q.Ya():Q.cd()});window.addEventListener("resize",function(){Q.resize(!0)},!1);window.addEventListener("localized",function(){Q.Rc()});Q.T.parentNode&&("complete"!==navigator.q.readyState&&Q.J.push(Q.T),Q.T.remove());Q.T.classList.remove("hidden");Q.M.parentNode&&("complete"!==navigator.q.readyState&&
Q.J.push(Q.M),Q.M.remove());Q.M.classList.remove("hidden");Q.F.parentNode&&("complete"!==navigator.q.readyState&&Q.J.push(Q.F),Q.F.remove());Q.F.classList.remove("hidden");Q.la.parentNode&&("complete"!==navigator.q.readyState&&Q.J.push(Q.la),Q.la.remove());Q.la.classList.remove("hidden");Q.la.style.transform="translateY("+window.innerHeight+"px)"},Rc:function(){document.documentElement.lang=navigator.q.language.code;document.documentElement.dir=navigator.q.language.direction;for(var a=0,b=Q.J.length;a<
b;a++)navigator.q.translate(Q.J[a]);delete Q.J},resize:function(){var a=Q.canvas;Ya&&a?(Q.ec(a),clearTimeout(Q.Vc),Q.Vc=setTimeout(function(){I.Xa()},100)):setTimeout(function(){Q.resize()},100)},ec:function(a){var b,c,d=Y,e=Z,f=window.innerWidth,k=window.innerHeight;d/e>f/k?(b=f-20,c=b/d*e,a.style.left="10px",a.style.top=(k-c)/2+"px"):(c=k-20,b=c/e*d,a.style.top="10px",a.style.left=(f-b)/2+"px");a.style.width=b+"px";a.style.height=c+"px";a.width=b;a.height=c;Q.va.style.left=a.style.left;Q.va.style.top=
a.style.top;Q.va.style.width=a.style.width;Q.va.style.height=a.style.height},vc:function(){var a=document.createElement("canvas");a.setAttribute("moz-opaque","");a.className="working-canvas";Q.ec(a);document.body.appendChild(a);I.U(a,Za);I.t(function(){I.D({w:function(){Q.canvas=a}})})},Nb:function(a){if(a){for(var b=a.querySelectorAll(".icon"),c=0,d=b.length;c<d;c++)b[c].classList.remove("hover");document.body.appendChild(a)}},Td:function(){return Q.canvas},za:function(a){a&&a.parentNode&&("complete"!==
navigator.q.readyState&&Q.J.push(a),a.remove())},Ca:function(){Q.Nb(Q.Fa);Q.za(Q.A);Q.Cc();Q.Ia();Q.Ya();Q.Za()},Pa:function(){Q.Nb(Q.A);Q.za(Q.Fa);Q.za(Q.$);Q.Ia();0<X.length&&Q.dd()},bd:function(){Q.Ia();Q.Nb(Q.$);Q.za(Q.A);Q.Za()},Qb:function(a){Q.$.querySelector(".bottom-label").textContent=a},Hc:function(){for(var a=Q.Aa.querySelectorAll(".select-menu-item"),b=0,c=a.length;b<c;b++){var d=a[b],e=d.getAttribute("data-class-name");if(h[e])d.setAttribute("data-l10n-id",h[e].label),"complete"===navigator.q.readyState?
d.textContent=W(h[e].label):Q.J.push(d),d.addEventListener(g?"touchstart":"click",function(){var b=this,d;if(!b.classList.contains("current")){for(d=0;d<c;d++)a[d].classList.remove("current");b.classList.add("current");clearTimeout(Q.Jc);Q.Jc=setTimeout(function(){for(d=0;d<c;d++)a[d].classList.remove("current");Q.bd();var e=b.getAttribute("data-class-name");4<=X.length?(alert(W("limited-layers-msg")),Q.Pa()):(e=new h[e],e.show(),Q.Qb(W(e.label)),X.push(e),Q.lc(X.length-1,e))},100)}},!1);else throw Error('GUI: Layer "'+
e+'" not found!');g||(d.addEventListener("mouseover",function(){this.classList.add("hover")},!1),d.addEventListener("mouseout",function(){this.classList.remove("hover")},!1))}},Zc:function(){var a=Q.Aa.querySelectorAll(".select-menu-item");Q.Ya();for(var b=0,c=a.length;b<c;b++)a[b].classList.remove("hover");Q.A.querySelector(".icon.add-layer").classList.add("active");Q.A.appendChild(Q.bb);Q.A.appendChild(Q.Aa)},Ia:function(){Q.A&&(Q.A.querySelector(".icon.add-layer").classList.remove("active"),"complete"!==
navigator.q.readyState&&Q.J.push(Q.bb,Q.Aa),Q.bb.remove(),Q.Aa.remove())},lc:function(a,b){var c=document.createElement("div");c["data-index"]=a;c.className="layer";var d=document.createElement("div");d.className="thumbnail";c.appendChild(d);d=document.createElement("span");d.className="text";d.textContent=W(b.label);c.appendChild(d);d=document.createElement("span");d.className="delete";var e=document.createElement("div");e.className="inner";e.appendChild(document.createTextNode("X"));d.appendChild(e);
c.appendChild(d);d.addEventListener(g?"touchstart":"click",function(){var a=this;a.classList.contains("inner")&&(a=a.parentNode);Q.Va||(Q.Va=Q.qc.bind(Q));if(a.classList.contains("confirm"))Wa(a.parentNode["data-index"]),document.body.removeEventListener(g?"touchstart":"click",Q.Va,!1);else{for(a.classList.add("confirm");a.hasChildNodes();)a.removeChild(a.lastChild);var b=document.createElement("div");b.className="inner";b.appendChild(document.createTextNode(W("delete")));a.appendChild(b);setTimeout(function(){document.body.addEventListener(g?
"touchstart":"click",Q.Va,!1)},60)}},!1);Q.m.insertBefore(c,Q.m.firstChild)},qc:function(a){if(a=a&&a.target){a.classList.contains("inner")&&(a=a.parentNode);var b,c,d=Q.m.querySelectorAll(".layer");b=0;for(c=d.length;b<c;b++){var e=d[b].querySelector(".delete");if(e!==a){document.body.removeEventListener(g?"touchstart":"click",Q.Va,!1);for(e.classList.remove("confirm");e.hasChildNodes();)e.removeChild(e.lastChild);var f=document.createElement("div");f.className="inner";f.appendChild(document.createTextNode("X"));
e.appendChild(f)}}}},Uc:function(a){var b,c,d=Q.m.querySelectorAll(".layer");b=0;for(c=d.length;b<c;b++){var e=d[b];if(e["data-index"]==a){e.remove();break}}d=Q.m.querySelectorAll(".layer");c=d.length;if(0===c)Q.Za();else for(b=0;b<c;b++)d[b]["data-index"]=c-1-b},ld:function(a,b){var c,d,e=Q.m.querySelectorAll(".layer");c=0;for(d=e.length;c<d;c++){var f=e[c];if(f["data-index"]==a){f.querySelector(".thumbnail").style.backgroundImage='url("'+b+'")';break}}},cd:function(){Q.Ia();Q.V.classList.add("active");
Q.A.appendChild(Q.m);Q.m.style.marginTop=-Math.ceil(Q.m.offsetHeight/2)+"px"},Ya:function(){Q.V&&(Q.V.classList.remove("active"),Q.m.remove())},dd:function(){Q.A.appendChild(Q.V)},Za:function(){Q.V&&Q.V.remove()},Ba:function(a){Q.$.style.height=a+("[object Number]"===Object.prototype.toString.call(a)?"px":"")},Oa:function(){clearTimeout(Q.gc);clearTimeout(Q.Dc);Q.canvas&&I.t()?(Q.canvas.remove(),document.body.appendChild(Q.va),Q.Zb.start()):Q.gc=setTimeout(Q.Oa.bind(Q),100)},$a:function(){clearTimeout(Q.gc);
clearTimeout(Q.Dc);setTimeout(function(){Q.Zb.stop();Q.va.remove();document.body.appendChild(Q.canvas)},100)},$c:function(){var a=Q.T;a.querySelector("button[data-type=save-original]").style.display="";a.querySelector("button[data-type=save-1600]").style.display="";a.querySelector("button[data-type=save-1024]").style.display="";var b=Math.max(Y,Z);512>ia&&1024<=b&&(a.querySelector("button[data-type=save-original]").style.display="none",a.querySelector("button[data-type=save-1600]").style.display=
"none");1600>b&&(a.querySelector("button[data-type=save-1600]").style.display="none");1024>b&&(a.querySelector("button[data-type=save-1024]").style.display="none");b=navigator.getDeviceStorage("pictures").freeSpace();b.onsuccess=function(){0>=this.result&&(a.querySelector("button[data-type=save-original]").style.display="none",a.querySelector("button[data-type=save-1600]").style.display="none",a.querySelector("button[data-type=save-1024]").style.display="none");a.style.zIndex=999;a.style.animation=
"toTop 0.4s forwards";document.body.appendChild(a)};b.onerror=function(){a.querySelector("button[data-type=save-original]").style.display="none";a.querySelector("button[data-type=save-1600]").style.display="none";a.querySelector("button[data-type=save-1024]").style.display="none";a.style.zIndex=999;a.style.animation="toTop 0.4s forwards";document.body.appendChild(a)}},Ja:function(){var a=Q.T;a.parentNode&&("complete"!==navigator.q.readyState&&Q.J.push(a),a.remove());for(var a=Q.T.querySelectorAll("button[data-type]"),
b=0,c=a.length;b<c;b++)a[b].classList.remove("active")},ad:function(){var a=Q.la;setTimeout(function(){a.style.animation="toTop 0.4s forwards";document.body.appendChild(a)},100)},Cc:function(){var a=Q.la;a&&a.parentNode&&("complete"!==navigator.q.readyState&&Q.J.push(a),a.remove())},fd:function(){var a=Q.M;setTimeout(function(){a.style.animation="toTop 0.4s forwards";document.body.appendChild(a)},100)},Fc:function(){var a=Q.M;a.parentNode&&("complete"!==navigator.q.readyState&&Q.J.push(a),a.remove(),
a.style.animation="")},ed:function(){for(var a=Q.M,b=Q.F,c=Q.F.querySelector("pre");c.hasChildNodes();)c.removeChild(c.lastChild);y.Xb(function(a){for(var b=document.createDocumentFragment(),f=0,k=a.length;f<k;f++){b.appendChild(document.createTextNode(a[f]));var m=document.createElement("br");b.appendChild(m)}c.appendChild(b)});setTimeout(function(){a.style.animation="currentToLeft 0.4s forwards";a.querySelector("header:first-child h1").style.Ta="headerCurrentToLeft 0.4s forwards";b.style.animation=
"rightToCurrent 0.4s forwards";b.querySelector("header:first-child h1").style.Ta="fadeIn 0.4s forwards";document.body.appendChild(b)},100)},Ec:function(){var a=Q.M,b=Q.F;setTimeout(function(){a.style.animation="leftToCurrent 0.4s forwards";a.querySelector("header:first-child h1").style.Ta="headerLeftToCurrent 0.4s forwards";b.style.animation="currentToRight 0.4s forwards";b.querySelector("header:first-child h1").style.Ta="fadeOut 0.4s forwards";setTimeout(function(){b.parentNode&&(b.remove(),b.style.Ta=
"")},400)},100)},Na:function(a,b){var c;Q.M&&(c=Q.M.querySelector('input[name="'+a+'"]'))&&(c.checked=b);Q.F&&(c=Q.F.querySelector('input[name="'+a+'"]'))&&(c.checked=b)}};var Ua=function(){function a(a,b){if(s)b(s.transaction(u,a).objectStore(u));else{var c=indexedDB.open(t,x);c.onerror=function(){throw Error("Demo: can't open database:"+c.error.name);};c.onupgradeneeded=function(){c.result.createObjectStore(u)};c.onsuccess=function(){s=c.result;b(s.transaction(u,a).objectStore(u))}}}function b(b,c){a("readonly",function(a){var d=a.get(b);d.onsuccess=function(){var a=d.result;void 0===a&&(a=null);c(a)};d.onerror=function(){throw Error("Error in Demo.getItem(): "+d.error.name);
}})}function c(b){a("readwrite",function(a){var c=a.put(!0,b);c.onerror=function(){throw Error("Error in Demo.setItem(): "+c.error.name);}})}function d(b){a("readwrite",function(a){var c=a.clear();b&&(c.onsuccess=function(){b()});c.onerror=function(){throw Error("Error in Demo.clear(): "+c.error.name);}})}function e(b){a("readonly",function(a){var c=a.count();c.onsuccess=function(){b(c.result)};c.onerror=function(){throw Error("Error in Demo.length(): "+c.error.name);}})}var f={},k=null,m={},s=null,
t="BessaDemo",x=1,u="keyvaluepairs",l=[];f.U=function(){null===k&&(k=document.body.querySelectorAll('section[role="demo"]'));window.addEventListener("localized",function(){for(var a=0,b=l.length;a<b;a++)navigator.q.translate(l[a]);l=null});e(function(a){if(a===k.length)m={},Q.Na("demo.enabled",!1);else{Q.Na("demo.enabled",!0);a=0;for(var d=k.length;a<d;a++){var f=k[a];f.parentNode&&("complete"!==navigator.q.readyState&&l.push(f),f.remove());f.classList.remove("hidden");B(f,function(){this.remove();
m[this.getAttribute("id")]=null});m[f.getAttribute("id")]=f}var s=new MutationObserver(function(a){a.forEach(function(a){if("childList"===a.type)for(var d=0,e=a.addedNodes.length;d<e;++d){var f=a.addedNodes[d];f===Q.A?(b("mainScreen",function(a){null===a&&(c("mainScreen"),document.body.appendChild(m.mainScreenDemo))}),b("mainScreen-Layers",function(a){if(null===a&&Q.A.contains(Q.V)){c("mainScreen-Layers");var d=m.mainScreenLayersDemo;document.body.appendChild(d);var e=function(){b("mainScreen-Export",
function(a){null===a&&setTimeout(function(){B(d,e);c("mainScreen-Export");document.body.appendChild(m.mainScreenExportDemo)},300)})};B(d,e)}})):f===Q.$?b("editLayerScreen",function(a){null===a&&(c("editLayerScreen"),document.body.appendChild(m.editLayerScreenDemo))}):f===m.editLayerScreenDemo&&b("editLayerScreen-Accept",function(a){if(null===a){c("editLayerScreen-Accept");var b=m.editLayerScreenDemo,d=function(a){a.target===b||b.contains(a.target)||(document.body.removeEventListener(g?"touchend":
"mouseup",d),document.body.appendChild(m.editLayerScreenAcceptDemo))};document.body.addEventListener(g?"touchend":"mouseup",d,!1)}})}});e(function(a){a===Object.size(m)&&(s.disconnect(),s=null,m={},Q.Na("demo.enabled",!1))})});s.observe(document.body,{attributes:!0,childList:!0,characterData:!0})}})};f.jd=function(){d(function(){f.U()})};f.xc=function(){c("mainScreen");c("mainScreen-Layers");c("mainScreen-Export");c("editLayerScreen");c("editLayerScreen-Accept");window.qd.Bd.Na("demo.enabled",!1)};
f.Wd=function(a){e(function(b){a(0===b)})};return f}();function $a(){B(document.getElementById("choosePictureLabel"),function(a){a&&a.preventDefault();a=new MozActivity({name:"pick",data:{type:["image/png","image/jpg","image/jpeg"]}});a.onsuccess=function(){var a=window.URL.createObjectURL(this.result.blob);Q.Pa();ab(a)};a.onerror=function(){}});navigator.mozSetMessageHandler("open",function(a){a=window.URL.createObjectURL(a.source.url);Q.Pa();ab(a)})};var W=navigator.q.get,Y=0,Z=0,Za=null,X=[],Ya=!1;function ab(a){var b=document.createElement("img");Za=b;b.crossOrigin="sunbox.local";b.origin="sunbox.local";b.onload=function(){URL.revokeObjectURL(a);Y=b.naturalWidth;Z=b.naturalHeight;Ya=!0;Q.vc()};b.onerror=function(){URL.revokeObjectURL(a);b.removeAttribute("src");Q.Ca();Ea();throw Error("Program: Image failed to load!");};b.src=a}function Xa(){var a=X.length-1;I.R(15,15,function(b){Q.ld(a,b);I.Kb(function(){X[a]&&X[a].B()})})}
function Wa(a){var b,c=X.length;0===c?I.D():1===c?(b=X[0],X.length=0):(b=X[c-1],X.length=c-1);b.n();Q.Uc(a)}function bb(){for(var a=0,b=X.length;a<b;a++){var c=X[a];c.qa&&c.qa(I.Ab(),I.zb())}}
function Va(a){Q.Oa();var b=document.createElement("canvas");b.setAttribute("moz-opaque","");b.width=Y;b.height=Z;var c=Y/Z;"save-1600"===a?1<c?(b.width=1600,b.height=Z/Y*1600):(b.height=1600,b.width=Y/Z*1600):"save-1024"===a&&(1<c?(b.width=1024,b.height=Z/Y*1024):(b.height=1024,b.width=Y/Z*1024));512>ia&&"share"===a&&(1<c?(b.width=1024,b.height=Z/Y*1024):(b.height=1024,b.width=Y/Z*1024));I.reset();I.U(b,Za);Q.Oa();I.t(function(){bb();I.Xa({w:function(){I.getBlob(function(b){if("share"===a){var c=
new MozActivity({name:"share",data:{type:"image/*",number:1,blobs:[b]}});c.onsuccess=function(){Q.Ja()};c.onerror=function(){Q.Ja()}}else{ya.U();var f=navigator.getDeviceStorage("pictures");ya.tb(f,function(a,c){var e=f.addNamed(b,a+c);e.onsuccess=function(){alert(W("image-saved"));Q.Ja();Q.$a()};e.onerror=function(){alert(W("image-save-error")+" "+this.error.name);Q.Ja();Q.$a()}})}})}})})}function Ea(){Q.canvas&&Q.canvas.remove();Ya=!1;Z=Y=0;Za=Q.canvas=null;X.length=0;I&&I.reset()}
function cb(){function a(){Q.U();Q.Ca();$a();Ua.U()}"complete"===document.readyState?a():document.addEventListener("DOMContentLoaded",a,!1)}var db=["Bessa","Program","init"],$=this;db[0]in $||!$.execScript||$.execScript("var "+db[0]);for(var eb;db.length&&(eb=db.shift());)db.length||void 0===cb?$=$[eb]?$[eb]:$[eb]={}:$[eb]=cb;window.URL=window.webkitURL||window.URL;(function(){var a=0,b=["ms","moz","webkit","o"],c,d,e,f;c=0;for(d=b.length;c<d&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(b){e=(new Date).getTime();f=Math.max(0,16-(e-a));a=e+f;return window.setTimeout(function(){b(e+f)},f)});window.cancelAnimationFrame||(window.cancelAnimationFrame=
function(a){clearTimeout(a)})})();
