18&&(h=a+n,d.style.height=h+"px")},y.onStop=function(){u=c,a=h}},o=0,u=0,a=0,f=!1,l=!1,c=null,h=this,p=e.offsetWidth,d=e.offsetHeight,v=function(e,t){if(e<-0.5||e>.5)throw"Invalid value: "+t+" must be between 0 and 1";return!0},m=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)},g=function(e){return b.getElementsByClassName(e)[0]},y=function(e){return document.createElement(e)},b=y("div");b.className="photobooth",b.innerHTML='Sorry, Photobooth.js is not supported by your browser
Please give Photobooth permission to use your Webcam. Try again
';var w=y("canvas"),E=w.getContext("2d"),S=b.getElementsByTagName("canvas")[0],x=S.getContext("2d"),T=y("video");T.autoplay=!0;var N=g("noWebcam");N.getElementsByTagName("span")[0].onclick=function(){M()},new i(g("hue"),function(e){o=e}),new i(g("saturation"),function(e){u=e}),new i(g("brightness"),function(e){a=e});var C=new s(b,p,d),k=g("crop");k.onclick=function(){C.toggle(),k.className==="crop"?k.className="crop selected":k.className="crop"};var L=g("blind");g("trigger").onclick=function(){L.className="blind",L.style.opacity=1,setTimeout(function(){L.className="blind anim",L.style.opacity=0},50);var e={};C.isActive()?e=C.getData():f?e={x:(p-T.videoWidth)/2,y:(d-T.videoHeight)/2,width:T.videoWidth,height:T.videoHeight}:e={x:0,y:0,width:p,height:d};var t=y("canvas");t.width=e.width,t.height=e.height;if(f)t.getContext("2d").drawImage(T,Math.max(0,e.x-(p-T.videoWidth)/2),Math.max(e.y-(d-T.videoHeight)/2),e.width,e.height,0,0,e.width,e.height);else{var n=x.getImageData(e.x,e.y,e.width,e.height);t.getContext("2d").putImageData(n,0,0)}h.onImage(t.toDataURL())};var A=function(e){c=e;try{T.src=(window.URL||window.webkitURL).createObjectURL(c),m(H)}catch(t){T.mozSrcObject=c,h.forceHSB===!1?(f=!0,b.appendChild(T),b.getElementsByTagName("ul")[0].className="noHSB"):T.addEventListener("canplay",function(){m(H)},!1),T.play()}},O=function(e){N.style.display="block"},M=function(){N.style.display="none",t.call(navigator,{video:!0},A,O)},_=function(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},D=function(e){return e>1?e-1:e<0?1+e:e},P=function(e){return e>1?1:e<0?0:e},H=function(){try{E.drawImage(T,0,0,p,d)}catch(e){}var t=E.getImageData(0,0,p,d),n=t.data;for(var r=0;r.5?b/(2-c-h):b/(c+h),c===i&&(v=((s-f)/b+(s