From 2abf0fae0967342153ba6098d4af056d5873b538 Mon Sep 17 00:00:00 2001 From: Jeffrey Warren Date: Sun, 29 Apr 2018 12:16:11 -0400 Subject: [PATCH] Code cleanup, re-organizing and tidying (#226) * initial cleanup * build * additions and build --- dist/image-sequencer.js | 911 +++++++++--------- dist/image-sequencer.min.js | 2 +- examples/demo.js | 43 +- package.json | 2 +- src/ImageSequencer.js | 8 +- src/Modules.js | 10 +- src/ReplaceImage.js | 2 + src/modules/Blur/info.json | 4 +- src/modules/Brightness/info.json | 2 +- .../{GreenChannel => Channel}/Module.js | 9 +- src/modules/Channel/info.json | 12 + .../Colormap.js} | 16 +- .../{SegmentedColormap => Colormap}/Module.js | 4 +- .../{SegmentedColormap => Colormap}/info.json | 4 +- src/modules/Crop/info.json | 2 +- src/modules/GreenChannel/info.json | 6 - src/modules/{NdviRed => Ndvi}/Module.js | 6 +- src/modules/Ndvi/info.json | 12 + src/modules/NdviRed/info.json | 6 - src/modules/Saturation/Module.js | 2 +- src/modules/Saturation/info.json | 4 +- src/{ => ui}/LoadImage.js | 2 +- src/{ => ui}/UserInterface.js | 0 test/modules/chain.js | 8 +- test/modules/image-sequencer.js | 38 +- 25 files changed, 575 insertions(+), 540 deletions(-) rename src/modules/{GreenChannel => Channel}/Module.js (77%) create mode 100644 src/modules/Channel/info.json rename src/modules/{SegmentedColormap/SegmentedColormap.js => Colormap/Colormap.js} (90%) rename src/modules/{SegmentedColormap => Colormap}/Module.js (90%) rename src/modules/{SegmentedColormap => Colormap}/info.json (65%) delete mode 100644 src/modules/GreenChannel/info.json rename src/modules/{NdviRed => Ndvi}/Module.js (83%) create mode 100644 src/modules/Ndvi/info.json delete mode 100644 src/modules/NdviRed/info.json rename src/{ => ui}/LoadImage.js (96%) rename src/{ => ui}/UserInterface.js (100%) diff --git a/dist/image-sequencer.js b/dist/image-sequencer.js index 651b6022..e325a003 100755 --- a/dist/image-sequencer.js +++ b/dist/image-sequencer.js @@ -56159,7 +56159,6 @@ ImageSequencer = function ImageSequencer(options) { options = options || {}; options.inBrowser = options.inBrowser || isBrowser; - // if (options.inBrowser) options.ui = options.ui || require('./UserInterface'); options.sequencerCounter = 0; function objTypeOf(object){ @@ -56196,7 +56195,7 @@ ImageSequencer = function ImageSequencer(options) { formatInput = require('./FormatInput'), images = {}, inputlog = [], - events = require('./UserInterface')(), + events = require('./ui/UserInterface')(), fs = require('fs'); // if in browser, prompt for an image @@ -56299,7 +56298,6 @@ ImageSequencer = function ImageSequencer(options) { inputlog.push({method:"loadImages", json_q:copy(json_q)}); var loadedimages = this.copy(json_q.loadedimages); - // require('./LoadImage')(this,i,json_q.images[i]); var ret = { name: "ImageSequencer Wrapper", @@ -56319,7 +56317,7 @@ ImageSequencer = function ImageSequencer(options) { return; } var img = loadedimages[i]; - require('./LoadImage')(sequencer,img,json_q.images[img],function(){ + require('./ui/LoadImage')(sequencer,img,json_q.images[img],function(){ load(++i); }); } @@ -56334,7 +56332,7 @@ ImageSequencer = function ImageSequencer(options) { } function setUI(UI) { - this.events = require('./UserInterface')(UI); + this.events = require('./ui/UserInterface')(UI); } var exportBin = function(dir,basic) { @@ -56382,7 +56380,7 @@ ImageSequencer = function ImageSequencer(options) { } module.exports = ImageSequencer; -},{"./AddStep":133,"./ExportBin":134,"./FormatInput":135,"./InsertStep":137,"./LoadImage":138,"./Modules":139,"./ReplaceImage":140,"./Run":141,"./UserInterface":142,"fs":7,"jquery":56}],137:[function(require,module,exports){ +},{"./AddStep":133,"./ExportBin":134,"./FormatInput":135,"./InsertStep":137,"./Modules":138,"./ReplaceImage":139,"./Run":140,"./ui/LoadImage":170,"./ui/UserInterface":171,"fs":7,"jquery":56}],137:[function(require,module,exports){ // insert one or more steps at a given index in the sequencer function InsertStep(ref, image, index, name, o) { @@ -56418,119 +56416,12 @@ function InsertStep(ref, image, index, name, o) { module.exports = InsertStep; },{}],138:[function(require,module,exports){ -// special module to load an image into the start of the sequence; used in the HTML UI -function LoadImage(ref, name, src, main_callback) { - function makeImage(datauri) { - var image = { - src: datauri, - format: datauri.split(':')[1].split(';')[0].split('/')[1] - } - return image; - } - function CImage(src, callback) { - var datauri; - if (!!src.match(/^data:/i)) { - datauri = src; - callback(datauri); - } - else if (!ref.options.inBrowser && !!src.match(/^https?:\/\//i)) { - require( src.match(/^(https?):\/\//i)[1] ).get(src,function(res){ - var data = ''; - var contentType = res.headers['content-type']; - res.setEncoding('base64'); - res.on('data',function(chunk) {data += chunk;}); - res.on('end',function() { - callback("data:"+contentType+";base64,"+data); - }); - }); - } - else if (ref.options.inBrowser) { - var ext = src.split('.').pop(); - var image = document.createElement('img'); - var canvas = document.createElement('canvas'); - var context = canvas.getContext('2d'); - image.onload = function() { - canvas.width = image.naturalWidth; - canvas.height = image.naturalHeight; - context.drawImage(image,0,0); - datauri = canvas.toDataURL(ext); - callback(datauri); - } - image.src = src; - } - else { - datauri = require('urify')(src); - callback(datauri); - } - } - - function loadImage(name, src) { - var step = { - name: "load-image", - description: "This initial step loads and displays the original image without any modifications.", - ID: ref.options.sequencerCounter++, - imageName: name, - inBrowser: ref.options.inBrowser, - ui: ref.options.ui - }; - - var image = { - src: src, - steps: [{ - options: { - id: step.ID, - name: "load-image", - description: "This initial step loads and displays the original image without any modifications.", - title: "Load Image", - step: step - }, - UI: ref.events, - draw: function() { - UI.onDraw(options.step); - if(arguments.length==1){ - this.output = CImage(arguments[0]); - options.step.output = this.output; - UI.onComplete(options.step); - return true; - } - else if(arguments.length==2) { - this.output = CImage(arguments[0]); - options.step.output = this.output; - arguments[1](); - UI.onComplete(options.step); - return true; - } - return false; - }, - }] - }; - CImage(src, function(datauri) { - var output = makeImage(datauri); - ref.images[name] = image; - var loadImageStep = ref.images[name].steps[0]; - loadImageStep.output = output; - loadImageStep.options.step.output = loadImageStep.output.src; - loadImageStep.UI.onSetup(loadImageStep.options.step); - loadImageStep.UI.onDraw(loadImageStep.options.step); - loadImageStep.UI.onComplete(loadImageStep.options.step); - - main_callback(); - return true; - }); - } - - return loadImage(name,src); -} - -module.exports = LoadImage; - -},{"urify":128}],139:[function(require,module,exports){ /* * Core modules and their info files */ module.exports = { - 'green-channel': [ - require('./modules/GreenChannel/Module'),require('./modules/GreenChannel/info') + 'channel': [ + require('./modules/Channel/Module'),require('./modules/Channel/info') ], 'brightness': [ require('./modules/Brightness/Module'),require('./modules/Brightness/info') @@ -56538,8 +56429,8 @@ module.exports = { 'edge-detect':[ require('./modules/EdgeDetect/Module'),require('./modules/EdgeDetect/info') ], - 'ndvi-red': [ - require('./modules/NdviRed/Module'),require('./modules/NdviRed/info') + 'ndvi': [ + require('./modules/Ndvi/Module'),require('./modules/Ndvi/info') ], 'invert': [ require('./modules/Invert/Module'),require('./modules/Invert/info') @@ -56548,7 +56439,7 @@ module.exports = { require('./modules/Crop/Module'),require('./modules/Crop/info') ], 'segmented-colormap': [ - require('./modules/SegmentedColormap/Module'),require('./modules/SegmentedColormap/info') + require('./modules/Colormap/Module'),require('./modules/Colormap/info') ], 'decode-qr': [ require('./modules/DecodeQr/Module'),require('./modules/DecodeQr/info') @@ -56567,7 +56458,9 @@ module.exports = { ] } -},{"./modules/Blur/Module":144,"./modules/Blur/info":145,"./modules/Brightness/Module":146,"./modules/Brightness/info":147,"./modules/Crop/Module":149,"./modules/Crop/info":150,"./modules/DecodeQr/Module":151,"./modules/DecodeQr/info":152,"./modules/Dynamic/Module":153,"./modules/Dynamic/info":154,"./modules/EdgeDetect/Module":156,"./modules/EdgeDetect/info":157,"./modules/FisheyeGl/Module":158,"./modules/FisheyeGl/info":159,"./modules/GreenChannel/Module":160,"./modules/GreenChannel/info":161,"./modules/Invert/Module":162,"./modules/Invert/info":163,"./modules/NdviRed/Module":164,"./modules/NdviRed/info":165,"./modules/Saturation/Module":166,"./modules/Saturation/info":167,"./modules/SegmentedColormap/Module":168,"./modules/SegmentedColormap/info":170}],140:[function(require,module,exports){ +},{"./modules/Blur/Module":142,"./modules/Blur/info":143,"./modules/Brightness/Module":144,"./modules/Brightness/info":145,"./modules/Channel/Module":146,"./modules/Channel/info":147,"./modules/Colormap/Module":149,"./modules/Colormap/info":150,"./modules/Crop/Module":152,"./modules/Crop/info":153,"./modules/DecodeQr/Module":154,"./modules/DecodeQr/info":155,"./modules/Dynamic/Module":156,"./modules/Dynamic/info":157,"./modules/EdgeDetect/Module":159,"./modules/EdgeDetect/info":160,"./modules/FisheyeGl/Module":161,"./modules/FisheyeGl/info":162,"./modules/Invert/Module":163,"./modules/Invert/info":164,"./modules/Ndvi/Module":165,"./modules/Ndvi/info":166,"./modules/Saturation/Module":167,"./modules/Saturation/info":168}],139:[function(require,module,exports){ +// Uses a given image as input and replaces it with the output. +// Works only in the browser. function ReplaceImage(ref,selector,steps,options) { if(!ref.options.inBrowser) return false; // This isn't for Node.js var tempSequencer = ImageSequencer({ui: false}); @@ -56614,7 +56507,7 @@ function ReplaceImage(ref,selector,steps,options) { module.exports = ReplaceImage; -},{}],141:[function(require,module,exports){ +},{}],140:[function(require,module,exports){ function Run(ref, json_q, callback,progressObj) { if(!progressObj) progressObj = {stop: function(){}} @@ -56672,75 +56565,7 @@ function Run(ref, json_q, callback,progressObj) { } module.exports = Run; -},{}],142:[function(require,module,exports){ -/* - * User Interface Handling Module - */ - -module.exports = function UserInterface(events = {}) { - - events.onSetup = events.onSetup || function(step) { - if(step.ui == false) { - // No UI - } - else if(step.inBrowser) { - // Create and append an HTML Element - console.log("Added Step \""+step.name+"\" to \""+step.imageName+"\"."); - } - else { - // Create a NodeJS Object - console.log('\x1b[36m%s\x1b[0m',"Added Step \""+step.name+"\" to \""+step.imageName+"\"."); - } - } - - events.onDraw = events.onDraw || function(step) { - if (step.ui == false) { - // No UI - } - else if(step.inBrowser) { - // Overlay a loading spinner - console.log("Drawing Step \""+step.name+"\" on \""+step.imageName+"\"."); - } - else { - // Don't do anything - console.log('\x1b[33m%s\x1b[0m',"Drawing Step \""+step.name+"\" on \""+step.imageName+"\"."); - } - } - - events.onComplete = events.onComplete || function(step) { - if (step.ui == false) { - // No UI - } - else if(step.inBrowser) { - // Update the DIV Element - // Hide the laoding spinner - console.log("Drawn Step \""+step.name+"\" on \""+step.imageName+"\"."); - } - else { - // Update the NodeJS Object - console.log('\x1b[32m%s\x1b[0m',"Drawn Step \""+step.name+"\" on \""+step.imageName+"\"."); - } - } - - events.onRemove = events.onRemove || function(step) { - if(step.ui == false){ - // No UI - } - else if(step.inBrowser) { - // Remove the DIV Element - console.log("Removing Step \""+step.name+"\" of \""+step.imageName+"\"."); - } - else { - // Delete the NodeJS Object - console.log('\x1b[31m%s\x1b[0m',"Removing Step \""+step.name+"\" of \""+step.imageName+"\"."); - } - } - - return events; - -} - -},{}],143:[function(require,module,exports){ +},{}],141:[function(require,module,exports){ module.exports = exports = function(pixels,blur){ let kernel = kernelGenerator(blur,1) kernel = flipKernel(kernel) @@ -56826,7 +56651,7 @@ function flipKernel(kernel){ return result } } -},{}],144:[function(require,module,exports){ +},{}],142:[function(require,module,exports){ /* * Blur an Image */ @@ -56887,10 +56712,10 @@ module.exports = function Blur(options,UI){ } } -},{"../_nomodule/PixelManipulation.js":171,"./Blur":143}],145:[function(require,module,exports){ +},{"../_nomodule/PixelManipulation.js":169,"./Blur":141}],143:[function(require,module,exports){ module.exports={ - "name": "blur", - "description": "Blur an image by a given value", + "name": "Blur", + "description": "Gaussian blur an image by a given value, typically 0-5", "inputs": { "blur": { "type": "integer", @@ -56900,7 +56725,7 @@ module.exports={ } } -},{}],146:[function(require,module,exports){ +},{}],144:[function(require,module,exports){ /* * Changes the Image Brightness */ @@ -56967,10 +56792,10 @@ module.exports = function Brightness(options,UI){ } } -},{"../_nomodule/PixelManipulation.js":171}],147:[function(require,module,exports){ +},{"../_nomodule/PixelManipulation.js":169}],145:[function(require,module,exports){ module.exports={ "name": "Brightness", - "description": "Change the brightness of the image by given value", + "description": "Change the brightness of the image by given percent value", "inputs": { "brightness": { "type": "integer", @@ -56980,7 +56805,240 @@ module.exports={ } } +},{}],146:[function(require,module,exports){ +/* + * Display only one color channel + */ +module.exports = function Channel(options,UI) { + + options = options || {}; + options.channel = options.channel || "green"; + + // Tell UI that a step has been set up + UI.onSetup(options.step); + var output; + + function draw(input,callback,progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + // Tell UI that a step is being drawn + UI.onDraw(options.step); + var step = this; + + function changePixel(r, g, b, a) { + if (options.channel == "red") return [r, 0, 0, a]; + if (options.channel == "green") return [0, g, 0, a]; + if (options.channel == "blue") return [0, 0, b, a]; + } + + function output(image,datauri,mimetype){ + + // This output is accesible by Image Sequencer + step.output = {src:datauri,format:mimetype}; + + // This output is accessible by UI + options.step.output = datauri; + + // Tell UI that step ahs been drawn + UI.onComplete(options.step); + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + + } + + return { + options: options, + //setup: setup, // optional + draw: draw, + output: output, + UI: UI + } +} + +},{"../_nomodule/PixelManipulation.js":169}],147:[function(require,module,exports){ +module.exports={ + "name": "Channel", + "description": "Displays only one color channel of an image -- default is green", + "inputs": { + "channel": { + "type": "select", + "desc": "Color channel", + "default": "green", + "values": ["red", "green", "blue"] + } + } +} + },{}],148:[function(require,module,exports){ +/* + * Accepts a value from 0-255 and returns the new color-mapped pixel + * from a lookup table, which can be specified as an array of [begin, end] + * gradients, where begin and end are represented as [r, g, b] colors. In + * combination, a lookup table which maps values from 0 - 255 smoothly from black to white looks like: + * [ + * [0, [0, 0, 0], [255, 255, 255]], + * [1, [255, 255, 255], [255, 255, 255]] + * ] + * + * Adapted from bgamari's work in Infragram: https://github.com/p-v-o-s/infragram-js/commit/346c97576a07b71a55671d17e0153b7df74e803b + */ + +module.exports = function Colormap(value, options) { + options.colormap = options.colormap || colormaps.default; + // if a lookup table is provided as an array: + if(typeof(options.colormap) == "object") + colormapFunction = colormap(options.colormap); + // if a stored colormap is named with a string like "fastie": + else if(colormaps.hasOwnProperty(options.colormap)) + colormapFunction = colormaps[options.colormap]; + else colormapFunction = colormaps.default; + return colormapFunction(value / 255.00); +} + +function colormap(segments) { + return function(x) { + var i, result, x0, x1, xstart, y0, y1, _i, _j, _len, _ref, _ref1, _ref2, _ref3; + _ref = [0, 0], y0 = _ref[0], y1 = _ref[1]; + _ref1 = [segments[0][0], 1], x0 = _ref1[0], x1 = _ref1[1]; + if (x < x0) { + return y0; + } + for (i = _i = 0, _len = segments.length; _i < _len; i = ++_i) { + _ref2 = segments[i], xstart = _ref2[0], y0 = _ref2[1], y1 = _ref2[2]; + x0 = xstart; + if (i === segments.length - 1) { + x1 = 1; + break; + } + x1 = segments[i + 1][0]; + if ((xstart <= x && x < x1)) { + break; + } + } + result = []; + for (i = _j = 0, _ref3 = y0.length; 0 <= _ref3 ? _j < _ref3 : _j > _ref3; i = 0 <= _ref3 ? ++_j : --_j) { + result[i] = (x - x0) / (x1 - x0) * (y1[i] - y0[i]) + y0[i]; + } + return result; + }; +}; + +var colormaps = { + greyscale: colormap([ + [0, [0, 0, 0], [255, 255, 255] ], + [1, [255, 255, 255], [255, 255, 255] ] + ]), + default: colormap([ + [0, [0, 0, 255], [0, 255, 0] ], + [0.25, [0, 255, 0], [255, 255, 0] ], + [0.50, [0, 255, 255], [255, 255, 0] ], + [0.75, [255, 255, 0], [255, 0, 0] ] + ]), + ndvi: colormap([ + [0, [0, 0, 255], [38, 195, 195] ], + [0.5, [0, 150, 0], [255, 255, 0] ], + [0.75, [255, 255, 0], [255, 50, 50] ] + ]), + stretched: colormap([ + [0, [0, 0, 255], [0, 0, 255] ], + [0.1, [0, 0, 255], [38, 195, 195] ], + [0.5, [0, 150, 0], [255, 255, 0] ], + [0.7, [255, 255, 0], [255, 50, 50] ], + [0.9, [255, 50, 50], [255, 50, 50] ] + ]), + fastie: colormap([ + [0, [255, 255, 255], [0, 0, 0] ], + [0.167, [0, 0, 0], [255, 255, 255] ], + [0.33, [255, 255, 255], [0, 0, 0] ], + [0.5, [0, 0, 0], [140, 140, 255] ], + [0.55, [140, 140, 255], [0, 255, 0] ], + [0.63, [0, 255, 0], [255, 255, 0] ], + [0.75, [255, 255, 0], [255, 0, 0] ], + [0.95, [255, 0, 0], [255, 0, 255] ] + ]) +} + +},{}],149:[function(require,module,exports){ +module.exports = function Colormap(options,UI) { + + options = options || {}; + + // Tell the UI that a step has been set up. + UI.onSetup(options.step); + var output; + + // This function is called on every draw. + function draw(input,callback,progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + // Tell the UI that the step is being drawn + UI.onDraw(options.step); + var step = this; + + function changePixel(r, g, b, a) { + var combined = (r + g + b) / 3.000; + var res = require('./Colormap')(combined, options); + return [res[0], res[1], res[2], 255]; + } + + function output(image,datauri,mimetype){ + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + // This output is accessible by the UI + options.step.output = datauri; + + // Tell the UI that the draw is complete + UI.onComplete(options.step); + + } + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} + +},{"../_nomodule/PixelManipulation.js":169,"./Colormap":148}],150:[function(require,module,exports){ +module.exports={ + "name": "Colormap", + "description": "Maps brightness values (average of red, green & blue) to a given color lookup table, made up of a set of one more color gradients.\n\nFor example, 'cooler' colors like blue could represent low values, while 'hot' colors like red could represent high values.", + "inputs": { + "colormap": { + "type": "select", + "desc": "Name of the Colormap", + "default": "default", + "values": ["default","greyscale","stretched","fastie"] + } + } +} + +},{}],151:[function(require,module,exports){ (function (Buffer){ module.exports = function Crop(input,options,callback) { @@ -57026,7 +57084,7 @@ module.exports = function Crop(input,options,callback) { }; }).call(this,require("buffer").Buffer) -},{"buffer":8,"get-pixels":38,"save-pixels":121}],149:[function(require,module,exports){ +},{"buffer":8,"get-pixels":38,"save-pixels":121}],152:[function(require,module,exports){ /* * Image Cropping module * Usage: @@ -57087,10 +57145,10 @@ module.exports = function Crop(input,options,callback) { } } -},{"./Crop":148}],150:[function(require,module,exports){ +},{"./Crop":151}],153:[function(require,module,exports){ module.exports={ "name": "Crop", - "description": "Crop image to given x, y, w, h", + "description": "Crop image to given x, y, w, h in pixels, measured from top left", "url": "https://github.com/publiclab/image-sequencer/tree/master/MODULES.md", "inputs": { "x": { @@ -57116,7 +57174,7 @@ module.exports={ } } -},{}],151:[function(require,module,exports){ +},{}],154:[function(require,module,exports){ /* * Decodes QR from a given image. */ @@ -57171,7 +57229,7 @@ module.exports = function DoNothing(options,UI) { } } -},{"get-pixels":38,"jsqr":57}],152:[function(require,module,exports){ +},{"get-pixels":38,"jsqr":57}],155:[function(require,module,exports){ module.exports={ "name": "Decode QR", "description": "Search for and decode a QR code in the image", @@ -57184,7 +57242,7 @@ module.exports={ } } -},{}],153:[function(require,module,exports){ +},{}],156:[function(require,module,exports){ module.exports = function Dynamic(options,UI) { options = options || {}; @@ -57281,7 +57339,7 @@ module.exports = function Dynamic(options,UI) { } } -},{"../_nomodule/PixelManipulation.js":171}],154:[function(require,module,exports){ +},{"../_nomodule/PixelManipulation.js":169}],157:[function(require,module,exports){ module.exports={ "name": "Dynamic", "description": "A module which accepts JavaScript math expressions to produce each color channel based on the original image's color. See Infragrammar.", @@ -57309,7 +57367,7 @@ module.exports={ } } -},{}],155:[function(require,module,exports){ +},{}],158:[function(require,module,exports){ const _ = require('lodash') //define kernels for the sobel filter @@ -57490,7 +57548,7 @@ function hysteresis(pixels){ -},{"lodash":58}],156:[function(require,module,exports){ +},{"lodash":58}],159:[function(require,module,exports){ /* * Detect Edges in an Image */ @@ -57559,7 +57617,7 @@ module.exports = function edgeDetect(options,UI) { } } -},{"../_nomodule/PixelManipulation.js":171,"./EdgeUtils":155,"ndarray-gaussian-filter":63}],157:[function(require,module,exports){ +},{"../_nomodule/PixelManipulation.js":169,"./EdgeUtils":158,"ndarray-gaussian-filter":63}],160:[function(require,module,exports){ module.exports={ "name": "Detect Edges", "description": "this module detects edges using the Canny method, which first Gaussian blurs the image to reduce noise (amount of blur configurable in settings as `options.blur`), then applies a number of steps to highlight edges, resulting in a greyscale image where the brighter the pixel, the stronger the detected edge. Read more at: https://en.wikipedia.org/wiki/Canny_edge_detector", @@ -57582,7 +57640,7 @@ module.exports={ } } -},{}],158:[function(require,module,exports){ +},{}],161:[function(require,module,exports){ /* * Resolves Fisheye Effect */ @@ -57664,7 +57722,7 @@ module.exports = function DoNothing(options,UI) { } } -},{"fisheyegl":30}],159:[function(require,module,exports){ +},{"fisheyegl":30}],162:[function(require,module,exports){ module.exports={ "name": "Fisheye GL", "description": "Correct fisheye, or barrel distortion, in images (with WebGL -- adapted from fisheye-correction-webgl by @bluemir).", @@ -57732,72 +57790,7 @@ module.exports={ } } -},{}],160:[function(require,module,exports){ -/* - * Display only the green channel - */ -module.exports = function GreenChannel(options,UI) { - - options = options || {}; - - // Tell UI that a step has been set up - UI.onSetup(options.step); - var output; - - function draw(input,callback,progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - // Tell UI that a step is being drawn - UI.onDraw(options.step); - var step = this; - - function changePixel(r, g, b, a) { - return [0, g, 0, a]; - } - - function output(image,datauri,mimetype){ - - // This output is accesible by Image Sequencer - step.output = {src:datauri,format:mimetype}; - - // This output is accessible by UI - options.step.output = datauri; - - // Tell UI that step ahs been drawn - UI.onComplete(options.step); - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - - } - - return { - options: options, - //setup: setup, // optional - draw: draw, - output: output, - UI: UI - } -} - -},{"../_nomodule/PixelManipulation.js":171}],161:[function(require,module,exports){ -module.exports={ - "name": "Green Channel", - "description": "Displays only the green channel of an image", - "inputs": { - } -} - -},{}],162:[function(require,module,exports){ +},{}],163:[function(require,module,exports){ /* * Invert the image */ @@ -57854,7 +57847,7 @@ module.exports = function Invert(options,UI) { } } -},{"../_nomodule/PixelManipulation.js":171}],163:[function(require,module,exports){ +},{"../_nomodule/PixelManipulation.js":169}],164:[function(require,module,exports){ module.exports={ "name": "Invert", "description": "Inverts the image.", @@ -57862,13 +57855,14 @@ module.exports={ } } -},{}],164:[function(require,module,exports){ +},{}],165:[function(require,module,exports){ /* * NDVI with red filter (blue channel is infrared) */ -module.exports = function NdviRed(options,UI) { +module.exports = function Ndvi(options,UI) { options = options || {}; + options.filter = options.filter || "red"; // Tell the UI that a step has been set up. UI.onSetup(options.step); @@ -57885,7 +57879,8 @@ module.exports = function NdviRed(options,UI) { var step = this; function changePixel(r, g, b, a) { - var ndvi = (b - r) / (1.00 * b + r); + if (options.filter == "red") var ndvi = (b - r) / (1.00 * b + r); + if (options.filter == "blue") var ndvi = (r - b) / (1.00 * b + r); var x = 255 * (ndvi + 1) / 2; return [x, x, x, a]; } @@ -57921,17 +57916,23 @@ module.exports = function NdviRed(options,UI) { } } -},{"../_nomodule/PixelManipulation.js":171}],165:[function(require,module,exports){ +},{"../_nomodule/PixelManipulation.js":169}],166:[function(require,module,exports){ module.exports={ - "name": "NDVI for red filters", - "description": "Normalized Difference Vegetation Index, or NDVI, is an image analysis technique used with aerial photography. It's a way to visualize the amounts of infrared and other wavelengths of light reflected from vegetation. Because both these methods compare ratios of blue and red light absorbed versus green and IR light reflected, they can be used to evaluate the health of vegetation. It's a snapshot of how much photosynthesis is happening. This is helpful in assessing vegetative health or stress. Read more.

This is designed for use with red-filtered single camera DIY Infragram cameras.", + "name": "NDVI", + "description": "Normalized Difference Vegetation Index, or NDVI, is an image analysis technique used with aerial photography. It's a way to visualize the amounts of infrared and other wavelengths of light reflected from vegetation by comparing ratios of blue and red light absorbed versus green and IR light reflected. NDVI is used to evaluate the health of vegetation in satellite imagery, where it correlates with how much photosynthesis is happening. This is helpful in assessing vegetative health or stress. Read more.

This is designed for use with red-filtered single camera DIY Infragram cameras; change to 'blue' for blue filters", "inputs": { + "filter": { + "type": "select", + "desc": "Filter color", + "default": "red", + "values": ["red", "blue"] + } } } -},{}],166:[function(require,module,exports){ +},{}],167:[function(require,module,exports){ /* - * Saturate an image + * Saturate an image with a value from 0 to 1 */ module.exports = function Saturation(options,UI) { @@ -57998,179 +57999,20 @@ module.exports = function Saturation(options,UI) { } } -},{"../_nomodule/PixelManipulation.js":171}],167:[function(require,module,exports){ +},{"../_nomodule/PixelManipulation.js":169}],168:[function(require,module,exports){ module.exports={ "name": "Saturation", - "description": "Change the saturation of the image by given value", + "description": "Change the saturation of the image by given value, from 0-1, with 1 being 100% saturated.", "inputs": { "saturation": { "type": "integer", - "desc": "saturation for the new image between 0 and 2, 0 being black and white and 2 being fully saturated", + "desc": "saturation for the new image between 0 and 2, 0 being black and white and 2 being highly saturated", "default": 0 } } } -},{}],168:[function(require,module,exports){ -module.exports = function SegmentedColormap(options,UI) { - - options = options || {}; - - // Tell the UI that a step has been set up. - UI.onSetup(options.step); - var output; - - // This function is called on every draw. - function draw(input,callback,progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - // Tell the UI that the step is being drawn - UI.onDraw(options.step); - var step = this; - - function changePixel(r, g, b, a) { - var combined = (r + g + b) / 3.000; - var res = require('./SegmentedColormap')(combined, options); - return [res[0], res[1], res[2], 255]; - } - - function output(image,datauri,mimetype){ - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - // This output is accessible by the UI - options.step.output = datauri; - - // Tell the UI that the draw is complete - UI.onComplete(options.step); - - } - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} - -},{"../_nomodule/PixelManipulation.js":171,"./SegmentedColormap":169}],169:[function(require,module,exports){ -/* - * Accepts a value from 0-255 and returns the new color-mapped pixel - * from a lookup table, which can be specified as an array of [begin, end] - * gradients, where begin and end are represented as [r, g, b] colors. In - * combination, a lookup table which maps values from 0 - 255 smoothly from black to white looks like: - * [ - * [0, [0, 0, 0], [255, 255, 255]], - * [1, [255, 255, 255], [255, 255, 255]] - * ] - * - * Adapted from bgamari's work in Infragram: https://github.com/p-v-o-s/infragram-js/commit/346c97576a07b71a55671d17e0153b7df74e803b - */ - -module.exports = function SegmentedColormap(value, options) { - options.colormap = options.colormap || colormaps.default; - // if a lookup table is provided as an array: - if(typeof(options.colormap) == "object") - colormapFunction = segmented_colormap(options.colormap); - // if a stored colormap is named with a string like "fastie": - else if(colormaps.hasOwnProperty(options.colormap)) - colormapFunction = colormaps[options.colormap]; - else colormapFunction = colormaps.default; - return colormapFunction(value / 255.00); -} - -function segmented_colormap(segments) { - return function(x) { - var i, result, x0, x1, xstart, y0, y1, _i, _j, _len, _ref, _ref1, _ref2, _ref3; - _ref = [0, 0], y0 = _ref[0], y1 = _ref[1]; - _ref1 = [segments[0][0], 1], x0 = _ref1[0], x1 = _ref1[1]; - if (x < x0) { - return y0; - } - for (i = _i = 0, _len = segments.length; _i < _len; i = ++_i) { - _ref2 = segments[i], xstart = _ref2[0], y0 = _ref2[1], y1 = _ref2[2]; - x0 = xstart; - if (i === segments.length - 1) { - x1 = 1; - break; - } - x1 = segments[i + 1][0]; - if ((xstart <= x && x < x1)) { - break; - } - } - result = []; - for (i = _j = 0, _ref3 = y0.length; 0 <= _ref3 ? _j < _ref3 : _j > _ref3; i = 0 <= _ref3 ? ++_j : --_j) { - result[i] = (x - x0) / (x1 - x0) * (y1[i] - y0[i]) + y0[i]; - } - return result; - }; -}; - -var colormaps = { - greyscale: segmented_colormap([ - [0, [0, 0, 0], [255, 255, 255] ], - [1, [255, 255, 255], [255, 255, 255] ] - ]), - default: segmented_colormap([ - [0, [0, 0, 255], [0, 255, 0] ], - [0.25, [0, 255, 0], [255, 255, 0] ], - [0.50, [0, 255, 255], [255, 255, 0] ], - [0.75, [255, 255, 0], [255, 0, 0] ] - ]), - ndvi: segmented_colormap([ - [0, [0, 0, 255], [38, 195, 195] ], - [0.5, [0, 150, 0], [255, 255, 0] ], - [0.75, [255, 255, 0], [255, 50, 50] ] - ]), - stretched: segmented_colormap([ - [0, [0, 0, 255], [0, 0, 255] ], - [0.1, [0, 0, 255], [38, 195, 195] ], - [0.5, [0, 150, 0], [255, 255, 0] ], - [0.7, [255, 255, 0], [255, 50, 50] ], - [0.9, [255, 50, 50], [255, 50, 50] ] - ]), - fastie: segmented_colormap([ - [0, [255, 255, 255], [0, 0, 0] ], - [0.167, [0, 0, 0], [255, 255, 255] ], - [0.33, [255, 255, 255], [0, 0, 0] ], - [0.5, [0, 0, 0], [140, 140, 255] ], - [0.55, [140, 140, 255], [0, 255, 0] ], - [0.63, [0, 255, 0], [255, 255, 0] ], - [0.75, [255, 255, 0], [255, 0, 0] ], - [0.95, [255, 0, 0], [255, 0, 255] ] - ]) -} - -},{}],170:[function(require,module,exports){ -module.exports={ - "name": "Segmented Colormap", - "description": "Maps brightness values (average of red, green & blue) to a given color lookup table, made up of a set of one more color gradients.", - "inputs": { - "colormap": { - "type": "select", - "desc": "Name of the Colormap", - "default": "default", - "values": ["default","greyscale","stretched","fastie"] - } - } -} - -},{}],171:[function(require,module,exports){ +},{}],169:[function(require,module,exports){ (function (Buffer){ /* * General purpose per-pixel manipulation @@ -58259,4 +58101,179 @@ module.exports = function PixelManipulation(image, options) { }; }).call(this,require("buffer").Buffer) -},{"buffer":8,"get-pixels":38,"pace":70,"save-pixels":121}]},{},[136]); +},{"buffer":8,"get-pixels":38,"pace":70,"save-pixels":121}],170:[function(require,module,exports){ +// special module to load an image into the start of the sequence; used in the HTML UI +function LoadImage(ref, name, src, main_callback) { + function makeImage(datauri) { + var image = { + src: datauri, + format: datauri.split(':')[1].split(';')[0].split('/')[1] + } + return image; + } + function CImage(src, callback) { + var datauri; + if (!!src.match(/^data:/i)) { + datauri = src; + callback(datauri); + } + else if (!ref.options.inBrowser && !!src.match(/^https?:\/\//i)) { + require( src.match(/^(https?):\/\//i)[1] ).get(src,function(res){ + var data = ''; + var contentType = res.headers['content-type']; + res.setEncoding('base64'); + res.on('data',function(chunk) {data += chunk;}); + res.on('end',function() { + callback("data:"+contentType+";base64,"+data); + }); + }); + } + else if (ref.options.inBrowser) { + var ext = src.split('.').pop(); + var image = document.createElement('img'); + var canvas = document.createElement('canvas'); + var context = canvas.getContext('2d'); + image.onload = function() { + canvas.width = image.naturalWidth; + canvas.height = image.naturalHeight; + context.drawImage(image,0,0); + datauri = canvas.toDataURL(ext); + callback(datauri); + } + image.src = src; + } + else { + datauri = require('urify')(src); + callback(datauri); + } + } + + function loadImage(name, src) { + var step = { + name: "load-image", + description: "This initial step loads and displays the original image without any modifications.

To work with a new or different image, drag one into the drop zone.", + ID: ref.options.sequencerCounter++, + imageName: name, + inBrowser: ref.options.inBrowser, + ui: ref.options.ui + }; + + var image = { + src: src, + steps: [{ + options: { + id: step.ID, + name: "load-image", + description: "This initial step loads and displays the original image without any modifications.", + title: "Load Image", + step: step + }, + UI: ref.events, + draw: function() { + UI.onDraw(options.step); + if(arguments.length==1){ + this.output = CImage(arguments[0]); + options.step.output = this.output; + UI.onComplete(options.step); + return true; + } + else if(arguments.length==2) { + this.output = CImage(arguments[0]); + options.step.output = this.output; + arguments[1](); + UI.onComplete(options.step); + return true; + } + return false; + }, + }] + }; + CImage(src, function(datauri) { + var output = makeImage(datauri); + ref.images[name] = image; + var loadImageStep = ref.images[name].steps[0]; + loadImageStep.output = output; + loadImageStep.options.step.output = loadImageStep.output.src; + loadImageStep.UI.onSetup(loadImageStep.options.step); + loadImageStep.UI.onDraw(loadImageStep.options.step); + loadImageStep.UI.onComplete(loadImageStep.options.step); + + main_callback(); + return true; + }); + } + + return loadImage(name,src); +} + +module.exports = LoadImage; + +},{"urify":128}],171:[function(require,module,exports){ +/* + * User Interface Handling Module + */ + +module.exports = function UserInterface(events = {}) { + + events.onSetup = events.onSetup || function(step) { + if(step.ui == false) { + // No UI + } + else if(step.inBrowser) { + // Create and append an HTML Element + console.log("Added Step \""+step.name+"\" to \""+step.imageName+"\"."); + } + else { + // Create a NodeJS Object + console.log('\x1b[36m%s\x1b[0m',"Added Step \""+step.name+"\" to \""+step.imageName+"\"."); + } + } + + events.onDraw = events.onDraw || function(step) { + if (step.ui == false) { + // No UI + } + else if(step.inBrowser) { + // Overlay a loading spinner + console.log("Drawing Step \""+step.name+"\" on \""+step.imageName+"\"."); + } + else { + // Don't do anything + console.log('\x1b[33m%s\x1b[0m',"Drawing Step \""+step.name+"\" on \""+step.imageName+"\"."); + } + } + + events.onComplete = events.onComplete || function(step) { + if (step.ui == false) { + // No UI + } + else if(step.inBrowser) { + // Update the DIV Element + // Hide the laoding spinner + console.log("Drawn Step \""+step.name+"\" on \""+step.imageName+"\"."); + } + else { + // Update the NodeJS Object + console.log('\x1b[32m%s\x1b[0m',"Drawn Step \""+step.name+"\" on \""+step.imageName+"\"."); + } + } + + events.onRemove = events.onRemove || function(step) { + if(step.ui == false){ + // No UI + } + else if(step.inBrowser) { + // Remove the DIV Element + console.log("Removing Step \""+step.name+"\" of \""+step.imageName+"\"."); + } + else { + // Delete the NodeJS Object + console.log('\x1b[31m%s\x1b[0m',"Removing Step \""+step.name+"\" of \""+step.imageName+"\"."); + } + } + + return events; + +} + +},{}]},{},[136]); diff --git a/dist/image-sequencer.min.js b/dist/image-sequencer.min.js index 52ac6738..058d6766 100644 --- a/dist/image-sequencer.min.js +++ b/dist/image-sequencer.min.js @@ -1 +1 @@ -!function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){var u="function"==typeof require&&require;if(!s&&u)return u(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,function(e){var n=t[o][1][e];return i(n||e)},c,c.exports,e,t,n,r)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o=0;s--)if(u[s]!=l[s])return!1;for(s=u.length-1;s>=0;s--)if(o=u[s],!f(e[o],t[o]))return!1;return!0}(e,t):e==t}function h(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function p(e,t){return!(!e||!t)&&("[object RegExp]"==Object.prototype.toString.call(t)?t.test(e):e instanceof t||!0===t.call({},e))}function d(e,t,n,i){var a;r.isString(n)&&(i=n,n=null);try{t()}catch(e){a=e}if(i=(n&&n.name?" ("+n.name+").":".")+(i?" "+i:"."),e&&!a&&l(a,n,"Missing expected exception"+i),!e&&p(a,n)&&l(a,n,"Got unwanted exception"+i),e&&a&&n&&!p(a,n)||!e&&a)throw a}o.AssertionError=function(e){var t;this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=(t=this,u(JSON.stringify(t.actual,s),128)+" "+t.operator+" "+u(JSON.stringify(t.expected,s),128)),this.generatedMessage=!0);var n=e.stackStartFunction||l;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var i=r.stack,a=n.name,o=i.indexOf("\n"+a);if(o>=0){var c=i.indexOf("\n",o+1);i=i.substring(c+1)}this.stack=i}}},r.inherits(o.AssertionError,Error),o.fail=l,o.ok=c,o.equal=function(e,t,n){e!=t&&l(e,t,n,"==",o.equal)},o.notEqual=function(e,t,n){e==t&&l(e,t,n,"!=",o.notEqual)},o.deepEqual=function(e,t,n){f(e,t)||l(e,t,n,"deepEqual",o.deepEqual)},o.notDeepEqual=function(e,t,n){f(e,t)&&l(e,t,n,"notDeepEqual",o.notDeepEqual)},o.strictEqual=function(e,t,n){e!==t&&l(e,t,n,"===",o.strictEqual)},o.notStrictEqual=function(e,t,n){e===t&&l(e,t,n,"!==",o.notStrictEqual)},o.throws=function(e,t,n){d.apply(this,[!0].concat(i.call(arguments)))},o.doesNotThrow=function(e,t){d.apply(this,[!1].concat(i.call(arguments)))},o.ifError=function(e){if(e)throw e};var g=Object.keys||function(e){var t=[];for(var n in e)a.call(e,n)&&t.push(n);return t}},{"util/":132}],2:[function(e,t,n){"use strict";n.byteLength=function(e){return 3*e.length/4-l(e)},n.toByteArray=function(e){var t,n,r,o,s,u,c=e.length;s=l(e),u=new a(3*c/4-s),r=s>0?c-4:c;var f=0;for(t=0,n=0;t>16&255,u[f++]=o>>8&255,u[f++]=255&o;2===s?(o=i[e.charCodeAt(t)]<<2|i[e.charCodeAt(t+1)]>>4,u[f++]=255&o):1===s&&(o=i[e.charCodeAt(t)]<<10|i[e.charCodeAt(t+1)]<<4|i[e.charCodeAt(t+2)]>>2,u[f++]=o>>8&255,u[f++]=255&o);return u},n.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a="",o=[],s=0,u=n-i;su?u:s+16383));1===i?(t=e[n-1],a+=r[t>>2],a+=r[t<<4&63],a+="=="):2===i&&(t=(e[n-2]<<8)+e[n-1],a+=r[t>>10],a+=r[t>>4&63],a+=r[t<<2&63],a+="=");return o.push(a),o.join("")};for(var r=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function c(e,t,n){for(var i,a,o=[],s=t;s>18&63]+r[a>>12&63]+r[a>>6&63]+r[63&a]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],3:[function(e,t,n){"use strict";"use restrict";function r(e){var t=32;return(e&=-e)&&t--,65535&e&&(t-=16),16711935&e&&(t-=8),252645135&e&&(t-=4),858993459&e&&(t-=2),1431655765&e&&(t-=1),t}n.INT_BITS=32,n.INT_MAX=2147483647,n.INT_MIN=-1<<31,n.sign=function(e){return(e>0)-(e<0)},n.abs=function(e){var t=e>>31;return(e^t)-t},n.min=function(e,t){return t^(e^t)&-(e65535)<<4,t|=n=((e>>>=t)>255)<<3,t|=n=((e>>>=n)>15)<<2,(t|=n=((e>>>=n)>3)<<1)|(e>>>=n)>>1},n.log10=function(e){return e>=1e9?9:e>=1e8?8:e>=1e7?7:e>=1e6?6:e>=1e5?5:e>=1e4?4:e>=1e3?3:e>=100?2:e>=10?1:0},n.popCount=function(e){return 16843009*((e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135)>>>24},n.countTrailingZeros=r,n.nextPow2=function(e){return e+=0===e,--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1},n.prevPow2=function(e){return e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)-(e>>>1)},n.parity=function(e){return e^=e>>>16,e^=e>>>8,e^=e>>>4,27030>>>(e&=15)&1};var i=new Array(256);!function(e){for(var t=0;t<256;++t){var n=t,r=t,i=7;for(n>>>=1;n;n>>>=1)r<<=1,r|=1&n,--i;e[t]=r<>>8&255]<<16|i[e>>>16&255]<<8|i[e>>>24&255]},n.interleave2=function(e,t){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))<<1},n.deinterleave2=function(e,t){return(e=65535&((e=16711935&((e=252645135&((e=858993459&((e=e>>>t&1431655765)|e>>>1))|e>>>2))|e>>>4))|e>>>16))<<16>>16},n.interleave3=function(e,t,n){return e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2),(e|=(t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2))<<1)|(n=1227133513&((n=3272356035&((n=251719695&((n=4278190335&((n&=1023)|n<<16))|n<<8))|n<<4))|n<<2))<<2},n.deinterleave3=function(e,t){return(e=1023&((e=4278190335&((e=251719695&((e=3272356035&((e=e>>>t&1227133513)|e>>>2))|e>>>4))|e>>>8))|e>>>16))<<22>>22},n.nextCombination=function(e){var t=e|e-1;return t+1|(~t&-~t)-1>>>r(e)+1}},{}],4:[function(e,t,n){},{}],5:[function(e,t,n){(function(t,r){var i=e("pako/lib/zlib/messages"),a=e("pako/lib/zlib/zstream"),o=e("pako/lib/zlib/deflate.js"),s=e("pako/lib/zlib/inflate.js"),u=e("pako/lib/zlib/constants");for(var l in u)n[l]=u[l];function c(e){if(en.UNZIP)throw new TypeError("Bad argument");this.mode=e,this.init_done=!1,this.write_in_progress=!1,this.pending_close=!1,this.windowBits=0,this.level=0,this.memLevel=0,this.strategy=0,this.dictionary=null}function f(e,t){for(var n=0;nn.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsn.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.leveln.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLeveln.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=n.Z_FILTERED&&e.strategy!=n.Z_HUFFMAN_ONLY&&e.strategy!=n.Z_RLE&&e.strategy!=n.Z_FIXED&&e.strategy!=n.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!r.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._binding=new a.Zlib(t);var o=this;this._hadError=!1,this._binding.onerror=function(e,t){o._binding=null,o._hadError=!0;var r=new Error(e);r.errno=t,r.code=n.codes[t],o.emit("error",r)};var s=n.Z_DEFAULT_COMPRESSION;"number"==typeof e.level&&(s=e.level);var u=n.Z_DEFAULT_STRATEGY;"number"==typeof e.strategy&&(u=e.strategy),this._binding.init(e.windowBits||n.Z_DEFAULT_WINDOWBITS,s,e.memLevel||n.Z_DEFAULT_MEMLEVEL,u,e.dictionary),this._buffer=new r(this._chunkSize),this._offset=0,this._closed=!1,this._level=s,this._strategy=u,this.once("end",this.close)}a.Z_MIN_WINDOWBITS=8,a.Z_MAX_WINDOWBITS=15,a.Z_DEFAULT_WINDOWBITS=15,a.Z_MIN_CHUNK=64,a.Z_MAX_CHUNK=1/0,a.Z_DEFAULT_CHUNK=16384,a.Z_MIN_MEMLEVEL=1,a.Z_MAX_MEMLEVEL=9,a.Z_DEFAULT_MEMLEVEL=8,a.Z_MIN_LEVEL=-1,a.Z_MAX_LEVEL=9,a.Z_DEFAULT_LEVEL=a.Z_DEFAULT_COMPRESSION,Object.keys(a).forEach(function(e){e.match(/^Z/)&&(n[e]=a[e])}),n.codes={Z_OK:a.Z_OK,Z_STREAM_END:a.Z_STREAM_END,Z_NEED_DICT:a.Z_NEED_DICT,Z_ERRNO:a.Z_ERRNO,Z_STREAM_ERROR:a.Z_STREAM_ERROR,Z_DATA_ERROR:a.Z_DATA_ERROR,Z_MEM_ERROR:a.Z_MEM_ERROR,Z_BUF_ERROR:a.Z_BUF_ERROR,Z_VERSION_ERROR:a.Z_VERSION_ERROR},Object.keys(n.codes).forEach(function(e){n.codes[n.codes[e]]=e}),n.Deflate=c,n.Inflate=f,n.Gzip=h,n.Gunzip=p,n.DeflateRaw=d,n.InflateRaw=g,n.Unzip=v,n.createDeflate=function(e){return new c(e)},n.createInflate=function(e){return new f(e)},n.createDeflateRaw=function(e){return new d(e)},n.createInflateRaw=function(e){return new g(e)},n.createGzip=function(e){return new h(e)},n.createGunzip=function(e){return new p(e)},n.createUnzip=function(e){return new v(e)},n.deflate=function(e,t,n){return"function"==typeof t&&(n=t,t={}),u(new c(t),e,n)},n.deflateSync=function(e,t){return l(new c(t),e)},n.gzip=function(e,t,n){return"function"==typeof t&&(n=t,t={}),u(new h(t),e,n)},n.gzipSync=function(e,t){return l(new h(t),e)},n.deflateRaw=function(e,t,n){return"function"==typeof t&&(n=t,t={}),u(new d(t),e,n)},n.deflateRawSync=function(e,t){return l(new d(t),e)},n.unzip=function(e,t,n){return"function"==typeof t&&(n=t,t={}),u(new v(t),e,n)},n.unzipSync=function(e,t){return l(new v(t),e)},n.inflate=function(e,t,n){return"function"==typeof t&&(n=t,t={}),u(new f(t),e,n)},n.inflateSync=function(e,t){return l(new f(t),e)},n.gunzip=function(e,t,n){return"function"==typeof t&&(n=t,t={}),u(new p(t),e,n)},n.gunzipSync=function(e,t){return l(new p(t),e)},n.inflateRaw=function(e,t,n){return"function"==typeof t&&(n=t,t={}),u(new g(t),e,n)},n.inflateRawSync=function(e,t){return l(new g(t),e)},o.inherits(m,i),m.prototype.params=function(e,r,i){if(en.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(r!=n.Z_FILTERED&&r!=n.Z_HUFFMAN_ONLY&&r!=n.Z_RLE&&r!=n.Z_FIXED&&r!=n.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+r);if(this._level!==e||this._strategy!==r){var o=this;this.flush(a.Z_SYNC_FLUSH,function(){o._binding.params(e,r),o._hadError||(o._level=e,o._strategy=r,i&&i())})}else t.nextTick(i)},m.prototype.reset=function(){return this._binding.reset()},m.prototype._flush=function(e){this._transform(new r(0),"",e)},m.prototype.flush=function(e,n){var i=this._writableState;if(("function"==typeof e||void 0===e&&!n)&&(n=e,e=a.Z_FULL_FLUSH),i.ended)n&&t.nextTick(n);else if(i.ending)n&&this.once("end",n);else if(i.needDrain){var o=this;this.once("drain",function(){o.flush(n)})}else this._flushFlag=e,this.write(new r(0),"",n)},m.prototype.close=function(e){if(e&&t.nextTick(e),!this._closed){this._closed=!0,this._binding.close();var n=this;t.nextTick(function(){n.emit("close")})}},m.prototype._transform=function(e,t,n){var i,o=this._writableState,s=(o.ending||o.ended)&&(!e||o.length===e.length);if(null===!e&&!r.isBuffer(e))return n(new Error("invalid input"));s?i=a.Z_FINISH:(i=this._flushFlag,e.length>=o.length&&(this._flushFlag=this._opts.flush||a.Z_NO_FLUSH));this._processChunk(e,i,n)},m.prototype._processChunk=function(e,t,n){var i=e&&e.length,a=this._chunkSize-this._offset,o=0,u=this,l="function"==typeof n;if(!l){var c,f=[],h=0;this.on("error",function(e){c=e});do{var p=this._binding.writeSync(t,e,o,i,this._buffer,this._offset,a)}while(!this._hadError&&v(p[0],p[1]));if(this._hadError)throw c;var d=r.concat(f,h);return this.close(),d}var g=this._binding.write(t,e,o,i,this._buffer,this._offset,a);function v(c,p){if(!u._hadError){var d=a-p;if(s(d>=0,"have should not go down"),d>0){var g=u._buffer.slice(u._offset,u._offset+d);u._offset+=d,l?u.push(g):(f.push(g),h+=g.length)}if((0===p||u._offset>=u._chunkSize)&&(a=u._chunkSize,u._offset=0,u._buffer=new r(u._chunkSize)),0===p){if(o+=i-c,i=c,!l)return!0;var m=u._binding.write(t,e,o,i,u._buffer,u._offset,u._chunkSize);return m.callback=v,void(m.buffer=e)}if(!l)return!1;n()}}g.buffer=e,g.callback=v},o.inherits(c,m),o.inherits(f,m),o.inherits(h,m),o.inherits(p,m),o.inherits(d,m),o.inherits(g,m),o.inherits(v,m)}).call(this,e("_process"),e("buffer").Buffer)},{"./binding":5,_process:105,_stream_transform:116,assert:1,buffer:8,util:132}],7:[function(e,t,n){arguments[4][4][0].apply(n,arguments)},{dup:4}],8:[function(e,t,n){(function(t){"use strict";var r=e("base64-js"),i=e("ieee754"),a=e("isarray");function o(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function d(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return U(e).length;default:if(r)return F(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:m(e,t,n,r,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):m(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,r,i){var a,o=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(a=n;as&&(n=s-u),a=n;a>=0;a--){for(var f=!0,h=0;hi&&(r=i):r=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var o=0;o>8,i=n%256,a.push(i),a.push(r);return a}(t,e.length-n),e,n,r)}function E(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function T(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:l>223?3:l>191?2:1;if(i+f<=n)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(a=e[i+1]))&&(u=(31&l)<<6|63&a)>127&&(c=u);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(u=(15&l)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=f}return function(e){var t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rthis.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return T(this,t,n);case"ascii":return S(this,t,n);case"latin1":case"binary":return C(this,t,n);case"base64":return E(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",t=n.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},u.prototype.compare=function(e,t,n,r,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var a=i-r,o=n-t,s=Math.min(a,o),l=this.slice(r,i),c=e.slice(t,n),f=0;fi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return y(this,e,t,n);case"ascii":return _(this,e,t,n);case"latin1":case"binary":return b(this,e,t,n);case"base64":return x(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function S(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",a=t;an)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,n,r,i,a){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function I(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function B(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function D(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function N(e,t,n,r,a){return a||D(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function O(e,t,n,r,a){return a||D(e,0,n,8),i.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){var n,r=this.length;if(e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},u.prototype.readUInt8=function(e,t){return t||j(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||j(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||j(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||j(e,t,this.length);for(var r=this[e],i=1,a=0;++a=(i*=128)&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||j(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},u.prototype.readInt8=function(e,t){return t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||j(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){t||j(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||j(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||j(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||j(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||j(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||L(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+i]=e/a&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):I(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):I(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):B(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);L(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a>0)-s&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);L(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):I(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):I(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):B(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,n){return N(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return N(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return O(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return O(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(a<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function U(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(P,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":2,ieee754:51,isarray:9}],9:[function(e,t,n){var r={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},{}],10:[function(e,t,n){(function(t){"use strict";var r=e("buffer"),i=r.Buffer,a=r.SlowBuffer,o=r.kMaxLength||2147483647;n.alloc=function(e,t,n){if("function"==typeof i.alloc)return i.alloc(e,t,n);if("number"==typeof n)throw new TypeError("encoding must not be number");if("number"!=typeof e)throw new TypeError("size must be a number");if(e>o)throw new RangeError("size is too large");var r=n,a=t;void 0===a&&(r=void 0,a=0);var s=new i(e);if("string"==typeof a)for(var u=new i(a,r),l=u.length,c=-1;++co)throw new RangeError("size is too large");return new i(e)},n.from=function(e,n,r){if("function"==typeof i.from&&(!t.Uint8Array||Uint8Array.from!==i.from))return i.from(e,n,r);if("number"==typeof e)throw new TypeError('"value" argument must not be a number');if("string"==typeof e)return new i(e,n);if("undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer){var a=n;if(1===arguments.length)return new i(e);void 0===a&&(a=0);var o=r;if(void 0===o&&(o=e.byteLength-a),a>=e.byteLength)throw new RangeError("'offset' is out of bounds");if(o>e.byteLength-a)throw new RangeError("'length' is out of bounds");return new i(e.slice(a,a+o))}if(i.isBuffer(e)){var s=new i(e.length);return e.copy(s,0,0,e.length),s}if(e){if(Array.isArray(e)||"undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return new i(e);if("Buffer"===e.type&&Array.isArray(e.data))return new i(e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},n.allocUnsafeSlow=function(e){if("function"==typeof i.allocUnsafeSlow)return i.allocUnsafeSlow(e);if("number"!=typeof e)throw new TypeError("size must be a number");if(e>=o)throw new RangeError("size is too large");return new a(e)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{buffer:8}],11:[function(e,t,n){(function(n){var r=e("tty"),i=e("./lib/encode"),a=e("stream").Stream,o=t.exports=function(){var e=null;function t(t){if(e)throw new Error("multiple inputs specified");e=t}var i=null;function a(e){if(i)throw new Error("multiple outputs specified");i=e}for(var o=0;o0&&this.down(t),e>0?this.right(e):e<0&&this.left(-e),this},s.prototype.up=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"A")),this},s.prototype.down=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"B")),this},s.prototype.right=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"C")),this},s.prototype.left=function(e){return void 0===e&&(e=1),this.write(i("["+Math.floor(e)+"D")),this},s.prototype.column=function(e){return this.write(i("["+Math.floor(e)+"G")),this},s.prototype.push=function(e){return this.write(i(e?"7":"[s")),this},s.prototype.pop=function(e){return this.write(i(e?"8":"[u")),this},s.prototype.erase=function(e){return"end"===e||"$"===e?this.write(i("[K")):"start"===e||"^"===e?this.write(i("[1K")):"line"===e?this.write(i("[2K")):"down"===e?this.write(i("[J")):"up"===e?this.write(i("[1J")):"screen"===e?this.write(i("[1J")):this.emit("error",new Error("Unknown erase type: "+e)),this},s.prototype.display=function(e){var t={reset:0,bright:1,dim:2,underscore:4,blink:5,reverse:7,hidden:8}[e];return void 0===t&&this.emit("error",new Error("Unknown attribute: "+e)),this.write(i("["+t+"m")),this},s.prototype.foreground=function(e){if("number"==typeof e)(e<0||e>=256)&&this.emit("error",new Error("Color out of range: "+e)),this.write(i("[38;5;"+e+"m"));else{var t={black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37}[e.toLowerCase()];t||this.emit("error",new Error("Unknown color: "+e)),this.write(i("["+t+"m"))}return this},s.prototype.background=function(e){if("number"==typeof e)(e<0||e>=256)&&this.emit("error",new Error("Color out of range: "+e)),this.write(i("[48;5;"+e+"m"));else{var t={black:40,red:41,green:42,yellow:43,blue:44,magenta:45,cyan:46,white:47}[e.toLowerCase()];t||this.emit("error",new Error("Unknown color: "+e)),this.write(i("["+t+"m"))}return this},s.prototype.cursor=function(e){return this.write(i(e?"[?25h":"[?25l")),this};var u=o.extractCodes=function(e){for(var t=[],n=-1,r=0;r=0&&t.push(e.slice(n,r)),n=r):n>=0&&r===e.length-1&&t.push(e.slice(n));return t}}).call(this,e("_process"))},{"./lib/encode":12,_process:105,stream:122,tty:125}],12:[function(e,t,n){(function(e){var n=(t.exports=function(t){return new e([27].concat(function e(t){return"string"==typeof t?t.split("").map(n):Array.isArray(t)?t.reduce(function(t,n){return t.concat(e(n))},[]):void 0}(t)))}).ord=function(e){return e.charCodeAt(0)}}).call(this,e("buffer").Buffer)},{buffer:8}],13:[function(e,t,n){(function(n){"use strict";var r=e("readable-stream").Readable,i=e("util");function a(e,t){if(!(this instanceof a))return new a(e,t);r.call(this,t),null!==e&&void 0!==e||(e=String(e)),this._obj=e}t.exports=a,i.inherits(a,r),a.prototype._read=function(e){var t=this._obj;"string"==typeof t?this.push(new n(t)):n.isBuffer(t)?this.push(t):this.push(new n(JSON.stringify(t))),this.push(null)}}).call(this,e("buffer").Buffer)},{buffer:8,"readable-stream":20,util:132}],14:[function(e,t,n){t.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{}],15:[function(e,t,n){(function(n){t.exports=s;var r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t},i=e("core-util-is");i.inherits=e("inherits");var a=e("./_stream_readable"),o=e("./_stream_writable");function s(e){if(!(this instanceof s))return new s(e);a.call(this,e),o.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",u)}function u(){this.allowHalfOpen||this._writableState.ended||n.nextTick(this.end.bind(this))}i.inherits(s,a),function(e,t){for(var n=0,r=e.length;n0?d(e):_(e)}(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!o){var u=new Error("stream.push() after EOF");e.emit("error",u)}else if(t.endEmitted&&o){u=new Error("stream.unshift() after end event");e.emit("error",u)}else!t.decoder||o||a||(r=t.decoder.write(r)),t.length+=t.objectMode?1:r.length,o?t.buffer.unshift(r):(t.reading=!1,t.buffer.push(r)),t.needReadable&&d(e),function(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){!function(e,t){var n=t.length;for(;!t.reading&&!t.flowing&&!t.ended&&t.lengtht.highWaterMark&&(t.highWaterMark=function(e){if(e>=h)e=h;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function d(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?n.nextTick(function(){g(e)}):g(e))}function g(e){e.emit("readable")}function v(e){var t,n=e._readableState;function r(e,r,i){!1===e.write(t)&&n.awaitDrain++}for(n.awaitDrain=0;n.pipesCount&&null!==(t=e.read());)if(1===n.pipesCount?r(n.pipes):b(n.pipes,r),e.emit("data",t),n.awaitDrain>0)return;if(0===n.pipesCount)return n.flowing=!1,void(a.listenerCount(e,"data")>0&&w(e));n.ranOut=!0}function m(){this._readableState.ranOut&&(this._readableState.ranOut=!1,v(this))}function w(e,t){if(e._readableState.flowing)throw new Error("Cannot switch to old mode now.");var r=t||!1,i=!1;e.readable=!0,e.pipe=s.prototype.pipe,e.on=e.addListener=s.prototype.on,e.on("readable",function(){var t;for(i=!0;!r&&null!==(t=e.read());)e.emit("data",t);null===t&&(i=!1,e._readableState.needReadable=!0)}),e.pause=function(){r=!0,this.emit("pause")},e.resume=function(){r=!1,i?n.nextTick(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function y(e,t){var n,r=t.buffer,a=t.length,o=!!t.decoder,s=!!t.objectMode;if(0===r.length)return null;if(0===a)n=null;else if(s)n=r.shift();else if(!e||e>=a)n=o?r.join(""):i.concat(r,a),r.length=0;else{if(e0)throw new Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function b(e,t){for(var n=0,r=e.length;n0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return d(this),null;if(0===(e=p(e,t))&&t.ended)return n=null,t.length>0&&t.decoder&&(n=y(e,t),t.length-=n.length),0===t.length&&_(this),n;var i=t.needReadable;return t.length-e<=t.highWaterMark&&(i=!0),(t.ended||t.reading)&&(i=!1),i&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),i&&!t.reading&&(e=p(r,t)),null===(n=e>0?y(e,t):null)&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),t.ended&&!t.endEmitted&&0===t.length&&_(this),n},c.prototype._read=function(e){this.emit("error",new Error("not implemented"))},c.prototype.pipe=function(e,t){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1;var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?l:f;function u(e){e===i&&f()}function l(){e.end()}o.endEmitted?n.nextTick(s):i.once("end",s),e.on("unpipe",u);var c=function(e){return function(){var t=e._readableState;t.awaitDrain--,0===t.awaitDrain&&v(e)}}(i);function f(){e.removeListener("close",p),e.removeListener("finish",d),e.removeListener("drain",c),e.removeListener("error",h),e.removeListener("unpipe",u),i.removeListener("end",l),i.removeListener("end",f),e._writableState&&!e._writableState.needDrain||c()}function h(t){g(),e.removeListener("error",h),0===a.listenerCount(e,"error")&&e.emit("error",t)}function p(){e.removeListener("finish",d),g()}function d(){e.removeListener("close",p),g()}function g(){i.unpipe(e)}return e.on("drain",c),e._events&&e._events.error?r(e._events.error)?e._events.error.unshift(h):e._events.error=[h,e._events.error]:e.on("error",h),e.once("close",p),e.once("finish",d),e.emit("pipe",i),o.flowing||(this.on("readable",m),o.flowing=!0,n.nextTick(function(){v(i)})),e},c.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,this.removeListener("readable",m),t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,this.removeListener("readable",m),t.flowing=!1;for(var i=0;i=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,r),r-=this.charReceived);var i;r=(t+=e.toString(this.encoding,0,r)).length-1;if((i=t.charCodeAt(r))>=55296&&i<=56319){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),e.copy(this.charBuffer,0,0,a),t.substring(0,r)}return t},a.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},a.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t}},{buffer:8}],22:[function(e,t,n){(function(e){function t(e){return Object.prototype.toString.call(e)}n.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===t(e)},n.isBoolean=function(e){return"boolean"==typeof e},n.isNull=function(e){return null===e},n.isNullOrUndefined=function(e){return null==e},n.isNumber=function(e){return"number"==typeof e},n.isString=function(e){return"string"==typeof e},n.isSymbol=function(e){return"symbol"==typeof e},n.isUndefined=function(e){return void 0===e},n.isRegExp=function(e){return"[object RegExp]"===t(e)},n.isObject=function(e){return"object"==typeof e&&null!==e},n.isDate=function(e){return"[object Date]"===t(e)},n.isError=function(e){return"[object Error]"===t(e)||e instanceof Error},n.isFunction=function(e){return"function"==typeof e},n.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},n.isBuffer=e.isBuffer}).call(this,{isBuffer:e("../../is-buffer/index.js")})},{"../../is-buffer/index.js":54}],23:[function(e,t,n){"use strict";var r=e("./lib/thunk.js");t.exports=function(e){var t=new function(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1};t.pre=e.pre,t.body=e.body,t.post=e.post;var n=e.args.slice(0);t.argTypes=n;for(var i=0;i0)throw new Error("cwise: pre() block may not reference array args");if(i0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===a)t.scalarArgs.push(i),t.shimArgs.push("scalar"+i);else if("index"===a){if(t.indexArgs.push(i),i0)throw new Error("cwise: pre() block may not reference array index");if(i0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(t.shapeArgs.push(i),in.length)throw new Error("cwise: Too many arguments in pre() block");if(t.body.args.length>n.length)throw new Error("cwise: Too many arguments in body() block");if(t.post.args.length>n.length)throw new Error("cwise: Too many arguments in post() block");return t.debug=!!e.printCode||!!e.debug,t.funcName=e.funcName||"cwise",t.blockSize=e.blockSize||64,r(t)}},{"./lib/thunk.js":25}],24:[function(e,t,n){"use strict";var r=e("uniq");function i(e,t,n){var r,i,a=e.length,o=t.arrayArgs.length,s=t.indexArgs.length>0,u=[],l=[],c=0,f=0;for(r=0;r=0;--r)c=e[r],u.push(["for(i",r,"=0;i",r,"0&&u.push(["index[",f,"]-=s",f].join("")),u.push(["++index[",c,"]"].join(""))),u.push("}")}return u.join("\n")}function a(e,t,n){for(var r=e.body,i=[],a=[],o=0;o0&&w.push("shape=SS.slice(0)"),e.indexArgs.length>0){var y=new Array(n);for(u=0;u3&&m.push(a(e.pre,e,s));var k=a(e.body,e,s),E=function(e){for(var t=0,n=e[0].length;t0,l=[],c=0;c0;){"].join("")),l.push(["if(j",c,"<",s,"){"].join("")),l.push(["s",t[c],"=j",c].join("")),l.push(["j",c,"=0"].join("")),l.push(["}else{s",t[c],"=",s].join("")),l.push(["j",c,"-=",s,"}"].join("")),u&&l.push(["index[",t[c],"]=j",c].join(""));for(c=0;c3&&m.push(a(e.post,e,s)),e.debug&&console.log("-----Generated cwise routine for ",t,":\n"+m.join("\n")+"\n----------");var T=[e.funcName||"unnamed","_cwise_loop_",o[0].join("s"),"m",E,function(e){for(var t=new Array(e.length),n=!0,r=0;r0&&(n=n&&t[r]===t[r-1])}return n?t[0]:t.join("")}(s)].join("");return new Function(["function ",T,"(",v.join(","),"){",m.join("\n"),"} return ",T].join(""))()}},{uniq:127}],25:[function(e,t,n){"use strict";var r=e("./compile.js");t.exports=function(e){var t=["'use strict'","var CACHED={}"],n=[],i=e.funcName+"_cwise_thunk";t.push(["return function ",i,"(",e.shimArgs.join(","),"){"].join(""));for(var a=[],o=[],s=[["array",e.arrayArgs[0],".shape.slice(",Math.max(0,e.arrayBlockIndices[0]),e.arrayBlockIndices[0]<0?","+e.arrayBlockIndices[0]+")":")"].join("")],u=[],l=[],c=0;c0&&(u.push("array"+e.arrayArgs[0]+".shape.length===array"+f+".shape.length+"+(Math.abs(e.arrayBlockIndices[0])-Math.abs(e.arrayBlockIndices[c]))),l.push("array"+e.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,e.arrayBlockIndices[0])+"]===array"+f+".shape[shapeIndex+"+Math.max(0,e.arrayBlockIndices[c])+"]"))}for(e.arrayArgs.length>1&&(t.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),t.push("for(var shapeIndex=array"+e.arrayArgs[0]+".shape.length-"+Math.abs(e.arrayBlockIndices[0])+"; shapeIndex--\x3e0;) {"),t.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),t.push("}")),c=0;c0)return function(e,t){var n,r;for(n=new Array(e),r=0;r0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){if(!i(t))throw TypeError("listener must be a function");var n=!1;function r(){this.removeListener(e,r),n||(n=!0,t.apply(this,arguments))}return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var n,r,o,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(o=(n=this._events[e]).length,r=-1,n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=o;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){r=s;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(i(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){return this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],30:[function(e,t,n){var r=function(t){(t=t||{}).width=t.width||800,t.height=t.height||600;var n=t.model||{vertex:[-1,-1,0,1,-1,0,1,1,0,-1,1,0],indices:[0,1,2,0,2,3,2,1,0,3,2,0],textureCoords:[0,0,1,0,1,1,0,1]},r=t.lens||{a:1,b:1,Fx:0,Fy:0,scale:1.5},i=t.fov||{x:1,y:1},a=t.image||"images/barrel-distortion.png",o=function(e){var t=document.querySelector(e);if(null==t)throw new Error("there is no canvas on this page");for(var n=["webgl","experimental-webgl","webkit-3d","moz-webgl"],r=0;r 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],33:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tfloat correctionRadius = 0.5;\n\tfloat distance = sqrt(vPosition.x * vPosition.x + vPosition.y * vPosition.y) / correctionRadius;\n\tfloat theta = 1.0;\n\tif(distance != 0.0){\n\t\ttheta = atan(distance);\n\t}\n\tvec2 vMapping = theta * vPosition.xy;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\t\t\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],34:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec3 uLensS;\nuniform vec2 uLensF;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord * vec2(1.0, -1.0)/ 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tfloat scale = uLensS.z;\n\tvec3 vPos = vPosition;\n\tfloat Fx = uLensF.x;\n\tfloat Fy = uLensF.y;\n\tvec2 vMapping = vPos.xy;\n\tvMapping.x = vMapping.x + ((pow(vPos.y, 2.0)/scale)*vPos.x/scale)*-Fx;\n\tvMapping.y = vMapping.y + ((pow(vPos.x, 2.0)/scale)*vPos.y/scale)*-Fy;\n\tvMapping = vMapping * uLensS.xy;\n\tvMapping = GLCoord2TextureCoord(vMapping/scale);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t}\n\tgl_FragColor = texture;\n}\n"},{}],35:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tvec2 vMapping = vec2(vTextureCoord.x, 1.0 - vTextureCoord.y);\n\tvMapping = TextureCoord2GLCoord(vMapping);\n\t//TODO insert Code\n\tfloat F = uLens.x/ uLens.w;\n\tfloat seta = length(vMapping) / F;\n\tvMapping = sin(seta) * F / length(vMapping) * vMapping;\n\tvMapping *= uLens.w * 1.414;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],36:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tvec2 vMapping = vec2(vTextureCoord.x, 1.0 - vTextureCoord.y);\n\tvMapping = TextureCoord2GLCoord(vMapping);\n\t//TOD insert Code\n\tfloat F = uLens.x/ uLens.w;\n\tfloat seta = length(vMapping) / F;\n\tvMapping = sin(seta) * F / length(vMapping) * vMapping;\n\tvMapping *= uLens.w * 1.414;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],37:[function(e,t,n){t.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvoid main(void){\n\tvPosition = aVertexPosition;\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = vec4(vPosition,1.0);\n}\n"},{}],38:[function(e,t,n){(function(n,r){"use strict";var i=e("path"),a=e("ndarray"),o=e("omggif").GifReader,s=(e("ndarray-pack"),e("through"),e("data-uri-to-buffer"));function u(e,t){var n;try{n=new o(e)}catch(e){return void t(e)}if(n.numFrames()>0){var r=[n.numFrames(),n.height,n.width,4],i=new Uint8Array(r[0]*r[1]*r[2]*r[3]),s=a(i,r);try{for(var u=0;u=0&&(this.dispose=e)},u.prototype.setRepeat=function(e){this.repeat=e},u.prototype.setTransparent=function(e){this.transparent=e},u.prototype.analyzeImage=function(e){this.setImagePixels(this.removeAlphaChannel(e)),this.analyzePixels()},u.prototype.writeImageInfo=function(){this.firstFrame&&(this.writeLSD(),this.writePalette(),this.repeat>=0&&this.writeNetscapeExt()),this.writeGraphicCtrlExt(),this.writeImageDesc(),this.firstFrame||this.writePalette(),this.firstFrame=!1},u.prototype.outputImage=function(){this.writePixels()},u.prototype.addFrame=function(e){this.emit("frame#start"),this.analyzeImage(e),this.writeImageInfo(),this.outputImage(),this.emit("frame#stop")},u.prototype.finish=function(){this.emit("finish#start"),this.writeByte(59),this.emit("finish#stop")},u.prototype.setQuality=function(e){e<1&&(e=1),this.sample=e},u.prototype.writeHeader=function(){this.emit("writeHeader#start"),this.writeUTFBytes("GIF89a"),this.emit("writeHeader#stop")},u.prototype.analyzePixels=function(){var e=this.pixels.length/3;this.indexedPixels=new Uint8Array(e);var t=new a(this.pixels,this.sample);t.buildColormap(),this.colorTab=t.getColormap();for(var n=0,r=0;r>16,n=(65280&e)>>8,r=255&e,i=0,a=16777216,o=this.colorTab.length,s=0;s=0&&(t=7&dispose),t<<=2,this.writeByte(0|t|e),this.writeShort(this.delay),this.writeByte(this.transIndex),this.writeByte(0)},u.prototype.writeImageDesc=function(){this.writeByte(44),this.writeShort(0),this.writeShort(0),this.writeShort(this.width),this.writeShort(this.height),this.firstFrame?this.writeByte(0):this.writeByte(128|this.palSize)},u.prototype.writeLSD=function(){this.writeShort(this.width),this.writeShort(this.height),this.writeByte(240|this.palSize),this.writeByte(0),this.writeByte(0)},u.prototype.writeNetscapeExt=function(){this.writeByte(33),this.writeByte(255),this.writeByte(11),this.writeUTFBytes("NETSCAPE2.0"),this.writeByte(3),this.writeByte(1),this.writeShort(this.repeat),this.writeByte(0)},u.prototype.writePalette=function(){this.writeBytes(this.colorTab);for(var e=768-this.colorTab.length,t=0;t>8&255)},u.prototype.writePixels=function(){new o(this.width,this.height,this.indexedPixels,this.colorDepth).encode(this)},u.prototype.stream=function(){return this},u.ByteCapacitor=s,t.exports=u}).call(this,e("buffer").Buffer)},{"./LZWEncoder.js":41,"./TypedNeuQuant.js":42,assert:1,buffer:8,events:29,"readable-stream":49,util:132}],41:[function(e,t,n){var r=-1,i=12,a=5003,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];t.exports=function(e,t,n,s){var u,l,c,f,h,p,d,g,v,m=Math.max(2,s),w=new Uint8Array(256),y=new Int32Array(a),_=new Int32Array(a),b=0,x=0,k=!1;function E(e,t){w[l++]=e,l>=254&&S(t)}function T(e){A(a),x=g+2,k=!0,R(g,e)}function A(e){for(var t=0;t0&&(e.writeByte(l),e.writeBytes(w,0,l),l=0)}function C(e){return(1<0?u|=e<=8;)E(255&u,t),u>>=8,b-=8;if((x>c||k)&&(k?(c=C(p=d),k=!1):c=++p==i?1<0;)E(255&u,t),u>>=8,b-=8;S(t)}}this.encode=function(n){n.writeByte(m),f=e*t,h=0,function(e,t){var n,o,s,u,f,h,m;for(k=!1,c=C(p=d=e),v=1+(g=1<=0){f=h-s,0===s&&(f=1);do{if((s-=f)<0&&(s+=h),y[s]===n){u=_[s];continue e}}while(y[s]>=0)}R(u,t),u=o,x<1<>c,h=u<>3)*(1<l;)u=S[p++],fl&&((s=n[h--])[0]-=u*(s[0]-r)/w,s[1]-=u*(s[1]-a)/w,s[2]-=u*(s[2]-o)/w)}function R(e,t,r){var a,u,p,d,g,v=~(1<<31),m=v,w=-1,y=w;for(a=0;a>s-o))>c,A[a]-=g,T[a]+=g<>3),e=0;e>p;for(A<=1&&(A=0),n=0;n=c&&(j-=c),n++,0===w&&(w=1),n%w==0)for(E-=E/f,(A=(T-=T/g)>>p)<=1&&(A=0),l=0;l>=o,n[e][1]>>=o,n[e][2]>>=o,n[e][3]=e}(),function(){var e,t,r,o,s,u,l=0,c=0;for(e=0;e>1,t=l+1;t>1,t=l+1;t<256;t++)E[t]=a}()},this.getColormap=function(){for(var e=[],t=[],r=0;r=0;)c=u?c=i:(c++,s<0&&(s=-s),(a=o[0]-e)<0&&(a=-a),(s+=a)=0&&((s=t-(o=n[f])[1])>=u?f=-1:(f--,s<0&&(s=-s),(a=o[0]-e)<0&&(a=-a),(s+=a)0)if(t.ended&&!a){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&a){s=new Error("stream.unshift() after end event");e.emit("error",s)}else!t.decoder||a||i||(r=t.decoder.write(r)),a||(t.reading=!1),t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,a?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&g(e)),function(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){!function(e,t){var n=t.length;for(;!t.reading&&!t.flowing&&!t.ended&&t.lengtht.highWaterMark&&(t.highWaterMark=function(e){if(e>=p)e=p;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function g(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(l("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?n.nextTick(function(){v(e)}):v(e))}function v(e){l("emit readable"),e.emit("readable"),m(e)}function m(e){var t=e._readableState;if(l("flow",t.flowing),t.flowing)do{var n=e.read()}while(null!==n&&t.flowing)}function w(e,t){var n,r=t.buffer,a=t.length,o=!!t.decoder,s=!!t.objectMode;if(0===r.length)return null;if(0===a)n=null;else if(s)n=r.shift();else if(!e||e>=a)n=o?r.join(""):i.concat(r,a),r.length=0;else{if(e0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}f.prototype.read=function(e){l("read",e);var t=this._readableState,n=e;if((!u.isNumber(e)||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return l("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?y(this):g(this),null;if(0===(e=d(e,t))&&t.ended)return 0===t.length&&y(this),null;var r,i=t.needReadable;return l("need readable",i),(0===t.length||t.length-e0?w(e,t):null,u.isNull(r)&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),n!==e&&t.ended&&0===t.length&&y(this),u.isNull(r)||this.emit("data",r),r},f.prototype._read=function(e){this.emit("error",new Error("not implemented"))},f.prototype.pipe=function(e,t){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,l("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?c:h;function u(e){l("onunpipe"),e===i&&h()}function c(){l("onend"),e.end()}o.endEmitted?n.nextTick(s):i.once("end",s),e.on("unpipe",u);var f=function(e){return function(){var t=e._readableState;l("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a.listenerCount(e,"data")&&(t.flowing=!0,m(e))}}(i);function h(){l("cleanup"),e.removeListener("close",g),e.removeListener("finish",v),e.removeListener("drain",f),e.removeListener("error",d),e.removeListener("unpipe",u),i.removeListener("end",c),i.removeListener("end",h),i.removeListener("data",p),!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}function p(t){l("ondata"),!1===e.write(t)&&(l("false write response, pause",i._readableState.awaitDrain),i._readableState.awaitDrain++,i.pause())}function d(t){l("onerror",t),w(),e.removeListener("error",d),0===a.listenerCount(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",v),w()}function v(){l("onfinish"),e.removeListener("close",g),w()}function w(){l("unpipe"),i.unpipe(e)}return e.on("drain",f),i.on("data",p),e._events&&e._events.error?r(e._events.error)?e._events.error.unshift(d):e._events.error=[d,e._events.error]:e.on("error",d),e.once("close",g),e.once("finish",v),e.emit("pipe",i),o.flowing||(l("pipe resume"),i.resume()),e},f.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i1){for(var n=[],r=0;r>1,c=-7,f=n?i-1:0,h=n?-1:1,p=e[t+f];for(f+=h,a=p&(1<<-c)-1,p>>=-c,c+=s;c>0;a=256*a+e[t+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=r;c>0;o=256*o+e[t+f],f+=h,c-=8);if(0===a)a=1-l;else{if(a===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),a-=l}return(p?-1:1)*o*Math.pow(2,a-r)},n.write=function(e,t,n,r,i,a){var o,s,u,l=8*a-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:a-1,d=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(o++,u/=2),o+f>=c?(s=0,o=c):o+f>=1?(s=(t*u-1)*Math.pow(2,i),o+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[n+p]=255&s,p+=d,s/=256,i-=8);for(o=o<0;e[n+p]=255&o,p+=d,o/=256,l-=8);e[n+p-d]|=128*g}},{}],52:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],53:[function(e,t,n){"use strict";t.exports=function(e){for(var t=new Array(e),n=0;n0&&t-1 in e)}h.fn=h.prototype={jquery:"2.2.4",constructor:h,selector:"",length:0,toArray:function(){return i.call(this)},get:function(e){return null!=e?e<0?this[e+this.length]:this[e]:i.call(this)},pushStack:function(e){var t=h.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e){return h.each(this,e)},map:function(e){return this.pushStack(h.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(i.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n=0},isPlainObject:function(e){var t;if("object"!==h.type(e)||e.nodeType||h.isWindow(e))return!1;if(e.constructor&&!c.call(e,"constructor")&&!c.call(e.constructor.prototype||{},"isPrototypeOf"))return!1;for(t in e);return void 0===t||c.call(e,t)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?u[l.call(e)]||"object":typeof e},globalEval:function(e){var t,n=eval;(e=h.trim(e))&&(1===e.indexOf("use strict")?((t=r.createElement("script")).text=e,r.head.appendChild(t).parentNode.removeChild(t)):n(e))},camelCase:function(e){return e.replace(d,"ms-").replace(g,v)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t){var n,r=0;if(m(e))for(n=e.length;r+~]|"+O+")"+O+"*"),V=new RegExp("="+O+"*([^\\]'\"]*?)"+O+"*\\]","g"),G=new RegExp(F),Z=new RegExp("^"+P+"$"),Y={ID:new RegExp("^#("+P+")"),CLASS:new RegExp("^\\.("+P+")"),TAG:new RegExp("^("+P+"|[*])"),ATTR:new RegExp("^"+z),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),bool:new RegExp("^(?:"+N+")$","i"),needsContext:new RegExp("^"+O+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)","i")},$=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Q=/[+~]/,ee=/'|\\/g,te=new RegExp("\\\\([\\da-f]{1,6}"+O+"?|("+O+")|.)","ig"),ne=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},re=function(){h()};try{I.apply(R=B.call(b.childNodes),b.childNodes),R[b.childNodes.length].nodeType}catch(e){I={apply:R.length?function(e,t){L.apply(e,B.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}function ie(e,t,r,i){var a,s,l,c,f,d,m,w,x=t&&t.ownerDocument,k=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==k&&9!==k&&11!==k)return r;if(!i&&((t?t.ownerDocument||t:b)!==p&&h(t),t=t||p,g)){if(11!==k&&(d=J.exec(e)))if(a=d[1]){if(9===k){if(!(l=t.getElementById(a)))return r;if(l.id===a)return r.push(l),r}else if(x&&(l=x.getElementById(a))&&y(t,l)&&l.id===a)return r.push(l),r}else{if(d[2])return I.apply(r,t.getElementsByTagName(e)),r;if((a=d[3])&&n.getElementsByClassName&&t.getElementsByClassName)return I.apply(r,t.getElementsByClassName(a)),r}if(n.qsa&&!A[e+" "]&&(!v||!v.test(e))){if(1!==k)x=t,w=e;else if("object"!==t.nodeName.toLowerCase()){for((c=t.getAttribute("id"))?c=c.replace(ee,"\\$&"):t.setAttribute("id",c=_),s=(m=o(e)).length,f=Z.test(c)?"#"+c:"[id='"+c+"']";s--;)m[s]=f+" "+ge(m[s]);w=m.join(","),x=Q.test(e)&&pe(t.parentNode)||t}if(w)try{return I.apply(r,x.querySelectorAll(w)),r}catch(e){}finally{c===_&&t.removeAttribute("id")}}}return u(e.replace(q,"$1"),t,r,i)}function ae(){var e=[];return function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}}function oe(e){return e[_]=!0,e}function se(e){var t=p.createElement("div");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ue(e,t){for(var n=e.split("|"),i=n.length;i--;)r.attrHandle[n[i]]=t}function le(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||C)-(~e.sourceIndex||C);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function ce(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function fe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function he(e){return oe(function(t){return t=+t,oe(function(n,r){for(var i,a=e([],n.length,t),o=a.length;o--;)n[i=a[o]]&&(n[i]=!(r[i]=n[i]))})})}function pe(e){return e&&void 0!==e.getElementsByTagName&&e}for(t in n=ie.support={},a=ie.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},h=ie.setDocument=function(e){var t,i,o=e?e.ownerDocument||e:b;return o!==p&&9===o.nodeType&&o.documentElement?(d=(p=o).documentElement,g=!a(p),(i=p.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=se(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=se(function(e){return e.appendChild(p.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=K.test(p.getElementsByClassName),n.getById=se(function(e){return d.appendChild(e).id=_,!p.getElementsByName||!p.getElementsByName(_).length}),n.getById?(r.find.ID=function(e,t){if(void 0!==t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}},r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}}):(delete r.find.ID,r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}}),r.find.TAG=n.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,a=t.getElementsByTagName(e);if("*"===e){for(;n=a[i++];)1===n.nodeType&&r.push(n);return r}return a},r.find.CLASS=n.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&g)return t.getElementsByClassName(e)},m=[],v=[],(n.qsa=K.test(p.querySelectorAll))&&(se(function(e){d.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+O+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+O+"*(?:value|"+N+")"),e.querySelectorAll("[id~="+_+"-]").length||v.push("~="),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+_+"+*").length||v.push(".#.+[+~]")}),se(function(e){var t=p.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+O+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(n.matchesSelector=K.test(w=d.matches||d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&se(function(e){n.disconnectedMatch=w.call(e,"div"),w.call(e,"[s!='']:x"),m.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),m=m.length&&new RegExp(m.join("|")),t=K.test(d.compareDocumentPosition),y=t||K.test(d.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},S=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===p||e.ownerDocument===b&&y(b,e)?-1:t===p||t.ownerDocument===b&&y(b,t)?1:c?D(c,e)-D(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,a=t.parentNode,o=[e],s=[t];if(!i||!a)return e===p?-1:t===p?1:i?-1:a?1:c?D(c,e)-D(c,t):0;if(i===a)return le(e,t);for(n=e;n=n.parentNode;)o.unshift(n);for(n=t;n=n.parentNode;)s.unshift(n);for(;o[r]===s[r];)r++;return r?le(o[r],s[r]):o[r]===b?-1:s[r]===b?1:0},p):p},ie.matches=function(e,t){return ie(e,null,null,t)},ie.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&h(e),t=t.replace(V,"='$1']"),n.matchesSelector&&g&&!A[t+" "]&&(!m||!m.test(t))&&(!v||!v.test(t)))try{var r=w.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return ie(t,p,null,[e]).length>0},ie.contains=function(e,t){return(e.ownerDocument||e)!==p&&h(e),y(e,t)},ie.attr=function(e,t){(e.ownerDocument||e)!==p&&h(e);var i=r.attrHandle[t.toLowerCase()],a=i&&M.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==a?a:n.attributes||!g?e.getAttribute(t):(a=e.getAttributeNode(t))&&a.specified?a.value:null},ie.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},ie.uniqueSort=function(e){var t,r=[],i=0,a=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(S),f){for(;t=e[a++];)t===e[a]&&(i=r.push(a));for(;i--;)e.splice(r[i],1)}return c=null,e},i=ie.getText=function(e){var t,n="",r=0,a=e.nodeType;if(a){if(1===a||9===a||11===a){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===a||4===a)return e.nodeValue}else for(;t=e[r++];)n+=i(t);return n},(r=ie.selectors={cacheLength:50,createPseudo:oe,match:Y,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ie.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ie.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return Y.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&G.test(n)&&(t=o(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=ie.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace(U," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var a="nth"!==e.slice(0,3),o="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,h,p,d,g=a!==o?"nextSibling":"previousSibling",v=t.parentNode,m=s&&t.nodeName.toLowerCase(),w=!u&&!s,y=!1;if(v){if(a){for(;g;){for(h=t;h=h[g];)if(s?h.nodeName.toLowerCase()===m:1===h.nodeType)return!1;d=g="only"===e&&!d&&"nextSibling"}return!0}if(d=[o?v.firstChild:v.lastChild],o&&w){for(y=(p=(l=(c=(f=(h=v)[_]||(h[_]={}))[h.uniqueID]||(f[h.uniqueID]={}))[e]||[])[0]===x&&l[1])&&l[2],h=p&&v.childNodes[p];h=++p&&h&&h[g]||(y=p=0)||d.pop();)if(1===h.nodeType&&++y&&h===t){c[e]=[x,p,y];break}}else if(w&&(y=p=(l=(c=(f=(h=t)[_]||(h[_]={}))[h.uniqueID]||(f[h.uniqueID]={}))[e]||[])[0]===x&&l[1]),!1===y)for(;(h=++p&&h&&h[g]||(y=p=0)||d.pop())&&((s?h.nodeName.toLowerCase()!==m:1!==h.nodeType)||!++y||(w&&((c=(f=h[_]||(h[_]={}))[h.uniqueID]||(f[h.uniqueID]={}))[e]=[x,y]),h!==t)););return(y-=i)===r||y%r==0&&y/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||ie.error("unsupported pseudo: "+e);return i[_]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?oe(function(e,n){for(var r,a=i(e,t),o=a.length;o--;)e[r=D(e,a[o])]=!(n[r]=a[o])}):function(e){return i(e,0,n)}):i}},pseudos:{not:oe(function(e){var t=[],n=[],r=s(e.replace(q,"$1"));return r[_]?oe(function(e,t,n,i){for(var a,o=r(e,null,i,[]),s=e.length;s--;)(a=o[s])&&(e[s]=!(t[s]=a))}):function(e,i,a){return t[0]=e,r(t,null,a,n),t[0]=null,!n.pop()}}),has:oe(function(e){return function(t){return ie(e,t).length>0}}),contains:oe(function(e){return e=e.replace(te,ne),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:oe(function(e){return Z.test(e||"")||ie.error("unsupported lang: "+e),e=e.replace(te,ne).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return!1===e.disabled},disabled:function(e){return!0===e.disabled},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return X.test(e.nodeName)},input:function(e){return $.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function we(e,t,n,r,i){for(var a,o=[],s=0,u=e.length,l=null!=t;s-1&&(a[l]=!(o[l]=f))}}else m=we(m===o?m.splice(d,m.length):m),i?i(null,o,m,u):I.apply(o,m)})}function _e(e){for(var t,n,i,a=e.length,o=r.relative[e[0].type],s=o||r.relative[" "],u=o?1:0,c=ve(function(e){return e===t},s,!0),f=ve(function(e){return D(t,e)>-1},s,!0),h=[function(e,n,r){var i=!o&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u1&&me(h),u>1&&ge(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(q,"$1"),n,u0,i=e.length>0,a=function(a,o,s,u,c){var f,d,v,m=0,w="0",y=a&&[],_=[],b=l,k=a||i&&r.find.TAG("*",c),E=x+=null==b?1:Math.random()||.1,T=k.length;for(c&&(l=o===p||o||c);w!==T&&null!=(f=k[w]);w++){if(i&&f){for(d=0,o||f.ownerDocument===p||(h(f),s=!g);v=e[d++];)if(v(f,o||p,s)){u.push(f);break}c&&(x=E)}n&&((f=!v&&f)&&m--,a&&y.push(f))}if(m+=w,n&&w!==m){for(d=0;v=t[d++];)v(y,_,o,s);if(a){if(m>0)for(;w--;)y[w]||_[w]||(_[w]=j.call(u));_=we(_)}I.apply(u,_),c&&!a&&_.length>0&&m+t.length>1&&ie.uniqueSort(u)}return c&&(x=E,l=b),y};return n?oe(a):a}(a,i))).selector=e}return s},u=ie.select=function(e,t,i,a){var u,l,c,f,h,p="function"==typeof e&&e,d=!a&&o(e=p.selector||e);if(i=i||[],1===d.length){if((l=d[0]=d[0].slice(0)).length>2&&"ID"===(c=l[0]).type&&n.getById&&9===t.nodeType&&g&&r.relative[l[1].type]){if(!(t=(r.find.ID(c.matches[0].replace(te,ne),t)||[])[0]))return i;p&&(t=t.parentNode),e=e.slice(l.shift().value.length)}for(u=Y.needsContext.test(e)?0:l.length;u--&&(c=l[u],!r.relative[f=c.type]);)if((h=r.find[f])&&(a=h(c.matches[0].replace(te,ne),Q.test(l[0].type)&&pe(t.parentNode)||t))){if(l.splice(u,1),!(e=a.length&&ge(l)))return I.apply(i,a),i;break}}return(p||s(e,d))(a,t,!g,i,!t||Q.test(e)&&pe(t.parentNode)||t),i},n.sortStable=_.split("").sort(S).join("")===_,n.detectDuplicates=!!f,h(),n.sortDetached=se(function(e){return 1&e.compareDocumentPosition(p.createElement("div"))}),se(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||ue("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&se(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ue("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),se(function(e){return null==e.getAttribute("disabled")})||ue(N,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),ie}(e);h.find=w,h.expr=w.selectors,h.expr[":"]=h.expr.pseudos,h.uniqueSort=h.unique=w.uniqueSort,h.text=w.getText,h.isXMLDoc=w.isXML,h.contains=w.contains;var y=function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&h(e).is(n))break;r.push(e)}return r},_=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},b=h.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,k=/^.[^:#\[\.,]*$/;function E(e,t,n){if(h.isFunction(t))return h.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return h.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(k.test(t))return h.filter(t,e,n);t=h.filter(t,e)}return h.grep(e,function(e){return s.call(t,e)>-1!==n})}h.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?h.find.matchesSelector(r,e)?[r]:[]:h.find.matches(e,h.grep(t,function(e){return 1===e.nodeType}))},h.fn.extend({find:function(e){var t,n=this.length,r=[],i=this;if("string"!=typeof e)return this.pushStack(h(e).filter(function(){for(t=0;t1?h.unique(r):r)).selector=this.selector?this.selector+" "+e:e,r},filter:function(e){return this.pushStack(E(this,e||[],!1))},not:function(e){return this.pushStack(E(this,e||[],!0))},is:function(e){return!!E(this,"string"==typeof e&&b.test(e)?h(e):e||[],!1).length}});var T,A=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/;(h.fn.init=function(e,t,n){var i,a;if(!e)return this;if(n=n||T,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:A.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof h?t[0]:t,h.merge(this,h.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),x.test(i[1])&&h.isPlainObject(t))for(i in t)h.isFunction(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(a=r.getElementById(i[2]))&&a.parentNode&&(this.length=1,this[0]=a),this.context=r,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):h.isFunction(e)?void 0!==n.ready?n.ready(e):e(h):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),h.makeArray(e,this))}).prototype=h.fn,T=h(r);var S=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};function M(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}h.fn.extend({has:function(e){var t=h(e,this),n=t.length;return this.filter(function(){for(var e=0;e-1:1===n.nodeType&&h.find.matchesSelector(n,e))){a.push(n);break}return this.pushStack(a.length>1?h.uniqueSort(a):a)},index:function(e){return e?"string"==typeof e?s.call(h(e),this[0]):s.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(h.uniqueSort(h.merge(this.get(),h(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),h.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return y(e,"parentNode")},parentsUntil:function(e,t,n){return y(e,"parentNode",n)},next:function(e){return M(e,"nextSibling")},prev:function(e){return M(e,"previousSibling")},nextAll:function(e){return y(e,"nextSibling")},prevAll:function(e){return y(e,"previousSibling")},nextUntil:function(e,t,n){return y(e,"nextSibling",n)},prevUntil:function(e,t,n){return y(e,"previousSibling",n)},siblings:function(e){return _((e.parentNode||{}).firstChild,e)},children:function(e){return _(e.firstChild)},contents:function(e){return e.contentDocument||h.merge([],e.childNodes)}},function(e,t){h.fn[e]=function(n,r){var i=h.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=h.filter(r,i)),this.length>1&&(C[e]||h.uniqueSort(i),S.test(e)&&i.reverse()),this.pushStack(i)}});var R,j=/\S+/g;function L(){r.removeEventListener("DOMContentLoaded",L),e.removeEventListener("load",L),h.ready()}h.Callbacks=function(e){e="string"==typeof e?function(e){var t={};return h.each(e.match(j)||[],function(e,n){t[n]=!0}),t}(e):h.extend({},e);var t,n,r,i,a=[],o=[],s=-1,u=function(){for(i=e.once,r=t=!0;o.length;s=-1)for(n=o.shift();++s-1;)a.splice(n,1),n<=s&&s--}),this},has:function(e){return e?h.inArray(e,a)>-1:a.length>0},empty:function(){return a&&(a=[]),this},disable:function(){return i=o=[],a=n="",this},disabled:function(){return!a},lock:function(){return i=o=[],n||(a=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],o.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l},h.extend({Deferred:function(e){var t=[["resolve","done",h.Callbacks("once memory"),"resolved"],["reject","fail",h.Callbacks("once memory"),"rejected"],["notify","progress",h.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return h.Deferred(function(n){h.each(t,function(t,a){var o=h.isFunction(e[t])&&e[t];i[a[1]](function(){var e=o&&o.apply(this,arguments);e&&h.isFunction(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[a[0]+"With"](this===r?n.promise():this,o?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?h.extend(e,r):r}},i={};return r.pipe=r.then,h.each(t,function(e,a){var o=a[2],s=a[3];r[a[1]]=o.add,s&&o.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[a[0]]=function(){return i[a[0]+"With"](this===i?r:this,arguments),this},i[a[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t,n,r,a=0,o=i.call(arguments),s=o.length,u=1!==s||e&&h.isFunction(e.promise)?s:0,l=1===u?e:h.Deferred(),c=function(e,n,r){return function(a){n[e]=this,r[e]=arguments.length>1?i.call(arguments):a,r===t?l.notifyWith(n,r):--u||l.resolveWith(n,r)}};if(s>1)for(t=new Array(s),n=new Array(s),r=new Array(s);a0||(R.resolveWith(r,[h]),h.fn.triggerHandler&&(h(r).triggerHandler("ready"),h(r).off("ready"))))}}),h.ready.promise=function(t){return R||(R=h.Deferred(),"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(h.ready):(r.addEventListener("DOMContentLoaded",L),e.addEventListener("load",L))),R.promise(t)},h.ready.promise();var I=function(e,t,n,r,i,a,o){var s=0,u=e.length,l=null==n;if("object"===h.type(n))for(s in i=!0,n)I(e,t,s,n[s],!0,a,o);else if(void 0!==r&&(i=!0,h.isFunction(r)||(o=!0),l&&(o?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(h(e),n)})),t))for(;s-1&&void 0!==n&&O.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){O.remove(this,e)})}}),h.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=N.get(e,t),n&&(!r||h.isArray(n)?r=N.access(e,t,h.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=h.queue(e,t),r=n.length,i=n.shift(),a=h._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete a.stop,i.call(e,function(){h.dequeue(e,t)},a)),!r&&a&&a.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return N.get(e,n)||N.access(e,n,{empty:h.Callbacks("once memory").add(function(){N.remove(e,[t+"queue",n])})})}}),h.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length",""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function X(e,t){var n=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&h.nodeName(e,t)?h.merge([e],n):n}function K(e,t){for(var n=0,r=e.length;n-1)i&&i.push(a);else if(l=h.contains(a.ownerDocument,a),o=X(f.appendChild(a),"script"),l&&K(o),n)for(c=0;a=o[c++];)Y.test(a.type||"")&&n.push(a);return f}J=r.createDocumentFragment().appendChild(r.createElement("div")),(Q=r.createElement("input")).setAttribute("type","radio"),Q.setAttribute("checked","checked"),Q.setAttribute("name","t"),J.appendChild(Q),f.checkClone=J.cloneNode(!0).cloneNode(!0).lastChild.checked,J.innerHTML="",f.noCloneChecked=!!J.cloneNode(!0).lastChild.defaultValue;var ne=/^key/,re=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ie=/^([^.]*)(?:\.(.+)|)/;function ae(){return!0}function oe(){return!1}function se(){try{return r.activeElement}catch(e){}}function ue(e,t,n,r,i,a){var o,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)ue(e,s,n,r,t[s],a);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=oe;else if(!i)return e;return 1===a&&(o=i,(i=function(e){return h().off(e),o.apply(this,arguments)}).guid=o.guid||(o.guid=h.guid++)),e.each(function(){h.event.add(this,t,i,r,n)})}h.event={global:{},add:function(e,t,n,r,i){var a,o,s,u,l,c,f,p,d,g,v,m=N.get(e);if(m)for(n.handler&&(n=(a=n).handler,i=a.selector),n.guid||(n.guid=h.guid++),(u=m.events)||(u=m.events={}),(o=m.handle)||(o=m.handle=function(t){return void 0!==h&&h.event.triggered!==t.type?h.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(j)||[""]).length;l--;)d=v=(s=ie.exec(t[l])||[])[1],g=(s[2]||"").split(".").sort(),d&&(f=h.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=h.event.special[d]||{},c=h.extend({type:d,origType:v,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&h.expr.match.needsContext.test(i),namespace:g.join(".")},a),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,g,o)||e.addEventListener&&e.addEventListener(d,o)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),h.event.global[d]=!0)},remove:function(e,t,n,r,i){var a,o,s,u,l,c,f,p,d,g,v,m=N.hasData(e)&&N.get(e);if(m&&(u=m.events)){for(l=(t=(t||"").match(j)||[""]).length;l--;)if(d=v=(s=ie.exec(t[l])||[])[1],g=(s[2]||"").split(".").sort(),d){for(f=h.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=a=p.length;a--;)c=p[a],!i&&v!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(a,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));o&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,g,m.handle)||h.removeEvent(e,d,m.handle),delete u[d])}else for(d in u)h.event.remove(e,d+t[l],n,r,!0);h.isEmptyObject(u)&&N.remove(e,"handle events")}},dispatch:function(e){e=h.event.fix(e);var t,n,r,a,o,s,u=i.call(arguments),l=(N.get(this,"events")||{})[e.type]||[],c=h.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,e)){for(s=h.event.handlers.call(this,e,l),t=0;(a=s[t++])&&!e.isPropagationStopped();)for(e.currentTarget=a.elem,n=0;(o=a.handlers[n++])&&!e.isImmediatePropagationStopped();)e.rnamespace&&!e.rnamespace.test(o.namespace)||(e.handleObj=o,e.data=o.data,void 0!==(r=((h.event.special[o.origType]||{}).handle||o.handler).apply(a.elem,u))&&!1===(e.result=r)&&(e.preventDefault(),e.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,a,o=[],s=t.delegateCount,u=e.target;if(s&&u.nodeType&&("click"!==e.type||isNaN(e.button)||e.button<1))for(;u!==this;u=u.parentNode||this)if(1===u.nodeType&&(!0!==u.disabled||"click"!==e.type)){for(r=[],n=0;n-1:h.find(i,this,null,[u]).length),r[i]&&r.push(a);r.length&&o.push({elem:u,handlers:r})}return s]*)\/>/gi,ce=/\s*$/g;function de(e,t){return h.nodeName(e,"table")&&h.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ge(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function ve(e){var t=he.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function me(e,t){var n,r,i,a,o,s,u,l;if(1===t.nodeType){if(N.hasData(e)&&(a=N.access(e),o=N.set(t,a),l=a.events))for(i in delete o.handle,o.events={},l)for(n=0,r=l[i].length;n1&&"string"==typeof v&&!f.checkClone&&fe.test(v))return e.each(function(i){var a=e.eq(i);m&&(t[0]=v.call(this,i,a.html())),we(a,t,n,r)});if(d&&(o=(i=te(t,e[0].ownerDocument,!1,e,r)).firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=h.map(X(i,"script"),ge)).length;p")},clone:function(e,t,n){var r,i,a,o,s,u,l,c=e.cloneNode(!0),p=h.contains(e.ownerDocument,e);if(!(f.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||h.isXMLDoc(e)))for(o=X(c),r=0,i=(a=X(e)).length;r0&&K(o,!p&&X(e,"script")),c},cleanData:function(e){for(var t,n,r,i=h.event.special,a=0;void 0!==(n=e[a]);a++)if(B(n)){if(t=n[N.expando]){if(t.events)for(r in t.events)i[r]?h.event.remove(n,r):h.removeEvent(n,r,t.handle);n[N.expando]=void 0}n[O.expando]&&(n[O.expando]=void 0)}}}),h.fn.extend({domManip:we,detach:function(e){return ye(this,e,!0)},remove:function(e){return ye(this,e)},text:function(e){return I(this,function(e){return void 0===e?h.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return we(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||de(this,e).appendChild(e)})},prepend:function(){return we(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=de(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return we(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return we(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(h.cleanData(X(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return h.clone(this,e,t)})},html:function(e){return I(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!ce.test(e)&&!$[(Z.exec(e)||["",""])[1].toLowerCase()]){e=h.htmlPrefilter(e);try{for(;n")).appendTo(t.documentElement))[0].contentDocument).write(),t.close(),n=xe(e,t),_e.detach()),be[e]=n),n}var Ee=/^margin/,Te=new RegExp("^("+U+")(?!px)[a-z%]+$","i"),Ae=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},Se=function(e,t,n,r){var i,a,o={};for(a in t)o[a]=e.style[a],e.style[a]=t[a];for(a in i=n.apply(e,r||[]),t)e.style[a]=o[a];return i},Ce=r.documentElement;function Me(e,t,n){var r,i,a,o,s=e.style;return""!==(o=(n=n||Ae(e))?n.getPropertyValue(t)||n[t]:void 0)&&void 0!==o||h.contains(e.ownerDocument,e)||(o=h.style(e,t)),n&&!f.pixelMarginRight()&&Te.test(o)&&Ee.test(t)&&(r=s.width,i=s.minWidth,a=s.maxWidth,s.minWidth=s.maxWidth=s.width=o,o=n.width,s.width=r,s.minWidth=i,s.maxWidth=a),void 0!==o?o+"":o}function Re(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){var t,n,i,a,o=r.createElement("div"),s=r.createElement("div");function u(){s.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",s.innerHTML="",Ce.appendChild(o);var r=e.getComputedStyle(s);t="1%"!==r.top,a="2px"===r.marginLeft,n="4px"===r.width,s.style.marginRight="50%",i="4px"===r.marginRight,Ce.removeChild(o)}s.style&&(s.style.backgroundClip="content-box",s.cloneNode(!0).style.backgroundClip="",f.clearCloneStyle="content-box"===s.style.backgroundClip,o.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",o.appendChild(s),h.extend(f,{pixelPosition:function(){return u(),t},boxSizingReliable:function(){return null==n&&u(),n},pixelMarginRight:function(){return null==n&&u(),i},reliableMarginLeft:function(){return null==n&&u(),a},reliableMarginRight:function(){var t,n=s.appendChild(r.createElement("div"));return n.style.cssText=s.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",n.style.marginRight=n.style.width="0",s.style.width="1px",Ce.appendChild(o),t=!parseFloat(e.getComputedStyle(n).marginRight),Ce.removeChild(o),s.removeChild(n),t}}))}();var je=/^(none|table(?!-c[ea]).+)/,Le={position:"absolute",visibility:"hidden",display:"block"},Ie={letterSpacing:"0",fontWeight:"400"},Be=["Webkit","O","Moz","ms"],De=r.createElement("div").style;function Ne(e){if(e in De)return e;for(var t=e[0].toUpperCase()+e.slice(1),n=Be.length;n--;)if((e=Be[n]+t)in De)return e}function Oe(e,t,n){var r=q.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Pe(e,t,n,r,i){for(var a=n===(r?"border":"content")?4:"width"===t?1:0,o=0;a<4;a+=2)"margin"===n&&(o+=h.css(e,n+W[a],!0,i)),r?("content"===n&&(o-=h.css(e,"padding"+W[a],!0,i)),"margin"!==n&&(o-=h.css(e,"border"+W[a]+"Width",!0,i))):(o+=h.css(e,"padding"+W[a],!0,i),"padding"!==n&&(o+=h.css(e,"border"+W[a]+"Width",!0,i)));return o}function ze(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,a=Ae(e),o="border-box"===h.css(e,"boxSizing",!1,a);if(i<=0||null==i){if(((i=Me(e,t,a))<0||null==i)&&(i=e.style[t]),Te.test(i))return i;r=o&&(f.boxSizingReliable()||i===e.style[t]),i=parseFloat(i)||0}return i+Pe(e,t,n||(o?"border":"content"),r,a)+"px"}function Fe(e,t){for(var n,r,i,a=[],o=0,s=e.length;o1)},show:function(){return Fe(this,!0)},hide:function(){return Fe(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){H(this)?h(this).show():h(this).hide()})}}),h.Tween=Ue,Ue.prototype={constructor:Ue,init:function(e,t,n,r,i,a){this.elem=e,this.prop=n,this.easing=i||h.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=a||(h.cssNumber[n]?"":"px")},cur:function(){var e=Ue.propHooks[this.prop];return e&&e.get?e.get(this):Ue.propHooks._default.get(this)},run:function(e){var t,n=Ue.propHooks[this.prop];return this.options.duration?this.pos=t=h.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Ue.propHooks._default.set(this),this}},Ue.prototype.init.prototype=Ue.prototype,Ue.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=h.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){h.fx.step[e.prop]?h.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[h.cssProps[e.prop]]&&!h.cssHooks[e.prop]?e.elem[e.prop]=e.now:h.style(e.elem,e.prop,e.now+e.unit)}}},Ue.propHooks.scrollTop=Ue.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},h.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},h.fx=Ue.prototype.init,h.fx.step={};var qe,We,He=/^(?:toggle|show|hide)$/,Ve=/queueHooks$/;function Ge(){return e.setTimeout(function(){qe=void 0}),qe=h.now()}function Ze(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=W[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function Ye(e,t,n){for(var r,i=($e.tweeners[t]||[]).concat($e.tweeners["*"]),a=0,o=i.length;a1)},removeAttr:function(e){return this.each(function(){h.removeAttr(this,e)})}}),h.extend({attr:function(e,t,n){var r,i,a=e.nodeType;if(3!==a&&8!==a&&2!==a)return void 0===e.getAttribute?h.prop(e,t,n):(1===a&&h.isXMLDoc(e)||(t=t.toLowerCase(),i=h.attrHooks[t]||(h.expr.match.bool.test(t)?Xe:void 0)),void 0!==n?null===n?void h.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=h.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!f.radioValue&&"radio"===t&&h.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r,i=0,a=t&&t.match(j);if(a&&1===e.nodeType)for(;n=a[i++];)r=h.propFix[n]||n,h.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)}}),Xe={set:function(e,t,n){return!1===t?h.removeAttr(e,n):e.setAttribute(n,n),n}},h.each(h.expr.match.bool.source.match(/\w+/g),function(e,t){var n=Ke[t]||h.find.attr;Ke[t]=function(e,t,r){var i,a;return r||(a=Ke[t],Ke[t]=i,i=null!=n(e,t,r)?t.toLowerCase():null,Ke[t]=a),i}});var Je=/^(?:input|select|textarea|button)$/i,Qe=/^(?:a|area)$/i;h.fn.extend({prop:function(e,t){return I(this,h.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[h.propFix[e]||e]})}}),h.extend({prop:function(e,t,n){var r,i,a=e.nodeType;if(3!==a&&8!==a&&2!==a)return 1===a&&h.isXMLDoc(e)||(t=h.propFix[t]||t,i=h.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=h.find.attr(e,"tabindex");return t?parseInt(t,10):Je.test(e.nodeName)||Qe.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),f.optSelected||(h.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),h.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){h.propFix[this.toLowerCase()]=this});var et=/[\t\r\n\f]/g;function tt(e){return e.getAttribute&&e.getAttribute("class")||""}h.fn.extend({addClass:function(e){var t,n,r,i,a,o,s,u=0;if(h.isFunction(e))return this.each(function(t){h(this).addClass(e.call(this,t,tt(this)))});if("string"==typeof e&&e)for(t=e.match(j)||[];n=this[u++];)if(i=tt(n),r=1===n.nodeType&&(" "+i+" ").replace(et," ")){for(o=0;a=t[o++];)r.indexOf(" "+a+" ")<0&&(r+=a+" ");i!==(s=h.trim(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,a,o,s,u=0;if(h.isFunction(e))return this.each(function(t){h(this).removeClass(e.call(this,t,tt(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(j)||[];n=this[u++];)if(i=tt(n),r=1===n.nodeType&&(" "+i+" ").replace(et," ")){for(o=0;a=t[o++];)for(;r.indexOf(" "+a+" ")>-1;)r=r.replace(" "+a+" "," ");i!==(s=h.trim(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):h.isFunction(e)?this.each(function(n){h(this).toggleClass(e.call(this,n,tt(this),t),t)}):this.each(function(){var t,r,i,a;if("string"===n)for(r=0,i=h(this),a=e.match(j)||[];t=a[r++];)i.hasClass(t)?i.removeClass(t):i.addClass(t);else void 0!==e&&"boolean"!==n||((t=tt(this))&&N.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":N.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+tt(n)+" ").replace(et," ").indexOf(t)>-1)return!0;return!1}});var nt=/\r/g,rt=/[\x20\t\r\n\f]+/g;h.fn.extend({val:function(e){var t,n,r,i=this[0];return arguments.length?(r=h.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,h(this).val()):e)?i="":"number"==typeof i?i+="":h.isArray(i)&&(i=h.map(i,function(e){return null==e?"":e+""})),(t=h.valHooks[this.type]||h.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))})):i?(t=h.valHooks[i.type]||h.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(nt,""):null==n?"":n:void 0}}),h.extend({valHooks:{option:{get:function(e){var t=h.find.attr(e,"value");return null!=t?t:h.trim(h.text(e)).replace(rt," ")}},select:{get:function(e){for(var t,n,r=e.options,i=e.selectedIndex,a="select-one"===e.type||i<0,o=a?null:[],s=a?i+1:r.length,u=i<0?s:a?i:0;u-1)&&(n=!0);return n||(e.selectedIndex=-1),a}}}}),h.each(["radio","checkbox"],function(){h.valHooks[this]={set:function(e,t){if(h.isArray(t))return e.checked=h.inArray(h(e).val(),t)>-1}},f.checkOn||(h.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var it=/^(?:focusinfocus|focusoutblur)$/;h.extend(h.event,{trigger:function(t,n,i,a){var o,s,u,l,f,p,d,g=[i||r],v=c.call(t,"type")?t.type:t,m=c.call(t,"namespace")?t.namespace.split("."):[];if(s=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!it.test(v+h.event.triggered)&&(v.indexOf(".")>-1&&(v=(m=v.split(".")).shift(),m.sort()),f=v.indexOf(":")<0&&"on"+v,(t=t[h.expando]?t:new h.Event(v,"object"==typeof t&&t)).isTrigger=a?2:3,t.namespace=m.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:h.makeArray(n,[t]),d=h.event.special[v]||{},a||!d.trigger||!1!==d.trigger.apply(i,n))){if(!a&&!d.noBubble&&!h.isWindow(i)){for(l=d.delegateType||v,it.test(l+v)||(s=s.parentNode);s;s=s.parentNode)g.push(s),u=s;u===(i.ownerDocument||r)&&g.push(u.defaultView||u.parentWindow||e)}for(o=0;(s=g[o++])&&!t.isPropagationStopped();)t.type=o>1?l:d.bindType||v,(p=(N.get(s,"events")||{})[t.type]&&N.get(s,"handle"))&&p.apply(s,n),(p=f&&s[f])&&p.apply&&B(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=v,a||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(g.pop(),n)||!B(i)||f&&h.isFunction(i[v])&&!h.isWindow(i)&&((u=i[f])&&(i[f]=null),h.event.triggered=v,i[v](),h.event.triggered=void 0,u&&(i[f]=u)),t.result}},simulate:function(e,t,n){var r=h.extend(new h.Event,n,{type:e,isSimulated:!0});h.event.trigger(r,null,t)}}),h.fn.extend({trigger:function(e,t){return this.each(function(){h.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return h.event.trigger(e,t,n,!0)}}),h.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){h.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),h.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),f.focusin="onfocusin"in e,f.focusin||h.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){h.event.simulate(t,e.target,h.event.fix(e))};h.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=N.access(r,t);i||r.addEventListener(e,n,!0),N.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=N.access(r,t)-1;i?N.access(r,t,i):(r.removeEventListener(e,n,!0),N.remove(r,t))}}});var at=e.location,ot=h.now(),st=/\?/;h.parseJSON=function(e){return JSON.parse(e+"")},h.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||h.error("Invalid XML: "+t),n};var ut=/#.*$/,lt=/([?&])_=[^&]*/,ct=/^(.*?):[ \t]*([^\r\n]*)$/gm,ft=/^(?:GET|HEAD)$/,ht=/^\/\//,pt={},dt={},gt="*/".concat("*"),vt=r.createElement("a");function mt(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,a=t.toLowerCase().match(j)||[];if(h.isFunction(n))for(;r=a[i++];)"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function wt(e,t,n,r){var i={},a=e===dt;function o(s){var u;return i[s]=!0,h.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||a||i[l]?a?!(u=l):void 0:(t.dataTypes.unshift(l),o(l),!1)}),u}return o(t.dataTypes[0])||!i["*"]&&o("*")}function yt(e,t){var n,r,i=h.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&h.extend(!0,e,r),e}vt.href=at.href,h.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:at.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(at.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":gt,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":h.parseJSON,"text xml":h.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?yt(yt(e,h.ajaxSettings),t):yt(h.ajaxSettings,e)},ajaxPrefilter:mt(pt),ajaxTransport:mt(dt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,a,o,s,u,l,c,f,p=h.ajaxSetup({},n),d=p.context||p,g=p.context&&(d.nodeType||d.jquery)?h(d):h.event,v=h.Deferred(),m=h.Callbacks("once memory"),w=p.statusCode||{},y={},_={},b=0,x="canceled",k={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!s)for(s={};t=ct.exec(o);)s[t[1].toLowerCase()]=t[2];t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?o:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=_[n]=_[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(b<2)for(t in e)w[t]=[w[t],e[t]];else k.always(e[k.status]);return this},abort:function(e){var t=e||x;return i&&i.abort(t),E(0,t),this}};if(v.promise(k).complete=m.add,k.success=k.done,k.error=k.fail,p.url=((t||p.url||at.href)+"").replace(ut,"").replace(ht,at.protocol+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=h.trim(p.dataType||"*").toLowerCase().match(j)||[""],null==p.crossDomain){l=r.createElement("a");try{l.href=p.url,l.href=l.href,p.crossDomain=vt.protocol+"//"+vt.host!=l.protocol+"//"+l.host}catch(e){p.crossDomain=!0}}if(p.data&&p.processData&&"string"!=typeof p.data&&(p.data=h.param(p.data,p.traditional)),wt(pt,p,n,k),2===b)return k;for(f in(c=h.event&&p.global)&&0==h.active++&&h.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!ft.test(p.type),a=p.url,p.hasContent||(p.data&&(a=p.url+=(st.test(a)?"&":"?")+p.data,delete p.data),!1===p.cache&&(p.url=lt.test(a)?a.replace(lt,"$1_="+ot++):a+(st.test(a)?"&":"?")+"_="+ot++)),p.ifModified&&(h.lastModified[a]&&k.setRequestHeader("If-Modified-Since",h.lastModified[a]),h.etag[a]&&k.setRequestHeader("If-None-Match",h.etag[a])),(p.data&&p.hasContent&&!1!==p.contentType||n.contentType)&&k.setRequestHeader("Content-Type",p.contentType),k.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+gt+"; q=0.01":""):p.accepts["*"]),p.headers)k.setRequestHeader(f,p.headers[f]);if(p.beforeSend&&(!1===p.beforeSend.call(d,k,p)||2===b))return k.abort();for(f in x="abort",{success:1,error:1,complete:1})k[f](p[f]);if(i=wt(dt,p,n,k)){if(k.readyState=1,c&&g.trigger("ajaxSend",[k,p]),2===b)return k;p.async&&p.timeout>0&&(u=e.setTimeout(function(){k.abort("timeout")},p.timeout));try{b=1,i.send(y,E)}catch(e){if(!(b<2))throw e;E(-1,e)}}else E(-1,"No Transport");function E(t,n,r,s){var l,f,y,_,x,E=n;2!==b&&(b=2,u&&e.clearTimeout(u),i=void 0,o=s||"",k.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(_=function(e,t,n){for(var r,i,a,o,s=e.contents,u=e.dataTypes;"*"===u[0];)u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)a=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){a=i;break}o||(o=i)}a=a||o}if(a)return a!==u[0]&&u.unshift(a),n[a]}(p,k,r)),_=function(e,t,n,r){var i,a,o,s,u,l={},c=e.dataTypes.slice();if(c[1])for(o in e.converters)l[o.toLowerCase()]=e.converters[o];for(a=c.shift();a;)if(e.responseFields[a]&&(n[e.responseFields[a]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=a,a=c.shift())if("*"===a)a=u;else if("*"!==u&&u!==a){if(!(o=l[u+" "+a]||l["* "+a]))for(i in l)if((s=i.split(" "))[1]===a&&(o=l[u+" "+s[0]]||l["* "+s[0]])){!0===o?o=l[i]:!0!==l[i]&&(a=s[0],c.unshift(s[1]));break}if(!0!==o)if(o&&e.throws)t=o(t);else try{t=o(t)}catch(e){return{state:"parsererror",error:o?e:"No conversion from "+u+" to "+a}}}return{state:"success",data:t}}(p,_,k,l),l?(p.ifModified&&((x=k.getResponseHeader("Last-Modified"))&&(h.lastModified[a]=x),(x=k.getResponseHeader("etag"))&&(h.etag[a]=x)),204===t||"HEAD"===p.type?E="nocontent":304===t?E="notmodified":(E=_.state,f=_.data,l=!(y=_.error))):(y=E,!t&&E||(E="error",t<0&&(t=0))),k.status=t,k.statusText=(n||E)+"",l?v.resolveWith(d,[f,E,k]):v.rejectWith(d,[k,E,y]),k.statusCode(w),w=void 0,c&&g.trigger(l?"ajaxSuccess":"ajaxError",[k,p,l?f:y]),m.fireWith(d,[k,E]),c&&(g.trigger("ajaxComplete",[k,p]),--h.active||h.event.trigger("ajaxStop")))}return k},getJSON:function(e,t,n){return h.get(e,t,n,"json")},getScript:function(e,t){return h.get(e,void 0,t,"script")}}),h.each(["get","post"],function(e,t){h[t]=function(e,n,r,i){return h.isFunction(n)&&(i=i||r,r=n,n=void 0),h.ajax(h.extend({url:e,type:t,dataType:i,data:n,success:r},h.isPlainObject(e)&&e))}}),h._evalUrl=function(e){return h.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})},h.fn.extend({wrapAll:function(e){var t;return h.isFunction(e)?this.each(function(t){h(this).wrapAll(e.call(this,t))}):(this[0]&&(t=h(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return h.isFunction(e)?this.each(function(t){h(this).wrapInner(e.call(this,t))}):this.each(function(){var t=h(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=h.isFunction(e);return this.each(function(n){h(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){h.nodeName(this,"body")||h(this).replaceWith(this.childNodes)}).end()}}),h.expr.filters.hidden=function(e){return!h.expr.filters.visible(e)},h.expr.filters.visible=function(e){return e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0};var _t=/%20/g,bt=/\[\]$/,xt=/\r?\n/g,kt=/^(?:submit|button|image|reset|file)$/i,Et=/^(?:input|select|textarea|keygen)/i;function Tt(e,t,n,r){var i;if(h.isArray(t))h.each(t,function(t,i){n||bt.test(e)?r(e,i):Tt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==h.type(t))r(e,t);else for(i in t)Tt(e+"["+i+"]",t[i],n,r)}h.param=function(e,t){var n,r=[],i=function(e,t){t=h.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=h.ajaxSettings&&h.ajaxSettings.traditional),h.isArray(e)||e.jquery&&!h.isPlainObject(e))h.each(e,function(){i(this.name,this.value)});else for(n in e)Tt(n,e[n],t,i);return r.join("&").replace(_t,"+")},h.fn.extend({serialize:function(){return h.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=h.prop(this,"elements");return e?h.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!h(this).is(":disabled")&&Et.test(this.nodeName)&&!kt.test(e)&&(this.checked||!G.test(e))}).map(function(e,t){var n=h(this).val();return null==n?null:h.isArray(n)?h.map(n,function(e){return{name:t.name,value:e.replace(xt,"\r\n")}}):{name:t.name,value:n.replace(xt,"\r\n")}}).get()}}),h.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var At={0:200,1223:204},St=h.ajaxSettings.xhr();f.cors=!!St&&"withCredentials"in St,f.ajax=St=!!St,h.ajaxTransport(function(t){var n,r;if(f.cors||St&&!t.crossDomain)return{send:function(i,a){var o,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(o in t.xhrFields)s[o]=t.xhrFields[o];for(o in t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest"),i)s.setRequestHeader(o,i[o]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?a(0,"error"):a(s.status,s.statusText):a(At[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),h.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return h.globalEval(e),e}}}),h.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),h.ajaxTransport("script",function(e){var t,n;if(e.crossDomain)return{send:function(i,a){t=h("