commit 495f1d958e95129533fb609c39b8ce96b1cc0cbf Author: synth-ruiner Date: Fri Dec 22 17:22:08 2017 +0000 initial diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..bdb0cab --- /dev/null +++ b/.gitattributes @@ -0,0 +1,17 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cd2946a --- /dev/null +++ b/.gitignore @@ -0,0 +1,47 @@ +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# ========================= +# Operating System Files +# ========================= + +# OSX +# ========================= + +.DS_Store +.AppleDouble +.LSOverride + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk diff --git a/Rubik-Regular.ttf b/Rubik-Regular.ttf new file mode 100644 index 0000000..20100d2 Binary files /dev/null and b/Rubik-Regular.ttf differ diff --git a/bitsy-default.txt b/bitsy-default.txt new file mode 100644 index 0000000..898876c --- /dev/null +++ b/bitsy-default.txt @@ -0,0 +1,5196 @@ +default game data + +# BITSY VERSION 4.5 + +! ROOM_FORMAT 1 + +PAL 0 +NAME test +249,232,162 +158,238,252 +255,255,255 + +ROOM 0 +k,k,k,k,k,k,k,g,h,k,k,k,k,k,k,k +k,k,k,k,k,k,k,i,j,k,k,k,k,k,k,k +k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k +k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k +k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k +k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k +k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k +k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k +k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k +k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k +k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k +k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k +k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k +k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k +a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a +f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f +WAL a +EXT 0,15 0 15,15 +EXT 15,15 0 0,15 +PAL 0 + +TIL a +00111100 +01100110 +01101110 +01101110 +01100000 +01100010 +00111100 +00000000 + +TIL b +00011000 +00111100 +01100110 +01111110 +01100110 +01100110 +01100110 +00000000 + +TIL c +01111100 +01100110 +01100110 +01111100 +01100110 +01100110 +01111100 +00000000 + +TIL d +00111100 +01100110 +01100000 +01100000 +01100000 +01100110 +00111100 +00000000 + +TIL e +01111000 +01101100 +01100110 +01100110 +01100110 +01101100 +01111000 +00000000 + +TIL f +01111110 +01100000 +01100000 +01111000 +01100000 +01100000 +01111110 +00000000 + +TIL g +01111110 +01100000 +01100000 +01111000 +01100000 +01100000 +01100000 +00000000 + +TIL h +00111100 +01100110 +01100000 +01101110 +01100110 +01100110 +00111100 +00000000 + +TIL i +01100110 +01100110 +01100110 +01111110 +01100110 +01100110 +01100110 +00000000 + +TIL j +00111100 +00011000 +00011000 +00011000 +00011000 +00011000 +00111100 +00000000 + +TIL ba +00011110 +00001100 +00001100 +00001100 +00001100 +01101100 +00111000 +00000000 + +TIL bb +01100110 +01101100 +01111000 +01110000 +01111000 +01101100 +01100110 +00000000 + +TIL bc +01100000 +01100000 +01100000 +01100000 +01100000 +01100000 +01111110 +00000000 + +TIL bd +01100011 +01110111 +01111111 +01101011 +01100011 +01100011 +01100011 +00000000 + +TIL be +01100110 +01110110 +01111110 +01111110 +01101110 +01100110 +01100110 +00000000 + +TIL bf +00111100 +01100110 +01100110 +01100110 +01100110 +01100110 +00111100 +00000000 + +TIL bg +01111100 +01100110 +01100110 +01111100 +01100000 +01100000 +01100000 +00000000 + +TIL bh +00111100 +01100110 +01100110 +01100110 +01100110 +00111100 +00001110 +00000000 + +TIL bi +01111100 +01100110 +01100110 +01111100 +01111000 +01101100 +01100110 +00000000 + +TIL bj +00111100 +01100110 +01100000 +00111100 +00000110 +01100110 +00111100 +00000000 + +TIL ca +01111110 +00011000 +00011000 +00011000 +00011000 +00011000 +00011000 +00000000 + +TIL cb +01100110 +01100110 +01100110 +01100110 +01100110 +01100110 +00111100 +00000000 + +TIL cc +01100110 +01100110 +01100110 +01100110 +01100110 +00111100 +00011000 +00000000 + +TIL cd +01100011 +01100011 +01100011 +01101011 +01111111 +01110111 +01100011 +00000000 + +TIL ce +01100110 +01100110 +00111100 +00011000 +00111100 +01100110 +01100110 +00000000 + +TIL cf +01100110 +01100110 +01100110 +00111100 +00011000 +00011000 +00011000 +00000000 + +TIL cg +01111110 +00000110 +00001100 +00011000 +00110000 +01100000 +01111110 +00000000 + +TIL ch +00111100 +00110000 +00110000 +00110000 +00110000 +00110000 +00111100 +00000000 + +TIL ci +00001100 +00010010 +00110000 +01111100 +00110000 +01100010 +11111100 +00000000 + +TIL cj +00111100 +00001100 +00001100 +00001100 +00001100 +00001100 +00111100 +00000000 + +TIL da +00000000 +00011000 +00111100 +01111110 +00011000 +00011000 +00011000 +00011000 + +TIL db +00000000 +00010000 +00110000 +01111111 +01111111 +00110000 +00010000 +00000000 + +TIL dc +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 + +TIL dd +00011000 +00011000 +00011000 +00011000 +00000000 +00000000 +00011000 +00000000 + +TIL de +01100110 +01100110 +01100110 +00000000 +00000000 +00000000 +00000000 +00000000 + +TIL df +01100110 +01100110 +11111111 +01100110 +11111111 +01100110 +01100110 +00000000 + +TIL dg +00011000 +00111110 +01100000 +00111100 +00000110 +01111100 +00011000 +00000000 + +TIL dh +01100010 +01100110 +00001100 +00011000 +00110000 +01100110 +01000110 +00000000 + +TIL di +00111100 +01100110 +00111100 +00111000 +01100111 +01100110 +00111111 +00000000 + +TIL dj +00000110 +00001100 +00011000 +00000000 +00000000 +00000000 +00000000 +00000000 + +TIL ea +00001100 +00011000 +00110000 +00110000 +00110000 +00011000 +00001100 +00000000 + +TIL eb +00110000 +00011000 +00001100 +00001100 +00001100 +00011000 +00110000 +00000000 + +TIL ec +00000000 +01100110 +00111100 +11111111 +00111100 +01100110 +00000000 +00000000 + +TIL ed +00000000 +00011000 +00011000 +01111110 +00011000 +00011000 +00000000 +00000000 + +TIL ee +00000000 +00000000 +00000000 +00000000 +00000000 +00011000 +00011000 +00110000 + +TIL ef +00000000 +00000000 +00000000 +01111110 +00000000 +00000000 +00000000 +00000000 + +TIL eg +00000000 +00000000 +00000000 +00000000 +00000000 +00011000 +00011000 +00000000 + +TIL eh +00000000 +00000011 +00000110 +00001100 +00011000 +00110000 +01100000 +00000000 + +TIL ei +00111100 +01100110 +01101110 +01110110 +01100110 +01100110 +00111100 +00000000 + +TIL ej +00011000 +00011000 +00111000 +00011000 +00011000 +00011000 +01111110 +00000000 + +TIL fa +00111100 +01100110 +00000110 +00001100 +00110000 +01100000 +01111110 +00000000 + +TIL fb +00111100 +01100110 +00000110 +00011100 +00000110 +01100110 +00111100 +00000000 + +TIL fc +00000110 +00001110 +00011110 +01100110 +01111111 +00000110 +00000110 +00000000 + +TIL fd +01111110 +01100000 +01111100 +00000110 +00000110 +01100110 +00111100 +00000000 + +TIL fe +00111100 +01100110 +01100000 +01111100 +01100110 +01100110 +00111100 +00000000 + +TIL ff +01111110 +01100110 +00001100 +00011000 +00011000 +00011000 +00011000 +00000000 + +TIL fg +00111100 +01100110 +01100110 +00111100 +01100110 +01100110 +00111100 +00000000 + +TIL fh +00111100 +01100110 +01100110 +00111110 +00000110 +01100110 +00111100 +00000000 + +TIL fi +00000000 +00000000 +00011000 +00000000 +00000000 +00011000 +00000000 +00000000 + +TIL fj +00000000 +00000000 +00011000 +00000000 +00000000 +00011000 +00011000 +00110000 + +TIL ga +00001110 +00011000 +00110000 +01100000 +00110000 +00011000 +00001110 +00000000 + +TIL gb +00000000 +00000000 +01111110 +00000000 +01111110 +00000000 +00000000 +00000000 + +TIL gc +01110000 +00011000 +00001100 +00000110 +00001100 +00011000 +01110000 +00000000 + +TIL gd +00111100 +01100110 +00000110 +00001100 +00011000 +00000000 +00011000 +00000000 + +TIL ge +00000000 +00000000 +00000000 +11111111 +11111111 +00000000 +00000000 +00000000 + +TIL gf +00001000 +00011100 +00111110 +01111111 +01111111 +00011100 +00111110 +00000000 + +TIL gg +00011000 +00011000 +00011000 +00011000 +00011000 +00011000 +00011000 +00011000 + +TIL gh +00000000 +00000000 +00000000 +11111111 +11111111 +00000000 +00000000 +00000000 + +TIL gi +00000000 +00000000 +11111111 +11111111 +00000000 +00000000 +00000000 +00000000 + +TIL gj +00000000 +11111111 +11111111 +00000000 +00000000 +00000000 +00000000 +00000000 + +TIL ha +00000000 +00000000 +00000000 +00000000 +11111111 +11111111 +00000000 +00000000 + +TIL hb +00110000 +00110000 +00110000 +00110000 +00110000 +00110000 +00110000 +00110000 + +TIL hc +00001100 +00001100 +00001100 +00001100 +00001100 +00001100 +00001100 +00001100 + +TIL hd +00000000 +00000000 +00000000 +11100000 +11110000 +00111000 +00011000 +00011000 + +TIL he +00011000 +00011000 +00011100 +00001111 +00000111 +00000000 +00000000 +00000000 + +TIL hf +00011000 +00011000 +00111000 +11110000 +11100000 +00000000 +00000000 +00000000 + +TIL hg +11000000 +11000000 +11000000 +11000000 +11000000 +11000000 +11111111 +11111111 + +TIL hh +11000000 +11100000 +01110000 +00111000 +00011100 +00001110 +00000111 +00000011 + +TIL hi +00000011 +00000111 +00001110 +00011100 +00111000 +01110000 +11100000 +11000000 + +TIL hj +11111111 +11111111 +11000000 +11000000 +11000000 +11000000 +11000000 +11000000 + +TIL ia +11111111 +11111111 +00000011 +00000011 +00000011 +00000011 +00000011 +00000011 + +TIL ib +00000000 +00111100 +01111110 +01111110 +01111110 +01111110 +00111100 +00000000 + +TIL ic +00000000 +00000000 +00000000 +00000000 +00000000 +11111111 +11111111 +00000000 + +TIL id +00110110 +01111111 +01111111 +01111111 +00111110 +00011100 +00001000 +00000000 + +TIL ie +01100000 +01100000 +01100000 +01100000 +01100000 +01100000 +01100000 +01100000 + +TIL if +00000000 +00000000 +00000000 +00000111 +00001111 +00011100 +00011000 +00011000 + +TIL ig +11000011 +11100111 +01111110 +00111100 +00111100 +01111110 +11100111 +11000011 + +TIL ih +00000000 +00111100 +01111110 +01100110 +01100110 +01111110 +00111100 +00000000 + +TIL ii +00011000 +00011000 +01100110 +01100110 +00011000 +00011000 +00111100 +00000000 + +TIL ij +00000110 +00000110 +00000110 +00000110 +00000110 +00000110 +00000110 +00000110 + +TIL ja +00001000 +00011100 +00111110 +01111111 +00111110 +00011100 +00001000 +00000000 + +TIL jb +00011000 +00011000 +00011000 +11111111 +11111111 +00011000 +00011000 +00011000 + +TIL jc +11000000 +11000000 +00110000 +00110000 +11000000 +11000000 +00110000 +00110000 + +TIL jd +00011000 +00011000 +00011000 +00011000 +00011000 +00011000 +00011000 +00011000 + +TIL je +00000000 +00000000 +00000011 +00111110 +01110110 +00110110 +00110110 +00000000 + +TIL jf +11111111 +01111111 +00111111 +00011111 +00001111 +00000111 +00000011 +00000001 + +TIL jg +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 + +TIL jh +11110000 +11110000 +11110000 +11110000 +11110000 +11110000 +11110000 +11110000 + +TIL ji +00000000 +00000000 +00000000 +00000000 +11111111 +11111111 +11111111 +11111111 + +TIL jj +11111111 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 + +TIL baa +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +11111111 + +TIL bab +11000000 +11000000 +11000000 +11000000 +11000000 +11000000 +11000000 +11000000 + +TIL bac +11001100 +11001100 +00110011 +00110011 +11001100 +11001100 +00110011 +00110011 + +TIL bad +00000011 +00000011 +00000011 +00000011 +00000011 +00000011 +00000011 +00000011 + +TIL bae +00000000 +00000000 +00000000 +00000000 +11001100 +11001100 +00110011 +00110011 + +TIL baf +11111111 +11111110 +11111100 +11111000 +11110000 +11100000 +11000000 +10000000 + +TIL bag +00000011 +00000011 +00000011 +00000011 +00000011 +00000011 +00000011 +00000011 + +TIL bah +00011000 +00011000 +00011000 +00011111 +00011111 +00011000 +00011000 +00011000 + +TIL bai +00000000 +00000000 +00000000 +00000000 +00001111 +00001111 +00001111 +00001111 + +TIL baj +00011000 +00011000 +00011000 +00011111 +00011111 +00000000 +00000000 +00000000 + +TIL bba +00000000 +00000000 +00000000 +11111000 +11111000 +00011000 +00011000 +00011000 + +TIL bbb +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +11111111 +11111111 + +TIL bbc +00000000 +00000000 +00000000 +00011111 +00011111 +00011000 +00011000 +00011000 + +TIL bbd +00011000 +00011000 +00011000 +11111111 +11111111 +00000000 +00000000 +00000000 + +TIL bbe +00000000 +00000000 +00000000 +11111111 +11111111 +00011000 +00011000 +00011000 + +TIL bbf +00011000 +00011000 +00011000 +11111000 +11111000 +00011000 +00011000 +00011000 + +TIL bbg +11000000 +11000000 +11000000 +11000000 +11000000 +11000000 +11000000 +11000000 + +TIL bbh +11100000 +11100000 +11100000 +11100000 +11100000 +11100000 +11100000 +11100000 + +TIL bbi +00000111 +00000111 +00000111 +00000111 +00000111 +00000111 +00000111 +00000111 + +TIL bbj +11111111 +11111111 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 + +TIL bca +11111111 +11111111 +11111111 +00000000 +00000000 +00000000 +00000000 +00000000 + +TIL bcb +00000000 +00000000 +00000000 +00000000 +00000000 +11111111 +11111111 +11111111 + +TIL bcc +00000011 +00000011 +00000011 +00000011 +00000011 +00000011 +11111111 +11111111 + +TIL bcd +00000000 +00000000 +00000000 +00000000 +11110000 +11110000 +11110000 +11110000 + +TIL bce +00001111 +00001111 +00001111 +00001111 +00000000 +00000000 +00000000 +00000000 + +TIL bcf +00011000 +00011000 +00011000 +11111000 +11111000 +00000000 +00000000 +00000000 + +TIL bcg +11110000 +11110000 +11110000 +11110000 +00000000 +00000000 +00000000 +00000000 + +TIL bch +11110000 +11110000 +11110000 +11110000 +00001111 +00001111 +00001111 +00001111 + +TIL bci +11000011 +10011001 +10010001 +10010001 +10011111 +10011001 +11000011 +11111111 + +TIL bcj +11100111 +11000011 +10011001 +10000001 +10011001 +10011001 +10011001 +11111111 + +TIL bda +10000011 +10011001 +10011001 +10000011 +10011001 +10011001 +10000011 +11111111 + +TIL bdb +11000011 +10011001 +10011111 +10011111 +10011111 +10011001 +11000011 +11111111 + +TIL bdc +10000111 +10010011 +10011001 +10011001 +10011001 +10010011 +10000111 +11111111 + +TIL bdd +10000001 +10011111 +10011111 +10000111 +10011111 +10011111 +10000001 +11111111 + +TIL bde +10000001 +10011111 +10011111 +10000111 +10011111 +10011111 +10011111 +11111111 + +TIL bdf +11000011 +10011001 +10011111 +10010001 +10011001 +10011001 +11000011 +11111111 + +TIL bdg +10011001 +10011001 +10011001 +10000001 +10011001 +10011001 +10011001 +11111111 + +TIL bdh +11000011 +11100111 +11100111 +11100111 +11100111 +11100111 +11000011 +11111111 + +TIL bdi +11100001 +11110011 +11110011 +11110011 +11110011 +10010011 +11000111 +11111111 + +TIL bdj +10011001 +10010011 +10000111 +10001111 +10000111 +10010011 +10011001 +11111111 + +TIL bea +10011111 +10011111 +10011111 +10011111 +10011111 +10011111 +10000001 +11111111 + +TIL beb +10011100 +10001000 +10000000 +10010100 +10011100 +10011100 +10011100 +11111111 + +TIL bec +10011001 +10001001 +10000001 +10000001 +10010001 +10011001 +10011001 +11111111 + +TIL bed +11000011 +10011001 +10011001 +10011001 +10011001 +10011001 +11000011 +11111111 + +TIL bee +10000011 +10011001 +10011001 +10000011 +10011111 +10011111 +10011111 +11111111 + +TIL bef +11000011 +10011001 +10011001 +10011001 +10011001 +11000011 +11110001 +11111111 + +TIL beg +10000011 +10011001 +10011001 +10000011 +10000111 +10010011 +10011001 +11111111 + +TIL beh +11000011 +10011001 +10011111 +11000011 +11111001 +10011001 +11000011 +11111111 + +TIL bei +10000001 +11100111 +11100111 +11100111 +11100111 +11100111 +11100111 +11111111 + +TIL bej +10011001 +10011001 +10011001 +10011001 +10011001 +10011001 +11000011 +11111111 + +TIL bfa +10011001 +10011001 +10011001 +10011001 +10011001 +11000011 +11100111 +11111111 + +TIL bfb +10011100 +10011100 +10011100 +10010100 +10000000 +10001000 +10011100 +11111111 + +TIL bfc +10011001 +10011001 +11000011 +11100111 +11000011 +10011001 +10011001 +11111111 + +TIL bfd +10011001 +10011001 +10011001 +11000011 +11100111 +11100111 +11100111 +11111111 + +TIL bfe +10000001 +11111001 +11110011 +11100111 +11001111 +10011111 +10000001 +11111111 + +TIL bff +11000011 +11001111 +11001111 +11001111 +11001111 +11001111 +11000011 +11111111 + +TIL bfg +11110011 +11101101 +11001111 +10000011 +11001111 +10011101 +00000011 +11111111 + +TIL bfh +11000011 +11110011 +11110011 +11110011 +11110011 +11110011 +11000011 +11111111 + +TIL bfi +11111111 +11100111 +11000011 +10000001 +11100111 +11100111 +11100111 +11100111 + +TIL bfj +11111111 +11101111 +11001111 +10000000 +10000000 +11001111 +11101111 +11111111 + +TIL bga +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 + +TIL bgb +11100111 +11100111 +11100111 +11100111 +11111111 +11111111 +11100111 +11111111 + +TIL bgc +10011001 +10011001 +10011001 +11111111 +11111111 +11111111 +11111111 +11111111 + +TIL bgd +10011001 +10011001 +00000000 +10011001 +00000000 +10011001 +10011001 +11111111 + +TIL bge +11100111 +11000001 +10011111 +11000011 +11111001 +10000011 +11100111 +11111111 + +TIL bgf +10011101 +10011001 +11110011 +11100111 +11001111 +10011001 +10111001 +11111111 + +TIL bgg +11000011 +10011001 +11000011 +11000111 +10011000 +10011001 +11000000 +11111111 + +TIL bgh +11111001 +11110011 +11100111 +11111111 +11111111 +11111111 +11111111 +11111111 + +TIL bgi +11110011 +11100111 +11001111 +11001111 +11001111 +11100111 +11110011 +11111111 + +TIL bgj +11001111 +11100111 +11110011 +11110011 +11110011 +11100111 +11001111 +11111111 + +TIL bha +11111111 +10011001 +11000011 +00000000 +11000011 +10011001 +11111111 +11111111 + +TIL bhb +11111111 +11100111 +11100111 +10000001 +11100111 +11100111 +11111111 +11111111 + +TIL bhc +11111111 +11111111 +11111111 +11111111 +11111111 +11100111 +11100111 +11001111 + +TIL bhd +11111111 +11111111 +11111111 +10000001 +11111111 +11111111 +11111111 +11111111 + +TIL bhe +11111111 +11111111 +11111111 +11111111 +11111111 +11100111 +11100111 +11111111 + +TIL bhf +11111111 +11111100 +11111001 +11110011 +11100111 +11001111 +10011111 +11111111 + +TIL bhg +11000011 +10011001 +10010001 +10001001 +10011001 +10011001 +11000011 +11111111 + +TIL bhh +11100111 +11100111 +11000111 +11100111 +11100111 +11100111 +10000001 +11111111 + +TIL bhi +11000011 +10011001 +11111001 +11110011 +11001111 +10011111 +10000001 +11111111 + +TIL bhj +11000011 +10011001 +11111001 +11100011 +11111001 +10011001 +11000011 +11111111 + +TIL bia +11111001 +11110001 +11100001 +10011001 +10000000 +11111001 +11111001 +11111111 + +TIL bib +10000001 +10011111 +10000011 +11111001 +11111001 +10011001 +11000011 +11111111 + +TIL bic +11000011 +10011001 +10011111 +10000011 +10011001 +10011001 +11000011 +11111111 + +TIL bid +10000001 +10011001 +11110011 +11100111 +11100111 +11100111 +11100111 +11111111 + +TIL bie +11000011 +10011001 +10011001 +11000011 +10011001 +10011001 +11000011 +11111111 + +TIL bif +11000011 +10011001 +10011001 +11000001 +11111001 +10011001 +11000011 +11111111 + +TIL big +11111111 +11111111 +11100111 +11111111 +11111111 +11100111 +11111111 +11111111 + +TIL bih +11111111 +11111111 +11100111 +11111111 +11111111 +11100111 +11100111 +11001111 + +TIL bii +11110001 +11100111 +11001111 +10011111 +11001111 +11100111 +11110001 +11111111 + +TIL bij +11111111 +11111111 +10000001 +11111111 +10000001 +11111111 +11111111 +11111111 + +TIL bja +10001111 +11100111 +11110011 +11111001 +11110011 +11100111 +10001111 +11111111 + +TIL bjb +11000011 +10011001 +11111001 +11110011 +11100111 +11111111 +11100111 +11111111 + +TIL bjc +11111111 +11111111 +11111111 +00000000 +00000000 +11111111 +11111111 +11111111 + +TIL bjd +11110111 +11100011 +11000001 +10000000 +10000000 +11100011 +11000001 +11111111 + +TIL bje +11100111 +11100111 +11100111 +11100111 +11100111 +11100111 +11100111 +11100111 + +TIL bjf +11111111 +11111111 +11111111 +00000000 +00000000 +11111111 +11111111 +11111111 + +TIL bjg +11111111 +11111111 +00000000 +00000000 +11111111 +11111111 +11111111 +11111111 + +TIL bjh +11111111 +00000000 +00000000 +11111111 +11111111 +11111111 +11111111 +11111111 + +TIL bji +11111111 +11111111 +11111111 +11111111 +00000000 +00000000 +11111111 +11111111 + +TIL bjj +11001111 +11001111 +11001111 +11001111 +11001111 +11001111 +11001111 +11001111 + +TIL caa +11110011 +11110011 +11110011 +11110011 +11110011 +11110011 +11110011 +11110011 + +TIL cab +11111111 +11111111 +11111111 +00011111 +00001111 +11000111 +11100111 +11100111 + +TIL cac +11100111 +11100111 +11100011 +11110000 +11111000 +11111111 +11111111 +11111111 + +TIL cad +11100111 +11100111 +11000111 +00001111 +00011111 +11111111 +11111111 +11111111 + +TIL cae +00111111 +00111111 +00111111 +00111111 +00111111 +00111111 +00000000 +00000000 + +TIL caf +00111111 +00011111 +10001111 +11000111 +11100011 +11110001 +11111000 +11111100 + +TIL cag +11111100 +11111000 +11110001 +11100011 +11000111 +10001111 +00011111 +00111111 + +TIL cah +00000000 +00000000 +00111111 +00111111 +00111111 +00111111 +00111111 +00111111 + +TIL cai +00000000 +00000000 +11111100 +11111100 +11111100 +11111100 +11111100 +11111100 + +TIL caj +11111111 +11000011 +10000001 +10000001 +10000001 +10000001 +11000011 +11111111 + +TIL cba +11111111 +11111111 +11111111 +11111111 +11111111 +00000000 +00000000 +11111111 + +TIL cbb +11001001 +10000000 +10000000 +10000000 +11000001 +11100011 +11110111 +11111111 + +TIL cbc +10011111 +10011111 +10011111 +10011111 +10011111 +10011111 +10011111 +10011111 + +TIL cbd +11111111 +11111111 +11111111 +11111000 +11110000 +11100011 +11100111 +11100111 + +TIL cbe +00111100 +00011000 +10000001 +11000011 +11000011 +10000001 +00011000 +00111100 + +TIL cbf +11111111 +11000011 +10000001 +10011001 +10011001 +10000001 +11000011 +11111111 + +TIL cbg +11100111 +11100111 +10011001 +10011001 +11100111 +11100111 +11000011 +11111111 + +TIL cbh +11111001 +11111001 +11111001 +11111001 +11111001 +11111001 +11111001 +11111001 + +TIL cbi +11110111 +11100011 +11000001 +10000000 +11000001 +11100011 +11110111 +11111111 + +TIL cbj +11100111 +11100111 +11100111 +00000000 +00000000 +11100111 +11100111 +11100111 + +TIL cca +00111111 +00111111 +11001111 +11001111 +00111111 +00111111 +11001111 +11001111 + +TIL ccb +11100111 +11100111 +11100111 +11100111 +11100111 +11100111 +11100111 +11100111 + +TIL ccc +11111111 +11111111 +11111100 +11000001 +10001001 +11001001 +11001001 +11111111 + +TIL ccd +00000000 +10000000 +11000000 +11100000 +11110000 +11111000 +11111100 +11111110 + +TIL cce +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 + +TIL ccf +00001111 +00001111 +00001111 +00001111 +00001111 +00001111 +00001111 +00001111 + +TIL ccg +11111111 +11111111 +11111111 +11111111 +00000000 +00000000 +00000000 +00000000 + +TIL cch +00000000 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 + +TIL cci +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +00000000 + +TIL ccj +00111111 +00111111 +00111111 +00111111 +00111111 +00111111 +00111111 +00111111 + +TIL cda +00110011 +00110011 +11001100 +11001100 +00110011 +00110011 +11001100 +11001100 + +TIL cdb +11111100 +11111100 +11111100 +11111100 +11111100 +11111100 +11111100 +11111100 + +TIL cdc +11111111 +11111111 +11111111 +11111111 +00110011 +00110011 +11001100 +11001100 + +TIL cdd +00000000 +00000001 +00000011 +00000111 +00001111 +00011111 +00111111 +01111111 + +TIL cde +11111100 +11111100 +11111100 +11111100 +11111100 +11111100 +11111100 +11111100 + +TIL cdf +11100111 +11100111 +11100111 +11100000 +11100000 +11100111 +11100111 +11100111 + +TIL cdg +11111111 +11111111 +11111111 +11111111 +11110000 +11110000 +11110000 +11110000 + +TIL cdh +11100111 +11100111 +11100111 +11100000 +11100000 +11111111 +11111111 +11111111 + +TIL cdi +11111111 +11111111 +11111111 +00000111 +00000111 +11100111 +11100111 +11100111 + +TIL cdj +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +00000000 +00000000 + +TIL cea +11111111 +11111111 +11111111 +11100000 +11100000 +11100111 +11100111 +11100111 + +TIL ceb +11100111 +11100111 +11100111 +00000000 +00000000 +11111111 +11111111 +11111111 + +TIL cec +11111111 +11111111 +11111111 +00000000 +00000000 +11100111 +11100111 +11100111 + +TIL ced +11100111 +11100111 +11100111 +00000111 +00000111 +11100111 +11100111 +11100111 + +TIL cee +00111111 +00111111 +00111111 +00111111 +00111111 +00111111 +00111111 +00111111 + +TIL cef +00011111 +00011111 +00011111 +00011111 +00011111 +00011111 +00011111 +00011111 + +TIL ceg +11111000 +11111000 +11111000 +11111000 +11111000 +11111000 +11111000 +11111000 + +TIL ceh +00000000 +00000000 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 + +TIL cei +00000000 +00000000 +00000000 +11111111 +11111111 +11111111 +11111111 +11111111 + +TIL cej +11111111 +11111111 +11111111 +11111111 +11111111 +00000000 +00000000 +00000000 + +TIL cfa +11111100 +11111100 +11111100 +11111100 +11111100 +11111100 +00000000 +00000000 + +TIL cfb +11111111 +11111111 +11111111 +11111111 +00001111 +00001111 +00001111 +00001111 + +TIL cfc +11110000 +11110000 +11110000 +11110000 +11111111 +11111111 +11111111 +11111111 + +TIL cfd +11100111 +11100111 +11100111 +00000111 +00000111 +11111111 +11111111 +11111111 + +TIL cfe +00001111 +00001111 +00001111 +00001111 +11111111 +11111111 +11111111 +11111111 + +TIL cff +00001111 +00001111 +00001111 +00001111 +11110000 +11110000 +11110000 +11110000 + +TIL cfg +00111100 +01100110 +01101110 +01101110 +01100000 +01100010 +00111100 +00000000 + +TIL cfh +00000000 +00000000 +00111100 +00000110 +00111110 +01100110 +00111110 +00000000 + +TIL cfi +00000000 +01100000 +01100000 +01111100 +01100110 +01100110 +01111100 +00000000 + +TIL cfj +00000000 +00000000 +00111100 +01100000 +01100000 +01100000 +00111100 +00000000 + +TIL cga +00000000 +00000110 +00000110 +00111110 +01100110 +01100110 +00111110 +00000000 + +TIL cgb +00000000 +00000000 +00111100 +01100110 +01111110 +01100000 +00111100 +00000000 + +TIL cgc +00000000 +00001110 +00011000 +00111110 +00011000 +00011000 +00011000 +00000000 + +TIL cgd +00000000 +00000000 +00111110 +01100110 +01100110 +00111110 +00000110 +01111100 + +TIL cge +00000000 +01100000 +01100000 +01111100 +01100110 +01100110 +01100110 +00000000 + +TIL cgf +00000000 +00011000 +00000000 +00111000 +00011000 +00011000 +00111100 +00000000 + +TIL cgg +00000000 +00000110 +00000000 +00000110 +00000110 +00000110 +00000110 +00111100 + +TIL cgh +00000000 +01100000 +01100000 +01101100 +01111000 +01101100 +01100110 +00000000 + +TIL cgi +00000000 +00111000 +00011000 +00011000 +00011000 +00011000 +00111100 +00000000 + +TIL cgj +00000000 +00000000 +01100110 +01111111 +01111111 +01101011 +01100011 +00000000 + +TIL cha +00000000 +00000000 +01111100 +01100110 +01100110 +01100110 +01100110 +00000000 + +TIL chb +00000000 +00000000 +00111100 +01100110 +01100110 +01100110 +00111100 +00000000 + +TIL chc +00000000 +00000000 +01111100 +01100110 +01100110 +01111100 +01100000 +01100000 + +TIL chd +00000000 +00000000 +00111110 +01100110 +01100110 +00111110 +00000110 +00000110 + +TIL che +00000000 +00000000 +01111100 +01100110 +01100000 +01100000 +01100000 +00000000 + +TIL chf +00000000 +00000000 +00111110 +01100000 +00111100 +00000110 +01111100 +00000000 + +TIL chg +00000000 +00011000 +01111110 +00011000 +00011000 +00011000 +00001110 +00000000 + +TIL chh +00000000 +00000000 +01100110 +01100110 +01100110 +01100110 +00111110 +00000000 + +TIL chi +00000000 +00000000 +01100110 +01100110 +01100110 +00111100 +00011000 +00000000 + +TIL chj +00000000 +00000000 +01100011 +01101011 +01111111 +00111110 +00110110 +00000000 + +TIL cia +00000000 +00000000 +01100110 +00111100 +00011000 +00111100 +01100110 +00000000 + +TIL cib +00000000 +00000000 +01100110 +01100110 +01100110 +00111110 +00001100 +01111000 + +TIL cic +00000000 +00000000 +01111110 +00001100 +00011000 +00110000 +01111110 +00000000 + +TIL cid +00111100 +00110000 +00110000 +00110000 +00110000 +00110000 +00111100 +00000000 + +TIL cie +00001100 +00010010 +00110000 +01111100 +00110000 +01100010 +11111100 +00000000 + +TIL cif +00111100 +00001100 +00001100 +00001100 +00001100 +00001100 +00111100 +00000000 + +TIL cig +00000000 +00011000 +00111100 +01111110 +00011000 +00011000 +00011000 +00011000 + +TIL cih +00000000 +00010000 +00110000 +01111111 +01111111 +00110000 +00010000 +00000000 + +TIL cii +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 + +TIL cij +00011000 +00011000 +00011000 +00011000 +00000000 +00000000 +00011000 +00000000 + +TIL cja +01100110 +01100110 +01100110 +00000000 +00000000 +00000000 +00000000 +00000000 + +TIL cjb +01100110 +01100110 +11111111 +01100110 +11111111 +01100110 +01100110 +00000000 + +TIL cjc +00011000 +00111110 +01100000 +00111100 +00000110 +01111100 +00011000 +00000000 + +TIL cjd +01100010 +01100110 +00001100 +00011000 +00110000 +01100110 +01000110 +00000000 + +TIL cje +00111100 +01100110 +00111100 +00111000 +01100111 +01100110 +00111111 +00000000 + +TIL cjf +00000110 +00001100 +00011000 +00000000 +00000000 +00000000 +00000000 +00000000 + +TIL cjg +00001100 +00011000 +00110000 +00110000 +00110000 +00011000 +00001100 +00000000 + +TIL cjh +00110000 +00011000 +00001100 +00001100 +00001100 +00011000 +00110000 +00000000 + +TIL cji +00000000 +01100110 +00111100 +11111111 +00111100 +01100110 +00000000 +00000000 + +TIL cjj +00000000 +00011000 +00011000 +01111110 +00011000 +00011000 +00000000 +00000000 + +TIL daa +00000000 +00000000 +00000000 +00000000 +00000000 +00011000 +00011000 +00110000 + +TIL dab +00000000 +00000000 +00000000 +01111110 +00000000 +00000000 +00000000 +00000000 + +TIL dac +00000000 +00000000 +00000000 +00000000 +00000000 +00011000 +00011000 +00000000 + +TIL dad +00000000 +00000011 +00000110 +00001100 +00011000 +00110000 +01100000 +00000000 + +TIL dae +00111100 +01100110 +01101110 +01110110 +01100110 +01100110 +00111100 +00000000 + +TIL daf +00011000 +00011000 +00111000 +00011000 +00011000 +00011000 +01111110 +00000000 + +TIL dag +00111100 +01100110 +00000110 +00001100 +00110000 +01100000 +01111110 +00000000 + +TIL dah +00111100 +01100110 +00000110 +00011100 +00000110 +01100110 +00111100 +00000000 + +TIL dai +00000110 +00001110 +00011110 +01100110 +01111111 +00000110 +00000110 +00000000 + +TIL daj +01111110 +01100000 +01111100 +00000110 +00000110 +01100110 +00111100 +00000000 + +TIL dba +00111100 +01100110 +01100000 +01111100 +01100110 +01100110 +00111100 +00000000 + +TIL dbb +01111110 +01100110 +00001100 +00011000 +00011000 +00011000 +00011000 +00000000 + +TIL dbc +00111100 +01100110 +01100110 +00111100 +01100110 +01100110 +00111100 +00000000 + +TIL dbd +00111100 +01100110 +01100110 +00111110 +00000110 +01100110 +00111100 +00000000 + +TIL dbe +00000000 +00000000 +00011000 +00000000 +00000000 +00011000 +00000000 +00000000 + +TIL dbf +00000000 +00000000 +00011000 +00000000 +00000000 +00011000 +00011000 +00110000 + +TIL dbg +00001110 +00011000 +00110000 +01100000 +00110000 +00011000 +00001110 +00000000 + +TIL dbh +00000000 +00000000 +01111110 +00000000 +01111110 +00000000 +00000000 +00000000 + +TIL dbi +01110000 +00011000 +00001100 +00000110 +00001100 +00011000 +01110000 +00000000 + +TIL dbj +00111100 +01100110 +00000110 +00001100 +00011000 +00000000 +00011000 +00000000 + +TIL dca +00000000 +00000000 +00000000 +11111111 +11111111 +00000000 +00000000 +00000000 + +TIL dcb +00011000 +00111100 +01100110 +01111110 +01100110 +01100110 +01100110 +00000000 + +TIL dcc +01111100 +01100110 +01100110 +01111100 +01100110 +01100110 +01111100 +00000000 + +TIL dcd +00111100 +01100110 +01100000 +01100000 +01100000 +01100110 +00111100 +00000000 + +TIL dce +01111000 +01101100 +01100110 +01100110 +01100110 +01101100 +01111000 +00000000 + +TIL dcf +01111110 +01100000 +01100000 +01111000 +01100000 +01100000 +01111110 +00000000 + +TIL dcg +01111110 +01100000 +01100000 +01111000 +01100000 +01100000 +01100000 +00000000 + +TIL dch +00111100 +01100110 +01100000 +01101110 +01100110 +01100110 +00111100 +00000000 + +TIL dci +01100110 +01100110 +01100110 +01111110 +01100110 +01100110 +01100110 +00000000 + +TIL dcj +00111100 +00011000 +00011000 +00011000 +00011000 +00011000 +00111100 +00000000 + +TIL dda +00011110 +00001100 +00001100 +00001100 +00001100 +01101100 +00111000 +00000000 + +TIL ddb +01100110 +01101100 +01111000 +01110000 +01111000 +01101100 +01100110 +00000000 + +TIL ddc +01100000 +01100000 +01100000 +01100000 +01100000 +01100000 +01111110 +00000000 + +TIL ddd +01100011 +01110111 +01111111 +01101011 +01100011 +01100011 +01100011 +00000000 + +TIL dde +01100110 +01110110 +01111110 +01111110 +01101110 +01100110 +01100110 +00000000 + +TIL ddf +00111100 +01100110 +01100110 +01100110 +01100110 +01100110 +00111100 +00000000 + +TIL ddg +01111100 +01100110 +01100110 +01111100 +01100000 +01100000 +01100000 +00000000 + +TIL ddh +00111100 +01100110 +01100110 +01100110 +01100110 +00111100 +00001110 +00000000 + +TIL ddi +01111100 +01100110 +01100110 +01111100 +01111000 +01101100 +01100110 +00000000 + +TIL ddj +00111100 +01100110 +01100000 +00111100 +00000110 +01100110 +00111100 +00000000 + +TIL dea +01111110 +00011000 +00011000 +00011000 +00011000 +00011000 +00011000 +00000000 + +TIL deb +01100110 +01100110 +01100110 +01100110 +01100110 +01100110 +00111100 +00000000 + +TIL dec +01100110 +01100110 +01100110 +01100110 +01100110 +00111100 +00011000 +00000000 + +TIL ded +01100011 +01100011 +01100011 +01101011 +01111111 +01110111 +01100011 +00000000 + +TIL dee +01100110 +01100110 +00111100 +00011000 +00111100 +01100110 +01100110 +00000000 + +TIL def +01100110 +01100110 +01100110 +00111100 +00011000 +00011000 +00011000 +00000000 + +TIL deg +01111110 +00000110 +00001100 +00011000 +00110000 +01100000 +01111110 +00000000 + +TIL deh +00011000 +00011000 +00011000 +11111111 +11111111 +00011000 +00011000 +00011000 + +TIL dei +11000000 +11000000 +00110000 +00110000 +11000000 +11000000 +00110000 +00110000 + +TIL dej +00011000 +00011000 +00011000 +00011000 +00011000 +00011000 +00011000 +00011000 + +TIL dfa +00110011 +00110011 +11001100 +11001100 +00110011 +00110011 +11001100 +11001100 + +TIL dfb +00110011 +10011001 +11001100 +01100110 +00110011 +10011001 +11001100 +01100110 + +TIL dfc +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 + +TIL dfd +11110000 +11110000 +11110000 +11110000 +11110000 +11110000 +11110000 +11110000 + +TIL dfe +00000000 +00000000 +00000000 +00000000 +11111111 +11111111 +11111111 +11111111 + +TIL dff +11111111 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 + +TIL dfg +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +11111111 + +TIL dfh +11000000 +11000000 +11000000 +11000000 +11000000 +11000000 +11000000 +11000000 + +TIL dfi +11001100 +11001100 +00110011 +00110011 +11001100 +11001100 +00110011 +00110011 + +TIL dfj +00000011 +00000011 +00000011 +00000011 +00000011 +00000011 +00000011 +00000011 + +TIL dga +00000000 +00000000 +00000000 +00000000 +11001100 +11001100 +00110011 +00110011 + +TIL dgb +11001100 +10011001 +00110011 +01100110 +11001100 +10011001 +00110011 +01100110 + +TIL dgc +00000011 +00000011 +00000011 +00000011 +00000011 +00000011 +00000011 +00000011 + +TIL dgd +00011000 +00011000 +00011000 +00011111 +00011111 +00011000 +00011000 +00011000 + +TIL dge +00000000 +00000000 +00000000 +00000000 +00001111 +00001111 +00001111 +00001111 + +TIL dgf +00011000 +00011000 +00011000 +00011111 +00011111 +00000000 +00000000 +00000000 + +TIL dgg +00000000 +00000000 +00000000 +11111000 +11111000 +00011000 +00011000 +00011000 + +TIL dgh +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +11111111 +11111111 + +TIL dgi +00000000 +00000000 +00000000 +00011111 +00011111 +00011000 +00011000 +00011000 + +TIL dgj +00011000 +00011000 +00011000 +11111111 +11111111 +00000000 +00000000 +00000000 + +TIL dha +00000000 +00000000 +00000000 +11111111 +11111111 +00011000 +00011000 +00011000 + +TIL dhb +00011000 +00011000 +00011000 +11111000 +11111000 +00011000 +00011000 +00011000 + +TIL dhc +11000000 +11000000 +11000000 +11000000 +11000000 +11000000 +11000000 +11000000 + +TIL dhd +11100000 +11100000 +11100000 +11100000 +11100000 +11100000 +11100000 +11100000 + +TIL dhe +00000111 +00000111 +00000111 +00000111 +00000111 +00000111 +00000111 +00000111 + +TIL dhf +11111111 +11111111 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 + +TIL dhg +11111111 +11111111 +11111111 +00000000 +00000000 +00000000 +00000000 +00000000 + +TIL dhh +00000000 +00000000 +00000000 +00000000 +00000000 +11111111 +11111111 +11111111 + +TIL dhi +00000001 +00000011 +00000110 +01101100 +01111000 +01110000 +01100000 +00000000 + +TIL dhj +00000000 +00000000 +00000000 +00000000 +11110000 +11110000 +11110000 +11110000 + +TIL dia +00001111 +00001111 +00001111 +00001111 +00000000 +00000000 +00000000 +00000000 + +TIL dib +00011000 +00011000 +00011000 +11111000 +11111000 +00000000 +00000000 +00000000 + +TIL dic +11110000 +11110000 +11110000 +11110000 +00000000 +00000000 +00000000 +00000000 + +TIL did +11110000 +11110000 +11110000 +11110000 +00001111 +00001111 +00001111 +00001111 + +TIL die +11000011 +10011001 +10010001 +10010001 +10011111 +10011001 +11000011 +11111111 + +TIL dif +11111111 +11111111 +11000011 +11111001 +11000001 +10011001 +11000001 +11111111 + +TIL dig +11111111 +10011111 +10011111 +10000011 +10011001 +10011001 +10000011 +11111111 + +TIL dih +11111111 +11111111 +11000011 +10011111 +10011111 +10011111 +11000011 +11111111 + +TIL dii +11111111 +11111001 +11111001 +11000001 +10011001 +10011001 +11000001 +11111111 + +TIL dij +11111111 +11111111 +11000011 +10011001 +10000001 +10011111 +11000011 +11111111 + +TIL dja +11111111 +11110001 +11100111 +11000001 +11100111 +11100111 +11100111 +11111111 + +TIL djb +11111111 +11111111 +11000001 +10011001 +10011001 +11000001 +11111001 +10000011 + +TIL djc +11111111 +10011111 +10011111 +10000011 +10011001 +10011001 +10011001 +11111111 + +TIL djd +11111111 +11100111 +11111111 +11000111 +11100111 +11100111 +11000011 +11111111 + +TIL dje +11111111 +11111001 +11111111 +11111001 +11111001 +11111001 +11111001 +11000011 + +TIL djf +11111111 +10011111 +10011111 +10010011 +10000111 +10010011 +10011001 +11111111 + +TIL djg +11111111 +11000111 +11100111 +11100111 +11100111 +11100111 +11000011 +11111111 + +TIL djh +11111111 +11111111 +10011001 +10000000 +10000000 +10010100 +10011100 +11111111 + +TIL dji +11111111 +11111111 +10000011 +10011001 +10011001 +10011001 +10011001 +11111111 + +TIL djj +11111111 +11111111 +11000011 +10011001 +10011001 +10011001 +11000011 +11111111 + +TIL eaa +11111111 +11111111 +10000011 +10011001 +10011001 +10000011 +10011111 +10011111 + +TIL eab +11111111 +11111111 +11000001 +10011001 +10011001 +11000001 +11111001 +11111001 + +TIL eac +11111111 +11111111 +10000011 +10011001 +10011111 +10011111 +10011111 +11111111 + +TIL ead +11111111 +11111111 +11000001 +10011111 +11000011 +11111001 +10000011 +11111111 + +TIL eae +11111111 +11100111 +10000001 +11100111 +11100111 +11100111 +11110001 +11111111 + +TIL eaf +11111111 +11111111 +10011001 +10011001 +10011001 +10011001 +11000001 +11111111 + +TIL eag +11111111 +11111111 +10011001 +10011001 +10011001 +11000011 +11100111 +11111111 + +TIL eah +11111111 +11111111 +10011100 +10010100 +10000000 +11000001 +11001001 +11111111 + +TIL eai +11111111 +11111111 +10011001 +11000011 +11100111 +11000011 +10011001 +11111111 + +TIL eaj +11111111 +11111111 +10011001 +10011001 +10011001 +11000001 +11110011 +10000111 + +TIL eba +11111111 +11111111 +10000001 +11110011 +11100111 +11001111 +10000001 +11111111 + +TIL ebb +11000011 +11001111 +11001111 +11001111 +11001111 +11001111 +11000011 +11111111 + +TIL ebc +11110011 +11101101 +11001111 +10000011 +11001111 +10011101 +00000011 +11111111 + +TIL ebd +11000011 +11110011 +11110011 +11110011 +11110011 +11110011 +11000011 +11111111 + +TIL ebe +11111111 +11100111 +11000011 +10000001 +11100111 +11100111 +11100111 +11100111 + +TIL ebf +11111111 +11101111 +11001111 +10000000 +10000000 +11001111 +11101111 +11111111 + +TIL ebg +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 + +TIL ebh +11100111 +11100111 +11100111 +11100111 +11111111 +11111111 +11100111 +11111111 + +TIL ebi +10011001 +10011001 +10011001 +11111111 +11111111 +11111111 +11111111 +11111111 + +TIL ebj +10011001 +10011001 +00000000 +10011001 +00000000 +10011001 +10011001 +11111111 + +TIL eca +11100111 +11000001 +10011111 +11000011 +11111001 +10000011 +11100111 +11111111 + +TIL ecb +10011101 +10011001 +11110011 +11100111 +11001111 +10011001 +10111001 +11111111 + +TIL ecc +11000011 +10011001 +11000011 +11000111 +10011000 +10011001 +11000000 +11111111 + +TIL ecd +11111001 +11110011 +11100111 +11111111 +11111111 +11111111 +11111111 +11111111 + +TIL ece +11110011 +11100111 +11001111 +11001111 +11001111 +11100111 +11110011 +11111111 + +TIL ecf +11001111 +11100111 +11110011 +11110011 +11110011 +11100111 +11001111 +11111111 + +TIL ecg +11111111 +10011001 +11000011 +00000000 +11000011 +10011001 +11111111 +11111111 + +TIL ech +11111111 +11100111 +11100111 +10000001 +11100111 +11100111 +11111111 +11111111 + +TIL eci +11111111 +11111111 +11111111 +11111111 +11111111 +11100111 +11100111 +11001111 + +TIL ecj +11111111 +11111111 +11111111 +10000001 +11111111 +11111111 +11111111 +11111111 + +TIL eda +11111111 +11111111 +11111111 +11111111 +11111111 +11100111 +11100111 +11111111 + +TIL edb +11111111 +11111100 +11111001 +11110011 +11100111 +11001111 +10011111 +11111111 + +TIL edc +11000011 +10011001 +10010001 +10001001 +10011001 +10011001 +11000011 +11111111 + +TIL edd +11100111 +11100111 +11000111 +11100111 +11100111 +11100111 +10000001 +11111111 + +TIL ede +11000011 +10011001 +11111001 +11110011 +11001111 +10011111 +10000001 +11111111 + +TIL edf +11000011 +10011001 +11111001 +11100011 +11111001 +10011001 +11000011 +11111111 + +TIL edg +11111001 +11110001 +11100001 +10011001 +10000000 +11111001 +11111001 +11111111 + +TIL edh +10000001 +10011111 +10000011 +11111001 +11111001 +10011001 +11000011 +11111111 + +TIL edi +11000011 +10011001 +10011111 +10000011 +10011001 +10011001 +11000011 +11111111 + +TIL edj +10000001 +10011001 +11110011 +11100111 +11100111 +11100111 +11100111 +11111111 + +TIL eea +11000011 +10011001 +10011001 +11000011 +10011001 +10011001 +11000011 +11111111 + +TIL eeb +11000011 +10011001 +10011001 +11000001 +11111001 +10011001 +11000011 +11111111 + +TIL eec +11111111 +11111111 +11100111 +11111111 +11111111 +11100111 +11111111 +11111111 + +TIL eed +11111111 +11111111 +11100111 +11111111 +11111111 +11100111 +11100111 +11001111 + +TIL eee +11110001 +11100111 +11001111 +10011111 +11001111 +11100111 +11110001 +11111111 + +TIL eef +11111111 +11111111 +10000001 +11111111 +10000001 +11111111 +11111111 +11111111 + +TIL eeg +10001111 +11100111 +11110011 +11111001 +11110011 +11100111 +10001111 +11111111 + +TIL eeh +11000011 +10011001 +11111001 +11110011 +11100111 +11111111 +11100111 +11111111 + +TIL eei +11111111 +11111111 +11111111 +00000000 +00000000 +11111111 +11111111 +11111111 + +TIL eej +11100111 +11000011 +10011001 +10000001 +10011001 +10011001 +10011001 +11111111 + +TIL efa +10000011 +10011001 +10011001 +10000011 +10011001 +10011001 +10000011 +11111111 + +TIL efb +11000011 +10011001 +10011111 +10011111 +10011111 +10011001 +11000011 +11111111 + +TIL efc +10000111 +10010011 +10011001 +10011001 +10011001 +10010011 +10000111 +11111111 + +TIL efd +10000001 +10011111 +10011111 +10000111 +10011111 +10011111 +10000001 +11111111 + +TIL efe +10000001 +10011111 +10011111 +10000111 +10011111 +10011111 +10011111 +11111111 + +TIL eff +11000011 +10011001 +10011111 +10010001 +10011001 +10011001 +11000011 +11111111 + +TIL efg +10011001 +10011001 +10011001 +10000001 +10011001 +10011001 +10011001 +11111111 + +TIL efh +11000011 +11100111 +11100111 +11100111 +11100111 +11100111 +11000011 +11111111 + +TIL efi +11100001 +11110011 +11110011 +11110011 +11110011 +10010011 +11000111 +11111111 + +TIL efj +10011001 +10010011 +10000111 +10001111 +10000111 +10010011 +10011001 +11111111 + +TIL ega +10011111 +10011111 +10011111 +10011111 +10011111 +10011111 +10000001 +11111111 + +TIL egb +10011100 +10001000 +10000000 +10010100 +10011100 +10011100 +10011100 +11111111 + +TIL egc +10011001 +10001001 +10000001 +10000001 +10010001 +10011001 +10011001 +11111111 + +TIL egd +11000011 +10011001 +10011001 +10011001 +10011001 +10011001 +11000011 +11111111 + +TIL ege +10000011 +10011001 +10011001 +10000011 +10011111 +10011111 +10011111 +11111111 + +TIL egf +11000011 +10011001 +10011001 +10011001 +10011001 +11000011 +11110001 +11111111 + +TIL egg +10000011 +10011001 +10011001 +10000011 +10000111 +10010011 +10011001 +11111111 + +TIL egh +11000011 +10011001 +10011111 +11000011 +11111001 +10011001 +11000011 +11111111 + +TIL egi +10000001 +11100111 +11100111 +11100111 +11100111 +11100111 +11100111 +11111111 + +TIL egj +10011001 +10011001 +10011001 +10011001 +10011001 +10011001 +11000011 +11111111 + +TIL eha +10011001 +10011001 +10011001 +10011001 +10011001 +11000011 +11100111 +11111111 + +TIL ehb +10011100 +10011100 +10011100 +10010100 +10000000 +10001000 +10011100 +11111111 + +TIL ehc +10011001 +10011001 +11000011 +11100111 +11000011 +10011001 +10011001 +11111111 + +TIL ehd +10011001 +10011001 +10011001 +11000011 +11100111 +11100111 +11100111 +11111111 + +TIL ehe +10000001 +11111001 +11110011 +11100111 +11001111 +10011111 +10000001 +11111111 + +TIL ehf +11100111 +11100111 +11100111 +00000000 +00000000 +11100111 +11100111 +11100111 + +TIL ehg +00111111 +00111111 +11001111 +11001111 +00111111 +00111111 +11001111 +11001111 + +TIL ehh +11100111 +11100111 +11100111 +11100111 +11100111 +11100111 +11100111 +11100111 + +TIL ehi +11001100 +11001100 +00110011 +00110011 +11001100 +11001100 +00110011 +00110011 + +TIL ehj +11001100 +01100110 +00110011 +10011001 +11001100 +01100110 +00110011 +10011001 + +TIL eia +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 + +TIL eib +00001111 +00001111 +00001111 +00001111 +00001111 +00001111 +00001111 +00001111 + +TIL eic +11111111 +11111111 +11111111 +11111111 +00000000 +00000000 +00000000 +00000000 + +TIL eid +00000000 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 + +TIL eie +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +00000000 + +TIL eif +00111111 +00111111 +00111111 +00111111 +00111111 +00111111 +00111111 +00111111 + +TIL eig +00110011 +00110011 +11001100 +11001100 +00110011 +00110011 +11001100 +11001100 + +TIL eih +11111100 +11111100 +11111100 +11111100 +11111100 +11111100 +11111100 +11111100 + +TIL eii +11111111 +11111111 +11111111 +11111111 +00110011 +00110011 +11001100 +11001100 + +TIL eij +00110011 +01100110 +11001100 +10011001 +00110011 +01100110 +11001100 +10011001 + +TIL eja +11111100 +11111100 +11111100 +11111100 +11111100 +11111100 +11111100 +11111100 + +TIL ejb +11100111 +11100111 +11100111 +11100000 +11100000 +11100111 +11100111 +11100111 + +TIL ejc +11111111 +11111111 +11111111 +11111111 +11110000 +11110000 +11110000 +11110000 + +TIL ejd +11100111 +11100111 +11100111 +11100000 +11100000 +11111111 +11111111 +11111111 + +TIL eje +11111111 +11111111 +11111111 +00000111 +00000111 +11100111 +11100111 +11100111 + +TIL ejf +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +00000000 +00000000 + +TIL ejg +11111111 +11111111 +11111111 +11100000 +11100000 +11100111 +11100111 +11100111 + +TIL ejh +11100111 +11100111 +11100111 +00000000 +00000000 +11111111 +11111111 +11111111 + +TIL eji +11111111 +11111111 +11111111 +00000000 +00000000 +11100111 +11100111 +11100111 + +TIL ejj +11100111 +11100111 +11100111 +00000111 +00000111 +11100111 +11100111 +11100111 + +TIL faa +00111111 +00111111 +00111111 +00111111 +00111111 +00111111 +00111111 +00111111 + +TIL fab +00011111 +00011111 +00011111 +00011111 +00011111 +00011111 +00011111 +00011111 + +TIL fac +11111000 +11111000 +11111000 +11111000 +11111000 +11111000 +11111000 +11111000 + +TIL fad +00000000 +00000000 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 + +TIL fae +00000000 +00000000 +00000000 +11111111 +11111111 +11111111 +11111111 +11111111 + +TIL faf +11111111 +11111111 +11111111 +11111111 +11111111 +00000000 +00000000 +00000000 + +TIL fag +11111110 +11111100 +11111001 +10010011 +10000111 +10001111 +10011111 +11111111 + +TIL fah +11111111 +11111111 +11111111 +11111111 +00001111 +00001111 +00001111 +00001111 + +TIL fai +11110000 +11110000 +11110000 +11110000 +11111111 +11111111 +11111111 +11111111 + +TIL faj +11100111 +11100111 +11100111 +00000111 +00000111 +11111111 +11111111 +11111111 + +TIL fba +00001111 +00001111 +00001111 +00001111 +11111111 +11111111 +11111111 +11111111 + +TIL fbb +00001111 +00001111 +00001111 +00001111 +11110000 +11110000 +11110000 +11110000 + +SPR A +00011000 +00011000 +00011000 +00111100 +01111110 +10111101 +00100100 +00100100 +POS 0 0,15 + +SPR a +00000000 +00000000 +01010001 +01110001 +01110010 +01111100 +00111100 +00100100 +DLG SPR_0 + +ITM 0 +00000000 +00000000 +00000000 +00111100 +01100100 +00100100 +00011000 +00000000 +NAME tea +DLG ITM_0 + +DLG SPR_0 +I'm a cat + +DLG ITM_0 +You found a nice warm cup of tea + +VAR a +42 \ No newline at end of file diff --git a/croppie.css b/croppie.css new file mode 100644 index 0000000..0af2e2c --- /dev/null +++ b/croppie.css @@ -0,0 +1,250 @@ +.croppie-container { + width: 100%; + height: 100%; +} + +.croppie-container .cr-image { + z-index: -1; + position: absolute; + top: 0; + left: 0; + transform-origin: 0 0; + max-height: none; + max-width: none; +} + +.croppie-container .cr-boundary { + position: relative; + overflow: hidden; + margin: 0 auto; + z-index: 1; + width: 100%; + height: 100%; +} + +.croppie-container .cr-viewport, +.croppie-container .cr-resizer { + position: absolute; + border: 2px solid #fff; + margin: auto; + top: 0; + bottom: 0; + right: 0; + left: 0; + box-shadow: 0 0 2000px 2000px rgba(0, 0, 0, 0.5); + z-index: 0; +} + +.croppie-container .cr-resizer { + z-index: 2; + box-shadow: none; + pointer-events: none; +} + +.croppie-container .cr-resizer-vertical, +.croppie-container .cr-resizer-horisontal { + position: absolute; + pointer-events: all; +} + +.croppie-container .cr-resizer-vertical::after, +.croppie-container .cr-resizer-horisontal::after { + display: block; + position: absolute; + box-sizing: border-box; + border: 1px solid black; + background: #fff; + width: 10px; + height: 10px; + content: ''; +} + +.croppie-container .cr-resizer-vertical { + bottom: -5px; + cursor: row-resize; + width: 100%; + height: 10px; +} + +.croppie-container .cr-resizer-vertical::after { + left: 50%; + margin-left: -5px; +} + +.croppie-container .cr-resizer-horisontal { + right: -5px; + cursor: col-resize; + width: 10px; + height: 100%; +} + +.croppie-container .cr-resizer-horisontal::after { + top: 50%; + margin-top: -5px; +} + +.croppie-container .cr-original-image { + display: none; +} + +.croppie-container .cr-vp-circle { + border-radius: 50%; +} + +.croppie-container .cr-overlay { + z-index: 1; + position: absolute; + cursor: move; + touch-action: none; +} + +.croppie-container .cr-slider-wrap { + width: 75%; + margin: 15px auto; + text-align: center; +} + +.croppie-result { + position: relative; + overflow: hidden; +} + +.croppie-result img { + position: absolute; +} + +.croppie-container .cr-image, +.croppie-container .cr-overlay, +.croppie-container .cr-viewport { + -webkit-transform: translateZ(0); + -moz-transform: translateZ(0); + -ms-transform: translateZ(0); + transform: translateZ(0); +} + +/*************************************/ +/***** STYLING RANGE INPUT ***********/ +/*************************************/ +/*http://brennaobrien.com/blog/2014/05/style-input-type-range-in-every-browser.html */ +/*************************************/ + +.cr-slider { + -webkit-appearance: none; +/*removes default webkit styles*/ + /*border: 1px solid white; *//*fix for FF unable to apply focus style bug */ + width: 300px; +/*required for proper track sizing in FF*/ + max-width: 100%; + padding-top: 8px; + padding-bottom: 8px; + background-color: transparent; +} + +.cr-slider::-webkit-slider-runnable-track { + width: 100%; + height: 3px; + background: rgba(0, 0, 0, 0.5); + border: 0; + border-radius: 3px; +} + +.cr-slider::-webkit-slider-thumb { + -webkit-appearance: none; + border: none; + height: 16px; + width: 16px; + border-radius: 50%; + background: #ddd; + margin-top: -6px; +} + +.cr-slider:focus { + outline: none; +} +/* +.cr-slider:focus::-webkit-slider-runnable-track { +background: #ccc; +} +*/ + +.cr-slider::-moz-range-track { + width: 100%; + height: 3px; + background: rgba(0, 0, 0, 0.5); + border: 0; + border-radius: 3px; +} + +.cr-slider::-moz-range-thumb { + border: none; + height: 16px; + width: 16px; + border-radius: 50%; + background: #ddd; + margin-top: -6px; +} + +/*hide the outline behind the border*/ +.cr-slider:-moz-focusring { + outline: 1px solid white; + outline-offset: -1px; +} + +.cr-slider::-ms-track { + width: 100%; + height: 5px; + background: transparent; +/*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */ + border-color: transparent;/*leave room for the larger thumb to overflow with a transparent border */ + border-width: 6px 0; + color: transparent;/*remove default tick marks*/ +} +.cr-slider::-ms-fill-lower { + background: rgba(0, 0, 0, 0.5); + border-radius: 10px; +} +.cr-slider::-ms-fill-upper { + background: rgba(0, 0, 0, 0.5); + border-radius: 10px; +} +.cr-slider::-ms-thumb { + border: none; + height: 16px; + width: 16px; + border-radius: 50%; + background: #ddd; + margin-top:1px; +} +.cr-slider:focus::-ms-fill-lower { + background: rgba(0, 0, 0, 0.5); +} +.cr-slider:focus::-ms-fill-upper { + background: rgba(0, 0, 0, 0.5); +} +/*******************************************/ + +/***********************************/ +/* Rotation Tools */ +/***********************************/ +.cr-rotate-controls { + position: absolute; + bottom: 5px; + left: 5px; + z-index: 1; +} +.cr-rotate-controls button { + border: 0; + background: none; +} +.cr-rotate-controls i:before { + display: inline-block; + font-style: normal; + font-weight: 900; + font-size: 22px; +} +.cr-rotate-l i:before { + content: '↺'; +} +.cr-rotate-r i:before { + content: '↻'; +} diff --git a/croppie.js b/croppie.js new file mode 100644 index 0000000..f6f4671 --- /dev/null +++ b/croppie.js @@ -0,0 +1,1596 @@ +/************************* + * Croppie + * Copyright 2017 + * Foliotek + * Version: 2.5.1 + *************************/ +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['exports'], factory); + } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') { + // CommonJS + factory(exports); + } else { + // Browser globals + factory((root.commonJsStrict = {})); + } +}(this, function (exports) { + + /* Polyfills */ + if (typeof Promise !== 'function') { + /*! promise-polyfill 3.1.0 */ + !function(a){function b(a,b){return function(){a.apply(b,arguments)}}function c(a){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof a)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],i(a,b(e,this),b(f,this))}function d(a){var b=this;return null===this._state?void this._deferreds.push(a):void k(function(){var c=b._state?a.onFulfilled:a.onRejected;if(null===c)return void(b._state?a.resolve:a.reject)(b._value);var d;try{d=c(b._value)}catch(e){return void a.reject(e)}a.resolve(d)})}function e(a){try{if(a===this)throw new TypeError("A promise cannot be resolved with itself.");if(a&&("object"==typeof a||"function"==typeof a)){var c=a.then;if("function"==typeof c)return void i(b(c,a),b(e,this),b(f,this))}this._state=!0,this._value=a,g.call(this)}catch(d){f.call(this,d)}}function f(a){this._state=!1,this._value=a,g.call(this)}function g(){for(var a=0,b=this._deferreds.length;b>a;a++)d.call(this,this._deferreds[a]);this._deferreds=null}function h(a,b,c,d){this.onFulfilled="function"==typeof a?a:null,this.onRejected="function"==typeof b?b:null,this.resolve=c,this.reject=d}function i(a,b,c){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,c(a))})}catch(e){if(d)return;d=!0,c(e)}}var j=setTimeout,k="function"==typeof setImmediate&&setImmediate||function(a){j(a,1)},l=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};c.prototype["catch"]=function(a){return this.then(null,a)},c.prototype.then=function(a,b){var e=this;return new c(function(c,f){d.call(e,new h(a,b,c,f))})},c.all=function(){var a=Array.prototype.slice.call(1===arguments.length&&l(arguments[0])?arguments[0]:arguments);return new c(function(b,c){function d(f,g){try{if(g&&("object"==typeof g||"function"==typeof g)){var h=g.then;if("function"==typeof h)return void h.call(g,function(a){d(f,a)},c)}a[f]=g,0===--e&&b(a)}catch(i){c(i)}}if(0===a.length)return b([]);for(var e=a.length,f=0;fd;d++)a[d].then(b,c)})},c._setImmediateFn=function(a){k=a},"undefined"!=typeof module&&module.exports?module.exports=c:a.Promise||(a.Promise=c)}(this); + } + + if ( typeof window.CustomEvent !== "function" ) { + (function(){ + function CustomEvent ( event, params ) { + params = params || { bubbles: false, cancelable: false, detail: undefined }; + var evt = document.createEvent( 'CustomEvent' ); + evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); + return evt; + } + CustomEvent.prototype = window.Event.prototype; + window.CustomEvent = CustomEvent; + }()); + } + + if (!HTMLCanvasElement.prototype.toBlob) { + Object.defineProperty(HTMLCanvasElement.prototype, 'toBlob', { + value: function (callback, type, quality) { + var binStr = atob( this.toDataURL(type, quality).split(',')[1] ), + len = binStr.length, + arr = new Uint8Array(len); + + for (var i=0; i= 5) { + var x= w; + w = h; + h = x; + } + return { width: w, height: h }; + } + + /* CSS Transform Prototype */ + var TRANSLATE_OPTS = { + 'translate3d': { + suffix: ', 0px' + }, + 'translate': { + suffix: '' + } + }; + var Transform = function (x, y, scale) { + this.x = parseFloat(x); + this.y = parseFloat(y); + this.scale = parseFloat(scale); + }; + + Transform.parse = function (v) { + if (v.style) { + return Transform.parse(v.style[CSS_TRANSFORM]); + } + else if (v.indexOf('matrix') > -1 || v.indexOf('none') > -1) { + return Transform.fromMatrix(v); + } + else { + return Transform.fromString(v); + } + }; + + Transform.fromMatrix = function (v) { + var vals = v.substring(7).split(','); + if (!vals.length || v === 'none') { + vals = [1, 0, 0, 1, 0, 0]; + } + + return new Transform(num(vals[4]), num(vals[5]), parseFloat(vals[0])); + }; + + Transform.fromString = function (v) { + var values = v.split(') '), + translate = values[0].substring(Croppie.globals.translate.length + 1).split(','), + scale = values.length > 1 ? values[1].substring(6) : 1, + x = translate.length > 1 ? translate[0] : 0, + y = translate.length > 1 ? translate[1] : 0; + + return new Transform(x, y, scale); + }; + + Transform.prototype.toString = function () { + var suffix = TRANSLATE_OPTS[Croppie.globals.translate].suffix || ''; + return Croppie.globals.translate + '(' + this.x + 'px, ' + this.y + 'px' + suffix + ') scale(' + this.scale + ')'; + }; + + var TransformOrigin = function (el) { + if (!el || !el.style[CSS_TRANS_ORG]) { + this.x = 0; + this.y = 0; + return; + } + var css = el.style[CSS_TRANS_ORG].split(' '); + this.x = parseFloat(css[0]); + this.y = parseFloat(css[1]); + }; + + TransformOrigin.prototype.toString = function () { + return this.x + 'px ' + this.y + 'px'; + }; + + function getExifOrientation (img) { + return img.exifdata.Orientation; + } + + function drawCanvas(canvas, img, orientation) { + var width = img.width, + height = img.height, + ctx = canvas.getContext('2d'); + + canvas.width = img.width; + canvas.height = img.height; + + ctx.save(); + switch (orientation) { + case 2: + ctx.translate(width, 0); + ctx.scale(-1, 1); + break; + + case 3: + ctx.translate(width, height); + ctx.rotate(180*Math.PI/180); + break; + + case 4: + ctx.translate(0, height); + ctx.scale(1, -1); + break; + + case 5: + canvas.width = height; + canvas.height = width; + ctx.rotate(90*Math.PI/180); + ctx.scale(1, -1); + break; + + case 6: + canvas.width = height; + canvas.height = width; + ctx.rotate(90*Math.PI/180); + ctx.translate(0, -height); + break; + + case 7: + canvas.width = height; + canvas.height = width; + ctx.rotate(-90*Math.PI/180); + ctx.translate(-width, height); + ctx.scale(1, -1); + break; + + case 8: + canvas.width = height; + canvas.height = width; + ctx.translate(0, width); + ctx.rotate(-90*Math.PI/180); + break; + } + ctx.drawImage(img, 0,0, width, height); + ctx.restore(); + } + + /* Private Methods */ + function _create() { + var self = this, + contClass = 'croppie-container', + customViewportClass = self.options.viewport.type ? 'cr-vp-' + self.options.viewport.type : null, + boundary, img, viewport, overlay, bw, bh; + + self.options.useCanvas = self.options.enableOrientation || _hasExif.call(self); + // Properties on class + self.data = {}; + self.elements = {}; + + boundary = self.elements.boundary = document.createElement('div'); + viewport = self.elements.viewport = document.createElement('div'); + img = self.elements.img = document.createElement('img'); + overlay = self.elements.overlay = document.createElement('div'); + + if (self.options.useCanvas) { + self.elements.canvas = document.createElement('canvas'); + self.elements.preview = self.elements.canvas; + } + else { + self.elements.preview = self.elements.img; + } + + addClass(boundary, 'cr-boundary'); + boundary.setAttribute('aria-dropeffect', 'none'); + bw = self.options.boundary.width; + bh = self.options.boundary.height; + css(boundary, { + width: (bw + (isNaN(bw) ? '' : 'px')), + height: (bh + (isNaN(bh) ? '' : 'px')) + }); + + addClass(viewport, 'cr-viewport'); + if (customViewportClass) { + addClass(viewport, customViewportClass); + } + css(viewport, { + width: self.options.viewport.width + 'px', + height: self.options.viewport.height + 'px' + }); + viewport.setAttribute('tabindex', 0); + + addClass(self.elements.preview, 'cr-image'); + setAttributes(self.elements.preview, { 'alt': 'preview', 'aria-grabbed': 'false' }); + addClass(overlay, 'cr-overlay'); + + self.element.appendChild(boundary); + boundary.appendChild(self.elements.preview); + boundary.appendChild(viewport); + boundary.appendChild(overlay); + + addClass(self.element, contClass); + if (self.options.customClass) { + addClass(self.element, self.options.customClass); + } + + _initDraggable.call(this); + + if (self.options.enableZoom) { + _initializeZoom.call(self); + } + + // if (self.options.enableOrientation) { + // _initRotationControls.call(self); + // } + + if (self.options.enableResize) { + _initializeResize.call(self); + } + } + + // function _initRotationControls () { + // var self = this, + // wrap, btnLeft, btnRight, iLeft, iRight; + + // wrap = document.createElement('div'); + // self.elements.orientationBtnLeft = btnLeft = document.createElement('button'); + // self.elements.orientationBtnRight = btnRight = document.createElement('button'); + + // wrap.appendChild(btnLeft); + // wrap.appendChild(btnRight); + + // iLeft = document.createElement('i'); + // iRight = document.createElement('i'); + // btnLeft.appendChild(iLeft); + // btnRight.appendChild(iRight); + + // addClass(wrap, 'cr-rotate-controls'); + // addClass(btnLeft, 'cr-rotate-l'); + // addClass(btnRight, 'cr-rotate-r'); + + // self.elements.boundary.appendChild(wrap); + + // btnLeft.addEventListener('click', function () { + // self.rotate(-90); + // }); + // btnRight.addEventListener('click', function () { + // self.rotate(90); + // }); + // } + + function _hasExif() { + return this.options.enableExif && window.EXIF; + } + + function _initializeResize () { + var self = this; + var wrap = document.createElement('div'); + var isDragging = false; + var direction; + var originalX; + var originalY; + var minSize = 50; + var maxWidth; + var maxHeight; + var vr; + var hr; + + addClass(wrap, 'cr-resizer'); + css(wrap, { + width: this.options.viewport.width + 'px', + height: this.options.viewport.height + 'px' + }); + + if (this.options.resizeControls.height) { + vr = document.createElement('div'); + addClass(vr, 'cr-resizer-vertical'); + wrap.appendChild(vr); + } + + if (this.options.resizeControls.width) { + hr = document.createElement('div'); + addClass(hr, 'cr-resizer-horisontal'); + wrap.appendChild(hr); + } + + function mouseDown(ev) { + if (ev.button !== undefined && ev.button !== 0) return; + + ev.preventDefault(); + if (isDragging) { + return; + } + + var overlayRect = self.elements.overlay.getBoundingClientRect(); + + isDragging = true; + originalX = ev.pageX; + originalY = ev.pageY; + direction = ev.currentTarget.className.indexOf('vertical') !== -1 ? 'v' : 'h'; + maxWidth = overlayRect.width; + maxHeight = overlayRect.height; + + if (ev.touches) { + var touches = ev.touches[0]; + originalX = touches.pageX; + originalY = touches.pageY; + } + + window.addEventListener('mousemove', mouseMove); + window.addEventListener('touchmove', mouseMove); + window.addEventListener('mouseup', mouseUp); + window.addEventListener('touchend', mouseUp); + document.body.style[CSS_USERSELECT] = 'none'; + } + + function mouseMove(ev) { + var pageX = ev.pageX; + var pageY = ev.pageY; + + ev.preventDefault(); + + if (ev.touches) { + var touches = ev.touches[0]; + pageX = touches.pageX; + pageY = touches.pageY; + } + + var deltaX = pageX - originalX; + var deltaY = pageY - originalY; + var newHeight = self.options.viewport.height + deltaY; + var newWidth = self.options.viewport.width + deltaX; + + if (direction === 'v' && newHeight >= minSize && newHeight <= maxHeight) { + css(wrap, { + height: newHeight + 'px' + }); + + self.options.boundary.height += deltaY; + css(self.elements.boundary, { + height: self.options.boundary.height + 'px' + }); + + self.options.viewport.height += deltaY; + css(self.elements.viewport, { + height: self.options.viewport.height + 'px' + }); + } + else if (direction === 'h' && newWidth >= minSize && newWidth <= maxWidth) { + css(wrap, { + width: newWidth + 'px' + }); + + self.options.boundary.width += deltaX; + css(self.elements.boundary, { + width: self.options.boundary.width + 'px' + }); + + self.options.viewport.width += deltaX; + css(self.elements.viewport, { + width: self.options.viewport.width + 'px' + }); + } + + _updateOverlay.call(self); + _updateZoomLimits.call(self); + _updateCenterPoint.call(self); + _triggerUpdate.call(self); + originalY = pageY; + originalX = pageX; + } + + function mouseUp() { + isDragging = false; + window.removeEventListener('mousemove', mouseMove); + window.removeEventListener('touchmove', mouseMove); + window.removeEventListener('mouseup', mouseUp); + window.removeEventListener('touchend', mouseUp); + document.body.style[CSS_USERSELECT] = ''; + } + + if (vr) { + vr.addEventListener('mousedown', mouseDown); + } + + if (hr) { + hr.addEventListener('mousedown', mouseDown); + } + + this.elements.boundary.appendChild(wrap); + } + + function _setZoomerVal(v) { + if (this.options.enableZoom) { + var z = this.elements.zoomer, + val = fix(v, 4); + + z.value = Math.max(z.min, Math.min(z.max, val)); + } + } + + function _initializeZoom() { + var self = this, + wrap = self.elements.zoomerWrap = document.createElement('div'), + zoomer = self.elements.zoomer = document.createElement('input'); + + addClass(wrap, 'cr-slider-wrap'); + addClass(zoomer, 'cr-slider'); + zoomer.type = 'range'; + zoomer.step = '0.0001'; + zoomer.value = 1; + zoomer.style.display = self.options.showZoomer ? '' : 'none'; + zoomer.setAttribute('aria-label', 'zoom'); + + self.element.appendChild(wrap); + wrap.appendChild(zoomer); + + self._currentZoom = 1; + + function change() { + _onZoom.call(self, { + value: parseFloat(zoomer.value), + origin: new TransformOrigin(self.elements.preview), + viewportRect: self.elements.viewport.getBoundingClientRect(), + transform: Transform.parse(self.elements.preview) + }); + } + + function scroll(ev) { + var delta, targetZoom; + + if (ev.wheelDelta) { + delta = ev.wheelDelta / 1200; //wheelDelta min: -120 max: 120 // max x 10 x 2 + } else if (ev.deltaY) { + delta = ev.deltaY / 1060; //deltaY min: -53 max: 53 // max x 10 x 2 + } else if (ev.detail) { + delta = ev.detail / -60; //delta min: -3 max: 3 // max x 10 x 2 + } else { + delta = 0; + } + + targetZoom = self._currentZoom + (delta * self._currentZoom); + + ev.preventDefault(); + _setZoomerVal.call(self, targetZoom); + change.call(self); + } + + self.elements.zoomer.addEventListener('input', change);// this is being fired twice on keypress + self.elements.zoomer.addEventListener('change', change); + + if (self.options.mouseWheelZoom) { + self.elements.boundary.addEventListener('mousewheel', scroll); + self.elements.boundary.addEventListener('DOMMouseScroll', scroll); + } + } + + function _onZoom(ui) { + var self = this, + transform = ui ? ui.transform : Transform.parse(self.elements.preview), + vpRect = ui ? ui.viewportRect : self.elements.viewport.getBoundingClientRect(), + origin = ui ? ui.origin : new TransformOrigin(self.elements.preview); + + function applyCss() { + var transCss = {}; + transCss[CSS_TRANSFORM] = transform.toString(); + transCss[CSS_TRANS_ORG] = origin.toString(); + css(self.elements.preview, transCss); + } + + self._currentZoom = ui ? ui.value : self._currentZoom; + transform.scale = self._currentZoom; + self.elements.zoomer.setAttribute('aria-valuenow', self._currentZoom); + applyCss(); + + if (self.options.enforceBoundary) { + var boundaries = _getVirtualBoundaries.call(self, vpRect), + transBoundaries = boundaries.translate, + oBoundaries = boundaries.origin; + + if (transform.x >= transBoundaries.maxX) { + origin.x = oBoundaries.minX; + transform.x = transBoundaries.maxX; + } + + if (transform.x <= transBoundaries.minX) { + origin.x = oBoundaries.maxX; + transform.x = transBoundaries.minX; + } + + if (transform.y >= transBoundaries.maxY) { + origin.y = oBoundaries.minY; + transform.y = transBoundaries.maxY; + } + + if (transform.y <= transBoundaries.minY) { + origin.y = oBoundaries.maxY; + transform.y = transBoundaries.minY; + } + } + applyCss(); + _debouncedOverlay.call(self); + _triggerUpdate.call(self); + } + + function _getVirtualBoundaries(viewport) { + var self = this, + scale = self._currentZoom, + vpWidth = viewport.width, + vpHeight = viewport.height, + centerFromBoundaryX = self.elements.boundary.clientWidth / 2, + centerFromBoundaryY = self.elements.boundary.clientHeight / 2, + imgRect = self.elements.preview.getBoundingClientRect(), + curImgWidth = imgRect.width, + curImgHeight = imgRect.height, + halfWidth = vpWidth / 2, + halfHeight = vpHeight / 2; + + var maxX = ((halfWidth / scale) - centerFromBoundaryX) * -1; + var minX = maxX - ((curImgWidth * (1 / scale)) - (vpWidth * (1 / scale))); + + var maxY = ((halfHeight / scale) - centerFromBoundaryY) * -1; + var minY = maxY - ((curImgHeight * (1 / scale)) - (vpHeight * (1 / scale))); + + var originMinX = (1 / scale) * halfWidth; + var originMaxX = (curImgWidth * (1 / scale)) - originMinX; + + var originMinY = (1 / scale) * halfHeight; + var originMaxY = (curImgHeight * (1 / scale)) - originMinY; + + return { + translate: { + maxX: maxX, + minX: minX, + maxY: maxY, + minY: minY + }, + origin: { + maxX: originMaxX, + minX: originMinX, + maxY: originMaxY, + minY: originMinY + } + }; + } + + function _updateCenterPoint() { + var self = this, + scale = self._currentZoom, + data = self.elements.preview.getBoundingClientRect(), + vpData = self.elements.viewport.getBoundingClientRect(), + transform = Transform.parse(self.elements.preview.style[CSS_TRANSFORM]), + pc = new TransformOrigin(self.elements.preview), + top = (vpData.top - data.top) + (vpData.height / 2), + left = (vpData.left - data.left) + (vpData.width / 2), + center = {}, + adj = {}; + + center.y = top / scale; + center.x = left / scale; + + adj.y = (center.y - pc.y) * (1 - scale); + adj.x = (center.x - pc.x) * (1 - scale); + + transform.x -= adj.x; + transform.y -= adj.y; + + var newCss = {}; + newCss[CSS_TRANS_ORG] = center.x + 'px ' + center.y + 'px'; + newCss[CSS_TRANSFORM] = transform.toString(); + css(self.elements.preview, newCss); + } + + function _initDraggable() { + var self = this, + isDragging = false, + originalX, + originalY, + originalDistance, + vpRect, + transform; + + function assignTransformCoordinates(deltaX, deltaY) { + var imgRect = self.elements.preview.getBoundingClientRect(), + top = transform.y + deltaY, + left = transform.x + deltaX; + + if (self.options.enforceBoundary) { + if (vpRect.top > imgRect.top + deltaY && vpRect.bottom < imgRect.bottom + deltaY) { + transform.y = top; + } + + if (vpRect.left > imgRect.left + deltaX && vpRect.right < imgRect.right + deltaX) { + transform.x = left; + } + } + else { + transform.y = top; + transform.x = left; + } + } + + function toggleGrabState(isDragging) { + self.elements.preview.setAttribute('aria-grabbed', isDragging); + self.elements.boundary.setAttribute('aria-dropeffect', isDragging? 'move': 'none'); + } + + function keyDown(ev) { + var LEFT_ARROW = 37, + UP_ARROW = 38, + RIGHT_ARROW = 39, + DOWN_ARROW = 40; + + if (ev.shiftKey && (ev.keyCode == UP_ARROW || ev.keyCode == DOWN_ARROW)) { + var zoom = 0.0; + if (ev.keyCode == UP_ARROW) { + zoom = parseFloat(self.elements.zoomer.value, 10) + parseFloat(self.elements.zoomer.step, 10) + } + else { + zoom = parseFloat(self.elements.zoomer.value, 10) - parseFloat(self.elements.zoomer.step, 10) + } + self.setZoom(zoom); + } + else if (self.options.enableKeyMovement && (ev.keyCode >= 37 && ev.keyCode <= 40)) { + ev.preventDefault(); + var movement = parseKeyDown(ev.keyCode); + + transform = Transform.parse(self.elements.preview); + document.body.style[CSS_USERSELECT] = 'none'; + vpRect = self.elements.viewport.getBoundingClientRect(); + keyMove(movement); + }; + + function parseKeyDown(key) { + switch (key) { + case LEFT_ARROW: + return [1, 0]; + case UP_ARROW: + return [0, 1]; + case RIGHT_ARROW: + return [-1, 0]; + case DOWN_ARROW: + return [0, -1]; + }; + }; + } + + function keyMove(movement) { + var deltaX = movement[0], + deltaY = movement[1], + newCss = {}; + + assignTransformCoordinates(deltaX, deltaY); + + newCss[CSS_TRANSFORM] = transform.toString(); + css(self.elements.preview, newCss); + _updateOverlay.call(self); + document.body.style[CSS_USERSELECT] = ''; + _updateCenterPoint.call(self); + _triggerUpdate.call(self); + originalDistance = 0; + } + + function mouseDown(ev) { + if (ev.button !== undefined && ev.button !== 0) return; + + ev.preventDefault(); + if (isDragging) return; + isDragging = true; + originalX = ev.pageX; + originalY = ev.pageY; + + if (ev.touches) { + var touches = ev.touches[0]; + originalX = touches.pageX; + originalY = touches.pageY; + } + toggleGrabState(isDragging); + transform = Transform.parse(self.elements.preview); + window.addEventListener('mousemove', mouseMove); + window.addEventListener('touchmove', mouseMove); + window.addEventListener('mouseup', mouseUp); + window.addEventListener('touchend', mouseUp); + document.body.style[CSS_USERSELECT] = 'none'; + vpRect = self.elements.viewport.getBoundingClientRect(); + } + + function mouseMove(ev) { + ev.preventDefault(); + var pageX = ev.pageX, + pageY = ev.pageY; + + if (ev.touches) { + var touches = ev.touches[0]; + pageX = touches.pageX; + pageY = touches.pageY; + } + + var deltaX = pageX - originalX, + deltaY = pageY - originalY, + newCss = {}; + + if (ev.type == 'touchmove') { + if (ev.touches.length > 1) { + var touch1 = ev.touches[0]; + var touch2 = ev.touches[1]; + var dist = Math.sqrt((touch1.pageX - touch2.pageX) * (touch1.pageX - touch2.pageX) + (touch1.pageY - touch2.pageY) * (touch1.pageY - touch2.pageY)); + + if (!originalDistance) { + originalDistance = dist / self._currentZoom; + } + + var scale = dist / originalDistance; + + _setZoomerVal.call(self, scale); + dispatchChange(self.elements.zoomer); + return; + } + } + + assignTransformCoordinates(deltaX, deltaY); + + newCss[CSS_TRANSFORM] = transform.toString(); + css(self.elements.preview, newCss); + _updateOverlay.call(self); + originalY = pageY; + originalX = pageX; + } + + function mouseUp() { + isDragging = false; + toggleGrabState(isDragging); + window.removeEventListener('mousemove', mouseMove); + window.removeEventListener('touchmove', mouseMove); + window.removeEventListener('mouseup', mouseUp); + window.removeEventListener('touchend', mouseUp); + document.body.style[CSS_USERSELECT] = ''; + _updateCenterPoint.call(self); + _triggerUpdate.call(self); + originalDistance = 0; + } + + self.elements.overlay.addEventListener('mousedown', mouseDown); + self.elements.viewport.addEventListener('keydown', keyDown); + self.elements.overlay.addEventListener('touchstart', mouseDown); + } + + function _updateOverlay() { + var self = this, + boundRect = self.elements.boundary.getBoundingClientRect(), + imgData = self.elements.preview.getBoundingClientRect(); + + css(self.elements.overlay, { + width: imgData.width + 'px', + height: imgData.height + 'px', + top: (imgData.top - boundRect.top) + 'px', + left: (imgData.left - boundRect.left) + 'px' + }); + } + var _debouncedOverlay = debounce(_updateOverlay, 500); + + function _triggerUpdate() { + var self = this, + data = self.get(), + ev; + + if (!_isVisible.call(self)) { + return; + } + + self.options.update.call(self, data); + if (self.$ && typeof Prototype == 'undefined') { + self.$(self.element).trigger('update', data); + } + else { + var ev; + if (window.CustomEvent) { + ev = new CustomEvent('update', { detail: data }); + } else { + ev = document.createEvent('CustomEvent'); + ev.initCustomEvent('update', true, true, data); + } + + self.element.dispatchEvent(ev); + } + } + + function _isVisible() { + return this.elements.preview.offsetHeight > 0 && this.elements.preview.offsetWidth > 0; + } + + function _updatePropertiesFromImage() { + var self = this, + initialZoom = 1, + cssReset = {}, + img = self.elements.preview, + imgData = null, + transformReset = new Transform(0, 0, initialZoom), + originReset = new TransformOrigin(), + isVisible = _isVisible.call(self); + + if (!isVisible || self.data.bound) { + // if the croppie isn't visible or it doesn't need binding + return; + } + + self.data.bound = true; + cssReset[CSS_TRANSFORM] = transformReset.toString(); + cssReset[CSS_TRANS_ORG] = originReset.toString(); + cssReset['opacity'] = 1; + css(img, cssReset); + + imgData = self.elements.preview.getBoundingClientRect(); + + self._originalImageWidth = imgData.width; + self._originalImageHeight = imgData.height; + + if (self.options.enableZoom) { + _updateZoomLimits.call(self, true); + } + else { + self._currentZoom = initialZoom; + } + + transformReset.scale = self._currentZoom; + cssReset[CSS_TRANSFORM] = transformReset.toString(); + css(img, cssReset); + + if (self.data.points.length) { + _bindPoints.call(self, self.data.points); + } + else { + _centerImage.call(self); + } + + _updateCenterPoint.call(self); + _updateOverlay.call(self); + } + + function _updateZoomLimits (initial) { + var self = this, + minZoom = 0, + maxZoom = 1.5, + initialZoom, + defaultInitialZoom, + zoomer = self.elements.zoomer, + scale = parseFloat(zoomer.value), + boundaryData = self.elements.boundary.getBoundingClientRect(), + imgData = self.elements.preview.getBoundingClientRect(), + vpData = self.elements.viewport.getBoundingClientRect(), + minW, + minH; + + if (self.options.enforceBoundary) { + minW = vpData.width / (initial ? imgData.width : imgData.width / scale); + minH = vpData.height / (initial ? imgData.height : imgData.height / scale); + minZoom = Math.max(minW, minH); + } + + if (minZoom >= maxZoom) { + maxZoom = minZoom + 1; + } + + zoomer.min = fix(minZoom, 4); + zoomer.max = fix(maxZoom, 4); + + if (initial) { + defaultInitialZoom = Math.max((boundaryData.width / imgData.width), (boundaryData.height / imgData.height)); + initialZoom = self.data.boundZoom !== null ? self.data.boundZoom : defaultInitialZoom; + _setZoomerVal.call(self, initialZoom); + } + + dispatchChange(zoomer); + } + + function _bindPoints(points) { + if (points.length != 4) { + throw "Croppie - Invalid number of points supplied: " + points; + } + var self = this, + pointsWidth = points[2] - points[0], + // pointsHeight = points[3] - points[1], + vpData = self.elements.viewport.getBoundingClientRect(), + boundRect = self.elements.boundary.getBoundingClientRect(), + vpOffset = { + left: vpData.left - boundRect.left, + top: vpData.top - boundRect.top + }, + scale = vpData.width / pointsWidth, + originTop = points[1], + originLeft = points[0], + transformTop = (-1 * points[1]) + vpOffset.top, + transformLeft = (-1 * points[0]) + vpOffset.left, + newCss = {}; + + newCss[CSS_TRANS_ORG] = originLeft + 'px ' + originTop + 'px'; + newCss[CSS_TRANSFORM] = new Transform(transformLeft, transformTop, scale).toString(); + css(self.elements.preview, newCss); + + _setZoomerVal.call(self, scale); + self._currentZoom = scale; + } + + function _centerImage() { + var self = this, + imgDim = self.elements.preview.getBoundingClientRect(), + vpDim = self.elements.viewport.getBoundingClientRect(), + boundDim = self.elements.boundary.getBoundingClientRect(), + vpLeft = vpDim.left - boundDim.left, + vpTop = vpDim.top - boundDim.top, + w = vpLeft - ((imgDim.width - vpDim.width) / 2), + h = vpTop - ((imgDim.height - vpDim.height) / 2), + transform = new Transform(w, h, self._currentZoom); + + css(self.elements.preview, CSS_TRANSFORM, transform.toString()); + } + + function _transferImageToCanvas(customOrientation) { + var self = this, + canvas = self.elements.canvas, + img = self.elements.img, + ctx = canvas.getContext('2d'), + exif = _hasExif.call(self), + customOrientation = self.options.enableOrientation && customOrientation; + + ctx.clearRect(0, 0, canvas.width, canvas.height); + canvas.width = img.width; + canvas.height = img.height; + + if (exif && !customOrientation) { + var orientation = getExifOrientation(img); + drawCanvas(canvas, img, num(orientation || 0, 10)); + } + else if (customOrientation) { + drawCanvas(canvas, img, customOrientation); + } + } + + function _getCanvas(data) { + var self = this, + points = data.points, + left = num(points[0]), + top = num(points[1]), + right = num(points[2]), + bottom = num(points[3]), + width = right-left, + height = bottom-top, + circle = data.circle, + canvas = document.createElement('canvas'), + ctx = canvas.getContext('2d'), + outWidth = width, + outHeight = height, + startX = 0, + startY = 0, + canvasWidth = outWidth, + canvasHeight = outHeight, + customDimensions = (data.outputWidth && data.outputHeight), + outputWidthRatio = 1; + outputHeightRatio = 1; + + if (customDimensions) { + canvasWidth = data.outputWidth; + canvasHeight = data.outputHeight; + outputWidthRatio = canvasWidth / outWidth; + outputHeightRatio = canvasHeight / outHeight; + } + + canvas.width = canvasWidth; + canvas.height = canvasHeight; + + if (data.backgroundColor) { + ctx.fillStyle = data.backgroundColor; + ctx.fillRect(0, 0, canvasWidth, canvasHeight); + } + + + // start fixing data to send to draw image for enforceBoundary: false + if (!self.options.enforceBoundary) { + if (left < 0) { + startX = Math.abs(left); + left = 0; + } + if (top < 0) { + startY = Math.abs(top); + top = 0; + } + if (right > self._originalImageWidth) { + width = self._originalImageWidth - left; + outWidth = width; + } + if (bottom > self._originalImageHeight) { + height = self._originalImageHeight - top; + outHeight = height; + } + } + else{ + width=Math.min(width, self._originalImageWidth); + height=Math.min(height, self._originalImageHeight) + } + + if (outputWidthRatio !== 1 || outputHeightRatio !== 1) { + startX *= outputWidthRatio; + startY *= outputHeightRatio; + outWidth *= outputWidthRatio; + outHeight *= outputHeightRatio; + } + ctx.drawImage(this.elements.preview, left, top, width, height, startX, startY, outWidth, outHeight); + if (circle) { + ctx.fillStyle = '#fff'; + ctx.globalCompositeOperation = 'destination-in'; + ctx.beginPath(); + ctx.arc(outWidth / 2, outHeight / 2, outWidth / 2, 0, Math.PI * 2, true); + ctx.closePath(); + ctx.fill(); + } + return canvas; + } + + function _getHtmlResult(data) { + var points = data.points, + div = document.createElement('div'), + img = document.createElement('img'), + width = points[2] - points[0], + height = points[3] - points[1]; + + addClass(div, 'croppie-result'); + div.appendChild(img); + css(img, { + left: (-1 * points[0]) + 'px', + top: (-1 * points[1]) + 'px' + }); + img.src = data.url; + css(div, { + width: width + 'px', + height: height + 'px' + }); + + return div; + } + + function _getBase64Result(data) { + return _getCanvas.call(this, data).toDataURL(data.format, data.quality); + } + + function _getBlobResult(data) { + var self = this; + return new Promise(function (resolve, reject) { + _getCanvas.call(self, data).toBlob(function (blob) { + resolve(blob); + }, data.format, data.quality); + }); + } + + function _bind(options, cb) { + var self = this, + url, + points = [], + zoom = null, + hasExif = _hasExif.call(self);; + + if (typeof (options) === 'string') { + url = options; + options = {}; + } + else if (Array.isArray(options)) { + points = options.slice(); + } + else if (typeof (options) == 'undefined' && self.data.url) { //refreshing + _updatePropertiesFromImage.call(self); + _triggerUpdate.call(self); + return null; + } + else { + url = options.url; + points = options.points || []; + zoom = typeof(options.zoom) === 'undefined' ? null : options.zoom; + } + + self.data.bound = false; + self.data.url = url || self.data.url; + self.data.boundZoom = zoom; + + return loadImage(url, self.elements.img, hasExif).then(function (img) { + if (!points.length) { + var natDim = naturalImageDimensions(img); + var rect = self.elements.viewport.getBoundingClientRect(); + var aspectRatio = rect.width / rect.height; + var imgAspectRatio = natDim.width / natDim.height; + var width, height; + + if (imgAspectRatio > aspectRatio) { + height = natDim.height; + width = height * aspectRatio; + } + else { + width = natDim.width; + height = width / aspectRatio; + } + + var x0 = (natDim.width - width) / 2; + var y0 = (natDim.height - height) / 2; + var x1 = x0 + width; + var y1 = y0 + height; + + self.data.points = [x0, y0, x1, y1]; + } + else if (self.options.relative) { + points = [ + points[0] * img.naturalWidth / 100, + points[1] * img.naturalHeight / 100, + points[2] * img.naturalWidth / 100, + points[3] * img.naturalHeight / 100 + ]; + } + + self.data.points = points.map(function (p) { + return parseFloat(p); + }); + if (self.options.useCanvas) { + _transferImageToCanvas.call(self, options.orientation || 1); + } + _updatePropertiesFromImage.call(self); + _triggerUpdate.call(self); + cb && cb(); + }); + } + + function fix(v, decimalPoints) { + return parseFloat(v).toFixed(decimalPoints || 0); + } + + function _get() { + var self = this, + imgData = self.elements.preview.getBoundingClientRect(), + vpData = self.elements.viewport.getBoundingClientRect(), + x1 = vpData.left - imgData.left, + y1 = vpData.top - imgData.top, + widthDiff = (vpData.width - self.elements.viewport.offsetWidth) / 2, //border + heightDiff = (vpData.height - self.elements.viewport.offsetHeight) / 2, + x2 = x1 + self.elements.viewport.offsetWidth + widthDiff, + y2 = y1 + self.elements.viewport.offsetHeight + heightDiff, + scale = self._currentZoom; + + if (scale === Infinity || isNaN(scale)) { + scale = 1; + } + + var max = self.options.enforceBoundary ? 0 : Number.NEGATIVE_INFINITY; + x1 = Math.max(max, x1 / scale); + y1 = Math.max(max, y1 / scale); + x2 = Math.max(max, x2 / scale); + y2 = Math.max(max, y2 / scale); + + return { + points: [fix(x1), fix(y1), fix(x2), fix(y2)], + zoom: scale + }; + } + + var RESULT_DEFAULTS = { + type: 'canvas', + format: 'png', + quality: 1 + }, + RESULT_FORMATS = ['jpeg', 'webp', 'png']; + + function _result(options) { + var self = this, + data = _get.call(self), + opts = deepExtend(RESULT_DEFAULTS, deepExtend({}, options)), + resultType = (typeof (options) === 'string' ? options : (opts.type || 'base64')), + size = opts.size || 'viewport', + format = opts.format, + quality = opts.quality, + backgroundColor = opts.backgroundColor, + circle = typeof opts.circle === 'boolean' ? opts.circle : (self.options.viewport.type === 'circle'), + vpRect = self.elements.viewport.getBoundingClientRect(), + ratio = vpRect.width / vpRect.height, + prom; + + if (size === 'viewport') { + data.outputWidth = vpRect.width; + data.outputHeight = vpRect.height; + } else if (typeof size === 'object') { + if (size.width && size.height) { + data.outputWidth = size.width; + data.outputHeight = size.height; + } else if (size.width) { + data.outputWidth = size.width; + data.outputHeight = size.width / ratio; + } else if (size.height) { + data.outputWidth = size.height * ratio; + data.outputHeight = size.height; + } + } + + if (RESULT_FORMATS.indexOf(format) > -1) { + data.format = 'image/' + format; + data.quality = quality; + } + + data.circle = circle; + data.url = self.data.url; + data.backgroundColor = backgroundColor; + + prom = new Promise(function (resolve, reject) { + switch(resultType.toLowerCase()) + { + case 'rawcanvas': + resolve(_getCanvas.call(self, data)); + break; + case 'canvas': + case 'base64': + resolve(_getBase64Result.call(self, data)); + break; + case 'blob': + _getBlobResult.call(self, data).then(resolve); + break; + default: + resolve(_getHtmlResult.call(self, data)); + break; + } + }); + return prom; + } + + function _refresh() { + _updatePropertiesFromImage.call(this); + } + + function _rotate(deg) { + if (!this.options.useCanvas) { + throw 'Croppie: Cannot rotate without enableOrientation'; + } + + var self = this, + canvas = self.elements.canvas, + copy = document.createElement('canvas'), + ornt = 1; + + copy.width = canvas.width; + copy.height = canvas.height; + var ctx = copy.getContext('2d'); + ctx.drawImage(canvas, 0, 0); + + if (deg === 90 || deg === -270) ornt = 6; + if (deg === -90 || deg === 270) ornt = 8; + if (deg === 180 || deg === -180) ornt = 3; + + drawCanvas(canvas, copy, ornt); + _onZoom.call(self); + copy = null; + } + + function _destroy() { + var self = this; + self.element.removeChild(self.elements.boundary); + removeClass(self.element, 'croppie-container'); + if (self.options.enableZoom) { + self.element.removeChild(self.elements.zoomerWrap); + } + delete self.elements; + } + + if (window.jQuery) { + var $ = window.jQuery; + $.fn.croppie = function (opts) { + var ot = typeof opts; + + if (ot === 'string') { + var args = Array.prototype.slice.call(arguments, 1); + var singleInst = $(this).data('croppie'); + + if (opts === 'get') { + return singleInst.get(); + } + else if (opts === 'result') { + return singleInst.result.apply(singleInst, args); + } + else if (opts === 'bind') { + return singleInst.bind.apply(singleInst, args); + } + + return this.each(function () { + var i = $(this).data('croppie'); + if (!i) return; + + var method = i[opts]; + if ($.isFunction(method)) { + method.apply(i, args); + if (opts === 'destroy') { + $(this).removeData('croppie'); + } + } + else { + throw 'Croppie ' + opts + ' method not found'; + } + }); + } + else { + return this.each(function () { + var i = new Croppie(this, opts); + i.$ = $; + $(this).data('croppie', i); + }); + } + }; + } + + function Croppie(element, opts) { + this.element = element; + this.options = deepExtend(deepExtend({}, Croppie.defaults), opts); + + if (this.element.tagName.toLowerCase() === 'img') { + var origImage = this.element; + addClass(origImage, 'cr-original-image'); + setAttributes(origImage, {'aria-hidden' : 'true', 'alt' : '' }); + var replacementDiv = document.createElement('div'); + this.element.parentNode.appendChild(replacementDiv); + replacementDiv.appendChild(origImage); + this.element = replacementDiv; + this.options.url = this.options.url || origImage.src; + } + + _create.call(this); + if (this.options.url) { + var bindOpts = { + url: this.options.url, + points: this.options.points + }; + delete this.options['url']; + delete this.options['points']; + _bind.call(this, bindOpts); + } + } + + Croppie.defaults = { + viewport: { + width: 100, + height: 100, + type: 'square' + }, + boundary: { }, + orientationControls: { + enabled: true, + leftClass: '', + rightClass: '' + }, + resizeControls: { + width: true, + height: true + }, + customClass: '', + showZoomer: true, + enableZoom: true, + enableResize: false, + mouseWheelZoom: true, + enableExif: false, + enforceBoundary: true, + enableOrientation: false, + enableKeyMovement: true, + update: function () { } + }; + + Croppie.globals = { + translate: 'translate3d' + }; + + deepExtend(Croppie.prototype, { + bind: function (options, cb) { + return _bind.call(this, options, cb); + }, + get: function () { + var data = _get.call(this); + var points = data.points; + if (this.options.relative) { + points[0] /= this.elements.img.naturalWidth / 100; + points[1] /= this.elements.img.naturalHeight / 100; + points[2] /= this.elements.img.naturalWidth / 100; + points[3] /= this.elements.img.naturalHeight / 100; + } + return data; + }, + result: function (type) { + return _result.call(this, type); + }, + refresh: function () { + return _refresh.call(this); + }, + setZoom: function (v) { + _setZoomerVal.call(this, v); + dispatchChange(this.elements.zoomer); + }, + rotate: function (deg) { + _rotate.call(this, deg); + }, + destroy: function () { + return _destroy.call(this); + } + }); + + exports.Croppie = window.Croppie = Croppie; + + if (typeof module === 'object' && !!module.exports) { + module.exports = Croppie; + } +})); diff --git a/dj-hamster.jpg b/dj-hamster.jpg new file mode 100644 index 0000000..f5f2c58 Binary files /dev/null and b/dj-hamster.jpg differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..5a9dee7 --- /dev/null +++ b/index.html @@ -0,0 +1,5196 @@ +

image-to-bitsy

convert any image to a bitsy room

game data

image

palette

preview

output



\ No newline at end of file diff --git a/index.pug b/index.pug new file mode 100644 index 0000000..50b8e1d --- /dev/null +++ b/index.pug @@ -0,0 +1,83 @@ +doctype html +html + head + // lodash + script(src="lodash.min.js") + + // jquery + script(src="jquery.min.js") + + // croppie + link(rel="stylesheet" href="croppie.css") + script(src="croppie.js") + + link(rel="stylesheet" type="text/css" href="style.css") + script(src="script.js") + body + h1 image-to-bitsy + p convert any image to a bitsy room + + #game-data.section + h2 game data + + textarea#bitsy-data(placeholder="Bitsy data or html") + include bitsy-default.txt + + #image.section + h2 image + + input#imageUpload(type="file" accepts="image/*") + + #croppie + + #palette.section + h2 palette + + form#palettes + table + tbody + tr.palette + td + input(type="radio" name="palette" checked) + td + label Palette 0 + td + input(type="color" name="background" value="#3e2b20") + td + input(type="color" name="tile" value="#d07038") + td + input(type="color" name="sprite" value="#e55c44") + + #crop.section + h2 preview + + canvas#preview(width=128, height=128) + + input#brightness(type="range" min=-255 max=255 value=0) + + label(for="brightness") brightness + + //- to do + input#dithering(type="checkbox") + label(for="dithering") dithering + + //- to do + input#smoothing(type="checkbox") + label(for="smoothing") smoothing + + #output.section + h2 output + + canvas#output(width=128, height=128) + + input#roomName(placeholder="room name") + + //-input(type="slider") + + br + + //-label favour broad strokes | favour details + + br + + //-button Download \ No newline at end of file diff --git a/jquery.min.js b/jquery.min.js new file mode 100644 index 0000000..644d35e --- /dev/null +++ b/jquery.min.js @@ -0,0 +1,4 @@ +/*! jQuery v3.2.1 | (c) JS Foundation and other contributors | jquery.org/license */ +!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.2.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&&b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:"label"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext;function B(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()}var C=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,D=/^.[^:#\[\.,]*$/;function E(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):D.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(E(this,a||[],!1))},not:function(a){return this.pushStack(E(this,a||[],!0))},is:function(a){return!!E(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var F,G=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,H=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||F,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:G.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),C.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};H.prototype=r.fn,F=r(d);var I=/^(?:parents|prev(?:Until|All))/,J={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function K(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return K(a,"nextSibling")},prev:function(a){return K(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return B(a,"iframe")?a.contentDocument:(B(a,"template")&&(a=a.content||a),r.merge([],a.childNodes))}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(J[a]||r.uniqueSort(e),I.test(a)&&e.reverse()),this.pushStack(e)}});var L=/[^\x20\t\r\n\f]+/g;function M(a){var b={};return r.each(a.match(L)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?M(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=e||a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function N(a){return a}function O(a){throw a}function P(a,b,c,d){var e;try{a&&r.isFunction(e=a.promise)?e.call(a).done(b).fail(c):a&&r.isFunction(e=a.then)?e.call(a,b,c):b.apply(void 0,[a].slice(d))}catch(a){c.apply(void 0,[a])}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b=f&&(d!==O&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:N,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:N)),c[2][3].add(g(0,a,r.isFunction(d)?d:O))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(P(a,g.done(h(c)).resolve,g.reject,!b),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)P(e[c],h(c),g.reject);return g.promise()}});var Q=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&Q.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var R=r.Deferred();r.fn.ready=function(a){return R.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||R.resolveWith(d,[r]))}}),r.ready.then=R.then;function S(){d.removeEventListener("DOMContentLoaded",S), +a.removeEventListener("load",S),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",S),a.addEventListener("load",S));var T=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)T(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h1,null,!0)},removeData:function(a){return this.each(function(){X.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=W.get(a,b),c&&(!d||Array.isArray(c)?d=W.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return W.get(a,c)||W.access(a,c,{empty:r.Callbacks("once memory").add(function(){W.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length\x20\t\r\n\f]+)/i,la=/^$|\/(?:java|ecma)script/i,ma={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ma.optgroup=ma.option,ma.tbody=ma.tfoot=ma.colgroup=ma.caption=ma.thead,ma.th=ma.td;function na(a,b){var c;return c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[],void 0===b||b&&B(a,b)?r.merge([a],c):c}function oa(a,b){for(var c=0,d=a.length;c-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=na(l.appendChild(f),"script"),j&&oa(g),c){k=0;while(f=g[k++])la.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var ra=d.documentElement,sa=/^key/,ta=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ua=/^([^.]*)(?:\.(.+)|)/;function va(){return!0}function wa(){return!1}function xa(){try{return d.activeElement}catch(a){}}function ya(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ya(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=wa;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(ra,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(L)||[""],j=b.length;while(j--)h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.hasData(a)&&W.get(a);if(q&&(i=q.events)){b=(b||"").match(L)||[""],j=b.length;while(j--)if(h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&W.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(W.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i\x20\t\r\n\f]*)[^>]*)\/>/gi,Aa=/\s*$/g;function Ea(a,b){return B(a,"table")&&B(11!==b.nodeType?b:b.firstChild,"tr")?r(">tbody",a)[0]||a:a}function Fa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ga(a){var b=Ca.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ha(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(W.hasData(a)&&(f=W.access(a),g=W.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c1&&"string"==typeof q&&!o.checkClone&&Ba.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ja(f,b,c,d)});if(m&&(e=qa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(na(e,"script"),Fa),i=h.length;l")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=na(h),f=na(a),d=0,e=f.length;d0&&oa(g,!i&&na(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(U(c)){if(b=c[W.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[W.expando]=void 0}c[X.expando]&&(c[X.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ka(this,a,!0)},remove:function(a){return Ka(this,a)},text:function(a){return T(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.appendChild(a)}})},prepend:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(na(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return T(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!Aa.test(a)&&!ma[(ka.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c1)}});function _a(a,b,c,d,e){return new _a.prototype.init(a,b,c,d,e)}r.Tween=_a,_a.prototype={constructor:_a,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=_a.propHooks[this.prop];return a&&a.get?a.get(this):_a.propHooks._default.get(this)},run:function(a){var b,c=_a.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):_a.propHooks._default.set(this),this}},_a.prototype.init.prototype=_a.prototype,_a.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},_a.propHooks.scrollTop=_a.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=_a.prototype.init,r.fx.step={};var ab,bb,cb=/^(?:toggle|show|hide)$/,db=/queueHooks$/;function eb(){bb&&(d.hidden===!1&&a.requestAnimationFrame?a.requestAnimationFrame(eb):a.setTimeout(eb,r.fx.interval),r.fx.tick())}function fb(){return a.setTimeout(function(){ab=void 0}),ab=r.now()}function gb(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=ca[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function hb(a,b,c){for(var d,e=(kb.tweeners[b]||[]).concat(kb.tweeners["*"]),f=0,g=e.length;f1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?lb:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b), +null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&B(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(L);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),lb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=mb[b]||r.find.attr;mb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=mb[g],mb[g]=e,e=null!=c(a,b,d)?g:null,mb[g]=f),e}});var nb=/^(?:input|select|textarea|button)$/i,ob=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return T(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):nb.test(a.nodeName)||ob.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function pb(a){var b=a.match(L)||[];return b.join(" ")}function qb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,qb(this)))});if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,qb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,qb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(L)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=qb(this),b&&W.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":W.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+pb(qb(c))+" ").indexOf(b)>-1)return!0;return!1}});var rb=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":Array.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(rb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:pb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(Array.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var sb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!sb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,sb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(W.get(h,"events")||{})[b.type]&&W.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&U(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!U(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=W.access(d,b);e||d.addEventListener(a,c,!0),W.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=W.access(d,b)-1;e?W.access(d,b,e):(d.removeEventListener(a,c,!0),W.remove(d,b))}}});var tb=a.location,ub=r.now(),vb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var wb=/\[\]$/,xb=/\r?\n/g,yb=/^(?:submit|button|image|reset|file)$/i,zb=/^(?:input|select|textarea|keygen)/i;function Ab(a,b,c,d){var e;if(Array.isArray(b))r.each(b,function(b,e){c||wb.test(a)?d(a,e):Ab(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)Ab(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(Array.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)Ab(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&zb.test(this.nodeName)&&!yb.test(a)&&(this.checked||!ja.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:Array.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(xb,"\r\n")}}):{name:b.name,value:c.replace(xb,"\r\n")}}).get()}});var Bb=/%20/g,Cb=/#.*$/,Db=/([?&])_=[^&]*/,Eb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Fb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Gb=/^(?:GET|HEAD)$/,Hb=/^\/\//,Ib={},Jb={},Kb="*/".concat("*"),Lb=d.createElement("a");Lb.href=tb.href;function Mb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(L)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Nb(a,b,c,d){var e={},f=a===Jb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Ob(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Pb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Qb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:tb.href,type:"GET",isLocal:Fb.test(tb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Kb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Ob(Ob(a,r.ajaxSettings),b):Ob(r.ajaxSettings,a)},ajaxPrefilter:Mb(Ib),ajaxTransport:Mb(Jb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Eb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||tb.href)+"").replace(Hb,tb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(L)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Lb.protocol+"//"+Lb.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Nb(Ib,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Gb.test(o.type),f=o.url.replace(Cb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(Bb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(vb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Db,"$1"),n=(vb.test(f)?"&":"?")+"_="+ub++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Kb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Nb(Jb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Pb(o,y,d)),v=Qb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Rb={0:200,1223:204},Sb=r.ajaxSettings.xhr();o.cors=!!Sb&&"withCredentials"in Sb,o.ajax=Sb=!!Sb,r.ajaxTransport(function(b){var c,d;if(o.cors||Sb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Rb[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r(" +``` + +## CDN +cdnjs.com provides croppie via cdn https://cdnjs.com/libraries/croppie +``` +https://cdnjs.cloudflare.com/ajax/libs/croppie/{version}/croppie.min.css +https://cdnjs.cloudflare.com/ajax/libs/croppie/{version}/croppie.min.js +``` + + +## Documentation +[Documentation](http://foliotek.github.io/Croppie#documentation) + +## Related Libraries +* https://github.com/wem/croppie-dart +* https://github.com/allenRoyston/ngCroppie +* https://github.com/lpsBetty/angular-croppie + + +## Contributing +#### Static Server +`live-server` + +#### Minifying +`uglifyjs croppie.js -c -m -r '$,require,exports' -o croppie.min.js` + +#### Releasing a new version +1. Bump version in croppie.js +2. Minify/Uglify +3. Commit +4. npm version [new version] +5. `git push && git push --tags` +6. `npm publish` +7. Draft a new release with new tag on https://github.com/Foliotek/Croppie/releases +8. Deploy to gh-pages `npm run deploy` diff --git a/node_modules/croppie/croppie.css b/node_modules/croppie/croppie.css new file mode 100644 index 0000000..0af2e2c --- /dev/null +++ b/node_modules/croppie/croppie.css @@ -0,0 +1,250 @@ +.croppie-container { + width: 100%; + height: 100%; +} + +.croppie-container .cr-image { + z-index: -1; + position: absolute; + top: 0; + left: 0; + transform-origin: 0 0; + max-height: none; + max-width: none; +} + +.croppie-container .cr-boundary { + position: relative; + overflow: hidden; + margin: 0 auto; + z-index: 1; + width: 100%; + height: 100%; +} + +.croppie-container .cr-viewport, +.croppie-container .cr-resizer { + position: absolute; + border: 2px solid #fff; + margin: auto; + top: 0; + bottom: 0; + right: 0; + left: 0; + box-shadow: 0 0 2000px 2000px rgba(0, 0, 0, 0.5); + z-index: 0; +} + +.croppie-container .cr-resizer { + z-index: 2; + box-shadow: none; + pointer-events: none; +} + +.croppie-container .cr-resizer-vertical, +.croppie-container .cr-resizer-horisontal { + position: absolute; + pointer-events: all; +} + +.croppie-container .cr-resizer-vertical::after, +.croppie-container .cr-resizer-horisontal::after { + display: block; + position: absolute; + box-sizing: border-box; + border: 1px solid black; + background: #fff; + width: 10px; + height: 10px; + content: ''; +} + +.croppie-container .cr-resizer-vertical { + bottom: -5px; + cursor: row-resize; + width: 100%; + height: 10px; +} + +.croppie-container .cr-resizer-vertical::after { + left: 50%; + margin-left: -5px; +} + +.croppie-container .cr-resizer-horisontal { + right: -5px; + cursor: col-resize; + width: 10px; + height: 100%; +} + +.croppie-container .cr-resizer-horisontal::after { + top: 50%; + margin-top: -5px; +} + +.croppie-container .cr-original-image { + display: none; +} + +.croppie-container .cr-vp-circle { + border-radius: 50%; +} + +.croppie-container .cr-overlay { + z-index: 1; + position: absolute; + cursor: move; + touch-action: none; +} + +.croppie-container .cr-slider-wrap { + width: 75%; + margin: 15px auto; + text-align: center; +} + +.croppie-result { + position: relative; + overflow: hidden; +} + +.croppie-result img { + position: absolute; +} + +.croppie-container .cr-image, +.croppie-container .cr-overlay, +.croppie-container .cr-viewport { + -webkit-transform: translateZ(0); + -moz-transform: translateZ(0); + -ms-transform: translateZ(0); + transform: translateZ(0); +} + +/*************************************/ +/***** STYLING RANGE INPUT ***********/ +/*************************************/ +/*http://brennaobrien.com/blog/2014/05/style-input-type-range-in-every-browser.html */ +/*************************************/ + +.cr-slider { + -webkit-appearance: none; +/*removes default webkit styles*/ + /*border: 1px solid white; *//*fix for FF unable to apply focus style bug */ + width: 300px; +/*required for proper track sizing in FF*/ + max-width: 100%; + padding-top: 8px; + padding-bottom: 8px; + background-color: transparent; +} + +.cr-slider::-webkit-slider-runnable-track { + width: 100%; + height: 3px; + background: rgba(0, 0, 0, 0.5); + border: 0; + border-radius: 3px; +} + +.cr-slider::-webkit-slider-thumb { + -webkit-appearance: none; + border: none; + height: 16px; + width: 16px; + border-radius: 50%; + background: #ddd; + margin-top: -6px; +} + +.cr-slider:focus { + outline: none; +} +/* +.cr-slider:focus::-webkit-slider-runnable-track { +background: #ccc; +} +*/ + +.cr-slider::-moz-range-track { + width: 100%; + height: 3px; + background: rgba(0, 0, 0, 0.5); + border: 0; + border-radius: 3px; +} + +.cr-slider::-moz-range-thumb { + border: none; + height: 16px; + width: 16px; + border-radius: 50%; + background: #ddd; + margin-top: -6px; +} + +/*hide the outline behind the border*/ +.cr-slider:-moz-focusring { + outline: 1px solid white; + outline-offset: -1px; +} + +.cr-slider::-ms-track { + width: 100%; + height: 5px; + background: transparent; +/*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */ + border-color: transparent;/*leave room for the larger thumb to overflow with a transparent border */ + border-width: 6px 0; + color: transparent;/*remove default tick marks*/ +} +.cr-slider::-ms-fill-lower { + background: rgba(0, 0, 0, 0.5); + border-radius: 10px; +} +.cr-slider::-ms-fill-upper { + background: rgba(0, 0, 0, 0.5); + border-radius: 10px; +} +.cr-slider::-ms-thumb { + border: none; + height: 16px; + width: 16px; + border-radius: 50%; + background: #ddd; + margin-top:1px; +} +.cr-slider:focus::-ms-fill-lower { + background: rgba(0, 0, 0, 0.5); +} +.cr-slider:focus::-ms-fill-upper { + background: rgba(0, 0, 0, 0.5); +} +/*******************************************/ + +/***********************************/ +/* Rotation Tools */ +/***********************************/ +.cr-rotate-controls { + position: absolute; + bottom: 5px; + left: 5px; + z-index: 1; +} +.cr-rotate-controls button { + border: 0; + background: none; +} +.cr-rotate-controls i:before { + display: inline-block; + font-style: normal; + font-weight: 900; + font-size: 22px; +} +.cr-rotate-l i:before { + content: '↺'; +} +.cr-rotate-r i:before { + content: '↻'; +} diff --git a/node_modules/croppie/croppie.js b/node_modules/croppie/croppie.js new file mode 100644 index 0000000..3e0223e --- /dev/null +++ b/node_modules/croppie/croppie.js @@ -0,0 +1,1588 @@ +/************************* + * Croppie + * Copyright 2017 + * Foliotek + * Version: 2.5.1 + *************************/ +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['exports'], factory); + } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') { + // CommonJS + factory(exports); + } else { + // Browser globals + factory((root.commonJsStrict = {})); + } +}(this, function (exports) { + + /* Polyfills */ + if (typeof Promise !== 'function') { + /*! promise-polyfill 3.1.0 */ + !function(a){function b(a,b){return function(){a.apply(b,arguments)}}function c(a){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof a)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],i(a,b(e,this),b(f,this))}function d(a){var b=this;return null===this._state?void this._deferreds.push(a):void k(function(){var c=b._state?a.onFulfilled:a.onRejected;if(null===c)return void(b._state?a.resolve:a.reject)(b._value);var d;try{d=c(b._value)}catch(e){return void a.reject(e)}a.resolve(d)})}function e(a){try{if(a===this)throw new TypeError("A promise cannot be resolved with itself.");if(a&&("object"==typeof a||"function"==typeof a)){var c=a.then;if("function"==typeof c)return void i(b(c,a),b(e,this),b(f,this))}this._state=!0,this._value=a,g.call(this)}catch(d){f.call(this,d)}}function f(a){this._state=!1,this._value=a,g.call(this)}function g(){for(var a=0,b=this._deferreds.length;b>a;a++)d.call(this,this._deferreds[a]);this._deferreds=null}function h(a,b,c,d){this.onFulfilled="function"==typeof a?a:null,this.onRejected="function"==typeof b?b:null,this.resolve=c,this.reject=d}function i(a,b,c){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,c(a))})}catch(e){if(d)return;d=!0,c(e)}}var j=setTimeout,k="function"==typeof setImmediate&&setImmediate||function(a){j(a,1)},l=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};c.prototype["catch"]=function(a){return this.then(null,a)},c.prototype.then=function(a,b){var e=this;return new c(function(c,f){d.call(e,new h(a,b,c,f))})},c.all=function(){var a=Array.prototype.slice.call(1===arguments.length&&l(arguments[0])?arguments[0]:arguments);return new c(function(b,c){function d(f,g){try{if(g&&("object"==typeof g||"function"==typeof g)){var h=g.then;if("function"==typeof h)return void h.call(g,function(a){d(f,a)},c)}a[f]=g,0===--e&&b(a)}catch(i){c(i)}}if(0===a.length)return b([]);for(var e=a.length,f=0;fd;d++)a[d].then(b,c)})},c._setImmediateFn=function(a){k=a},"undefined"!=typeof module&&module.exports?module.exports=c:a.Promise||(a.Promise=c)}(this); + } + + if ( typeof window.CustomEvent !== "function" ) { + (function(){ + function CustomEvent ( event, params ) { + params = params || { bubbles: false, cancelable: false, detail: undefined }; + var evt = document.createEvent( 'CustomEvent' ); + evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); + return evt; + } + CustomEvent.prototype = window.Event.prototype; + window.CustomEvent = CustomEvent; + }()); + } + + if (!HTMLCanvasElement.prototype.toBlob) { + Object.defineProperty(HTMLCanvasElement.prototype, 'toBlob', { + value: function (callback, type, quality) { + var binStr = atob( this.toDataURL(type, quality).split(',')[1] ), + len = binStr.length, + arr = new Uint8Array(len); + + for (var i=0; i= 5) { + var x= w; + w = h; + h = x; + } + return { width: w, height: h }; + } + + /* CSS Transform Prototype */ + var TRANSLATE_OPTS = { + 'translate3d': { + suffix: ', 0px' + }, + 'translate': { + suffix: '' + } + }; + var Transform = function (x, y, scale) { + this.x = parseFloat(x); + this.y = parseFloat(y); + this.scale = parseFloat(scale); + }; + + Transform.parse = function (v) { + if (v.style) { + return Transform.parse(v.style[CSS_TRANSFORM]); + } + else if (v.indexOf('matrix') > -1 || v.indexOf('none') > -1) { + return Transform.fromMatrix(v); + } + else { + return Transform.fromString(v); + } + }; + + Transform.fromMatrix = function (v) { + var vals = v.substring(7).split(','); + if (!vals.length || v === 'none') { + vals = [1, 0, 0, 1, 0, 0]; + } + + return new Transform(num(vals[4]), num(vals[5]), parseFloat(vals[0])); + }; + + Transform.fromString = function (v) { + var values = v.split(') '), + translate = values[0].substring(Croppie.globals.translate.length + 1).split(','), + scale = values.length > 1 ? values[1].substring(6) : 1, + x = translate.length > 1 ? translate[0] : 0, + y = translate.length > 1 ? translate[1] : 0; + + return new Transform(x, y, scale); + }; + + Transform.prototype.toString = function () { + var suffix = TRANSLATE_OPTS[Croppie.globals.translate].suffix || ''; + return Croppie.globals.translate + '(' + this.x + 'px, ' + this.y + 'px' + suffix + ') scale(' + this.scale + ')'; + }; + + var TransformOrigin = function (el) { + if (!el || !el.style[CSS_TRANS_ORG]) { + this.x = 0; + this.y = 0; + return; + } + var css = el.style[CSS_TRANS_ORG].split(' '); + this.x = parseFloat(css[0]); + this.y = parseFloat(css[1]); + }; + + TransformOrigin.prototype.toString = function () { + return this.x + 'px ' + this.y + 'px'; + }; + + function getExifOrientation (img) { + return img.exifdata.Orientation; + } + + function drawCanvas(canvas, img, orientation) { + var width = img.width, + height = img.height, + ctx = canvas.getContext('2d'); + + canvas.width = img.width; + canvas.height = img.height; + + ctx.save(); + switch (orientation) { + case 2: + ctx.translate(width, 0); + ctx.scale(-1, 1); + break; + + case 3: + ctx.translate(width, height); + ctx.rotate(180*Math.PI/180); + break; + + case 4: + ctx.translate(0, height); + ctx.scale(1, -1); + break; + + case 5: + canvas.width = height; + canvas.height = width; + ctx.rotate(90*Math.PI/180); + ctx.scale(1, -1); + break; + + case 6: + canvas.width = height; + canvas.height = width; + ctx.rotate(90*Math.PI/180); + ctx.translate(0, -height); + break; + + case 7: + canvas.width = height; + canvas.height = width; + ctx.rotate(-90*Math.PI/180); + ctx.translate(-width, height); + ctx.scale(1, -1); + break; + + case 8: + canvas.width = height; + canvas.height = width; + ctx.translate(0, width); + ctx.rotate(-90*Math.PI/180); + break; + } + ctx.drawImage(img, 0,0, width, height); + ctx.restore(); + } + + /* Private Methods */ + function _create() { + var self = this, + contClass = 'croppie-container', + customViewportClass = self.options.viewport.type ? 'cr-vp-' + self.options.viewport.type : null, + boundary, img, viewport, overlay, bw, bh; + + self.options.useCanvas = self.options.enableOrientation || _hasExif.call(self); + // Properties on class + self.data = {}; + self.elements = {}; + + boundary = self.elements.boundary = document.createElement('div'); + viewport = self.elements.viewport = document.createElement('div'); + img = self.elements.img = document.createElement('img'); + overlay = self.elements.overlay = document.createElement('div'); + + if (self.options.useCanvas) { + self.elements.canvas = document.createElement('canvas'); + self.elements.preview = self.elements.canvas; + } + else { + self.elements.preview = self.elements.img; + } + + addClass(boundary, 'cr-boundary'); + boundary.setAttribute('aria-dropeffect', 'none'); + bw = self.options.boundary.width; + bh = self.options.boundary.height; + css(boundary, { + width: (bw + (isNaN(bw) ? '' : 'px')), + height: (bh + (isNaN(bh) ? '' : 'px')) + }); + + addClass(viewport, 'cr-viewport'); + if (customViewportClass) { + addClass(viewport, customViewportClass); + } + css(viewport, { + width: self.options.viewport.width + 'px', + height: self.options.viewport.height + 'px' + }); + viewport.setAttribute('tabindex', 0); + + addClass(self.elements.preview, 'cr-image'); + setAttributes(self.elements.preview, { 'alt': 'preview', 'aria-grabbed': 'false' }); + addClass(overlay, 'cr-overlay'); + + self.element.appendChild(boundary); + boundary.appendChild(self.elements.preview); + boundary.appendChild(viewport); + boundary.appendChild(overlay); + + addClass(self.element, contClass); + if (self.options.customClass) { + addClass(self.element, self.options.customClass); + } + + _initDraggable.call(this); + + if (self.options.enableZoom) { + _initializeZoom.call(self); + } + + // if (self.options.enableOrientation) { + // _initRotationControls.call(self); + // } + + if (self.options.enableResize) { + _initializeResize.call(self); + } + } + + // function _initRotationControls () { + // var self = this, + // wrap, btnLeft, btnRight, iLeft, iRight; + + // wrap = document.createElement('div'); + // self.elements.orientationBtnLeft = btnLeft = document.createElement('button'); + // self.elements.orientationBtnRight = btnRight = document.createElement('button'); + + // wrap.appendChild(btnLeft); + // wrap.appendChild(btnRight); + + // iLeft = document.createElement('i'); + // iRight = document.createElement('i'); + // btnLeft.appendChild(iLeft); + // btnRight.appendChild(iRight); + + // addClass(wrap, 'cr-rotate-controls'); + // addClass(btnLeft, 'cr-rotate-l'); + // addClass(btnRight, 'cr-rotate-r'); + + // self.elements.boundary.appendChild(wrap); + + // btnLeft.addEventListener('click', function () { + // self.rotate(-90); + // }); + // btnRight.addEventListener('click', function () { + // self.rotate(90); + // }); + // } + + function _hasExif() { + return this.options.enableExif && window.EXIF; + } + + function _initializeResize () { + var self = this; + var wrap = document.createElement('div'); + var isDragging = false; + var direction; + var originalX; + var originalY; + var minSize = 50; + var maxWidth; + var maxHeight; + var vr; + var hr; + + addClass(wrap, 'cr-resizer'); + css(wrap, { + width: this.options.viewport.width + 'px', + height: this.options.viewport.height + 'px' + }); + + if (this.options.resizeControls.height) { + vr = document.createElement('div'); + addClass(vr, 'cr-resizer-vertical'); + wrap.appendChild(vr); + } + + if (this.options.resizeControls.width) { + hr = document.createElement('div'); + addClass(hr, 'cr-resizer-horisontal'); + wrap.appendChild(hr); + } + + function mouseDown(ev) { + if (ev.button !== undefined && ev.button !== 0) return; + + ev.preventDefault(); + if (isDragging) { + return; + } + + var overlayRect = self.elements.overlay.getBoundingClientRect(); + + isDragging = true; + originalX = ev.pageX; + originalY = ev.pageY; + direction = ev.currentTarget.className.indexOf('vertical') !== -1 ? 'v' : 'h'; + maxWidth = overlayRect.width; + maxHeight = overlayRect.height; + + if (ev.touches) { + var touches = ev.touches[0]; + originalX = touches.pageX; + originalY = touches.pageY; + } + + window.addEventListener('mousemove', mouseMove); + window.addEventListener('touchmove', mouseMove); + window.addEventListener('mouseup', mouseUp); + window.addEventListener('touchend', mouseUp); + document.body.style[CSS_USERSELECT] = 'none'; + } + + function mouseMove(ev) { + var pageX = ev.pageX; + var pageY = ev.pageY; + + ev.preventDefault(); + + if (ev.touches) { + var touches = ev.touches[0]; + pageX = touches.pageX; + pageY = touches.pageY; + } + + var deltaX = pageX - originalX; + var deltaY = pageY - originalY; + var newHeight = self.options.viewport.height + deltaY; + var newWidth = self.options.viewport.width + deltaX; + + if (direction === 'v' && newHeight >= minSize && newHeight <= maxHeight) { + css(wrap, { + height: newHeight + 'px' + }); + + self.options.boundary.height += deltaY; + css(self.elements.boundary, { + height: self.options.boundary.height + 'px' + }); + + self.options.viewport.height += deltaY; + css(self.elements.viewport, { + height: self.options.viewport.height + 'px' + }); + } + else if (direction === 'h' && newWidth >= minSize && newWidth <= maxWidth) { + css(wrap, { + width: newWidth + 'px' + }); + + self.options.boundary.width += deltaX; + css(self.elements.boundary, { + width: self.options.boundary.width + 'px' + }); + + self.options.viewport.width += deltaX; + css(self.elements.viewport, { + width: self.options.viewport.width + 'px' + }); + } + + _updateOverlay.call(self); + _updateZoomLimits.call(self); + _updateCenterPoint.call(self); + _triggerUpdate.call(self); + originalY = pageY; + originalX = pageX; + } + + function mouseUp() { + isDragging = false; + window.removeEventListener('mousemove', mouseMove); + window.removeEventListener('touchmove', mouseMove); + window.removeEventListener('mouseup', mouseUp); + window.removeEventListener('touchend', mouseUp); + document.body.style[CSS_USERSELECT] = ''; + } + + if (vr) { + vr.addEventListener('mousedown', mouseDown); + } + + if (hr) { + hr.addEventListener('mousedown', mouseDown); + } + + this.elements.boundary.appendChild(wrap); + } + + function _setZoomerVal(v) { + if (this.options.enableZoom) { + var z = this.elements.zoomer, + val = fix(v, 4); + + z.value = Math.max(z.min, Math.min(z.max, val)); + } + } + + function _initializeZoom() { + var self = this, + wrap = self.elements.zoomerWrap = document.createElement('div'), + zoomer = self.elements.zoomer = document.createElement('input'); + + addClass(wrap, 'cr-slider-wrap'); + addClass(zoomer, 'cr-slider'); + zoomer.type = 'range'; + zoomer.step = '0.0001'; + zoomer.value = 1; + zoomer.style.display = self.options.showZoomer ? '' : 'none'; + zoomer.setAttribute('aria-label', 'zoom'); + + self.element.appendChild(wrap); + wrap.appendChild(zoomer); + + self._currentZoom = 1; + + function change() { + _onZoom.call(self, { + value: parseFloat(zoomer.value), + origin: new TransformOrigin(self.elements.preview), + viewportRect: self.elements.viewport.getBoundingClientRect(), + transform: Transform.parse(self.elements.preview) + }); + } + + function scroll(ev) { + var delta, targetZoom; + + if (ev.wheelDelta) { + delta = ev.wheelDelta / 1200; //wheelDelta min: -120 max: 120 // max x 10 x 2 + } else if (ev.deltaY) { + delta = ev.deltaY / 1060; //deltaY min: -53 max: 53 // max x 10 x 2 + } else if (ev.detail) { + delta = ev.detail / -60; //delta min: -3 max: 3 // max x 10 x 2 + } else { + delta = 0; + } + + targetZoom = self._currentZoom + (delta * self._currentZoom); + + ev.preventDefault(); + _setZoomerVal.call(self, targetZoom); + change.call(self); + } + + self.elements.zoomer.addEventListener('input', change);// this is being fired twice on keypress + self.elements.zoomer.addEventListener('change', change); + + if (self.options.mouseWheelZoom) { + self.elements.boundary.addEventListener('mousewheel', scroll); + self.elements.boundary.addEventListener('DOMMouseScroll', scroll); + } + } + + function _onZoom(ui) { + var self = this, + transform = ui ? ui.transform : Transform.parse(self.elements.preview), + vpRect = ui ? ui.viewportRect : self.elements.viewport.getBoundingClientRect(), + origin = ui ? ui.origin : new TransformOrigin(self.elements.preview); + + function applyCss() { + var transCss = {}; + transCss[CSS_TRANSFORM] = transform.toString(); + transCss[CSS_TRANS_ORG] = origin.toString(); + css(self.elements.preview, transCss); + } + + self._currentZoom = ui ? ui.value : self._currentZoom; + transform.scale = self._currentZoom; + self.elements.zoomer.setAttribute('aria-valuenow', self._currentZoom); + applyCss(); + + if (self.options.enforceBoundary) { + var boundaries = _getVirtualBoundaries.call(self, vpRect), + transBoundaries = boundaries.translate, + oBoundaries = boundaries.origin; + + if (transform.x >= transBoundaries.maxX) { + origin.x = oBoundaries.minX; + transform.x = transBoundaries.maxX; + } + + if (transform.x <= transBoundaries.minX) { + origin.x = oBoundaries.maxX; + transform.x = transBoundaries.minX; + } + + if (transform.y >= transBoundaries.maxY) { + origin.y = oBoundaries.minY; + transform.y = transBoundaries.maxY; + } + + if (transform.y <= transBoundaries.minY) { + origin.y = oBoundaries.maxY; + transform.y = transBoundaries.minY; + } + } + applyCss(); + _debouncedOverlay.call(self); + _triggerUpdate.call(self); + } + + function _getVirtualBoundaries(viewport) { + var self = this, + scale = self._currentZoom, + vpWidth = viewport.width, + vpHeight = viewport.height, + centerFromBoundaryX = self.elements.boundary.clientWidth / 2, + centerFromBoundaryY = self.elements.boundary.clientHeight / 2, + imgRect = self.elements.preview.getBoundingClientRect(), + curImgWidth = imgRect.width, + curImgHeight = imgRect.height, + halfWidth = vpWidth / 2, + halfHeight = vpHeight / 2; + + var maxX = ((halfWidth / scale) - centerFromBoundaryX) * -1; + var minX = maxX - ((curImgWidth * (1 / scale)) - (vpWidth * (1 / scale))); + + var maxY = ((halfHeight / scale) - centerFromBoundaryY) * -1; + var minY = maxY - ((curImgHeight * (1 / scale)) - (vpHeight * (1 / scale))); + + var originMinX = (1 / scale) * halfWidth; + var originMaxX = (curImgWidth * (1 / scale)) - originMinX; + + var originMinY = (1 / scale) * halfHeight; + var originMaxY = (curImgHeight * (1 / scale)) - originMinY; + + return { + translate: { + maxX: maxX, + minX: minX, + maxY: maxY, + minY: minY + }, + origin: { + maxX: originMaxX, + minX: originMinX, + maxY: originMaxY, + minY: originMinY + } + }; + } + + function _updateCenterPoint() { + var self = this, + scale = self._currentZoom, + data = self.elements.preview.getBoundingClientRect(), + vpData = self.elements.viewport.getBoundingClientRect(), + transform = Transform.parse(self.elements.preview.style[CSS_TRANSFORM]), + pc = new TransformOrigin(self.elements.preview), + top = (vpData.top - data.top) + (vpData.height / 2), + left = (vpData.left - data.left) + (vpData.width / 2), + center = {}, + adj = {}; + + center.y = top / scale; + center.x = left / scale; + + adj.y = (center.y - pc.y) * (1 - scale); + adj.x = (center.x - pc.x) * (1 - scale); + + transform.x -= adj.x; + transform.y -= adj.y; + + var newCss = {}; + newCss[CSS_TRANS_ORG] = center.x + 'px ' + center.y + 'px'; + newCss[CSS_TRANSFORM] = transform.toString(); + css(self.elements.preview, newCss); + } + + function _initDraggable() { + var self = this, + isDragging = false, + originalX, + originalY, + originalDistance, + vpRect, + transform; + + function assignTransformCoordinates(deltaX, deltaY) { + var imgRect = self.elements.preview.getBoundingClientRect(), + top = transform.y + deltaY, + left = transform.x + deltaX; + + if (self.options.enforceBoundary) { + if (vpRect.top > imgRect.top + deltaY && vpRect.bottom < imgRect.bottom + deltaY) { + transform.y = top; + } + + if (vpRect.left > imgRect.left + deltaX && vpRect.right < imgRect.right + deltaX) { + transform.x = left; + } + } + else { + transform.y = top; + transform.x = left; + } + } + + function toggleGrabState(isDragging) { + self.elements.preview.setAttribute('aria-grabbed', isDragging); + self.elements.boundary.setAttribute('aria-dropeffect', isDragging? 'move': 'none'); + } + + function keyDown(ev) { + var LEFT_ARROW = 37, + UP_ARROW = 38, + RIGHT_ARROW = 39, + DOWN_ARROW = 40; + + if (ev.shiftKey && (ev.keyCode == UP_ARROW || ev.keyCode == DOWN_ARROW)) { + var zoom = 0.0; + if (ev.keyCode == UP_ARROW) { + zoom = parseFloat(self.elements.zoomer.value, 10) + parseFloat(self.elements.zoomer.step, 10) + } + else { + zoom = parseFloat(self.elements.zoomer.value, 10) - parseFloat(self.elements.zoomer.step, 10) + } + self.setZoom(zoom); + } + else if (self.options.enableKeyMovement && (ev.keyCode >= 37 && ev.keyCode <= 40)) { + ev.preventDefault(); + var movement = parseKeyDown(ev.keyCode); + + transform = Transform.parse(self.elements.preview); + document.body.style[CSS_USERSELECT] = 'none'; + vpRect = self.elements.viewport.getBoundingClientRect(); + keyMove(movement); + }; + + function parseKeyDown(key) { + switch (key) { + case LEFT_ARROW: + return [1, 0]; + case UP_ARROW: + return [0, 1]; + case RIGHT_ARROW: + return [-1, 0]; + case DOWN_ARROW: + return [0, -1]; + }; + }; + } + + function keyMove(movement) { + var deltaX = movement[0], + deltaY = movement[1], + newCss = {}; + + assignTransformCoordinates(deltaX, deltaY); + + newCss[CSS_TRANSFORM] = transform.toString(); + css(self.elements.preview, newCss); + _updateOverlay.call(self); + document.body.style[CSS_USERSELECT] = ''; + _updateCenterPoint.call(self); + _triggerUpdate.call(self); + originalDistance = 0; + } + + function mouseDown(ev) { + if (ev.button !== undefined && ev.button !== 0) return; + + ev.preventDefault(); + if (isDragging) return; + isDragging = true; + originalX = ev.pageX; + originalY = ev.pageY; + + if (ev.touches) { + var touches = ev.touches[0]; + originalX = touches.pageX; + originalY = touches.pageY; + } + toggleGrabState(isDragging); + transform = Transform.parse(self.elements.preview); + window.addEventListener('mousemove', mouseMove); + window.addEventListener('touchmove', mouseMove); + window.addEventListener('mouseup', mouseUp); + window.addEventListener('touchend', mouseUp); + document.body.style[CSS_USERSELECT] = 'none'; + vpRect = self.elements.viewport.getBoundingClientRect(); + } + + function mouseMove(ev) { + ev.preventDefault(); + var pageX = ev.pageX, + pageY = ev.pageY; + + if (ev.touches) { + var touches = ev.touches[0]; + pageX = touches.pageX; + pageY = touches.pageY; + } + + var deltaX = pageX - originalX, + deltaY = pageY - originalY, + newCss = {}; + + if (ev.type == 'touchmove') { + if (ev.touches.length > 1) { + var touch1 = ev.touches[0]; + var touch2 = ev.touches[1]; + var dist = Math.sqrt((touch1.pageX - touch2.pageX) * (touch1.pageX - touch2.pageX) + (touch1.pageY - touch2.pageY) * (touch1.pageY - touch2.pageY)); + + if (!originalDistance) { + originalDistance = dist / self._currentZoom; + } + + var scale = dist / originalDistance; + + _setZoomerVal.call(self, scale); + dispatchChange(self.elements.zoomer); + return; + } + } + + assignTransformCoordinates(deltaX, deltaY); + + newCss[CSS_TRANSFORM] = transform.toString(); + css(self.elements.preview, newCss); + _updateOverlay.call(self); + originalY = pageY; + originalX = pageX; + } + + function mouseUp() { + isDragging = false; + toggleGrabState(isDragging); + window.removeEventListener('mousemove', mouseMove); + window.removeEventListener('touchmove', mouseMove); + window.removeEventListener('mouseup', mouseUp); + window.removeEventListener('touchend', mouseUp); + document.body.style[CSS_USERSELECT] = ''; + _updateCenterPoint.call(self); + _triggerUpdate.call(self); + originalDistance = 0; + } + + self.elements.overlay.addEventListener('mousedown', mouseDown); + self.elements.viewport.addEventListener('keydown', keyDown); + self.elements.overlay.addEventListener('touchstart', mouseDown); + } + + function _updateOverlay() { + var self = this, + boundRect = self.elements.boundary.getBoundingClientRect(), + imgData = self.elements.preview.getBoundingClientRect(); + + css(self.elements.overlay, { + width: imgData.width + 'px', + height: imgData.height + 'px', + top: (imgData.top - boundRect.top) + 'px', + left: (imgData.left - boundRect.left) + 'px' + }); + } + var _debouncedOverlay = debounce(_updateOverlay, 500); + + function _triggerUpdate() { + var self = this, + data = self.get(), + ev; + + if (!_isVisible.call(self)) { + return; + } + + self.options.update.call(self, data); + if (self.$ && typeof Prototype == 'undefined') { + self.$(self.element).trigger('update', data); + } + else { + var ev; + if (window.CustomEvent) { + ev = new CustomEvent('update', { detail: data }); + } else { + ev = document.createEvent('CustomEvent'); + ev.initCustomEvent('update', true, true, data); + } + + self.element.dispatchEvent(ev); + } + } + + function _isVisible() { + return this.elements.preview.offsetHeight > 0 && this.elements.preview.offsetWidth > 0; + } + + function _updatePropertiesFromImage() { + var self = this, + initialZoom = 1, + cssReset = {}, + img = self.elements.preview, + imgData = self.elements.preview.getBoundingClientRect(), + transformReset = new Transform(0, 0, initialZoom), + originReset = new TransformOrigin(), + isVisible = _isVisible.call(self); + + if (!isVisible || self.data.bound) { + // if the croppie isn't visible or it doesn't need binding + return; + } + + self.data.bound = true; + cssReset[CSS_TRANSFORM] = transformReset.toString(); + cssReset[CSS_TRANS_ORG] = originReset.toString(); + cssReset['opacity'] = 1; + css(img, cssReset); + + self._originalImageWidth = imgData.width; + self._originalImageHeight = imgData.height; + + if (self.options.enableZoom) { + _updateZoomLimits.call(self, true); + } + else { + self._currentZoom = initialZoom; + } + + transformReset.scale = self._currentZoom; + cssReset[CSS_TRANSFORM] = transformReset.toString(); + css(img, cssReset); + + if (self.data.points.length) { + _bindPoints.call(self, self.data.points); + } + else { + _centerImage.call(self); + } + + _updateCenterPoint.call(self); + _updateOverlay.call(self); + } + + function _updateZoomLimits (initial) { + var self = this, + minZoom = 0, + maxZoom = 1.5, + initialZoom, + defaultInitialZoom, + zoomer = self.elements.zoomer, + scale = parseFloat(zoomer.value), + boundaryData = self.elements.boundary.getBoundingClientRect(), + imgData = self.elements.preview.getBoundingClientRect(), + vpData = self.elements.viewport.getBoundingClientRect(), + minW, + minH; + + if (self.options.enforceBoundary) { + minW = vpData.width / (initial ? imgData.width : imgData.width / scale); + minH = vpData.height / (initial ? imgData.height : imgData.height / scale); + minZoom = Math.max(minW, minH); + } + + if (minZoom >= maxZoom) { + maxZoom = minZoom + 1; + } + + zoomer.min = fix(minZoom, 4); + zoomer.max = fix(maxZoom, 4); + + if (initial) { + defaultInitialZoom = Math.max((boundaryData.width / imgData.width), (boundaryData.height / imgData.height)); + initialZoom = self.data.boundZoom !== null ? self.data.boundZoom : defaultInitialZoom; + _setZoomerVal.call(self, initialZoom); + } + + dispatchChange(zoomer); + } + + function _bindPoints(points) { + if (points.length != 4) { + throw "Croppie - Invalid number of points supplied: " + points; + } + var self = this, + pointsWidth = points[2] - points[0], + // pointsHeight = points[3] - points[1], + vpData = self.elements.viewport.getBoundingClientRect(), + boundRect = self.elements.boundary.getBoundingClientRect(), + vpOffset = { + left: vpData.left - boundRect.left, + top: vpData.top - boundRect.top + }, + scale = vpData.width / pointsWidth, + originTop = points[1], + originLeft = points[0], + transformTop = (-1 * points[1]) + vpOffset.top, + transformLeft = (-1 * points[0]) + vpOffset.left, + newCss = {}; + + newCss[CSS_TRANS_ORG] = originLeft + 'px ' + originTop + 'px'; + newCss[CSS_TRANSFORM] = new Transform(transformLeft, transformTop, scale).toString(); + css(self.elements.preview, newCss); + + _setZoomerVal.call(self, scale); + self._currentZoom = scale; + } + + function _centerImage() { + var self = this, + imgDim = self.elements.preview.getBoundingClientRect(), + vpDim = self.elements.viewport.getBoundingClientRect(), + boundDim = self.elements.boundary.getBoundingClientRect(), + vpLeft = vpDim.left - boundDim.left, + vpTop = vpDim.top - boundDim.top, + w = vpLeft - ((imgDim.width - vpDim.width) / 2), + h = vpTop - ((imgDim.height - vpDim.height) / 2), + transform = new Transform(w, h, self._currentZoom); + + css(self.elements.preview, CSS_TRANSFORM, transform.toString()); + } + + function _transferImageToCanvas(customOrientation) { + var self = this, + canvas = self.elements.canvas, + img = self.elements.img, + ctx = canvas.getContext('2d'), + exif = _hasExif.call(self), + customOrientation = self.options.enableOrientation && customOrientation; + + ctx.clearRect(0, 0, canvas.width, canvas.height); + canvas.width = img.width; + canvas.height = img.height; + + if (exif && !customOrientation) { + var orientation = getExifOrientation(img); + drawCanvas(canvas, img, num(orientation || 0, 10)); + } + else if (customOrientation) { + drawCanvas(canvas, img, customOrientation); + } + } + + function _getCanvas(data) { + var self = this, + points = data.points, + left = num(points[0]), + top = num(points[1]), + right = num(points[2]), + bottom = num(points[3]), + width = right-left, + height = bottom-top, + circle = data.circle, + canvas = document.createElement('canvas'), + ctx = canvas.getContext('2d'), + outWidth = width, + outHeight = height, + startX = 0, + startY = 0, + canvasWidth = outWidth, + canvasHeight = outHeight, + customDimensions = (data.outputWidth && data.outputHeight), + outputRatio = 1; + + if (customDimensions) { + canvasWidth = data.outputWidth; + canvasHeight = data.outputHeight; + outputRatio = canvasWidth / outWidth; + } + + canvas.width = canvasWidth; + canvas.height = canvasHeight; + + if (data.backgroundColor) { + ctx.fillStyle = data.backgroundColor; + ctx.fillRect(0, 0, outWidth, outHeight); + } + + // start fixing data to send to draw image for enforceBoundary: false + if (!self.options.enforceBoundary) { + if (left < 0) { + startX = Math.abs(left); + left = 0; + } + if (top < 0) { + startY = Math.abs(top); + top = 0; + } + if (right > self._originalImageWidth) { + width = self._originalImageWidth - left; + outWidth = width; + } + if (bottom > self._originalImageHeight) { + height = self._originalImageHeight - top; + outHeight = height; + } + } + + if (outputRatio !== 1) { + startX *= outputRatio; + startY *= outputRatio; + outWidth *= outputRatio; + outHeight *= outputRatio; + } + + ctx.drawImage(this.elements.preview, left, top, Math.min(width, self._originalImageWidth), Math.min(height, self._originalImageHeight), startX, startY, outWidth, outHeight); + if (circle) { + ctx.fillStyle = '#fff'; + ctx.globalCompositeOperation = 'destination-in'; + ctx.beginPath(); + ctx.arc(outWidth / 2, outHeight / 2, outWidth / 2, 0, Math.PI * 2, true); + ctx.closePath(); + ctx.fill(); + } + return canvas; + } + + function _getHtmlResult(data) { + var points = data.points, + div = document.createElement('div'), + img = document.createElement('img'), + width = points[2] - points[0], + height = points[3] - points[1]; + + addClass(div, 'croppie-result'); + div.appendChild(img); + css(img, { + left: (-1 * points[0]) + 'px', + top: (-1 * points[1]) + 'px' + }); + img.src = data.url; + css(div, { + width: width + 'px', + height: height + 'px' + }); + + return div; + } + + function _getBase64Result(data) { + return _getCanvas.call(this, data).toDataURL(data.format, data.quality); + } + + function _getBlobResult(data) { + var self = this; + return new Promise(function (resolve, reject) { + _getCanvas.call(self, data).toBlob(function (blob) { + resolve(blob); + }, data.format, data.quality); + }); + } + + function _bind(options, cb) { + var self = this, + url, + points = [], + zoom = null, + hasExif = _hasExif.call(self);; + + if (typeof (options) === 'string') { + url = options; + options = {}; + } + else if (Array.isArray(options)) { + points = options.slice(); + } + else if (typeof (options) == 'undefined' && self.data.url) { //refreshing + _updatePropertiesFromImage.call(self); + _triggerUpdate.call(self); + return null; + } + else { + url = options.url; + points = options.points || []; + zoom = typeof(options.zoom) === 'undefined' ? null : options.zoom; + } + + self.data.bound = false; + self.data.url = url || self.data.url; + self.data.boundZoom = zoom; + + return loadImage(url, self.elements.img, hasExif).then(function (img) { + if (!points.length) { + var natDim = naturalImageDimensions(img); + var rect = self.elements.viewport.getBoundingClientRect(); + var aspectRatio = rect.width / rect.height; + var imgAspectRatio = natDim.width / natDim.height; + var width, height; + + if (imgAspectRatio > aspectRatio) { + height = natDim.height; + width = height * aspectRatio; + } + else { + width = natDim.width; + height = width / aspectRatio; + } + + var x0 = (natDim.width - width) / 2; + var y0 = (natDim.height - height) / 2; + var x1 = x0 + width; + var y1 = y0 + height; + + self.data.points = [x0, y0, x1, y1]; + } + else if (self.options.relative) { + points = [ + points[0] * img.naturalWidth / 100, + points[1] * img.naturalHeight / 100, + points[2] * img.naturalWidth / 100, + points[3] * img.naturalHeight / 100 + ]; + } + + self.data.points = points.map(function (p) { + return parseFloat(p); + }); + if (self.options.useCanvas) { + _transferImageToCanvas.call(self, options.orientation || 1); + } + _updatePropertiesFromImage.call(self); + _triggerUpdate.call(self); + cb && cb(); + }); + } + + function fix(v, decimalPoints) { + return parseFloat(v).toFixed(decimalPoints || 0); + } + + function _get() { + var self = this, + imgData = self.elements.preview.getBoundingClientRect(), + vpData = self.elements.viewport.getBoundingClientRect(), + x1 = vpData.left - imgData.left, + y1 = vpData.top - imgData.top, + widthDiff = (vpData.width - self.elements.viewport.offsetWidth) / 2, //border + heightDiff = (vpData.height - self.elements.viewport.offsetHeight) / 2, + x2 = x1 + self.elements.viewport.offsetWidth + widthDiff, + y2 = y1 + self.elements.viewport.offsetHeight + heightDiff, + scale = self._currentZoom; + + if (scale === Infinity || isNaN(scale)) { + scale = 1; + } + + var max = self.options.enforceBoundary ? 0 : Number.NEGATIVE_INFINITY; + x1 = Math.max(max, x1 / scale); + y1 = Math.max(max, y1 / scale); + x2 = Math.max(max, x2 / scale); + y2 = Math.max(max, y2 / scale); + + return { + points: [fix(x1), fix(y1), fix(x2), fix(y2)], + zoom: scale + }; + } + + var RESULT_DEFAULTS = { + type: 'canvas', + format: 'png', + quality: 1 + }, + RESULT_FORMATS = ['jpeg', 'webp', 'png']; + + function _result(options) { + var self = this, + data = _get.call(self), + opts = deepExtend(RESULT_DEFAULTS, deepExtend({}, options)), + resultType = (typeof (options) === 'string' ? options : (opts.type || 'base64')), + size = opts.size || 'viewport', + format = opts.format, + quality = opts.quality, + backgroundColor = opts.backgroundColor, + circle = typeof opts.circle === 'boolean' ? opts.circle : (self.options.viewport.type === 'circle'), + vpRect = self.elements.viewport.getBoundingClientRect(), + ratio = vpRect.width / vpRect.height, + prom; + + if (size === 'viewport') { + data.outputWidth = vpRect.width; + data.outputHeight = vpRect.height; + } else if (typeof size === 'object') { + if (size.width && size.height) { + data.outputWidth = size.width; + data.outputHeight = size.height; + } else if (size.width) { + data.outputWidth = size.width; + data.outputHeight = size.width / ratio; + } else if (size.height) { + data.outputWidth = size.height * ratio; + data.outputHeight = size.height; + } + } + + if (RESULT_FORMATS.indexOf(format) > -1) { + data.format = 'image/' + format; + data.quality = quality; + } + + data.circle = circle; + data.url = self.data.url; + data.backgroundColor = backgroundColor; + + prom = new Promise(function (resolve, reject) { + switch(resultType.toLowerCase()) + { + case 'rawcanvas': + resolve(_getCanvas.call(self, data)); + break; + case 'canvas': + case 'base64': + resolve(_getBase64Result.call(self, data)); + break; + case 'blob': + _getBlobResult.call(self, data).then(resolve); + break; + default: + resolve(_getHtmlResult.call(self, data)); + break; + } + }); + return prom; + } + + function _refresh() { + _updatePropertiesFromImage.call(this); + } + + function _rotate(deg) { + if (!this.options.useCanvas) { + throw 'Croppie: Cannot rotate without enableOrientation'; + } + + var self = this, + canvas = self.elements.canvas, + copy = document.createElement('canvas'), + ornt = 1; + + copy.width = canvas.width; + copy.height = canvas.height; + var ctx = copy.getContext('2d'); + ctx.drawImage(canvas, 0, 0); + + if (deg === 90 || deg === -270) ornt = 6; + if (deg === -90 || deg === 270) ornt = 8; + if (deg === 180 || deg === -180) ornt = 3; + + drawCanvas(canvas, copy, ornt); + _onZoom.call(self); + copy = null; + } + + function _destroy() { + var self = this; + self.element.removeChild(self.elements.boundary); + removeClass(self.element, 'croppie-container'); + if (self.options.enableZoom) { + self.element.removeChild(self.elements.zoomerWrap); + } + delete self.elements; + } + + if (window.jQuery) { + var $ = window.jQuery; + $.fn.croppie = function (opts) { + var ot = typeof opts; + + if (ot === 'string') { + var args = Array.prototype.slice.call(arguments, 1); + var singleInst = $(this).data('croppie'); + + if (opts === 'get') { + return singleInst.get(); + } + else if (opts === 'result') { + return singleInst.result.apply(singleInst, args); + } + else if (opts === 'bind') { + return singleInst.bind.apply(singleInst, args); + } + + return this.each(function () { + var i = $(this).data('croppie'); + if (!i) return; + + var method = i[opts]; + if ($.isFunction(method)) { + method.apply(i, args); + if (opts === 'destroy') { + $(this).removeData('croppie'); + } + } + else { + throw 'Croppie ' + opts + ' method not found'; + } + }); + } + else { + return this.each(function () { + var i = new Croppie(this, opts); + i.$ = $; + $(this).data('croppie', i); + }); + } + }; + } + + function Croppie(element, opts) { + this.element = element; + this.options = deepExtend(deepExtend({}, Croppie.defaults), opts); + + if (this.element.tagName.toLowerCase() === 'img') { + var origImage = this.element; + addClass(origImage, 'cr-original-image'); + setAttributes(origImage, {'aria-hidden' : 'true', 'alt' : '' }); + var replacementDiv = document.createElement('div'); + this.element.parentNode.appendChild(replacementDiv); + replacementDiv.appendChild(origImage); + this.element = replacementDiv; + this.options.url = this.options.url || origImage.src; + } + + _create.call(this); + if (this.options.url) { + var bindOpts = { + url: this.options.url, + points: this.options.points + }; + delete this.options['url']; + delete this.options['points']; + _bind.call(this, bindOpts); + } + } + + Croppie.defaults = { + viewport: { + width: 100, + height: 100, + type: 'square' + }, + boundary: { }, + orientationControls: { + enabled: true, + leftClass: '', + rightClass: '' + }, + resizeControls: { + width: true, + height: true + }, + customClass: '', + showZoomer: true, + enableZoom: true, + enableResize: false, + mouseWheelZoom: true, + enableExif: false, + enforceBoundary: true, + enableOrientation: false, + enableKeyMovement: true, + update: function () { } + }; + + Croppie.globals = { + translate: 'translate3d' + }; + + deepExtend(Croppie.prototype, { + bind: function (options, cb) { + return _bind.call(this, options, cb); + }, + get: function () { + var data = _get.call(this); + var points = data.points; + if (this.options.relative) { + points[0] /= this.elements.img.naturalWidth / 100; + points[1] /= this.elements.img.naturalHeight / 100; + points[2] /= this.elements.img.naturalWidth / 100; + points[3] /= this.elements.img.naturalHeight / 100; + } + return data; + }, + result: function (type) { + return _result.call(this, type); + }, + refresh: function () { + return _refresh.call(this); + }, + setZoom: function (v) { + _setZoomerVal.call(this, v); + dispatchChange(this.elements.zoomer); + }, + rotate: function (deg) { + _rotate.call(this, deg); + }, + destroy: function () { + return _destroy.call(this); + } + }); + + exports.Croppie = window.Croppie = Croppie; + + if (typeof module === 'object' && !!module.exports) { + module.exports = Croppie; + } +})); diff --git a/node_modules/croppie/croppie.min.js b/node_modules/croppie/croppie.min.js new file mode 100644 index 0000000..e9ffb8f --- /dev/null +++ b/node_modules/croppie/croppie.min.js @@ -0,0 +1 @@ +!function(e,t){"function"==typeof define&&define.amd?define(["exports"],t):t("object"==typeof exports&&"string"!=typeof exports.nodeName?exports:e.commonJsStrict={})}(this,function(e){function t(e){if(e in q)return e;for(var t=e[0].toUpperCase()+e.slice(1),n=T.length;n--;)if((e=T[n]+t)in q)return e}function n(e,t){e=e||{};for(var i in t)t[i]&&t[i].constructor&&t[i].constructor===Object?(e[i]=e[i]||{},n(e[i],t[i])):e[i]=t[i];return e}function i(e){if("createEvent"in document){var t=document.createEvent("HTMLEvents");t.initEvent("change",!1,!0),e.dispatchEvent(t)}else e.fireEvent("onchange")}function o(e,t,n){if("string"==typeof t){var i=t;(t={})[i]=n}for(var o in t)e.style[o]=t[o]}function r(e,t){e.classList?e.classList.add(t):e.className+=" "+t}function a(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(t,"")}function l(e,t){for(var n in t)e.setAttribute(n,t[n])}function s(e){return parseInt(e,10)}function u(e,t,n){var i=t||new Image;return i.style.opacity=0,new Promise(function(t){function o(){setTimeout(function(){t(i)},1)}i.src!==e?(i.exifdata=null,i.removeAttribute("crossOrigin"),e.match(/^https?:\/\/|^\/\//)&&i.setAttribute("crossOrigin","anonymous"),i.onload=function(){n?EXIF.getData(i,function(){o()}):o()},i.src=e):o()})}function c(e){var t=e.naturalWidth,n=e.naturalHeight;if(e.exifdata&&e.exifdata.Orientation>=5){var i=t;t=n,n=i}return{width:t,height:n}}function h(e){return e.exifdata.Orientation}function p(e,t,n){var i=t.width,o=t.height,r=e.getContext("2d");switch(e.width=t.width,e.height=t.height,r.save(),n){case 2:r.translate(i,0),r.scale(-1,1);break;case 3:r.translate(i,o),r.rotate(180*Math.PI/180);break;case 4:r.translate(0,o),r.scale(1,-1);break;case 5:e.width=o,e.height=i,r.rotate(90*Math.PI/180),r.scale(1,-1);break;case 6:e.width=o,e.height=i,r.rotate(90*Math.PI/180),r.translate(0,-o);break;case 7:e.width=o,e.height=i,r.rotate(-90*Math.PI/180),r.translate(-i,o),r.scale(1,-1);break;case 8:e.width=o,e.height=i,r.translate(0,i),r.rotate(-90*Math.PI/180)}r.drawImage(t,0,0,i,o),r.restore()}function d(){var e,t,n,i,a,s=this,u=s.options.viewport.type?"cr-vp-"+s.options.viewport.type:null;s.options.useCanvas=s.options.enableOrientation||m.call(s),s.data={},s.elements={},e=s.elements.boundary=document.createElement("div"),t=s.elements.viewport=document.createElement("div"),s.elements.img=document.createElement("img"),n=s.elements.overlay=document.createElement("div"),s.options.useCanvas?(s.elements.canvas=document.createElement("canvas"),s.elements.preview=s.elements.canvas):s.elements.preview=s.elements.img,r(e,"cr-boundary"),e.setAttribute("aria-dropeffect","none"),i=s.options.boundary.width,a=s.options.boundary.height,o(e,{width:i+(isNaN(i)?"":"px"),height:a+(isNaN(a)?"":"px")}),r(t,"cr-viewport"),u&&r(t,u),o(t,{width:s.options.viewport.width+"px",height:s.options.viewport.height+"px"}),t.setAttribute("tabindex",0),r(s.elements.preview,"cr-image"),l(s.elements.preview,{alt:"preview","aria-grabbed":"false"}),r(n,"cr-overlay"),s.element.appendChild(e),e.appendChild(s.elements.preview),e.appendChild(t),e.appendChild(n),r(s.element,"croppie-container"),s.options.customClass&&r(s.element,s.options.customClass),x.call(this),s.options.enableZoom&&g.call(s),s.options.enableResize&&f.call(s)}function m(){return this.options.enableExif&&window.EXIF}function f(){function e(e){if((void 0===e.button||0===e.button)&&(e.preventDefault(),!m)){var o=p.elements.overlay.getBoundingClientRect();if(m=!0,a=e.pageX,l=e.pageY,i=-1!==e.currentTarget.className.indexOf("vertical")?"v":"h",s=o.width,u=o.height,e.touches){var r=e.touches[0];a=r.pageX,l=r.pageY}window.addEventListener("mousemove",t),window.addEventListener("touchmove",t),window.addEventListener("mouseup",n),window.addEventListener("touchend",n),document.body.style[D]="none"}}function t(e){var t=e.pageX,n=e.pageY;if(e.preventDefault(),e.touches){var r=e.touches[0];t=r.pageX,n=r.pageY}var c=t-a,h=n-l,m=p.options.viewport.height+h,v=p.options.viewport.width+c;"v"===i&&m>=f&&m<=u?(o(d,{height:m+"px"}),p.options.boundary.height+=h,o(p.elements.boundary,{height:p.options.boundary.height+"px"}),p.options.viewport.height+=h,o(p.elements.viewport,{height:p.options.viewport.height+"px"})):"h"===i&&v>=f&&v<=s&&(o(d,{width:v+"px"}),p.options.boundary.width+=c,o(p.elements.boundary,{width:p.options.boundary.width+"px"}),p.options.viewport.width+=c,o(p.elements.viewport,{width:p.options.viewport.width+"px"})),C.call(p),B.call(p),b.call(p),E.call(p),l=n,a=t}function n(){m=!1,window.removeEventListener("mousemove",t),window.removeEventListener("touchmove",t),window.removeEventListener("mouseup",n),window.removeEventListener("touchend",n),document.body.style[D]=""}var i,a,l,s,u,c,h,p=this,d=document.createElement("div"),m=!1,f=50;r(d,"cr-resizer"),o(d,{width:this.options.viewport.width+"px",height:this.options.viewport.height+"px"}),this.options.resizeControls.height&&(r(c=document.createElement("div"),"cr-resizer-vertical"),d.appendChild(c)),this.options.resizeControls.width&&(r(h=document.createElement("div"),"cr-resizer-horisontal"),d.appendChild(h)),c&&c.addEventListener("mousedown",e),h&&h.addEventListener("mousedown",e),this.elements.boundary.appendChild(d)}function v(e){if(this.options.enableZoom){var t=this.elements.zoomer,n=F(e,4);t.value=Math.max(t.min,Math.min(t.max,n))}}function g(){function e(){w.call(n,{value:parseFloat(o.value),origin:new $(n.elements.preview),viewportRect:n.elements.viewport.getBoundingClientRect(),transform:K.parse(n.elements.preview)})}function t(t){var i,o;i=t.wheelDelta?t.wheelDelta/1200:t.deltaY?t.deltaY/1060:t.detail?t.detail/-60:0,o=n._currentZoom+i*n._currentZoom,t.preventDefault(),v.call(n,o),e.call(n)}var n=this,i=n.elements.zoomerWrap=document.createElement("div"),o=n.elements.zoomer=document.createElement("input");r(i,"cr-slider-wrap"),r(o,"cr-slider"),o.type="range",o.step="0.0001",o.value=1,o.style.display=n.options.showZoomer?"":"none",o.setAttribute("aria-label","zoom"),n.element.appendChild(i),i.appendChild(o),n._currentZoom=1,n.elements.zoomer.addEventListener("input",e),n.elements.zoomer.addEventListener("change",e),n.options.mouseWheelZoom&&(n.elements.boundary.addEventListener("mousewheel",t),n.elements.boundary.addEventListener("DOMMouseScroll",t))}function w(e){function t(){var e={};e[P]=i.toString(),e[N]=a.toString(),o(n.elements.preview,e)}var n=this,i=e?e.transform:K.parse(n.elements.preview),r=e?e.viewportRect:n.elements.viewport.getBoundingClientRect(),a=e?e.origin:new $(n.elements.preview);if(n._currentZoom=e?e.value:n._currentZoom,i.scale=n._currentZoom,n.elements.zoomer.setAttribute("aria-valuenow",n._currentZoom),t(),n.options.enforceBoundary){var l=y.call(n,r),s=l.translate,u=l.origin;i.x>=s.maxX&&(a.x=u.minX,i.x=s.maxX),i.x<=s.minX&&(a.x=u.maxX,i.x=s.minX),i.y>=s.maxY&&(a.y=u.minY,i.y=s.maxY),i.y<=s.minY&&(a.y=u.maxY,i.y=s.minY)}t(),Q.call(n),E.call(n)}function y(e){var t=this,n=t._currentZoom,i=e.width,o=e.height,r=t.elements.boundary.clientWidth/2,a=t.elements.boundary.clientHeight/2,l=t.elements.preview.getBoundingClientRect(),s=l.width,u=l.height,c=i/2,h=o/2,p=-1*(c/n-r),d=-1*(h/n-a),m=1/n*c,f=1/n*h;return{translate:{maxX:p,minX:p-(s*(1/n)-i*(1/n)),maxY:d,minY:d-(u*(1/n)-o*(1/n))},origin:{maxX:s*(1/n)-m,minX:m,maxY:u*(1/n)-f,minY:f}}}function b(){var e=this,t=e._currentZoom,n=e.elements.preview.getBoundingClientRect(),i=e.elements.viewport.getBoundingClientRect(),r=K.parse(e.elements.preview.style[P]),a=new $(e.elements.preview),l=i.top-n.top+i.height/2,s=i.left-n.left+i.width/2,u={},c={};u.y=l/t,u.x=s/t,c.y=(u.y-a.y)*(1-t),c.x=(u.x-a.x)*(1-t),r.x-=c.x,r.y-=c.y;var h={};h[N]=u.x+"px "+u.y+"px",h[P]=r.toString(),o(e.elements.preview,h)}function x(){function e(e,t){var n=d.elements.preview.getBoundingClientRect(),i=p.y+t,o=p.x+e;d.options.enforceBoundary?(h.top>n.top+t&&h.bottomn.left+e&&h.right1){var f=t.touches[0],g=t.touches[1],w=Math.sqrt((f.pageX-g.pageX)*(f.pageX-g.pageX)+(f.pageY-g.pageY)*(f.pageY-g.pageY));c||(c=w/d._currentZoom);var y=w/c;return v.call(d,y),void i(d.elements.zoomer)}e(l,h),m[P]=p.toString(),o(d.elements.preview,m),C.call(d),u=r,s=n}function l(){t(m=!1),window.removeEventListener("mousemove",a),window.removeEventListener("touchmove",a),window.removeEventListener("mouseup",l),window.removeEventListener("touchend",l),document.body.style[D]="",b.call(d),E.call(d),c=0}var s,u,c,h,p,d=this,m=!1;d.elements.overlay.addEventListener("mousedown",r),d.elements.viewport.addEventListener("keydown",function(e){var t=37,i=38,o=39,r=40;if(!e.shiftKey||e.keyCode!=i&&e.keyCode!=r){if(d.options.enableKeyMovement&&e.keyCode>=37&&e.keyCode<=40){e.preventDefault();var a=function(n){switch(e.keyCode){case t:return[1,0];case i:return[0,1];case o:return[-1,0];case r:return[0,-1]}}();p=K.parse(d.elements.preview),document.body.style[D]="none",h=d.elements.viewport.getBoundingClientRect(),n(a)}}else{var l=0;l=e.keyCode==i?parseFloat(d.elements.zoomer.value,10)+parseFloat(d.elements.zoomer.step,10):parseFloat(d.elements.zoomer.value,10)-parseFloat(d.elements.zoomer.step,10),d.setZoom(l)}}),d.elements.overlay.addEventListener("touchstart",r)}function C(){var e=this,t=e.elements.boundary.getBoundingClientRect(),n=e.elements.preview.getBoundingClientRect();o(e.elements.overlay,{width:n.width+"px",height:n.height+"px",top:n.top-t.top+"px",left:n.left-t.left+"px"})}function E(){var e=this,t=e.get();if(_.call(e))if(e.options.update.call(e,t),e.$&&"undefined"==typeof Prototype)e.$(e.element).trigger("update",t);else{var n;window.CustomEvent?n=new CustomEvent("update",{detail:t}):(n=document.createEvent("CustomEvent")).initCustomEvent("update",!0,!0,t),e.element.dispatchEvent(n)}}function _(){return this.elements.preview.offsetHeight>0&&this.elements.preview.offsetWidth>0}function L(){var e=this,t={},n=e.elements.preview,i=e.elements.preview.getBoundingClientRect(),r=new K(0,0,1),a=new $;_.call(e)&&!e.data.bound&&(e.data.bound=!0,t[P]=r.toString(),t[N]=a.toString(),t.opacity=1,o(n,t),e._originalImageWidth=i.width,e._originalImageHeight=i.height,e.options.enableZoom?B.call(e,!0):e._currentZoom=1,r.scale=e._currentZoom,t[P]=r.toString(),o(n,t),e.data.points.length?R.call(e,e.data.points):I.call(e),b.call(e),C.call(e))}function B(e){var t,n,o,r,a=this,l=0,s=1.5,u=a.elements.zoomer,c=parseFloat(u.value),h=a.elements.boundary.getBoundingClientRect(),p=a.elements.preview.getBoundingClientRect(),d=a.elements.viewport.getBoundingClientRect();a.options.enforceBoundary&&(o=d.width/(e?p.width:p.width/c),r=d.height/(e?p.height:p.height/c),l=Math.max(o,r)),l>=s&&(s=l+1),u.min=F(l,4),u.max=F(s,4),e&&(n=Math.max(h.width/p.width,h.height/p.height),t=null!==a.data.boundZoom?a.data.boundZoom:n,v.call(a,t)),i(u)}function R(e){if(4!=e.length)throw"Croppie - Invalid number of points supplied: "+e;var t=this,n=e[2]-e[0],i=t.elements.viewport.getBoundingClientRect(),r=t.elements.boundary.getBoundingClientRect(),a={left:i.left-r.left,top:i.top-r.top},l=i.width/n,s=e[1],u=e[0],c=-1*e[1]+a.top,h=-1*e[0]+a.left,p={};p[N]=u+"px "+s+"px",p[P]=new K(h,c,l).toString(),o(t.elements.preview,p),v.call(t,l),t._currentZoom=l}function I(){var e=this,t=e.elements.preview.getBoundingClientRect(),n=e.elements.viewport.getBoundingClientRect(),i=e.elements.boundary.getBoundingClientRect(),r=n.left-i.left,a=n.top-i.top,l=r-(t.width-n.width)/2,s=a-(t.height-n.height)/2,u=new K(l,s,e._currentZoom);o(e.elements.preview,P,u.toString())}function M(e){var t=this,n=t.elements.canvas,i=t.elements.img,o=n.getContext("2d"),r=m.call(t),e=t.options.enableOrientation&&e;o.clearRect(0,0,n.width,n.height),n.width=i.width,n.height=i.height,r&&!e?p(n,i,s(h(i)||0,10)):e&&p(n,i,e)}function Z(e){var t=this,n=e.points,i=s(n[0]),o=s(n[1]),r=s(n[2]),a=s(n[3]),l=r-i,u=a-o,c=e.circle,h=document.createElement("canvas"),p=h.getContext("2d"),d=l,m=u,f=0,v=0,g=d,w=m,y=1;return e.outputWidth&&e.outputHeight&&(g=e.outputWidth,w=e.outputHeight,y=g/d),h.width=g,h.height=w,e.backgroundColor&&(p.fillStyle=e.backgroundColor,p.fillRect(0,0,d,m)),t.options.enforceBoundary||(i<0&&(f=Math.abs(i),i=0),o<0&&(v=Math.abs(o),o=0),r>t._originalImageWidth&&(d=l=t._originalImageWidth-i),a>t._originalImageHeight&&(m=u=t._originalImageHeight-o)),1!==y&&(f*=y,v*=y,d*=y,m*=y),p.drawImage(this.elements.preview,i,o,Math.min(l,t._originalImageWidth),Math.min(u,t._originalImageHeight),f,v,d,m),c&&(p.fillStyle="#fff",p.globalCompositeOperation="destination-in",p.beginPath(),p.arc(d/2,m/2,d/2,0,2*Math.PI,!0),p.closePath(),p.fill()),h}function z(e){var t=e.points,n=document.createElement("div"),i=document.createElement("img"),a=t[2]-t[0],l=t[3]-t[1];return r(n,"croppie-result"),n.appendChild(i),o(i,{left:-1*t[0]+"px",top:-1*t[1]+"px"}),i.src=e.url,o(n,{width:a+"px",height:l+"px"}),n}function Y(e){return Z.call(this,e).toDataURL(e.format,e.quality)}function W(e){var t=this;return new Promise(function(n,i){Z.call(t,e).toBlob(function(e){n(e)},e.format,e.quality)})}function X(e,t){var n,i=this,o=[],r=null,a=m.call(i);if("string"==typeof e)n=e,e={};else if(Array.isArray(e))o=e.slice();else{if(void 0===e&&i.data.url)return L.call(i),E.call(i),null;n=e.url,o=e.points||[],r=void 0===e.zoom?null:e.zoom}return i.data.bound=!1,i.data.url=n||i.data.url,i.data.boundZoom=r,u(n,i.elements.img,a).then(function(n){if(o.length)i.options.relative&&(o=[o[0]*n.naturalWidth/100,o[1]*n.naturalHeight/100,o[2]*n.naturalWidth/100,o[3]*n.naturalHeight/100]);else{var r,a,l=c(n),s=i.elements.viewport.getBoundingClientRect(),u=s.width/s.height;l.width/l.height>u?r=(a=l.height)*u:a=(r=l.width)/u;var h=(l.width-r)/2,p=(l.height-a)/2,d=h+r,m=p+a;i.data.points=[h,p,d,m]}i.data.points=o.map(function(e){return parseFloat(e)}),i.options.useCanvas&&M.call(i,e.orientation||1),L.call(i),E.call(i),t&&t()})}function F(e,t){return parseFloat(e).toFixed(t||0)}function H(){var e=this,t=e.elements.preview.getBoundingClientRect(),n=e.elements.viewport.getBoundingClientRect(),i=n.left-t.left,o=n.top-t.top,r=(n.width-e.elements.viewport.offsetWidth)/2,a=(n.height-e.elements.viewport.offsetHeight)/2,l=i+e.elements.viewport.offsetWidth+r,s=o+e.elements.viewport.offsetHeight+a,u=e._currentZoom;(u===1/0||isNaN(u))&&(u=1);var c=e.options.enforceBoundary?0:Number.NEGATIVE_INFINITY;return i=Math.max(c,i/u),o=Math.max(c,o/u),l=Math.max(c,l/u),s=Math.max(c,s/u),{points:[F(i),F(o),F(l),F(s)],zoom:u}}function k(e){var t=this,i=H.call(t),o=n(G,n({},e)),r="string"==typeof e?e:o.type||"base64",a=o.size||"viewport",l=o.format,s=o.quality,u=o.backgroundColor,c="boolean"==typeof o.circle?o.circle:"circle"===t.options.viewport.type,h=t.elements.viewport.getBoundingClientRect(),p=h.width/h.height;return"viewport"===a?(i.outputWidth=h.width,i.outputHeight=h.height):"object"==typeof a&&(a.width&&a.height?(i.outputWidth=a.width,i.outputHeight=a.height):a.width?(i.outputWidth=a.width,i.outputHeight=a.width/p):a.height&&(i.outputWidth=a.height*p,i.outputHeight=a.height)),J.indexOf(l)>-1&&(i.format="image/"+l,i.quality=s),i.circle=c,i.url=t.data.url,i.backgroundColor=u,new Promise(function(e,n){switch(r.toLowerCase()){case"rawcanvas":e(Z.call(t,i));break;case"canvas":case"base64":e(Y.call(t,i));break;case"blob":W.call(t,i).then(e);break;default:e(z.call(t,i))}})}function j(){L.call(this)}function A(e){if(!this.options.useCanvas)throw"Croppie: Cannot rotate without enableOrientation";var t=this,n=t.elements.canvas,i=document.createElement("canvas"),o=1;i.width=n.width,i.height=n.height,i.getContext("2d").drawImage(n,0,0),90!==e&&-270!==e||(o=6),-90!==e&&270!==e||(o=8),180!==e&&-180!==e||(o=3),p(n,i,o),w.call(t),i=null}function S(){var e=this;e.element.removeChild(e.elements.boundary),a(e.element,"croppie-container"),e.options.enableZoom&&e.element.removeChild(e.elements.zoomerWrap),delete e.elements}function O(e,t){if(this.element=e,this.options=n(n({},O.defaults),t),"img"===this.element.tagName.toLowerCase()){var i=this.element;r(i,"cr-original-image"),l(i,{"aria-hidden":"true",alt:""});var o=document.createElement("div");this.element.parentNode.appendChild(o),o.appendChild(i),this.element=o,this.options.url=this.options.url||i.src}if(d.call(this),this.options.url){var a={url:this.options.url,points:this.options.points};delete this.options.url,delete this.options.points,X.call(this,a)}}"function"!=typeof Promise&&function(e){function t(e,t){return function(){e.apply(t,arguments)}}function n(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],s(e,t(o,this),t(r,this))}function i(e){var t=this;return null===this._state?void this._deferreds.push(e):void c(function(){var n=t._state?e.onFulfilled:e.onRejected;if(null!==n){var i;try{i=n(t._value)}catch(t){return void e.reject(t)}e.resolve(i)}else(t._state?e.resolve:e.reject)(t._value)})}function o(e){try{if(e===this)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if("function"==typeof n)return void s(t(n,e),t(o,this),t(r,this))}this._state=!0,this._value=e,a.call(this)}catch(e){r.call(this,e)}}function r(e){this._state=!1,this._value=e,a.call(this)}function a(){for(var e=0,t=this._deferreds.length;t>e;e++)i.call(this,this._deferreds[e]);this._deferreds=null}function l(e,t,n,i){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=i}function s(e,t,n){var i=!1;try{e(function(e){i||(i=!0,t(e))},function(e){i||(i=!0,n(e))})}catch(e){if(i)return;i=!0,n(e)}}var u=setTimeout,c="function"==typeof setImmediate&&setImmediate||function(e){u(e,1)},h=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};n.prototype.catch=function(e){return this.then(null,e)},n.prototype.then=function(e,t){var o=this;return new n(function(n,r){i.call(o,new l(e,t,n,r))})},n.all=function(){var e=Array.prototype.slice.call(1===arguments.length&&h(arguments[0])?arguments[0]:arguments);return new n(function(t,n){function i(r,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var l=a.then;if("function"==typeof l)return void l.call(a,function(e){i(r,e)},n)}e[r]=a,0==--o&&t(e)}catch(e){n(e)}}if(0===e.length)return t([]);for(var o=e.length,r=0;ri;i++)e[i].then(t,n)})},n._setImmediateFn=function(e){c=e},"undefined"!=typeof module&&module.exports?module.exports=n:e.Promise||(e.Promise=n)}(this),"function"!=typeof window.CustomEvent&&function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}e.prototype=window.Event.prototype,window.CustomEvent=e}(),HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(e,t,n){for(var i=atob(this.toDataURL(t,n).split(",")[1]),o=i.length,r=new Uint8Array(o),a=0;a-1||e.indexOf("none")>-1?K.fromMatrix(e):K.fromString(e)},K.fromMatrix=function(e){var t=e.substring(7).split(",");return t.length&&"none"!==e||(t=[1,0,0,1,0,0]),new K(s(t[4]),s(t[5]),parseFloat(t[0]))},K.fromString=function(e){var t=e.split(") "),n=t[0].substring(O.globals.translate.length+1).split(","),i=t.length>1?t[1].substring(6):1,o=n.length>1?n[0]:0,r=n.length>1?n[1]:0;return new K(o,r,i)},K.prototype.toString=function(){var e=U[O.globals.translate].suffix||"";return O.globals.translate+"("+this.x+"px, "+this.y+"px"+e+") scale("+this.scale+")"};var $=function(e){if(!e||!e.style[N])return this.x=0,void(this.y=0);var t=e.style[N].split(" ");this.x=parseFloat(t[0]),this.y=parseFloat(t[1])};$.prototype.toString=function(){return this.x+"px "+this.y+"px"};var Q=function(e,t,n){var i;return function(){var o=this,r=arguments,a=n&&!i;clearTimeout(i),i=setTimeout(function(){i=null,n||e.apply(o,r)},t),a&&e.apply(o,r)}}(C,500),G={type:"canvas",format:"png",quality:1},J=["jpeg","webp","png"];if(window.jQuery){var V=window.jQuery;V.fn.croppie=function(e){if("string"===typeof e){var t=Array.prototype.slice.call(arguments,1),n=V(this).data("croppie");return"get"===e?n.get():"result"===e?n.result.apply(n,t):"bind"===e?n.bind.apply(n,t):this.each(function(){var n=V(this).data("croppie");if(n){var i=n[e];if(!V.isFunction(i))throw"Croppie "+e+" method not found";i.apply(n,t),"destroy"===e&&V(this).removeData("croppie")}})}return this.each(function(){var t=new O(this,e);t.$=V,V(this).data("croppie",t)})}}O.defaults={viewport:{width:100,height:100,type:"square"},boundary:{},orientationControls:{enabled:!0,leftClass:"",rightClass:""},resizeControls:{width:!0,height:!0},customClass:"",showZoomer:!0,enableZoom:!0,enableResize:!1,mouseWheelZoom:!0,enableExif:!1,enforceBoundary:!0,enableOrientation:!1,enableKeyMovement:!0,update:function(){}},O.globals={translate:"translate3d"},n(O.prototype,{bind:function(e,t){return X.call(this,e,t)},get:function(){var e=H.call(this),t=e.points;return this.options.relative&&(t[0]/=this.elements.img.naturalWidth/100,t[1]/=this.elements.img.naturalHeight/100,t[2]/=this.elements.img.naturalWidth/100,t[3]/=this.elements.img.naturalHeight/100),e},result:function(e){return k.call(this,e)},refresh:function(){return j.call(this)},setZoom:function(e){v.call(this,e),i(this.elements.zoomer)},rotate:function(e){A.call(this,e)},destroy:function(){return S.call(this)}}),e.Croppie=window.Croppie=O,"object"==typeof module&&module.exports&&(module.exports=O)}); \ No newline at end of file diff --git a/node_modules/croppie/package.json b/node_modules/croppie/package.json new file mode 100644 index 0000000..67cc001 --- /dev/null +++ b/node_modules/croppie/package.json @@ -0,0 +1,64 @@ +{ + "_from": "croppie", + "_id": "croppie@2.5.1", + "_inBundle": false, + "_integrity": "sha512-8QsuDg2/vGlNutBH2hcnxm4rZUpMe50HQFpU1q0MDetD1uT4qHHkS485e+u7wvCQflJjfBxBsWlQ9grGMOsmxg==", + "_location": "/croppie", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "croppie", + "name": "croppie", + "escapedName": "croppie", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/croppie/-/croppie-2.5.1.tgz", + "_shasum": "87896bb4fb219350106558791730ed275730f38e", + "_spec": "croppie", + "_where": "C:\\Users\\Tom\\Documents\\Development\\bitsy-image-to-room", + "authors": [ + "Dustin Smith ", + "Ethan Calvert " + ], + "bugs": { + "url": "https://github.com/Foliotek/Croppie/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "A simple javascript image cropper", + "devDependencies": { + "gh-pages": "^0.11.0", + "mocha": "2.4.5" + }, + "files": [ + "croppie.css", + "croppie.js", + "croppie.min.js" + ], + "homepage": "http://foliotek.github.io/Croppie", + "keywords": [ + "crop", + "cropper", + "image", + "cropping" + ], + "license": "MIT", + "main": "croppie.js", + "name": "croppie", + "repository": { + "type": "git", + "url": "git+https://github.com/Foliotek/Croppie.git" + }, + "scripts": { + "deploy": "node deploy.js", + "test": "mocha test/unit" + }, + "version": "2.5.1" +} diff --git a/node_modules/cryptiles/.npmignore b/node_modules/cryptiles/.npmignore new file mode 100644 index 0000000..77ba16c --- /dev/null +++ b/node_modules/cryptiles/.npmignore @@ -0,0 +1,18 @@ +.idea +*.iml +npm-debug.log +dump.rdb +node_modules +results.tap +results.xml +npm-shrinkwrap.json +config.json +.DS_Store +*/.DS_Store +*/*/.DS_Store +._* +*/._* +*/*/._* +coverage.* +lib-cov + diff --git a/node_modules/cryptiles/.travis.yml b/node_modules/cryptiles/.travis.yml new file mode 100644 index 0000000..dd1b24f --- /dev/null +++ b/node_modules/cryptiles/.travis.yml @@ -0,0 +1,8 @@ +language: node_js + +node_js: + - 0.10 + - 4.0 + +sudo: false + diff --git a/node_modules/cryptiles/LICENSE b/node_modules/cryptiles/LICENSE new file mode 100644 index 0000000..cda4473 --- /dev/null +++ b/node_modules/cryptiles/LICENSE @@ -0,0 +1,28 @@ +Copyright (c) 2014, Eran Hammer and other contributors. +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. + * The names of any contributors may not 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 HOLDERS AND 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. + + * * * + +The complete list of contributors can be found at: https://github.com/hueniverse/cryptiles/graphs/contributors diff --git a/node_modules/cryptiles/README.md b/node_modules/cryptiles/README.md new file mode 100644 index 0000000..4008305 --- /dev/null +++ b/node_modules/cryptiles/README.md @@ -0,0 +1,16 @@ +cryptiles +========= + +General purpose crypto utilities + +[![Build Status](https://secure.travis-ci.org/hapijs/cryptiles.png)](http://travis-ci.org/hapijs/cryptiles) + +Lead Maintainer - [C J Silverio](https://github.com/ceejbot) + +## Methods + +### `randomString( size)` +Returns a cryptographically strong pseudo-random data string. Takes a size argument for the length of the string. + +### `fixedTimeComparison( a, b)` +Compare two strings using fixed time algorithm (to prevent time-based analysis of MAC digest match). Returns `true` if the strings match, `false` if they differ. diff --git a/node_modules/cryptiles/lib/index.js b/node_modules/cryptiles/lib/index.js new file mode 100644 index 0000000..f385870 --- /dev/null +++ b/node_modules/cryptiles/lib/index.js @@ -0,0 +1,68 @@ +// Load modules + +var Crypto = require('crypto'); +var Boom = require('boom'); + + +// Declare internals + +var internals = {}; + + +// Generate a cryptographically strong pseudo-random data + +exports.randomString = function (size) { + + var buffer = exports.randomBits((size + 1) * 6); + if (buffer instanceof Error) { + return buffer; + } + + var string = buffer.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/\=/g, ''); + return string.slice(0, size); +}; + + +exports.randomBits = function (bits) { + + if (!bits || + bits < 0) { + + return Boom.internal('Invalid random bits count'); + } + + var bytes = Math.ceil(bits / 8); + try { + return Crypto.randomBytes(bytes); + } + catch (err) { + return Boom.internal('Failed generating random bits: ' + err.message); + } +}; + + +// Compare two strings using fixed time algorithm (to prevent time-based analysis of MAC digest match) + +exports.fixedTimeComparison = function (a, b) { + + if (typeof a !== 'string' || + typeof b !== 'string') { + + return false; + } + + var mismatch = (a.length === b.length ? 0 : 1); + if (mismatch) { + b = a; + } + + for (var i = 0, il = a.length; i < il; ++i) { + var ac = a.charCodeAt(i); + var bc = b.charCodeAt(i); + mismatch |= (ac ^ bc); + } + + return (mismatch === 0); +}; + + diff --git a/node_modules/cryptiles/package.json b/node_modules/cryptiles/package.json new file mode 100644 index 0000000..444419f --- /dev/null +++ b/node_modules/cryptiles/package.json @@ -0,0 +1,59 @@ +{ + "_from": "cryptiles@2.x.x", + "_id": "cryptiles@2.0.5", + "_inBundle": false, + "_integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "_location": "/cryptiles", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "cryptiles@2.x.x", + "name": "cryptiles", + "escapedName": "cryptiles", + "rawSpec": "2.x.x", + "saveSpec": null, + "fetchSpec": "2.x.x" + }, + "_requiredBy": [ + "/hawk" + ], + "_resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "_shasum": "3bdfecdc608147c1c67202fa291e7dca59eaa3b8", + "_spec": "cryptiles@2.x.x", + "_where": "C:\\Users\\Tom\\Documents\\Development\\bitsy-image-to-room\\node_modules\\hawk", + "bugs": { + "url": "https://github.com/hapijs/cryptiles/issues" + }, + "bundleDependencies": false, + "dependencies": { + "boom": "2.x.x" + }, + "deprecated": false, + "description": "General purpose crypto utilities", + "devDependencies": { + "code": "1.x.x", + "lab": "5.x.x" + }, + "engines": { + "node": ">=0.10.40" + }, + "homepage": "https://github.com/hapijs/cryptiles#readme", + "keywords": [ + "cryptography", + "security", + "utilites" + ], + "license": "BSD-3-Clause", + "main": "lib/index.js", + "name": "cryptiles", + "repository": { + "type": "git", + "url": "git://github.com/hapijs/cryptiles.git" + }, + "scripts": { + "test": "lab -a code -t 100 -L", + "test-cov-html": "lab -a code -r html -o coverage.html" + }, + "version": "2.0.5" +} diff --git a/node_modules/cryptiles/test/index.js b/node_modules/cryptiles/test/index.js new file mode 100644 index 0000000..170393f --- /dev/null +++ b/node_modules/cryptiles/test/index.js @@ -0,0 +1,102 @@ +// Load modules + +var Code = require('code'); +var Cryptiles = require('..'); +var Lab = require('lab'); + + +// Declare internals + +var internals = {}; + + +// Test shortcuts + +var lab = exports.lab = Lab.script(); +var describe = lab.describe; +var it = lab.it; +var expect = Code.expect; + + +describe('randomString()', function () { + + it('should generate the right length string', function (done) { + + for (var i = 1; i <= 1000; ++i) { + expect(Cryptiles.randomString(i).length).to.equal(i); + } + + done(); + }); + + it('returns an error on invalid bits size', function (done) { + + expect(Cryptiles.randomString(99999999999999999999).message).to.match(/Failed generating random bits/); + done(); + }); +}); + +describe('randomBits()', function () { + + it('returns an error on invalid input', function (done) { + + expect(Cryptiles.randomBits(0).message).to.equal('Invalid random bits count'); + done(); + }); +}); + +describe('fixedTimeComparison()', function () { + + var a = Cryptiles.randomString(50000); + var b = Cryptiles.randomString(150000); + + it('should take the same amount of time comparing different string sizes', function (done) { + + var now = Date.now(); + Cryptiles.fixedTimeComparison(b, a); + var t1 = Date.now() - now; + + now = Date.now(); + Cryptiles.fixedTimeComparison(b, b); + var t2 = Date.now() - now; + + expect(t2 - t1).to.be.within(-20, 20); + done(); + }); + + it('should return true for equal strings', function (done) { + + expect(Cryptiles.fixedTimeComparison(a, a)).to.equal(true); + done(); + }); + + it('should return false for different strings (size, a < b)', function (done) { + + expect(Cryptiles.fixedTimeComparison(a, a + 'x')).to.equal(false); + done(); + }); + + it('should return false for different strings (size, a > b)', function (done) { + + expect(Cryptiles.fixedTimeComparison(a + 'x', a)).to.equal(false); + done(); + }); + + it('should return false for different strings (size, a = b)', function (done) { + + expect(Cryptiles.fixedTimeComparison(a + 'x', a + 'y')).to.equal(false); + done(); + }); + + it('should return false when not a string', function (done) { + + expect(Cryptiles.fixedTimeComparison('x', null)).to.equal(false); + done(); + }); + + it('should return false when not a string (left)', function (done) { + + expect(Cryptiles.fixedTimeComparison(null, 'x')).to.equal(false); + done(); + }); +}); diff --git a/node_modules/dashdash/CHANGES.md b/node_modules/dashdash/CHANGES.md new file mode 100644 index 0000000..d7c8f4e --- /dev/null +++ b/node_modules/dashdash/CHANGES.md @@ -0,0 +1,364 @@ +# node-dashdash changelog + +## not yet released + +(nothing yet) + +## 1.14.1 + +- [issue #30] Change the output used by dashdash's Bash completion support to + indicate "there are no completions for this argument" to cope with different + sorting rules on different Bash/platforms. For example: + + $ triton -v -p test2 package get # before + ##-no -tritonpackage- completions-## + + $ triton -v -p test2 package get # after + ##-no-completion- -results-## + +## 1.14.0 + +- New `synopsisFromOpt(